Fixed issue #1076: Error trying to delete remote branch named 1.0.0
[TortoiseGit.git] / src / TortoiseProc / LogDlg.h
blob196838a26962eb8c769e931cad529ac4b4cf0464
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.
20 #pragma once
22 #include "resource.h"
23 #include "Git.h"
24 #include "ProjectProperties.h"
25 #include "StandAloneDlg.h"
26 #include "TGitPath.h"
27 #include "registry.h"
28 #include "SplitterControl.h"
29 #include "Colors.h"
30 #include "MenuButton.h"
31 #include "LogDlgHelper.h"
32 #include "FilterEdit.h"
33 #include "GitRev.h"
34 #include "Tooltip.h"
35 #include "HintListCtrl.h"
36 #include <regex>
37 #include "GitLogList.h"
38 #include "GitStatusListCtrl.h"
39 #include "HyperLink.h"
40 #include "Win7.h"
42 using namespace std;
45 #define LOGFILTER_TIMER 101
46 #define LOGFTIME_TIMER 102
48 typedef int (__cdecl *GENERICCOMPAREFN)(const void * elem1, const void * elem2);
50 /**
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;
60 public:
61 CLogDlg(CWnd* pParent = NULL); // standard constructor
62 virtual ~CLogDlg();
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);
71 void ShowStartRef();
72 afx_msg LRESULT OnRefLogChanged(WPARAM wParam, LPARAM lParam);
73 /**
74 * Provides selected commit hash if available, call after OK return from here
75 * Empty if none
76 **/
77 CString GetSelectedHash(){ return m_sSelectedHash; }
79 // Dialog Data
80 enum { IDD = IDD_LOGMESSAGE };
82 void FillLogMessageCtrl(bool bShow = true);
83 CString GetTagInfo(GitRev* pLogEntry);
85 void UpdateLogInfoLabel();
87 afx_msg void OnFind()
89 m_LogList.OnFind();
91 protected:
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();
136 virtual void OnOK();
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()
144 private:
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);
168 void SetDlgTitle();
169 CString GetAbsoluteUrlFromRelativeUrl(const CString& url);
172 virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);
174 public:
175 CWnd * m_pNotifyWindow;
176 WORD m_wParam;
177 private:
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;
186 CTGitPath m_path;
187 CTGitPath m_orgPath;
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;
195 bool m_bCancelled;
197 BOOL m_bFirstParent;
198 BOOL m_bAllBranch;
199 BOOL m_bWholeProject;
200 BOOL m_bFollowRenames;
202 CTGitPathList * m_currentChangedArray;
203 LogChangedPathArray m_CurrentFilteredChangedArray;
204 CTGitPathList m_currentChangedPathList;
206 bool m_bFilterWithRegex;
208 CFont m_logFont;
209 CSplitterControl m_wndSplitter1;
210 CSplitterControl m_wndSplitter2;
211 CRect m_DlgOrigRect;
212 CRect m_MsgViewOrigRect;
213 CRect m_LogListOrigRect;
214 CRect m_ChgOrigRect;
216 //volatile LONG m_bNoDispUpdates;
217 CDateTimeCtrl m_DateFrom;
218 CDateTimeCtrl m_DateTo;
219 int m_limit;
220 int m_nSortColumn;
221 bool m_bAscending;
222 static int m_nSortColumnPathList;
223 static bool m_bAscendingPathList;
224 CButton m_cHidePaths;
225 CString m_sTitle;
226 bool m_bSelect;
227 CString m_sLogInfo;
229 CToolTips m_tooltips;
231 CColors m_Colors;
232 CImageList m_imgList;
234 HACCEL m_hAccel;
236 static UINT WM_REVSELECTED = RegisterWindowMessage(_T("TORTOISEGit_REVSELECTED_MSG"));
237 static UINT WM_REVLIST = RegisterWindowMessage(_T("TORTOISEGit_REVLIST_MSG"));
238 static UINT WM_REVLISTONERANGE = RegisterWindowMessage(_T("TORTOISEGit_REVLISTONERANGE_MSG"));