OSDN Git Service

Add SCI Edit to GitBlameView
[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 \r
14 const COLORREF black = RGB(0,0,0);\r
15 const COLORREF white = RGB(0xff,0xff,0xff);\r
16 const COLORREF red = RGB(0xFF, 0, 0);\r
17 const COLORREF offWhite = RGB(0xFF, 0xFB, 0xF0);\r
18 const COLORREF darkGreen = RGB(0, 0x80, 0);\r
19 const COLORREF darkBlue = RGB(0, 0, 0x80);\r
20 const COLORREF lightBlue = RGB(0xA6, 0xCA, 0xF0);\r
21 const int blockSize = 128 * 1024;\r
22 \r
23 #define BLAMESPACE 20\r
24 #define HEADER_HEIGHT 18\r
25 #define LOCATOR_WIDTH 20\r
26 \r
27 #define MAX_LOG_LENGTH 2000\r
28 \r
29 \r
30 #ifndef GET_X_LPARAM\r
31 #define GET_X_LPARAM(lp)                        ((int)(short)LOWORD(lp))\r
32 #endif\r
33 #ifndef GET_Y_LPARAM\r
34 #define GET_Y_LPARAM(lp)                        ((int)(short)HIWORD(lp))\r
35 #endif\r
36 \r
37 \r
38 class CTortoiseGitBlameView : public CView\r
39 {\r
40 protected: // create from serialization only\r
41         CTortoiseGitBlameView();\r
42         DECLARE_DYNCREATE(CTortoiseGitBlameView)\r
43 \r
44 // Attributes\r
45 public:\r
46         CTortoiseGitBlameDoc* GetDocument() const;\r
47 \r
48 // Operations\r
49 public:\r
50 \r
51 // Overrides\r
52 public:\r
53         virtual void OnDraw(CDC* pDC);  // overridden to draw this view\r
54         virtual BOOL PreCreateWindow(CREATESTRUCT& cs);\r
55 protected:\r
56         virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);\r
57         virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);\r
58         virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);\r
59 \r
60 // Implementation\r
61 public:\r
62         virtual ~CTortoiseGitBlameView();\r
63 #ifdef _DEBUG\r
64         virtual void AssertValid() const;\r
65         virtual void Dump(CDumpContext& dc) const;\r
66 #endif\r
67 \r
68 protected:\r
69 \r
70 // Generated message map functions\r
71 protected:\r
72         afx_msg void OnFilePrintPreview();\r
73         afx_msg void OnRButtonUp(UINT nFlags, CPoint point);\r
74         afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);\r
75         afx_msg int OnCreate(LPCREATESTRUCT lpcs);\r
76         afx_msg void OnSize(UINT nType, int cx, int cy);\r
77 \r
78         DECLARE_MESSAGE_MAP()\r
79 \r
80 public:\r
81 \r
82         CSciEdit                        m_TextView;\r
83 \r
84         HINSTANCE hInstance;\r
85         HINSTANCE hResource;\r
86         HWND currentDialog;\r
87         HWND wMain;\r
88         HWND wEditor;\r
89         HWND wBlame;\r
90         HWND wHeader;\r
91         HWND wLocator;\r
92         HWND hwndTT;\r
93 \r
94         BOOL bIgnoreEOL;\r
95         BOOL bIgnoreSpaces;\r
96         BOOL bIgnoreAllSpaces;\r
97 \r
98         LRESULT SendEditor(UINT Msg, WPARAM wParam=0, LPARAM lParam=0);\r
99 \r
100         void GetRange(int start, int end, char *text);\r
101 \r
102         void SetTitle();\r
103         BOOL OpenFile(const char *fileName);\r
104         BOOL OpenLogFile(const char *fileName);\r
105 \r
106         void Command(int id);\r
107         void Notify(SCNotification *notification);\r
108 \r
109         void SetAStyle(int style, COLORREF fore, COLORREF back=::GetSysColor(COLOR_WINDOW), int size=-1, const char *face=0);\r
110         void InitialiseEditor();\r
111     void InitSize();\r
112         LONG GetBlameWidth();\r
113         void DrawBlame(HDC hDC);\r
114         void DrawHeader(HDC hDC);\r
115         void DrawLocatorBar(HDC hDC);\r
116         void StartSearch();\r
117         void CopySelectedLogToClipboard();\r
118         void BlamePreviousRevision();\r
119         void DiffPreviousRevision();\r
120         void ShowLog();\r
121         bool DoSearch(LPSTR what, DWORD flags);\r
122         bool GotoLine(long line);\r
123         bool ScrollToLine(long line);\r
124         void GotoLineDlg();\r
125         static INT_PTR CALLBACK GotoDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);\r
126 \r
127         void SetSelectedLine(LONG line) { m_SelectedLine=line;};\r
128 \r
129         LONG                                            m_mouserev;\r
130         CString                                 m_mouseauthor;\r
131         LONG                                            m_selectedrev;\r
132         LONG                                            m_selectedorigrev;\r
133         CString                                 m_selectedauthor;\r
134         CString                                 m_selecteddate;\r
135         static long                                     m_gotoline;\r
136         long                                            m_lowestrev;\r
137         long                                            m_highestrev;\r
138         bool                                            m_colorage;\r
139 \r
140         std::vector<bool>                       mergelines;\r
141         std::vector<LONG>                       revs;\r
142         std::vector<LONG>                       origrevs;\r
143         std::vector<CString>    dates;\r
144         std::vector<CString>    authors;\r
145         std::vector<CString>    paths;\r
146         std::map<LONG, CString> logmessages;\r
147         char                                            m_szTip[MAX_LOG_LENGTH*2+6];\r
148         wchar_t                                         m_wszTip[MAX_LOG_LENGTH*2+6];\r
149         void StringExpand(LPSTR str);\r
150         void StringExpand(LPWSTR str);\r
151         BOOL                                            ttVisible;\r
152 protected:\r
153         void CreateFont();\r
154         void SetupLexer(LPCSTR filename);\r
155         void SetupCppLexer();\r
156         COLORREF InterColor(COLORREF c1, COLORREF c2, int Slider);\r
157         CString GetAppDirectory();\r
158         std::vector<COLORREF>           colors;\r
159         HFONT                                           m_font;\r
160         HFONT                                           m_italicfont;\r
161         LONG                                            m_blamewidth;\r
162         LONG                                            m_revwidth;\r
163         LONG                                            m_datewidth;\r
164         LONG                                            m_authorwidth;\r
165         LONG                                            m_pathwidth;\r
166         LONG                                            m_linewidth;\r
167         LONG                                            m_SelectedLine; ///< zero-based\r
168 \r
169         COLORREF                                        m_mouserevcolor;\r
170         COLORREF                                        m_mouseauthorcolor;\r
171         COLORREF                                        m_selectedrevcolor;\r
172         COLORREF                                        m_selectedauthorcolor;\r
173         COLORREF                                        m_windowcolor;\r
174         COLORREF                                        m_textcolor;\r
175         COLORREF                                        m_texthighlightcolor;\r
176 \r
177         LRESULT                                         m_directFunction;\r
178         LRESULT                                         m_directPointer;\r
179         FINDREPLACE                                     fr;\r
180         TCHAR                                           szFindWhat[80];\r
181 \r
182         CRegStdWORD                                     m_regOldLinesColor;\r
183         CRegStdWORD                                     m_regNewLinesColor;\r
184 \r
185 };\r
186 \r
187 #ifndef _DEBUG  // debug version in TortoiseGitBlameView.cpp\r
188 inline CTortoiseGitBlameDoc* CTortoiseGitBlameView::GetDocument() const\r
189    { return reinterpret_cast<CTortoiseGitBlameDoc*>(m_pDocument); }\r
190 #endif\r
191 \r