OSDN Git Service

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