1 // TortoiseGit - a Windows shell extension for easy version control
\r
3 // Copyright (C) 2003-2008 - TortoiseGit
\r
5 // This program is free software; you can redistribute it and/or
\r
6 // modify it under the terms of the GNU General Public License
\r
7 // as published by the Free Software Foundation; either version 2
\r
8 // of the License, or (at your option) any later version.
\r
10 // This program is distributed in the hope that it will be useful,
\r
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
13 // GNU General Public License for more details.
\r
15 // You should have received a copy of the GNU General Public License
\r
16 // along with this program; if not, write to the Free Software Foundation,
\r
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
\r
21 #include "resource.h"
\r
23 #include "ProjectProperties.h"
\r
24 #include "StandAloneDlg.h"
\r
25 #include "TGitPath.h"
\r
26 #include "registry.h"
\r
27 #include "SplitterControl.h"
\r
29 #include "MenuButton.h"
\r
30 #include "LogDlgHelper.h"
\r
31 #include "FilterEdit.h"
\r
33 #include "Tooltip.h"
\r
34 #include "HintListCtrl.h"
\r
36 #include "GitLogList.h"
\r
37 #include "GitStatusListCtrl.h"
\r
38 #include "HyperLink.h"
\r
40 using namespace std;
\r
43 #define MERGE_REVSELECTSTART 1
\r
44 #define MERGE_REVSELECTEND 2
\r
45 #define MERGE_REVSELECTSTARTEND 3 ///< both
\r
46 #define MERGE_REVSELECTMINUSONE 4 ///< first with N-1
\r
49 #define LOGFILTER_TIMER 101
\r
51 typedef int (__cdecl *GENERICCOMPAREFN)(const void * elem1, const void * elem2);
\r
54 * \ingroup TortoiseProc
\r
55 * Shows log messages of a single file or folder in a listbox.
\r
57 class CLogDlg : public CResizableStandAloneDialog, IFilterEditValidator
\r
59 DECLARE_DYNAMIC(CLogDlg)
\r
61 friend class CStoreSelection;
\r
64 CLogDlg(CWnd* pParent = NULL); // standard constructor
\r
75 LOGLIST_MESSAGE_MAX=250
\r
86 void SetParams(const CTGitPath& path, GitRev pegrev, GitRev startrev, GitRev endrev, int limit);
\r
87 void SetIncludeMerge(bool bInclude = true) {m_bIncludeMerges = bInclude;}
\r
88 void SetProjectPropertiesPath(const CTGitPath& path) {m_ProjectProperties.ReadProps(path);}
\r
89 bool IsThreadRunning() {return !!m_LogList.m_bThreadRunning;}
\r
90 void SetDialogTitle(const CString& sTitle) {m_sTitle = sTitle;}
\r
91 void SetSelect(bool bSelect) {m_bSelect = bSelect;}
\r
92 void ContinuousSelection(bool bCont = true) {m_bSelectionMustBeContinuous = bCont;}
\r
93 void SingleSelection(bool bSingle = true) {m_bSelectionMustBeSingle = bSingle;}
\r
94 void SetMergePath(const CTGitPath& mergepath) {m_mergePath = mergepath;}
\r
95 void SetStartRef(const CString& StartRef);
\r
96 void ShowStartRef();
\r
98 * Provides selected commit hash if available, call after OK return from here
\r
101 CString GetSelectedHash(){ return m_sSelectedHash; }
\r
103 // const GitRevRangeArray& GetSelectedRevRanges() {return m_selectedRevs;}
\r
106 enum { IDD = IDD_LOGMESSAGE };
\r
109 //implement the virtual methods from Git base class
\r
110 virtual BOOL Log(git_revnum_t rev, const CString& author, const CString& date, const CString& message, LogChangedPathArray * cpaths, int filechanges, BOOL copies, DWORD actions, BOOL haschildren);
\r
111 virtual BOOL Cancel();
\r
112 virtual bool Validate(LPCTSTR string);
\r
114 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
\r
116 afx_msg LRESULT OnFindDialogMessage(WPARAM wParam, LPARAM lParam);
\r
117 afx_msg LRESULT OnClickedInfoIcon(WPARAM wParam, LPARAM lParam);
\r
118 afx_msg LRESULT OnClickedCancelFilter(WPARAM wParam, LPARAM lParam);
\r
119 afx_msg LRESULT OnLogListLoading(WPARAM wParam, LPARAM lParam);
\r
121 afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
\r
122 afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
\r
123 afx_msg void OnBnClickedGetall();
\r
124 afx_msg void OnNMDblclkChangedFileList(NMHDR *pNMHDR, LRESULT *pResult);
\r
125 afx_msg void OnNMDblclkLoglist(NMHDR *pNMHDR, LRESULT *pResult);
\r
126 afx_msg void OnLvnItemchangedLoglist(NMHDR *pNMHDR, LRESULT *pResult);
\r
127 afx_msg void OnBnClickedHelp();
\r
128 afx_msg void OnEnLinkMsgview(NMHDR *pNMHDR, LRESULT *pResult);
\r
129 afx_msg void OnBnClickedStatbutton();
\r
131 afx_msg void OnNMCustomdrawChangedFileList(NMHDR *pNMHDR, LRESULT *pResult);
\r
132 afx_msg void OnLvnGetdispinfoChangedFileList(NMHDR *pNMHDR, LRESULT *pResult);
\r
133 afx_msg void OnEnChangeSearchedit();
\r
134 afx_msg void OnTimer(UINT_PTR nIDEvent);
\r
135 afx_msg void OnDtnDatetimechangeDateto(NMHDR *pNMHDR, LRESULT *pResult);
\r
136 afx_msg void OnDtnDatetimechangeDatefrom(NMHDR *pNMHDR, LRESULT *pResult);
\r
137 afx_msg void OnLvnColumnclick(NMHDR *pNMHDR, LRESULT *pResult);
\r
138 afx_msg void OnLvnColumnclickChangedFileList(NMHDR *pNMHDR, LRESULT *pResult);
\r
139 afx_msg void OnBnClickShowWholeProject();
\r
140 afx_msg void OnBnClickedHidepaths();
\r
141 afx_msg void OnBnClickedAllBranch();
\r
142 afx_msg void OnBnClickedBrowseRef();
\r
143 afx_msg void OnBnClickedCheckStoponcopy();
\r
145 afx_msg void OnDtnDropdownDatefrom(NMHDR *pNMHDR, LRESULT *pResult);
\r
146 afx_msg void OnDtnDropdownDateto(NMHDR *pNMHDR, LRESULT *pResult);
\r
147 afx_msg void OnSize(UINT nType, int cx, int cy);
\r
148 afx_msg void OnBnClickedFirstParent();
\r
149 afx_msg void OnBnClickedRefresh();
\r
150 afx_msg void OnRefresh();
\r
151 afx_msg void OnFind();
\r
152 afx_msg void OnFocusFilter();
\r
153 afx_msg void OnEditCopy();
\r
155 virtual void OnCancel();
\r
156 virtual void OnOK();
\r
157 virtual BOOL OnInitDialog();
\r
158 virtual BOOL PreTranslateMessage(MSG* pMsg);
\r
160 void FillLogMessageCtrl(bool bShow = true);
\r
161 void DoDiffFromLog(INT_PTR selIndex, GitRev *rev1, GitRev *rev2, bool blame, bool unified);
\r
163 static void LogCallBack(void *data, int cur){((CLogDlg*)data)->LogRunStatus(cur);}
\r
164 void LogRunStatus(int cur);
\r
166 DECLARE_MESSAGE_MAP()
\r
171 void Refresh (bool autoGoOnline = false);
\r
172 BOOL IsDiffPossible(LogChangedPath * changedpath, git_revnum_t rev);
\r
173 BOOL Open(bool bOpenWith, CString changedpath, git_revnum_t rev);
\r
174 void EditAuthor(const CLogDataVector& logs);
\r
175 void EditLogMessage(int index);
\r
176 void DoSizeV1(int delta);
\r
177 void DoSizeV2(int delta);
\r
178 void AdjustMinSize();
\r
179 void SetSplitterRange();
\r
180 void SetFilterCueText();
\r
182 void CopySelectionToClipBoard();
\r
183 void CopyChangedSelectionToClipBoard();
\r
184 CTGitPathList GetChangedPathsFromSelectedRevisions(bool bRelativePaths = false, bool bUseFilter = true);
\r
185 void SortShownListArray();
\r
187 void SetSortArrow(CListCtrl * control, int nColumn, bool bAscending);
\r
188 void SortByColumn(int nSortColumn, bool bAscending);
\r
190 void EnableOKButton();
\r
191 void GetAll(bool bIsShowProjectOrBranch = false);
\r
192 void UpdateLogInfoLabel();
\r
193 void SaveSplitterPos();
\r
194 bool ValidateRegexp(LPCTSTR regexp_str, tr1::wregex& pat, bool bMatchCase);
\r
195 void CheckRegexpTooltip();
\r
196 void GetChangedPaths(std::vector<CString>& changedpaths, std::vector<LogChangedPath*>& changedlogpaths);
\r
197 void DiffSelectedFile();
\r
198 void DiffSelectedRevWithPrevious();
\r
199 void SetDlgTitle(bool bOffline);
\r
200 CString GetAbsoluteUrlFromRelativeUrl(const CString& url);
\r
203 * Extracts part of commit message suitable for displaying in revision list.
\r
205 CString MakeShortMessage(const CString& message);
\r
206 // inline int ShownCountWithStopped() const { return (int)m_arShownList.GetCount() + (m_bStrictStopped ? 1 : 0); }
\r
209 virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);
\r
210 static int __cdecl SortCompare(const void * pElem1, const void * pElem2); ///< sort callback function
\r
212 void ShowContextMenuForRevisions(CWnd* pWnd, CPoint point);
\r
213 void ShowContextMenuForChangedpaths(CWnd* pWnd, CPoint point);
\r
215 CWnd * m_pNotifyWindow;
\r
216 ProjectProperties m_ProjectProperties;
\r
219 //HFONT m_boldFont;
\r
220 CString m_sRelativeRoot;
\r
221 CString m_sRepositoryRoot;
\r
222 CString m_sSelfRelativeURL;
\r
224 CString m_sUUID; ///< empty if the log cache is not used
\r
225 CGitLogList m_LogList;
\r
226 CGitStatusListCtrl m_ChangedFileListCtrl;
\r
227 CFilterEdit m_cFilter;
\r
228 CHyperLink m_staticRef;
\r
229 CProgressCtrl m_LogProgress;
\r
230 CMenuButton m_btnShow;
\r
231 CMenuButton m_btnShowWholeProject;
\r
233 CTGitPath m_mergePath;
\r
236 GitRev m_LogRevision;
\r
239 // GitRevRangeArray m_selectedRevs;
\r
240 // GitRevRangeArray m_selectedRevsOneRange;
\r
241 CString m_sSelectedHash; // set to selected commit hash on OK if appropriate
\r
242 bool m_bSelectionMustBeContinuous;
\r
243 bool m_bSelectionMustBeSingle;
\r
247 BOOL m_bIncludeMerges;
\r
248 BOOL m_bFirstParent;
\r
250 BOOL m_bWholeProject;
\r
252 git_revnum_t m_lowestRev;
\r
253 CTGitPathList * m_currentChangedArray;
\r
254 LogChangedPathArray m_CurrentFilteredChangedArray;
\r
255 CTGitPathList m_currentChangedPathList;
\r
256 //CPtrArray m_arShownList;
\r
258 int m_nSearchIndex;
\r
259 bool m_bFilterWithRegex;
\r
260 static const UINT m_FindDialogMessage;
\r
261 CFindReplaceDialog *m_pFindDialog;
\r
263 CString m_sMessageBuf;
\r
264 CSplitterControl m_wndSplitter1;
\r
265 CSplitterControl m_wndSplitter2;
\r
266 CRect m_DlgOrigRect;
\r
267 CRect m_MsgViewOrigRect;
\r
268 CRect m_LogListOrigRect;
\r
269 CRect m_ChgOrigRect;
\r
270 // CString m_sFilterText;
\r
272 //volatile LONG m_bNoDispUpdates;
\r
273 CDateTimeCtrl m_DateFrom;
\r
274 CDateTimeCtrl m_DateTo;
\r
276 int m_limitcounter;
\r
279 static int m_nSortColumnPathList;
\r
280 static bool m_bAscendingPathList;
\r
281 //CRegDWORD m_regMaxBugIDColWidth;
\r
282 CButton m_cHidePaths;
\r
286 bool m_bShowBugtraqColumn;
\r
287 CString m_sLogInfo;
\r
288 std::set<git_revnum_t> m_mergedRevs;
\r
290 CToolTips m_tooltips;
\r
293 CImageList m_imgList;
\r
295 HICON m_hModifiedIcon;
\r
296 HICON m_hReplacedIcon;
\r
297 HICON m_hAddedIcon;
\r
298 HICON m_hDeletedIcon;
\r
301 DWORD m_childCounter;
\r
311 static UINT WM_REVSELECTED = RegisterWindowMessage(_T("TORTOISEGit_REVSELECTED_MSG"));
\r
312 static UINT WM_REVLIST = RegisterWindowMessage(_T("TORTOISEGit_REVLIST_MSG"));
\r
313 static UINT WM_REVLISTONERANGE = RegisterWindowMessage(_T("TORTOISEGit_REVLISTONERANGE_MSG"));
\r