RebaseDlg: Fetch log when change branch and upstream
[TortoiseGit.git] / src / TortoiseProc / GitLogListBase.h
blob42b2359d8e89e09aed13f83aebe89725c137c09e
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_bStrictStopped;
70 BOOL m_bShowBugtraqColumn;
71 BOOL m_bSearchIndex;
72 BOOL m_bCancelled;
73 bool m_hasWC;
74 GitRev m_wcRev;
75 volatile LONG m_bThreadRunning;
76 CLogCache m_LogCache;
78 enum
80 LOGLIST_GRAPH,
81 LOGLIST_ACTION,
82 LOGLIST_MESSAGE,
83 LOGLIST_AUTHOR,
84 LOGLIST_DATE,
85 LOGLIST_BUG,
86 LOGLIST_MESSAGE_MAX=300,
87 LOGLIST_MESSAGE_MIN=200
90 enum
92 // needs to start with 1, since 0 is the return value if *nothing* is clicked on in the context menu
93 ID_COMPARE = 1,
94 ID_SAVEAS,
95 ID_COMPARETWO,
96 ID_UPDATE,
97 ID_COPY,
98 ID_REVERTREV,
99 ID_MERGEREV,
100 ID_GNUDIFF1,
101 ID_GNUDIFF2,
102 ID_FINDENTRY,
103 ID_OPEN,
104 ID_BLAME,
105 ID_REPOBROWSE,
106 ID_LOG,
107 ID_POPPROPS,
108 ID_EDITAUTHOR,
109 ID_EDITLOG,
110 ID_DIFF,
111 ID_OPENWITH,
112 ID_COPYCLIPBOARD,
113 ID_COPYHASH,
114 ID_CHECKOUT,
115 ID_REVERTTOREV,
116 ID_BLAMECOMPARE,
117 ID_BLAMETWO,
118 ID_BLAMEDIFF,
119 ID_VIEWREV,
120 ID_VIEWPATHREV,
121 ID_EXPORT,
122 ID_COMPAREWITHPREVIOUS,
123 ID_BLAMEWITHPREVIOUS,
124 ID_GETMERGELOGS,
125 ID_REVPROPS,
126 ID_CHERRY_PICK,
127 ID_CREATE_BRANCH,
128 ID_CREATE_TAG,
129 ID_SWITCHTOREV,
130 ID_RESET
132 void InsertGitColumn();
133 void ResizeAllListCtrlCols();
134 void CopySelectionToClipBoard(bool hashonly=FALSE);
135 void DiffSelectedRevWithPrevious();
136 bool IsSelectionContinuous();
137 int FillGitShortLog();
138 int FillGitLog(CTGitPath *path,int infomask=CGit:: LOG_INFO_STAT| CGit::LOG_INFO_FILESTATE,CString *from=NULL,CString *to=NULL);
140 inline int ShownCountWithStopped() const { return (int)m_arShownList.GetCount() + (m_bStrictStopped ? 1 : 0); }
141 int FetchLogAsync(void * data=NULL);
142 CPtrArray m_arShownList;
143 void Refresh();
144 void RecalculateShownList(CPtrArray * pShownlist);
145 void Clear();
147 int m_nSelectedFilter;
148 CLogDataVector m_logEntries;
149 void RemoveFilter();
150 void StartFilter();
151 bool ValidateRegexp(LPCTSTR regexp_str, tr1::wregex& pat, bool bMatchCase = false );
152 CString m_sFilterText;
153 CTime m_From;
154 CTime m_To;
156 CTGitPath m_Path;
157 int m_ShowMask;
159 void GetTimeRange(CTime &oldest,CTime &latest);
160 virtual void ContextMenuAction(int cmd,int FirstSelect, int LastSelect)=0;
161 void ReloadHashMap()
163 m_HashMap.clear();
164 g_Git.GetMapHashToFriendName(m_HashMap);
165 m_CurrentBranch=g_Git.GetCurrentBranch();
167 void TerminateThread()
169 if(this->m_LoadingThread)
170 AfxTermThread((HINSTANCE)m_LoadingThread->m_hThread);
173 bool IsInWorkingThread()
175 return (AfxGetThread() == m_LoadingThread);
178 volatile bool m_bExitThread;
179 CWinThread* m_LoadingThread;
180 protected:
181 DECLARE_MESSAGE_MAP()
182 afx_msg void OnDestroy();
183 afx_msg void OnNMCustomdrawLoglist(NMHDR *pNMHDR, LRESULT *pResult);
184 afx_msg void OnLvnGetdispinfoLoglist(NMHDR *pNMHDR, LRESULT *pResult);
185 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
186 afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
187 afx_msg LRESULT OnLoad(WPARAM wParam, LPARAM lParam);
188 void OnNMDblclkLoglist(NMHDR * /*pNMHDR*/, LRESULT *pResult);
189 afx_msg void OnLvnOdfinditemLoglist(NMHDR *pNMHDR, LRESULT *pResult);
190 void PreSubclassWindow();
191 virtual BOOL PreTranslateMessage(MSG* pMsg);
192 static UINT LogThreadEntry(LPVOID pVoid);
193 UINT LogThread();
194 void FetchFullLogInfoOrig();
195 void FetchFullLogInfo();
196 void FillBackGround(HDC hdc, int Index,CRect &rect);
197 void DrawTagBranch(HDC,CRect &rect,INT_PTR index);
198 void DrawGraph(HDC,CRect &rect,INT_PTR index);
200 BOOL GetShortName(CString ref, CString &shortname,CString prefix);
201 void paintGraphLane(HDC hdc,int laneHeight, int type, int x1, int x2,
202 const COLORREF& col,int top) ;
203 void DrawLine(HDC hdc, int x1, int y1, int x2, int y2){::MoveToEx(hdc,x1,y1,NULL);::LineTo(hdc,x2,y2);}
205 * Save column widths to the registry
207 void SaveColumnWidths(); // save col widths to the registry
209 BOOL IsEntryInDateRange(int i);
213 bool m_bFilterWithRegex;
216 CXPTheme m_Theme;
217 BOOL m_bVista;
219 HICON m_hModifiedIcon;
220 HICON m_hReplacedIcon;
221 HICON m_hAddedIcon;
222 HICON m_hDeletedIcon;
224 HFONT m_boldFont;
226 CRegDWORD m_regMaxBugIDColWidth;
227 int m_nSearchIndex;
229 void *m_ProcData;
230 CStoreSelection* m_pStoreSelection;
231 MAP_HASH_NAME m_HashMap;
233 CColors m_Colors;
235 CString m_CurrentBranch;
237 COLORREF m_LineColors[Lanes::COLORS_NUM];
238 DWORD m_DateFormat; // DATE_SHORTDATE or DATE_LONGDATE
239 bool m_bRelativeTimes; // Show relative times