2 // TortoiseGitBlameView.h : interface of the CTortoiseGitBlameView class
\r
8 #include "Scintilla.h"
\r
9 #include "SciLexer.h"
\r
10 #include "registry.h"
\r
11 #include "SciEdit.h"
\r
13 #include "GitBlameLogList.h"
\r
15 const COLORREF black = RGB(0,0,0);
\r
16 const COLORREF white = RGB(0xff,0xff,0xff);
\r
17 const COLORREF red = RGB(0xFF, 0, 0);
\r
18 const COLORREF offWhite = RGB(0xFF, 0xFB, 0xF0);
\r
19 const COLORREF darkGreen = RGB(0, 0x80, 0);
\r
20 const COLORREF darkBlue = RGB(0, 0, 0x80);
\r
21 const COLORREF lightBlue = RGB(0xA6, 0xCA, 0xF0);
\r
22 const int blockSize = 128 * 1024;
\r
24 #define BLAMESPACE 20
\r
25 #define HEADER_HEIGHT 18
\r
26 #define LOCATOR_WIDTH 10
\r
28 #define MAX_LOG_LENGTH 2000
\r
31 #ifndef GET_X_LPARAM
\r
32 #define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp))
\r
34 #ifndef GET_Y_LPARAM
\r
35 #define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp))
\r
39 class CTortoiseGitBlameView : public CView
\r
41 protected: // create from serialization only
\r
42 CTortoiseGitBlameView();
\r
43 DECLARE_DYNCREATE(CTortoiseGitBlameView)
\r
47 CTortoiseGitBlameDoc* GetDocument() const;
\r
54 virtual void OnDraw(CDC* pDC); // overridden to draw this view
\r
55 virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
\r
57 virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
\r
58 virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
\r
59 virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
\r
63 virtual ~CTortoiseGitBlameView();
\r
65 virtual void AssertValid() const;
\r
66 virtual void Dump(CDumpContext& dc) const;
\r
71 // Generated message map functions
\r
73 afx_msg void OnFilePrintPreview();
\r
74 afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
\r
75 afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
\r
76 afx_msg int OnCreate(LPCREATESTRUCT lpcs);
\r
77 afx_msg void OnSize(UINT nType, int cx, int cy);
\r
78 afx_msg void OnSciPainted(NMHDR*, LRESULT*);
\r
79 afx_msg void OnLButtonDown(UINT nFlags,CPoint point);
\r
80 afx_msg void OnRButtonDown(UINT nFlags,CPoint point){OnLButtonDown(nFlags,point);CView::OnRButtonDown(nFlags,point);};
\r
81 afx_msg void OnSciGetBkColor(NMHDR*, LRESULT*);
\r
82 DECLARE_MESSAGE_MAP()
\r
87 void FocusOn(GitRev *pRev);
\r
89 CSciEdit m_TextView;
\r
91 HINSTANCE hInstance;
\r
92 HINSTANCE hResource;
\r
102 BOOL bIgnoreSpaces;
\r
103 BOOL bIgnoreAllSpaces;
\r
105 LRESULT SendEditor(UINT Msg, WPARAM wParam=0, LPARAM lParam=0);
\r
107 void GetRange(int start, int end, char *text);
\r
110 BOOL OpenFile(const char *fileName);
\r
111 BOOL OpenLogFile(const char *fileName);
\r
113 void Command(int id);
\r
114 void Notify(SCNotification *notification);
\r
116 void SetAStyle(int style, COLORREF fore, COLORREF back=::GetSysColor(COLOR_WINDOW), int size=-1, CString *face=0);
\r
118 void InitialiseEditor();
\r
120 LONG GetBlameWidth();
\r
121 void DrawBlame(HDC hDC);
\r
122 void DrawHeader(HDC hDC);
\r
123 void DrawLocatorBar(HDC hDC);
\r
124 void StartSearch();
\r
125 void CopySelectedLogToClipboard();
\r
126 void BlamePreviousRevision();
\r
127 void DiffPreviousRevision();
\r
129 bool DoSearch(LPSTR what, DWORD flags);
\r
130 bool GotoLine(long line);
\r
131 bool ScrollToLine(long line);
\r
132 void GotoLineDlg();
\r
133 static INT_PTR CALLBACK GotoDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
\r
135 void SetSelectedLine(LONG line) { m_SelectedLine=line;};
\r
138 CString m_MouseHash;
\r
139 LONG m_selectedrev;
\r
140 LONG m_selectedorigrev;
\r
141 CString m_SelectedHash;
\r
142 CString m_selecteddate;
\r
143 static long m_gotoline;
\r
148 // std::vector<bool> m_Mergelines;
\r
149 std::vector<LONG> m_ID;
\r
150 std::vector<LONG> m_LineNum;
\r
151 // std::vector<LONG> m_Origrevs;
\r
152 std::vector<CString> m_Dates;
\r
153 std::vector<CString> m_Authors;
\r
154 std::vector<CString> m_CommitHash;
\r
156 // std::vector<CString> m_Paths;
\r
157 // std::map<LONG, CString> logmessages;
\r
158 char m_szTip[MAX_LOG_LENGTH*2+6];
\r
159 wchar_t m_wszTip[MAX_LOG_LENGTH*2+6];
\r
160 void StringExpand(LPSTR str);
\r
161 void StringExpand(LPWSTR str);
\r
164 CLogDataVector * GetLogData();
\r
170 void SetupLexer(CString filename);
\r
171 void SetupCppLexer();
\r
172 COLORREF InterColor(COLORREF c1, COLORREF c2, int Slider);
\r
173 CString GetAppDirectory();
\r
174 std::vector<COLORREF> colors;
\r
176 HFONT m_italicfont;
\r
180 LONG m_authorwidth;
\r
183 LONG m_SelectedLine; ///< zero-based
\r
185 COLORREF m_mouserevcolor;
\r
186 COLORREF m_mouseauthorcolor;
\r
187 COLORREF m_selectedrevcolor;
\r
188 COLORREF m_selectedauthorcolor;
\r
189 COLORREF m_windowcolor;
\r
190 COLORREF m_textcolor;
\r
191 COLORREF m_texthighlightcolor;
\r
193 LRESULT m_directFunction;
\r
194 LRESULT m_directPointer;
\r
196 TCHAR szFindWhat[80];
\r
198 CRegStdWORD m_regOldLinesColor;
\r
199 CRegStdWORD m_regNewLinesColor;
\r
201 CGitBlameLogList * GetLogList();
\r
205 #ifndef _DEBUG // debug version in TortoiseGitBlameView.cpp
\r
206 inline CTortoiseGitBlameDoc* CTortoiseGitBlameView::GetDocument() const
\r
207 { return reinterpret_cast<CTortoiseGitBlameDoc*>(m_pDocument); }
\r