3 #include "HintListCtrl.h"
5 #include "CommonResource.h"
7 #include "ProjectProperties.h"
10 #include "SplitterControl.h"
12 #include "MenuButton.h"
13 #include "LogDlgHelper.h"
14 #include "FilterEdit.h"
17 #include "HintListCtrl.h"
18 //#include "GitLogList.h"
20 #include "GitLogCache.h"
23 #if (NTDDI_VERSION < NTDDI_LONGHORN)
25 enum LISTITEMSTATES_MINE
{
30 LISS_SELECTEDNOTFOCUS
= 5,
34 #define MCS_NOTRAILINGDATES 0x0040
35 #define MCS_SHORTDAYSOFWEEK 0x0080
36 #define MCS_NOSELCHANGEONNAV 0x0100
38 #define DTM_SETMCSTYLE (DTM_FIRST + 11)
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)
59 #define MSG_REFLOG_CHANGED (WM_USER+112)
61 class CGitLogListBase
: public CHintListCtrl
63 DECLARE_DYNAMIC(CGitLogListBase
)
67 virtual ~CGitLogListBase();
68 volatile LONG m_bNoDispUpdates
;
69 BOOL m_IsIDReplaceAction
;
71 BOOL m_IsRebaseReplaceGraph
;
73 void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct
);
74 void OnMeasureItem(int nIDCtl
, LPMEASUREITEMSTRUCT lpMeasureItemStruct
);
76 BOOL m_bStrictStopped
;
77 BOOL m_bShowBugtraqColumn
;
80 unsigned __int64 m_ContextMenuMask
;
85 volatile LONG m_bThreadRunning
;
96 LOGLIST_MESSAGE_MAX
=300,
97 LOGLIST_MESSAGE_MIN
=200
102 // needs to start with 1, since 0 is the return value if *nothing* is clicked on in the context menu
132 ID_COMPAREWITHPREVIOUS
,
133 ID_BLAMEWITHPREVIOUS
,
148 ID_REBASE_TO_VERSION
,
152 inline unsigned __int64
GetContextMenuBit(int i
){ return ((unsigned __int64
)0x1)<<i
;}
153 void InsertGitColumn();
154 void ResizeAllListCtrlCols();
155 void CopySelectionToClipBoard(bool hashonly
=FALSE
);
156 void DiffSelectedRevWithPrevious();
157 bool IsSelectionContinuous();
158 int FillGitShortLog();
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
);
161 inline int ShownCountWithStopped() const { return (int)m_arShownList
.GetCount() + (m_bStrictStopped
? 1 : 0); }
162 int FetchLogAsync(void * data
=NULL
);
163 CPtrArray m_arShownList
;
165 void RecalculateShownList(CPtrArray
* pShownlist
);
168 int m_nSelectedFilter
;
169 CLogDataVector m_logEntries
;
172 bool ValidateRegexp(LPCTSTR regexp_str
, tr1::wregex
& pat
, bool bMatchCase
= false );
173 CString m_sFilterText
;
180 void GetTimeRange(CTime
&oldest
,CTime
&latest
);
181 virtual void ContextMenuAction(int cmd
,int FirstSelect
, int LastSelect
)=0;
185 g_Git
.GetMapHashToFriendName(m_HashMap
);
186 m_CurrentBranch
=g_Git
.GetCurrentBranch();
187 this->m_HeadHash
=g_Git
.GetHash(CString(_T("HEAD"))).Left(40);
189 void TerminateThread()
191 if(this->m_LoadingThread
)
192 AfxTermThread((HINSTANCE
)m_LoadingThread
->m_hThread
);
195 bool IsInWorkingThread()
197 return (AfxGetThread() == m_LoadingThread
);
200 void SetStartRef(const CString
& StartRef
)
205 CString
GetStartRef() const {return m_StartRef
;}
208 volatile bool m_bExitThread
;
209 CWinThread
* m_LoadingThread
;
211 DECLARE_MESSAGE_MAP()
212 afx_msg
void OnDestroy();
213 virtual afx_msg
void OnNMCustomdrawLoglist(NMHDR
*pNMHDR
, LRESULT
*pResult
);
214 virtual afx_msg
void OnLvnGetdispinfoLoglist(NMHDR
*pNMHDR
, LRESULT
*pResult
);
215 afx_msg
int OnCreate(LPCREATESTRUCT lpCreateStruct
);
216 afx_msg
void OnContextMenu(CWnd
* pWnd
, CPoint point
);
217 afx_msg LRESULT
OnLoad(WPARAM wParam
, LPARAM lParam
);
218 void OnNMDblclkLoglist(NMHDR
* /*pNMHDR*/, LRESULT
*pResult
);
219 afx_msg
void OnLvnOdfinditemLoglist(NMHDR
*pNMHDR
, LRESULT
*pResult
);
220 void PreSubclassWindow();
221 virtual BOOL
PreTranslateMessage(MSG
* pMsg
);
222 static UINT
LogThreadEntry(LPVOID pVoid
);
224 void FetchLastLogInfo();
225 void FetchFullLogInfo(CString
&from
, CString
&to
);
226 void FillBackGround(HDC hdc
, int Index
,CRect
&rect
);
227 void DrawTagBranch(HDC
,CRect
&rect
,INT_PTR index
);
228 void DrawGraph(HDC
,CRect
&rect
,INT_PTR index
);
230 BOOL
GetShortName(CString ref
, CString
&shortname
,CString prefix
);
231 void paintGraphLane(HDC hdc
,int laneHeight
, int type
, int x1
, int x2
,
232 const COLORREF
& col
,const COLORREF
& activeColor
, int top
) ;
233 void DrawLine(HDC hdc
, int x1
, int y1
, int x2
, int y2
){::MoveToEx(hdc
,x1
,y1
,NULL
);::LineTo(hdc
,x2
,y2
);}
235 * Save column widths to the registry
237 void SaveColumnWidths(); // save col widths to the registry
239 BOOL
IsEntryInDateRange(int i
);
243 bool m_bFilterWithRegex
;
249 HICON m_hModifiedIcon
;
250 HICON m_hReplacedIcon
;
252 HICON m_hDeletedIcon
;
256 CRegDWORD m_regMaxBugIDColWidth
;
260 CStoreSelection
* m_pStoreSelection
;
261 MAP_HASH_NAME m_HashMap
;
265 CString m_CurrentBranch
;
268 CString m_StartRef
; //Ref of the top-commit
270 CString m_ColumnRegKey
;
272 COLORREF m_LineColors
[Lanes::COLORS_NUM
];
273 DWORD m_DateFormat
; // DATE_SHORTDATE or DATE_LONGDATE
274 bool m_bRelativeTimes
; // Show relative times