From a775410756d031ede220d243cbfef672e2748a94 Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Mon, 11 Jun 2012 05:05:41 +0200 Subject: [PATCH] Fixed issue #1067: Add clear button into "stash list" Signed-off-by: Sven Strickroth --- src/Changelog.txt | 1 + src/Resources/TortoiseProcENG.rc | 9 +++++++++ src/TortoiseProc/RefLogDlg.cpp | 29 +++++++++++++++++++++++++++-- src/TortoiseProc/RefLogDlg.h | 3 ++- src/TortoiseProc/resource.h | 1 + 5 files changed, 40 insertions(+), 3 deletions(-) diff --git a/src/Changelog.txt b/src/Changelog.txt index c66f1300c..9870a0ff2 100644 --- a/src/Changelog.txt +++ b/src/Changelog.txt @@ -4,6 +4,7 @@ Released: unreleased == Features== * Fixed issue #746: Make tortoisegit more gerrit friendly * Optimized TGitCache overlay calculation (deleted but kept files are now displayed as such) + * Fixed issue #1067: Add clear button into "stash list" == Bug Fix == * Fixed issue #1213: cannot diff renamed files with Revision Diff Dialog diff --git a/src/Resources/TortoiseProcENG.rc b/src/Resources/TortoiseProcENG.rc index 4ee657651..1647d0183 100644 --- a/src/Resources/TortoiseProcENG.rc +++ b/src/Resources/TortoiseProcENG.rc @@ -1329,6 +1329,7 @@ BEGIN LTEXT "Ref",IDC_STATIC_REF,9,9,27,8 CONTROL "",IDC_COMBOBOXEX_REF,"ComboBoxEx32",CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP,55,7,128,80 CONTROL "",IDC_REFLOG_LIST,"SysListView32",LVS_REPORT | LVS_ALIGNLEFT | LVS_OWNERDATA | WS_BORDER | WS_TABSTOP,7,27,342,138 + PUSHBUTTON "&Clear stash",IDC_REFLOG_BUTTONCLEARSTASH,7,175,79,14,NOT WS_VISIBLE END IDD_SUBMODULE_ADD DIALOGEX 0, 0, 271, 122 @@ -2176,6 +2177,14 @@ BEGIN BOTTOMMARGIN, 85 END + IDD_REFLOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 349 + TOPMARGIN, 7 + BOTTOMMARGIN, 189 + END + IDD_SETTINGIT_CONFIG, DIALOG BEGIN LEFTMARGIN, 7 diff --git a/src/TortoiseProc/RefLogDlg.cpp b/src/TortoiseProc/RefLogDlg.cpp index cb81a57df..4e9426421 100644 --- a/src/TortoiseProc/RefLogDlg.cpp +++ b/src/TortoiseProc/RefLogDlg.cpp @@ -1,6 +1,6 @@ // TortoiseGit - a Windows shell extension for easy version control -// Copyright (C) 2009-2011 - TortoiseGit +// Copyright (C) 2009-2012 - TortoiseGit // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -24,6 +24,7 @@ #include "RefLogDlg.h" #include "git.h" #include "AppUtils.h" +#include "MessageBox.h" // CRefLogDlg dialog @@ -49,6 +50,7 @@ void CRefLogDlg::DoDataExchange(CDataExchange* pDX) BEGIN_MESSAGE_MAP(CRefLogDlg, CResizableStandAloneDialog) ON_BN_CLICKED(IDOK, &CRefLogDlg::OnBnClickedOk) + ON_BN_CLICKED(IDC_REFLOG_BUTTONCLEARSTASH, &CRefLogDlg::OnBnClickedClearStash) ON_CBN_SELCHANGE(IDC_COMBOBOXEX_REF, &CRefLogDlg::OnCbnSelchangeRef) ON_MESSAGE(MSG_REFLOG_CHANGED,OnRefLogChanged) END_MESSAGE_MAP() @@ -69,7 +71,7 @@ BOOL CRefLogDlg::OnInitDialog() AddAnchor(IDOK,BOTTOM_RIGHT); AddAnchor(IDCANCEL,BOTTOM_RIGHT); - + AddAnchor(IDC_REFLOG_BUTTONCLEARSTASH, BOTTOM_LEFT); AddAnchor(IDC_REFLOG_LIST,TOP_LEFT,BOTTOM_RIGHT); AddAnchor(IDHELP, BOTTOM_RIGHT); @@ -133,6 +135,22 @@ void CRefLogDlg::OnBnClickedOk() OnOK(); } +void CRefLogDlg::OnBnClickedClearStash() +{ + if (CMessageBox::Show(this->GetSafeHwnd(), IDS_PROC_DELETEALLSTASH, IDS_APPNAME, 2, IDI_QUESTION, IDS_DELETEBUTTON, IDS_ABORTBUTTON) == 1) + { + CString cmdOut; + if (g_Git.Run(_T("git.exe stash clear"), &cmdOut, CP_UTF8)) + { + MessageBox(cmdOut, _T("TortoiseGit"), MB_ICONERROR); + return; + } + + m_RefList.m_RefMap.clear(); + + OnCbnSelchangeRef(); + } +} void CRefLogDlg::OnCbnSelchangeRef() { @@ -165,4 +183,11 @@ void CRefLogDlg::OnCbnSelchangeRef() m_RefList.Invalidate(); + if (ref == _T("refs/stash")) + { + GetDlgItem(IDC_REFLOG_BUTTONCLEARSTASH)->ShowWindow(SW_SHOW); + GetDlgItem(IDC_REFLOG_BUTTONCLEARSTASH)->EnableWindow((m_RefList.m_arShownList.GetSize() > 0)); + } + else + GetDlgItem(IDC_REFLOG_BUTTONCLEARSTASH)->ShowWindow(SW_HIDE); } \ No newline at end of file diff --git a/src/TortoiseProc/RefLogDlg.h b/src/TortoiseProc/RefLogDlg.h index b911726b8..dcdb70513 100644 --- a/src/TortoiseProc/RefLogDlg.h +++ b/src/TortoiseProc/RefLogDlg.h @@ -1,6 +1,6 @@ // TortoiseGit - a Windows shell extension for easy version control -// Copyright (C) 2009-2011 - TortoiseGit +// Copyright (C) 2009-2012 - TortoiseGit // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -40,6 +40,7 @@ protected: afx_msg void OnCbnSelchangeRef(); afx_msg LRESULT OnRefLogChanged(WPARAM wParam, LPARAM lParam); afx_msg void OnBnClickedOk(); + afx_msg void OnBnClickedClearStash(); DECLARE_MESSAGE_MAP() CHistoryCombo m_ChooseRef; diff --git a/src/TortoiseProc/resource.h b/src/TortoiseProc/resource.h index 6f9bd852b..2b3b0285f 100644 --- a/src/TortoiseProc/resource.h +++ b/src/TortoiseProc/resource.h @@ -1122,6 +1122,7 @@ #define IDC_CREATELIB 1683 #define IDC_BUTTON_REVISION 1684 #define IDC_REPOBROWSER_URL 1685 +#define IDC_REFLOG_BUTTONCLEARSTASH 1686 #define IDS_ABOUTVERSION 1700 #define IDS_ABOUTVERSIONBOX 1701 #define IDS_DLGTITLE_ADD_DIFF_TOOL 1750 -- 2.11.4.GIT