1 // TortoiseSVN - a Windows shell extension for easy version control
\r
3 // Copyright (C) 2003-2007 - TortoiseSVN
\r
5 // This program is free software; you can redistribute it and/or
\r
6 // modify it under the terms of the GNU General Public License
\r
7 // as published by the Free Software Foundation; either version 2
\r
8 // of the License, or (at your option) any later version.
\r
10 // This program is distributed in the hope that it will be useful,
\r
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
13 // GNU General Public License for more details.
\r
15 // You should have received a copy of the GNU General Public License
\r
16 // along with this program; if not, write to the Free Software Foundation,
\r
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
\r
20 #include "TortoiseProc.h"
\r
21 #include "ToolAssocDlg.h"
\r
22 #include "AppUtils.h"
\r
23 #include "StringUtils.h"
\r
25 IMPLEMENT_DYNAMIC(CToolAssocDlg, CDialog)
\r
26 CToolAssocDlg::CToolAssocDlg(const CString& type, bool add, CWnd* pParent /*=NULL*/)
\r
27 : CDialog(CToolAssocDlg::IDD, pParent)
\r
30 , m_sExtension(_T(""))
\r
35 CToolAssocDlg::~CToolAssocDlg()
\r
39 void CToolAssocDlg::DoDataExchange(CDataExchange* pDX)
\r
41 CDialog::DoDataExchange(pDX);
\r
42 DDX_Text(pDX, IDC_EXTEDIT, m_sExtension);
\r
43 DDV_MaxChars(pDX, m_sExtension, 20);
\r
44 DDX_Text(pDX, IDC_TOOLEDIT, m_sTool);
\r
46 if (pDX->m_bSaveAndValidate)
\r
48 if (m_sExtension.Find('/')<0)
\r
50 m_sExtension.TrimLeft(_T("*"));
\r
51 m_sExtension.TrimLeft(_T("."));
\r
52 m_sExtension = _T(".") + m_sExtension;
\r
58 BEGIN_MESSAGE_MAP(CToolAssocDlg, CDialog)
\r
59 ON_BN_CLICKED(IDC_TOOLBROWSE, OnBnClickedToolbrowse)
\r
62 BOOL CToolAssocDlg::OnInitDialog()
\r
64 CDialog::OnInitDialog();
\r
67 m_tooltips.Create(this);
\r
70 if (m_sType == _T("Diff"))
\r
72 title.LoadString(m_bAdd ? IDS_DLGTITLE_ADD_DIFF_TOOL : IDS_DLGTITLE_EDIT_DIFF_TOOL);
\r
73 m_tooltips.AddTool(IDC_TOOLEDIT, IDS_SETTINGS_EXTDIFF_TT);
\r
77 title.LoadString(m_bAdd ? IDS_DLGTITLE_ADD_MERGE_TOOL : IDS_DLGTITLE_EDIT_MERGE_TOOL);
\r
78 m_tooltips.AddTool(IDC_TOOLEDIT, IDS_SETTINGS_EXTMERGE_TT);
\r
81 SetWindowText(title);
\r
82 SHAutoComplete(::GetDlgItem(m_hWnd, IDC_TOOLEDIT), SHACF_FILESYSTEM | SHACF_FILESYS_ONLY);
\r
88 BOOL CToolAssocDlg::PreTranslateMessage(MSG* pMsg)
\r
90 m_tooltips.RelayEvent(pMsg);
\r
91 return CDialog::PreTranslateMessage(pMsg);
\r
94 void CToolAssocDlg::OnBnClickedToolbrowse()
\r
97 if (CAppUtils::FileOpenSave(m_sTool, NULL, IDS_SETTINGS_SELECTDIFF, IDS_PROGRAMSFILEFILTER, true, m_hWnd))
\r