2 // TortoiseGitBlameView.h : interface of the CTortoiseGitBlameView class
13 #include "GitBlameLogList.h"
16 const COLORREF black
= RGB(0,0,0);
17 const COLORREF white
= RGB(0xff,0xff,0xff);
18 const COLORREF red
= RGB(0xFF, 0, 0);
19 const COLORREF offWhite
= RGB(0xFF, 0xFB, 0xF0);
20 const COLORREF darkGreen
= RGB(0, 0x80, 0);
21 const COLORREF darkBlue
= RGB(0, 0, 0x80);
22 const COLORREF lightBlue
= RGB(0xA6, 0xCA, 0xF0);
23 const int blockSize
= 128 * 1024;
26 #define HEADER_HEIGHT 18
27 #define LOCATOR_WIDTH 10
29 #define MAX_LOG_LENGTH 2000
33 #define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp))
36 #define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp))
40 class CTortoiseGitBlameView
: public CView
42 protected: // create from serialization only
43 CTortoiseGitBlameView();
44 DECLARE_DYNCREATE(CTortoiseGitBlameView
)
48 CTortoiseGitBlameDoc
* GetDocument() const;
55 virtual void OnDraw(CDC
* pDC
); // overridden to draw this view
56 virtual BOOL
PreCreateWindow(CREATESTRUCT
& cs
);
58 virtual BOOL
OnPreparePrinting(CPrintInfo
* pInfo
);
59 virtual void OnBeginPrinting(CDC
* pDC
, CPrintInfo
* pInfo
);
60 virtual void OnEndPrinting(CDC
* pDC
, CPrintInfo
* pInfo
);
64 virtual ~CTortoiseGitBlameView();
66 virtual void AssertValid() const;
67 virtual void Dump(CDumpContext
& dc
) const;
72 // Generated message map functions
74 BOOL
PreTranslateMessage(MSG
* pMsg
);
75 afx_msg
void OnEditFind();
76 afx_msg
void OnEditGoto();
77 afx_msg
void OnFilePrintPreview();
78 afx_msg
void OnRButtonUp(UINT nFlags
, CPoint point
);
79 afx_msg
void OnContextMenu(CWnd
* pWnd
, CPoint point
);
80 afx_msg
int OnCreate(LPCREATESTRUCT lpcs
);
81 afx_msg
void OnSize(UINT nType
, int cx
, int cy
);
82 afx_msg
void OnSciPainted(NMHDR
*, LRESULT
*);
83 afx_msg
void OnLButtonDown(UINT nFlags
,CPoint point
);
84 afx_msg
void OnRButtonDown(UINT nFlags
,CPoint point
){OnLButtonDown(nFlags
,point
);CView::OnRButtonDown(nFlags
,point
);};
85 afx_msg
void OnSciGetBkColor(NMHDR
*, LRESULT
*);
86 afx_msg
void OnMouseHover(UINT nFlags
, CPoint point
);
87 afx_msg
void OnMouseMove(UINT nFlags
, CPoint point
);
88 afx_msg LRESULT
OnFindDialogMessage(WPARAM wParam
, LPARAM lParam
);
89 afx_msg
void OnViewNext();
90 afx_msg
void OnViewPrev();
92 int FindNextLine(CString commithash
, bool bUpOrDown
=false);
93 int FindFirstLine(CString commithash
, int line
)
97 if( m_CommitHash
[line
] != commithash
)
106 DECLARE_MESSAGE_MAP()
108 static UINT m_FindDialogMessage
;
112 void FocusOn(GitRev
*pRev
);
129 BOOL bIgnoreAllSpaces
;
135 LRESULT
SendEditor(UINT Msg
, WPARAM wParam
=0, LPARAM lParam
=0);
137 void GetRange(int start
, int end
, char *text
);
140 BOOL
OpenFile(const char *fileName
);
141 BOOL
OpenLogFile(const char *fileName
);
143 void Command(int id
);
144 void Notify(SCNotification
*notification
);
146 void SetAStyle(int style
, COLORREF fore
, COLORREF back
=::GetSysColor(COLOR_WINDOW
), int size
=-1, CString
*face
=0);
148 void InitialiseEditor();
150 LONG
GetBlameWidth();
151 void DrawBlame(HDC hDC
);
152 void DrawHeader(HDC hDC
);
153 void DrawLocatorBar(HDC hDC
);
155 void CopySelectedLogToClipboard();
156 void BlamePreviousRevision();
157 void DiffPreviousRevision();
159 bool DoSearch(CString what
, DWORD flags
);
160 bool GotoLine(long line
);
161 bool ScrollToLine(long line
);
163 static INT_PTR CALLBACK
GotoDlgProc(HWND hwndDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
);
165 void SetSelectedLine(LONG line
) { m_SelectedLine
=line
;};
170 LONG m_selectedorigrev
;
171 CString m_SelectedHash
;
172 CString m_selecteddate
;
173 static long m_gotoline
;
178 // std::vector<bool> m_Mergelines;
179 std::vector
<LONG
> m_ID
;
180 std::vector
<LONG
> m_LineNum
;
181 // std::vector<LONG> m_Origrevs;
182 std::vector
<CString
> m_Dates
;
183 std::vector
<CString
> m_Authors
;
184 std::vector
<CString
> m_CommitHash
;
186 std::map
<CString
,GitRev
> m_NoListCommit
;
188 // std::vector<CString> m_Paths;
189 // std::map<LONG, CString> logmessages;
190 char m_szTip
[MAX_LOG_LENGTH
*2+6];
191 wchar_t m_wszTip
[MAX_LOG_LENGTH
*2+6];
192 void StringExpand(LPSTR str
);
193 void StringExpand(LPWSTR str
);
196 CLogDataVector
* GetLogData();
202 void SetupLexer(CString filename
);
203 void SetupCppLexer();
204 COLORREF
InterColor(COLORREF c1
, COLORREF c2
, int Slider
);
205 CString
GetAppDirectory();
206 std::vector
<COLORREF
> colors
;
215 LONG m_SelectedLine
; ///< zero-based
217 COLORREF m_mouserevcolor
;
218 COLORREF m_mouseauthorcolor
;
219 COLORREF m_selectedrevcolor
;
220 COLORREF m_selectedauthorcolor
;
221 COLORREF m_windowcolor
;
222 COLORREF m_textcolor
;
223 COLORREF m_texthighlightcolor
;
225 LRESULT m_directFunction
;
226 LRESULT m_directPointer
;
228 TCHAR szFindWhat
[80];
230 CRegStdWORD m_regOldLinesColor
;
231 CRegStdWORD m_regNewLinesColor
;
233 CGitBlameLogList
* GetLogList();
235 CFindReplaceDialog
*m_pFindDialog
;
237 DWORD m_DateFormat
; // DATE_SHORTDATE or DATE_LONGDATE
240 #ifndef _DEBUG // debug version in TortoiseGitBlameView.cpp
241 inline CTortoiseGitBlameDoc
* CTortoiseGitBlameView::GetDocument() const
242 { return reinterpret_cast<CTortoiseGitBlameDoc
*>(m_pDocument
); }