Use wchar_t instead of TCHAR

For making Unicode application status more explicit.

Close #15459
This commit is contained in:
Don Ho 2024-07-18 23:43:17 +02:00
parent a427ace34c
commit d13c9bb943
66 changed files with 416 additions and 436 deletions

View File

@ -149,7 +149,7 @@ bool SecurityGuard::verifySignedLibrary(const std::wstring& filepath)
DWORD netstatus;
QOCINFO oci;
oci.dwSize = sizeof(oci);
CONST TCHAR* msftTEXTest_site = L"http://www.msftncsi.com/ncsi.txt";
CONST wchar_t* msftTEXTest_site = L"http://www.msftncsi.com/ncsi.txt";
bool online = false;
online = (0 != IsNetworkAlive(&netstatus));
online = online && (0 == GetLastError());
@ -248,7 +248,7 @@ bool SecurityGuard::verifySignedLibrary(const std::wstring& filepath)
throw string("Getting x509 field size problem.");
}
std::unique_ptr<TCHAR[]> subject_buffer(new TCHAR[subject_sze]);
std::unique_ptr<wchar_t[]> subject_buffer(new wchar_t[subject_sze]);
if (::CertNameToStr(X509_ASN_ENCODING, &context->pCertInfo->Subject, CERT_X500_NAME_STR, subject_buffer.get(), subject_sze) <= 1)
{
throw string("Failed to get x509 filed infos from certificate.");
@ -271,7 +271,7 @@ bool SecurityGuard::verifySignedLibrary(const std::wstring& filepath)
wstringstream ss;
for (unsigned i = 0; i < key_id_sze; i++)
{
ss << std::uppercase << std::setfill(TCHAR('0')) << std::setw(2) << std::hex
ss << std::uppercase << std::setfill(wchar_t('0')) << std::setw(2) << std::hex
<< key_id_buff[i];
}
key_id_hex = ss.str();
@ -287,7 +287,7 @@ bool SecurityGuard::verifySignedLibrary(const std::wstring& filepath)
}
// Get display name.
std::unique_ptr<TCHAR[]> display_name_buffer(new TCHAR[sze]);
std::unique_ptr<wchar_t[]> display_name_buffer(new wchar_t[sze]);
if (::CertGetNameString(context, CERT_NAME_SIMPLE_DISPLAY_TYPE, 0, NULL, display_name_buffer.get(), sze) <= 1)
{
throw string("Cannot get certificate info." + ws2s(GetLastErrorAsString(GetLastError())));

View File

@ -29,8 +29,8 @@ MiniDumper::MiniDumper()
bool MiniDumper::writeDump(EXCEPTION_POINTERS * pExceptionInfo)
{
TCHAR szDumpPath[MAX_PATH];
TCHAR szScratch[MAX_PATH];
wchar_t szDumpPath[MAX_PATH];
wchar_t szScratch[MAX_PATH];
LPCTSTR szResult = NULL;
bool retval = false;

View File

@ -21,17 +21,17 @@ typedef std::vector<generic_string> stringVector;
class FileNameStringSplitter
{
public:
FileNameStringSplitter(const TCHAR *fileNameStr)
FileNameStringSplitter(const wchar_t *fileNameStr)
{
TCHAR *pStr = NULL;
wchar_t *pStr = NULL;
bool isInsideQuotes = false;
const int filePathLength = MAX_PATH;
TCHAR str[filePathLength];
wchar_t str[filePathLength];
int i = 0;
bool fini = false;
for (pStr = (TCHAR *)fileNameStr ; !fini ; )
for (pStr = (wchar_t *)fileNameStr ; !fini ; )
{
if (i >= filePathLength)
break;
@ -93,7 +93,7 @@ public:
return _fileNames;
};
const TCHAR * getFileName(size_t index) const {
const wchar_t * getFileName(size_t index) const {
if (index >= _fileNames.size())
return NULL;
return _fileNames[index].c_str();

View File

@ -25,7 +25,7 @@
#include "Notepad_plus_msgs.h"
typedef const TCHAR * (__cdecl * PFUNCGETNAME)();
typedef const wchar_t * (__cdecl * PFUNCGETNAME)();
struct NppData
{
@ -52,7 +52,7 @@ const int menuItemSize = 64;
struct FuncItem
{
TCHAR _itemName[menuItemSize] = { '\0' };
wchar_t _itemName[menuItemSize] = { '\0' };
PFUNCPLUGINCMD _pFunc = nullptr;
int _cmdID = 0;
bool _init2Check = false;
@ -63,7 +63,7 @@ typedef FuncItem * (__cdecl * PFUNCGETFUNCSARRAY)(int *);
// You should implement (or define an empty function body) those functions which are called by Notepad++ plugin manager
extern "C" __declspec(dllexport) void setInfo(NppData);
extern "C" __declspec(dllexport) const TCHAR * getName();
extern "C" __declspec(dllexport) const wchar_t * getName();
extern "C" __declspec(dllexport) FuncItem * getFuncsArray(int *);
extern "C" __declspec(dllexport) void beNotified(SCNotification *);
extern "C" __declspec(dllexport) LRESULT messageProc(UINT Message, WPARAM wParam, LPARAM lParam);

View File

@ -21,7 +21,7 @@
void Process::run(bool isElevationRequired) const
{
const TCHAR *opVerb = isElevationRequired ? L"runas" : L"open";
const wchar_t *opVerb = isElevationRequired ? L"runas" : L"open";
::ShellExecute(NULL, opVerb, _command.c_str(), _args.c_str(), _curDir.c_str(), SW_SHOWNORMAL);
}

View File

@ -20,16 +20,16 @@
const TCHAR* nppName = L"Notepad++_file";
const TCHAR* nppBackup = L"Notepad++_backup";
const TCHAR* nppDoc = L"Notepad++ Document";
const wchar_t* nppName = L"Notepad++_file";
const wchar_t* nppBackup = L"Notepad++_backup";
const wchar_t* nppDoc = L"Notepad++ Document";
const int nbSupportedLang = 10;
const int nbExtMax = 28;
const int extNameMax = 18;
const TCHAR defExtArray[nbSupportedLang][nbExtMax][extNameMax] =
const wchar_t defExtArray[nbSupportedLang][nbExtMax][extNameMax] =
{
{L"Notepad",
L".txt", L".log"
@ -171,7 +171,7 @@ intptr_t CALLBACK RegExtDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPa
{
writeNppPath();
TCHAR ext2Add[extNameMax] = L"";
wchar_t ext2Add[extNameMax] = L"";
if (!_isCustomize)
{
auto index2Add = ::SendDlgItemMessage(_hSelf, IDC_REGEXT_LANGEXT_LIST, LB_GETCURSEL, 0, 0);
@ -199,7 +199,7 @@ intptr_t CALLBACK RegExtDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPa
case IDC_REMOVEEXT_BUTTON :
{
TCHAR ext2Sup[extNameMax] = L"";
wchar_t ext2Sup[extNameMax] = L"";
auto index2Sup = ::SendDlgItemMessage(_hSelf, IDC_REGEXT_REGISTEREDEXTS_LIST, LB_GETCURSEL, 0, 0);
auto lbTextLen = ::SendDlgItemMessage(_hSelf, IDC_REGEXT_REGISTEREDEXTS_LIST, LB_GETTEXTLEN, index2Sup, 0);
if (lbTextLen > extNameMax - 1)
@ -235,7 +235,7 @@ intptr_t CALLBACK RegExtDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPa
if (HIWORD(wParam) == EN_CHANGE)
{
TCHAR text[extNameMax] = L"";
wchar_t text[extNameMax] = L"";
::SendDlgItemMessage(_hSelf, IDC_CUSTOMEXT_EDIT, WM_GETTEXT, extNameMax, reinterpret_cast<LPARAM>(text));
if ((lstrlen(text) == 1) && (text[0] != '.'))
{
@ -257,7 +257,7 @@ intptr_t CALLBACK RegExtDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPa
if (i != LB_ERR)
{
const size_t itemNameLen = 32;
TCHAR itemName[itemNameLen + 1] = { '\0' };
wchar_t itemName[itemNameLen + 1] = { '\0' };
size_t lbTextLen = ::SendDlgItemMessage(_hSelf, LOWORD(wParam), LB_GETTEXTLEN, i, 0);
if (lbTextLen > itemNameLen)
return TRUE;
@ -324,15 +324,15 @@ void RegExtDlg::getRegisteredExts()
int nbRegisteredKey = getNbSubKey(HKEY_CLASSES_ROOT);
for (int i = 0 ; i < nbRegisteredKey ; ++i)
{
TCHAR extName[extNameLen]{};
wchar_t extName[extNameLen]{};
//FILETIME fileTime;
int extNameActualLen = extNameLen;
int res = ::RegEnumKeyEx(HKEY_CLASSES_ROOT, i, extName, reinterpret_cast<LPDWORD>(&extNameActualLen), nullptr, nullptr, nullptr, nullptr);
if ((res == ERROR_SUCCESS) && (extName[0] == '.'))
{
//TCHAR valName[extNameLen];
TCHAR valData[extNameLen] = { '\0' };
DWORD valDataLen = extNameLen * sizeof(TCHAR);
//wchar_t valName[extNameLen];
wchar_t valData[extNameLen] = { '\0' };
DWORD valDataLen = extNameLen * sizeof(wchar_t);
DWORD valType = 0;
HKEY hKey2Check;
extNameActualLen = extNameLen;
@ -354,7 +354,7 @@ void RegExtDlg::getDefSupportedExts()
}
void RegExtDlg::addExt(TCHAR *ext)
void RegExtDlg::addExt(wchar_t *ext)
{
HKEY hKey;
DWORD dwDisp = 0;
@ -364,8 +364,8 @@ void RegExtDlg::addExt(TCHAR *ext)
if (nRet == ERROR_SUCCESS)
{
TCHAR valData[MAX_PATH] = { '\0' };
DWORD valDataLen = MAX_PATH * sizeof(TCHAR);
wchar_t valData[MAX_PATH] = { '\0' };
DWORD valDataLen = MAX_PATH * sizeof(wchar_t);
if (dwDisp == REG_OPENED_EXISTING_KEY)
{
@ -373,14 +373,14 @@ void RegExtDlg::addExt(TCHAR *ext)
if (res == ERROR_SUCCESS)
::RegSetValueEx(hKey, nppBackup, 0, REG_SZ, reinterpret_cast<LPBYTE>(valData), valDataLen);
}
::RegSetValueEx(hKey, nullptr, 0, REG_SZ, reinterpret_cast<const BYTE *>(nppName), static_cast<DWORD>((lstrlen(nppName) + 1) * sizeof(TCHAR)));
::RegSetValueEx(hKey, nullptr, 0, REG_SZ, reinterpret_cast<const BYTE *>(nppName), static_cast<DWORD>((lstrlen(nppName) + 1) * sizeof(wchar_t)));
::RegCloseKey(hKey);
}
}
bool RegExtDlg::deleteExts(const TCHAR *ext2Delete)
bool RegExtDlg::deleteExts(const wchar_t *ext2Delete)
{
HKEY hKey;
::RegOpenKeyEx(HKEY_CLASSES_ROOT, ext2Delete, 0, KEY_ALL_ACCESS, &hKey);
@ -390,14 +390,14 @@ bool RegExtDlg::deleteExts(const TCHAR *ext2Delete)
if ((nbValue <= 1) && (!nbSubkey))
{
TCHAR subKey[32] = L"\\";
wchar_t subKey[32] = L"\\";
wcscat_s(subKey, ext2Delete);
::RegDeleteKey(HKEY_CLASSES_ROOT, subKey);
}
else
{
TCHAR valData[extNameLen] = { '\0' };
DWORD valDataLen = extNameLen*sizeof(TCHAR);
wchar_t valData[extNameLen] = { '\0' };
DWORD valDataLen = extNameLen*sizeof(wchar_t);
DWORD valType = 0;
int res = ::RegQueryValueEx(hKey, nppBackup, nullptr, &valType, (LPBYTE)valData, &valDataLen);
@ -431,17 +431,17 @@ void RegExtDlg::writeNppPath()
{
// Write the value for new document
::RegOpenKeyEx(HKEY_CLASSES_ROOT, nppName, 0, KEY_ALL_ACCESS, &hRootKey);
::RegSetValueEx(hRootKey, nullptr, 0, REG_SZ, (LPBYTE)nppDoc, static_cast<DWORD>((lstrlen(nppDoc) + 1) * sizeof(TCHAR)));
::RegSetValueEx(hRootKey, nullptr, 0, REG_SZ, (LPBYTE)nppDoc, static_cast<DWORD>((lstrlen(nppDoc) + 1) * sizeof(wchar_t)));
RegCloseKey(hRootKey);
TCHAR nppPath[MAX_PATH] = { '\0' };
wchar_t nppPath[MAX_PATH] = { '\0' };
::GetModuleFileName(_hInst, nppPath, MAX_PATH);
TCHAR nppPathParam[MAX_PATH] = L"\"";
wchar_t nppPathParam[MAX_PATH] = L"\"";
wcscat_s(nppPathParam, nppPath);
wcscat_s(nppPathParam, L"\" \"%1\"");
::RegSetValueEx(hKey, nullptr, 0, REG_SZ, (LPBYTE)nppPathParam, static_cast<DWORD>((lstrlen(nppPathParam) + 1) * sizeof(TCHAR)));
::RegSetValueEx(hKey, nullptr, 0, REG_SZ, (LPBYTE)nppPathParam, static_cast<DWORD>((lstrlen(nppPathParam) + 1) * sizeof(wchar_t)));
}
RegCloseKey(hKey);
}
@ -455,14 +455,14 @@ void RegExtDlg::writeNppPath()
{
//if (dwDisp == REG_CREATED_NEW_KEY)
{
TCHAR nppPath[MAX_PATH] = { '\0' };
wchar_t nppPath[MAX_PATH] = { '\0' };
::GetModuleFileName(_hInst, nppPath, MAX_PATH);
TCHAR nppPathParam[MAX_PATH] = L"\"";
wchar_t nppPathParam[MAX_PATH] = L"\"";
wcscat_s(nppPathParam, nppPath);
wcscat_s(nppPathParam, L"\",0");
::RegSetValueEx(hKey, nullptr, 0, REG_SZ, (LPBYTE)nppPathParam, static_cast<DWORD>((lstrlen(nppPathParam) + 1) * sizeof(TCHAR)));
::RegSetValueEx(hKey, nullptr, 0, REG_SZ, (LPBYTE)nppPathParam, static_cast<DWORD>((lstrlen(nppPathParam) + 1) * sizeof(wchar_t)));
}
RegCloseKey(hKey);
}

View File

@ -37,8 +37,8 @@ private :
void getRegisteredExts();
void getDefSupportedExts();
void addExt(TCHAR *ext);
bool deleteExts(const TCHAR *ext2Delete);
void addExt(wchar_t *ext);
bool deleteExts(const wchar_t *ext2Delete);
void writeNppPath();
int getNbSubKey(HKEY hKey) const {

View File

@ -145,7 +145,7 @@ bool CSHA1::HashFile(const wchar_t* tszFileName)
{
if(tszFileName == NULL) return false;
FILE* fpIn = _tfopen(tszFileName, L"rb");
FILE* fpIn = _wfopen(tszFileName, L"rb");
if(fpIn == NULL) return false;
UINT_8* pbData = new UINT_8[SHA1_MAX_FILE_BUFFER];
@ -211,25 +211,25 @@ bool CSHA1::ReportHash(wchar_t* tszReport, REPORT_TYPE rtReportType) const
if((rtReportType == REPORT_HEX) || (rtReportType == REPORT_HEX_SHORT))
{
_sntprintf(tszTemp, 15, L"%02X", m_digest[0]);
_tcscpy(tszReport, tszTemp);
_snwprintf(tszTemp, 15, L"%02X", m_digest[0]);
wcscpy(tszReport, tszTemp);
const wchar_t* lpFmt = ((rtReportType == REPORT_HEX) ? L" %02X" : L"%02X");
for(size_t i = 1; i < 20; ++i)
{
_sntprintf(tszTemp, 15, lpFmt, m_digest[i]);
_tcscat(tszReport, tszTemp);
_snwprintf(tszTemp, 15, lpFmt, m_digest[i]);
wcscat(tszReport, tszTemp);
}
}
else if(rtReportType == REPORT_DIGIT)
{
_sntprintf(tszTemp, 15, L"%u", m_digest[0]);
_tcscpy(tszReport, tszTemp);
_snwprintf(tszTemp, 15, L"%u", m_digest[0]);
wcscpy(tszReport, tszTemp);
for(size_t i = 1; i < 20; ++i)
{
_sntprintf(tszTemp, 15, L" %u", m_digest[i]);
_tcscat(tszReport, tszTemp);
_snwprintf(tszTemp, 15, L" %u", m_digest[i]);
wcscat(tszReport, tszTemp);
}
}
else return false;

View File

@ -146,26 +146,6 @@
#define SHA1_WIPE_VARIABLES
#endif
#if defined(SHA1_HAS_TCHAR)
#include <tchar.h>
#else
#ifdef _MSC_VER
#include <tchar.h>
#else
#ifndef TCHAR
#define TCHAR wchar_t
#endif
#define _tmain wmain
#define _tprintf wprintf
#define _getts getws
#define _tcslen wcslen
#define _tfopen _wfopen
#define _tcscpy wcscpy
#define _tcscat wcscat
#define _sntprintf snwprintf
#endif
#endif
///////////////////////////////////////////////////////////////////////////
// Define variable types

View File

@ -76,7 +76,7 @@ void DocTabView::addBuffer(BufferID buffer)
if (_hasImgLst)
index = 0;
tie.iImage = index;
tie.pszText = const_cast<TCHAR *>(buf->getFileName());
tie.pszText = const_cast<wchar_t *>(buf->getFileName());
tie.lParam = reinterpret_cast<LPARAM>(buffer);
::SendMessage(_hSelf, TCM_INSERTITEM, _nbItem++, reinterpret_cast<LPARAM>(&tie));
bufferUpdated(buf, BufferChangeMask);
@ -120,7 +120,7 @@ BufferID DocTabView::activeBuffer()
}
BufferID DocTabView::findBufferByName(const TCHAR * fullfilename) //-1 if not found, something else otherwise
BufferID DocTabView::findBufferByName(const wchar_t * fullfilename) //-1 if not found, something else otherwise
{
TCITEM tie{};
tie.lParam = -1;
@ -190,7 +190,7 @@ void DocTabView::bufferUpdated(Buffer * buffer, int mask)
}
//We must make space for the added ampersand characters.
TCHAR encodedLabel[2 * MAX_PATH] = { '\0' };
wchar_t encodedLabel[2 * MAX_PATH] = { '\0' };
if (mask & BufferChangeFilename)
{
@ -198,8 +198,8 @@ void DocTabView::bufferUpdated(Buffer * buffer, int mask)
tie.pszText = encodedLabel;
{
const TCHAR* in = buffer->getFileName();
TCHAR* out = encodedLabel;
const wchar_t* in = buffer->getFileName();
wchar_t* out = encodedLabel;
//This code will read in one character at a time and duplicate every first ampersand(&).
//ex. If input is "test & test && test &&&" then output will be "test && test &&& test &&&&".

View File

@ -53,7 +53,7 @@ public :
bool activateBuffer(BufferID buffer);
BufferID activeBuffer();
BufferID findBufferByName(const TCHAR * fullfilename); //-1 if not found, something else otherwise
BufferID findBufferByName(const wchar_t * fullfilename); //-1 if not found, something else otherwise
int getIndexByBuffer(BufferID id);
BufferID getBufferByIndex(size_t index);

View File

@ -19,10 +19,10 @@
struct Token {
TCHAR * token;
wchar_t * token;
int length;
bool isIdentifier;
Token(TCHAR * tok, int len, bool isID) : token(tok), length(len), isIdentifier(isID) {};
Token(wchar_t * tok, int len, bool isID) : token(tok), length(len), isIdentifier(isID) {};
};
struct FunctionValues {
@ -33,11 +33,11 @@ struct FunctionValues {
FunctionValues() : lastIdentifier(-1), lastFunctionIdentifier(-1), param(0), scopeLevel(-1) {};
};
inline bool lower(TCHAR c) {
inline bool lower(wchar_t c) {
return (c >= 'a' && c <= 'z');
}
inline bool match(TCHAR c1, TCHAR c2) {
inline bool match(wchar_t c1, wchar_t c2) {
if (c1 == c2) return true;
if (lower(c1))
return ((c1-32) == c2);
@ -48,7 +48,7 @@ inline bool match(TCHAR c1, TCHAR c2) {
//test string case insensitive ala Scintilla
//0 if equal, <0 of before, >0 if after (name1 that is)
int testNameNoCase(const TCHAR * name1, const TCHAR * name2, int len = -1)
int testNameNoCase(const wchar_t * name1, const wchar_t * name2, int len = -1)
{
if (len == -1)
{
@ -145,7 +145,7 @@ bool FunctionCallTip::getCursorFunction()
return false; //cannot be a func, need name and separator
}
TCHAR lineData[maxLen] = L"";
wchar_t lineData[maxLen] = L"";
_pEditView->getLine(line, lineData, len);
@ -154,7 +154,7 @@ bool FunctionCallTip::getCursorFunction()
//token is identifier or some expression, whitespace is ignored
std::vector< Token > tokenVector;
int tokenLen = 0;
TCHAR ch;
wchar_t ch;
for (int i = 0; i < offset; ++i) //we dont care about stuff after the offset
{
//tokenVector.push_back(pair(lineData+i, len));
@ -162,7 +162,7 @@ bool FunctionCallTip::getCursorFunction()
if (isBasicWordChar(ch) || isAdditionalWordChar(ch)) //part of identifier
{
tokenLen = 0;
TCHAR * begin = lineData+i;
wchar_t * begin = lineData+i;
while ((isBasicWordChar(ch) || isAdditionalWordChar(ch)) && i < offset)
{
++tokenLen;
@ -275,7 +275,7 @@ bool FunctionCallTip::getCursorFunction()
{ //check if we need to reload data
delete [] _funcName;
_funcName = new TCHAR[funcToken.length+1];
_funcName = new wchar_t[funcToken.length+1];
wcscpy_s(_funcName, funcToken.length+1, funcToken.token);
res = loadFunction();
}
@ -300,7 +300,7 @@ bool FunctionCallTip::loadFunction()
for (; funcNode; funcNode = funcNode->NextSiblingElement(L"KeyWord"))
{
const TCHAR * name = NULL;
const wchar_t * name = NULL;
name = funcNode->Attribute(L"name");
if (!name) //malformed node
continue;
@ -311,7 +311,7 @@ bool FunctionCallTip::loadFunction()
compVal = lstrcmp(name, _funcName);
if (!compVal) //found it!
{
const TCHAR * val = funcNode->Attribute(L"func");
const wchar_t * val = funcNode->Attribute(L"func");
if (val)
{
if (!lstrcmp(val, L"yes"))
@ -339,12 +339,12 @@ bool FunctionCallTip::loadFunction()
TiXmlElement *paramNode = NULL;
for (; overloadNode ; overloadNode = overloadNode->NextSiblingElement(L"Overload") )
{
const TCHAR * retVal = overloadNode->Attribute(L"retVal");
const wchar_t * retVal = overloadNode->Attribute(L"retVal");
if (!retVal)
continue; //malformed node
_retVals.push_back(retVal);
const TCHAR * description = overloadNode->Attribute(L"descr");
const wchar_t * description = overloadNode->Attribute(L"descr");
if (description)
_descriptions.push_back(description);
else
@ -353,7 +353,7 @@ bool FunctionCallTip::loadFunction()
paramNode = overloadNode->FirstChildElement(L"Param");
for (; paramNode ; paramNode = paramNode->NextSiblingElement(L"Param") )
{
const TCHAR * param = paramNode->Attribute(L"name");
const wchar_t * param = paramNode->Attribute(L"name");
if (!param)
continue; //malformed node
paramVec.push_back(param);

View File

@ -18,7 +18,7 @@
#include "ScintillaEditView.h"
typedef std::vector<const TCHAR *> stringVec;
typedef std::vector<const wchar_t *> stringVec;
class FunctionCallTip {
friend class AutoCompletion;
@ -41,7 +41,7 @@ private:
TiXmlElement * _curFunction = nullptr; //current function element
//cache some XML values n stuff
TCHAR * _funcName = nullptr; //name of function
wchar_t * _funcName = nullptr; //name of function
stringVec _retVals; //vector of overload return values/types
std::vector<stringVec> _overloads; //vector of overload params (=vector)
stringVec _descriptions; //vecotr of function descriptions
@ -49,10 +49,10 @@ private:
size_t _currentOverload = 0; //current chosen overload
size_t _currentParam = 0; //current highlighted param
TCHAR _start = '(';
TCHAR _stop = ')';
TCHAR _param = ',';
TCHAR _terminal = ';';
wchar_t _start = '(';
wchar_t _stop = ')';
wchar_t _param = ',';
wchar_t _terminal = ';';
generic_string _additionalWordChar = L"";
bool _ignoreCase = true;
bool _selfActivated = false;
@ -62,11 +62,11 @@ private:
void showCalltip(); //display calltip based on current variables
void reset(); //reset all vars in case function is invalidated
void cleanup(); //delete any leftovers
bool isBasicWordChar(TCHAR ch) const {
bool isBasicWordChar(wchar_t ch) const {
return ((ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z') || (ch >= '0' && ch <= '9') || ch == '_');
};
bool isAdditionalWordChar(TCHAR ch) const {
const TCHAR *addChars = _additionalWordChar.c_str();
bool isAdditionalWordChar(wchar_t ch) const {
const wchar_t *addChars = _additionalWordChar.c_str();
size_t len = _additionalWordChar.length();
for (size_t i = 0 ; i < len ; ++i)
if (ch == addChars[i])

View File

@ -156,7 +156,7 @@ void SmartHighlighter::highlightView(ScintillaEditView * pHighlightView, Scintil
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
UINT cp = static_cast<UINT>(pHighlightView->execute(SCI_GETCODEPAGE));
const TCHAR * text2FindW = wmc.char2wchar(text2Find, cp);
const wchar_t * text2FindW = wmc.char2wchar(text2Find, cp);
highlightViewWithWord(pHighlightView, text2FindW);

View File

@ -199,7 +199,7 @@ intptr_t CALLBACK ColumnEditorDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
auto endLine = (*_ppEditView)->execute(SCI_LINEFROMPOSITION, endPos);
constexpr int lineAllocatedLen = 1024;
TCHAR *line = new TCHAR[lineAllocatedLen];
wchar_t *line = new wchar_t[lineAllocatedLen];
for (size_t i = cursorLine ; i <= static_cast<size_t>(endLine); ++i)
{
@ -212,7 +212,7 @@ intptr_t CALLBACK ColumnEditorDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
if (lineLen > lineAllocatedLen)
{
delete [] line;
line = new TCHAR[lineLen];
line = new wchar_t[lineLen];
}
(*_ppEditView)->getGenericText(line, lineLen, lineBegin, lineEnd);
generic_string s2r(line);
@ -290,7 +290,7 @@ intptr_t CALLBACK ColumnEditorDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
}
constexpr int lineAllocatedLen = 1024;
TCHAR *line = new TCHAR[lineAllocatedLen];
wchar_t *line = new wchar_t[lineAllocatedLen];
UCHAR f = format & MASK_FORMAT;
@ -319,7 +319,7 @@ intptr_t CALLBACK ColumnEditorDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
if (lineLen > lineAllocatedLen)
{
delete [] line;
line = new TCHAR[lineLen];
line = new wchar_t[lineLen];
}
(*_ppEditView)->getGenericText(line, lineLen, lineBegin, lineEnd);
@ -389,7 +389,7 @@ intptr_t CALLBACK ColumnEditorDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
{
ColumnEditorParam& colEditParam = NppParameters::getInstance()._columnEditParam;
constexpr int stringSize = MAX_PATH;
TCHAR str[stringSize]{};
wchar_t str[stringSize]{};
switch (LOWORD(wParam))
{

View File

@ -758,7 +758,7 @@ bool TiXmlDocumentA::LoadFile( const char* filename )
return false;
}
bool TiXmlDocumentA::LoadUnicodeFilePath( const TCHAR* filename )
bool TiXmlDocumentA::LoadUnicodeFilePath( const wchar_t* filename )
{
// Delete the existing data:
@ -829,7 +829,7 @@ bool TiXmlDocumentA::SaveFile( const char * filename ) const
}
return false;
}
bool TiXmlDocumentA::SaveUnicodeFilePath( const TCHAR* filename ) const
bool TiXmlDocumentA::SaveUnicodeFilePath( const wchar_t* filename ) const
{
// The old c stuff lives on...
FILE* fp = _wfopen( filename, L"wc" );

View File

@ -1013,8 +1013,8 @@ public:
bool SaveFile( const char * filename ) const;
/// Load and Save a file using the given unicode filename. Returns true if successful.
bool LoadUnicodeFilePath( const TCHAR* filename );
bool SaveUnicodeFilePath( const TCHAR* filename ) const;
bool LoadUnicodeFilePath( const wchar_t* filename );
bool SaveUnicodeFilePath( const wchar_t* filename ) const;
#ifdef TIXMLA_USE_STL
bool LoadFile( const std::string& filename ) ///< STL std::string version.

View File

@ -29,10 +29,10 @@ distribution.
#include "tinystr.h"
// TiXmlString constructor, based on a C string
TiXmlString::TiXmlString (const TCHAR* instring)
TiXmlString::TiXmlString (const wchar_t* instring)
{
unsigned newlen;
TCHAR * newstring;
wchar_t * newstring;
if (!instring)
{
@ -42,7 +42,7 @@ TiXmlString::TiXmlString (const TCHAR* instring)
return;
}
newlen = lstrlen (instring) + 1;
newstring = new TCHAR [newlen];
newstring = new wchar_t [newlen];
memcpy (newstring, instring, newlen);
allocated = newlen;
cstring = newstring;
@ -53,7 +53,7 @@ TiXmlString::TiXmlString (const TCHAR* instring)
TiXmlString::TiXmlString (const TiXmlString& copy)
{
unsigned newlen;
TCHAR * newstring;
wchar_t * newstring;
// Prevent copy to self!
if ( &copy == this )
@ -67,7 +67,7 @@ TiXmlString::TiXmlString (const TiXmlString& copy)
return;
}
newlen = copy . length () + 1;
newstring = new TCHAR [newlen];
newstring = new wchar_t [newlen];
memcpy (newstring, copy . cstring, newlen);
allocated = newlen;
cstring = newstring;
@ -75,10 +75,10 @@ TiXmlString::TiXmlString (const TiXmlString& copy)
}
// TiXmlString = operator. Safe when assign own content
void TiXmlString ::operator = (const TCHAR * content)
void TiXmlString ::operator = (const wchar_t * content)
{
unsigned newlen;
TCHAR * newstring;
wchar_t * newstring;
if (! content)
{
@ -86,7 +86,7 @@ void TiXmlString ::operator = (const TCHAR * content)
return;
}
newlen = lstrlen (content) + 1;
newstring = new TCHAR [newlen];
newstring = new wchar_t [newlen];
memcpy (newstring, content, newlen);
empty_it ();
allocated = newlen;
@ -98,7 +98,7 @@ void TiXmlString ::operator = (const TCHAR * content)
void TiXmlString ::operator = (const TiXmlString & copy)
{
unsigned newlen;
TCHAR * newstring;
wchar_t * newstring;
if (! copy . length ())
{
@ -106,7 +106,7 @@ void TiXmlString ::operator = (const TiXmlString & copy)
return;
}
newlen = copy . length () + 1;
newstring = new TCHAR [newlen];
newstring = new wchar_t [newlen];
memcpy (newstring, copy . c_str (), newlen);
empty_it ();
allocated = newlen;
@ -118,17 +118,17 @@ void TiXmlString ::operator = (const TiXmlString & copy)
//// Checks if a TiXmlString contains only whitespace (same rules as isspace)
//bool TiXmlString::isblank () const
//{
// TCHAR * lookup;
// wchar_t * lookup;
// for (lookup = cstring; * lookup; lookup++)
// if (! isspace (* lookup))
// return false;
// return true;
//}
// append a const TCHAR * to an existing TiXmlString
void TiXmlString::append( const TCHAR* str, int len )
// append a const wchar_t * to an existing TiXmlString
void TiXmlString::append( const wchar_t* str, int len )
{
TCHAR * new_string;
wchar_t * new_string;
unsigned new_alloc, new_size, size_suffix;
size_suffix = lstrlen (str);
@ -145,7 +145,7 @@ void TiXmlString::append( const TCHAR* str, int len )
new_alloc = assign_new_size (new_size);
// allocate new buffer
new_string = new TCHAR [new_alloc];
new_string = new wchar_t [new_alloc];
new_string [0] = 0;
// copy the previous allocated buffer into this one
@ -179,10 +179,10 @@ void TiXmlString::append( const TCHAR* str, int len )
}
// append a const TCHAR * to an existing TiXmlString
void TiXmlString::append( const TCHAR * suffix )
// append a const wchar_t * to an existing TiXmlString
void TiXmlString::append( const wchar_t * suffix )
{
TCHAR * new_string;
wchar_t * new_string;
unsigned new_alloc, new_size;
new_size = length () + lstrlen (suffix) + 1;
@ -193,7 +193,7 @@ void TiXmlString::append( const TCHAR * suffix )
new_alloc = assign_new_size (new_size);
// allocate new buffer
new_string = new TCHAR [new_alloc];
new_string = new wchar_t [new_alloc];
new_string [0] = 0;
// copy the previous allocated buffer into this one
@ -238,9 +238,9 @@ void TiXmlString::append( const TCHAR * suffix )
//}
unsigned TiXmlString::find (TCHAR tofind, unsigned offset) const
unsigned TiXmlString::find (wchar_t tofind, unsigned offset) const
{
TCHAR * lookup;
wchar_t * lookup;
if (offset >= length ())
return (unsigned) notfound;

View File

@ -45,7 +45,7 @@ class TiXmlString
{
public :
// TiXmlString constructor, based on a string
TiXmlString (const TCHAR * instring);
TiXmlString (const wchar_t * instring);
// TiXmlString empty constructor
TiXmlString ()
@ -64,8 +64,8 @@ class TiXmlString
empty_it ();
}
// Convert a TiXmlString into a classical TCHAR *
const TCHAR * c_str () const
// Convert a TiXmlString into a classical wchar_t *
const wchar_t * c_str () const
{
if (allocated)
return cstring;
@ -79,20 +79,20 @@ class TiXmlString
}
// TiXmlString = operator
void operator = (const TCHAR * content);
void operator = (const wchar_t * content);
// = operator
void operator = (const TiXmlString & copy);
// += operator. Maps to append
TiXmlString& operator += (const TCHAR * suffix)
TiXmlString& operator += (const wchar_t * suffix)
{
append (suffix);
return *this;
}
// += operator. Maps to append
TiXmlString& operator += (TCHAR single)
TiXmlString& operator += (wchar_t single)
{
append (single);
return *this;
@ -119,21 +119,21 @@ class TiXmlString
// which is a problem. Commenting out. -lee
// bool isblank () const;
// single TCHAR extraction
const TCHAR& at (unsigned index) const
// single wchar_t extraction
const wchar_t& at (unsigned index) const
{
assert( index < length ());
return cstring [index];
}
// find a char in a string. Return TiXmlString::notfound if not found
unsigned find (TCHAR lookup) const
unsigned find (wchar_t lookup) const
{
return find (lookup, 0);
}
// find a char in a string from an offset. Return TiXmlString::notfound if not found
unsigned find (TCHAR tofind, unsigned offset) const;
unsigned find (wchar_t tofind, unsigned offset) const;
/* Function to reserve a big amount of data when we know we'll need it. Be aware that this
function clears the content of the TiXmlString if any exists.
@ -144,14 +144,14 @@ class TiXmlString
if (size)
{
allocated = size;
cstring = new TCHAR [size];
cstring = new wchar_t [size];
cstring [0] = 0;
current_length = 0;
}
}
// [] operator
TCHAR& operator [] (unsigned index) const
wchar_t& operator [] (unsigned index) const
{
assert( index < length ());
return cstring [index];
@ -161,12 +161,12 @@ class TiXmlString
enum { notfound = 0xffffffff,
npos = notfound };
void append (const TCHAR *str, int len );
void append (const wchar_t *str, int len );
protected :
// The base string
TCHAR * cstring;
wchar_t * cstring;
// Number of chars allocated
unsigned allocated;
// Current string size
@ -189,7 +189,7 @@ class TiXmlString
current_length = 0;
}
void append (const TCHAR *suffix );
void append (const wchar_t *suffix );
// append function for another TiXmlString
void append (const TiXmlString & suffix)
@ -197,10 +197,10 @@ class TiXmlString
append (suffix . c_str ());
}
// append for a single TCHAR. This could be improved a lot if needed
void append (TCHAR single)
// append for a single wchar_t. This could be improved a lot if needed
void append (wchar_t single)
{
TCHAR smallstr [2];
wchar_t smallstr [2];
smallstr [0] = single;
smallstr [1] = 0;
append (smallstr);
@ -218,7 +218,7 @@ public :
TiXmlOutStream () : TiXmlString () {}
// TiXmlOutStream << operator. Maps to TiXmlString::append
TiXmlOutStream & operator << (const TCHAR * in)
TiXmlOutStream & operator << (const wchar_t * in)
{
append (in);
return (* this);

View File

@ -32,7 +32,7 @@ distribution.
// It also cleans up the code a bit.
//
const TCHAR* TiXmlBase::errorString[ TIXML_ERROR_STRING_COUNT ] =
const wchar_t* TiXmlBase::errorString[ TIXML_ERROR_STRING_COUNT ] =
{
L"No error",
L"Error",

View File

@ -46,15 +46,15 @@ class TiXmlParsingData
{
friend class TiXmlDocument;
public:
//TiXmlParsingData( const TCHAR* now, const TiXmlParsingData* prevData );
void Stamp( const TCHAR* now );
//TiXmlParsingData( const wchar_t* now, const TiXmlParsingData* prevData );
void Stamp( const wchar_t* now );
const TiXmlCursor& Cursor() { return cursor; }
//void Update( const TCHAR* now );
//void Update( const wchar_t* now );
private:
// Only used by the document!
TiXmlParsingData( const TCHAR* start, int _tabsize, int row, int col )
TiXmlParsingData( const wchar_t* start, int _tabsize, int row, int col )
{
assert( start );
stamp = start;
@ -64,12 +64,12 @@ class TiXmlParsingData
}
TiXmlCursor cursor;
const TCHAR* stamp;
const wchar_t* stamp;
int tabsize;
};
void TiXmlParsingData::Stamp( const TCHAR* now )
void TiXmlParsingData::Stamp( const wchar_t* now )
{
assert( now );
@ -82,7 +82,7 @@ void TiXmlParsingData::Stamp( const TCHAR* now )
// Get the current row, column.
int row = cursor.row;
int col = cursor.col;
const TCHAR* p = stamp;
const wchar_t* p = stamp;
assert( p );
while ( p < now )
@ -135,7 +135,7 @@ void TiXmlParsingData::Stamp( const TCHAR* now )
// Eat the character
++p;
// Normal TCHAR - just advance one column
// Normal wchar_t - just advance one column
++col;
break;
}
@ -149,7 +149,7 @@ void TiXmlParsingData::Stamp( const TCHAR* now )
}
const TCHAR* TiXmlBase::SkipWhiteSpace( const TCHAR* p )
const wchar_t* TiXmlBase::SkipWhiteSpace( const wchar_t* p )
{
if ( !p || !*p )
{
@ -176,7 +176,7 @@ const TCHAR* TiXmlBase::SkipWhiteSpace( const TCHAR* p )
int c = in->peek();
if ( !IsWhiteSpace( c ) )
return true;
*tag += static_cast<TCHAR>(in->get());
*tag += static_cast<wchar_t>(in->get());
}
}
@ -189,13 +189,13 @@ const TCHAR* TiXmlBase::SkipWhiteSpace( const TCHAR* p )
return true;
in->get();
*tag += static_cast<TCHAR>(c);
*tag += static_cast<wchar_t>(c);
}
return false;
}
#endif
const TCHAR* TiXmlBase::ReadName( const TCHAR* p, TIXML_STRING * name )
const wchar_t* TiXmlBase::ReadName( const wchar_t* p, TIXML_STRING * name )
{
*name = L"";
assert( p );
@ -222,7 +222,7 @@ const TCHAR* TiXmlBase::ReadName( const TCHAR* p, TIXML_STRING * name )
return 0;
}
const TCHAR* TiXmlBase::GetEntity( const TCHAR* p, TCHAR* value )
const wchar_t* TiXmlBase::GetEntity( const wchar_t* p, wchar_t* value )
{
// Presume an entity, and pull it out.
int i;
@ -230,14 +230,14 @@ const TCHAR* TiXmlBase::GetEntity( const TCHAR* p, TCHAR* value )
// Handle the &#x entities.
if (wcsncmp( L"&#x", p, 3 ) == 0)
{
const TCHAR* end = wcschr(p+3, L';');
const wchar_t* end = wcschr(p+3, L';');
if (end && end - p <= 3 + 4)
{
TCHAR* hexend;
wchar_t* hexend;
auto val = wcstol(p + 3, &hexend, 16);
if (hexend == end)
{
*value = static_cast<TCHAR>(val);
*value = static_cast<wchar_t>(val);
return end + 1;
}
}
@ -260,8 +260,8 @@ const TCHAR* TiXmlBase::GetEntity( const TCHAR* p, TCHAR* value )
}
bool TiXmlBase::StringEqual( const TCHAR* p,
const TCHAR* tag,
bool TiXmlBase::StringEqual( const wchar_t* p,
const wchar_t* tag,
bool ignoreCase )
{
assert( p );
@ -273,7 +273,7 @@ bool TiXmlBase::StringEqual( const TCHAR* p,
if ( _totlower( *p ) == _totlower( *tag ) )
{
const TCHAR* q = p;
const wchar_t* q = p;
if (ignoreCase)
{
@ -305,10 +305,10 @@ bool TiXmlBase::StringEqual( const TCHAR* p,
return false;
}
const TCHAR* TiXmlBase::ReadText( const TCHAR* p,
const wchar_t* TiXmlBase::ReadText( const wchar_t* p,
TIXML_STRING * text,
bool trimWhiteSpace,
const TCHAR* endTag,
const wchar_t* endTag,
bool caseInsensitive )
{
*text = L"";
@ -320,7 +320,7 @@ const TCHAR* TiXmlBase::ReadText( const TCHAR* p,
&& !StringEqual( p, endTag, caseInsensitive )
)
{
TCHAR c;
wchar_t c;
p = GetChar( p, &c );
(* text) += c;
}
@ -353,7 +353,7 @@ const TCHAR* TiXmlBase::ReadText( const TCHAR* p,
(* text) += ' ';
whitespace = false;
}
TCHAR c;
wchar_t c;
p = GetChar( p, &c );
(* text) += c;
}
@ -385,7 +385,7 @@ void TiXmlDocument::StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag )
while ( in->good() && in->peek() != '>' )
{
int c = in->get();
(*tag) += static_cast<TCHAR>(c);
(*tag) += static_cast<wchar_t>(c);
}
if ( in->good() )
@ -422,7 +422,7 @@ void TiXmlDocument::StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag )
#endif
const TCHAR* TiXmlDocument::Parse( const TCHAR* p, TiXmlParsingData* prevData )
const wchar_t* TiXmlDocument::Parse( const wchar_t* p, TiXmlParsingData* prevData )
{
ClearError();
@ -478,7 +478,7 @@ const TCHAR* TiXmlDocument::Parse( const TCHAR* p, TiXmlParsingData* prevData )
return p;
}
void TiXmlDocument::SetError( int err, const TCHAR* pError, TiXmlParsingData* data )
void TiXmlDocument::SetError( int err, const wchar_t* pError, TiXmlParsingData* data )
{
// The first error in a chain is more accurate - don't set again!
if ( error )
@ -499,7 +499,7 @@ void TiXmlDocument::SetError( int err, const TCHAR* pError, TiXmlParsingData* da
}
TiXmlNode* TiXmlNode::Identify( const TCHAR* p )
TiXmlNode* TiXmlNode::Identify( const wchar_t* p )
{
TiXmlNode* returnNode = 0;
@ -524,8 +524,8 @@ TiXmlNode* TiXmlNode::Identify( const TCHAR* p )
// - Everthing else is unknown to tinyxml.
//
const TCHAR* xmlHeader = { L"<?xml" };
const TCHAR* commentHeader = { L"<!--" };
const wchar_t* xmlHeader = { L"<?xml" };
const wchar_t* commentHeader = { L"<!--" };
if ( StringEqual( p, xmlHeader, true ) )
{
@ -579,7 +579,7 @@ void TiXmlElement::StreamIn (TIXML_ISTREAM * in, TIXML_STRING * tag)
while( in->good() )
{
int c = in->get();
(*tag) += static_cast<TCHAR>(c);
(*tag) += static_cast<wchar_t>(c);
if ( c == '>' )
break;
@ -637,7 +637,7 @@ void TiXmlElement::StreamIn (TIXML_ISTREAM * in, TIXML_STRING * tag)
if ( c == '>' )
break;
*tag += static_cast<TCHAR>(c);
*tag += static_cast<wchar_t>(c);
in->get();
if ( !firstCharFound && c != '<' && !IsWhiteSpace( c ) )
@ -653,7 +653,7 @@ void TiXmlElement::StreamIn (TIXML_ISTREAM * in, TIXML_STRING * tag)
{
int c = in->get();
assert( c == '>' );
*tag += static_cast<TCHAR>(c);
*tag += static_cast<wchar_t>(c);
// We are done, once we've found our closing tag.
return;
@ -661,7 +661,7 @@ void TiXmlElement::StreamIn (TIXML_ISTREAM * in, TIXML_STRING * tag)
else
{
// If not a closing tag, id it, and stream.
const TCHAR* tagloc = tag->c_str() + tagIndex;
const wchar_t* tagloc = tag->c_str() + tagIndex;
TiXmlNode* node = Identify( tagloc );
if ( !node )
return;
@ -676,7 +676,7 @@ void TiXmlElement::StreamIn (TIXML_ISTREAM * in, TIXML_STRING * tag)
}
#endif
const TCHAR* TiXmlElement::Parse( const TCHAR* p, TiXmlParsingData* data )
const wchar_t* TiXmlElement::Parse( const wchar_t* p, TiXmlParsingData* data )
{
p = SkipWhiteSpace( p );
TiXmlDocument* document = GetDocument();
@ -703,7 +703,7 @@ const TCHAR* TiXmlElement::Parse( const TCHAR* p, TiXmlParsingData* data )
p = SkipWhiteSpace( p+1 );
// Read the name.
const TCHAR* pErr = p;
const wchar_t* pErr = p;
p = ReadName( p, &value );
if ( !p || !*p )
@ -771,7 +771,7 @@ const TCHAR* TiXmlElement::Parse( const TCHAR* p, TiXmlParsingData* data )
}
attrib->SetDocument( document );
const TCHAR* pErr = p;
const wchar_t* pErr = p;
p = attrib->Parse( p, data );
if ( !p || !*p )
@ -797,7 +797,7 @@ const TCHAR* TiXmlElement::Parse( const TCHAR* p, TiXmlParsingData* data )
}
const TCHAR* TiXmlElement::ReadValue( const TCHAR* p, TiXmlParsingData* data )
const wchar_t* TiXmlElement::ReadValue( const wchar_t* p, TiXmlParsingData* data )
{
TiXmlDocument* document = GetDocument();
@ -862,7 +862,7 @@ void TiXmlUnknown::StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag )
while ( in->good() )
{
int c = in->get();
(*tag) += static_cast<TCHAR>(c);
(*tag) += static_cast<wchar_t>(c);
if ( c == '>' )
{
@ -874,7 +874,7 @@ void TiXmlUnknown::StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag )
#endif
const TCHAR* TiXmlUnknown::Parse( const TCHAR* p, TiXmlParsingData* data )
const wchar_t* TiXmlUnknown::Parse( const wchar_t* p, TiXmlParsingData* data )
{
TiXmlDocument* document = GetDocument();
p = SkipWhiteSpace( p );
@ -914,7 +914,7 @@ void TiXmlComment::StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag )
while ( in->good() )
{
int c = in->get();
(*tag) += static_cast<TCHAR>(c);
(*tag) += static_cast<wchar_t>(c);
if ( c == '>'
&& tag->at( tag->length() - 2 ) == '-'
@ -928,7 +928,7 @@ void TiXmlComment::StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag )
#endif
const TCHAR* TiXmlComment::Parse( const TCHAR* p, TiXmlParsingData* data )
const wchar_t* TiXmlComment::Parse( const wchar_t* p, TiXmlParsingData* data )
{
TiXmlDocument* document = GetDocument();
value = L"";
@ -941,8 +941,8 @@ const TCHAR* TiXmlComment::Parse( const TCHAR* p, TiXmlParsingData* data )
data->Stamp( p );
location = data->Cursor();
}
const TCHAR* startTag = L"<!--";
const TCHAR* endTag = L"-->";
const wchar_t* startTag = L"<!--";
const wchar_t* endTag = L"-->";
if ( !StringEqual( p, startTag, false ) )
{
@ -955,7 +955,7 @@ const TCHAR* TiXmlComment::Parse( const TCHAR* p, TiXmlParsingData* data )
}
const TCHAR* TiXmlAttribute::Parse( const TCHAR* p, TiXmlParsingData* data )
const wchar_t* TiXmlAttribute::Parse( const wchar_t* p, TiXmlParsingData* data )
{
p = SkipWhiteSpace( p );
if ( !p || !*p ) return 0;
@ -967,7 +967,7 @@ const TCHAR* TiXmlAttribute::Parse( const TCHAR* p, TiXmlParsingData* data )
location = data->Cursor();
}
// Read the name, the '=' and the value.
const TCHAR* pErr = p;
const wchar_t* pErr = p;
p = ReadName( p, &name );
if ( !p || !*p )
{
@ -989,7 +989,7 @@ const TCHAR* TiXmlAttribute::Parse( const TCHAR* p, TiXmlParsingData* data )
return 0;
}
const TCHAR* end;
const wchar_t* end;
if ( *p == '\'' )
{
@ -1029,13 +1029,13 @@ void TiXmlText::StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag )
if ( c == '<' )
return;
(*tag) += static_cast<TCHAR>(c);
(*tag) += static_cast<wchar_t>(c);
in->get();
}
}
#endif
const TCHAR* TiXmlText::Parse( const TCHAR* p, TiXmlParsingData* data )
const wchar_t* TiXmlText::Parse( const wchar_t* p, TiXmlParsingData* data )
{
value = L"";
// TiXmlParsingData data( p, prevData );
@ -1046,7 +1046,7 @@ const TCHAR* TiXmlText::Parse( const TCHAR* p, TiXmlParsingData* data )
}
bool ignoreWhite = true;
const TCHAR* end = L"<";
const wchar_t* end = L"<";
p = ReadText( p, &value, ignoreWhite, end, false );
if ( p )
return p-1; // don't truncate the '<'
@ -1059,7 +1059,7 @@ void TiXmlDeclaration::StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag )
while ( in->good() )
{
int c = in->get();
(*tag) += static_cast<TCHAR>(c);
(*tag) += static_cast<wchar_t>(c);
if ( c == '>' )
{
@ -1070,7 +1070,7 @@ void TiXmlDeclaration::StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag )
}
#endif
const TCHAR* TiXmlDeclaration::Parse( const TCHAR* p, TiXmlParsingData* data )
const wchar_t* TiXmlDeclaration::Parse( const wchar_t* p, TiXmlParsingData* data )
{
p = SkipWhiteSpace( p );
// Find the beginning, find the end, and look for

View File

@ -299,7 +299,7 @@ Utf8_16_Write::~Utf8_16_Write()
closeFile();
}
bool Utf8_16_Write::openFile(const TCHAR *name)
bool Utf8_16_Write::openFile(const wchar_t *name)
{
m_pFile = std::make_unique<Win32_IO_File>(name);

View File

@ -141,7 +141,7 @@ public:
void setEncoding(UniMode eType);
bool openFile(const TCHAR *name);
bool openFile(const wchar_t *name);
bool writeFile(const void* p, size_t _size);
void closeFile();

View File

@ -20,7 +20,7 @@
#include "Parameters.h"
void URLCtrl::create(HWND itemHandle, const TCHAR * link, COLORREF linkColor)
void URLCtrl::create(HWND itemHandle, const wchar_t * link, COLORREF linkColor)
{
// turn on notify style
::SetWindowLongPtr(itemHandle, GWL_STYLE, ::GetWindowLongPtr(itemHandle, GWL_STYLE) | SS_NOTIFY);
@ -108,7 +108,7 @@ void URLCtrl::action()
}
else
{
TCHAR szWinText[MAX_PATH] = { '\0' };
wchar_t szWinText[MAX_PATH] = { '\0' };
::GetWindowText(_hSelf, szWinText, MAX_PATH);
::ShellExecute(NULL, L"open", szWinText, NULL, NULL, SW_SHOWNORMAL);
}
@ -172,7 +172,7 @@ LRESULT URLCtrl::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
HANDLE hOld = SelectObject(hdc, _hfUnderlined);
// Draw the text!
TCHAR szWinText[MAX_PATH] = { '\0' };
wchar_t szWinText[MAX_PATH] = { '\0' };
::GetWindowText(hwnd, szWinText, MAX_PATH);
::DrawText(hdc, szWinText, -1, &rect, dwDTStyle);

View File

@ -22,7 +22,7 @@
class URLCtrl : public Window {
public:
void create(HWND itemHandle, const TCHAR * link, COLORREF linkColor = RGB(0,0,255));
void create(HWND itemHandle, const wchar_t * link, COLORREF linkColor = RGB(0,0,255));
void create(HWND itemHandle, int cmd, HWND msgDest = NULL);
void destroy() override;
private:

View File

@ -67,7 +67,7 @@ void ListView::init(HINSTANCE hInst, HWND parent)
for (auto it = _columnInfos.begin(); it != _columnInfos.end(); ++it)
{
lvColumn.cx = static_cast<int>(it->_width);
lvColumn.pszText = const_cast<TCHAR *>(it->_label.c_str());
lvColumn.pszText = const_cast<wchar_t *>(it->_label.c_str());
ListView_InsertColumn(_hSelf, ++i, &lvColumn); // index is not 0 based but 1 based
}
}
@ -92,7 +92,7 @@ void ListView::addLine(const vector<generic_string> & values2Add, LPARAM lParam,
LVITEM item{};
item.mask = LVIF_TEXT | LVIF_PARAM;
item.pszText = const_cast<TCHAR *>(it->c_str());
item.pszText = const_cast<wchar_t *>(it->c_str());
item.iItem = pos2insert;
item.iSubItem = 0;
item.lParam = lParam;
@ -102,7 +102,7 @@ void ListView::addLine(const vector<generic_string> & values2Add, LPARAM lParam,
int j = 0;
for (; it != values2Add.end(); ++it)
{
ListView_SetItemText(_hSelf, pos2insert, ++j, const_cast<TCHAR *>(it->c_str()));
ListView_SetItemText(_hSelf, pos2insert, ++j, const_cast<wchar_t *>(it->c_str()));
}
}
@ -114,7 +114,7 @@ size_t ListView::findAlphabeticalOrderPos(const generic_string& string2Cmp, Sort
for (size_t i = 0; i < nbItem; ++i)
{
TCHAR str[MAX_PATH] = { '\0' };
wchar_t str[MAX_PATH] = { '\0' };
ListView_GetItemText(_hSelf, i, 0, str, sizeof(str));
int res = lstrcmp(string2Cmp.c_str(), str);

View File

@ -47,7 +47,7 @@ public:
void setColumnText(size_t i, generic_string txt2Set) {
LVCOLUMN lvColumn{};
lvColumn.mask = LVCF_TEXT;
lvColumn.pszText = const_cast<TCHAR *>(txt2Set.c_str());
lvColumn.pszText = const_cast<wchar_t *>(txt2Set.c_str());
ListView_SetColumn(_hSelf, i, &lvColumn);
}

View File

@ -188,16 +188,16 @@ void ClipboardHistoryPanel::drawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
ClipboardDataInfo& cbd = _clipboardDataInfos[i];
StringArray sa(cbd, MAX_DISPLAY_LENGTH);
TCHAR* displayStr = nullptr;
wchar_t* displayStr = nullptr;
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
if (cbd._isBinaryContained)
{
char* displayStrA = (char*)sa.getPointer();
displayStr = (TCHAR*)wmc.char2wchar(displayStrA, SC_CP_UTF8);
displayStr = (wchar_t*)wmc.char2wchar(displayStrA, SC_CP_UTF8);
}
else
{
displayStr = (TCHAR*)sa.getPointer();
displayStr = (wchar_t*)sa.getPointer();
}
::SetTextColor(lpDrawItemStruct->hDC, fgColor);

View File

@ -51,7 +51,7 @@ LRESULT CALLBACK ColourStaticTextHooker::colourStaticProc(HWND hwnd, UINT Messag
HANDLE hOld = ::SelectObject(hdc, hf);
// Draw the text!
TCHAR text[MAX_PATH]{};
wchar_t text[MAX_PATH]{};
::GetWindowText(hwnd, text, MAX_PATH);
::DrawText(hdc, text, -1, &rect, DT_LEFT);
@ -121,7 +121,7 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM
}
::SendMessage(_hSwitch2ThemeCombo, CB_SETCURSEL, _currentThemeIndex, 0);
for (size_t i = 0 ; i < sizeof(fontSizeStrs)/(3*sizeof(TCHAR)) ; ++i)
for (size_t i = 0 ; i < sizeof(fontSizeStrs)/(3*sizeof(wchar_t)) ; ++i)
::SendMessage(_hFontSizeCombo, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(fontSizeStrs[i]));
const std::vector<generic_string> & fontlist = (NppParameters::getInstance()).getFontList();
@ -402,7 +402,7 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM
::SendMessage(_hParent, WM_UPDATESCINTILLAS, 0, 0);
::SendMessage(_hParent, WM_UPDATEMAINMENUBITMAPS, 0, 0);
const TCHAR* fn = ::PathFindFileName(_themeName.c_str());
const wchar_t* fn = ::PathFindFileName(_themeName.c_str());
NppDarkMode::setThemeName((!NppDarkMode::isEnabled() && lstrcmp(fn, L"stylers.xml") == 0) ? L"" : fn);
return TRUE;
@ -618,7 +618,7 @@ void WordStyleDlg::updateThemeName(const generic_string& themeName)
nppGUI._themeName.assign( themeName );
}
bool WordStyleDlg::getStyleName(TCHAR *styleName, const size_t styleNameLen)
bool WordStyleDlg::getStyleName(wchar_t *styleName, const size_t styleNameLen)
{
auto i = ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETCURSEL, 0, 0);
if (i == LB_ERR)
@ -636,7 +636,7 @@ bool WordStyleDlg::getStyleName(TCHAR *styleName, const size_t styleNameLen)
int WordStyleDlg::whichTabColourIndex()
{
constexpr size_t styleNameLen = 128;
TCHAR styleName[styleNameLen + 1] = { '\0' };
wchar_t styleName[styleNameLen + 1] = { '\0' };
if (!WordStyleDlg::getStyleName(styleName, styleNameLen))
{
@ -661,7 +661,7 @@ int WordStyleDlg::whichTabColourIndex()
bool WordStyleDlg::isDocumentMapStyle()
{
constexpr size_t styleNameLen = 128;
TCHAR styleName[styleNameLen + 1] = { '\0' };
wchar_t styleName[styleNameLen + 1] = { '\0' };
return (WordStyleDlg::getStyleName(styleName, styleNameLen) && (lstrcmp(styleName, VIEWZONE_DOCUMENTMAP) == 0));
}
@ -695,7 +695,7 @@ void WordStyleDlg::updateFontSize()
if (iFontSizeSel != 0)
{
constexpr size_t intStrLen = 3;
TCHAR intStr[intStrLen]{};
wchar_t intStr[intStrLen]{};
auto lbTextLen = ::SendMessage(_hFontSizeCombo, CB_GETLBTEXTLEN, iFontSizeSel, 0);
if (static_cast<size_t>(lbTextLen) >= intStrLen)
@ -707,7 +707,7 @@ void WordStyleDlg::updateFontSize()
style._fontSize = STYLE_NOT_USED;
else
{
TCHAR *finStr = nullptr;
wchar_t *finStr = nullptr;
style._fontSize = wcstol(intStr, &finStr, 10);
if (*finStr != '\0')
style._fontSize = STYLE_NOT_USED;
@ -720,7 +720,7 @@ void WordStyleDlg::updateFontSize()
void WordStyleDlg::updateExtension()
{
constexpr int NB_MAX = 256;
TCHAR ext[NB_MAX]{};
wchar_t ext[NB_MAX]{};
::SendDlgItemMessage(_hSelf, IDC_USER_EXT_EDIT, WM_GETTEXT, NB_MAX, reinterpret_cast<LPARAM>(ext));
_lsArray.getLexerFromIndex(_currentLexerIndex - 1).setLexerUserExt(ext);
}
@ -729,11 +729,11 @@ void WordStyleDlg::updateUserKeywords()
{
Style & style = getCurrentStyler();
//const int NB_MAX = 2048;
//TCHAR kw[NB_MAX];
//wchar_t kw[NB_MAX];
auto len = ::SendDlgItemMessage(_hSelf, IDC_USER_KEYWORDS_EDIT, WM_GETTEXTLENGTH, 0, 0);
len += 1;
TCHAR* kw = new TCHAR[len];
::memset(kw, 0, len * sizeof(TCHAR));
wchar_t* kw = new wchar_t[len];
::memset(kw, 0, len * sizeof(wchar_t));
::SendDlgItemMessage(_hSelf, IDC_USER_KEYWORDS_EDIT, WM_GETTEXT, len, reinterpret_cast<LPARAM>(kw));
style._keywords = kw;
@ -744,7 +744,7 @@ void WordStyleDlg::updateFontName()
{
Style & style = getCurrentStyler();
auto iFontSel = ::SendMessage(_hFontNameCombo, CB_GETCURSEL, 0, 0);
TCHAR *fnStr = (TCHAR *)::SendMessage(_hFontNameCombo, CB_GETITEMDATA, iFontSel, 0);
wchar_t *fnStr = (wchar_t *)::SendMessage(_hFontNameCombo, CB_GETITEMDATA, iFontSel, 0);
style._fontName = fnStr;
}
@ -792,7 +792,7 @@ void WordStyleDlg::switchToTheme()
if (_isThemeDirty)
{
TCHAR themeFileName[MAX_PATH]{};
wchar_t themeFileName[MAX_PATH]{};
wcscpy_s(themeFileName, prevThemeName.c_str());
PathStripPath(themeFileName);
PathRemoveExtension(themeFileName);
@ -823,7 +823,7 @@ void WordStyleDlg::applyCurrentSelectedThemeAndUpdateUI()
apply();
}
bool WordStyleDlg::selectThemeByName(const TCHAR* themeName)
bool WordStyleDlg::selectThemeByName(const wchar_t* themeName)
{
LRESULT iTheme = ::SendMessage(_hSwitch2ThemeCombo, CB_FINDSTRING, 1, reinterpret_cast<LPARAM>(themeName));
if (iTheme == CB_ERR)
@ -836,7 +836,7 @@ bool WordStyleDlg::selectThemeByName(const TCHAR* themeName)
return true;
}
bool WordStyleDlg::goToSection(const TCHAR* sectionNames)
bool WordStyleDlg::goToSection(const wchar_t* sectionNames)
{
if (!sectionNames || !sectionNames[0])
return false;
@ -876,9 +876,9 @@ void WordStyleDlg::setStyleListFromLexer(int index)
if (index)
{
const TCHAR *langName = _lsArray.getLexerNameFromIndex(index - 1);
const TCHAR *ext = NppParameters::getInstance().getLangExtFromName(langName);
const TCHAR *userExt = (_lsArray.getLexerStylerByName(langName))->getLexerUserExt();
const wchar_t *langName = _lsArray.getLexerNameFromIndex(index - 1);
const wchar_t *ext = NppParameters::getInstance().getLangExtFromName(langName);
const wchar_t *userExt = (_lsArray.getLexerStylerByName(langName))->getLexerUserExt();
::SendDlgItemMessage(_hSelf, IDC_DEF_EXT_EDIT, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(ext));
// WM_SETTEXT cause sending WM_COMMAND message with EN_CHANGE.
@ -889,7 +889,7 @@ void WordStyleDlg::setStyleListFromLexer(int index)
bool isThemeDirty = _isThemeDirty;
constexpr int NB_MAX = 256;
TCHAR currentExt[NB_MAX]{};
wchar_t currentExt[NB_MAX]{};
::SendDlgItemMessage(_hSelf, IDC_USER_EXT_EDIT, WM_GETTEXT, NB_MAX, reinterpret_cast<LPARAM>(currentExt));
if (userExt && lstrcmp(currentExt, userExt) != 0)
@ -1047,7 +1047,7 @@ void WordStyleDlg::setVisualFromStyleList()
COLORREF c = NppDarkMode::isEnabled() ? NppDarkMode::getLinkTextColor() : RGB(0x00, 0x00, 0xFF);
const size_t strLen = 256;
TCHAR str[strLen + 1] = { '\0' };
wchar_t str[strLen + 1] = { '\0' };
str[0] = '\0';
@ -1064,7 +1064,7 @@ void WordStyleDlg::setVisualFromStyleList()
if (i == LB_ERR)
return;
const size_t styleNameLen = 64;
TCHAR styleName[styleNameLen + 1] = { '\0' };
wchar_t styleName[styleNameLen + 1] = { '\0' };
lbTextLen = ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETTEXTLEN, i, 0);
if (static_cast<size_t>(lbTextLen) > styleNameLen)
return;
@ -1122,7 +1122,7 @@ void WordStyleDlg::setVisualFromStyleList()
//-- font size
constexpr size_t intStrLen = 3;
TCHAR intStr[intStrLen]{};
wchar_t intStr[intStrLen]{};
LRESULT iFontSize = 0;
if (style._fontSize != STYLE_NOT_USED && style._fontSize < 100) // style._fontSize has only 2 digits
{
@ -1167,12 +1167,12 @@ void WordStyleDlg::setVisualFromStyleList()
lexerNameStr += L" is not defined in NppParameters::getLangIDFromStr()";
printStr(lexerNameStr.c_str());
}
const TCHAR *kws = nppParams.getWordList(lType, style._keywordClass);
const wchar_t *kws = nppParams.getWordList(lType, style._keywordClass);
if (!kws)
kws = L"";
::SendDlgItemMessage(_hSelf, IDC_DEF_KEYWORDS_EDIT, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(kws));
const TCHAR *ckwStr = style._keywords.c_str();
const wchar_t *ckwStr = style._keywords.c_str();
::SendDlgItemMessage(_hSelf, IDC_USER_KEYWORDS_EDIT, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(ckwStr));
}

View File

@ -69,8 +69,8 @@ public :
void restoreGlobalOverrideValues();
void apply(bool needVisualApply = true);
void addLastThemeEntry();
bool selectThemeByName(const TCHAR* themeName);
bool goToSection(const TCHAR* sectionNames); // sectionNames is formed as following: "Language name:Style name"
bool selectThemeByName(const wchar_t* themeName);
bool goToSection(const wchar_t* sectionNames); // sectionNames is formed as following: "Language name:Style name"
// ex: "Global Styles:EOL custom color" will set Language on "Global Styles", then set Style on "EOL custom color" if both are found.
private :
@ -116,7 +116,7 @@ private :
Style& getCurrentStyler();
bool getStyleName(TCHAR *styleName, const size_t styleNameLen);
bool getStyleName(wchar_t *styleName, const size_t styleNameLen);
int whichTabColourIndex();
bool isDocumentMapStyle();

View File

@ -49,18 +49,18 @@
struct tTbData {
HWND hClient = nullptr; // client Window Handle
const TCHAR* pszName = nullptr; // name of plugin (shown in window)
const wchar_t* pszName = nullptr; // name of plugin (shown in window)
int dlgID = 0; // a funcItem provides the function pointer to start a dialog. Please parse here these ID
// user modifications
UINT uMask = 0; // mask params: look to above defines
HICON hIconTab = nullptr; // icon for tabs
const TCHAR* pszAddInfo = nullptr; // for plugin to display additional informations
const wchar_t* pszAddInfo = nullptr; // for plugin to display additional informations
// internal data, do not use !!!
RECT rcFloat = {}; // floating position
int iPrevCont = 0; // stores the privious container (toggling between float and dock)
const TCHAR* pszModuleName = nullptr; // it's the plugin file name. It's used to identify the plugin
const wchar_t* pszModuleName = nullptr; // it's the plugin file name. It's used to identify the plugin
};

View File

@ -172,7 +172,7 @@ tTbData* DockingCont::findToolbarByWnd(HWND hClient)
return pTbData;
}
tTbData* DockingCont::findToolbarByName(TCHAR* pszName)
tTbData* DockingCont::findToolbarByName(wchar_t* pszName)
{
tTbData* pTbData = NULL;
@ -312,7 +312,7 @@ LRESULT DockingCont::runProcCaption(HWND hwnd, UINT Message, WPARAM wParam, LPAR
if (!hookMouse)
{
DWORD dwError = ::GetLastError();
TCHAR str[128]{};
wchar_t str[128]{};
::wsprintf(str, L"GetLastError() returned %lu", dwError);
::MessageBox(NULL, str, L"SetWindowsHookEx(MOUSE) failed on runProcCaption", MB_OK | MB_ICONERROR);
}
@ -1065,7 +1065,7 @@ void DockingCont::drawTabItem(DRAWITEMSTRUCT* pDrawItemStruct)
auto tbData = reinterpret_cast<tTbData*>(tcItem.lParam);
const TCHAR* text = tbData->pszName;
const wchar_t* text = tbData->pszName;
int length = lstrlen(tbData->pszName);
// get drawing context
@ -1652,7 +1652,7 @@ void DockingCont::selectTab(int iTab)
{
if (iTab != -1)
{
const TCHAR *pszMaxTxt = NULL;
const wchar_t *pszMaxTxt = NULL;
TCITEM tcItem {};
SIZE size = {};
int maxWidth = 0;
@ -1700,7 +1700,7 @@ void DockingCont::selectTab(int iTab)
for (int iItem = 0; iItem < iItemCnt; ++iItem)
{
const TCHAR *pszTabTxt = NULL;
const wchar_t *pszTabTxt = NULL;
::SendMessage(_hContTab, TCM_GETITEM, iItem, reinterpret_cast<LPARAM>(&tcItem));
if (!tcItem.lParam)
@ -1729,7 +1729,7 @@ void DockingCont::selectTab(int iTab)
szText = L" ";
szText += pszMaxTxt;
}
tcItem.pszText = (TCHAR *)szText.c_str();
tcItem.pszText = (wchar_t *)szText.c_str();
::SendMessage(_hContTab, TCM_SETITEM, iItem, reinterpret_cast<LPARAM>(&tcItem));
}

View File

@ -66,7 +66,7 @@ public:
tTbData* createToolbar(const tTbData& data);
void removeToolbar(const tTbData& data);
tTbData* findToolbarByWnd(HWND hClient);
tTbData* findToolbarByName(TCHAR* pszName);
tTbData* findToolbarByName(wchar_t* pszName);
void showToolbar(tTbData *pTbData, BOOL state);

View File

@ -36,7 +36,7 @@ public:
void init(HINSTANCE hInst, HWND parent) override {
StaticDialog::init(hInst, parent);
TCHAR temp[MAX_PATH];
wchar_t temp[MAX_PATH];
::GetModuleFileName(hInst, temp, MAX_PATH);
_moduleName = ::PathFindFileName(temp);
}
@ -44,7 +44,7 @@ public:
void create(tTbData* data, bool isRTL = false) {
assert(data != nullptr);
StaticDialog::create(_dlgID, isRTL);
TCHAR temp[MAX_PATH];
wchar_t temp[MAX_PATH];
::GetWindowText(_hSelf, temp, MAX_PATH);
_pluginName = temp;
@ -78,7 +78,7 @@ public:
_isClosed = toClose;
}
const TCHAR * getPluginFileName() const {
const wchar_t * getPluginFileName() const {
return _moduleName.c_str();
}

View File

@ -704,7 +704,7 @@ void DockingManager::showDockableDlg(HWND hDlg, BOOL view)
}
}
void DockingManager::showDockableDlg(TCHAR* pszName, BOOL view)
void DockingManager::showDockableDlg(wchar_t* pszName, BOOL view)
{
for (size_t i = 0, len = _vContainer.size(); i < len; ++i)
{

View File

@ -48,7 +48,7 @@ public :
void createDockableDlg(tTbData data, int iCont = CONT_LEFT, bool isVisible = false);
void setActiveTab(int iCont, int iItem);
void showDockableDlg(HWND hDlg, BOOL view);
void showDockableDlg(TCHAR* pszName, BOOL view);
void showDockableDlg(wchar_t* pszName, BOOL view);
DockingCont* toggleActiveTb(DockingCont* pContSrc, UINT message, BOOL bNew = FALSE, LPRECT rcFloat = NULL);
DockingCont* toggleVisTb(DockingCont* pContSrc, UINT message, LPRECT rcFloat = NULL);

View File

@ -221,7 +221,7 @@ void Gripper::create()
if (!hookMouse)
{
DWORD dwError = ::GetLastError();
TCHAR str[128];
wchar_t str[128];
::wsprintf(str, L"GetLastError() returned %lu", dwError);
::MessageBox(NULL, str, L"SetWindowsHookEx(MOUSE) failed on Gripper::create()", MB_OK | MB_ICONERROR);
}
@ -232,7 +232,7 @@ void Gripper::create()
if (!hookKeyboard)
{
DWORD dwError = ::GetLastError();
TCHAR str[128];
wchar_t str[128];
::wsprintf(str, L"GetLastError() returned %lu", dwError);
::MessageBox(NULL, str, L"SetWindowsHookEx(KEYBOARD) failed on Gripper::create()", MB_OK | MB_ICONERROR);
}
@ -473,7 +473,7 @@ void Gripper::doTabReordering(POINT pt)
#if 0
extern HWND g_hMainWnd;
TCHAR str[128];
wchar_t str[128];
wsprintf(str, L"Size: %i", vCont.size());
::SetWindowText(g_hMainWnd, str);
#endif
@ -835,7 +835,7 @@ void Gripper::initTabInformation()
::SendMessage(_hTabSource, TCM_GETITEMRECT, _iItem, reinterpret_cast<LPARAM>(&_rcItem));
/* store item data */
static TCHAR szText[64];
static wchar_t szText[64];
_tcItem.mask = TCIF_PARAM | TCIF_TEXT;
_tcItem.pszText = szText;
_tcItem.cchTextMax = 64;

View File

@ -26,7 +26,7 @@
#define DOCUMENTMAP_MOUSECLICKED (WM_USER + 5) // DM_REPOSITION uses WM_USER + 2
#define DOCUMENTMAP_MOUSEWHEEL (WM_USER + 3)
const TCHAR VIEWZONE_DOCUMENTMAP[64] = L"Document map";
const wchar_t VIEWZONE_DOCUMENTMAP[64] = L"Document map";
class ScintillaEditView;
class Buffer;

View File

@ -29,10 +29,10 @@ struct GridHandleStruct
{
HMENU gridmenu = nullptr;
HWND hlist1 = nullptr;
TCHAR protect[2]{ 'U', '\0' };
TCHAR title[305]{};
TCHAR editstring[305]{};
TCHAR editstringdisplay[305]{};
wchar_t protect[2]{ 'U', '\0' };
wchar_t title[305]{};
wchar_t editstring[305]{};
wchar_t editstringdisplay[305]{};
int rows = 100;
int cols = 255;
int gridwidth = 0;
@ -106,8 +106,8 @@ int AddGrid(HMENU);
int FindGrid(HMENU);
void ShowVscroll(HWND, int);
void ShowHscroll(HWND, int);
int BinarySearchListBox(HWND, TCHAR*);
void DisplayEditString(HWND, int, const TCHAR*);
int BinarySearchListBox(HWND, wchar_t*);
void DisplayEditString(HWND, int, const wchar_t*);
int CountGrids();
@ -413,7 +413,7 @@ void DisplayColumn(HWND hWnd, int SI, int c, int offset, HFONT hfont, HFONT hcol
BGCELL BGcell;
SetCell(&BGcell, r, c);
TCHAR buffer[bufferLen]{};
wchar_t buffer[bufferLen]{};
wcscpy_s(buffer, L"");
if (BGHS[SI].COLUMNSNUMBERED)
{
@ -703,18 +703,18 @@ void SetCurrentCellStatus(HWND hWnd, int SelfIndex)
}
TCHAR GetASCII(WPARAM wParam, LPARAM lParam)
wchar_t GetASCII(WPARAM wParam, LPARAM lParam)
{
TCHAR mbuffer[100]{};
wchar_t mbuffer[100]{};
BYTE keys[256]{};
WORD dwReturnedValue = 0;
GetKeyboardState(keys);
int result = ToAscii(static_cast<UINT>(wParam), (lParam >> 16) & 0xff, keys, &dwReturnedValue, 0);
int returnvalue = (TCHAR)dwReturnedValue;
int returnvalue = (wchar_t)dwReturnedValue;
if (returnvalue < 0) { returnvalue = 0; }
wsprintf(mbuffer, L"return value = %d", returnvalue);
if (result != 1) { returnvalue = 0; }
return (TCHAR)returnvalue;
return (wchar_t)returnvalue;
}
@ -1036,7 +1036,7 @@ void CloseEdit(HWND hWnd, int SI)
NotifyEditEnd(hWnd, SI);
}
void DisplayEditString(HWND hWnd, int SI, const TCHAR* tstring)
void DisplayEditString(HWND hWnd, int SI, const wchar_t* tstring)
{
if (SI < 0)
return;
@ -1140,7 +1140,7 @@ int FindLongestLine(HDC hdc, wchar_t* text, SIZE* size)
LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
TCHAR buffer[bufferLen]{};
wchar_t buffer[bufferLen]{};
int ReturnValue = FALSE;
int SelfIndex = FindGrid(GetMenu(hWnd));
@ -1221,13 +1221,13 @@ LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
case WM_SETTEXT:
{
if (lstrlen((TCHAR*)lParam) > 300)
if (lstrlen((wchar_t*)lParam) > 300)
{
wcscpy_s(BGHS[SelfIndex].title, L"Title too long (300 chars max)");
}
else
{
wcscpy_s(BGHS[SelfIndex].title, (TCHAR*)lParam);
wcscpy_s(BGHS[SelfIndex].title, (wchar_t*)lParam);
}
HDC gdc = GetDC(hWnd);
@ -1479,7 +1479,7 @@ LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
if (iDataType == 5) { wcscat_s(buffer, L"G"); }
wcscat_s(buffer, L"|");
wcscat_s(buffer, (TCHAR*)lParam);
wcscat_s(buffer, (wchar_t*)lParam);
int FindResult = static_cast<int32_t>(SendMessage(BGHS[SelfIndex].hlist1, LB_ADDSTRING, 0, reinterpret_cast<LPARAM>(buffer)));
if (FindResult == LB_ERR)
@ -1533,14 +1533,14 @@ LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
holdfont = (HFONT)SelectObject(hdc, BGHS[SelfIndex].hfont);
}
//if there are \n codes in the generic_string, find the longest line
int longestline = FindLongestLine(hdc, (TCHAR*)lParam, &size);
int longestline = FindLongestLine(hdc, (wchar_t*)lParam, &size);
int required_width = longestline + 15;
required_height = size.cy;
//count lines
{
int count = 1;
TCHAR tbuffer[255] = { '\0' };
wcscpy_s(tbuffer, (TCHAR*)lParam);
wchar_t tbuffer[255] = { '\0' };
wcscpy_s(tbuffer, (wchar_t*)lParam);
for (int j = 0; j < (int)lstrlen(tbuffer); j++)
{
if (tbuffer[j] == '\n') { count++; }
@ -1617,7 +1617,7 @@ LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
default: ReturnValue |= 1 << 4; break;
}
TCHAR tbuffer[1000]{};
wchar_t tbuffer[1000]{};
wcscpy_s(tbuffer, buffer);
int k = lstrlen(tbuffer);
int c = 0;
@ -1627,11 +1627,11 @@ LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
c++;
}
buffer[c] = 0x00;
wcscpy_s((TCHAR*)lParam, bufferLen, buffer);
wcscpy_s((wchar_t*)lParam, bufferLen, buffer);
}
else
{
wcscpy_s((TCHAR*)lParam, bufferLen, L"");
wcscpy_s((wchar_t*)lParam, bufferLen, L"");
}
}
break;
@ -2446,13 +2446,13 @@ LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
wParam = ascii;
if ((wParam >= 32) && (wParam <= 125))
{
TCHAR tstring[2];
wchar_t tstring[2];
if (!BGHS[SelfIndex].EDITING)
{
NotifyEditBegin(hWnd, SelfIndex);
}
BGHS[SelfIndex].EDITING = TRUE;
tstring[0] = (TCHAR)wParam;
tstring[0] = (wchar_t)wParam;
tstring[1] = 0x00;
DisplayEditString(hWnd, SelfIndex, tstring);
break;
@ -2930,12 +2930,12 @@ int FindGrid(HMENU menuid)
}
int BinarySearchListBox(HWND lbhWnd, TCHAR* searchtext)
int BinarySearchListBox(HWND lbhWnd, wchar_t* searchtext)
{
const size_t bufLen = 1000;
TCHAR tbuffer[bufLen]{};
TCHAR headtext[bufLen]{};
TCHAR tailtext[bufLen]{};
wchar_t tbuffer[bufLen]{};
wchar_t headtext[bufLen]{};
wchar_t tailtext[bufLen]{};
BOOL FOUND = FALSE;
//get count of items in listbox

View File

@ -49,7 +49,7 @@ public:
::SendMessage(_hSelf, BGM_SETCOLSNUMBERED, isNumbered ? TRUE : FALSE, 0);
}
void setText(size_t row, size_t col, const TCHAR* text) {
void setText(size_t row, size_t col, const wchar_t* text) {
BGCELL cell;
cell.row = int(row);
cell.col = int(col);

View File

@ -92,7 +92,7 @@ void IconList::addIcon(HICON hIcon) const
ImageList_AddIcon(_hImglst, hIcon);
}
bool IconList::changeIcon(size_t index, const TCHAR *iconLocation) const
bool IconList::changeIcon(size_t index, const wchar_t *iconLocation) const
{
HBITMAP hBmp = (HBITMAP)::LoadImage(_hInst, iconLocation, IMAGE_ICON, _iconSize, _iconSize, LR_LOADFROMFILE | LR_LOADMAP3DCOLORS | LR_LOADTRANSPARENT);
if (!hBmp)

View File

@ -42,7 +42,7 @@ public :
void addIcon(int iconID, int cx = 16, int cy = 16, int failIconID = -1) const;
void addIcon(HICON hIcon) const;
bool changeIcon(size_t index, const TCHAR *iconLocation) const;
bool changeIcon(size_t index, const wchar_t *iconLocation) const;
private :
HIMAGELIST _hImglst = nullptr;
@ -142,7 +142,7 @@ public :
return _tbiis[i]._stdIcon;
};
bool replaceIcon(size_t witchList, size_t iconIndex, const TCHAR *iconLocation) const {
bool replaceIcon(size_t witchList, size_t iconIndex, const wchar_t *iconLocation) const {
if ((witchList != HLIST_DEFAULT) && (witchList != HLIST_DISABLE) &&
(witchList != HLIST_DEFAULT2) && (witchList != HLIST_DISABLE2) &&
(witchList != HLIST_DEFAULT_DM) && (witchList != HLIST_DISABLE_DM) &&

View File

@ -72,19 +72,19 @@ public:
void setPanelTitle(std::wstring title) {
_panelTitle = title;
};
const TCHAR * getPanelTitle() const {
const wchar_t * getPanelTitle() const {
return _panelTitle.c_str();
};
void newWorkSpace();
bool saveWorkspaceRequest();
bool openWorkSpace(const TCHAR *projectFileName, bool force = false);
bool openWorkSpace(const wchar_t *projectFileName, bool force = false);
bool saveWorkSpace();
bool saveWorkSpaceAs(bool saveCopyAs);
void setWorkSpaceFilePath(const TCHAR *projectFileName){
void setWorkSpaceFilePath(const wchar_t *projectFileName){
_workSpaceFilePath = projectFileName;
};
const TCHAR * getWorkSpaceFilePath() const {
const wchar_t * getWorkSpaceFilePath() const {
return _workSpaceFilePath.c_str();
};
bool isDirty() const {
@ -118,12 +118,12 @@ protected:
void destroyMenus();
void addFiles(HTREEITEM hTreeItem);
void addFilesFromDirectory(HTREEITEM hTreeItem);
void recursiveAddFilesFrom(const TCHAR *folderPath, HTREEITEM hTreeItem);
HTREEITEM addFolder(HTREEITEM hTreeItem, const TCHAR *folderName);
void recursiveAddFilesFrom(const wchar_t *folderPath, HTREEITEM hTreeItem);
HTREEITEM addFolder(HTREEITEM hTreeItem, const wchar_t *folderName);
bool writeWorkSpace(const TCHAR *projectFileName = NULL, bool doUpdateGUI = true);
std::wstring getRelativePath(const std::wstring & fn, const TCHAR *workSpaceFileName);
void buildProjectXml(TiXmlNode *root, HTREEITEM hItem, const TCHAR* fn2write);
bool writeWorkSpace(const wchar_t *projectFileName = NULL, bool doUpdateGUI = true);
std::wstring getRelativePath(const std::wstring & fn, const wchar_t *workSpaceFileName);
void buildProjectXml(TiXmlNode *root, HTREEITEM hItem, const wchar_t* fn2write);
NodeType getNodeType(HTREEITEM hItem);
void setWorkSpaceDirty(bool isDirty);
void popupMenuCmd(int cmdID);
@ -134,7 +134,7 @@ protected:
void showContextMenu(int x, int y);
void showContextMenuFromMenuKey(HTREEITEM selectedItem, int x, int y);
HMENU getMenuHandler(HTREEITEM selectedItem);
std::wstring getAbsoluteFilePath(const TCHAR * relativePath);
std::wstring getAbsoluteFilePath(const wchar_t * relativePath);
void openSelectFile();
void setFileExtFilter(CustomFileDialog & fDlg);
std::vector<std::wstring*> fullPathStrs;
@ -145,7 +145,7 @@ class FileRelocalizerDlg : public StaticDialog
public :
FileRelocalizerDlg() = default;
int doDialog(const TCHAR *fn, bool isRTL = false);
int doDialog(const wchar_t *fn, bool isRTL = false);
void destroy() override {};

View File

@ -24,7 +24,7 @@
#include <strsafe.h>
void Command::extractArgs(TCHAR* cmd2Exec, size_t cmd2ExecLen, TCHAR* args, size_t argsLen, const TCHAR* cmdEntier)
void Command::extractArgs(wchar_t* cmd2Exec, size_t cmd2ExecLen, wchar_t* args, size_t argsLen, const wchar_t* cmdEntier)
{
size_t i = 0;
bool quoted = false;
@ -74,7 +74,7 @@ void Command::extractArgs(TCHAR* cmd2Exec, size_t cmd2ExecLen, TCHAR* args, size
}
int whichVar(TCHAR *str)
int whichVar(wchar_t *str)
{
if (!lstrcmp(fullCurrentPath, str))
return FULL_CURRENT_PATH;
@ -103,7 +103,7 @@ int whichVar(TCHAR *str)
}
// Since I'm sure the length will be 256, I won't check the lstrlen : watch out!
void expandNppEnvironmentStrs(const TCHAR *strSrc, TCHAR *stringDest, size_t strDestLen, HWND hWnd)
void expandNppEnvironmentStrs(const wchar_t *strSrc, wchar_t *stringDest, size_t strDestLen, HWND hWnd)
{
size_t j = 0;
for (int i = 0, len = lstrlen(strSrc); i < len; ++i)
@ -126,7 +126,7 @@ void expandNppEnvironmentStrs(const TCHAR *strSrc, TCHAR *stringDest, size_t str
{
if (iEnd != -1)
{
TCHAR str[MAX_PATH] = { '\0' };
wchar_t str[MAX_PATH] = { '\0' };
int m = 0;
for (int k = iBegin ; k <= iEnd ; ++k)
str[m++] = strSrc[k];
@ -143,7 +143,7 @@ void expandNppEnvironmentStrs(const TCHAR *strSrc, TCHAR *stringDest, size_t str
}
else
{
TCHAR expandedStr[CURRENTWORD_MAXLENGTH] = { '\0' };
wchar_t expandedStr[CURRENTWORD_MAXLENGTH] = { '\0' };
if (internalVar == CURRENT_LINE || internalVar == CURRENT_COLUMN)
{
size_t lineNumber = ::SendMessage(hWnd, RUNCOMMAND_USER + internalVar, 0, 0);
@ -185,17 +185,17 @@ HINSTANCE Command::run(HWND hWnd)
return run(hWnd, L".");
}
HINSTANCE Command::run(HWND hWnd, const TCHAR* cwd)
HINSTANCE Command::run(HWND hWnd, const wchar_t* cwd)
{
constexpr int argsIntermediateLen = MAX_PATH * 2;
constexpr int args2ExecLen = CURRENTWORD_MAXLENGTH + MAX_PATH * 2;
TCHAR cmdPure[MAX_PATH]{};
TCHAR cmdIntermediate[MAX_PATH]{};
TCHAR cmd2Exec[MAX_PATH]{};
TCHAR args[MAX_PATH]{};
TCHAR argsIntermediate[argsIntermediateLen]{};
TCHAR args2Exec[args2ExecLen]{};
wchar_t cmdPure[MAX_PATH]{};
wchar_t cmdIntermediate[MAX_PATH]{};
wchar_t cmd2Exec[MAX_PATH]{};
wchar_t args[MAX_PATH]{};
wchar_t argsIntermediate[argsIntermediateLen]{};
wchar_t args2Exec[args2ExecLen]{};
extractArgs(cmdPure, MAX_PATH, args, MAX_PATH, _cmdLine.c_str());
int nbTchar = ::ExpandEnvironmentStrings(cmdPure, cmdIntermediate, MAX_PATH);
@ -213,7 +213,7 @@ HINSTANCE Command::run(HWND hWnd, const TCHAR* cwd)
expandNppEnvironmentStrs(cmdIntermediate, cmd2Exec, MAX_PATH, hWnd);
expandNppEnvironmentStrs(argsIntermediate, args2Exec, args2ExecLen, hWnd);
TCHAR cwd2Exec[MAX_PATH]{};
wchar_t cwd2Exec[MAX_PATH]{};
expandNppEnvironmentStrs(cwd, cwd2Exec, MAX_PATH, hWnd);
HINSTANCE res = ::ShellExecute(hWnd, L"open", cmd2Exec, args2Exec, cwd2Exec, SW_SHOW);
@ -330,7 +330,7 @@ intptr_t CALLBACK RunDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam
case IDOK :
{
TCHAR cmd[MAX_PATH]{};
wchar_t cmd[MAX_PATH]{};
::GetDlgItemText(_hSelf, IDC_COMBO_RUN_PATH, cmd, MAX_PATH);
_cmdLine = cmd;
@ -358,7 +358,7 @@ intptr_t CALLBACK RunDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam
DynamicMenu& runMenu = nppParams.getRunMenuItems();
int nbTopLevelItem = runMenu.getTopLevelItemNumber();
TCHAR cmd[MAX_PATH]{};
wchar_t cmd[MAX_PATH]{};
::GetDlgItemText(_hSelf, IDC_COMBO_RUN_PATH, cmd, MAX_PATH);
UserCommand uc(Shortcut(), wstring2string(cmd, CP_UTF8).c_str(), cmdID);
uc.init(_hInst, _hSelf);
@ -424,7 +424,7 @@ intptr_t CALLBACK RunDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam
return FALSE;
}
void RunDlg::addTextToCombo(const TCHAR *txt2Add) const
void RunDlg::addTextToCombo(const wchar_t *txt2Add) const
{
HWND handle = ::GetDlgItem(_hSelf, IDC_COMBO_RUN_PATH);
auto i = ::SendMessage(handle, CB_FINDSTRINGEXACT, static_cast<WPARAM>(-1), reinterpret_cast<LPARAM>(txt2Add));
@ -432,7 +432,7 @@ void RunDlg::addTextToCombo(const TCHAR *txt2Add) const
i = ::SendMessage(handle, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(txt2Add));
::SendMessage(handle, CB_SETCURSEL, i, 0);
}
void RunDlg::removeTextFromCombo(const TCHAR *txt2Remove) const
void RunDlg::removeTextFromCombo(const wchar_t *txt2Remove) const
{
HWND handle = ::GetDlgItem(_hSelf, IDC_COMBO_RUN_PATH);
auto i = ::SendMessage(handle, CB_FINDSTRINGEXACT, static_cast<WPARAM>(-1), reinterpret_cast<LPARAM>(txt2Remove));

View File

@ -21,33 +21,33 @@
#define CURRENTWORD_MAXLENGTH 2048
const TCHAR fullCurrentPath[] = L"FULL_CURRENT_PATH";
const TCHAR currentDirectory[] = L"CURRENT_DIRECTORY";
const TCHAR onlyFileName[] = L"FILE_NAME";
const TCHAR fileNamePart[] = L"NAME_PART";
const TCHAR fileExtPart[] = L"EXT_PART";
const TCHAR currentWord[] = L"CURRENT_WORD";
const TCHAR nppDir[] = L"NPP_DIRECTORY";
const TCHAR nppFullFilePath[] = L"NPP_FULL_FILE_PATH";
const TCHAR currentLine[] = L"CURRENT_LINE";
const TCHAR currentColumn[] = L"CURRENT_COLUMN";
const TCHAR currentLineStr[] = L"CURRENT_LINESTR";
const wchar_t fullCurrentPath[] = L"FULL_CURRENT_PATH";
const wchar_t currentDirectory[] = L"CURRENT_DIRECTORY";
const wchar_t onlyFileName[] = L"FILE_NAME";
const wchar_t fileNamePart[] = L"NAME_PART";
const wchar_t fileExtPart[] = L"EXT_PART";
const wchar_t currentWord[] = L"CURRENT_WORD";
const wchar_t nppDir[] = L"NPP_DIRECTORY";
const wchar_t nppFullFilePath[] = L"NPP_FULL_FILE_PATH";
const wchar_t currentLine[] = L"CURRENT_LINE";
const wchar_t currentColumn[] = L"CURRENT_COLUMN";
const wchar_t currentLineStr[] = L"CURRENT_LINESTR";
int whichVar(TCHAR *str);
void expandNppEnvironmentStrs(const TCHAR *strSrc, TCHAR *stringDest, size_t strDestLen, HWND hWnd);
int whichVar(wchar_t *str);
void expandNppEnvironmentStrs(const wchar_t *strSrc, wchar_t *stringDest, size_t strDestLen, HWND hWnd);
class Command {
public :
Command() = default;
explicit Command(const TCHAR *cmd) : _cmdLine(cmd){};
explicit Command(const wchar_t *cmd) : _cmdLine(cmd){};
explicit Command(const generic_string& cmd) : _cmdLine(cmd){};
HINSTANCE run(HWND hWnd);
HINSTANCE run(HWND hWnd, const TCHAR* cwd);
HINSTANCE run(HWND hWnd, const wchar_t* cwd);
protected :
generic_string _cmdLine;
private :
void extractArgs(TCHAR *cmd2Exec, size_t cmd2ExecLen, TCHAR *args, size_t argsLen, const TCHAR *cmdEntier);
void extractArgs(wchar_t *cmd2Exec, size_t cmd2ExecLen, wchar_t *args, size_t argsLen, const wchar_t *cmdEntier);
};
class RunDlg : public Command, public StaticDialog
@ -62,7 +62,7 @@ protected :
intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) override;
private :
void addTextToCombo(const TCHAR *txt2Add) const;
void removeTextFromCombo(const TCHAR *txt2Remove) const;
void addTextToCombo(const wchar_t *txt2Add) const;
void removeTextFromCombo(const wchar_t *txt2Remove) const;
};

View File

@ -40,8 +40,8 @@ public:
int getHeight() const override;
bool setText(const TCHAR* str, int whichPart);
bool setOwnerDrawText(const TCHAR* str);
bool setText(const wchar_t* str, int whichPart);
bool setOwnerDrawText(const wchar_t* str);
void adjustParts(int clientWidth);

View File

@ -62,7 +62,7 @@ void ControlsTab::reSizeTo(RECT & rc)
}
bool ControlsTab::renameTab(const TCHAR *internalName, const TCHAR *newName)
bool ControlsTab::renameTab(const wchar_t *internalName, const wchar_t *newName)
{
bool foundIt = false;
size_t i = 0;
@ -81,10 +81,10 @@ bool ControlsTab::renameTab(const TCHAR *internalName, const TCHAR *newName)
return true;
}
void ControlsTab::renameTab(size_t index, const TCHAR *newName)
void ControlsTab::renameTab(size_t index, const wchar_t *newName)
{
TCITEM tie;
tie.mask = TCIF_TEXT;
tie.pszText = (TCHAR *)newName;
tie.pszText = (wchar_t *)newName;
TabCtrl_SetItem(_hSelf, index, &tie);
}

View File

@ -27,7 +27,7 @@ struct DlgInfo
generic_string _name;
generic_string _internalName;
DlgInfo(Window *dlg, const TCHAR *name, const TCHAR *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) {};
};
typedef std::vector<DlgInfo> WindowVector;
@ -60,8 +60,8 @@ public :
int indexClicked = int(::SendMessage(_hSelf, TCM_GETCURSEL, 0, 0));
activateWindowAt(indexClicked);
};
void renameTab(size_t index, const TCHAR *newName);
bool renameTab(const TCHAR *internalName, const TCHAR *newName);
void renameTab(size_t index, const wchar_t *newName);
bool renameTab(const wchar_t *internalName, const wchar_t *newName);
private:
WindowVector *_pWinVector = nullptr;

View File

@ -117,7 +117,7 @@ void TabBar::destroy()
}
int TabBar::insertAtEnd(const TCHAR *subTabName)
int TabBar::insertAtEnd(const wchar_t *subTabName)
{
TCITEM tie{};
tie.mask = TCIF_TEXT | TCIF_IMAGE;
@ -126,12 +126,12 @@ int TabBar::insertAtEnd(const TCHAR *subTabName)
if (_hasImgLst)
index = 0;
tie.iImage = index;
tie.pszText = (TCHAR *)subTabName;
tie.pszText = (wchar_t *)subTabName;
return int(::SendMessage(_hSelf, TCM_INSERTITEM, _nbItem++, reinterpret_cast<LPARAM>(&tie)));
}
void TabBar::getCurrentTitle(TCHAR *title, int titleLen)
void TabBar::getCurrentTitle(wchar_t *title, int titleLen)
{
TCITEM tci{};
tci.mask = TCIF_TEXT;
@ -1149,7 +1149,7 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT *pDrawItemStruct, bool isDarkMode)
}
bool isSelected = (nTab == ::SendMessage(_hSelf, TCM_GETCURSEL, 0, 0));
TCHAR label[MAX_PATH] = { '\0' };
wchar_t label[MAX_PATH] = { '\0' };
TCITEM tci{};
tci.mask = TCIF_TEXT|TCIF_IMAGE;
tci.pszText = label;
@ -1398,9 +1398,9 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT *pDrawItemStruct, bool isDarkMode)
// This code will read in one character at a time and remove every first ampersand (&).
// ex. If input "test && test &&& test &&&&" then output will be "test & test && test &&&".
// Tab's caption must be encoded like this because otherwise tab control would make tab too small or too big for the text.
TCHAR decodedLabel[MAX_PATH] = { '\0' };
const TCHAR* in = label;
TCHAR* out = decodedLabel;
wchar_t decodedLabel[MAX_PATH] = { '\0' };
const wchar_t* in = label;
wchar_t* out = decodedLabel;
while (*in != 0)
if (*in == '&')
while (*(++in) == '&')
@ -1460,7 +1460,7 @@ void TabBarPlus::draggingCursor(POINT screenPoint)
::SetCursor(::LoadCursor(NULL, IDC_ARROW));
else
{
TCHAR className[256] = { '\0' };
wchar_t className[256] = { '\0' };
::GetClassName(hWin, className, 256);
if ((!lstrcmp(className, L"Scintilla")) || (!lstrcmp(className, WC_TABCONTROL)))
{
@ -1495,8 +1495,8 @@ void TabBarPlus::exchangeTabItemData(int oldTab, int newTab)
TCITEM itemData_nDraggedTab{}, itemData_shift{};
itemData_nDraggedTab.mask = itemData_shift.mask = TCIF_IMAGE | TCIF_TEXT | TCIF_PARAM;
const int stringSize = 256;
TCHAR str1[stringSize] = { '\0' };
TCHAR str2[stringSize] = { '\0' };
wchar_t str1[stringSize] = { '\0' };
wchar_t str2[stringSize] = { '\0' };
itemData_nDraggedTab.pszText = str1;
itemData_nDraggedTab.cchTextMax = (stringSize);

View File

@ -43,10 +43,10 @@
const int marge = 8;
const int nbCtrlMax = 10;
const TCHAR TABBAR_ACTIVEFOCUSEDINDCATOR[64] = L"Active tab focused indicator";
const TCHAR TABBAR_ACTIVEUNFOCUSEDINDCATOR[64] = L"Active tab unfocused indicator";
const TCHAR TABBAR_ACTIVETEXT[64] = L"Active tab text";
const TCHAR TABBAR_INACTIVETEXT[64] = L"Inactive tabs";
const wchar_t TABBAR_ACTIVEFOCUSEDINDCATOR[64] = L"Active tab focused indicator";
const wchar_t TABBAR_ACTIVEUNFOCUSEDINDCATOR[64] = L"Active tab unfocused indicator";
const wchar_t TABBAR_ACTIVETEXT[64] = L"Active tab text";
const wchar_t TABBAR_INACTIVETEXT[64] = L"Inactive tabs";
constexpr int g_TabIconSize = 16;
constexpr int g_TabHeight = 22;
@ -72,9 +72,9 @@ public:
void destroy() override;
virtual void init(HINSTANCE hInst, HWND hwnd, bool isVertical = false, bool isMultiLine = false);
void reSizeTo(RECT& rc2Ajust) override;
int insertAtEnd(const TCHAR *subTabName);
int insertAtEnd(const wchar_t *subTabName);
void activateAt(int index) const;
void getCurrentTitle(TCHAR *title, int titleLen);
void getCurrentTitle(wchar_t *title, int titleLen);
int32_t getCurrentTabIndex() const {
return static_cast<int32_t>(SendMessage(_hSelf, TCM_GETCURSEL, 0, 0));

View File

@ -103,7 +103,7 @@ RECT TaskList::adjustSize()
int maxwidth = -1;
_rc = { 0, 0, 0, 0 };
TCHAR buf[MAX_PATH] = { '\0' };
wchar_t buf[MAX_PATH] = { '\0' };
for (int i = 0 ; i < _nbItem ; ++i)
{
ListView_GetItemText(_hSelf, i, 0, buf, MAX_PATH);
@ -130,7 +130,7 @@ RECT TaskList::adjustSize()
return _rc;
}
void TaskList::setFont(const TCHAR *fontName, int fontSize)
void TaskList::setFont(const wchar_t *fontName, int fontSize)
{
if (_hFont)
::DeleteObject(_hFont);

View File

@ -38,7 +38,7 @@ public:
virtual ~TaskList() = default;
void init(HINSTANCE hInst, HWND hwnd, HIMAGELIST hImaLst, int nbItem, int index2set);
virtual void destroy();
void setFont(const TCHAR *fontName, int fontSize);
void setFont(const wchar_t *fontName, int fontSize);
RECT adjustSize();
int getCurrentIndex() const {return _currentIndex;}
int updateCurrentIndex();

View File

@ -150,7 +150,7 @@ intptr_t CALLBACK TaskListDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM l
TaskLstFnStatus & fileNameStatus = _taskListInfo._tlfsLst[lvItem.iItem];
lvItem.pszText = (TCHAR *)fileNameStatus._fn.c_str();
lvItem.pszText = (wchar_t *)fileNameStatus._fn.c_str();
lvItem.iImage = fileNameStatus._status;
return TRUE;
@ -200,7 +200,7 @@ void TaskListDlg::drawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
RECT rect = lpDrawItemStruct->rcItem;
HDC hDC = lpDrawItemStruct->hDC;
int nItem = lpDrawItemStruct->itemID;
const TCHAR *label = _taskListInfo._tlfsLst[nItem]._fn.c_str();
const wchar_t *label = _taskListInfo._tlfsLst[nItem]._fn.c_str();
int iImage = _taskListInfo._tlfsLst[nItem]._status;
const int aSpaceWidth = ListView_GetStringWidth(_taskList.getHSelf(), L" ");

View File

@ -91,7 +91,7 @@ public :
return true;
};
bool changeIcons(size_t whichLst, size_t iconIndex, const TCHAR *iconLocation){
bool changeIcons(size_t whichLst, size_t iconIndex, const wchar_t *iconLocation){
return _toolBarIcons.replaceIcon(whichLst, iconIndex, iconLocation);
};

View File

@ -38,7 +38,7 @@ void ToolTip::init(HINSTANCE hInst, HWND hParent)
}
void ToolTip::Show(RECT rectTitle, const TCHAR * pszTitle, int iXOff, int iWidthOff)
void ToolTip::Show(RECT rectTitle, const wchar_t * pszTitle, int iXOff, int iWidthOff)
{
if (isVisible())
destroy();
@ -62,7 +62,7 @@ void ToolTip::Show(RECT rectTitle, const TCHAR * pszTitle, int iXOff, int iWidth
::SendMessage(_hSelf, WM_SETFONT, reinterpret_cast<WPARAM>(_hFont), TRUE);
// Bleuargh... const_cast. Will have to do for now.
_ti.lpszText = const_cast<TCHAR *>(pszTitle);
_ti.lpszText = const_cast<wchar_t *>(pszTitle);
::SendMessage(_hSelf, TTM_ADDTOOL, 0, reinterpret_cast<LPARAM>(&_ti));
::SendMessage(_hSelf, TTM_TRACKPOSITION, 0, MAKELONG(_ti.rect.left + iXOff, _ti.rect.top + iWidthOff));
::SendMessage(_hSelf, TTM_TRACKACTIVATE, true, reinterpret_cast<LPARAM>(&_ti));

View File

@ -35,7 +35,7 @@ public:
};
void init(HINSTANCE hInst, HWND hParent) override;
void Show(RECT rectTitle, const TCHAR* pszTitleText, int iXOff = 0, int iWidthOff = 0);
void Show(RECT rectTitle, const wchar_t* pszTitleText, int iXOff = 0, int iWidthOff = 0);
protected:
BOOL _bTrackMouse = FALSE;

View File

@ -17,7 +17,7 @@
#include "trayIconControler.h"
trayIconControler::trayIconControler(HWND hwnd, UINT uID, UINT uCBMsg, HICON hicon, const TCHAR *tip)
trayIconControler::trayIconControler(HWND hwnd, UINT uID, UINT uCBMsg, HICON hicon, const wchar_t *tip)
{
_nid.cbSize = sizeof(_nid);
_nid.hWnd = hwnd;

View File

@ -29,7 +29,7 @@
class trayIconControler
{
public:
trayIconControler(HWND hwnd, UINT uID, UINT uCBMsg, HICON hicon, const TCHAR *tip);
trayIconControler(HWND hwnd, UINT uID, UINT uCBMsg, HICON hicon, const wchar_t *tip);
int doTrayIcon(DWORD op);
bool isInTray() const {return _isIconShowed;};

View File

@ -125,7 +125,7 @@ LPARAM TreeView::getItemParam(HTREEITEM Item2Get) const
{
if (!Item2Get)
return false;
//TCHAR textBuffer[MAX_PATH];
//wchar_t textBuffer[MAX_PATH];
TVITEM tvItem{};
tvItem.hItem = Item2Get;
tvItem.mask = TVIF_PARAM;
@ -139,7 +139,7 @@ generic_string TreeView::getItemDisplayName(HTREEITEM Item2Set) const
{
if (!Item2Set)
return L"";
TCHAR textBuffer[MAX_PATH] = { '\0' };
wchar_t textBuffer[MAX_PATH] = { '\0' };
TVITEM tvItem{};
tvItem.hItem = Item2Set;
tvItem.mask = TVIF_TEXT;
@ -149,7 +149,7 @@ generic_string TreeView::getItemDisplayName(HTREEITEM Item2Set) const
return tvItem.pszText;
}
bool TreeView::renameItem(HTREEITEM Item2Set, const TCHAR *newName)
bool TreeView::renameItem(HTREEITEM Item2Set, const wchar_t *newName)
{
if (!Item2Set || !newName)
return false;
@ -163,7 +163,7 @@ bool TreeView::renameItem(HTREEITEM Item2Set, const TCHAR *newName)
return true;
}
HTREEITEM TreeView::addItem(const TCHAR *itemName, HTREEITEM hParentItem, int iImage, LPARAM lParam)
HTREEITEM TreeView::addItem(const wchar_t *itemName, HTREEITEM hParentItem, int iImage, LPARAM lParam)
{
TVITEM tvi{};
tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM;
@ -217,7 +217,7 @@ void TreeView::dupTree(HTREEITEM hTree2Dup, HTREEITEM hParentItem)
{
for (HTREEITEM hItem = getChildFrom(hTree2Dup); hItem != NULL; hItem = getNextSibling(hItem))
{
TCHAR textBuffer[MAX_PATH]{};
wchar_t textBuffer[MAX_PATH]{};
TVITEM tvItem{};
tvItem.hItem = hItem;
tvItem.pszText = textBuffer;
@ -234,7 +234,7 @@ void TreeView::dupTree(HTREEITEM hTree2Dup, HTREEITEM hParentItem)
}
}
HTREEITEM TreeView::searchSubItemByName(const TCHAR *itemName, HTREEITEM hParentItem)
HTREEITEM TreeView::searchSubItemByName(const wchar_t *itemName, HTREEITEM hParentItem)
{
HTREEITEM hItem = nullptr;
if (hParentItem != nullptr)
@ -244,7 +244,7 @@ HTREEITEM TreeView::searchSubItemByName(const TCHAR *itemName, HTREEITEM hParent
while (hItem != nullptr)
{
TCHAR textBuffer[MAX_PATH] = { '\0' };
wchar_t textBuffer[MAX_PATH] = { '\0' };
TVITEM tvItem{};
tvItem.hItem = hItem;
tvItem.pszText = textBuffer;
@ -491,7 +491,7 @@ bool TreeView::isParent(HTREEITEM targetItem, HTREEITEM draggedItem)
void TreeView::moveTreeViewItem(HTREEITEM draggedItem, HTREEITEM targetItem)
{
TCHAR textBuffer[MAX_PATH]{};
wchar_t textBuffer[MAX_PATH]{};
TVITEM tvDraggingItem{};
tvDraggingItem.mask = TVIF_TEXT | TVIF_PARAM | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
tvDraggingItem.pszText = textBuffer;
@ -540,8 +540,8 @@ bool TreeView::swapTreeViewItem(HTREEITEM itemGoDown, HTREEITEM itemGoUp)
return false;
// get both item infos
TCHAR textBufferUp[MAX_PATH]{};
TCHAR textBufferDown[MAX_PATH]{};
wchar_t textBufferUp[MAX_PATH]{};
wchar_t textBufferDown[MAX_PATH]{};
TVITEM tvUpItem{};
TVITEM tvDownItem{};
tvUpItem.mask = TVIF_TEXT | TVIF_PARAM | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
@ -636,7 +636,7 @@ bool TreeView::searchLeafRecusivelyAndBuildTree(HTREEITEM tree2Build, const gene
if (!tree2Search)
return false;
TCHAR textBuffer[MAX_PATH] = { '\0' };
wchar_t textBuffer[MAX_PATH] = { '\0' };
TVITEM tvItem{};
tvItem.hItem = tree2Search;
tvItem.pszText = textBuffer;
@ -676,7 +676,7 @@ bool TreeView::retrieveFoldingStateTo(TreeStateNode & treeState2Construct, HTREE
if (!treeviewNode)
return false;
TCHAR textBuffer[MAX_PATH] = { '\0' };
wchar_t textBuffer[MAX_PATH] = { '\0' };
TVITEM tvItem{};
tvItem.hItem = treeviewNode;
tvItem.pszText = textBuffer;

View File

@ -40,14 +40,14 @@ public:
virtual void init(HINSTANCE hInst, HWND parent, int treeViewID);
virtual void destroy();
HTREEITEM addItem(const TCHAR *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);
LPARAM getItemParam(HTREEITEM Item2Get) const;
generic_string getItemDisplayName(HTREEITEM Item2Set) const;
HTREEITEM searchSubItemByName(const TCHAR *itemName, HTREEITEM hParentItem);
HTREEITEM searchSubItemByName(const wchar_t *itemName, HTREEITEM hParentItem);
void removeItem(HTREEITEM hTreeItem);
void removeAllItems();
bool renameItem(HTREEITEM Item2Set, const TCHAR *newName);
bool renameItem(HTREEITEM Item2Set, const wchar_t *newName);
void makeLabelEditable(bool toBeEnabled);
HTREEITEM getChildFrom(HTREEITEM hTreeItem) const {

View File

@ -35,8 +35,8 @@ COLORREF VerticalFileSwitcher::_bgColor = 0xFFFFFF;
int CALLBACK ListViewCompareProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
{
sortCompareData* sortData = (sortCompareData*)lParamSort;
TCHAR str1[MAX_PATH] = { '\0' };
TCHAR str2[MAX_PATH] = { '\0' };
wchar_t str1[MAX_PATH] = { '\0' };
wchar_t str2[MAX_PATH] = { '\0' };
ListView_GetItemText(sortData->hListView, lParam1, sortData->columnIndex, str1, sizeof(str1));
ListView_GetItemText(sortData->hListView, lParam2, sortData->columnIndex, str2, sizeof(str2));
@ -443,7 +443,7 @@ intptr_t CALLBACK VerticalFileSwitcher::run_dlgProc(UINT message, WPARAM wParam,
LPNMHEADER test = (LPNMHEADER)lParam;
HWND hwndHD = ListView_GetHeader(_fileListView.getHSelf());
TCHAR HDtext[MAX_PATH] = { '\0' };
wchar_t HDtext[MAX_PATH] = { '\0' };
HDITEM hdi = {};
hdi.mask = HDI_TEXT | HDI_WIDTH;
hdi.pszText = HDtext;

View File

@ -132,7 +132,7 @@ void VerticalFileSwitcherListView::initList()
TaskLstFnStatus *tl = new TaskLstFnStatus(fileNameStatus);
TCHAR fn[MAX_PATH] = { '\0' };
wchar_t fn[MAX_PATH] = { '\0' };
wcscpy_s(fn, ::PathFindFileName(fileNameStatus._fn.c_str()));
if (isExtColumn)
@ -156,7 +156,7 @@ void VerticalFileSwitcherListView::initList()
}
if (isPathColumn)
{
TCHAR dir[MAX_PATH] = { '\0' }, drive[MAX_PATH] = { '\0' };
wchar_t dir[MAX_PATH] = { '\0' }, drive[MAX_PATH] = { '\0' };
_wsplitpath_s(fileNameStatus._fn.c_str(), drive, MAX_PATH, dir, MAX_PATH, NULL, 0, NULL, 0);
wcscat_s(drive, dir);
ListView_SetItemText(_hSelf, i, ++colIndex2, drive);
@ -218,7 +218,7 @@ void VerticalFileSwitcherListView::setItemIconStatus(BufferID bufferID)
{
Buffer *buf = bufferID;
TCHAR fn[MAX_PATH] = { '\0' };
wchar_t fn[MAX_PATH] = { '\0' };
wcscpy_s(fn, ::PathFindFileName(buf->getFileName()));
bool isExtColumn = !(NppParameters::getInstance()).getNppGUI()._fileSwitcherWithoutExtColumn;
bool isPathColumn = !(NppParameters::getInstance()).getNppGUI()._fileSwitcherWithoutPathColumn;
@ -251,7 +251,7 @@ void VerticalFileSwitcherListView::setItemIconStatus(BufferID bufferID)
}
if (isPathColumn)
{
TCHAR dir[MAX_PATH] = { '\0' }, drive[MAX_PATH] = { '\0' };
wchar_t dir[MAX_PATH] = { '\0' }, drive[MAX_PATH] = { '\0' };
_wsplitpath_s(buf->getFullPathName(), drive, MAX_PATH, dir, MAX_PATH, NULL, 0, NULL, 0);
wcscat_s(drive, dir);
ListView_SetItemText(_hSelf, i, ++colIndex, drive);
@ -329,11 +329,11 @@ int VerticalFileSwitcherListView::add(BufferID bufferID, int iView)
{
_currentIndex = ListView_GetItemCount(_hSelf);
Buffer *buf = bufferID;
const TCHAR *fileName = buf->getFileName();
const wchar_t *fileName = buf->getFileName();
const NppGUI& nppGUI = NppParameters::getInstance().getNppGUI();
TaskLstFnStatus *tl = new TaskLstFnStatus(iView, 0, buf->getFullPathName(), 0, (void *)bufferID, -1);
TCHAR fn[MAX_PATH] = { '\0' };
wchar_t fn[MAX_PATH] = { '\0' };
wcscpy_s(fn, ::PathFindFileName(fileName));
bool isExtColumn = !nppGUI._fileSwitcherWithoutExtColumn;
bool isPathColumn = !nppGUI._fileSwitcherWithoutPathColumn;
@ -358,7 +358,7 @@ int VerticalFileSwitcherListView::add(BufferID bufferID, int iView)
}
if (isPathColumn)
{
TCHAR dir[MAX_PATH] = { '\0' }, drive[MAX_PATH] = { '\0' };
wchar_t dir[MAX_PATH] = { '\0' }, drive[MAX_PATH] = { '\0' };
_wsplitpath_s(buf->getFullPathName(), drive, MAX_PATH, dir, MAX_PATH, NULL, 0, NULL, 0);
wcscat_s(drive, dir);
ListView_SetItemText(_hSelf, _currentIndex, ++colIndex, drive);
@ -422,13 +422,13 @@ int VerticalFileSwitcherListView::find(BufferID bufferID, int iView) const
return (found?i:-1);
}
void VerticalFileSwitcherListView::insertColumn(const TCHAR *name, int width, int index)
void VerticalFileSwitcherListView::insertColumn(const wchar_t *name, int width, int index)
{
LVCOLUMN lvColumn{};
lvColumn.mask = LVCF_TEXT | LVCF_WIDTH;
lvColumn.cx = width;
lvColumn.pszText = (TCHAR *)name;
lvColumn.pszText = (wchar_t *)name;
ListView_InsertColumn(_hSelf, index, &lvColumn); // index is not 0 based but 1 based
}

View File

@ -52,7 +52,7 @@ public:
generic_string getFullFilePath(size_t i) const;
void setItemColor(BufferID bufferID);
void insertColumn(const TCHAR *name, int width, int index);
void insertColumn(const wchar_t *name, int width, int index);
void resizeColumns(int totalWidth);
void deleteColumn(size_t i) {
ListView_DeleteColumn(_hSelf, i);

View File

@ -42,7 +42,7 @@ using namespace std;
#define WD_MENUCOPYNAME "MenuCopyName"
#define WD_MENUCOPYPATH "MenuCopyPath"
static const TCHAR *readonlyString = L" [Read Only]";
static const wchar_t *readonlyString = L" [Read Only]";
const UINT WDN_NOTIFY = RegisterWindowMessage(L"WDN_NOTIFY");
/*
inline static DWORD GetStyle(HWND hWnd) {
@ -74,14 +74,14 @@ inline static BOOL ModifyStyleEx(HWND hWnd, DWORD dwRemove, DWORD dwAdd) {
struct NumericStringEquivalence
{
int operator()(const TCHAR* s1, const TCHAR* s2) const
int operator()(const wchar_t* s1, const wchar_t* s2) const
{
return numstrcmp(s1, s2);
}
static inline int numstrcmp_get(const TCHAR **str, int *length)
static inline int numstrcmp_get(const wchar_t **str, int *length)
{
const TCHAR *p = *str;
const wchar_t *p = *str;
int value = 0;
for (*length = 0; isdigit(*p); ++(*length))
value = value * 10 + *p++ - '0';
@ -89,9 +89,9 @@ struct NumericStringEquivalence
return (value);
}
static int numstrcmp(const TCHAR *str1, const TCHAR *str2)
static int numstrcmp(const wchar_t *str1, const wchar_t *str2)
{
TCHAR *p1 = nullptr, *p2 = nullptr;
wchar_t *p1 = nullptr, *p2 = nullptr;
int c1 = 0, c2 = 0, lcmp = 0;
for (;;)
{
@ -158,8 +158,8 @@ struct BufferEquivalent
if (_iColumn == 0)
{
const TCHAR *s1 = b1->getFileName();
const TCHAR *s2 = b2->getFileName();
const wchar_t *s1 = b1->getFileName();
const wchar_t *s2 = b2->getFileName();
int result = _strequiv(s1, s2);
if (result != 0) // default to filepath sorting when equivalent
@ -168,9 +168,9 @@ struct BufferEquivalent
else if (_iColumn == 2)
{
NppParameters & nppParameters = NppParameters::getInstance();
const TCHAR *s1;
const TCHAR *s2;
//const TCHAR empty[] = ;
const wchar_t *s1;
const wchar_t *s2;
//const wchar_t empty[] = ;
Lang *lang1 = nppParameters.getLangFromID(b1->getLangType());
if (lang1)
@ -204,8 +204,8 @@ struct BufferEquivalent
}
// _iColumn == 1
const TCHAR *s1 = b1->getFullPathName();
const TCHAR *s2 = b2->getFullPathName();
const wchar_t *s1 = b1->getFullPathName();
const wchar_t *s2 = b2->getFullPathName();
return _strequiv(s1, s2) < 0; //we can compare the full path to sort on directory, since after sorting directories sorting files is the second thing to do (if directories are the same that is)
}
return false;
@ -393,8 +393,8 @@ intptr_t CALLBACK WindowsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
}
else if (pLvdi->item.iSubItem == 1) // directory
{
const TCHAR *fullName = buf->getFullPathName();
const TCHAR *fileName = buf->getFileName();
const wchar_t *fullName = buf->getFullPathName();
const wchar_t *fileName = buf->getFileName();
int len = lstrlen(fullName)-lstrlen(fileName);
if (!len) {
len = 1;
@ -602,23 +602,23 @@ BOOL WindowsDlg::onInitDialog()
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
columnText = L"" + pNativeSpeaker->getAttrNameStr(L"Name", WD_ROOTNODE, WD_CLMNNAME);
lvColumn.pszText = const_cast<TCHAR *>(columnText.c_str());
lvColumn.pszText = const_cast<wchar_t *>(columnText.c_str());
lvColumn.cx = width / 4;
SendMessage(_hList, LVM_INSERTCOLUMN, 0, LPARAM(&lvColumn));
columnText = L"" + pNativeSpeaker->getAttrNameStr(L"Path", WD_ROOTNODE, WD_CLMNPATH);
lvColumn.pszText = const_cast<TCHAR *>(columnText.c_str());
lvColumn.pszText = const_cast<wchar_t *>(columnText.c_str());
lvColumn.cx = 300;
SendMessage(_hList, LVM_INSERTCOLUMN, 1, LPARAM(&lvColumn));
lvColumn.fmt = LVCFMT_CENTER;
columnText = L"" + pNativeSpeaker->getAttrNameStr(L"Type", WD_ROOTNODE, WD_CLMNTYPE);
lvColumn.pszText = const_cast<TCHAR *>(columnText.c_str());
lvColumn.pszText = const_cast<wchar_t *>(columnText.c_str());
lvColumn.cx = 100;
SendMessage(_hList, LVM_INSERTCOLUMN, 2, LPARAM(&lvColumn));
columnText = L"" + pNativeSpeaker->getAttrNameStr(L"Size", WD_ROOTNODE, WD_CLMNSIZE);
lvColumn.pszText = const_cast<TCHAR *>(columnText.c_str());
lvColumn.pszText = const_cast<wchar_t *>(columnText.c_str());
lvColumn.cx = 100;
SendMessage(_hList, LVM_INSERTCOLUMN, 3, LPARAM(&lvColumn));
@ -660,7 +660,7 @@ void WindowsDlg::updateColumnNames()
{
columnText = L"" + columnText;
}
lvColumn.pszText = const_cast<TCHAR *>(columnText.c_str());
lvColumn.pszText = const_cast<wchar_t *>(columnText.c_str());
lvColumn.cx = static_cast<int>(SendMessage(_hList, LVM_GETCOLUMNWIDTH, 0, 0));
SendMessage(_hList, LVM_SETCOLUMN, 0, LPARAM(&lvColumn));
@ -677,7 +677,7 @@ void WindowsDlg::updateColumnNames()
{
columnText = L"" + columnText;
}
lvColumn.pszText = const_cast<TCHAR *>(columnText.c_str());
lvColumn.pszText = const_cast<wchar_t *>(columnText.c_str());
lvColumn.cx = static_cast<int>(SendMessage(_hList, LVM_GETCOLUMNWIDTH, 1, 0));
SendMessage(_hList, LVM_SETCOLUMN, 1, LPARAM(&lvColumn));
@ -695,7 +695,7 @@ void WindowsDlg::updateColumnNames()
{
columnText = L"" + columnText;
}
lvColumn.pszText = const_cast<TCHAR *>(columnText.c_str());
lvColumn.pszText = const_cast<wchar_t *>(columnText.c_str());
lvColumn.cx = static_cast<int>(SendMessage(_hList, LVM_GETCOLUMNWIDTH, 2, 0));
SendMessage(_hList, LVM_SETCOLUMN, 2, LPARAM(&lvColumn));
@ -712,7 +712,7 @@ void WindowsDlg::updateColumnNames()
{
columnText = L"" + columnText;
}
lvColumn.pszText = const_cast<TCHAR *>(columnText.c_str());
lvColumn.pszText = const_cast<wchar_t *>(columnText.c_str());
lvColumn.cx = static_cast<int>(SendMessage(_hList, LVM_GETCOLUMNWIDTH, 3, 0));
SendMessage(_hList, LVM_SETCOLUMN, 3, LPARAM(&lvColumn));
}
@ -1167,7 +1167,7 @@ void WindowsMenu::initPopupMenu(HMENU hMenu, DocTabView* pTab)
mii.fMask = MIIM_STRING | MIIM_STATE | MIIM_ID;
generic_string strBuffer(BuildMenuFileName(60, static_cast<int32_t>(pos), buf->getFileName(), !isDropListMenu));
std::vector<TCHAR> vBuffer(strBuffer.begin(), strBuffer.end());
std::vector<wchar_t> vBuffer(strBuffer.begin(), strBuffer.end());
vBuffer.push_back('\0');
mii.dwTypeData = (&vBuffer[0]);

View File

@ -331,7 +331,7 @@ void getNameStrFromCmd(DWORD cmd, wstring & str)
else
{
HWND hNotepad_plus = ::FindWindow(Notepad_plus_Window::getClassName(), NULL);
TCHAR cmdName[menuItemStrLenMax];
wchar_t cmdName[menuItemStrLenMax];
HMENU m = reinterpret_cast<HMENU>(::SendMessage(hNotepad_plus, NPPM_INTERNAL_GETMENU, 0, 0));
int nbChar = ::GetMenuString(m, cmd, cmdName, menuItemStrLenMax, MF_BYCOMMAND);
if (!nbChar)
@ -496,7 +496,7 @@ intptr_t CALLBACK Shortcut::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPar
if (_canModifyName)
{
TCHAR editName[menuItemStrLenMax]{};
wchar_t editName[menuItemStrLenMax]{};
::SendDlgItemMessage(_hSelf, IDC_NAME_EDIT, WM_GETTEXT, menuItemStrLenMax, reinterpret_cast<LPARAM>(editName));
setName(wstring2string(editName, CP_UTF8).c_str());
}
@ -984,7 +984,7 @@ void ScintillaAccelerator::updateKeys()
void ScintillaAccelerator::updateMenuItemByID(const ScintillaKeyMap& skm, int id)
{
TCHAR cmdName[menuItemStrLenMax];
wchar_t cmdName[menuItemStrLenMax];
::GetMenuString(_hAccelMenu, id, cmdName, menuItemStrLenMax, MF_BYCOMMAND);
int i = 0;
while (cmdName[i] != 0)

View File

@ -194,8 +194,8 @@ public:
unsigned long getID() const {return _id;};
void setID(unsigned long id) { _id = id;};
int getNth() const { return _nth; };
const TCHAR * getCategory() const { return _category.c_str(); };
const TCHAR * getShortcutName() const { return _shortcutName.c_str(); };
const wchar_t * getCategory() const { return _category.c_str(); };
const wchar_t * getShortcutName() const { return _shortcutName.c_str(); };
private :
unsigned long _id = 0;