mirror of
https://github.com/reactos/reactos.git
synced 2025-06-24 10:10:16 +00:00
[RSHELL]
* Handle SMSET_BOTTOM on SetShellFolder so the shell items show below the static menu. * Downgrade some DbgPrints to TRACEs (reduces log spam). * Add some extra debugging messages to CMergedFolder. * Export the CMergedFolder constructor so it can be used from browseui. [BROWSEUI] * Use merged folders for the Favorites menu. svn path=/branches/shell-experiments/; revision=63683
This commit is contained in:
parent
20a3d5b994
commit
e362a0da43
8 changed files with 106 additions and 26 deletions
|
@ -75,7 +75,8 @@ CMenuBand::CMenuBand() :
|
|||
m_hotItem(-1),
|
||||
m_popupBar(NULL),
|
||||
m_popupItem(-1),
|
||||
m_Show(FALSE)
|
||||
m_Show(FALSE),
|
||||
m_shellBottom(FALSE)
|
||||
{
|
||||
m_focusManager = CMenuFocusManager::AcquireManager();
|
||||
}
|
||||
|
@ -292,6 +293,27 @@ HRESULT STDMETHODCALLTYPE CMenuBand::OnPosRectChangeDB(RECT *prc)
|
|||
int syStatic = maxStatic.cy;
|
||||
int syShlFld = sy - syStatic;
|
||||
|
||||
if (m_shellBottom)
|
||||
{
|
||||
if (m_SFToolbar)
|
||||
{
|
||||
m_SFToolbar->SetPosSize(
|
||||
prc->left,
|
||||
prc->top + syStatic,
|
||||
prc->right - prc->left,
|
||||
syShlFld);
|
||||
}
|
||||
if (m_staticToolbar)
|
||||
{
|
||||
m_staticToolbar->SetPosSize(
|
||||
prc->left,
|
||||
prc->top,
|
||||
prc->right - prc->left,
|
||||
syStatic);
|
||||
}
|
||||
}
|
||||
else // shell menu on top
|
||||
{
|
||||
if (m_SFToolbar)
|
||||
{
|
||||
m_SFToolbar->SetPosSize(
|
||||
|
@ -308,6 +330,7 @@ HRESULT STDMETHODCALLTYPE CMenuBand::OnPosRectChangeDB(RECT *prc)
|
|||
prc->right - prc->left,
|
||||
syStatic);
|
||||
}
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -637,6 +660,8 @@ HRESULT STDMETHODCALLTYPE CMenuBand::SetShellFolder(IShellFolder *psf, LPCITEMID
|
|||
if (FAILED_UNEXPECTEDLY(hr))
|
||||
return hr;
|
||||
|
||||
m_shellBottom = (dwFlags & SMSET_BOTTOM) != 0;
|
||||
|
||||
if (m_site)
|
||||
{
|
||||
HWND hwndParent;
|
||||
|
|
|
@ -66,6 +66,7 @@ private:
|
|||
INT m_popupItem;
|
||||
|
||||
BOOL m_Show;
|
||||
BOOL m_shellBottom;
|
||||
|
||||
public:
|
||||
CMenuBand();
|
||||
|
|
|
@ -315,7 +315,7 @@ LRESULT CMenuFocusManager::ProcessMouseMove(MSG* msg)
|
|||
StackEntry * entry = NULL;
|
||||
if (IsTrackedWindow(child, &entry) == S_OK)
|
||||
{
|
||||
DbgPrint("MouseMove %d\n", m_isLButtonDown);
|
||||
TRACE("MouseMove %d\n", m_isLButtonDown);
|
||||
}
|
||||
|
||||
BOOL isTracking = FALSE;
|
||||
|
@ -392,7 +392,7 @@ LRESULT CMenuFocusManager::ProcessMouseDown(MSG* msg)
|
|||
if (IsTrackedWindow(child, &entry) != S_OK)
|
||||
return TRUE;
|
||||
|
||||
DbgPrint("MouseDown %d\n", m_isLButtonDown);
|
||||
TRACE("MouseDown %d\n", m_isLButtonDown);
|
||||
|
||||
BOOL isTracking = FALSE;
|
||||
if (entry)
|
||||
|
@ -403,7 +403,7 @@ LRESULT CMenuFocusManager::ProcessMouseDown(MSG* msg)
|
|||
|
||||
if (iHitTestResult >= 0)
|
||||
{
|
||||
DbgPrint("MouseDown send %d\n", iHitTestResult);
|
||||
TRACE("MouseDown send %d\n", iHitTestResult);
|
||||
entry->mb->_MenuBarMouseDown(child, iHitTestResult);
|
||||
}
|
||||
}
|
||||
|
@ -414,7 +414,7 @@ LRESULT CMenuFocusManager::ProcessMouseDown(MSG* msg)
|
|||
m_movedSinceDown = FALSE;
|
||||
m_windowAtDown = child;
|
||||
|
||||
DbgPrint("MouseDown end %d\n", m_isLButtonDown);
|
||||
TRACE("MouseDown end %d\n", m_isLButtonDown);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -442,7 +442,7 @@ LRESULT CMenuFocusManager::ProcessMouseUp(MSG* msg)
|
|||
if (IsTrackedWindow(child, &entry) != S_OK)
|
||||
return TRUE;
|
||||
|
||||
DbgPrint("MouseUp %d\n", m_isLButtonDown);
|
||||
TRACE("MouseUp %d\n", m_isLButtonDown);
|
||||
|
||||
BOOL isTracking = FALSE;
|
||||
if (entry)
|
||||
|
@ -453,7 +453,7 @@ LRESULT CMenuFocusManager::ProcessMouseUp(MSG* msg)
|
|||
|
||||
if (iHitTestResult >= 0)
|
||||
{
|
||||
DbgPrint("MouseUp send %d\n", iHitTestResult);
|
||||
TRACE("MouseUp send %d\n", iHitTestResult);
|
||||
entry->mb->_MenuBarMouseUp(child, iHitTestResult);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -356,6 +356,18 @@ HRESULT WINAPI CMergedFolder_Constructor(IShellFolder* userLocal, IShellFolder*
|
|||
return hr;
|
||||
}
|
||||
|
||||
CMergedFolder::CMergedFolder() :
|
||||
m_UserLocal(NULL),
|
||||
m_AllUSers(NULL),
|
||||
m_EnumSource(NULL),
|
||||
m_shellPidl(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
CMergedFolder::~CMergedFolder()
|
||||
{
|
||||
}
|
||||
|
||||
HRESULT CMergedFolder::_SetSources(IShellFolder* userLocal, IShellFolder* allUsers)
|
||||
{
|
||||
m_UserLocal = userLocal;
|
||||
|
@ -382,6 +394,7 @@ HRESULT STDMETHODCALLTYPE CMergedFolder::EnumObjects(
|
|||
SHCONTF grfFlags,
|
||||
IEnumIDList **ppenumIDList)
|
||||
{
|
||||
DbgPrint("EnumObjects\n");
|
||||
HRESULT hr = m_EnumSource->QueryInterface(IID_PPV_ARG(IEnumIDList, ppenumIDList));
|
||||
if (FAILED_UNEXPECTEDLY(hr))
|
||||
return hr;
|
||||
|
@ -397,12 +410,14 @@ HRESULT STDMETHODCALLTYPE CMergedFolder::BindToObject(
|
|||
LocalPidlInfo info;
|
||||
HRESULT hr;
|
||||
|
||||
DbgPrint("BindToObject\n");
|
||||
|
||||
hr = m_EnumSource->FindPidlInList(pidl, &info);
|
||||
if (FAILED_UNEXPECTEDLY(hr))
|
||||
return hr;
|
||||
|
||||
if (!info.shared)
|
||||
return info.parent->BindToObject(pidl, pbcReserved, riid, ppvOut);
|
||||
return info.parent->BindToObject(info.pidl, pbcReserved, riid, ppvOut);
|
||||
|
||||
if (riid != IID_IShellFolder)
|
||||
return E_FAIL;
|
||||
|
@ -410,11 +425,11 @@ HRESULT STDMETHODCALLTYPE CMergedFolder::BindToObject(
|
|||
CComPtr<IShellFolder> fld1;
|
||||
CComPtr<IShellFolder> fld2;
|
||||
|
||||
hr = m_UserLocal->BindToObject(pidl, pbcReserved, IID_PPV_ARG(IShellFolder, &fld1));
|
||||
hr = m_UserLocal->BindToObject(info.pidl, pbcReserved, IID_PPV_ARG(IShellFolder, &fld1));
|
||||
if (FAILED_UNEXPECTEDLY(hr))
|
||||
return hr;
|
||||
|
||||
hr = m_AllUSers->BindToObject(pidl, pbcReserved, IID_PPV_ARG(IShellFolder, &fld2));
|
||||
hr = m_AllUSers->BindToObject(info.pidl, pbcReserved, IID_PPV_ARG(IShellFolder, &fld2));
|
||||
if (FAILED_UNEXPECTEDLY(hr))
|
||||
return hr;
|
||||
|
||||
|
@ -436,6 +451,7 @@ HRESULT STDMETHODCALLTYPE CMergedFolder::CompareIDs(
|
|||
LPCITEMIDLIST pidl1,
|
||||
LPCITEMIDLIST pidl2)
|
||||
{
|
||||
DbgPrint("CompareIDs\n");
|
||||
return m_UserLocal->CompareIDs(lParam, pidl1, pidl2);
|
||||
}
|
||||
|
||||
|
@ -456,6 +472,8 @@ HRESULT STDMETHODCALLTYPE CMergedFolder::GetAttributesOf(
|
|||
LocalPidlInfo info;
|
||||
HRESULT hr;
|
||||
|
||||
DbgPrint("GetAttributesOf\n");
|
||||
|
||||
for (int i = 0; i < (int)cidl; i++)
|
||||
{
|
||||
LPCITEMIDLIST pidl = apidl[i];
|
||||
|
@ -464,6 +482,8 @@ HRESULT STDMETHODCALLTYPE CMergedFolder::GetAttributesOf(
|
|||
if (FAILED_UNEXPECTEDLY(hr))
|
||||
return hr;
|
||||
|
||||
pidl = info.pidl;
|
||||
|
||||
SFGAOF * pinOut1 = rgfInOut ? rgfInOut + i : NULL;
|
||||
|
||||
hr = info.parent->GetAttributesOf(1, &pidl, pinOut1);
|
||||
|
@ -486,6 +506,8 @@ HRESULT STDMETHODCALLTYPE CMergedFolder::GetUIObjectOf(
|
|||
LocalPidlInfo info;
|
||||
HRESULT hr;
|
||||
|
||||
DbgPrint("GetUIObjectOf\n");
|
||||
|
||||
for (int i = 0; i < (int)cidl; i++)
|
||||
{
|
||||
LPCITEMIDLIST pidl = apidl[i];
|
||||
|
@ -496,6 +518,8 @@ HRESULT STDMETHODCALLTYPE CMergedFolder::GetUIObjectOf(
|
|||
if (FAILED_UNEXPECTEDLY(hr))
|
||||
return hr;
|
||||
|
||||
pidl = info.pidl;
|
||||
|
||||
TRACE("FindPidlInList succeeded with parent %p and pidl { db=%d }\n", info.parent, info.pidl->mkid.cb);
|
||||
|
||||
UINT * pinOut1 = prgfInOut ? prgfInOut+i : NULL;
|
||||
|
@ -518,11 +542,13 @@ HRESULT STDMETHODCALLTYPE CMergedFolder::GetDisplayNameOf(
|
|||
LocalPidlInfo info;
|
||||
HRESULT hr;
|
||||
|
||||
DbgPrint("GetDisplayNameOf\n");
|
||||
|
||||
hr = m_EnumSource->FindPidlInList(pidl, &info);
|
||||
if (FAILED_UNEXPECTEDLY(hr))
|
||||
return hr;
|
||||
|
||||
hr = info.parent->GetDisplayNameOf(pidl, uFlags, lpName);
|
||||
hr = info.parent->GetDisplayNameOf(info.pidl, uFlags, lpName);
|
||||
|
||||
if (FAILED_UNEXPECTEDLY(hr))
|
||||
return hr;
|
||||
|
|
|
@ -43,8 +43,8 @@ private:
|
|||
LPITEMIDLIST m_shellPidl;
|
||||
|
||||
public:
|
||||
CMergedFolder() {}
|
||||
virtual ~CMergedFolder() {}
|
||||
CMergedFolder();
|
||||
virtual ~CMergedFolder();
|
||||
|
||||
HRESULT _SetSources(IShellFolder* userLocal, IShellFolder* allUSers);
|
||||
|
||||
|
|
|
@ -2,3 +2,4 @@
|
|||
@ stdcall CMenuDeskBar_Constructor(ptr ptr);
|
||||
@ stdcall CMenuSite_Constructor(ptr ptr);
|
||||
@ stdcall CMenuBand_Constructor(ptr ptr);
|
||||
@ stdcall CMergedFolder_Constructor(ptr ptr ptr ptr)
|
|
@ -74,6 +74,7 @@ extern HRESULT CreateBandProxy(REFIID riid, void **ppv);
|
|||
extern HRESULT CreateAddressBand(REFIID riid, void **ppv);
|
||||
|
||||
typedef HRESULT(WINAPI * PMENUBAND_CONSTRUCTOR)(REFIID riid, void **ppv);
|
||||
typedef HRESULT(WINAPI * PMERGEDFOLDER_CONSTRUCTOR)(IShellFolder* userLocal, IShellFolder* allUsers, REFIID riid, LPVOID *ppv);
|
||||
|
||||
HRESULT IUnknown_HasFocusIO(IUnknown * punk)
|
||||
{
|
||||
|
@ -397,6 +398,9 @@ HRESULT STDMETHODCALLTYPE CMenuCallback::GetObject(LPSMDATA psmd, REFIID riid, v
|
|||
CComPtr<IShellMenu> newMenu;
|
||||
CComPtr<IShellFolder> favoritesFolder;
|
||||
LPITEMIDLIST favoritesPIDL;
|
||||
CComPtr<IShellFolder> commonFavsFolder;
|
||||
LPITEMIDLIST commonFavsPIDL;
|
||||
CComPtr<IShellFolder> mergedFolder;
|
||||
HWND ownerWindow;
|
||||
HMENU parentHMenu;
|
||||
HMENU favoritesHMenu;
|
||||
|
@ -456,7 +460,28 @@ HRESULT STDMETHODCALLTYPE CMenuCallback::GetObject(LPSMDATA psmd, REFIID riid, v
|
|||
return hResult;
|
||||
RegCreateKeyEx(HKEY_CURRENT_USER, szFavoritesKey,
|
||||
0, NULL, 0, KEY_READ | KEY_WRITE, NULL, &orderRegKey, &disposition);
|
||||
hResult = newMenu->SetShellFolder(favoritesFolder, favoritesPIDL, orderRegKey, SMSET_BOTTOM | 0x18);
|
||||
#if 1 /*USE_MERGED_FAVORITES*/
|
||||
hResult = SHGetSpecialFolderLocation(NULL, CSIDL_COMMON_FAVORITES, &commonFavsPIDL);
|
||||
if (FAILED_UNEXPECTEDLY(hResult))
|
||||
return hResult;
|
||||
hResult = SHBindToFolder(commonFavsPIDL, &commonFavsFolder);
|
||||
if (FAILED_UNEXPECTEDLY(hResult))
|
||||
return hResult;
|
||||
ILFree(commonFavsPIDL);
|
||||
|
||||
PMERGEDFOLDER_CONSTRUCTOR mfconstruct = (PMERGEDFOLDER_CONSTRUCTOR) GetProcAddress(hrs, "CMergedFolder_Constructor");
|
||||
if (mfconstruct)
|
||||
{
|
||||
hResult = mfconstruct(favoritesFolder, commonFavsFolder, IID_PPV_ARG(IShellFolder, &mergedFolder));
|
||||
}
|
||||
else
|
||||
{
|
||||
mergedFolder = favoritesFolder;
|
||||
}
|
||||
#else
|
||||
mergedFolder = favoritesFolder;
|
||||
#endif
|
||||
hResult = newMenu->SetShellFolder(mergedFolder, favoritesPIDL, orderRegKey, SMSET_BOTTOM | SMINIT_CACHED | SMINV_ID);
|
||||
ILFree(favoritesPIDL);
|
||||
if (SUCCEEDED(hResult))
|
||||
fFavoritesMenu.Attach(newMenu.Detach());
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
|
||||
project(SHELL)
|
||||
|
||||
add_definitions(
|
||||
-D__WINESRC__
|
||||
-D_SHLWAPI_)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue