Author: dquintana
Date: Wed Oct 8 15:25:52 2014
New Revision: 64596
URL:
http://svn.reactos.org/svn/reactos?rev=64596&view=rev
Log:
[RSHELL]
[BROWSEUI]
* Add some traces
[SHELL32]
* Implement displaying the View popup from the toolbar.
Modified:
branches/shell-experiments/base/shell/rshell/CMenuFocusManager.cpp
branches/shell-experiments/dll/win32/browseui/internettoolbar.cpp
branches/shell-experiments/dll/win32/shell32/shlview.cpp
Modified: branches/shell-experiments/base/shell/rshell/CMenuFocusManager.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/CMenuFocusManager.cpp [iso-8859-1]
(original)
+++ branches/shell-experiments/base/shell/rshell/CMenuFocusManager.cpp [iso-8859-1] Wed
Oct 8 15:25:52 2014
@@ -378,6 +378,8 @@
HWND child;
int iHitTestResult = -1;
+ TRACE("ProcessMouseDown %d %d %d\n", msg->message, msg->wParam,
msg->lParam);
+
// Don't do anything if another window is capturing the mouse.
HWND cCapture = ::GetCapture();
if (cCapture && cCapture != m_captureHwnd && m_current->type !=
TrackedMenuEntry)
@@ -423,6 +425,8 @@
{
HWND child;
int iHitTestResult = -1;
+
+ TRACE("ProcessMouseUp %d %d %d\n", msg->message, msg->wParam,
msg->lParam);
// Don't do anything if another window is capturing the mouse.
HWND cCapture = ::GetCapture();
@@ -667,6 +671,8 @@
HRESULT hr;
StackEntry * old = m_current;
+ TRACE("UpdateFocus\n");
+
if (old)
SetCapture(NULL);
@@ -753,6 +759,8 @@
HRESULT CMenuFocusManager::PushMenuBar(CMenuBand * mb)
{
+ TRACE("PushTrackedPopup %p\n", mb);
+
_ASSERT(m_bandCount == 0);
HRESULT hr = PushToArray(MenuBarEntry, mb, NULL);
@@ -764,6 +772,8 @@
HRESULT CMenuFocusManager::PushMenuPopup(CMenuBand * mb)
{
+ TRACE("PushTrackedPopup %p\n", mb);
+
_ASSERT(!m_current || m_current->type != TrackedMenuEntry);
HRESULT hr = PushToArray(MenuPopupEntry, mb, NULL);
@@ -783,6 +793,8 @@
HRESULT CMenuFocusManager::PushTrackedPopup(HMENU popup)
{
+ TRACE("PushTrackedPopup %p\n", popup);
+
_ASSERT(m_bandCount > 0);
_ASSERT(!m_current || m_current->type != TrackedMenuEntry);
@@ -804,6 +816,8 @@
CMenuBand * mbc;
HRESULT hr;
+ TRACE("PopMenuBar %p\n", mb);
+
hr = PopFromArray(&type, &mbc, NULL);
if (FAILED_UNEXPECTEDLY(hr))
{
@@ -839,6 +853,8 @@
CMenuBand * mbc;
HRESULT hr;
+ TRACE("PopMenuPopup %p\n", mb);
+
hr = PopFromArray(&type, &mbc, NULL);
if (FAILED_UNEXPECTEDLY(hr))
{
@@ -874,6 +890,8 @@
HMENU hmenu;
HRESULT hr;
+ TRACE("PopTrackedPopup %p\n", popup);
+
hr = PopFromArray(&type, NULL, &hmenu);
if (FAILED_UNEXPECTEDLY(hr))
{
Modified: branches/shell-experiments/dll/win32/browseui/internettoolbar.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/bro…
==============================================================================
--- branches/shell-experiments/dll/win32/browseui/internettoolbar.cpp [iso-8859-1]
(original)
+++ branches/shell-experiments/dll/win32/browseui/internettoolbar.cpp [iso-8859-1] Wed Oct
8 15:25:52 2014
@@ -1287,6 +1287,8 @@
{
HRESULT hResult;
+ TRACE("SetCommandTarget %p category %s param %d\n", theTarget,
wine_dbgstr_guid(category), param14);
+
fCommandTarget.Release();
hResult = theTarget->QueryInterface(IID_PPV_ARG(IOleCommandTarget,
&fCommandTarget));
if (FAILED_UNEXPECTEDLY(hResult))
Modified: branches/shell-experiments/dll/win32/shell32/shlview.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
==============================================================================
--- branches/shell-experiments/dll/win32/shell32/shlview.cpp [iso-8859-1] (original)
+++ branches/shell-experiments/dll/win32/shell32/shlview.cpp [iso-8859-1] Wed Oct 8
15:25:52 2014
@@ -107,6 +107,13 @@
CComPtr<IContextMenu> m_pCM;
BOOL m_isEditing;
+
+ CLSID m_Category;
+ HMENU m_hView;
+ private:
+
+ HRESULT _MergeToolbar();
+
public:
CDefView();
~CDefView();
@@ -332,27 +339,6 @@
#define GET_WM_COMMAND_HWND(wp, lp) (HWND)(lp)
#define GET_WM_COMMAND_CMD(wp, lp) HIWORD(wp)
-/*
- Items merged into the toolbar and the filemenu
-*/
-typedef struct
-{ int idCommand;
- int iImage;
- int idButtonString;
- int idMenuString;
- BYTE bState;
- BYTE bStyle;
-} MYTOOLINFO, *LPMYTOOLINFO;
-
-static const MYTOOLINFO Tools[] =
-{
- { FCIDM_SHVIEW_BIGICON, 0, 0, IDS_VIEW_LARGE, TBSTATE_ENABLED, BTNS_BUTTON },
- { FCIDM_SHVIEW_SMALLICON, 0, 0, IDS_VIEW_SMALL, TBSTATE_ENABLED, BTNS_BUTTON },
- { FCIDM_SHVIEW_LISTVIEW, 0, 0, IDS_VIEW_LIST, TBSTATE_ENABLED, BTNS_BUTTON },
- { FCIDM_SHVIEW_REPORTVIEW, 0, 0, IDS_VIEW_DETAILS, TBSTATE_ENABLED, BTNS_BUTTON },
- { -1, 0, 0, 0, 0, 0}
-};
-
typedef void (CALLBACK *PFNSHGETSETTINGSPROC)(LPSHELLFLAGSTATE lpsfs, DWORD dwMask);
CDefView::CDefView()
@@ -378,6 +364,8 @@
m_ptLastMousePos.x = 0;
m_ptLastMousePos.y = 0;
m_isEditing = FALSE;
+ ZeroMemory(&m_Category, sizeof(m_Category));
+ m_hView = NULL;
}
CDefView::~CDefView()
@@ -1430,6 +1418,7 @@
}
/* initialize VIEW menu */
+
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_SUBMENU;
if (::GetMenuItemInfoW(m_hMenu, FCIDM_MENU_VIEW, FALSE, &mii))
@@ -1437,6 +1426,8 @@
HMENU menubase = ::LoadMenuW(shell32_hInstance,
L"MENU_001");
HMENU hSubMenu = mii.hSubMenu;
+
+ m_hView = CreatePopupMenu();
_InsertMenuItemW(hSubMenu, FCIDM_MENU_VIEW_SEP_OPTIONS, FALSE, 0,
MFT_SEPARATOR, NULL, MFS_ENABLED);
@@ -1451,6 +1442,8 @@
mii.dwTypeData = label;
mii.cch = _countof(label);
::GetMenuItemInfoW(menubase, i, TRUE, &mii);
+
+ ::AppendMenuW(m_hView, mii.fType, mii.wID, mii.dwTypeData);
TRACE("Adding item %d label %S type %d\n", mii.wID,
mii.dwTypeData, mii.fType);
@@ -2117,6 +2110,8 @@
TRACE("-- after fnInsertMenusSB\n");
}
+ _MergeToolbar();
+
return S_OK;
}
@@ -2661,6 +2656,40 @@
if (!pguidCmdGroup)
return OLECMDERR_E_UNKNOWNGROUP;
+ if (IsEqualCLSID(*pguidCmdGroup, m_Category))
+ {
+ if (nCmdID == FCIDM_SHVIEW_AUTOARRANGE)
+ {
+ if (V_VT(pvaIn) != VT_INT_PTR)
+ return OLECMDERR_E_NOTSUPPORTED;
+
+
+ TPMPARAMS params;
+ params.cbSize = sizeof(params);
+ params.rcExclude = *(RECT*) V_INTREF(pvaIn);
+
+ HMENU hView = m_hView;
+#if 0
+ hView = CreatePopupMenu();
+ AppendMenuW(hView, MF_STRING, FCIDM_SHVIEW_BIGICON, L"Big!");
+ AppendMenuW(hView, MF_STRING, FCIDM_SHVIEW_SMALLICON, L"Small!");
+ AppendMenuW(hView, MF_STRING, FCIDM_SHVIEW_LISTVIEW, L"List!");
+ AppendMenuW(hView, MF_STRING, FCIDM_SHVIEW_REPORTVIEW,
L"Report!");
+#endif
+
+ if (hView)
+ {
+ PrepareShowViewMenu(hView);
+
+ TrackPopupMenuEx(hView, TPM_LEFTALIGN | TPM_TOPALIGN,
params.rcExclude.left, params.rcExclude.bottom, m_hWndParent, ¶ms);
+ }
+
+ // pvaOut is VT_I4 with value 0x403 (cmd id of the new mode maybe?)
+ V_VT(pvaOut) = VT_I4;
+ V_I4(pvaOut) = 0x403;
+ }
+ }
+
if (IsEqualIID(*pguidCmdGroup, CGID_Explorer) &&
(nCmdID == 0x29) &&
(nCmdexecopt == 4) && pvaOut)
@@ -2913,6 +2942,33 @@
return E_NOINTERFACE;
}
+HRESULT CDefView::_MergeToolbar()
+{
+ CComPtr<IExplorerToolbar> ptb; // [sp+8h] [bp-4h]@1
+
+ HRESULT hr = S_OK;
+
+ hr = IUnknown_QueryService(m_pShellBrowser, IID_IExplorerToolbar,
IID_PPV_ARG(IExplorerToolbar, &ptb));
+ if (FAILED(hr))
+ return hr;
+
+ m_Category = CGID_DefViewFrame;
+
+ hr = ptb->SetCommandTarget(static_cast<IOleCommandTarget*>(this),
&m_Category, 0);
+ if (FAILED(hr))
+ return hr;
+
+ if (hr == S_FALSE)
+ return S_OK;
+
+#if 0
+ hr = ptb->AddButtons(&m_Category, buttonsCount, buttons);
+ if (FAILED(hr))
+ return hr;
+#endif
+
+ return S_OK;
+}
/**********************************************************
* IShellView_Constructor
*/