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 SetDialogTitle(const CString
& sTitle
) {m_sTitle
= sTitle
;}
65 void SetSelect(bool bSelect
) {m_bSelect
= bSelect
;}
66 void ContinuousSelection(bool bCont
= true) {m_bSelectionMustBeContinuous
= bCont
;}
67 void SingleSelection(bool bSingle
= true) {m_bSelectionMustBeSingle
= bSingle
;}
68 void SetRange(const CString
& range
);
70 afx_msg LRESULT
OnRefLogChanged(WPARAM wParam
, LPARAM lParam
);
72 * Provides selected commit hash if available, call after OK return from here
75 CString
GetSelectedHash(){ return m_sSelectedHash
; }
78 enum { IDD
= IDD_LOGMESSAGE
};
80 void FillLogMessageCtrl(bool bShow
= true);
81 CString
GetTagInfo(GitRev
* pLogEntry
);
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
OnClickedInfoIcon(WPARAM wParam
, LPARAM lParam
);
100 afx_msg LRESULT
OnClickedCancelFilter(WPARAM wParam
, LPARAM lParam
);
101 afx_msg LRESULT
OnLogListLoading(WPARAM wParam
, LPARAM lParam
);
103 afx_msg BOOL
OnSetCursor(CWnd
* pWnd
, UINT nHitTest
, UINT message
);
104 afx_msg
void OnContextMenu(CWnd
* pWnd
, CPoint point
);
105 afx_msg
void OnNMDblclkLoglist(NMHDR
*pNMHDR
, LRESULT
*pResult
);
106 afx_msg
void OnLvnItemchangedLoglist(NMHDR
*pNMHDR
, LRESULT
*pResult
);
107 afx_msg
void OnLvnItemchangedLogmsg(NMHDR
*pNMHDR
, LRESULT
*pResult
);
108 afx_msg
void OnEnLinkMsgview(NMHDR
*pNMHDR
, LRESULT
*pResult
);
109 afx_msg
void OnBnClickedStatbutton();
111 afx_msg
void OnNMCustomdrawChangedFileList(NMHDR
*pNMHDR
, LRESULT
*pResult
);
112 afx_msg
void OnLvnGetdispinfoChangedFileList(NMHDR
*pNMHDR
, LRESULT
*pResult
);
113 afx_msg
void OnEnChangeSearchedit();
114 afx_msg
void OnTimer(UINT_PTR nIDEvent
);
115 afx_msg
void OnDtnDatetimechangeDateto(NMHDR
*pNMHDR
, LRESULT
*pResult
);
116 afx_msg
void OnDtnDatetimechangeDatefrom(NMHDR
*pNMHDR
, LRESULT
*pResult
);
117 afx_msg
void OnCbnSelchangeJumpType();
118 afx_msg
void OnBnClickedJumpUp();
119 afx_msg
void OnBnClickedJumpDown();
120 afx_msg
void OnLvnColumnclick(NMHDR
*pNMHDR
, LRESULT
*pResult
);
121 afx_msg
void OnBnClickShowWholeProject();
122 afx_msg
void OnBnClickedHidepaths();
123 afx_msg
void OnBnClickedAllBranch();
124 afx_msg
void OnBnClickedFollowRenames();
125 afx_msg
void OnBnClickedShowTags();
126 afx_msg
void OnBnClickedBrowseRef();
128 afx_msg
void OnDtnDropdownDatefrom(NMHDR
*pNMHDR
, LRESULT
*pResult
);
129 afx_msg
void OnDtnDropdownDateto(NMHDR
*pNMHDR
, LRESULT
*pResult
);
130 afx_msg
void OnSize(UINT nType
, int cx
, int cy
);
131 afx_msg
void OnBnClickedFirstParent();
132 afx_msg
void OnBnClickedRefresh();
133 afx_msg
void OnBnClickedDownAuthor();
134 afx_msg
void OnRefresh();
135 afx_msg
void OnFocusFilter();
136 afx_msg
void OnEditCopy();
138 virtual void OnCancel();
140 virtual BOOL
OnInitDialog();
141 virtual BOOL
PreTranslateMessage(MSG
* pMsg
);
143 void DoDiffFromLog(INT_PTR selIndex
, GitRev
*rev1
, GitRev
*rev2
, bool blame
, bool unified
);
145 DECLARE_MESSAGE_MAP()
148 CRegDWORD m_regbAllBranch
;
149 CRegDWORD m_regbShowTags
;
151 void Refresh (bool clearfilter
= false);
152 void MoveToSameTop(CWnd
*pWndRef
, CWnd
*pWndTarget
);
153 void DoSizeV1(int delta
);
154 void DoSizeV2(int delta
);
155 void AdjustMinSize();
156 void SetSplitterRange();
157 void SetFilterCueText();
159 void CopySelectionToClipBoard();
160 void CopyChangedSelectionToClipBoard();
161 CTGitPathList
GetChangedPathsFromSelectedRevisions(bool bRelativePaths
= false, bool bUseFilter
= true);
162 void SortShownListArray();
164 void SetSortArrow(CListCtrl
* control
, int nColumn
, bool bAscending
);
165 void SortByColumn(int nSortColumn
, bool bAscending
);
167 void EnableOKButton();
169 void SaveSplitterPos();
170 bool ValidateRegexp(LPCTSTR regexp_str
, std::tr1::wregex
& pat
, bool bMatchCase
);
171 void CheckRegexpTooltip();
172 void GetChangedPaths(std::vector
<CString
>& changedpaths
, std::vector
<LogChangedPath
*>& changedlogpaths
);
174 CString
GetAbsoluteUrlFromRelativeUrl(const CString
& url
);
177 virtual LRESULT
DefWindowProc(UINT message
, WPARAM wParam
, LPARAM lParam
);
180 CWnd
* m_pNotifyWindow
;
183 CString m_sRelativeRoot
;
184 CString m_sRepositoryRoot
;
185 CGitLogList m_LogList
;
186 CGitStatusListCtrl m_ChangedFileListCtrl
;
187 CFilterEdit m_cFilter
;
188 CHyperLink m_staticRef
;
189 CProgressCtrl m_LogProgress
;
190 CMenuButton m_btnShowWholeProject
;
193 CString m_hightlightRevision
;
195 CString m_sSelectedHash
; // set to selected commit hash on OK if appropriate
196 bool m_bSelectionMustBeContinuous
;
197 bool m_bSelectionMustBeSingle
;
202 BOOL m_bWholeProject
;
203 BOOL m_bFollowRenames
;
204 BOOL m_bShowUnversioned
;
207 CTGitPathList
* m_currentChangedArray
;
208 LogChangedPathArray m_CurrentFilteredChangedArray
;
209 CTGitPathList m_currentChangedPathList
;
211 bool m_bFilterWithRegex
;
214 CSplitterControl m_wndSplitter1
;
215 CSplitterControl m_wndSplitter2
;
217 CRect m_MsgViewOrigRect
;
218 CRect m_LogListOrigRect
;
221 //volatile LONG m_bNoDispUpdates;
222 CDateTimeCtrl m_DateFrom
;
223 CDateTimeCtrl m_DateTo
;
224 CComboBox m_JumpType
;
230 static int m_nSortColumnPathList
;
231 static bool m_bAscendingPathList
;
232 CButton m_cHidePaths
;
237 CToolTips m_tooltips
;
240 CImageList m_imgList
;
244 CGravatar m_gravatar
;
246 static UINT WM_REVSELECTED
= RegisterWindowMessage(_T("TORTOISEGit_REVSELECTED_MSG"));
247 static UINT WM_REVLIST
= RegisterWindowMessage(_T("TORTOISEGit_REVLIST_MSG"));
248 static UINT WM_REVLISTONERANGE
= RegisterWindowMessage(_T("TORTOISEGit_REVLISTONERANGE_MSG"));