home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 2006 April / DPPRO0406DVD.ISO / Essentials / Programming / Notepad2 / Source / NP2SRC.ZIP / Styles.c < prev    next >
Encoding:
C/C++ Source or Header  |  2004-06-25  |  133.0 KB  |  2,971 lines

  1. /******************************************************************************
  2. *
  3. *
  4. * Notepad2
  5. *
  6. * Styles.c
  7. *   Scintilla Style Management
  8. *
  9. * See Readme.txt for more information about this source code.
  10. * Please send me your comments to this work.
  11. *
  12. * Distributed under the terms of the GNU General Public License,
  13. * see License.txt for details.
  14. *
  15. *                                              (c) Florian Balmer 1996-2004
  16. *                                                       textview@bluewin.ch
  17. *                                               http://www.flos-freeware.ch
  18. *
  19. *
  20. ******************************************************************************/
  21. #include <windows.h>
  22. #include <commctrl.h>
  23. #include <commdlg.h>
  24. #include <shlobj.h>
  25. #include <shlwapi.h>
  26. #include <stdio.h>
  27. #include "appreg.h"
  28. #include "dialogs.h"
  29. #include "helpers.h"
  30. #include "notepad2.h"
  31. #include "scintilla.h"
  32. #include "scilexer.h"
  33. #include "styles.h"
  34. #include "resource.h"
  35.  
  36.  
  37. KEYWORDLIST KeyWords_NULL = {
  38. "", "", "", "", "", "", "", "", "" };
  39.  
  40.  
  41. EDITLEXER lexDefault = { SCLEX_NULL, "Default Text", "txt;wtx;log;asc;doc;diz;nfo", "", &KeyWords_NULL, {
  42.                 /*  0 */ { STYLE_DEFAULT, "Default Style", "font:Lucida Console;size:10", "" },
  43.                 /*  1 */ { STYLE_LINENUMBER, "Margins and Line Numbers", "size:-2", "" },
  44.                 /*  2 */ { STYLE_BRACELIGHT, "Matching Braces", "size:+1;fore:#FF0000;bold", "" },
  45.                 /*  3 */ { STYLE_BRACEBAD, "Matching Braces Error", "size:+1;fore:#000080;bold", "" },
  46.                 /*  4 */ { STYLE_CONTROLCHAR, "Control Characters (Unused)", "", "" },
  47.                 /*  5 */ { STYLE_INDENTGUIDE, "Indentation Guide (Color only)", "", "" },
  48.                 /*  6 */ { SCI_SETSELFORE+SCI_SETSELBACK, "Selected Text (Colors only)", "", "" },
  49.                 /*  7 */ { SCI_SETWHITESPACEFORE+SCI_SETWHITESPACEBACK, "Whitespace (Colors only)", "fore:#FF0000", "" },
  50.                 /*  8 */ { SCI_SETCARETLINEBACK, "Current Line Background (Color only)", "", "" },
  51.                 /*  9 */ { SCI_SETCARETFORE, "Caret Foreground (Color only)", "", "" },
  52.                 /* 10 */ { SCI_SETCARETWIDTH, "Caret Width (Size from 1 to 3)", "", "" },
  53.                 /* 11 */ { SCI_SETEDGECOLOUR, "Long Line Marker (Colors only)", "", "" },
  54.                 /* 12 */ { SCI_MARKERDEFINEPIXMAP, "Bookmark Icon (1 to 9)", "1", "" },
  55.                 /* 13 */ { SCI_MARKERSETFORE+SCI_MARKERSETBACK, "Bookmark Line Background (Color only)", "back:#ABCDEF", "" },
  56.  
  57.                 /* 14 */ { STYLE_DEFAULT, "2nd Default Style", "font:Fixedsys;size:9;fore:#FFFFFF;back:#000000", "" },
  58.                 /* 15 */ { STYLE_LINENUMBER, "2nd Margins and Line Numbers", "font:Tahoma;size:7;fore:#FFFFFF;back:#000000", "" },
  59.                 /* 16 */ { STYLE_BRACELIGHT, "2nd Matching Braces", "", "" },
  60.                 /* 17 */ { STYLE_BRACEBAD, "2nd Matching Braces Error", "", "" },
  61.                 /* 18 */ { STYLE_CONTROLCHAR, "2nd Control Characters (Unused)", "", "" },
  62.                 /* 19 */ { STYLE_INDENTGUIDE, "2nd Indentation Guide (Color only)", "fore:#FFFFFF", "" },
  63.                 /* 20 */ { SCI_SETSELFORE+SCI_SETSELBACK, "2nd Selected Text (Colors only)", "fore:#000000;back:#FFFFFF", "" },
  64.                 /* 21 */ { SCI_SETWHITESPACEFORE+SCI_SETWHITESPACEBACK, "2nd Whitespace (Colors only)", "fore:#FFFFFF", "" },
  65.                 /* 22 */ { SCI_SETCARETLINEBACK, "2nd Current Line Background (Color only)", "back:#202020", "" },
  66.                 /* 23 */ { SCI_SETCARETFORE, "2nd Caret Foreground (Color only)", "fore:#FFFFFF", "" },
  67.                 /* 24 */ { SCI_SETCARETWIDTH, "2nd Caret Width (Size from 1 to 3)", "size:2", "" },
  68.                 /* 25 */ { SCI_SETEDGECOLOUR, "2nd Long Line Marker (Colors only)", "fore:#FFFFFF;back:#808080", "" },
  69.                 /* 26 */ { SCI_MARKERDEFINEPIXMAP, "2nd Bookmark Icon (1 to 9)", "9", "" },
  70.                 /* 27 */ { SCI_MARKERSETFORE+SCI_MARKERSETBACK, "2nd Bookmark Line Background (Color only)", "back:#3A6EA5", "" },
  71.                          { -1, "", "", "" } } };
  72.  
  73.  
  74. KEYWORDLIST KeyWords_HTML = {
  75. "a abbr acronym address applet area b base basefont bdo big blockquote body bordercolor br button caption "
  76. "center cite code col colgroup dd del dfn dir div dl dt em fieldset font form frame frameset h1 h2 "
  77. "h3 h4 h5 h6 head hr html i iframe img input ins isindex kbd label legend li link map menu meta "
  78. "noframes noscript object ol optgroup option p param pre q s samp script select small span strike "
  79. "strong style sub sup table tbody td textarea tfoot th thead title tr tt u ul var xml xmlns abbr "
  80. "accept-charset accept accesskey action align alink alt archive axis background bgcolor border "
  81. "cellpadding cellspacing char charoff charset checked cite class classid clear codebase codetype "
  82. "color cols colspan compact content coords data datafld dataformatas datapagesize datasrc "
  83. "datetime declare defer dir disabled enctype event face for frame frameborder headers height href "
  84. "hreflang hspace http-equiv id ismap label lang language leftmargin link longdesc marginwidth "
  85. "marginheight maxlength media method multiple name nohref noresize noshade nowrap object "
  86. "onblur onchange onclick ondblclick onfocus onkeydown onkeypress onkeyup onload onmousedown "
  87. "onmousemove onmouseover onmouseout onmouseup onreset onselect onsubmit onunload profile "
  88. "prompt readonly rel rev rows rowspan rules scheme scope scrolling selected shape size span src standby "
  89. "start style summary tabindex target text title topmargin type usemap valign value valuetype "
  90. "version vlink vspace width text password checkbox radio submit reset file hidden image public "
  91. "!doctype",
  92. "abstract boolean break byte case catch char class const continue debugger default delete do "
  93. "double else enum export extends final finally float for function goto if implements import in "
  94. "instanceof int interface long native new package private protected public return short static "
  95. "super switch synchronized this throw throws transient try typeof var void volatile while with",
  96. "and begin case call continue do each else elseif end erase error event exit false for function get "
  97. "gosub goto if implement in load loop lset me mid new next not nothing on or property raiseevent "
  98. "rem resume return rset select set stop sub then to true unload until wend while with withevents "
  99. "attribute alias as boolean byref byte byval const compare currency date declare dim double enum "
  100. "explicit friend global integer let lib long module object option optional preserve private property "
  101. "public redim single static string type variant",
  102. "and assert break class continue def del elif else except exec finally for from global if import in is "
  103. "lambda None not or pass print raise return try while yield",
  104. "and argv as argc break case cfunction class const continue declare default define do die echo else elseif "
  105. "empty enddeclare endfor endforeach endif endswitch endwhile e_all e_parse e_error e_warning eval exit "
  106. "extends false for foreach function global http_cookie_vars http_get_vars http_post_vars http_post_files "
  107. "http_env_vars http_server_vars if include include_once isset list new not null old_function or parent "
  108. "php_os php_self php_version print require require_once return static switch stdclass this true unset use "
  109. "var xor virtual while __file__ __line__ __sleep __wakeup",
  110. "ELEMENT DOCTYPE ATTLIST ENTITY NOTATION",
  111. "", "", "" };
  112.  
  113.  
  114. EDITLEXER lexHTML = { SCLEX_HTML, "Web Source Code", "html;htm;asp;aspx;shtml;htd;xhtml;php;php3;phtml;htt;cfm;tpl;dtd;hta", "", &KeyWords_HTML, {
  115.                       { STYLE_DEFAULT, "Default", "", "" },
  116.                       //{ SCE_H_DEFAULT, "Default", "", "" },
  117.                       { SCE_H_TAG, "HTML Tag", "fore:#000080", "" },
  118.                       { SCE_H_TAGUNKNOWN, "HTML Unknown Tag", "fore:#000080", "" },
  119.                       { SCE_H_ATTRIBUTE, "HTML Attribute", "fore:#FF0000", "" },
  120.                       { SCE_H_ATTRIBUTEUNKNOWN, "HTML Unknown Attribute", "fore:#FF0000", "" },
  121.                       { SCE_H_VALUE, "HTML Value", "fore:#3A6EA5", "" },
  122.                       { SCE_H_DOUBLESTRING, "HTML String double quoted", "fore:#3A6EA5", "" },
  123.                       { SCE_H_SINGLESTRING, "HTML String single quoted", "fore:#3A6EA5", "" },
  124.                       { SCE_H_OTHER, "HTML Other Inside Tag", "fore:#3A6EA5", "" },
  125.                       { SCE_H_COMMENT, "HTML Comment", "fore:#808080", "" },
  126.                       { SCE_H_ENTITY, "HTML Entity", "fore:#800080", "" },
  127.                       { SCE_H_TAGEND, "XML Closing Tag", "fore:#000080", "" },
  128.                       { SCE_H_XMLSTART, "XML Identifier Start", "bold;fore:#FF0000", "" },
  129.                       { SCE_H_XMLEND, "XML Identifier End", "bold;fore:#FF0000", "" },
  130.                       { SCE_H_ASP, "ASP Start Tag", "", "fore:#000080;bold" },
  131.                       { SCE_H_ASPAT, "ASP Start Tag @", "fore:#000080;bold", "" },
  132.                       //{ SCE_H_SCRIPT, "Script", "", "" },
  133.                       { SCE_H_CDATA, "CDATA", "", "" },
  134.                       //{ SCE_H_XCCOMMENT, "XC Comment", "", "" },
  135.                       { SCE_H_QUESTION, "PHP Start Tag", "fore:#000080;bold", "" },
  136.                       { SCE_HPHP_DEFAULT, "PHP Default", "", "" },
  137.                       { SCE_HPHP_HSTRING, "PHP String", "fore:#008000", "" },
  138.                       { SCE_HPHP_SIMPLESTRING, "PHP Simple String", "fore:#008000", "" },
  139.                       { SCE_HPHP_WORD, "PHP Keyword", "fore:#800080", "" },
  140.                       { SCE_HPHP_NUMBER, "PHP Number", "fore:#FF0000", "" },
  141.                       { SCE_HPHP_VARIABLE, "PHP Variable", "italic;fore:#000080", "" },
  142.                       { SCE_HPHP_HSTRING_VARIABLE, "PHP String Variable", "italic;fore:#000080", "" },
  143.                       { SCE_HPHP_COMPLEX_VARIABLE, "PHP Complex Variable", "italic;fore:#000080", "" },
  144.                       { SCE_HPHP_COMMENT, "PHP Comment", "fore:#FF8000", "" },
  145.                       { SCE_HPHP_COMMENTLINE, "PHP Comment Line", "fore:#FF8000", "" },
  146.                       { SCE_HPHP_OPERATOR, "PHP Operator", "", "" },
  147.                       //{ SCE_HJ_START, "JS Start", "", "" },
  148.                       { SCE_HJ_DEFAULT, "JS Default", "", "" },
  149.                       { SCE_HJ_COMMENT, "JS Comment", "fore:#008000", "" },
  150.                       { SCE_HJ_COMMENTLINE, "JS Comment Line", "fore:#008000", "" },
  151.                       { SCE_HJ_COMMENTDOC, "JS Comment Doc", "fore:#008000", "" },
  152.                       { SCE_HJ_NUMBER, "JS Number", "fore:#FF0000", "" },
  153.                       { SCE_HJ_WORD, "JS Identifier", "", "" },
  154.                       { SCE_HJ_KEYWORD, "JS Keyword", "fore:#0A246A;bold", "" },
  155.                       { SCE_HJ_DOUBLESTRING, "JS Double String", "fore:#008000", "" },
  156.                       { SCE_HJ_SINGLESTRING, "JS Single String", "fore:#008000", "" },
  157.                       { SCE_HJ_STRINGEOL, "JS String EOL", "fore:#008000", "" },
  158.                       { SCE_HJ_SYMBOLS, "JS Symbols", "", "" },
  159.                       { SCE_HJ_REGEX, "JS Regex", "", "" },
  160.                       //{ SCE_HJA_START, "ASP JS Start", "", "" },
  161.                       { SCE_HJA_DEFAULT, "ASP JS Default", "", "" },
  162.                       { SCE_HJA_COMMENT, "ASP JS Comment", "fore:#008000", "" },
  163.                       { SCE_HJA_COMMENTLINE, "ASP JS Commentline", "fore:#008000", "" },
  164.                       { SCE_HJA_COMMENTDOC, "ASP JS Comment Doc", "fore:#008000", "" },
  165.                       { SCE_HJA_NUMBER, "ASP JS Number", "fore:#FF0000", "" },
  166.                       { SCE_HJA_WORD, "ASP JS Identifier", "", "" },
  167.                       { SCE_HJA_KEYWORD, "ASP JS Keyword", "fore:#0A246A;bold", "" },
  168.                       { SCE_HJA_DOUBLESTRING, "ASP JS Double String", "fore:#008000", "" },
  169.                       { SCE_HJA_SINGLESTRING, "ASP JS Single String", "fore:#008000", "" },
  170.                       { SCE_HJA_STRINGEOL, "ASP JS String EOL", "fore:#008000", "" },
  171.                       { SCE_HJA_SYMBOLS, "ASP JS Symbols", "", "" },
  172.                       { SCE_HJA_REGEX, "ASP JS Regex", "", "" },
  173.                       //{ SCE_HB_START, "VBS Start", "", "" },
  174.                       { SCE_HB_DEFAULT, "VBS Default", "", "" },
  175.                       { SCE_HB_COMMENTLINE, "VBS Comment Line", "fore:#008000", "" },
  176.                       { SCE_HB_NUMBER, "VBS Number", "fore:#FF0000", "" },
  177.                       { SCE_HB_WORD, "VBS Keyword", "fore:#800080;bold", "" },
  178.                       { SCE_HB_STRING, "VBS String", "fore:#008000", "" },
  179.                       { SCE_HB_STRINGEOL, "VBS String EOL", "fore:#008000", "" },
  180.                       { SCE_HB_IDENTIFIER, "VBS Identifier", "", "" },
  181.                       //{ SCE_HBA_START, "ASP VBS Start", "", "" },
  182.                       { SCE_HBA_DEFAULT, "ASP VBS Default", "", "" },
  183.                       { SCE_HBA_COMMENTLINE, "ASP VBS Comment Line ", "fore:#008000", "" },
  184.                       { SCE_HBA_NUMBER, "ASP VBS Number", "", "" },
  185.                       { SCE_HBA_WORD, "ASP VBS Keyword", "fore:#800080;bold", "" },
  186.                       { SCE_HBA_STRING, "ASP VBS String", "fore:#008000", "" },
  187.                       { SCE_HBA_STRINGEOL, "ASP VBS String EOL", "fore:#008000", "" },
  188.                       { SCE_HBA_IDENTIFIER, "ASP VBS Identifier", "", "" },
  189.                       //{ SCE_HP_START, "Phyton Start", "", "" },
  190.                       //{ SCE_HP_DEFAULT, "Phyton Default", "", "" },
  191.                       //{ SCE_HP_COMMENTLINE, "Phyton Comment Line", "", "" },
  192.                       //{ SCE_HP_NUMBER, "Phyton Number", "", "" },
  193.                       //{ SCE_HP_STRING, "Phyton String", "", "" },
  194.                       //{ SCE_HP_CHARACTER, "Phyton Character", "", "" },
  195.                       //{ SCE_HP_WORD, "Phyton Keyword", "", "" },
  196.                       //{ SCE_HP_TRIPLE, "Phyton Triple", "", "" },
  197.                       //{ SCE_HP_TRIPLEDOUBLE, "Phyton Triple Double", "", "" },
  198.                       //{ SCE_HP_CLASSNAME, "Phyton Class Name", "", "" },
  199.                       //{ SCE_HP_DEFNAME, "Phyton Def Name", "", "" },
  200.                       //{ SCE_HP_OPERATOR, "Phyton Operator", "", "" },
  201.                       //{ SCE_HP_IDENTIFIER, "Phyton Identifier", "", "" },
  202.                       //{ SCE_HPA_START, "ASP Phyton Start", "", "" },
  203.                       //{ SCE_HPA_DEFAULT, "ASP Phyton Default", "", "" },
  204.                       //{ SCE_HPA_COMMENTLINE, "ASP Phyton Comment Line", "", "" },
  205.                       //{ SCE_HPA_NUMBER, "ASP Phyton Number", "", "" },
  206.                       //{ SCE_HPA_STRING, "ASP Phyton String", "", "" },
  207.                       //{ SCE_HPA_CHARACTER, "ASP Phyton Character", "", "" },
  208.                       //{ SCE_HPA_WORD, "ASP Phyton Keyword", "", "" },
  209.                       //{ SCE_HPA_TRIPLE, "ASP Phyton Triple", "", "" },
  210.                       //{ SCE_HPA_TRIPLEDOUBLE, "ASP Phyton Triple Double", "", "" },
  211.                       //{ SCE_HPA_CLASSNAME, "ASP Phyton Class Name", "", "" },
  212.                       //{ SCE_HPA_DEFNAME, "ASP Phyton Def Name", "", "" },
  213.                       //{ SCE_HPA_OPERATOR, "ASP Phyton Operator", "", "" },
  214.                       //{ SCE_HPA_IDENTIFIER, "ASP Phyton Identifier", "", "" },
  215.                       //{ SCE_H_SGML_DEFAULT, "SGML Default", "", "" },
  216.                       //{ SCE_H_SGML_COMMAND, "SGML Command", "","" },
  217.                       //{ SCE_H_SGML_1ST_PARAM, "SGML 1st Param", "","" },
  218.                       //{ SCE_H_SGML_DOUBLESTRING, "SGML Double String", "", "" },
  219.                       //{ SCE_H_SGML_SIMPLESTRING, "SGML Single Stirng", "", "" },
  220.                       //{ SCE_H_SGML_ERROR, "SGML Error", "", "" },
  221.                       //{ SCE_H_SGML_SPECIAL, "SGML Special", "", "" },
  222.                       //{ SCE_H_SGML_ENTITY, "SGML Entity", "", "" },
  223.                       //{ SCE_H_SGML_COMMENT, "SGML Comment", "", "" },
  224.                       //{ SCE_H_SGML_1ST_PARAM_COMMENT, "SGML 1st Param Comment", "", "" },
  225.                       //{ SCE_H_SGML_BLOCK_DEFAULT, "SGML Block Default", "", "" },
  226.                       { -1, "", "", "" } } };
  227.  
  228.  
  229. KEYWORDLIST KeyWords_XML = {
  230. "", "", "", "", "", "ELEMENT DOCTYPE ATTLIST ENTITY NOTATION", "", "", "" };
  231.  
  232.  
  233. EDITLEXER lexXML = { SCLEX_XML, "XML Document", "xml;xsl;svg;xul;xsd;dtd;xslt;axl;rdf;manifest", "", &KeyWords_XML, {
  234.                      { STYLE_DEFAULT, "Default", "", "" },
  235.                      //{ SCE_H_DEFAULT, "Default", "", "" },
  236.                      { SCE_H_TAG, "XML Tag", "fore:#800080", "" },
  237.                      { SCE_H_TAGEND, "XML Closing Tag", "fore:#800080", "" },
  238.                      //{ SCE_H_TAGUNKNOWN, "XML Unknown Tag", "fore:#000080", "" },
  239.                      { SCE_H_ATTRIBUTE, "XML Attribute", "fore:#FF0000", "" },
  240.                      //{ SCE_H_ATTRIBUTEUNKNOWN, "XML Unknown Attribute", "fore:#FF0000", "" },
  241.                      { SCE_H_VALUE, "XML Value", "fore:#3A6EA5", "" },
  242.                      { SCE_H_DOUBLESTRING, "XML String double quoted", "fore:#3A6EA5", "" },
  243.                      { SCE_H_SINGLESTRING, "XML String single quoted", "fore:#3A6EA5", "" },
  244.                      { SCE_H_OTHER, "XML Other Inside Tag", "fore:#3A6EA5", "" },
  245.                      { SCE_H_COMMENT, "XML Comment", "fore:#808080", "" },
  246.                      { SCE_H_ENTITY, "XML Entity", "fore:#800080", "" },
  247.                      { SCE_H_XMLSTART, "XML Identifier Start", "bold;fore:#FF0000", "" },
  248.                      { SCE_H_XMLEND, "XML Identifier End", "bold;fore:#FF0000", "" },
  249.                      //{ SCE_H_ASP, "ASP Start Tag", "", "fore:#000080;bold" },
  250.                      //{ SCE_H_ASPAT, "ASP Start Tag @", "fore:#000080;bold", "" },
  251.                      //{ SCE_H_SCRIPT, "Script", "", "" },
  252.                      { SCE_H_CDATA, "CDATA", "fore:#008000", "" },
  253.                      //{ SCE_H_XCCOMMENT, "XC Comment", "", "" },
  254.                      //{ SCE_H_QUESTION, "PHP Start Tag", "fore:#000080;bold", "" },
  255.                      //{ SCE_HPHP_DEFAULT, "PHP Default", "", "" },
  256.                      //{ SCE_HPHP_HSTRING, "PHP String", "fore:#008000", "" },
  257.                      //{ SCE_HPHP_SIMPLESTRING, "PHP Simple String", "fore:#008000", "" },
  258.                      //{ SCE_HPHP_WORD, "PHP Keyword", "fore:#800080", "" },
  259.                      //{ SCE_HPHP_NUMBER, "PHP Number", "fore:#FF0000", "" },
  260.                      //{ SCE_HPHP_VARIABLE, "PHP Variable", "italic;fore:#000080", "" },
  261.                      //{ SCE_HPHP_HSTRING_VARIABLE, "PHP String Variable", "italic;fore:#000080", "" },
  262.                      //{ SCE_HPHP_COMPLEX_VARIABLE, "PHP Complex Variable", "italic;fore:#000080", "" },
  263.                      //{ SCE_HPHP_COMMENT, "PHP Comment", "fore:#FF8000", "" },
  264.                      //{ SCE_HPHP_COMMENTLINE, "PHP Comment Line", "fore:#FF8000", "" },
  265.                      //{ SCE_HPHP_OPERATOR, "PHP Operator", "", "" },
  266.                      //{ SCE_HJ_START, "JS Start", "", "" },
  267.                      //{ SCE_HJ_DEFAULT, "JS Default", "", "" },
  268.                      //{ SCE_HJ_COMMENT, "JS Comment", "fore:#008000", "" },
  269.                      //{ SCE_HJ_COMMENTLINE, "JS Comment Line", "fore:#008000", "" },
  270.                      //{ SCE_HJ_COMMENTDOC, "JS Comment Doc", "fore:#008000", "" },
  271.                      //{ SCE_HJ_NUMBER, "JS Number", "fore:#FF0000", "" },
  272.                      //{ SCE_HJ_WORD, "JS Identifier", "", "" },
  273.                      //{ SCE_HJ_KEYWORD, "JS Keyword", "fore:#0A246A;bold", "" },
  274.                      //{ SCE_HJ_DOUBLESTRING, "JS Double String", "fore:#008000", "" },
  275.                      //{ SCE_HJ_SINGLESTRING, "JS Single String", "fore:#008000", "" },
  276.                      //{ SCE_HJ_STRINGEOL, "JS String EOL", "fore:#008000", "" },
  277.                      //{ SCE_HJ_SYMBOLS, "JS Symbols", "", "" },
  278.                      //{ SCE_HJ_REGEX, "JS Regex", "", "" },
  279.                      //{ SCE_HJA_START, "ASP JS Start", "", "" },
  280.                      //{ SCE_HJA_DEFAULT, "ASP JS Default", "", "" },
  281.                      //{ SCE_HJA_COMMENT, "ASP JS Comment", "fore:#008000", "" },
  282.                      //{ SCE_HJA_COMMENTLINE, "ASP JS Commentline", "fore:#008000", "" },
  283.                      //{ SCE_HJA_COMMENTDOC, "ASP JS Comment Doc", "fore:#008000", "" },
  284.                      //{ SCE_HJA_NUMBER, "ASP JS Number", "fore:#FF0000", "" },
  285.                      //{ SCE_HJA_WORD, "ASP JS Identifier", "", "" },
  286.                      //{ SCE_HJA_KEYWORD, "ASP JS Keyword", "fore:#0A246A;bold", "" },
  287.                      //{ SCE_HJA_DOUBLESTRING, "ASP JS Double String", "fore:#008000", "" },
  288.                      //{ SCE_HJA_SINGLESTRING, "ASP JS Single String", "fore:#008000", "" },
  289.                      //{ SCE_HJA_STRINGEOL, "ASP JS String EOL", "fore:#008000", "" },
  290.                      //{ SCE_HJA_SYMBOLS, "ASP JS Symbols", "", "" },
  291.                      //{ SCE_HJA_REGEX, "ASP JS Regex", "", "" },
  292.                      //{ SCE_HB_START, "VBS Start", "", "" },
  293.                      //{ SCE_HB_DEFAULT, "VBS Default", "", "" },
  294.                      //{ SCE_HB_COMMENTLINE, "VBS Comment Line", "fore:#008000", "" },
  295.                      //{ SCE_HB_NUMBER, "VBS Number", "fore:#FF0000", "" },
  296.                      //{ SCE_HB_WORD, "VBS Keyword", "fore:#800080;bold", "" },
  297.                      //{ SCE_HB_STRING, "VBS String", "fore:#008000", "" },
  298.                      //{ SCE_HB_STRINGEOL, "VBS String EOL", "fore:#008000", "" },
  299.                      //{ SCE_HB_IDENTIFIER, "VBS Identifier", "", "" },
  300.                      //{ SCE_HBA_START, "ASP VBS Start", "", "" },
  301.                      //{ SCE_HBA_DEFAULT, "ASP VBS Default", "", "" },
  302.                      //{ SCE_HBA_COMMENTLINE, "ASP VBS Comment Line ", "fore:#008000", "" },
  303.                      //{ SCE_HBA_NUMBER, "ASP VBS Number", "", "" },
  304.                      //{ SCE_HBA_WORD, "ASP VBS Keyword", "fore:#800080;bold", "" },
  305.                      //{ SCE_HBA_STRING, "ASP VBS String", "fore:#008000", "" },
  306.                      //{ SCE_HBA_STRINGEOL, "ASP VBS String EOL", "fore:#008000", "" },
  307.                      //{ SCE_HBA_IDENTIFIER, "ASP VBS Identifier", "", "" },
  308.                      //{ SCE_HP_START, "Phyton Start", "", "" },
  309.                      //{ SCE_HP_DEFAULT, "Phyton Default", "", "" },
  310.                      //{ SCE_HP_COMMENTLINE, "Phyton Comment Line", "", "" },
  311.                      //{ SCE_HP_NUMBER, "Phyton Number", "", "" },
  312.                      //{ SCE_HP_STRING, "Phyton String", "", "" },
  313.                      //{ SCE_HP_CHARACTER, "Phyton Character", "", "" },
  314.                      //{ SCE_HP_WORD, "Phyton Keyword", "", "" },
  315.                      //{ SCE_HP_TRIPLE, "Phyton Triple", "", "" },
  316.                      //{ SCE_HP_TRIPLEDOUBLE, "Phyton Triple Double", "", "" },
  317.                      //{ SCE_HP_CLASSNAME, "Phyton Class Name", "", "" },
  318.                      //{ SCE_HP_DEFNAME, "Phyton Def Name", "", "" },
  319.                      //{ SCE_HP_OPERATOR, "Phyton Operator", "", "" },
  320.                      //{ SCE_HP_IDENTIFIER, "Phyton Identifier", "", "" },
  321.                      //{ SCE_HPA_START, "ASP Phyton Start", "", "" },
  322.                      //{ SCE_HPA_DEFAULT, "ASP Phyton Default", "", "" },
  323.                      //{ SCE_HPA_COMMENTLINE, "ASP Phyton Comment Line", "", "" },
  324.                      //{ SCE_HPA_NUMBER, "ASP Phyton Number", "", "" },
  325.                      //{ SCE_HPA_STRING, "ASP Phyton String", "", "" },
  326.                      //{ SCE_HPA_CHARACTER, "ASP Phyton Character", "", "" },
  327.                      //{ SCE_HPA_WORD, "ASP Phyton Keyword", "", "" },
  328.                      //{ SCE_HPA_TRIPLE, "ASP Phyton Triple", "", "" },
  329.                      //{ SCE_HPA_TRIPLEDOUBLE, "ASP Phyton Triple Double", "", "" },
  330.                      //{ SCE_HPA_CLASSNAME, "ASP Phyton Class Name", "", "" },
  331.                      //{ SCE_HPA_DEFNAME, "ASP Phyton Def Name", "", "" },
  332.                      //{ SCE_HPA_OPERATOR, "ASP Phyton Operator", "", "" },
  333.                      //{ SCE_HPA_IDENTIFIER, "ASP Phyton Identifier", "", "" },
  334.                      //{ SCE_H_SGML_DEFAULT, "SGML Default", "", "" },
  335.                      //{ SCE_H_SGML_COMMAND, "SGML Command", "","" },
  336.                      //{ SCE_H_SGML_1ST_PARAM, "SGML 1st Param", "","" },
  337.                      //{ SCE_H_SGML_DOUBLESTRING, "SGML Double String", "", "" },
  338.                      //{ SCE_H_SGML_SIMPLESTRING, "SGML Single Stirng", "", "" },
  339.                      //{ SCE_H_SGML_ERROR, "SGML Error", "", "" },
  340.                      //{ SCE_H_SGML_SPECIAL, "SGML Special", "", "" },
  341.                      //{ SCE_H_SGML_ENTITY, "SGML Entity", "", "" },
  342.                      //{ SCE_H_SGML_COMMENT, "SGML Comment", "", "" },
  343.                      //{ SCE_H_SGML_1ST_PARAM_COMMENT, "SGML 1st Param Comment", "", "" },
  344.                      //{ SCE_H_SGML_BLOCK_DEFAULT, "SGML Block Default", "", "" },
  345.                      { -1, "", "", "" } } };
  346.  
  347.  
  348. KEYWORDLIST KeyWords_CSS = {
  349. "azimuth background background-attachment background-color "
  350. "background-image background-position background-repeat border "
  351. "border-bottom border-bottom-color border-bottom-style "
  352. "border-bottom-width border-collapse border-color border-left "
  353. "border-left-color border-left-style border-left-width "
  354. "border-right border-right-color border-right-style "
  355. "border-right-width border-spacing border-style border-top "
  356. "border-top-color border-top-style border-top-width border-width "
  357. "bottom caption-side clear clip color content counter-increment "
  358. "counter-reset cue cue-after cue-before cursor direction display "
  359. "elevation empty-cells float font font-family font-size "
  360. "font-size-adjust font-stretch font-style font-variant "
  361. "font-weight height left letter-spacing line-height list-style "
  362. "list-style-image list-style-position list-style-type margin "
  363. "margin-bottom margin-left margin-right margin-top marker-offset "
  364. "marks max-height max-width min-height min-width orphans outline "
  365. "outline-color outline-style outline-width overflow padding "
  366. "padding-bottom padding-left padding-right padding-top page "
  367. "page-break-after page-break-before page-break-inside pause "
  368. "pause-after pause-before pitch pitch-range play-during position "
  369. "quotes richness right scrollbar-3dlight-color "
  370. "scrollbar-arrow-color scrollbar-base-color "
  371. "scrollbar-darkshadow-color scrollbar-face-color "
  372. "scrollbar-highlight-color scrollbar-shadow-color "
  373. "scrollbar-track-color size speak speak-header speak-numeral "
  374. "speak-punctuation speech-rate stress table-layout text-align "
  375. "text-decoration text-indent text-shadow text-transform top "
  376. "unicode-bidi vertical-align visibility voice-family volume "
  377. "white-space widows width word-spacing z-index",
  378. "first-letter first-line active link visited hover",
  379. "", "", "", "", "", "", "" };
  380.  
  381.  
  382. EDITLEXER lexCSS = { SCLEX_CSS, "CSS Style Sheets", "css", "", &KeyWords_CSS, {
  383.                      { STYLE_DEFAULT, "Default", "", "" },
  384.                      //{ SCE_CSS_DEFAULT, "Default", "", "" },
  385.                      { SCE_CSS_TAG, "Tag", "fore:#0A246A", "" },
  386.                      { SCE_CSS_CLASS, "Class", "fore:#FF0000", "" },
  387.                      { SCE_CSS_PSEUDOCLASS, "Pseudoclass", "fore:#FF0000", "" },
  388.                      { SCE_CSS_UNKNOWN_PSEUDOCLASS, "Unknown Pseudoclass", "fore:#FF0000", "" },
  389.                      { SCE_CSS_OPERATOR, "Operator", "", "" },
  390.                      { SCE_CSS_IDENTIFIER, "Identifier", "fore:#3A6EA5", "" },
  391.                      { SCE_CSS_UNKNOWN_IDENTIFIER, "Unknown Identifier", "", "" },
  392.                      { SCE_CSS_VALUE, "Value", "", "" },
  393.                      { SCE_CSS_COMMENT, "Comment", "fore:#008000", "" },
  394.                      { SCE_CSS_ID, "Id", "", "" },
  395.                      { SCE_CSS_IMPORTANT, "Important", "", "" },
  396.                      { SCE_CSS_DIRECTIVE, "Directive", "", "" },
  397.                      { SCE_CSS_DOUBLESTRING, "String double quoted", "fore:#008000", "" },
  398.                      { SCE_CSS_SINGLESTRING, "String single quoted", "fore:#008000", "" },
  399.                      { -1, "", "", "" } } };
  400.  
  401.  
  402. KEYWORDLIST KeyWords_CPP = {
  403. "and and_eq asm auto bitand bitor bool break case catch char class "
  404. "compl const const_cast continue default delete do double "
  405. "dynamic_cast else enum explicit export extern false float for friend "
  406. "goto if inline int long mutable namespace new not not_eq operator or "
  407. "or_eq private protected public register reinterpret_cast return short "
  408. "signed sizeof static static_cast struct switch template this throw true "
  409. "try typedef typeid typename union unsigned using virtual void volatile "
  410. "wchar_t while xor xor_eq",
  411. "",
  412. "a addindex addtogroup anchor arg attention author b brief bug c class code "
  413. "date def defgroup deprecated dontinclude e em endcode endhtmlonly endif "
  414. "endlatexonly endlink endverbatim enum example exception f$ f[ f] file fn "
  415. "hideinitializer htmlinclude htmlonly if image include ingroup internal invariant "
  416. "interface latexonly li line link mainpage name namespace nosubgrouping note "
  417. "overload p page par param post pre ref relates remarks return retval sa "
  418. "section see showinitializer since skip skipline struct subsection test throw "
  419. "todo typedef union until var verbatim verbinclude version warning "
  420. "weakgroup $ @ \\ & < > # { }",
  421. "", "", "", "", "", "" };
  422.  
  423.  
  424. EDITLEXER lexCPP = { SCLEX_CPP, "C/C++ Source Code", "c;cpp;cxx;h;hxx", "", &KeyWords_CPP, {
  425.                      { STYLE_DEFAULT, "Default", "", "" },
  426.                      //{ SCE_C_DEFAULT, "Default", "", "" },
  427.                      { SCE_C_COMMENT, "Comment", "fore:#008000", "" },
  428.                      { SCE_C_COMMENTLINE, "Comment Line", "fore:#008000", "" },
  429.                      { SCE_C_COMMENTDOC, "Comment Doc", "fore:#008000", "" },
  430.                      { SCE_C_COMMENTLINEDOC, "Comment Line Doc", "fore:#008000", "" },
  431.                      { SCE_C_WORD, "Keyword", "fore:#0A246A;bold", "" },
  432.                      { SCE_C_IDENTIFIER, "Identifier", "", "" },
  433.                      { SCE_C_NUMBER, "Number", "fore:#FF0000", "" },
  434.                      { SCE_C_STRING, "String", "fore:#008000", "" },
  435.                      { SCE_C_STRINGEOL, "String not closed", "fore:#008000;back:#FFFF80;eolfilled", "" },
  436.                      { SCE_C_CHARACTER, "Character", "fore:#008000", "" },
  437.                      //{ SCE_C_UUID, "UUID", "", "" },
  438.                      { SCE_C_OPERATOR, "Operator", "fore:#0A246A", "" },
  439.                      { SCE_C_PREPROCESSOR, "Preprocessor", "fore:#FF8000", "" },
  440.                      //{ SCE_C_VERBATIM, "Verbatim", "", "" },
  441.                      //{ SCE_C_REGEX, "Regex", "", "" },
  442.                      //{ SCE_C_WORD2, "Word 2", "", "" },
  443.                      { SCE_C_COMMENTDOCKEYWORD, "Comment Doc Keyword", "fore:#008000", "" },
  444.                      { SCE_C_COMMENTDOCKEYWORDERROR, "Comment Doc Keyword Error", "fore:#008000", "" },
  445.                      //{ SCE_C_GLOBALCLASS, "Global Class", "", "" },
  446.                      { -1, "", "", "" } } };
  447.  
  448.  
  449. KEYWORDLIST KeyWords_CS = {
  450. "abstract as base bool break byte case catch char checked class const "
  451. "continue decimal default delegate do double else enum event explicit "
  452. "extern false finally fixed float for foreach goto if implicit in int interface "
  453. "internal is lock long namespace new null object operator out override "
  454. "params private protected public readonly ref return sbyte sealed short "
  455. "sizeof stackalloc static string struct switch this throw true try typeof "
  456. "uint ulong unchecked unsafe ushort using virtual void while",
  457. "",
  458. "a addindex addtogroup anchor arg attention author b brief bug c class code "
  459. "date def defgroup deprecated dontinclude e em endcode endhtmlonly endif "
  460. "endlatexonly endlink endverbatim enum example exception f$ f[ f] file fn "
  461. "hideinitializer htmlinclude htmlonly if image include ingroup internal invariant "
  462. "interface latexonly li line link mainpage name namespace nosubgrouping note "
  463. "overload p page par param post pre ref relates remarks return retval sa "
  464. "section see showinitializer since skip skipline struct subsection test throw todo "
  465. "typedef union until var verbatim verbinclude version warning weakgroup $ @ "
  466. "\\ & < > # { }",
  467. "", "", "", "", "", "" };
  468.  
  469.  
  470. EDITLEXER lexCS = { SCLEX_CPP, "C# Source Code", "cs", "", &KeyWords_CS, {
  471.                     { STYLE_DEFAULT, "Default", "", "" },
  472.                     //{ SCE_C_DEFAULT, "Default", "", "" },
  473.                     { SCE_C_COMMENT, "Comment", "fore:#008000", "" },
  474.                     { SCE_C_COMMENTLINE, "Comment Line", "fore:#008000", "" },
  475.                     { SCE_C_COMMENTDOC, "Comment Doc", "fore:#008000", "" },
  476.                     { SCE_C_COMMENTLINEDOC, "Comment Line Doc", "fore:#008000", "" },
  477.                     { SCE_C_WORD, "Keyword", "fore:#0A246A;bold", "" },
  478.                     { SCE_C_IDENTIFIER, "Identifier", "", "" },
  479.                     { SCE_C_NUMBER, "Number", "fore:#FF0000", "" },
  480.                     { SCE_C_STRING, "String", "fore:#008000", "" },
  481.                     { SCE_C_VERBATIM, "Verbatim String", "fore:#008000", "" },
  482.                     { SCE_C_STRINGEOL, "String not closed", "fore:#008000;back:#FFFF80;eolfilled", "" },
  483.                     { SCE_C_CHARACTER, "Character", "fore:#008000", "" },
  484.                     //{ SCE_C_UUID, "UUID", "", "" },
  485.                     { SCE_C_OPERATOR, "Operator", "fore:#0A246A", "" },
  486.                     { SCE_C_PREPROCESSOR, "Preprocessor", "fore:#FF8000", "" },
  487.                     //{ SCE_C_REGEX, "Regex", "", "" },
  488.                     //{ SCE_C_WORD2, "Word 2", "", "" },
  489.                     { SCE_C_COMMENTDOCKEYWORD, "Comment Doc Keyword", "fore:#008000", "" },
  490.                     { SCE_C_COMMENTDOCKEYWORDERROR, "Comment Doc Keyword Error", "fore:#008000", "" },
  491.                     //{ SCE_C_GLOBALCLASS, "Global Class", "", "" },
  492.                     { -1, "", "", "" } } };
  493.  
  494.  
  495. KEYWORDLIST KeyWords_RC = {
  496. "ACCELERATORS ALT AUTO3STATE AUTOCHECKBOX AUTORADIOBUTTON "
  497. "BEGIN BITMAP BLOCK BUTTON CAPTION CHARACTERISTICS CHECKBOX "
  498. "CLASS COMBOBOX CONTROL CTEXT CURSOR DEFPUSHBUTTON DIALOG "
  499. "DIALOGEX DISCARDABLE EDITTEXT END EXSTYLE FONT GROUPBOX "
  500. "ICON LANGUAGE LISTBOX LTEXT MENU MENUEX MENUITEM "
  501. "MESSAGETABLE POPUP PUSHBUTTON RADIOBUTTON RCDATA RTEXT "
  502. "SCROLLBAR SEPARATOR SHIFT STATE3 STRINGTABLE STYLE "
  503. "TEXTINCLUDE VALUE VERSION VERSIONINFO VIRTKEY",
  504. "", "", "", "", "", "", "", "" };
  505.  
  506.  
  507. EDITLEXER lexRC = { SCLEX_CPP, "Resource Script", "rc;rc2;rct;dlg", "", &KeyWords_RC, {
  508.                     { STYLE_DEFAULT, "Default", "", "" },
  509.                     //{ SCE_C_DEFAULT, "Default", "", "" },
  510.                     { SCE_C_COMMENT, "Comment", "fore:#008000", "" },
  511.                     { SCE_C_COMMENTLINE, "Comment Line", "fore:#008000", "" },
  512.                     { SCE_C_COMMENTDOC, "Comment Doc", "fore:#008000", "" },
  513.                     { SCE_C_WORD, "Keyword", "fore:#0A246A;bold", "" },
  514.                     { SCE_C_IDENTIFIER, "Identifier", "", "" },
  515.                     { SCE_C_NUMBER, "Number", "fore:#FF0000", "" },
  516.                     { SCE_C_STRING, "String", "fore:#008000", "" },
  517.                     { SCE_C_STRINGEOL, "String not closed", "fore:#008000;back:#FFFF80;eolfilled", "" },
  518.                     { SCE_C_CHARACTER, "Character", "fore:#008000", "" },
  519.                     //{ SCE_C_UUID, "UUID", "", "" },
  520.                     { SCE_C_OPERATOR, "Operator", "fore:#0A246A", "" },
  521.                     { SCE_C_PREPROCESSOR, "Preprocessor", "fore:#FF8000", "" },
  522.                     //{ SCE_C_VERBATIM, "Verbatim", "", "" },
  523.                     //{ SCE_C_REGEX, "Regex", "", "" },
  524.                     //{ SCE_C_COMMENTLINEDOC, "Comment Line Doc", "", "" },
  525.                     //{ SCE_C_WORD2, "Word 2", "", "" },
  526.                     //{ SCE_C_COMMENTDOCKEYWORD, "Comment Doc Keyword", "", "" },
  527.                     //{ SCE_C_COMMENTDOCKEYWORDERROR, "Comment Doc Keyword Error", "", "" },
  528.                     //{ SCE_C_GLOBALCLASS, "Global Class", "", "" },
  529.                     { -1, "", "", "" } } };
  530.  
  531.  
  532. KEYWORDLIST KeyWords_MAK = {
  533. "", "", "", "", "", "", "", "", "" };
  534.  
  535.  
  536. EDITLEXER lexMAK = { SCLEX_MAKEFILE, "Makefiles", "mak;make", "", &KeyWords_MAK, {
  537.                      { STYLE_DEFAULT, "Default", "", "" },
  538.                      //{ SCE_MAKE_DEFAULT, "Default", "", "" },
  539.                      { SCE_MAKE_COMMENT, "Comment", "fore:#008000", "" },
  540.                      { SCE_MAKE_PREPROCESSOR, "Preprocessor", "fore:#FF8000", "" },
  541.                      { SCE_MAKE_IDENTIFIER, "Identifier", "", "" },
  542.                      { SCE_MAKE_OPERATOR, "Operator", "", "" },
  543.                      { SCE_MAKE_TARGET, "Target", "", "" },
  544.                      { SCE_MAKE_IDEOL, "ID EOL", "", "" },
  545.                      { -1, "", "", "" } } };
  546.  
  547.  
  548. KEYWORDLIST KeyWords_VBS = {
  549. "and begin case call continue do each else elseif end erase error event exit false "
  550. "for function get gosub goto if implement in load loop lset me mid new next not nothing "
  551. "on or property raiseevent rem resume return rset select set stop sub then to true unload "
  552. "until wend while with withevents attribute alias as boolean byref byte byval const compare "
  553. "currency date declare dim double enum explicit friend global integer let lib long module object "
  554. "option optional preserve private property public redim single static string type variant",
  555. "", "", "", "", "", "", "", "" };
  556.  
  557.  
  558. EDITLEXER lexVBS = { SCLEX_VBSCRIPT, "VBScript", "vbs;dsm", "", &KeyWords_VBS, {
  559.                     { STYLE_DEFAULT, "Default", "", "" },
  560.                     //{ SCE_B_DEFAULT, "Default", "", "" },
  561.                     { SCE_B_COMMENT, "Comment", "fore:#008000", "" },
  562.                     { SCE_B_NUMBER, "Number", "fore:#FF0000", "" },
  563.                     { SCE_B_KEYWORD, "Keyword", "fore:#0A246A;bold", "" },
  564.                     { SCE_B_STRING, "String", "fore:#008000", "" },
  565.                     { SCE_B_STRINGEOL, "String not closed", "fore:#008000;back:#FFFF80;eolfilled", "" },
  566.                     { SCE_B_OPERATOR, "Operator", "", "" },
  567.                     { SCE_B_IDENTIFIER, "Identifier", "", "" },
  568.                     //{ SCE_B_DATE, "Date", "", "" },
  569.                     //{ SCE_B_KEYWORD2, "Keyword 2", "", "" },
  570.                     //{ SCE_B_KEYWORD3, "Keyword 3", "", "" },
  571.                     //{ SCE_B_KEYWORD4, "Keyword 4", "", "" },
  572.                     { SCE_B_CONSTANT, "Constant", "", "" },
  573.                     { SCE_B_PREPROCESSOR, "Preprocessor", "#fore:#808080", "" },
  574.                     { SCE_B_ASM, "Assembler", "fore:#FF8000", "" },
  575.                     { -1, "", "", "" } } };
  576.  
  577.  
  578. KEYWORDLIST KeyWords_VB = {
  579. "addhandler addressof andalso alias and ansi as assembly auto boolean byref "
  580. "byte byval call case catch cbool cbyte cchar cdate cdec cdbl char cint class "
  581. "clng cobj const cshort csng cstr ctype date decimal declare default delegate "
  582. "dim do double each else elseif end enum erase error event exit false finally for "
  583. "friend function get gettype goto  handles if implements imports in inherits integer "
  584. "interface is let lib like long loop me mod module mustinherit mustoverride "
  585. "mybase myclass namespace new next not nothing notinheritable notoverridable "
  586. "object on option optional or orelse overloads overridable overrides paramarray "
  587. "preserve private property protected public raiseevent readonly redim rem "
  588. "removehandler resume return select set shadows shared short single static step "
  589. "stop string structure sub synclock then throw to true try typeof unicode until "
  590. "variant when while with withevents writeonly xor",
  591. "", "", "", "", "", "", "", "" };
  592.  
  593.  
  594. EDITLEXER lexVB = { SCLEX_VB, "Visual Basic", "vb;bas;frm;cls;ctl;pag;dsr;dob", "", &KeyWords_VB, {
  595.                     { STYLE_DEFAULT, "Default", "", "" },
  596.                     //{ SCE_B_DEFAULT, "Default", "", "" },
  597.                     { SCE_B_COMMENT, "Comment", "fore:#008000", "" },
  598.                     { SCE_B_NUMBER, "Number", "fore:#FF0000", "" },
  599.                     { SCE_B_KEYWORD, "Keyword", "fore:#0A246A;bold", "" },
  600.                     { SCE_B_STRING, "String", "fore:#008000", "" },
  601.                     { SCE_B_STRINGEOL, "String not closed", "fore:#008000;back:#FFFF80;eolfilled", "" },
  602.                     { SCE_B_OPERATOR, "Operator", "", "" },
  603.                     { SCE_B_IDENTIFIER, "Identifier", "", "" },
  604.                     //{ SCE_B_DATE, "Date", "", "" },
  605.                     //{ SCE_B_KEYWORD2, "Keyword 2", "", "" },
  606.                     //{ SCE_B_KEYWORD3, "Keyword 3", "", "" },
  607.                     //{ SCE_B_KEYWORD4, "Keyword 4", "", "" },
  608.                     { SCE_B_CONSTANT, "Constant", "", "" },
  609.                     { SCE_B_PREPROCESSOR, "Preprocessor", "#fore:#808080", "" },
  610.                     { SCE_B_ASM, "Assembler", "fore:#FF8000", "" },
  611.                     { -1, "", "", "" } } };
  612.  
  613.  
  614. KEYWORDLIST KeyWords_JS = {
  615. "abstract boolean break byte case catch char class const continue "
  616. "debugger default delete do double else enum export extends final "
  617. "finally float for function goto if implements import in instanceof int "
  618. "interface long native new package private protected public return "
  619. "short static super switch synchronized this throw throws transient try "
  620. "typeof var void volatile while with",
  621. "", "", "", "", "", "", "", "" };
  622.  
  623.  
  624. EDITLEXER lexJS = { SCLEX_CPP, "JavaScript", "js;jse", "", &KeyWords_JS, {
  625.                     { STYLE_DEFAULT, "Default", "", "" },
  626.                     //{ SCE_C_DEFAULT, "Default", "", "" },
  627.                     { SCE_C_COMMENT, "Comment", "fore:#008000", "" },
  628.                     { SCE_C_COMMENTLINE, "Comment Line", "fore:#008000", "" },
  629.                     { SCE_C_COMMENTDOC, "Comment Doc", "fore:#008000", "" },
  630.                     { SCE_C_COMMENTLINEDOC, "Comment Line Doc", "fore:#008000", "" },
  631.                     { SCE_C_WORD, "Keyword", "fore:#0A246A;bold", "" },
  632.                     { SCE_C_IDENTIFIER, "Identifier", "", "" },
  633.                     { SCE_C_NUMBER, "Number", "fore:#FF0000", "" },
  634.                     { SCE_C_STRING, "String", "fore:#008000", "" },
  635.                     { SCE_C_STRINGEOL, "String not closed", "fore:#008000;back:#FFFF80;eolfilled", "" },
  636.                     { SCE_C_CHARACTER, "Character", "fore:#008000", "" },
  637.                     //{ SCE_C_UUID, "UUID", "", "" },
  638.                     { SCE_C_OPERATOR, "Operator", "fore:#0A246A", "" },
  639.                     { SCE_C_PREPROCESSOR, "Preprocessor", "fore:#FF8000", "" },
  640.                     //{ SCE_C_VERBATIM, "Verbatim", "", "" },
  641.                     //{ SCE_C_REGEX, "Regex", "", "" },
  642.                     //{ SCE_C_WORD2, "Word 2", "", "" },
  643.                     //{ SCE_C_COMMENTDOCKEYWORD, "Comment Doc Keyword", "", "" },
  644.                     //{ SCE_C_COMMENTDOCKEYWORDERROR, "Comment Doc Keyword Error", "", "" },
  645.                     //{ SCE_C_GLOBALCLASS, "Global Class", "", "" },
  646.                     { -1, "", "", "" } } };
  647.  
  648.  
  649. KEYWORDLIST KeyWords_JAVA = {
  650. "abstract assert boolean break byte case catch char class const "
  651. "continue default do double else extends final finally float for future "
  652. "generic goto if implements import inner instanceof int interface long "
  653. "native new null outer package private protected public rest return "
  654. "short static super switch synchronized this throw throws transient try "
  655. "var void volatile while",
  656. "", "", "", "", "", "", "", "" };
  657.  
  658.  
  659. EDITLEXER lexJAVA = { SCLEX_CPP, "Java Source Code", "java", "", &KeyWords_JAVA, {
  660.                       { STYLE_DEFAULT, "Default", "", "" },
  661.                       //{ SCE_C_DEFAULT, "Default", "", "" },
  662.                       { SCE_C_COMMENT, "Comment", "fore:#008000", "" },
  663.                       { SCE_C_COMMENTLINE, "Comment Line", "fore:#008000", "" },
  664.                       { SCE_C_COMMENTDOC, "Comment Doc", "fore:#008000", "" },
  665.                       { SCE_C_COMMENTLINEDOC, "Comment Line Doc", "fore:#008000", "" },
  666.                       { SCE_C_WORD, "Keyword", "fore:#0A246A;bold", "" },
  667.                       { SCE_C_IDENTIFIER, "Identifier", "", "" },
  668.                       { SCE_C_NUMBER, "Number", "fore:#FF0000", "" },
  669.                       { SCE_C_STRING, "String", "fore:#008000", "" },
  670.                       { SCE_C_STRINGEOL, "String not closed", "fore:#008000;back:#FFFF80;eolfilled", "" },
  671.                       { SCE_C_CHARACTER, "Character", "fore:#008000", "" },
  672.                       //{ SCE_C_UUID, "UUID", "", "" },
  673.                       { SCE_C_OPERATOR, "Operator", "fore:#0A246A", "" },
  674.                       { SCE_C_PREPROCESSOR, "Preprocessor", "fore:#FF8000", "" },
  675.                       //{ SCE_C_VERBATIM, "Verbatim", "", "" },
  676.                       //{ SCE_C_REGEX, "Regex", "", "" },
  677.                       //{ SCE_C_WORD2, "Word 2", "", "" },
  678.                       //{ SCE_C_COMMENTDOCKEYWORD, "Comment Doc Keyword", "", "" },
  679.                       //{ SCE_C_COMMENTDOCKEYWORDERROR, "Comment Doc Keyword Error", "", "" },
  680.                       //{ SCE_C_GLOBALCLASS, "Global Class", "", "" },
  681.                       { -1, "", "", "" } } };
  682.  
  683.  
  684. KEYWORDLIST KeyWords_PAS = {
  685. "and array asm begin case cdecl class const constructor default destructor "
  686. "div do downto else end end. except exit exports external far file finalization "
  687. "finally for function goto if implementation in index inherited initialization inline "
  688. "interface label library message mod near nil not object of on or out overload "
  689. "override packed pascal private procedure program property protected public "
  690. "published raise read record register repeat resourcestring safecall set shl shr "
  691. "stdcall stored string then threadvar to try type unit until uses var virtual "
  692. "while with write xor",
  693. "write read default public protected private property published stored",
  694. "", "", "", "", "", "", "" };
  695.  
  696.  
  697. EDITLEXER lexPAS = { SCLEX_PASCAL, "Pascal Source Code", "pas;dpr;dpk;dfm;inc;pp", "", &KeyWords_PAS, {
  698.                      { STYLE_DEFAULT, "Default", "", "" },
  699.                      //{ 0, "Default", "", "" },
  700.                      { SCE_C_COMMENT, "Comment", "fore:#008000", "" },
  701.                      { SCE_C_COMMENTLINE, "Comment Line", "fore:#008000", "" },
  702.                      { SCE_C_COMMENTDOC, "Comment Doc", "fore:#008000", "" },
  703.                      { SCE_C_WORD, "Keyword", "fore:#800080;bold", "" },
  704.                      { SCE_C_IDENTIFIER, "Identifier", "", "" },
  705.                      //{ SCE_C_STRING, "String", "", "" },
  706.                      //{ SCE_C_STRINGEOL, "String eol", "", "" },
  707.                      { SCE_C_NUMBER, "Number", "fore:#FF0000", "" },
  708.                      { SCE_C_CHARACTER, "String", "fore:#008000", "" },
  709.                      { SCE_C_OPERATOR, "Operator", "fore:#0A246A", "" },
  710.                      { SCE_C_PREPROCESSOR, "Preprocessor", "fore:#808080", "" },
  711.                      { SCE_C_REGEX, "Inline Asm", "fore:#FF8000", "" },
  712.                      //{ SCE_C_COMMENTDOCKEYWORD, "Comment Doc Keyword", "fore:#008000", "" },
  713.                      //{ SCE_C_COMMENTDOCKEYWORDERROR, "Comment Doc Keyword Error", "fore:#008000", "" },
  714.                      { -1, "", "", "" } } };
  715.  
  716.  
  717. KEYWORDLIST KeyWords_ASM = {
  718. "aaa aad aam aas adc add and call cbw clc cld cli cmc cmp cmps cmpsb "
  719. "cmpsw cwd daa das dec div esc hlt idiv imul in inc int into iret ja jae jb jbe "
  720. "jc jcxz je jg jge jl jle jmp jna jnae jnb jnbe jnc jne jng jnge jnl jnle jno jnp "
  721. "jns jnz jo jp jpe jpo js jz lahf lds lea les lods lodsb lodsw loop loope loopew "
  722. "loopne loopnew loopnz loopnzw loopw loopz loopzw mov movs movsb "
  723. "movsw mul neg nop not or out pop popf push pushf rcl rcr ret retf retn rol "
  724. "ror sahf sal sar sbb scas scasb scasw shl shr stc std sti stos stosb stosw "
  725. "sub test wait xchg xlat xlatb xor bound enter ins insb insw leave outs "
  726. "outsb outsw popa pusha pushw arpl lar lsl sgdt sidt sldt smsw str verr "
  727. "verw clts lgdt lidt lldt lmsw ltr bsf bsr bt btc btr bts cdq cmpsd cwde insd "
  728. "iretd iretdf iretf jecxz lfs lgs lodsd loopd looped loopned loopnzd loopzd "
  729. "lss movsd movsx movzx outsd popad popfd pushad pushd pushfd scasd "
  730. "seta setae setb setbe setc sete setg setge setl setle setna setnae "
  731. "setnb setnbe setnc setne setng setnge setnl setnle setno setnp setns "
  732. "setnz seto setp setpe setpo sets setz shld shrd stosd bswap cmpxchg "
  733. "invd invlpg wbinvd xadd lock rep repe repne repnz repz cflush cpuid emms "
  734. "femms cmovo cmovno cmovb cmovc cmovnae cmovae cmovnb cmovnc "
  735. "cmove cmovz cmovne cmovnz cmovbe cmovna cmova cmovnbe cmovs "
  736. "cmovns cmovp cmovpe cmovnp cmovpo cmovl cmovnge cmovge cmovnl "
  737. "cmovle cmovng cmovg cmovnle cmpxchg486 cmpxchg8b loadall loadall286 "
  738. "ibts icebp int1 int3 int01 int03 iretw popaw popfw pushaw pushfw rdmsr "
  739. "rdpmc rdshr rdtsc rsdc rsldt rsm rsts salc smi smint smintold svdc svldt "
  740. "svts syscall sysenter sysexit sysret ud0 ud1 ud2 umov xbts wrmsr wrshr",
  741. "f2xm1 fabs fadd faddp fbld fbstp fchs fclex fcom fcomp fcompp fdecstp "
  742. "fdisi fdiv fdivp fdivr fdivrp feni ffree fiadd ficom ficomp fidiv fidivr fild fimul "
  743. "fincstp finit fist fistp fisub fisubr fld fld1 fldcw fldenv fldenvw fldl2e fldl2t "
  744. "fldlg2 fldln2 fldpi fldz fmul fmulp fnclex fndisi fneni fninit fnop fnsave "
  745. "fnsavew fnstcw fnstenv fnstenvw fnstsw fpatan fprem fptan frndint frstor "
  746. "frstorw fsave fsavew fscale fsqrt fst fstcw fstenv fstenvw fstp fstsw fsub "
  747. "fsubp fsubr fsubrp ftst fwait fxam fxch fxtract fyl2x fyl2xp1 fsetpm fcos "
  748. "fldenvd fnsaved fnstenvd fprem1 frstord fsaved fsin fsincos fstenvd fucom "
  749. "fucomp fucompp fcomi fcomip ffreep fcmovb fcmove fcmovbe fcmovu "
  750. "fcmovnb fcmovne fcmovnbe fcmovnu",
  751. "ah al ax bh bl bp bx ch cl cr0 cr2 cr3 cr4 cs cx dh di dl dr0 dr1 dr2 dr3 dr6 "
  752. "dr7 ds dx eax ebp ebx ecx edi edx es esi esp fs gs si sp ss st tr3 tr4 tr5 "
  753. "tr6 tr7 st0 st1 st2 st3 st4 st5 st6 st7 mm0 mm1 mm2 mm3 mm4 mm5 "
  754. "mm6 mm7 xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7",
  755. ".186 .286 .286c .286p .287 .386 .386c .386p .387 .486 .486p .8086 .8087 "
  756. ".alpha .break .code .const .continue .cref .data .data? .dosseg .else "
  757. ".elseif .endif .endw .err .err1 .err2 .errb .errdef .errdif .errdifi .erre .erridn "
  758. ".erridni .errnb .errndef .errnz .exit .fardata .fardata? .if .lall .lfcond .list "
  759. ".listall .listif .listmacro .listmacroall .model .no87 .nocref .nolist .nolistif "
  760. ".nolistmacro .radix .repeat .sall .seq .sfcond .stack .startup .tfcond .type "
  761. ".until .untilcxz .while .xall .xcref .xlist alias align assume catstr comm "
  762. "comment db dd df dosseg dq dt dup dw echo else elseif elseif1 elseif2 "
  763. "elseifb elseifdef elseifdif elseifdifi elseife elseifidn elseifidni elseifnb "
  764. "elseifndef end endif endm endp ends eq equ even exitm extern externdef "
  765. "extrn for forc ge goto group gt high highword if if1 if2 ifb ifdef ifdif ifdifi ife "
  766. "ifidn ifidni ifnb ifndef include includelib instr invoke irp irpc label le length "
  767. "lengthof local low lowword lroffset lt macro mask mod .msfloat name ne "
  768. "offset opattr option org %out page popcontext proc proto ptr public "
  769. "purge pushcontext record repeat rept seg segment short size sizeof "
  770. "sizestr struc struct substr subtitle subttl textequ this title type typedef "
  771. "union while width db dw dd dq dt resb resw resd resq rest incbin equ "
  772. "times %define %idefine %xdefine %xidefine %undef %assign %iassign "
  773. "%strlen %substr %macro %imacro %endmacro %rotate .nolist %if %elif "
  774. "%else %endif %ifdef %ifndef %elifdef %elifndef %ifmacro %ifnmacro "
  775. "%elifmacro %elifnmacro %ifctk %ifnctk %elifctk %elifnctk %ifidn %ifnidn "
  776. "%elifidn %elifnidn %ifidni %ifnidni %elifidni %elifnidni %ifid %ifnid %elifid "
  777. "%elifnid %ifstr %ifnstr %elifstr %elifnstr %ifnum %ifnnum %elifnum "
  778. "%elifnnum %error %rep %endrep %exitrep %include %push %pop %repl "
  779. "struct endstruc istruc at iend align alignb %arg %stacksize %local %line "
  780. "bits use16 use32 section absolute extern global common cpu org section "
  781. "group import export",
  782. "$ ? @b @f addr basic byte c carry? dword far far16 fortran fword near "
  783. "near16 overflow? parity? pascal qword real4 real8 real10 sbyte sdword "
  784. "sign? stdcall sword syscall tbyte vararg word zero? flat near32 far32 abs "
  785. "all assumes at casemap common compact cpu dotname emulator epilogue "
  786. "error export expr16 expr32 farstack flat forceframe huge language large "
  787. "listing ljmp loadds m510 medium memory nearstack nodotname noemulator "
  788. "nokeyword noljmp nom510 none nonunique nooldmacros nooldstructs "
  789. "noreadonly noscoped nosignextend nothing notpublic oldmacros oldstructs "
  790. "os_dos para private prologue radix readonly req scoped setif2 smallstack "
  791. "tiny use16 use32 uses # nasm directives, mostly complete, does not parse "
  792. "properly a16 a32 o16 o32 byte word dword nosplit $ $$ seq wrt flat large "
  793. "small .text .data .bss near far %0 %1 %2 %3 %4 %5 %6 %7 %8 %9",
  794. "addpd addps addsd addss andpd andps andnpd andnps cmpeqpd cmpltpd "
  795. "cmplepd cmpunordpd cmpnepd cmpnltpd cmpnlepd cmpordpd cmpeqps "
  796. "cmpltps cmpleps cmpunordps cmpneps cmpnltps cmpnleps cmpordps "
  797. "cmpeqsd cmpltsd cmplesd cmpunordsd cmpnesd cmpnltsd cmpnlesd "
  798. "cmpordsd cmpeqss cmpltss cmpless cmpunordss cmpness cmpnltss "
  799. "cmpnless cmpordss comisd comiss cvtdq2pd cvtdq2ps cvtpd2dq cvtpd2pi "
  800. "cvtpd2ps cvtpi2pd cvtpi2ps cvtps2dq cvtps2pd cvtps2pi cvtss2sd "
  801. "cvtss2si cvtsd2si cvtsd2ss cvtsi2sd cvtsi2ss cvttpd2dq cvttpd2pi "
  802. "cvttps2dq cvttps2pi cvttsd2si cvttss2si divpd divps divsd divss fxrstor "
  803. "fxsave ldmxscr lfence mfence maskmovdqu maskmovdq maxpd maxps "
  804. "paxsd maxss minpd minps minsd minss movapd movaps movdq2q movdqa "
  805. "movdqu movhlps movhpd movhps movd movq movlhps movlpd movlps "
  806. "movmskpd movmskps movntdq movnti movntpd movntps movntq "
  807. "movq2dq movsd movss movupd movups mulpd mulps mulsd mulss orpd "
  808. "orps packssdw packsswb packuswb paddb paddsb paddw paddsw paddd "
  809. "paddsiw paddq paddusb paddusw pand pandn pause paveb pavgb pavgw "
  810. "pavgusb pdistib pextrw pcmpeqb pcmpeqw pcmpeqd pcmpgtb pcmpgtw "
  811. "pcmpgtd pf2id pf2iw pfacc pfadd pfcmpeq pfcmpge pfcmpgt pfmax pfmin "
  812. "pfmul pmachriw pmaddwd pmagw pmaxsw pmaxub pminsw pminub "
  813. "pmovmskb pmulhrwc pmulhriw pmulhrwa pmulhuw pmulhw pmullw pmuludq "
  814. "pmvzb pmvnzb pmvlzb pmvgezb pfnacc pfpnacc por prefetch prefetchw "
  815. "prefetchnta prefetcht0 prefetcht1 prefetcht2 pfrcp pfrcpit1 pfrcpit2 "
  816. "pfrsqit1 pfrsqrt pfsub pfsubr pi2fd pf2iw pinsrw psadbw pshufd pshufhw "
  817. "pshuflw pshufw psllw pslld psllq pslldq psraw psrad psrlw psrld psrlq psrldq "
  818. "psubb psubw psubd psubq psubsb psubsw psubusb psubusw psubsiw "
  819. "pswapd punpckhbw punpckhwd punpckhdq punpckhqdq punpcklbw "
  820. "punpcklwd punpckldq punpcklqdq pxor rcpps rcpss rsqrtps rsqrtss sfence "
  821. "shufpd shufps sqrtpd sqrtps sqrtsd sqrtss stmxcsr subpd subps subsd "
  822. "subss ucomisd ucomiss unpckhpd unpckhps unpcklpd unpcklps xorpd xorps",
  823. "", "", "" };
  824.  
  825.  
  826. EDITLEXER lexASM = { SCLEX_ASM, "Assembler", "asm", "", &KeyWords_ASM, {
  827.                      { STYLE_DEFAULT, "Default", "", "" },
  828.                      //{ SCE_ASM_DEFAULT, "Default", "", "" },
  829.                      { SCE_ASM_COMMENT, "Comment", "fore:#008000", "" },
  830.                      //{ SCE_ASM_COMMENTBLOCK, "Comment Block (not used)", "", "" },
  831.                      { SCE_ASM_NUMBER, "Number", "fore:#FF0000", "" },
  832.                      { SCE_ASM_STRING, "String double quoted", "fore:#008000", "" },
  833.                      { SCE_ASM_CHARACTER, "String single quoted", "fore:#008000", "" },
  834.                      { SCE_ASM_STRINGEOL, "String not closed", "fore:#008000;back:#FFFF80;eolfilled", "" },
  835.                      { SCE_ASM_OPERATOR, "Operator", "fore:#0A246A", "" },
  836.                      { SCE_ASM_IDENTIFIER, "Identifier", "", "" },
  837.                      { SCE_ASM_CPUINSTRUCTION, "CPU Instruction", "fore:#0A246A", "" },
  838.                      { SCE_ASM_MATHINSTRUCTION, "FPU Instruction", "fore:#0A246A", "" },
  839.                      { SCE_ASM_REGISTER, "Register", "fore:#FF8000", "" },
  840.                      { SCE_ASM_DIRECTIVE, "Directive", "fore:#0A246A", "" },
  841.                      { SCE_ASM_DIRECTIVEOPERAND, "Directive Operand", "fore:#0A246A", "" },
  842.                      { SCE_ASM_EXTINSTRUCTION, "Extended Instruction", "fore:#0A246A", "" },
  843.                      { -1, "", "", "" } } };
  844.  
  845.  
  846.  
  847. KEYWORDLIST KeyWords_PL = {
  848. "NULL __FILE__ __LINE__ __PACKAGE__ __DATA__ __END__ AUTOLOAD "
  849. "BEGIN CORE DESTROY END EQ GE GT INIT LE LT NE CHECK abs accept alarm "
  850. "and atan2 bind binmode bless caller chdir chmod chomp chop chown chr "
  851. "chroot close closedir cmp connect continue cos crypt dbmclose dbmopen "
  852. "defined delete die do dump each else elsif endgrent endhostent endnetent "
  853. "endprotoent endpwent endservent eof eq eval exec exists exit exp fcntl "
  854. "fileno flock for foreach fork format formline ge getc getgrent getgrgid "
  855. "getgrnam gethostbyaddr gethostbyname gethostent getlogin getnetbyaddr "
  856. "getnetbyname getnetent getpeername getpgrp getppid getpriority "
  857. "getprotobyname getprotobynumber getprotoent getpwent getpwnam "
  858. "getpwuid getservbyname getservbyport getservent getsockname "
  859. "getsockopt glob gmtime goto grep gt hex if index int ioctl join keys kill last lc "
  860. "lcfirst le length link listen local localtime lock log lstat lt m map mkdir msgctl "
  861. "msgget msgrcv msgsnd my ne next no not oct open opendir or ord our pack "
  862. "package pipe pop pos print printf prototype push q qq qr quotemeta qu qw "
  863. "qx rand read readdir readline readlink readpipe recv redo ref rename require "
  864. "reset return reverse rewinddir rindex rmdir s scalar seek seekdir select "
  865. "semctl semget semop send setgrent sethostent setnetent setpgrp "
  866. "setpriority setprotoent setpwent setservent setsockopt shift shmctl shmget "
  867. "shmread shmwrite shutdown sin sleep socket socketpair sort splice split "
  868. "sprintf sqrt srand stat study sub substr symlink syscall sysopen sysread "
  869. "sysseek system syswrite tell telldir tie tied time times tr truncate uc ucfirst "
  870. "umask undef unless unlink unpack unshift untie until use utime values vec "
  871. "wait waitpid wantarray warn while write x xor y",
  872. "", "", "", "", "", "", "", "" };
  873.  
  874.  
  875. EDITLEXER lexPL = { SCLEX_PERL, "Perl/CGI Script", "pl;pm;cgi;pod", "", &KeyWords_PL, {
  876.                     { STYLE_DEFAULT, "Default", "", "" },
  877.                     //{ SCE_PL_DEFAULT, "Default", "", "" },
  878.                     { SCE_PL_ERROR, "Error", "", "" },
  879.                     { SCE_PL_COMMENTLINE, "Comment", "fore:#008000", "" },
  880.                     { SCE_PL_NUMBER, "Number", "", "" },
  881.                     { SCE_PL_WORD, "Keyword", "fore:#FF8000;bold", "" },
  882.                     { SCE_PL_STRING, "String double quoted", "fore:#008000", "" },
  883.                     { SCE_PL_CHARACTER, "String single quoted", "fore:#008000", "" },
  884.                     //{ SCE_PL_PUNCTUATION, "Symbols / Punctuation (not used)", "", "" },
  885.                     //{ SCE_PL_PREPROCESSOR, "Preprocessor (not used)", "", "" },
  886.                     { SCE_PL_OPERATOR, "Operator", "", "" },
  887.                     { SCE_PL_IDENTIFIER, "Identifier", "", "" },
  888.                     { SCE_PL_POD, "POD at beginning of line", "", "" },
  889.                     { SCE_PL_SCALAR, "Scalar $", "", "" },
  890.                     { SCE_PL_ARRAY, "Array @", "", "" },
  891.                     { SCE_PL_HASH, "Hash %", "", "" },
  892.                     { SCE_PL_SYMBOLTABLE, "Symbol Table *", "", "" },
  893.                     { SCE_PL_REGEX, "Regex /re/ or m{re}", "", "" },
  894.                     { SCE_PL_REGSUBST, "Substitution s/re/or e/", "", "" },
  895.                     //{ SCE_PL_LONGQUOTE, "Long Quote (qq, qr, qw, qx) (not used)", "", "" },
  896.                     { SCE_PL_BACKTICKS, "Back Ticks", "", "" },
  897.                     { SCE_PL_DATASECTION, "Data Section", "", "" },
  898.                     { SCE_PL_HERE_DELIM, "Here-doc (Delimiter)", "", "" },
  899.                     { SCE_PL_HERE_Q, "Here-doc (Single quoted, q)", "", "" },
  900.                     { SCE_PL_HERE_QQ, "Here-doc (Double quoted, qq)", "", "" },
  901.                     { SCE_PL_HERE_QX, "Here-doc (Back ticks, qx)", "", "" },
  902.                     { SCE_PL_STRING_Q, "Single quoted string, generic (q)", "", "" },
  903.                     { SCE_PL_STRING_QQ, "Double quoted string (qq)", "", "" },
  904.                     { SCE_PL_STRING_QX, "Back ticks (qx)", "", "" },
  905.                     { SCE_PL_STRING_QR, "Regex (qr)", "", "" },
  906.                     { SCE_PL_STRING_QW, "Array (qw)", "", "" },
  907.                     { -1, "", "", "" } } };
  908.  
  909.  
  910. KEYWORDLIST KeyWords_INI = {
  911. "", "", "", "", "", "", "", "", "" };
  912.  
  913.  
  914. EDITLEXER lexINI = { SCLEX_PROPERTIES, "Configuration Files", "ini;inf;reg;cfg;properties;url", "", &KeyWords_INI, {
  915.                      { STYLE_DEFAULT, "Default", "", "" },
  916.                      //{ SCE_PROPS_DEFAULT, "Default", "", "" },
  917.                      { SCE_PROPS_COMMENT, "Comment", "fore:#008000", "" },
  918.                      { SCE_PROPS_SECTION, "Section", "back:#FF8040;bold;eolfilled", "" },
  919.                      { SCE_PROPS_ASSIGNMENT, "Assignment", "fore:#FF0000", "" },
  920.                      { SCE_PROPS_DEFVAL, "Default Value", "fore:#FF0000", "" },
  921.                      { -1, "", "", "" } } };
  922.  
  923.  
  924. KEYWORDLIST KeyWords_BAT = {
  925. "rem set if exist errorlevel for in do break call chcp cd chdir choice cls "
  926. "country ctty date del erase dir echo exit goto loadfix loadhigh mkdir md "
  927. "move path pause prompt rename ren rmdir rd shift time type ver verify vol "
  928. "com con lpt nul echo.",
  929. "", "", "", "", "", "", "", "" };
  930.  
  931.  
  932. EDITLEXER lexBAT = { SCLEX_BATCH, "Batch Files", "bat;cmd", "", &KeyWords_BAT, {
  933.                      { STYLE_DEFAULT, "Default", "", "" },
  934.                      //{ SCE_BAT_DEFAULT, "Default", "", "" },
  935.                      { SCE_BAT_COMMENT, "Comment", "fore:#008000", "" },
  936.                      { SCE_BAT_WORD, "Keyword", "bold;fore:#0A246A", "" },
  937.                      { SCE_BAT_LABEL, "Label", "fore:#800000;back:#FFFF80;eolfilled", "" },
  938.                      { SCE_BAT_HIDE, "Hide", "", "" },
  939.                      { SCE_BAT_COMMAND, "Command", "bold", "" },
  940.                      { SCE_BAT_IDENTIFIER, "Identifier", "", "" },
  941.                      { SCE_BAT_OPERATOR, "Operator", "", "" },
  942.                      { -1, "", "", "" } } };
  943.  
  944.  
  945. KEYWORDLIST KeyWords_DIFF = {
  946. "", "", "", "", "", "", "", "", "" };
  947.  
  948.  
  949. EDITLEXER lexDIFF = { SCLEX_DIFF, "Diff Files", "diff;patch", "", &KeyWords_DIFF, {
  950.                       { STYLE_DEFAULT, "Default", "", "" },
  951.                       //{ SCE_DIFF_DEFAULT, "Default", "", "" },
  952.                       { SCE_DIFF_COMMENT, "Comment", "fore:#008000", "" },
  953.                       { SCE_DIFF_COMMAND, "Command", "bold;fore:#0A246A", "" },
  954.                       { SCE_DIFF_HEADER, "Source and Destination Files", "fore:#800000;back:#FFFF80;eolfilled", "" },
  955.                       { SCE_DIFF_POSITION, "Position Setting", "fore:#FF0000", "" },
  956.                       { SCE_DIFF_ADDED, "Line Addition", "back:#80FF80;eolfilled", "" },
  957.                       { SCE_DIFF_DELETED, "Line Removal", "back:#FF8080;eolfilled", "" },
  958.                       { -1, "", "", "" } } };
  959.  
  960.  
  961. KEYWORDLIST KeyWords_SQL = {
  962. "absolute action add admin after aggregate alias all allocate alter and any "
  963. "are array as asc assertion at authorization before begin binary bit blob "
  964. "boolean both breadth by call cascade cascaded case cast catalog char "
  965. "character check class clob close collate collation column commit completion "
  966. "connect connection constraint constraints constructor continue "
  967. "corresponding create cross cube current current_date current_path "
  968. "current_role current_time current_timestamp current_user cursor cycle data "
  969. "date day deallocate dec decimal declare default deferrable deferred delete "
  970. "depth deref desc describe descriptor destroy destructor deterministic "
  971. "dictionary diagnostics disconnect distinct domain double drop dynamic each "
  972. "else end end-exec equals escape every except exception exec execute "
  973. "external false fetch first float for foreign found from free full function general "
  974. "get global go goto grant group grouping having host hour identity if ignore "
  975. "immediate in indicator initialize initially inner inout input insert int integer "
  976. "intersect interval into is isolation iterate join key language large last lateral "
  977. "leading left less level like limit local localtime localtimestamp locator map "
  978. "match minute modifies modify module month names national natural nchar "
  979. "nclob new next no none not null numeric object of off old on only open "
  980. "operation option or order ordinality out outer output pad parameter "
  981. "parameters partial path postfix precision prefix preorder prepare preserve "
  982. "primary prior privileges procedure public read reads real recursive ref "
  983. "references referencing relative restrict result return returns revoke right role "
  984. "rollback rollup routine row rows savepoint schema scroll scope search "
  985. "second section select sequence session session_user set sets size smallint "
  986. "some space specific specifictype sql sqlexception sqlstate sqlwarning start "
  987. "state statement static structure system_user table temporary terminate "
  988. "than then time timestamp timezone_hour timezone_minute to trailing "
  989. "transaction translation treat trigger true under union unique unknown unnest "
  990. "update usage user using value values varchar variable varying view when "
  991. "whenever where with without work write year zone",
  992. "", "", "", "", "", "", "", "" };
  993.  
  994.  
  995. EDITLEXER lexSQL = { SCLEX_SQL, "SQL Query", "sql", "", &KeyWords_SQL, {
  996.                      //{ 0, "Default", "", "" },
  997.                      { STYLE_DEFAULT, "Default", "", "" },
  998.                      { 1, "Comment", "fore:#008000", "" },
  999.                      { 2, "Line Comment", "fore:#008000", "" },
  1000.                      { 3, "Doc Comment", "fore:#008000", "" },
  1001.                      { 4, "Number", "fore:#FF0000", "" },
  1002.                      { 5, "Keyword", "fore:#800080;bold", "" },
  1003.                      { 6, "String double quoted", "fore:#008000", "" },
  1004.                      { 7, "String single quoted", "fore:#008000", "" },
  1005.                      //{ 12, "String not closed", "fore:#008000;back:#FFFF80;eolfilled", "" },
  1006.                      { 10, "Operator", "", "" },
  1007.                      { 11, "Identifier", "", "" },
  1008.                      //{ 8, "Symbols", "", "" },
  1009.                      //{ 9, "Preprocessor", "fore:#FF8000", "" },
  1010.                      { -1, "", "", "" } } };
  1011.  
  1012.  
  1013. KEYWORDLIST KeyWords_AS = {
  1014. "arguments break constructor case class continue default delete dynamic false else extends for "
  1015. "function if implements import in instanceof interface intrinsic new newline null private "
  1016. "public return super static switch this true typeof undefined var void while with "
  1017. "Accessibility Arguments Array Boolean Button Camera ContextMenu ContextMenuItem CustomActions "
  1018. "Color Date Error Function Key LoadVars LocalConnection Math Microphone Mouse MovieClip "
  1019. "MovieClipLoader NetConnection NetStream Number PrintJob Object TextField StyleSheet "
  1020. "TextFormat TextSnapshot SharedObject Selection Sound Stage String System XML XMLNode "
  1021. "XMLSocket Void abs acos asin atan atan2 ceil cos exp floor log max min pow random round sin "
  1022. "sqrt tan on onActivity onChanged onClipEvent onClose onConnect onData onDragOut onDragOver "
  1023. "onEnterFrame onID3 onKeyDown onKeyUp onKillFocus onLoad onLoadComplete onLoadError onLoadInit "
  1024. "onLoadProgress onLoadStart onMouseDown onMouseMove onMouseUp onMouseWheel onPress onRelease "
  1025. "onReleaseOutside onResize onRollOut onRollOver onScroller onSelect onSetFocus onSoundComplete "
  1026. "onStatus onUnload onUpdate onXML add addListener addPage addProperty addRequestHeader "
  1027. "allowDomain allowInsecureDomain appendChild apply applyChanges asfunction attachAudio "
  1028. "attachMovie attachSound attachVideo beginFill beginGradientFill call ceil charAt charCodeAt "
  1029. "clear clearInterval cloneNode close concat connect copy cos createElement "
  1030. "createEmptyMovieClip createTextField createTextNode curveTo domain duplicateMovieClip endFill "
  1031. "escape eval evaluate exp findText floor fscommand flush fromCharCode get getAscii "
  1032. "getBeginIndex getBounds getBytesLoaded getBytesTotal getCaretIndex getCode getCount getDate "
  1033. "getDay getDepth getEndIndex getFocus getFontList getFullYear getHours getInstanceAtDepth "
  1034. "getLocal getMilliseconds getMinutes getMonth getNewTextFormat getNextHighestDepth getPan "
  1035. "getProggress getProperty getRGB getSeconds getSelected getSelectedText getSize getStyle "
  1036. "getStyleNames getSWFVersion getText getTextExtent getTextFormat getTextSnapshot getTime "
  1037. "getTimer getTimezoneOffset getTransform getURL getUTCDate getUTCDay getUTCFullYear "
  1038. "getUTCHours getUTCMilliseconds getUTCMinutes getUTCMonth getUTCSeconds getVersion getVolume "
  1039. "getYear globalToLocal gotoAndPlay gotoAndStop hasChildNodes hide hideBuiltInItems hitTest "
  1040. "hitTestTextNearPos indexOf insertBefore install isActive isDown isToggled join lastIndexOf "
  1041. "lineStyle lineTo list load loadClip loadMovie loadMovieNum loadSound loadVariables "
  1042. "loadVariablesNum localToGlobal log mbchr mblength mbord mbsubstring min MMExecute moveTo "
  1043. "nextFrame nextScene parseCSS parseFloat parseInt parseXML pause play pop pow prevScene print "
  1044. "printAsBitmap printAsBitmapNum printNum push random registerClass removeListener "
  1045. "removeMovieClip removeNode removeTextField replaceSel replaceText reverse round seek send "
  1046. "sendAndLoad setBufferTime set setDate setFocus setFullYear setGain setHours setInterval "
  1047. "setMask setMilliseconds setMinutes setMode setMonth setMotionLevel setNewTextFormat setPan "
  1048. "setProperty setQuality setRate setRGB setSeconds setSelectColor setSelected setSelection "
  1049. "setSilenceLevel setStyle setTextFormat setTime setTransform setUseEchoSuppression setUTCDate "
  1050. "setUTCFullYear setUTCHours setUTCMilliseconds setUTCMinutes setUTCMonth setUTCSeconds "
  1051. "setVolume setYear shift show showSettings silenceLevel silenceTimeout sin slice sort sortOn "
  1052. "splice split sqrt start startDrag stop stopAllSounds stopDrag substr substring swapDepths tan "
  1053. "toggleHighQuality toLowerCase toString toUpperCase trace unescape uninstall unLoadClip "
  1054. "unloadMovie unloadMovieNum unshift unwatch updateAfterEvent updateProperties "
  1055. "useEchoSuppression valueOf watch endinitclip include initclip __proto__ _accProps _alpha "
  1056. "_currentframe _droptarget _focusrect _framesloaded _global _height _highquality _level "
  1057. "_lockroot _name _parent _quality _root _rotation _soundbuftime _target _totalframes _url "
  1058. "_visible _width _x _xmouse _xscale _y _ymouse _yscale activityLevel align allowDomain "
  1059. "allowInsecureDomain attributes autoSize avHardwareDisable background backgroundColor "
  1060. "bandwidth blockIndent bold border borderColor bottomScroll bufferLenght bufferTime "
  1061. "builtInItems bullet bytesLoaded bytesTotal callee caller capabilities caption childNodes "
  1062. "color condenseWhite contentType currentFps customItems data deblocking docTypeDecl duration "
  1063. "embedFonts enabled exactSettings firstChild focusEnabled font fps gain globalStyleFormat "
  1064. "hasAccessibility hasAudio hasAudioEncoder hasEmbeddedVideo hasMP3 hasPrinting "
  1065. "hasScreenBroadcast hasScreenPlayback hasStreamingAudio hasStreamingVideo hasVideoEncoder "
  1066. "height hitArea hscroll html htmlText indent index italic instanceof int ignoreWhite "
  1067. "isDebugger isDown isFinite italic language lastChild leading leftMargin length loaded "
  1068. "localFileReadDisable manufacturer maxChars maxhscroll maxscroll menu message motionLevel "
  1069. "motionTimeout mouseWheelEnabled multiline muted name names NaN nextSibling nodeName nodeType "
  1070. "nodeValue os parentNode password pixelAspectRatio playerType previousSibling prototype "
  1071. "quality rate restrict resolutionX resolutionY rightMargin scaleMode screenColor screenDPI "
  1072. "screenResolutionX screenResolutionY scroll selectable separatorBefore showMenu size smoothing "
  1073. "status styleSheet tabChildren tabEnabled tabIndex tabStops target targetPath text textColor "
  1074. "textHeight textWidth time trackAsMenu type typeof underline url useCodepage "
  1075. "useEchoSuppression useHandCursor variable version visible width wordWrap xmlDecl",
  1076. "", "", "", "", "", "", "", "" };
  1077.  
  1078.  
  1079. EDITLEXER lexAS = { SCLEX_CPP, "ActionScript 2.0", "as;mx", "", &KeyWords_AS, {
  1080.                     { STYLE_DEFAULT, "Default", "", "" },
  1081.                     //{ SCE_C_DEFAULT, "Default", "", "" },
  1082.                     { SCE_C_COMMENT, "Comment", "size:-2;fore:#FF0080", "" },
  1083.                     { SCE_C_COMMENTLINE, "Comment Line", "size:-2;fore:#FF0080", "" },
  1084.                     { SCE_C_COMMENTDOC, "Comment Doc", "size:-2;fore:#FF0080", "" },
  1085.                     { SCE_C_COMMENTLINEDOC, "Comment Line Doc", "size:-2;fore:#FF0080", "" },
  1086.                     { SCE_C_WORD, "Keyword", "fore:#000080", "" },
  1087.                     { SCE_C_IDENTIFIER, "Identifier", "", "" },
  1088.                     { SCE_C_NUMBER, "Number", "fore:#FF0000", "" },
  1089.                     { SCE_C_STRING, "String", "fore:#008000", "" },
  1090.                     { SCE_C_STRINGEOL, "String not closed", "fore:#008000;back:#FFFF80;eolfilled", "" },
  1091.                     { SCE_C_CHARACTER, "Character", "fore:#008000", "" },
  1092.                     //{ SCE_C_UUID, "UUID", "", "" },
  1093.                     { SCE_C_OPERATOR, "Operator", "fore:#FF0000", "" },
  1094.                     { SCE_C_PREPROCESSOR, "Preprocessor", "fore:#808080", "" },
  1095.                     //{ SCE_C_VERBATIM, "Verbatim", "", "" },
  1096.                     //{ SCE_C_REGEX, "Regex", "", "" },
  1097.                     //{ SCE_C_WORD2, "Word 2", "", "" },
  1098.                     //{ SCE_C_COMMENTDOCKEYWORD, "Comment Doc Keyword", "", "" },
  1099.                     //{ SCE_C_COMMENTDOCKEYWORDERROR, "Comment Doc Keyword Error", "", "" },
  1100.                     //{ SCE_C_GLOBALCLASS, "Global Class", "", "" },
  1101.                     { -1, "", "", "" } } };
  1102.  
  1103.  
  1104. KEYWORDLIST KeyWords_NSIS = {
  1105. ".onGUIInit .onInit .onInstFailed .onInstSuccess .onMouseOverSection .onNextPage .onPrevPage "
  1106. ".onSelChange .onUninstFailed .onUninstSuccess .onUserAbort .onVerifyInstDir Abort "
  1107. "AddBrandingImage AddSize AllowRootDirInstall AutoCloseWindow BGGradient BrandingText "
  1108. "BringToFront Call CallInstDLL Caption ChangeUI CheckBitmap ClearErrors CompletedText "
  1109. "ComponentText CopyFiles CRCCheck CreateDirectory CreateFont CreateShortCut Delete "
  1110. "DeleteINISec DeleteINIStr DeleteRegKey DeleteRegValue DetailPrint DetailsButtonText DirShow "
  1111. "DirText DisabledBitmap EnabledBitmap EnumRegKey EnumRegValue Exch Exec ExecShell ExecWait "
  1112. "ExpandEnvStrings File FileClose FileErrorText FileOpen FileRead FileReadByte FileSeek "
  1113. "FileWrite FileWriteByte FindClose FindFirst FindNext FindWindow FlushINI Function "
  1114. "FunctionEnd GetCurrentAddress GetDlgItem GetDLLVersion GetDLLVersionLocal GetFileTime "
  1115. "GetFileTimeLocal GetFullPathName GetFunctionAddress GetLabelAddress GetTempFileName Goto "
  1116. "HideWindow Icon IfErrors IfFileExists IfRebootFlag InitPluginsDir InstallButtonText "
  1117. "InstallColors InstallDir InstallDirRegKey InstProgressFlags InstType IntCmp IntCmpU IntFmt "
  1118. "IntOp IsWindow LangString LangStringUP LicenseBkColor LicenseData LicenseText "
  1119. "LoadLanguageFile LogSet LogText MessageBox MiscButtonText Name Nop OutFile PluginDir Pop "
  1120. "Push Quit ReadEnvStr ReadINIStr ReadRegDword ReadRegDWORD ReadRegStr Reboot RegDLL Rename "
  1121. "ReserveFile Return RMDir SearchPath SectionDivider SectionGetFlags SectionGetInstTypes "
  1122. "SectionGetText SectionIn SectionSetFlags SectionSetInstTypes SectionSetText SendMessage "
  1123. "SetAutoClose SetBrandingImage SetCompress SetDatablockOptimize SetDateSave SetDetailsPrint "
  1124. "SetDetailsView SetErrors SetFileAttributes SetFont SetOutPath SetOverwrite SetRebootFlag "
  1125. "SetShellVarContext SetStaticBkColor SetWindowLong ShowInstDetails ShowUninstDetails "
  1126. "ShowWindow SilentInstall SilentUnInstall Sleep SpaceTexts StrCmp StrCpy StrLen SubCaption "
  1127. "UninstallButtonText UninstallCaption UninstallEXEName UninstallIcon UninstallSubCaption "
  1128. "UninstallText UnRegDLL What WindowIcon WriteINIStr WriteRegBin WriteRegDWORD "
  1129. "WriteRegExpandStr WriteRegStr WriteUninstaller XPStyle "
  1130. "!system !include !cd !packhdr !define !undef !ifdef !ifndef !endif !else !macro !macroend "
  1131. "!insertmacro !verbose",
  1132. "${NSISDIR} $0 $1 $2 $3 $4 $5 $6 $7 $8 $9 $CMDLINE $DESKTOP $EXEDIR $HWNDPARENT $INSTDIR "
  1133. "$LANGUAGE $NSISDIR $OUTDIR $PLUGINSDIR $PROGRAMFILES $QUICKLAUNCH "
  1134. "$R $R0 $R1 $R2 $R3 $R4 $R5 $R6 $R7 $R8 $R9 $SMPROGRAMS "
  1135. "$SMSTARTUP $STARTMENU $SYSDIR $TEMP $WINDIR",
  1136. "ALT ARCHIVE auto colored COMPONENTSONLYONCUSTOM CONTROL CUSTOMSTRING EXT false "
  1137. "FILE_ATTRIBUTE_ARCHIVE FILE_ATTRIBUTE_HIDDEN FILE_ATTRIBUTE_NORMAL FILE_ATTRIBUTE_OFFLINE "
  1138. "FILE_ATTRIBUTE_READONLY FILE_ATTRIBUTE_SYSTEM FILE_ATTRIBUTE_TEMPORARY force HIDDEN hide HKCC "
  1139. "HKCR HKCU HKDD HKEY_CLASSES_ROOT HKEY_CURRENT_CONFIG HKEY_CURRENT_USER HKEY_DYN_DATA "
  1140. "HKEY_LOCAL_MACHINE HKEY_PERFORMANCE_DATA HKEY_USERS HKLM HKPD HKU IDABORT IDCANCEL IDIGNORE "
  1141. "IDNO IDOK IDRETRY IDYES ifempty ifnewer MB_ABORTRETRYIGNORE MB_DEFBUTTON1 MB_DEFBUTTON2 "
  1142. "MB_DEFBUTTON3 MB_DEFBUTTON4 MB_ICONEXCLAMATION MB_ICONINFORMATION MB_ICONQUESTION MB_ICONSTOP "
  1143. "MB_OK MB_OKCANCEL MB_RETRYCANCEL MB_RIGHT MB_SETFOREGROUND MB_TOPMOST MB_YESNO MB_YESNOCANCEL "
  1144. "nevershow NOCUSTOM normal NORMAL off OFFLINE on oname READONLY REBOOTOK SHIFT SHORT show "
  1145. "SILENT silent silentlog smooth SW_SHOWMAXIMIZED SW_SHOWMINIMIZED SW_SHOWNORMAL SYSTEM "
  1146. "TEMPORARY true try windows",
  1147. "", "", "", "", "", "" };
  1148.  
  1149.  
  1150. EDITLEXER lexNSIS = { SCLEX_NSIS, "NSIS Script", "nsi;nsh", "", &KeyWords_NSIS, {
  1151.                       { STYLE_DEFAULT, "Default", "", "" },
  1152.                       //{ SCE_NSIS_DEFAULT, "Default", "", "" },
  1153.                       { SCE_NSIS_COMMENT, "Comment", "fore:#007F00", "" },
  1154.                       { SCE_NSIS_STRINGDQ, "String double quoted", "fore:#999999;back:#EEEEEE", "" },
  1155.                       { SCE_NSIS_STRINGLQ, "String left quoted", "fore:#999999;back:#EEEEEE", "" },
  1156.                       { SCE_NSIS_STRINGRQ, "String right quoted", "fore:#999999;back:#EEEEEE", "" },
  1157.                       { SCE_NSIS_FUNCTION, "Function", "fore:#0033CC;bold", "" },
  1158.                       { SCE_NSIS_VARIABLE, "Variable", "fore:#CC3300", "" },
  1159.                       { SCE_NSIS_STRINGVAR, "Variable within String", "fore:#CC3300;back:#EEEEEE", "" },
  1160.                       { SCE_NSIS_NUMBER, "Number", "fore:FF0000", "" },
  1161.                       { SCE_NSIS_LABEL, "Constant", "fore:#FF9900", "" },
  1162.                       //{ SCE_NSIS_USERDEFINED, "User Defined", "", "" },
  1163.                       { SCE_NSIS_SECTIONDEF, "Section", "fore:#0033CC;bold", "" },
  1164.                       { SCE_NSIS_SUBSECTIONDEF, "Sub Section", "fore:#0033CC;bold", "" },
  1165.                       { SCE_NSIS_IFDEFINEDEF, "If Definition", "fore:#0033CC;bold", "" },
  1166.                       { SCE_NSIS_MACRODEF, "Macro Definition", "fore:#0033CC;bold", "" },
  1167.                       { -1, "", "", "" } } };
  1168.  
  1169.  
  1170. KEYWORDLIST KeyWords_PY = {
  1171. "and assert break class continue def del elif else except "
  1172. "exec finally for from global if import in is lambda None "
  1173. "not or pass print raise return try while yield",
  1174. "", "", "", "", "", "", "", "" };
  1175.  
  1176.  
  1177. EDITLEXER lexPY = { SCLEX_PYTHON, "Python Script", "py;pyw", "", &KeyWords_PY, {
  1178.                     { STYLE_DEFAULT, "Default", "", "" },
  1179.                     //{ SCE_P_DEFAULT, "Default", "", "" },
  1180.                     { SCE_P_COMMENTLINE, "Comment", "fore:#007F00", "" },
  1181.                     { SCE_P_COMMENTBLOCK, "Comment Block", "fore:#007F00", "" },
  1182.                     { SCE_P_WORD, "Keyword", "fore:#00007F;bold", "" },
  1183.                     { SCE_P_IDENTIFIER, "Identifier", "", "" },
  1184.                     { SCE_P_NUMBER, "Number", "fore:#007F7F", "" },
  1185.                     { SCE_P_OPERATOR, "Operator", "bold", "" },
  1186.                     { SCE_P_STRING, "String double quoted", "fore:#FF8000", "" },
  1187.                     { SCE_P_CHARACTER, "String single quoted", "fore:#FF8000", "" },
  1188.                     { SCE_P_STRINGEOL, "String not closed", "fore:#FF8000", "" },
  1189.                     { SCE_P_TRIPLEDOUBLE, "String triple double quotes", "fore:#FF8000", "" },
  1190.                     { SCE_P_TRIPLE, "String triple single quotes", "fore:#FF8000", "" },
  1191.                     { SCE_P_CLASSNAME, "Class name", "fore:#0000FF;bold", "" },
  1192.                     { SCE_P_DEFNAME, "Function name", "fore:#007F7F;bold", "" },
  1193.                     { -1, "", "", "" } } };
  1194.  
  1195.  
  1196. /*KEYWORDLIST KeyWords_F = {
  1197. "access action advance allocatable allocate apostrophe assign assignment "
  1198. "associate asynchronous backspace bind blank blockdata call case character "
  1199. "class close common complex contains continue cycle data deallocate decimal "
  1200. "delim default dimension direct do dowhile double doubleprecision else "
  1201. "elseif elsewhere encoding end endassociate endblockdata enddo endfile "
  1202. "endforall endfunction endif endinterface endmodule endprogram endselect "
  1203. "endsubroutine endtype endwhere entry eor equivalence err errmsg exist exit "
  1204. "external file flush fmt forall form format formatted function go goto id if "
  1205. "implicit in include inout integer inquire intent interface intrinsic iomsg "
  1206. "iolength iostat kind len logical module name named namelist nextrec nml "
  1207. "none nullify number only open opened operator optional out pad parameter "
  1208. "pass pause pending pointer pos position precision print private program "
  1209. "protected public quote read readwrite real rec recl recursive result return "
  1210. "rewind save select selectcase selecttype sequential sign size stat status "
  1211. "stop stream subroutine target then to type unformatted unit use value "
  1212. "volatile wait where while write",
  1213. "abs achar acos acosd adjustl adjustr aimag aimax0 aimin0 aint ajmax0 ajmin0 "
  1214. "akmax0 akmin0 all allocated alog alog10 amax0 amax1 amin0 amin1 amod anint "
  1215. "any asin asind associated atan atan2 atan2d atand bitest bitl bitlr bitrl "
  1216. "bjtest bit_size bktest break btest cabs ccos cdabs cdcos cdexp cdlog cdsin "
  1217. "cdsqrt ceiling cexp char clog cmplx conjg cos cosd cosh count cpu_time "
  1218. "cshift csin csqrt dabs dacos dacosd dasin dasind datan datan2 datan2d "
  1219. "datand date date_and_time dble dcmplx dconjg dcos dcosd dcosh dcotan ddim "
  1220. "dexp dfloat dflotk dfloti dflotj digits dim dimag dint dlog dlog10 dmax1 "
  1221. "dmin1 dmod dnint dot_product dprod dreal dsign dsin dsind dsinh dsqrt dtan "
  1222. "dtand dtanh eoshift epsilon errsns exp exponent float floati floatj floatk "
  1223. "floor fraction free huge iabs iachar iand ibclr ibits ibset ichar idate "
  1224. "idim idint idnint ieor ifix iiabs iiand iibclr iibits iibset iidim iidint "
  1225. "iidnnt iieor iifix iint iior iiqint iiqnnt iishft iishftc iisign ilen imax0 "
  1226. "imax1 imin0 imin1 imod index inint inot int int1 int2 int4 int8 iqint "
  1227. "iqnint ior ishft ishftc isign isnan izext jiand jibclr jibits jibset jidim "
  1228. "jidint jidnnt jieor jifix jint jior jiqint jiqnnt jishft jishftc jisign "
  1229. "jmax0 jmax1 jmin0 jmin1 jmod jnint jnot jzext kiabs kiand kibclr kibits "
  1230. "kibset kidim kidint kidnnt kieor kifix kind kint kior kishft kishftc kisign "
  1231. "kmax0 kmax1 kmin0 kmin1 kmod knint knot kzext lbound leadz len len_trim "
  1232. "lenlge lge lgt lle llt log log10 logical lshift malloc matmul max max0 max1 "
  1233. "maxexponent maxloc maxval merge min min0 min1 minexponent minloc minval mod "
  1234. "modulo mvbits nearest nint not nworkers number_of_processors pack popcnt "
  1235. "poppar precision present product radix random random_number random_seed "
  1236. "range real repeat reshape rrspacing rshift scale scan secnds "
  1237. "selected_int_kind selected_real_kind set_exponent shape sign sin sind sinh "
  1238. "size sizeof sngl snglq spacing spread sqrt sum system_clock tan tand tanh "
  1239. "tiny transfer transpose trim ubound unpack verify",
  1240. "cdabs cdcos cdexp cdlog cdsin cdsqrt cotan cotand dcmplx dconjg dcotan "
  1241. "dcotand decode dimag dll_export dll_import doublecomplex dreal dvchk encode "
  1242. "find flen flush getarg getcharqq getcl getdat getenv gettim hfix ibchng "
  1243. "identifier imag int1 int2 int4 intc intrup invalop iostat_msg isha ishc ishl "
  1244. "jfix lacfar locking locnear map nargs nbreak ndperr ndpexc offset ovefl "
  1245. "peekcharqq precfill prompt qabs qacos qacosd qasin qasind qatan qatand "
  1246. "qatan2 qcmplx qconjg qcos qcosd qcosh qdim qexp qext qextd qfloat qimag qlog "
  1247. "qlog10 qmax1 qmin1 qmod qreal qsign qsin qsind qsinh qsqrt qtan qtand qtanh "
  1248. "ran rand randu rewrite segment setdat settim system timer undfl unlock union "
  1249. "val virtual volatile zabs zcos zexp zlog zsin zsqrt",
  1250. "", "", "", "", "", "" };
  1251.  
  1252.  
  1253. EDITLEXER lexF77 = { SCLEX_F77, "Fortran 77", "f;for", "", &KeyWords_F, {
  1254.                      { STYLE_DEFAULT, "Default", "", "" },
  1255.                      //{ SCE_F_DEFAULT, "Default", "", "" },
  1256.                      { SCE_F_COMMENT, "Comment", "", "" },
  1257.                      { SCE_F_NUMBER, "Number", "", "" },
  1258.                      { SCE_F_STRING1, "Single quoted string", "", "" },
  1259.                      { SCE_F_STRING2, "Double quoted string", "", "" },
  1260.                      { SCE_F_STRINGEOL, "End of line where string is not closed", "", "" },
  1261.                      { SCE_F_OPERATOR, "Operators", "", "" },
  1262.                      { SCE_F_IDENTIFIER, "Identifiers", "", "" },
  1263.                      { SCE_F_WORD, "Keywords", "", "" },
  1264.                      { SCE_F_WORD2, "Keywords2", "", "" },
  1265.                      { SCE_F_WORD3, "Keywords3", "", "" },
  1266.                      { SCE_F_PREPROCESSOR, "Preprocessor", "", "" },
  1267.                      { SCE_F_OPERATOR2, "Operators in .NAME. format", "", "" },
  1268.                      { SCE_F_LABEL, "Label", "", "" },
  1269.                      { SCE_F_CONTINUATION, "Continuation", "", "" },
  1270.                      { -1, "", "", "" } } };
  1271.  
  1272.  
  1273. EDITLEXER lexF90 = { SCLEX_FORTRAN, "Fortran 90", "f90;f95;f2k", "", &KeyWords_F, {
  1274.                      { STYLE_DEFAULT, "Default", "", "" },
  1275.                      //{ SCE_F_DEFAULT, "Default", "", "" },
  1276.                      { SCE_F_COMMENT, "Comment", "", "" },
  1277.                      { SCE_F_NUMBER, "Number", "", "" },
  1278.                      { SCE_F_STRING1, "Single quoted string", "", "" },
  1279.                      { SCE_F_STRING2, "Double quoted string", "", "" },
  1280.                      { SCE_F_STRINGEOL, "End of line where string is not closed", "", "" },
  1281.                      { SCE_F_OPERATOR, "Operators", "", "" },
  1282.                      { SCE_F_IDENTIFIER, "Identifiers", "", "" },
  1283.                      { SCE_F_WORD, "Keywords", "", "" },
  1284.                      { SCE_F_WORD2, "Keywords2", "", "" },
  1285.                      { SCE_F_WORD3, "Keywords3", "", "" },
  1286.                      { SCE_F_PREPROCESSOR, "Preprocessor", "", "" },
  1287.                      { SCE_F_OPERATOR2, "Operators in .NAME. format", "", "" },
  1288.                      { SCE_F_LABEL, "Label", "", "" },
  1289.                      { SCE_F_CONTINUATION, "Continuation", "", "" },
  1290.                      { -1, "", "", "" } } }; */
  1291.  
  1292.  
  1293. // This array holds all the lexers...
  1294. //#define NUMLEXERS 22
  1295. PEDITLEXER pLexArray[NUMLEXERS] =
  1296. { &lexDefault,
  1297.   &lexHTML,
  1298.   &lexXML,
  1299.   &lexCSS,
  1300.   &lexJS,
  1301.   &lexVBS,
  1302.   &lexPL,
  1303.   &lexAS,
  1304.   &lexCPP,
  1305.   &lexCS,
  1306.   &lexRC,
  1307.   &lexMAK,
  1308.   &lexJAVA,
  1309.   &lexVB,
  1310.   &lexPAS,
  1311.   &lexASM,
  1312.   &lexSQL,
  1313.   &lexPY,
  1314.   &lexNSIS,
  1315.   &lexINI,
  1316.   &lexBAT,
  1317.   &lexDIFF };
  1318.  
  1319.  
  1320. // Currently used lexer
  1321. PEDITLEXER pLexCurrent = &lexDefault;
  1322.  
  1323.  
  1324. // Custom colors
  1325. COLORREF crCustom[16];
  1326.  
  1327.  
  1328. // use 2nd default style
  1329. BOOL bUse2ndDefaultStyle;
  1330.  
  1331.  
  1332. // base font size used for relative values
  1333. int iBaseFontSize = 10;
  1334.  
  1335.  
  1336. // default lexer
  1337. int iDefaultLexer;
  1338.  
  1339.  
  1340. // automatically select lexer
  1341. BOOL bAutoSelect;
  1342.  
  1343.  
  1344. // scheme select dlg dimensions
  1345. int cxStyleSelectDlg;
  1346. int cyStyleSelectDlg;
  1347.  
  1348.  
  1349. // default codepage and character set
  1350. extern int  iDefaultCodePage;
  1351. extern int  iDefaultCharSet;
  1352. extern BOOL bAutoSelACP;
  1353.  
  1354.  
  1355. //=============================================================================
  1356. //
  1357. //  Style_Load()
  1358. //
  1359. void Style_Load(HKEY hKeyRoot)
  1360. {
  1361.   int i,iLexer;
  1362.   char tch[32];
  1363.   HKEY hKey;
  1364.  
  1365.   for (iLexer = 0; iLexer < NUMLEXERS; iLexer++)
  1366.   {
  1367.     hKey = RegGetSubKey(hKeyRoot,pLexArray[iLexer]->pszName);
  1368.     if (!RegGetString(hKey,"",pLexArray[iLexer]->pszDefExt,
  1369.           pLexArray[iLexer]->szExtensions,COUNTOF(pLexArray[iLexer]->szExtensions)))
  1370.       lstrcpyn(pLexArray[iLexer]->szExtensions,pLexArray[iLexer]->pszDefExt,
  1371.         COUNTOF(pLexArray[iLexer]->szExtensions));
  1372.     i = 0;
  1373.     while (pLexArray[iLexer]->Styles[i].iStyle != -1)
  1374.     {
  1375.       RegGetString(hKey,pLexArray[iLexer]->Styles[i].pszName,
  1376.         pLexArray[iLexer]->Styles[i].pszDefault,
  1377.         pLexArray[iLexer]->Styles[i].szValue,
  1378.         COUNTOF(pLexArray[iLexer]->Styles[i].szValue));
  1379.       i++;
  1380.     }
  1381.     RegCloseKey(hKey);
  1382.   }
  1383.  
  1384.   // Custom colors
  1385.   crCustom[0] = RGB(0,0,128);                     crCustom[8]  = RGB(255,255,226);
  1386.   crCustom[1] = GetSysColor(COLOR_WINDOWTEXT);    crCustom[9]  = GetSysColor(COLOR_WINDOW);
  1387.   crCustom[2] = GetSysColor(COLOR_INFOTEXT);      crCustom[10] = GetSysColor(COLOR_INFOBK);
  1388.   crCustom[3] = GetSysColor(COLOR_HIGHLIGHTTEXT); crCustom[11] = GetSysColor(COLOR_HIGHLIGHT);
  1389.   crCustom[4] = GetSysColor(COLOR_ACTIVECAPTION); crCustom[12] = GetSysColor(COLOR_DESKTOP);
  1390.   crCustom[5] = GetSysColor(COLOR_3DFACE);        crCustom[13] = GetSysColor(COLOR_3DHILIGHT);
  1391.   crCustom[6] = GetSysColor(COLOR_3DLIGHT);       crCustom[14] = GetSysColor(COLOR_3DSHADOW);
  1392.   crCustom[7] = GetSysColor(COLOR_APPWORKSPACE);  crCustom[15] = GetSysColor(COLOR_SCROLLBAR);
  1393.  
  1394.   hKey = RegGetSubKey(hKeyRoot,"Colors");
  1395.   for (i = 0; i < 16; i++)
  1396.   {
  1397.     wsprintf(tch,"Color %02i",i+1);
  1398.     crCustom[i] = RegGetInt(hKey,tch,crCustom[i]);
  1399.   }
  1400.   RegCloseKey(hKey);
  1401.  
  1402.   // 2nd default
  1403.   bUse2ndDefaultStyle = (RegGetInt(hKeyRoot,"Use2ndDefaultStyle",0)) ? 1 : 0;
  1404.  
  1405.   // default scheme
  1406.   iDefaultLexer = RegGetInt(hKeyRoot,"DefaultScheme",0);
  1407.   iDefaultLexer = min(max(iDefaultLexer,0),NUMLEXERS-1);
  1408.  
  1409.   // auto select
  1410.   bAutoSelect = (RegGetInt(hKeyRoot,"AutoSelect",1)) ? 1 : 0;
  1411.  
  1412.   // scheme select dlg dimensions
  1413.   cxStyleSelectDlg = RegGetInt(hKeyRoot,"SelectDlgSizeX",0);
  1414.   cxStyleSelectDlg = max(cxStyleSelectDlg,0);
  1415.  
  1416.   cyStyleSelectDlg = RegGetInt(hKeyRoot,"SelectDlgSizeY",0);
  1417.   cyStyleSelectDlg = max(cyStyleSelectDlg,0);
  1418. }
  1419.  
  1420.  
  1421. //=============================================================================
  1422. //
  1423. //  Style_Save()
  1424. //
  1425. void Style_Save(HKEY hKeyRoot)
  1426. {
  1427.   int i,iLexer;
  1428.   char tch[32];
  1429.   HKEY hKey;
  1430.  
  1431.   for (iLexer = 0; iLexer < NUMLEXERS; iLexer++)
  1432.   {
  1433.     hKey = RegGetSubKey(hKeyRoot,pLexArray[iLexer]->pszName);
  1434.     RegSetString(hKey,"",pLexArray[iLexer]->szExtensions);
  1435.     i = 0;
  1436.     while (pLexArray[iLexer]->Styles[i].iStyle != -1) {
  1437.       RegSetString(hKey,pLexArray[iLexer]->Styles[i].pszName,pLexArray[iLexer]->Styles[i].szValue);
  1438.       i++; }
  1439.     RegCloseKey(hKey);
  1440.   }
  1441.  
  1442.   // Custom colors
  1443.   hKey = RegGetSubKey(hKeyRoot,"Colors");
  1444.   for (i = 0; i < 16; i++)
  1445.   {
  1446.     wsprintf(tch,"Color %02i",i+1);
  1447.     RegSetInt(hKey,tch,crCustom[i]);
  1448.   }
  1449.   RegCloseKey(hKey);
  1450.  
  1451.   // auto select
  1452.   RegSetInt(hKeyRoot,"Use2ndDefaultStyle",bUse2ndDefaultStyle);
  1453.  
  1454.   // default scheme
  1455.   RegSetInt(hKeyRoot,"DefaultScheme",iDefaultLexer);
  1456.  
  1457.   // auto select
  1458.   RegSetInt(hKeyRoot,"AutoSelect",bAutoSelect);
  1459.  
  1460.   // scheme select dlg dimensions
  1461.   RegSetInt(hKeyRoot,"SelectDlgSizeX",cxStyleSelectDlg);
  1462.   RegSetInt(hKeyRoot,"SelectDlgSizeY",cyStyleSelectDlg);
  1463. }
  1464.  
  1465.  
  1466. //=============================================================================
  1467. //
  1468. //  Style_SetLexer()
  1469. //
  1470. void Style_SetLexer(HWND hwnd,PEDITLEXER pLexNew)
  1471. {
  1472.   int i;
  1473.   //char *p;
  1474.   int rgb;
  1475.   int iValue;
  1476.   int iIdx;
  1477.   char tch[128];
  1478.  
  1479.   // Select default if NULL is specified
  1480.   if (!pLexNew)
  1481.     pLexNew = pLexArray[iDefaultLexer];
  1482.  
  1483.   // Clear
  1484.   SendMessage(hwnd,SCI_CLEARDOCUMENTSTYLE,0,0);
  1485.  
  1486.   // Lexer
  1487.   SendMessage(hwnd,SCI_SETLEXER,pLexNew->iLexer,0);
  1488.  
  1489.   if (pLexNew->iLexer == SCLEX_HTML || pLexNew->iLexer == SCLEX_XML)
  1490.     SendMessage(hwnd,SCI_SETSTYLEBITS,7,0);
  1491.   else
  1492.     SendMessage(hwnd,SCI_SETSTYLEBITS,5,0);
  1493.  
  1494.   // Add KeyWord Lists
  1495.   for (i = 0; i < 9; i++) {
  1496.     SendMessage(hwnd,SCI_SETKEYWORDS,i,(LPARAM)pLexNew->pKeyWords->pszKeyWords[i]); }
  1497.  
  1498.   // Use 2nd default style
  1499.   iIdx = (bUse2ndDefaultStyle) ? 14 : 0;
  1500.  
  1501.   // Default Values are always set
  1502.   SendMessage(hwnd,SCI_STYLERESETDEFAULT,0,0);
  1503.   SendMessage(hwnd,SCI_STYLESETCHARACTERSET,STYLE_DEFAULT,(LPARAM)iDefaultCharSet);
  1504.   iBaseFontSize = 10;
  1505.   Style_SetStyles(hwnd,lexDefault.Styles[0+iIdx].iStyle,lexDefault.Styles[0+iIdx].szValue);  // default
  1506.   Style_StrGetSize(lexDefault.Styles[0+iIdx].szValue,&iBaseFontSize);                        // base size
  1507.  
  1508.   // Auto-select codepage according to charset
  1509.   Style_SetACPfromCharSet(hwnd);
  1510.  
  1511.   if (!Style_StrGetColor(TRUE,lexDefault.Styles[0+iIdx].szValue,&iValue))
  1512.     SendMessage(hwnd,SCI_STYLESETFORE,STYLE_DEFAULT,(LPARAM)GetSysColor(COLOR_WINDOWTEXT));   // default text color
  1513.   if (!Style_StrGetColor(FALSE,lexDefault.Styles[0+iIdx].szValue,&iValue))
  1514.     SendMessage(hwnd,SCI_STYLESETBACK,STYLE_DEFAULT,(LPARAM)GetSysColor(COLOR_WINDOW));       // default window color
  1515.  
  1516.   if (pLexNew->iLexer != SCLEX_NULL) {
  1517.     Style_SetStyles(hwnd,pLexNew->Styles[0].iStyle,pLexNew->Styles[0].szValue); } // lexer default
  1518.   SendMessage(hwnd,SCI_STYLECLEARALL,0,0);
  1519.  
  1520.   Style_SetStyles(hwnd,lexDefault.Styles[1+iIdx].iStyle,lexDefault.Styles[1+iIdx].szValue); // linenumber
  1521.   Style_SetStyles(hwnd,lexDefault.Styles[2+iIdx].iStyle,lexDefault.Styles[2+iIdx].szValue); // brace light
  1522.   Style_SetStyles(hwnd,lexDefault.Styles[3+iIdx].iStyle,lexDefault.Styles[3+iIdx].szValue); // brace bad
  1523.   Style_SetStyles(hwnd,lexDefault.Styles[4+iIdx].iStyle,lexDefault.Styles[4+iIdx].szValue); // control char
  1524.   Style_SetStyles(hwnd,lexDefault.Styles[5+iIdx].iStyle,lexDefault.Styles[5+iIdx].szValue); // indent guide
  1525.  
  1526.   // More default values...
  1527.   if (Style_StrGetColor(TRUE,lexDefault.Styles[6+iIdx].szValue,&rgb)) // selection fore
  1528.     SendMessage(hwnd,SCI_SETSELFORE,TRUE,rgb);
  1529.   else
  1530.     SendMessage(hwnd,SCI_SETSELFORE,0,0);
  1531.  
  1532.   if (Style_StrGetColor(FALSE,lexDefault.Styles[6+iIdx].szValue,&rgb)) // selection back
  1533.     SendMessage(hwnd,SCI_SETSELBACK,TRUE,rgb);
  1534.   else
  1535.     SendMessage(hwnd,SCI_SETSELBACK,TRUE,RGB(0xC0,0xC0,0xC0)); // use a default value...
  1536.  
  1537.   if (Style_StrGetColor(TRUE,lexDefault.Styles[7+iIdx].szValue,&rgb)) // whitespace fore
  1538.     SendMessage(hwnd,SCI_SETWHITESPACEFORE,TRUE,rgb);
  1539.   else
  1540.     SendMessage(hwnd,SCI_SETWHITESPACEFORE,0,0);
  1541.  
  1542.   if (Style_StrGetColor(FALSE,lexDefault.Styles[7+iIdx].szValue,&rgb)) // whitespace back
  1543.     SendMessage(hwnd,SCI_SETWHITESPACEBACK,TRUE,rgb);
  1544.   else
  1545.     SendMessage(hwnd,SCI_SETWHITESPACEBACK,0,0);    // use a default value...
  1546.  
  1547.   if (Style_StrGetColor(FALSE,lexDefault.Styles[8+iIdx].szValue,&rgb)) // caret line back
  1548.   {
  1549.     SendMessage(hwnd,SCI_SETCARETLINEVISIBLE,TRUE,0);
  1550.     SendMessage(hwnd,SCI_SETCARETLINEBACK,rgb,0);
  1551.   }
  1552.   else
  1553.     SendMessage(hwnd,SCI_SETCARETLINEVISIBLE,FALSE,0);
  1554.  
  1555.   if (Style_StrGetColor(TRUE,lexDefault.Styles[9+iIdx].szValue,&rgb)) // caret fore
  1556.     SendMessage(hwnd,SCI_SETCARETFORE,rgb,0);
  1557.   else
  1558.     SendMessage(hwnd,SCI_SETCARETFORE,GetSysColor(COLOR_WINDOWTEXT),0); // default value
  1559.  
  1560.   // caret width
  1561.   iValue = 1;
  1562.   Style_StrGetSize(lexDefault.Styles[10+iIdx].szValue,&iValue);
  1563.   iValue = max(min(iValue,3),1);
  1564.   wsprintf(lexDefault.Styles[10+iIdx].szValue,"size:%i",iValue);
  1565.   SendMessage(hwnd,SCI_SETCARETWIDTH,iValue,0);
  1566.  
  1567.   if (SendMessage(hwnd,SCI_GETEDGEMODE,0,0) == EDGE_LINE) {
  1568.     if (Style_StrGetColor(TRUE,lexDefault.Styles[11+iIdx].szValue,&rgb)) // edge fore
  1569.       SendMessage(hwnd,SCI_SETEDGECOLOUR,rgb,0);
  1570.     else
  1571.       SendMessage(hwnd,SCI_SETEDGECOLOUR,GetSysColor(COLOR_3DLIGHT),0); }
  1572.   else {
  1573.     if (Style_StrGetColor(FALSE,lexDefault.Styles[11+iIdx].szValue,&rgb)) // edge back
  1574.       SendMessage(hwnd,SCI_SETEDGECOLOUR,rgb,0);
  1575.     else
  1576.       SendMessage(hwnd,SCI_SETEDGECOLOUR,GetSysColor(COLOR_3DLIGHT),0); }
  1577.  
  1578.   lstrcpyn(tch,lexDefault.Styles[12+iIdx].szValue,COUNTOF(tch)); // bookmark icon
  1579.   TrimString(tch);
  1580.   if (1 == sscanf(tch,"%i",&iValue))
  1581.   {
  1582.     LPSTR pszXPM;
  1583.     iValue = max(min(iValue+99,IDX_BM8),IDX_BM0);
  1584.     pszXPM = LoadXPM(g_hInstance,iValue);
  1585.     SendMessage(hwnd,SCI_MARKERDEFINE,0,SC_MARK_PIXMAP);
  1586.     SendMessage(hwnd,SCI_MARKERDEFINEPIXMAP,0,(LPARAM)pszXPM);
  1587.     LocalFree(pszXPM);
  1588.   }
  1589.  
  1590.   SendMessage(hwnd,SCI_MARKERSETFORE,0,(WPARAM)RGB(0,0,0));             // bookmark line fore (default)
  1591.  
  1592.   if (Style_StrGetColor(FALSE,lexDefault.Styles[13+iIdx].szValue,&rgb)) // bookmark line back
  1593.     SendMessage(hwnd,SCI_MARKERSETBACK,0,(WPARAM)rgb);
  1594.   else
  1595.     SendMessage(hwnd,SCI_MARKERSETBACK,0,(WPARAM)RGB(0xAB,0xCD,0xEF));
  1596.  
  1597.   if (pLexNew->iLexer != SCLEX_NULL)
  1598.   {
  1599.     i = 1;
  1600.     while (pLexNew->Styles[i].iStyle != -1) {
  1601.       Style_SetStyles(hwnd,pLexNew->Styles[i].iStyle,pLexNew->Styles[i].szValue);
  1602.       i++; }
  1603.   }
  1604.  
  1605.   SendMessage(hwnd,SCI_COLOURISE,0,(LPARAM)-1);
  1606.  
  1607.   // Save current lexer
  1608.   pLexCurrent = pLexNew;
  1609. }
  1610.  
  1611.  
  1612. //=============================================================================
  1613. //
  1614. //  Style_SetACPfromCharSet()
  1615. //
  1616. void Style_SetACPfromCharSet(HWND hwnd)
  1617. {
  1618.   int iValue;
  1619.  
  1620.   // Use 2nd default style
  1621.   int iIdx = (bUse2ndDefaultStyle) ? 14 : 0;
  1622.  
  1623.   if (bAutoSelACP) {
  1624.     iValue = iDefaultCharSet;
  1625.     Style_StrGetCharSet(lexDefault.Styles[0+iIdx].szValue,&iValue);
  1626.     iDefaultCodePage = CodePageFromCharSet(iValue);
  1627.     if (SendMessage(hwnd,SCI_GETCODEPAGE,0,0) != SC_CP_UTF8)
  1628.       SendMessage(hwnd,SCI_SETCODEPAGE,(WPARAM)iDefaultCodePage,0); }
  1629. }
  1630.  
  1631.  
  1632. //=============================================================================
  1633. //
  1634. //  Style_SetLongLineColors()
  1635. //
  1636. void Style_SetLongLineColors(HWND hwnd)
  1637. {
  1638.   int rgb;
  1639.  
  1640.   // Use 2nd default style
  1641.   int iIdx = (bUse2ndDefaultStyle) ? 14 : 0;
  1642.  
  1643.   if (SendMessage(hwnd,SCI_GETEDGEMODE,0,0) == EDGE_LINE) {
  1644.     if (Style_StrGetColor(TRUE,lexDefault.Styles[11+iIdx].szValue,&rgb)) // edge fore
  1645.       SendMessage(hwnd,SCI_SETEDGECOLOUR,rgb,0);
  1646.     else
  1647.       SendMessage(hwnd,SCI_SETEDGECOLOUR,GetSysColor(COLOR_3DLIGHT),0); }
  1648.   else {
  1649.     if (Style_StrGetColor(FALSE,lexDefault.Styles[11+iIdx].szValue,&rgb)) // edge back
  1650.       SendMessage(hwnd,SCI_SETEDGECOLOUR,rgb,0);
  1651.     else
  1652.       SendMessage(hwnd,SCI_SETEDGECOLOUR,GetSysColor(COLOR_3DLIGHT),0); }
  1653. }
  1654.  
  1655.  
  1656. //=============================================================================
  1657. //
  1658. //  Style_SetLexerFromFile()
  1659. //
  1660. void Style_SetLexerFromFile(HWND hwnd,LPCSTR lpszFile)
  1661. {
  1662.   int i;
  1663.   LPSTR lpszExt;
  1664.   char  tch[256+16];
  1665.   char  *p1,*p2;
  1666.   BOOL  bFound = FALSE;
  1667.   PEDITLEXER pLexNew = pLexArray[iDefaultLexer];
  1668.  
  1669.   lpszExt = PathFindExtension(lpszFile);
  1670.  
  1671.   if (lpszFile && lstrlen(lpszFile) > 0 &&
  1672.       *lpszExt &&
  1673.       bAutoSelect) // bAutoSelect == FALSE skips lexer search
  1674.   {
  1675.     // Skip the . (dot)
  1676.     lpszExt++;
  1677.  
  1678.     // Check Lexers
  1679.     for (i = 0; i < NUMLEXERS; i++)
  1680.     {
  1681.       if (bFound)
  1682.         break;
  1683.  
  1684.       ZeroMemory(tch,COUNTOF(tch));
  1685.       lstrcpy(tch,pLexArray[i]->szExtensions);
  1686.       p1 = tch;
  1687.       while (*p1 && !bFound)
  1688.       {
  1689.         if (p2 = StrChr(p1,';'))
  1690.           *p2 = '\0';
  1691.         else
  1692.           p2 = StrEnd(p1);
  1693.         if (lstrcmpi(p1,lpszExt) == 0)
  1694.         {
  1695.           pLexNew = pLexArray[i];
  1696.           bFound = TRUE;
  1697.         }
  1698.         p1 = p2+1;
  1699.       }
  1700.     }
  1701.   }
  1702.  
  1703.   // Apply the new lexer
  1704.   Style_SetLexer(hwnd,pLexNew);
  1705. }
  1706.  
  1707.  
  1708. //=============================================================================
  1709. //
  1710. //  Style_SetDefaultLexer()
  1711. //
  1712. void Style_SetDefaultLexer(HWND hwnd)
  1713. {
  1714.   Style_SetLexer(hwnd,pLexArray[0]);
  1715. }
  1716.  
  1717.  
  1718. //=============================================================================
  1719. //
  1720. //  Style_SetHTMLLexer()
  1721. //
  1722. void Style_SetHTMLLexer(HWND hwnd)
  1723. {
  1724.   Style_SetLexer(hwnd,pLexArray[1]);
  1725. }
  1726.  
  1727.  
  1728. //=============================================================================
  1729. //
  1730. //  Style_SetXMLLexer()
  1731. //
  1732. void Style_SetXMLLexer(HWND hwnd)
  1733. {
  1734.   Style_SetLexer(hwnd,pLexArray[2]);
  1735. }
  1736.  
  1737.  
  1738. //=============================================================================
  1739. //
  1740. //  Style_ToggleUse2ndDefault()
  1741. //
  1742. void Style_ToggleUse2ndDefault(HWND hwnd)
  1743. {
  1744.   bUse2ndDefaultStyle = (bUse2ndDefaultStyle) ? 0 : 1;
  1745.   Style_SetLexer(hwnd,pLexCurrent);
  1746. }
  1747.  
  1748.  
  1749. //=============================================================================
  1750. //
  1751. //  Style_GetUse2ndDefault()
  1752. //
  1753. BOOL Style_GetUse2ndDefault(HWND hwnd)
  1754. {
  1755.   return (bUse2ndDefaultStyle);
  1756. }
  1757.  
  1758.  
  1759. //=============================================================================
  1760. //
  1761. //  Style_GetFileOpenDlgFilter()
  1762. //
  1763. BOOL Style_GetOpenDlgFilterStr(LPSTR lpszFilter,int cchFilter)
  1764. {
  1765.   int i;
  1766.   int iSize;
  1767.   char *p1,*p2;
  1768.   char tchFilters[NUMLEXERS+1][COUNTOF(lexDefault.szExtensions) * 5 + 64];
  1769.   char szExtensions[COUNTOF(lexDefault.szExtensions)];
  1770.  
  1771.  
  1772.   GetString(IDS_FILTER_ALL,tchFilters[0],COUNTOF(tchFilters[0]));
  1773.   iSize = lstrlen(tchFilters[0]);
  1774.  
  1775.   for (i = 0; i < NUMLEXERS; i++)
  1776.   {
  1777.     lstrcpy(tchFilters[i+1],pLexArray[i]->pszName);
  1778.     lstrcat(tchFilters[i+1],"\n");
  1779.  
  1780.     lstrcpy(szExtensions,pLexArray[i]->szExtensions);
  1781.     p1 = szExtensions;
  1782.     while (*p1)
  1783.     {
  1784.       if (p2 = StrChr(p1,';')) {
  1785.         *p2 = '\0'; p2++; }
  1786.       else
  1787.         p2 = StrEnd(p1);
  1788.       if (*p1) {
  1789.         lstrcat(tchFilters[i+1],"*.");
  1790.         lstrcat(tchFilters[i+1],p1);
  1791.         if (*p2)
  1792.           lstrcat(tchFilters[i+1],";"); }
  1793.       p1 = p2;
  1794.     }
  1795.  
  1796.     // Check for empty extensions
  1797.     p1 = StrEnd(tchFilters[i+1]) - 1;
  1798.     if (*p1 == '\n') // no extensions yet, add *.*
  1799.       lstrcat(tchFilters[i+1],"*.*\n");
  1800.     else
  1801.       lstrcat(tchFilters[i+1],"\n");
  1802.  
  1803.     iSize += lstrlen(tchFilters[i+1]);
  1804.   }
  1805.  
  1806.   if (iSize + 2 < cchFilter)
  1807.   {
  1808.     lstrcpy(lpszFilter,tchFilters[0]);
  1809.  
  1810.     for (i = 0; i < NUMLEXERS; i++)
  1811.       lstrcat(lpszFilter,tchFilters[i+1]);
  1812.  
  1813.     lstrcat(lpszFilter,"\n");
  1814.     PrepareFilterStr(lpszFilter);
  1815.     return TRUE;
  1816.   }
  1817.   else
  1818.     return FALSE;
  1819. }
  1820.  
  1821.  
  1822. //=============================================================================
  1823. //
  1824. //  Style_StrGetFont()
  1825. //
  1826. BOOL Style_StrGetFont(LPCSTR lpszStyle,LPSTR lpszFont,int cchFont)
  1827. {
  1828.   char tch[256];
  1829.   char *p;
  1830.  
  1831.   if (p = StrStrI(lpszStyle,"font:"))
  1832.   {
  1833.     lstrcpy(tch,p + lstrlen("font:"));
  1834.     if (p = StrChr(tch,';'))
  1835.       *p = '\0';
  1836.     TrimString(tch);
  1837.     lstrcpyn(lpszFont,tch,cchFont);
  1838.     return TRUE;
  1839.   }
  1840.   return FALSE;
  1841. }
  1842.  
  1843.  
  1844. //=============================================================================
  1845. //
  1846. //  Style_StrGetCharSet()
  1847. //
  1848. BOOL Style_StrGetCharSet(LPCSTR lpszStyle,int *i)
  1849. {
  1850.   char tch[256];
  1851.   char *p;
  1852.   int  iValue;
  1853.   int  itok;
  1854.  
  1855.   if (p = StrStrI(lpszStyle,"charset:"))
  1856.   {
  1857.     lstrcpy(tch,p + lstrlen("charset:"));
  1858.     if (p = StrChr(tch,';'))
  1859.       *p = '\0';
  1860.     TrimString(tch);
  1861.     itok = sscanf(tch,"%i",&iValue);
  1862.     if (itok == 1)
  1863.     {
  1864.       *i = iValue;
  1865.       return TRUE;
  1866.     }
  1867.   }
  1868.   return FALSE;
  1869. }
  1870.  
  1871.  
  1872. //=============================================================================
  1873. //
  1874. //  Style_StrGetSize()
  1875. //
  1876. BOOL Style_StrGetSize(LPCSTR lpszStyle,int *i)
  1877. {
  1878.   char tch[256];
  1879.   char *p;
  1880.   int  iValue;
  1881.   int  iSign = 0;
  1882.   int  itok;
  1883.  
  1884.   if (p = StrStrI(lpszStyle,"size:"))
  1885.   {
  1886.     lstrcpy(tch,p + lstrlen("size:"));
  1887.     if (tch[0] == '+')
  1888.     {
  1889.       iSign = 1;
  1890.       tch[0] = ' ';
  1891.     }
  1892.     else if (tch[0] == '-')
  1893.     {
  1894.       iSign = -1;
  1895.       tch[0] = ' ';
  1896.     }
  1897.     if (p = StrChr(tch,';'))
  1898.       *p = '\0';
  1899.     TrimString(tch);
  1900.     itok = sscanf(tch,"%i",&iValue);
  1901.     if (itok == 1)
  1902.     {
  1903.       if (iSign == 0)
  1904.         *i = iValue;
  1905.       else
  1906.         *i = max(0,iBaseFontSize + iValue * iSign); // size must be +
  1907.       return TRUE;
  1908.     }
  1909.   }
  1910.   return FALSE;
  1911. }
  1912.  
  1913.  
  1914. //=============================================================================
  1915. //
  1916. //  Style_StrGetSizeStr()
  1917. //
  1918. BOOL Style_StrGetSizeStr(LPCSTR lpszStyle,LPSTR lpszSize,int cchSize)
  1919. {
  1920.   char tch[256];
  1921.   char *p;
  1922.  
  1923.   if (p = StrStrI(lpszStyle,"size:"))
  1924.   {
  1925.     lstrcpy(tch,p + lstrlen("size:"));
  1926.     if (p = StrChr(tch,';'))
  1927.       *p = '\0';
  1928.     TrimString(tch);
  1929.     lstrcpyn(lpszSize,tch,cchSize);
  1930.     return TRUE;
  1931.   }
  1932.   return FALSE;
  1933. }
  1934.  
  1935.  
  1936. //=============================================================================
  1937. //
  1938. //  Style_StrGetColor()
  1939. //
  1940. BOOL Style_StrGetColor(BOOL bFore,LPCSTR lpszStyle,int *rgb)
  1941. {
  1942.   char tch[256];
  1943.   char *p;
  1944.   int  iValue;
  1945.   int  itok;
  1946.   char *pItem = (bFore) ? "fore:" : "back:";
  1947.  
  1948.   if (p = StrStrI(lpszStyle,pItem))
  1949.   {
  1950.     lstrcpy(tch,p + lstrlen(pItem));
  1951.     if (tch[0] == '#')
  1952.       tch[0] = ' ';
  1953.     if (p = StrChr(tch,';'))
  1954.       *p = '\0';
  1955.     TrimString(tch);
  1956.     itok = sscanf(tch,"%x",&iValue);
  1957.     if (itok == 1)
  1958.     {
  1959.       *rgb = RGB((iValue&0xFF0000) >> 16,(iValue&0xFF00) >> 8,iValue&0xFF);
  1960.       return TRUE;
  1961.     }
  1962.   }
  1963.   return FALSE;
  1964. }
  1965.  
  1966.  
  1967. //=============================================================================
  1968. //
  1969. //  Style_StrGetCase()
  1970. //
  1971. BOOL Style_StrGetCase(LPCSTR lpszStyle,int *i)
  1972. {
  1973.   char tch[256];
  1974.   char *p;
  1975.  
  1976.   if (p = StrStrI(lpszStyle,"case:"))
  1977.   {
  1978.     lstrcpy(tch,p + lstrlen("case:"));
  1979.     if (p = StrChr(tch,';'))
  1980.       *p = '\0';
  1981.     TrimString(tch);
  1982.     if (tch[0] == 'u' || tch[0] == 'U') {
  1983.       *i = SC_CASE_UPPER;
  1984.       return TRUE; }
  1985.     else if (tch[0] == 'l' || tch[0] == 'L') {
  1986.       *i = SC_CASE_LOWER;
  1987.       return TRUE; }
  1988.   }
  1989.   return FALSE;
  1990. }
  1991.  
  1992.  
  1993. //=============================================================================
  1994. //
  1995. //  Style_SelectFont()
  1996. //
  1997. BOOL Style_SelectFont(HWND hwnd,LPSTR lpszStyle,int cchStyle)
  1998. {
  1999.   CHOOSEFONT cf;
  2000.   LOGFONT lf;
  2001.   char szNewStyle[512];
  2002.   int  iValue;
  2003.   char tch[32];
  2004.   HDC hdc;
  2005.  
  2006.   ZeroMemory(&cf,sizeof(CHOOSEFONT));
  2007.   ZeroMemory(&lf,sizeof(LOGFONT));
  2008.  
  2009.   // Map lpszStyle to LOGFONT
  2010.   if (Style_StrGetFont(lpszStyle,tch,COUNTOF(tch)))
  2011.     lstrcpyn(lf.lfFaceName,tch,COUNTOF(lf.lfFaceName));
  2012.   if (Style_StrGetSize(lpszStyle,&iValue))
  2013.   {
  2014.     hdc = GetDC(hwnd);
  2015.     lf.lfHeight = -MulDiv(iValue,GetDeviceCaps(hdc,LOGPIXELSY),72);
  2016.     ReleaseDC(hwnd,hdc);
  2017.   }
  2018.   lf.lfWeight = (StrStrI(lpszStyle,"bold")) ? FW_BOLD : FW_NORMAL;
  2019.   lf.lfItalic = (StrStrI(lpszStyle,"italic")) ? 1 : 0;
  2020.   lf.lfCharSet = iDefaultCharSet;
  2021.  
  2022.   // Init cf
  2023.   cf.lStructSize = sizeof(CHOOSEFONT);
  2024.   cf.hwndOwner = hwnd;
  2025.   cf.lpLogFont = &lf;
  2026.   cf.Flags = CF_INITTOLOGFONTSTRUCT /*| CF_NOSCRIPTSEL*/ | CF_SCREENFONTS;
  2027.  
  2028.   //// MonoSpace
  2029.   //if (bMonoSpace)
  2030.   //  cf.Flags |= CF_FIXEDPITCHONLY;
  2031.  
  2032.   if (!ChooseFont(&cf) || !lstrlen(lf.lfFaceName))
  2033.     return FALSE;
  2034.  
  2035.   // Map back to lpszStyle
  2036.   lstrcpy(szNewStyle,"font:");
  2037.   lstrcat(szNewStyle,lf.lfFaceName);
  2038.   if (Style_StrGetCharSet(lpszStyle,&iValue)) {
  2039.     wsprintf(tch,";charset:%i",iValue);
  2040.     lstrcat(szNewStyle,tch); }
  2041.   lstrcat(szNewStyle,";size:");
  2042.   wsprintf(tch,"%i",cf.iPointSize/10);
  2043.   lstrcat(szNewStyle,tch);
  2044.   if (cf.nFontType & BOLD_FONTTYPE)
  2045.     lstrcat(szNewStyle,";bold");
  2046.   if (cf.nFontType & ITALIC_FONTTYPE)
  2047.     lstrcat(szNewStyle,";italic");
  2048.  
  2049.   iDefaultCharSet = lf.lfCharSet;
  2050.  
  2051.   // save colors
  2052.   if (Style_StrGetColor(TRUE,lpszStyle,&iValue))
  2053.   {
  2054.     wsprintf(tch,";fore:#%02X%02X%02X",
  2055.       (int)iValue&0xFF,
  2056.       (int)(iValue&0xFF00) >> 8,
  2057.       (int)(iValue&0xFF0000) >> 16);
  2058.     lstrcat(szNewStyle,tch);
  2059.   }
  2060.   if (Style_StrGetColor(FALSE,lpszStyle,&iValue))
  2061.   {
  2062.     wsprintf(tch,";back:#%02X%02X%02X",
  2063.       (int)iValue&0xFF,
  2064.       (int)(iValue&0xFF00) >> 8,
  2065.       (int)(iValue&0xFF0000) >> 16);
  2066.     lstrcat(szNewStyle,tch);
  2067.   }
  2068.  
  2069.   if (StrStrI(lpszStyle,"underline"))
  2070.     lstrcat(szNewStyle,";underline");
  2071.  
  2072.   if (StrStrI(lpszStyle,"eolfilled"))
  2073.     lstrcat(szNewStyle,";eolfilled");
  2074.  
  2075.   if (Style_StrGetCase(lpszStyle,&iValue)) {
  2076.     lstrcat(szNewStyle,";case:");
  2077.     lstrcat(szNewStyle,(iValue == SC_CASE_UPPER) ? "u" : "l"); }
  2078.  
  2079.   lstrcpyn(lpszStyle,szNewStyle,cchStyle);
  2080.   return TRUE;
  2081. }
  2082.  
  2083.  
  2084. //=============================================================================
  2085. //
  2086. //  Style_SelectColor()
  2087. //
  2088. BOOL Style_SelectColor(HWND hwnd,BOOL bFore,LPSTR lpszStyle,int cchStyle)
  2089. {
  2090.   CHOOSECOLOR cc;
  2091.   char szNewStyle[512];
  2092.   int  iRGBResult;
  2093.   int  iValue;
  2094.   char tch[32];
  2095.  
  2096.   ZeroMemory(&cc,sizeof(CHOOSECOLOR));
  2097.  
  2098.   iRGBResult = (bFore) ? GetSysColor(COLOR_WINDOWTEXT) : GetSysColor(COLOR_WINDOW);
  2099.   Style_StrGetColor(bFore,lpszStyle,&iRGBResult);
  2100.  
  2101.   cc.lStructSize = sizeof(CHOOSECOLOR);
  2102.   cc.hwndOwner = hwnd;
  2103.   cc.rgbResult = iRGBResult;
  2104.   cc.lpCustColors = crCustom;
  2105.   cc.Flags = CC_RGBINIT | CC_SOLIDCOLOR;
  2106.  
  2107.   if (!ChooseColor(&cc))
  2108.     return FALSE;
  2109.  
  2110.   iRGBResult = cc.rgbResult;
  2111.  
  2112.   // Rebuild style string
  2113.   lstrcpy(szNewStyle,"");
  2114.   if (Style_StrGetFont(lpszStyle,tch,COUNTOF(tch)))
  2115.   {
  2116.     lstrcat(szNewStyle,"font:");
  2117.     lstrcat(szNewStyle,tch);
  2118.   }
  2119.   if (Style_StrGetCharSet(lpszStyle,&iValue))
  2120.   {
  2121.     if (lstrlen(szNewStyle))
  2122.       lstrcat(szNewStyle,";");
  2123.     wsprintf(tch,"charset:%i",iValue);
  2124.     lstrcat(szNewStyle,tch);
  2125.   }
  2126.   if (Style_StrGetSizeStr(lpszStyle,tch,COUNTOF(tch)))
  2127.   {
  2128.     if (lstrlen(szNewStyle))
  2129.       lstrcat(szNewStyle,";");
  2130.     lstrcat(szNewStyle,"size:");
  2131.     lstrcat(szNewStyle,tch);
  2132.   }
  2133.  
  2134.   if (StrStrI(lpszStyle,"bold"))
  2135.   {
  2136.     if (lstrlen(szNewStyle))
  2137.       lstrcat(szNewStyle,";");
  2138.     lstrcat(szNewStyle,"bold");
  2139.   }
  2140.   if (StrStrI(lpszStyle,"italic"))
  2141.   {
  2142.     if (lstrlen(szNewStyle))
  2143.       lstrcat(szNewStyle,";");
  2144.     lstrcat(szNewStyle,"italic");
  2145.   }
  2146.  
  2147.   if (bFore)
  2148.   {
  2149.     if (lstrlen(szNewStyle))
  2150.       lstrcat(szNewStyle,";");
  2151.     wsprintf(tch,"fore:#%02X%02X%02X",
  2152.       (int)iRGBResult&0xFF,
  2153.       (int)(iRGBResult&0xFF00) >> 8,
  2154.       (int)(iRGBResult&0xFF0000) >> 16);
  2155.     lstrcat(szNewStyle,tch);
  2156.     if (Style_StrGetColor(FALSE,lpszStyle,&iValue))
  2157.     {
  2158.       wsprintf(tch,";back:#%02X%02X%02X",
  2159.         (int)iValue&0xFF,
  2160.         (int)(iValue&0xFF00) >> 8,
  2161.         (int)(iValue&0xFF0000) >> 16);
  2162.       lstrcat(szNewStyle,tch);
  2163.     }
  2164.   }
  2165.   else
  2166.   {
  2167.     if (lstrlen(szNewStyle))
  2168.       lstrcat(szNewStyle,";");
  2169.     if (Style_StrGetColor(TRUE,lpszStyle,&iValue))
  2170.     {
  2171.       wsprintf(tch,"fore:#%02X%02X%02X;",
  2172.         (int)iValue&0xFF,
  2173.         (int)(iValue&0xFF00) >> 8,
  2174.         (int)(iValue&0xFF0000) >> 16);
  2175.       lstrcat(szNewStyle,tch);
  2176.     }
  2177.     wsprintf(tch,"back:#%02X%02X%02X",
  2178.       (int)iRGBResult&0xFF,
  2179.       (int)(iRGBResult&0xFF00) >> 8,
  2180.       (int)(iRGBResult&0xFF0000) >> 16);
  2181.     lstrcat(szNewStyle,tch);
  2182.   }
  2183.  
  2184.   if (StrStrI(lpszStyle,"underline"))
  2185.     lstrcat(szNewStyle,";underline");
  2186.  
  2187.   if (StrStrI(lpszStyle,"eolfilled"))
  2188.     lstrcat(szNewStyle,";eolfilled");
  2189.  
  2190.   if (Style_StrGetCase(lpszStyle,&iValue)) {
  2191.     lstrcat(szNewStyle,";case:");
  2192.     lstrcat(szNewStyle,(iValue == SC_CASE_UPPER) ? "u" : "l"); }
  2193.  
  2194.   lstrcpyn(lpszStyle,szNewStyle,cchStyle);
  2195.   return TRUE;
  2196. }
  2197.  
  2198.  
  2199. //=============================================================================
  2200. //
  2201. //  Style_SetStyles()
  2202. //
  2203. void Style_SetStyles(HWND hwnd,int iStyle,LPCSTR lpszStyle)
  2204. {
  2205.  
  2206.   char tch[256];
  2207.   char *p;
  2208.   int  iValue;
  2209.  
  2210.   // Font
  2211.   if (Style_StrGetFont(lpszStyle,tch,COUNTOF(tch)))
  2212.     SendMessage(hwnd,SCI_STYLESETFONT,iStyle,(LPARAM)tch);
  2213.  
  2214.   // Size
  2215.   if (Style_StrGetSize(lpszStyle,&iValue))
  2216.     SendMessage(hwnd,SCI_STYLESETSIZE,iStyle,(LPARAM)iValue);
  2217.  
  2218.   // Fore
  2219.   if (Style_StrGetColor(TRUE,lpszStyle,&iValue))
  2220.     SendMessage(hwnd,SCI_STYLESETFORE,iStyle,(LPARAM)iValue);
  2221.  
  2222.   // Back
  2223.   if (Style_StrGetColor(FALSE,lpszStyle,&iValue))
  2224.     SendMessage(hwnd,SCI_STYLESETBACK,iStyle,(LPARAM)iValue);
  2225.  
  2226.   // Bold
  2227.   if (p = StrStrI(lpszStyle,"bold"))
  2228.     SendMessage(hwnd,SCI_STYLESETBOLD,iStyle,(LPARAM)TRUE);
  2229.   else
  2230.     SendMessage(hwnd,SCI_STYLESETBOLD,iStyle,(LPARAM)FALSE);
  2231.  
  2232.   // Italic
  2233.   if (p = StrStrI(lpszStyle,"italic"))
  2234.     SendMessage(hwnd,SCI_STYLESETITALIC,iStyle,(LPARAM)TRUE);
  2235.   else
  2236.     SendMessage(hwnd,SCI_STYLESETITALIC,iStyle,(LPARAM)FALSE);
  2237.  
  2238.   // Underline
  2239.   if (p = StrStrI(lpszStyle,"underline"))
  2240.     SendMessage(hwnd,SCI_STYLESETUNDERLINE,iStyle,(LPARAM)TRUE);
  2241.   else
  2242.     SendMessage(hwnd,SCI_STYLESETUNDERLINE,iStyle,(LPARAM)FALSE);
  2243.  
  2244.   // EOL Filled
  2245.   if (p = StrStrI(lpszStyle,"eolfilled"))
  2246.     SendMessage(hwnd,SCI_STYLESETEOLFILLED,iStyle,(LPARAM)TRUE);
  2247.   else
  2248.     SendMessage(hwnd,SCI_STYLESETEOLFILLED,iStyle,(LPARAM)FALSE);
  2249.  
  2250.   // Case
  2251.   if (Style_StrGetCase(lpszStyle,&iValue))
  2252.     SendMessage(hwnd,SCI_STYLESETCASE,iStyle,(LPARAM)iValue);
  2253.  
  2254.   // Character Set
  2255.   if (Style_StrGetCharSet(lpszStyle,&iValue))
  2256.     SendMessage(hwnd,SCI_STYLESETCHARACTERSET,iStyle,(LPARAM)iValue);
  2257.  
  2258. }
  2259.  
  2260.  
  2261. //=============================================================================
  2262. //
  2263. //  Style_GetCurrentLexerName()
  2264. //
  2265. LPCSTR Style_GetCurrentLexerName()
  2266. {
  2267.   return pLexCurrent->pszName;
  2268. }
  2269.  
  2270.  
  2271. //=============================================================================
  2272. //
  2273. //  Style_GetLexerIconId()
  2274. //
  2275. int Style_GetLexerIconId(PEDITLEXER plex)
  2276. {
  2277.   char *p;
  2278.   char *pszExtensions;
  2279.   char *pszFile;
  2280.  
  2281.   SHFILEINFO shfi;
  2282.  
  2283.   if (lstrlen(plex->szExtensions))
  2284.     pszExtensions = plex->szExtensions;
  2285.   else
  2286.     pszExtensions = plex->pszDefExt;
  2287.  
  2288.   pszFile = GlobalAlloc(GPTR,lstrlen(pszExtensions) + lstrlen("*.txt") + 16);
  2289.   lstrcpy(pszFile,"*.");
  2290.   lstrcat(pszFile,pszExtensions);
  2291.   if (p = StrChr(pszFile,';'))
  2292.     *p = '\0';
  2293.  
  2294.   // check for ; at beginning
  2295.   if (lstrlen(pszFile) < 3)
  2296.     lstrcat(pszFile,"txt");
  2297.  
  2298.   SHGetFileInfo(pszFile,FILE_ATTRIBUTE_NORMAL,&shfi,sizeof(SHFILEINFO),
  2299.     SHGFI_SMALLICON | SHGFI_SYSICONINDEX | SHGFI_USEFILEATTRIBUTES);
  2300.  
  2301.   GlobalFree(pszFile);
  2302.  
  2303.   return (shfi.iIcon);
  2304. }
  2305.  
  2306.  
  2307. //=============================================================================
  2308. //
  2309. //  Style_AddLexerToTreeView()
  2310. //
  2311. void Style_AddLexerToTreeView(HWND hwnd,PEDITLEXER plex)
  2312. {
  2313.   //int i = 0;
  2314.  
  2315.   //LVITEM lvi;
  2316.   //ZeroMemory(&lvi,sizeof(LVITEM));
  2317.  
  2318.   //lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM;
  2319.   //lvi.pszText = plex->pszName;
  2320.   //lvi.iImage = Style_GetLexerIconId(plex);
  2321.   //lvi.lParam = 0;
  2322.   //lvi.iItem = ListView_GetItemCount(hwnd);
  2323.   //ListView_InsertItem(hwnd,&lvi);
  2324.  
  2325.   //lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM | LVIF_INDENT;
  2326.   //lvi.iImage = -1;
  2327.   //lvi.iIndent = 1;
  2328.  
  2329.   //while (plex->Styles[i].iStyle != -1)
  2330.   //{
  2331.   //  lvi.pszText = plex->Styles[i].pszName;
  2332.   //  lvi.lParam = (LPARAM)(&plex->Styles[i]);
  2333.   //  lvi.iItem = ListView_GetItemCount(hwnd);
  2334.   //  ListView_InsertItem(hwnd,&lvi);
  2335.   //  i++;
  2336.   //}
  2337.  
  2338.   int i = 0;
  2339.  
  2340.   HTREEITEM hTreeNode;
  2341.  
  2342.   TVINSERTSTRUCT tvis;
  2343.   ZeroMemory(&tvis,sizeof(TVINSERTSTRUCT));
  2344.  
  2345.   tvis.hInsertAfter = TVI_LAST;
  2346.  
  2347.   tvis.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM;
  2348.   tvis.item.pszText = plex->pszName;
  2349.   tvis.item.iImage = Style_GetLexerIconId(plex);
  2350.   tvis.item.iSelectedImage = tvis.item.iImage;
  2351.   tvis.item.lParam = (LPARAM)plex;
  2352.  
  2353.   hTreeNode = (HTREEITEM)TreeView_InsertItem(hwnd,&tvis);
  2354.  
  2355.   tvis.hParent = hTreeNode;
  2356.  
  2357.   tvis.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM;
  2358.   //tvis.item.iImage = -1;
  2359.   //tvis.item.iSelectedImage = -1;
  2360.  
  2361.   while (plex->Styles[i].iStyle != -1)
  2362.   {
  2363.     tvis.item.pszText = plex->Styles[i].pszName;
  2364.     tvis.item.lParam = (LPARAM)(&plex->Styles[i]);
  2365.     TreeView_InsertItem(hwnd,&tvis);
  2366.     i++;
  2367.   }
  2368.  
  2369. }
  2370.  
  2371.  
  2372. //=============================================================================
  2373. //
  2374. //  Style_AddLexerToListView()
  2375. //
  2376. void Style_AddLexerToListView(HWND hwnd,PEDITLEXER plex)
  2377. {
  2378.   LVITEM lvi;
  2379.   ZeroMemory(&lvi,sizeof(LVITEM));
  2380.  
  2381.   lvi.mask = LVIF_IMAGE | LVIF_PARAM | LVIF_TEXT;
  2382.   lvi.iItem = ListView_GetItemCount(hwnd);
  2383.   lvi.pszText = plex->pszName;
  2384.   lvi.iImage = Style_GetLexerIconId(plex);
  2385.   lvi.lParam = (LPARAM)plex;
  2386.  
  2387.   ListView_InsertItem(hwnd,&lvi);
  2388. }
  2389.  
  2390.  
  2391. //=============================================================================
  2392. //
  2393. //  Style_ConfigDlgProc()
  2394. //
  2395. BOOL CALLBACK Style_ConfigDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam)
  2396. {
  2397.  
  2398.   static HWND hwndTV;
  2399.   static BOOL fDragging;
  2400.   static PEDITLEXER pCurrentLexer;
  2401.   static PEDITSTYLE pCurrentStyle;
  2402.  
  2403.   switch(umsg)
  2404.   {
  2405.  
  2406.     case WM_INITDIALOG:
  2407.       {
  2408.         int i;
  2409.         SHFILEINFO shfi;
  2410.  
  2411.         hwndTV = GetDlgItem(hwnd,IDC_STYLELIST);
  2412.         fDragging = FALSE;
  2413.  
  2414.         TreeView_SetImageList(hwndTV,
  2415.           (HIMAGELIST)SHGetFileInfo("C:\\",0,&shfi,sizeof(SHFILEINFO),
  2416.           SHGFI_SMALLICON | SHGFI_SYSICONINDEX),TVSIL_NORMAL);
  2417.  
  2418.         // Add lexers
  2419.         for (i = 0; i < NUMLEXERS; i++)
  2420.           Style_AddLexerToTreeView(hwndTV,pLexArray[i]);
  2421.  
  2422.         pCurrentLexer = 0;
  2423.         pCurrentStyle = 0;
  2424.         //TreeView_Expand(hwndTV,TreeView_GetRoot(hwndTV),TVE_EXPAND);
  2425.         TreeView_Select(hwndTV,TreeView_GetRoot(hwndTV),TVGN_CARET);
  2426.  
  2427.         SendDlgItemMessage(hwnd,IDC_STYLEEDIT,EM_LIMITTEXT,COUNTOF(lexDefault.Styles[0].szValue)-1,0);
  2428.  
  2429.         MakeBitmapButton(hwnd,IDC_PREVSTYLE,g_hInstance,IDB_PREV);
  2430.         MakeBitmapButton(hwnd,IDC_NEXTSTYLE,g_hInstance,IDB_NEXT);
  2431.  
  2432.         CenterDlgInParent(hwnd);
  2433.       }
  2434.       return TRUE;
  2435.  
  2436.  
  2437.     case WM_NOTIFY:
  2438.  
  2439.       if (((LPNMHDR)(lParam))->idFrom == IDC_STYLELIST)
  2440.       {
  2441.         LPNMTREEVIEW lpnmtv = (LPNMTREEVIEW)lParam;
  2442.  
  2443.         switch (lpnmtv->hdr.code)
  2444.         {
  2445.  
  2446.           case TVN_SELCHANGED:
  2447.             {
  2448.               if (pCurrentStyle)
  2449.                 GetDlgItemText(hwnd,IDC_STYLEEDIT,pCurrentStyle->szValue,COUNTOF(pCurrentStyle->szValue));
  2450.  
  2451.               else if (pCurrentLexer) {
  2452.                 if (!GetDlgItemText(hwnd,IDC_STYLEEDIT,pCurrentLexer->szExtensions,COUNTOF(pCurrentStyle->szValue)))
  2453.                   lstrcpy(pCurrentLexer->szExtensions,pCurrentLexer->pszDefExt); }
  2454.  
  2455.               // a lexer has been selected
  2456.               if (!TreeView_GetParent(hwndTV,lpnmtv->itemNew.hItem))
  2457.               {
  2458.                 pCurrentStyle = 0;
  2459.                 if (pCurrentLexer = (PEDITLEXER)lpnmtv->itemNew.lParam)
  2460.                 {
  2461.                   EnableWindow(GetDlgItem(hwnd,IDC_STYLEEDIT),TRUE);
  2462.                   EnableWindow(GetDlgItem(hwnd,IDC_STYLEFONT),FALSE);
  2463.                   EnableWindow(GetDlgItem(hwnd,IDC_STYLEFORE),FALSE);
  2464.                   EnableWindow(GetDlgItem(hwnd,IDC_STYLEBACK),FALSE);
  2465.                   EnableWindow(GetDlgItem(hwnd,IDC_STYLEDEFAULT),FALSE);
  2466.                   SetDlgItemText(hwnd,IDC_STYLEEDIT,pCurrentLexer->szExtensions);
  2467.                 }
  2468.                 else
  2469.                 {
  2470.                   EnableWindow(GetDlgItem(hwnd,IDC_STYLEEDIT),FALSE);
  2471.                   EnableWindow(GetDlgItem(hwnd,IDC_STYLEFONT),FALSE);
  2472.                   EnableWindow(GetDlgItem(hwnd,IDC_STYLEFORE),FALSE);
  2473.                   EnableWindow(GetDlgItem(hwnd,IDC_STYLEBACK),FALSE);
  2474.                   EnableWindow(GetDlgItem(hwnd,IDC_STYLEDEFAULT),FALSE);
  2475.                   SetDlgItemText(hwnd,IDC_STYLEEDIT,"");
  2476.                 }
  2477.               }
  2478.  
  2479.               // a style has been selected
  2480.               else
  2481.               {
  2482.                 pCurrentLexer = 0;
  2483.                 if (pCurrentStyle = (PEDITSTYLE)lpnmtv->itemNew.lParam)
  2484.                 {
  2485.                   EnableWindow(GetDlgItem(hwnd,IDC_STYLEEDIT),TRUE);
  2486.                   EnableWindow(GetDlgItem(hwnd,IDC_STYLEFONT),TRUE);
  2487.                   EnableWindow(GetDlgItem(hwnd,IDC_STYLEFORE),TRUE);
  2488.                   EnableWindow(GetDlgItem(hwnd,IDC_STYLEBACK),TRUE);
  2489.                   EnableWindow(GetDlgItem(hwnd,IDC_STYLEDEFAULT),TRUE);
  2490.                   SetDlgItemText(hwnd,IDC_STYLEEDIT,pCurrentStyle->szValue);
  2491.                 }
  2492.                 else
  2493.                 {
  2494.                   EnableWindow(GetDlgItem(hwnd,IDC_STYLEEDIT),FALSE);
  2495.                   EnableWindow(GetDlgItem(hwnd,IDC_STYLEFONT),FALSE);
  2496.                   EnableWindow(GetDlgItem(hwnd,IDC_STYLEFORE),FALSE);
  2497.                   EnableWindow(GetDlgItem(hwnd,IDC_STYLEBACK),FALSE);
  2498.                   EnableWindow(GetDlgItem(hwnd,IDC_STYLEDEFAULT),FALSE);
  2499.                   SetDlgItemText(hwnd,IDC_STYLEEDIT,"");
  2500.                 }
  2501.               }
  2502.             }
  2503.             break;
  2504.  
  2505.           case TVN_BEGINDRAG:
  2506.             {
  2507.               //HIMAGELIST himl;
  2508.  
  2509.               //if (pCurrentStyle)
  2510.               //  GetDlgItemText(hwnd,IDC_STYLEEDIT,pCurrentStyle->szValue,COUNTOF(pCurrentStyle->szValue));
  2511.               TreeView_Select(hwndTV,lpnmtv->itemNew.hItem,TVGN_CARET);
  2512.  
  2513.               //himl = TreeView_CreateDragImage(hwndTV,lpnmtv->itemNew.hItem);
  2514.               //ImageList_BeginDrag(himl,0,0,0);
  2515.               //ImageList_DragEnter(hwndTV,lpnmtv->ptDrag.x,lpnmtv->ptDrag.y);
  2516.               if (pCurrentStyle)
  2517.                 DestroyCursor(SetCursor(LoadCursor(g_hInstance,MAKEINTRESOURCE(IDC_COPY))));
  2518.               else
  2519.                 DestroyCursor(SetCursor(LoadCursor(NULL,IDC_NO)));
  2520.  
  2521.               SetCapture(hwnd);
  2522.               fDragging = TRUE;
  2523.             }
  2524.  
  2525.         }
  2526.       }
  2527.  
  2528.       break;
  2529.  
  2530.  
  2531.     case WM_MOUSEMOVE:
  2532.       {
  2533.         HTREEITEM htiTarget;
  2534.         TVHITTESTINFO tvht;
  2535.  
  2536.         if (fDragging && pCurrentStyle)
  2537.         {
  2538.           LONG xCur = LOWORD(lParam);
  2539.           LONG yCur = HIWORD(lParam);
  2540.  
  2541.           //ImageList_DragMove(xCur,yCur);
  2542.           //ImageList_DragShowNolock(FALSE);
  2543.  
  2544.           tvht.pt.x = xCur;
  2545.           tvht.pt.y = yCur;
  2546.  
  2547.           //ClientToScreen(hwnd,&tvht.pt);
  2548.           //ScreenToClient(hwndTV,&tvht.pt);
  2549.           MapWindowPoints(hwnd,hwndTV,&tvht.pt,1);
  2550.  
  2551.           if ((htiTarget = TreeView_HitTest(hwndTV,&tvht)) != NULL &&
  2552.                TreeView_GetParent(hwndTV,htiTarget) != NULL)
  2553.           {
  2554.             TreeView_SelectDropTarget(hwndTV,htiTarget);
  2555.             //TreeView_Expand(hwndTV,htiTarget,TVE_EXPAND);
  2556.             TreeView_EnsureVisible(hwndTV,htiTarget);
  2557.           }
  2558.           else
  2559.             TreeView_SelectDropTarget(hwndTV,NULL);
  2560.  
  2561.           //ImageList_DragShowNolock(TRUE);
  2562.         }
  2563.       }
  2564.       break;
  2565.  
  2566.  
  2567.     case WM_LBUTTONUP:
  2568.       {
  2569.         if (fDragging)
  2570.         {
  2571.           HTREEITEM htiTarget;
  2572.  
  2573.           //ImageList_EndDrag();
  2574.  
  2575.           if (htiTarget = TreeView_GetDropHilight(hwndTV))
  2576.           {
  2577.             char tchCopy[256];
  2578.             TreeView_SelectDropTarget(hwndTV,NULL);
  2579.             GetDlgItemText(hwnd,IDC_STYLEEDIT,tchCopy,COUNTOF(tchCopy));
  2580.             TreeView_Select(hwndTV,htiTarget,TVGN_CARET);
  2581.  
  2582.             // after select, this is new current item
  2583.             if (pCurrentStyle)
  2584.             {
  2585.               lstrcpy(pCurrentStyle->szValue,tchCopy);
  2586.               SetDlgItemText(hwnd,IDC_STYLEEDIT,tchCopy);
  2587.             }
  2588.           }
  2589.           ReleaseCapture();
  2590.           DestroyCursor(SetCursor(LoadCursor(NULL,IDC_ARROW)));
  2591.           fDragging = FALSE;
  2592.         }
  2593.       }
  2594.       break;
  2595.  
  2596.  
  2597.     case WM_CANCELMODE:
  2598.       {
  2599.         if (fDragging)
  2600.         {
  2601.           //ImageList_EndDrag();
  2602.           TreeView_SelectDropTarget(hwndTV,NULL);
  2603.           ReleaseCapture();
  2604.           DestroyCursor(SetCursor(LoadCursor(NULL,IDC_ARROW)));
  2605.           fDragging = FALSE;
  2606.         }
  2607.       }
  2608.       break;
  2609.  
  2610.  
  2611.     case WM_COMMAND:
  2612.  
  2613.       switch(LOWORD(wParam))
  2614.       {
  2615.  
  2616.         case IDC_PREVSTYLE:
  2617.           if (TreeView_GetSelection(hwndTV))
  2618.             TreeView_Select(hwndTV,TreeView_GetPrevVisible(hwndTV,
  2619.               TreeView_GetSelection(hwndTV)),TVGN_CARET);
  2620.           PostMessage(hwnd,WM_NEXTDLGCTL,(WPARAM)(GetDlgItem(hwnd,IDC_STYLEEDIT)),1);
  2621.           break;
  2622.  
  2623.         case IDC_NEXTSTYLE:
  2624.           if (TreeView_GetSelection(hwndTV))
  2625.             TreeView_Select(hwndTV,TreeView_GetNextVisible(hwndTV,
  2626.               TreeView_GetSelection(hwndTV)),TVGN_CARET);
  2627.           PostMessage(hwnd,WM_NEXTDLGCTL,(WPARAM)(GetDlgItem(hwnd,IDC_STYLEEDIT)),1);
  2628.           break;
  2629.  
  2630.         case IDC_STYLEFONT:
  2631.           if (pCurrentStyle)
  2632.           {
  2633.             char tch[256];
  2634.             GetDlgItemText(hwnd,IDC_STYLEEDIT,tch,COUNTOF(tch));
  2635.             if (Style_SelectFont(hwnd,tch,COUNTOF(tch)))
  2636.               SetDlgItemText(hwnd,IDC_STYLEEDIT,tch);
  2637.           }
  2638.           PostMessage(hwnd,WM_NEXTDLGCTL,(WPARAM)(GetDlgItem(hwnd,IDC_STYLEEDIT)),1);
  2639.           break;
  2640.  
  2641.         case IDC_STYLEFORE:
  2642.           if (pCurrentStyle)
  2643.           {
  2644.             char tch[256];
  2645.             GetDlgItemText(hwnd,IDC_STYLEEDIT,tch,COUNTOF(tch));
  2646.             if (Style_SelectColor(hwnd,TRUE,tch,COUNTOF(tch)))
  2647.               SetDlgItemText(hwnd,IDC_STYLEEDIT,tch);
  2648.           }
  2649.           PostMessage(hwnd,WM_NEXTDLGCTL,(WPARAM)(GetDlgItem(hwnd,IDC_STYLEEDIT)),1);
  2650.           break;
  2651.  
  2652.         case IDC_STYLEBACK:
  2653.           if (pCurrentStyle)
  2654.           {
  2655.             char tch[256];
  2656.             GetDlgItemText(hwnd,IDC_STYLEEDIT,tch,COUNTOF(tch));
  2657.             if (Style_SelectColor(hwnd,FALSE,tch,COUNTOF(tch)))
  2658.               SetDlgItemText(hwnd,IDC_STYLEEDIT,tch);
  2659.           }
  2660.           PostMessage(hwnd,WM_NEXTDLGCTL,(WPARAM)(GetDlgItem(hwnd,IDC_STYLEEDIT)),1);
  2661.           break;
  2662.  
  2663.         case IDC_STYLEDEFAULT:
  2664.           if (pCurrentStyle)
  2665.           {
  2666.             lstrcpy(pCurrentStyle->szValue,pCurrentStyle->pszDefault);
  2667.             SetDlgItemText(hwnd,IDC_STYLEEDIT,pCurrentStyle->szValue);
  2668.           }
  2669.           PostMessage(hwnd,WM_NEXTDLGCTL,(WPARAM)(GetDlgItem(hwnd,IDC_STYLEEDIT)),1);
  2670.           break;
  2671.  
  2672.         case IDOK:
  2673.           if (pCurrentStyle)
  2674.             GetDlgItemText(hwnd,IDC_STYLEEDIT,pCurrentStyle->szValue,COUNTOF(pCurrentStyle->szValue));
  2675.           else if (pCurrentLexer) {
  2676.             if (!GetDlgItemText(hwnd,IDC_STYLEEDIT,pCurrentLexer->szExtensions,COUNTOF(pCurrentStyle->szValue)))
  2677.               lstrcpy(pCurrentLexer->szExtensions,pCurrentLexer->pszDefExt); }
  2678.           EndDialog(hwnd,IDOK);
  2679.           break;
  2680.  
  2681.  
  2682.         case IDCANCEL:
  2683.           if (fDragging)
  2684.             SendMessage(hwnd,WM_CANCELMODE,0,0);
  2685.           else
  2686.             EndDialog(hwnd,IDCANCEL);
  2687.           break;
  2688.  
  2689.       }
  2690.  
  2691.       return TRUE;
  2692.  
  2693.   }
  2694.  
  2695.   return FALSE;
  2696.  
  2697. }
  2698.  
  2699.  
  2700. //=============================================================================
  2701. //
  2702. //  Style_ConfigDlg()
  2703. //
  2704. void Style_ConfigDlg(HWND hwnd)
  2705. {
  2706.   HKEY hKey = RegGetAppKey("Styles");
  2707.   Style_Save(hKey);
  2708.   RegCloseKey(hKey);
  2709.  
  2710.   if (IDCANCEL == DialogBoxParam(g_hInstance,
  2711.                     MAKEINTRESOURCE(IDD_STYLECONFIG),
  2712.                     GetParent(hwnd),Style_ConfigDlgProc,0))
  2713.   {
  2714.     // Reload Styles when cancel was hit
  2715.     HKEY hKey = RegGetAppKey("Styles");
  2716.     Style_Load(hKey);
  2717.     RegCloseKey(hKey);
  2718.   }
  2719.  
  2720.   // Apply new Styles
  2721.   else
  2722.   {
  2723.     int iLexer = (int)SendMessage(hwnd,SCI_GETLEXER,0,0);
  2724.     Style_SetLexer(hwnd,pLexCurrent);
  2725.   }
  2726. }
  2727.  
  2728.  
  2729. //=============================================================================
  2730. //
  2731. //  Style_SelectLexerDlgProc()
  2732. //
  2733. BOOL CALLBACK Style_SelectLexerDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam)
  2734. {
  2735.  
  2736.   static int cxClient;
  2737.   static int cyClient;
  2738.   static int mmiPtMaxY;
  2739.   static int mmiPtMinX;
  2740.  
  2741.   static HWND hwndLV;
  2742.   static int  iInternalDefault;
  2743.  
  2744.   switch(umsg)
  2745.   {
  2746.  
  2747.     case WM_INITDIALOG:
  2748.       {
  2749.         int i;
  2750.         int lvItems;
  2751.         LVITEM lvi;
  2752.         SHFILEINFO shfi;
  2753.  
  2754.         RECT rc;
  2755.         char tch[MAX_PATH];
  2756.         int cGrip;
  2757.  
  2758.         GetClientRect(hwnd,&rc);
  2759.         cxClient = rc.right - rc.left;
  2760.         cyClient = rc.bottom - rc.top;
  2761.  
  2762.         GetWindowRect(hwnd,&rc);
  2763.         mmiPtMaxY = rc.bottom-rc.top;
  2764.         mmiPtMinX = rc.right-rc.left;
  2765.  
  2766.         if (cxStyleSelectDlg < (rc.right-rc.left))
  2767.           cxStyleSelectDlg = rc.right-rc.left;
  2768.         if (cyStyleSelectDlg < (rc.bottom-rc.top))
  2769.           cyStyleSelectDlg = rc.bottom-rc.top;
  2770.         SetWindowPos(hwnd,NULL,rc.left,rc.top,cxStyleSelectDlg,cyStyleSelectDlg,SWP_NOZORDER);
  2771.  
  2772.         SetWindowLong(hwnd,GWL_STYLE,GetWindowLong(hwnd,GWL_STYLE)|WS_THICKFRAME);
  2773.         SetWindowPos(hwnd,NULL,0,0,0,0,SWP_NOZORDER|SWP_NOMOVE|SWP_NOSIZE|SWP_FRAMECHANGED);
  2774.  
  2775.         GetMenuString(GetSystemMenu(GetParent(hwnd),FALSE),SC_SIZE,tch,COUNTOF(tch),MF_BYCOMMAND);
  2776.         InsertMenu(GetSystemMenu(hwnd,FALSE),SC_CLOSE,MF_BYCOMMAND|MF_STRING|MF_ENABLED,SC_SIZE,tch);
  2777.         InsertMenu(GetSystemMenu(hwnd,FALSE),SC_CLOSE,MF_BYCOMMAND|MF_SEPARATOR,0,NULL);
  2778.  
  2779.         SetWindowLong(GetDlgItem(hwnd,IDC_RESIZEGRIP3),GWL_STYLE,
  2780.           GetWindowLong(GetDlgItem(hwnd,IDC_RESIZEGRIP3),GWL_STYLE)|SBS_SIZEGRIP|WS_CLIPSIBLINGS);
  2781.  
  2782.         cGrip = GetSystemMetrics(SM_CXHTHUMB);
  2783.         SetWindowPos(GetDlgItem(hwnd,IDC_RESIZEGRIP3),NULL,cxClient-cGrip,
  2784.                      cyClient-cGrip,cGrip,cGrip,SWP_NOZORDER);
  2785.  
  2786.         hwndLV = GetDlgItem(hwnd,IDC_STYLELIST);
  2787.  
  2788.         ListView_SetImageList(hwndLV,
  2789.           (HIMAGELIST)SHGetFileInfo("C:\\",0,&shfi,sizeof(SHFILEINFO),SHGFI_SMALLICON | SHGFI_SYSICONINDEX),
  2790.           LVSIL_SMALL);
  2791.  
  2792.         ListView_SetImageList(hwndLV,
  2793.           (HIMAGELIST)SHGetFileInfo("C:\\",0,&shfi,sizeof(SHFILEINFO),SHGFI_LARGEICON | SHGFI_SYSICONINDEX),
  2794.           LVSIL_NORMAL);
  2795.  
  2796.         ListView_SetExtendedListViewStyle(hwndLV,LVS_EX_LABELTIP);
  2797.  
  2798.         // Add lexers
  2799.         for (i = 0; i < NUMLEXERS; i++)
  2800.           Style_AddLexerToListView(hwndLV,pLexArray[i]);
  2801.  
  2802.         ListView_SetColumnWidth(hwndLV,0,LVSCW_AUTOSIZE);
  2803.         ListView_Arrange(hwndLV,LVA_DEFAULT);
  2804.  
  2805.         // Select current lexer
  2806.         lvItems = ListView_GetItemCount(hwndLV);
  2807.         lvi.mask = LVIF_PARAM;
  2808.         for (i = 0; i < lvItems; i++) {
  2809.           lvi.iItem = i;
  2810.           ListView_GetItem(hwndLV,&lvi);;
  2811.           if (lstrcmp(((PEDITLEXER)lvi.lParam)->pszName,pLexCurrent->pszName) == 0) {
  2812.             ListView_SetItemState(hwndLV,i,LVIS_FOCUSED|LVIS_SELECTED,LVIS_FOCUSED|LVIS_SELECTED);
  2813.             ListView_EnsureVisible(hwndLV,i,FALSE);
  2814.             if (iDefaultLexer == i) {
  2815.               CheckDlgButton(hwnd,IDC_DEFAULTSCHEME,BST_CHECKED); } } }
  2816.  
  2817.         iInternalDefault = iDefaultLexer;
  2818.  
  2819.         if (bAutoSelect)
  2820.           CheckDlgButton(hwnd,IDC_AUTOSELECT,BST_CHECKED);
  2821.  
  2822.         CenterDlgInParent(hwnd);
  2823.       }
  2824.       return TRUE;
  2825.  
  2826.  
  2827.     case WM_DESTROY:
  2828.       {
  2829.         RECT rc;
  2830.  
  2831.         GetWindowRect(hwnd,&rc);
  2832.         cxStyleSelectDlg = rc.right-rc.left;
  2833.         cyStyleSelectDlg = rc.bottom-rc.top;
  2834.       }
  2835.       return FALSE;
  2836.  
  2837.  
  2838.     case WM_SIZE:
  2839.       {
  2840.         RECT rc;
  2841.  
  2842.         int dxClient = LOWORD(lParam) - cxClient;
  2843.         int dyClient = HIWORD(lParam) - cyClient;
  2844.         cxClient = LOWORD(lParam);
  2845.         cyClient = HIWORD(lParam);
  2846.  
  2847.         GetWindowRect(GetDlgItem(hwnd,IDC_RESIZEGRIP3),&rc);
  2848.         MapWindowPoints(NULL,hwnd,(LPPOINT)&rc,2);
  2849.         SetWindowPos(GetDlgItem(hwnd,IDC_RESIZEGRIP3),NULL,rc.left+dxClient,rc.top+dyClient,0,0,SWP_NOZORDER|SWP_NOSIZE);
  2850.         InvalidateRect(GetDlgItem(hwnd,IDC_RESIZEGRIP3),NULL,TRUE);
  2851.  
  2852.         GetWindowRect(GetDlgItem(hwnd,IDOK),&rc);
  2853.         MapWindowPoints(NULL,hwnd,(LPPOINT)&rc,2);
  2854.         SetWindowPos(GetDlgItem(hwnd,IDOK),NULL,rc.left+dxClient,rc.top+dyClient,0,0,SWP_NOZORDER|SWP_NOSIZE);
  2855.         InvalidateRect(GetDlgItem(hwnd,IDOK),NULL,TRUE);
  2856.  
  2857.         GetWindowRect(GetDlgItem(hwnd,IDCANCEL),&rc);
  2858.         MapWindowPoints(NULL,hwnd,(LPPOINT)&rc,2);
  2859.         SetWindowPos(GetDlgItem(hwnd,IDCANCEL),NULL,rc.left+dxClient,rc.top+dyClient,0,0,SWP_NOZORDER|SWP_NOSIZE);
  2860.         InvalidateRect(GetDlgItem(hwnd,IDCANCEL),NULL,TRUE);
  2861.  
  2862.         GetWindowRect(GetDlgItem(hwnd,IDC_STYLELIST),&rc);
  2863.         MapWindowPoints(NULL,hwnd,(LPPOINT)&rc,2);
  2864.         SetWindowPos(GetDlgItem(hwnd,IDC_STYLELIST),NULL,0,0,rc.right-rc.left+dxClient,rc.bottom-rc.top+dyClient,SWP_NOZORDER|SWP_NOMOVE);
  2865.         InvalidateRect(GetDlgItem(hwnd,IDC_STYLELIST),NULL,TRUE);
  2866.  
  2867.         GetWindowRect(GetDlgItem(hwnd,IDC_AUTOSELECT),&rc);
  2868.         MapWindowPoints(NULL,hwnd,(LPPOINT)&rc,2);
  2869.         SetWindowPos(GetDlgItem(hwnd,IDC_AUTOSELECT),NULL,rc.left,rc.top+dyClient,0,0,SWP_NOZORDER|SWP_NOSIZE);
  2870.         InvalidateRect(GetDlgItem(hwnd,IDC_AUTOSELECT),NULL,TRUE);
  2871.  
  2872.         GetWindowRect(GetDlgItem(hwnd,IDC_DEFAULTSCHEME),&rc);
  2873.         MapWindowPoints(NULL,hwnd,(LPPOINT)&rc,2);
  2874.         SetWindowPos(GetDlgItem(hwnd,IDC_DEFAULTSCHEME),NULL,rc.left,rc.top+dyClient,0,0,SWP_NOZORDER|SWP_NOSIZE);
  2875.         InvalidateRect(GetDlgItem(hwnd,IDC_DEFAULTSCHEME),NULL,TRUE);
  2876.       }
  2877.       return TRUE;
  2878.  
  2879.  
  2880.     case WM_GETMINMAXINFO:
  2881.       {
  2882.         LPMINMAXINFO lpmmi = (LPMINMAXINFO)lParam;
  2883.         lpmmi->ptMinTrackSize.x = mmiPtMinX;
  2884.         lpmmi->ptMinTrackSize.y = mmiPtMaxY;
  2885.         //lpmmi->ptMaxTrackSize.y = mmiPtMaxY;
  2886.       }
  2887.       return TRUE;
  2888.  
  2889.  
  2890.     case WM_NOTIFY: {
  2891.       if (((LPNMHDR)(lParam))->idFrom == IDC_STYLELIST) {
  2892.  
  2893.       switch (((LPNMHDR)(lParam))->code) {
  2894.  
  2895.         case NM_DBLCLK:
  2896.           SendMessage(hwnd,WM_COMMAND,MAKELONG(IDOK,1),0);
  2897.           break;
  2898.  
  2899.         case LVN_ITEMCHANGED:
  2900.         case LVN_DELETEITEM: {
  2901.           int i = ListView_GetNextItem(hwndLV,-1,LVNI_ALL | LVNI_SELECTED);
  2902.           if (iInternalDefault == i)
  2903.             CheckDlgButton(hwnd,IDC_DEFAULTSCHEME,BST_CHECKED);
  2904.           else
  2905.             CheckDlgButton(hwnd,IDC_DEFAULTSCHEME,BST_UNCHECKED);
  2906.           EnableWindow(GetDlgItem(hwnd,IDC_DEFAULTSCHEME),i != -1);
  2907.           EnableWindow(GetDlgItem(hwnd,IDOK),i != -1); }
  2908.           break; } } }
  2909.  
  2910.       return TRUE;
  2911.  
  2912.  
  2913.     case WM_COMMAND:
  2914.  
  2915.       switch(LOWORD(wParam))
  2916.       {
  2917.  
  2918.         case IDC_DEFAULTSCHEME:
  2919.           if (IsDlgButtonChecked(hwnd,IDC_DEFAULTSCHEME) == BST_CHECKED)
  2920.             iInternalDefault = ListView_GetNextItem(hwndLV,-1,LVNI_ALL | LVNI_SELECTED);
  2921.           else
  2922.             iInternalDefault = 0;
  2923.           break;
  2924.  
  2925.  
  2926.         case IDOK:
  2927.           {
  2928.             LVITEM lvi;
  2929.  
  2930.             lvi.mask = LVIF_PARAM;
  2931.             lvi.iItem = ListView_GetNextItem(hwndLV,-1,LVNI_ALL | LVNI_SELECTED);
  2932.             if (ListView_GetItem(hwndLV,&lvi)) {
  2933.               pLexCurrent = (PEDITLEXER)lvi.lParam;
  2934.               iDefaultLexer = iInternalDefault;
  2935.               bAutoSelect = (IsDlgButtonChecked(hwnd,IDC_AUTOSELECT) == BST_CHECKED) ? 1 : 0;
  2936.               EndDialog(hwnd,IDOK); }
  2937.           }
  2938.           break;
  2939.  
  2940.  
  2941.         case IDCANCEL:
  2942.           EndDialog(hwnd,IDCANCEL);
  2943.           break;
  2944.  
  2945.       }
  2946.  
  2947.       return TRUE;
  2948.  
  2949.   }
  2950.  
  2951.   return FALSE;
  2952.  
  2953. }
  2954.  
  2955.  
  2956. //=============================================================================
  2957. //
  2958. //  Style_SelectLexerDlg()
  2959. //
  2960. void Style_SelectLexerDlg(HWND hwnd)
  2961. {
  2962.   if (IDOK == DialogBoxParam(g_hInstance,
  2963.                 MAKEINTRESOURCE(IDD_STYLESELECT),
  2964.                 GetParent(hwnd),Style_SelectLexerDlgProc,0))
  2965.  
  2966.     Style_SetLexer(hwnd,pLexCurrent);
  2967. }
  2968.  
  2969.  
  2970. // End of Styles.c
  2971.