Remove ambiguous symbols (part 5)

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

Close #15379
This commit is contained in:
Don Ho 2024-06-30 19:21:26 +02:00
parent 4d8ef955e2
commit 3c897f892a
10 changed files with 722 additions and 725 deletions

View File

@ -85,7 +85,7 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 };
// return the number of opened files // return the number of opened files
#define NPPM_GETOPENFILENAMES (NPPMSG + 8) #define NPPM_GETOPENFILENAMES (NPPMSG + 8)
// BOOL NPPM_GETOPENFILENAMES(TCHAR** fileNames, int nbFileNames) // BOOL NPPM_GETOPENFILENAMES(wchar_t** fileNames, int nbFileNames)
// Get the open files full paths of both views. User is responsible to allocate an big enough fileNames array by using NPPM_GETNBOPENFILES. // Get the open files full paths of both views. User is responsible to allocate an big enough fileNames array by using NPPM_GETNBOPENFILES.
// wParam[out]: fileNames - array of file path // wParam[out]: fileNames - array of file path
// lParam[in]: nbFileNames is the number of file path. // lParam[in]: nbFileNames is the number of file path.
@ -104,14 +104,14 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 };
// return hDlg (HWND) on success, NULL on failure // return hDlg (HWND) on success, NULL on failure
#define NPPM_GETNBSESSIONFILES (NPPMSG + 13) #define NPPM_GETNBSESSIONFILES (NPPMSG + 13)
// int NPPM_GETNBSESSIONFILES (BOOL* pbIsValidXML, TCHAR* sessionFileName) // int NPPM_GETNBSESSIONFILES (BOOL* pbIsValidXML, wchar_t* sessionFileName)
// Get the number of files to load in the session sessionFileName. sessionFileName should be a full path name of an xml file. // Get the number of files to load in the session sessionFileName. sessionFileName should be a full path name of an xml file.
// wParam[out]: pbIsValidXML, if the lParam pointer is null, then this parameter will be ignored. TRUE if XML is valid, otherwise FALSE. // wParam[out]: pbIsValidXML, if the lParam pointer is null, then this parameter will be ignored. TRUE if XML is valid, otherwise FALSE.
// lParam[in]: sessionFileName is XML session full path // lParam[in]: sessionFileName is XML session full path
// return value: The number of files in XML session file // return value: The number of files in XML session file
#define NPPM_GETSESSIONFILES (NPPMSG + 14) #define NPPM_GETSESSIONFILES (NPPMSG + 14)
// NPPM_GETSESSIONFILES (TCHAR** sessionFileArray, TCHAR* sessionFileName) // NPPM_GETSESSIONFILES (wchar_t** sessionFileArray, wchar_t* sessionFileName)
// the files' full path name from a session file. // the files' full path name from a session file.
// wParam[out]: sessionFileArray is the array in which the files' full path of the same group are written. To allocate the array with the proper size, send message NPPM_GETNBSESSIONFILES. // wParam[out]: sessionFileArray is the array in which the files' full path of the same group are written. To allocate the array with the proper size, send message NPPM_GETNBSESSIONFILES.
// lParam[in]: sessionFileName is XML session full path // lParam[in]: sessionFileName is XML session full path
@ -119,9 +119,9 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 };
#define NPPM_SAVESESSION (NPPMSG + 15) #define NPPM_SAVESESSION (NPPMSG + 15)
struct sessionInfo { struct sessionInfo {
TCHAR* sessionFilePathName; // Full session file path name to be saved wchar_t* sessionFilePathName; // Full session file path name to be saved
int nbFile; // Size of "files" array - number of files to be saved in session int nbFile; // Size of "files" array - number of files to be saved in session
TCHAR** files; // Array of file name (full path) to be saved in session wchar_t** files; // Array of file name (full path) to be saved in session
}; };
// NPPM_SAVESESSION(0, sessionInfo* si) // NPPM_SAVESESSION(0, sessionInfo* si)
// Creates an session file for a defined set of files. // Creates an session file for a defined set of files.
@ -131,7 +131,7 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 };
// Returns sessionFileName on success, NULL otherwise // Returns sessionFileName on success, NULL otherwise
#define NPPM_SAVECURRENTSESSION (NPPMSG + 16) #define NPPM_SAVECURRENTSESSION (NPPMSG + 16)
// TCHAR* NPPM_SAVECURRENTSESSION(0, TCHAR* sessionFileName) // wchar_t* NPPM_SAVECURRENTSESSION(0, wchar_t* sessionFileName)
// Saves the current opened files in Notepad++ as a group of files (session) as an xml file. // Saves the current opened files in Notepad++ as a group of files (session) as an xml file.
// wParam: 0 (not used) // wParam: 0 (not used)
// lParam[in]: sessionFileName is the xml full path name // lParam[in]: sessionFileName is the xml full path name
@ -139,14 +139,14 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 };
#define NPPM_GETOPENFILENAMESPRIMARY (NPPMSG + 17) #define NPPM_GETOPENFILENAMESPRIMARY (NPPMSG + 17)
// BOOL NPPM_GETOPENFILENAMESPRIMARY(TCHAR** fileNames, int nbFileNames) // BOOL NPPM_GETOPENFILENAMESPRIMARY(wchar_t** fileNames, int nbFileNames)
// Get the open files full paths of main view. User is responsible to allocate an big enough fileNames array by using NPPM_GETNBOPENFILES. // Get the open files full paths of main view. User is responsible to allocate an big enough fileNames array by using NPPM_GETNBOPENFILES.
// wParam[out]: fileNames - array of file path // wParam[out]: fileNames - array of file path
// lParam[in]: nbFileNames is the number of file path. // lParam[in]: nbFileNames is the number of file path.
// return value: The number of files copied into fileNames array // return value: The number of files copied into fileNames array
#define NPPM_GETOPENFILENAMESSECOND (NPPMSG + 18) #define NPPM_GETOPENFILENAMESSECOND (NPPMSG + 18)
// BOOL NPPM_GETOPENFILENAMESSECOND(TCHAR** fileNames, int nbFileNames) // BOOL NPPM_GETOPENFILENAMESSECOND(wchar_t** fileNames, int nbFileNames)
// Get the open files full paths of sub-view. User is responsible to allocate an big enough fileNames array by using NPPM_GETNBOPENFILES. // Get the open files full paths of sub-view. User is responsible to allocate an big enough fileNames array by using NPPM_GETNBOPENFILES.
// wParam[out]: fileNames - array of file path // wParam[out]: fileNames - array of file path
// lParam[in]: nbFileNames is the number of file path. // lParam[in]: nbFileNames is the number of file path.
@ -189,7 +189,7 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 };
#define STATUSBAR_EOF_FORMAT 3 #define STATUSBAR_EOF_FORMAT 3
#define STATUSBAR_UNICODE_TYPE 4 #define STATUSBAR_UNICODE_TYPE 4
#define STATUSBAR_TYPING_MODE 5 #define STATUSBAR_TYPING_MODE 5
// BOOL NPPM_SETSTATUSBAR(int whichPart, TCHAR *str2set) // BOOL NPPM_SETSTATUSBAR(int whichPart, wchar_t *str2set)
// Set string in the specified field of a statusbar. // Set string in the specified field of a statusbar.
// wParam[in]: whichPart for indicating the statusbar part you want to set. It can be only the above value (0 - 5) // wParam[in]: whichPart for indicating the statusbar part you want to set. It can be only the above value (0 - 5)
// lParam[in]: str2set is the string you want to write to the part of statusbar. // lParam[in]: str2set is the string you want to write to the part of statusbar.
@ -234,7 +234,7 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 };
// Return TRUE // Return TRUE
#define NPPM_LAUNCHFINDINFILESDLG (NPPMSG + 29) #define NPPM_LAUNCHFINDINFILESDLG (NPPMSG + 29)
// BOOL NPPM_LAUNCHFINDINFILESDLG(TCHAR * dir2Search, TCHAR * filtre) // BOOL NPPM_LAUNCHFINDINFILESDLG(wchar_t * dir2Search, wchar_t * filtre)
// Launch Find in Files dialog and set "Find in" directory and filters with the given arguments. // Launch Find in Files dialog and set "Find in" directory and filters with the given arguments.
// wParam[in]: if dir2Search is not NULL, it will be set as working directory in which Notepad++ will search // wParam[in]: if dir2Search is not NULL, it will be set as working directory in which Notepad++ will search
// lParam[in]: if filtre is not NULL, filtre string will be set into filter field // lParam[in]: if filtre is not NULL, filtre string will be set into filter field
@ -271,28 +271,28 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 };
// Return TRUE // Return TRUE
#define NPPM_LOADSESSION (NPPMSG + 34) #define NPPM_LOADSESSION (NPPMSG + 34)
// BOOL NPPM_LOADSESSION(0, TCHAR* sessionFileName) // BOOL NPPM_LOADSESSION(0, wchar_t* sessionFileName)
// Open all files of same session in Notepad++ via a xml format session file sessionFileName. // Open all files of same session in Notepad++ via a xml format session file sessionFileName.
// wParam: 0 (not used) // wParam: 0 (not used)
// lParam[in]: sessionFileName is the full file path of session file to reload // lParam[in]: sessionFileName is the full file path of session file to reload
// Return TRUE // Return TRUE
#define NPPM_DMMVIEWOTHERTAB (NPPMSG + 35) #define NPPM_DMMVIEWOTHERTAB (NPPMSG + 35)
// BOOL WM_DMM_VIEWOTHERTAB(0, TCHAR* name) // BOOL WM_DMM_VIEWOTHERTAB(0, wchar_t* name)
// Show the plugin dialog (switch to plugin tab) with the given name. // Show the plugin dialog (switch to plugin tab) with the given name.
// wParam: 0 (not used) // wParam: 0 (not used)
// lParam[in]: name should be the same value as previously used to register the dialog (pszName of tTbData) // lParam[in]: name should be the same value as previously used to register the dialog (pszName of tTbData)
// Return TRUE // Return TRUE
#define NPPM_RELOADFILE (NPPMSG + 36) #define NPPM_RELOADFILE (NPPMSG + 36)
// BOOL NPPM_RELOADFILE(BOOL withAlert, TCHAR *filePathName2Reload) // BOOL NPPM_RELOADFILE(BOOL withAlert, wchar_t *filePathName2Reload)
// Reload the document which matches with the given filePathName2Reload. // Reload the document which matches with the given filePathName2Reload.
// wParam: 0 (not used) // wParam: 0 (not used)
// lParam[in]: filePathName2Reload is the full file path of document to reload // lParam[in]: filePathName2Reload is the full file path of document to reload
// Return TRUE if reloading file succeeds, otherwise FALSE // Return TRUE if reloading file succeeds, otherwise FALSE
#define NPPM_SWITCHTOFILE (NPPMSG + 37) #define NPPM_SWITCHTOFILE (NPPMSG + 37)
// BOOL NPPM_SWITCHTOFILE(0, TCHAR* filePathName2switch) // BOOL NPPM_SWITCHTOFILE(0, wchar_t* filePathName2switch)
// Switch to the document which matches with the given filePathName2switch. // Switch to the document which matches with the given filePathName2switch.
// wParam: 0 (not used) // wParam: 0 (not used)
// lParam[in]: filePathName2switch is the full file path of document to switch // lParam[in]: filePathName2switch is the full file path of document to switch
@ -340,7 +340,7 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 };
// Return enum winVer, which is defined at the begining of this file // Return enum winVer, which is defined at the begining of this file
#define NPPM_DMMGETPLUGINHWNDBYNAME (NPPMSG + 43) #define NPPM_DMMGETPLUGINHWNDBYNAME (NPPMSG + 43)
// HWND NPPM_DMMGETPLUGINHWNDBYNAME(const TCHAR *windowName, const TCHAR *moduleName) // HWND NPPM_DMMGETPLUGINHWNDBYNAME(const wchar_t *windowName, const wchar_t *moduleName)
// Retrieve the dialog handle corresponds to the windowName and moduleName. You may need this message if you want to communicate with another plugin "dockable" dialog. // Retrieve the dialog handle corresponds to the windowName and moduleName. You may need this message if you want to communicate with another plugin "dockable" dialog.
// wParam[in]: windowName - if windowName is NULL, then the first found window handle which matches with the moduleName will be returned // wParam[in]: windowName - if windowName is NULL, then the first found window handle which matches with the moduleName will be returned
// lParam[in] : moduleName - if moduleName is NULL, then return value is NULL // lParam[in] : moduleName - if moduleName is NULL, then return value is NULL
@ -361,22 +361,22 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 };
// Return a proc address or NULL // Return a proc address or NULL
#define NPPM_GETPLUGINSCONFIGDIR (NPPMSG + 46) #define NPPM_GETPLUGINSCONFIGDIR (NPPMSG + 46)
// int NPPM_GETPLUGINSCONFIGDIR(int strLen, TCHAR *str) // int NPPM_GETPLUGINSCONFIGDIR(int strLen, wchar_t *str)
// Get user's plugin config directory path. It's useful if plugins want to save/load parameters for the current user // Get user's plugin config directory path. It's useful if plugins want to save/load parameters for the current user
// wParam[in]: strLen is length of allocated buffer in which directory path is copied // wParam[in]: strLen is length of allocated buffer in which directory path is copied
// lParam[out] : str is the allocated buffere. User should call this message twice - // lParam[out] : str is the allocated buffere. User should call this message twice -
// The 1st call with "str" be NULL to get the required number of TCHAR (not including the terminating nul character) // The 1st call with "str" be NULL to get the required number of wchar_t (not including the terminating nul character)
// The 2nd call to allocate "str" buffer with the 1st call's return value + 1, then call it again to get the path // The 2nd call to allocate "str" buffer with the 1st call's return value + 1, then call it again to get the path
// Return value: The 1st call - the number of TCHAR to copy. // Return value: The 1st call - the number of wchar_t to copy.
// The 2nd call - FALSE on failure, TRUE on success // The 2nd call - FALSE on failure, TRUE on success
#define NPPM_MSGTOPLUGIN (NPPMSG + 47) #define NPPM_MSGTOPLUGIN (NPPMSG + 47)
struct CommunicationInfo { struct CommunicationInfo {
long internalMsg; // an integer defined by plugin Y, known by plugin X, identifying the message being sent. long internalMsg; // an integer defined by plugin Y, known by plugin X, identifying the message being sent.
const TCHAR * srcModuleName; // the complete module name (with the extesion .dll) of caller (plugin X). const wchar_t * srcModuleName; // the complete module name (with the extesion .dll) of caller (plugin X).
void* info; // defined by plugin, the informations to be exchanged between X and Y. It's a void pointer so it should be defined by plugin Y and known by plugin X. void* info; // defined by plugin, the informations to be exchanged between X and Y. It's a void pointer so it should be defined by plugin Y and known by plugin X.
}; };
// BOOL NPPM_MSGTOPLUGIN(TCHAR *destModuleName, CommunicationInfo *info) // BOOL NPPM_MSGTOPLUGIN(wchar_t *destModuleName, CommunicationInfo *info)
// Send a private information to a plugin with given plugin name. This message allows the communication between 2 plugins. // Send a private information to a plugin with given plugin name. This message allows the communication between 2 plugins.
// For example, plugin X can execute a command of plugin Y if plugin X knows the command ID and the file name of plugin Y. // For example, plugin X can execute a command of plugin Y if plugin X knows the command ID and the file name of plugin Y.
// wParam[in]: destModuleName is the destination complete module file name (with the file extension ".dll") // wParam[in]: destModuleName is the destination complete module file name (with the file extension ".dll")
@ -457,12 +457,12 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 };
// if priorityView set to SUB_VIEW, then SUB_VIEW will be search firstly // if priorityView set to SUB_VIEW, then SUB_VIEW will be search firstly
#define NPPM_GETFULLPATHFROMBUFFERID (NPPMSG + 58) #define NPPM_GETFULLPATHFROMBUFFERID (NPPMSG + 58)
// int NPPM_GETFULLPATHFROMBUFFERID(UINT_PTR bufferID, TCHAR* fullFilePath) // int NPPM_GETFULLPATHFROMBUFFERID(UINT_PTR bufferID, wchar_t* fullFilePath)
// Get full path file name from a bufferID (the pointer of buffer). // Get full path file name from a bufferID (the pointer of buffer).
// wParam[in]: bufferID // wParam[in]: bufferID
// lParam[out]: fullFilePath - User should call it with fullFilePath be NULL to get the number of TCHAR (not including the nul character), // lParam[out]: fullFilePath - User should call it with fullFilePath be NULL to get the number of wchar_t (not including the nul character),
// allocate fullFilePath with the return values + 1, then call it again to get full path file name // allocate fullFilePath with the return values + 1, then call it again to get full path file name
// Return -1 if the bufferID non existing, otherwise the number of TCHAR copied/to copy // Return -1 if the bufferID non existing, otherwise the number of wchar_t copied/to copy
#define NPPM_GETBUFFERIDFROMPOS (NPPMSG + 59) #define NPPM_GETBUFFERIDFROMPOS (NPPMSG + 59)
// UINT_PTR NPPM_GETBUFFERIDFROMPOS(int index, int iView) // UINT_PTR NPPM_GETBUFFERIDFROMPOS(int index, int iView)
@ -591,7 +591,7 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 };
// return value: TRUE if this function call is successful and shortcut is enable, otherwise FALSE // return value: TRUE if this function call is successful and shortcut is enable, otherwise FALSE
#define NPPM_DOOPEN (NPPMSG + 77) #define NPPM_DOOPEN (NPPMSG + 77)
// BOOL NPPM_DOOPEN(0, const TCHAR* fullPathName2Open) // BOOL NPPM_DOOPEN(0, const wchar_t* fullPathName2Open)
// Open a file with given fullPathName2Open. // Open a file with given fullPathName2Open.
// If fullPathName2Open has been already opened in Notepad++, the it will be activated and becomes the current document. // If fullPathName2Open has been already opened in Notepad++, the it will be activated and becomes the current document.
// wParam: 0 (not used) // wParam: 0 (not used)
@ -599,7 +599,7 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 };
// The return value is TRUE if the operation is successful, otherwise FALSE // The return value is TRUE if the operation is successful, otherwise FALSE
#define NPPM_SAVECURRENTFILEAS (NPPMSG + 78) #define NPPM_SAVECURRENTFILEAS (NPPMSG + 78)
// BOOL NPPM_SAVECURRENTFILEAS (BOOL saveAsCopy, const TCHAR* filename) // BOOL NPPM_SAVECURRENTFILEAS (BOOL saveAsCopy, const wchar_t* filename)
// Save the current activated document. // Save the current activated document.
// wParam[in]: saveAsCopy must be either FALSE to save, or TRUE to save a copy of the current filename ("Save a Copy As..." action) // wParam[in]: saveAsCopy must be either FALSE to save, or TRUE to save a copy of the current filename ("Save a Copy As..." action)
// lParam[in]: filename indicates the full file path name to be saved // lParam[in]: filename indicates the full file path name to be saved
@ -653,7 +653,7 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 };
// then marker ID 16, 17 and 18 are preserved by Notepad++, and they are safe to be used by the plugin. // then marker ID 16, 17 and 18 are preserved by Notepad++, and they are safe to be used by the plugin.
#define NPPM_GETLANGUAGENAME (NPPMSG + 83) #define NPPM_GETLANGUAGENAME (NPPMSG + 83)
// int NPPM_GETLANGUAGENAME(LangType langType, TCHAR* langName) // int NPPM_GETLANGUAGENAME(LangType langType, wchar_t* langName)
// Get programming language name from the given language type (enum LangType). // Get programming language name from the given language type (enum LangType).
// wParam[in]: langType is the number of LangType // wParam[in]: langType is the number of LangType
// lParam[out]: langName is the buffer to recieve the language name string // lParam[out]: langName is the buffer to recieve the language name string
@ -664,7 +664,7 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 };
// by passing allocated buffer as argument langName // by passing allocated buffer as argument langName
#define NPPM_GETLANGUAGEDESC (NPPMSG + 84) #define NPPM_GETLANGUAGEDESC (NPPMSG + 84)
// INT NPPM_GETLANGUAGEDESC(int langType, TCHAR *langDesc) // INT NPPM_GETLANGUAGEDESC(int langType, wchar_t *langDesc)
// Get programming language short description from the given language type (enum LangType) // Get programming language short description from the given language type (enum LangType)
// wParam[in]: langType is the number of LangType // wParam[in]: langType is the number of LangType
// lParam[out]: langDesc is the buffer to recieve the language description string // lParam[out]: langDesc is the buffer to recieve the language description string
@ -745,7 +745,7 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 };
// Return TRUE // Return TRUE
#define NPPM_SAVEFILE (NPPMSG + 94) #define NPPM_SAVEFILE (NPPMSG + 94)
// BOOL NPPM_SAVEFILE(0, const TCHAR *fileNameToSave) // BOOL NPPM_SAVEFILE(0, const wchar_t *fileNameToSave)
// Save the file (opened in Notepad++) with the given full file name path. // Save the file (opened in Notepad++) with the given full file name path.
// wParam: 0 (not used) // wParam: 0 (not used)
// lParam[in]: fileNameToSave must be the full file path for the file to be saved. // lParam[in]: fileNameToSave must be the full file path for the file to be saved.
@ -766,20 +766,20 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 };
// return value: TRUE if function call is successful, otherwise FALSE // return value: TRUE if function call is successful, otherwise FALSE
#define NPPM_GETPLUGINHOMEPATH (NPPMSG + 97) #define NPPM_GETPLUGINHOMEPATH (NPPMSG + 97)
// int NPPM_GETPLUGINHOMEPATH(size_t strLen, TCHAR* pluginRootPath) // int NPPM_GETPLUGINHOMEPATH(size_t strLen, wchar_t* pluginRootPath)
// Get plugin home root path. It's useful if plugins want to get its own path by appending <pluginFolderName> which is the name of plugin without extension part. // Get plugin home root path. It's useful if plugins want to get its own path by appending <pluginFolderName> which is the name of plugin without extension part.
// wParam[in]: strLen - size of allocated buffer "pluginRootPath" // wParam[in]: strLen - size of allocated buffer "pluginRootPath"
// lParam[out]: pluginRootPath - Users should call it with pluginRootPath be NULL to get the required number of TCHAR (not including the terminating nul character), // lParam[out]: pluginRootPath - Users should call it with pluginRootPath be NULL to get the required number of wchar_t (not including the terminating nul character),
// allocate pluginRootPath buffer with the return value + 1, then call it again to get the path. // allocate pluginRootPath buffer with the return value + 1, then call it again to get the path.
// Return the number of TCHAR copied/to copy, 0 on copy failed // Return the number of wchar_t copied/to copy, 0 on copy failed
#define NPPM_GETSETTINGSONCLOUDPATH (NPPMSG + 98) #define NPPM_GETSETTINGSONCLOUDPATH (NPPMSG + 98)
// int NPPM_GETSETTINGSCLOUDPATH(size_t strLen, TCHAR *settingsOnCloudPath) // int NPPM_GETSETTINGSCLOUDPATH(size_t strLen, wchar_t *settingsOnCloudPath)
// Get settings on cloud path. It's useful if plugins want to store its settings on Cloud, if this path is set. // Get settings on cloud path. It's useful if plugins want to store its settings on Cloud, if this path is set.
// wParam[in]: strLen - size of allocated buffer "settingsOnCloudPath" // wParam[in]: strLen - size of allocated buffer "settingsOnCloudPath"
// lParam[out]: settingsOnCloudPath - Users should call it with settingsOnCloudPath be NULL to get the required number of TCHAR (not including the terminating nul character), // lParam[out]: settingsOnCloudPath - Users should call it with settingsOnCloudPath be NULL to get the required number of wchar_t (not including the terminating nul character),
// allocate settingsOnCloudPath buffer with the return value + 1, then call it again to get the path. // allocate settingsOnCloudPath buffer with the return value + 1, then call it again to get the path.
// Returns the number of TCHAR copied/to copy. If the return value is 0, then this path is not set, or the "strLen" is not enough to copy the path. // Returns the number of wchar_t copied/to copy. If the return value is 0, then this path is not set, or the "strLen" is not enough to copy the path.
#define NPPM_SETLINENUMBERWIDTHMODE (NPPMSG + 99) #define NPPM_SETLINENUMBERWIDTHMODE (NPPMSG + 99)
#define LINENUMWIDTH_DYNAMIC 0 #define LINENUMWIDTH_DYNAMIC 0
@ -812,7 +812,7 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 };
// Return TRUE // Return TRUE
#define NPPM_GETEXTERNALLEXERAUTOINDENTMODE (NPPMSG + 103) #define NPPM_GETEXTERNALLEXERAUTOINDENTMODE (NPPMSG + 103)
// BOOL NPPM_GETEXTERNALLEXERAUTOINDENTMODE(const TCHAR* languageName, ExternalLexerAutoIndentMode* autoIndentMode) // BOOL NPPM_GETEXTERNALLEXERAUTOINDENTMODE(const wchar_t* languageName, ExternalLexerAutoIndentMode* autoIndentMode)
// Get ExternalLexerAutoIndentMode for an installed external programming language. // Get ExternalLexerAutoIndentMode for an installed external programming language.
// wParam[in]: languageName is external language name to search // wParam[in]: languageName is external language name to search
// lParam[out]: autoIndentMode could recieve one of three following values // lParam[out]: autoIndentMode could recieve one of three following values
@ -822,7 +822,7 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 };
// returned values: TRUE for successful searches, otherwise FALSE. // returned values: TRUE for successful searches, otherwise FALSE.
#define NPPM_SETEXTERNALLEXERAUTOINDENTMODE (NPPMSG + 104) #define NPPM_SETEXTERNALLEXERAUTOINDENTMODE (NPPMSG + 104)
// BOOL NPPM_SETEXTERNALLEXERAUTOINDENTMODE(const TCHAR* languageName, ExternalLexerAutoIndentMode autoIndentMode) // BOOL NPPM_SETEXTERNALLEXERAUTOINDENTMODE(const wchar_t* languageName, ExternalLexerAutoIndentMode autoIndentMode)
// Set ExternalLexerAutoIndentMode for an installed external programming language. // Set ExternalLexerAutoIndentMode for an installed external programming language.
// wParam[in]: languageName is external language name to set // wParam[in]: languageName is external language name to set
// lParam[in]: autoIndentMode could recieve one of three following values // lParam[in]: autoIndentMode could recieve one of three following values
@ -887,17 +887,17 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 };
// https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/PowerEditor/src/NppDarkMode.h#L32 // https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/PowerEditor/src/NppDarkMode.h#L32
#define NPPM_GETCURRENTCMDLINE (NPPMSG + 109) #define NPPM_GETCURRENTCMDLINE (NPPMSG + 109)
// int NPPM_GETCURRENTCMDLINE(size_t strLen, TCHAR *commandLineStr) // int NPPM_GETCURRENTCMDLINE(size_t strLen, wchar_t *commandLineStr)
// Get the Current Command Line string. // Get the Current Command Line string.
// Users should call it with commandLineStr as NULL to get the required number of TCHAR (not including the terminating nul character), // Users should call it with commandLineStr as NULL to get the required number of wchar_t (not including the terminating nul character),
// allocate commandLineStr buffer with the return value + 1, then call it again to get the current command line string. // allocate commandLineStr buffer with the return value + 1, then call it again to get the current command line string.
// wParam[in]: strLen is "commandLineStr" buffer length // wParam[in]: strLen is "commandLineStr" buffer length
// lParam[out]: commandLineStr recieves all copied command line string // lParam[out]: commandLineStr recieves all copied command line string
// Return the number of TCHAR copied/to copy // Return the number of wchar_t copied/to copy
#define NPPM_CREATELEXER (NPPMSG + 110) #define NPPM_CREATELEXER (NPPMSG + 110)
// void* NPPM_CREATELEXER(0, const TCHAR* lexer_name) // void* NPPM_CREATELEXER(0, const wchar_t* lexer_name)
// Get the ILexer pointer created by Lexilla. Call the lexilla "CreateLexer()" function to allow plugins to set the lexer for a Scintilla instance created by NPPM_CREATESCINTILLAHANDLE. // Get the ILexer pointer created by Lexilla. Call the lexilla "CreateLexer()" function to allow plugins to set the lexer for a Scintilla instance created by NPPM_CREATESCINTILLAHANDLE.
// wParam: 0 (not used) // wParam: 0 (not used)
// lParam[in]: lexer_name is the name of the lexer // lParam[in]: lexer_name is the name of the lexer
@ -974,7 +974,7 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 };
// Note: there's no symetric command NPPM_SETTABCOLORID. Plugins can use NPPM_MENUCOMMAND to set current tab color with the desired tab color ID. // Note: there's no symetric command NPPM_SETTABCOLORID. Plugins can use NPPM_MENUCOMMAND to set current tab color with the desired tab color ID.
#define NPPM_SETUNTITLEDNAME (NPPMSG + 115) #define NPPM_SETUNTITLEDNAME (NPPMSG + 115)
// int NPPM_SETUNTITLEDNAME(BufferID id, const TCHAR* newName) // int NPPM_SETUNTITLEDNAME(BufferID id, const wchar_t* newName)
// Rename the tab name for an untitled tab. // Rename the tab name for an untitled tab.
// wParam[in]: id - BufferID of the tab. -1 for currently active tab // wParam[in]: id - BufferID of the tab. -1 for currently active tab
// lParam[in]: newName - the desired new name of the tab // lParam[in]: newName - the desired new name of the tab
@ -1007,11 +1007,11 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 };
#define NPPM_GETNPPFULLFILEPATH (RUNCOMMAND_USER + NPP_FULL_FILE_PATH) #define NPPM_GETNPPFULLFILEPATH (RUNCOMMAND_USER + NPP_FULL_FILE_PATH)
#define NPPM_GETFILENAMEATCURSOR (RUNCOMMAND_USER + GETFILENAMEATCURSOR) #define NPPM_GETFILENAMEATCURSOR (RUNCOMMAND_USER + GETFILENAMEATCURSOR)
#define NPPM_GETCURRENTLINESTR (RUNCOMMAND_USER + CURRENT_LINESTR) #define NPPM_GETCURRENTLINESTR (RUNCOMMAND_USER + CURRENT_LINESTR)
// BOOL NPPM_GETXXXXXXXXXXXXXXXX(size_t strLen, TCHAR *str) // BOOL NPPM_GETXXXXXXXXXXXXXXXX(size_t strLen, wchar_t *str)
// Get XXX string operations. // Get XXX string operations.
// wParam[in]: strLen is the allocated array size // wParam[in]: strLen is the allocated array size
// lParam[out]: str is the allocated TCHAR array // lParam[out]: str is the allocated wchar_t array
// The return value is TRUE when get generic_string operation success, otherwise FALSE (allocated array size is too small) // The return value is TRUE when get std::wstring operation success, otherwise FALSE (allocated array size is too small)
#define NPPM_GETCURRENTLINE (RUNCOMMAND_USER + CURRENT_LINE) #define NPPM_GETCURRENTLINE (RUNCOMMAND_USER + CURRENT_LINE)

