do not hardcode path for "Common Files\Merge Modules" on all platforms
[TortoiseGit.git] / src / TortoiseBlame / TortoiseBlame.h
blobd6a361bf4b7dca2d6c6a3046bfbbf5b1641a26cd
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.
18 #pragma once
20 #include "resource.h"
21 #include "Commdlg.h"
22 #include "Scintilla.h"
23 #include "SciLexer.h"
24 #include "registry.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;
35 #define BLAMESPACE 20
36 #define HEADER_HEIGHT 18
37 #define LOCATOR_WIDTH 20
39 #define MAX_LOG_LENGTH 2000
42 #ifndef GET_X_LPARAM
43 #define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp))
44 #endif
45 #ifndef GET_Y_LPARAM
46 #define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp))
47 #endif
49 /**
50 * \ingroup TortoiseBlame
51 * Main class for TortoiseBlame.
52 * Handles all child windows, loads the blame files, ...
54 class TortoiseBlame
56 public:
57 TortoiseBlame();
58 ~TortoiseBlame();
60 HINSTANCE hInstance;
61 HINSTANCE hResource;
62 HWND currentDialog;
63 HWND wMain;
64 HWND wEditor;
65 HWND wBlame;
66 HWND wHeader;
67 HWND wLocator;
68 HWND hwndTT;
70 BOOL bIgnoreEOL;
71 BOOL bIgnoreSpaces;
72 BOOL bIgnoreAllSpaces;
74 LRESULT SendEditor(UINT Msg, WPARAM wParam=0, LPARAM lParam=0);
76 void GetRange(int start, int end, char *text);
78 void SetTitle();
79 BOOL OpenFile(const char *fileName);
80 BOOL OpenLogFile(const char *fileName);
82 void Command(int id);
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();
87 void InitSize();
88 LONG GetBlameWidth();
89 void DrawBlame(HDC hDC);
90 void DrawHeader(HDC hDC);
91 void DrawLocatorBar(HDC hDC);
92 void StartSearch();
93 void CopySelectedLogToClipboard();
94 void BlamePreviousRevision();
95 void DiffPreviousRevision();
96 void ShowLog();
97 bool DoSearch(LPSTR what, DWORD flags);
98 bool GotoLine(long line);
99 bool ScrollToLine(long line);
100 void GotoLineDlg();
101 static INT_PTR CALLBACK GotoDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
103 void SetSelectedLine(LONG line) { m_SelectedLine=line;};
105 LONG m_mouserev;
106 std::string m_mouseauthor;
107 LONG m_selectedrev;
108 LONG m_selectedorigrev;
109 std::string m_selectedauthor;
110 std::string m_selecteddate;
111 static long m_gotoline;
112 long m_lowestrev;
113 long m_highestrev;
114 bool m_colorage;
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);
127 BOOL ttVisible;
128 protected:
129 void CreateFont();
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;
135 HFONT m_font;
136 HFONT m_italicfont;
137 LONG m_blamewidth;
138 LONG m_revwidth;
139 LONG m_datewidth;
140 LONG m_authorwidth;
141 LONG m_pathwidth;
142 LONG m_linewidth;
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;
155 FINDREPLACE fr;
156 TCHAR szFindWhat[80];
158 CRegStdWORD m_regOldLinesColor;
159 CRegStdWORD m_regNewLinesColor;