Refactor rebase commit list: Don't fill list again and again when reordering commits
[TortoiseGit.git] / src / TortoiseProc / CommitIsOnRefsDlg.h
blob5afc1869f1a0c94200c156f27e5f3056515ca774
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2016-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 #pragma once
21 #include "StandAloneDlg.h"
22 #include "registry.h"
23 #include "GitRev.h"
24 #include "ACEdit.h"
25 #include "MenuButton.h"
26 #include "FilterEdit.h"
27 #include "HintCtrl.h"
28 #include "GestureEnabledControl.h"
30 // CCommitIsOnRefsDlg dialog
32 #define IDT_FILTER 101
33 #define IDT_INPUT 102
35 class CCommitIsOnRefsDlg : public CResizableStandAloneDialog
37 DECLARE_DYNAMIC(CCommitIsOnRefsDlg)
39 public:
40 CCommitIsOnRefsDlg(CWnd* pParent = nullptr); // standard constructor
41 virtual ~CCommitIsOnRefsDlg();
42 void Create(CWnd* pParent = nullptr) { m_bNonModalParentHWND = pParent->GetSafeHwnd(); CDialog::Create(IDD, pParent); ShowWindow(SW_SHOW); UpdateWindow(); }
44 // Dialog Data
45 enum { IDD = IDD_COMMITISONREFS };
47 enum eCmd
49 eCmd_ViewLog = WM_APP,
50 eCmd_Diff,
51 eCmd_RepoBrowser,
52 eCmd_ViewLogRange,
53 eCmd_ViewLogRangeReachableFromOnlyOne,
54 eCmd_UnifiedDiff,
55 eCmd_Copy,
56 eCmd_DiffWC,
59 protected:
60 virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support
61 virtual void OnCancel() override;
62 virtual BOOL OnInitDialog() override;
63 virtual BOOL PreTranslateMessage(MSG* pMsg) override;
64 virtual void PostNcDestroy() override;
65 afx_msg void OnEnChangeEditFilter();
66 afx_msg LRESULT OnClickedCancelFilter(WPARAM wParam, LPARAM lParam);
67 afx_msg void OnBnClickedSelRevBtn();
68 afx_msg void OnBnClickedShowLog();
69 afx_msg void OnTimer(UINT_PTR nIDEvent);
70 afx_msg LRESULT OnEnChangeCommit(WPARAM wParam, LPARAM lParam);
71 afx_msg void OnItemChangedListRefs(NMHDR* pNMHDR, LRESULT* pResult);
72 afx_msg void OnNMDblClickListRefs(NMHDR* pNMHDR, LRESULT* pResult);
73 afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
74 afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
75 afx_msg LRESULT OnGettingRefsFinished(WPARAM, LPARAM);
77 DECLARE_MESSAGE_MAP()
79 STRING_VECTOR m_RefList;
81 static CString GetTwoSelectedRefs(const STRING_VECTOR& selectedRefs, const CString& lastSelected, const CString& separator);
82 void AddToList();
83 void CopySelectionToClipboard();
84 int FillRevFromString(const CString& str)
86 GitRev gitrev;
87 if (gitrev.GetCommit(str))
89 MessageBox(gitrev.GetLastErr(), L"TortoiseGit", MB_ICONERROR);
90 return -1;
92 m_gitrev = gitrev;
93 return 0;
95 GitRev m_gitrev;
97 public:
98 CString m_Rev;
100 private:
101 HWND m_bNonModalParentHWND;
102 static UINT WM_GETTINGREFSFINISHED;
103 void StartGetRefsThread();
104 static UINT GetRefsThreadEntry(LPVOID pVoid);
105 UINT GetRefsThread();
107 volatile LONG m_bThreadRunning;
108 bool m_bRefsLoaded;
109 CString m_sLastSelected;
110 CGestureEnabledControlTmpl<CHintCtrl<CListCtrl>> m_cRefList;
111 CACEdit m_cRevEdit;
112 CMenuButton m_cSelRevBtn;
113 CFilterEdit m_cFilter;
114 bool m_bHasWC;