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"
38 #include "GestureEnabledControl.h"
40 #define LOGFILTER_TIMER 101
41 #define LOGFTIME_TIMER 102
42 #define LOG_FILLPATCHVTIMER 103
43 #define LOG_HEADER_ORDER_TIMER 104
44 #define FILEFILTER_TIMER 105
46 typedef int (__cdecl
*GENERICCOMPAREFN
)(const void * elem1
, const void * elem2
);
57 * \ingroup TortoiseProc
58 * Shows log messages of a single file or folder in a listbox.
60 class CLogDlg
: public CResizableStandAloneDialog
, IFilterEditValidator
, IHasPatchView
62 DECLARE_DYNAMIC(CLogDlg
)
64 friend class CStoreSelection
;
67 CLogDlg(CWnd
* pParent
= nullptr); // standard constructor
69 void SetParams(const CTGitPath
& orgPath
, const CTGitPath
& path
, CString hightlightRevision
, CString range
, DWORD limit
, int limitScale
= -1);
70 void SetFilter(const CString
& findstr
, LONG findtype
, bool findregex
);
71 bool IsThreadRunning() {return !!m_LogList
.m_bThreadRunning
;}
72 void SetSelect(bool bSelect
) {m_bSelect
= bSelect
;}
73 void ContinuousSelection(bool bCont
= true) {m_bSelectionMustBeContinuous
= bCont
;}
74 void SingleSelection(bool bSingle
= true) {m_bSelectionMustBeSingle
= bSingle
;}
75 void ShowWorkingTreeChanges(bool bShow
= false) { m_bShowWC
= bShow
; }
76 void SetRange(const CString
& range
);
78 afx_msg LRESULT
OnRefLogChanged(WPARAM wParam
, LPARAM lParam
);
80 * Provides selected commit hash if available, call after OK return from here
83 std::vector
<CGitHash
> GetSelectedHash(){ return m_sSelectedHash
; }
86 enum { IDD
= IDD_LOGMESSAGE
};
88 void FillLogMessageCtrl(bool bShow
= true);
90 void UpdateLogInfoLabel();
97 //implement the virtual methods from Git base class
98 virtual bool Validate(LPCTSTR string
) override
;
100 virtual void DoDataExchange(CDataExchange
* pDX
) override
; // 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();
152 afx_msg LRESULT
OnResetWcRev(WPARAM
, LPARAM
);
154 virtual void OnCancel() override
;
155 virtual void OnOK() override
;
156 virtual BOOL
OnInitDialog() override
;
157 virtual BOOL
PreTranslateMessage(MSG
* pMsg
) override
;
158 afx_msg HBRUSH
OnCtlColor(CDC
* pDC
, CWnd
* pWnd
, UINT nCtlColor
);
159 afx_msg
void OnPaint();
161 void OnPasteGitHash();
162 void JumpToGitHash(CString hash
);
164 DECLARE_MESSAGE_MAP()
167 CRegDWORD m_regbAllBranch
;
168 CRegDWORD m_regbShowTags
;
169 CRegDWORD m_regbShowLocalBranches
;
170 CRegDWORD m_regbShowRemoteBranches
;
171 CRegDWORD m_regbShowOtherRefs
;
172 CRegDWORD m_regbShowGravatar
;
173 CRegDWORD m_regShowWholeProject
;
174 CRegDWORD m_regAddBeforeCommit
;
176 void Refresh (bool clearfilter
= false);
177 void MoveToSameTop(CWnd
*pWndRef
, CWnd
*pWndTarget
);
178 void AddMainAnchors();
179 void RemoveMainAnchors();
180 void DoSizeV1(int delta
);
181 void DoSizeV2(int delta
);
182 void SetSplitterRange();
183 void SetFilterCueText();
185 void CopyChangedSelectionToClipBoard();
186 void SortShownListArray();
188 void SetSortArrow(CListCtrl
* control
, int nColumn
, bool bAscending
);
189 void SortByColumn(int nSortColumn
, bool bAscending
);
191 void EnableOKButton();
193 void SaveSplitterPos();
194 void CheckRegexpTooltip();
196 CString
GetAbsoluteUrlFromRelativeUrl(const CString
& url
);
199 CPatchViewDlg m_patchViewdlg
;
200 void FillPatchView(bool onlySetTimer
= false);
201 CWnd
* GetPatchViewParentWnd() { return this; }
202 void TogglePatchView();
203 LRESULT
OnFileListCtrlItemChanged(WPARAM
/*wparam*/, LPARAM
/*lparam*/);
204 afx_msg LRESULT
OnGitStatusListCtrlNeedsRefresh(WPARAM
, LPARAM
);
205 afx_msg
void OnMoving(UINT fwSide
, LPRECT pRect
);
206 afx_msg
void OnSizing(UINT fwSide
, LPRECT pRect
);
208 virtual LRESULT
DefWindowProc(UINT message
, WPARAM wParam
, LPARAM lParam
) override
;
211 CWnd
* m_pNotifyWindow
;
214 CString m_sRelativeRoot
;
215 CString m_sRepositoryRoot
;
216 CGitLogList m_LogList
;
217 CGitStatusListCtrl m_ChangedFileListCtrl
;
218 CFilterEdit m_cFilter
;
219 CGestureEnabledControlTmpl
<CHyperLink
> m_staticRef
;
220 CProgressCtrl m_LogProgress
;
223 CString m_hightlightRevision
;
225 CMenuButton m_ctrlView
;
226 CMenuButton m_ctrlWalkBehavior
;
228 std::vector
<CGitHash
> m_sSelectedHash
; // set to selected commit hash on OK if appropriate
229 bool m_bSelectionMustBeContinuous
;
230 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_bShowOtherRefs
;
246 bool m_bShowGravatar
;
247 bool m_bShowDescribe
;
248 bool m_bShowBranchRevNo
;
250 int m_iCompressedGraph
;
251 bool m_bNavigatingWithSelect
;
252 bool m_bAsteriskLogPrefix
;
254 bool m_bFilterWithRegex
;
255 bool m_bFilterCaseSensitively
;
258 CSplitterControl m_wndSplitter1
;
259 CSplitterControl m_wndSplitter2
;
261 CRect m_MsgViewOrigRect
;
262 CRect m_LogListOrigRect
;
265 //volatile LONG m_bNoDispUpdates;
266 CGestureEnabledControlTmpl
<CDateTimeCtrl
> m_DateFrom
;
267 CRegString m_regLastSelectedFromDate
;
268 CDateTimeCtrl m_DateTo
;
269 CComboBox m_JumpType
;
274 static int m_nSortColumnPathList
;
275 static bool m_bAscendingPathList
;
281 CImageList m_imgList
;
285 CRegHistory m_History
;
287 CGravatar m_gravatar
;
291 static UINT WM_REVSELECTED
= RegisterWindowMessage(L
"TORTOISEGit_REVSELECTED_MSG");
292 static UINT WM_REVLIST
= RegisterWindowMessage(L
"TORTOISEGit_REVLIST_MSG");
293 static UINT WM_REVLISTONERANGE
= RegisterWindowMessage(L
"TORTOISEGit_REVLISTONERANGE_MSG");