diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 403dc60a..8b1f65b9 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -103,7 +103,7 @@ ToolBarButtonUnit toolBarIcons[] = { {IDM_VIEW_WRAP, IDI_VIEW_WRAP_OFF_ICON, IDI_VIEW_WRAP_ON_ICON, IDI_VIEW_WRAP_OFF_ICON, IDR_WRAP}, {IDM_VIEW_ALL_CHARACTERS, IDI_VIEW_ALL_CHAR_OFF_ICON, IDI_VIEW_ALL_CHAR_ON_ICON, IDI_VIEW_ALL_CHAR_OFF_ICON, IDR_INVISIBLECHAR}, {IDM_VIEW_INDENT_GUIDE, IDI_VIEW_INDENT_OFF_ICON, IDI_VIEW_INDENT_ON_ICON, IDI_VIEW_INDENT_OFF_ICON, IDR_INDENTGUIDE}, - {IDM_VIEW_USER_DLG, IDI_VIEW_UD_DLG_OFF_ICON, IDI_VIEW_UD_DLG_ON_ICON, IDI_VIEW_UD_DLG_OFF_ICON, IDR_SHOWPANNEL}, + {IDM_LANG_USER_DLG, IDI_VIEW_UD_DLG_OFF_ICON, IDI_VIEW_UD_DLG_ON_ICON, IDI_VIEW_UD_DLG_OFF_ICON, IDR_SHOWPANNEL}, //-------------------------------------------------------------------------------------// {0, IDI_SEPARATOR_ICON, IDI_SEPARATOR_ICON, IDI_SEPARATOR_ICON, IDI_SEPARATOR_ICON}, @@ -615,8 +615,8 @@ LRESULT Notepad_plus::init(HWND hwnd) } // UserDefine Dialog - checkMenuItem(IDM_VIEW_USER_DLG, uddShow); - _toolBar.setCheck(IDM_VIEW_USER_DLG, uddShow); + checkMenuItem(IDM_LANG_USER_DLG, uddShow); + _toolBar.setCheck(IDM_LANG_USER_DLG, uddShow); //launch the plugin dlg memorized at the last session DockingManagerData &dmd = nppGUI._dockingData; @@ -3291,7 +3291,7 @@ void Notepad_plus::showFunctionComp() autoC->showFunctionComplete(); } -static generic_string extractSymbol(TCHAR prefix, const TCHAR *str2extract) +static generic_string extractSymbol(TCHAR firstChar, TCHAR secondChar, const TCHAR *str2extract) { bool found = false; TCHAR extracted[128] = TEXT(""); @@ -3313,8 +3313,11 @@ static generic_string extractSymbol(TCHAR prefix, const TCHAR *str2extract) if (!str2extract[i]) return TEXT(""); - if (str2extract[i] == prefix) + if (str2extract[i] == firstChar && str2extract[i+1] == secondChar) + { found = true; + ++i; + } } } return generic_string(extracted); @@ -3341,12 +3344,12 @@ bool Notepad_plus::doBlockComment(comment_mode currCommentMode) if (!userLangContainer) return false; - symbol = extractSymbol('0', userLangContainer->_keywordLists[4]); + 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('1', userLangContainer->_keywordLists[4]); + symbolStart = extractSymbol('0', '1', userLangContainer->_keywordLists[SCE_USER_KWLIST_COMMENTS]); commentStart = symbolStart.c_str(); - symbolEnd = extractSymbol('2', userLangContainer->_keywordLists[4]); + symbolEnd = extractSymbol('0', '2', userLangContainer->_keywordLists[SCE_USER_KWLIST_COMMENTS]); commentEnd = symbolEnd.c_str(); } else @@ -3495,12 +3498,12 @@ bool Notepad_plus::doStreamComment() return false; //--FLS: BlockToStreamComment: Next two lines needed to decide, if block-comment can be called below! - symbol = extractSymbol('0', userLangContainer->_keywordLists[4]); + symbol = extractSymbol('0', '0', userLangContainer->_keywordLists[SCE_USER_KWLIST_COMMENTS]); commentLineSybol = symbol.c_str(); - symbolStart = extractSymbol('1', userLangContainer->_keywordLists[4]); + symbolStart = extractSymbol('0', '1', userLangContainer->_keywordLists[SCE_USER_KWLIST_COMMENTS]); commentStart = symbolStart.c_str(); - symbolEnd = extractSymbol('2', userLangContainer->_keywordLists[4]); + symbolEnd = extractSymbol('0', '2', userLangContainer->_keywordLists[SCE_USER_KWLIST_COMMENTS]); commentEnd = symbolEnd.c_str(); } else @@ -5479,9 +5482,9 @@ bool Notepad_plus::undoStreamComment() if (!userLangContainer) return false; - symbolStart = extractSymbol('1', userLangContainer->_keywordLists[4]); + symbolStart = extractSymbol('0', '1', userLangContainer->_keywordLists[SCE_USER_KWLIST_COMMENTS]); commentStart = symbolStart.c_str(); - symbolEnd = extractSymbol('2', userLangContainer->_keywordLists[4]); + symbolEnd = extractSymbol('0', '2', userLangContainer->_keywordLists[SCE_USER_KWLIST_COMMENTS]); commentEnd = symbolEnd.c_str(); } else diff --git a/PowerEditor/src/Notepad_plus.rc b/PowerEditor/src/Notepad_plus.rc index 382d5e74..53875c04 100644 --- a/PowerEditor/src/Notepad_plus.rc +++ b/PowerEditor/src/Notepad_plus.rc @@ -408,7 +408,7 @@ BEGIN MENUITEM "Word wrap", IDM_VIEW_WRAP MENUITEM "Focus on Another View", IDM_VIEW_SWITCHTO_OTHER_VIEW MENUITEM "Hide Lines", IDM_VIEW_HIDELINES - MENUITEM "User-Defined Dialogue...", IDM_VIEW_USER_DLG + //MENUITEM "User-Defined Dialogue...", IDM_VIEW_USER_DLG MENUITEM SEPARATOR MENUITEM "Fold All", IDM_VIEW_TOGGLE_FOLDALL MENUITEM "Unfold All", IDM_VIEW_TOGGLE_UNFOLDALL @@ -642,7 +642,8 @@ BEGIN MENUITEM "XML", IDM_LANG_XML MENUITEM "YAML", IDM_LANG_YAML MENUITEM SEPARATOR - MENUITEM "User-Defined", IDM_LANG_USER + MENUITEM "Define your language...", IDM_LANG_USER_DLG + MENUITEM "User-Defined", IDM_LANG_USER END POPUP "&Language" @@ -744,6 +745,7 @@ BEGIN MENUITEM "XML", IDM_LANG_XML MENUITEM "YAML", IDM_LANG_YAML MENUITEM SEPARATOR + MENUITEM "Define your language...", IDM_LANG_USER_DLG MENUITEM "User-Defined", IDM_LANG_USER END diff --git a/PowerEditor/src/NppBigSwitch.cpp b/PowerEditor/src/NppBigSwitch.cpp index e18835fe..299a7341 100644 --- a/PowerEditor/src/NppBigSwitch.cpp +++ b/PowerEditor/src/NppBigSwitch.cpp @@ -173,8 +173,8 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa case WM_CLOSE_USERDEFINE_DLG : { - checkMenuItem(IDM_VIEW_USER_DLG, false); - _toolBar.setCheck(IDM_VIEW_USER_DLG, false); + checkMenuItem(IDM_LANG_USER_DLG, false); + _toolBar.setCheck(IDM_LANG_USER_DLG, false); return TRUE; } diff --git a/PowerEditor/src/NppCommands.cpp b/PowerEditor/src/NppCommands.cpp index f30b7955..fcfb09f7 100644 --- a/PowerEditor/src/NppCommands.cpp +++ b/PowerEditor/src/NppCommands.cpp @@ -711,7 +711,7 @@ void Notepad_plus::command(int id) bookmarkClearAll(); break; - case IDM_VIEW_USER_DLG : + case IDM_LANG_USER_DLG : { bool isUDDlgVisible = false; @@ -776,8 +776,8 @@ void Notepad_plus::command(int id) else //((!isUDDlgDocked)&&(!isUDDlgVisible)) udd->display(); } - checkMenuItem(IDM_VIEW_USER_DLG, !isUDDlgVisible); - _toolBar.setCheck(IDM_VIEW_USER_DLG, !isUDDlgVisible); + checkMenuItem(IDM_LANG_USER_DLG, !isUDDlgVisible); + _toolBar.setCheck(IDM_LANG_USER_DLG, !isUDDlgVisible); break; } diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index 981d55d2..d153886f 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -32,6 +32,7 @@ #include "ScintillaEditView.h" #include "keys.h" #include "localization.h" +#include "UserDefineDialog.h" struct WinMenuKeyDefinition { //more or less matches accelerator table definition, easy copy/paste //const TCHAR * name; //name retrieved from menu? @@ -169,10 +170,10 @@ WinMenuKeyDefinition winKeyDefs[] = { {VK_NULL, IDM_VIEW_INDENT_GUIDE, false, false, false, NULL}, {VK_NULL, IDM_VIEW_WRAP, false, false, false, NULL}, {VK_NULL, IDM_VIEW_WRAP_SYMBOL, false, false, false, NULL}, - {VK_NULL, IDM_VIEW_USER_DLG, false, false, false, NULL}, - //{VK_NULL, IDM_VIEW_ZOOMIN, false, false, false, NULL}, - //{VK_NULL, IDM_VIEW_ZOOMOUT, false, false, false, NULL}, - //{VK_NULL, IDM_VIEW_ZOOMRESTORE, false, false, false, NULL}, + {VK_NULL, IDM_LANG_USER_DLG, false, false, false, NULL}, + // {VK_NULL, IDM_VIEW_ZOOMIN, false, false, false, NULL}, + // {VK_NULL, IDM_VIEW_ZOOMOUT, false, false, false, NULL}, + // {VK_NULL, IDM_VIEW_ZOOMRESTORE, false, false, false, NULL}, {VK_0, IDM_VIEW_TOGGLE_FOLDALL, false, true, false, NULL}, {VK_F, IDM_VIEW_FOLD_CURRENT, true, true, false, NULL}, {VK_1, IDM_VIEW_FOLD_1, false, true, false, NULL}, @@ -399,34 +400,34 @@ ScintillaKeyDefinition scintKeyDefs[] = { //array of accelerator keys for all po {TEXT("SCI_SWAPMAINANCHORCARET"), SCI_SWAPMAINANCHORCARET, false, false, false, 0, 0}, {TEXT("SCI_ROTATESELECTION"), SCI_ROTATESELECTION, false, false, false, 0, 0} - //{TEXT("SCI_EMPTYUNDOBUFFER"), SCI_EMPTYUNDOBUFFER, false, false, false, 0, 0}, - //{TEXT("SCI_TOGGLECARETSTICKY"), SCI_TOGGLECARETSTICKY, false, false, false, 0, 0}, - //{TEXT("SCI_CALLTIPCANCEL"), SCI_CALLTIPCANCEL, false, false, false, 0, 0}, - //{TEXT("SCI_SETSAVEPOINT"), SCI_SETSAVEPOINT, false, false, false, 0, 0}, - //{TEXT("SCI_CLEARDOCUMENTSTYLE"), SCI_CLEARDOCUMENTSTYLE, false, false, false, 0, 0}, + // {TEXT("SCI_EMPTYUNDOBUFFER"), SCI_EMPTYUNDOBUFFER, false, false, false, 0, 0}, + // {TEXT("SCI_TOGGLECARETSTICKY"), SCI_TOGGLECARETSTICKY, false, false, false, 0, 0}, + // {TEXT("SCI_CALLTIPCANCEL"), SCI_CALLTIPCANCEL, false, false, false, 0, 0}, + // {TEXT("SCI_SETSAVEPOINT"), SCI_SETSAVEPOINT, false, false, false, 0, 0}, + // {TEXT("SCI_CLEARDOCUMENTSTYLE"), SCI_CLEARDOCUMENTSTYLE, false, false, false, 0, 0}, // // //{TEXT("SCI_CHOOSECARETX"), SCI_CHOOSECARETX, false, false, false, 0, 0}, - //{TEXT("SCI_AUTOCCOMPLETE"), SCI_AUTOCCOMPLETE, false, false, false, 0, 0}, - //{TEXT("SCI_AUTOCCANCEL"), SCI_AUTOCCANCEL, false, false, false, 0, 0}, - //{TEXT("SCI_CLEARREGISTEREDIMAGES"), SCI_CLEARREGISTEREDIMAGES, false, false, false, 0, 0}, - //{TEXT("SCI_HOMEDISPLAYEXTEND"), SCI_HOMEDISPLAYEXTEND, false, true, true, VK_HOME, 0}, - //{TEXT("SCI_LINEENDDISPLAYEXTEND"), SCI_LINEENDDISPLAYEXTEND, false, true, true, VK_END, 0}, - // - //{TEXT("SCI_DELWORDRIGHTEND"), SCI_DELWORDRIGHTEND, false, false, false, 0, 0}, - //{TEXT("SCI_LOWERCASE"), SCI_LOWERCASE, false, false, false, 0, 0}, - //{TEXT("SCI_UPPERCASE"), SCI_UPPERCASE, false, false, false, 0, 0}, - //{TEXT("SCI_LOWERCASE"), SCI_LOWERCASE, true, false, false, VK_U, 0}, - //{TEXT("SCI_UPPERCASE"), SCI_UPPERCASE, true, false, true, VK_U, 0}, - // - //{TEXT("SCI_FORMFEED"), SCI_FORMFEED, true, false, false, VK_L, 0}, - //{TEXT("SCI_CLEARALLCMDKEYS"), SCI_CLEARALLCMDKEYS, false, false, false, 0, 0}, - //{TEXT("SCI_STARTRECORD"), SCI_STARTRECORD, false, false, false, 0, 0}, - //{TEXT("SCI_STOPRECORD"), SCI_STOPRECORD, false, false, false, 0, 0}, - //{TEXT("SCI_SEARCHANCHOR"), SCI_SEARCHANCHOR, false, false, false, 0, 0}, - //{TEXT("SCI_TARGETFROMSELECTION"), SCI_TARGETFROMSELECTION, false, false, false, 0, 0}, - //{TEXT("SCI_STYLERESETDEFAULT"), SCI_STYLERESETDEFAULT, false, false, false, 0, 0}, - //{TEXT("SCI_STYLECLEARALL"), SCI_STYLECLEARALL, false, false, false, 0, 0}, + // {TEXT("SCI_AUTOCCOMPLETE"), SCI_AUTOCCOMPLETE, false, false, false, 0, 0}, + // {TEXT("SCI_AUTOCCANCEL"), SCI_AUTOCCANCEL, false, false, false, 0, 0}, + // {TEXT("SCI_CLEARREGISTEREDIMAGES"), SCI_CLEARREGISTEREDIMAGES, false, false, false, 0, 0}, + // {TEXT("SCI_HOMEDISPLAYEXTEND"), SCI_HOMEDISPLAYEXTEND, false, true, true, VK_HOME, 0}, + // {TEXT("SCI_LINEENDDISPLAYEXTEND"), SCI_LINEENDDISPLAYEXTEND, false, true, true, VK_END, 0}, + // + // {TEXT("SCI_DELWORDRIGHTEND"), SCI_DELWORDRIGHTEND, false, false, false, 0, 0}, + // {TEXT("SCI_LOWERCASE"), SCI_LOWERCASE, false, false, false, 0, 0}, + // {TEXT("SCI_UPPERCASE"), SCI_UPPERCASE, false, false, false, 0, 0}, + // {TEXT("SCI_LOWERCASE"), SCI_LOWERCASE, true, false, false, VK_U, 0}, + // {TEXT("SCI_UPPERCASE"), SCI_UPPERCASE, true, false, true, VK_U, 0}, + // + // {TEXT("SCI_FORMFEED"), SCI_FORMFEED, true, false, false, VK_L, 0}, + // {TEXT("SCI_CLEARALLCMDKEYS"), SCI_CLEARALLCMDKEYS, false, false, false, 0, 0}, + // {TEXT("SCI_STARTRECORD"), SCI_STARTRECORD, false, false, false, 0, 0}, + // {TEXT("SCI_STOPRECORD"), SCI_STOPRECORD, false, false, false, 0, 0}, + // {TEXT("SCI_SEARCHANCHOR"), SCI_SEARCHANCHOR, false, false, false, 0, 0}, + // {TEXT("SCI_TARGETFROMSELECTION"), SCI_TARGETFROMSELECTION, false, false, false, 0, 0}, + // {TEXT("SCI_STYLERESETDEFAULT"), SCI_STYLERESETDEFAULT, false, false, false, 0, 0}, + // {TEXT("SCI_STYLECLEARALL"), SCI_STYLECLEARALL, false, false, false, 0, 0}, // }; @@ -2155,12 +2156,16 @@ bool NppParameters::feedUserLang(TiXmlNode *node) { const TCHAR *name = (childNode->ToElement())->Attribute(TEXT("name")); const TCHAR *ext = (childNode->ToElement())->Attribute(TEXT("ext")); + const TCHAR *udlVersion = (childNode->ToElement())->Attribute(TEXT("udlVersion")); hasFoundElement = true; try { if (!name || !name[0] || !ext) throw std::runtime_error("NppParameters::feedUserLang : UserLang name is missing"); - _userLangArray[_nbUserLang] = new UserLangContainer(name, ext); + if (!udlVersion) + _userLangArray[_nbUserLang] = new UserLangContainer(name, ext, TEXT("")); + else + _userLangArray[_nbUserLang] = new UserLangContainer(name, ext, udlVersion); _nbUserLang++; TiXmlNode *settingsRoot = childNode->FirstChildElement(TEXT("Settings")); @@ -2181,6 +2186,14 @@ bool NppParameters::feedUserLang(TiXmlNode *node) feedUserStyles(stylesRoot); + // styles that were not read from xml file should get default values + for (int i=0; i_styleArray.getStyler(i); + if (style._styleID == -1) + _userLangArray[_nbUserLang - 1]->_styleArray.addStyler(i, styleNameMapper[i]); + } + } catch (std::exception e) { delete _userLangArray[--_nbUserLang]; isEverythingOK = false; @@ -2524,20 +2537,6 @@ void NppParameters::removeUserLang(int index) _nbUserLang--; } -int NppParameters::getIndexFromKeywordListName(const TCHAR *name) -{ - if (!name) return -1; - if (!lstrcmp(name, TEXT("Folder+"))) return 1; - else if (!lstrcmp(name, TEXT("Folder-"))) return 2; - else if (!lstrcmp(name, TEXT("Operators")))return 3; - else if (!lstrcmp(name, TEXT("Comment"))) return 4; - else if (!lstrcmp(name, TEXT("Words1"))) return 5; - else if (!lstrcmp(name, TEXT("Words2"))) return 6; - else if (!lstrcmp(name, TEXT("Words3"))) return 7; - else if (!lstrcmp(name, TEXT("Words4"))) return 8; - else if (!lstrcmp(name, TEXT("Delimiters"))) return 0; - else return -1; -} void NppParameters::feedUserSettings(TiXmlNode *settingsRoot) { const TCHAR *boolStr; @@ -2546,31 +2545,44 @@ void NppParameters::feedUserSettings(TiXmlNode *settingsRoot) { boolStr = (globalSettingNode->ToElement())->Attribute(TEXT("caseIgnored")); if (boolStr) - _userLangArray[_nbUserLang - 1]->_isCaseIgnored = !lstrcmp(TEXT("yes"), boolStr); - boolStr = (globalSettingNode->ToElement())->Attribute(TEXT("escapeChar")); - _userLangArray[_nbUserLang - 1]->_escapeChar[0] = (boolStr) ? boolStr[0] : 0; - } - TiXmlNode *treatAsSymbolNode = settingsRoot->FirstChildElement(TEXT("TreatAsSymbol")); - if (treatAsSymbolNode) - { - boolStr = (treatAsSymbolNode->ToElement())->Attribute(TEXT("comment")); - if (boolStr) - _userLangArray[_nbUserLang - 1]->_isCommentSymbol = !lstrcmp(TEXT("yes"), boolStr); + _userLangArray[_nbUserLang - 1]->_isCaseIgnored = !lstrcmp(TEXT("yes"), boolStr); - boolStr = (treatAsSymbolNode->ToElement())->Attribute(TEXT("commentLine")); + boolStr = (globalSettingNode->ToElement())->Attribute(TEXT("allowFoldOfComments")); if (boolStr) - _userLangArray[_nbUserLang - 1]->_isCommentLineSymbol = !lstrcmp(TEXT("yes"), 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); + + boolStr = (globalSettingNode->ToElement())->Attribute(TEXT("foldCompact")); + if (boolStr) + _userLangArray[_nbUserLang - 1]->_foldCompact = !lstrcmp(TEXT("yes"), boolStr); } + TiXmlNode *prefixNode = settingsRoot->FirstChildElement(TEXT("Prefix")); if (prefixNode) { - TCHAR names[nbPrefixListAllowed][7] = {TEXT("words1"), TEXT("words2"), TEXT("words3"), TEXT("words4")}; - for (int i = 0 ; i < nbPrefixListAllowed ; i++) - { - boolStr = (prefixNode->ToElement())->Attribute(names[i]); - if (boolStr) - _userLangArray[_nbUserLang - 1]->_isPrefix[i] = !lstrcmp(TEXT("yes"), boolStr); - } + const TCHAR *udlVersion = _userLangArray[_nbUserLang - 1]->_udlVersion.c_str(); + if (!lstrcmp(udlVersion, TEXT("2.0"))) + { + for (int i = 0 ; i < SCE_USER_TOTAL_KEYWORD_GROUPS ; i++) + { + boolStr = (prefixNode->ToElement())->Attribute(keywordListMapper[i+SCE_USER_KWLIST_KEYWORDS1]); + if (boolStr) + _userLangArray[_nbUserLang - 1]->_isPrefix[i] = !lstrcmp(TEXT("yes"), boolStr); + } + } + else // support for old style (pre 2.0) + { + TCHAR names[SCE_USER_TOTAL_KEYWORD_GROUPS][7] = {TEXT("words1"), TEXT("words2"), TEXT("words3"), TEXT("words4")}; + for (int i = 0 ; i < 4 ; i++) + { + boolStr = (prefixNode->ToElement())->Attribute(names[i]); + if (boolStr) + _userLangArray[_nbUserLang - 1]->_isPrefix[i] = !lstrcmp(TEXT("yes"), boolStr); + } + } } } @@ -2581,30 +2593,136 @@ void NppParameters::feedUserKeywordList(TiXmlNode *node) childNode = childNode->NextSibling(TEXT("Keywords"))) { const TCHAR *keywordsName = (childNode->ToElement())->Attribute(TEXT("name")); - int i = getIndexFromKeywordListName(keywordsName); - if (i != -1) - { - TiXmlNode *valueNode = childNode->FirstChild(); - if (valueNode) - { - const TCHAR *kwl = (valueNode)?valueNode->Value():(lstrcmp(keywordsName, TEXT("Delimiters"))?TEXT(""):TEXT("000000")); - lstrcpy(_userLangArray[_nbUserLang - 1]->_keywordLists[i], kwl); - } - } + const TCHAR *udlVersion = _userLangArray[_nbUserLang - 1]->_udlVersion.c_str(); + TCHAR *kwl = NULL; + + TiXmlNode *valueNode = childNode->FirstChild(); + if (valueNode) + { + if (!lstrcmp(udlVersion, TEXT("2.0"))) + { + const int keywordsID = _tstoi((childNode->ToElement())->Attribute(TEXT("id"))); + kwl = (valueNode)?valueNode->Value():TEXT(""); + lstrcpy(_userLangArray[_nbUserLang - 1]->_keywordLists[keywordsID], kwl); + } + else // support for old style (pre 2.0) + { + if (!lstrcmp(keywordsName, TEXT("Delimiters"))) + { + 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 if (!lstrcmp(keywordsName, TEXT("Operators"))) + { + kwl = (valueNode)?valueNode->Value():TEXT(""); + lstrcpy(_userLangArray[_nbUserLang - 1]->_keywordLists[SCE_USER_KWLIST_OPERATORS1], kwl); + } + else if (!lstrcmp(keywordsName, TEXT("Folder+"))) + { + 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); + } + 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")); + } + + temp += TEXT(" 01 02"); + if (temp[0] == ' ') + temp.erase(0, 1); + + lstrcpy(_userLangArray[_nbUserLang - 1]->_keywordLists[SCE_USER_KWLIST_COMMENTS], temp.c_str()); + + } + } + } } } 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; + 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) + { + if (id >= SCE_USER_STYLE_MAPPER_TOTAL) + continue; + + id = styleIdMApper[id]; + if (id == -1) + continue; + } if (styleIDStr) { - _userLangArray[_nbUserLang - 1]->_styleArray.addStyler(id, childNode); + if (id < SCE_USER_STYLE_TOTAL_STYLES) + _userLangArray[_nbUserLang - 1]->_styleArray.addStyler((id | L_USER << 16), childNode); } } } @@ -2704,26 +2822,40 @@ void LexerStylerArray::eraseAll() void StyleArray::addStyler(int styleID, TiXmlNode *styleNode) { - _styleArray[_nbStyler]._styleID = styleID; + int index = _nbStyler; + bool isUser = styleID >> 16 == L_USER; + if (isUser) + { + styleID = (styleID & 0xFFFF); + index = styleID; + if (index >= SCE_USER_STYLE_TOTAL_STYLES) + return; + } + + _styleArray[index]._styleID = styleID; if (styleNode) { TiXmlElement *element = styleNode->ToElement(); + // TODO: translate to English // Pour _fgColor, _bgColor : // RGB() | (result & 0xFF000000) c'est pour le cas de -1 (0xFFFFFFFF) // retourné par hexStrVal(str) const TCHAR *str = element->Attribute(TEXT("name")); if (str) { - _styleArray[_nbStyler]._styleDesc = str; + if (isUser) + _styleArray[index]._styleDesc = styleNameMapper[index]; + else + _styleArray[index]._styleDesc = str; } str = element->Attribute(TEXT("fgColor")); if (str) { unsigned long result = hexStrVal(str); - _styleArray[_nbStyler]._fgColor = (RGB((result >> 16) & 0xFF, (result >> 8) & 0xFF, result & 0xFF)) | (result & 0xFF000000); + _styleArray[index]._fgColor = (RGB((result >> 16) & 0xFF, (result >> 8) & 0xFF, result & 0xFF)) | (result & 0xFF000000); } @@ -2731,40 +2863,46 @@ void StyleArray::addStyler(int styleID, TiXmlNode *styleNode) if (str) { unsigned long result = hexStrVal(str); - _styleArray[_nbStyler]._bgColor = (RGB((result >> 16) & 0xFF, (result >> 8) & 0xFF, result & 0xFF)) | (result & 0xFF000000); + _styleArray[index]._bgColor = (RGB((result >> 16) & 0xFF, (result >> 8) & 0xFF, result & 0xFF)) | (result & 0xFF000000); } str = element->Attribute(TEXT("colorStyle")); if (str) { - _styleArray[_nbStyler]._colorStyle = decStrVal(str); + _styleArray[index]._colorStyle = decStrVal(str); } str = element->Attribute(TEXT("fontName")); - _styleArray[_nbStyler]._fontName = str; + _styleArray[index]._fontName = str; str = element->Attribute(TEXT("fontStyle")); if (str) { - _styleArray[_nbStyler]._fontStyle = decStrVal(str); + _styleArray[index]._fontStyle = decStrVal(str); } str = element->Attribute(TEXT("fontSize")); if (str) { - _styleArray[_nbStyler]._fontSize = decStrVal(str); + _styleArray[index]._fontSize = decStrVal(str); + } + str = element->Attribute(TEXT("nesting")); + + if (str) + { + _styleArray[index]._nesting = decStrVal(str); } str = element->Attribute(TEXT("keywordClass")); if (str) { - _styleArray[_nbStyler]._keywordClass = getKwClassFromName(str); + _styleArray[index]._keywordClass = getKwClassFromName(str); } TiXmlNode *v = styleNode->FirstChild(); if (v) { - _styleArray[_nbStyler]._keywords = new generic_string(v->Value()); + _styleArray[index]._keywords = new generic_string(v->Value()); } } _nbStyler++; @@ -5125,61 +5263,57 @@ bool NppParameters::insertTabInfo(const TCHAR *langName, int tabInfo) return false; } -void NppParameters::writeStyle2Element(Style & style2Wite, Style & style2Sync, TiXmlElement *element) +void NppParameters::writeStyle2Element(Style & style2Write, Style & style2Sync, TiXmlElement *element) { - if (HIBYTE(HIWORD(style2Wite._fgColor)) != 0xFF) + if (HIBYTE(HIWORD(style2Write._fgColor)) != 0xFF) { - int rgbVal = RGB2int(style2Wite._fgColor); + int rgbVal = RGB2int(style2Write._fgColor); TCHAR fgStr[7]; wsprintf(fgStr, TEXT("%.6X"), rgbVal); element->SetAttribute(TEXT("fgColor"), fgStr); } - if (HIBYTE(HIWORD(style2Wite._bgColor)) != 0xFF) + if (HIBYTE(HIWORD(style2Write._bgColor)) != 0xFF) { - int rgbVal = RGB2int(style2Wite._bgColor); + int rgbVal = RGB2int(style2Write._bgColor); TCHAR bgStr[7]; wsprintf(bgStr, TEXT("%.6X"), rgbVal); element->SetAttribute(TEXT("bgColor"), bgStr); } - if (style2Wite._colorStyle != COLORSTYLE_ALL) + if (style2Write._colorStyle != COLORSTYLE_ALL) { - element->SetAttribute(TEXT("colorStyle"), style2Wite._colorStyle); + element->SetAttribute(TEXT("colorStyle"), style2Write._colorStyle); } - if (style2Wite._fontName) + if (style2Write._fontName) { const TCHAR *oldFontName = element->Attribute(TEXT("fontName")); - if (lstrcmp(oldFontName, style2Wite._fontName)) + if (lstrcmp(oldFontName, style2Write._fontName)) { - element->SetAttribute(TEXT("fontName"), style2Wite._fontName); - style2Sync._fontName = style2Wite._fontName = element->Attribute(TEXT("fontName")); + element->SetAttribute(TEXT("fontName"), style2Write._fontName); + style2Sync._fontName = style2Write._fontName = element->Attribute(TEXT("fontName")); } } - if (style2Wite._fontSize != -1) + if (style2Write._fontSize != -1) { - if (!style2Wite._fontSize) + if (!style2Write._fontSize) element->SetAttribute(TEXT("fontSize"), TEXT("")); else - element->SetAttribute(TEXT("fontSize"), style2Wite._fontSize); - } - - if (style2Wite._fontStyle != -1) - { - element->SetAttribute(TEXT("fontStyle"), style2Wite._fontStyle); + element->SetAttribute(TEXT("fontSize"), style2Write._fontSize); } + element->SetAttribute(TEXT("fontStyle"), style2Write._fontStyle); - if (style2Wite._keywords) + if (style2Write._keywords) { TiXmlNode *teteDeNoeud = element->LastChild(); if (teteDeNoeud) - teteDeNoeud->SetValue(style2Wite._keywords->c_str()); + teteDeNoeud->SetValue(style2Write._keywords->c_str()); else - element->InsertEndChild(TiXmlText(style2Wite._keywords->c_str())); + element->InsertEndChild(TiXmlText(style2Write._keywords->c_str())); } } @@ -5189,31 +5323,27 @@ void NppParameters::insertUserLang2Tree(TiXmlNode *node, UserLangContainer *user rootElement->SetAttribute(TEXT("name"), userLang->_name); rootElement->SetAttribute(TEXT("ext"), userLang->_ext); + rootElement->SetAttribute(TEXT("udlVersion"), TEXT("2.0")); 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")); - if (userLang->_escapeChar[0]) - globalElement->SetAttribute(TEXT("escapeChar"), userLang->_escapeChar); - - TiXmlElement *treatAsSymbolElement = (settingsElement->InsertEndChild(TiXmlElement(TEXT("TreatAsSymbol"))))->ToElement(); - treatAsSymbolElement->SetAttribute(TEXT("comment"), userLang->_isCommentSymbol?TEXT("yes"):TEXT("no")); - treatAsSymbolElement->SetAttribute(TEXT("commentLine"), userLang->_isCommentLineSymbol?TEXT("yes"):TEXT("no")); + 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")); TiXmlElement *prefixElement = (settingsElement->InsertEndChild(TiXmlElement(TEXT("Prefix"))))->ToElement(); - TCHAR names[nbPrefixListAllowed][7] = {TEXT("words1"), TEXT("words2"), TEXT("words3"), TEXT("words4")}; - for (int i = 0 ; i < nbPrefixListAllowed ; i++) - prefixElement->SetAttribute(names[i], userLang->_isPrefix[i]?TEXT("yes"):TEXT("no")); + 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")); } TiXmlElement *kwlElement = (rootElement->InsertEndChild(TiXmlElement(TEXT("KeywordLists"))))->ToElement(); - const int nbKWL = 9; - TCHAR kwn[nbKWL][16] = {TEXT("Delimiters"), TEXT("Folder+"), TEXT("Folder-"), TEXT("Operators"), TEXT("Comment"), TEXT("Words1"), TEXT("Words2"), TEXT("Words3"), TEXT("Words4")}; - for (int i = 0 ; i < nbKWL ; i++) + for (int i = 0 ; i < SCE_USER_KWLIST_TOTAL ; i++) { TiXmlElement *kwElement = (kwlElement->InsertEndChild(TiXmlElement(TEXT("Keywords"))))->ToElement(); - kwElement->SetAttribute(TEXT("name"), kwn[i]); + kwElement->SetAttribute(TEXT("name"), keywordListMapper[i]); + kwElement->SetAttribute(TEXT("id"), i); kwElement->InsertEndChild(TiXmlText(userLang->_keywordLists[i])); } @@ -5222,54 +5352,52 @@ void NppParameters::insertUserLang2Tree(TiXmlNode *node, UserLangContainer *user for (int i = 0 ; i < userLang->_styleArray.getNbStyler() ; i++) { TiXmlElement *styleElement = (styleRootElement->InsertEndChild(TiXmlElement(TEXT("WordsStyle"))))->ToElement(); - Style style2Wite = userLang->_styleArray.getStyler(i); + Style style2Write = userLang->_styleArray.getStyler(i); + + if (style2Write._styleID == -1) + continue; + + styleElement->SetAttribute(TEXT("name"), style2Write._styleDesc); - styleElement->SetAttribute(TEXT("name"), style2Wite._styleDesc); + styleElement->SetAttribute(TEXT("styleID"), style2Write._styleID); - styleElement->SetAttribute(TEXT("styleID"), style2Wite._styleID); - - //if (HIBYTE(HIWORD(style2Wite._fgColor)) != 0xFF) + //if (HIBYTE(HIWORD(style2Write._fgColor)) != 0xFF) { - int rgbVal = RGB2int(style2Wite._fgColor); + int rgbVal = RGB2int(style2Write._fgColor); TCHAR fgStr[7]; wsprintf(fgStr, TEXT("%.6X"), rgbVal); styleElement->SetAttribute(TEXT("fgColor"), fgStr); } - //if (HIBYTE(HIWORD(style2Wite._bgColor)) != 0xFF) + //if (HIBYTE(HIWORD(style2Write._bgColor)) != 0xFF) { - int rgbVal = RGB2int(style2Wite._bgColor); + int rgbVal = RGB2int(style2Write._bgColor); TCHAR bgStr[7]; wsprintf(bgStr, TEXT("%.6X"), rgbVal); styleElement->SetAttribute(TEXT("bgColor"), bgStr); } - if (style2Wite._colorStyle != COLORSTYLE_ALL) + if (style2Write._colorStyle != COLORSTYLE_ALL) { - styleElement->SetAttribute(TEXT("colorStyle"), style2Wite._colorStyle); + styleElement->SetAttribute(TEXT("colorStyle"), style2Write._colorStyle); } - if (style2Wite._fontName) + if (style2Write._fontName) { - styleElement->SetAttribute(TEXT("fontName"), style2Wite._fontName); + styleElement->SetAttribute(TEXT("fontName"), style2Write._fontName); } - if (style2Wite._fontStyle == -1) - { - styleElement->SetAttribute(TEXT("fontStyle"), TEXT("0")); - } - else - { - styleElement->SetAttribute(TEXT("fontStyle"), style2Wite._fontStyle); - } + styleElement->SetAttribute(TEXT("fontStyle"), style2Write._fontStyle); - if (style2Wite._fontSize != -1) + if (style2Write._fontSize != -1) { - if (!style2Wite._fontSize) + if (!style2Write._fontSize) styleElement->SetAttribute(TEXT("fontSize"), TEXT("")); else - styleElement->SetAttribute(TEXT("fontSize"), style2Wite._fontSize); + styleElement->SetAttribute(TEXT("fontSize"), style2Write._fontSize); } + + styleElement->SetAttribute(TEXT("nesting"), style2Write._nesting); } } diff --git a/PowerEditor/src/Parameters.h b/PowerEditor/src/Parameters.h index 6c06246b..24efa4b8 100644 --- a/PowerEditor/src/Parameters.h +++ b/PowerEditor/src/Parameters.h @@ -65,6 +65,8 @@ #include "ContextMenu.h" #endif //CONTEXTMENU +#include + class NativeLangSpeaker; using namespace std; @@ -250,6 +252,7 @@ struct DockingManagerData { } }; +const int FONTSTYLE_NONE = 0; const int FONTSTYLE_BOLD = 1; const int FONTSTYLE_ITALIC = 2; const int FONTSTYLE_UNDERLINE = 4; @@ -269,11 +272,12 @@ struct Style const TCHAR *_fontName; int _fontStyle; int _fontSize; + int _nesting; int _keywordClass; generic_string *_keywords; - Style():_styleID(-1), _styleDesc(NULL), _fgColor(COLORREF(-1)), _bgColor(COLORREF(-1)), _colorStyle(COLORSTYLE_ALL), _fontName(NULL), _fontStyle(-1), _fontSize(-1), _keywordClass(-1), _keywords(NULL){}; + Style():_styleID(-1), _styleDesc(NULL), _fgColor(COLORREF(-1)), _bgColor(COLORREF(-1)), _colorStyle(COLORSTYLE_ALL), _fontName(NULL), _fontStyle(FONTSTYLE_NONE), _fontSize(-1), _keywordClass(-1), _keywords(NULL), _nesting(0){}; ~Style(){ if (_keywords) @@ -291,6 +295,7 @@ struct Style _fontSize = style._fontSize; _fontStyle = style._fontStyle; _keywordClass = style._keywordClass; + _nesting = style._nesting; if (style._keywords) _keywords = new generic_string(*(style._keywords)); else @@ -309,6 +314,7 @@ struct Style this->_fontSize = style._fontSize; this->_fontStyle = style._fontStyle; this->_keywordClass = style._keywordClass; + this->_nesting = style._nesting; if (!(this->_keywords) && style._keywords) this->_keywords = new generic_string(*(style._keywords)); @@ -344,8 +350,6 @@ struct GlobalOverride GlobalOverride():enableFg(false), enableBg(false), enableFont(false), enableFontSize(false), enableBold(false), enableItalic(false), enableUnderLine(false) {}; }; -const int MAX_STYLE = 30; - struct StyleArray { public: @@ -372,15 +376,15 @@ public: return _styleArray[index]; }; - bool hasEnoughSpace() {return (_nbStyler < MAX_STYLE);}; + bool hasEnoughSpace() {return (_nbStyler < SCE_USER_STYLE_TOTAL_STYLES);}; void addStyler(int styleID, TiXmlNode *styleNode); - void addStyler(int styleID, TCHAR *styleName) { + void addStyler(int styleID, const TCHAR *styleName) { //ZeroMemory(&_styleArray[_nbStyler], sizeof(Style));; - _styleArray[_nbStyler]._styleID = styleID; - _styleArray[_nbStyler]._styleDesc = styleName; - _styleArray[_nbStyler]._fgColor = black; - _styleArray[_nbStyler]._bgColor = white; + _styleArray[styleID]._styleID = styleID; + _styleArray[styleID]._styleDesc = styleName; + _styleArray[styleID]._fgColor = black; + _styleArray[styleID]._bgColor = white; _nbStyler++; }; @@ -401,7 +405,7 @@ public: }; protected: - Style _styleArray[MAX_STYLE]; + Style _styleArray[SCE_USER_STYLE_TOTAL_STYLES]; int _nbStyler; }; @@ -887,25 +891,26 @@ friend class KeyWordsStyleDialog; friend class CommentStyleDialog; friend class SymbolsStyleDialog; friend class UserDefineDialog; +friend class StylerDlg; public : UserLangContainer(){ _name = TEXT("new user define"); _ext = TEXT(""); - _escapeChar[0] = '\0'; - _escapeChar[1] = '\0'; + _udlVersion = TEXT(""); + _allowFoldOfComments = false; + _forceLineCommentsAtBOL = false; + _foldCompact = false; - // Keywords list of Delimiters (index 0) - lstrcpy(_keywordLists[0], TEXT("000000")); - for (int i = 1 ; i < nbKeywodList ; i++) + for (int i = 0 ; i < SCE_USER_KWLIST_TOTAL ; i++) *_keywordLists[i] = '\0'; }; - UserLangContainer(const TCHAR *name, const TCHAR *ext) : _name(name), _ext(ext) { - // Keywords list of Delimiters (index 0) - lstrcpy(_keywordLists[0], TEXT("000000")); - _escapeChar[0] = '\0'; - _escapeChar[1] = '\0'; - for (int j = 1 ; j < nbKeywodList ; j++) + 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'; }; @@ -914,10 +919,12 @@ public : { this->_name = ulc._name; this->_ext = ulc._ext; - this->_escapeChar[0] = ulc._escapeChar[0]; - this->_escapeChar[1] = '\0'; + this->_udlVersion = ulc._udlVersion; this->_isCaseIgnored = ulc._isCaseIgnored; this->_styleArray = ulc._styleArray; + this->_allowFoldOfComments = ulc._allowFoldOfComments; + this->_forceLineCommentsAtBOL = ulc._forceLineCommentsAtBOL; + this->_foldCompact = ulc._foldCompact; int nbStyler = this->_styleArray.getNbStyler(); for (int i = 0 ; i < nbStyler ; i++) { @@ -927,28 +934,31 @@ public : if (st._fgColor == COLORREF(-1)) st._fgColor = black; } - for (int i = 0 ; i < nbKeywodList ; i++) - lstrcpy(this->_keywordLists[i], ulc._keywordLists[i]); + for (int i = 0 ; i < SCE_USER_KWLIST_TOTAL ; i++) + lstrcpy(this->_keywordLists[i], ulc._keywordLists[i]); } return *this; }; - int getNbKeywordList() {return nbKeywodList;}; + // int getNbKeywordList() {return SCE_USER_KWLIST_TOTAL;}; const TCHAR * getName() {return _name.c_str();}; const TCHAR * getExtention() {return _ext.c_str();}; + const TCHAR * getUdlVersion() {return _udlVersion.c_str();}; private: + StyleArray _styleArray; generic_string _name; generic_string _ext; + generic_string _udlVersion; - StyleArray _styleArray; - TCHAR _keywordLists[nbKeywodList][max_char]; + //TCHAR _keywordLists[nbKeywodList][max_char]; + TCHAR _keywordLists[SCE_USER_KWLIST_TOTAL][max_char]; bool _isCaseIgnored; - bool _isCommentLineSymbol; - bool _isCommentSymbol; - bool _isPrefix[nbPrefixListAllowed]; - TCHAR _escapeChar[2]; + bool _allowFoldOfComments; + bool _forceLineCommentsAtBOL; + bool _foldCompact; + bool _isPrefix[SCE_USER_TOTAL_KEYWORD_GROUPS]; }; #define MAX_EXTERNAL_LEXER_NAME_LEN 16 @@ -1284,7 +1294,7 @@ public: return false; }; - const TCHAR * getUserDefinedLangNameFromExt(TCHAR *ext) { + const TCHAR * getUserDefinedLangNameFromExt(TCHAR *ext, TCHAR *fullName) { if ((!ext) || (!ext[0])) return NULL; @@ -1293,7 +1303,7 @@ public: vector extVect; cutString(_userLangArray[i]->_ext.c_str(), extVect); for (size_t j = 0 ; j < extVect.size() ; j++) - if (!generic_stricmp(extVect[j].c_str(), ext)) + if (!generic_stricmp(extVect[j].c_str(), ext) || (_tcschr(fullName, '.') && !generic_stricmp(extVect[j].c_str(), fullName))) return _userLangArray[i]->_name.c_str(); } return NULL; @@ -1611,7 +1621,7 @@ private: void getActions(TiXmlNode *node, Macro & macro); bool getShortcuts(TiXmlNode *node, Shortcut & sc); - void writeStyle2Element(Style & style2Wite, Style & style2Sync, TiXmlElement *element); + void writeStyle2Element(Style & style2Write, Style & style2Sync, TiXmlElement *element); void insertUserLang2Tree(TiXmlNode *node, UserLangContainer *userLang); void insertCmd(TiXmlNode *cmdRoot, const CommandShortcut & cmd); void insertMacro(TiXmlNode *macrosRoot, const MacroShortcut & macro); diff --git a/PowerEditor/src/ScitillaComponent/Buffer.cpp b/PowerEditor/src/ScitillaComponent/Buffer.cpp index 1710bc1b..8731a0c4 100644 --- a/PowerEditor/src/ScitillaComponent/Buffer.cpp +++ b/PowerEditor/src/ScitillaComponent/Buffer.cpp @@ -117,7 +117,7 @@ void Buffer::setFileName(const TCHAR *fn, LangType defaultLang) ext += 1; // Define User Lang firstly - const TCHAR *langName = pNppParamInst->getUserDefinedLangNameFromExt(ext); + const TCHAR *langName = pNppParamInst->getUserDefinedLangNameFromExt(ext, _fileName); if (langName) { newLang = L_USER; diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp index e76215b6..54588f2b 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp @@ -475,8 +475,8 @@ void ScintillaEditView::setStyle(Style styleToSet) if (go.enableFontSize && (style._fontSize > 0)) styleToSet._fontSize = style._fontSize; - if (style._fontStyle != -1) - { + //if (style._fontStyle != -1) + //{ if (go.enableBold) { if (style._fontStyle & FONTSTYLE_BOLD) @@ -498,7 +498,7 @@ void ScintillaEditView::setStyle(Style styleToSet) else styleToSet._fontStyle &= ~FONTSTYLE_UNDERLINE; } - } + //} } } setSpecialStyle(styleToSet); @@ -607,6 +607,7 @@ void ScintillaEditView::setEmbeddedAspLexer() void ScintillaEditView::setUserLexer(const TCHAR *userLangName) { + int setKeywordsCounter = 0; execute(SCI_SETLEXER, SCLEX_USER); UserLangContainer * userLangContainer = userLangName?NppParameters::getInstance()->getULCFromName(userLangName):_userDefineDlg._pCurrentUserLang; @@ -614,31 +615,154 @@ void ScintillaEditView::setUserLexer(const TCHAR *userLangName) if (!userLangContainer) return; - execute(SCI_SETPROPERTY, reinterpret_cast("fold"), reinterpret_cast("1")); - execute(SCI_SETPROPERTY, (WPARAM)"userDefine.ignoreCase", (LPARAM)(userLangContainer->_isCaseIgnored?"1":"0")); - execute(SCI_SETPROPERTY, (WPARAM)"userDefine.commentLineSymbol", (LPARAM)(userLangContainer->_isCommentLineSymbol?"1":"0")); - execute(SCI_SETPROPERTY, (WPARAM)"userDefine.commentSymbol", (LPARAM)(userLangContainer->_isCommentSymbol?"1":"0")); - char buf[4]; - execute(SCI_SETPROPERTY, (WPARAM)"userDefine.escapeChar", reinterpret_cast((userLangContainer->_escapeChar[0]) ? itoa(userLangContainer->_escapeChar[0],buf,10) : "0")); - - const char strArray[4][20] = {"userDefine.g1Prefix", "userDefine.g2Prefix", "userDefine.g3Prefix", "userDefine.g4Prefix"}; - for (int i = 0 ; i < 4 ; i++) - execute(SCI_SETPROPERTY, (WPARAM)strArray[i], (LPARAM)(userLangContainer->_isPrefix[i]?"1":"0")); - - for (int i = 0 ; i < userLangContainer->getNbKeywordList() ; i++) + UINT codepage = CP_ACP; + UniMode unicodeMode = _currentBuffer->getUnicodeMode(); + int encoding = _currentBuffer->getEncoding(); + if (encoding == -1) { -#ifdef UNICODE - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); - const char * keyWords_char = wmc->wchar2char(userLangContainer->_keywordLists[i], CP_ACP); - execute(SCI_SETKEYWORDS, i, reinterpret_cast(keyWords_char)); -#else - execute(SCI_SETKEYWORDS, i, reinterpret_cast(userLangContainer->_keywordLists[i])); -#endif + if (unicodeMode == uniUTF8 || unicodeMode == uniCookie) + codepage = CP_UTF8; + } + else + { + codepage = CP_OEMCP; // system OEM code page might not match user selection for character set, + // but this is the best match WideCharToMultiByte offers } + 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"; + 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 + const char * keyWords_char = userLangContainer->_keywordLists[i]; +#else + WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); + const char * keyWords_char = wmc->wchar2char(userLangContainer->_keywordLists[i], codepage); +#endif + if (i == SCE_USER_KWLIST_COMMENTS) + { + 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)); + } + else // OPERATORS2, FOLDERS_IN_CODE2, FOLDERS_IN_COMMENT, KEYWORDS1-8 + { + char temp[max_char]; + bool inDoubleQuote = false; + bool inSingleQuote = false; + bool nonWSFound = false; + int index = 0; + for (unsigned int j=0; j ' ') // copy non-whitespace unconditionally + { + temp[index++] = keyWords_char[j]; + if (nonWSFound == false) + nonWSFound = true; + } + else if (nonWSFound == true && keyWords_char[j-1] != '"' && keyWords_char[j+1] != '"' && keyWords_char[j+1] > ' ') + { + temp[index++] = inDoubleQuote ? '\v' : '\b'; + } + else + continue; + } + else + { + temp[index++] = keyWords_char[j]; + } + + } + temp[index++] = 0; + execute(SCI_SETKEYWORDS, setKeywordsCounter++, reinterpret_cast(temp)); + } + } + + // 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 nestingBuffer[] = "userDefine.nesting.00"; + for (int i = 0 ; i < userLangContainer->_styleArray.getNbStyler() ; i++) { Style & style = userLangContainer->_styleArray.getStyler(i); + + if (style._styleID == -1) + continue; + + if (i < 10) itoa(i, (nestingBuffer+20), 10); + else itoa(i, (nestingBuffer+19), 10); + execute(SCI_SETPROPERTY, (WPARAM)nestingBuffer, (LPARAM)(itoa(style._nesting, intBuffer, 10))); + setStyle(style); } } diff --git a/PowerEditor/src/ScitillaComponent/UserDefineDialog.cpp b/PowerEditor/src/ScitillaComponent/UserDefineDialog.cpp index de67ad89..4a436530 100644 --- a/PowerEditor/src/ScitillaComponent/UserDefineDialog.cpp +++ b/PowerEditor/src/ScitillaComponent/UserDefineDialog.cpp @@ -34,178 +34,33 @@ #include "resource.h" #include "Notepad_plus_msgs.h" #include "FileDialog.h" +#include "Common.h" UserLangContainer * SharedParametersDialog::_pUserLang = NULL; ScintillaEditView * SharedParametersDialog::_pScintilla = NULL; -void SharedParametersDialog::initControls() +bool SharedParametersDialog::setPropertyByCheck(HWND hwnd, WPARAM id, bool & bool2set) { - NppParameters *pNppParam = NppParameters::getInstance(); - for (int i = 0 ; i < _nbGroup ; i++) + bool2set = (BST_CHECKED == ::SendMessage(::GetDlgItem(hwnd, id), BM_GETCHECK, 0, 0)); + + if (_pScintilla->getCurrentBuffer()->getLangType() == L_USER) + _pScintilla->styleChange(); + + return TRUE; +} + +BOOL CALLBACK SharedParametersDialog::run_dlgProc(UINT Message, WPARAM wParam, LPARAM /*lParam*/) +{ + switch (Message) { - HWND hFgColourStaticText = ::GetDlgItem(_hSelf, _fgStatic[i]); - HWND hBgColourStaticText = ::GetDlgItem(_hSelf, _bgStatic[i]); - - _pFgColour[i] = new ColourPicker; - _pFgColour[i]->init(_hInst, _hSelf); - _pFgColour[i]->setColour(black); - - _pBgColour[i] = new ColourPicker; - _pBgColour[i]->init(_hInst, _hSelf); - _pBgColour[i]->setColour(white); - - POINT p1, p2; - - alignWith(hFgColourStaticText, _pFgColour[i]->getHSelf(), ALIGNPOS_RIGHT, p1); - alignWith(hBgColourStaticText, _pBgColour[i]->getHSelf(), ALIGNPOS_RIGHT, p2); - - p1.x = p2.x = ((p1.x > p2.x)?p1.x:p2.x) + 10; - p1.y -= 4; p2.y -= 4; - - ::MoveWindow(_pFgColour[i]->getHSelf(), p1.x, p1.y, 25, 25, TRUE); - ::MoveWindow(_pBgColour[i]->getHSelf(), p2.x, p2.y, 25, 25, TRUE); - _pFgColour[i]->display(); - _pBgColour[i]->display(); - - //for the font size combos - for(int j = 0 ; j < int(sizeof(fontSizeStrs))/(3*sizeof(TCHAR)) ; j++) + case WM_INITDIALOG : { - ::SendDlgItemMessage(_hSelf, _fontSizeCombo[i], CB_ADDSTRING, 0, (LPARAM)fontSizeStrs[j]); - } - - //for the font name combos - HWND hFontNameCombo = ::GetDlgItem(_hSelf, _fontNameCombo[i]); - - const std::vector & fontlist = pNppParam->getFontList(); - for (int j = 0 ; j < int(fontlist.size()) ; j++) - { - int k = ::SendMessage(hFontNameCombo, CB_ADDSTRING, 0, (LPARAM)fontlist[j].c_str()); - ::SendMessage(hFontNameCombo, CB_SETITEMDATA, k, (LPARAM)fontlist[j].c_str()); - } - } -} - -bool SharedParametersDialog::setPropertyByCheck(HWND hwnd, WPARAM id, bool & bool2set) -{ - bool2set = (BST_CHECKED == ::SendMessage(::GetDlgItem(hwnd, id), BM_GETCHECK, 0, 0)); - - if (_pScintilla->getCurrentBuffer()->getLangType() == L_USER) - _pScintilla->styleChange(); - return TRUE; -} - -void SharedParametersDialog::styleUpdate(const Style & style, ColourPicker *pFgColourPicker, ColourPicker *pBgColourPicker, - int fontComboId, int fontSizeComboId, int boldCheckId, int italicCheckId, int underlineCheckId) -{ - pFgColourPicker->setColour((style._fgColor == COLORREF(-1))?black:style._fgColor); - pFgColourPicker->setEnabled((style._colorStyle & COLORSTYLE_FOREGROUND) != 0); - pFgColourPicker->redraw(); - pBgColourPicker->setColour((style._bgColor == COLORREF(-1))?white:style._bgColor); - pBgColourPicker->setEnabled((style._colorStyle & COLORSTYLE_BACKGROUND) != 0); - pBgColourPicker->redraw(); - - HWND hFontCombo = ::GetDlgItem(_hSelf, fontComboId); - int i = ::SendMessage(hFontCombo, CB_FINDSTRINGEXACT, (WPARAM)-1, (LPARAM)style._fontName); - if (i == CB_ERR) - i = 0; - ::SendMessage(hFontCombo, CB_SETCURSEL, i, 0); - - TCHAR size[10]; - if (style._fontSize == -1) - size[0] = '\0'; - else - wsprintf(size, TEXT("%d"), style._fontSize); - - hFontCombo = ::GetDlgItem(_hSelf, fontSizeComboId); - i = ::SendMessage(hFontCombo, CB_FINDSTRINGEXACT, (WPARAM)-1, (LPARAM)size); - if (i != CB_ERR) - ::SendMessage(hFontCombo, CB_SETCURSEL, i, 0); - int isBold = 0; - int isItalic = 0; - int isUnderline = 0; - if (style._fontStyle != -1) - { - isBold = (style._fontStyle & FONTSTYLE_BOLD)?BST_CHECKED:BST_UNCHECKED; - isItalic = (style._fontStyle & FONTSTYLE_ITALIC)?BST_CHECKED:BST_UNCHECKED; - isUnderline = (style._fontStyle & FONTSTYLE_UNDERLINE)?BST_CHECKED:BST_UNCHECKED; - } - ::SendDlgItemMessage(_hSelf, boldCheckId, BM_SETCHECK, isBold, 0); - ::SendDlgItemMessage(_hSelf, italicCheckId, BM_SETCHECK, isItalic, 0); - ::SendDlgItemMessage(_hSelf, underlineCheckId, BM_SETCHECK, isUnderline, 0); -} - -int fgStatic[] = {IDC_DEFAULT_FG_STATIC, IDC_FOLDEROPEN_FG_STATIC, IDC_FOLDERCLOSE_FG_STATIC}; -int bgStatic[] = {IDC_DEFAULT_BG_STATIC, IDC_FOLDEROPEN_BG_STATIC, IDC_FOLDERCLOSE_BG_STATIC}; -int fontSizeCombo[] = {IDC_DEFAULT_FONTSIZE_COMBO, IDC_FOLDEROPEN_FONTSIZE_COMBO, IDC_FOLDERCLOSE_FONTSIZE_COMBO}; -int fontNameCombo[] = {IDC_DEFAULT_FONT_COMBO, IDC_FOLDEROPEN_FONT_COMBO, IDC_FOLDERCLOSE_FONT_COMBO}; - -FolderStyleDialog::FolderStyleDialog() : SharedParametersDialog(3) -{ - memcpy(_fgStatic, fgStatic, sizeof(fgStatic)); - memcpy(_bgStatic, bgStatic, sizeof(bgStatic)); - memcpy(_fontSizeCombo, fontSizeCombo, sizeof(fontSizeCombo)); - memcpy(_fontNameCombo, fontNameCombo, sizeof(fontNameCombo)); -} - -void FolderStyleDialog::setKeywords2List(int ctrlID) -{ - int index; - if (ctrlID == IDC_FOLDEROPEN_EDIT) - index = 1; - else if (ctrlID == IDC_FOLDERCLOSE_EDIT) - index = 2; - else - index = -1; - - if (index != -1) - ::GetDlgItemText(_hSelf, ctrlID, _pUserLang->_keywordLists[index], max_char); -} - -int FolderStyleDialog::getGroupIndexFromCombo(int ctrlID, bool & isFontSize) const -{ - switch (ctrlID) - { - case IDC_DEFAULT_FONT_COMBO : - isFontSize = false; - return STYLE_DEFAULT_INDEX; - - case IDC_DEFAULT_FONTSIZE_COMBO : - isFontSize = true; - return STYLE_DEFAULT_INDEX; - - case IDC_FOLDEROPEN_FONT_COMBO : - isFontSize = false; - return STYLE_BLOCK_OPEN_INDEX; - - case IDC_FOLDEROPEN_FONTSIZE_COMBO : - isFontSize = true; - return STYLE_BLOCK_OPEN_INDEX; - - case IDC_FOLDERCLOSE_FONT_COMBO : - isFontSize = false; - return STYLE_BLOCK_CLOSE_INDEX; - - case IDC_FOLDERCLOSE_FONTSIZE_COMBO : - isFontSize = true; - return STYLE_BLOCK_CLOSE_INDEX; - - default : - return -1; - } -} - -BOOL CALLBACK SharedParametersDialog::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam) -{ - switch (Message) - { - case WM_INITDIALOG : - { - initControls(); + // initControls(); return TRUE; - } + } - case WM_COMMAND : - { + case WM_COMMAND : + { if (HIWORD(wParam) == EN_CHANGE) { setKeywords2List(LOWORD(wParam)); @@ -215,569 +70,142 @@ BOOL CALLBACK SharedParametersDialog::run_dlgProc(UINT Message, WPARAM wParam, L return TRUE; } - else if (HIWORD(wParam) == CBN_SELCHANGE) + return FALSE; + } + } + return FALSE; +} + +BOOL CALLBACK FolderStyleDialog::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam) +{ + switch (Message) + { + case WM_INITDIALOG : + { + _pageLink.init(_hInst, _hSelf); + _pageLink.create(::GetDlgItem(_hSelf, IDC_WEB_HELP_LINK), TEXT("http://udl20.weebly.com/")); + return TRUE; + } + + case WM_COMMAND : + { + switch (wParam) { - bool isFontSize; - int k = getGroupIndexFromCombo(LOWORD(wParam), isFontSize); - - if (k != -1) - { - int i = ::SendDlgItemMessage(_hSelf, LOWORD(wParam), CB_GETCURSEL, 0, 0); - Style & style = _pUserLang->_styleArray.getStyler(k); - if (isFontSize) - { - TCHAR intStr[5]; - if (i != 0) - { - ::SendDlgItemMessage(_hSelf, LOWORD(wParam), CB_GETLBTEXT, i, (LPARAM)intStr); - if (!intStr[0]) - style._fontSize = -1; - else - { - TCHAR *finStr; - style._fontSize = generic_strtol(intStr, &finStr, 10); - if (*finStr != '\0') - style._fontSize = -1; - } - } - } - else - { - style._fontName = (TCHAR *)::SendDlgItemMessage(_hSelf, LOWORD(wParam), CB_GETITEMDATA, i, 0); - } - if (_pScintilla->getCurrentBuffer()->getLangType() == L_USER) - _pScintilla->styleChange(); - return TRUE; - } - } - else if (HIWORD(wParam) == CPN_COLOURPICKED) - { - bool isFG; - ColourPicker *pCP; - int index = getStylerIndexFromCP((HWND)lParam, isFG, &pCP); - if (index != -1) + case IDC_FOLDER_FOLD_COMPACT : { - Style & style = _pUserLang->_styleArray.getStyler(index); - if (isFG) { - style._fgColor = pCP->getColour(); - if (pCP->isEnabled()) - style._colorStyle |= COLORSTYLE_FOREGROUND; - else - style._colorStyle &= ~COLORSTYLE_FOREGROUND; - } else { - style._bgColor = pCP->getColour(); - if (pCP->isEnabled()) - style._colorStyle |= COLORSTYLE_BACKGROUND; - else - style._colorStyle &= ~COLORSTYLE_BACKGROUND; - } - } - // A cause de "#define CPN_COLOURPICKED (BN_CLICKED)" - // Nous sommes obligés de mettre ce bloc ici !!! - // A modifier !!! - else - { - int fontStyleMask; - int k = getGroupeIndexFromCheck(wParam, fontStyleMask); - - if (k != -1) - { - Style & style = _pUserLang->_styleArray.getStyler(k); - if (style._fontStyle == -1) - style._fontStyle = 0; - style._fontStyle ^= fontStyleMask; - //::MessageBox(NULL, TEXT("Bingo!!!"), TEXT(""), MB_OK); - } - } - if (_pScintilla->getCurrentBuffer()->getLangType() == L_USER) - _pScintilla->styleChange(); - return TRUE; - } - return FALSE; - } - /* - case WM_SIZE : - { - redraw(); - return TRUE; - } - */ - case WM_DESTROY: - { - for (int i = 0 ; i < _nbGroup ; i++) - { - _pFgColour[i]->destroy(); - _pBgColour[i]->destroy(); - - delete _pFgColour[i]; - delete _pBgColour[i]; - } - return TRUE; - } - } - return FALSE; -} - -void FolderStyleDialog::updateDlg() -{ - ::SendDlgItemMessage(_hSelf, IDC_FOLDEROPEN_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[KWL_FOLDER_OPEN_INDEX])); - ::SendDlgItemMessage(_hSelf, IDC_FOLDERCLOSE_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[KWL_FOLDER_CLOSE_INDEX])); - - Style & defaultStyle = _pUserLang->_styleArray.getStyler(STYLE_DEFAULT_INDEX); - styleUpdate(defaultStyle, _pFgColour[0], _pBgColour[0], IDC_DEFAULT_FONT_COMBO, IDC_DEFAULT_FONTSIZE_COMBO, - IDC_DEFAULT_BOLD_CHECK, IDC_DEFAULT_ITALIC_CHECK, IDC_DEFAULT_UNDERLINE_CHECK); - - Style & foStyle = _pUserLang->_styleArray.getStyler(STYLE_BLOCK_OPEN_INDEX); - styleUpdate(foStyle, _pFgColour[1], _pBgColour[1], IDC_FOLDEROPEN_FONT_COMBO, IDC_FOLDEROPEN_FONTSIZE_COMBO, - IDC_FOLDEROPEN_BOLD_CHECK, IDC_FOLDEROPEN_ITALIC_CHECK, IDC_FOLDEROPEN_UNDERLINE_CHECK); - - Style & fcStyle = _pUserLang->_styleArray.getStyler(STYLE_BLOCK_CLOSE_INDEX); - styleUpdate(fcStyle, _pFgColour[2], _pBgColour[2], IDC_FOLDERCLOSE_FONT_COMBO, IDC_FOLDERCLOSE_FONTSIZE_COMBO, - IDC_FOLDERCLOSE_BOLD_CHECK, IDC_FOLDERCLOSE_ITALIC_CHECK, IDC_FOLDERCLOSE_UNDERLINE_CHECK); -} - -int FolderStyleDialog::getStylerIndexFromCP(HWND hWnd, bool & isFG, ColourPicker **ppCP) const -{ - for (int i = 0 ; i < _nbGroup ; i++) - { - if (hWnd == _pFgColour[i]->getHSelf()) - { - *ppCP = _pFgColour[i]; - isFG = true; - return i; + 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); + stylerDlg.doDialog(); + return TRUE; + } + case IDC_FOLDER_IN_CODE2_STYLER : + { + StylerDlg stylerDlg(_hInst, _hSelf, SCE_USER_STYLE_FOLDER_IN_CODE2, SCE_USER_MASK_NESTING_NONE); + stylerDlg.doDialog(); + return TRUE; + } + case IDC_FOLDER_IN_COMMENT_STYLER : + { + StylerDlg stylerDlg(_hInst, _hSelf, SCE_USER_STYLE_FOLDER_IN_COMMENT, SCE_USER_MASK_NESTING_NONE); + stylerDlg.doDialog(); + return TRUE; + } + case IDC_DEFAULT_STYLER : + { + StylerDlg stylerDlg(_hInst, _hSelf, SCE_USER_STYLE_DEFAULT, SCE_USER_MASK_NESTING_NONE); + stylerDlg.doDialog(); + return TRUE; + } + default : + return SharedParametersDialog::run_dlgProc(Message, wParam, lParam); + } } - if (hWnd == _pBgColour[i]->getHSelf()) + case WM_DESTROY: { - *ppCP = _pBgColour[i]; - isFG = false; - return i; + _pageLink.destroy(); + return TRUE; } - } - return -1; -} - -int FolderStyleDialog::getGroupeIndexFromCheck(int ctrlID, int & fontStyleMask) const -{ - switch (ctrlID) - { - case IDC_DEFAULT_BOLD_CHECK : - fontStyleMask = FONTSTYLE_BOLD; - return STYLE_DEFAULT_INDEX; - - case IDC_DEFAULT_ITALIC_CHECK : - fontStyleMask = FONTSTYLE_ITALIC; - return STYLE_DEFAULT_INDEX; - - case IDC_DEFAULT_UNDERLINE_CHECK : - fontStyleMask = FONTSTYLE_UNDERLINE; - return STYLE_DEFAULT_INDEX; - - case IDC_FOLDEROPEN_BOLD_CHECK : - fontStyleMask = FONTSTYLE_BOLD; - return STYLE_BLOCK_OPEN_INDEX; - - case IDC_FOLDEROPEN_ITALIC_CHECK : - fontStyleMask = FONTSTYLE_ITALIC; - return STYLE_BLOCK_OPEN_INDEX; - - case IDC_FOLDEROPEN_UNDERLINE_CHECK : - fontStyleMask = FONTSTYLE_UNDERLINE; - return STYLE_BLOCK_OPEN_INDEX; - - case IDC_FOLDERCLOSE_BOLD_CHECK : - fontStyleMask = FONTSTYLE_BOLD; - return STYLE_BLOCK_CLOSE_INDEX; - - case IDC_FOLDERCLOSE_ITALIC_CHECK : - fontStyleMask = FONTSTYLE_ITALIC; - return STYLE_BLOCK_CLOSE_INDEX; - - case IDC_FOLDERCLOSE_UNDERLINE_CHECK : - fontStyleMask = FONTSTYLE_UNDERLINE; - return STYLE_BLOCK_CLOSE_INDEX; - default : - return -1; + return SharedParametersDialog::run_dlgProc(Message, wParam, lParam); } } -int fgStatic2[] = {IDC_KEYWORD1_FG_STATIC, IDC_KEYWORD2_FG_STATIC, IDC_KEYWORD3_FG_STATIC, IDC_KEYWORD4_FG_STATIC}; -int bgStatic2[] = {IDC_KEYWORD1_BG_STATIC, IDC_KEYWORD2_BG_STATIC, IDC_KEYWORD3_BG_STATIC, IDC_KEYWORD4_BG_STATIC}; -int fontSizeCombo2[] = {IDC_KEYWORD1_FONTSIZE_COMBO, IDC_KEYWORD2_FONTSIZE_COMBO, IDC_KEYWORD3_FONTSIZE_COMBO, IDC_KEYWORD4_FONTSIZE_COMBO}; -int fontNameCombo2[] = {IDC_KEYWORD1_FONT_COMBO, IDC_KEYWORD2_FONT_COMBO, IDC_KEYWORD3_FONT_COMBO, IDC_KEYWORD4_FONT_COMBO}; - -KeyWordsStyleDialog::KeyWordsStyleDialog() : SharedParametersDialog(4) +void FolderStyleDialog::setKeywords2List(int id) { - memcpy(_fgStatic, fgStatic2, sizeof(fgStatic2)); - memcpy(_bgStatic, bgStatic2, sizeof(bgStatic2)); - memcpy(_fontSizeCombo, fontSizeCombo2, sizeof(fontSizeCombo2)); - memcpy(_fontNameCombo, fontNameCombo2, sizeof(fontNameCombo2)); -} - - -BOOL CALLBACK KeyWordsStyleDialog::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam) -{ - switch (Message) - { - - case WM_COMMAND : - { - switch (wParam) - { - case IDC_KEYWORD1_PREFIX_CHECK : - return setPropertyByCheck(_hSelf, wParam, _pUserLang->_isPrefix[0]); - - case IDC_KEYWORD2_PREFIX_CHECK : - return setPropertyByCheck(_hSelf, wParam, _pUserLang->_isPrefix[1]); - - case IDC_KEYWORD3_PREFIX_CHECK : - return setPropertyByCheck(_hSelf, wParam, _pUserLang->_isPrefix[2]); - - case IDC_KEYWORD4_PREFIX_CHECK : - return setPropertyByCheck(_hSelf, wParam, _pUserLang->_isPrefix[3]); - } - } - default : - return SharedParametersDialog::run_dlgProc(Message, wParam, lParam); - } -} - -void KeyWordsStyleDialog::setKeywords2List(int id) -{ - int index; - switch (id) - { - case IDC_KEYWORD1_EDIT : index = 5; break; - case IDC_KEYWORD2_EDIT : index = 6; break; - case IDC_KEYWORD3_EDIT : index = 7; break; - case IDC_KEYWORD4_EDIT : index = 8; break; - default : index = -1; - } - if (index != -1) - ::GetDlgItemText(_hSelf, id, _pUserLang->_keywordLists[index], max_char); -} - -int KeyWordsStyleDialog::getStylerIndexFromCP(HWND hWnd, bool & isFG, ColourPicker **ppCP) const -{ - for (int i = 0 ; i < _nbGroup ; i++) - { - if (hWnd == _pFgColour[i]->getHSelf()) - { - *ppCP = _pFgColour[i]; - isFG = true; - return i+3; - } - if (hWnd == _pBgColour[i]->getHSelf()) - { - *ppCP = _pBgColour[i]; - isFG = false; - return i+3; - } - } - return -1; -} - - int KeyWordsStyleDialog::getGroupIndexFromCombo(int ctrlID, bool & isFontSize) const - { - switch (ctrlID) - { - case IDC_KEYWORD1_FONT_COMBO : - isFontSize = false; - return STYLE_WORD1_INDEX; - - case IDC_KEYWORD1_FONTSIZE_COMBO : - isFontSize = true; - return STYLE_WORD1_INDEX; - - case IDC_KEYWORD2_FONT_COMBO : - isFontSize = false; - return STYLE_WORD2_INDEX; - - case IDC_KEYWORD2_FONTSIZE_COMBO : - isFontSize = true; - return STYLE_WORD2_INDEX; - - case IDC_KEYWORD3_FONT_COMBO : - isFontSize = false; - return STYLE_WORD3_INDEX; - - case IDC_KEYWORD3_FONTSIZE_COMBO : - isFontSize = true; - return STYLE_WORD3_INDEX; - - case IDC_KEYWORD4_FONT_COMBO : - isFontSize = false; - return STYLE_WORD4_INDEX; - - case IDC_KEYWORD4_FONTSIZE_COMBO : - isFontSize = true; - return STYLE_WORD4_INDEX; - - default : - return -1; - } -} - -int KeyWordsStyleDialog::getGroupeIndexFromCheck(int ctrlID, int & fontStyleMask) const -{ - switch (ctrlID) - { - case IDC_KEYWORD1_BOLD_CHECK : - fontStyleMask = FONTSTYLE_BOLD; - return STYLE_WORD1_INDEX; - - case IDC_KEYWORD1_ITALIC_CHECK : - fontStyleMask = FONTSTYLE_ITALIC; - return STYLE_WORD1_INDEX; - - case IDC_KEYWORD1_UNDERLINE_CHECK : - fontStyleMask = FONTSTYLE_UNDERLINE; - return STYLE_WORD1_INDEX; - - case IDC_KEYWORD2_BOLD_CHECK : - fontStyleMask = FONTSTYLE_BOLD; - return STYLE_WORD2_INDEX; - - case IDC_KEYWORD2_ITALIC_CHECK : - fontStyleMask = FONTSTYLE_ITALIC; - return STYLE_WORD2_INDEX; - - case IDC_KEYWORD2_UNDERLINE_CHECK : - fontStyleMask = FONTSTYLE_UNDERLINE; - return STYLE_WORD2_INDEX; - - case IDC_KEYWORD3_BOLD_CHECK : - fontStyleMask = FONTSTYLE_BOLD; - return STYLE_WORD3_INDEX; - - case IDC_KEYWORD3_ITALIC_CHECK : - fontStyleMask = FONTSTYLE_ITALIC; - return STYLE_WORD3_INDEX; - - case IDC_KEYWORD3_UNDERLINE_CHECK : - fontStyleMask = FONTSTYLE_UNDERLINE; - return STYLE_WORD3_INDEX; - - case IDC_KEYWORD4_BOLD_CHECK : - fontStyleMask = FONTSTYLE_BOLD; - return STYLE_WORD4_INDEX; - - case IDC_KEYWORD4_ITALIC_CHECK : - fontStyleMask = FONTSTYLE_ITALIC; - return STYLE_WORD4_INDEX; - - case IDC_KEYWORD4_UNDERLINE_CHECK : - fontStyleMask = FONTSTYLE_UNDERLINE; - return STYLE_WORD4_INDEX; - - default : - return -1; - } -} - -void KeyWordsStyleDialog::updateDlg() -{ - ::SendDlgItemMessage(_hSelf, IDC_KEYWORD1_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[KWL_KW1_INDEX])); - ::SendDlgItemMessage(_hSelf, IDC_KEYWORD2_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[KWL_KW2_INDEX])); - ::SendDlgItemMessage(_hSelf, IDC_KEYWORD3_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[KWL_KW3_INDEX])); - ::SendDlgItemMessage(_hSelf, IDC_KEYWORD4_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[KWL_KW4_INDEX])); - - Style & w1Style = _pUserLang->_styleArray.getStyler(STYLE_WORD1_INDEX); - styleUpdate(w1Style, _pFgColour[0], _pBgColour[0], IDC_KEYWORD1_FONT_COMBO, IDC_KEYWORD1_FONTSIZE_COMBO, - IDC_KEYWORD1_BOLD_CHECK, IDC_KEYWORD1_ITALIC_CHECK, IDC_KEYWORD1_UNDERLINE_CHECK); - - Style & w2Style = _pUserLang->_styleArray.getStyler(STYLE_WORD2_INDEX); - styleUpdate(w2Style, _pFgColour[1], _pBgColour[1], IDC_KEYWORD2_FONT_COMBO, IDC_KEYWORD2_FONTSIZE_COMBO, - IDC_KEYWORD2_BOLD_CHECK, IDC_KEYWORD2_ITALIC_CHECK, IDC_KEYWORD2_UNDERLINE_CHECK); - - Style & w3Style = _pUserLang->_styleArray.getStyler(STYLE_WORD3_INDEX); - styleUpdate(w3Style, _pFgColour[2], _pBgColour[2], IDC_KEYWORD3_FONT_COMBO, IDC_KEYWORD3_FONTSIZE_COMBO, - IDC_KEYWORD3_BOLD_CHECK, IDC_KEYWORD3_BOLD_CHECK, IDC_KEYWORD3_UNDERLINE_CHECK); - - Style & w4Style = _pUserLang->_styleArray.getStyler(STYLE_WORD4_INDEX); - styleUpdate(w4Style, _pFgColour[3], _pBgColour[3], IDC_KEYWORD4_FONT_COMBO, IDC_KEYWORD4_FONTSIZE_COMBO, - IDC_KEYWORD4_BOLD_CHECK, IDC_KEYWORD4_ITALIC_CHECK, IDC_KEYWORD4_UNDERLINE_CHECK); - - ::SendDlgItemMessage(_hSelf, IDC_KEYWORD1_PREFIX_CHECK, BM_SETCHECK, _pUserLang->_isPrefix[0], 0); - ::SendDlgItemMessage(_hSelf, IDC_KEYWORD2_PREFIX_CHECK, BM_SETCHECK, _pUserLang->_isPrefix[1], 0); - ::SendDlgItemMessage(_hSelf, IDC_KEYWORD3_PREFIX_CHECK, BM_SETCHECK, _pUserLang->_isPrefix[2], 0); - ::SendDlgItemMessage(_hSelf, IDC_KEYWORD4_PREFIX_CHECK, BM_SETCHECK, _pUserLang->_isPrefix[3], 0); -} - -int fgStatic3[] = {IDC_COMMENT_FG_STATIC, IDC_COMMENTLINE_FG_STATIC, IDC_NUMBER_FG_STATIC}; -int bgStatic3[] = {IDC_COMMENT_BG_STATIC, IDC_COMMENTLINE_BG_STATIC, IDC_NUMBER_BG_STATIC}; -int fontSizeCombo3[] = {IDC_COMMENT_FONTSIZE_COMBO, IDC_COMMENTLINE_FONTSIZE_COMBO, IDC_NUMBER_FONTSIZE_COMBO}; -int fontNameCombo3[] = {IDC_COMMENT_FONT_COMBO, IDC_COMMENTLINE_FONT_COMBO, IDC_NUMBER_FONT_COMBO}; - -CommentStyleDialog::CommentStyleDialog() : SharedParametersDialog(3) -{ - memcpy(_fgStatic, fgStatic3, sizeof(fgStatic3)); - memcpy(_bgStatic, bgStatic3, sizeof(bgStatic3)); - memcpy(_fontSizeCombo, fontSizeCombo3, sizeof(fontSizeCombo3)); - memcpy(_fontNameCombo, fontNameCombo3, sizeof(fontNameCombo3)); -} - -BOOL CALLBACK CommentStyleDialog::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam) -{ - switch (Message) - { - case WM_COMMAND : - { - switch (wParam) - { - case IDC_COMMENTLINESYMBOL_CHECK : - return setPropertyByCheck(_hSelf, wParam, _pUserLang->_isCommentLineSymbol);; - - case IDC_COMMENTSYMBOL_CHECK : - return setPropertyByCheck(_hSelf, wParam, _pUserLang->_isCommentSymbol);; - - } - } - default : - return SharedParametersDialog::run_dlgProc(Message, wParam, lParam); - } -} - - -void CommentStyleDialog::setKeywords2List(int id) -{ - int i; + int index; switch (id) { - case IDC_COMMENTOPEN_EDIT : - case IDC_COMMENTCLOSE_EDIT : - case IDC_COMMENTLINE_EDIT : - i = 4; - break; - default : i = -1; - } - if (i != -1) - { - TCHAR commentOpen[max_char]; - TCHAR commentClose[max_char]; - TCHAR commentLine[max_char]; - TCHAR newList[max_char] = TEXT(""); - ::GetDlgItemText(_hSelf, IDC_COMMENTOPEN_EDIT, commentOpen, max_char); - ::GetDlgItemText(_hSelf, IDC_COMMENTCLOSE_EDIT, commentClose, max_char); - ::GetDlgItemText(_hSelf, IDC_COMMENTLINE_EDIT, commentLine, max_char); - convertTo(newList, commentOpen, '1'); - convertTo(newList, commentClose, '2'); - convertTo(newList, commentLine, '0'); - lstrcpy(_pUserLang->_keywordLists[i], newList); + 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; } + if (index != -1) + ::GetDlgItemText(_hSelf, id, _pUserLang->_keywordLists[index], max_char); } -int CommentStyleDialog::getStylerIndexFromCP(HWND hWnd, bool & isFG, ColourPicker **ppCP) const +void FolderStyleDialog::updateDlg() { - for (int i = 0 ; i < _nbGroup ; i++) - { - if (hWnd == _pFgColour[i]->getHSelf()) - { - *ppCP = _pFgColour[i]; - isFG = true; - return i+7; - } - if (hWnd == _pBgColour[i]->getHSelf()) - { - *ppCP = _pBgColour[i]; - isFG = false; - return i+7; - } - } - return -1; + ::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_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])); } -int CommentStyleDialog::getGroupIndexFromCombo(int ctrlID, bool & isFontSize) const -{ - switch (ctrlID) - { - case IDC_COMMENT_FONT_COMBO : - isFontSize = false; - return STYLE_COMMENT_INDEX; - - case IDC_COMMENT_FONTSIZE_COMBO : - isFontSize = true; - return STYLE_COMMENT_INDEX; - - case IDC_COMMENTLINE_FONT_COMBO : - isFontSize = false; - return STYLE_COMMENTLINE_INDEX; - - case IDC_COMMENTLINE_FONTSIZE_COMBO : - isFontSize = true; - return STYLE_COMMENTLINE_INDEX; - - case IDC_NUMBER_FONT_COMBO : - isFontSize = false; - return STYLE_NUMBER_INDEX; - - case IDC_NUMBER_FONTSIZE_COMBO : - isFontSize = true; - return STYLE_NUMBER_INDEX; - - default : - return -1; - } -} - -int CommentStyleDialog::getGroupeIndexFromCheck(int ctrlID, int & fontStyleMask) const -{ - switch (ctrlID) - { - case IDC_COMMENT_BOLD_CHECK : - fontStyleMask = FONTSTYLE_BOLD; - return STYLE_COMMENT_INDEX; - - case IDC_COMMENT_ITALIC_CHECK : - fontStyleMask = FONTSTYLE_ITALIC; - return STYLE_COMMENT_INDEX; - - case IDC_COMMENT_UNDERLINE_CHECK : - fontStyleMask = FONTSTYLE_UNDERLINE; - return STYLE_COMMENT_INDEX; - - case IDC_COMMENTLINE_BOLD_CHECK : - fontStyleMask = FONTSTYLE_BOLD; - return STYLE_COMMENTLINE_INDEX; - - case IDC_COMMENTLINE_ITALIC_CHECK : - fontStyleMask = FONTSTYLE_ITALIC; - return STYLE_COMMENTLINE_INDEX; - - case IDC_COMMENTLINE_UNDERLINE_CHECK : - fontStyleMask = FONTSTYLE_UNDERLINE; - return STYLE_COMMENTLINE_INDEX; - - case IDC_NUMBER_BOLD_CHECK : - fontStyleMask = FONTSTYLE_BOLD; - return STYLE_NUMBER_INDEX; - - case IDC_NUMBER_ITALIC_CHECK : - fontStyleMask = FONTSTYLE_ITALIC; - return STYLE_NUMBER_INDEX; - - case IDC_NUMBER_UNDERLINE_CHECK : - fontStyleMask = FONTSTYLE_UNDERLINE; - return STYLE_NUMBER_INDEX; - - default : - return -1; - } -} - -void CommentStyleDialog::convertTo(TCHAR *dest, const TCHAR *toConvert, TCHAR prefix) const +void FolderStyleDialog::convertTo(TCHAR *dest, const TCHAR *toConvert, TCHAR *prefix) const { + bool inGroup = false; int index = lstrlen(dest); - dest[index++] = ' '; - dest[index++] = prefix; + if (index > 0) + dest[index++] = ' '; + dest[index++] = prefix[0]; + dest[index++] = prefix[1]; + for (int i = 0 ; i < int(lstrlen(toConvert)) ; i++) { + if (i == 0 && toConvert[i] == '(' && toConvert[i+1] == '(') + { + inGroup = true; + } + else if (toConvert[i] == ' ' && toConvert[i+1] == '(' && toConvert[i+2] == '(') + { + inGroup = true; + dest[index++] = ' '; + dest[index++] = prefix[0]; + dest[index++] = prefix[1]; + ++i; // skip space + } + if (inGroup && toConvert[i-1] == ')' && toConvert[i-2] == ')') + { + inGroup = false; + } + if (toConvert[i] == ' ') { - if (toConvert[i+1] != ' ') + if (toConvert[i+1] != ' ' && toConvert[i+1] != '\0') { dest[index++] = ' '; - dest[index++] = prefix; + if (!inGroup) + { + dest[index++] = prefix[0]; + dest[index++] = prefix[1]; + } } } else @@ -785,581 +213,716 @@ void CommentStyleDialog::convertTo(TCHAR *dest, const TCHAR *toConvert, TCHAR pr dest[index++] = toConvert[i]; } } - dest[index] = '\0'; + dest[index] = '\0'; } -void CommentStyleDialog::retrieve(TCHAR *dest, const TCHAR *toRetrieve, TCHAR prefix) const +void FolderStyleDialog::retrieve(TCHAR *dest, const TCHAR *toRetrieve, TCHAR *prefix) const { - int j = 0; - bool begin2Copy = false; + int j = 0; + bool begin2Copy = false; - for (int i = 0 ; i < int(lstrlen(toRetrieve)) ; i++) - { - if (((i == 0) || toRetrieve[i-1] == ' ') && (toRetrieve[i] == prefix)) + for (int i = 0 ; i < int(lstrlen(toRetrieve)) ; i++) + { + if ((i == 0 || (toRetrieve[i-1] == ' ')) && (toRetrieve[i] == prefix[0] && toRetrieve[i+1] == prefix[1])) + { + if (j > 0) + dest[j++] = ' '; + + begin2Copy = true; + ++i; + continue; + } + else if (((toRetrieve[i] == ' ') && begin2Copy == true)) + { + begin2Copy = false; + } + + if (begin2Copy) + dest[j++] = toRetrieve[i]; + } + dest[j++] = '\0'; +} + +BOOL CALLBACK KeyWordsStyleDialog::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam) +{ + switch (Message) + { + case WM_COMMAND : + { + switch (wParam) + { + case IDC_KEYWORD1_PREFIX_CHECK : + return setPropertyByCheck(_hSelf, wParam, _pUserLang->_isPrefix[0]); + + case IDC_KEYWORD2_PREFIX_CHECK : + return setPropertyByCheck(_hSelf, wParam, _pUserLang->_isPrefix[1]); + + case IDC_KEYWORD3_PREFIX_CHECK : + return setPropertyByCheck(_hSelf, wParam, _pUserLang->_isPrefix[2]); + + case IDC_KEYWORD4_PREFIX_CHECK : + return setPropertyByCheck(_hSelf, wParam, _pUserLang->_isPrefix[3]); + + case IDC_KEYWORD5_PREFIX_CHECK : + return setPropertyByCheck(_hSelf, wParam, _pUserLang->_isPrefix[4]); + + case IDC_KEYWORD6_PREFIX_CHECK : + return setPropertyByCheck(_hSelf, wParam, _pUserLang->_isPrefix[5]); + + case IDC_KEYWORD7_PREFIX_CHECK : + return setPropertyByCheck(_hSelf, wParam, _pUserLang->_isPrefix[6]); + + case IDC_KEYWORD8_PREFIX_CHECK : + return setPropertyByCheck(_hSelf, wParam, _pUserLang->_isPrefix[7]); + + case IDC_KEYWORD1_STYLER : + { + StylerDlg stylerDlg(_hInst, _hSelf, SCE_USER_STYLE_KEYWORD1, SCE_USER_MASK_NESTING_NONE); + stylerDlg.doDialog(); + return TRUE; + } + case IDC_KEYWORD2_STYLER : + { + StylerDlg stylerDlg(_hInst, _hSelf, SCE_USER_STYLE_KEYWORD2, SCE_USER_MASK_NESTING_NONE); + stylerDlg.doDialog(); + return TRUE; + } + case IDC_KEYWORD3_STYLER : + { + StylerDlg stylerDlg(_hInst, _hSelf, SCE_USER_STYLE_KEYWORD3, SCE_USER_MASK_NESTING_NONE); + stylerDlg.doDialog(); + return TRUE; + } + case IDC_KEYWORD4_STYLER : + { + StylerDlg stylerDlg(_hInst, _hSelf, SCE_USER_STYLE_KEYWORD4, SCE_USER_MASK_NESTING_NONE); + stylerDlg.doDialog(); + return TRUE; + } + case IDC_KEYWORD5_STYLER : + { + StylerDlg stylerDlg(_hInst, _hSelf, SCE_USER_STYLE_KEYWORD5, SCE_USER_MASK_NESTING_NONE); + stylerDlg.doDialog(); + return TRUE; + } + case IDC_KEYWORD6_STYLER : + { + StylerDlg stylerDlg(_hInst, _hSelf, SCE_USER_STYLE_KEYWORD6, SCE_USER_MASK_NESTING_NONE); + stylerDlg.doDialog(); + return TRUE; + } + case IDC_KEYWORD7_STYLER : + { + StylerDlg stylerDlg(_hInst, _hSelf, SCE_USER_STYLE_KEYWORD7, SCE_USER_MASK_NESTING_NONE); + stylerDlg.doDialog(); + return TRUE; + } + case IDC_KEYWORD8_STYLER : + { + StylerDlg stylerDlg(_hInst, _hSelf, SCE_USER_STYLE_KEYWORD8, SCE_USER_MASK_NESTING_NONE); + stylerDlg.doDialog(); + return TRUE; + } + default : + return SharedParametersDialog::run_dlgProc(Message, wParam, lParam); + } + } + default : + return SharedParametersDialog::run_dlgProc(Message, wParam, lParam); + } +} + +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; + } + if (index != -1) + ::GetDlgItemText(_hSelf, id, _pUserLang->_keywordLists[index], max_char); +} + +void KeyWordsStyleDialog::updateDlg() +{ + ::SendDlgItemMessage(_hSelf, IDC_KEYWORD1_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_KEYWORDS1])); + ::SendDlgItemMessage(_hSelf, IDC_KEYWORD2_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_KEYWORDS2])); + ::SendDlgItemMessage(_hSelf, IDC_KEYWORD3_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_KEYWORDS3])); + ::SendDlgItemMessage(_hSelf, IDC_KEYWORD4_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_KEYWORDS4])); + ::SendDlgItemMessage(_hSelf, IDC_KEYWORD5_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_KEYWORDS5])); + ::SendDlgItemMessage(_hSelf, IDC_KEYWORD6_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_KEYWORDS6])); + ::SendDlgItemMessage(_hSelf, IDC_KEYWORD7_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_KEYWORDS7])); + ::SendDlgItemMessage(_hSelf, IDC_KEYWORD8_EDIT, WM_SETTEXT, 0, (LPARAM)(_pUserLang->_keywordLists[SCE_USER_KWLIST_KEYWORDS8])); + + ::SendDlgItemMessage(_hSelf, IDC_KEYWORD1_PREFIX_CHECK, BM_SETCHECK, _pUserLang->_isPrefix[0], 0); + ::SendDlgItemMessage(_hSelf, IDC_KEYWORD2_PREFIX_CHECK, BM_SETCHECK, _pUserLang->_isPrefix[1], 0); + ::SendDlgItemMessage(_hSelf, IDC_KEYWORD3_PREFIX_CHECK, BM_SETCHECK, _pUserLang->_isPrefix[2], 0); + ::SendDlgItemMessage(_hSelf, IDC_KEYWORD4_PREFIX_CHECK, BM_SETCHECK, _pUserLang->_isPrefix[3], 0); + ::SendDlgItemMessage(_hSelf, IDC_KEYWORD5_PREFIX_CHECK, BM_SETCHECK, _pUserLang->_isPrefix[4], 0); + ::SendDlgItemMessage(_hSelf, IDC_KEYWORD6_PREFIX_CHECK, BM_SETCHECK, _pUserLang->_isPrefix[5], 0); + ::SendDlgItemMessage(_hSelf, IDC_KEYWORD7_PREFIX_CHECK, BM_SETCHECK, _pUserLang->_isPrefix[6], 0); + ::SendDlgItemMessage(_hSelf, IDC_KEYWORD8_PREFIX_CHECK, BM_SETCHECK, _pUserLang->_isPrefix[7], 0); +} + +BOOL CALLBACK CommentStyleDialog::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam) +{ + switch (Message) + { + case WM_COMMAND : + { + switch (wParam) + { + case IDC_FOLDING_OF_COMMENTS : + { + return setPropertyByCheck(_hSelf, wParam, _pUserLang->_allowFoldOfComments); + } + + case IDC_FORCE_LINE_COMMENTS_AT_BOL : + { + return setPropertyByCheck(_hSelf, wParam, _pUserLang->_forceLineCommentsAtBOL); + } + + case IDC_COMMENTLINE_STYLER : + { + StylerDlg stylerDlg(_hInst, _hSelf, SCE_USER_STYLE_COMMENTLINE); + stylerDlg.doDialog(); + return TRUE; + } + case IDC_COMMENT_STYLER : + { + StylerDlg stylerDlg(_hInst, _hSelf, SCE_USER_STYLE_COMMENT); + stylerDlg.doDialog(); + return TRUE; + } + case IDC_NUMBER_STYLER : + { + StylerDlg stylerDlg(_hInst, _hSelf, SCE_USER_STYLE_NUMBER, SCE_USER_MASK_NESTING_NONE); + stylerDlg.doDialog(); + return TRUE; + } + default : + return SharedParametersDialog::run_dlgProc(Message, wParam, lParam); + } + } + default : + return SharedParametersDialog::run_dlgProc(Message, wParam, lParam); + } +} + +void CommentStyleDialog::setKeywords2List(int id) +{ + int index = 0; + switch (id) + { + case IDC_NUMBER_EXTRA_EDIT : { - begin2Copy = true; - continue; + ::SendDlgItemMessage(_hSelf, IDC_NUMBER_EXTRA_EDIT, WM_GETTEXT, max_char, reinterpret_cast((_pUserLang->_keywordLists[SCE_USER_KWLIST_NUMBER_EXTRA]))); + break; } - else if (((toRetrieve[i] == ' ') && begin2Copy == true)) + 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_COMMENT_OPEN_EDIT : + case IDC_COMMENT_CLOSE_EDIT : + case IDC_COMMENTLINE_OPEN_EDIT : + case IDC_COMMENTLINE_CONTINUE_EDIT : + case IDC_COMMENTLINE_CLOSE_EDIT : + index = SCE_USER_KWLIST_COMMENTS; + break; + default : index = -1; + } + if (index != -1) + { + TCHAR newList[max_char] = TEXT(""); + 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 + }; + + for (int i=0; i_keywordLists[index], newList); + } +} + +void CommentStyleDialog::convertTo(TCHAR *dest, const TCHAR *toConvert, TCHAR *prefix) const +{ + bool inGroup = false; + int index = lstrlen(dest); + if (index > 0) + dest[index++] = ' '; + dest[index++] = prefix[0]; + dest[index++] = prefix[1]; + + for (int i = 0 ; i < int(lstrlen(toConvert)) ; i++) + { + if (i == 0 && toConvert[i] == '(' && toConvert[i+1] == '(') + { + inGroup = true; + } + else if (toConvert[i] == ' ' && toConvert[i+1] == '(' && toConvert[i+2] == '(') + { + inGroup = true; + dest[index++] = ' '; + dest[index++] = prefix[0]; + dest[index++] = prefix[1]; + ++i; // skip space + } + if (inGroup && toConvert[i-1] == ')' && toConvert[i-2] == ')') + { + inGroup = false; + } + + if (toConvert[i] == ' ') + { + if (toConvert[i+1] != ' ' && toConvert[i+1] != '\0') + { + dest[index++] = ' '; + if (!inGroup) + { + dest[index++] = prefix[0]; + dest[index++] = prefix[1]; + } + } + } + else + { + dest[index++] = toConvert[i]; + } + } + dest[index] = '\0'; +} + +void CommentStyleDialog::retrieve(TCHAR *dest, const TCHAR *toRetrieve, TCHAR *prefix) const +{ + int j = 0; + bool begin2Copy = false; + bool inGroup = false; + + for (int i = 0 ; i < int(lstrlen(toRetrieve)) ; i++) + { + if ((i == 0 || (toRetrieve[i-1] == ' ')) && (toRetrieve[i] == prefix[0] && toRetrieve[i+1] == prefix[1])) + { + if (j > 0) + dest[j++] = ' '; + + begin2Copy = true; + ++i; + continue; + } + if (toRetrieve[i] == '(' && toRetrieve[i+1] == '(' && inGroup == false && begin2Copy == true) { - dest[j++] = toRetrieve[i]; - begin2Copy = false; + inGroup = true; } - if (begin2Copy) - dest[j++] = toRetrieve[i]; - } - dest[j++] = '\0'; + if (toRetrieve[i] != ')' && toRetrieve[i-1] == ')' && toRetrieve[i-2] == ')' && inGroup == true) + { + inGroup = false; + } + if (toRetrieve[i] == ' ' && begin2Copy == true) + { + begin2Copy = false; + } + + if (begin2Copy || inGroup) + dest[j++] = toRetrieve[i]; + } + dest[j++] = '\0'; } void CommentStyleDialog::updateDlg() { - TCHAR commentOpen[256] = TEXT(""); - TCHAR commentClose[256] = TEXT(""); - TCHAR commentLine[256] = TEXT(""); + TCHAR buffer[max_char] = TEXT(""); + TCHAR intBuffer[10] = {'0', 0}; - retrieve(commentOpen, _pUserLang->_keywordLists[KWL_COMMENT_INDEX], '1'); - retrieve(commentClose, _pUserLang->_keywordLists[KWL_COMMENT_INDEX], '2'); - retrieve(commentLine, _pUserLang->_keywordLists[KWL_COMMENT_INDEX], '0'); + const int list[] = { + IDC_COMMENTLINE_OPEN_EDIT, + IDC_COMMENTLINE_CONTINUE_EDIT, + IDC_COMMENTLINE_CLOSE_EDIT, + IDC_COMMENT_OPEN_EDIT, + IDC_COMMENT_CLOSE_EDIT + }; - ::SendDlgItemMessage(_hSelf, IDC_COMMENTOPEN_EDIT, WM_SETTEXT, 0, (LPARAM)commentOpen); - ::SendDlgItemMessage(_hSelf, IDC_COMMENTCLOSE_EDIT, WM_SETTEXT, 0, (LPARAM)commentClose); - ::SendDlgItemMessage(_hSelf, IDC_COMMENTLINE_EDIT, WM_SETTEXT, 0, (LPARAM)commentLine); - - Style & commentStyle = _pUserLang->_styleArray.getStyler(STYLE_COMMENT_INDEX); - styleUpdate(commentStyle, _pFgColour[0], _pBgColour[0], IDC_COMMENT_FONT_COMBO, IDC_COMMENT_FONTSIZE_COMBO, - IDC_COMMENT_BOLD_CHECK, IDC_COMMENT_ITALIC_CHECK, IDC_COMMENT_UNDERLINE_CHECK); - - Style & commentLineStyle = _pUserLang->_styleArray.getStyler(STYLE_COMMENTLINE_INDEX); - styleUpdate(commentLineStyle, _pFgColour[1], _pBgColour[1], IDC_COMMENTLINE_FONT_COMBO, IDC_COMMENTLINE_FONTSIZE_COMBO, - IDC_COMMENTLINE_BOLD_CHECK, IDC_COMMENTLINE_ITALIC_CHECK, IDC_COMMENTLINE_UNDERLINE_CHECK); - - Style & numberStyle = _pUserLang->_styleArray.getStyler(STYLE_NUMBER_INDEX); - styleUpdate(numberStyle, _pFgColour[2], _pBgColour[2], IDC_NUMBER_FONT_COMBO, IDC_NUMBER_FONTSIZE_COMBO, - IDC_NUMBER_BOLD_CHECK, IDC_NUMBER_ITALIC_CHECK, IDC_NUMBER_UNDERLINE_CHECK); - - ::SendDlgItemMessage(_hSelf, IDC_COMMENTLINESYMBOL_CHECK, BM_SETCHECK, _pUserLang->_isCommentLineSymbol, 0); - ::SendDlgItemMessage(_hSelf, IDC_COMMENTSYMBOL_CHECK, BM_SETCHECK, _pUserLang->_isCommentSymbol, 0); -} - -TCHAR symbolesArray[] = TEXT("+-*/.?!:;,%^$&\"'(_)=}]@\\`|[{#~<>"); -const bool SymbolsStyleDialog::ADD = true; -const bool SymbolsStyleDialog::REMOVE = false; - -int fgStatic4[] = {IDC_SYMBOL_FG_STATIC, IDC_SYMBOL_FG2_STATIC, IDC_SYMBOL_FG3_STATIC}; -int bgStatic4[] = {IDC_SYMBOL_BG_STATIC, IDC_SYMBOL_BG2_STATIC, IDC_SYMBOL_BG3_STATIC}; -int fontSizeCombo4[] = {IDC_SYMBOL_FONTSIZE_COMBO, IDC_SYMBOL_FONTSIZE2_COMBO, IDC_SYMBOL_FONTSIZE3_COMBO}; -int fontNameCombo4[] = {IDC_SYMBOL_FONT_COMBO, IDC_SYMBOL_FONT2_COMBO, IDC_SYMBOL_FONT3_COMBO}; - -// 2 static const TCHAR * to have the compatibility with the old xml -const TCHAR *SymbolsStyleDialog::_delimTag1 = TEXT("DELIMINER1"); -const TCHAR *SymbolsStyleDialog::_delimTag2 = TEXT("DELIMINER2"); - -SymbolsStyleDialog::SymbolsStyleDialog() : SharedParametersDialog(3) -{ - memcpy(_fgStatic, fgStatic4, sizeof(fgStatic4)); - memcpy(_bgStatic, bgStatic4, sizeof(bgStatic4)); - memcpy(_fontSizeCombo, fontSizeCombo4, sizeof(fontSizeCombo4)); - memcpy(_fontNameCombo, fontNameCombo4, sizeof(fontNameCombo4)); -} - -int SymbolsStyleDialog::getStylerIndexFromCP(HWND hWnd, bool & isFG, ColourPicker **ppCP) const -{ - for (int i = 0 ; i < _nbGroup ; i++) - { - if (hWnd == _pFgColour[i]->getHSelf()) - { - *ppCP = _pFgColour[i]; - isFG = true; - return i+10; - } - if (hWnd == _pBgColour[i]->getHSelf()) - { - *ppCP = _pBgColour[i]; - isFG = false; - return i+10; - } - } - return -1; -} - -int SymbolsStyleDialog::getGroupIndexFromCombo(int ctrlID, bool & isFontSize) const -{ - switch (ctrlID) + for (int i=0; i_keywordLists[SCE_USER_KWLIST_COMMENTS], intBuffer); + ::SendDlgItemMessage(_hSelf, list[i], WM_SETTEXT, 0, (LPARAM)buffer); } - // Get the operators list - count = ::SendDlgItemMessage(_hSelf, IDC_ACTIVATED_SYMBOL_LIST, LB_GETCOUNT, 0, 0); - - int j = 0; - for (int i = 0 ; i < count ; i++) - { - ::SendDlgItemMessage(_hSelf, IDC_ACTIVATED_SYMBOL_LIST, LB_GETTEXT, i, (LPARAM)s); - _pUserLang->_keywordLists[3][j++] = s[0]; - _pUserLang->_keywordLists[3][j++] = ' '; - } - _pUserLang->_keywordLists[3][--j] = '\0'; + ::SendDlgItemMessage(_hSelf, IDC_FORCE_LINE_COMMENTS_AT_BOL, BM_SETCHECK, _pUserLang->_forceLineCommentsAtBOL, 0); + ::SendDlgItemMessage(_hSelf, IDC_FOLDING_OF_COMMENTS, BM_SETCHECK, _pUserLang->_allowFoldOfComments, 0); - if (_pScintilla->getCurrentBuffer()->getLangType() == L_USER) - _pScintilla->styleChange(); + ::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])); } -void SymbolsStyleDialog::listboxsRemoveAll() +void SymbolsStyleDialog::updateDlg() { - int count = ::SendDlgItemMessage(_hSelf, IDC_AVAILABLE_SYMBOLS_LIST, LB_GETCOUNT, 0, 0); - for (int i = count-1 ; i >= 0 ; i--) + 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= 0 ; i--) - { - ::SendDlgItemMessage(_hSelf, IDC_ACTIVATED_SYMBOL_LIST, LB_DELETESTRING, i, 0); - } -} -void SymbolsStyleDialog::updateDlg() -{ - listboxsReInit(); + if (i < 10) + generic_itoa(i, intBuffer+1, 10); + else + generic_itoa(i, intBuffer, 10); - const TCHAR *symbols = _pUserLang->_keywordLists[KWL_OPERATOR_INDEX]; - - for (int i = 0 ; i < int(lstrlen(symbols)) ; i++) - { - if (symbols[i] != ' ') - { - TCHAR s[2]; - s[0] = symbols[i]; - s[1] = '\0'; - int index = ::SendDlgItemMessage(_hSelf, IDC_AVAILABLE_SYMBOLS_LIST, LB_FINDSTRING, (WPARAM)-1, (LPARAM)s); - if (index == LB_ERR) - continue; - - int id2Add = IDC_ACTIVATED_SYMBOL_LIST; - int id2Remove = IDC_AVAILABLE_SYMBOLS_LIST; - int idButton2Enable = IDC_REMOVE_BUTTON; - int idButton2Disable = IDC_ADD_BUTTON; - - ::SendDlgItemMessage(_hSelf, id2Add, LB_ADDSTRING, 0, (LPARAM)s); - ::SendDlgItemMessage(_hSelf, id2Remove, LB_DELETESTRING, index, 0); - int count = ::SendDlgItemMessage(_hSelf, id2Remove, LB_GETCOUNT, 0, 0); - if (index == count) - index -= 1; - - ::SendDlgItemMessage(_hSelf, id2Remove, LB_SETCURSEL, index, 0); - count = ::SendDlgItemMessage(_hSelf, id2Remove, LB_GETCOUNT, 0, 0); - - // If there's no symbol, we activate another side - if (!count) - { - ::SendDlgItemMessage(_hSelf, id2Add, LB_SETCURSEL, 0, 0); - ::EnableWindow(::GetDlgItem(_hSelf, idButton2Enable), TRUE); - ::EnableWindow(::GetDlgItem(_hSelf, idButton2Disable), FALSE); - } - } - } - bool hasEscape = (_pUserLang->_escapeChar[0] != 0); - ::SendDlgItemMessage(_hSelf, IDC_HAS_ESCAPE, BM_SETCHECK, (hasEscape) ? BST_CHECKED : BST_UNCHECKED,0); - ::EnableWindow(::GetDlgItem(_hSelf, IDC_ESCAPE_CHAR), (hasEscape) ? TRUE : FALSE); - ::SendDlgItemMessage(_hSelf, IDC_ESCAPE_CHAR, WM_SETTEXT, 0, reinterpret_cast(&_pUserLang->_escapeChar)); - const TCHAR *delims = _pUserLang->_keywordLists[KWL_DELIM_INDEX]; - // ICI LE TRAITEMENT POUR REMPLIR LES 4 COMBO BOX - TCHAR dOpen1[2], dClose1[2], dOpen2[2], dClose2[2], dOpen3[2], dClose3[2]; - dOpen1[0] = dClose1[0] = dOpen2[0] = dClose2[0] = dOpen3[0] = dClose3[0] = '\0'; - dOpen1[1] = dClose1[1] = dOpen2[1] = dClose2[1] = dOpen3[1] = dClose3[1] = '\0'; - if (lstrlen(delims) >= 6) - { - if (delims[0] != '0') - dOpen1[0] = delims[0]; - - int i = ::SendDlgItemMessage(_hSelf, IDC_SYMBOL_BO2_COMBO, CB_FINDSTRINGEXACT, (WPARAM)-1, (LPARAM)dOpen1); - if (i == CB_ERR) - i = 0; - ::SendDlgItemMessage(_hSelf, IDC_SYMBOL_BO2_COMBO,CB_SETCURSEL, i, 0); - - if (delims[1] != '0') - dOpen2[0] = delims[1]; - - i = ::SendDlgItemMessage(_hSelf, IDC_SYMBOL_BO3_COMBO, CB_FINDSTRINGEXACT, (WPARAM)-1, (LPARAM)dOpen2); - if (i == CB_ERR) - i = 0; - ::SendDlgItemMessage(_hSelf, IDC_SYMBOL_BO3_COMBO,CB_SETCURSEL, i, 0); - - //if (delims[2] != '0') - //dOpen3 = delims[2]; - if (delims[3] != '0') - dClose1[0] = delims[3]; - - i = ::SendDlgItemMessage(_hSelf, IDC_SYMBOL_BC2_COMBO, CB_FINDSTRINGEXACT, (WPARAM)-1, (LPARAM)dClose1); - if (i == CB_ERR) - i = 0; - ::SendDlgItemMessage(_hSelf, IDC_SYMBOL_BC2_COMBO,CB_SETCURSEL, i, 0); - - if (delims[4] != '0') - dClose2[0] = delims[4]; - - i = ::SendDlgItemMessage(_hSelf, IDC_SYMBOL_BC3_COMBO, CB_FINDSTRINGEXACT, (WPARAM)-1, (LPARAM)dClose2); - if (i == CB_ERR) - i = 0; - ::SendDlgItemMessage(_hSelf, IDC_SYMBOL_BC3_COMBO,CB_SETCURSEL, i, 0); - //if (delims[5] != '0') - //dClose3 = delims[5]; + retrieve(buffer, _pUserLang->_keywordLists[SCE_USER_KWLIST_DELIMITERS], intBuffer); + ::SendDlgItemMessage(_hSelf, list[i], WM_SETTEXT, 0, (LPARAM)buffer); } - - Style & opStyle = _pUserLang->_styleArray.getStyler(STYLE_OPERATOR_INDEX); - - styleUpdate(opStyle, _pFgColour[0], _pBgColour[0], IDC_SYMBOL_FONT_COMBO, IDC_SYMBOL_FONTSIZE_COMBO, - IDC_SYMBOL_BOLD_CHECK, IDC_SYMBOL_ITALIC_CHECK, IDC_SYMBOL_UNDERLINE_CHECK); - - Style & delim2Style = _pUserLang->_styleArray.getStyler(STYLE_DELIM2_INDEX); - - // the compatibility with the old xml - if (delim2Style._styleID == -1) - { - delim2Style._styleID = SCE_USER_DELIMITER1; - delim2Style._styleDesc = SymbolsStyleDialog::_delimTag1; - } - styleUpdate(delim2Style, _pFgColour[1], _pBgColour[1], IDC_SYMBOL_FONT2_COMBO, IDC_SYMBOL_FONTSIZE2_COMBO, - IDC_SYMBOL_BOLD2_CHECK, IDC_SYMBOL_ITALIC2_CHECK, IDC_SYMBOL_UNDERLINE2_CHECK); - - Style & delim3Style = _pUserLang->_styleArray.getStyler(STYLE_DELIM3_INDEX); - - // the compatibility with the old xml - if (delim3Style._styleID == -1) - { - delim3Style._styleID = SCE_USER_DELIMITER2; - delim3Style._styleDesc = SymbolsStyleDialog::_delimTag2; - } - styleUpdate(delim3Style, _pFgColour[2], _pBgColour[2], IDC_SYMBOL_FONT3_COMBO, IDC_SYMBOL_FONTSIZE3_COMBO, - IDC_SYMBOL_BOLD3_CHECK, IDC_SYMBOL_ITALIC3_CHECK, IDC_SYMBOL_UNDERLINE3_CHECK); - - // the compatibility with the old xml - if (_pUserLang->_styleArray.getNbStyler() < 13) - _pUserLang->_styleArray.setNbStyler(13); -} - -void SymbolsStyleDialog::listboxsInit() -{ - ::SendDlgItemMessage(_hSelf, IDC_SYMBOL_BO2_COMBO, CB_ADDSTRING, 0, (LPARAM)TEXT("")); - ::SendDlgItemMessage(_hSelf, IDC_SYMBOL_BC2_COMBO, CB_ADDSTRING, 0, (LPARAM)TEXT("")); - ::SendDlgItemMessage(_hSelf, IDC_SYMBOL_BO3_COMBO, CB_ADDSTRING, 0, (LPARAM)TEXT("")); - ::SendDlgItemMessage(_hSelf, IDC_SYMBOL_BC3_COMBO, CB_ADDSTRING, 0, (LPARAM)TEXT("")); - - for (int i = 0 ; i < int((sizeof(symbolesArray)/sizeof(TCHAR))-1) ; i++) - { - TCHAR s[2]; - s[0] = symbolesArray[i]; - s[1] = '\0'; - ::SendDlgItemMessage(_hSelf, IDC_AVAILABLE_SYMBOLS_LIST, LB_ADDSTRING, 0, (LPARAM)s); - ::SendDlgItemMessage(_hSelf, IDC_SYMBOL_BO2_COMBO, CB_ADDSTRING, 0, (LPARAM)s); - ::SendDlgItemMessage(_hSelf, IDC_SYMBOL_BC2_COMBO, CB_ADDSTRING, 0, (LPARAM)s); - ::SendDlgItemMessage(_hSelf, IDC_SYMBOL_BO3_COMBO, CB_ADDSTRING, 0, (LPARAM)s); - ::SendDlgItemMessage(_hSelf, IDC_SYMBOL_BC3_COMBO, CB_ADDSTRING, 0, (LPARAM)s); - } + ::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])); } BOOL CALLBACK SymbolsStyleDialog::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam) { - switch (Message) - { - case WM_INITDIALOG : - { - // 2 listBoxes et 4 combobox - listboxsInit(); - - ::SendDlgItemMessage(_hSelf, IDC_AVAILABLE_SYMBOLS_LIST, LB_SETCURSEL, 0, 0); - ::EnableWindow(::GetDlgItem(_hSelf, IDC_REMOVE_BUTTON), FALSE); - ::SendDlgItemMessage(_hSelf,IDC_ESCAPE_CHAR, EM_LIMITTEXT,1,0); - - return SharedParametersDialog::run_dlgProc(Message, wParam, lParam); - } - - case WM_COMMAND : - { - //int toto = HIWORD(wParam); - if ((wParam == IDC_ADD_BUTTON) || (wParam == IDC_REMOVE_BUTTON)) - { - symbolAction((wParam == IDC_ADD_BUTTON)?ADD:REMOVE); - if (_pScintilla->getCurrentBuffer()->getLangType() == L_USER) - _pScintilla->styleChange(); - return TRUE; - } - else if (wParam == IDC_HAS_ESCAPE) - { - int newState = ::SendDlgItemMessage(_hSelf,IDC_HAS_ESCAPE, BM_GETCHECK, 0, 0); - ::EnableWindow(::GetDlgItem(_hSelf, IDC_ESCAPE_CHAR), (newState == BST_CHECKED) ? TRUE : FALSE); - if ((newState == BST_CHECKED) && !::SendDlgItemMessage(_hSelf, IDC_ESCAPE_CHAR, WM_GETTEXTLENGTH, 0, 0) && (_lastEscapeChar != 0)) - //restore previous char - { - _pUserLang->_escapeChar[0] = _lastEscapeChar; - ::SendDlgItemMessage(_hSelf, IDC_ESCAPE_CHAR, WM_SETTEXT, 0, reinterpret_cast(&_pUserLang->_escapeChar[0])); - } - else - { - _lastEscapeChar = _pUserLang->_escapeChar[0]; - ::SendDlgItemMessage(_hSelf,IDC_ESCAPE_CHAR,WM_SETTEXT,0,reinterpret_cast("")); - _pUserLang->_escapeChar[0]='\0'; - } - if (_pScintilla->getCurrentBuffer()->getLangType() == L_USER) - { - _pScintilla->execute(SCI_SETPROPERTY, (WPARAM)"userDefine.escapeChar", reinterpret_cast(_pUserLang->_escapeChar)); - _pScintilla->styleChange(); - } - } - - else if (LOWORD(wParam) == IDC_ESCAPE_CHAR) - { - if (HIWORD(wParam) == EN_CHANGE) - { - if (::SendDlgItemMessage(_hSelf, IDC_ESCAPE_CHAR, WM_GETTEXTLENGTH, 0, 0)) - { - ::SendDlgItemMessage(_hSelf, IDC_ESCAPE_CHAR, WM_GETTEXT, sizeof(_pUserLang->_escapeChar), reinterpret_cast(&_pUserLang->_escapeChar)); - _lastEscapeChar = _pUserLang->_escapeChar[0]; - } - if (_pScintilla->getCurrentBuffer()->getLangType() == L_USER) - { - _pScintilla->execute(SCI_SETPROPERTY, (WPARAM)"userDefine.escapeChar", reinterpret_cast(_pUserLang->_escapeChar)); - _pScintilla->styleChange(); - } - } - } - // car LBN_SELCHANGE == CBN_SELCHANGE == 1 - else if ((HIWORD(wParam) == LBN_SELCHANGE) ||(HIWORD(wParam) == CBN_SELCHANGE)) - { - if ((LOWORD(wParam) == IDC_ACTIVATED_SYMBOL_LIST) || (LOWORD(wParam) == IDC_AVAILABLE_SYMBOLS_LIST)) - { - int idButton2Enable; - int idButton2Disable; - - if (LOWORD(wParam) == IDC_AVAILABLE_SYMBOLS_LIST) - { - idButton2Enable = IDC_ADD_BUTTON; - idButton2Disable = IDC_REMOVE_BUTTON; - } - else - { - idButton2Enable = IDC_REMOVE_BUTTON; - idButton2Disable = IDC_ADD_BUTTON; - } - - int i = ::SendDlgItemMessage(_hSelf, LOWORD(wParam), LB_GETCURSEL, 0, 0); - if (i != LB_ERR) - { - ::EnableWindow(::GetDlgItem(_hSelf, idButton2Enable), TRUE); - int idListbox2Disable = (LOWORD(wParam)== IDC_AVAILABLE_SYMBOLS_LIST)?IDC_ACTIVATED_SYMBOL_LIST:IDC_AVAILABLE_SYMBOLS_LIST; - ::SendDlgItemMessage(_hSelf, idListbox2Disable, LB_SETCURSEL, (WPARAM)-1, 0); - ::EnableWindow(::GetDlgItem(_hSelf, idButton2Disable), FALSE); - } - return TRUE; - } - else if ((LOWORD(wParam) == IDC_SYMBOL_BO2_COMBO) || (LOWORD(wParam) == IDC_SYMBOL_BC2_COMBO) || - (LOWORD(wParam) == IDC_SYMBOL_BO3_COMBO) || (LOWORD(wParam) == IDC_SYMBOL_BC3_COMBO)) - { - TCHAR charStr[5] = TEXT(""); - int i = ::SendDlgItemMessage(_hSelf, LOWORD(wParam), CB_GETCURSEL, 0, 0); - ::SendDlgItemMessage(_hSelf, LOWORD(wParam), CB_GETLBTEXT, i, (LPARAM)charStr); - int symbIndex; - - if (LOWORD(wParam) == IDC_SYMBOL_BO2_COMBO) - symbIndex = 0; - else if (LOWORD(wParam) == IDC_SYMBOL_BO3_COMBO) - symbIndex = 1; - else if (LOWORD(wParam) == IDC_SYMBOL_BC2_COMBO) - symbIndex = 3; - else // (LOWORD(wParam) == IDC_SYMBOL_BC3_COMBO) - symbIndex = 4; - - TCHAR *delims = _pUserLang->_keywordLists[KWL_DELIM_INDEX]; - delims[symbIndex] = charStr[0]?charStr[0]:'0'; - - if (_pScintilla->getCurrentBuffer()->getLangType() == L_USER) - _pScintilla->styleChange(); - return TRUE; - } - else - return SharedParametersDialog::run_dlgProc(Message, wParam, lParam); - } - } - default : - return SharedParametersDialog::run_dlgProc(Message, wParam, lParam); - } -} - -void SymbolsStyleDialog::undeleteChar() -{ - if ((::SendDlgItemMessage(_hSelf, IDC_HAS_ESCAPE, BM_GETCHECK,0,0) == BST_CHECKED) && - (!::SendDlgItemMessage(_hSelf, IDC_ESCAPE_CHAR, WM_GETTEXTLENGTH, 0, 0))) - { - if (_pUserLang->_escapeChar[0]) - ::SendDlgItemMessage(_hSelf, IDC_ESCAPE_CHAR, WM_SETTEXT, 0, reinterpret_cast(&_pUserLang->_escapeChar[0])); - else - ::SendDlgItemMessage(_hSelf, IDC_HAS_ESCAPE, BM_SETCHECK, BST_UNCHECKED, 0); - } -} - -int SymbolsStyleDialog::getGroupeIndexFromCheck(int ctrlID, int & fontStyleMask) const -{ - switch (ctrlID) + switch (Message) { - case IDC_SYMBOL_BOLD_CHECK : - { - fontStyleMask = FONTSTYLE_BOLD; - return STYLE_OPERATOR_INDEX; - } - case IDC_SYMBOL_ITALIC_CHECK : - { - fontStyleMask = FONTSTYLE_ITALIC; - return STYLE_OPERATOR_INDEX; - } - case IDC_SYMBOL_UNDERLINE_CHECK : - { - fontStyleMask = FONTSTYLE_UNDERLINE; - return STYLE_OPERATOR_INDEX; - } - - case IDC_SYMBOL_BOLD2_CHECK : - { - fontStyleMask = FONTSTYLE_BOLD; - return STYLE_DELIM2_INDEX; - } - case IDC_SYMBOL_ITALIC2_CHECK : - { - fontStyleMask = FONTSTYLE_ITALIC; - return STYLE_DELIM2_INDEX; - } - case IDC_SYMBOL_UNDERLINE2_CHECK : - { - fontStyleMask = FONTSTYLE_UNDERLINE; - return STYLE_DELIM2_INDEX; - } - - case IDC_SYMBOL_BOLD3_CHECK : - { - fontStyleMask = FONTSTYLE_BOLD; - return STYLE_DELIM3_INDEX; - } - case IDC_SYMBOL_ITALIC3_CHECK : - { - fontStyleMask = FONTSTYLE_ITALIC; - return STYLE_DELIM3_INDEX; - } - case IDC_SYMBOL_UNDERLINE3_CHECK : - { - fontStyleMask = FONTSTYLE_UNDERLINE; - return STYLE_DELIM3_INDEX; - } - - default : - return -1; - } + case WM_COMMAND : + { + switch (wParam) + { + case IDC_OPERATOR_STYLER : + { + StylerDlg stylerDlg(_hInst, _hSelf, SCE_USER_STYLE_OPERATOR, SCE_USER_MASK_NESTING_NONE); + stylerDlg.doDialog(); + return TRUE; + } + case IDC_DELIMITER1_STYLER : + { + StylerDlg stylerDlg(_hInst, _hSelf, SCE_USER_STYLE_DELIMITER1); + stylerDlg.doDialog(); + return TRUE; + } + case IDC_DELIMITER2_STYLER : + { + StylerDlg stylerDlg(_hInst, _hSelf, SCE_USER_STYLE_DELIMITER2); + stylerDlg.doDialog(); + return TRUE; + } + case IDC_DELIMITER3_STYLER : + { + StylerDlg stylerDlg(_hInst, _hSelf, SCE_USER_STYLE_DELIMITER3); + stylerDlg.doDialog(); + return TRUE; + } + case IDC_DELIMITER4_STYLER : + { + StylerDlg stylerDlg(_hInst, _hSelf, SCE_USER_STYLE_DELIMITER4); + stylerDlg.doDialog(); + return TRUE; + } + case IDC_DELIMITER5_STYLER : + { + StylerDlg stylerDlg(_hInst, _hSelf, SCE_USER_STYLE_DELIMITER5); + stylerDlg.doDialog(); + return TRUE; + } + case IDC_DELIMITER6_STYLER : + { + StylerDlg stylerDlg(_hInst, _hSelf, SCE_USER_STYLE_DELIMITER6); + stylerDlg.doDialog(); + return TRUE; + } + case IDC_DELIMITER7_STYLER : + { + StylerDlg stylerDlg(_hInst, _hSelf, SCE_USER_STYLE_DELIMITER7); + stylerDlg.doDialog(); + return TRUE; + } + case IDC_DELIMITER8_STYLER : + { + StylerDlg stylerDlg(_hInst, _hSelf, SCE_USER_STYLE_DELIMITER8); + stylerDlg.doDialog(); + return TRUE; + } + default : + return SharedParametersDialog::run_dlgProc(Message, wParam, lParam); + } + } + default : + return SharedParametersDialog::run_dlgProc(Message, wParam, lParam); + } } -TCHAR styleName[][32] = {TEXT("DEFAULT"), TEXT("FOLDEROPEN"), TEXT("FOLDERCLOSE"), TEXT("KEYWORD1"), TEXT("KEYWORD2"), TEXT("KEYWORD3"), TEXT("KEYWORD4"), TEXT("COMMENT"), TEXT("COMMENT LINE"), TEXT("NUMBER"), TEXT("OPERATOR"), TEXT("DELIMINER1"), TEXT("DELIMINER2"), TEXT("DELIMINER3")}; +void SymbolsStyleDialog::convertTo(TCHAR *dest, const TCHAR *toConvert, TCHAR *prefix) const +{ + bool inGroup = false; + int index = lstrlen(dest); + if (index > 0) + dest[index++] = ' '; + dest[index++] = prefix[0]; + dest[index++] = prefix[1]; + for (int i = 0 ; i < int(lstrlen(toConvert)) ; i++) + { + if (i == 0 && toConvert[i] == '(' && toConvert[i+1] == '(') + { + inGroup = true; + } + else if (toConvert[i] == ' ' && toConvert[i+1] == '(' && toConvert[i+2] == '(') + { + inGroup = true; + dest[index++] = ' '; + dest[index++] = prefix[0]; + dest[index++] = prefix[1]; + ++i; // skip space + } + if (inGroup && toConvert[i-1] == ')' && toConvert[i-2] == ')') + { + inGroup = false; + } + + if (toConvert[i] == ' ') + { + if (toConvert[i+1] != ' ' && toConvert[i+1] != '\0') + { + dest[index++] = ' '; + if (!inGroup) + { + dest[index++] = prefix[0]; + dest[index++] = prefix[1]; + } + } + } + else + { + dest[index++] = toConvert[i]; + } + } + dest[index] = '\0'; +} + +void SymbolsStyleDialog::retrieve(TCHAR *dest, const TCHAR *toRetrieve, TCHAR *prefix) const +{ + int j = 0; + bool begin2Copy = false; + bool inGroup = false; + + for (int i = 0 ; i < int(lstrlen(toRetrieve)) ; i++) + { + if ((i == 0 || (toRetrieve[i-1] == ' ')) && (toRetrieve[i] == prefix[0] && toRetrieve[i+1] == prefix[1])) + { + if (j > 0) + dest[j++] = ' '; + + begin2Copy = true; + ++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] == ' ' && begin2Copy == true) + { + begin2Copy = false; + } + + if (begin2Copy || inGroup) + dest[j++] = toRetrieve[i]; + } + dest[j++] = '\0'; +} + +void SymbolsStyleDialog::setKeywords2List(int id) +{ + switch (id) + { + case IDC_OPERATOR1_EDIT : + ::GetDlgItemText(_hSelf, id, _pUserLang->_keywordLists[SCE_USER_KWLIST_OPERATORS1], max_char); + break; + case IDC_OPERATOR2_EDIT : + ::GetDlgItemText(_hSelf, id, _pUserLang->_keywordLists[SCE_USER_KWLIST_OPERATORS2], max_char); + break; + + case IDC_DELIMITER1_BOUNDARYOPEN_EDIT : + case IDC_DELIMITER1_ESCAPE_EDIT : + case IDC_DELIMITER1_BOUNDARYCLOSE_EDIT : + case IDC_DELIMITER2_BOUNDARYOPEN_EDIT : + case IDC_DELIMITER2_ESCAPE_EDIT : + case IDC_DELIMITER2_BOUNDARYCLOSE_EDIT : + case IDC_DELIMITER3_BOUNDARYOPEN_EDIT : + case IDC_DELIMITER3_ESCAPE_EDIT : + case IDC_DELIMITER3_BOUNDARYCLOSE_EDIT : + case IDC_DELIMITER4_BOUNDARYOPEN_EDIT : + case IDC_DELIMITER4_ESCAPE_EDIT : + case IDC_DELIMITER4_BOUNDARYCLOSE_EDIT : + case IDC_DELIMITER5_BOUNDARYOPEN_EDIT : + case IDC_DELIMITER5_ESCAPE_EDIT : + case IDC_DELIMITER5_BOUNDARYCLOSE_EDIT : + case IDC_DELIMITER6_BOUNDARYOPEN_EDIT : + case IDC_DELIMITER6_ESCAPE_EDIT : + case IDC_DELIMITER6_BOUNDARYCLOSE_EDIT : + case IDC_DELIMITER7_BOUNDARYOPEN_EDIT : + case IDC_DELIMITER7_ESCAPE_EDIT : + case IDC_DELIMITER7_BOUNDARYCLOSE_EDIT : + case IDC_DELIMITER8_BOUNDARYOPEN_EDIT : + 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}; + + 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; + } + default : + break; + } +} UserDefineDialog::UserDefineDialog(): SharedParametersDialog(), _status(UNDOCK), _yScrollPos(0), _prevHightVal(0), _isDirty(false) { - _pCurrentUserLang = new UserLangContainer(); + _pCurrentUserLang = new UserLangContainer(); - // @REF #01 NE CHANGER PAS D'ORDRE !!! - _pCurrentUserLang->_styleArray.addStyler(SCE_USER_IDENTIFIER, styleName[0]); - _pCurrentUserLang->_styleArray.addStyler(SCE_USER_BLOCK_OPERATOR_OPEN, styleName[1]); - _pCurrentUserLang->_styleArray.addStyler(SCE_USER_BLOCK_OPERATOR_CLOSE, styleName[2]); - _pCurrentUserLang->_styleArray.addStyler(SCE_USER_WORD1, styleName[3]); - _pCurrentUserLang->_styleArray.addStyler(SCE_USER_WORD2, styleName[4]); - _pCurrentUserLang->_styleArray.addStyler(SCE_USER_WORD3, styleName[5]); - _pCurrentUserLang->_styleArray.addStyler(SCE_USER_WORD4, styleName[6]); - _pCurrentUserLang->_styleArray.addStyler(SCE_USER_COMMENT, styleName[7]); - _pCurrentUserLang->_styleArray.addStyler(SCE_USER_COMMENTLINE, styleName[8]); - _pCurrentUserLang->_styleArray.addStyler(SCE_USER_NUMBER, styleName[9]); - _pCurrentUserLang->_styleArray.addStyler(SCE_USER_OPERATOR, styleName[10]); - _pCurrentUserLang->_styleArray.addStyler(SCE_USER_DELIMITER1, styleName[11]); - _pCurrentUserLang->_styleArray.addStyler(SCE_USER_DELIMITER2, styleName[12]); - _pCurrentUserLang->_styleArray.addStyler(SCE_USER_DELIMITER3, styleName[13]); + _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]); } UserDefineDialog::~UserDefineDialog() { - delete _pCurrentUserLang; + delete _pCurrentUserLang; } void UserDefineDialog::reloadLangCombo() { NppParameters *pNppParam = NppParameters::getInstance(); ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_RESETCONTENT, 0, 0); - ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_ADDSTRING, 0, (LPARAM)TEXT("User Define Language")); - for (int i = 0 ; i < pNppParam->getNbUserLang() ; i++) - { - UserLangContainer & userLangContainer = pNppParam->getULCFromIndex(i); - ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_ADDSTRING, 0, (LPARAM)userLangContainer.getName()); - } + ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_ADDSTRING, 0, (LPARAM)TEXT("User Define Language")); + for (int i = 0 ; i < pNppParam->getNbUserLang() ; i++) + { + UserLangContainer & userLangContainer = pNppParam->getULCFromIndex(i); + ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_ADDSTRING, 0, (LPARAM)userLangContainer.getName()); + } } void UserDefineDialog::changeStyle() @@ -1377,7 +940,7 @@ void UserDefineDialog::changeStyle() long result = ::SetWindowLongPtr(_hSelf, GWL_STYLE, style); if (!result) - ::MessageBox(NULL, TEXT("SetWindowLongPtr failed in UserDefineDialog::changeStyle()"), TEXT(""), MB_OK); + ::MessageBox(NULL, TEXT("SetWindowLongPtr failed in UserDefineDialog::changeStyle()"), TEXT(""), MB_OK); if (_status == DOCK) getActualPosSize(); @@ -1389,320 +952,320 @@ void UserDefineDialog::changeStyle() void UserDefineDialog::enableLangAndControlsBy(int index) { - _pUserLang = (index == 0)?_pCurrentUserLang:&((NppParameters::getInstance())->getULCFromIndex(index - 1)); - if (index != 0) - ::SetWindowText(::GetDlgItem(_hSelf, IDC_EXT_EDIT), _pUserLang->_ext.c_str()); + _pUserLang = (index == 0)?_pCurrentUserLang:&((NppParameters::getInstance())->getULCFromIndex(index - 1)); + if (index != 0) + ::SetWindowText(::GetDlgItem(_hSelf, IDC_EXT_EDIT), _pUserLang->_ext.c_str()); - ::ShowWindow(::GetDlgItem(_hSelf, IDC_EXT_STATIC), (index == 0)?SW_HIDE:SW_SHOW); - ::ShowWindow(::GetDlgItem(_hSelf, IDC_EXT_EDIT), (index == 0)?SW_HIDE:SW_SHOW); - ::ShowWindow(::GetDlgItem(_hSelf, IDC_RENAME_BUTTON), (index == 0)?SW_HIDE:SW_SHOW); - ::ShowWindow(::GetDlgItem(_hSelf, IDC_REMOVELANG_BUTTON), (index == 0)?SW_HIDE:SW_SHOW); + ::ShowWindow(::GetDlgItem(_hSelf, IDC_EXT_STATIC), (index == 0)?SW_HIDE:SW_SHOW); + ::ShowWindow(::GetDlgItem(_hSelf, IDC_EXT_EDIT), (index == 0)?SW_HIDE:SW_SHOW); + ::ShowWindow(::GetDlgItem(_hSelf, IDC_RENAME_BUTTON), (index == 0)?SW_HIDE:SW_SHOW); + ::ShowWindow(::GetDlgItem(_hSelf, IDC_REMOVELANG_BUTTON), (index == 0)?SW_HIDE:SW_SHOW); } -void UserDefineDialog::updateDlg() +void UserDefineDialog::updateDlg() { - if (!_isDirty) - { - int i = ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_GETCURSEL, 0, 0); - if (i > 0) - _isDirty = true; - } - ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_IGNORECASE_CHECK, BM_SETCHECK, _pUserLang->_isCaseIgnored, 0); - _folderStyleDlg.updateDlg(); - _keyWordsStyleDlg.updateDlg(); - _commentStyleDlg.updateDlg(); - _symbolsStyleDlg.updateDlg(); + if (!_isDirty) + { + int i = ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_GETCURSEL, 0, 0); + if (i > 0) + _isDirty = true; + } + ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_IGNORECASE_CHECK, BM_SETCHECK, _pUserLang->_isCaseIgnored, 0); + _folderStyleDlg.updateDlg(); + _keyWordsStyleDlg.updateDlg(); + _commentStyleDlg.updateDlg(); + _symbolsStyleDlg.updateDlg(); } BOOL CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) { - NppParameters *pNppParam = NppParameters::getInstance(); - switch (message) - { + NppParameters *pNppParam = NppParameters::getInstance(); + switch (message) + { case WM_INITDIALOG : { - _ctrlTab.init(_hInst, _hSelf, false); - _ctrlTab.setFont(TEXT("Tahoma"), 13); + _ctrlTab.init(_hInst, _hSelf, false); + _ctrlTab.setFont(TEXT("Tahoma"), 13); - _folderStyleDlg.init(_hInst, _hSelf); - _folderStyleDlg.create(IDD_FOLDER_STYLE_DLG); - _folderStyleDlg.display(); + _folderStyleDlg.init(_hInst, _hSelf); + _folderStyleDlg.create(IDD_FOLDER_STYLE_DLG); + _folderStyleDlg.display(); - _keyWordsStyleDlg.init(_hInst, _hSelf); - _keyWordsStyleDlg.create(IDD_KEYWORD_STYLE_DLG); - _keyWordsStyleDlg.display(false); + _keyWordsStyleDlg.init(_hInst, _hSelf); + _keyWordsStyleDlg.create(IDD_KEYWORD_STYLE_DLG); + _keyWordsStyleDlg.display(false); - _commentStyleDlg.init(_hInst, _hSelf); - _commentStyleDlg.create(IDD_COMMENT_STYLE_DLG); - _commentStyleDlg.display(false); + _commentStyleDlg.init(_hInst, _hSelf); + _commentStyleDlg.create(IDD_COMMENT_STYLE_DLG); + _commentStyleDlg.display(false); - _symbolsStyleDlg.init(_hInst, _hSelf); - _symbolsStyleDlg.create(IDD_SYMBOL_STYLE_DLG); - _symbolsStyleDlg.display(false); + _symbolsStyleDlg.init(_hInst, _hSelf); + _symbolsStyleDlg.create(IDD_SYMBOL_STYLE_DLG); + _symbolsStyleDlg.display(false); - _wVector.push_back(DlgInfo(&_folderStyleDlg, TEXT("Folder && Default"))); - _wVector.push_back(DlgInfo(&_keyWordsStyleDlg, TEXT("Keywords Lists"))); - _wVector.push_back(DlgInfo(&_commentStyleDlg, TEXT("Comment && Number"))); - _wVector.push_back(DlgInfo(&_symbolsStyleDlg, TEXT("Operators"))); + _wVector.push_back(DlgInfo(&_folderStyleDlg, TEXT("Folder && Default"))); + _wVector.push_back(DlgInfo(&_keyWordsStyleDlg, TEXT("Keywords Lists"))); + _wVector.push_back(DlgInfo(&_commentStyleDlg, TEXT("Comment && Number"))); + _wVector.push_back(DlgInfo(&_symbolsStyleDlg, TEXT("Operators && Delimiters"))); - _ctrlTab.createTabs(_wVector); - _ctrlTab.display(); + _ctrlTab.createTabs(_wVector); + _ctrlTab.display(); - RECT arc; - ::GetWindowRect(::GetDlgItem(_hSelf, IDC_IMPORT_BUTTON), &arc); + RECT arc; + ::GetWindowRect(::GetDlgItem(_hSelf, IDC_IMPORT_BUTTON), &arc); - POINT p; - p.x = arc.left; - p.y = arc.bottom; - ::ScreenToClient(_hSelf, &p); + POINT p; + p.x = arc.left; + p.y = arc.bottom; + ::ScreenToClient(_hSelf, &p); - RECT rc; - getClientRect(rc); - rc.top = p.y + 10; - rc.bottom -= 100; - _ctrlTab.reSizeTo(rc); + RECT rc; + getClientRect(rc); + rc.top = p.y + 10; + rc.bottom -= 100; + _ctrlTab.reSizeTo(rc); - _folderStyleDlg.reSizeTo(rc); - _keyWordsStyleDlg.reSizeTo(rc); - _commentStyleDlg.reSizeTo(rc); - _symbolsStyleDlg.reSizeTo(rc); + _folderStyleDlg.reSizeTo(rc); + _keyWordsStyleDlg.reSizeTo(rc); + _commentStyleDlg.reSizeTo(rc); + _symbolsStyleDlg.reSizeTo(rc); - reloadLangCombo(); + reloadLangCombo(); ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_SETCURSEL, 0, 0); - enableLangAndControlsBy(0); + enableLangAndControlsBy(0); - _pUserLang = _pCurrentUserLang; + _pUserLang = _pCurrentUserLang; - if (pNppParam->isTransparentAvailable()) - { - ::ShowWindow(::GetDlgItem(_hSelf, IDC_UD_TRANSPARENT_CHECK), SW_SHOW); - ::ShowWindow(::GetDlgItem(_hSelf, IDC_UD_PERCENTAGE_SLIDER), SW_SHOW); - - ::SendDlgItemMessage(_hSelf, IDC_UD_PERCENTAGE_SLIDER, TBM_SETRANGE, FALSE, MAKELONG(20, 200)); - ::SendDlgItemMessage(_hSelf, IDC_UD_PERCENTAGE_SLIDER, TBM_SETPOS, TRUE, 150); - if (!(BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_UD_PERCENTAGE_SLIDER, BM_GETCHECK, 0, 0))) - ::EnableWindow(::GetDlgItem(_hSelf, IDC_UD_PERCENTAGE_SLIDER), FALSE); - } - SCROLLINFO si; - si.cbSize = sizeof(si); - 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); - } + if (pNppParam->isTransparentAvailable()) + { + ::ShowWindow(::GetDlgItem(_hSelf, IDC_UD_TRANSPARENT_CHECK), SW_SHOW); + ::ShowWindow(::GetDlgItem(_hSelf, IDC_UD_PERCENTAGE_SLIDER), SW_SHOW); + + ::SendDlgItemMessage(_hSelf, IDC_UD_PERCENTAGE_SLIDER, TBM_SETRANGE, FALSE, MAKELONG(20, 200)); + ::SendDlgItemMessage(_hSelf, IDC_UD_PERCENTAGE_SLIDER, TBM_SETPOS, TRUE, 150); + if (!(BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_UD_PERCENTAGE_SLIDER, BM_GETCHECK, 0, 0))) + ::EnableWindow(::GetDlgItem(_hSelf, IDC_UD_PERCENTAGE_SLIDER), FALSE); + } + SCROLLINFO si; + si.cbSize = sizeof(si); + 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); + // } return TRUE; } - case WM_NOTIFY : - { - NMHDR *nmhdr = (NMHDR *)lParam; - if (nmhdr->code == TCN_SELCHANGE) - { - if (nmhdr->hwndFrom == _ctrlTab.getHSelf()) - { - _ctrlTab.clickedUpdate(); - return TRUE; - } - } - break; - } + case WM_NOTIFY : + { + NMHDR *nmhdr = (NMHDR *)lParam; + if (nmhdr->code == TCN_SELCHANGE) + { + if (nmhdr->hwndFrom == _ctrlTab.getHSelf()) + { + _ctrlTab.clickedUpdate(); + return TRUE; + } + } + break; + } - case WM_HSCROLL : - { - if ((HWND)lParam == ::GetDlgItem(_hSelf, IDC_UD_PERCENTAGE_SLIDER)) - { - int percent = ::SendDlgItemMessage(_hSelf, IDC_UD_PERCENTAGE_SLIDER, TBM_GETPOS, 0, 0); - pNppParam->SetTransparent(_hSelf, percent/*HIWORD(wParam)*/); - } - return TRUE; - } + case WM_HSCROLL : + { + if ((HWND)lParam == ::GetDlgItem(_hSelf, IDC_UD_PERCENTAGE_SLIDER)) + { + int percent = ::SendDlgItemMessage(_hSelf, IDC_UD_PERCENTAGE_SLIDER, TBM_GETPOS, 0, 0); + pNppParam->SetTransparent(_hSelf, percent/*HIWORD(wParam)*/); + } + return TRUE; + } - case WM_COMMAND : - { + case WM_COMMAND : + { if (HIWORD(wParam) == EN_CHANGE) { - TCHAR ext[extsLenMax]; - ::SendDlgItemMessage(_hSelf, IDC_EXT_EDIT, WM_GETTEXT, extsLenMax, (LPARAM)ext); - _pUserLang->_ext = ext; + TCHAR ext[extsLenMax]; + ::SendDlgItemMessage(_hSelf, IDC_EXT_EDIT, WM_GETTEXT, extsLenMax, (LPARAM)ext); + _pUserLang->_ext = ext; return TRUE; } else if (HIWORD(wParam) == CBN_SELCHANGE) { - if (LOWORD(wParam) == IDC_LANGNAME_COMBO) - { - int i = ::SendDlgItemMessage(_hSelf, LOWORD(wParam), CB_GETCURSEL, 0, 0); - enableLangAndControlsBy(i); - updateDlg(); - } + if (LOWORD(wParam) == IDC_LANGNAME_COMBO) + { + int i = ::SendDlgItemMessage(_hSelf, LOWORD(wParam), CB_GETCURSEL, 0, 0); + enableLangAndControlsBy(i); + updateDlg(); + } return TRUE; } else { - switch (wParam) - { - case IDC_DOCK_BUTTON : + switch (wParam) + { + case IDC_DOCK_BUTTON : { - int msg = WM_UNDOCK_USERDEFINE_DLG; - - if (_status == UNDOCK) - { - if (pNppParam->isTransparentAvailable()) - { - pNppParam->removeTransparent(_hSelf); - ::ShowWindow(::GetDlgItem(_hSelf, IDC_UD_TRANSPARENT_CHECK), SW_HIDE); - ::ShowWindow(::GetDlgItem(_hSelf, IDC_UD_PERCENTAGE_SLIDER), SW_HIDE); - } - msg = WM_DOCK_USERDEFINE_DLG; - } + int msg = WM_UNDOCK_USERDEFINE_DLG; + + if (_status == UNDOCK) + { + if (pNppParam->isTransparentAvailable()) + { + pNppParam->removeTransparent(_hSelf); + ::ShowWindow(::GetDlgItem(_hSelf, IDC_UD_TRANSPARENT_CHECK), SW_HIDE); + ::ShowWindow(::GetDlgItem(_hSelf, IDC_UD_PERCENTAGE_SLIDER), SW_HIDE); + } + msg = WM_DOCK_USERDEFINE_DLG; + } changeStyle(); - if (_status == UNDOCK) - { - if (pNppParam->isTransparentAvailable()) - { - bool isChecked = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_UD_TRANSPARENT_CHECK, BM_GETCHECK, 0, 0)); - if (isChecked) - { - int percent = ::SendDlgItemMessage(_hSelf, IDC_UD_PERCENTAGE_SLIDER, TBM_GETPOS, 0, 0); - pNppParam->SetTransparent(_hSelf, percent); - } - ::ShowWindow(::GetDlgItem(_hSelf, IDC_UD_TRANSPARENT_CHECK), SW_SHOW); - ::ShowWindow(::GetDlgItem(_hSelf, IDC_UD_PERCENTAGE_SLIDER), SW_SHOW); - } - } + if (_status == UNDOCK) + { + if (pNppParam->isTransparentAvailable()) + { + bool isChecked = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_UD_TRANSPARENT_CHECK, BM_GETCHECK, 0, 0)); + if (isChecked) + { + int percent = ::SendDlgItemMessage(_hSelf, IDC_UD_PERCENTAGE_SLIDER, TBM_GETPOS, 0, 0); + pNppParam->SetTransparent(_hSelf, percent); + } + ::ShowWindow(::GetDlgItem(_hSelf, IDC_UD_TRANSPARENT_CHECK), SW_SHOW); + ::ShowWindow(::GetDlgItem(_hSelf, IDC_UD_PERCENTAGE_SLIDER), SW_SHOW); + } + } ::SendMessage(_hParent, msg, 0, 0); - return TRUE; + return TRUE; } - case IDCANCEL : - ::SendMessage(_hParent, WM_CLOSE_USERDEFINE_DLG, 0, 0); - display(false); - return TRUE; + case IDCANCEL : + ::SendMessage(_hParent, WM_CLOSE_USERDEFINE_DLG, 0, 0); + display(false); + return TRUE; - case IDC_REMOVELANG_BUTTON : + case IDC_REMOVELANG_BUTTON : { - int result = ::MessageBox(_hSelf, TEXT("Are you sure?"), TEXT("Remove the current language"), MB_YESNO); - if (result == IDYES) - { - int i = ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_GETCURSEL, 0, 0); - TCHAR langName[256]; - ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_GETLBTEXT, i, (LPARAM)langName); + int result = ::MessageBox(_hSelf, TEXT("Are you sure?"), TEXT("Remove the current language"), MB_YESNO); + if (result == IDYES) + { + int i = ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_GETCURSEL, 0, 0); + TCHAR langName[256]; + ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_GETLBTEXT, i, (LPARAM)langName); - //remove current language from combobox - ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_DELETESTRING, i, 0); - ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_SETCURSEL, i-1, 0); - ::SendMessage(_hSelf, WM_COMMAND, MAKELONG(IDC_LANGNAME_COMBO, CBN_SELCHANGE), (LPARAM)::GetDlgItem(_hSelf, IDC_LANGNAME_COMBO)); + //remove current language from combobox + ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_DELETESTRING, i, 0); + ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_SETCURSEL, i-1, 0); + ::SendMessage(_hSelf, WM_COMMAND, MAKELONG(IDC_LANGNAME_COMBO, CBN_SELCHANGE), (LPARAM)::GetDlgItem(_hSelf, IDC_LANGNAME_COMBO)); - //remove current language from userLangArray - pNppParam->removeUserLang(i-1); + //remove current language from userLangArray + pNppParam->removeUserLang(i-1); - //remove current language from langMenu - HWND hNpp = ::GetParent(_hSelf); - ::RemoveMenu(::GetSubMenu((HMENU)::SendMessage(hNpp, NPPM_INTERNAL_GETMENU, 0, 0), MENUINDEX_LANGUAGE), IDM_LANG_USER + i, MF_BYCOMMAND); - ::DrawMenuBar(hNpp); - ::SendMessage(_hParent, WM_REMOVE_USERLANG, 0, (LPARAM)langName); - } - return TRUE; + //remove current language from langMenu + HWND hNpp = ::GetParent(_hSelf); + ::RemoveMenu(::GetSubMenu((HMENU)::SendMessage(hNpp, NPPM_INTERNAL_GETMENU, 0, 0), MENUINDEX_LANGUAGE), IDM_LANG_USER + i, MF_BYCOMMAND); + ::DrawMenuBar(hNpp); + ::SendMessage(_hParent, WM_REMOVE_USERLANG, 0, (LPARAM)langName); + } + return TRUE; } - case IDC_RENAME_BUTTON : + case IDC_RENAME_BUTTON : { - TCHAR langName[256]; - int i = ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_GETCURSEL, 0, 0); - ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_GETLBTEXT, i, (LPARAM)langName); + TCHAR langName[256]; + int i = ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_GETCURSEL, 0, 0); + ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_GETLBTEXT, i, (LPARAM)langName); - StringDlg strDlg; - strDlg.init(_hInst, _hSelf, TEXT("Rename Current Language Name"), TEXT("Name : "), langName, langNameLenMax-1); + StringDlg strDlg; + strDlg.init(_hInst, _hSelf, TEXT("Rename Current Language Name"), TEXT("Name : "), langName, langNameLenMax-1); - TCHAR *newName = (TCHAR *)strDlg.doDialog(); + TCHAR *newName = (TCHAR *)strDlg.doDialog(); - if (newName) - { - if (pNppParam->isExistingUserLangName(newName)) - { - ::MessageBox(_hSelf, TEXT("This name is used by another language,\rplease give another one."), TEXT("Err"), MB_OK); - ::PostMessage(_hSelf, WM_COMMAND, IDC_RENAME_BUTTON, 0); - return TRUE; - } - //rename current language name in combobox - ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_DELETESTRING, i, 0); - ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_INSERTSTRING, i, (LPARAM)newName); - ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_SETCURSEL, i, 0); - - //rename current language name in userLangArray - UserLangContainer & userLangContainer = pNppParam->getULCFromIndex(i-1); - userLangContainer._name = newName; + if (newName) + { + if (pNppParam->isExistingUserLangName(newName)) + { + ::MessageBox(_hSelf, TEXT("This name is used by another language,\rplease give another one."), TEXT("Err"), MB_OK); + ::PostMessage(_hSelf, WM_COMMAND, IDC_RENAME_BUTTON, 0); + return TRUE; + } + //rename current language name in combobox + ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_DELETESTRING, i, 0); + ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_INSERTSTRING, i, (LPARAM)newName); + ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_SETCURSEL, i, 0); - //rename current language name in langMenu - HWND hNpp = ::GetParent(_hSelf); - ::ModifyMenu(::GetSubMenu((HMENU)::SendMessage(hNpp, NPPM_INTERNAL_GETMENU, 0, 0), MENUINDEX_LANGUAGE), IDM_LANG_USER + i, MF_BYCOMMAND, IDM_LANG_USER + i, newName); - ::DrawMenuBar(hNpp); - ::SendMessage(_hParent, WM_RENAME_USERLANG, (WPARAM)newName, (LPARAM)langName); - } + //rename current language name in userLangArray + UserLangContainer & userLangContainer = pNppParam->getULCFromIndex(i-1); + userLangContainer._name = newName; - return TRUE; + //rename current language name in langMenu + HWND hNpp = ::GetParent(_hSelf); + ::ModifyMenu(::GetSubMenu((HMENU)::SendMessage(hNpp, NPPM_INTERNAL_GETMENU, 0, 0), MENUINDEX_LANGUAGE), IDM_LANG_USER + i, MF_BYCOMMAND, IDM_LANG_USER + i, newName); + ::DrawMenuBar(hNpp); + ::SendMessage(_hParent, WM_RENAME_USERLANG, (WPARAM)newName, (LPARAM)langName); + } + + return TRUE; } - case IDC_ADDNEW_BUTTON : - case IDC_SAVEAS_BUTTON : + case IDC_ADDNEW_BUTTON : + case IDC_SAVEAS_BUTTON : { - //TCHAR langName[256]; - int i = ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_GETCURSEL, 0, 0); - //::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_GETLBTEXT, i, (LPARAM)langName); - if (i == 0) - wParam = IDC_ADDNEW_BUTTON; + //TCHAR langName[256]; + int i = ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_GETCURSEL, 0, 0); + //::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_GETLBTEXT, i, (LPARAM)langName); + if (i == 0) + wParam = IDC_ADDNEW_BUTTON; - StringDlg strDlg; - if (wParam == IDC_SAVEAS_BUTTON) - strDlg.init(_hInst, _hSelf, TEXT("Save Current Language Name As..."), TEXT("Name : "), TEXT(""), langNameLenMax-1); - else - strDlg.init(_hInst, _hSelf, TEXT("Create New Language..."), TEXT("Name : "), TEXT(""), langNameLenMax-1); + StringDlg strDlg; + if (wParam == IDC_SAVEAS_BUTTON) + strDlg.init(_hInst, _hSelf, TEXT("Save Current Language Name As..."), TEXT("Name : "), TEXT(""), langNameLenMax-1); + else + strDlg.init(_hInst, _hSelf, TEXT("Create New Language..."), TEXT("Name : "), TEXT(""), langNameLenMax-1); - TCHAR *tmpName = (TCHAR *)strDlg.doDialog(); - //const TCHAR *newName = newNameString.c_str(); + TCHAR *tmpName = (TCHAR *)strDlg.doDialog(); + //const TCHAR *newName = newNameString.c_str(); - if (tmpName && tmpName[0]) - { - generic_string newNameString(tmpName); - const TCHAR *newName = newNameString.c_str(); + if (tmpName && tmpName[0]) + { + generic_string newNameString(tmpName); + const TCHAR *newName = newNameString.c_str(); - if (pNppParam->isExistingUserLangName(newName)) - { - ::MessageBox(_hSelf, TEXT("This name is used by another language,\rplease give another one."), TEXT("Err"), MB_OK); - ::PostMessage(_hSelf, WM_COMMAND, IDC_RENAME_BUTTON, 0); - return TRUE; - } - //add current language in userLangArray at the end as a new lang - UserLangContainer & userLang = (wParam == IDC_SAVEAS_BUTTON)?pNppParam->getULCFromIndex(i-1):*_pCurrentUserLang; - int newIndex = pNppParam->addUserLangToEnd(userLang, newName); + if (pNppParam->isExistingUserLangName(newName)) + { + ::MessageBox(_hSelf, TEXT("This name is used by another language,\rplease give another one."), TEXT("Err"), MB_OK); + ::PostMessage(_hSelf, WM_COMMAND, IDC_RENAME_BUTTON, 0); + return TRUE; + } + //add current language in userLangArray at the end as a new lang + UserLangContainer & userLang = (wParam == IDC_SAVEAS_BUTTON)?pNppParam->getULCFromIndex(i-1):*_pCurrentUserLang; + int newIndex = pNppParam->addUserLangToEnd(userLang, newName); - //add new language name in combobox - ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_ADDSTRING, 0, LPARAM(newName)); - ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_SETCURSEL, newIndex + 1, 0); - ::SendMessage(_hSelf, WM_COMMAND, MAKELONG(IDC_LANGNAME_COMBO, CBN_SELCHANGE), (LPARAM)::GetDlgItem(_hSelf, IDC_LANGNAME_COMBO)); + //add new language name in combobox + ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_ADDSTRING, 0, LPARAM(newName)); + ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_SETCURSEL, newIndex + 1, 0); + ::SendMessage(_hSelf, WM_COMMAND, MAKELONG(IDC_LANGNAME_COMBO, CBN_SELCHANGE), (LPARAM)::GetDlgItem(_hSelf, IDC_LANGNAME_COMBO)); - //add new language name in langMenu - HWND hNpp = ::GetParent(_hSelf); - ::InsertMenu(::GetSubMenu((HMENU)::SendMessage(hNpp, NPPM_INTERNAL_GETMENU, 0, 0), MENUINDEX_LANGUAGE), IDM_LANG_USER + newIndex /*+ 1*/, MF_BYCOMMAND, IDM_LANG_USER + newIndex + 1, newName); - ::DrawMenuBar(hNpp); - } + //add new language name in langMenu + HWND hNpp = ::GetParent(_hSelf); + ::InsertMenu(::GetSubMenu((HMENU)::SendMessage(hNpp, NPPM_INTERNAL_GETMENU, 0, 0), MENUINDEX_LANGUAGE), IDM_LANG_USER + newIndex /*+ 1*/, MF_BYCOMMAND, IDM_LANG_USER + newIndex + 1, newName); + ::DrawMenuBar(hNpp); + } - return TRUE; + return TRUE; } - case IDC_IMPORT_BUTTON : + case IDC_IMPORT_BUTTON : { NppParameters *pNppParam = NppParameters::getInstance(); FileDialog fDlg(_hSelf, ::GetModuleHandle(NULL)); - fDlg.setExtFilter(TEXT("UDL"), TEXT(".xml"), NULL); + fDlg.setExtFilter(TEXT("UDL"), TEXT(".xml"), NULL); TCHAR *fn = fDlg.doOpenSingleFileDlg(); if (!fn) break; generic_string sourceFile = fn; @@ -1723,18 +1286,25 @@ BOOL CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPARAM break; } - case IDC_EXPORT_BUTTON : + case IDC_EXPORT_BUTTON : { NppParameters *pNppParam = NppParameters::getInstance(); + int i2Export = ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_GETCURSEL, 0, 0); + + if (i2Export == 0) + { + // maybe a better option would be to simply send IDC_SAVEAS_BUTTON message, and display "Save As..." dialog? + printStr(TEXT("Before exporting, save your language definition by clicking \"Save As...\" button")); + break; + } + FileDialog fDlg(_hSelf, ::GetModuleHandle(NULL)); - fDlg.setExtFilter(TEXT("UDL"), TEXT(".xml"), NULL); + fDlg.setExtFilter(TEXT("UDL"), TEXT(".xml"), NULL); TCHAR *fn = fDlg.doSaveDlg(); if (!fn) break; generic_string fileName2save = fn; - int i2Export = ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_GETCURSEL, 0, 0); - if (i2Export > 0) { bool isSuccessful = pNppParam->exportUDLToFile(i2Export - 1, fileName2save); @@ -1750,165 +1320,362 @@ BOOL CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPARAM break; } - case IDC_UD_TRANSPARENT_CHECK : - { - bool isChecked = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_UD_TRANSPARENT_CHECK, BM_GETCHECK, 0, 0)); - if (isChecked) - { - int percent = ::SendDlgItemMessage(_hSelf, IDC_UD_PERCENTAGE_SLIDER, TBM_GETPOS, 0, 0); - pNppParam->SetTransparent(_hSelf, percent); - } - else - pNppParam->removeTransparent(_hSelf); + case IDC_UD_TRANSPARENT_CHECK : + { + bool isChecked = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_UD_TRANSPARENT_CHECK, BM_GETCHECK, 0, 0)); + if (isChecked) + { + int percent = ::SendDlgItemMessage(_hSelf, IDC_UD_PERCENTAGE_SLIDER, TBM_GETPOS, 0, 0); + pNppParam->SetTransparent(_hSelf, percent); + } + else + pNppParam->removeTransparent(_hSelf); - ::EnableWindow(::GetDlgItem(_hSelf, IDC_UD_PERCENTAGE_SLIDER), isChecked); - return TRUE; - } + ::EnableWindow(::GetDlgItem(_hSelf, IDC_UD_PERCENTAGE_SLIDER), isChecked); + return TRUE; + } - case IDC_LANGNAME_IGNORECASE_CHECK : - return setPropertyByCheck(_hSelf, wParam, _pUserLang->_isCaseIgnored); + case IDC_LANGNAME_IGNORECASE_CHECK : + return setPropertyByCheck(_hSelf, wParam, _pUserLang->_isCaseIgnored); - default : - break; - } + default : + break; + } } - return FALSE; - } + return FALSE; + } - case WM_DESTROY: - { - _folderStyleDlg.destroy(); - _keyWordsStyleDlg.destroy(); - _commentStyleDlg.destroy(); - _symbolsStyleDlg.destroy(); + case WM_DESTROY: + { + _folderStyleDlg.destroy(); + _keyWordsStyleDlg.destroy(); + _commentStyleDlg.destroy(); + _symbolsStyleDlg.destroy(); - _ctrlTab.destroy(); - return TRUE; - } + _ctrlTab.destroy(); + return TRUE; + } - case WM_SIZE: - { - int originalHight = _dlgPos.bottom; //- ((_status == DOCK)?_dlgPos.top:0); - _currentHight = HIWORD (lParam); + case WM_SIZE: + { + int originalHight = _dlgPos.bottom; //- ((_status == DOCK)?_dlgPos.top:0); + _currentHight = HIWORD (lParam); - int diff = _currentHight - _prevHightVal; - _prevHightVal = _currentHight; + int diff = _currentHight - _prevHightVal; + _prevHightVal = _currentHight; - int maxPos = originalHight - _currentHight; - // Set the vertical scrolling range and page size - SCROLLINFO si; - si.cbSize = sizeof(si); - si.fMask = SIF_RANGE | SIF_PAGE; - si.nMin = 0; - si.nMax = (_status == UNDOCK)?0:originalHight; - si.nPage = _currentHight; - //si.nPos = 0; - ::SetScrollInfo(_hSelf, SB_VERT, &si, TRUE); + int maxPos = originalHight - _currentHight; + // Set the vertical scrolling range and page size + SCROLLINFO si; + si.cbSize = sizeof(si); + si.fMask = SIF_RANGE | SIF_PAGE; + si.nMin = 0; + si.nMax = (_status == UNDOCK)?0:originalHight; + si.nPage = _currentHight; + //si.nPos = 0; + ::SetScrollInfo(_hSelf, SB_VERT, &si, TRUE); - if ((_yScrollPos >= maxPos) && (_currentHight < originalHight)) - { - //int nDelta = min(max(maxPos/10,5), maxPos - _yScrollPos); - if (_yScrollPos > 0) - { - _yScrollPos -= diff; - ::SetScrollPos(_hSelf, SB_VERT, _yScrollPos, TRUE); - ::ScrollWindow(_hSelf, 0, diff, NULL, NULL); - } - } - return TRUE; - } + if ((_yScrollPos >= maxPos) && (_currentHight < originalHight)) + { + //int nDelta = min(max(maxPos/10,5), maxPos - _yScrollPos); + if (_yScrollPos > 0) + { + _yScrollPos -= diff; + ::SetScrollPos(_hSelf, SB_VERT, _yScrollPos, TRUE); + ::ScrollWindow(_hSelf, 0, diff, NULL, NULL); + } + } + return TRUE; + } - case WM_VSCROLL : - { - int originalHight = _dlgPos.bottom; - int oldy = _yScrollPos; - int maxPos = originalHight - _currentHight; + case WM_VSCROLL : + { + int originalHight = _dlgPos.bottom; + int oldy = _yScrollPos; + int maxPos = originalHight - _currentHight; - switch (LOWORD (wParam)) - { - // user clicked the top arrow - case SB_LINEUP: - if (_yScrollPos <= 0) - return FALSE; - _yScrollPos = 0; - break; + switch (LOWORD (wParam)) + { + // user clicked the top arrow + case SB_LINEUP: + if (_yScrollPos <= 0) + return FALSE; + _yScrollPos = 0; + break; - // user clicked the bottom arrow - case SB_LINEDOWN: - if (_yScrollPos >= maxPos) - return FALSE; - _yScrollPos = maxPos; - break; + // user clicked the bottom arrow + case SB_LINEDOWN: + if (_yScrollPos >= maxPos) + return FALSE; + _yScrollPos = maxPos; + break; - case SB_PAGEDOWN: - if (_yScrollPos >= maxPos) - return FALSE; - _yScrollPos = maxPos; - break; + case SB_PAGEDOWN: + if (_yScrollPos >= maxPos) + return FALSE; + _yScrollPos = maxPos; + break; - case SB_PAGEUP: - if (_yScrollPos <= 0) - return FALSE; - _yScrollPos = 0; - break; + case SB_PAGEUP: + if (_yScrollPos <= 0) + return FALSE; + _yScrollPos = 0; + break; - case SB_THUMBTRACK: - case SB_THUMBPOSITION: - _yScrollPos = (int)HIWORD(wParam); - break; + case SB_THUMBTRACK: + case SB_THUMBPOSITION: + _yScrollPos = (int)HIWORD(wParam); + break; - default : - return FALSE; - } - ::SetScrollPos(_hSelf, SB_VERT, _yScrollPos, TRUE); - ::ScrollWindow(_hSelf, 0, oldy-_yScrollPos, NULL, NULL); - } - case NPPM_MODELESSDIALOG : - return ::SendMessage(_hParent, NPPM_MODELESSDIALOG, wParam, lParam); + default : + return FALSE; + } + ::SetScrollPos(_hSelf, SB_VERT, _yScrollPos, TRUE); + ::ScrollWindow(_hSelf, 0, oldy-_yScrollPos, NULL, NULL); + } + case NPPM_MODELESSDIALOG : + return ::SendMessage(_hParent, NPPM_MODELESSDIALOG, wParam, lParam); } - - return FALSE; + + return FALSE; } BOOL CALLBACK StringDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM) { + switch (Message) + { + case WM_INITDIALOG : + { + ::SetWindowText(_hSelf, _title.c_str()); + ::SetDlgItemText(_hSelf, IDC_STRING_STATIC, _static.c_str()); + ::SetDlgItemText(_hSelf, IDC_STRING_EDIT, _textValue.c_str()); + if (_txtLen) + ::SendDlgItemMessage(_hSelf, IDC_STRING_EDIT, EM_SETLIMITTEXT, _txtLen, 0); - switch (Message) - { - case WM_INITDIALOG : - { - ::SetWindowText(_hSelf, _title.c_str()); - ::SetDlgItemText(_hSelf, IDC_STRING_STATIC, _static.c_str()); - ::SetDlgItemText(_hSelf, IDC_STRING_EDIT, _textValue.c_str()); - if (_txtLen) - ::SendDlgItemMessage(_hSelf, IDC_STRING_EDIT, EM_SETLIMITTEXT, _txtLen, 0); + return TRUE; + } - return TRUE; - } + case WM_COMMAND : + { + switch (wParam) + { + case IDOK : + { + TCHAR tmpName[langNameLenMax]; + tmpName[0] = '\0'; + ::GetDlgItemText(_hSelf, IDC_STRING_EDIT, (LPTSTR)tmpName, langNameLenMax); + _textValue = tmpName; + ::EndDialog(_hSelf, int(_textValue.c_str())); + return TRUE; + } - case WM_COMMAND : - { - switch (wParam) - { - case IDOK : - { - TCHAR tmpName[langNameLenMax]; - tmpName[0] = '\0'; - ::GetDlgItemText(_hSelf, IDC_STRING_EDIT, (LPTSTR)tmpName, langNameLenMax); - _textValue = tmpName; - ::EndDialog(_hSelf, int(_textValue.c_str())); - return TRUE; - } + case IDCANCEL : + ::EndDialog(_hSelf, 0); + return TRUE; - case IDCANCEL : - ::EndDialog(_hSelf, 0); - return TRUE; - - default: - return FALSE; - } - } - default : - return FALSE; - } + default: + return FALSE; + } + } + default : + return FALSE; + } +} + +BOOL CALLBACK StylerDlg::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + StylerDlg * dlg = (StylerDlg *)::GetProp(hwnd, TEXT("Styler dialog prop")); + NppParameters *pNppParam = NppParameters::getInstance(); + + switch (message) + { + case WM_INITDIALOG : + { + ::SetProp(hwnd, TEXT("Styler dialog prop"), (HANDLE)lParam); + 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); + ::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); + + // for the font size combo + HWND hFontSizeCombo = ::GetDlgItem(hwnd, IDC_STYLER_COMBO_FONT_SIZE); + for(int j = 0 ; j < int(sizeof(fontSizeStrs))/(3*sizeof(TCHAR)) ; j++) + ::SendMessage(hFontSizeCombo, CB_ADDSTRING, 0, (LPARAM)fontSizeStrs[j]); + + TCHAR size[10]; + if (style._fontSize == -1) + size[0] = '\0'; + else + wsprintf(size, TEXT("%d"),style._fontSize); + + int i = ::SendMessage(hFontSizeCombo, CB_FINDSTRINGEXACT, (WPARAM)-1, (LPARAM)size); + if (i != CB_ERR) + ::SendMessage(hFontSizeCombo, CB_SETCURSEL, i, 0); + + // for the font name combo + HWND hFontNameCombo = ::GetDlgItem(hwnd, IDC_STYLER_COMBO_FONT_NAME); + const std::vector & fontlist = pNppParam->getFontList(); + for (int j = 0 ; j < int(fontlist.size()) ; j++) + { + int k = ::SendMessage(hFontNameCombo, CB_ADDSTRING, 0, (LPARAM)fontlist[j].c_str()); + ::SendMessage(hFontNameCombo, CB_SETITEMDATA, k, (LPARAM)fontlist[j].c_str()); + } + + i = ::SendMessage(hFontNameCombo, CB_FINDSTRINGEXACT, (WPARAM)-1, (LPARAM)style._fontName); + if (i == CB_ERR) + i = 0; + ::SendMessage(hFontNameCombo, CB_SETCURSEL, i, 0); + + HWND hFgColourStaticText = ::GetDlgItem(hwnd, IDC_STYLER_FG_STATIC); + HWND hBgColourStaticText = ::GetDlgItem(hwnd, IDC_STYLER_BG_STATIC); + + if (style._fgColor == COLORREF(-1)) + style._fgColor = black; + + if (style._bgColor == COLORREF(-1)) + style._bgColor = white; + + dlg->pFgColour->init(dlg->hInst, hwnd); + dlg->pFgColour->setColour(style._fgColor); + dlg->pBgColour->init(dlg->hInst, hwnd); + dlg->pBgColour->setColour(style._bgColor); + + POINT p1, p2; + RECT rc1, rc2; + + ::GetWindowRect(hFgColourStaticText, &rc1); + ::GetWindowRect(hBgColourStaticText, &rc2); + + p1.x = rc1.left; p1.y = rc1.top; + p2.x = rc2.left; p2.y = rc2.top; + + p1.x += rc1.right - rc1.left; + p2.x += rc2.right - rc2.left; + + ::ScreenToClient(hwnd, &p1); + ::ScreenToClient(hwnd, &p2); + + p1.x += 10; p2.x += 10; + p1.y -= 6; p2.y -= 6; + + ::MoveWindow(dlg->pFgColour->getHSelf(), p1.x, p1.y, 30, 30, TRUE); + ::MoveWindow(dlg->pBgColour->getHSelf(), p2.x, p2.y, 30, 30, TRUE); + + dlg->pFgColour->display(); + dlg->pBgColour->display(); + + for (int i=0; ienabledNesters & nestingMapper[i][1]); + } + return TRUE; + } + + case WM_COMMAND : + { + Style & style = SharedParametersDialog::_pUserLang->_styleArray.getStyler(dlg->stylerIndex); + if (HIWORD(wParam) == CBN_SELCHANGE) + { + int i = ::SendDlgItemMessage(hwnd, LOWORD(wParam), CB_GETCURSEL, 0, 0); + Style & style = SharedParametersDialog::_pUserLang->_styleArray.getStyler(dlg->stylerIndex); + if (LOWORD(wParam) == IDC_STYLER_COMBO_FONT_SIZE) + { + TCHAR intStr[5]; + if (i != 0) + { + ::SendDlgItemMessage(hwnd, LOWORD(wParam), CB_GETLBTEXT, i, (LPARAM)intStr); + if ((!intStr) || (!intStr[0])) + style._fontSize = -1; + else + { + TCHAR *finStr; + style._fontSize = generic_strtol(intStr, &finStr, 10); + if (*finStr != '\0') + 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(); + return TRUE; + } + else if (HIWORD(wParam) == CPN_COLOURPICKED) // #define CPN_COLOURPICKED (BN_CLICKED) + { + if (wParam == IDCANCEL) + { + style = dlg->initialStyle; + + // show changes to user, re-color document + if (SharedParametersDialog::_pScintilla->getCurrentBuffer()->getLangType() == L_USER) + SharedParametersDialog::_pScintilla->styleChange(); + + ::RemoveProp(hwnd, TEXT("Styler dialog prop")); + ::EndDialog(hwnd, IDCANCEL); + return TRUE; + } + + if (wParam == IDOK) + { + ::RemoveProp(hwnd, TEXT("Styler dialog prop")); + ::EndDialog(hwnd, IDOK); + return TRUE; + } + + style._fgColor = dlg->pFgColour->getColour(); + style._bgColor = dlg->pBgColour->getColour(); + + if (dlg->pFgColour->isEnabled()) + style._colorStyle |= COLORSTYLE_FOREGROUND; + else + style._colorStyle &= ~COLORSTYLE_FOREGROUND; + if (dlg->pBgColour->isEnabled()) + style._colorStyle |= COLORSTYLE_BACKGROUND; + else + style._colorStyle &= ~COLORSTYLE_BACKGROUND; + + style._fontStyle = FONTSTYLE_NONE; + if (BST_CHECKED == ::SendMessage(::GetDlgItem(hwnd, IDC_STYLER_CHECK_BOLD), BM_GETCHECK, 0, 0)) + style._fontStyle |= FONTSTYLE_BOLD; + if (BST_CHECKED == ::SendMessage(::GetDlgItem(hwnd, IDC_STYLER_CHECK_ITALIC), BM_GETCHECK, 0, 0)) + style._fontStyle |= FONTSTYLE_ITALIC; + if (BST_CHECKED == ::SendMessage(::GetDlgItem(hwnd, IDC_STYLER_CHECK_UNDERLINE), BM_GETCHECK, 0, 0)) + style._fontStyle |= FONTSTYLE_UNDERLINE; + + style._nesting = SCE_USER_MASK_NESTING_NONE; + for (int i=0; igetCurrentBuffer()->getLangType() == L_USER) + SharedParametersDialog::_pScintilla->styleChange(); + + return TRUE; + } + } + default : + return FALSE; + } } diff --git a/PowerEditor/src/ScitillaComponent/UserDefineDialog.h b/PowerEditor/src/ScitillaComponent/UserDefineDialog.h index e274a54d..f03011ed 100644 --- a/PowerEditor/src/ScitillaComponent/UserDefineDialog.h +++ b/PowerEditor/src/ScitillaComponent/UserDefineDialog.h @@ -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. @@ -24,332 +24,335 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - #ifndef USER_DEFINE_H #define USER_DEFINE_H - #ifndef USERDEFINE_RC_H #include "UserDefineResource.h" #endif //USERDEFINE_RC_H - #ifndef CONTROLS_TAB_H #include "ControlsTab.h" #endif //CONTROLS_TAB_H - #ifndef COLOUR_PICKER_H #include "ColourPicker.h" #endif //COLOUR_PICKER_H - #ifndef PARAMETERS_H #include "Parameters.h" #endif //PARAMETERS_H - +#ifndef URLCTRL_INCLUDED +#include "URLCtrl.h" +#endif// URLCTRL_INCLUDED #ifdef __GNUC__ static int min(int a, int b) { - return (ab)?a:b; + return (a>b)?a:b; }; #endif //__GNUC__ - +#include "tchar.h" +#include "scilexer.h" +#include +using namespace std; class ScintillaEditView; class UserLangContainer; struct Style; - #define WL_LEN_MAX 1024 - #define BOLD_MASK 1 #define ITALIC_MASK 2 - -const int nbWordList = 4; -const int nbBlockColor = 5; -const int nbBoolean = 5; - const bool DOCK = true; const bool UNDOCK = false; - -const int maxNbGroup = 10; - -const int KWL_FOLDER_OPEN_INDEX = 1; -const int KWL_FOLDER_CLOSE_INDEX = 2; -const int KWL_OPERATOR_INDEX = 3; -const int KWL_COMMENT_INDEX = 4; -const int KWL_KW1_INDEX = 5; -const int KWL_KW2_INDEX = 6; -const int KWL_KW3_INDEX = 7; -const int KWL_KW4_INDEX = 8; -const int KWL_DELIM_INDEX = 0; - -const int STYLE_DEFAULT_INDEX = 0; -const int STYLE_BLOCK_OPEN_INDEX = 1; -const int STYLE_BLOCK_CLOSE_INDEX = 2; -const int STYLE_WORD1_INDEX = 3; -const int STYLE_WORD2_INDEX = 4; -const int STYLE_WORD3_INDEX = 5; -const int STYLE_WORD4_INDEX = 6; -const int STYLE_COMMENT_INDEX = 7; -const int STYLE_COMMENTLINE_INDEX = 8; -const int STYLE_NUMBER_INDEX = 9; -const int STYLE_OPERATOR_INDEX = 10; -const int STYLE_DELIM2_INDEX = 11; -const int STYLE_DELIM3_INDEX = 12; - - - +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 SharedParametersDialog : public StaticDialog { +friend class StylerDlg; public: - SharedParametersDialog() {}; - SharedParametersDialog(int nbGroup) : _nbGroup(nbGroup) {}; - virtual void updateDlg() = 0; - - + SharedParametersDialog() {}; + virtual void updateDlg() = 0; protected : - //Shared data - static UserLangContainer *_pUserLang; - static ScintillaEditView *_pScintilla; - - //data for per object - int _nbGroup; - ColourPicker *_pFgColour[maxNbGroup]; - ColourPicker *_pBgColour[maxNbGroup]; - int _fgStatic[maxNbGroup]; - int _bgStatic[maxNbGroup]; - int _fontSizeCombo[maxNbGroup]; - int _fontNameCombo[maxNbGroup]; - + //Shared data + static UserLangContainer *_pUserLang; + static ScintillaEditView *_pScintilla; BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam); - void initControls(); - void styleUpdate(const Style & style, ColourPicker *pFgColourPicker, ColourPicker *pBgColourPicker, - int fontComboId, int fontSizeComboId, int boldCheckId, int italicCheckId, int underlineCheckId); - - bool setPropertyByCheck(HWND hwnd, WPARAM id, bool & bool2set); - virtual void setKeywords2List(int ctrlID) = 0; - virtual int getGroupIndexFromCombo(int ctrlID, bool & isFontSize) const = 0; - virtual int getStylerIndexFromCP(HWND hWnd, bool & isFG, ColourPicker **ppCP) const = 0; - virtual int getGroupeIndexFromCheck(int ctrlID, int & fontStyleMask) const = 0; - - + bool setPropertyByCheck(HWND hwnd, WPARAM id, bool & bool2set); + virtual void setKeywords2List(int ctrlID) = 0; }; - class FolderStyleDialog : public SharedParametersDialog { public: - FolderStyleDialog(); - void updateDlg(); + FolderStyleDialog(): SharedParametersDialog() {}; + void updateDlg(); protected : - void setKeywords2List(int ctrlID); - - int getGroupIndexFromCombo(int ctrlID, bool & isFontSize) const; - int getStylerIndexFromCP(HWND hWnd, bool & isFG, ColourPicker **ppCP) const; - int getGroupeIndexFromCheck(int ctrlID, int & fontStyleMask) const; + BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam); + void setKeywords2List(int ctrlID); +private : + void convertTo(TCHAR *dest, const TCHAR *toConvert, TCHAR *prefix) const; + void retrieve(TCHAR *dest, const TCHAR *toRetrieve, TCHAR *prefix) const; + URLCtrl _pageLink; }; - class KeyWordsStyleDialog : public SharedParametersDialog { public: - KeyWordsStyleDialog() ; - void updateDlg(); - + KeyWordsStyleDialog(): SharedParametersDialog() {}; + void updateDlg(); protected : - BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam); - void setKeywords2List(int id); - - // SEE @REF #01 - int getGroupIndexFromCombo(int ctrlID, bool & isFontSize) const; - int getStylerIndexFromCP(HWND hWnd, bool & isFG, ColourPicker **ppCP) const; - int getGroupeIndexFromCheck(int ctrlID, int & fontStyleMask) const; + BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam); + void setKeywords2List(int id); }; - class CommentStyleDialog : public SharedParametersDialog { public : - CommentStyleDialog(); + CommentStyleDialog(): SharedParametersDialog() {}; void updateDlg(); protected : - - BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam); - + BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam); void setKeywords2List(int id); - int getGroupIndexFromCombo(int ctrlID, bool & isFontSize) const; - - int getStylerIndexFromCP(HWND hWnd, bool & isFG, ColourPicker **ppCP) const; - int getGroupeIndexFromCheck(int ctrlID, int & fontStyleMask) const; - private : - void convertTo(TCHAR *dest, const TCHAR *toConvert, TCHAR prefix) const; - void retrieve(TCHAR *dest, const TCHAR *toRetrieve, TCHAR prefix) const; + void convertTo(TCHAR *dest, const TCHAR *toConvert, TCHAR *prefix) const; + void retrieve(TCHAR *dest, const TCHAR *toRetrieve, TCHAR *prefix) const; }; - -class SymbolsStyleDialog : public SharedParametersDialog +class SymbolsStyleDialog : public SharedParametersDialog { public : - static const bool ADD; - static const bool REMOVE; - SymbolsStyleDialog(); - void updateDlg(); - void undeleteChar(); - + SymbolsStyleDialog(): SharedParametersDialog() {}; + void updateDlg(); protected : - BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam); - void setKeywords2List(int) {}; - int getGroupIndexFromCombo(int ctrlID, bool & isFontSize) const; - int getStylerIndexFromCP(HWND hWnd, bool & isFG, ColourPicker **ppCP) const; - int getGroupeIndexFromCheck(int ctrlID, int & fontStyleMask) const; - + BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam); + void setKeywords2List(int id); private : - // 2 static const TCHAR * to have the compatibility with the old xml - static const TCHAR *_delimTag1; - static const TCHAR *_delimTag2; - TCHAR _lastEscapeChar; - - void symbolAction(bool action); - void listboxsRemoveAll(); - void listboxsInit(); - void listboxsReInit() { - listboxsRemoveAll(); - listboxsInit(); - }; + void convertTo(TCHAR *dest, const TCHAR *toConvert, TCHAR *prefix) const; + void retrieve(TCHAR *dest, const TCHAR *toRetrieve, TCHAR *prefix) const; }; - -class UserDefineDialog : public SharedParametersDialog +class UserDefineDialog : public SharedParametersDialog { friend class ScintillaEditView; public : - UserDefineDialog(); - ~UserDefineDialog(); - - void init(HINSTANCE hInst, HWND hPere, ScintillaEditView *pSev) { - if (!_pScintilla) - { - Window::init(hInst, hPere); - _pScintilla = pSev; - } - }; - - void setScintilla(ScintillaEditView *pScinView) { - _pScintilla = pScinView; - }; - - virtual void create(int dialogID, bool isRTL = false) { - StaticDialog::create(dialogID, isRTL); - } - - void destroy() { - // A Ajouter les fils... - }; - int getWidth() const { - return _dlgPos.right; - }; - - int getHeight() const { - return _dlgPos.bottom; - }; - void doDialog(bool willBeShown = true, bool isRTL = false) { - if (!isCreated()) - create(IDD_GLOBAL_USERDEFINE_DLG, isRTL); - display(willBeShown); - }; - - virtual void reSizeTo(RECT & rc) // should NEVER be const !!! - { - Window::reSizeTo(rc); - display(false); - display(); - }; - + UserDefineDialog(); + ~UserDefineDialog(); + void init(HINSTANCE hInst, HWND hPere, ScintillaEditView *pSev) { + if (!_pScintilla) + { + Window::init(hInst, hPere); + _pScintilla = pSev; + } + }; + void setScintilla(ScintillaEditView *pScinView) { + _pScintilla = pScinView; + }; + virtual void create(int dialogID, bool isRTL = false) { + StaticDialog::create(dialogID, isRTL); + } + void destroy() { + // A Ajouter les fils... + }; + int getWidth() const { + return _dlgPos.right; + }; + int getHeight() const { + return _dlgPos.bottom; + }; + void doDialog(bool willBeShown = true, bool isRTL = false) { + if (!isCreated()) + create(IDD_GLOBAL_USERDEFINE_DLG, isRTL); + display(willBeShown); + }; + virtual void reSizeTo(RECT & rc) // should NEVER be const !!! + { + Window::reSizeTo(rc); + display(false); + display(); + }; void reloadLangCombo(); - void changeStyle(); + void changeStyle(); bool isDocked() const {return _status == DOCK;}; - void setDockStatus(bool isDocked) {_status = isDocked;}; - - int getNbKeywordList() {return nbKeywodList;}; - bool isDirty() const {return _isDirty;}; - HWND getFolderHandle() const { - return _folderStyleDlg.getHSelf(); - }; - - HWND getKeywordsHandle() const { - return _keyWordsStyleDlg.getHSelf(); - }; - - HWND getCommentHandle() const { - return _commentStyleDlg.getHSelf(); - }; - - HWND getSymbolHandle() const { - return _symbolsStyleDlg.getHSelf(); - }; - - void setTabName(int index, const TCHAR *name2set) { - _ctrlTab.renameTab(index, name2set); - }; + void setDockStatus(bool isDocked) {_status = isDocked;}; + bool isDirty() const {return _isDirty;}; + HWND getFolderHandle() const { + return _folderStyleDlg.getHSelf(); + }; + HWND getKeywordsHandle() const { + return _keyWordsStyleDlg.getHSelf(); + }; + HWND getCommentHandle() const { + return _commentStyleDlg.getHSelf(); + }; + HWND getSymbolHandle() const { + return _symbolsStyleDlg.getHSelf(); + }; + void setTabName(int index, const TCHAR *name2set) { + _ctrlTab.renameTab(index, name2set); + }; protected : - virtual BOOL CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); - + virtual BOOL CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); private : - ControlsTab _ctrlTab; - WindowVector _wVector; - UserLangContainer *_pCurrentUserLang; - - FolderStyleDialog _folderStyleDlg; - KeyWordsStyleDialog _keyWordsStyleDlg; - CommentStyleDialog _commentStyleDlg; - SymbolsStyleDialog _symbolsStyleDlg; - - bool _status; + ControlsTab _ctrlTab; + WindowVector _wVector; + UserLangContainer *_pCurrentUserLang; + FolderStyleDialog _folderStyleDlg; + KeyWordsStyleDialog _keyWordsStyleDlg; + CommentStyleDialog _commentStyleDlg; + SymbolsStyleDialog _symbolsStyleDlg; + bool _status; RECT _dlgPos; - int _currentHight; - int _yScrollPos; + int _currentHight; + int _yScrollPos; int _prevHightVal; - - bool _isDirty; - void getActualPosSize() { + bool _isDirty; + void getActualPosSize() { ::GetWindowRect(_hSelf, &_dlgPos); _dlgPos.right -= _dlgPos.left; _dlgPos.bottom -= _dlgPos.top; }; void restorePosSize(){reSizeTo(_dlgPos);}; - void enableLangAndControlsBy(int index); - + void enableLangAndControlsBy(int index); protected : - void setKeywords2List(int){}; - int getGroupIndexFromCombo(int, bool &) const {return -1;}; - int getStylerIndexFromCP(HWND, bool &, ColourPicker **) const {return -1;}; - int getGroupeIndexFromCheck(int, int &) const {return -1;}; - void updateDlg(); + void setKeywords2List(int){}; + void updateDlg(); }; - class StringDlg : public StaticDialog { public : StringDlg() : StaticDialog() {}; void init(HINSTANCE hInst, HWND parent, TCHAR *title, TCHAR *staticName, TCHAR *text2Set, int txtLen = 0) { Window::init(hInst, parent); - _title = title; - _static = staticName; - _textValue = text2Set; - _txtLen = txtLen; + _title = title; + _static = staticName; + _textValue = text2Set; + _txtLen = txtLen; }; - long doDialog() { - return long(::DialogBoxParam(_hInst, MAKEINTRESOURCE(IDD_STRING_DLG), _hParent, (DLGPROC)dlgProc, (LPARAM)this)); + return long(::DialogBoxParam(_hInst, MAKEINTRESOURCE(IDD_STRING_DLG), _hParent, (DLGPROC)dlgProc, (LPARAM)this)); }; - - virtual void destroy() {}; - + virtual void destroy() {}; protected : - BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM); - + BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM); private : - generic_string _title; + generic_string _title; generic_string _textValue; - generic_string _static; - int _txtLen; + generic_string _static; + int _txtLen; +}; +class StylerDlg +{ +public: + StylerDlg( HINSTANCE hInst, HWND parent, int stylerIndex = 0, int enabledNesters = -1): + hInst(hInst), parent(parent), stylerIndex(stylerIndex), enabledNesters(enabledNesters) + { + pFgColour = new ColourPicker; + pBgColour = new ColourPicker; + initialStyle = SharedParametersDialog::_pUserLang->_styleArray.getStyler(stylerIndex); + }; + ~StylerDlg() + { + pFgColour->destroy(); + pBgColour->destroy(); + delete pFgColour; + delete pBgColour; + } + long doDialog() { + return long (::DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_STYLER_POPUP_DLG), parent, (DLGPROC)dlgProc, (LPARAM)this)); + }; + static BOOL CALLBACK dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); +public: + HINSTANCE hInst; + HWND parent; + int stylerIndex; + int enabledNesters; + ColourPicker * pFgColour; + ColourPicker * pBgColour; + Style initialStyle; }; - - #endif //USER_DEFINE_H diff --git a/PowerEditor/src/ScitillaComponent/UserDefineDialog.rc b/PowerEditor/src/ScitillaComponent/UserDefineDialog.rc index 5041ec5f..8abe122f 100644 --- a/PowerEditor/src/ScitillaComponent/UserDefineDialog.rc +++ b/PowerEditor/src/ScitillaComponent/UserDefineDialog.rc @@ -31,249 +31,215 @@ #include #include "UserDefineResource.h" -IDD_FOLDER_STYLE_DLG DIALOGEX 36, 44, 320, 460 + +IDD_FOLDER_STYLE_DLG DIALOGEX 36, 44, 337, 400 STYLE DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | WS_CHILD -FONT 8, TEXT("MS Shell Dlg"), 0, 0, 0x0 +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - GROUPBOX "Folder Open Keywords Settings", IDC_FOLDEROPEN_DESCGROUP_STATIC,5,114,300,127,BS_CENTER - LTEXT "Foreground color",IDC_FOLDEROPEN_FG_STATIC,27,144,58,8, 0,WS_EX_RIGHT - LTEXT "Background color",IDC_FOLDEROPEN_BG_STATIC,27,168,58,8, 0,WS_EX_RIGHT - COMBOBOX IDC_FOLDEROPEN_FONT_COMBO,185,140,104,78, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_FOLDEROPEN_FONTSIZE_COMBO,249,162,40,82, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "Bold",IDC_FOLDEROPEN_BOLD_CHECK,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,141,166,46,10 - CONTROL "Italic",IDC_FOLDEROPEN_ITALIC_CHECK,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,141,179,47,10 - GROUPBOX "Font style",IDC_FOLDEROPEN_FONTSTYLEGROUP_STATIC,133, 125,164,71 - GROUPBOX "Colour style",IDC_FOLDEROPEN_COLORSTYLEGROUP_STATIC,15, 125,111,71 - LTEXT "Font Name :",IDC_FOLDEROPEN_FONTNAME_STATIC,138,142,44, 8,0,WS_EX_RIGHT - LTEXT "Font size :",IDC_FOLDEROPEN_FONTSIZE_STATIC,212,164,35, 8,0,WS_EX_RIGHT - EDITTEXT IDC_FOLDEROPEN_EDIT,15,203,282,28,ES_MULTILINE | WS_VSCROLL - GROUPBOX "Folder Close Keywords Settings", IDC_FOLDERCLOSE_DESCGROUP_STATIC,5,246,300,125,BS_CENTER - LTEXT "Foreground color",IDC_FOLDERCLOSE_FG_STATIC,27,277,58,8,0,WS_EX_RIGHT - LTEXT "Background color",IDC_FOLDERCLOSE_BG_STATIC,27,301,58,8,0,WS_EX_RIGHT - COMBOBOX IDC_FOLDERCLOSE_FONT_COMBO,185,272,104,78,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_FOLDERCLOSE_FONTSIZE_COMBO,249,292,40,82, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "Bold",IDC_FOLDERCLOSE_BOLD_CHECK,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,141,298,45,10 - CONTROL "Italic",IDC_FOLDERCLOSE_ITALIC_CHECK,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,141,312,46,10 - GROUPBOX "Font style",IDC_FOLDERCLOSE_FONTSTYLEGROUP_STATIC,133,257,164,69 - GROUPBOX "Colour style",IDC_FOLDERCLOSE_COLORSTYLEGROUP_STATIC,15,257,111,69 - LTEXT "Font Name :",IDC_FOLDERCLOSE_FONTNAME_STATIC,138,273,45,8,0,WS_EX_RIGHT - LTEXT "Font size :",IDC_FOLDERCLOSE_FONTSIZE_STATIC,212,294,35, 8,0,WS_EX_RIGHT - EDITTEXT IDC_FOLDERCLOSE_EDIT,15,334,282,28,ES_MULTILINE | WS_VSCROLL - GROUPBOX "Default Style Settings",IDC_DEFAULT_DESCGROUP_STATIC,5,7, 300,92,BS_CENTER - LTEXT "Foreground color",IDC_DEFAULT_FG_STATIC,27,38,59,8,0, WS_EX_RIGHT - LTEXT "Background color",IDC_DEFAULT_BG_STATIC,27,62,59,8,0, WS_EX_RIGHT - COMBOBOX IDC_DEFAULT_FONT_COMBO,185,33,104,78,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_DEFAULT_FONTSIZE_COMBO,249,55,40,82,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "Bold",IDC_DEFAULT_BOLD_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,141,59,45,10 - CONTROL "Italic",IDC_DEFAULT_ITALIC_CHECK,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,141,73,46,10 - GROUPBOX "Font style",IDC_DEFAULT_FONTSTYLEGROUP_STATIC,133,17, 164,73 - GROUPBOX "Colour style",IDC_DEFAULT_COLORSTYLEGROUP_STATIC,15,17, 111,73 - LTEXT "Font Name :",IDC_DEFAULT_FONTNAME_STATIC,137,34,47,8,0, WS_EX_RIGHT - LTEXT "Font size :",IDC_DEFAULT_FONTSIZE_STATIC,212,57,36,8,0, WS_EX_RIGHT - CONTROL "Underline",IDC_DEFAULT_UNDERLINE_CHECK,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,214,73,59,10 - CONTROL "Underline",IDC_FOLDEROPEN_UNDERLINE_CHECK,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,213,179,59,10 - CONTROL "Underline",IDC_FOLDERCLOSE_UNDERLINE_CHECK,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,212,312,59,10 + LTEXT "http://udl20.weebly.com/",IDC_WEB_HELP_LINK,44,45,114,13 + LTEXT "Temporary doc site:",IDC_WEB_HELP_STATIC,44,31,114,13 + GROUPBOX "Documentation:",IDC_WEB_HELP_DESCGROUP_STATIC,12,14,152,49 + PUSHBUTTON "Styler",IDC_DEFAULT_STYLER,62,94,54,13 + GROUPBOX "Default style:",IDC_DEFAULT_DESCGROUP_STATIC,12,71,152,49 + CONTROL "Fold &compact (fold empty lines too)",IDC_FOLDER_FOLD_COMPACT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,143,152,11 + EDITTEXT IDC_FOLDER_IN_COMMENT_OPEN_EDIT,186,62,131,22,ES_MULTILINE | WS_VSCROLL + EDITTEXT IDC_FOLDER_IN_COMMENT_MIDDLE_EDIT,186,99,131,22,ES_MULTILINE | WS_VSCROLL + EDITTEXT IDC_FOLDER_IN_COMMENT_CLOSE_EDIT,186,137,131,22,ES_MULTILINE | WS_VSCROLL + PUSHBUTTON "Styler",IDC_FOLDER_IN_COMMENT_STYLER,186,30,54,13 + LTEXT "Open:",IDC_FOLDER_IN_COMMENT_OPEN_STATIC,186,53,113,8 + LTEXT "Middle:",IDC_FOLDER_IN_COMMENT_MIDDLE_STATIC,186,89,113,9 + LTEXT "Close:",IDC_FOLDER_IN_COMMENT_CLOSE_STATIC,186,126,113,9 + GROUPBOX "Folding in comment style:",IDC_FOLDER_IN_COMMENT_DESCGROUP_STATIC,175,14,152,156,BS_CENTER + EDITTEXT IDC_FOLDER_IN_CODE1_OPEN_EDIT,22,236,131,22,ES_MULTILINE | WS_VSCROLL + EDITTEXT IDC_FOLDER_IN_CODE1_MIDDLE_EDIT,22,273,131,22,ES_MULTILINE | WS_VSCROLL + EDITTEXT IDC_FOLDER_IN_CODE1_CLOSE_EDIT,22,311,131,22,ES_MULTILINE | WS_VSCROLL + PUSHBUTTON "Styler",IDC_FOLDER_IN_CODE1_STYLER,22,203,54,13 + LTEXT "Open:",IDC_FOLDER_IN_CODE1_OPEN_STATIC,23,224,113,9 + LTEXT "Middle:",IDC_FOLDER_IN_CODE1_MIDDLE_STATIC,23,262,113,9 + LTEXT "Close:",IDC_FOLDER_IN_CODE1_CLOSE_STATIC,23,299,113,9 + GROUPBOX "Folding in code 1 style:",IDC_FOLDER_IN_CODE1_DESCGROUP_STATIC,12,186,152,156,BS_CENTER + EDITTEXT IDC_FOLDER_IN_CODE2_OPEN_EDIT,187,236,131,22,ES_MULTILINE | WS_VSCROLL + EDITTEXT IDC_FOLDER_IN_CODE2_MIDDLE_EDIT,187,273,131,22,ES_MULTILINE | WS_VSCROLL + EDITTEXT IDC_FOLDER_IN_CODE2_CLOSE_EDIT,187,311,131,22,ES_MULTILINE | WS_VSCROLL + PUSHBUTTON "Styler",IDC_FOLDER_IN_CODE2_STYLER,187,202,54,13 + LTEXT "Open:",IDC_FOLDER_IN_CODE2_OPEN_STATIC,187,224,113,9 + LTEXT "Middle:",IDC_FOLDER_IN_CODE2_MIDDLE_STATIC,187,261,113,9 + LTEXT "Close:",IDC_FOLDER_IN_CODE2_CLOSE_STATIC,187,298,113,9 + GROUPBOX "Folding in code 2 style (separators needed):",IDC_FOLDER_IN_CODE2_DESCGROUP_STATIC,176,186,152,156,BS_CENTER END -IDD_KEYWORD_STYLE_DLG DIALOGEX 36, 44, 320, 460 +IDD_SYMBOL_STYLE_DLG DIALOGEX 36, 44, 337, 550 STYLE DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | WS_CHILD -FONT 8, TEXT("MS Shell Dlg"), 0, 0, 0x0 +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT "Foreground color",IDC_KEYWORD1_FG_STATIC,26,25,56,8,0, WS_EX_RIGHT - LTEXT "Background color",IDC_KEYWORD1_BG_STATIC,26,45,56,8,0,WS_EX_RIGHT - COMBOBOX IDC_KEYWORD1_FONT_COMBO,184,26,104,78,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_KEYWORD1_FONTSIZE_COMBO,248,42,40,82,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "Bold",IDC_KEYWORD1_BOLD_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,140,44,45,10 - CONTROL "Italic",IDC_KEYWORD1_ITALIC_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,140,59,41,10 - GROUPBOX "Font style",IDC_KEYWORD1_FONTSTYLEGROUP_STATIC,132,13,164,61 - GROUPBOX "Colour style",IDC_KEYWORD1_COLORSTYLEGROUP_STATIC,14,13,111,49 - LTEXT "Font Name :",IDC_KEYWORD1_FONTNAME_STATIC,136,27,44,8,0,WS_EX_RIGHT - LTEXT "Font size :",IDC_KEYWORD1_FONTSIZE_STATIC,212,44,34,8,0,WS_EX_RIGHT - EDITTEXT IDC_KEYWORD1_EDIT,14,78,282,28,ES_MULTILINE | WS_VSCROLL - GROUPBOX "1st Group",IDC_KEYWORD1_DESCGROUP_STATIC,4,3,300,109,BS_CENTER | BS_FLAT - LTEXT "Foreground color",IDC_KEYWORD2_FG_STATIC,26,136,56,8,0,WS_EX_RIGHT - LTEXT "Background color",IDC_KEYWORD2_BG_STATIC,26,157,56,8,0,WS_EX_RIGHT - COMBOBOX IDC_KEYWORD2_FONT_COMBO,184,138,104,78,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_KEYWORD2_FONTSIZE_COMBO,248,154,40,82,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "Bold",IDC_KEYWORD2_BOLD_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,140,156,46,10 - CONTROL "Italic",IDC_KEYWORD2_ITALIC_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,140,172,43,10 - GROUPBOX "Font style",IDC_KEYWORD2_FONTSTYLEGROUP_STATIC,132,125,164,62 - GROUPBOX "Colour style",IDC_KEYWORD2_COLORSTYLEGROUP_STATIC,14,125,111,49 - LTEXT "Font Name :",IDC_KEYWORD2_FONTNAME_STATIC,136,139,44,8,0,WS_EX_RIGHT - LTEXT "Font size :",IDC_KEYWORD2_FONTSIZE_STATIC,212,156,34,8,0,WS_EX_RIGHT - EDITTEXT IDC_KEYWORD2_EDIT,14,192,282,28,ES_MULTILINE | WS_VSCROLL - GROUPBOX "2nd Group",IDC_KEYWORD2_DESCGROUP_STATIC,4,115,300,110,BS_CENTER | BS_FLAT - LTEXT "Foreground color",IDC_KEYWORD3_FG_STATIC,26,248,56,8,0,WS_EX_RIGHT - LTEXT "Background color",IDC_KEYWORD3_BG_STATIC,26,269,56,8,0,WS_EX_RIGHT - COMBOBOX IDC_KEYWORD3_FONT_COMBO,184,250,104,78,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_KEYWORD3_FONTSIZE_COMBO,248,266,40,82,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "Bold",IDC_KEYWORD3_BOLD_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,140,268,45,10 - CONTROL "Italic",IDC_KEYWORD3_ITALIC_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,140,283,44,10 - GROUPBOX "Font style",IDC_KEYWORD3_FONTSTYLEGROUP_STATIC,132,237,164,61 - GROUPBOX "Colour style",IDC_KEYWORD3_COLORSTYLEGROUP_STATIC,14,237,111,49 - LTEXT "Font Name :",IDC_KEYWORD3_FONTNAME_STATIC,136,251,44,8,0,WS_EX_RIGHT - LTEXT "Font size :",IDC_KEYWORD3_FONTSIZE_STATIC,212,268,34,8,0,WS_EX_RIGHT - EDITTEXT IDC_KEYWORD3_EDIT,14,303,282,28,ES_MULTILINE | WS_VSCROLL - GROUPBOX "3rd Group",IDC_KEYWORD3_DESCGROUP_STATIC,4,227,300,110,BS_CENTER | BS_FLAT - LTEXT "Foreground color",IDC_KEYWORD4_FG_STATIC,26,362,57,8,0,WS_EX_RIGHT - LTEXT "Background color",IDC_KEYWORD4_BG_STATIC,26,383,57,8,0,WS_EX_RIGHT - COMBOBOX IDC_KEYWORD4_FONT_COMBO,184,363,104,78,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_KEYWORD4_FONTSIZE_COMBO,248,379,40,82,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "Bold",IDC_KEYWORD4_BOLD_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,140,381,44,10 - CONTROL "Italic",IDC_KEYWORD4_ITALIC_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,140,396,44,10 - GROUPBOX "Font style",IDC_KEYWORD4_FONTSTYLEGROUP_STATIC,132,350,164,60 - GROUPBOX "Colour style",IDC_KEYWORD4_COLORSTYLEGROUP_STATIC,14, 350,111,50 - LTEXT "Font Name :",IDC_KEYWORD4_FONTNAME_STATIC,136,364,44,8, 0,WS_EX_RIGHT - LTEXT "Font size :",IDC_KEYWORD4_FONTSIZE_STATIC,212,381,34,8, 0,WS_EX_RIGHT - EDITTEXT IDC_KEYWORD4_EDIT,14,416,282,28,ES_MULTILINE | WS_VSCROLL - GROUPBOX "4th Group",IDC_KEYWORD4_DESCGROUP_STATIC,4,340,300,111, BS_CENTER | BS_FLAT - CONTROL "Prefix mode",IDC_KEYWORD1_PREFIX_CHECK,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,14,67,64,10 - CONTROL "Prefix mode",IDC_KEYWORD2_PREFIX_CHECK,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,14,180,64,10 - CONTROL "Prefix mode",IDC_KEYWORD3_PREFIX_CHECK,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,14,291,64,10 - CONTROL "Prefix mode",IDC_KEYWORD4_PREFIX_CHECK,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,14,404,64,10 - CONTROL "Underline",IDC_KEYWORD4_UNDERLINE_CHECK,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,211,396,58,10 - CONTROL "Underline",IDC_KEYWORD3_UNDERLINE_CHECK,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,211,283,61,10 - CONTROL "Underline",IDC_KEYWORD1_UNDERLINE_CHECK,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,211,59,59,10 - CONTROL "Underline",IDC_KEYWORD2_UNDERLINE_CHECK,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,211,172,59,10 + EDITTEXT IDC_OPERATOR1_EDIT,15,47,144,29,ES_MULTILINE | WS_VSCROLL + EDITTEXT IDC_OPERATOR2_EDIT,178,47,144,29,ES_MULTILINE | WS_VSCROLL + PUSHBUTTON "Styler",IDC_OPERATOR_STYLER,14,28,54,13 + GROUPBOX "Operators style",IDC_OPERATOR_DESCGROUP_STATIC,8,14,319,67,BS_CENTER + LTEXT "Operators1",IDC_OPERATOR1_STATIC,82,36,75,10,0,WS_EX_RIGHT + LTEXT "Operators2 (separators required)",IDC_OPERATOR2_STATIC,194,36,124,10,0,WS_EX_RIGHT + EDITTEXT IDC_DELIMITER1_BOUNDARYOPEN_EDIT,15,125,144,12,ES_MULTILINE | WS_VSCROLL + EDITTEXT IDC_DELIMITER1_ESCAPE_EDIT,15,151,144,12,ES_MULTILINE | WS_VSCROLL + EDITTEXT IDC_DELIMITER1_BOUNDARYCLOSE_EDIT,15,175,144,12,ES_MULTILINE | WS_VSCROLL + PUSHBUTTON "Styler",IDC_DELIMITER1_STYLER,15,100,54,13 + LTEXT "Open: ",IDC_DELIMITER1_BOUNDARYOPEN_STATIC,15,115,144,8 + LTEXT "Escape: ",IDC_DELIMITER1_ESCAPE_STATIC,15,140,144,8 + LTEXT "Close: ",IDC_DELIMITER1_BOUNDARYCLOSE_STATIC,15,164,144,8 + GROUPBOX "Delimiter1 style",IDC_DELIMITER1_DESCGROUP_STATIC,8,89,156,105,BS_RIGHT + EDITTEXT IDC_DELIMITER2_BOUNDARYOPEN_EDIT,178,125,144,12,ES_MULTILINE | WS_VSCROLL + EDITTEXT IDC_DELIMITER2_ESCAPE_EDIT,178,151,144,12,ES_MULTILINE | WS_VSCROLL + EDITTEXT IDC_DELIMITER2_BOUNDARYCLOSE_EDIT,178,175,144,12,ES_MULTILINE | WS_VSCROLL + PUSHBUTTON "Styler",IDC_DELIMITER2_STYLER,178,100,54,13 + LTEXT "Open: ",IDC_DELIMITER2_BOUNDARYOPEN_STATIC,178,115,144,8 + LTEXT "Escape: ",IDC_DELIMITER2_ESCAPE_STATIC,178,140,144,8 + LTEXT "Close: ",IDC_DELIMITER2_BOUNDARYCLOSE_STATIC,178,164,144,8 + GROUPBOX "Delimiter2 style",IDC_DELIMITER2_DESCGROUP_STATIC,172,89,156,105,BS_RIGHT + EDITTEXT IDC_DELIMITER3_BOUNDARYOPEN_EDIT,15,241,144,12,ES_MULTILINE | WS_VSCROLL + EDITTEXT IDC_DELIMITER3_ESCAPE_EDIT,15,264,144,12,ES_MULTILINE | WS_VSCROLL + EDITTEXT IDC_DELIMITER3_BOUNDARYCLOSE_EDIT,15,287,144,12,ES_MULTILINE | WS_VSCROLL + PUSHBUTTON "Styler",IDC_DELIMITER3_STYLER,15,215,54,13 + LTEXT "Open: ",IDC_DELIMITER3_BOUNDARYOPEN_STATIC,15,230,144,8 + LTEXT "Escape: ",IDC_DELIMITER3_ESCAPE_STATIC,15,255,144,8 + LTEXT "Close: ",IDC_DELIMITER3_BOUNDARYCLOSE_STATIC,15,276,144,8 + GROUPBOX "Delimiter3 style",IDC_DELIMITER3_DESCGROUP_STATIC,8,204,156,105,BS_RIGHT + EDITTEXT IDC_DELIMITER4_BOUNDARYOPEN_EDIT,178,241,144,12,ES_MULTILINE | WS_VSCROLL + EDITTEXT IDC_DELIMITER4_ESCAPE_EDIT,178,264,144,12,ES_MULTILINE | WS_VSCROLL + EDITTEXT IDC_DELIMITER4_BOUNDARYCLOSE_EDIT,178,287,144,12,ES_MULTILINE | WS_VSCROLL + PUSHBUTTON "Styler",IDC_DELIMITER4_STYLER,178,215,54,13 + LTEXT "Open: ",IDC_DELIMITER4_BOUNDARYOPEN_STATIC,178,232,144,8 + LTEXT "Escape: ",IDC_DELIMITER4_ESCAPE_STATIC,178,255,144,8 + LTEXT "Close: ",IDC_DELIMITER4_BOUNDARYCLOSE_STATIC,178,278,144,8 + GROUPBOX "Delimiter4 style",IDC_DELIMITER4_DESCGROUP_STATIC,172,204,156,105,BS_RIGHT + EDITTEXT IDC_DELIMITER5_BOUNDARYOPEN_EDIT,15,356,144,12,ES_MULTILINE | WS_VSCROLL + EDITTEXT IDC_DELIMITER5_ESCAPE_EDIT,15,381,144,12,ES_MULTILINE | WS_VSCROLL + EDITTEXT IDC_DELIMITER5_BOUNDARYCLOSE_EDIT,15,406,144,12,ES_MULTILINE | WS_VSCROLL + PUSHBUTTON "Styler",IDC_DELIMITER5_STYLER,17,331,54,13 + LTEXT "Open: ",IDC_DELIMITER5_BOUNDARYOPEN_STATIC,15,347,144,8 + LTEXT "Escape: ",IDC_DELIMITER5_ESCAPE_STATIC,15,372,144,8 + LTEXT "Close: ",IDC_DELIMITER5_BOUNDARYCLOSE_STATIC,15,397,144,8 + GROUPBOX "Delimiter5 style",IDC_DELIMITER5_DESCGROUP_STATIC,8,320,156,105,BS_RIGHT + EDITTEXT IDC_DELIMITER6_BOUNDARYOPEN_EDIT,178,356,144,12,ES_MULTILINE | WS_VSCROLL + EDITTEXT IDC_DELIMITER6_ESCAPE_EDIT,178,381,144,12,ES_MULTILINE | WS_VSCROLL + EDITTEXT IDC_DELIMITER6_BOUNDARYCLOSE_EDIT,178,406,144,12,ES_MULTILINE | WS_VSCROLL + PUSHBUTTON "Styler",IDC_DELIMITER6_STYLER,178,331,54,13 + LTEXT "Open: ",IDC_DELIMITER6_BOUNDARYOPEN_STATIC,178,347,144,8 + LTEXT "Escape: ",IDC_DELIMITER6_ESCAPE_STATIC,178,372,144,8 + LTEXT "Close: ",IDC_DELIMITER6_BOUNDARYCLOSE_STATIC,178,397,144,8 + GROUPBOX "Delimiter6 style",IDC_DELIMITER6_DESCGROUP_STATIC,172,320,156,105,BS_RIGHT + EDITTEXT IDC_DELIMITER7_BOUNDARYOPEN_EDIT,12,471,144,12,ES_MULTILINE | WS_VSCROLL + EDITTEXT IDC_DELIMITER7_ESCAPE_EDIT,11,496,144,12,ES_MULTILINE | WS_VSCROLL + EDITTEXT IDC_DELIMITER7_BOUNDARYCLOSE_EDIT,12,521,144,12,ES_MULTILINE | WS_VSCROLL + PUSHBUTTON "Styler",IDC_DELIMITER7_STYLER,15,446,54,13 + LTEXT "Open: ",IDC_DELIMITER7_BOUNDARYOPEN_STATIC,178,460,144,8 + LTEXT "Escape: ",IDC_DELIMITER7_ESCAPE_STATIC,178,487,144,8 + LTEXT "Close: ",IDC_DELIMITER7_BOUNDARYCLOSE_STATIC,178,512,144,8 + GROUPBOX "Delimiter7 style",IDC_DELIMITER7_DESCGROUP_STATIC,8,435,156,105,BS_RIGHT + EDITTEXT IDC_DELIMITER8_BOUNDARYOPEN_EDIT,178,471,144,12,ES_MULTILINE | WS_VSCROLL + EDITTEXT IDC_DELIMITER8_ESCAPE_EDIT,178,496,144,12,ES_MULTILINE | WS_VSCROLL + EDITTEXT IDC_DELIMITER8_BOUNDARYCLOSE_EDIT,178,521,144,12,ES_MULTILINE | WS_VSCROLL + PUSHBUTTON "Styler",IDC_DELIMITER8_STYLER,178,446,54,13 + LTEXT "Open: ",IDC_DELIMITER8_BOUNDARYOPEN_STATIC,15,460,144,8 + LTEXT "Escape: ",IDC_DELIMITER8_ESCAPE_STATIC,15,487,144,8 + LTEXT "Close: ",IDC_DELIMITER8_BOUNDARYCLOSE_STATIC,15,512,144,8 + GROUPBOX "Delimiter8 style",IDC_DELIMITER8_DESCGROUP_STATIC,172,435,156,105,BS_RIGHT END -IDD_COMMENT_STYLE_DLG DIALOGEX 36, 44, 320, 460 +IDD_KEYWORD_STYLE_DLG DIALOGEX 36, 44, 337, 470 STYLE DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | WS_CHILD -FONT 8, TEXT("MS Shell Dlg"), 0, 0, 0x0 +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT "Foreground color ",IDC_COMMENTLINE_FG_STATIC,24,31,58,8,0,WS_EX_RIGHT - LTEXT "Background color",IDC_COMMENTLINE_BG_STATIC,24,52,58,8,0,WS_EX_RIGHT - COMBOBOX IDC_COMMENTLINE_FONT_COMBO,184,32,104,78,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_COMMENTLINE_FONTSIZE_COMBO,248,48,40,82,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "Bold",IDC_COMMENTLINE_BOLD_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,140,50,43,10 - CONTROL "Italic",IDC_COMMENTLINE_ITALIC_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,140,65,43,10 - GROUPBOX "Font style",IDC_COMMENTLINE_FONTSTYLEGROUP_STATIC,132,19,164,63 - GROUPBOX "Colour style",IDC_COMMENTLINE_COLORSTYLEGROUP_STATIC,14,19,111,50 - LTEXT "Font Name :",IDC_COMMENTLINE_FONTNAME_STATIC,140,33,40,8,0,WS_EX_RIGHT - LTEXT "Font size :",IDC_COMMENTLINE_FONTSIZE_STATIC,212,50,34,8,0,WS_EX_RIGHT - EDITTEXT IDC_COMMENTLINE_EDIT,14,90,282,28,ES_MULTILINE | WS_VSCROLL - GROUPBOX "Comment Line",IDC_COMMENTLINE_DESCGROUP_STATIC,4,7,300,119,BS_CENTER - LTEXT "Foreground color",IDC_NUMBER_FG_STATIC,24,302,58,8,0,WS_EX_RIGHT - LTEXT "Background color",IDC_NUMBER_BG_STATIC,24,325,58,8,0,WS_EX_RIGHT - COMBOBOX IDC_NUMBER_FONT_COMBO,183,300,104,78,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_NUMBER_FONTSIZE_COMBO,247,316,40,82,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "Bold",IDC_NUMBER_BOLD_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,139,317,44,10 - CONTROL "Italic",IDC_NUMBER_ITALIC_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,139,333,44,10 - GROUPBOX "Font style",IDC_NUMBER_FONTSTYLEGROUP_STATIC,131,288,164,60 - GROUPBOX "Colour style",IDC_NUMBER_COLORSTYLEGROUP_STATIC,13,288,111,60 - LTEXT "Font Name :",IDC_NUMBER_FONTNAME_STATIC,139,301,40,8,0,WS_EX_RIGHT - LTEXT "Font size :",IDC_NUMBER_FONTSIZE_STATIC,211,317,34,8,0,WS_EX_RIGHT - GROUPBOX "Number",IDC_NUMBER_DESCGROUP_STATIC,3,274,300,85,BS_CENTER - LTEXT "Foreground color",IDC_COMMENT_FG_STATIC,24,158,57,8,0,WS_EX_RIGHT - LTEXT "Background color",IDC_COMMENT_BG_STATIC,24,179,57,8,0,WS_EX_RIGHT - COMBOBOX IDC_COMMENT_FONT_COMBO,184,159,104,78,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_COMMENT_FONTSIZE_COMBO,248,175,40,82,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "Bold",IDC_COMMENT_BOLD_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,140,177,44,10 - CONTROL "Italic",IDC_COMMENT_ITALIC_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,140,193,43,10 - GROUPBOX "Font style",IDC_COMMENT_FONTSTYLEGROUP_STATIC,132,146,164,64 - GROUPBOX "Colour style",IDC_COMMENT_COLORSTYLEGROUP_STATIC,14,146,111,50 - LTEXT "Font Name :",IDC_COMMENT_FONTNAME_STATIC,140,160,40,8,0,WS_EX_RIGHT - LTEXT "Font size :",IDC_COMMENT_FONTSIZE_STATIC,212,177,34,8,0,WS_EX_RIGHT - EDITTEXT IDC_COMMENTOPEN_EDIT,14,229,133,28,ES_MULTILINE | WS_VSCROLL - GROUPBOX "Comment Block",IDC_COMMENT_DESCGROUP_STATIC,4,133,300,132,BS_CENTER - EDITTEXT IDC_COMMENTCLOSE_EDIT,157,229,139,28,ES_MULTILINE | WS_VSCROLL - LTEXT "Comment open :",IDC_COMMENTOPEN_STATIC,17,218,90,8 - LTEXT "Comment close :",IDC_COMMENTCLOSE_STATIC,158,218,88,8 - CONTROL "Treat keyword as symbol",IDC_COMMENTLINESYMBOL_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,78,112,10 - CONTROL "Treat keywords as symbols",IDC_COMMENTSYMBOL_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,203,112,10 - CONTROL "Underline",IDC_COMMENT_UNDERLINE_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,211,193,59,10 - CONTROL "Underline",IDC_COMMENTLINE_UNDERLINE_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,212,65,59,10 - CONTROL "Underline",IDC_NUMBER_UNDERLINE_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,211,332,59,10 + EDITTEXT IDC_KEYWORD1_EDIT,19,46,138,69,ES_MULTILINE | WS_VSCROLL | ES_WANTRETURN + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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_SYMBOL_STYLE_DLG DIALOGEX 36, 44, 320, 460 +IDD_COMMENT_STYLE_DLG DIALOGEX 36, 44, 337, 400 STYLE DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | WS_CHILD -FONT 8, TEXT("MS Shell Dlg"), 0, 0, 0x0 +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LISTBOX IDC_AVAILABLE_SYMBOLS_LIST,68,33,41,116,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "->",IDC_ADD_BUTTON,127,65,50,14 - PUSHBUTTON "<-",IDC_REMOVE_BUTTON,127,94,50,14 - LISTBOX IDC_ACTIVATED_SYMBOL_LIST,195,33,41,115,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP - LTEXT "Activated operators",IDC_ACTIVATED_SYMBOL_STATIC,182,18,86,8 - LTEXT "Available symbols",IDC_AVAILABLE_SYMBOLS_STATIC,59,18,90,8 - LTEXT "Foreground color",IDC_SYMBOL_FG_STATIC,25,169,57,8,0,WS_EX_RIGHT - LTEXT "Background color",IDC_SYMBOL_BG_STATIC,25,192,57,8,0,WS_EX_RIGHT - COMBOBOX IDC_SYMBOL_FONT_COMBO,183,168,104,78,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_SYMBOL_FONTSIZE_COMBO,247,184,40,82,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "Bold",IDC_SYMBOL_BOLD_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,139,185,44,10 - CONTROL "Italic",IDC_SYMBOL_ITALIC_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,139,199,44,10 - GROUPBOX "Font style",IDC_SYMBOL_FONTSTYLEGROUP_STATIC,131,155,164,59 - GROUPBOX "Colour style",IDC_SYMBOL_COLORSTYLEGROUP_STATIC,13,155,111,59 - LTEXT "Font Name :",IDC_SYMBOL_FONTNAME_STATIC,135,169,44,8,0,WS_EX_RIGHT - LTEXT "Font size :",IDC_SYMBOL_FONTSIZE_STATIC,211,185,34,8,0,WS_EX_RIGHT - GROUPBOX "Operator",IDC_SYMBOL_DESCGROUP_STATIC,3,5,300,216,BS_CENTER - CONTROL "Underline",IDC_SYMBOL_UNDERLINE_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,211,199,59,10 - LTEXT "Foreground color",IDC_SYMBOL_FG2_STATIC,26,288,56,8,0,WS_EX_RIGHT - LTEXT "Background color",IDC_SYMBOL_BG2_STATIC,26,309,56,8,0,WS_EX_RIGHT - COMBOBOX IDC_SYMBOL_FONT2_COMBO,184,286,104,78,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_SYMBOL_BO2_COMBO,85,257,40,82,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "Bold",IDC_SYMBOL_BOLD2_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,140,304,45,10 - CONTROL "Italic",IDC_SYMBOL_ITALIC2_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,140,319,41,10 - GROUPBOX "Font style",IDC_SYMBOL_FONTSTYLEGROUP2_STATIC,132,273,164,60 - GROUPBOX "Colour style",IDC_SYMBOL_COLORSTYLEGROUP2_STATIC,14,273,111,60 - LTEXT "Font Name :",IDC_SYMBOL_FONTNAME2_STATIC,136,287,44,8,0,WS_EX_RIGHT - LTEXT "Boundary open :",IDC_SYMBOL_BO2_STATIC,9,259,74,8,0,WS_EX_RIGHT - CONTROL "Underline",IDC_SYMBOL_UNDERLINE2_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,211,319,59,10 - COMBOBOX IDC_SYMBOL_BC2_COMBO,256,257,40,82,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Boundary close :",IDC_SYMBOL_BC2_STATIC,168,259,86,8,0,WS_EX_RIGHT - GROUPBOX "Delimiter 1",IDC_SYMBOL_DELIMGROUP1_STATIC,3,247,300,93,BS_CENTER | BS_FLAT - LTEXT "Foreground colour",IDC_SYMBOL_FG3_STATIC,26,389,56,8,0,WS_EX_RIGHT - LTEXT "Background colour",IDC_SYMBOL_BG3_STATIC,26,410,56,8,0,WS_EX_RIGHT - COMBOBOX IDC_SYMBOL_FONT3_COMBO,184,387,104,78,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_SYMBOL_BO3_COMBO,85,359,40,82,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "Bold",IDC_SYMBOL_BOLD3_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,140,405,45,10 - CONTROL "Italic",IDC_SYMBOL_ITALIC3_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,140,420,41,10 - GROUPBOX "Font Style",IDC_SYMBOL_FONTSTYLEGROUP3_STATIC,132,375,164,60 - GROUPBOX "Colour Style",IDC_SYMBOL_COLORSTYLEGROUP3_STATIC,14,375,111,60 - LTEXT "Font name :",IDC_SYMBOL_FONTNAME3_STATIC,136,388,44,8,0,WS_EX_RIGHT - LTEXT "Boundary open :",IDC_SYMBOL_BO3_STATIC,9,360,74,8,0,WS_EX_RIGHT - CONTROL "Underline",IDC_SYMBOL_UNDERLINE3_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,211,420,59,10 - COMBOBOX IDC_SYMBOL_BC3_COMBO,256,359,40,82,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Boundary close :",IDC_SYMBOL_BC3_STATIC,168,360,86,8,0,WS_EX_RIGHT - GROUPBOX "Delimiter 2",IDC_SYMBOL_DELIMGROUP2_STATIC,3,348,300,93,BS_CENTER | BS_FLAT - COMBOBOX IDC_SYMBOL_FONTSIZE2_COMBO,248,303,40,82,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Font size :",IDC_SYMBOL_FONTSIZE2_STATIC,212,305,34,8,0,WS_EX_RIGHT - COMBOBOX IDC_SYMBOL_FONTSIZE3_COMBO,248,404,40,82,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Font size :",IDC_SYMBOL_FONTSIZE3_STATIC,212,406,34,8,0,WS_EX_RIGHT - CONTROL "Enable escape character :", IDC_HAS_ESCAPE, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,227,110,10 - EDITTEXT IDC_ESCAPE_CHAR,130,227,20,10,WS_TABSTOP + 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 END -IDD_GLOBAL_USERDEFINE_DLG DIALOGEX 36, 44, 340, 550 -STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | - WS_CAPTION | WS_VSCROLL | WS_SYSMENU +IDD_GLOBAL_USERDEFINE_DLG DIALOGEX 36, 44, 365, 670 +STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_VSCROLL | WS_SYSMENU EXSTYLE WS_EX_TOOLWINDOW CAPTION "User Defined Language" -FONT 8, TEXT("MS Shell Dlg"), 0, 0, 0x0 +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN LTEXT "User language : ",IDC_LANGNAME_STATIC,0,3,63,8,0,WS_EX_RIGHT COMBOBOX IDC_LANGNAME_COMBO,64,1,90,58,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP - CONTROL "Transparency",IDC_UD_TRANSPARENT_CHECK,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,165,3,66,10 - CONTROL "",IDC_UD_PERCENTAGE_SLIDER,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | NOT WS_VISIBLE | WS_TABSTOP,225,3,53,10 - PUSHBUTTON "Dock",IDC_DOCK_BUTTON,280,1,50,14,BS_FLAT - - PUSHBUTTON "Create New...",IDC_ADDNEW_BUTTON,34,20,62,14 + CONTROL "Transparency",IDC_UD_TRANSPARENT_CHECK,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,179,3,66,10 + CONTROL "",IDC_UD_PERCENTAGE_SLIDER,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | NOT WS_VISIBLE | WS_TABSTOP,240,3,53,10 + PUSHBUTTON "Dock",IDC_DOCK_BUTTON,298,1,50,14,BS_FLAT + PUSHBUTTON "Create New...",IDC_ADDNEW_BUTTON,34,20,62,14 PUSHBUTTON "Save As...",IDC_SAVEAS_BUTTON,104,20,62,14 - CONTROL "Ignore case",IDC_LANGNAME_IGNORECASE_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,175,24,76,10 - RTEXT "Ext. :",IDC_EXT_STATIC,257,25,33,8,0,WS_EX_RIGHT - EDITTEXT IDC_EXT_EDIT,291,23,33,14,ES_AUTOHSCROLL - - PUSHBUTTON "Import...",IDC_IMPORT_BUTTON,34,40,62,14 + CONTROL "Ignore case",IDC_LANGNAME_IGNORECASE_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,179,24,76,10 + RTEXT "Ext. :",IDC_EXT_STATIC,259,25,33,8,0,WS_EX_RIGHT + EDITTEXT IDC_EXT_EDIT,293,23,33,14,ES_AUTOHSCROLL + PUSHBUTTON "Import...",IDC_IMPORT_BUTTON,34,40,62,14 PUSHBUTTON "Export...",IDC_EXPORT_BUTTON,104,40,62,14 - PUSHBUTTON "Rename",IDC_RENAME_BUTTON,174,40,62,14 - PUSHBUTTON "Remove",IDC_REMOVELANG_BUTTON,243,40,62,14 + PUSHBUTTON "Rename",IDC_RENAME_BUTTON,179,40,62,14 + PUSHBUTTON "Remove",IDC_REMOVELANG_BUTTON,248,40,62,14 END IDD_STRING_DLG DIALOGEX 0, 0, 151, 52 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | - WS_SYSMENU +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_TOOLWINDOW -FONT 8, TEXT("MS Shell Dlg"), 0, 0, 0x1 +FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN LTEXT "STATIC :",IDC_STRING_STATIC,6,4,42,8,0,WS_EX_RIGHT EDITTEXT IDC_STRING_EDIT,49,2,88,14 @@ -281,5 +247,45 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,87,26,50,14 END -#endif //USERDEFINEDIALOG_RC +IDD_STYLER_POPUP_DLG DIALOGEX 100, 50, 324, 305 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Styler Dialog" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + DEFPUSHBUTTON "OK",IDOK,100,280,50,14 + PUSHBUTTON "Cancel",IDCANCEL,172,280,50,14 + CONTROL "Bold",IDC_STYLER_CHECK_BOLD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,201,31,90,13 + CONTROL "Italic",IDC_STYLER_CHECK_ITALIC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,201,45,90,13 + CONTROL "Underline",IDC_STYLER_CHECK_UNDERLINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,201,59,90,13 + COMBOBOX IDC_STYLER_COMBO_FONT_NAME,65,32,104,80,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_STYLER_COMBO_FONT_SIZE,65,53,104,77,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP + RTEXT "Foreground color:",IDC_STYLER_FG_STATIC,14,85,75,11 + RTEXT "Background color:",IDC_STYLER_BG_STATIC,153,86,75,11 + CONTROL "Delimiter 1",IDC_STYLER_CHECK_NESTING_DELIMITER1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,38,132,76,13 + CONTROL "Delimiter 2",IDC_STYLER_CHECK_NESTING_DELIMITER2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,38,149,76,13 + CONTROL "Delimiter 3",IDC_STYLER_CHECK_NESTING_DELIMITER3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,38,166,76,13 + CONTROL "Comment",IDC_STYLER_CHECK_NESTING_COMMENT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,209,132,76,13 + CONTROL "Comment line",IDC_STYLER_CHECK_NESTING_COMMENT_LINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,209,149,76,13 + CONTROL "Keyword 1",IDC_STYLER_CHECK_NESTING_KEYWORD1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,119,132,76,13 + CONTROL "Keyword 2",IDC_STYLER_CHECK_NESTING_KEYWORD2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,119,149,76,13 + CONTROL "Keyword 3",IDC_STYLER_CHECK_NESTING_KEYWORD3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,119,166,76,13 + CONTROL "Keyword 4",IDC_STYLER_CHECK_NESTING_KEYWORD4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,119,183,76,13 + GROUPBOX "Nesting:",IDC_STYLER_STATIC_NESTING_GROUP,14,116,295,157 + GROUPBOX "Font options:",IDC_STYLER_STATIC_FONT_OPTIONS,14,15,295,95 + CONTROL "Delimiter 4",IDC_STYLER_CHECK_NESTING_DELIMITER4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,38,183,76,13 + CONTROL "Delimiter 5",IDC_STYLER_CHECK_NESTING_DELIMITER5,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,38,200,76,13 + CONTROL "Delimiter 6",IDC_STYLER_CHECK_NESTING_DELIMITER6,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,38,217,76,13 + CONTROL "Delimiter 7",IDC_STYLER_CHECK_NESTING_DELIMITER7,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,38,234,76,13 + CONTROL "Delimiter 8",IDC_STYLER_CHECK_NESTING_DELIMITER8,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,38,251,76,13 + CONTROL "Keyword 5",IDC_STYLER_CHECK_NESTING_KEYWORD5,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,119,200,76,13 + CONTROL "Keyword 6",IDC_STYLER_CHECK_NESTING_KEYWORD6,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,119,217,76,13 + CONTROL "Keyword 7",IDC_STYLER_CHECK_NESTING_KEYWORD7,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,119,234,76,13 + CONTROL "Keyword 8",IDC_STYLER_CHECK_NESTING_KEYWORD8,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,119,251,76,13 + RTEXT "Name:",IDC_STYLER_NAME_STATIC,23,32,36,12 + RTEXT "Size:",IDC_STYLER_SIZE_STATIC,22,53,36,12 + CONTROL "Operators 1",IDC_STYLER_CHECK_NESTING_OPERATORS1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,209,166,76,13 + 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/UserDefineLangReference.h b/PowerEditor/src/ScitillaComponent/UserDefineLangReference.h index 4e744e09..1b37cbc7 100644 --- a/PowerEditor/src/ScitillaComponent/UserDefineLangReference.h +++ b/PowerEditor/src/ScitillaComponent/UserDefineLangReference.h @@ -29,16 +29,14 @@ #ifndef USER_DEFINE_LANG_REFERENCE_H #define USER_DEFINE_LANG_REFERENCE_H +#ifndef SCILEXER_H +#include "scilexer.h" +#endif //SCILEXER_H + const int langNameLenMax = 16; const int extsLenMax = 256; - -const int nbKeywodList = 9; -//const int max_char = 4096; const int max_char = 1024*30; -const int nbPrefixListAllowed = 4; - - #endif //USER_DEFINE_LANG_REFERENCE_H diff --git a/PowerEditor/src/ScitillaComponent/UserDefineResource.h b/PowerEditor/src/ScitillaComponent/UserDefineResource.h index 0247bd00..2bb0b82a 100644 --- a/PowerEditor/src/ScitillaComponent/UserDefineResource.h +++ b/PowerEditor/src/ScitillaComponent/UserDefineResource.h @@ -30,251 +30,273 @@ #define USERDEFINE_RC_H #define IDD_GLOBAL_USERDEFINE_DLG 20000 - #define IDC_DOCK_BUTTON (IDD_GLOBAL_USERDEFINE_DLG + 1) - #define IDC_RENAME_BUTTON (IDD_GLOBAL_USERDEFINE_DLG + 2) - #define IDC_ADDNEW_BUTTON (IDD_GLOBAL_USERDEFINE_DLG + 3) - #define IDC_REMOVELANG_BUTTON (IDD_GLOBAL_USERDEFINE_DLG + 4) - #define IDC_SAVEAS_BUTTON (IDD_GLOBAL_USERDEFINE_DLG + 5) - #define IDC_LANGNAME_COMBO (IDD_GLOBAL_USERDEFINE_DLG + 6) - #define IDC_LANGNAME_STATIC (IDD_GLOBAL_USERDEFINE_DLG + 7) - #define IDC_EXT_EDIT (IDD_GLOBAL_USERDEFINE_DLG + 8) - #define IDC_EXT_STATIC (IDD_GLOBAL_USERDEFINE_DLG + 9) + #define IDC_DOCK_BUTTON (IDD_GLOBAL_USERDEFINE_DLG + 1 ) + #define IDC_RENAME_BUTTON (IDD_GLOBAL_USERDEFINE_DLG + 2 ) + #define IDC_ADDNEW_BUTTON (IDD_GLOBAL_USERDEFINE_DLG + 3 ) + #define IDC_REMOVELANG_BUTTON (IDD_GLOBAL_USERDEFINE_DLG + 4 ) + #define IDC_SAVEAS_BUTTON (IDD_GLOBAL_USERDEFINE_DLG + 5 ) + #define IDC_LANGNAME_COMBO (IDD_GLOBAL_USERDEFINE_DLG + 6 ) + #define IDC_LANGNAME_STATIC (IDD_GLOBAL_USERDEFINE_DLG + 7 ) + #define IDC_EXT_EDIT (IDD_GLOBAL_USERDEFINE_DLG + 8 ) + #define IDC_EXT_STATIC (IDD_GLOBAL_USERDEFINE_DLG + 9 ) - #define IDC_UD_PERCENTAGE_SLIDER (IDD_GLOBAL_USERDEFINE_DLG + 10) - #define IDC_UD_TRANSPARENT_CHECK (IDD_GLOBAL_USERDEFINE_DLG + 11) - #define IDC_LANGNAME_IGNORECASE_CHECK (IDD_GLOBAL_USERDEFINE_DLG + 12) - #define IDC_AUTOCOMPLET_EDIT (IDD_GLOBAL_USERDEFINE_DLG + 13) - #define IDC_AUTOCOMPLET_STATIC (IDD_GLOBAL_USERDEFINE_DLG + 14) - #define IDC_IMPORT_BUTTON (IDD_GLOBAL_USERDEFINE_DLG + 15) - #define IDC_EXPORT_BUTTON (IDD_GLOBAL_USERDEFINE_DLG + 16) -#define IDD_FOLDER_STYLE_DLG 21000 + #define IDC_UD_PERCENTAGE_SLIDER (IDD_GLOBAL_USERDEFINE_DLG + 10) + #define IDC_UD_TRANSPARENT_CHECK (IDD_GLOBAL_USERDEFINE_DLG + 11) + #define IDC_LANGNAME_IGNORECASE_CHECK (IDD_GLOBAL_USERDEFINE_DLG + 12) + #define IDC_AUTOCOMPLET_EDIT (IDD_GLOBAL_USERDEFINE_DLG + 13) + #define IDC_AUTOCOMPLET_STATIC (IDD_GLOBAL_USERDEFINE_DLG + 14) + #define IDC_IMPORT_BUTTON (IDD_GLOBAL_USERDEFINE_DLG + 15) + #define IDC_EXPORT_BUTTON (IDD_GLOBAL_USERDEFINE_DLG + 16) + +#define IDD_FOLDER_STYLE_DLG 21000 // IDD_GLOBAL_USERDEFINE_DLG + 1000 + #define IDC_DEFAULT (IDD_FOLDER_STYLE_DLG + 100) + #define IDC_DEFAULT_DESCGROUP_STATIC (IDC_DEFAULT + 1) + #define IDC_DEFAULT_STYLER (IDC_DEFAULT + 2) + #define IDC_WEB_HELP_LINK (IDC_DEFAULT + 3) + #define IDC_WEB_HELP_STATIC (IDC_DEFAULT + 4) + #define IDC_WEB_HELP_DESCGROUP_STATIC (IDC_DEFAULT + 5) + #define IDC_FOLDER_FOLD_COMPACT (IDC_DEFAULT + 6) + + #define IDC_FOLDER_IN_CODE1 (IDD_FOLDER_STYLE_DLG + 200) + #define IDC_FOLDER_IN_CODE1_DESCGROUP_STATIC (IDC_FOLDER_IN_CODE1 + 20) + #define IDC_FOLDER_IN_CODE1_OPEN_EDIT (IDC_FOLDER_IN_CODE1 + 21) + #define IDC_FOLDER_IN_CODE1_MIDDLE_EDIT (IDC_FOLDER_IN_CODE1 + 22) + #define IDC_FOLDER_IN_CODE1_CLOSE_EDIT (IDC_FOLDER_IN_CODE1 + 23) + #define IDC_FOLDER_IN_CODE1_OPEN_STATIC (IDC_FOLDER_IN_CODE1 + 24) + #define IDC_FOLDER_IN_CODE1_MIDDLE_STATIC (IDC_FOLDER_IN_CODE1 + 25) + #define IDC_FOLDER_IN_CODE1_CLOSE_STATIC (IDC_FOLDER_IN_CODE1 + 26) + #define IDC_FOLDER_IN_CODE1_STYLER (IDC_FOLDER_IN_CODE1 + 27) + + #define IDC_FOLDER_IN_CODE2 (IDD_FOLDER_STYLE_DLG + 300) + #define IDC_FOLDER_IN_CODE2_DESCGROUP_STATIC (IDC_FOLDER_IN_CODE2 + 20) + #define IDC_FOLDER_IN_CODE2_OPEN_EDIT (IDC_FOLDER_IN_CODE2 + 21) + #define IDC_FOLDER_IN_CODE2_MIDDLE_EDIT (IDC_FOLDER_IN_CODE2 + 22) + #define IDC_FOLDER_IN_CODE2_CLOSE_EDIT (IDC_FOLDER_IN_CODE2 + 23) + #define IDC_FOLDER_IN_CODE2_OPEN_STATIC (IDC_FOLDER_IN_CODE2 + 24) + #define IDC_FOLDER_IN_CODE2_MIDDLE_STATIC (IDC_FOLDER_IN_CODE2 + 25) + #define IDC_FOLDER_IN_CODE2_CLOSE_STATIC (IDC_FOLDER_IN_CODE2 + 26) + #define IDC_FOLDER_IN_CODE2_STYLER (IDC_FOLDER_IN_CODE2 + 27) + + #define IDC_FOLDER_IN_COMMENT (IDD_FOLDER_STYLE_DLG + 400) + #define IDC_FOLDER_IN_COMMENT_DESCGROUP_STATIC (IDC_FOLDER_IN_COMMENT + 20) + #define IDC_FOLDER_IN_COMMENT_OPEN_EDIT (IDC_FOLDER_IN_COMMENT + 21) + #define IDC_FOLDER_IN_COMMENT_MIDDLE_EDIT (IDC_FOLDER_IN_COMMENT + 22) + #define IDC_FOLDER_IN_COMMENT_CLOSE_EDIT (IDC_FOLDER_IN_COMMENT + 23) + #define IDC_FOLDER_IN_COMMENT_OPEN_STATIC (IDC_FOLDER_IN_COMMENT + 24) + #define IDC_FOLDER_IN_COMMENT_MIDDLE_STATIC (IDC_FOLDER_IN_COMMENT + 25) + #define IDC_FOLDER_IN_COMMENT_CLOSE_STATIC (IDC_FOLDER_IN_COMMENT + 26) + #define IDC_FOLDER_IN_COMMENT_STYLER (IDC_FOLDER_IN_COMMENT + 27) - #define IDC_DEFAULT (IDD_FOLDER_STYLE_DLG + 100) - #define IDC_DEFAULT_DESCGROUP_STATIC (IDC_DEFAULT+ 1) - #define IDC_DEFAULT_FG_STATIC (IDC_DEFAULT+ 2) - #define IDC_DEFAULT_BG_STATIC (IDC_DEFAULT + 3) - #define IDC_DEFAULT_FONT_COMBO (IDC_DEFAULT+ 4) - #define IDC_DEFAULT_FONTSIZE_COMBO (IDC_DEFAULT + 5) - #define IDC_DEFAULT_BOLD_CHECK (IDC_DEFAULT + 6) - #define IDC_DEFAULT_ITALIC_CHECK (IDC_DEFAULT + 7) - #define IDC_DEFAULT_FONTSTYLEGROUP_STATIC (IDC_DEFAULT+ 8) - #define IDC_DEFAULT_COLORSTYLEGROUP_STATIC (IDC_DEFAULT + 9) - #define IDC_DEFAULT_FONTNAME_STATIC (IDC_DEFAULT + 10) - #define IDC_DEFAULT_FONTSIZE_STATIC (IDC_DEFAULT+ 11) - #define IDC_DEFAULT_EDIT (IDC_DEFAULT+ 12) - #define IDC_DEFAULT_UNDERLINE_CHECK (IDC_DEFAULT + 13) - - #define IDC_FOLDEROPEN (IDD_FOLDER_STYLE_DLG + 200) - #define IDC_FOLDEROPEN_DESCGROUP_STATIC (IDC_FOLDEROPEN + 1) - #define IDC_FOLDEROPEN_FG_STATIC (IDC_FOLDEROPEN + 2) - #define IDC_FOLDEROPEN_BG_STATIC (IDC_FOLDEROPEN + 3) - #define IDC_FOLDEROPEN_FONT_COMBO (IDC_FOLDEROPEN + 4) - #define IDC_FOLDEROPEN_FONTSIZE_COMBO (IDC_FOLDEROPEN + 5) - #define IDC_FOLDEROPEN_BOLD_CHECK (IDC_FOLDEROPEN + 6) - #define IDC_FOLDEROPEN_ITALIC_CHECK (IDC_FOLDEROPEN + 7) - #define IDC_FOLDEROPEN_FONTSTYLEGROUP_STATIC (IDC_FOLDEROPEN + 8) - #define IDC_FOLDEROPEN_COLORSTYLEGROUP_STATIC (IDC_FOLDEROPEN + 9) - #define IDC_FOLDEROPEN_FONTNAME_STATIC (IDC_FOLDEROPEN + 10) - #define IDC_FOLDEROPEN_FONTSIZE_STATIC (IDC_FOLDEROPEN + 11) - #define IDC_FOLDEROPEN_EDIT (IDC_FOLDEROPEN + 12) - #define IDC_FOLDEROPEN_UNDERLINE_CHECK (IDC_FOLDEROPEN + 13) - - #define IDC_FOLDERCLOSE (IDD_FOLDER_STYLE_DLG + 300) - #define IDC_FOLDERCLOSE_DESCGROUP_STATIC (IDC_FOLDERCLOSE + 1) - #define IDC_FOLDERCLOSE_FG_STATIC (IDC_FOLDERCLOSE + 2) - #define IDC_FOLDERCLOSE_BG_STATIC (IDC_FOLDERCLOSE + 3) - #define IDC_FOLDERCLOSE_FONT_COMBO (IDC_FOLDERCLOSE + 4) - #define IDC_FOLDERCLOSE_FONTSIZE_COMBO (IDC_FOLDERCLOSE + 5) - #define IDC_FOLDERCLOSE_BOLD_CHECK (IDC_FOLDERCLOSE + 6) - #define IDC_FOLDERCLOSE_ITALIC_CHECK (IDC_FOLDERCLOSE + 7) - #define IDC_FOLDERCLOSE_FONTSTYLEGROUP_STATIC (IDC_FOLDERCLOSE + 8) - #define IDC_FOLDERCLOSE_COLORSTYLEGROUP_STATIC (IDC_FOLDERCLOSE + 9) - #define IDC_FOLDERCLOSE_FONTNAME_STATIC (IDC_FOLDERCLOSE + 10) - #define IDC_FOLDERCLOSE_FONTSIZE_STATIC (IDC_FOLDERCLOSE + 11) - #define IDC_FOLDERCLOSE_EDIT (IDC_FOLDERCLOSE + 12) - #define IDC_FOLDERCLOSE_UNDERLINE_CHECK (IDC_FOLDERCLOSE + 13) - #define IDD_KEYWORD_STYLE_DLG 22000 //(IDD_GLOBAL_USERDEFINE_DLG + 2000) - - #define IDC_KEYWORD1 (IDD_KEYWORD_STYLE_DLG + 100) - #define IDC_KEYWORD1_DESCGROUP_STATIC (IDC_KEYWORD1 + 1) - #define IDC_KEYWORD1_FG_STATIC (IDC_KEYWORD1 + 2) - #define IDC_KEYWORD1_BG_STATIC (IDC_KEYWORD1 + 3) - #define IDC_KEYWORD1_FONT_COMBO (IDC_KEYWORD1 + 4) - #define IDC_KEYWORD1_FONTSIZE_COMBO (IDC_KEYWORD1 + 5) - #define IDC_KEYWORD1_BOLD_CHECK (IDC_KEYWORD1 + 6) - #define IDC_KEYWORD1_ITALIC_CHECK (IDC_KEYWORD1 + 7) - #define IDC_KEYWORD1_FONTSTYLEGROUP_STATIC (IDC_KEYWORD1 + 8) - #define IDC_KEYWORD1_COLORSTYLEGROUP_STATIC (IDC_KEYWORD1 + 9) - #define IDC_KEYWORD1_FONTNAME_STATIC (IDC_KEYWORD1 + 10) - #define IDC_KEYWORD1_FONTSIZE_STATIC (IDC_KEYWORD1 + 11) - #define IDC_KEYWORD1_EDIT (IDC_KEYWORD1 + 12) - #define IDC_KEYWORD1_PREFIX_CHECK (IDC_KEYWORD1 + 13) - #define IDC_KEYWORD1_UNDERLINE_CHECK (IDC_KEYWORD1 + 14) + #define IDC_KEYWORD1 (IDD_KEYWORD_STYLE_DLG + 100) + #define IDC_KEYWORD1_DESCGROUP_STATIC (IDC_KEYWORD1 + 1 ) + #define IDC_KEYWORD1_EDIT (IDC_KEYWORD1 + 20) + #define IDC_KEYWORD1_PREFIX_CHECK (IDC_KEYWORD1 + 21) + #define IDC_KEYWORD1_STYLER (IDC_KEYWORD1 + 22) + + #define IDC_KEYWORD2 (IDD_KEYWORD_STYLE_DLG + 200) + #define IDC_KEYWORD2_DESCGROUP_STATIC (IDC_KEYWORD2 + 1 ) + #define IDC_KEYWORD2_EDIT (IDC_KEYWORD2 + 20) + #define IDC_KEYWORD2_PREFIX_CHECK (IDC_KEYWORD2 + 21) + #define IDC_KEYWORD2_STYLER (IDC_KEYWORD2 + 22) + + #define IDC_KEYWORD3 (IDD_KEYWORD_STYLE_DLG + 300) + #define IDC_KEYWORD3_DESCGROUP_STATIC (IDC_KEYWORD3 + 1 ) + #define IDC_KEYWORD3_EDIT (IDC_KEYWORD3 + 20) + #define IDC_KEYWORD3_PREFIX_CHECK (IDC_KEYWORD3 + 21) + #define IDC_KEYWORD3_STYLER (IDC_KEYWORD3 + 22) + + #define IDC_KEYWORD4 (IDD_KEYWORD_STYLE_DLG + 400) + #define IDC_KEYWORD4_DESCGROUP_STATIC (IDC_KEYWORD4 + 1 ) + #define IDC_KEYWORD4_EDIT (IDC_KEYWORD4 + 20) + #define IDC_KEYWORD4_PREFIX_CHECK (IDC_KEYWORD4 + 21) + #define IDC_KEYWORD4_STYLER (IDC_KEYWORD4 + 22) + + #define IDC_KEYWORD5 (IDD_KEYWORD_STYLE_DLG + 450) + #define IDC_KEYWORD5_DESCGROUP_STATIC (IDC_KEYWORD5 + 1 ) + #define IDC_KEYWORD5_EDIT (IDC_KEYWORD5 + 20) + #define IDC_KEYWORD5_PREFIX_CHECK (IDC_KEYWORD5 + 21) + #define IDC_KEYWORD5_STYLER (IDC_KEYWORD5 + 22) + + #define IDC_KEYWORD6 (IDD_KEYWORD_STYLE_DLG + 500) + #define IDC_KEYWORD6_DESCGROUP_STATIC (IDC_KEYWORD6 + 1 ) + #define IDC_KEYWORD6_EDIT (IDC_KEYWORD6 + 20) + #define IDC_KEYWORD6_PREFIX_CHECK (IDC_KEYWORD6 + 21) + #define IDC_KEYWORD6_STYLER (IDC_KEYWORD6 + 22) + + #define IDC_KEYWORD7 (IDD_KEYWORD_STYLE_DLG + 550) + #define IDC_KEYWORD7_DESCGROUP_STATIC (IDC_KEYWORD7 + 1 ) + #define IDC_KEYWORD7_EDIT (IDC_KEYWORD7 + 20) + #define IDC_KEYWORD7_PREFIX_CHECK (IDC_KEYWORD7 + 21) + #define IDC_KEYWORD7_STYLER (IDC_KEYWORD7 + 22) + + #define IDC_KEYWORD8 (IDD_KEYWORD_STYLE_DLG + 600) + #define IDC_KEYWORD8_DESCGROUP_STATIC (IDC_KEYWORD8 + 1 ) + #define IDC_KEYWORD8_EDIT (IDC_KEYWORD8 + 20) + #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 IDC_KEYWORD2 (IDD_KEYWORD_STYLE_DLG + 200) - #define IDC_KEYWORD2_DESCGROUP_STATIC (IDC_KEYWORD2 + 1) - #define IDC_KEYWORD2_FG_STATIC (IDC_KEYWORD2 + 2) - #define IDC_KEYWORD2_BG_STATIC (IDC_KEYWORD2 + 3) - #define IDC_KEYWORD2_FONT_COMBO (IDC_KEYWORD2 + 4) - #define IDC_KEYWORD2_FONTSIZE_COMBO (IDC_KEYWORD2 + 5) - #define IDC_KEYWORD2_BOLD_CHECK (IDC_KEYWORD2 + 6) - #define IDC_KEYWORD2_ITALIC_CHECK (IDC_KEYWORD2 + 7) - #define IDC_KEYWORD2_FONTSTYLEGROUP_STATIC (IDC_KEYWORD2 + 8) - #define IDC_KEYWORD2_COLORSTYLEGROUP_STATIC (IDC_KEYWORD2 + 9) - #define IDC_KEYWORD2_FONTNAME_STATIC (IDC_KEYWORD2 + 10) - #define IDC_KEYWORD2_FONTSIZE_STATIC (IDC_KEYWORD2 + 11) - #define IDC_KEYWORD2_EDIT (IDC_KEYWORD2 + 12) - #define IDC_KEYWORD2_PREFIX_CHECK (IDC_KEYWORD2 + 13) - #define IDC_KEYWORD2_UNDERLINE_CHECK (IDC_KEYWORD2 + 14) - - #define IDC_KEYWORD3 (IDD_KEYWORD_STYLE_DLG + 300) - #define IDC_KEYWORD3_DESCGROUP_STATIC (IDC_KEYWORD3 + 1) - #define IDC_KEYWORD3_FG_STATIC (IDC_KEYWORD3 + 2) - #define IDC_KEYWORD3_BG_STATIC (IDC_KEYWORD3 + 3) - #define IDC_KEYWORD3_FONT_COMBO (IDC_KEYWORD3 + 4) - #define IDC_KEYWORD3_FONTSIZE_COMBO (IDC_KEYWORD3 + 5) - #define IDC_KEYWORD3_BOLD_CHECK (IDC_KEYWORD3 + 6) - #define IDC_KEYWORD3_ITALIC_CHECK (IDC_KEYWORD3 + 7) - #define IDC_KEYWORD3_FONTSTYLEGROUP_STATIC (IDC_KEYWORD3 + 8) - #define IDC_KEYWORD3_COLORSTYLEGROUP_STATIC (IDC_KEYWORD3 + 9) - #define IDC_KEYWORD3_FONTNAME_STATIC (IDC_KEYWORD3 + 10) - #define IDC_KEYWORD3_FONTSIZE_STATIC (IDC_KEYWORD3 + 11) - #define IDC_KEYWORD3_EDIT (IDC_KEYWORD3 + 12) - #define IDC_KEYWORD3_PREFIX_CHECK (IDC_KEYWORD3 + 13) - #define IDC_KEYWORD3_UNDERLINE_CHECK (IDC_KEYWORD3 + 14) - - #define IDC_KEYWORD4 (IDD_KEYWORD_STYLE_DLG + 400) - #define IDC_KEYWORD4_DESCGROUP_STATIC (IDC_KEYWORD4 + 1) - #define IDC_KEYWORD4_FG_STATIC (IDC_KEYWORD4 + 2) - #define IDC_KEYWORD4_BG_STATIC (IDC_KEYWORD4 + 3) - #define IDC_KEYWORD4_FONT_COMBO (IDC_KEYWORD4 + 4) - #define IDC_KEYWORD4_FONTSIZE_COMBO (IDC_KEYWORD4 + 5) - #define IDC_KEYWORD4_BOLD_CHECK (IDC_KEYWORD4 + 6) - #define IDC_KEYWORD4_ITALIC_CHECK (IDC_KEYWORD4 + 7) - #define IDC_KEYWORD4_FONTSTYLEGROUP_STATIC (IDC_KEYWORD4 + 8) - #define IDC_KEYWORD4_COLORSTYLEGROUP_STATIC (IDC_KEYWORD4 + 9) - #define IDC_KEYWORD4_FONTNAME_STATIC (IDC_KEYWORD4 + 10) - #define IDC_KEYWORD4_FONTSIZE_STATIC (IDC_KEYWORD4 + 11) - #define IDC_KEYWORD4_EDIT (IDC_KEYWORD4 + 12) - #define IDC_KEYWORD4_PREFIX_CHECK (IDC_KEYWORD4 + 13) - #define IDC_KEYWORD4_UNDERLINE_CHECK (IDC_KEYWORD4 + 14) - - #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_COMMENT (IDD_COMMENT_STYLE_DLG + 100) + #define IDC_COMMENT_DESCGROUP_STATIC (IDC_COMMENT + 1 ) + #define IDC_COMMENT_OPEN_EDIT (IDC_COMMENT + 20) + #define IDC_COMMENT_CLOSE_EDIT (IDC_COMMENT + 21) + #define IDC_COMMENT_OPEN_STATIC (IDC_COMMENT + 22) + #define IDC_COMMENT_CLOSE_STATIC (IDC_COMMENT + 23) + #define IDC_COMMENT_STYLER (IDC_COMMENT + 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_COMMENTLINE (IDD_COMMENT_STYLE_DLG + 300) + #define IDC_COMMENTLINE_DESCGROUP_STATIC (IDC_COMMENTLINE + 1 ) + #define IDC_COMMENTLINE_OPEN_EDIT (IDC_COMMENTLINE + 20) + #define IDC_COMMENTLINE_CONTINUE_EDIT (IDC_COMMENTLINE + 21) + #define IDC_COMMENTLINE_CLOSE_EDIT (IDC_COMMENTLINE + 22) + #define IDC_COMMENTLINE_OPEN_STATIC (IDC_COMMENTLINE + 23) + #define IDC_COMMENTLINE_CONTINUE_STATIC (IDC_COMMENTLINE + 24) + #define IDC_COMMENTLINE_CLOSE_STATIC (IDC_COMMENTLINE + 25) + #define IDC_COMMENTLINE_STYLER (IDC_COMMENTLINE + 26) - #define IDC_COMMENT (IDD_COMMENT_STYLE_DLG + 100) - #define IDC_COMMENT_DESCGROUP_STATIC (IDC_COMMENT + 1) - #define IDC_COMMENT_FG_STATIC (IDC_COMMENT + 2) - #define IDC_COMMENT_BG_STATIC (IDC_COMMENT+ 3) - #define IDC_COMMENT_FONT_COMBO (IDC_COMMENT + 4) - #define IDC_COMMENT_FONTSIZE_COMBO (IDC_COMMENT+ 5) - #define IDC_COMMENT_BOLD_CHECK (IDC_COMMENT+ 6) - #define IDC_COMMENT_ITALIC_CHECK (IDC_COMMENT+ 7) - #define IDC_COMMENT_FONTSTYLEGROUP_STATIC (IDC_COMMENT+ 8) - #define IDC_COMMENT_COLORSTYLEGROUP_STATIC (IDC_COMMENT+ 9) - #define IDC_COMMENT_FONTNAME_STATIC (IDC_COMMENT+ 10) - #define IDC_COMMENT_FONTSIZE_STATIC (IDC_COMMENT+ 11) - #define IDC_COMMENTOPEN_EDIT (IDC_COMMENT+ 12) - #define IDC_COMMENTOPEN_STATIC (IDC_COMMENT+ 13) - #define IDC_COMMENTCLOSE_EDIT (IDC_COMMENT + 14) - #define IDC_COMMENTCLOSE_STATIC (IDC_COMMENT + 15) - #define IDC_COMMENTLINESYMBOL_CHECK (IDC_COMMENT + 16) - #define IDC_COMMENTSYMBOL_CHECK (IDC_COMMENT + 17) - #define IDC_COMMENT_UNDERLINE_CHECK (IDC_NUMBER + 18) - - #define IDC_NUMBER (IDD_COMMENT_STYLE_DLG + 200) - #define IDC_NUMBER_DESCGROUP_STATIC (IDC_NUMBER+ 1) - #define IDC_NUMBER_FG_STATIC (IDC_NUMBER+ 2) - #define IDC_NUMBER_BG_STATIC (IDC_NUMBER + 3) - #define IDC_NUMBER_FONT_COMBO (IDC_NUMBER+ 4) - #define IDC_NUMBER_FONTSIZE_COMBO (IDC_NUMBER + 5) - #define IDC_NUMBER_BOLD_CHECK (IDC_NUMBER + 6) - #define IDC_NUMBER_ITALIC_CHECK (IDC_NUMBER + 7) - #define IDC_NUMBER_FONTSTYLEGROUP_STATIC (IDC_NUMBER + 8) - #define IDC_NUMBER_COLORSTYLEGROUP_STATIC (IDC_NUMBER + 9) - #define IDC_NUMBER_FONTNAME_STATIC (IDC_NUMBER + 10) - #define IDC_NUMBER_FONTSIZE_STATIC (IDC_NUMBER + 11) - #define IDC_NUMBER_UNDERLINE_CHECK (IDC_NUMBER + 12) - - #define IDC_COMMENTLINE (IDD_COMMENT_STYLE_DLG + 300) - #define IDC_COMMENTLINE_DESCGROUP_STATIC (IDC_COMMENTLINE + 1) - #define IDC_COMMENTLINE_FG_STATIC (IDC_COMMENTLINE + 2) - #define IDC_COMMENTLINE_BG_STATIC (IDC_COMMENTLINE + 3) - #define IDC_COMMENTLINE_FONT_COMBO (IDC_COMMENTLINE + 4) - #define IDC_COMMENTLINE_FONTSIZE_COMBO (IDC_COMMENTLINE + 5) - #define IDC_COMMENTLINE_BOLD_CHECK (IDC_COMMENTLINE + 6) - #define IDC_COMMENTLINE_ITALIC_CHECK (IDC_COMMENTLINE + 7) - #define IDC_COMMENTLINE_FONTSTYLEGROUP_STATIC (IDC_COMMENTLINE + 8) - #define IDC_COMMENTLINE_COLORSTYLEGROUP_STATIC (IDC_COMMENTLINE + 9) - #define IDC_COMMENTLINE_FONTNAME_STATIC (IDC_COMMENTLINE + 10) - #define IDC_COMMENTLINE_FONTSIZE_STATIC (IDC_COMMENTLINE + 11) - #define IDC_COMMENTLINE_EDIT (IDC_COMMENTLINE + 12) - #define IDC_COMMENTLINE_UNDERLINE_CHECK (IDC_COMMENTLINE + 13) - #define IDD_SYMBOL_STYLE_DLG 24000 //IDD_GLOBAL_USERDEFINE_DLG + 4000 - #define IDC_HAS_ESCAPE (IDD_SYMBOL_STYLE_DLG + 1) - #define IDC_ESCAPE_CHAR (IDD_SYMBOL_STYLE_DLG + 2) + #define IDC_OPERATOR (IDD_SYMBOL_STYLE_DLG + 100) + #define IDC_OPERATOR_DESCGROUP_STATIC (IDC_OPERATOR + 1 ) + #define IDC_OPERATOR_STYLER (IDC_OPERATOR + 13) + #define IDC_OPERATOR1_EDIT (IDC_OPERATOR + 14) + #define IDC_OPERATOR2_EDIT (IDC_OPERATOR + 15) + #define IDC_OPERATOR1_STATIC (IDC_OPERATOR + 16) + #define IDC_OPERATOR2_STATIC (IDC_OPERATOR + 17) - #define IDC_SYMBOL (IDD_SYMBOL_STYLE_DLG + 100) - #define IDC_ACTIVATED_SYMBOL_STATIC (IDC_SYMBOL + 1) - #define IDC_ACTIVATED_SYMBOL_LIST (IDC_SYMBOL + 2) - #define IDC_AVAILABLE_SYMBOLS_STATIC (IDC_SYMBOL + 3) - #define IDC_AVAILABLE_SYMBOLS_LIST (IDC_SYMBOL + 4) - #define IDC_ADD_BUTTON (IDC_SYMBOL + 5) - #define IDC_REMOVE_BUTTON (IDC_SYMBOL + 6) - #define IDC_SYMBOL_DESCGROUP_STATIC (IDC_SYMBOL+ 7) - #define IDC_SYMBOL_FG_STATIC (IDC_SYMBOL + 8) - #define IDC_SYMBOL_BG_STATIC (IDC_SYMBOL + 9) - #define IDC_SYMBOL_FONT_COMBO (IDC_SYMBOL + 10) - #define IDC_SYMBOL_FONTSIZE_COMBO (IDC_SYMBOL + 11) - #define IDC_SYMBOL_BOLD_CHECK (IDC_SYMBOL+ 12) - #define IDC_SYMBOL_ITALIC_CHECK (IDC_SYMBOL + 13) - #define IDC_SYMBOL_FONTSTYLEGROUP_STATIC (IDC_SYMBOL + 14) - #define IDC_SYMBOL_COLORSTYLEGROUP_STATIC ( IDC_SYMBOL + 15) - #define IDC_SYMBOL_FONTNAME_STATIC (IDC_SYMBOL + 16) - #define IDC_SYMBOL_FONTSIZE_STATIC (IDC_SYMBOL + 17) - #define IDC_SYMBOL_UNDERLINE_CHECK (IDC_SYMBOL + 18) - - #define IDC_SYMBOL2 (IDD_SYMBOL_STYLE_DLG + 200) - #define IDC_SYMBOL_DELIMGROUP1_STATIC (IDC_SYMBOL2 + 1) - #define IDC_SYMBOL_COLORSTYLEGROUP2_STATIC (IDC_SYMBOL2 + 2) - #define IDC_SYMBOL_FONTSTYLEGROUP2_STATIC (IDC_SYMBOL2 + 3) - #define IDC_SYMBOL_FG2_STATIC (IDC_SYMBOL2 + 4) - #define IDC_SYMBOL_BG2_STATIC (IDC_SYMBOL2 + 5) - #define IDC_SYMBOL_FONTNAME2_STATIC (IDC_SYMBOL2 + 6) - #define IDC_SYMBOL_BOLD2_CHECK (IDC_SYMBOL2 + 7) - #define IDC_SYMBOL_ITALIC2_CHECK (IDC_SYMBOL2 + 8) - #define IDC_SYMBOL_FONT2_COMBO (IDC_SYMBOL2 + 9) - #define IDC_SYMBOL_UNDERLINE2_CHECK (IDC_SYMBOL2 + 10) - #define IDC_SYMBOL_BO2_STATIC (IDC_SYMBOL2 + 11) - #define IDC_SYMBOL_BO2_COMBO (IDC_SYMBOL2 + 12) - #define IDC_SYMBOL_BC2_COMBO (IDC_SYMBOL2 + 13) - #define IDC_SYMBOL_BC2_STATIC (IDC_SYMBOL2 + 14) - #define IDC_SYMBOL_FONTSIZE2_COMBO (IDC_SYMBOL2 + 15) - #define IDC_SYMBOL_FONTSIZE2_STATIC (IDC_SYMBOL2 + 16) + #define IDC_DELIMITER1 (IDD_SYMBOL_STYLE_DLG + 200) + #define IDC_DELIMITER1_DESCGROUP_STATIC (IDC_DELIMITER1 + 1 ) + #define IDC_DELIMITER1_BOUNDARYOPEN_EDIT (IDC_DELIMITER1 + 17) + #define IDC_DELIMITER1_ESCAPE_EDIT (IDC_DELIMITER1 + 18) + #define IDC_DELIMITER1_BOUNDARYCLOSE_EDIT (IDC_DELIMITER1 + 19) + #define IDC_DELIMITER1_BOUNDARYOPEN_STATIC (IDC_DELIMITER1 + 20) + #define IDC_DELIMITER1_ESCAPE_STATIC (IDC_DELIMITER1 + 21) + #define IDC_DELIMITER1_BOUNDARYCLOSE_STATIC (IDC_DELIMITER1 + 22) + #define IDC_DELIMITER1_STYLER (IDC_DELIMITER1 + 23) + + #define IDC_DELIMITER2 (IDD_SYMBOL_STYLE_DLG + 300) + #define IDC_DELIMITER2_DESCGROUP_STATIC (IDC_DELIMITER2 + 1 ) + #define IDC_DELIMITER2_BOUNDARYOPEN_EDIT (IDC_DELIMITER2 + 17) + #define IDC_DELIMITER2_ESCAPE_EDIT (IDC_DELIMITER2 + 18) + #define IDC_DELIMITER2_BOUNDARYCLOSE_EDIT (IDC_DELIMITER2 + 19) + #define IDC_DELIMITER2_BOUNDARYOPEN_STATIC (IDC_DELIMITER2 + 20) + #define IDC_DELIMITER2_ESCAPE_STATIC (IDC_DELIMITER2 + 21) + #define IDC_DELIMITER2_BOUNDARYCLOSE_STATIC (IDC_DELIMITER2 + 22) + #define IDC_DELIMITER2_STYLER (IDC_DELIMITER2 + 23) + + #define IDC_DELIMITER3 (IDD_SYMBOL_STYLE_DLG + 400) + #define IDC_DELIMITER3_DESCGROUP_STATIC (IDC_DELIMITER3 + 1 ) + #define IDC_DELIMITER3_BOUNDARYOPEN_EDIT (IDC_DELIMITER3 + 17) + #define IDC_DELIMITER3_ESCAPE_EDIT (IDC_DELIMITER3 + 18) + #define IDC_DELIMITER3_BOUNDARYCLOSE_EDIT (IDC_DELIMITER3 + 19) + #define IDC_DELIMITER3_BOUNDARYOPEN_STATIC (IDC_DELIMITER3 + 20) + #define IDC_DELIMITER3_ESCAPE_STATIC (IDC_DELIMITER3 + 21) + #define IDC_DELIMITER3_BOUNDARYCLOSE_STATIC (IDC_DELIMITER3 + 22) + #define IDC_DELIMITER3_STYLER (IDC_DELIMITER3 + 23) + + #define IDC_DELIMITER4 (IDD_SYMBOL_STYLE_DLG + 450) + #define IDC_DELIMITER4_DESCGROUP_STATIC (IDC_DELIMITER4 + 1 ) + #define IDC_DELIMITER4_BOUNDARYOPEN_EDIT (IDC_DELIMITER4 + 17) + #define IDC_DELIMITER4_ESCAPE_EDIT (IDC_DELIMITER4 + 18) + #define IDC_DELIMITER4_BOUNDARYCLOSE_EDIT (IDC_DELIMITER4 + 19) + #define IDC_DELIMITER4_BOUNDARYOPEN_STATIC (IDC_DELIMITER4 + 20) + #define IDC_DELIMITER4_ESCAPE_STATIC (IDC_DELIMITER4 + 21) + #define IDC_DELIMITER4_BOUNDARYCLOSE_STATIC (IDC_DELIMITER4 + 22) + #define IDC_DELIMITER4_STYLER (IDC_DELIMITER4 + 23) + + #define IDC_DELIMITER5 (IDD_SYMBOL_STYLE_DLG + 500) + #define IDC_DELIMITER5_DESCGROUP_STATIC (IDC_DELIMITER5 + 1 ) + #define IDC_DELIMITER5_BOUNDARYOPEN_EDIT (IDC_DELIMITER5 + 17) + #define IDC_DELIMITER5_ESCAPE_EDIT (IDC_DELIMITER5 + 18) + #define IDC_DELIMITER5_BOUNDARYCLOSE_EDIT (IDC_DELIMITER5 + 19) + #define IDC_DELIMITER5_BOUNDARYOPEN_STATIC (IDC_DELIMITER5 + 20) + #define IDC_DELIMITER5_ESCAPE_STATIC (IDC_DELIMITER5 + 21) + #define IDC_DELIMITER5_BOUNDARYCLOSE_STATIC (IDC_DELIMITER5 + 22) + #define IDC_DELIMITER5_STYLER (IDC_DELIMITER5 + 23) + + #define IDC_DELIMITER6 (IDD_SYMBOL_STYLE_DLG + 550) + #define IDC_DELIMITER6_DESCGROUP_STATIC (IDC_DELIMITER6 + 1 ) + #define IDC_DELIMITER6_BOUNDARYOPEN_EDIT (IDC_DELIMITER6 + 17) + #define IDC_DELIMITER6_ESCAPE_EDIT (IDC_DELIMITER6 + 18) + #define IDC_DELIMITER6_BOUNDARYCLOSE_EDIT (IDC_DELIMITER6 + 19) + #define IDC_DELIMITER6_BOUNDARYOPEN_STATIC (IDC_DELIMITER6 + 20) + #define IDC_DELIMITER6_ESCAPE_STATIC (IDC_DELIMITER6 + 21) + #define IDC_DELIMITER6_BOUNDARYCLOSE_STATIC (IDC_DELIMITER6 + 22) + #define IDC_DELIMITER6_STYLER (IDC_DELIMITER6 + 23) + + #define IDC_DELIMITER7 (IDD_SYMBOL_STYLE_DLG + 600) + #define IDC_DELIMITER7_DESCGROUP_STATIC (IDC_DELIMITER7 + 1 ) + #define IDC_DELIMITER7_BOUNDARYOPEN_EDIT (IDC_DELIMITER7 + 17) + #define IDC_DELIMITER7_ESCAPE_EDIT (IDC_DELIMITER7 + 18) + #define IDC_DELIMITER7_BOUNDARYCLOSE_EDIT (IDC_DELIMITER7 + 19) + #define IDC_DELIMITER7_BOUNDARYOPEN_STATIC (IDC_DELIMITER7 + 20) + #define IDC_DELIMITER7_ESCAPE_STATIC (IDC_DELIMITER7 + 21) + #define IDC_DELIMITER7_BOUNDARYCLOSE_STATIC (IDC_DELIMITER7 + 22) + #define IDC_DELIMITER7_STYLER (IDC_DELIMITER7 + 23) + + #define IDC_DELIMITER8 (IDD_SYMBOL_STYLE_DLG + 650) + #define IDC_DELIMITER8_DESCGROUP_STATIC (IDC_DELIMITER8 + 1 ) + #define IDC_DELIMITER8_BOUNDARYOPEN_EDIT (IDC_DELIMITER8 + 17) + #define IDC_DELIMITER8_ESCAPE_EDIT (IDC_DELIMITER8 + 18) + #define IDC_DELIMITER8_BOUNDARYCLOSE_EDIT (IDC_DELIMITER8 + 19) + #define IDC_DELIMITER8_BOUNDARYOPEN_STATIC (IDC_DELIMITER8 + 20) + #define IDC_DELIMITER8_ESCAPE_STATIC (IDC_DELIMITER8 + 21) + #define IDC_DELIMITER8_BOUNDARYCLOSE_STATIC (IDC_DELIMITER8 + 22) + #define IDC_DELIMITER8_STYLER (IDC_DELIMITER8 + 23) + +#define IDD_STYLER_POPUP_DLG 25000 //IDD_GLOBAL_USERDEFINE_DLG + 5000 + #define IDC_STYLER_CHECK_BOLD (IDD_STYLER_POPUP_DLG + 1 ) + #define IDC_STYLER_CHECK_ITALIC (IDD_STYLER_POPUP_DLG + 2 ) + #define IDC_STYLER_CHECK_UNDERLINE (IDD_STYLER_POPUP_DLG + 3 ) + #define IDC_STYLER_COMBO_FONT_NAME (IDD_STYLER_POPUP_DLG + 4 ) + #define IDC_STYLER_COMBO_FONT_SIZE (IDD_STYLER_POPUP_DLG + 5 ) + #define IDC_STYLER_FG_STATIC (IDD_STYLER_POPUP_DLG + 6 ) + #define IDC_STYLER_BG_STATIC (IDD_STYLER_POPUP_DLG + 7 ) + #define IDC_STYLER_CHECK_NESTING_DELIMITER1 (IDD_STYLER_POPUP_DLG + 8 ) + #define IDC_STYLER_CHECK_NESTING_DELIMITER2 (IDD_STYLER_POPUP_DLG + 9 ) + #define IDC_STYLER_CHECK_NESTING_DELIMITER3 (IDD_STYLER_POPUP_DLG + 10) + #define IDC_STYLER_CHECK_NESTING_DELIMITER4 (IDD_STYLER_POPUP_DLG + 11) + #define IDC_STYLER_CHECK_NESTING_DELIMITER5 (IDD_STYLER_POPUP_DLG + 12) + #define IDC_STYLER_CHECK_NESTING_DELIMITER6 (IDD_STYLER_POPUP_DLG + 13) + #define IDC_STYLER_CHECK_NESTING_DELIMITER7 (IDD_STYLER_POPUP_DLG + 14) + #define IDC_STYLER_CHECK_NESTING_DELIMITER8 (IDD_STYLER_POPUP_DLG + 15) + #define IDC_STYLER_CHECK_NESTING_COMMENT (IDD_STYLER_POPUP_DLG + 16) + #define IDC_STYLER_CHECK_NESTING_COMMENT_LINE (IDD_STYLER_POPUP_DLG + 17) + #define IDC_STYLER_CHECK_NESTING_KEYWORD1 (IDD_STYLER_POPUP_DLG + 18) + #define IDC_STYLER_CHECK_NESTING_KEYWORD2 (IDD_STYLER_POPUP_DLG + 19) + #define IDC_STYLER_CHECK_NESTING_KEYWORD3 (IDD_STYLER_POPUP_DLG + 20) + #define IDC_STYLER_CHECK_NESTING_KEYWORD4 (IDD_STYLER_POPUP_DLG + 21) + #define IDC_STYLER_CHECK_NESTING_KEYWORD5 (IDD_STYLER_POPUP_DLG + 22) + #define IDC_STYLER_CHECK_NESTING_KEYWORD6 (IDD_STYLER_POPUP_DLG + 23) + #define IDC_STYLER_CHECK_NESTING_KEYWORD7 (IDD_STYLER_POPUP_DLG + 24) + #define IDC_STYLER_CHECK_NESTING_KEYWORD8 (IDD_STYLER_POPUP_DLG + 25) + #define IDC_STYLER_CHECK_NESTING_OPERATORS1 (IDD_STYLER_POPUP_DLG + 26) + #define IDC_STYLER_CHECK_NESTING_OPERATORS2 (IDD_STYLER_POPUP_DLG + 27) + #define IDC_STYLER_CHECK_NESTING_NUMBERS (IDD_STYLER_POPUP_DLG + 28) + #define IDC_STYLER_STATIC_NESTING_GROUP (IDD_STYLER_POPUP_DLG + 29) + #define IDC_STYLER_STATIC_FONT_OPTIONS (IDD_STYLER_POPUP_DLG + 30) + #define IDC_STYLER_NAME_STATIC (IDD_STYLER_POPUP_DLG + 31) + #define IDC_STYLER_SIZE_STATIC (IDD_STYLER_POPUP_DLG + 32) + +#define IDD_STRING_DLG 26000 //IDD_GLOBAL_USERDEFINE_DLG + 6000 + #define IDC_STRING_STATIC (IDD_STRING_DLG + 1) + #define IDC_STRING_EDIT (IDD_STRING_DLG + 2) - #define IDC_SYMBOL3 (IDD_SYMBOL_STYLE_DLG + 300) - #define IDC_SYMBOL_DELIMGROUP2_STATIC (IDC_SYMBOL3 + 1) - #define IDC_SYMBOL_FG3_STATIC (IDC_SYMBOL3 + 2) - #define IDC_SYMBOL_BG3_STATIC (IDC_SYMBOL3 + 3) - #define IDC_SYMBOL_FONT3_COMBO (IDC_SYMBOL3 + 4) - #define IDC_SYMBOL_BO3_COMBO (IDC_SYMBOL3 + 5) - #define IDC_SYMBOL_BOLD3_CHECK (IDC_SYMBOL3 + 6) - #define IDC_SYMBOL_ITALIC3_CHECK (IDC_SYMBOL3 + 7) - #define IDC_SYMBOL_FONTSTYLEGROUP3_STATIC (IDC_SYMBOL3 + 8) - #define IDC_SYMBOL_COLORSTYLEGROUP3_STATIC (IDC_SYMBOL3 + 9) - #define IDC_SYMBOL_FONTNAME3_STATIC (IDC_SYMBOL3 + 10) - #define IDC_SYMBOL_BO3_STATIC (IDC_SYMBOL3 + 11) - #define IDC_SYMBOL_UNDERLINE3_CHECK (IDC_SYMBOL3 + 12) - #define IDC_SYMBOL_BC3_COMBO (IDC_SYMBOL3 + 13) - #define IDC_SYMBOL_BC3_STATIC (IDC_SYMBOL3 + 14) - #define IDC_SYMBOL_FONTSIZE3_COMBO (IDC_SYMBOL3 + 15) - #define IDC_SYMBOL_FONTSIZE3_STATIC (IDC_SYMBOL3 + 16) - -#define IDD_STRING_DLG 25000 - #define IDC_STRING_STATIC (IDD_STRING_DLG + 1) - #define IDC_STRING_EDIT (IDD_STRING_DLG + 2) #endif //USERDEFIN_RC_H - diff --git a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp index b33a32ef..f6af9232 100644 --- a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp +++ b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp @@ -592,8 +592,8 @@ void WordStyleDlg::updateFontName() void WordStyleDlg::updateFontStyleStatus(fontStyleType whitchStyle) { Style & style = getCurrentStyler(); - if (style._fontStyle == -1) - style._fontStyle = 0; + //if (style._fontStyle == -1) + // style._fontStyle = 0; int fontStyle = FONTSTYLE_UNDERLINE; HWND hWnd = _hCheckUnderline; @@ -786,7 +786,7 @@ void WordStyleDlg::setVisualFromStyleList() //-- font style : bold et italic isEnable = false; int isBold, isItalic, isUnderline; - if (style._fontStyle != -1) + if (style._fontStyle != FONTSTYLE_NONE) { isBold = (style._fontStyle & FONTSTYLE_BOLD)?BST_CHECKED:BST_UNCHECKED; isItalic = (style._fontStyle & FONTSTYLE_ITALIC)?BST_CHECKED:BST_UNCHECKED; diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp index d8087996..59f68edf 100644 --- a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp +++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp @@ -1567,7 +1567,7 @@ BOOL CALLBACK LangMenuDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPara { nppGUI._isLangMenuCompact = (BST_CHECKED == ::SendMessage(::GetDlgItem(_hSelf, IDC_CHECK_LANGMENUCOMPACT), BM_GETCHECK, 0, 0)); ::MessageBox(_hSelf, - nppGUI._isLangMenuCompact?TEXT("This option will be enable on the next launch."):TEXT("This option will be disable on the next launch."), + nppGUI._isLangMenuCompact?TEXT("This option will be enabled on the next launch."):TEXT("This option will be disabled on the next launch."), TEXT("Compact Language Menu"), MB_OK); return TRUE; } diff --git a/PowerEditor/src/localization.cpp b/PowerEditor/src/localization.cpp index f08ae3a3..08dc30df 100644 --- a/PowerEditor/src/localization.cpp +++ b/PowerEditor/src/localization.cpp @@ -663,34 +663,35 @@ void NativeLangSpeaker::changeUserDefineLang(UserDefineDialog *userDefineDlg) hDlgArrary[3] = userDefineDlg->getSymbolHandle(); const int nbGrpFolder = 3; - int folderID[nbGrpFolder][nbControl] = {\ - {IDC_DEFAULT_COLORSTYLEGROUP_STATIC, IDC_DEFAULT_FG_STATIC, IDC_DEFAULT_BG_STATIC, IDC_DEFAULT_FONTSTYLEGROUP_STATIC, IDC_DEFAULT_FONTNAME_STATIC, IDC_DEFAULT_FONTSIZE_STATIC, IDC_DEFAULT_BOLD_CHECK, IDC_DEFAULT_ITALIC_CHECK, IDC_DEFAULT_UNDERLINE_CHECK},\ - {IDC_FOLDEROPEN_COLORSTYLEGROUP_STATIC, IDC_FOLDEROPEN_FG_STATIC, IDC_FOLDEROPEN_BG_STATIC, IDC_FOLDEROPEN_FONTSTYLEGROUP_STATIC, IDC_FOLDEROPEN_FONTNAME_STATIC, IDC_FOLDEROPEN_FONTSIZE_STATIC, IDC_FOLDEROPEN_BOLD_CHECK, IDC_FOLDEROPEN_ITALIC_CHECK, IDC_FOLDEROPEN_UNDERLINE_CHECK},\ - {IDC_FOLDERCLOSE_COLORSTYLEGROUP_STATIC, IDC_FOLDERCLOSE_FG_STATIC, IDC_FOLDERCLOSE_BG_STATIC, IDC_FOLDERCLOSE_FONTSTYLEGROUP_STATIC, IDC_FOLDERCLOSE_FONTNAME_STATIC, IDC_FOLDERCLOSE_FONTSIZE_STATIC, IDC_FOLDERCLOSE_BOLD_CHECK, IDC_FOLDERCLOSE_ITALIC_CHECK, IDC_FOLDERCLOSE_UNDERLINE_CHECK}\ + int folderID[nbGrpFolder][nbControl] = { + //{IDC_DEFAULT_COLORSTYLEGROUP_STATIC, IDC_DEFAULT_FG_STATIC, IDC_DEFAULT_BG_STATIC, IDC_DEFAULT_FONTSTYLEGROUP_STATIC, IDC_DEFAULT_FONTNAME_STATIC, IDC_DEFAULT_FONTSIZE_STATIC, IDC_DEFAULT_BOLD_CHECK, IDC_DEFAULT_ITALIC_CHECK, IDC_DEFAULT_UNDERLINE_CHECK},\ + //{IDC_FOLDEROPEN_COLORSTYLEGROUP_STATIC, IDC_FOLDEROPEN_FG_STATIC, IDC_FOLDEROPEN_BG_STATIC, IDC_FOLDEROPEN_FONTSTYLEGROUP_STATIC, IDC_FOLDEROPEN_FONTNAME_STATIC, IDC_FOLDEROPEN_FONTSIZE_STATIC, IDC_FOLDEROPEN_BOLD_CHECK, IDC_FOLDEROPEN_ITALIC_CHECK, IDC_FOLDEROPEN_UNDERLINE_CHECK},\ + //{IDC_FOLDERCLOSE_COLORSTYLEGROUP_STATIC, IDC_FOLDERCLOSE_FG_STATIC, IDC_FOLDERCLOSE_BG_STATIC, IDC_FOLDERCLOSE_FONTSTYLEGROUP_STATIC, IDC_FOLDERCLOSE_FONTNAME_STATIC, IDC_FOLDERCLOSE_FONTSIZE_STATIC, IDC_FOLDERCLOSE_BOLD_CHECK, IDC_FOLDERCLOSE_ITALIC_CHECK, IDC_FOLDERCLOSE_UNDERLINE_CHECK} }; const int nbGrpKeywords = 4; - int keywordsID[nbGrpKeywords][nbControl] = {\ - {IDC_KEYWORD1_COLORSTYLEGROUP_STATIC, IDC_KEYWORD1_FG_STATIC, IDC_KEYWORD1_BG_STATIC, IDC_KEYWORD1_FONTSTYLEGROUP_STATIC, IDC_KEYWORD1_FONTNAME_STATIC, IDC_KEYWORD1_FONTSIZE_STATIC, IDC_KEYWORD1_BOLD_CHECK, IDC_KEYWORD1_ITALIC_CHECK, IDC_KEYWORD1_UNDERLINE_CHECK},\ - {IDC_KEYWORD2_COLORSTYLEGROUP_STATIC, IDC_KEYWORD2_FG_STATIC, IDC_KEYWORD2_BG_STATIC, IDC_KEYWORD2_FONTSTYLEGROUP_STATIC, IDC_KEYWORD2_FONTNAME_STATIC, IDC_KEYWORD2_FONTSIZE_STATIC, IDC_KEYWORD2_BOLD_CHECK, IDC_KEYWORD2_ITALIC_CHECK, IDC_KEYWORD2_UNDERLINE_CHECK},\ - {IDC_KEYWORD3_COLORSTYLEGROUP_STATIC, IDC_KEYWORD3_FG_STATIC, IDC_KEYWORD3_BG_STATIC, IDC_KEYWORD3_FONTSTYLEGROUP_STATIC, IDC_KEYWORD3_FONTNAME_STATIC, IDC_KEYWORD3_FONTSIZE_STATIC, IDC_KEYWORD3_BOLD_CHECK, IDC_KEYWORD3_ITALIC_CHECK, IDC_KEYWORD3_UNDERLINE_CHECK},\ - {IDC_KEYWORD4_COLORSTYLEGROUP_STATIC, IDC_KEYWORD4_FG_STATIC, IDC_KEYWORD4_BG_STATIC, IDC_KEYWORD4_FONTSTYLEGROUP_STATIC, IDC_KEYWORD4_FONTNAME_STATIC, IDC_KEYWORD4_FONTSIZE_STATIC, IDC_KEYWORD4_BOLD_CHECK, IDC_KEYWORD4_ITALIC_CHECK, IDC_KEYWORD4_UNDERLINE_CHECK}\ + int keywordsID[nbGrpKeywords][nbControl] = {//\ + //{IDC_KEYWORD1_COLORSTYLEGROUP_STATIC, IDC_KEYWORD1_FG_STATIC, IDC_KEYWORD1_BG_STATIC, IDC_KEYWORD1_FONTSTYLEGROUP_STATIC, IDC_KEYWORD1_FONTNAME_STATIC, IDC_KEYWORD1_FONTSIZE_STATIC, IDC_KEYWORD1_BOLD_CHECK, IDC_KEYWORD1_ITALIC_CHECK, IDC_KEYWORD1_UNDERLINE_CHECK},\ + //{IDC_KEYWORD2_COLORSTYLEGROUP_STATIC, IDC_KEYWORD2_FG_STATIC, IDC_KEYWORD2_BG_STATIC, IDC_KEYWORD2_FONTSTYLEGROUP_STATIC, IDC_KEYWORD2_FONTNAME_STATIC, IDC_KEYWORD2_FONTSIZE_STATIC, IDC_KEYWORD2_BOLD_CHECK, IDC_KEYWORD2_ITALIC_CHECK, IDC_KEYWORD2_UNDERLINE_CHECK},\ + //{IDC_KEYWORD3_COLORSTYLEGROUP_STATIC, IDC_KEYWORD3_FG_STATIC, IDC_KEYWORD3_BG_STATIC, IDC_KEYWORD3_FONTSTYLEGROUP_STATIC, IDC_KEYWORD3_FONTNAME_STATIC, IDC_KEYWORD3_FONTSIZE_STATIC, IDC_KEYWORD3_BOLD_CHECK, IDC_KEYWORD3_ITALIC_CHECK, IDC_KEYWORD3_UNDERLINE_CHECK},\ + //{IDC_KEYWORD4_COLORSTYLEGROUP_STATIC, IDC_KEYWORD4_FG_STATIC, IDC_KEYWORD4_BG_STATIC, IDC_KEYWORD4_FONTSTYLEGROUP_STATIC, IDC_KEYWORD4_FONTNAME_STATIC, IDC_KEYWORD4_FONTSIZE_STATIC, IDC_KEYWORD4_BOLD_CHECK, IDC_KEYWORD4_ITALIC_CHECK, IDC_KEYWORD4_UNDERLINE_CHECK} }; const int nbGrpComment = 3; - int commentID[nbGrpComment][nbControl] = {\ - {IDC_COMMENT_COLORSTYLEGROUP_STATIC, IDC_COMMENT_FG_STATIC, IDC_COMMENT_BG_STATIC, IDC_COMMENT_FONTSTYLEGROUP_STATIC, IDC_COMMENT_FONTNAME_STATIC, IDC_COMMENT_FONTSIZE_STATIC, IDC_COMMENT_BOLD_CHECK, IDC_COMMENT_ITALIC_CHECK, IDC_COMMENT_UNDERLINE_CHECK},\ - {IDC_NUMBER_COLORSTYLEGROUP_STATIC, IDC_NUMBER_FG_STATIC, IDC_NUMBER_BG_STATIC, IDC_NUMBER_FONTSTYLEGROUP_STATIC, IDC_NUMBER_FONTNAME_STATIC, IDC_NUMBER_FONTSIZE_STATIC, IDC_NUMBER_BOLD_CHECK, IDC_NUMBER_ITALIC_CHECK, IDC_NUMBER_UNDERLINE_CHECK},\ - {IDC_COMMENTLINE_COLORSTYLEGROUP_STATIC, IDC_COMMENTLINE_FG_STATIC, IDC_COMMENTLINE_BG_STATIC, IDC_COMMENTLINE_FONTSTYLEGROUP_STATIC, IDC_COMMENTLINE_FONTNAME_STATIC, IDC_COMMENTLINE_FONTSIZE_STATIC, IDC_COMMENTLINE_BOLD_CHECK, IDC_COMMENTLINE_ITALIC_CHECK, IDC_COMMENTLINE_UNDERLINE_CHECK}\ + int commentID[nbGrpComment][nbControl] = {//\ + //{IDC_COMMENT_COLORSTYLEGROUP_STATIC, IDC_COMMENT_FG_STATIC, IDC_COMMENT_BG_STATIC, IDC_COMMENT_FONTSTYLEGROUP_STATIC, IDC_COMMENT_FONTNAME_STATIC, IDC_COMMENT_FONTSIZE_STATIC, IDC_COMMENT_BOLD_CHECK, IDC_COMMENT_ITALIC_CHECK, IDC_COMMENT_UNDERLINE_CHECK},\ + //{IDC_NUMBER_COLORSTYLEGROUP_STATIC, IDC_NUMBER_FG_STATIC, IDC_NUMBER_BG_STATIC, IDC_NUMBER_FONTSTYLEGROUP_STATIC, IDC_NUMBER_FONTNAME_STATIC, IDC_NUMBER_FONTSIZE_STATIC, IDC_NUMBER_BOLD_CHECK, IDC_NUMBER_ITALIC_CHECK, IDC_NUMBER_UNDERLINE_CHECK},\ + //{IDC_COMMENTLINE_COLORSTYLEGROUP_STATIC, IDC_COMMENTLINE_FG_STATIC, IDC_COMMENTLINE_BG_STATIC, IDC_COMMENTLINE_FONTSTYLEGROUP_STATIC, IDC_COMMENTLINE_FONTNAME_STATIC, IDC_COMMENTLINE_FONTSIZE_STATIC, IDC_COMMENTLINE_BOLD_CHECK, IDC_COMMENTLINE_ITALIC_CHECK, IDC_COMMENTLINE_UNDERLINE_CHECK} }; - const int nbGrpOperator = 3; - int operatorID[nbGrpOperator][nbControl] = {\ - {IDC_SYMBOL_COLORSTYLEGROUP_STATIC, IDC_SYMBOL_FG_STATIC, IDC_SYMBOL_BG_STATIC, IDC_SYMBOL_FONTSTYLEGROUP_STATIC, IDC_SYMBOL_FONTNAME_STATIC, IDC_SYMBOL_FONTSIZE_STATIC, IDC_SYMBOL_BOLD_CHECK, IDC_SYMBOL_ITALIC_CHECK, IDC_SYMBOL_UNDERLINE_CHECK},\ - {IDC_SYMBOL_COLORSTYLEGROUP2_STATIC, IDC_SYMBOL_FG2_STATIC, IDC_SYMBOL_BG2_STATIC, IDC_SYMBOL_FONTSTYLEGROUP2_STATIC, IDC_SYMBOL_FONTNAME2_STATIC, IDC_SYMBOL_FONTSIZE2_STATIC, IDC_SYMBOL_BOLD2_CHECK, IDC_SYMBOL_ITALIC2_CHECK, IDC_SYMBOL_UNDERLINE2_CHECK},\ - {IDC_SYMBOL_COLORSTYLEGROUP3_STATIC, IDC_SYMBOL_FG3_STATIC, IDC_SYMBOL_BG3_STATIC, IDC_SYMBOL_FONTSTYLEGROUP3_STATIC, IDC_SYMBOL_FONTNAME3_STATIC, IDC_SYMBOL_FONTSIZE3_STATIC, IDC_SYMBOL_BOLD3_CHECK, IDC_SYMBOL_ITALIC3_CHECK, IDC_SYMBOL_UNDERLINE3_CHECK} + const int nbGrpOperator = 4; + int operatorID[nbGrpOperator][nbControl] = {//\ + //{IDC_OPERATOR_COLORSTYLEGROUP_STATIC, IDC_OPERATOR_FG_STATIC, IDC_OPERATOR_BG_STATIC, IDC_OPERATOR_FONTSTYLEGROUP_STATIC, IDC_OPERATOR_FONTNAME_STATIC, IDC_OPERATOR_FONTSIZE_STATIC, IDC_OPERATOR_BOLD_CHECK, IDC_OPERATOR_ITALIC_CHECK, IDC_OPERATOR_UNDERLINE_CHECK},\ + //{IDC_DELIMITER1_COLORSTYLEGROUP_STATIC, IDC_DELIMITER1_FG_STATIC, IDC_DELIMITER1_BG_STATIC, IDC_DELIMITER1_FONTSTYLEGROUP_STATIC, IDC_DELIMITER1_FONTNAME_STATIC, IDC_DELIMITER1_FONTSIZE_STATIC, IDC_DELIMITER1_BOLD_CHECK, IDC_DELIMITER1_ITALIC_CHECK, IDC_DELIMITER1_UNDERLINE_CHECK},\ + //{IDC_DELIMITER2_COLORSTYLEGROUP_STATIC, IDC_DELIMITER2_FG_STATIC, IDC_DELIMITER2_BG_STATIC, IDC_DELIMITER2_FONTSTYLEGROUP_STATIC, IDC_DELIMITER2_FONTNAME_STATIC, IDC_DELIMITER2_FONTSIZE_STATIC, IDC_DELIMITER2_BOLD_CHECK, IDC_DELIMITER2_ITALIC_CHECK, IDC_DELIMITER2_UNDERLINE_CHECK},\ + //{IDC_DELIMITER3_COLORSTYLEGROUP_STATIC, IDC_DELIMITER3_FG_STATIC, IDC_DELIMITER3_BG_STATIC, IDC_DELIMITER3_FONTSTYLEGROUP_STATIC, IDC_DELIMITER3_FONTNAME_STATIC, IDC_DELIMITER3_FONTSIZE_STATIC, IDC_DELIMITER3_BOLD_CHECK, IDC_DELIMITER3_ITALIC_CHECK, IDC_DELIMITER3_UNDERLINE_CHECK} }; - + int nbGpArray[nbDlg] = {nbGrpFolder, nbGrpKeywords, nbGrpComment, nbGrpOperator}; const char nodeNameArray[nbDlg][16] = {"Folder", "Keywords", "Comment", "Operator"}; diff --git a/PowerEditor/src/menuCmdID.h b/PowerEditor/src/menuCmdID.h index 9f5a975e..dd869295 100644 --- a/PowerEditor/src/menuCmdID.h +++ b/PowerEditor/src/menuCmdID.h @@ -195,7 +195,7 @@ #define IDM_VIEW_DRAWTABBAR_INACIVETAB (IDM_VIEW + 8) #define IDM_VIEW_POSTIT (IDM_VIEW + 9) #define IDM_VIEW_TOGGLE_FOLDALL (IDM_VIEW + 10) - #define IDM_VIEW_USER_DLG (IDM_VIEW + 11) + //#define IDM_VIEW_USER_DLG (IDM_VIEW + 11) #define IDM_VIEW_LINENUMBER (IDM_VIEW + 12) #define IDM_VIEW_SYMBOLMARGIN (IDM_VIEW + 13) #define IDM_VIEW_FOLDERMAGIN (IDM_VIEW + 14) @@ -401,6 +401,8 @@ #define IDM_LANG_USER (IDM_LANG + 80) //46080 #define IDM_LANG_USER_LIMIT (IDM_LANG + 110) //46110 + #define IDM_LANG_USER_DLG (IDM_LANG + 150) + #define IDM_ABOUT (IDM + 7000) diff --git a/scintilla/include/SciLexer.h b/scintilla/include/SciLexer.h index 06e3efe7..d4a8bd74 100644 --- a/scintilla/include/SciLexer.h +++ b/scintilla/include/SciLexer.h @@ -199,21 +199,96 @@ #define SCE_SEARCHRESULT_CURRENT_LINE 6 #define SCE_OBJC_DIRECTIVE 20 #define SCE_OBJC_QUALIFIER 21 -#define SCE_USER_DEFAULT 0 -#define SCE_USER_COMMENT 1 -#define SCE_USER_COMMENTLINE 2 -#define SCE_USER_NUMBER 4 -#define SCE_USER_WORD1 5 -#define SCE_USER_WORD2 6 -#define SCE_USER_WORD3 7 -#define SCE_USER_WORD4 8 -#define SCE_USER_OPERATOR 10 -#define SCE_USER_IDENTIFIER 11 -#define SCE_USER_BLOCK_OPERATOR_OPEN 12 -#define SCE_USER_BLOCK_OPERATOR_CLOSE 13 -#define SCE_USER_DELIMITER1 14 -#define SCE_USER_DELIMITER2 15 -#define SCE_USER_DELIMITER3 16 + +#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_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 +#define SCE_USER_STYLE_FOLDER_IN_CODE1 13 +#define SCE_USER_STYLE_FOLDER_IN_CODE2 14 +#define SCE_USER_STYLE_FOLDER_IN_COMMENT 15 +#define SCE_USER_STYLE_DELIMITER1 16 +#define SCE_USER_STYLE_DELIMITER2 17 +#define SCE_USER_STYLE_DELIMITER3 18 +#define SCE_USER_STYLE_DELIMITER4 19 +#define SCE_USER_STYLE_DELIMITER5 20 +#define SCE_USER_STYLE_DELIMITER6 21 +#define SCE_USER_STYLE_DELIMITER7 22 +#define SCE_USER_STYLE_DELIMITER8 23 +#define SCE_USER_STYLE_IDENTIFIER 24 +#define SCE_USER_STYLE_TOTAL_STYLES SCE_USER_STYLE_IDENTIFIER +#define SCE_USER_STYLE_MAPPER_TOTAL 17 + +#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 #define SCE_TCL_COMMENTLINE 2 diff --git a/scintilla/include/Scintilla.h b/scintilla/include/Scintilla.h index 334006ec..8b787d65 100644 --- a/scintilla/include/Scintilla.h +++ b/scintilla/include/Scintilla.h @@ -819,7 +819,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_GETLEXER 4002 #define SCI_COLOURISE 4003 #define SCI_SETPROPERTY 4004 -#define KEYWORDSET_MAX 8 +// #define KEYWORDSET_MAX 8 +#define KEYWORDSET_MAX 30 #define SCI_SETKEYWORDS 4005 #define SCI_SETLEXERLANGUAGE 4006 #define SCI_LOADLEXERLIBRARY 4007 diff --git a/scintilla/lexers/LexUser.cxx b/scintilla/lexers/LexUser.cxx index b16f9d75..a385d7a0 100644 --- a/scintilla/lexers/LexUser.cxx +++ b/scintilla/lexers/LexUser.cxx @@ -16,16 +16,17 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ----------------------------------------------------------------------------------------*/ -#include -#include -#include -#include -#include +// #include +#include +#include +#include +// #include +// #include +// #include #include #include #include "Platform.h" - #include "ILexer.h" #include "LexAccessor.h" #include "Accessor.h" @@ -35,507 +36,2164 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #include "SciLexer.h" #include "CharClassify.h" #include "LexerModule.h" +#include "PropSetSimple.h" +#include "SplitVector.h" +#include "Partitioning.h" +#include "RunStyles.h" +#include "CellBuffer.h" +// #include "PerLine.h" +#include "Decoration.h" +#include "Document.h" -#define KEYWORD_BOXHEADER 1 -#define KEYWORD_FOLDCONTRACTED 2 +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif +#define CL_CURRENT 0x1 +#define CL_PREV 0x2 +#define CL_PREVPREV 0x4 -static inline bool IsADigit(char ch) { - return isascii(ch) && isdigit(ch); -} +#define FOLD_NONE 0 +#define FOLD_OPEN 1 +#define FOLD_MIDDLE 2 +#define FOLD_CLOSE 3 -static inline bool isspacechar(unsigned char ch) { - return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d)); -} +#define COMMENTLINE_NO 0 +#define COMMENTLINE_YES 1 +#define COMMENTLINE_SKIP_TESTING 2 -static bool isInOpList(WordList & opList, char op) +#define NI_OPEN 0 +#define NI_CLOSE 1 + +#define NBR_DECIMAL 0 +#define NBR_EXTRA_CHAR 1 +#define NBR_RANGE_CHAR 2 +#define NBR_PREFIX_CHAR 3 +#define NBR_SUFFIX_CHAR 4 +#define NBR_WHITESPACE 5 +#define NBR_FOLLOWED_BY_FORWARD_KEYWORD 6 +#define NBR_NOT_A_NUMBER 7 + +#define NO_DELIMITER 0 +#define FORWARD_WHITESPACE_FOUND 1 +#define FORWARD_KEYWORD_FOUND 2 + +#define SC_ISCOMMENTLINE 0x8000 +#define MULTI_PART_LIMIT 100 + +#define MAPPER_TOTAL 15 +#define FW_VECTORS_TOTAL SCE_USER_TOTAL_DELIMITERS + 6 + +const int maskMapper[MAPPER_TOTAL] = { - for (int i = 0 ; i < opList.len ; i++) - if (op == *(opList.words[i])) - return true; - return false; -} + SCE_USER_MASK_NESTING_OPERATORS2, + SCE_USER_MASK_NESTING_FOLDERS_IN_CODE2_OPEN, + SCE_USER_MASK_NESTING_FOLDERS_IN_CODE2_MIDDLE, + SCE_USER_MASK_NESTING_FOLDERS_IN_CODE2_CLOSE, + SCE_USER_MASK_NESTING_FOLDERS_IN_COMMENT_OPEN, + SCE_USER_MASK_NESTING_FOLDERS_IN_COMMENT_MIDDLE, + SCE_USER_MASK_NESTING_FOLDERS_IN_COMMENT_CLOSE, + SCE_USER_MASK_NESTING_KEYWORD1, + SCE_USER_MASK_NESTING_KEYWORD2, + SCE_USER_MASK_NESTING_KEYWORD3, + SCE_USER_MASK_NESTING_KEYWORD4, + SCE_USER_MASK_NESTING_KEYWORD5, + SCE_USER_MASK_NESTING_KEYWORD6, + SCE_USER_MASK_NESTING_KEYWORD7, + SCE_USER_MASK_NESTING_KEYWORD8 +}; -static int cmpString(const void *a1, const void *a2) { - // Can't work out the correct incantation to use modern casts here - return strcmp(*(char**)(a1), *(char**)(a2)); -} - - -static bool isInList(WordList & list, const char *s, bool specialMode, bool ignoreCase) +const int styleMapper[MAPPER_TOTAL] = { - if (!list.words) - return false; + SCE_USER_STYLE_OPERATOR, + SCE_USER_STYLE_FOLDER_IN_CODE2, + SCE_USER_STYLE_FOLDER_IN_CODE2, + SCE_USER_STYLE_FOLDER_IN_CODE2, + SCE_USER_STYLE_FOLDER_IN_COMMENT, + SCE_USER_STYLE_FOLDER_IN_COMMENT, + SCE_USER_STYLE_FOLDER_IN_COMMENT, + SCE_USER_STYLE_KEYWORD1, + SCE_USER_STYLE_KEYWORD2, + SCE_USER_STYLE_KEYWORD3, + SCE_USER_STYLE_KEYWORD4, + SCE_USER_STYLE_KEYWORD5, + SCE_USER_STYLE_KEYWORD6, + SCE_USER_STYLE_KEYWORD7, + SCE_USER_STYLE_KEYWORD8 +}; - unsigned char firstChar = s[0]; - int j = list.starts[firstChar]; - - if (j >= 0) - { - while ((ignoreCase?toupper(list.words[j][0]):list.words[j][0]) == (ignoreCase?toupper(s[0]):s[0])) - { - if (!list.words[j][1]) - { - if (specialMode) - { - return true; - } - else - { - if (!s[1]) - return true; - } - } - int a1 = ignoreCase?toupper(list.words[j][1]):list.words[j][1]; - int b1 = ignoreCase?toupper(s[1]):s[1]; - if (a1 == b1) - { - - const char *a = list.words[j] + 1; - int An = ignoreCase?toupper((int)*a):(int)*a; - - const char *b = s + 1; - int Bn = ignoreCase?toupper((int)*b):(int)*b; - - - while (An && (An == Bn)) - { - a++; - An = ignoreCase?toupper((int)*a):(int)*a; - b++; - Bn = ignoreCase?toupper((int)*b):(int)*b; - } - if (specialMode) - { - if (!An) - return true; - } - else - { - if (!An && !Bn) - return true; - } - } - j++; - } - } - - if (ignoreCase) - { - // if the 1st char is not a letter, no need to test one more time - if (!isalpha(s[0])) - return false; - - firstChar = isupper(s[0])?tolower(s[0]):toupper(s[0]); - j = list.starts[firstChar]; - if (j >= 0) - { - while (toupper(list.words[j][0]) == toupper(s[0])) - { - if (!list.words[j][1]) - { - if (specialMode) - { - return true; - } - else - { - if (!s[1]) - return true; - } - } - int a1 = toupper(list.words[j][1]); - int b1 = toupper(s[1]); - if (a1 == b1) - { - const char *a = list.words[j] + 1; - int An = toupper((int)*a); - - const char *b = s + 1; - int Bn = toupper((int)*b); - - while (An && (An == Bn)) - { - a++; - An = toupper((int)*a); - b++; - Bn = toupper((int)*b); - } - if (specialMode) - { - if (!*a) - return true; - } - else - { - if (!*a && !*b) - return true; - } - } - j++; - } - } - } - - return false; -} -/* -static void getRange(unsigned int start, unsigned int end, Accessor &styler, char *s, unsigned int len) +const int foldingtMapper[MAPPER_TOTAL] = { - unsigned int i = 0; - while ((i < end - start + 1) && (i < len-1)) - { - s[i] = static_cast(styler[start + i]); - i++; - } - s[i] = '\0'; -} -*/ -static inline bool isAWordChar(const int ch) { - //return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_'); - return ((ch > 0x20) && (ch <= 0xFF) && (ch != ' ') && (ch != '\n')); + FOLD_NONE, + FOLD_OPEN, + FOLD_MIDDLE, + FOLD_CLOSE, + FOLD_OPEN, + FOLD_MIDDLE, + FOLD_CLOSE, + FOLD_NONE, + FOLD_NONE, + FOLD_NONE, + FOLD_NONE, + FOLD_NONE, + FOLD_NONE, + FOLD_NONE, + FOLD_NONE +}; + +using namespace std; +typedef vector> vvstring; + +// static vector * foldVectorStatic; // foldVectorStatic is used for debugging only, it should be commented out in production code ! + +struct forwardStruct +{ + vvstring * vec; + int sceID; + int maskID; + + forwardStruct(): vec(0), sceID(0), maskID(0) {}; // constructor, useless but obligatory + + forwardStruct * Set (vvstring * vec, int sceID, int maskID) { + this->vec = vec; + this->sceID = sceID; + this->maskID = maskID; + return this; + } + +}FWS; // just one instance + +struct nestedInfo { + unsigned int position; + int nestedLevel; + int index; + int state; + int opener; + + // constructor, useless but obligatory + nestedInfo():position(0), nestedLevel(0), index(0), state(0), opener(0) {}; + + nestedInfo * Set (unsigned int position, int nestedLevel, int index, int state, int opener) { + this->position = position; + this->nestedLevel = nestedLevel; + this->index = index; + this->state = state; + this->opener = opener; + return this; + } +}; +static nestedInfo NI; // also just one instance + +struct udlKeywordsMapStruct +{ + vvstring commentLineOpen, commentLineContinue, commentLineClose; + vvstring commentOpen, commentClose; + vvstring delim1Open, delim1Escape, delim1Close; + vvstring delim2Open, delim2Escape, delim2Close; + vvstring delim3Open, delim3Escape, delim3Close; + vvstring delim4Open, delim4Escape, delim4Close; + vvstring delim5Open, delim5Escape, delim5Close; + vvstring delim6Open, delim6Escape, delim6Close; + vvstring delim7Open, delim7Escape, delim7Close; + vvstring delim8Open, delim8Escape, delim8Close; + vvstring operators1; + vvstring foldersInCode1Open, foldersInCode1Middle, foldersInCode1Close; + vvstring foldersInCode2Open, foldersInCode2Middle, foldersInCode2Close; + vector suffixTokens; + vector prefixTokens; + vector negativePrefixTokens; + vector extrasInPrefixedTokens; + vector rangeTokens; +}; + +// key value is of type "int" so it could receive pointer value !! +// UDL name is defined as "const char *" in UserLangContainer class +// so, map will use pointer value (not value pointed to!) as the key +typedef map udlMapType; +static udlMapType udlKeywordsMap; + +// key value is of type "int" so it could receive pointer value !! +// currentBufferID is defined as "Buffer *" in ScintillaEditView class +// so, map will use pointer value (not value pointed to!) as the key +typedef map > nestedMapType; +static nestedMapType nestedMap; + +static inline bool isWhiteSpace(const int ch) +{ + return (ch > 0 && ch < 0x21); } -static inline bool isAWordStart(const int ch) { - return isAWordChar(ch); +static inline bool isWhiteSpace2(unsigned char ch, int & nlCount, unsigned char excludeNewLine=0, unsigned char chNext=0) +{ + // multi-part keywords come in two flavors: + // 1. "else if" (internally mapped to "else\vif") where '\v' can be replaced by spaces, tabs and new lines + // 2. 'else if" (internally mapped to "else\bif") where '\b' can be replaced by spaces, tabs but not new lines + // 'excludeNewLine' parameter is used to differentiate the two + + if ((ch == '\n') || (ch == '\r' && chNext != '\n')) + ++nlCount; + + if (excludeNewLine == '\b') + return (ch == ' ') || (ch == '\t'); + else + return isWhiteSpace(ch); } -static void ColouriseUserDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], - Accessor &styler) { +static bool isInListForward2(vvstring * fwEndVectors[], StyleContext & sc, bool ignoreCase, int forward) +{ + // forward check for multi-part keywords and numbers + // this is differnt from 'isInListForward' function because + // search for keyword is not performed at sc.currentPos but rather + // at some position forward of sc.currentPos - // It seems that there're only 9 keywordlists - WordList &keywords = *keywordlists[0]; - WordList &blockOpenWords = *keywordlists[1]; - WordList &blockCloseWords = *keywordlists[2]; - WordList &symbols = *keywordlists[3]; - WordList &comments = *keywordlists[4]; - WordList &keywords5 = *keywordlists[5]; - WordList &keywords6 = *keywordlists[6]; - WordList &keywords7 = *keywordlists[7]; - WordList &keywords8 = *keywordlists[8]; - //WordList &keywords9 = *keywordlists[9]; - //WordList &keywords10 = *keywordlists[10]; + vvstring::iterator iter1;// = openVector.begin(); + vector::iterator iter2; + string::iterator iter3; + int index = 0; + int a = 0; + int b = 0; - int chPrevNonWhite = ' '; - int visibleChars = 0; + for (int i=0; iempty()) + { + // vvstring::iterator iter1 = fwEndVectors[i].begin(); + // vector::iterator iter2; + // string::iterator iter3; + index = 0; + a = 0; + b = 0; - bool isCaseIgnored = styler.GetPropertyInt("userDefine.ignoreCase", 0) != 0; - bool isCommentLineSymbol = styler.GetPropertyInt("userDefine.commentLineSymbol", 0) != 0; - bool isCommentSymbol = styler.GetPropertyInt("userDefine.commentSymbol", 0) != 0; - - bool doPrefix4G1 = styler.GetPropertyInt("userDefine.g1Prefix", 0) != 0; - bool doPrefix4G2 = styler.GetPropertyInt("userDefine.g2Prefix", 0) != 0; - bool doPrefix4G3 = styler.GetPropertyInt("userDefine.g3Prefix", 0) != 0; - bool doPrefix4G4 = styler.GetPropertyInt("userDefine.g4Prefix", 0) != 0; - - char delimOpen[3]; - char delimClose[3]; - bool escaped = false; - char escapeChar = static_cast(styler.GetPropertyInt("userDefine.escapeChar", 0)); - - bool hasDot = false; - bool hasExp = false; - - for (int i = 0 ; i < 3 ; i++) - { - delimOpen[i] = keywords.words[0][i] == '0'?'\0':keywords.words[0][i]; - delimClose[i] = keywords.words[0][i+3] == '0'?'\0':keywords.words[0][i+3]; - } - - StyleContext sc(startPos, length, initStyle, styler); - - for (; sc.More(); sc.Forward()) - { - // Determine if the current state should terminate. - switch (sc.state) - { - case SCE_USER_NUMBER : - { - if (sc.ch == '.') - { - if (!hasDot) - { - hasDot = true; - break; - } - } - //if (!isAWordChar(sc.ch)) - if (sc.ch == 'e' || sc.ch == 'E') - { - if (!hasExp && sc.More()) - { - hasExp = true; - sc.Forward(); - if (IsADigit(sc.ch)) break; - if (sc.More()) - if (sc.ch == '+' || sc.ch == '-') - { - sc.Forward(); - if (IsADigit(sc.ch)) break; - } - } - } - if (!IsADigit(sc.ch)) - { - sc.SetState(SCE_USER_DEFAULT); - hasDot = false; - hasExp = false; - } - break; - } - - case SCE_USER_DELIMITER1 : - { - if (sc.ch == escapeChar) - escaped = !escaped; - else - { - if (delimClose[0] && (sc.ch == delimClose[0]) && !escaped) - sc.ForwardSetState(SCE_USER_DEFAULT); - escaped = false; + for (iter1 = fwEndVectors[i]->begin(); iter1 != fwEndVectors[i]->end(); ++iter1) + { + iter2 = iter1->begin(); + for (; iter2 != iter1->end(); ++iter2) + { + iter3 = iter2->begin(); + index = 0; + for (; ; ++iter3) + { + a = ignoreCase?toupper(*iter3):*iter3; + b = ignoreCase?toupper(sc.GetRelative(forward + index++)):sc.GetRelative(forward + index++); + if (a != b) + break; + if (iter3 != iter2->end()) + return true; + } } - break; - } - - case SCE_USER_DELIMITER2 : - { - if (sc.ch == escapeChar) - escaped = !escaped; - else - { - if (delimClose[0] && (sc.ch == delimClose[1]) && !escaped) - sc.ForwardSetState(SCE_USER_DEFAULT); - escaped = false; - } - break; - } - - case SCE_USER_DELIMITER3 : - { - if (sc.ch == escapeChar) - escaped = !escaped; - else - { - if (delimClose[0] && (sc.ch == delimClose[2]) && !escaped) - sc.ForwardSetState(SCE_USER_DEFAULT); - escaped = false; - } - break; - } - - case SCE_USER_IDENTIFIER : - { - bool isSymbol = isInOpList(symbols, sc.ch); - - if (!isAWordChar(sc.ch) || isSymbol) - { - bool doDefault = true; - const int tokenLen = 100; - char s[tokenLen]; - sc.GetCurrent(s, sizeof(s)); - char commentLineStr[tokenLen+10] = "0"; - char *p = commentLineStr+1; - strcpy(p, s); - char commentOpen[tokenLen+10] = "1"; - p = commentOpen+1; - strcpy(p, s); - - if (isInList(keywords5, s, doPrefix4G1, isCaseIgnored)) - sc.ChangeState(SCE_USER_WORD1); - else if (isInList(keywords6, s, doPrefix4G2, isCaseIgnored)) - sc.ChangeState(SCE_USER_WORD2); - else if (isInList(keywords7, s, doPrefix4G3, isCaseIgnored)) - sc.ChangeState(SCE_USER_WORD3); - else if (isInList(keywords8, s, doPrefix4G4, isCaseIgnored)) - sc.ChangeState(SCE_USER_WORD4); - - //else if (blockOpenWords.InList(s)) - else if (isInList(blockOpenWords, s, false, isCaseIgnored)) - sc.ChangeState(SCE_USER_BLOCK_OPERATOR_OPEN); - //else if (blockCloseWords.InList(s)) - else if (isInList(blockCloseWords, s, false, isCaseIgnored)) - sc.ChangeState(SCE_USER_BLOCK_OPERATOR_CLOSE); - else if (isInList(comments,commentLineStr, isCommentLineSymbol, isCaseIgnored)) - { - sc.ChangeState(SCE_USER_COMMENTLINE); - doDefault = false; - } - else if (isInList(comments, commentOpen, isCommentSymbol, isCaseIgnored)) - { - sc.ChangeState(SCE_USER_COMMENT); - doDefault = false; - } - if (doDefault) - sc.SetState(SCE_USER_DEFAULT); - } - break; - } - - case SCE_USER_COMMENT : - { - char *pCommentClose = NULL; - for (int i = 0 ; i < comments.len ; i++) - { - if (comments.words[i][0] == '2') - { - pCommentClose = comments.words[i] + 1; - break; - } - } - if (pCommentClose) - { - int len = strlen(pCommentClose); - if (len == 1) - { - if (sc.Match(pCommentClose[0])) - { - sc.Forward(); - sc.SetState(SCE_USER_DEFAULT); - } - } - else - { - if (sc.Match(pCommentClose)) - { - for (int i = 0 ; i < len ; i++) - sc.Forward(); - sc.SetState(SCE_USER_DEFAULT); - } - } - } - break; - } - - case SCE_USER_COMMENTLINE : - { - if (sc.atLineEnd) - { - sc.SetState(SCE_USER_DEFAULT); - visibleChars = 0; - } - break; - } - - case SCE_USER_OPERATOR : - { - sc.SetState(SCE_USER_DEFAULT); - break; - } - - default : - break; - } - - // Determine if a new state should be entered. - if (sc.state == SCE_USER_DEFAULT) - { - //char aSymbol[2] = {sc.ch, '\0'}; - - if (IsADigit(sc.ch)) - sc.SetState(SCE_USER_NUMBER); - //else if (symbols.InList(aSymbol)) - else if (delimOpen[0] && (sc.ch == delimOpen[0])) - { - escaped = false; - sc.SetState(SCE_USER_DELIMITER1); } - else if (delimOpen[0] && (sc.ch == delimOpen[1])) - { - escaped = false; - sc.SetState(SCE_USER_DELIMITER2); - } - else if (delimOpen[0] && (sc.ch == delimOpen[2])) - { - escaped = false; - sc.SetState(SCE_USER_DELIMITER3); - } - else if (isInOpList(symbols, sc.ch)) - sc.SetState(SCE_USER_OPERATOR); - else if (sc.ch == '-' && IsADigit(sc.chNext)) - sc.SetState(SCE_USER_NUMBER); - else if (sc.ch == '.' && IsADigit(sc.chNext)) - { - hasDot = true; - sc.SetState(SCE_USER_NUMBER); - } - else if (isAWordStart(sc.ch)) - sc.SetState(SCE_USER_IDENTIFIER); - } - - if (sc.atLineEnd) - { - // Reset states to begining of colourise so no surprises - // if different sets of lines lexed. - if (sc.state == SCE_USER_COMMENTLINE) - sc.SetState(SCE_USER_DEFAULT); - - chPrevNonWhite = ' '; - visibleChars = 0; - } - if (!isspacechar(sc.ch)) { - chPrevNonWhite = sc.ch; - visibleChars++; - } - - } - sc.Complete(); + } + } + return false; } - -static void FoldUserDoc(unsigned int startPos, int length, int initStyle, WordList *[], Accessor &styler) +static inline bool IsADigit(char ch) { - unsigned int endPos = startPos + length; - int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); - int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; - int levelCurrent = levelPrev; - char chNext = styler[startPos]; - int styleNext = styler.StyleAt(startPos); - int style = initStyle; - - for (unsigned int i = startPos; i < endPos; i++) - { - char ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - int stylePrev = style; - style = styleNext; - styleNext = styler.StyleAt(i + 1); - bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); - - if (stylePrev != SCE_USER_BLOCK_OPERATOR_OPEN && style == SCE_USER_BLOCK_OPERATOR_OPEN) - { - levelCurrent++; - } - - if (stylePrev != SCE_USER_BLOCK_OPERATOR_CLOSE && style == SCE_USER_BLOCK_OPERATOR_CLOSE) - { - levelCurrent--; - } - - if (atEOL) - { - int lev = levelPrev; - - if ((levelCurrent > levelPrev) && (visibleChars > 0)) - lev |= SC_FOLDLEVELHEADERFLAG; - if (lev != styler.LevelAt(lineCurrent)) - { - styler.SetLevel(lineCurrent, lev); - } - lineCurrent++; - levelPrev = levelCurrent; - visibleChars = 0; - } - if (!isspacechar(ch)) - visibleChars++; - } - // Fill in the real level of the next line, keeping the current flags as they will be filled in later - int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; - styler.SetLevel(lineCurrent, levelPrev | flagsNext); + return isascii(ch) && isdigit(ch); } +static inline int isADigit(StyleContext & sc, bool ignoreCase, vector & rangeTokens, bool hasPrefix, + vector & extrasInPrefixedTokens, vector & prefixTokens, + vector & suffixTokens, int & moveForward, char & chNext, vvstring * fwEndVectors[]) +{ + moveForward = 0; + chNext = 0; + vector::iterator iter; + if (hasPrefix) + { + iter = extrasInPrefixedTokens.begin(); + for (; iter != extrasInPrefixedTokens.end(); ++iter) + if (ignoreCase ? sc.MatchIgnoreCase2(iter->c_str()) : sc.Match(iter->c_str())) + return NBR_EXTRA_CHAR; + } + + iter = rangeTokens.begin(); + for (; iter != rangeTokens.end(); ++iter) + { + if (ignoreCase ? sc.MatchIgnoreCase2(iter->c_str()) : sc.Match(iter->c_str())) + { + moveForward = iter->length(); + chNext = sc.GetRelative(moveForward); + return NBR_RANGE_CHAR; + } + } + + iter = suffixTokens.begin(); + for (; iter != suffixTokens.end(); ++iter) + { + if (ignoreCase ? sc.MatchIgnoreCase2(iter->c_str()) : sc.Match(iter->c_str())) + { + moveForward = iter->length(); + chNext = sc.GetRelative(moveForward); + return NBR_SUFFIX_CHAR; + } + } + + iter = prefixTokens.begin(); + for (; iter != prefixTokens.end(); ++iter) + { + if (ignoreCase ? sc.MatchIgnoreCase2(iter->c_str()) : sc.Match(iter->c_str())) + { + moveForward = iter->length(); + chNext = sc.GetRelative(moveForward); + return NBR_PREFIX_CHAR; + } + } + + if (true == isInListForward2(fwEndVectors, sc, ignoreCase, 0)) + return NBR_FOLLOWED_BY_FORWARD_KEYWORD; + + if (IsADigit(sc.ch)) + return NBR_DECIMAL; + + if (true == isWhiteSpace(sc.ch)) + return NBR_WHITESPACE; + + return NBR_NOT_A_NUMBER; +} + +static bool IsNumber(vector & prefixTokens, vector & negativePrefixTokens, + StyleContext & sc, bool ignoreCase, bool & hasPrefix, bool & dontMove, bool & hasDot) +{ + // is it a prefixed number? + vector::iterator iter = prefixTokens.begin(); + vector::iterator last = prefixTokens.end(); + if (sc.ch == '-') + { + iter = negativePrefixTokens.begin(); + last = negativePrefixTokens.end(); + } + for (; iter != last; ++iter) + { + if (ignoreCase?sc.MatchIgnoreCase2(iter->c_str()) : sc.Match(iter->c_str())) + break; + } + if (iter != last) + { + sc.SetState(SCE_USER_STYLE_NUMBER); + // prefix is styled as number only if followed by an actual number + // sc.ChangeState(SCE_USER_STYLE_NUMBER); + sc.Forward(iter->length()); + hasPrefix = true; + dontMove = true; + return true; + } + + // or is it a simple digit? + if (IsADigit(sc.ch) || ((sc.ch == '-' || sc.ch == '+') && IsADigit(sc.chNext) && !IsADigit(sc.chPrev))) + { + sc.SetState(SCE_USER_STYLE_NUMBER); + hasPrefix = true; // prefix in the middle is an error case, treat any number as it it had a prefix + return true; + } + else if (sc.ch == '.' && IsADigit(sc.chNext)) + { + sc.SetState(SCE_USER_STYLE_NUMBER); + hasPrefix = true; + hasDot = true; + return true; + } + + return false; +} + +static inline void SubGroup(const char * s, vvstring & vec, bool group=false) +{ + unsigned int length = strlen(s); + char * temp = new char[length+1]; + unsigned int index = 0; + vector subvector; + unsigned int i = 0; + + for (unsigned int j=0; j 0) i += 1; // skip space + i += 2; // skip prefix + copy = true; + + if (s[i] == ' ') + continue; + + if (s[i] == '(' && s[i+1] == '(') + inGroup = true; + } + + if (inGroup && s[i] == ')' && s[i+1] == ')') + inGroup = false; + + if (copy) + temp[index++] = s[i]; + } + + if (length) + SubGroup(temp, vec, inGroup); + + vector emptyVector; + for (int i = vec.size(); i < minLength; ++i) + { + vec.push_back(emptyVector); + } + + delete [] temp; +} + +static inline void StringToVector(char * original, vector & tokenVector, bool negative=false) +{ + // this is rarely used, so I chose std::string for simplicity reasons + // for better performance C-strings could be used + + string temp = ""; + char * pch = original; + while (*pch != NULL) + { + if (*pch != ' ') + temp += *pch; // + else if (temp.size() > 0) + { + if (negative) + tokenVector.push_back("-" + temp); + else + tokenVector.push_back(temp); + + temp = ""; + } + ++pch; + } + + if (temp.size() > 0) + { + if (negative) + tokenVector.push_back("-" + temp); + else + tokenVector.push_back(temp); + } +} + +static inline void ReColoringCheck(unsigned int & startPos, unsigned int & nestedLevel, int & initStyle, int & openIndex, + int & isCommentLine, bool & isInComment, Accessor & styler, vector & lastNestedGroup, + vector & nestedVector, /* vector & foldVector, */ int & continueCommentBlock) +{ + // re-coloring always starts at line beginning !! + + // special exception for multipart keywords + initStyle = styler.StyleAt(startPos-1); // check style of previous new line character + if ( (initStyle >= SCE_USER_STYLE_KEYWORD1 && initStyle < (SCE_USER_STYLE_KEYWORD1+SCE_USER_TOTAL_KEYWORD_GROUPS)) // keywords1-8 + || initStyle == SCE_USER_STYLE_FOLDER_IN_COMMENT + || initStyle == SCE_USER_STYLE_FOLDER_IN_CODE2 ) + { + // we are in middle of multi-part keyword that contains newline characters, go back until current style ends + while (startPos >= 0 && styler.StyleAt(--startPos) == initStyle); + } + + if (static_cast(startPos) < 0) + startPos = 0; + + if (startPos > 0) + { + // go back until first EOL char + char ch = 0; + do + { + ch = styler.SafeGetCharAt(--startPos); + if (startPos == -1) + startPos = 0; + } + while(ch != '\r' && ch != '\n' && startPos > 0); + if (startPos > 0) + startPos += 1; // compensate for decrement operation + } + + if (startPos == 0) + { + // foldVector.clear(); + nestedVector.clear(); + lastNestedGroup.clear(); + initStyle = SCE_USER_STYLE_IDENTIFIER; + return; + } + + // clear all data on positions forward of 'startPos' as we + // are about to re-color that part of the document. + vector::iterator iter = nestedVector.begin(); + for (; iter != nestedVector.end(); ++iter) + { + if (iter->position >= startPos) + { + nestedVector.erase(iter, nestedVector.end()); + break; + } + } + + if (!nestedVector.empty()) + { + // go back to last nesting level '1' (or beginning of vector if no level '1' is found) + iter = --nestedVector.end(); + lastNestedGroup.clear(); + while (iter->nestedLevel > 1 && iter != nestedVector.begin()) + --iter; + } + else + { + iter = nestedVector.end(); + } + + // recreate lastNestedGroup, skip adjecent OPEN/CLOSE pairs + // nesting group is something like: + // "first delimiter 'nested delimiter 1 /*nested delimiter 2*/ delimiter 1 again' first delimiter again" + // if user is editing somewhere inside this group, than 'lastNestedGroup' provides info about nesting + // this is much more convinient that trying to obtain the same info from 'nestedVector' + vector::iterator last; + while (iter != nestedVector.end()) + { + if (iter->opener == NI_OPEN) + lastNestedGroup.push_back(*iter); + else if (iter->opener == NI_CLOSE && !lastNestedGroup.empty()) + { + last = --lastNestedGroup.end(); + if (last->opener == NI_OPEN) + if (last->nestedLevel == iter->nestedLevel) + if (last->state == iter->state) + if (last->index == iter->index) + lastNestedGroup.erase(last); + } + ++iter; + } + + if (!lastNestedGroup.empty()) + { + last = --lastNestedGroup.end(); + initStyle = last->state; + openIndex = last->index; + nestedLevel = last->nestedLevel; + + // are we nested somewhere in comment? + for (; ; --last) + { + if (last->state == SCE_USER_STYLE_COMMENT) + { + isInComment = true; + isCommentLine = COMMENTLINE_YES; + } + if (last->state == SCE_USER_STYLE_COMMENTLINE) + { + isCommentLine = COMMENTLINE_YES; + } + if (last == lastNestedGroup.begin()) + break; + } + } + else + { + initStyle = SCE_USER_STYLE_IDENTIFIER; + openIndex = -1; + nestedLevel = 0; + } + + // are we in fold block of comment lines? + int lineCurrent = styler.GetLine(startPos); + + if ((styler.LevelAt(lineCurrent) & SC_ISCOMMENTLINE) != 0) + continueCommentBlock |= CL_CURRENT; + + if (lineCurrent >= 1) + if ((styler.LevelAt(lineCurrent - 1) & SC_ISCOMMENTLINE) != 0) + continueCommentBlock |= CL_PREV; + + if (lineCurrent >= 2) + if ((styler.LevelAt(lineCurrent - 2) & SC_ISCOMMENTLINE) != 0) + if (continueCommentBlock & CL_PREV) + continueCommentBlock |= CL_PREVPREV; + + // foldVector.erase(foldVector.begin() + lineCurrent, foldVector.end()); +} + +static bool isInListForward(vvstring & openVector, StyleContext & sc, bool ignoreCase, int & openIndex, int & skipForward) +{ + // forward check for standard (sigle part) keywords + + skipForward = 0; + vector>::iterator iter1 = openVector.begin(); + vector::iterator iter2; + + for (; iter1 != openVector.end(); ++iter1) + { + iter2 = iter1->begin(); + for (; iter2 != iter1->end(); ++iter2) + { + if (ignoreCase?sc.MatchIgnoreCase2(iter2->c_str()):sc.Match(iter2->c_str())) + { + openIndex = iter1 - openVector.begin(); + skipForward = iter2->length(); + return true; + } + } + } + + return false; +} + +static bool isInListBackward(WordList & list, StyleContext & sc, bool specialMode, bool ignoreCase, + int & moveForward, vvstring * fwEndVectors[], int & nlCount, unsigned int docLength) +{ + // backward search + // this function compares last identified 'word' (text surrounded by spaces or other forward keywords) + // with all keywords within 'WordList' object + + // 'isInListBackward' can search for multi-part keywords too. Such keywords have variable length, + // in case 'isInListBackward' finds such keywords it will set 'moveForward' parameter so algorythm could adjust position + + if (!list.words) + return false; + + moveForward = 0; + + int offset = -1 * sc.LengthCurrent(); // length of 'word' that needs to be investigated + unsigned char a = 0; // iterator for user defined keywords + unsigned char b = 0; // iterator for text in the file + unsigned char bNext = 0; + unsigned char wsChar = 0; + unsigned char firstChar = sc.GetRelative(offset); + int fwDelimiterFound = NO_DELIMITER; + int nlCountTemp = 0; + int indexa = 0; + int indexb = 0; + int i = list.starts[firstChar]; + bool doUpperLoop = ignoreCase; + + if (ignoreCase) + { + i = list.starts[tolower(firstChar)]; + if (i == -1) + { + i = list.starts[toupper(firstChar)]; + if (i == -1) + return false; + + doUpperLoop = false; + } + } + + while (i >= 0) + { + while (static_cast(ignoreCase?toupper(list.words[i][0]):list.words[i][0]) == (ignoreCase?toupper(firstChar):firstChar)) + { + a = 0; + b = 0; + bNext = 0; + indexa = 0; + indexb = 0; + wsChar = 0; + fwDelimiterFound = NO_DELIMITER; + + do + { + a = static_cast(ignoreCase?toupper(list.words[i][indexa++]):list.words[i][indexa++]); + if (a == '\v' || a == '\b') + { + wsChar = a; + b = sc.GetRelative(offset + indexb++); + bNext = sc.GetRelative(offset + indexb); + if (isWhiteSpace2(b, nlCountTemp, wsChar, bNext)) + { + do { + b = sc.GetRelative(offset + indexb++); + bNext = sc.GetRelative(offset + indexb); + } + while((sc.currentPos + offset + indexb) <= docLength && isWhiteSpace2(b, nlCountTemp, wsChar, bNext)); + + a = static_cast(ignoreCase?toupper(list.words[i][indexa++]):list.words[i][indexa++]); + } + } + else + b = ignoreCase?toupper(sc.GetRelative(offset + indexb++)):sc.GetRelative(offset + indexb++); + } + while (a && (a == b)); + + if (!a) + { + --indexb; // decrement indexb to compensate for comparing with '\0' in previous loop + if (wsChar) + { + // multi-part keyword is found, + // but it must be followed by whitespace (or 'forward' keyword) + // otherwise "else if" might wrongly match "else iff" + bNext = sc.GetRelative(indexb + offset + 1); + if (isWhiteSpace2(b, nlCountTemp, wsChar, bNext)) + fwDelimiterFound = FORWARD_WHITESPACE_FOUND; + + if (fwDelimiterFound == NO_DELIMITER) + { + if (isInListForward2(fwEndVectors, sc, ignoreCase, indexb + offset)) + { + fwDelimiterFound = FORWARD_KEYWORD_FOUND; + } + } + + // special case when multi-part keywords have 'prefix' option enabled + // then the next word in the text file must be treated as part of multi-part keyword + // e.g. prefixed "else if" matches "else if nextWord", but not "else iffy" + if (specialMode) + { + if (fwDelimiterFound == FORWARD_WHITESPACE_FOUND) // there must be a white space !! + { + // skip whitespace (all of it) + int savedPosition = indexb; // return here if whitespace is not followed by another word + for (;;) + { + if ((sc.currentPos + offset + indexb) > docLength) + break; + if (!isWhiteSpace2(sc.GetRelative(offset + indexb), nlCountTemp, wsChar, sc.GetRelative(offset + indexb + 1))) + break; + ++indexb; + } + + // skip next "word" (if next word is not found, go back to end of multi-part keyword) + // it is not necessary to check EOF position here, because sc.GetRelative returns ' ' beyond EOF + bool nextWordFound = false; + while (!isWhiteSpace2(sc.GetRelative(indexb + offset), nlCountTemp, wsChar, sc.GetRelative(offset + indexb + 1))) + { + if (isInListForward2(fwEndVectors, sc, ignoreCase, indexb + offset)) + { + break; + } + ++indexb; + nextWordFound = true; + } + if (nextWordFound == false) + indexb = savedPosition; + } + } + } + // keyword is read fully, decide if we can leave this function + nlCount += nlCountTemp; + moveForward = indexb + offset; // offset is already negative + + if (wsChar) + { + if (fwDelimiterFound != NO_DELIMITER) + return true; // multi part keyword found + } + else if (moveForward == 0) + return true; // single part keyword found + else if (specialMode) + return true; // prefixed single part keyword found + } + nlCountTemp = 0; + ++i; + } + // run one more time for capital letter version + if (doUpperLoop) + { + i = list.starts[toupper(firstChar)]; + doUpperLoop = false; + } + else + break; + } + + return false; +} + +static void setBackwards(WordList * kwLists[], StyleContext & sc, bool prefixes[], bool ignoreCase, + int nestedKey, vvstring * fwEndVectors[], int & levelMinCurrent, + int & levelNext, int & nlCount, bool & dontMove, unsigned int docLength) +{ + if (sc.LengthCurrent() == 0) + return; + + int folding = FOLD_NONE; + int moveForward = 0; + + for (int i=0; i<=MAPPER_TOTAL; ++i) + { + if (nestedKey & maskMapper[i]) + { + if (isInListBackward(*kwLists[i], sc, prefixes[i], ignoreCase, moveForward, fwEndVectors, nlCount, docLength)) + { + folding = foldingtMapper[i]; + if (moveForward > 0) + { + sc.Forward(moveForward); + dontMove = true; + } + sc.ChangeState(styleMapper[i]); + break; + } + } + } + + if (folding == FOLD_MIDDLE) + { + // treat middle point as a sequence of: FOLD_CLOSE followed by FOLD_OPEN + levelNext--; + folding = FOLD_OPEN; + } + + if (folding == FOLD_OPEN) + { + if (levelMinCurrent > levelNext) + levelMinCurrent = levelNext; + levelNext++; + } + else if (folding == FOLD_CLOSE) + { + levelNext--; + } +} + +static bool isInListNested(int nestedKey, vector & forwards, StyleContext & sc, + bool ignoreCase, int & openIndex, int & skipForward, int & newState, bool lineCommentAtBOL ) +{ + // check if some other delimiter is nested within current delimiter + // all delimiters are freely checked but line comments must be synched with property 'lineCommentAtBOL' + + int backup = openIndex; + vector::iterator iter = forwards.begin(); + + for (; iter != forwards.end(); ++iter) + { + if (nestedKey & iter->maskID) + { + if ((iter->maskID != SCE_USER_MASK_NESTING_COMMENT_LINE) || + (iter->maskID == SCE_USER_MASK_NESTING_COMMENT_LINE && !(lineCommentAtBOL && !sc.atLineStart))) + { + if (isInListForward(*(iter->vec), sc, ignoreCase, openIndex, skipForward)) + { + newState = iter->sceID; + return true; + } + } + } + } + + openIndex = backup; + return false; +} + +static void readLastNested(vector & lastNestedGroup, int & newState, int & openIndex) +{ + // after delimiter ends we need to determine whether we are entering some other delimiter (in case of nesting) + // or do we simply start over from default style. + + newState = SCE_USER_STYLE_IDENTIFIER; + openIndex = -1; + if (!lastNestedGroup.empty()) + { + lastNestedGroup.erase(lastNestedGroup.end()-1); + if (!lastNestedGroup.empty()) + { + newState = (--lastNestedGroup.end())->state; + openIndex = (--lastNestedGroup.end())->index; + } + } +} + +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 prefixes[MAPPER_TOTAL]; + + for (int i=0; i>) objects is expensive, + // therefore these objects are created only at beginning of file, and saved to + // global std::map objects udlKeywordsMap and nestedMap + + int currentBufferID = styler.GetPropertyInt("userDefine.currentBufferID", 0); + if (nestedMap.find(currentBufferID) == nestedMap.end()) + { + nestedMap[currentBufferID] = vector(); + } + vector & nestedVector = nestedMap[currentBufferID]; + + int sUdlName = styler.GetPropertyInt("userDefine.udlName", 0); + if (udlKeywordsMap.find(sUdlName) == udlKeywordsMap.end()) + { + udlKeywordsMap[sUdlName] = udlKeywordsMapStruct(); + } + + vvstring & commentLineOpen = udlKeywordsMap[sUdlName].commentLineOpen; + vvstring & commentLineContinue = udlKeywordsMap[sUdlName].commentLineContinue; + vvstring & commentLineClose = udlKeywordsMap[sUdlName].commentLineClose; + vvstring & commentOpen = udlKeywordsMap[sUdlName].commentOpen; + vvstring & commentClose = udlKeywordsMap[sUdlName].commentClose; + vvstring & delim1Open = udlKeywordsMap[sUdlName].delim1Open; + vvstring & delim1Escape = udlKeywordsMap[sUdlName].delim1Escape; + vvstring & delim1Close = udlKeywordsMap[sUdlName].delim1Close; + vvstring & delim2Open = udlKeywordsMap[sUdlName].delim2Open; + vvstring & delim2Escape = udlKeywordsMap[sUdlName].delim2Escape; + vvstring & delim2Close = udlKeywordsMap[sUdlName].delim2Close; + vvstring & delim3Open = udlKeywordsMap[sUdlName].delim3Open; + vvstring & delim3Escape = udlKeywordsMap[sUdlName].delim3Escape; + vvstring & delim3Close = udlKeywordsMap[sUdlName].delim3Close; + vvstring & delim4Open = udlKeywordsMap[sUdlName].delim4Open; + vvstring & delim4Escape = udlKeywordsMap[sUdlName].delim4Escape; + vvstring & delim4Close = udlKeywordsMap[sUdlName].delim4Close; + vvstring & delim5Open = udlKeywordsMap[sUdlName].delim5Open; + vvstring & delim5Escape = udlKeywordsMap[sUdlName].delim5Escape; + vvstring & delim5Close = udlKeywordsMap[sUdlName].delim5Close; + vvstring & delim6Open = udlKeywordsMap[sUdlName].delim6Open; + vvstring & delim6Escape = udlKeywordsMap[sUdlName].delim6Escape; + vvstring & delim6Close = udlKeywordsMap[sUdlName].delim6Close; + vvstring & delim7Open = udlKeywordsMap[sUdlName].delim7Open; + vvstring & delim7Escape = udlKeywordsMap[sUdlName].delim7Escape; + vvstring & delim7Close = udlKeywordsMap[sUdlName].delim7Close; + vvstring & delim8Open = udlKeywordsMap[sUdlName].delim8Open; + vvstring & delim8Escape = udlKeywordsMap[sUdlName].delim8Escape; + vvstring & delim8Close = udlKeywordsMap[sUdlName].delim8Close; + vvstring & operators1 = udlKeywordsMap[sUdlName].operators1; + vvstring & foldersInCode1Open = udlKeywordsMap[sUdlName].foldersInCode1Open; + vvstring & foldersInCode1Middle = udlKeywordsMap[sUdlName].foldersInCode1Middle; + vvstring & foldersInCode1Close = udlKeywordsMap[sUdlName].foldersInCode1Close; + + vector & extrasInPrefixedTokens = udlKeywordsMap[sUdlName].extrasInPrefixedTokens; + vector & rangeTokens = udlKeywordsMap[sUdlName].rangeTokens; + vector & negativePrefixTokens = udlKeywordsMap[sUdlName].negativePrefixTokens; + vector & prefixTokens = udlKeywordsMap[sUdlName].prefixTokens; + vector & suffixTokens = udlKeywordsMap[sUdlName].suffixTokens; + + if (startPos == 0) + { + // in keyword list objects, put longer multi-part string first, + // e.g. "else if" should go in front of "else" + bool equal = true; + bool isMultiPart = false; + bool switchPerformed = true; + + while (switchPerformed) + { + switchPerformed = false; + for (int i=0; ilen; ++j) // for each keyword within object + { + equal = true; + int z = 0; + for (; kwLists[i]->words[j][z]; ++z) // for each letter within keyword + { + if (kwLists[i]->words[j+1][z] == '\v' || kwLists[i]->words[j+1][z] == '\b') + isMultiPart = true; + + if (kwLists[i]->words[j][z] != kwLists[i]->words[j+1][z]) + { + equal = false; + break; + } + } + if (!isMultiPart) // is next word multi part keyword? + { + for (int k=0; kwLists[i]->words[j+1][k]; ++k) + { + if (kwLists[i]->words[j+1][k] == '\v' || kwLists[i]->words[j+1][k] == '\b') + { + isMultiPart = true; + break; + } + } + } + + if (equal && isMultiPart && kwLists[i]->words[j+1][z]) // perform switch only if next word is longer ! + { + char * temp = kwLists[i]->words[j]; + kwLists[i]->words[j] = kwLists[i]->words[j+1]; + kwLists[i]->words[j+1] = temp; + switchPerformed = true; + } + } + } + } + + // if this is BOF, re-generate stuff in global map objects (udlKeywordsMap and nestedMap) + const char * sFoldersInCode1Open = styler.pprops->Get("userDefine.foldersInCode1Open"); + const char * sFoldersInCode1Middle = styler.pprops->Get("userDefine.foldersInCode1Middle"); + const char * sFoldersInCode1Close = styler.pprops->Get("userDefine.foldersInCode1Close"); + + const char * sDelimiters = styler.pprops->Get("userDefine.delimiters"); + const char * sOperators1 = styler.pprops->Get("userDefine.operators1"); + const char * sComments = styler.pprops->Get("userDefine.comments"); + + // 'GenerateVector' converts strings into vvstring objects + GenerateVector(commentLineOpen, sComments, TEXT("00"), 0); + GenerateVector(commentLineContinue, sComments, TEXT("01"), commentLineOpen.size()); + GenerateVector(commentLineClose, sComments, TEXT("02"), commentLineOpen.size()); + GenerateVector(commentOpen, sComments, TEXT("03"), 0); + GenerateVector(commentClose, sComments, TEXT("04"), commentOpen.size()); + + GenerateVector(delim1Open, sDelimiters, TEXT("00"), 0); + GenerateVector(delim1Escape, sDelimiters, TEXT("01"), delim1Open.size()); + GenerateVector(delim1Close, sDelimiters, TEXT("02"), delim1Open.size()); + GenerateVector(delim2Open, sDelimiters, TEXT("03"), 0); + GenerateVector(delim2Escape, sDelimiters, TEXT("04"), delim2Open.size()); + GenerateVector(delim2Close, sDelimiters, TEXT("05"), delim2Open.size()); + GenerateVector(delim3Open, sDelimiters, TEXT("06"), 0); + GenerateVector(delim3Escape, sDelimiters, TEXT("07"), delim3Open.size()); + GenerateVector(delim3Close, sDelimiters, TEXT("08"), delim3Open.size()); + GenerateVector(delim4Open, sDelimiters, TEXT("09"), 0); + GenerateVector(delim4Escape, sDelimiters, TEXT("10"), delim4Open.size()); + GenerateVector(delim4Close, sDelimiters, TEXT("11"), delim4Open.size()); + GenerateVector(delim5Open, sDelimiters, TEXT("12"), 0); + GenerateVector(delim5Escape, sDelimiters, TEXT("13"), delim5Open.size()); + GenerateVector(delim5Close, sDelimiters, TEXT("14"), delim5Open.size()); + GenerateVector(delim6Open, sDelimiters, TEXT("15"), 0); + GenerateVector(delim6Escape, sDelimiters, TEXT("16"), delim6Open.size()); + GenerateVector(delim6Close, sDelimiters, TEXT("17"), delim6Open.size()); + GenerateVector(delim7Open, sDelimiters, TEXT("18"), 0); + GenerateVector(delim7Escape, sDelimiters, TEXT("19"), delim7Open.size()); + GenerateVector(delim7Close, sDelimiters, TEXT("20"), delim7Open.size()); + GenerateVector(delim8Open, sDelimiters, TEXT("21"), 0); + GenerateVector(delim8Escape, sDelimiters, TEXT("22"), delim8Open.size()); + GenerateVector(delim8Close, sDelimiters, TEXT("23"), delim8Open.size()); + + operators1.clear(); + foldersInCode1Open.clear(); + foldersInCode1Middle.clear(); + foldersInCode1Close.clear(); + + SubGroup(sFoldersInCode1Open, foldersInCode1Open, true); + SubGroup(sFoldersInCode1Middle, foldersInCode1Middle, true); + 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 * numberPrefixes = (char *)styler.pprops->Get("userDefine.numberPrefixes"); + char * numberSuffixes = (char *)styler.pprops->Get("userDefine.numberSuffixes"); + + negativePrefixTokens.clear(); + prefixTokens.clear(); + extrasInPrefixedTokens.clear(); + rangeTokens.clear(); + suffixTokens.clear(); + + // 'StringToVector' converts strings into vector objects + StringToVector(numberPrefixes, prefixTokens); + StringToVector(numberPrefixes, negativePrefixTokens, true); + StringToVector(numberSuffixes, suffixTokens); + StringToVector(extraCharsInPrefixed, extrasInPrefixedTokens); + StringToVector(numberRanges, rangeTokens); + } + + // forward strings are actually kept in forwardStruct's, this allows easy access to ScintillaID and MaskID + // FWS is a single global object used only to create temporary forwardStruct objects that are copied into vector + vector forwards; + forwards.push_back(*FWS.Set(&delim1Open, SCE_USER_STYLE_DELIMITER1, SCE_USER_MASK_NESTING_DELIMITER1)); + forwards.push_back(*FWS.Set(&delim2Open, SCE_USER_STYLE_DELIMITER2, SCE_USER_MASK_NESTING_DELIMITER2)); + forwards.push_back(*FWS.Set(&delim3Open, SCE_USER_STYLE_DELIMITER3, SCE_USER_MASK_NESTING_DELIMITER3)); + forwards.push_back(*FWS.Set(&delim4Open, SCE_USER_STYLE_DELIMITER4, SCE_USER_MASK_NESTING_DELIMITER4)); + forwards.push_back(*FWS.Set(&delim5Open, SCE_USER_STYLE_DELIMITER5, SCE_USER_MASK_NESTING_DELIMITER5)); + forwards.push_back(*FWS.Set(&delim6Open, SCE_USER_STYLE_DELIMITER6, SCE_USER_MASK_NESTING_DELIMITER6)); + forwards.push_back(*FWS.Set(&delim7Open, SCE_USER_STYLE_DELIMITER7, SCE_USER_MASK_NESTING_DELIMITER7)); + forwards.push_back(*FWS.Set(&delim8Open, SCE_USER_STYLE_DELIMITER8, SCE_USER_MASK_NESTING_DELIMITER8)); + forwards.push_back(*FWS.Set(&commentOpen, SCE_USER_STYLE_COMMENT, SCE_USER_MASK_NESTING_COMMENT)); + forwards.push_back(*FWS.Set(&commentLineOpen, SCE_USER_STYLE_COMMENTLINE, SCE_USER_MASK_NESTING_COMMENT_LINE)); + forwards.push_back(*FWS.Set(&operators1, SCE_USER_STYLE_OPERATOR, SCE_USER_MASK_NESTING_OPERATORS1)); + + // keep delimiter open strings in an array for easier looping + vvstring * delimStart[SCE_USER_TOTAL_DELIMITERS]; + delimStart[0] = &delim1Open; + delimStart[1] = &delim2Open; + delimStart[2] = &delim3Open; + delimStart[3] = &delim4Open; + delimStart[4] = &delim5Open; + delimStart[5] = &delim6Open; + delimStart[6] = &delim7Open; + delimStart[7] = &delim8Open; + + vvstring * fwEndVectors[FW_VECTORS_TOTAL]; // array of forward end vectors for multi-part forward search + fwEndVectors[0] = &operators1; + fwEndVectors[1] = &commentLineOpen; + fwEndVectors[2] = &commentLineContinue; + 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; + + // keep delimiter escape/close strings in an array for easier looping + vvstring * delimVectors[SCE_USER_TOTAL_DELIMITERS * 2]; + delimVectors[0] = &delim1Escape; + delimVectors[1] = &delim1Close; + delimVectors[2] = &delim2Escape; + delimVectors[3] = &delim2Close; + delimVectors[4] = &delim3Escape; + delimVectors[5] = &delim3Close; + delimVectors[6] = &delim4Escape; + delimVectors[7] = &delim4Close; + delimVectors[8] = &delim5Escape; + delimVectors[9] = &delim5Close; + delimVectors[10] = &delim6Escape; + delimVectors[11] = &delim6Close; + delimVectors[12] = &delim7Escape; + delimVectors[13] = &delim7Close; + delimVectors[14] = &delim8Escape; + delimVectors[15] = &delim8Close; + + // again, loops make our lifes easier + int delimNestings[SCE_USER_TOTAL_DELIMITERS]; + delimNestings[0] = delim1Nesting; + delimNestings[1] = delim2Nesting; + delimNestings[2] = delim3Nesting; + delimNestings[3] = delim4Nesting; + delimNestings[4] = delim5Nesting; + delimNestings[5] = delim6Nesting; + delimNestings[6] = delim7Nesting; + delimNestings[7] = delim8Nesting; + + int levelCurrent = SC_FOLDLEVELBASE; + int lineCurrent = 0; + int levelMinCurrent = 0; + int levelNext = 0; + int levelPrev = 0; + int lev = 0; + + bool visibleChars = false; + + bool hasDot = false; + bool hasExp = false; + bool hasPrefix = false; + bool hasSuffix = false; + bool hasRange = false; + bool notNumber = false; + bool previousWasRange = false; + + bool dontMove = false; + bool finished = true; + + unsigned int nestedLevel = 0; + int openIndex = 0; + int skipForward = 0; + int prevState = 0; + + int isCommentLine = COMMENTLINE_NO; + int isPrevLineComment = COMMENTLINE_NO; + bool isInCommentBlock = false; + bool isInComment = false; + int newState = 0; + int nlCount = 0; + + int continueCommentBlock = 0; + bool startOfDelimiter = false; + + vector lastNestedGroup; + + vvstring * delimEscape = NULL; + vvstring * delimClose = NULL; + int delimNesting = 0; + unsigned int docLength = startPos + length; + + int numberParentState = SCE_USER_STYLE_IDENTIFIER; + + if (startPos == 0) + { + // foldVector.clear(); + nestedVector.clear(); + lastNestedGroup.clear(); + initStyle = SCE_USER_STYLE_IDENTIFIER; + } + else + { + int oldStartPos = startPos; + ReColoringCheck(startPos, nestedLevel, initStyle, openIndex, isCommentLine, isInComment, + styler, lastNestedGroup, nestedVector, /* foldVector, */ continueCommentBlock); + + // offset move to previous line + length += (oldStartPos - startPos); + docLength = startPos + length; + } + + lineCurrent = styler.GetLine(startPos); + if (lineCurrent > 0) + levelCurrent = styler.LevelAt(lineCurrent - 1) >> 16; + + levelMinCurrent = levelCurrent; + levelNext = levelCurrent; + + StyleContext sc(startPos, length, initStyle, styler); + for (; finished; dontMove?true:sc.Forward()) + { + dontMove = false; + if (sc.More() == false) + finished = false; // colorize last word, even if file does not end with whitespace char + + if (foldComments) + if (isInComment == false) + if (isCommentLine == COMMENTLINE_NO) + if (sc.state != SCE_USER_STYLE_COMMENTLINE) + if (sc.state != SCE_USER_STYLE_IDENTIFIER) + if (sc.state != SCE_USER_STYLE_DEFAULT) + if (!isWhiteSpace(sc.ch)) + isCommentLine = COMMENTLINE_SKIP_TESTING; + + if (foldCompact == true && visibleChars == false && !isWhiteSpace(sc.ch)) + visibleChars = true; + + if (sc.atLineEnd) + { + if (foldComments == true) + { + if (levelCurrent != levelNext) + isCommentLine = COMMENTLINE_SKIP_TESTING; + + if (continueCommentBlock > 0) + { + if (continueCommentBlock & CL_PREVPREV) + { + isInCommentBlock = true; + isPrevLineComment = COMMENTLINE_YES; + + if (!(continueCommentBlock & CL_CURRENT)) + { + levelNext++; + levelMinCurrent++; + levelCurrent++; + levelPrev = (levelMinCurrent | levelNext << 16) | SC_ISCOMMENTLINE; + } + } + else if (continueCommentBlock & CL_PREV) + { + isPrevLineComment = COMMENTLINE_YES; + if (continueCommentBlock & CL_CURRENT) + { + levelMinCurrent--; + levelNext--; + levelCurrent--; + levelPrev = (levelMinCurrent | levelNext << 16) | SC_ISCOMMENTLINE; + } + } + continueCommentBlock = 0; + } + + if (isInCommentBlock && isCommentLine != COMMENTLINE_YES && isPrevLineComment == COMMENTLINE_YES) + { + levelNext--; + levelPrev = (levelMinCurrent | levelNext << 16) | SC_ISCOMMENTLINE; + levelMinCurrent--; + isInCommentBlock = false; + } + + if (!isInCommentBlock && isCommentLine == COMMENTLINE_YES && isPrevLineComment == COMMENTLINE_YES) + { + levelNext++; + levelPrev = (levelMinCurrent | levelNext << 16) | SC_FOLDLEVELHEADERFLAG | SC_ISCOMMENTLINE; + levelMinCurrent = levelNext; + isInCommentBlock = true; + } + + if (levelPrev != 0) + { + // foldVector[lineCurrent - 1] = levelPrev; + styler.SetLevel(lineCurrent - 1, levelPrev); + levelPrev = 0; + } + } + + lev = levelMinCurrent | levelNext << 16; + if (foldComments && isCommentLine == COMMENTLINE_YES) + lev |= SC_ISCOMMENTLINE; + if (visibleChars == false && foldCompact) + lev |= SC_FOLDLEVELWHITEFLAG; + if (levelMinCurrent < levelNext) + lev |= SC_FOLDLEVELHEADERFLAG; + // foldVector.push_back(lev); + styler.SetLevel(lineCurrent, lev); + + for (int i=0; i::iterator 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. + 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); + if (delimNesting & SCE_USER_MASK_NESTING_NUMBERS) + { + if (true == IsNumber(prefixTokens, negativePrefixTokens, sc, ignoreCase, hasPrefix, dontMove, hasDot)) + { + numberParentState = prevState; + break; + } + } + } + + // special case when number follows opening sequence + if (startOfDelimiter == true) + { + startOfDelimiter = false; + if (delimNesting & SCE_USER_MASK_NESTING_NUMBERS) + { + if (true == IsNumber(prefixTokens, negativePrefixTokens, sc, ignoreCase, hasPrefix, dontMove, hasDot)) + { + numberParentState = prevState; + break; + } + } + } + + // third, check nested delimiter sequence + if (isInListNested(delimNesting, forwards, sc, ignoreCase, openIndex, skipForward, newState, lineCommentAtBOL)) + { + // 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) + { + // 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) + { + // generally, nested keywords must be surrounded by spaces (or forward keywords) + // one exception is that operators can be followed by numbers + sc.ChangeState(prevState); + if (delimNesting & SCE_USER_MASK_NESTING_NUMBERS) + { + if (true == IsNumber(prefixTokens, negativePrefixTokens, sc, ignoreCase, hasPrefix, dontMove, hasDot)) + { + numberParentState = prevState; + break; + } + } + } + dontMove = true; + break; + } + break; + } + + case SCE_USER_STYLE_COMMENT: + { + // 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); + if (commentNesting & SCE_USER_MASK_NESTING_NUMBERS) + { + if (true == IsNumber(prefixTokens, negativePrefixTokens, sc, ignoreCase, hasPrefix, dontMove, hasDot)) + { + numberParentState = SCE_USER_STYLE_COMMENT; + break; + } + } + } + + // special case when number follows opening sequence + if (startOfDelimiter == true) + { + startOfDelimiter = false; + if (commentNesting & SCE_USER_MASK_NESTING_NUMBERS) + { + if (true == IsNumber(prefixTokens, negativePrefixTokens, sc, ignoreCase, hasPrefix, dontMove, hasDot)) + { + numberParentState = SCE_USER_STYLE_COMMENT; + break; + } + } + } + + // third, check nested delimiter sequence + if (isInListNested(commentNesting, forwards, sc, ignoreCase, openIndex, skipForward, newState, lineCommentAtBOL)) + { + // 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) + { + // 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) + { + // generally, nested keywords must be surrounded by spaces (or forward keywords) + // one exception is that operators can be followed by numbers + sc.ChangeState(SCE_USER_STYLE_COMMENT); + if (commentNesting & SCE_USER_MASK_NESTING_NUMBERS) + { + if (true == IsNumber(prefixTokens, negativePrefixTokens, sc, ignoreCase, hasPrefix, dontMove, hasDot)) + { + numberParentState = SCE_USER_STYLE_COMMENT; + break; + } + } + } + dontMove = true; + break; + } + break; + } + + case SCE_USER_STYLE_COMMENTLINE: + { + // 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); + if (lineCommentNesting & SCE_USER_MASK_NESTING_NUMBERS) + { + if (true == IsNumber(prefixTokens, negativePrefixTokens, sc, ignoreCase, hasPrefix, dontMove, hasDot)) + { + numberParentState = SCE_USER_STYLE_COMMENTLINE; + break; + } + } + } + + // special case when number follows opening sequence + if (startOfDelimiter == true) + { + startOfDelimiter = false; + if (lineCommentNesting & SCE_USER_MASK_NESTING_NUMBERS) + { + if (true == IsNumber(prefixTokens, negativePrefixTokens, sc, ignoreCase, hasPrefix, dontMove, hasDot)) + { + numberParentState = SCE_USER_STYLE_COMMENTLINE; + break; + } + } + } + + // 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 (delimNestings[i] & SCE_USER_MASK_NESTING_NUMBERS) + startOfDelimiter = 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))// && isWhiteSpace(sc.chPrev)) + { + break; + } + + if (true == IsNumber(prefixTokens, negativePrefixTokens, sc, ignoreCase, hasPrefix, dontMove, hasDot)) + { + numberParentState = SCE_USER_STYLE_IDENTIFIER; + break; + } + + if (!isWhiteSpace(sc.ch))// && isWhiteSpace(sc.chPrev)) // word start + { + sc.SetState(SCE_USER_STYLE_DEFAULT); + dontMove = true; + break; + } + break; + } + + default: + break; + } + } + sc.Complete(); +} + +static void FoldUserDoc(unsigned int /* startPos */, int /* length */, int /*initStyle*/, WordList *[], Accessor & /* styler */) +{ + // this function will not be used in final version of the code. + // it should remain commented out as it is useful for debugging purposes !!! + // perhaps ifdef block would be a wiser choice, but commenting out works just fine for the time being + + // int lineCurrent = styler.GetLine(startPos); + // vector::iterator iter = foldVectorStatic->begin() + lineCurrent; + + // for (; iter != foldVectorStatic->end(); ++iter) + // { + // styler.SetLevel(lineCurrent++, *iter); + // } +} static const char * const userDefineWordLists[] = { "Primary keywords and identifiers", @@ -545,6 +2203,4 @@ static const char * const userDefineWordLists[] = { 0, }; - - LexerModule lmUserDefine(SCLEX_USER, ColouriseUserDoc, "user", FoldUserDoc, userDefineWordLists); diff --git a/scintilla/lexlib/StyleContext.h b/scintilla/lexlib/StyleContext.h index c3f85e36..114966b2 100644 --- a/scintilla/lexlib/StyleContext.h +++ b/scintilla/lexlib/StyleContext.h @@ -145,6 +145,8 @@ public: if (MakeLowerCase(ch) != static_cast(*s)) return false; s++; + if (!*s) + return true; if (MakeLowerCase(chNext) != static_cast(*s)) return false; s++; @@ -156,6 +158,23 @@ public: } return true; } + bool MatchIgnoreCase2(const char *s) { + if (MakeLowerCase(ch) != MakeLowerCase(static_cast(*s))) + return false; + s++; + if (!*s) + return true; + if (MakeLowerCase(chNext) != MakeLowerCase(static_cast(*s))) + return false; + s++; + for (int n=2; *s; n++) { + if (MakeLowerCase(static_cast(*s)) != + MakeLowerCase(static_cast(styler.SafeGetCharAt(currentPos+n)))) + return false; + s++; + } + return true; + } // Non-inline void GetCurrent(char *s, unsigned int len); void GetCurrentLowered(char *s, unsigned int len);