From 6e53dfca72b932c4bdcd7aa02ca62bf8b2630eac Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 26 Jul 2016 09:20:25 +0000 Subject: less TCHARs: - TCHAR is replaced with wchar_t everywhere; - LPGENT replaced with either LPGENW or LPGEN; - fixes for ANSI plugins that improperly used _t functions; - TCHAR *t removed from MAllStrings; - ptszGroup, ptszTitle & ptszTab in OPTIONSDIALOGPAGE replaced with pwsz* git-svn-id: http://svn.miranda-ng.org/main/trunk@17133 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/mTextControl/src/FormattedTextDraw.cpp | 10 +++++----- plugins/mTextControl/src/FormattedTextDraw.h | 2 +- plugins/mTextControl/src/fancy_rtf.cpp | 18 +++++++++--------- plugins/mTextControl/src/richeditutils.cpp | 2 +- plugins/mTextControl/src/stdafx.h | 6 ++++-- plugins/mTextControl/src/textcontrol.cpp | 6 +++--- 6 files changed, 23 insertions(+), 21 deletions(-) (limited to 'plugins/mTextControl') diff --git a/plugins/mTextControl/src/FormattedTextDraw.cpp b/plugins/mTextControl/src/FormattedTextDraw.cpp index 8bce9290e3..61bd51534a 100644 --- a/plugins/mTextControl/src/FormattedTextDraw.cpp +++ b/plugins/mTextControl/src/FormattedTextDraw.cpp @@ -120,7 +120,7 @@ HRESULT CFormattedTextDraw::putTextA(char *newVal) cf.cbSize = sizeof(cf); cf.dwMask = CFM_FACE | CFM_BOLD; cf.dwEffects = 0; - _tcsncpy_s(cf.szFaceName, L"MS Shell Dlg", _TRUNCATE); + wcsncpy_s(cf.szFaceName, L"MS Shell Dlg", _TRUNCATE); m_spTextServices->TxSendMessage(EM_SETCHARFORMAT, (WPARAM)(SCF_ALL), (LPARAM)&cf, &lResult); return S_OK; @@ -148,7 +148,7 @@ HRESULT CFormattedTextDraw::putTextW(WCHAR *newVal) cf.cbSize = sizeof(cf); cf.dwMask = CFM_FACE | CFM_BOLD; cf.dwEffects = 0; - _tcsncpy_s(cf.szFaceName, L"MS Shell Dlg", _TRUNCATE); + wcsncpy_s(cf.szFaceName, L"MS Shell Dlg", _TRUNCATE); m_spTextServices->TxSendMessage(EM_SETCHARFORMAT, (WPARAM)(SCF_ALL), (LPARAM)&cf, &lResult); return S_OK; } @@ -170,7 +170,7 @@ HRESULT CFormattedTextDraw::Draw(void *hdcDraw, RECT *prc) cf.crTextColor = GetTextColor((HDC)hdcDraw); cf.bCharSet = lf.lfCharSet; cf.yHeight = 1440 * abs(lf.lfHeight) / GetDeviceCaps((HDC)hdcDraw, LOGPIXELSY); - _tcsncpy_s(cf.szFaceName, lf.lfFaceName, _TRUNCATE); + wcsncpy_s(cf.szFaceName, lf.lfFaceName, _TRUNCATE); m_spTextServices->TxSendMessage(EM_SETCHARFORMAT, (WPARAM)(SCF_ALL), (LPARAM)&cf, &lResult); m_spTextServices->TxDraw( @@ -211,7 +211,7 @@ HRESULT CFormattedTextDraw::get_NaturalSize(void *hdcDraw, long *Width, long *He cf.crTextColor = GetTextColor((HDC)hdcDraw); cf.bCharSet = lf.lfCharSet; cf.yHeight = 1440 * abs(lf.lfHeight) / GetDeviceCaps((HDC)hdcDraw, LOGPIXELSY); - _tcsncpy_s(cf.szFaceName, lf.lfFaceName, _TRUNCATE); + wcsncpy_s(cf.szFaceName, lf.lfFaceName, _TRUNCATE); if (!m_spTextServices) return S_FALSE; @@ -384,7 +384,7 @@ HRESULT CFormattedTextDraw::TxGetScrollBars(DWORD *pdwScrollBar) return S_OK; } -HRESULT CFormattedTextDraw::TxGetPasswordChar(TCHAR *) +HRESULT CFormattedTextDraw::TxGetPasswordChar(wchar_t *) { return S_FALSE; } diff --git a/plugins/mTextControl/src/FormattedTextDraw.h b/plugins/mTextControl/src/FormattedTextDraw.h index 0eeaa850bb..8f318717e6 100644 --- a/plugins/mTextControl/src/FormattedTextDraw.h +++ b/plugins/mTextControl/src/FormattedTextDraw.h @@ -151,7 +151,7 @@ public: HRESULT TxGetBackStyle(TXTBACKSTYLE *pstyle); HRESULT TxGetMaxLength(DWORD *plength); HRESULT TxGetScrollBars(DWORD *pdwScrollBar); - HRESULT TxGetPasswordChar(TCHAR *pch); + HRESULT TxGetPasswordChar(wchar_t *pch); HRESULT TxGetAcceleratorPos(LONG *pcp); HRESULT TxGetExtent(LPSIZEL lpExtent); HRESULT OnTxCharFormatChange(const CHARFORMATW * pcf); diff --git a/plugins/mTextControl/src/fancy_rtf.cpp b/plugins/mTextControl/src/fancy_rtf.cpp index a210632700..17f5f76dba 100644 --- a/plugins/mTextControl/src/fancy_rtf.cpp +++ b/plugins/mTextControl/src/fancy_rtf.cpp @@ -2,9 +2,9 @@ struct BBCodeInfo { - TCHAR *start; - TCHAR *end; - bool(*func)(IFormattedTextDraw *ftd, CHARRANGE range, TCHAR *txt, DWORD cookie); + wchar_t *start; + wchar_t *end; + bool(*func)(IFormattedTextDraw *ftd, CHARRANGE range, wchar_t *txt, DWORD cookie); DWORD cookie; }; @@ -14,7 +14,7 @@ enum { BBS_IMG1, BBS_IMG2 }; -static bool bbCodeSimpleFunc(IFormattedTextDraw *ftd, CHARRANGE range, TCHAR *, DWORD cookie) +static bool bbCodeSimpleFunc(IFormattedTextDraw *ftd, CHARRANGE range, wchar_t *, DWORD cookie) { CHARFORMAT cf = { 0 }; cf.cbSize = sizeof(cf); @@ -60,7 +60,7 @@ static bool bbCodeSimpleFunc(IFormattedTextDraw *ftd, CHARRANGE range, TCHAR *, return true; } -static bool bbCodeImageFunc(IFormattedTextDraw *ftd, CHARRANGE range, TCHAR *txt, DWORD) +static bool bbCodeImageFunc(IFormattedTextDraw *ftd, CHARRANGE range, wchar_t *txt, DWORD) { ITextServices *ts = ftd->getTextService(); ITextDocument *td = ftd->getTextDocument(); @@ -73,9 +73,9 @@ static bool bbCodeImageFunc(IFormattedTextDraw *ftd, CHARRANGE range, TCHAR *txt td->Freeze(&cnt); #ifdef _WIN64 - bool res = InsertBitmap(RichEditOle, CacheIconToEmf((HICON)_tstoi64(txt))); + bool res = InsertBitmap(RichEditOle, CacheIconToEmf((HICON)_wtoi64(txt))); #else - bool res = InsertBitmap(RichEditOle, CacheIconToEmf((HICON)_ttoi(txt))); + bool res = InsertBitmap(RichEditOle, CacheIconToEmf((HICON)_wtoi(txt))); #endif td->Unfreeze(&cnt); @@ -115,7 +115,7 @@ void bbCodeParse(IFormattedTextDraw *ftd) for (bool found = true; found;) { found = false; CHARRANGE fRange; fRange.cpMin = -1; - TCHAR *fText = 0; + wchar_t *fText = 0; BBCodeInfo *fBBCode = NULL; for (int i = 0; i < bbCodeCount; i++) { @@ -154,7 +154,7 @@ void bbCodeParse(IFormattedTextDraw *ftd) TEXTRANGE trg; trg.chrg.cpMin = fte.chrg.cpMin; trg.chrg.cpMax = fte.chrgText.cpMin; - trg.lpstrText = new TCHAR[trg.chrg.cpMax - trg.chrg.cpMin + 1]; + trg.lpstrText = new wchar_t[trg.chrg.cpMax - trg.chrg.cpMin + 1]; ts->TxSendMessage(EM_GETTEXTRANGE, 0, (LPARAM)&trg, &lResult); fText = trg.lpstrText; } diff --git a/plugins/mTextControl/src/richeditutils.cpp b/plugins/mTextControl/src/richeditutils.cpp index d94785d475..3f3614dc1b 100644 --- a/plugins/mTextControl/src/richeditutils.cpp +++ b/plugins/mTextControl/src/richeditutils.cpp @@ -76,7 +76,7 @@ public: HRESULT STDMETHODCALLTYPE GetNewStorage(LPSTORAGE * lplpstg) { - TCHAR sztName[64]; + wchar_t sztName[64]; mir_sntprintf(sztName, L"s%u", this->nextStgId); if (this->pictStg == NULL) return STG_E_MEDIUMFULL; diff --git a/plugins/mTextControl/src/stdafx.h b/plugins/mTextControl/src/stdafx.h index e46827e586..3840d89738 100644 --- a/plugins/mTextControl/src/stdafx.h +++ b/plugins/mTextControl/src/stdafx.h @@ -47,8 +47,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "fancy_rtf.h" #include "textcontrol.h" -#define MODULNAME "MTextControl" //DB modul for this plugin -#define MODULTITLE "Text Display" +#define MODULNAME "MTextControl" // DB module for this plugin +#define MODULNAMEW L"MTextControl" // DB module for this plugin + +#define MODULTITLE "Text Display" // globals extern HINSTANCE hInst; diff --git a/plugins/mTextControl/src/textcontrol.cpp b/plugins/mTextControl/src/textcontrol.cpp index daf7b6ad71..4dad57ec55 100644 --- a/plugins/mTextControl/src/textcontrol.cpp +++ b/plugins/mTextControl/src/textcontrol.cpp @@ -26,7 +26,7 @@ LRESULT MTextControl_OnPaint(HWND hwnd, WPARAM wParam, LPARAM lParam); struct TextControlData { HANDLE htu; - TCHAR *text; + wchar_t *text; HANDLE mtext; }; @@ -43,7 +43,7 @@ void MTextControl_RegisterClass() wcl.hCursor = LoadCursor(NULL, IDC_ARROW); wcl.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH); wcl.lpszMenuName = NULL; - wcl.lpszClassName = _T(MODULNAME); + wcl.lpszClassName = MODULNAMEW; wcl.hIconSm = 0; RegisterClassEx(&wcl); } @@ -74,7 +74,7 @@ LRESULT CALLBACK MTextControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM if (data->mtext) MTI_MTextDestroy(data->mtext); { int textLength = GetWindowTextLength(hwnd); - data->text = new TCHAR[textLength + 1]; + data->text = new wchar_t[textLength + 1]; GetWindowText(hwnd, data->text, textLength + 1); data->mtext = MTI_MTextCreateW(data->htu, data->text); -- cgit v1.2.3