[OPTIMIZE] (Author : Sune Marcher) Rewrite of menuID2LangType function.

[UPDATE] Refactor Notepad_plus.cpp (in progress).

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@608 f5eea248-9336-0410-98b8-ebc06183d4e3
remotes/x64
Don Ho 2010-02-04 01:22:41 +00:00
parent ebfec9d026
commit 689d434a9f
15 changed files with 236 additions and 312 deletions

View File

@ -19,8 +19,8 @@
#define NOTEPAD_PLUS_MSGS_H
enum LangType {L_TXT, L_PHP , L_C, L_CPP, L_CS, L_OBJC, L_JAVA, L_RC,\
L_HTML, L_XML, L_MAKEFILE, L_PASCAL, L_BATCH, L_INI, L_NFO, L_USER,\
enum LangType {L_TEXT, L_PHP , L_C, L_CPP, L_CS, L_OBJC, L_JAVA, L_RC,\
L_HTML, L_XML, L_MAKEFILE, L_PASCAL, L_BATCH, L_INI, L_ASCII, L_USER,\
L_ASP, L_SQL, L_VB, L_JS, L_CSS, L_PERL, L_PYTHON, L_LUA,\
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,\

View File

@ -543,147 +543,6 @@ void Notepad_plus::saveDockingParams()
nppGUI._dockingData._flaotingWindowInfo = vFloatingWindowInfo;
}
// return true if all the session files are loaded
// return false if one or more sessions files fail to load (and session is modify to remove invalid files)
bool Notepad_plus::loadSession(Session & session)
{
bool allSessionFilesLoaded = true;
BufferID lastOpened = BUFFER_INVALID;
size_t i = 0;
showView(MAIN_VIEW);
switchEditViewTo(MAIN_VIEW); //open files in main
for ( ; i < session.nbMainFiles() ; )
{
const TCHAR *pFn = session._mainViewFiles[i]._fileName.c_str();
if (isFileSession(pFn)) {
vector<sessionFileInfo>::iterator posIt = session._mainViewFiles.begin() + i;
session._mainViewFiles.erase(posIt);
continue; //skip session files, not supporting recursive sessions
}
if (PathFileExists(pFn)) {
lastOpened = doOpen(pFn, false, session._mainViewFiles[i]._encoding);
} else {
lastOpened = BUFFER_INVALID;
}
if (lastOpened != BUFFER_INVALID)
{
showView(MAIN_VIEW);
const TCHAR *pLn = session._mainViewFiles[i]._langName.c_str();
int id = getLangFromMenuName(pLn);
LangType typeToSet = L_TXT;
if (id != 0 && lstrcmp(pLn, TEXT("User Defined")) != 0)
typeToSet = menuID2LangType(id);
if (typeToSet == L_EXTERNAL )
typeToSet = (LangType)(id - IDM_LANG_EXTERNAL + L_EXTERNAL);
Buffer * buf = MainFileManager->getBufferByID(lastOpened);
buf->setPosition(session._mainViewFiles[i], &_mainEditView);
buf->setLangType(typeToSet, pLn);
if (session._mainViewFiles[i]._encoding != -1)
buf->setEncoding(session._mainViewFiles[i]._encoding);
//Force in the document so we can add the markers
//Dont use default methods because of performance
Document prevDoc = _mainEditView.execute(SCI_GETDOCPOINTER);
_mainEditView.execute(SCI_SETDOCPOINTER, 0, buf->getDocument());
for (size_t j = 0 ; j < session._mainViewFiles[i].marks.size() ; j++)
{
_mainEditView.execute(SCI_MARKERADD, session._mainViewFiles[i].marks[j], MARK_BOOKMARK);
}
_mainEditView.execute(SCI_SETDOCPOINTER, 0, prevDoc);
i++;
}
else
{
vector<sessionFileInfo>::iterator posIt = session._mainViewFiles.begin() + i;
session._mainViewFiles.erase(posIt);
allSessionFilesLoaded = false;
}
}
size_t k = 0;
showView(SUB_VIEW);
switchEditViewTo(SUB_VIEW); //open files in sub
for ( ; k < session.nbSubFiles() ; )
{
const TCHAR *pFn = session._subViewFiles[k]._fileName.c_str();
if (isFileSession(pFn)) {
vector<sessionFileInfo>::iterator posIt = session._subViewFiles.begin() + k;
session._subViewFiles.erase(posIt);
continue; //skip session files, not supporting recursive sessions
}
if (PathFileExists(pFn)) {
lastOpened = doOpen(pFn, false, session._subViewFiles[k]._encoding);
//check if already open in main. If so, clone
if (_mainDocTab.getIndexByBuffer(lastOpened) != -1) {
loadBufferIntoView(lastOpened, SUB_VIEW);
}
} else {
lastOpened = BUFFER_INVALID;
}
if (lastOpened != BUFFER_INVALID)
{
showView(SUB_VIEW);
if (canHideView(MAIN_VIEW))
hideView(MAIN_VIEW);
const TCHAR *pLn = session._subViewFiles[k]._langName.c_str();
int id = getLangFromMenuName(pLn);
LangType typeToSet = L_TXT;
if (id != 0)
typeToSet = menuID2LangType(id);
if (typeToSet == L_EXTERNAL )
typeToSet = (LangType)(id - IDM_LANG_EXTERNAL + L_EXTERNAL);
Buffer * buf = MainFileManager->getBufferByID(lastOpened);
buf->setPosition(session._subViewFiles[k], &_subEditView);
if (typeToSet == L_USER) {
if (!lstrcmp(pLn, TEXT("User Defined"))) {
pLn = TEXT(""); //default user defined
}
}
buf->setLangType(typeToSet, pLn);
buf->setEncoding(session._subViewFiles[k]._encoding);
//Force in the document so we can add the markers
//Dont use default methods because of performance
Document prevDoc = _subEditView.execute(SCI_GETDOCPOINTER);
_subEditView.execute(SCI_SETDOCPOINTER, 0, buf->getDocument());
for (size_t j = 0 ; j < session._subViewFiles[k].marks.size() ; j++)
{
_subEditView.execute(SCI_MARKERADD, session._subViewFiles[k].marks[j], MARK_BOOKMARK);
}
_subEditView.execute(SCI_SETDOCPOINTER, 0, prevDoc);
k++;
}
else
{
vector<sessionFileInfo>::iterator posIt = session._subViewFiles.begin() + k;
session._subViewFiles.erase(posIt);
allSessionFilesLoaded = false;
}
}
_mainEditView.restoreCurrentPos();
_subEditView.restoreCurrentPos();
if (session._activeMainIndex < (size_t)_mainDocTab.nbItem())//session.nbMainFiles())
activateBuffer(_mainDocTab.getBufferByIndex(session._activeMainIndex), MAIN_VIEW);
if (session._activeSubIndex < (size_t)_subDocTab.nbItem())//session.nbSubFiles())
activateBuffer(_subDocTab.getBufferByIndex(session._activeSubIndex), SUB_VIEW);
if ((session.nbSubFiles() > 0) && (session._activeView == MAIN_VIEW || session._activeView == SUB_VIEW))
switchEditViewTo(session._activeView);
else
switchEditViewTo(MAIN_VIEW);
if (canHideView(otherView()))
hideView(otherView());
else if (canHideView(currentView()))
hideView(currentView());
return allSessionFilesLoaded;
}
int Notepad_plus::getHtmlXmlEncoding(const TCHAR *fileName) const
{
@ -792,28 +651,6 @@ int Notepad_plus::getHtmlXmlEncoding(const TCHAR *fileName) const
}
}
bool Notepad_plus::isFileSession(const TCHAR * filename) {
// if file2open matches the ext of user defined session file ext, then it'll be opened as a session
const TCHAR *definedSessionExt = NppParameters::getInstance()->getNppGUI()._definedSessionExt.c_str();
if (*definedSessionExt != '\0')
{
generic_string fncp = filename;
TCHAR *pExt = PathFindExtension(fncp.c_str());
generic_string usrSessionExt = TEXT("");
if (*definedSessionExt != '.')
{
usrSessionExt += TEXT(".");
}
usrSessionExt += definedSessionExt;
if (!generic_stricmp(pExt, usrSessionExt.c_str()))
{
return true;
}
}
return false;
}
bool Notepad_plus::replaceAllFiles() {
@ -1465,7 +1302,7 @@ generic_string Notepad_plus::getLangDesc(LangType langType, bool shortDesc)
}
if (langType > L_EXTERNAL)
langType = L_TXT;
langType = L_TEXT;
generic_string str2Show = ScintillaEditView::langNames[langType].longName;
@ -2748,130 +2585,49 @@ void Notepad_plus::setLanguage(LangType langType) {
}
};
//NEW-2: 41 lines, 53 bytes code, 54 items: 108 bytes data = 161 bytes
#define LANG_MAP(x) { (IDM_LANG_##x - IDM_LANG), (L_##x) }
enum LangType Notepad_plus::menuID2LangType(int cmdID)
{
switch (cmdID)
{
case IDM_LANG_C :
return L_C;
case IDM_LANG_CPP :
return L_CPP;
case IDM_LANG_JAVA :
return L_JAVA;
case IDM_LANG_CS :
return L_CS;
case IDM_LANG_HTML :
return L_HTML;
case IDM_LANG_XML :
return L_XML;
case IDM_LANG_JS :
return L_JS;
case IDM_LANG_PHP :
return L_PHP;
case IDM_LANG_ASP :
return L_ASP;
case IDM_LANG_JSP :
return L_JSP;
case IDM_LANG_CSS :
return L_CSS;
case IDM_LANG_LUA :
return L_LUA;
case IDM_LANG_PERL :
return L_PERL;
case IDM_LANG_PYTHON :
return L_PYTHON;
case IDM_LANG_PASCAL :
return L_PASCAL;
case IDM_LANG_BATCH :
return L_BATCH;
case IDM_LANG_OBJC :
return L_OBJC;
case IDM_LANG_VB :
return L_VB;
case IDM_LANG_SQL :
return L_SQL;
case IDM_LANG_ASCII :
return L_NFO;
case IDM_LANG_TEXT :
return L_TXT;
case IDM_LANG_RC :
return L_RC;
case IDM_LANG_MAKEFILE :
return L_MAKEFILE;
case IDM_LANG_INI :
return L_INI;
case IDM_LANG_TEX :
return L_TEX;
case IDM_LANG_FORTRAN :
return L_FORTRAN;
case IDM_LANG_SH :
return L_BASH;
case IDM_LANG_FLASH :
return L_FLASH;
case IDM_LANG_NSIS :
return L_NSIS;
case IDM_LANG_TCL :
return L_TCL;
case IDM_LANG_LISP :
return L_LISP;
case IDM_LANG_SCHEME :
return L_SCHEME;
case IDM_LANG_ASM :
return L_ASM;
case IDM_LANG_DIFF :
return L_DIFF;
case IDM_LANG_PROPS :
return L_PROPS;
case IDM_LANG_PS:
return L_PS;
case IDM_LANG_RUBY:
return L_RUBY;
case IDM_LANG_SMALLTALK:
return L_SMALLTALK;
case IDM_LANG_VHDL :
return L_VHDL;
case IDM_LANG_KIX :
return L_KIX;
case IDM_LANG_CAML :
return L_CAML;
case IDM_LANG_ADA :
return L_ADA;
case IDM_LANG_VERILOG :
return L_VERILOG;
case IDM_LANG_MATLAB :
return L_MATLAB;
case IDM_LANG_HASKELL :
return L_HASKELL;
case IDM_LANG_AU3 :
return L_AU3;
case IDM_LANG_INNO :
return L_INNO;
case IDM_LANG_CMAKE :
return L_CMAKE;
case IDM_LANG_YAML :
return L_YAML;
case IDM_LANG_COBOL :
return L_COBOL;
case IDM_LANG_D :
return L_D;
case IDM_LANG_GUI4CLI :
return L_GUI4CLI;
case IDM_LANG_POWERSHELL :
return L_POWERSHELL;
case IDM_LANG_R :
return L_R;
static struct Mapping {
unsigned char mapFrom;
unsigned char mapTo;
} mappings[]= {
LANG_MAP(ADA), LANG_MAP(ASM), LANG_MAP(ASP),
LANG_MAP(AU3), LANG_MAP(BATCH), LANG_MAP(C),
LANG_MAP(CAML), LANG_MAP(CMAKE), LANG_MAP(COBOL),
LANG_MAP(CPP), LANG_MAP(CS), LANG_MAP(CSS),
LANG_MAP(D), LANG_MAP(DIFF), LANG_MAP(FLASH),
LANG_MAP(FORTRAN), LANG_MAP(GUI4CLI), LANG_MAP(HASKELL),
LANG_MAP(HTML), LANG_MAP(INI), LANG_MAP(INNO),
LANG_MAP(JAVA), LANG_MAP(JS), LANG_MAP(KIX),
LANG_MAP(LISP), LANG_MAP(LUA), LANG_MAP(MAKEFILE),
LANG_MAP(MATLAB), LANG_MAP(NSIS), LANG_MAP(OBJC),
LANG_MAP(PASCAL), LANG_MAP(PERL), LANG_MAP(PHP),
LANG_MAP(POWERSHELL), LANG_MAP(PROPS), LANG_MAP(PS),
LANG_MAP(PYTHON), LANG_MAP(R), LANG_MAP(RC),
LANG_MAP(RUBY), LANG_MAP(SCHEME), LANG_MAP(SMALLTALK),
LANG_MAP(SQL), LANG_MAP(TCL), LANG_MAP(TEX),
LANG_MAP(VB), LANG_MAP(VERILOG), LANG_MAP(VHDL),
LANG_MAP(XML), LANG_MAP(YAML), LANG_MAP(BASH),
LANG_MAP(ASCII), LANG_MAP(TEXT),
{ 0xFF, L_EXTERNAL }
};
case IDM_LANG_USER :
return L_USER;
default: {
if (cmdID >= IDM_LANG_USER && cmdID <= IDM_LANG_USER_LIMIT) {
return L_USER;
}
break; }
if (cmdID >= IDM_LANG_USER && cmdID <= IDM_LANG_USER_LIMIT)
return L_USER;
else
{
// scan mapping table - ends at L_EXTERNAL entry if not found.
Mapping *map;
for(map = mappings; map->mapFrom != 0xFF; ++map)
if((cmdID-IDM_LANG) == map->mapFrom) break;
return (LangType) (map->mapTo);
}
return L_EXTERNAL;
}
void Notepad_plus::setTitle()
{
const NppGUI & nppGUI = NppParameters::getInstance()->getNppGUI();
@ -5883,7 +5639,7 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
{
if (!wParam)
return FALSE;
if (lParam < L_TXT || lParam >= L_EXTERNAL || lParam == L_USER)
if (lParam < L_TEXT || lParam >= L_EXTERNAL || lParam == L_USER)
return FALSE;
BufferID id = (BufferID)wParam;

View File

@ -568,7 +568,7 @@ BEGIN
MENUITEM "R", IDM_LANG_R
MENUITEM "Resource file", IDM_LANG_RC
MENUITEM "Ruby", IDM_LANG_RUBY
MENUITEM "Shell", IDM_LANG_SH
MENUITEM "Shell", IDM_LANG_BASH
MENUITEM "Scheme", IDM_LANG_SCHEME
MENUITEM "Smalltalk", IDM_LANG_SMALLTALK
MENUITEM "SQL", IDM_LANG_SQL
@ -663,7 +663,7 @@ BEGIN
END
POPUP "S"
BEGIN
MENUITEM "Shell", IDM_LANG_SH
MENUITEM "Shell", IDM_LANG_BASH
MENUITEM "Scheme", IDM_LANG_SCHEME
MENUITEM "Smalltalk", IDM_LANG_SMALLTALK
MENUITEM "SQL", IDM_LANG_SQL

View File

@ -1664,7 +1664,7 @@ void Notepad_plus::command(int id)
case IDM_LANG_INI :
case IDM_LANG_TEX :
case IDM_LANG_FORTRAN :
case IDM_LANG_SH :
case IDM_LANG_BASH :
case IDM_LANG_FLASH :
case IDM_LANG_NSIS :
case IDM_LANG_TCL :

View File

@ -817,6 +817,175 @@ void Notepad_plus::fileOpen()
}
}
bool Notepad_plus::isFileSession(const TCHAR * filename) {
// if file2open matches the ext of user defined session file ext, then it'll be opened as a session
const TCHAR *definedSessionExt = NppParameters::getInstance()->getNppGUI()._definedSessionExt.c_str();
if (*definedSessionExt != '\0')
{
generic_string fncp = filename;
TCHAR *pExt = PathFindExtension(fncp.c_str());
generic_string usrSessionExt = TEXT("");
if (*definedSessionExt != '.')
{
usrSessionExt += TEXT(".");
}
usrSessionExt += definedSessionExt;
if (!generic_stricmp(pExt, usrSessionExt.c_str()))
{
return true;
}
}
return false;
}
// return true if all the session files are loaded
// return false if one or more sessions files fail to load (and session is modify to remove invalid files)
bool Notepad_plus::loadSession(Session & session)
{
bool allSessionFilesLoaded = true;
BufferID lastOpened = BUFFER_INVALID;
size_t i = 0;
showView(MAIN_VIEW);
switchEditViewTo(MAIN_VIEW); //open files in main
for ( ; i < session.nbMainFiles() ; )
{
const TCHAR *pFn = session._mainViewFiles[i]._fileName.c_str();
if (isFileSession(pFn)) {
vector<sessionFileInfo>::iterator posIt = session._mainViewFiles.begin() + i;
session._mainViewFiles.erase(posIt);
continue; //skip session files, not supporting recursive sessions
}
if (PathFileExists(pFn)) {
lastOpened = doOpen(pFn, false, session._mainViewFiles[i]._encoding);
} else {
lastOpened = BUFFER_INVALID;
}
if (lastOpened != BUFFER_INVALID)
{
showView(MAIN_VIEW);
const TCHAR *pLn = session._mainViewFiles[i]._langName.c_str();
int id = getLangFromMenuName(pLn);
LangType typeToSet = L_TEXT;
if (id != 0 && lstrcmp(pLn, TEXT("User Defined")) != 0)
typeToSet = menuID2LangType(id);
if (typeToSet == L_EXTERNAL )
typeToSet = (LangType)(id - IDM_LANG_EXTERNAL + L_EXTERNAL);
Buffer * buf = MainFileManager->getBufferByID(lastOpened);
buf->setPosition(session._mainViewFiles[i], &_mainEditView);
buf->setLangType(typeToSet, pLn);
if (session._mainViewFiles[i]._encoding != -1)
buf->setEncoding(session._mainViewFiles[i]._encoding);
//Force in the document so we can add the markers
//Dont use default methods because of performance
Document prevDoc = _mainEditView.execute(SCI_GETDOCPOINTER);
_mainEditView.execute(SCI_SETDOCPOINTER, 0, buf->getDocument());
for (size_t j = 0 ; j < session._mainViewFiles[i].marks.size() ; j++)
{
_mainEditView.execute(SCI_MARKERADD, session._mainViewFiles[i].marks[j], MARK_BOOKMARK);
}
_mainEditView.execute(SCI_SETDOCPOINTER, 0, prevDoc);
i++;
}
else
{
vector<sessionFileInfo>::iterator posIt = session._mainViewFiles.begin() + i;
session._mainViewFiles.erase(posIt);
allSessionFilesLoaded = false;
}
}
size_t k = 0;
showView(SUB_VIEW);
switchEditViewTo(SUB_VIEW); //open files in sub
for ( ; k < session.nbSubFiles() ; )
{
const TCHAR *pFn = session._subViewFiles[k]._fileName.c_str();
if (isFileSession(pFn)) {
vector<sessionFileInfo>::iterator posIt = session._subViewFiles.begin() + k;
session._subViewFiles.erase(posIt);
continue; //skip session files, not supporting recursive sessions
}
if (PathFileExists(pFn)) {
lastOpened = doOpen(pFn, false, session._subViewFiles[k]._encoding);
//check if already open in main. If so, clone
if (_mainDocTab.getIndexByBuffer(lastOpened) != -1) {
loadBufferIntoView(lastOpened, SUB_VIEW);
}
} else {
lastOpened = BUFFER_INVALID;
}
if (lastOpened != BUFFER_INVALID)
{
showView(SUB_VIEW);
if (canHideView(MAIN_VIEW))
hideView(MAIN_VIEW);
const TCHAR *pLn = session._subViewFiles[k]._langName.c_str();
int id = getLangFromMenuName(pLn);
LangType typeToSet = L_TEXT;
if (id != 0)
typeToSet = menuID2LangType(id);
if (typeToSet == L_EXTERNAL )
typeToSet = (LangType)(id - IDM_LANG_EXTERNAL + L_EXTERNAL);
Buffer * buf = MainFileManager->getBufferByID(lastOpened);
buf->setPosition(session._subViewFiles[k], &_subEditView);
if (typeToSet == L_USER) {
if (!lstrcmp(pLn, TEXT("User Defined"))) {
pLn = TEXT(""); //default user defined
}
}
buf->setLangType(typeToSet, pLn);
buf->setEncoding(session._subViewFiles[k]._encoding);
//Force in the document so we can add the markers
//Dont use default methods because of performance
Document prevDoc = _subEditView.execute(SCI_GETDOCPOINTER);
_subEditView.execute(SCI_SETDOCPOINTER, 0, buf->getDocument());
for (size_t j = 0 ; j < session._subViewFiles[k].marks.size() ; j++)
{
_subEditView.execute(SCI_MARKERADD, session._subViewFiles[k].marks[j], MARK_BOOKMARK);
}
_subEditView.execute(SCI_SETDOCPOINTER, 0, prevDoc);
k++;
}
else
{
vector<sessionFileInfo>::iterator posIt = session._subViewFiles.begin() + k;
session._subViewFiles.erase(posIt);
allSessionFilesLoaded = false;
}
}
_mainEditView.restoreCurrentPos();
_subEditView.restoreCurrentPos();
if (session._activeMainIndex < (size_t)_mainDocTab.nbItem())//session.nbMainFiles())
activateBuffer(_mainDocTab.getBufferByIndex(session._activeMainIndex), MAIN_VIEW);
if (session._activeSubIndex < (size_t)_subDocTab.nbItem())//session.nbSubFiles())
activateBuffer(_subDocTab.getBufferByIndex(session._activeSubIndex), SUB_VIEW);
if ((session.nbSubFiles() > 0) && (session._activeView == MAIN_VIEW || session._activeView == SUB_VIEW))
switchEditViewTo(session._activeView);
else
switchEditViewTo(MAIN_VIEW);
if (canHideView(otherView()))
hideView(otherView());
else if (canHideView(currentView()))
hideView(currentView());
return allSessionFilesLoaded;
}
bool Notepad_plus::fileLoadSession(const TCHAR *fn)
{
bool result = false;

View File

@ -2068,7 +2068,7 @@ LangType NppParameters::getLangFromExt(const TCHAR *ext)
if (isInList(ext, list.c_str()))
return l->getLangID();
}
return L_TXT;
return L_TEXT;
}
void NppParameters::writeUserDefinedLang()
@ -2621,7 +2621,7 @@ TiXmlNode * NppParameters::getChildElementByAttribut(TiXmlNode *pere, const TCHA
// 2 restes : L_H, L_USER
LangType NppParameters::getLangIDFromStr(const TCHAR *langName)
{
int lang = (int)L_TXT;
int lang = (int)L_TEXT;
for(; lang < L_EXTERNAL; lang++) {
const TCHAR * name = ScintillaEditView::langNames[lang].lexerName;
if (!lstrcmp(name, langName)) { //found lang?
@ -2637,7 +2637,7 @@ LangType NppParameters::getLangIDFromStr(const TCHAR *langName)
if (id != -1) return (LangType)(id + L_EXTERNAL);
}
return L_TXT;
return L_TEXT;
}
void NppParameters::feedKeyWordsParameters(TiXmlNode *node)
@ -4608,7 +4608,7 @@ int NppParameters::langTypeToCommandID(LangType lt) const
id = IDM_LANG_MAKEFILE; break;
case L_INI :
id = IDM_LANG_INI; break;
case L_NFO :
case L_ASCII :
id = IDM_LANG_ASCII; break;
case L_RC :
id = IDM_LANG_RC; break;
@ -4617,7 +4617,7 @@ int NppParameters::langTypeToCommandID(LangType lt) const
case L_FORTRAN :
id = IDM_LANG_FORTRAN; break;
case L_BASH :
id = IDM_LANG_SH; break;
id = IDM_LANG_BASH; break;
case L_FLASH :
id = IDM_LANG_FLASH; break;
case L_NSIS :
@ -4694,7 +4694,7 @@ int NppParameters::langTypeToCommandID(LangType lt) const
case L_SEARCHRESULT :
id = -1; break;
case L_TXT :
case L_TEXT :
id = IDM_LANG_TEXT; break;
default :

View File

@ -477,7 +477,7 @@ struct NewDocDefaultSettings
UniMode _encoding;
bool _openAnsiAsUtf8;
LangType _lang;
NewDocDefaultSettings():_format(WIN_FORMAT), _encoding(uni8Bit), _openAnsiAsUtf8(false), _lang(L_TXT){};
NewDocDefaultSettings():_format(WIN_FORMAT), _encoding(uni8Bit), _openAnsiAsUtf8(false), _lang(L_TEXT){};
};
struct LangMenuItem {
@ -795,7 +795,7 @@ struct Lang
bool _isTabReplacedBySpace;
int _tabSize;
Lang(): _langID(L_TXT), _langName(TEXT("")), _defaultExtList(NULL), _pCommentLineSymbol(NULL), _pCommentStart(NULL),
Lang(): _langID(L_TEXT), _langName(TEXT("")), _defaultExtList(NULL), _pCommentLineSymbol(NULL), _pCommentStart(NULL),
_pCommentEnd(NULL), _isTabReplacedBySpace(false), _tabSize(-1) {
for (int i = 0 ; i < NB_LIST ; _langKeyWordList[i] = NULL ,i++);
};

View File

@ -29,7 +29,7 @@ static bool isInList(generic_string word, const vector<generic_string> & wordArr
};
AutoCompletion::AutoCompletion(ScintillaEditView * pEditView) : _funcCompletionActive(false), _pEditView(pEditView), _funcCalltip(pEditView),
_curLang(L_TXT), _XmlFile(TEXT("")), _activeCompletion(CompletionNone),
_curLang(L_TEXT), _XmlFile(TEXT("")), _activeCompletion(CompletionNone),
_pXmlKeyword(NULL), _ignoreCase(true), _keyWords(TEXT(""))
{
//Do not load any language yet
@ -309,7 +309,7 @@ const TCHAR * AutoCompletion::getApiFileName() {
return NppParameters::getInstance()->getELCFromIndex(_curLang - L_EXTERNAL)._name;
if (_curLang > L_EXTERNAL)
_curLang = L_TXT;
_curLang = L_TEXT;
return ScintillaEditView::langNames[_curLang].lexerName;

View File

@ -117,7 +117,7 @@ void Buffer::setFileName(const TCHAR *fn, LangType defaultLang)
}
}
if (newLang == defaultLang || newLang == L_TXT) //language can probably be refined
if (newLang == defaultLang || newLang == L_TEXT) //language can probably be refined
{
if ((!generic_stricmp(_fileName, TEXT("makefile"))) || (!generic_stricmp(_fileName, TEXT("GNUmakefile"))))
newLang = L_MAKEFILE;
@ -389,7 +389,7 @@ BufferID FileManager::loadFile(const TCHAR * filename, Document doc, int encodin
Utf8_16_Read UnicodeConvertor; //declare here so we can get information after loading is done
formatType format;
bool res = loadFileData(doc, fullpath, &UnicodeConvertor, L_TXT, encoding, &format);
bool res = loadFileData(doc, fullpath, &UnicodeConvertor, L_TEXT, encoding, &format);
if (res)
{
Buffer * newBuf = new Buffer(this, _nextBufferID, doc, DOC_REGULAR, fullpath);

View File

@ -143,7 +143,7 @@ public :
// this method 1. copies the file name
// 2. determinates the language from the ext of file name
// 3. gets the last modified time
void setFileName(const TCHAR *fn, LangType defaultLang = L_TXT);
void setFileName(const TCHAR *fn, LangType defaultLang = L_TEXT);
const TCHAR * getFullPathName() const {
return _fullPathName.c_str();

View File

@ -54,7 +54,7 @@ const int ScintillaEditView::_markersArray[][NB_FOLDER_STATE] = {
//Array with all the names of all languages
LanguageName ScintillaEditView::langNames[L_EXTERNAL+1] = {
{TEXT("normal"), TEXT("Normal text"), TEXT("Normal text file"), L_TXT, SCLEX_NULL},
{TEXT("normal"), TEXT("Normal text"), TEXT("Normal text file"), L_TEXT, SCLEX_NULL},
{TEXT("php"), TEXT("PHP"), TEXT("PHP Hypertext Preprocessor file"), L_PHP, SCLEX_HTML},
{TEXT("c"), TEXT("C"), TEXT("C source file"), L_C, SCLEX_CPP},
{TEXT("cpp"), TEXT("C++"), TEXT("C++ source file"), L_CPP, SCLEX_CPP},
@ -68,7 +68,7 @@ LanguageName ScintillaEditView::langNames[L_EXTERNAL+1] = {
{TEXT("pascal"), TEXT("Pascal"), TEXT("Pascal source file"), L_PASCAL, SCLEX_PASCAL},
{TEXT("batch"), TEXT("Batch"), TEXT("Batch file"), L_BATCH, SCLEX_BATCH},
{TEXT("ini"), TEXT("ini"), TEXT("MS ini file"), L_INI, SCLEX_PROPERTIES},
{TEXT("nfo"), TEXT("NFO"), TEXT("MSDOS Style/ASCII Art"), L_NFO, SCLEX_NULL},
{TEXT("nfo"), TEXT("NFO"), TEXT("MSDOS Style/ASCII Art"), L_ASCII, SCLEX_NULL},
{TEXT("udf"), TEXT("udf"), TEXT("User Define File"), L_USER, SCLEX_USER},
{TEXT("asp"), TEXT("ASP"), TEXT("Active Server Pages script file"), L_ASP, SCLEX_HTML},
{TEXT("sql"), TEXT("SQL"), TEXT("Structured Query Language file"), L_SQL, SCLEX_SQL},
@ -1141,7 +1141,7 @@ void ScintillaEditView::defineDocType(LangType typeDoc)
setUserLexer();
break; }
case L_NFO :
case L_ASCII :
{
LexerStyler *pStyler = (_pParameter->getLStylerArray()).getLexerStylerByName(TEXT("nfo"));
@ -1275,7 +1275,7 @@ void ScintillaEditView::defineDocType(LangType typeDoc)
case L_R :
setRLexer(); break;
case L_TXT :
case L_TEXT :
default :
if (typeDoc >= L_EXTERNAL && typeDoc < NppParameters::getInstance()->L_END)
setExternalLexer(typeDoc);

View File

@ -831,11 +831,10 @@ protected:
bool isNeededFolderMarge(LangType typeDoc) const {
switch (typeDoc)
{
case L_NFO:
case L_ASCII:
case L_BATCH:
case L_TXT:
case L_TEXT:
case L_MAKEFILE:
//case L_SQL:
case L_ASM:
case L_HASKELL:
case L_PROPS:

View File

@ -794,7 +794,7 @@ void WordStyleDlg::setVisualFromStyleList()
NppParameters *pNppParams = NppParameters::getInstance();
LangType lType = pNppParams->getLangIDFromStr(lexerStyler.getLexerName());
if (lType == L_TXT)
if (lType == L_TEXT)
{
generic_string str = lexerStyler.getLexerName();
str += TEXT(" is not defined in NppParameters::getLangIDFromStr()");

View File

@ -868,7 +868,7 @@ BOOL CALLBACK DefaultNewDocDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
::SendDlgItemMessage(_hSelf, IDC_CHECK_OPENANSIASUTF8, BM_SETCHECK, (ID2Check == IDC_RADIO_UTF8SANSBOM && ndds._openAnsiAsUtf8)?BST_CHECKED:BST_UNCHECKED, 0);
::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_OPENANSIASUTF8), ID2Check == IDC_RADIO_UTF8SANSBOM);
int index = 0;
for (int i = L_TXT ; i < pNppParam->L_END ; i++)
for (int i = L_TEXT ; i < pNppParam->L_END ; i++)
{
generic_string str;
if ((LangType)i != L_USER)
@ -1044,7 +1044,7 @@ BOOL CALLBACK LangMenuDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPara
::EnableWindow(::GetDlgItem(_hSelf, IDC_TABSIZEVAL_DISABLE_STATIC), FALSE);
::ShowWindow(::GetDlgItem(_hSelf, IDC_TABSIZEVAL_DISABLE_STATIC), SW_HIDE);
for (int i = L_TXT ; i < pNppParam->L_END ; i++)
for (int i = L_TEXT ; i < pNppParam->L_END ; i++)
{
generic_string str;
if ((LangType)i != L_USER)

View File

@ -325,7 +325,7 @@
#define IDM_LANG_LUA (IDM_LANG + 24)
#define IDM_LANG_TEX (IDM_LANG + 25)
#define IDM_LANG_FORTRAN (IDM_LANG + 26)
#define IDM_LANG_SH (IDM_LANG + 27)
#define IDM_LANG_BASH (IDM_LANG + 27)
#define IDM_LANG_FLASH (IDM_LANG + 28)
#define IDM_LANG_NSIS (IDM_LANG + 29)
#define IDM_LANG_TCL (IDM_LANG + 30)