OSDN Git Service

remove igit and libiconv2.dll at install script
[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 #include "Balloon.h"\r
15 \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
24 \r
25 #define BLAMESPACE 5\r
26 #define HEADER_HEIGHT 18\r
27 #define LOCATOR_WIDTH 10\r
28 \r
29 #define MAX_LOG_LENGTH 2000\r
30 \r
31 \r
32 #ifndef GET_X_LPARAM\r
33 #define GET_X_LPARAM(lp)                        ((int)(short)LOWORD(lp))\r
34 #endif\r
35 #ifndef GET_Y_LPARAM\r
36 #define GET_Y_LPARAM(lp)                        ((int)(short)HIWORD(lp))\r
37 #endif\r
38 \r
39 class CSciEditBlame: public CSciEdit\r
40 {\r
41         DECLARE_DYNAMIC(CSciEditBlame)\r
42 public:\r
43         afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)\r
44         {\r
45                 switch (nChar)\r
46                 {\r
47                         case (VK_ESCAPE):\r
48                         {\r
49                                 if ((Call(SCI_AUTOCACTIVE)==0)&&(Call(SCI_CALLTIPACTIVE)==0))\r
50                                 {\r
51                                         ::SendMessage(::AfxGetApp()->GetMainWnd()->m_hWnd, WM_CLOSE, 0, 0);\r
52                                         return;\r
53                                 }\r
54                         }\r
55                         break;\r
56                 }\r
57                 CWnd::OnKeyDown(nChar, nRepCnt, nFlags);\r
58         }\r
59 };\r
60 \r
61 class CTortoiseGitBlameView : public CView\r
62 {\r
63 protected: // create from serialization only\r
64         CTortoiseGitBlameView();\r
65         DECLARE_DYNCREATE(CTortoiseGitBlameView)\r
66 \r
67 // Attributes\r
68 public:\r
69         CTortoiseGitBlameDoc* GetDocument() const;\r
70 \r
71 // Operations\r
72 public:\r
73 \r
74 // Overrides\r
75 public:\r
76         virtual void OnDraw(CDC* pDC);  // overridden to draw this view\r
77         virtual BOOL PreCreateWindow(CREATESTRUCT& cs);\r
78 protected:\r
79         virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);\r
80         virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);\r
81         virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);\r
82 \r
83 // Implementation\r
84 public:\r
85         virtual ~CTortoiseGitBlameView();\r
86 #ifdef _DEBUG\r
87         virtual void AssertValid() const;\r
88         virtual void Dump(CDumpContext& dc) const;\r
89 #endif\r
90 \r
91 protected:\r
92 \r
93 // Generated message map functions\r
94 protected:\r
95         BOOL PreTranslateMessage(MSG* pMsg);\r
96         afx_msg void OnEditFind();\r
97         afx_msg void OnEditGoto();\r
98         afx_msg void OnFilePrintPreview();\r
99         afx_msg void OnRButtonUp(UINT nFlags, CPoint point);\r
100         afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);\r
101         afx_msg int OnCreate(LPCREATESTRUCT lpcs);\r
102         afx_msg void OnSize(UINT nType, int cx, int cy);\r
103         afx_msg void OnSciPainted(NMHDR*, LRESULT*);\r
104         afx_msg void OnLButtonDown(UINT nFlags,CPoint point);\r
105         afx_msg void OnRButtonDown(UINT nFlags,CPoint point){OnLButtonDown(nFlags,point);CView::OnRButtonDown(nFlags,point);};\r
106         afx_msg void OnSciGetBkColor(NMHDR*, LRESULT*);\r
107         afx_msg void OnMouseHover(UINT nFlags, CPoint point);\r
108         afx_msg void OnMouseMove(UINT nFlags, CPoint point);\r
109     afx_msg LRESULT OnFindDialogMessage(WPARAM   wParam,   LPARAM   lParam);\r
110         afx_msg void OnViewNext();\r
111         afx_msg void OnViewPrev();\r
112         \r
113         int FindNextLine(CString commithash, bool bUpOrDown=false);\r
114         int FindFirstLine(CString commithash, int line)\r
115         {\r
116                 while(line>=0)\r
117                 {\r
118                         if( m_CommitHash[line] != commithash )\r
119                         {\r
120                                 return line++;\r
121                         }\r
122                         line--;\r
123                 }\r
124                 return line;\r
125         }\r
126 \r
127         DECLARE_MESSAGE_MAP()\r
128 \r
129     static UINT m_FindDialogMessage;\r
130 public:\r
131 \r
132         void UpdateInfo();\r
133         void FocusOn(GitRev *pRev);\r
134 \r
135         CSciEditBlame           m_TextView;\r
136         CBalloon                        m_ToolTip;\r
137 \r
138         HINSTANCE hInstance;\r
139         HINSTANCE hResource;\r
140         HWND currentDialog;\r
141         HWND wMain;\r
142         HWND m_wEditor;\r
143         HWND wBlame;\r
144         HWND wHeader;\r
145         HWND wLocator;\r
146         HWND hwndTT;\r
147 \r
148         BOOL bIgnoreEOL;\r
149         BOOL bIgnoreSpaces;\r
150         BOOL bIgnoreAllSpaces;\r
151 \r
152         BOOL m_bShowAuthor;\r
153         BOOL m_bShowDate;\r
154 \r
155 \r
156         LRESULT SendEditor(UINT Msg, WPARAM wParam=0, LPARAM lParam=0);\r
157 \r
158         void GetRange(int start, int end, char *text);\r
159 \r
160         void SetTitle();\r
161         BOOL OpenFile(const char *fileName);\r
162         BOOL OpenLogFile(const char *fileName);\r
163 \r
164         void Command(int id);\r
165         void Notify(SCNotification *notification);\r
166 \r
167         void SetAStyle(int style, COLORREF fore, COLORREF back=::GetSysColor(COLOR_WINDOW), int size=-1, CString *face=0);\r
168 \r
169         void InitialiseEditor();\r
170     void InitSize();\r
171         LONG GetBlameWidth();\r
172         void DrawBlame(HDC hDC);\r
173         void DrawHeader(HDC hDC);\r
174         void DrawLocatorBar(HDC hDC);\r
175         void StartSearch();\r
176         void CopySelectedLogToClipboard();\r
177         void BlamePreviousRevision();\r
178         void DiffPreviousRevision();\r
179         void ShowLog();\r
180         bool DoSearch(CString what, DWORD flags);\r
181         bool GotoLine(long line);\r
182         bool ScrollToLine(long line);\r
183         void GotoLineDlg();\r
184         static INT_PTR CALLBACK GotoDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);\r
185 \r
186         void SetSelectedLine(LONG line) { m_SelectedLine=line;};\r
187 \r
188         LONG                                            m_mouserev;\r
189         LONG                                            m_MouseLine;\r
190         LONG                                            m_selectedrev;\r
191         LONG                                            m_selectedorigrev;\r
192         CString                                         m_SelectedHash;\r
193         CString                                         m_selecteddate;\r
194         static long                                     m_gotoline;\r
195         long                                            m_lowestrev;\r
196         long                                            m_highestrev;\r
197         bool                                            m_colorage;\r
198 \r
199 //      std::vector<bool>               m_Mergelines;\r
200         std::vector<LONG>               m_ID;\r
201         std::vector<LONG>               m_LineNum;\r
202 //      std::vector<LONG>               m_Origrevs;\r
203         std::vector<CString>    m_Dates;\r
204         std::vector<CString>    m_Authors;\r
205         std::vector<CString>    m_CommitHash;\r
206 \r
207         std::map<CString,GitRev> m_NoListCommit;\r
208 \r
209 //      std::vector<CString>    m_Paths;\r
210 //      std::map<LONG, CString> logmessages;\r
211         char                                            m_szTip[MAX_LOG_LENGTH*2+6];\r
212         wchar_t                                         m_wszTip[MAX_LOG_LENGTH*2+6];\r
213         void StringExpand(LPSTR str);\r
214         void StringExpand(LPWSTR str);\r
215         BOOL                                            ttVisible;\r
216 \r
217         CLogDataVector *                GetLogData();\r
218 \r
219         BOOL m_bShowLine;\r
220 \r
221 protected:\r
222         void CreateFont();\r
223         void SetupLexer(CString filename);\r
224         void SetupCppLexer();\r
225         COLORREF InterColor(COLORREF c1, COLORREF c2, int Slider);\r
226         CString GetAppDirectory();\r
227         std::vector<COLORREF>           colors;\r
228         HFONT                                           m_font;\r
229         HFONT                                           m_italicfont;\r
230         LONG                                            m_blamewidth;\r
231         LONG                                            m_revwidth;\r
232         LONG                                            m_datewidth;\r
233         LONG                                            m_authorwidth;\r
234         LONG                                            m_pathwidth;\r
235         LONG                                            m_linewidth;\r
236         LONG                                            m_SelectedLine; ///< zero-based\r
237 \r
238         COLORREF                                        m_mouserevcolor;\r
239         COLORREF                                        m_mouseauthorcolor;\r
240         COLORREF                                        m_selectedrevcolor;\r
241         COLORREF                                        m_selectedauthorcolor;\r
242         COLORREF                                        m_windowcolor;\r
243         COLORREF                                        m_textcolor;\r
244         COLORREF                                        m_texthighlightcolor;\r
245 \r
246         LRESULT                                         m_directFunction;\r
247         LRESULT                                         m_directPointer;\r
248         FINDREPLACE                                     fr;\r
249         TCHAR                                           szFindWhat[80];\r
250 \r
251         CRegStdWORD                                     m_regOldLinesColor;\r
252         CRegStdWORD                                     m_regNewLinesColor;\r
253 \r
254         CGitBlameLogList * GetLogList();\r
255 \r
256     CFindReplaceDialog          *m_pFindDialog;\r
257 \r
258         DWORD                                           m_DateFormat;   // DATE_SHORTDATE or DATE_LONGDATE\r
259 };\r
260 \r
261 #ifndef _DEBUG  // debug version in TortoiseGitBlameView.cpp\r
262 inline CTortoiseGitBlameDoc* CTortoiseGitBlameView::GetDocument() const\r
263    { return reinterpret_cast<CTortoiseGitBlameDoc*>(m_pDocument); }\r
264 #endif\r
265 \r