LONG CRegKeyEx::Open(HKEY hKeyRoot, LPCTSTR pszPath)
{
+ return OpenWithAccess(hKeyRoot, pszPath, KEY_ALL_ACCESS);
+}
+
+LONG CRegKeyEx::OpenWithAccess(HKEY hKeyRoot, LPCTSTR pszPath, REGSAM regsam)
+{
+ Close();
+
DWORD dw;
_tcscpy(m_sPath,pszPath);
return RegCreateKeyEx (hKeyRoot, pszPath, 0L, NULL,
- REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
+ REG_OPTION_NON_VOLATILE, regsam, NULL,
&m_hKey, &dw);
}
+LONG CRegKeyEx::OpenNoCreateWithAccess(HKEY hKeyRoot, LPCTSTR pszPath, REGSAM regsam)
+{
+ Close();
+
+ _tcscpy(m_sPath,pszPath);
+
+ return RegOpenKeyEx (hKeyRoot, pszPath, 0L, regsam, &m_hKey);
+}
LONG CRegKeyEx::WriteDword (LPCTSTR pszKey, DWORD dwVal)
{
HKEY GetKey() { return m_hKey; }
void Close();
LONG Open(HKEY hKeyRoot, LPCTSTR pszPath);
+ LONG OpenWithAccess(HKEY hKeyRoot, LPCTSTR pszPath, REGSAM regsam);
+ LONG OpenNoCreateWithAccess(HKEY hKeyRoot, LPCTSTR pszPath, REGSAM regsam);
LONG WriteDword (LPCTSTR pszKey, DWORD dwVal);
LONG WriteString (LPCTSTR pszKey, LPCTSTR pszVal);
#include "PropGeneral.h"
#include "PropFilter.h"
#include "PropColors.h"
+#include "PropRegistry.h"
#include "RegKey.h"
#include "logfile.h"
#include "PropSyntax.h"
CPropSyntax syn;
CPropFilter filter;
CPropColors colors( theApp.GetDiffColor(), theApp.GetSelDiffColor() );
+ CPropRegistry regpage;
sht.AddPage(&gen);
sht.AddPage(&syn);
sht.AddPage(&filter);
sht.AddPage(&vss);
sht.AddPage(&colors);
+ sht.AddPage(®page);
vss.m_nVerSys = m_nVerSys;
vss.m_strPath = m_strVssPath;
# End Source File
# Begin Source File
+SOURCE=.\PropRegistry.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\PropSyntax.cpp
# End Source File
# Begin Source File
# End Source File
# Begin Source File
+SOURCE=.\PropRegistry.h
+# End Source File
+# Begin Source File
+
SOURCE=.\PropSyntax.h
# End Source File
# Begin Source File
WS_VSCROLL
END
+IDD_PROPPAGE_REGISTRY DIALOGEX 0, 0, 235, 156
+STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
+CAPTION "Registry"
+FONT 8, "MS Sans Serif", 0, 0, 0x1
+BEGIN
+ CONTROL "Associated with directories",IDC_ASSOC_DIRECTORY,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,7,7,221,15
+END
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
IDS_BIN_FILES_SAME "Binary files are identical"
END
+STRINGTABLE DISCARDABLE
+BEGIN
+ IDS_WINMERGE_THIS_DIRECTORY "WinMerge this directory"
+END
+
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
--- /dev/null
+// PropRegistry.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "resource.h"
+#include "PropRegistry.h"
+#include "RegKey.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+// registry keys we use to be on Directory context menu
+static LPCTSTR f_context_key = _T("Directory\\shell\\WinMerge");
+static LPCTSTR f_context_key_cmd = _T("Directory\\shell\\WinMerge\\command");
+
+/////////////////////////////////////////////////////////////////////////////
+// CPropRegistry dialog
+
+
+CPropRegistry::CPropRegistry()
+ : CPropertyPage(CPropRegistry::IDD)
+{
+ //{{AFX_DATA_INIT(CPropRegistry)
+ // NOTE: the ClassWizard will add member initialization here
+ //}}AFX_DATA_INIT
+}
+
+void CPropRegistry::DoDataExchange(CDataExchange* pDX)
+{
+ CDialog::DoDataExchange(pDX);
+ //{{AFX_DATA_MAP(CPropRegistry)
+ //}}AFX_DATA_MAP
+}
+
+BEGIN_MESSAGE_MAP(CPropRegistry, CDialog)
+ //{{AFX_MSG_MAP(CPropRegistry)
+ ON_BN_CLICKED(IDC_ASSOC_DIRECTORY, OnAssocDirectory)
+ //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CPropRegistry message handlers
+
+BOOL CPropRegistry::OnInitDialog()
+{
+ CPropertyPage::OnInitDialog();
+
+ UpdateButton();
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
+
+// Are we registered as a Directory context handler ?
+bool CPropRegistry::IsRegisteredForDirectory() const
+{
+ CRegKeyEx reg;
+ REGSAM regsam = KEY_READ;
+ if (reg.OpenNoCreateWithAccess(HKEY_CLASSES_ROOT, f_context_key, regsam) != ERROR_SUCCESS)
+ return false;
+ reg.Close();
+ if (reg.OpenNoCreateWithAccess(HKEY_CLASSES_ROOT, f_context_key_cmd, regsam) != ERROR_SUCCESS)
+ return false;
+ return true;
+}
+
+// check registry and set button & member accordingly
+void CPropRegistry::UpdateButton()
+{
+ m_enabled = IsRegisteredForDirectory();
+ WPARAM wcheck = m_enabled ? BST_CHECKED : BST_UNCHECKED;
+ SendDlgItemMessage(IDC_ASSOC_DIRECTORY, BM_SETCHECK, wcheck, 0);
+}
+
+// Set or clear our entries in registry for Directory context
+void CPropRegistry::EnableContextHandler(bool enabling)
+{
+ if (enabling)
+ {
+ CRegKeyEx reg;
+ if (reg.Open(HKEY_CLASSES_ROOT, f_context_key) != ERROR_SUCCESS)
+ {
+ return;
+ }
+ CString lbl;
+ VERIFY(lbl.LoadString(IDS_WINMERGE_THIS_DIRECTORY));
+ reg.WriteString(_T(""), lbl);
+ reg.Close();
+ if (reg.Open(HKEY_CLASSES_ROOT, f_context_key_cmd) != ERROR_SUCCESS)
+ return;
+ CString cmd = (CString)AfxGetApp()->m_pszExeName + _T(" \"%1\"");
+ reg.WriteString(_T(""), cmd);
+ }
+ else
+ {
+ ::RegDeleteKey(HKEY_CLASSES_ROOT, f_context_key_cmd);
+ ::RegDeleteKey(HKEY_CLASSES_ROOT, f_context_key);
+ }
+}
+
+void CPropRegistry::OnAssocDirectory()
+{
+ bool enabling = (SendDlgItemMessage(IDC_ASSOC_DIRECTORY, BM_GETCHECK, 0, 0) == BST_CHECKED);
+ EnableContextHandler(enabling);
+ UpdateButton();
+}
--- /dev/null
+#ifndef PropRegistry_h_included
+#define PropRegistry_h_included
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// PropRegistry.h : header file
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+// CPropRegistry dialog
+
+class CPropRegistry : public CPropertyPage
+{
+// Construction
+public:
+
+ CPropRegistry(); // standard constructor
+
+// Dialog Data
+ //{{AFX_DATA(CPropRegistry)
+ enum { IDD = IDD_PROPPAGE_REGISTRY };
+ //}}AFX_DATA
+
+ // Overrides
+ // ClassWizard generated virtual function overrides
+ //{{AFX_VIRTUAL(CPropRegistry)
+ protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ //}}AFX_VIRTUAL
+
+// Implementation methods
+protected:
+ bool IsRegisteredForDirectory() const;
+ void UpdateButton();
+ void EnableContextHandler(bool enabling);
+
+ // Generated message map functions
+ //{{AFX_MSG(CPropRegistry)
+ virtual BOOL OnInitDialog();
+ afx_msg void OnAssocDirectory();
+ //}}AFX_MSG
+ DECLARE_MESSAGE_MAP()
+
+// Implementation data
+protected:
+ bool m_enabled;
+};
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // PropRegistry_h_included
+2003-02-12 Christian
+ [ 683752 ] Add option to be listed on Directory context menu
+
2003-02-11 Perry
Fixing recent SplitFilename & directory concat problems.
[ 683924 ] Same binaries for directory compare.
2003-02-05 Perry
Updated Brazilian, Italian, Spanish resources to sync with English/main resources.
-2003-01-28
- [ 424579 ] Escape to exit
+2003-01-28 Christian
+ Committed [ 424579 ] Escape to exit
-2003-01-27
+2003-01-27 Christian
[ 668654 ] Tabtype selection feature
[ 672554 ] Update DirView after individual merge
Fixed [ 225571 ] After individual merge, dirView not updated
[ 673063 ] Modification check before close
[ 675526 ] Waitcursors and merging all
-2003-01-21
+2003-01-21 Christian
[ 671037 ] Changes for MSVC.NET
[ 671810 ] Tempfiles to temp dir
-2003-01-20
+2003-01-20 Christian
[ 671034 ] operator precedence bug in SplitterWndEx.cpp
-2003-01-15
+2003-01-15 Christian
[ 650384 ] Fix for false equals for binary files
[ 651689 ] Add OpenLeft, OpenLeftWith, ... context
[ 650293 ] Implement context menus with multiselect
-2003-01-14
+2003-01-14 Christian
[ 665993 ] Little optimisation
2002-11-26 Perry
Fixed tooltips of toolbar buttons to list correct hotkeys
Split "Show Unique" option into "Show Left Unique" and "Show Right Unique"
-2002-12-02
+2002-12-02 Perry
Added left files, left dirs, right files, right dirs to status bar feedback
#define IDD_ABOUTBOX 100
#define IDR_POPUP_DIFFVIEW 101
#define IDR_POPUP_DIRVIEW 102
-
#define IDD_PROP_VSS 103
#define IDR_MAINFRAME 104
#define IDR_MERGETYPE 105
#define IDD_OPEN 106
+#define IDS_WINMERGE_THIS_DIRECTORY 106
#define IDD_EDITFILE 107
#define IDD_VSS 108
#define IDD_PROPPAGE_LARGE 109
#define IDD_CLEARCASE 110
#define IDD_PROPPAGE_FILTER 111
#define IDD_OUTPUT 112
+#define IDD_PROPPAGE_REGISTRY 113
#define IDS_VERSION_FMT 130
-
#define IDS_ALLFILES 131
#define IDS_CONFIRM_ALL_LEFT 132
#define IDS_CONFIRM_ALL_RIGHT 133
#define IDC_EDIT1 1033
#define IDC_PROP_INSERT_TABS 1034
#define IDC_PROP_INSERT_SPACES 1035
+#define IDC_ASSOC_DIRECTORY 1036
#define IDR_MARGIN_CURSOR 22900
#define IDD_LANGUAGE_SELECT 30000
#define IDD_PROPSYNTAX 30001
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_3D_CONTROLS 1
-#define _APS_NEXT_RESOURCE_VALUE 225
+#define _APS_NEXT_RESOURCE_VALUE 114
#define _APS_NEXT_COMMAND_VALUE 32817
-#define _APS_NEXT_CONTROL_VALUE 1036
+#define _APS_NEXT_CONTROL_VALUE 1037
#define _APS_NEXT_SYMED_VALUE 108
#endif
#endif