Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=29912
Now it looks like this (this patch adds the separator & "up" button):
![Bildschirmfoto_vom_2023-03-08_13-34-36](/uploads/cd30de5b3fa5f39accb4dd14a3f54421/Bildschirmfoto_vom_2023-03-08_13-34-36.png)
-- v2: comdlg32: Add parent dir button to "Item" file dialog.
From: Florian Will florian.will@gmail.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=29912 --- v2: Remove error check that possibly does more harm than good. --- dlls/comdlg32/itemdlg.c | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-)
diff --git a/dlls/comdlg32/itemdlg.c b/dlls/comdlg32/itemdlg.c index 95778c2f358..30f599d5bae 100644 --- a/dlls/comdlg32/itemdlg.c +++ b/dlls/comdlg32/itemdlg.c @@ -40,6 +40,7 @@ #define IDC_NAV_TOOLBAR 200 #define IDC_NAVBACK 201 #define IDC_NAVFORWARD 202 +#define IDC_NAVPARENTFOLDER 203
#include <initguid.h> /* This seems to be another version of IID_IFileDialogCustomize. If @@ -1895,7 +1896,8 @@ static void init_toolbar(FileDialogImpl *This, HWND hwnd) { HWND htoolbar; TBADDBITMAP tbab; - TBBUTTON button[2]; + int view_icons_index; + TBBUTTON button[4];
htoolbar = CreateWindowExW(0, TOOLBARCLASSNAMEW, NULL, TBSTYLE_FLAT | WS_CHILD | WS_VISIBLE, 0, 0, 0, 0, @@ -1905,6 +1907,9 @@ static void init_toolbar(FileDialogImpl *This, HWND hwnd) tbab.nID = IDB_HIST_LARGE_COLOR; SendMessageW(htoolbar, TB_ADDBITMAP, 0, (LPARAM)&tbab);
+ tbab.nID = IDB_VIEW_LARGE_COLOR; + view_icons_index = SendMessageW(htoolbar, TB_ADDBITMAP, 0, (LPARAM)&tbab); + button[0].iBitmap = HIST_BACK; button[0].idCommand = IDC_NAVBACK; button[0].fsState = TBSTATE_ENABLED; @@ -1919,7 +1924,21 @@ static void init_toolbar(FileDialogImpl *This, HWND hwnd) button[1].dwData = 0; button[1].iString = 0;
- SendMessageW(htoolbar, TB_ADDBUTTONSW, 2, (LPARAM)button); + button[2].iBitmap = 0; + button[2].idCommand = 0; + button[2].fsState = TBSTATE_ENABLED; + button[2].fsStyle = BTNS_SEP; + button[2].dwData = 0; + button[2].iString = 0; + + button[3].iBitmap = view_icons_index + VIEW_PARENTFOLDER; + button[3].idCommand = IDC_NAVPARENTFOLDER; + button[3].fsState = TBSTATE_ENABLED; + button[3].fsStyle = BTNS_BUTTON; + button[3].dwData = 0; + button[3].iString = 0; + + SendMessageW(htoolbar, TB_ADDBUTTONSW, 4, (LPARAM)button); SendMessageW(htoolbar, TB_SETBUTTONSIZE, 0, MAKELPARAM(24,24)); SendMessageW(htoolbar, TB_AUTOSIZE, 0, 0); } @@ -2160,6 +2179,13 @@ static LRESULT on_browse_forward(FileDialogImpl *This) return FALSE; }
+static LRESULT on_browse_parentfolder(FileDialogImpl *This) +{ + TRACE("%p\n", This); + IExplorerBrowser_BrowseToIDList(This->peb, NULL, SBSP_PARENT); + return FALSE; +} + static LRESULT on_command_filetype(FileDialogImpl *This, WPARAM wparam, LPARAM lparam) { if(HIWORD(wparam) == CBN_SELCHANGE) @@ -2218,6 +2244,7 @@ static LRESULT on_wm_command(FileDialogImpl *This, WPARAM wparam, LPARAM lparam) case psh1: return on_command_opendropdown(This, wparam, lparam); case IDC_NAVBACK: return on_browse_back(This); case IDC_NAVFORWARD: return on_browse_forward(This); + case IDC_NAVPARENTFOLDER: return on_browse_parentfolder(This); case IDC_FILETYPE: return on_command_filetype(This, wparam, lparam); default: TRACE("Unknown command.\n"); }
On Thu Mar 9 05:54:53 2023 +0000, Florian Will wrote:
changed this line in [version 2 of the diff](/wine/wine/-/merge_requests/2348/diffs?diff_id=36172&start_sha=3b89d1ff6c1e05bf628468ee5d8b0c9954ed9a76#941712bdad220aba7d6798d478d2fe9a0ed5c6d0_1927_1927)
And even if it fails for some reason, it's probably better to have a button with an incorrect icon (that users would notice and report) than no button at all.
Removed that failure check in v2, thanks a lot for your always helpful reviews :-)
Oh, now I found !1857 . That one looks really great. Merging my patch would probably be annoying for Vladislav when rebasing, so if there's a chance of his patches making it across the finish line before wine 9.0, I think it would be better to wait for that and put this merge request on hold.
This merge request was closed by Florian Will.
Closing in favor of !2993 . Thanks for your work on this, Vladislav! And thanks, Esme, for the reviews.