Code enhancement: use std::wstring instead of generic_string

This commit is contained in:
Don Ho 2023-07-21 12:11:08 +02:00
parent ff2179aeca
commit a367fc1b79
2 changed files with 213 additions and 230 deletions

View File

@ -615,7 +615,7 @@ int getKwClassFromName(const TCHAR *str)
} // anonymous namespace
void cutString(const TCHAR* str2cut, vector<generic_string>& patternVect)
void cutString(const TCHAR* str2cut, vector<std::wstring>& patternVect)
{
if (str2cut == nullptr) return;
@ -638,7 +638,7 @@ void cutString(const TCHAR* str2cut, vector<generic_string>& patternVect)
patternVect.emplace_back(pBegin, pEnd);
}
void cutStringBy(const TCHAR* str2cut, vector<generic_string>& patternVect, char byChar, bool allowEmptyStr)
void cutStringBy(const TCHAR* str2cut, vector<std::wstring>& patternVect, char byChar, bool allowEmptyStr)
{
if (str2cut == nullptr) return;
@ -710,11 +710,11 @@ bool LocalizationSwitcher::switchToLang(const wchar_t *lang2switch) const
}
generic_string ThemeSwitcher::getThemeFromXmlFileName(const TCHAR *xmlFullPath) const
std::wstring ThemeSwitcher::getThemeFromXmlFileName(const TCHAR *xmlFullPath) const
{
if (!xmlFullPath || !xmlFullPath[0])
return generic_string();
generic_string fn(::PathFindFileName(xmlFullPath));
return std::wstring();
std::wstring fn(::PathFindFileName(xmlFullPath));
PathRemoveExtension(const_cast<TCHAR *>(fn.c_str()));
return fn;
}
@ -722,7 +722,7 @@ generic_string ThemeSwitcher::getThemeFromXmlFileName(const TCHAR *xmlFullPath)
int DynamicMenu::getTopLevelItemNumber() const
{
int nb = 0;
generic_string previousFolderName;
std::wstring previousFolderName;
for (const MenuItemUnit& i : _menuItems)
{
if (i._parentFolderName.empty())
@ -759,7 +759,7 @@ int DynamicMenu::getTopLevelItemNumber() const
return nb;
}
bool DynamicMenu::attach(HMENU hMenu, unsigned int posBase, int lastCmd, const generic_string& lastCmdLabel)
bool DynamicMenu::attach(HMENU hMenu, unsigned int posBase, int lastCmd, const std::wstring& lastCmdLabel)
{
if (!hMenu) return false;
@ -790,7 +790,7 @@ bool DynamicMenu::createMenu() const
bool lastIsSep = false;
HMENU hParentFolder = NULL;
generic_string currentParentFolderStr;
std::wstring currentParentFolderStr;
int j = 0;
size_t nb = _menuItems.size();
@ -980,7 +980,7 @@ NppParameters::NppParameters()
_currentDirectory = curDir;
_appdataNppDir.clear();
generic_string notepadStylePath(_nppPath);
std::wstring notepadStylePath(_nppPath);
pathAppend(notepadStylePath, notepadStyleFile);
_asNotepadStyle = (PathFileExists(notepadStylePath.c_str()) == TRUE);
@ -1051,13 +1051,13 @@ bool NppParameters::reloadStylers(const TCHAR* stylePath)
bool NppParameters::reloadLang()
{
// use user path
generic_string nativeLangPath(_localizationSwitcher._nativeLangPath);
std::wstring nativeLangPath(_localizationSwitcher._nativeLangPath);
// if "nativeLang.xml" does not exist, use npp path
if (!PathFileExists(nativeLangPath.c_str()))
{
nativeLangPath = _nppPath;
pathAppend(nativeLangPath, generic_string(TEXT("nativeLang.xml")));
pathAppend(nativeLangPath, std::wstring(TEXT("nativeLang.xml")));
if (!PathFileExists(nativeLangPath.c_str()))
return false;
}
@ -1076,12 +1076,12 @@ bool NppParameters::reloadLang()
return loadOkay;
}
generic_string NppParameters::getSpecialFolderLocation(int folderKind)
std::wstring NppParameters::getSpecialFolderLocation(int folderKind)
{
TCHAR path[MAX_PATH];
const HRESULT specialLocationResult = SHGetFolderPath(nullptr, folderKind, nullptr, SHGFP_TYPE_CURRENT, path);
generic_string result;
std::wstring result;
if (SUCCEEDED(specialLocationResult))
{
result = path;
@ -1090,12 +1090,12 @@ generic_string NppParameters::getSpecialFolderLocation(int folderKind)
}
generic_string NppParameters::getSettingsFolder()
std::wstring NppParameters::getSettingsFolder()
{
if (_isLocal)
return _nppPath;
generic_string settingsFolderPath = getSpecialFolderLocation(CSIDL_APPDATA);
std::wstring settingsFolderPath = getSpecialFolderLocation(CSIDL_APPDATA);
if (settingsFolderPath.empty())
return _nppPath;
@ -1113,7 +1113,7 @@ bool NppParameters::load()
_isx64 = sizeof(void *) == 8;
// Make localConf.xml path
generic_string localConfPath(_nppPath);
std::wstring localConfPath(_nppPath);
pathAppend(localConfPath, localConfFile);
// Test if localConf.xml exist
@ -1126,7 +1126,7 @@ bool NppParameters::load()
// We check if OS is Vista or greater version
if (_winVersion >= WV_VISTA)
{
generic_string progPath = getSpecialFolderLocation(CSIDL_PROGRAM_FILES);
std::wstring progPath = getSpecialFolderLocation(CSIDL_PROGRAM_FILES);
TCHAR nppDirLocation[MAX_PATH];
wcscpy_s(nppDirLocation, _nppPath.c_str());
::PathRemoveFileSpec(nppDirLocation);
@ -1142,7 +1142,7 @@ bool NppParameters::load()
//
// the 3rd priority: general default configuration
//
generic_string nppPluginRootParent;
std::wstring nppPluginRootParent;
if (_isLocal)
{
_userPath = nppPluginRootParent = _nppPath;
@ -1180,7 +1180,7 @@ bool NppParameters::load()
_sessionPath = _userPath; // Session stock the absolute file path, it should never be on cloud
// Detection cloud settings
generic_string cloudChoicePath{_userPath};
std::wstring cloudChoicePath{_userPath};
cloudChoicePath += TEXT("\\cloud\\choice");
//
@ -1215,7 +1215,7 @@ bool NppParameters::load()
{
// The following text is not translatable.
// _pNativeLangSpeaker is initialized AFTER _userPath being dterminated because nativeLang.xml is from from _userPath.
generic_string errMsg = TEXT("The given path\r");
std::wstring errMsg = TEXT("The given path\r");
errMsg += _cmdSettingsDir;
errMsg += TEXT("\nvia command line \"-settingsDir=\" is not a valid directory.\rThis argument will be ignored.");
::MessageBox(NULL, errMsg.c_str(), TEXT("Invalid directory"), MB_OK);
@ -1230,7 +1230,7 @@ bool NppParameters::load()
//--------------------------//
// langs.xml : for per user //
//--------------------------//
generic_string langs_xml_path(_userPath);
std::wstring langs_xml_path(_userPath);
pathAppend(langs_xml_path, TEXT("langs.xml"));
BOOL doRecover = FALSE;
@ -1262,7 +1262,7 @@ bool NppParameters::load()
if (doRecover)
{
generic_string srcLangsPath(_nppPath);
std::wstring srcLangsPath(_nppPath);
pathAppend(srcLangsPath, TEXT("langs.model.xml"));
::CopyFile(srcLangsPath.c_str(), langs_xml_path.c_str(), FALSE);
}
@ -1296,10 +1296,10 @@ bool NppParameters::load()
//---------------------------//
// config.xml : for per user //
//---------------------------//
generic_string configPath(_userPath);
std::wstring configPath(_userPath);
pathAppend(configPath, TEXT("config.xml"));
generic_string srcConfigPath(_nppPath);
std::wstring srcConfigPath(_nppPath);
pathAppend(srcConfigPath, TEXT("config.model.xml"));
if (!::PathFileExists(configPath.c_str()))
@ -1327,7 +1327,7 @@ bool NppParameters::load()
if (!PathFileExists(_stylerPath.c_str()))
{
generic_string srcStylersPath(_nppPath);
std::wstring srcStylersPath(_nppPath);
pathAppend(srcStylersPath, TEXT("stylers.model.xml"));
::CopyFile(srcStylersPath.c_str(), _stylerPath.c_str(), TRUE);
@ -1373,7 +1373,7 @@ bool NppParameters::load()
pathAppend(_userDefineLangPath, TEXT("userDefineLang.xml"));
pathAppend(_userDefineLangsFolderPath, TEXT("userDefineLangs"));
std::vector<generic_string> udlFiles;
std::vector<std::wstring> udlFiles;
getFilesInFolder(udlFiles, TEXT("*.xml"), _userDefineLangsFolderPath);
_pXmlUserLangDoc = new TiXmlDocument(_userDefineLangPath);
@ -1413,7 +1413,7 @@ bool NppParameters::load()
// We'll look in the Notepad++ Dir. //
//----------------------------------------------//
generic_string nativeLangPath;
std::wstring nativeLangPath;
nativeLangPath = _userPath;
pathAppend(nativeLangPath, TEXT("nativeLang.xml"));
@ -1450,7 +1450,7 @@ bool NppParameters::load()
//---------------------------------//
// toolbarIcons.xml : for per user //
//---------------------------------//
generic_string toolbarIconsPath(_userPath);
std::wstring toolbarIconsPath(_userPath);
pathAppend(toolbarIconsPath, TEXT("toolbarIcons.xml"));
_pXmlToolIconsDoc = new TiXmlDocument(toolbarIconsPath);
@ -1472,7 +1472,7 @@ bool NppParameters::load()
if (!PathFileExists(_shortcutsPath.c_str()))
{
generic_string srcShortcutsPath(_nppPath);
std::wstring srcShortcutsPath(_nppPath);
pathAppend(srcShortcutsPath, SHORTCUTSXML_FILENAME);
::CopyFile(srcShortcutsPath.c_str(), _shortcutsPath.c_str(), TRUE);
@ -1510,7 +1510,7 @@ bool NppParameters::load()
if (!PathFileExists(_contextMenuPath.c_str()))
{
generic_string srcContextMenuPath(_nppPath);
std::wstring srcContextMenuPath(_nppPath);
pathAppend(srcContextMenuPath, TEXT("contextMenu.xml"));
::CopyFile(srcContextMenuPath.c_str(), _contextMenuPath.c_str(), TRUE);
@ -1569,7 +1569,7 @@ bool NppParameters::load()
// This empty xml file is optional - user adds this empty file //
// manually in order to set selected text's foreground color. //
//-------------------------------------------------------------//
generic_string enableSelectFgColorPath = _userPath;
std::wstring enableSelectFgColorPath = _userPath;
pathAppend(enableSelectFgColorPath, TEXT("enableSelectFgColor.xml"));
if (PathFileExists(enableSelectFgColorPath.c_str()))
@ -1578,7 +1578,7 @@ bool NppParameters::load()
}
generic_string filePath, filePath2, issueFileName;
std::wstring filePath, filePath2, issueFileName;
filePath = _nppPath;
issueFileName = nppLogNetworkDriveIssue;
@ -1684,7 +1684,7 @@ const TCHAR* NppParameters::getUserDefinedLangNameFromExt(TCHAR *ext, TCHAR *ful
if ((!ext) || (!ext[0]))
return nullptr;
std::vector<generic_string> extVect;
std::vector<std::wstring> extVect;
int iMatched = -1;
for (int i = 0 ; i < _nbUserLang ; ++i)
{
@ -1763,7 +1763,7 @@ void NppParameters::setCurLineHilitingColour(COLORREF colour2Set)
static int CALLBACK EnumFontFamExProc(const LOGFONT* lpelfe, const TEXTMETRIC*, DWORD, LPARAM lParam)
{
std::vector<generic_string>& strVect = *(std::vector<generic_string> *)lParam;
std::vector<std::wstring>& strVect = *(std::vector<std::wstring> *)lParam;
const int32_t vectSize = static_cast<int32_t>(strVect.size());
const TCHAR* lfFaceName = ((ENUMLOGFONTEX*)lpelfe)->elfLogFont.lfFaceName;
@ -1790,7 +1790,7 @@ void NppParameters::setFontList(HWND hWnd)
LOGFONT lf{};
_fontlist.clear();
_fontlist.reserve(64); // arbitrary
_fontlist.push_back(generic_string());
_fontlist.push_back(std::wstring());
lf.lfCharSet = DEFAULT_CHARSET;
lf.lfFaceName[0]='\0';
@ -1799,7 +1799,7 @@ void NppParameters::setFontList(HWND hWnd)
::EnumFontFamiliesEx(hDC, &lf, EnumFontFamExProc, reinterpret_cast<LPARAM>(&_fontlist), 0);
}
bool NppParameters::isInFontList(const generic_string& fontName2Search) const
bool NppParameters::isInFontList(const std::wstring& fontName2Search) const
{
if (fontName2Search.empty())
return false;
@ -2066,7 +2066,7 @@ bool NppParameters::reloadContextMenuFromXmlTree(HMENU mainMenuHadle, HMENU plug
return getContextMenuFromXmlTree(mainMenuHadle, pluginsMenu);
}
int NppParameters::getCmdIdFromMenuEntryItemName(HMENU mainMenuHadle, const generic_string& menuEntryName, const generic_string& menuItemName)
int NppParameters::getCmdIdFromMenuEntryItemName(HMENU mainMenuHadle, const std::wstring& menuEntryName, const std::wstring& menuItemName)
{
int nbMenuEntry = ::GetMenuItemCount(mainMenuHadle);
for (int i = 0; i < nbMenuEntry; ++i)
@ -2126,7 +2126,7 @@ int NppParameters::getCmdIdFromMenuEntryItemName(HMENU mainMenuHadle, const gene
return -1;
}
int NppParameters::getPluginCmdIdFromMenuEntryItemName(HMENU pluginsMenu, const generic_string& pluginName, const generic_string& pluginCmdName)
int NppParameters::getPluginCmdIdFromMenuEntryItemName(HMENU pluginsMenu, const std::wstring& pluginName, const std::wstring& pluginCmdName)
{
int nbPlugins = ::GetMenuItemCount(pluginsMenu);
for (int i = 0; i < nbPlugins; ++i)
@ -2177,8 +2177,8 @@ bool NppParameters::getContextMenuFromXmlTree(HMENU mainMenuHadle, HMENU plugins
const char *folderNameTranslateID_A = (childNode->ToElement())->Attribute("TranslateID");
const char *displayAsA = (childNode->ToElement())->Attribute("ItemNameAs");
generic_string folderName;
generic_string displayAs;
std::wstring folderName;
std::wstring displayAs;
folderName = folderNameDefaultA ? wmc.char2wchar(folderNameDefaultA, SC_CP_UTF8) : TEXT("");
displayAs = displayAsA ? wmc.char2wchar(displayAsA, SC_CP_UTF8) : TEXT("");
@ -2198,8 +2198,8 @@ bool NppParameters::getContextMenuFromXmlTree(HMENU mainMenuHadle, HMENU plugins
const char *menuEntryNameA = (childNode->ToElement())->Attribute("MenuEntryName");
const char *menuItemNameA = (childNode->ToElement())->Attribute("MenuItemName");
generic_string menuEntryName;
generic_string menuItemName;
std::wstring menuEntryName;
std::wstring menuItemName;
menuEntryName = menuEntryNameA?wmc.char2wchar(menuEntryNameA, SC_CP_UTF8):TEXT("");
menuItemName = menuItemNameA?wmc.char2wchar(menuItemNameA, SC_CP_UTF8):TEXT("");
@ -2214,8 +2214,8 @@ bool NppParameters::getContextMenuFromXmlTree(HMENU mainMenuHadle, HMENU plugins
const char *pluginNameA = (childNode->ToElement())->Attribute("PluginEntryName");
const char *pluginCmdNameA = (childNode->ToElement())->Attribute("PluginCommandItemName");
generic_string pluginName;
generic_string pluginCmdName;
std::wstring pluginName;
std::wstring pluginCmdName;
pluginName = pluginNameA?wmc.char2wchar(pluginNameA, SC_CP_UTF8):TEXT("");
pluginCmdName = pluginCmdNameA?wmc.char2wchar(pluginCmdNameA, SC_CP_UTF8):TEXT("");
@ -2472,7 +2472,7 @@ void NppParameters::feedFileListParameters(TiXmlNode *node)
const TCHAR *filePath = (childNode->ToElement())->Attribute(TEXT("filename"));
if (filePath)
{
_LRFileList[_nbRecentFile] = new generic_string(filePath);
_LRFileList[_nbRecentFile] = new std::wstring(filePath);
++_nbRecentFile;
}
}
@ -2608,7 +2608,7 @@ void NppParameters::feedFindHistoryParameters(TiXmlNode *node)
const TCHAR *filePath = (childNode->ToElement())->Attribute(TEXT("name"));
if (filePath)
{
_findHistory._findHistoryPaths.push_back(generic_string(filePath));
_findHistory._findHistoryPaths.push_back(std::wstring(filePath));
}
}
}
@ -2627,7 +2627,7 @@ void NppParameters::feedFindHistoryParameters(TiXmlNode *node)
const TCHAR *fileFilter = (childNode->ToElement())->Attribute(TEXT("name"));
if (fileFilter)
{
_findHistory._findHistoryFilters.push_back(generic_string(fileFilter));
_findHistory._findHistoryFilters.push_back(std::wstring(fileFilter));
}
}
}
@ -2646,7 +2646,7 @@ void NppParameters::feedFindHistoryParameters(TiXmlNode *node)
const TCHAR *fileFind = (childNode->ToElement())->Attribute(TEXT("name"));
if (fileFind)
{
_findHistory._findHistoryFinds.push_back(generic_string(fileFind));
_findHistory._findHistoryFinds.push_back(std::wstring(fileFind));
}
}
}
@ -2665,7 +2665,7 @@ void NppParameters::feedFindHistoryParameters(TiXmlNode *node)
const TCHAR *fileReplace = (childNode->ToElement())->Attribute(TEXT("name"));
if (fileReplace)
{
_findHistory._findHistoryReplaces.push_back(generic_string(fileReplace));
_findHistory._findHistoryReplaces.push_back(std::wstring(fileReplace));
}
}
}
@ -3061,7 +3061,7 @@ std::pair<unsigned char, unsigned char> NppParameters::feedUserLang(TiXmlNode *n
return pair<unsigned char, unsigned char>(static_cast<unsigned char>(iBegin), static_cast<unsigned char>(iEnd));
}
bool NppParameters::importUDLFromFile(const generic_string& sourceFile)
bool NppParameters::importUDLFromFile(const std::wstring& sourceFile)
{
TiXmlDocument *pXmlUserLangDoc = new TiXmlDocument(sourceFile);
@ -3082,7 +3082,7 @@ bool NppParameters::importUDLFromFile(const generic_string& sourceFile)
return loadOkay;
}
bool NppParameters::exportUDLToFile(size_t langIndex2export, const generic_string& fileName2save)
bool NppParameters::exportUDLToFile(size_t langIndex2export, const std::wstring& fileName2save)
{
if (langIndex2export >= NB_MAX_USER_LANG)
return false;
@ -3118,7 +3118,7 @@ LangType NppParameters::getLangFromExt(const TCHAR *ext)
if (pLS)
userList = pLS->getLexerUserExt();
generic_string list;
std::wstring list;
if (defList)
list += defList;
@ -3135,7 +3135,7 @@ LangType NppParameters::getLangFromExt(const TCHAR *ext)
void NppParameters::setCloudChoice(const TCHAR *pathChoice)
{
generic_string cloudChoicePath = getSettingsFolder();
std::wstring cloudChoicePath = getSettingsFolder();
cloudChoicePath += TEXT("\\cloud\\");
if (!PathFileExists(cloudChoicePath.c_str()))
@ -3152,7 +3152,7 @@ void NppParameters::setCloudChoice(const TCHAR *pathChoice)
void NppParameters::removeCloudChoice()
{
generic_string cloudChoicePath = getSettingsFolder();
std::wstring cloudChoicePath = getSettingsFolder();
cloudChoicePath += TEXT("\\cloud\\choice");
if (PathFileExists(cloudChoicePath.c_str()))
@ -3186,7 +3186,7 @@ bool NppParameters::isCloudPathChanged() const
return true;
}
bool NppParameters::writeSettingsFilesOnCloudForThe1stTime(const generic_string & cloudSettingsPath)
bool NppParameters::writeSettingsFilesOnCloudForThe1stTime(const std::wstring & cloudSettingsPath)
{
bool isOK = false;
@ -3194,7 +3194,7 @@ bool NppParameters::writeSettingsFilesOnCloudForThe1stTime(const generic_string
return false;
// config.xml
generic_string cloudConfigPath = cloudSettingsPath;
std::wstring cloudConfigPath = cloudSettingsPath;
pathAppend(cloudConfigPath, TEXT("config.xml"));
if (!::PathFileExists(cloudConfigPath.c_str()) && _pXmlUserDoc)
{
@ -3204,7 +3204,7 @@ bool NppParameters::writeSettingsFilesOnCloudForThe1stTime(const generic_string
}
// stylers.xml
generic_string cloudStylersPath = cloudSettingsPath;
std::wstring cloudStylersPath = cloudSettingsPath;
pathAppend(cloudStylersPath, TEXT("stylers.xml"));
if (!::PathFileExists(cloudStylersPath.c_str()) && _pXmlUserStylerDoc)
{
@ -3214,7 +3214,7 @@ bool NppParameters::writeSettingsFilesOnCloudForThe1stTime(const generic_string
}
// langs.xml
generic_string cloudLangsPath = cloudSettingsPath;
std::wstring cloudLangsPath = cloudSettingsPath;
pathAppend(cloudLangsPath, TEXT("langs.xml"));
if (!::PathFileExists(cloudLangsPath.c_str()) && _pXmlUserDoc)
{
@ -3224,7 +3224,7 @@ bool NppParameters::writeSettingsFilesOnCloudForThe1stTime(const generic_string
}
// userDefineLang.xml
generic_string cloudUserLangsPath = cloudSettingsPath;
std::wstring cloudUserLangsPath = cloudSettingsPath;
pathAppend(cloudUserLangsPath, TEXT("userDefineLang.xml"));
if (!::PathFileExists(cloudUserLangsPath.c_str()) && _pXmlUserLangDoc)
{
@ -3234,7 +3234,7 @@ bool NppParameters::writeSettingsFilesOnCloudForThe1stTime(const generic_string
}
// shortcuts.xml
generic_string cloudShortcutsPath = cloudSettingsPath;
std::wstring cloudShortcutsPath = cloudSettingsPath;
pathAppend(cloudShortcutsPath, SHORTCUTSXML_FILENAME);
if (!::PathFileExists(cloudShortcutsPath.c_str()) && _pXmlShortcutDocA)
{
@ -3244,7 +3244,7 @@ bool NppParameters::writeSettingsFilesOnCloudForThe1stTime(const generic_string
}
// contextMenu.xml
generic_string cloudContextMenuPath = cloudSettingsPath;
std::wstring cloudContextMenuPath = cloudSettingsPath;
pathAppend(cloudContextMenuPath, TEXT("contextMenu.xml"));
if (!::PathFileExists(cloudContextMenuPath.c_str()) && _pXmlContextMenuDocA)
{
@ -3254,7 +3254,7 @@ bool NppParameters::writeSettingsFilesOnCloudForThe1stTime(const generic_string
}
// nativeLang.xml
generic_string cloudNativeLangPath = cloudSettingsPath;
std::wstring cloudNativeLangPath = cloudSettingsPath;
pathAppend(cloudNativeLangPath, TEXT("nativeLang.xml"));
if (!::PathFileExists(cloudNativeLangPath.c_str()) && _pXmlNativeLangDocA)
{
@ -4234,7 +4234,7 @@ bool NppParameters::writeProjectPanelsSettings() const
return true;
}
bool NppParameters::writeFileBrowserSettings(const vector<generic_string> & rootPaths, const generic_string & latestSelectedItemPath) const
bool NppParameters::writeFileBrowserSettings(const vector<std::wstring> & rootPaths, const std::wstring & latestSelectedItemPath) const
{
if (!_pXmlUserDoc) return false;
@ -4338,7 +4338,7 @@ LangType NppParameters::getLangIDFromStr(const TCHAR *langName)
return L_TEXT;
}
generic_string NppParameters::getLocPathFromStr(const generic_string & localizationCode)
std::wstring NppParameters::getLocPathFromStr(const std::wstring & localizationCode)
{
if (localizationCode == TEXT("en") || localizationCode == TEXT("en-au") || localizationCode == TEXT("en-bz") || localizationCode == TEXT("en-ca") || localizationCode == TEXT("en-cb") || localizationCode == TEXT("en-gb") || localizationCode == TEXT("en-ie") || localizationCode == TEXT("en-jm") || localizationCode == TEXT("en-nz") || localizationCode == TEXT("en-ph") || localizationCode == TEXT("en-tt") || localizationCode == TEXT("en-us") || localizationCode == TEXT("en-za") || localizationCode == TEXT("en-zw"))
return TEXT("english.xml");
@ -4525,7 +4525,7 @@ generic_string NppParameters::getLocPathFromStr(const generic_string & localizat
if (localizationCode == TEXT("ab") || localizationCode == TEXT("abk"))
return TEXT("abkhazian.xml");
return generic_string();
return std::wstring();
}
@ -5744,10 +5744,10 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
::ExpandEnvironmentStrings(_nppGUI._defaultDir, _nppGUI._defaultDirExp, MAX_PATH);
}
const TCHAR* path2 = element->Attribute(TEXT("lastUsedDirPath"));
if (path2 && path2[0])
path = element->Attribute(TEXT("lastUsedDirPath"));
if (path && path[0])
{
lstrcpyn(_nppGUI._lastUsedDir, path2, MAX_PATH);
lstrcpyn(_nppGUI._lastUsedDir, path, MAX_PATH);
}
}
@ -6100,8 +6100,8 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
// Windows mode is handled later in Notepad_plus_Window::init from Notepad_plus_Window.cpp
if (!windowsMode)
{
generic_string themePath;
generic_string xmlFileName = _nppGUI._darkmode._isEnabled ? darkThemeName : lightThemeName;
std::wstring themePath;
std::wstring xmlFileName = _nppGUI._darkmode._isEnabled ? darkThemeName : lightThemeName;
const bool isLocalOnly = _isLocal && !_isCloud;
if (!xmlFileName.empty() && lstrcmp(xmlFileName.c_str(), TEXT("stylers.xml")) != 0)
@ -6719,11 +6719,11 @@ bool NppParameters::writeScintillaParams()
(scintNode->ToElement())->SetAttribute(TEXT("Wrap"), _svp._doWrap?TEXT("yes"):TEXT("no"));
(scintNode->ToElement())->SetAttribute(TEXT("borderEdge"), _svp._showBorderEdge ? TEXT("yes") : TEXT("no"));
generic_string edgeColumnPosStr;
std::wstring edgeColumnPosStr;
for (auto i : _svp._edgeMultiColumnPos)
{
std::string s = std::to_string(i);
edgeColumnPosStr += generic_string(s.begin(), s.end());
edgeColumnPosStr += std::wstring(s.begin(), s.end());
edgeColumnPosStr += TEXT(" ");
}
(scintNode->ToElement())->SetAttribute(TEXT("isEdgeBgMode"), _svp._isEdgeBgMode ? TEXT("yes") : TEXT("no"));
@ -7873,7 +7873,7 @@ int NppParameters::langTypeToCommandID(LangType lt) const
return id;
}
generic_string NppParameters:: getWinVersionStr() const
std::wstring NppParameters:: getWinVersionStr() const
{
switch (_winVersion)
{
@ -7896,7 +7896,7 @@ generic_string NppParameters:: getWinVersionStr() const
}
}
generic_string NppParameters::getWinVerBitStr() const
std::wstring NppParameters::getWinVerBitStr() const
{
switch (_platForm)
{
@ -7913,7 +7913,7 @@ generic_string NppParameters::getWinVerBitStr() const
}
}
generic_string NppParameters::writeStyles(LexerStylerArray & lexersStylers, StyleArray & globalStylers)
std::wstring NppParameters::writeStyles(LexerStylerArray & lexersStylers, StyleArray & globalStylers)
{
TiXmlNode *lexersRoot = (_pXmlUserStylerDoc->FirstChild(TEXT("NotepadPlus")))->FirstChildElement(TEXT("LexerStyles"));
for (TiXmlNode *childNode = lexersRoot->FirstChildElement(TEXT("LexerType"));
@ -8095,7 +8095,7 @@ void NppParameters::insertUserLang2Tree(TiXmlNode *node, UserLangContainer *user
TiXmlElement *rootElement = (node->InsertEndChild(TiXmlElement(TEXT("UserLang"))))->ToElement();
TCHAR temp[32];
generic_string udlVersion;
std::wstring udlVersion;
udlVersion += _itow(SCE_UDL_VERSION_MAJOR, temp, 10);
udlVersion += TEXT(".");
udlVersion += _itow(SCE_UDL_VERSION_MINOR, temp, 10);
@ -8344,10 +8344,10 @@ Date::Date(const TCHAR *dateStr)
if ( 8==D )
{
generic_string ds(dateStr);
generic_string yyyy(ds, 0, 4);
generic_string mm(ds, 4, 2);
generic_string dd(ds, 6, 2);
std::wstring ds(dateStr);
std::wstring yyyy(ds, 0, 4);
std::wstring mm(ds, 4, 2);
std::wstring dd(ds, 6, 2);
int y = _wtoi(yyyy.c_str());
int m = _wtoi(mm.c_str());

View File

@ -146,8 +146,8 @@ const TCHAR notepadStyleFile[] = TEXT("asNotepad.xml");
const TCHAR nppLogNetworkDriveIssue[] = TEXT("nppLogNetworkDriveIssue");
const TCHAR nppLogNulContentCorruptionIssue[] = TEXT("nppLogNulContentCorruptionIssue");
void cutString(const TCHAR *str2cut, std::vector<generic_string> & patternVect);
void cutStringBy(const TCHAR *str2cut, std::vector<generic_string> & patternVect, char byChar, bool allowEmptyStr);
void cutString(const TCHAR *str2cut, std::vector<std::wstring> & patternVect);
void cutStringBy(const TCHAR *str2cut, std::vector<std::wstring> & patternVect, char byChar, bool allowEmptyStr);
// style names
const wchar_t g_npcStyleName[] = L"Non-printing characters custom color";
@ -224,10 +224,10 @@ struct Session
size_t _activeMainIndex = 0;
size_t _activeSubIndex = 0;
bool _includeFileBrowser = false;
generic_string _fileBrowserSelectedItem;
std::wstring _fileBrowserSelectedItem;
std::vector<sessionFileInfo> _mainViewFiles;
std::vector<sessionFileInfo> _subViewFiles;
std::vector<generic_string> _fileBrowserRoots;
std::vector<std::wstring> _fileBrowserRoots;
};
@ -254,11 +254,11 @@ struct CmdLineParams
bool _monitorFiles = false;
LangType _langType = L_EXTERNAL;
generic_string _localizationPath;
generic_string _udlName;
generic_string _pluginMessage;
std::wstring _localizationPath;
std::wstring _udlName;
std::wstring _pluginMessage;
generic_string _easterEggName;
std::wstring _easterEggName;
unsigned char _quoteType = 0;
int _ghostTypingSpeed = -1; // -1: initial value 1: slow 2: fast 3: speed of light
@ -331,7 +331,7 @@ struct FloatingWindowInfo
struct PluginDlgDockingInfo final
{
generic_string _name;
std::wstring _name;
int _internalID = -1;
int _currContainer = -1;
@ -404,21 +404,21 @@ const int COLORSTYLE_ALL = COLORSTYLE_FOREGROUND|COLORSTYLE_BACKGROUND;
struct Style final
{
int _styleID = STYLE_NOT_USED;
generic_string _styleDesc;
std::wstring _styleDesc;
COLORREF _fgColor = COLORREF(STYLE_NOT_USED);
COLORREF _bgColor = COLORREF(STYLE_NOT_USED);
int _colorStyle = COLORSTYLE_ALL;
bool _isFontEnabled = false;
generic_string _fontName;
std::wstring _fontName;
int _fontStyle = STYLE_NOT_USED;
int _fontSize = STYLE_NOT_USED;
int _nesting = FONTSTYLE_NONE;
int _keywordClass = STYLE_NOT_USED;
generic_string _keywords;
std::wstring _keywords;
};
@ -447,7 +447,7 @@ struct StyleArray
void addStyler(int styleID, TiXmlNode *styleNode);
void addStyler(int styleID, const generic_string& styleName) {
void addStyler(int styleID, const std::wstring& styleName) {
_styleVect.emplace_back();
Style& s = _styleVect.back();
s._styleID = styleID;
@ -465,7 +465,7 @@ struct StyleArray
return nullptr;
};
Style* findByName(const generic_string& name) {
Style* findByName(const std::wstring& name) {
for (size_t i = 0; i < _styleVect.size(); ++i)
{
if (_styleVect[i]._styleDesc == name)
@ -514,9 +514,9 @@ public:
const TCHAR * getLexerUserExt() const {return _lexerUserExt.c_str();};
private :
generic_string _lexerName;
generic_string _lexerDesc;
generic_string _lexerUserExt;
std::wstring _lexerName;
std::wstring _lexerDesc;
std::wstring _lexerUserExt;
};
struct SortLexersInAlphabeticalOrder {
@ -651,7 +651,7 @@ public:
void now();
generic_string toString() const // Return Notepad++ date format : YYYYMMDD
std::wstring toString() const // Return Notepad++ date format : YYYYMMDD
{
TCHAR dateStr[16];
wsprintf(dateStr, TEXT("%04u%02u%02u"), _year, _month, _day);
@ -744,23 +744,6 @@ struct LargeFileRestriction final
struct NppGUI final
{
NppGUI()
{
_appPos.left = 0;
_appPos.top = 0;
_appPos.right = 1100;
_appPos.bottom = 700;
_findWindowPos.left = 0;
_findWindowPos.top = 0;
_findWindowPos.right = 0;
_findWindowPos.bottom = 0;
_defaultDir[0] = 0;
_defaultDirExp[0] = 0;
_lastUsedDir[0] = 0;
}
toolBarStatusType _toolBarStatus = TB_STANDARD;
bool _toolbarShow = true;
bool _statusBarShow = true;
@ -790,9 +773,9 @@ struct NppGUI final
bool _checkHistoryFiles = false;
RECT _appPos = {};
RECT _appPos {};
RECT _findWindowPos = {};
RECT _findWindowPos {};
bool _findWindowLessMode = false;
bool _isMaximized = false;
@ -836,10 +819,10 @@ struct NppGUI final
bool _isWordCharDefault = true;
std::string _customWordChars;
urlMode _styleURL = urlUnderLineFg;
generic_string _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 = TEXT("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;
generic_string _dateTimeFormat = TEXT("yyyy-MM-dd HH:mm:ss");
std::wstring _dateTimeFormat = TEXT("yyyy-MM-dd HH:mm:ss");
bool _dateTimeReverseDefaultOrder = false;
void setTabReplacedBySpace(bool b) {_tabReplacedBySpace = b;};
@ -850,7 +833,7 @@ struct NppGUI final
PrintSettings _printSettings;
BackupFeature _backup = bak_none;
bool _useDir = false;
generic_string _backupDir;
std::wstring _backupDir;
DockingManagerData _dockingData;
GlobalOverride _globalOverride;
enum AutocStatus{autoc_none, autoc_func, autoc_word, autoc_both};
@ -863,10 +846,10 @@ struct NppGUI final
bool _funcParams = true;
MatchedPairConf _matchedPairConf;
generic_string _definedSessionExt;
generic_string _definedWorkspaceExt;
std::wstring _definedSessionExt;
std::wstring _definedWorkspaceExt;
generic_string _commandLineInterpreter = CMD_INTERPRETER;
std::wstring _commandLineInterpreter = CMD_INTERPRETER;
struct AutoUpdateOptions
{
@ -886,11 +869,11 @@ struct NppGUI final
OpenSaveDirSetting _openSaveDir = dir_followCurrent;
TCHAR _defaultDir[MAX_PATH];
TCHAR _defaultDirExp[MAX_PATH]; //expanded environment variables
TCHAR _lastUsedDir[MAX_PATH];
TCHAR _defaultDir[MAX_PATH]{};
TCHAR _defaultDirExp[MAX_PATH]{}; //expanded environment variables
TCHAR _lastUsedDir[MAX_PATH]{};
generic_string _themeName;
std::wstring _themeName;
MultiInstSetting _multiInstSetting = monoInst;
bool _clipboardHistoryPanelKeepState = false;
bool _docListKeepState = false;
@ -908,12 +891,12 @@ struct NppGUI final
bool isSnapshotMode() const {return _isSnapshotMode && _rememberLastSession && !_isCmdlineNosessionActivated;};
bool _isSnapshotMode = true;
size_t _snapshotBackupTiming = 7000;
generic_string _cloudPath; // this option will never be read/written from/to config.xml
std::wstring _cloudPath; // this option will never be read/written from/to config.xml
unsigned char _availableClouds = '\0'; // this option will never be read/written from/to config.xml
enum SearchEngineChoice{ se_custom = 0, se_duckDuckGo = 1, se_google = 2, se_bing = 3, se_yahoo = 4, se_stackoverflow = 5 };
SearchEngineChoice _searchEngineChoice = se_google;
generic_string _searchEngineCustom;
std::wstring _searchEngineCustom;
bool _isFolderDroppedOpenFiles = false;
@ -1009,7 +992,7 @@ const int MASK_TabSize = 0x7F;
struct Lang final
{
LangType _langID = L_TEXT;
generic_string _langName;
std::wstring _langName;
const TCHAR* _defaultExtList = nullptr;
const TCHAR* _langKeyWordList[NB_LIST];
const TCHAR* _pCommentLineSymbol = nullptr;
@ -1129,10 +1112,10 @@ public:
private:
StyleArray _styles;
generic_string _name;
generic_string _ext;
std::wstring _name;
std::wstring _ext;
bool _isDarkModeTheme = false;
generic_string _udlVersion;
std::wstring _udlVersion;
TCHAR _keywordLists[SCE_USER_KWLIST_TOTAL][max_char];
bool _isPrefix[SCE_USER_TOTAL_KEYWORD_GROUPS] = {false};
@ -1187,10 +1170,10 @@ struct FindHistory final
int _nbMaxFindHistoryFind = 10;
int _nbMaxFindHistoryReplace = 10;
std::vector<generic_string> _findHistoryPaths;
std::vector<generic_string> _findHistoryFilters;
std::vector<generic_string> _findHistoryFinds;
std::vector<generic_string> _findHistoryReplaces;
std::vector<std::wstring> _findHistoryPaths;
std::vector<std::wstring> _findHistoryFilters;
std::vector<std::wstring> _findHistoryFinds;
std::vector<std::wstring> _findHistoryReplaces;
bool _isMatchWord = false;
bool _isMatchCase = false;
@ -1284,20 +1267,20 @@ class ThemeSwitcher final
friend class NppParameters;
public:
void addThemeFromXml(const generic_string& xmlFullPath) {
_themeList.push_back(std::pair<generic_string, generic_string>(getThemeFromXmlFileName(xmlFullPath.c_str()), xmlFullPath));
void addThemeFromXml(const std::wstring& xmlFullPath) {
_themeList.push_back(std::pair<std::wstring, std::wstring>(getThemeFromXmlFileName(xmlFullPath.c_str()), xmlFullPath));
}
void addDefaultThemeFromXml(const generic_string& xmlFullPath) {
_themeList.push_back(std::pair<generic_string, generic_string>(_defaultThemeLabel, xmlFullPath));
void addDefaultThemeFromXml(const std::wstring& xmlFullPath) {
_themeList.push_back(std::pair<std::wstring, std::wstring>(_defaultThemeLabel, xmlFullPath));
}
generic_string getThemeFromXmlFileName(const TCHAR *fn) const;
std::wstring getThemeFromXmlFileName(const TCHAR *fn) const;
generic_string getXmlFilePathFromThemeName(const TCHAR *themeName) const {
std::wstring getXmlFilePathFromThemeName(const TCHAR *themeName) const {
if (!themeName || themeName[0])
return generic_string();
generic_string themePath = _stylesXmlPath;
return std::wstring();
std::wstring themePath = _stylesXmlPath;
return themePath;
}
@ -1314,18 +1297,18 @@ public:
size_t size() const { return _themeList.size(); }
std::pair<generic_string, generic_string> & getElementFromIndex(size_t index)
std::pair<std::wstring, std::wstring> & getElementFromIndex(size_t index)
{
assert(index < _themeList.size());
return _themeList[index];
}
void setThemeDirPath(generic_string themeDirPath) { _themeDirPath = themeDirPath; }
generic_string getThemeDirPath() const { return _themeDirPath; }
void setThemeDirPath(std::wstring themeDirPath) { _themeDirPath = themeDirPath; }
std::wstring getThemeDirPath() const { return _themeDirPath; }
generic_string getDefaultThemeLabel() const { return _defaultThemeLabel; }
std::wstring getDefaultThemeLabel() const { return _defaultThemeLabel; }
generic_string getSavePathFrom(const generic_string& path) const {
std::wstring getSavePathFrom(const std::wstring& path) const {
const auto iter = _themeStylerSavePath.find(path);
if (iter == _themeStylerSavePath.end())
{
@ -1337,16 +1320,16 @@ public:
}
};
void addThemeStylerSavePath(generic_string key, generic_string val) {
void addThemeStylerSavePath(std::wstring key, std::wstring val) {
_themeStylerSavePath[key] = val;
};
private:
std::vector<std::pair<generic_string, generic_string>> _themeList;
std::map<generic_string, generic_string> _themeStylerSavePath;
generic_string _themeDirPath;
const generic_string _defaultThemeLabel = TEXT("Default (stylers.xml)");
generic_string _stylesXmlPath;
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)");
std::wstring _stylesXmlPath;
};
@ -1368,7 +1351,7 @@ const int RECENTFILES_SHOWONLYFILENAME = 0;
class DynamicMenu final
{
public:
bool attach(HMENU hMenu, unsigned int posBase, int lastCmd, const generic_string& lastCmdLabel);
bool attach(HMENU hMenu, unsigned int posBase, int lastCmd, const std::wstring& lastCmdLabel);
bool createMenu() const;
bool clearMenu() const;
int getTopLevelItemNumber() const;
@ -1386,14 +1369,14 @@ public:
unsigned int getPosBase() const { return _posBase; };
generic_string getLastCmdLabel() const { return _lastCmdLabel; };
std::wstring getLastCmdLabel() const { return _lastCmdLabel; };
private:
std::vector<MenuItemUnit> _menuItems;
HMENU _hMenu = nullptr;
unsigned int _posBase = 0;
int _lastCmd = 0;
generic_string _lastCmdLabel;
std::wstring _lastCmdLabel;
};
class NppParameters final
@ -1410,13 +1393,13 @@ public:
};
static LangType getLangIDFromStr(const TCHAR *langName);
static generic_string getLocPathFromStr(const generic_string & localizationCode);
static std::wstring getLocPathFromStr(const std::wstring & localizationCode);
bool load();
bool reloadLang();
bool reloadStylers(const TCHAR *stylePath = nullptr);
void destroyInstance();
generic_string getSettingsFolder();
std::wstring getSettingsFolder();
bool _isTaskListRBUTTONUP_Active = false;
int L_END;
@ -1474,7 +1457,7 @@ public:
int getNbLRFile() const {return _nbRecentFile;};
generic_string *getLRFile(int index) const {
std::wstring *getLRFile(int index) const {
return _LRFileList[index];
};
@ -1506,14 +1489,14 @@ public:
bool writeProjectPanelsSettings() const;
bool writeColumnEditorSettings() const;
bool writeFileBrowserSettings(const std::vector<generic_string> & rootPath, const generic_string & latestSelectedItemPath) 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;
bool writeScintillaParams();
void createXmlTreeFromGUIParams();
generic_string writeStyles(LexerStylerArray & lexersStylers, StyleArray & globalStylers); // return "" if saving file succeeds, otherwise return the new saved file path
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);
LexerStylerArray & getLStylerArray() {return _lexerStylerVect;};
@ -1526,8 +1509,8 @@ public:
void setCurLineHilitingColour(COLORREF colour2Set);
void setFontList(HWND hWnd);
bool isInFontList(const generic_string& fontName2Search) const;
const std::vector<generic_string>& getFontList() const { return _fontlist; }
bool isInFontList(const std::wstring& fontName2Search) const;
const std::vector<std::wstring>& getFontList() const { return _fontlist; }
enum class DefaultFontType { menu, status, message, caption, smcaption };
static LOGFONT getDefaultGUIFont(DefaultFontType type = DefaultFontType::message);
@ -1596,8 +1579,8 @@ public:
const CmdLineParamsDTO & getCmdLineParams() const {return _cmdLineParams;};
const generic_string& getCmdLineString() const { return _cmdLineString; }
void setCmdLineString(const generic_string& str) { _cmdLineString = str; }
const std::wstring& getCmdLineString() const { return _cmdLineString; }
void setCmdLineString(const std::wstring& str) { _cmdLineString = str; }
void setFileSaveDlgFilterIndex(int ln) {_fileSaveDlgFilterIndex = ln;};
int getFileSaveDlgFilterIndex() const {return _fileSaveDlgFilterIndex;};
@ -1632,8 +1615,8 @@ public:
void setScintillaAccelerator(ScintillaAccelerator *pScintAccel) {_pScintAccelerator = pScintAccel;};
ScintillaAccelerator * getScintillaAccelerator() {return _pScintAccelerator;};
generic_string getNppPath() const {return _nppPath;};
generic_string getContextMenuPath() const {return _contextMenuPath;};
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(); };
@ -1644,14 +1627,14 @@ public:
return _workSpaceFilePathes[i].c_str();
};
const std::vector<generic_string> getFileBrowserRoots() const { return _fileBrowserRoot; };
generic_string getFileBrowserSelectedItemPath() const { return _fileBrowserSelectedItemPath; };
const std::vector<std::wstring> getFileBrowserRoots() const { return _fileBrowserRoot; };
std::wstring getFileBrowserSelectedItemPath() const { return _fileBrowserSelectedItemPath; };
void setWorkSpaceFilePath(int i, const TCHAR *wsFile);
void setWorkingDir(const TCHAR * newPath);
void setStartWithLocFileName(const generic_string& locPath) {
void setStartWithLocFileName(const std::wstring& locPath) {
_startWithLocFileName = locPath;
};
@ -1671,22 +1654,22 @@ public:
bool loadSession(Session & session, const TCHAR *sessionFileName);
void setLoadedSessionFilePath(const generic_string & loadedSessionFilePath) {
void setLoadedSessionFilePath(const std::wstring & loadedSessionFilePath) {
_loadedSessionFullFilePath = loadedSessionFilePath;
};
generic_string getLoadedSessionFilePath() {
std::wstring getLoadedSessionFilePath() {
return _loadedSessionFullFilePath;
};
int langTypeToCommandID(LangType lt) const;
struct FindDlgTabTitiles final {
generic_string _find;
generic_string _replace;
generic_string _findInFiles;
generic_string _findInProjects;
generic_string _mark;
std::wstring _find;
std::wstring _replace;
std::wstring _findInFiles;
std::wstring _findInProjects;
std::wstring _mark;
};
FindDlgTabTitiles & getFindDlgTabTitiles() { return _findDlgTabTitiles;};
@ -1700,8 +1683,8 @@ public:
bool getContextMenuFromXmlTree(HMENU mainMenuHadle, HMENU pluginsMenu, bool isEditCM = true);
bool reloadContextMenuFromXmlTree(HMENU mainMenuHadle, HMENU pluginsMenu);
winVer getWinVersion() const {return _winVersion;};
generic_string getWinVersionStr() const;
generic_string getWinVerBitStr() const;
std::wstring getWinVersionStr() const;
std::wstring getWinVerBitStr() const;
FindHistory & getFindHistory() {return _findHistory;};
bool _isFindReplacing = false; // an on the fly variable for find/replace functions
void safeWow64EnableWow64FsRedirection(BOOL Wow64FsEnableRedirection);
@ -1714,7 +1697,7 @@ public:
return _themeSwitcher;
}
std::vector<generic_string> & getBlackList() { return _blacklist; };
std::vector<std::wstring> & getBlackList() { return _blacklist; };
bool isInBlackList(TCHAR *fn) const
{
for (auto& element: _blacklist)
@ -1725,8 +1708,8 @@ public:
return false;
}
bool importUDLFromFile(const generic_string& sourceFile);
bool exportUDLToFile(size_t langIndex2export, const generic_string& fileName2save);
bool importUDLFromFile(const std::wstring& sourceFile);
bool exportUDLToFile(size_t langIndex2export, const std::wstring& fileName2save);
NativeLangSpeaker* getNativeLangSpeaker() {
return _pNativeLangSpeaker;
}
@ -1744,19 +1727,19 @@ public:
void saveConfig_xml();
generic_string getUserPath() const {
std::wstring getUserPath() const {
return _userPath;
}
generic_string getUserDefineLangFolderPath() const {
std::wstring getUserDefineLangFolderPath() const {
return _userDefineLangsFolderPath;
}
generic_string getUserDefineLangPath() const {
std::wstring getUserDefineLangPath() const {
return _userDefineLangPath;
}
bool writeSettingsFilesOnCloudForThe1stTime(const generic_string & cloudSettingsPath);
bool writeSettingsFilesOnCloudForThe1stTime(const std::wstring & cloudSettingsPath);
void setCloudChoice(const TCHAR *pathChoice);
void removeCloudChoice();
bool isCloudPathChanged() const;
@ -1777,21 +1760,21 @@ public:
_currentDefaultFgColor = c;
}
void setCmdSettingsDir(const generic_string& settingsDir) {
void setCmdSettingsDir(const std::wstring& settingsDir) {
_cmdSettingsDir = settingsDir;
};
void setTitleBarAdd(const generic_string& titleAdd) {
void setTitleBarAdd(const std::wstring& titleAdd) {
_titleBarAdditional = titleAdd;
}
const generic_string& getTitleBarAdd() const {
const std::wstring& getTitleBarAdd() const {
return _titleBarAdditional;
}
DPIManager _dpiManager;
generic_string static getSpecialFolderLocation(int folderKind);
std::wstring static getSpecialFolderLocation(int folderKind);
void setUdlXmlDirtyFromIndex(size_t i);
void setUdlXmlDirtyFromXmlDoc(const TiXmlDocument* xmlDoc);
@ -1834,7 +1817,7 @@ private:
int _nbLang = 0;
// Recent File History
generic_string* _LRFileList[NB_MAX_LRF_FILE] = { nullptr };
std::wstring* _LRFileList[NB_MAX_LRF_FILE] = { nullptr };
int _nbRecentFile = 0;
UINT _nbMaxRecentFile = 10;
bool _putRecentFileInSubMenu = false;
@ -1846,13 +1829,13 @@ private:
UserLangContainer* _userLangArray[NB_MAX_USER_LANG] = { nullptr };
unsigned char _nbUserLang = 0; // won't be exceeded to 255;
generic_string _userDefineLangsFolderPath;
generic_string _userDefineLangPath;
std::wstring _userDefineLangsFolderPath;
std::wstring _userDefineLangPath;
ExternalLangContainer* _externalLangArray[NB_MAX_EXTERNAL_LANG] = { nullptr };
int _nbExternalLang = 0;
CmdLineParamsDTO _cmdLineParams;
generic_string _cmdLineString;
std::wstring _cmdLineString;
int _fileSaveDlgFilterIndex = -1;
@ -1860,17 +1843,17 @@ private:
LexerStylerArray _lexerStylerVect;
StyleArray _widgetStyleArray;
std::vector<generic_string> _fontlist;
std::vector<generic_string> _blacklist;
std::vector<std::wstring> _fontlist;
std::vector<std::wstring> _blacklist;
bool _isLocal = false;
bool _isx64 = false; // by default 32-bit
bool _isCloud = false;
generic_string _cmdSettingsDir;
generic_string _titleBarAdditional;
std::wstring _cmdSettingsDir;
std::wstring _titleBarAdditional;
generic_string _loadedSessionFullFilePath;
std::wstring _loadedSessionFullFilePath;
public:
void setShortcutDirty() { _isAnyShortcutModified = true; };
@ -1892,7 +1875,7 @@ private:
std::vector<int> _scintillaModifiedKeyIndices; //modified scintilla keys. Indices static, determined by searching for commandId. Needed when saving alterations
LocalizationSwitcher _localizationSwitcher;
generic_string _startWithLocFileName;
std::wstring _startWithLocFileName;
bool _doFunctionListExport = false;
bool _doPrintAndExit = false;
@ -1904,22 +1887,22 @@ private:
DynamicMenu _runMenuItems;
Session _session;
generic_string _shortcutsPath;
generic_string _contextMenuPath;
generic_string _tabContextMenuPath;
generic_string _sessionPath;
generic_string _nppPath;
generic_string _userPath;
generic_string _stylerPath;
generic_string _appdataNppDir; // sentinel of the absence of "doLocalConf.xml" : (_appdataNppDir == TEXT(""))?"doLocalConf.xml present":"doLocalConf.xml absent"
generic_string _pluginRootDir; // plugins root where all the plugins are installed
generic_string _pluginConfDir; // plugins config dir where the plugin list is installed
generic_string _userPluginConfDir; // plugins config dir for per user where the plugin parameters are saved / loaded
generic_string _currentDirectory;
generic_string _workSpaceFilePathes[3];
std::wstring _shortcutsPath;
std::wstring _contextMenuPath;
std::wstring _tabContextMenuPath;
std::wstring _sessionPath;
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 _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
std::wstring _currentDirectory;
std::wstring _workSpaceFilePathes[3];
std::vector<generic_string> _fileBrowserRoot;
generic_string _fileBrowserSelectedItemPath;
std::vector<std::wstring> _fileBrowserRoot;
std::wstring _fileBrowserSelectedItemPath;
Accelerator* _pAccelerator = nullptr;
ScintillaAccelerator* _pScintAccelerator = nullptr;
@ -1935,11 +1918,11 @@ private:
COLORREF _currentDefaultBgColor = RGB(0xFF, 0xFF, 0xFF);
COLORREF _currentDefaultFgColor = RGB(0x00, 0x00, 0x00);
generic_string _initialCloudChoice;
std::wstring _initialCloudChoice;
generic_string _wingupFullPath;
generic_string _wingupParams;
generic_string _wingupDir;
std::wstring _wingupFullPath;
std::wstring _wingupParams;
std::wstring _wingupDir;
bool _isElevationRequired = false;
bool _isAdminMode = false;
@ -1952,13 +1935,13 @@ private:
bool _isEndSessionCritical = false;
public:
generic_string getWingupFullPath() const { return _wingupFullPath; };
generic_string getWingupParams() const { return _wingupParams; };
generic_string getWingupDir() const { return _wingupDir; };
std::wstring getWingupFullPath() const { return _wingupFullPath; };
std::wstring getWingupParams() const { return _wingupParams; };
std::wstring getWingupDir() const { return _wingupDir; };
bool shouldDoUAC() const { return _isElevationRequired; };
void setWingupFullPath(const generic_string& val2set) { _wingupFullPath = val2set; };
void setWingupParams(const generic_string& val2set) { _wingupParams = val2set; };
void setWingupDir(const generic_string& val2set) { _wingupDir = val2set; };
void setWingupFullPath(const std::wstring& val2set) { _wingupFullPath = val2set; };
void setWingupParams(const std::wstring& val2set) { _wingupParams = val2set; };
void setWingupDir(const std::wstring& val2set) { _wingupDir = val2set; };
void setElevationRequired(bool val2set) { _isElevationRequired = val2set; };
bool doNppLogNetworkDriveIssue() { return _doNppLogNetworkDriveIssue; };
@ -2019,8 +2002,8 @@ private:
void writePrintSetting(TiXmlElement *element);
void initMenuKeys(); //initialise menu keys and scintilla keys. Other keys are initialized on their own
void initScintillaKeys(); //these functions have to be called first before any modifications are loaded
int getCmdIdFromMenuEntryItemName(HMENU mainMenuHadle, const generic_string& menuEntryName, const generic_string& menuItemName); // return -1 if not found
int getPluginCmdIdFromMenuEntryItemName(HMENU pluginsMenu, const generic_string& pluginName, const generic_string& pluginCmdName); // return -1 if not found
int getCmdIdFromMenuEntryItemName(HMENU mainMenuHadle, const std::wstring& menuEntryName, const std::wstring& menuItemName); // return -1 if not found
int getPluginCmdIdFromMenuEntryItemName(HMENU pluginsMenu, const std::wstring& pluginName, const std::wstring& pluginCmdName); // return -1 if not found
winVer getWindowsVersion();
};