mirror of
https://github.com/reactos/reactos.git
synced 2025-04-27 17:10:22 +00:00
[BROWSEUI] Use the last id for custom find files menu item (#7918)
This commit is contained in:
parent
6faee56f86
commit
fcc2247774
2 changed files with 18 additions and 12 deletions
|
@ -904,15 +904,24 @@ class CFindFolderContextMenu :
|
||||||
{
|
{
|
||||||
CComPtr<IContextMenu> m_pInner;
|
CComPtr<IContextMenu> m_pInner;
|
||||||
CComPtr<IShellFolderView> m_shellFolderView;
|
CComPtr<IShellFolderView> m_shellFolderView;
|
||||||
UINT m_firstCmdId;
|
UINT m_MyFirstId = 0;
|
||||||
static const UINT ADDITIONAL_MENU_ITEMS = 2;
|
static const UINT ADDITIONAL_MENU_ITEMS = 2;
|
||||||
|
|
||||||
//// *** IContextMenu methods ***
|
//// *** IContextMenu methods ***
|
||||||
STDMETHODIMP QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags)
|
STDMETHODIMP QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags)
|
||||||
{
|
{
|
||||||
m_firstCmdId = idCmdFirst;
|
m_MyFirstId = 0;
|
||||||
_InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst++, MFT_STRING, MAKEINTRESOURCEW(IDS_SEARCH_OPEN_FOLDER), MFS_ENABLED);
|
if (idCmdLast - idCmdFirst > ADDITIONAL_MENU_ITEMS)
|
||||||
_InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst++, MFT_SEPARATOR, NULL, 0);
|
{
|
||||||
|
// We use the last available id. For DefView, this places us at
|
||||||
|
// DVIDM_CONTEXTMENU_LAST which should not collide with anything.
|
||||||
|
// This is just a temporary fix until we are moved to shell32 and
|
||||||
|
// can use DFM_MERGECONTEXTMENU.
|
||||||
|
_InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdLast--, MFT_STRING,
|
||||||
|
MAKEINTRESOURCEW(IDS_SEARCH_OPEN_FOLDER), MFS_ENABLED);
|
||||||
|
_InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdLast--, MFT_SEPARATOR, NULL, 0);
|
||||||
|
m_MyFirstId = idCmdLast + 1;
|
||||||
|
}
|
||||||
return m_pInner->QueryContextMenu(hMenu, indexMenu, idCmdFirst, idCmdLast, uFlags);
|
return m_pInner->QueryContextMenu(hMenu, indexMenu, idCmdFirst, idCmdLast, uFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -923,7 +932,8 @@ class CFindFolderContextMenu :
|
||||||
return m_pInner->InvokeCommand(lpcmi);
|
return m_pInner->InvokeCommand(lpcmi);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LOWORD(lpcmi->lpVerb) >= m_firstCmdId && LOWORD(lpcmi->lpVerb) < m_firstCmdId + ADDITIONAL_MENU_ITEMS)
|
UINT idCmd = LOWORD(lpcmi->lpVerb);
|
||||||
|
if (m_MyFirstId && idCmd >= m_MyFirstId && idCmd < m_MyFirstId + ADDITIONAL_MENU_ITEMS)
|
||||||
{
|
{
|
||||||
PCUITEMID_CHILD *apidl;
|
PCUITEMID_CHILD *apidl;
|
||||||
UINT cidl;
|
UINT cidl;
|
||||||
|
@ -944,11 +954,7 @@ class CFindFolderContextMenu :
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: We can't block FCIDM_SHVIEW_REFRESH here, add items on SFVM_LISTREFRESHED instead
|
// FIXME: We can't block FCIDM_SHVIEW_REFRESH here, add items on SFVM_LISTREFRESHED instead
|
||||||
CMINVOKECOMMANDINFOEX actualCmdInfo;
|
return m_pInner->InvokeCommand(lpcmi);
|
||||||
memcpy(&actualCmdInfo, lpcmi, lpcmi->cbSize);
|
|
||||||
if (LOWORD(lpcmi->lpVerb) < FCIDM_SHVIEW_ARRANGE) // HACKFIX for DefView using direct FCIDM_SHVIEW ids
|
|
||||||
actualCmdInfo.lpVerb -= ADDITIONAL_MENU_ITEMS;
|
|
||||||
return m_pInner->InvokeCommand((CMINVOKECOMMANDINFO *)&actualCmdInfo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
STDMETHODIMP GetCommandString(UINT_PTR idCommand, UINT uFlags, UINT *lpReserved, LPSTR lpszName, UINT uMaxNameLen)
|
STDMETHODIMP GetCommandString(UINT_PTR idCommand, UINT uFlags, UINT *lpReserved, LPSTR lpszName, UINT uMaxNameLen)
|
||||||
|
|
|
@ -2586,7 +2586,7 @@ LRESULT CDefView::OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHand
|
||||||
case FCIDM_SHVIEW_INVERTSELECTION:
|
case FCIDM_SHVIEW_INVERTSELECTION:
|
||||||
nCount = m_ListView.GetItemCount();
|
nCount = m_ListView.GetItemCount();
|
||||||
for (int i=0; i < nCount; i++)
|
for (int i=0; i < nCount; i++)
|
||||||
m_ListView.SetItemState(i, m_ListView.GetItemState(i, LVIS_SELECTED) ? 0 : LVIS_SELECTED, LVIS_SELECTED);
|
m_ListView.SetItemState(i, m_ListView.GetItemState(i, LVIS_SELECTED) ^ LVIS_SELECTED, LVIS_SELECTED);
|
||||||
break;
|
break;
|
||||||
case FCIDM_SHVIEW_REFRESH:
|
case FCIDM_SHVIEW_REFRESH:
|
||||||
Refresh();
|
Refresh();
|
||||||
|
@ -4046,7 +4046,7 @@ HRESULT STDMETHODCALLTYPE CDefView::GetSelectedObjects(PCUITEMID_CHILD **pidl, U
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* it's documented that caller shouldn't PIDLs, only array itself */
|
// It's documented that caller shouldn't free the PIDLs, only the array itself
|
||||||
memcpy(*pidl, m_apidl, *items * sizeof(PCUITEMID_CHILD));
|
memcpy(*pidl, m_apidl, *items * sizeof(PCUITEMID_CHILD));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue