1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2008-2013 - 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 // ResetDlg.cpp : implementation file
23 #include "TortoiseProc.h"
26 #include "FileDiffDlg.h"
31 IMPLEMENT_DYNAMIC(CResetDlg
, CHorizontalResizableStandAloneDialog
)
33 CResetDlg::CResetDlg(CWnd
* pParent
/*=NULL*/)
34 : CHorizontalResizableStandAloneDialog(CResetDlg::IDD
, pParent
)
35 , CChooseVersion(this)
41 CResetDlg::~CResetDlg()
45 void CResetDlg::DoDataExchange(CDataExchange
* pDX
)
47 CDialog::DoDataExchange(pDX
);
52 BEGIN_MESSAGE_MAP(CResetDlg
, CHorizontalResizableStandAloneDialog
)
54 ON_BN_CLICKED(IDHELP
, &CResetDlg::OnBnClickedHelp
)
55 ON_BN_CLICKED(IDC_SHOW_MODIFIED_FILES
, &CResetDlg::OnBnClickedShowModifiedFiles
)
59 // CResetDlg message handlers
60 BOOL
CResetDlg::OnInitDialog()
62 CHorizontalResizableStandAloneDialog::OnInitDialog();
63 CAppUtils::MarkWindowAsUnpinnable(m_hWnd
);
65 AddAnchor(IDC_SHOW_MODIFIED_FILES
, TOP_LEFT
, TOP_RIGHT
);
66 AddAnchor(IDC_GROUP_RESET_TYPE
, TOP_LEFT
, TOP_RIGHT
);
67 AddAnchor(IDOK
, BOTTOM_RIGHT
);
68 AddAnchor(IDCANCEL
, BOTTOM_RIGHT
);
69 AddAnchor(IDHELP
, BOTTOM_RIGHT
);
71 CHOOSE_VERSION_ADDANCHOR
;
72 this->AddOthersToAnchor();
74 AdjustControlSize(IDC_RADIO_BRANCH
);
75 AdjustControlSize(IDC_RADIO_TAGS
);
76 AdjustControlSize(IDC_RADIO_VERSION
);
77 AdjustControlSize(IDC_RADIO_RESET_SOFT
);
78 AdjustControlSize(IDC_RADIO_RESET_MIXED
);
79 AdjustControlSize(IDC_RADIO_RESET_HARD
);
81 EnableSaveRestore(_T("ResetDlg"));
84 CString currentBranch
= g_Git
.GetCurrentBranch();
85 resetTo
.Format(IDS_PROC_RESETBRANCH
, currentBranch
);
86 GetDlgItem(IDC_GROUP_BASEON
)->SetWindowTextW(resetTo
);
88 if (g_GitAdminDir
.IsBareRepo(g_Git
.m_CurrentDir
))
91 DialogEnableWindow(IDC_RADIO_RESET_MIXED
, FALSE
);
92 DialogEnableWindow(IDC_RADIO_RESET_HARD
, FALSE
);
94 this->CheckRadioButton(IDC_RADIO_RESET_SOFT
,IDC_RADIO_RESET_HARD
,IDC_RADIO_RESET_SOFT
+m_ResetType
);
97 SetDefaultChoose(IDC_RADIO_BRANCH
);
98 GetDlgItem(IDC_RADIO_RESET_SOFT
+ m_ResetType
)->SetFocus();
103 void CResetDlg::OnBnClickedChooseRadioHost()
105 OnBnClickedChooseRadio();
108 void CResetDlg::OnBnClickedShow()
110 OnBnClickedChooseVersion();
113 void CResetDlg::OnVersionChanged()
120 void CResetDlg::OnOK()
122 this->UpdateData(TRUE
);
124 m_ResetToVersion
= m_VersionName
;
125 m_ResetType
=this->GetCheckedRadioButton(IDC_RADIO_RESET_SOFT
,IDC_RADIO_RESET_HARD
)-IDC_RADIO_RESET_SOFT
;
126 return CHorizontalResizableStandAloneDialog::OnOK();
129 void CResetDlg::OnBnClickedHelp()
134 void CResetDlg::OnBnClickedShowModifiedFiles()
138 dlg
.m_strRev1
= _T("0000000000000000000000000000000000000000");
139 dlg
.m_strRev2
= _T("HEAD");