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
14 #include "Balloon.h"
\r
16 const COLORREF black = RGB(0,0,0);
\r
17 const COLORREF white = RGB(0xff,0xff,0xff);
\r
18 const COLORREF red = RGB(0xFF, 0, 0);
\r
19 const COLORREF offWhite = RGB(0xFF, 0xFB, 0xF0);
\r
20 const COLORREF darkGreen = RGB(0, 0x80, 0);
\r
21 const COLORREF darkBlue = RGB(0, 0, 0x80);
\r
22 const COLORREF lightBlue = RGB(0xA6, 0xCA, 0xF0);
\r
23 const int blockSize = 128 * 1024;
\r
25 #define BLAMESPACE 5
\r
26 #define HEADER_HEIGHT 18
\r
27 #define LOCATOR_WIDTH 10
\r
29 #define MAX_LOG_LENGTH 2000
\r
32 #ifndef GET_X_LPARAM
\r
33 #define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp))
\r
35 #ifndef GET_Y_LPARAM
\r
36 #define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp))
\r
40 class CTortoiseGitBlameView : public CView
\r
42 protected: // create from serialization only
\r
43 CTortoiseGitBlameView();
\r
44 DECLARE_DYNCREATE(CTortoiseGitBlameView)
\r
48 CTortoiseGitBlameDoc* GetDocument() const;
\r
55 virtual void OnDraw(CDC* pDC); // overridden to draw this view
\r
56 virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
\r
58 virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
\r
59 virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
\r
60 virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
\r
64 virtual ~CTortoiseGitBlameView();
\r
66 virtual void AssertValid() const;
\r
67 virtual void Dump(CDumpContext& dc) const;
\r
72 // Generated message map functions
\r
74 BOOL PreTranslateMessage(MSG* pMsg);
\r
75 afx_msg void OnEditFind();
\r
76 afx_msg void OnEditGoto();
\r
77 afx_msg void OnFilePrintPreview();
\r
78 afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
\r
79 afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
\r
80 afx_msg int OnCreate(LPCREATESTRUCT lpcs);
\r
81 afx_msg void OnSize(UINT nType, int cx, int cy);
\r
82 afx_msg void OnSciPainted(NMHDR*, LRESULT*);
\r
83 afx_msg void OnLButtonDown(UINT nFlags,CPoint point);
\r
84 afx_msg void OnRButtonDown(UINT nFlags,CPoint point){OnLButtonDown(nFlags,point);CView::OnRButtonDown(nFlags,point);};
\r
85 afx_msg void OnSciGetBkColor(NMHDR*, LRESULT*);
\r
86 afx_msg void OnMouseHover(UINT nFlags, CPoint point);
\r
87 afx_msg void OnMouseMove(UINT nFlags, CPoint point);
\r
88 afx_msg LRESULT OnFindDialogMessage(WPARAM wParam, LPARAM lParam);
\r
89 DECLARE_MESSAGE_MAP()
\r
91 static UINT m_FindDialogMessage;
\r
95 void FocusOn(GitRev *pRev);
\r
97 CSciEdit m_TextView;
\r
100 HINSTANCE hInstance;
\r
101 HINSTANCE hResource;
\r
102 HWND currentDialog;
\r
111 BOOL bIgnoreSpaces;
\r
112 BOOL bIgnoreAllSpaces;
\r
114 BOOL m_bShowAuthor;
\r
118 LRESULT SendEditor(UINT Msg, WPARAM wParam=0, LPARAM lParam=0);
\r
120 void GetRange(int start, int end, char *text);
\r
123 BOOL OpenFile(const char *fileName);
\r
124 BOOL OpenLogFile(const char *fileName);
\r
126 void Command(int id);
\r
127 void Notify(SCNotification *notification);
\r
129 void SetAStyle(int style, COLORREF fore, COLORREF back=::GetSysColor(COLOR_WINDOW), int size=-1, CString *face=0);
\r
131 void InitialiseEditor();
\r
133 LONG GetBlameWidth();
\r
134 void DrawBlame(HDC hDC);
\r
135 void DrawHeader(HDC hDC);
\r
136 void DrawLocatorBar(HDC hDC);
\r
137 void StartSearch();
\r
138 void CopySelectedLogToClipboard();
\r
139 void BlamePreviousRevision();
\r
140 void DiffPreviousRevision();
\r
142 bool DoSearch(CString what, DWORD flags);
\r
143 bool GotoLine(long line);
\r
144 bool ScrollToLine(long line);
\r
145 void GotoLineDlg();
\r
146 static INT_PTR CALLBACK GotoDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
\r
148 void SetSelectedLine(LONG line) { m_SelectedLine=line;};
\r
152 LONG m_selectedrev;
\r
153 LONG m_selectedorigrev;
\r
154 CString m_SelectedHash;
\r
155 CString m_selecteddate;
\r
156 static long m_gotoline;
\r
161 // std::vector<bool> m_Mergelines;
\r
162 std::vector<LONG> m_ID;
\r
163 std::vector<LONG> m_LineNum;
\r
164 // std::vector<LONG> m_Origrevs;
\r
165 std::vector<CString> m_Dates;
\r
166 std::vector<CString> m_Authors;
\r
167 std::vector<CString> m_CommitHash;
\r
169 // std::vector<CString> m_Paths;
\r
170 // std::map<LONG, CString> logmessages;
\r
171 char m_szTip[MAX_LOG_LENGTH*2+6];
\r
172 wchar_t m_wszTip[MAX_LOG_LENGTH*2+6];
\r
173 void StringExpand(LPSTR str);
\r
174 void StringExpand(LPWSTR str);
\r
177 CLogDataVector * GetLogData();
\r
183 void SetupLexer(CString filename);
\r
184 void SetupCppLexer();
\r
185 COLORREF InterColor(COLORREF c1, COLORREF c2, int Slider);
\r
186 CString GetAppDirectory();
\r
187 std::vector<COLORREF> colors;
\r
189 HFONT m_italicfont;
\r
193 LONG m_authorwidth;
\r
196 LONG m_SelectedLine; ///< zero-based
\r
198 COLORREF m_mouserevcolor;
\r
199 COLORREF m_mouseauthorcolor;
\r
200 COLORREF m_selectedrevcolor;
\r
201 COLORREF m_selectedauthorcolor;
\r
202 COLORREF m_windowcolor;
\r
203 COLORREF m_textcolor;
\r
204 COLORREF m_texthighlightcolor;
\r
206 LRESULT m_directFunction;
\r
207 LRESULT m_directPointer;
\r
209 TCHAR szFindWhat[80];
\r
211 CRegStdWORD m_regOldLinesColor;
\r
212 CRegStdWORD m_regNewLinesColor;
\r
214 CGitBlameLogList * GetLogList();
\r
216 CFindReplaceDialog *m_pFindDialog;
\r
220 #ifndef _DEBUG // debug version in TortoiseGitBlameView.cpp
\r
221 inline CTortoiseGitBlameDoc* CTortoiseGitBlameView::GetDocument() const
\r
222 { return reinterpret_cast<CTortoiseGitBlameDoc*>(m_pDocument); }
\r