Fixed issue #2449: wrong column info in tag reference dialog
[TortoiseGit.git] / src / TortoiseProc / LogDlg.h
blob1eec23ac4f7b8ce52e46dbb52857451f80cc640b
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2003-2009 - TortoiseSVN
4 // Copyright (C) 2008-2015 - 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 "Git.h"
24 #include "StandAloneDlg.h"
25 #include "TGitPath.h"
26 #include "registry.h"
27 #include "RegHistory.h"
28 #include "SplitterControl.h"
29 #include "Colors.h"
30 #include "LogDlgHelper.h"
31 #include "FilterEdit.h"
32 #include "GitRev.h"
33 #include <regex>
34 #include "GitLogList.h"
35 #include "GitStatusListCtrl.h"
36 #include "HyperLink.h"
37 #include "Win7.h"
38 #include "GravatarPictureBox.h"
39 #include "PatchViewDlg.h"
41 #define LOGFILTER_TIMER 101
42 #define LOGFTIME_TIMER 102
43 #define LOG_FILLPATCHVTIMER 103
44 #define LOG_HEADER_ORDER_TIMER 104
45 #define FILEFILTER_TIMER 105
47 typedef int (__cdecl *GENERICCOMPAREFN)(const void * elem1, const void * elem2);
49 /**
50 * \ingroup TortoiseProc
51 * Shows log messages of a single file or folder in a listbox.
53 class CLogDlg : public CResizableStandAloneDialog, IFilterEditValidator, IHasPatchView
55 DECLARE_DYNAMIC(CLogDlg)
57 friend class CStoreSelection;
59 public:
60 CLogDlg(CWnd* pParent = NULL); // standard constructor
61 virtual ~CLogDlg();
62 void SetParams(const CTGitPath& orgPath, const CTGitPath& path, CString hightlightRevision, CString range, int limit);
63 void SetFilter(const CString& findstr, LONG findtype, bool findregex);
64 bool IsThreadRunning() {return !!m_LogList.m_bThreadRunning;}
65 void SetSelect(bool bSelect) {m_bSelect = bSelect;}
66 void ContinuousSelection(bool bCont = true) {m_bSelectionMustBeContinuous = bCont;}
67 void SingleSelection(bool bSingle = true) {m_bSelectionMustBeSingle = bSingle;}
68 void SetRange(const CString& range);
69 void ShowStartRef();
70 afx_msg LRESULT OnRefLogChanged(WPARAM wParam, LPARAM lParam);
71 /**
72 * Provides selected commit hash if available, call after OK return from here
73 * Empty if none
74 **/
75 CString GetSelectedHash(){ return m_sSelectedHash; }
77 // Dialog Data
78 enum { IDD = IDD_LOGMESSAGE };
80 void FillLogMessageCtrl(bool bShow = true);
82 void UpdateLogInfoLabel();
84 afx_msg void OnFind()
86 m_LogList.OnFind();
88 protected:
89 //implement the virtual methods from Git base class
90 virtual BOOL Cancel();
91 virtual bool Validate(LPCTSTR string);
93 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
95 afx_msg LRESULT OnTaskbarBtnCreated(WPARAM wParam, LPARAM lParam);
96 CComPtr<ITaskbarList3> m_pTaskbarList;
98 afx_msg LRESULT OnRefreshSelection(WPARAM wParam, LPARAM lParam);
99 afx_msg LRESULT OnClickedInfoIcon(WPARAM wParam, LPARAM lParam);
100 afx_msg LRESULT OnClickedCancelFilter(WPARAM wParam, LPARAM lParam);
101 afx_msg LRESULT OnLogListLoading(WPARAM wParam, LPARAM lParam);
103 afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
104 afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
105 afx_msg void OnNMDblclkLoglist(NMHDR *pNMHDR, LRESULT *pResult);
106 afx_msg void OnLvnItemchangedLoglist(NMHDR *pNMHDR, LRESULT *pResult);
107 afx_msg void OnLvnItemchangedLogmsg(NMHDR *pNMHDR, LRESULT *pResult);
108 afx_msg void OnEnLinkMsgview(NMHDR *pNMHDR, LRESULT *pResult);
109 afx_msg void OnBnClickedStatbutton();
110 afx_msg void OnSelectSearchField();
112 afx_msg void OnNMCustomdrawChangedFileList(NMHDR *pNMHDR, LRESULT *pResult);
113 afx_msg void OnLvnGetdispinfoChangedFileList(NMHDR *pNMHDR, LRESULT *pResult);
114 afx_msg void OnEnChangeSearchedit();
115 afx_msg void OnTimer(UINT_PTR nIDEvent);
116 afx_msg void OnDtnDatetimechangeDateto(NMHDR *pNMHDR, LRESULT *pResult);
117 afx_msg void OnDtnDatetimechangeDatefrom(NMHDR *pNMHDR, LRESULT *pResult);
118 afx_msg void OnCbnSelchangeJumpType();
119 afx_msg void OnBnClickedJumpUp();
120 afx_msg void OnBnClickedJumpDown();
121 afx_msg void OnLvnColumnclick(NMHDR *pNMHDR, LRESULT *pResult);
122 afx_msg void OnBnClickedWalkBehaviour();
123 afx_msg void OnBnClickedView();
124 afx_msg void OnBnClickShowWholeProject();
125 void OnBnClickedHidepaths();
126 afx_msg void OnBnClickedAllBranch();
127 void OnBnClickedFollowRenames();
128 void HandleShowLabels(bool var, int flag);
129 void OnBnClickedCompressedGraph();
130 afx_msg void OnBnClickedBrowseRef();
132 afx_msg void GoBack();
133 afx_msg void GoForward();
134 afx_msg void GoBackAndSelect();
135 afx_msg void GoForwardAndSelect();
136 void GoBackForward(bool select, bool bForward);
138 afx_msg void OnDtnDropdownDatefrom(NMHDR *pNMHDR, LRESULT *pResult);
139 afx_msg void OnDtnDropdownDateto(NMHDR *pNMHDR, LRESULT *pResult);
140 afx_msg void OnSize(UINT nType, int cx, int cy);
141 void OnBnClickedFirstParent();
142 afx_msg void OnBnClickedRefresh();
143 afx_msg void OnRefresh();
144 afx_msg void OnFocusFilter();
145 afx_msg void OnEditCopy();
146 afx_msg void OnEnChangeFileFilter();
147 afx_msg void OnEnscrollMsgview();
149 virtual void OnCancel();
150 virtual void OnOK();
151 virtual BOOL OnInitDialog();
152 virtual BOOL PreTranslateMessage(MSG* pMsg);
154 void DoDiffFromLog(INT_PTR selIndex, GitRev *rev1, GitRev *rev2, bool blame, bool unified);
156 DECLARE_MESSAGE_MAP()
158 private:
159 CRegDWORD m_regbAllBranch;
160 CRegDWORD m_regbShowTags;
161 CRegDWORD m_regbShowLocalBranches;
162 CRegDWORD m_regbShowRemoteBranches;
163 CRegDWORD m_regbShowGravatar;
164 CRegDWORD m_regShowWholeProject;
166 void Refresh (bool clearfilter = false);
167 void MoveToSameTop(CWnd *pWndRef, CWnd *pWndTarget);
168 void DoSizeV1(int delta);
169 void DoSizeV2(int delta);
170 void AdjustMinSize();
171 void SetSplitterRange();
172 void SetFilterCueText();
174 void CopySelectionToClipBoard();
175 void CopyChangedSelectionToClipBoard();
176 CTGitPathList GetChangedPathsFromSelectedRevisions(bool bRelativePaths = false, bool bUseFilter = true);
177 void SortShownListArray();
179 void SetSortArrow(CListCtrl * control, int nColumn, bool bAscending);
180 void SortByColumn(int nSortColumn, bool bAscending);
182 void EnableOKButton();
184 void SaveSplitterPos();
185 bool ValidateRegexp(LPCTSTR regexp_str, std::tr1::wregex& pat, bool bMatchCase);
186 void CheckRegexpTooltip();
187 void GetChangedPaths(std::vector<CString>& changedpaths, std::vector<LogChangedPath*>& changedlogpaths);
188 void SetDlgTitle();
189 CString GetAbsoluteUrlFromRelativeUrl(const CString& url);
190 void ShowGravatar();
192 CPatchViewDlg m_patchViewdlg;
193 void FillPatchView(bool onlySetTimer = false);
194 CWnd * GetPatchViewParentWnd() { return this; }
195 virtual void TogglePatchView();
196 LRESULT OnFileListCtrlItemChanged(WPARAM /*wparam*/, LPARAM /*lparam*/);
197 afx_msg void OnMoving(UINT fwSide, LPRECT pRect);
198 afx_msg void OnSizing(UINT fwSide, LPRECT pRect);
200 virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);
202 public:
203 CWnd * m_pNotifyWindow;
204 WORD m_wParam;
205 private:
206 CString m_sRelativeRoot;
207 CString m_sRepositoryRoot;
208 CGitLogList m_LogList;
209 CGitStatusListCtrl m_ChangedFileListCtrl;
210 CFilterEdit m_cFilter;
211 CHyperLink m_staticRef;
212 CProgressCtrl m_LogProgress;
213 CTGitPath m_path;
214 CTGitPath m_orgPath;
215 CString m_hightlightRevision;
217 CString m_sSelectedHash; // set to selected commit hash on OK if appropriate
218 bool m_bSelectionMustBeContinuous;
219 bool m_bSelectionMustBeSingle;
220 bool m_bCancelled;
222 CFilterEdit m_cFileFilter;
224 BOOL m_iHidePaths;
225 bool m_bFirstParent;
226 BOOL m_bAllBranch;
227 BOOL m_bWholeProject;
228 bool m_bFollowRenames;
229 BOOL m_bShowUnversioned;
230 bool m_bShowTags;
231 bool m_bShowLocalBranches;
232 bool m_bShowRemoteBranches;
233 bool m_bShowGravatar;
234 bool m_bShowDescribe;
235 bool m_bNoMerges;
236 int m_iCompressedGraph;
237 BOOL m_bWalkBehavior;
238 bool m_bNavigatingWithSelect;
239 bool m_bAsteriskLogPrefix;
241 CTGitPathList * m_currentChangedArray;
242 LogChangedPathArray m_CurrentFilteredChangedArray;
243 CTGitPathList m_currentChangedPathList;
245 bool m_bFilterWithRegex;
246 bool m_bFilterCaseSensitively;
248 CFont m_logFont;
249 CSplitterControl m_wndSplitter1;
250 CSplitterControl m_wndSplitter2;
251 CRect m_DlgOrigRect;
252 CRect m_MsgViewOrigRect;
253 CRect m_LogListOrigRect;
254 CRect m_ChgOrigRect;
256 //volatile LONG m_bNoDispUpdates;
257 CDateTimeCtrl m_DateFrom;
258 CDateTimeCtrl m_DateTo;
259 CComboBox m_JumpType;
260 CButton m_JumpUp;
261 CButton m_JumpDown;
262 int m_limit;
263 int m_nSortColumn;
264 bool m_bAscending;
265 static int m_nSortColumnPathList;
266 static bool m_bAscendingPathList;
267 CString m_sTitle;
268 bool m_bSelect;
269 CString m_sLogInfo;
271 CColors m_Colors;
272 CImageList m_imgList;
274 HACCEL m_hAccel;
276 CRegHistory m_History;
278 CGravatar m_gravatar;
280 static UINT WM_REVSELECTED = RegisterWindowMessage(_T("TORTOISEGit_REVSELECTED_MSG"));
281 static UINT WM_REVLIST = RegisterWindowMessage(_T("TORTOISEGit_REVLIST_MSG"));
282 static UINT WM_REVLISTONERANGE = RegisterWindowMessage(_T("TORTOISEGit_REVLISTONERANGE_MSG"));