Remove ambiguous symbols (part 4)

Relace TCHAR, generic_string & TEXT("") par wchar_t, wstring & L"" respectively.
Follow up: 94af271
This commit is contained in:
Don Ho 2024-06-30 01:10:36 +02:00
parent 10deb9970c
commit 97279d024f
4 changed files with 2301 additions and 2299 deletions

View File

@ -35,7 +35,7 @@ using namespace std;
// https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file
// Reserved characters: < > : " / \ | ? * tab
// ("tab" is not in the official list, but it is good to avoid it)
const std::wstring filenameReservedChars = TEXT("<>:\"/\\|\?*\t");
const std::wstring filenameReservedChars = L"<>:\"/\\|\?*\t";
DWORD WINAPI Notepad_plus::monitorFileOnChange(void * params)
{
@ -43,7 +43,7 @@ DWORD WINAPI Notepad_plus::monitorFileOnChange(void * params)
Buffer *buf = monitorInfo->_buffer;
HWND h = monitorInfo->_nppHandle;
const TCHAR *fullFileName = (const TCHAR *)buf->getFullPathName();
const wchar_t *fullFileName = (const wchar_t *)buf->getFullPathName();
//The folder to watch :
WCHAR folderToMonitor[MAX_PATH]{};
@ -80,14 +80,14 @@ DWORD WINAPI Notepad_plus::monitorFileOnChange(void * params)
// We've received a notification in the queue.
{
DWORD dwAction = 0;
generic_string fn;
wstring fn;
// Process all available changes, ignore User actions
while (dirChanges.Pop(dwAction, fn))
{
// Fix monitoring files which are under root problem
size_t pos = fn.find(TEXT("\\\\"));
size_t pos = fn.find(L"\\\\");
if (pos == 2)
fn.replace(pos, 2, TEXT("\\"));
fn.replace(pos, 2, L"\\");
if (wcscmp(fullFileName, fn.c_str()) == 0)
{
@ -177,13 +177,13 @@ bool resolveLinkFile(std::wstring& linkFilePath)
return isResolved;
}
BufferID Notepad_plus::doOpen(const generic_string& fileName, bool isRecursive, bool isReadOnly, int encoding, const TCHAR *backupFileName, FILETIME fileNameTimestamp)
BufferID Notepad_plus::doOpen(const wstring& fileName, bool isRecursive, bool isReadOnly, int encoding, const wchar_t *backupFileName, FILETIME fileNameTimestamp)
{
const rsize_t longFileNameBufferSize = MAX_PATH; // TODO stop using fixed-size buffer
if (fileName.size() >= longFileNameBufferSize - 1) // issue with all other sub-routines
return BUFFER_INVALID;
generic_string targetFileName = fileName;
wstring targetFileName = fileName;
bool isResolvedLinkFileName = resolveLinkFile(targetFileName);
bool isRawFileName;
@ -201,8 +201,8 @@ BufferID Notepad_plus::doOpen(const generic_string& fileName, bool isRecursive,
//{
// int answer = _nativeLangSpeaker.messageBox("OpenNonconformingWin32FileName",
// _pPublicInterface->getHSelf(),
// TEXT("You are about to open a file with unusual filename:\n\"$STR_REPLACE$\""),
// TEXT("Open Nonconforming Win32-Filename"),
// L"You are about to open a file with unusual filename:\n\"$STR_REPLACE$\"",
// L"Open Nonconforming Win32-Filename",
// MB_OKCANCEL | MB_ICONWARNING | MB_APPLMODAL,
// 0,
// isResolvedLinkFileName ? targetFileName.c_str() : fileName.c_str());
@ -214,8 +214,8 @@ BufferID Notepad_plus::doOpen(const generic_string& fileName, bool isRecursive,
// unsupported, use the existing Notepad++ file dialog to report
_nativeLangSpeaker.messageBox("OpenFileError",
_pPublicInterface->getHSelf(),
TEXT("Cannot open file \"$STR_REPLACE$\"."),
TEXT("ERROR"),
L"Cannot open file \"$STR_REPLACE$\".",
L"ERROR",
MB_OK,
0,
isResolvedLinkFileName ? targetFileName.c_str() : fileName.c_str());
@ -262,8 +262,8 @@ BufferID Notepad_plus::doOpen(const generic_string& fileName, bool isRecursive,
}
_lastRecentFileList.remove(longFileName);
generic_string fileName2Find;
generic_string gs_fileName{ targetFileName };
wstring fileName2Find;
wstring gs_fileName{ targetFileName };
// "fileName" could be:
@ -321,15 +321,15 @@ BufferID Notepad_plus::doOpen(const generic_string& fileName, bool isRecursive,
bool globbing;
if (isRawFileName)
globbing = (wcsrchr(longFileName, TCHAR('*')) || (abs(longFileName - wcsrchr(longFileName, TCHAR('?'))) > 3));
globbing = (wcsrchr(longFileName, wchar_t('*')) || (abs(longFileName - wcsrchr(longFileName, wchar_t('?'))) > 3));
else
globbing = (wcsrchr(longFileName, TCHAR('*')) || wcsrchr(longFileName, TCHAR('?')));
globbing = (wcsrchr(longFileName, wchar_t('*')) || wcsrchr(longFileName, wchar_t('?')));
if (!isSnapshotMode) // if not backup mode, or backupfile path is invalid
{
if (!PathFileExists(longFileName) && !globbing)
{
generic_string longFileDir(longFileName);
wstring longFileDir(longFileName);
PathRemoveFileSpec(longFileDir);
bool isCreateFileSuccessful = false;
@ -337,8 +337,8 @@ BufferID Notepad_plus::doOpen(const generic_string& fileName, bool isRecursive,
{
int res = _nativeLangSpeaker.messageBox("CreateNewFileOrNot",
_pPublicInterface->getHSelf(),
TEXT("\"$STR_REPLACE$\" doesn't exist. Create it?"),
TEXT("Create new file"),
L"\"$STR_REPLACE$\" doesn't exist. Create it?",
L"Create new file",
MB_YESNO,
0,
longFileName);
@ -354,8 +354,8 @@ BufferID Notepad_plus::doOpen(const generic_string& fileName, bool isRecursive,
{
_nativeLangSpeaker.messageBox("CreateNewFileError",
_pPublicInterface->getHSelf(),
TEXT("Cannot create the file \"$STR_REPLACE$\"."),
TEXT("Create new file"),
L"Cannot create the file \"$STR_REPLACE$\".",
L"Create new file",
MB_OK,
0,
longFileName);
@ -364,20 +364,20 @@ BufferID Notepad_plus::doOpen(const generic_string& fileName, bool isRecursive,
}
else
{
generic_string msg, title;
wstring msg, title;
if (!_nativeLangSpeaker.getMsgBoxLang("OpenFileNoFolderError", title, msg))
{
title = TEXT("Cannot open file");
msg = TEXT("\"");
title = L"Cannot open file";
msg = L"\"";
msg += longFileName;
msg += TEXT("\" cannot be opened:\nFolder \"");
msg += L"\" cannot be opened:\nFolder \"";
msg += longFileDir;
msg += TEXT("\" doesn't exist.");
msg += L"\" doesn't exist.";
}
else
{
msg = stringReplace(msg, TEXT("$STR_REPLACE1$"), longFileName);
msg = stringReplace(msg, TEXT("$STR_REPLACE2$"), longFileDir);
msg = stringReplace(msg, L"$STR_REPLACE1$", longFileName);
msg = stringReplace(msg, L"$STR_REPLACE2$", longFileDir);
}
::MessageBox(_pPublicInterface->getHSelf(), msg.c_str(), title.c_str(), MB_OK);
}
@ -475,17 +475,17 @@ BufferID Notepad_plus::doOpen(const generic_string& fileName, bool isRecursive,
{
if (globbing || ::PathIsDirectory(targetFileName.c_str()))
{
vector<generic_string> fileNames;
vector<generic_string> patterns;
vector<wstring> fileNames;
vector<wstring> patterns;
if (globbing)
{
const TCHAR * substring = wcsrchr(targetFileName.c_str(), TCHAR('\\'));
const wchar_t * substring = wcsrchr(targetFileName.c_str(), wchar_t('\\'));
if (substring)
{
size_t pos = substring - targetFileName.c_str();
patterns.push_back(substring + 1);
generic_string dir(targetFileName.c_str(), pos + 1); // use char * to evoke:
wstring dir(targetFileName.c_str(), pos + 1); // use char * to evoke:
// string (const char* s, size_t n);
// and avoid to call (if pass string) :
// string (const string& str, size_t pos, size_t len = npos);
@ -495,11 +495,11 @@ BufferID Notepad_plus::doOpen(const generic_string& fileName, bool isRecursive,
}
else
{
generic_string fileNameStr = targetFileName;
wstring fileNameStr = targetFileName;
if (targetFileName[targetFileName.size() - 1] != '\\')
fileNameStr += TEXT("\\");
fileNameStr += L"\\";
patterns.push_back(TEXT("*"));
patterns.push_back(L"*");
getMatchedFileNames(fileNameStr.c_str(), 0, patterns, fileNames, true, false);
}
@ -510,8 +510,8 @@ BufferID Notepad_plus::doOpen(const generic_string& fileName, bool isRecursive,
{
ok2Open = IDYES == _nativeLangSpeaker.messageBox("NbFileToOpenImportantWarning",
_pPublicInterface->getHSelf(),
TEXT("$INT_REPLACE$ files are about to be opened.\rAre you sure to open them?"),
TEXT("Amount of files to open is too large"),
L"$INT_REPLACE$ files are about to be opened.\rAre you sure to open them?",
L"Amount of files to open is too large",
MB_YESNO|MB_APPLMODAL,
static_cast<int32_t>(nbFiles2Open));
}
@ -526,8 +526,8 @@ BufferID Notepad_plus::doOpen(const generic_string& fileName, bool isRecursive,
{
_nativeLangSpeaker.messageBox("OpenFileError",
_pPublicInterface->getHSelf(),
TEXT("Can not open file \"$STR_REPLACE$\"."),
TEXT("ERROR"),
L"Can not open file \"$STR_REPLACE$\".",
L"ERROR",
MB_OK,
0,
longFileName);
@ -554,8 +554,8 @@ bool Notepad_plus::doReload(BufferID id, bool alert)
{
int answer = _nativeLangSpeaker.messageBox("DocReloadWarning",
_pPublicInterface->getHSelf(),
TEXT("Are you sure you want to reload the current file and lose the changes made in Notepad++?"),
TEXT("Reload"),
L"Are you sure you want to reload the current file and lose the changes made in Notepad++?",
L"Reload",
MB_YESNO | MB_ICONEXCLAMATION | MB_APPLMODAL);
if (answer != IDYES)
return false;
@ -607,15 +607,15 @@ bool Notepad_plus::doReload(BufferID id, bool alert)
return res;
}
bool Notepad_plus::doSave(BufferID id, const TCHAR * filename, bool isCopy)
bool Notepad_plus::doSave(BufferID id, const wchar_t * filename, bool isCopy)
{
const int index = MainFileManager.getBufferIndexByID(id);
if (index == -1)
{
_nativeLangSpeaker.messageBox("BufferInvalidWarning",
_pPublicInterface->getHSelf(),
TEXT("Cannot save: Buffer is invalid."),
TEXT("Save failed"),
L"Cannot save: Buffer is invalid.",
L"Save failed",
MB_OK | MB_ICONWARNING);
return false;
@ -644,14 +644,14 @@ bool Notepad_plus::doSave(BufferID id, const TCHAR * filename, bool isCopy)
{
_nativeLangSpeaker.messageBox("NotEnoughRoom4Saving",
_pPublicInterface->getHSelf(),
TEXT("Failed to save file.\nIt seems there's not enough space on disk to save file. Your file is not saved."),
TEXT("Save failed"),
L"Failed to save file.\nIt seems there's not enough space on disk to save file. Your file is not saved.",
L"Save failed",
MB_OK);
}
else if (res == SavingStatus::SaveWritingFailed)
{
wstring errorMessage = GetLastErrorAsString(GetLastError());
::MessageBox(_pPublicInterface->getHSelf(), errorMessage.c_str(), TEXT("Save failed"), MB_OK | MB_ICONWARNING);
::MessageBox(_pPublicInterface->getHSelf(), errorMessage.c_str(), L"Save failed", MB_OK | MB_ICONWARNING);
}
else if (res == SavingStatus::SaveOpenFailed)
{
@ -660,8 +660,8 @@ bool Notepad_plus::doSave(BufferID id, const TCHAR * filename, bool isCopy)
// Already in admin mode? File is probably locked.
_nativeLangSpeaker.messageBox("FileLockedWarning",
_pPublicInterface->getHSelf(),
TEXT("Please check whether if this file is opened in another program"),
TEXT("Save failed"),
L"Please check whether if this file is opened in another program",
L"Save failed",
MB_OK | MB_ICONWARNING);
}
else
@ -675,17 +675,17 @@ bool Notepad_plus::doSave(BufferID id, const TCHAR * filename, bool isCopy)
int openInAdminModeRes = _nativeLangSpeaker.messageBox("OpenInAdminMode",
_pPublicInterface->getHSelf(),
TEXT("This file cannot be saved and it may be protected.\rDo you want to launch Notepad++ in Administrator mode?"),
TEXT("Save failed"),
L"This file cannot be saved and it may be protected.\rDo you want to launch Notepad++ in Administrator mode?",
L"Save failed",
MB_YESNO);
if (openInAdminModeRes == IDYES)
{
TCHAR nppFullPath[MAX_PATH]{};
wchar_t nppFullPath[MAX_PATH]{};
::GetModuleFileName(NULL, nppFullPath, MAX_PATH);
generic_string args = TEXT("-multiInst");
size_t shellExecRes = (size_t)::ShellExecute(_pPublicInterface->getHSelf(), TEXT("runas"), nppFullPath, args.c_str(), TEXT("."), SW_SHOW);
wstring args = L"-multiInst";
size_t shellExecRes = (size_t)::ShellExecute(_pPublicInterface->getHSelf(), L"runas", nppFullPath, args.c_str(), L".", SW_SHOW);
// If the function succeeds, it returns a value greater than 32. If the function fails,
// it returns an error value that indicates the cause of the failure.
@ -695,8 +695,8 @@ bool Notepad_plus::doSave(BufferID id, const TCHAR * filename, bool isCopy)
{
_nativeLangSpeaker.messageBox("OpenInAdminModeFailed",
_pPublicInterface->getHSelf(),
TEXT("Notepad++ cannot be opened in Administrator mode."),
TEXT("Open in Administrator mode failed"),
L"Notepad++ cannot be opened in Administrator mode.",
L"Open in Administrator mode failed",
MB_OK);
}
else
@ -711,26 +711,26 @@ bool Notepad_plus::doSave(BufferID id, const TCHAR * filename, bool isCopy)
int openInAdminModeRes = _nativeLangSpeaker.messageBox("OpenInAdminModeWithoutCloseCurrent",
_pPublicInterface->getHSelf(),
TEXT("The file cannot be saved and it may be protected.\rDo you want to launch Notepad++ in Administrator mode?"),
TEXT("Save failed"),
L"The file cannot be saved and it may be protected.\rDo you want to launch Notepad++ in Administrator mode?",
L"Save failed",
MB_YESNO);
if (openInAdminModeRes == IDYES)
{
TCHAR nppFullPath[MAX_PATH]{};
wchar_t nppFullPath[MAX_PATH]{};
::GetModuleFileName(NULL, nppFullPath, MAX_PATH);
BufferID bufferID = _pEditView->getCurrentBufferID();
Buffer * buf = MainFileManager.getBufferByID(bufferID);
//process the fileNamePath into LRF
generic_string fileNamePath = buf->getFullPathName();
wstring fileNamePath = buf->getFullPathName();
generic_string args = TEXT("-multiInst -nosession ");
args += TEXT("\"");
wstring args = L"-multiInst -nosession ";
args += L"\"";
args += fileNamePath;
args += TEXT("\"");
size_t shellExecRes = (size_t)::ShellExecute(_pPublicInterface->getHSelf(), TEXT("runas"), nppFullPath, args.c_str(), TEXT("."), SW_SHOW);
args += L"\"";
size_t shellExecRes = (size_t)::ShellExecute(_pPublicInterface->getHSelf(), L"runas", nppFullPath, args.c_str(), L".", SW_SHOW);
// If the function succeeds, it returns a value greater than 32. If the function fails,
// it returns an error value that indicates the cause of the failure.
@ -740,8 +740,8 @@ bool Notepad_plus::doSave(BufferID id, const TCHAR * filename, bool isCopy)
{
_nativeLangSpeaker.messageBox("OpenInAdminModeFailed",
_pPublicInterface->getHSelf(),
TEXT("Notepad++ cannot be opened in Administrator mode."),
TEXT("Open in Administrator mode failed"),
L"Notepad++ cannot be opened in Administrator mode.",
L"Open in Administrator mode failed",
MB_OK);
}
}
@ -784,14 +784,14 @@ void Notepad_plus::doClose(BufferID id, int whichOne, bool doDeleteBackup)
// Add to recent file history only if file is removed from all the views
// There might be cases when file is cloned/moved to view.
// Don't add to recent list unless file is removed from all the views
generic_string fileFullPath;
wstring fileFullPath;
if (!buf->isUntitled())
{
// if the file doesn't exist, it could be redirected
// So we turn Wow64 off
bool isWow64Off = false;
NppParameters& nppParam = NppParameters::getInstance();
const TCHAR *fn = buf->getFullPathName();
const wchar_t *fn = buf->getFullPathName();
if (!PathFileExists(fn))
{
nppParam.safeWow64EnableWow64FsRedirection(FALSE);
@ -868,11 +868,11 @@ void Notepad_plus::doClose(BufferID id, int whichOne, bool doDeleteBackup)
return;
}
generic_string Notepad_plus::exts2Filters(const generic_string& exts, int maxExtsLen) const
wstring Notepad_plus::exts2Filters(const wstring& exts, int maxExtsLen) const
{
const TCHAR *extStr = exts.c_str();
TCHAR aExt[MAX_PATH] = { '\0' };
generic_string filters(TEXT(""));
const wchar_t *extStr = exts.c_str();
wchar_t aExt[MAX_PATH] = { '\0' };
wstring filters(L"");
int j = 0;
bool stop = false;
@ -888,15 +888,15 @@ generic_string Notepad_plus::exts2Filters(const generic_string& exts, int maxExt
if (aExt[0])
{
filters += TEXT("*.");
filters += L"*.";
filters += aExt;
filters += TEXT(";");
filters += L";";
}
j = 0;
if (maxExtsLen != -1 && i >= static_cast<size_t>(maxExtsLen))
{
filters += TEXT(" ... ");
filters += L" ... ";
break;
}
}
@ -914,9 +914,9 @@ generic_string Notepad_plus::exts2Filters(const generic_string& exts, int maxExt
aExt[j] = '\0';
if (aExt[0])
{
filters += TEXT("*.");
filters += L"*.";
filters += aExt;
filters += TEXT(";");
filters += L";";
}
}
@ -952,27 +952,27 @@ int Notepad_plus::setFileOpenSaveDlgFilters(CustomFileDialog & fDlg, bool showAl
if (!inExcludedList)
{
const TCHAR *defList = l->getDefaultExtList();
const TCHAR *userList = NULL;
const wchar_t *defList = l->getDefaultExtList();
const wchar_t *userList = NULL;
LexerStylerArray &lsa = (NppParameters::getInstance()).getLStylerArray();
const TCHAR *lName = l->getLangName();
const wchar_t *lName = l->getLangName();
LexerStyler *pLS = lsa.getLexerStylerByName(lName);
if (pLS)
userList = pLS->getLexerUserExt();
generic_string list(TEXT(""));
wstring list(L"");
if (defList)
list += defList;
if (userList)
{
list += TEXT(" ");
list += L" ";
list += userList;
}
generic_string stringFilters = exts2Filters(list, showAllExt ? -1 : 40);
const TCHAR *filters = stringFilters.c_str();
wstring stringFilters = exts2Filters(list, showAllExt ? -1 : 40);
const wchar_t *filters = stringFilters.c_str();
if (filters[0])
{
fDlg.setExtFilter(getLangDesc(lid, false).c_str(), filters);
@ -1013,7 +1013,7 @@ bool Notepad_plus::fileClose(BufferID id, int curView)
}
else if (buf->isDirty())
{
const TCHAR* fileNamePath = buf->getFullPathName();
const wchar_t* fileNamePath = buf->getFullPathName();
int res = doSaveOrNot(fileNamePath);
if (res == IDYES)
@ -1068,7 +1068,7 @@ bool Notepad_plus::fileCloseAll(bool doDeleteBackup, bool isSnapshotMode)
{
if (isSnapshotMode)
{
if (buf->getBackupFileName() == TEXT("") || !::PathFileExists(buf->getBackupFileName().c_str())) //backup file has been deleted from outside
if (buf->getBackupFileName() == L"" || !::PathFileExists(buf->getBackupFileName().c_str())) //backup file has been deleted from outside
{
// warning user and save it if user want it.
activateBuffer(id, MAIN_VIEW);
@ -1077,8 +1077,8 @@ bool Notepad_plus::fileCloseAll(bool doDeleteBackup, bool isSnapshotMode)
int res = _nativeLangSpeaker.messageBox("NoBackupDoSaveFile",
_pPublicInterface->getHSelf(),
TEXT("Your backup file cannot be found (deleted from outside).\rSave it otherwise your data will be lost\rDo you want to save file \"$STR_REPLACE$\" ?"),
TEXT("Save"),
L"Your backup file cannot be found (deleted from outside).\rSave it otherwise your data will be lost\rDo you want to save file \"$STR_REPLACE$\" ?",
L"Save",
MB_YESNOCANCEL | MB_ICONQUESTION | MB_APPLMODAL,
0, // not used
buf->getFullPathName());
@ -1152,7 +1152,7 @@ bool Notepad_plus::fileCloseAll(bool doDeleteBackup, bool isSnapshotMode)
{
if (isSnapshotMode)
{
if (buf->getBackupFileName() == TEXT("") || !::PathFileExists(buf->getBackupFileName().c_str())) //backup file has been deleted from outside
if (buf->getBackupFileName() == L"" || !::PathFileExists(buf->getBackupFileName().c_str())) //backup file has been deleted from outside
{
// warning user and save it if user want it.
activateBuffer(id, SUB_VIEW);
@ -1160,8 +1160,8 @@ bool Notepad_plus::fileCloseAll(bool doDeleteBackup, bool isSnapshotMode)
int res = _nativeLangSpeaker.messageBox("NoBackupDoSaveFile",
_pPublicInterface->getHSelf(),
TEXT("Your backup file cannot be found (deleted from outside).\rSave it otherwise your data will be lost\rDo you want to save file \"$STR_REPLACE$\" ?"),
TEXT("Save"),
L"Your backup file cannot be found (deleted from outside).\rSave it otherwise your data will be lost\rDo you want to save file \"$STR_REPLACE$\" ?",
L"Save",
MB_YESNOCANCEL | MB_ICONQUESTION | MB_APPLMODAL,
0, // not used
buf->getFullPathName());
@ -1588,34 +1588,34 @@ bool Notepad_plus::fileSave(BufferID id)
if (backup != bak_none && !buf->isLargeFile())
{
const TCHAR *fn = buf->getFullPathName();
TCHAR *name = ::PathFindFileName(fn);
generic_string fn_bak;
const wchar_t *fn = buf->getFullPathName();
wchar_t *name = ::PathFindFileName(fn);
wstring fn_bak;
if (nppgui._useDir && !nppgui._backupDir.empty())
{
// Get the custom directory, make sure it has a trailing slash
fn_bak = nppgui._backupDir;
if (fn_bak.back() != TEXT('\\'))
fn_bak += TEXT("\\");
if (fn_bak.back() != L'\\')
fn_bak += L"\\";
}
else
{
// Get the current file's directory
generic_string path = fn;
wstring path = fn;
::PathRemoveFileSpec(path);
fn_bak = path.c_str();
fn_bak += TEXT("\\");
fn_bak += L"\\";
// If verbose, save it in a sub folder
if (backup == bak_verbose)
{
fn_bak += TEXT("nppBackup\\");
fn_bak += L"nppBackup\\";
}
}
// Expand any environment variables
TCHAR fn_bak_expanded[MAX_PATH] = { '\0' };
wchar_t fn_bak_expanded[MAX_PATH] = { '\0' };
::ExpandEnvironmentStrings(fn_bak.c_str(), fn_bak_expanded, MAX_PATH);
fn_bak = fn_bak_expanded;
@ -1629,12 +1629,12 @@ bool Notepad_plus::fileSave(BufferID id)
if (backup == bak_simple)
{
fn_bak += name;
fn_bak += TEXT(".bak");
fn_bak += L".bak";
}
else if (backup == bak_verbose)
{
constexpr int temBufLen = 32;
TCHAR tmpbuf[temBufLen]{};
wchar_t tmpbuf[temBufLen]{};
time_t ltime = time(0);
const struct tm* today;
@ -1644,9 +1644,9 @@ bool Notepad_plus::fileSave(BufferID id)
wcsftime(tmpbuf, temBufLen, L"%Y-%m-%d_%H%M%S", today);
fn_bak += name;
fn_bak += TEXT(".");
fn_bak += L".";
fn_bak += tmpbuf;
fn_bak += TEXT(".bak");
fn_bak += L".bak";
}
}
@ -1655,8 +1655,8 @@ bool Notepad_plus::fileSave(BufferID id)
{
int res = _nativeLangSpeaker.messageBox("FileBackupFailed",
_pPublicInterface->getHSelf(),
TEXT("The previous version of the file could not be saved into the backup directory at \"$STR_REPLACE$\".\r\rDo you want to save the current file anyways?"),
TEXT("File Backup Failed"),
L"The previous version of the file could not be saved into the backup directory at \"$STR_REPLACE$\".\r\rDo you want to save the current file anyways?",
L"File Backup Failed",
MB_YESNO | MB_ICONERROR,
0,
fn_bak.c_str());
@ -1673,7 +1673,7 @@ bool Notepad_plus::fileSave(BufferID id)
return false;
}
bool Notepad_plus::fileSaveSpecific(const generic_string& fileNameToSave)
bool Notepad_plus::fileSaveSpecific(const wstring& fileNameToSave)
{
BufferID idToSave = _mainDocTab.findBufferByName(fileNameToSave.c_str());
if (idToSave == BUFFER_INVALID)
@ -1788,12 +1788,12 @@ bool Notepad_plus::fileSaveAs(BufferID id, bool isSaveCopy)
bufferID = _pEditView->getCurrentBufferID();
Buffer * buf = MainFileManager.getBufferByID(bufferID);
generic_string origPathname = buf->getFullPathName();
wstring origPathname = buf->getFullPathName();
bool wasUntitled = buf->isUntitled();
CustomFileDialog fDlg(_pPublicInterface->getHSelf());
fDlg.setExtFilter(TEXT("All types"), TEXT(".*"));
fDlg.setExtFilter(L"All types", L".*");
LangType langType = buf->getLangType();
@ -1804,7 +1804,7 @@ bool Notepad_plus::fileSaveAs(BufferID id, bool isSaveCopy)
fDlg.setExtIndex(langTypeIndex + 1); // +1 for "All types"
generic_string localizedTitle;
wstring localizedTitle;
if (isSaveCopy)
{
localizedTitle = _nativeLangSpeaker.getNativeLangMenuString(IDM_FILE_SAVECOPYAS, L"Save a Copy As", true);
@ -1815,8 +1815,8 @@ bool Notepad_plus::fileSaveAs(BufferID id, bool isSaveCopy)
}
fDlg.setTitle(localizedTitle.c_str());
const generic_string checkboxLabel = _nativeLangSpeaker.getLocalizedStrFromID("file-save-assign-type",
TEXT("&Append extension"));
const wstring checkboxLabel = _nativeLangSpeaker.getLocalizedStrFromID("file-save-assign-type",
L"&Append extension");
fDlg.enableFileTypeCheckbox(checkboxLabel, !defaultAllTypes);
// Disable file autodetection before opening save dialog to prevent use-after-delete bug.
@ -1824,7 +1824,7 @@ bool Notepad_plus::fileSaveAs(BufferID id, bool isSaveCopy)
auto cdBefore = nppParam.getNppGUI()._fileAutoDetection;
(nppParam.getNppGUI())._fileAutoDetection = cdDisabled;
generic_string fn = fDlg.doSaveDlg();
wstring fn = fDlg.doSaveDlg();
// Remember the selected state
(nppParam.getNppGUI())._setSaveDlgExtFiltToAllTypes = !fDlg.getFileTypeCheckboxValue();
@ -1860,8 +1860,8 @@ bool Notepad_plus::fileSaveAs(BufferID id, bool isSaveCopy)
{
_nativeLangSpeaker.messageBox("FileAlreadyOpenedInNpp",
_pPublicInterface->getHSelf(),
TEXT("The file is already opened in Notepad++."),
TEXT("ERROR"),
L"The file is already opened in Notepad++.",
L"ERROR",
MB_OK | MB_ICONSTOP);
switchToFile(other);
return false;
@ -1892,7 +1892,7 @@ bool Notepad_plus::fileRename(BufferID id)
{
CustomFileDialog fDlg(_pPublicInterface->getHSelf());
fDlg.setExtFilter(TEXT("All types"), TEXT(".*"));
fDlg.setExtFilter(L"All types", L".*");
setFileOpenSaveDlgFilters(fDlg, false);
fDlg.setFolder(buf->getFullPathName());
fDlg.setDefFileName(buf->getFileName());
@ -1964,7 +1964,7 @@ bool Notepad_plus::fileRename(BufferID id)
std::wstring oldBackUpFile = buf->getBackupFileName();
// Change the backup file name and let MainFileManager decide the new filename
buf->setBackupFileName(TEXT(""));
buf->setBackupFileName(L"");
// Create new backup
buf->setModifiedStatus(true);
@ -2033,7 +2033,7 @@ bool Notepad_plus::fileRenameUntitled(BufferID id, const wchar_t* tabNewName)
std::wstring oldBackUpFile = buf->getBackupFileName();
// Change the backup file name and let MainFileManager decide the new filename
buf->setBackupFileName(TEXT(""));
buf->setBackupFileName(L"");
// Create new backup
buf->setModifiedStatus(true);
@ -2057,7 +2057,7 @@ bool Notepad_plus::fileDelete(BufferID id)
bufferID = _pEditView->getCurrentBufferID();
Buffer * buf = MainFileManager.getBufferByID(bufferID);
const TCHAR *fileNamePath = buf->getFullPathName();
const wchar_t *fileNamePath = buf->getFullPathName();
winVer winVersion = (NppParameters::getInstance()).getWinVersion();
bool goAhead = true;
@ -2079,8 +2079,8 @@ bool Notepad_plus::fileDelete(BufferID id)
{
_nativeLangSpeaker.messageBox("DeleteFileFailed",
_pPublicInterface->getHSelf(),
TEXT("Delete File failed"),
TEXT("Delete File"),
L"Delete File failed",
L"Delete File",
MB_OK);
scnN.nmhdr.code = NPPN_FILEDELETEFAILED;
@ -2106,7 +2106,7 @@ void Notepad_plus::fileOpen()
CustomFileDialog fDlg(_pPublicInterface->getHSelf());
wstring localizedTitle = _nativeLangSpeaker.getNativeLangMenuString(IDM_FILE_OPEN, L"Open", true);
fDlg.setTitle(localizedTitle.c_str());
fDlg.setExtFilter(TEXT("All types"), TEXT(".*"));
fDlg.setExtFilter(L"All types", L".*");
setFileOpenSaveDlgFilters(fDlg, true);
@ -2144,19 +2144,19 @@ bool Notepad_plus::fileReload()
}
bool Notepad_plus::isFileSession(const TCHAR * filename)
bool Notepad_plus::isFileSession(const wchar_t * filename)
{
// if file2open matches the ext of user defined session file ext, then it'll be opened as a session
const TCHAR *definedSessionExt = NppParameters::getInstance().getNppGUI()._definedSessionExt.c_str();
const wchar_t *definedSessionExt = NppParameters::getInstance().getNppGUI()._definedSessionExt.c_str();
if (*definedSessionExt != '\0')
{
generic_string fncp = filename;
TCHAR *pExt = PathFindExtension(fncp.c_str());
wstring fncp = filename;
wchar_t *pExt = PathFindExtension(fncp.c_str());
generic_string usrSessionExt = TEXT("");
wstring usrSessionExt = L"";
if (*definedSessionExt != '.')
{
usrSessionExt += TEXT(".");
usrSessionExt += L".";
}
usrSessionExt += definedSessionExt;
@ -2168,19 +2168,19 @@ bool Notepad_plus::isFileSession(const TCHAR * filename)
return false;
}
bool Notepad_plus::isFileWorkspace(const TCHAR * filename)
bool Notepad_plus::isFileWorkspace(const wchar_t * filename)
{
// if filename matches the ext of user defined workspace file ext, then it'll be opened as a workspace
const TCHAR *definedWorkspaceExt = NppParameters::getInstance().getNppGUI()._definedWorkspaceExt.c_str();
const wchar_t *definedWorkspaceExt = NppParameters::getInstance().getNppGUI()._definedWorkspaceExt.c_str();
if (*definedWorkspaceExt != '\0')
{
generic_string fncp = filename;
TCHAR *pExt = PathFindExtension(fncp.c_str());
wstring fncp = filename;
wchar_t *pExt = PathFindExtension(fncp.c_str());
generic_string usrWorkspaceExt = TEXT("");
wstring usrWorkspaceExt = L"";
if (*definedWorkspaceExt != '.')
{
usrWorkspaceExt += TEXT(".");
usrWorkspaceExt += L".";
}
usrWorkspaceExt += definedWorkspaceExt;
@ -2231,7 +2231,7 @@ bool Notepad_plus::loadSession(Session & session, bool isSnapshotMode, const wch
for (size_t i = 0; i < session.nbMainFiles() ; )
{
const TCHAR *pFn = session._mainViewFiles[i]._fileName.c_str();
const wchar_t *pFn = session._mainViewFiles[i]._fileName.c_str();
if (isFileSession(pFn) || isFileWorkspace(pFn))
{
@ -2248,7 +2248,7 @@ bool Notepad_plus::loadSession(Session & session, bool isSnapshotMode, const wch
}
if (PathFileExists(pFn))
{
if (isSnapshotMode && session._mainViewFiles[i]._backupFilePath != TEXT(""))
if (isSnapshotMode && !session._mainViewFiles[i]._backupFilePath.empty())
lastOpened = doOpen(pFn, false, false, session._mainViewFiles[i]._encoding, session._mainViewFiles[i]._backupFilePath.c_str(), session._mainViewFiles[i]._originalFileLastModifTimestamp);
else
lastOpened = doOpen(pFn, false, false, session._mainViewFiles[i]._encoding);
@ -2319,7 +2319,7 @@ bool Notepad_plus::loadSession(Session & session, bool isSnapshotMode, const wch
buf->setUserReadOnly(session._mainViewFiles[i]._isUserReadOnly);
if (isSnapshotMode && session._mainViewFiles[i]._backupFilePath != TEXT("") && PathFileExists(session._mainViewFiles[i]._backupFilePath.c_str()))
if (isSnapshotMode && session._mainViewFiles[i]._backupFilePath.empty() && PathFileExists(session._mainViewFiles[i]._backupFilePath.c_str()))
buf->setDirty(true);
buf->setRTL(session._mainViewFiles[i]._isRTL);
@ -2360,7 +2360,7 @@ bool Notepad_plus::loadSession(Session & session, bool isSnapshotMode, const wch
for (size_t k = 0 ; k < session.nbSubFiles() ; )
{
const TCHAR *pFn = session._subViewFiles[k]._fileName.c_str();
const wchar_t *pFn = session._subViewFiles[k]._fileName.c_str();
if (isFileSession(pFn) || isFileWorkspace(pFn))
{
@ -2387,7 +2387,7 @@ bool Notepad_plus::loadSession(Session & session, bool isSnapshotMode, const wch
}
else
{
if (isSnapshotMode && session._subViewFiles[k]._backupFilePath != TEXT(""))
if (isSnapshotMode && !session._subViewFiles[k]._backupFilePath.empty())
lastOpened = doOpen(pFn, false, false, session._subViewFiles[k]._encoding, session._subViewFiles[k]._backupFilePath.c_str(), session._subViewFiles[k]._originalFileLastModifTimestamp);
else
lastOpened = doOpen(pFn, false, false, session._subViewFiles[k]._encoding);
@ -2415,7 +2415,7 @@ bool Notepad_plus::loadSession(Session & session, bool isSnapshotMode, const wch
showView(SUB_VIEW);
if (canHideView(MAIN_VIEW))
hideView(MAIN_VIEW);
const TCHAR *pLn = session._subViewFiles[k]._langName.c_str();
const wchar_t *pLn = session._subViewFiles[k]._langName.c_str();
int id = getLangFromMenuName(pLn);
LangType typeToSet = L_TEXT;
@ -2441,16 +2441,16 @@ bool Notepad_plus::loadSession(Session & session, bool isSnapshotMode, const wch
buf->setMapPosition(session._subViewFiles[k]._mapPos);
if (typeToSet == L_USER)
{
if (!lstrcmp(pLn, TEXT("User Defined")))
if (!lstrcmp(pLn, L"User Defined"))
{
pLn = TEXT(""); //default user defined
pLn = L""; //default user defined
}
}
buf->setLangType(typeToSet, pLn);
buf->setEncoding(session._subViewFiles[k]._encoding);
buf->setUserReadOnly(session._subViewFiles[k]._isUserReadOnly);
if (isSnapshotMode && session._subViewFiles[k]._backupFilePath != TEXT("") && PathFileExists(session._subViewFiles[k]._backupFilePath.c_str()))
if (isSnapshotMode && !session._subViewFiles[k]._backupFilePath.empty() && PathFileExists(session._subViewFiles[k]._backupFilePath.c_str()))
buf->setDirty(true);
buf->setRTL(session._subViewFiles[k]._isRTL);
@ -2537,24 +2537,24 @@ bool Notepad_plus::loadSession(Session & session, bool isSnapshotMode, const wch
return allSessionFilesLoaded;
}
bool Notepad_plus::fileLoadSession(const TCHAR *fn)
bool Notepad_plus::fileLoadSession(const wchar_t *fn)
{
bool result = false;
generic_string sessionFileName;
wstring sessionFileName;
if (fn == NULL)
{
CustomFileDialog fDlg(_pPublicInterface->getHSelf());
const TCHAR *ext = NppParameters::getInstance().getNppGUI()._definedSessionExt.c_str();
generic_string sessionExt = TEXT("");
const wchar_t *ext = NppParameters::getInstance().getNppGUI()._definedSessionExt.c_str();
wstring sessionExt = L"";
if (*ext != '\0')
{
if (*ext != '.')
sessionExt += TEXT(".");
sessionExt += L".";
sessionExt += ext;
fDlg.setExtFilter(TEXT("Session file"), sessionExt.c_str());
fDlg.setExtFilter(L"Session file", sessionExt.c_str());
fDlg.setDefExt(ext);
}
fDlg.setExtFilter(TEXT("All types"), TEXT(".*"));
fDlg.setExtFilter(L"All types", L".*");
wstring localizedTitle = _nativeLangSpeaker.getNativeLangMenuString(IDM_FILE_LOADSESSION, L"Load Session", true);
fDlg.setTitle(localizedTitle.c_str());
sessionFileName = fDlg.doOpenSingleFileDlg();
@ -2578,14 +2578,14 @@ bool Notepad_plus::fileLoadSession(const TCHAR *fn)
}
if (!isEmptyNpp && (nppGUI._multiInstSetting == multiInstOnSession || nppGUI._multiInstSetting == multiInst))
{
TCHAR nppFullPath[MAX_PATH]{};
wchar_t nppFullPath[MAX_PATH]{};
::GetModuleFileName(NULL, nppFullPath, MAX_PATH);
generic_string args = TEXT("-multiInst -nosession -openSession ");
args += TEXT("\"");
wstring args = L"-multiInst -nosession -openSession ";
args += L"\"";
args += sessionFileName;
args += TEXT("\"");
if (::ShellExecute(_pPublicInterface->getHSelf(), TEXT("open"), nppFullPath, args.c_str(), TEXT("."), SW_SHOW) > (HINSTANCE)32)
args += L"\"";
if (::ShellExecute(_pPublicInterface->getHSelf(), L"open", nppFullPath, args.c_str(), L".", SW_SHOW) > (HINSTANCE)32)
result = true;
}
else
@ -2606,7 +2606,7 @@ bool Notepad_plus::fileLoadSession(const TCHAR *fn)
return result;
}
const TCHAR * Notepad_plus::fileSaveSession(size_t nbFile, TCHAR ** fileNames, const TCHAR *sessionFile2save, bool includeFileBrowser)
const wchar_t * Notepad_plus::fileSaveSession(size_t nbFile, wchar_t ** fileNames, const wchar_t *sessionFile2save, bool includeFileBrowser)
{
if (sessionFile2save && (lstrlen(sessionFile2save) > 0))
{
@ -2616,7 +2616,7 @@ const TCHAR * Notepad_plus::fileSaveSession(size_t nbFile, TCHAR ** fileNames, c
for (size_t i = 0 ; i < nbFile ; ++i)
{
if (PathFileExists(fileNames[i]))
currentSession._mainViewFiles.push_back(generic_string(fileNames[i]));
currentSession._mainViewFiles.push_back(wstring(fileNames[i]));
}
}
else
@ -2638,28 +2638,28 @@ const TCHAR * Notepad_plus::fileSaveSession(size_t nbFile, TCHAR ** fileNames, c
return NULL;
}
const TCHAR * Notepad_plus::fileSaveSession(size_t nbFile, TCHAR ** fileNames)
const wchar_t * Notepad_plus::fileSaveSession(size_t nbFile, wchar_t ** fileNames)
{
CustomFileDialog fDlg(_pPublicInterface->getHSelf());
const TCHAR *ext = NppParameters::getInstance().getNppGUI()._definedSessionExt.c_str();
const wchar_t *ext = NppParameters::getInstance().getNppGUI()._definedSessionExt.c_str();
generic_string sessionExt = TEXT("");
wstring sessionExt = L"";
if (*ext != '\0')
{
if (*ext != '.')
sessionExt += TEXT(".");
sessionExt += L".";
sessionExt += ext;
fDlg.setExtFilter(TEXT("Session file"), sessionExt.c_str());
fDlg.setExtFilter(L"Session file", sessionExt.c_str());
fDlg.setDefExt(ext);
fDlg.setExtIndex(0); // 0 index for "custom extension types"
}
fDlg.setExtFilter(TEXT("All types"), TEXT(".*"));
fDlg.setExtFilter(L"All types", L".*");
const bool isCheckboxActive = _pFileBrowser && !_pFileBrowser->isClosed();
const generic_string checkboxLabel = _nativeLangSpeaker.getLocalizedStrFromID("session-save-folder-as-workspace", L"Save Folder as Workspace");
const wstring checkboxLabel = _nativeLangSpeaker.getLocalizedStrFromID("session-save-folder-as-workspace", L"Save Folder as Workspace");
fDlg.setCheckbox(checkboxLabel.c_str(), isCheckboxActive);
wstring localizedTitle = _nativeLangSpeaker.getNativeLangMenuString(IDM_FILE_SAVESESSION, L"Save Session", true);
fDlg.setTitle(localizedTitle.c_str());
generic_string sessionFileName = fDlg.doSaveDlg();
wstring sessionFileName = fDlg.doSaveDlg();
if (!sessionFileName.empty())
return fileSaveSession(nbFile, fileNames, sessionFileName.c_str(), fDlg.getCheckboxState());

View File

@ -238,8 +238,8 @@ BOOL Notepad_plus::notify(SCNotification *notification)
{
if (!_tabPopupDropMenu.isCreated())
{
TCHAR goToView[32] = TEXT("Move to Other View");
TCHAR cloneToView[32] = TEXT("Clone to Other View");
wchar_t goToView[32] = L"Move to Other View";
wchar_t cloneToView[32] = L"Clone to Other View";
vector<MenuItemUnit> itemUnitArray;
itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_GOTO_ANOTHER_VIEW, goToView));
itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_CLONE_TO_ANOTHER_VIEW, cloneToView));
@ -263,17 +263,17 @@ BOOL Notepad_plus::notify(SCNotification *notification)
// Do nothing
return TRUE;
}
generic_string quotFileName = TEXT("\"");
wstring quotFileName = L"\"";
quotFileName += _pEditView->getCurrentBuffer()->getFullPathName();
quotFileName += TEXT("\"");
quotFileName += L"\"";
COPYDATASTRUCT fileNamesData{};
fileNamesData.dwData = COPYDATA_FILENAMESW;
fileNamesData.lpData = (void *)quotFileName.c_str();
fileNamesData.cbData = static_cast<DWORD>((quotFileName.length() + 1) * sizeof(TCHAR));
fileNamesData.cbData = static_cast<DWORD>((quotFileName.length() + 1) * sizeof(wchar_t));
HWND hWinParent = ::GetParent(hWin);
const rsize_t classNameBufferSize = MAX_PATH;
TCHAR className[classNameBufferSize];
wchar_t className[classNameBufferSize];
::GetClassName(hWinParent,className, classNameBufferSize);
if (lstrcmp(className, _pPublicInterface->getClassName()) == 0 && hWinParent != _pPublicInterface->getHSelf()) // another Notepad++
{
@ -283,11 +283,11 @@ BOOL Notepad_plus::notify(SCNotification *notification)
int iView = isFromPrimary?MAIN_VIEW:SUB_VIEW;
if (buf->isDirty())
{
generic_string msg, title;
wstring msg, title;
_nativeLangSpeaker.messageBox("CannotMoveDoc",
_pPublicInterface->getHSelf(),
TEXT("Document is modified, save it then try again."),
TEXT("Move to new Notepad++ Instance"),
L"Document is modified, save it then try again.",
L"Move to new Notepad++ Instance",
MB_OK);
}
else
@ -368,7 +368,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
{
bool isOverTypeMode = (_pEditView->execute(SCI_GETOVERTYPE) != 0);
_pEditView->execute(SCI_SETOVERTYPE, !isOverTypeMode);
_statusBar.setText((_pEditView->execute(SCI_GETOVERTYPE))?TEXT("OVR"):TEXT("INS"), STATUSBAR_TYPING_MODE);
_statusBar.setText((_pEditView->execute(SCI_GETOVERTYPE)) ? L"OVR" : L"INS", STATUSBAR_TYPING_MODE);
}
}
else if (notification->nmhdr.hwndFrom == _mainDocTab.getHSelf() && _activeView == SUB_VIEW)
@ -494,14 +494,14 @@ BOOL Notepad_plus::notify(SCNotification *notification)
if (!_fileSwitcherMultiFilePopupMenu.isCreated())
{
vector<MenuItemUnit> itemUnitArray;
itemUnitArray.push_back(MenuItemUnit(IDM_DOCLIST_FILESCLOSE, TEXT("Close Selected files")));
itemUnitArray.push_back(MenuItemUnit(IDM_DOCLIST_FILESCLOSEOTHERS, TEXT("Close Other files")));
itemUnitArray.push_back(MenuItemUnit(IDM_DOCLIST_COPYNAMES, TEXT("Copy Selected Names")));
itemUnitArray.push_back(MenuItemUnit(IDM_DOCLIST_COPYPATHS, TEXT("Copy Selected Pathnames")));
itemUnitArray.push_back(MenuItemUnit(IDM_DOCLIST_FILESCLOSE, L"Close Selected files"));
itemUnitArray.push_back(MenuItemUnit(IDM_DOCLIST_FILESCLOSEOTHERS, L"Close Other files"));
itemUnitArray.push_back(MenuItemUnit(IDM_DOCLIST_COPYNAMES, L"Copy Selected Names"));
itemUnitArray.push_back(MenuItemUnit(IDM_DOCLIST_COPYPATHS, L"Copy Selected Pathnames"));
for (auto&& x : itemUnitArray)
{
const generic_string menuItem = _nativeLangSpeaker.getNativeLangMenuString(x._cmdID);
const wstring menuItem = _nativeLangSpeaker.getNativeLangMenuString(x._cmdID);
if (!menuItem.empty())
x._itemName = menuItem;
}
@ -529,42 +529,42 @@ BOOL Notepad_plus::notify(SCNotification *notification)
{
// IMPORTANT: If any submenu entry is added/moved/removed, you have to change the value of tabCmSubMenuEntryPos[] in localization.cpp file
itemUnitArray.push_back(MenuItemUnit(IDM_FILE_CLOSE, TEXT("Close")));
itemUnitArray.push_back(MenuItemUnit(IDM_FILE_CLOSEALL_BUT_CURRENT, TEXT("Close All BUT This"), TEXT("Close Multiple Tabs")));
itemUnitArray.push_back(MenuItemUnit(IDM_FILE_CLOSEALL_TOLEFT, TEXT("Close All to the Left"), TEXT("Close Multiple Tabs")));
itemUnitArray.push_back(MenuItemUnit(IDM_FILE_CLOSEALL_TORIGHT, TEXT("Close All to the Right"), TEXT("Close Multiple Tabs")));
itemUnitArray.push_back(MenuItemUnit(IDM_FILE_CLOSEALL_UNCHANGED, TEXT("Close All Unchanged"), TEXT("Close Multiple Tabs")));
itemUnitArray.push_back(MenuItemUnit(IDM_FILE_SAVE, TEXT("Save")));
itemUnitArray.push_back(MenuItemUnit(IDM_FILE_SAVEAS, TEXT("Save As...")));
itemUnitArray.push_back(MenuItemUnit(IDM_FILE_OPEN_FOLDER, TEXT("Open Containing Folder in Explorer"), TEXT("Open into")));
itemUnitArray.push_back(MenuItemUnit(IDM_FILE_OPEN_CMD, TEXT("Open Containing Folder in cmd"), TEXT("Open into")));
itemUnitArray.push_back(MenuItemUnit(IDM_FILE_CONTAININGFOLDERASWORKSPACE, TEXT("Open Containing Folder as Workspace"), TEXT("Open into")));
itemUnitArray.push_back(MenuItemUnit(0, NULL, TEXT("Open into")));
itemUnitArray.push_back(MenuItemUnit(IDM_FILE_OPEN_DEFAULT_VIEWER, TEXT("Open in Default Viewer"), TEXT("Open into")));
itemUnitArray.push_back(MenuItemUnit(IDM_FILE_RENAME, TEXT("Rename")));
itemUnitArray.push_back(MenuItemUnit(IDM_FILE_DELETE, TEXT("Move to Recycle Bin")));
itemUnitArray.push_back(MenuItemUnit(IDM_FILE_RELOAD, TEXT("Reload")));
itemUnitArray.push_back(MenuItemUnit(IDM_FILE_PRINT, TEXT("Print")));
itemUnitArray.push_back(MenuItemUnit(IDM_FILE_CLOSE, L"Close"));
itemUnitArray.push_back(MenuItemUnit(IDM_FILE_CLOSEALL_BUT_CURRENT, L"Close All BUT This", L"Close Multiple Tabs"));
itemUnitArray.push_back(MenuItemUnit(IDM_FILE_CLOSEALL_TOLEFT, L"Close All to the Left", L"Close Multiple Tabs"));
itemUnitArray.push_back(MenuItemUnit(IDM_FILE_CLOSEALL_TORIGHT, L"Close All to the Right", L"Close Multiple Tabs"));
itemUnitArray.push_back(MenuItemUnit(IDM_FILE_CLOSEALL_UNCHANGED, L"Close All Unchanged", L"Close Multiple Tabs"));
itemUnitArray.push_back(MenuItemUnit(IDM_FILE_SAVE, L"Save"));
itemUnitArray.push_back(MenuItemUnit(IDM_FILE_SAVEAS, L"Save As..."));
itemUnitArray.push_back(MenuItemUnit(IDM_FILE_OPEN_FOLDER, L"Open Containing Folder in Explorer", L"Open into"));
itemUnitArray.push_back(MenuItemUnit(IDM_FILE_OPEN_CMD, L"Open Containing Folder in cmd", L"Open into"));
itemUnitArray.push_back(MenuItemUnit(IDM_FILE_CONTAININGFOLDERASWORKSPACE, L"Open Containing Folder as Workspace", L"Open into"));
itemUnitArray.push_back(MenuItemUnit(0, NULL, L"Open into"));
itemUnitArray.push_back(MenuItemUnit(IDM_FILE_OPEN_DEFAULT_VIEWER, L"Open in Default Viewer", L"Open into"));
itemUnitArray.push_back(MenuItemUnit(IDM_FILE_RENAME, L"Rename"));
itemUnitArray.push_back(MenuItemUnit(IDM_FILE_DELETE, L"Move to Recycle Bin"));
itemUnitArray.push_back(MenuItemUnit(IDM_FILE_RELOAD, L"Reload"));
itemUnitArray.push_back(MenuItemUnit(IDM_FILE_PRINT, L"Print"));
itemUnitArray.push_back(MenuItemUnit(0, NULL));
itemUnitArray.push_back(MenuItemUnit(IDM_EDIT_SETREADONLY, TEXT("Read-Only")));
itemUnitArray.push_back(MenuItemUnit(IDM_EDIT_CLEARREADONLY, TEXT("Clear Read-Only Flag")));
itemUnitArray.push_back(MenuItemUnit(IDM_EDIT_SETREADONLY, L"Read-Only"));
itemUnitArray.push_back(MenuItemUnit(IDM_EDIT_CLEARREADONLY, L"Clear Read-Only Flag"));
itemUnitArray.push_back(MenuItemUnit(0, NULL));
itemUnitArray.push_back(MenuItemUnit(IDM_EDIT_FULLPATHTOCLIP, TEXT("Copy Full File Path"), TEXT("Copy to Clipboard")));
itemUnitArray.push_back(MenuItemUnit(IDM_EDIT_FILENAMETOCLIP, TEXT("Copy Filename"), TEXT("Copy to Clipboard")));
itemUnitArray.push_back(MenuItemUnit(IDM_EDIT_CURRENTDIRTOCLIP, TEXT("Copy Current Dir. Path"), TEXT("Copy to Clipboard")));
itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_GOTO_START, TEXT("Move to Start"), TEXT("Move Document")));
itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_GOTO_END, TEXT("Move to End"), TEXT("Move Document")));
itemUnitArray.push_back(MenuItemUnit(0, NULL, TEXT("Move Document")));
itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_GOTO_ANOTHER_VIEW, TEXT("Move to Other View"), TEXT("Move Document")));
itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_CLONE_TO_ANOTHER_VIEW, TEXT("Clone to Other View"), TEXT("Move Document")));
itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_GOTO_NEW_INSTANCE, TEXT("Move to New Instance"), TEXT("Move Document")));
itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_LOAD_IN_NEW_INSTANCE, TEXT("Open in New Instance"), TEXT("Move Document")));
itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_TAB_COLOUR_1, TEXT("Apply Color 1"), TEXT("Apply Color to Tab")));
itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_TAB_COLOUR_2, TEXT("Apply Color 2"), TEXT("Apply Color to Tab")));
itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_TAB_COLOUR_3, TEXT("Apply Color 3"), TEXT("Apply Color to Tab")));
itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_TAB_COLOUR_4, TEXT("Apply Color 4"), TEXT("Apply Color to Tab")));
itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_TAB_COLOUR_5, TEXT("Apply Color 5"), TEXT("Apply Color to Tab")));
itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_TAB_COLOUR_NONE, TEXT("Remove Color"), TEXT("Apply Color to Tab")));
itemUnitArray.push_back(MenuItemUnit(IDM_EDIT_FULLPATHTOCLIP, L"Copy Full File Path", L"Copy to Clipboard"));
itemUnitArray.push_back(MenuItemUnit(IDM_EDIT_FILENAMETOCLIP, L"Copy Filename", L"Copy to Clipboard"));
itemUnitArray.push_back(MenuItemUnit(IDM_EDIT_CURRENTDIRTOCLIP, L"Copy Current Dir. Path", L"Copy to Clipboard"));
itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_GOTO_START, L"Move to Start", L"Move Document"));
itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_GOTO_END, L"Move to End", L"Move Document"));
itemUnitArray.push_back(MenuItemUnit(0, NULL, L"Move Document"));
itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_GOTO_ANOTHER_VIEW, L"Move to Other View", L"Move Document"));
itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_CLONE_TO_ANOTHER_VIEW, L"Clone to Other View", L"Move Document"));
itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_GOTO_NEW_INSTANCE, L"Move to New Instance", L"Move Document"));
itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_LOAD_IN_NEW_INSTANCE, L"Open in New Instance", L"Move Document"));
itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_TAB_COLOUR_1, L"Apply Color 1", L"Apply Color to Tab"));
itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_TAB_COLOUR_2, L"Apply Color 2", L"Apply Color to Tab"));
itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_TAB_COLOUR_3, L"Apply Color 3", L"Apply Color to Tab"));
itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_TAB_COLOUR_4, L"Apply Color 4", L"Apply Color to Tab"));
itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_TAB_COLOUR_5, L"Apply Color 5", L"Apply Color to Tab"));
itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_TAB_COLOUR_NONE, L"Remove Color", L"Apply Color to Tab"));
// IMPORTANT: If any submenu entry is added/moved/removed, you have to change the value of tabCmSubMenuEntryPos[] in localization.cpp file
}
@ -694,7 +694,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
const NppGUI & nppGui = NppParameters::getInstance().getNppGUI();
bool indentMaintain = nppGui._maintainIndent;
if (indentMaintain)
maintainIndentation(static_cast<TCHAR>(notification->ch));
maintainIndentation(static_cast<wchar_t>(notification->ch));
Buffer* currentBuf = _pEditView->getCurrentBuffer();
if (currentBuf->allowAutoCompletion())
@ -882,8 +882,8 @@ BOOL Notepad_plus::notify(SCNotification *notification)
notifyView->execute(SCI_SETSEL, notification->position, notification->position);
// Open URL
generic_string url = notifyView->getGenericTextAsString(static_cast<size_t>(startPos), static_cast<size_t>(endPos));
::ShellExecute(_pPublicInterface->getHSelf(), TEXT("open"), url.c_str(), NULL, NULL, SW_SHOW);
wstring url = notifyView->getGenericTextAsString(static_cast<size_t>(startPos), static_cast<size_t>(endPos));
::ShellExecute(_pPublicInterface->getHSelf(), L"open", url.c_str(), NULL, NULL, SW_SHOW);
}
break;
}
@ -911,8 +911,8 @@ BOOL Notepad_plus::notify(SCNotification *notification)
{
if (nppGui._smartHiliteOnAnotherView)
{
TCHAR selectedText[1024];
_pEditView->getGenericSelectedText(selectedText, sizeof(selectedText)/sizeof(TCHAR), false);
wchar_t selectedText[1024];
_pEditView->getGenericSelectedText(selectedText, sizeof(selectedText)/sizeof(wchar_t), false);
_smartHighlighter.highlightViewWithWord(notifyView, selectedText);
}
break;
@ -965,10 +965,10 @@ BOOL Notepad_plus::notify(SCNotification *notification)
::MapWindowPoints(NULL, _pPublicInterface->getHSelf(), &p, 1);
HWND hWin = ::ChildWindowFromPointEx(_pPublicInterface->getHSelf(), p, CWP_SKIPINVISIBLE);
const int tipMaxLen = 1024;
static TCHAR docTip[tipMaxLen];
static wchar_t docTip[tipMaxLen];
docTip[0] = '\0';
generic_string tipTmp(TEXT(""));
wstring tipTmp(L"");
int id = int(lpttt->hdr.idFrom);
if (hWin == _rebarTop.getHSelf())
@ -1015,7 +1015,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
}
catch (...)
{
//printStr(TEXT("ToolTip crash is caught!"));
//printStr(L"ToolTip crash is caught!"));
}
break;
}

File diff suppressed because it is too large Load Diff

View File

@ -47,7 +47,7 @@
#endif
#define CMD_INTERPRETER TEXT("%COMSPEC%")
#define CMD_INTERPRETER L"%COMSPEC%"
class NativeLangSpeaker;
@ -150,17 +150,17 @@ const int COPYDATA_FULL_CMDLINE = 3;
const int FINDREPLACE_INSELECTION_THRESHOLD_DEFAULT = 1024;
const TCHAR fontSizeStrs[][3] = {TEXT(""), TEXT("5"), TEXT("6"), TEXT("7"), TEXT("8"), TEXT("9"), TEXT("10"), TEXT("11"), TEXT("12"), TEXT("14"), TEXT("16"), TEXT("18"), TEXT("20"), TEXT("22"), TEXT("24"), TEXT("26"), TEXT("28")};
const wchar_t fontSizeStrs[][3] = {L"", L"5", L"6", L"7", L"8", L"9", L"10", L"11", L"12", L"14", L"16", L"18", L"20", L"22", L"24", L"26", L"28"};
const TCHAR localConfFile[] = TEXT("doLocalConf.xml");
const TCHAR notepadStyleFile[] = TEXT("asNotepad.xml");
const wchar_t localConfFile[] = L"doLocalConf.xml";
const wchar_t notepadStyleFile[] = L"asNotepad.xml";
// issue xml/log file name
const TCHAR nppLogNetworkDriveIssue[] = TEXT("nppLogNetworkDriveIssue");
const TCHAR nppLogNulContentCorruptionIssue[] = TEXT("nppLogNulContentCorruptionIssue");
const wchar_t nppLogNetworkDriveIssue[] = L"nppLogNetworkDriveIssue";
const wchar_t nppLogNulContentCorruptionIssue[] = L"nppLogNulContentCorruptionIssue";
void cutString(const TCHAR *str2cut, std::vector<std::wstring> & patternVect);
void cutStringBy(const TCHAR *str2cut, std::vector<std::wstring> & patternVect, char byChar, bool allowEmptyStr);
void cutString(const wchar_t *str2cut, std::vector<std::wstring> & patternVect);
void cutStringBy(const wchar_t *str2cut, std::vector<std::wstring> & patternVect, char byChar, bool allowEmptyStr);
// style names
const wchar_t g_npcStyleName[] = L"Non-printing characters custom color";
@ -203,7 +203,7 @@ public:
struct sessionFileInfo : public Position
{
sessionFileInfo(const wchar_t* fn, const TCHAR *ln, int encoding, bool userReadOnly, const Position& pos, const TCHAR *backupFilePath, FILETIME originalFileLastModifTimestamp, const MapPosition & mapPos) :
sessionFileInfo(const wchar_t* fn, const wchar_t *ln, int encoding, bool userReadOnly, const Position& pos, const wchar_t *backupFilePath, FILETIME originalFileLastModifTimestamp, const MapPosition & mapPos) :
Position(pos), _encoding(encoding), _isUserReadOnly(userReadOnly), _originalFileLastModifTimestamp(originalFileLastModifTimestamp), _mapPos(mapPos)
{
if (fn) _fileName = fn;
@ -352,7 +352,7 @@ struct PluginDlgDockingInfo final
int _prevContainer = -1;
bool _isVisible = false;
PluginDlgDockingInfo(const TCHAR* pluginName, int id, int curr, int prev, bool isVis)
PluginDlgDockingInfo(const wchar_t* pluginName, int id, int curr, int prev, bool isVis)
: _name(pluginName), _internalID(id), _currContainer(curr), _prevContainer(prev), _isVisible(isVis)
{}
@ -515,23 +515,23 @@ public:
return *this;
}
void setLexerName(const TCHAR *lexerName)
void setLexerName(const wchar_t *lexerName)
{
_lexerName = lexerName;
}
void setLexerDesc(const TCHAR *lexerDesc)
void setLexerDesc(const wchar_t *lexerDesc)
{
_lexerDesc = lexerDesc;
}
void setLexerUserExt(const TCHAR *lexerUserExt) {
void setLexerUserExt(const wchar_t *lexerUserExt) {
_lexerUserExt = lexerUserExt;
};
const TCHAR * getLexerName() const {return _lexerName.c_str();};
const TCHAR * getLexerDesc() const {return _lexerDesc.c_str();};
const TCHAR * getLexerUserExt() const {return _lexerUserExt.c_str();};
const wchar_t * getLexerName() const {return _lexerName.c_str();};
const wchar_t * getLexerDesc() const {return _lexerDesc.c_str();};
const wchar_t * getLexerUserExt() const {return _lexerUserExt.c_str();};
private :
std::wstring _lexerName;
@ -541,9 +541,9 @@ private :
struct SortLexersInAlphabeticalOrder {
bool operator() (const LexerStyler& l, const LexerStyler& r) {
if (!lstrcmp(l.getLexerDesc(), TEXT("Search result")))
if (!lstrcmp(l.getLexerDesc(), L"Search result"))
return false;
if (!lstrcmp(r.getLexerDesc(), TEXT("Search result")))
if (!lstrcmp(r.getLexerDesc(), L"Search result"))
return true;
return lstrcmp(l.getLexerDesc(), r.getLexerDesc()) < 0;
}
@ -560,10 +560,10 @@ struct LexerStylerArray
return _lexerStylerVect[index];
};
const TCHAR * getLexerNameFromIndex(size_t index) const { return _lexerStylerVect[index].getLexerName(); }
const TCHAR * getLexerDescFromIndex(size_t index) const { return _lexerStylerVect[index].getLexerDesc(); }
const wchar_t * getLexerNameFromIndex(size_t index) const { return _lexerStylerVect[index].getLexerName(); }
const wchar_t * getLexerDescFromIndex(size_t index) const { return _lexerStylerVect[index].getLexerDesc(); }
LexerStyler * getLexerStylerByName(const TCHAR *lexerName) {
LexerStyler * getLexerStylerByName(const wchar_t *lexerName) {
if (!lexerName) return nullptr;
for (size_t i = 0 ; i < _lexerStylerVect.size() ; ++i)
{
@ -573,7 +573,7 @@ struct LexerStylerArray
return nullptr;
};
void addLexerStyler(const TCHAR *lexerName, const TCHAR *lexerDesc, const TCHAR *lexerUserExt, TiXmlNode *lexerNode);
void addLexerStyler(const wchar_t *lexerName, const wchar_t *lexerDesc, const wchar_t *lexerUserExt, TiXmlNode *lexerNode);
void sort() {
std::sort(_lexerStylerVect.begin(), _lexerStylerVect.end(), SortLexersInAlphabeticalOrder());
@ -601,7 +601,7 @@ struct LangMenuItem final
int _cmdID = -1;
std::wstring _langName;
LangMenuItem(LangType lt, int cmdID = 0, const std::wstring& langName = TEXT("")):
LangMenuItem(LangType lt, int cmdID = 0, const std::wstring& langName = L""):
_langType(lt), _cmdID(cmdID), _langName(langName){};
bool operator<(const LangMenuItem& rhs) const
@ -638,11 +638,11 @@ struct PrintSettings final {
};
bool isHeaderPresent() const {
return ((_headerLeft != TEXT("")) || (_headerMiddle != TEXT("")) || (_headerRight != TEXT("")));
return (!_headerLeft.empty() || !_headerMiddle.empty() || !_headerRight.empty());
};
bool isFooterPresent() const {
return ((_footerLeft != TEXT("")) || (_footerMiddle != TEXT("")) || (_footerRight != TEXT("")));
return (!_footerLeft.empty() || !_footerMiddle.empty() || !_footerRight.empty());
};
bool isUserMargePresent() const {
@ -670,7 +670,7 @@ public:
!(month == 11 && day > 30));
}
explicit Date(const TCHAR *dateStr);
explicit Date(const wchar_t *dateStr);
// The constructor which makes the date of number of days from now
// nbDaysFromNow could be negative if user want to make a date in the past
@ -681,8 +681,8 @@ public:
std::wstring toString() const // Return Notepad++ date format : YYYYMMDD
{
TCHAR dateStr[16];
wsprintf(dateStr, TEXT("%04u%02u%02u"), _year, _month, _day);
wchar_t dateStr[16];
wsprintf(dateStr, L"%04u%02u%02u", _year, _month, _day);
return dateStr;
}
@ -851,10 +851,10 @@ struct NppGUI final
bool _isWordCharDefault = true;
std::string _customWordChars;
urlMode _styleURL = urlUnderLineFg;
std::wstring _uriSchemes = TEXT("svn:// cvs:// git:// imap:// irc:// irc6:// ircs:// ldap:// ldaps:// news: telnet:// gopher:// ssh:// sftp:// smb:// skype: snmp:// spotify: steam:// sms: slack:// chrome:// bitcoin:");
std::wstring _uriSchemes = L"svn:// cvs:// git:// imap:// irc:// irc6:// ircs:// ldap:// ldaps:// news: telnet:// gopher:// ssh:// sftp:// smb:// skype: snmp:// spotify: steam:// sms: slack:// chrome:// bitcoin:";
NewDocDefaultSettings _newDocDefaultSettings;
std::wstring _dateTimeFormat = TEXT("yyyy-MM-dd HH:mm:ss");
std::wstring _dateTimeFormat = L"yyyy-MM-dd HH:mm:ss";
bool _dateTimeReverseDefaultOrder = false;
void setTabReplacedBySpace(bool b) {_tabReplacedBySpace = b;};
@ -901,9 +901,9 @@ struct NppGUI final
OpenSaveDirSetting _openSaveDir = dir_followCurrent;
TCHAR _defaultDir[MAX_PATH]{};
TCHAR _defaultDirExp[MAX_PATH]{}; //expanded environment variables
TCHAR _lastUsedDir[MAX_PATH]{};
wchar_t _defaultDir[MAX_PATH]{};
wchar_t _defaultDirExp[MAX_PATH]{}; //expanded environment variables
wchar_t _lastUsedDir[MAX_PATH]{};
std::wstring _themeName;
MultiInstSetting _multiInstSetting = monoInst;
@ -1034,11 +1034,11 @@ struct Lang final
{
LangType _langID = L_TEXT;
std::wstring _langName;
const TCHAR* _defaultExtList = nullptr;
const TCHAR* _langKeyWordList[NB_LIST];
const TCHAR* _pCommentLineSymbol = nullptr;
const TCHAR* _pCommentStart = nullptr;
const TCHAR* _pCommentEnd = nullptr;
const wchar_t* _defaultExtList = nullptr;
const wchar_t* _langKeyWordList[NB_LIST];
const wchar_t* _pCommentLineSymbol = nullptr;
const wchar_t* _pCommentStart = nullptr;
const wchar_t* _pCommentEnd = nullptr;
bool _isTabReplacedBySpace = false;
int _tabSize = -1;
@ -1049,26 +1049,26 @@ struct Lang final
for (int i = 0 ; i < NB_LIST ; _langKeyWordList[i] = NULL, ++i);
}
Lang(LangType langID, const TCHAR *name) : _langID(langID), _langName(name ? name : TEXT(""))
Lang(LangType langID, const wchar_t *name) : _langID(langID), _langName(name ? name : L"")
{
for (int i = 0 ; i < NB_LIST ; _langKeyWordList[i] = NULL, ++i);
}
~Lang() = default;
void setDefaultExtList(const TCHAR *extLst){
void setDefaultExtList(const wchar_t *extLst){
_defaultExtList = extLst;
}
void setCommentLineSymbol(const TCHAR *commentLine){
void setCommentLineSymbol(const wchar_t *commentLine){
_pCommentLineSymbol = commentLine;
}
void setCommentStart(const TCHAR *commentStart){
void setCommentStart(const wchar_t *commentStart){
_pCommentStart = commentStart;
}
void setCommentEnd(const TCHAR *commentEnd){
void setCommentEnd(const wchar_t *commentEnd){
_pCommentEnd = commentEnd;
}
@ -1083,20 +1083,20 @@ struct Lang final
_isBackspaceUnindent = isBackspaceUnindent;
}
const TCHAR * getDefaultExtList() const {
const wchar_t * getDefaultExtList() const {
return _defaultExtList;
}
void setWords(const TCHAR *words, int index) {
void setWords(const wchar_t *words, int index) {
_langKeyWordList[index] = words;
}
const TCHAR * getWords(int index) const {
const wchar_t * getWords(int index) const {
return _langKeyWordList[index];
}
LangType getLangID() const {return _langID;};
const TCHAR * getLangName() const {return _langName.c_str();};
const wchar_t * getLangName() const {return _langName.c_str();};
int getTabInfo() const
{
@ -1110,11 +1110,11 @@ struct Lang final
class UserLangContainer final
{
public:
UserLangContainer() :_name(TEXT("new user define")), _ext(TEXT("")), _udlVersion(TEXT("")) {
UserLangContainer() :_name(L"new user define"), _ext(L""), _udlVersion(L"") {
for (int i = 0; i < SCE_USER_KWLIST_TOTAL; ++i) *_keywordLists[i] = '\0';
}
UserLangContainer(const TCHAR *name, const TCHAR *ext, bool isDarkModeTheme, const TCHAR *udlVer):
UserLangContainer(const wchar_t *name, const wchar_t *ext, bool isDarkModeTheme, const wchar_t *udlVer):
_name(name), _ext(ext), _isDarkModeTheme(isDarkModeTheme), _udlVersion(udlVer) {
for (int i = 0; i < SCE_USER_KWLIST_TOTAL; ++i) *_keywordLists[i] = '\0';
}
@ -1150,9 +1150,9 @@ public:
return *this;
}
const TCHAR * getName() {return _name.c_str();};
const TCHAR * getExtention() {return _ext.c_str();};
const TCHAR * getUdlVersion() {return _udlVersion.c_str();};
const wchar_t * getName() {return _name.c_str();};
const wchar_t * getExtention() {return _ext.c_str();};
const wchar_t * getUdlVersion() {return _udlVersion.c_str();};
private:
StyleArray _styles;
@ -1161,7 +1161,7 @@ private:
bool _isDarkModeTheme = false;
std::wstring _udlVersion;
TCHAR _keywordLists[SCE_USER_KWLIST_TOTAL][max_char];
wchar_t _keywordLists[SCE_USER_KWLIST_TOTAL][max_char];
bool _isPrefix[SCE_USER_TOTAL_KEYWORD_GROUPS] = {false};
bool _isCaseIgnored = false;
@ -1319,16 +1319,16 @@ public:
_themeList.push_back(std::pair<std::wstring, std::wstring>(_defaultThemeLabel, xmlFullPath));
}
std::wstring getThemeFromXmlFileName(const TCHAR *fn) const;
std::wstring getThemeFromXmlFileName(const wchar_t *fn) const;
std::wstring getXmlFilePathFromThemeName(const TCHAR *themeName) const {
std::wstring getXmlFilePathFromThemeName(const wchar_t *themeName) const {
if (!themeName || themeName[0])
return std::wstring();
std::wstring themePath = _stylesXmlPath;
return themePath;
}
bool themeNameExists(const TCHAR *themeName) {
bool themeNameExists(const wchar_t *themeName) {
for (size_t i = 0; i < _themeList.size(); ++i )
{
auto& themeNameOnList = getElementFromIndex(i).first;
@ -1356,7 +1356,7 @@ public:
const auto iter = _themeStylerSavePath.find(path);
if (iter == _themeStylerSavePath.end())
{
return TEXT("");
return L"";
}
else
{
@ -1372,7 +1372,7 @@ private:
std::vector<std::pair<std::wstring, std::wstring>> _themeList;
std::map<std::wstring, std::wstring> _themeStylerSavePath;
std::wstring _themeDirPath;
const std::wstring _defaultThemeLabel = TEXT("Default (stylers.xml)");
const std::wstring _defaultThemeLabel = L"Default (stylers.xml)";
std::wstring _stylesXmlPath;
};
@ -1436,12 +1436,12 @@ public:
return *getInstancePointer();
};
static LangType getLangIDFromStr(const TCHAR *langName);
static LangType getLangIDFromStr(const wchar_t *langName);
static std::wstring getLocPathFromStr(const std::wstring & localizationCode);
bool load();
bool reloadLang();
bool reloadStylers(const TCHAR *stylePath = nullptr);
bool reloadStylers(const wchar_t *stylePath = nullptr);
void destroyInstance();
std::wstring getSettingsFolder();
@ -1452,7 +1452,7 @@ public:
return _nppGUI;
}
const TCHAR * getWordList(LangType langID, int typeIndex) const
const wchar_t * getWordList(LangType langID, int typeIndex) const
{
const Lang* pLang = getLangFromID(langID);
if (!pLang) return nullptr;
@ -1477,9 +1477,9 @@ public:
int getNbLang() const {return _nbLang;};
LangType getLangFromExt(const TCHAR *ext);
LangType getLangFromExt(const wchar_t *ext);
const TCHAR * getLangExtFromName(const TCHAR *langName) const
const wchar_t * getLangExtFromName(const wchar_t *langName) const
{
for (int i = 0 ; i < _nbLang ; ++i)
{
@ -1489,7 +1489,7 @@ public:
return nullptr;
}
const TCHAR * getLangExtFromLangType(LangType langType) const
const wchar_t * getLangExtFromLangType(LangType langType) const
{
for (int i = 0 ; i < _nbLang ; ++i)
{
@ -1529,19 +1529,19 @@ public:
}
bool writeRecentFileHistorySettings(int nbMaxFile = -1) const;
bool writeHistory(const TCHAR *fullpath);
bool writeHistory(const wchar_t *fullpath);
bool writeProjectPanelsSettings() const;
bool writeColumnEditorSettings() const;
bool writeFileBrowserSettings(const std::vector<std::wstring> & rootPath, const std::wstring & latestSelectedItemPath) const;
TiXmlNode* getChildElementByAttribut(TiXmlNode *pere, const TCHAR *childName, const TCHAR *attributName, const TCHAR *attributVal) const;
TiXmlNode* getChildElementByAttribut(TiXmlNode *pere, const wchar_t *childName, const wchar_t *attributName, const wchar_t *attributVal) const;
bool writeScintillaParams();
void createXmlTreeFromGUIParams();
std::wstring writeStyles(LexerStylerArray & lexersStylers, StyleArray & globalStylers); // return "" if saving file succeeds, otherwise return the new saved file path
bool insertTabInfo(const TCHAR* langName, int tabInfo, bool backspaceUnindent);
bool insertTabInfo(const wchar_t* langName, int tabInfo, bool backspaceUnindent);
LexerStylerArray & getLStylerArray() {return _lexerStylerVect;};
StyleArray & getGlobalStylers() {return _widgetStyleArray;};
@ -1558,10 +1558,10 @@ public:
int getNbUserLang() const {return _nbUserLang;}
UserLangContainer & getULCFromIndex(size_t i) {return *_userLangArray[i];};
UserLangContainer * getULCFromName(const TCHAR *userLangName);
UserLangContainer * getULCFromName(const wchar_t *userLangName);
int getNbExternalLang() const {return _nbExternalLang;};
int getExternalLangIndexFromName(const TCHAR *externalLangName) const;
int getExternalLangIndexFromName(const wchar_t *externalLangName) const;
ExternalLangContainer & getELCFromIndex(int i) {return *_externalLangArray[i];};
@ -1574,10 +1574,10 @@ public:
void writeNonDefaultUDL();
void writeNeed2SaveUDL();
void writeShortcuts();
void writeSession(const Session & session, const TCHAR *fileName = NULL);
void writeSession(const Session & session, const wchar_t *fileName = NULL);
bool writeFindHistory();
bool isExistingUserLangName(const TCHAR *newName) const
bool isExistingUserLangName(const wchar_t *newName) const
{
if ((!newName) || (!newName[0]))
return true;
@ -1590,9 +1590,9 @@ public:
return false;
}
const TCHAR * getUserDefinedLangNameFromExt(TCHAR *ext, TCHAR *fullName) const;
const wchar_t * getUserDefinedLangNameFromExt(wchar_t *ext, wchar_t *fullName) const;
int addUserLangToEnd(const UserLangContainer & userLang, const TCHAR *newName);
int addUserLangToEnd(const UserLangContainer & userLang, const wchar_t *newName);
void removeUserLang(size_t index);
bool isExistingExternalLangName(const char* newName) const;
@ -1657,12 +1657,12 @@ public:
std::wstring getNppPath() const {return _nppPath;};
std::wstring getContextMenuPath() const {return _contextMenuPath;};
const TCHAR * getAppDataNppDir() const {return _appdataNppDir.c_str();};
const TCHAR * getPluginRootDir() const { return _pluginRootDir.c_str(); };
const TCHAR * getPluginConfDir() const { return _pluginConfDir.c_str(); };
const TCHAR * getUserPluginConfDir() const { return _userPluginConfDir.c_str(); };
const TCHAR * getWorkingDir() const {return _currentDirectory.c_str();};
const TCHAR * getWorkSpaceFilePath(int i) const {
const wchar_t * getAppDataNppDir() const {return _appdataNppDir.c_str();};
const wchar_t * getPluginRootDir() const { return _pluginRootDir.c_str(); };
const wchar_t * getPluginConfDir() const { return _pluginConfDir.c_str(); };
const wchar_t * getUserPluginConfDir() const { return _userPluginConfDir.c_str(); };
const wchar_t * getWorkingDir() const {return _currentDirectory.c_str();};
const wchar_t * getWorkSpaceFilePath(int i) const {
if (i < 0 || i > 2) return nullptr;
return _workSpaceFilePathes[i].c_str();
};
@ -1670,9 +1670,9 @@ public:
const std::vector<std::wstring> getFileBrowserRoots() const { return _fileBrowserRoot; };
std::wstring getFileBrowserSelectedItemPath() const { return _fileBrowserSelectedItemPath; };
void setWorkSpaceFilePath(int i, const TCHAR *wsFile);
void setWorkSpaceFilePath(int i, const wchar_t *wsFile);
void setWorkingDir(const TCHAR * newPath);
void setWorkingDir(const wchar_t * newPath);
void setStartWithLocFileName(const std::wstring& locPath) {
_startWithLocFileName = locPath;
@ -1692,7 +1692,7 @@ public:
return _doPrintAndExit;
};
bool loadSession(Session& session, const TCHAR* sessionFileName, const bool bSuppressErrorMsg = false);
bool loadSession(Session& session, const wchar_t* sessionFileName, const bool bSuppressErrorMsg = false);
void setLoadedSessionFilePath(const std::wstring & loadedSessionFilePath) {
_loadedSessionFullFilePath = loadedSessionFilePath;
@ -1780,7 +1780,7 @@ public:
}
bool writeSettingsFilesOnCloudForThe1stTime(const std::wstring & cloudSettingsPath);
void setCloudChoice(const TCHAR *pathChoice);
void setCloudChoice(const wchar_t *pathChoice);
void removeCloudChoice();
bool isCloudPathChanged() const;
int archType() const { return ARCH_TYPE; };
@ -1935,7 +1935,7 @@ private:
std::wstring _nppPath;
std::wstring _userPath;
std::wstring _stylerPath;
std::wstring _appdataNppDir; // sentinel of the absence of "doLocalConf.xml" : (_appdataNppDir == TEXT(""))?"doLocalConf.xml present":"doLocalConf.xml absent"
std::wstring _appdataNppDir; // sentinel of the absence of "doLocalConf.xml" : (_appdataNppDir == L""))?"doLocalConf.xml present":"doLocalConf.xml absent"
std::wstring _pluginRootDir; // plugins root where all the plugins are installed
std::wstring _pluginConfDir; // plugins config dir where the plugin list is installed
std::wstring _userPluginConfDir; // plugins config dir for per user where the plugin parameters are saved / loaded
@ -2047,7 +2047,7 @@ private:
void insertUserCmd(TiXmlNodeA *userCmdRoot, const UserCommand & userCmd, const std::string& folderName);
void insertScintKey(TiXmlNodeA *scintKeyRoot, const ScintillaKeyMap & scintKeyMap);
void insertPluginCmd(TiXmlNodeA *pluginCmdRoot, const PluginCmdShortcut & pluginCmd);
TiXmlElement * insertGUIConfigBoolNode(TiXmlNode *r2w, const TCHAR *name, bool bVal);
TiXmlElement * insertGUIConfigBoolNode(TiXmlNode *r2w, const wchar_t *name, bool bVal);
void insertDockingParamNode(TiXmlNode *GUIRoot);
void writeExcludedLangList(TiXmlElement *element);
void writePrintSetting(TiXmlElement *element);