If there are submodule changes in the file list when resolving conflicts while rebasi...
[TortoiseGit.git] / src / TortoiseProc / ResetDlg.cpp
blob58105ca6699c29041339404de24bc25b1a623b96
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
22 #include "stdafx.h"
23 #include "TortoiseProc.h"
24 #include "ResetDlg.h"
25 #include "Git.h"
26 #include "FileDiffDlg.h"
27 #include "AppUtils.h"
29 // CResetDlg dialog
31 IMPLEMENT_DYNAMIC(CResetDlg, CHorizontalResizableStandAloneDialog)
33 CResetDlg::CResetDlg(CWnd* pParent /*=NULL*/)
34 : CHorizontalResizableStandAloneDialog(CResetDlg::IDD, pParent)
35 , CChooseVersion(this)
36 , m_ResetType(1)
41 CResetDlg::~CResetDlg()
45 void CResetDlg::DoDataExchange(CDataExchange* pDX)
47 CDialog::DoDataExchange(pDX);
48 CHOOSE_VERSION_DDX;
52 BEGIN_MESSAGE_MAP(CResetDlg, CHorizontalResizableStandAloneDialog)
53 CHOOSE_VERSION_EVENT
54 ON_BN_CLICKED(IDHELP, &CResetDlg::OnBnClickedHelp)
55 ON_BN_CLICKED(IDC_SHOW_MODIFIED_FILES, &CResetDlg::OnBnClickedShowModifiedFiles)
56 END_MESSAGE_MAP()
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"));
83 CString resetTo;
84 CString currentBranch = g_Git.GetCurrentBranch();
85 resetTo.Format(IDS_PROC_RESETBRANCH, currentBranch);
86 GetDlgItem(IDC_GROUP_BASEON)->SetWindowTextW(resetTo);
88 this->CheckRadioButton(IDC_RADIO_RESET_SOFT,IDC_RADIO_RESET_HARD,IDC_RADIO_RESET_SOFT+m_ResetType);
90 Init();
91 SetDefaultChoose(IDC_RADIO_BRANCH);
92 GetDlgItem(IDC_RADIO_RESET_SOFT + m_ResetType)->SetFocus();
94 return FALSE;
97 void CResetDlg::OnBnClickedChooseRadioHost()
99 OnBnClickedChooseRadio();
102 void CResetDlg::OnBnClickedShow()
104 OnBnClickedChooseVersion();
107 void CResetDlg::OnVersionChanged()
109 UpdateData(TRUE);
110 UpdateRevsionName();
111 UpdateData(FALSE);
114 void CResetDlg::OnOK()
116 m_ResetToVersion = m_VersionName;
117 m_ResetType=this->GetCheckedRadioButton(IDC_RADIO_RESET_SOFT,IDC_RADIO_RESET_HARD)-IDC_RADIO_RESET_SOFT;
118 return CHorizontalResizableStandAloneDialog::OnOK();
121 void CResetDlg::OnBnClickedHelp()
123 OnHelp();
126 void CResetDlg::OnBnClickedShowModifiedFiles()
128 CFileDiffDlg dlg;
130 dlg.m_strRev1 = _T("0000000000000000000000000000000000000000");
131 dlg.m_strRev2 = _T("HEAD");
133 dlg.DoModal();