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/TooltipNotify/src/Tooltip.cpp | 6 ++-- plugins/TooltipNotify/src/Tooltip.h | 6 ++-- plugins/TooltipNotify/src/TooltipNotify.cpp | 56 ++++++++++++++--------------- plugins/TooltipNotify/src/TooltipNotify.h | 4 +-- plugins/TooltipNotify/src/Utils.cpp | 8 ++--- plugins/TooltipNotify/src/Utils.h | 2 +- 6 files changed, 41 insertions(+), 41 deletions(-) (limited to 'plugins/TooltipNotify') diff --git a/plugins/TooltipNotify/src/Tooltip.cpp b/plugins/TooltipNotify/src/Tooltip.cpp index 2b5cc39063..9f9edc03e4 100644 --- a/plugins/TooltipNotify/src/Tooltip.cpp +++ b/plugins/TooltipNotify/src/Tooltip.cpp @@ -4,7 +4,7 @@ #include "stdafx.h" -/*static*/ const TCHAR *CTooltip::s_szTooltipClass = L"MimTooltipNotify"; +/*static*/ const wchar_t *CTooltip::s_szTooltipClass = L"MimTooltipNotify"; ////////////////////////////////////////////////////////////////////// // Construction/Destruction @@ -192,9 +192,9 @@ void CTooltip::set_Position(INT x, INT y) SetWindowPos(m_hWnd, 0, x, y, 0, 0, SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSIZE); } -void CTooltip::set_Text(const TCHAR* szText) +void CTooltip::set_Text(const wchar_t* szText) { if (m_szText) free(m_szText); - m_szText = _tcsdup(szText); + m_szText = wcsdup(szText); } diff --git a/plugins/TooltipNotify/src/Tooltip.h b/plugins/TooltipNotify/src/Tooltip.h index 2ad5bea397..9e47040bf6 100644 --- a/plugins/TooltipNotify/src/Tooltip.h +++ b/plugins/TooltipNotify/src/Tooltip.h @@ -19,7 +19,7 @@ public: void get_Rect(RECT *Rect) const; void set_TransparentInput(BOOL bOnOff); void set_Translucency(BYTE bAlpha); - void set_Text(const TCHAR* szText); + void set_Text(const wchar_t* szText); void set_Font(const LOGFONT& Font) { m_lfFont = Font; } void set_TextColor(DWORD TextColor) { m_dwTextColor = TextColor; } void set_BgColor(DWORD BgColor) { m_dwBgColor = BgColor; } @@ -43,11 +43,11 @@ private: DWORD m_dwTextColor; DWORD m_dwBgColor; LOGFONT m_lfFont; - TCHAR *m_szText; + wchar_t *m_szText; BYTE m_bAlpha; BOOL m_bTranspInput; BYTE m_bLDblClick; CTooltipNotify *m_pTooltipNotify; - static const TCHAR *s_szTooltipClass; + static const wchar_t *s_szTooltipClass; }; diff --git a/plugins/TooltipNotify/src/TooltipNotify.cpp b/plugins/TooltipNotify/src/TooltipNotify.cpp index 439ca55f58..3bb08f45ad 100644 --- a/plugins/TooltipNotify/src/TooltipNotify.cpp +++ b/plugins/TooltipNotify/src/TooltipNotify.cpp @@ -20,17 +20,17 @@ static const int ID_TTNTF_STATUS_TYPING = ID_STATUS_INVISIBLE + 10; static const int ID_TTNTF_STATUS_IDLE = ID_STATUS_INVISIBLE + 11; static const int ID_TTNTF_STATUS_NOT_IDLE = ID_STATUS_INVISIBLE + 12; -#define FONTSERV_GROUP LPGENT("Tooltip Notify") -#define FONTSERV_ONLINE LPGENT("Online") -#define FONTSERV_OFFLINE LPGENT("Offline") -#define FONTSERV_OTHER LPGENT("Other status") -#define FONTSERV_TYPING LPGENT("Typing") -#define FONTSERV_IDLE LPGENT("Idle") +#define FONTSERV_GROUP LPGENW("Tooltip Notify") +#define FONTSERV_ONLINE LPGENW("Online") +#define FONTSERV_OFFLINE LPGENW("Offline") +#define FONTSERV_OTHER LPGENW("Other status") +#define FONTSERV_TYPING LPGENW("Typing") +#define FONTSERV_IDLE LPGENW("Idle") struct FontEntry { int status; - TCHAR* name; + wchar_t* name; char* fontPrefix; char* clrPrefix; }; @@ -73,31 +73,31 @@ CTooltipNotify::~CTooltipNotify() void CTooltipNotify::RegisterFonts() { FontIDT fontId = { sizeof(fontId) }; - _tcsncpy(fontId.group, FONTSERV_GROUP, _countof(fontId.group) - 1); + wcsncpy(fontId.group, FONTSERV_GROUP, _countof(fontId.group) - 1); strncpy(fontId.dbSettingsGroup, MODULENAME, _countof(fontId.dbSettingsGroup) - 1); fontId.flags = FIDF_DEFAULTVALID; fontId.deffontsettings.colour = DEF_SETTING_TXTCOLOR; fontId.deffontsettings.size = -MulDiv(DEF_SETTING_FONT_SIZE, DEF_LOGPIXELSY, 72); fontId.deffontsettings.style = DEF_SETTING_FONT_STYLE; fontId.deffontsettings.charset = DEF_SETTING_FONT_CHARSET; - _tcsncpy(fontId.deffontsettings.szFace, DEF_SETTING_FONT_FACE, _countof(fontId.deffontsettings.szFace) - 1); + wcsncpy(fontId.deffontsettings.szFace, DEF_SETTING_FONT_FACE, _countof(fontId.deffontsettings.szFace) - 1); fontId.order = 0; - _tcsncpy(fontId.backgroundGroup, FONTSERV_GROUP, _countof(fontId.backgroundGroup) - 1); + wcsncpy(fontId.backgroundGroup, FONTSERV_GROUP, _countof(fontId.backgroundGroup) - 1); ColourIDT colorId = { sizeof(colorId) }; - _tcsncpy(colorId.group, FONTSERV_GROUP, _countof(colorId.group) - 1); + wcsncpy(colorId.group, FONTSERV_GROUP, _countof(colorId.group) - 1); strncpy(colorId.dbSettingsGroup, MODULENAME, _countof(colorId.dbSettingsGroup) - 1); colorId.flags = 0; colorId.defcolour = DEF_SETTING_BGCOLOR; colorId.order = 0; for (int i = 0; i < _countof(s_fontTable); i++) { - _tcsncpy(fontId.name, s_fontTable[i].name, _countof(fontId.name) - 1); + wcsncpy(fontId.name, s_fontTable[i].name, _countof(fontId.name) - 1); strncpy(fontId.prefix, s_fontTable[i].fontPrefix, _countof(fontId.prefix) - 1); - _tcsncpy(fontId.backgroundName, s_fontTable[i].name, _countof(fontId.backgroundName) - 1); + wcsncpy(fontId.backgroundName, s_fontTable[i].name, _countof(fontId.backgroundName) - 1); ::FontRegisterT(&fontId); - _tcsncpy(colorId.name, s_fontTable[i].name, _countof(colorId.name) - 1); + wcsncpy(colorId.name, s_fontTable[i].name, _countof(colorId.name) - 1); strncpy(colorId.setting, s_fontTable[i].clrPrefix, _countof(colorId.setting) - 1); ::ColourRegisterT(&colorId); } @@ -105,7 +105,7 @@ void CTooltipNotify::RegisterFonts() void CTooltipNotify::GetFont(int iStatus, LOGFONT* lf, COLORREF* text, COLORREF* bg) { - TCHAR* fontName = 0; + wchar_t* fontName = 0; for (int i = 0; i < _countof(s_fontTable); i++) { if (s_fontTable[i].status == iStatus) { fontName = s_fontTable[i].name; @@ -117,10 +117,10 @@ void CTooltipNotify::GetFont(int iStatus, LOGFONT* lf, COLORREF* text, COLORREF* // name and group only FontIDT fontId = { sizeof(fontId), FONTSERV_GROUP, 0 }; - _tcsncpy(fontId.name, fontName, _countof(fontId.name) - 1); + wcsncpy(fontId.name, fontName, _countof(fontId.name) - 1); *text = (COLORREF)::CallService(MS_FONT_GETT, (WPARAM)&fontId, (LPARAM)lf); ColourIDT colorId = { sizeof(colorId), FONTSERV_GROUP, 0 }; - _tcsncpy(colorId.name, fontName, _countof(colorId.name) - 1); + wcsncpy(colorId.name, fontName, _countof(colorId.name) - 1); *bg = (COLORREF)::CallService(MS_COLOUR_GETT, (WPARAM)&colorId, 0); } @@ -276,7 +276,7 @@ int CTooltipNotify::InitializeOptions(WPARAM wParam, LPARAM) CTooltip *CTooltipNotify::BeginNotify(STooltipData *pTooltipData) { - TCHAR szTooltipText[64] = { 0 }; + wchar_t szTooltipText[64] = { 0 }; MakeTooltipString(pTooltipData->hContact, pTooltipData->iStatus, szTooltipText, 64); LOGFONT lf = { 0 }; @@ -536,7 +536,7 @@ BOOL CTooltipNotify::OptionsDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM l case WM_VSCROLL: case WM_HSCROLL: - TCHAR str[10]; + wchar_t str[10]; mir_sntprintf(str, L"%d%%", 100 * SendDlgItemMessage(hDlg, IDC_TRANSPARENCY_SLIDER, TBM_GETPOS, 0, 0) / 255); SetDlgItemText(hDlg, IDC_TRANSPERC, str); if (wParam != 0x12345678) @@ -674,7 +674,7 @@ BOOL CTooltipNotify::ProtosDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM) int proto_count = ListView_GetItemCount(GetDlgItem(hDlg, IDC_PROTOS)); for (int i = 0; i < proto_count; i++) { - TCHAR szProto[64]; + wchar_t szProto[64]; ListView_GetItemText(GetDlgItem(hDlg, IDC_PROTOS), i, 0, szProto, _countof(szProto)); @@ -796,7 +796,7 @@ BOOL CTooltipNotify::ContactsDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM) } -TCHAR* CTooltipNotify::StatusToString(int iStatus, TCHAR *szStatus, int iBufSize) +wchar_t* CTooltipNotify::StatusToString(int iStatus, wchar_t *szStatus, int iBufSize) { if (iStatus >= ID_STATUS_OFFLINE && iStatus <= ID_STATUS_OUTTOLUNCH) mir_tstrncpy(szStatus, pcli->pfnGetStatusModeDescription(iStatus, 0), iBufSize); @@ -822,24 +822,24 @@ TCHAR* CTooltipNotify::StatusToString(int iStatus, TCHAR *szStatus, int iBufSize return szStatus; } -TCHAR* CTooltipNotify::MakeTooltipString(MCONTACT hContact, int iStatus, TCHAR *szString, int iBufSize) +wchar_t* CTooltipNotify::MakeTooltipString(MCONTACT hContact, int iStatus, wchar_t *szString, int iBufSize) { - TCHAR szStatus[32]; + wchar_t szStatus[32]; StatusToString(iStatus, szStatus, _countof(szStatus)); // "proro: user is online" - const TCHAR *szFormatString = m_sOptions.bPrefixProto ? L"%s%s%s" : L"%.0s%.0s%s"; - const TCHAR* szIs = TranslateT("is"); + const wchar_t *szFormatString = m_sOptions.bPrefixProto ? L"%s%s%s" : L"%.0s%.0s%s"; + const wchar_t* szIs = TranslateT("is"); const char* szProto = hContact == 0 ? "Proto" : ::GetContactProto(hContact); - const TCHAR* szContactName = ::pcli->pfnGetContactDisplayName(hContact, 0); + const wchar_t* szContactName = ::pcli->pfnGetContactDisplayName(hContact, 0); - memset(szString, 0, iBufSize*sizeof(TCHAR)); + memset(szString, 0, iBufSize*sizeof(wchar_t)); WCHAR wszProto[32]; long lLen = MultiByteToWideChar(CP_ACP, 0, szProto, (int)mir_strlen(szProto), wszProto, _countof(wszProto)); - wszProto[lLen] = _T('\0'); + wszProto[lLen] = '\0'; mir_sntprintf(szString, iBufSize - 1, szFormatString, wszProto, L": ", szContactName); diff --git a/plugins/TooltipNotify/src/TooltipNotify.h b/plugins/TooltipNotify/src/TooltipNotify.h index 50f507da31..793d1d6500 100644 --- a/plugins/TooltipNotify/src/TooltipNotify.h +++ b/plugins/TooltipNotify/src/TooltipNotify.h @@ -87,8 +87,8 @@ private: MapTimerIdProtoIter FindProtoByTimer(UINT idTimer); template TooltipsListIter FindBy(T STooltipData::* m, const T& value); - TCHAR *StatusToString(int iStatus, TCHAR *szStatus, int iBufSize); - TCHAR *MakeTooltipString(MCONTACT hContact, int iStatus, TCHAR *szString, int iBufSize); + wchar_t *StatusToString(int iStatus, wchar_t *szStatus, int iBufSize); + wchar_t *MakeTooltipString(MCONTACT hContact, int iStatus, wchar_t *szString, int iBufSize); void MigrateSettings(); void RegisterFonts(); void GetFont(int iStatus, LOGFONT* lf, COLORREF* text, COLORREF* bg); diff --git a/plugins/TooltipNotify/src/Utils.cpp b/plugins/TooltipNotify/src/Utils.cpp index c0d4a25fc8..4d102f9822 100644 --- a/plugins/TooltipNotify/src/Utils.cpp +++ b/plugins/TooltipNotify/src/Utils.cpp @@ -11,14 +11,14 @@ BOOL IsNt50() return (bMajorVer>=5); } -void TruncateWithDots(TCHAR* szString, size_t iNewLen) +void TruncateWithDots(wchar_t* szString, size_t iNewLen) { size_t iOrigLen = mir_tstrlen(szString); if (iNewLen < iOrigLen) { - TCHAR* p = szString+iNewLen; - *p = _T('\0'); + wchar_t* p = szString+iNewLen; + *p = '\0'; for(int i=0; --p>=szString && i<3; i++) - *p = _T('.'); + *p = '.'; } } diff --git a/plugins/TooltipNotify/src/Utils.h b/plugins/TooltipNotify/src/Utils.h index b0baf7c0da..36270e8311 100644 --- a/plugins/TooltipNotify/src/Utils.h +++ b/plugins/TooltipNotify/src/Utils.h @@ -3,4 +3,4 @@ // BOOL IsNt50(); -void TruncateWithDots(TCHAR* szString, size_t iNewLen); \ No newline at end of file +void TruncateWithDots(wchar_t* szString, size_t iNewLen); -- cgit v1.2.3