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 GoBack();
133 afx_msg
void GoForward();
134 void GoBackForward(bool bForward
);
136 afx_msg
void OnDtnDropdownDatefrom(NMHDR
*pNMHDR
, LRESULT
*pResult
);
137 afx_msg
void OnDtnDropdownDateto(NMHDR
*pNMHDR
, LRESULT
*pResult
);
138 afx_msg
void OnSize(UINT nType
, int cx
, int cy
);
139 void OnBnClickedFirstParent();
140 afx_msg
void OnBnClickedRefresh();
141 afx_msg
void OnRefresh();
142 afx_msg
void OnFocusFilter();
143 afx_msg
void OnEditCopy();
145 virtual void OnCancel();
147 virtual BOOL
OnInitDialog();
148 virtual BOOL
PreTranslateMessage(MSG
* pMsg
);
150 void DoDiffFromLog(INT_PTR selIndex
, GitRev
*rev1
, GitRev
*rev2
, bool blame
, bool unified
);
152 DECLARE_MESSAGE_MAP()
155 CRegDWORD m_regbAllBranch
;
156 CRegDWORD m_regbShowTags
;
157 CRegDWORD m_regbShowLocalBranches
;
158 CRegDWORD m_regbShowRemoteBranches
;
159 CRegDWORD m_regbShowGravatar
;
160 CRegDWORD m_regShowWholeProject
;
162 void Refresh (bool clearfilter
= false);
163 void MoveToSameTop(CWnd
*pWndRef
, CWnd
*pWndTarget
);
164 void DoSizeV1(int delta
);
165 void DoSizeV2(int delta
);
166 void AdjustMinSize();
167 void SetSplitterRange();
168 void SetFilterCueText();
170 void CopySelectionToClipBoard();
171 void CopyChangedSelectionToClipBoard();
172 CTGitPathList
GetChangedPathsFromSelectedRevisions(bool bRelativePaths
= false, bool bUseFilter
= true);
173 void SortShownListArray();
175 void SetSortArrow(CListCtrl
* control
, int nColumn
, bool bAscending
);
176 void SortByColumn(int nSortColumn
, bool bAscending
);
178 void EnableOKButton();
180 void SaveSplitterPos();
181 bool ValidateRegexp(LPCTSTR regexp_str
, std::tr1::wregex
& pat
, bool bMatchCase
);
182 void CheckRegexpTooltip();
183 void GetChangedPaths(std::vector
<CString
>& changedpaths
, std::vector
<LogChangedPath
*>& changedlogpaths
);
185 CString
GetAbsoluteUrlFromRelativeUrl(const CString
& url
);
188 CPatchViewDlg m_patchViewdlg
;
189 void FillPatchView(bool onlySetTimer
= false);
190 CWnd
* GetPatchViewParentWnd() { return this; }
191 virtual void TogglePatchView();
192 LRESULT
OnFileListCtrlItemChanged(WPARAM
/*wparam*/, LPARAM
/*lparam*/);
193 afx_msg
void OnMoving(UINT fwSide
, LPRECT pRect
);
194 afx_msg
void OnSizing(UINT fwSide
, LPRECT pRect
);
196 virtual LRESULT
DefWindowProc(UINT message
, WPARAM wParam
, LPARAM lParam
);
199 CWnd
* m_pNotifyWindow
;
202 CString m_sRelativeRoot
;
203 CString m_sRepositoryRoot
;
204 CGitLogList m_LogList
;
205 CGitStatusListCtrl m_ChangedFileListCtrl
;
206 CFilterEdit m_cFilter
;
207 CHyperLink m_staticRef
;
208 CProgressCtrl m_LogProgress
;
211 CString m_hightlightRevision
;
213 CString m_sSelectedHash
; // set to selected commit hash on OK if appropriate
214 bool m_bSelectionMustBeContinuous
;
215 bool m_bSelectionMustBeSingle
;
221 BOOL m_bWholeProject
;
222 bool m_bFollowRenames
;
223 BOOL m_bShowUnversioned
;
225 bool m_bShowLocalBranches
;
226 bool m_bShowRemoteBranches
;
227 bool m_bShowGravatar
;
229 int m_iCompressedGraph
;
230 BOOL m_bWalkBehavior
;
232 CTGitPathList
* m_currentChangedArray
;
233 LogChangedPathArray m_CurrentFilteredChangedArray
;
234 CTGitPathList m_currentChangedPathList
;
236 bool m_bFilterWithRegex
;
239 CSplitterControl m_wndSplitter1
;
240 CSplitterControl m_wndSplitter2
;
242 CRect m_MsgViewOrigRect
;
243 CRect m_LogListOrigRect
;
246 //volatile LONG m_bNoDispUpdates;
247 CDateTimeCtrl m_DateFrom
;
248 CDateTimeCtrl m_DateTo
;
249 CComboBox m_JumpType
;
255 static int m_nSortColumnPathList
;
256 static bool m_bAscendingPathList
;
261 CToolTips m_tooltips
;
264 CImageList m_imgList
;
268 CRegHistory m_History
;
270 CGravatar m_gravatar
;
272 static UINT WM_REVSELECTED
= RegisterWindowMessage(_T("TORTOISEGit_REVSELECTED_MSG"));
273 static UINT WM_REVLIST
= RegisterWindowMessage(_T("TORTOISEGit_REVLIST_MSG"));
274 static UINT WM_REVLISTONERANGE
= RegisterWindowMessage(_T("TORTOISEGit_REVLISTONERANGE_MSG"));