mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-25 23:05:13 +02:00
Code improvement for WcharMbcsConvertor
This commit is contained in:
parent
2c764d7221
commit
bbc55d06f2
@ -96,9 +96,9 @@ bool matchInList(const TCHAR *fileName, const std::vector<generic_string> & patt
|
|||||||
class WcharMbcsConvertor final
|
class WcharMbcsConvertor final
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static WcharMbcsConvertor* getInstance() {
|
static WcharMbcsConvertor& getInstance() {
|
||||||
static WcharMbcsConvertor instance;
|
static WcharMbcsConvertor instance;
|
||||||
return &instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
const wchar_t * char2wchar(const char *mbStr, UINT codepage, int lenIn=-1, int *pLenOut=NULL, int *pBytesNotProcessed=NULL);
|
const wchar_t * char2wchar(const char *mbStr, UINT codepage, int lenIn=-1, int *pLenOut=NULL, int *pBytesNotProcessed=NULL);
|
||||||
|
@ -202,12 +202,12 @@ int PluginsManager::loadPlugin(const TCHAR *pluginFilePath)
|
|||||||
|
|
||||||
ExternalLangContainer *containers[30];
|
ExternalLangContainer *containers[30];
|
||||||
|
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
for (int x = 0; x < numLexers; ++x)
|
for (int x = 0; x < numLexers; ++x)
|
||||||
{
|
{
|
||||||
GetLexerName(x, lexName, MAX_EXTERNAL_LEXER_NAME_LEN);
|
GetLexerName(x, lexName, MAX_EXTERNAL_LEXER_NAME_LEN);
|
||||||
GetLexerStatusText(x, lexDesc, MAX_EXTERNAL_LEXER_DESC_LEN);
|
GetLexerStatusText(x, lexDesc, MAX_EXTERNAL_LEXER_DESC_LEN);
|
||||||
const TCHAR *pLexerName = wmc->char2wchar(lexName, CP_ACP);
|
const TCHAR *pLexerName = wmc.char2wchar(lexName, CP_ACP);
|
||||||
if (!nppParams->isExistingExternalLangName(pLexerName) && nppParams->ExternalLangHasRoom())
|
if (!nppParams->isExistingExternalLangName(pLexerName) && nppParams->ExternalLangHasRoom())
|
||||||
containers[x] = new ExternalLangContainer(pLexerName, lexDesc);
|
containers[x] = new ExternalLangContainer(pLexerName, lexDesc);
|
||||||
else
|
else
|
||||||
@ -253,7 +253,7 @@ int PluginsManager::loadPlugin(const TCHAR *pluginFilePath)
|
|||||||
|
|
||||||
nppParams->getExternalLexerFromXmlTree(pXmlDoc);
|
nppParams->getExternalLexerFromXmlTree(pXmlDoc);
|
||||||
nppParams->getExternalLexerDoc()->push_back(pXmlDoc);
|
nppParams->getExternalLexerDoc()->push_back(pXmlDoc);
|
||||||
const char *pDllName = wmc->wchar2char(pluginFilePath, CP_ACP);
|
const char *pDllName = wmc.wchar2char(pluginFilePath, CP_ACP);
|
||||||
::SendMessage(_nppData._scintillaMainHandle, SCI_LOADLEXERLIBRARY, 0, reinterpret_cast<LPARAM>(pDllName));
|
::SendMessage(_nppData._scintillaMainHandle, SCI_LOADLEXERLIBRARY, 0, reinterpret_cast<LPARAM>(pDllName));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -64,8 +64,8 @@ INT_PTR CALLBACK HashFromFilesDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
|
|||||||
{
|
{
|
||||||
if (_ht == hashType::hash_md5)
|
if (_ht == hashType::hash_md5)
|
||||||
{
|
{
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
const char *path = wmc->wchar2char(it.c_str(), CP_ACP);
|
const char *path = wmc.wchar2char(it.c_str(), CP_ACP);
|
||||||
|
|
||||||
MD5 md5;
|
MD5 md5;
|
||||||
char *md5Result = md5.digestFile(path);
|
char *md5Result = md5.digestFile(path);
|
||||||
@ -76,7 +76,7 @@ INT_PTR CALLBACK HashFromFilesDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
|
|||||||
files2check += TEXT("\r\n");
|
files2check += TEXT("\r\n");
|
||||||
|
|
||||||
wchar_t* fileName = ::PathFindFileName(it.c_str());
|
wchar_t* fileName = ::PathFindFileName(it.c_str());
|
||||||
hashResultStr += wmc->char2wchar(md5Result, CP_ACP);
|
hashResultStr += wmc.char2wchar(md5Result, CP_ACP);
|
||||||
hashResultStr += TEXT(" ");
|
hashResultStr += TEXT(" ");
|
||||||
hashResultStr += fileName;
|
hashResultStr += fileName;
|
||||||
hashResultStr += TEXT("\r\n");
|
hashResultStr += TEXT("\r\n");
|
||||||
@ -173,8 +173,8 @@ void HashFromTextDlg::generateHash()
|
|||||||
// So we get the result of UTF8 text (tested with Chinese).
|
// So we get the result of UTF8 text (tested with Chinese).
|
||||||
wchar_t *text = new wchar_t[len + 1];
|
wchar_t *text = new wchar_t[len + 1];
|
||||||
::GetDlgItemText(_hSelf, IDC_HASH_TEXT_EDIT, text, len + 1);
|
::GetDlgItemText(_hSelf, IDC_HASH_TEXT_EDIT, text, len + 1);
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
const char *newText = wmc->wchar2char(text, SC_CP_UTF8);
|
const char *newText = wmc.wchar2char(text, SC_CP_UTF8);
|
||||||
if (_ht == hash_md5)
|
if (_ht == hash_md5)
|
||||||
{
|
{
|
||||||
MD5 md5;
|
MD5 md5;
|
||||||
@ -212,7 +212,7 @@ void HashFromTextDlg::generateHashPerLine()
|
|||||||
std::wstring aLine;
|
std::wstring aLine;
|
||||||
std::string result;
|
std::string result;
|
||||||
MD5 md5;
|
MD5 md5;
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
while (std::getline(ss, aLine))
|
while (std::getline(ss, aLine))
|
||||||
{
|
{
|
||||||
// getline() detect only '\n' but not "\r\n" under windows
|
// getline() detect only '\n' but not "\r\n" under windows
|
||||||
@ -224,7 +224,7 @@ void HashFromTextDlg::generateHashPerLine()
|
|||||||
result += "\r\n";
|
result += "\r\n";
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const char *newText = wmc->wchar2char(aLine.c_str(), SC_CP_UTF8);
|
const char *newText = wmc.wchar2char(aLine.c_str(), SC_CP_UTF8);
|
||||||
|
|
||||||
if (_ht == hash_md5)
|
if (_ht == hash_md5)
|
||||||
{
|
{
|
||||||
|
@ -2486,8 +2486,8 @@ void Notepad_plus::addHotSpot()
|
|||||||
const size_t generic_fontnameLen = 128;
|
const size_t generic_fontnameLen = 128;
|
||||||
TCHAR *generic_fontname = new TCHAR[generic_fontnameLen];
|
TCHAR *generic_fontname = new TCHAR[generic_fontnameLen];
|
||||||
|
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
const wchar_t * fontNameW = wmc->char2wchar(fontNameA, _nativeLangSpeaker.getLangEncoding());
|
const wchar_t * fontNameW = wmc.char2wchar(fontNameA, _nativeLangSpeaker.getLangEncoding());
|
||||||
wcscpy_s(generic_fontname, generic_fontnameLen, fontNameW);
|
wcscpy_s(generic_fontname, generic_fontnameLen, fontNameW);
|
||||||
hotspotStyle._fontName = generic_fontname;
|
hotspotStyle._fontName = generic_fontname;
|
||||||
|
|
||||||
|
@ -285,8 +285,8 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLin
|
|||||||
if (::PathFileExists(cmdLineParams->_easterEggName.c_str()))
|
if (::PathFileExists(cmdLineParams->_easterEggName.c_str()))
|
||||||
{
|
{
|
||||||
std::string content = getFileContent(cmdLineParams->_easterEggName.c_str());
|
std::string content = getFileContent(cmdLineParams->_easterEggName.c_str());
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
_userQuote = wmc->char2wchar(content.c_str(), SC_CP_UTF8);
|
_userQuote = wmc.char2wchar(content.c_str(), SC_CP_UTF8);
|
||||||
if (!_userQuote.empty())
|
if (!_userQuote.empty())
|
||||||
{
|
{
|
||||||
_quoteParams.reset();
|
_quoteParams.reset();
|
||||||
|
@ -574,8 +574,8 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||||||
{
|
{
|
||||||
char *fileNamesA = static_cast<char *>(pCopyData->lpData);
|
char *fileNamesA = static_cast<char *>(pCopyData->lpData);
|
||||||
const CmdLineParamsDTO & cmdLineParams = pNppParam->getCmdLineParams();
|
const CmdLineParamsDTO & cmdLineParams = pNppParam->getCmdLineParams();
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
const wchar_t *fileNamesW = wmc->char2wchar(fileNamesA, CP_ACP);
|
const wchar_t *fileNamesW = wmc.char2wchar(fileNamesA, CP_ACP);
|
||||||
loadCommandlineParams(fileNamesW, &cmdLineParams);
|
loadCommandlineParams(fileNamesW, &cmdLineParams);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2766,8 +2766,8 @@ void Notepad_plus::command(int id)
|
|||||||
{
|
{
|
||||||
char author[maxSelLen+1] = "";
|
char author[maxSelLen+1] = "";
|
||||||
_pEditView->getSelectedText(author, maxSelLen + 1);
|
_pEditView->getSelectedText(author, maxSelLen + 1);
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
const wchar_t * authorW = wmc->char2wchar(author, _nativeLangSpeaker.getLangEncoding());
|
const wchar_t * authorW = wmc.char2wchar(author, _nativeLangSpeaker.getLangEncoding());
|
||||||
int iQuote = getQuoteIndexFrom(authorW);
|
int iQuote = getQuoteIndexFrom(authorW);
|
||||||
|
|
||||||
if (iQuote == -1)
|
if (iQuote == -1)
|
||||||
@ -2803,8 +2803,8 @@ void Notepad_plus::command(int id)
|
|||||||
const char *authorName = "«J¤µ§^";
|
const char *authorName = "«J¤µ§^";
|
||||||
HWND hItem = ::GetDlgItem(_aboutDlg.getHSelf(), IDC_AUTHOR_NAME);
|
HWND hItem = ::GetDlgItem(_aboutDlg.getHSelf(), IDC_AUTHOR_NAME);
|
||||||
|
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
const wchar_t *authorNameW = wmc->char2wchar(authorName, NPP_CP_BIG5);
|
const wchar_t *authorNameW = wmc.char2wchar(authorName, NPP_CP_BIG5);
|
||||||
::SetWindowText(hItem, authorNameW);
|
::SetWindowText(hItem, authorNameW);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1057,8 +1057,8 @@ bool NppParameters::load()
|
|||||||
{
|
{
|
||||||
// Read cloud choice
|
// Read cloud choice
|
||||||
std::string cloudChoiceStr = getFileContent(cloudChoicePath.c_str());
|
std::string cloudChoiceStr = getFileContent(cloudChoicePath.c_str());
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
std::wstring cloudChoiceStrW = wmc->char2wchar(cloudChoiceStr.c_str(), SC_CP_UTF8);
|
std::wstring cloudChoiceStrW = wmc.char2wchar(cloudChoiceStr.c_str(), SC_CP_UTF8);
|
||||||
|
|
||||||
if (not cloudChoiceStrW.empty() and ::PathFileExists(cloudChoiceStrW.c_str()))
|
if (not cloudChoiceStrW.empty() and ::PathFileExists(cloudChoiceStrW.c_str()))
|
||||||
{
|
{
|
||||||
@ -1913,7 +1913,7 @@ bool NppParameters::getContextMenuFromXmlTree(HMENU mainMenuHadle, HMENU plugins
|
|||||||
if (!root)
|
if (!root)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
|
|
||||||
TiXmlNodeA *contextMenuRoot = root->FirstChildElement("ScintillaContextMenu");
|
TiXmlNodeA *contextMenuRoot = root->FirstChildElement("ScintillaContextMenu");
|
||||||
if (contextMenuRoot)
|
if (contextMenuRoot)
|
||||||
@ -1927,8 +1927,8 @@ bool NppParameters::getContextMenuFromXmlTree(HMENU mainMenuHadle, HMENU plugins
|
|||||||
|
|
||||||
generic_string folderName;
|
generic_string folderName;
|
||||||
generic_string displayAs;
|
generic_string displayAs;
|
||||||
folderName = folderNameA?wmc->char2wchar(folderNameA, SC_CP_UTF8):TEXT("");
|
folderName = folderNameA?wmc.char2wchar(folderNameA, SC_CP_UTF8):TEXT("");
|
||||||
displayAs = displayAsA?wmc->char2wchar(displayAsA, SC_CP_UTF8):TEXT("");
|
displayAs = displayAsA?wmc.char2wchar(displayAsA, SC_CP_UTF8):TEXT("");
|
||||||
|
|
||||||
int id;
|
int id;
|
||||||
const char *idStr = (childNode->ToElement())->Attribute("id", &id);
|
const char *idStr = (childNode->ToElement())->Attribute("id", &id);
|
||||||
@ -1943,8 +1943,8 @@ bool NppParameters::getContextMenuFromXmlTree(HMENU mainMenuHadle, HMENU plugins
|
|||||||
|
|
||||||
generic_string menuEntryName;
|
generic_string menuEntryName;
|
||||||
generic_string menuItemName;
|
generic_string menuItemName;
|
||||||
menuEntryName = menuEntryNameA?wmc->char2wchar(menuEntryNameA, SC_CP_UTF8):TEXT("");
|
menuEntryName = menuEntryNameA?wmc.char2wchar(menuEntryNameA, SC_CP_UTF8):TEXT("");
|
||||||
menuItemName = menuItemNameA?wmc->char2wchar(menuItemNameA, SC_CP_UTF8):TEXT("");
|
menuItemName = menuItemNameA?wmc.char2wchar(menuItemNameA, SC_CP_UTF8):TEXT("");
|
||||||
|
|
||||||
if (not menuEntryName.empty() and not menuItemName.empty())
|
if (not menuEntryName.empty() and not menuItemName.empty())
|
||||||
{
|
{
|
||||||
@ -1959,8 +1959,8 @@ bool NppParameters::getContextMenuFromXmlTree(HMENU mainMenuHadle, HMENU plugins
|
|||||||
|
|
||||||
generic_string pluginName;
|
generic_string pluginName;
|
||||||
generic_string pluginCmdName;
|
generic_string pluginCmdName;
|
||||||
pluginName = pluginNameA?wmc->char2wchar(pluginNameA, SC_CP_UTF8):TEXT("");
|
pluginName = pluginNameA?wmc.char2wchar(pluginNameA, SC_CP_UTF8):TEXT("");
|
||||||
pluginCmdName = pluginCmdNameA?wmc->char2wchar(pluginCmdNameA, SC_CP_UTF8):TEXT("");
|
pluginCmdName = pluginCmdNameA?wmc.char2wchar(pluginCmdNameA, SC_CP_UTF8):TEXT("");
|
||||||
|
|
||||||
// if plugin menu existing plls the value of PluginEntryName and PluginCommandItemName are valid
|
// if plugin menu existing plls the value of PluginEntryName and PluginCommandItemName are valid
|
||||||
if (pluginsMenu && not pluginName.empty() && not pluginCmdName.empty())
|
if (pluginsMenu && not pluginName.empty() && not pluginCmdName.empty())
|
||||||
@ -2752,8 +2752,8 @@ void NppParameters::setCloudChoice(const TCHAR *pathChoice)
|
|||||||
}
|
}
|
||||||
cloudChoicePath += TEXT("choice");
|
cloudChoicePath += TEXT("choice");
|
||||||
|
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
std::string cloudPathA = wmc->wchar2char(pathChoice, SC_CP_UTF8);
|
std::string cloudPathA = wmc.wchar2char(pathChoice, SC_CP_UTF8);
|
||||||
|
|
||||||
writeFileContent(cloudChoicePath.c_str(), cloudPathA.c_str());
|
writeFileContent(cloudChoicePath.c_str(), cloudPathA.c_str());
|
||||||
}
|
}
|
||||||
@ -5021,8 +5021,8 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
|
|||||||
const TCHAR *charsAddedW = element->Attribute(TEXT("charsAdded"));
|
const TCHAR *charsAddedW = element->Attribute(TEXT("charsAdded"));
|
||||||
if (charsAddedW)
|
if (charsAddedW)
|
||||||
{
|
{
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
_nppGUI._customWordChars = wmc->wchar2char(charsAddedW, SC_CP_UTF8);
|
_nppGUI._customWordChars = wmc.wchar2char(charsAddedW, SC_CP_UTF8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!lstrcmp(nm, TEXT("delimiterSelection")))
|
else if (!lstrcmp(nm, TEXT("delimiterSelection")))
|
||||||
@ -5799,8 +5799,8 @@ void NppParameters::createXmlTreeFromGUIParams()
|
|||||||
TiXmlElement *GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement();
|
TiXmlElement *GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement();
|
||||||
GUIConfigElement->SetAttribute(TEXT("name"), TEXT("wordCharList"));
|
GUIConfigElement->SetAttribute(TEXT("name"), TEXT("wordCharList"));
|
||||||
GUIConfigElement->SetAttribute(TEXT("useDefault"), _nppGUI._isWordCharDefault ? TEXT("yes") : TEXT("no"));
|
GUIConfigElement->SetAttribute(TEXT("useDefault"), _nppGUI._isWordCharDefault ? TEXT("yes") : TEXT("no"));
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
const wchar_t* charsAddStr = wmc->char2wchar(_nppGUI._customWordChars.c_str(), SC_CP_UTF8);
|
const wchar_t* charsAddStr = wmc.char2wchar(_nppGUI._customWordChars.c_str(), SC_CP_UTF8);
|
||||||
GUIConfigElement->SetAttribute(TEXT("charsAdded"), charsAddStr);
|
GUIConfigElement->SetAttribute(TEXT("charsAdded"), charsAddStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -878,7 +878,7 @@ bool FileManager::backupCurrentBuffer()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
int grabSize;
|
int grabSize;
|
||||||
for (int i = 0; i < lengthDoc; i += grabSize)
|
for (int i = 0; i < lengthDoc; i += grabSize)
|
||||||
{
|
{
|
||||||
@ -888,7 +888,7 @@ bool FileManager::backupCurrentBuffer()
|
|||||||
|
|
||||||
int newDataLen = 0;
|
int newDataLen = 0;
|
||||||
int incompleteMultibyteChar = 0;
|
int incompleteMultibyteChar = 0;
|
||||||
const char *newData = wmc->encode(SC_CP_UTF8, encoding, buf+i, grabSize, &newDataLen, &incompleteMultibyteChar);
|
const char *newData = wmc.encode(SC_CP_UTF8, encoding, buf+i, grabSize, &newDataLen, &incompleteMultibyteChar);
|
||||||
grabSize -= incompleteMultibyteChar;
|
grabSize -= incompleteMultibyteChar;
|
||||||
items_written = UnicodeConvertor.fwrite(newData, newDataLen);
|
items_written = UnicodeConvertor.fwrite(newData, newDataLen);
|
||||||
}
|
}
|
||||||
@ -1003,7 +1003,7 @@ bool FileManager::saveBuffer(BufferID id, const TCHAR * filename, bool isCopy, g
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
int grabSize;
|
int grabSize;
|
||||||
for (int i = 0; i < lengthDoc; i += grabSize)
|
for (int i = 0; i < lengthDoc; i += grabSize)
|
||||||
{
|
{
|
||||||
@ -1013,7 +1013,7 @@ bool FileManager::saveBuffer(BufferID id, const TCHAR * filename, bool isCopy, g
|
|||||||
|
|
||||||
int newDataLen = 0;
|
int newDataLen = 0;
|
||||||
int incompleteMultibyteChar = 0;
|
int incompleteMultibyteChar = 0;
|
||||||
const char *newData = wmc->encode(SC_CP_UTF8, encoding, buf+i, grabSize, &newDataLen, &incompleteMultibyteChar);
|
const char *newData = wmc.encode(SC_CP_UTF8, encoding, buf+i, grabSize, &newDataLen, &incompleteMultibyteChar);
|
||||||
grabSize -= incompleteMultibyteChar;
|
grabSize -= incompleteMultibyteChar;
|
||||||
items_written = UnicodeConvertor.fwrite(newData, newDataLen);
|
items_written = UnicodeConvertor.fwrite(newData, newDataLen);
|
||||||
}
|
}
|
||||||
@ -1309,8 +1309,8 @@ bool FileManager::loadFileData(Document doc, const TCHAR * filename, char* data,
|
|||||||
{
|
{
|
||||||
int id = fileFormat._language - L_EXTERNAL;
|
int id = fileFormat._language - L_EXTERNAL;
|
||||||
TCHAR * name = NppParameters::getInstance()->getELCFromIndex(id)._name;
|
TCHAR * name = NppParameters::getInstance()->getELCFromIndex(id)._name;
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
const char *pName = wmc->wchar2char(name, CP_ACP);
|
const char *pName = wmc.wchar2char(name, CP_ACP);
|
||||||
_pscratchTilla->execute(SCI_SETLEXERLANGUAGE, 0, reinterpret_cast<LPARAM>(pName));
|
_pscratchTilla->execute(SCI_SETLEXERLANGUAGE, 0, reinterpret_cast<LPARAM>(pName));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1369,9 +1369,9 @@ bool FileManager::loadFileData(Document doc, const TCHAR * filename, char* data,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WcharMbcsConvertor* wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
int newDataLen = 0;
|
int newDataLen = 0;
|
||||||
const char *newData = wmc->encode(fileFormat._encoding, SC_CP_UTF8, data, static_cast<int32_t>(lenFile), &newDataLen, &incompleteMultibyteChar);
|
const char *newData = wmc.encode(fileFormat._encoding, SC_CP_UTF8, data, static_cast<int32_t>(lenFile), &newDataLen, &incompleteMultibyteChar);
|
||||||
_pscratchTilla->execute(SCI_APPENDTEXT, newDataLen, reinterpret_cast<LPARAM>(newData));
|
_pscratchTilla->execute(SCI_APPENDTEXT, newDataLen, reinterpret_cast<LPARAM>(newData));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -525,7 +525,7 @@ void ScintillaEditView::setSpecialStyle(const Style & styleToSet)
|
|||||||
|
|
||||||
if (styleToSet._fontName && lstrcmp(styleToSet._fontName, TEXT("")) != 0)
|
if (styleToSet._fontName && lstrcmp(styleToSet._fontName, TEXT("")) != 0)
|
||||||
{
|
{
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
|
|
||||||
if (not _pParameter->isInFontList(styleToSet._fontName))
|
if (not _pParameter->isInFontList(styleToSet._fontName))
|
||||||
{
|
{
|
||||||
@ -533,7 +533,7 @@ void ScintillaEditView::setSpecialStyle(const Style & styleToSet)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const char * fontNameA = wmc->wchar2char(styleToSet._fontName, CP_UTF8);
|
const char * fontNameA = wmc.wchar2char(styleToSet._fontName, CP_UTF8);
|
||||||
execute(SCI_STYLESETFONT, styleID, reinterpret_cast<LPARAM>(fontNameA));
|
execute(SCI_STYLESETFONT, styleID, reinterpret_cast<LPARAM>(fontNameA));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -657,8 +657,8 @@ void ScintillaEditView::setXmlLexer(LangType type)
|
|||||||
execute(SCI_SETLEXER, SCLEX_HTML);
|
execute(SCI_SETLEXER, SCLEX_HTML);
|
||||||
const TCHAR *htmlKeyWords_generic =_pParameter->getWordList(L_HTML, LANG_INDEX_INSTR);
|
const TCHAR *htmlKeyWords_generic =_pParameter->getWordList(L_HTML, LANG_INDEX_INSTR);
|
||||||
|
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
const char *htmlKeyWords = wmc->wchar2char(htmlKeyWords_generic, CP_ACP);
|
const char *htmlKeyWords = wmc.wchar2char(htmlKeyWords_generic, CP_ACP);
|
||||||
execute(SCI_SETKEYWORDS, 0, reinterpret_cast<LPARAM>(htmlKeyWords?htmlKeyWords:""));
|
execute(SCI_SETKEYWORDS, 0, reinterpret_cast<LPARAM>(htmlKeyWords?htmlKeyWords:""));
|
||||||
makeStyle(L_HTML);
|
makeStyle(L_HTML);
|
||||||
|
|
||||||
@ -790,8 +790,8 @@ void ScintillaEditView::setUserLexer(const TCHAR *userLangName)
|
|||||||
|
|
||||||
for (int i = 0 ; i < SCE_USER_KWLIST_TOTAL ; ++i)
|
for (int i = 0 ; i < SCE_USER_KWLIST_TOTAL ; ++i)
|
||||||
{
|
{
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
const char * keyWords_char = wmc->wchar2char(userLangContainer->_keywordLists[i], codepage);
|
const char * keyWords_char = wmc.wchar2char(userLangContainer->_keywordLists[i], codepage);
|
||||||
|
|
||||||
if (globalMappper().setLexerMapper.find(i) != globalMappper().setLexerMapper.end())
|
if (globalMappper().setLexerMapper.find(i) != globalMappper().setLexerMapper.end())
|
||||||
{
|
{
|
||||||
@ -887,8 +887,8 @@ void ScintillaEditView::setExternalLexer(LangType typeDoc)
|
|||||||
int id = typeDoc - L_EXTERNAL;
|
int id = typeDoc - L_EXTERNAL;
|
||||||
TCHAR * name = _pParameter->getELCFromIndex(id)._name;
|
TCHAR * name = _pParameter->getELCFromIndex(id)._name;
|
||||||
|
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
const char *pName = wmc->wchar2char(name, CP_ACP);
|
const char *pName = wmc.wchar2char(name, CP_ACP);
|
||||||
|
|
||||||
execute(SCI_SETLEXERLANGUAGE, 0, reinterpret_cast<LPARAM>(pName));
|
execute(SCI_SETLEXERLANGUAGE, 0, reinterpret_cast<LPARAM>(pName));
|
||||||
|
|
||||||
@ -926,8 +926,8 @@ void ScintillaEditView::setCppLexer(LangType langType)
|
|||||||
{
|
{
|
||||||
if (doxygenKeyWords)
|
if (doxygenKeyWords)
|
||||||
{
|
{
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
const char * doxygenKeyWords_char = wmc->wchar2char(doxygenKeyWords, CP_ACP);
|
const char * doxygenKeyWords_char = wmc.wchar2char(doxygenKeyWords, CP_ACP);
|
||||||
execute(SCI_SETKEYWORDS, 2, reinterpret_cast<LPARAM>(doxygenKeyWords_char));
|
execute(SCI_SETKEYWORDS, 2, reinterpret_cast<LPARAM>(doxygenKeyWords_char));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -975,8 +975,8 @@ void ScintillaEditView::setJsLexer()
|
|||||||
|
|
||||||
if (doxygenKeyWords)
|
if (doxygenKeyWords)
|
||||||
{
|
{
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
const char * doxygenKeyWords_char = wmc->wchar2char(doxygenKeyWords, CP_ACP);
|
const char * doxygenKeyWords_char = wmc.wchar2char(doxygenKeyWords, CP_ACP);
|
||||||
execute(SCI_SETKEYWORDS, 2, reinterpret_cast<LPARAM>(doxygenKeyWords_char));
|
execute(SCI_SETKEYWORDS, 2, reinterpret_cast<LPARAM>(doxygenKeyWords_char));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1184,47 +1184,47 @@ void ScintillaEditView::setLexer(int lexerID, LangType langType, int whichList)
|
|||||||
|
|
||||||
makeStyle(langType, pKwArray);
|
makeStyle(langType, pKwArray);
|
||||||
|
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
|
|
||||||
if (whichList & LIST_0)
|
if (whichList & LIST_0)
|
||||||
{
|
{
|
||||||
const char * keyWords_char = wmc->wchar2char(pKwArray[LANG_INDEX_INSTR], CP_ACP);
|
const char * keyWords_char = wmc.wchar2char(pKwArray[LANG_INDEX_INSTR], CP_ACP);
|
||||||
setKeywords(langType, keyWords_char, LANG_INDEX_INSTR);
|
setKeywords(langType, keyWords_char, LANG_INDEX_INSTR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (whichList & LIST_1)
|
if (whichList & LIST_1)
|
||||||
{
|
{
|
||||||
const char * keyWords_char = wmc->wchar2char(pKwArray[LANG_INDEX_INSTR2], CP_ACP);
|
const char * keyWords_char = wmc.wchar2char(pKwArray[LANG_INDEX_INSTR2], CP_ACP);
|
||||||
setKeywords(langType, keyWords_char, LANG_INDEX_INSTR2);
|
setKeywords(langType, keyWords_char, LANG_INDEX_INSTR2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (whichList & LIST_2)
|
if (whichList & LIST_2)
|
||||||
{
|
{
|
||||||
const char * keyWords_char = wmc->wchar2char(pKwArray[LANG_INDEX_TYPE], CP_ACP);
|
const char * keyWords_char = wmc.wchar2char(pKwArray[LANG_INDEX_TYPE], CP_ACP);
|
||||||
setKeywords(langType, keyWords_char, LANG_INDEX_TYPE);
|
setKeywords(langType, keyWords_char, LANG_INDEX_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (whichList & LIST_3)
|
if (whichList & LIST_3)
|
||||||
{
|
{
|
||||||
const char * keyWords_char = wmc->wchar2char(pKwArray[LANG_INDEX_TYPE2], CP_ACP);
|
const char * keyWords_char = wmc.wchar2char(pKwArray[LANG_INDEX_TYPE2], CP_ACP);
|
||||||
setKeywords(langType, keyWords_char, LANG_INDEX_TYPE2);
|
setKeywords(langType, keyWords_char, LANG_INDEX_TYPE2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (whichList & LIST_4)
|
if (whichList & LIST_4)
|
||||||
{
|
{
|
||||||
const char * keyWords_char = wmc->wchar2char(pKwArray[LANG_INDEX_TYPE3], CP_ACP);
|
const char * keyWords_char = wmc.wchar2char(pKwArray[LANG_INDEX_TYPE3], CP_ACP);
|
||||||
setKeywords(langType, keyWords_char, LANG_INDEX_TYPE3);
|
setKeywords(langType, keyWords_char, LANG_INDEX_TYPE3);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (whichList & LIST_5)
|
if (whichList & LIST_5)
|
||||||
{
|
{
|
||||||
const char * keyWords_char = wmc->wchar2char(pKwArray[LANG_INDEX_TYPE4], CP_ACP);
|
const char * keyWords_char = wmc.wchar2char(pKwArray[LANG_INDEX_TYPE4], CP_ACP);
|
||||||
setKeywords(langType, keyWords_char, LANG_INDEX_TYPE4);
|
setKeywords(langType, keyWords_char, LANG_INDEX_TYPE4);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (whichList & LIST_6)
|
if (whichList & LIST_6)
|
||||||
{
|
{
|
||||||
const char * keyWords_char = wmc->wchar2char(pKwArray[LANG_INDEX_TYPE5], CP_ACP);
|
const char * keyWords_char = wmc.wchar2char(pKwArray[LANG_INDEX_TYPE5], CP_ACP);
|
||||||
setKeywords(langType, keyWords_char, LANG_INDEX_TYPE5);
|
setKeywords(langType, keyWords_char, LANG_INDEX_TYPE5);
|
||||||
}
|
}
|
||||||
execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("fold"), reinterpret_cast<LPARAM>("1"));
|
execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("fold"), reinterpret_cast<LPARAM>("1"));
|
||||||
@ -2132,11 +2132,11 @@ generic_string ScintillaEditView::getGenericTextAsString(size_t start, size_t en
|
|||||||
|
|
||||||
void ScintillaEditView::getGenericText(TCHAR *dest, size_t destlen, size_t start, size_t end) const
|
void ScintillaEditView::getGenericText(TCHAR *dest, size_t destlen, size_t start, size_t end) const
|
||||||
{
|
{
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
char *destA = new char[end - start + 1];
|
char *destA = new char[end - start + 1];
|
||||||
getText(destA, start, end);
|
getText(destA, start, end);
|
||||||
UINT cp = static_cast<UINT>(execute(SCI_GETCODEPAGE));
|
UINT cp = static_cast<UINT>(execute(SCI_GETCODEPAGE));
|
||||||
const TCHAR *destW = wmc->char2wchar(destA, cp);
|
const TCHAR *destW = wmc.char2wchar(destA, cp);
|
||||||
_tcsncpy_s(dest, destlen, destW, _TRUNCATE);
|
_tcsncpy_s(dest, destlen, destW, _TRUNCATE);
|
||||||
delete [] destA;
|
delete [] destA;
|
||||||
}
|
}
|
||||||
@ -2146,20 +2146,20 @@ void ScintillaEditView::getGenericText(TCHAR *dest, size_t destlen, size_t start
|
|||||||
|
|
||||||
void ScintillaEditView::getGenericText(TCHAR *dest, size_t destlen, int start, int end, int *mstart, int *mend) const
|
void ScintillaEditView::getGenericText(TCHAR *dest, size_t destlen, int start, int end, int *mstart, int *mend) const
|
||||||
{
|
{
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
char *destA = new char[end - start + 1];
|
char *destA = new char[end - start + 1];
|
||||||
getText(destA, start, end);
|
getText(destA, start, end);
|
||||||
UINT cp = static_cast<UINT>(execute(SCI_GETCODEPAGE)) ;
|
UINT cp = static_cast<UINT>(execute(SCI_GETCODEPAGE)) ;
|
||||||
const TCHAR *destW = wmc->char2wchar(destA, cp, mstart, mend);
|
const TCHAR *destW = wmc.char2wchar(destA, cp, mstart, mend);
|
||||||
_tcsncpy_s(dest, destlen, destW, _TRUNCATE);
|
_tcsncpy_s(dest, destlen, destW, _TRUNCATE);
|
||||||
delete [] destA;
|
delete [] destA;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScintillaEditView::insertGenericTextFrom(size_t position, const TCHAR *text2insert) const
|
void ScintillaEditView::insertGenericTextFrom(size_t position, const TCHAR *text2insert) const
|
||||||
{
|
{
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
UINT cp = static_cast<UINT>(execute(SCI_GETCODEPAGE));
|
UINT cp = static_cast<UINT>(execute(SCI_GETCODEPAGE));
|
||||||
const char *text2insertA = wmc->wchar2char(text2insert, cp);
|
const char *text2insertA = wmc.wchar2char(text2insert, cp);
|
||||||
execute(SCI_INSERTTEXT, position, reinterpret_cast<LPARAM>(text2insertA));
|
execute(SCI_INSERTTEXT, position, reinterpret_cast<LPARAM>(text2insertA));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2211,12 +2211,12 @@ char * ScintillaEditView::getWordOnCaretPos(char * txt, int size)
|
|||||||
|
|
||||||
TCHAR * ScintillaEditView::getGenericWordOnCaretPos(TCHAR * txt, int size)
|
TCHAR * ScintillaEditView::getGenericWordOnCaretPos(TCHAR * txt, int size)
|
||||||
{
|
{
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
UINT cp = static_cast<UINT>(execute(SCI_GETCODEPAGE));
|
UINT cp = static_cast<UINT>(execute(SCI_GETCODEPAGE));
|
||||||
char *txtA = new char[size + 1];
|
char *txtA = new char[size + 1];
|
||||||
getWordOnCaretPos(txtA, size);
|
getWordOnCaretPos(txtA, size);
|
||||||
|
|
||||||
const TCHAR * txtW = wmc->char2wchar(txtA, cp);
|
const TCHAR * txtW = wmc.char2wchar(txtA, cp);
|
||||||
wcscpy_s(txt, size, txtW);
|
wcscpy_s(txt, size, txtW);
|
||||||
delete [] txtA;
|
delete [] txtA;
|
||||||
return txt;
|
return txt;
|
||||||
@ -2242,12 +2242,12 @@ char * ScintillaEditView::getSelectedText(char * txt, int size, bool expand)
|
|||||||
|
|
||||||
TCHAR * ScintillaEditView::getGenericSelectedText(TCHAR * txt, int size, bool expand)
|
TCHAR * ScintillaEditView::getGenericSelectedText(TCHAR * txt, int size, bool expand)
|
||||||
{
|
{
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
UINT cp = static_cast<UINT>(execute(SCI_GETCODEPAGE));
|
UINT cp = static_cast<UINT>(execute(SCI_GETCODEPAGE));
|
||||||
char *txtA = new char[size + 1];
|
char *txtA = new char[size + 1];
|
||||||
getSelectedText(txtA, size, expand);
|
getSelectedText(txtA, size, expand);
|
||||||
|
|
||||||
const TCHAR * txtW = wmc->char2wchar(txtA, cp);
|
const TCHAR * txtW = wmc.char2wchar(txtA, cp);
|
||||||
wcscpy_s(txt, size, txtW);
|
wcscpy_s(txt, size, txtW);
|
||||||
delete [] txtA;
|
delete [] txtA;
|
||||||
return txt;
|
return txt;
|
||||||
@ -2257,9 +2257,9 @@ int ScintillaEditView::searchInTarget(const TCHAR * text2Find, size_t lenOfText2
|
|||||||
{
|
{
|
||||||
execute(SCI_SETTARGETRANGE, fromPos, toPos);
|
execute(SCI_SETTARGETRANGE, fromPos, toPos);
|
||||||
|
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
UINT cp = static_cast<UINT>(execute(SCI_GETCODEPAGE));
|
UINT cp = static_cast<UINT>(execute(SCI_GETCODEPAGE));
|
||||||
const char *text2FindA = wmc->wchar2char(text2Find, cp);
|
const char *text2FindA = wmc.wchar2char(text2Find, cp);
|
||||||
size_t text2FindALen = strlen(text2FindA);
|
size_t text2FindALen = strlen(text2FindA);
|
||||||
size_t len = (lenOfText2Find > text2FindALen) ? lenOfText2Find : text2FindALen;
|
size_t len = (lenOfText2Find > text2FindALen) ? lenOfText2Find : text2FindALen;
|
||||||
return static_cast<int32_t>(execute(SCI_SEARCHINTARGET, len, reinterpret_cast<LPARAM>(text2FindA)));
|
return static_cast<int32_t>(execute(SCI_SEARCHINTARGET, len, reinterpret_cast<LPARAM>(text2FindA)));
|
||||||
@ -2267,25 +2267,25 @@ int ScintillaEditView::searchInTarget(const TCHAR * text2Find, size_t lenOfText2
|
|||||||
|
|
||||||
void ScintillaEditView::appandGenericText(const TCHAR * text2Append) const
|
void ScintillaEditView::appandGenericText(const TCHAR * text2Append) const
|
||||||
{
|
{
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
UINT cp = static_cast<UINT>(execute(SCI_GETCODEPAGE));
|
UINT cp = static_cast<UINT>(execute(SCI_GETCODEPAGE));
|
||||||
const char *text2AppendA =wmc->wchar2char(text2Append, cp);
|
const char *text2AppendA =wmc.wchar2char(text2Append, cp);
|
||||||
execute(SCI_APPENDTEXT, strlen(text2AppendA), reinterpret_cast<LPARAM>(text2AppendA));
|
execute(SCI_APPENDTEXT, strlen(text2AppendA), reinterpret_cast<LPARAM>(text2AppendA));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScintillaEditView::addGenericText(const TCHAR * text2Append) const
|
void ScintillaEditView::addGenericText(const TCHAR * text2Append) const
|
||||||
{
|
{
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
UINT cp = static_cast<UINT>(execute(SCI_GETCODEPAGE));
|
UINT cp = static_cast<UINT>(execute(SCI_GETCODEPAGE));
|
||||||
const char *text2AppendA =wmc->wchar2char(text2Append, cp);
|
const char *text2AppendA =wmc.wchar2char(text2Append, cp);
|
||||||
execute(SCI_ADDTEXT, strlen(text2AppendA), reinterpret_cast<LPARAM>(text2AppendA));
|
execute(SCI_ADDTEXT, strlen(text2AppendA), reinterpret_cast<LPARAM>(text2AppendA));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScintillaEditView::addGenericText(const TCHAR * text2Append, long *mstart, long *mend) const
|
void ScintillaEditView::addGenericText(const TCHAR * text2Append, long *mstart, long *mend) const
|
||||||
{
|
{
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
UINT cp = static_cast<UINT>(execute(SCI_GETCODEPAGE));
|
UINT cp = static_cast<UINT>(execute(SCI_GETCODEPAGE));
|
||||||
const char *text2AppendA =wmc->wchar2char(text2Append, cp, mstart, mend);
|
const char *text2AppendA =wmc.wchar2char(text2Append, cp, mstart, mend);
|
||||||
execute(SCI_ADDTEXT, strlen(text2AppendA), reinterpret_cast<LPARAM>(text2AppendA));
|
execute(SCI_ADDTEXT, strlen(text2AppendA), reinterpret_cast<LPARAM>(text2AppendA));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2295,9 +2295,9 @@ int32_t ScintillaEditView::replaceTarget(const TCHAR * str2replace, int fromTarg
|
|||||||
{
|
{
|
||||||
execute(SCI_SETTARGETRANGE, fromTargetPos, toTargetPos);
|
execute(SCI_SETTARGETRANGE, fromTargetPos, toTargetPos);
|
||||||
}
|
}
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
UINT cp = static_cast<UINT>(execute(SCI_GETCODEPAGE));
|
UINT cp = static_cast<UINT>(execute(SCI_GETCODEPAGE));
|
||||||
const char *str2replaceA = wmc->wchar2char(str2replace, cp);
|
const char *str2replaceA = wmc.wchar2char(str2replace, cp);
|
||||||
return static_cast<int32_t>(execute(SCI_REPLACETARGET, static_cast<WPARAM>(-1), reinterpret_cast<LPARAM>(str2replaceA)));
|
return static_cast<int32_t>(execute(SCI_REPLACETARGET, static_cast<WPARAM>(-1), reinterpret_cast<LPARAM>(str2replaceA)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2307,25 +2307,25 @@ int ScintillaEditView::replaceTargetRegExMode(const TCHAR * re, int fromTargetPo
|
|||||||
{
|
{
|
||||||
execute(SCI_SETTARGETRANGE, fromTargetPos, toTargetPos);
|
execute(SCI_SETTARGETRANGE, fromTargetPos, toTargetPos);
|
||||||
}
|
}
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
UINT cp = static_cast<UINT>(execute(SCI_GETCODEPAGE));
|
UINT cp = static_cast<UINT>(execute(SCI_GETCODEPAGE));
|
||||||
const char *reA = wmc->wchar2char(re, cp);
|
const char *reA = wmc.wchar2char(re, cp);
|
||||||
return static_cast<int32_t>(execute(SCI_REPLACETARGETRE, static_cast<WPARAM>(-1), reinterpret_cast<LPARAM>(reA)));
|
return static_cast<int32_t>(execute(SCI_REPLACETARGETRE, static_cast<WPARAM>(-1), reinterpret_cast<LPARAM>(reA)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScintillaEditView::showAutoComletion(size_t lenEntered, const TCHAR* list)
|
void ScintillaEditView::showAutoComletion(size_t lenEntered, const TCHAR* list)
|
||||||
{
|
{
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
UINT cp = static_cast<UINT>(execute(SCI_GETCODEPAGE));
|
UINT cp = static_cast<UINT>(execute(SCI_GETCODEPAGE));
|
||||||
const char *listA = wmc->wchar2char(list, cp);
|
const char *listA = wmc.wchar2char(list, cp);
|
||||||
execute(SCI_AUTOCSHOW, lenEntered, reinterpret_cast<LPARAM>(listA));
|
execute(SCI_AUTOCSHOW, lenEntered, reinterpret_cast<LPARAM>(listA));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScintillaEditView::showCallTip(int startPos, const TCHAR * def)
|
void ScintillaEditView::showCallTip(int startPos, const TCHAR * def)
|
||||||
{
|
{
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
UINT cp = static_cast<UINT>(execute(SCI_GETCODEPAGE));
|
UINT cp = static_cast<UINT>(execute(SCI_GETCODEPAGE));
|
||||||
const char *defA = wmc->wchar2char(def, cp);
|
const char *defA = wmc.wchar2char(def, cp);
|
||||||
execute(SCI_CALLTIPSHOW, startPos, reinterpret_cast<LPARAM>(defA));
|
execute(SCI_CALLTIPSHOW, startPos, reinterpret_cast<LPARAM>(defA));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2345,14 +2345,14 @@ void ScintillaEditView::getLine(size_t lineNumber, TCHAR * line, int lineBufferL
|
|||||||
if (lineLen >= lineBufferLen)
|
if (lineLen >= lineBufferLen)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
UINT cp = static_cast<UINT>(execute(SCI_GETCODEPAGE));
|
UINT cp = static_cast<UINT>(execute(SCI_GETCODEPAGE));
|
||||||
char *lineA = new char[lineBufferLen];
|
char *lineA = new char[lineBufferLen];
|
||||||
// From Scintilla documentation for SCI_GETLINE: "The buffer is not terminated by a 0 character."
|
// From Scintilla documentation for SCI_GETLINE: "The buffer is not terminated by a 0 character."
|
||||||
memset(lineA, 0x0, sizeof(char) * lineBufferLen);
|
memset(lineA, 0x0, sizeof(char) * lineBufferLen);
|
||||||
|
|
||||||
execute(SCI_GETLINE, lineNumber, reinterpret_cast<LPARAM>(lineA));
|
execute(SCI_GETLINE, lineNumber, reinterpret_cast<LPARAM>(lineA));
|
||||||
const TCHAR *lineW = wmc->char2wchar(lineA, cp);
|
const TCHAR *lineW = wmc.char2wchar(lineA, cp);
|
||||||
lstrcpyn(line, lineW, lineBufferLen);
|
lstrcpyn(line, lineW, lineBufferLen);
|
||||||
delete [] lineA;
|
delete [] lineA;
|
||||||
}
|
}
|
||||||
@ -2626,8 +2626,8 @@ const char * ScintillaEditView::getCompleteKeywordList(std::basic_string<char> &
|
|||||||
kwl += " ";
|
kwl += " ";
|
||||||
const TCHAR *defKwl_generic = _pParameter->getWordList(langType, keywordIndex);
|
const TCHAR *defKwl_generic = _pParameter->getWordList(langType, keywordIndex);
|
||||||
|
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
const char * defKwl = wmc->wchar2char(defKwl_generic, CP_ACP);
|
const char * defKwl = wmc.wchar2char(defKwl_generic, CP_ACP);
|
||||||
kwl += defKwl?defKwl:"";
|
kwl += defKwl?defKwl:"";
|
||||||
|
|
||||||
return kwl.c_str();
|
return kwl.c_str();
|
||||||
@ -3009,9 +3009,9 @@ void ScintillaEditView::columnReplace(ColumnModeInfos & cmi, const TCHAR *str)
|
|||||||
|
|
||||||
execute(SCI_SETTARGETRANGE, cmi[i]._selLpos, cmi[i]._selRpos);
|
execute(SCI_SETTARGETRANGE, cmi[i]._selLpos, cmi[i]._selRpos);
|
||||||
|
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
UINT cp = static_cast<UINT>(execute(SCI_GETCODEPAGE));
|
UINT cp = static_cast<UINT>(execute(SCI_GETCODEPAGE));
|
||||||
const char *strA = wmc->wchar2char(str, cp);
|
const char *strA = wmc.wchar2char(str, cp);
|
||||||
execute(SCI_REPLACETARGET, static_cast<WPARAM>(-1), reinterpret_cast<LPARAM>(strA));
|
execute(SCI_REPLACETARGET, static_cast<WPARAM>(-1), reinterpret_cast<LPARAM>(strA));
|
||||||
|
|
||||||
if (hasVirtualSpc)
|
if (hasVirtualSpc)
|
||||||
@ -3116,9 +3116,9 @@ void ScintillaEditView::columnReplace(ColumnModeInfos & cmi, int initial, int in
|
|||||||
}
|
}
|
||||||
execute(SCI_SETTARGETRANGE, cmi[i]._selLpos, cmi[i]._selRpos);
|
execute(SCI_SETTARGETRANGE, cmi[i]._selLpos, cmi[i]._selRpos);
|
||||||
|
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
UINT cp = static_cast<UINT>(execute(SCI_GETCODEPAGE));
|
UINT cp = static_cast<UINT>(execute(SCI_GETCODEPAGE));
|
||||||
const char *strA = wmc->wchar2char(str, cp);
|
const char *strA = wmc.wchar2char(str, cp);
|
||||||
execute(SCI_REPLACETARGET, static_cast<WPARAM>(-1), reinterpret_cast<LPARAM>(strA));
|
execute(SCI_REPLACETARGET, static_cast<WPARAM>(-1), reinterpret_cast<LPARAM>(strA));
|
||||||
|
|
||||||
if (hasVirtualSpc)
|
if (hasVirtualSpc)
|
||||||
|
@ -165,9 +165,9 @@ void SmartHighlighter::highlightView(ScintillaEditView * pHighlightView, Scintil
|
|||||||
char * text2Find = new char[textlen];
|
char * text2Find = new char[textlen];
|
||||||
pHighlightView->getSelectedText(text2Find, textlen, false); //do not expand selection (false)
|
pHighlightView->getSelectedText(text2Find, textlen, false); //do not expand selection (false)
|
||||||
|
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
UINT cp = static_cast<UINT>(pHighlightView->execute(SCI_GETCODEPAGE));
|
UINT cp = static_cast<UINT>(pHighlightView->execute(SCI_GETCODEPAGE));
|
||||||
const TCHAR * text2FindW = wmc->char2wchar(text2Find, cp);
|
const TCHAR * text2FindW = wmc.char2wchar(text2Find, cp);
|
||||||
|
|
||||||
highlightViewWithWord(pHighlightView, text2FindW);
|
highlightViewWithWord(pHighlightView, text2FindW);
|
||||||
|
|
||||||
|
@ -43,10 +43,10 @@ INT_PTR CALLBACK AboutDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPara
|
|||||||
HWND compileDateHandle = ::GetDlgItem(_hSelf, IDC_BUILD_DATETIME);
|
HWND compileDateHandle = ::GetDlgItem(_hSelf, IDC_BUILD_DATETIME);
|
||||||
generic_string buildTime = TEXT("Build time : ");
|
generic_string buildTime = TEXT("Build time : ");
|
||||||
|
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
buildTime += wmc->char2wchar(__DATE__, CP_ACP);
|
buildTime += wmc.char2wchar(__DATE__, CP_ACP);
|
||||||
buildTime += TEXT(" - ");
|
buildTime += TEXT(" - ");
|
||||||
buildTime += wmc->char2wchar(__TIME__, CP_ACP);
|
buildTime += wmc.char2wchar(__TIME__, CP_ACP);
|
||||||
|
|
||||||
NppParameters *pNppParam = NppParameters::getInstance();
|
NppParameters *pNppParam = NppParameters::getInstance();
|
||||||
LPCTSTR bitness = pNppParam ->isx64() ? TEXT("(64-bit)") : TEXT("(32-bit)");
|
LPCTSTR bitness = pNppParam ->isx64() ? TEXT("(64-bit)") : TEXT("(32-bit)");
|
||||||
@ -136,10 +136,10 @@ INT_PTR CALLBACK DebugInfoDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM /
|
|||||||
// Build time
|
// Build time
|
||||||
_debugInfoStr += TEXT("Build time : ");
|
_debugInfoStr += TEXT("Build time : ");
|
||||||
generic_string buildTime;
|
generic_string buildTime;
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
buildTime += wmc->char2wchar(__DATE__, CP_ACP);
|
buildTime += wmc.char2wchar(__DATE__, CP_ACP);
|
||||||
buildTime += TEXT(" - ");
|
buildTime += TEXT(" - ");
|
||||||
buildTime += wmc->char2wchar(__TIME__, CP_ACP);
|
buildTime += wmc.char2wchar(__TIME__, CP_ACP);
|
||||||
_debugInfoStr += buildTime;
|
_debugInfoStr += buildTime;
|
||||||
_debugInfoStr += TEXT("\r\n");
|
_debugInfoStr += TEXT("\r\n");
|
||||||
|
|
||||||
|
@ -259,18 +259,18 @@ bool FunctionListPanel::serialize(const generic_string & outputFilename)
|
|||||||
const char* leavesLabel = "leaves";
|
const char* leavesLabel = "leaves";
|
||||||
const char* nameLabel = "name";
|
const char* nameLabel = "name";
|
||||||
|
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
json j;
|
json j;
|
||||||
j[rootLabel] = wmc->wchar2char(fileNameLabel, CP_ACP);
|
j[rootLabel] = wmc.wchar2char(fileNameLabel, CP_ACP);
|
||||||
|
|
||||||
for (const auto & info : _foundFuncInfos)
|
for (const auto & info : _foundFuncInfos)
|
||||||
{
|
{
|
||||||
std::string leafName = wmc->wchar2char(info._data.c_str(), CP_ACP);
|
std::string leafName = wmc.wchar2char(info._data.c_str(), CP_ACP);
|
||||||
|
|
||||||
if (!info._data2.empty()) // node
|
if (!info._data2.empty()) // node
|
||||||
{
|
{
|
||||||
bool isFound = false;
|
bool isFound = false;
|
||||||
std::string nodeName = wmc->wchar2char(info._data2.c_str(), CP_ACP);
|
std::string nodeName = wmc.wchar2char(info._data2.c_str(), CP_ACP);
|
||||||
|
|
||||||
for (auto & i : j[nodesLabel])
|
for (auto & i : j[nodesLabel])
|
||||||
{
|
{
|
||||||
|
@ -631,7 +631,7 @@ bool loadFromJson(PluginViewList & pl, const json& j)
|
|||||||
if (j.empty())
|
if (j.empty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
|
|
||||||
json jArray = j["npp-plugins"];
|
json jArray = j["npp-plugins"];
|
||||||
if (jArray.empty() || jArray.type() != json::value_t::array)
|
if (jArray.empty() || jArray.type() != json::value_t::array)
|
||||||
@ -644,29 +644,29 @@ bool loadFromJson(PluginViewList & pl, const json& j)
|
|||||||
PluginUpdateInfo* pi = new PluginUpdateInfo();
|
PluginUpdateInfo* pi = new PluginUpdateInfo();
|
||||||
|
|
||||||
string valStr = i.at("folder-name").get<std::string>();
|
string valStr = i.at("folder-name").get<std::string>();
|
||||||
pi->_folderName = wmc->char2wchar(valStr.c_str(), CP_ACP);
|
pi->_folderName = wmc.char2wchar(valStr.c_str(), CP_ACP);
|
||||||
|
|
||||||
valStr = i.at("display-name").get<std::string>();
|
valStr = i.at("display-name").get<std::string>();
|
||||||
pi->_displayName = wmc->char2wchar(valStr.c_str(), CP_ACP);
|
pi->_displayName = wmc.char2wchar(valStr.c_str(), CP_ACP);
|
||||||
|
|
||||||
valStr = i.at("author").get<std::string>();
|
valStr = i.at("author").get<std::string>();
|
||||||
pi->_author = wmc->char2wchar(valStr.c_str(), CP_ACP);
|
pi->_author = wmc.char2wchar(valStr.c_str(), CP_ACP);
|
||||||
|
|
||||||
valStr = i.at("description").get<std::string>();
|
valStr = i.at("description").get<std::string>();
|
||||||
pi->_description = wmc->char2wchar(valStr.c_str(), CP_ACP);
|
pi->_description = wmc.char2wchar(valStr.c_str(), CP_ACP);
|
||||||
|
|
||||||
valStr = i.at("id").get<std::string>();
|
valStr = i.at("id").get<std::string>();
|
||||||
pi->_id = wmc->char2wchar(valStr.c_str(), CP_ACP);
|
pi->_id = wmc.char2wchar(valStr.c_str(), CP_ACP);
|
||||||
|
|
||||||
valStr = i.at("version").get<std::string>();
|
valStr = i.at("version").get<std::string>();
|
||||||
generic_string newValStr(valStr.begin(), valStr.end());
|
generic_string newValStr(valStr.begin(), valStr.end());
|
||||||
pi->_version = Version(newValStr);
|
pi->_version = Version(newValStr);
|
||||||
|
|
||||||
valStr = i.at("repository").get<std::string>();
|
valStr = i.at("repository").get<std::string>();
|
||||||
pi->_repository = wmc->char2wchar(valStr.c_str(), CP_ACP);
|
pi->_repository = wmc.char2wchar(valStr.c_str(), CP_ACP);
|
||||||
|
|
||||||
valStr = i.at("homepage").get<std::string>();
|
valStr = i.at("homepage").get<std::string>();
|
||||||
pi->_homepage = wmc->char2wchar(valStr.c_str(), CP_ACP);
|
pi->_homepage = wmc.char2wchar(valStr.c_str(), CP_ACP);
|
||||||
|
|
||||||
|
|
||||||
pl.pushBack(pi);
|
pl.pushBack(pi);
|
||||||
|
@ -154,7 +154,7 @@ generic_string NativeLangSpeaker::getSpecialMenuEntryName(const char *entryName)
|
|||||||
TiXmlNodeA *entriesRoot = mainMenu->FirstChild("Entries");
|
TiXmlNodeA *entriesRoot = mainMenu->FirstChild("Entries");
|
||||||
if (!entriesRoot) return TEXT("");
|
if (!entriesRoot) return TEXT("");
|
||||||
|
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
|
|
||||||
for (TiXmlNodeA *childNode = entriesRoot->FirstChildElement("Item");
|
for (TiXmlNodeA *childNode = entriesRoot->FirstChildElement("Item");
|
||||||
childNode ;
|
childNode ;
|
||||||
@ -168,7 +168,7 @@ generic_string NativeLangSpeaker::getSpecialMenuEntryName(const char *entryName)
|
|||||||
const char *name = element->Attribute("name");
|
const char *name = element->Attribute("name");
|
||||||
if (!strcmp(idName, entryName))
|
if (!strcmp(idName, entryName))
|
||||||
{
|
{
|
||||||
return wmc->char2wchar(name, _nativeLangEncoding);
|
return wmc.char2wchar(name, _nativeLangEncoding);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -189,7 +189,7 @@ generic_string NativeLangSpeaker::getNativeLangMenuString(int itemID) const
|
|||||||
node = node->FirstChild("Commands");
|
node = node->FirstChild("Commands");
|
||||||
if (!node) return TEXT("");
|
if (!node) return TEXT("");
|
||||||
|
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
|
|
||||||
for (TiXmlNodeA *childNode = node->FirstChildElement("Item");
|
for (TiXmlNodeA *childNode = node->FirstChildElement("Item");
|
||||||
childNode ;
|
childNode ;
|
||||||
@ -202,7 +202,7 @@ generic_string NativeLangSpeaker::getNativeLangMenuString(int itemID) const
|
|||||||
const char *name = element->Attribute("name");
|
const char *name = element->Attribute("name");
|
||||||
if (name)
|
if (name)
|
||||||
{
|
{
|
||||||
return wmc->char2wchar(name, _nativeLangEncoding);
|
return wmc.char2wchar(name, _nativeLangEncoding);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -228,8 +228,8 @@ generic_string NativeLangSpeaker::getLocalizedStrFromID(const char *strID, const
|
|||||||
const char *value = element->Attribute("value");
|
const char *value = element->Attribute("value");
|
||||||
if (not value) return defaultString;
|
if (not value) return defaultString;
|
||||||
|
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
return wmc->char2wchar(value, _nativeLangEncoding);
|
return wmc.char2wchar(value, _nativeLangEncoding);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -265,7 +265,7 @@ void NativeLangSpeaker::changeMenuLang(HMENU menuHandle, generic_string & plugin
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
const char* idName = nullptr;
|
const char* idName = nullptr;
|
||||||
WcharMbcsConvertor* wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
|
|
||||||
for (TiXmlNodeA *childNode = entriesRoot->FirstChildElement("Item");
|
for (TiXmlNodeA *childNode = entriesRoot->FirstChildElement("Item");
|
||||||
childNode ;
|
childNode ;
|
||||||
@ -279,7 +279,7 @@ void NativeLangSpeaker::changeMenuLang(HMENU menuHandle, generic_string & plugin
|
|||||||
if (menuPos._x != -1)
|
if (menuPos._x != -1)
|
||||||
{
|
{
|
||||||
const char *name = element->Attribute("name");
|
const char *name = element->Attribute("name");
|
||||||
const wchar_t *nameW = wmc->char2wchar(name, _nativeLangEncoding);
|
const wchar_t *nameW = wmc.char2wchar(name, _nativeLangEncoding);
|
||||||
::ModifyMenu(menuHandle, menuPos._x, MF_BYPOSITION, 0, nameW);
|
::ModifyMenu(menuHandle, menuPos._x, MF_BYPOSITION, 0, nameW);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -291,12 +291,12 @@ void NativeLangSpeaker::changeMenuLang(HMENU menuHandle, generic_string & plugin
|
|||||||
const char *name = element->Attribute("name");
|
const char *name = element->Attribute("name");
|
||||||
if (!strcmp(idName, "Plugins"))
|
if (!strcmp(idName, "Plugins"))
|
||||||
{
|
{
|
||||||
const wchar_t *nameW = wmc->char2wchar(name, _nativeLangEncoding);
|
const wchar_t *nameW = wmc.char2wchar(name, _nativeLangEncoding);
|
||||||
pluginsTrans = nameW;
|
pluginsTrans = nameW;
|
||||||
}
|
}
|
||||||
else if (!strcmp(idName, "Window"))
|
else if (!strcmp(idName, "Window"))
|
||||||
{
|
{
|
||||||
const wchar_t *nameW = wmc->char2wchar(name, _nativeLangEncoding);
|
const wchar_t *nameW = wmc.char2wchar(name, _nativeLangEncoding);
|
||||||
windowTrans = nameW;
|
windowTrans = nameW;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -313,7 +313,7 @@ void NativeLangSpeaker::changeMenuLang(HMENU menuHandle, generic_string & plugin
|
|||||||
element->Attribute("id", &id);
|
element->Attribute("id", &id);
|
||||||
const char *name = element->Attribute("name");
|
const char *name = element->Attribute("name");
|
||||||
|
|
||||||
const wchar_t *nameW = wmc->char2wchar(name, _nativeLangEncoding);
|
const wchar_t *nameW = wmc.char2wchar(name, _nativeLangEncoding);
|
||||||
::ModifyMenu(menuHandle, id, MF_BYCOMMAND, id, nameW);
|
::ModifyMenu(menuHandle, id, MF_BYCOMMAND, id, nameW);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -358,7 +358,7 @@ void NativeLangSpeaker::changeMenuLang(HMENU menuHandle, generic_string & plugin
|
|||||||
pos = z;
|
pos = z;
|
||||||
}
|
}
|
||||||
|
|
||||||
const wchar_t *nameW = wmc->char2wchar(name, _nativeLangEncoding);
|
const wchar_t *nameW = wmc.char2wchar(name, _nativeLangEncoding);
|
||||||
::ModifyMenu(hMenu, pos, MF_BYPOSITION, 0, nameW);
|
::ModifyMenu(hMenu, pos, MF_BYPOSITION, 0, nameW);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -407,7 +407,7 @@ void NativeLangSpeaker::changeLangTabContextMenu(HMENU hCM)
|
|||||||
tabBarMenu = tabBarMenu->FirstChild("TabBar");
|
tabBarMenu = tabBarMenu->FirstChild("TabBar");
|
||||||
if (tabBarMenu)
|
if (tabBarMenu)
|
||||||
{
|
{
|
||||||
WcharMbcsConvertor* wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
int nbCMItems = sizeof(tabContextMenuItemPos)/sizeof(int);
|
int nbCMItems = sizeof(tabContextMenuItemPos)/sizeof(int);
|
||||||
|
|
||||||
for (TiXmlNodeA *childNode = tabBarMenu->FirstChildElement("Item");
|
for (TiXmlNodeA *childNode = tabBarMenu->FirstChildElement("Item");
|
||||||
@ -424,7 +424,7 @@ void NativeLangSpeaker::changeLangTabContextMenu(HMENU hCM)
|
|||||||
const char *pName = element->Attribute("name");
|
const char *pName = element->Attribute("name");
|
||||||
if (pName)
|
if (pName)
|
||||||
{
|
{
|
||||||
const wchar_t *pNameW = wmc->char2wchar(pName, _nativeLangEncoding);
|
const wchar_t *pNameW = wmc.char2wchar(pName, _nativeLangEncoding);
|
||||||
int cmdID = ::GetMenuItemID(hCM, pos);
|
int cmdID = ::GetMenuItemID(hCM, pos);
|
||||||
::ModifyMenu(hCM, pos, MF_BYPOSITION, cmdID, pNameW);
|
::ModifyMenu(hCM, pos, MF_BYPOSITION, cmdID, pNameW);
|
||||||
}
|
}
|
||||||
@ -464,16 +464,16 @@ void NativeLangSpeaker::changeLangTabDrapContextMenu(HMENU hCM)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
if (goToViewA && goToViewA[0])
|
if (goToViewA && goToViewA[0])
|
||||||
{
|
{
|
||||||
const wchar_t *goToViewG = wmc->char2wchar(goToViewA, _nativeLangEncoding);
|
const wchar_t *goToViewG = wmc.char2wchar(goToViewA, _nativeLangEncoding);
|
||||||
int cmdID = ::GetMenuItemID(hCM, POS_GO2VIEW);
|
int cmdID = ::GetMenuItemID(hCM, POS_GO2VIEW);
|
||||||
::ModifyMenu(hCM, POS_GO2VIEW, MF_BYPOSITION|MF_STRING, cmdID, goToViewG);
|
::ModifyMenu(hCM, POS_GO2VIEW, MF_BYPOSITION|MF_STRING, cmdID, goToViewG);
|
||||||
}
|
}
|
||||||
if (cloneToViewA && cloneToViewA[0])
|
if (cloneToViewA && cloneToViewA[0])
|
||||||
{
|
{
|
||||||
const wchar_t *cloneToViewG = wmc->char2wchar(cloneToViewA, _nativeLangEncoding);
|
const wchar_t *cloneToViewG = wmc.char2wchar(cloneToViewA, _nativeLangEncoding);
|
||||||
int cmdID = ::GetMenuItemID(hCM, POS_CLONE2VIEW);
|
int cmdID = ::GetMenuItemID(hCM, POS_CLONE2VIEW);
|
||||||
::ModifyMenu(hCM, POS_CLONE2VIEW, MF_BYPOSITION|MF_STRING, cmdID, cloneToViewG);
|
::ModifyMenu(hCM, POS_CLONE2VIEW, MF_BYPOSITION|MF_STRING, cmdID, cloneToViewG);
|
||||||
}
|
}
|
||||||
@ -493,14 +493,14 @@ void NativeLangSpeaker::changeConfigLang(HWND hDlg)
|
|||||||
styleConfDlgNode = styleConfDlgNode->FirstChild("StyleConfig");
|
styleConfDlgNode = styleConfDlgNode->FirstChild("StyleConfig");
|
||||||
if (!styleConfDlgNode) return;
|
if (!styleConfDlgNode) return;
|
||||||
|
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
|
|
||||||
// Set Title
|
// Set Title
|
||||||
const char *titre = (styleConfDlgNode->ToElement())->Attribute("title");
|
const char *titre = (styleConfDlgNode->ToElement())->Attribute("title");
|
||||||
|
|
||||||
if ((titre && titre[0]) && hDlg)
|
if ((titre && titre[0]) && hDlg)
|
||||||
{
|
{
|
||||||
const wchar_t *nameW = wmc->char2wchar(titre, _nativeLangEncoding);
|
const wchar_t *nameW = wmc.char2wchar(titre, _nativeLangEncoding);
|
||||||
::SetWindowText(hDlg, nameW);
|
::SetWindowText(hDlg, nameW);
|
||||||
}
|
}
|
||||||
for (TiXmlNodeA *childNode = styleConfDlgNode->FirstChildElement("Item");
|
for (TiXmlNodeA *childNode = styleConfDlgNode->FirstChildElement("Item");
|
||||||
@ -516,7 +516,7 @@ void NativeLangSpeaker::changeConfigLang(HWND hDlg)
|
|||||||
HWND hItem = ::GetDlgItem(hDlg, id);
|
HWND hItem = ::GetDlgItem(hDlg, id);
|
||||||
if (hItem)
|
if (hItem)
|
||||||
{
|
{
|
||||||
const wchar_t *nameW = wmc->char2wchar(name, _nativeLangEncoding);
|
const wchar_t *nameW = wmc.char2wchar(name, _nativeLangEncoding);
|
||||||
::SetWindowText(hItem, nameW);
|
::SetWindowText(hItem, nameW);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -536,7 +536,7 @@ void NativeLangSpeaker::changeConfigLang(HWND hDlg)
|
|||||||
HWND hItem = ::GetDlgItem(hDlg, id);
|
HWND hItem = ::GetDlgItem(hDlg, id);
|
||||||
if (hItem)
|
if (hItem)
|
||||||
{
|
{
|
||||||
const wchar_t *nameW = wmc->char2wchar(name, _nativeLangEncoding);
|
const wchar_t *nameW = wmc.char2wchar(name, _nativeLangEncoding);
|
||||||
::SetWindowText(hItem, nameW);
|
::SetWindowText(hItem, nameW);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -557,8 +557,8 @@ void NativeLangSpeaker::changeStyleCtrlsLang(HWND hDlg, int *idArray, const char
|
|||||||
hItem = ::GetDlgItem(hDlg, idArray[i]);
|
hItem = ::GetDlgItem(hDlg, idArray[i]);
|
||||||
if (hItem)
|
if (hItem)
|
||||||
{
|
{
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
const wchar_t *nameW = wmc->char2wchar(translatedText[i], _nativeLangEncoding);
|
const wchar_t *nameW = wmc.char2wchar(translatedText[i], _nativeLangEncoding);
|
||||||
::SetWindowText(hItem, nameW);
|
::SetWindowText(hItem, nameW);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -575,7 +575,7 @@ void NativeLangSpeaker::changeUserDefineLangPopupDlg(HWND hDlg)
|
|||||||
userDefineDlgNode = userDefineDlgNode->FirstChild("UserDefine");
|
userDefineDlgNode = userDefineDlgNode->FirstChild("UserDefine");
|
||||||
if (!userDefineDlgNode) return;
|
if (!userDefineDlgNode) return;
|
||||||
|
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
|
|
||||||
TiXmlNodeA *stylerDialogNode = userDefineDlgNode->FirstChild("StylerDialog");
|
TiXmlNodeA *stylerDialogNode = userDefineDlgNode->FirstChild("StylerDialog");
|
||||||
if (!stylerDialogNode) return;
|
if (!stylerDialogNode) return;
|
||||||
@ -583,7 +583,7 @@ void NativeLangSpeaker::changeUserDefineLangPopupDlg(HWND hDlg)
|
|||||||
const char *titre = (stylerDialogNode->ToElement())->Attribute("title");
|
const char *titre = (stylerDialogNode->ToElement())->Attribute("title");
|
||||||
if (titre &&titre[0])
|
if (titre &&titre[0])
|
||||||
{
|
{
|
||||||
const wchar_t *nameW = wmc->char2wchar(titre, _nativeLangEncoding);
|
const wchar_t *nameW = wmc.char2wchar(titre, _nativeLangEncoding);
|
||||||
::SetWindowText(hDlg, nameW);
|
::SetWindowText(hDlg, nameW);
|
||||||
}
|
}
|
||||||
for (TiXmlNodeA *childNode = stylerDialogNode->FirstChildElement("Item");
|
for (TiXmlNodeA *childNode = stylerDialogNode->FirstChildElement("Item");
|
||||||
@ -599,7 +599,7 @@ void NativeLangSpeaker::changeUserDefineLangPopupDlg(HWND hDlg)
|
|||||||
HWND hItem = ::GetDlgItem(hDlg, id);
|
HWND hItem = ::GetDlgItem(hDlg, id);
|
||||||
if (hItem)
|
if (hItem)
|
||||||
{
|
{
|
||||||
const wchar_t *nameW = wmc->char2wchar(name, _nativeLangEncoding);
|
const wchar_t *nameW = wmc.char2wchar(name, _nativeLangEncoding);
|
||||||
::SetWindowText(hItem, nameW);
|
::SetWindowText(hItem, nameW);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -619,13 +619,13 @@ void NativeLangSpeaker::changeUserDefineLang(UserDefineDialog *userDefineDlg)
|
|||||||
|
|
||||||
HWND hDlg = userDefineDlg->getHSelf();
|
HWND hDlg = userDefineDlg->getHSelf();
|
||||||
|
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
|
|
||||||
// Set Title
|
// Set Title
|
||||||
const char *titre = (userDefineDlgNode->ToElement())->Attribute("title");
|
const char *titre = (userDefineDlgNode->ToElement())->Attribute("title");
|
||||||
if (titre && titre[0])
|
if (titre && titre[0])
|
||||||
{
|
{
|
||||||
const wchar_t *nameW = wmc->char2wchar(titre, _nativeLangEncoding);
|
const wchar_t *nameW = wmc.char2wchar(titre, _nativeLangEncoding);
|
||||||
::SetWindowText(hDlg, nameW);
|
::SetWindowText(hDlg, nameW);
|
||||||
}
|
}
|
||||||
// for each control
|
// for each control
|
||||||
@ -650,7 +650,7 @@ void NativeLangSpeaker::changeUserDefineLang(UserDefineDialog *userDefineDlg)
|
|||||||
HWND hItem = ::GetDlgItem(hDlg, id);
|
HWND hItem = ::GetDlgItem(hDlg, id);
|
||||||
if (hItem)
|
if (hItem)
|
||||||
{
|
{
|
||||||
const wchar_t *nameW = wmc->char2wchar(name, _nativeLangEncoding);
|
const wchar_t *nameW = wmc.char2wchar(name, _nativeLangEncoding);
|
||||||
::SetWindowText(hItem, nameW);
|
::SetWindowText(hItem, nameW);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -684,7 +684,7 @@ void NativeLangSpeaker::changeUserDefineLang(UserDefineDialog *userDefineDlg)
|
|||||||
titre = (node->ToElement())->Attribute("title");
|
titre = (node->ToElement())->Attribute("title");
|
||||||
if (titre &&titre[0])
|
if (titre &&titre[0])
|
||||||
{
|
{
|
||||||
const wchar_t *nameW = wmc->char2wchar(titre, _nativeLangEncoding);
|
const wchar_t *nameW = wmc.char2wchar(titre, _nativeLangEncoding);
|
||||||
userDefineDlg->setTabName(i, nameW);
|
userDefineDlg->setTabName(i, nameW);
|
||||||
}
|
}
|
||||||
for (TiXmlNodeA *childNode = node->FirstChildElement("Item");
|
for (TiXmlNodeA *childNode = node->FirstChildElement("Item");
|
||||||
@ -700,7 +700,7 @@ void NativeLangSpeaker::changeUserDefineLang(UserDefineDialog *userDefineDlg)
|
|||||||
HWND hItem = ::GetDlgItem(hDlgArrary[i], id);
|
HWND hItem = ::GetDlgItem(hDlgArrary[i], id);
|
||||||
if (hItem)
|
if (hItem)
|
||||||
{
|
{
|
||||||
const wchar_t *nameW = wmc->char2wchar(name, _nativeLangEncoding);
|
const wchar_t *nameW = wmc.char2wchar(name, _nativeLangEncoding);
|
||||||
::SetWindowText(hItem, nameW);
|
::SetWindowText(hItem, nameW);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -725,29 +725,29 @@ void NativeLangSpeaker::changeFindReplaceDlgLang(FindReplaceDlg & findReplaceDlg
|
|||||||
const char *titre3 = (dlgNode->ToElement())->Attribute("titleFindInFiles");
|
const char *titre3 = (dlgNode->ToElement())->Attribute("titleFindInFiles");
|
||||||
const char *titre4 = (dlgNode->ToElement())->Attribute("titleMark");
|
const char *titre4 = (dlgNode->ToElement())->Attribute("titleMark");
|
||||||
|
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
|
|
||||||
if (titre1 && titre1[0])
|
if (titre1 && titre1[0])
|
||||||
{
|
{
|
||||||
basic_string<wchar_t> nameW = wmc->char2wchar(titre1, _nativeLangEncoding);
|
basic_string<wchar_t> nameW = wmc.char2wchar(titre1, _nativeLangEncoding);
|
||||||
pNppParam->getFindDlgTabTitiles()._find = nameW;
|
pNppParam->getFindDlgTabTitiles()._find = nameW;
|
||||||
findReplaceDlg.changeTabName(FIND_DLG, pNppParam->getFindDlgTabTitiles()._find.c_str());
|
findReplaceDlg.changeTabName(FIND_DLG, pNppParam->getFindDlgTabTitiles()._find.c_str());
|
||||||
}
|
}
|
||||||
if (titre2 && titre2[0])
|
if (titre2 && titre2[0])
|
||||||
{
|
{
|
||||||
basic_string<wchar_t> nameW = wmc->char2wchar(titre2, _nativeLangEncoding);
|
basic_string<wchar_t> nameW = wmc.char2wchar(titre2, _nativeLangEncoding);
|
||||||
pNppParam->getFindDlgTabTitiles()._replace = nameW;
|
pNppParam->getFindDlgTabTitiles()._replace = nameW;
|
||||||
findReplaceDlg.changeTabName(REPLACE_DLG, pNppParam->getFindDlgTabTitiles()._replace.c_str());
|
findReplaceDlg.changeTabName(REPLACE_DLG, pNppParam->getFindDlgTabTitiles()._replace.c_str());
|
||||||
}
|
}
|
||||||
if (titre3 && titre3[0])
|
if (titre3 && titre3[0])
|
||||||
{
|
{
|
||||||
basic_string<wchar_t> nameW = wmc->char2wchar(titre3, _nativeLangEncoding);
|
basic_string<wchar_t> nameW = wmc.char2wchar(titre3, _nativeLangEncoding);
|
||||||
pNppParam->getFindDlgTabTitiles()._findInFiles = nameW;
|
pNppParam->getFindDlgTabTitiles()._findInFiles = nameW;
|
||||||
findReplaceDlg.changeTabName(FINDINFILES_DLG, pNppParam->getFindDlgTabTitiles()._findInFiles.c_str());
|
findReplaceDlg.changeTabName(FINDINFILES_DLG, pNppParam->getFindDlgTabTitiles()._findInFiles.c_str());
|
||||||
}
|
}
|
||||||
if (titre4 && titre4[0])
|
if (titre4 && titre4[0])
|
||||||
{
|
{
|
||||||
basic_string<wchar_t> nameW = wmc->char2wchar(titre4, _nativeLangEncoding);
|
basic_string<wchar_t> nameW = wmc.char2wchar(titre4, _nativeLangEncoding);
|
||||||
pNppParam->getFindDlgTabTitiles()._mark = nameW;
|
pNppParam->getFindDlgTabTitiles()._mark = nameW;
|
||||||
findReplaceDlg.changeTabName(MARK_DLG, pNppParam->getFindDlgTabTitiles()._mark.c_str());
|
findReplaceDlg.changeTabName(MARK_DLG, pNppParam->getFindDlgTabTitiles()._mark.c_str());
|
||||||
}
|
}
|
||||||
@ -767,7 +767,7 @@ void NativeLangSpeaker::changePluginsAdminDlgLang(PluginsAdminDlg & pluginsAdmin
|
|||||||
dlgNode = searchDlgNode(dlgNode, "PluginsAdminDlg");
|
dlgNode = searchDlgNode(dlgNode, "PluginsAdminDlg");
|
||||||
if (dlgNode)
|
if (dlgNode)
|
||||||
{
|
{
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
|
|
||||||
TiXmlNodeA *ColumnPluginNode = dlgNode->FirstChild("ColumnPlugin");
|
TiXmlNodeA *ColumnPluginNode = dlgNode->FirstChild("ColumnPlugin");
|
||||||
if (ColumnPluginNode)
|
if (ColumnPluginNode)
|
||||||
@ -775,7 +775,7 @@ void NativeLangSpeaker::changePluginsAdminDlgLang(PluginsAdminDlg & pluginsAdmin
|
|||||||
const char *name = (ColumnPluginNode->ToElement())->Attribute("name");
|
const char *name = (ColumnPluginNode->ToElement())->Attribute("name");
|
||||||
if (name && name[0])
|
if (name && name[0])
|
||||||
{
|
{
|
||||||
basic_string<wchar_t> nameW = wmc->char2wchar(name, _nativeLangEncoding);
|
basic_string<wchar_t> nameW = wmc.char2wchar(name, _nativeLangEncoding);
|
||||||
pluginsAdminDlg.changeColumnName(COLUMN_PLUGIN, nameW.c_str());
|
pluginsAdminDlg.changeColumnName(COLUMN_PLUGIN, nameW.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -786,7 +786,7 @@ void NativeLangSpeaker::changePluginsAdminDlgLang(PluginsAdminDlg & pluginsAdmin
|
|||||||
const char *name = (ColumnVersionNode->ToElement())->Attribute("name");
|
const char *name = (ColumnVersionNode->ToElement())->Attribute("name");
|
||||||
if (name && name[0])
|
if (name && name[0])
|
||||||
{
|
{
|
||||||
basic_string<wchar_t> nameW = wmc->char2wchar(name, _nativeLangEncoding);
|
basic_string<wchar_t> nameW = wmc.char2wchar(name, _nativeLangEncoding);
|
||||||
pluginsAdminDlg.changeColumnName(COLUMN_VERSION, nameW.c_str());
|
pluginsAdminDlg.changeColumnName(COLUMN_VERSION, nameW.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -797,17 +797,17 @@ void NativeLangSpeaker::changePluginsAdminDlgLang(PluginsAdminDlg & pluginsAdmin
|
|||||||
|
|
||||||
if (titre1 && titre1[0])
|
if (titre1 && titre1[0])
|
||||||
{
|
{
|
||||||
basic_string<wchar_t> nameW = wmc->char2wchar(titre1, _nativeLangEncoding);
|
basic_string<wchar_t> nameW = wmc.char2wchar(titre1, _nativeLangEncoding);
|
||||||
pluginsAdminDlg.changeTabName(AVAILABLE_LIST, nameW.c_str());
|
pluginsAdminDlg.changeTabName(AVAILABLE_LIST, nameW.c_str());
|
||||||
}
|
}
|
||||||
if (titre2 && titre2[0])
|
if (titre2 && titre2[0])
|
||||||
{
|
{
|
||||||
basic_string<wchar_t> nameW = wmc->char2wchar(titre2, _nativeLangEncoding);
|
basic_string<wchar_t> nameW = wmc.char2wchar(titre2, _nativeLangEncoding);
|
||||||
pluginsAdminDlg.changeTabName(UPDATES_LIST, nameW.c_str());
|
pluginsAdminDlg.changeTabName(UPDATES_LIST, nameW.c_str());
|
||||||
}
|
}
|
||||||
if (titre3 && titre3[0])
|
if (titre3 && titre3[0])
|
||||||
{
|
{
|
||||||
basic_string<wchar_t> nameW = wmc->char2wchar(titre3, _nativeLangEncoding);
|
basic_string<wchar_t> nameW = wmc.char2wchar(titre3, _nativeLangEncoding);
|
||||||
pluginsAdminDlg.changeTabName(INSTALLED_LIST, nameW.c_str());
|
pluginsAdminDlg.changeTabName(INSTALLED_LIST, nameW.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -822,115 +822,115 @@ void NativeLangSpeaker::changePrefereceDlgLang(PreferenceDlg & preference)
|
|||||||
auto currentSel = preference.getListSelectedIndex();
|
auto currentSel = preference.getListSelectedIndex();
|
||||||
changeDlgLang(preference.getHSelf(), "Preference");
|
changeDlgLang(preference.getHSelf(), "Preference");
|
||||||
|
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
const size_t titreMaxSize = 128;
|
const size_t titreMaxSize = 128;
|
||||||
char titre[titreMaxSize];
|
char titre[titreMaxSize];
|
||||||
changeDlgLang(preference._barsDlg.getHSelf(), "Global", titre, titreMaxSize);
|
changeDlgLang(preference._barsDlg.getHSelf(), "Global", titre, titreMaxSize);
|
||||||
if (titre[0] != '\0')
|
if (titre[0] != '\0')
|
||||||
{
|
{
|
||||||
const wchar_t *nameW = wmc->char2wchar(titre, _nativeLangEncoding);
|
const wchar_t *nameW = wmc.char2wchar(titre, _nativeLangEncoding);
|
||||||
preference.renameDialogTitle(TEXT("Global"), nameW);
|
preference.renameDialogTitle(TEXT("Global"), nameW);
|
||||||
}
|
}
|
||||||
changeDlgLang(preference._marginsDlg.getHSelf(), "Scintillas", titre, titreMaxSize);
|
changeDlgLang(preference._marginsDlg.getHSelf(), "Scintillas", titre, titreMaxSize);
|
||||||
if (titre[0] != '\0')
|
if (titre[0] != '\0')
|
||||||
{
|
{
|
||||||
const wchar_t *nameW = wmc->char2wchar(titre, _nativeLangEncoding);
|
const wchar_t *nameW = wmc.char2wchar(titre, _nativeLangEncoding);
|
||||||
preference.renameDialogTitle(TEXT("Scintillas"), nameW);
|
preference.renameDialogTitle(TEXT("Scintillas"), nameW);
|
||||||
}
|
}
|
||||||
|
|
||||||
changeDlgLang(preference._defaultNewDocDlg.getHSelf(), "NewDoc", titre, titreMaxSize);
|
changeDlgLang(preference._defaultNewDocDlg.getHSelf(), "NewDoc", titre, titreMaxSize);
|
||||||
if (titre[0] != '\0')
|
if (titre[0] != '\0')
|
||||||
{
|
{
|
||||||
const wchar_t *nameW = wmc->char2wchar(titre, _nativeLangEncoding);
|
const wchar_t *nameW = wmc.char2wchar(titre, _nativeLangEncoding);
|
||||||
preference.renameDialogTitle(TEXT("NewDoc"), nameW);
|
preference.renameDialogTitle(TEXT("NewDoc"), nameW);
|
||||||
}
|
}
|
||||||
|
|
||||||
changeDlgLang(preference._defaultDirectoryDlg.getHSelf(), "DefaultDir", titre, titreMaxSize);
|
changeDlgLang(preference._defaultDirectoryDlg.getHSelf(), "DefaultDir", titre, titreMaxSize);
|
||||||
if (titre[0] != '\0')
|
if (titre[0] != '\0')
|
||||||
{
|
{
|
||||||
const wchar_t *nameW = wmc->char2wchar(titre, _nativeLangEncoding);
|
const wchar_t *nameW = wmc.char2wchar(titre, _nativeLangEncoding);
|
||||||
preference.renameDialogTitle(TEXT("DefaultDir"), nameW);
|
preference.renameDialogTitle(TEXT("DefaultDir"), nameW);
|
||||||
}
|
}
|
||||||
|
|
||||||
changeDlgLang(preference._recentFilesHistoryDlg.getHSelf(), "RecentFilesHistory", titre, titreMaxSize);
|
changeDlgLang(preference._recentFilesHistoryDlg.getHSelf(), "RecentFilesHistory", titre, titreMaxSize);
|
||||||
if (titre[0] != '\0')
|
if (titre[0] != '\0')
|
||||||
{
|
{
|
||||||
const wchar_t *nameW = wmc->char2wchar(titre, _nativeLangEncoding);
|
const wchar_t *nameW = wmc.char2wchar(titre, _nativeLangEncoding);
|
||||||
preference.renameDialogTitle(TEXT("RecentFilesHistory"), nameW);
|
preference.renameDialogTitle(TEXT("RecentFilesHistory"), nameW);
|
||||||
}
|
}
|
||||||
|
|
||||||
changeDlgLang(preference._fileAssocDlg.getHSelf(), "FileAssoc", titre, titreMaxSize);
|
changeDlgLang(preference._fileAssocDlg.getHSelf(), "FileAssoc", titre, titreMaxSize);
|
||||||
if (titre[0] != '\0')
|
if (titre[0] != '\0')
|
||||||
{
|
{
|
||||||
const wchar_t *nameW = wmc->char2wchar(titre, _nativeLangEncoding);
|
const wchar_t *nameW = wmc.char2wchar(titre, _nativeLangEncoding);
|
||||||
preference.renameDialogTitle(TEXT("FileAssoc"), nameW);
|
preference.renameDialogTitle(TEXT("FileAssoc"), nameW);
|
||||||
}
|
}
|
||||||
|
|
||||||
changeDlgLang(preference._langMenuDlg.getHSelf(), "Language", titre, titreMaxSize);
|
changeDlgLang(preference._langMenuDlg.getHSelf(), "Language", titre, titreMaxSize);
|
||||||
if (titre[0] != '\0')
|
if (titre[0] != '\0')
|
||||||
{
|
{
|
||||||
const wchar_t *nameW = wmc->char2wchar(titre, _nativeLangEncoding);
|
const wchar_t *nameW = wmc.char2wchar(titre, _nativeLangEncoding);
|
||||||
preference.renameDialogTitle(TEXT("Language"), nameW);
|
preference.renameDialogTitle(TEXT("Language"), nameW);
|
||||||
}
|
}
|
||||||
|
|
||||||
changeDlgLang(preference._highlighting.getHSelf(), "Highlighting", titre, titreMaxSize);
|
changeDlgLang(preference._highlighting.getHSelf(), "Highlighting", titre, titreMaxSize);
|
||||||
if (titre[0] != '\0')
|
if (titre[0] != '\0')
|
||||||
{
|
{
|
||||||
const wchar_t *nameW = wmc->char2wchar(titre, _nativeLangEncoding);
|
const wchar_t *nameW = wmc.char2wchar(titre, _nativeLangEncoding);
|
||||||
preference.renameDialogTitle(TEXT("Highlighting"), nameW);
|
preference.renameDialogTitle(TEXT("Highlighting"), nameW);
|
||||||
}
|
}
|
||||||
|
|
||||||
changeDlgLang(preference._printSettingsDlg.getHSelf(), "Print", titre, titreMaxSize);
|
changeDlgLang(preference._printSettingsDlg.getHSelf(), "Print", titre, titreMaxSize);
|
||||||
if (titre[0] != '\0')
|
if (titre[0] != '\0')
|
||||||
{
|
{
|
||||||
const wchar_t *nameW = wmc->char2wchar(titre, _nativeLangEncoding);
|
const wchar_t *nameW = wmc.char2wchar(titre, _nativeLangEncoding);
|
||||||
preference.renameDialogTitle(TEXT("Print"), nameW);
|
preference.renameDialogTitle(TEXT("Print"), nameW);
|
||||||
}
|
}
|
||||||
changeDlgLang(preference._settingsDlg.getHSelf(), "MISC", titre, titreMaxSize);
|
changeDlgLang(preference._settingsDlg.getHSelf(), "MISC", titre, titreMaxSize);
|
||||||
if (titre[0] != '\0')
|
if (titre[0] != '\0')
|
||||||
{
|
{
|
||||||
const wchar_t *nameW = wmc->char2wchar(titre, _nativeLangEncoding);
|
const wchar_t *nameW = wmc.char2wchar(titre, _nativeLangEncoding);
|
||||||
preference.renameDialogTitle(TEXT("MISC"), nameW);
|
preference.renameDialogTitle(TEXT("MISC"), nameW);
|
||||||
}
|
}
|
||||||
changeDlgLang(preference._backupDlg.getHSelf(), "Backup", titre, titreMaxSize);
|
changeDlgLang(preference._backupDlg.getHSelf(), "Backup", titre, titreMaxSize);
|
||||||
if (titre[0] != '\0')
|
if (titre[0] != '\0')
|
||||||
{
|
{
|
||||||
const wchar_t *nameW = wmc->char2wchar(titre, _nativeLangEncoding);
|
const wchar_t *nameW = wmc.char2wchar(titre, _nativeLangEncoding);
|
||||||
preference.renameDialogTitle(TEXT("Backup"), nameW);
|
preference.renameDialogTitle(TEXT("Backup"), nameW);
|
||||||
}
|
}
|
||||||
|
|
||||||
changeDlgLang(preference._autoCompletionDlg.getHSelf(), "AutoCompletion", titre, titreMaxSize);
|
changeDlgLang(preference._autoCompletionDlg.getHSelf(), "AutoCompletion", titre, titreMaxSize);
|
||||||
if (titre[0] != '\0')
|
if (titre[0] != '\0')
|
||||||
{
|
{
|
||||||
const wchar_t *nameW = wmc->char2wchar(titre, _nativeLangEncoding);
|
const wchar_t *nameW = wmc.char2wchar(titre, _nativeLangEncoding);
|
||||||
preference.renameDialogTitle(TEXT("AutoCompletion"), nameW);
|
preference.renameDialogTitle(TEXT("AutoCompletion"), nameW);
|
||||||
}
|
}
|
||||||
|
|
||||||
changeDlgLang(preference._multiInstDlg.getHSelf(), "MultiInstance", titre, titreMaxSize);
|
changeDlgLang(preference._multiInstDlg.getHSelf(), "MultiInstance", titre, titreMaxSize);
|
||||||
if (titre[0] != '\0')
|
if (titre[0] != '\0')
|
||||||
{
|
{
|
||||||
const wchar_t *nameW = wmc->char2wchar(titre, _nativeLangEncoding);
|
const wchar_t *nameW = wmc.char2wchar(titre, _nativeLangEncoding);
|
||||||
preference.renameDialogTitle(TEXT("MultiInstance"), nameW);
|
preference.renameDialogTitle(TEXT("MultiInstance"), nameW);
|
||||||
}
|
}
|
||||||
|
|
||||||
changeDlgLang(preference._delimiterSettingsDlg.getHSelf(), "Delimiter", titre, titreMaxSize);
|
changeDlgLang(preference._delimiterSettingsDlg.getHSelf(), "Delimiter", titre, titreMaxSize);
|
||||||
if (titre[0] != '\0')
|
if (titre[0] != '\0')
|
||||||
{
|
{
|
||||||
const wchar_t *nameW = wmc->char2wchar(titre, _nativeLangEncoding);
|
const wchar_t *nameW = wmc.char2wchar(titre, _nativeLangEncoding);
|
||||||
preference.renameDialogTitle(TEXT("Delimiter"), nameW);
|
preference.renameDialogTitle(TEXT("Delimiter"), nameW);
|
||||||
}
|
}
|
||||||
|
|
||||||
changeDlgLang(preference._settingsOnCloudDlg.getHSelf(), "Cloud", titre, titreMaxSize);
|
changeDlgLang(preference._settingsOnCloudDlg.getHSelf(), "Cloud", titre, titreMaxSize);
|
||||||
if (titre[0] != '\0')
|
if (titre[0] != '\0')
|
||||||
{
|
{
|
||||||
const wchar_t *nameW = wmc->char2wchar(titre, _nativeLangEncoding);
|
const wchar_t *nameW = wmc.char2wchar(titre, _nativeLangEncoding);
|
||||||
preference.renameDialogTitle(TEXT("Cloud"), nameW);
|
preference.renameDialogTitle(TEXT("Cloud"), nameW);
|
||||||
}
|
}
|
||||||
|
|
||||||
changeDlgLang(preference._searchEngineDlg.getHSelf(), "SearchEngine", titre, titreMaxSize);
|
changeDlgLang(preference._searchEngineDlg.getHSelf(), "SearchEngine", titre, titreMaxSize);
|
||||||
if (titre[0] != '\0')
|
if (titre[0] != '\0')
|
||||||
{
|
{
|
||||||
const wchar_t *nameW = wmc->char2wchar(titre, _nativeLangEncoding);
|
const wchar_t *nameW = wmc.char2wchar(titre, _nativeLangEncoding);
|
||||||
preference.renameDialogTitle(TEXT("SearchEngine"), nameW);
|
preference.renameDialogTitle(TEXT("SearchEngine"), nameW);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -968,8 +968,8 @@ void NativeLangSpeaker::changeShortcutLang()
|
|||||||
CommandShortcut & csc = mainshortcuts[index];
|
CommandShortcut & csc = mainshortcuts[index];
|
||||||
if (csc.getID() == (unsigned long)id)
|
if (csc.getID() == (unsigned long)id)
|
||||||
{
|
{
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
const wchar_t * nameW = wmc->char2wchar(name, _nativeLangEncoding);
|
const wchar_t * nameW = wmc.char2wchar(name, _nativeLangEncoding);
|
||||||
csc.setName(nameW);
|
csc.setName(nameW);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -999,8 +999,8 @@ void NativeLangSpeaker::changeShortcutLang()
|
|||||||
const char *name = element->Attribute("name");
|
const char *name = element->Attribute("name");
|
||||||
ScintillaKeyMap & skm = scinshortcuts[index];
|
ScintillaKeyMap & skm = scinshortcuts[index];
|
||||||
|
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
const wchar_t * nameW = wmc->char2wchar(name, _nativeLangEncoding);
|
const wchar_t * nameW = wmc.char2wchar(name, _nativeLangEncoding);
|
||||||
skm.setName(nameW);
|
skm.setName(nameW);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1024,8 +1024,8 @@ generic_string NativeLangSpeaker::getShortcutMapperLangStr(const char *nodeName,
|
|||||||
const char *name = (targetNode->ToElement())->Attribute("name");
|
const char *name = (targetNode->ToElement())->Attribute("name");
|
||||||
if (name && name[0])
|
if (name && name[0])
|
||||||
{
|
{
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
return wmc->char2wchar(name, _nativeLangEncoding);
|
return wmc.char2wchar(name, _nativeLangEncoding);
|
||||||
}
|
}
|
||||||
|
|
||||||
return defaultStr;
|
return defaultStr;
|
||||||
@ -1059,13 +1059,13 @@ bool NativeLangSpeaker::changeDlgLang(HWND hDlg, const char *dlgTagName, char *t
|
|||||||
dlgNode = searchDlgNode(dlgNode, dlgTagName);
|
dlgNode = searchDlgNode(dlgNode, dlgTagName);
|
||||||
if (!dlgNode) return false;
|
if (!dlgNode) return false;
|
||||||
|
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
|
|
||||||
// Set Title
|
// Set Title
|
||||||
const char *title2set = (dlgNode->ToElement())->Attribute("title");
|
const char *title2set = (dlgNode->ToElement())->Attribute("title");
|
||||||
if ((title2set && title2set[0]) && hDlg)
|
if ((title2set && title2set[0]) && hDlg)
|
||||||
{
|
{
|
||||||
const wchar_t *nameW = wmc->char2wchar(title2set, _nativeLangEncoding);
|
const wchar_t *nameW = wmc.char2wchar(title2set, _nativeLangEncoding);
|
||||||
::SetWindowText(hDlg, nameW);
|
::SetWindowText(hDlg, nameW);
|
||||||
|
|
||||||
if (title && titleMaxSize)
|
if (title && titleMaxSize)
|
||||||
@ -1086,7 +1086,7 @@ bool NativeLangSpeaker::changeDlgLang(HWND hDlg, const char *dlgTagName, char *t
|
|||||||
HWND hItem = ::GetDlgItem(hDlg, id);
|
HWND hItem = ::GetDlgItem(hDlg, id);
|
||||||
if (hItem)
|
if (hItem)
|
||||||
{
|
{
|
||||||
const wchar_t *nameW = wmc->char2wchar(name, _nativeLangEncoding);
|
const wchar_t *nameW = wmc.char2wchar(name, _nativeLangEncoding);
|
||||||
::SetWindowText(hItem, nameW);
|
::SetWindowText(hItem, nameW);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1111,7 +1111,7 @@ bool NativeLangSpeaker::changeDlgLang(HWND hDlg, const char *dlgTagName, char *t
|
|||||||
{
|
{
|
||||||
TiXmlElementA *comBoelement = gChildNode->ToElement();
|
TiXmlElementA *comBoelement = gChildNode->ToElement();
|
||||||
const char *name = comBoelement->Attribute("name");
|
const char *name = comBoelement->Attribute("name");
|
||||||
const wchar_t *nameW = wmc->char2wchar(name, _nativeLangEncoding);
|
const wchar_t *nameW = wmc.char2wchar(name, _nativeLangEncoding);
|
||||||
comboElms.push_back(nameW);
|
comboElms.push_back(nameW);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1151,15 +1151,15 @@ bool NativeLangSpeaker::getMsgBoxLang(const char *msgBoxTagName, generic_string
|
|||||||
msgBoxNode = searchDlgNode(msgBoxNode, msgBoxTagName);
|
msgBoxNode = searchDlgNode(msgBoxNode, msgBoxTagName);
|
||||||
if (!msgBoxNode) return false;
|
if (!msgBoxNode) return false;
|
||||||
|
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
|
|
||||||
// Set Title
|
// Set Title
|
||||||
const char *titre = (msgBoxNode->ToElement())->Attribute("title");
|
const char *titre = (msgBoxNode->ToElement())->Attribute("title");
|
||||||
const char *msg = (msgBoxNode->ToElement())->Attribute("message");
|
const char *msg = (msgBoxNode->ToElement())->Attribute("message");
|
||||||
if ((titre && titre[0]) && (msg && msg[0]))
|
if ((titre && titre[0]) && (msg && msg[0]))
|
||||||
{
|
{
|
||||||
title = wmc->char2wchar(titre, _nativeLangEncoding);
|
title = wmc.char2wchar(titre, _nativeLangEncoding);
|
||||||
message = wmc->char2wchar(msg, _nativeLangEncoding);
|
message = wmc.char2wchar(msg, _nativeLangEncoding);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -1193,8 +1193,8 @@ generic_string NativeLangSpeaker::getFileBrowserLangMenuStr(int cmdID, const TCH
|
|||||||
|
|
||||||
if (name && name[0])
|
if (name && name[0])
|
||||||
{
|
{
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
return wmc->char2wchar(name, _nativeLangEncoding);
|
return wmc.char2wchar(name, _nativeLangEncoding);
|
||||||
}
|
}
|
||||||
return defaultStr;
|
return defaultStr;
|
||||||
}
|
}
|
||||||
@ -1230,8 +1230,8 @@ generic_string NativeLangSpeaker::getProjectPanelLangMenuStr(const char * nodeNa
|
|||||||
|
|
||||||
if (name && name[0])
|
if (name && name[0])
|
||||||
{
|
{
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
return wmc->char2wchar(name, _nativeLangEncoding);
|
return wmc.char2wchar(name, _nativeLangEncoding);
|
||||||
}
|
}
|
||||||
return defaultStr;
|
return defaultStr;
|
||||||
}
|
}
|
||||||
@ -1250,8 +1250,8 @@ generic_string NativeLangSpeaker::getAttrNameStr(const TCHAR *defaultStr, const
|
|||||||
const char *name = (targetNode->ToElement())->Attribute("name");
|
const char *name = (targetNode->ToElement())->Attribute("name");
|
||||||
if (name && name[0])
|
if (name && name[0])
|
||||||
{
|
{
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||||
return wmc->char2wchar(name, _nativeLangEncoding);
|
return wmc.char2wchar(name, _nativeLangEncoding);
|
||||||
}
|
}
|
||||||
return defaultStr;
|
return defaultStr;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user