Fixed c&p error: Usage of wrong path
[TortoiseGit.git] / src / TortoiseProc / StashSave.cpp
blobcb3bead44070a8ceea74d3ecc4233418a422aa58
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2011-2013 Sven Strickroth, <email@cs-ware.de>
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.
20 #include "stdafx.h"
21 #include "TortoiseProc.h"
22 #include "StashSave.h"
23 #include "AppUtils.h"
24 #include "MessageBox.h"
26 IMPLEMENT_DYNAMIC(CStashSaveDlg, CHorizontalResizableStandAloneDialog)
28 CStashSaveDlg::CStashSaveDlg(CWnd* pParent /*=NULL*/)
29 : CHorizontalResizableStandAloneDialog(CStashSaveDlg::IDD, pParent)
30 , m_bIncludeUntracked(FALSE)
31 , m_bAll(FALSE)
35 CStashSaveDlg::~CStashSaveDlg()
39 void CStashSaveDlg::DoDataExchange(CDataExchange* pDX)
41 CHorizontalResizableStandAloneDialog::DoDataExchange(pDX);
42 DDX_Text(pDX, IDC_STASHMESSAGE, m_sMessage);
43 DDX_Check(pDX, IDC_CHECK_UNTRACKED, m_bIncludeUntracked);
44 DDX_Check(pDX, IDC_CHECK_ALL, m_bAll);
47 BEGIN_MESSAGE_MAP(CStashSaveDlg, CHorizontalResizableStandAloneDialog)
48 ON_BN_CLICKED(IDOK, &CStashSaveDlg::OnBnClickedOk)
49 ON_BN_CLICKED(IDC_CHECK_UNTRACKED, &CStashSaveDlg::OnBnClickedCheckUntracked)
50 ON_BN_CLICKED(IDC_CHECK_ALL, &CStashSaveDlg::OnBnClickedCheckAll)
51 END_MESSAGE_MAP()
53 BOOL CStashSaveDlg::OnInitDialog()
55 CHorizontalResizableStandAloneDialog::OnInitDialog();
56 CAppUtils::MarkWindowAsUnpinnable(m_hWnd);
58 AddAnchor(IDOK,BOTTOM_RIGHT);
59 AddAnchor(IDCANCEL, BOTTOM_RIGHT);
60 AddAnchor(IDHELP, BOTTOM_RIGHT);
61 AddAnchor(IDC_GROUP_STASHMESSAGE, TOP_LEFT, TOP_RIGHT);
62 AddAnchor(IDC_STASHMESSAGE, TOP_LEFT, TOP_RIGHT);
63 AddAnchor(IDC_GROUP_OPTION, TOP_LEFT, TOP_RIGHT);
65 AdjustControlSize(IDC_CHECK_UNTRACKED);
66 AdjustControlSize(IDC_CHECK_ALL);
68 CString sWindowTitle;
69 GetWindowText(sWindowTitle);
70 CAppUtils::SetWindowTitle(m_hWnd, g_Git.m_CurrentDir, sWindowTitle);
72 this->UpdateData(false);
74 if (CAppUtils::GetMsysgitVersion() < 0x01070700)
76 GetDlgItem(IDC_CHECK_UNTRACKED)->EnableWindow(FALSE);
77 GetDlgItem(IDC_CHECK_ALL)->EnableWindow(FALSE);
80 return TRUE;
83 void CStashSaveDlg::OnBnClickedOk()
85 CHorizontalResizableStandAloneDialog::UpdateData(TRUE);
87 if (m_bIncludeUntracked)
89 if (CMessageBox::ShowCheck(GetSafeHwnd(), IDS_STASHSAVE_INCLUDEUNTRACKED, IDS_APPNAME, 2, IDI_WARNING, IDS_CONTINUEBUTTON, IDS_ABORTBUTTON, NULL, _T("NoStashIncludeUntrackedWarning"), IDS_PROC_NOTSHOWAGAINCONTINUE) == 2)
91 CMessageBox::RemoveRegistryKey(_T("NoStashIncludeUntrackedWarning")); // only store answer if it is "Continue"
92 return;
96 CHorizontalResizableStandAloneDialog::OnOK();
99 void CStashSaveDlg::OnBnClickedCheckUntracked()
101 UpdateData();
102 DialogEnableWindow(IDC_CHECK_ALL, !m_bIncludeUntracked);
105 void CStashSaveDlg::OnBnClickedCheckAll()
107 UpdateData();
108 DialogEnableWindow(IDC_CHECK_UNTRACKED, !m_bAll);