1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2003-2008 - 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.
24 #include "StandAloneDlg.h"
27 #include "RegHistory.h"
28 #include "SplitterControl.h"
30 #include "LogDlgHelper.h"
31 #include "FilterEdit.h"
34 #include "HintListCtrl.h"
36 #include "GitLogList.h"
37 #include "GitStatusListCtrl.h"
38 #include "HyperLink.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
);
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
;
61 CLogDlg(CWnd
* pParent
= NULL
); // standard constructor
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
);
71 afx_msg LRESULT
OnRefLogChanged(WPARAM wParam
, LPARAM lParam
);
73 * Provides selected commit hash if available, call after OK return from here
76 CString
GetSelectedHash(){ return m_sSelectedHash
; }
79 enum { IDD
= IDD_LOGMESSAGE
};
81 void FillLogMessageCtrl(bool bShow
= true);
83 void UpdateLogInfoLabel();
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 OnDtnDropdownDatefrom(NMHDR
*pNMHDR
, LRESULT
*pResult
);
133 afx_msg
void OnDtnDropdownDateto(NMHDR
*pNMHDR
, LRESULT
*pResult
);
134 afx_msg
void OnSize(UINT nType
, int cx
, int cy
);
135 void OnBnClickedFirstParent();
136 afx_msg
void OnBnClickedRefresh();
137 afx_msg
void OnRefresh();
138 afx_msg
void OnFocusFilter();
139 afx_msg
void OnEditCopy();
141 virtual void OnCancel();
143 virtual BOOL
OnInitDialog();
144 virtual BOOL
PreTranslateMessage(MSG
* pMsg
);
146 void DoDiffFromLog(INT_PTR selIndex
, GitRev
*rev1
, GitRev
*rev2
, bool blame
, bool unified
);
148 DECLARE_MESSAGE_MAP()
151 CRegDWORD m_regbAllBranch
;
152 CRegDWORD m_regbShowTags
;
153 CRegDWORD m_regbShowLocalBranches
;
154 CRegDWORD m_regbShowRemoteBranches
;
155 CRegDWORD m_regbShowGravatar
;
156 CRegDWORD m_regShowWholeProject
;
158 void Refresh (bool clearfilter
= false);
159 void MoveToSameTop(CWnd
*pWndRef
, CWnd
*pWndTarget
);
160 void DoSizeV1(int delta
);
161 void DoSizeV2(int delta
);
162 void AdjustMinSize();
163 void SetSplitterRange();
164 void SetFilterCueText();
166 void CopySelectionToClipBoard();
167 void CopyChangedSelectionToClipBoard();
168 CTGitPathList
GetChangedPathsFromSelectedRevisions(bool bRelativePaths
= false, bool bUseFilter
= true);
169 void SortShownListArray();
171 void SetSortArrow(CListCtrl
* control
, int nColumn
, bool bAscending
);
172 void SortByColumn(int nSortColumn
, bool bAscending
);
174 void EnableOKButton();
176 void SaveSplitterPos();
177 bool ValidateRegexp(LPCTSTR regexp_str
, std::tr1::wregex
& pat
, bool bMatchCase
);
178 void CheckRegexpTooltip();
179 void GetChangedPaths(std::vector
<CString
>& changedpaths
, std::vector
<LogChangedPath
*>& changedlogpaths
);
181 CString
GetAbsoluteUrlFromRelativeUrl(const CString
& url
);
184 CPatchViewDlg m_patchViewdlg
;
185 void FillPatchView(bool onlySetTimer
= false);
186 CWnd
* GetPatchViewParentWnd() { return this; }
187 virtual void TogglePatchView();
188 LRESULT
OnFileListCtrlItemChanged(WPARAM
/*wparam*/, LPARAM
/*lparam*/);
189 afx_msg
void OnMoving(UINT fwSide
, LPRECT pRect
);
190 afx_msg
void OnSizing(UINT fwSide
, LPRECT pRect
);
192 virtual LRESULT
DefWindowProc(UINT message
, WPARAM wParam
, LPARAM lParam
);
195 CWnd
* m_pNotifyWindow
;
198 CString m_sRelativeRoot
;
199 CString m_sRepositoryRoot
;
200 CGitLogList m_LogList
;
201 CGitStatusListCtrl m_ChangedFileListCtrl
;
202 CFilterEdit m_cFilter
;
203 CHyperLink m_staticRef
;
204 CProgressCtrl m_LogProgress
;
207 CString m_hightlightRevision
;
209 CString m_sSelectedHash
; // set to selected commit hash on OK if appropriate
210 bool m_bSelectionMustBeContinuous
;
211 bool m_bSelectionMustBeSingle
;
217 BOOL m_bWholeProject
;
218 bool m_bFollowRenames
;
219 BOOL m_bShowUnversioned
;
221 bool m_bShowLocalBranches
;
222 bool m_bShowRemoteBranches
;
223 bool m_bShowGravatar
;
225 int m_iCompressedGraph
;
226 BOOL m_bWalkBehavior
;
228 CTGitPathList
* m_currentChangedArray
;
229 LogChangedPathArray m_CurrentFilteredChangedArray
;
230 CTGitPathList m_currentChangedPathList
;
232 bool m_bFilterWithRegex
;
235 CSplitterControl m_wndSplitter1
;
236 CSplitterControl m_wndSplitter2
;
238 CRect m_MsgViewOrigRect
;
239 CRect m_LogListOrigRect
;
242 //volatile LONG m_bNoDispUpdates;
243 CDateTimeCtrl m_DateFrom
;
244 CDateTimeCtrl m_DateTo
;
245 CComboBox m_JumpType
;
251 static int m_nSortColumnPathList
;
252 static bool m_bAscendingPathList
;
257 CToolTips m_tooltips
;
260 CImageList m_imgList
;
264 CRegHistory m_History
;
266 CGravatar m_gravatar
;
268 static UINT WM_REVSELECTED
= RegisterWindowMessage(_T("TORTOISEGit_REVSELECTED_MSG"));
269 static UINT WM_REVLIST
= RegisterWindowMessage(_T("TORTOISEGit_REVLIST_MSG"));
270 static UINT WM_REVLISTONERANGE
= RegisterWindowMessage(_T("TORTOISEGit_REVLISTONERANGE_MSG"));