Remember recently selected branches
[TortoiseGit.git] / src / TortoiseProc / LogDlg.h
blob0a0eb71b19afc4548a543224243b08590653978c
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2003-2008 - TortoiseSVN
4 // Copyright (C) 2008-2013 - 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"
43 #define LOGFILTER_TIMER 101
44 #define LOGFTIME_TIMER 102
46 typedef int (__cdecl *GENERICCOMPAREFN)(const void * elem1, const void * elem2);
48 /**
49 * \ingroup TortoiseProc
50 * Shows log messages of a single file or folder in a listbox.
52 class CLogDlg : public CResizableStandAloneDialog, IFilterEditValidator
54 DECLARE_DYNAMIC(CLogDlg)
56 friend class CStoreSelection;
58 public:
59 CLogDlg(CWnd* pParent = NULL); // standard constructor
60 virtual ~CLogDlg();
61 void SetParams(const CTGitPath& orgPath, const CTGitPath& path, CString hightlightRevision, CString range, int limit);
62 void SetFilter(const CString& findstr, LONG findtype, bool findregex);
63 bool IsThreadRunning() {return !!m_LogList.m_bThreadRunning;}
64 void SetSelect(bool bSelect) {m_bSelect = bSelect;}
65 void ContinuousSelection(bool bCont = true) {m_bSelectionMustBeContinuous = bCont;}
66 void SingleSelection(bool bSingle = true) {m_bSelectionMustBeSingle = bSingle;}
67 void SetRange(const CString& range);
68 void ShowStartRef();
69 afx_msg LRESULT OnRefLogChanged(WPARAM wParam, LPARAM lParam);
70 /**
71 * Provides selected commit hash if available, call after OK return from here
72 * Empty if none
73 **/
74 CString GetSelectedHash(){ return m_sSelectedHash; }
76 // Dialog Data
77 enum { IDD = IDD_LOGMESSAGE };
79 void FillLogMessageCtrl(bool bShow = true);
80 CString GetTagInfo(GitRev* pLogEntry);
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 OnClickedInfoIcon(WPARAM wParam, LPARAM lParam);
99 afx_msg LRESULT OnClickedCancelFilter(WPARAM wParam, LPARAM lParam);
100 afx_msg LRESULT OnLogListLoading(WPARAM wParam, LPARAM lParam);
102 afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
103 afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
104 afx_msg void OnNMDblclkLoglist(NMHDR *pNMHDR, LRESULT *pResult);
105 afx_msg void OnLvnItemchangedLoglist(NMHDR *pNMHDR, LRESULT *pResult);
106 afx_msg void OnLvnItemchangedLogmsg(NMHDR *pNMHDR, LRESULT *pResult);
107 afx_msg void OnEnLinkMsgview(NMHDR *pNMHDR, LRESULT *pResult);
108 afx_msg void OnBnClickedStatbutton();
110 afx_msg void OnNMCustomdrawChangedFileList(NMHDR *pNMHDR, LRESULT *pResult);
111 afx_msg void OnLvnGetdispinfoChangedFileList(NMHDR *pNMHDR, LRESULT *pResult);
112 afx_msg void OnEnChangeSearchedit();
113 afx_msg void OnTimer(UINT_PTR nIDEvent);
114 afx_msg void OnDtnDatetimechangeDateto(NMHDR *pNMHDR, LRESULT *pResult);
115 afx_msg void OnDtnDatetimechangeDatefrom(NMHDR *pNMHDR, LRESULT *pResult);
116 afx_msg void OnCbnSelchangeJumpType();
117 afx_msg void OnBnClickedJumpUp();
118 afx_msg void OnBnClickedJumpDown();
119 afx_msg void OnLvnColumnclick(NMHDR *pNMHDR, LRESULT *pResult);
120 afx_msg void OnBnClickedWalkBehaviour();
121 afx_msg void OnBnClickedView();
122 afx_msg void OnBnClickShowWholeProject();
123 void OnBnClickedHidepaths();
124 afx_msg void OnBnClickedAllBranch();
125 void OnBnClickedFollowRenames();
126 void HandleShowLabels(bool var, int flag);
127 void OnBnClickedCompressedGraph();
128 afx_msg void OnBnClickedBrowseRef();
130 afx_msg void OnDtnDropdownDatefrom(NMHDR *pNMHDR, LRESULT *pResult);
131 afx_msg void OnDtnDropdownDateto(NMHDR *pNMHDR, LRESULT *pResult);
132 afx_msg void OnSize(UINT nType, int cx, int cy);
133 void OnBnClickedFirstParent();
134 afx_msg void OnBnClickedRefresh();
135 afx_msg void OnRefresh();
136 afx_msg void OnFocusFilter();
137 afx_msg void OnEditCopy();
139 virtual void OnCancel();
140 virtual void OnOK();
141 virtual BOOL OnInitDialog();
142 virtual BOOL PreTranslateMessage(MSG* pMsg);
144 void DoDiffFromLog(INT_PTR selIndex, GitRev *rev1, GitRev *rev2, bool blame, bool unified);
146 DECLARE_MESSAGE_MAP()
148 private:
149 CRegDWORD m_regbAllBranch;
150 CRegDWORD m_regbShowTags;
151 CRegDWORD m_regbShowLocalBranches;
152 CRegDWORD m_regbShowRemoteBranches;
153 CRegDWORD m_regbShowGravatar;
155 void Refresh (bool clearfilter = false);
156 void MoveToSameTop(CWnd *pWndRef, CWnd *pWndTarget);
157 void DoSizeV1(int delta);
158 void DoSizeV2(int delta);
159 void AdjustMinSize();
160 void SetSplitterRange();
161 void SetFilterCueText();
163 void CopySelectionToClipBoard();
164 void CopyChangedSelectionToClipBoard();
165 CTGitPathList GetChangedPathsFromSelectedRevisions(bool bRelativePaths = false, bool bUseFilter = true);
166 void SortShownListArray();
168 void SetSortArrow(CListCtrl * control, int nColumn, bool bAscending);
169 void SortByColumn(int nSortColumn, bool bAscending);
171 void EnableOKButton();
173 void SaveSplitterPos();
174 bool ValidateRegexp(LPCTSTR regexp_str, std::tr1::wregex& pat, bool bMatchCase);
175 void CheckRegexpTooltip();
176 void GetChangedPaths(std::vector<CString>& changedpaths, std::vector<LogChangedPath*>& changedlogpaths);
177 void SetDlgTitle();
178 CString GetAbsoluteUrlFromRelativeUrl(const CString& url);
179 void ShowGravatar();
182 virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);
184 public:
185 CWnd * m_pNotifyWindow;
186 WORD m_wParam;
187 private:
188 CString m_sRelativeRoot;
189 CString m_sRepositoryRoot;
190 CGitLogList m_LogList;
191 CGitStatusListCtrl m_ChangedFileListCtrl;
192 CFilterEdit m_cFilter;
193 CHyperLink m_staticRef;
194 CProgressCtrl m_LogProgress;
195 CTGitPath m_path;
196 CTGitPath m_orgPath;
197 CString m_hightlightRevision;
199 CString m_sSelectedHash; // set to selected commit hash on OK if appropriate
200 bool m_bSelectionMustBeContinuous;
201 bool m_bSelectionMustBeSingle;
202 bool m_bCancelled;
204 BOOL m_iHidePaths;
205 bool m_bFirstParent;
206 BOOL m_bAllBranch;
207 BOOL m_bWholeProject;
208 bool m_bFollowRenames;
209 BOOL m_bShowUnversioned;
210 bool m_bShowTags;
211 bool m_bShowLocalBranches;
212 bool m_bShowRemoteBranches;
213 bool m_bShowGravatar;
214 bool m_bNoMerges;
215 int m_iCompressedGraph;
216 BOOL m_bWalkBehavior;
218 CTGitPathList * m_currentChangedArray;
219 LogChangedPathArray m_CurrentFilteredChangedArray;
220 CTGitPathList m_currentChangedPathList;
222 bool m_bFilterWithRegex;
224 CFont m_logFont;
225 CSplitterControl m_wndSplitter1;
226 CSplitterControl m_wndSplitter2;
227 CRect m_DlgOrigRect;
228 CRect m_MsgViewOrigRect;
229 CRect m_LogListOrigRect;
230 CRect m_ChgOrigRect;
232 //volatile LONG m_bNoDispUpdates;
233 CDateTimeCtrl m_DateFrom;
234 CDateTimeCtrl m_DateTo;
235 CComboBox m_JumpType;
236 CButton m_JumpUp;
237 CButton m_JumpDown;
238 int m_limit;
239 int m_nSortColumn;
240 bool m_bAscending;
241 static int m_nSortColumnPathList;
242 static bool m_bAscendingPathList;
243 CString m_sTitle;
244 bool m_bSelect;
245 CString m_sLogInfo;
247 CToolTips m_tooltips;
249 CColors m_Colors;
250 CImageList m_imgList;
252 HACCEL m_hAccel;
254 CRegHistory m_History;
256 CGravatar m_gravatar;
258 static UINT WM_REVSELECTED = RegisterWindowMessage(_T("TORTOISEGit_REVSELECTED_MSG"));
259 static UINT WM_REVLIST = RegisterWindowMessage(_T("TORTOISEGit_REVLIST_MSG"));
260 static UINT WM_REVLISTONERANGE = RegisterWindowMessage(_T("TORTOISEGit_REVLISTONERANGE_MSG"));