OSDN Git Service

Add work dir copy at log dialog
[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 #define MSG_LOADED                              (WM_USER+110)\r
58 #define MSG_LOAD_PERCENTAGE             (WM_USER+111)\r
59 #define MSG_REFLOG_CHANGED              (WM_USER+112)\r
60 \r
61 class CGitLogListBase : public CHintListCtrl\r
62 {\r
63         DECLARE_DYNAMIC(CGitLogListBase)\r
64 \r
65 public:\r
66         CGitLogListBase();\r
67         virtual ~CGitLogListBase();\r
68         volatile LONG           m_bNoDispUpdates;\r
69         BOOL m_IsIDReplaceAction;\r
70         BOOL m_IsOldFirst;\r
71         BOOL m_IsRebaseReplaceGraph;\r
72 \r
73         void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct);\r
74         void OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct);\r
75 \r
76         BOOL m_bStrictStopped;\r
77         BOOL m_bShowBugtraqColumn;\r
78         BOOL m_bSearchIndex;\r
79         BOOL m_bCancelled;\r
80         unsigned __int64 m_ContextMenuMask;\r
81 \r
82         bool                            m_hasWC;\r
83         bool                            m_bShowWC;\r
84         GitRev                          m_wcRev;\r
85         volatile LONG           m_bThreadRunning;\r
86         CLogCache                       m_LogCache;\r
87 \r
88         enum\r
89         {\r
90                 LOGLIST_GRAPH,\r
91                 LOGLIST_ACTION,\r
92                 LOGLIST_MESSAGE,\r
93                 LOGLIST_AUTHOR,\r
94                 LOGLIST_DATE,\r
95                 LOGLIST_BUG,\r
96                 LOGLIST_MESSAGE_MAX=300,\r
97                 LOGLIST_MESSAGE_MIN=200\r
98         };\r
99 \r
100         enum \r
101         {\r
102         // needs to start with 1, since 0 is the return value if *nothing* is clicked on in the context menu\r
103         ID_COMPARE = 1,\r
104         ID_SAVEAS,\r
105         ID_COMPARETWO,\r
106         ID_UPDATE,\r
107         ID_COPY,\r
108         ID_REVERTREV,\r
109         ID_MERGEREV,\r
110         ID_GNUDIFF1,\r
111         ID_GNUDIFF2,\r
112         ID_FINDENTRY,\r
113         ID_OPEN,\r
114         ID_BLAME,\r
115         ID_REPOBROWSE,\r
116         ID_LOG,\r
117         ID_POPPROPS,\r
118         ID_EDITAUTHOR,\r
119         ID_EDITLOG,\r
120         ID_DIFF,\r
121         ID_OPENWITH,\r
122         ID_COPYCLIPBOARD,\r
123         ID_COPYHASH,\r
124         ID_CHECKOUT,\r
125         ID_REVERTTOREV,\r
126         ID_BLAMECOMPARE,\r
127         ID_BLAMETWO,\r
128         ID_BLAMEDIFF,\r
129         ID_VIEWREV,\r
130         ID_VIEWPATHREV,\r
131         ID_EXPORT,\r
132         ID_COMPAREWITHPREVIOUS,\r
133         ID_BLAMEWITHPREVIOUS,\r
134         ID_GETMERGELOGS,\r
135         ID_REVPROPS,\r
136         ID_CHERRY_PICK,\r
137         ID_CREATE_BRANCH,\r
138         ID_CREATE_TAG,\r
139         ID_SWITCHTOREV,\r
140         ID_RESET,\r
141         ID_REBASE_PICK,\r
142         ID_REBASE_EDIT,\r
143         ID_REBASE_SQUASH,\r
144         ID_REBASE_SKIP,\r
145         ID_COMBINE_COMMIT,\r
146         ID_STASH_APPLY,\r
147         ID_REFLOG_DEL,\r
148         ID_REBASE_TO_VERSION,\r
149         ID_CREATE_PATCH,\r
150         ID_DELETE,\r
151         };\r
152         inline unsigned __int64 GetContextMenuBit(int i){ return ((unsigned __int64 )0x1)<<i ;}\r
153         void InsertGitColumn();\r
154         void ResizeAllListCtrlCols();\r
155         void CopySelectionToClipBoard(bool hashonly=FALSE);\r
156         void DiffSelectedRevWithPrevious();\r
157         bool IsSelectionContinuous();\r
158         int  FillGitShortLog();\r
159         int  FillGitLog(CTGitPath *path,int infomask=CGit::     LOG_INFO_STAT| CGit::LOG_INFO_FILESTATE | CGit::LOG_INFO_SHOW_MERGEDFILE,CString *from=NULL,CString *to=NULL);\r
160 \r
161         inline int ShownCountWithStopped() const { return (int)m_arShownList.GetCount() + (m_bStrictStopped ? 1 : 0); }\r
162         int FetchLogAsync(void * data=NULL);\r
163         CPtrArray                       m_arShownList;\r
164         void Refresh();\r
165         void RecalculateShownList(CPtrArray * pShownlist);\r
166         void Clear();\r
167 \r
168         int                                     m_nSelectedFilter;\r
169         CLogDataVector          m_logEntries;\r
170         void RemoveFilter();\r
171         void StartFilter();\r
172         bool ValidateRegexp(LPCTSTR regexp_str, tr1::wregex& pat, bool bMatchCase = false );\r
173         CString                         m_sFilterText;\r
174         CTime                   m_From;\r
175         CTime                   m_To;\r
176     \r
177     CTGitPath           m_Path;\r
178     int                                 m_ShowMask;\r
179 \r
180         void                            GetTimeRange(CTime &oldest,CTime &latest);\r
181         virtual void ContextMenuAction(int cmd,int FirstSelect, int LastSelect)=0;\r
182         void ReloadHashMap()\r
183         {       \r
184                 m_HashMap.clear();\r
185                 g_Git.GetMapHashToFriendName(m_HashMap);\r
186                 m_CurrentBranch=g_Git.GetCurrentBranch();\r
187                 this->m_HeadHash=g_Git.GetHash(CString(_T("HEAD"))).Left(40);\r
188         }\r
189         void TerminateThread()\r
190         {\r
191                 if(this->m_LoadingThread)\r
192                         AfxTermThread((HINSTANCE)m_LoadingThread->m_hThread);\r
193         };\r
194 \r
195         bool IsInWorkingThread()\r
196         {\r
197                 return (AfxGetThread() == m_LoadingThread);\r
198         }\r
199 \r
200         void SetStartRef(const CString& StartRef)\r
201         {\r
202                 m_StartRef=StartRef;\r
203         }\r
204 \r
205         CString GetStartRef() const {return m_StartRef;}\r
206 \r
207         \r
208         volatile bool           m_bExitThread;\r
209         CWinThread*                     m_LoadingThread;\r
210 protected:\r
211         DECLARE_MESSAGE_MAP()\r
212         afx_msg void OnDestroy();\r
213         virtual afx_msg void OnNMCustomdrawLoglist(NMHDR *pNMHDR, LRESULT *pResult);\r
214         virtual afx_msg void OnLvnGetdispinfoLoglist(NMHDR *pNMHDR, LRESULT *pResult);\r
215         afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);\r
216         afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);\r
217         afx_msg LRESULT OnLoad(WPARAM wParam, LPARAM lParam);\r
218         void OnNMDblclkLoglist(NMHDR * /*pNMHDR*/, LRESULT *pResult);\r
219         afx_msg void OnLvnOdfinditemLoglist(NMHDR *pNMHDR, LRESULT *pResult);\r
220         void PreSubclassWindow();\r
221         virtual BOOL PreTranslateMessage(MSG* pMsg);\r
222         static UINT LogThreadEntry(LPVOID pVoid);\r
223         UINT LogThread();\r
224         void FetchLastLogInfo();\r
225         void FetchFullLogInfo(CString &from, CString &to);\r
226         void FillBackGround(HDC hdc, int Index,CRect &rect);\r
227         void DrawTagBranch(HDC,CRect &rect,INT_PTR index);\r
228         void DrawGraph(HDC,CRect &rect,INT_PTR index);\r
229 \r
230         BOOL GetShortName(CString ref, CString &shortname,CString prefix);\r
231         void paintGraphLane(HDC hdc,int laneHeight, int type, int x1, int x2,\r
232                                       const COLORREF& col,const COLORREF& activeColor, int top) ; \r
233         void DrawLine(HDC hdc, int x1, int y1, int x2, int y2){::MoveToEx(hdc,x1,y1,NULL);::LineTo(hdc,x2,y2);}\r
234         /**\r
235         * Save column widths to the registry\r
236         */\r
237         void SaveColumnWidths();        // save col widths to the registry\r
238 \r
239         BOOL IsEntryInDateRange(int i);\r
240 \r
241         int GetHeadIndex();\r
242 \r
243         bool                            m_bFilterWithRegex;\r
244 \r
245         \r
246         CXPTheme                        m_Theme;\r
247         BOOL                            m_bVista;\r
248         \r
249         HICON                           m_hModifiedIcon;\r
250         HICON                           m_hReplacedIcon;\r
251         HICON                           m_hAddedIcon;\r
252         HICON                           m_hDeletedIcon;\r
253 \r
254         HFONT                           m_boldFont;\r
255 \r
256         CRegDWORD                       m_regMaxBugIDColWidth;\r
257         int                                     m_nSearchIndex;\r
258         \r
259         void                            *m_ProcData;\r
260         CStoreSelection*        m_pStoreSelection;\r
261         MAP_HASH_NAME           m_HashMap;\r
262 \r
263         CColors                         m_Colors;\r
264 \r
265         CString                         m_CurrentBranch;\r
266         CString                         m_HeadHash;\r
267 \r
268         CString                         m_StartRef; //Ref of the top-commit\r
269         \r
270         CString                         m_ColumnRegKey;\r
271 \r
272         COLORREF                        m_LineColors[Lanes::COLORS_NUM];\r
273         DWORD                           m_DateFormat;   // DATE_SHORTDATE or DATE_LONGDATE\r
274         bool                            m_bRelativeTimes;       // Show relative times\r
275 };\r
276 \r
277 \r