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 afx_msg void OnViewNext();
\r
90 afx_msg void OnViewPrev();
\r
92 int FindNextLine(CString commithash, bool bUpOrDown=false);
\r
93 int FindFirstLine(CString commithash, int line)
\r
97 if( m_CommitHash[line] != commithash )
\r
106 DECLARE_MESSAGE_MAP()
\r
108 static UINT m_FindDialogMessage;
\r
112 void FocusOn(GitRev *pRev);
\r
114 CSciEdit m_TextView;
\r
115 CBalloon m_ToolTip;
\r
117 HINSTANCE hInstance;
\r
118 HINSTANCE hResource;
\r
119 HWND currentDialog;
\r
128 BOOL bIgnoreSpaces;
\r
129 BOOL bIgnoreAllSpaces;
\r
131 BOOL m_bShowAuthor;
\r
135 LRESULT SendEditor(UINT Msg, WPARAM wParam=0, LPARAM lParam=0);
\r
137 void GetRange(int start, int end, char *text);
\r
140 BOOL OpenFile(const char *fileName);
\r
141 BOOL OpenLogFile(const char *fileName);
\r
143 void Command(int id);
\r
144 void Notify(SCNotification *notification);
\r
146 void SetAStyle(int style, COLORREF fore, COLORREF back=::GetSysColor(COLOR_WINDOW), int size=-1, CString *face=0);
\r
148 void InitialiseEditor();
\r
150 LONG GetBlameWidth();
\r
151 void DrawBlame(HDC hDC);
\r
152 void DrawHeader(HDC hDC);
\r
153 void DrawLocatorBar(HDC hDC);
\r
154 void StartSearch();
\r
155 void CopySelectedLogToClipboard();
\r
156 void BlamePreviousRevision();
\r
157 void DiffPreviousRevision();
\r
159 bool DoSearch(CString what, DWORD flags);
\r
160 bool GotoLine(long line);
\r
161 bool ScrollToLine(long line);
\r
162 void GotoLineDlg();
\r
163 static INT_PTR CALLBACK GotoDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
\r
165 void SetSelectedLine(LONG line) { m_SelectedLine=line;};
\r
169 LONG m_selectedrev;
\r
170 LONG m_selectedorigrev;
\r
171 CString m_SelectedHash;
\r
172 CString m_selecteddate;
\r
173 static long m_gotoline;
\r
178 // std::vector<bool> m_Mergelines;
\r
179 std::vector<LONG> m_ID;
\r
180 std::vector<LONG> m_LineNum;
\r
181 // std::vector<LONG> m_Origrevs;
\r
182 std::vector<CString> m_Dates;
\r
183 std::vector<CString> m_Authors;
\r
184 std::vector<CString> m_CommitHash;
\r
186 std::map<CString,GitRev> m_NoListCommit;
\r
188 // std::vector<CString> m_Paths;
\r
189 // std::map<LONG, CString> logmessages;
\r
190 char m_szTip[MAX_LOG_LENGTH*2+6];
\r
191 wchar_t m_wszTip[MAX_LOG_LENGTH*2+6];
\r
192 void StringExpand(LPSTR str);
\r
193 void StringExpand(LPWSTR str);
\r
196 CLogDataVector * GetLogData();
\r
202 void SetupLexer(CString filename);
\r
203 void SetupCppLexer();
\r
204 COLORREF InterColor(COLORREF c1, COLORREF c2, int Slider);
\r
205 CString GetAppDirectory();
\r
206 std::vector<COLORREF> colors;
\r
208 HFONT m_italicfont;
\r
212 LONG m_authorwidth;
\r
215 LONG m_SelectedLine; ///< zero-based
\r
217 COLORREF m_mouserevcolor;
\r
218 COLORREF m_mouseauthorcolor;
\r
219 COLORREF m_selectedrevcolor;
\r
220 COLORREF m_selectedauthorcolor;
\r
221 COLORREF m_windowcolor;
\r
222 COLORREF m_textcolor;
\r
223 COLORREF m_texthighlightcolor;
\r
225 LRESULT m_directFunction;
\r
226 LRESULT m_directPointer;
\r
228 TCHAR szFindWhat[80];
\r
230 CRegStdWORD m_regOldLinesColor;
\r
231 CRegStdWORD m_regNewLinesColor;
\r
233 CGitBlameLogList * GetLogList();
\r
235 CFindReplaceDialog *m_pFindDialog;
\r
237 DWORD m_DateFormat; // DATE_SHORTDATE or DATE_LONGDATE
\r
240 #ifndef _DEBUG // debug version in TortoiseGitBlameView.cpp
\r
241 inline CTortoiseGitBlameDoc* CTortoiseGitBlameView::GetDocument() const
\r
242 { return reinterpret_cast<CTortoiseGitBlameDoc*>(m_pDocument); }
\r