Improve line margin icon for moved lines
[TortoiseGit.git] / src / TortoiseProc / LogDlg.h
blob64277df7a3ec8a4efe19d6e6d8381ce71a3e0c89
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 Cancel();
99 virtual bool Validate(LPCTSTR string);
101 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
103 afx_msg LRESULT OnTaskbarBtnCreated(WPARAM wParam, LPARAM lParam);
104 CComPtr<ITaskbarList3> m_pTaskbarList;
106 afx_msg LRESULT OnRefreshSelection(WPARAM wParam, LPARAM lParam);
107 afx_msg LRESULT OnClickedInfoIcon(WPARAM wParam, LPARAM lParam);
108 afx_msg LRESULT OnClickedCancelFilter(WPARAM wParam, LPARAM lParam);
109 afx_msg LRESULT OnLogListLoading(WPARAM wParam, LPARAM lParam);
111 afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
112 afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
113 afx_msg void OnLvnItemchangedLoglist(NMHDR *pNMHDR, LRESULT *pResult);
114 afx_msg void OnLvnItemchangedLogmsg(NMHDR *pNMHDR, LRESULT *pResult);
115 afx_msg void OnEnLinkMsgview(NMHDR *pNMHDR, LRESULT *pResult);
116 afx_msg void OnBnClickedStatbutton();
117 afx_msg void OnSelectSearchField();
118 afx_msg void OnExitClearFilter();
120 afx_msg void OnEnChangeSearchedit();
121 afx_msg void OnTimer(UINT_PTR nIDEvent);
122 afx_msg void OnDtnDatetimechangeDateto(NMHDR *pNMHDR, LRESULT *pResult);
123 afx_msg void OnDtnDatetimechangeDatefrom(NMHDR *pNMHDR, LRESULT *pResult);
124 afx_msg void OnCbnSelchangeJumpType();
125 afx_msg void OnBnClickedJumpUp();
126 afx_msg void OnBnClickedJumpDown();
127 afx_msg void OnLvnColumnclick(NMHDR *pNMHDR, LRESULT *pResult);
128 afx_msg void OnBnClickedWalkBehaviour();
129 afx_msg void OnBnClickedView();
130 afx_msg void OnBnClickShowWholeProject();
131 void OnBnClickedHidepaths();
132 afx_msg void OnBnClickedAllBranch();
133 void OnBnClickedFollowRenames();
134 void HandleShowLabels(bool var, int flag);
135 void OnBnClickedCompressedGraph();
136 afx_msg void OnBnClickedBrowseRef();
138 afx_msg void GoBack();
139 afx_msg void GoForward();
140 afx_msg void GoBackAndSelect();
141 afx_msg void GoForwardAndSelect();
142 void GoBackForward(bool select, bool bForward);
144 afx_msg void OnDtnDropdownDatefrom(NMHDR *pNMHDR, LRESULT *pResult);
145 afx_msg void OnSize(UINT nType, int cx, int cy);
146 void OnBnClickedFirstParent();
147 afx_msg void OnBnClickedRefresh();
148 afx_msg void OnRefresh();
149 afx_msg void OnFocusFilter();
150 afx_msg void OnEditCopy();
151 afx_msg void OnEnChangeFileFilter();
152 afx_msg void OnEnscrollMsgview();
153 afx_msg LRESULT OnResetWcRev(WPARAM, LPARAM);
155 virtual void OnCancel();
156 virtual void OnOK();
157 virtual BOOL OnInitDialog();
158 virtual BOOL PreTranslateMessage(MSG* pMsg);
159 afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
160 afx_msg void OnPaint();
162 void OnPasteGitHash();
163 void JumpToGitHash(CString hash);
165 DECLARE_MESSAGE_MAP()
167 private:
168 CRegDWORD m_regbAllBranch;
169 CRegDWORD m_regbShowTags;
170 CRegDWORD m_regbShowLocalBranches;
171 CRegDWORD m_regbShowRemoteBranches;
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 AdjustMinSize();
183 void SetSplitterRange();
184 void SetFilterCueText();
186 void CopyChangedSelectionToClipBoard();
187 void SortShownListArray();
189 void SetSortArrow(CListCtrl * control, int nColumn, bool bAscending);
190 void SortByColumn(int nSortColumn, bool bAscending);
192 void EnableOKButton();
194 void SaveSplitterPos();
195 void CheckRegexpTooltip();
196 void SetDlgTitle();
197 CString GetAbsoluteUrlFromRelativeUrl(const CString& url);
198 void ShowGravatar();
200 CPatchViewDlg m_patchViewdlg;
201 void FillPatchView(bool onlySetTimer = false);
202 CWnd * GetPatchViewParentWnd() { return this; }
203 virtual void TogglePatchView();
204 LRESULT OnFileListCtrlItemChanged(WPARAM /*wparam*/, LPARAM /*lparam*/);
205 afx_msg LRESULT OnGitStatusListCtrlNeedsRefresh(WPARAM, LPARAM);
206 afx_msg void OnMoving(UINT fwSide, LPRECT pRect);
207 afx_msg void OnSizing(UINT fwSide, LPRECT pRect);
209 virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);
211 public:
212 CWnd * m_pNotifyWindow;
213 WORD m_wParam;
214 private:
215 CString m_sRelativeRoot;
216 CString m_sRepositoryRoot;
217 CGitLogList m_LogList;
218 CGitStatusListCtrl m_ChangedFileListCtrl;
219 CFilterEdit m_cFilter;
220 CGestureEnabledControlTmpl<CHyperLink> m_staticRef;
221 CProgressCtrl m_LogProgress;
222 CTGitPath m_path;
223 CTGitPath m_orgPath;
224 CString m_hightlightRevision;
226 CMenuButton m_ctrlView;
227 CMenuButton m_ctrlWalkBehavior;
229 std::vector<CGitHash> m_sSelectedHash; // set to selected commit hash on OK if appropriate
230 bool m_bSelectionMustBeContinuous;
231 bool m_bSelectionMustBeSingle;
232 bool m_bShowWC;
233 bool m_bCancelled;
235 CFilterEdit m_cFileFilter;
237 BOOL m_iHidePaths;
238 bool m_bFirstParent;
239 BOOL m_bAllBranch; // variable for checkbox only
240 AllBranchType m_AllBranchType; // variable for actual branch type
241 BOOL m_bWholeProject;
242 bool m_bFollowRenames;
243 BOOL m_bShowUnversioned;
244 bool m_bShowTags;
245 bool m_bShowLocalBranches;
246 bool m_bShowRemoteBranches;
247 bool m_bShowGravatar;
248 bool m_bShowDescribe;
249 bool m_bShowBranchRevNo;
250 bool m_bNoMerges;
251 int m_iCompressedGraph;
252 bool m_bNavigatingWithSelect;
253 bool m_bAsteriskLogPrefix;
255 bool m_bFilterWithRegex;
256 bool m_bFilterCaseSensitively;
258 CFont m_logFont;
259 CSplitterControl m_wndSplitter1;
260 CSplitterControl m_wndSplitter2;
261 CRect m_DlgOrigRect;
262 CRect m_MsgViewOrigRect;
263 CRect m_LogListOrigRect;
264 CRect m_ChgOrigRect;
266 //volatile LONG m_bNoDispUpdates;
267 CGestureEnabledControlTmpl<CDateTimeCtrl> m_DateFrom;
268 CRegString m_regLastSelectedFromDate;
269 CDateTimeCtrl m_DateTo;
270 CComboBox m_JumpType;
271 CButton m_JumpUp;
272 CButton m_JumpDown;
273 int m_nSortColumn;
274 bool m_bAscending;
275 static int m_nSortColumnPathList;
276 static bool m_bAscendingPathList;
277 CString m_sTitle;
278 bool m_bSelect;
279 CString m_sLogInfo;
281 CColors m_Colors;
282 CImageList m_imgList;
284 HACCEL m_hAccel;
286 CRegHistory m_History;
288 CGravatar m_gravatar;
290 CBrush m_Brush;
292 static UINT WM_REVSELECTED = RegisterWindowMessage(L"TORTOISEGit_REVSELECTED_MSG");
293 static UINT WM_REVLIST = RegisterWindowMessage(L"TORTOISEGit_REVLIST_MSG");
294 static UINT WM_REVLISTONERANGE = RegisterWindowMessage(L"TORTOISEGit_REVLISTONERANGE_MSG");