[BUG_FIXED] Recover langs.xml while its length is zero.
[NEW] Add JSP. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@601 f5eea248-9336-0410-98b8-ebc06183d4e3remotes/x64
parent
1f1ce89572
commit
9c03f48263
|
@ -25,7 +25,7 @@ enum LangType {L_TXT, L_PHP , L_C, L_CPP, L_CS, L_OBJC, L_JAVA, L_RC,\
|
||||||
L_TEX, L_FORTRAN, L_BASH, L_FLASH, L_NSIS, L_TCL, L_LISP, L_SCHEME,\
|
L_TEX, L_FORTRAN, L_BASH, L_FLASH, L_NSIS, L_TCL, L_LISP, L_SCHEME,\
|
||||||
L_ASM, L_DIFF, L_PROPS, L_PS, L_RUBY, L_SMALLTALK, L_VHDL, L_KIX, L_AU3,\
|
L_ASM, L_DIFF, L_PROPS, L_PS, L_RUBY, L_SMALLTALK, L_VHDL, L_KIX, L_AU3,\
|
||||||
L_CAML, L_ADA, L_VERILOG, L_MATLAB, L_HASKELL, L_INNO, L_SEARCHRESULT,\
|
L_CAML, L_ADA, L_VERILOG, L_MATLAB, L_HASKELL, L_INNO, L_SEARCHRESULT,\
|
||||||
L_CMAKE, L_YAML, L_COBOL, L_GUI4CLI, L_D, L_POWERSHELL, L_R,\
|
L_CMAKE, L_YAML, L_COBOL, L_GUI4CLI, L_D, L_POWERSHELL, L_R, L_JSP,\
|
||||||
// The end of enumated language type, so it should be always at the end
|
// The end of enumated language type, so it should be always at the end
|
||||||
L_EXTERNAL};
|
L_EXTERNAL};
|
||||||
enum winVer{WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, WV_XP, WV_S2003, WV_XPX64, WV_VISTA, WV_WIN7};
|
enum winVer{WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, WV_XP, WV_S2003, WV_XPX64, WV_VISTA, WV_WIN7};
|
||||||
|
|
|
@ -157,12 +157,12 @@ int PluginsManager::loadPlugin(const TCHAR *pluginFilePath, vector<generic_strin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TiXmlDocument *_pXmlDoc = new TiXmlDocument(xmlPath);
|
TiXmlDocument *pXmlDoc = new TiXmlDocument(xmlPath);
|
||||||
|
|
||||||
if (!_pXmlDoc->LoadFile())
|
if (!pXmlDoc->LoadFile())
|
||||||
{
|
{
|
||||||
delete _pXmlDoc;
|
delete pXmlDoc;
|
||||||
_pXmlDoc = NULL;
|
pXmlDoc = NULL;
|
||||||
throw generic_string(generic_string(xmlPath) + TEXT(" failed to load."));
|
throw generic_string(generic_string(xmlPath) + TEXT(" failed to load."));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,8 +170,8 @@ int PluginsManager::loadPlugin(const TCHAR *pluginFilePath, vector<generic_strin
|
||||||
if (containers[x] != NULL)
|
if (containers[x] != NULL)
|
||||||
nppParams->addExternalLangToEnd(containers[x]);
|
nppParams->addExternalLangToEnd(containers[x]);
|
||||||
|
|
||||||
nppParams->getExternalLexerFromXmlTree(_pXmlDoc);
|
nppParams->getExternalLexerFromXmlTree(pXmlDoc);
|
||||||
nppParams->getExternalLexerDoc()->push_back(_pXmlDoc);
|
nppParams->getExternalLexerDoc()->push_back(pXmlDoc);
|
||||||
#ifdef UNICODE
|
#ifdef UNICODE
|
||||||
const char *pDllName = wmc->wchar2char(pluginFilePath, CP_ACP);
|
const char *pDllName = wmc->wchar2char(pluginFilePath, CP_ACP);
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -5199,6 +5199,7 @@ void Notepad_plus::command(int id)
|
||||||
case IDM_LANG_GUI4CLI :
|
case IDM_LANG_GUI4CLI :
|
||||||
case IDM_LANG_POWERSHELL :
|
case IDM_LANG_POWERSHELL :
|
||||||
case IDM_LANG_R :
|
case IDM_LANG_R :
|
||||||
|
case IDM_LANG_JSP :
|
||||||
case IDM_LANG_USER :
|
case IDM_LANG_USER :
|
||||||
{
|
{
|
||||||
setLanguage(menuID2LangType(id));
|
setLanguage(menuID2LangType(id));
|
||||||
|
@ -5539,6 +5540,8 @@ enum LangType Notepad_plus::menuID2LangType(int cmdID)
|
||||||
return L_PHP;
|
return L_PHP;
|
||||||
case IDM_LANG_ASP :
|
case IDM_LANG_ASP :
|
||||||
return L_ASP;
|
return L_ASP;
|
||||||
|
case IDM_LANG_JSP :
|
||||||
|
return L_JSP;
|
||||||
case IDM_LANG_CSS :
|
case IDM_LANG_CSS :
|
||||||
return L_CSS;
|
return L_CSS;
|
||||||
case IDM_LANG_LUA :
|
case IDM_LANG_LUA :
|
||||||
|
|
|
@ -547,6 +547,7 @@ BEGIN
|
||||||
MENUITEM "INNO", IDM_LANG_INNO
|
MENUITEM "INNO", IDM_LANG_INNO
|
||||||
MENUITEM "Java", IDM_LANG_JAVA
|
MENUITEM "Java", IDM_LANG_JAVA
|
||||||
MENUITEM "Javascript", IDM_LANG_JS
|
MENUITEM "Javascript", IDM_LANG_JS
|
||||||
|
MENUITEM "JSP", IDM_LANG_JSP
|
||||||
MENUITEM "KIXtart", IDM_LANG_KIX
|
MENUITEM "KIXtart", IDM_LANG_KIX
|
||||||
MENUITEM "LISP", IDM_LANG_LISP
|
MENUITEM "LISP", IDM_LANG_LISP
|
||||||
MENUITEM "Lua", IDM_LANG_LUA
|
MENUITEM "Lua", IDM_LANG_LUA
|
||||||
|
@ -623,6 +624,7 @@ BEGIN
|
||||||
BEGIN
|
BEGIN
|
||||||
MENUITEM "Java", IDM_LANG_JAVA
|
MENUITEM "Java", IDM_LANG_JAVA
|
||||||
MENUITEM "Javascript", IDM_LANG_JS
|
MENUITEM "Javascript", IDM_LANG_JS
|
||||||
|
MENUITEM "JSP", IDM_LANG_JSP
|
||||||
END
|
END
|
||||||
MENUITEM "KIXtart", IDM_LANG_KIX
|
MENUITEM "KIXtart", IDM_LANG_KIX
|
||||||
POPUP "L"
|
POPUP "L"
|
||||||
|
|
|
@ -790,13 +790,25 @@ bool NppParameters::load()
|
||||||
// langs.xml : for every user statically //
|
// langs.xml : for every user statically //
|
||||||
//---------------------------------------//
|
//---------------------------------------//
|
||||||
generic_string langs_xml_path(_nppPath);
|
generic_string langs_xml_path(_nppPath);
|
||||||
|
|
||||||
PathAppend(langs_xml_path, TEXT("langs.xml"));
|
PathAppend(langs_xml_path, TEXT("langs.xml"));
|
||||||
if (!PathFileExists(langs_xml_path.c_str()))
|
|
||||||
|
BOOL doRecover = FALSE;
|
||||||
|
if (::PathFileExists(langs_xml_path.c_str()))
|
||||||
|
{
|
||||||
|
struct _stat buf;
|
||||||
|
|
||||||
|
if (generic_stat(langs_xml_path.c_str(), &buf)==0)
|
||||||
|
if (buf.st_size == 0)
|
||||||
|
doRecover = ::MessageBox(NULL, TEXT("Load langs.xml failed!\rDo you want to recover your langs.xml?"), TEXT("Configurator"),MB_YESNO);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
doRecover = true;
|
||||||
|
|
||||||
|
if (doRecover)
|
||||||
{
|
{
|
||||||
generic_string srcLangsPath(_nppPath);
|
generic_string srcLangsPath(_nppPath);
|
||||||
PathAppend(srcLangsPath, TEXT("langs.model.xml"));
|
PathAppend(srcLangsPath, TEXT("langs.model.xml"));
|
||||||
::CopyFile(srcLangsPath.c_str(), langs_xml_path.c_str(), TRUE);
|
::CopyFile(srcLangsPath.c_str(), langs_xml_path.c_str(), FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
_pXmlDoc = new TiXmlDocument(langs_xml_path);
|
_pXmlDoc = new TiXmlDocument(langs_xml_path);
|
||||||
|
@ -1116,7 +1128,8 @@ void NppParameters::setFontList(HWND hWnd)
|
||||||
|
|
||||||
void NppParameters::getLangKeywordsFromXmlTree()
|
void NppParameters::getLangKeywordsFromXmlTree()
|
||||||
{
|
{
|
||||||
TiXmlNode *root = _pXmlDoc->FirstChild(TEXT("NotepadPlus"));
|
TiXmlNode *root =
|
||||||
|
_pXmlDoc->FirstChild(TEXT("NotepadPlus"));
|
||||||
if (!root) return;
|
if (!root) return;
|
||||||
feedKeyWordsParameters(root);
|
feedKeyWordsParameters(root);
|
||||||
}
|
}
|
||||||
|
@ -4577,6 +4590,8 @@ int NppParameters::langTypeToCommandID(LangType lt) const
|
||||||
id = IDM_LANG_PHP; break;
|
id = IDM_LANG_PHP; break;
|
||||||
case L_ASP :
|
case L_ASP :
|
||||||
id = IDM_LANG_ASP; break;
|
id = IDM_LANG_ASP; break;
|
||||||
|
case L_JSP :
|
||||||
|
id = IDM_LANG_JSP; break;
|
||||||
case L_CSS :
|
case L_CSS :
|
||||||
id = IDM_LANG_CSS; break;
|
id = IDM_LANG_CSS; break;
|
||||||
case L_LUA :
|
case L_LUA :
|
||||||
|
|
|
@ -109,6 +109,7 @@ LanguageName ScintillaEditView::langNames[L_EXTERNAL+1] = {
|
||||||
{TEXT("d"), TEXT("D"), TEXT("D programming language"), L_D, SCLEX_D},
|
{TEXT("d"), TEXT("D"), TEXT("D programming language"), L_D, SCLEX_D},
|
||||||
{TEXT("powershell"), TEXT("PowerShell"), TEXT("Windows PowerShell"), L_POWERSHELL, SCLEX_POWERSHELL},
|
{TEXT("powershell"), TEXT("PowerShell"), TEXT("Windows PowerShell"), L_POWERSHELL, SCLEX_POWERSHELL},
|
||||||
{TEXT("r"), TEXT("R"), TEXT("R programming language"), L_R, SCLEX_R},
|
{TEXT("r"), TEXT("R"), TEXT("R programming language"), L_R, SCLEX_R},
|
||||||
|
{TEXT("jsp"), TEXT("JSP"), TEXT("Java Server Pages script file"), L_JSP, SCLEX_HTML},
|
||||||
{TEXT("ext"), TEXT("External"), TEXT("External"), L_EXTERNAL, SCLEX_NULL}
|
{TEXT("ext"), TEXT("External"), TEXT("External"), L_EXTERNAL, SCLEX_NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -497,7 +498,7 @@ void ScintillaEditView::setXmlLexer(LangType type)
|
||||||
|
|
||||||
makeStyle(type);
|
makeStyle(type);
|
||||||
}
|
}
|
||||||
else if ((type == L_HTML) || (type == L_PHP) || (type == L_ASP))
|
else if ((type == L_HTML) || (type == L_PHP) || (type == L_ASP) || (type == L_JSP))
|
||||||
{
|
{
|
||||||
execute(SCI_SETLEXER, SCLEX_HTML);
|
execute(SCI_SETLEXER, SCLEX_HTML);
|
||||||
const TCHAR *htmlKeyWords_generic =_pParameter->getWordList(L_HTML, LANG_INDEX_INSTR);
|
const TCHAR *htmlKeyWords_generic =_pParameter->getWordList(L_HTML, LANG_INDEX_INSTR);
|
||||||
|
@ -512,7 +513,7 @@ void ScintillaEditView::setXmlLexer(LangType type)
|
||||||
makeStyle(L_HTML);
|
makeStyle(L_HTML);
|
||||||
|
|
||||||
setEmbeddedJSLexer();
|
setEmbeddedJSLexer();
|
||||||
setPhpEmbeddedLexer();
|
setEmbeddedPhpLexer();
|
||||||
setEmbeddedAspLexer();
|
setEmbeddedAspLexer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -539,7 +540,7 @@ void ScintillaEditView::setEmbeddedJSLexer()
|
||||||
execute(SCI_STYLESETEOLFILLED, SCE_HJ_COMMENTDOC, true);
|
execute(SCI_STYLESETEOLFILLED, SCE_HJ_COMMENTDOC, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScintillaEditView::setPhpEmbeddedLexer()
|
void ScintillaEditView::setEmbeddedPhpLexer()
|
||||||
{
|
{
|
||||||
const TCHAR *pKwArray[10] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
|
const TCHAR *pKwArray[10] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
|
||||||
makeStyle(L_PHP, pKwArray);
|
makeStyle(L_PHP, pKwArray);
|
||||||
|
@ -1115,6 +1116,7 @@ void ScintillaEditView::defineDocType(LangType typeDoc)
|
||||||
|
|
||||||
case L_PHP :
|
case L_PHP :
|
||||||
case L_ASP :
|
case L_ASP :
|
||||||
|
case L_JSP :
|
||||||
case L_HTML :
|
case L_HTML :
|
||||||
case L_XML :
|
case L_XML :
|
||||||
setXmlLexer(typeDoc); break;
|
setXmlLexer(typeDoc); break;
|
||||||
|
|
|
@ -659,7 +659,7 @@ protected:
|
||||||
void setUserLexer(const TCHAR *userLangName = NULL);
|
void setUserLexer(const TCHAR *userLangName = NULL);
|
||||||
void setExternalLexer(LangType typeDoc);
|
void setExternalLexer(LangType typeDoc);
|
||||||
void setEmbeddedJSLexer();
|
void setEmbeddedJSLexer();
|
||||||
void setPhpEmbeddedLexer();
|
void setEmbeddedPhpLexer();
|
||||||
void setEmbeddedAspLexer();
|
void setEmbeddedAspLexer();
|
||||||
//Simple lexers
|
//Simple lexers
|
||||||
void setCssLexer() {
|
void setCssLexer() {
|
||||||
|
|
|
@ -448,7 +448,7 @@ void XmlMatchedTagsHighlighter::tagMatch(bool doHiliteAttr)
|
||||||
// Detect the current lang type. It works only with html and xml
|
// Detect the current lang type. It works only with html and xml
|
||||||
LangType lang = (_pEditView->getCurrentBuffer())->getLangType();
|
LangType lang = (_pEditView->getCurrentBuffer())->getLangType();
|
||||||
|
|
||||||
if (lang != L_XML && lang != L_HTML && lang != L_PHP && lang != L_ASP)
|
if (lang != L_XML && lang != L_HTML && lang != L_PHP && lang != L_ASP && lang != L_JSP)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Get the original targets and search options to restore after tag matching operation
|
// Get the original targets and search options to restore after tag matching operation
|
||||||
|
|
|
@ -110,6 +110,7 @@
|
||||||
<Language name="javascript" ext="js" commentLine="//" commentStart="/*" commentEnd="*/">
|
<Language name="javascript" ext="js" commentLine="//" commentStart="/*" commentEnd="*/">
|
||||||
<Keywords name="instre1">abstract boolean break byte case catch char class const continue debugger default delete do double else enum export extends final finally float for function goto if implements import in instanceof int interface long native new package private protected public return short static super switch synchronized this throw throws transient try typeof var void volatile while with true false prototype</Keywords>
|
<Keywords name="instre1">abstract boolean break byte case catch char class const continue debugger default delete do double else enum export extends final finally float for function goto if implements import in instanceof int interface long native new package private protected public return short static super switch synchronized this throw throws transient try typeof var void volatile while with true false prototype</Keywords>
|
||||||
</Language>
|
</Language>
|
||||||
|
<Language name="jsp" ext="jsp" commentLine="//" commentStart="/*" commentEnd="*/"/>
|
||||||
<Language name="kix" ext="kix" commentLine=";" commentStart="" commentEnd="">
|
<Language name="kix" ext="kix" commentLine=";" commentStart="" commentEnd="">
|
||||||
<Keywords name="instre1">? and beep big break call cd cls color cookie1 copy debug del dim display do until exit flushkb for each next function endfunction get gets global go gosub goto if else endif md or password play quit rd redim return run select case endselect set setl setm settime shell sleep small use while loop</Keywords>
|
<Keywords name="instre1">? and beep big break call cd cls color cookie1 copy debug del dim display do until exit flushkb for each next function endfunction get gets global go gosub goto if else endif md or password play quit rd redim return run select case endselect set setl setm settime shell sleep small use while loop</Keywords>
|
||||||
<Keywords name="instre2">abs addkey addprinterconnection addprogramgroup addprogramitem asc ascan at backupeventlog box cdbl chr cint cleareventlog close comparefiletimes createobject cstr dectohex delkey delprinterconnection delprogramgroup delprogramitem deltree delvalue dir enumgroup enumipinfo enumkey enumlocalgroup enumvalue execute exist existkey expandenvironmentvars fix formatnumber freefilehandle getdiskspace getfileattr getfilesize getfiletime getfileversion getobject iif ingroup instr instrrev int isdeclared join kbhit keyexist lcase left len loadhive loadkey logevent logoff ltrim memorysize messagebox open readline readprofilestring readtype readvalue redirectoutput right rnd round rtrim savekey sendkeys sendmessage setascii setconsole setdefaultprinter setfileattr setfocus setoption setsystemstate settitle setwallpaper showprogramgroup shutdown sidtoname split srnd substr trim ubound ucase unloadhive val vartype vartypename writeline writeprofilestring writevalue</Keywords>
|
<Keywords name="instre2">abs addkey addprinterconnection addprogramgroup addprogramitem asc ascan at backupeventlog box cdbl chr cint cleareventlog close comparefiletimes createobject cstr dectohex delkey delprinterconnection delprogramgroup delprogramitem deltree delvalue dir enumgroup enumipinfo enumkey enumlocalgroup enumvalue execute exist existkey expandenvironmentvars fix formatnumber freefilehandle getdiskspace getfileattr getfilesize getfiletime getfileversion getobject iif ingroup instr instrrev int isdeclared join kbhit keyexist lcase left len loadhive loadkey logevent logoff ltrim memorysize messagebox open readline readprofilestring readtype readvalue redirectoutput right rnd round rtrim savekey sendkeys sendmessage setascii setconsole setdefaultprinter setfileattr setfocus setoption setsystemstate settitle setwallpaper showprogramgroup shutdown sidtoname split srnd substr trim ubound ucase unloadhive val vartype vartypename writeline writeprofilestring writevalue</Keywords>
|
||||||
|
|
|
@ -353,6 +353,7 @@
|
||||||
#define IDM_LANG_GUI4CLI (IDM_LANG + 52)
|
#define IDM_LANG_GUI4CLI (IDM_LANG + 52)
|
||||||
#define IDM_LANG_POWERSHELL (IDM_LANG + 53)
|
#define IDM_LANG_POWERSHELL (IDM_LANG + 53)
|
||||||
#define IDM_LANG_R (IDM_LANG + 54)
|
#define IDM_LANG_R (IDM_LANG + 54)
|
||||||
|
#define IDM_LANG_JSP (IDM_LANG + 55)
|
||||||
|
|
||||||
#define IDM_LANG_EXTERNAL (IDM_LANG + 65)
|
#define IDM_LANG_EXTERNAL (IDM_LANG + 65)
|
||||||
#define IDM_LANG_EXTERNAL_LIMIT (IDM_LANG + 79)
|
#define IDM_LANG_EXTERNAL_LIMIT (IDM_LANG + 79)
|
||||||
|
|
Loading…
Reference in New Issue