Author: dquintana Date: Wed Nov 12 17:13:05 2014 New Revision: 65389
URL: http://svn.reactos.org/svn/reactos?rev=65389&view=rev Log: [BROWSEUI] * Remove the unwanted "(Empty)" item from the static menu, the SF menu will add its own if needed.
[RSHELL] * Load the "(Empty)" string from shell32 resources.
[SHELL32] * Add the string resource for empty menus.
Modified: branches/shell-experiments/base/shell/explorer-new/traywnd.cpp branches/shell-experiments/base/shell/rshell/CMenuBand.cpp branches/shell-experiments/base/shell/rshell/CMenuToolbars.cpp branches/shell-experiments/dll/win32/browseui/internettoolbar.cpp branches/shell-experiments/dll/win32/browseui/shellbrowser.cpp branches/shell-experiments/dll/win32/shell32/lang/en-US.rc branches/shell-experiments/dll/win32/shell32/shresdef.h
Modified: branches/shell-experiments/base/shell/explorer-new/traywnd.cpp URL: http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/exp... ============================================================================== --- branches/shell-experiments/base/shell/explorer-new/traywnd.cpp [iso-8859-1] (original) +++ branches/shell-experiments/base/shell/explorer-new/traywnd.cpp [iso-8859-1] Wed Nov 12 17:13:05 2014 @@ -1345,8 +1345,7 @@ /* Make sure the height is at least the size of a caption icon. */ if (hIconStart != NULL) Size.cx += SmallIcon.cx + 4; - Size.cy = max(Size.cy, - SmallIcon.cy); + Size.cy = max(Size.cy, SmallIcon.cy);
/* Create the bitmap */ hbmp = CreateCompatibleBitmap(hDCScreen,
Modified: branches/shell-experiments/base/shell/rshell/CMenuBand.cpp URL: http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rsh... ============================================================================== --- branches/shell-experiments/base/shell/rshell/CMenuBand.cpp [iso-8859-1] (original) +++ branches/shell-experiments/base/shell/rshell/CMenuBand.cpp [iso-8859-1] Wed Nov 12 17:13:05 2014 @@ -132,7 +132,7 @@
BOOL created = FALSE;
- if (m_hmenu) + if (m_hmenu && m_hmenu != hmenu) { DestroyMenu(m_hmenu); m_hmenu = NULL;
Modified: branches/shell-experiments/base/shell/rshell/CMenuToolbars.cpp URL: http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rsh... ============================================================================== --- branches/shell-experiments/base/shell/rshell/CMenuToolbars.cpp [iso-8859-1] (original) +++ branches/shell-experiments/base/shell/rshell/CMenuToolbars.cpp [iso-8859-1] Wed Nov 12 17:13:05 2014 @@ -25,6 +25,8 @@ #include "CMenuBand.h" #include "CMenuToolbars.h"
+#define IDS_MENU_EMPTY 34561 + #define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp)) #define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp))
@@ -425,13 +427,18 @@ if (m_hasSizes) return S_OK;
+ TRACE("Sizes out of date, recalculating.\n"); + if (!m_hWnd) - return S_OK; + { + return S_OK; + }
// Obtain the ideal size, to be used as min and max - AutoSize(); GetMaxSize(&m_idealSize); GetIdealSize((m_initFlags & SMINIT_VERTICAL) != 0, &m_idealSize); + + TRACE("Ideal Size: (%d, %d) for %d buttons\n", m_idealSize, GetButtonCount());
// Obtain the button size, to be used as the integral size DWORD size = GetButtonSize(); @@ -1004,7 +1011,9 @@ HRESULT CMenuToolbarBase::AddPlaceholder() { TBBUTTON tbb = { 0 }; - PCWSTR MenuString = L"(Empty)"; // FIXME: Make localizable + WCHAR MenuString[128]; + + LoadStringW(GetModuleHandle(L"shell32.dll"), IDS_MENU_EMPTY, MenuString, _countof(MenuString));
tbb.fsState = 0; tbb.fsStyle = 0; @@ -1131,6 +1140,8 @@ m_hwndMenu = hwnd; m_dwMenuFlags = dwFlags;
+ ClearToolbar(); + return S_OK; }
@@ -1340,6 +1351,9 @@ m_idList = ILClone(pidlFolder); m_hKey = hKey; m_dwMenuFlags = dwFlags; + + ClearToolbar(); + return S_OK; }
Modified: branches/shell-experiments/dll/win32/browseui/internettoolbar.cpp URL: http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/brow... ============================================================================== --- branches/shell-experiments/dll/win32/browseui/internettoolbar.cpp [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/browseui/internettoolbar.cpp [iso-8859-1] Wed Nov 12 17:13:05 2014 @@ -547,18 +547,19 @@ if (psmd->uId != FCIDM_MENU_FAVORITES) return E_FAIL;
+ // create favorites menu + hResult = psmd->punk->QueryInterface(IID_PPV_ARG(IShellMenu, &parentMenu)); + if (FAILED_UNEXPECTEDLY(hResult)) + return hResult; + hResult = parentMenu->GetMenu(&parentHMenu, &ownerWindow, NULL); + if (FAILED_UNEXPECTEDLY(hResult)) + return hResult; + favoritesHMenu = GetSubMenu(parentHMenu, 3); + if (favoritesHMenu == NULL) + return E_FAIL; + if (fFavoritesMenu.p == NULL) { - // create favorites menu - hResult = psmd->punk->QueryInterface(IID_PPV_ARG(IShellMenu, &parentMenu)); - if (FAILED_UNEXPECTEDLY(hResult)) - return hResult; - hResult = parentMenu->GetMenu(&parentHMenu, &ownerWindow, NULL); - if (FAILED_UNEXPECTEDLY(hResult)) - return hResult; - favoritesHMenu = GetSubMenu(parentHMenu, 3); - if (favoritesHMenu == NULL) - return E_FAIL; #if USE_CUSTOM_MENUBAND if (!hRShell) { @@ -588,9 +589,6 @@ hResult = newMenu->Initialize(this, FCIDM_MENU_FAVORITES, -1, SMINIT_VERTICAL | SMINIT_CACHED); if (FAILED_UNEXPECTEDLY(hResult)) return hResult; - hResult = newMenu->SetMenu(favoritesHMenu, ownerWindow, SMSET_TOP | SMSET_DONTOWN); - if (FAILED_UNEXPECTEDLY(hResult)) - return hResult;
RegCreateKeyEx(HKEY_CURRENT_USER, szFavoritesKey, 0, NULL, 0, KEY_READ | KEY_WRITE, NULL, &orderRegKey, &disposition); @@ -608,6 +606,10 @@
fFavoritesMenu = newMenu; } + + hResult = fFavoritesMenu->SetMenu(favoritesHMenu, ownerWindow, SMSET_TOP | SMSET_DONTOWN); + if (FAILED_UNEXPECTEDLY(hResult)) + return hResult;
return fFavoritesMenu->QueryInterface(riid, ppvObject); } @@ -794,7 +796,16 @@ if (FAILED_UNEXPECTEDLY(hResult)) return hResult;
- hResult = menubar->SetMenu((HMENU) V_INTREF(&menuOut), ownerWindow, SMSET_DONTOWN); + HMENU hMenuBar = (HMENU) V_INTREF(&menuOut); + + // FIXME: Figure out the proper way to do this. + HMENU hMenuFavs = GetSubMenu(hMenuBar, 3); + if (hMenuFavs) + { + DeleteMenu(hMenuFavs, IDM_FAVORITES_EMPTY, MF_BYCOMMAND); + } + + hResult = menubar->SetMenu(hMenuBar, ownerWindow, SMSET_DONTOWN); if (FAILED_UNEXPECTEDLY(hResult)) return hResult; }
Modified: branches/shell-experiments/dll/win32/browseui/shellbrowser.cpp URL: http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/brow... ============================================================================== --- branches/shell-experiments/dll/win32/browseui/shellbrowser.cpp [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/browseui/shellbrowser.cpp [iso-8859-1] Wed Nov 12 17:13:05 2014 @@ -1874,6 +1874,17 @@ hResult = GetMenuBand(IID_PPV_ARG(IShellMenu, &shellMenu)); if (FAILED_UNEXPECTEDLY(hResult)) return hResult; + + if (hmenuShared) + { + // FIXME: Figure out the proper way to do this. + HMENU hMenuFavs = GetSubMenu(hmenuShared, 3); + if (hMenuFavs) + { + DeleteMenu(hMenuFavs, IDM_FAVORITES_EMPTY, MF_BYCOMMAND); + } + } + hResult = shellMenu->SetMenu(hmenuShared, m_hWnd, SMSET_DONTOWN); if (FAILED_UNEXPECTEDLY(hResult)) return hResult;
Modified: branches/shell-experiments/dll/win32/shell32/lang/en-US.rc URL: http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/shel... ============================================================================== --- branches/shell-experiments/dll/win32/shell32/lang/en-US.rc [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/shell32/lang/en-US.rc [iso-8859-1] Wed Nov 12 17:13:05 2014 @@ -798,4 +798,6 @@ IDS_BYTES_FORMAT "bytes" IDS_UNKNOWN_APP "Unknown application" IDS_EXE_DESCRIPTION "Description:" -END + + IDS_MENU_EMPTY "(Empty)" +END
Modified: branches/shell-experiments/dll/win32/shell32/shresdef.h URL: http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/shel... ============================================================================== --- branches/shell-experiments/dll/win32/shell32/shresdef.h [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/shell32/shresdef.h [iso-8859-1] Wed Nov 12 17:13:05 2014 @@ -201,6 +201,8 @@ #define IDS_INSERT 330 #define IDS_DESCRIPTION 331 #define IDS_COPY_OF 332 + +#define IDS_MENU_EMPTY 34561
/* Note: those strings are referenced from the registry */ #define IDS_RECYCLEBIN_FOLDER_NAME 8964