Refactor rebase commit list: Don't fill list again and again when reordering commits
[TortoiseGit.git] / src / TortoiseProc / LogDlg.h
blob12e8016892c4e3d798ce9b3640e32793fc5a4765
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2003-2009 - TortoiseSVN
4 // Copyright (C) 2008-2017 - TortoiseGit
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software Foundation,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #pragma once
22 #include "resource.h"
23 #include "StandAloneDlg.h"
24 #include "TGitPath.h"
25 #include "registry.h"
26 #include "RegHistory.h"
27 #include "SplitterControl.h"
28 #include "Colors.h"
29 #include "LogDlgHelper.h"
30 #include "FilterEdit.h"
31 #include <regex>
32 #include "GitLogList.h"
33 #include "GitStatusListCtrl.h"
34 #include "HyperLink.h"
35 #include "GravatarPictureBox.h"
36 #include "PatchViewDlg.h"
37 #include "MenuButton.h"
38 #include "GestureEnabledControl.h"
40 #define LOGFILTER_TIMER 101
41 #define LOGFTIME_TIMER 102
42 #define LOG_FILLPATCHVTIMER 103
43 #define LOG_HEADER_ORDER_TIMER 104
44 #define FILEFILTER_TIMER 105
46 typedef int (__cdecl *GENERICCOMPAREFN)(const void * elem1, const void * elem2);
48 enum AllBranchType
50 None = 0,
51 AllBranches = 1,
52 AllLocalBranches = 2,
53 AllBasicRefs = 3,
56 /**
57 * \ingroup TortoiseProc
58 * Shows log messages of a single file or folder in a listbox.
60 class CLogDlg : public CResizableStandAloneDialog, IFilterEditValidator, IHasPatchView
62 DECLARE_DYNAMIC(CLogDlg)
64 friend class CStoreSelection;
66 public:
67 CLogDlg(CWnd* pParent = nullptr); // standard constructor
68 virtual ~CLogDlg();
69 void SetParams(const CTGitPath& orgPath, const CTGitPath& path, CString hightlightRevision, CString range, DWORD limit, int limitScale = -1);
70 void SetFilter(const CString& findstr, LONG findtype, bool findregex);
71 bool IsThreadRunning() {return !!m_LogList.m_bThreadRunning;}
72 void SetSelect(bool bSelect) {m_bSelect = bSelect;}
73 void ContinuousSelection(bool bCont = true) {m_bSelectionMustBeContinuous = bCont;}
74 void SingleSelection(bool bSingle = true) {m_bSelectionMustBeSingle = bSingle;}
75 void ShowWorkingTreeChanges(bool bShow = false) { m_bShowWC = bShow; }
76 void SetRange(const CString& range);
77 void ShowStartRef();
78 afx_msg LRESULT OnRefLogChanged(WPARAM wParam, LPARAM lParam);
79 /**
80 * Provides selected commit hash if available, call after OK return from here
81 * Empty if none
82 **/
83 std::vector<CGitHash> GetSelectedHash(){ return m_sSelectedHash; }
85 // Dialog Data
86 enum { IDD = IDD_LOGMESSAGE };
88 void FillLogMessageCtrl(bool bShow = true);
90 void UpdateLogInfoLabel();
92 afx_msg void OnFind()
94 m_LogList.OnFind();
96 protected:
97 //implement the virtual methods from Git base class
98 virtual bool Validate(LPCTSTR string) override;
100 virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support
102 afx_msg LRESULT OnTaskbarBtnCreated(WPARAM wParam, LPARAM lParam);
103 CComPtr<ITaskbarList3> m_pTaskbarList;
105 afx_msg LRESULT OnRefreshSelection(WPARAM wParam, LPARAM lParam);
106 afx_msg LRESULT OnClickedInfoIcon(WPARAM wParam, LPARAM lParam);
107 afx_msg LRESULT OnClickedCancelFilter(WPARAM wParam, LPARAM lParam);
108 afx_msg LRESULT OnLogListLoading(WPARAM wParam, LPARAM lParam);
110 afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
111 afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
112 afx_msg void OnLvnItemchangedLoglist(NMHDR *pNMHDR, LRESULT *pResult);
113 afx_msg void OnLvnItemchangedLogmsg(NMHDR *pNMHDR, LRESULT *pResult);
114 afx_msg void OnEnLinkMsgview(NMHDR *pNMHDR, LRESULT *pResult);
115 afx_msg void OnBnClickedStatbutton();
116 afx_msg void OnSelectSearchField();
117 afx_msg void OnExitClearFilter();
119 afx_msg void OnEnChangeSearchedit();
120 afx_msg void OnTimer(UINT_PTR nIDEvent);
121 afx_msg void OnDtnDatetimechangeDateto(NMHDR *pNMHDR, LRESULT *pResult);
122 afx_msg void OnDtnDatetimechangeDatefrom(NMHDR *pNMHDR, LRESULT *pResult);
123 afx_msg void OnCbnSelchangeJumpType();
124 afx_msg void OnBnClickedJumpUp();
125 afx_msg void OnBnClickedJumpDown();
126 afx_msg void OnLvnColumnclick(NMHDR *pNMHDR, LRESULT *pResult);
127 afx_msg void OnBnClickedWalkBehaviour();
128 afx_msg void OnBnClickedView();
129 afx_msg void OnBnClickShowWholeProject();
130 void OnBnClickedHidepaths();
131 afx_msg void OnBnClickedAllBranch();
132 void OnBnClickedFollowRenames();
133 void HandleShowLabels(bool var, int flag);
134 void OnBnClickedCompressedGraph();
135 afx_msg void OnBnClickedBrowseRef();
137 afx_msg void GoBack();
138 afx_msg void GoForward();
139 afx_msg void GoBackAndSelect();
140 afx_msg void GoForwardAndSelect();
141 void GoBackForward(bool select, bool bForward);
143 afx_msg void OnDtnDropdownDatefrom(NMHDR *pNMHDR, LRESULT *pResult);
144 afx_msg void OnSize(UINT nType, int cx, int cy);
145 void OnBnClickedFirstParent();
146 afx_msg void OnBnClickedRefresh();
147 afx_msg void OnRefresh();
148 afx_msg void OnFocusFilter();
149 afx_msg void OnEditCopy();
150 afx_msg void OnEnChangeFileFilter();
151 afx_msg void OnEnscrollMsgview();
152 afx_msg LRESULT OnResetWcRev(WPARAM, LPARAM);
154 virtual void OnCancel() override;
155 virtual void OnOK() override;
156 virtual BOOL OnInitDialog() override;
157 virtual BOOL PreTranslateMessage(MSG* pMsg) override;
158 afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
159 afx_msg void OnPaint();
161 void OnPasteGitHash();
162 void JumpToGitHash(CString hash);
164 DECLARE_MESSAGE_MAP()
166 private:
167 CRegDWORD m_regbAllBranch;
168 CRegDWORD m_regbShowTags;
169 CRegDWORD m_regbShowLocalBranches;
170 CRegDWORD m_regbShowRemoteBranches;
171 CRegDWORD m_regbShowOtherRefs;
172 CRegDWORD m_regbShowGravatar;
173 CRegDWORD m_regShowWholeProject;
174 CRegDWORD m_regAddBeforeCommit;
176 void Refresh (bool clearfilter = false);
177 void MoveToSameTop(CWnd *pWndRef, CWnd *pWndTarget);
178 void AddMainAnchors();
179 void RemoveMainAnchors();
180 void DoSizeV1(int delta);
181 void DoSizeV2(int delta);
182 void SetSplitterRange();
183 void SetFilterCueText();
185 void CopyChangedSelectionToClipBoard();
186 void SortShownListArray();
188 void SetSortArrow(CListCtrl * control, int nColumn, bool bAscending);
189 void SortByColumn(int nSortColumn, bool bAscending);
191 void EnableOKButton();
193 void SaveSplitterPos();
194 void CheckRegexpTooltip();
195 void SetDlgTitle();
196 CString GetAbsoluteUrlFromRelativeUrl(const CString& url);
197 void ShowGravatar();
199 CPatchViewDlg m_patchViewdlg;
200 void FillPatchView(bool onlySetTimer = false);
201 CWnd * GetPatchViewParentWnd() { return this; }
202 void TogglePatchView();
203 LRESULT OnFileListCtrlItemChanged(WPARAM /*wparam*/, LPARAM /*lparam*/);
204 afx_msg LRESULT OnGitStatusListCtrlNeedsRefresh(WPARAM, LPARAM);
205 afx_msg void OnMoving(UINT fwSide, LPRECT pRect);
206 afx_msg void OnSizing(UINT fwSide, LPRECT pRect);
208 virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam) override;
210 public:
211 CWnd * m_pNotifyWindow;
212 WORD m_wParam;
213 private:
214 CString m_sRelativeRoot;
215 CString m_sRepositoryRoot;
216 CGitLogList m_LogList;
217 CGitStatusListCtrl m_ChangedFileListCtrl;
218 CFilterEdit m_cFilter;
219 CGestureEnabledControlTmpl<CHyperLink> m_staticRef;
220 CProgressCtrl m_LogProgress;
221 CTGitPath m_path;
222 CTGitPath m_orgPath;
223 CString m_hightlightRevision;
225 CMenuButton m_ctrlView;
226 CMenuButton m_ctrlWalkBehavior;
228 std::vector<CGitHash> m_sSelectedHash; // set to selected commit hash on OK if appropriate
229 bool m_bSelectionMustBeContinuous;
230 bool m_bSelectionMustBeSingle;
231 bool m_bShowWC;
233 CFilterEdit m_cFileFilter;
235 BOOL m_iHidePaths;
236 bool m_bFirstParent;
237 BOOL m_bAllBranch; // variable for checkbox only
238 AllBranchType m_AllBranchType; // variable for actual branch type
239 BOOL m_bWholeProject;
240 bool m_bFollowRenames;
241 BOOL m_bShowUnversioned;
242 bool m_bShowTags;
243 bool m_bShowLocalBranches;
244 bool m_bShowRemoteBranches;
245 bool m_bShowOtherRefs;
246 bool m_bShowGravatar;
247 bool m_bShowDescribe;
248 bool m_bShowBranchRevNo;
249 bool m_bNoMerges;
250 int m_iCompressedGraph;
251 bool m_bNavigatingWithSelect;
252 bool m_bAsteriskLogPrefix;
254 bool m_bFilterWithRegex;
255 bool m_bFilterCaseSensitively;
257 CFont m_logFont;
258 CSplitterControl m_wndSplitter1;
259 CSplitterControl m_wndSplitter2;
260 CRect m_DlgOrigRect;
261 CRect m_MsgViewOrigRect;
262 CRect m_LogListOrigRect;
263 CRect m_ChgOrigRect;
265 //volatile LONG m_bNoDispUpdates;
266 CGestureEnabledControlTmpl<CDateTimeCtrl> m_DateFrom;
267 CRegString m_regLastSelectedFromDate;
268 CDateTimeCtrl m_DateTo;
269 CComboBox m_JumpType;
270 CButton m_JumpUp;
271 CButton m_JumpDown;
272 int m_nSortColumn;
273 bool m_bAscending;
274 static int m_nSortColumnPathList;
275 static bool m_bAscendingPathList;
276 CString m_sTitle;
277 bool m_bSelect;
278 CString m_sLogInfo;
280 CColors m_Colors;
281 CImageList m_imgList;
283 HACCEL m_hAccel;
285 CRegHistory m_History;
287 CGravatar m_gravatar;
289 CBrush m_Brush;
291 static UINT WM_REVSELECTED = RegisterWindowMessage(L"TORTOISEGit_REVSELECTED_MSG");
292 static UINT WM_REVLIST = RegisterWindowMessage(L"TORTOISEGit_REVLIST_MSG");
293 static UINT WM_REVLISTONERANGE = RegisterWindowMessage(L"TORTOISEGit_REVLISTONERANGE_MSG");