File indexing completed on 2024-04-14 05:35:36

0001 /*
0002   SPDX-FileCopyrightText: 2003-2006, Sergey Zorin. All rights reserved.
0003   SPDX-FileCopyrightText:  2018-2020 Michael Reeves reeves.87@gmail.com
0004   SPDX-License-Identifier: BSD-2-Clause
0005 */
0006 
0007 
0008 #ifndef diff_ext_h
0009 #define diff_ext_h
0010 
0011 //This option is not compatible with our shell extention.
0012 #undef WIN32_LEAN_AND_MEAN
0013 
0014 #include <windows.h>
0015 #include <windowsx.h>
0016 #include <shlobj.h>
0017 
0018 #include "server.h"
0019 
0020 
0021 // this is the actual OLE Shell context menu handler
0022 class DIFF_EXT : public IContextMenu, IShellExtInit {
0023   public:
0024     DIFF_EXT();
0025     virtual ~DIFF_EXT();
0026 
0027     //IUnknown members
0028     STDMETHODIMP QueryInterface(REFIID interface_id, void** result);
0029     STDMETHODIMP_(ULONG) AddRef();
0030     STDMETHODIMP_(ULONG) Release();
0031 
0032     //IShell members
0033     STDMETHODIMP QueryContextMenu(HMENU menu, UINT index, UINT cmd_first, UINT cmd_last, UINT flags);
0034     STDMETHODIMP InvokeCommand(LPCMINVOKECOMMANDINFO info);
0035     STDMETHODIMP GetCommandString(UINT_PTR cmd, UINT flags, UINT* reserved, LPSTR name, UINT name_length);
0036 
0037     //IShellExtInit methods
0038     STDMETHODIMP Initialize(LPCITEMIDLIST folder, IDataObject* subj, HKEY key);
0039 
0040   private:
0041     void diff( const tstring& arguments );
0042     void diff_with(unsigned int num, bool bMerge);
0043     tstring cut_to_length(const tstring&, size_t length = 64);
0044 
0045   private:
0046     UINT m_nrOfSelectedFiles;
0047     tstring _file_name1;
0048     tstring _file_name2;
0049     tstring _file_name3;
0050     HINSTANCE _resource;
0051     HWND _hwnd;
0052 
0053     ULONG  _ref_count;
0054 
0055     std::list< tstring >& m_recentFiles;
0056     UINT m_id_FirstCmd;
0057     UINT m_id_Diff;
0058     UINT m_id_DiffWith;
0059     UINT m_id_DiffLater;
0060     UINT m_id_MergeWith;
0061     UINT m_id_Merge3;
0062     UINT m_id_Diff3;
0063     UINT m_id_DiffWith_Base;
0064     UINT m_id_About;
0065     UINT m_id_ClearList;
0066 };
0067 
0068 #endif // __diff_ext_h__