Added CString wrapper for get_windows_home_directory()
[TortoiseGit.git] / src / TortoiseProc / Settings / SetProgsAdvDlg.h
blob28d5a2a04f04dd5ab556f81db12cada9522c583f
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2003-2008 - TortoiseSVN
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software Foundation,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 #pragma once
21 #include "Registry.h"
23 /**
24 * \ingroup TortoiseProc
25 * Helper dialog to configure the external tools used e.g. for diffing/merging/...
27 class CSetProgsAdvDlg : public CDialog
29 DECLARE_DYNAMIC(CSetProgsAdvDlg)
31 public:
32 CSetProgsAdvDlg(const CString& type, CWnd* pParent = NULL);
33 virtual ~CSetProgsAdvDlg();
35 enum { IDD = IDD_SETTINGSPROGSADV };
37 private:
38 /**
39 * Loads the tools from the registry.
41 void LoadData();
43 public:
44 /**
45 * Saves the changed tools to the registry.
46 * returns 0 if no restart is needed for the changes to take effect
47 * \remark If the dialog is closed/dismissed without calling
48 * this method first then all settings the user made must be
49 * discarded!
51 int SaveData();
53 private:
54 int AddExtension(const CString& ext, const CString& tool);
55 int FindExtension(const CString& ext);
56 void EnableBtns();
58 protected:
59 virtual void DoDataExchange(CDataExchange* pDX);
60 virtual BOOL OnInitDialog();
61 afx_msg void OnBnClickedAddtool();
62 afx_msg void OnBnClickedEdittool();
63 afx_msg void OnBnClickedRemovetool();
64 afx_msg void OnNMDblclkToollistctrl(NMHDR *pNMHDR, LRESULT *pResult);
65 afx_msg void OnLvnItemchangedToollistctrl(NMHDR *pNMHDR, LRESULT *pResult);
66 afx_msg void OnBnClickedRestoredefaults();
68 DECLARE_MESSAGE_MAP()
70 private:
71 CString m_sType; ///< tool type ("Diff" or "Merge")
72 CRegistryKey m_regToolKey; ///< registry key where the tools are stored
73 CListCtrl m_ToolListCtrl; ///< list control used for viewing and editing
75 typedef std::map<CString,CString> TOOL_MAP;
76 TOOL_MAP m_Tools; ///< internal storage of all tools
77 bool m_ToolsValid; ///< true if m_Tools was ever read