From d60466eed348e1d61577225fd260abeb5d061095 Mon Sep 17 00:00:00 2001 From: Don Ho Date: Sun, 27 Jan 2013 01:03:53 +0000 Subject: [PATCH] =?UTF-8?q?[BUG=5FFIXED]=20(Author:=20Ivan=20Radi=C4=87=20?= =?UTF-8?q?-=20aka=20Loreia)=20UDL=202.1.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1012 f5eea248-9336-0410-98b8-ebc06183d4e3 --- PowerEditor/src/Notepad_plus.cpp | 16 +- PowerEditor/src/Parameters.cpp | 192 +-- PowerEditor/src/Parameters.h | 46 +- .../ScitillaComponent/ScintillaEditView.cpp | 96 +- .../src/ScitillaComponent/ScintillaEditView.h | 4 +- .../ScitillaComponent/UserDefineDialog.cpp | 563 ++++---- .../src/ScitillaComponent/UserDefineDialog.h | 297 ++-- .../src/ScitillaComponent/UserDefineDialog.rc | 85 +- .../ScitillaComponent/UserDefineResource.h | 35 +- .../WinControls/Preference/preferenceDlg.cpp | 2 + scintilla/include/SciLexer.h | 143 +- scintilla/lexers/LexUser.cxx | 1269 +++++++++-------- 12 files changed, 1502 insertions(+), 1246 deletions(-) diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 921fbb9e..87930af1 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -1414,7 +1414,7 @@ bool Notepad_plus::replaceInFiles() _pEditView = pOldView; TCHAR msg[128]; - wsprintf(msg, TEXT("%d occurences replaced"), nbTotal); + wsprintf(msg, TEXT("%d occurrences replaced"), nbTotal); printStr(msg); return true; @@ -2124,7 +2124,6 @@ void Notepad_plus::addHotSpot() { _pEditView->execute(SCI_STARTSTYLING, start, 0xFF); _pEditView->execute(SCI_SETSTYLING, foundTextLen, fs); - } else // generize a new style and add it into a array { @@ -2183,7 +2182,6 @@ void Notepad_plus::addHotSpot() } - void Notepad_plus::MaintainIndentation(TCHAR ch) { int eolMode = int(_pEditView->execute(SCI_GETEOLMODE)); @@ -3374,9 +3372,9 @@ bool Notepad_plus::doBlockComment(comment_mode currCommentMode) symbol = extractSymbol('0', '0', userLangContainer->_keywordLists[SCE_USER_KWLIST_COMMENTS]); commentLineSybol = symbol.c_str(); //--FLS: BlockToStreamComment: Needed to decide, if stream-comment can be called below! - symbolStart = extractSymbol('0', '1', userLangContainer->_keywordLists[SCE_USER_KWLIST_COMMENTS]); + symbolStart = extractSymbol('0', '3', userLangContainer->_keywordLists[SCE_USER_KWLIST_COMMENTS]); commentStart = symbolStart.c_str(); - symbolEnd = extractSymbol('0', '2', userLangContainer->_keywordLists[SCE_USER_KWLIST_COMMENTS]); + symbolEnd = extractSymbol('0', '4', userLangContainer->_keywordLists[SCE_USER_KWLIST_COMMENTS]); commentEnd = symbolEnd.c_str(); } else @@ -3528,9 +3526,9 @@ bool Notepad_plus::doStreamComment() symbol = extractSymbol('0', '0', userLangContainer->_keywordLists[SCE_USER_KWLIST_COMMENTS]); commentLineSybol = symbol.c_str(); - symbolStart = extractSymbol('0', '1', userLangContainer->_keywordLists[SCE_USER_KWLIST_COMMENTS]); + symbolStart = extractSymbol('0', '3', userLangContainer->_keywordLists[SCE_USER_KWLIST_COMMENTS]); commentStart = symbolStart.c_str(); - symbolEnd = extractSymbol('0', '2', userLangContainer->_keywordLists[SCE_USER_KWLIST_COMMENTS]); + symbolEnd = extractSymbol('0', '4', userLangContainer->_keywordLists[SCE_USER_KWLIST_COMMENTS]); commentEnd = symbolEnd.c_str(); } else @@ -5563,9 +5561,9 @@ bool Notepad_plus::undoStreamComment() if (!userLangContainer) return false; - symbolStart = extractSymbol('0', '1', userLangContainer->_keywordLists[SCE_USER_KWLIST_COMMENTS]); + symbolStart = extractSymbol('0', '3', userLangContainer->_keywordLists[SCE_USER_KWLIST_COMMENTS]); commentStart = symbolStart.c_str(); - symbolEnd = extractSymbol('0', '2', userLangContainer->_keywordLists[SCE_USER_KWLIST_COMMENTS]); + symbolEnd = extractSymbol('0', '4', userLangContainer->_keywordLists[SCE_USER_KWLIST_COMMENTS]); commentEnd = symbolEnd.c_str(); } else diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index 3b3feff2..4e907da7 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -2191,7 +2191,7 @@ bool NppParameters::feedUserLang(TiXmlNode *node) { Style & style = _userLangArray[_nbUserLang - 1]->_styleArray.getStyler(i); if (style._styleID == -1) - _userLangArray[_nbUserLang - 1]->_styleArray.addStyler(i, styleNameMapper[i]); + _userLangArray[_nbUserLang - 1]->_styleArray.addStyler(i, globalMappper().styleNameMapper[i].c_str()); } } catch (std::exception e) { @@ -2551,9 +2551,8 @@ void NppParameters::feedUserSettings(TiXmlNode *settingsRoot) if (boolStr) _userLangArray[_nbUserLang - 1]->_allowFoldOfComments = !lstrcmp(TEXT("yes"), boolStr); - boolStr = (globalSettingNode->ToElement())->Attribute(TEXT("forceLineCommentsAtBOL")); - if (boolStr) - _userLangArray[_nbUserLang - 1]->_forceLineCommentsAtBOL = !lstrcmp(TEXT("yes"), boolStr); + (globalSettingNode->ToElement())->Attribute(TEXT("forcePureLC"), &_userLangArray[_nbUserLang - 1]->_forcePureLC); + (globalSettingNode->ToElement())->Attribute(TEXT("decimalSeparator"), &_userLangArray[_nbUserLang - 1]->_decimalSeparator); boolStr = (globalSettingNode->ToElement())->Attribute(TEXT("foldCompact")); if (boolStr) @@ -2568,7 +2567,7 @@ void NppParameters::feedUserSettings(TiXmlNode *settingsRoot) { for (int i = 0 ; i < SCE_USER_TOTAL_KEYWORD_GROUPS ; i++) { - boolStr = (prefixNode->ToElement())->Attribute(keywordListMapper[i+SCE_USER_KWLIST_KEYWORDS1]); + boolStr = (prefixNode->ToElement())->Attribute(globalMappper().keywordNameMapper[i+SCE_USER_KWLIST_KEYWORDS1]); if (boolStr) _userLangArray[_nbUserLang - 1]->_isPrefix[i] = !lstrcmp(TEXT("yes"), boolStr); } @@ -2588,109 +2587,77 @@ void NppParameters::feedUserSettings(TiXmlNode *settingsRoot) void NppParameters::feedUserKeywordList(TiXmlNode *node) { + const TCHAR * udlVersion = _userLangArray[_nbUserLang - 1]->_udlVersion.c_str(); + const TCHAR * keywordsName = NULL; + TCHAR *kwl = NULL; + int id = -1; + for (TiXmlNode *childNode = node->FirstChildElement(TEXT("Keywords")); childNode ; childNode = childNode->NextSibling(TEXT("Keywords"))) { - const TCHAR *keywordsName = (childNode->ToElement())->Attribute(TEXT("name")); - const TCHAR *udlVersion = _userLangArray[_nbUserLang - 1]->_udlVersion.c_str(); - TCHAR *kwl = NULL; + keywordsName = (childNode->ToElement())->Attribute(TEXT("name")); + kwl = NULL; TiXmlNode *valueNode = childNode->FirstChild(); if (valueNode) { - if (!lstrcmp(udlVersion, TEXT("2.0"))) + if (!lstrcmp(udlVersion, TEXT("")) && !lstrcmp(keywordsName, TEXT("Delimiters"))) // support for old style (pre 2.0) { - const int keywordsID = _tstoi((childNode->ToElement())->Attribute(TEXT("id"))); - kwl = (valueNode)?valueNode->Value():TEXT(""); - lstrcpy(_userLangArray[_nbUserLang - 1]->_keywordLists[keywordsID], kwl); + basic_string temp = TEXT(""); + kwl = (valueNode)?valueNode->Value():TEXT("000000"); + + temp += TEXT("00"); if (kwl[0] != '0') temp += kwl[0]; temp += TEXT(" 01"); + temp += TEXT(" 02"); if (kwl[3] != '0') temp += kwl[3]; + temp += TEXT(" 03"); if (kwl[1] != '0') temp += kwl[1]; temp += TEXT(" 04"); + temp += TEXT(" 05"); if (kwl[4] != '0') temp += kwl[4]; + temp += TEXT(" 06"); if (kwl[2] != '0') temp += kwl[2]; temp += TEXT(" 07"); + temp += TEXT(" 08"); if (kwl[5] != '0') temp += kwl[5]; + + temp += TEXT(" 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23"); + lstrcpy(_userLangArray[_nbUserLang - 1]->_keywordLists[SCE_USER_KWLIST_DELIMITERS], temp.c_str()); } - else // support for old style (pre 2.0) + else if (!lstrcmp(keywordsName, TEXT("Comment"))) { - if (!lstrcmp(keywordsName, TEXT("Delimiters"))) - { - basic_string temp = TEXT(""); - kwl = (valueNode)?valueNode->Value():TEXT("000000"); + kwl = (valueNode)?valueNode->Value():TEXT(""); + //int len = _tcslen(kwl); + basic_string temp = TEXT(" "); - temp += TEXT("00"); if (kwl[0] != '0') temp += kwl[0]; temp += TEXT(" 01"); - temp += TEXT(" 02"); if (kwl[3] != '0') temp += kwl[3]; - temp += TEXT(" 03"); if (kwl[1] != '0') temp += kwl[1]; temp += TEXT(" 04"); - temp += TEXT(" 05"); if (kwl[4] != '0') temp += kwl[4]; - temp += TEXT(" 06"); if (kwl[2] != '0') temp += kwl[2]; temp += TEXT(" 07"); - temp += TEXT(" 08"); if (kwl[5] != '0') temp += kwl[5]; + temp += kwl; + size_t pos = 0; - temp += TEXT(" 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23"); - lstrcpy(_userLangArray[_nbUserLang - 1]->_keywordLists[SCE_USER_KWLIST_DELIMITERS], temp.c_str()); - } - else if (!lstrcmp(keywordsName, TEXT("Operators"))) + pos = temp.find(TEXT(" 0")); + while (pos != string::npos) { - kwl = (valueNode)?valueNode->Value():TEXT(""); - lstrcpy(_userLangArray[_nbUserLang - 1]->_keywordLists[SCE_USER_KWLIST_OPERATORS1], kwl); + temp.replace(pos, 2, TEXT(" 00")); + pos = temp.find(TEXT(" 0"), pos+1); } - else if (!lstrcmp(keywordsName, TEXT("Folder+"))) + pos = temp.find(TEXT(" 1")); + while (pos != string::npos) { - kwl = (valueNode)?valueNode->Value():TEXT(""); - lstrcpy(_userLangArray[_nbUserLang - 1]->_keywordLists[SCE_USER_KWLIST_FOLDERS_IN_CODE1_OPEN], kwl); - } - else if (!lstrcmp(keywordsName, TEXT("Folder-"))) - { - kwl = (valueNode)?valueNode->Value():TEXT(""); - lstrcpy(_userLangArray[_nbUserLang - 1]->_keywordLists[SCE_USER_KWLIST_FOLDERS_IN_CODE1_CLOSE], kwl); - } - else if (!lstrcmp(keywordsName, TEXT("Words1"))) - { - kwl = (valueNode)?valueNode->Value():TEXT(""); - lstrcpy(_userLangArray[_nbUserLang - 1]->_keywordLists[SCE_USER_KWLIST_KEYWORDS1], kwl); - } - else if (!lstrcmp(keywordsName, TEXT("Words2"))) - { - kwl = (valueNode)?valueNode->Value():TEXT(""); - lstrcpy(_userLangArray[_nbUserLang - 1]->_keywordLists[SCE_USER_KWLIST_KEYWORDS2], kwl); - } - else if (!lstrcmp(keywordsName, TEXT("Words3"))) - { - kwl = (valueNode)?valueNode->Value():TEXT(""); - lstrcpy(_userLangArray[_nbUserLang - 1]->_keywordLists[SCE_USER_KWLIST_KEYWORDS3], kwl); - } - else if (!lstrcmp(keywordsName, TEXT("Words4"))) - { - kwl = (valueNode)?valueNode->Value():TEXT(""); - lstrcpy(_userLangArray[_nbUserLang - 1]->_keywordLists[SCE_USER_KWLIST_KEYWORDS4], kwl); - } - else if (!lstrcmp(keywordsName, TEXT("Comment"))) - { - kwl = (valueNode)?valueNode->Value():TEXT(""); - //int len = _tcslen(kwl); - basic_string temp = TEXT(" "); - - temp += kwl; - size_t pos = 0; - - pos = temp.find(TEXT(" 0")); - while (pos != string::npos) - { - temp.replace(pos, 2, TEXT(" 00")); - pos = temp.find(TEXT(" 0"), pos+1); - } + temp.replace(pos, 2, TEXT(" 03")); pos = temp.find(TEXT(" 1")); - while (pos != string::npos) - { - temp.replace(pos, 2, TEXT(" 03")); - pos = temp.find(TEXT(" 1")); - } + } + pos = temp.find(TEXT(" 2")); + while (pos != string::npos) + { + temp.replace(pos, 2, TEXT(" 04")); pos = temp.find(TEXT(" 2")); - while (pos != string::npos) - { - temp.replace(pos, 2, TEXT(" 04")); - pos = temp.find(TEXT(" 2")); - } + } - temp += TEXT(" 01 02"); - if (temp[0] == ' ') - temp.erase(0, 1); + temp += TEXT(" 01 02"); + if (temp[0] == ' ') + temp.erase(0, 1); - lstrcpy(_userLangArray[_nbUserLang - 1]->_keywordLists[SCE_USER_KWLIST_COMMENTS], temp.c_str()); - + lstrcpy(_userLangArray[_nbUserLang - 1]->_keywordLists[SCE_USER_KWLIST_COMMENTS], temp.c_str()); + } + else + { + kwl = (valueNode)?valueNode->Value():TEXT(""); + if (globalMappper().keywordIdMapper.find(keywordsName) != globalMappper().keywordIdMapper.end()) + { + id = globalMappper().keywordIdMapper[keywordsName]; + lstrcpy(_userLangArray[_nbUserLang - 1]->_keywordLists[id], kwl); } } } @@ -2699,30 +2666,21 @@ void NppParameters::feedUserKeywordList(TiXmlNode *node) void NppParameters::feedUserStyles(TiXmlNode *node) { - bool oldVersion = false; - const TCHAR *udlVersion = _userLangArray[_nbUserLang - 1]->_udlVersion.c_str(); - if (lstrcmp(udlVersion, TEXT("2.0"))) - oldVersion = true; + const TCHAR *styleName = NULL; + int id = -1; for (TiXmlNode *childNode = node->FirstChildElement(TEXT("WordsStyle")); childNode ; childNode = childNode->NextSibling(TEXT("WordsStyle"))) { - int id; - const TCHAR *styleIDStr = (childNode->ToElement())->Attribute(TEXT("styleID"), &id); - if (oldVersion) + styleName = (childNode->ToElement())->Attribute(TEXT("name")); + if (styleName) { - if (id >= SCE_USER_STYLE_MAPPER_TOTAL) - continue; - - id = styleIdMApper[id]; - if (id == -1) - continue; - } - if (styleIDStr) - { - if (id < SCE_USER_STYLE_TOTAL_STYLES) + if (globalMappper().styleIdMapper.find(styleName) != globalMappper().styleIdMapper.end()) + { + id = globalMappper().styleIdMapper[styleName]; _userLangArray[_nbUserLang - 1]->_styleArray.addStyler((id | L_USER << 16), childNode); + } } } } @@ -2846,7 +2804,7 @@ void StyleArray::addStyler(int styleID, TiXmlNode *styleNode) if (str) { if (isUser) - _styleArray[index]._styleDesc = styleNameMapper[index]; + _styleArray[index]._styleDesc = globalMappper().styleNameMapper[index].c_str(); else _styleArray[index]._styleDesc = str; } @@ -5325,20 +5283,28 @@ void NppParameters::insertUserLang2Tree(TiXmlNode *node, UserLangContainer *user { TiXmlElement *rootElement = (node->InsertEndChild(TiXmlElement(TEXT("UserLang"))))->ToElement(); + TCHAR temp[32]; + generic_string udlVersion = TEXT(""); + udlVersion += generic_itoa(SCE_UDL_VERSION_MAJOR, temp, 10); + udlVersion += TEXT("."); + udlVersion += generic_itoa(SCE_UDL_VERSION_MINOR, temp, 10); + rootElement->SetAttribute(TEXT("name"), userLang->_name); rootElement->SetAttribute(TEXT("ext"), userLang->_ext); - rootElement->SetAttribute(TEXT("udlVersion"), TEXT("2.0")); + rootElement->SetAttribute(TEXT("udlVersion"), udlVersion.c_str()); + TiXmlElement *settingsElement = (rootElement->InsertEndChild(TiXmlElement(TEXT("Settings"))))->ToElement(); { TiXmlElement *globalElement = (settingsElement->InsertEndChild(TiXmlElement(TEXT("Global"))))->ToElement(); globalElement->SetAttribute(TEXT("caseIgnored"), userLang->_isCaseIgnored ? TEXT("yes"):TEXT("no")); globalElement->SetAttribute(TEXT("allowFoldOfComments"), userLang->_allowFoldOfComments ? TEXT("yes"):TEXT("no")); - globalElement->SetAttribute(TEXT("forceLineCommentsAtBOL"), userLang->_forceLineCommentsAtBOL ? TEXT("yes"):TEXT("no")); globalElement->SetAttribute(TEXT("foldCompact"), userLang->_foldCompact ? TEXT("yes"):TEXT("no")); + globalElement->SetAttribute(TEXT("forcePureLC"), userLang->_forcePureLC); + globalElement->SetAttribute(TEXT("decimalSeparator"), userLang->_decimalSeparator); TiXmlElement *prefixElement = (settingsElement->InsertEndChild(TiXmlElement(TEXT("Prefix"))))->ToElement(); for (int i = 0 ; i < SCE_USER_TOTAL_KEYWORD_GROUPS ; i++) - prefixElement->SetAttribute(keywordListMapper[i+SCE_USER_KWLIST_KEYWORDS1], userLang->_isPrefix[i]?TEXT("yes"):TEXT("no")); + prefixElement->SetAttribute(globalMappper().keywordNameMapper[i+SCE_USER_KWLIST_KEYWORDS1], userLang->_isPrefix[i]?TEXT("yes"):TEXT("no")); } TiXmlElement *kwlElement = (rootElement->InsertEndChild(TiXmlElement(TEXT("KeywordLists"))))->ToElement(); @@ -5346,14 +5312,12 @@ void NppParameters::insertUserLang2Tree(TiXmlNode *node, UserLangContainer *user for (int i = 0 ; i < SCE_USER_KWLIST_TOTAL ; i++) { TiXmlElement *kwElement = (kwlElement->InsertEndChild(TiXmlElement(TEXT("Keywords"))))->ToElement(); - kwElement->SetAttribute(TEXT("name"), keywordListMapper[i]); - kwElement->SetAttribute(TEXT("id"), i); + kwElement->SetAttribute(TEXT("name"), globalMappper().keywordNameMapper[i]); kwElement->InsertEndChild(TiXmlText(userLang->_keywordLists[i])); } TiXmlElement *styleRootElement = (rootElement->InsertEndChild(TiXmlElement(TEXT("Styles"))))->ToElement(); - //for (int i = 0 ; i < userLang->_styleArray.getNbStyler() ; i++) for (int i = 0 ; i < SCE_USER_STYLE_TOTAL_STYLES ; i++) { TiXmlElement *styleElement = (styleRootElement->InsertEndChild(TiXmlElement(TEXT("WordsStyle"))))->ToElement(); @@ -5364,8 +5328,6 @@ void NppParameters::insertUserLang2Tree(TiXmlNode *node, UserLangContainer *user styleElement->SetAttribute(TEXT("name"), style2Write._styleDesc); - styleElement->SetAttribute(TEXT("styleID"), style2Write._styleID); - //if (HIBYTE(HIWORD(style2Write._fgColor)) != 0xFF) { int rgbVal = RGB2int(style2Write._fgColor); @@ -5417,8 +5379,6 @@ void NppParameters::stylerStrOp(bool op) { for (int i = 0 ; i < _nbUserLang ; i++) { - //int nbStyler = _userLangArray[i]->_styleArray.getNbStyler(); - //for (int j = 0 ; j < nbStyler ; j++) for (int j = 0 ; j < SCE_USER_STYLE_TOTAL_STYLES ; j++) { Style & style = _userLangArray[i]->_styleArray.getStyler(j); diff --git a/PowerEditor/src/Parameters.h b/PowerEditor/src/Parameters.h index 50c7d847..5fe724bd 100644 --- a/PowerEditor/src/Parameters.h +++ b/PowerEditor/src/Parameters.h @@ -110,6 +110,14 @@ const int COPYDATA_PARAMS = 0; const int COPYDATA_FILENAMESA = 1; const int COPYDATA_FILENAMESW = 2; +#define PURE_LC_NONE 0 +#define PURE_LC_BOL 1 +#define PURE_LC_WSP 2 + +#define DECSEP_DOT 0 +#define DECSEP_COMMA 1 +#define DECSEP_BOTH 2 + const TCHAR fontSizeStrs[][3] = {TEXT(""), TEXT("5"), TEXT("6"), TEXT("7"), TEXT("8"), TEXT("9"), TEXT("10"), TEXT("11"), TEXT("12"), TEXT("14"), TEXT("16"), TEXT("18"), TEXT("20"), TEXT("22"), TEXT("24"), TEXT("26"), TEXT("28")}; const TCHAR localConfFile[] = TEXT("doLocalConf.xml"); @@ -280,7 +288,7 @@ struct Style generic_string *_keywords; Style():_styleID(-1), _styleDesc(NULL), _fgColor(COLORREF(STYLE_NOT_USED)), _bgColor(COLORREF(STYLE_NOT_USED)), _colorStyle(COLORSTYLE_ALL),\ - _fontName(NULL), _fontStyle(STYLE_NOT_USED), _fontSize(STYLE_NOT_USED), _keywordClass(STYLE_NOT_USED), _keywords(NULL){}; + _fontName(NULL), _fontStyle(FONTSTYLE_NONE), _fontSize(STYLE_NOT_USED), _keywordClass(STYLE_NOT_USED), _keywords(NULL), _nesting(FONTSTYLE_NONE){}; ~Style(){ if (_keywords) @@ -902,19 +910,28 @@ public : _ext = TEXT(""); _udlVersion = TEXT(""); _allowFoldOfComments = false; - _forceLineCommentsAtBOL = false; + _forcePureLC = PURE_LC_NONE; + _decimalSeparator = DECSEP_DOT; + _foldCompact = false; + _isCaseIgnored = false; + + for (int i = 0 ; i < SCE_USER_KWLIST_TOTAL ; i++) + *_keywordLists[i] = '\0'; + + for (int i = 0 ; i < SCE_USER_TOTAL_KEYWORD_GROUPS ; i++) + _isPrefix[i] = false; + }; + UserLangContainer(const TCHAR *name, const TCHAR *ext, const TCHAR *udlVer) : _name(name), _ext(ext), _udlVersion(udlVer) { + _allowFoldOfComments = false; + _forcePureLC = PURE_LC_NONE; + _decimalSeparator = DECSEP_DOT; _foldCompact = false; for (int i = 0 ; i < SCE_USER_KWLIST_TOTAL ; i++) *_keywordLists[i] = '\0'; - }; - UserLangContainer(const TCHAR *name, const TCHAR *ext, const TCHAR *udlVer) : _name(name), _ext(ext), _udlVersion(udlVer) { - _allowFoldOfComments = false; - _forceLineCommentsAtBOL = false; - _foldCompact = false; - for (int j = 0 ; j < SCE_USER_KWLIST_TOTAL ; j++) - *_keywordLists[j] = '\0'; + for (int i = 0 ; i < SCE_USER_TOTAL_KEYWORD_GROUPS ; i++) + _isPrefix[i] = false; }; UserLangContainer & operator=(const UserLangContainer & ulc) { @@ -926,7 +943,8 @@ public : this->_isCaseIgnored = ulc._isCaseIgnored; this->_styleArray = ulc._styleArray; this->_allowFoldOfComments = ulc._allowFoldOfComments; - this->_forceLineCommentsAtBOL = ulc._forceLineCommentsAtBOL; + this->_forcePureLC = ulc._forcePureLC; + this->_decimalSeparator = ulc._decimalSeparator; this->_foldCompact = ulc._foldCompact; int nbStyler = this->_styleArray.getNbStyler(); for (int i = 0 ; i < nbStyler ; i++) @@ -939,6 +957,9 @@ public : } for (int i = 0 ; i < SCE_USER_KWLIST_TOTAL ; i++) lstrcpy(this->_keywordLists[i], ulc._keywordLists[i]); + + for (int i = 0 ; i < SCE_USER_TOTAL_KEYWORD_GROUPS ; i++) + _isPrefix[i] = ulc._isPrefix[i]; } return *this; }; @@ -956,12 +977,13 @@ private: //TCHAR _keywordLists[nbKeywodList][max_char]; TCHAR _keywordLists[SCE_USER_KWLIST_TOTAL][max_char]; + bool _isPrefix[SCE_USER_TOTAL_KEYWORD_GROUPS]; bool _isCaseIgnored; bool _allowFoldOfComments; - bool _forceLineCommentsAtBOL; + int _forcePureLC; + int _decimalSeparator; bool _foldCompact; - bool _isPrefix[SCE_USER_TOTAL_KEYWORD_GROUPS]; }; #define MAX_EXTERNAL_LEXER_NAME_LEN 16 diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp index f0077ab2..2d59e26b 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp @@ -646,17 +646,15 @@ void ScintillaEditView::setUserLexer(const TCHAR *userLangName) execute(SCI_SETPROPERTY, reinterpret_cast("fold"), reinterpret_cast("1")); execute(SCI_SETPROPERTY, (WPARAM)"userDefine.isCaseIgnored", (LPARAM)(userLangContainer->_isCaseIgnored ? "1":"0")); execute(SCI_SETPROPERTY, (WPARAM)"userDefine.allowFoldOfComments", (LPARAM)(userLangContainer->_allowFoldOfComments ? "1":"0")); - execute(SCI_SETPROPERTY, (WPARAM)"userDefine.forceLineCommentsAtBOL", (LPARAM)(userLangContainer->_forceLineCommentsAtBOL ? "1":"0")); execute(SCI_SETPROPERTY, (WPARAM)"userDefine.foldCompact", (LPARAM)(userLangContainer->_foldCompact ? "1":"0")); - char name[] = "userDefine.prefixKeywords0"; + char name[] = "userDefine.prefixKeywords0"; for (int i=0 ; i_isPrefix[i]?"1":"0")); } - // for (int i = 0 ; i < userLangContainer->getNbKeywordList() ; i++) for (int i = 0 ; i < SCE_USER_KWLIST_TOTAL ; i++) { #ifndef UNICODE @@ -665,45 +663,9 @@ void ScintillaEditView::setUserLexer(const TCHAR *userLangName) WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); const char * keyWords_char = wmc->wchar2char(userLangContainer->_keywordLists[i], codepage); #endif - if (i == SCE_USER_KWLIST_COMMENTS) + if (globalMappper().setLexerMapper.find(i) != globalMappper().setLexerMapper.end()) { - execute(SCI_SETPROPERTY, (WPARAM)"userDefine.comments", reinterpret_cast(keyWords_char)); - } - else if (i == SCE_USER_KWLIST_DELIMITERS) - { - execute(SCI_SETPROPERTY, (WPARAM)"userDefine.delimiters", reinterpret_cast(keyWords_char)); - } - else if (i == SCE_USER_KWLIST_OPERATORS1) - { - execute(SCI_SETPROPERTY, (WPARAM)"userDefine.operators1", reinterpret_cast(keyWords_char)); - } - else if (i == SCE_USER_KWLIST_NUMBER_EXTRA) - { - execute(SCI_SETPROPERTY, (WPARAM)"userDefine.numberRanges", reinterpret_cast(keyWords_char)); - } - else if (i == SCE_USER_KWLIST_NUMBER_PREFIX) - { - execute(SCI_SETPROPERTY, (WPARAM)"userDefine.numberPrefixes", reinterpret_cast(keyWords_char)); - } - else if (i == SCE_USER_KWLIST_NUMBER_EXTRAPREF) - { - execute(SCI_SETPROPERTY, (WPARAM)"userDefine.extraCharsInPrefixed", reinterpret_cast(keyWords_char)); - } - else if (i == SCE_USER_KWLIST_NUMBER_SUFFIX) - { - execute(SCI_SETPROPERTY, (WPARAM)"userDefine.numberSuffixes", reinterpret_cast(keyWords_char)); - } - else if (i == SCE_USER_KWLIST_FOLDERS_IN_CODE1_OPEN) - { - execute(SCI_SETPROPERTY, (WPARAM)"userDefine.foldersInCode1Open", reinterpret_cast(keyWords_char)); - } - else if (i == SCE_USER_KWLIST_FOLDERS_IN_CODE1_MIDDLE) - { - execute(SCI_SETPROPERTY, (WPARAM)"userDefine.foldersInCode1Middle", reinterpret_cast(keyWords_char)); - } - else if (i == SCE_USER_KWLIST_FOLDERS_IN_CODE1_CLOSE) - { - execute(SCI_SETPROPERTY, (WPARAM)"userDefine.foldersInCode1Close", reinterpret_cast(keyWords_char)); + execute(SCI_SETPROPERTY, (WPARAM)globalMappper().setLexerMapper[i].c_str(), reinterpret_cast(keyWords_char)); } else // OPERATORS2, FOLDERS_IN_CODE2, FOLDERS_IN_COMMENT, KEYWORDS1-8 { @@ -759,14 +721,22 @@ void ScintillaEditView::setUserLexer(const TCHAR *userLangName) } } - // at the end (position SCE_USER_KWLIST_TOTAL) send id values - execute(SCI_SETPROPERTY, (WPARAM)"userDefine.udlName", reinterpret_cast(userLangContainer->getName())); - execute(SCI_SETPROPERTY, (WPARAM)"userDefine.currentBufferID", reinterpret_cast(_currentBufferID)); - - char intBuffer[10]; + char intBuffer[15]; char nestingBuffer[] = "userDefine.nesting.00"; + + itoa(userLangContainer->_forcePureLC, intBuffer, 10); + execute(SCI_SETPROPERTY, (WPARAM)"userDefine.forcePureLC", reinterpret_cast(intBuffer)); + + itoa(userLangContainer->_decimalSeparator, intBuffer, 10); + execute(SCI_SETPROPERTY, (WPARAM)"userDefine.decimalSeparator", reinterpret_cast(intBuffer)); + + // at the end (position SCE_USER_KWLIST_TOTAL) send id values + itoa((int)userLangContainer->getName(), intBuffer, 10); // use numeric value of TCHAR pointer + execute(SCI_SETPROPERTY, (WPARAM)"userDefine.udlName", reinterpret_cast(intBuffer)); + + itoa((int)_currentBufferID, intBuffer, 10); // use numeric value of BufferID pointer + execute(SCI_SETPROPERTY, (WPARAM)"userDefine.currentBufferID", reinterpret_cast(intBuffer)); - //for (int i = 0 ; i < userLangContainer->_styleArray.getNbStyler() ; i++) for (int i = 0 ; i < SCE_USER_STYLE_TOTAL_STYLES ; i++) { Style & style = userLangContainer->_styleArray.getStyler(i); @@ -1706,15 +1676,7 @@ void ScintillaEditView::bufferUpdated(Buffer * buffer, int mask) void ScintillaEditView::collapse(int level2Collapse, bool mode) { - // The following code is needed : - int startPos = 0, endPos = -1; - getVisibleStartAndEndPosition(&startPos, &endPos); - execute(SCI_COLOURISE, startPos, endPos); - // according to the Scitilla document : - // This requests the current lexer or the container (if the lexer is set to SCLEX_CONTAINER) - // to style the document between startPos and endPos. If endPos is -1, the document is styled from startPos to the end. - // If the "fold" property is set to "1" and your lexer or container supports folding, fold levels are also set. - // This message causes a redraw. + execute(SCI_COLOURISE, 0, -1); int maxLine = execute(SCI_GETLINECOUNT); @@ -1743,15 +1705,11 @@ void ScintillaEditView::foldCurrentPos(bool mode) void ScintillaEditView::fold(int line, bool mode) { - // The following code is needed : - int startPos = 0, endPos = -1; - getVisibleStartAndEndPosition(&startPos, &endPos); - execute(SCI_COLOURISE, startPos, endPos); - // according to the Scitilla document : - // This requests the current lexer or the container (if the lexer is set to SCLEX_CONTAINER) - // to style the document between startPos and endPos. If endPos is -1, the document is styled from startPos to the end. - // If the "fold" property is set to "1" and your lexer or container supports folding, fold levels are also set. - // This message causes a redraw. + int endStyled = execute(SCI_GETENDSTYLED); + int len = execute(SCI_GETTEXTLENGTH); + + if (endStyled < len) + execute(SCI_COLOURISE, 0, -1); int headerLine; int level = execute(SCI_GETFOLDLEVEL, line); @@ -1782,14 +1740,6 @@ void ScintillaEditView::fold(int line, bool mode) void ScintillaEditView::foldAll(bool mode) { - // The following code is needed : - //execute(SCI_COLOURISE, 0, -1); - // according to the Scitilla document : - // This requests the current lexer or the container (if the lexer is set to SCLEX_CONTAINER) - // to style the document between startPos and endPos. If endPos is -1, the document is styled from startPos to the end. - // If the "fold" property is set to "1" and your lexer or container supports folding, fold levels are also set. - // This message causes a redraw. - int maxLine = execute(SCI_GETLINECOUNT); for (int line = 0; line < maxLine; line++) diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.h b/PowerEditor/src/ScitillaComponent/ScintillaEditView.h index 7ec19d81..bae92f10 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.h +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.h @@ -225,7 +225,7 @@ public: delete [] it2->second._fontName; } delete it->second; - } + } } }; virtual void destroy() @@ -674,7 +674,7 @@ protected: typedef std::map StyleMap; typedef std::map BufferStyleMap; - BufferStyleMap _hotspotStyles; + BufferStyleMap _hotspotStyles; //Lexers and Styling void restyleBuffer(); diff --git a/PowerEditor/src/ScitillaComponent/UserDefineDialog.cpp b/PowerEditor/src/ScitillaComponent/UserDefineDialog.cpp index 55146056..d41a0c0f 100644 --- a/PowerEditor/src/ScitillaComponent/UserDefineDialog.cpp +++ b/PowerEditor/src/ScitillaComponent/UserDefineDialog.cpp @@ -7,10 +7,10 @@ // version 2 of the License, or (at your option) any later version. // // Note that the GPL places important restrictions on "derived works", yet -// it does not provide a detailed definition of that term. To avoid -// misunderstandings, we consider an application to constitute a +// it does not provide a detailed definition of that term. To avoid +// misunderstandings, we consider an application to constitute a // "derivative work" for the purpose of this license if it does any of the -// following: +// following: // 1. Integrates source code from Notepad++. // 2. Integrates/includes/aggregates Notepad++ into a proprietary executable // installer, such as those produced by InstallShield. @@ -40,6 +40,14 @@ UserLangContainer * SharedParametersDialog::_pUserLang = NULL; ScintillaEditView * SharedParametersDialog::_pScintilla = NULL; +GlobalMappers & globalMappper() +{ + // getting global object as reference to static ensures that only one object is created + // even if called from different code units + static GlobalMappers gm; + return gm; +} + bool SharedParametersDialog::setPropertyByCheck(HWND hwnd, WPARAM id, bool & bool2set) { bool2set = (BST_CHECKED == ::SendMessage(::GetDlgItem(hwnd, id), BM_GETCHECK, 0, 0)); @@ -83,7 +91,7 @@ BOOL CALLBACK FolderStyleDialog::run_dlgProc(UINT Message, WPARAM wParam, LPARAM { case WM_INITDIALOG : { - _pageLink.init(_hInst, _hSelf); + _pageLink.init(_hInst, _hSelf); _pageLink.create(::GetDlgItem(_hSelf, IDC_WEB_HELP_LINK), TEXT("http://udl20.weebly.com/")); return TRUE; } @@ -95,7 +103,7 @@ BOOL CALLBACK FolderStyleDialog::run_dlgProc(UINT Message, WPARAM wParam, LPARAM case IDC_FOLDER_FOLD_COMPACT : { return setPropertyByCheck(_hSelf, wParam, _pUserLang->_foldCompact); - } + } case IDC_FOLDER_IN_CODE1_STYLER : { StylerDlg stylerDlg(_hInst, _hSelf, SCE_USER_STYLE_FOLDER_IN_CODE1, SCE_USER_MASK_NESTING_NONE); @@ -120,13 +128,13 @@ BOOL CALLBACK FolderStyleDialog::run_dlgProc(UINT Message, WPARAM wParam, LPARAM stylerDlg.doDialog(); return TRUE; } - default : - return SharedParametersDialog::run_dlgProc(Message, wParam, lParam); + default : + return SharedParametersDialog::run_dlgProc(Message, wParam, lParam); } } case WM_DESTROY: { - _pageLink.destroy(); + _pageLink.destroy(); return TRUE; } default : @@ -136,37 +144,35 @@ BOOL CALLBACK FolderStyleDialog::run_dlgProc(UINT Message, WPARAM wParam, LPARAM void FolderStyleDialog::setKeywords2List(int id) { - int index; switch (id) { - case IDC_FOLDER_IN_CODE1_OPEN_EDIT : index = SCE_USER_KWLIST_FOLDERS_IN_CODE1_OPEN; break; - case IDC_FOLDER_IN_CODE1_MIDDLE_EDIT : index = SCE_USER_KWLIST_FOLDERS_IN_CODE1_MIDDLE; break; - case IDC_FOLDER_IN_CODE1_CLOSE_EDIT : index = SCE_USER_KWLIST_FOLDERS_IN_CODE1_CLOSE; break; - case IDC_FOLDER_IN_CODE2_OPEN_EDIT : index = SCE_USER_KWLIST_FOLDERS_IN_CODE2_OPEN; break; - case IDC_FOLDER_IN_CODE2_MIDDLE_EDIT : index = SCE_USER_KWLIST_FOLDERS_IN_CODE2_MIDDLE; break; - case IDC_FOLDER_IN_CODE2_CLOSE_EDIT : index = SCE_USER_KWLIST_FOLDERS_IN_CODE2_CLOSE; break; - case IDC_FOLDER_IN_COMMENT_OPEN_EDIT : index = SCE_USER_KWLIST_FOLDERS_IN_COMMENT_OPEN; break; - case IDC_FOLDER_IN_COMMENT_MIDDLE_EDIT : index = SCE_USER_KWLIST_FOLDERS_IN_COMMENT_MIDDLE; break; - case IDC_FOLDER_IN_COMMENT_CLOSE_EDIT : index = SCE_USER_KWLIST_FOLDERS_IN_COMMENT_CLOSE; break; - default : index = -1; + case IDC_FOLDER_IN_CODE1_OPEN_EDIT : + case IDC_FOLDER_IN_CODE1_MIDDLE_EDIT : + case IDC_FOLDER_IN_CODE1_CLOSE_EDIT : + case IDC_FOLDER_IN_CODE2_OPEN_EDIT : + case IDC_FOLDER_IN_CODE2_MIDDLE_EDIT : + case IDC_FOLDER_IN_CODE2_CLOSE_EDIT : + case IDC_FOLDER_IN_COMMENT_OPEN_EDIT : + case IDC_FOLDER_IN_COMMENT_MIDDLE_EDIT : + case IDC_FOLDER_IN_COMMENT_CLOSE_EDIT : + ::GetDlgItemText(_hSelf, id, _pUserLang->_keywordLists[globalMappper().dialogMapper[id]], max_char); + break; } - if (index != -1) - ::GetDlgItemText(_hSelf, id, _pUserLang->_keywordLists[index], max_char); } void FolderStyleDialog::updateDlg() { - ::SendDlgItemMessage(_hSelf, IDC_FOLDER_FOLD_COMPACT, BM_SETCHECK, _pUserLang->_foldCompact, 0); + ::SendDlgItemMessage(_hSelf, IDC_FOLDER_FOLD_COMPACT, BM_SETCHECK, _pUserLang->_foldCompact, 0); - ::SendDlgItemMessage(_hSelf, IDC_FOLDER_IN_CODE1_OPEN_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_FOLDERS_IN_CODE1_OPEN])); - ::SendDlgItemMessage(_hSelf, IDC_FOLDER_IN_CODE1_MIDDLE_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_FOLDERS_IN_CODE1_MIDDLE])); - ::SendDlgItemMessage(_hSelf, IDC_FOLDER_IN_CODE1_CLOSE_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_FOLDERS_IN_CODE1_CLOSE])); - ::SendDlgItemMessage(_hSelf, IDC_FOLDER_IN_CODE2_OPEN_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_FOLDERS_IN_CODE2_OPEN])); - ::SendDlgItemMessage(_hSelf, IDC_FOLDER_IN_CODE2_MIDDLE_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_FOLDERS_IN_CODE2_MIDDLE])); - ::SendDlgItemMessage(_hSelf, IDC_FOLDER_IN_CODE2_CLOSE_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_FOLDERS_IN_CODE2_CLOSE])); - ::SendDlgItemMessage(_hSelf, IDC_FOLDER_IN_COMMENT_OPEN_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_FOLDERS_IN_COMMENT_OPEN])); + ::SendDlgItemMessage(_hSelf, IDC_FOLDER_IN_CODE1_OPEN_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_FOLDERS_IN_CODE1_OPEN])); + ::SendDlgItemMessage(_hSelf, IDC_FOLDER_IN_CODE1_MIDDLE_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_FOLDERS_IN_CODE1_MIDDLE])); + ::SendDlgItemMessage(_hSelf, IDC_FOLDER_IN_CODE1_CLOSE_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_FOLDERS_IN_CODE1_CLOSE])); + ::SendDlgItemMessage(_hSelf, IDC_FOLDER_IN_CODE2_OPEN_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_FOLDERS_IN_CODE2_OPEN])); + ::SendDlgItemMessage(_hSelf, IDC_FOLDER_IN_CODE2_MIDDLE_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_FOLDERS_IN_CODE2_MIDDLE])); + ::SendDlgItemMessage(_hSelf, IDC_FOLDER_IN_CODE2_CLOSE_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_FOLDERS_IN_CODE2_CLOSE])); + ::SendDlgItemMessage(_hSelf, IDC_FOLDER_IN_COMMENT_OPEN_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_FOLDERS_IN_COMMENT_OPEN])); ::SendDlgItemMessage(_hSelf, IDC_FOLDER_IN_COMMENT_MIDDLE_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_FOLDERS_IN_COMMENT_MIDDLE])); - ::SendDlgItemMessage(_hSelf, IDC_FOLDER_IN_COMMENT_CLOSE_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_FOLDERS_IN_COMMENT_CLOSE])); + ::SendDlgItemMessage(_hSelf, IDC_FOLDER_IN_COMMENT_CLOSE_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_FOLDERS_IN_COMMENT_CLOSE])); } void FolderStyleDialog::convertTo(TCHAR *dest, const TCHAR *toConvert, TCHAR *prefix) const @@ -248,12 +254,27 @@ BOOL CALLBACK KeyWordsStyleDialog::run_dlgProc(UINT Message, WPARAM wParam, LPAR { switch (Message) { + case WM_INITDIALOG : + { + // extend Keyword edit boxes to hold 128k of TCHARs + ::SendMessage(::GetDlgItem(_hSelf,IDC_KEYWORD1_EDIT), EM_LIMITTEXT, WPARAM(128*1024), 0); + ::SendMessage(::GetDlgItem(_hSelf,IDC_KEYWORD2_EDIT), EM_LIMITTEXT, WPARAM(128*1024), 0); + ::SendMessage(::GetDlgItem(_hSelf,IDC_KEYWORD3_EDIT), EM_LIMITTEXT, WPARAM(128*1024), 0); + ::SendMessage(::GetDlgItem(_hSelf,IDC_KEYWORD4_EDIT), EM_LIMITTEXT, WPARAM(128*1024), 0); + ::SendMessage(::GetDlgItem(_hSelf,IDC_KEYWORD5_EDIT), EM_LIMITTEXT, WPARAM(128*1024), 0); + ::SendMessage(::GetDlgItem(_hSelf,IDC_KEYWORD6_EDIT), EM_LIMITTEXT, WPARAM(128*1024), 0); + ::SendMessage(::GetDlgItem(_hSelf,IDC_KEYWORD7_EDIT), EM_LIMITTEXT, WPARAM(128*1024), 0); + ::SendMessage(::GetDlgItem(_hSelf,IDC_KEYWORD8_EDIT), EM_LIMITTEXT, WPARAM(128*1024), 0); + + return TRUE; + } + case WM_COMMAND : { switch (wParam) { case IDC_KEYWORD1_PREFIX_CHECK : - return setPropertyByCheck(_hSelf, wParam, _pUserLang->_isPrefix[0]); + return setPropertyByCheck(_hSelf, wParam, _pUserLang->_isPrefix[0]); case IDC_KEYWORD2_PREFIX_CHECK : return setPropertyByCheck(_hSelf, wParam, _pUserLang->_isPrefix[1]); @@ -324,8 +345,8 @@ BOOL CALLBACK KeyWordsStyleDialog::run_dlgProc(UINT Message, WPARAM wParam, LPAR stylerDlg.doDialog(); return TRUE; } - default : - return SharedParametersDialog::run_dlgProc(Message, wParam, lParam); + default : + return SharedParametersDialog::run_dlgProc(Message, wParam, lParam); } } default : @@ -335,21 +356,18 @@ BOOL CALLBACK KeyWordsStyleDialog::run_dlgProc(UINT Message, WPARAM wParam, LPAR void KeyWordsStyleDialog::setKeywords2List(int id) { - int index; switch (id) { - case IDC_KEYWORD1_EDIT : index = SCE_USER_KWLIST_KEYWORDS1; break; - case IDC_KEYWORD2_EDIT : index = SCE_USER_KWLIST_KEYWORDS2; break; - case IDC_KEYWORD3_EDIT : index = SCE_USER_KWLIST_KEYWORDS3; break; - case IDC_KEYWORD4_EDIT : index = SCE_USER_KWLIST_KEYWORDS4; break; - case IDC_KEYWORD5_EDIT : index = SCE_USER_KWLIST_KEYWORDS5; break; - case IDC_KEYWORD6_EDIT : index = SCE_USER_KWLIST_KEYWORDS6; break; - case IDC_KEYWORD7_EDIT : index = SCE_USER_KWLIST_KEYWORDS7; break; - case IDC_KEYWORD8_EDIT : index = SCE_USER_KWLIST_KEYWORDS8; break; - default : index = -1; + case IDC_KEYWORD1_EDIT : + case IDC_KEYWORD2_EDIT : + case IDC_KEYWORD3_EDIT : + case IDC_KEYWORD4_EDIT : + case IDC_KEYWORD5_EDIT : + case IDC_KEYWORD6_EDIT : + case IDC_KEYWORD7_EDIT : + case IDC_KEYWORD8_EDIT : + ::GetDlgItemText(_hSelf, id, _pUserLang->_keywordLists[globalMappper().dialogMapper[id]], max_char); } - if (index != -1) - ::GetDlgItemText(_hSelf, id, _pUserLang->_keywordLists[index], max_char); } void KeyWordsStyleDialog::updateDlg() @@ -377,6 +395,20 @@ BOOL CALLBACK CommentStyleDialog::run_dlgProc(UINT Message, WPARAM wParam, LPARA { switch (Message) { + case WM_ACTIVATE : + case WM_SHOWWINDOW : + { + ::SendDlgItemMessage(_hSelf, IDC_ALLOW_ANYWHERE, BM_SETCHECK, _pUserLang->_forcePureLC == PURE_LC_NONE, 0); + ::SendDlgItemMessage(_hSelf, IDC_FORCE_AT_BOL, BM_SETCHECK, _pUserLang->_forcePureLC == PURE_LC_BOL, 0); + ::SendDlgItemMessage(_hSelf, IDC_ALLOW_WHITESPACE, BM_SETCHECK, _pUserLang->_forcePureLC == PURE_LC_WSP, 0); + + ::SendDlgItemMessage(_hSelf, IDC_DOT_RADIO, BM_SETCHECK, _pUserLang->_decimalSeparator == DECSEP_DOT, 0); + ::SendDlgItemMessage(_hSelf, IDC_COMMA_RADIO, BM_SETCHECK, _pUserLang->_decimalSeparator == DECSEP_COMMA, 0); + ::SendDlgItemMessage(_hSelf, IDC_BOTH_RADIO, BM_SETCHECK, _pUserLang->_decimalSeparator == DECSEP_BOTH, 0); + + return SharedParametersDialog::run_dlgProc(Message, wParam, lParam); + } + case WM_COMMAND : { switch (wParam) @@ -385,12 +417,38 @@ BOOL CALLBACK CommentStyleDialog::run_dlgProc(UINT Message, WPARAM wParam, LPARA { return setPropertyByCheck(_hSelf, wParam, _pUserLang->_allowFoldOfComments); } + case IDC_ALLOW_ANYWHERE : + case IDC_FORCE_AT_BOL : + case IDC_ALLOW_WHITESPACE : + { + if (BST_CHECKED == ::SendMessage(::GetDlgItem(_hSelf, IDC_ALLOW_ANYWHERE), BM_GETCHECK, 0, 0)) + _pUserLang->_forcePureLC = PURE_LC_NONE; + else if (BST_CHECKED == ::SendMessage(::GetDlgItem(_hSelf, IDC_FORCE_AT_BOL), BM_GETCHECK, 0, 0)) + _pUserLang->_forcePureLC = PURE_LC_BOL; + else if (BST_CHECKED == ::SendMessage(::GetDlgItem(_hSelf, IDC_ALLOW_WHITESPACE), BM_GETCHECK, 0, 0)) + _pUserLang->_forcePureLC = PURE_LC_WSP; - case IDC_FORCE_LINE_COMMENTS_AT_BOL : - { - return setPropertyByCheck(_hSelf, wParam, _pUserLang->_forceLineCommentsAtBOL); - } + if (_pScintilla->getCurrentBuffer()->getLangType() == L_USER) + _pScintilla->styleChange(); + return TRUE; + } + case IDC_DOT_RADIO : + case IDC_COMMA_RADIO : + case IDC_BOTH_RADIO : + { + if (BST_CHECKED == ::SendMessage(::GetDlgItem(_hSelf, IDC_DOT_RADIO), BM_GETCHECK, 0, 0)) + _pUserLang->_decimalSeparator = DECSEP_DOT; + else if (BST_CHECKED == ::SendMessage(::GetDlgItem(_hSelf, IDC_COMMA_RADIO), BM_GETCHECK, 0, 0)) + _pUserLang->_decimalSeparator = DECSEP_COMMA; + else if (BST_CHECKED == ::SendMessage(::GetDlgItem(_hSelf, IDC_BOTH_RADIO), BM_GETCHECK, 0, 0)) + _pUserLang->_decimalSeparator = DECSEP_BOTH; + + if (_pScintilla->getCurrentBuffer()->getLangType() == L_USER) + _pScintilla->styleChange(); + + return TRUE; + } case IDC_COMMENTLINE_STYLER : { StylerDlg stylerDlg(_hInst, _hSelf, SCE_USER_STYLE_COMMENTLINE); @@ -409,8 +467,8 @@ BOOL CALLBACK CommentStyleDialog::run_dlgProc(UINT Message, WPARAM wParam, LPARA stylerDlg.doDialog(); return TRUE; } - default : - return SharedParametersDialog::run_dlgProc(Message, wParam, lParam); + default : + return SharedParametersDialog::run_dlgProc(Message, wParam, lParam); } } default : @@ -423,26 +481,17 @@ void CommentStyleDialog::setKeywords2List(int id) int index = 0; switch (id) { - case IDC_NUMBER_EXTRA_EDIT : - { - ::SendDlgItemMessage(_hSelf, IDC_NUMBER_EXTRA_EDIT, WM_GETTEXT, max_char, reinterpret_cast((_pUserLang->_keywordLists[SCE_USER_KWLIST_NUMBER_EXTRA]))); - break; - } - case IDC_NUMBER_PREFIX_EDIT : - { - ::SendDlgItemMessage(_hSelf, IDC_NUMBER_PREFIX_EDIT, WM_GETTEXT, max_char, reinterpret_cast((_pUserLang->_keywordLists[SCE_USER_KWLIST_NUMBER_PREFIX]))); - break; - } - case IDC_NUMBER_EXTRAPREF_EDIT : - { - ::SendDlgItemMessage(_hSelf, IDC_NUMBER_EXTRAPREF_EDIT, WM_GETTEXT, max_char, reinterpret_cast((_pUserLang->_keywordLists[SCE_USER_KWLIST_NUMBER_EXTRAPREF]))); - break; - } - case IDC_NUMBER_SUFFIX_EDIT : - { - ::SendDlgItemMessage(_hSelf, IDC_NUMBER_SUFFIX_EDIT, WM_GETTEXT, max_char, reinterpret_cast((_pUserLang->_keywordLists[SCE_USER_KWLIST_NUMBER_SUFFIX]))); - break; - } + case IDC_NUMBER_PREFIX1_EDIT : + case IDC_NUMBER_PREFIX2_EDIT : + case IDC_NUMBER_EXTRAS1_EDIT : + case IDC_NUMBER_EXTRAS2_EDIT : + case IDC_NUMBER_SUFFIX1_EDIT : + case IDC_NUMBER_SUFFIX2_EDIT : + case IDC_NUMBER_RANGE_EDIT : + { + ::GetDlgItemText(_hSelf, id, _pUserLang->_keywordLists[globalMappper().dialogMapper[id]], max_char); + break; + } case IDC_COMMENT_OPEN_EDIT : case IDC_COMMENT_CLOSE_EDIT : @@ -543,14 +592,14 @@ void CommentStyleDialog::retrieve(TCHAR *dest, const TCHAR *toRetrieve, TCHAR *p ++i; continue; } - if (toRetrieve[i] == '(' && toRetrieve[i+1] == '(' && inGroup == false && begin2Copy == true) - { - inGroup = true; - } - if (toRetrieve[i] != ')' && toRetrieve[i-1] == ')' && toRetrieve[i-2] == ')' && inGroup == true) - { - inGroup = false; - } + if (toRetrieve[i] == '(' && toRetrieve[i+1] == '(' && inGroup == false && begin2Copy == true) + { + inGroup = true; + } + if (toRetrieve[i] != ')' && toRetrieve[i-1] == ')' && toRetrieve[i-2] == ')' && inGroup == true) + { + inGroup = false; + } if (toRetrieve[i] == ' ' && begin2Copy == true) { begin2Copy = false; @@ -564,74 +613,84 @@ void CommentStyleDialog::retrieve(TCHAR *dest, const TCHAR *toRetrieve, TCHAR *p void CommentStyleDialog::updateDlg() { - TCHAR buffer[max_char] = TEXT(""); - TCHAR intBuffer[10] = {'0', 0}; + TCHAR buffer[max_char] = TEXT(""); + TCHAR intBuffer[10] = {'0', 0}; - const int list[] = { - IDC_COMMENTLINE_OPEN_EDIT, - IDC_COMMENTLINE_CONTINUE_EDIT, - IDC_COMMENTLINE_CLOSE_EDIT, - IDC_COMMENT_OPEN_EDIT, - IDC_COMMENT_CLOSE_EDIT - }; + const int list[] = { + IDC_COMMENTLINE_OPEN_EDIT, + IDC_COMMENTLINE_CONTINUE_EDIT, + IDC_COMMENTLINE_CLOSE_EDIT, + IDC_COMMENT_OPEN_EDIT, + IDC_COMMENT_CLOSE_EDIT + }; - for (int i=0; i_keywordLists[SCE_USER_KWLIST_COMMENTS], intBuffer); - ::SendDlgItemMessage(_hSelf, list[i], WM_SETTEXT, 0, (LPARAM)buffer); - } + for (int i=0; i_keywordLists[SCE_USER_KWLIST_COMMENTS], intBuffer); + ::SendDlgItemMessage(_hSelf, list[i], WM_SETTEXT, 0, (LPARAM)buffer); + } - ::SendDlgItemMessage(_hSelf, IDC_FORCE_LINE_COMMENTS_AT_BOL, BM_SETCHECK, _pUserLang->_forceLineCommentsAtBOL, 0); - ::SendDlgItemMessage(_hSelf, IDC_FOLDING_OF_COMMENTS, BM_SETCHECK, _pUserLang->_allowFoldOfComments, 0); - - ::SendDlgItemMessage(_hSelf, IDC_NUMBER_EXTRA_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_NUMBER_EXTRA])); - ::SendDlgItemMessage(_hSelf, IDC_NUMBER_PREFIX_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_NUMBER_PREFIX])); - ::SendDlgItemMessage(_hSelf, IDC_NUMBER_EXTRAPREF_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_NUMBER_EXTRAPREF])); - ::SendDlgItemMessage(_hSelf, IDC_NUMBER_SUFFIX_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_NUMBER_SUFFIX])); + ::SendDlgItemMessage(_hSelf, IDC_FOLDING_OF_COMMENTS, BM_SETCHECK, _pUserLang->_allowFoldOfComments, 0); + + ::SendDlgItemMessage(_hSelf, IDC_ALLOW_ANYWHERE, BM_SETCHECK, _pUserLang->_forcePureLC == PURE_LC_NONE, 0); + ::SendDlgItemMessage(_hSelf, IDC_FORCE_AT_BOL, BM_SETCHECK, _pUserLang->_forcePureLC == PURE_LC_BOL, 0); + ::SendDlgItemMessage(_hSelf, IDC_ALLOW_WHITESPACE, BM_SETCHECK, _pUserLang->_forcePureLC == PURE_LC_WSP, 0); + + ::SendDlgItemMessage(_hSelf, IDC_DOT_RADIO, BM_SETCHECK, _pUserLang->_decimalSeparator == DECSEP_DOT, 0); + ::SendDlgItemMessage(_hSelf, IDC_COMMA_RADIO, BM_SETCHECK, _pUserLang->_decimalSeparator == DECSEP_COMMA, 0); + ::SendDlgItemMessage(_hSelf, IDC_BOTH_RADIO, BM_SETCHECK, _pUserLang->_decimalSeparator == DECSEP_BOTH, 0); + + ::SendDlgItemMessage(_hSelf, IDC_NUMBER_PREFIX1_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_NUMBER_PREFIX1])); + ::SendDlgItemMessage(_hSelf, IDC_NUMBER_PREFIX2_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_NUMBER_PREFIX2])); + ::SendDlgItemMessage(_hSelf, IDC_NUMBER_EXTRAS1_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_NUMBER_EXTRAS1])); + ::SendDlgItemMessage(_hSelf, IDC_NUMBER_EXTRAS2_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_NUMBER_EXTRAS2])); + ::SendDlgItemMessage(_hSelf, IDC_NUMBER_SUFFIX1_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_NUMBER_SUFFIX1])); + ::SendDlgItemMessage(_hSelf, IDC_NUMBER_SUFFIX2_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_NUMBER_SUFFIX2])); + ::SendDlgItemMessage(_hSelf, IDC_NUMBER_RANGE_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_NUMBER_RANGE])); } void SymbolsStyleDialog::updateDlg() { - TCHAR buffer[max_char] = TEXT(""); - const int list[] = { - IDC_DELIMITER1_BOUNDARYOPEN_EDIT, - IDC_DELIMITER1_ESCAPE_EDIT, - IDC_DELIMITER1_BOUNDARYCLOSE_EDIT, - IDC_DELIMITER2_BOUNDARYOPEN_EDIT, - IDC_DELIMITER2_ESCAPE_EDIT, - IDC_DELIMITER2_BOUNDARYCLOSE_EDIT, - IDC_DELIMITER3_BOUNDARYOPEN_EDIT, - IDC_DELIMITER3_ESCAPE_EDIT, - IDC_DELIMITER3_BOUNDARYCLOSE_EDIT, - IDC_DELIMITER4_BOUNDARYOPEN_EDIT, - IDC_DELIMITER4_ESCAPE_EDIT, - IDC_DELIMITER4_BOUNDARYCLOSE_EDIT, - IDC_DELIMITER5_BOUNDARYOPEN_EDIT, - IDC_DELIMITER5_ESCAPE_EDIT, - IDC_DELIMITER5_BOUNDARYCLOSE_EDIT, - IDC_DELIMITER6_BOUNDARYOPEN_EDIT, - IDC_DELIMITER6_ESCAPE_EDIT, - IDC_DELIMITER6_BOUNDARYCLOSE_EDIT, - IDC_DELIMITER7_BOUNDARYOPEN_EDIT, - IDC_DELIMITER7_ESCAPE_EDIT, - IDC_DELIMITER7_BOUNDARYCLOSE_EDIT, - IDC_DELIMITER8_BOUNDARYOPEN_EDIT, - IDC_DELIMITER8_ESCAPE_EDIT, - IDC_DELIMITER8_BOUNDARYCLOSE_EDIT - }; - TCHAR intBuffer[10] = {'0', 0}; + TCHAR buffer[max_char] = TEXT(""); + const int list[] = { + IDC_DELIMITER1_BOUNDARYOPEN_EDIT, + IDC_DELIMITER1_ESCAPE_EDIT, + IDC_DELIMITER1_BOUNDARYCLOSE_EDIT, + IDC_DELIMITER2_BOUNDARYOPEN_EDIT, + IDC_DELIMITER2_ESCAPE_EDIT, + IDC_DELIMITER2_BOUNDARYCLOSE_EDIT, + IDC_DELIMITER3_BOUNDARYOPEN_EDIT, + IDC_DELIMITER3_ESCAPE_EDIT, + IDC_DELIMITER3_BOUNDARYCLOSE_EDIT, + IDC_DELIMITER4_BOUNDARYOPEN_EDIT, + IDC_DELIMITER4_ESCAPE_EDIT, + IDC_DELIMITER4_BOUNDARYCLOSE_EDIT, + IDC_DELIMITER5_BOUNDARYOPEN_EDIT, + IDC_DELIMITER5_ESCAPE_EDIT, + IDC_DELIMITER5_BOUNDARYCLOSE_EDIT, + IDC_DELIMITER6_BOUNDARYOPEN_EDIT, + IDC_DELIMITER6_ESCAPE_EDIT, + IDC_DELIMITER6_BOUNDARYCLOSE_EDIT, + IDC_DELIMITER7_BOUNDARYOPEN_EDIT, + IDC_DELIMITER7_ESCAPE_EDIT, + IDC_DELIMITER7_BOUNDARYCLOSE_EDIT, + IDC_DELIMITER8_BOUNDARYOPEN_EDIT, + IDC_DELIMITER8_ESCAPE_EDIT, + IDC_DELIMITER8_BOUNDARYCLOSE_EDIT + }; + TCHAR intBuffer[10] = {'0', 0}; - for (int i=0; i_keywordLists[SCE_USER_KWLIST_DELIMITERS], intBuffer); - ::SendDlgItemMessage(_hSelf, list[i], WM_SETTEXT, 0, (LPARAM)buffer); - } + retrieve(buffer, _pUserLang->_keywordLists[SCE_USER_KWLIST_DELIMITERS], intBuffer); + ::SendDlgItemMessage(_hSelf, list[i], WM_SETTEXT, 0, (LPARAM)buffer); + } ::SendDlgItemMessage(_hSelf, IDC_OPERATOR1_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_OPERATORS1])); ::SendDlgItemMessage(_hSelf, IDC_OPERATOR2_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_OPERATORS2])); @@ -699,8 +758,8 @@ BOOL CALLBACK SymbolsStyleDialog::run_dlgProc(UINT Message, WPARAM wParam, LPARA stylerDlg.doDialog(); return TRUE; } - default : - return SharedParametersDialog::run_dlgProc(Message, wParam, lParam); + default : + return SharedParametersDialog::run_dlgProc(Message, wParam, lParam); } } default : @@ -760,7 +819,7 @@ void SymbolsStyleDialog::retrieve(TCHAR *dest, const TCHAR *toRetrieve, TCHAR *p { int j = 0; bool begin2Copy = false; - bool inGroup = false; + bool inGroup = false; for (int i = 0 ; i < int(lstrlen(toRetrieve)) ; i++) { @@ -773,14 +832,14 @@ void SymbolsStyleDialog::retrieve(TCHAR *dest, const TCHAR *toRetrieve, TCHAR *p ++i; continue; } - if (toRetrieve[i] == '(' && toRetrieve[i+1] == '(' && inGroup == false && begin2Copy == true) - { - inGroup = true; - } - if (toRetrieve[i] != ')' && toRetrieve[i-1] == ')' && toRetrieve[i-2] == ')' && inGroup == true) - { - inGroup = false; - } + if (toRetrieve[i] == '(' && toRetrieve[i+1] == '(' && inGroup == false && begin2Copy == true) + { + inGroup = true; + } + if (toRetrieve[i] != ')' && toRetrieve[i-1] == ')' && toRetrieve[i-2] == ')' && inGroup == true) + { + inGroup = false; + } if (toRetrieve[i] == ' ' && begin2Copy == true) { begin2Copy = false; @@ -828,48 +887,48 @@ void SymbolsStyleDialog::setKeywords2List(int id) case IDC_DELIMITER8_ESCAPE_EDIT : case IDC_DELIMITER8_BOUNDARYCLOSE_EDIT : { - TCHAR newList[max_char] = TEXT(""); - TCHAR buffer[max_char] = TEXT(""); - TCHAR intBuffer[10] = {'0', 0}; + TCHAR newList[max_char] = TEXT(""); + TCHAR buffer[max_char] = TEXT(""); + TCHAR intBuffer[10] = {'0', 0}; - const int list[] = { - IDC_DELIMITER1_BOUNDARYOPEN_EDIT, - IDC_DELIMITER1_ESCAPE_EDIT, - IDC_DELIMITER1_BOUNDARYCLOSE_EDIT, - IDC_DELIMITER2_BOUNDARYOPEN_EDIT, - IDC_DELIMITER2_ESCAPE_EDIT, - IDC_DELIMITER2_BOUNDARYCLOSE_EDIT, - IDC_DELIMITER3_BOUNDARYOPEN_EDIT, - IDC_DELIMITER3_ESCAPE_EDIT, - IDC_DELIMITER3_BOUNDARYCLOSE_EDIT, - IDC_DELIMITER4_BOUNDARYOPEN_EDIT, - IDC_DELIMITER4_ESCAPE_EDIT, - IDC_DELIMITER4_BOUNDARYCLOSE_EDIT, - IDC_DELIMITER5_BOUNDARYOPEN_EDIT, - IDC_DELIMITER5_ESCAPE_EDIT, - IDC_DELIMITER5_BOUNDARYCLOSE_EDIT, - IDC_DELIMITER6_BOUNDARYOPEN_EDIT, - IDC_DELIMITER6_ESCAPE_EDIT, - IDC_DELIMITER6_BOUNDARYCLOSE_EDIT, - IDC_DELIMITER7_BOUNDARYOPEN_EDIT, - IDC_DELIMITER7_ESCAPE_EDIT, - IDC_DELIMITER7_BOUNDARYCLOSE_EDIT, - IDC_DELIMITER8_BOUNDARYOPEN_EDIT, - IDC_DELIMITER8_ESCAPE_EDIT, - IDC_DELIMITER8_BOUNDARYCLOSE_EDIT - }; + const int list[] = { + IDC_DELIMITER1_BOUNDARYOPEN_EDIT, + IDC_DELIMITER1_ESCAPE_EDIT, + IDC_DELIMITER1_BOUNDARYCLOSE_EDIT, + IDC_DELIMITER2_BOUNDARYOPEN_EDIT, + IDC_DELIMITER2_ESCAPE_EDIT, + IDC_DELIMITER2_BOUNDARYCLOSE_EDIT, + IDC_DELIMITER3_BOUNDARYOPEN_EDIT, + IDC_DELIMITER3_ESCAPE_EDIT, + IDC_DELIMITER3_BOUNDARYCLOSE_EDIT, + IDC_DELIMITER4_BOUNDARYOPEN_EDIT, + IDC_DELIMITER4_ESCAPE_EDIT, + IDC_DELIMITER4_BOUNDARYCLOSE_EDIT, + IDC_DELIMITER5_BOUNDARYOPEN_EDIT, + IDC_DELIMITER5_ESCAPE_EDIT, + IDC_DELIMITER5_BOUNDARYCLOSE_EDIT, + IDC_DELIMITER6_BOUNDARYOPEN_EDIT, + IDC_DELIMITER6_ESCAPE_EDIT, + IDC_DELIMITER6_BOUNDARYCLOSE_EDIT, + IDC_DELIMITER7_BOUNDARYOPEN_EDIT, + IDC_DELIMITER7_ESCAPE_EDIT, + IDC_DELIMITER7_BOUNDARYCLOSE_EDIT, + IDC_DELIMITER8_BOUNDARYOPEN_EDIT, + IDC_DELIMITER8_ESCAPE_EDIT, + IDC_DELIMITER8_BOUNDARYCLOSE_EDIT + }; - for (int i=0; i_keywordLists[SCE_USER_KWLIST_DELIMITERS], newList); break; @@ -883,30 +942,30 @@ UserDefineDialog::UserDefineDialog(): SharedParametersDialog(), _status(UNDOCK), { _pCurrentUserLang = new UserLangContainer(); - _pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_DEFAULT, styleNameMapper[SCE_USER_STYLE_DEFAULT]); - _pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_COMMENT, styleNameMapper[SCE_USER_STYLE_COMMENT]); - _pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_COMMENTLINE, styleNameMapper[SCE_USER_STYLE_COMMENTLINE]); - _pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_NUMBER, styleNameMapper[SCE_USER_STYLE_NUMBER]); - _pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_KEYWORD1, styleNameMapper[SCE_USER_STYLE_KEYWORD1]); - _pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_KEYWORD2, styleNameMapper[SCE_USER_STYLE_KEYWORD2]); - _pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_KEYWORD3, styleNameMapper[SCE_USER_STYLE_KEYWORD3]); - _pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_KEYWORD4, styleNameMapper[SCE_USER_STYLE_KEYWORD4]); - _pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_KEYWORD5, styleNameMapper[SCE_USER_STYLE_KEYWORD5]); - _pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_KEYWORD6, styleNameMapper[SCE_USER_STYLE_KEYWORD6]); - _pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_KEYWORD7, styleNameMapper[SCE_USER_STYLE_KEYWORD7]); - _pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_KEYWORD8, styleNameMapper[SCE_USER_STYLE_KEYWORD8]); - _pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_OPERATOR, styleNameMapper[SCE_USER_STYLE_OPERATOR]); - _pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_FOLDER_IN_CODE1, styleNameMapper[SCE_USER_STYLE_FOLDER_IN_CODE1]); - _pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_FOLDER_IN_CODE2, styleNameMapper[SCE_USER_STYLE_FOLDER_IN_CODE2]); - _pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_FOLDER_IN_COMMENT, styleNameMapper[SCE_USER_STYLE_FOLDER_IN_COMMENT]); - _pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_DELIMITER1, styleNameMapper[SCE_USER_STYLE_DELIMITER1]); - _pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_DELIMITER2, styleNameMapper[SCE_USER_STYLE_DELIMITER2]); - _pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_DELIMITER3, styleNameMapper[SCE_USER_STYLE_DELIMITER3]); - _pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_DELIMITER4, styleNameMapper[SCE_USER_STYLE_DELIMITER4]); - _pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_DELIMITER5, styleNameMapper[SCE_USER_STYLE_DELIMITER5]); - _pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_DELIMITER6, styleNameMapper[SCE_USER_STYLE_DELIMITER6]); - _pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_DELIMITER7, styleNameMapper[SCE_USER_STYLE_DELIMITER7]); - _pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_DELIMITER8, styleNameMapper[SCE_USER_STYLE_DELIMITER8]); + _pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_DEFAULT, globalMappper().styleNameMapper[SCE_USER_STYLE_DEFAULT].c_str()); + _pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_COMMENT, globalMappper().styleNameMapper[SCE_USER_STYLE_COMMENT].c_str()); + _pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_COMMENTLINE, globalMappper().styleNameMapper[SCE_USER_STYLE_COMMENTLINE].c_str()); + _pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_NUMBER, globalMappper().styleNameMapper[SCE_USER_STYLE_NUMBER].c_str()); + _pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_KEYWORD1, globalMappper().styleNameMapper[SCE_USER_STYLE_KEYWORD1].c_str()); + _pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_KEYWORD2, globalMappper().styleNameMapper[SCE_USER_STYLE_KEYWORD2].c_str()); + _pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_KEYWORD3, globalMappper().styleNameMapper[SCE_USER_STYLE_KEYWORD3].c_str()); + _pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_KEYWORD4, globalMappper().styleNameMapper[SCE_USER_STYLE_KEYWORD4].c_str()); + _pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_KEYWORD5, globalMappper().styleNameMapper[SCE_USER_STYLE_KEYWORD5].c_str()); + _pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_KEYWORD6, globalMappper().styleNameMapper[SCE_USER_STYLE_KEYWORD6].c_str()); + _pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_KEYWORD7, globalMappper().styleNameMapper[SCE_USER_STYLE_KEYWORD7].c_str()); + _pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_KEYWORD8, globalMappper().styleNameMapper[SCE_USER_STYLE_KEYWORD8].c_str()); + _pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_OPERATOR, globalMappper().styleNameMapper[SCE_USER_STYLE_OPERATOR].c_str()); + _pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_FOLDER_IN_CODE1, globalMappper().styleNameMapper[SCE_USER_STYLE_FOLDER_IN_CODE1].c_str()); + _pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_FOLDER_IN_CODE2, globalMappper().styleNameMapper[SCE_USER_STYLE_FOLDER_IN_CODE2].c_str()); + _pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_FOLDER_IN_COMMENT, globalMappper().styleNameMapper[SCE_USER_STYLE_FOLDER_IN_COMMENT].c_str()); + _pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_DELIMITER1, globalMappper().styleNameMapper[SCE_USER_STYLE_DELIMITER1].c_str()); + _pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_DELIMITER2, globalMappper().styleNameMapper[SCE_USER_STYLE_DELIMITER2].c_str()); + _pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_DELIMITER3, globalMappper().styleNameMapper[SCE_USER_STYLE_DELIMITER3].c_str()); + _pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_DELIMITER4, globalMappper().styleNameMapper[SCE_USER_STYLE_DELIMITER4].c_str()); + _pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_DELIMITER5, globalMappper().styleNameMapper[SCE_USER_STYLE_DELIMITER5].c_str()); + _pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_DELIMITER6, globalMappper().styleNameMapper[SCE_USER_STYLE_DELIMITER6].c_str()); + _pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_DELIMITER7, globalMappper().styleNameMapper[SCE_USER_STYLE_DELIMITER7].c_str()); + _pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_DELIMITER8, globalMappper().styleNameMapper[SCE_USER_STYLE_DELIMITER8].c_str()); } UserDefineDialog::~UserDefineDialog() @@ -985,6 +1044,8 @@ BOOL CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPARAM { case WM_INITDIALOG : { + _pUserLang = _pCurrentUserLang; + _ctrlTab.init(_hInst, _hSelf, false); _ctrlTab.setFont(TEXT("Tahoma"), 13); @@ -1036,8 +1097,6 @@ BOOL CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPARAM enableLangAndControlsBy(0); - _pUserLang = _pCurrentUserLang; - if (pNppParam->isTransparentAvailable()) { ::ShowWindow(::GetDlgItem(_hSelf, IDC_UD_TRANSPARENT_CHECK), SW_SHOW); @@ -1053,15 +1112,19 @@ BOOL CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPARAM si.fMask = SIF_RANGE; //| SIF_PAGE; si.nMin = 0; si.nMax = 0; - //si.nPage = _currentHight; - //si.nPos = 0; ::SetScrollInfo(_hSelf, SB_VERT, &si, TRUE); - // ETDTProc enableDlgTheme = (ETDTProc)pNppParam->getEnableThemeDlgTexture(); - // if (enableDlgTheme) - // { - // // enableDlgTheme(_hSelf, ETDT_ENABLETAB); - // } + TCHAR temp[32]; + generic_string udlVersion = TEXT("User Defined Language v."); + udlVersion += generic_itoa(SCE_UDL_VERSION_MAJOR, temp, 10); + udlVersion += TEXT("."); + udlVersion += generic_itoa(SCE_UDL_VERSION_MINOR, temp, 10); + udlVersion += TEXT("."); + udlVersion += generic_itoa(SCE_UDL_VERSION_BUILD, temp, 10); + udlVersion += TEXT("."); + udlVersion += generic_itoa(SCE_UDL_VERSION_REVISION, temp, 10); + + ::SetWindowText(_hSelf, udlVersion.c_str()); return TRUE; } @@ -1487,26 +1550,26 @@ BOOL CALLBACK StylerDlg::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM { StylerDlg * dlg = (StylerDlg *)::GetProp(hwnd, TEXT("Styler dialog prop")); NppParameters *pNppParam = NppParameters::getInstance(); - + switch (message) { case WM_INITDIALOG : { - NativeLangSpeaker *pNativeLangSpeaker = pNppParam->getNativeLangSpeaker(); - pNativeLangSpeaker->changeUserDefineLangPopupDlg(hwnd); + NativeLangSpeaker *pNativeLangSpeaker = pNppParam->getNativeLangSpeaker(); + pNativeLangSpeaker->changeUserDefineLangPopupDlg(hwnd); ::SetProp(hwnd, TEXT("Styler dialog prop"), (HANDLE)lParam); - dlg = (StylerDlg *)::GetProp(hwnd, TEXT("Styler dialog prop")); + dlg = (StylerDlg *)::GetProp(hwnd, TEXT("Styler dialog prop")); Style & style = SharedParametersDialog::_pUserLang->_styleArray.getStyler(dlg->stylerIndex); - // move dialog over UDL GUI (position 0,0 of UDL window) so it wouldn't cover the code - RECT wrc; - ::GetWindowRect(dlg->parent, &wrc); - wrc.left = wrc.left < 0 ? 200 : wrc.left; // if outside of visible area - wrc.top = wrc.top < 0 ? 200 : wrc.top; - ::SetWindowPos(hwnd, HWND_TOP, wrc.left, wrc.top, 0, 0, SWP_NOSIZE | SWP_NOZORDER); - - ::SendDlgItemMessage(hwnd, IDC_STYLER_CHECK_UNDERLINE, BM_SETCHECK, style._fontStyle & FONTSTYLE_UNDERLINE, 0); + // move dialog over UDL GUI (position 0,0 of UDL window) so it wouldn't cover the code + RECT wrc; + ::GetWindowRect(dlg->parent, &wrc); + wrc.left = wrc.left < 0 ? 200 : wrc.left; // if outside of visible area + wrc.top = wrc.top < 0 ? 200 : wrc.top; + ::SetWindowPos(hwnd, HWND_TOP, wrc.left, wrc.top, 0, 0, SWP_NOSIZE | SWP_NOZORDER); + + ::SendDlgItemMessage(hwnd, IDC_STYLER_CHECK_UNDERLINE, BM_SETCHECK, style._fontStyle & FONTSTYLE_UNDERLINE, 0); ::SendDlgItemMessage(hwnd, IDC_STYLER_CHECK_ITALIC, BM_SETCHECK, style._fontStyle & FONTSTYLE_ITALIC, 0); ::SendDlgItemMessage(hwnd, IDC_STYLER_CHECK_BOLD, BM_SETCHECK, style._fontStyle & FONTSTYLE_BOLD, 0); @@ -1577,10 +1640,11 @@ BOOL CALLBACK StylerDlg::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM dlg->pFgColour->display(); dlg->pBgColour->display(); - for (int i=0; i::iterator iter = globalMappper().nestingMapper.begin(); + for (; iter != globalMappper().nestingMapper.end(); ++iter) { - ::SendDlgItemMessage(hwnd, nestingMapper[i][0], BM_SETCHECK, style._nesting & nestingMapper[i][1], 0); - ::EnableWindow(::GetDlgItem(hwnd, nestingMapper[i][0]), dlg->enabledNesters & nestingMapper[i][1]); + ::SendDlgItemMessage(hwnd, iter->first, BM_SETCHECK, style._nesting & iter->second, 0); + ::EnableWindow(::GetDlgItem(hwnd, iter->first), dlg->enabledNesters & iter->second); } return TRUE; } @@ -1607,16 +1671,16 @@ BOOL CALLBACK StylerDlg::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM style._fontSize = -1; } } - else - { - style._fontSize = -1; - } + else + { + style._fontSize = -1; + } } else if (LOWORD(wParam) == IDC_STYLER_COMBO_FONT_NAME) { style._fontName = (TCHAR *)::SendDlgItemMessage(hwnd, LOWORD(wParam), CB_GETITEMDATA, i, 0); } - + // show changes to user, re-color document if (SharedParametersDialog::_pScintilla->getCurrentBuffer()->getLangType() == L_USER) SharedParametersDialog::_pScintilla->styleChange(); @@ -1627,7 +1691,7 @@ BOOL CALLBACK StylerDlg::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM if (wParam == IDCANCEL) { style = dlg->initialStyle; - + // show changes to user, re-color document if (SharedParametersDialog::_pScintilla->getCurrentBuffer()->getLangType() == L_USER) SharedParametersDialog::_pScintilla->styleChange(); @@ -1665,10 +1729,11 @@ BOOL CALLBACK StylerDlg::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM style._fontStyle |= FONTSTYLE_UNDERLINE; style._nesting = SCE_USER_MASK_NESTING_NONE; - for (int i=0; i::iterator iter = globalMappper().nestingMapper.begin(); + for (; iter != globalMappper().nestingMapper.end(); ++iter) { - if (BST_CHECKED == ::SendMessage(::GetDlgItem(hwnd, nestingMapper[i][0]), BM_GETCHECK, 0, 0)) - style._nesting |= nestingMapper[i][1]; + if (BST_CHECKED == ::SendMessage(::GetDlgItem(hwnd, iter->first), BM_GETCHECK, 0, 0)) + style._nesting |= iter->second; } // show changes to user, re-color document @@ -1677,11 +1742,11 @@ BOOL CALLBACK StylerDlg::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM return TRUE; } - return FALSE; + return FALSE; } - case WM_CLOSE: - { - return TRUE; + case WM_CLOSE: + { + return TRUE; } default : return FALSE; diff --git a/PowerEditor/src/ScitillaComponent/UserDefineDialog.h b/PowerEditor/src/ScitillaComponent/UserDefineDialog.h index f03011ed..f92d2576 100644 --- a/PowerEditor/src/ScitillaComponent/UserDefineDialog.h +++ b/PowerEditor/src/ScitillaComponent/UserDefineDialog.h @@ -61,101 +61,210 @@ struct Style; #define ITALIC_MASK 2 const bool DOCK = true; const bool UNDOCK = false; -const TCHAR keywordListMapper[SCE_USER_KWLIST_TOTAL][32] = { - TEXT("Comments"), // SCE_USER_KWLIST_COMMENTS - TEXT("Numbers, additional"), // SCE_USER_KWLIST_NUMBER_EXTRA - TEXT("Numbers, prefixes"), // SCE_USER_KWLIST_NUMBER_PREFIX - TEXT("Numbers, extras with prefixes"), // SCE_USER_KWLIST_NUMBER_EXTRAPREF - TEXT("Numbers, suffixes"), // SCE_USER_KWLIST_NUMBER_SUFFIX - TEXT("Operators1"), // SCE_USER_KWLIST_OPERATORS1 - TEXT("Operators2"), // SCE_USER_KWLIST_OPERATORS2 - TEXT("Folders in code1, open"), // SCE_USER_KWLIST_FOLDERS_IN_CODE1_OPEN - TEXT("Folders in code1, middle"), // SCE_USER_KWLIST_FOLDERS_IN_CODE1_MIDDLE - TEXT("Folders in code1, close"), // SCE_USER_KWLIST_FOLDERS_IN_CODE1_CLOSE - TEXT("Folders in code2, open"), // SCE_USER_KWLIST_FOLDERS_IN_CODE2_OPEN - TEXT("Folders in code2, middle"), // SCE_USER_KWLIST_FOLDERS_IN_CODE2_MIDDLE - TEXT("Folders in code2, close"), // SCE_USER_KWLIST_FOLDERS_IN_CODE2_CLOSE - TEXT("Folders in comment, open"), // SCE_USER_KWLIST_FOLDERS_IN_COMMENT_OPEN - TEXT("Folders in comment, middle"), // SCE_USER_KWLIST_FOLDERS_IN_COMMENT_MIDDLE - TEXT("Folders in comment, close"), // SCE_USER_KWLIST_FOLDERS_IN_COMMENT_CLOSE - TEXT("Keywords1"), // SCE_USER_KWLIST_KEYWORDS1 - TEXT("Keywords2"), // SCE_USER_KWLIST_KEYWORDS2 - TEXT("Keywords3"), // SCE_USER_KWLIST_KEYWORDS3 - TEXT("Keywords4"), // SCE_USER_KWLIST_KEYWORDS4 - TEXT("Keywords5"), // SCE_USER_KWLIST_KEYWORDS5 - TEXT("Keywords6"), // SCE_USER_KWLIST_KEYWORDS6 - TEXT("Keywords7"), // SCE_USER_KWLIST_KEYWORDS7 - TEXT("Keywords8"), // SCE_USER_KWLIST_KEYWORDS8 - TEXT("Delimiters") // SCE_USER_KWLIST_DELIMITERS -}; -const TCHAR styleNameMapper[SCE_USER_STYLE_TOTAL_STYLES][32] = { - TEXT("DEFAULT"), // 0 SCE_USER_STYLE_DEFAULT - TEXT("COMMENTS"), // 1 SCE_USER_STYLE_COMMENT - TEXT("LINE COMMENTS"), // 2 SCE_USER_STYLE_COMMENTLINE - TEXT("NUMBERS"), // 3 SCE_USER_STYLE_NUMBER - TEXT("KEYWORDS1"), // 4 SCE_USER_STYLE_KEYWORD1 - TEXT("KEYWORDS2"), // 5 SCE_USER_STYLE_KEYWORD2 - TEXT("KEYWORDS3"), // 6 SCE_USER_STYLE_KEYWORD3 - TEXT("KEYWORDS4"), // 7 SCE_USER_STYLE_KEYWORD4 - TEXT("KEYWORDS5"), // 8 SCE_USER_STYLE_KEYWORD5 - TEXT("KEYWORDS6"), // 9 SCE_USER_STYLE_KEYWORD6 - TEXT("KEYWORDS7"), // 10 SCE_USER_STYLE_KEYWORD7 - TEXT("KEYWORDS8"), // 11 SCE_USER_STYLE_KEYWORD8 - TEXT("OPERATORS"), // 12 SCE_USER_STYLE_OPERATOR - TEXT("FOLDER IN CODE1"), // 13 SCE_USER_STYLE_FOLDER_IN_CODE1 - TEXT("FOLDER IN CODE2"), // 14 SCE_USER_STYLE_FOLDER_IN_CODE2 - TEXT("FOLDER IN COMMENT"), // 15 SCE_USER_STYLE_FOLDER_IN_COMMENT - TEXT("DELIMITERS1"), // 16 SCE_USER_STYLE_DELIMITER1 - TEXT("DELIMITERS2"), // 17 SCE_USER_STYLE_DELIMITER2 - TEXT("DELIMITERS3"), // 18 SCE_USER_STYLE_DELIMITER3 - TEXT("DELIMITERS4"), // 19 SCE_USER_STYLE_DELIMITER4 - TEXT("DELIMITERS5"), // 20 SCE_USER_STYLE_DELIMITER5 - TEXT("DELIMITERS6"), // 21 SCE_USER_STYLE_DELIMITER6 - TEXT("DELIMITERS7"), // 22 SCE_USER_STYLE_DELIMITER7 - TEXT("DELIMITERS8") // 23 SCE_USER_STYLE_DELIMITER8 -}; -const int styleIdMApper[SCE_USER_STYLE_MAPPER_TOTAL] = { // mapping sytle ID's between UDL 1.0 and UDL 2.0 - -1, // -1 stands for: not used // 0 - SCE_USER_STYLE_COMMENT, // 1 - SCE_USER_STYLE_COMMENTLINE, // 2 - -1, // 3 - SCE_USER_STYLE_NUMBER, // 4 - SCE_USER_STYLE_KEYWORD1, // 5 - SCE_USER_STYLE_KEYWORD2, // 6 - SCE_USER_STYLE_KEYWORD3, // 7 - SCE_USER_STYLE_KEYWORD4, // 8 - -1, // 9 - SCE_USER_STYLE_OPERATOR, // 10 - SCE_USER_STYLE_DEFAULT, // 11 - SCE_USER_STYLE_FOLDER_IN_CODE1, // 12 - -1, // 13 - SCE_USER_STYLE_DELIMITER1, // 14 - SCE_USER_STYLE_DELIMITER2, // 15 - SCE_USER_STYLE_DELIMITER3, // 16 -}; -const int nestingMapper[][2] = { - { IDC_STYLER_CHECK_NESTING_DELIMITER1, SCE_USER_MASK_NESTING_DELIMITER1 }, - { IDC_STYLER_CHECK_NESTING_DELIMITER2, SCE_USER_MASK_NESTING_DELIMITER2 }, - { IDC_STYLER_CHECK_NESTING_DELIMITER3, SCE_USER_MASK_NESTING_DELIMITER3 }, - { IDC_STYLER_CHECK_NESTING_DELIMITER4, SCE_USER_MASK_NESTING_DELIMITER4 }, - { IDC_STYLER_CHECK_NESTING_DELIMITER5, SCE_USER_MASK_NESTING_DELIMITER5 }, - { IDC_STYLER_CHECK_NESTING_DELIMITER6, SCE_USER_MASK_NESTING_DELIMITER6 }, - { IDC_STYLER_CHECK_NESTING_DELIMITER7, SCE_USER_MASK_NESTING_DELIMITER7 }, - { IDC_STYLER_CHECK_NESTING_DELIMITER8, SCE_USER_MASK_NESTING_DELIMITER8 }, - { IDC_STYLER_CHECK_NESTING_COMMENT, SCE_USER_MASK_NESTING_COMMENT }, - { IDC_STYLER_CHECK_NESTING_COMMENT_LINE, SCE_USER_MASK_NESTING_COMMENT_LINE }, - { IDC_STYLER_CHECK_NESTING_KEYWORD1, SCE_USER_MASK_NESTING_KEYWORD1 }, - { IDC_STYLER_CHECK_NESTING_KEYWORD2, SCE_USER_MASK_NESTING_KEYWORD2 }, - { IDC_STYLER_CHECK_NESTING_KEYWORD3, SCE_USER_MASK_NESTING_KEYWORD3 }, - { IDC_STYLER_CHECK_NESTING_KEYWORD4, SCE_USER_MASK_NESTING_KEYWORD4 }, - { IDC_STYLER_CHECK_NESTING_KEYWORD5, SCE_USER_MASK_NESTING_KEYWORD5 }, - { IDC_STYLER_CHECK_NESTING_KEYWORD6, SCE_USER_MASK_NESTING_KEYWORD6 }, - { IDC_STYLER_CHECK_NESTING_KEYWORD7, SCE_USER_MASK_NESTING_KEYWORD7 }, - { IDC_STYLER_CHECK_NESTING_KEYWORD8, SCE_USER_MASK_NESTING_KEYWORD8 }, - { IDC_STYLER_CHECK_NESTING_OPERATORS1, SCE_USER_MASK_NESTING_OPERATORS1 }, - { IDC_STYLER_CHECK_NESTING_OPERATORS2, SCE_USER_MASK_NESTING_OPERATORS2 }, - { IDC_STYLER_CHECK_NESTING_NUMBERS, SCE_USER_MASK_NESTING_NUMBERS } + +class GlobalMappers +{ + public: + + map keywordIdMapper; + map keywordNameMapper; + + map styleIdMapper; + map styleNameMapper; + + map temp; + map::iterator iter; + + map nestingMapper; + map dialogMapper; + map setLexerMapper; + + // only default constructor is needed + GlobalMappers() + { + // pre 2.0 + temp[TEXT("Operators")] = SCE_USER_KWLIST_OPERATORS1; + temp[TEXT("Folder+")] = SCE_USER_KWLIST_FOLDERS_IN_CODE1_OPEN; + temp[TEXT("Folder-")] = SCE_USER_KWLIST_FOLDERS_IN_CODE1_CLOSE; + temp[TEXT("Words1")] = SCE_USER_KWLIST_KEYWORDS1; + temp[TEXT("Words2")] = SCE_USER_KWLIST_KEYWORDS2; + temp[TEXT("Words3")] = SCE_USER_KWLIST_KEYWORDS3; + temp[TEXT("Words4")] = SCE_USER_KWLIST_KEYWORDS4; + + // in case of duplicate entries, newer string should overwrite old one ! + for (iter = temp.begin(); iter != temp.end(); ++iter) + keywordNameMapper[iter->second] = iter->first; + keywordIdMapper.insert(temp.begin(), temp.end()); + temp.clear(); + + // 2.0 + temp[TEXT("Comments")] = SCE_USER_KWLIST_COMMENTS; + temp[TEXT("Numbers, additional")] = SCE_USER_KWLIST_NUMBER_RANGE; + temp[TEXT("Numbers, prefixes")] = SCE_USER_KWLIST_NUMBER_PREFIX1; + temp[TEXT("Numbers, extras with prefixes")] = SCE_USER_KWLIST_NUMBER_RANGE; + temp[TEXT("Numbers, suffixes")] = SCE_USER_KWLIST_NUMBER_SUFFIX1; + temp[TEXT("Operators1")] = SCE_USER_KWLIST_OPERATORS1; + temp[TEXT("Operators2")] = SCE_USER_KWLIST_OPERATORS2; + temp[TEXT("Folders in code1, open")] = SCE_USER_KWLIST_FOLDERS_IN_CODE1_OPEN; + temp[TEXT("Folders in code1, middle")] = SCE_USER_KWLIST_FOLDERS_IN_CODE1_MIDDLE; + temp[TEXT("Folders in code1, close")] = SCE_USER_KWLIST_FOLDERS_IN_CODE1_CLOSE; + temp[TEXT("Folders in code2, open")] = SCE_USER_KWLIST_FOLDERS_IN_CODE2_OPEN; + temp[TEXT("Folders in code2, middle")] = SCE_USER_KWLIST_FOLDERS_IN_CODE2_MIDDLE; + temp[TEXT("Folders in code2, close")] = SCE_USER_KWLIST_FOLDERS_IN_CODE2_CLOSE; + temp[TEXT("Folders in comment, open")] = SCE_USER_KWLIST_FOLDERS_IN_COMMENT_OPEN; + temp[TEXT("Folders in comment, middle")] = SCE_USER_KWLIST_FOLDERS_IN_COMMENT_MIDDLE; + temp[TEXT("Folders in comment, close")] = SCE_USER_KWLIST_FOLDERS_IN_COMMENT_CLOSE; + temp[TEXT("Keywords1")] = SCE_USER_KWLIST_KEYWORDS1; + temp[TEXT("Keywords2")] = SCE_USER_KWLIST_KEYWORDS2; + temp[TEXT("Keywords3")] = SCE_USER_KWLIST_KEYWORDS3; + temp[TEXT("Keywords4")] = SCE_USER_KWLIST_KEYWORDS4; + temp[TEXT("Keywords5")] = SCE_USER_KWLIST_KEYWORDS5; + temp[TEXT("Keywords6")] = SCE_USER_KWLIST_KEYWORDS6; + temp[TEXT("Keywords7")] = SCE_USER_KWLIST_KEYWORDS7; + temp[TEXT("Keywords8")] = SCE_USER_KWLIST_KEYWORDS8; + temp[TEXT("Delimiters")] = SCE_USER_KWLIST_DELIMITERS; + + // in case of duplicate entries, newer string should overwrite old one ! + for (iter = temp.begin(); iter != temp.end(); ++iter) + keywordNameMapper[iter->second] = iter->first; + keywordIdMapper.insert(temp.begin(), temp.end()); + temp.clear(); + + // 2.1 + temp[TEXT("Numbers, prefix1")] = SCE_USER_KWLIST_NUMBER_PREFIX1; + temp[TEXT("Numbers, prefix2")] = SCE_USER_KWLIST_NUMBER_PREFIX2; + temp[TEXT("Numbers, extras1")] = SCE_USER_KWLIST_NUMBER_EXTRAS1; + temp[TEXT("Numbers, extras2")] = SCE_USER_KWLIST_NUMBER_EXTRAS2; + temp[TEXT("Numbers, suffix1")] = SCE_USER_KWLIST_NUMBER_SUFFIX1; + temp[TEXT("Numbers, suffix2")] = SCE_USER_KWLIST_NUMBER_SUFFIX2; + temp[TEXT("Numbers, range")] = SCE_USER_KWLIST_NUMBER_RANGE; + + // in case of duplicate entries, newer string should overwrite old one ! + for (iter = temp.begin(); iter != temp.end(); ++iter) + keywordNameMapper[iter->second] = iter->first; + keywordIdMapper.insert(temp.begin(), temp.end()); + temp.clear(); + + // pre 2.0 + temp[TEXT("FOLDEROPEN")] = SCE_USER_STYLE_FOLDER_IN_CODE1; + temp[TEXT("FOLDERCLOSE")] = SCE_USER_STYLE_FOLDER_IN_CODE1; + temp[TEXT("KEYWORD1")] = SCE_USER_STYLE_KEYWORD1; + temp[TEXT("KEYWORD2")] = SCE_USER_STYLE_KEYWORD2; + temp[TEXT("KEYWORD3")] = SCE_USER_STYLE_KEYWORD3; + temp[TEXT("KEYWORD4")] = SCE_USER_STYLE_KEYWORD4; + temp[TEXT("COMMENT")] = SCE_USER_STYLE_COMMENT; + temp[TEXT("COMMENT LINE")] = SCE_USER_STYLE_COMMENTLINE; + temp[TEXT("NUMBER")] = SCE_USER_STYLE_NUMBER; + temp[TEXT("OPERATOR")] = SCE_USER_STYLE_OPERATOR; + temp[TEXT("DELIMINER1")] = SCE_USER_STYLE_DELIMITER1; + temp[TEXT("DELIMINER2")] = SCE_USER_STYLE_DELIMITER2; + temp[TEXT("DELIMINER3")] = SCE_USER_STYLE_DELIMITER3; + + // in case of duplicate entries, newer string should overwrite old one ! + for (iter = temp.begin(); iter != temp.end(); ++iter) + styleNameMapper[iter->second] = iter->first; + styleIdMapper.insert(temp.begin(), temp.end()); + temp.clear(); + + // post 2.0 + temp[TEXT("DEFAULT")] = SCE_USER_STYLE_DEFAULT; + temp[TEXT("COMMENTS")] = SCE_USER_STYLE_COMMENT; + temp[TEXT("LINE COMMENTS")] = SCE_USER_STYLE_COMMENTLINE; + temp[TEXT("NUMBERS")] = SCE_USER_STYLE_NUMBER; + temp[TEXT("KEYWORDS1")] = SCE_USER_STYLE_KEYWORD1; + temp[TEXT("KEYWORDS2")] = SCE_USER_STYLE_KEYWORD2; + temp[TEXT("KEYWORDS3")] = SCE_USER_STYLE_KEYWORD3; + temp[TEXT("KEYWORDS4")] = SCE_USER_STYLE_KEYWORD4; + temp[TEXT("KEYWORDS5")] = SCE_USER_STYLE_KEYWORD5; + temp[TEXT("KEYWORDS6")] = SCE_USER_STYLE_KEYWORD6; + temp[TEXT("KEYWORDS7")] = SCE_USER_STYLE_KEYWORD7; + temp[TEXT("KEYWORDS8")] = SCE_USER_STYLE_KEYWORD8; + temp[TEXT("OPERATORS")] = SCE_USER_STYLE_OPERATOR; + temp[TEXT("FOLDER IN CODE1")] = SCE_USER_STYLE_FOLDER_IN_CODE1; + temp[TEXT("FOLDER IN CODE2")] = SCE_USER_STYLE_FOLDER_IN_CODE2; + temp[TEXT("FOLDER IN COMMENT")] = SCE_USER_STYLE_FOLDER_IN_COMMENT; + temp[TEXT("DELIMITERS1")] = SCE_USER_STYLE_DELIMITER1; + temp[TEXT("DELIMITERS2")] = SCE_USER_STYLE_DELIMITER2; + temp[TEXT("DELIMITERS3")] = SCE_USER_STYLE_DELIMITER3; + temp[TEXT("DELIMITERS4")] = SCE_USER_STYLE_DELIMITER4; + temp[TEXT("DELIMITERS5")] = SCE_USER_STYLE_DELIMITER5; + temp[TEXT("DELIMITERS6")] = SCE_USER_STYLE_DELIMITER6; + temp[TEXT("DELIMITERS7")] = SCE_USER_STYLE_DELIMITER7; + temp[TEXT("DELIMITERS8")] = SCE_USER_STYLE_DELIMITER8; + + // in case of duplicate entries, newer string should overwrite old one ! + for (iter = temp.begin(); iter != temp.end(); ++iter) + styleNameMapper[iter->second] = iter->first; + styleIdMapper.insert(temp.begin(), temp.end()); + temp.clear(); + + nestingMapper[IDC_STYLER_CHECK_NESTING_DELIMITER1] = SCE_USER_MASK_NESTING_DELIMITER1; + nestingMapper[IDC_STYLER_CHECK_NESTING_DELIMITER2] = SCE_USER_MASK_NESTING_DELIMITER2; + nestingMapper[IDC_STYLER_CHECK_NESTING_DELIMITER3] = SCE_USER_MASK_NESTING_DELIMITER3; + nestingMapper[IDC_STYLER_CHECK_NESTING_DELIMITER4] = SCE_USER_MASK_NESTING_DELIMITER4; + nestingMapper[IDC_STYLER_CHECK_NESTING_DELIMITER5] = SCE_USER_MASK_NESTING_DELIMITER5; + nestingMapper[IDC_STYLER_CHECK_NESTING_DELIMITER6] = SCE_USER_MASK_NESTING_DELIMITER6; + nestingMapper[IDC_STYLER_CHECK_NESTING_DELIMITER7] = SCE_USER_MASK_NESTING_DELIMITER7; + nestingMapper[IDC_STYLER_CHECK_NESTING_DELIMITER8] = SCE_USER_MASK_NESTING_DELIMITER8; + nestingMapper[IDC_STYLER_CHECK_NESTING_COMMENT] = SCE_USER_MASK_NESTING_COMMENT; + nestingMapper[IDC_STYLER_CHECK_NESTING_COMMENT_LINE] = SCE_USER_MASK_NESTING_COMMENT_LINE; + nestingMapper[IDC_STYLER_CHECK_NESTING_KEYWORD1] = SCE_USER_MASK_NESTING_KEYWORD1; + nestingMapper[IDC_STYLER_CHECK_NESTING_KEYWORD2] = SCE_USER_MASK_NESTING_KEYWORD2; + nestingMapper[IDC_STYLER_CHECK_NESTING_KEYWORD3] = SCE_USER_MASK_NESTING_KEYWORD3; + nestingMapper[IDC_STYLER_CHECK_NESTING_KEYWORD4] = SCE_USER_MASK_NESTING_KEYWORD4; + nestingMapper[IDC_STYLER_CHECK_NESTING_KEYWORD5] = SCE_USER_MASK_NESTING_KEYWORD5; + nestingMapper[IDC_STYLER_CHECK_NESTING_KEYWORD6] = SCE_USER_MASK_NESTING_KEYWORD6; + nestingMapper[IDC_STYLER_CHECK_NESTING_KEYWORD7] = SCE_USER_MASK_NESTING_KEYWORD7; + nestingMapper[IDC_STYLER_CHECK_NESTING_KEYWORD8] = SCE_USER_MASK_NESTING_KEYWORD8; + nestingMapper[IDC_STYLER_CHECK_NESTING_OPERATORS1] = SCE_USER_MASK_NESTING_OPERATORS1; + nestingMapper[IDC_STYLER_CHECK_NESTING_OPERATORS2] = SCE_USER_MASK_NESTING_OPERATORS2; + nestingMapper[IDC_STYLER_CHECK_NESTING_NUMBERS] = SCE_USER_MASK_NESTING_NUMBERS; + + dialogMapper[IDC_NUMBER_PREFIX1_EDIT] = SCE_USER_KWLIST_NUMBER_PREFIX1; + dialogMapper[IDC_NUMBER_PREFIX2_EDIT] = SCE_USER_KWLIST_NUMBER_PREFIX2; + dialogMapper[IDC_NUMBER_EXTRAS1_EDIT] = SCE_USER_KWLIST_NUMBER_EXTRAS1; + dialogMapper[IDC_NUMBER_EXTRAS2_EDIT] = SCE_USER_KWLIST_NUMBER_EXTRAS2; + dialogMapper[IDC_NUMBER_SUFFIX1_EDIT] = SCE_USER_KWLIST_NUMBER_SUFFIX1; + dialogMapper[IDC_NUMBER_SUFFIX2_EDIT] = SCE_USER_KWLIST_NUMBER_SUFFIX2; + dialogMapper[IDC_NUMBER_RANGE_EDIT] = SCE_USER_KWLIST_NUMBER_RANGE; + + dialogMapper[IDC_FOLDER_IN_CODE1_OPEN_EDIT] = SCE_USER_KWLIST_FOLDERS_IN_CODE1_OPEN; + dialogMapper[IDC_FOLDER_IN_CODE1_MIDDLE_EDIT] = SCE_USER_KWLIST_FOLDERS_IN_CODE1_MIDDLE; + dialogMapper[IDC_FOLDER_IN_CODE1_CLOSE_EDIT] = SCE_USER_KWLIST_FOLDERS_IN_CODE1_CLOSE; + dialogMapper[IDC_FOLDER_IN_CODE2_OPEN_EDIT] = SCE_USER_KWLIST_FOLDERS_IN_CODE2_OPEN; + dialogMapper[IDC_FOLDER_IN_CODE2_MIDDLE_EDIT] = SCE_USER_KWLIST_FOLDERS_IN_CODE2_MIDDLE; + dialogMapper[IDC_FOLDER_IN_CODE2_CLOSE_EDIT] = SCE_USER_KWLIST_FOLDERS_IN_CODE2_CLOSE; + dialogMapper[IDC_FOLDER_IN_COMMENT_OPEN_EDIT] = SCE_USER_KWLIST_FOLDERS_IN_COMMENT_OPEN; + dialogMapper[IDC_FOLDER_IN_COMMENT_MIDDLE_EDIT] = SCE_USER_KWLIST_FOLDERS_IN_COMMENT_MIDDLE; + dialogMapper[IDC_FOLDER_IN_COMMENT_CLOSE_EDIT] = SCE_USER_KWLIST_FOLDERS_IN_COMMENT_CLOSE; + + dialogMapper[IDC_KEYWORD1_EDIT] = SCE_USER_KWLIST_KEYWORDS1; + dialogMapper[IDC_KEYWORD2_EDIT] = SCE_USER_KWLIST_KEYWORDS2; + dialogMapper[IDC_KEYWORD3_EDIT] = SCE_USER_KWLIST_KEYWORDS3; + dialogMapper[IDC_KEYWORD4_EDIT] = SCE_USER_KWLIST_KEYWORDS4; + dialogMapper[IDC_KEYWORD5_EDIT] = SCE_USER_KWLIST_KEYWORDS5; + dialogMapper[IDC_KEYWORD6_EDIT] = SCE_USER_KWLIST_KEYWORDS6; + dialogMapper[IDC_KEYWORD7_EDIT] = SCE_USER_KWLIST_KEYWORDS7; + dialogMapper[IDC_KEYWORD8_EDIT] = SCE_USER_KWLIST_KEYWORDS8; + + setLexerMapper[SCE_USER_KWLIST_COMMENTS] = "userDefine.comments"; + setLexerMapper[SCE_USER_KWLIST_DELIMITERS] = "userDefine.delimiters"; + setLexerMapper[SCE_USER_KWLIST_OPERATORS1] = "userDefine.operators1"; + setLexerMapper[SCE_USER_KWLIST_NUMBER_PREFIX1] = "userDefine.numberPrefix1"; + setLexerMapper[SCE_USER_KWLIST_NUMBER_PREFIX2] = "userDefine.numberPrefix2"; + setLexerMapper[SCE_USER_KWLIST_NUMBER_EXTRAS1] = "userDefine.numberExtras1"; + setLexerMapper[SCE_USER_KWLIST_NUMBER_EXTRAS2] = "userDefine.numberExtras2"; + setLexerMapper[SCE_USER_KWLIST_NUMBER_SUFFIX1] = "userDefine.numberSuffix1"; + setLexerMapper[SCE_USER_KWLIST_NUMBER_SUFFIX2] = "userDefine.numberSuffix2"; + setLexerMapper[SCE_USER_KWLIST_NUMBER_RANGE] = "userDefine.numberRange"; + setLexerMapper[SCE_USER_KWLIST_FOLDERS_IN_CODE1_OPEN] = "userDefine.foldersInCode1Open"; + setLexerMapper[SCE_USER_KWLIST_FOLDERS_IN_CODE1_MIDDLE] = "userDefine.foldersInCode1Middle"; + setLexerMapper[SCE_USER_KWLIST_FOLDERS_IN_CODE1_CLOSE] = "userDefine.foldersInCode1Close"; + }; }; + +GlobalMappers & globalMappper(); + class SharedParametersDialog : public StaticDialog { friend class StylerDlg; diff --git a/PowerEditor/src/ScitillaComponent/UserDefineDialog.rc b/PowerEditor/src/ScitillaComponent/UserDefineDialog.rc index ae68b1c7..dbfd504c 100644 --- a/PowerEditor/src/ScitillaComponent/UserDefineDialog.rc +++ b/PowerEditor/src/ScitillaComponent/UserDefineDialog.rc @@ -148,70 +148,83 @@ IDD_KEYWORD_STYLE_DLG DIALOGEX 36, 44, 337, 470 STYLE DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | WS_CHILD FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - EDITTEXT IDC_KEYWORD1_EDIT,19,46,138,69,ES_MULTILINE | WS_VSCROLL | ES_WANTRETURN + EDITTEXT IDC_KEYWORD1_EDIT,19,46,138,69,ES_MULTILINE | ES_WANTRETURN | WS_VSCROLL GROUPBOX "1st group",IDC_KEYWORD1_DESCGROUP_STATIC,9,17,155,104,BS_CENTER PUSHBUTTON "Styler",IDC_KEYWORD1_STYLER,18,29,53,13 CONTROL "Prefix mode",IDC_KEYWORD1_PREFIX_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,33,68,13 - EDITTEXT IDC_KEYWORD2_EDIT,181,46,138,69,ES_MULTILINE | WS_VSCROLL | ES_WANTRETURN + EDITTEXT IDC_KEYWORD2_EDIT,181,46,138,69,ES_MULTILINE | ES_WANTRETURN | WS_VSCROLL GROUPBOX "2nd group",IDC_KEYWORD2_DESCGROUP_STATIC,171,17,155,104,BS_CENTER PUSHBUTTON "Styler",IDC_KEYWORD2_STYLER,179,28,53,13 CONTROL "Prefix mode",IDC_KEYWORD2_PREFIX_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,251,33,68,13 - EDITTEXT IDC_KEYWORD3_EDIT,20,154,138,69,ES_MULTILINE | WS_VSCROLL | ES_WANTRETURN + EDITTEXT IDC_KEYWORD3_EDIT,20,154,138,69,ES_MULTILINE | ES_WANTRETURN | WS_VSCROLL GROUPBOX "3rd group",IDC_KEYWORD3_DESCGROUP_STATIC,10,125,155,104,BS_CENTER PUSHBUTTON "Styler",IDC_KEYWORD3_STYLER,18,136,53,13 CONTROL "Prefix mode",IDC_KEYWORD3_PREFIX_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,141,68,13 - EDITTEXT IDC_KEYWORD4_EDIT,181,154,138,69,ES_MULTILINE | WS_VSCROLL | ES_WANTRETURN + EDITTEXT IDC_KEYWORD4_EDIT,181,154,138,69,ES_MULTILINE | ES_WANTRETURN | WS_VSCROLL GROUPBOX "4th group",IDC_KEYWORD4_DESCGROUP_STATIC,171,125,155,104,BS_CENTER PUSHBUTTON "Styler",IDC_KEYWORD4_STYLER,179,136,53,13 CONTROL "Prefix mode",IDC_KEYWORD4_PREFIX_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,251,141,68,13 - EDITTEXT IDC_KEYWORD5_EDIT,20,263,138,69,ES_MULTILINE | WS_VSCROLL | ES_WANTRETURN + EDITTEXT IDC_KEYWORD5_EDIT,20,263,138,69,ES_MULTILINE | ES_WANTRETURN | WS_VSCROLL GROUPBOX "5th group",IDC_KEYWORD5_DESCGROUP_STATIC,10,234,155,104,BS_CENTER PUSHBUTTON "Styler",IDC_KEYWORD5_STYLER,18,245,53,13 CONTROL "Prefix mode",IDC_KEYWORD5_PREFIX_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,250,68,13 - EDITTEXT IDC_KEYWORD6_EDIT,181,263,138,69,ES_MULTILINE | WS_VSCROLL | ES_WANTRETURN + EDITTEXT IDC_KEYWORD6_EDIT,181,263,138,69,ES_MULTILINE | ES_WANTRETURN | WS_VSCROLL GROUPBOX "6th group",IDC_KEYWORD6_DESCGROUP_STATIC,171,234,155,104,BS_CENTER PUSHBUTTON "Styler",IDC_KEYWORD6_STYLER,179,245,53,13 CONTROL "Prefix mode",IDC_KEYWORD6_PREFIX_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,251,250,68,13 - EDITTEXT IDC_KEYWORD7_EDIT,20,373,138,69,ES_MULTILINE | WS_VSCROLL | ES_WANTRETURN + EDITTEXT IDC_KEYWORD7_EDIT,20,373,138,69,ES_MULTILINE | ES_WANTRETURN | WS_VSCROLL GROUPBOX "7th group",IDC_KEYWORD7_DESCGROUP_STATIC,10,344,155,104,BS_CENTER PUSHBUTTON "Styler",IDC_KEYWORD7_STYLER,18,355,53,13 CONTROL "Prefix mode",IDC_KEYWORD7_PREFIX_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,359,72,13 - EDITTEXT IDC_KEYWORD8_EDIT,181,373,138,69,ES_MULTILINE | WS_VSCROLL | ES_WANTRETURN + EDITTEXT IDC_KEYWORD8_EDIT,181,373,138,69,ES_MULTILINE | ES_WANTRETURN | WS_VSCROLL GROUPBOX "8th group",IDC_KEYWORD8_DESCGROUP_STATIC,171,344,155,104,BS_CENTER PUSHBUTTON "Styler",IDC_KEYWORD8_STYLER,179,355,53,13 CONTROL "Prefix mode",IDC_KEYWORD8_PREFIX_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,251,359,72,13 END -IDD_COMMENT_STYLE_DLG DIALOGEX 36, 44, 337, 400 +IDD_COMMENT_STYLE_DLG DIALOGEX 36, 44, 337, 472 STYLE DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | WS_CHILD FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - CONTROL "Allow folding of comments",IDC_FOLDING_OF_COMMENTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,11,206,14 - CONTROL "Force line comments at beginning of line",IDC_FORCE_LINE_COMMENTS_AT_BOL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,30,206,14 - EDITTEXT IDC_COMMENTLINE_OPEN_EDIT,20,105,138,12,ES_MULTILINE | WS_VSCROLL - EDITTEXT IDC_COMMENTLINE_CONTINUE_EDIT,20,131,138,12,ES_MULTILINE | WS_VSCROLL - EDITTEXT IDC_COMMENTLINE_CLOSE_EDIT,20,155,138,12,ES_MULTILINE | WS_VSCROLL - PUSHBUTTON "Styler",IDC_COMMENTLINE_STYLER,22,72,54,13 - LTEXT "Open",IDC_COMMENTLINE_OPEN_STATIC,20,95,138,9 - LTEXT "Continue character",IDC_COMMENTLINE_CONTINUE_STATIC,20,121,138,9 - LTEXT "Close",IDC_COMMENTLINE_CLOSE_STATIC,20,145,138,9 - GROUPBOX "Comment line style",IDC_COMMENTLINE_DESCGROUP_STATIC,10,58,155,119,BS_CENTER - EDITTEXT IDC_COMMENT_OPEN_EDIT,182,117,138,12,ES_MULTILINE | WS_VSCROLL - EDITTEXT IDC_COMMENT_CLOSE_EDIT,182,145,138,12,ES_MULTILINE | WS_VSCROLL - PUSHBUTTON "Styler",IDC_COMMENT_STYLER,184,77,54,13 - LTEXT "Open",IDC_COMMENT_OPEN_STATIC,182,107,138,9 - LTEXT "Close",IDC_COMMENT_CLOSE_STATIC,182,136,138,9 - GROUPBOX "Comment style",IDC_COMMENT_DESCGROUP_STATIC,172,58,155,119,BS_CENTER - GROUPBOX "Number style",IDC_NUMBER_DESCGROUP_STATIC,10,190,155,159,BS_CENTER - EDITTEXT IDC_NUMBER_PREFIX_EDIT,20,243,138,12,ES_MULTILINE | WS_VSCROLL - EDITTEXT IDC_NUMBER_EXTRAPREF_EDIT,20,271,138,12,ES_MULTILINE | WS_VSCROLL - EDITTEXT IDC_NUMBER_SUFFIX_EDIT,20,300,138,12,ES_MULTILINE | WS_VSCROLL - EDITTEXT IDC_NUMBER_EXTRA_EDIT,20,328,138,12,ES_MULTILINE | WS_VSCROLL - PUSHBUTTON "Styler",IDC_NUMBER_STYLER,24,205,54,13 - LTEXT "Number prefixes (hex, octal, ...) :",IDC_NUMBER_PREFIX_STATIC,20,233,138,13 - LTEXT "Extra characters in numbers with a prefix : ",IDC_NUMBER_EXTRAPREF_STATIC,20,261,138,13 - LTEXT "Optional suffixes for numbers : ",IDC_NUMBER_SUFFIX_STATIC,20,290,138,13 - LTEXT "Range symbols : ",IDC_NUMBER_EXTRA_STATIC,20,318,138,13 + GROUPBOX "Line comment position",IDC_COMMENTLINE_POSITION_STATIC,11,18,156,57 + CONTROL "Allow folding of comments",IDC_FOLDING_OF_COMMENTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,188,25,131,8 + CONTROL "Allow anywhere",IDC_ALLOW_ANYWHERE,"Button",BS_AUTORADIOBUTTON | WS_GROUP,33,33,121,8 + CONTROL "Force at beginning of line",IDC_FORCE_AT_BOL,"Button",BS_AUTORADIOBUTTON,33,45,121,8 + CONTROL "Allow preceeding whitespace",IDC_ALLOW_WHITESPACE,"Button",BS_AUTORADIOBUTTON,33,57,121,8 + EDITTEXT IDC_COMMENTLINE_OPEN_EDIT,20,136,138,12,ES_MULTILINE | WS_VSCROLL + EDITTEXT IDC_COMMENTLINE_CONTINUE_EDIT,20,164,138,12,ES_MULTILINE | WS_VSCROLL + EDITTEXT IDC_COMMENTLINE_CLOSE_EDIT,20,189,138,12,ES_MULTILINE | WS_VSCROLL + PUSHBUTTON "Styler",IDC_COMMENTLINE_STYLER,22,104,54,13 + LTEXT "Open",IDC_COMMENTLINE_OPEN_STATIC,20,126,138,9 + LTEXT "Continue character",IDC_COMMENTLINE_CONTINUE_STATIC,20,152,138,9 + LTEXT "Close",IDC_COMMENTLINE_CLOSE_STATIC,20,178,138,9 + GROUPBOX "Comment line style",IDC_COMMENTLINE_DESCGROUP_STATIC,10,90,155,119,BS_CENTER + EDITTEXT IDC_COMMENT_OPEN_EDIT,182,149,138,12,ES_MULTILINE | WS_VSCROLL + EDITTEXT IDC_COMMENT_CLOSE_EDIT,182,177,138,12,ES_MULTILINE | WS_VSCROLL + PUSHBUTTON "Styler",IDC_COMMENT_STYLER,184,109,54,13 + LTEXT "Open",IDC_COMMENT_OPEN_STATIC,182,139,138,9 + LTEXT "Close",IDC_COMMENT_CLOSE_STATIC,182,168,138,9 + GROUPBOX "Comment style",IDC_COMMENT_DESCGROUP_STATIC,172,90,155,119,BS_CENTER + GROUPBOX "Number style",IDC_NUMBER_DESCGROUP_STATIC,10,222,317,239,BS_CENTER + PUSHBUTTON "Styler",IDC_NUMBER_STYLER,24,237,54,13 + RTEXT "Prefix 1:",IDC_NUMBER_PREFIX1_STATIC,12,264,45,13 + RTEXT "Prefix 2:",IDC_NUMBER_PREFIX2_STATIC,12,291,45,13 + RTEXT "Extras 1:",IDC_NUMBER_EXTRAS1_STATIC,12,318,45,13 + RTEXT "Extras 2:",IDC_NUMBER_EXTRAS2_STATIC,12,345,45,13 + RTEXT "Suffix 1:",IDC_NUMBER_SUFFIX1_STATIC,12,372,45,13 + RTEXT "Suffix 2:",IDC_NUMBER_SUFFIX2_STATIC,12,399,45,13 + RTEXT "Range : ",IDC_NUMBER_RANGE_STATIC,12,426,45,13 + EDITTEXT IDC_NUMBER_PREFIX1_EDIT,63,264,136,21,ES_MULTILINE | WS_VSCROLL + EDITTEXT IDC_NUMBER_PREFIX2_EDIT,63,291,136,21,ES_MULTILINE | WS_VSCROLL + EDITTEXT IDC_NUMBER_EXTRAS1_EDIT,63,318,136,21,ES_MULTILINE | WS_VSCROLL + EDITTEXT IDC_NUMBER_EXTRAS2_EDIT,63,345,136,21,ES_MULTILINE | WS_VSCROLL + EDITTEXT IDC_NUMBER_SUFFIX1_EDIT,63,372,136,21,ES_MULTILINE | WS_VSCROLL + EDITTEXT IDC_NUMBER_SUFFIX2_EDIT,63,399,136,21,ES_MULTILINE | WS_VSCROLL + EDITTEXT IDC_NUMBER_RANGE_EDIT,63,426,136,21,ES_MULTILINE | WS_VSCROLL + GROUPBOX "Decimal separator",IDC_DECIMAL_SEPARATOR_STATIC,221,259,85,66 + CONTROL "Dot",IDC_DOT_RADIO,"Button",BS_AUTORADIOBUTTON | WS_GROUP,242,278,59,8 + CONTROL "Comma",IDC_COMMA_RADIO,"Button",BS_AUTORADIOBUTTON,242,292,59,8 + CONTROL "Both",IDC_BOTH_RADIO,"Button",BS_AUTORADIOBUTTON,242,306,59,8 END IDD_GLOBAL_USERDEFINE_DLG DIALOGEX 36, 44, 365, 670 @@ -287,5 +300,5 @@ BEGIN CONTROL "Operators 2",IDC_STYLER_CHECK_NESTING_OPERATORS2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,209,183,76,13 CONTROL "Numbers",IDC_STYLER_CHECK_NESTING_NUMBERS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,209,200,76,13 END - + #endif //USERDEFINEDIALOG_RC diff --git a/PowerEditor/src/ScitillaComponent/UserDefineResource.h b/PowerEditor/src/ScitillaComponent/UserDefineResource.h index 2bb0b82a..01283a2f 100644 --- a/PowerEditor/src/ScitillaComponent/UserDefineResource.h +++ b/PowerEditor/src/ScitillaComponent/UserDefineResource.h @@ -136,11 +136,12 @@ #define IDC_KEYWORD8_PREFIX_CHECK (IDC_KEYWORD8 + 21) #define IDC_KEYWORD8_STYLER (IDC_KEYWORD8 + 22) - // #define IDC_KEYWORD_SCROLLBAR (IDD_KEYWORD_STYLE_DLG + 500) - #define IDD_COMMENT_STYLE_DLG 23000 //(IDD_GLOBAL_USERDEFINE_DLG + 3000) - #define IDC_FOLDING_OF_COMMENTS (IDD_COMMENT_STYLE_DLG + 1) - #define IDC_FORCE_LINE_COMMENTS_AT_BOL (IDD_COMMENT_STYLE_DLG + 2) + #define IDC_FOLDING_OF_COMMENTS (IDD_COMMENT_STYLE_DLG + 1) + #define IDC_COMMENTLINE_POSITION_STATIC (IDD_COMMENT_STYLE_DLG + 3) + #define IDC_ALLOW_ANYWHERE (IDD_COMMENT_STYLE_DLG + 4) + #define IDC_FORCE_AT_BOL (IDD_COMMENT_STYLE_DLG + 5) + #define IDC_ALLOW_WHITESPACE (IDD_COMMENT_STYLE_DLG + 6) #define IDC_COMMENT (IDD_COMMENT_STYLE_DLG + 100) #define IDC_COMMENT_DESCGROUP_STATIC (IDC_COMMENT + 1 ) @@ -153,14 +154,24 @@ #define IDC_NUMBER (IDD_COMMENT_STYLE_DLG + 200) #define IDC_NUMBER_DESCGROUP_STATIC (IDC_NUMBER + 1 ) #define IDC_NUMBER_STYLER (IDC_NUMBER + 20) - #define IDC_NUMBER_PREFIX_STATIC (IDC_NUMBER + 21) - #define IDC_NUMBER_PREFIX_EDIT (IDC_NUMBER + 22) - #define IDC_NUMBER_EXTRA_STATIC (IDC_NUMBER + 23) - #define IDC_NUMBER_EXTRA_EDIT (IDC_NUMBER + 24) - #define IDC_NUMBER_SUFFIX_STATIC (IDC_NUMBER + 25) - #define IDC_NUMBER_SUFFIX_EDIT (IDC_NUMBER + 26) - #define IDC_NUMBER_EXTRAPREF_STATIC (IDC_NUMBER + 27) - #define IDC_NUMBER_EXTRAPREF_EDIT (IDC_NUMBER + 28) + #define IDC_NUMBER_PREFIX1_STATIC (IDC_NUMBER + 30) + #define IDC_NUMBER_PREFIX1_EDIT (IDC_NUMBER + 31) + #define IDC_NUMBER_PREFIX2_STATIC (IDC_NUMBER + 32) + #define IDC_NUMBER_PREFIX2_EDIT (IDC_NUMBER + 33) + #define IDC_NUMBER_EXTRAS1_STATIC (IDC_NUMBER + 34) + #define IDC_NUMBER_EXTRAS1_EDIT (IDC_NUMBER + 35) + #define IDC_NUMBER_EXTRAS2_STATIC (IDC_NUMBER + 36) + #define IDC_NUMBER_EXTRAS2_EDIT (IDC_NUMBER + 37) + #define IDC_NUMBER_SUFFIX1_STATIC (IDC_NUMBER + 38) + #define IDC_NUMBER_SUFFIX1_EDIT (IDC_NUMBER + 39) + #define IDC_NUMBER_SUFFIX2_STATIC (IDC_NUMBER + 40) + #define IDC_NUMBER_SUFFIX2_EDIT (IDC_NUMBER + 41) + #define IDC_NUMBER_RANGE_STATIC (IDC_NUMBER + 42) + #define IDC_NUMBER_RANGE_EDIT (IDC_NUMBER + 43) + #define IDC_DECIMAL_SEPARATOR_STATIC (IDC_NUMBER + 44) + #define IDC_DOT_RADIO (IDC_NUMBER + 45) + #define IDC_COMMA_RADIO (IDC_NUMBER + 46) + #define IDC_BOTH_RADIO (IDC_NUMBER + 47) #define IDC_COMMENTLINE (IDD_COMMENT_STYLE_DLG + 300) #define IDC_COMMENTLINE_DESCGROUP_STATIC (IDC_COMMENTLINE + 1 ) diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp index 871a7ed2..2dd6ca7c 100644 --- a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp +++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp @@ -881,6 +881,7 @@ BOOL CALLBACK SettingsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM) ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_SMARTHILITECASESENSITIVE), nppGUI._enableSmartHilite); return TRUE; } + case IDC_CHECK_SMARTHILITECASESENSITIVE: { nppGUI._smartHiliteCaseSensitive = !nppGUI._smartHiliteCaseSensitive; @@ -904,6 +905,7 @@ BOOL CALLBACK SettingsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM) ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_HIGHLITENONEHTMLZONE), nppGUI._enableTagsMatchHilite); return TRUE; } + case IDC_CHECK_ENABLTAGATTRHILITE: { nppGUI._enableTagAttrsHilite = !nppGUI._enableTagAttrsHilite; diff --git a/scintilla/include/SciLexer.h b/scintilla/include/SciLexer.h index 06d80e14..c8ffb714 100644 --- a/scintilla/include/SciLexer.h +++ b/scintilla/include/SciLexer.h @@ -200,48 +200,55 @@ #define SCE_OBJC_DIRECTIVE 20 #define SCE_OBJC_QUALIFIER 21 -#define SCE_USER_KWLIST_COMMENTS 0 -#define SCE_USER_KWLIST_NUMBER_EXTRA 1 -#define SCE_USER_KWLIST_NUMBER_PREFIX 2 -#define SCE_USER_KWLIST_NUMBER_EXTRAPREF 3 -#define SCE_USER_KWLIST_NUMBER_SUFFIX 4 -#define SCE_USER_KWLIST_OPERATORS1 5 -#define SCE_USER_KWLIST_OPERATORS2 6 -#define SCE_USER_KWLIST_FOLDERS_IN_CODE1_OPEN 7 -#define SCE_USER_KWLIST_FOLDERS_IN_CODE1_MIDDLE 8 -#define SCE_USER_KWLIST_FOLDERS_IN_CODE1_CLOSE 9 -#define SCE_USER_KWLIST_FOLDERS_IN_CODE2_OPEN 10 -#define SCE_USER_KWLIST_FOLDERS_IN_CODE2_MIDDLE 11 -#define SCE_USER_KWLIST_FOLDERS_IN_CODE2_CLOSE 12 -#define SCE_USER_KWLIST_FOLDERS_IN_COMMENT_OPEN 13 -#define SCE_USER_KWLIST_FOLDERS_IN_COMMENT_MIDDLE 14 -#define SCE_USER_KWLIST_FOLDERS_IN_COMMENT_CLOSE 15 -#define SCE_USER_KWLIST_KEYWORDS1 16 -#define SCE_USER_KWLIST_KEYWORDS2 17 -#define SCE_USER_KWLIST_KEYWORDS3 18 -#define SCE_USER_KWLIST_KEYWORDS4 19 -#define SCE_USER_KWLIST_KEYWORDS5 20 -#define SCE_USER_KWLIST_KEYWORDS6 21 -#define SCE_USER_KWLIST_KEYWORDS7 22 -#define SCE_USER_KWLIST_KEYWORDS8 23 -#define SCE_USER_KWLIST_DELIMITERS 24 -#define SCE_USER_KWLIST_TOTAL 25 // must always be <= SCE_USER_STYLE_TOTAL_STYLES - // and <= KEYWORDSET_MAX +#define SCE_UDL_VERSION_MAJOR 2 +#define SCE_UDL_VERSION_MINOR 1 +#define SCE_UDL_VERSION_BUILD 0 +#define SCE_UDL_VERSION_REVISION 10 -#define SCE_USER_TOTAL_DELIMITERS 8 -#define SCE_USER_TOTAL_KEYWORD_GROUPS 8 -#define SCE_USER_TOTAL_FOLDERS 6 +#define SCE_USER_KWLIST_COMMENTS 0 +#define SCE_USER_KWLIST_NUMBER_PREFIX1 1 +#define SCE_USER_KWLIST_NUMBER_PREFIX2 2 +#define SCE_USER_KWLIST_NUMBER_EXTRAS1 3 +#define SCE_USER_KWLIST_NUMBER_EXTRAS2 4 +#define SCE_USER_KWLIST_NUMBER_SUFFIX1 5 +#define SCE_USER_KWLIST_NUMBER_SUFFIX2 6 +#define SCE_USER_KWLIST_NUMBER_RANGE 7 +#define SCE_USER_KWLIST_OPERATORS1 8 +#define SCE_USER_KWLIST_OPERATORS2 9 +#define SCE_USER_KWLIST_FOLDERS_IN_CODE1_OPEN 10 +#define SCE_USER_KWLIST_FOLDERS_IN_CODE1_MIDDLE 11 +#define SCE_USER_KWLIST_FOLDERS_IN_CODE1_CLOSE 12 +#define SCE_USER_KWLIST_FOLDERS_IN_CODE2_OPEN 13 +#define SCE_USER_KWLIST_FOLDERS_IN_CODE2_MIDDLE 14 +#define SCE_USER_KWLIST_FOLDERS_IN_CODE2_CLOSE 15 +#define SCE_USER_KWLIST_FOLDERS_IN_COMMENT_OPEN 16 +#define SCE_USER_KWLIST_FOLDERS_IN_COMMENT_MIDDLE 17 +#define SCE_USER_KWLIST_FOLDERS_IN_COMMENT_CLOSE 18 +#define SCE_USER_KWLIST_KEYWORDS1 19 +#define SCE_USER_KWLIST_KEYWORDS2 20 +#define SCE_USER_KWLIST_KEYWORDS3 21 +#define SCE_USER_KWLIST_KEYWORDS4 22 +#define SCE_USER_KWLIST_KEYWORDS5 23 +#define SCE_USER_KWLIST_KEYWORDS6 24 +#define SCE_USER_KWLIST_KEYWORDS7 25 +#define SCE_USER_KWLIST_KEYWORDS8 26 +#define SCE_USER_KWLIST_DELIMITERS 27 +#define SCE_USER_KWLIST_TOTAL 28 // must always be <= KEYWORDSET_MAX -#define SCE_USER_STYLE_DEFAULT 0 -#define SCE_USER_STYLE_COMMENT 1 -#define SCE_USER_STYLE_COMMENTLINE 2 -#define SCE_USER_STYLE_NUMBER 3 -#define SCE_USER_STYLE_KEYWORD1 4 -#define SCE_USER_STYLE_KEYWORD2 5 -#define SCE_USER_STYLE_KEYWORD3 6 -#define SCE_USER_STYLE_KEYWORD4 7 -#define SCE_USER_STYLE_KEYWORD5 8 -#define SCE_USER_STYLE_KEYWORD6 9 +#define SCE_USER_TOTAL_DELIMITERS 8 +#define SCE_USER_TOTAL_KEYWORD_GROUPS 8 +#define SCE_USER_TOTAL_FOLDERS 6 + +#define SCE_USER_STYLE_DEFAULT 0 +#define SCE_USER_STYLE_COMMENT 1 +#define SCE_USER_STYLE_COMMENTLINE 2 +#define SCE_USER_STYLE_NUMBER 3 +#define SCE_USER_STYLE_KEYWORD1 4 +#define SCE_USER_STYLE_KEYWORD2 5 +#define SCE_USER_STYLE_KEYWORD3 6 +#define SCE_USER_STYLE_KEYWORD4 7 +#define SCE_USER_STYLE_KEYWORD5 8 +#define SCE_USER_STYLE_KEYWORD6 9 #define SCE_USER_STYLE_KEYWORD7 10 #define SCE_USER_STYLE_KEYWORD8 11 #define SCE_USER_STYLE_OPERATOR 12 @@ -261,34 +268,34 @@ #define SCE_USER_STYLE_MAPPER_TOTAL 17 #define SCE_STYLE_ARRAY_SIZE 30 // must cover sizes of NppParameters::_lexerStyler and NppParameters::_widgetStyle -#define SCE_USER_MASK_NESTING_NONE 0 -#define SCE_USER_MASK_NESTING_DELIMITER1 0x1 -#define SCE_USER_MASK_NESTING_DELIMITER2 0x2 -#define SCE_USER_MASK_NESTING_DELIMITER3 0x4 -#define SCE_USER_MASK_NESTING_DELIMITER4 0x8 -#define SCE_USER_MASK_NESTING_DELIMITER5 0x10 -#define SCE_USER_MASK_NESTING_DELIMITER6 0x20 -#define SCE_USER_MASK_NESTING_DELIMITER7 0x40 -#define SCE_USER_MASK_NESTING_DELIMITER8 0x80 -#define SCE_USER_MASK_NESTING_COMMENT 0x100 -#define SCE_USER_MASK_NESTING_COMMENT_LINE 0x200 -#define SCE_USER_MASK_NESTING_KEYWORD1 0x400 -#define SCE_USER_MASK_NESTING_KEYWORD2 0x800 -#define SCE_USER_MASK_NESTING_KEYWORD3 0x1000 -#define SCE_USER_MASK_NESTING_KEYWORD4 0x2000 -#define SCE_USER_MASK_NESTING_KEYWORD5 0x4000 -#define SCE_USER_MASK_NESTING_KEYWORD6 0x8000 -#define SCE_USER_MASK_NESTING_KEYWORD7 0x10000 -#define SCE_USER_MASK_NESTING_KEYWORD8 0x20000 -#define SCE_USER_MASK_NESTING_FOLDERS_IN_CODE2_OPEN 0x40000 -#define SCE_USER_MASK_NESTING_FOLDERS_IN_CODE2_MIDDLE 0x80000 -#define SCE_USER_MASK_NESTING_FOLDERS_IN_CODE2_CLOSE 0x100000 -#define SCE_USER_MASK_NESTING_FOLDERS_IN_COMMENT_OPEN 0x200000 -#define SCE_USER_MASK_NESTING_FOLDERS_IN_COMMENT_MIDDLE 0x400000 -#define SCE_USER_MASK_NESTING_FOLDERS_IN_COMMENT_CLOSE 0x800000 -#define SCE_USER_MASK_NESTING_OPERATORS1 0x1000000 -#define SCE_USER_MASK_NESTING_OPERATORS2 0x2000000 -#define SCE_USER_MASK_NESTING_NUMBERS 0x4000000 +#define SCE_USER_MASK_NESTING_NONE 0 +#define SCE_USER_MASK_NESTING_DELIMITER1 0x1 +#define SCE_USER_MASK_NESTING_DELIMITER2 0x2 +#define SCE_USER_MASK_NESTING_DELIMITER3 0x4 +#define SCE_USER_MASK_NESTING_DELIMITER4 0x8 +#define SCE_USER_MASK_NESTING_DELIMITER5 0x10 +#define SCE_USER_MASK_NESTING_DELIMITER6 0x20 +#define SCE_USER_MASK_NESTING_DELIMITER7 0x40 +#define SCE_USER_MASK_NESTING_DELIMITER8 0x80 +#define SCE_USER_MASK_NESTING_COMMENT 0x100 +#define SCE_USER_MASK_NESTING_COMMENT_LINE 0x200 +#define SCE_USER_MASK_NESTING_KEYWORD1 0x400 +#define SCE_USER_MASK_NESTING_KEYWORD2 0x800 +#define SCE_USER_MASK_NESTING_KEYWORD3 0x1000 +#define SCE_USER_MASK_NESTING_KEYWORD4 0x2000 +#define SCE_USER_MASK_NESTING_KEYWORD5 0x4000 +#define SCE_USER_MASK_NESTING_KEYWORD6 0x8000 +#define SCE_USER_MASK_NESTING_KEYWORD7 0x10000 +#define SCE_USER_MASK_NESTING_KEYWORD8 0x20000 +#define SCE_USER_MASK_NESTING_FOLDERS_IN_CODE2_OPEN 0x40000 +#define SCE_USER_MASK_NESTING_FOLDERS_IN_CODE2_MIDDLE 0x80000 +#define SCE_USER_MASK_NESTING_FOLDERS_IN_CODE2_CLOSE 0x100000 +#define SCE_USER_MASK_NESTING_FOLDERS_IN_COMMENT_OPEN 0x200000 +#define SCE_USER_MASK_NESTING_FOLDERS_IN_COMMENT_MIDDLE 0x400000 +#define SCE_USER_MASK_NESTING_FOLDERS_IN_COMMENT_CLOSE 0x800000 +#define SCE_USER_MASK_NESTING_OPERATORS1 0x1000000 +#define SCE_USER_MASK_NESTING_OPERATORS2 0x2000000 +#define SCE_USER_MASK_NESTING_NUMBERS 0x4000000 #define SCE_TCL_DEFAULT 0 #define SCE_TCL_COMMENT 1 diff --git a/scintilla/lexers/LexUser.cxx b/scintilla/lexers/LexUser.cxx index f5b9de21..471db1bc 100644 --- a/scintilla/lexers/LexUser.cxx +++ b/scintilla/lexers/LexUser.cxx @@ -76,8 +76,16 @@ using namespace Scintilla; #define SC_ISCOMMENTLINE 0x8000 #define MULTI_PART_LIMIT 100 +#define PURE_LC_NONE 0 // must be in synch with the same values in PowerEditor/src/Parameters.h +#define PURE_LC_BOL 1 +#define PURE_LC_WSP 2 + +#define EOL_DEFAULT_VALUE 0 +#define EOL_SKIP_CHECK 1 +#define EOL_FORCE_CHECK 2 + #define MAPPER_TOTAL 15 -#define FW_VECTORS_TOTAL SCE_USER_TOTAL_DELIMITERS + 6 +#define FW_VECTORS_TOTAL SCE_USER_TOTAL_DELIMITERS + 9 const int maskMapper[MAPPER_TOTAL] = { @@ -194,13 +202,16 @@ struct udlKeywordsMapStruct vvstring operators1; vvstring foldersInCode1Open, foldersInCode1Middle, foldersInCode1Close; vvstring foldersInCode2Open, foldersInCode2Middle, foldersInCode2Close; - vector suffixTokens; vector prefixTokens1; vector prefixTokens2; + vector suffixTokens1; + vector suffixTokens2; + vector extrasTokens1; + vector extrasTokens2; + vector rangeTokens; vector negativePrefixTokens1; vector negativePrefixTokens2; - vector extrasInPrefixedTokens; - vector rangeTokens; + vector negativeExtrasTokens2; }; // key value is of type "int" so it could receive pointer value !! @@ -335,7 +346,9 @@ static bool IsNumber(StyleContext & sc, vector * numberTokens[], vvstrin bool hasDot = false; bool hasPrefix1 = false; bool hasPrefix2 = false; - bool hasSuffix = false; + bool hasSuffix1 = false; + bool hasSuffix2 = false; + bool hasExtras2 = false; bool hasRange = false; bool hasExp = false; bool previousWasRange = false; @@ -343,11 +356,14 @@ static bool IsNumber(StyleContext & sc, vector * numberTokens[], vvstrin vector * prefixTokens1 = numberTokens[0]; vector * prefixTokens2 = numberTokens[1]; - vector * negativePrefixTokens1 = numberTokens[2]; - vector * negativePrefixTokens2 = numberTokens[3]; - vector * extrasInPrefixedTokens = numberTokens[4]; - vector * rangeTokens = numberTokens[5]; - vector * suffixTokens = numberTokens[6]; + vector * extrasTokens1 = numberTokens[2]; + vector * extrasTokens2 = numberTokens[3]; + vector * suffixTokens1 = numberTokens[4]; + vector * suffixTokens2 = numberTokens[5]; + vector * rangeTokens = numberTokens[6]; + vector * negativePrefixTokens1 = numberTokens[7]; + vector * negativePrefixTokens2 = numberTokens[8]; + vector * negativeExtrasTokens2 = numberTokens[9]; // treat .1234 as correct number sequence if (((decSeparator == SEPARATOR_BOTH || decSeparator == SEPARATOR_DOT) && sc.ch == '.') || @@ -379,7 +395,7 @@ static bool IsNumber(StyleContext & sc, vector * numberTokens[], vvstrin // prefix2 is styled as number only if followed by an actual number or NBR_EXTRA_CHAR int skipForward = 0; - if (isInListForward3(extrasInPrefixedTokens, sc, ignoreCase, iter->length(), skipForward)) + if (isInListForward3(extrasTokens1, sc, ignoreCase, iter->length(), skipForward)) { offset += iter->length() + skipForward; hasPrefix2 = true; @@ -420,6 +436,29 @@ static bool IsNumber(StyleContext & sc, vector * numberTokens[], vvstrin } } } + if (hasPrefix1 == false && hasPrefix2 == false) + { + // or is it a suffixed1 number with extras2? + vector::iterator iter = extrasTokens2->begin(); + vector::iterator last = extrasTokens2->end(); + + if (sc.ch == '-') + { + iter = negativeExtrasTokens2->begin(); + last = negativeExtrasTokens2->end(); + } + for (; iter != last; ++iter) + { + if (ignoreCase?sc.MatchIgnoreCase2(iter->c_str()) : sc.Match(iter->c_str())) + break; + } + if (iter != last) + { + offset += iter->length(); + hasExtras2 = true; + hasExp = true; // can't be a scientific E notation + } + } } // is it a simple digit? if (offset == 0) @@ -446,6 +485,9 @@ static bool IsNumber(StyleContext & sc, vector * numberTokens[], vvstrin // if (isInListForward2(fwEndVectors, (*fwEndVectors)->size(), sc, ignoreCase, offset) || isWhiteSpace(sc.GetRelative(offset))) if (isWhiteSpace(sc.GetRelative(offset)) || isInListForward2(fwEndVectors, 12, sc, ignoreCase, offset)) { + if (hasExtras2 == true && hasSuffix1 == false) + return false; + moveForward = offset; return true; // yay, finally we have a number } @@ -454,34 +496,58 @@ static bool IsNumber(StyleContext & sc, vector * numberTokens[], vvstrin { if (isInListForward3(rangeTokens, sc, ignoreCase, offset, skipForward)) { + if (hasExtras2 == true && hasSuffix1 == false) + return false; + offset += skipForward; - hasSuffix = false; + hasSuffix1 = false; + hasSuffix2 = false; hasDot = false; hasRange = true; hasExp = false; + hasExtras2 = false; previousWasRange = true; continue; } } - if (hasSuffix == true) // only RANGE_CHARs are allowed after SUFFIX_CHARs + if (hasSuffix2 == true) // only RANGE_CHARs are allowed after SUFFIX_CHARs return false; if (hasPrefix2 == true) { - if (isInListForward3(extrasInPrefixedTokens, sc, ignoreCase, offset, skipForward)) + if (isInListForward3(extrasTokens1, sc, ignoreCase, offset, skipForward)) { offset += skipForward; continue; } } - if (hasSuffix == false/* && hasExp == false*/) + if (hasSuffix1 == false && hasPrefix1 == false && hasPrefix2 == false) { - if (isInListForward3(suffixTokens, sc, ignoreCase, offset, skipForward)) + if (isInListForward3(suffixTokens1, sc, ignoreCase, offset, skipForward)) { offset += skipForward; - hasSuffix = true; + hasExtras2 = false; + hasSuffix1 = true; + continue; + } + + if (isInListForward3(extrasTokens2, sc, ignoreCase, offset, skipForward)) + { + offset += skipForward; + hasExtras2 = true; + hasExp = true; // can't be a scientific E notation + continue; + } + } + + if (hasSuffix2 == false) + { + if (isInListForward3(suffixTokens2, sc, ignoreCase, offset, skipForward)) + { + offset += skipForward; + hasSuffix2 = true; continue; } } @@ -555,7 +621,6 @@ static bool IsNumber(StyleContext & sc, vector * numberTokens[], vvstrin { offset += move; hasPrefix2 = false; // EXTRA_CHARs are not allowed in E notation - //hasSuffix = true; // SUFFIX_CHARs are not allowed in E notation hasDot = false; hasExp = true; continue; @@ -761,6 +826,7 @@ static inline void ReColoringCheck(unsigned int & startPos, unsigned int & neste startPos = 0; } while(ch != '\r' && ch != '\n' && startPos > 0); + if (startPos > 0) startPos += 1; // compensate for decrement operation } @@ -965,6 +1031,7 @@ static bool isInListBackward(WordList & list, StyleContext & sc, bool specialMod a = static_cast(ignoreCase?toupper(list.words[i][indexa++]):list.words[i][indexa++]); } + b = ignoreCase?toupper(b):b; } else b = ignoreCase?toupper(sc.GetRelative(offset + indexb++)):sc.GetRelative(offset + indexb++); @@ -1104,11 +1171,11 @@ static void setBackwards(WordList * kwLists[], StyleContext & sc, bool prefixes[ } static bool isInListNested(int nestedKey, vector & forwards, StyleContext & sc, - bool ignoreCase, int & openIndex, int & skipForward, int & newState, bool lineCommentAtBOL, - vector * numberTokens[], vvstring ** numberDelims, int decSeparator) + bool ignoreCase, int & openIndex, int & skipForward, int & newState, int pureLC, + bool visibleChars, vector * numberTokens[], vvstring ** numberDelims, int decSeparator) { // check if some other delimiter is nested within current delimiter - // all delimiters are freely checked but line comments must be synched with property 'lineCommentAtBOL' + // all delimiters are freely checked but line comments must be synched with property 'pureLC' int backup = openIndex; vector::iterator iter = forwards.begin(); @@ -1118,7 +1185,11 @@ static bool isInListNested(int nestedKey, vector & forwards, Styl if (nestedKey & iter->maskID) { if ((iter->maskID != SCE_USER_MASK_NESTING_COMMENT_LINE) || - (iter->maskID == SCE_USER_MASK_NESTING_COMMENT_LINE && !(lineCommentAtBOL && !sc.atLineStart))) + (iter->maskID == SCE_USER_MASK_NESTING_COMMENT_LINE && + ((pureLC == PURE_LC_NONE) || + (pureLC == PURE_LC_BOL && (sc.chPrev == '\r' || sc.chPrev == '\n')) || + (pureLC == PURE_LC_WSP && visibleChars == false)))) + { if (isInListForward(*(iter->vec), sc, ignoreCase, openIndex, skipForward)) { @@ -1162,10 +1233,11 @@ static void readLastNested(vector & lastNestedGroup, int & newState, static void ColouriseUserDoc(unsigned int startPos, int length, int initStyle, WordList *kwLists[], Accessor &styler) { - bool lineCommentAtBOL = styler.GetPropertyInt("userDefine.forceLineCommentsAtBOL", 0) != 0; - bool foldComments = styler.GetPropertyInt("userDefine.allowFoldOfComments", 0) != 0; - bool ignoreCase = styler.GetPropertyInt("userDefine.isCaseIgnored", 0) != 0; - bool foldCompact = styler.GetPropertyInt("userDefine.foldCompact", 0) != 0; + bool foldComments = styler.GetPropertyInt("userDefine.allowFoldOfComments", 0) != 0; + bool ignoreCase = styler.GetPropertyInt("userDefine.isCaseIgnored", 0) != 0; + bool foldCompact = styler.GetPropertyInt("userDefine.foldCompact", 0) != 0; + + int pureLC = styler.GetPropertyInt("userDefine.forcePureLC", 0); bool prefixes[MAPPER_TOTAL]; @@ -1269,13 +1341,16 @@ static void ColouriseUserDoc(unsigned int startPos, int length, int initStyle, W vvstring & foldersInCode1Middle = udlKeywordsMap[sUdlName].foldersInCode1Middle; vvstring & foldersInCode1Close = udlKeywordsMap[sUdlName].foldersInCode1Close; - vector & extrasInPrefixedTokens = udlKeywordsMap[sUdlName].extrasInPrefixedTokens; + vector & prefixTokens1 = udlKeywordsMap[sUdlName].prefixTokens1; + vector & prefixTokens2 = udlKeywordsMap[sUdlName].prefixTokens2; + vector & extrasTokens1 = udlKeywordsMap[sUdlName].extrasTokens1; + vector & extrasTokens2 = udlKeywordsMap[sUdlName].extrasTokens2; + vector & suffixTokens1 = udlKeywordsMap[sUdlName].suffixTokens1; + vector & suffixTokens2 = udlKeywordsMap[sUdlName].suffixTokens2; vector & rangeTokens = udlKeywordsMap[sUdlName].rangeTokens; vector & negativePrefixTokens1 = udlKeywordsMap[sUdlName].negativePrefixTokens1; vector & negativePrefixTokens2 = udlKeywordsMap[sUdlName].negativePrefixTokens2; - vector & prefixTokens1 = udlKeywordsMap[sUdlName].prefixTokens1; - vector & prefixTokens2 = udlKeywordsMap[sUdlName].prefixTokens2; - vector & suffixTokens = udlKeywordsMap[sUdlName].suffixTokens; + vector & negativeExtrasTokens2 = udlKeywordsMap[sUdlName].negativeExtrasTokens2; if (startPos == 0) { @@ -1379,30 +1454,36 @@ static void ColouriseUserDoc(unsigned int startPos, int length, int initStyle, W SubGroup(sFoldersInCode1Close, foldersInCode1Close, true); SubGroup(sOperators1, operators1, true); - char * numberRanges = (char *)styler.pprops->Get("userDefine.numberRanges"); - char * extraCharsInPrefixed = (char *)styler.pprops->Get("userDefine.extraCharsInPrefixed"); - //char * numberPrefixes1 = (char *)styler.pprops->Get("userDefine.numberPrefixes1"); - char * numberPrefixes1 = ""; - //char * numberPrefixes2 = (char *)styler.pprops->Get("userDefine.numberPrefixes2"); - char * numberPrefixes2 = (char *)styler.pprops->Get("userDefine.numberPrefixes"); - char * numberSuffixes = (char *)styler.pprops->Get("userDefine.numberSuffixes"); + char * numberPrefix1 = (char *)styler.pprops->Get("userDefine.numberPrefix1"); + char * numberPrefix2 = (char *)styler.pprops->Get("userDefine.numberPrefix2"); + char * numberExtras1 = (char *)styler.pprops->Get("userDefine.numberExtras1"); + char * numberExtras2 = (char *)styler.pprops->Get("userDefine.numberExtras2"); + char * numberSuffix1 = (char *)styler.pprops->Get("userDefine.numberSuffix1"); + char * numberSuffix2 = (char *)styler.pprops->Get("userDefine.numberSuffix2"); + char * numberRange = (char *)styler.pprops->Get("userDefine.numberRange"); - negativePrefixTokens1.clear(); + prefixTokens1.clear(); prefixTokens2.clear(); - negativePrefixTokens1.clear(); - prefixTokens2.clear(); - extrasInPrefixedTokens.clear(); + extrasTokens1.clear(); + extrasTokens2.clear(); + suffixTokens1.clear(); + suffixTokens2.clear(); rangeTokens.clear(); - suffixTokens.clear(); + negativePrefixTokens1.clear(); + negativePrefixTokens2.clear(); + negativeExtrasTokens2.clear(); // 'StringToVector' converts strings into vector objects - StringToVector(numberPrefixes1, prefixTokens1); - StringToVector(numberPrefixes1, negativePrefixTokens1, true); - StringToVector(numberPrefixes2, prefixTokens2); - StringToVector(numberPrefixes2, negativePrefixTokens2, true); - StringToVector(numberSuffixes, suffixTokens); - StringToVector(extraCharsInPrefixed, extrasInPrefixedTokens); - StringToVector(numberRanges, rangeTokens); + StringToVector(numberPrefix1, prefixTokens1); + StringToVector(numberPrefix1, negativePrefixTokens1, true); + StringToVector(numberPrefix2, prefixTokens2); + StringToVector(numberPrefix2, negativePrefixTokens2, true); + StringToVector(numberExtras1, extrasTokens1); + StringToVector(numberExtras2, extrasTokens2); + StringToVector(numberExtras2, negativeExtrasTokens2, true); + StringToVector(numberSuffix1, suffixTokens1); + StringToVector(numberSuffix2, suffixTokens2); + StringToVector(numberRange, rangeTokens); } // forward strings are actually kept in forwardStruct's, this allows easy access to ScintillaID and MaskID @@ -1438,14 +1519,17 @@ static void ColouriseUserDoc(unsigned int startPos, int length, int initStyle, W fwEndVectors[3] = &commentLineClose; fwEndVectors[4] = &commentOpen; fwEndVectors[5] = &commentClose; - fwEndVectors[6] = &delim1Close; - fwEndVectors[7] = &delim2Close; - fwEndVectors[8] = &delim3Close; - fwEndVectors[9] = &delim4Close; - fwEndVectors[10] = &delim5Close; - fwEndVectors[11] = &delim6Close; - fwEndVectors[12] = &delim7Close; - fwEndVectors[13] = &delim8Close; + fwEndVectors[6] = &foldersInCode1Open; + fwEndVectors[7] = &foldersInCode1Middle; + fwEndVectors[8] = &foldersInCode1Close; + fwEndVectors[9] = &delim1Close; + fwEndVectors[10] = &delim2Close; + fwEndVectors[11] = &delim3Close; + fwEndVectors[12] = &delim4Close; + fwEndVectors[13] = &delim5Close; + fwEndVectors[14] = &delim6Close; + fwEndVectors[15] = &delim7Close; + fwEndVectors[16] = &delim8Close; // keep delimiter escape/close strings in an array for easier looping vvstring * delimVectors[(SCE_USER_TOTAL_DELIMITERS+2) * 2]; @@ -1504,14 +1588,17 @@ static void ColouriseUserDoc(unsigned int startPos, int length, int initStyle, W numberDelimSeparators[i][11] = (delimNestings[i] & SCE_USER_MASK_NESTING_OPERATORS1) ? &operators1 : NULL; } - vector * numberTokens[7]; + vector * numberTokens[10]; numberTokens[0] = &prefixTokens1; numberTokens[1] = &prefixTokens2; - numberTokens[2] = &negativePrefixTokens1; - numberTokens[3] = &negativePrefixTokens2; - numberTokens[4] = &extrasInPrefixedTokens; - numberTokens[5] = &rangeTokens; - numberTokens[6] = &suffixTokens; + numberTokens[2] = &extrasTokens1; + numberTokens[3] = &extrasTokens2; + numberTokens[4] = &suffixTokens1; + numberTokens[5] = &suffixTokens2; + numberTokens[6] = &rangeTokens; + numberTokens[7] = &negativePrefixTokens1; + numberTokens[8] = &negativePrefixTokens2; + numberTokens[9] = &negativeExtrasTokens2; int levelCurrent = SC_FOLDLEVELBASE; int lineCurrent = 0; @@ -1521,9 +1608,11 @@ static void ColouriseUserDoc(unsigned int startPos, int length, int initStyle, W int lev = 0; bool visibleChars = false; + bool skipVisibleCheck = false; bool dontMove = false; bool finished = true; + int checkEOL = EOL_DEFAULT_VALUE; unsigned int nestedLevel = 0; int openIndex = 0; @@ -1578,9 +1667,547 @@ static void ColouriseUserDoc(unsigned int startPos, int length, int initStyle, W for (; finished; dontMove?true:sc.Forward()) { dontMove = false; + checkEOL = EOL_DEFAULT_VALUE; if (sc.More() == false) finished = false; // colorize last word, even if file does not end with whitespace char + switch (sc.state) + { + case SCE_USER_STYLE_DELIMITER1: + case SCE_USER_STYLE_DELIMITER2: + case SCE_USER_STYLE_DELIMITER3: + case SCE_USER_STYLE_DELIMITER4: + case SCE_USER_STYLE_DELIMITER5: + case SCE_USER_STYLE_DELIMITER6: + case SCE_USER_STYLE_DELIMITER7: + case SCE_USER_STYLE_DELIMITER8: + { + int index = sc.state - SCE_USER_STYLE_DELIMITER1; + delimEscape = delimVectors[index*2]; + delimClose = delimVectors[index*2 + 1]; + delimNesting = delimNestings[index]; + numberDelims = numberDelimSeparators[index]; + prevState = sc.state; + newState = sc.state; + + // first, check escape sequence + bool loopEscape = true; + vector::iterator iter; + while (loopEscape == true) + { + loopEscape = false; + iter = (*delimEscape)[openIndex].begin(); + for (; iter != (*delimEscape)[openIndex].end(); ++iter) + { + if (ignoreCase?sc.MatchIgnoreCase2(iter->c_str()):sc.Match(iter->c_str())) + { + sc.Forward(iter->length() + 1); // escape is found, skip escape string and one char after it. + loopEscape = true; + //break; + } + } + } + + // second, check end of delimiter sequence + iter = (*delimClose)[openIndex].begin(); + for (; iter != (*delimClose)[openIndex].end(); ++iter) + { + if (ignoreCase ? sc.MatchIgnoreCase2(iter->c_str()):sc.Match(iter->c_str())) + { + // record end of delimiter sequence (NI_CLOSE) + nestedVector.push_back(*NI.Set(sc.currentPos + iter->length() - 1, nestedLevel--, openIndex, sc.state, NI_CLOSE)); + // is there anything on the left side? (any backward keyword 'glued' with end of delimiter sequence) + setBackwards(kwLists, sc, prefixes, ignoreCase, delimNesting, fwEndVectors, levelMinCurrent, levelNext, nlCount, dontMove, docLength); + // paint backward keyword + sc.SetState(prevState); + // was current delimiter sequence nested, or do we start over from SCE_USER_STYLE_IDENTIFIER? + readLastNested(lastNestedGroup, newState, openIndex); + // for delimiters that end with ((EOL)) + if (newState != SCE_USER_STYLE_COMMENTLINE || (sc.ch != '\r' && sc.ch != '\n')) + sc.Forward(iter->length()); + if (sc.atLineStart) + checkEOL = EOL_FORCE_CHECK; + + // paint end of delimiter sequence + sc.SetState(newState); + + dontMove = true; + break; // break out of 'for', not 'case' + } + } + + // out of current state? + if (prevState != newState) + break; + + // quick replacement for SCE_USER_STYLE_DEFAULT (important for nested keywords) + if (isWhiteSpace(sc.ch) && !isWhiteSpace(sc.chPrev)) + { + setBackwards(kwLists, sc, prefixes, ignoreCase, delimNesting, fwEndVectors, levelMinCurrent, levelNext, nlCount, dontMove, docLength); + sc.SetState(prevState); + } + else if ((!isWhiteSpace(sc.ch) && isWhiteSpace(sc.chPrev))) + { + // create new 'compare point' (AKA beginning of nested keyword) before checking for numbers + sc.SetState(prevState); + } + + // third, check nested delimiter sequence + if (isInListNested(delimNesting, forwards, sc, ignoreCase, openIndex, skipForward, + newState, pureLC, visibleChars, numberTokens, numberDelims, decSeparator)) + { + // any backward keyword 'glued' on the left side? + setBackwards(kwLists, sc, prefixes, ignoreCase, delimNesting, fwEndVectors, levelMinCurrent, levelNext, nlCount, dontMove, docLength); + + if (newState != SCE_USER_STYLE_OPERATOR && newState != SCE_USER_STYLE_NUMBER) + { + // record delimiter sequence in BOTH vectors + nestedVector.push_back(*NI.Set(sc.currentPos, ++nestedLevel, openIndex, newState, NI_OPEN)); + lastNestedGroup.push_back(NI); + } + + sc.SetState(newState); // yes, both 'SetState' calls are needed + sc.Forward(skipForward); + sc.SetState(newState); + + if (newState == SCE_USER_STYLE_OPERATOR || newState == SCE_USER_STYLE_NUMBER) + sc.ChangeState(prevState); + + dontMove = true; + break; + } + break; + } + + case SCE_USER_STYLE_COMMENT: + { + numberDelims = numberDelimSeparators[SCE_USER_TOTAL_DELIMITERS]; + // first, check end of comment sequence + vector::iterator iter = commentClose[openIndex].begin(); + for (; iter != commentClose[openIndex].end(); ++iter) + { + if (ignoreCase?sc.MatchIgnoreCase2(iter->c_str()):sc.Match(iter->c_str())) + { + // record end of comment sequence (NI_CLOSE) + nestedVector.push_back(*NI.Set(sc.currentPos + iter->length() - 1, nestedLevel--, openIndex, SCE_USER_STYLE_COMMENT, NI_CLOSE)); + // is there anything on the left side? (any backward keyword 'glued' with end of comment sequence) + setBackwards(kwLists, sc, prefixes, ignoreCase, commentNesting, fwEndVectors, levelMinCurrent, levelNext, nlCount, dontMove, docLength); + // paint backward keyword and move on + sc.SetState(SCE_USER_STYLE_COMMENT); + sc.Forward(iter->length()); + // was current comment sequence nested, or do we start over from SCE_USER_STYLE_IDENTIFIER? + readLastNested(lastNestedGroup, newState, openIndex); + // paint end of comment sequence + sc.SetState(newState); + + isInComment = false; + dontMove = true; + break; + } + } + + if (sc.state != SCE_USER_STYLE_COMMENT) + break; + + // quick replacement for SCE_USER_STYLE_DEFAULT (important for nested keywords) + if (isWhiteSpace(sc.ch) && !isWhiteSpace(sc.chPrev)) + { + setBackwards(kwLists, sc, prefixes, ignoreCase, commentNesting, fwEndVectors, levelMinCurrent, levelNext, nlCount, dontMove, docLength); + sc.SetState(SCE_USER_STYLE_COMMENT); + } + else if (!isWhiteSpace(sc.ch) && isWhiteSpace(sc.chPrev)) + { + // create new 'compare point' (AKA beginning of nested keyword) before checking for numbers + sc.SetState(SCE_USER_STYLE_COMMENT); + } + + // third, check nested delimiter sequence + if (isInListNested(commentNesting, forwards, sc, ignoreCase, openIndex, skipForward, + newState, pureLC, visibleChars, numberTokens, numberDelims, decSeparator)) + { + // any backward keyword 'glued' on the left side? + setBackwards(kwLists, sc, prefixes, ignoreCase, commentNesting, fwEndVectors, levelMinCurrent, levelNext, nlCount, dontMove, docLength); + + if (newState != SCE_USER_STYLE_OPERATOR && newState != SCE_USER_STYLE_NUMBER) + { + // record delimiter sequence in BOTH vectors + nestedVector.push_back(*NI.Set(sc.currentPos, ++nestedLevel, openIndex, newState, NI_OPEN)); + lastNestedGroup.push_back(NI); + } + + sc.SetState(newState); // yes, both 'SetState' calls are needed + sc.Forward(skipForward); + sc.SetState(newState); + + if (newState == SCE_USER_STYLE_OPERATOR || newState == SCE_USER_STYLE_NUMBER) + sc.ChangeState(SCE_USER_STYLE_COMMENT); + + dontMove = true; + break; + } + break; + } + + case SCE_USER_STYLE_COMMENTLINE: + { + numberDelims = numberDelimSeparators[SCE_USER_TOTAL_DELIMITERS + 1]; + + // first, check end of line comment sequence (in rare cases when line comments can end before new line char) + vector::iterator iter = commentLineClose[openIndex].begin(); + for (; iter != commentLineClose[openIndex].end(); ++iter) + { + if (ignoreCase?sc.MatchIgnoreCase2(iter->c_str()):sc.Match(iter->c_str())) + { + // record end of line comment sequence (NI_CLOSE) + nestedVector.push_back(*NI.Set(sc.currentPos + iter->length() - 1, nestedLevel--, openIndex, SCE_USER_STYLE_COMMENTLINE, NI_CLOSE)); + // is there anything on the left side? (any backward keyword 'glued' with end of line comment sequence) + setBackwards(kwLists, sc, prefixes, ignoreCase, lineCommentNesting, fwEndVectors, levelMinCurrent, levelNext, nlCount, dontMove, docLength); + // paint backward keyword and move on + sc.SetState(SCE_USER_STYLE_COMMENTLINE); + sc.Forward(iter->length()); + // was current line comment sequence nested, or do we start over from SCE_USER_STYLE_IDENTIFIER? + readLastNested(lastNestedGroup, newState, openIndex); + // paint end of line comment sequence + sc.SetState(newState); + + dontMove = true; + break; // break out of 'for', not 'case' + } + } + + if (sc.state != SCE_USER_STYLE_COMMENTLINE) + break; + + // quick replacement for SCE_USER_STYLE_DEFAULT (important for nested keywords) + if (isWhiteSpace(sc.ch) && !isWhiteSpace(sc.chPrev)) + { + setBackwards(kwLists, sc, prefixes, ignoreCase, lineCommentNesting, fwEndVectors, levelMinCurrent, levelNext, nlCount, dontMove, docLength); + sc.SetState(SCE_USER_STYLE_COMMENTLINE); + } + else if (!isWhiteSpace(sc.ch) && isWhiteSpace(sc.chPrev)) + { + // create new 'compare point' (AKA beginning of nested keyword) before checking for numbers + sc.SetState(SCE_USER_STYLE_COMMENTLINE); + } + + // second, check line comment continuation + if (sc.atLineEnd) + { + bool lineContinuation = false; + int offset = 0; + if (sc.chPrev == '\r') + offset = 1; + + vector::iterator iter = commentLineContinue[openIndex].begin(); + for (; iter != commentLineContinue[openIndex].end(); ++iter) + { + int length = iter->length(); + if (length == 0) + continue; + + lineContinuation = true; + for (int i=0; iempty()) + { + if (isInListForward(*delimStart[i], sc, ignoreCase, openIndex, skipForward)) + { + // any backward keyword 'glued' on the left side? + setBackwards(kwLists, sc, prefixes, ignoreCase, bwNesting, fwEndVectors, levelMinCurrent, levelNext, nlCount, dontMove, docLength); + // paint up to start of delimiter sequence + sc.SetState(i+SCE_USER_STYLE_DELIMITER1); + // record start of delimiter sequence (NI_OPEN) in BOTH nesting vectors + nestedVector.push_back(*NI.Set(sc.currentPos, ++nestedLevel, openIndex, i+SCE_USER_STYLE_DELIMITER1, NI_OPEN)); + lastNestedGroup.push_back(NI); + // paint start of delimiter sequence + sc.Forward(skipForward); + sc.SetState(i+SCE_USER_STYLE_DELIMITER1); + dontMove = true; + if (sc.atLineEnd) + checkEOL = EOL_SKIP_CHECK; + break; // break from nested 'for' loop, not 'case' statement + } + } + } + + if (dontMove == true) + break; // delimiter start found, break from case SCE_USER_STYLE_DEFAULT + + if (!operators1.empty()) + { + if (isInListForward(operators1, sc, ignoreCase, openIndex, skipForward)) + { + // any backward keyword 'glued' on the left side? + setBackwards(kwLists, sc, prefixes, ignoreCase, bwNesting, fwEndVectors, levelMinCurrent, levelNext, nlCount, dontMove, docLength); + // paint up to start of sequence + sc.SetState(SCE_USER_STYLE_OPERATOR); + // paint sequence + sc.Forward(skipForward); + //sc.ChangeState(SCE_USER_STYLE_OPERATOR); + // no closing sequence, start over from default + sc.SetState(SCE_USER_STYLE_IDENTIFIER); + dontMove = true; + break; + } + } + + if (!foldersInCode1Open.empty()) + { + if (isInListForward(foldersInCode1Open, sc, ignoreCase, openIndex, skipForward)) + { + // any backward keyword 'glued' on the left side? + setBackwards(kwLists, sc, prefixes, ignoreCase, bwNesting, fwEndVectors, levelMinCurrent, levelNext, nlCount, dontMove, docLength); + // paint up to start of sequence + sc.SetState(SCE_USER_STYLE_FOLDER_IN_CODE1); + // paint sequence + sc.Forward(skipForward); + //sc.ChangeState(SCE_USER_STYLE_FOLDER_IN_CODE1); + // no closing sequence, start over from default + sc.SetState(SCE_USER_STYLE_IDENTIFIER); + dontMove = true; + if (sc.atLineEnd) + checkEOL = EOL_SKIP_CHECK; + + if (levelMinCurrent > levelNext) + levelMinCurrent = levelNext; + + levelNext++; + break; + } + } + + if (!foldersInCode1Middle.empty()) + { + if (isInListForward(foldersInCode1Middle, sc, ignoreCase, openIndex, skipForward)) + { + // any backward keyword 'glued' on the left side? + setBackwards(kwLists, sc, prefixes, ignoreCase, bwNesting, fwEndVectors, levelMinCurrent, levelNext, nlCount, dontMove, docLength); + // paint up to start of sequence + sc.SetState(SCE_USER_STYLE_FOLDER_IN_CODE1); + // paint sequence + sc.Forward(skipForward); + //sc.ChangeState(SCE_USER_STYLE_FOLDER_IN_CODE1); + // no closing sequence, start over from default + sc.SetState(SCE_USER_STYLE_IDENTIFIER); + dontMove = true; + if (sc.atLineEnd) + checkEOL = true; + + levelNext--; + if (levelMinCurrent > levelNext) + levelMinCurrent = levelNext; + + levelNext++; + break; + } + } + + if (!foldersInCode1Close.empty()) + { + if (isInListForward(foldersInCode1Close, sc, ignoreCase, openIndex, skipForward)) + { + // any backward keyword 'glued' on the left side? + setBackwards(kwLists, sc, prefixes, ignoreCase, bwNesting, fwEndVectors, levelMinCurrent, levelNext, nlCount, dontMove, docLength); + // paint up to start of sequence + sc.SetState(SCE_USER_STYLE_FOLDER_IN_CODE1); + // paint sequence + sc.Forward(skipForward); + //sc.ChangeState(SCE_USER_STYLE_FOLDER_IN_CODE1); + // no closing sequence, start over from default + sc.SetState(SCE_USER_STYLE_IDENTIFIER); + if (sc.atLineEnd) + checkEOL = true; + + dontMove = true; + levelNext--; + break; + } + } + + if (foldComments && isCommentLine != COMMENTLINE_SKIP_TESTING) + isCommentLine = COMMENTLINE_SKIP_TESTING; + + break; + } + + // determine if a new state should be entered. + case SCE_USER_STYLE_IDENTIFIER: + { + if (isWhiteSpace(sc.ch)) + break; + + if (IsNumber(sc, numberTokens, fwEndVectors, ignoreCase, decSeparator, skipForward)) + { + // paint up to start of sequence + sc.SetState(SCE_USER_STYLE_NUMBER); + // paint sequence + sc.Forward(skipForward); + //sc.ChangeState(SCE_USER_STYLE_NUMBER); + // start over from default + sc.SetState(SCE_USER_STYLE_IDENTIFIER); + + if (isWhiteSpace(sc.ch)) + break; + } + + if (!isWhiteSpace(sc.ch))// && isWhiteSpace(sc.chPrev)) // word start + { + sc.SetState(SCE_USER_STYLE_DEFAULT); + skipVisibleCheck = true; + dontMove = true; + break; + } + break; + } + + default: + break; + } + if (foldComments) if (isInComment == false) if (isCommentLine == COMMENTLINE_NO) @@ -1590,10 +2217,12 @@ static void ColouriseUserDoc(unsigned int startPos, int length, int initStyle, W if (!isWhiteSpace(sc.ch)) isCommentLine = COMMENTLINE_SKIP_TESTING; - if (foldCompact == true && visibleChars == false && !isWhiteSpace(sc.ch)) + if (skipVisibleCheck == true) + skipVisibleCheck = false; + else if (visibleChars == false && !isWhiteSpace(sc.ch)) visibleChars = true; - if (sc.atLineEnd) + if ((sc.atLineEnd == true && checkEOL != EOL_SKIP_CHECK) || (sc.atLineEnd == false && checkEOL == EOL_FORCE_CHECK)) { if (foldComments == true) { @@ -1680,516 +2309,6 @@ static void ColouriseUserDoc(unsigned int startPos, int length, int initStyle, W isCommentLine = isInComment ? COMMENTLINE_YES:COMMENTLINE_NO; } } - - switch (sc.state) - { - case SCE_USER_STYLE_DELIMITER1: - case SCE_USER_STYLE_DELIMITER2: - case SCE_USER_STYLE_DELIMITER3: - case SCE_USER_STYLE_DELIMITER4: - case SCE_USER_STYLE_DELIMITER5: - case SCE_USER_STYLE_DELIMITER6: - case SCE_USER_STYLE_DELIMITER7: - case SCE_USER_STYLE_DELIMITER8: - { - int index = sc.state - SCE_USER_STYLE_DELIMITER1; - delimEscape = delimVectors[index*2]; - delimClose = delimVectors[index*2 + 1]; - delimNesting = delimNestings[index]; - numberDelims = numberDelimSeparators[index]; - prevState = sc.state; - newState = sc.state; - - // first, check escape sequence - bool loopEscape = true; - vector::iterator iter; - while (loopEscape == true) - { - loopEscape = false; - iter = (*delimEscape)[openIndex].begin(); - for (; iter != (*delimEscape)[openIndex].end(); ++iter) - { - if (ignoreCase?sc.MatchIgnoreCase2(iter->c_str()):sc.Match(iter->c_str())) - { - sc.Forward(iter->length() + 1); // escape is found, skip escape string and one char after it. - loopEscape = true; - //break; - } - } - } - - // second, check end of delimiter sequence - iter = (*delimClose)[openIndex].begin(); - for (; iter != (*delimClose)[openIndex].end(); ++iter) - { - if (ignoreCase ? sc.MatchIgnoreCase2(iter->c_str()):sc.Match(iter->c_str())) - { - // record end of delimiter sequence (NI_CLOSE) - nestedVector.push_back(*NI.Set(sc.currentPos + iter->length() - 1, nestedLevel--, openIndex, sc.state, NI_CLOSE)); - // is there anything on the left side? (any backward keyword 'glued' with end of delimiter sequence) - setBackwards(kwLists, sc, prefixes, ignoreCase, delimNesting, fwEndVectors, levelMinCurrent, levelNext, nlCount, dontMove, docLength); - // paint backward keyword - sc.SetState(prevState); - // was current delimiter sequence nested, or do we start over from SCE_USER_STYLE_IDENTIFIER? - readLastNested(lastNestedGroup, newState, openIndex); - // for delimiters that end with ((EOL)) - if (newState != SCE_USER_STYLE_COMMENTLINE || (sc.ch != '\r' && sc.ch != '\n')) - sc.Forward(iter->length()); - - // paint end of delimiter sequence - sc.SetState(newState); - - dontMove = true; - break; // break out of 'for', not 'case' - } - } - - // out of current state? - if (prevState != newState) - break; - - // quick replacement for SCE_USER_STYLE_DEFAULT (important for nested keywords) - if (isWhiteSpace(sc.ch) && !isWhiteSpace(sc.chPrev)) - { - setBackwards(kwLists, sc, prefixes, ignoreCase, delimNesting, fwEndVectors, levelMinCurrent, levelNext, nlCount, dontMove, docLength); - sc.SetState(prevState); - } - else if ((!isWhiteSpace(sc.ch) && isWhiteSpace(sc.chPrev))) - { - // create new 'compare point' (AKA beginning of nested keyword) before checking for numbers - sc.SetState(prevState); - } - - // third, check nested delimiter sequence - if (isInListNested(delimNesting, forwards, sc, ignoreCase, openIndex, skipForward, newState, lineCommentAtBOL, numberTokens, numberDelims, decSeparator)) - { - // any backward keyword 'glued' on the left side? - setBackwards(kwLists, sc, prefixes, ignoreCase, delimNesting, fwEndVectors, levelMinCurrent, levelNext, nlCount, dontMove, docLength); - - if (newState != SCE_USER_STYLE_OPERATOR && newState != SCE_USER_STYLE_NUMBER) - { - // record delimiter sequence in BOTH vectors - nestedVector.push_back(*NI.Set(sc.currentPos, ++nestedLevel, openIndex, newState, NI_OPEN)); - lastNestedGroup.push_back(NI); - } - - sc.SetState(newState); // yes, both 'SetState' calls are needed - sc.Forward(skipForward); - sc.SetState(newState); - - if (newState == SCE_USER_STYLE_OPERATOR || newState == SCE_USER_STYLE_NUMBER) - sc.ChangeState(prevState); - - dontMove = true; - break; - } - break; - } - - case SCE_USER_STYLE_COMMENT: - { - numberDelims = numberDelimSeparators[SCE_USER_TOTAL_DELIMITERS]; - // first, check end of comment sequence - vector::iterator iter = commentClose[openIndex].begin(); - for (; iter != commentClose[openIndex].end(); ++iter) - { - if (ignoreCase?sc.MatchIgnoreCase2(iter->c_str()):sc.Match(iter->c_str())) - { - // record end of comment sequence (NI_CLOSE) - nestedVector.push_back(*NI.Set(sc.currentPos + iter->length() - 1, nestedLevel--, openIndex, SCE_USER_STYLE_COMMENT, NI_CLOSE)); - // is there anything on the left side? (any backward keyword 'glued' with end of comment sequence) - setBackwards(kwLists, sc, prefixes, ignoreCase, commentNesting, fwEndVectors, levelMinCurrent, levelNext, nlCount, dontMove, docLength); - // paint backward keyword and move on - sc.SetState(SCE_USER_STYLE_COMMENT); - sc.Forward(iter->length()); - // was current comment sequence nested, or do we start over from SCE_USER_STYLE_IDENTIFIER? - readLastNested(lastNestedGroup, newState, openIndex); - // paint end of comment sequence - sc.SetState(newState); - - isInComment = false; - dontMove = true; - break; - } - } - - if (sc.state != SCE_USER_STYLE_COMMENT) - break; - - // quick replacement for SCE_USER_STYLE_DEFAULT (important for nested keywords) - if (isWhiteSpace(sc.ch) && !isWhiteSpace(sc.chPrev)) - { - setBackwards(kwLists, sc, prefixes, ignoreCase, commentNesting, fwEndVectors, levelMinCurrent, levelNext, nlCount, dontMove, docLength); - sc.SetState(SCE_USER_STYLE_COMMENT); - } - else if (!isWhiteSpace(sc.ch) && isWhiteSpace(sc.chPrev)) - { - // create new 'compare point' (AKA beginning of nested keyword) before checking for numbers - sc.SetState(SCE_USER_STYLE_COMMENT); - } - - // third, check nested delimiter sequence - if (isInListNested(commentNesting, forwards, sc, ignoreCase, openIndex, skipForward, newState, lineCommentAtBOL, numberTokens, numberDelims, decSeparator)) - { - // any backward keyword 'glued' on the left side? - setBackwards(kwLists, sc, prefixes, ignoreCase, commentNesting, fwEndVectors, levelMinCurrent, levelNext, nlCount, dontMove, docLength); - - if (newState != SCE_USER_STYLE_OPERATOR && newState != SCE_USER_STYLE_NUMBER) - { - // record delimiter sequence in BOTH vectors - nestedVector.push_back(*NI.Set(sc.currentPos, ++nestedLevel, openIndex, newState, NI_OPEN)); - lastNestedGroup.push_back(NI); - } - - sc.SetState(newState); // yes, both 'SetState' calls are needed - sc.Forward(skipForward); - sc.SetState(newState); - - if (newState == SCE_USER_STYLE_OPERATOR || newState == SCE_USER_STYLE_NUMBER) - sc.ChangeState(SCE_USER_STYLE_COMMENT); - - dontMove = true; - break; - } - break; - } - - case SCE_USER_STYLE_COMMENTLINE: - { - numberDelims = numberDelimSeparators[SCE_USER_TOTAL_DELIMITERS + 1]; - - // first, check end of line comment sequence (in rare cases when line comments can end before new line char) - vector::iterator iter = commentLineClose[openIndex].begin(); - for (; iter != commentLineClose[openIndex].end(); ++iter) - { - if (ignoreCase?sc.MatchIgnoreCase2(iter->c_str()):sc.Match(iter->c_str())) - { - // record end of line comment sequence (NI_CLOSE) - nestedVector.push_back(*NI.Set(sc.currentPos + iter->length() - 1, nestedLevel--, openIndex, SCE_USER_STYLE_COMMENTLINE, NI_CLOSE)); - // is there anything on the left side? (any backward keyword 'glued' with end of line comment sequence) - setBackwards(kwLists, sc, prefixes, ignoreCase, lineCommentNesting, fwEndVectors, levelMinCurrent, levelNext, nlCount, dontMove, docLength); - // paint backward keyword and move on - sc.SetState(SCE_USER_STYLE_COMMENTLINE); - sc.Forward(iter->length()); - // was current line comment sequence nested, or do we start over from SCE_USER_STYLE_IDENTIFIER? - readLastNested(lastNestedGroup, newState, openIndex); - // paint end of line comment sequence - sc.SetState(newState); - - dontMove = true; - break; - } - } - - if (sc.state != SCE_USER_STYLE_COMMENTLINE) - break; - - // quick replacement for SCE_USER_STYLE_DEFAULT (important for nested keywords) - if (isWhiteSpace(sc.ch) && !isWhiteSpace(sc.chPrev)) - { - setBackwards(kwLists, sc, prefixes, ignoreCase, lineCommentNesting, fwEndVectors, levelMinCurrent, levelNext, nlCount, dontMove, docLength); - sc.SetState(SCE_USER_STYLE_COMMENTLINE); - } - else if (!isWhiteSpace(sc.ch) && isWhiteSpace(sc.chPrev)) - { - // create new 'compare point' (AKA beginning of nested keyword) before checking for numbers - sc.SetState(SCE_USER_STYLE_COMMENTLINE); - } - - // second, check line comment continuation - if (sc.atLineEnd) - { - bool lineContinuation = false; - int offset = 0; - if (sc.chPrev == '\r') - offset = 1; - - vector::iterator iter = commentLineContinue[openIndex].begin(); - for (; iter != commentLineContinue[openIndex].end(); ++iter) - { - int length = iter->length(); - if (length == 0) - continue; - - lineContinuation = true; - for (int i=0; iempty()) - { - if (isInListForward(*delimStart[i], sc, ignoreCase, openIndex, skipForward)) - { - // any backward keyword 'glued' on the left side? - setBackwards(kwLists, sc, prefixes, ignoreCase, bwNesting, fwEndVectors, levelMinCurrent, levelNext, nlCount, dontMove, docLength); - // paint up to start of delimiter sequence - sc.SetState(i+SCE_USER_STYLE_DELIMITER1); - // record start of delimiter sequence (NI_OPEN) in BOTH nesting vectors - nestedVector.push_back(*NI.Set(sc.currentPos, ++nestedLevel, openIndex, i+SCE_USER_STYLE_DELIMITER1, NI_OPEN)); - lastNestedGroup.push_back(NI); - // paint start of delimiter sequence - sc.Forward(skipForward); - sc.SetState(i+SCE_USER_STYLE_DELIMITER1); - dontMove = true; - break; // break from nested 'for' loop, not 'case' statement - } - } - } - - if (dontMove == true) - break; // delimiter start found, break from case SCE_USER_STYLE_DEFAULT - - if (!operators1.empty()) - { - if (isInListForward(operators1, sc, ignoreCase, openIndex, skipForward)) - { - // any backward keyword 'glued' on the left side? - setBackwards(kwLists, sc, prefixes, ignoreCase, bwNesting, fwEndVectors, levelMinCurrent, levelNext, nlCount, dontMove, docLength); - // paint up to start of sequence - sc.SetState(SCE_USER_STYLE_OPERATOR); - // paint sequence - sc.Forward(skipForward); - //sc.ChangeState(SCE_USER_STYLE_OPERATOR); - // no closing sequence, start over from default - sc.SetState(SCE_USER_STYLE_IDENTIFIER); - dontMove = true; - break; - } - } - - if (!foldersInCode1Open.empty()) - { - if (isInListForward(foldersInCode1Open, sc, ignoreCase, openIndex, skipForward)) - { - // any backward keyword 'glued' on the left side? - setBackwards(kwLists, sc, prefixes, ignoreCase, bwNesting, fwEndVectors, levelMinCurrent, levelNext, nlCount, dontMove, docLength); - // paint up to start of sequence - sc.SetState(SCE_USER_STYLE_FOLDER_IN_CODE1); - // paint sequence - sc.Forward(skipForward); - //sc.ChangeState(SCE_USER_STYLE_FOLDER_IN_CODE1); - // no closing sequence, start over from default - sc.SetState(SCE_USER_STYLE_IDENTIFIER); - dontMove = true; - if (levelMinCurrent > levelNext) - levelMinCurrent = levelNext; - levelNext++; - break; - } - } - - if (!foldersInCode1Middle.empty()) - { - if (isInListForward(foldersInCode1Middle, sc, ignoreCase, openIndex, skipForward)) - { - // any backward keyword 'glued' on the left side? - setBackwards(kwLists, sc, prefixes, ignoreCase, bwNesting, fwEndVectors, levelMinCurrent, levelNext, nlCount, dontMove, docLength); - // paint up to start of sequence - sc.SetState(SCE_USER_STYLE_FOLDER_IN_CODE1); - // paint sequence - sc.Forward(skipForward); - //sc.ChangeState(SCE_USER_STYLE_FOLDER_IN_CODE1); - // no closing sequence, start over from default - sc.SetState(SCE_USER_STYLE_IDENTIFIER); - dontMove = true; - levelNext--; - if (levelMinCurrent > levelNext) - levelMinCurrent = levelNext; - levelNext++; - break; - } - } - - if (!foldersInCode1Close.empty()) - { - if (isInListForward(foldersInCode1Close, sc, ignoreCase, openIndex, skipForward)) - { - // any backward keyword 'glued' on the left side? - setBackwards(kwLists, sc, prefixes, ignoreCase, bwNesting, fwEndVectors, levelMinCurrent, levelNext, nlCount, dontMove, docLength); - // paint up to start of sequence - sc.SetState(SCE_USER_STYLE_FOLDER_IN_CODE1); - // paint sequence - sc.Forward(skipForward); - //sc.ChangeState(SCE_USER_STYLE_FOLDER_IN_CODE1); - // no closing sequence, start over from default - sc.SetState(SCE_USER_STYLE_IDENTIFIER); - dontMove = true; - levelNext--; - break; - } - } - - if (foldComments && isCommentLine != COMMENTLINE_SKIP_TESTING) - isCommentLine = COMMENTLINE_SKIP_TESTING; - - break; - } - - // determine if a new state should be entered. - case SCE_USER_STYLE_IDENTIFIER: - { - if (isWhiteSpace(sc.ch)) - break; - - if (IsNumber(sc, numberTokens, fwEndVectors, ignoreCase, decSeparator, skipForward)) - { - // paint up to start of sequence - sc.SetState(SCE_USER_STYLE_NUMBER); - // paint sequence - sc.Forward(skipForward); - //sc.ChangeState(SCE_USER_STYLE_NUMBER); - // start over from default - sc.SetState(SCE_USER_STYLE_IDENTIFIER); - - if (isWhiteSpace(sc.ch)) - break; - } - - if (!isWhiteSpace(sc.ch))// && isWhiteSpace(sc.chPrev)) // word start - { - sc.SetState(SCE_USER_STYLE_DEFAULT); - dontMove = true; - break; - } - break; - } - - default: - break; - } } sc.Complete(); }