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.
24 #include "StandAloneDlg.h"
27 #include "SplitterControl.h"
29 #include "MenuButton.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"
43 #define LOGFILTER_TIMER 101
44 #define LOGFTIME_TIMER 102
46 typedef int (__cdecl
*GENERICCOMPAREFN
)(const void * elem1
, const void * elem2
);
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
;
59 CLogDlg(CWnd
* pParent
= NULL
); // standard constructor
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
);
69 afx_msg LRESULT
OnRefLogChanged(WPARAM wParam
, LPARAM lParam
);
71 * Provides selected commit hash if available, call after OK return from here
74 CString
GetSelectedHash(){ return m_sSelectedHash
; }
77 enum { IDD
= IDD_LOGMESSAGE
};
79 void FillLogMessageCtrl(bool bShow
= true);
80 CString
GetTagInfo(GitRev
* pLogEntry
);
82 void UpdateLogInfoLabel();
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 OnBnClickedDownAuthor();
136 afx_msg
void OnRefresh();
137 afx_msg
void OnFocusFilter();
138 afx_msg
void OnEditCopy();
140 virtual void OnCancel();
142 virtual BOOL
OnInitDialog();
143 virtual BOOL
PreTranslateMessage(MSG
* pMsg
);
145 void DoDiffFromLog(INT_PTR selIndex
, GitRev
*rev1
, GitRev
*rev2
, bool blame
, bool unified
);
147 DECLARE_MESSAGE_MAP()
150 CRegDWORD m_regbAllBranch
;
151 CRegDWORD m_regbShowTags
;
152 CRegDWORD m_regbShowLocalBranches
;
153 CRegDWORD m_regbShowRemoteBranches
;
154 CRegDWORD m_regbShowGravatar
;
156 void Refresh (bool clearfilter
= false);
157 void MoveToSameTop(CWnd
*pWndRef
, CWnd
*pWndTarget
);
158 void DoSizeV1(int delta
);
159 void DoSizeV2(int delta
);
160 void AdjustMinSize();
161 void SetSplitterRange();
162 void SetFilterCueText();
164 void CopySelectionToClipBoard();
165 void CopyChangedSelectionToClipBoard();
166 CTGitPathList
GetChangedPathsFromSelectedRevisions(bool bRelativePaths
= false, bool bUseFilter
= true);
167 void SortShownListArray();
169 void SetSortArrow(CListCtrl
* control
, int nColumn
, bool bAscending
);
170 void SortByColumn(int nSortColumn
, bool bAscending
);
172 void EnableOKButton();
174 void SaveSplitterPos();
175 bool ValidateRegexp(LPCTSTR regexp_str
, std::tr1::wregex
& pat
, bool bMatchCase
);
176 void CheckRegexpTooltip();
177 void GetChangedPaths(std::vector
<CString
>& changedpaths
, std::vector
<LogChangedPath
*>& changedlogpaths
);
179 CString
GetAbsoluteUrlFromRelativeUrl(const CString
& url
);
183 virtual LRESULT
DefWindowProc(UINT message
, WPARAM wParam
, LPARAM lParam
);
186 CWnd
* m_pNotifyWindow
;
189 CString m_sRelativeRoot
;
190 CString m_sRepositoryRoot
;
191 CGitLogList m_LogList
;
192 CGitStatusListCtrl m_ChangedFileListCtrl
;
193 CFilterEdit m_cFilter
;
194 CHyperLink m_staticRef
;
195 CProgressCtrl m_LogProgress
;
196 CMenuButton m_btnShowWholeProject
;
199 CString m_hightlightRevision
;
201 CString m_sSelectedHash
; // set to selected commit hash on OK if appropriate
202 bool m_bSelectionMustBeContinuous
;
203 bool m_bSelectionMustBeSingle
;
209 BOOL m_bWholeProject
;
210 BOOL m_bFollowRenames
;
211 BOOL m_bShowUnversioned
;
213 bool m_bShowLocalBranches
;
214 bool m_bShowRemoteBranches
;
215 bool m_bShowGravatar
;
216 bool m_bCompressedGraph
;
218 CTGitPathList
* m_currentChangedArray
;
219 LogChangedPathArray m_CurrentFilteredChangedArray
;
220 CTGitPathList m_currentChangedPathList
;
222 bool m_bFilterWithRegex
;
225 CSplitterControl m_wndSplitter1
;
226 CSplitterControl m_wndSplitter2
;
228 CRect m_MsgViewOrigRect
;
229 CRect m_LogListOrigRect
;
232 //volatile LONG m_bNoDispUpdates;
233 CDateTimeCtrl m_DateFrom
;
234 CDateTimeCtrl m_DateTo
;
235 CComboBox m_JumpType
;
241 static int m_nSortColumnPathList
;
242 static bool m_bAscendingPathList
;
247 CToolTips m_tooltips
;
250 CImageList m_imgList
;
254 CGravatar m_gravatar
;
256 static UINT WM_REVSELECTED
= RegisterWindowMessage(_T("TORTOISEGit_REVSELECTED_MSG"));
257 static UINT WM_REVLIST
= RegisterWindowMessage(_T("TORTOISEGit_REVLIST_MSG"));
258 static UINT WM_REVLISTONERANGE
= RegisterWindowMessage(_T("TORTOISEGit_REVLISTONERANGE_MSG"));