1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2003-2008 - TortoiseSVN
4 // Copyright (C) 2008-2012 - 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 startrev
, CString endrev
, 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 SetStartRef(const CString
& StartRef
);
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 OnLvnColumnclick(NMHDR
*pNMHDR
, LRESULT
*pResult
);
120 afx_msg
void OnBnClickShowWholeProject();
121 afx_msg
void OnBnClickedHidepaths();
122 afx_msg
void OnBnClickedAllBranch();
123 afx_msg
void OnBnClickedFollowRenames();
124 afx_msg
void OnBnClickedBrowseRef();
126 afx_msg
void OnDtnDropdownDatefrom(NMHDR
*pNMHDR
, LRESULT
*pResult
);
127 afx_msg
void OnDtnDropdownDateto(NMHDR
*pNMHDR
, LRESULT
*pResult
);
128 afx_msg
void OnSize(UINT nType
, int cx
, int cy
);
129 afx_msg
void OnBnClickedFirstParent();
130 afx_msg
void OnBnClickedRefresh();
131 afx_msg
void OnRefresh();
132 afx_msg
void OnFocusFilter();
133 afx_msg
void OnEditCopy();
135 virtual void OnCancel();
137 virtual BOOL
OnInitDialog();
138 virtual BOOL
PreTranslateMessage(MSG
* pMsg
);
140 void DoDiffFromLog(INT_PTR selIndex
, GitRev
*rev1
, GitRev
*rev2
, bool blame
, bool unified
);
142 DECLARE_MESSAGE_MAP()
145 CRegDWORD m_regbAllBranch
;
147 void Refresh (bool clearfilter
= false);
148 void DoSizeV1(int delta
);
149 void DoSizeV2(int delta
);
150 void AdjustMinSize();
151 void SetSplitterRange();
152 void SetFilterCueText();
154 void CopySelectionToClipBoard();
155 void CopyChangedSelectionToClipBoard();
156 CTGitPathList
GetChangedPathsFromSelectedRevisions(bool bRelativePaths
= false, bool bUseFilter
= true);
157 void SortShownListArray();
159 void SetSortArrow(CListCtrl
* control
, int nColumn
, bool bAscending
);
160 void SortByColumn(int nSortColumn
, bool bAscending
);
162 void EnableOKButton();
164 void SaveSplitterPos();
165 bool ValidateRegexp(LPCTSTR regexp_str
, tr1::wregex
& pat
, bool bMatchCase
);
166 void CheckRegexpTooltip();
167 void GetChangedPaths(std::vector
<CString
>& changedpaths
, std::vector
<LogChangedPath
*>& changedlogpaths
);
169 CString
GetAbsoluteUrlFromRelativeUrl(const CString
& url
);
172 virtual LRESULT
DefWindowProc(UINT message
, WPARAM wParam
, LPARAM lParam
);
175 CWnd
* m_pNotifyWindow
;
178 CString m_sRelativeRoot
;
179 CString m_sRepositoryRoot
;
180 CGitLogList m_LogList
;
181 CGitStatusListCtrl m_ChangedFileListCtrl
;
182 CFilterEdit m_cFilter
;
183 CHyperLink m_staticRef
;
184 CProgressCtrl m_LogProgress
;
185 CMenuButton m_btnShowWholeProject
;
188 CString m_hightlightRevision
;
190 CString m_LogRevision
;
192 CString m_sSelectedHash
; // set to selected commit hash on OK if appropriate
193 bool m_bSelectionMustBeContinuous
;
194 bool m_bSelectionMustBeSingle
;
199 BOOL m_bWholeProject
;
200 BOOL m_bFollowRenames
;
201 BOOL m_bShowUnversioned
;
203 CTGitPathList
* m_currentChangedArray
;
204 LogChangedPathArray m_CurrentFilteredChangedArray
;
205 CTGitPathList m_currentChangedPathList
;
207 bool m_bFilterWithRegex
;
210 CSplitterControl m_wndSplitter1
;
211 CSplitterControl m_wndSplitter2
;
213 CRect m_MsgViewOrigRect
;
214 CRect m_LogListOrigRect
;
217 //volatile LONG m_bNoDispUpdates;
218 CDateTimeCtrl m_DateFrom
;
219 CDateTimeCtrl m_DateTo
;
223 static int m_nSortColumnPathList
;
224 static bool m_bAscendingPathList
;
225 CButton m_cHidePaths
;
230 CToolTips m_tooltips
;
233 CImageList m_imgList
;
237 static UINT WM_REVSELECTED
= RegisterWindowMessage(_T("TORTOISEGit_REVSELECTED_MSG"));
238 static UINT WM_REVLIST
= RegisterWindowMessage(_T("TORTOISEGit_REVLIST_MSG"));
239 static UINT WM_REVLISTONERANGE
= RegisterWindowMessage(_T("TORTOISEGit_REVLISTONERANGE_MSG"));