From 9627abcd69f4f9fd26d9a98bf017f17c7f26aea2 Mon Sep 17 00:00:00 2001 From: Don Ho Date: Thu, 10 Sep 2009 00:44:36 +0000 Subject: [PATCH] [NEW_FEATURE] (Author : Christian Cuvier) Add the escape character capacity for the delimiter in User Defined Language System. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@531 f5eea248-9336-0410-98b8-ebc06183d4e3 --- PowerEditor/installer/nativeLang/english.xml | 1 + PowerEditor/src/Parameters.cpp | 4 + PowerEditor/src/Parameters.h | 7 + .../ScitillaComponent/ScintillaEditView.cpp | 2 + .../ScitillaComponent/UserDefineDialog.cpp | 57 +- .../src/ScitillaComponent/UserDefineDialog.h | 3 + .../src/ScitillaComponent/UserDefineDialog.rc | 66 +- .../ScitillaComponent/UserDefineResource.h | 3 + scintilla/src/LexUser.cxx | 41 +- scintilla/vcbuild/SciLexer.7.vcproj | 582 ---- scintilla/vcbuild/SciLexer.vcproj | 2589 ----------------- 11 files changed, 145 insertions(+), 3210 deletions(-) delete mode 100644 scintilla/vcbuild/SciLexer.7.vcproj delete mode 100644 scintilla/vcbuild/SciLexer.vcproj diff --git a/PowerEditor/installer/nativeLang/english.xml b/PowerEditor/installer/nativeLang/english.xml index 87f34027..c173d92d 100644 --- a/PowerEditor/installer/nativeLang/english.xml +++ b/PowerEditor/installer/nativeLang/english.xml @@ -347,6 +347,7 @@ + diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index cc7d8810..e2859256 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -2175,6 +2175,8 @@ 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) @@ -4669,6 +4671,8 @@ void NppParameters::insertUserLang2Tree(TiXmlNode *node, UserLangContainer *user { 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")); diff --git a/PowerEditor/src/Parameters.h b/PowerEditor/src/Parameters.h index f21db3ea..a4979019 100644 --- a/PowerEditor/src/Parameters.h +++ b/PowerEditor/src/Parameters.h @@ -868,6 +868,8 @@ public : UserLangContainer(){ _name = TEXT("new user define"); _ext = TEXT(""); + _escapeChar[0] = '\0'; + _escapeChar[1] = '\0'; // Keywords list of Delimiters (index 0) lstrcpy(_keywordLists[0], TEXT("000000")); @@ -877,6 +879,8 @@ public : 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++) *_keywordLists[j] = '\0'; }; @@ -886,6 +890,8 @@ public : { this->_name = ulc._name; this->_ext = ulc._ext; + this->_escapeChar[0] = ulc._escapeChar[0]; + this->_escapeChar[1] = '\0'; this->_isCaseIgnored = ulc._isCaseIgnored; this->_styleArray = ulc._styleArray; int nbStyler = this->_styleArray.getNbStyler(); @@ -918,6 +924,7 @@ private: bool _isCommentLineSymbol; bool _isCommentSymbol; bool _isPrefix[nbPrefixListAllowed]; + TCHAR _escapeChar[2]; }; #define MAX_EXTERNAL_LEXER_NAME_LEN 16 diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp index f8a2c3a2..a6dca73a 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp @@ -591,6 +591,8 @@ void ScintillaEditView::setUserLexer(const TCHAR *userLangName) 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++) diff --git a/PowerEditor/src/ScitillaComponent/UserDefineDialog.cpp b/PowerEditor/src/ScitillaComponent/UserDefineDialog.cpp index d6519cce..5e991b87 100644 --- a/PowerEditor/src/ScitillaComponent/UserDefineDialog.cpp +++ b/PowerEditor/src/ScitillaComponent/UserDefineDialog.cpp @@ -1012,7 +1012,10 @@ void SymbolsStyleDialog::updateDlg() } } } - + 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]; @@ -1121,6 +1124,7 @@ BOOL CALLBACK SymbolsStyleDialog::run_dlgProc(UINT Message, WPARAM wParam, LPARA ::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); } @@ -1135,6 +1139,45 @@ BOOL CALLBACK SymbolsStyleDialog::run_dlgProc(UINT Message, WPARAM wParam, LPARA _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)) { @@ -1197,6 +1240,18 @@ BOOL CALLBACK SymbolsStyleDialog::run_dlgProc(UINT Message, WPARAM wParam, LPARA } } +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) diff --git a/PowerEditor/src/ScitillaComponent/UserDefineDialog.h b/PowerEditor/src/ScitillaComponent/UserDefineDialog.h index 1927d20e..5bc0e642 100644 --- a/PowerEditor/src/ScitillaComponent/UserDefineDialog.h +++ b/PowerEditor/src/ScitillaComponent/UserDefineDialog.h @@ -182,6 +182,8 @@ public : static const bool REMOVE; SymbolsStyleDialog(); void updateDlg(); + void undeleteChar(); + protected : BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam); void setKeywords2List(int) {}; @@ -193,6 +195,7 @@ 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(); diff --git a/PowerEditor/src/ScitillaComponent/UserDefineDialog.rc b/PowerEditor/src/ScitillaComponent/UserDefineDialog.rc index 67717cf9..84bf0513 100644 --- a/PowerEditor/src/ScitillaComponent/UserDefineDialog.rc +++ b/PowerEditor/src/ScitillaComponent/UserDefineDialog.rc @@ -199,38 +199,40 @@ BEGIN 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,268,56,8,0,WS_EX_RIGHT - LTEXT "Background color",IDC_SYMBOL_BG2_STATIC,26,289,56,8,0,WS_EX_RIGHT - COMBOBOX IDC_SYMBOL_FONT2_COMBO,184,266,104,78,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_SYMBOL_BO2_COMBO,85,237,40,82,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "Bold",IDC_SYMBOL_BOLD2_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,140,284,45,10 - CONTROL "Italic",IDC_SYMBOL_ITALIC2_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,140,299,41,10 - GROUPBOX "Font style",IDC_SYMBOL_FONTSTYLEGROUP2_STATIC,132,253,164,60 - GROUPBOX "Colour style",IDC_SYMBOL_COLORSTYLEGROUP2_STATIC,14,253,111,60 - LTEXT "Font Name :",IDC_SYMBOL_FONTNAME2_STATIC,136,267,44,8,0,WS_EX_RIGHT - LTEXT "Boundary open :",IDC_SYMBOL_BO2_STATIC,9,239,74,8,0,WS_EX_RIGHT - CONTROL "Underline",IDC_SYMBOL_UNDERLINE2_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,211,299,59,10 - COMBOBOX IDC_SYMBOL_BC2_COMBO,256,237,40,82,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Boundary close :",IDC_SYMBOL_BC2_STATIC,168,239,86,8,0,WS_EX_RIGHT - GROUPBOX "Delimiter 1",IDC_SYMBOL_DELIMGROUP1_STATIC,3,227,300,93,BS_CENTER | BS_FLAT - LTEXT "Foreground colour",IDC_SYMBOL_FG3_STATIC,26,369,56,8,0,WS_EX_RIGHT - LTEXT "Background colour",IDC_SYMBOL_BG3_STATIC,26,390,56,8,0,WS_EX_RIGHT - COMBOBOX IDC_SYMBOL_FONT3_COMBO,184,367,104,78,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_SYMBOL_BO3_COMBO,85,339,40,82,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "Bold",IDC_SYMBOL_BOLD3_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,140,385,45,10 - CONTROL "Italic",IDC_SYMBOL_ITALIC3_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,140,400,41,10 - GROUPBOX "Font Style",IDC_SYMBOL_FONTSTYLEGROUP3_STATIC,132,355,164,60 - GROUPBOX "Colour Style",IDC_SYMBOL_COLORSTYLEGROUP3_STATIC,14,355,111,60 - LTEXT "Font name :",IDC_SYMBOL_FONTNAME3_STATIC,136,368,44,8,0,WS_EX_RIGHT - LTEXT "Boundary open :",IDC_SYMBOL_BO3_STATIC,9,340,74,8,0,WS_EX_RIGHT - CONTROL "Underline",IDC_SYMBOL_UNDERLINE3_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,211,400,59,10 - COMBOBOX IDC_SYMBOL_BC3_COMBO,256,339,40,82,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Boundary close :",IDC_SYMBOL_BC3_STATIC,168,340,86,8,0,WS_EX_RIGHT - GROUPBOX "Delimiter 2",IDC_SYMBOL_DELIMGROUP2_STATIC,3,328,300,93,BS_CENTER | BS_FLAT - COMBOBOX IDC_SYMBOL_FONTSIZE2_COMBO,248,283,40,82,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Font size :",IDC_SYMBOL_FONTSIZE2_STATIC,212,285,34,8,0,WS_EX_RIGHT - COMBOBOX IDC_SYMBOL_FONTSIZE3_COMBO,248,384,40,82,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Font size :",IDC_SYMBOL_FONTSIZE3_STATIC,212,386,34,8,0,WS_EX_RIGHT + 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 END IDD_GLOBAL_USERDEFINE_DLG DIALOGEX 36, 44, 340, 550 diff --git a/PowerEditor/src/ScitillaComponent/UserDefineResource.h b/PowerEditor/src/ScitillaComponent/UserDefineResource.h index 73fda5f5..24cfc95c 100644 --- a/PowerEditor/src/ScitillaComponent/UserDefineResource.h +++ b/PowerEditor/src/ScitillaComponent/UserDefineResource.h @@ -202,6 +202,9 @@ #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_SYMBOL (IDD_SYMBOL_STYLE_DLG + 100) #define IDC_ACTIVATED_SYMBOL_STATIC (IDC_SYMBOL + 1) #define IDC_ACTIVATED_SYMBOL_LIST (IDC_SYMBOL + 2) diff --git a/scintilla/src/LexUser.cxx b/scintilla/src/LexUser.cxx index 92a343bb..a167341c 100644 --- a/scintilla/src/LexUser.cxx +++ b/scintilla/src/LexUser.cxx @@ -240,6 +240,8 @@ static void ColouriseUserDoc(unsigned int startPos, int length, int initStyle, W char delimOpen[3]; char delimClose[3]; + bool escaped = false; + char escapeChar = static_cast(styler.GetPropertyInt("userDefine.escapeChar", 0)); for (int i = 0 ; i < 3 ; i++) { @@ -264,22 +266,40 @@ static void ColouriseUserDoc(unsigned int startPos, int length, int initStyle, W case SCE_USER_DELIMITER1 : { - if (delimClose[0] && (sc.ch == delimClose[0])) - sc.ForwardSetState(SCE_USER_DEFAULT); + if (sc.ch == escapeChar) + escaped = !escaped; + else + { + if (delimClose[0] && (sc.ch == delimClose[0]) && !escaped) + sc.ForwardSetState(SCE_USER_DEFAULT); + escaped = false; + } break; } case SCE_USER_DELIMITER2 : { - if (delimClose[0] && (sc.ch == delimClose[1])) - sc.ForwardSetState(SCE_USER_DEFAULT); + 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 (delimClose[0] && (sc.ch == delimClose[2])) - sc.ForwardSetState(SCE_USER_DEFAULT); + if (sc.ch == escapeChar) + escaped = !escaped; + else + { + if (delimClose[0] && (sc.ch == delimClose[2]) && !escaped) + sc.ForwardSetState(SCE_USER_DEFAULT); + escaped = false; + } break; } @@ -395,11 +415,20 @@ static void ColouriseUserDoc(unsigned int startPos, int length, int initStyle, W 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 (isAWordStart(sc.ch)) diff --git a/scintilla/vcbuild/SciLexer.7.vcproj b/scintilla/vcbuild/SciLexer.7.vcproj deleted file mode 100644 index e2cbe49a..00000000 --- a/scintilla/vcbuild/SciLexer.7.vcproj +++ /dev/null @@ -1,582 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/scintilla/vcbuild/SciLexer.vcproj b/scintilla/vcbuild/SciLexer.vcproj deleted file mode 100644 index a2609954..00000000 --- a/scintilla/vcbuild/SciLexer.vcproj +++ /dev/null @@ -1,2589 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -