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