mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-07 07:14:56 -06:00
23.01
This commit is contained in:
@@ -1,38 +1,77 @@
|
||||
// ContextMenu.h
|
||||
|
||||
#ifndef __CONTEXT_MENU_H
|
||||
#define __CONTEXT_MENU_H
|
||||
#ifndef ZIP7_INC_CONTEXT_MENU_H
|
||||
#define ZIP7_INC_CONTEXT_MENU_H
|
||||
|
||||
#include "../../../Common/MyWindows.h"
|
||||
|
||||
#include <ShlObj.h>
|
||||
#include "../../../Windows/Shell.h"
|
||||
|
||||
#include "MyExplorerCommand.h"
|
||||
|
||||
#include "../../../Common/MyString.h"
|
||||
|
||||
#include "../FileManager/MyCom2.h"
|
||||
|
||||
enum ECtxCommandType
|
||||
#ifdef CMF_EXTENDEDVERBS
|
||||
#define Z7_WIN_CMF_EXTENDEDVERBS CMF_EXTENDEDVERBS
|
||||
#else
|
||||
#define Z7_WIN_CMF_EXTENDEDVERBS 0x00000100
|
||||
#endif
|
||||
|
||||
enum enum_CtxCommandType
|
||||
{
|
||||
CtxCommandType_Normal,
|
||||
CtxCommandType_OpenRoot,
|
||||
CtxCommandType_OpenChild,
|
||||
CtxCommandType_CrcRoot,
|
||||
CtxCommandType_CrcChild,
|
||||
CtxCommandType_CrcChild
|
||||
};
|
||||
|
||||
|
||||
class CZipContextMenu:
|
||||
class CZipContextMenu Z7_final:
|
||||
public IContextMenu,
|
||||
public IShellExtInit,
|
||||
public IExplorerCommand,
|
||||
public IEnumExplorerCommand,
|
||||
public CMyUnknownImp
|
||||
{
|
||||
Z7_COM_UNKNOWN_IMP_4_MT(
|
||||
IContextMenu,
|
||||
IShellExtInit,
|
||||
IExplorerCommand,
|
||||
IEnumExplorerCommand
|
||||
)
|
||||
|
||||
// IShellExtInit
|
||||
STDMETHOD(Initialize)(LPCITEMIDLIST pidlFolder, LPDATAOBJECT dataObject, HKEY hkeyProgID) Z7_override;
|
||||
|
||||
// IContextMenu
|
||||
STDMETHOD(QueryContextMenu)(HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags) Z7_override;
|
||||
STDMETHOD(InvokeCommand)(LPCMINVOKECOMMANDINFO lpici) Z7_override;
|
||||
STDMETHOD(GetCommandString)(
|
||||
#ifdef Z7_OLD_WIN_SDK
|
||||
UINT
|
||||
#else
|
||||
UINT_PTR
|
||||
#endif
|
||||
idCmd, UINT uType, UINT *pwReserved, LPSTR pszName, UINT cchMax) Z7_override;
|
||||
|
||||
// IExplorerCommand
|
||||
STDMETHOD (GetTitle) (IShellItemArray *psiItemArray, LPWSTR *ppszName) Z7_override;
|
||||
STDMETHOD (GetIcon) (IShellItemArray *psiItemArray, LPWSTR *ppszIcon) Z7_override;
|
||||
STDMETHOD (GetToolTip) (IShellItemArray *psiItemArray, LPWSTR *ppszInfotip) Z7_override;
|
||||
STDMETHOD (GetCanonicalName) (GUID *pguidCommandName) Z7_override;
|
||||
STDMETHOD (GetState) (IShellItemArray *psiItemArray, BOOL fOkToBeSlow, EXPCMDSTATE *pCmdState) Z7_override;
|
||||
STDMETHOD (Invoke) (IShellItemArray *psiItemArray, IBindCtx *pbc) Z7_override;
|
||||
STDMETHOD (GetFlags) (EXPCMDFLAGS *pFlags) Z7_override;
|
||||
STDMETHOD (EnumSubCommands) (IEnumExplorerCommand **ppEnum) Z7_override;
|
||||
|
||||
// IEnumExplorerCommand
|
||||
STDMETHOD (Next) (ULONG celt, IExplorerCommand **pUICommand, ULONG *pceltFetched) Z7_override;
|
||||
STDMETHOD (Skip) (ULONG celt) Z7_override;
|
||||
STDMETHOD (Reset) (void) Z7_override;
|
||||
STDMETHOD (Clone) (IEnumExplorerCommand **ppenum) Z7_override;
|
||||
|
||||
public:
|
||||
|
||||
enum ECommandInternalID
|
||||
enum enum_CommandInternalID
|
||||
{
|
||||
kCommandNULL,
|
||||
kOpen,
|
||||
@@ -54,48 +93,22 @@ public:
|
||||
kHash_Generate_SHA256,
|
||||
kHash_TestArc
|
||||
};
|
||||
|
||||
MY_UNKNOWN_IMP4_MT(
|
||||
IContextMenu,
|
||||
IShellExtInit,
|
||||
IExplorerCommand,
|
||||
IEnumExplorerCommand
|
||||
)
|
||||
|
||||
// IShellExtInit
|
||||
STDMETHOD(Initialize)(LPCITEMIDLIST pidlFolder, LPDATAOBJECT dataObject, HKEY hkeyProgID);
|
||||
|
||||
// IContextMenu
|
||||
STDMETHOD(QueryContextMenu)(HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags);
|
||||
STDMETHOD(InvokeCommand)(LPCMINVOKECOMMANDINFO lpici);
|
||||
STDMETHOD(GetCommandString)(UINT_PTR idCmd, UINT uType, UINT *pwReserved, LPSTR pszName, UINT cchMax);
|
||||
|
||||
HRESULT InitContextMenu(const wchar_t *folder, const wchar_t * const *names, unsigned numFiles);
|
||||
public:
|
||||
void Init_For_7zFM()
|
||||
{
|
||||
// _isMenuForFM = true;
|
||||
// _fileNames_WereReduced = false;
|
||||
}
|
||||
|
||||
void LoadItems(IShellItemArray *psiItemArray);
|
||||
|
||||
// IExplorerCommand
|
||||
STDMETHOD (GetTitle) (IShellItemArray *psiItemArray, LPWSTR *ppszName);
|
||||
STDMETHOD (GetIcon) (IShellItemArray *psiItemArray, LPWSTR *ppszIcon);
|
||||
STDMETHOD (GetToolTip) (IShellItemArray *psiItemArray, LPWSTR *ppszInfotip);
|
||||
STDMETHOD (GetCanonicalName) (GUID *pguidCommandName);
|
||||
STDMETHOD (GetState) (IShellItemArray *psiItemArray, BOOL fOkToBeSlow, EXPCMDSTATE *pCmdState);
|
||||
STDMETHOD (Invoke) (IShellItemArray *psiItemArray, IBindCtx *pbc);
|
||||
STDMETHOD (GetFlags) (EXPCMDFLAGS *pFlags);
|
||||
STDMETHOD (EnumSubCommands) (IEnumExplorerCommand **ppEnum);
|
||||
|
||||
// IEnumExplorerCommand
|
||||
STDMETHOD (Next) (ULONG celt, IExplorerCommand **pUICommand, ULONG *pceltFetched);
|
||||
STDMETHOD (Skip) (ULONG celt);
|
||||
STDMETHOD (Reset) (void);
|
||||
STDMETHOD (Clone) (IEnumExplorerCommand **ppenum);
|
||||
|
||||
CZipContextMenu();
|
||||
~CZipContextMenu();
|
||||
|
||||
struct CCommandMapItem
|
||||
{
|
||||
ECommandInternalID CommandInternalID;
|
||||
enum_CommandInternalID CommandInternalID;
|
||||
UString Verb;
|
||||
UString UserString;
|
||||
// UString HelpString;
|
||||
@@ -103,7 +116,7 @@ public:
|
||||
UString ArcName;
|
||||
UString ArcType;
|
||||
bool IsPopup;
|
||||
ECtxCommandType CtxCommandType;
|
||||
enum_CtxCommandType CtxCommandType;
|
||||
|
||||
CCommandMapItem():
|
||||
IsPopup(false),
|
||||
@@ -118,33 +131,34 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
bool _isMenuForFM;
|
||||
UStringVector _fileNames;
|
||||
NWindows::NShell::CFileAttribs _attribs;
|
||||
|
||||
private:
|
||||
bool _isMenuForFM;
|
||||
bool _fileNames_WereReduced; // = true, if only first 16 items were used in QueryContextMenu()
|
||||
bool _dropMode;
|
||||
UString _dropPath;
|
||||
CObjectVector<CCommandMapItem> _commandMap;
|
||||
CObjectVector<CCommandMapItem> _commandMap_Cur;
|
||||
|
||||
HBITMAP _bitmap;
|
||||
CBoolPair _elimDup;
|
||||
UInt32 _writeZone;
|
||||
CBoolPair _elimDup;
|
||||
|
||||
bool IsSeparator;
|
||||
bool IsRoot;
|
||||
CObjectVector< CMyComPtr<IExplorerCommand> > SubCommands;
|
||||
ULONG CurrentSubCommand;
|
||||
unsigned CurrentSubCommand;
|
||||
|
||||
void Set_UserString_in_LastCommand(const UString &s)
|
||||
{
|
||||
_commandMap.Back().UserString = s;
|
||||
}
|
||||
|
||||
HRESULT GetFileNames(LPDATAOBJECT dataObject, UStringVector &fileNames);
|
||||
int FindVerb(const UString &verb);
|
||||
void FillCommand(ECommandInternalID id, UString &mainString, CCommandMapItem &cmi);
|
||||
void AddCommand(ECommandInternalID id, UString &mainString, CCommandMapItem &cmi);
|
||||
int FindVerb(const UString &verb) const;
|
||||
void FillCommand(enum_CommandInternalID id, UString &mainString, CCommandMapItem &cmi) const;
|
||||
void AddCommand(enum_CommandInternalID id, UString &mainString, CCommandMapItem &cmi);
|
||||
void AddMapItem_ForSubMenu(const char *ver);
|
||||
|
||||
HRESULT InvokeCommandCommon(const CCommandMapItem &cmi);
|
||||
|
||||
Reference in New Issue
Block a user