Fix typos
[TortoiseGit.git] / src / TortoiseProc / CleanTypeDlg.cpp
blob2e4aa235bc92a22da1949c259290a1629246bf3c
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2008-2017 - TortoiseGit
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 // CleanTypeDlg.cpp : implementation file
22 #include "stdafx.h"
23 #include "TortoiseProc.h"
24 #include "CleanTypeDlg.h"
25 #include "Git.h"
26 #include "AppUtils.h"
28 // CCleanTypeDlg dialog
30 IMPLEMENT_DYNAMIC(CCleanTypeDlg, CStateStandAloneDialog)
32 CCleanTypeDlg::CCleanTypeDlg(CWnd* pParent /*=nullptr*/)
33 : CStateStandAloneDialog(CCleanTypeDlg::IDD, pParent)
34 , m_bDryRun(BST_UNCHECKED)
35 , m_bSubmodules(BST_UNCHECKED)
36 , m_bNoRecycleBin(!CRegDWORD(L"Software\\TortoiseGit\\RevertWithRecycleBin", TRUE))
37 , m_bDirUnmanagedRepo(BST_UNCHECKED)
39 CString WorkingDir=g_Git.m_CurrentDir;
40 WorkingDir.Replace(L':', L'_');
41 this->m_regDir = CRegDWORD(L"Software\\TortoiseGit\\History\\CleanDir\\" + WorkingDir, 1);
42 this->m_regType = CRegDWORD(L"Software\\TortoiseGit\\History\\CleanType\\" + WorkingDir, 0);
44 this->m_bDir = this->m_regDir;
45 this->m_CleanType = this->m_regType;
48 CCleanTypeDlg::~CCleanTypeDlg()
52 void CCleanTypeDlg::DoDataExchange(CDataExchange* pDX)
54 CDialog::DoDataExchange(pDX);
55 DDX_Check(pDX, IDC_CHECK_DIR, m_bDir);
56 DDX_Check(pDX, IDC_CHECK_DIR_UNMANAGEDREPO, m_bDirUnmanagedRepo);
57 DDX_Check(pDX, IDC_CHECK_NORECYCLEBIN, m_bNoRecycleBin);
58 DDX_Check(pDX, IDC_CHECK_DRYRUN, m_bDryRun);
59 DDX_Check(pDX, IDC_CHECKSUBMODULES, m_bSubmodules);
60 DDX_Radio(pDX, IDC_RADIO_CLEAN_ALL,m_CleanType);
64 BEGIN_MESSAGE_MAP(CCleanTypeDlg, CStateStandAloneDialog)
65 ON_BN_CLICKED(IDC_CHECK_DIR, &CCleanTypeDlg::OnBnClickedCheckDir)
66 END_MESSAGE_MAP()
69 // CCleanTypeDlg message handlers
71 BOOL CCleanTypeDlg::OnInitDialog()
73 CStateStandAloneDialog::OnInitDialog();
74 CAppUtils::MarkWindowAsUnpinnable(m_hWnd);
76 AdjustControlSize(IDC_RADIO_CLEAN_ALL);
77 AdjustControlSize(IDC_RADIO_CLEAN_NO);
78 AdjustControlSize(IDC_RADIO_CLEAN_IGNORE);
79 AdjustControlSize(IDC_CHECK_DIR);
80 AdjustControlSize(IDC_CHECK_DIR_UNMANAGEDREPO);
81 AdjustControlSize(IDC_CHECK_NORECYCLEBIN);
82 AdjustControlSize(IDC_CHECK_DRYRUN);
83 AdjustControlSize(IDC_CHECKSUBMODULES);
85 EnableSaveRestore(L"CleanTypeDlg");
87 SetDlgTitle();
89 DialogEnableWindow(IDC_CHECK_DIR_UNMANAGEDREPO, m_bDir);
91 return TRUE; // return TRUE unless you set the focus to a control
92 // EXCEPTION: OCX Property Pages should return FALSE
95 void CCleanTypeDlg::OnOK()
97 this->UpdateData();
99 this->m_regDir = this->m_bDir;
100 this->m_regType = this->m_CleanType ;
102 CStateStandAloneDialog::OnOK();
105 void CCleanTypeDlg::SetDlgTitle()
107 if (m_sTitle.IsEmpty())
108 GetWindowText(m_sTitle);
110 if (m_pathList.GetCount() == 1)
111 CAppUtils::SetWindowTitle(m_hWnd, g_Git.CombinePath(m_pathList[0].GetUIPathString()), m_sTitle);
112 else
113 CAppUtils::SetWindowTitle(m_hWnd, g_Git.CombinePath(m_pathList.GetCommonRoot().GetDirectory()), m_sTitle);
116 void CCleanTypeDlg::OnBnClickedCheckDir()
118 UpdateData();
119 if (!m_bDir && m_bDirUnmanagedRepo)
121 m_bDirUnmanagedRepo = BST_UNCHECKED;
122 UpdateData(FALSE);
124 DialogEnableWindow(IDC_CHECK_DIR_UNMANAGEDREPO, m_bDir);