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 20
\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 DECLARE_MESSAGE_MAP()
\r
85 CSciEdit m_TextView;
\r
87 HINSTANCE hInstance;
\r
88 HINSTANCE hResource;
\r
99 BOOL bIgnoreAllSpaces;
\r
101 LRESULT SendEditor(UINT Msg, WPARAM wParam=0, LPARAM lParam=0);
\r
103 void GetRange(int start, int end, char *text);
\r
106 BOOL OpenFile(const char *fileName);
\r
107 BOOL OpenLogFile(const char *fileName);
\r
109 void Command(int id);
\r
110 void Notify(SCNotification *notification);
\r
112 void SetAStyle(int style, COLORREF fore, COLORREF back=::GetSysColor(COLOR_WINDOW), int size=-1, CString *face=0);
\r
114 void InitialiseEditor();
\r
116 LONG GetBlameWidth();
\r
117 void DrawBlame(HDC hDC);
\r
118 void DrawHeader(HDC hDC);
\r
119 void DrawLocatorBar(HDC hDC);
\r
120 void StartSearch();
\r
121 void CopySelectedLogToClipboard();
\r
122 void BlamePreviousRevision();
\r
123 void DiffPreviousRevision();
\r
125 bool DoSearch(LPSTR what, DWORD flags);
\r
126 bool GotoLine(long line);
\r
127 bool ScrollToLine(long line);
\r
128 void GotoLineDlg();
\r
129 static INT_PTR CALLBACK GotoDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
\r
131 void SetSelectedLine(LONG line) { m_SelectedLine=line;};
\r
134 CString m_MouseHash;
\r
135 LONG m_selectedrev;
\r
136 LONG m_selectedorigrev;
\r
137 CString m_SelectedHash;
\r
138 CString m_selecteddate;
\r
139 static long m_gotoline;
\r
144 // std::vector<bool> m_Mergelines;
\r
145 std::vector<LONG> m_ID;
\r
146 std::vector<LONG> m_LineNum;
\r
147 // std::vector<LONG> m_Origrevs;
\r
148 std::vector<CString> m_Dates;
\r
149 std::vector<CString> m_Authors;
\r
150 std::vector<CString> m_CommitHash;
\r
152 // std::vector<CString> m_Paths;
\r
153 // std::map<LONG, CString> logmessages;
\r
154 char m_szTip[MAX_LOG_LENGTH*2+6];
\r
155 wchar_t m_wszTip[MAX_LOG_LENGTH*2+6];
\r
156 void StringExpand(LPSTR str);
\r
157 void StringExpand(LPWSTR str);
\r
160 CLogDataVector * GetLogData();
\r
166 void SetupLexer(CString filename);
\r
167 void SetupCppLexer();
\r
168 COLORREF InterColor(COLORREF c1, COLORREF c2, int Slider);
\r
169 CString GetAppDirectory();
\r
170 std::vector<COLORREF> colors;
\r
172 HFONT m_italicfont;
\r
176 LONG m_authorwidth;
\r
179 LONG m_SelectedLine; ///< zero-based
\r
181 COLORREF m_mouserevcolor;
\r
182 COLORREF m_mouseauthorcolor;
\r
183 COLORREF m_selectedrevcolor;
\r
184 COLORREF m_selectedauthorcolor;
\r
185 COLORREF m_windowcolor;
\r
186 COLORREF m_textcolor;
\r
187 COLORREF m_texthighlightcolor;
\r
189 LRESULT m_directFunction;
\r
190 LRESULT m_directPointer;
\r
192 TCHAR szFindWhat[80];
\r
194 CRegStdWORD m_regOldLinesColor;
\r
195 CRegStdWORD m_regNewLinesColor;
\r
199 #ifndef _DEBUG // debug version in TortoiseGitBlameView.cpp
\r
200 inline CTortoiseGitBlameDoc* CTortoiseGitBlameView::GetDocument() const
\r
201 { return reinterpret_cast<CTortoiseGitBlameDoc*>(m_pDocument); }
\r