mirror of
https://github.com/reactos/reactos.git
synced 2026-06-01 00:40:26 +08:00
[FONTEXT][SHELL32][SDK] Support delete operation (#8639)
Improve usability of Fonts folder. JIRA issue: CORE-17311 - Modify PIDL design to contain name and filename. - Implement CFontExt:: ParseDisplayName to parsing name as PIDL. - Modify CDefaultContextMenu:: GetCommandString and CDefaultContextMenu:: DoCopyOrCut for DFM_GETVERBA, DFM_GETVERBW, DFM_CMD_COPY, and DFM_CMD_MOVE. - Add IDS_CONFIRM_DELETE_FONT, IDS_CANTDELETEFONT, and IDS_PROPERTIES resource strings. - Add SHMultiFileProperties prototype to <shlobj.h>.
This commit is contained in:
committed by
GitHub
parent
5213cf717c
commit
6af07a31b0
@@ -7,7 +7,7 @@
|
||||
|
||||
#include "precomp.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(shell_ad);
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(fontext);
|
||||
|
||||
void CFontFolderViewCB::Initialize(CFontExt* pFontExt, IShellView *psv, LPCITEMIDLIST pidlParent)
|
||||
{
|
||||
@@ -18,70 +18,29 @@ void CFontFolderViewCB::Initialize(CFontExt* pFontExt, IShellView *psv, LPCITEMI
|
||||
m_pShellView = psv;
|
||||
m_pidlParent.Attach(ILClone(pidlParent));
|
||||
if (!m_pidlParent)
|
||||
ERR("!m_pidlParent\n");
|
||||
ERR("m_pidlParent was null\n");
|
||||
}
|
||||
|
||||
HRESULT CFontFolderViewCB::TranslatePidl(LPITEMIDLIST* ppidlNew, LPCITEMIDLIST pidl)
|
||||
BOOL CFontFolderViewCB::FilterEvent(PIDLIST_ABSOLUTE* apidls, LONG lEvent) const
|
||||
{
|
||||
ATLASSERT(ppidlNew);
|
||||
lEvent &= ~SHCNE_INTERRUPT;
|
||||
|
||||
*ppidlNew = NULL;
|
||||
|
||||
WCHAR szFontFile[MAX_PATH];
|
||||
if (!SHGetPathFromIDListW(pidl, szFontFile))
|
||||
return E_FAIL;
|
||||
|
||||
CStringW strFontName;
|
||||
HRESULT hr = DoGetFontTitle(szFontFile, strFontName);
|
||||
if (FAILED_UNEXPECTEDLY(hr))
|
||||
return E_FAIL;
|
||||
|
||||
LPITEMIDLIST pidlChild = _ILCreate(strFontName);
|
||||
if (!pidlChild)
|
||||
{
|
||||
ERR("!pidlChild\n");
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
*ppidlNew = ILCombine(m_pidlParent, pidlChild);
|
||||
ILFree(pidlChild);
|
||||
|
||||
return *ppidlNew ? S_OK : E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
void CFontFolderViewCB::TranslateTwoPIDLs(PIDLIST_ABSOLUTE* pidls)
|
||||
{
|
||||
ATLASSERT(pidls);
|
||||
|
||||
HRESULT hr;
|
||||
if (pidls[0])
|
||||
{
|
||||
m_pidl0.Free();
|
||||
hr = TranslatePidl(&m_pidl0, pidls[0]);
|
||||
if (!FAILED_UNEXPECTEDLY(hr))
|
||||
pidls[0] = m_pidl0;
|
||||
}
|
||||
if (pidls[1])
|
||||
{
|
||||
m_pidl1.Free();
|
||||
hr = TranslatePidl(&m_pidl1, pidls[1]);
|
||||
if (!FAILED_UNEXPECTEDLY(hr))
|
||||
pidls[1] = m_pidl1;
|
||||
}
|
||||
}
|
||||
|
||||
BOOL CFontFolderViewCB::FilterEvent(LONG lEvent) const
|
||||
{
|
||||
switch (lEvent & ~SHCNE_INTERRUPT)
|
||||
switch (lEvent)
|
||||
{
|
||||
case SHCNE_CREATE:
|
||||
case SHCNE_DELETE:
|
||||
case SHCNE_RENAMEITEM:
|
||||
case SHCNE_UPDATEDIR:
|
||||
return FALSE; // OK
|
||||
// Refresh font cache and notify the system about the font change
|
||||
if (g_FontCache)
|
||||
g_FontCache->Read();
|
||||
break;
|
||||
case SHCNE_DELETE:
|
||||
break;
|
||||
default:
|
||||
return TRUE; // We don't want this event
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
@@ -91,19 +50,17 @@ CFontFolderViewCB::MessageSFVCB(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
case SFVM_QUERYFSNOTIFY: // Registering change notification
|
||||
{
|
||||
if (!m_pShellView || !m_pFontExt)
|
||||
return E_FAIL;
|
||||
// Now, we can get the view window
|
||||
ATLASSERT(m_pShellView);
|
||||
ATLASSERT(m_pFontExt);
|
||||
m_pShellView->GetWindow(&m_hwndView);
|
||||
m_pFontExt->SetViewWindow(m_hwndView);
|
||||
return S_OK;
|
||||
}
|
||||
case SFVM_FSNOTIFY: // Change notification
|
||||
{
|
||||
if (FilterEvent((LONG)lParam))
|
||||
if (FilterEvent((PIDLIST_ABSOLUTE*)wParam, (LONG)lParam))
|
||||
return S_FALSE; // Don't process
|
||||
|
||||
TranslateTwoPIDLs((PIDLIST_ABSOLUTE*)wParam);
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user