RebaseDlg: Implement Pick squash and edit by context menu
[TortoiseGit.git] / src / TortoiseProc / GitLogListBase.h
bloba7af487a2bf802a497319a2a6f87ce828ac2986e
1 #pragma once
3 #include "HintListCtrl.h"
4 #include "XPTheme.h"
5 #include "CommonResource.h"
6 #include "Git.h"
7 #include "ProjectProperties.h"
8 #include "TGitPath.h"
9 #include "registry.h"
10 #include "SplitterControl.h"
11 #include "Colors.h"
12 #include "MenuButton.h"
13 #include "LogDlgHelper.h"
14 #include "FilterEdit.h"
15 #include "GitRev.h"
16 #include "Tooltip.h"
17 #include "HintListCtrl.h"
18 //#include "GitLogList.h"
19 #include "lanes.h"
20 #include "GitLogCache.h"
21 #include <regex>
22 // CGitLogList
23 #if (NTDDI_VERSION < NTDDI_LONGHORN)
25 enum LISTITEMSTATES_MINE {
26 LISS_NORMAL = 1,
27 LISS_HOT = 2,
28 LISS_SELECTED = 3,
29 LISS_DISABLED = 4,
30 LISS_SELECTEDNOTFOCUS = 5,
31 LISS_HOTSELECTED = 6,
34 #define MCS_NOTRAILINGDATES 0x0040
35 #define MCS_SHORTDAYSOFWEEK 0x0080
36 #define MCS_NOSELCHANGEONNAV 0x0100
38 #define DTM_SETMCSTYLE (DTM_FIRST + 11)
40 #endif
42 #define ICONITEMBORDER 5
44 #define GITLOG_START 0
45 #define GITLOG_START_ALL 1
46 #define GITLOG_END 100
48 #define LOGFILTER_ALL 1
49 #define LOGFILTER_MESSAGES 2
50 #define LOGFILTER_PATHS 3
51 #define LOGFILTER_AUTHORS 4
52 #define LOGFILTER_REVS 5
53 #define LOGFILTER_REGEX 6
54 #define LOGFILTER_BUGID 7
56 //typedef void CALLBACK_PROCESS(void * data, int progress);
57 #define MSG_LOADED (WM_USER+110)
58 #define MSG_LOAD_PERCENTAGE (WM_USER+111)
60 class CGitLogListBase : public CHintListCtrl
62 DECLARE_DYNAMIC(CGitLogListBase)
64 public:
65 CGitLogListBase();
66 virtual ~CGitLogListBase();
67 volatile LONG m_bNoDispUpdates;
68 BOOL m_IsIDReplaceAction;
69 BOOL m_IsOldFirst;
70 BOOL m_IsRebaseReplaceGraph;
72 BOOL m_bStrictStopped;
73 BOOL m_bShowBugtraqColumn;
74 BOOL m_bSearchIndex;
75 BOOL m_bCancelled;
76 bool m_hasWC;
77 GitRev m_wcRev;
78 volatile LONG m_bThreadRunning;
79 CLogCache m_LogCache;
81 enum
83 LOGLIST_GRAPH,
84 LOGLIST_ACTION,
85 LOGLIST_MESSAGE,
86 LOGLIST_AUTHOR,
87 LOGLIST_DATE,
88 LOGLIST_BUG,
89 LOGLIST_MESSAGE_MAX=300,
90 LOGLIST_MESSAGE_MIN=200
93 enum
95 // needs to start with 1, since 0 is the return value if *nothing* is clicked on in the context menu
96 ID_COMPARE = 1,
97 ID_SAVEAS,
98 ID_COMPARETWO,
99 ID_UPDATE,
100 ID_COPY,
101 ID_REVERTREV,
102 ID_MERGEREV,
103 ID_GNUDIFF1,
104 ID_GNUDIFF2,
105 ID_FINDENTRY,
106 ID_OPEN,
107 ID_BLAME,
108 ID_REPOBROWSE,
109 ID_LOG,
110 ID_POPPROPS,
111 ID_EDITAUTHOR,
112 ID_EDITLOG,
113 ID_DIFF,
114 ID_OPENWITH,
115 ID_COPYCLIPBOARD,
116 ID_COPYHASH,
117 ID_CHECKOUT,
118 ID_REVERTTOREV,
119 ID_BLAMECOMPARE,
120 ID_BLAMETWO,
121 ID_BLAMEDIFF,
122 ID_VIEWREV,
123 ID_VIEWPATHREV,
124 ID_EXPORT,
125 ID_COMPAREWITHPREVIOUS,
126 ID_BLAMEWITHPREVIOUS,
127 ID_GETMERGELOGS,
128 ID_REVPROPS,
129 ID_CHERRY_PICK,
130 ID_CREATE_BRANCH,
131 ID_CREATE_TAG,
132 ID_SWITCHTOREV,
133 ID_RESET,
134 ID_REBASE_PICK,
135 ID_REBASE_EDIT,
136 ID_REBASE_SQUASH
138 void InsertGitColumn();
139 void ResizeAllListCtrlCols();
140 void CopySelectionToClipBoard(bool hashonly=FALSE);
141 void DiffSelectedRevWithPrevious();
142 bool IsSelectionContinuous();
143 int FillGitShortLog();
144 int FillGitLog(CTGitPath *path,int infomask=CGit:: LOG_INFO_STAT| CGit::LOG_INFO_FILESTATE,CString *from=NULL,CString *to=NULL);
146 inline int ShownCountWithStopped() const { return (int)m_arShownList.GetCount() + (m_bStrictStopped ? 1 : 0); }
147 int FetchLogAsync(void * data=NULL);
148 CPtrArray m_arShownList;
149 void Refresh();
150 void RecalculateShownList(CPtrArray * pShownlist);
151 void Clear();
153 int m_nSelectedFilter;
154 CLogDataVector m_logEntries;
155 void RemoveFilter();
156 void StartFilter();
157 bool ValidateRegexp(LPCTSTR regexp_str, tr1::wregex& pat, bool bMatchCase = false );
158 CString m_sFilterText;
159 CTime m_From;
160 CTime m_To;
162 CTGitPath m_Path;
163 int m_ShowMask;
165 void GetTimeRange(CTime &oldest,CTime &latest);
166 virtual void ContextMenuAction(int cmd,int FirstSelect, int LastSelect)=0;
167 void ReloadHashMap()
169 m_HashMap.clear();
170 g_Git.GetMapHashToFriendName(m_HashMap);
171 m_CurrentBranch=g_Git.GetCurrentBranch();
173 void TerminateThread()
175 if(this->m_LoadingThread)
176 AfxTermThread((HINSTANCE)m_LoadingThread->m_hThread);
179 bool IsInWorkingThread()
181 return (AfxGetThread() == m_LoadingThread);
184 volatile bool m_bExitThread;
185 CWinThread* m_LoadingThread;
186 protected:
187 DECLARE_MESSAGE_MAP()
188 afx_msg void OnDestroy();
189 afx_msg void OnNMCustomdrawLoglist(NMHDR *pNMHDR, LRESULT *pResult);
190 afx_msg void OnLvnGetdispinfoLoglist(NMHDR *pNMHDR, LRESULT *pResult);
191 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
192 afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
193 afx_msg LRESULT OnLoad(WPARAM wParam, LPARAM lParam);
194 void OnNMDblclkLoglist(NMHDR * /*pNMHDR*/, LRESULT *pResult);
195 afx_msg void OnLvnOdfinditemLoglist(NMHDR *pNMHDR, LRESULT *pResult);
196 void PreSubclassWindow();
197 virtual BOOL PreTranslateMessage(MSG* pMsg);
198 static UINT LogThreadEntry(LPVOID pVoid);
199 UINT LogThread();
200 void FetchFullLogInfoOrig();
201 void FetchFullLogInfo();
202 void FillBackGround(HDC hdc, int Index,CRect &rect);
203 void DrawTagBranch(HDC,CRect &rect,INT_PTR index);
204 void DrawGraph(HDC,CRect &rect,INT_PTR index);
206 BOOL GetShortName(CString ref, CString &shortname,CString prefix);
207 void paintGraphLane(HDC hdc,int laneHeight, int type, int x1, int x2,
208 const COLORREF& col,int top) ;
209 void DrawLine(HDC hdc, int x1, int y1, int x2, int y2){::MoveToEx(hdc,x1,y1,NULL);::LineTo(hdc,x2,y2);}
211 * Save column widths to the registry
213 void SaveColumnWidths(); // save col widths to the registry
215 BOOL IsEntryInDateRange(int i);
219 bool m_bFilterWithRegex;
222 CXPTheme m_Theme;
223 BOOL m_bVista;
225 HICON m_hModifiedIcon;
226 HICON m_hReplacedIcon;
227 HICON m_hAddedIcon;
228 HICON m_hDeletedIcon;
230 HFONT m_boldFont;
232 CRegDWORD m_regMaxBugIDColWidth;
233 int m_nSearchIndex;
235 void *m_ProcData;
236 CStoreSelection* m_pStoreSelection;
237 MAP_HASH_NAME m_HashMap;
239 CColors m_Colors;
241 CString m_CurrentBranch;
243 COLORREF m_LineColors[Lanes::COLORS_NUM];
244 DWORD m_DateFormat; // DATE_SHORTDATE or DATE_LONGDATE
245 bool m_bRelativeTimes; // Show relative times