OSDN Git Service

blame sync with context
[tortoisegit/TortoiseGitJp.git] / src / TortoiseGitBlame / TortoiseGitBlameView.h
1 \r
2 // TortoiseGitBlameView.h : interface of the CTortoiseGitBlameView class\r
3 //\r
4 \r
5 \r
6 #pragma once\r
7 \r
8 #include "Scintilla.h"\r
9 #include "SciLexer.h"\r
10 #include "registry.h"\r
11 #include "SciEdit.h"\r
12 \r
13 #include "GitBlameLogList.h"\r
14 \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
23 \r
24 #define BLAMESPACE 20\r
25 #define HEADER_HEIGHT 18\r
26 #define LOCATOR_WIDTH 20\r
27 \r
28 #define MAX_LOG_LENGTH 2000\r
29 \r
30 \r
31 #ifndef GET_X_LPARAM\r
32 #define GET_X_LPARAM(lp)                        ((int)(short)LOWORD(lp))\r
33 #endif\r
34 #ifndef GET_Y_LPARAM\r
35 #define GET_Y_LPARAM(lp)                        ((int)(short)HIWORD(lp))\r
36 #endif\r
37 \r
38 \r
39 class CTortoiseGitBlameView : public CView\r
40 {\r
41 protected: // create from serialization only\r
42         CTortoiseGitBlameView();\r
43         DECLARE_DYNCREATE(CTortoiseGitBlameView)\r
44 \r
45 // Attributes\r
46 public:\r
47         CTortoiseGitBlameDoc* GetDocument() const;\r
48 \r
49 // Operations\r
50 public:\r
51 \r
52 // Overrides\r
53 public:\r
54         virtual void OnDraw(CDC* pDC);  // overridden to draw this view\r
55         virtual BOOL PreCreateWindow(CREATESTRUCT& cs);\r
56 protected:\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
60 \r
61 // Implementation\r
62 public:\r
63         virtual ~CTortoiseGitBlameView();\r
64 #ifdef _DEBUG\r
65         virtual void AssertValid() const;\r
66         virtual void Dump(CDumpContext& dc) const;\r
67 #endif\r
68 \r
69 protected:\r
70 \r
71 // Generated message map functions\r
72 protected:\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
80 \r
81 public:\r
82 \r
83         void UpdateInfo();\r
84 \r
85         CSciEdit                        m_TextView;\r
86 \r
87         HINSTANCE hInstance;\r
88         HINSTANCE hResource;\r
89         HWND currentDialog;\r
90         HWND wMain;\r
91         HWND m_wEditor;\r
92         HWND wBlame;\r
93         HWND wHeader;\r
94         HWND wLocator;\r
95         HWND hwndTT;\r
96 \r
97         BOOL bIgnoreEOL;\r
98         BOOL bIgnoreSpaces;\r
99         BOOL bIgnoreAllSpaces;\r
100 \r
101         LRESULT SendEditor(UINT Msg, WPARAM wParam=0, LPARAM lParam=0);\r
102 \r
103         void GetRange(int start, int end, char *text);\r
104 \r
105         void SetTitle();\r
106         BOOL OpenFile(const char *fileName);\r
107         BOOL OpenLogFile(const char *fileName);\r
108 \r
109         void Command(int id);\r
110         void Notify(SCNotification *notification);\r
111 \r
112         void SetAStyle(int style, COLORREF fore, COLORREF back=::GetSysColor(COLOR_WINDOW), int size=-1, CString *face=0);\r
113 \r
114         void InitialiseEditor();\r
115     void InitSize();\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
124         void ShowLog();\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
130 \r
131         void SetSelectedLine(LONG line) { m_SelectedLine=line;};\r
132 \r
133         LONG                                            m_mouserev;\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
140         long                                            m_lowestrev;\r
141         long                                            m_highestrev;\r
142         bool                                            m_colorage;\r
143 \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
151 \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
158         BOOL                                            ttVisible;\r
159 \r
160         CLogDataVector *                GetLogData();\r
161 \r
162         BOOL m_bShowLine;\r
163 \r
164 protected:\r
165         void CreateFont();\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
171         HFONT                                           m_font;\r
172         HFONT                                           m_italicfont;\r
173         LONG                                            m_blamewidth;\r
174         LONG                                            m_revwidth;\r
175         LONG                                            m_datewidth;\r
176         LONG                                            m_authorwidth;\r
177         LONG                                            m_pathwidth;\r
178         LONG                                            m_linewidth;\r
179         LONG                                            m_SelectedLine; ///< zero-based\r
180 \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
188 \r
189         LRESULT                                         m_directFunction;\r
190         LRESULT                                         m_directPointer;\r
191         FINDREPLACE                                     fr;\r
192         TCHAR                                           szFindWhat[80];\r
193 \r
194         CRegStdWORD                                     m_regOldLinesColor;\r
195         CRegStdWORD                                     m_regNewLinesColor;\r
196 \r
197 };\r
198 \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
202 #endif\r
203 \r