// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or (at
// your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/////////////////////////////////////////////////////////////////////////////
// Look at http://www.codeproject.com/shell/ for excellent guide
// to Windows Shell programming by Michael Dunn.
-/**
+/**
* @file WinMergeShell.h
*
* @brief Declaration file for ShellExtension class
*/
-// RCS ID line follows -- this is updated by CVS
-// $Id$
+// ID line follows -- this is updated by SVN
+// $Id: WinMergeShell.h 6933 2009-07-26 14:07:03Z kimmov $
-#ifndef __WINMERGESHELL_H_
-#define __WINMERGESHELL_H_
+#pragma once
#include <shlobj.h>
+#include <shlguid.h>
#include <comdef.h>
#include <atlconv.h> // for ATL string conversion macros
#include "resource.h" // main symbols
+#include "UnicodeString.h"
-/**
+/**
* @brief Class for handling shell extension tasks
*/
-class ATL_NO_VTABLE CWinMergeShell :
- public CComObjectRootEx<CComSingleThreadModel>,
- public CComCoClass<CWinMergeShell, &CLSID_WinMergeShell>,
- public IDispatchImpl<IWinMergeShell, &IID_IWinMergeShell, &LIBID_SHELLEXTENSIONLib>,
- public IShellExtInit,
- public IContextMenu
+class ATL_NO_VTABLE CWinMergeShell :
+ public CComObjectRootEx<CComSingleThreadModel>,
+ public CComCoClass<CWinMergeShell, &CLSID_WinMergeShell>,
+ public IDispatchImpl<IWinMergeShell, &IID_IWinMergeShell, &LIBID_SHELLEXTENSIONLib>,
+ public IShellExtInit,
+ public IContextMenu
{
public:
CWinMergeShell();
+ ~CWinMergeShell();
-DECLARE_REGISTRY_RESOURCEID(IDR_WINMERGESHELL)
+ DECLARE_REGISTRY_RESOURCEID(IDR_WINMERGESHELL)
-DECLARE_PROTECT_FINAL_CONSTRUCT()
+ DECLARE_PROTECT_FINAL_CONSTRUCT()
-BEGIN_COM_MAP(CWinMergeShell)
+ BEGIN_COM_MAP(CWinMergeShell)
COM_INTERFACE_ENTRY(IWinMergeShell)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(IShellExtInit)
COM_INTERFACE_ENTRY(IContextMenu)
-END_COM_MAP()
+ END_COM_MAP()
// IWinMergeShell
protected:
- CString m_strPaths[2]; /**< Paths for selected items */
- CString m_strPreviousPath; /**< Previously selected path */
- CBitmap m_MergeBmp; /**< Icon */
+ String m_strPaths[3]; /**< Paths for selected items */
+ String m_strPreviousPath[2]; /**< Previously selected path */
+ HBITMAP m_MergeBmp, m_MergeDirBmp; /**< Icon */
UINT m_nSelectedItems; /**< Amount of selected items */
DWORD m_dwContextMenuEnabled; /**< Is context menu enabled and in which mode? */
DWORD m_dwMenuState; /**< Shown menuitems */
+ inline static HMENU s_hMenuLastAdded = nullptr;
+ inline static UINT s_uidCmdLastAdded = 0;
- BOOL GetWinMergeDir(CString &strDir);
- BOOL CheckExecutable(CString path);
+ BOOL GetWinMergeDir(String &strDir);
int DrawSimpleMenu(HMENU hmenu, UINT uMenuIndex, UINT uidFirstCmd);
int DrawAdvancedMenu(HMENU hmenu, UINT uMenuIndex, UINT uidFirstCmd);
- CString GetHelpText(UINT_PTR idCmd);
- CString FormatCmdLine(const CString &winmergePath,
- const CString &path1, const CString &path2, BOOL bAlterSubFolders);
+ String GetHelpText(UINT_PTR idCmd);
+ String FormatCmdLine(const String &winmergePath,
+ const String &path1, const String &path2, const String &path3, BOOL bAlterSubFolders);
public:
- // IShellExtInit
- STDMETHOD(Initialize)(LPCITEMIDLIST, LPDATAOBJECT, HKEY);
+ // IShellExtInit
+ STDMETHOD(Initialize)(LPCITEMIDLIST, LPDATAOBJECT, HKEY);
- // IContextMenu
- STDMETHOD(GetCommandString)(UINT_PTR, UINT, UINT*, LPSTR, UINT);
- STDMETHOD(InvokeCommand)(LPCMINVOKECOMMANDINFO);
- STDMETHOD(QueryContextMenu)(HMENU, UINT, UINT, UINT, UINT);
+ // IContextMenu
+ STDMETHOD(GetCommandString)(UINT_PTR, UINT, UINT*, LPSTR, UINT);
+ STDMETHOD(InvokeCommand)(LPCMINVOKECOMMANDINFO);
+ STDMETHOD(QueryContextMenu)(HMENU, UINT, UINT, UINT, UINT);
};
-#endif //__WINMERGESHELL_H_