From 05c989e58aeffcfb59cebaca6797cb69dd25cb1e Mon Sep 17 00:00:00 2001 From: Vadim Dashevskiy Date: Sat, 16 Jun 2012 14:33:30 +0000 Subject: another portion of "#ifdef Unicode" removal git-svn-id: http://svn.miranda-ng.org/main/trunk@446 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/TooltipNotify/src/TooltipNotify.cpp | 24 ++++++++---------------- plugins/TooltipNotify/src/main.cpp | 12 ++++-------- 2 files changed, 12 insertions(+), 24 deletions(-) (limited to 'plugins/TooltipNotify') diff --git a/plugins/TooltipNotify/src/TooltipNotify.cpp b/plugins/TooltipNotify/src/TooltipNotify.cpp index d21cae65d2..d4864c96d5 100644 --- a/plugins/TooltipNotify/src/TooltipNotify.cpp +++ b/plugins/TooltipNotify/src/TooltipNotify.cpp @@ -725,16 +725,14 @@ BOOL CTooltipNotify::ProtosDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP lvi.iSubItem = 0; lvi.iItem = i; lvi.lParam = i; -#ifdef _UNICODE + WCHAR wszProto[128]; long lLen = MultiByteToWideChar(CP_ACP, 0, ppProtos[i]->szName, (int)strlen(ppProtos[i]->szName), wszProto, ARRAY_SIZE(wszProto)); wszProto[lLen] = L'\0'; lvi.pszText = wszProto; -#else - lvi.pszText = ppProtos[lvi.iItem]->szName; -#endif + int new_item = ListView_InsertItem(GetDlgItem(hDlg,IDC_PROTOS),&lvi); BYTE bProtoState = ReadSettingByte(ppProtos[i]->szName, ProtoUserBit|ProtoIntBit); @@ -762,24 +760,20 @@ BOOL CTooltipNotify::ProtosDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP TCHAR szProto[64]; ListView_GetItemText(GetDlgItem(hDlg,IDC_PROTOS), i, 0, szProto, ARRAY_SIZE(szProto)); -#ifdef _UNICODE + char szMultiByteProto[128]; long lLen = WideCharToMultiByte(CP_ACP, 0, szProto, lstrlen(szProto), szMultiByteProto, sizeof(szMultiByteProto), NULL, NULL); szMultiByteProto[lLen] = '\0'; BYTE bProtoState = ReadSettingByte(szMultiByteProto, ProtoUserBit|ProtoIntBit); -#else - BYTE bProtoState = ReadSettingByte(szProto, ProtoUserBit|ProtoIntBit); -#endif + BOOL bProtoEnabled = ListView_GetCheckState(GetDlgItem(hDlg,IDC_PROTOS), i); bProtoState = bProtoEnabled ? bProtoState|ProtoUserBit : bProtoState&~ProtoUserBit; -#ifdef _UNICODE + WriteSettingByte(szMultiByteProto, bProtoState); -#else - WriteSettingByte(szProto, bProtoState); -#endif + } EndDialog(hDlg, LOWORD(wParam)); @@ -1007,15 +1001,13 @@ TCHAR *CTooltipNotify::MakeTooltipString(HANDLE hContact, int iStatus, TCHAR *sz memset(szString, 0, iBufSize*sizeof(TCHAR)); -#ifdef _UNICODE + WCHAR wszProto[32]; long lLen = MultiByteToWideChar(CP_ACP, 0, szProto, (int)strlen(szProto), wszProto, ARRAY_SIZE(wszProto)); wszProto[lLen] = _T('\0'); _sntprintf(szString, iBufSize-1, szFormatString, wszProto, _T(": "), szContactName); -#else - _sntprintf(szString, iBufSize-1, szFormatString, szProto, _T(": "), szContactName); -#endif + TruncateWithDots(szString, iBufSize-1-_tcslen(szStatus)-_tcslen(szIs)-2); // 2 spaces around szIs _sntprintf(szString+_tcslen(szString), iBufSize-1-_tcslen(szString), _T(" %s %s"), szIs, szStatus); diff --git a/plugins/TooltipNotify/src/main.cpp b/plugins/TooltipNotify/src/main.cpp index 85e73351a6..a634a012ae 100644 --- a/plugins/TooltipNotify/src/main.cpp +++ b/plugins/TooltipNotify/src/main.cpp @@ -54,11 +54,9 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved) OsVersionInfo.dwOSVersionInfoSize = sizeof(OsVersionInfo); GetVersionEx(&OsVersionInfo); -#ifdef _UNICODE + g_bRightModule = (OsVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT); -#else - g_bRightModule = (OsVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS); -#endif + break; } @@ -98,11 +96,9 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda extern "C" int __declspec(dllexport) Load(PLUGINLINK *pLink) { -#ifdef _UNICODE + if (!g_bRightModule) return 0; -#else - // ansi version can work ok on winnt platform -#endif + pluginLink = pLink; mir_getLP(&sPluginInfo); -- cgit v1.2.3