OSDN Git Service

Fix Un-rev Group problem.
[tortoisegit/TortoiseGitJp.git] / src / TortoiseBlame / Lexer.cpp
1 // TortoiseBlame - a Viewer for Subversion Blames\r
2 \r
3 // Copyright (C) 2003-2008 - TortoiseSVN\r
4 \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
9 \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
14 \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
18 #include "stdafx.h"\r
19 \r
20 // disable "dead code eleminated" warning\r
21 #pragma warning(disable:4505)\r
22 \r
23 #include "TortoiseBlame.h"\r
24 \r
25 void TortoiseBlame::SetupLexer(LPCSTR filename)\r
26 {\r
27         char line[20];\r
28         const char * lineptr = _tcsrchr(filename, '.');\r
29 \r
30         if (lineptr)\r
31         {\r
32                 _tcscpy_s(line, 20, lineptr+1);\r
33                 _tcslwr_s(line, 20);\r
34                 if ((_tcscmp(line, _T("py"))==0)||\r
35                         (_tcscmp(line, _T("pyw"))==0)||\r
36                         (_tcscmp(line, _T("pyw"))==0))\r
37                 {\r
38                         SendEditor(SCI_SETLEXER, SCLEX_PYTHON);\r
39                         SendEditor(SCI_SETKEYWORDS, 0, (LPARAM)_T("and assert break class continue def del elif \\r
40 else except exec finally for from global if import in is lambda None \\r
41 not or pass print raise return try while yield"));\r
42                         SetAStyle(SCE_P_DEFAULT, black);\r
43                         SetAStyle(SCE_P_COMMENTLINE, darkGreen);\r
44                         SetAStyle(SCE_P_NUMBER, RGB(0, 0x80, 0x80));\r
45                         SetAStyle(SCE_P_STRING, RGB(0, 0, 0x80));\r
46                         SetAStyle(SCE_P_CHARACTER, RGB(0, 0, 0x80));\r
47                         SetAStyle(SCE_P_WORD, RGB(0x80, 0, 0x80));\r
48                         SetAStyle(SCE_P_TRIPLE, black);\r
49                         SetAStyle(SCE_P_TRIPLEDOUBLE, black);\r
50                         SetAStyle(SCE_P_CLASSNAME, darkBlue);\r
51                         SetAStyle(SCE_P_DEFNAME, darkBlue);\r
52                         SetAStyle(SCE_P_OPERATOR, darkBlue);\r
53                         SetAStyle(SCE_P_IDENTIFIER, darkBlue);\r
54                         SetAStyle(SCE_P_COMMENTBLOCK, darkGreen);\r
55                         SetAStyle(SCE_P_STRINGEOL, red);\r
56                 }\r
57                 if ((_tcscmp(line, _T("c"))==0)||\r
58                         (_tcscmp(line, _T("cc"))==0)||\r
59                         (_tcscmp(line, _T("cpp"))==0)||\r
60                         (_tcscmp(line, _T("cxx"))==0)||\r
61                         (_tcscmp(line, _T("h"))==0)||\r
62                         (_tcscmp(line, _T("hh"))==0)||\r
63                         (_tcscmp(line, _T("hpp"))==0)||\r
64                         (_tcscmp(line, _T("hxx"))==0)||\r
65                         (_tcscmp(line, _T("dlg"))==0)||\r
66                         (_tcscmp(line, _T("mak"))==0))\r
67                 {\r
68                         SendEditor(SCI_SETLEXER, SCLEX_CPP);\r
69                         SendEditor(SCI_SETKEYWORDS, 0, (LPARAM)_T("and and_eq asm auto bitand bitor bool break \\r
70 case catch char class compl const const_cast continue \\r
71 default delete do double dynamic_cast else enum explicit export extern false float for \\r
72 friend goto if inline int long mutable namespace new not not_eq \\r
73 operator or or_eq private protected public \\r
74 register reinterpret_cast return short signed sizeof static static_cast struct switch \\r
75 template this throw true try typedef typeid typename union unsigned using \\r
76 virtual void volatile wchar_t while xor xor_eq"));\r
77                         SendEditor(SCI_SETKEYWORDS, 3, (LPARAM)_T("a addindex addtogroup anchor arg attention \\r
78 author b brief bug c class code date def defgroup deprecated dontinclude \\r
79 e em endcode endhtmlonly endif endlatexonly endlink endverbatim enum example exception \\r
80 f$ f[ f] file fn hideinitializer htmlinclude htmlonly \\r
81 if image include ingroup internal invariant interface latexonly li line link \\r
82 mainpage name namespace nosubgrouping note overload \\r
83 p page par param post pre ref relates remarks return retval \\r
84 sa section see showinitializer since skip skipline struct subsection \\r
85 test throw todo typedef union until \\r
86 var verbatim verbinclude version warning weakgroup $ @ \\ & < > # { }"));\r
87                         SetupCppLexer();\r
88                 }\r
89                 if (_tcscmp(line, _T("cs"))==0)\r
90                 {\r
91                         SendEditor(SCI_SETLEXER, SCLEX_CPP);\r
92                         SendEditor(SCI_SETKEYWORDS, 0, (LPARAM)_T("abstract as base bool break byte case catch char checked class \\r
93 const continue decimal default delegate do double else enum \\r
94 event explicit extern false finally fixed float for foreach goto if \\r
95 implicit in int interface internal is lock long namespace new null \\r
96 object operator out override params private protected public \\r
97 readonly ref return sbyte sealed short sizeof stackalloc static \\r
98 string struct switch this throw true try typeof uint ulong \\r
99 unchecked unsafe ushort using virtual void while"));\r
100                         SetupCppLexer();\r
101                 }\r
102                 if ((_tcscmp(line, _T("rc"))==0)||\r
103                         (_tcscmp(line, _T("rc2"))==0))\r
104                 {\r
105                         SendEditor(SCI_SETLEXER, SCLEX_CPP);\r
106                         SendEditor(SCI_SETKEYWORDS, 0, (LPARAM)_T("ACCELERATORS ALT AUTO3STATE AUTOCHECKBOX AUTORADIOBUTTON \\r
107 BEGIN BITMAP BLOCK BUTTON CAPTION CHARACTERISTICS CHECKBOX CLASS \\r
108 COMBOBOX CONTROL CTEXT CURSOR DEFPUSHBUTTON DIALOG DIALOGEX DISCARDABLE \\r
109 EDITTEXT END EXSTYLE FONT GROUPBOX ICON LANGUAGE LISTBOX LTEXT \\r
110 MENU MENUEX MENUITEM MESSAGETABLE POPUP \\r
111 PUSHBUTTON RADIOBUTTON RCDATA RTEXT SCROLLBAR SEPARATOR SHIFT STATE3 \\r
112 STRINGTABLE STYLE TEXTINCLUDE VALUE VERSION VERSIONINFO VIRTKEY"));\r
113                         SetupCppLexer();\r
114                 }\r
115                 if ((_tcscmp(line, _T("idl"))==0)||\r
116                         (_tcscmp(line, _T("odl"))==0))\r
117                 {\r
118                         SendEditor(SCI_SETLEXER, SCLEX_CPP);\r
119                         SendEditor(SCI_SETKEYWORDS, 0, (LPARAM)_T("aggregatable allocate appobject arrays async async_uuid \\r
120 auto_handle \\r
121 bindable boolean broadcast byte byte_count \\r
122 call_as callback char coclass code comm_status \\r
123 const context_handle context_handle_noserialize \\r
124 context_handle_serialize control cpp_quote custom \\r
125 decode default defaultbind defaultcollelem \\r
126 defaultvalue defaultvtable dispinterface displaybind dllname \\r
127 double dual \\r
128 enable_allocate encode endpoint entry enum error_status_t \\r
129 explicit_handle \\r
130 fault_status first_is float \\r
131 handle_t heap helpcontext helpfile helpstring \\r
132 helpstringcontext helpstringdll hidden hyper \\r
133 id idempotent ignore iid_as iid_is immediatebind implicit_handle \\r
134 import importlib in include in_line int __int64 __int3264 interface \\r
135 last_is lcid length_is library licensed local long \\r
136 max_is maybe message methods midl_pragma \\r
137 midl_user_allocate midl_user_free min_is module ms_union \\r
138 ncacn_at_dsp ncacn_dnet_nsp ncacn_http ncacn_ip_tcp \\r
139 ncacn_nb_ipx ncacn_nb_nb ncacn_nb_tcp ncacn_np \\r
140 ncacn_spx ncacn_vns_spp ncadg_ip_udp ncadg_ipx ncadg_mq \\r
141 ncalrpc nocode nonbrowsable noncreatable nonextensible notify \\r
142 object odl oleautomation optimize optional out out_of_line \\r
143 pipe pointer_default pragma properties propget propput propputref \\r
144 ptr public \\r
145 range readonly ref represent_as requestedit restricted retval \\r
146 shape short signed size_is small source strict_context_handle \\r
147 string struct switch switch_is switch_type \\r
148 transmit_as typedef \\r
149 uidefault union unique unsigned user_marshal usesgetlasterror uuid \\r
150 v1_enum vararg version void wchar_t wire_marshal"));\r
151                         SetupCppLexer();\r
152                 }\r
153                 if (_tcscmp(line, _T("java"))==0)\r
154                 {\r
155                         SendEditor(SCI_SETLEXER, SCLEX_CPP);\r
156                         SendEditor(SCI_SETKEYWORDS, 0, (LPARAM)_T("abstract assert boolean break byte case catch char class \\r
157 const continue default do double else extends final finally float for future \\r
158 generic goto if implements import inner instanceof int interface long \\r
159 native new null outer package private protected public rest \\r
160 return short static super switch synchronized this throw throws \\r
161 transient try var void volatile while"));\r
162                         SetupCppLexer();\r
163                 }\r
164                 if (_tcscmp(line, _T("js"))==0)\r
165                 {\r
166                         SendEditor(SCI_SETLEXER, SCLEX_CPP);\r
167                         SendEditor(SCI_SETKEYWORDS, 0, (LPARAM)_T("abstract boolean break byte case catch char class \\r
168 const continue debugger default delete do double else enum export extends \\r
169 final finally float for function goto if implements import in instanceof \\r
170 int interface long native new package private protected public \\r
171 return short static super switch synchronized this throw throws \\r
172 transient try typeof var void volatile while with"));\r
173                         SetupCppLexer();\r
174                 }\r
175                 if ((_tcscmp(line, _T("pas"))==0)||\r
176                         (_tcscmp(line, _T("dpr"))==0)||\r
177                         (_tcscmp(line, _T("pp"))==0))\r
178                 {\r
179                         SendEditor(SCI_SETLEXER, SCLEX_PASCAL);\r
180                         SendEditor(SCI_SETKEYWORDS, 0, (LPARAM)_T("and array as begin case class const constructor \\r
181 destructor div do downto else end except file finally \\r
182 for function goto if implementation in inherited \\r
183 interface is mod not object of on or packed \\r
184 procedure program property raise record repeat \\r
185 set shl shr then threadvar to try type unit \\r
186 until uses var while with xor"));\r
187                         SetupCppLexer();\r
188                 }\r
189                 if ((_tcscmp(line, _T("as"))==0)||\r
190                         (_tcscmp(line, _T("asc"))==0)||\r
191                         (_tcscmp(line, _T("jsfl"))==0))\r
192                 {\r
193                         SendEditor(SCI_SETLEXER, SCLEX_CPP);\r
194                         SendEditor(SCI_SETKEYWORDS, 0, (LPARAM)_T("add and break case catch class continue default delete do \\r
195 dynamic else eq extends false finally for function ge get gt if implements import in \\r
196 instanceof interface intrinsic le lt ne new not null or private public return \\r
197 set static super switch this throw true try typeof undefined var void while with"));\r
198                         SendEditor(SCI_SETKEYWORDS, 1, (LPARAM)_T("Array Arguments Accessibility Boolean Button Camera Color \\r
199 ContextMenu ContextMenuItem Date Error Function Key LoadVars LocalConnection Math \\r
200 Microphone Mouse MovieClip MovieClipLoader NetConnection NetStream Number Object \\r
201 PrintJob Selection SharedObject Sound Stage String StyleSheet System TextField \\r
202 TextFormat TextSnapshot Video Void XML XMLNode XMLSocket \\r
203 _accProps _focusrect _global _highquality _parent _quality _root _soundbuftime \\r
204 arguments asfunction call capabilities chr clearInterval duplicateMovieClip \\r
205 escape eval fscommand getProperty getTimer getURL getVersion gotoAndPlay gotoAndStop \\r
206 ifFrameLoaded Infinity -Infinity int isFinite isNaN length loadMovie loadMovieNum \\r
207 loadVariables loadVariablesNum maxscroll mbchr mblength mbord mbsubstring MMExecute \\r
208 NaN newline nextFrame nextScene on onClipEvent onUpdate ord parseFloat parseInt play \\r
209 prevFrame prevScene print printAsBitmap printAsBitmapNum printNum random removeMovieClip \\r
210 scroll set setInterval setProperty startDrag stop stopAllSounds stopDrag substring \\r
211 targetPath tellTarget toggleHighQuality trace unescape unloadMovie unLoadMovieNum updateAfterEvent"));\r
212                         SetupCppLexer();\r
213                 }\r
214                 if ((_tcscmp(line, _T("html"))==0)||\r
215                         (_tcscmp(line, _T("htm"))==0)||\r
216                         (_tcscmp(line, _T("shtml"))==0)||\r
217                         (_tcscmp(line, _T("htt"))==0)||\r
218                         (_tcscmp(line, _T("xml"))==0)||\r
219                         (_tcscmp(line, _T("asp"))==0)||\r
220                         (_tcscmp(line, _T("xsl"))==0)||\r
221                         (_tcscmp(line, _T("php"))==0)||\r
222                         (_tcscmp(line, _T("xhtml"))==0)||\r
223                         (_tcscmp(line, _T("phtml"))==0)||\r
224                         (_tcscmp(line, _T("cfm"))==0)||\r
225                         (_tcscmp(line, _T("tpl"))==0)||\r
226                         (_tcscmp(line, _T("dtd"))==0)||\r
227                         (_tcscmp(line, _T("hta"))==0)||\r
228                         (_tcscmp(line, _T("htd"))==0)||\r
229                         (_tcscmp(line, _T("wxs"))==0))\r
230                 {\r
231                         SendEditor(SCI_SETLEXER, SCLEX_HTML);\r
232                         SendEditor(SCI_SETSTYLEBITS, 7);\r
233                         SendEditor(SCI_SETKEYWORDS, 0, (LPARAM)_T("a abbr acronym address applet area b base basefont \\r
234 bdo big blockquote body br button caption center \\r
235 cite code col colgroup dd del dfn dir div dl dt em \\r
236 fieldset font form frame frameset h1 h2 h3 h4 h5 h6 \\r
237 head hr html i iframe img input ins isindex kbd label \\r
238 legend li link map menu meta noframes noscript \\r
239 object ol optgroup option p param pre q s samp \\r
240 script select small span strike strong style sub sup \\r
241 table tbody td textarea tfoot th thead title tr tt u ul \\r
242 var xml xmlns abbr accept-charset accept accesskey action align alink \\r
243 alt archive axis background bgcolor border \\r
244 cellpadding cellspacing char charoff charset checked cite \\r
245 class classid clear codebase codetype color cols colspan \\r
246 compact content coords \\r
247 data datafld dataformatas datapagesize datasrc datetime \\r
248 declare defer dir disabled enctype event \\r
249 face for frame frameborder \\r
250 headers height href hreflang hspace http-equiv \\r
251 id ismap label lang language leftmargin link longdesc \\r
252 marginwidth marginheight maxlength media method multiple \\r
253 name nohref noresize noshade nowrap \\r
254 object onblur onchange onclick ondblclick onfocus \\r
255 onkeydown onkeypress onkeyup onload onmousedown \\r
256 onmousemove onmouseover onmouseout onmouseup \\r
257 onreset onselect onsubmit onunload \\r
258 profile prompt readonly rel rev rows rowspan rules \\r
259 scheme scope selected shape size span src standby start style \\r
260 summary tabindex target text title topmargin type usemap \\r
261 valign value valuetype version vlink vspace width \\r
262 text password checkbox radio submit reset \\r
263 file hidden image"));\r
264                         SendEditor(SCI_SETKEYWORDS, 1, (LPARAM)_T("assign audio block break catch choice clear disconnect else elseif \\r
265 emphasis enumerate error exit field filled form goto grammar help \\r
266 if initial link log menu meta noinput nomatch object option p paragraph \\r
267 param phoneme prompt property prosody record reprompt return s say-as \\r
268 script sentence subdialog submit throw transfer value var voice vxml"));\r
269                         SendEditor(SCI_SETKEYWORDS, 2, (LPARAM)_T("accept age alphabet anchor application base beep bridge category charset \\r
270 classid cond connecttimeout content contour count dest destexpr dtmf dtmfterm \\r
271 duration enctype event eventexpr expr expritem fetchtimeout finalsilence \\r
272 gender http-equiv id level maxage maxstale maxtime message messageexpr \\r
273 method mime modal mode name namelist next nextitem ph pitch range rate \\r
274 scope size sizeexpr skiplist slot src srcexpr sub time timeexpr timeout \\r
275 transferaudio type value variant version volume xml:lang"));\r
276                         SendEditor(SCI_SETKEYWORDS, 3, (LPARAM)_T("and assert break class continue def del elif \\r
277 else except exec finally for from global if import in is lambda None \\r
278 not or pass print raise return try while yield"));\r
279                         SendEditor(SCI_SETKEYWORDS, 4, (LPARAM)_T("and argv as argc break case cfunction class continue declare default do \\r
280 die echo else elseif empty enddeclare endfor endforeach endif endswitch \\r
281 endwhile e_all e_parse e_error e_warning eval exit extends false for \\r
282 foreach function global http_cookie_vars http_get_vars http_post_vars \\r
283 http_post_files http_env_vars http_server_vars if include include_once \\r
284 list new not null old_function or parent php_os php_self php_version \\r
285 print require require_once return static switch stdclass this true var \\r
286 xor virtual while __file__ __line__ __sleep __wakeup"));\r
287 \r
288                         SetAStyle(SCE_H_TAG, darkBlue);\r
289                         SetAStyle(SCE_H_TAGUNKNOWN, red);\r
290                         SetAStyle(SCE_H_ATTRIBUTE, darkBlue);\r
291                         SetAStyle(SCE_H_ATTRIBUTEUNKNOWN, red);\r
292                         SetAStyle(SCE_H_NUMBER, RGB(0x80,0,0x80));\r
293                         SetAStyle(SCE_H_DOUBLESTRING, RGB(0,0x80,0));\r
294                         SetAStyle(SCE_H_SINGLESTRING, RGB(0,0x80,0));\r
295                         SetAStyle(SCE_H_OTHER, RGB(0x80,0,0x80));\r
296                         SetAStyle(SCE_H_COMMENT, RGB(0x80,0x80,0));\r
297                         SetAStyle(SCE_H_ENTITY, RGB(0x80,0,0x80));\r
298 \r
299                         SetAStyle(SCE_H_TAGEND, darkBlue);\r
300                         SetAStyle(SCE_H_XMLSTART, darkBlue);    // <?\r
301                         SetAStyle(SCE_H_QUESTION, darkBlue);    // <?\r
302                         SetAStyle(SCE_H_XMLEND, darkBlue);              // ?>\r
303                         SetAStyle(SCE_H_SCRIPT, darkBlue);              // <script\r
304                         SetAStyle(SCE_H_ASP, RGB(0x4F, 0x4F, 0), RGB(0xFF, 0xFF, 0));   // <% ... %>\r
305                         SetAStyle(SCE_H_ASPAT, RGB(0x4F, 0x4F, 0), RGB(0xFF, 0xFF, 0)); // <%@ ... %>\r
306 \r
307                         SetAStyle(SCE_HB_DEFAULT, black);\r
308                         SetAStyle(SCE_HB_COMMENTLINE, darkGreen);\r
309                         SetAStyle(SCE_HB_NUMBER, RGB(0,0x80,0x80));\r
310                         SetAStyle(SCE_HB_WORD, darkBlue);\r
311                         SendEditor(SCI_STYLESETBOLD, SCE_HB_WORD, 1);\r
312                         SetAStyle(SCE_HB_STRING, RGB(0x80,0,0x80));\r
313                         SetAStyle(SCE_HB_IDENTIFIER, black);\r
314 \r
315                         // This light blue is found in the windows system palette so is safe to use even in 256 colour modes.\r
316                         // Show the whole section of VBScript with light blue background\r
317                         for (int bstyle=SCE_HB_DEFAULT; bstyle<=SCE_HB_STRINGEOL; bstyle++) {\r
318                                 SendEditor(SCI_STYLESETFONT, bstyle, \r
319                                         reinterpret_cast<LPARAM>("Lucida Console"));\r
320                                 SendEditor(SCI_STYLESETBACK, bstyle, lightBlue);\r
321                                 // This call extends the backround colour of the last style on the line to the edge of the window\r
322                                 SendEditor(SCI_STYLESETEOLFILLED, bstyle, 1);\r
323                         }\r
324                         SendEditor(SCI_STYLESETBACK, SCE_HB_STRINGEOL, RGB(0x7F,0x7F,0xFF));\r
325                         SendEditor(SCI_STYLESETFONT, SCE_HB_COMMENTLINE, \r
326                                 reinterpret_cast<LPARAM>("Lucida Console"));\r
327 \r
328                         SetAStyle(SCE_HBA_DEFAULT, black);\r
329                         SetAStyle(SCE_HBA_COMMENTLINE, darkGreen);\r
330                         SetAStyle(SCE_HBA_NUMBER, RGB(0,0x80,0x80));\r
331                         SetAStyle(SCE_HBA_WORD, darkBlue);\r
332                         SendEditor(SCI_STYLESETBOLD, SCE_HBA_WORD, 1);\r
333                         SetAStyle(SCE_HBA_STRING, RGB(0x80,0,0x80));\r
334                         SetAStyle(SCE_HBA_IDENTIFIER, black);\r
335 \r
336                         // Show the whole section of ASP VBScript with bright yellow background\r
337                         for (int bastyle=SCE_HBA_DEFAULT; bastyle<=SCE_HBA_STRINGEOL; bastyle++) {\r
338                                 SendEditor(SCI_STYLESETFONT, bastyle, \r
339                                         reinterpret_cast<LPARAM>("Lucida Console"));\r
340                                 SendEditor(SCI_STYLESETBACK, bastyle, RGB(0xFF, 0xFF, 0));\r
341                                 // This call extends the backround colour of the last style on the line to the edge of the window\r
342                                 SendEditor(SCI_STYLESETEOLFILLED, bastyle, 1);\r
343                         }\r
344                         SendEditor(SCI_STYLESETBACK, SCE_HBA_STRINGEOL, RGB(0xCF,0xCF,0x7F));\r
345                         SendEditor(SCI_STYLESETFONT, SCE_HBA_COMMENTLINE, \r
346                                 reinterpret_cast<LPARAM>("Lucida Console"));\r
347 \r
348                         // If there is no need to support embedded Javascript, the following code can be dropped.\r
349                         // Javascript will still be correctly processed but will be displayed in just the default style.\r
350 \r
351                         SetAStyle(SCE_HJ_START, RGB(0x80,0x80,0));\r
352                         SetAStyle(SCE_HJ_DEFAULT, black);\r
353                         SetAStyle(SCE_HJ_COMMENT, darkGreen);\r
354                         SetAStyle(SCE_HJ_COMMENTLINE, darkGreen);\r
355                         SetAStyle(SCE_HJ_COMMENTDOC, darkGreen);\r
356                         SetAStyle(SCE_HJ_NUMBER, RGB(0,0x80,0x80));\r
357                         SetAStyle(SCE_HJ_WORD, black);\r
358                         SetAStyle(SCE_HJ_KEYWORD, darkBlue);\r
359                         SetAStyle(SCE_HJ_DOUBLESTRING, RGB(0x80,0,0x80));\r
360                         SetAStyle(SCE_HJ_SINGLESTRING, RGB(0x80,0,0x80));\r
361                         SetAStyle(SCE_HJ_SYMBOLS, black);\r
362 \r
363                         SetAStyle(SCE_HJA_START, RGB(0x80,0x80,0));\r
364                         SetAStyle(SCE_HJA_DEFAULT, black);\r
365                         SetAStyle(SCE_HJA_COMMENT, darkGreen);\r
366                         SetAStyle(SCE_HJA_COMMENTLINE, darkGreen);\r
367                         SetAStyle(SCE_HJA_COMMENTDOC, darkGreen);\r
368                         SetAStyle(SCE_HJA_NUMBER, RGB(0,0x80,0x80));\r
369                         SetAStyle(SCE_HJA_WORD, black);\r
370                         SetAStyle(SCE_HJA_KEYWORD, darkBlue);\r
371                         SetAStyle(SCE_HJA_DOUBLESTRING, RGB(0x80,0,0x80));\r
372                         SetAStyle(SCE_HJA_SINGLESTRING, RGB(0x80,0,0x80));\r
373                         SetAStyle(SCE_HJA_SYMBOLS, black);\r
374 \r
375                         SetAStyle(SCE_HPHP_DEFAULT, black);\r
376                         SetAStyle(SCE_HPHP_HSTRING,  RGB(0x80,0,0x80));\r
377                         SetAStyle(SCE_HPHP_SIMPLESTRING,  RGB(0x80,0,0x80));\r
378                         SetAStyle(SCE_HPHP_WORD, darkBlue);\r
379                         SetAStyle(SCE_HPHP_NUMBER, RGB(0,0x80,0x80));\r
380                         SetAStyle(SCE_HPHP_VARIABLE, red);\r
381                         SetAStyle(SCE_HPHP_HSTRING_VARIABLE, red);\r
382                         SetAStyle(SCE_HPHP_COMPLEX_VARIABLE, red);\r
383                         SetAStyle(SCE_HPHP_COMMENT, darkGreen);\r
384                         SetAStyle(SCE_HPHP_COMMENTLINE, darkGreen);\r
385                         SetAStyle(SCE_HPHP_OPERATOR, darkBlue);\r
386 \r
387                         // Show the whole section of Javascript with off white background\r
388                         for (int jstyle=SCE_HJ_DEFAULT; jstyle<=SCE_HJ_SYMBOLS; jstyle++) {\r
389                                 SendEditor(SCI_STYLESETFONT, jstyle, \r
390                                         reinterpret_cast<LPARAM>("Lucida Console"));\r
391                                 SendEditor(SCI_STYLESETBACK, jstyle, offWhite);\r
392                                 SendEditor(SCI_STYLESETEOLFILLED, jstyle, 1);\r
393                         }\r
394                         SendEditor(SCI_STYLESETBACK, SCE_HJ_STRINGEOL, RGB(0xDF, 0xDF, 0x7F));\r
395                         SendEditor(SCI_STYLESETEOLFILLED, SCE_HJ_STRINGEOL, 1);\r
396 \r
397                         // Show the whole section of Javascript with brown background\r
398                         for (int jastyle=SCE_HJA_DEFAULT; jastyle<=SCE_HJA_SYMBOLS; jastyle++) {\r
399                                 SendEditor(SCI_STYLESETFONT, jastyle, \r
400                                         reinterpret_cast<LPARAM>("Lucida Console"));\r
401                                 SendEditor(SCI_STYLESETBACK, jastyle, RGB(0xDF, 0xDF, 0x7F));\r
402                                 SendEditor(SCI_STYLESETEOLFILLED, jastyle, 1);\r
403                         }\r
404                         SendEditor(SCI_STYLESETBACK, SCE_HJA_STRINGEOL, RGB(0x0,0xAF,0x5F));\r
405                         SendEditor(SCI_STYLESETEOLFILLED, SCE_HJA_STRINGEOL, 1);\r
406                 }\r
407         }\r
408         else\r
409         {\r
410                 SendEditor(SCI_SETLEXER, SCLEX_CPP);\r
411                 SetupCppLexer();\r
412         }\r
413         SendEditor(SCI_COLOURISE, 0, -1);\r
414 }\r
415 \r
416 void TortoiseBlame::SetupCppLexer()\r
417 {\r
418         SetAStyle(SCE_C_DEFAULT, RGB(0, 0, 0));\r
419         SetAStyle(SCE_C_COMMENT, RGB(0, 0x80, 0));\r
420         SetAStyle(SCE_C_COMMENTLINE, RGB(0, 0x80, 0));\r
421         SetAStyle(SCE_C_COMMENTDOC, RGB(0, 0x80, 0));\r
422         SetAStyle(SCE_C_COMMENTLINEDOC, RGB(0, 0x80, 0));\r
423         SetAStyle(SCE_C_COMMENTDOCKEYWORD, RGB(0, 0x80, 0));\r
424         SetAStyle(SCE_C_COMMENTDOCKEYWORDERROR, RGB(0, 0x80, 0));\r
425         SetAStyle(SCE_C_NUMBER, RGB(0, 0x80, 0x80));\r
426         SetAStyle(SCE_C_WORD, RGB(0, 0, 0x80));\r
427         SendEditor(SCE_C_WORD, 1);\r
428         SetAStyle(SCE_C_STRING, RGB(0x80, 0, 0x80));\r
429         SetAStyle(SCE_C_IDENTIFIER, RGB(0, 0, 0));\r
430         SetAStyle(SCE_C_PREPROCESSOR, RGB(0x80, 0, 0));\r
431         SetAStyle(SCE_C_OPERATOR, RGB(0x80, 0x80, 0));\r
432 }\r