From: Vladislav Timonin timoninvlad@yandex.ru
--- dlls/comdlg32/itemdlg.c | 18 +++++++++++ dlls/comdlg32/navbar.c | 66 +++++++++++++++++++++++++++++++++++++---- dlls/comdlg32/navbar.h | 1 + 3 files changed, 79 insertions(+), 6 deletions(-)
diff --git a/dlls/comdlg32/itemdlg.c b/dlls/comdlg32/itemdlg.c index 453c83dcf1a..4c7d4fa0fdf 100644 --- a/dlls/comdlg32/itemdlg.c +++ b/dlls/comdlg32/itemdlg.c @@ -2176,6 +2176,23 @@ static LRESULT on_browse_pidl(FileDialogImpl *This, LPARAM lparam) return FALSE; }
+static LRESULT on_browse_refresh(FileDialogImpl *This) +{ + IShellView *psv; + HRESULT hr; + + TRACE("%p\n", This); + + hr = IExplorerBrowser_GetCurrentView(This->peb, &IID_IShellView, (void**)&psv); + if (SUCCEEDED(hr)) + { + IShellView_Refresh(psv); + IShellView_Release(psv); + } + + return FALSE; +} + static LRESULT on_command_filetype(FileDialogImpl *This, WPARAM wparam, LPARAM lparam) { if(HIWORD(wparam) == CBN_SELCHANGE) @@ -2253,6 +2270,7 @@ static INT_PTR CALLBACK itemdlg_dlgproc(HWND hwnd, UINT umessage, WPARAM wparam, case NBN_NAVFORWARD: return on_browse_forward(This); case NBN_NAVUP: return on_browse_up(This); case NBN_NAVPIDL: return on_browse_pidl(This, lparam); + case NBN_NAVREFRESH: return on_browse_refresh(This); }
return FALSE; diff --git a/dlls/comdlg32/navbar.c b/dlls/comdlg32/navbar.c index 3107e6324c0..228080fafd1 100644 --- a/dlls/comdlg32/navbar.c +++ b/dlls/comdlg32/navbar.c @@ -16,6 +16,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(commdlg); #define IDC_NAVFORWARD 202 #define IDC_NAVUP 203 #define IDC_NAVCRUMB 204 +#define IDC_NAVREFRESHGOTO 205
typedef struct { HWND parent_hwnd; @@ -28,6 +29,7 @@ typedef struct { HWND back_btn_hwnd; HWND fwd_btn_hwnd; HWND up_btn_hwnd; + HWND refresh_goto_btn_hwnd;
HWND background_hwnd; INT background_x; @@ -70,6 +72,7 @@ static void NAVBAR_PATHEDIT_Edit(NAVBAR_INFO *info) { struct crumb *crumb; HDWP hdwp; + HICON icon;
NAVBAR_PATHEDIT_SetCurrentPath(info);
@@ -82,6 +85,11 @@ static void NAVBAR_PATHEDIT_Edit(NAVBAR_INFO *info) hdwp = DeferWindowPos(hdwp, info->background_hwnd, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_HIDEWINDOW); EndDeferWindowPos(hdwp);
+ /* change the Refresh button to Go to button */ + icon = ImageList_GetIcon(info->icons, ILI_FORWARD, ILD_NORMAL); + SendMessageW(info->refresh_goto_btn_hwnd, BM_SETIMAGE, (WPARAM)IMAGE_ICON, (LPARAM)icon); + DestroyIcon(icon); + SetFocus(info->pathedit_hwnd); }
@@ -94,6 +102,7 @@ static void NAVBAR_PATHEDIT_Copy(NAVBAR_INFO *info) static void NAVBAR_PATHEDIT_Dismiss(NAVBAR_INFO *info) { HDWP hdwp; + HICON icon;
if (!IsWindowVisible(info->pathedit_hwnd)) return; @@ -104,11 +113,19 @@ static void NAVBAR_PATHEDIT_Dismiss(NAVBAR_INFO *info) hdwp = DeferWindowPos(hdwp, info->overflow_hwnd, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW); hdwp = NAVBAR_DoLayout(info, hdwp); EndDeferWindowPos(hdwp); + + /* change the Go to button back to Refresh button */ + icon = ImageList_GetIcon(info->icons, ILI_REFRESH, ILD_NORMAL); + SendMessageW(info->refresh_goto_btn_hwnd, BM_SETIMAGE, (WPARAM)IMAGE_ICON, (LPARAM)icon); + DestroyIcon(icon); }
static LRESULT NAVBAR_PATHEDIT_KillFocus(HWND hwnd, NAVBAR_INFO *info, UINT msg, WPARAM wparam, LPARAM lparam) { - NAVBAR_PATHEDIT_Dismiss(info); + /* if user clicked on the Go to button, don't dismiss the path edit, */ + /* let either Go to focus handler or NAVBAR_Command dismiss it */ + if (GetFocus() != info->refresh_goto_btn_hwnd) + NAVBAR_PATHEDIT_Dismiss(info);
return DefSubclassProc(hwnd, msg, wparam, lparam); } @@ -276,6 +293,21 @@ static LRESULT CALLBACK NAVBAR_PATHEDIT_SubclassProc(HWND hwnd, UINT msg, WPARAM return DefSubclassProc(hwnd, msg, wparam, lparam); }
+static LRESULT CALLBACK NAVBAR_REFRESHGOTO_SubclassProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, UINT_PTR id_subclass, DWORD_PTR ref_data) +{ + NAVBAR_INFO *info = (NAVBAR_INFO *)ref_data; + + switch (msg) + { + case WM_KILLFOCUS: + if (GetFocus() != info->pathedit_hwnd) + NAVBAR_PATHEDIT_Dismiss(info); + break; + } + + return DefSubclassProc(hwnd, msg, wparam, lparam); +} + static LRESULT CALLBACK NAVBAR_RMBMENU_SubclassProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, UINT_PTR id_subclass, DWORD_PTR ref_data) { NAVBAR_INFO *info = (NAVBAR_INFO *)ref_data; @@ -443,10 +475,10 @@ static LRESULT CALLBACK NAVBAR_BACKGROUND_SubclassProc(HWND hwnd, UINT msg, WPAR
static void NAVBAR_CalcLayout(NAVBAR_INFO *info) { - RECT container_rc, overflow_rc; + RECT container_rc, overflow_rc, refresh_goto_btn_rc; struct crumb *crumb1, *crumb2; INT padding, container_w, - buttons_w, overflow_w, max_crumbs_w, + buttons_w, overflow_w, max_crumbs_w, refresh_goto_btn_w, w = 0, crumbs_visible_n = 0, prev_x;
if (!GetWindowRect(info->container_hwnd, &container_rc)) @@ -468,10 +500,15 @@ static void NAVBAR_CalcLayout(NAVBAR_INFO *info) if (max_crumbs_w < 0) return;
- SetWindowPos(info->pathedit_hwnd, NULL, 0, 0, overflow_w + max_crumbs_w, info->container_h, SWP_NOMOVE); + if (!GetClientRect(info->refresh_goto_btn_hwnd, &refresh_goto_btn_rc)) + return; + refresh_goto_btn_w = refresh_goto_btn_rc.right - refresh_goto_btn_rc.left; + + SetWindowPos(info->pathedit_hwnd, NULL, 0, 0, overflow_w + max_crumbs_w - refresh_goto_btn_w, info->container_h, SWP_NOMOVE); + SetWindowPos(info->refresh_goto_btn_hwnd, NULL, container_w - refresh_goto_btn_w, 0, 0, 0, SWP_NOSIZE);
/* reserve some space on the right side for click-to-edit area */ - max_crumbs_w -= MulDiv(64, info->dpi_x, USER_DEFAULT_SCREEN_DPI); + max_crumbs_w -= MulDiv(64 + refresh_goto_btn_w, info->dpi_x, USER_DEFAULT_SCREEN_DPI); if (max_crumbs_w < 0) return;
@@ -543,7 +580,7 @@ static void NAVBAR_CalcLayout(NAVBAR_INFO *info) prev_x = buttons_w + w;
info->background_x = prev_x; - info->background_w = container_rc.right - prev_x; + info->background_w = container_rc.right - refresh_goto_btn_w - prev_x;
info->crumbs_visible_n = crumbs_visible_n;
@@ -735,6 +772,16 @@ static LRESULT NAVBAR_Create(HWND hwnd, NAVBAR_INFO *info, UINT msg, WPARAM wpar SendMessageW(info->pathedit_hwnd, WM_SETFONT, (WPARAM)gui_font, FALSE); SetWindowSubclass(info->pathedit_hwnd, NAVBAR_PATHEDIT_SubclassProc, 0, (DWORD_PTR)info);
+ info->refresh_goto_btn_hwnd = CreateWindowExW(0, WC_BUTTONW, NULL, + WS_CHILD | WS_VISIBLE | BS_ICON | BS_BITMAP, + 0, 0, cs->cy, cs->cy, + hwnd, (HMENU)IDC_NAVREFRESHGOTO, COMDLG32_hInstance, NULL); + SendMessageW(info->refresh_goto_btn_hwnd, WM_SETFONT, (WPARAM)gui_font, FALSE); + icon = ImageList_GetIcon(info->icons, ILI_REFRESH, ILD_NORMAL); + SendMessageW(info->refresh_goto_btn_hwnd, BM_SETIMAGE, (WPARAM)IMAGE_ICON, (LPARAM)icon); + DestroyIcon(icon); + SetWindowSubclass(info->refresh_goto_btn_hwnd, NAVBAR_REFRESHGOTO_SubclassProc, 0, (DWORD_PTR)info); + SetWindowLongPtrW(hwnd, 0, (DWORD_PTR)info);
return DefWindowProcW(hwnd, msg, wparam, lparam); @@ -761,6 +808,7 @@ static LRESULT NAVBAR_Destroy(HWND hwnd, NAVBAR_INFO *info, UINT msg, WPARAM wpa DestroyWindow(info->back_btn_hwnd); DestroyWindow(info->fwd_btn_hwnd); DestroyWindow(info->up_btn_hwnd); + DestroyWindow(info->refresh_goto_btn_hwnd); DestroyWindow(info->background_hwnd); DestroyWindow(info->overflow_hwnd); NAVBAR_OVERFLOW_Clear(info); @@ -808,6 +856,12 @@ static LRESULT NAVBAR_Command(HWND hwnd, NAVBAR_INFO *info, UINT msg, WPARAM wpa SendMessageW(info->parent_hwnd, NBN_NAVPIDL, 0, (LPARAM)pidl); break; } + case IDC_NAVREFRESHGOTO: + if (IsWindowVisible(info->pathedit_hwnd)) + NAVBAR_PATHEDIT_GoTo(info); + else + SendMessageW(info->parent_hwnd, NBN_NAVREFRESH, 0, 0); + break; }
return DefWindowProcW(hwnd, msg, wparam, lparam); diff --git a/dlls/comdlg32/navbar.h b/dlls/comdlg32/navbar.h index 1438fd2b322..f4d0eb73c45 100644 --- a/dlls/comdlg32/navbar.h +++ b/dlls/comdlg32/navbar.h @@ -13,6 +13,7 @@ #define NBN_NAVFORWARD WM_USER + 103 #define NBN_NAVUP WM_USER + 104 #define NBN_NAVPIDL WM_USER + 105 +#define NBN_NAVREFRESH WM_USER + 106
/* strings */ #define IDS_COPY_ADDRESS_AS_TEXT 2001