1 // TortoiseBlame - a Viewer for Subversion Blames
\r
3 // Copyright (C) 2003-2008 - TortoiseSVN
\r
5 // This program is free software; you can redistribute it and/or
\r
6 // modify it under the terms of the GNU General Public License
\r
7 // as published by the Free Software Foundation; either version 2
\r
8 // of the License, or (at your option) any later version.
\r
10 // This program is distributed in the hope that it will be useful,
\r
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
13 // GNU General Public License for more details.
\r
15 // You should have received a copy of the GNU General Public License
\r
16 // along with this program; if not, write to the Free Software Foundation,
\r
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
\r
20 #include "resource.h"
\r
21 #include "Commdlg.h"
\r
22 #include "Scintilla.h"
\r
23 #include "SciLexer.h"
\r
24 #include "registry.h"
\r
26 const COLORREF black = RGB(0,0,0);
\r
27 const COLORREF white = RGB(0xff,0xff,0xff);
\r
28 const COLORREF red = RGB(0xFF, 0, 0);
\r
29 const COLORREF offWhite = RGB(0xFF, 0xFB, 0xF0);
\r
30 const COLORREF darkGreen = RGB(0, 0x80, 0);
\r
31 const COLORREF darkBlue = RGB(0, 0, 0x80);
\r
32 const COLORREF lightBlue = RGB(0xA6, 0xCA, 0xF0);
\r
33 const int blockSize = 128 * 1024;
\r
35 #define BLAMESPACE 20
\r
36 #define HEADER_HEIGHT 18
\r
37 #define LOCATOR_WIDTH 20
\r
39 #define MAX_LOG_LENGTH 2000
\r
42 #ifndef GET_X_LPARAM
\r
43 #define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp))
\r
45 #ifndef GET_Y_LPARAM
\r
46 #define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp))
\r
50 * \ingroup TortoiseBlame
\r
51 * Main class for TortoiseBlame.
\r
52 * Handles all child windows, loads the blame files, ...
\r
60 HINSTANCE hInstance;
\r
61 HINSTANCE hResource;
\r
72 BOOL bIgnoreAllSpaces;
\r
74 LRESULT SendEditor(UINT Msg, WPARAM wParam=0, LPARAM lParam=0);
\r
76 void GetRange(int start, int end, char *text);
\r
79 BOOL OpenFile(const char *fileName);
\r
80 BOOL OpenLogFile(const char *fileName);
\r
82 void Command(int id);
\r
83 void Notify(SCNotification *notification);
\r
85 void SetAStyle(int style, COLORREF fore, COLORREF back=::GetSysColor(COLOR_WINDOW), int size=-1, const char *face=0);
\r
86 void InitialiseEditor();
\r
88 LONG GetBlameWidth();
\r
89 void DrawBlame(HDC hDC);
\r
90 void DrawHeader(HDC hDC);
\r
91 void DrawLocatorBar(HDC hDC);
\r
93 void CopySelectedLogToClipboard();
\r
94 void BlamePreviousRevision();
\r
95 void DiffPreviousRevision();
\r
97 bool DoSearch(LPSTR what, DWORD flags);
\r
98 bool GotoLine(long line);
\r
99 bool ScrollToLine(long line);
\r
100 void GotoLineDlg();
\r
101 static INT_PTR CALLBACK GotoDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
\r
103 void SetSelectedLine(LONG line) { m_SelectedLine=line;};
\r
106 std::string m_mouseauthor;
\r
107 LONG m_selectedrev;
\r
108 LONG m_selectedorigrev;
\r
109 std::string m_selectedauthor;
\r
110 std::string m_selecteddate;
\r
111 static long m_gotoline;
\r
116 std::vector<bool> mergelines;
\r
117 std::vector<LONG> revs;
\r
118 std::vector<LONG> origrevs;
\r
119 std::vector<std::string> dates;
\r
120 std::vector<std::string> authors;
\r
121 std::vector<std::string> paths;
\r
122 std::map<LONG, std::string> logmessages;
\r
123 char m_szTip[MAX_LOG_LENGTH*2+6];
\r
124 wchar_t m_wszTip[MAX_LOG_LENGTH*2+6];
\r
125 void StringExpand(LPSTR str);
\r
126 void StringExpand(LPWSTR str);
\r
130 void SetupLexer(LPCSTR filename);
\r
131 void SetupCppLexer();
\r
132 COLORREF InterColor(COLORREF c1, COLORREF c2, int Slider);
\r
133 std::string GetAppDirectory();
\r
134 std::vector<COLORREF> colors;
\r
136 HFONT m_italicfont;
\r
140 LONG m_authorwidth;
\r
143 LONG m_SelectedLine; ///< zero-based
\r
145 COLORREF m_mouserevcolor;
\r
146 COLORREF m_mouseauthorcolor;
\r
147 COLORREF m_selectedrevcolor;
\r
148 COLORREF m_selectedauthorcolor;
\r
149 COLORREF m_windowcolor;
\r
150 COLORREF m_textcolor;
\r
151 COLORREF m_texthighlightcolor;
\r
153 LRESULT m_directFunction;
\r
154 LRESULT m_directPointer;
\r
156 TCHAR szFindWhat[80];
\r
158 CRegStdWORD m_regOldLinesColor;
\r
159 CRegStdWORD m_regNewLinesColor;
\r