Allow to move item past last item
[TortoiseGit.git] / src / TortoiseProc / CleanTypeDlg.cpp
blobbb76ba9f9ee9863e69f81e31608594b594613cf9
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2008-2016 - 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))
38 CString WorkingDir=g_Git.m_CurrentDir;
39 WorkingDir.Replace(L':', L'_');
40 this->m_regDir = CRegDWORD(L"Software\\TortoiseGit\\History\\CleanDir\\" + WorkingDir, 1);
41 this->m_regType = CRegDWORD(L"Software\\TortoiseGit\\History\\CleanType\\" + WorkingDir, 0);
43 this->m_bDir = this->m_regDir;
44 this->m_CleanType = this->m_regType;
47 CCleanTypeDlg::~CCleanTypeDlg()
51 void CCleanTypeDlg::DoDataExchange(CDataExchange* pDX)
53 CDialog::DoDataExchange(pDX);
54 DDX_Check(pDX, IDC_CHECK_DIR, m_bDir);
55 DDX_Check(pDX, IDC_CHECK_NORECYCLEBIN, m_bNoRecycleBin);
56 DDX_Check(pDX, IDC_CHECK_DRYRUN, m_bDryRun);
57 DDX_Check(pDX, IDC_CHECKSUBMODULES, m_bSubmodules);
58 DDX_Radio(pDX, IDC_RADIO_CLEAN_ALL,m_CleanType);
62 BEGIN_MESSAGE_MAP(CCleanTypeDlg, CStateStandAloneDialog)
63 END_MESSAGE_MAP()
66 // CCleanTypeDlg message handlers
68 BOOL CCleanTypeDlg::OnInitDialog()
70 CStateStandAloneDialog::OnInitDialog();
71 CAppUtils::MarkWindowAsUnpinnable(m_hWnd);
73 AdjustControlSize(IDC_RADIO_CLEAN_ALL);
74 AdjustControlSize(IDC_RADIO_CLEAN_NO);
75 AdjustControlSize(IDC_RADIO_CLEAN_IGNORE);
76 AdjustControlSize(IDC_CHECK_DIR);
77 AdjustControlSize(IDC_CHECK_NORECYCLEBIN);
78 AdjustControlSize(IDC_CHECK_DRYRUN);
79 AdjustControlSize(IDC_CHECKSUBMODULES);
81 EnableSaveRestore(L"CleanTypeDlg");
83 SetDlgTitle();
85 return TRUE; // return TRUE unless you set the focus to a control
86 // EXCEPTION: OCX Property Pages should return FALSE
89 void CCleanTypeDlg::OnOK()
91 this->UpdateData();
93 this->m_regDir = this->m_bDir;
94 this->m_regType = this->m_CleanType ;
96 CStateStandAloneDialog::OnOK();
99 void CCleanTypeDlg::SetDlgTitle()
101 if (m_sTitle.IsEmpty())
102 GetWindowText(m_sTitle);
104 if (m_pathList.GetCount() == 1)
105 CAppUtils::SetWindowTitle(m_hWnd, g_Git.CombinePath(m_pathList[0].GetUIPathString()), m_sTitle);
106 else
107 CAppUtils::SetWindowTitle(m_hWnd, g_Git.CombinePath(m_pathList.GetCommonRoot().GetDirectory()), m_sTitle);