From 58973a21a30bf95427fd43c456e41e35c386218c Mon Sep 17 00:00:00 2001 From: Vadim Dashevskiy Date: Fri, 15 Jun 2012 18:52:16 +0000 Subject: another portion of "#ifsef Unicode" removal git-svn-id: http://svn.miranda-ng.org/main/trunk@434 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Popup/src/actions.cpp | 7 +-- plugins/Popup/src/avatars_gif.cpp | 13 +--- plugins/Popup/src/avatars_simple.cpp | 14 +---- plugins/Popup/src/bitmap_funcs.cpp | 12 +--- plugins/Popup/src/common.h | 45 +------------- plugins/Popup/src/config.cpp | 24 -------- plugins/Popup/src/config.h | 29 --------- plugins/Popup/src/history.cpp | 22 +------ plugins/Popup/src/main.cpp | 67 -------------------- plugins/Popup/src/opt_adv.cpp | 55 ++++------------- plugins/Popup/src/opt_gen.cpp | 16 +---- plugins/Popup/src/opt_skins.cpp | 21 +------ plugins/Popup/src/opttree.cpp | 28 +-------- plugins/Popup/src/popup_thread.cpp | 16 +---- plugins/Popup/src/popup_wnd2.cpp | 103 ++++++------------------------- plugins/Popup/src/skin.cpp | 115 ++++++----------------------------- 16 files changed, 68 insertions(+), 519 deletions(-) (limited to 'plugins/Popup/src') diff --git a/plugins/Popup/src/actions.cpp b/plugins/Popup/src/actions.cpp index 32ad120bcd..9aa0506d21 100644 --- a/plugins/Popup/src/actions.cpp +++ b/plugins/Popup/src/actions.cpp @@ -155,13 +155,10 @@ DWORD MouseOverride(HWND hCombo, int number) } // options -#if defined(_UNICODE) + #define ListView_InsertItemW(hwnd, pitem) \ (int)SendMessageW((hwnd), LVM_INSERTITEMW, 0, (LPARAM)(const LVITEMW *)(pitem)) -#else -#define ListView_InsertItemW(hwnd, pitem) \ - (int)MySendMessageW((hwnd), LVM_INSERTITEMW, 0, (LPARAM)(const LVITEMW *)(pitem)) -#endif + void LoadOption_Actions() { PopUpOptions.actions = DBGetContactSettingDword(NULL, MODULNAME, "Actions", diff --git a/plugins/Popup/src/avatars_gif.cpp b/plugins/Popup/src/avatars_gif.cpp index 24ee798e93..8ef662b882 100644 --- a/plugins/Popup/src/avatars_gif.cpp +++ b/plugins/Popup/src/avatars_gif.cpp @@ -97,7 +97,7 @@ void GifAvatar::draw(MyBitmap *bmp, int x, int y, int w, int h, POPUPOPTIONS *op SelectObject(hdcTmp, hBitmap); SetStretchBltMode(bmp->getDC(), HALFTONE); -#if defined(_UNICODE) + if (av->dwFlags & AVS_PREMULTIPLIED) { BLENDFUNCTION bf; @@ -106,16 +106,7 @@ void GifAvatar::draw(MyBitmap *bmp, int x, int y, int w, int h, POPUPOPTIONS *op bf.SourceConstantAlpha = 255; bf.AlphaFormat = AC_SRC_ALPHA; AlphaBlend(bmp->getDC(), x, y, w, h, hdcTmp, frameSize.cx*activeFrame, 0, frameSize.cx, frameSize.cy, bf); -#else - if (MyAlphaBlend && (av->dwFlags & AVS_PREMULTIPLIED)) - { - BLENDFUNCTION bf; - bf.BlendOp = AC_SRC_OVER; - bf.BlendFlags = 0; - bf.SourceConstantAlpha = 255; - bf.AlphaFormat = AC_SRC_ALPHA; - MyAlphaBlend(bmp->getDC(), x, y, w, h, hdcTmp, frameSize.cx*activeFrame, 0, frameSize.cx, frameSize.cy, bf); -#endif + if (options->avatarBorders && options->avatarPNGBorders) { HBRUSH hbr = CreateSolidBrush(fonts.clAvatarBorder); diff --git a/plugins/Popup/src/avatars_simple.cpp b/plugins/Popup/src/avatars_simple.cpp index 2c3b3341cb..b152afdc47 100644 --- a/plugins/Popup/src/avatars_simple.cpp +++ b/plugins/Popup/src/avatars_simple.cpp @@ -104,7 +104,7 @@ void SimpleAvatar::draw(MyBitmap *bmp, int x, int y, int w, int h, POPUPOPTIONS SelectObject(hdcTmp, av->hbmPic); SetStretchBltMode(bmp->getDC(), HALFTONE); -#if defined(_UNICODE) + if (av->dwFlags & AVS_HASTRANSPARENCY) { BLENDFUNCTION bf; @@ -113,17 +113,7 @@ void SimpleAvatar::draw(MyBitmap *bmp, int x, int y, int w, int h, POPUPOPTIONS bf.SourceConstantAlpha = 255; bf.AlphaFormat = AC_SRC_ALPHA; AlphaBlend(bmp->getDC(), x, y, w, h, hdcTmp, 0, 0, av->bmWidth, av->bmHeight, bf); -#else -// if (MyAlphaBlend && (av->dwFlags & AVS_PREMULTIPLIED)) - if (MyAlphaBlend && (av->dwFlags & AVS_HASTRANSPARENCY)) - { - BLENDFUNCTION bf; - bf.BlendOp = AC_SRC_OVER; - bf.BlendFlags = 0; - bf.SourceConstantAlpha = 255; - bf.AlphaFormat = AC_SRC_ALPHA; - MyAlphaBlend(bmp->getDC(), x, y, w, h, hdcTmp, 0, 0, av->bmWidth, av->bmHeight, bf); -#endif + if (options->avatarBorders && options->avatarPNGBorders) { HBRUSH hbr = CreateSolidBrush(fonts.clAvatarBorder); diff --git a/plugins/Popup/src/bitmap_funcs.cpp b/plugins/Popup/src/bitmap_funcs.cpp index 4cb013a378..22f60786fb 100644 --- a/plugins/Popup/src/bitmap_funcs.cpp +++ b/plugins/Popup/src/bitmap_funcs.cpp @@ -687,22 +687,12 @@ void MyBitmap::Draw_TextA(char *str, int x, int y) void MyBitmap::Draw_TextW(WCHAR *str, int x, int y) { -#if defined(_UNICODE) + SIZE sz; GetTextExtentPoint32W(this->getDC(), str, lstrlenW(str), &sz); RECT rc; SetRect(&rc, x, y, x+10000, y+10000); this->saveAlpha(x,y,sz.cx,sz.cy); DrawTextW(this->getDC(), str, lstrlenW(str), &rc, DT_LEFT | DT_TOP | DT_SINGLELINE | DT_NOPREFIX); this->restoreAlpha(x,y,sz.cx,sz.cy); -#else - if (MyGetTextExtentPoint32W && MyDrawTextW) - { - SIZE sz; MyGetTextExtentPoint32W(this->getDC(), str, lstrlenW(str), &sz); - RECT rc; SetRect(&rc, x, y, x+10000, y+10000); - this->saveAlpha(x,y,sz.cx,sz.cy); - MyDrawTextW(this->getDC(), str, lstrlenW(str), &rc, DT_LEFT | DT_TOP | DT_SINGLELINE | DT_NOPREFIX); - this->restoreAlpha(x,y,sz.cx,sz.cy); - } -#endif } // based on code by Yuriy Zaporozhets from: diff --git a/plugins/Popup/src/common.h b/plugins/Popup/src/common.h index 3b5ecae721..5319bc236d 100644 --- a/plugins/Popup/src/common.h +++ b/plugins/Popup/src/common.h @@ -143,7 +143,7 @@ inline INT_PTR DBGetContactSettingStringX(HANDLE hContact, const char *ModuleNam } /* not used -#if !defined(_UNICODE) + inline void SetWindowTextTraslated(HWND hwnd, const char *text) { if (!(hwnd && text)) return; @@ -160,7 +160,7 @@ inline void SetWindowTextTraslated(HWND hwnd, const char *text) SetWindowTextA(hwnd, Translate(text)); } } -#endif + */ /*/dedrecatet (tricky thing to minimize memory fragmentation) inline wchar_t* a2u( char* src ) @@ -204,7 +204,7 @@ inline wchar_t* a2u( char* src ) inline void AddTooltipTranslated(HWND hwndToolTip, HWND hwnd, int id, RECT rc, char *text) { -#if defined(_UNICODE) + TOOLINFO ti = {0}; ti.cbSize = sizeof(TOOLINFO); @@ -224,45 +224,6 @@ inline void AddTooltipTranslated(HWND hwndToolTip, HWND hwnd, int id, RECT rc, c mir_free(wtext); -#else - if (g_popup.isOsUnicode && MySendMessageW) - { - TOOLINFOW ti = {0}; - ti.cbSize = sizeof(TOOLINFO); - - ti.hwnd = hwnd; - ti.uId = id; - MySendMessageW(hwndToolTip, TTM_DELTOOLW, 0, (LPARAM) (LPTOOLINFOW) &ti); - - LPWSTR wtext = mir_a2u(text); - - ti.uFlags = TTF_SUBCLASS; - ti.hwnd = hwnd; - ti.uId = id; - ti.hinst = hInst; - ti.lpszText = TranslateW(wtext); - ti.rect = rc; - MySendMessageW(hwndToolTip, TTM_ADDTOOLW, 0, (LPARAM) (LPTOOLINFOW) &ti); - - mir_free(wtext); - } else - { - TOOLINFOA ti = {0}; - ti.cbSize = sizeof(TOOLINFO); - - ti.hwnd = hwnd; - ti.uId = id; - SendMessage(hwndToolTip, TTM_DELTOOLA, 0, (LPARAM) (LPTOOLINFOA) &ti); - - ti.uFlags = TTF_SUBCLASS; - ti.hwnd = hwnd; - ti.uId = id; - ti.hinst = hInst; - ti.lpszText = Translate(text); - ti.rect = rc; - SendMessage(hwndToolTip, TTM_ADDTOOLA, 0, (LPARAM) (LPTOOLINFOA) &ti); - } -#endif } /* not used diff --git a/plugins/Popup/src/config.cpp b/plugins/Popup/src/config.cpp index 169f6a7630..b013ecb3dc 100644 --- a/plugins/Popup/src/config.cpp +++ b/plugins/Popup/src/config.cpp @@ -75,30 +75,6 @@ PLUGININFOEX pluginInfoEx = POPUP_UUID }; -// MLU layer for ansi release -#if !defined(_UNICODE) -BOOL (WINAPI *MySetLayeredWindowAttributes)(HWND,COLORREF,BYTE,DWORD); -BOOL (WINAPI *MyAnimateWindow)(HWND hWnd,DWORD dwTime,DWORD dwFlags); -BOOL (WINAPI *MyGetMonitorInfo)(HMONITOR hMonitor, LPMONITORINFO lpmi); -BOOL (WINAPI *MyUpdateLayeredWindow) - (HWND hwnd, HDC hdcDST, POINT *pptDst, SIZE *psize, HDC hdcSrc, POINT *pptSrc, - COLORREF crKey, BLENDFUNCTION *pblend, DWORD dwFlags); -HMONITOR (WINAPI *MyMonitorFromWindow)(HWND hWnd, DWORD dwFlags); -BOOL (WINAPI *MyTransparentBlt)(HDC, int, int, int, int, HDC, int, int, int, int, UINT); -BOOL (WINAPI *MyAlphaBlend)(HDC, int, int, int, int, HDC, int, int, int, int, BLENDFUNCTION); - -// gdi32.dll -BOOL (WINAPI *MyGetTextExtentPoint32W)(HDC, LPCWSTR, int, LPSIZE); - -//user32.dll -int (WINAPI *MyDrawTextW)(HDC, LPCWSTR, int, LPRECT, UINT); -int (WINAPI *MyDrawTextExW)(HDC, LPCWSTR, int, LPRECT, UINT, LPDRAWTEXTPARAMS); -BOOL (WINAPI *MySetWindowTextW)(HWND, LPCWSTR); -LRESULT (WINAPI *MySendMessageW)(HWND, UINT, WPARAM, LPARAM); -LRESULT (WINAPI *MyCallWindowProcW)(WNDPROC, HWND, UINT, WPARAM, LPARAM); -HWND (WINAPI *MyCreateWindowExW)(DWORD, LPCWSTR, LPCWSTR, DWORD, int, int, int, int, HWND, HMENU, HINSTANCE, LPVOID); - -#endif HRESULT (WINAPI *MyDwmEnableBlurBehindWindow)(HWND hWnd, DWM_BLURBEHIND *pBlurBehind); diff --git a/plugins/Popup/src/config.h b/plugins/Popup/src/config.h index 6b293ba10d..3fe8e7facc 100644 --- a/plugins/Popup/src/config.h +++ b/plugins/Popup/src/config.h @@ -196,35 +196,6 @@ extern PLUGININFOEX pluginInfoEx; #define INVALID_FILE_ATTRIBUTES (DWORD (-1)) #endif -// MLU layer for ansi release -#if !defined(_UNICODE) -//===== DLLs ===== -extern HMODULE hUserDll; -extern HMODULE hMsimgDll; -extern HMODULE hKernelDll; -extern HMODULE hGdiDll; -extern HMODULE hDwmapiDll; - -extern BOOL (WINAPI *MySetLayeredWindowAttributes)(HWND,COLORREF,BYTE,DWORD); -extern BOOL (WINAPI *MyAnimateWindow)(HWND hWnd,DWORD dwTime,DWORD dwFlags); -extern BOOL (WINAPI *MyGetMonitorInfo)(HMONITOR hMonitor, LPMONITORINFO lpmi); -extern BOOL (WINAPI *MyUpdateLayeredWindow) - (HWND hwnd, HDC hdcDST, POINT *pptDst, SIZE *psize, HDC hdcSrc, POINT *pptSrc, - COLORREF crKey, BLENDFUNCTION *pblend, DWORD dwFlags); -extern HMONITOR (WINAPI* MyMonitorFromWindow)(HWND hWnd, DWORD dwFlags); -extern BOOL (WINAPI *MyTransparentBlt)(HDC, int, int, int, int, HDC, int, int, int, int, UINT); -extern BOOL (WINAPI *MyAlphaBlend)(HDC, int, int, int, int, HDC, int, int, int, int, BLENDFUNCTION); - -extern BOOL (WINAPI *MyGetTextExtentPoint32W)(HDC, LPCWSTR, int, LPSIZE); -extern int (WINAPI *MyDrawTextW)(HDC, LPCWSTR, int, LPRECT, UINT); -extern int (WINAPI *MyDrawTextExW)(HDC, LPCWSTR, int, LPRECT, UINT, LPDRAWTEXTPARAMS); -extern BOOL (WINAPI *MySetWindowTextW)(HWND, LPCWSTR); -extern LRESULT (WINAPI *MySendMessageW)(HWND, UINT, WPARAM, LPARAM); -extern LRESULT (WINAPI *MyCallWindowProcW)(WNDPROC, HWND, UINT, WPARAM, LPARAM); -extern HWND (WINAPI *MyCreateWindowExW)(DWORD, LPCWSTR, LPCWSTR, DWORD, int, int, int, int, HWND, HMENU, HINSTANCE, LPVOID); - -#endif - #define DWM_BB_ENABLE 0x00000001 #define DWM_BB_BLURREGION 0x00000002 #define DWM_BB_TRANSITIONONMAXIMIZED 0x00000004 diff --git a/plugins/Popup/src/history.cpp b/plugins/Popup/src/history.cpp index baf5e1797d..22529426b8 100644 --- a/plugins/Popup/src/history.cpp +++ b/plugins/Popup/src/history.cpp @@ -358,7 +358,7 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA int width = wndPreview->getContent()->getWidth(); int height = wndPreview->getContent()->getHeight(); -#if defined(_UNICODE) + { BLENDFUNCTION bf; bf.BlendOp = AC_SRC_OVER; @@ -369,25 +369,7 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA wndPreview->getContent()->getDC(), 0, 0, width, height, bf); } -#else - if (MyAlphaBlend) - { - BLENDFUNCTION bf; - bf.BlendOp = AC_SRC_OVER; - bf.BlendFlags = 0; - bf.SourceConstantAlpha = 255; - bf.AlphaFormat = AC_SRC_ALPHA; - MyAlphaBlend(lpdis->hDC, lpdis->rcItem.left+5, lpdis->rcItem.top+3, width, height, - wndPreview->getContent()->getDC(), - 0, 0, width, height, bf); - } - else { - BitBlt(lpdis->hDC, - lpdis->rcItem.left+5, lpdis->rcItem.top+5, lpdis->rcItem.left+5+width, lpdis->rcItem.top+3+height, - wndPreview->getContent()->getDC(), - 0, 0, SRCCOPY); - } -#endif + } return TRUE; diff --git a/plugins/Popup/src/main.cpp b/plugins/Popup/src/main.cpp index debafada7a..268226de9c 100644 --- a/plugins/Popup/src/main.cpp +++ b/plugins/Popup/src/main.cpp @@ -553,73 +553,6 @@ MIRAPI int Load(PLUGINLINK *link) osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); bResult = GetVersionEx(&osvi); -// MLU layer for ansi release -#if !defined(_UNICODE) - MySetLayeredWindowAttributes = 0; - MyUpdateLayeredWindow = 0; - MyAnimateWindow = 0; - MyDrawTextW = 0; - MyDrawTextExW = 0; - MySetWindowTextW = 0; - MySendMessageW = 0; - MyCallWindowProcW = 0; - MyCreateWindowExW = 0; - - MyGetMonitorInfo = 0; - MyMonitorFromWindow = 0; - - hUserDll = LoadLibrary(_T("user32.dll")); - if (hUserDll) { - MySetLayeredWindowAttributes = (BOOL (WINAPI *)(HWND,COLORREF,BYTE,DWORD))GetProcAddress(hUserDll, "SetLayeredWindowAttributes"); - MyUpdateLayeredWindow = (BOOL (WINAPI *)(HWND, HDC, POINT *, SIZE *, HDC, POINT *, COLORREF, BLENDFUNCTION *, DWORD))GetProcAddress(hUserDll, "UpdateLayeredWindow"); - MyAnimateWindow = (BOOL (WINAPI*)(HWND,DWORD,DWORD))GetProcAddress(hUserDll,"AnimateWindow"); - MyDrawTextW = (int (WINAPI *)(HDC, LPCWSTR, int, LPRECT, UINT))GetProcAddress(hUserDll,"DrawTextW"); - MyDrawTextExW = (int (WINAPI*)(HDC,LPCWSTR,int,LPRECT,UINT,LPDRAWTEXTPARAMS))GetProcAddress(hUserDll,"DrawTextExW"); - MySetWindowTextW = (BOOL (WINAPI*)(HWND, LPCWSTR))GetProcAddress(hUserDll,"SetWindowTextW"); - MySendMessageW = (LRESULT (WINAPI *)(HWND, UINT, WPARAM, LPARAM))GetProcAddress(hUserDll,"SendMessageW"); - MyCallWindowProcW = (LRESULT (WINAPI *)(WNDPROC, HWND, UINT, WPARAM, LPARAM))GetProcAddress(hUserDll,"CallWindowProcW"); - MyCreateWindowExW = (HWND (WINAPI*)(DWORD, LPCWSTR, LPCWSTR, DWORD, int, int, int, int, HWND, HMENU, HINSTANCE, LPVOID))GetProcAddress(hUserDll,"CreateWindowExW"); - - if (LOWORD(GetVersion())!=4) { //Windows 98, ME, 2000, XP, and later support multimonitor configuration. - if (bResult) { - if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) - { //2000 or XP - #ifdef UNICODE - MyGetMonitorInfo = (BOOL (WINAPI*)(HMONITOR,LPMONITORINFO))GetProcAddress(hUserDll,("GetMonitorInfoW")); - #else - MyGetMonitorInfo = (BOOL (WINAPI*)(HMONITOR,LPMONITORINFO))GetProcAddress(hUserDll,("GetMonitorInfoA")); - #endif //UNICODE - } else - { //98 or ME - // attempt to fix multimonitor on 9x - MyGetMonitorInfo = (BOOL (WINAPI*)(HMONITOR,LPMONITORINFO))GetProcAddress(hUserDll,("GetMonitorInfoA")); - if (!MyGetMonitorInfo) - MyGetMonitorInfo = (BOOL (WINAPI*)(HMONITOR,LPMONITORINFO))GetProcAddress(hUserDll,("GetMonitorInfo")); - } - } //There's no need for an else branch. - if (MyGetMonitorInfo) - MyMonitorFromWindow = (HMONITOR (WINAPI*)(HWND,DWORD))GetProcAddress(hUserDll, ("MonitorFromWindow")); - } - } - - hGdiDll = LoadLibrary(_T("gdi32.dll")); - if (hGdiDll) { - MyGetTextExtentPoint32W = (BOOL (WINAPI *)(HDC, LPCWSTR, int, LPSIZE))GetProcAddress(hGdiDll,"GetTextExtentPoint32W"); - } - else{ - MyGetTextExtentPoint32W = 0; - } - hMsimgDll = LoadLibrary(_T("msimg32.dll")); - MyAlphaBlend = 0; - MyTransparentBlt = 0; - if (hMsimgDll) - { - MyTransparentBlt = (BOOL (WINAPI *)(HDC, int, int, int, int, HDC, int, int, int, int, UINT)) - GetProcAddress(hMsimgDll, "TransparentBlt"); - MyAlphaBlend = (BOOL (WINAPI *)(HDC, int, int, int, int, HDC, int, int, int, int, BLENDFUNCTION)) - GetProcAddress(hMsimgDll, "AlphaBlend"); - } -#endif hDwmapiDll = LoadLibrary(_T("dwmapi.dll")); MyDwmEnableBlurBehindWindow = 0; diff --git a/plugins/Popup/src/opt_adv.cpp b/plugins/Popup/src/opt_adv.cpp index ef831df123..52cc033ba3 100644 --- a/plugins/Popup/src/opt_adv.cpp +++ b/plugins/Popup/src/opt_adv.cpp @@ -144,14 +144,9 @@ INT_PTR CALLBACK DlgProcPopUpAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM //Group: Monitor { BOOL bMonitor = 0; -#if defined(_UNICODE) + bMonitor = GetSystemMetrics(SM_CMONITORS)>1; -#else - if(MyGetMonitorInfo) { - //os support multimonitor, check if monitor > 1 - bMonitor = GetSystemMetrics(SM_CMONITORS)>1; - } -#endif + CheckDlgButton(hwnd, IDC_MIRANDAWND, bMonitor ? (PopUpOptions.Monitor == MN_MIRANDA) : TRUE); CheckDlgButton(hwnd, IDC_ACTIVEWND, bMonitor ? (PopUpOptions.Monitor == MN_ACTIVE) : FALSE); EnableWindow(GetDlgItem(hwnd, IDC_GRP_MULTIMONITOR), bMonitor); @@ -175,11 +170,9 @@ INT_PTR CALLBACK DlgProcPopUpAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM SetDlgItemText(hwnd, IDC_TRANS_PERCENT, tstr); CheckDlgButton(hwnd, IDC_TRANS_OPAQUEONHOVER, PopUpOptions.OpaqueOnHover); { -#if defined(_UNICODE) + BOOL how = TRUE; -#else - BOOL how = (BOOL)(MySetLayeredWindowAttributes); -#endif + EnableWindow(GetDlgItem(hwnd, IDC_TRANS) ,how); EnableWindow(GetDlgItem(hwnd, IDC_TRANS_TXT1) ,how && PopUpOptions.UseTransparency); EnableWindow(GetDlgItem(hwnd, IDC_TRANS_SLIDER) ,how && PopUpOptions.UseTransparency); @@ -214,11 +207,9 @@ INT_PTR CALLBACK DlgProcPopUpAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM { DWORD dwItem, dwActiveItem = 0; -#if defined(_UNICODE) + BOOL how = TRUE; -#else - BOOL how = (BOOL)(MySetLayeredWindowAttributes) /*&& !PopUpOptions.UseAnimations*/; -#endif + EnableWindow(GetDlgItem(hwnd, IDC_EFFECT), how); EnableWindow(GetDlgItem(hwnd, IDC_EFFECT_TXT), how); @@ -336,11 +327,9 @@ INT_PTR CALLBACK DlgProcPopUpAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case IDC_TRANS: { PopUpOptions.UseTransparency = !PopUpOptions.UseTransparency; -#if defined(_UNICODE) + BOOL how = TRUE; -#else - BOOL how = (BOOL)(MySetLayeredWindowAttributes); -#endif + EnableWindow(GetDlgItem(hwnd, IDC_TRANS_TXT1) ,how && PopUpOptions.UseTransparency); EnableWindow(GetDlgItem(hwnd, IDC_TRANS_SLIDER) ,how && PopUpOptions.UseTransparency); EnableWindow(GetDlgItem(hwnd, IDC_TRANS_PERCENT) ,how && PopUpOptions.UseTransparency); @@ -709,7 +698,7 @@ INT_PTR CALLBACK AlphaTrackBarWndProc (HWND hwnd, UINT msg, WPARAM wParam, LPARA int newVal = (BYTE)SendMessage(hwnd, TBM_GETPOS, 0, 0); if (oldVal != newVal) { -#if defined(_UNICODE) + if (oldVal < 0) { SetWindowLongPtr(hwndBox, GWLP_USERDATA, 1); @@ -721,37 +710,17 @@ INT_PTR CALLBACK AlphaTrackBarWndProc (HWND hwnd, UINT msg, WPARAM wParam, LPARA } SetWindowLongPtr(hwndBox, GWL_EXSTYLE, GetWindowLongPtr(hwndBox, GWL_EXSTYLE) | WS_EX_LAYERED); SetLayeredWindowAttributes(hwndBox, NULL, newVal, LWA_ALPHA); -#else - if (MySetLayeredWindowAttributes) - { - if (oldVal < 0) - { - SetWindowLongPtr(hwndBox, GWLP_USERDATA, 1); - RECT rc; GetWindowRect(hwnd, &rc); - SetWindowPos(hwndBox, NULL, - (rc.left+rc.right-170)/2, rc.bottom+2, 170, 50, - SWP_NOACTIVATE|SWP_DEFERERASE|SWP_NOSENDCHANGING|SWP_SHOWWINDOW); - SetWindowRgn(hwndBox, NULL, TRUE); - } - SetWindowLongPtr(hwndBox, GWL_EXSTYLE, GetWindowLongPtr(hwndBox, GWL_EXSTYLE) | WS_EX_LAYERED); - MySetLayeredWindowAttributes(hwndBox, NULL, newVal, LWA_ALPHA); - } -#endif + oldVal = newVal; } break; } case WM_MOUSELEAVE: { -#if defined(_UNICODE) + SetWindowLongPtr(hwndBox, GWL_EXSTYLE, GetWindowLongPtr(hwndBox, GWL_EXSTYLE) & ~WS_EX_LAYERED); SetLayeredWindowAttributes(hwndBox, NULL, 255, LWA_ALPHA); -#else - if (MySetLayeredWindowAttributes) { - SetWindowLongPtr(hwndBox, GWL_EXSTYLE, GetWindowLongPtr(hwndBox, GWL_EXSTYLE) & ~WS_EX_LAYERED); - MySetLayeredWindowAttributes(hwndBox, NULL, 255, LWA_ALPHA); - } -#endif + ShowWindow(hwndBox, SW_HIDE); oldVal = -1; break; diff --git a/plugins/Popup/src/opt_gen.cpp b/plugins/Popup/src/opt_gen.cpp index 4538e2b9fa..e124702f80 100644 --- a/plugins/Popup/src/opt_gen.cpp +++ b/plugins/Popup/src/opt_gen.cpp @@ -349,7 +349,7 @@ INT_PTR CALLBACK DlgProcPopUpGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM rcBox.right-rcBox.left, rcBox.bottom-rcBox.top, FALSE); -#if defined(_UNICODE) + SetWindowLongPtr(hwndBox, GWL_EXSTYLE, GetWindowLongPtr(hwndBox, GWL_EXSTYLE)|WS_EX_LAYERED); SetLayeredWindowAttributes(hwndBox, NULL, 0, LWA_ALPHA); ShowWindow(hwndBox, SW_SHOW); @@ -359,19 +359,7 @@ INT_PTR CALLBACK DlgProcPopUpGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM Sleep(1); } SetWindowLongPtr(hwndBox, GWL_EXSTYLE, GetWindowLongPtr(hwndBox, GWL_EXSTYLE)&~WS_EX_LAYERED); -#else - if (MySetLayeredWindowAttributes) { - SetWindowLongPtr(hwndBox, GWL_EXSTYLE, GetWindowLongPtr(hwndBox, GWL_EXSTYLE)|WS_EX_LAYERED); - MySetLayeredWindowAttributes(hwndBox, NULL, 0, LWA_ALPHA); - ShowWindow(hwndBox, SW_SHOW); - for (int i = 0; i <= 255; i += 15) { - MySetLayeredWindowAttributes(hwndBox, NULL, i, LWA_ALPHA); - UpdateWindow(hwndBox); - Sleep(1); - } - SetWindowLongPtr(hwndBox, GWL_EXSTYLE, GetWindowLongPtr(hwndBox, GWL_EXSTYLE)&~WS_EX_LAYERED); - } -#endif + ShowWindow(hwndBox, SW_SHOW); SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); } diff --git a/plugins/Popup/src/opt_skins.cpp b/plugins/Popup/src/opt_skins.cpp index 033c26c6a7..207c817401 100644 --- a/plugins/Popup/src/opt_skins.cpp +++ b/plugins/Popup/src/opt_skins.cpp @@ -143,7 +143,7 @@ static void DrawPreview(HWND hwnd, HDC hdc) int left = (rc.right - width) / 2; int top = (rc.bottom - height) / 2; -#if defined(_UNICODE) + BLENDFUNCTION bf; bf.BlendOp = AC_SRC_OVER; bf.BlendFlags = 0; @@ -152,24 +152,7 @@ static void DrawPreview(HWND hwnd, HDC hdc) AlphaBlend(hdc, left, top, width, height, wndPreview->getContent()->getDC(), 0, 0, width, height, bf); -#else - if (MyAlphaBlend) { - BLENDFUNCTION bf; - bf.BlendOp = AC_SRC_OVER; - bf.BlendFlags = 0; - bf.SourceConstantAlpha = 255; - bf.AlphaFormat = AC_SRC_ALPHA; - MyAlphaBlend(hdc, left, top, width, height, - wndPreview->getContent()->getDC(), - 0, 0, width, height, bf); - } - else { - BitBlt(hdc, - left, top, left+width, top+height, - wndPreview->getContent()->getDC(), - 0, 0, SRCCOPY); - } -#endif + } FrameRect(hdc, &rc, GetStockBrush(LTGRAY_BRUSH)); diff --git a/plugins/Popup/src/opttree.cpp b/plugins/Popup/src/opttree.cpp index d6d81c8103..8aa6a737e0 100644 --- a/plugins/Popup/src/opttree.cpp +++ b/plugins/Popup/src/opttree.cpp @@ -40,7 +40,7 @@ static void OptTree_TranslateItem(HWND hwndTree, HTREEITEM hItem) WCHAR unicode[64]; } buf; -#if defined(_UNICODE) + TVITEMW tvi = {0}; tvi.mask = TVIF_HANDLE|TVIF_TEXT; tvi.hItem = hItem; @@ -50,32 +50,6 @@ static void OptTree_TranslateItem(HWND hwndTree, HTREEITEM hItem) tvi.pszText = TranslateW(tvi.pszText); tvi.cchTextMax = lstrlenW(tvi.pszText); SendMessageW(hwndTree, TVM_SETITEMW, 0, (LPARAM)&tvi); - -#else - if (g_popup.isOsUnicode && MySendMessageW) - { - TVITEMW tvi = {0}; - tvi.mask = TVIF_HANDLE|TVIF_TEXT; - tvi.hItem = hItem; - tvi.pszText = buf.unicode; - tvi.cchTextMax = SIZEOF(buf.unicode); - MySendMessageW(hwndTree, TVM_GETITEMW, 0, (LPARAM)&tvi); - tvi.pszText = TranslateW(tvi.pszText); - tvi.cchTextMax = lstrlenW(tvi.pszText); - MySendMessageW(hwndTree, TVM_SETITEMW, 0, (LPARAM)&tvi); - } - else { - TVITEMA tvi = {0}; - tvi.mask = TVIF_HANDLE|TVIF_TEXT; - tvi.hItem = hItem; - tvi.pszText = buf.ansi; - tvi.cchTextMax = SIZEOF(buf.ansi); - SendMessageA(hwndTree, TVM_GETITEMA, 0, (LPARAM)&tvi); - tvi.pszText = Translate(tvi.pszText); - tvi.cchTextMax = lstrlenA(tvi.pszText); - SendMessageA(hwndTree, TVM_SETITEMA, 0, (LPARAM)&tvi); - } -#endif } void OptTree_Translate(HWND hwndTree) diff --git a/plugins/Popup/src/popup_thread.cpp b/plugins/Popup/src/popup_thread.cpp index 2376653cba..3ee85fa4d3 100644 --- a/plugins/Popup/src/popup_thread.cpp +++ b/plugins/Popup/src/popup_thread.cpp @@ -138,14 +138,7 @@ bool UpdatePopupPosition(PopupWnd2 *prev, PopupWnd2 *wnd) RECT rc; // SystemParametersInfo(SPI_GETWORKAREA, 0, &rc, 0); -#if !defined(_UNICODE) - //Win95 or NT don't have the support for multi monitor. - if (!MyGetMonitorInfo) { - SystemParametersInfo(SPI_GETWORKAREA,0,&rc,0); - } - //Windows 98/ME/2000/XP do have it. - else -#endif + if (GetSystemMetrics(SM_CMONITORS)==1) { //we have only one monitor (cant check it together with 1.if) SystemParametersInfo(SPI_GETWORKAREA,0,&rc,0); } @@ -161,13 +154,10 @@ bool UpdatePopupPosition(PopupWnd2 *prev, PopupWnd2 *wnd) mnti.cbSize = sizeof(MONITORINFOEX); -#if defined(_UNICODE) + hMonitor = MonitorFromWindow(hWnd, MONITOR_DEFAULTTOPRIMARY); if (GetMonitorInfo(hMonitor, (LPMONITORINFO)&mnti) == TRUE) //It worked -#else - hMonitor = MyMonitorFromWindow(hWnd, MONITOR_DEFAULTTOPRIMARY); - if (MyGetMonitorInfo(hMonitor, (LPMONITORINFO)&mnti) == TRUE) //It worked -#endif + CopyMemory(&rc, &(mnti.rcWork), sizeof(RECT)); else SystemParametersInfo(SPI_GETWORKAREA,0,&rc,0); diff --git a/plugins/Popup/src/popup_wnd2.cpp b/plugins/Popup/src/popup_wnd2.cpp index f8ef1cf3b2..93fc5f428f 100644 --- a/plugins/Popup/src/popup_wnd2.cpp +++ b/plugins/Popup/src/popup_wnd2.cpp @@ -87,15 +87,10 @@ bool LoadPopupWnd2() // register custom class for edit box with drop-shadow attribute if (IsWinVerXPPlus()) { - #if defined(_UNICODE) || defined(_WIN64) + #define MyRegisterClassExW RegisterClassExW #define MyGetClassInfoExW GetClassInfoExW - #else - ATOM (WINAPI *MyRegisterClassExW)(CONST WNDCLASSEXW *); - MyRegisterClassExW = (ATOM (WINAPI *)(CONST WNDCLASSEXW *))GetProcAddress(hUserDll, "RegisterClassExW"); - BOOL (WINAPI *MyGetClassInfoExW)(HINSTANCE, LPCWSTR, LPWNDCLASSEXW); - MyGetClassInfoExW = (BOOL (WINAPI *)(HINSTANCE, LPCWSTR, LPWNDCLASSEXW))GetProcAddress(hUserDll, "GetClassInfoExW"); - #endif + WNDCLASSEXW wclw = {0}; wclw.cbSize = sizeof(wclw); if (!MyGetClassInfoExW(NULL, L"EDIT", &wclw)) @@ -262,7 +257,7 @@ void PopupWnd2::create() void PopupWnd2::updateLayered(BYTE opacity) { if (!m_hwnd) return; -#if defined(_UNICODE) + if (SetWindowLongPtr(m_hwnd, GWL_EXSTYLE, GetWindowLongPtr(m_hwnd, GWL_EXSTYLE) | WS_EX_LAYERED)) { RECT rc; GetWindowRect(m_hwnd, &rc); POINT ptDst = {rc.left, rc.top}; @@ -280,28 +275,7 @@ void PopupWnd2::updateLayered(BYTE opacity) UpdateWindow(m_hwnd); } -#else - if (MyUpdateLayeredWindow) { - if (SetWindowLongPtr(m_hwnd, GWL_EXSTYLE, GetWindowLongPtr(m_hwnd, GWL_EXSTYLE) | WS_EX_LAYERED)) - { - RECT rc; GetWindowRect(m_hwnd, &rc); - POINT ptDst = {rc.left, rc.top}; - POINT ptSrc = {0, 0}; - - BLENDFUNCTION blend; - blend.BlendOp = AC_SRC_OVER; - blend.BlendFlags = 0; - blend.SourceConstantAlpha = opacity; //m_options->UseTransparency ? opacity : 255; - blend.AlphaFormat = AC_SRC_ALPHA; - MyUpdateLayeredWindow(m_hwnd, NULL, &ptDst, &m_sz, - m_bmpAnimate ? m_bmpAnimate->getDC() : m_bmp->getDC(), - &ptSrc, 0xffffffff, &blend, ULW_ALPHA); - - UpdateWindow(m_hwnd); - } - } -#endif } SIZE PopupWnd2::measure() @@ -380,16 +354,10 @@ void PopupWnd2::animate() if (m_bReshapeWindow) { m_bReshapeWindow = false; -#if defined(_UNICODE) + if (m_hwnd && m_bmp && m_options->DropShadow && PopUpOptions.EnableFreeformShadows /*DoWeNeedRegionForThisSkin()*/) SetWindowRgn(m_hwnd, m_bmp->buildOpaqueRgn(skin->getShadowRegionOpacity()), FALSE); -#else - if (!MyUpdateLayeredWindow && m_hwnd && m_bmp && PopUpOptions.Enable9xTransparency) - SetWindowRgn(m_hwnd, m_bmp->buildOpaqueRgn(skin->getLegacyRegionOpacity()), FALSE); - if (MyUpdateLayeredWindow && m_hwnd && m_bmp && m_options->DropShadow && PopUpOptions.EnableFreeformShadows /*DoWeNeedRegionForThisSkin()*/) - SetWindowRgn(m_hwnd, m_bmp->buildOpaqueRgn(skin->getShadowRegionOpacity()), FALSE); -#endif if (MyDwmEnableBlurBehindWindow && PopUpOptions.EnableAeroGlass) { @@ -1146,11 +1114,9 @@ LRESULT CALLBACK ReplyEditWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM { WCHAR msg[2048]; LPWSTR bufW = NULL; -#if defined(_UNICODE) + SendMessageW(hwnd, WM_GETTEXT, SIZEOF(msg), (LPARAM)msg); -#else - MySendMessageW(hwnd, WM_GETTEXT, SIZEOF(msg), (LPARAM)msg); -#endif + if(wcslen(msg)==0){ DestroyWindow(hwnd); return 0; @@ -1220,13 +1186,9 @@ LRESULT CALLBACK ReplyEditWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM if (oldWndProc) { -#if defined(_UNICODE) + return CallWindowProcW(oldWndProc, hwnd, message, wParam, lParam); -#else - if (IsWindowUnicode(hwnd) && MyCallWindowProcW) - return MyCallWindowProcW(oldWndProc, hwnd, message, wParam, lParam); - return CallWindowProc(oldWndProc, hwnd, message, wParam, lParam); -#endif + } return DefWindowProc(hwnd, message, wParam, lParam); @@ -1294,41 +1256,21 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara //RECT rc = renderInfo.textRect; //MapWindowPoints(hwnd, NULL, (LPPOINT)&rc, 2); RECT rc; GetWindowRect(m_hwnd, &rc); -#if defined(_UNICODE) + HWND hwndEditBox = CreateWindowExW(WS_EX_TOOLWINDOW|WS_EX_TOPMOST, g_wndClass.cPopupEditBox ? L"PopupEditBox" : L"EDIT", NULL, WS_BORDER|WS_POPUP|WS_VISIBLE|ES_AUTOVSCROLL|ES_LEFT|ES_MULTILINE|ES_NOHIDESEL|ES_WANTRETURN, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, NULL, NULL, hInst, NULL); -#else - HWND hwndEditBox = 0; - if(MyCreateWindowExW && g_popup.isMirUnicode) { - //create unicode window only if miranda is unicode - //coz many protocol make trouble with unicode text on utf8 send inside ansi release - hwndEditBox = MyCreateWindowExW(WS_EX_TOOLWINDOW|WS_EX_TOPMOST, - g_wndClass.cPopupEditBox ? L"PopupEditBox" : L"EDIT", - NULL, - WS_BORDER|WS_POPUP|WS_VISIBLE|ES_AUTOVSCROLL|ES_LEFT|ES_MULTILINE|ES_NOHIDESEL|ES_WANTRETURN, - rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, NULL, NULL, hInst, NULL); - } - else { - hwndEditBox = CreateWindowExA(WS_EX_TOOLWINDOW|WS_EX_TOPMOST, - g_wndClass.cPopupEditBox ? "PopupEditBox" : "EDIT", - NULL, - WS_BORDER|WS_POPUP|WS_VISIBLE|ES_AUTOVSCROLL|ES_LEFT|ES_MULTILINE|ES_NOHIDESEL|ES_WANTRETURN, - rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, NULL, NULL, hInst, NULL); - } -#endif + ReplyEditData *dat = (ReplyEditData *)mir_alloc(sizeof(ReplyEditData)); dat->oldWndProc = (WNDPROC)GetWindowLongPtr(hwndEditBox, (LONG_PTR)GWLP_WNDPROC); dat->hwndPopup = m_hwnd; dat->hContact = m_hContact; if(IsWindowUnicode(hwndEditBox)) { -#if defined(_UNICODE) + SendMessageW(hwndEditBox, WM_SETFONT, (WPARAM)fonts.text, TRUE); -#else - MySendMessageW(hwndEditBox, WM_SETFONT, (WPARAM)fonts.text, TRUE); -#endif + SetWindowLongPtrW(hwndEditBox, GWLP_USERDATA, (LONG_PTR)dat); SetWindowLongPtrW(hwndEditBox, GWLP_WNDPROC, (LONG_PTR)ReplyEditWndProc); } @@ -1382,11 +1324,8 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara break; case ACT_DEF_COPY: { - #ifdef UNICODE - #define CF_TCHAR CF_UNICODETEXT - #else - #define CF_TCHAR CF_TEXT - #endif + #define CF_TCHAR CF_UNICODETEXT + HGLOBAL clipbuffer; static TCHAR * buffer, *text; char* sztext; @@ -1658,13 +1597,10 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara tme.hwndTrack = m_hwnd; _TrackMouseEvent(&tme); if (!m_customPopup) PopupThreadLock(); -#if defined(_UNICODE) + if (m_options->OpaqueOnHover) updateLayered(255); -#else - if (MySetLayeredWindowAttributes && m_options->OpaqueOnHover) - updateLayered(255); -#endif + m_bIsHovered = true; break; } @@ -1676,13 +1612,10 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara animate(); if (!m_bIsHovered) break; -#if defined(_UNICODE) + if (m_options->OpaqueOnHover) updateLayered(m_options->UseTransparency ? m_options->Alpha : 255); -#else - if (MySetLayeredWindowAttributes && m_options->OpaqueOnHover) - updateLayered(m_options->UseTransparency ? m_options->Alpha : 255); -#endif + if (!m_customPopup) PopupThreadUnlock(); m_bIsHovered = false; break; diff --git a/plugins/Popup/src/skin.cpp b/plugins/Popup/src/skin.cpp index c18dcde07f..6cd3f7df14 100644 --- a/plugins/Popup/src/skin.cpp +++ b/plugins/Popup/src/skin.cpp @@ -75,25 +75,13 @@ SIZE PopupSkin::measureAction(HDC hdc, POPUPACTION *act) const SIZE szText, szSpace; -#if defined(_UNICODE) + LPWSTR wname = mir_a2u(name); WCHAR *str = TranslateW(wname); GetTextExtentPoint32W(hdc, str, lstrlenW(str), &szText); mir_free(wname); GetTextExtentPoint32W(hdc, L" ", 1, &szSpace); -#else - if (g_popup.isOsUnicode && MyGetTextExtentPoint32W) { - LPWSTR wname = mir_a2u(name); - WCHAR *str = TranslateW(wname); - MyGetTextExtentPoint32W(hdc, str, lstrlenW(str), &szText); - mir_free(wname); - } - else { - char *str = Translate(name); - GetTextExtentPoint32A(hdc, str, lstrlenA(str), &szText); - } - GetTextExtentPoint32A(hdc, " ", 1, &szSpace); -#endif + sz.cy = max(sz.cy, szText.cy); sz.cx += szSpace.cx; sz.cx += szText.cx; @@ -154,7 +142,7 @@ void PopupSkin::drawAction(MyBitmap *bmp, POPUPACTION *act, int x, int y, bool h GetTextExtentPoint32A(bmp->getDC(), " ", 1, &szSpace); -#if defined(_UNICODE) + LPWSTR wname = mir_a2u(name); WCHAR *str = TranslateW(wname); GetTextExtentPoint32W(bmp->getDC(), str, lstrlenW(str), &szText); @@ -165,31 +153,7 @@ void PopupSkin::drawAction(MyBitmap *bmp, POPUPACTION *act, int x, int y, bool h y+2 + (((PopUpOptions.actions&ACT_LARGE) ? 32 : 16) - szText.cy)/2 )); mir_free(wname); -#else - if (g_popup.isOsUnicode && MyGetTextExtentPoint32W) - { - LPWSTR wname = mir_a2u(name); - WCHAR *str = TranslateW(wname); - MyGetTextExtentPoint32W(bmp->getDC(), str, lstrlenW(str), &szText); - bmp->Draw_TextW(str, - (PopUpOptions.actions&ACT_LARGE) ? (x+szSpace.cx+32) : (x+szSpace.cx+16), - max( - y+2, - y+2 + (((PopUpOptions.actions&ACT_LARGE) ? 32 : 16) - szText.cy)/2 - )); - mir_free(wname); - } - else { - char *str = Translate(name); - GetTextExtentPoint32A(bmp->getDC(), str, lstrlenA(str), &szText); - bmp->Draw_TextA(str, - (PopUpOptions.actions&ACT_LARGE) ? (x+szSpace.cx+32) : (x+szSpace.cx+16), - max( - y+2, - y+2 + (((PopUpOptions.actions&ACT_LARGE) ? 32 : 16) - szText.cy)/2 - )); - } -#endif + SelectObject(bmp->getDC(), hFntSave); } else { @@ -322,22 +286,13 @@ void PopupSkin::measure(HDC hdc, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *options } case PopupWnd2::TT_UNICODE: { -#if defined(_UNICODE) + RECT rc; SetRect(&rc, 0, 0, szNew.cx, 0); DrawTextExW(hdc, wnd->getTextW(), lstrlenW(wnd->getTextW()), &rc, DT_CALCRECT|DT_EXPANDTABS|DT_LEFT|DT_NOPREFIX|DT_TOP|DT_WORDBREAK/*|DT_RTLREADING*/, NULL); szNew.cx = rc.right; szNew.cy = rc.bottom; -#else - if (g_popup.isOsUnicode && MyDrawTextExW) - { - RECT rc; SetRect(&rc, 0, 0, szNew.cx, 0); - MyDrawTextExW(hdc, wnd->getTextW(), lstrlenW(wnd->getTextW()), &rc, - DT_CALCRECT|DT_EXPANDTABS|DT_LEFT|DT_NOPREFIX|DT_TOP|DT_WORDBREAK/*|DT_RTLREADING*/, NULL); - szNew.cx = rc.right; - szNew.cy = rc.bottom; - } -#endif + break; } case PopupWnd2::TT_MTEXT: @@ -390,22 +345,13 @@ void PopupSkin::measure(HDC hdc, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *options } case PopupWnd2::TT_UNICODE: { -#if defined(_UNICODE) + RECT rc; SetRect(&rc, 0, 0, szNew.cx, 0); DrawTextExW(hdc, wnd->getTitleW(), lstrlenW(wnd->getTitleW()), &rc, DT_CALCRECT|DT_EXPANDTABS|DT_LEFT|DT_NOPREFIX|DT_TOP|DT_WORDBREAK/*|DT_RTLREADING*/, NULL); szNew.cx = rc.right; szNew.cy = rc.bottom; -#else - if (g_popup.isOsUnicode && MyDrawTextExW) - { - RECT rc; SetRect(&rc, 0, 0, szNew.cx, 0); - MyDrawTextExW(hdc, wnd->getTitleW(), lstrlenW(wnd->getTitleW()), &rc, - DT_CALCRECT|DT_EXPANDTABS|DT_LEFT|DT_NOPREFIX|DT_TOP|DT_WORDBREAK/*|DT_RTLREADING*/, NULL); - szNew.cx = rc.right; - szNew.cy = rc.bottom; - } -#endif + break; } case PopupWnd2::TT_MTEXT: @@ -665,18 +611,11 @@ void PopupSkin::display(MyBitmap *bmp, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *o } case PopupWnd2::TT_UNICODE: { -#if defined(_UNICODE) + RECT rc; SetRect(&rc, pos.x, pos.y, pos.x+sz.cx, pos.y+sz.cy); DrawTextExW(hdc, wnd->getTextW(), lstrlenW(wnd->getTextW()), &rc, DT_EXPANDTABS|DT_LEFT|DT_NOPREFIX|DT_TOP|DT_WORDBREAK/*|DT_RTLREADING*/, NULL); -#else - if (g_popup.isOsUnicode && MyDrawTextExW) - { - RECT rc; SetRect(&rc, pos.x, pos.y, pos.x+sz.cx, pos.y+sz.cy); - MyDrawTextExW(hdc, wnd->getTextW(), lstrlenW(wnd->getTextW()), &rc, - DT_EXPANDTABS|DT_LEFT|DT_NOPREFIX|DT_TOP|DT_WORDBREAK/*|DT_RTLREADING*/, NULL); - } -#endif + break; } case PopupWnd2::TT_MTEXT: @@ -738,22 +677,13 @@ void PopupSkin::display(MyBitmap *bmp, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *o } case PopupWnd2::TT_UNICODE: { -#if defined(_UNICODE) + HFONT hFntSave = (HFONT)SelectObject(hdc, fonts.title); RECT rc; SetRect(&rc, pos.x, pos.y, pos.x+sz.cx, pos.y+sz.cy); DrawTextExW(hdc, wnd->getTitleW(), lstrlenW(wnd->getTitleW()), &rc, DT_EXPANDTABS|DT_LEFT|DT_NOPREFIX|DT_TOP|DT_WORDBREAK/*|DT_RTLREADING*/, NULL); SelectObject(hdc, hFntSave); -#else - if (g_popup.isOsUnicode && MyDrawTextExW) - { - HFONT hFntSave = (HFONT)SelectObject(hdc, fonts.title); - RECT rc; SetRect(&rc, pos.x, pos.y, pos.x+sz.cx, pos.y+sz.cy); - MyDrawTextExW(hdc, wnd->getTitleW(), lstrlenW(wnd->getTitleW()), &rc, - DT_EXPANDTABS|DT_LEFT|DT_NOPREFIX|DT_TOP|DT_WORDBREAK/*|DT_RTLREADING*/, NULL); - SelectObject(hdc, hFntSave); - } -#endif + break; } case PopupWnd2::TT_MTEXT: @@ -1153,15 +1083,10 @@ void PopupSkin::loadSkin(std::istream &f) void PopupSkin::loadSkin(LPCTSTR fn) { if (!fn) return; -#if defined (_UNICODE) && _MSC_VER <= 1200 - char* temp= mir_t2a(fn); - std::ifstream theFile; - theFile.open(temp, std::ios::in); - mir_free(temp); -#else + std::ifstream theFile; theFile.open(fn, std::ios::in); -#endif + if (!theFile) return; loadSkin(theFile); theFile.close(); @@ -1350,22 +1275,18 @@ void PopupSkin::freeSkin(SKINELEMENT *head) void PopupSkin::saveOpts() const { char buf[128]; -#if defined( _UNICODE ) + mir_snprintf(buf, sizeof(buf), "skin.%.120S", m_name); -#else - mir_snprintf(buf, sizeof(buf), "skin.%.120s", m_name); -#endif + DBWriteContactSettingDword(NULL, MODULNAME, buf, m_flags); } void PopupSkin::loadOpts() const { char buf[128]; -#if defined( _UNICODE ) + mir_snprintf(buf, sizeof(buf), "skin.%.120S", m_name); -#else - mir_snprintf(buf, sizeof(buf), "skin.%.120s", m_name); -#endif + m_flags = DBGetContactSettingDword(NULL, MODULNAME, buf, m_flags); } -- cgit v1.2.3