Fixed issue #3304: Double click on stash list item does nothing, show log instead
[TortoiseGit.git] / src / TortoiseProc / StashSave.cpp
blobc4723aaefd6155e862a5bdc7b016d16784d9d8a1
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2011-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.
20 #include "stdafx.h"
21 #include "TortoiseProc.h"
22 #include "StashSave.h"
23 #include "AppUtils.h"
24 #include "MessageBox.h"
25 #include "Git.h"
27 IMPLEMENT_DYNAMIC(CStashSaveDlg, CHorizontalResizableStandAloneDialog)
29 CStashSaveDlg::CStashSaveDlg(CWnd* pParent /*=nullptr*/)
30 : CHorizontalResizableStandAloneDialog(CStashSaveDlg::IDD, pParent)
31 , m_bIncludeUntracked(FALSE)
32 , m_bAll(FALSE)
36 CStashSaveDlg::~CStashSaveDlg()
40 void CStashSaveDlg::DoDataExchange(CDataExchange* pDX)
42 CHorizontalResizableStandAloneDialog::DoDataExchange(pDX);
43 DDX_Text(pDX, IDC_STASHMESSAGE, m_sMessage);
44 DDX_Check(pDX, IDC_CHECK_UNTRACKED, m_bIncludeUntracked);
45 DDX_Check(pDX, IDC_CHECK_ALL, m_bAll);
48 BEGIN_MESSAGE_MAP(CStashSaveDlg, CHorizontalResizableStandAloneDialog)
49 ON_BN_CLICKED(IDOK, &CStashSaveDlg::OnBnClickedOk)
50 ON_BN_CLICKED(IDC_CHECK_UNTRACKED, &CStashSaveDlg::OnBnClickedCheckUntracked)
51 ON_BN_CLICKED(IDC_CHECK_ALL, &CStashSaveDlg::OnBnClickedCheckAll)
52 END_MESSAGE_MAP()
54 BOOL CStashSaveDlg::OnInitDialog()
56 CHorizontalResizableStandAloneDialog::OnInitDialog();
57 CAppUtils::MarkWindowAsUnpinnable(m_hWnd);
59 AdjustControlSize(IDC_CHECK_UNTRACKED);
60 AdjustControlSize(IDC_CHECK_ALL);
62 AddAnchor(IDOK,BOTTOM_RIGHT);
63 AddAnchor(IDCANCEL, BOTTOM_RIGHT);
64 AddAnchor(IDHELP, BOTTOM_RIGHT);
65 AddAnchor(IDC_GROUP_STASHMESSAGE, TOP_LEFT, TOP_RIGHT);
66 AddAnchor(IDC_STASHMESSAGE, TOP_LEFT, TOP_RIGHT);
67 AddAnchor(IDC_GROUP_OPTION, TOP_LEFT, TOP_RIGHT);
69 CString sWindowTitle;
70 GetWindowText(sWindowTitle);
71 CAppUtils::SetWindowTitle(m_hWnd, g_Git.m_CurrentDir, sWindowTitle);
73 this->UpdateData(false);
75 return TRUE;
78 void CStashSaveDlg::OnBnClickedOk()
80 CHorizontalResizableStandAloneDialog::UpdateData(TRUE);
82 if (m_bIncludeUntracked)
84 if (CMessageBox::ShowCheck(GetSafeHwnd(), IDS_STASHSAVE_INCLUDEUNTRACKED, IDS_APPNAME, 2, IDI_WARNING, IDS_CONTINUEBUTTON, IDS_ABORTBUTTON, NULL, L"NoStashIncludeUntrackedWarning", IDS_PROC_NOTSHOWAGAINCONTINUE) == 2)
86 CMessageBox::RemoveRegistryKey(L"NoStashIncludeUntrackedWarning"); // only store answer if it is "Continue"
87 return;
91 CHorizontalResizableStandAloneDialog::OnOK();
94 void CStashSaveDlg::OnBnClickedCheckUntracked()
96 UpdateData();
97 DialogEnableWindow(IDC_CHECK_ALL, !m_bIncludeUntracked);
100 void CStashSaveDlg::OnBnClickedCheckAll()
102 UpdateData();
103 DialogEnableWindow(IDC_CHECK_UNTRACKED, !m_bAll);