Fixed issue #3307: Abort Merge on a single file always results in a parameter error...
[TortoiseGit.git] / src / TortoiseProc / LogDlg.h
blobbb0a5c6d5760332f4e16c369d531bb9a504516c4
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2003-2009 - TortoiseSVN
4 // Copyright (C) 2008-2018 - 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 OnNMCustomdrawChangedFileList(NMHDR* pNMHDR, LRESULT* pResult);
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() override;
156 virtual void OnOK() override;
157 virtual BOOL OnInitDialog() override;
158 virtual BOOL PreTranslateMessage(MSG* pMsg) override;
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_regbShowOtherRefs;
173 CRegDWORD m_regbShowGravatar;
174 CRegDWORD m_regShowWholeProject;
175 CRegDWORD m_regAddBeforeCommit;
177 void Refresh (bool clearfilter = false);
178 void MoveToSameTop(CWnd *pWndRef, CWnd *pWndTarget);
179 void AddMainAnchors();
180 void RemoveMainAnchors();
181 void DoSizeV1(int delta);
182 void DoSizeV2(int delta);
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 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) override;
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 CString m_sFilterText;
221 DWORD m_SelectedFilters;
222 CGestureEnabledControlTmpl<CHyperLink> m_staticRef;
223 CProgressCtrl m_LogProgress;
224 CTGitPath m_path;
225 CTGitPath m_orgPath;
226 CString m_hightlightRevision;
228 CMenuButton m_ctrlView;
229 CMenuButton m_ctrlWalkBehavior;
231 std::vector<CGitHash> m_sSelectedHash; // set to selected commit hash on OK if appropriate
232 bool m_bSelectionMustBeContinuous;
233 bool m_bSelectionMustBeSingle;
234 bool m_bShowWC;
236 CFilterEdit m_cFileFilter;
238 BOOL m_iHidePaths;
239 bool m_bFirstParent;
240 BOOL m_bAllBranch; // variable for checkbox only
241 AllBranchType m_AllBranchType; // variable for actual branch type
242 BOOL m_bWholeProject;
243 bool m_bFollowRenames;
244 BOOL m_bShowUnversioned;
245 bool m_bShowTags;
246 bool m_bShowLocalBranches;
247 bool m_bShowRemoteBranches;
248 bool m_bShowOtherRefs;
249 bool m_bShowGravatar;
250 bool m_bShowDescribe;
251 bool m_bShowBranchRevNo;
252 bool m_bNoMerges;
253 int m_iCompressedGraph;
254 bool m_bNavigatingWithSelect;
255 bool m_bAsteriskLogPrefix;
257 bool m_bFilterWithRegex;
258 bool m_bFilterCaseSensitively;
260 CFont m_logFont;
261 CSplitterControl m_wndSplitter1;
262 CSplitterControl m_wndSplitter2;
263 CRect m_DlgOrigRect;
264 CRect m_MsgViewOrigRect;
265 CRect m_LogListOrigRect;
266 CRect m_ChgOrigRect;
268 //volatile LONG m_bNoDispUpdates;
269 CGestureEnabledControlTmpl<CDateTimeCtrl> m_DateFrom;
270 CRegString m_regLastSelectedFromDate;
271 CDateTimeCtrl m_DateTo;
272 CComboBox m_JumpType;
273 CButton m_JumpUp;
274 CButton m_JumpDown;
275 int m_nSortColumn;
276 bool m_bAscending;
277 static int m_nSortColumnPathList;
278 static bool m_bAscendingPathList;
279 CString m_sTitle;
280 bool m_bSelect;
281 CString m_sLogInfo;
283 CColors m_Colors;
284 CImageList m_imgList;
286 HACCEL m_hAccel;
288 CRegHistory m_History;
290 CGravatar m_gravatar;
292 CBrush m_Brush;
294 static UINT WM_REVSELECTED = RegisterWindowMessage(L"TORTOISEGit_REVSELECTED_MSG");
295 static UINT WM_REVLIST = RegisterWindowMessage(L"TORTOISEGit_REVLIST_MSG");
296 static UINT WM_REVLISTONERANGE = RegisterWindowMessage(L"TORTOISEGit_REVLISTONERANGE_MSG");