OSDN Git Service

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