OSDN Git Service

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