1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2003-2009 - TortoiseSVN
4 // Copyright (C) 2008-2017 - 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.
23 #include "StandAloneDlg.h"
26 #include "RegHistory.h"
27 #include "SplitterControl.h"
29 #include "LogDlgHelper.h"
30 #include "FilterEdit.h"
32 #include "GitLogList.h"
33 #include "GitStatusListCtrl.h"
34 #include "HyperLink.h"
35 #include "GravatarPictureBox.h"
36 #include "PatchViewDlg.h"
37 #include "MenuButton.h"
39 #define LOGFILTER_TIMER 101
40 #define LOGFTIME_TIMER 102
41 #define LOG_FILLPATCHVTIMER 103
42 #define LOG_HEADER_ORDER_TIMER 104
43 #define FILEFILTER_TIMER 105
45 typedef int (__cdecl
*GENERICCOMPAREFN
)(const void * elem1
, const void * elem2
);
56 * \ingroup TortoiseProc
57 * Shows log messages of a single file or folder in a listbox.
59 class CLogDlg
: public CResizableStandAloneDialog
, IFilterEditValidator
, IHasPatchView
61 DECLARE_DYNAMIC(CLogDlg
)
63 friend class CStoreSelection
;
66 CLogDlg(CWnd
* pParent
= nullptr); // standard constructor
68 void SetParams(const CTGitPath
& orgPath
, const CTGitPath
& path
, CString hightlightRevision
, CString range
, DWORD limit
, int limitScale
= -1);
69 void SetFilter(const CString
& findstr
, LONG findtype
, bool findregex
);
70 bool IsThreadRunning() {return !!m_LogList
.m_bThreadRunning
;}
71 void SetSelect(bool bSelect
) {m_bSelect
= bSelect
;}
72 void ContinuousSelection(bool bCont
= true) {m_bSelectionMustBeContinuous
= bCont
;}
73 void SingleSelection(bool bSingle
= true) {m_bSelectionMustBeSingle
= bSingle
;}
74 void ShowWorkingTreeChanges(bool bShow
= false) { m_bShowWC
= bShow
; }
75 void SetRange(const CString
& range
);
77 afx_msg LRESULT
OnRefLogChanged(WPARAM wParam
, LPARAM lParam
);
79 * Provides selected commit hash if available, call after OK return from here
82 std::vector
<CGitHash
> GetSelectedHash(){ return m_sSelectedHash
; }
85 enum { IDD
= IDD_LOGMESSAGE
};
87 void FillLogMessageCtrl(bool bShow
= true);
89 void UpdateLogInfoLabel();
96 //implement the virtual methods from Git base class
97 virtual BOOL
Cancel();
98 virtual bool Validate(LPCTSTR string
);
100 virtual void DoDataExchange(CDataExchange
* pDX
); // 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 OnSelectSearchField();
117 afx_msg
void OnExitClearFilter();
119 afx_msg
void OnEnChangeSearchedit();
120 afx_msg
void OnTimer(UINT_PTR nIDEvent
);
121 afx_msg
void OnDtnDatetimechangeDateto(NMHDR
*pNMHDR
, LRESULT
*pResult
);
122 afx_msg
void OnDtnDatetimechangeDatefrom(NMHDR
*pNMHDR
, LRESULT
*pResult
);
123 afx_msg
void OnCbnSelchangeJumpType();
124 afx_msg
void OnBnClickedJumpUp();
125 afx_msg
void OnBnClickedJumpDown();
126 afx_msg
void OnLvnColumnclick(NMHDR
*pNMHDR
, LRESULT
*pResult
);
127 afx_msg
void OnBnClickedWalkBehaviour();
128 afx_msg
void OnBnClickedView();
129 afx_msg
void OnBnClickShowWholeProject();
130 void OnBnClickedHidepaths();
131 afx_msg
void OnBnClickedAllBranch();
132 void OnBnClickedFollowRenames();
133 void HandleShowLabels(bool var
, int flag
);
134 void OnBnClickedCompressedGraph();
135 afx_msg
void OnBnClickedBrowseRef();
137 afx_msg
void GoBack();
138 afx_msg
void GoForward();
139 afx_msg
void GoBackAndSelect();
140 afx_msg
void GoForwardAndSelect();
141 void GoBackForward(bool select
, bool bForward
);
143 afx_msg
void OnDtnDropdownDatefrom(NMHDR
*pNMHDR
, LRESULT
*pResult
);
144 afx_msg
void OnSize(UINT nType
, int cx
, int cy
);
145 void OnBnClickedFirstParent();
146 afx_msg
void OnBnClickedRefresh();
147 afx_msg
void OnRefresh();
148 afx_msg
void OnFocusFilter();
149 afx_msg
void OnEditCopy();
150 afx_msg
void OnEnChangeFileFilter();
151 afx_msg
void OnEnscrollMsgview();
153 virtual void OnCancel();
155 virtual BOOL
OnInitDialog();
156 virtual BOOL
PreTranslateMessage(MSG
* pMsg
);
157 afx_msg HBRUSH
OnCtlColor(CDC
* pDC
, CWnd
* pWnd
, UINT nCtlColor
);
158 afx_msg
void OnPaint();
160 void OnPasteGitHash();
161 void JumpToGitHash(CString hash
);
163 DECLARE_MESSAGE_MAP()
166 CRegDWORD m_regbAllBranch
;
167 CRegDWORD m_regbShowTags
;
168 CRegDWORD m_regbShowLocalBranches
;
169 CRegDWORD m_regbShowRemoteBranches
;
170 CRegDWORD m_regbShowGravatar
;
171 CRegDWORD m_regShowWholeProject
;
172 CRegDWORD m_regAddBeforeCommit
;
174 void Refresh (bool clearfilter
= false);
175 void MoveToSameTop(CWnd
*pWndRef
, CWnd
*pWndTarget
);
176 void AddMainAnchors();
177 void RemoveMainAnchors();
178 void DoSizeV1(int delta
);
179 void DoSizeV2(int delta
);
180 void AdjustMinSize();
181 void SetSplitterRange();
182 void SetFilterCueText();
184 void CopyChangedSelectionToClipBoard();
185 void SortShownListArray();
187 void SetSortArrow(CListCtrl
* control
, int nColumn
, bool bAscending
);
188 void SortByColumn(int nSortColumn
, bool bAscending
);
190 void EnableOKButton();
192 void SaveSplitterPos();
193 void CheckRegexpTooltip();
195 CString
GetAbsoluteUrlFromRelativeUrl(const CString
& url
);
198 CPatchViewDlg m_patchViewdlg
;
199 void FillPatchView(bool onlySetTimer
= false);
200 CWnd
* GetPatchViewParentWnd() { return this; }
201 virtual void TogglePatchView();
202 LRESULT
OnFileListCtrlItemChanged(WPARAM
/*wparam*/, LPARAM
/*lparam*/);
203 afx_msg LRESULT
OnGitStatusListCtrlNeedsRefresh(WPARAM
, LPARAM
);
204 afx_msg
void OnMoving(UINT fwSide
, LPRECT pRect
);
205 afx_msg
void OnSizing(UINT fwSide
, LPRECT pRect
);
207 virtual LRESULT
DefWindowProc(UINT message
, WPARAM wParam
, LPARAM lParam
);
210 CWnd
* m_pNotifyWindow
;
213 CString m_sRelativeRoot
;
214 CString m_sRepositoryRoot
;
215 CGitLogList m_LogList
;
216 CGitStatusListCtrl m_ChangedFileListCtrl
;
217 CFilterEdit m_cFilter
;
218 CHyperLink m_staticRef
;
219 CProgressCtrl m_LogProgress
;
222 CString m_hightlightRevision
;
224 CMenuButton m_ctrlView
;
225 CMenuButton m_ctrlWalkBehavior
;
227 std::vector
<CGitHash
> m_sSelectedHash
; // set to selected commit hash on OK if appropriate
228 bool m_bSelectionMustBeContinuous
;
229 bool m_bSelectionMustBeSingle
;
233 CFilterEdit m_cFileFilter
;
237 BOOL m_bAllBranch
; // variable for checkbox only
238 AllBranchType m_AllBranchType
; // variable for actual branch type
239 BOOL m_bWholeProject
;
240 bool m_bFollowRenames
;
241 BOOL m_bShowUnversioned
;
243 bool m_bShowLocalBranches
;
244 bool m_bShowRemoteBranches
;
245 bool m_bShowGravatar
;
246 bool m_bShowDescribe
;
247 bool m_bShowBranchRevNo
;
249 int m_iCompressedGraph
;
250 bool m_bNavigatingWithSelect
;
251 bool m_bAsteriskLogPrefix
;
253 bool m_bFilterWithRegex
;
254 bool m_bFilterCaseSensitively
;
257 CSplitterControl m_wndSplitter1
;
258 CSplitterControl m_wndSplitter2
;
260 CRect m_MsgViewOrigRect
;
261 CRect m_LogListOrigRect
;
264 //volatile LONG m_bNoDispUpdates;
265 CDateTimeCtrl m_DateFrom
;
266 CRegString m_regLastSelectedFromDate
;
267 CDateTimeCtrl m_DateTo
;
268 CComboBox m_JumpType
;
273 static int m_nSortColumnPathList
;
274 static bool m_bAscendingPathList
;
280 CImageList m_imgList
;
284 CRegHistory m_History
;
286 CGravatar m_gravatar
;
290 static UINT WM_REVSELECTED
= RegisterWindowMessage(L
"TORTOISEGit_REVSELECTED_MSG");
291 static UINT WM_REVLIST
= RegisterWindowMessage(L
"TORTOISEGit_REVLIST_MSG");
292 static UINT WM_REVLISTONERANGE
= RegisterWindowMessage(L
"TORTOISEGit_REVLISTONERANGE_MSG");