Remove ambiguous symbols (part 7)

Relace TCHAR, generic_string & TEXT("") par wchar_t, wstring & L"" respectively.
Follow up: 94af271

Close #15381
pull/15385/head
Don Ho 2024-07-01 04:56:43 +02:00
parent f7d9e7c095
commit 88bd09e67d
8 changed files with 417 additions and 417 deletions

View File

@ -67,101 +67,101 @@ const int ScintillaEditView::_markersArray[][NB_FOLDER_STATE] = {
// The order of lang type (enum LangType) must be respected // The order of lang type (enum LangType) must be respected
LanguageNameInfo ScintillaEditView::_langNameInfoArray[L_EXTERNAL + 1] = { LanguageNameInfo ScintillaEditView::_langNameInfoArray[L_EXTERNAL + 1] = {
// //
// _langName _shortName _longName _langID _lexerID //_langName _shortName _longName _langID _lexerID
// //
{L"normal", L"Normal text", L"Normal text file", L_TEXT, "null"}, {L"normal", L"Normal text", L"Normal text file", L_TEXT, "null"},
{L"php", L"PHP", L"PHP Hypertext Preprocessor file", L_PHP, "phpscript"}, {L"php", L"PHP", L"PHP Hypertext Preprocessor file", L_PHP, "phpscript"},
{L"c", L"C", L"C source file", L_C, "cpp"}, {L"c", L"C", L"C source file", L_C, "cpp"},
{L"cpp", L"C++", L"C++ source file", L_CPP, "cpp"}, {L"cpp", L"C++", L"C++ source file", L_CPP, "cpp"},
{L"cs", L"C#", L"C# source file", L_CS, "cpp"}, {L"cs", L"C#", L"C# source file", L_CS, "cpp"},
{L"objc", L"Objective-C", L"Objective-C source file", L_OBJC, "objc"}, {L"objc", L"Objective-C", L"Objective-C source file", L_OBJC, "objc"},
{L"java", L"Java", L"Java source file", L_JAVA, "cpp"}, {L"java", L"Java", L"Java source file", L_JAVA, "cpp"},
{L"rc", L"RC", L"Windows Resource file", L_RC, "cpp"}, {L"rc", L"RC", L"Windows Resource file", L_RC, "cpp"},
{L"html", L"HTML", L"Hyper Text Markup Language file", L_HTML, "hypertext"}, {L"html", L"HTML", L"Hyper Text Markup Language file", L_HTML, "hypertext"},
{L"xml", L"XML", L"eXtensible Markup Language file", L_XML, "xml"}, {L"xml", L"XML", L"eXtensible Markup Language file", L_XML, "xml"},
{L"makefile", L"Makefile", L"Makefile", L_MAKEFILE, "makefile"}, {L"makefile", L"Makefile", L"Makefile", L_MAKEFILE, "makefile"},
{L"pascal", L"Pascal", L"Pascal source file", L_PASCAL, "pascal"}, {L"pascal", L"Pascal", L"Pascal source file", L_PASCAL, "pascal"},
{L"batch", L"Batch", L"Batch file", L_BATCH, "batch"}, {L"batch", L"Batch", L"Batch file", L_BATCH, "batch"},
{L"ini", L"ini", L"MS ini file", L_INI, "props"}, {L"ini", L"ini", L"MS ini file", L_INI, "props"},
{L"nfo", L"NFO", L"MSDOS Style/ASCII Art", L_ASCII, "null"}, {L"nfo", L"NFO", L"MSDOS Style/ASCII Art", L_ASCII, "null"},
{L"udf", L"udf", L"User Defined language file", L_USER, "user"}, {L"udf", L"udf", L"User Defined language file", L_USER, "user"},
{L"asp", L"ASP", L"Active Server Pages script file", L_ASP, "hypertext"}, {L"asp", L"ASP", L"Active Server Pages script file", L_ASP, "hypertext"},
{L"sql", L"SQL", L"Structured Query Language file", L_SQL, "sql"}, {L"sql", L"SQL", L"Structured Query Language file", L_SQL, "sql"},
{L"vb", L"Visual Basic", L"Visual Basic file", L_VB, "vb"}, {L"vb", L"Visual Basic", L"Visual Basic file", L_VB, "vb"},
{L"javascript", L"JavaScript", L"JavaScript file", L_JS, "cpp"}, {L"javascript", L"JavaScript", L"JavaScript file", L_JS, "cpp"},
{L"css", L"CSS", L"Cascade Style Sheets File", L_CSS, "css"}, {L"css", L"CSS", L"Cascade Style Sheets File", L_CSS, "css"},
{L"perl", L"Perl", L"Perl source file", L_PERL, "perl"}, {L"perl", L"Perl", L"Perl source file", L_PERL, "perl"},
{L"python", L"Python", L"Python file", L_PYTHON, "python"}, {L"python", L"Python", L"Python file", L_PYTHON, "python"},
{L"lua", L"Lua", L"Lua source File", L_LUA, "lua"}, {L"lua", L"Lua", L"Lua source File", L_LUA, "lua"},
{L"tex", L"TeX", L"TeX file", L_TEX, "tex"}, {L"tex", L"TeX", L"TeX file", L_TEX, "tex"},
{L"fortran", L"Fortran free form", L"Fortran free form source file", L_FORTRAN, "fortran"}, {L"fortran", L"Fortran free form", L"Fortran free form source file", L_FORTRAN, "fortran"},
{L"bash", L"Shell", L"Unix script file", L_BASH, "bash"}, {L"bash", L"Shell", L"Unix script file", L_BASH, "bash"},
{L"actionscript", L"ActionScript", L"Flash ActionScript file", L_FLASH, "cpp"}, {L"actionscript", L"ActionScript", L"Flash ActionScript file", L_FLASH, "cpp"},
{L"nsis", L"NSIS", L"Nullsoft Scriptable Install System script file", L_NSIS, "nsis"}, {L"nsis", L"NSIS", L"Nullsoft Scriptable Install System script file", L_NSIS, "nsis"},
{L"tcl", L"TCL", L"Tool Command Language file", L_TCL, "tcl"}, {L"tcl", L"TCL", L"Tool Command Language file", L_TCL, "tcl"},
{L"lisp", L"Lisp", L"List Processing language file", L_LISP, "lisp"}, {L"lisp", L"Lisp", L"List Processing language file", L_LISP, "lisp"},
{L"scheme", L"Scheme", L"Scheme file", L_SCHEME, "lisp"}, {L"scheme", L"Scheme", L"Scheme file", L_SCHEME, "lisp"},
{L"asm", L"Assembly", L"Assembly language source file", L_ASM, "asm"}, {L"asm", L"Assembly", L"Assembly language source file", L_ASM, "asm"},
{L"diff", L"Diff", L"Diff file", L_DIFF, "diff"}, {L"diff", L"Diff", L"Diff file", L_DIFF, "diff"},
{L"props", L"Properties file", L"Properties file", L_PROPS, "props"}, {L"props", L"Properties file", L"Properties file", L_PROPS, "props"},
{L"postscript", L"PostScript", L"PostScript file", L_PS, "ps"}, {L"postscript", L"PostScript", L"PostScript file", L_PS, "ps"},
{L"ruby", L"Ruby", L"Ruby file", L_RUBY, "ruby"}, {L"ruby", L"Ruby", L"Ruby file", L_RUBY, "ruby"},
{L"smalltalk", L"Smalltalk", L"Smalltalk file", L_SMALLTALK, "smalltalk"}, {L"smalltalk", L"Smalltalk", L"Smalltalk file", L_SMALLTALK, "smalltalk"},
{L"vhdl", L"VHDL", L"VHSIC Hardware Description Language file", L_VHDL, "vhdl"}, {L"vhdl", L"VHDL", L"VHSIC Hardware Description Language file", L_VHDL, "vhdl"},
{L"kix", L"KiXtart", L"KiXtart file", L_KIX, "kix"}, {L"kix", L"KiXtart", L"KiXtart file", L_KIX, "kix"},
{L"autoit", L"AutoIt", L"AutoIt", L_AU3, "au3"}, {L"autoit", L"AutoIt", L"AutoIt", L_AU3, "au3"},
{L"caml", L"CAML", L"Categorical Abstract Machine Language", L_CAML, "caml"}, {L"caml", L"CAML", L"Categorical Abstract Machine Language", L_CAML, "caml"},
{L"ada", L"Ada", L"Ada file", L_ADA, "ada"}, {L"ada", L"Ada", L"Ada file", L_ADA, "ada"},
{L"verilog", L"Verilog", L"Verilog file", L_VERILOG, "verilog"}, {L"verilog", L"Verilog", L"Verilog file", L_VERILOG, "verilog"},
{L"matlab", L"MATLAB", L"MATrix LABoratory", L_MATLAB, "matlab"}, {L"matlab", L"MATLAB", L"MATrix LABoratory", L_MATLAB, "matlab"},
{L"haskell", L"Haskell", L"Haskell", L_HASKELL, "haskell"}, {L"haskell", L"Haskell", L"Haskell", L_HASKELL, "haskell"},
{L"inno", L"Inno Setup", L"Inno Setup script", L_INNO, "inno"}, {L"inno", L"Inno Setup", L"Inno Setup script", L_INNO, "inno"},
{L"searchResult", L"Internal Search", L"Internal Search", L_SEARCHRESULT, "searchResult"}, {L"searchResult", L"Internal Search", L"Internal Search", L_SEARCHRESULT, "searchResult"},
{L"cmake", L"CMake", L"CMake file", L_CMAKE, "cmake"}, {L"cmake", L"CMake", L"CMake file", L_CMAKE, "cmake"},
{L"yaml", L"YAML", L"YAML Ain't Markup Language", L_YAML, "yaml"}, {L"yaml", L"YAML", L"YAML Ain't Markup Language", L_YAML, "yaml"},
{L"cobol", L"COBOL", L"COmmon Business Oriented Language", L_COBOL, "COBOL"}, {L"cobol", L"COBOL", L"COmmon Business Oriented Language", L_COBOL, "COBOL"},
{L"gui4cli", L"Gui4Cli", L"Gui4Cli file", L_GUI4CLI, "gui4cli"}, {L"gui4cli", L"Gui4Cli", L"Gui4Cli file", L_GUI4CLI, "gui4cli"},
{L"d", L"D", L"D programming language", L_D, "d"}, {L"d", L"D", L"D programming language", L_D, "d"},
{L"powershell", L"PowerShell", L"Windows PowerShell", L_POWERSHELL, "powershell"}, {L"powershell", L"PowerShell", L"Windows PowerShell", L_POWERSHELL, "powershell"},
{L"r", L"R", L"R programming language", L_R, "r"}, {L"r", L"R", L"R programming language", L_R, "r"},
{L"jsp", L"JSP", L"JavaServer Pages script file", L_JSP, "hypertext"}, {L"jsp", L"JSP", L"JavaServer Pages script file", L_JSP, "hypertext"},
{L"coffeescript", L"CoffeeScript", L"CoffeeScript file", L_COFFEESCRIPT, "coffeescript"}, {L"coffeescript", L"CoffeeScript", L"CoffeeScript file", L_COFFEESCRIPT, "coffeescript"},
{L"json", L"json", L"JSON file", L_JSON, "json"}, {L"json", L"json", L"JSON file", L_JSON, "json"},
{L"javascript.js", L"JavaScript", L"JavaScript file", L_JAVASCRIPT, "cpp"}, {L"javascript.js", L"JavaScript", L"JavaScript file", L_JAVASCRIPT, "cpp"},
{L"fortran77", L"Fortran fixed form", L"Fortran fixed form source file", L_FORTRAN_77, "f77"}, {L"fortran77", L"Fortran fixed form", L"Fortran fixed form source file", L_FORTRAN_77, "f77"},
{L"baanc", L"BaanC", L"BaanC File", L_BAANC, "baan"}, {L"baanc", L"BaanC", L"BaanC File", L_BAANC, "baan"},
{L"srec", L"S-Record", L"Motorola S-Record binary data", L_SREC, "srec"}, {L"srec", L"S-Record", L"Motorola S-Record binary data", L_SREC, "srec"},
{L"ihex", L"Intel HEX", L"Intel HEX binary data", L_IHEX, "ihex"}, {L"ihex", L"Intel HEX", L"Intel HEX binary data", L_IHEX, "ihex"},
{L"tehex", L"Tektronix extended HEX", L"Tektronix extended HEX binary data", L_TEHEX, "tehex"}, {L"tehex", L"Tektronix extended HEX", L"Tektronix extended HEX binary data", L_TEHEX, "tehex"},
{L"swift", L"Swift", L"Swift file", L_SWIFT, "cpp"}, {L"swift", L"Swift", L"Swift file", L_SWIFT, "cpp"},
{L"asn1", L"ASN.1", L"Abstract Syntax Notation One file", L_ASN1, "asn1"}, {L"asn1", L"ASN.1", L"Abstract Syntax Notation One file", L_ASN1, "asn1"},
{L"avs", L"AviSynth", L"AviSynth scripts files", L_AVS, "avs"}, {L"avs", L"AviSynth", L"AviSynth scripts files", L_AVS, "avs"},
{L"blitzbasic", L"BlitzBasic", L"BlitzBasic file", L_BLITZBASIC, "blitzbasic"}, {L"blitzbasic", L"BlitzBasic", L"BlitzBasic file", L_BLITZBASIC, "blitzbasic"},
{L"purebasic", L"PureBasic", L"PureBasic file", L_PUREBASIC, "purebasic"}, {L"purebasic", L"PureBasic", L"PureBasic file", L_PUREBASIC, "purebasic"},
{L"freebasic", L"FreeBasic", L"FreeBasic file", L_FREEBASIC, "freebasic"}, {L"freebasic", L"FreeBasic", L"FreeBasic file", L_FREEBASIC, "freebasic"},
{L"csound", L"Csound", L"Csound file", L_CSOUND, "csound"}, {L"csound", L"Csound", L"Csound file", L_CSOUND, "csound"},
{L"erlang", L"Erlang", L"Erlang file", L_ERLANG, "erlang"}, {L"erlang", L"Erlang", L"Erlang file", L_ERLANG, "erlang"},
{L"escript", L"ESCRIPT", L"ESCRIPT file", L_ESCRIPT, "escript"}, {L"escript", L"ESCRIPT", L"ESCRIPT file", L_ESCRIPT, "escript"},
{L"forth", L"Forth", L"Forth file", L_FORTH, "forth"}, {L"forth", L"Forth", L"Forth file", L_FORTH, "forth"},
{L"latex", L"LaTeX", L"LaTeX file", L_LATEX, "latex"}, {L"latex", L"LaTeX", L"LaTeX file", L_LATEX, "latex"},
{L"mmixal", L"MMIXAL", L"MMIXAL file", L_MMIXAL, "mmixal"}, {L"mmixal", L"MMIXAL", L"MMIXAL file", L_MMIXAL, "mmixal"},
{L"nim", L"Nim", L"Nim file", L_NIM, "nimrod"}, {L"nim", L"Nim", L"Nim file", L_NIM, "nimrod"},
{L"nncrontab", L"Nncrontab", L"extended crontab file", L_NNCRONTAB, "nncrontab"}, {L"nncrontab", L"Nncrontab", L"extended crontab file", L_NNCRONTAB, "nncrontab"},
{L"oscript", L"OScript", L"OScript source file", L_OSCRIPT, "oscript"}, {L"oscript", L"OScript", L"OScript source file", L_OSCRIPT, "oscript"},
{L"rebol", L"REBOL", L"REBOL file", L_REBOL, "rebol"}, {L"rebol", L"REBOL", L"REBOL file", L_REBOL, "rebol"},
{L"registry", L"registry", L"registry file", L_REGISTRY, "registry"}, {L"registry", L"registry", L"registry file", L_REGISTRY, "registry"},
{L"rust", L"Rust", L"Rust file", L_RUST, "rust"}, {L"rust", L"Rust", L"Rust file", L_RUST, "rust"},
{L"spice", L"Spice", L"spice file", L_SPICE, "spice"}, {L"spice", L"Spice", L"spice file", L_SPICE, "spice"},
{L"txt2tags", L"txt2tags", L"txt2tags file", L_TXT2TAGS, "txt2tags"}, {L"txt2tags", L"txt2tags", L"txt2tags file", L_TXT2TAGS, "txt2tags"},
{L"visualprolog", L"Visual Prolog", L"Visual Prolog file", L_VISUALPROLOG, "visualprolog"}, {L"visualprolog", L"Visual Prolog", L"Visual Prolog file", L_VISUALPROLOG, "visualprolog"},
{L"typescript", L"TypeScript", L"TypeScript file", L_TYPESCRIPT, "cpp"}, {L"typescript", L"TypeScript", L"TypeScript file", L_TYPESCRIPT, "cpp"},
{L"json5", L"json5", L"JSON5 file", L_JSON5, "json"}, {L"json5", L"json5", L"JSON5 file", L_JSON5, "json"},
{L"mssql", L"mssql", L"Microsoft Transact-SQL (SQL Server) file", L_MSSQL, "mssql"}, {L"mssql", L"mssql", L"Microsoft Transact-SQL (SQL Server) file", L_MSSQL, "mssql"},
{L"gdscript", L"GDScript", L"GDScript file", L_GDSCRIPT, "gdscript"}, {L"gdscript", L"GDScript", L"GDScript file", L_GDSCRIPT, "gdscript"},
{L"hollywood", L"Hollywood", L"Hollywood script", L_HOLLYWOOD, "hollywood"}, {L"hollywood", L"Hollywood", L"Hollywood script", L_HOLLYWOOD, "hollywood"},
{L"go", L"Go", L"Go source file", L_GOLANG, "cpp"}, {L"go", L"Go", L"Go source file", L_GOLANG, "cpp"},
{L"raku", L"Raku", L"Raku source file", L_RAKU, "raku"}, {L"raku", L"Raku", L"Raku source file", L_RAKU, "raku"},
{L"ext", L"External", L"External", L_EXTERNAL, "null"} {L"ext", L"External", L"External", L_EXTERNAL, "null"}
}; };

View File

@ -778,7 +778,7 @@ bool TiXmlDocumentA::LoadUnicodeFilePath( const TCHAR* filename )
if ( file ) if ( file )
{ {
// Get the file size, so we can pre-allocate the generic_string. HUGE speed impact. // Get the file size, so we can pre-allocate the string. HUGE speed impact.
long length = 0; long length = 0;
fseek( file, 0, SEEK_END ); fseek( file, 0, SEEK_END );
length = ftell( file ); length = ftell( file );

View File

@ -28,7 +28,7 @@ distribution.
#include "tinystr.h" #include "tinystr.h"
// TiXmlString constructor, based on a C generic_string // TiXmlString constructor, based on a C string
TiXmlString::TiXmlString (const TCHAR* instring) TiXmlString::TiXmlString (const TCHAR* instring)
{ {
unsigned newlen; unsigned newlen;
@ -168,7 +168,7 @@ void TiXmlString::append( const TCHAR* str, int len )
} }
else else
{ {
// we know we can safely append the new generic_string // we know we can safely append the new string
// strncat (cstring, str, len); // strncat (cstring, str, len);
memcpy (cstring + length (), memcpy (cstring + length (),
str, str,
@ -215,7 +215,7 @@ void TiXmlString::append( const TCHAR * suffix )
} }
else else
{ {
// we know we can safely append the new generic_string // we know we can safely append the new string
memcpy (cstring + length (), memcpy (cstring + length (),
suffix, suffix,
lstrlen (suffix) + 1); lstrlen (suffix) + 1);

View File

@ -39,12 +39,12 @@ distribution.
Its purpose is to allow compiling TinyXML on compilers with no or poor STL support. Its purpose is to allow compiling TinyXML on compilers with no or poor STL support.
Only the member functions relevant to the TinyXML project have been implemented. Only the member functions relevant to the TinyXML project have been implemented.
The buffer allocation is made by a simplistic power of 2 like mechanism : if we increase The buffer allocation is made by a simplistic power of 2 like mechanism : if we increase
a generic_string and there's no more room, we allocate a buffer twice as big as we need. a string and there's no more room, we allocate a buffer twice as big as we need.
*/ */
class TiXmlString class TiXmlString
{ {
public : public :
// TiXmlString constructor, based on a generic_string // TiXmlString constructor, based on a string
TiXmlString (const TCHAR * instring); TiXmlString (const TCHAR * instring);
// TiXmlString empty constructor // TiXmlString empty constructor
@ -126,13 +126,13 @@ class TiXmlString
return cstring [index]; return cstring [index];
} }
// find a TCHAR in a generic_string. Return TiXmlString::notfound if not found // find a char in a string. Return TiXmlString::notfound if not found
unsigned find (TCHAR lookup) const unsigned find (TCHAR lookup) const
{ {
return find (lookup, 0); return find (lookup, 0);
} }
// find a TCHAR in a generic_string from an offset. Return TiXmlString::notfound if not found // find a char in a string from an offset. Return TiXmlString::notfound if not found
unsigned find (TCHAR tofind, unsigned offset) const; unsigned find (TCHAR tofind, unsigned offset) const;
/* Function to reserve a big amount of data when we know we'll need it. Be aware that this /* Function to reserve a big amount of data when we know we'll need it. Be aware that this
@ -165,11 +165,11 @@ class TiXmlString
protected : protected :
// The base generic_string // The base string
TCHAR * cstring; TCHAR * cstring;
// Number of chars allocated // Number of chars allocated
unsigned allocated; unsigned allocated;
// Current generic_string size // Current string size
unsigned current_length; unsigned current_length;
// New size computation. It is simplistic right now : it returns twice the amount // New size computation. It is simplistic right now : it returns twice the amount

View File

@ -30,7 +30,7 @@ FunctionParsersManager::~FunctionParsersManager()
} }
} }
bool FunctionParsersManager::init(const generic_string& xmlDirPath, const generic_string& xmlInstalledPath, ScintillaEditView ** ppEditView) bool FunctionParsersManager::init(const wstring& xmlDirPath, const wstring& xmlInstalledPath, ScintillaEditView ** ppEditView)
{ {
_ppEditView = ppEditView; _ppEditView = ppEditView;
_xmlDirPath = xmlDirPath; _xmlDirPath = xmlDirPath;
@ -45,56 +45,56 @@ bool FunctionParsersManager::init(const generic_string& xmlDirPath, const generi
return false; return false;
} }
bool FunctionParsersManager::getZonePaserParameters(TiXmlNode *classRangeParser, generic_string &mainExprStr, generic_string &openSymboleStr, generic_string &closeSymboleStr, std::vector<generic_string> &classNameExprArray, generic_string &functionExprStr, std::vector<generic_string> &functionNameExprArray) bool FunctionParsersManager::getZonePaserParameters(TiXmlNode *classRangeParser, wstring &mainExprStr, wstring &openSymboleStr, wstring &closeSymboleStr, std::vector<wstring> &classNameExprArray, wstring &functionExprStr, std::vector<wstring> &functionNameExprArray)
{ {
const TCHAR *mainExpr = NULL; const wchar_t *mainExpr = NULL;
const TCHAR *openSymbole = NULL; const wchar_t *openSymbole = NULL;
const TCHAR *closeSymbole = NULL; const wchar_t *closeSymbole = NULL;
const TCHAR *functionExpr = NULL; const wchar_t *functionExpr = NULL;
mainExpr = (classRangeParser->ToElement())->Attribute(TEXT("mainExpr")); mainExpr = (classRangeParser->ToElement())->Attribute(L"mainExpr");
if (!mainExpr || !mainExpr[0]) if (!mainExpr || !mainExpr[0])
return false; return false;
mainExprStr = mainExpr; mainExprStr = mainExpr;
openSymbole = (classRangeParser->ToElement())->Attribute(TEXT("openSymbole")); openSymbole = (classRangeParser->ToElement())->Attribute(L"openSymbole");
if (openSymbole && openSymbole[0]) if (openSymbole && openSymbole[0])
openSymboleStr = openSymbole; openSymboleStr = openSymbole;
closeSymbole = (classRangeParser->ToElement())->Attribute(TEXT("closeSymbole")); closeSymbole = (classRangeParser->ToElement())->Attribute(L"closeSymbole");
if (closeSymbole && closeSymbole[0]) if (closeSymbole && closeSymbole[0])
closeSymboleStr = closeSymbole; closeSymboleStr = closeSymbole;
TiXmlNode *classNameParser = classRangeParser->FirstChild(TEXT("className")); TiXmlNode *classNameParser = classRangeParser->FirstChild(L"className");
if (classNameParser) if (classNameParser)
{ {
for (TiXmlNode *childNode2 = classNameParser->FirstChildElement(TEXT("nameExpr")); for (TiXmlNode *childNode2 = classNameParser->FirstChildElement(L"nameExpr");
childNode2; childNode2;
childNode2 = childNode2->NextSibling(TEXT("nameExpr")) ) childNode2 = childNode2->NextSibling(L"nameExpr") )
{ {
const TCHAR *expr = (childNode2->ToElement())->Attribute(TEXT("expr")); const wchar_t *expr = (childNode2->ToElement())->Attribute(L"expr");
if (expr && expr[0]) if (expr && expr[0])
classNameExprArray.push_back(expr); classNameExprArray.push_back(expr);
} }
} }
TiXmlNode *functionParser = classRangeParser->FirstChild(TEXT("function")); TiXmlNode *functionParser = classRangeParser->FirstChild(L"function");
if (!functionParser) if (!functionParser)
return false; return false;
functionExpr = (functionParser->ToElement())->Attribute(TEXT("mainExpr")); functionExpr = (functionParser->ToElement())->Attribute(L"mainExpr");
if (!functionExpr || !functionExpr[0]) if (!functionExpr || !functionExpr[0])
return false; return false;
functionExprStr = functionExpr; functionExprStr = functionExpr;
TiXmlNode *functionNameParser = functionParser->FirstChild(TEXT("functionName")); TiXmlNode *functionNameParser = functionParser->FirstChild(L"functionName");
if (functionNameParser) if (functionNameParser)
{ {
for (TiXmlNode *childNode3 = functionNameParser->FirstChildElement(TEXT("funcNameExpr")); for (TiXmlNode *childNode3 = functionNameParser->FirstChildElement(L"funcNameExpr");
childNode3; childNode3;
childNode3 = childNode3->NextSibling(TEXT("funcNameExpr")) ) childNode3 = childNode3->NextSibling(L"funcNameExpr") )
{ {
const TCHAR *expr = (childNode3->ToElement())->Attribute(TEXT("expr")); const wchar_t *expr = (childNode3->ToElement())->Attribute(L"expr");
if (expr && expr[0]) if (expr && expr[0])
functionNameExprArray.push_back(expr); functionNameExprArray.push_back(expr);
} }
@ -103,34 +103,34 @@ bool FunctionParsersManager::getZonePaserParameters(TiXmlNode *classRangeParser,
return true; return true;
} }
bool FunctionParsersManager::getUnitPaserParameters(TiXmlNode *functionParser, generic_string &mainExprStr, std::vector<generic_string> &functionNameExprArray, std::vector<generic_string> &classNameExprArray) bool FunctionParsersManager::getUnitPaserParameters(TiXmlNode *functionParser, wstring &mainExprStr, std::vector<wstring> &functionNameExprArray, std::vector<wstring> &classNameExprArray)
{ {
const TCHAR *mainExpr = (functionParser->ToElement())->Attribute(TEXT("mainExpr")); const wchar_t *mainExpr = (functionParser->ToElement())->Attribute(L"mainExpr");
if (!mainExpr || !mainExpr[0]) if (!mainExpr || !mainExpr[0])
return false; return false;
mainExprStr = mainExpr; mainExprStr = mainExpr;
TiXmlNode *functionNameParser = functionParser->FirstChild(TEXT("functionName")); TiXmlNode *functionNameParser = functionParser->FirstChild(L"functionName");
if (functionNameParser) if (functionNameParser)
{ {
for (TiXmlNode *childNode = functionNameParser->FirstChildElement(TEXT("nameExpr")); for (TiXmlNode *childNode = functionNameParser->FirstChildElement(L"nameExpr");
childNode; childNode;
childNode = childNode->NextSibling(TEXT("nameExpr")) ) childNode = childNode->NextSibling(L"nameExpr") )
{ {
const TCHAR *expr = (childNode->ToElement())->Attribute(TEXT("expr")); const wchar_t *expr = (childNode->ToElement())->Attribute(L"expr");
if (expr && expr[0]) if (expr && expr[0])
functionNameExprArray.push_back(expr); functionNameExprArray.push_back(expr);
} }
} }
TiXmlNode *classNameParser = functionParser->FirstChild(TEXT("className")); TiXmlNode *classNameParser = functionParser->FirstChild(L"className");
if (classNameParser) if (classNameParser)
{ {
for (TiXmlNode *childNode = classNameParser->FirstChildElement(TEXT("nameExpr")); for (TiXmlNode *childNode = classNameParser->FirstChildElement(L"nameExpr");
childNode; childNode;
childNode = childNode->NextSibling(TEXT("nameExpr")) ) childNode = childNode->NextSibling(L"nameExpr") )
{ {
const TCHAR *expr = (childNode->ToElement())->Attribute(TEXT("expr")); const wchar_t *expr = (childNode->ToElement())->Attribute(L"expr");
if (expr && expr[0]) if (expr && expr[0])
classNameExprArray.push_back(expr); classNameExprArray.push_back(expr);
} }
@ -139,10 +139,10 @@ bool FunctionParsersManager::getUnitPaserParameters(TiXmlNode *functionParser, g
} }
bool FunctionParsersManager::loadFuncListFromXmlTree(const generic_string & xmlDirPath, LangType lType, const generic_string& overrideId, int udlIndex) bool FunctionParsersManager::loadFuncListFromXmlTree(const wstring & xmlDirPath, LangType lType, const wstring& overrideId, int udlIndex)
{ {
generic_string funcListRulePath = xmlDirPath; wstring funcListRulePath = xmlDirPath;
funcListRulePath += TEXT("\\"); funcListRulePath += L"\\";
int index = -1; int index = -1;
if (lType == L_USER) // UDL if (lType == L_USER) // UDL
{ {
@ -160,9 +160,9 @@ bool FunctionParsersManager::loadFuncListFromXmlTree(const generic_string & xmlD
index = lType; index = lType;
if (overrideId.empty()) if (overrideId.empty())
{ {
generic_string lexerName = ScintillaEditView::_langNameInfoArray[lType]._langName; wstring lexerName = ScintillaEditView::_langNameInfoArray[lType]._langName;
funcListRulePath += lexerName; funcListRulePath += lexerName;
funcListRulePath += TEXT(".xml"); funcListRulePath += L".xml";
} }
else else
{ {
@ -182,44 +182,44 @@ bool FunctionParsersManager::loadFuncListFromXmlTree(const generic_string & xmlD
if (!loadOK) if (!loadOK)
return false; return false;
TiXmlNode *root = xmlFuncListDoc.FirstChild(TEXT("NotepadPlus")); TiXmlNode *root = xmlFuncListDoc.FirstChild(L"NotepadPlus");
if (!root) if (!root)
return false; return false;
root = root->FirstChild(TEXT("functionList")); root = root->FirstChild(L"functionList");
if (!root) if (!root)
return false; return false;
TiXmlNode *parserRoot = root->FirstChild(TEXT("parser")); TiXmlNode *parserRoot = root->FirstChild(L"parser");
if (!parserRoot) if (!parserRoot)
return false; return false;
const TCHAR *id = (parserRoot->ToElement())->Attribute(TEXT("id")); const wchar_t *id = (parserRoot->ToElement())->Attribute(L"id");
if (!id || !id[0]) if (!id || !id[0])
return false; return false;
generic_string commentExpr(TEXT("")); wstring commentExpr(L"");
const TCHAR *pCommentExpr = (parserRoot->ToElement())->Attribute(TEXT("commentExpr")); const wchar_t *pCommentExpr = (parserRoot->ToElement())->Attribute(L"commentExpr");
if (pCommentExpr && pCommentExpr[0]) if (pCommentExpr && pCommentExpr[0])
commentExpr = pCommentExpr; commentExpr = pCommentExpr;
std::vector<generic_string> classNameExprArray; std::vector<wstring> classNameExprArray;
std::vector<generic_string> functionNameExprArray; std::vector<wstring> functionNameExprArray;
const TCHAR *displayName = (parserRoot->ToElement())->Attribute(TEXT("displayName")); const wchar_t *displayName = (parserRoot->ToElement())->Attribute(L"displayName");
if (!displayName || !displayName[0]) if (!displayName || !displayName[0])
displayName = id; displayName = id;
TiXmlNode *classRangeParser = parserRoot->FirstChild(TEXT("classRange")); TiXmlNode *classRangeParser = parserRoot->FirstChild(L"classRange");
TiXmlNode *functionParser = parserRoot->FirstChild(TEXT("function")); TiXmlNode *functionParser = parserRoot->FirstChild(L"function");
if (classRangeParser && functionParser) if (classRangeParser && functionParser)
{ {
generic_string mainExpr, openSymbole, closeSymbole, functionExpr; wstring mainExpr, openSymbole, closeSymbole, functionExpr;
getZonePaserParameters(classRangeParser, mainExpr, openSymbole, closeSymbole, classNameExprArray, functionExpr, functionNameExprArray); getZonePaserParameters(classRangeParser, mainExpr, openSymbole, closeSymbole, classNameExprArray, functionExpr, functionNameExprArray);
generic_string mainExpr2; wstring mainExpr2;
std::vector<generic_string> classNameExprArray2; std::vector<wstring> classNameExprArray2;
std::vector<generic_string> functionNameExprArray2; std::vector<wstring> functionNameExprArray2;
getUnitPaserParameters(functionParser, mainExpr2, functionNameExprArray2, classNameExprArray2); getUnitPaserParameters(functionParser, mainExpr2, functionNameExprArray2, classNameExprArray2);
FunctionUnitParser *funcUnitPaser = new FunctionUnitParser(id, displayName, commentExpr.c_str(), mainExpr2.c_str(), functionNameExprArray2, classNameExprArray2); FunctionUnitParser *funcUnitPaser = new FunctionUnitParser(id, displayName, commentExpr.c_str(), mainExpr2.c_str(), functionNameExprArray2, classNameExprArray2);
@ -227,13 +227,13 @@ bool FunctionParsersManager::loadFuncListFromXmlTree(const generic_string & xmlD
} }
else if (classRangeParser) else if (classRangeParser)
{ {
generic_string mainExpr, openSymbole, closeSymbole, functionExpr; wstring mainExpr, openSymbole, closeSymbole, functionExpr;
getZonePaserParameters(classRangeParser, mainExpr, openSymbole, closeSymbole, classNameExprArray, functionExpr, functionNameExprArray); getZonePaserParameters(classRangeParser, mainExpr, openSymbole, closeSymbole, classNameExprArray, functionExpr, functionNameExprArray);
_parsers[index]->_parser = new FunctionZoneParser(id, displayName, commentExpr.c_str(), mainExpr.c_str(), openSymbole.c_str(), closeSymbole.c_str(), classNameExprArray, functionExpr.c_str(), functionNameExprArray); _parsers[index]->_parser = new FunctionZoneParser(id, displayName, commentExpr.c_str(), mainExpr.c_str(), openSymbole.c_str(), closeSymbole.c_str(), classNameExprArray, functionExpr.c_str(), functionNameExprArray);
} }
else if (functionParser) else if (functionParser)
{ {
generic_string mainExpr; wstring mainExpr;
getUnitPaserParameters(functionParser, mainExpr, functionNameExprArray, classNameExprArray); getUnitPaserParameters(functionParser, mainExpr, functionNameExprArray, classNameExprArray);
_parsers[index]->_parser = new FunctionUnitParser(id, displayName, commentExpr.c_str(), mainExpr.c_str(), functionNameExprArray, classNameExprArray); _parsers[index]->_parser = new FunctionUnitParser(id, displayName, commentExpr.c_str(), mainExpr.c_str(), functionNameExprArray, classNameExprArray);
} }
@ -241,10 +241,10 @@ bool FunctionParsersManager::loadFuncListFromXmlTree(const generic_string & xmlD
return true; return true;
} }
bool FunctionParsersManager::getOverrideMapFromXmlTree(const generic_string & xmlDirPath) bool FunctionParsersManager::getOverrideMapFromXmlTree(const wstring & xmlDirPath)
{ {
generic_string funcListRulePath = xmlDirPath; wstring funcListRulePath = xmlDirPath;
funcListRulePath += TEXT("\\overrideMap.xml"); funcListRulePath += L"\\overrideMap.xml";
TiXmlDocument xmlFuncListDoc(funcListRulePath); TiXmlDocument xmlFuncListDoc(funcListRulePath);
bool loadOK = xmlFuncListDoc.LoadFile(); bool loadOK = xmlFuncListDoc.LoadFile();
@ -252,25 +252,25 @@ bool FunctionParsersManager::getOverrideMapFromXmlTree(const generic_string & xm
if (!loadOK) if (!loadOK)
return false; return false;
TiXmlNode *root = xmlFuncListDoc.FirstChild(TEXT("NotepadPlus")); TiXmlNode *root = xmlFuncListDoc.FirstChild(L"NotepadPlus");
if (!root) if (!root)
return false; return false;
root = root->FirstChild(TEXT("functionList")); root = root->FirstChild(L"functionList");
if (!root) if (!root)
return false; return false;
TiXmlNode *associationMapRoot = root->FirstChild(TEXT("associationMap")); TiXmlNode *associationMapRoot = root->FirstChild(L"associationMap");
if (associationMapRoot) if (associationMapRoot)
{ {
for (TiXmlNode *childNode = associationMapRoot->FirstChildElement(TEXT("association")); for (TiXmlNode *childNode = associationMapRoot->FirstChildElement(L"association");
childNode; childNode;
childNode = childNode->NextSibling(TEXT("association")) ) childNode = childNode->NextSibling(L"association") )
{ {
int langID; int langID;
const TCHAR *langIDStr = (childNode->ToElement())->Attribute(TEXT("langID"), &langID); const wchar_t *langIDStr = (childNode->ToElement())->Attribute(L"langID", &langID);
const TCHAR *id = (childNode->ToElement())->Attribute(TEXT("id")); const wchar_t *id = (childNode->ToElement())->Attribute(L"id");
const TCHAR *userDefinedLangName = (childNode->ToElement())->Attribute(TEXT("userDefinedLangName")); const wchar_t *userDefinedLangName = (childNode->ToElement())->Attribute(L"userDefinedLangName");
if (!(id && id[0])) if (!(id && id[0]))
continue; continue;
@ -305,7 +305,7 @@ FunctionParser * FunctionParsersManager::getParser(const AssociationInfo & assoI
if (assoInfo._langID != -1 && assoInfo._langID != L_USER) if (assoInfo._langID != -1 && assoInfo._langID != L_USER)
choice = checkLangID; choice = checkLangID;
// langID == L_USER, we chack the userDefinedLangName // langID == L_USER, we chack the userDefinedLangName
else if (assoInfo._langID == L_USER && assoInfo._userDefinedLangName != TEXT("")) else if (assoInfo._langID == L_USER && assoInfo._userDefinedLangName != L"")
choice = checkUserDefined; choice = checkUserDefined;
else else
return NULL; return NULL;
@ -377,7 +377,7 @@ FunctionParser * FunctionParsersManager::getParser(const AssociationInfo & assoI
} }
void FunctionParser::funcParse(std::vector<foundInfo> & foundInfos, size_t begin, size_t end, ScintillaEditView **ppEditView, generic_string classStructName, const std::vector< std::pair<size_t, size_t> > * commentZones) void FunctionParser::funcParse(std::vector<foundInfo> & foundInfos, size_t begin, size_t end, ScintillaEditView **ppEditView, wstring classStructName, const std::vector< std::pair<size_t, size_t> > * commentZones)
{ {
if (begin >= end) if (begin >= end)
return; return;
@ -409,7 +409,7 @@ void FunctionParser::funcParse(std::vector<foundInfo> & foundInfos, size_t begin
// dataToSearch & data2ToSearch are optional // dataToSearch & data2ToSearch are optional
if (!_functionNameExprArray.size() && !_classNameExprArray.size()) if (!_functionNameExprArray.size() && !_classNameExprArray.size())
{ {
TCHAR foundData[1024]; wchar_t foundData[1024];
(*ppEditView)->getGenericText(foundData, 1024, targetStart, targetEnd); (*ppEditView)->getGenericText(foundData, 1024, targetStart, targetEnd);
fi._data = foundData; // whole found data fi._data = foundData; // whole found data
@ -454,27 +454,27 @@ void FunctionParser::funcParse(std::vector<foundInfo> & foundInfos, size_t begin
} }
generic_string FunctionParser::parseSubLevel(size_t begin, size_t end, std::vector< generic_string > dataToSearch, intptr_t & foundPos, ScintillaEditView **ppEditView) wstring FunctionParser::parseSubLevel(size_t begin, size_t end, std::vector< wstring > dataToSearch, intptr_t & foundPos, ScintillaEditView **ppEditView)
{ {
if (begin >= end) if (begin >= end)
{ {
foundPos = -1; foundPos = -1;
return generic_string(); return wstring();
} }
if (!dataToSearch.size()) if (!dataToSearch.size())
return generic_string(); return wstring();
int flags = SCFIND_REGEXP | SCFIND_POSIX | SCFIND_REGEXP_DOTMATCHESNL; int flags = SCFIND_REGEXP | SCFIND_POSIX | SCFIND_REGEXP_DOTMATCHESNL;
(*ppEditView)->execute(SCI_SETSEARCHFLAGS, flags); (*ppEditView)->execute(SCI_SETSEARCHFLAGS, flags);
const TCHAR *regExpr2search = dataToSearch[0].c_str(); const wchar_t *regExpr2search = dataToSearch[0].c_str();
intptr_t targetStart = (*ppEditView)->searchInTarget(regExpr2search, lstrlen(regExpr2search), begin, end); intptr_t targetStart = (*ppEditView)->searchInTarget(regExpr2search, lstrlen(regExpr2search), begin, end);
if (targetStart < 0) if (targetStart < 0)
{ {
foundPos = -1; foundPos = -1;
return generic_string(); return wstring();
} }
intptr_t targetEnd = (*ppEditView)->execute(SCI_GETTARGETEND); intptr_t targetEnd = (*ppEditView)->execute(SCI_GETTARGETEND);
@ -485,7 +485,7 @@ generic_string FunctionParser::parseSubLevel(size_t begin, size_t end, std::vect
} }
// only one processed element, so we conclude the result // only one processed element, so we conclude the result
TCHAR foundStr[1024]; wchar_t foundStr[1024];
(*ppEditView)->getGenericText(foundStr, 1024, targetStart, targetEnd); (*ppEditView)->getGenericText(foundStr, 1024, targetStart, targetEnd);
foundPos = targetStart; foundPos = targetStart;
@ -508,7 +508,7 @@ bool FunctionParsersManager::parse(std::vector<foundInfo> & foundInfos, const As
} }
size_t FunctionZoneParser::getBodyClosePos(size_t begin, const TCHAR *bodyOpenSymbol, const TCHAR *bodyCloseSymbol, const std::vector< std::pair<size_t, size_t> > & commentZones, ScintillaEditView **ppEditView) size_t FunctionZoneParser::getBodyClosePos(size_t begin, const wchar_t *bodyOpenSymbol, const wchar_t *bodyCloseSymbol, const std::vector< std::pair<size_t, size_t> > & commentZones, ScintillaEditView **ppEditView)
{ {
size_t cntOpen = 1; size_t cntOpen = 1;
@ -517,11 +517,11 @@ size_t FunctionZoneParser::getBodyClosePos(size_t begin, const TCHAR *bodyOpenSy
if (begin >= docLen) if (begin >= docLen)
return docLen; return docLen;
generic_string exprToSearch = TEXT("("); wstring exprToSearch = L"(";
exprToSearch += bodyOpenSymbol; exprToSearch += bodyOpenSymbol;
exprToSearch += TEXT("|"); exprToSearch += L"|";
exprToSearch += bodyCloseSymbol; exprToSearch += bodyCloseSymbol;
exprToSearch += TEXT(")"); exprToSearch += L")";
int flags = SCFIND_REGEXP | SCFIND_POSIX | SCFIND_REGEXP_DOTMATCHESNL; int flags = SCFIND_REGEXP | SCFIND_POSIX | SCFIND_REGEXP_DOTMATCHESNL;
@ -564,7 +564,7 @@ size_t FunctionZoneParser::getBodyClosePos(size_t begin, const TCHAR *bodyOpenSy
return targetEnd; return targetEnd;
} }
void FunctionZoneParser::classParse(vector<foundInfo> & foundInfos, vector< pair<size_t, size_t> > &scannedZones, const std::vector< std::pair<size_t, size_t> > & commentZones, size_t begin, size_t end, ScintillaEditView **ppEditView, generic_string /*classStructName*/) void FunctionZoneParser::classParse(vector<foundInfo> & foundInfos, vector< pair<size_t, size_t> > &scannedZones, const std::vector< std::pair<size_t, size_t> > & commentZones, size_t begin, size_t end, ScintillaEditView **ppEditView, wstring /*classStructName*/)
{ {
if (begin >= end) if (begin >= end)
return; return;
@ -582,7 +582,7 @@ void FunctionZoneParser::classParse(vector<foundInfo> & foundInfos, vector< pair
// Get class name // Get class name
intptr_t foundPos = 0; intptr_t foundPos = 0;
generic_string subLevelClassStructName = parseSubLevel(targetStart, targetEnd, _classNameExprArray, foundPos, ppEditView); wstring subLevelClassStructName = parseSubLevel(targetStart, targetEnd, _classNameExprArray, foundPos, ppEditView);
if (!_openSymbole.empty() && !_closeSymbole.empty()) if (!_openSymbole.empty() && !_closeSymbole.empty())
@ -600,7 +600,7 @@ void FunctionZoneParser::classParse(vector<foundInfo> & foundInfos, vector< pair
break; break;
// Begin to search all method inside // Begin to search all method inside
//vector< generic_string > emptyArray; //vector< wstring > emptyArray;
if (!isInZones(targetStart, commentZones)) if (!isInZones(targetStart, commentZones))
{ {
funcParse(foundInfos, targetStart, targetEnd, ppEditView, subLevelClassStructName, &commentZones); funcParse(foundInfos, targetStart, targetEnd, ppEditView, subLevelClassStructName, &commentZones);
@ -681,7 +681,7 @@ void FunctionParser::getInvertZones(vector< pair<size_t, size_t> > & destZones,
} }
void FunctionZoneParser::parse(std::vector<foundInfo> & foundInfos, size_t begin, size_t end, ScintillaEditView **ppEditView, generic_string classStructName) void FunctionZoneParser::parse(std::vector<foundInfo> & foundInfos, size_t begin, size_t end, ScintillaEditView **ppEditView, wstring classStructName)
{ {
vector< pair<size_t, size_t> > classZones, commentZones, nonCommentZones; vector< pair<size_t, size_t> > classZones, commentZones, nonCommentZones;
getCommentZones(commentZones, begin, end, ppEditView); getCommentZones(commentZones, begin, end, ppEditView);
@ -692,7 +692,7 @@ void FunctionZoneParser::parse(std::vector<foundInfo> & foundInfos, size_t begin
} }
} }
void FunctionUnitParser::parse(std::vector<foundInfo> & foundInfos, size_t begin, size_t end, ScintillaEditView **ppEditView, generic_string classStructName) void FunctionUnitParser::parse(std::vector<foundInfo> & foundInfos, size_t begin, size_t end, ScintillaEditView **ppEditView, wstring classStructName)
{ {
vector< pair<size_t, size_t> > commentZones, nonCommentZones; vector< pair<size_t, size_t> > commentZones, nonCommentZones;
getCommentZones(commentZones, begin, end, ppEditView); getCommentZones(commentZones, begin, end, ppEditView);
@ -714,7 +714,7 @@ struct SortZones final
} }
}; };
void FunctionMixParser::parse(std::vector<foundInfo> & foundInfos, size_t begin, size_t end, ScintillaEditView **ppEditView, generic_string classStructName) void FunctionMixParser::parse(std::vector<foundInfo> & foundInfos, size_t begin, size_t end, ScintillaEditView **ppEditView, wstring classStructName)
{ {
vector< pair<size_t, size_t> > commentZones, scannedZones, nonScannedZones; vector< pair<size_t, size_t> > commentZones, scannedZones, nonScannedZones;
getCommentZones(commentZones, begin, end, ppEditView); getCommentZones(commentZones, begin, end, ppEditView);

View File

@ -22,8 +22,8 @@ class TiXmlNode;
struct foundInfo final struct foundInfo final
{ {
generic_string _data; std::wstring _data;
generic_string _data2; std::wstring _data2;
intptr_t _pos = -1; intptr_t _pos = -1;
intptr_t _pos2 = -1; intptr_t _pos2 = -1;
}; };
@ -32,24 +32,24 @@ class FunctionParser
{ {
friend class FunctionParsersManager; friend class FunctionParsersManager;
public: public:
FunctionParser(const TCHAR *id, const TCHAR *displayName, const TCHAR *commentExpr, const generic_string& functionExpr, const std::vector<generic_string>& functionNameExprArray, const std::vector<generic_string>& classNameExprArray): FunctionParser(const wchar_t *id, const wchar_t *displayName, const wchar_t *commentExpr, const std::wstring& functionExpr, const std::vector<std::wstring>& functionNameExprArray, const std::vector<std::wstring>& classNameExprArray):
_id(id), _displayName(displayName), _commentExpr(commentExpr?commentExpr:TEXT("")), _functionExpr(functionExpr), _functionNameExprArray(functionNameExprArray), _classNameExprArray(classNameExprArray){}; _id(id), _displayName(displayName), _commentExpr(commentExpr?commentExpr:L""), _functionExpr(functionExpr), _functionNameExprArray(functionNameExprArray), _classNameExprArray(classNameExprArray){};
virtual void parse(std::vector<foundInfo> & foundInfos, size_t begin, size_t end, ScintillaEditView **ppEditView, generic_string classStructName = TEXT("")) = 0; virtual void parse(std::vector<foundInfo> & foundInfos, size_t begin, size_t end, ScintillaEditView **ppEditView, std::wstring classStructName = L"") = 0;
void funcParse(std::vector<foundInfo> & foundInfos, size_t begin, size_t end, ScintillaEditView **ppEditView, generic_string classStructName = TEXT(""), const std::vector< std::pair<size_t, size_t> > * commentZones = NULL); void funcParse(std::vector<foundInfo> & foundInfos, size_t begin, size_t end, ScintillaEditView **ppEditView, std::wstring classStructName = L"", const std::vector< std::pair<size_t, size_t> > * commentZones = NULL);
bool isInZones(size_t pos2Test, const std::vector< std::pair<size_t, size_t> > & zones); bool isInZones(size_t pos2Test, const std::vector< std::pair<size_t, size_t> > & zones);
virtual ~FunctionParser() = default; virtual ~FunctionParser() = default;
protected: protected:
generic_string _id; std::wstring _id;
generic_string _displayName; std::wstring _displayName;
generic_string _commentExpr; std::wstring _commentExpr;
generic_string _functionExpr; std::wstring _functionExpr;
std::vector<generic_string> _functionNameExprArray; std::vector<std::wstring> _functionNameExprArray;
std::vector<generic_string> _classNameExprArray; std::vector<std::wstring> _classNameExprArray;
void getCommentZones(std::vector< std::pair<size_t, size_t> > & commentZone, size_t begin, size_t end, ScintillaEditView **ppEditView); void getCommentZones(std::vector< std::pair<size_t, size_t> > & commentZone, size_t begin, size_t end, ScintillaEditView **ppEditView);
void getInvertZones(std::vector< std::pair<size_t, size_t> > & destZones, const std::vector< std::pair<size_t, size_t> > & sourceZones, size_t begin, size_t end); void getInvertZones(std::vector< std::pair<size_t, size_t> > & destZones, const std::vector< std::pair<size_t, size_t> > & sourceZones, size_t begin, size_t end);
generic_string parseSubLevel(size_t begin, size_t end, std::vector< generic_string > dataToSearch, intptr_t & foundPos, ScintillaEditView **ppEditView); std::wstring parseSubLevel(size_t begin, size_t end, std::vector< std::wstring > dataToSearch, intptr_t & foundPos, ScintillaEditView **ppEditView);
}; };
@ -57,21 +57,21 @@ class FunctionZoneParser : public FunctionParser
{ {
public: public:
FunctionZoneParser() = delete; FunctionZoneParser() = delete;
FunctionZoneParser(const TCHAR *id, const TCHAR *displayName, const TCHAR *commentExpr, const generic_string& rangeExpr, const generic_string& openSymbole, const generic_string& closeSymbole, FunctionZoneParser(const wchar_t *id, const wchar_t *displayName, const wchar_t *commentExpr, const std::wstring& rangeExpr, const std::wstring& openSymbole, const std::wstring& closeSymbole,
const std::vector<generic_string>& classNameExprArray, const generic_string& functionExpr, const std::vector<generic_string>& functionNameExprArray): const std::vector<std::wstring>& classNameExprArray, const std::wstring& functionExpr, const std::vector<std::wstring>& functionNameExprArray):
FunctionParser(id, displayName, commentExpr, functionExpr, functionNameExprArray, classNameExprArray), _rangeExpr(rangeExpr), _openSymbole(openSymbole), _closeSymbole(closeSymbole) {}; FunctionParser(id, displayName, commentExpr, functionExpr, functionNameExprArray, classNameExprArray), _rangeExpr(rangeExpr), _openSymbole(openSymbole), _closeSymbole(closeSymbole) {};
void parse(std::vector<foundInfo> & foundInfos, size_t begin, size_t end, ScintillaEditView **ppEditView, generic_string classStructName = TEXT("")) override; void parse(std::vector<foundInfo> & foundInfos, size_t begin, size_t end, ScintillaEditView **ppEditView, std::wstring classStructName = L"") override;
protected: protected:
void classParse(std::vector<foundInfo> & foundInfos, std::vector< std::pair<size_t, size_t> > & scannedZones, const std::vector< std::pair<size_t, size_t> > & commentZones, size_t begin, size_t end, ScintillaEditView **ppEditView, generic_string classStructName = TEXT("")); void classParse(std::vector<foundInfo> & foundInfos, std::vector< std::pair<size_t, size_t> > & scannedZones, const std::vector< std::pair<size_t, size_t> > & commentZones, size_t begin, size_t end, ScintillaEditView **ppEditView, std::wstring classStructName = L"");
private: private:
generic_string _rangeExpr; std::wstring _rangeExpr;
generic_string _openSymbole; std::wstring _openSymbole;
generic_string _closeSymbole; std::wstring _closeSymbole;
size_t getBodyClosePos(size_t begin, const TCHAR *bodyOpenSymbol, const TCHAR *bodyCloseSymbol, const std::vector< std::pair<size_t, size_t> > & commentZones, ScintillaEditView **ppEditView); size_t getBodyClosePos(size_t begin, const wchar_t *bodyOpenSymbol, const wchar_t *bodyCloseSymbol, const std::vector< std::pair<size_t, size_t> > & commentZones, ScintillaEditView **ppEditView);
}; };
@ -79,19 +79,19 @@ private:
class FunctionUnitParser : public FunctionParser class FunctionUnitParser : public FunctionParser
{ {
public: public:
FunctionUnitParser(const TCHAR *id, const TCHAR *displayName, const TCHAR *commentExpr, FunctionUnitParser(const wchar_t *id, const wchar_t *displayName, const wchar_t *commentExpr,
const generic_string& mainExpr, const std::vector<generic_string>& functionNameExprArray, const std::wstring& mainExpr, const std::vector<std::wstring>& functionNameExprArray,
const std::vector<generic_string>& classNameExprArray): FunctionParser(id, displayName, commentExpr, mainExpr, functionNameExprArray, classNameExprArray) const std::vector<std::wstring>& classNameExprArray): FunctionParser(id, displayName, commentExpr, mainExpr, functionNameExprArray, classNameExprArray)
{} {}
void parse(std::vector<foundInfo> & foundInfos, size_t begin, size_t end, ScintillaEditView **ppEditView, generic_string classStructName = TEXT("")) override; void parse(std::vector<foundInfo> & foundInfos, size_t begin, size_t end, ScintillaEditView **ppEditView, std::wstring classStructName = L"") override;
}; };
class FunctionMixParser : public FunctionZoneParser class FunctionMixParser : public FunctionZoneParser
{ {
public: public:
FunctionMixParser(const TCHAR *id, const TCHAR *displayName, const TCHAR *commentExpr, const generic_string& rangeExpr, const generic_string& openSymbole, const generic_string& closeSymbole, FunctionMixParser(const wchar_t *id, const wchar_t *displayName, const wchar_t *commentExpr, const std::wstring& rangeExpr, const std::wstring& openSymbole, const std::wstring& closeSymbole,
const std::vector<generic_string>& classNameExprArray, const generic_string& functionExpr, const std::vector<generic_string>& functionNameExprArray, FunctionUnitParser *funcUnitPaser): const std::vector<std::wstring>& classNameExprArray, const std::wstring& functionExpr, const std::vector<std::wstring>& functionNameExprArray, FunctionUnitParser *funcUnitPaser):
FunctionZoneParser(id, displayName, commentExpr, rangeExpr, openSymbole, closeSymbole, classNameExprArray, functionExpr, functionNameExprArray), _funcUnitPaser(funcUnitPaser){}; FunctionZoneParser(id, displayName, commentExpr, rangeExpr, openSymbole, closeSymbole, classNameExprArray, functionExpr, functionNameExprArray), _funcUnitPaser(funcUnitPaser){};
~FunctionMixParser() ~FunctionMixParser()
@ -99,7 +99,7 @@ public:
delete _funcUnitPaser; delete _funcUnitPaser;
} }
void parse(std::vector<foundInfo> & foundInfos, size_t begin, size_t end, ScintillaEditView **ppEditView, generic_string classStructName = TEXT("")) override; void parse(std::vector<foundInfo> & foundInfos, size_t begin, size_t end, ScintillaEditView **ppEditView, std::wstring classStructName = L"") override;
private: private:
FunctionUnitParser* _funcUnitPaser = nullptr; FunctionUnitParser* _funcUnitPaser = nullptr;
@ -110,10 +110,10 @@ struct AssociationInfo final
{ {
int _id; int _id;
int _langID; int _langID;
generic_string _ext; std::wstring _ext;
generic_string _userDefinedLangName; std::wstring _userDefinedLangName;
AssociationInfo(int id, int langID, const TCHAR *ext, const TCHAR *userDefinedLangName) AssociationInfo(int id, int langID, const wchar_t *ext, const wchar_t *userDefinedLangName)
: _id(id), _langID(langID) : _id(id), _langID(langID)
{ {
if (ext) if (ext)
@ -132,13 +132,13 @@ const int nbMaxUserDefined = 25;
struct ParserInfo struct ParserInfo
{ {
generic_string _id; // xml parser rule file name - if empty, then we use default name. Mandatory if _userDefinedLangName is not empty std::wstring _id; // xml parser rule file name - if empty, then we use default name. Mandatory if _userDefinedLangName is not empty
FunctionParser* _parser = nullptr; FunctionParser* _parser = nullptr;
generic_string _userDefinedLangName; std::wstring _userDefinedLangName;
ParserInfo() {}; ParserInfo() {};
ParserInfo(const generic_string& id): _id(id) {}; ParserInfo(const std::wstring& id): _id(id) {};
ParserInfo(const generic_string& id, const generic_string& userDefinedLangName): _id(id), _userDefinedLangName(userDefinedLangName) {}; ParserInfo(const std::wstring& id, const std::wstring& userDefinedLangName): _id(id), _userDefinedLangName(userDefinedLangName) {};
~ParserInfo() { if (_parser) delete _parser; } ~ParserInfo() { if (_parser) delete _parser; }
}; };
@ -147,21 +147,21 @@ class FunctionParsersManager final
public: public:
~FunctionParsersManager(); ~FunctionParsersManager();
bool init(const generic_string& xmlPath, const generic_string& xmlInstalledPath, ScintillaEditView ** ppEditView); bool init(const std::wstring& xmlPath, const std::wstring& xmlInstalledPath, ScintillaEditView ** ppEditView);
bool parse(std::vector<foundInfo> & foundInfos, const AssociationInfo & assoInfo); bool parse(std::vector<foundInfo> & foundInfos, const AssociationInfo & assoInfo);
private: private:
ScintillaEditView **_ppEditView = nullptr; ScintillaEditView **_ppEditView = nullptr;
generic_string _xmlDirPath; // The 1st place to load function list files. Usually it's "%APPDATA%\Notepad++\functionList\" std::wstring _xmlDirPath; // The 1st place to load function list files. Usually it's "%APPDATA%\Notepad++\functionList\"
generic_string _xmlDirInstalledPath; // Where Notepad++ is installed. The 2nd place to load function list files. Usually it's "%PROGRAMFILES%\Notepad++\functionList\" std::wstring _xmlDirInstalledPath; // Where Notepad++ is installed. The 2nd place to load function list files. Usually it's "%PROGRAMFILES%\Notepad++\functionList\"
ParserInfo* _parsers[L_EXTERNAL + nbMaxUserDefined] = {nullptr}; ParserInfo* _parsers[L_EXTERNAL + nbMaxUserDefined] = {nullptr};
int _currentUDIndex = L_EXTERNAL; int _currentUDIndex = L_EXTERNAL;
bool getOverrideMapFromXmlTree(const generic_string & xmlDirPath); bool getOverrideMapFromXmlTree(const std::wstring & xmlDirPath);
bool loadFuncListFromXmlTree(const generic_string & xmlDirPath, LangType lType, const generic_string& overrideId, int udlIndex = -1); bool loadFuncListFromXmlTree(const std::wstring & xmlDirPath, LangType lType, const std::wstring& overrideId, int udlIndex = -1);
bool getZonePaserParameters(TiXmlNode *classRangeParser, generic_string &mainExprStr, generic_string &openSymboleStr, generic_string &closeSymboleStr, std::vector<generic_string> &classNameExprArray, generic_string &functionExprStr, std::vector<generic_string> &functionNameExprArray); bool getZonePaserParameters(TiXmlNode *classRangeParser, std::wstring &mainExprStr, std::wstring &openSymboleStr, std::wstring &closeSymboleStr, std::vector<std::wstring> &classNameExprArray, std::wstring &functionExprStr, std::vector<std::wstring> &functionNameExprArray);
bool getUnitPaserParameters(TiXmlNode *functionParser, generic_string &mainExprStr, std::vector<generic_string> &functionNameExprArray, std::vector<generic_string> &classNameExprArray); bool getUnitPaserParameters(TiXmlNode *functionParser, std::wstring &mainExprStr, std::vector<std::wstring> &functionNameExprArray, std::vector<std::wstring> &classNameExprArray);
FunctionParser * getParser(const AssociationInfo & assoInfo); FunctionParser * getParser(const AssociationInfo & assoInfo);
}; };

View File

@ -184,27 +184,27 @@ intptr_t CALLBACK PreferenceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
_searchEngineSubDlg.init(_hInst, _hSelf); _searchEngineSubDlg.init(_hInst, _hSelf);
_searchEngineSubDlg.create(IDD_PREFERENCE_SUB_SEARCHENGINE, false, false); _searchEngineSubDlg.create(IDD_PREFERENCE_SUB_SEARCHENGINE, false, false);
_wVector.push_back(DlgInfo(&_generalSubDlg, TEXT("General"), TEXT("Global"))); _wVector.push_back(DlgInfo(&_generalSubDlg, L"General", L"Global"));
_wVector.push_back(DlgInfo(&_editingSubDlg, TEXT("Editing 1"), TEXT("Scintillas"))); _wVector.push_back(DlgInfo(&_editingSubDlg, L"Editing 1", L"Scintillas"));
_wVector.push_back(DlgInfo(&_editing2SubDlg, TEXT("Editing 2"), TEXT("Scintillas2"))); _wVector.push_back(DlgInfo(&_editing2SubDlg, L"Editing 2", L"Scintillas2"));
_wVector.push_back(DlgInfo(&_darkModeSubDlg, TEXT("Dark Mode"), TEXT("DarkMode"))); _wVector.push_back(DlgInfo(&_darkModeSubDlg, L"Dark Mode", L"DarkMode"));
_wVector.push_back(DlgInfo(&_marginsBorderEdgeSubDlg, TEXT("Margins/Border/Edge"), TEXT("MarginsBorderEdge"))); _wVector.push_back(DlgInfo(&_marginsBorderEdgeSubDlg, L"Margins/Border/Edge", L"MarginsBorderEdge"));
_wVector.push_back(DlgInfo(&_newDocumentSubDlg, TEXT("New Document"), TEXT("NewDoc"))); _wVector.push_back(DlgInfo(&_newDocumentSubDlg, L"New Document", L"NewDoc"));
_wVector.push_back(DlgInfo(&_defaultDirectorySubDlg, TEXT("Default Directory"), TEXT("DefaultDir"))); _wVector.push_back(DlgInfo(&_defaultDirectorySubDlg, L"Default Directory", L"DefaultDir"));
_wVector.push_back(DlgInfo(&_recentFilesHistorySubDlg, TEXT("Recent Files History"), TEXT("RecentFilesHistory"))); _wVector.push_back(DlgInfo(&_recentFilesHistorySubDlg, L"Recent Files History", L"RecentFilesHistory"));
_wVector.push_back(DlgInfo(&_fileAssocDlg, TEXT("File Association"), TEXT("FileAssoc"))); _wVector.push_back(DlgInfo(&_fileAssocDlg, L"File Association", L"FileAssoc"));
_wVector.push_back(DlgInfo(&_languageSubDlg, TEXT("Language"), TEXT("Language"))); _wVector.push_back(DlgInfo(&_languageSubDlg, L"Language", L"Language"));
_wVector.push_back(DlgInfo(&_highlightingSubDlg, TEXT("Highlighting"), TEXT("Highlighting"))); _wVector.push_back(DlgInfo(&_highlightingSubDlg, L"Highlighting", L"Highlighting"));
_wVector.push_back(DlgInfo(&_printSubDlg, TEXT("Print"), TEXT("Print"))); _wVector.push_back(DlgInfo(&_printSubDlg, L"Print", L"Print"));
_wVector.push_back(DlgInfo(&_searchingSubDlg, TEXT("Searching"), TEXT("Searching"))); _wVector.push_back(DlgInfo(&_searchingSubDlg, L"Searching", L"Searching"));
_wVector.push_back(DlgInfo(&_backupSubDlg, TEXT("Backup"), TEXT("Backup"))); _wVector.push_back(DlgInfo(&_backupSubDlg, L"Backup", L"Backup"));
_wVector.push_back(DlgInfo(&_autoCompletionSubDlg, TEXT("Auto-Completion"), TEXT("AutoCompletion"))); _wVector.push_back(DlgInfo(&_autoCompletionSubDlg, L"Auto-Completion", L"AutoCompletion"));
_wVector.push_back(DlgInfo(&_multiInstanceSubDlg, TEXT("Multi-Instance & Date"), TEXT("MultiInstance"))); _wVector.push_back(DlgInfo(&_multiInstanceSubDlg, L"Multi-Instance & Date", L"MultiInstance"));
_wVector.push_back(DlgInfo(&_delimiterSubDlg, TEXT("Delimiter"), TEXT("Delimiter"))); _wVector.push_back(DlgInfo(&_delimiterSubDlg, L"Delimiter", L"Delimiter"));
_wVector.push_back(DlgInfo(&_performanceSubDlg, TEXT("Performance"), TEXT("Performance"))); _wVector.push_back(DlgInfo(&_performanceSubDlg, L"Performance", L"Performance"));
_wVector.push_back(DlgInfo(&_cloudAndLinkSubDlg, TEXT("Cloud & Link"), TEXT("Cloud"))); _wVector.push_back(DlgInfo(&_cloudAndLinkSubDlg, L"Cloud & Link", L"Cloud"));
_wVector.push_back(DlgInfo(&_searchEngineSubDlg, TEXT("Search Engine"), TEXT("SearchEngine"))); _wVector.push_back(DlgInfo(&_searchEngineSubDlg, L"Search Engine", L"SearchEngine"));
_wVector.push_back(DlgInfo(&_miscSubDlg, TEXT("MISC."), TEXT("MISC"))); _wVector.push_back(DlgInfo(&_miscSubDlg, L"MISC.", L"MISC"));
makeCategoryList(); makeCategoryList();
@ -435,7 +435,7 @@ void PreferenceDlg::makeCategoryList()
setListSelection(0); setListSelection(0);
} }
int32_t PreferenceDlg::getIndexFromName(const TCHAR *name) const int32_t PreferenceDlg::getIndexFromName(const wchar_t *name) const
{ {
if (!name) if (!name)
return -1; return -1;
@ -453,7 +453,7 @@ bool PreferenceDlg::setListSelection(size_t currentSel) const
{ {
// Stupid LB API doesn't allow LB_SETSEL to be used on single select listbox, so we do it in a hard way // Stupid LB API doesn't allow LB_SETSEL to be used on single select listbox, so we do it in a hard way
const size_t selStrLenMax = 255; const size_t selStrLenMax = 255;
TCHAR selStr[selStrLenMax + 1] = { '\0' }; wchar_t selStr[selStrLenMax + 1] = { '\0' };
auto lbTextLen = ::SendMessage(_hSelf, LB_GETTEXTLEN, currentSel, 0); auto lbTextLen = ::SendMessage(_hSelf, LB_GETTEXTLEN, currentSel, 0);
if (static_cast<size_t>(lbTextLen) > selStrLenMax) if (static_cast<size_t>(lbTextLen) > selStrLenMax)
@ -464,7 +464,7 @@ bool PreferenceDlg::setListSelection(size_t currentSel) const
return true; return true;
} }
bool PreferenceDlg::renameDialogTitle(const TCHAR *internalName, const TCHAR *newName) bool PreferenceDlg::renameDialogTitle(const wchar_t *internalName, const wchar_t *newName)
{ {
bool foundIt = false; bool foundIt = false;
size_t i = 0; size_t i = 0;
@ -480,7 +480,7 @@ bool PreferenceDlg::renameDialogTitle(const TCHAR *internalName, const TCHAR *ne
return false; return false;
const size_t lenMax = 256; const size_t lenMax = 256;
TCHAR oldName[lenMax] = { '\0' }; wchar_t oldName[lenMax] = { '\0' };
size_t txtLen = ::SendDlgItemMessage(_hSelf, IDC_LIST_DLGTITLE, LB_GETTEXTLEN, i, 0); size_t txtLen = ::SendDlgItemMessage(_hSelf, IDC_LIST_DLGTITLE, LB_GETTEXTLEN, i, 0);
if (txtLen >= lenMax) if (txtLen >= lenMax)
return false; return false;
@ -497,7 +497,7 @@ bool PreferenceDlg::renameDialogTitle(const TCHAR *internalName, const TCHAR *ne
return true; return true;
} }
void PreferenceDlg::showDialogByName(const TCHAR *name) const void PreferenceDlg::showDialogByName(const wchar_t *name) const
{ {
int32_t i = getIndexFromName(name); int32_t i = getIndexFromName(name);
if (i >= 0) if (i >= 0)
@ -618,7 +618,7 @@ intptr_t CALLBACK GeneralSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
pair<wstring, wstring> localizationInfo = localizationSwitcher.getElementFromIndex(i); pair<wstring, wstring> localizationInfo = localizationSwitcher.getElementFromIndex(i);
::SendDlgItemMessage(_hSelf, IDC_COMBO_LOCALIZATION, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(localizationInfo.first.c_str())); ::SendDlgItemMessage(_hSelf, IDC_COMBO_LOCALIZATION, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(localizationInfo.first.c_str()));
} }
wstring lang = TEXT("English"); // Set default language as Englishs wstring lang = L"English"; // Set default language as Englishs
if (nppParam.getNativeLangA()) // if nativeLangA is not NULL, then we can be sure the default language (English) is not used if (nppParam.getNativeLangA()) // if nativeLangA is not NULL, then we can be sure the default language (English) is not used
{ {
string fn = localizationSwitcher.getFileName(); string fn = localizationSwitcher.getFileName();
@ -793,7 +793,7 @@ intptr_t CALLBACK GeneralSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
{ {
LocalizationSwitcher & localizationSwitcher = nppParam.getLocalizationSwitcher(); LocalizationSwitcher & localizationSwitcher = nppParam.getLocalizationSwitcher();
auto index = ::SendDlgItemMessage(_hSelf, IDC_COMBO_LOCALIZATION, CB_GETCURSEL, 0, 0); auto index = ::SendDlgItemMessage(_hSelf, IDC_COMBO_LOCALIZATION, CB_GETCURSEL, 0, 0);
TCHAR langName[MAX_PATH] = { '\0' }; wchar_t langName[MAX_PATH] = { '\0' };
auto cbTextLen = ::SendDlgItemMessage(_hSelf, IDC_COMBO_LOCALIZATION, CB_GETLBTEXTLEN, index, 0); auto cbTextLen = ::SendDlgItemMessage(_hSelf, IDC_COMBO_LOCALIZATION, CB_GETLBTEXTLEN, index, 0);
if (cbTextLen > MAX_PATH - 1) if (cbTextLen > MAX_PATH - 1)
return TRUE; return TRUE;
@ -802,7 +802,7 @@ intptr_t CALLBACK GeneralSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
if (langName[0]) if (langName[0])
{ {
// Make English as basic language // Make English as basic language
if (localizationSwitcher.switchToLang(TEXT("English"))) if (localizationSwitcher.switchToLang(L"English"))
{ {
::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_RELOADNATIVELANG, 0, 0); ::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_RELOADNATIVELANG, 0, 0);
} }
@ -994,12 +994,12 @@ intptr_t CALLBACK EditingSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
{ {
case WM_INITDIALOG : case WM_INITDIALOG :
{ {
::SendDlgItemMessage(_hSelf, IDC_WIDTH_COMBO, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(TEXT("0"))); ::SendDlgItemMessage(_hSelf, IDC_WIDTH_COMBO, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"0"));
::SendDlgItemMessage(_hSelf, IDC_WIDTH_COMBO, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(TEXT("1"))); ::SendDlgItemMessage(_hSelf, IDC_WIDTH_COMBO, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"1"));
::SendDlgItemMessage(_hSelf, IDC_WIDTH_COMBO, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(TEXT("2"))); ::SendDlgItemMessage(_hSelf, IDC_WIDTH_COMBO, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"2"));
::SendDlgItemMessage(_hSelf, IDC_WIDTH_COMBO, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(TEXT("3"))); ::SendDlgItemMessage(_hSelf, IDC_WIDTH_COMBO, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"3"));
::SendDlgItemMessage(_hSelf, IDC_WIDTH_COMBO, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(TEXT("Block"))); ::SendDlgItemMessage(_hSelf, IDC_WIDTH_COMBO, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"Block"));
::SendDlgItemMessage(_hSelf, IDC_WIDTH_COMBO, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(TEXT("Block After"))); ::SendDlgItemMessage(_hSelf, IDC_WIDTH_COMBO, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"Block After"));
::SendMessage(::GetDlgItem(_hSelf, IDC_WIDTH_COMBO), CB_SETCURSEL, nppGUI._caretWidth, 0); ::SendMessage(::GetDlgItem(_hSelf, IDC_WIDTH_COMBO), CB_SETCURSEL, nppGUI._caretWidth, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_FOLDINGTOGGLE, BM_SETCHECK, nppGUI._enableFoldCmdToggable, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_FOLDINGTOGGLE, BM_SETCHECK, nppGUI._enableFoldCmdToggable, 0);
@ -1212,7 +1212,7 @@ intptr_t CALLBACK Editing2SubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_COLUMN2MULTIEDITING), svp._multiSelection); ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_COLUMN2MULTIEDITING), svp._multiSelection);
NativeLangSpeaker* pNativeSpeaker = nppParam.getNativeLangSpeaker(); NativeLangSpeaker* pNativeSpeaker = nppParam.getNativeLangSpeaker();
generic_string tip2show = pNativeSpeaker->getLocalizedStrFromID("eol-custom-color-tip", TEXT("Go to Style Configurator to change the default EOL custom color (\"EOL custom color\").")); wstring tip2show = pNativeSpeaker->getLocalizedStrFromID("eol-custom-color-tip", L"Go to Style Configurator to change the default EOL custom color (\"EOL custom color\").");
_tip = CreateToolTip(IDC_BUTTON_LAUNCHSTYLECONF_CRLF, _hSelf, _hInst, const_cast<PTSTR>(tip2show.c_str()), pNativeSpeaker->isRTL()); _tip = CreateToolTip(IDC_BUTTON_LAUNCHSTYLECONF_CRLF, _hSelf, _hInst, const_cast<PTSTR>(tip2show.c_str()), pNativeSpeaker->isRTL());
@ -1224,14 +1224,14 @@ intptr_t CALLBACK Editing2SubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
setChecked(IDC_CHECK_NPC_INCLUDECCUNIEOL, svp._npcIncludeCcUniEol); setChecked(IDC_CHECK_NPC_INCLUDECCUNIEOL, svp._npcIncludeCcUniEol);
setChecked(IDC_CHECK_NPC_NOINPUTC0, svp._npcNoInputC0); setChecked(IDC_CHECK_NPC_NOINPUTC0, svp._npcNoInputC0);
generic_string tipNote2Show = pNativeSpeaker->getLocalizedStrFromID("npcNote-tip", wstring tipNote2Show = pNativeSpeaker->getLocalizedStrFromID("npcNote-tip",
L"Representation of selected \"non-ASCII\" whitespace and non-printing (control) characters.\n\n"\ L"Representation of selected \"non-ASCII\" whitespace and non-printing (control) characters.\n\n"\
L"NOTE:\n"\ L"NOTE:\n"\
L"Using representation will disable character effects on text.\n\n"\ L"Using representation will disable character effects on text.\n\n"\
L"For the full list of selected whitespace and non-printing characters check User Manual.\n\n"\ L"For the full list of selected whitespace and non-printing characters check User Manual.\n\n"\
L"Click on this button to open website with User Manual."); L"Click on this button to open website with User Manual.");
generic_string tipAb2Show = pNativeSpeaker->getLocalizedStrFromID("npcAbbreviation-tip", wstring tipAb2Show = pNativeSpeaker->getLocalizedStrFromID("npcAbbreviation-tip",
L"Abbreviation : name\n"\ L"Abbreviation : name\n"\
L"NBSP : no-break space\n"\ L"NBSP : no-break space\n"\
L"ZWSP : zero-width space\n"\ L"ZWSP : zero-width space\n"\
@ -1239,7 +1239,7 @@ intptr_t CALLBACK Editing2SubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
L"For the full list check User Manual.\n"\ L"For the full list check User Manual.\n"\
L"Click on \"?\" button on right to open website with User Manual."); L"Click on \"?\" button on right to open website with User Manual.");
generic_string tipCp2Show = pNativeSpeaker->getLocalizedStrFromID("npcCodepoint-tip", wstring tipCp2Show = pNativeSpeaker->getLocalizedStrFromID("npcCodepoint-tip",
L"Codepoint : name\n"\ L"Codepoint : name\n"\
L"U+00A0 : no-break space\n"\ L"U+00A0 : no-break space\n"\
L"U+200B : zero-width space\n"\ L"U+200B : zero-width space\n"\
@ -1247,10 +1247,10 @@ intptr_t CALLBACK Editing2SubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
L"For the full list check User Manual.\n"\ L"For the full list check User Manual.\n"\
L"Click on \"?\" button on right to open website with User Manual."); L"Click on \"?\" button on right to open website with User Manual.");
generic_string tipNpcCol2show = pNativeSpeaker->getLocalizedStrFromID("npcCustomColor-tip", wstring tipNpcCol2show = pNativeSpeaker->getLocalizedStrFromID("npcCustomColor-tip",
L"Go to Style Configurator to change the default custom color for selected whitespace and non-printing characters (\"Non-printing characters custom color\")."); L"Go to Style Configurator to change the default custom color for selected whitespace and non-printing characters (\"Non-printing characters custom color\").");
generic_string tipNpcInc2show = pNativeSpeaker->getLocalizedStrFromID("npcIncludeCcUniEol-tip", wstring tipNpcInc2show = pNativeSpeaker->getLocalizedStrFromID("npcIncludeCcUniEol-tip",
L"Apply non-printing characters appearance settings to C0, C1 control and Unicode EOL (next line, line separator and paragraph separator) characters."); L"Apply non-printing characters appearance settings to C0, C1 control and Unicode EOL (next line, line separator and paragraph separator) characters.");
_tipNote = CreateToolTip(IDC_BUTTON_NPC_NOTE, _hSelf, _hInst, const_cast<PTSTR>(tipNote2Show.c_str()), pNativeSpeaker->isRTL()); _tipNote = CreateToolTip(IDC_BUTTON_NPC_NOTE, _hSelf, _hInst, const_cast<PTSTR>(tipNote2Show.c_str()), pNativeSpeaker->isRTL());
@ -1986,12 +1986,12 @@ void MarginsBorderEdgeSubDlg::initScintParam()
::SendDlgItemMessage(_hSelf, IDC_CHECK_EDGEBGMODE, BM_SETCHECK, svp._isEdgeBgMode, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_EDGEBGMODE, BM_SETCHECK, svp._isEdgeBgMode, 0);
} }
generic_string edgeColumnPosStr; wstring edgeColumnPosStr;
for (auto i : svp._edgeMultiColumnPos) for (auto i : svp._edgeMultiColumnPos)
{ {
std::string s = std::to_string(i); std::string s = std::to_string(i);
edgeColumnPosStr += generic_string(s.begin(), s.end()); edgeColumnPosStr += wstring(s.begin(), s.end());
edgeColumnPosStr += TEXT(" "); edgeColumnPosStr += L" ";
} }
::SendDlgItemMessage(_hSelf, IDC_COLUMNPOS_EDIT, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(edgeColumnPosStr.c_str())); ::SendDlgItemMessage(_hSelf, IDC_COLUMNPOS_EDIT, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(edgeColumnPosStr.c_str()));
@ -2033,7 +2033,7 @@ intptr_t CALLBACK MarginsBorderEdgeSubDlg::run_dlgProc(UINT message, WPARAM wPar
::SetDlgItemInt(_hSelf, IDC_DISTRACTIONFREEVAL_STATIC, svp._distractionFreeDivPart, FALSE); ::SetDlgItemInt(_hSelf, IDC_DISTRACTIONFREEVAL_STATIC, svp._distractionFreeDivPart, FALSE);
NativeLangSpeaker* pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker(); NativeLangSpeaker* pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
generic_string tipNote2Show = pNativeSpeaker->getLocalizedStrFromID("verticalEdge-tip", L"Add your column marker by indicating its position with a decimal number. You can define several column markers by using white space to separate the different numbers."); wstring tipNote2Show = pNativeSpeaker->getLocalizedStrFromID("verticalEdge-tip", L"Add your column marker by indicating its position with a decimal number. You can define several column markers by using white space to separate the different numbers.");
_verticalEdgeTip = CreateToolTip(IDC_BUTTON_VES_TIP, _hSelf, _hInst, const_cast<PTSTR>(tipNote2Show.c_str()), pNativeSpeaker->isRTL()); _verticalEdgeTip = CreateToolTip(IDC_BUTTON_VES_TIP, _hSelf, _hInst, const_cast<PTSTR>(tipNote2Show.c_str()), pNativeSpeaker->isRTL());
if (_verticalEdgeTip != nullptr) if (_verticalEdgeTip != nullptr)
@ -2139,8 +2139,8 @@ intptr_t CALLBACK MarginsBorderEdgeSubDlg::run_dlgProc(UINT message, WPARAM wPar
NativeLangSpeaker* pNativeSpeaker = nppParam.getNativeLangSpeaker(); NativeLangSpeaker* pNativeSpeaker = nppParam.getNativeLangSpeaker();
pNativeSpeaker->messageBox("ChangeHistoryEnabledWarning", pNativeSpeaker->messageBox("ChangeHistoryEnabledWarning",
_hSelf, _hSelf,
TEXT("You have to restart Notepad++ to enable Change History."), L"You have to restart Notepad++ to enable Change History.",
TEXT("Notepad++ need to be relaunched"), L"Notepad++ need to be relaunched",
MB_OK | MB_APPLMODAL); MB_OK | MB_APPLMODAL);
changeHistoryWarningHasBeenGiven = true; changeHistoryWarningHasBeenGiven = true;
@ -2171,8 +2171,8 @@ intptr_t CALLBACK MarginsBorderEdgeSubDlg::run_dlgProc(UINT message, WPARAM wPar
NativeLangSpeaker* pNativeSpeaker = nppParam.getNativeLangSpeaker(); NativeLangSpeaker* pNativeSpeaker = nppParam.getNativeLangSpeaker();
pNativeSpeaker->messageBox("ChangeHistoryEnabledWarning", pNativeSpeaker->messageBox("ChangeHistoryEnabledWarning",
_hSelf, _hSelf,
TEXT("You have to restart Notepad++ to enable Change History."), L"You have to restart Notepad++ to enable Change History.",
TEXT("Notepad++ need to be relaunched"), L"Notepad++ need to be relaunched",
MB_OK | MB_APPLMODAL); MB_OK | MB_APPLMODAL);
changeHistoryWarningHasBeenGiven = true; changeHistoryWarningHasBeenGiven = true;
@ -2230,7 +2230,7 @@ intptr_t CALLBACK MarginsBorderEdgeSubDlg::run_dlgProc(UINT message, WPARAM wPar
{ {
if (LOWORD(wParam) == IDC_COLUMNPOS_EDIT) if (LOWORD(wParam) == IDC_COLUMNPOS_EDIT)
{ {
TCHAR text[MAX_PATH] = {'\0'}; wchar_t text[MAX_PATH] = {'\0'};
::SendDlgItemMessage(_hSelf, IDC_COLUMNPOS_EDIT, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(text)); ::SendDlgItemMessage(_hSelf, IDC_COLUMNPOS_EDIT, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(text));
if (str2numberVector(text, svp._edgeMultiColumnPos)) if (str2numberVector(text, svp._edgeMultiColumnPos))
@ -2267,9 +2267,9 @@ intptr_t CALLBACK MiscSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
{ {
case WM_INITDIALOG : case WM_INITDIALOG :
{ {
::SendDlgItemMessage(_hSelf, IDC_COMBO_FILEUPDATECHOICE, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(TEXT("Enable"))); ::SendDlgItemMessage(_hSelf, IDC_COMBO_FILEUPDATECHOICE, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"Enable"));
::SendDlgItemMessage(_hSelf, IDC_COMBO_FILEUPDATECHOICE, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(TEXT("Enable for all opened files"))); ::SendDlgItemMessage(_hSelf, IDC_COMBO_FILEUPDATECHOICE, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"Enable for all opened files"));
::SendDlgItemMessage(_hSelf, IDC_COMBO_FILEUPDATECHOICE, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(TEXT("Disable"))); ::SendDlgItemMessage(_hSelf, IDC_COMBO_FILEUPDATECHOICE, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"Disable"));
int selIndex = -1; int selIndex = -1;
@ -2351,14 +2351,14 @@ intptr_t CALLBACK MiscSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
{ {
case IDC_EDIT_SESSIONFILEEXT: case IDC_EDIT_SESSIONFILEEXT:
{ {
TCHAR sessionExt[MAX_PATH] = { '\0' }; wchar_t sessionExt[MAX_PATH] = { '\0' };
::SendDlgItemMessage(_hSelf, IDC_EDIT_SESSIONFILEEXT, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(sessionExt)); ::SendDlgItemMessage(_hSelf, IDC_EDIT_SESSIONFILEEXT, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(sessionExt));
nppGUI._definedSessionExt = sessionExt; nppGUI._definedSessionExt = sessionExt;
return TRUE; return TRUE;
} }
case IDC_EDIT_WORKSPACEFILEEXT: case IDC_EDIT_WORKSPACEFILEEXT:
{ {
TCHAR workspaceExt[MAX_PATH] = { '\0' }; wchar_t workspaceExt[MAX_PATH] = { '\0' };
::SendDlgItemMessage(_hSelf, IDC_EDIT_WORKSPACEFILEEXT, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(workspaceExt)); ::SendDlgItemMessage(_hSelf, IDC_EDIT_WORKSPACEFILEEXT, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(workspaceExt));
nppGUI._definedWorkspaceExt = workspaceExt; nppGUI._definedWorkspaceExt = workspaceExt;
return TRUE; return TRUE;
@ -2562,7 +2562,7 @@ intptr_t CALLBACK NewDocumentSubDlg::run_dlgProc(UINT message, WPARAM wParam, LP
} }
int selIndex = -1; int selIndex = -1;
generic_string str; wstring str;
EncodingMapper& em = EncodingMapper::getInstance(); EncodingMapper& em = EncodingMapper::getInstance();
for (size_t i = 0, encodingArraySize = sizeof(encodings)/sizeof(int) ; i < encodingArraySize ; ++i) for (size_t i = 0, encodingArraySize = sizeof(encodings)/sizeof(int) ; i < encodingArraySize ; ++i)
{ {
@ -2815,7 +2815,7 @@ intptr_t CALLBACK DefaultDirectorySubDlg::run_dlgProc(UINT message, WPARAM wPara
{ {
case IDC_OPENSAVEDIR_ALWAYSON_EDIT: case IDC_OPENSAVEDIR_ALWAYSON_EDIT:
{ {
TCHAR inputDir[MAX_PATH] = { '\0' }; wchar_t inputDir[MAX_PATH] = { '\0' };
::SendDlgItemMessage(_hSelf, IDC_OPENSAVEDIR_ALWAYSON_EDIT, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(inputDir)); ::SendDlgItemMessage(_hSelf, IDC_OPENSAVEDIR_ALWAYSON_EDIT, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(inputDir));
wcscpy_s(nppGUI._defaultDir, inputDir); wcscpy_s(nppGUI._defaultDir, inputDir);
::ExpandEnvironmentStrings(nppGUI._defaultDir, nppGUI._defaultDirExp, _countof(nppGUI._defaultDirExp)); ::ExpandEnvironmentStrings(nppGUI._defaultDir, nppGUI._defaultDirExp, _countof(nppGUI._defaultDirExp));
@ -2847,8 +2847,8 @@ intptr_t CALLBACK DefaultDirectorySubDlg::run_dlgProc(UINT message, WPARAM wPara
case IDD_OPENSAVEDIR_ALWAYSON_BROWSE_BUTTON : case IDD_OPENSAVEDIR_ALWAYSON_BROWSE_BUTTON :
{ {
generic_string title = nppParam.getNativeLangSpeaker()->getLocalizedStrFromID("default-open-save-select-folder", wstring title = nppParam.getNativeLangSpeaker()->getLocalizedStrFromID("default-open-save-select-folder",
TEXT("Select a folder as default directory")); L"Select a folder as default directory");
folderBrowser(_hSelf, title, IDC_OPENSAVEDIR_ALWAYSON_EDIT); folderBrowser(_hSelf, title, IDC_OPENSAVEDIR_ALWAYSON_EDIT);
} }
return TRUE; return TRUE;
@ -3131,7 +3131,7 @@ intptr_t CALLBACK LanguageSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
// //
for (int i = L_TEXT ; i < nppParam.L_END ; ++i) for (int i = L_TEXT ; i < nppParam.L_END ; ++i)
{ {
generic_string str; wstring str;
if (static_cast<LangType>(i) != L_USER) if (static_cast<LangType>(i) != L_USER)
{ {
int cmdID = nppParam.langTypeToCommandID(static_cast<LangType>(i)); int cmdID = nppParam.langTypeToCommandID(static_cast<LangType>(i));
@ -3173,7 +3173,7 @@ intptr_t CALLBACK LanguageSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
::SendDlgItemMessage(_hSelf, IDC_RADIO_USINGTAB, BM_SETCHECK, !nppGUI._tabReplacedBySpace, 0); ::SendDlgItemMessage(_hSelf, IDC_RADIO_USINGTAB, BM_SETCHECK, !nppGUI._tabReplacedBySpace, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_BACKSPACEUNINDENT, BM_SETCHECK, nppGUI._backspaceUnindent, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_BACKSPACEUNINDENT, BM_SETCHECK, nppGUI._backspaceUnindent, 0);
::SendDlgItemMessage(_hSelf, IDC_LIST_TABSETTNG, LB_ADDSTRING, 0, reinterpret_cast<LPARAM>(TEXT("[Default]"))); ::SendDlgItemMessage(_hSelf, IDC_LIST_TABSETTNG, LB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"[Default]"));
const int nbLang = nppParam.getNbLang(); const int nbLang = nppParam.getNbLang();
for (int i = 0; i < nbLang; ++i) for (int i = 0; i < nbLang; ++i)
{ {
@ -3451,8 +3451,8 @@ intptr_t CALLBACK LanguageSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
nppGUI._isLangMenuCompact = (BST_CHECKED == ::SendMessage(::GetDlgItem(_hSelf, IDC_CHECK_LANGMENUCOMPACT), BM_GETCHECK, 0, 0)); nppGUI._isLangMenuCompact = (BST_CHECKED == ::SendMessage(::GetDlgItem(_hSelf, IDC_CHECK_LANGMENUCOMPACT), BM_GETCHECK, 0, 0));
pNativeSpeaker->messageBox("LanguageMenuCompactWarning", pNativeSpeaker->messageBox("LanguageMenuCompactWarning",
_hSelf, _hSelf,
TEXT("This option will be changed on the next launch."), L"This option will be changed on the next launch.",
TEXT("Compact Language Menu"), L"Compact Language Menu",
MB_OK); MB_OK);
return TRUE; return TRUE;
} }
@ -3492,7 +3492,7 @@ intptr_t CALLBACK LanguageSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
return TRUE; return TRUE;
const size_t sL = 31; const size_t sL = 31;
TCHAR s[sL + 1] = { '\0' }; wchar_t s[sL + 1] = { '\0' };
auto lbTextLen = ::SendDlgItemMessage(_hSelf, list2Remove, LB_GETTEXTLEN, iRemove, 0); auto lbTextLen = ::SendDlgItemMessage(_hSelf, list2Remove, LB_GETTEXTLEN, iRemove, 0);
if (static_cast<size_t>(lbTextLen) > sL) if (static_cast<size_t>(lbTextLen) > sL)
return TRUE; return TRUE;
@ -3517,16 +3517,16 @@ intptr_t CALLBACK LanguageSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
bool found(false); bool found(false);
for (size_t x = 0; x < nppParam.getExternalLexerDoc()->size() && !found; ++x) for (size_t x = 0; x < nppParam.getExternalLexerDoc()->size() && !found; ++x)
{ {
TiXmlNode *lexersRoot = nppParam.getExternalLexerDoc()->at(x)->FirstChild(TEXT("NotepadPlus"))->FirstChildElement(TEXT("LexerStyles")); TiXmlNode *lexersRoot = nppParam.getExternalLexerDoc()->at(x)->FirstChild(L"NotepadPlus")->FirstChildElement(L"LexerStyles");
for (TiXmlNode *childNode = lexersRoot->FirstChildElement(TEXT("LexerType")); for (TiXmlNode *childNode = lexersRoot->FirstChildElement(L"LexerType");
childNode ; childNode ;
childNode = childNode->NextSibling(TEXT("LexerType"))) childNode = childNode->NextSibling(L"LexerType"))
{ {
TiXmlElement *element = childNode->ToElement(); TiXmlElement *element = childNode->ToElement();
if (generic_string(element->Attribute(TEXT("name"))) == lmi._langName) if (wstring(element->Attribute(L"name")) == lmi._langName)
{ {
element->SetAttribute(TEXT("excluded"), (LOWORD(wParam)==IDC_BUTTON_REMOVE)?TEXT("yes"):TEXT("no")); element->SetAttribute(L"excluded", (LOWORD(wParam)==IDC_BUTTON_REMOVE)?L"yes":L"no");
nppParam.getExternalLexerDoc()->at(x)->SaveFile(); nppParam.getExternalLexerDoc()->at(x)->SaveFile();
found = true; found = true;
break; break;
@ -3563,8 +3563,8 @@ intptr_t CALLBACK LanguageSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
} }
// Find the location in existing language menu to insert to. This includes submenu if using compact language menu. // Find the location in existing language menu to insert to. This includes submenu if using compact language menu.
TCHAR firstLetter = lmi._langName.empty() ? TEXT('\0') : towupper(lmi._langName[0]); wchar_t firstLetter = lmi._langName.empty() ? L'\0' : towupper(lmi._langName[0]);
TCHAR buffer[MAX_EXTERNAL_LEXER_NAME_LEN]{TEXT('\0')}; wchar_t buffer[MAX_EXTERNAL_LEXER_NAME_LEN]{ L'\0' };
menuItemInfo.fMask = MIIM_SUBMENU; menuItemInfo.fMask = MIIM_SUBMENU;
for (++x; x < nbItem; ++x) for (++x; x < nbItem; ++x)
{ {
@ -3946,14 +3946,14 @@ intptr_t CALLBACK PrintSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM l
::SetDlgItemText(_hSelf, IDC_EDIT_FMIDDLE, nppGUI._printSettings._footerMiddle.c_str()); ::SetDlgItemText(_hSelf, IDC_EDIT_FMIDDLE, nppGUI._printSettings._footerMiddle.c_str());
::SetDlgItemText(_hSelf, IDC_EDIT_FRIGHT, nppGUI._printSettings._footerRight.c_str()); ::SetDlgItemText(_hSelf, IDC_EDIT_FRIGHT, nppGUI._printSettings._footerRight.c_str());
TCHAR intStr[5]{}; wchar_t intStr[5]{};
for (int i = 6 ; i < 15 ; ++i) for (int i = 6 ; i < 15 ; ++i)
{ {
wsprintf(intStr, TEXT("%d"), i); wsprintf(intStr, L"%d", i);
::SendDlgItemMessage(_hSelf, IDC_COMBO_HFONTSIZE, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(intStr)); ::SendDlgItemMessage(_hSelf, IDC_COMBO_HFONTSIZE, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(intStr));
::SendDlgItemMessage(_hSelf, IDC_COMBO_FFONTSIZE, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(intStr)); ::SendDlgItemMessage(_hSelf, IDC_COMBO_FFONTSIZE, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(intStr));
} }
const std::vector<generic_string> & fontlist = nppParam.getFontList(); const std::vector<wstring> & fontlist = nppParam.getFontList();
for (size_t i = 0, len = fontlist.size() ; i < len ; ++i) for (size_t i = 0, len = fontlist.size() ; i < len ; ++i)
{ {
auto j = ::SendDlgItemMessage(_hSelf, IDC_COMBO_HFONTNAME, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(fontlist[i].c_str())); auto j = ::SendDlgItemMessage(_hSelf, IDC_COMBO_HFONTNAME, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(fontlist[i].c_str()));
@ -3972,9 +3972,9 @@ intptr_t CALLBACK PrintSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM l
index = 0; index = 0;
::SendDlgItemMessage(_hSelf, IDC_COMBO_FFONTNAME, CB_SETCURSEL, index, 0); ::SendDlgItemMessage(_hSelf, IDC_COMBO_FFONTNAME, CB_SETCURSEL, index, 0);
wsprintf(intStr, TEXT("%d"), nppGUI._printSettings._headerFontSize); wsprintf(intStr, L"%d", nppGUI._printSettings._headerFontSize);
::SendDlgItemMessage(_hSelf, IDC_COMBO_HFONTSIZE, CB_SELECTSTRING, static_cast<WPARAM>(-1), reinterpret_cast<LPARAM>(intStr)); ::SendDlgItemMessage(_hSelf, IDC_COMBO_HFONTSIZE, CB_SELECTSTRING, static_cast<WPARAM>(-1), reinterpret_cast<LPARAM>(intStr));
wsprintf(intStr, TEXT("%d"), nppGUI._printSettings._footerFontSize); wsprintf(intStr, L"%d", nppGUI._printSettings._footerFontSize);
::SendDlgItemMessage(_hSelf, IDC_COMBO_FFONTSIZE, CB_SELECTSTRING, static_cast<WPARAM>(-1), reinterpret_cast<LPARAM>(intStr)); ::SendDlgItemMessage(_hSelf, IDC_COMBO_FFONTSIZE, CB_SELECTSTRING, static_cast<WPARAM>(-1), reinterpret_cast<LPARAM>(intStr));
::SendDlgItemMessage(_hSelf, IDC_CHECK_HBOLD, BM_SETCHECK, nppGUI._printSettings._headerFontStyle & FONTSTYLE_BOLD, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_HBOLD, BM_SETCHECK, nppGUI._printSettings._headerFontStyle & FONTSTYLE_BOLD, 0);
@ -3982,21 +3982,21 @@ intptr_t CALLBACK PrintSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM l
::SendDlgItemMessage(_hSelf, IDC_CHECK_FBOLD, BM_SETCHECK, nppGUI._printSettings._footerFontStyle & FONTSTYLE_BOLD, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_FBOLD, BM_SETCHECK, nppGUI._printSettings._footerFontStyle & FONTSTYLE_BOLD, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_FITALIC, BM_SETCHECK, nppGUI._printSettings._footerFontStyle & FONTSTYLE_ITALIC, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_FITALIC, BM_SETCHECK, nppGUI._printSettings._footerFontStyle & FONTSTYLE_ITALIC, 0);
::SendDlgItemMessage(_hSelf, IDC_COMBO_VARLIST, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(TEXT("Full file name path"))); ::SendDlgItemMessage(_hSelf, IDC_COMBO_VARLIST, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"Full file name path"));
::SendDlgItemMessage(_hSelf, IDC_COMBO_VARLIST, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(TEXT("File name"))); ::SendDlgItemMessage(_hSelf, IDC_COMBO_VARLIST, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"File name"));
::SendDlgItemMessage(_hSelf, IDC_COMBO_VARLIST, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(TEXT("File directory"))); ::SendDlgItemMessage(_hSelf, IDC_COMBO_VARLIST, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"File directory"));
::SendDlgItemMessage(_hSelf, IDC_COMBO_VARLIST, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(TEXT("Page"))); ::SendDlgItemMessage(_hSelf, IDC_COMBO_VARLIST, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"Page"));
::SendDlgItemMessage(_hSelf, IDC_COMBO_VARLIST, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(TEXT("Short date format"))); ::SendDlgItemMessage(_hSelf, IDC_COMBO_VARLIST, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"Short date format"));
::SendDlgItemMessage(_hSelf, IDC_COMBO_VARLIST, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(TEXT("Long date format"))); ::SendDlgItemMessage(_hSelf, IDC_COMBO_VARLIST, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"Long date format"));
::SendDlgItemMessage(_hSelf, IDC_COMBO_VARLIST, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(TEXT("Time"))); ::SendDlgItemMessage(_hSelf, IDC_COMBO_VARLIST, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"Time"));
varList.push_back(TEXT("$(FULL_CURRENT_PATH)")); varList.push_back(L"$(FULL_CURRENT_PATH)");
varList.push_back(TEXT("$(FILE_NAME)")); varList.push_back(L"$(FILE_NAME)");
varList.push_back(TEXT("$(CURRENT_DIRECTORY)")); varList.push_back(L"$(CURRENT_DIRECTORY)");
varList.push_back(TEXT("$(CURRENT_PRINTING_PAGE)")); varList.push_back(L"$(CURRENT_PRINTING_PAGE)");
varList.push_back(TEXT("$(SHORT_DATE)")); varList.push_back(L"$(SHORT_DATE)");
varList.push_back(TEXT("$(LONG_DATE)")); varList.push_back(L"$(LONG_DATE)");
varList.push_back(TEXT("$(TIME)")); varList.push_back(L"$(TIME)");
::SendDlgItemMessage(_hSelf, IDC_COMBO_VARLIST, CB_SETCURSEL, 0, 0); ::SendDlgItemMessage(_hSelf, IDC_COMBO_VARLIST, CB_SETCURSEL, 0, 0);
@ -4063,7 +4063,7 @@ intptr_t CALLBACK PrintSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM l
default: default:
{ {
constexpr int stringSize = 256; constexpr int stringSize = 256;
TCHAR str[stringSize]{}; wchar_t str[stringSize]{};
_focusedEditCtrl = LOWORD(wParam); _focusedEditCtrl = LOWORD(wParam);
::GetDlgItemText(_hSelf, _focusedEditCtrl, str, stringSize); ::GetDlgItemText(_hSelf, _focusedEditCtrl, str, stringSize);
::SendDlgItemMessage(_hSelf, IDC_EDIT_VIEWPANEL, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(str)); ::SendDlgItemMessage(_hSelf, IDC_EDIT_VIEWPANEL, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(str));
@ -4108,7 +4108,7 @@ intptr_t CALLBACK PrintSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM l
else if (HIWORD(wParam) == EN_SETFOCUS && LOWORD(wParam) != IDC_EDIT_VIEWPANEL) else if (HIWORD(wParam) == EN_SETFOCUS && LOWORD(wParam) != IDC_EDIT_VIEWPANEL)
{ {
constexpr int stringSize = 256; constexpr int stringSize = 256;
TCHAR str[stringSize]{}; wchar_t str[stringSize]{};
_focusedEditCtrl = LOWORD(wParam); _focusedEditCtrl = LOWORD(wParam);
int focusedEditStatic = 0; int focusedEditStatic = 0;
@ -4126,8 +4126,8 @@ intptr_t CALLBACK PrintSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM l
::GetDlgItemText(_hSelf, _focusedEditCtrl, str, stringSize); ::GetDlgItemText(_hSelf, _focusedEditCtrl, str, stringSize);
::SendDlgItemMessage(_hSelf, IDC_EDIT_VIEWPANEL, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(str)); ::SendDlgItemMessage(_hSelf, IDC_EDIT_VIEWPANEL, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(str));
::GetDlgItemText(_hSelf, groupStatic, str, stringSize); ::GetDlgItemText(_hSelf, groupStatic, str, stringSize);
generic_string title = str; wstring title = str;
title += TEXT(" "); title += L" ";
::GetDlgItemText(_hSelf, focusedEditStatic, str, stringSize); ::GetDlgItemText(_hSelf, focusedEditStatic, str, stringSize);
title += str; title += str;
title = purgeMenuItemString(title.c_str()); // use purgeMenuItemString to clean '&' title = purgeMenuItemString(title.c_str()); // use purgeMenuItemString to clean '&'
@ -4144,7 +4144,7 @@ intptr_t CALLBACK PrintSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM l
case IDC_COMBO_HFONTNAME : case IDC_COMBO_HFONTNAME :
case IDC_COMBO_FFONTNAME : case IDC_COMBO_FFONTNAME :
{ {
TCHAR *fnStr = (TCHAR *)::SendDlgItemMessage(_hSelf, LOWORD(wParam), CB_GETITEMDATA, iSel, 0); wchar_t *fnStr = (wchar_t *)::SendDlgItemMessage(_hSelf, LOWORD(wParam), CB_GETITEMDATA, iSel, 0);
if (LOWORD(wParam) == IDC_COMBO_HFONTNAME) if (LOWORD(wParam) == IDC_COMBO_HFONTNAME)
nppGUI._printSettings._headerFontName = fnStr; nppGUI._printSettings._headerFontName = fnStr;
else else
@ -4157,7 +4157,7 @@ intptr_t CALLBACK PrintSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM l
case IDC_COMBO_FFONTSIZE : case IDC_COMBO_FFONTSIZE :
{ {
constexpr size_t intStrLen = 3; constexpr size_t intStrLen = 3;
TCHAR intStr[intStrLen]{}; wchar_t intStr[intStrLen]{};
auto lbTextLen = ::SendDlgItemMessage(_hSelf, LOWORD(wParam), CB_GETLBTEXTLEN, iSel, 0); auto lbTextLen = ::SendDlgItemMessage(_hSelf, LOWORD(wParam), CB_GETLBTEXTLEN, iSel, 0);
if (static_cast<size_t>(lbTextLen) >= intStrLen) if (static_cast<size_t>(lbTextLen) >= intStrLen)
@ -4235,16 +4235,16 @@ intptr_t CALLBACK PrintSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM l
if (iSel >= varList.size()) if (iSel >= varList.size())
return TRUE; return TRUE;
TCHAR *varStr = (TCHAR*)varList[iSel].c_str(); wchar_t *varStr = (wchar_t*)varList[iSel].c_str();
size_t selStart = 0; size_t selStart = 0;
size_t selEnd = 0; size_t selEnd = 0;
::SendDlgItemMessage(_hSelf, _focusedEditCtrl, EM_GETSEL, reinterpret_cast<WPARAM>(&selStart), reinterpret_cast<LPARAM>(&selEnd)); ::SendDlgItemMessage(_hSelf, _focusedEditCtrl, EM_GETSEL, reinterpret_cast<WPARAM>(&selStart), reinterpret_cast<LPARAM>(&selEnd));
constexpr int stringSize = 256; constexpr int stringSize = 256;
TCHAR str[stringSize]{}; wchar_t str[stringSize]{};
::SendDlgItemMessage(_hSelf, _focusedEditCtrl, WM_GETTEXT, stringSize, reinterpret_cast<LPARAM>(str)); ::SendDlgItemMessage(_hSelf, _focusedEditCtrl, WM_GETTEXT, stringSize, reinterpret_cast<LPARAM>(str));
generic_string str2Set(str); wstring str2Set(str);
size_t strLen = str2Set.length(); size_t strLen = str2Set.length();
if (selStart > strLen || selEnd > strLen) if (selStart > strLen || selEnd > strLen)
selStart = selEnd = strLen; selStart = selEnd = strLen;
@ -4280,8 +4280,8 @@ intptr_t CALLBACK BackupSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
::SendDlgItemMessage(_hSelf, IDC_BACKUPDIR_RESTORESESSION_CHECK, BM_SETCHECK, snapshotCheck?BST_CHECKED:BST_UNCHECKED, 0); ::SendDlgItemMessage(_hSelf, IDC_BACKUPDIR_RESTORESESSION_CHECK, BM_SETCHECK, snapshotCheck?BST_CHECKED:BST_UNCHECKED, 0);
auto periodicBackupInSec = static_cast<UINT>(nppGUI._snapshotBackupTiming / 1000); auto periodicBackupInSec = static_cast<UINT>(nppGUI._snapshotBackupTiming / 1000);
::SetDlgItemInt(_hSelf, IDC_BACKUPDIR_RESTORESESSION_EDIT,periodicBackupInSec, FALSE); ::SetDlgItemInt(_hSelf, IDC_BACKUPDIR_RESTORESESSION_EDIT,periodicBackupInSec, FALSE);
generic_string backupFilePath = NppParameters::getInstance().getUserPath(); wstring backupFilePath = NppParameters::getInstance().getUserPath();
backupFilePath += TEXT("\\backup\\"); backupFilePath += L"\\backup\\";
::SetDlgItemText(_hSelf, IDD_BACKUPDIR_RESTORESESSION_PATH_EDIT, backupFilePath.c_str()); ::SetDlgItemText(_hSelf, IDD_BACKUPDIR_RESTORESESSION_PATH_EDIT, backupFilePath.c_str());
::SendDlgItemMessage(_hSelf, IDC_CHECK_KEEPABSENTFILESINSESSION, BM_SETCHECK, nppGUI._keepSessionAbsentFileEntries, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_KEEPABSENTFILESINSESSION, BM_SETCHECK, nppGUI._keepSessionAbsentFileEntries, 0);
@ -4367,7 +4367,7 @@ intptr_t CALLBACK BackupSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
{ {
case IDC_BACKUPDIR_EDIT: case IDC_BACKUPDIR_EDIT:
{ {
TCHAR inputDir[MAX_PATH] = {'\0'}; wchar_t inputDir[MAX_PATH] = {'\0'};
::SendDlgItemMessage(_hSelf, IDC_BACKUPDIR_EDIT, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(inputDir)); ::SendDlgItemMessage(_hSelf, IDC_BACKUPDIR_EDIT, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(inputDir));
nppGUI._backupDir = inputDir; nppGUI._backupDir = inputDir;
return TRUE; return TRUE;
@ -4377,11 +4377,11 @@ intptr_t CALLBACK BackupSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
{ {
constexpr int stringSize = 16; constexpr int stringSize = 16;
TCHAR str[stringSize]{}; wchar_t str[stringSize]{};
::GetDlgItemText(_hSelf, IDC_BACKUPDIR_RESTORESESSION_EDIT, str, stringSize); ::GetDlgItemText(_hSelf, IDC_BACKUPDIR_RESTORESESSION_EDIT, str, stringSize);
if (lstrcmp(str, TEXT("")) == 0) if (lstrcmp(str, L"") == 0)
return TRUE; return TRUE;
nppGUI._snapshotBackupTiming = ::GetDlgItemInt(_hSelf, IDC_BACKUPDIR_RESTORESESSION_EDIT, NULL, FALSE) * 1000; nppGUI._snapshotBackupTiming = ::GetDlgItemInt(_hSelf, IDC_BACKUPDIR_RESTORESESSION_EDIT, NULL, FALSE) * 1000;
@ -4400,13 +4400,13 @@ intptr_t CALLBACK BackupSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
{ {
case IDC_BACKUPDIR_RESTORESESSION_EDIT: case IDC_BACKUPDIR_RESTORESESSION_EDIT:
{ {
//printStr(TEXT("")); //printStr(L"");
constexpr int stringSize = 16; constexpr int stringSize = 16;
TCHAR str[stringSize]{}; wchar_t str[stringSize]{};
::GetDlgItemText(_hSelf, IDC_BACKUPDIR_RESTORESESSION_EDIT, str, stringSize); ::GetDlgItemText(_hSelf, IDC_BACKUPDIR_RESTORESESSION_EDIT, str, stringSize);
if (lstrcmp(str, TEXT("")) == 0) if (lstrcmp(str, L"") == 0)
{ {
::SetDlgItemInt(_hSelf, IDC_BACKUPDIR_RESTORESESSION_EDIT, static_cast<int32_t>(nppGUI._snapshotBackupTiming / 1000), FALSE); ::SetDlgItemInt(_hSelf, IDC_BACKUPDIR_RESTORESESSION_EDIT, static_cast<int32_t>(nppGUI._snapshotBackupTiming / 1000), FALSE);
} }
@ -4476,8 +4476,8 @@ intptr_t CALLBACK BackupSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
} }
case IDD_BACKUPDIR_BROWSE_BUTTON : case IDD_BACKUPDIR_BROWSE_BUTTON :
{ {
generic_string title = nppParam.getNativeLangSpeaker()->getLocalizedStrFromID("backup-select-folder", wstring title = nppParam.getNativeLangSpeaker()->getLocalizedStrFromID("backup-select-folder",
TEXT("Select a folder as backup directory")); L"Select a folder as backup directory");
folderBrowser(_hSelf, title, IDC_BACKUPDIR_EDIT); folderBrowser(_hSelf, title, IDC_BACKUPDIR_EDIT);
return TRUE; return TRUE;
} }
@ -4591,23 +4591,23 @@ intptr_t CALLBACK AutoCompletionSubDlg::run_dlgProc(UINT message, WPARAM wParam,
::SendDlgItemMessage(_hSelf, IDD_AUTOCPARENTHESES_CHECK, BM_SETCHECK, nppGUI._matchedPairConf._doParentheses?BST_CHECKED:BST_UNCHECKED, 0); ::SendDlgItemMessage(_hSelf, IDD_AUTOCPARENTHESES_CHECK, BM_SETCHECK, nppGUI._matchedPairConf._doParentheses?BST_CHECKED:BST_UNCHECKED, 0);
if (nppGUI._matchedPairConf._doParentheses) if (nppGUI._matchedPairConf._doParentheses)
::SendDlgItemMessage(_hSelf, IDD_AUTOCPARENTHESES_CHECK, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(TEXT(" ( )"))); ::SendDlgItemMessage(_hSelf, IDD_AUTOCPARENTHESES_CHECK, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(L" ( )"));
::SendDlgItemMessage(_hSelf, IDD_AUTOCBRACKET_CHECK, BM_SETCHECK, nppGUI._matchedPairConf._doBrackets?BST_CHECKED:BST_UNCHECKED, 0); ::SendDlgItemMessage(_hSelf, IDD_AUTOCBRACKET_CHECK, BM_SETCHECK, nppGUI._matchedPairConf._doBrackets?BST_CHECKED:BST_UNCHECKED, 0);
if (nppGUI._matchedPairConf._doBrackets) if (nppGUI._matchedPairConf._doBrackets)
::SendDlgItemMessage(_hSelf, IDD_AUTOCBRACKET_CHECK, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(TEXT(" [ ]"))); ::SendDlgItemMessage(_hSelf, IDD_AUTOCBRACKET_CHECK, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(L" [ ]"));
::SendDlgItemMessage(_hSelf, IDD_AUTOCCURLYBRACKET_CHECK, BM_SETCHECK, nppGUI._matchedPairConf._doCurlyBrackets?BST_CHECKED:BST_UNCHECKED, 0); ::SendDlgItemMessage(_hSelf, IDD_AUTOCCURLYBRACKET_CHECK, BM_SETCHECK, nppGUI._matchedPairConf._doCurlyBrackets?BST_CHECKED:BST_UNCHECKED, 0);
if (nppGUI._matchedPairConf._doCurlyBrackets) if (nppGUI._matchedPairConf._doCurlyBrackets)
::SendDlgItemMessage(_hSelf, IDD_AUTOCCURLYBRACKET_CHECK, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(TEXT(" { }"))); ::SendDlgItemMessage(_hSelf, IDD_AUTOCCURLYBRACKET_CHECK, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(L" { }"));
::SendDlgItemMessage(_hSelf, IDD_AUTOC_QUOTESCHECK, BM_SETCHECK, nppGUI._matchedPairConf._doQuotes?BST_CHECKED:BST_UNCHECKED, 0); ::SendDlgItemMessage(_hSelf, IDD_AUTOC_QUOTESCHECK, BM_SETCHECK, nppGUI._matchedPairConf._doQuotes?BST_CHECKED:BST_UNCHECKED, 0);
if (nppGUI._matchedPairConf._doQuotes) if (nppGUI._matchedPairConf._doQuotes)
::SendDlgItemMessage(_hSelf, IDD_AUTOC_QUOTESCHECK, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(TEXT(" ' '"))); ::SendDlgItemMessage(_hSelf, IDD_AUTOC_QUOTESCHECK, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(L" ' '"));
::SendDlgItemMessage(_hSelf, IDD_AUTOC_DOUBLEQUOTESCHECK, BM_SETCHECK, nppGUI._matchedPairConf._doDoubleQuotes?BST_CHECKED:BST_UNCHECKED, 0); ::SendDlgItemMessage(_hSelf, IDD_AUTOC_DOUBLEQUOTESCHECK, BM_SETCHECK, nppGUI._matchedPairConf._doDoubleQuotes?BST_CHECKED:BST_UNCHECKED, 0);
if (nppGUI._matchedPairConf._doDoubleQuotes) if (nppGUI._matchedPairConf._doDoubleQuotes)
::SendDlgItemMessage(_hSelf, IDD_AUTOC_DOUBLEQUOTESCHECK, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(TEXT(" \" \""))); ::SendDlgItemMessage(_hSelf, IDD_AUTOC_DOUBLEQUOTESCHECK, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(L" \" \""));
::SendDlgItemMessage(_hSelf, IDD_AUTOCTAG_CHECK, BM_SETCHECK, nppGUI._matchedPairConf._doHtmlXmlTag?BST_CHECKED:BST_UNCHECKED, 0); ::SendDlgItemMessage(_hSelf, IDD_AUTOCTAG_CHECK, BM_SETCHECK, nppGUI._matchedPairConf._doHtmlXmlTag?BST_CHECKED:BST_UNCHECKED, 0);
@ -4623,10 +4623,10 @@ intptr_t CALLBACK AutoCompletionSubDlg::run_dlgProc(UINT message, WPARAM wParam,
nbMatchedPair = 3; nbMatchedPair = 3;
for (size_t i = 0; i < nbMatchedPair; ++i) for (size_t i = 0; i < nbMatchedPair; ++i)
{ {
TCHAR openChar[2]{}; wchar_t openChar[2]{};
openChar[0] = nppGUI._matchedPairConf._matchedPairs[i].first; openChar[0] = nppGUI._matchedPairConf._matchedPairs[i].first;
openChar[1] = '\0'; openChar[1] = '\0';
TCHAR closeChar[2]{}; wchar_t closeChar[2]{};
closeChar[0] = nppGUI._matchedPairConf._matchedPairs[i].second; closeChar[0] = nppGUI._matchedPairConf._matchedPairs[i].second;
closeChar[1] = '\0'; closeChar[1] = '\0';
@ -4716,8 +4716,8 @@ intptr_t CALLBACK AutoCompletionSubDlg::run_dlgProc(UINT message, WPARAM wParam,
{ {
nppGUI._matchedPairConf._matchedPairs.clear(); nppGUI._matchedPairConf._matchedPairs.clear();
TCHAR opener[2] = {'\0', '\0'}; wchar_t opener[2] = {'\0', '\0'};
TCHAR closer[2] = {'\0', '\0'}; wchar_t closer[2] = {'\0', '\0'};
::SendDlgItemMessage(_hSelf, IDC_MACHEDPAIROPEN_EDIT1, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(opener)); ::SendDlgItemMessage(_hSelf, IDC_MACHEDPAIROPEN_EDIT1, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(opener));
::SendDlgItemMessage(_hSelf, IDC_MACHEDPAIRCLOSE_EDIT1, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(closer)); ::SendDlgItemMessage(_hSelf, IDC_MACHEDPAIRCLOSE_EDIT1, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(closer));
@ -4859,31 +4859,31 @@ intptr_t CALLBACK AutoCompletionSubDlg::run_dlgProc(UINT message, WPARAM wParam,
case IDD_AUTOC_QUOTESCHECK : case IDD_AUTOC_QUOTESCHECK :
{ {
bool isChecked = isCheckedOrNot(static_cast<int32_t>(wParam)); bool isChecked = isCheckedOrNot(static_cast<int32_t>(wParam));
const TCHAR *label = nullptr; const wchar_t *label = nullptr;
if (wParam == IDD_AUTOCPARENTHESES_CHECK) if (wParam == IDD_AUTOCPARENTHESES_CHECK)
{ {
nppGUI._matchedPairConf._doParentheses = isChecked; nppGUI._matchedPairConf._doParentheses = isChecked;
label = isChecked?TEXT(" ( )"):TEXT(" ("); label = isChecked ? L" ( )" : L" (";
} }
else if (wParam == IDD_AUTOCBRACKET_CHECK) else if (wParam == IDD_AUTOCBRACKET_CHECK)
{ {
nppGUI._matchedPairConf._doBrackets = isChecked; nppGUI._matchedPairConf._doBrackets = isChecked;
label = isChecked?TEXT(" [ ]"):TEXT(" ["); label = isChecked ? L" [ ]" : L" [";
} }
else if (wParam == IDD_AUTOCCURLYBRACKET_CHECK) else if (wParam == IDD_AUTOCCURLYBRACKET_CHECK)
{ {
nppGUI._matchedPairConf._doCurlyBrackets = isChecked; nppGUI._matchedPairConf._doCurlyBrackets = isChecked;
label = isChecked?TEXT(" { }"):TEXT(" {"); label = isChecked ? L" { }" : L" {";
} }
else if (wParam == IDD_AUTOC_DOUBLEQUOTESCHECK) else if (wParam == IDD_AUTOC_DOUBLEQUOTESCHECK)
{ {
nppGUI._matchedPairConf._doDoubleQuotes = isChecked; nppGUI._matchedPairConf._doDoubleQuotes = isChecked;
label = isChecked?TEXT(" \" \""):TEXT(" \""); label = isChecked ? L" \" \"" : L" \"";
} }
else // if (wParam == IDD_AUTOC_QUOTESCHECK) else // if (wParam == IDD_AUTOC_QUOTESCHECK)
{ {
nppGUI._matchedPairConf._doQuotes = isChecked; nppGUI._matchedPairConf._doQuotes = isChecked;
label = isChecked?TEXT(" ' '"):TEXT(" '"); label = isChecked ? L" ' '" : L" '";
} }
::SendDlgItemMessage(_hSelf, static_cast<int32_t>(wParam), WM_SETTEXT, 0, reinterpret_cast<LPARAM>(label)); ::SendDlgItemMessage(_hSelf, static_cast<int32_t>(wParam), WM_SETTEXT, 0, reinterpret_cast<LPARAM>(label));
return TRUE; return TRUE;
@ -4934,7 +4934,7 @@ intptr_t CALLBACK MultiInstanceSubDlg::run_dlgProc(UINT message, WPARAM wParam,
::SendDlgItemMessage(_hSelf, IDD_DATETIMEFORMAT_REVERSEORDER_CHECK, BM_SETCHECK, nppGUI._dateTimeReverseDefaultOrder ? BST_CHECKED : BST_UNCHECKED, 0); ::SendDlgItemMessage(_hSelf, IDD_DATETIMEFORMAT_REVERSEORDER_CHECK, BM_SETCHECK, nppGUI._dateTimeReverseDefaultOrder ? BST_CHECKED : BST_UNCHECKED, 0);
::SetDlgItemText(_hSelf, IDC_DATETIMEFORMAT_EDIT, nppGUI._dateTimeFormat.c_str()); ::SetDlgItemText(_hSelf, IDC_DATETIMEFORMAT_EDIT, nppGUI._dateTimeFormat.c_str());
generic_string datetimeStr = getDateTimeStrFrom(nppGUI._dateTimeFormat, _BTTF_time); wstring datetimeStr = getDateTimeStrFrom(nppGUI._dateTimeFormat, _BTTF_time);
::SetDlgItemText(_hSelf, IDD_DATETIMEFORMAT_RESULT_STATIC, datetimeStr.c_str()); ::SetDlgItemText(_hSelf, IDD_DATETIMEFORMAT_RESULT_STATIC, datetimeStr.c_str());
return TRUE; return TRUE;
@ -4965,11 +4965,11 @@ intptr_t CALLBACK MultiInstanceSubDlg::run_dlgProc(UINT message, WPARAM wParam,
if (HIWORD(wParam) == EN_CHANGE && LOWORD(wParam) == IDC_DATETIMEFORMAT_EDIT) if (HIWORD(wParam) == EN_CHANGE && LOWORD(wParam) == IDC_DATETIMEFORMAT_EDIT)
{ {
constexpr size_t inputLen = 256; constexpr size_t inputLen = 256;
TCHAR input[inputLen]{}; wchar_t input[inputLen]{};
::GetDlgItemText(_hSelf, IDC_DATETIMEFORMAT_EDIT, input, inputLen); ::GetDlgItemText(_hSelf, IDC_DATETIMEFORMAT_EDIT, input, inputLen);
nppGUI._dateTimeFormat = input; nppGUI._dateTimeFormat = input;
generic_string datetimeStr = getDateTimeStrFrom(nppGUI._dateTimeFormat, _BTTF_time); wstring datetimeStr = getDateTimeStrFrom(nppGUI._dateTimeFormat, _BTTF_time);
::SetDlgItemText(_hSelf, IDD_DATETIMEFORMAT_RESULT_STATIC, datetimeStr.c_str()); ::SetDlgItemText(_hSelf, IDD_DATETIMEFORMAT_RESULT_STATIC, datetimeStr.c_str());
return TRUE; return TRUE;
} }
@ -5071,82 +5071,82 @@ void DelimiterSubDlg::detectSpace(const char *text2Check, int & nbSp, int & nbTa
} }
generic_string DelimiterSubDlg::getWarningText(size_t nbSp, size_t nbTab) const wstring DelimiterSubDlg::getWarningText(size_t nbSp, size_t nbTab) const
{ {
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
generic_string msg; wstring msg;
if (nbSp && nbTab) if (nbSp && nbTab)
{ {
generic_string nbSpStr = std::to_wstring(nbSp); wstring nbSpStr = std::to_wstring(nbSp);
generic_string nbTabStr = std::to_wstring(nbTab); wstring nbTabStr = std::to_wstring(nbTab);
generic_string warnBegin = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-warning-begin", TEXT("")); wstring warnBegin = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-warning-begin", L"");
generic_string space = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-space-warning", TEXT("")); wstring space = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-space-warning", L"");
generic_string tab = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-tab-warning", TEXT("")); wstring tab = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-tab-warning", L"");
generic_string warnEnd = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-warning-end", TEXT("")); wstring warnEnd = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-warning-end", L"");
// half translation is not allowed // half translation is not allowed
if (!warnBegin.empty() && !space.empty() && !tab.empty() && !warnEnd.empty()) if (!warnBegin.empty() && !space.empty() && !tab.empty() && !warnEnd.empty())
{ {
space = stringReplace(space, TEXT("$INT_REPLACE$"), nbSpStr); space = stringReplace(space, L"$INT_REPLACE$", nbSpStr);
tab = stringReplace(tab, TEXT("$INT_REPLACE$"), nbTabStr); tab = stringReplace(tab, L"$INT_REPLACE$", nbTabStr);
msg = warnBegin; msg = warnBegin;
msg += space; msg += space;
msg += TEXT(" && "); msg += L" && ";
msg += tab; msg += tab;
msg += warnEnd; msg += warnEnd;
} }
else else
{ {
msg = TEXT("Be aware: "); msg = L"Be aware: ";
msg += nbSpStr; msg += nbSpStr;
msg += TEXT(" space(s) && "); msg += L" space(s) && ";
msg += std::to_wstring(nbTab); msg += std::to_wstring(nbTab);
msg += TEXT(" TAB(s) in your character list."); msg += L" TAB(s) in your character list.";
} }
} }
else if (nbSp && !nbTab) else if (nbSp && !nbTab)
{ {
generic_string nbSpStr = std::to_wstring(nbSp); wstring nbSpStr = std::to_wstring(nbSp);
generic_string warnBegin = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-warning-begin", TEXT("")); wstring warnBegin = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-warning-begin", L"");
generic_string space = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-space-warning", TEXT("")); wstring space = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-space-warning", L"");
generic_string warnEnd = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-warning-end", TEXT("")); wstring warnEnd = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-warning-end", L"");
// half translation is not allowed // half translation is not allowed
if (!warnBegin.empty() && !space.empty() && !warnEnd.empty()) if (!warnBegin.empty() && !space.empty() && !warnEnd.empty())
{ {
space = stringReplace(space, TEXT("$INT_REPLACE$"), nbSpStr); space = stringReplace(space, L"$INT_REPLACE$", nbSpStr);
msg = warnBegin; msg = warnBegin;
msg += space; msg += space;
msg += warnEnd; msg += warnEnd;
} }
else else
{ {
msg = TEXT("Be aware: "); msg = L"Be aware: ";
msg += std::to_wstring(nbSp); msg += std::to_wstring(nbSp);
msg += TEXT(" space(s) in your character list."); msg += L" space(s) in your character list.";
} }
} }
else if (!nbSp && nbTab) else if (!nbSp && nbTab)
{ {
generic_string nbTabStr = std::to_wstring(nbTab); wstring nbTabStr = std::to_wstring(nbTab);
generic_string warnBegin = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-warning-begin", TEXT("")); wstring warnBegin = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-warning-begin", L"");
generic_string tab = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-tab-warning", TEXT("")); wstring tab = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-tab-warning", L"");
generic_string warnEnd = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-warning-end", TEXT("")); wstring warnEnd = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-warning-end", L"");
// half translation is not allowed // half translation is not allowed
if (!warnBegin.empty() && !tab.empty() && !warnEnd.empty()) if (!warnBegin.empty() && !tab.empty() && !warnEnd.empty())
{ {
tab = stringReplace(tab, TEXT("$INT_REPLACE$"), nbTabStr); tab = stringReplace(tab, L"$INT_REPLACE$", nbTabStr);
msg = warnBegin; msg = warnBegin;
msg += tab; msg += tab;
msg += warnEnd; msg += warnEnd;
} }
else else
{ {
msg = TEXT("Be aware: "); msg = L"Be aware: ";
msg += std::to_wstring(nbTab); msg += std::to_wstring(nbTab);
msg += TEXT(" TAB(s) in your character list."); msg += L" TAB(s) in your character list.";
} }
} }
else // (!nbSp && !nbTab) else // (!nbSp && !nbTab)
@ -5159,7 +5159,7 @@ generic_string DelimiterSubDlg::getWarningText(size_t nbSp, size_t nbTab) const
void DelimiterSubDlg::setWarningIfNeed() const void DelimiterSubDlg::setWarningIfNeed() const
{ {
generic_string msg; wstring msg;
NppGUI & nppGUI = (NppParameters::getInstance()).getNppGUI(); NppGUI & nppGUI = (NppParameters::getInstance()).getNppGUI();
if (!nppGUI._isWordCharDefault) if (!nppGUI._isWordCharDefault)
{ {
@ -5211,10 +5211,10 @@ intptr_t CALLBACK DelimiterSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
// //
// Delimiter // Delimiter
// //
TCHAR opener[2]{}; wchar_t opener[2]{};
opener[0] = nppGUI._leftmostDelimiter; opener[0] = nppGUI._leftmostDelimiter;
opener[1] = '\0'; opener[1] = '\0';
TCHAR closer[2]{}; wchar_t closer[2]{};
closer[0] = nppGUI._rightmostDelimiter; closer[0] = nppGUI._rightmostDelimiter;
closer[1] = '\0'; closer[1] = '\0';
bool onSeveralLines = nppGUI._delimiterSelectionOnEntireDocument; bool onSeveralLines = nppGUI._delimiterSelectionOnEntireDocument;
@ -5240,7 +5240,7 @@ intptr_t CALLBACK DelimiterSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
setWarningIfNeed(); setWarningIfNeed();
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
generic_string tip2show = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-tip", TEXT("This allows you to include additional character into current word characters while double clicking for selection or searching with \"Match whole word only\" option checked.")); wstring tip2show = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-tip", L"This allows you to include additional character into current word characters while double clicking for selection or searching with \"Match whole word only\" option checked.");
_tip = CreateToolTip(IDD_WORDCHAR_QUESTION_BUTTON, _hSelf, _hInst, const_cast<PTSTR>(tip2show.c_str()), pNativeSpeaker->isRTL()); _tip = CreateToolTip(IDD_WORDCHAR_QUESTION_BUTTON, _hSelf, _hInst, const_cast<PTSTR>(tip2show.c_str()), pNativeSpeaker->isRTL());
if (_tip) if (_tip)
@ -5310,14 +5310,14 @@ intptr_t CALLBACK DelimiterSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
{ {
case IDC_EDIT_OPENDELIMITER: case IDC_EDIT_OPENDELIMITER:
{ {
TCHAR opener[2] = { '\0' }; wchar_t opener[2] = { '\0' };
::SendDlgItemMessage(_hSelf, IDC_EDIT_OPENDELIMITER, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(opener)); ::SendDlgItemMessage(_hSelf, IDC_EDIT_OPENDELIMITER, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(opener));
nppGUI._leftmostDelimiter = static_cast<char>(opener[0]); nppGUI._leftmostDelimiter = static_cast<char>(opener[0]);
return TRUE; return TRUE;
} }
case IDC_EDIT_CLOSEDELIMITER: case IDC_EDIT_CLOSEDELIMITER:
{ {
TCHAR closer[2] = { '\0' }; wchar_t closer[2] = { '\0' };
::SendDlgItemMessage(_hSelf, IDC_EDIT_CLOSEDELIMITER, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(closer)); ::SendDlgItemMessage(_hSelf, IDC_EDIT_CLOSEDELIMITER, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(closer));
nppGUI._rightmostDelimiter = static_cast<char>(closer[0]); nppGUI._rightmostDelimiter = static_cast<char>(closer[0]);
return TRUE; return TRUE;
@ -5357,7 +5357,7 @@ intptr_t CALLBACK DelimiterSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
nppGUI._isWordCharDefault = true; nppGUI._isWordCharDefault = true;
::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_SETWORDCHARS, 0, 0); ::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_SETWORDCHARS, 0, 0);
::EnableWindow(::GetDlgItem(_hSelf, IDC_WORDCHAR_CUSTOM_EDIT), !nppGUI._isWordCharDefault); ::EnableWindow(::GetDlgItem(_hSelf, IDC_WORDCHAR_CUSTOM_EDIT), !nppGUI._isWordCharDefault);
::SetDlgItemText(_hSelf, IDD_STATIC_WORDCHAR_WARNING, TEXT("")); ::SetDlgItemText(_hSelf, IDD_STATIC_WORDCHAR_WARNING, L"");
return TRUE; return TRUE;
} }
@ -5391,14 +5391,14 @@ intptr_t CALLBACK CloudAndLinkSubDlg::run_dlgProc(UINT message, WPARAM wParam, L
{ {
case WM_INITDIALOG: case WM_INITDIALOG:
{ {
generic_string errMsg = TEXT(""); wstring errMsg = L"";
bool withCloud = nppGUI._cloudPath != TEXT(""); bool withCloud = nppGUI._cloudPath != L"";
if (withCloud) if (withCloud)
{ {
// detect validation of path // detect validation of path
if (!::PathFileExists(nppGUI._cloudPath.c_str())) if (!::PathFileExists(nppGUI._cloudPath.c_str()))
errMsg = TEXT("Invalid path"); errMsg = L"Invalid path";
} }
::SetDlgItemText(_hSelf, IDC_SETTINGSONCLOUD_WARNING_STATIC, errMsg.c_str()); ::SetDlgItemText(_hSelf, IDC_SETTINGSONCLOUD_WARNING_STATIC, errMsg.c_str());
@ -5468,8 +5468,8 @@ intptr_t CALLBACK CloudAndLinkSubDlg::run_dlgProc(UINT message, WPARAM wParam, L
{ {
case IDC_CLOUDPATH_EDIT: case IDC_CLOUDPATH_EDIT:
{ {
TCHAR inputDir[MAX_PATH] = { '\0' }; wchar_t inputDir[MAX_PATH] = { '\0' };
TCHAR inputDirExpanded[MAX_PATH] = { '\0' }; wchar_t inputDirExpanded[MAX_PATH] = { '\0' };
::SendDlgItemMessage(_hSelf, IDC_CLOUDPATH_EDIT, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(inputDir)); ::SendDlgItemMessage(_hSelf, IDC_CLOUDPATH_EDIT, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(inputDir));
::ExpandEnvironmentStrings(inputDir, inputDirExpanded, MAX_PATH); ::ExpandEnvironmentStrings(inputDir, inputDirExpanded, MAX_PATH);
NativeLangSpeaker* pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker(); NativeLangSpeaker* pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
@ -5478,10 +5478,10 @@ intptr_t CALLBACK CloudAndLinkSubDlg::run_dlgProc(UINT message, WPARAM wParam, L
nppGUI._cloudPath = inputDirExpanded; nppGUI._cloudPath = inputDirExpanded;
nppParams.setCloudChoice(inputDirExpanded); nppParams.setCloudChoice(inputDirExpanded);
generic_string warningMsg; wstring warningMsg;
if (nppParams.isCloudPathChanged()) if (nppParams.isCloudPathChanged())
{ {
warningMsg = pNativeSpeaker->getLocalizedStrFromID("cloud-restart-warning", TEXT("Please restart Notepad++ to take effect.")); warningMsg = pNativeSpeaker->getLocalizedStrFromID("cloud-restart-warning", L"Please restart Notepad++ to take effect.");
} }
::SetDlgItemText(_hSelf, IDC_SETTINGSONCLOUD_WARNING_STATIC, warningMsg.c_str()); ::SetDlgItemText(_hSelf, IDC_SETTINGSONCLOUD_WARNING_STATIC, warningMsg.c_str());
} }
@ -5490,7 +5490,7 @@ intptr_t CALLBACK CloudAndLinkSubDlg::run_dlgProc(UINT message, WPARAM wParam, L
bool isChecked = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_WITHCLOUD_RADIO, BM_GETCHECK, 0, 0)); bool isChecked = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_WITHCLOUD_RADIO, BM_GETCHECK, 0, 0));
if (isChecked) if (isChecked)
{ {
generic_string errMsg = pNativeSpeaker->getLocalizedStrFromID("cloud-invalid-warning", TEXT("Invalid path.")); wstring errMsg = pNativeSpeaker->getLocalizedStrFromID("cloud-invalid-warning", L"Invalid path.");
::SetDlgItemText(_hSelf, IDC_SETTINGSONCLOUD_WARNING_STATIC, errMsg.c_str()); ::SetDlgItemText(_hSelf, IDC_SETTINGSONCLOUD_WARNING_STATIC, errMsg.c_str());
nppParams.removeCloudChoice(); nppParams.removeCloudChoice();
@ -5501,7 +5501,7 @@ intptr_t CALLBACK CloudAndLinkSubDlg::run_dlgProc(UINT message, WPARAM wParam, L
case IDC_URISCHEMES_EDIT: case IDC_URISCHEMES_EDIT:
{ {
TCHAR uriScheme[uriSchemesMaxLength] = { '\0' }; wchar_t uriScheme[uriSchemesMaxLength] = { '\0' };
::SendDlgItemMessage(_hSelf, IDC_URISCHEMES_EDIT, WM_GETTEXT, uriSchemesMaxLength, reinterpret_cast<LPARAM>(uriScheme)); ::SendDlgItemMessage(_hSelf, IDC_URISCHEMES_EDIT, WM_GETTEXT, uriSchemesMaxLength, reinterpret_cast<LPARAM>(uriScheme));
nppGUI._uriSchemes = uriScheme; nppGUI._uriSchemes = uriScheme;
HWND grandParent = ::GetParent(_hParent); HWND grandParent = ::GetParent(_hParent);
@ -5516,13 +5516,13 @@ intptr_t CALLBACK CloudAndLinkSubDlg::run_dlgProc(UINT message, WPARAM wParam, L
{ {
case IDC_NOCLOUD_RADIO: case IDC_NOCLOUD_RADIO:
{ {
nppGUI._cloudPath = TEXT(""); nppGUI._cloudPath = L"";
nppParams.removeCloudChoice(); nppParams.removeCloudChoice();
generic_string warningMsg; wstring warningMsg;
if (nppParams.isCloudPathChanged()) if (nppParams.isCloudPathChanged())
{ {
warningMsg = pNativeSpeaker->getLocalizedStrFromID("cloud-restart-warning", TEXT("Please restart Notepad++ to take effect.")); warningMsg = pNativeSpeaker->getLocalizedStrFromID("cloud-restart-warning", L"Please restart Notepad++ to take effect.");
} }
// else set empty string // else set empty string
::SetDlgItemText(_hSelf, IDC_SETTINGSONCLOUD_WARNING_STATIC, warningMsg.c_str()); ::SetDlgItemText(_hSelf, IDC_SETTINGSONCLOUD_WARNING_STATIC, warningMsg.c_str());
@ -5535,7 +5535,7 @@ intptr_t CALLBACK CloudAndLinkSubDlg::run_dlgProc(UINT message, WPARAM wParam, L
case IDC_WITHCLOUD_RADIO: case IDC_WITHCLOUD_RADIO:
{ {
generic_string errMsg = pNativeSpeaker->getLocalizedStrFromID("cloud-invalid-warning", TEXT("Invalid path.")); wstring errMsg = pNativeSpeaker->getLocalizedStrFromID("cloud-invalid-warning", L"Invalid path.");
::SetDlgItemText(_hSelf, IDC_SETTINGSONCLOUD_WARNING_STATIC, errMsg.c_str()); ::SetDlgItemText(_hSelf, IDC_SETTINGSONCLOUD_WARNING_STATIC, errMsg.c_str());
::EnableWindow(::GetDlgItem(_hSelf, IDC_CLOUDPATH_EDIT), true); ::EnableWindow(::GetDlgItem(_hSelf, IDC_CLOUDPATH_EDIT), true);
@ -5545,7 +5545,7 @@ intptr_t CALLBACK CloudAndLinkSubDlg::run_dlgProc(UINT message, WPARAM wParam, L
case IDD_CLOUDPATH_BROWSE_BUTTON: case IDD_CLOUDPATH_BROWSE_BUTTON:
{ {
generic_string warningMsg = pNativeSpeaker->getLocalizedStrFromID("cloud-select-folder", TEXT("Select a folder from/to where Notepad++ reads/writes its settings")); wstring warningMsg = pNativeSpeaker->getLocalizedStrFromID("cloud-select-folder", L"Select a folder from/to where Notepad++ reads/writes its settings");
folderBrowser(_hSelf, warningMsg, IDC_CLOUDPATH_EDIT); folderBrowser(_hSelf, warningMsg, IDC_CLOUDPATH_EDIT);
} }
break; break;
@ -5623,7 +5623,7 @@ intptr_t CALLBACK PerformanceSubDlg::run_dlgProc(UINT message , WPARAM wParam, L
::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_PERFORMANCE_DEACTIVATEWORDWRAP), largeFileRestrictionEnabled); ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_PERFORMANCE_DEACTIVATEWORDWRAP), largeFileRestrictionEnabled);
NativeLangSpeaker* pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker(); NativeLangSpeaker* pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
generic_string enablePerfTip = pNativeSpeaker->getLocalizedStrFromID("largeFileRestriction-tip", TEXT("Some features may slow performance in large files. These features can be auto-disabled on opening a large file. You can customize them here.\n\nNOTE:\n1. Modifying options here requires re-open currently opened large files to get proper behavior.\n\n2. If \"Deactivate Word Wrap globally\" is checked and you open a large file, \"Word Wrap\" will be disabled for all files. You can re-enable it via menu \"View->Word Wrap\"")); wstring enablePerfTip = pNativeSpeaker->getLocalizedStrFromID("largeFileRestriction-tip", L"Some features may slow performance in large files. These features can be auto-disabled on opening a large file. You can customize them here.\n\nNOTE:\n1. Modifying options here requires re-open currently opened large files to get proper behavior.\n\n2. If \"Deactivate Word Wrap globally\" is checked and you open a large file, \"Word Wrap\" will be disabled for all files. You can re-enable it via menu \"View->Word Wrap\"");
_largeFileRestrictionTip = CreateToolTip(IDD_PERFORMANCE_TIP_QUESTION_BUTTON, _hSelf, _hInst, const_cast<PTSTR>(enablePerfTip.c_str()), false); _largeFileRestrictionTip = CreateToolTip(IDD_PERFORMANCE_TIP_QUESTION_BUTTON, _hSelf, _hInst, const_cast<PTSTR>(enablePerfTip.c_str()), false);
return TRUE; return TRUE;
@ -5669,11 +5669,11 @@ intptr_t CALLBACK PerformanceSubDlg::run_dlgProc(UINT message , WPARAM wParam, L
{ {
constexpr int stringSize = 16; constexpr int stringSize = 16;
TCHAR str[stringSize]{}; wchar_t str[stringSize]{};
::GetDlgItemText(_hSelf, IDC_EDIT_PERFORMANCE_FILESIZE, str, stringSize); ::GetDlgItemText(_hSelf, IDC_EDIT_PERFORMANCE_FILESIZE, str, stringSize);
if (lstrcmp(str, TEXT("")) == 0) if (lstrcmp(str, L"") == 0)
return TRUE; return TRUE;
constexpr int fileLenInMBMax = (INT32_MAX - 1024 * 1024) / 1024 / 1024; // -1MB ... have to to consider also the bufferSizeRequested algo in FileManager::loadFileData constexpr int fileLenInMBMax = (INT32_MAX - 1024 * 1024) / 1024 / 1024; // -1MB ... have to to consider also the bufferSizeRequested algo in FileManager::loadFileData
@ -5691,10 +5691,10 @@ intptr_t CALLBACK PerformanceSubDlg::run_dlgProc(UINT message , WPARAM wParam, L
else if (HIWORD(wParam) == EN_KILLFOCUS && LOWORD(wParam) == IDC_EDIT_PERFORMANCE_FILESIZE) else if (HIWORD(wParam) == EN_KILLFOCUS && LOWORD(wParam) == IDC_EDIT_PERFORMANCE_FILESIZE)
{ {
constexpr int stringSize = 16; constexpr int stringSize = 16;
TCHAR str[stringSize]{}; wchar_t str[stringSize]{};
::GetDlgItemText(_hSelf, IDC_EDIT_PERFORMANCE_FILESIZE, str, stringSize); ::GetDlgItemText(_hSelf, IDC_EDIT_PERFORMANCE_FILESIZE, str, stringSize);
if (lstrcmp(str, TEXT("")) == 0) if (lstrcmp(str, L"") == 0)
{ {
::SetDlgItemInt(_hSelf, IDC_EDIT_PERFORMANCE_FILESIZE, (NPP_STYLING_FILESIZE_LIMIT_DEFAULT / 1024) / 1024, FALSE); ::SetDlgItemInt(_hSelf, IDC_EDIT_PERFORMANCE_FILESIZE, (NPP_STYLING_FILESIZE_LIMIT_DEFAULT / 1024) / 1024, FALSE);
return TRUE; return TRUE;
@ -5852,7 +5852,7 @@ intptr_t CALLBACK SearchEngineSubDlg::run_dlgProc(UINT message, WPARAM wParam, L
{ {
if (HIWORD(wParam) == EN_CHANGE && LOWORD(wParam) == IDC_SEARCHENGINE_EDIT) if (HIWORD(wParam) == EN_CHANGE && LOWORD(wParam) == IDC_SEARCHENGINE_EDIT)
{ {
TCHAR input[MAX_PATH] = { '\0' }; wchar_t input[MAX_PATH] = { '\0' };
::SendDlgItemMessage(_hSelf, IDC_SEARCHENGINE_EDIT, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(input)); ::SendDlgItemMessage(_hSelf, IDC_SEARCHENGINE_EDIT, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(input));
nppGUI._searchEngineCustom = input; nppGUI._searchEngineCustom = input;
return TRUE; return TRUE;
@ -5924,7 +5924,7 @@ intptr_t CALLBACK SearchingSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
::SetDlgItemInt(_hSelf, IDC_INSELECTION_THRESHOLD_EDIT, nppGUI._inSelectionAutocheckThreshold, 0); ::SetDlgItemInt(_hSelf, IDC_INSELECTION_THRESHOLD_EDIT, nppGUI._inSelectionAutocheckThreshold, 0);
NativeLangSpeaker* pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker(); NativeLangSpeaker* pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
generic_string tipText = pNativeSpeaker->getLocalizedStrFromID("searchingInSelThresh-tip", L"Number of selected characters in edit zone to automatically check the \"In selection\" checkbox when the Find dialog is activated. The maximum value is 1024. Set the value to 0 to disable auto-checking."); wstring tipText = pNativeSpeaker->getLocalizedStrFromID("searchingInSelThresh-tip", L"Number of selected characters in edit zone to automatically check the \"In selection\" checkbox when the Find dialog is activated. The maximum value is 1024. Set the value to 0 to disable auto-checking.");
_tipInSelThresh = CreateToolTip(IDC_INSELECTION_THRESH_QUESTION_BUTTON, _hSelf, _hInst, const_cast<PTSTR>(tipText.c_str()), pNativeSpeaker->isRTL()); _tipInSelThresh = CreateToolTip(IDC_INSELECTION_THRESH_QUESTION_BUTTON, _hSelf, _hInst, const_cast<PTSTR>(tipText.c_str()), pNativeSpeaker->isRTL());

View File

@ -136,8 +136,8 @@ private :
struct LangID_Name struct LangID_Name
{ {
LangType _id = L_TEXT; LangType _id = L_TEXT;
generic_string _name; std::wstring _name;
LangID_Name(LangType id, const generic_string& name) : _id(id), _name(name){}; LangID_Name(LangType id, const std::wstring& name) : _id(id), _name(name){};
}; };
class NewDocumentSubDlg : public StaticDialog class NewDocumentSubDlg : public StaticDialog
@ -219,7 +219,7 @@ public :
private : private :
intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) override; intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) override;
std::vector<generic_string> varList; std::vector<std::wstring> varList;
int _focusedEditCtrl = 0; int _focusedEditCtrl = 0;
}; };
@ -271,7 +271,7 @@ private :
intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) override; intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) override;
void detectSpace(const char *text2Check, int & nbSp, int & nbTab) const; void detectSpace(const char *text2Check, int & nbSp, int & nbTab) const;
generic_string getWarningText(size_t nbSp, size_t nbTab) const; std::wstring getWarningText(size_t nbSp, size_t nbTab) const;
void setWarningIfNeed() const; void setWarningIfNeed() const;
void calcCtrlsPos(); void calcCtrlsPos();
void setCtrlsPos(bool isMultiline); void setCtrlsPos(bool isMultiline);
@ -327,13 +327,13 @@ public :
display(); display();
}; };
bool renameDialogTitle(const TCHAR *internalName, const TCHAR *newName); bool renameDialogTitle(const wchar_t *internalName, const wchar_t *newName);
int getListSelectedIndex() const { int getListSelectedIndex() const {
return static_cast<int32_t>(::SendDlgItemMessage(_hSelf, IDC_LIST_DLGTITLE, LB_GETCURSEL, 0, 0)); return static_cast<int32_t>(::SendDlgItemMessage(_hSelf, IDC_LIST_DLGTITLE, LB_GETCURSEL, 0, 0));
}; };
void showDialogByName(const TCHAR *name) const; void showDialogByName(const wchar_t *name) const;
bool setListSelection(size_t currentSel) const; bool setListSelection(size_t currentSel) const;
bool goToSection(size_t iPage, intptr_t ctrlID = -1); bool goToSection(size_t iPage, intptr_t ctrlID = -1);
@ -343,7 +343,7 @@ public :
private : private :
intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) override; intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) override;
void makeCategoryList(); void makeCategoryList();
int32_t getIndexFromName(const TCHAR *name) const; int32_t getIndexFromName(const wchar_t *name) const;
void showDialogByIndex(size_t index) const; void showDialogByIndex(size_t index) const;
WindowVector _wVector; WindowVector _wVector;
GeneralSubDlg _generalSubDlg; GeneralSubDlg _generalSubDlg;