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 "ProjectProperties.h"
25 #include "StandAloneDlg.h"
28 #include "SplitterControl.h"
30 #include "MenuButton.h"
31 #include "LogDlgHelper.h"
32 #include "FilterEdit.h"
35 #include "HintListCtrl.h"
37 #include "GitLogList.h"
38 #include "GitStatusListCtrl.h"
39 #include "HyperLink.h"
45 #define LOGFILTER_TIMER 101
46 #define LOGFTIME_TIMER 102
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
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 SetDialogTitle(const CString
& sTitle
) {m_sTitle
= sTitle
;}
67 void SetSelect(bool bSelect
) {m_bSelect
= bSelect
;}
68 void ContinuousSelection(bool bCont
= true) {m_bSelectionMustBeContinuous
= bCont
;}
69 void SingleSelection(bool bSingle
= true) {m_bSelectionMustBeSingle
= bSingle
;}
70 void SetRange(const CString
& range
);
72 afx_msg LRESULT
OnRefLogChanged(WPARAM wParam
, LPARAM lParam
);
74 * Provides selected commit hash if available, call after OK return from here
77 CString
GetSelectedHash(){ return m_sSelectedHash
; }
80 enum { IDD
= IDD_LOGMESSAGE
};
82 void FillLogMessageCtrl(bool bShow
= true);
83 CString
GetTagInfo(GitRev
* pLogEntry
);
85 void UpdateLogInfoLabel();
92 //implement the virtual methods from Git base class
93 virtual BOOL
Cancel();
94 virtual bool Validate(LPCTSTR string
);
96 virtual void DoDataExchange(CDataExchange
* pDX
); // DDX/DDV support
98 afx_msg LRESULT
OnTaskbarBtnCreated(WPARAM wParam
, LPARAM lParam
);
99 CComPtr
<ITaskbarList3
> m_pTaskbarList
;
101 afx_msg LRESULT
OnClickedInfoIcon(WPARAM wParam
, LPARAM lParam
);
102 afx_msg LRESULT
OnClickedCancelFilter(WPARAM wParam
, LPARAM lParam
);
103 afx_msg LRESULT
OnLogListLoading(WPARAM wParam
, LPARAM lParam
);
105 afx_msg BOOL
OnSetCursor(CWnd
* pWnd
, UINT nHitTest
, UINT message
);
106 afx_msg
void OnContextMenu(CWnd
* pWnd
, CPoint point
);
107 afx_msg
void OnNMDblclkLoglist(NMHDR
*pNMHDR
, LRESULT
*pResult
);
108 afx_msg
void OnLvnItemchangedLoglist(NMHDR
*pNMHDR
, LRESULT
*pResult
);
109 afx_msg
void OnBnClickedHelp();
110 afx_msg
void OnEnLinkMsgview(NMHDR
*pNMHDR
, LRESULT
*pResult
);
111 afx_msg
void OnBnClickedStatbutton();
113 afx_msg
void OnNMCustomdrawChangedFileList(NMHDR
*pNMHDR
, LRESULT
*pResult
);
114 afx_msg
void OnLvnGetdispinfoChangedFileList(NMHDR
*pNMHDR
, LRESULT
*pResult
);
115 afx_msg
void OnEnChangeSearchedit();
116 afx_msg
void OnTimer(UINT_PTR nIDEvent
);
117 afx_msg
void OnDtnDatetimechangeDateto(NMHDR
*pNMHDR
, LRESULT
*pResult
);
118 afx_msg
void OnDtnDatetimechangeDatefrom(NMHDR
*pNMHDR
, LRESULT
*pResult
);
119 afx_msg
void OnCbnSelchangeJumpType();
120 afx_msg
void OnBnClickedJumpUp();
121 afx_msg
void OnBnClickedJumpDown();
122 afx_msg
void OnLvnColumnclick(NMHDR
*pNMHDR
, LRESULT
*pResult
);
123 afx_msg
void OnBnClickShowWholeProject();
124 afx_msg
void OnBnClickedHidepaths();
125 afx_msg
void OnBnClickedAllBranch();
126 afx_msg
void OnBnClickedFollowRenames();
127 afx_msg
void OnBnClickedShowTags();
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 afx_msg
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
;
153 void Refresh (bool clearfilter
= false);
154 void DoSizeV1(int delta
);
155 void DoSizeV2(int delta
);
156 void AdjustMinSize();
157 void SetSplitterRange();
158 void SetFilterCueText();
160 void CopySelectionToClipBoard();
161 void CopyChangedSelectionToClipBoard();
162 CTGitPathList
GetChangedPathsFromSelectedRevisions(bool bRelativePaths
= false, bool bUseFilter
= true);
163 void SortShownListArray();
165 void SetSortArrow(CListCtrl
* control
, int nColumn
, bool bAscending
);
166 void SortByColumn(int nSortColumn
, bool bAscending
);
168 void EnableOKButton();
170 void SaveSplitterPos();
171 bool ValidateRegexp(LPCTSTR regexp_str
, tr1::wregex
& pat
, bool bMatchCase
);
172 void CheckRegexpTooltip();
173 void GetChangedPaths(std::vector
<CString
>& changedpaths
, std::vector
<LogChangedPath
*>& changedlogpaths
);
175 CString
GetAbsoluteUrlFromRelativeUrl(const CString
& url
);
178 virtual LRESULT
DefWindowProc(UINT message
, WPARAM wParam
, LPARAM lParam
);
181 CWnd
* m_pNotifyWindow
;
184 CString m_sRelativeRoot
;
185 CString m_sRepositoryRoot
;
186 CGitLogList m_LogList
;
187 CGitStatusListCtrl m_ChangedFileListCtrl
;
188 CFilterEdit m_cFilter
;
189 CHyperLink m_staticRef
;
190 CProgressCtrl m_LogProgress
;
191 CMenuButton m_btnShowWholeProject
;
194 CString m_hightlightRevision
;
196 CString m_sSelectedHash
; // set to selected commit hash on OK if appropriate
197 bool m_bSelectionMustBeContinuous
;
198 bool m_bSelectionMustBeSingle
;
203 BOOL m_bWholeProject
;
204 BOOL m_bFollowRenames
;
205 BOOL m_bShowUnversioned
;
208 CTGitPathList
* m_currentChangedArray
;
209 LogChangedPathArray m_CurrentFilteredChangedArray
;
210 CTGitPathList m_currentChangedPathList
;
212 bool m_bFilterWithRegex
;
215 CSplitterControl m_wndSplitter1
;
216 CSplitterControl m_wndSplitter2
;
218 CRect m_MsgViewOrigRect
;
219 CRect m_LogListOrigRect
;
222 //volatile LONG m_bNoDispUpdates;
223 CDateTimeCtrl m_DateFrom
;
224 CDateTimeCtrl m_DateTo
;
225 CComboBox m_JumpType
;
231 static int m_nSortColumnPathList
;
232 static bool m_bAscendingPathList
;
233 CButton m_cHidePaths
;
238 CToolTips m_tooltips
;
241 CImageList m_imgList
;
245 static UINT WM_REVSELECTED
= RegisterWindowMessage(_T("TORTOISEGit_REVSELECTED_MSG"));
246 static UINT WM_REVLIST
= RegisterWindowMessage(_T("TORTOISEGit_REVLIST_MSG"));
247 static UINT WM_REVLISTONERANGE
= RegisterWindowMessage(_T("TORTOISEGit_REVLISTONERANGE_MSG"));