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