View File

@ -18,10 +18,8 @@
#include <shlwapi.h> #include <shlwapi.h>
#include "Notepad_plus_Window.h" #include "Notepad_plus_Window.h"
const TCHAR Notepad_plus_Window::_className[32] = TEXT("Notepad++");
HWND Notepad_plus_Window::gNppHWND = NULL; HWND Notepad_plus_Window::gNppHWND = NULL;
namespace // anonymous namespace // anonymous
{ {
@ -49,6 +47,7 @@ namespace // anonymous
} // anonymous namespace } // anonymous namespace
using namespace std;
void Notepad_plus_Window::setStartupBgColor(COLORREF BgColor) void Notepad_plus_Window::setStartupBgColor(COLORREF BgColor)
{ {
@ -61,7 +60,7 @@ void Notepad_plus_Window::setStartupBgColor(COLORREF BgColor)
void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLine, CmdLineParams *cmdLineParams) void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const wchar_t *cmdLine, CmdLineParams *cmdLineParams)
{ {
Window::init(hInst, parent); Window::init(hInst, parent);
WNDCLASS nppClass{}; WNDCLASS nppClass{};
@ -97,7 +96,7 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLin
_hSelf = ::CreateWindowEx( _hSelf = ::CreateWindowEx(
WS_EX_ACCEPTFILES | (_notepad_plus_plus_core._nativeLangSpeaker.isRTL() ? WS_EX_LAYOUTRTL : 0), WS_EX_ACCEPTFILES | (_notepad_plus_plus_core._nativeLangSpeaker.isRTL() ? WS_EX_LAYOUTRTL : 0),
_className, _className,
TEXT("Notepad++"), L"Notepad++",
(WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN), (WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN),
// CreateWindowEx bug : set all 0 to walk around the pb // CreateWindowEx bug : set all 0 to walk around the pb
0, 0, 0, 0, 0, 0, 0, 0,
@ -189,22 +188,22 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLin
{ {
HICON icon = nullptr; HICON icon = nullptr;
loadTrayIcon(_hInst, &icon); loadTrayIcon(_hInst, &icon);
_notepad_plus_plus_core._pTrayIco = new trayIconControler(_hSelf, IDI_M30ICON, NPPM_INTERNAL_MINIMIZED_TRAY, icon, TEXT("")); _notepad_plus_plus_core._pTrayIco = new trayIconControler(_hSelf, IDI_M30ICON, NPPM_INTERNAL_MINIMIZED_TRAY, icon, L"");
_notepad_plus_plus_core._pTrayIco->doTrayIcon(ADD); _notepad_plus_plus_core._pTrayIco->doTrayIcon(ADD);
} }
if(cmdLineParams->isPointValid() && NppDarkMode::isEnabled()) if(cmdLineParams->isPointValid() && NppDarkMode::isEnabled())
setStartupBgColor(NppDarkMode::getBackgroundColor()); //draw dark background when opening Npp through cmd with position data setStartupBgColor(NppDarkMode::getBackgroundColor()); //draw dark background when opening Npp through cmd with position data
std::vector<generic_string> fileNames; std::vector<wstring> fileNames;
std::vector<generic_string> patterns; std::vector<wstring> patterns;
patterns.push_back(TEXT("*.xml")); patterns.push_back(L"*.xml");
generic_string nppDir = nppParams.getNppPath(); wstring nppDir = nppParams.getNppPath();
LocalizationSwitcher & localizationSwitcher = nppParams.getLocalizationSwitcher(); LocalizationSwitcher & localizationSwitcher = nppParams.getLocalizationSwitcher();
std::wstring localizationDir = nppDir; std::wstring localizationDir = nppDir;
pathAppend(localizationDir, TEXT("localization\\")); pathAppend(localizationDir, L"localization\\");
_notepad_plus_plus_core.getMatchedFileNames(localizationDir.c_str(), 0, patterns, fileNames, false, false); _notepad_plus_plus_core.getMatchedFileNames(localizationDir.c_str(), 0, patterns, fileNames, false, false);
for (size_t i = 0, len = fileNames.size(); i < len; ++i) for (size_t i = 0, len = fileNames.size(); i < len; ++i)
@ -216,10 +215,10 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLin
// Get themes from both npp install themes dir and app data themes dir with the per user // Get themes from both npp install themes dir and app data themes dir with the per user
// overriding default themes of the same name. // overriding default themes of the same name.
generic_string appDataThemeDir = nppParams.isCloud() ? nppParams.getUserPath() : nppParams.getAppDataNppDir(); wstring appDataThemeDir = nppParams.isCloud() ? nppParams.getUserPath() : nppParams.getAppDataNppDir();
if (!appDataThemeDir.empty()) if (!appDataThemeDir.empty())
{ {
pathAppend(appDataThemeDir, TEXT("themes\\")); pathAppend(appDataThemeDir, L"themes\\");
_notepad_plus_plus_core.getMatchedFileNames(appDataThemeDir.c_str(), 0, patterns, fileNames, false, false); _notepad_plus_plus_core.getMatchedFileNames(appDataThemeDir.c_str(), 0, patterns, fileNames, false, false);
for (size_t i = 0, len = fileNames.size() ; i < len ; ++i) for (size_t i = 0, len = fileNames.size() ; i < len ; ++i)
{ {
@ -229,8 +228,8 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLin
fileNames.clear(); fileNames.clear();
generic_string nppThemeDir = nppDir.c_str(); // <- should use the pointer to avoid the constructor of copy wstring nppThemeDir = nppDir.c_str(); // <- should use the pointer to avoid the constructor of copy
pathAppend(nppThemeDir, TEXT("themes\\")); pathAppend(nppThemeDir, L"themes\\");
// Set theme directory to their installation directory // Set theme directory to their installation directory
themeSwitcher.setThemeDirPath(nppThemeDir); themeSwitcher.setThemeDirPath(nppThemeDir);
@ -238,21 +237,21 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLin
_notepad_plus_plus_core.getMatchedFileNames(nppThemeDir.c_str(), 0, patterns, fileNames, false, false); _notepad_plus_plus_core.getMatchedFileNames(nppThemeDir.c_str(), 0, patterns, fileNames, false, false);
for (size_t i = 0, len = fileNames.size(); i < len ; ++i) for (size_t i = 0, len = fileNames.size(); i < len ; ++i)
{ {
generic_string themeName( themeSwitcher.getThemeFromXmlFileName(fileNames[i].c_str()) ); wstring themeName( themeSwitcher.getThemeFromXmlFileName(fileNames[i].c_str()) );
if (!themeSwitcher.themeNameExists(themeName.c_str())) if (!themeSwitcher.themeNameExists(themeName.c_str()))
{ {
themeSwitcher.addThemeFromXml(fileNames[i]); themeSwitcher.addThemeFromXml(fileNames[i]);
if (!appDataThemeDir.empty()) if (!appDataThemeDir.empty())
{ {
generic_string appDataThemePath = appDataThemeDir; wstring appDataThemePath = appDataThemeDir;
if (!::PathFileExists(appDataThemePath.c_str())) if (!::PathFileExists(appDataThemePath.c_str()))
{ {
::CreateDirectory(appDataThemePath.c_str(), NULL); ::CreateDirectory(appDataThemePath.c_str(), NULL);
} }
TCHAR* fn = PathFindFileName(fileNames[i].c_str()); wchar_t* fn = PathFindFileName(fileNames[i].c_str());
pathAppend(appDataThemePath, fn); pathAppend(appDataThemePath, fn);
themeSwitcher.addThemeStylerSavePath(fileNames[i], appDataThemePath); themeSwitcher.addThemeStylerSavePath(fileNames[i], appDataThemePath);
} }
@ -261,14 +260,14 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLin
if (NppDarkMode::isWindowsModeEnabled()) if (NppDarkMode::isWindowsModeEnabled())
{ {
generic_string themePath; wstring themePath;
generic_string xmlFileName = NppDarkMode::getThemeName(); wstring xmlFileName = NppDarkMode::getThemeName();
if (!xmlFileName.empty()) if (!xmlFileName.empty())
{ {
if (!nppParams.isLocal() || nppParams.isCloud()) if (!nppParams.isLocal() || nppParams.isCloud())
{ {
themePath = nppParams.getUserPath(); themePath = nppParams.getUserPath();
pathAppend(themePath, TEXT("themes\\")); pathAppend(themePath, L"themes\\");
pathAppend(themePath, xmlFileName); pathAppend(themePath, xmlFileName);
} }
@ -297,7 +296,7 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLin
::SendMessage(_hSelf, WM_COMMAND, _notepad_plus_plus_core._internalFuncIDs[i], 0); ::SendMessage(_hSelf, WM_COMMAND, _notepad_plus_plus_core._internalFuncIDs[i], 0);
std::chrono::steady_clock::duration cmdlineParamsLoadingTime{}; std::chrono::steady_clock::duration cmdlineParamsLoadingTime{};
std::vector<generic_string> fns; std::vector<wstring> fns;
if (cmdLine) if (cmdLine)
{ {
std::chrono::steady_clock::time_point cmdlineParamsLoadingStartTP = std::chrono::steady_clock::now(); std::chrono::steady_clock::time_point cmdlineParamsLoadingStartTP = std::chrono::steady_clock::now();
@ -309,7 +308,7 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLin
// To avoid dockable panel toggle problem. // To avoid dockable panel toggle problem.
if (cmdLineParams->_openFoldersAsWorkspace) if (cmdLineParams->_openFoldersAsWorkspace)
{ {
generic_string emptyStr; wstring emptyStr;
_notepad_plus_plus_core.launchFileBrowser(fns, emptyStr, true); _notepad_plus_plus_core.launchFileBrowser(fns, emptyStr, true);
} }
::SendMessage(_hSelf, WM_ACTIVATE, WA_ACTIVE, 0); ::SendMessage(_hSelf, WM_ACTIVATE, WA_ACTIVE, 0);
@ -349,7 +348,7 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLin
_userQuote = cmdLineParams->_easterEggName; _userQuote = cmdLineParams->_easterEggName;
_quoteParams.reset(); _quoteParams.reset();
_quoteParams._quote = _userQuote.c_str(); _quoteParams._quote = _userQuote.c_str();
_quoteParams._quoter = TEXT("Anonymous #999"); _quoteParams._quoter = L"Anonymous #999";
_quoteParams._shouldBeTrolling = false; _quoteParams._shouldBeTrolling = false;
_quoteParams._lang = cmdLineParams->_langType; _quoteParams._lang = cmdLineParams->_langType;
if (cmdLineParams->_ghostTypingSpeed == 1) if (cmdLineParams->_ghostTypingSpeed == 1)
@ -372,7 +371,7 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLin
{ {
_quoteParams.reset(); _quoteParams.reset();
_quoteParams._quote = _userQuote.c_str(); _quoteParams._quote = _userQuote.c_str();
_quoteParams._quoter = TEXT("Anonymous #999"); _quoteParams._quoter = L"Anonymous #999";
_quoteParams._shouldBeTrolling = false; _quoteParams._shouldBeTrolling = false;
_quoteParams._lang = cmdLineParams->_langType; _quoteParams._lang = cmdLineParams->_langType;
if (cmdLineParams->_ghostTypingSpeed == 1) if (cmdLineParams->_ghostTypingSpeed == 1)

View File

@ -18,7 +18,7 @@
constexpr int splitterSize = 8; constexpr int splitterSize = 8;
const TCHAR COMMAND_ARG_HELP[] = TEXT("Usage :\r\ const wchar_t COMMAND_ARG_HELP[] = L"Usage :\r\
\r\ \r\
notepad++ [--help] [-multiInst] [-noPlugin] [-lLanguage] [-udl=\"My UDL Name\"] [-LlangCode] [-nLineNumber] [-cColumnNumber] [-pPosition] [-xLeftPos] [-yTopPos] [-monitor] [-nosession] [-notabbar] [-ro] [-systemtray] [-loadingTime] [-alwaysOnTop] [-openSession] [-r] [-qn=\"Easter egg name\" | -qt=\"a text to display.\" | -qf=\"D:\\my quote.txt\"] [-qSpeed1|2|3] [-quickPrint] [-settingsDir=\"d:\\your settings dir\\\"] [-openFoldersAsWorkspace] [-titleAdd=\"additional title bar text\"][filePath]\r\ notepad++ [--help] [-multiInst] [-noPlugin] [-lLanguage] [-udl=\"My UDL Name\"] [-LlangCode] [-nLineNumber] [-cColumnNumber] [-pPosition] [-xLeftPos] [-yTopPos] [-monitor] [-nosession] [-notabbar] [-ro] [-systemtray] [-loadingTime] [-alwaysOnTop] [-openSession] [-r] [-qn=\"Easter egg name\" | -qt=\"a text to display.\" | -qf=\"D:\\my quote.txt\"] [-qSpeed1|2|3] [-quickPrint] [-settingsDir=\"d:\\your settings dir\\\"] [-openFoldersAsWorkspace] [-titleAdd=\"additional title bar text\"][filePath]\r\
\r\ \r\
@ -52,13 +52,13 @@ notepad++ [--help] [-multiInst] [-noPlugin] [-lLanguage] [-udl=\"My UDL Name\"]
-openFoldersAsWorkspace: open filePath of folder(s) as workspace\r\ -openFoldersAsWorkspace: open filePath of folder(s) as workspace\r\
-titleAdd=\"string\": add string to Notepad++ title bar\r\ -titleAdd=\"string\": add string to Notepad++ title bar\r\
filePath : file or folder name to open (absolute or relative path name)\r\ filePath : file or folder name to open (absolute or relative path name)\r\
"); ";
class Notepad_plus_Window : public Window class Notepad_plus_Window : public Window
{ {
public: public:
void init(HINSTANCE, HWND, const TCHAR *cmdLine, CmdLineParams *cmdLineParams); void init(HINSTANCE, HWND, const wchar_t *cmdLine, CmdLineParams *cmdLineParams);
bool isDlgsMsg(MSG *msg) const; bool isDlgsMsg(MSG *msg) const;
@ -66,7 +66,7 @@ public:
return _notepad_plus_plus_core.getAccTable(); return _notepad_plus_plus_core.getAccTable();
}; };
bool emergency(const generic_string& emergencySavedDir) { bool emergency(const std::wstring& emergencySavedDir) {
return _notepad_plus_plus_core.emergency(emergencySavedDir); return _notepad_plus_plus_core.emergency(emergencySavedDir);
}; };
@ -78,7 +78,7 @@ public:
_isPrelaunch = val; _isPrelaunch = val;
}; };
generic_string getPluginListVerStr() const { std::wstring getPluginListVerStr() const {
return _notepad_plus_plus_core.getPluginListVerStr(); return _notepad_plus_plus_core.getPluginListVerStr();
}; };
@ -88,7 +88,7 @@ public:
::DestroyWindow(_hSelf); ::DestroyWindow(_hSelf);
}; };
static const TCHAR * getClassName() { static const wchar_t * getClassName() {
return _className; return _className;
}; };
@ -109,7 +109,7 @@ private:
static LRESULT CALLBACK Notepad_plus_Proc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam); static LRESULT CALLBACK Notepad_plus_Proc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam);
LRESULT runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam); LRESULT runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam);
static const TCHAR _className[32]; static constexpr wchar_t _className[32] = L"Notepad++";
bool _isPrelaunch = false; bool _isPrelaunch = false;
bool _disablePluginsManager = false; bool _disablePluginsManager = false;

View File

@ -69,11 +69,11 @@ bool SetOSAppRestart()
bool bRet = false; bool bRet = false;
bool bUnregister = nppParam.isRegForOSAppRestartDisabled(); bool bUnregister = nppParam.isRegForOSAppRestartDisabled();
generic_string nppIssueLog; wstring nppIssueLog;
if (nppParam.doNppLogNulContentCorruptionIssue()) if (nppParam.doNppLogNulContentCorruptionIssue())
{ {
generic_string issueFn = nppLogNulContentCorruptionIssue; wstring issueFn = nppLogNulContentCorruptionIssue;
issueFn += TEXT(".log"); issueFn += L".log";
nppIssueLog = nppParam.getUserPath(); nppIssueLog = nppParam.getUserPath();
pathAppend(nppIssueLog, issueFn); pathAppend(nppIssueLog, issueFn);
} }
@ -244,7 +244,7 @@ LRESULT Notepad_plus_Window::runProc(HWND hwnd, UINT message, WPARAM wParam, LPA
} }
// Used by NPPM_GETFILENAMEATCURSOR // Used by NPPM_GETFILENAMEATCURSOR
int CharacterIs(TCHAR c, const TCHAR *any) int CharacterIs(wchar_t c, const wchar_t *any)
{ {
int i; int i;
for (i = 0; any[i] != 0; i++) for (i = 0; any[i] != 0; i++)
@ -392,29 +392,29 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case WM_REMOVE_USERLANG: case WM_REMOVE_USERLANG:
{ {
TCHAR *userLangName = reinterpret_cast<TCHAR *>(lParam); wchar_t *userLangName = reinterpret_cast<wchar_t *>(lParam);
if (!userLangName || !userLangName[0]) if (!userLangName || !userLangName[0])
return FALSE; return FALSE;
generic_string name{userLangName}; wstring name{userLangName};
//loop through buffers and reset the language (L_USER, TEXT("")) if (L_USER, name) //loop through buffers and reset the language (L_USER, L"")) if (L_USER, name)
for (size_t i = 0; i < MainFileManager.getNbBuffers(); ++i) for (size_t i = 0; i < MainFileManager.getNbBuffers(); ++i)
{ {
Buffer* buf = MainFileManager.getBufferByIndex(i); Buffer* buf = MainFileManager.getBufferByIndex(i);
if (buf->getLangType() == L_USER && name == buf->getUserDefineLangName()) if (buf->getLangType() == L_USER && name == buf->getUserDefineLangName())
buf->setLangType(L_USER, TEXT("")); buf->setLangType(L_USER, L"");
} }
return TRUE; return TRUE;
} }
case WM_RENAME_USERLANG: case WM_RENAME_USERLANG:
{ {
if (!lParam || !((reinterpret_cast<TCHAR *>(lParam))[0]) || !wParam || !((reinterpret_cast<TCHAR *>(wParam))[0])) if (!lParam || !((reinterpret_cast<wchar_t *>(lParam))[0]) || !wParam || !((reinterpret_cast<wchar_t *>(wParam))[0]))
return FALSE; return FALSE;
generic_string oldName{ reinterpret_cast<TCHAR *>(lParam) }; wstring oldName{ reinterpret_cast<wchar_t *>(lParam) };
generic_string newName{ reinterpret_cast<TCHAR *>(wParam) }; wstring newName{ reinterpret_cast<wchar_t *>(wParam) };
//loop through buffers and reset the language (L_USER, newName) if (L_USER, oldName) //loop through buffers and reset the language (L_USER, newName) if (L_USER, oldName)
for (size_t i = 0; i < MainFileManager.getNbBuffers(); ++i) for (size_t i = 0; i < MainFileManager.getNbBuffers(); ++i)
@ -487,7 +487,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
{ {
// Find in files function code should be here due to the number of parameters (2) cannot be passed via WM_COMMAND // Find in files function code should be here due to the number of parameters (2) cannot be passed via WM_COMMAND
constexpr int strSize = FINDREPLACE_MAXLENGTH; constexpr int strSize = FINDREPLACE_MAXLENGTH;
TCHAR str[strSize]{}; wchar_t str[strSize]{};
bool isFirstTime = !_findReplaceDlg.isCreated(); bool isFirstTime = !_findReplaceDlg.isCreated();
_findReplaceDlg.doDialog(FIND_DLG, _nativeLangSpeaker.isRTL()); _findReplaceDlg.doDialog(FIND_DLG, _nativeLangSpeaker.isRTL());
@ -502,7 +502,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
if (isFirstTime) if (isFirstTime)
_nativeLangSpeaker.changeFindReplaceDlgLang(_findReplaceDlg); _nativeLangSpeaker.changeFindReplaceDlgLang(_findReplaceDlg);
_findReplaceDlg.launchFindInFilesDlg(); _findReplaceDlg.launchFindInFilesDlg();
setFindReplaceFolderFilter(reinterpret_cast<const TCHAR*>(wParam), reinterpret_cast<const TCHAR*>(lParam)); setFindReplaceFolderFilter(reinterpret_cast<const wchar_t*>(wParam), reinterpret_cast<const wchar_t*>(lParam));
return TRUE; return TRUE;
} }
@ -510,7 +510,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case NPPM_INTERNAL_FINDINPROJECTS: case NPPM_INTERNAL_FINDINPROJECTS:
{ {
constexpr int strSize = FINDREPLACE_MAXLENGTH; constexpr int strSize = FINDREPLACE_MAXLENGTH;
TCHAR str[strSize]{}; wchar_t str[strSize]{};
bool isFirstTime = not _findReplaceDlg.isCreated(); bool isFirstTime = not _findReplaceDlg.isCreated();
_findReplaceDlg.doDialog(FIND_DLG, _nativeLangSpeaker.isRTL()); _findReplaceDlg.doDialog(FIND_DLG, _nativeLangSpeaker.isRTL());
@ -527,7 +527,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case NPPM_INTERNAL_FINDINFINDERDLG: case NPPM_INTERNAL_FINDINFINDERDLG:
{ {
constexpr int strSize = FINDREPLACE_MAXLENGTH; constexpr int strSize = FINDREPLACE_MAXLENGTH;
TCHAR str[strSize]{}; wchar_t str[strSize]{};
Finder *launcher = reinterpret_cast<Finder *>(wParam); Finder *launcher = reinterpret_cast<Finder *>(wParam);
bool isFirstTime = !_findInFinderDlg.isCreated(); bool isFirstTime = !_findInFinderDlg.isCreated();
@ -547,7 +547,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case NPPM_DOOPEN: case NPPM_DOOPEN:
case WM_DOOPEN: case WM_DOOPEN:
{ {
BufferID id = doOpen(reinterpret_cast<const TCHAR *>(lParam)); BufferID id = doOpen(reinterpret_cast<const wchar_t *>(lParam));
if (id != BUFFER_INVALID) if (id != BUFFER_INVALID)
return switchToFile(id); return switchToFile(id);
break; break;
@ -656,8 +656,8 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case NPPM_RELOADFILE: case NPPM_RELOADFILE:
{ {
TCHAR longNameFullpath[MAX_PATH]{}; wchar_t longNameFullpath[MAX_PATH]{};
const TCHAR* pFilePath = reinterpret_cast<const TCHAR*>(lParam); const wchar_t* pFilePath = reinterpret_cast<const wchar_t*>(lParam);
wcscpy_s(longNameFullpath, MAX_PATH, pFilePath); wcscpy_s(longNameFullpath, MAX_PATH, pFilePath);
if (wcschr(longNameFullpath, '~')) if (wcschr(longNameFullpath, '~'))
{ {
@ -673,7 +673,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case NPPM_SWITCHTOFILE : case NPPM_SWITCHTOFILE :
{ {
BufferID id = MainFileManager.getBufferFromName(reinterpret_cast<const TCHAR *>(lParam)); BufferID id = MainFileManager.getBufferFromName(reinterpret_cast<const wchar_t *>(lParam));
if (id != BUFFER_INVALID) if (id != BUFFER_INVALID)
return switchToFile(id); return switchToFile(id);
return false; return false;
@ -688,7 +688,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
{ {
BufferID currentBufferID = _pEditView->getCurrentBufferID(); BufferID currentBufferID = _pEditView->getCurrentBufferID();
bool asCopy = wParam == TRUE; bool asCopy = wParam == TRUE;
const TCHAR *filename = reinterpret_cast<const TCHAR *>(lParam); const wchar_t *filename = reinterpret_cast<const wchar_t *>(lParam);
if (!filename) return FALSE; if (!filename) return FALSE;
return doSave(currentBufferID, filename, asCopy); return doSave(currentBufferID, filename, asCopy);
} }
@ -700,7 +700,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case NPPM_SAVEFILE: case NPPM_SAVEFILE:
{ {
return fileSaveSpecific(reinterpret_cast<const TCHAR *>(lParam)); return fileSaveSpecific(reinterpret_cast<const wchar_t *>(lParam));
} }
case NPPM_GETCURRENTNATIVELANGENCODING: case NPPM_GETCURRENTNATIVELANGENCODING:
@ -821,7 +821,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
if (sizeof(CmdLineParamsDTO) == cmdLineParamsSize) // make sure the structure is the same if (sizeof(CmdLineParamsDTO) == cmdLineParamsSize) // make sure the structure is the same
{ {
nppParam.setCmdlineParam(*cmdLineParam); nppParam.setCmdlineParam(*cmdLineParam);
generic_string pluginMessage { nppParam.getCmdLineParams()._pluginMessage }; wstring pluginMessage { nppParam.getCmdLineParams()._pluginMessage };
if (!pluginMessage.empty()) if (!pluginMessage.empty())
{ {
SCNotification scnN{}; SCNotification scnN{};
@ -834,7 +834,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
else else
{ {
#ifdef DEBUG #ifdef DEBUG
printStr(TEXT("sizeof(CmdLineParams) != cmdLineParamsSize\rCmdLineParams is formed by an instance of another version,\rwhereas your CmdLineParams has been modified in this instance.")); printStr(L"sizeof(CmdLineParams) != cmdLineParamsSize\rCmdLineParams is formed by an instance of another version,\rwhereas your CmdLineParams has been modified in this instance.");
#endif #endif
} }
@ -952,10 +952,10 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case NPPM_GETNAMEPART: case NPPM_GETNAMEPART:
case NPPM_GETEXTPART: case NPPM_GETEXTPART:
{ {
TCHAR str[MAX_PATH] = { '\0' }; wchar_t str[MAX_PATH] = { '\0' };
// par defaut : NPPM_GETCURRENTDIRECTORY // par defaut : NPPM_GETCURRENTDIRECTORY
wcscpy_s(str, _pEditView->getCurrentBuffer()->getFullPathName()); wcscpy_s(str, _pEditView->getCurrentBuffer()->getFullPathName());
TCHAR* fileStr = str; wchar_t* fileStr = str;
if (message == NPPM_GETCURRENTDIRECTORY) if (message == NPPM_GETCURRENTDIRECTORY)
PathRemoveFileSpec(str); PathRemoveFileSpec(str);
@ -969,8 +969,8 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
else if (message == NPPM_GETEXTPART) else if (message == NPPM_GETEXTPART)
fileStr = PathFindExtension(str); fileStr = PathFindExtension(str);
// For the compability reason, if wParam is 0, then we assume the size of generic_string buffer (lParam) is large enough. // For the compability reason, if wParam is 0, then we assume the size of wstring buffer (lParam) is large enough.
// otherwise we check if the generic_string buffer size is enough for the generic_string to copy. // otherwise we check if the wstring buffer size is enough for the wstring to copy.
if (wParam != 0) if (wParam != 0)
{ {
if (lstrlen(fileStr) >= int(wParam)) if (lstrlen(fileStr) >= int(wParam))
@ -979,7 +979,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
} }
} }
lstrcpy(reinterpret_cast<TCHAR *>(lParam), fileStr); lstrcpy(reinterpret_cast<wchar_t *>(lParam), fileStr);
return TRUE; return TRUE;
} }
@ -987,16 +987,16 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case NPPM_GETCURRENTLINESTR: case NPPM_GETCURRENTLINESTR:
{ {
const int strSize = CURRENTWORD_MAXLENGTH; const int strSize = CURRENTWORD_MAXLENGTH;
TCHAR str[strSize] = { '\0' }; wchar_t str[strSize] = { '\0' };
TCHAR *pTchar = reinterpret_cast<TCHAR *>(lParam); wchar_t *pTchar = reinterpret_cast<wchar_t *>(lParam);
if (message == NPPM_GETCURRENTWORD) if (message == NPPM_GETCURRENTWORD)
_pEditView->getGenericSelectedText(str, strSize); _pEditView->getGenericSelectedText(str, strSize);
else if (message == NPPM_GETCURRENTLINESTR) else if (message == NPPM_GETCURRENTLINESTR)
_pEditView->getLine(_pEditView->getCurrentLineNumber(), str, strSize); _pEditView->getLine(_pEditView->getCurrentLineNumber(), str, strSize);
// For the compability reason, if wParam is 0, then we assume the size of generic_string buffer (lParam) is large enough. // For the compability reason, if wParam is 0, then we assume the size of wstring buffer (lParam) is large enough.
// otherwise we check if the generic_string buffer size is enough for the generic_string to copy. // otherwise we check if the wstring buffer size is enough for the wstring to copy.
if (wParam != 0) if (wParam != 0)
{ {
if (lstrlen(str) >= int(wParam)) //buffer too small if (lstrlen(str) >= int(wParam)) //buffer too small
@ -1014,16 +1014,16 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
return TRUE; return TRUE;
} }
case NPPM_GETFILENAMEATCURSOR: // wParam = buffer length, lParam = (TCHAR*)buffer case NPPM_GETFILENAMEATCURSOR: // wParam = buffer length, lParam = (wchar_t*)buffer
{ {
constexpr int strSize = CURRENTWORD_MAXLENGTH; constexpr int strSize = CURRENTWORD_MAXLENGTH;
TCHAR str[strSize]{}; wchar_t str[strSize]{};
int hasSlash = 0; int hasSlash = 0;
_pEditView->getGenericSelectedText(str, strSize); // this is either the selected text, or the word under the cursor if there is no selection _pEditView->getGenericSelectedText(str, strSize); // this is either the selected text, or the word under the cursor if there is no selection
hasSlash = FALSE; hasSlash = FALSE;
for (int i = 0; str[i] != 0; i++) for (int i = 0; str[i] != 0; i++)
if (CharacterIs(str[i], TEXT("\\/"))) if (CharacterIs(str[i], L"\\/"))
hasSlash = TRUE; hasSlash = TRUE;
if (hasSlash == FALSE) if (hasSlash == FALSE)
@ -1031,8 +1031,8 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
// it's not a full file name so try to find the beginning and ending of it // it's not a full file name so try to find the beginning and ending of it
intptr_t start = 0; intptr_t start = 0;
intptr_t end = 0; intptr_t end = 0;
const TCHAR *delimiters; const wchar_t *delimiters;
TCHAR strLine[strSize]{}; wchar_t strLine[strSize]{};
size_t lineNumber = 0; size_t lineNumber = 0;
intptr_t col = 0; intptr_t col = 0;
@ -1042,7 +1042,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
// find the start // find the start
start = col; start = col;
delimiters = TEXT(" \t[(\"<>"); delimiters = L" \t[(\"<>";
while ((start > 0) && (CharacterIs(strLine[start], delimiters) == FALSE)) while ((start > 0) && (CharacterIs(strLine[start], delimiters) == FALSE))
start--; start--;
@ -1050,7 +1050,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
// find the end // find the end
end = col; end = col;
delimiters = TEXT(" \t:()[]<>\"\r\n"); delimiters = L" \t:()[]<>\"\r\n";
while ((strLine[end] != 0) && (CharacterIs(strLine[end], delimiters) == FALSE)) end++; while ((strLine[end] != 0) && (CharacterIs(strLine[end], delimiters) == FALSE)) end++;
lstrcpyn(str, &strLine[start], static_cast<int>(end - start + 1)); lstrcpyn(str, &strLine[start], static_cast<int>(end - start + 1));
@ -1062,7 +1062,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
} }
else //buffer large enough, perform safe copy else //buffer large enough, perform safe copy
{ {
TCHAR* pTchar = reinterpret_cast<TCHAR*>(lParam); wchar_t* pTchar = reinterpret_cast<wchar_t*>(lParam);
lstrcpyn(pTchar, str, static_cast<int32_t>(wParam)); lstrcpyn(pTchar, str, static_cast<int32_t>(wParam));
return TRUE; return TRUE;
} }
@ -1072,15 +1072,15 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case NPPM_GETNPPDIRECTORY: case NPPM_GETNPPDIRECTORY:
{ {
constexpr int strSize = MAX_PATH; constexpr int strSize = MAX_PATH;
TCHAR str[strSize]{}; wchar_t str[strSize]{};
::GetModuleFileName(NULL, str, strSize); ::GetModuleFileName(NULL, str, strSize);
if (message == NPPM_GETNPPDIRECTORY) if (message == NPPM_GETNPPDIRECTORY)
PathRemoveFileSpec(str); PathRemoveFileSpec(str);
// For the compability reason, if wParam is 0, then we assume the size of generic_string buffer (lParam) is large enough. // For the compability reason, if wParam is 0, then we assume the size of wstring buffer (lParam) is large enough.
// otherwise we check if the generic_string buffer size is enough for the generic_string to copy. // otherwise we check if the wstring buffer size is enough for the wstring to copy.
if (wParam != 0) if (wParam != 0)
{ {
if (lstrlen(str) >= int(wParam)) if (lstrlen(str) >= int(wParam))
@ -1089,7 +1089,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
} }
} }
lstrcpy(reinterpret_cast<TCHAR *>(lParam), str); lstrcpy(reinterpret_cast<wchar_t *>(lParam), str);
return TRUE; return TRUE;
} }
@ -1148,7 +1148,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
if (!wParam) if (!wParam)
return 0; return 0;
TCHAR** fileNames = reinterpret_cast<TCHAR**>(wParam); wchar_t** fileNames = reinterpret_cast<wchar_t**>(wParam);
size_t nbFileNames = static_cast<size_t>(lParam); size_t nbFileNames = static_cast<size_t>(lParam);
size_t j = 0; size_t j = 0;
@ -1250,7 +1250,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case NPPM_GETNBSESSIONFILES: case NPPM_GETNBSESSIONFILES:
{ {
size_t nbSessionFiles = 0; size_t nbSessionFiles = 0;
const TCHAR* sessionFileName = reinterpret_cast<const TCHAR*>(lParam); const wchar_t* sessionFileName = reinterpret_cast<const wchar_t*>(lParam);
BOOL* pbIsValidXML = reinterpret_cast<BOOL*>(wParam); BOOL* pbIsValidXML = reinterpret_cast<BOOL*>(wParam);
if (pbIsValidXML) if (pbIsValidXML)
*pbIsValidXML = false; *pbIsValidXML = false;
@ -1269,8 +1269,8 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case NPPM_GETSESSIONFILES: case NPPM_GETSESSIONFILES:
{ {
const TCHAR *sessionFileName = reinterpret_cast<const TCHAR *>(lParam); const wchar_t *sessionFileName = reinterpret_cast<const wchar_t *>(lParam);
TCHAR **sessionFileArray = reinterpret_cast<TCHAR **>(wParam); wchar_t **sessionFileArray = reinterpret_cast<wchar_t **>(wParam);
if ((!sessionFileName) || (sessionFileName[0] == '\0')) if ((!sessionFileName) || (sessionFileName[0] == '\0'))
return FALSE; return FALSE;
@ -1281,13 +1281,13 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
size_t i = 0; size_t i = 0;
for ( ; i < session2Load.nbMainFiles() ; ) for ( ; i < session2Load.nbMainFiles() ; )
{ {
const TCHAR *pFn = session2Load._mainViewFiles[i]._fileName.c_str(); const wchar_t *pFn = session2Load._mainViewFiles[i]._fileName.c_str();
lstrcpy(sessionFileArray[i++], pFn); lstrcpy(sessionFileArray[i++], pFn);
} }
for (size_t j = 0, len = session2Load.nbSubFiles(); j < len ; ++j) for (size_t j = 0, len = session2Load.nbSubFiles(); j < len ; ++j)
{ {
const TCHAR *pFn = session2Load._subViewFiles[j]._fileName.c_str(); const wchar_t *pFn = session2Load._subViewFiles[j]._fileName.c_str();
lstrcpy(sessionFileArray[i++], pFn); lstrcpy(sessionFileArray[i++], pFn);
} }
return TRUE; return TRUE;
@ -1432,9 +1432,9 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
// 13.6.6.6 | 13 | 666 // 13.6.6.6 | 13 | 666
case NPPM_GETNPPVERSION: case NPPM_GETNPPVERSION:
{ {
const TCHAR* verStr = VERSION_INTERNAL_VALUE; const wchar_t* verStr = VERSION_INTERNAL_VALUE;
TCHAR mainVerStr[16]{}; wchar_t mainVerStr[16]{};
TCHAR auxVerStr[16]{}; wchar_t auxVerStr[16]{};
bool isDot = false; bool isDot = false;
int j = 0; int j = 0;
int k = 0; int k = 0;
@ -1503,7 +1503,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case NPPM_GETCURRENTCMDLINE: case NPPM_GETCURRENTCMDLINE:
{ {
generic_string cmdLineString = nppParam.getCmdLineString(); wstring cmdLineString = nppParam.getCmdLineString();
if (lParam != 0) if (lParam != 0)
{ {
@ -1511,7 +1511,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
{ {
return 0; return 0;
} }
lstrcpy(reinterpret_cast<TCHAR*>(lParam), cmdLineString.c_str()); lstrcpy(reinterpret_cast<wchar_t*>(lParam), cmdLineString.c_str());
} }
return cmdLineString.length(); return cmdLineString.length();
} }
@ -1519,7 +1519,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case NPPM_CREATELEXER: case NPPM_CREATELEXER:
{ {
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
const char* lexer_name = wmc.wchar2char(reinterpret_cast<TCHAR*>(lParam), CP_ACP); const char* lexer_name = wmc.wchar2char(reinterpret_cast<wchar_t*>(lParam), CP_ACP);
return (LRESULT) CreateLexer(lexer_name); return (LRESULT) CreateLexer(lexer_name);
} }
@ -1659,7 +1659,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case NPPM_SETSTATUSBAR: case NPPM_SETSTATUSBAR:
{ {
TCHAR *str2set = reinterpret_cast<TCHAR *>(lParam); wchar_t *str2set = reinterpret_cast<wchar_t *>(lParam);
if (!str2set || !str2set[0]) if (!str2set || !str2set[0])
return FALSE; return FALSE;
@ -1690,13 +1690,13 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case NPPM_LOADSESSION: case NPPM_LOADSESSION:
{ {
fileLoadSession(reinterpret_cast<const TCHAR *>(lParam)); fileLoadSession(reinterpret_cast<const wchar_t *>(lParam));
return TRUE; return TRUE;
} }
case NPPM_SAVECURRENTSESSION: case NPPM_SAVECURRENTSESSION:
{ {
return (LRESULT)fileSaveSession(0, NULL, reinterpret_cast<const TCHAR *>(lParam)); return (LRESULT)fileSaveSession(0, NULL, reinterpret_cast<const wchar_t *>(lParam));
} }
case NPPM_SAVESESSION: case NPPM_SAVESESSION:
@ -2240,7 +2240,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case NPPM_GETFULLPATHFROMBUFFERID: case NPPM_GETFULLPATHFROMBUFFERID:
{ {
return MainFileManager.getFileNameFromBuffer(reinterpret_cast<BufferID>(wParam), reinterpret_cast<TCHAR *>(lParam)); return MainFileManager.getFileNameFromBuffer(reinterpret_cast<BufferID>(wParam), reinterpret_cast<wchar_t *>(lParam));
} }
case NPPM_INTERNAL_ENABLECHECKDOCOPT: case NPPM_INTERNAL_ENABLECHECKDOCOPT:
@ -2393,8 +2393,8 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
{ {
int answer = _nativeLangSpeaker.messageBox("WindowsSessionExit", int answer = _nativeLangSpeaker.messageBox("WindowsSessionExit",
_pPublicInterface->getHSelf(), _pPublicInterface->getHSelf(),
TEXT("Windows session is about to be terminated but you have some data unsaved. Do you want to exit Notepad++ now?"), L"Windows session is about to be terminated but you have some data unsaved. Do you want to exit Notepad++ now?",
TEXT("Notepad++ - Windows session exit"), L"Notepad++ - Windows session exit",
MB_YESNO | MB_ICONQUESTION | MB_APPLMODAL); MB_YESNO | MB_ICONQUESTION | MB_APPLMODAL);
if (answer == IDYES) if (answer == IDYES)
::PostMessage(_pPublicInterface->getHSelf(), WM_CLOSE, 0, 0); ::PostMessage(_pPublicInterface->getHSelf(), WM_CLOSE, 0, 0);
@ -2464,9 +2464,9 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
if (nppParam.doNppLogNulContentCorruptionIssue()) if (nppParam.doNppLogNulContentCorruptionIssue())
{ {
generic_string issueFn = nppLogNulContentCorruptionIssue; wstring issueFn = nppLogNulContentCorruptionIssue;
issueFn += TEXT(".log"); issueFn += L".log";
generic_string nppIssueLog = nppParam.getUserPath(); wstring nppIssueLog = nppParam.getUserPath();
pathAppend(nppIssueLog, issueFn); pathAppend(nppIssueLog, issueFn);
string wmqesType = std::to_string(lParam); string wmqesType = std::to_string(lParam);
@ -2570,9 +2570,9 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
if (nppParam.doNppLogNulContentCorruptionIssue()) if (nppParam.doNppLogNulContentCorruptionIssue())
{ {
generic_string issueFn = nppLogNulContentCorruptionIssue; wstring issueFn = nppLogNulContentCorruptionIssue;
issueFn += TEXT(".log"); issueFn += L".log";
generic_string nppIssueLog = nppParam.getUserPath(); wstring nppIssueLog = nppParam.getUserPath();
pathAppend(nppIssueLog, issueFn); pathAppend(nppIssueLog, issueFn);
writeLog(nppIssueLog.c_str(), strLog.c_str()); writeLog(nppIssueLog.c_str(), strLog.c_str());
} }
@ -2591,9 +2591,9 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
if (nppParam.doNppLogNulContentCorruptionIssue()) if (nppParam.doNppLogNulContentCorruptionIssue())
{ {
generic_string issueFn = nppLogNulContentCorruptionIssue; wstring issueFn = nppLogNulContentCorruptionIssue;
issueFn += TEXT(".log"); issueFn += L".log";
generic_string nppIssueLog = nppParam.getUserPath(); wstring nppIssueLog = nppParam.getUserPath();
pathAppend(nppIssueLog, issueFn); pathAppend(nppIssueLog, issueFn);
string wmesType = std::to_string(lParam); string wmesType = std::to_string(lParam);
@ -2646,9 +2646,9 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
{ {
if (nppParam.doNppLogNulContentCorruptionIssue() && nppParam.isEndSessionStarted() && (message == WM_CLOSE)) if (nppParam.doNppLogNulContentCorruptionIssue() && nppParam.isEndSessionStarted() && (message == WM_CLOSE))
{ {
generic_string issueFn = nppLogNulContentCorruptionIssue; wstring issueFn = nppLogNulContentCorruptionIssue;
issueFn += TEXT(".log"); issueFn += L".log";
generic_string nppIssueLog = nppParam.getUserPath(); wstring nppIssueLog = nppParam.getUserPath();
pathAppend(nppIssueLog, issueFn); pathAppend(nppIssueLog, issueFn);
writeLog(nppIssueLog.c_str(), "WM_CLOSE (isEndSessionStarted == true)"); writeLog(nppIssueLog.c_str(), "WM_CLOSE (isEndSessionStarted == true)");
} }
@ -2761,21 +2761,21 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
// //
// saving session.xml into loaded session if a saved session is loaded and saveLoadedSessionOnExit option is enabled // saving session.xml into loaded session if a saved session is loaded and saveLoadedSessionOnExit option is enabled
// //
generic_string loadedSessionFilePath = nppParam.getLoadedSessionFilePath(); wstring loadedSessionFilePath = nppParam.getLoadedSessionFilePath();
if (!loadedSessionFilePath.empty() && PathFileExists(loadedSessionFilePath.c_str())) if (!loadedSessionFilePath.empty() && PathFileExists(loadedSessionFilePath.c_str()))
nppParam.writeSession(currentSession, loadedSessionFilePath.c_str()); nppParam.writeSession(currentSession, loadedSessionFilePath.c_str());
} }
// write settings on cloud if enabled, if the settings files don't exist // write settings on cloud if enabled, if the settings files don't exist
if (nppgui._cloudPath != TEXT("") && nppParam.isCloudPathChanged()) if (!nppgui._cloudPath.empty() && nppParam.isCloudPathChanged())
{ {
bool isOK = nppParam.writeSettingsFilesOnCloudForThe1stTime(nppgui._cloudPath); bool isOK = nppParam.writeSettingsFilesOnCloudForThe1stTime(nppgui._cloudPath);
if (!isOK) if (!isOK)
{ {
_nativeLangSpeaker.messageBox("SettingsOnCloudError", _nativeLangSpeaker.messageBox("SettingsOnCloudError",
hwnd, hwnd,
TEXT("It seems the path of settings on cloud is set on a read only drive,\ror on a folder needed privilege right for writing access.\rYour settings on cloud will be canceled. Please reset a coherent value via Preference dialog."), L"It seems the path of settings on cloud is set on a read only drive,\ror on a folder needed privilege right for writing access.\rYour settings on cloud will be canceled. Please reset a coherent value via Preference dialog.",
TEXT("Settings on Cloud"), L"Settings on Cloud",
MB_OK | MB_APPLMODAL); MB_OK | MB_APPLMODAL);
nppParam.removeCloudChoice(); nppParam.removeCloudChoice();
} }
@ -2789,7 +2789,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
if (!nppParam.isEndSessionCritical()) if (!nppParam.isEndSessionCritical())
{ {
generic_string updaterFullPath = nppParam.getWingupFullPath(); wstring updaterFullPath = nppParam.getWingupFullPath();
if (!updaterFullPath.empty()) if (!updaterFullPath.empty())
{ {
Process updater(updaterFullPath.c_str(), nppParam.getWingupParams().c_str(), nppParam.getWingupDir().c_str()); Process updater(updaterFullPath.c_str(), nppParam.getWingupParams().c_str(), nppParam.getWingupDir().c_str());
@ -2805,9 +2805,9 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
{ {
if (nppParam.isEndSessionStarted() && nppParam.doNppLogNulContentCorruptionIssue()) if (nppParam.isEndSessionStarted() && nppParam.doNppLogNulContentCorruptionIssue())
{ {
generic_string issueFn = nppLogNulContentCorruptionIssue; wstring issueFn = nppLogNulContentCorruptionIssue;
issueFn += TEXT(".log"); issueFn += L".log";
generic_string nppIssueLog = nppParam.getUserPath(); wstring nppIssueLog = nppParam.getUserPath();
pathAppend(nppIssueLog, issueFn); pathAppend(nppIssueLog, issueFn);
writeLog(nppIssueLog.c_str(), "WM_DESTROY (isEndSessionStarted == true)"); writeLog(nppIssueLog.c_str(), "WM_DESTROY (isEndSessionStarted == true)");
} }
@ -2839,7 +2839,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
{ {
HICON icon = nullptr; HICON icon = nullptr;
Notepad_plus_Window::loadTrayIcon(_pPublicInterface->getHinst(), &icon); Notepad_plus_Window::loadTrayIcon(_pPublicInterface->getHinst(), &icon);
_pTrayIco = new trayIconControler(hwnd, IDI_M30ICON, NPPM_INTERNAL_MINIMIZED_TRAY, icon, TEXT("")); _pTrayIco = new trayIconControler(hwnd, IDI_M30ICON, NPPM_INTERNAL_MINIMIZED_TRAY, icon, L"");
} }
_pTrayIco->doTrayIcon(ADD); _pTrayIco->doTrayIcon(ADD);
@ -2943,17 +2943,17 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case NPPM_DMMVIEWOTHERTAB: case NPPM_DMMVIEWOTHERTAB:
{ {
_dockingManager.showDockableDlg(reinterpret_cast<TCHAR *>(lParam), SW_SHOW); _dockingManager.showDockableDlg(reinterpret_cast<wchar_t *>(lParam), SW_SHOW);
return TRUE; return TRUE;
} }
case NPPM_DMMGETPLUGINHWNDBYNAME : //(const TCHAR *windowName, const TCHAR *moduleName) case NPPM_DMMGETPLUGINHWNDBYNAME : //(const wchar_t *windowName, const wchar_t *moduleName)
{ {
if (!lParam) if (!lParam)
return static_cast<LRESULT>(NULL); return static_cast<LRESULT>(NULL);
TCHAR *moduleName = reinterpret_cast<TCHAR *>(lParam); wchar_t *moduleName = reinterpret_cast<wchar_t *>(lParam);
TCHAR *windowName = reinterpret_cast<TCHAR *>(wParam); wchar_t *windowName = reinterpret_cast<wchar_t *>(wParam);
std::vector<DockingCont *> dockContainer = _dockingManager.getContainerInfo(); std::vector<DockingCont *> dockContainer = _dockingManager.getContainerInfo();
for (size_t i = 0, len = dockContainer.size(); i < len ; ++i) for (size_t i = 0, len = dockContainer.size(); i < len ; ++i)
@ -3011,14 +3011,14 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case NPPM_GETPLUGINSCONFIGDIR: case NPPM_GETPLUGINSCONFIGDIR:
{ {
generic_string userPluginConfDir = nppParam.getUserPluginConfDir(); wstring userPluginConfDir = nppParam.getUserPluginConfDir();
if (lParam != 0) if (lParam != 0)
{ {
if (userPluginConfDir.length() >= static_cast<size_t>(wParam)) if (userPluginConfDir.length() >= static_cast<size_t>(wParam))
{ {
return 0; return 0;
} }
lstrcpy(reinterpret_cast<TCHAR *>(lParam), userPluginConfDir.c_str()); lstrcpy(reinterpret_cast<wchar_t *>(lParam), userPluginConfDir.c_str());
// For the retro-compatibility // For the retro-compatibility
return TRUE; return TRUE;
@ -3028,14 +3028,14 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case NPPM_GETPLUGINHOMEPATH: case NPPM_GETPLUGINHOMEPATH:
{ {
generic_string pluginHomePath = nppParam.getPluginRootDir(); wstring pluginHomePath = nppParam.getPluginRootDir();
if (lParam != 0) if (lParam != 0)
{ {
if (pluginHomePath.length() >= static_cast<size_t>(wParam)) if (pluginHomePath.length() >= static_cast<size_t>(wParam))
{ {
return 0; return 0;
} }
lstrcpy(reinterpret_cast<TCHAR *>(lParam), pluginHomePath.c_str()); lstrcpy(reinterpret_cast<wchar_t *>(lParam), pluginHomePath.c_str());
} }
return pluginHomePath.length(); return pluginHomePath.length();
} }
@ -3043,14 +3043,14 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case NPPM_GETSETTINGSONCLOUDPATH: case NPPM_GETSETTINGSONCLOUDPATH:
{ {
const NppGUI & nppGUI = nppParam.getNppGUI(); const NppGUI & nppGUI = nppParam.getNppGUI();
generic_string settingsOnCloudPath = nppGUI._cloudPath; wstring settingsOnCloudPath = nppGUI._cloudPath;
if (lParam != 0) if (lParam != 0)
{ {
if (settingsOnCloudPath.length() >= static_cast<size_t>(wParam)) if (settingsOnCloudPath.length() >= static_cast<size_t>(wParam))
{ {
return 0; return 0;
} }
lstrcpy(reinterpret_cast<TCHAR *>(lParam), settingsOnCloudPath.c_str()); lstrcpy(reinterpret_cast<wchar_t *>(lParam), settingsOnCloudPath.c_str());
} }
return settingsOnCloudPath.length(); return settingsOnCloudPath.length();
} }
@ -3358,7 +3358,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
command(IDM_LANGSTYLE_CONFIG_DLG); command(IDM_LANGSTYLE_CONFIG_DLG);
// go into the section we need // go into the section we need
_configStyleDlg.goToSection(TEXT("Global Styles:EOL custom color")); _configStyleDlg.goToSection(L"Global Styles:EOL custom color");
return TRUE; return TRUE;
} }
@ -3369,7 +3369,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
command(IDM_LANGSTYLE_CONFIG_DLG); command(IDM_LANGSTYLE_CONFIG_DLG);
// go into the section we need // go into the section we need
generic_string npcStr = L"Global Styles:"; wstring npcStr = L"Global Styles:";
npcStr += g_npcStyleName; npcStr += g_npcStyleName;
_configStyleDlg.goToSection(npcStr.c_str()); _configStyleDlg.goToSection(npcStr.c_str());
@ -3389,7 +3389,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case NPPM_INTERNAL_DISABLEAUTOUPDATE: case NPPM_INTERNAL_DISABLEAUTOUPDATE:
{ {
//printStr(TEXT("you've got me")); //printStr(L"you've got me"));
NppGUI & nppGUI = nppParam.getNppGUI(); NppGUI & nppGUI = nppParam.getNppGUI();
nppGUI._autoUpdateOpt._doAutoUpdate = false; nppGUI._autoUpdateOpt._doAutoUpdate = false;
return TRUE; return TRUE;
@ -3397,7 +3397,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case NPPM_GETLANGUAGENAME: case NPPM_GETLANGUAGENAME:
{ {
generic_string langName = getLangDesc((LangType)wParam, true); wstring langName = getLangDesc((LangType)wParam, true);
if (lParam) if (lParam)
lstrcpy((LPTSTR)lParam, langName.c_str()); lstrcpy((LPTSTR)lParam, langName.c_str());
return langName.length(); return langName.length();
@ -3405,7 +3405,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case NPPM_GETLANGUAGEDESC: case NPPM_GETLANGUAGEDESC:
{ {
generic_string langDesc = getLangDesc((LangType)wParam, false); wstring langDesc = getLangDesc((LangType)wParam, false);
if (lParam) if (lParam)
lstrcpy((LPTSTR)lParam, langDesc.c_str()); lstrcpy((LPTSTR)lParam, langDesc.c_str());
return langDesc.length(); return langDesc.length();
@ -3413,7 +3413,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case NPPM_GETEXTERNALLEXERAUTOINDENTMODE: case NPPM_GETEXTERNALLEXERAUTOINDENTMODE:
{ {
int index = nppParam.getExternalLangIndexFromName(reinterpret_cast<TCHAR*>(wParam)); int index = nppParam.getExternalLangIndexFromName(reinterpret_cast<wchar_t*>(wParam));
if (index < 0) if (index < 0)
return FALSE; return FALSE;
@ -3423,7 +3423,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case NPPM_SETEXTERNALLEXERAUTOINDENTMODE: case NPPM_SETEXTERNALLEXERAUTOINDENTMODE:
{ {
int index = nppParam.getExternalLangIndexFromName(reinterpret_cast<TCHAR*>(wParam)); int index = nppParam.getExternalLangIndexFromName(reinterpret_cast<wchar_t*>(wParam));
if (index < 0) if (index < 0)
return FALSE; return FALSE;
@ -3533,7 +3533,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
// if doLocal - not allowed. Otherwise - allowed. // if doLocal - not allowed. Otherwise - allowed.
case NPPM_GETAPPDATAPLUGINSALLOWED: case NPPM_GETAPPDATAPLUGINSALLOWED:
{ {
const TCHAR *appDataNpp = nppParam.getAppDataNppDir(); const wchar_t *appDataNpp = nppParam.getAppDataNppDir();
if (appDataNpp[0]) // if not doLocal if (appDataNpp[0]) // if not doLocal
{ {
return TRUE; return TRUE;
@ -3564,7 +3564,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
ScintillaViewParams &svp = const_cast<ScintillaViewParams &>(nppParam.getSVP()); ScintillaViewParams &svp = const_cast<ScintillaViewParams &>(nppParam.getSVP());
COLORREF multiEdgeColor = liteGrey; COLORREF multiEdgeColor = liteGrey;
const Style * pStyle = NppParameters::getInstance().getMiscStylerArray().findByName(TEXT("Edge colour")); const Style * pStyle = NppParameters::getInstance().getMiscStylerArray().findByName(L"Edge colour");
if (pStyle) if (pStyle)
{ {
multiEdgeColor = pStyle->_fgColor; multiEdgeColor = pStyle->_fgColor;
@ -3722,7 +3722,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case NPPM_INTERNAL_REFRESHWORKDIR: case NPPM_INTERNAL_REFRESHWORKDIR:
{ {
const Buffer* buf = _pEditView->getCurrentBuffer(); const Buffer* buf = _pEditView->getCurrentBuffer();
generic_string path = buf ? buf->getFullPathName() : _T(""); wstring path = buf ? buf->getFullPathName() : L"";
PathRemoveFileSpec(path); PathRemoveFileSpec(path);
setWorkingDir(path.c_str()); setWorkingDir(path.c_str());
return TRUE; return TRUE;

File diff suppressed because it is too large Load Diff

View File

@ -43,13 +43,13 @@ enum DIALOG_TYPE {FIND_DLG, REPLACE_DLG, FINDINFILES_DLG, FINDINPROJECTS_DLG, MA
enum InWhat{ALL_OPEN_DOCS, FILES_IN_DIR, CURRENT_DOC, CURR_DOC_SELECTION, FILES_IN_PROJECTS}; enum InWhat{ALL_OPEN_DOCS, FILES_IN_DIR, CURRENT_DOC, CURR_DOC_SELECTION, FILES_IN_PROJECTS};
struct FoundInfo { struct FoundInfo {
FoundInfo(intptr_t start, intptr_t end, size_t lineNumber, const TCHAR *fullPath) FoundInfo(intptr_t start, intptr_t end, size_t lineNumber, const wchar_t *fullPath)
: _lineNumber(lineNumber), _fullPath(fullPath) { : _lineNumber(lineNumber), _fullPath(fullPath) {
_ranges.push_back(std::pair<intptr_t, intptr_t>(start, end)); _ranges.push_back(std::pair<intptr_t, intptr_t>(start, end));
}; };
std::vector<std::pair<intptr_t, intptr_t>> _ranges; std::vector<std::pair<intptr_t, intptr_t>> _ranges;
size_t _lineNumber = 0; size_t _lineNumber = 0;
generic_string _fullPath; std::wstring _fullPath;
}; };
struct TargetRange { struct TargetRange {
@ -72,10 +72,10 @@ struct FindOption
bool _doPurge = false; bool _doPurge = false;
bool _doMarkLine = false; bool _doMarkLine = false;
bool _isInSelection = false; bool _isInSelection = false;
generic_string _str2Search; std::wstring _str2Search;
generic_string _str4Replace; std::wstring _str4Replace;
generic_string _filters; std::wstring _filters;
generic_string _directory; std::wstring _directory;
bool _isRecursive = true; bool _isRecursive = true;
bool _isInHiddenDir = false; bool _isInHiddenDir = false;
bool _isProjectPanel_1 = false; bool _isProjectPanel_1 = false;
@ -88,7 +88,7 @@ struct FindOption
//This class contains generic search functions as static functions for easy access //This class contains generic search functions as static functions for easy access
class Searching { class Searching {
public: public:
static int convertExtendedToString(const TCHAR * query, TCHAR * result, int length); static int convertExtendedToString(const wchar_t * query, wchar_t * result, int length);
static TargetRange t; static TargetRange t;
static int buildSearchFlags(const FindOption * option) { static int buildSearchFlags(const FindOption * option) {
return (option->_isWholeWord ? SCFIND_WHOLEWORD : 0) | return (option->_isWholeWord ? SCFIND_WHOLEWORD : 0) |
@ -99,7 +99,7 @@ public:
static void displaySectionCentered(size_t posStart, size_t posEnd, ScintillaEditView * pEditView, bool isDownwards = true); static void displaySectionCentered(size_t posStart, size_t posEnd, ScintillaEditView * pEditView, bool isDownwards = true);
private: private:
static bool readBase(const TCHAR * str, int * value, int base, int size); static bool readBase(const wchar_t * str, int * value, int base, int size);
}; };
@ -121,11 +121,11 @@ public:
_ppEditView = ppEditView; _ppEditView = ppEditView;
}; };
void addSearchLine(const TCHAR *searchName); void addSearchLine(const wchar_t *searchName);
void addFileNameTitle(const TCHAR * fileName); void addFileNameTitle(const wchar_t * fileName);
void addFileHitCount(int count); void addFileHitCount(int count);
void addSearchResultInfo(int count, int countSearched, bool searchedEntireNotSelection, const FindOption *pFindOpt); void addSearchResultInfo(int count, int countSearched, bool searchedEntireNotSelection, const FindOption *pFindOpt);
const char* foundLine(FoundInfo fi, SearchResultMarkingLine mi, const TCHAR* foundline, size_t totalLineNumber); const char* foundLine(FoundInfo fi, SearchResultMarkingLine mi, const wchar_t* foundline, size_t totalLineNumber);
void setFinderStyle(); void setFinderStyle();
void setFinderStyleForNpc(bool onlyColor = false); void setFinderStyleForNpc(bool onlyColor = false);
void removeAll(); void removeAll();
@ -140,10 +140,10 @@ public:
void gotoNextFoundResult(int direction); void gotoNextFoundResult(int direction);
std::pair<intptr_t, intptr_t> gotoFoundLine(size_t nOccurrence = 0); // value 0 means this argument is not used std::pair<intptr_t, intptr_t> gotoFoundLine(size_t nOccurrence = 0); // value 0 means this argument is not used
void deleteResult(); void deleteResult();
std::vector<generic_string> getResultFilePaths() const; std::vector<std::wstring> getResultFilePaths() const;
bool canFind(const TCHAR *fileName, size_t lineNumber, size_t* indexToStartFrom) const; bool canFind(const wchar_t *fileName, size_t lineNumber, size_t* indexToStartFrom) const;
void setVolatiled(bool val) { _canBeVolatiled = val; }; void setVolatiled(bool val) { _canBeVolatiled = val; };
generic_string getHitsString(int count) const; std::wstring getHitsString(int count) const;
LRESULT scintillaExecute(UINT msg, WPARAM wParam = 0, LPARAM lParam = 0) const { LRESULT scintillaExecute(UINT msg, WPARAM wParam = 0, LPARAM lParam = 0) const {
return _scintView.execute(msg, wParam, lParam); return _scintView.execute(msg, wParam, lParam);
@ -182,14 +182,14 @@ private:
bool _longLinesAreWrapped = false; bool _longLinesAreWrapped = false;
bool _purgeBeforeEverySearch = false; bool _purgeBeforeEverySearch = false;
generic_string _prefixLineStr; std::wstring _prefixLineStr;
void setFinderReadOnly(bool isReadOnly) { void setFinderReadOnly(bool isReadOnly) {
_scintView.execute(SCI_SETREADONLY, isReadOnly); _scintView.execute(SCI_SETREADONLY, isReadOnly);
}; };
bool isLineActualSearchResult(const generic_string & s) const; bool isLineActualSearchResult(const std::wstring & s) const;
generic_string & prepareStringForClipboard(generic_string & s) const; std::wstring & prepareStringForClipboard(std::wstring & s) const;
static FoundInfo EmptyFoundInfo; static FoundInfo EmptyFoundInfo;
static SearchResultMarkingLine EmptySearchResultMarking; static SearchResultMarkingLine EmptySearchResultMarking;
@ -209,8 +209,8 @@ enum FindNextType {
struct FindReplaceInfo struct FindReplaceInfo
{ {
const TCHAR *_txt2find = nullptr; const wchar_t *_txt2find = nullptr;
const TCHAR *_txt2replace = nullptr; const wchar_t *_txt2replace = nullptr;
intptr_t _startRange = -1; intptr_t _startRange = -1;
intptr_t _endRange = -1; intptr_t _endRange = -1;
}; };
@ -219,7 +219,7 @@ struct FindersInfo
{ {
Finder *_pSourceFinder = nullptr; Finder *_pSourceFinder = nullptr;
Finder *_pDestFinder = nullptr; Finder *_pDestFinder = nullptr;
const TCHAR *_pFileName = nullptr; const wchar_t *_pFileName = nullptr;
FindOption _findOption; FindOption _findOption;
}; };
@ -272,10 +272,10 @@ public :
void initOptionsFromDlg(); void initOptionsFromDlg();
void doDialog(DIALOG_TYPE whichType, bool isRTL = false, bool toShow = true); void doDialog(DIALOG_TYPE whichType, bool isRTL = false, bool toShow = true);
bool processFindNext(const TCHAR *txt2find, const FindOption *options = NULL, FindStatus *oFindStatus = NULL, FindNextType findNextType = FINDNEXTTYPE_FINDNEXT); bool processFindNext(const wchar_t *txt2find, const FindOption *options = NULL, FindStatus *oFindStatus = NULL, FindNextType findNextType = FINDNEXTTYPE_FINDNEXT);
bool processReplace(const TCHAR *txt2find, const TCHAR *txt2replace, const FindOption *options = NULL); bool processReplace(const wchar_t *txt2find, const wchar_t *txt2replace, const FindOption *options = NULL);
int markAll(const TCHAR *txt2find, int styleID); int markAll(const wchar_t *txt2find, int styleID);
int markAllInc(const FindOption *opt); int markAllInc(const FindOption *opt);
@ -284,7 +284,7 @@ public :
void replaceAllInOpenedDocs(); void replaceAllInOpenedDocs();
void findAllIn(InWhat op); void findAllIn(InWhat op);
void setSearchText(TCHAR * txt2find); void setSearchText(wchar_t * txt2find);
void gotoNextFoundResult(int direction = 0) const { void gotoNextFoundResult(int direction = 0) const {
if (_pFinder) _pFinder->gotoNextFoundResult(direction); if (_pFinder) _pFinder->gotoNextFoundResult(direction);
@ -293,10 +293,10 @@ public :
void putFindResult(int result) { void putFindResult(int result) {
_findAllResult = result; _findAllResult = result;
}; };
const TCHAR * getDir2Search() const {return _env->_directory.c_str();}; const wchar_t * getDir2Search() const {return _env->_directory.c_str();};
void getPatterns(std::vector<generic_string> & patternVect); void getPatterns(std::vector<std::wstring> & patternVect);
void getAndValidatePatterns(std::vector<generic_string> & patternVect); void getAndValidatePatterns(std::vector<std::wstring> & patternVect);
void launchFindInFilesDlg() { void launchFindInFilesDlg() {
doDialog(FINDINFILES_DLG); doDialog(FINDINFILES_DLG);
@ -306,16 +306,16 @@ public :
doDialog(FINDINPROJECTS_DLG); doDialog(FINDINPROJECTS_DLG);
}; };
void setFindInFilesDirFilter(const TCHAR *dir, const TCHAR *filters); void setFindInFilesDirFilter(const wchar_t *dir, const wchar_t *filters);
void setProjectCheckmarks(FindHistory *findHistory, int Msk); void setProjectCheckmarks(FindHistory *findHistory, int Msk);
void enableProjectCheckmarks(); void enableProjectCheckmarks();
generic_string getText2search() const { std::wstring getText2search() const {
return _env->_str2Search; return _env->_str2Search;
}; };
const generic_string & getFilters() const {return _env->_filters;}; const std::wstring & getFilters() const {return _env->_filters;};
const generic_string & getDirectory() const {return _env->_directory;}; const std::wstring & getDirectory() const {return _env->_directory;};
const FindOption & getCurrentOptions() const {return *_env;}; const FindOption & getCurrentOptions() const {return *_env;};
bool isRecursive() const { return _env->_isRecursive; }; bool isRecursive() const { return _env->_isRecursive; };
bool isInHiddenDir() const { return _env->_isInHiddenDir; }; bool isInHiddenDir() const { return _env->_isInHiddenDir; };
@ -323,13 +323,13 @@ public :
bool isProjectPanel_2() const { return _env->_isProjectPanel_2; }; bool isProjectPanel_2() const { return _env->_isProjectPanel_2; };
bool isProjectPanel_3() const { return _env->_isProjectPanel_3; }; bool isProjectPanel_3() const { return _env->_isProjectPanel_3; };
void saveFindHistory(); void saveFindHistory();
void changeTabName(DIALOG_TYPE index, const TCHAR *name2change) { void changeTabName(DIALOG_TYPE index, const wchar_t *name2change) {
TCITEM tie{}; TCITEM tie{};
tie.mask = TCIF_TEXT; tie.mask = TCIF_TEXT;
tie.pszText = (TCHAR *)name2change; tie.pszText = (wchar_t *)name2change;
TabCtrl_SetItem(_tab.getHSelf(), index, &tie); TabCtrl_SetItem(_tab.getHSelf(), index, &tie);
TCHAR label[MAX_PATH]{}; wchar_t label[MAX_PATH]{};
_tab.getCurrentTitle(label, MAX_PATH); _tab.getCurrentTitle(label, MAX_PATH);
::SetWindowText(_hSelf, label); ::SetWindowText(_hSelf, label);
} }
@ -389,11 +389,11 @@ public :
} }
}; };
void execSavedCommand(int cmd, uptr_t intValue, const generic_string& stringValue); void execSavedCommand(int cmd, uptr_t intValue, const std::wstring& stringValue);
void clearMarks(const FindOption& opt); void clearMarks(const FindOption& opt);
void setStatusbarMessage(const std::wstring & msg, FindStatus staus, std::wstring tooltipMsg = L""); void setStatusbarMessage(const std::wstring & msg, FindStatus staus, std::wstring tooltipMsg = L"");
void setStatusbarMessageWithRegExprErr(ScintillaEditView* pEditView); void setStatusbarMessageWithRegExprErr(ScintillaEditView* pEditView);
generic_string getScopeInfoForStatusBar(FindOption const *pFindOpt) const; std::wstring getScopeInfoForStatusBar(FindOption const *pFindOpt) const;
Finder * createFinder(); Finder * createFinder();
bool removeFinder(Finder *finder2remove); bool removeFinder(Finder *finder2remove);
DIALOG_TYPE getCurrentStatus() {return _currentStatus;}; DIALOG_TYPE getCurrentStatus() {return _currentStatus;};
@ -424,7 +424,7 @@ private:
ScintillaEditView** _ppEditView = nullptr; ScintillaEditView** _ppEditView = nullptr;
Finder *_pFinder = nullptr; Finder *_pFinder = nullptr;
generic_string _findResTitle; std::wstring _findResTitle;
std::vector<Finder*> _findersOfFinder{}; std::vector<Finder*> _findersOfFinder{};
@ -435,7 +435,7 @@ private:
bool _isRTL = false; bool _isRTL = false;
int _findAllResult = 0; int _findAllResult = 0;
TCHAR _findAllResultStr[1024] = {'\0'}; wchar_t _findAllResultStr[1024] = {'\0'};
int _fileNameLenMax = 1024; int _fileNameLenMax = 1024;
char *_uniFileName = nullptr; char *_uniFileName = nullptr;
@ -445,7 +445,7 @@ private:
StatusBar _statusBar; StatusBar _statusBar;
FindStatus _statusbarFindStatus; FindStatus _statusbarFindStatus;
generic_string _statusbarTooltipMsg; std::wstring _statusbarTooltipMsg;
HWND _statusbarTooltipWnd = nullptr; HWND _statusbarTooltipWnd = nullptr;
HICON _statusbarTooltipIcon = nullptr; HICON _statusbarTooltipIcon = nullptr;
int _statusbarTooltipIconSize = 0; int _statusbarTooltipIconSize = 0;
@ -491,8 +491,8 @@ private:
void updateCombos(); void updateCombos();
void updateCombo(int comboID); void updateCombo(int comboID);
void fillFindHistory(); void fillFindHistory();
void fillComboHistory(int id, const std::vector<generic_string> & strings); void fillComboHistory(int id, const std::vector<std::wstring> & strings);
int saveComboHistory(int id, int maxcount, std::vector<generic_string> & strings, bool saveEmpty); int saveComboHistory(int id, int maxcount, std::vector<std::wstring> & strings, bool saveEmpty);
static const int FR_OP_FIND = 1; static const int FR_OP_FIND = 1;
static const int FR_OP_REPLACE = 2; static const int FR_OP_REPLACE = 2;
static const int FR_OP_FIF = 4; static const int FR_OP_FIF = 4;
@ -500,7 +500,7 @@ private:
static const int FR_OP_FIP = 16; static const int FR_OP_FIP = 16;
void saveInMacro(size_t cmd, int cmdType); void saveInMacro(size_t cmd, int cmdType);
void drawItem(LPDRAWITEMSTRUCT lpDrawItemStruct); void drawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
bool replaceInFilesConfirmCheck(generic_string directory, generic_string fileTypes); bool replaceInFilesConfirmCheck(std::wstring directory, std::wstring fileTypes);
bool replaceInProjectsConfirmCheck(); bool replaceInProjectsConfirmCheck();
bool replaceInOpenDocsConfirmCheck(void); bool replaceInOpenDocsConfirmCheck(void);
@ -523,7 +523,7 @@ public :
void destroy() override; void destroy() override;
void display(bool toShow = true) const override; void display(bool toShow = true) const override;
void setSearchText(const TCHAR* txt2find, bool) { void setSearchText(const wchar_t* txt2find, bool) {
::SendDlgItemMessage(_hSelf, IDC_INCFINDTEXT, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(txt2find)); ::SendDlgItemMessage(_hSelf, IDC_INCFINDTEXT, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(txt2find));
}; };
@ -557,7 +557,7 @@ public:
Progress(const Progress&) = delete; Progress(const Progress&) = delete;
const Progress& operator=(const Progress&) = delete; const Progress& operator=(const Progress&) = delete;
HWND open(HWND hCallerWnd, const TCHAR* header = NULL); HWND open(HWND hCallerWnd, const wchar_t* header = NULL);
void close(); void close();
bool isCancelled() const bool isCancelled() const
@ -567,12 +567,12 @@ public:
return false; return false;
} }
void setPercent(unsigned percent, const TCHAR* fileName, int nbHitsSoFar) const; void setPercent(unsigned percent, const wchar_t* fileName, int nbHitsSoFar) const;
void setInfo(const TCHAR* info, int nbHitsSoFar = -1) const; void setInfo(const wchar_t* info, int nbHitsSoFar = -1) const;
private: private:
static const TCHAR cClassName[]; static const wchar_t cClassName[];
static const TCHAR cDefaultHeader[]; static const wchar_t cDefaultHeader[];
static const int cBackgroundColor; static const int cBackgroundColor;
static const SIZE _szClient; static const SIZE _szClient;
@ -591,7 +591,7 @@ private:
HINSTANCE _hInst = nullptr; HINSTANCE _hInst = nullptr;
volatile HWND _hwnd = nullptr; volatile HWND _hwnd = nullptr;
HWND _hCallerWnd = nullptr; HWND _hCallerWnd = nullptr;
TCHAR _header[128] = {'\0'}; wchar_t _header[128] = {'\0'};
HANDLE _hThread = nullptr; HANDLE _hThread = nullptr;
HANDLE _hActiveState = nullptr; HANDLE _hActiveState = nullptr;
HWND _hPathText = nullptr; HWND _hPathText = nullptr;

View File

@ -69,99 +69,99 @@ LanguageNameInfo ScintillaEditView::_langNameInfoArray[L_EXTERNAL + 1] = {
// //
// _langName _shortName _longName _langID _lexerID // _langName _shortName _longName _langID _lexerID
// //
{TEXT("normal"), TEXT("Normal text"), TEXT("Normal text file"), L_TEXT, "null"}, {L"normal", L"Normal text", L"Normal text file", L_TEXT, "null"},
{TEXT("php"), TEXT("PHP"), TEXT("PHP Hypertext Preprocessor file"), L_PHP, "phpscript"}, {L"php", L"PHP", L"PHP Hypertext Preprocessor file", L_PHP, "phpscript"},
{TEXT("c"), TEXT("C"), TEXT("C source file"), L_C, "cpp"}, {L"c", L"C", L"C source file", L_C, "cpp"},
{TEXT("cpp"), TEXT("C++"), TEXT("C++ source file"), L_CPP, "cpp"}, {L"cpp", L"C++", L"C++ source file", L_CPP, "cpp"},
{TEXT("cs"), TEXT("C#"), TEXT("C# source file"), L_CS, "cpp"}, {L"cs", L"C#", L"C# source file", L_CS, "cpp"},
{TEXT("objc"), TEXT("Objective-C"), TEXT("Objective-C source file"), L_OBJC, "objc"}, {L"objc", L"Objective-C", L"Objective-C source file", L_OBJC, "objc"},
{TEXT("java"), TEXT("Java"), TEXT("Java source file"), L_JAVA, "cpp"}, {L"java", L"Java", L"Java source file", L_JAVA, "cpp"},
{TEXT("rc"), TEXT("RC"), TEXT("Windows Resource file"), L_RC, "cpp"}, {L"rc", L"RC", L"Windows Resource file", L_RC, "cpp"},
{TEXT("html"), TEXT("HTML"), TEXT("Hyper Text Markup Language file"), L_HTML, "hypertext"}, {L"html", L"HTML", L"Hyper Text Markup Language file", L_HTML, "hypertext"},
{TEXT("xml"), TEXT("XML"), TEXT("eXtensible Markup Language file"), L_XML, "xml"}, {L"xml", L"XML", L"eXtensible Markup Language file", L_XML, "xml"},
{TEXT("makefile"), TEXT("Makefile"), TEXT("Makefile"), L_MAKEFILE, "makefile"}, {L"makefile", L"Makefile", L"Makefile", L_MAKEFILE, "makefile"},
{TEXT("pascal"), TEXT("Pascal"), TEXT("Pascal source file"), L_PASCAL, "pascal"}, {L"pascal", L"Pascal", L"Pascal source file", L_PASCAL, "pascal"},
{TEXT("batch"), TEXT("Batch"), TEXT("Batch file"), L_BATCH, "batch"}, {L"batch", L"Batch", L"Batch file", L_BATCH, "batch"},
{TEXT("ini"), TEXT("ini"), TEXT("MS ini file"), L_INI, "props"}, {L"ini", L"ini", L"MS ini file", L_INI, "props"},
{TEXT("nfo"), TEXT("NFO"), TEXT("MSDOS Style/ASCII Art"), L_ASCII, "null"}, {L"nfo", L"NFO", L"MSDOS Style/ASCII Art", L_ASCII, "null"},
{TEXT("udf"), TEXT("udf"), TEXT("User Defined language file"), L_USER, "user"}, {L"udf", L"udf", L"User Defined language file", L_USER, "user"},
{TEXT("asp"), TEXT("ASP"), TEXT("Active Server Pages script file"), L_ASP, "hypertext"}, {L"asp", L"ASP", L"Active Server Pages script file", L_ASP, "hypertext"},
{TEXT("sql"), TEXT("SQL"), TEXT("Structured Query Language file"), L_SQL, "sql"}, {L"sql", L"SQL", L"Structured Query Language file", L_SQL, "sql"},
{TEXT("vb"), TEXT("Visual Basic"), TEXT("Visual Basic file"), L_VB, "vb"}, {L"vb", L"Visual Basic", L"Visual Basic file", L_VB, "vb"},
{TEXT("javascript"), TEXT("JavaScript"), TEXT("JavaScript file"), L_JS, "cpp"}, {L"javascript", L"JavaScript", L"JavaScript file", L_JS, "cpp"},
{TEXT("css"), TEXT("CSS"), TEXT("Cascade Style Sheets File"), L_CSS, "css"}, {L"css", L"CSS", L"Cascade Style Sheets File", L_CSS, "css"},
{TEXT("perl"), TEXT("Perl"), TEXT("Perl source file"), L_PERL, "perl"}, {L"perl", L"Perl", L"Perl source file", L_PERL, "perl"},
{TEXT("python"), TEXT("Python"), TEXT("Python file"), L_PYTHON, "python"}, {L"python", L"Python", L"Python file", L_PYTHON, "python"},
{TEXT("lua"), TEXT("Lua"), TEXT("Lua source File"), L_LUA, "lua"}, {L"lua", L"Lua", L"Lua source File", L_LUA, "lua"},
{TEXT("tex"), TEXT("TeX"), TEXT("TeX file"), L_TEX, "tex"}, {L"tex", L"TeX", L"TeX file", L_TEX, "tex"},
{TEXT("fortran"), TEXT("Fortran free form"), TEXT("Fortran free form source file"), L_FORTRAN, "fortran"}, {L"fortran", L"Fortran free form", L"Fortran free form source file", L_FORTRAN, "fortran"},
{TEXT("bash"), TEXT("Shell"), TEXT("Unix script file"), L_BASH, "bash"}, {L"bash", L"Shell", L"Unix script file", L_BASH, "bash"},
{TEXT("actionscript"), TEXT("ActionScript"), TEXT("Flash ActionScript file"), L_FLASH, "cpp"}, {L"actionscript", L"ActionScript", L"Flash ActionScript file", L_FLASH, "cpp"},
{TEXT("nsis"), TEXT("NSIS"), TEXT("Nullsoft Scriptable Install System script file"), L_NSIS, "nsis"}, {L"nsis", L"NSIS", L"Nullsoft Scriptable Install System script file", L_NSIS, "nsis"},
{TEXT("tcl"), TEXT("TCL"), TEXT("Tool Command Language file"), L_TCL, "tcl"}, {L"tcl", L"TCL", L"Tool Command Language file", L_TCL, "tcl"},
{TEXT("lisp"), TEXT("Lisp"), TEXT("List Processing language file"), L_LISP, "lisp"}, {L"lisp", L"Lisp", L"List Processing language file", L_LISP, "lisp"},
{TEXT("scheme"), TEXT("Scheme"), TEXT("Scheme file"), L_SCHEME, "lisp"}, {L"scheme", L"Scheme", L"Scheme file", L_SCHEME, "lisp"},
{TEXT("asm"), TEXT("Assembly"), TEXT("Assembly language source file"), L_ASM, "asm"}, {L"asm", L"Assembly", L"Assembly language source file", L_ASM, "asm"},
{TEXT("diff"), TEXT("Diff"), TEXT("Diff file"), L_DIFF, "diff"}, {L"diff", L"Diff", L"Diff file", L_DIFF, "diff"},
{TEXT("props"), TEXT("Properties file"), TEXT("Properties file"), L_PROPS, "props"}, {L"props", L"Properties file", L"Properties file", L_PROPS, "props"},
{TEXT("postscript"), TEXT("PostScript"), TEXT("PostScript file"), L_PS, "ps"}, {L"postscript", L"PostScript", L"PostScript file", L_PS, "ps"},
{TEXT("ruby"), TEXT("Ruby"), TEXT("Ruby file"), L_RUBY, "ruby"}, {L"ruby", L"Ruby", L"Ruby file", L_RUBY, "ruby"},
{TEXT("smalltalk"), TEXT("Smalltalk"), TEXT("Smalltalk file"), L_SMALLTALK, "smalltalk"}, {L"smalltalk", L"Smalltalk", L"Smalltalk file", L_SMALLTALK, "smalltalk"},
{TEXT("vhdl"), TEXT("VHDL"), TEXT("VHSIC Hardware Description Language file"), L_VHDL, "vhdl"}, {L"vhdl", L"VHDL", L"VHSIC Hardware Description Language file", L_VHDL, "vhdl"},
{TEXT("kix"), TEXT("KiXtart"), TEXT("KiXtart file"), L_KIX, "kix"}, {L"kix", L"KiXtart", L"KiXtart file", L_KIX, "kix"},
{TEXT("autoit"), TEXT("AutoIt"), TEXT("AutoIt"), L_AU3, "au3"}, {L"autoit", L"AutoIt", L"AutoIt", L_AU3, "au3"},
{TEXT("caml"), TEXT("CAML"), TEXT("Categorical Abstract Machine Language"), L_CAML, "caml"}, {L"caml", L"CAML", L"Categorical Abstract Machine Language", L_CAML, "caml"},
{TEXT("ada"), TEXT("Ada"), TEXT("Ada file"), L_ADA, "ada"}, {L"ada", L"Ada", L"Ada file", L_ADA, "ada"},
{TEXT("verilog"), TEXT("Verilog"), TEXT("Verilog file"), L_VERILOG, "verilog"}, {L"verilog", L"Verilog", L"Verilog file", L_VERILOG, "verilog"},
{TEXT("matlab"), TEXT("MATLAB"), TEXT("MATrix LABoratory"), L_MATLAB, "matlab"}, {L"matlab", L"MATLAB", L"MATrix LABoratory", L_MATLAB, "matlab"},
{TEXT("haskell"), TEXT("Haskell"), TEXT("Haskell"), L_HASKELL, "haskell"}, {L"haskell", L"Haskell", L"Haskell", L_HASKELL, "haskell"},
{TEXT("inno"), TEXT("Inno Setup"), TEXT("Inno Setup script"), L_INNO, "inno"}, {L"inno", L"Inno Setup", L"Inno Setup script", L_INNO, "inno"},
{TEXT("searchResult"), TEXT("Internal Search"), TEXT("Internal Search"), L_SEARCHRESULT, "searchResult"}, {L"searchResult", L"Internal Search", L"Internal Search", L_SEARCHRESULT, "searchResult"},
{TEXT("cmake"), TEXT("CMake"), TEXT("CMake file"), L_CMAKE, "cmake"}, {L"cmake", L"CMake", L"CMake file", L_CMAKE, "cmake"},
{TEXT("yaml"), TEXT("YAML"), TEXT("YAML Ain't Markup Language"), L_YAML, "yaml"}, {L"yaml", L"YAML", L"YAML Ain't Markup Language", L_YAML, "yaml"},
{TEXT("cobol"), TEXT("COBOL"), TEXT("COmmon Business Oriented Language"), L_COBOL, "COBOL"}, {L"cobol", L"COBOL", L"COmmon Business Oriented Language", L_COBOL, "COBOL"},
{TEXT("gui4cli"), TEXT("Gui4Cli"), TEXT("Gui4Cli file"), L_GUI4CLI, "gui4cli"}, {L"gui4cli", L"Gui4Cli", L"Gui4Cli file", L_GUI4CLI, "gui4cli"},
{TEXT("d"), TEXT("D"), TEXT("D programming language"), L_D, "d"}, {L"d", L"D", L"D programming language", L_D, "d"},
{TEXT("powershell"), TEXT("PowerShell"), TEXT("Windows PowerShell"), L_POWERSHELL, "powershell"}, {L"powershell", L"PowerShell", L"Windows PowerShell", L_POWERSHELL, "powershell"},
{TEXT("r"), TEXT("R"), TEXT("R programming language"), L_R, "r"}, {L"r", L"R", L"R programming language", L_R, "r"},
{TEXT("jsp"), TEXT("JSP"), TEXT("JavaServer Pages script file"), L_JSP, "hypertext"}, {L"jsp", L"JSP", L"JavaServer Pages script file", L_JSP, "hypertext"},
{TEXT("coffeescript"), TEXT("CoffeeScript"), TEXT("CoffeeScript file"), L_COFFEESCRIPT, "coffeescript"}, {L"coffeescript", L"CoffeeScript", L"CoffeeScript file", L_COFFEESCRIPT, "coffeescript"},
{TEXT("json"), TEXT("json"), TEXT("JSON file"), L_JSON, "json"}, {L"json", L"json", L"JSON file", L_JSON, "json"},
{TEXT("javascript.js"), TEXT("JavaScript"), TEXT("JavaScript file"), L_JAVASCRIPT, "cpp"}, {L"javascript.js", L"JavaScript", L"JavaScript file", L_JAVASCRIPT, "cpp"},
{TEXT("fortran77"), TEXT("Fortran fixed form"), TEXT("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"},
{TEXT("baanc"), TEXT("BaanC"), TEXT("BaanC File"), L_BAANC, "baan"}, {L"baanc", L"BaanC", L"BaanC File", L_BAANC, "baan"},
{TEXT("srec"), TEXT("S-Record"), TEXT("Motorola S-Record binary data"), L_SREC, "srec"}, {L"srec", L"S-Record", L"Motorola S-Record binary data", L_SREC, "srec"},
{TEXT("ihex"), TEXT("Intel HEX"), TEXT("Intel HEX binary data"), L_IHEX, "ihex"}, {L"ihex", L"Intel HEX", L"Intel HEX binary data", L_IHEX, "ihex"},
{TEXT("tehex"), TEXT("Tektronix extended HEX"), TEXT("Tektronix extended HEX binary data"), L_TEHEX, "tehex"}, {L"tehex", L"Tektronix extended HEX", L"Tektronix extended HEX binary data", L_TEHEX, "tehex"},
{TEXT("swift"), TEXT("Swift"), TEXT("Swift file"), L_SWIFT, "cpp"}, {L"swift", L"Swift", L"Swift file", L_SWIFT, "cpp"},
{TEXT("asn1"), TEXT("ASN.1"), TEXT("Abstract Syntax Notation One file"), L_ASN1, "asn1"}, {L"asn1", L"ASN.1", L"Abstract Syntax Notation One file", L_ASN1, "asn1"},
{TEXT("avs"), TEXT("AviSynth"), TEXT("AviSynth scripts files"), L_AVS, "avs"}, {L"avs", L"AviSynth", L"AviSynth scripts files", L_AVS, "avs"},
{TEXT("blitzbasic"), TEXT("BlitzBasic"), TEXT("BlitzBasic file"), L_BLITZBASIC, "blitzbasic"}, {L"blitzbasic", L"BlitzBasic", L"BlitzBasic file", L_BLITZBASIC, "blitzbasic"},
{TEXT("purebasic"), TEXT("PureBasic"), TEXT("PureBasic file"), L_PUREBASIC, "purebasic"}, {L"purebasic", L"PureBasic", L"PureBasic file", L_PUREBASIC, "purebasic"},
{TEXT("freebasic"), TEXT("FreeBasic"), TEXT("FreeBasic file"), L_FREEBASIC, "freebasic"}, {L"freebasic", L"FreeBasic", L"FreeBasic file", L_FREEBASIC, "freebasic"},
{TEXT("csound"), TEXT("Csound"), TEXT("Csound file"), L_CSOUND, "csound"}, {L"csound", L"Csound", L"Csound file", L_CSOUND, "csound"},
{TEXT("erlang"), TEXT("Erlang"), TEXT("Erlang file"), L_ERLANG, "erlang"}, {L"erlang", L"Erlang", L"Erlang file", L_ERLANG, "erlang"},
{TEXT("escript"), TEXT("ESCRIPT"), TEXT("ESCRIPT file"), L_ESCRIPT, "escript"}, {L"escript", L"ESCRIPT", L"ESCRIPT file", L_ESCRIPT, "escript"},
{TEXT("forth"), TEXT("Forth"), TEXT("Forth file"), L_FORTH, "forth"}, {L"forth", L"Forth", L"Forth file", L_FORTH, "forth"},
{TEXT("latex"), TEXT("LaTeX"), TEXT("LaTeX file"), L_LATEX, "latex"}, {L"latex", L"LaTeX", L"LaTeX file", L_LATEX, "latex"},
{TEXT("mmixal"), TEXT("MMIXAL"), TEXT("MMIXAL file"), L_MMIXAL, "mmixal"}, {L"mmixal", L"MMIXAL", L"MMIXAL file", L_MMIXAL, "mmixal"},
{TEXT("nim"), TEXT("Nim"), TEXT("Nim file"), L_NIM, "nimrod"}, {L"nim", L"Nim", L"Nim file", L_NIM, "nimrod"},
{TEXT("nncrontab"), TEXT("Nncrontab"), TEXT("extended crontab file"), L_NNCRONTAB, "nncrontab"}, {L"nncrontab", L"Nncrontab", L"extended crontab file", L_NNCRONTAB, "nncrontab"},
{TEXT("oscript"), TEXT("OScript"), TEXT("OScript source file"), L_OSCRIPT, "oscript"}, {L"oscript", L"OScript", L"OScript source file", L_OSCRIPT, "oscript"},
{TEXT("rebol"), TEXT("REBOL"), TEXT("REBOL file"), L_REBOL, "rebol"}, {L"rebol", L"REBOL", L"REBOL file", L_REBOL, "rebol"},
{TEXT("registry"), TEXT("registry"), TEXT("registry file"), L_REGISTRY, "registry"}, {L"registry", L"registry", L"registry file", L_REGISTRY, "registry"},
{TEXT("rust"), TEXT("Rust"), TEXT("Rust file"), L_RUST, "rust"}, {L"rust", L"Rust", L"Rust file", L_RUST, "rust"},
{TEXT("spice"), TEXT("Spice"), TEXT("spice file"), L_SPICE, "spice"}, {L"spice", L"Spice", L"spice file", L_SPICE, "spice"},
{TEXT("txt2tags"), TEXT("txt2tags"), TEXT("txt2tags file"), L_TXT2TAGS, "txt2tags"}, {L"txt2tags", L"txt2tags", L"txt2tags file", L_TXT2TAGS, "txt2tags"},
{TEXT("visualprolog"), TEXT("Visual Prolog"), TEXT("Visual Prolog file"), L_VISUALPROLOG, "visualprolog"}, {L"visualprolog", L"Visual Prolog", L"Visual Prolog file", L_VISUALPROLOG, "visualprolog"},
{TEXT("typescript"), TEXT("TypeScript"), TEXT("TypeScript file"), L_TYPESCRIPT, "cpp"}, {L"typescript", L"TypeScript", L"TypeScript file", L_TYPESCRIPT, "cpp"},
{TEXT("json5"), TEXT("json5"), TEXT("JSON5 file"), L_JSON5, "json"}, {L"json5", L"json5", L"JSON5 file", L_JSON5, "json"},
{TEXT("mssql"), TEXT("mssql"), TEXT("Microsoft Transact-SQL (SQL Server) file"), L_MSSQL, "mssql"}, {L"mssql", L"mssql", L"Microsoft Transact-SQL (SQL Server) file", L_MSSQL, "mssql"},
{TEXT("gdscript"), TEXT("GDScript"), TEXT("GDScript file"), L_GDSCRIPT, "gdscript"}, {L"gdscript", L"GDScript", L"GDScript file", L_GDSCRIPT, "gdscript"},
{TEXT("hollywood"), TEXT("Hollywood"), TEXT("Hollywood script"), L_HOLLYWOOD, "hollywood"}, {L"hollywood", L"Hollywood", L"Hollywood script", L_HOLLYWOOD, "hollywood"},
{TEXT("go"), TEXT("Go"), TEXT("Go source file"), L_GOLANG, "cpp"}, {L"go", L"Go", L"Go source file", L_GOLANG, "cpp"},
{TEXT("raku"), TEXT("Raku"), TEXT("Raku source file"), L_RAKU, "raku"}, {L"raku", L"Raku", L"Raku source file", L_RAKU, "raku"},
{TEXT("ext"), TEXT("External"), TEXT("External"), L_EXTERNAL, "null"} {L"ext", L"External", L"External", L_EXTERNAL, "null"}
}; };
@ -198,8 +198,8 @@ void ScintillaEditView::init(HINSTANCE hInst, HWND hPere)
Window::init(hInst, hPere); Window::init(hInst, hPere);
_hSelf = ::CreateWindowEx( _hSelf = ::CreateWindowEx(
0,\ 0,\
TEXT("Scintilla"),\ L"Scintilla",\
TEXT("Notepad++"),\ L"Notepad++",\
WS_CHILD | WS_VSCROLL | WS_HSCROLL | WS_CLIPCHILDREN | WS_EX_RTLREADING,\ WS_CHILD | WS_VSCROLL | WS_HSCROLL | WS_CLIPCHILDREN | WS_EX_RTLREADING,\
0, 0, 100, 100,\ 0, 0, 100, 100,\
_hParent,\ _hParent,\
@ -467,7 +467,7 @@ LRESULT ScintillaEditView::scintillaNew_Proc(HWND hwnd, UINT Message, WPARAM wPa
{ {
// convert the selection to Unicode, and store it at the end of the structure. // convert the selection to Unicode, and store it at the end of the structure.
// Beware: For a Unicode IME, dwStrLen , dwCompStrLen, and dwTargetStrLen // Beware: For a Unicode IME, dwStrLen , dwCompStrLen, and dwTargetStrLen
// are TCHAR values, that is, character counts. The members dwStrOffset, // are wchar_t values, that is, character counts. The members dwStrOffset,
// dwCompStrOffset, and dwTargetStrOffset specify byte counts. // dwCompStrOffset, and dwTargetStrOffset specify byte counts.
textLength = ::MultiByteToWideChar( codepage, 0, textLength = ::MultiByteToWideChar( codepage, 0,
@ -738,7 +738,7 @@ void ScintillaEditView::setStyle(Style styleToSet)
if (go.isEnable()) if (go.isEnable())
{ {
const Style * pStyle = NppParameters::getInstance().getMiscStylerArray().findByName(TEXT("Global override")); const Style * pStyle = NppParameters::getInstance().getMiscStylerArray().findByName(L"Global override");
if (pStyle) if (pStyle)
{ {
if (go.enableFg) if (go.enableFg)
@ -814,7 +814,7 @@ void ScintillaEditView::setXmlLexer(LangType type)
setLexerFromLangID(L_XML); setLexerFromLangID(L_XML);
for (int i = 0 ; i < 4 ; ++i) for (int i = 0 ; i < 4 ; ++i)
execute(SCI_SETKEYWORDS, i, reinterpret_cast<LPARAM>(TEXT(""))); execute(SCI_SETKEYWORDS, i, reinterpret_cast<LPARAM>(L""));
makeStyle(type); makeStyle(type);
@ -838,7 +838,7 @@ void ScintillaEditView::setXmlLexer(LangType type)
void ScintillaEditView::setHTMLLexer() void ScintillaEditView::setHTMLLexer()
{ {
const TCHAR *pKwArray[10] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; const wchar_t *pKwArray[10] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
makeStyle(L_HTML, pKwArray); makeStyle(L_HTML, pKwArray);
basic_string<char> keywordList(""); basic_string<char> keywordList("");
@ -853,7 +853,7 @@ void ScintillaEditView::setHTMLLexer()
void ScintillaEditView::setEmbeddedJSLexer() void ScintillaEditView::setEmbeddedJSLexer()
{ {
const TCHAR *pKwArray[10] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; const wchar_t *pKwArray[10] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
makeStyle(L_JS, pKwArray); makeStyle(L_JS, pKwArray);
basic_string<char> keywordList(""); basic_string<char> keywordList("");
@ -873,7 +873,7 @@ void ScintillaEditView::setJsonLexer(bool isJson5)
{ {
setLexerFromLangID(isJson5 ? L_JSON5 : L_JSON); setLexerFromLangID(isJson5 ? L_JSON5 : L_JSON);
const TCHAR *pKwArray[10] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; const wchar_t *pKwArray[10] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };
makeStyle(L_JSON, pKwArray); makeStyle(L_JSON, pKwArray);
@ -905,7 +905,7 @@ void ScintillaEditView::setJsonLexer(bool isJson5)
void ScintillaEditView::setEmbeddedPhpLexer() void ScintillaEditView::setEmbeddedPhpLexer()
{ {
const TCHAR *pKwArray[10] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; const wchar_t *pKwArray[10] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
makeStyle(L_PHP, pKwArray); makeStyle(L_PHP, pKwArray);
basic_string<char> keywordList(""); basic_string<char> keywordList("");
@ -923,7 +923,7 @@ void ScintillaEditView::setEmbeddedPhpLexer()
void ScintillaEditView::setEmbeddedAspLexer() void ScintillaEditView::setEmbeddedAspLexer()
{ {
const TCHAR *pKwArray[10] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; const wchar_t *pKwArray[10] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
makeStyle(L_ASP, pKwArray); makeStyle(L_ASP, pKwArray);
basic_string<char> keywordList(""); basic_string<char> keywordList("");
@ -940,7 +940,7 @@ void ScintillaEditView::setEmbeddedAspLexer()
execute(SCI_STYLESETEOLFILLED, SCE_HBA_DEFAULT, true); execute(SCI_STYLESETEOLFILLED, SCE_HBA_DEFAULT, true);
} }
void ScintillaEditView::setUserLexer(const TCHAR *userLangName) void ScintillaEditView::setUserLexer(const wchar_t *userLangName)
{ {
int setKeywordsCounter = 0; int setKeywordsCounter = 0;
setLexerFromLangID(L_USER); setLexerFromLangID(L_USER);
@ -1049,7 +1049,7 @@ void ScintillaEditView::setUserLexer(const TCHAR *userLangName)
execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("userDefine.decimalSeparator"), reinterpret_cast<LPARAM>(intBuffer)); execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("userDefine.decimalSeparator"), reinterpret_cast<LPARAM>(intBuffer));
// at the end (position SCE_USER_KWLIST_TOTAL) send id values // at the end (position SCE_USER_KWLIST_TOTAL) send id values
sprintf(intBuffer, "%" PRIuPTR, reinterpret_cast<uintptr_t>(userLangContainer->getName())); // use numeric value of TCHAR pointer sprintf(intBuffer, "%" PRIuPTR, reinterpret_cast<uintptr_t>(userLangContainer->getName())); // use numeric value of wchar_t pointer
execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("userDefine.udlName"), reinterpret_cast<LPARAM>(intBuffer)); execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("userDefine.udlName"), reinterpret_cast<LPARAM>(intBuffer));
sprintf(intBuffer, "%" PRIuPTR, reinterpret_cast<uintptr_t>(_currentBufferID)); // use numeric value of BufferID pointer sprintf(intBuffer, "%" PRIuPTR, reinterpret_cast<uintptr_t>(_currentBufferID)); // use numeric value of BufferID pointer
@ -1110,7 +1110,7 @@ void ScintillaEditView::setCppLexer(LangType langType)
const char *cppInstrs; const char *cppInstrs;
const char *cppTypes; const char *cppTypes;
const char *cppGlobalclass; const char *cppGlobalclass;
const TCHAR *doxygenKeyWords = NppParameters::getInstance().getWordList(L_CPP, LANG_INDEX_TYPE2); const wchar_t *doxygenKeyWords = NppParameters::getInstance().getWordList(L_CPP, LANG_INDEX_TYPE2);
setLexerFromLangID(L_CPP); setLexerFromLangID(L_CPP);
@ -1124,7 +1124,7 @@ void ScintillaEditView::setCppLexer(LangType langType)
} }
} }
const TCHAR *pKwArray[10] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; const wchar_t *pKwArray[10] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
makeStyle(langType, pKwArray); makeStyle(langType, pKwArray);
basic_string<char> keywordListInstruction(""); basic_string<char> keywordListInstruction("");
@ -1169,10 +1169,10 @@ void ScintillaEditView::setCppLexer(LangType langType)
void ScintillaEditView::setJsLexer() void ScintillaEditView::setJsLexer()
{ {
const TCHAR *doxygenKeyWords = NppParameters::getInstance().getWordList(L_CPP, LANG_INDEX_TYPE2); const wchar_t *doxygenKeyWords = NppParameters::getInstance().getWordList(L_CPP, LANG_INDEX_TYPE2);
setLexerFromLangID(L_JAVASCRIPT); setLexerFromLangID(L_JAVASCRIPT);
const TCHAR *pKwArray[10] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; const wchar_t *pKwArray[10] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };
makeStyle(L_JAVASCRIPT, pKwArray); makeStyle(L_JAVASCRIPT, pKwArray);
if (doxygenKeyWords) if (doxygenKeyWords)
@ -1182,7 +1182,7 @@ void ScintillaEditView::setJsLexer()
execute(SCI_SETKEYWORDS, 2, reinterpret_cast<LPARAM>(doxygenKeyWords_char)); execute(SCI_SETKEYWORDS, 2, reinterpret_cast<LPARAM>(doxygenKeyWords_char));
} }
const TCHAR *newLexerName = ScintillaEditView::_langNameInfoArray[L_JAVASCRIPT]._langName; const wchar_t *newLexerName = ScintillaEditView::_langNameInfoArray[L_JAVASCRIPT]._langName;
LexerStyler *pNewStyler = (NppParameters::getInstance().getLStylerArray()).getLexerStylerByName(newLexerName); LexerStyler *pNewStyler = (NppParameters::getInstance().getLStylerArray()).getLexerStylerByName(newLexerName);
if (pNewStyler) // New js styler is available, so we can use it do more modern styling if (pNewStyler) // New js styler is available, so we can use it do more modern styling
{ {
@ -1222,7 +1222,7 @@ void ScintillaEditView::setJsLexer()
} }
else // New js styler is not available, we use the old styling for the sake of retro-compatibility else // New js styler is not available, we use the old styling for the sake of retro-compatibility
{ {
const TCHAR *lexerName = ScintillaEditView::_langNameInfoArray[L_JS]._langName; const wchar_t *lexerName = ScintillaEditView::_langNameInfoArray[L_JS]._langName;
LexerStyler *pOldStyler = (NppParameters::getInstance().getLStylerArray()).getLexerStylerByName(lexerName); LexerStyler *pOldStyler = (NppParameters::getInstance().getLStylerArray()).getLexerStylerByName(lexerName);
if (pOldStyler) if (pOldStyler)
@ -1288,7 +1288,7 @@ void ScintillaEditView::setTclLexer()
setLexerFromLangID(L_TCL); setLexerFromLangID(L_TCL);
const TCHAR *pKwArray[10] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; const wchar_t *pKwArray[10] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
makeStyle(L_TCL, pKwArray); makeStyle(L_TCL, pKwArray);
basic_string<char> keywordListInstruction(""); basic_string<char> keywordListInstruction("");
@ -1315,7 +1315,7 @@ void ScintillaEditView::setObjCLexer(LangType langType)
{ {
setLexerFromLangID(L_OBJC); setLexerFromLangID(L_OBJC);
const TCHAR *pKwArray[10] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; const wchar_t *pKwArray[10] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
makeStyle(langType, pKwArray); makeStyle(langType, pKwArray);
@ -1351,7 +1351,7 @@ void ScintillaEditView::setObjCLexer(LangType langType)
basic_string<char> doxygenKeyWordsString(""); basic_string<char> doxygenKeyWordsString("");
const TCHAR *doxygenKeyWordsW = NppParameters::getInstance().getWordList(L_CPP, LANG_INDEX_TYPE2); const wchar_t *doxygenKeyWordsW = NppParameters::getInstance().getWordList(L_CPP, LANG_INDEX_TYPE2);
if (doxygenKeyWordsW) if (doxygenKeyWordsW)
{ {
doxygenKeyWordsString = wstring2string(doxygenKeyWordsW, CP_ACP); doxygenKeyWordsString = wstring2string(doxygenKeyWordsW, CP_ACP);
@ -1374,7 +1374,7 @@ void ScintillaEditView::setObjCLexer(LangType langType)
void ScintillaEditView::setTypeScriptLexer() void ScintillaEditView::setTypeScriptLexer()
{ {
const TCHAR* doxygenKeyWords = NppParameters::getInstance().getWordList(L_CPP, LANG_INDEX_TYPE2); const wchar_t* doxygenKeyWords = NppParameters::getInstance().getWordList(L_CPP, LANG_INDEX_TYPE2);
setLexerFromLangID(L_TYPESCRIPT); setLexerFromLangID(L_TYPESCRIPT);
if (doxygenKeyWords) if (doxygenKeyWords)
@ -1384,7 +1384,7 @@ void ScintillaEditView::setTypeScriptLexer()
execute(SCI_SETKEYWORDS, 2, reinterpret_cast<LPARAM>(doxygenKeyWords_char)); execute(SCI_SETKEYWORDS, 2, reinterpret_cast<LPARAM>(doxygenKeyWords_char));
} }
const TCHAR* pKwArray[10] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; const wchar_t* pKwArray[10] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };
makeStyle(L_TYPESCRIPT, pKwArray); makeStyle(L_TYPESCRIPT, pKwArray);
auto getKeywordList = [&pKwArray](const int i) auto getKeywordList = [&pKwArray](const int i)
@ -1428,7 +1428,7 @@ void ScintillaEditView::setLexer(LangType langType, int whichList)
{ {
setLexerFromLangID(langType); setLexerFromLangID(langType);
const TCHAR *pKwArray[10] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; const wchar_t *pKwArray[10] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
makeStyle(langType, pKwArray); makeStyle(langType, pKwArray);
@ -1493,9 +1493,9 @@ void ScintillaEditView::setLexer(LangType langType, int whichList)
execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("fold.comment"), reinterpret_cast<LPARAM>("1")); execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("fold.comment"), reinterpret_cast<LPARAM>("1"));
} }
void ScintillaEditView::makeStyle(LangType language, const TCHAR **keywordArray) void ScintillaEditView::makeStyle(LangType language, const wchar_t **keywordArray)
{ {
const TCHAR * lexerName = ScintillaEditView::_langNameInfoArray[language]._langName; const wchar_t * lexerName = ScintillaEditView::_langNameInfoArray[language]._langName;
LexerStyler *pStyler = (NppParameters::getInstance().getLStylerArray()).getLexerStylerByName(lexerName); LexerStyler *pStyler = (NppParameters::getInstance().getLStylerArray()).getLexerStylerByName(lexerName);
if (pStyler) if (pStyler)
{ {
@ -1572,7 +1572,7 @@ void ScintillaEditView::setCRLF(long color)
if (color == -1) if (color == -1)
{ {
StyleArray& stylers = nppParams.getMiscStylerArray(); StyleArray& stylers = nppParams.getMiscStylerArray();
Style* pStyle = stylers.findByName(TEXT("EOL custom color")); Style* pStyle = stylers.findByName(L"EOL custom color");
if (pStyle) if (pStyle)
{ {
eolCustomColor = pStyle->_fgColor; eolCustomColor = pStyle->_fgColor;
@ -1786,7 +1786,7 @@ void ScintillaEditView::defineDocType(LangType typeDoc)
setPropsLexer(false); break; setPropsLexer(false); break;
case L_USER : { case L_USER : {
const TCHAR * langExt = _currentBuffer->getUserDefineLangName(); const wchar_t * langExt = _currentBuffer->getUserDefineLangName();
if (langExt[0]) if (langExt[0])
setUserLexer(langExt); setUserLexer(langExt);
else else
@ -1795,16 +1795,16 @@ void ScintillaEditView::defineDocType(LangType typeDoc)
case L_ASCII : case L_ASCII :
{ {
LexerStyler *pStyler = (NppParameters::getInstance().getLStylerArray()).getLexerStylerByName(TEXT("nfo")); LexerStyler *pStyler = (NppParameters::getInstance().getLStylerArray()).getLexerStylerByName(L"nfo");
Style nfoStyle; Style nfoStyle;
nfoStyle._styleID = STYLE_DEFAULT; nfoStyle._styleID = STYLE_DEFAULT;
nfoStyle._fontName = TEXT("Lucida Console"); nfoStyle._fontName = L"Lucida Console";
nfoStyle._fontSize = 10; nfoStyle._fontSize = 10;
if (pStyler) if (pStyler)
{ {
const Style * pStyle = pStyler->findByName(TEXT("DEFAULT")); const Style * pStyle = pStyler->findByName(L"DEFAULT");
if (pStyle) if (pStyle)
{ {
nfoStyle._bgColor = pStyle->_bgColor; nfoStyle._bgColor = pStyle->_bgColor;
@ -2543,43 +2543,43 @@ void ScintillaEditView::getText(char *dest, size_t start, size_t end) const
execute(SCI_GETTEXTRANGEFULL, 0, reinterpret_cast<LPARAM>(&tr)); execute(SCI_GETTEXTRANGEFULL, 0, reinterpret_cast<LPARAM>(&tr));
} }
generic_string ScintillaEditView::getGenericTextAsString(size_t start, size_t end) const wstring ScintillaEditView::getGenericTextAsString(size_t start, size_t end) const
{ {
assert(end > start); assert(end > start);
const size_t bufSize = end - start + 1; const size_t bufSize = end - start + 1;
TCHAR *buf = new TCHAR[bufSize]; wchar_t *buf = new wchar_t[bufSize];
getGenericText(buf, bufSize, start, end); getGenericText(buf, bufSize, start, end);
generic_string text = buf; wstring text = buf;
delete[] buf; delete[] buf;
return text; return text;
} }
void ScintillaEditView::getGenericText(TCHAR *dest, size_t destlen, size_t start, size_t end) const void ScintillaEditView::getGenericText(wchar_t *dest, size_t destlen, size_t start, size_t end) const
{ {
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
char *destA = new char[end - start + 1]; char *destA = new char[end - start + 1];
getText(destA, start, end); getText(destA, start, end);
size_t cp = execute(SCI_GETCODEPAGE); size_t cp = execute(SCI_GETCODEPAGE);
const TCHAR *destW = wmc.char2wchar(destA, cp); const wchar_t *destW = wmc.char2wchar(destA, cp);
wcsncpy_s(dest, destlen, destW, _TRUNCATE); wcsncpy_s(dest, destlen, destW, _TRUNCATE);
delete [] destA; delete [] destA;
} }
// "mstart" and "mend" are pointers to indexes in the read string, // "mstart" and "mend" are pointers to indexes in the read string,
// which are converted to the corresponding indexes in the returned TCHAR string. // which are converted to the corresponding indexes in the returned wchar_t string.
void ScintillaEditView::getGenericText(TCHAR *dest, size_t destlen, size_t start, size_t end, intptr_t* mstart, intptr_t* mend) const void ScintillaEditView::getGenericText(wchar_t *dest, size_t destlen, size_t start, size_t end, intptr_t* mstart, intptr_t* mend) const
{ {
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
char *destA = new char[end - start + 1]; char *destA = new char[end - start + 1];
getText(destA, start, end); getText(destA, start, end);
size_t cp = execute(SCI_GETCODEPAGE) ; size_t cp = execute(SCI_GETCODEPAGE) ;
const TCHAR *destW = wmc.char2wchar(destA, cp, mstart, mend); const wchar_t *destW = wmc.char2wchar(destA, cp, mstart, mend);
wcsncpy_s(dest, destlen, destW, _TRUNCATE); wcsncpy_s(dest, destlen, destW, _TRUNCATE);
delete [] destA; delete [] destA;
} }
void ScintillaEditView::insertGenericTextFrom(size_t position, const TCHAR *text2insert) const void ScintillaEditView::insertGenericTextFrom(size_t position, const wchar_t *text2insert) const
{ {
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
size_t cp = execute(SCI_GETCODEPAGE); size_t cp = execute(SCI_GETCODEPAGE);
@ -2633,14 +2633,14 @@ char * ScintillaEditView::getWordOnCaretPos(char * txt, size_t size)
return getWordFromRange(txt, size, range.first, range.second); return getWordFromRange(txt, size, range.first, range.second);
} }
TCHAR * ScintillaEditView::getGenericWordOnCaretPos(TCHAR * txt, int size) wchar_t * ScintillaEditView::getGenericWordOnCaretPos(wchar_t * txt, int size)
{ {
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
size_t cp = execute(SCI_GETCODEPAGE); size_t cp = execute(SCI_GETCODEPAGE);
char *txtA = new char[size + 1]; char *txtA = new char[size + 1];
getWordOnCaretPos(txtA, size); getWordOnCaretPos(txtA, size);
const TCHAR * txtW = wmc.char2wchar(txtA, cp); const wchar_t * txtW = wmc.char2wchar(txtA, cp);
wcscpy_s(txt, size, txtW); wcscpy_s(txt, size, txtW);
delete [] txtA; delete [] txtA;
return txt; return txt;
@ -2664,20 +2664,20 @@ char * ScintillaEditView::getSelectedText(char * txt, size_t size, bool expand)
return getWordFromRange(txt, size, range.cpMin, range.cpMax); return getWordFromRange(txt, size, range.cpMin, range.cpMax);
} }
TCHAR * ScintillaEditView::getGenericSelectedText(TCHAR * txt, int size, bool expand) wchar_t * ScintillaEditView::getGenericSelectedText(wchar_t * txt, int size, bool expand)
{ {
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
size_t cp = execute(SCI_GETCODEPAGE); size_t cp = execute(SCI_GETCODEPAGE);
char *txtA = new char[size + 1]; char *txtA = new char[size + 1];
getSelectedText(txtA, size, expand); getSelectedText(txtA, size, expand);
const TCHAR * txtW = wmc.char2wchar(txtA, cp); const wchar_t * txtW = wmc.char2wchar(txtA, cp);
wcscpy_s(txt, size, txtW); wcscpy_s(txt, size, txtW);
delete [] txtA; delete [] txtA;
return txt; return txt;
} }
intptr_t ScintillaEditView::searchInTarget(const TCHAR * text2Find, size_t lenOfText2Find, size_t fromPos, size_t toPos) const intptr_t ScintillaEditView::searchInTarget(const wchar_t * text2Find, size_t lenOfText2Find, size_t fromPos, size_t toPos) const
{ {
execute(SCI_SETTARGETRANGE, fromPos, toPos); execute(SCI_SETTARGETRANGE, fromPos, toPos);
@ -2689,7 +2689,7 @@ intptr_t ScintillaEditView::searchInTarget(const TCHAR * text2Find, size_t lenOf
return execute(SCI_SEARCHINTARGET, len, reinterpret_cast<LPARAM>(text2FindA)); return execute(SCI_SEARCHINTARGET, len, reinterpret_cast<LPARAM>(text2FindA));
} }
void ScintillaEditView::appandGenericText(const TCHAR * text2Append) const void ScintillaEditView::appandGenericText(const wchar_t * text2Append) const
{ {
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
size_t cp = execute(SCI_GETCODEPAGE); size_t cp = execute(SCI_GETCODEPAGE);
@ -2697,7 +2697,7 @@ void ScintillaEditView::appandGenericText(const TCHAR * text2Append) const
execute(SCI_APPENDTEXT, strlen(text2AppendA), reinterpret_cast<LPARAM>(text2AppendA)); execute(SCI_APPENDTEXT, strlen(text2AppendA), reinterpret_cast<LPARAM>(text2AppendA));
} }
void ScintillaEditView::addGenericText(const TCHAR * text2Append) const void ScintillaEditView::addGenericText(const wchar_t * text2Append) const
{ {
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
size_t cp = execute(SCI_GETCODEPAGE); size_t cp = execute(SCI_GETCODEPAGE);
@ -2705,7 +2705,7 @@ void ScintillaEditView::addGenericText(const TCHAR * text2Append) const
execute(SCI_ADDTEXT, strlen(text2AppendA), reinterpret_cast<LPARAM>(text2AppendA)); execute(SCI_ADDTEXT, strlen(text2AppendA), reinterpret_cast<LPARAM>(text2AppendA));
} }
void ScintillaEditView::addGenericText(const TCHAR * text2Append, intptr_t* mstart, intptr_t* mend) const void ScintillaEditView::addGenericText(const wchar_t * text2Append, intptr_t* mstart, intptr_t* mend) const
{ {
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
size_t cp = execute(SCI_GETCODEPAGE); size_t cp = execute(SCI_GETCODEPAGE);
@ -2713,7 +2713,7 @@ void ScintillaEditView::addGenericText(const TCHAR * text2Append, intptr_t* msta
execute(SCI_ADDTEXT, strlen(text2AppendA), reinterpret_cast<LPARAM>(text2AppendA)); execute(SCI_ADDTEXT, strlen(text2AppendA), reinterpret_cast<LPARAM>(text2AppendA));
} }
intptr_t ScintillaEditView::replaceTarget(const TCHAR * str2replace, intptr_t fromTargetPos, intptr_t toTargetPos) const intptr_t ScintillaEditView::replaceTarget(const wchar_t * str2replace, intptr_t fromTargetPos, intptr_t toTargetPos) const
{ {
if (fromTargetPos != -1 || toTargetPos != -1) if (fromTargetPos != -1 || toTargetPos != -1)
{ {
@ -2725,7 +2725,7 @@ intptr_t ScintillaEditView::replaceTarget(const TCHAR * str2replace, intptr_t fr
return execute(SCI_REPLACETARGET, static_cast<WPARAM>(-1), reinterpret_cast<LPARAM>(str2replaceA)); return execute(SCI_REPLACETARGET, static_cast<WPARAM>(-1), reinterpret_cast<LPARAM>(str2replaceA));
} }
intptr_t ScintillaEditView::replaceTargetRegExMode(const TCHAR * re, intptr_t fromTargetPos, intptr_t toTargetPos) const intptr_t ScintillaEditView::replaceTargetRegExMode(const wchar_t * re, intptr_t fromTargetPos, intptr_t toTargetPos) const
{ {
if (fromTargetPos != -1 || toTargetPos != -1) if (fromTargetPos != -1 || toTargetPos != -1)
{ {
@ -2737,7 +2737,7 @@ intptr_t ScintillaEditView::replaceTargetRegExMode(const TCHAR * re, intptr_t fr
return execute(SCI_REPLACETARGETRE, static_cast<WPARAM>(-1), reinterpret_cast<LPARAM>(reA)); return execute(SCI_REPLACETARGETRE, static_cast<WPARAM>(-1), reinterpret_cast<LPARAM>(reA));
} }
void ScintillaEditView::showAutoComletion(size_t lenEntered, const TCHAR* list) void ScintillaEditView::showAutoComletion(size_t lenEntered, const wchar_t* list)
{ {
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
size_t cp = execute(SCI_GETCODEPAGE); size_t cp = execute(SCI_GETCODEPAGE);
@ -2746,7 +2746,7 @@ void ScintillaEditView::showAutoComletion(size_t lenEntered, const TCHAR* list)
NppDarkMode::setDarkAutoCompletion(); NppDarkMode::setDarkAutoCompletion();
} }
void ScintillaEditView::showCallTip(size_t startPos, const TCHAR * def) void ScintillaEditView::showCallTip(size_t startPos, const wchar_t * def)
{ {
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
size_t cp = execute(SCI_GETCODEPAGE); size_t cp = execute(SCI_GETCODEPAGE);
@ -2754,16 +2754,16 @@ void ScintillaEditView::showCallTip(size_t startPos, const TCHAR * def)
execute(SCI_CALLTIPSHOW, startPos, reinterpret_cast<LPARAM>(defA)); execute(SCI_CALLTIPSHOW, startPos, reinterpret_cast<LPARAM>(defA));
} }
generic_string ScintillaEditView::getLine(size_t lineNumber) wstring ScintillaEditView::getLine(size_t lineNumber)
{ {
size_t lineLen = execute(SCI_LINELENGTH, lineNumber); size_t lineLen = execute(SCI_LINELENGTH, lineNumber);
const size_t bufSize = lineLen + 1; const size_t bufSize = lineLen + 1;
std::unique_ptr<TCHAR[]> buf = std::make_unique<TCHAR[]>(bufSize); std::unique_ptr<wchar_t[]> buf = std::make_unique<wchar_t[]>(bufSize);
getLine(lineNumber, buf.get(), bufSize); getLine(lineNumber, buf.get(), bufSize);
return buf.get(); return buf.get();
} }
void ScintillaEditView::getLine(size_t lineNumber, TCHAR * line, size_t lineBufferLen) void ScintillaEditView::getLine(size_t lineNumber, wchar_t * line, size_t lineBufferLen)
{ {
// make sure the buffer length is enough to get the whole line // make sure the buffer length is enough to get the whole line
size_t lineLen = execute(SCI_LINELENGTH, lineNumber); size_t lineLen = execute(SCI_LINELENGTH, lineNumber);
@ -2777,7 +2777,7 @@ void ScintillaEditView::getLine(size_t lineNumber, TCHAR * line, size_t lineBuff
memset(lineA, 0x0, sizeof(char) * lineBufferLen); memset(lineA, 0x0, sizeof(char) * lineBufferLen);
execute(SCI_GETLINE, lineNumber, reinterpret_cast<LPARAM>(lineA)); execute(SCI_GETLINE, lineNumber, reinterpret_cast<LPARAM>(lineA));
const TCHAR *lineW = wmc.char2wchar(lineA, cp); const wchar_t *lineW = wmc.char2wchar(lineA, cp);
lstrcpyn(line, lineW, static_cast<int>(lineBufferLen)); lstrcpyn(line, lineW, static_cast<int>(lineBufferLen));
delete [] lineA; delete [] lineA;
} }
@ -2941,7 +2941,7 @@ void ScintillaEditView::performGlobalStyles()
if (svp._currentLineHiliteMode != LINEHILITE_NONE) if (svp._currentLineHiliteMode != LINEHILITE_NONE)
{ {
pStyle = stylers.findByName(TEXT("Current line background colour")); pStyle = stylers.findByName(L"Current line background colour");
if (pStyle) if (pStyle)
{ {
setElementColour(SC_ELEMENT_CARET_LINE_BACK, pStyle->_bgColor); setElementColour(SC_ELEMENT_CARET_LINE_BACK, pStyle->_bgColor);
@ -2952,7 +2952,7 @@ void ScintillaEditView::performGlobalStyles()
COLORREF selectColorBack = grey; COLORREF selectColorBack = grey;
COLORREF selectColorFore = black; COLORREF selectColorFore = black;
pStyle = stylers.findByName(TEXT("Selected text colour")); pStyle = stylers.findByName(L"Selected text colour");
if (pStyle) if (pStyle)
{ {
selectColorBack = pStyle->_bgColor; selectColorBack = pStyle->_bgColor;
@ -2964,7 +2964,7 @@ void ScintillaEditView::performGlobalStyles()
COLORREF selectMultiSelectColorBack = liteGrey; COLORREF selectMultiSelectColorBack = liteGrey;
pStyle = stylers.findByName(TEXT("Multi-selected text color")); pStyle = stylers.findByName(L"Multi-selected text color");
if (pStyle) if (pStyle)
{ {
selectMultiSelectColorBack = pStyle->_bgColor; selectMultiSelectColorBack = pStyle->_bgColor;
@ -2997,7 +2997,7 @@ void ScintillaEditView::performGlobalStyles()
setElementColour(SC_ELEMENT_CARET_ADDITIONAL, multiEditCaretColor); setElementColour(SC_ELEMENT_CARET_ADDITIONAL, multiEditCaretColor);
COLORREF edgeColor = liteGrey; COLORREF edgeColor = liteGrey;
pStyle = stylers.findByName(TEXT("Edge colour")); pStyle = stylers.findByName(L"Edge colour");
if (pStyle) if (pStyle)
{ {
edgeColor = pStyle->_fgColor; edgeColor = pStyle->_fgColor;
@ -3007,7 +3007,7 @@ void ScintillaEditView::performGlobalStyles()
COLORREF foldMarginColor = grey; COLORREF foldMarginColor = grey;
COLORREF foldMarginHiColor = white; COLORREF foldMarginHiColor = white;
pStyle = stylers.findByName(TEXT("Fold margin")); pStyle = stylers.findByName(L"Fold margin");
if (pStyle) if (pStyle)
{ {
foldMarginHiColor = pStyle->_fgColor; foldMarginHiColor = pStyle->_fgColor;
@ -3017,10 +3017,10 @@ void ScintillaEditView::performGlobalStyles()
execute(SCI_SETFOLDMARGINHICOLOUR, true, foldMarginHiColor); execute(SCI_SETFOLDMARGINHICOLOUR, true, foldMarginHiColor);
COLORREF bookmarkMarginColor = veryLiteGrey; COLORREF bookmarkMarginColor = veryLiteGrey;
pStyle = stylers.findByName(TEXT("Bookmark margin")); pStyle = stylers.findByName(L"Bookmark margin");
if (!pStyle) if (!pStyle)
{ {
pStyle = stylers.findByName(TEXT("Line number margin")); // "Line number margin" is used only for getting the bg color for _SC_MARGE_SYMBOL. pStyle = stylers.findByName(L"Line number margin"); // "Line number margin" is used only for getting the bg color for _SC_MARGE_SYMBOL.
if (pStyle) // "Line number margin" has its own style (styleID="33") for setting its bg & fg color if (pStyle) // "Line number margin" has its own style (styleID="33") for setting its bg & fg color
{ {
bookmarkMarginColor = pStyle->_bgColor; bookmarkMarginColor = pStyle->_bgColor;
@ -3034,10 +3034,10 @@ void ScintillaEditView::performGlobalStyles()
execute(SCI_SETMARGINBACKN, _SC_MARGE_SYMBOL, bookmarkMarginColor); execute(SCI_SETMARGINBACKN, _SC_MARGE_SYMBOL, bookmarkMarginColor);
COLORREF changeHistoryMarginColor = veryLiteGrey; COLORREF changeHistoryMarginColor = veryLiteGrey;
pStyle = stylers.findByName(TEXT("Change History margin")); pStyle = stylers.findByName(L"Change History margin");
if (!pStyle) if (!pStyle)
{ {
pStyle = stylers.findByName(TEXT("Line number margin")); pStyle = stylers.findByName(L"Line number margin");
if (pStyle) if (pStyle)
{ {
changeHistoryMarginColor = pStyle->_bgColor; changeHistoryMarginColor = pStyle->_bgColor;
@ -3052,7 +3052,7 @@ void ScintillaEditView::performGlobalStyles()
COLORREF changeModifiedfgColor = orange; COLORREF changeModifiedfgColor = orange;
COLORREF changeModifiedbgColor = orange; COLORREF changeModifiedbgColor = orange;
pStyle = stylers.findByName(TEXT("Change History modified")); pStyle = stylers.findByName(L"Change History modified");
if (pStyle) if (pStyle)
{ {
changeModifiedfgColor = pStyle->_fgColor; changeModifiedfgColor = pStyle->_fgColor;
@ -3065,7 +3065,7 @@ void ScintillaEditView::performGlobalStyles()
COLORREF changeRevertModifiedfgColor = yellowGreen; COLORREF changeRevertModifiedfgColor = yellowGreen;
COLORREF changeRevertModifiedbgColor = yellowGreen; COLORREF changeRevertModifiedbgColor = yellowGreen;
pStyle = stylers.findByName(TEXT("Change History revert modified")); pStyle = stylers.findByName(L"Change History revert modified");
if (pStyle) if (pStyle)
{ {
changeRevertModifiedfgColor = pStyle->_fgColor; changeRevertModifiedfgColor = pStyle->_fgColor;
@ -3078,7 +3078,7 @@ void ScintillaEditView::performGlobalStyles()
COLORREF changeRevertOriginfgColor = darkCyan; COLORREF changeRevertOriginfgColor = darkCyan;
COLORREF changeRevertOriginbgColor = darkCyan; COLORREF changeRevertOriginbgColor = darkCyan;
pStyle = stylers.findByName(TEXT("Change History revert origin")); pStyle = stylers.findByName(L"Change History revert origin");
if (pStyle) if (pStyle)
{ {
changeRevertOriginfgColor = pStyle->_fgColor; changeRevertOriginfgColor = pStyle->_fgColor;
@ -3091,7 +3091,7 @@ void ScintillaEditView::performGlobalStyles()
COLORREF changeSavedfgColor = midGreen; COLORREF changeSavedfgColor = midGreen;
COLORREF changeSavedbgColor = midGreen; COLORREF changeSavedbgColor = midGreen;
pStyle = stylers.findByName(TEXT("Change History saved")); pStyle = stylers.findByName(L"Change History saved");
if (pStyle) if (pStyle)
{ {
changeSavedfgColor = pStyle->_fgColor; changeSavedfgColor = pStyle->_fgColor;
@ -3103,7 +3103,7 @@ void ScintillaEditView::performGlobalStyles()
execute(SCI_INDICSETFORE, INDICATOR_HISTORY_SAVED_DELETION, changeSavedfgColor); execute(SCI_INDICSETFORE, INDICATOR_HISTORY_SAVED_DELETION, changeSavedfgColor);
COLORREF urlHoveredFG = grey; COLORREF urlHoveredFG = grey;
pStyle = stylers.findByName(TEXT("URL hovered")); pStyle = stylers.findByName(L"URL hovered");
if (pStyle) if (pStyle)
{ {
urlHoveredFG = pStyle->_fgColor; urlHoveredFG = pStyle->_fgColor;
@ -3119,7 +3119,7 @@ void ScintillaEditView::performGlobalStyles()
execute(SCI_MARKERENABLEHIGHLIGHT, true); execute(SCI_MARKERENABLEHIGHLIGHT, true);
COLORREF wsSymbolFgColor = black; COLORREF wsSymbolFgColor = black;
pStyle = stylers.findByName(TEXT("White space symbol")); pStyle = stylers.findByName(L"White space symbol");
if (pStyle) if (pStyle)
{ {
wsSymbolFgColor = pStyle->_fgColor; wsSymbolFgColor = pStyle->_fgColor;
@ -3127,7 +3127,7 @@ void ScintillaEditView::performGlobalStyles()
execute(SCI_SETWHITESPACEFORE, true, wsSymbolFgColor); execute(SCI_SETWHITESPACEFORE, true, wsSymbolFgColor);
COLORREF eolCustomColor = liteGrey; COLORREF eolCustomColor = liteGrey;
pStyle = stylers.findByName(TEXT("EOL custom color")); pStyle = stylers.findByName(L"EOL custom color");
if (pStyle) if (pStyle)
{ {
eolCustomColor = pStyle->_fgColor; eolCustomColor = pStyle->_fgColor;
@ -3365,7 +3365,7 @@ void ScintillaEditView::updateLineNumberWidth()
const char * ScintillaEditView::getCompleteKeywordList(std::basic_string<char> & kwl, LangType langType, int keywordIndex) const char * ScintillaEditView::getCompleteKeywordList(std::basic_string<char> & kwl, LangType langType, int keywordIndex)
{ {
kwl += " "; kwl += " ";
const TCHAR *defKwl_generic = NppParameters::getInstance().getWordList(langType, keywordIndex); const wchar_t *defKwl_generic = NppParameters::getInstance().getWordList(langType, keywordIndex);
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
const char * defKwl = wmc.wchar2char(defKwl_generic, CP_ACP); const char * defKwl = wmc.wchar2char(defKwl_generic, CP_ACP);
@ -3691,7 +3691,7 @@ ColumnModeInfos ScintillaEditView::getColumnModeSelectInfo()
return columnModeInfos; return columnModeInfos;
} }
void ScintillaEditView::columnReplace(ColumnModeInfos & cmi, const TCHAR *str) void ScintillaEditView::columnReplace(ColumnModeInfos & cmi, const wchar_t *str)
{ {
intptr_t totalDiff = 0; intptr_t totalDiff = 0;
for (size_t i = 0, len = cmi.size(); i < len ; ++i) for (size_t i = 0, len = cmi.size(); i < len ; ++i)
@ -4151,7 +4151,7 @@ void ScintillaEditView::setTabSettings(Lang* lang)
void ScintillaEditView::insertNewLineAboveCurrentLine() void ScintillaEditView::insertNewLineAboveCurrentLine()
{ {
generic_string newline = getEOLString(); wstring newline = getEOLString();
const auto current_line = getCurrentLineNumber(); const auto current_line = getCurrentLineNumber();
if (current_line == 0) if (current_line == 0)
{ {
@ -4170,7 +4170,7 @@ void ScintillaEditView::insertNewLineAboveCurrentLine()
void ScintillaEditView::insertNewLineBelowCurrentLine() void ScintillaEditView::insertNewLineBelowCurrentLine()
{ {
generic_string newline = getEOLString(); wstring newline = getEOLString();
const auto line_count = execute(SCI_GETLINECOUNT); const auto line_count = execute(SCI_GETLINECOUNT);
const auto current_line = getCurrentLineNumber(); const auto current_line = getCurrentLineNumber();
if (current_line == line_count - 1) if (current_line == line_count - 1)
@ -4196,8 +4196,8 @@ void ScintillaEditView::sortLines(size_t fromLine, size_t toLine, ISorter* pSort
const auto startPos = execute(SCI_POSITIONFROMLINE, fromLine); const auto startPos = execute(SCI_POSITIONFROMLINE, fromLine);
const auto endPos = execute(SCI_POSITIONFROMLINE, toLine) + execute(SCI_LINELENGTH, toLine); const auto endPos = execute(SCI_POSITIONFROMLINE, toLine) + execute(SCI_LINELENGTH, toLine);
const generic_string text = getGenericTextAsString(startPos, endPos); const wstring text = getGenericTextAsString(startPos, endPos);
std::vector<generic_string> splitText; std::vector<wstring> splitText;
stringSplit(text, getEOLString(), splitText); stringSplit(text, getEOLString(), splitText);
const size_t lineCount = execute(SCI_GETLINECOUNT); const size_t lineCount = execute(SCI_GETLINECOUNT);
const bool sortEntireDocument = toLine == lineCount - 1; const bool sortEntireDocument = toLine == lineCount - 1;
@ -4210,7 +4210,7 @@ void ScintillaEditView::sortLines(size_t fromLine, size_t toLine, ISorter* pSort
} }
assert(toLine - fromLine + 1 == splitText.size()); assert(toLine - fromLine + 1 == splitText.size());
pSort->sort(splitText); pSort->sort(splitText);
generic_string joined; wstring joined;
stringJoin(splitText, getEOLString(), joined); stringJoin(splitText, getEOLString(), joined);
if (sortEntireDocument) if (sortEntireDocument)
@ -4248,8 +4248,8 @@ void ScintillaEditView::changeTextDirection(bool isRTL)
{ {
(nppParamInst.getNativeLangSpeaker())->messageBox("RTLvsDirectWrite", (nppParamInst.getNativeLangSpeaker())->messageBox("RTLvsDirectWrite",
getHSelf(), getHSelf(),
TEXT("RTL is not compatible with Direct Write mode. Please disable DirectWrite mode in MISC. section of Preferences dialog, and restart Notepad++."), L"RTL is not compatible with Direct Write mode. Please disable DirectWrite mode in MISC. section of Preferences dialog, and restart Notepad++.",
TEXT("Cannot run RTL"), L"Cannot run RTL",
MB_OK | MB_APPLMODAL); MB_OK | MB_APPLMODAL);
theWarningIsGiven = true; theWarningIsGiven = true;
@ -4294,20 +4294,20 @@ void ScintillaEditView::changeTextDirection(bool isRTL)
buf->setRTL(isRTL); buf->setRTL(isRTL);
} }
generic_string ScintillaEditView::getEOLString() const wstring ScintillaEditView::getEOLString() const
{ {
intptr_t eol_mode = execute(SCI_GETEOLMODE); intptr_t eol_mode = execute(SCI_GETEOLMODE);
if (eol_mode == SC_EOL_CRLF) if (eol_mode == SC_EOL_CRLF)
{ {
return TEXT("\r\n"); return L"\r\n";
} }
else if (eol_mode == SC_EOL_LF) else if (eol_mode == SC_EOL_LF)
{ {
return TEXT("\n"); return L"\n";
} }
else else
{ {
return TEXT("\r"); return L"\r";
} }
} }
@ -4344,14 +4344,14 @@ void ScintillaEditView::getFoldColor(COLORREF& fgColor, COLORREF& bgColor, COLOR
{ {
StyleArray & stylers = NppParameters::getInstance().getMiscStylerArray(); StyleArray & stylers = NppParameters::getInstance().getMiscStylerArray();
const Style * pStyle = stylers.findByName(TEXT("Fold")); const Style * pStyle = stylers.findByName(L"Fold");
if (pStyle) if (pStyle)
{ {
fgColor = pStyle->_bgColor; fgColor = pStyle->_bgColor;
bgColor = pStyle->_fgColor; bgColor = pStyle->_fgColor;
} }
pStyle = stylers.findByName(TEXT("Fold active")); pStyle = stylers.findByName(L"Fold active");
if (pStyle) if (pStyle)
{ {
activeFgColor = pStyle->_fgColor; activeFgColor = pStyle->_fgColor;
@ -4453,10 +4453,10 @@ void ScintillaEditView::markedTextToClipboard(int indiStyle, bool doAll /*= fals
} }
// vector of pairs: starting position of styled text, and styled text // vector of pairs: starting position of styled text, and styled text
std::vector<std::pair<size_t, generic_string>> styledVect; std::vector<std::pair<size_t, wstring>> styledVect;
const generic_string cr = TEXT("\r"); const wstring cr = L"\r";
const generic_string lf = TEXT("\n"); const wstring lf = L"\n";
bool textContainsLineEndingChar = false; bool textContainsLineEndingChar = false;
@ -4473,7 +4473,7 @@ void ScintillaEditView::markedTextToClipboard(int indiStyle, bool doAll /*= fals
{ {
if (atEndOfIndic) if (atEndOfIndic)
{ {
generic_string styledText = getGenericTextAsString(prevPos, pos); wstring styledText = getGenericTextAsString(prevPos, pos);
if (!textContainsLineEndingChar) if (!textContainsLineEndingChar)
{ {
if (styledText.find(cr) != std::string::npos || if (styledText.find(cr) != std::string::npos ||
@ -4499,11 +4499,11 @@ void ScintillaEditView::markedTextToClipboard(int indiStyle, bool doAll /*= fals
std::sort(styledVect.begin(), styledVect.end()); std::sort(styledVect.begin(), styledVect.end());
} }
const generic_string delim = const wstring delim =
(textContainsLineEndingChar && styledVect.size() > 1) ? (textContainsLineEndingChar && styledVect.size() > 1) ?
TEXT("\r\n----\r\n") : TEXT("\r\n"); L"\r\n----\r\n" : L"\r\n";
generic_string joined; wstring joined;
for (auto& item : styledVect) for (auto& item : styledVect)
{ {
joined += delim + item.second; joined += delim + item.second;
@ -4511,7 +4511,7 @@ void ScintillaEditView::markedTextToClipboard(int indiStyle, bool doAll /*= fals
joined = joined.substr(delim.length()); joined = joined.substr(delim.length());
if (styledVect.size() > 1) if (styledVect.size() > 1)
{ {
joined += TEXT("\r\n"); joined += L"\r\n";
} }
str2Clipboard(joined, NULL); str2Clipboard(joined, NULL);
@ -4552,8 +4552,8 @@ void ScintillaEditView::removeAnyDuplicateLines()
const auto startPos = execute(SCI_POSITIONFROMLINE, fromLine); const auto startPos = execute(SCI_POSITIONFROMLINE, fromLine);
const auto endPos = execute(SCI_POSITIONFROMLINE, toLine) + execute(SCI_LINELENGTH, toLine); const auto endPos = execute(SCI_POSITIONFROMLINE, toLine) + execute(SCI_LINELENGTH, toLine);
const generic_string text = getGenericTextAsString(startPos, endPos); const wstring text = getGenericTextAsString(startPos, endPos);
std::vector<generic_string> linesVect; std::vector<wstring> linesVect;
stringSplit(text, getEOLString(), linesVect); stringSplit(text, getEOLString(), linesVect);
const size_t lineCount = execute(SCI_GETLINECOUNT); const size_t lineCount = execute(SCI_GETLINECOUNT);
@ -4570,7 +4570,7 @@ void ScintillaEditView::removeAnyDuplicateLines()
size_t newSize = vecRemoveDuplicates(linesVect); size_t newSize = vecRemoveDuplicates(linesVect);
if (origSize != newSize) if (origSize != newSize)
{ {
generic_string joined; wstring joined;
stringJoin(linesVect, getEOLString(), joined); stringJoin(linesVect, getEOLString(), joined);
if (!doingEntireDocument) if (!doingEntireDocument)
{ {
@ -4590,7 +4590,7 @@ bool ScintillaEditView::pasteToMultiSelection() const
return false; return false;
// "MSDEVColumnSelect" is column format from Scintilla // "MSDEVColumnSelect" is column format from Scintilla
CLIPFORMAT cfColumnSelect = static_cast<CLIPFORMAT>(::RegisterClipboardFormat(TEXT("MSDEVColumnSelect"))); CLIPFORMAT cfColumnSelect = static_cast<CLIPFORMAT>(::RegisterClipboardFormat(L"MSDEVColumnSelect"));
if (!::IsClipboardFormatAvailable(cfColumnSelect) || !::OpenClipboard(NULL)) if (!::IsClipboardFormatAvailable(cfColumnSelect) || !::OpenClipboard(NULL))
return false; return false;
@ -4608,7 +4608,7 @@ bool ScintillaEditView::pasteToMultiSelection() const
return false; return false;
} }
wstring clipboardStr = static_cast<const TCHAR*>(clipboardDataPtr); wstring clipboardStr = static_cast<const wchar_t*>(clipboardDataPtr);
::GlobalUnlock(clipboardData); ::GlobalUnlock(clipboardData);
::CloseClipboard(); ::CloseClipboard();

View File

@ -388,9 +388,9 @@ struct SortInPositionOrder {
typedef std::vector<ColumnModeInfo> ColumnModeInfos; typedef std::vector<ColumnModeInfo> ColumnModeInfos;
struct LanguageNameInfo { struct LanguageNameInfo {
const TCHAR* _langName = nullptr; const wchar_t* _langName = nullptr;
const TCHAR* _shortName = nullptr; const wchar_t* _shortName = nullptr;
const TCHAR* _longName = nullptr; const wchar_t* _longName = nullptr;
LangType _langID = L_TEXT; LangType _langID = L_TEXT;
const char* _lexerID = nullptr; const char* _lexerID = nullptr;
}; };
@ -451,10 +451,10 @@ public:
void syncFoldStateWith(const std::vector<size_t> & lineStateVectorNew); void syncFoldStateWith(const std::vector<size_t> & lineStateVectorNew);
void getText(char *dest, size_t start, size_t end) const; void getText(char *dest, size_t start, size_t end) const;
void getGenericText(TCHAR *dest, size_t destlen, size_t start, size_t end) const; void getGenericText(wchar_t *dest, size_t destlen, size_t start, size_t end) const;
void getGenericText(TCHAR *dest, size_t deslen, size_t start, size_t end, intptr_t* mstart, intptr_t* mend) const; void getGenericText(wchar_t *dest, size_t deslen, size_t start, size_t end, intptr_t* mstart, intptr_t* mend) const;
generic_string getGenericTextAsString(size_t start, size_t end) const; std::wstring getGenericTextAsString(size_t start, size_t end) const;
void insertGenericTextFrom(size_t position, const TCHAR *text2insert) const; void insertGenericTextFrom(size_t position, const wchar_t *text2insert) const;
void replaceSelWith(const char * replaceText); void replaceSelWith(const char * replaceText);
intptr_t getSelectedTextCount() { intptr_t getSelectedTextCount() {
@ -466,18 +466,18 @@ public:
char * getWordFromRange(char * txt, size_t size, size_t pos1, size_t pos2); char * getWordFromRange(char * txt, size_t size, size_t pos1, size_t pos2);
char * getSelectedText(char * txt, size_t size, bool expand = true); char * getSelectedText(char * txt, size_t size, bool expand = true);
char * getWordOnCaretPos(char * txt, size_t size); char * getWordOnCaretPos(char * txt, size_t size);
TCHAR * getGenericWordOnCaretPos(TCHAR * txt, int size); wchar_t * getGenericWordOnCaretPos(wchar_t * txt, int size);
TCHAR * getGenericSelectedText(TCHAR * txt, int size, bool expand = true); wchar_t * getGenericSelectedText(wchar_t * txt, int size, bool expand = true);
intptr_t searchInTarget(const TCHAR * Text2Find, size_t lenOfText2Find, size_t fromPos, size_t toPos) const; intptr_t searchInTarget(const wchar_t * Text2Find, size_t lenOfText2Find, size_t fromPos, size_t toPos) const;
void appandGenericText(const TCHAR * text2Append) const; void appandGenericText(const wchar_t * text2Append) const;
void addGenericText(const TCHAR * text2Append) const; void addGenericText(const wchar_t * text2Append) const;
void addGenericText(const TCHAR * text2Append, intptr_t* mstart, intptr_t* mend) const; void addGenericText(const wchar_t * text2Append, intptr_t* mstart, intptr_t* mend) const;
intptr_t replaceTarget(const TCHAR * str2replace, intptr_t fromTargetPos = -1, intptr_t toTargetPos = -1) const; intptr_t replaceTarget(const wchar_t * str2replace, intptr_t fromTargetPos = -1, intptr_t toTargetPos = -1) const;
intptr_t replaceTargetRegExMode(const TCHAR * re, intptr_t fromTargetPos = -1, intptr_t toTargetPos = -1) const; intptr_t replaceTargetRegExMode(const wchar_t * re, intptr_t fromTargetPos = -1, intptr_t toTargetPos = -1) const;
void showAutoComletion(size_t lenEntered, const TCHAR * list); void showAutoComletion(size_t lenEntered, const wchar_t * list);
void showCallTip(size_t startPos, const TCHAR * def); void showCallTip(size_t startPos, const wchar_t * def);
generic_string getLine(size_t lineNumber); std::wstring getLine(size_t lineNumber);
void getLine(size_t lineNumber, TCHAR * line, size_t lineBufferLen); void getLine(size_t lineNumber, wchar_t * line, size_t lineBufferLen);
void addText(size_t length, const char *buf); void addText(size_t length, const char *buf);
void insertNewLineAboveCurrentLine(); void insertNewLineAboveCurrentLine();
@ -503,7 +503,7 @@ public:
return crange; return crange;
}; };
void getWordToCurrentPos(TCHAR * str, intptr_t strLen) const { void getWordToCurrentPos(wchar_t * str, intptr_t strLen) const {
auto caretPos = execute(SCI_GETCURRENTPOS); auto caretPos = execute(SCI_GETCURRENTPOS);
auto startPos = execute(SCI_WORDSTARTPOSITION, caretPos, true); auto startPos = execute(SCI_WORDSTARTPOSITION, caretPos, true);
@ -765,7 +765,7 @@ public:
if ((NppParameters::getInstance()).isTransparentAvailable()) if ((NppParameters::getInstance()).isTransparentAvailable())
convertSelectedTextTo(caseToConvert); convertSelectedTextTo(caseToConvert);
else else
::MessageBox(_hSelf, TEXT("This function needs a newer OS version."), TEXT("Change Case Error"), MB_OK | MB_ICONHAND); ::MessageBox(_hSelf, L"This function needs a newer OS version.", L"Change Case Error", MB_OK | MB_ICONHAND);
}; };
bool isFoldIndentationBased() const; bool isFoldIndentationBased() const;
@ -782,7 +782,7 @@ public:
ColumnModeInfos getColumnModeSelectInfo(); ColumnModeInfos getColumnModeSelectInfo();
void columnReplace(ColumnModeInfos & cmi, const TCHAR *str); void columnReplace(ColumnModeInfos & cmi, const wchar_t *str);
void columnReplace(ColumnModeInfos & cmi, size_t initial, size_t incr, size_t repeat, UCHAR format, ColumnEditorParam::leadingChoice lead); void columnReplace(ColumnModeInfos & cmi, size_t initial, size_t incr, size_t repeat, UCHAR format, ColumnEditorParam::leadingChoice lead);
void clearIndicator(int indicatorNumber) { void clearIndicator(int indicatorNumber) {
@ -859,7 +859,7 @@ public:
(_codepage == CP_JAPANESE) || (_codepage == CP_KOREAN)); (_codepage == CP_JAPANESE) || (_codepage == CP_KOREAN));
}; };
void scrollPosToCenter(size_t pos); void scrollPosToCenter(size_t pos);
generic_string getEOLString() const; std::wstring getEOLString() const;
void setBorderEdge(bool doWithBorderEdge); void setBorderEdge(bool doWithBorderEdge);
void sortLines(size_t fromLine, size_t toLine, ISorter *pSort); void sortLines(size_t fromLine, size_t toLine, ISorter *pSort);
void changeTextDirection(bool isRTL); void changeTextDirection(bool isRTL);
@ -913,7 +913,7 @@ protected:
void setKeywords(LangType langType, const char *keywords, int index); void setKeywords(LangType langType, const char *keywords, int index);
void setLexer(LangType langID, int whichList); void setLexer(LangType langID, int whichList);
bool setLexerFromLangID(int langID); bool setLexerFromLangID(int langID);
void makeStyle(LangType langType, const TCHAR **keywordArray = NULL); void makeStyle(LangType langType, const wchar_t **keywordArray = NULL);
void setStyle(Style styleToSet); //NOT by reference (style edited) void setStyle(Style styleToSet); //NOT by reference (style edited)
void setSpecialStyle(const Style & styleToSet); //by reference void setSpecialStyle(const Style & styleToSet); //by reference
void setSpecialIndicator(const Style & styleToSet) { void setSpecialIndicator(const Style & styleToSet) {
@ -927,7 +927,7 @@ protected:
void setJsLexer(); void setJsLexer();
void setTclLexer(); void setTclLexer();
void setObjCLexer(LangType type); void setObjCLexer(LangType type);
void setUserLexer(const TCHAR *userLangName = NULL); void setUserLexer(const wchar_t *userLangName = NULL);
void setExternalLexer(LangType typeDoc); void setExternalLexer(LangType typeDoc);
void setEmbeddedJSLexer(); void setEmbeddedJSLexer();
void setEmbeddedPhpLexer(); void setEmbeddedPhpLexer();
@ -1000,7 +1000,7 @@ protected:
void setTeXLexer() { void setTeXLexer() {
for (int i = 0 ; i < 4 ; ++i) for (int i = 0 ; i < 4 ; ++i)
execute(SCI_SETKEYWORDS, i, reinterpret_cast<LPARAM>(TEXT(""))); execute(SCI_SETKEYWORDS, i, reinterpret_cast<LPARAM>(L""));
setLexer(L_TEX, LIST_NONE); setLexer(L_TEX, LIST_NONE);
}; };

View File

@ -263,9 +263,9 @@ void StaticDialog::create(int dialogID, bool isRTL, bool msgDestParent)
if (!_hSelf) if (!_hSelf)
{ {
generic_string errMsg = TEXT("CreateDialogParam() return NULL.\rGetLastError(): "); std::wstring errMsg = L"CreateDialogParam() return NULL.\rGetLastError(): ";
errMsg += GetLastErrorAsString(); errMsg += GetLastErrorAsString();
::MessageBox(NULL, errMsg.c_str(), TEXT("In StaticDialog::create()"), MB_OK); ::MessageBox(NULL, errMsg.c_str(), L"In StaticDialog::create()", MB_OK);
return; return;
} }

View File

@ -266,7 +266,7 @@ void StatusBar::init(HINSTANCE hInst, HWND hPere, int nbParts)
_hSelf = ::CreateWindowEx( _hSelf = ::CreateWindowEx(
0, 0,
STATUSCLASSNAME, STATUSCLASSNAME,
TEXT(""), L"",
WS_CHILD | SBARS_SIZEGRIP , WS_CHILD | SBARS_SIZEGRIP ,
0, 0, 0, 0, 0, 0, 0, 0,
_hParent, nullptr, _hInst, 0); _hParent, nullptr, _hInst, 0);
@ -344,7 +344,7 @@ void StatusBar::adjustParts(int clientWidth)
} }
bool StatusBar::setText(const TCHAR* str, int whichPart) bool StatusBar::setText(const wchar_t* str, int whichPart)
{ {
if ((size_t) whichPart < _partWidthArray.size()) if ((size_t) whichPart < _partWidthArray.size())
{ {
@ -360,7 +360,7 @@ bool StatusBar::setText(const TCHAR* str, int whichPart)
} }
bool StatusBar::setOwnerDrawText(const TCHAR* str) bool StatusBar::setOwnerDrawText(const wchar_t* str)
{ {
if (str != nullptr) if (str != nullptr)
_lastSetText = str; _lastSetText = str;