From 1f232f477d72ffbf1225a031f1444bc4e4b497f7 Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Tue, 30 Dec 2014 15:38:20 +0300 Subject: [PATCH 01/18] add Travis-CI build status icon --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 24fad33b..c0490979 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,9 @@ Some screenshots: http://buggins.github.io/dlangui/screenshots.html [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/buggins/dlangui?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +[![Build Status](https://travis-ci.org/buggins/dlangui.svg?branch=master)](https://travis-ci.org/buggins/dlangui) + + Main features: * Crossplatform (Win32 and Linux are supported in current version); can use SDL2 as a backend. From f0883c5816391c9068f935f7cd0b9ad215919049 Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Tue, 30 Dec 2014 15:50:05 +0300 Subject: [PATCH 02/18] Use master version of dlib to enable jpeg support; enable OPENGL for windows builds --- dub.json | 3 ++- examples/example1/dub.json | 1 + examples/helloworld/dub.json | 1 + examples/tetris/dub.json | 1 + src/dlangui/graphics/images.d | 2 +- 5 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dub.json b/dub.json index 85682f9f..8fe12fc0 100644 --- a/dub.json +++ b/dub.json @@ -21,6 +21,7 @@ "targetType": "staticLibrary", "versions-posix": ["USE_SDL", "USE_OPENGL"], + "versions-windows": ["USE_OPENGL"], "copyFiles": ["res"], @@ -94,7 +95,7 @@ "derelict-sdl2": "~master", "derelict-gl3": "~master", "derelict-ft": "~master", - "dlib": ">=0.4.0" + "dlib": "~master" }, "-ddoxFilterArgs": ["--unittest-examples", "--min-protection=Protected", "--ex", "win32.", "--ex", "src.dlangui"] }, diff --git a/examples/example1/dub.json b/examples/example1/dub.json index e9475fb5..9ac74829 100644 --- a/examples/example1/dub.json +++ b/examples/example1/dub.json @@ -16,6 +16,7 @@ "copyFiles": ["res"], "versions-posix": ["USE_SDL", "USE_OPENGL"], + "versions-windows": ["USE_OPENGL"], "mainSourceFile": "src/main.d", diff --git a/examples/helloworld/dub.json b/examples/helloworld/dub.json index 5339e64b..6fcd6659 100644 --- a/examples/helloworld/dub.json +++ b/examples/helloworld/dub.json @@ -10,6 +10,7 @@ "targetType": "executable", "versions-posix": ["USE_SDL", "USE_OPENGL"], + "versions-windows": ["USE_OPENGL"], "sourceFiles": [ "src/app.d" diff --git a/examples/tetris/dub.json b/examples/tetris/dub.json index 1bd547b4..72fe39c1 100644 --- a/examples/tetris/dub.json +++ b/examples/tetris/dub.json @@ -16,6 +16,7 @@ "copyFiles": ["res"], "versions-posix": ["USE_SDL", "USE_OPENGL"], + "versions-windows": ["USE_OPENGL"], "mainSourceFile": "src/main.d", diff --git a/src/dlangui/graphics/images.d b/src/dlangui/graphics/images.d index d53d96c0..31524545 100644 --- a/src/dlangui/graphics/images.d +++ b/src/dlangui/graphics/images.d @@ -34,7 +34,7 @@ version (USE_DEIMAGE) { version (USE_DLIBIMAGE) { import dlib.image.io.io; import dlib.image.image; - //version = ENABLE_DLIBIMAGE_JPEG; + version = ENABLE_DLIBIMAGE_JPEG; } import dlangui.core.logger; From 466509b7faba002bc3f231b936f4200471ad583a Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Tue, 30 Dec 2014 17:03:42 +0300 Subject: [PATCH 03/18] add empty parameters list constructor support to all widgets - for future usage by factory methods --- src/dlangui/dialogs/filedlg.d | 4 ++++ src/dlangui/graphics/ftfonts.d | 2 ++ src/dlangui/widgets/combobox.d | 5 ++++ src/dlangui/widgets/controls.d | 43 ++++++++++++++++++++++------------ src/dlangui/widgets/editors.d | 10 ++++++++ src/dlangui/widgets/grid.d | 7 +++++- src/dlangui/widgets/layouts.d | 37 +++++++++++++++++++++++++---- src/dlangui/widgets/lists.d | 7 +++++- src/dlangui/widgets/menu.d | 10 ++++++-- src/dlangui/widgets/scroll.d | 7 +++++- src/dlangui/widgets/tabs.d | 15 ++++++++++++ src/dlangui/widgets/tree.d | 14 +++++++++-- src/dlangui/widgets/widget.d | 15 +++++++++--- 13 files changed, 146 insertions(+), 30 deletions(-) diff --git a/src/dlangui/dialogs/filedlg.d b/src/dlangui/dialogs/filedlg.d index 66ceab51..87430317 100644 --- a/src/dlangui/dialogs/filedlg.d +++ b/src/dlangui/dialogs/filedlg.d @@ -314,3 +314,7 @@ class FileDialog : Dialog, CustomGridCellAdapter { _fileList.setFocus(); } } + + +class FilePathPanel : FrameLayout { +} diff --git a/src/dlangui/graphics/ftfonts.d b/src/dlangui/graphics/ftfonts.d index 9aee3f1e..1124a9cf 100644 --- a/src/dlangui/graphics/ftfonts.d +++ b/src/dlangui/graphics/ftfonts.d @@ -205,6 +205,8 @@ private class FreeTypeFontFile { case 0x2039: return '<'; case 0x203A: + case '‣': + case '►': return '>'; case 0x2044: return '/'; diff --git a/src/dlangui/widgets/combobox.d b/src/dlangui/widgets/combobox.d index 099c82b2..ad8944ca 100644 --- a/src/dlangui/widgets/combobox.d +++ b/src/dlangui/widgets/combobox.d @@ -139,6 +139,11 @@ class ComboBox : ComboBoxBase { protected StringListAdapter _adapter; protected EditLine _edit; + /// empty parameter list constructor - for usage by factory + this() { + this(null); + } + /// create with ID parameter this(string ID) { super(ID, (_adapter = new StringListAdapter()), true); } diff --git a/src/dlangui/widgets/controls.d b/src/dlangui/widgets/controls.d index e3b2749e..63b51404 100644 --- a/src/dlangui/widgets/controls.d +++ b/src/dlangui/widgets/controls.d @@ -344,33 +344,40 @@ class Button : Widget { override @property Widget text(dstring s) { _text = s; requestLayout(); return this; } override @property Widget text(UIString s) { _text = s; requestLayout(); return this; } @property Widget textResource(string s) { _text = s; requestLayout(); return this; } - this(string ID = null) { - super(ID); + /// empty parameter list constructor - for usage by factory + this() { + super(null); + init(UIString()); + } + + private void init(UIString label) { styleId = "BUTTON"; + _text = label; clickable = true; focusable = true; trackHover = true; } + + /// create with ID parameter + this(string ID) { + super(ID); + init(UIString()); + } + this(string ID, UIString label) { + super(ID); + init(label); + } this(string ID, dstring label) { super(ID); - _text = label; - styleId = "BUTTON"; - clickable = true; - focusable = true; - trackHover = true; + init(UIString(label)); } this(string ID, string labelResourceId) { super(ID); - _text = labelResourceId; - styleId = "BUTTON"; - clickable = true; - focusable = true; - trackHover = true; + init(UIString(labelResourceId)); } /// constructor from action this(const Action a) { - this("button-action" ~ to!string(a.id)); - _text = a.labelValue; + this("button-action" ~ to!string(a.id), a.labelValue); action = a; } @@ -408,6 +415,7 @@ class AbstractSlider : WidgetGroup { protected int _pageSize = 30; protected int _position = 20; + /// create with ID parameter this(string ID) { super(ID); } @@ -656,7 +664,12 @@ class ScrollBar : AbstractSlider, OnClickHandler { return this; } - this(string ID = null, Orientation orient = Orientation.Vertical) { + /// empty parameter list constructor - for usage by factory + this() { + this(null, Orientation.Vertical); + } + /// create with ID parameter + this(string ID, Orientation orient = Orientation.Vertical) { super(ID); styleId = "SCROLLBAR"; _orientation = orient; diff --git a/src/dlangui/widgets/editors.d b/src/dlangui/widgets/editors.d index 564f89c9..0ebdbee6 100644 --- a/src/dlangui/widgets/editors.d +++ b/src/dlangui/widgets/editors.d @@ -1712,6 +1712,11 @@ class EditWidgetBase : ScrollWidgetBase, EditableContentListener, MenuItemAction /// single line editor class EditLine : EditWidgetBase { + /// empty parameter list constructor - for usage by factory + this() { + this(null); + } + /// create with ID parameter this(string ID, dstring initialContent = null) { super(ID, ScrollBarMode.Invisible, ScrollBarMode.Invisible); _content = new EditableContent(false); @@ -1880,6 +1885,11 @@ class EditLine : EditWidgetBase { /// single line editor class EditBox : EditWidgetBase { + /// empty parameter list constructor - for usage by factory + this() { + this(null); + } + /// create with ID parameter this(string ID, dstring initialContent = null, ScrollBarMode hscrollbarMode = ScrollBarMode.Visible, ScrollBarMode vscrollbarMode = ScrollBarMode.Visible) { super(ID, hscrollbarMode, vscrollbarMode); _content = new EditableContent(true); // multiline diff --git a/src/dlangui/widgets/grid.d b/src/dlangui/widgets/grid.d index c4ef073b..935f6d05 100644 --- a/src/dlangui/widgets/grid.d +++ b/src/dlangui/widgets/grid.d @@ -1163,7 +1163,12 @@ class StringGridWidget : StringGridWidgetBase { protected dstring[] _rowTitles; protected dstring[] _colTitles; - this(string ID = null) { + /// empty parameter list constructor - for usage by factory + this() { + this(null); + } + /// create with ID parameter + this(string ID) { super(ID); styleId = "EDIT_BOX"; } diff --git a/src/dlangui/widgets/layouts.d b/src/dlangui/widgets/layouts.d index 0de1c269..2f8e5a02 100644 --- a/src/dlangui/widgets/layouts.d +++ b/src/dlangui/widgets/layouts.d @@ -278,7 +278,12 @@ class ResizerWidget : Widget { protected string _styleVertical; protected string _styleHorizontal; - this(string ID = null) { + /// empty parameter list constructor - for usage by factory + this() { + this(null); + } + /// create with ID parameter + this(string ID) { super(ID); _styleVertical = "RESIZER_VERTICAL"; _styleHorizontal = "RESIZER_HORIZONTAL"; @@ -461,7 +466,7 @@ class ResizerWidget : Widget { } - +/// Arranges items either vertically or horizontally class LinearLayout : WidgetGroup { protected Orientation _orientation = Orientation.Vertical; /// returns linear layout orientation (Vertical, Horizontal) @@ -469,7 +474,12 @@ class LinearLayout : WidgetGroup { /// sets linear layout orientation @property LinearLayout orientation(Orientation value) { _orientation = value; requestLayout(); return this; } - this(string ID = null) { + /// empty parameter list constructor - for usage by factory + this() { + this(null); + } + /// create with ID parameter + this(string ID) { super(ID); _layoutItems = new LayoutItems(); } @@ -523,15 +533,27 @@ class LinearLayout : WidgetGroup { } +/// Arranges children vertically class VerticalLayout : LinearLayout { - this(string ID = null) { + /// empty parameter list constructor - for usage by factory + this() { + this(null); + } + /// create with ID parameter + this(string ID) { super(ID); orientation = Orientation.Vertical; } } +/// Arranges children horizontally class HorizontalLayout : LinearLayout { - this(string ID = null) { + /// empty parameter list constructor - for usage by factory + this() { + this(null); + } + /// create with ID parameter + this(string ID) { super(ID); orientation = Orientation.Horizontal; } @@ -539,6 +561,11 @@ class HorizontalLayout : LinearLayout { /// place all children into same place (usually, only one child should be visible at a time) class FrameLayout : WidgetGroup { + /// empty parameter list constructor - for usage by factory + this() { + this(null); + } + /// create with ID parameter this(string ID) { super(ID); } diff --git a/src/dlangui/widgets/lists.d b/src/dlangui/widgets/lists.d index 63a4d39f..3d4a8d62 100644 --- a/src/dlangui/widgets/lists.d +++ b/src/dlangui/widgets/lists.d @@ -298,7 +298,12 @@ class ListWidget : WidgetGroup, OnScrollHandler { requestLayout(); } - this(string ID = null, Orientation orientation = Orientation.Vertical) { + /// empty parameter list constructor - for usage by factory + this() { + this(null); + } + /// create with ID parameter + this(string ID, Orientation orientation = Orientation.Vertical) { super(ID); _orientation = orientation; focusable = true; diff --git a/src/dlangui/widgets/menu.d b/src/dlangui/widgets/menu.d index 29def03b..9014514e 100644 --- a/src/dlangui/widgets/menu.d +++ b/src/dlangui/widgets/menu.d @@ -342,8 +342,14 @@ class MenuItemWidget : WidgetGroup { addChild(_label); // accelerator dstring acc = _item.acceleratorText; - if (_item.isSubmenu && !mainMenu) - acc = "‣"d; + if (_item.isSubmenu && !mainMenu) { + version (Windows) { + acc = ">"d; + //acc = "►"d; + } else { + acc = "‣"d; + } + } if (acc !is null) { _accel = new TextWidget("MENU_ACCEL"); _accel.styleId = "MENU_ACCEL"; diff --git a/src/dlangui/widgets/scroll.d b/src/dlangui/widgets/scroll.d index aae03cd1..53c08f67 100644 --- a/src/dlangui/widgets/scroll.d +++ b/src/dlangui/widgets/scroll.d @@ -304,7 +304,12 @@ class ScrollWidget : ScrollWidgetBase { requestLayout(); return this; } - this(string ID = null, ScrollBarMode hscrollbarMode = ScrollBarMode.Visible, ScrollBarMode vscrollbarMode = ScrollBarMode.Visible) { + /// empty parameter list constructor - for usage by factory + this() { + this(null); + } + /// create with ID parameter + this(string ID, ScrollBarMode hscrollbarMode = ScrollBarMode.Visible, ScrollBarMode vscrollbarMode = ScrollBarMode.Visible) { super(ID, hscrollbarMode, vscrollbarMode); } diff --git a/src/dlangui/widgets/tabs.d b/src/dlangui/widgets/tabs.d index 5af2e68e..daaa9a52 100644 --- a/src/dlangui/widgets/tabs.d +++ b/src/dlangui/widgets/tabs.d @@ -177,6 +177,11 @@ class TabControl : WidgetGroup { /// signal of tab change (e.g. by clicking on tab header) Signal!TabHandler onTabChangedListener; + /// empty parameter list constructor - for usage by factory + this() { + this(null); + } + /// create with ID parameter this(string ID) { super(ID); _items = new TabItemList(); @@ -373,6 +378,11 @@ class TabControl : WidgetGroup { /// container for widgets controlled by TabControl class TabHost : FrameLayout, TabHandler { + /// empty parameter list constructor - for usage by factory + this() { + this(null); + } + /// create with ID parameter this(string ID, TabControl tabControl = null) { super(ID); _tabControl = tabControl; @@ -458,6 +468,11 @@ class TabHost : FrameLayout, TabHandler { class TabWidget : VerticalLayout, TabHandler { protected TabControl _tabControl; protected TabHost _tabHost; + /// empty parameter list constructor - for usage by factory + this() { + this(null); + } + /// create with ID parameter this(string ID) { super(ID); _tabControl = new TabControl("TAB_CONTROL"); diff --git a/src/dlangui/widgets/tree.d b/src/dlangui/widgets/tree.d index 59f90f4e..e2140dea 100644 --- a/src/dlangui/widgets/tree.d +++ b/src/dlangui/widgets/tree.d @@ -549,7 +549,12 @@ class TreeWidgetBase : ScrollWidget, OnTreeContentChangeListener, OnTreeStateCh protected bool _needUpdateWidgets; protected bool _needUpdateWidgetStates; - this(string ID = null, ScrollBarMode hscrollbarMode = ScrollBarMode.Visible, ScrollBarMode vscrollbarMode = ScrollBarMode.Visible) { + /// empty parameter list constructor - for usage by factory + this() { + this(null); + } + /// create with ID parameter + this(string ID, ScrollBarMode hscrollbarMode = ScrollBarMode.Visible, ScrollBarMode vscrollbarMode = ScrollBarMode.Visible) { super(ID, hscrollbarMode, vscrollbarMode); contentWidget = new VerticalLayout("TREE_CONTENT"); _tree = new TreeItems(); @@ -737,7 +742,12 @@ class TreeWidgetBase : ScrollWidget, OnTreeContentChangeListener, OnTreeStateCh /// Tree widget with items which can have icons and labels class TreeWidget : TreeWidgetBase { - this(string ID = null) { + /// empty parameter list constructor - for usage by factory + this() { + this(null); + } + /// create with ID parameter + this(string ID) { super(ID); } } diff --git a/src/dlangui/widgets/widget.d b/src/dlangui/widgets/widget.d index 4719b6f2..0860d570 100644 --- a/src/dlangui/widgets/widget.d +++ b/src/dlangui/widgets/widget.d @@ -177,8 +177,12 @@ class Widget { private static int _instanceCount = 0; private static bool _appShuttingDown = false; } - /// create widget, with optional id - this(string ID = null) { + /// empty parameter list constructor - for usage by factory + this() { + this(null); + } + /// create with ID parameter + this(string ID) { _id = ID; _state = State.Enabled; debug(resalloc) _instanceCount++; @@ -1327,7 +1331,12 @@ alias WidgetList = ObjectList!Widget; /** Base class for widgets which have children. */ class WidgetGroup : Widget { - this(string ID = null) { + /// empty parameter list constructor - for usage by factory + this() { + this(null); + } + /// create with ID parameter + this(string ID) { super(ID); } From 4cbf96784b23923e73dcf99308e29c589b2bf064 Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Tue, 30 Dec 2014 18:28:49 +0300 Subject: [PATCH 04/18] fileDialog - path elements panel, in progress --- src/dlangui/core/files.d | 5 ++ src/dlangui/dialogs/filedlg.d | 137 +++++++++++++++++++++++++++++++++- 2 files changed, 141 insertions(+), 1 deletion(-) diff --git a/src/dlangui/core/files.d b/src/dlangui/core/files.d index d895ff6c..a3447a8f 100644 --- a/src/dlangui/core/files.d +++ b/src/dlangui/core/files.d @@ -151,6 +151,11 @@ bool isRoot(string path) { return false; } +/// returns parent directory for specified path +string parentDir(string path) { + return buildNormalizedPath(path, ".."); +} + /// Filters file name by pattern list bool filterFilename(string filename, string[] filters) { return true; diff --git a/src/dlangui/dialogs/filedlg.d b/src/dlangui/dialogs/filedlg.d index 87430317..8b4f1144 100644 --- a/src/dlangui/dialogs/filedlg.d +++ b/src/dlangui/dialogs/filedlg.d @@ -93,7 +93,7 @@ class FileDialog : Dialog, CustomGridCellAdapter { } protected bool upLevel() { - return openDirectory(buildNormalizedPath(_path, ".."), _path); + return openDirectory(parentDir(_path), _path); } protected bool openDirectory(string dir, string selectedItemPath) { @@ -315,6 +315,141 @@ class FileDialog : Dialog, CustomGridCellAdapter { } } +interface OnPathSelectionHandler { + bool onPathSelected(string path); +} + +class FilePathPanelItem : HorizontalLayout { + protected string _path; + protected TextWidget _text; + protected ImageButton _button; + Listener!OnPathSelectionHandler onPathSelectionListener; + this(string path) { + super(null); + _path = path; + string fname = baseName(path); + _text = new TextWidget(null, toUTF32(fname)); + _text.clickable = true; + _text.onClickListener = &onTextClick; + _button = new ImageButton(null, "scrollbar_btn_right"); + _button.focusable = false; + _button.onClickListener = &onButtonClick; + addChild(_text); + addChild(_button); + margins(Rect(2,0,2,0)); + } + private bool onTextClick(Widget src) { + if (onPathSelectionListener.assigned) + return onPathSelectionListener(_path); + return false; + } + private bool onButtonClick(Widget src) { + // TODO: show popup menu with subdirs + return true; + } +} + +class FilePathPanelButtons : WidgetGroup { + protected string _path; + this() { + super(null); + } + void init(string path) { + _path = path; + _children.clear(); + string itemPath = path; + for (;;) { + FilePathPanelItem item = new FilePathPanelItem(itemPath); + addChild(item); + if (isRoot(path)) { + break; + } + itemPath = parentDir(itemPath); + } + } + /// Measure widget according to desired width and height constraints. (Step 1 of two phase layout). + override void measure(int parentWidth, int parentHeight) { + Rect m = margins; + Rect p = padding; + // calc size constraints for children + int pwidth = parentWidth; + int pheight = parentHeight; + if (parentWidth != SIZE_UNSPECIFIED) + pwidth -= m.left + m.right + p.left + p.right; + if (parentHeight != SIZE_UNSPECIFIED) + pheight -= m.top + m.bottom + p.top + p.bottom; + int reservedForEmptySpace = parentWidth / 16; + Point sz; + sz.x += reservedForEmptySpace; + // measure children + bool exceeded = false; + for (int i = 0; i < _children.count; i++) { + Widget item = _children.get(i); + item.visibility = Visibility.Visible; + item.measure(pwidth, pheight); + if (sz.y < item.measuredHeight) + sz.y = item.measuredHeight; + if (sz.x + item.measuredWidth > pwidth) { + exceeded = true; + } + if (!exceeded || i == 0) // at least one item must be visible + sz.x += item.measuredWidth; + else + item.visibility = Visibility.Gone; + } + measuredContent(parentWidth, parentHeight, sz.x, sz.y); + } + /// Set widget rectangle to specified value and layout widget contents. (Step 2 of two phase layout). + override void layout(Rect rc) { + //Log.d("tabControl.layout enter"); + _needLayout = false; + if (visibility == Visibility.Gone) { + return; + } + _pos = rc; + applyMargins(rc); + applyPadding(rc); + + int reservedForEmptySpace = rc.width / 16; + int maxw = rc.width - reservedForEmptySpace; + int totalw = 0; + int visibleItems = 0; + bool exceeded = false; + // measure and update visibility + for (int i = 0; i < _children.count; i++) { + Widget item = _children.get(i); + item.visibility = Visibility.Visible; + item.measure(rc.width, rc.height); + if (totalw + item.measuredWidth > rc.width) { + exceeded = true; + } + if (!exceeded || i == 0) { // at least one item must be visible + totalw += item.measuredWidth; + visibleItems++; + } else + item.visibility = Visibility.Gone; + } + // layout visible items + // backward order + Rect itemRect = rc; + for (int i = visibleItems - 1; i >= 0; i--) { + Widget item = _children.get(i); + int w = item.measuredWidth; + if (i == visibleItems - 1 && w > maxw) + w = maxw; + rc.right = rc.left + w; + item.layout(rc); + rc.left += w; + } + + } + +} class FilePathPanel : FrameLayout { + protected HorizontalLayout _segments; + protected EditLine _edPath; + this(string ID = null) { + super(ID); + } } From bf6d65959d0d51e10cbf1dd3035bdbbe45420d2f Mon Sep 17 00:00:00 2001 From: Andrey Penechko Date: Wed, 31 Dec 2014 03:03:52 +0200 Subject: [PATCH 05/18] Fix C-style arrays. --- 3rdparty/win32/commctrl.d | 22 +- 3rdparty/win32/directx/d3d9.d | 6 +- 3rdparty/win32/directx/d3d9types.d | 4 +- 3rdparty/win32/directx/d3dx9.d | 40 ++-- 3rdparty/win32/directx/dinput8.d | 50 ++--- 3rdparty/win32/docobj.d | 2 +- 3rdparty/win32/imm.d | 10 +- 3rdparty/win32/lmaccess.d | 4 +- 3rdparty/win32/mmsystem.d | 80 +++---- 3rdparty/win32/nb30.d | 2 +- 3rdparty/win32/ntsecpkg.d | 6 +- 3rdparty/win32/oaidl.d | 6 +- 3rdparty/win32/objidl.d | 8 +- 3rdparty/win32/oledlg.d | 32 +-- 3rdparty/win32/oleidl.d | 2 +- 3rdparty/win32/ras.d | 28 +-- 3rdparty/win32/richedit.d | 12 +- 3rdparty/win32/rpcdce.d | 4 +- 3rdparty/win32/rpcndr.d | 8 +- 3rdparty/win32/setupapi.d | 240 ++++++++++----------- 3rdparty/win32/shlobj.d | 30 +-- 3rdparty/win32/sqltypes.d | 2 +- 3rdparty/win32/subauth.d | 8 +- 3rdparty/win32/tlhelp32.d | 8 +- 3rdparty/win32/vfw.d | 30 +-- 3rdparty/win32/winnt.d | 14 +- 3rdparty/win32/winperf.d | 2 +- 3rdparty/win32/winspool.d | 4 +- 3rdparty/win32/winuser.d | 14 +- 3rdparty/win32/wtsapi32.d | 56 ++--- 3rdparty/win32/wtypes.d | 2 +- src/dlangui/graphics/glsupport.d | 2 +- src/dlangui/graphics/images.d | 4 +- src/dlangui/graphics/resources.d | 6 +- src/dlangui/platforms/windows/win32fonts.d | 2 +- src/dlangui/platforms/windows/winapp.d | 150 ++++++------- src/dlangui/platforms/x11/x11app.d | 6 +- 37 files changed, 453 insertions(+), 453 deletions(-) diff --git a/3rdparty/win32/commctrl.d b/3rdparty/win32/commctrl.d index ffdc54a2..b78dad4e 100644 --- a/3rdparty/win32/commctrl.d +++ b/3rdparty/win32/commctrl.d @@ -2834,14 +2834,14 @@ static if (_WIN32_IE >= 0x400) { struct NMCBEDRAGBEGINW { NMHDR hdr; int iItemid; - WCHAR szText[CBEMAXSTRLEN]; + WCHAR[CBEMAXSTRLEN] szText; } alias NMCBEDRAGBEGINW* LPNMCBEDRAGBEGINW, PNMCBEDRAGBEGINW; struct NMCBEDRAGBEGINA { NMHDR hdr; int iItemid; - char szText[CBEMAXSTRLEN]; + char[CBEMAXSTRLEN] szText; } alias NMCBEDRAGBEGINA* LPNMCBEDRAGBEGINA, PNMCBEDRAGBEGINA; @@ -2962,7 +2962,7 @@ struct NMCBEENDEDITW { NMHDR hdr; BOOL fChanged; int iNewSelection; - WCHAR szText[CBEMAXSTRLEN]; + WCHAR[CBEMAXSTRLEN] szText; int iWhy; } alias NMCBEENDEDITW* LPNMCBEENDEDITW, PNMCBEENDEDITW; @@ -2971,7 +2971,7 @@ struct NMCBEENDEDITA { NMHDR hdr; BOOL fChanged; int iNewSelection; - char szText[CBEMAXSTRLEN]; + char[CBEMAXSTRLEN] szText; int iWhy; } alias NMCBEENDEDITA* LPNMCBEENDEDITA, PNMCBEENDEDITA; @@ -2995,9 +2995,9 @@ struct TBBUTTON { BYTE fsState; BYTE fsStyle; version(Win64){ - BYTE bReserved[6]; + BYTE[6] bReserved; } else { - BYTE bReserved[2]; + BYTE[2] bReserved; } DWORD_PTR dwData; INT_PTR iString; @@ -3172,7 +3172,7 @@ struct HD_LAYOUT { RECT* prc; WINDOWPOS* pwpos; } -alias HDLAYOUT* LPHDLAYOUT; +alias HD_LAYOUT* LPHDLAYOUT; deprecated alias HD_LAYOUT HDLAYOUT; struct HD_HITTESTINFO { @@ -3543,7 +3543,7 @@ static if (_WIN32_IE >= 0x300) { struct NMTTDISPINFOA { NMHDR hdr; LPSTR lpszText; - char szText[80]; + char[80] szText; HINSTANCE hinst; UINT uFlags; LPARAM lParam; @@ -3552,7 +3552,7 @@ static if (_WIN32_IE >= 0x300) { struct NMTTDISPINFOW { NMHDR hdr; LPWSTR lpszText; - WCHAR szText[80]; + WCHAR[80] szText; HINSTANCE hinst; UINT uFlags; LPARAM lParam; @@ -3561,7 +3561,7 @@ static if (_WIN32_IE >= 0x300) { struct NMTTDISPINFOA { NMHDR hdr; LPSTR lpszText; - char szText[80]; + char[80] szText; HINSTANCE hinst; UINT uFlags; } @@ -3569,7 +3569,7 @@ static if (_WIN32_IE >= 0x300) { struct NMTTDISPINFOW { NMHDR hdr; LPWSTR lpszText; - WCHAR szText[80]; + WCHAR[80] szText; HINSTANCE hinst; UINT uFlags; } diff --git a/3rdparty/win32/directx/d3d9.d b/3rdparty/win32/directx/d3d9.d index c444745a..a451fb41 100644 --- a/3rdparty/win32/directx/d3d9.d +++ b/3rdparty/win32/directx/d3d9.d @@ -302,7 +302,7 @@ interface LPDIRECT3DDEVICE9 : IUnknown D3DMATRIX ProjectionMatrix; D3DMATRIX ViewMatrix; D3DMATRIX WorldMatrix; - D3DMATRIX TextureMatrices[8]; + D3DMATRIX[8] TextureMatrices; DWORD FVF; UINT VertexSize; @@ -311,8 +311,8 @@ interface LPDIRECT3DDEVICE9 : IUnknown BOOL SoftwareVertexProcessing; D3DMATERIAL9 Material; - D3DLIGHT9 Lights[16]; - BOOL LightsEnabled[16]; + D3DLIGHT9[16] Lights; + BOOL[16] LightsEnabled; D3DGAMMARAMP GammaRamp; RECT ScissorRect; diff --git a/3rdparty/win32/directx/d3d9types.d b/3rdparty/win32/directx/d3d9types.d index 4ce84787..c3c335e3 100644 --- a/3rdparty/win32/directx/d3d9types.d +++ b/3rdparty/win32/directx/d3d9types.d @@ -1708,8 +1708,8 @@ const D3DRTYPECOUNT = D3DRTYPE_INDEXBUFFER+1; struct D3DDEVINFO_RESOURCEMANAGER { //#ifndef WOW64_ENUM_WORKAROUND -// D3DRESOURCESTATS stats[D3DRTYPECOUNT]; - D3DRESOURCESTATS stats[8]; +// D3DRESOURCESTATS[D3DRTYPECOUNT] stats; + D3DRESOURCESTATS[8] stats; } alias D3DDEVINFO_RESOURCEMANAGER* LPD3DDEVINFO_RESOURCEMANAGER; diff --git a/3rdparty/win32/directx/d3dx9.d b/3rdparty/win32/directx/d3dx9.d index d0bc0c9d..0d47824e 100644 --- a/3rdparty/win32/directx/d3dx9.d +++ b/3rdparty/win32/directx/d3dx9.d @@ -160,7 +160,7 @@ align(4) struct D3DXFONT_DESCA BYTE OutputPrecision; BYTE Quality; BYTE PitchAndFamily; - CHAR FaceName[LF_FACESIZE]; + CHAR[LF_FACESIZE] FaceName; } align(4) struct D3DXFONT_DESCW @@ -174,7 +174,7 @@ align(4) struct D3DXFONT_DESCW BYTE OutputPrecision; BYTE Quality; BYTE PitchAndFamily; - WCHAR FaceName[LF_FACESIZE]; + WCHAR[LF_FACESIZE] FaceName; } align(4) struct TEXTMETRICA @@ -1744,36 +1744,36 @@ const char[] XSKINEXP_TEMPLATES = DWORD nIndices; DWORD nOriginalVertices; - array DWORD indices[nIndices]; + array DWORD[nIndices] indices; } template FaceAdjacency { DWORD nIndices; - array DWORD indices[nIndices]; + array DWORD[nIndices] indices; } template SkinWeights { <6F0D123B-BAD2-4167-A0D0-80224F25FABB> STRING transformNodeName; DWORD nWeights; - array DWORD vertexIndices[nWeights]; - array float weights[nWeights]; + array DWORD[nWeights] vertexIndices; + array float[nWeights] weights; Matrix4x4 matrixOffset; } template Patch { DWORD nControlIndices; - array DWORD controlIndices[nControlIndices]; + array DWORD[nControlIndices] controlIndices; } template PatchMesh { DWORD nVertices; - array Vector vertices[nVertices]; + array Vector[nVertices] vertices; DWORD nPatches; - array Patch patches[nPatches]; + array Patch[nPatches] patches; [ ... ] } template PatchMesh9 @@ -1783,16 +1783,16 @@ const char[] XSKINEXP_TEMPLATES = DWORD Degree; DWORD Basis; DWORD nVertices; - array Vector vertices[nVertices]; + array Vector[nVertices] vertices; DWORD nPatches; - array Patch patches[nPatches]; + array Patch[nPatches] patches; [ ... ] } " "template EffectFloats { DWORD nFloats; - array float Floats[nFloats]; + array float[nFloats] Floats; } template EffectString { @@ -1809,7 +1809,7 @@ const char[] XSKINEXP_TEMPLATES = <3014B9A0-62F5-478c-9B86-E4AC9F4E418B> STRING ParamName; DWORD nFloats; - array float Floats[nFloats]; + array float[nFloats] Floats; } " "template EffectParamString { @@ -1841,7 +1841,7 @@ const char[] XSKINEXP_TEMPLATES = FLOAT TicksPerSec; DWORD PlaybackType; DWORD BufferLength; - array DWORD CompressedData[BufferLength]; + array DWORD[BufferLength] CompressedData; } "; const char[] XEXTENSIONS_TEMPLATES = @@ -1851,7 +1851,7 @@ const char[] XEXTENSIONS_TEMPLATES = DWORD dwFVF; DWORD nDWords; - array DWORD data[nDWords]; + array DWORD[nDWords] data; } template VertexElement { @@ -1865,9 +1865,9 @@ const char[] XEXTENSIONS_TEMPLATES = { DWORD nElements; - array VertexElement Elements[nElements]; + array VertexElement[nElements] Elements; DWORD nDWords; - array DWORD data[nDWords]; + array DWORD[nDWords] data; } template PMAttributeRange { @@ -1890,14 +1890,14 @@ const char[] XEXTENSIONS_TEMPLATES = { DWORD nAttributes; - array PMAttributeRange attributeRanges[nAttributes]; + array PMAttributeRange[nAttributes] attributeRanges; DWORD nMaxValence; DWORD nMinLogicalVertices; DWORD nMaxLogicalVertices; DWORD nVSplits; - array PMVSplitRecord splitRecords[nVSplits]; + array PMVSplitRecord[nVSplits] splitRecords; DWORD nAttributeMispredicts; - array DWORD attributeMispredicts[nAttributeMispredicts]; + array DWORD[nAttributeMispredicts] attributeMispredicts; } "; enum : uint diff --git a/3rdparty/win32/directx/dinput8.d b/3rdparty/win32/directx/dinput8.d index e509a571..a6d11785 100644 --- a/3rdparty/win32/directx/dinput8.d +++ b/3rdparty/win32/directx/dinput8.d @@ -24,8 +24,8 @@ struct DIDEVICEINSTANCEA GUID guidInstance; GUID guidProduct; DWORD dwDevType; - CHAR tszInstanceName[MAX_PATH]; - CHAR tszProductName[MAX_PATH]; + CHAR[MAX_PATH] tszInstanceName; + CHAR[MAX_PATH] tszProductName; GUID guidFFDriver; WORD wUsagePage; WORD wUsage; @@ -39,7 +39,7 @@ struct DIDEVICEOBJECTINSTANCEA DWORD dwOfs; DWORD dwType; DWORD dwFlags; - CHAR tszName[MAX_PATH]; + CHAR[MAX_PATH] tszName; DWORD dwFFMaxForce; DWORD dwFFForceResolution; WORD wCollectionNumber; @@ -103,7 +103,7 @@ struct DIACTIONFORMATA HINSTANCE hInstString; FILETIME ftTimeStamp; DWORD dwCRC; - CHAR tszActionMap[MAX_PATH]; + CHAR[MAX_PATH] tszActionMap; } struct DIDEVCAPS @@ -182,7 +182,7 @@ struct DIEFFECTINFOA DWORD dwEffType; DWORD dwStaticParams; DWORD dwDynamicParams; - CHAR tszName[MAX_PATH]; + CHAR[MAX_PATH] tszName; } struct DIFILEEFFECT @@ -190,21 +190,21 @@ struct DIFILEEFFECT DWORD dwSize; GUID GuidEffect; DIEFFECT* lpDiEffect; - CHAR szFriendlyName[MAX_PATH]; + CHAR[MAX_PATH] szFriendlyName; } struct DIDEVICEIMAGEINFOA { - CHAR tszImagePath[MAX_PATH]; - DWORD dwFlags; + CHAR[MAX_PATH] tszImagePath; + DWORD dwFlags; // These are valid if DIDIFT_OVERLAY is present in dwFlags. - DWORD dwViewID; - RECT rcOverlay; - DWORD dwObjID; - DWORD dwcValidPts; - POINT rgptCalloutLine[5]; - RECT rcCalloutRect; - DWORD dwTextAlign; + DWORD dwViewID; + RECT rcOverlay; + DWORD dwObjID; + DWORD dwcValidPts; + POINT[5] rgptCalloutLine; + RECT rcCalloutRect; + DWORD dwTextAlign; } struct DIDEVICEIMAGEINFOHEADERA @@ -250,20 +250,20 @@ struct DIMOUSESTATE2 LONG lX; LONG lY; LONG lZ; - BYTE rgbButtons[8]; + BYTE[8] rgbButtons; } struct DIJOYSTATE { - LONG lX; /* x-axis position */ - LONG lY; /* y-axis position */ - LONG lZ; /* z-axis position */ - LONG lRx; /* x-axis rotation */ - LONG lRy; /* y-axis rotation */ - LONG lRz; /* z-axis rotation */ - LONG rglSlider[2]; /* extra axes positions */ - DWORD rgdwPOV[4]; /* POV directions */ - BYTE rgbButtons[32]; /* 32 buttons */ + LONG lX; /* x-axis position */ + LONG lY; /* y-axis position */ + LONG lZ; /* z-axis position */ + LONG lRx; /* x-axis rotation */ + LONG lRy; /* y-axis rotation */ + LONG lRz; /* z-axis rotation */ + LONG[2] rglSlider; /* extra axes positions */ + DWORD[4] rgdwPOV; /* POV directions */ + BYTE[32] rgbButtons; /* 32 buttons */ } struct DIPROPRANGE diff --git a/3rdparty/win32/docobj.d b/3rdparty/win32/docobj.d index 726f6d61..3d5e30e8 100644 --- a/3rdparty/win32/docobj.d +++ b/3rdparty/win32/docobj.d @@ -74,7 +74,7 @@ struct OLECMDTEXT { DWORD cmdtextf; ULONG cwActual; ULONG cwBuf; - wchar rgwz[1]; + wchar[1] rgwz; } struct OLECMD { diff --git a/3rdparty/win32/imm.d b/3rdparty/win32/imm.d index ee53b6c5..d49cee1f 100644 --- a/3rdparty/win32/imm.d +++ b/3rdparty/win32/imm.d @@ -301,7 +301,7 @@ struct CANDIDATELIST{ DWORD dwSelection; DWORD dwPageStart; DWORD dwPageSize; - DWORD dwOffset[1]; + DWORD[1] dwOffset; } alias CANDIDATELIST* PCANDIDATELIST, LPCANDIDATELIST; @@ -319,13 +319,13 @@ alias REGISTERWORDW* PREGISTERWORDW, LPREGISTERWORDW; struct STYLEBUFA{ DWORD dwStyle; - CHAR szDescription[STYLE_DESCRIPTION_SIZE]; + CHAR[STYLE_DESCRIPTION_SIZE] szDescription; } alias STYLEBUFA* PSTYLEBUFA, LPSTYLEBUFA; struct STYLEBUFW{ DWORD dwStyle; - WCHAR szDescription[STYLE_DESCRIPTION_SIZE]; + WCHAR[STYLE_DESCRIPTION_SIZE] szDescription; } alias STYLEBUFW* PSTYLEBUFW, LPSTYLEBUFW; @@ -337,7 +337,7 @@ struct IMEMENUITEMINFOA{ HBITMAP hbmpChecked; HBITMAP hbmpUnchecked; DWORD dwItemData; - CHAR szString[IMEMENUITEM_STRING_SIZE]; + CHAR[IMEMENUITEM_STRING_SIZE] szString; HBITMAP hbmpItem; } alias IMEMENUITEMINFOA* PIMEMENUITEMINFOA, LPIMEMENUITEMINFOA; @@ -350,7 +350,7 @@ struct IMEMENUITEMINFOW{ HBITMAP hbmpChecked; HBITMAP hbmpUnchecked; DWORD dwItemData; - WCHAR szString[IMEMENUITEM_STRING_SIZE]; + WCHAR[IMEMENUITEM_STRING_SIZE] szString; HBITMAP hbmpItem; } alias IMEMENUITEMINFOW* PIMEMENUITEMINFOW, LPIMEMENUITEMINFOW; diff --git a/3rdparty/win32/lmaccess.d b/3rdparty/win32/lmaccess.d index b49c5c8d..7d236d90 100644 --- a/3rdparty/win32/lmaccess.d +++ b/3rdparty/win32/lmaccess.d @@ -352,13 +352,13 @@ struct USER_INFO_20 { alias USER_INFO_20* PUSER_INFO_20, LPUSER_INFO_20; struct USER_INFO_21 { - BYTE usri21_password[ENCRYPTED_PWLEN]; + BYTE[ENCRYPTED_PWLEN] usri21_password; } alias USER_INFO_21* PUSER_INFO_21, LPUSER_INFO_21; struct USER_INFO_22{ LPWSTR usri22_name; - BYTE usri22_password[ENCRYPTED_PWLEN]; + BYTE[ENCRYPTED_PWLEN] usri22_password; DWORD usri22_password_age; DWORD usri22_priv; LPWSTR usri22_home_dir; diff --git a/3rdparty/win32/mmsystem.d b/3rdparty/win32/mmsystem.d index 0535b382..9a0368ca 100644 --- a/3rdparty/win32/mmsystem.d +++ b/3rdparty/win32/mmsystem.d @@ -1036,7 +1036,7 @@ struct MMTIME { BYTE frame; BYTE fps; BYTE dummy; - BYTE pad[2]; + BYTE[2] pad; }; struct midi { DWORD songptrpos; @@ -1100,7 +1100,7 @@ struct WAVEOUTCAPSA { WORD wMid; WORD wPid; MMVERSION vDriverVersion; - CHAR szPname[MAXPNAMELEN]; + CHAR[MAXPNAMELEN] szPname; DWORD dwFormats; WORD wChannels; WORD wReserved1; @@ -1112,7 +1112,7 @@ struct WAVEOUTCAPSW { WORD wMid; WORD wPid; MMVERSION vDriverVersion; - WCHAR szPname[MAXPNAMELEN]; + WCHAR[MAXPNAMELEN] szPname; DWORD dwFormats; WORD wChannels; WORD wReserved1; @@ -1124,7 +1124,7 @@ struct WAVEINCAPSA { WORD wMid; WORD wPid; MMVERSION vDriverVersion; - CHAR szPname[MAXPNAMELEN]; + CHAR[MAXPNAMELEN] szPname; DWORD dwFormats; WORD wChannels; WORD wReserved1; @@ -1135,7 +1135,7 @@ struct WAVEINCAPSW { WORD wMid; WORD wPid; MMVERSION vDriverVersion; - WCHAR szPname[MAXPNAMELEN]; + WCHAR[MAXPNAMELEN] szPname; DWORD dwFormats; WORD wChannels; WORD wReserved1; @@ -1179,16 +1179,16 @@ alias HMIDIIN* LPHMIDIIN; alias HMIDIOUT* LPHMIDIOUT; alias HMIDISTRM* LPHMIDISTRM; -alias WORD PATCHARRAY[MIDIPATCHSIZE]; +alias WORD[MIDIPATCHSIZE] PATCHARRAY; alias WORD* LPPATCHARRAY; -alias WORD KEYARRAY[MIDIPATCHSIZE]; +alias WORD[MIDIPATCHSIZE] KEYARRAY; alias WORD* LPKEYARRAY; struct MIDIOUTCAPSA { WORD wMid; WORD wPid; MMVERSION vDriverVersion; - CHAR szPname[MAXPNAMELEN]; + CHAR[MAXPNAMELEN] szPname; WORD wTechnology; WORD wVoices; WORD wNotes; @@ -1201,7 +1201,7 @@ struct MIDIOUTCAPSW { WORD wMid; WORD wPid; MMVERSION vDriverVersion; - WCHAR szPname[MAXPNAMELEN]; + WCHAR[MAXPNAMELEN] szPname; WORD wTechnology; WORD wVoices; WORD wNotes; @@ -1214,7 +1214,7 @@ struct MIDIINCAPSA { WORD wMid; WORD wPid; MMVERSION vDriverVersion; - CHAR szPname[MAXPNAMELEN]; + CHAR[MAXPNAMELEN] szPname; DWORD dwSupport; } alias MIDIINCAPSA* PMIDIINCAPSA, LPMIDIINCAPSA; @@ -1223,7 +1223,7 @@ struct MIDIINCAPSW { WORD wMid; WORD wPid; MMVERSION vDriverVersion; - WCHAR szPname[MAXPNAMELEN]; + WCHAR[MAXPNAMELEN] szPname; DWORD dwSupport; } alias MIDIINCAPSW* PMIDIINCAPSW, LPMIDIINCAPSW; @@ -1237,7 +1237,7 @@ struct MIDIHDR { MIDIHDR *lpNext; DWORD reserved; DWORD dwOffset; - DWORD dwReserved[8]; + DWORD[8] dwReserved; } alias MIDIHDR* PMIDIHDR, LPMIDIHDR; @@ -1245,7 +1245,7 @@ struct MIDIEVENT { DWORD dwDeltaTime; DWORD dwStreamID; DWORD dwEvent; - DWORD dwParms[1]; + DWORD[1] dwParms; } struct MIDISTRMBUFFVER { @@ -1270,7 +1270,7 @@ struct AUXCAPSA { WORD wMid; WORD wPid; MMVERSION vDriverVersion; - CHAR szPname[MAXPNAMELEN]; + CHAR[MAXPNAMELEN] szPname; WORD wTechnology; WORD wReserved1; DWORD dwSupport; @@ -1281,7 +1281,7 @@ struct AUXCAPSW { WORD wMid; WORD wPid; MMVERSION vDriverVersion; - WCHAR szPname[MAXPNAMELEN]; + WCHAR[MAXPNAMELEN] szPname; WORD wTechnology; WORD wReserved1; DWORD dwSupport; @@ -1298,7 +1298,7 @@ struct MIXERCAPSA { WORD wMid; WORD wPid; MMVERSION vDriverVersion; - CHAR szPname[MAXPNAMELEN]; + CHAR[MAXPNAMELEN] szPname; DWORD fdwSupport; DWORD cDestinations; } @@ -1308,7 +1308,7 @@ struct MIXERCAPSW { WORD wMid; WORD wPid; MMVERSION vDriverVersion; - WCHAR szPname[MAXPNAMELEN]; + WCHAR[MAXPNAMELEN] szPname; DWORD fdwSupport; DWORD cDestinations; } @@ -1325,15 +1325,15 @@ struct MIXERLINEA { DWORD cChannels; DWORD cConnections; DWORD cControls; - CHAR szShortName[MIXER_SHORT_NAME_CHARS]; - CHAR szName[MIXER_LONG_NAME_CHARS]; + CHAR[MIXER_SHORT_NAME_CHARS] szShortName; + CHAR[MIXER_LONG_NAME_CHARS] szName; struct Target { DWORD dwType; DWORD dwDeviceID; WORD wMid; WORD wPid; MMVERSION vDriverVersion; - CHAR szPname[MAXPNAMELEN]; + CHAR[MAXPNAMELEN] szPname; } } alias MIXERLINEA* PMIXERLINEA, LPMIXERLINEA; @@ -1349,15 +1349,15 @@ struct MIXERLINEW { DWORD cChannels; DWORD cConnections; DWORD cControls; - WCHAR szShortName[MIXER_SHORT_NAME_CHARS]; - WCHAR szName[MIXER_LONG_NAME_CHARS]; + WCHAR[MIXER_SHORT_NAME_CHARS] szShortName; + WCHAR[MIXER_LONG_NAME_CHARS] szName; struct Target { DWORD dwType; DWORD dwDeviceID; WORD wMid; WORD wPid; MMVERSION vDriverVersion; - WCHAR szPname[MAXPNAMELEN]; + WCHAR[MAXPNAMELEN] szPname; } } alias MIXERLINEW* PMIXERLINEW, LPMIXERLINEW; @@ -1368,8 +1368,8 @@ struct MIXERCONTROLA { DWORD dwControlType; DWORD fdwControl; DWORD cMultipleItems; - CHAR szShortName[MIXER_SHORT_NAME_CHARS]; - CHAR szName[MIXER_LONG_NAME_CHARS]; + CHAR[MIXER_SHORT_NAME_CHARS] szShortName; + CHAR[MIXER_LONG_NAME_CHARS] szName; union _Bounds { struct { LONG lMinimum; @@ -1379,13 +1379,13 @@ struct MIXERCONTROLA { DWORD dwMinimum; DWORD dwMaximum; } - DWORD dwReserved[6]; + DWORD[6] dwReserved; } _Bounds Bounds; union _Metrics { DWORD cSteps; DWORD cbCustomData; - DWORD dwReserved[6]; + DWORD[6] dwReserved; } _Metrics Metrics; } @@ -1397,8 +1397,8 @@ struct MIXERCONTROLW { DWORD dwControlType; DWORD fdwControl; DWORD cMultipleItems; - WCHAR szShortName[MIXER_SHORT_NAME_CHARS]; - WCHAR szName[MIXER_LONG_NAME_CHARS]; + WCHAR[MIXER_SHORT_NAME_CHARS] szShortName; + WCHAR[MIXER_LONG_NAME_CHARS] szName; union _Bounds { struct { LONG lMinimum; @@ -1408,13 +1408,13 @@ struct MIXERCONTROLW { DWORD dwMinimum; DWORD dwMaximum; } - DWORD dwReserved[6]; + DWORD[6] dwReserved; } _Bounds Bounds; union _Metrics { DWORD cSteps; DWORD cbCustomData; - DWORD dwReserved[6]; + DWORD[6] dwReserved; } _Metrics Metrics; } @@ -1463,14 +1463,14 @@ alias MIXERCONTROLDETAILS* PMIXERCONTROLDETAILS, LPMIXERCONTROLDETAILS; struct MIXERCONTROLDETAILS_LISTTEXTA { DWORD dwParam1; DWORD dwParam2; - CHAR szName[MIXER_LONG_NAME_CHARS]; + CHAR[MIXER_LONG_NAME_CHARS] szName; } alias MIXERCONTROLDETAILS_LISTTEXTA* PMIXERCONTROLDETAILS_LISTTEXTA, LPMIXERCONTROLDETAILS_LISTTEXTA; struct MIXERCONTROLDETAILS_LISTTEXTW { DWORD dwParam1; DWORD dwParam2; - WCHAR szName[MIXER_LONG_NAME_CHARS]; + WCHAR[MIXER_LONG_NAME_CHARS] szName; } alias MIXERCONTROLDETAILS_LISTTEXTW* PMIXERCONTROLDETAILS_LISTTEXTW, LPMIXERCONTROLDETAILS_LISTTEXTW; @@ -1500,7 +1500,7 @@ alias TIMECAPS* PTIMECAPS, LPTIMECAPS; struct JOYCAPSA { WORD wMid; WORD wPid; - CHAR szPname[MAXPNAMELEN]; + CHAR[MAXPNAMELEN] szPname; UINT wXmin; UINT wXmax; UINT wYmin; @@ -1520,15 +1520,15 @@ struct JOYCAPSA { UINT wMaxAxes; UINT wNumAxes; UINT wMaxButtons; - CHAR szRegKey[MAXPNAMELEN]; - CHAR szOEMVxD[MAX_JOYSTICKOEMVXDNAME]; + CHAR[MAXPNAMELEN] szRegKey; + CHAR[MAX_JOYSTICKOEMVXDNAME] szOEMVxD; } alias JOYCAPSA* PJOYCAPSA, LPJOYCAPSA; struct JOYCAPSW { WORD wMid; WORD wPid; - WCHAR szPname[MAXPNAMELEN]; + WCHAR[MAXPNAMELEN] szPname; UINT wXmin; UINT wXmax; UINT wYmin; @@ -1548,8 +1548,8 @@ struct JOYCAPSW { UINT wMaxAxes; UINT wNumAxes; UINT wMaxButtons; - WCHAR szRegKey[MAXPNAMELEN]; - WCHAR szOEMVxD[MAX_JOYSTICKOEMVXDNAME]; + WCHAR[MAXPNAMELEN] szRegKey; + WCHAR[MAX_JOYSTICKOEMVXDNAME] szOEMVxD; } alias JOYCAPSW* PJOYCAPSW, LPJOYCAPSW; @@ -1598,7 +1598,7 @@ struct MMIOINFO { HPSTR pchEndWrite; LONG lBufOffset; LONG lDiskOffset; - DWORD adwInfo[3]; + DWORD[3] adwInfo; DWORD dwReserved1; DWORD dwReserved2; HMMIO hmmio; diff --git a/3rdparty/win32/nb30.d b/3rdparty/win32/nb30.d index 8f135166..ac8b4c69 100644 --- a/3rdparty/win32/nb30.d +++ b/3rdparty/win32/nb30.d @@ -212,7 +212,7 @@ struct NCB { extern (Windows) void function(NCB*) ncb_post; UCHAR ncb_lana_num; UCHAR ncb_cmd_cplt; - UCHAR ncb_reserve[10]; + UCHAR[10] ncb_reserve; HANDLE ncb_event; } alias NCB* PNCB; diff --git a/3rdparty/win32/ntsecpkg.d b/3rdparty/win32/ntsecpkg.d index 334e62b8..2c249043 100644 --- a/3rdparty/win32/ntsecpkg.d +++ b/3rdparty/win32/ntsecpkg.d @@ -112,7 +112,7 @@ struct SECPKG_SUPPLEMENTAL_CRED { alias SECPKG_SUPPLEMENTAL_CRED* PSECPKG_SUPPLEMENTAL_CRED; struct SECPKG_SUPPLEMENTAL_CRED_ARRAY { ULONG CredentialCount; - SECPKG_SUPPLEMENTAL_CRED Credentials[1]; + SECPKG_SUPPLEMENTAL_CRED[1] Credentials; } alias SECPKG_SUPPLEMENTAL_CRED_ARRAY* PSECPKG_SUPPLEMENTAL_CRED_ARRAY; struct SECPKG_PARAMETERS { @@ -145,12 +145,12 @@ alias SECURITY_USER_DATA* PSECURITY_USER_DATA,PSecurityUserData; alias SECURITY_USER_DATA SecurityUserData; struct SECPKG_GSS_INFO { ULONG EncodedIdLength; - UCHAR EncodedId[4]; + UCHAR[4] EncodedId; } alias SECPKG_GSS_INFO* PSECPKG_GSS_INFO; struct SECPKG_CONTEXT_THUNKS { ULONG InfoLevelCount; - ULONG Levels[1]; + ULONG[1] Levels; } alias SECPKG_CONTEXT_THUNKS* PSECPKG_CONTEXT_THUNKS; struct SECPKG_MUTUAL_AUTH_LEVEL { diff --git a/3rdparty/win32/oaidl.d b/3rdparty/win32/oaidl.d index 8bb869a6..36eb2763 100644 --- a/3rdparty/win32/oaidl.d +++ b/3rdparty/win32/oaidl.d @@ -161,7 +161,7 @@ struct _wireSAFEARRAY { ULONG cbElements; ULONG cLocks; SAFEARRAYUNION uArrayStructs; - SAFEARRAYBOUND rgsabound[1]; + SAFEARRAYBOUND[1] rgsabound; } alias _wireSAFEARRAY* wireSAFEARRAY; @@ -173,7 +173,7 @@ struct SAFEARRAY { ULONG cbElements; ULONG cLocks; PVOID pvData; - SAFEARRAYBOUND rgsabound[1]; + SAFEARRAYBOUND[1] rgsabound; } alias SAFEARRAY* LPSAFEARRAY; @@ -316,7 +316,7 @@ struct TYPEDESC { struct ARRAYDESC { TYPEDESC tdescElem; USHORT cDims; - SAFEARRAYBOUND rgbounds[1]; + SAFEARRAYBOUND[1] rgbounds; } struct PARAMDESCEX { diff --git a/3rdparty/win32/objidl.d b/3rdparty/win32/objidl.d index eaf6e8f8..0a89e261 100644 --- a/3rdparty/win32/objidl.d +++ b/3rdparty/win32/objidl.d @@ -91,7 +91,7 @@ struct DVTARGETDEVICE { WORD tdDeviceNameOffset; WORD tdPortNameOffset; WORD tdExtDevmodeOffset; - BYTE tdData[1]; + BYTE[1] tdData; } struct FORMATETC { @@ -109,7 +109,7 @@ struct RemSTGMEDIUM { ULONG pData; uint pUnkForRelease; uint cbData; - BYTE data[1]; + BYTE[1] data; } struct HLITEM { @@ -226,7 +226,7 @@ struct RPCOLEMESSAGE { PVOID Buffer; ULONG cbBuffer; ULONG iMethod; - PVOID reserved2[5]; + PVOID[5] reserved2; ULONG rpcFlags; } alias RPCOLEMESSAGE* PRPCOLEMESSAGE; @@ -250,7 +250,7 @@ enum MKREDUCE { struct RemSNB { uint ulCntStr; uint ulCntChar; - OLECHAR rgString[1]; + OLECHAR[1] rgString; } enum ADVF { diff --git a/3rdparty/win32/oledlg.d b/3rdparty/win32/oledlg.d index f604d347..29858f0b 100644 --- a/3rdparty/win32/oledlg.d +++ b/3rdparty/win32/oledlg.d @@ -543,7 +543,7 @@ struct OLEUICHANGEICONW { HRSRC hResource; HGLOBAL hMetaPict; CLSID clsid; - WCHAR szIconExe[MAX_PATH]; + WCHAR[MAX_PATH] szIconExe; int cchIconExe; } alias OLEUICHANGEICONW* POLEUICHANGEICONW, LPOLEUICHANGEICONW; @@ -560,7 +560,7 @@ struct OLEUICHANGEICONA { HRSRC hResource; HGLOBAL hMetaPict; CLSID clsid; - CHAR szIconExe[MAX_PATH]; + CHAR[MAX_PATH] szIconExe; int cchIconExe; } alias OLEUICHANGEICONA* POLEUICHANGEICONA, LPOLEUICHANGEICONA; @@ -658,7 +658,7 @@ struct OLEUICHANGESOURCEW { LPCWSTR lpszTemplate; HRSRC hResource; OPENFILENAMEW* lpOFN; - DWORD dwReserved1[4]; + DWORD[4] dwReserved1; LPOLEUILINKCONTAINERW lpOleUILinkContainer; DWORD dwLink; LPWSTR lpszDisplayName; @@ -679,7 +679,7 @@ struct OLEUICHANGESOURCEA { LPCSTR lpszTemplate; HRSRC hResource; OPENFILENAMEA *lpOFN; - DWORD dwReserved1[4]; + DWORD[4] dwReserved1; LPOLEUILINKCONTAINERA lpOleUILinkContainer; DWORD dwLink; LPSTR lpszDisplayName; @@ -752,10 +752,10 @@ alias IOleUILinkInfoA LPOLEUILINKINFOA; struct OLEUIGNRLPROPSW { DWORD cbStruct; DWORD dwFlags; - DWORD dwReserved1[2]; + DWORD[2] dwReserved1; LPFNOLEUIHOOK lpfnHook; LPARAM lCustData; - DWORD dwReserved2[3]; + DWORD[3] dwReserved2; OLEUIOBJECTPROPSW* lpOP; } alias OLEUIGNRLPROPSW* POLEUIGNRLPROPSW, LPOLEUIGNRLPROPSW; @@ -763,10 +763,10 @@ alias OLEUIGNRLPROPSW* POLEUIGNRLPROPSW, LPOLEUIGNRLPROPSW; struct OLEUIGNRLPROPSA { DWORD cbStruct; DWORD dwFlags; - DWORD dwReserved1[2]; + DWORD[2] dwReserved1; LPFNOLEUIHOOK lpfnHook; LPARAM lCustData; - DWORD dwReserved2[3]; + DWORD[3] dwReserved2; OLEUIOBJECTPROPSA* lpOP; } alias OLEUIGNRLPROPSA* POLEUIGNRLPROPSA, LPOLEUIGNRLPROPSA; @@ -774,10 +774,10 @@ alias OLEUIGNRLPROPSA* POLEUIGNRLPROPSA, LPOLEUIGNRLPROPSA; struct OLEUIVIEWPROPSW { DWORD cbStruct; DWORD dwFlags; - DWORD dwReserved1[2]; + DWORD[2] dwReserved1; LPFNOLEUIHOOK lpfnHook; LPARAM lCustData; - DWORD dwReserved2[3]; + DWORD[3] dwReserved2; OLEUIOBJECTPROPSW* lpOP; int nScaleMin; int nScaleMax; @@ -787,10 +787,10 @@ alias OLEUIVIEWPROPSW* POLEUIVIEWPROPSW, LPOLEUIVIEWPROPSW; struct OLEUIVIEWPROPSA { DWORD cbStruct; DWORD dwFlags; - DWORD dwReserved1[2]; + DWORD[2] dwReserved1; LPFNOLEUIHOOK lpfnHook; LPARAM lCustData; - DWORD dwReserved2[3]; + DWORD[3] dwReserved2; OLEUIOBJECTPROPSA *lpOP; int nScaleMin; int nScaleMax; @@ -800,10 +800,10 @@ alias OLEUIVIEWPROPSA* POLEUIVIEWPROPSA, LPOLEUIVIEWPROPSA; struct OLEUILINKPROPSW { DWORD cbStruct; DWORD dwFlags; - DWORD dwReserved1[2]; + DWORD[2] dwReserved1; LPFNOLEUIHOOK lpfnHook; LPARAM lCustData; - DWORD dwReserved2[3]; + DWORD[3] dwReserved2; OLEUIOBJECTPROPSW *lpOP; } alias OLEUILINKPROPSW* POLEUILINKPROPSW, LPOLEUILINKPROPSW; @@ -811,10 +811,10 @@ alias OLEUILINKPROPSW* POLEUILINKPROPSW, LPOLEUILINKPROPSW; struct OLEUILINKPROPSA { DWORD cbStruct; DWORD dwFlags; - DWORD dwReserved1[2]; + DWORD[2] dwReserved1; LPFNOLEUIHOOK lpfnHook; LPARAM lCustData; - DWORD dwReserved2[3]; + DWORD[3] dwReserved2; OLEUIOBJECTPROPSA* lpOP; } alias OLEUILINKPROPSA* POLEUILINKPROPSA, LPOLEUILINKPROPSA; diff --git a/3rdparty/win32/oleidl.d b/3rdparty/win32/oleidl.d index 58660857..681fe7ca 100644 --- a/3rdparty/win32/oleidl.d +++ b/3rdparty/win32/oleidl.d @@ -55,7 +55,7 @@ enum DROPEFFECT { } struct OLEMENUGROUPWIDTHS { - LONG width[6]; + LONG[6] width; } alias OLEMENUGROUPWIDTHS* LPOLEMENUGROUPWIDTHS; diff --git a/3rdparty/win32/ras.d b/3rdparty/win32/ras.d index 28bd4fd5..455193a3 100644 --- a/3rdparty/win32/ras.d +++ b/3rdparty/win32/ras.d @@ -233,7 +233,7 @@ struct RASCONNW { WCHAR szDeviceType[RAS_MaxDeviceType + 1]; WCHAR szDeviceName[RAS_MaxDeviceName + 1]; static if (_WIN32_WINNT >= 0x401) { - WCHAR szPhonebook[MAX_PATH]; + WCHAR[MAX_PATH] szPhonebook; DWORD dwSubEntry; } static if (_WIN32_WINNT >= 0x500) { @@ -253,7 +253,7 @@ struct RASCONNA { CHAR szDeviceType[RAS_MaxDeviceType + 1]; CHAR szDeviceName[RAS_MaxDeviceName + 1]; static if (_WIN32_WINNT >= 0x401) { - CHAR szPhonebook[MAX_PATH]; + CHAR[MAX_PATH] szPhonebook; DWORD dwSubEntry; } static if (_WIN32_WINNT >= 0x500) { @@ -451,7 +451,7 @@ struct RASPPPLCPW{ BOOL fMultilink; DWORD dwTerminateReason; DWORD dwServerTerminateReason; - WCHAR szReplyMessage[RAS_MaxReplyMessage]; + WCHAR[RAS_MaxReplyMessage] szReplyMessage; DWORD dwOptions; DWORD dwServerOptions; } @@ -472,7 +472,7 @@ struct RASPPPLCPA{ BOOL fMultilink; DWORD dwTerminateReason; DWORD dwServerTerminateReason; - CHAR szReplyMessage[RAS_MaxReplyMessage]; + CHAR[RAS_MaxReplyMessage] szReplyMessage; DWORD dwOptions; DWORD dwServerOptions; } @@ -542,9 +542,9 @@ struct RASENTRYW { DWORD dwFrameSize; DWORD dwfNetProtocols; DWORD dwFramingProtocol; - WCHAR szScript[MAX_PATH]; - WCHAR szAutodialDll[MAX_PATH]; - WCHAR szAutodialFunc[MAX_PATH]; + WCHAR[MAX_PATH] szScript; + WCHAR[MAX_PATH] szAutodialDll; + WCHAR[MAX_PATH] szAutodialFunc; WCHAR szDeviceType[RAS_MaxDeviceType + 1]; WCHAR szDeviceName[RAS_MaxDeviceName + 1]; WCHAR szX25PadType[RAS_MaxPadType + 1]; @@ -568,7 +568,7 @@ struct RASENTRYW { DWORD dwEncryptionType; DWORD dwCustomAuthKey; GUID guidId; - WCHAR szCustomDialDll[MAX_PATH]; + WCHAR[MAX_PATH] szCustomDialDll; DWORD dwVpnStrategy; } } @@ -590,9 +590,9 @@ struct RASENTRYA { DWORD dwFrameSize; DWORD dwfNetProtocols; DWORD dwFramingProtocol; - CHAR szScript[MAX_PATH]; - CHAR szAutodialDll[MAX_PATH]; - CHAR szAutodialFunc[MAX_PATH]; + CHAR[MAX_PATH] szScript; + CHAR[MAX_PATH] szAutodialDll; + CHAR[MAX_PATH] szAutodialFunc; CHAR szDeviceType[RAS_MaxDeviceType + 1]; CHAR szDeviceName[RAS_MaxDeviceName + 1]; CHAR szX25PadType[RAS_MaxPadType + 1]; @@ -616,7 +616,7 @@ struct RASENTRYA { DWORD dwEncryptionType; DWORD dwCustomAuthKey; GUID guidId; - CHAR szCustomDialDll[MAX_PATH]; + CHAR[MAX_PATH] szCustomDialDll; DWORD dwVpnStrategy; } } @@ -702,14 +702,14 @@ static if (_WIN32_WINNT >= 0x500) { struct RASEAPUSERIDENTITYW{ WCHAR szUserName[UNLEN + 1]; DWORD dwSizeofEapInfo; - BYTE pbEapInfo[1]; + BYTE[1] pbEapInfo; } alias RASEAPUSERIDENTITYW* LPRASEAPUSERIDENTITYW; struct RASEAPUSERIDENTITYA{ CHAR szUserName[UNLEN + 1]; DWORD dwSizeofEapInfo; - BYTE pbEapInfo[1]; + BYTE[1] pbEapInfo; } alias RASEAPUSERIDENTITYA* LPRASEAPUSERIDENTITYA; diff --git a/3rdparty/win32/richedit.d b/3rdparty/win32/richedit.d index 739742d5..98363dca 100644 --- a/3rdparty/win32/richedit.d +++ b/3rdparty/win32/richedit.d @@ -317,7 +317,7 @@ struct CHARFORMATA { COLORREF crTextColor; BYTE bCharSet; BYTE bPitchAndFamily; - char szFaceName[LF_FACESIZE]; + char[LF_FACESIZE] szFaceName; } struct CHARFORMATW { UINT cbSize = this.sizeof; @@ -328,7 +328,7 @@ struct CHARFORMATW { COLORREF crTextColor; BYTE bCharSet; BYTE bPitchAndFamily; - WCHAR szFaceName[LF_FACESIZE]; + WCHAR[LF_FACESIZE] szFaceName; } struct CHARFORMAT2A { @@ -340,7 +340,7 @@ struct CHARFORMAT2A { COLORREF crTextColor; BYTE bCharSet; BYTE bPitchAndFamily; - char szFaceName[LF_FACESIZE]; + char[LF_FACESIZE] szFaceName; WORD wWeight; SHORT sSpacing; COLORREF crBackColor; @@ -362,7 +362,7 @@ struct CHARFORMAT2W { COLORREF crTextColor; BYTE bCharSet; BYTE bPitchAndFamily; - WCHAR szFaceName[LF_FACESIZE]; + WCHAR[LF_FACESIZE] szFaceName; WORD wWeight; SHORT sSpacing; COLORREF crBackColor; @@ -486,7 +486,7 @@ struct PARAFORMAT { LONG dxOffset; WORD wAlignment; SHORT cTabCount; - LONG rgxTabs[MAX_TAB_STOPS]; + LONG[MAX_TAB_STOPS] rgxTabs; } struct PARAFORMAT2 { @@ -499,7 +499,7 @@ struct PARAFORMAT2 { LONG dxOffset; WORD wAlignment; SHORT cTabCount; - LONG rgxTabs[MAX_TAB_STOPS]; + LONG[MAX_TAB_STOPS] rgxTabs; LONG dySpaceBefore; LONG dySpaceAfter; LONG dyLineSpacing; diff --git a/3rdparty/win32/rpcdce.d b/3rdparty/win32/rpcdce.d index afe812a7..f55fc0bf 100644 --- a/3rdparty/win32/rpcdce.d +++ b/3rdparty/win32/rpcdce.d @@ -118,7 +118,7 @@ alias RPC_BINDING_HANDLE handle_t; struct RPC_BINDING_VECTOR { uint Count; - RPC_BINDING_HANDLE BindingH[1]; + RPC_BINDING_HANDLE[1] BindingH; } alias RPC_BINDING_HANDLE rpc_binding_handle_t; @@ -127,7 +127,7 @@ alias RPC_BINDING_VECTOR rpc_binding_vector_t; struct UUID_VECTOR { uint Count; - UUID* Uuid[1]; + UUID*[1] Uuid; } alias void* RPC_IF_HANDLE; diff --git a/3rdparty/win32/rpcndr.d b/3rdparty/win32/rpcndr.d index c7f96431..d2820501 100644 --- a/3rdparty/win32/rpcndr.d +++ b/3rdparty/win32/rpcndr.d @@ -100,8 +100,8 @@ const cbNDRContext=20; alias void * NDR_CCONTEXT; struct tagNDR_SCONTEXT { - void *pad[2]; - void *userContext; + void*[2] pad; + void* userContext; } alias tagNDR_SCONTEXT * NDR_SCONTEXT; @@ -211,7 +211,7 @@ struct MIDL_STUB_MESSAGE { uint * SizePtrLengthArray; void* pArgQueue; uint dwStubPhase; - uint w2kReserved[5]; + uint[5] w2kReserved; } alias MIDL_STUB_MESSAGE * PMIDL_STUB_MESSAGE; @@ -317,7 +317,7 @@ alias void * PMIDL_XMIT_TYPE; struct MIDL_FORMAT_STRING { short Pad; - ubyte Format[1]; + ubyte[1] Format; } struct MIDL_SERVER_INFO { diff --git a/3rdparty/win32/setupapi.d b/3rdparty/win32/setupapi.d index 45551b3c..3aedeb35 100644 --- a/3rdparty/win32/setupapi.d +++ b/3rdparty/win32/setupapi.d @@ -881,10 +881,10 @@ struct INFCONTEXT { alias INFCONTEXT* PINFCONTEXT; struct SP_INF_INFORMATION { - DWORD InfStyle; - DWORD InfCount; - BYTE _VersionData[1]; - BYTE* VersionData() { return _VersionData.ptr; } + DWORD InfStyle; + DWORD InfCount; + BYTE[1] _VersionData; + BYTE* VersionData() { return _VersionData.ptr; } } alias SP_INF_INFORMATION* PSP_INF_INFORMATION; @@ -899,16 +899,16 @@ struct SP_ALTPLATFORM_INFO { alias SP_ALTPLATFORM_INFO* PSP_ALTPLATFORM_INFO; struct SP_ORIGINAL_FILE_INFO_A { - DWORD cbSize = SP_ORIGINAL_FILE_INFO_A.sizeof; - CHAR OriginalInfName[MAX_PATH]; - CHAR OriginalCatalogName[MAX_PATH]; + DWORD cbSize = SP_ORIGINAL_FILE_INFO_A.sizeof; + CHAR[MAX_PATH] OriginalInfName; + CHAR[MAX_PATH] OriginalCatalogName; } alias SP_ORIGINAL_FILE_INFO_A* PSP_ORIGINAL_FILE_INFO_A; struct SP_ORIGINAL_FILE_INFO_W { - DWORD cbSize = SP_ORIGINAL_FILE_INFO_W.sizeof; - WCHAR OriginalInfName[MAX_PATH]; - WCHAR OriginalCatalogName[MAX_PATH]; + DWORD cbSize = SP_ORIGINAL_FILE_INFO_W.sizeof; + WCHAR[MAX_PATH] OriginalInfName; + WCHAR[MAX_PATH] OriginalCatalogName; } alias SP_ORIGINAL_FILE_INFO_W* PSP_ORIGINAL_FILE_INFO_W; @@ -967,24 +967,24 @@ struct CABINET_INFO_W { alias CABINET_INFO_W* PCABINET_INFO_W; struct FILE_IN_CABINET_INFO_A { - PCSTR NameInCabinet; - DWORD FileSize; - DWORD Win32Error; - WORD DosDate; - WORD DosTime; - WORD DosAttribs; - CHAR FullTargetName[MAX_PATH]; + PCSTR NameInCabinet; + DWORD FileSize; + DWORD Win32Error; + WORD DosDate; + WORD DosTime; + WORD DosAttribs; + CHAR[MAX_PATH] FullTargetName; } alias FILE_IN_CABINET_INFO_A* PFILE_IN_CABINET_INFO_A; struct FILE_IN_CABINET_INFO_W { - PCWSTR NameInCabinet; - DWORD FileSize; - DWORD Win32Error; - WORD DosDate; - WORD DosTime; - WORD DosAttribs; - WCHAR FullTargetName[MAX_PATH]; + PCWSTR NameInCabinet; + DWORD FileSize; + DWORD Win32Error; + WORD DosDate; + WORD DosTime; + WORD DosAttribs; + WCHAR[MAX_PATH] FullTargetName; } alias FILE_IN_CABINET_INFO_W* PFILE_IN_CABINET_INFO_W; @@ -1039,16 +1039,16 @@ deprecated alias SP_DEVICE_INTERFACE_DATA SP_INTERFACE_DEVICE_DATA; deprecated alias SP_DEVICE_INTERFACE_DATA* PSP_INTERFACE_DEVICE_DATA; struct SP_DEVICE_INTERFACE_DETAIL_DATA_A { - DWORD cbSize = SP_DEVICE_INTERFACE_DETAIL_DATA_A.sizeof; - CHAR _DevicePath[1]; - CHAR* DevicePath() { return _DevicePath.ptr; } + DWORD cbSize = SP_DEVICE_INTERFACE_DETAIL_DATA_A.sizeof; + CHAR[1] _DevicePath; + CHAR* DevicePath() { return _DevicePath.ptr; } } alias SP_DEVICE_INTERFACE_DETAIL_DATA_A* PSP_DEVICE_INTERFACE_DETAIL_DATA_A; struct SP_DEVICE_INTERFACE_DETAIL_DATA_W { - DWORD cbSize = SP_DEVICE_INTERFACE_DETAIL_DATA_W.sizeof; - WCHAR _DevicePath[1]; - WCHAR* DevicePath() { return _DevicePath.ptr; } + DWORD cbSize = SP_DEVICE_INTERFACE_DETAIL_DATA_W.sizeof; + WCHAR[1] _DevicePath; + WCHAR* DevicePath() { return _DevicePath.ptr; } } alias SP_DEVICE_INTERFACE_DETAIL_DATA_W* PSP_DEVICE_INTERFACE_DETAIL_DATA_W; @@ -1058,18 +1058,18 @@ deprecated alias SP_DEVICE_INTERFACE_DETAIL_DATA_W SP_INTERFACE_DEVICE_DETAIL_DA deprecated alias SP_DEVICE_INTERFACE_DETAIL_DATA_W* PSP_INTERFACE_DEVICE_DETAIL_DATA_W; struct SP_DEVINFO_LIST_DETAIL_DATA_A { - DWORD cbSize = SP_DEVINFO_LIST_DETAIL_DATA_A.sizeof; - GUID ClassGuid; - HANDLE RemoteMachineHandle; - CHAR RemoteMachineName[SP_MAX_MACHINENAME_LENGTH]; + DWORD cbSize = SP_DEVINFO_LIST_DETAIL_DATA_A.sizeof; + GUID ClassGuid; + HANDLE RemoteMachineHandle; + CHAR[SP_MAX_MACHINENAME_LENGTH] RemoteMachineName; } alias SP_DEVINFO_LIST_DETAIL_DATA_A* PSP_DEVINFO_LIST_DETAIL_DATA_A; struct SP_DEVINFO_LIST_DETAIL_DATA_W { - DWORD cbSize = SP_DEVINFO_LIST_DETAIL_DATA_W.sizeof; - GUID ClassGuid; - HANDLE RemoteMachineHandle; - WCHAR RemoteMachineName[SP_MAX_MACHINENAME_LENGTH]; + DWORD cbSize = SP_DEVINFO_LIST_DETAIL_DATA_W.sizeof; + GUID ClassGuid; + HANDLE RemoteMachineHandle; + WCHAR[SP_MAX_MACHINENAME_LENGTH] RemoteMachineName; } alias SP_DEVINFO_LIST_DETAIL_DATA_W* PSP_DEVINFO_LIST_DETAIL_DATA_W; @@ -1086,7 +1086,7 @@ struct SP_DEVINSTALL_PARAMS_A { HSPFILEQ FileQueue; ULONG_PTR ClassInstallReserved; DWORD Reserved; - CHAR DriverPath[MAX_PATH]; + CHAR[MAX_PATH] DriverPath; } alias SP_DEVINSTALL_PARAMS_A* PSP_DEVINSTALL_PARAMS_A; @@ -1100,7 +1100,7 @@ struct SP_DEVINSTALL_PARAMS_W { HSPFILEQ FileQueue; ULONG_PTR ClassInstallReserved; DWORD Reserved; - WCHAR DriverPath[MAX_PATH]; + WCHAR[MAX_PATH] DriverPath; } alias SP_DEVINSTALL_PARAMS_W* PSP_DEVINSTALL_PARAMS_W; @@ -1146,21 +1146,21 @@ struct SP_UNREMOVEDEVICE_PARAMS { alias SP_UNREMOVEDEVICE_PARAMS* PSP_UNREMOVEDEVICE_PARAMS; struct SP_SELECTDEVICE_PARAMS_A { - SP_CLASSINSTALL_HEADER ClassInstallHeader; - CHAR Title[MAX_TITLE_LEN]; - CHAR Instructions[MAX_INSTRUCTION_LEN]; - CHAR ListLabel[MAX_LABEL_LEN]; - CHAR SubTitle[MAX_SUBTITLE_LEN]; - BYTE Reserved[2]; + SP_CLASSINSTALL_HEADER ClassInstallHeader; + CHAR[MAX_TITLE_LEN] Title; + CHAR[MAX_INSTRUCTION_LEN] Instructions; + CHAR[MAX_LABEL_LEN] ListLabel; + CHAR[MAX_SUBTITLE_LEN] SubTitle; + BYTE[2] Reserved; } alias SP_SELECTDEVICE_PARAMS_A* PSP_SELECTDEVICE_PARAMS_A; struct SP_SELECTDEVICE_PARAMS_W { - SP_CLASSINSTALL_HEADER ClassInstallHeader; - WCHAR Title[MAX_TITLE_LEN]; - WCHAR Instructions[MAX_INSTRUCTION_LEN]; - WCHAR ListLabel[MAX_LABEL_LEN]; - WCHAR SubTitle[MAX_SUBTITLE_LEN]; + SP_CLASSINSTALL_HEADER ClassInstallHeader; + WCHAR[MAX_TITLE_LEN] Title; + WCHAR[MAX_INSTRUCTION_LEN] Instructions; + WCHAR[MAX_LABEL_LEN] ListLabel; + WCHAR[MAX_SUBTITLE_LEN] SubTitle; } alias SP_SELECTDEVICE_PARAMS_W* PSP_SELECTDEVICE_PARAMS_W; @@ -1174,23 +1174,23 @@ struct SP_DETECTDEVICE_PARAMS { alias SP_DETECTDEVICE_PARAMS* PSP_DETECTDEVICE_PARAMS; struct SP_INSTALLWIZARD_DATA { - SP_CLASSINSTALL_HEADER ClassInstallHeader; - DWORD Flags; - HPROPSHEETPAGE DynamicPages[MAX_INSTALLWIZARD_DYNAPAGES]; - DWORD NumDynamicPages; - DWORD DynamicPageFlags; - DWORD PrivateFlags; - LPARAM PrivateData; - HWND hwndWizardDlg; + SP_CLASSINSTALL_HEADER ClassInstallHeader; + DWORD Flags; + HPROPSHEETPAGE[MAX_INSTALLWIZARD_DYNAPAGES] DynamicPages; + DWORD NumDynamicPages; + DWORD DynamicPageFlags; + DWORD PrivateFlags; + LPARAM PrivateData; + HWND hwndWizardDlg; } alias SP_INSTALLWIZARD_DATA* PSP_INSTALLWIZARD_DATA; struct SP_NEWDEVICEWIZARD_DATA { - SP_CLASSINSTALL_HEADER ClassInstallHeader; - DWORD Flags; - HPROPSHEETPAGE DynamicPages[MAX_INSTALLWIZARD_DYNAPAGES]; - DWORD NumDynamicPages; - HWND hwndWizardDlg; + SP_CLASSINSTALL_HEADER ClassInstallHeader; + DWORD Flags; + HPROPSHEETPAGE[MAX_INSTALLWIZARD_DYNAPAGES] DynamicPages; + DWORD NumDynamicPages; + HWND hwndWizardDlg; } alias SP_NEWDEVICEWIZARD_DATA* PSP_NEWDEVICEWIZARD_DATA; alias SP_NEWDEVICEWIZARD_DATA SP_ADDPROPERTYPAGE_DATA; @@ -1198,15 +1198,15 @@ alias SP_NEWDEVICEWIZARD_DATA* PSP_ADDPROPERTYPAGE_DATA; struct SP_TROUBLESHOOTER_PARAMS_A { SP_CLASSINSTALL_HEADER ClassInstallHeader; - CHAR ChmFile[MAX_PATH]; - CHAR HtmlTroubleShooter[MAX_PATH]; + CHAR[MAX_PATH] ChmFile; + CHAR[MAX_PATH] HtmlTroubleShooter; } alias SP_TROUBLESHOOTER_PARAMS_A* PSP_TROUBLESHOOTER_PARAMS_A; struct SP_TROUBLESHOOTER_PARAMS_W { SP_CLASSINSTALL_HEADER ClassInstallHeader; - WCHAR ChmFile[MAX_PATH]; - WCHAR HtmlTroubleShooter[MAX_PATH]; + WCHAR[MAX_PATH] ChmFile; + WCHAR[MAX_PATH] HtmlTroubleShooter; } alias SP_TROUBLESHOOTER_PARAMS_W* PSP_TROUBLESHOOTER_PARAMS_W; @@ -1223,46 +1223,46 @@ struct SP_POWERMESSAGEWAKE_PARAMS_W { alias SP_POWERMESSAGEWAKE_PARAMS_W* PSP_POWERMESSAGEWAKE_PARAMS_W; struct SP_DRVINFO_DATA_V2_A { - DWORD cbSize = SP_DRVINFO_DATA_V2_A.sizeof; - DWORD DriverType; - ULONG_PTR Reserved; - CHAR Description[LINE_LEN]; - CHAR MfgName[LINE_LEN]; - CHAR ProviderName[LINE_LEN]; - FILETIME DriverDate; - DWORDLONG DriverVersion; + DWORD cbSize = SP_DRVINFO_DATA_V2_A.sizeof; + DWORD DriverType; + ULONG_PTR Reserved; + CHAR[LINE_LEN] Description; + CHAR[LINE_LEN] MfgName; + CHAR[LINE_LEN] ProviderName; + FILETIME DriverDate; + DWORDLONG DriverVersion; } alias SP_DRVINFO_DATA_V2_A* PSP_DRVINFO_DATA_V2_A; struct SP_DRVINFO_DATA_V2_W { - DWORD cbSize = SP_DRVINFO_DATA_V2_A.sizeof; - DWORD DriverType; - ULONG_PTR Reserved; - WCHAR Description[LINE_LEN]; - WCHAR MfgName[LINE_LEN]; - WCHAR ProviderName[LINE_LEN]; - FILETIME DriverDate; - DWORDLONG DriverVersion; + DWORD cbSize = SP_DRVINFO_DATA_V2_A.sizeof; + DWORD DriverType; + ULONG_PTR Reserved; + WCHAR[LINE_LEN] Description; + WCHAR[LINE_LEN] MfgName; + WCHAR[LINE_LEN] ProviderName; + FILETIME DriverDate; + DWORDLONG DriverVersion; } alias SP_DRVINFO_DATA_V2_W* PSP_DRVINFO_DATA_V2_W; struct SP_DRVINFO_DATA_V1_A { - DWORD cbSize = SP_DRVINFO_DATA_V1_A.sizeof; - DWORD DriverType; - ULONG_PTR Reserved; - CHAR Description[LINE_LEN]; - CHAR MfgName[LINE_LEN]; - CHAR ProviderName[LINE_LEN]; + DWORD cbSize = SP_DRVINFO_DATA_V1_A.sizeof; + DWORD DriverType; + ULONG_PTR Reserved; + CHAR[LINE_LEN] Description; + CHAR[LINE_LEN] MfgName; + CHAR[LINE_LEN] ProviderName; } alias SP_DRVINFO_DATA_V1_A* PSP_DRVINFO_DATA_V1_A; struct SP_DRVINFO_DATA_V1_W { - DWORD cbSize = SP_DRVINFO_DATA_V1_W.sizeof; - DWORD DriverType; - ULONG_PTR Reserved; - WCHAR Description[LINE_LEN]; - WCHAR MfgName[LINE_LEN]; - WCHAR ProviderName[LINE_LEN]; + DWORD cbSize = SP_DRVINFO_DATA_V1_W.sizeof; + DWORD DriverType; + ULONG_PTR Reserved; + WCHAR[LINE_LEN] Description; + WCHAR[LINE_LEN] MfgName; + WCHAR[LINE_LEN] ProviderName; } alias SP_DRVINFO_DATA_V1_W* PSP_DRVINFO_DATA_V1_W; @@ -1295,29 +1295,29 @@ static if(USE_SP_DRVINFO_DATA_V1) { extern(Windows) alias DWORD function(HDEVINFO, PSP_DEVINFO_DATA, PSP_DEVINFO_DATA, PVOID) PSP_DETSIG_CMPPROC; struct SP_DRVINFO_DETAIL_DATA_A { - DWORD cbSize = SP_DRVINFO_DETAIL_DATA_A.sizeof; - FILETIME InfDate; - DWORD CompatIDsOffset; - DWORD CompatIDsLength; - ULONG_PTR Reserved; - CHAR SectionName[LINE_LEN]; - CHAR InfFileName[MAX_PATH]; - CHAR DrvDescription[LINE_LEN]; - CHAR _HardwareID[1]; + DWORD cbSize = SP_DRVINFO_DETAIL_DATA_A.sizeof; + FILETIME InfDate; + DWORD CompatIDsOffset; + DWORD CompatIDsLength; + ULONG_PTR Reserved; + CHAR[LINE_LEN] SectionName; + CHAR[MAX_PATH] InfFileName; + CHAR[LINE_LEN] DrvDescription; + CHAR[1] _HardwareID; CHAR* HardwareID() { return _HardwareID.ptr; } } alias SP_DRVINFO_DETAIL_DATA_A* PSP_DRVINFO_DETAIL_DATA_A; struct SP_DRVINFO_DETAIL_DATA_W { - DWORD cbSize = SP_DRVINFO_DETAIL_DATA_W.sizeof; - FILETIME InfDate; - DWORD CompatIDsOffset; - DWORD CompatIDsLength; - ULONG_PTR Reserved; - WCHAR SectionName[LINE_LEN]; - WCHAR InfFileName[MAX_PATH]; - WCHAR DrvDescription[LINE_LEN]; - WCHAR _HardwareID[1]; + DWORD cbSize = SP_DRVINFO_DETAIL_DATA_W.sizeof; + FILETIME InfDate; + DWORD CompatIDsOffset; + DWORD CompatIDsLength; + ULONG_PTR Reserved; + WCHAR[LINE_LEN] SectionName; + WCHAR[MAX_PATH] InfFileName; + WCHAR[LINE_LEN] DrvDescription; + WCHAR[1] _HardwareID; WCHAR* HardwareID() { return _HardwareID.ptr; } } alias SP_DRVINFO_DETAIL_DATA_W* PSP_DRVINFO_DETAIL_DATA_W; @@ -1354,16 +1354,16 @@ struct SP_PROPSHEETPAGE_REQUEST { alias SP_PROPSHEETPAGE_REQUEST* PSP_PROPSHEETPAGE_REQUEST; struct SP_BACKUP_QUEUE_PARAMS_A { - DWORD cbSize = SP_BACKUP_QUEUE_PARAMS_A.sizeof; - CHAR FullInfPath[MAX_PATH]; - INT FilenameOffset; + DWORD cbSize = SP_BACKUP_QUEUE_PARAMS_A.sizeof; + CHAR[MAX_PATH] FullInfPath; + INT FilenameOffset; } alias SP_BACKUP_QUEUE_PARAMS_A* PSP_BACKUP_QUEUE_PARAMS_A; struct SP_BACKUP_QUEUE_PARAMS_W { - DWORD cbSize = SP_BACKUP_QUEUE_PARAMS_W.sizeof; - WCHAR FullInfPath[MAX_PATH]; - INT FilenameOffset; + DWORD cbSize = SP_BACKUP_QUEUE_PARAMS_W.sizeof; + WCHAR[MAX_PATH] FullInfPath; + INT FilenameOffset; } alias SP_BACKUP_QUEUE_PARAMS_W* PSP_BACKUP_QUEUE_PARAMS_W; diff --git a/3rdparty/win32/shlobj.d b/3rdparty/win32/shlobj.d index 7ac879b7..7aaa90c6 100644 --- a/3rdparty/win32/shlobj.d +++ b/3rdparty/win32/shlobj.d @@ -477,7 +477,7 @@ struct STRRET { union { LPWSTR pOleStr; UINT uOffset; - char cStr[MAX_PATH]; + char[MAX_PATH] cStr; } } alias STRRET* LPSTRRET; @@ -504,7 +504,7 @@ struct FILEDESCRIPTORA { FILETIME ftLastWriteTime; DWORD nFileSizeHigh; DWORD nFileSizeLow; - CHAR cFileName[MAX_PATH]; + CHAR[MAX_PATH] cFileName; } alias FILEDESCRIPTORA* LPFILEDESCRIPTORA; @@ -519,19 +519,19 @@ struct FILEDESCRIPTORW { FILETIME ftLastWriteTime; DWORD nFileSizeHigh; DWORD nFileSizeLow; - WCHAR cFileName[MAX_PATH]; + WCHAR[MAX_PATH] cFileName; } alias FILEDESCRIPTORW* LPFILEDESCRIPTORW; struct FILEGROUPDESCRIPTORA { UINT cItems; - FILEDESCRIPTORA fgd[1]; + FILEDESCRIPTORA[1] fgd; } alias FILEGROUPDESCRIPTORA* LPFILEGROUPDESCRIPTORA; struct FILEGROUPDESCRIPTORW { UINT cItems; - FILEDESCRIPTORW fgd[1]; + FILEDESCRIPTORW[1] fgd; } alias FILEGROUPDESCRIPTORW* LPFILEGROUPDESCRIPTORW; @@ -591,13 +591,13 @@ struct FVSHOWINFO { DWORD dwFlags; RECT rect; LPUNKNOWN punkRel; - OLECHAR strNewFile[MAX_PATH]; + OLECHAR[MAX_PATH] strNewFile; } alias FVSHOWINFO* LPFVSHOWINFO; struct NRESARRAY { UINT cItems; - NETRESOURCE nr[1]; + NETRESOURCE[1] nr; } alias NRESARRAY* LPNRESARRAY; @@ -629,8 +629,8 @@ static if (_WIN32_IE >= 0x500) { struct EXTRASEARCH { GUID guidSearch; - WCHAR wszFriendlyName[80]; - WCHAR wszUrl[2084]; + WCHAR[80] wszFriendlyName; + WCHAR[2084] wszUrl; } alias EXTRASEARCH* LPEXTRASEARCH; @@ -653,8 +653,8 @@ static if (_WIN32_IE >= 0x500) { struct PERSIST_FOLDER_TARGET_INFO { LPITEMIDLIST pidlTargetFolder; - WCHAR szTargetParsingName[MAX_PATH]; - WCHAR szNetworkProvider[MAX_PATH]; + WCHAR[MAX_PATH] szTargetParsingName; + WCHAR[MAX_PATH] szNetworkProvider; DWORD dwAttributes; int csidl; } @@ -696,7 +696,7 @@ static if (_WIN32_IE >= 0x500) { struct SHCOLUMNINIT { ULONG dwFlags; ULONG dwReserved; - WCHAR wszFolder[MAX_PATH]; + WCHAR[MAX_PATH] wszFolder; } alias SHCOLUMNINIT* LPSHCOLUMNINIT; alias const(SHCOLUMNINIT)* LPCSHCOLUMNINIT; @@ -706,7 +706,7 @@ static if (_WIN32_IE >= 0x500) { DWORD dwFileAttributes; ULONG dwReserved; WCHAR *pwszExt; - WCHAR wszFile[MAX_PATH]; + WCHAR[MAX_PATH] wszFile; } alias SHCOLUMNDATA* LPSHCOLUMNDATA; alias const(SHCOLUMNDATA)* LPCSHCOLUMNDATA; @@ -721,8 +721,8 @@ static if (_WIN32_IE >= 0x500) { DWORD fmt; UINT cChars; DWORD csFlags; - WCHAR wszTitle[MAX_COLUMN_NAME_LEN]; - WCHAR wszDescription[MAX_COLUMN_DESC_LEN]; + WCHAR[MAX_COLUMN_NAME_LEN] wszTitle; + WCHAR[MAX_COLUMN_DESC_LEN] wszDescription; } alias SHCOLUMNINFO* LPSHCOLUMNINFO; alias const(SHCOLUMNINFO)* LPCSHCOLUMNINFO; diff --git a/3rdparty/win32/sqltypes.d b/3rdparty/win32/sqltypes.d index e33d193e..bf5ec275 100644 --- a/3rdparty/win32/sqltypes.d +++ b/3rdparty/win32/sqltypes.d @@ -137,7 +137,7 @@ struct SQL_NUMERIC_STRUCT { SQLCHAR precision; SQLSCHAR scale; SQLCHAR sign; - SQLCHAR val[SQL_MAX_NUMERIC_LEN]; + SQLCHAR[SQL_MAX_NUMERIC_LEN] val; } // } ODBCVER >= 0x0300 alias GUID SQLGUID; diff --git a/3rdparty/win32/subauth.d b/3rdparty/win32/subauth.d index 53a74430..8230f84e 100644 --- a/3rdparty/win32/subauth.d +++ b/3rdparty/win32/subauth.d @@ -132,22 +132,22 @@ const USER_SESSION_KEY_LENGTH = CYPHER_BLOCK_LENGTH * 2; const CLEAR_BLOCK_LENGTH = 8; struct CYPHER_BLOCK { - CHAR data[CYPHER_BLOCK_LENGTH]; + CHAR[CYPHER_BLOCK_LENGTH] data; } alias CYPHER_BLOCK* PCYPHER_BLOCK; struct CLEAR_BLOCK { - CHAR data[CLEAR_BLOCK_LENGTH]; + CHAR[CLEAR_BLOCK_LENGTH] data; } alias CLEAR_BLOCK* PCLEAR_BLOCK; struct LM_OWF_PASSWORD { - CYPHER_BLOCK data[2]; + CYPHER_BLOCK[2] data; } alias LM_OWF_PASSWORD* PLM_OWF_PASSWORD; struct USER_SESSION_KEY { - CYPHER_BLOCK data[2]; + CYPHER_BLOCK[2] data; } alias USER_SESSION_KEY* PUSER_SESSION_KEY; diff --git a/3rdparty/win32/tlhelp32.d b/3rdparty/win32/tlhelp32.d index 3e5a75cd..9f9e1d57 100644 --- a/3rdparty/win32/tlhelp32.d +++ b/3rdparty/win32/tlhelp32.d @@ -67,7 +67,7 @@ struct PROCESSENTRY32W { DWORD th32ParentProcessID; LONG pcPriClassBase; DWORD dwFlags; - WCHAR szExeFile[MAX_PATH]; + WCHAR[MAX_PATH] szExeFile; } alias PROCESSENTRY32W* PPROCESSENTRY32W; alias PROCESSENTRY32W* LPPROCESSENTRY32W; @@ -94,7 +94,7 @@ struct MODULEENTRY32W { DWORD modBaseSize; HMODULE hModule; WCHAR szModule[MAX_MODULE_NAME32 + 1]; - WCHAR szExePath[MAX_PATH]; + WCHAR[MAX_PATH] szExePath; } alias MODULEENTRY32W* PMODULEENTRY32W; alias MODULEENTRY32W* LPMODULEENTRY32W; @@ -118,7 +118,7 @@ version(Unicode) { DWORD th32ParentProcessID; LONG pcPriClassBase; DWORD dwFlags; - CHAR szExeFile[MAX_PATH]; + CHAR[MAX_PATH] szExeFile; } alias PROCESSENTRY32* PPROCESSENTRY32; alias PROCESSENTRY32* LPPROCESSENTRY32; @@ -133,7 +133,7 @@ version(Unicode) { DWORD modBaseSize; HMODULE hModule; char szModule[MAX_MODULE_NAME32 + 1]; - char szExePath[MAX_PATH]; + char[MAX_PATH] szExePath; } alias MODULEENTRY32* PMODULEENTRY32; alias MODULEENTRY32* LPMODULEENTRY32; diff --git a/3rdparty/win32/vfw.d b/3rdparty/win32/vfw.d index 9ead25cf..20702c88 100644 --- a/3rdparty/win32/vfw.d +++ b/3rdparty/win32/vfw.d @@ -181,15 +181,15 @@ struct ICOPEN { } struct ICINFO { - DWORD dwSize; - DWORD fccType; - DWORD fccHandler; - DWORD dwFlags; - DWORD dwVersion; - DWORD dwVersionICM; - WCHAR szName[16]; - WCHAR szDescription[128]; - WCHAR szDriver[128]; + DWORD dwSize; + DWORD fccType; + DWORD fccHandler; + DWORD dwFlags; + DWORD dwVersion; + DWORD dwVersionICM; + WCHAR[16] szName; + WCHAR[128] szDescription; + WCHAR[128] szDriver; } enum { @@ -819,7 +819,7 @@ struct MainAVIHeader { DWORD dwSuggestedBufferSize; DWORD dwWidth; DWORD dwHeight; - DWORD dwReserved[4]; + DWORD[4] dwReserved; } const AVISF_DISABLED = 0x00000001; @@ -885,7 +885,7 @@ struct AVISTREAMINFOW { RECT rcFrame; DWORD dwEditCount; DWORD dwFormatChangeCount; - WCHAR szName[64]; + WCHAR[64] szName; } alias AVISTREAMINFOW* LPAVISTREAMINFOW; @@ -907,7 +907,7 @@ struct AVISTREAMINFOA { RECT rcFrame; DWORD dwEditCount; DWORD dwFormatChangeCount; - char szName[64]; + char[64] szName; } alias AVISTREAMINFOA* LPAVISTREAMINFOA; @@ -934,7 +934,7 @@ struct AVIFILEINFOW { DWORD dwRate; DWORD dwLength; DWORD dwEditCount; - WCHAR szFileType[64]; + WCHAR[64] szFileType; } alias AVIFILEINFOW* LPAVIFILEINFOW; @@ -950,7 +950,7 @@ struct AVIFILEINFOA { DWORD dwRate; DWORD dwLength; DWORD dwEditCount; - char szFileType[64]; + char[64] szFileType; } alias AVIFILEINFOA* LPAVIFILEINFOA; @@ -1887,7 +1887,7 @@ struct VIDEOHDR { DWORD dwTimeCaptured; DWORD_PTR dwUser; DWORD dwFlags; - DWORD_PTR dwReserved[4]; + DWORD_PTR[4] dwReserved; } alias VIDEOHDR* PVIDEOHDR, LPVIDEOHDR; diff --git a/3rdparty/win32/winnt.d b/3rdparty/win32/winnt.d index 3c49b1c1..513b1660 100644 --- a/3rdparty/win32/winnt.d +++ b/3rdparty/win32/winnt.d @@ -1960,7 +1960,7 @@ struct GUID { uint Data1; ushort Data2; ushort Data3; - ubyte Data4[8]; + ubyte[8] Data4; } alias GUID* REFGUID, LPGUID; */ @@ -2164,9 +2164,9 @@ version (X86) { WORD Reserved3; DWORD MxCsr; DWORD MxCsr_Mask; - M128A FloatRegisters[8]; - M128A XmmRegisters[16]; - BYTE Reserved4[96]; + M128A[8] FloatRegisters; + M128A[16] XmmRegisters; + BYTE[96] Reserved4; } alias XMM_SAVE_AREA32 PXMM_SAVE_AREA32; const LEGACY_SAVE_AREA_LENGTH = XMM_SAVE_AREA32.sizeof; @@ -2217,8 +2217,8 @@ version (X86) { XMM_SAVE_AREA32 FloatSave; struct { - M128A Header[2]; - M128A Legacy[8]; + M128A[2] Header; + M128A[8] Legacy; M128A Xmm0; M128A Xmm1; M128A Xmm2; @@ -2237,7 +2237,7 @@ version (X86) { M128A Xmm15; }; }; - M128A VectorRegister[26]; + M128A[26] VectorRegister; DWORD64 VectorControl; DWORD64 DebugControl; DWORD64 LastBranchToRip; diff --git a/3rdparty/win32/winperf.d b/3rdparty/win32/winperf.d index 2a375434..658e11b0 100644 --- a/3rdparty/win32/winperf.d +++ b/3rdparty/win32/winperf.d @@ -83,7 +83,7 @@ const PERF_RAW_BASE=(PERF_SIZE_DWORD|PERF_TYPE_COUNTER|PERF_COUNTER_BASE|PERF_DI const PERF_ELAPSED_TIME=(PERF_SIZE_LARGE|PERF_TYPE_COUNTER|PERF_COUNTER_ELAPSED|PERF_OBJECT_TIMER|PERF_DISPLAY_SECONDS); struct PERF_DATA_BLOCK { - WCHAR Signature[4]; + WCHAR[4] Signature; DWORD LittleEndian; DWORD Version; DWORD Revision; diff --git a/3rdparty/win32/winspool.d b/3rdparty/win32/winspool.d index 876dd2a0..9be719ca 100644 --- a/3rdparty/win32/winspool.d +++ b/3rdparty/win32/winspool.d @@ -636,7 +636,7 @@ struct PRINTER_NOTIFY_INFO_DATA { DWORD Reserved; DWORD Id; union _NotifyData { - DWORD adwData[2]; + DWORD[2] adwData; struct Data { DWORD cbBuf; PVOID pBuf; @@ -650,7 +650,7 @@ struct PRINTER_NOTIFY_INFO { DWORD Version; DWORD Flags; DWORD Count; - PRINTER_NOTIFY_INFO_DATA aData[1]; + PRINTER_NOTIFY_INFO_DATA[1] aData; } alias PRINTER_NOTIFY_INFO* PPRINTER_NOTIFY_INFO, LPPRINTER_NOTIFY_INFO; diff --git a/3rdparty/win32/winuser.d b/3rdparty/win32/winuser.d index b91fc31a..351cad39 100644 --- a/3rdparty/win32/winuser.d +++ b/3rdparty/win32/winuser.d @@ -3051,7 +3051,7 @@ struct MENUITEMTEMPLATEHEADER { struct MENUITEMTEMPLATE { WORD mtOption; WORD mtID; - WCHAR mtString[1]; + WCHAR[1] mtString; } alias void MENUTEMPLATE, MENUTEMPLATEA, MENUTEMPLATEW; @@ -3309,7 +3309,7 @@ struct WINDOWPOS { alias WINDOWPOS* PWINDOWPOS, LPWINDOWPOS; struct NCCALCSIZE_PARAMS { - RECT rgrc[3]; + RECT[3] rgrc; PWINDOWPOS lppos; } alias NCCALCSIZE_PARAMS* LPNCCALCSIZE_PARAMS; @@ -3381,14 +3381,14 @@ alias DWORD HELPPOLY; struct MULTIKEYHELPA { DWORD mkSize; CHAR mkKeylist; - CHAR szKeyphrase[1]; + CHAR[1] szKeyphrase; } alias MULTIKEYHELPA* PMULTIKEYHELPA, LPMULTIKEYHELPA; struct MULTIKEYHELPW { DWORD mkSize; WCHAR mkKeylist; - WCHAR szKeyphrase[1]; + WCHAR[1] szKeyphrase; } alias MULTIKEYHELPW* PMULTIKEYHELPW, LPMULTIKEYHELPW; @@ -3399,7 +3399,7 @@ struct HELPWININFOA { int dx; int dy; int wMax; - CHAR rgchMember[2]; + CHAR[2] rgchMember; } alias HELPWININFOA* PHELPWININFOA, LPHELPWININFOA; @@ -3410,7 +3410,7 @@ struct HELPWININFOW { int dx; int dy; int wMax; - WCHAR rgchMember[2]; + WCHAR[2] rgchMember; } alias HELPWININFOW* PHELPWININFOW, LPHELPWININFOW; @@ -3489,7 +3489,7 @@ struct SCROLLBARINFO { int xyThumbTop; int xyThumbBottom; int reserved; - DWORD rgstate[CCHILDREN_SCROLLBAR+1]; + DWORD[CCHILDREN_SCROLLBAR+1] rgstate; } alias SCROLLBARINFO* PSCROLLBARINFO, LPSCROLLBARINFO; diff --git a/3rdparty/win32/wtsapi32.d b/3rdparty/win32/wtsapi32.d index 977e707d..c34dbd1f 100644 --- a/3rdparty/win32/wtsapi32.d +++ b/3rdparty/win32/wtsapi32.d @@ -326,38 +326,38 @@ static if (_WIN32_WINNT >= 0x600) { } struct WTSINFOW { - WTS_CONNECTSTATE_CLASS State; - DWORD SessionId; - DWORD IncomingBytes; - DWORD OutgoingBytes; - DWORD IncomingCompressedBytes; - DWORD OutgoingCompressedBytes; - WCHAR WinStationName[WINSTATIONNAME_LENGTH]; - WCHAR Domain[DOMAIN_LENGTH]; - WCHAR UserName[USERNAME_LENGTH+1]; - LARGE_INTEGER ConnectTime; - LARGE_INTEGER DisconnectTime; - LARGE_INTEGER LastInputTime; - LARGE_INTEGER LogonTime; - LARGE_INTEGER CurrentTime; + WTS_CONNECTSTATE_CLASS State; + DWORD SessionId; + DWORD IncomingBytes; + DWORD OutgoingBytes; + DWORD IncomingCompressedBytes; + DWORD OutgoingCompressedBytes; + WCHAR[WINSTATIONNAME_LENGTH] WinStationName; + WCHAR[DOMAIN_LENGTH] Domain; + WCHAR UserName[USERNAME_LENGTH+1]; + LARGE_INTEGER ConnectTime; + LARGE_INTEGER DisconnectTime; + LARGE_INTEGER LastInputTime; + LARGE_INTEGER LogonTime; + LARGE_INTEGER CurrentTime; } alias WTSINFOW* PWTSINFOW; struct WTSINFOA { - WTS_CONNECTSTATE_CLASS State; - DWORD SessionId; - DWORD IncomingBytes; - DWORD OutgoingBytes; - DWORD IncomingCompressedBytes; - DWORD OutgoingCompressedBytes; - CHAR WinStationName[WINSTATIONNAME_LENGTH]; - CHAR Domain[DOMAIN_LENGTH]; - CHAR UserName[USERNAME_LENGTH+1]; - LARGE_INTEGER ConnectTime; - LARGE_INTEGER DisconnectTime; - LARGE_INTEGER LastInputTime; - LARGE_INTEGER LogonTime; - LARGE_INTEGER CurrentTime; + WTS_CONNECTSTATE_CLASS State; + DWORD SessionId; + DWORD IncomingBytes; + DWORD OutgoingBytes; + DWORD IncomingCompressedBytes; + DWORD OutgoingCompressedBytes; + CHAR[WINSTATIONNAME_LENGTH] WinStationName; + CHAR[DOMAIN_LENGTH] Domain; + CHAR UserName[USERNAME_LENGTH+1]; + LARGE_INTEGER ConnectTime; + LARGE_INTEGER DisconnectTime; + LARGE_INTEGER LastInputTime; + LARGE_INTEGER LogonTime; + LARGE_INTEGER CurrentTime; } alias WTSINFOA* PWTSINFOA; diff --git a/3rdparty/win32/wtypes.d b/3rdparty/win32/wtypes.d index 7de7f07c..56d842e5 100644 --- a/3rdparty/win32/wtypes.d +++ b/3rdparty/win32/wtypes.d @@ -77,7 +77,7 @@ enum MSHLFLAGS { struct FLAGGED_WORD_BLOB { uint fFlags; uint clSize; - ushort asData[1]; + ushort[1] asData; } alias WCHAR OLECHAR; diff --git a/src/dlangui/graphics/glsupport.d b/src/dlangui/graphics/glsupport.d index 3b6b3890..fa5cb762 100644 --- a/src/dlangui/graphics/glsupport.d +++ b/src/dlangui/graphics/glsupport.d @@ -107,7 +107,7 @@ void drawColorAndTextureRect(uint textureId, int tdx, int tdy, Rect srcrc, Rect } void drawColorAndTextureRect(uint textureId, int tdx, int tdy, int srcx, int srcy, int srcdx, int srcdy, int xx, int yy, int dx, int dy, uint color, bool linear) { - float colors[6*4]; + float[6*4] colors; LVGLFillColor(color, colors.ptr, 6); float dstx0 = cast(float)xx; float dsty0 = cast(float)(bufferDy - (yy)); diff --git a/src/dlangui/graphics/images.d b/src/dlangui/graphics/images.d index 31524545..e00e2075 100644 --- a/src/dlangui/graphics/images.d +++ b/src/dlangui/graphics/images.d @@ -142,8 +142,8 @@ version (USE_FREEIMAGE) { FREE_IMAGE_LOADED = true; } - ubyte imagebuf[]; - ubyte readbuf[4096]; + ubyte[] imagebuf; + ubyte[4096] readbuf; for (;;) { size_t bytesRead = stream.read(readbuf); if (!bytesRead) diff --git a/src/dlangui/graphics/resources.d b/src/dlangui/graphics/resources.d index 78202ff2..3db4cb69 100644 --- a/src/dlangui/graphics/resources.d +++ b/src/dlangui/graphics/resources.d @@ -452,7 +452,7 @@ class StateDrawable : Drawable { private static uint colorTransformFromStringAdd(string value) { if (value is null) return COLOR_TRANSFORM_OFFSET_NONE; - int n[4]; + int [4]n; if (!parseList4(value, n)) return COLOR_TRANSFORM_OFFSET_NONE; foreach (ref item; n) { @@ -467,8 +467,8 @@ class StateDrawable : Drawable { private static uint colorTransformFromStringMult(string value) { if (value is null) return COLOR_TRANSFORM_MULTIPLY_NONE; - float n[4]; - uint nn[4]; + float[4] n; + uint[4] nn; if (!parseList4!float(value, n)) return COLOR_TRANSFORM_MULTIPLY_NONE; for(int i = 0; i < 4; i++) { diff --git a/src/dlangui/platforms/windows/win32fonts.d b/src/dlangui/platforms/windows/win32fonts.d index d3f08e5d..d9f75104 100644 --- a/src/dlangui/platforms/windows/win32fonts.d +++ b/src/dlangui/platforms/windows/win32fonts.d @@ -167,7 +167,7 @@ class Win32Font : Font { g.glyph = new ubyte[g.blackBoxX * g.blackBoxY]; if (gs>0) { - ubyte glyph[] = new ubyte[gs]; + ubyte[] glyph = new ubyte[gs]; res = GetGlyphOutlineW( _drawbuf.dc, cast(wchar)ch, GGO_GRAY8_BITMAP, //GGO_METRICS &metrics, diff --git a/src/dlangui/platforms/windows/winapp.d b/src/dlangui/platforms/windows/winapp.d index ae540318..dc069afe 100644 --- a/src/dlangui/platforms/windows/winapp.d +++ b/src/dlangui/platforms/windows/winapp.d @@ -1,24 +1,24 @@ -// Written in the D programming language. - -/** - -This module contains implementation of Win32 platform support - -Provides Win32Window and Win32Platform classes. - -Usually you don't need to use this module directly. - - -Synopsis: - ----- -import dlangui.platforms.windows.winapp; ----- - -Copyright: Vadim Lopatin, 2014 -License: Boost License 1.0 -Authors: Vadim Lopatin, coolreader.org@gmail.com -*/ +// Written in the D programming language. + +/** + +This module contains implementation of Win32 platform support + +Provides Win32Window and Win32Platform classes. + +Usually you don't need to use this module directly. + + +Synopsis: + +---- +import dlangui.platforms.windows.winapp; +---- + +Copyright: Vadim Lopatin, 2014 +License: Boost License 1.0 +Authors: Vadim Lopatin, coolreader.org@gmail.com +*/ module dlangui.platforms.windows.winapp; version (USE_SDL) { } else version (Windows) { @@ -39,15 +39,15 @@ import dlangui.graphics.drawbuf; import dlangui.graphics.images; import dlangui.graphics.fonts; import dlangui.core.logger; -import dlangui.core.files; +import dlangui.core.files; version (USE_OPENGL) { import dlangui.graphics.glsupport; } -// specify debug=DebugMouseEvents for logging mouse handling -// specify debug=DebugRedraw for logging drawing and layouts handling -// specify debug=DebugKeys for logging of key events +// specify debug=DebugMouseEvents for logging mouse handling +// specify debug=DebugRedraw for logging drawing and layouts handling +// specify debug=DebugKeys for logging of key events pragma(lib, "gdi32.lib"); pragma(lib, "user32.lib"); @@ -370,59 +370,59 @@ class Win32Window : Window { void onSetCursorType() { HANDLE winCursor = null; switch (_cursorType) { - case CursorType.None: - winCursor = null; - break; - case CursorType.Parent: - break; - case CursorType.Arrow: - winCursor = loadCursor(IDC_ARROW); - break; - case CursorType.IBeam: - winCursor = loadCursor(IDC_IBEAM); - break; - case CursorType.Wait: - winCursor = loadCursor(IDC_WAIT); - break; - case CursorType.Crosshair: - winCursor = loadCursor(IDC_CROSS); - break; - case CursorType.WaitArrow: - winCursor = loadCursor(IDC_APPSTARTING); - break; - case CursorType.SizeNWSE: - winCursor = loadCursor(IDC_SIZENWSE); - break; - case CursorType.SizeNESW: - winCursor = loadCursor(IDC_SIZENESW); - break; - case CursorType.SizeWE: - winCursor = loadCursor(IDC_SIZEWE); - break; - case CursorType.SizeNS: - winCursor = loadCursor(IDC_SIZENS); - break; - case CursorType.SizeAll: - winCursor = loadCursor(IDC_SIZEALL); - break; - case CursorType.No: - winCursor = loadCursor(IDC_NO); - break; - case CursorType.Hand: - winCursor = loadCursor(IDC_HAND); - break; - default: - break; + case CursorType.None: + winCursor = null; + break; + case CursorType.Parent: + break; + case CursorType.Arrow: + winCursor = loadCursor(IDC_ARROW); + break; + case CursorType.IBeam: + winCursor = loadCursor(IDC_IBEAM); + break; + case CursorType.Wait: + winCursor = loadCursor(IDC_WAIT); + break; + case CursorType.Crosshair: + winCursor = loadCursor(IDC_CROSS); + break; + case CursorType.WaitArrow: + winCursor = loadCursor(IDC_APPSTARTING); + break; + case CursorType.SizeNWSE: + winCursor = loadCursor(IDC_SIZENWSE); + break; + case CursorType.SizeNESW: + winCursor = loadCursor(IDC_SIZENESW); + break; + case CursorType.SizeWE: + winCursor = loadCursor(IDC_SIZEWE); + break; + case CursorType.SizeNS: + winCursor = loadCursor(IDC_SIZENS); + break; + case CursorType.SizeAll: + winCursor = loadCursor(IDC_SIZEALL); + break; + case CursorType.No: + winCursor = loadCursor(IDC_NO); + break; + case CursorType.Hand: + winCursor = loadCursor(IDC_HAND); + break; + default: + break; } SetCursor(winCursor); } - /// sets cursor type for window - override protected void setCursorType(uint cursorType) { - // override to support different mouse cursors - _cursorType = cursorType; - onSetCursorType(); - } + /// sets cursor type for window + override protected void setCursorType(uint cursorType) { + // override to support different mouse cursors + _cursorType = cursorType; + onSetCursorType(); + } /// sets window icon @property override void windowIcon(DrawBufRef buf) { @@ -852,7 +852,7 @@ int myWinMain(void* hInstance, void* hPrevInstance, char* lpCmdLine, int iCmdSho FreeTypeFontManager ftfontMan = new FreeTypeFontManager(); string fontsPath = "c:\\Windows\\Fonts\\"; static if (false) { // SHGetFolderPathW not found in shell32.lib - WCHAR szPath[MAX_PATH]; + WCHAR[MAX_PATH] szPath; const CSIDL_FLAG_NO_ALIAS = 0x1000; const CSIDL_FLAG_DONT_UNEXPAND = 0x2000; if(SUCCEEDED(SHGetFolderPathW(NULL, diff --git a/src/dlangui/platforms/x11/x11app.d b/src/dlangui/platforms/x11/x11app.d index 8b597d6d..8211a4a2 100644 --- a/src/dlangui/platforms/x11/x11app.d +++ b/src/dlangui/platforms/x11/x11app.d @@ -118,7 +118,7 @@ class XCBWindow : Window { import std.c.linux.X11.Xlib; uint mask; - uint values[3]; + uint[3] values; // disable opengl for testing _enableOpengl = false; @@ -139,7 +139,7 @@ class XCBWindow : Window { Log.d("window=", _w, " gc=", _g); version (USE_OPENGL) { if (_enableOpengl) { - int visual_attribs[] = [ + int[] visual_attribs = [ GLX_RENDER_TYPE, GLX_RGBA_BIT, GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT, GLX_DOUBLEBUFFER, 1, @@ -385,7 +385,7 @@ class XCBWindow : Window { Log.e("glXCreateContextAttribsARB function is not found"); _context = glXCreateNewContext(_display, _fb_config, GLX_RGBA_TYPE, null, true); } else { - int context_attribs[] = + int[] context_attribs = [ GLX_CONTEXT_MAJOR_VERSION_ARB, 3, GLX_CONTEXT_MINOR_VERSION_ARB, 0, From 1de90b5434b2fa9214d491e5791edc56d855e4e1 Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Wed, 31 Dec 2014 09:56:46 +0300 Subject: [PATCH 06/18] FileDialog path segment buttons --- README.md | 8 +++++--- src/dlangui/dialogs/filedlg.d | 22 +++++++++++++++++++--- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index c0490979..56ebbf35 100644 --- a/README.md +++ b/README.md @@ -123,16 +123,18 @@ Run Tetris game example dub run dlangui:tetris --build=release -To develop using Visual-D, download sources for dlabgui and dependencies into some directory: +To develop using Visual-D or MonoD, download sources for dlabgui and dependencies into some directory: git clone https://github.com/buggins/dlangui.git git clone https://github.com/DerelictOrg/DerelictUtil.git git clone https://github.com/DerelictOrg/DerelictGL3.git - git clone https://github.com/DerelictOrg/DerelictFI.git git clone https://github.com/DerelictOrg/DerelictFT.git git clone https://github.com/DerelictOrg/DerelictSDL2.git + git clone https://github.com/gecko0307/dlib.git + git clone https://github.com/Devisualization/image.git de_image + -Then open .sln using Visual D. +Then open dlangui.sln using Visual D (or dlangui-monod.sln for MonoD) diff --git a/src/dlangui/dialogs/filedlg.d b/src/dlangui/dialogs/filedlg.d index 8b4f1144..caba1b6a 100644 --- a/src/dlangui/dialogs/filedlg.d +++ b/src/dlangui/dialogs/filedlg.d @@ -351,8 +351,8 @@ class FilePathPanelItem : HorizontalLayout { class FilePathPanelButtons : WidgetGroup { protected string _path; - this() { - super(null); + this(string ID = null) { + super(ID); } void init(string path) { _path = path; @@ -447,9 +447,25 @@ class FilePathPanelButtons : WidgetGroup { } class FilePathPanel : FrameLayout { - protected HorizontalLayout _segments; + static const ID_SEGMENTS = "SEGMENTS"; + static const ID_EDITOR = "ED_PATH"; + protected FilePathPanelButtons _segments; protected EditLine _edPath; + protected string _path; this(string ID = null) { super(ID); + _segments = new FilePathPanelButtons(ID_SEGMENTS); + _edPath = new EditLine(ID_EDITOR); + addChild(_segments); + addChild(_edPath); + showChild(ID_SEGMENTS); } + @property void path(string value) { + _segments.init(value); + _edPath.text = toUTF32(value); + _path = path; + } + @property string path() { + return _path; + } } From 5fdf4ad935b31698a5faaf7abb8cceafb2065671 Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Mon, 5 Jan 2015 17:47:35 +0300 Subject: [PATCH 07/18] FileDialog - path segments --- src/dlangui/dialogs/filedlg.d | 134 +++++++++++++++++++++++++++++++--- src/dlangui/widgets/editors.d | 11 +++ src/dlangui/widgets/menu.d | 2 +- 3 files changed, 134 insertions(+), 13 deletions(-) diff --git a/src/dlangui/dialogs/filedlg.d b/src/dlangui/dialogs/filedlg.d index caba1b6a..54655f7f 100644 --- a/src/dlangui/dialogs/filedlg.d +++ b/src/dlangui/dialogs/filedlg.d @@ -33,6 +33,7 @@ import dlangui.widgets.popup; import dlangui.widgets.layouts; import dlangui.widgets.grid; import dlangui.widgets.editors; +import dlangui.widgets.menu; import dlangui.platforms.common.platform; import dlangui.dialogs.dialog; @@ -57,7 +58,7 @@ enum FileDialogFlag : uint { /// File open / save dialog class FileDialog : Dialog, CustomGridCellAdapter { - protected EditLine _edPath; + protected FilePathPanel _edPath; protected EditLine _edFilename; protected StringGridWidget _fileList; //protected StringGridWidget places; @@ -105,7 +106,7 @@ class FileDialog : Dialog, CustomGridCellAdapter { return false; _path = dir; _isRoot = isRoot(dir); - _edPath.text = toUTF32(_path); + _edPath.path = _path; //toUTF32(_path); _fileList.rows = cast(int)_entries.length; int selectionIndex = -1; for (int i = 0; i < _entries.length; i++) { @@ -247,6 +248,10 @@ class FileDialog : Dialog, CustomGridCellAdapter { return super.handleAction(action); } + bool onPathSelected(string path) { + // + return openDirectory(path, null); + } /// override to implement creation of dialog controls override void init() { @@ -272,9 +277,10 @@ class FileDialog : Dialog, CustomGridCellAdapter { content.addChild(leftPanel); content.addChild(rightPanel); - _edPath = new EditLine("path"); + _edPath = new FilePathPanel("path"); _edPath.layoutWidth(FILL_PARENT); _edPath.layoutWeight = 0; + _edPath.onPathSelectionListener = &onPathSelected; _edFilename = new EditLine("filename"); _edFilename.layoutWidth(FILL_PARENT); @@ -326,14 +332,22 @@ class FilePathPanelItem : HorizontalLayout { Listener!OnPathSelectionHandler onPathSelectionListener; this(string path) { super(null); + styleId = "LIST_ITEM"; _path = path; - string fname = baseName(path); + string fname = isRoot(path) ? path : baseName(path); _text = new TextWidget(null, toUTF32(fname)); + _text.styleId = "BUTTON_TRANSPARENT"; _text.clickable = true; _text.onClickListener = &onTextClick; + //_text.backgroundColor = 0xC0FFFF; + _text.state = State.Parent; _button = new ImageButton(null, "scrollbar_btn_right"); + _button.styleId = "BUTTON_TRANSPARENT"; _button.focusable = false; _button.onClickListener = &onButtonClick; + //_button.backgroundColor = 0xC0FFC0; + _button.state = State.Parent; + trackHover(true); addChild(_text); addChild(_button); margins(Rect(2,0,2,0)); @@ -344,15 +358,48 @@ class FilePathPanelItem : HorizontalLayout { return false; } private bool onButtonClick(Widget src) { - // TODO: show popup menu with subdirs + // show popup menu with subdirs + string[] filters; + DirEntry[] entries; + if (!listDirectory(_path, true, false, false, filters, entries)) + return false; + if (entries.length == 0) + return false; + MenuItem dirs = new MenuItem(); + int itemId = 25000; + foreach(ref DirEntry e; entries) { + string fullPath = e.name; + string d = baseName(fullPath); + Action a = new Action(itemId++, toUTF32(d)); + MenuItem item = new MenuItem(a); + item.onMenuItemClick = delegate(MenuItem item) { + if (onPathSelectionListener.assigned) + return onPathSelectionListener(fullPath); + return false; + }; + dirs.add(item); + } + PopupMenu menuWidget = new PopupMenu(dirs); + PopupWidget popup = window.showPopup(menuWidget, this, PopupAlign.Below); + popup.flags = PopupFlags.CloseOnClickOutside; return true; } } +/// Panel with buttons - path segments - for fast navigation to subdirs. class FilePathPanelButtons : WidgetGroup { protected string _path; + Listener!OnPathSelectionHandler onPathSelectionListener; + bool onPathSelected(string path) { + if (onPathSelectionListener.assigned) { + return onPathSelectionListener(path); + } + return false; + } this(string ID = null) { super(ID); + layoutWidth = FILL_PARENT; + clickable = true; } void init(string path) { _path = path; @@ -360,8 +407,9 @@ class FilePathPanelButtons : WidgetGroup { string itemPath = path; for (;;) { FilePathPanelItem item = new FilePathPanelItem(itemPath); + item.onPathSelectionListener = &onPathSelected; addChild(item); - if (isRoot(path)) { + if (isRoot(itemPath)) { break; } itemPath = parentDir(itemPath); @@ -378,7 +426,10 @@ class FilePathPanelButtons : WidgetGroup { pwidth -= m.left + m.right + p.left + p.right; if (parentHeight != SIZE_UNSPECIFIED) pheight -= m.top + m.bottom + p.top + p.bottom; - int reservedForEmptySpace = parentWidth / 16; + int reservedForEmptySpace = parentWidth / 20; + if (reservedForEmptySpace > 40) + reservedForEmptySpace = 40; + Point sz; sz.x += reservedForEmptySpace; // measure children @@ -410,7 +461,9 @@ class FilePathPanelButtons : WidgetGroup { applyMargins(rc); applyPadding(rc); - int reservedForEmptySpace = rc.width / 16; + int reservedForEmptySpace = rc.width / 20; + if (reservedForEmptySpace > 40) + reservedForEmptySpace = 40; int maxw = rc.width - reservedForEmptySpace; int totalw = 0; int visibleItems = 0; @@ -437,33 +490,90 @@ class FilePathPanelButtons : WidgetGroup { int w = item.measuredWidth; if (i == visibleItems - 1 && w > maxw) w = maxw; - rc.right = rc.left + w; - item.layout(rc); - rc.left += w; + itemRect.right = itemRect.left + w; + item.layout(itemRect); + itemRect.left += w; } } + /// Draw widget at its position to buffer + override void onDraw(DrawBuf buf) { + if (visibility != Visibility.Visible) + return; + super.onDraw(buf); + Rect rc = _pos; + applyMargins(rc); + applyPadding(rc); + auto saver = ClipRectSaver(buf, rc); + for (int i = 0; i < _children.count; i++) { + Widget item = _children.get(i); + if (item.visibility != Visibility.Visible) + continue; + item.onDraw(buf); + } + } + +} + +interface PathSelectedHandler { + bool onPathSelected(string path); } class FilePathPanel : FrameLayout { + Listener!OnPathSelectionHandler onPathSelectionListener; static const ID_SEGMENTS = "SEGMENTS"; static const ID_EDITOR = "ED_PATH"; protected FilePathPanelButtons _segments; protected EditLine _edPath; protected string _path; + Signal!PathSelectedHandler pathListener; this(string ID = null) { super(ID); _segments = new FilePathPanelButtons(ID_SEGMENTS); _edPath = new EditLine(ID_EDITOR); + _edPath.layoutWidth = FILL_PARENT; + _edPath.editorActionListener = &onEditorAction; + _edPath.onFocusChangeListener = &onEditorFocusChanged; + _segments.onClickListener = &onSegmentsClickOutside; + _segments.onPathSelectionListener = &onPathSelected; addChild(_segments); addChild(_edPath); - showChild(ID_SEGMENTS); } + protected bool onEditorFocusChanged(Widget source, bool focused) { + if (!focused) { + _edPath.text = toUTF32(_path); + showChild(ID_SEGMENTS); + } + return true; + } + protected bool onPathSelected(string path) { + if (onPathSelectionListener.assigned) { + if (exists(path)) + return onPathSelectionListener(path); + } + return false; + } + bool onSegmentsClickOutside(Widget w) { + // switch to editor + showChild(ID_EDITOR); + _edPath.setFocus(); + return true; + } + bool onEditorAction(const Action action) { + if (action.id == EditorActions.InsertNewLine) { + string fn = buildNormalizedPath(toUTF8(_edPath.text)); + if (exists(fn) && isDir(fn)) + return onPathSelected(fn); + } + return false; + } + @property void path(string value) { _segments.init(value); _edPath.text = toUTF32(value); _path = path; + showChild(ID_SEGMENTS); } @property string path() { return _path; diff --git a/src/dlangui/widgets/editors.d b/src/dlangui/widgets/editors.d index 0ebdbee6..1d655eed 100644 --- a/src/dlangui/widgets/editors.d +++ b/src/dlangui/widgets/editors.d @@ -1708,10 +1708,15 @@ class EditWidgetBase : ScrollWidgetBase, EditableContentListener, MenuItemAction } +interface EditorActionHandler { + bool onEditorAction(const Action action); +} /// single line editor class EditLine : EditWidgetBase { + Signal!EditorActionHandler editorActionListener; + /// empty parameter list constructor - for usage by factory this() { this(null); @@ -1797,6 +1802,12 @@ class EditLine : EditWidgetBase { override protected bool handleAction(const Action a) { switch (a.id) { + case EditorActions.InsertNewLine: + case EditorActions.PrependNewLine: + if (editorActionListener.assigned) { + return editorActionListener(a); + } + break; case EditorActions.Up: break; case EditorActions.Down: diff --git a/src/dlangui/widgets/menu.d b/src/dlangui/widgets/menu.d index 9014514e..ac2903db 100644 --- a/src/dlangui/widgets/menu.d +++ b/src/dlangui/widgets/menu.d @@ -88,7 +88,7 @@ class MenuItem { } /// set new MenuItemType - @property MenuItem type(MenuItemType type) { + @property MenuItem type(MenuItemType type) { _type = type; return this; } From 78f407c4745f86fe712df6634e8253714c5da7a7 Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Mon, 5 Jan 2015 18:04:58 +0300 Subject: [PATCH 08/18] fixes --- src/dlangui/dialogs/filedlg.d | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/dlangui/dialogs/filedlg.d b/src/dlangui/dialogs/filedlg.d index 54655f7f..c59b7d83 100644 --- a/src/dlangui/dialogs/filedlg.d +++ b/src/dlangui/dialogs/filedlg.d @@ -61,7 +61,6 @@ class FileDialog : Dialog, CustomGridCellAdapter { protected FilePathPanel _edPath; protected EditLine _edFilename; protected StringGridWidget _fileList; - //protected StringGridWidget places; protected VerticalLayout leftPanel; protected VerticalLayout rightPanel; protected Action _action; @@ -390,7 +389,7 @@ class FilePathPanelItem : HorizontalLayout { class FilePathPanelButtons : WidgetGroup { protected string _path; Listener!OnPathSelectionHandler onPathSelectionListener; - bool onPathSelected(string path) { + protected bool onPathSelected(string path) { if (onPathSelectionListener.assigned) { return onPathSelectionListener(path); } @@ -401,7 +400,7 @@ class FilePathPanelButtons : WidgetGroup { layoutWidth = FILL_PARENT; clickable = true; } - void init(string path) { + protected void init(string path) { _path = path; _children.clear(); string itemPath = path; @@ -520,6 +519,7 @@ interface PathSelectedHandler { bool onPathSelected(string path); } +/// Panel - either path segment buttons or text editor line class FilePathPanel : FrameLayout { Listener!OnPathSelectionHandler onPathSelectionListener; static const ID_SEGMENTS = "SEGMENTS"; @@ -554,13 +554,14 @@ class FilePathPanel : FrameLayout { } return false; } - bool onSegmentsClickOutside(Widget w) { + protected bool onSegmentsClickOutside(Widget w) { // switch to editor + _edPath.text = toUTF32(_path); showChild(ID_EDITOR); _edPath.setFocus(); return true; } - bool onEditorAction(const Action action) { + protected bool onEditorAction(const Action action) { if (action.id == EditorActions.InsertNewLine) { string fn = buildNormalizedPath(toUTF8(_edPath.text)); if (exists(fn) && isDir(fn)) From 202ff81633d35ced18a12500a5ddea5b5847d937 Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Mon, 5 Jan 2015 18:17:25 +0300 Subject: [PATCH 09/18] file dialog path segments fixed; enhancement issue #22 implemented. --- src/dlangui/dialogs/filedlg.d | 2 +- src/dlangui/widgets/widget.d | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dlangui/dialogs/filedlg.d b/src/dlangui/dialogs/filedlg.d index c59b7d83..35ddfb8b 100644 --- a/src/dlangui/dialogs/filedlg.d +++ b/src/dlangui/dialogs/filedlg.d @@ -573,7 +573,7 @@ class FilePathPanel : FrameLayout { @property void path(string value) { _segments.init(value); _edPath.text = toUTF32(value); - _path = path; + _path = value; showChild(ID_SEGMENTS); } @property string path() { diff --git a/src/dlangui/widgets/widget.d b/src/dlangui/widgets/widget.d index 0860d570..3ecd6571 100644 --- a/src/dlangui/widgets/widget.d +++ b/src/dlangui/widgets/widget.d @@ -262,7 +262,7 @@ class Widget { /// override to handle focus changes protected void handleFocusChange(bool focused) { invalidate(); - onFocusChangeListener(this, checked); + onFocusChangeListener(this, focused); } /// override to handle check changes protected void handleCheckChange(bool checked) { From 6cf62f374c84df32400707da6d9178a9e23031ca Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Tue, 6 Jan 2015 23:02:18 +0300 Subject: [PATCH 10/18] i18n: support both resource id and fallback dstring - to allow inline fallback strings --- src/dlangui/core/i18n.d | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/dlangui/core/i18n.d b/src/dlangui/core/i18n.d index 76309ef8..ace4263a 100644 --- a/src/dlangui/core/i18n.d +++ b/src/dlangui/core/i18n.d @@ -83,6 +83,11 @@ struct UIString { this(dstring value) { _value = value; } + /** create string with resource id and raw value as fallback for missing translations */ + this(string id, dstring fallbackValue) { + _id = id; + _value = value; + } /// Returns string resource id @@ -94,12 +99,9 @@ struct UIString { } /** Get value (either raw or translated by id) */ @property dstring value() const { - if (_value !is null) - return _value; - if (_id is null) - return null; - // translate ID to dstring - return i18n.get(_id); + if (_id !is null) // translate ID to dstring + return i18n.get(_id, _value); // get from resource, use _value as fallback + return _value; } /** Set raw value using property */ @property void value(dstring newValue) { @@ -311,7 +313,7 @@ synchronized class UIStringTranslator { } /** Translate string ID to string (returns "UNTRANSLATED: id" for missing values) */ - dstring get(string id) { + dstring get(string id, dstring fallbackValue = null) { if (id is null) return null; dstring s = _main.get(id); @@ -320,6 +322,8 @@ synchronized class UIStringTranslator { s = _fallback.get(id); if (s !is null) return s; + if (fallbackValue !is null) + return fallbackValue; return "UNTRANSLATED: "d ~ toUTF32(id); } } From cc6610bbc18a8980a60eb108ec1fbcb7b8f6e9b7 Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Tue, 6 Jan 2015 23:06:05 +0300 Subject: [PATCH 11/18] update docs for i18n --- src/dlangui/core/i18n.d | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/dlangui/core/i18n.d b/src/dlangui/core/i18n.d index ace4263a..42797219 100644 --- a/src/dlangui/core/i18n.d +++ b/src/dlangui/core/i18n.d @@ -36,14 +36,18 @@ import dlangui.core.i18n; // use global i18n object to get translation for string ID dstring translated = i18n.get("STR_FILE_OPEN"); +// as well, you can specify fallback value - to return if translation is not found +dstring translated = i18n.get("STR_FILE_OPEN", "Open..."d); // UIString type can hold either string resource id or dstring raw value. UIString text; -// assign resource id as string +// assign resource id as string (will remove dstring value if it was here) text = "ID_FILE_EXIT"; -// or assign raw value as dstring +// or assign raw value as dstring (will remove id if it was here) text = "some text"d; +// assign both resource id and fallback value - to use if string resource is not found +text = UIString("ID_FILE_EXIT", "Exit"d); // i18n.get() will automatically be invoked when getting UIString value (e.g. using alias this). dstring translated = text; From 66f02db2f111511a0b265657d2092e223b67c4e4 Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Wed, 7 Jan 2015 11:16:36 +0300 Subject: [PATCH 12/18] FileDialog - file type filter support, part 1 --- examples/example1/src/main.d | 4 +++ src/dlangui/core/files.d | 19 ++++++++++++- src/dlangui/dialogs/filedlg.d | 53 +++++++++++++++++++++++++++++++++-- 3 files changed, 73 insertions(+), 3 deletions(-) diff --git a/examples/example1/src/main.d b/examples/example1/src/main.d index 67595064..89f45146 100644 --- a/examples/example1/src/main.d +++ b/examples/example1/src/main.d @@ -294,6 +294,10 @@ extern (C) int UIAppMain(string[] args) { UIString caption; caption = "Open Text File"d; FileDialog dlg = new FileDialog(caption, window, null); + dlg.addFilter(FileFilterEntry(UIString("FILTER_ALL_FILES", "All files (*.*)"d), "*.*")); + dlg.addFilter(FileFilterEntry(UIString("FILTER_TEXT_FILES", "Text files (*.txt)"d), "*.txt")); + dlg.addFilter(FileFilterEntry(UIString("FILTER_SOURCE_FILES", "Source files"d), "*.d;*.dd;*.c;*.cc;*.cpp;*.h;*.hpp")); + dlg.filterIndex = 2; dlg.onDialogResult = delegate(Dialog dlg, const Action result) { Log.d("FileDialog.onDialogResult: ", result, " param=", result.stringParam); window.showMessageBox(UIString("FileOpen result"d), UIString(toUTF32(result.stringParam))); diff --git a/src/dlangui/core/files.d b/src/dlangui/core/files.d index a3447a8f..aee21ce8 100644 --- a/src/dlangui/core/files.d +++ b/src/dlangui/core/files.d @@ -156,9 +156,26 @@ string parentDir(string path) { return buildNormalizedPath(path, ".."); } +/// check filename with pattern (currently only *.ext pattern is supported) +bool filterFilename(string filename, string pattern) { + if (pattern.equal("*.*")) + return true; // matches any + if (pattern.length < 3) + return false; + if (pattern[0] != '*' || pattern[1] != '.') + return false; + return filename.endsWith(pattern[1..$]); +} + /// Filters file name by pattern list bool filterFilename(string filename, string[] filters) { - return true; + if (filters.length == 0) + return true; // no filters - show all + foreach(pattern; filters) { + if (filterFilename(filename, pattern)) + return true; + } + return false; } /** List directory content diff --git a/src/dlangui/dialogs/filedlg.d b/src/dlangui/dialogs/filedlg.d index 35ddfb8b..08f30682 100644 --- a/src/dlangui/dialogs/filedlg.d +++ b/src/dlangui/dialogs/filedlg.d @@ -42,6 +42,7 @@ private import std.file; private import std.path; private import std.utf; private import std.conv : to; +private import std.array : split; /// flags for file dialog options @@ -56,6 +57,17 @@ enum FileDialogFlag : uint { Save = ConfirmOverwrite, } +/// filetype filter entry for FileDialog +struct FileFilterEntry { + UIString label; + string[] filter; + this(UIString displayLabel, string filterList) { + label = displayLabel; + if (filterList.length) + filter = split(filterList, ";"); + } +} + /// File open / save dialog class FileDialog : Dialog, CustomGridCellAdapter { protected FilePathPanel _edPath; @@ -66,6 +78,8 @@ class FileDialog : Dialog, CustomGridCellAdapter { protected Action _action; protected RootEntry[] _roots; + protected FileFilterEntry[] _filters; + protected int _filterIndex; protected string _path; protected string _filename; protected DirEntry[] _entries; @@ -85,6 +99,38 @@ class FileDialog : Dialog, CustomGridCellAdapter { _action = action; } + /// filter list for file type filter combo box + @property FileFilterEntry[] filters() { + return _filters; + } + + /// filter list for file type filter combo box + @property void filters(FileFilterEntry[] values) { + _filters = values; + } + + /// add new filter entry + void addFilter(FileFilterEntry value) { + _filters ~= value; + } + + /// filter index + @property int filterIndex() { + return _filterIndex; + } + + /// filter index + @property void filterIndex(int index) { + _filterIndex = index; + } + + /// return currently selected filter value - array of patterns like ["*.txt", "*.rtf"] + @property string[] selectedFilter() { + if (_filterIndex >= 0 && _filterIndex < _filters.length) + return _filters[_filterIndex].filter; + return null; + } + /// Set widget rectangle to specified value and layout widget contents. (Step 2 of two phase layout). override void layout(Rect rc) { super.layout(rc); @@ -96,12 +142,15 @@ class FileDialog : Dialog, CustomGridCellAdapter { return openDirectory(parentDir(_path), _path); } + protected bool reopenDirectory() { + return true; + } + protected bool openDirectory(string dir, string selectedItemPath) { dir = buildNormalizedPath(dir); Log.d("FileDialog.openDirectory(", dir, ")"); _fileList.rows = 0; - string[] filters; - if (!listDirectory(dir, true, true, false, filters, _entries)) + if (!listDirectory(dir, true, true, false, selectedFilter, _entries)) return false; _path = dir; _isRoot = isRoot(dir); From 15226e85a4135296822751621eee1df8512fd66c Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Wed, 7 Jan 2015 12:50:58 +0300 Subject: [PATCH 13/18] i18n: fix fallback value; FileDialog: filetype combobox --- src/dlangui/core/i18n.d | 4 ++-- src/dlangui/dialogs/filedlg.d | 40 ++++++++++++++++++++++++++++++---- src/dlangui/widgets/combobox.d | 11 +++++++++- 3 files changed, 48 insertions(+), 7 deletions(-) diff --git a/src/dlangui/core/i18n.d b/src/dlangui/core/i18n.d index 42797219..239bbf0e 100644 --- a/src/dlangui/core/i18n.d +++ b/src/dlangui/core/i18n.d @@ -90,7 +90,7 @@ struct UIString { /** create string with resource id and raw value as fallback for missing translations */ this(string id, dstring fallbackValue) { _id = id; - _value = value; + _value = fallbackValue; } @@ -326,7 +326,7 @@ synchronized class UIStringTranslator { s = _fallback.get(id); if (s !is null) return s; - if (fallbackValue !is null) + if (fallbackValue.length > 0) return fallbackValue; return "UNTRANSLATED: "d ~ toUTF32(id); } diff --git a/src/dlangui/dialogs/filedlg.d b/src/dlangui/dialogs/filedlg.d index 08f30682..fe110644 100644 --- a/src/dlangui/dialogs/filedlg.d +++ b/src/dlangui/dialogs/filedlg.d @@ -34,6 +34,7 @@ import dlangui.widgets.layouts; import dlangui.widgets.grid; import dlangui.widgets.editors; import dlangui.widgets.menu; +import dlangui.widgets.combobox; import dlangui.platforms.common.platform; import dlangui.dialogs.dialog; @@ -68,10 +69,20 @@ struct FileFilterEntry { } } +class HorizontalLayoutTest : HorizontalLayout { + this() { + } + /// Set widget rectangle to specified value and layout widget contents. (Step 2 of two phase layout). + override void layout(Rect rc) { + super.layout(rc); + } +} + /// File open / save dialog class FileDialog : Dialog, CustomGridCellAdapter { protected FilePathPanel _edPath; protected EditLine _edFilename; + protected ComboBox _cbFilters; protected StringGridWidget _fileList; protected VerticalLayout leftPanel; protected VerticalLayout rightPanel; @@ -143,7 +154,7 @@ class FileDialog : Dialog, CustomGridCellAdapter { } protected bool reopenDirectory() { - return true; + return openDirectory(_path, null); } protected bool openDirectory(string dir, string selectedItemPath) { @@ -330,11 +341,30 @@ class FileDialog : Dialog, CustomGridCellAdapter { _edPath.layoutWeight = 0; _edPath.onPathSelectionListener = &onPathSelected; + HorizontalLayout fnlayout = new HorizontalLayoutTest(); + fnlayout.layoutWidth(FILL_PARENT); _edFilename = new EditLine("filename"); _edFilename.layoutWidth(FILL_PARENT); - _edFilename.layoutWeight = 0; + //_edFilename.layoutWeight = 0; + fnlayout.addChild(_edFilename); + if (_filters.length) { + dstring[] filterLabels; + foreach(f; _filters) + filterLabels ~= f.label.value; + _cbFilters = new ComboBox("filter", filterLabels); + _cbFilters.selectedItemIndex = _filterIndex; + _cbFilters.onItemClickListener = delegate(Widget source, int itemIndex) { + _filterIndex = itemIndex; + reopenDirectory(); + return true; + }; + _cbFilters.layoutWidth(WRAP_CONTENT); + _cbFilters.layoutWeight(0); + //_cbFilters.backgroundColor = 0xFFC0FF; + fnlayout.addChild(_cbFilters); + //fnlayout.backgroundColor = 0xFFFFC0; + } - rightPanel.addChild(_edPath); _fileList = new StringGridWidget("files"); _fileList.layoutWidth(FILL_PARENT).layoutHeight(FILL_PARENT); _fileList.resize(4, 3); @@ -344,8 +374,10 @@ class FileDialog : Dialog, CustomGridCellAdapter { _fileList.setColTitle(3, "Modified"d); _fileList.showRowHeaders = false; _fileList.rowSelect = true; + + rightPanel.addChild(_edPath); rightPanel.addChild(_fileList); - rightPanel.addChild(_edFilename); + rightPanel.addChild(fnlayout); addChild(content); diff --git a/src/dlangui/widgets/combobox.d b/src/dlangui/widgets/combobox.d index ad8944ca..10416cd5 100644 --- a/src/dlangui/widgets/combobox.d +++ b/src/dlangui/widgets/combobox.d @@ -55,8 +55,16 @@ class ComboBoxBase : HorizontalLayout, OnClickHandler { } else { res = new Widget("COMBOBOX_BODY"); } - res.layoutWidth = FILL_PARENT; + res.layoutWidth = WRAP_CONTENT; res.layoutHeight = WRAP_CONTENT; + int maxItemWidth = 0; + for(int i = 0; i < _adapter.itemCount; i++) { + Widget item = _adapter.itemWidget(i); + item.measure(SIZE_UNSPECIFIED, SIZE_UNSPECIFIED); + if (maxItemWidth < item.measuredWidth) + maxItemWidth = item.measuredWidth; + } + res.minWidth = maxItemWidth; return res; } @@ -80,6 +88,7 @@ class ComboBoxBase : HorizontalLayout, OnClickHandler { protected ImageButton createButton() { ImageButton res = new ImageButton("COMBOBOX_BUTTON", "scrollbar_btn_down"); + res.layoutWeight = 0; res.onClickListener = this; return res; } From 50a523205360e48031972e5a72579cffe9e37ec0 Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Wed, 7 Jan 2015 18:08:11 +0300 Subject: [PATCH 14/18] FileDlg improvements; fix ComboBox --- examples/example1/src/main.d | 9 +-- res/theme_default.xml | 17 +++++ src/dlangui/all.d | 1 + src/dlangui/dialogs/filedlg.d | 11 +--- src/dlangui/widgets/combobox.d | 115 +++++++++++++++++++++++---------- 5 files changed, 106 insertions(+), 47 deletions(-) diff --git a/examples/example1/src/main.d b/examples/example1/src/main.d index 89f45146..2d4a3bd8 100644 --- a/examples/example1/src/main.d +++ b/examples/example1/src/main.d @@ -297,11 +297,12 @@ extern (C) int UIAppMain(string[] args) { dlg.addFilter(FileFilterEntry(UIString("FILTER_ALL_FILES", "All files (*.*)"d), "*.*")); dlg.addFilter(FileFilterEntry(UIString("FILTER_TEXT_FILES", "Text files (*.txt)"d), "*.txt")); dlg.addFilter(FileFilterEntry(UIString("FILTER_SOURCE_FILES", "Source files"d), "*.d;*.dd;*.c;*.cc;*.cpp;*.h;*.hpp")); - dlg.filterIndex = 2; + //dlg.filterIndex = 2; dlg.onDialogResult = delegate(Dialog dlg, const Action result) { - Log.d("FileDialog.onDialogResult: ", result, " param=", result.stringParam); - window.showMessageBox(UIString("FileOpen result"d), UIString(toUTF32(result.stringParam))); - import dlangui.core.stdaction; + if (result.id == ACTION_OPEN.id) { + Log.d("FileDialog.onDialogResult: ", result, " param=", result.stringParam); + window.showMessageBox(UIString("FileOpen result"d), UIString(toUTF32(result.stringParam))); + } }; dlg.show(); diff --git a/res/theme_default.xml b/res/theme_default.xml index 0973a50d..8aed3d80 100644 --- a/res/theme_default.xml +++ b/res/theme_default.xml @@ -143,6 +143,23 @@ fontFamily="SansSerif" fontSize="16" /> +