Merge branch 'git-describe'
[TortoiseGit.git] / src / TortoiseProc / LogDlg.h
blobb4eab7c6a9f817b3d782f4fe36e97af67605ba29
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2003-2009 - TortoiseSVN
4 // Copyright (C) 2008-2014 - 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 "Tooltip.h"
34 #include "HintListCtrl.h"
35 #include <regex>
36 #include "GitLogList.h"
37 #include "GitStatusListCtrl.h"
38 #include "HyperLink.h"
39 #include "Win7.h"
40 #include "GravatarPictureBox.h"
41 #include "PatchViewDlg.h"
43 #define LOGFILTER_TIMER 101
44 #define LOGFTIME_TIMER 102
45 #define LOG_FILLPATCHVTIMER 103
46 #define LOG_HEADER_ORDER_TIMER 104
48 typedef int (__cdecl *GENERICCOMPAREFN)(const void * elem1, const void * elem2);
50 /**
51 * \ingroup TortoiseProc
52 * Shows log messages of a single file or folder in a listbox.
54 class CLogDlg : public CResizableStandAloneDialog, IFilterEditValidator, IHasPatchView
56 DECLARE_DYNAMIC(CLogDlg)
58 friend class CStoreSelection;
60 public:
61 CLogDlg(CWnd* pParent = NULL); // standard constructor
62 virtual ~CLogDlg();
63 void SetParams(const CTGitPath& orgPath, const CTGitPath& path, CString hightlightRevision, CString range, int limit);
64 void SetFilter(const CString& findstr, LONG findtype, bool findregex);
65 bool IsThreadRunning() {return !!m_LogList.m_bThreadRunning;}
66 void SetSelect(bool bSelect) {m_bSelect = bSelect;}
67 void ContinuousSelection(bool bCont = true) {m_bSelectionMustBeContinuous = bCont;}
68 void SingleSelection(bool bSingle = true) {m_bSelectionMustBeSingle = bSingle;}
69 void SetRange(const CString& range);
70 void ShowStartRef();
71 afx_msg LRESULT OnRefLogChanged(WPARAM wParam, LPARAM lParam);
72 /**
73 * Provides selected commit hash if available, call after OK return from here
74 * Empty if none
75 **/
76 CString GetSelectedHash(){ return m_sSelectedHash; }
78 // Dialog Data
79 enum { IDD = IDD_LOGMESSAGE };
81 void FillLogMessageCtrl(bool bShow = true);
83 void UpdateLogInfoLabel();
85 afx_msg void OnFind()
87 m_LogList.OnFind();
89 protected:
90 //implement the virtual methods from Git base class
91 virtual BOOL Cancel();
92 virtual bool Validate(LPCTSTR string);
94 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
96 afx_msg LRESULT OnTaskbarBtnCreated(WPARAM wParam, LPARAM lParam);
97 CComPtr<ITaskbarList3> m_pTaskbarList;
99 afx_msg LRESULT OnRefreshSelection(WPARAM wParam, LPARAM lParam);
100 afx_msg LRESULT OnClickedInfoIcon(WPARAM wParam, LPARAM lParam);
101 afx_msg LRESULT OnClickedCancelFilter(WPARAM wParam, LPARAM lParam);
102 afx_msg LRESULT OnLogListLoading(WPARAM wParam, LPARAM lParam);
104 afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
105 afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
106 afx_msg void OnNMDblclkLoglist(NMHDR *pNMHDR, LRESULT *pResult);
107 afx_msg void OnLvnItemchangedLoglist(NMHDR *pNMHDR, LRESULT *pResult);
108 afx_msg void OnLvnItemchangedLogmsg(NMHDR *pNMHDR, LRESULT *pResult);
109 afx_msg void OnEnLinkMsgview(NMHDR *pNMHDR, LRESULT *pResult);
110 afx_msg void OnBnClickedStatbutton();
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();
147 virtual void OnCancel();
148 virtual void OnOK();
149 virtual BOOL OnInitDialog();
150 virtual BOOL PreTranslateMessage(MSG* pMsg);
152 void DoDiffFromLog(INT_PTR selIndex, GitRev *rev1, GitRev *rev2, bool blame, bool unified);
154 DECLARE_MESSAGE_MAP()
156 private:
157 CRegDWORD m_regbAllBranch;
158 CRegDWORD m_regbShowTags;
159 CRegDWORD m_regbShowLocalBranches;
160 CRegDWORD m_regbShowRemoteBranches;
161 CRegDWORD m_regbShowGravatar;
162 CRegDWORD m_regShowWholeProject;
164 void Refresh (bool clearfilter = false);
165 void MoveToSameTop(CWnd *pWndRef, CWnd *pWndTarget);
166 void DoSizeV1(int delta);
167 void DoSizeV2(int delta);
168 void AdjustMinSize();
169 void SetSplitterRange();
170 void SetFilterCueText();
172 void CopySelectionToClipBoard();
173 void CopyChangedSelectionToClipBoard();
174 CTGitPathList GetChangedPathsFromSelectedRevisions(bool bRelativePaths = false, bool bUseFilter = true);
175 void SortShownListArray();
177 void SetSortArrow(CListCtrl * control, int nColumn, bool bAscending);
178 void SortByColumn(int nSortColumn, bool bAscending);
180 void EnableOKButton();
182 void SaveSplitterPos();
183 bool ValidateRegexp(LPCTSTR regexp_str, std::tr1::wregex& pat, bool bMatchCase);
184 void CheckRegexpTooltip();
185 void GetChangedPaths(std::vector<CString>& changedpaths, std::vector<LogChangedPath*>& changedlogpaths);
186 void SetDlgTitle();
187 CString GetAbsoluteUrlFromRelativeUrl(const CString& url);
188 void ShowGravatar();
190 CPatchViewDlg m_patchViewdlg;
191 void FillPatchView(bool onlySetTimer = false);
192 CWnd * GetPatchViewParentWnd() { return this; }
193 virtual void TogglePatchView();
194 LRESULT OnFileListCtrlItemChanged(WPARAM /*wparam*/, LPARAM /*lparam*/);
195 afx_msg void OnMoving(UINT fwSide, LPRECT pRect);
196 afx_msg void OnSizing(UINT fwSide, LPRECT pRect);
198 virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);
200 public:
201 CWnd * m_pNotifyWindow;
202 WORD m_wParam;
203 private:
204 CString m_sRelativeRoot;
205 CString m_sRepositoryRoot;
206 CGitLogList m_LogList;
207 CGitStatusListCtrl m_ChangedFileListCtrl;
208 CFilterEdit m_cFilter;
209 CHyperLink m_staticRef;
210 CProgressCtrl m_LogProgress;
211 CTGitPath m_path;
212 CTGitPath m_orgPath;
213 CString m_hightlightRevision;
215 CString m_sSelectedHash; // set to selected commit hash on OK if appropriate
216 bool m_bSelectionMustBeContinuous;
217 bool m_bSelectionMustBeSingle;
218 bool m_bCancelled;
220 BOOL m_iHidePaths;
221 bool m_bFirstParent;
222 BOOL m_bAllBranch;
223 BOOL m_bWholeProject;
224 bool m_bFollowRenames;
225 BOOL m_bShowUnversioned;
226 bool m_bShowTags;
227 bool m_bShowLocalBranches;
228 bool m_bShowRemoteBranches;
229 bool m_bShowGravatar;
230 bool m_bShowDescribe;
231 bool m_bNoMerges;
232 int m_iCompressedGraph;
233 BOOL m_bWalkBehavior;
234 bool m_bNavigatingWithSelect;
236 CTGitPathList * m_currentChangedArray;
237 LogChangedPathArray m_CurrentFilteredChangedArray;
238 CTGitPathList m_currentChangedPathList;
240 bool m_bFilterWithRegex;
241 bool m_bFilterCaseSensitively;
243 CFont m_logFont;
244 CSplitterControl m_wndSplitter1;
245 CSplitterControl m_wndSplitter2;
246 CRect m_DlgOrigRect;
247 CRect m_MsgViewOrigRect;
248 CRect m_LogListOrigRect;
249 CRect m_ChgOrigRect;
251 //volatile LONG m_bNoDispUpdates;
252 CDateTimeCtrl m_DateFrom;
253 CDateTimeCtrl m_DateTo;
254 CComboBox m_JumpType;
255 CButton m_JumpUp;
256 CButton m_JumpDown;
257 int m_limit;
258 int m_nSortColumn;
259 bool m_bAscending;
260 static int m_nSortColumnPathList;
261 static bool m_bAscendingPathList;
262 CString m_sTitle;
263 bool m_bSelect;
264 CString m_sLogInfo;
266 CToolTips m_tooltips;
268 CColors m_Colors;
269 CImageList m_imgList;
271 HACCEL m_hAccel;
273 CRegHistory m_History;
275 CGravatar m_gravatar;
277 static UINT WM_REVSELECTED = RegisterWindowMessage(_T("TORTOISEGit_REVSELECTED_MSG"));
278 static UINT WM_REVLIST = RegisterWindowMessage(_T("TORTOISEGit_REVLIST_MSG"));
279 static UINT WM_REVLISTONERANGE = RegisterWindowMessage(_T("TORTOISEGit_REVLISTONERANGE_MSG"));