Use std::wstring instead of generic_string

pull/15405/head
Don Ho 2024-07-19 04:35:14 +02:00
parent d13c9bb943
commit 4cde33048f
38 changed files with 118 additions and 108 deletions

View File

@ -46,7 +46,7 @@ void printStr(const wchar_t *str2print)
wstring commafyInt(size_t n) wstring commafyInt(size_t n)
{ {
generic_stringstream ss; std::basic_stringstream<wchar_t> ss;
ss.imbue(std::locale("")); ss.imbue(std::locale(""));
ss << n; ss << n;
return ss.str(); return ss.str();

View File

@ -49,8 +49,6 @@ const bool dirDown = false;
#define NPP_INTERNAL_FUCTION_STR L"Notepad++::InternalFunction" #define NPP_INTERNAL_FUCTION_STR L"Notepad++::InternalFunction"
typedef std::basic_string<wchar_t> generic_string;
typedef std::basic_stringstream<wchar_t> generic_stringstream;
std::wstring folderBrowser(HWND parent, const std::wstring & title = L"", int outputCtrlID = 0, const wchar_t *defaultStr = NULL); std::wstring folderBrowser(HWND parent, const std::wstring & title = L"", int outputCtrlID = 0, const wchar_t *defaultStr = NULL);
std::wstring getFolderName(HWND parent, const wchar_t *defaultDir = NULL); std::wstring getFolderName(HWND parent, const wchar_t *defaultDir = NULL);

View File

@ -16,7 +16,7 @@
#pragma once #pragma once
typedef std::vector<generic_string> stringVector; typedef std::vector<std::wstring> stringVector;
class FileNameStringSplitter class FileNameStringSplitter
{ {
@ -44,7 +44,7 @@ public:
{ {
str[i] = '\0'; str[i] = '\0';
if (str[0]) if (str[0])
_fileNames.push_back(generic_string(str)); _fileNames.push_back(std::wstring(str));
i = 0; i = 0;
} }
isInsideQuotes = !isInsideQuotes; isInsideQuotes = !isInsideQuotes;
@ -63,7 +63,7 @@ public:
{ {
str[i] = '\0'; str[i] = '\0';
if (str[0]) if (str[0])
_fileNames.push_back(generic_string(str)); _fileNames.push_back(std::wstring(str));
i = 0; i = 0;
} }
pStr++; pStr++;
@ -74,7 +74,7 @@ public:
{ {
str[i] = *pStr; str[i] = *pStr;
if (str[0]) if (str[0])
_fileNames.push_back(generic_string(str)); _fileNames.push_back(std::wstring(str));
fini = true; fini = true;
break; break;
} }

View File

@ -2971,7 +2971,7 @@ bool FindReplaceDlg::processReplace(const wchar_t *txt2find, const wchar_t *txt2
} }
else if (status == FSTopReached) else if (status == FSTopReached)
{ {
generic_string msg = pNativeSpeaker->getLocalizedStrFromID("find-status-replace-top-reached", L"Replace: Replaced the last occurrence from the bottom. The begin of document has been reached."); wstring msg = pNativeSpeaker->getLocalizedStrFromID("find-status-replace-top-reached", L"Replace: Replaced the last occurrence from the bottom. The begin of document has been reached.");
setStatusbarMessage(msg, FSTopReached); setStatusbarMessage(msg, FSTopReached);
} }
else else

View File

@ -397,7 +397,7 @@ void FunctionCallTip::showCalltip()
} }
} }
generic_stringstream callTipText; std::basic_stringstream<wchar_t> callTipText;
if (_currentNbOverloads > 1) if (_currentNbOverloads > 1)
{ {

View File

@ -53,7 +53,7 @@ private:
wchar_t _stop = ')'; wchar_t _stop = ')';
wchar_t _param = ','; wchar_t _param = ',';
wchar_t _terminal = ';'; wchar_t _terminal = ';';
generic_string _additionalWordChar = L""; std::wstring _additionalWordChar = L"";
bool _ignoreCase = true; bool _ignoreCase = true;
bool _selfActivated = false; bool _selfActivated = false;

View File

@ -26,7 +26,7 @@ SmartHighlighter::SmartHighlighter(FindReplaceDlg * pFRDlg)
//Nothing to do //Nothing to do
} }
void SmartHighlighter::highlightViewWithWord(ScintillaEditView * pHighlightView, const generic_string & word2Hilite) void SmartHighlighter::highlightViewWithWord(ScintillaEditView * pHighlightView, const std::wstring & word2Hilite)
{ {
// save target locations for other search functions // save target locations for other search functions
auto originalStartPos = pHighlightView->execute(SCI_GETTARGETSTART); auto originalStartPos = pHighlightView->execute(SCI_GETTARGETSTART);

View File

@ -25,7 +25,7 @@ class SmartHighlighter {
public: public:
explicit SmartHighlighter(FindReplaceDlg * pFRDlg); explicit SmartHighlighter(FindReplaceDlg * pFRDlg);
void highlightView(ScintillaEditView * pHighlightView, ScintillaEditView * unfocusView); void highlightView(ScintillaEditView * pHighlightView, ScintillaEditView * unfocusView);
void highlightViewWithWord(ScintillaEditView * pHighlightView, const generic_string & word2Hilite); void highlightViewWithWord(ScintillaEditView * pHighlightView, const std::wstring & word2Hilite);
private: private:
FindReplaceDlg * _pFRDlg = nullptr; FindReplaceDlg * _pFRDlg = nullptr;

View File

@ -20,6 +20,7 @@
#include "columnEditor.h" #include "columnEditor.h"
#include "ScintillaEditView.h" #include "ScintillaEditView.h"
using namespace std;
void ColumnEditorDlg::init(HINSTANCE hInst, HWND hPere, ScintillaEditView **ppEditView) void ColumnEditorDlg::init(HINSTANCE hInst, HWND hPere, ScintillaEditView **ppEditView)
{ {
@ -215,11 +216,11 @@ intptr_t CALLBACK ColumnEditorDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
line = new wchar_t[lineLen]; line = new wchar_t[lineLen];
} }
(*_ppEditView)->getGenericText(line, lineLen, lineBegin, lineEnd); (*_ppEditView)->getGenericText(line, lineLen, lineBegin, lineEnd);
generic_string s2r(line); wstring s2r(line);
if (lineEndCol < cursorCol) if (lineEndCol < cursorCol)
{ {
generic_string s_space(cursorCol - lineEndCol, ' '); wstring s_space(cursorCol - lineEndCol, ' ');
s2r.append(s_space); s2r.append(s_space);
s2r.append(str); s2r.append(str);
} }
@ -323,16 +324,16 @@ intptr_t CALLBACK ColumnEditorDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
} }
(*_ppEditView)->getGenericText(line, lineLen, lineBegin, lineEnd); (*_ppEditView)->getGenericText(line, lineLen, lineBegin, lineEnd);
generic_string s2r(line); wstring s2r(line);
// //
// Calcule generic_string // Calcule wstring
// //
variedFormatNumber2String<wchar_t>(str, stringSize, numbers.at(i - cursorLine), base, nb, getLeading()); variedFormatNumber2String<wchar_t>(str, stringSize, numbers.at(i - cursorLine), base, nb, getLeading());
if (lineEndCol < cursorCol) if (lineEndCol < cursorCol)
{ {
generic_string s_space(cursorCol - lineEndCol, ' '); wstring s_space(cursorCol - lineEndCol, ' ');
s2r.append(s_space); s2r.append(s_space);
s2r.append(str); s2r.append(str);
} }

View File

@ -29,7 +29,7 @@ private:
HCURSOR& loadHandCursor(); HCURSOR& loadHandCursor();
void action(); void action();
protected : protected :
generic_string _URL; std::wstring _URL;
HFONT _hfUnderlined = nullptr; HFONT _hfUnderlined = nullptr;
HCURSOR _hCursor = nullptr; HCURSOR _hCursor = nullptr;

View File

@ -79,7 +79,7 @@ void ListView::destroy()
_hSelf = NULL; _hSelf = NULL;
} }
void ListView::addLine(const vector<generic_string> & values2Add, LPARAM lParam, int pos2insert) void ListView::addLine(const vector<wstring> & values2Add, LPARAM lParam, int pos2insert)
{ {
if (!values2Add.size()) if (!values2Add.size())
return; return;
@ -106,7 +106,7 @@ void ListView::addLine(const vector<generic_string> & values2Add, LPARAM lParam,
} }
} }
size_t ListView::findAlphabeticalOrderPos(const generic_string& string2Cmp, SortDirection sortDir) size_t ListView::findAlphabeticalOrderPos(const wstring& string2Cmp, SortDirection sortDir)
{ {
size_t nbItem = ListView_GetItemCount(_hSelf); size_t nbItem = ListView_GetItemCount(_hSelf);
if (!nbItem) if (!nbItem)

View File

@ -24,9 +24,9 @@
struct columnInfo { struct columnInfo {
size_t _width; size_t _width;
generic_string _label; std::wstring _label;
columnInfo(const generic_string & label, size_t width) : _width(width), _label(label) {}; columnInfo(const std::wstring & label, size_t width) : _width(width), _label(label) {};
}; };
class ListView : public Window class ListView : public Window
@ -44,7 +44,7 @@ public:
_columnInfos.push_back(column2Add); _columnInfos.push_back(column2Add);
}; };
void setColumnText(size_t i, generic_string txt2Set) { void setColumnText(size_t i, std::wstring txt2Set) {
LVCOLUMN lvColumn{}; LVCOLUMN lvColumn{};
lvColumn.mask = LVCF_TEXT; lvColumn.mask = LVCF_TEXT;
lvColumn.pszText = const_cast<wchar_t *>(txt2Set.c_str()); lvColumn.pszText = const_cast<wchar_t *>(txt2Set.c_str());
@ -56,9 +56,9 @@ public:
_extraStyle = extraStyle; _extraStyle = extraStyle;
}; };
size_t findAlphabeticalOrderPos(const generic_string& string2search, SortDirection sortDir); size_t findAlphabeticalOrderPos(const std::wstring& string2search, SortDirection sortDir);
void addLine(const std::vector<generic_string> & values2Add, LPARAM lParam = 0, int pos2insert = -1); void addLine(const std::vector<std::wstring> & values2Add, LPARAM lParam = 0, int pos2insert = -1);
size_t nbItem() const { size_t nbItem() const {
return ListView_GetItemCount(_hSelf); return ListView_GetItemCount(_hSelf);

View File

@ -18,6 +18,8 @@
#include "asciiListView.h" #include "asciiListView.h"
#include "Parameters.h" #include "Parameters.h"
using namespace std;
void AsciiListView::resetValues(int codepage) void AsciiListView::resetValues(int codepage)
{ {
if (codepage == -1) if (codepage == -1)
@ -30,7 +32,7 @@ void AsciiListView::resetValues(int codepage)
setValues(codepage); setValues(codepage);
} }
generic_string AsciiListView::getAscii(unsigned char value) wstring AsciiListView::getAscii(unsigned char value)
{ {
switch (value) switch (value)
{ {
@ -115,7 +117,7 @@ generic_string AsciiListView::getAscii(unsigned char value)
} }
} }
generic_string AsciiListView::getHtmlName(unsigned char value) wstring AsciiListView::getHtmlName(unsigned char value)
{ {
switch (value) switch (value)
{ {
@ -515,10 +517,10 @@ void AsciiListView::setValues(int codepage)
wchar_t hex[bufSize]{}; wchar_t hex[bufSize]{};
wchar_t htmlNumber[bufSize]{}; wchar_t htmlNumber[bufSize]{};
wchar_t htmlHexNumber[bufSizeHex]{}; wchar_t htmlHexNumber[bufSizeHex]{};
generic_string htmlName; wstring htmlName;
swprintf(dec, bufSize, L"%d", i); swprintf(dec, bufSize, L"%d", i);
swprintf(hex, bufSize, L"%02X", i); swprintf(hex, bufSize, L"%02X", i);
generic_string s = getAscii(static_cast<unsigned char>(i)); wstring s = getAscii(static_cast<unsigned char>(i));
if (codepage == 0 || codepage == 1252) if (codepage == 0 || codepage == 1252)
{ {
@ -551,7 +553,7 @@ void AsciiListView::setValues(int codepage)
htmlName = L""; htmlName = L"";
} }
std::vector<generic_string> values2Add; std::vector<wstring> values2Add;
values2Add.push_back(dec); values2Add.push_back(dec);
values2Add.push_back(hex); values2Add.push_back(hex);

View File

@ -24,8 +24,8 @@ public:
void setValues(int codepage = 0); void setValues(int codepage = 0);
void resetValues(int codepage); void resetValues(int codepage);
generic_string getAscii(unsigned char value); std::wstring getAscii(unsigned char value);
generic_string getHtmlName(unsigned char value); std::wstring getHtmlName(unsigned char value);
int getHtmlNumber(unsigned char value); int getHtmlNumber(unsigned char value);
private: private:
int _codepage = -1; int _codepage = -1;

View File

@ -103,7 +103,7 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM
ThemeSwitcher & themeSwitcher = nppParamInst.getThemeSwitcher(); ThemeSwitcher & themeSwitcher = nppParamInst.getThemeSwitcher();
for (size_t i = 0 ; i < themeSwitcher.size() ; ++i) for (size_t i = 0 ; i < themeSwitcher.size() ; ++i)
{ {
pair<generic_string, generic_string> & themeInfo = themeSwitcher.getElementFromIndex(i); pair<wstring, wstring> & themeInfo = themeSwitcher.getElementFromIndex(i);
int j = static_cast<int32_t>(::SendMessage(_hSwitch2ThemeCombo, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(themeInfo.first.c_str()))); int j = static_cast<int32_t>(::SendMessage(_hSwitch2ThemeCombo, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(themeInfo.first.c_str())));
if (! themeInfo.second.compare( nppParamInst.getNppGUI()._themeName ) ) if (! themeInfo.second.compare( nppParamInst.getNppGUI()._themeName ) )
{ {
@ -124,7 +124,7 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM
for (size_t i = 0 ; i < sizeof(fontSizeStrs)/(3*sizeof(wchar_t)) ; ++i) for (size_t i = 0 ; i < sizeof(fontSizeStrs)/(3*sizeof(wchar_t)) ; ++i)
::SendMessage(_hFontSizeCombo, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(fontSizeStrs[i])); ::SendMessage(_hFontSizeCombo, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(fontSizeStrs[i]));
const std::vector<generic_string> & fontlist = (NppParameters::getInstance()).getFontList(); const std::vector<wstring> & fontlist = (NppParameters::getInstance()).getFontList();
for (size_t i = 0, len = fontlist.size() ; i < len ; ++i) for (size_t i = 0, len = fontlist.size() ; i < len ; ++i)
{ {
auto j = ::SendMessage(_hFontNameCombo, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(fontlist[i].c_str())); auto j = ::SendMessage(_hFontNameCombo, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(fontlist[i].c_str()));
@ -339,7 +339,7 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM
NppParameters& nppParamInst = NppParameters::getInstance(); NppParameters& nppParamInst = NppParameters::getInstance();
if (_restoreInvalid) if (_restoreInvalid)
{ {
generic_string str(nppParamInst.getNppGUI()._themeName); wstring str(nppParamInst.getNppGUI()._themeName);
nppParamInst.reloadStylers(str.c_str()); nppParamInst.reloadStylers(str.c_str());
loadLangListFromNppParam(); loadLangListFromNppParam();
} }
@ -611,7 +611,7 @@ void WordStyleDlg::loadLangListFromNppParam()
setStyleListFromLexer(index2Begin); setStyleListFromLexer(index2Begin);
} }
void WordStyleDlg::updateThemeName(const generic_string& themeName) void WordStyleDlg::updateThemeName(const wstring& themeName)
{ {
NppParameters& nppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
NppGUI & nppGUI = (NppGUI & )nppParam.getNppGUI(); NppGUI & nppGUI = (NppGUI & )nppParam.getNppGUI();
@ -782,12 +782,12 @@ void WordStyleDlg::switchToTheme()
{ {
auto iSel = ::SendMessage(_hSwitch2ThemeCombo, CB_GETCURSEL, 0, 0); auto iSel = ::SendMessage(_hSwitch2ThemeCombo, CB_GETCURSEL, 0, 0);
generic_string prevThemeName(_themeName); wstring prevThemeName(_themeName);
_themeName.clear(); _themeName.clear();
NppParameters& nppParamInst = NppParameters::getInstance(); NppParameters& nppParamInst = NppParameters::getInstance();
ThemeSwitcher & themeSwitcher = nppParamInst.getThemeSwitcher(); ThemeSwitcher & themeSwitcher = nppParamInst.getThemeSwitcher();
pair<generic_string, generic_string> & themeInfo = themeSwitcher.getElementFromIndex(iSel); pair<wstring, wstring> & themeInfo = themeSwitcher.getElementFromIndex(iSel);
_themeName = themeInfo.second; _themeName = themeInfo.second;
if (_isThemeDirty) if (_isThemeDirty)
@ -841,7 +841,7 @@ bool WordStyleDlg::goToSection(const wchar_t* sectionNames)
if (!sectionNames || !sectionNames[0]) if (!sectionNames || !sectionNames[0])
return false; return false;
std::vector<generic_string> sections = tokenizeString(sectionNames, ':'); std::vector<wstring> sections = tokenizeString(sectionNames, ':');
if (sections.size() == 0 || sections.size() >= 3) if (sections.size() == 0 || sections.size() >= 3)
return false; return false;
@ -1163,7 +1163,7 @@ void WordStyleDlg::setVisualFromStyleList()
LangType lType = nppParams.getLangIDFromStr(lexerStyler.getLexerName()); LangType lType = nppParams.getLangIDFromStr(lexerStyler.getLexerName());
if (lType == L_TEXT) if (lType == L_TEXT)
{ {
generic_string lexerNameStr = lexerStyler.getLexerName(); wstring lexerNameStr = lexerStyler.getLexerName();
lexerNameStr += L" is not defined in NppParameters::getLangIDFromStr()"; lexerNameStr += L" is not defined in NppParameters::getLangIDFromStr()";
printStr(lexerNameStr.c_str()); printStr(lexerNameStr.c_str());
} }
@ -1280,7 +1280,7 @@ void WordStyleDlg::addLastThemeEntry()
{ {
NppParameters& nppParamInst = NppParameters::getInstance(); NppParameters& nppParamInst = NppParameters::getInstance();
ThemeSwitcher& themeSwitcher = nppParamInst.getThemeSwitcher(); ThemeSwitcher& themeSwitcher = nppParamInst.getThemeSwitcher();
std::pair<generic_string, generic_string>& themeInfo = themeSwitcher.getElementFromIndex(themeSwitcher.size() - 1); std::pair<wstring, wstring>& themeInfo = themeSwitcher.getElementFromIndex(themeSwitcher.size() - 1);
::SendMessage(_hSwitch2ThemeCombo, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(themeInfo.first.c_str())); ::SendMessage(_hSwitch2ThemeCombo, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(themeInfo.first.c_str()));
} }

View File

@ -97,7 +97,7 @@ private :
LexerStylerArray _lsArray; LexerStylerArray _lsArray;
StyleArray _globalStyles; StyleArray _globalStyles;
generic_string _themeName; std::wstring _themeName;
LexerStylerArray _styles2restored; LexerStylerArray _styles2restored;
StyleArray _gstyles2restored; StyleArray _gstyles2restored;
@ -128,7 +128,7 @@ private :
void updateFontSize(); void updateFontSize();
void updateUserKeywords(); void updateUserKeywords();
void switchToTheme(); void switchToTheme();
void updateThemeName(const generic_string& themeName); void updateThemeName(const std::wstring& themeName);
void loadLangListFromNppParam(); void loadLangListFromNppParam();
void enableFontStyle(bool isEnable); void enableFontStyle(bool isEnable);
long notifyDataModified(); long notifyDataModified();

View File

@ -425,7 +425,7 @@ LRESULT DockingCont::runProcCaption(HWND hwnd, UINT Message, WPARAM wParam, LPAR
else else
{ {
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
generic_string tip = pNativeSpeaker->getLocalizedStrFromID("close-panel-tip", L"Close"); wstring tip = pNativeSpeaker->getLocalizedStrFromID("close-panel-tip", L"Close");
toolTip.Show(rc, tip.c_str(), pt.x, pt.y + 20); toolTip.Show(rc, tip.c_str(), pt.x, pt.y + 20);
} }
return 0; return 0;
@ -1722,7 +1722,7 @@ void DockingCont::selectTab(int iTab)
for (int iItem = 0; iItem < iItemCnt; ++iItem) for (int iItem = 0; iItem < iItemCnt; ++iItem)
{ {
generic_string szText; wstring szText;
if (iItem == iTab && pszMaxTxt) if (iItem == iTab && pszMaxTxt)
{ {
// fake here an icon before text ... // fake here an icon before text ...

View File

@ -186,7 +186,7 @@ private:
// caption params // caption params
BOOL _isTopCaption = CAPTION_TOP; BOOL _isTopCaption = CAPTION_TOP;
generic_string _pszCaption; std::wstring _pszCaption;
BOOL _isMouseDown = FALSE; BOOL _isMouseDown = FALSE;
BOOL _isMouseClose = FALSE; BOOL _isMouseClose = FALSE;

View File

@ -86,8 +86,8 @@ protected :
int _dlgID = -1; int _dlgID = -1;
bool _isFloating = true; bool _isFloating = true;
int _iDockedPos = 0; int _iDockedPos = 0;
generic_string _moduleName; std::wstring _moduleName;
generic_string _pluginName; std::wstring _pluginName;
bool _isClosed = false; bool _isClosed = false;
intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) override { intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) override {

View File

@ -150,5 +150,5 @@ private:
// for needToRecomputeWith function // for needToRecomputeWith function
intptr_t _displayZoom = -1; intptr_t _displayZoom = -1;
intptr_t _displayWidth = 0; intptr_t _displayWidth = 0;
generic_string id4dockingCont = DM_NOFOCUSWHILECLICKINGCAPTION; std::wstring id4dockingCont = DM_NOFOCUSWHILECLICKINGCAPTION;
}; };

View File

@ -1532,7 +1532,7 @@ LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{ {
holdfont = (HFONT)SelectObject(hdc, BGHS[SelfIndex].hfont); holdfont = (HFONT)SelectObject(hdc, BGHS[SelfIndex].hfont);
} }
//if there are \n codes in the generic_string, find the longest line //if there are \n codes in the string, find the longest line
int longestline = FindLongestLine(hdc, (wchar_t*)lParam, &size); int longestline = FindLongestLine(hdc, (wchar_t*)lParam, &size);
int required_width = longestline + 15; int required_width = longestline + 15;
required_height = size.cy; required_height = size.cy;

View File

@ -244,9 +244,9 @@ LRESULT SplitterContainer::runProc(UINT message, WPARAM wParam, LPARAM lParam)
_hPopupMenu = ::CreatePopupMenu(); _hPopupMenu = ::CreatePopupMenu();
NativeLangSpeaker* nativeLangSpeaker = NppParameters::getInstance().getNativeLangSpeaker(); NativeLangSpeaker* nativeLangSpeaker = NppParameters::getInstance().getNativeLangSpeaker();
const generic_string textLeft = const std::wstring textLeft =
nativeLangSpeaker->getLocalizedStrFromID("splitter-rotate-left", L"Rotate to left"); nativeLangSpeaker->getLocalizedStrFromID("splitter-rotate-left", L"Rotate to left");
const generic_string textRight = const std::wstring textRight =
nativeLangSpeaker->getLocalizedStrFromID("splitter-rotate-right", L"Rotate to right"); nativeLangSpeaker->getLocalizedStrFromID("splitter-rotate-right", L"Rotate to right");
::InsertMenu(_hPopupMenu, 1, MF_BYPOSITION, ROTATION_LEFT, textLeft.c_str()); ::InsertMenu(_hPopupMenu, 1, MF_BYPOSITION, ROTATION_LEFT, textLeft.c_str());

View File

@ -23,6 +23,7 @@
#include "Notepad_plus.h" #include "Notepad_plus.h"
#include <strsafe.h> #include <strsafe.h>
using namespace std;
void Command::extractArgs(wchar_t* cmd2Exec, size_t cmd2ExecLen, wchar_t* args, size_t argsLen, const wchar_t* cmdEntier) void Command::extractArgs(wchar_t* cmd2Exec, size_t cmd2ExecLen, wchar_t* args, size_t argsLen, const wchar_t* cmdEntier)
{ {
@ -224,7 +225,7 @@ HINSTANCE Command::run(HWND hWnd, const wchar_t* cwd)
int retResult = static_cast<int>(reinterpret_cast<intptr_t>(res)); int retResult = static_cast<int>(reinterpret_cast<intptr_t>(res));
if (retResult <= 32) if (retResult <= 32)
{ {
generic_string errorMsg; wstring errorMsg;
errorMsg += GetLastErrorAsString(retResult); errorMsg += GetLastErrorAsString(retResult);
errorMsg += L"An attempt was made to execute the below command."; errorMsg += L"An attempt was made to execute the below command.";
errorMsg += L"\n----------------------------------------------------------"; errorMsg += L"\n----------------------------------------------------------";
@ -381,7 +382,7 @@ intptr_t CALLBACK RunDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam
// Insert the separator and modify/delete command // Insert the separator and modify/delete command
::InsertMenu(hRunMenu, posBase + nbTopLevelItem + 1, MF_BYPOSITION, static_cast<unsigned int>(-1), 0); ::InsertMenu(hRunMenu, posBase + nbTopLevelItem + 1, MF_BYPOSITION, static_cast<unsigned int>(-1), 0);
NativeLangSpeaker *pNativeLangSpeaker = nppParams.getNativeLangSpeaker(); NativeLangSpeaker *pNativeLangSpeaker = nppParams.getNativeLangSpeaker();
generic_string nativeLangShortcutMapperMacro = pNativeLangSpeaker->getNativeLangMenuString(IDM_SETTING_SHORTCUT_MAPPER_MACRO); wstring nativeLangShortcutMapperMacro = pNativeLangSpeaker->getNativeLangMenuString(IDM_SETTING_SHORTCUT_MAPPER_MACRO);
if (nativeLangShortcutMapperMacro == L"") if (nativeLangShortcutMapperMacro == L"")
nativeLangShortcutMapperMacro = runMenu.getLastCmdLabel(); nativeLangShortcutMapperMacro = runMenu.getLastCmdLabel();
@ -399,12 +400,12 @@ intptr_t CALLBACK RunDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam
fd.setExtFilter(L"Executable File", { L".exe", L".com", L".cmd", L".bat" }); fd.setExtFilter(L"Executable File", { L".exe", L".com", L".cmd", L".bat" });
fd.setExtFilter(L"All Files", L".*"); fd.setExtFilter(L"All Files", L".*");
generic_string fn = fd.doOpenSingleFileDlg(); wstring fn = fd.doOpenSingleFileDlg();
if (!fn.empty()) if (!fn.empty())
{ {
if (fn.find(' ') != generic_string::npos) if (fn.find(' ') != wstring::npos)
{ {
generic_string fn_quotes(fn); wstring fn_quotes(fn);
fn_quotes = L"\"" + fn_quotes + L"\""; fn_quotes = L"\"" + fn_quotes + L"\"";
addTextToCombo(fn_quotes.c_str()); addTextToCombo(fn_quotes.c_str());
} }

View File

@ -40,12 +40,12 @@ class Command {
public : public :
Command() = default; Command() = default;
explicit Command(const wchar_t *cmd) : _cmdLine(cmd){}; explicit Command(const wchar_t *cmd) : _cmdLine(cmd){};
explicit Command(const generic_string& cmd) : _cmdLine(cmd){}; explicit Command(const std::wstring& cmd) : _cmdLine(cmd){};
HINSTANCE run(HWND hWnd); HINSTANCE run(HWND hWnd);
HINSTANCE run(HWND hWnd, const wchar_t* cwd); HINSTANCE run(HWND hWnd, const wchar_t* cwd);
protected : protected :
generic_string _cmdLine; std::wstring _cmdLine;
private : private :
void extractArgs(wchar_t *cmd2Exec, size_t cmd2ExecLen, wchar_t *args, size_t argsLen, const wchar_t *cmdEntier); void extractArgs(wchar_t *cmd2Exec, size_t cmd2ExecLen, wchar_t *args, size_t argsLen, const wchar_t *cmdEntier);
}; };

View File

@ -51,6 +51,6 @@ private:
private: private:
std::vector<int> _partWidthArray; std::vector<int> _partWidthArray;
int *_lpParts = nullptr; int *_lpParts = nullptr;
generic_string _lastSetText; std::wstring _lastSetText;
StatusBarSubclassInfo* _pStatusBarInfo = nullptr; StatusBarSubclassInfo* _pStatusBarInfo = nullptr;
}; };

View File

@ -24,8 +24,8 @@
struct DlgInfo struct DlgInfo
{ {
Window *_dlg; Window *_dlg;
generic_string _name; std::wstring _name;
generic_string _internalName; std::wstring _internalName;
DlgInfo(Window *dlg, const wchar_t *name, const wchar_t *internalName = L""): _dlg(dlg), _name(name), _internalName(internalName) {}; DlgInfo(Window *dlg, const wchar_t *name, const wchar_t *internalName = L""): _dlg(dlg), _name(name), _internalName(internalName) {};
}; };

View File

@ -29,12 +29,12 @@
struct TaskLstFnStatus { struct TaskLstFnStatus {
int _iView = -1; int _iView = -1;
int _docIndex = 0; int _docIndex = 0;
generic_string _fn; std::wstring _fn;
int _status = 0; int _status = 0;
void *_bufID = nullptr; void *_bufID = nullptr;
int _docColor = -1; int _docColor = -1;
TaskLstFnStatus(const generic_string& str, int status) : _fn(str), _status(status){}; TaskLstFnStatus(const std::wstring& str, int status) : _fn(str), _status(status){};
TaskLstFnStatus(int iView, int docIndex, generic_string str, int status, void *bufID, int docColor) : TaskLstFnStatus(int iView, int docIndex, std::wstring str, int status, void *bufID, int docColor) :
_iView(iView), _docIndex(docIndex), _fn(str), _status(status), _bufID(bufID), _docColor(docColor) {}; _iView(iView), _docIndex(docIndex), _fn(str), _status(status), _bufID(bufID), _docColor(docColor) {};
}; };

View File

@ -22,11 +22,13 @@
#include "FindReplaceDlg_rc.h" #include "FindReplaceDlg_rc.h"
#include "NppDarkMode.h" #include "NppDarkMode.h"
using namespace std;
constexpr DWORD WS_TOOLBARSTYLE = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | TBSTYLE_TOOLTIPS | TBSTYLE_FLAT | CCS_TOP | CCS_NOPARENTALIGN | CCS_NORESIZE | CCS_NODIVIDER; constexpr DWORD WS_TOOLBARSTYLE = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | TBSTYLE_TOOLTIPS | TBSTYLE_FLAT | CCS_TOP | CCS_NOPARENTALIGN | CCS_NORESIZE | CCS_NODIVIDER;
struct ToolbarIconIdUnit struct ToolbarIconIdUnit
{ {
generic_string _id; wstring _id;
bool hasDisabledIcon = false; bool hasDisabledIcon = false;
}; };
@ -73,21 +75,21 @@ void ToolBar::initTheme(TiXmlDocument *toolIconsDocRoot)
_toolIcons = _toolIcons->FirstChild(L"ToolBarIcons"); _toolIcons = _toolIcons->FirstChild(L"ToolBarIcons");
if (_toolIcons) if (_toolIcons)
{ {
generic_string iconFolderDir = NppParameters::getInstance().getUserPath(); wstring iconFolderDir = NppParameters::getInstance().getUserPath();
generic_string toolbarIconsRootFolderName = L"toolbarIcons"; wstring toolbarIconsRootFolderName = L"toolbarIcons";
pathAppend(iconFolderDir, toolbarIconsRootFolderName); pathAppend(iconFolderDir, toolbarIconsRootFolderName);
generic_string folderName = (_toolIcons->ToElement())->Attribute(L"icoFolderName"); wstring folderName = (_toolIcons->ToElement())->Attribute(L"icoFolderName");
if (folderName.empty()) if (folderName.empty())
folderName = L"default"; folderName = L"default";
pathAppend(iconFolderDir, folderName); pathAppend(iconFolderDir, folderName);
size_t i = 0; size_t i = 0;
generic_string disabled_suffix = L"_disabled"; wstring disabled_suffix = L"_disabled";
generic_string ext = L".ico"; wstring ext = L".ico";
for (ToolbarIconIdUnit icoUnit : toolbarIconIDs) for (ToolbarIconIdUnit icoUnit : toolbarIconIDs)
{ {
generic_string locator = iconFolderDir; wstring locator = iconFolderDir;
locator += L"\\"; locator += L"\\";
locator += icoUnit._id; locator += icoUnit._id;
locator += ext; locator += ext;
@ -101,7 +103,7 @@ void ToolBar::initTheme(TiXmlDocument *toolIconsDocRoot)
if (icoUnit.hasDisabledIcon) if (icoUnit.hasDisabledIcon)
{ {
generic_string locator_dis = iconFolderDir; wstring locator_dis = iconFolderDir;
locator_dis += L"\\"; locator_dis += L"\\";
locator_dis += icoUnit._id; locator_dis += icoUnit._id;
locator_dis += disabled_suffix; locator_dis += disabled_suffix;
@ -497,7 +499,7 @@ void ToolBar::doPopop(POINT chevPoint)
if (start < _nbCurrentButtons) if (start < _nbCurrentButtons)
{ //some buttons are hidden { //some buttons are hidden
HMENU menu = ::CreatePopupMenu(); HMENU menu = ::CreatePopupMenu();
generic_string text; wstring text;
while (start < _nbCurrentButtons) while (start < _nbCurrentButtons)
{ {
int cmd = _pTBB[start].idCommand; int cmd = _pTBB[start].idCommand;

View File

@ -37,9 +37,9 @@ enum toolBarStatusType {TB_SMALL, TB_LARGE, TB_SMALL2, TB_LARGE2, TB_STANDARD};
struct iconLocator { struct iconLocator {
size_t _listIndex = 0; size_t _listIndex = 0;
size_t _iconIndex = 0; size_t _iconIndex = 0;
generic_string _iconLocation; std::wstring _iconLocation;
iconLocator(size_t iList, size_t iIcon, const generic_string& iconLoc) iconLocator(size_t iList, size_t iIcon, const std::wstring& iconLoc)
: _listIndex(iList), _iconIndex(iIcon), _iconLocation(iconLoc){}; : _listIndex(iList), _iconIndex(iIcon), _iconLocation(iconLoc){};
}; };

View File

@ -19,6 +19,8 @@
#include "TreeView.h" #include "TreeView.h"
#include "Parameters.h" #include "Parameters.h"
using namespace std;
#define CY_ITEMHEIGHT 18 #define CY_ITEMHEIGHT 18
void TreeView::init(HINSTANCE hInst, HWND parent, int treeViewID) void TreeView::init(HINSTANCE hInst, HWND parent, int treeViewID)
@ -135,7 +137,7 @@ LPARAM TreeView::getItemParam(HTREEITEM Item2Get) const
return tvItem.lParam; return tvItem.lParam;
} }
generic_string TreeView::getItemDisplayName(HTREEITEM Item2Set) const wstring TreeView::getItemDisplayName(HTREEITEM Item2Set) const
{ {
if (!Item2Set) if (!Item2Set)
return L""; return L"";
@ -623,7 +625,7 @@ bool TreeView::canDragOut(HTREEITEM targetItem)
bool TreeView::searchLeafAndBuildTree(const TreeView & tree2Build, const generic_string & text2Search, int index2Search) bool TreeView::searchLeafAndBuildTree(const TreeView & tree2Build, const wstring & text2Search, int index2Search)
{ {
//tree2Build.removeAllItems(); //tree2Build.removeAllItems();
//HTREEITEM root = getRoot(); //HTREEITEM root = getRoot();
@ -631,7 +633,7 @@ bool TreeView::searchLeafAndBuildTree(const TreeView & tree2Build, const generic
return searchLeafRecusivelyAndBuildTree(tree2Build.getRoot(), text2Search, index2Search, getRoot()); return searchLeafRecusivelyAndBuildTree(tree2Build.getRoot(), text2Search, index2Search, getRoot());
} }
bool TreeView::searchLeafRecusivelyAndBuildTree(HTREEITEM tree2Build, const generic_string & text2Search, int index2Search, HTREEITEM tree2Search) bool TreeView::searchLeafRecusivelyAndBuildTree(HTREEITEM tree2Build, const wstring & text2Search, int index2Search, HTREEITEM tree2Search)
{ {
if (!tree2Search) if (!tree2Search)
return false; return false;
@ -646,11 +648,11 @@ bool TreeView::searchLeafRecusivelyAndBuildTree(HTREEITEM tree2Build, const gene
if (tvItem.iImage == index2Search) if (tvItem.iImage == index2Search)
{ {
generic_string itemNameUpperCase = stringToUpper(tvItem.pszText); wstring itemNameUpperCase = stringToUpper(tvItem.pszText);
generic_string text2SearchUpperCase = stringToUpper(text2Search); wstring text2SearchUpperCase = stringToUpper(text2Search);
size_t res = itemNameUpperCase.find(text2SearchUpperCase); size_t res = itemNameUpperCase.find(text2SearchUpperCase);
if (res != generic_string::npos) if (res != wstring::npos)
{ {
TVINSERTSTRUCT tvInsertStruct{}; TVINSERTSTRUCT tvInsertStruct{};
tvInsertStruct.item = tvItem; tvInsertStruct.item = tvItem;
@ -690,7 +692,7 @@ bool TreeView::retrieveFoldingStateTo(TreeStateNode & treeState2Construct, HTREE
if (tvItem.lParam) if (tvItem.lParam)
{ {
treeState2Construct._extraData = *((generic_string *)tvItem.lParam); treeState2Construct._extraData = *((wstring *)tvItem.lParam);
} }
int i = 0; int i = 0;

View File

@ -25,8 +25,8 @@
#define CY_BITMAP 16 #define CY_BITMAP 16
struct TreeStateNode { struct TreeStateNode {
generic_string _label; std::wstring _label;
generic_string _extraData; std::wstring _extraData;
bool _isExpanded = false; bool _isExpanded = false;
bool _isSelected = false; bool _isSelected = false;
std::vector<TreeStateNode> _children; std::vector<TreeStateNode> _children;
@ -43,7 +43,7 @@ public:
HTREEITEM addItem(const wchar_t *itemName, HTREEITEM hParentItem, int iImage, LPARAM lParam = 0); HTREEITEM addItem(const wchar_t *itemName, HTREEITEM hParentItem, int iImage, LPARAM lParam = 0);
bool setItemParam(HTREEITEM Item2Set, LPARAM param); bool setItemParam(HTREEITEM Item2Set, LPARAM param);
LPARAM getItemParam(HTREEITEM Item2Get) const; LPARAM getItemParam(HTREEITEM Item2Get) const;
generic_string getItemDisplayName(HTREEITEM Item2Set) const; std::wstring getItemDisplayName(HTREEITEM Item2Set) const;
HTREEITEM searchSubItemByName(const wchar_t *itemName, HTREEITEM hParentItem); HTREEITEM searchSubItemByName(const wchar_t *itemName, HTREEITEM hParentItem);
void removeItem(HTREEITEM hTreeItem); void removeItem(HTREEITEM hTreeItem);
void removeAllItems(); void removeAllItems();
@ -116,7 +116,7 @@ public:
bool swapTreeViewItem(HTREEITEM itemGoDown, HTREEITEM itemGoUp); bool swapTreeViewItem(HTREEITEM itemGoDown, HTREEITEM itemGoUp);
bool restoreFoldingStateFrom(const TreeStateNode & treeState2Compare, HTREEITEM treeviewNode); bool restoreFoldingStateFrom(const TreeStateNode & treeState2Compare, HTREEITEM treeviewNode);
bool retrieveFoldingStateTo(TreeStateNode & treeState2Construct, HTREEITEM treeviewNode); bool retrieveFoldingStateTo(TreeStateNode & treeState2Construct, HTREEITEM treeviewNode);
bool searchLeafAndBuildTree(const TreeView & tree2Build, const generic_string & text2Search, int index2Search); bool searchLeafAndBuildTree(const TreeView & tree2Build, const std::wstring & text2Search, int index2Search);
void sort(HTREEITEM hTreeItem, bool isRecusive); void sort(HTREEITEM hTreeItem, bool isRecusive);
void customSorting(HTREEITEM hTreeItem, PFNTVCOMPARE sortingCallbackFunc, LPARAM lParam, bool isRecursive); void customSorting(HTREEITEM hTreeItem, PFNTVCOMPARE sortingCallbackFunc, LPARAM lParam, bool isRecursive);
BOOL setImageList(int w, int h, int nbImage, int image_id, ...); BOOL setImageList(int w, int h, int nbImage, int image_id, ...);
@ -132,7 +132,7 @@ protected:
void cleanSubEntries(HTREEITEM hTreeItem); void cleanSubEntries(HTREEITEM hTreeItem);
void dupTree(HTREEITEM hTree2Dup, HTREEITEM hParentItem); void dupTree(HTREEITEM hTree2Dup, HTREEITEM hParentItem);
bool searchLeafRecusivelyAndBuildTree(HTREEITEM tree2Build, const generic_string & text2Search, int index2Search, HTREEITEM tree2Search); bool searchLeafRecusivelyAndBuildTree(HTREEITEM tree2Build, const std::wstring & text2Search, int index2Search, HTREEITEM tree2Search);
// Drag and Drop operations // Drag and Drop operations
HTREEITEM _draggedItem = nullptr; HTREEITEM _draggedItem = nullptr;

View File

@ -22,6 +22,8 @@
#include "resource.h" #include "resource.h"
#include "localization.h" #include "localization.h"
using namespace std;
#define GET_X_LPARAM(lp) static_cast<short>(LOWORD(lp)) #define GET_X_LPARAM(lp) static_cast<short>(LOWORD(lp))
#define GET_Y_LPARAM(lp) static_cast<short>(HIWORD(lp)) #define GET_Y_LPARAM(lp) static_cast<short>(HIWORD(lp))
@ -414,7 +416,7 @@ intptr_t CALLBACK VerticalFileSwitcher::run_dlgProc(UINT message, WPARAM wParam,
int i = pGetInfoTip->iItem; int i = pGetInfoTip->iItem;
if (i == -1) if (i == -1)
return TRUE; return TRUE;
generic_string fn = getFullFilePath((size_t)i); wstring fn = getFullFilePath((size_t)i);
lstrcpyn(pGetInfoTip->pszText, fn.c_str(), pGetInfoTip->cchTextMax); lstrcpyn(pGetInfoTip->pszText, fn.c_str(), pGetInfoTip->cchTextMax);
return TRUE; return TRUE;
} }
@ -533,9 +535,9 @@ void VerticalFileSwitcher::initPopupMenus()
NativeLangSpeaker* pNativeSpeaker = NppParameters::getInstance().getNativeLangSpeaker(); NativeLangSpeaker* pNativeSpeaker = NppParameters::getInstance().getNativeLangSpeaker();
NppGUI& nppGUI = NppParameters::getInstance().getNppGUI(); NppGUI& nppGUI = NppParameters::getInstance().getNppGUI();
generic_string extStr = pNativeSpeaker->getAttrNameStr(L"Ext.", FS_ROOTNODE, FS_CLMNEXT); wstring extStr = pNativeSpeaker->getAttrNameStr(L"Ext.", FS_ROOTNODE, FS_CLMNEXT);
generic_string pathStr = pNativeSpeaker->getAttrNameStr(L"Path", FS_ROOTNODE, FS_CLMNPATH); wstring pathStr = pNativeSpeaker->getAttrNameStr(L"Path", FS_ROOTNODE, FS_CLMNPATH);
generic_string groupStr = pNativeSpeaker->getAttrNameStr(L"Group by View", FS_ROOTNODE, FS_LVGROUPS); wstring groupStr = pNativeSpeaker->getAttrNameStr(L"Group by View", FS_ROOTNODE, FS_LVGROUPS);
_hGlobalMenu = ::CreatePopupMenu(); _hGlobalMenu = ::CreatePopupMenu();
::InsertMenu(_hGlobalMenu, CLMNEXT_ID, MF_BYCOMMAND | MF_STRING, CLMNEXT_ID, extStr.c_str()); ::InsertMenu(_hGlobalMenu, CLMNEXT_ID, MF_BYCOMMAND | MF_STRING, CLMNEXT_ID, extStr.c_str());

View File

@ -71,7 +71,7 @@ public:
_fileListView.setItemColor(bufferID); _fileListView.setItemColor(bufferID);
}; };
generic_string getFullFilePath(size_t i) const { std::wstring getFullFilePath(size_t i) const {
return _fileListView.getFullFilePath(i); return _fileListView.getFullFilePath(i);
}; };

View File

@ -20,6 +20,8 @@
#include "Buffer.h" #include "Buffer.h"
#include "localization.h" #include "localization.h"
using namespace std;
void VerticalFileSwitcherListView::init(HINSTANCE hInst, HWND parent, HIMAGELIST hImaLst) void VerticalFileSwitcherListView::init(HINSTANCE hInst, HWND parent, HIMAGELIST hImaLst)
{ {
Window::init(hInst, parent); Window::init(hInst, parent);
@ -109,16 +111,16 @@ void VerticalFileSwitcherListView::initList()
nameWidth -= nppParams._dpiManager.scaleX(nppParams.getNppGUI()._fileSwitcherPathWidth); nameWidth -= nppParams._dpiManager.scaleX(nppParams.getNppGUI()._fileSwitcherPathWidth);
//add columns //add columns
generic_string nameStr = pNativeSpeaker->getAttrNameStr(L"Name", FS_ROOTNODE, FS_CLMNNAME); wstring nameStr = pNativeSpeaker->getAttrNameStr(L"Name", FS_ROOTNODE, FS_CLMNNAME);
insertColumn(nameStr.c_str(), nameWidth, ++colIndex); insertColumn(nameStr.c_str(), nameWidth, ++colIndex);
if (isExtColumn) if (isExtColumn)
{ {
generic_string extStr = pNativeSpeaker->getAttrNameStr(L"Ext.", FS_ROOTNODE, FS_CLMNEXT); wstring extStr = pNativeSpeaker->getAttrNameStr(L"Ext.", FS_ROOTNODE, FS_CLMNEXT);
insertColumn(extStr.c_str(), nppParams._dpiManager.scaleX(nppParams.getNppGUI()._fileSwitcherExtWidth), ++colIndex); //2nd column insertColumn(extStr.c_str(), nppParams._dpiManager.scaleX(nppParams.getNppGUI()._fileSwitcherExtWidth), ++colIndex); //2nd column
} }
if (isPathColumn) if (isPathColumn)
{ {
generic_string pathStr = pNativeSpeaker->getAttrNameStr(L"Path", FS_ROOTNODE, FS_CLMNPATH); wstring pathStr = pNativeSpeaker->getAttrNameStr(L"Path", FS_ROOTNODE, FS_CLMNPATH);
insertColumn(pathStr.c_str(), nppParams._dpiManager.scaleX(nppParams.getNppGUI()._fileSwitcherPathWidth), ++colIndex); //2nd column if .ext is off insertColumn(pathStr.c_str(), nppParams._dpiManager.scaleX(nppParams.getNppGUI()._fileSwitcherPathWidth), ++colIndex); //2nd column if .ext is off
} }
@ -284,7 +286,7 @@ void VerticalFileSwitcherListView::setItemColor(BufferID bufferID)
redraw(); redraw();
} }
generic_string VerticalFileSwitcherListView::getFullFilePath(size_t i) const wstring VerticalFileSwitcherListView::getFullFilePath(size_t i) const
{ {
size_t nbItem = ListView_GetItemCount(_hSelf); size_t nbItem = ListView_GetItemCount(_hSelf);
if (i > nbItem) if (i > nbItem)

View File

@ -49,7 +49,7 @@ public:
int closeItem(BufferID bufferID, int iView); int closeItem(BufferID bufferID, int iView);
void activateItem(BufferID bufferID, int iView); void activateItem(BufferID bufferID, int iView);
void setItemIconStatus(BufferID bufferID); void setItemIconStatus(BufferID bufferID);
generic_string getFullFilePath(size_t i) const; std::wstring getFullFilePath(size_t i) const;
void setItemColor(BufferID bufferID); void setItemColor(BufferID bufferID);
void insertColumn(const wchar_t *name, int width, int index); void insertColumn(const wchar_t *name, int width, int index);

View File

@ -378,7 +378,7 @@ intptr_t CALLBACK WindowsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
Buffer* buf = getBuffer(pLvdi->item.iItem); Buffer* buf = getBuffer(pLvdi->item.iItem);
if (!buf) if (!buf)
return FALSE; return FALSE;
generic_string text; wstring text;
if (pLvdi->item.iSubItem == 0) // file name if (pLvdi->item.iSubItem == 0) // file name
{ {
text = buf->getFileName(); text = buf->getFileName();
@ -598,7 +598,7 @@ BOOL WindowsDlg::onInitDialog()
lvColumn.mask = LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM | LVCF_FMT; lvColumn.mask = LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM | LVCF_FMT;
lvColumn.fmt = LVCFMT_LEFT; lvColumn.fmt = LVCFMT_LEFT;
generic_string columnText; wstring columnText;
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
columnText = L"" + pNativeSpeaker->getAttrNameStr(L"Name", WD_ROOTNODE, WD_CLMNNAME); columnText = L"" + pNativeSpeaker->getAttrNameStr(L"Name", WD_ROOTNODE, WD_CLMNNAME);
@ -644,7 +644,7 @@ void WindowsDlg::updateColumnNames()
lvColumn.mask = LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM | LVCF_FMT; lvColumn.mask = LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM | LVCF_FMT;
lvColumn.fmt = LVCFMT_LEFT; lvColumn.fmt = LVCFMT_LEFT;
generic_string columnText; wstring columnText;
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker(); NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
columnText = pNativeSpeaker->getAttrNameStr(L"Name", WD_ROOTNODE, WD_CLMNNAME); columnText = pNativeSpeaker->getAttrNameStr(L"Name", WD_ROOTNODE, WD_CLMNNAME);
@ -937,7 +937,7 @@ void WindowsDlg::doCount()
{ {
NativeLangSpeaker* pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker(); NativeLangSpeaker* pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
generic_string msg = pNativeSpeaker->getAttrNameStr(L"Windows", "Dialog", "Window", "title"); wstring msg = pNativeSpeaker->getAttrNameStr(L"Windows", "Dialog", "Window", "title");
msg += L" - "; msg += L" - ";
msg += pNativeSpeaker->getAttrNameStr(L"Total documents: ", WD_ROOTNODE, WD_NBDOCSTOTAL); msg += pNativeSpeaker->getAttrNameStr(L"Total documents: ", WD_ROOTNODE, WD_NBDOCSTOTAL);
msg += L" "; msg += L" ";
@ -1166,7 +1166,7 @@ void WindowsMenu::initPopupMenu(HMENU hMenu, DocTabView* pTab)
mii.cbSize = sizeof(mii); mii.cbSize = sizeof(mii);
mii.fMask = MIIM_STRING | MIIM_STATE | MIIM_ID; mii.fMask = MIIM_STRING | MIIM_STATE | MIIM_ID;
generic_string strBuffer(BuildMenuFileName(60, static_cast<int32_t>(pos), buf->getFileName(), !isDropListMenu)); wstring strBuffer(BuildMenuFileName(60, static_cast<int32_t>(pos), buf->getFileName(), !isDropListMenu));
std::vector<wchar_t> vBuffer(strBuffer.begin(), strBuffer.end()); std::vector<wchar_t> vBuffer(strBuffer.begin(), strBuffer.end());
vBuffer.push_back('\0'); vBuffer.push_back('\0');
mii.dwTypeData = (&vBuffer[0]); mii.dwTypeData = (&vBuffer[0]);

View File

@ -996,7 +996,7 @@ void ScintillaAccelerator::updateMenuItemByID(const ScintillaKeyMap& skm, int id
} }
++i; ++i;
} }
generic_string menuItem = cmdName; wstring menuItem = cmdName;
if (skm.isEnabled()) if (skm.isEnabled())
{ {
menuItem += L"\t"; menuItem += L"\t";
@ -1189,7 +1189,7 @@ intptr_t CALLBACK ScintillaKeyMap::run_dlgProc(UINT Message, WPARAM wParam, LPAR
::SendDlgItemMessage(_hSelf, IDC_LIST_KEYS, LB_INSERTSTRING, static_cast<WPARAM>(-1), reinterpret_cast<LPARAM>(string2wstring(toString(res), CP_UTF8).c_str())); ::SendDlgItemMessage(_hSelf, IDC_LIST_KEYS, LB_INSERTSTRING, static_cast<WPARAM>(-1), reinterpret_cast<LPARAM>(string2wstring(toString(res), CP_UTF8).c_str()));
} }
else else
{ //update current generic_string, can happen if it was disabled { //update current string, can happen if it was disabled
updateListItem(res); updateListItem(res);
} }
::SendDlgItemMessage(_hSelf, IDC_LIST_KEYS, LB_SETCURSEL, res, 0); ::SendDlgItemMessage(_hSelf, IDC_LIST_KEYS, LB_SETCURSEL, res, 0);

View File

@ -142,7 +142,7 @@ public:
}; };
virtual std::string toString() const; //the hotkey part virtual std::string toString() const; //the hotkey part
std::string toMenuItemString() const { //generic_string suitable for menu std::string toMenuItemString() const { //std::wstring suitable for menu
std::string str = _menuName; std::string str = _menuName;
if (isEnabled()) if (isEnabled())
{ {
@ -199,8 +199,8 @@ public:
private : private :
unsigned long _id = 0; unsigned long _id = 0;
generic_string _category; std::wstring _category;
generic_string _shortcutName; std::wstring _shortcutName;
int _nth = 0; // Allow several shortcuts for the same command (_id). int _nth = 0; // Allow several shortcuts for the same command (_id).
// If there is the 2nd identical command in winKeyDefs array, the value of _nth will be 1. // If there is the 2nd identical command in winKeyDefs array, the value of _nth will be 1.
// This variable member allows the application to distinguish the different shortcuts assigned to the same command. // This variable member allows the application to distinguish the different shortcuts assigned to the same command.