From 101ca36412b3e7b8851b6b48a4f6cbc17d9f9eff Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 10 Jun 2012 14:46:58 +0000 Subject: bitmap operations were removed from TopToolBar and replaced with IcoLib git-svn-id: http://svn.miranda-ng.org/main/trunk@379 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- include/m_icolib.h | 41 + plugins/Alarms/alarms.cpp | 7 +- plugins/Clist_nicer/SRC/CLCButton.cpp | 1277 ++++++++++---------- plugins/Console/Console.c | 14 +- plugins/Console/Console.opt | Bin 49664 -> 0 bytes plugins/Console/Console.plg | 49 - plugins/Console/res/console_dn.bmp | Bin 1014 -> 0 bytes plugins/Console/res/console_dn.ico | Bin 0 -> 1086 bytes plugins/Console/res/console_up.bmp | Bin 1014 -> 0 bytes plugins/Console/res/console_up.ico | Bin 0 -> 1086 bytes plugins/Console/resource.h | 4 +- plugins/Console/resource.rc | 10 +- plugins/ExternalAPI/m_toptoolbar.h | 45 +- plugins/ListeningTo/listeningto.cpp | 53 +- plugins/ListeningTo/res/listening_off.ico | Bin 0 -> 2038 bytes plugins/ListeningTo/res/ttb_disabled.bmp | Bin 1016 -> 0 bytes plugins/ListeningTo/res/ttb_enabled.bmp | Bin 1016 -> 0 bytes plugins/ListeningTo/resource.h | 7 +- plugins/ListeningTo/resource.rc | 17 +- plugins/Popup/src/main.cpp | 4 +- plugins/RecentContacts/RecentContacts.cpp | 23 +- plugins/RecentContacts/RecentContacts.ico | Bin 23542 -> 2550 bytes plugins/RecentContacts/resource.h | 6 +- plugins/RecentContacts/resource.rc | 24 +- plugins/SimpleStatusMsg/main.cpp | 2 +- .../StatusPlugins/StartupStatus/StartupStatus.rc | 10 +- plugins/StatusPlugins/StartupStatus/options.cpp | 2 - plugins/StatusPlugins/StartupStatus/profiles.cpp | 11 +- .../StatusPlugins/StartupStatus/res/ttbDown.bmp | Bin 1398 -> 0 bytes plugins/StatusPlugins/StartupStatus/res/ttbUp.bmp | Bin 1398 -> 0 bytes .../StatusPlugins/StartupStatus/startupstatus.cpp | 6 - .../StatusPlugins/StartupStatus/startupstatus.h | 1 - plugins/StatusPlugins/StartupStatus/toolbars.cpp | 41 +- plugins/StatusPlugins/resource.h | 2 - plugins/Svc_dbepp/main.cpp | 2 +- plugins/TopToolBar/InternalButtons.cpp | 2 +- plugins/TopToolBar/TopToolBar.vcxproj | 24 +- plugins/TopToolBar/TopToolBar.vcxproj.filters | 68 +- plugins/TopToolBar/bmp/bitmap1.bmp | Bin 1398 -> 0 bytes plugins/TopToolBar/bmp/bmp00001.bmp | Bin 1398 -> 0 bytes plugins/TopToolBar/bmp/bmp00002.bmp | Bin 1270 -> 0 bytes plugins/TopToolBar/bmp/borderup.bmp | Bin 1398 -> 0 bytes plugins/TopToolBar/bmp/borederdn.bmp | Bin 1398 -> 0 bytes plugins/TopToolBar/bmp/cpaneldn.bmp | Bin 1398 -> 0 bytes plugins/TopToolBar/bmp/cpanelup.bmp | Bin 1398 -> 0 bytes plugins/TopToolBar/bmp/findusedn.bmp | Bin 1398 -> 0 bytes plugins/TopToolBar/bmp/finduser.bmp | Bin 1398 -> 0 bytes plugins/TopToolBar/bmp/finduserdn.bmp | Bin 1398 -> 0 bytes plugins/TopToolBar/bmp/groupdn.bmp | Bin 1398 -> 0 bytes plugins/TopToolBar/bmp/groupup.bmp | Bin 1398 -> 0 bytes plugins/TopToolBar/bmp/launch.bmp | Bin 1244 -> 0 bytes plugins/TopToolBar/bmp/launchdn.bmp | Bin 1398 -> 0 bytes plugins/TopToolBar/bmp/launchup.bmp | Bin 1398 -> 0 bytes plugins/TopToolBar/bmp/menudn.bmp | Bin 1398 -> 0 bytes plugins/TopToolBar/bmp/menuup.bmp | Bin 1398 -> 0 bytes plugins/TopToolBar/bmp/minimize.bmp | Bin 1252 -> 0 bytes plugins/TopToolBar/bmp/minimizedn.bmp | Bin 1232 -> 0 bytes plugins/TopToolBar/bmp/options.bmp | Bin 1398 -> 0 bytes plugins/TopToolBar/bmp/searchtest.bmp | Bin 1370 -> 0 bytes plugins/TopToolBar/bmp/separator.bmp | Bin 512 -> 0 bytes plugins/TopToolBar/bmp/soundsdn.bmp | Bin 1398 -> 0 bytes plugins/TopToolBar/bmp/soundsup.bmp | Bin 1398 -> 0 bytes plugins/TopToolBar/bmp/test.bmp | Bin 1270 -> 0 bytes plugins/TopToolBar/common.h | 15 +- plugins/TopToolBar/launchbt.cpp | 8 +- plugins/TopToolBar/main.cpp | 2 +- plugins/TopToolBar/main.rc | 114 +- plugins/TopToolBar/resource.h | 8 - plugins/TopToolBar/separators.cpp | 4 - plugins/TopToolBar/toolbar.cpp | 230 ++-- plugins/TopToolBar/ttbopt.cpp | 406 ++----- plugins/UserInfoEx/Flags/svc_flags.cpp | 8 +- plugins/UserInfoEx/Flags/svc_flagsicons.cpp | 15 +- plugins/UserInfoEx/dlg_anniversarylist.cpp | 50 +- plugins/UserInfoEx/mir_icolib.cpp | 65 +- plugins/UserInfoEx/mir_icolib.h | 1 - plugins/UserInfoEx/psp_base.cpp | 2 +- plugins/UserInfoEx/svc_email.cpp | 2 +- plugins/UserInfoEx/svc_gender.cpp | 4 +- plugins/UserInfoEx/svc_homepage.cpp | 2 +- plugins/UserInfoEx/svc_phone.cpp | 4 +- plugins/UserInfoEx/svc_reminder.cpp | 46 +- plugins/Utils/mir_icons.cpp | 15 +- plugins/Utils/mir_icons.h | 8 +- plugins/WhenWasIt/WhenWasIt.rc | 24 +- plugins/WhenWasIt/hooked_events.cpp | 12 +- plugins/WhenWasIt/icons/check.bmp | Bin 726 -> 0 bytes plugins/WhenWasIt/resource.h | 6 +- protocols/YAMN/services.cpp | 6 +- 89 files changed, 1087 insertions(+), 1722 deletions(-) delete mode 100644 plugins/Console/Console.opt delete mode 100644 plugins/Console/Console.plg delete mode 100644 plugins/Console/res/console_dn.bmp create mode 100644 plugins/Console/res/console_dn.ico delete mode 100644 plugins/Console/res/console_up.bmp create mode 100644 plugins/Console/res/console_up.ico create mode 100644 plugins/ListeningTo/res/listening_off.ico delete mode 100644 plugins/ListeningTo/res/ttb_disabled.bmp delete mode 100644 plugins/ListeningTo/res/ttb_enabled.bmp delete mode 100644 plugins/StatusPlugins/StartupStatus/res/ttbDown.bmp delete mode 100644 plugins/StatusPlugins/StartupStatus/res/ttbUp.bmp delete mode 100644 plugins/TopToolBar/bmp/bitmap1.bmp delete mode 100644 plugins/TopToolBar/bmp/bmp00001.bmp delete mode 100644 plugins/TopToolBar/bmp/bmp00002.bmp delete mode 100644 plugins/TopToolBar/bmp/borderup.bmp delete mode 100644 plugins/TopToolBar/bmp/borederdn.bmp delete mode 100644 plugins/TopToolBar/bmp/cpaneldn.bmp delete mode 100644 plugins/TopToolBar/bmp/cpanelup.bmp delete mode 100644 plugins/TopToolBar/bmp/findusedn.bmp delete mode 100644 plugins/TopToolBar/bmp/finduser.bmp delete mode 100644 plugins/TopToolBar/bmp/finduserdn.bmp delete mode 100644 plugins/TopToolBar/bmp/groupdn.bmp delete mode 100644 plugins/TopToolBar/bmp/groupup.bmp delete mode 100644 plugins/TopToolBar/bmp/launch.bmp delete mode 100644 plugins/TopToolBar/bmp/launchdn.bmp delete mode 100644 plugins/TopToolBar/bmp/launchup.bmp delete mode 100644 plugins/TopToolBar/bmp/menudn.bmp delete mode 100644 plugins/TopToolBar/bmp/menuup.bmp delete mode 100644 plugins/TopToolBar/bmp/minimize.bmp delete mode 100644 plugins/TopToolBar/bmp/minimizedn.bmp delete mode 100644 plugins/TopToolBar/bmp/options.bmp delete mode 100644 plugins/TopToolBar/bmp/searchtest.bmp delete mode 100644 plugins/TopToolBar/bmp/separator.bmp delete mode 100644 plugins/TopToolBar/bmp/soundsdn.bmp delete mode 100644 plugins/TopToolBar/bmp/soundsup.bmp delete mode 100644 plugins/TopToolBar/bmp/test.bmp delete mode 100644 plugins/WhenWasIt/icons/check.bmp diff --git a/include/m_icolib.h b/include/m_icolib.h index 1f868d13a8..a5e97db2e9 100644 --- a/include/m_icolib.h +++ b/include/m_icolib.h @@ -80,6 +80,10 @@ typedef struct { // #define MS_SKIN2_ADDICON "Skin2/Icons/AddIcon" +__inline static HANDLE Skin_AddIcon(SKINICONDESC* si) +{ return (HANDLE)CallService(MS_SKIN2_ADDICON, 0, (LPARAM)si); +} + // // Remove a icon from options UI // @@ -89,6 +93,10 @@ typedef struct { // #define MS_SKIN2_REMOVEICON "Skin2/Icons/RemoveIcon" +__inline static void Skin_RemoveIcon(const char* szIconName) +{ CallService(MS_SKIN2_REMOVEICON, 0, (LPARAM)szIconName); +} + // // Retrieve HICON with name specified in lParam // wParam = (WPARAM)0 - small 1 - big @@ -97,6 +105,14 @@ typedef struct { // #define MS_SKIN2_GETICON "Skin2/Icons/GetIcon" +#ifdef __cplusplus +__inline static HICON Skin_GetIcon(const char* szIconName, int size=0) +#else +__inline static HICON Skin_GetIcon(const char* szIconName, int size) +#endif +{ return (HICON)CallService(MS_SKIN2_GETICON, size, (LPARAM)szIconName); +} + // // Retrieve an icolib handle for icon by name specified in lParam // wParam = (WPARAM)0 @@ -104,6 +120,10 @@ typedef struct { // #define MS_SKIN2_GETICONHANDLE "Skin2/Icons/GetIconHandle" +__inline static HANDLE Skin_GetIconHandle(const char* szIconName) +{ return (HANDLE)CallService(MS_SKIN2_GETICONHANDLE, 0, (LPARAM)szIconName); +} + // // Retrieve HICON with HANDLE specified in lParam // wParam = (WPARAM)0 - small 1 - big @@ -112,6 +132,14 @@ typedef struct { // #define MS_SKIN2_GETICONBYHANDLE "Skin2/Icons/GetIconByHandle" +#ifdef __cplusplus +__inline static HICON Skin_GetIconByHandle(HANDLE hIcolibIcon, int size=0) +#else +__inline static HICON Skin_GetIconByHandle(HANDLE hIcolibIcon, int size) +#endif +{ return (HICON)CallService(MS_SKIN2_GETICONBYHANDLE, size, (LPARAM)hIcolibIcon); +} + // // Add reference to HICON // @@ -127,6 +155,19 @@ typedef struct { // lParam = (LPARAM)(char*)pszName (optional) // at least one needs to be specified // #define MS_SKIN2_RELEASEICON "Skin2/Icons/ReleaseIcon" + +__inline static void Skin_ReleaseIcon(const char* szIconName) +{ CallService(MS_SKIN2_RELEASEICON, 0, (LPARAM)szIconName); +} + +#ifdef __cplusplus +__inline static void Skin_ReleaseIcon(HICON hIcon) +#else +__inline static void Skin_ReleaseIcon2(HICON hIcon) +#endif +{ CallService(MS_SKIN2_RELEASEICON, (WPARAM)hIcon, 0); +} + #define MS_SKIN2_RELEASEICONBIG "Skin2/Icons/ReleaseIconBig" // diff --git a/plugins/Alarms/alarms.cpp b/plugins/Alarms/alarms.cpp index 79cea6c27f..e63e2090fc 100644 --- a/plugins/Alarms/alarms.cpp +++ b/plugins/Alarms/alarms.cpp @@ -200,12 +200,13 @@ HBITMAP LoadBmpFromIcon(int IdRes) return hBmp; } -static int InitTopToolbarButton(WPARAM wParam, LPARAM lParam) { +static int InitTopToolbarButton(WPARAM wParam, LPARAM lParam) +{ TTBButton ttb = {0}; ttb.cbSize = sizeof(ttb); - ttb.hbBitmapUp = LoadBmpFromIcon(IDI_TBUP); //LoadBitmap(hInst, MAKEINTRESOURCE(IDB_CLOCK)); - ttb.hbBitmapDown = LoadBmpFromIcon(IDI_TBDN); //LoadBitmap(hInst, MAKEINTRESOURCE(IDB_CLOCK)); + ttb.hIconUp = LoadIcon(hInst, MAKEINTRESOURCE(IDI_TBUP)); + ttb.hIconDn = LoadIcon(hInst, MAKEINTRESOURCE(IDI_TBDN)); ttb.pszServiceDown = MODULE "/NewAlarm"; ttb.dwFlags = TTBBF_VISIBLE;// | TTBBF_DRAWBORDER; ttb.name = Translate("Set Alarm"); diff --git a/plugins/Clist_nicer/SRC/CLCButton.cpp b/plugins/Clist_nicer/SRC/CLCButton.cpp index 5b3401f068..290484c62f 100644 --- a/plugins/Clist_nicer/SRC/CLCButton.cpp +++ b/plugins/Clist_nicer/SRC/CLCButton.cpp @@ -23,56 +23,34 @@ extern LONG g_cxsmIcon, g_cysmIcon; extern StatusItems_t *StatusItems; extern ImageItem *g_glyphItem; -static LRESULT CALLBACK TSButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); +static HWND hwndToolTips = NULL; typedef struct { - HWND hwnd; - int stateId; // button state - int focus; // has focus (1 or 0) - HFONT hFont; // font - HICON arrow; // uses down arrow - int defbutton; // default button - HICON hIcon, hIconPrivate; - HBITMAP hBitmap; - int pushBtn; - int pbState; - HANDLE hThemeButton; - HANDLE hThemeToolbar; - BOOL bThemed; - DWORD bSkinned; - char cHot; - int flatBtn; - TCHAR szText[128]; - SIZE sLabel; - HIMAGELIST hIml; - int iIcon; + HWND hwnd; + int stateId; // button state + int focus; // has focus (1 or 0) + HFONT hFont; // font + HICON arrow; // uses down arrow + int defbutton; // default button + HICON hIcon, hIconPrivate; + HBITMAP hBitmap; + int pushBtn; + int pbState; + HANDLE hThemeButton; + HANDLE hThemeToolbar; + BOOL bThemed; + DWORD bSkinned; + char cHot; + int flatBtn; + TCHAR szText[128]; + SIZE sLabel; + HIMAGELIST hIml; + int iIcon; BOOL bSendOnDown; - ButtonItem *buttonItem; - LONG lastGlyphMetrics[4]; + ButtonItem *buttonItem; + LONG lastGlyphMetrics[4]; } MButtonCtrl; -static HWND hwndToolTips = NULL; - -int UnloadTSButtonModule(WPARAM wParam, LPARAM lParam) -{ - return 0; -} - -int LoadCLCButtonModule(void) -{ - WNDCLASSEX wc; - - ZeroMemory(&wc, sizeof(wc)); - wc.cbSize = sizeof(wc); - wc.lpszClassName = _T("CLCButtonClass"); - wc.lpfnWndProc = TSButtonWndProc; - wc.hCursor = LoadCursor(NULL, IDC_ARROW); - wc.cbWndExtra = sizeof(MButtonCtrl *); - wc.hbrBackground = 0; - wc.style = CS_GLOBALCLASS; - RegisterClassEx(&wc); - return 0; -} // Used for our own cheap TrackMouseEvent #define BUTTON_POLLID 100 @@ -99,613 +77,630 @@ static void LoadTheme(MButtonCtrl *ctl) { DestroyTheme(ctl); if (IS_THEMED) { - ctl->hThemeButton = API::pfnOpenThemeData(ctl->hwnd, L"BUTTON"); - ctl->hThemeToolbar = API::pfnOpenThemeData(ctl->hwnd, L"TOOLBAR"); - ctl->bThemed = TRUE; - } + ctl->hThemeButton = API::pfnOpenThemeData(ctl->hwnd, L"BUTTON"); + ctl->hThemeToolbar = API::pfnOpenThemeData(ctl->hwnd, L"TOOLBAR"); + ctl->bThemed = TRUE; + } } static int TBStateConvert2Flat(int state) { - switch (state) { - case PBS_NORMAL: - return TS_NORMAL; - case PBS_HOT: - return TS_HOT; - case PBS_PRESSED: - return TS_PRESSED; - case PBS_DISABLED: - return TS_DISABLED; - case PBS_DEFAULTED: - return TS_NORMAL; - } - return TS_NORMAL; + switch (state) { + case PBS_NORMAL: + return TS_NORMAL; + case PBS_HOT: + return TS_HOT; + case PBS_PRESSED: + return TS_PRESSED; + case PBS_DISABLED: + return TS_DISABLED; + case PBS_DEFAULTED: + return TS_NORMAL; + } + return TS_NORMAL; } static void PaintWorker(MButtonCtrl *ctl, HDC hdcPaint) { - if (hdcPaint) { - HDC hdcMem; - HBITMAP hbmMem; - HBITMAP hbmOld = 0; - RECT rcClient; - HFONT hOldFont = 0; - int xOffset = 0; - - GetClientRect(ctl->hwnd, &rcClient); - hdcMem = CreateCompatibleDC(hdcPaint); - hbmMem = CreateCompatibleBitmap(hdcPaint, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top); - hbmOld = reinterpret_cast(SelectObject(hdcMem, hbmMem)); - - hOldFont = reinterpret_cast(SelectObject(hdcMem, ctl->hFont)); - // If its a push button, check to see if it should stay pressed - if (ctl->pushBtn && ctl->pbState) - ctl->stateId = PBS_PRESSED; - - // Draw the flat button - if (ctl->flatBtn) { - if (ctl->hThemeToolbar && ctl->bThemed) { - RECT rc = rcClient; - int state = IsWindowEnabled(ctl->hwnd) ? (ctl->stateId == PBS_NORMAL && ctl->defbutton ? PBS_DEFAULTED : ctl->stateId) : PBS_DISABLED; - SkinDrawBg(ctl->hwnd, hdcMem); - if (API::pfnIsThemeBackgroundPartiallyTransparent(ctl->hThemeToolbar, TP_BUTTON, TBStateConvert2Flat(state))) { - API::pfnDrawThemeParentBackground(ctl->hwnd, hdcMem, &rc); - } - API::pfnDrawThemeBackground(ctl->hThemeToolbar, hdcMem, TP_BUTTON, TBStateConvert2Flat(state), &rc, &rc); - } else { - HBRUSH hbr; - RECT rc = rcClient; - - if(ctl->buttonItem) { - RECT rcParent; - POINT pt; - HWND hwndParent = pcli->hwndContactList; - ImageItem *imgItem = ctl->stateId == PBS_HOT ? ctl->buttonItem->imgHover : (ctl->stateId == PBS_PRESSED ? ctl->buttonItem->imgPressed : ctl->buttonItem->imgNormal); - LONG *glyphMetrics = ctl->stateId == PBS_HOT ? ctl->buttonItem->hoverGlyphMetrics : (ctl->stateId == PBS_PRESSED ? ctl->buttonItem->pressedGlyphMetrics : ctl->buttonItem->normalGlyphMetrics); - - //if(ctl->stateId == PBS_HOT && glyphMetrics[2] <= 1 && glyphMetrics[3] <= 1) - // glyphMetrics = ctl->lastGlyphMetrics; - - GetWindowRect(ctl->hwnd, &rcParent); - pt.x = rcParent.left; - pt.y = rcParent.top; - - ScreenToClient(pcli->hwndContactList, &pt); - - BitBlt(hdcMem, 0, 0, rc.right, rc.bottom, cfg::dat.hdcBg, pt.x, pt.y, SRCCOPY); - if(imgItem) - DrawAlpha(hdcMem, &rc, 0, 0, 0, 0, 0, 0, 0, imgItem); - if(g_glyphItem) { - API::pfnAlphaBlend(hdcMem, (rc.right - glyphMetrics[2]) / 2, (rc.bottom - glyphMetrics[3]) / 2, - glyphMetrics[2], glyphMetrics[3], g_glyphItem->hdc, - glyphMetrics[0], glyphMetrics[1], glyphMetrics[2], - glyphMetrics[3], g_glyphItem->bf); - //CopyMemory(ctl->lastGlyphMetrics, glyphMetrics, 4 * sizeof(LONG)); - } - } - else if(ctl->bSkinned) { // skinned - RECT rcParent; - POINT pt; - HWND hwndParent = pcli->hwndContactList; - StatusItems_t *item; - int item_id; - - GetWindowRect(ctl->hwnd, &rcParent); - pt.x = rcParent.left; - pt.y = rcParent.top; - - ScreenToClient(pcli->hwndContactList, &pt); - - if(HIWORD(ctl->bSkinned)) - item_id = ctl->stateId == PBS_HOT ? ID_EXTBKTBBUTTONMOUSEOVER : (ctl->stateId == PBS_PRESSED ? ID_EXTBKTBBUTTONSPRESSED : ID_EXTBKTBBUTTONSNPRESSED); - //GetItemByStatus(ctl->stateId == PBS_HOT ? ID_EXTBKBUTTONSMOUSEOVER : (ctl->stateId == PBS_PRESSED ? ID_EXTBKTBBUTTONSPRESSED : ID_EXTBKTBBUTTONSNPRESSED), &item); - else - item_id = ctl->stateId == PBS_HOT ? ID_EXTBKBUTTONSMOUSEOVER : (ctl->stateId == PBS_PRESSED ? ID_EXTBKBUTTONSPRESSED : ID_EXTBKBUTTONSNPRESSED); - item = &StatusItems[item_id - ID_STATUS_OFFLINE]; - //GetItemByStatus(ctl->stateId == PBS_PRESSED ? ID_EXTBKBUTTONSPRESSED : ID_EXTBKBUTTONSNPRESSED, &item); - SetTextColor(hdcMem, item->TEXTCOLOR); - if(item->IGNORED) { - if(pt.y < 10 || cfg::dat.bWallpaperMode) - //SkinDrawBg(ctl->hwnd, hdcMem); - BitBlt(hdcMem, 0, 0, rc.right, rc.bottom, cfg::dat.hdcBg, pt.x, pt.y, SRCCOPY); - else - FillRect(hdcMem, &rc, GetSysColorBrush(COLOR_3DFACE)); - } - else { - if(pt.y < 10 || cfg::dat.bWallpaperMode) - //SkinDrawBg(ctl->hwnd, hdcMem); - BitBlt(hdcMem, 0, 0, rc.right, rc.bottom, cfg::dat.hdcBg, pt.x, pt.y, SRCCOPY); - else - FillRect(hdcMem, &rc, GetSysColorBrush(COLOR_3DFACE)); - rc.top += item->MARGIN_TOP; rc.bottom -= item->MARGIN_BOTTOM; - rc.left += item->MARGIN_LEFT; rc.right -= item->MARGIN_RIGHT; - DrawAlpha(hdcMem, &rc, item->COLOR, item->ALPHA, item->COLOR2, item->COLOR2_TRANSPARENT, item->GRADIENT, - item->CORNER, item->BORDERSTYLE, item->imageItem); - } - } - else { - if (ctl->stateId == PBS_PRESSED || ctl->stateId == PBS_HOT) - hbr = GetSysColorBrush(COLOR_3DFACE); - else { - HDC dc; - HWND hwndParent; - - hwndParent = GetParent(ctl->hwnd); - dc = GetDC(hwndParent); - hbr = (HBRUSH) SendMessage(hwndParent, WM_CTLCOLORDLG, (WPARAM) dc, (LPARAM) hwndParent); - ReleaseDC(hwndParent, dc); - } - if (hbr) { - FillRect(hdcMem, &rc, hbr); - DeleteObject(hbr); - } - } - if (!ctl->bSkinned && ctl->buttonItem == 0) { - if (ctl->stateId == PBS_HOT || ctl->focus) { - if (ctl->pbState) - DrawEdge(hdcMem, &rc, EDGE_ETCHED, BF_RECT | BF_SOFT); - else - DrawEdge(hdcMem, &rc, BDR_RAISEDOUTER, BF_RECT | BF_SOFT); - } else if (ctl->stateId == PBS_PRESSED) - DrawEdge(hdcMem, &rc, BDR_SUNKENOUTER, BF_RECT | BF_SOFT); - } - } - } else { - // Draw background/border - if (ctl->hThemeButton && ctl->bThemed) { - int state = IsWindowEnabled(ctl->hwnd) ? (ctl->stateId == PBS_NORMAL && ctl->defbutton ? PBS_DEFAULTED : ctl->stateId) : PBS_DISABLED; - POINT pt; - RECT rcParent; - - GetWindowRect(ctl->hwnd, &rcParent); - pt.x = rcParent.left; - pt.y = rcParent.top; - ScreenToClient(pcli->hwndContactList, &pt); - BitBlt(hdcMem, 0, 0, rcClient.right, rcClient.bottom, cfg::dat.hdcBg, pt.x, pt.y, SRCCOPY); - - if (API::pfnIsThemeBackgroundPartiallyTransparent(ctl->hThemeButton, BP_PUSHBUTTON, state)) { - API::pfnDrawThemeParentBackground(ctl->hwnd, hdcMem, &rcClient); - } - API::pfnDrawThemeBackground(ctl->hThemeButton, hdcMem, BP_PUSHBUTTON, state, &rcClient, &rcClient); - } else { - UINT uState = DFCS_BUTTONPUSH | ((ctl->stateId == PBS_HOT) ? DFCS_HOT : 0) | ((ctl->stateId == PBS_PRESSED) ? DFCS_PUSHED : 0); - if (ctl->defbutton && ctl->stateId == PBS_NORMAL) - uState |= DLGC_DEFPUSHBUTTON; - DrawFrameControl(hdcMem, &rcClient, DFC_BUTTON, uState); - } - - // Draw focus rectangle if button has focus - if (ctl->focus) { - RECT focusRect = rcClient; - InflateRect(&focusRect, -3, -3); - DrawFocusRect(hdcMem, &focusRect); - } - } - - // If we have an icon or a bitmap, ignore text and only draw the image on the button - if (ctl->hIcon || ctl->hIconPrivate || ctl->iIcon) { - int ix = (rcClient.right - rcClient.left) / 2 - (g_cxsmIcon / 2); - int iy = (rcClient.bottom - rcClient.top) / 2 - (g_cxsmIcon / 2); - HICON hIconNew = ctl->hIconPrivate != 0 ? ctl->hIconPrivate : ctl->hIcon; - if (lstrlen(ctl->szText) == 0) { - if (ctl->iIcon) - ImageList_DrawEx(ctl->hIml, ctl->iIcon, hdcMem, ix, iy, g_cxsmIcon, g_cysmIcon, CLR_NONE, CLR_NONE, ILD_NORMAL); - else - DrawState(hdcMem, NULL, NULL, (LPARAM) hIconNew, 0, ix, iy, g_cxsmIcon, g_cysmIcon, IsWindowEnabled(ctl->hwnd) ? DST_ICON | DSS_NORMAL : DST_ICON | DSS_DISABLED); - ctl->sLabel.cx = ctl->sLabel.cy = 0; - } else { - GetTextExtentPoint32(hdcMem, ctl->szText, lstrlen(ctl->szText), &ctl->sLabel); - - if(g_cxsmIcon + ctl->sLabel.cx + 8 > rcClient.right - rcClient.left) - ctl->sLabel.cx = (rcClient.right - rcClient.left) - g_cxsmIcon - 8; - else - ctl->sLabel.cx += 4; - - ix = (rcClient.right - rcClient.left) / 2 - ((g_cxsmIcon + ctl->sLabel.cx) / 2); - if (ctl->iIcon) - ImageList_DrawEx(ctl->hIml, ctl->iIcon, hdcMem, ix, iy, g_cxsmIcon, g_cysmIcon, CLR_NONE, CLR_NONE, ILD_NORMAL); - else - DrawState(hdcMem, NULL, NULL, (LPARAM) hIconNew, 0, ix, iy, g_cxsmIcon, g_cysmIcon, IsWindowEnabled(ctl->hwnd) ? DST_ICON | DSS_NORMAL : DST_ICON | DSS_DISABLED); - xOffset = ix + g_cxsmIcon + 4; - } - } else if (ctl->hBitmap) { - BITMAP bminfo; - int ix, iy; - - GetObject(ctl->hBitmap, sizeof(bminfo), &bminfo); - ix = (rcClient.right - rcClient.left) / 2 - (bminfo.bmWidth / 2); - iy = (rcClient.bottom - rcClient.top) / 2 - (bminfo.bmHeight / 2); - if (ctl->stateId == PBS_PRESSED) { - ix++; - iy++; - } - DrawState(hdcMem, NULL, NULL, (LPARAM) ctl->hBitmap, 0, ix, iy, bminfo.bmWidth, bminfo.bmHeight, IsWindowEnabled(ctl->hwnd) ? DST_BITMAP : DST_BITMAP | DSS_DISABLED); - } - if (GetWindowTextLength(ctl->hwnd)) { - // Draw the text and optinally the arrow - RECT rcText; - - CopyRect(&rcText, &rcClient); - SetBkMode(hdcMem, TRANSPARENT); - // XP w/themes doesn't used the glossy disabled text. Is it always using COLOR_GRAYTEXT? Seems so. - if (!ctl->bSkinned) - SetTextColor(hdcMem, IsWindowEnabled(ctl->hwnd) || !ctl->hThemeButton ? GetSysColor(COLOR_BTNTEXT) : GetSysColor(COLOR_GRAYTEXT)); - if (ctl->arrow) - DrawState(hdcMem, NULL, NULL, (LPARAM) ctl->arrow, 0, rcClient.right - rcClient.left - 5 - g_cxsmIcon + (!ctl->hThemeButton && ctl->stateId == PBS_PRESSED ? 1 : 0), (rcClient.bottom - rcClient.top) / 2 - g_cysmIcon / 2 + (!ctl->hThemeButton && ctl->stateId == PBS_PRESSED ? 1 : 0), g_cxsmIcon, g_cysmIcon, IsWindowEnabled(ctl->hwnd) ? DST_ICON : DST_ICON | DSS_DISABLED); - DrawState(hdcMem, NULL, NULL, (LPARAM) ctl->szText, 0, xOffset + (!ctl->hThemeButton && ctl->stateId == PBS_PRESSED ? 1 : 0), ctl->hThemeButton ? (rcText.bottom - rcText.top - ctl->sLabel.cy) / 2 + 1 : (rcText.bottom - rcText.top - ctl->sLabel.cy) / 2 + (ctl->stateId == PBS_PRESSED ? 1 : 0), ctl->sLabel.cx, ctl->sLabel.cy, IsWindowEnabled(ctl->hwnd) || ctl->hThemeButton ? DST_PREFIXTEXT | DSS_NORMAL : DST_PREFIXTEXT | DSS_DISABLED); - } - if (hOldFont) - SelectObject(hdcMem, hOldFont); - BitBlt(hdcPaint, 0, 0, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top, hdcMem, 0, 0, SRCCOPY); - SelectObject(hdcMem, hbmOld); - DeleteObject(hbmMem); - DeleteDC(hdcMem); - DeleteObject(hbmOld); - } + if (hdcPaint) { + HDC hdcMem; + HBITMAP hbmMem; + HBITMAP hbmOld = 0; + RECT rcClient; + HFONT hOldFont = 0; + int xOffset = 0; + + GetClientRect(ctl->hwnd, &rcClient); + hdcMem = CreateCompatibleDC(hdcPaint); + hbmMem = CreateCompatibleBitmap(hdcPaint, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top); + hbmOld = reinterpret_cast(SelectObject(hdcMem, hbmMem)); + + hOldFont = reinterpret_cast(SelectObject(hdcMem, ctl->hFont)); + // If its a push button, check to see if it should stay pressed + if (ctl->pushBtn && ctl->pbState) + ctl->stateId = PBS_PRESSED; + + // Draw the flat button + if (ctl->flatBtn) { + if (ctl->hThemeToolbar && ctl->bThemed) { + RECT rc = rcClient; + int state = IsWindowEnabled(ctl->hwnd) ? (ctl->stateId == PBS_NORMAL && ctl->defbutton ? PBS_DEFAULTED : ctl->stateId) : PBS_DISABLED; + SkinDrawBg(ctl->hwnd, hdcMem); + if (API::pfnIsThemeBackgroundPartiallyTransparent(ctl->hThemeToolbar, TP_BUTTON, TBStateConvert2Flat(state))) { + API::pfnDrawThemeParentBackground(ctl->hwnd, hdcMem, &rc); + } + API::pfnDrawThemeBackground(ctl->hThemeToolbar, hdcMem, TP_BUTTON, TBStateConvert2Flat(state), &rc, &rc); + } else { + HBRUSH hbr; + RECT rc = rcClient; + + if(ctl->buttonItem) { + RECT rcParent; + POINT pt; + HWND hwndParent = pcli->hwndContactList; + ImageItem *imgItem = ctl->stateId == PBS_HOT ? ctl->buttonItem->imgHover : (ctl->stateId == PBS_PRESSED ? ctl->buttonItem->imgPressed : ctl->buttonItem->imgNormal); + LONG *glyphMetrics = ctl->stateId == PBS_HOT ? ctl->buttonItem->hoverGlyphMetrics : (ctl->stateId == PBS_PRESSED ? ctl->buttonItem->pressedGlyphMetrics : ctl->buttonItem->normalGlyphMetrics); + + //if(ctl->stateId == PBS_HOT && glyphMetrics[2] <= 1 && glyphMetrics[3] <= 1) + // glyphMetrics = ctl->lastGlyphMetrics; + + GetWindowRect(ctl->hwnd, &rcParent); + pt.x = rcParent.left; + pt.y = rcParent.top; + + ScreenToClient(pcli->hwndContactList, &pt); + + BitBlt(hdcMem, 0, 0, rc.right, rc.bottom, cfg::dat.hdcBg, pt.x, pt.y, SRCCOPY); + if(imgItem) + DrawAlpha(hdcMem, &rc, 0, 0, 0, 0, 0, 0, 0, imgItem); + if(g_glyphItem) { + API::pfnAlphaBlend(hdcMem, (rc.right - glyphMetrics[2]) / 2, (rc.bottom - glyphMetrics[3]) / 2, + glyphMetrics[2], glyphMetrics[3], g_glyphItem->hdc, + glyphMetrics[0], glyphMetrics[1], glyphMetrics[2], + glyphMetrics[3], g_glyphItem->bf); + //CopyMemory(ctl->lastGlyphMetrics, glyphMetrics, 4 * sizeof(LONG)); + } + } + else if(ctl->bSkinned) { // skinned + RECT rcParent; + POINT pt; + HWND hwndParent = pcli->hwndContactList; + StatusItems_t *item; + int item_id; + + GetWindowRect(ctl->hwnd, &rcParent); + pt.x = rcParent.left; + pt.y = rcParent.top; + + ScreenToClient(pcli->hwndContactList, &pt); + + if(HIWORD(ctl->bSkinned)) + item_id = ctl->stateId == PBS_HOT ? ID_EXTBKTBBUTTONMOUSEOVER : (ctl->stateId == PBS_PRESSED ? ID_EXTBKTBBUTTONSPRESSED : ID_EXTBKTBBUTTONSNPRESSED); + //GetItemByStatus(ctl->stateId == PBS_HOT ? ID_EXTBKBUTTONSMOUSEOVER : (ctl->stateId == PBS_PRESSED ? ID_EXTBKTBBUTTONSPRESSED : ID_EXTBKTBBUTTONSNPRESSED), &item); + else + item_id = ctl->stateId == PBS_HOT ? ID_EXTBKBUTTONSMOUSEOVER : (ctl->stateId == PBS_PRESSED ? ID_EXTBKBUTTONSPRESSED : ID_EXTBKBUTTONSNPRESSED); + item = &StatusItems[item_id - ID_STATUS_OFFLINE]; + //GetItemByStatus(ctl->stateId == PBS_PRESSED ? ID_EXTBKBUTTONSPRESSED : ID_EXTBKBUTTONSNPRESSED, &item); + SetTextColor(hdcMem, item->TEXTCOLOR); + if(item->IGNORED) { + if(pt.y < 10 || cfg::dat.bWallpaperMode) + //SkinDrawBg(ctl->hwnd, hdcMem); + BitBlt(hdcMem, 0, 0, rc.right, rc.bottom, cfg::dat.hdcBg, pt.x, pt.y, SRCCOPY); + else + FillRect(hdcMem, &rc, GetSysColorBrush(COLOR_3DFACE)); + } + else { + if(pt.y < 10 || cfg::dat.bWallpaperMode) + //SkinDrawBg(ctl->hwnd, hdcMem); + BitBlt(hdcMem, 0, 0, rc.right, rc.bottom, cfg::dat.hdcBg, pt.x, pt.y, SRCCOPY); + else + FillRect(hdcMem, &rc, GetSysColorBrush(COLOR_3DFACE)); + rc.top += item->MARGIN_TOP; rc.bottom -= item->MARGIN_BOTTOM; + rc.left += item->MARGIN_LEFT; rc.right -= item->MARGIN_RIGHT; + DrawAlpha(hdcMem, &rc, item->COLOR, item->ALPHA, item->COLOR2, item->COLOR2_TRANSPARENT, item->GRADIENT, + item->CORNER, item->BORDERSTYLE, item->imageItem); + } + } + else { + if (ctl->stateId == PBS_PRESSED || ctl->stateId == PBS_HOT) + hbr = GetSysColorBrush(COLOR_3DFACE); + else { + HDC dc; + HWND hwndParent; + + hwndParent = GetParent(ctl->hwnd); + dc = GetDC(hwndParent); + hbr = (HBRUSH) SendMessage(hwndParent, WM_CTLCOLORDLG, (WPARAM) dc, (LPARAM) hwndParent); + ReleaseDC(hwndParent, dc); + } + if (hbr) { + FillRect(hdcMem, &rc, hbr); + DeleteObject(hbr); + } + } + if (!ctl->bSkinned && ctl->buttonItem == 0) { + if (ctl->stateId == PBS_HOT || ctl->focus) { + if (ctl->pbState) + DrawEdge(hdcMem, &rc, EDGE_ETCHED, BF_RECT | BF_SOFT); + else + DrawEdge(hdcMem, &rc, BDR_RAISEDOUTER, BF_RECT | BF_SOFT); + } else if (ctl->stateId == PBS_PRESSED) + DrawEdge(hdcMem, &rc, BDR_SUNKENOUTER, BF_RECT | BF_SOFT); + } + } + } else { + // Draw background/border + if (ctl->hThemeButton && ctl->bThemed) { + int state = IsWindowEnabled(ctl->hwnd) ? (ctl->stateId == PBS_NORMAL && ctl->defbutton ? PBS_DEFAULTED : ctl->stateId) : PBS_DISABLED; + POINT pt; + RECT rcParent; + + GetWindowRect(ctl->hwnd, &rcParent); + pt.x = rcParent.left; + pt.y = rcParent.top; + ScreenToClient(pcli->hwndContactList, &pt); + BitBlt(hdcMem, 0, 0, rcClient.right, rcClient.bottom, cfg::dat.hdcBg, pt.x, pt.y, SRCCOPY); + + if (API::pfnIsThemeBackgroundPartiallyTransparent(ctl->hThemeButton, BP_PUSHBUTTON, state)) { + API::pfnDrawThemeParentBackground(ctl->hwnd, hdcMem, &rcClient); + } + API::pfnDrawThemeBackground(ctl->hThemeButton, hdcMem, BP_PUSHBUTTON, state, &rcClient, &rcClient); + } else { + UINT uState = DFCS_BUTTONPUSH | ((ctl->stateId == PBS_HOT) ? DFCS_HOT : 0) | ((ctl->stateId == PBS_PRESSED) ? DFCS_PUSHED : 0); + if (ctl->defbutton && ctl->stateId == PBS_NORMAL) + uState |= DLGC_DEFPUSHBUTTON; + DrawFrameControl(hdcMem, &rcClient, DFC_BUTTON, uState); + } + + // Draw focus rectangle if button has focus + if (ctl->focus) { + RECT focusRect = rcClient; + InflateRect(&focusRect, -3, -3); + DrawFocusRect(hdcMem, &focusRect); + } + } + + // If we have an icon or a bitmap, ignore text and only draw the image on the button + if (ctl->hIcon || ctl->hIconPrivate || ctl->iIcon) { + int ix = (rcClient.right - rcClient.left) / 2 - (g_cxsmIcon / 2); + int iy = (rcClient.bottom - rcClient.top) / 2 - (g_cxsmIcon / 2); + HICON hIconNew = ctl->hIconPrivate != 0 ? ctl->hIconPrivate : ctl->hIcon; + if (lstrlen(ctl->szText) == 0) { + if (ctl->iIcon) + ImageList_DrawEx(ctl->hIml, ctl->iIcon, hdcMem, ix, iy, g_cxsmIcon, g_cysmIcon, CLR_NONE, CLR_NONE, ILD_NORMAL); + else + DrawState(hdcMem, NULL, NULL, (LPARAM) hIconNew, 0, ix, iy, g_cxsmIcon, g_cysmIcon, IsWindowEnabled(ctl->hwnd) ? DST_ICON | DSS_NORMAL : DST_ICON | DSS_DISABLED); + ctl->sLabel.cx = ctl->sLabel.cy = 0; + } else { + GetTextExtentPoint32(hdcMem, ctl->szText, lstrlen(ctl->szText), &ctl->sLabel); + + if(g_cxsmIcon + ctl->sLabel.cx + 8 > rcClient.right - rcClient.left) + ctl->sLabel.cx = (rcClient.right - rcClient.left) - g_cxsmIcon - 8; + else + ctl->sLabel.cx += 4; + + ix = (rcClient.right - rcClient.left) / 2 - ((g_cxsmIcon + ctl->sLabel.cx) / 2); + if (ctl->iIcon) + ImageList_DrawEx(ctl->hIml, ctl->iIcon, hdcMem, ix, iy, g_cxsmIcon, g_cysmIcon, CLR_NONE, CLR_NONE, ILD_NORMAL); + else + DrawState(hdcMem, NULL, NULL, (LPARAM) hIconNew, 0, ix, iy, g_cxsmIcon, g_cysmIcon, IsWindowEnabled(ctl->hwnd) ? DST_ICON | DSS_NORMAL : DST_ICON | DSS_DISABLED); + xOffset = ix + g_cxsmIcon + 4; + } + } else if (ctl->hBitmap) { + BITMAP bminfo; + int ix, iy; + + GetObject(ctl->hBitmap, sizeof(bminfo), &bminfo); + ix = (rcClient.right - rcClient.left) / 2 - (bminfo.bmWidth / 2); + iy = (rcClient.bottom - rcClient.top) / 2 - (bminfo.bmHeight / 2); + if (ctl->stateId == PBS_PRESSED) { + ix++; + iy++; + } + DrawState(hdcMem, NULL, NULL, (LPARAM) ctl->hBitmap, 0, ix, iy, bminfo.bmWidth, bminfo.bmHeight, IsWindowEnabled(ctl->hwnd) ? DST_BITMAP : DST_BITMAP | DSS_DISABLED); + } + if (GetWindowTextLength(ctl->hwnd)) { + // Draw the text and optinally the arrow + RECT rcText; + + CopyRect(&rcText, &rcClient); + SetBkMode(hdcMem, TRANSPARENT); + // XP w/themes doesn't used the glossy disabled text. Is it always using COLOR_GRAYTEXT? Seems so. + if (!ctl->bSkinned) + SetTextColor(hdcMem, IsWindowEnabled(ctl->hwnd) || !ctl->hThemeButton ? GetSysColor(COLOR_BTNTEXT) : GetSysColor(COLOR_GRAYTEXT)); + if (ctl->arrow) + DrawState(hdcMem, NULL, NULL, (LPARAM) ctl->arrow, 0, rcClient.right - rcClient.left - 5 - g_cxsmIcon + (!ctl->hThemeButton && ctl->stateId == PBS_PRESSED ? 1 : 0), (rcClient.bottom - rcClient.top) / 2 - g_cysmIcon / 2 + (!ctl->hThemeButton && ctl->stateId == PBS_PRESSED ? 1 : 0), g_cxsmIcon, g_cysmIcon, IsWindowEnabled(ctl->hwnd) ? DST_ICON : DST_ICON | DSS_DISABLED); + DrawState(hdcMem, NULL, NULL, (LPARAM) ctl->szText, 0, xOffset + (!ctl->hThemeButton && ctl->stateId == PBS_PRESSED ? 1 : 0), ctl->hThemeButton ? (rcText.bottom - rcText.top - ctl->sLabel.cy) / 2 + 1 : (rcText.bottom - rcText.top - ctl->sLabel.cy) / 2 + (ctl->stateId == PBS_PRESSED ? 1 : 0), ctl->sLabel.cx, ctl->sLabel.cy, IsWindowEnabled(ctl->hwnd) || ctl->hThemeButton ? DST_PREFIXTEXT | DSS_NORMAL : DST_PREFIXTEXT | DSS_DISABLED); + } + if (hOldFont) + SelectObject(hdcMem, hOldFont); + BitBlt(hdcPaint, 0, 0, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top, hdcMem, 0, 0, SRCCOPY); + SelectObject(hdcMem, hbmOld); + DeleteObject(hbmMem); + DeleteDC(hdcMem); + DeleteObject(hbmOld); + } } static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - MButtonCtrl *bct = (MButtonCtrl *) GetWindowLongPtr(hwndDlg, 0); - switch (msg) { - case WM_NCCREATE: - { - SetWindowLongPtr(hwndDlg, GWL_STYLE, GetWindowLongPtr(hwndDlg, GWL_STYLE) | BS_OWNERDRAW); - bct = reinterpret_cast(malloc(sizeof(MButtonCtrl))); - if (bct == NULL) - return FALSE; - bct->hwnd = hwndDlg; - bct->stateId = PBS_NORMAL; - bct->focus = 0; - bct->hFont = reinterpret_cast(GetStockObject(DEFAULT_GUI_FONT)); - bct->arrow = NULL; - bct->defbutton = 0; - bct->hIcon = bct->hIconPrivate = 0; - bct->iIcon = 0; - bct->hIml = 0; - bct->hBitmap = NULL; - bct->pushBtn = 0; - bct->pbState = 0; - bct->hThemeButton = NULL; - bct->hThemeToolbar = NULL; - bct->cHot = 0; - bct->flatBtn = 0; - bct->bThemed = FALSE; - bct->bSkinned = bct->bSendOnDown = 0; - bct->buttonItem = NULL; - LoadTheme(bct); - SetWindowLongPtr(hwndDlg, 0, (LONG_PTR) bct); - if (((CREATESTRUCTA *) lParam)->lpszName) - SetWindowText(hwndDlg, ((CREATESTRUCT *) lParam)->lpszName); - return TRUE; - } - case WM_DESTROY: - { - if (bct) { - if (hwndToolTips) { - TOOLINFO ti; - - ZeroMemory(&ti, sizeof(ti)); - ti.cbSize = sizeof(ti); - ti.uFlags = TTF_IDISHWND; - ti.hwnd = bct->hwnd; - ti.uId = (UINT_PTR) bct->hwnd; - if (SendMessage(hwndToolTips, TTM_GETTOOLINFO, 0, (LPARAM) &ti)) { - SendMessage(hwndToolTips, TTM_DELTOOL, 0, (LPARAM) &ti); - } - if (SendMessage(hwndToolTips, TTM_GETTOOLCOUNT, 0, (LPARAM) &ti) == 0) { - DestroyWindow(hwndToolTips); - hwndToolTips = NULL; - } - } - if (bct->hIconPrivate) - DestroyIcon(bct->hIconPrivate); - DestroyTheme(bct); - free(bct); - } - SetWindowLongPtr(hwndDlg, 0, 0); - break; // DONT! fall thru - } - case WM_SETTEXT: - { - bct->cHot = 0; - if ((char*) lParam) { - char *tmp = (char *) lParam; - while (*tmp) { - if (*tmp == '&' && *(tmp + 1)) { - bct->cHot = tolower(*(tmp + 1)); - break; - } - tmp++; - } - InvalidateRect(bct->hwnd, NULL, TRUE); - lstrcpyn(bct->szText, (TCHAR *)lParam, 127); - bct->szText[127] = 0; - } - break; - } - case WM_SYSKEYUP: - if (bct->stateId != PBS_DISABLED && bct->cHot && bct->cHot == tolower((int) wParam)) { - if (bct->pushBtn) { - if (bct->pbState) - bct->pbState = 0; - else - bct->pbState = 1; - InvalidateRect(bct->hwnd, NULL, TRUE); - } - if (!bct->bSendOnDown) - SendMessage(GetParent(hwndDlg), WM_COMMAND, MAKELONG(GetDlgCtrlID(hwndDlg), BN_CLICKED), (LPARAM) hwndDlg); - return 0; - } - break; - case WM_THEMECHANGED: - { - if (bct->bThemed) - LoadTheme(bct); - InvalidateRect(bct->hwnd, NULL, TRUE); // repaint it - break; - } - case WM_SETFONT: - // remember the font so we can use it later - { - bct->hFont = (HFONT) wParam; // maybe we should redraw? - break; - } - case WM_NCPAINT: - case WM_PAINT: - { - PAINTSTRUCT ps; - HDC hdcPaint; - - hdcPaint = BeginPaint(hwndDlg, &ps); - if (hdcPaint) { - PaintWorker(bct, hdcPaint); - EndPaint(hwndDlg, &ps); - } - break; - } - case BM_GETIMAGE: - if(wParam == IMAGE_ICON) - return (LRESULT)(bct->hIconPrivate ? bct->hIconPrivate : bct->hIcon); - break; - case BM_SETIMAGE: - if (!lParam) - break; - bct->hIml = 0; - bct->iIcon = 0; - if (wParam == IMAGE_ICON) { - ICONINFO ii = {0}; - BITMAP bm = {0}; - - if (bct->hIconPrivate) { - DestroyIcon(bct->hIconPrivate); - bct->hIconPrivate = 0; - } - - GetIconInfo((HICON) lParam, &ii); - GetObject(ii.hbmColor, sizeof(bm), &bm); - if (bm.bmWidth > g_cxsmIcon || bm.bmHeight > g_cysmIcon) { - HIMAGELIST hImageList; - hImageList = ImageList_Create(g_cxsmIcon, g_cysmIcon, IsWinVerXPPlus() ? ILC_COLOR32 | ILC_MASK : ILC_COLOR16 | ILC_MASK, 1, 0); - ImageList_AddIcon(hImageList, (HICON) lParam); - bct->hIconPrivate = ImageList_GetIcon(hImageList, 0, ILD_NORMAL); - ImageList_RemoveAll(hImageList); - ImageList_Destroy(hImageList); - bct->hIcon = 0; - } else { - bct->hIcon = (HICON) lParam; - bct->hIconPrivate = 0; - } - - DeleteObject(ii.hbmMask); - DeleteObject(ii.hbmColor); - bct->hBitmap = NULL; - InvalidateRect(bct->hwnd, NULL, TRUE); - } else if (wParam == IMAGE_BITMAP) { - bct->hBitmap = (HBITMAP) lParam; - if (bct->hIconPrivate) - DestroyIcon(bct->hIconPrivate); - bct->hIcon = bct->hIconPrivate = NULL; - InvalidateRect(bct->hwnd, NULL, TRUE); - } - break; - case BM_SETPRIVATEICON: - bct->hIml = 0; - bct->iIcon = 0; { - if (bct->hIconPrivate) - DestroyIcon(bct->hIconPrivate); - bct->hIconPrivate = DuplicateIcon(g_hInst, (HICON) lParam); - bct->hIcon = 0; - break; - } - case BM_SETIMLICON: - { - if (bct->hIconPrivate) - DestroyIcon(bct->hIconPrivate); - bct->hIml = (HIMAGELIST) wParam; - bct->iIcon = (int) lParam; - bct->hIcon = bct->hIconPrivate = 0; - InvalidateRect(bct->hwnd, NULL, TRUE); - break; - } - case BM_SETSKINNED: - bct->bSkinned = (DWORD)lParam; - bct->bThemed = bct->bSkinned ? FALSE : bct->bThemed; - InvalidateRect(bct->hwnd, NULL, TRUE); - break; - case BM_SETBTNITEM: - bct->buttonItem = (ButtonItem *)lParam; - break; - case BM_SETASMENUACTION: - bct->bSendOnDown = wParam ? TRUE : FALSE; + MButtonCtrl *bct = (MButtonCtrl *) GetWindowLongPtr(hwndDlg, 0); + switch (msg) { + case WM_NCCREATE: + SetWindowLongPtr(hwndDlg, GWL_STYLE, GetWindowLongPtr(hwndDlg, GWL_STYLE) | BS_OWNERDRAW); + bct = reinterpret_cast(calloc(1, sizeof(MButtonCtrl))); + if (bct == NULL) + return FALSE; + + bct->hwnd = hwndDlg; + bct->stateId = PBS_NORMAL; + bct->hFont = reinterpret_cast(GetStockObject(DEFAULT_GUI_FONT)); + LoadTheme(bct); + SetWindowLongPtr(hwndDlg, 0, (LONG_PTR) bct); + if (((CREATESTRUCT*) lParam)->lpszName) + SetWindowText(hwndDlg, ((CREATESTRUCT *) lParam)->lpszName); + return TRUE; + + case WM_DESTROY: + if (bct) { + if (hwndToolTips) { + TOOLINFO ti; + + ZeroMemory(&ti, sizeof(ti)); + ti.cbSize = sizeof(ti); + ti.uFlags = TTF_IDISHWND; + ti.hwnd = bct->hwnd; + ti.uId = (UINT_PTR) bct->hwnd; + if (SendMessage(hwndToolTips, TTM_GETTOOLINFO, 0, (LPARAM) &ti)) { + SendMessage(hwndToolTips, TTM_DELTOOL, 0, (LPARAM) &ti); + } + if (SendMessage(hwndToolTips, TTM_GETTOOLCOUNT, 0, (LPARAM) &ti) == 0) { + DestroyWindow(hwndToolTips); + hwndToolTips = NULL; + } + } + if (bct->hIconPrivate) + DestroyIcon(bct->hIconPrivate); + DestroyTheme(bct); + free(bct); + } + SetWindowLongPtr(hwndDlg, 0, 0); + break; + + case WM_SETTEXT: + bct->cHot = 0; + if ((char*) lParam) { + char *tmp = (char *) lParam; + while (*tmp) { + if (*tmp == '&' && *(tmp + 1)) { + bct->cHot = tolower(*(tmp + 1)); + break; + } + tmp++; + } + InvalidateRect(bct->hwnd, NULL, TRUE); + lstrcpyn(bct->szText, (TCHAR *)lParam, 127); + bct->szText[127] = 0; + } + break; + + case WM_SYSKEYUP: + if (bct->stateId != PBS_DISABLED && bct->cHot && bct->cHot == tolower((int) wParam)) { + if (bct->pushBtn) { + if (bct->pbState) + bct->pbState = 0; + else + bct->pbState = 1; + InvalidateRect(bct->hwnd, NULL, TRUE); + } + if (!bct->bSendOnDown) + SendMessage(GetParent(hwndDlg), WM_COMMAND, MAKELONG(GetDlgCtrlID(hwndDlg), BN_CLICKED), (LPARAM) hwndDlg); return 0; - case BM_SETCHECK: - if (!bct->pushBtn) - break; - if (wParam == BST_CHECKED) { - bct->pbState = 1; - bct->stateId = PBS_PRESSED; - } else if (wParam == BST_UNCHECKED) { - bct->pbState = 0; - bct->stateId = PBS_NORMAL; - } - InvalidateRect(bct->hwnd, NULL, TRUE); - break; - case BM_GETCHECK: - if (bct->pushBtn) { - return bct->pbState ? BST_CHECKED : BST_UNCHECKED; - } - return 0; - case BUTTONSETARROW: - // turn arrow on/off - if (wParam) { - if (!bct->arrow) - bct->arrow = (HICON) LoadImage(g_hInst, MAKEINTRESOURCE(IDI_MINIMIZE), IMAGE_ICON, g_cxsmIcon, g_cysmIcon, 0); - } else { - if (bct->arrow) { - DestroyIcon(bct->arrow); - bct->arrow = NULL; - } - } - InvalidateRect(bct->hwnd, NULL, TRUE); - break; - case BUTTONSETDEFAULT: - bct->defbutton = wParam ? 1 : 0; - InvalidateRect(bct->hwnd, NULL, TRUE); - break; - case BUTTONSETASPUSHBTN: - bct->pushBtn = 1; - InvalidateRect(bct->hwnd, NULL, TRUE); - break; - case BUTTONSETASFLATBTN: - bct->flatBtn = lParam == 0 ? 1 : 0; - InvalidateRect(bct->hwnd, NULL, TRUE); - break; - case BUTTONSETASFLATBTN + 10: - bct->bThemed = lParam ? TRUE : FALSE; - bct->bSkinned = bct->bThemed ? 0 : bct->bSkinned; - break; - case BUTTONADDTOOLTIP: - { - TOOLINFO ti; - - if (!(char*) wParam) - break; - if (!hwndToolTips) { - hwndToolTips = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, _T(""), WS_POPUP, 0, 0, 0, 0, NULL, NULL, GetModuleHandle(NULL), NULL); - SetWindowPos(hwndToolTips, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); - } - ZeroMemory(&ti, sizeof(ti)); - ti.cbSize = sizeof(ti); - ti.uFlags = TTF_IDISHWND; - ti.hwnd = bct->hwnd; - ti.uId = (UINT_PTR) bct->hwnd; - if (SendMessage(hwndToolTips, TTM_GETTOOLINFO, 0, (LPARAM) &ti)) { - SendMessage(hwndToolTips, TTM_DELTOOL, 0, (LPARAM) &ti); - } - ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS; - ti.uId = (UINT_PTR) bct->hwnd; - ti.lpszText = (TCHAR *) wParam; - SendMessage(hwndToolTips, TTM_ADDTOOL, 0, (LPARAM) &ti); - break; - } - case WM_SETFOCUS: - // set keybord focus and redraw - bct->focus = 1; - InvalidateRect(bct->hwnd, NULL, TRUE); - break; - case WM_KILLFOCUS: - // kill focus and redraw - bct->focus = 0; - InvalidateRect(bct->hwnd, NULL, TRUE); - break; - case WM_WINDOWPOSCHANGED: - InvalidateRect(bct->hwnd, NULL, TRUE); - break; - case WM_ENABLE: - // windows tells us to enable/disable - { - bct->stateId = wParam ? PBS_NORMAL : PBS_DISABLED; - InvalidateRect(bct->hwnd, NULL, TRUE); - break; - } - case WM_MOUSELEAVE: - // faked by the WM_TIMER - { - if (bct->stateId != PBS_DISABLED) { - // don't change states if disabled - bct->stateId = PBS_NORMAL; - InvalidateRect(bct->hwnd, NULL, TRUE); - } - break; - } - case WM_LBUTTONDOWN: - { - if (bct->stateId != PBS_DISABLED && bct->stateId != PBS_PRESSED) { - bct->stateId = PBS_PRESSED; - InvalidateRect(bct->hwnd, NULL, TRUE); - if(bct->bSendOnDown) { - SendMessage(GetParent(hwndDlg), WM_COMMAND, MAKELONG(GetDlgCtrlID(hwndDlg), BN_CLICKED), (LPARAM) hwndDlg); - bct->stateId = PBS_NORMAL; - InvalidateRect(bct->hwnd, NULL, TRUE); - } - } - break; - } - case WM_LBUTTONUP: - { - if (bct->pushBtn) { - if (bct->pbState) - bct->pbState = 0; - else - bct->pbState = 1; - } - if (bct->stateId != PBS_DISABLED) { - // don't change states if disabled - if (msg == WM_LBUTTONUP) - bct->stateId = PBS_HOT; - else - bct->stateId = PBS_NORMAL; - InvalidateRect(bct->hwnd, NULL, TRUE); - } - if (!bct->bSendOnDown) - SendMessage(GetParent(hwndDlg), WM_COMMAND, MAKELONG(GetDlgCtrlID(hwndDlg), BN_CLICKED), (LPARAM) hwndDlg); - break; - } - case WM_MOUSEMOVE: - if (bct->stateId == PBS_NORMAL) { - bct->stateId = PBS_HOT; - InvalidateRect(bct->hwnd, NULL, TRUE); - } - // Call timer, used to start cheesy TrackMouseEvent faker - SetTimer(hwndDlg, BUTTON_POLLID, BUTTON_POLLDELAY, NULL); - break; - case WM_NCHITTEST: - { - LRESULT lr = SendMessage(GetParent(hwndDlg), WM_NCHITTEST, wParam, lParam); - if(lr == HTLEFT || lr == HTRIGHT || lr == HTBOTTOM || lr == HTTOP || lr == HTTOPLEFT || lr == HTTOPRIGHT - || lr == HTBOTTOMLEFT || lr == HTBOTTOMRIGHT) - return HTTRANSPARENT; - break; - } - case WM_TIMER: - // use a timer to check if they have did a mouseout - { - if (wParam == BUTTON_POLLID) { - RECT rc; - POINT pt; - GetWindowRect(hwndDlg, &rc); - GetCursorPos(&pt); - if (!PtInRect(&rc, pt)) { - // mouse must be gone, trigger mouse leave - PostMessage(hwndDlg, WM_MOUSELEAVE, 0, 0L); - KillTimer(hwndDlg, BUTTON_POLLID); - } - } - break; - } - case WM_ERASEBKGND: - return 1; - } - return DefWindowProc(hwndDlg, msg, wParam, lParam); + } + break; + + case WM_THEMECHANGED: + if (bct->bThemed) + LoadTheme(bct); + InvalidateRect(bct->hwnd, NULL, TRUE); // repaint it + break; + + case WM_SETFONT: + // remember the font so we can use it later + bct->hFont = (HFONT) wParam; // maybe we should redraw? + break; + + case WM_NCPAINT: + case WM_PAINT: + { + PAINTSTRUCT ps; + HDC hdcPaint; + + hdcPaint = BeginPaint(hwndDlg, &ps); + if (hdcPaint) { + PaintWorker(bct, hdcPaint); + EndPaint(hwndDlg, &ps); + } + break; + } + + case BM_GETIMAGE: + if(wParam == IMAGE_ICON) + return (LRESULT)(bct->hIconPrivate ? bct->hIconPrivate : bct->hIcon); + break; + + case BM_SETIMAGE: + if (!lParam) + break; + bct->hIml = 0; + bct->iIcon = 0; + if (wParam == IMAGE_ICON) { + ICONINFO ii = {0}; + BITMAP bm = {0}; + + if (bct->hIconPrivate) { + DestroyIcon(bct->hIconPrivate); + bct->hIconPrivate = 0; + } + + GetIconInfo((HICON) lParam, &ii); + GetObject(ii.hbmColor, sizeof(bm), &bm); + if (bm.bmWidth > g_cxsmIcon || bm.bmHeight > g_cysmIcon) { + HIMAGELIST hImageList; + hImageList = ImageList_Create(g_cxsmIcon, g_cysmIcon, IsWinVerXPPlus() ? ILC_COLOR32 | ILC_MASK : ILC_COLOR16 | ILC_MASK, 1, 0); + ImageList_AddIcon(hImageList, (HICON) lParam); + bct->hIconPrivate = ImageList_GetIcon(hImageList, 0, ILD_NORMAL); + ImageList_RemoveAll(hImageList); + ImageList_Destroy(hImageList); + bct->hIcon = 0; + } else { + bct->hIcon = (HICON) lParam; + bct->hIconPrivate = 0; + } + + DeleteObject(ii.hbmMask); + DeleteObject(ii.hbmColor); + bct->hBitmap = NULL; + InvalidateRect(bct->hwnd, NULL, TRUE); + } + else if (wParam == IMAGE_BITMAP) { + bct->hBitmap = (HBITMAP) lParam; + if (bct->hIconPrivate) + DestroyIcon(bct->hIconPrivate); + bct->hIcon = bct->hIconPrivate = NULL; + InvalidateRect(bct->hwnd, NULL, TRUE); + } + break; + + case BM_SETPRIVATEICON: + bct->hIml = 0; + bct->iIcon = 0; { + if (bct->hIconPrivate) + DestroyIcon(bct->hIconPrivate); + bct->hIconPrivate = DuplicateIcon(g_hInst, (HICON) lParam); + bct->hIcon = 0; + } + break; + + case BM_SETIMLICON: + { + if (bct->hIconPrivate) + DestroyIcon(bct->hIconPrivate); + bct->hIml = (HIMAGELIST) wParam; + bct->iIcon = (int) lParam; + bct->hIcon = bct->hIconPrivate = 0; + InvalidateRect(bct->hwnd, NULL, TRUE); + } + break; + + case BM_SETSKINNED: + bct->bSkinned = (DWORD)lParam; + bct->bThemed = bct->bSkinned ? FALSE : bct->bThemed; + InvalidateRect(bct->hwnd, NULL, TRUE); + break; + + case BM_SETBTNITEM: + bct->buttonItem = (ButtonItem *)lParam; + break; + + case BM_SETASMENUACTION: + bct->bSendOnDown = wParam ? TRUE : FALSE; + return 0; + + case BM_SETCHECK: + if (!bct->pushBtn) + break; + if (wParam == BST_CHECKED) { + bct->pbState = 1; + bct->stateId = PBS_PRESSED; + } else if (wParam == BST_UNCHECKED) { + bct->pbState = 0; + bct->stateId = PBS_NORMAL; + } + InvalidateRect(bct->hwnd, NULL, TRUE); + break; + + case BM_GETCHECK: + if (bct->pushBtn) + return bct->pbState ? BST_CHECKED : BST_UNCHECKED; + + return 0; + + case BUTTONSETARROW: + // turn arrow on/off + if (wParam) { + if (!bct->arrow) + bct->arrow = (HICON) LoadImage(g_hInst, MAKEINTRESOURCE(IDI_MINIMIZE), IMAGE_ICON, g_cxsmIcon, g_cysmIcon, 0); + } + else { + if (bct->arrow) { + DestroyIcon(bct->arrow); + bct->arrow = NULL; + } + } + InvalidateRect(bct->hwnd, NULL, TRUE); + break; + + case BUTTONSETDEFAULT: + bct->defbutton = wParam ? 1 : 0; + InvalidateRect(bct->hwnd, NULL, TRUE); + break; + + case BUTTONSETASPUSHBTN: + bct->pushBtn = 1; + InvalidateRect(bct->hwnd, NULL, TRUE); + break; + + case BUTTONSETASFLATBTN: + bct->flatBtn = lParam == 0 ? 1 : 0; + InvalidateRect(bct->hwnd, NULL, TRUE); + break; + + case BUTTONSETASFLATBTN + 10: + bct->bThemed = lParam ? TRUE : FALSE; + bct->bSkinned = bct->bThemed ? 0 : bct->bSkinned; + break; + + case BUTTONADDTOOLTIP: + if (wParam) { + if (!hwndToolTips) { + hwndToolTips = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, _T(""), WS_POPUP, 0, 0, 0, 0, NULL, NULL, GetModuleHandle(NULL), NULL); + SetWindowPos(hwndToolTips, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); + } + + TOOLINFO ti = { 0 }; + ti.cbSize = sizeof(ti); + ti.uFlags = TTF_IDISHWND; + ti.hwnd = bct->hwnd; + ti.uId = (UINT_PTR) bct->hwnd; + if (SendMessage(hwndToolTips, TTM_GETTOOLINFO, 0, (LPARAM) &ti)) { + SendMessage(hwndToolTips, TTM_DELTOOL, 0, (LPARAM) &ti); + } + ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS; + ti.uId = (UINT_PTR) bct->hwnd; + ti.lpszText = (TCHAR *) wParam; + SendMessage(hwndToolTips, TTM_ADDTOOL, 0, (LPARAM) &ti); + } + break; + + case WM_SETFOCUS: + // set keybord focus and redraw + bct->focus = 1; + InvalidateRect(bct->hwnd, NULL, TRUE); + break; + + case WM_KILLFOCUS: + // kill focus and redraw + bct->focus = 0; + InvalidateRect(bct->hwnd, NULL, TRUE); + break; + + case WM_WINDOWPOSCHANGED: + InvalidateRect(bct->hwnd, NULL, TRUE); + break; + + case WM_ENABLE: + // windows tells us to enable/disable + bct->stateId = wParam ? PBS_NORMAL : PBS_DISABLED; + InvalidateRect(bct->hwnd, NULL, TRUE); + break; + + case WM_MOUSELEAVE: + // faked by the WM_TIMER + if (bct->stateId != PBS_DISABLED) { + // don't change states if disabled + bct->stateId = PBS_NORMAL; + InvalidateRect(bct->hwnd, NULL, TRUE); + } + break; + + case WM_LBUTTONDOWN: + if (bct->stateId != PBS_DISABLED && bct->stateId != PBS_PRESSED) { + bct->stateId = PBS_PRESSED; + InvalidateRect(bct->hwnd, NULL, TRUE); + if(bct->bSendOnDown) { + SendMessage(GetParent(hwndDlg), WM_COMMAND, MAKELONG(GetDlgCtrlID(hwndDlg), BN_CLICKED), (LPARAM) hwndDlg); + bct->stateId = PBS_NORMAL; + InvalidateRect(bct->hwnd, NULL, TRUE); + } + } + break; + + case WM_LBUTTONUP: + if (bct->pushBtn) { + if (bct->pbState) + bct->pbState = 0; + else + bct->pbState = 1; + } + if (bct->stateId != PBS_DISABLED) { + // don't change states if disabled + if (msg == WM_LBUTTONUP) + bct->stateId = PBS_HOT; + else + bct->stateId = PBS_NORMAL; + InvalidateRect(bct->hwnd, NULL, TRUE); + } + if (!bct->bSendOnDown) + SendMessage(GetParent(hwndDlg), WM_COMMAND, MAKELONG(GetDlgCtrlID(hwndDlg), BN_CLICKED), (LPARAM) hwndDlg); + break; + + case WM_MOUSEMOVE: + if (bct->stateId == PBS_NORMAL) { + bct->stateId = PBS_HOT; + InvalidateRect(bct->hwnd, NULL, TRUE); + } + // Call timer, used to start cheesy TrackMouseEvent faker + SetTimer(hwndDlg, BUTTON_POLLID, BUTTON_POLLDELAY, NULL); + break; + + case WM_NCHITTEST: + { + LRESULT lr = SendMessage(GetParent(hwndDlg), WM_NCHITTEST, wParam, lParam); + if(lr == HTLEFT || lr == HTRIGHT || lr == HTBOTTOM || lr == HTTOP || lr == HTTOPLEFT || lr == HTTOPRIGHT + || lr == HTBOTTOMLEFT || lr == HTBOTTOMRIGHT) + return HTTRANSPARENT; + } + break; + + case WM_TIMER: + // use a timer to check if they have did a mouseout + if (wParam == BUTTON_POLLID) { + RECT rc; + POINT pt; + GetWindowRect(hwndDlg, &rc); + GetCursorPos(&pt); + if (!PtInRect(&rc, pt)) { + // mouse must be gone, trigger mouse leave + PostMessage(hwndDlg, WM_MOUSELEAVE, 0, 0L); + KillTimer(hwndDlg, BUTTON_POLLID); + } + } + break; + + case WM_ERASEBKGND: + return 1; + } + return DefWindowProc(hwndDlg, msg, wParam, lParam); +} + +///////////////////////////////////////////////////////////////////////////////////////// + +int LoadCLCButtonModule(void) +{ + WNDCLASSEX wc = { 0 }; + wc.cbSize = sizeof(wc); + wc.lpszClassName = _T("CLCButtonClass"); + wc.lpfnWndProc = TSButtonWndProc; + wc.hCursor = LoadCursor(NULL, IDC_ARROW); + wc.cbWndExtra = sizeof(MButtonCtrl *); + wc.hbrBackground = 0; + wc.style = CS_GLOBALCLASS; + RegisterClassEx(&wc); + return 0; +} + +int UnloadTSButtonModule(WPARAM, LPARAM) +{ + return 0; } diff --git a/plugins/Console/Console.c b/plugins/Console/Console.c index 7d08659a8b..eea28e711f 100644 --- a/plugins/Console/Console.c +++ b/plugins/Console/Console.c @@ -122,8 +122,6 @@ static int Openfile(TCHAR *outputFile, int selection); //////////////////////////////////////////////////////////////////////////////// #ifdef TTB -static HBITMAP BmpUp = NULL; -static HBITMAP BmpDn = NULL; static HANDLE hTTBButt = 0; static INT_PTR HideConsoleButt(WPARAM wParam,LPARAM lParam) @@ -149,12 +147,9 @@ static int OnTTBLoaded(WPARAM wParam,LPARAM lParam) CreateServiceFunction("Console/Hide", HideConsoleButt); CreateServiceFunction("Console/Show", ShowConsoleButt); - BmpUp = LoadBitmap(hInst,MAKEINTRESOURCE(IDB_CONSOLE_UP)); - BmpDn = LoadBitmap(hInst,MAKEINTRESOURCE(IDB_CONSOLE_DOWN)); - ttbb.cbSize = sizeof(ttbb); - ttbb.hbBitmapUp = BmpUp; - ttbb.hbBitmapDown = BmpDn; + ttbb.hIconUp = LoadIcon(hInst, MAKEINTRESOURCE(IDI_CONSOLE_UP)); + ttbb.hIconDn = LoadIcon(hInst, MAKEINTRESOURCE(IDI_CONSOLE_DOWN)); ttbb.dwFlags=(state?TTBBF_PUSHED:0)|TTBBF_VISIBLE|TTBBF_SHOWTOOLTIP; ttbb.pszServiceDown = "Console/Show"; ttbb.pszServiceUp = "Console/Hide"; @@ -1485,11 +1480,6 @@ void ShutdownConsole(void) for(i = 0; i < SIZEOF(hIcons); i++) { if (hIcons[i]) DestroyIcon(hIcons[i]); } - -#ifdef TBB - if (BmpUp) DeleteObject(BmpUp); - if (BmpDn) DeleteObject(BmpDn); -#endif } //////////////////////////////////////////////////////////////////////////////// diff --git a/plugins/Console/Console.opt b/plugins/Console/Console.opt deleted file mode 100644 index 8c2c90007d..0000000000 Binary files a/plugins/Console/Console.opt and /dev/null differ diff --git a/plugins/Console/Console.plg b/plugins/Console/Console.plg deleted file mode 100644 index 60b675e88e..0000000000 --- a/plugins/Console/Console.plg +++ /dev/null @@ -1,49 +0,0 @@ - - -
-

Build Log

-

---------------------Configuration: Console - Win32 Release Unicode-------------------- -

-

Command Lines

-Creating command line "rc.exe /l 0x409 /fo"Release_Unicode/resource.res" /i "..\..\include" /d "NDEBUG" "D:\Sources\svn.miranda.im\console\trunk\resource.rc"" -Creating temporary file "C:\Temp\RSPB728.tmp" with contents -[ -/nologo /MD /W3 /GX /Zi /O2 /I "../../include" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "Console_EXPORTS" /FR"Release_Unicode/" /Fo".\Release/" /Fd".\Release/" /c -"D:\Sources\svn.miranda.im\console\trunk\Commonheaders.c" -"D:\Sources\svn.miranda.im\console\trunk\Console.c" -] -Creating command line "cl.exe @C:\Temp\RSPB728.tmp" -Creating temporary file "C:\Temp\RSPB729.tmp" with contents -[ -/nologo /MD /W3 /Zi /Ox /Og /Gf /Gy /I "../../include" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "Console_EXPORTS" /Fr"Release_Unicode/" /Fo".\Release/" /Fd".\Release/" /c -"D:\Sources\svn.miranda.im\console\trunk\init.c" -] -Creating command line "cl.exe @C:\Temp\RSPB729.tmp" -Creating temporary file "C:\Temp\RSPB72A.tmp" with contents -[ -kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /incremental:no /pdb:"Release_Unicode/Console.pdb" /map:"Release_Unicode/Console.map" /debug /machine:IX86 /out:"Release_Unicode\Plugins\Console.dll" /implib:".\Release/Console.lib" -.\Release\Commonheaders.obj -.\Release\Console.obj -.\Release\init.obj -.\Release_Unicode\resource.res -] -Creating command line "link.exe @C:\Temp\RSPB72A.tmp" -

Output Window

-Compiling resources... -Compiling... -Commonheaders.c -Console.c -Generating Code... -Compiling... -init.c -Linking... - Creating library .\Release/Console.lib and object .\Release/Console.exp - - - -

Results

-Console.dll - 0 error(s), 0 warning(s) -
- - diff --git a/plugins/Console/res/console_dn.bmp b/plugins/Console/res/console_dn.bmp deleted file mode 100644 index 33bb07c0f2..0000000000 Binary files a/plugins/Console/res/console_dn.bmp and /dev/null differ diff --git a/plugins/Console/res/console_dn.ico b/plugins/Console/res/console_dn.ico new file mode 100644 index 0000000000..be752114a7 Binary files /dev/null and b/plugins/Console/res/console_dn.ico differ diff --git a/plugins/Console/res/console_up.bmp b/plugins/Console/res/console_up.bmp deleted file mode 100644 index 2cdbb8d0cc..0000000000 Binary files a/plugins/Console/res/console_up.bmp and /dev/null differ diff --git a/plugins/Console/res/console_up.ico b/plugins/Console/res/console_up.ico new file mode 100644 index 0000000000..2c8198b29c Binary files /dev/null and b/plugins/Console/res/console_up.ico differ diff --git a/plugins/Console/resource.h b/plugins/Console/resource.h index e0b9ed225a..a8947819a4 100644 --- a/plugins/Console/resource.h +++ b/plugins/Console/resource.h @@ -2,8 +2,8 @@ // Microsoft Visual C++ generated include file. // Used by resource.rc // -#define IDB_CONSOLE_UP 100 -#define IDB_CONSOLE_DOWN 101 +#define IDI_CONSOLE_UP 100 +#define IDI_CONSOLE_DOWN 101 #define IDD_MSG 111 #define IDD_CONSOLE 112 #define IDD_LOG 113 diff --git a/plugins/Console/resource.rc b/plugins/Console/resource.rc index c67981d6d4..55f6382d2f 100644 --- a/plugins/Console/resource.rc +++ b/plugins/Console/resource.rc @@ -180,14 +180,8 @@ IDI_OUT ICON "Res\\out.ico" IDI_ARROW ICON "Res\\arrow.ico" IDI_INFO ICON "Res\\info.ico" IDI_EMPTY ICON "Res\\empty.ico" - -///////////////////////////////////////////////////////////////////////////// -// -// Bitmap -// - -IDB_CONSOLE_UP BITMAP "res\\console_up.bmp" -IDB_CONSOLE_DOWN BITMAP "res\\console_dn.bmp" +IDI_CONSOLE_UP ICON "Res\\console_up.ico" +IDI_CONSOLE_DOWN ICON "Res\\console_dn.ico" ///////////////////////////////////////////////////////////////////////////// // diff --git a/plugins/ExternalAPI/m_toptoolbar.h b/plugins/ExternalAPI/m_toptoolbar.h index 5628f68de8..f67a3f965b 100644 --- a/plugins/ExternalAPI/m_toptoolbar.h +++ b/plugins/ExternalAPI/m_toptoolbar.h @@ -3,20 +3,17 @@ #define M_TOPTOOLBAR_H //button flags -#define TTBBF_DISABLED 1 -#define TTBBF_VISIBLE 2 -#define TTBBF_PUSHED 4 -#define TTBBF_SHOWTOOLTIP 8 -#define TTBBF_DRAWBORDER 16//draw border for bitmap,bitmap must be WxH 16x12 -#define TTBBF_ISSEPARATOR 32 - -//for internal launch buttons +#define TTBBF_DISABLED 1 +#define TTBBF_VISIBLE 2 +#define TTBBF_PUSHED 4 +#define TTBBF_SHOWTOOLTIP 8 +#define TTBBF_DRAWBORDER 16 +#define TTBBF_ISSEPARATOR 32 #define TTBBF_ISLBUTTON 64 +#define TTBBF_ICONBYHANDLE 128 typedef struct { int cbSize; - HBITMAP hbBitmapUp; - HBITMAP hbBitmapDown; char *pszServiceUp; char *pszServiceDown; DWORD dwFlags; @@ -25,26 +22,18 @@ typedef struct { LPARAM lParamDown; WPARAM wParamDown; char *name; - -} TTBButton, * lpTTBButton; - -typedef struct { - int cbSize; - HBITMAP hbBitmapUp; - HBITMAP hbBitmapDown; - char *pszServiceUp; - char *pszServiceDown; - DWORD dwFlags; - LPARAM lParamUp; - WPARAM wParamUp; - LPARAM lParamDown; - WPARAM wParamDown; - char *name; - HICON hIconUp,hIconDn; + union { + HICON hIconUp; + HANDLE hIconHandleUp; + }; + union { + HICON hIconDn; + HANDLE hIconHandleDn; + }; char *tooltipUp; char *tooltipDn; - -} TTBButtonV2, * lpTTBButtonV2; +} + TTBButton, * lpTTBButton; //=== EVENTS === /* diff --git a/plugins/ListeningTo/listeningto.cpp b/plugins/ListeningTo/listeningto.cpp index ca89e587f9..f5fbfd6d20 100644 --- a/plugins/ListeningTo/listeningto.cpp +++ b/plugins/ListeningTo/listeningto.cpp @@ -34,8 +34,6 @@ Boston, MA 02111-1307, USA. #define MS_LISTENINGTO_HOTKEYS_DISABLE "ListeningTo/HotkeysDisable" #define MS_LISTENINGTO_HOTKEYS_TOGGLE "ListeningTo/HotkeysToggle" -#define ICON_NAME "LISTENING_TO_ICON" - int hLangpack; PLUGININFOEX pluginInfo={ @@ -60,8 +58,8 @@ struct UTF8_INTERFACE utfi; static std::vector hHooks; static std::vector hServices; -static HANDLE hEnableStateChangedEvent = NULL; -HANDLE hExtraIcon = NULL; +static HANDLE hEnableStateChangedEvent; +HANDLE hExtraIcon, hIcon1, hIcon2; static HANDLE hMainMenuGroup = NULL; static HANDLE hListeningInfoChangedEvent = NULL; @@ -74,7 +72,6 @@ static DWORD lastInfoSetTime = 0; std::vector proto_itens; - int ModulesLoaded(WPARAM wParam, LPARAM lParam); int PreShutdown(WPARAM wParam, LPARAM lParam); int PreBuildContactMenu(WPARAM wParam,LPARAM lParam); @@ -117,47 +114,24 @@ TCHAR* VariablesParsePlayer(ARGUMENTSINFO *ai); // Functions //////////////////////////////////////////////////////////////////////////// - - extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { hInst = hinstDLL; return TRUE; } - extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) { pluginInfo.cbSize = sizeof(PLUGININFOEX); return &pluginInfo; } - static const MUUID interfaces[] = { MIID_LISTENINGTO, MIID_LAST }; extern "C" __declspec(dllexport) const MUUID* MirandaPluginInterfaces(void) { return interfaces; } -/* -BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam) -{ - // Find the windows - char class_name[1024]; - if (GetClassNameA(hwnd, class_name, sizeof(class_name))) - { - class_name[sizeof(class_name)-1] = '\0'; -OutputDebugStringA(class_name); -OutputDebugStringA(" -> "); - GetWindowTextA(hwnd, class_name, 1024); -OutputDebugStringA(class_name); -OutputDebugStringA("\n"); - } - - return TRUE; -} -*/ - extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) { pluginLink = link; @@ -352,10 +326,11 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) // add our modules to the KnownModules list CallService("DBEditorpp/RegisterSingleModule", (WPARAM) MODULE_NAME, 0); - IcoLib_Register(ICON_NAME, _T("Contact List"), _T("Listening to"), IDI_LISTENINGTO); + hIcon1 = IcoLib_Register("listening_to_icon", _T("Contact List"), _T("Listening to"), IDI_LISTENINGTO); + hIcon2 = IcoLib_Register("listening_off_icon", _T("Contact List"), _T("Listening to"), IDI_LISTENINGOFF); // Extra icon support - hExtraIcon = ExtraIcon_Register(MODULE_NAME, "Listening to music", ICON_NAME); + hExtraIcon = ExtraIcon_Register(MODULE_NAME, "Listening to music", "listening_to_icon"); if (hExtraIcon != NULL) { HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); @@ -390,8 +365,8 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) mi.position = 500080000; mi.pszPopupName = (char*) -1; mi.pszName = "Listening to"; - mi.flags = CMIF_ROOTPOPUP; - mi.hIcon = IcoLib_LoadIcon(ICON_NAME); + mi.flags = CMIF_ROOTPOPUP | CMIF_ICONFROMICOLIB; + mi.icolibItem = hIcon1; hMainMenuGroup = (HANDLE) CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM) &mi); @@ -594,11 +569,11 @@ int TopToolBarLoaded(WPARAM wParam, LPARAM lParam) TTBButton ttb = {0}; ttb.cbSize = sizeof(ttb); - ttb.hbBitmapUp = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_TTB_UP_DISABLED)); - ttb.hbBitmapDown = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_TTB_UP_ENABLED)); + ttb.hIconHandleDn = hIcon2; + ttb.hIconHandleUp = hIcon1; ttb.pszServiceUp = MS_LISTENINGTO_TTB; ttb.pszServiceDown = MS_LISTENINGTO_TTB; - ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP | (enabled ? TTBBF_PUSHED : 0); + ttb.dwFlags = TTBBF_VISIBLE | TTBBF_ICONBYHANDLE | TTBBF_SHOWTOOLTIP | (enabled ? TTBBF_PUSHED : 0); ttb.name = Translate("Enable/Disable sending Listening To info (to all protocols)"); hTTB = (HANDLE)CallService(MS_TTB_ADDBUTTON, (WPARAM)&ttb, 0); @@ -1076,11 +1051,11 @@ void HasNewListeningInfo() int ClistExtraListRebuild(WPARAM wParam, LPARAM lParam) { - HICON hIcon = IcoLib_LoadIcon(ICON_NAME); + HICON hIcon = Skin_GetIconByHandle(hIcon1); hExtraImage = (HANDLE) CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM) hIcon, 0); - IcoLib_ReleaseIcon(hIcon); + Skin_ReleaseIcon(hIcon); return 0; } @@ -1089,7 +1064,7 @@ void SetExtraIcon(HANDLE hContact, BOOL set) { if (hExtraIcon != NULL) { - ExtraIcon_SetIcon(hExtraIcon, hContact, set ? ICON_NAME : NULL); + ExtraIcon_SetIcon(hExtraIcon, hContact, set ? "listening_to_icon" : NULL); } else if (opts.show_adv_icon && hExtraImage != NULL) { @@ -1248,5 +1223,3 @@ TCHAR* VariablesParsePlayer(ARGUMENTSINFO *ai) { VARIABLES_PARSE_BODY(ptszPlayer); } - - diff --git a/plugins/ListeningTo/res/listening_off.ico b/plugins/ListeningTo/res/listening_off.ico new file mode 100644 index 0000000000..bdacbb028a Binary files /dev/null and b/plugins/ListeningTo/res/listening_off.ico differ diff --git a/plugins/ListeningTo/res/ttb_disabled.bmp b/plugins/ListeningTo/res/ttb_disabled.bmp deleted file mode 100644 index df1a9abde5..0000000000 Binary files a/plugins/ListeningTo/res/ttb_disabled.bmp and /dev/null differ diff --git a/plugins/ListeningTo/res/ttb_enabled.bmp b/plugins/ListeningTo/res/ttb_enabled.bmp deleted file mode 100644 index 98467fb6e5..0000000000 Binary files a/plugins/ListeningTo/res/ttb_enabled.bmp and /dev/null differ diff --git a/plugins/ListeningTo/resource.h b/plugins/ListeningTo/resource.h index 3f35843a69..d4084c98b4 100644 --- a/plugins/ListeningTo/resource.h +++ b/plugins/ListeningTo/resource.h @@ -5,9 +5,8 @@ #define IDD_OPTIONS 119 #define IDD_PLAYERS 120 #define IDD_FORMAT 121 -#define IDB_TTB_UP_DISABLED 122 -#define IDB_TTB_UP_ENABLED 123 -#define IDI_LISTENINGTO 124 +#define IDI_LISTENINGTO 122 +#define IDI_LISTENINGOFF 123 #define IDC_DELAY 1001 #define IDC_WINCOLORS 1002 #define IDC_DEFAULTCOLORS 1003 @@ -81,7 +80,7 @@ #define IDC_STATIC -1 // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NO_MFC 1 diff --git a/plugins/ListeningTo/resource.rc b/plugins/ListeningTo/resource.rc index 893cf39de6..49f777458d 100644 --- a/plugins/ListeningTo/resource.rc +++ b/plugins/ListeningTo/resource.rc @@ -116,7 +116,7 @@ END // #ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO +GUIDELINES DESIGNINFO BEGIN IDD_OPTIONS, DIALOG BEGIN @@ -145,14 +145,6 @@ END #endif // APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Bitmap -// - -IDB_TTB_UP_DISABLED BITMAP "res\\ttb_disabled.bmp" -IDB_TTB_UP_ENABLED BITMAP "res\\ttb_enabled.bmp" - ///////////////////////////////////////////////////////////////////////////// // // Icon @@ -180,19 +172,19 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_CAN // TEXTINCLUDE // -1 TEXTINCLUDE +1 TEXTINCLUDE BEGIN "resource.h\0" END -2 TEXTINCLUDE +2 TEXTINCLUDE BEGIN "#include ""resource.h""\r\n" "#include ""winresrc.h""\r\n" "\0" END -3 TEXTINCLUDE +3 TEXTINCLUDE BEGIN "\r\n" "\0" @@ -214,4 +206,3 @@ END ///////////////////////////////////////////////////////////////////////////// #endif // not APSTUDIO_INVOKED - diff --git a/plugins/Popup/src/main.cpp b/plugins/Popup/src/main.cpp index 7f17238cf2..afebbe75e3 100644 --- a/plugins/Popup/src/main.cpp +++ b/plugins/Popup/src/main.cpp @@ -211,7 +211,7 @@ static int IconsChanged(WPARAM wParam,LPARAM lParam){ CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hMenuItemHistory,(LPARAM)&mi); if (hTTButton >= 0) { - TTBButtonV2 btn = {0}; + TTBButton btn = {0}; btn.cbSize = sizeof(btn); btn.pszServiceUp = btn.pszServiceDown = MENUCOMMAND_SVC; btn.lParamUp = 1; @@ -230,7 +230,7 @@ static int IconsChanged(WPARAM wParam,LPARAM lParam){ static int TTBLoaded(WPARAM wParam,LPARAM lParam){ if (hTTButton < 0) { - TTBButtonV2 btn = {0}; + TTBButton btn = {0}; btn.cbSize = sizeof(btn); btn.pszServiceUp = btn.pszServiceDown = MENUCOMMAND_SVC; btn.lParamUp = 1; diff --git a/plugins/RecentContacts/RecentContacts.cpp b/plugins/RecentContacts/RecentContacts.cpp index af3a21f501..cbb77d8491 100644 --- a/plugins/RecentContacts/RecentContacts.cpp +++ b/plugins/RecentContacts/RecentContacts.cpp @@ -14,16 +14,11 @@ int hLangpack = 0; MM_INTERFACE mmi; LIST_INTERFACE li; -HANDLE hMenu = NULL; -HANDLE hPrebuildMenu = NULL; -HANDLE hSystemModulesLoaded = NULL; -HANDLE hTopToolbarLoaded = NULL; -HANDLE hTopToolbarButtonShowList = NULL; -HANDLE hMsgWndEvent = NULL; -HANDLE hWindowList = NULL; -HANDLE hMenuItemRemove = NULL; -HANDLE hOptInitialise = NULL; -HANDLE hContactSetting = NULL; +HANDLE hTopToolbarButtonShowList; +HANDLE hMsgWndEvent; +HANDLE hWindowList; +HANDLE hMenuItemRemove; +HANDLE hIcon; const INT_PTR boo = 0; LIST ServiceList(10,boo), HookList(10,boo); @@ -466,10 +461,8 @@ int Create_TopToolbarShowList(WPARAM wParam, LPARAM lParam) if (ServiceExists(MS_TTB_ADDBUTTON)) { TTBButton ttbb = { 0 }; ttbb.cbSize = sizeof(ttbb); - ttbb.hbBitmapUp = - ttbb.hbBitmapDown = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_CMD_SHOWLASTUSED)); - ttbb.pszServiceUp = - ttbb.pszServiceDown = msLastUC_ShowList; + ttbb.hIconHandleDn = ttbb.hIconHandleDn = hIcon; + ttbb.pszServiceUp = ttbb.pszServiceDown = msLastUC_ShowList; ttbb.dwFlags = TTBBF_VISIBLE|TTBBF_SHOWTOOLTIP|TTBBF_DRAWBORDER; ttbb.name = Translate(msLastUC_ShowListName); @@ -540,7 +533,7 @@ static void iconsInit(void) sid.pszDescription = LPGEN("Main icon"); sid.pszName = "recent_main"; sid.iDefaultIndex = -IDI_SHOWRECENT; - CallService(MS_SKIN2_ADDICON, 0, (LPARAM)&sid); + hIcon = Skin_AddIcon(&sid); } static int OnPrebuildContactMenu (WPARAM wParam, LPARAM lParam) diff --git a/plugins/RecentContacts/RecentContacts.ico b/plugins/RecentContacts/RecentContacts.ico index 765c18bb73..25efdf36ab 100644 Binary files a/plugins/RecentContacts/RecentContacts.ico and b/plugins/RecentContacts/RecentContacts.ico differ diff --git a/plugins/RecentContacts/resource.h b/plugins/RecentContacts/resource.h index 93dc6a4a6f..59e47a934a 100644 --- a/plugins/RecentContacts/resource.h +++ b/plugins/RecentContacts/resource.h @@ -4,10 +4,8 @@ // #define IDD_LASTUC_OPT 9 #define IDI_FOLDER 101 -#define IDB_FOLDER 102 -#define IDI_CMD_BROWSE 103 +#define IDI_CMD_BROWSE 102 #define IDI_SHOWRECENT 103 -#define IDB_CMD_SHOWLASTUSED 104 #define IDD_LASTUC_DIALOG 105 #define IDC_LIST1 1000 #define IDC_CONTACTS_LIST 1000 @@ -16,7 +14,7 @@ #define IDC_DATETIME 1005 // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 106 diff --git a/plugins/RecentContacts/resource.rc b/plugins/RecentContacts/resource.rc index 7656a189e4..463d9f0a76 100644 --- a/plugins/RecentContacts/resource.rc +++ b/plugins/RecentContacts/resource.rc @@ -21,28 +21,21 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT #pragma code_page(1251) #endif //_WIN32 -///////////////////////////////////////////////////////////////////////////// -// -// Bitmap -// - -IDB_CMD_SHOWLASTUSED BITMAP "RecentContacts.bmp" - ///////////////////////////////////////////////////////////////////////////// // // Dialog // IDD_LASTUC_DIALOG DIALOGEX 0, 0, 150, 200 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU | +STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME EXSTYLE WS_EX_TOOLWINDOW CAPTION "Recent Contacts" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - CONTROL "",IDC_CONTACTS_LIST,"SysListView32",LVS_REPORT | - LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | - LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | WS_BORDER | + CONTROL "",IDC_CONTACTS_LIST,"SysListView32",LVS_REPORT | + LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | + LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,0,0,150,200 END @@ -65,18 +58,18 @@ LANGUAGE LANG_GERMAN, SUBLANG_GERMAN // TEXTINCLUDE // -1 TEXTINCLUDE +1 TEXTINCLUDE BEGIN "resource.h\0" END -2 TEXTINCLUDE +2 TEXTINCLUDE BEGIN "#include ""afxres.h""\r\n" "\0" END -3 TEXTINCLUDE +3 TEXTINCLUDE BEGIN "\r\n" "\0" @@ -133,7 +126,7 @@ IDI_SHOWRECENT ICON "RecentContacts.ico" // #ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO +GUIDELINES DESIGNINFO BEGIN IDD_LASTUC_OPT, DIALOG BEGIN @@ -161,4 +154,3 @@ END ///////////////////////////////////////////////////////////////////////////// #endif // not APSTUDIO_INVOKED - diff --git a/plugins/SimpleStatusMsg/main.cpp b/plugins/SimpleStatusMsg/main.cpp index 47a3e38eb0..44beb6312e 100644 --- a/plugins/SimpleStatusMsg/main.cpp +++ b/plugins/SimpleStatusMsg/main.cpp @@ -1625,7 +1625,7 @@ VOID CALLBACK UpdateMsgTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD d static int AddTopToolbarButton(WPARAM wParam, LPARAM lParam) { - TTBButtonV2 ttbb = {0}; + TTBButton ttbb = {0}; ttbb.cbSize = sizeof(ttbb); ttbb.hIconUp = ttbb.hIconDn = LoadIconEx("csmsg"); diff --git a/plugins/StatusPlugins/StartupStatus/StartupStatus.rc b/plugins/StatusPlugins/StartupStatus/StartupStatus.rc index fd2f96e9f3..8f41f36229 100644 --- a/plugins/StatusPlugins/StartupStatus/StartupStatus.rc +++ b/plugins/StatusPlugins/StartupStatus/StartupStatus.rc @@ -27,18 +27,18 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // TEXTINCLUDE // -1 TEXTINCLUDE +1 TEXTINCLUDE BEGIN "..\\resource.h\0" END -2 TEXTINCLUDE +2 TEXTINCLUDE BEGIN "#include ""afxres.h""\r\n" "\0" END -3 TEXTINCLUDE +3 TEXTINCLUDE BEGIN "\r\n" "\0" @@ -53,8 +53,7 @@ END IDI_TTBDOWN ICON "res\\ttbDown.ico" IDI_TTBUP ICON "res\\ttbUp.ico" -IDB_TTBDOWN BITMAP "res\\ttbDown.bmp" -IDB_TTBUP BITMAP "res\\ttbUp.bmp" + #endif // English (U.S.) resources ///////////////////////////////////////////////////////////////////////////// @@ -69,4 +68,3 @@ IDB_TTBUP BITMAP "res\\ttbUp.bmp" ///////////////////////////////////////////////////////////////////////////// #endif // not APSTUDIO_INVOKED - diff --git a/plugins/StatusPlugins/StartupStatus/options.cpp b/plugins/StatusPlugins/StartupStatus/options.cpp index 6422091cc6..91b437f7ed 100644 --- a/plugins/StatusPlugins/StartupStatus/options.cpp +++ b/plugins/StatusPlugins/StartupStatus/options.cpp @@ -33,8 +33,6 @@ static int CountSettings(const char *szSetting,LPARAM lParam); static int DeleteSetting(const char *szSetting,LPARAM lParam); static int ClearDatabase(char* filter); -int LoadMainOptions(); - ///////////////////////////////////////////////////////////////////////////////////////// static TSettingsList* GetCurrentProtoSettings() diff --git a/plugins/StatusPlugins/StartupStatus/profiles.cpp b/plugins/StatusPlugins/StartupStatus/profiles.cpp index c6f4298f19..339733b31a 100644 --- a/plugins/StatusPlugins/StartupStatus/profiles.cpp +++ b/plugins/StatusPlugins/StartupStatus/profiles.cpp @@ -366,7 +366,7 @@ static int UnregisterHotKeys() return 0; } -int ReinitProfileModule() +int LoadMainOptions() { if (ServiceExists(MS_TTB_ADDBUTTON)) { RemoveTopToolbarButtons(); @@ -376,17 +376,15 @@ int ReinitProfileModule() RemoveTopToolbarButtons(); CreateTopToolbarButtons(0,0); } + UnregisterHotKeys(); RegisterHotKeys(); - return 0; } int LoadProfileModule() { hLoadAndSetProfileService = CreateServiceFunction(MS_SS_LOADANDSETPROFILE, LoadAndSetProfile); - hTBModuleLoadedHook = HookEvent(ME_TB_MODULELOADED, CreateToolbarButtons); - RegisterButtons(); return 0; } @@ -394,10 +392,11 @@ int LoadProfileModule() int InitProfileModule() { hTTBModuleLoadedHook = HookEvent(ME_TTB_MODULELOADED, CreateTopToolbarButtons); - ReinitProfileModule(); + hTBModuleLoadedHook = HookEvent(ME_TB_MODULELOADED, CreateToolbarButtons); hPrebuildProfilesMenu = HookEvent( ME_CLIST_PREBUILDSTATUSMENU, CreateMainMenuItems); - CreateMainMenuItems(0,0); + CreateMainMenuItems(0,0); + RegisterHotKeys(); return 0; } diff --git a/plugins/StatusPlugins/StartupStatus/res/ttbDown.bmp b/plugins/StatusPlugins/StartupStatus/res/ttbDown.bmp deleted file mode 100644 index 91f95e240b..0000000000 Binary files a/plugins/StatusPlugins/StartupStatus/res/ttbDown.bmp and /dev/null differ diff --git a/plugins/StatusPlugins/StartupStatus/res/ttbUp.bmp b/plugins/StatusPlugins/StartupStatus/res/ttbUp.bmp deleted file mode 100644 index 5b684407a5..0000000000 Binary files a/plugins/StatusPlugins/StartupStatus/res/ttbUp.bmp and /dev/null differ diff --git a/plugins/StatusPlugins/StartupStatus/startupstatus.cpp b/plugins/StatusPlugins/StartupStatus/startupstatus.cpp index 13b58e2e52..c9ad54ebb7 100644 --- a/plugins/StatusPlugins/StartupStatus/startupstatus.cpp +++ b/plugins/StatusPlugins/StartupStatus/startupstatus.cpp @@ -284,12 +284,6 @@ static VOID CALLBACK SetStatusTimed(HWND hwnd,UINT message, UINT_PTR idEvent,DWO CallService(MS_CS_SETSTATUSEX, (WPARAM)&startupSettings, 0); } -int LoadMainOptions() -{ - ReinitProfileModule(); - return 0; -} - static int Exit(WPARAM wParam, LPARAM lParam) { DeinitProfilesModule(); diff --git a/plugins/StatusPlugins/StartupStatus/startupstatus.h b/plugins/StatusPlugins/StartupStatus/startupstatus.h index 19ff57e76f..c1e8e69bb8 100644 --- a/plugins/StatusPlugins/StartupStatus/startupstatus.h +++ b/plugins/StatusPlugins/StartupStatus/startupstatus.h @@ -159,7 +159,6 @@ void RegisterButtons(); int LoadProfileModule(); int InitProfileModule(); -int ReinitProfileModule(); int DeinitProfilesModule(); #endif //__STARTUPSTATUSHEADER diff --git a/plugins/StatusPlugins/StartupStatus/toolbars.cpp b/plugins/StatusPlugins/StartupStatus/toolbars.cpp index 7a12697c52..9b8ab6c475 100644 --- a/plugins/StatusPlugins/StartupStatus/toolbars.cpp +++ b/plugins/StatusPlugins/StartupStatus/toolbars.cpp @@ -53,35 +53,34 @@ int RemoveTopToolbarButtons() int CreateTopToolbarButtons(WPARAM wParam, LPARAM lParam) { - TTBButton ttb; - int i, profileCount; - DBVARIANT dbv; - char setting[80]; - - profileCount = CallService(MS_SS_GETPROFILECOUNT, 0, 0); + int profileCount = CallService(MS_SS_GETPROFILECOUNT, 0, 0); ttbButtons = ( HANDLE* )realloc(ttbButtons, profileCount*sizeof(HANDLE)); - ZeroMemory(&ttb,sizeof(ttb)); - ZeroMemory(&dbv,sizeof(dbv)); + + TTBButton ttb = { 0 }; ttb.cbSize = sizeof(ttb); - ttb.dwFlags = TTBBF_VISIBLE|TTBBF_SHOWTOOLTIP; - ttb.hbBitmapDown = LoadBitmap(hInst,MAKEINTRESOURCE(IDB_TTBDOWN)); - ttb.hbBitmapUp = LoadBitmap(hInst,MAKEINTRESOURCE(IDB_TTBUP)); + ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP | TTBBF_ICONBYHANDLE; ttb.pszServiceDown = ttb.pszServiceUp = MS_SS_LOADANDSETPROFILE; - for (i=0;i 3 times or so + CallService(MS_TTB_SETBUTTONOPTIONS,MAKEWPARAM(TTBO_TIPNAME,ttbButtons[ttbButtonCount]), (LPARAM)profileName); DBFreeVariant(&dbv); ttbButtonCount += 1; @@ -182,10 +181,10 @@ void RegisterButtons() sid.pszDescription = "Pressed toolbar icon"; sid.iDefaultIndex = -IDI_TTBDOWN; sid.flags = SIDF_PATH_TCHAR; - hTtbDown = (HANDLE)CallService(MS_SKIN2_ADDICON, 0, (LPARAM)&sid); + hTtbDown = Skin_AddIcon(&sid); sid.pszName = "StartupStatus/TtbUp"; sid.pszDescription = "Released toolbar icon"; sid.iDefaultIndex = -IDI_TTBUP; - hTtbUp = (HANDLE)CallService(MS_SKIN2_ADDICON, 0, (LPARAM)&sid); + hTtbUp = Skin_AddIcon(&sid); } diff --git a/plugins/StatusPlugins/resource.h b/plugins/StatusPlugins/resource.h index 38bdf18a3b..3fbeccde84 100644 --- a/plugins/StatusPlugins/resource.h +++ b/plugins/StatusPlugins/resource.h @@ -9,8 +9,6 @@ #define IDD_CMDLOPTIONS 106 #define IDD_ADDPROFILE 109 #define IDD_OPT_STARTUPSTATUS 110 -#define IDB_TTBDOWN 111 -#define IDB_TTBUP 112 #define IDD_PUOPT_KEEPSTATUS 113 #define IDD_OPT_AUTOAWAYMSG 114 #define IDI_TICK 117 diff --git a/plugins/Svc_dbepp/main.cpp b/plugins/Svc_dbepp/main.cpp index 8412f5410e..4860f13e09 100644 --- a/plugins/Svc_dbepp/main.cpp +++ b/plugins/Svc_dbepp/main.cpp @@ -153,7 +153,7 @@ BOOL IsCP_UTF8(void) static int OnTTBLoaded(WPARAM wParam,LPARAM lParam) { - TTBButtonV2 ttbb = {0}; + TTBButton ttbb = {0}; HICON ico = LoadIcon(hInst,MAKEINTRESOURCE(ICO_DBE_BUTT)); UnhookEvent(hTTBHook); diff --git a/plugins/TopToolBar/InternalButtons.cpp b/plugins/TopToolBar/InternalButtons.cpp index 5b7fc1db2a..06d4488c94 100644 --- a/plugins/TopToolBar/InternalButtons.cpp +++ b/plugins/TopToolBar/InternalButtons.cpp @@ -223,7 +223,7 @@ int LoadInternalButtons(HWND hwnd) ShowGroups = DBGetContactSettingByte(NULL, "CList", "UseGroups", 2); SoundsEnabled = DBGetContactSettingByte(NULL, "Skin", "UseSound", 1); - TTBButtonV2 ttb = { 0 }; + TTBButton ttb = { 0 }; ttb.cbSize = sizeof(ttb); ttb.hIconUp = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_SHOWONLINEUP), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); ttb.hIconDn = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_SHOWONLINEDN), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); diff --git a/plugins/TopToolBar/TopToolBar.vcxproj b/plugins/TopToolBar/TopToolBar.vcxproj index f71c76676b..0822bd90e2 100644 --- a/plugins/TopToolBar/TopToolBar.vcxproj +++ b/plugins/TopToolBar/TopToolBar.vcxproj @@ -238,36 +238,17 @@ - - - - - - + - - - - - - - - - - - - - - @@ -276,9 +257,6 @@ - - - diff --git a/plugins/TopToolBar/TopToolBar.vcxproj.filters b/plugins/TopToolBar/TopToolBar.vcxproj.filters index 12fb8c451d..43d0d470cc 100644 --- a/plugins/TopToolBar/TopToolBar.vcxproj.filters +++ b/plugins/TopToolBar/TopToolBar.vcxproj.filters @@ -26,24 +26,6 @@ - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - Resource Files @@ -53,69 +35,27 @@ Resource Files - - Resource Files - - - Resource Files - - - Resource Files - Resource Files Resource Files - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - Resource Files Resource Files - - Resource Files - - - Resource Files - Resource Files Resource Files - - Resource Files - Resource Files - - Resource Files - - - Resource Files - Resource Files @@ -140,13 +80,7 @@ Resource Files - - Resource Files - - - Resource Files - - + Resource Files diff --git a/plugins/TopToolBar/bmp/bitmap1.bmp b/plugins/TopToolBar/bmp/bitmap1.bmp deleted file mode 100644 index 573b7d6186..0000000000 Binary files a/plugins/TopToolBar/bmp/bitmap1.bmp and /dev/null differ diff --git a/plugins/TopToolBar/bmp/bmp00001.bmp b/plugins/TopToolBar/bmp/bmp00001.bmp deleted file mode 100644 index 7c97999188..0000000000 Binary files a/plugins/TopToolBar/bmp/bmp00001.bmp and /dev/null differ diff --git a/plugins/TopToolBar/bmp/bmp00002.bmp b/plugins/TopToolBar/bmp/bmp00002.bmp deleted file mode 100644 index 6e8e840620..0000000000 Binary files a/plugins/TopToolBar/bmp/bmp00002.bmp and /dev/null differ diff --git a/plugins/TopToolBar/bmp/borderup.bmp b/plugins/TopToolBar/bmp/borderup.bmp deleted file mode 100644 index 2d7fd71299..0000000000 Binary files a/plugins/TopToolBar/bmp/borderup.bmp and /dev/null differ diff --git a/plugins/TopToolBar/bmp/borederdn.bmp b/plugins/TopToolBar/bmp/borederdn.bmp deleted file mode 100644 index 53809acff3..0000000000 Binary files a/plugins/TopToolBar/bmp/borederdn.bmp and /dev/null differ diff --git a/plugins/TopToolBar/bmp/cpaneldn.bmp b/plugins/TopToolBar/bmp/cpaneldn.bmp deleted file mode 100644 index 2f4e2a95b5..0000000000 Binary files a/plugins/TopToolBar/bmp/cpaneldn.bmp and /dev/null differ diff --git a/plugins/TopToolBar/bmp/cpanelup.bmp b/plugins/TopToolBar/bmp/cpanelup.bmp deleted file mode 100644 index fc3531facd..0000000000 Binary files a/plugins/TopToolBar/bmp/cpanelup.bmp and /dev/null differ diff --git a/plugins/TopToolBar/bmp/findusedn.bmp b/plugins/TopToolBar/bmp/findusedn.bmp deleted file mode 100644 index f21e56fb95..0000000000 Binary files a/plugins/TopToolBar/bmp/findusedn.bmp and /dev/null differ diff --git a/plugins/TopToolBar/bmp/finduser.bmp b/plugins/TopToolBar/bmp/finduser.bmp deleted file mode 100644 index e6a884651b..0000000000 Binary files a/plugins/TopToolBar/bmp/finduser.bmp and /dev/null differ diff --git a/plugins/TopToolBar/bmp/finduserdn.bmp b/plugins/TopToolBar/bmp/finduserdn.bmp deleted file mode 100644 index 668a92c4b5..0000000000 Binary files a/plugins/TopToolBar/bmp/finduserdn.bmp and /dev/null differ diff --git a/plugins/TopToolBar/bmp/groupdn.bmp b/plugins/TopToolBar/bmp/groupdn.bmp deleted file mode 100644 index 9a106b15ee..0000000000 Binary files a/plugins/TopToolBar/bmp/groupdn.bmp and /dev/null differ diff --git a/plugins/TopToolBar/bmp/groupup.bmp b/plugins/TopToolBar/bmp/groupup.bmp deleted file mode 100644 index 7bc71b6764..0000000000 Binary files a/plugins/TopToolBar/bmp/groupup.bmp and /dev/null differ diff --git a/plugins/TopToolBar/bmp/launch.bmp b/plugins/TopToolBar/bmp/launch.bmp deleted file mode 100644 index 326c0d31c6..0000000000 Binary files a/plugins/TopToolBar/bmp/launch.bmp and /dev/null differ diff --git a/plugins/TopToolBar/bmp/launchdn.bmp b/plugins/TopToolBar/bmp/launchdn.bmp deleted file mode 100644 index 0e72934853..0000000000 Binary files a/plugins/TopToolBar/bmp/launchdn.bmp and /dev/null differ diff --git a/plugins/TopToolBar/bmp/launchup.bmp b/plugins/TopToolBar/bmp/launchup.bmp deleted file mode 100644 index 22584a7e3b..0000000000 Binary files a/plugins/TopToolBar/bmp/launchup.bmp and /dev/null differ diff --git a/plugins/TopToolBar/bmp/menudn.bmp b/plugins/TopToolBar/bmp/menudn.bmp deleted file mode 100644 index ad93aff878..0000000000 Binary files a/plugins/TopToolBar/bmp/menudn.bmp and /dev/null differ diff --git a/plugins/TopToolBar/bmp/menuup.bmp b/plugins/TopToolBar/bmp/menuup.bmp deleted file mode 100644 index a3a902ae6e..0000000000 Binary files a/plugins/TopToolBar/bmp/menuup.bmp and /dev/null differ diff --git a/plugins/TopToolBar/bmp/minimize.bmp b/plugins/TopToolBar/bmp/minimize.bmp deleted file mode 100644 index 4749fa9369..0000000000 Binary files a/plugins/TopToolBar/bmp/minimize.bmp and /dev/null differ diff --git a/plugins/TopToolBar/bmp/minimizedn.bmp b/plugins/TopToolBar/bmp/minimizedn.bmp deleted file mode 100644 index f8470a3d6a..0000000000 Binary files a/plugins/TopToolBar/bmp/minimizedn.bmp and /dev/null differ diff --git a/plugins/TopToolBar/bmp/options.bmp b/plugins/TopToolBar/bmp/options.bmp deleted file mode 100644 index 945be884f4..0000000000 Binary files a/plugins/TopToolBar/bmp/options.bmp and /dev/null differ diff --git a/plugins/TopToolBar/bmp/searchtest.bmp b/plugins/TopToolBar/bmp/searchtest.bmp deleted file mode 100644 index 2b2fda1042..0000000000 Binary files a/plugins/TopToolBar/bmp/searchtest.bmp and /dev/null differ diff --git a/plugins/TopToolBar/bmp/separator.bmp b/plugins/TopToolBar/bmp/separator.bmp deleted file mode 100644 index fa4a4449f0..0000000000 Binary files a/plugins/TopToolBar/bmp/separator.bmp and /dev/null differ diff --git a/plugins/TopToolBar/bmp/soundsdn.bmp b/plugins/TopToolBar/bmp/soundsdn.bmp deleted file mode 100644 index 224e299691..0000000000 Binary files a/plugins/TopToolBar/bmp/soundsdn.bmp and /dev/null differ diff --git a/plugins/TopToolBar/bmp/soundsup.bmp b/plugins/TopToolBar/bmp/soundsup.bmp deleted file mode 100644 index c11e7521fe..0000000000 Binary files a/plugins/TopToolBar/bmp/soundsup.bmp and /dev/null differ diff --git a/plugins/TopToolBar/bmp/test.bmp b/plugins/TopToolBar/bmp/test.bmp deleted file mode 100644 index b3b4252fef..0000000000 Binary files a/plugins/TopToolBar/bmp/test.bmp and /dev/null differ diff --git a/plugins/TopToolBar/common.h b/plugins/TopToolBar/common.h index 6e51009e93..7a51636e2a 100644 --- a/plugins/TopToolBar/common.h +++ b/plugins/TopToolBar/common.h @@ -58,10 +58,9 @@ struct TopButtonInt BOOL bPushed; int dwFlags; int x, y; - HBITMAP hbBitmapUp, hbBitmapDown; - HBITMAP hbDefBitmapUp, hbDefBitmapDown; HBITMAP hbWBordBitmapUp, hbWBordBitmapDown; HICON hIconUp, hIconDn; + HANDLE hIconHandleUp, hIconHandleDn; char *pszServiceUp, *pszServiceDown; char *name; @@ -72,8 +71,6 @@ struct TopButtonInt LPARAM lParamDown; WPARAM wParamDown; WORD arrangedpos; - TCHAR *UserDefinedbmUp; - TCHAR *UserDefinedbmDown; }; struct SortData @@ -88,14 +85,7 @@ struct SortData //#define BUTTHEIGHT 16 #define SEPWIDTH 3 -struct ButtonOptData -{ - char *name; - int pos; - bool show; -}; - -extern bool OptionsOpened, UseIcoLib, StopArrange; +extern bool OptionsOpened, StopArrange; extern HWND OptionshWnd; extern HANDLE hHookTTBModuleLoaded; extern HINSTANCE hInst; @@ -155,7 +145,6 @@ int UnInitLBut(); void lockbut(); void ulockbut(); -int applyuserbitmaps( int ); INT_PTR TTBAddButton(WPARAM, LPARAM); INT_PTR TTBRemoveButton(WPARAM, LPARAM); diff --git a/plugins/TopToolBar/launchbt.cpp b/plugins/TopToolBar/launchbt.cpp index 3b5678386f..fd0e15d600 100644 --- a/plugins/TopToolBar/launchbt.cpp +++ b/plugins/TopToolBar/launchbt.cpp @@ -82,8 +82,8 @@ INT_PTR InsertLBut(int id) TTBButton ttb = { 0 }; ttb.cbSize = sizeof(ttb); - ttb.hbBitmapDown = DefLDn; - ttb.hbBitmapUp = DefLUp; + //ttb.hbBitmapDown = DefLDn; !!!!!!!!!!!!!! + //ttb.hbBitmapUp = DefLUp; !!!!!!!!!!!!!! ttb.dwFlags = TTBBF_VISIBLE|TTBBF_ISLBUTTON; ttb.pszServiceDown = TTB_LAUNCHSERVICE; ttb.lParamDown = id; @@ -120,7 +120,7 @@ int LoadAllLButs() memset(LBUTS, 0, sizeof(LBUTS)); for (int i = 0; i < MAXLBUTS; i++) { memset(buf1, 0, SIZEOF(buf1)); - itoa(i, buf1, 10); + _itoa(i, buf1, 10); AS(fixname, "LBUT", buf1); id = DBGetContactSettingWord(0, TTB_OPTDIR, AS(buf, fixname, ""), -1); if (id != -1) { @@ -145,7 +145,7 @@ int SaveAllLButs() memset(buf, 0, SIZEOF(buf)); for (int i = 0;i 0 ) Buttons[butpos].dwFlags |= TTBBF_VISIBLE; - - Buttons[butpos].UserDefinedbmDown = DBGetStringT(0, TTB_OPTDIR, AS(buf, Buttons[butpos].name, "_BmpDown")); - if ( Buttons[butpos].UserDefinedbmDown != NULL && Buttons[butpos].UserDefinedbmDown[0] == 0) { - mir_free(Buttons[butpos].UserDefinedbmDown); - Buttons[butpos].UserDefinedbmDown = NULL; - } - - Buttons[butpos].UserDefinedbmUp = DBGetStringT(0, TTB_OPTDIR, AS(buf, Buttons[butpos].name, "_BmpUp")); - if ( Buttons[butpos].UserDefinedbmUp != NULL && Buttons[butpos].UserDefinedbmUp[0] == 0) { - mir_free(Buttons[butpos].UserDefinedbmUp); - Buttons[butpos].UserDefinedbmUp = NULL; - } return 0; } @@ -192,23 +152,23 @@ INT_PTR TTBRemoveButton(WPARAM wParam, LPARAM lParam) return 0; } -static HBITMAP DrawBorderForBitmap(HBITMAP hb, BOOL up) +static HBITMAP DrawBorderForBitmap(HICON hIcon, BOOL up) { - HBITMAP Border, workbmp; - HDC workdc, destdc, srcdc; + ICONINFO ii; + GetIconInfo(hIcon, &ii); - Border = LoadBitmap(hInst, MAKEINTRESOURCE(up?IDB_BORDERUP:IDB_BORDERDN)); - workdc = GetDC(hwndContactList); - destdc = CreateCompatibleDC(workdc); - srcdc = CreateCompatibleDC(workdc); + HBITMAP Border = LoadBitmap(hInst, MAKEINTRESOURCE(up?IDB_BORDERUP:IDB_BORDERDN)); + HDC workdc = GetDC(hwndContactList); + HDC destdc = CreateCompatibleDC(workdc); + HDC srcdc = CreateCompatibleDC(workdc); - workbmp = CreateBitmap(BUTTWIDTH, BUTTHEIGHT, 1, GetDeviceCaps(workdc, BITSPIXEL), NULL); + HBITMAP workbmp = CreateBitmap(BUTTWIDTH, BUTTHEIGHT, 1, GetDeviceCaps(workdc, BITSPIXEL), NULL); SelectObject(destdc, workbmp); SelectObject(srcdc, Border); BitBlt(destdc, 0, 0, BUTTWIDTH, BUTTHEIGHT, srcdc, 0, 0, SRCCOPY); - SelectObject(srcdc, hb); + SelectObject(srcdc, ii.hbmColor); BitBlt(destdc, 1, 1, BUTTWIDTH-4, BUTTHEIGHT-4, srcdc, 0, 0, SRCCOPY); DeleteDC(destdc); @@ -237,7 +197,7 @@ bool nameexists(const char *name) return FALSE; } -HICON LoadIconFromLibrary(char *SectName, char *Name, char *Description, HICON hIcon, bool RegisterIt, bool *RegistredOk) +HICON LoadIconFromLibrary(char *Name, char *Description, HICON hIcon, HANDLE* phIcolib, bool *RegistredOk) { if (RegistredOk) *RegistredOk = FALSE; @@ -245,22 +205,20 @@ HICON LoadIconFromLibrary(char *SectName, char *Name, char *Description, HICON h if (Name != NULL && *Name != 0) { char iconame[256]; _snprintf(iconame, SIZEOF(iconame), "toptoolbar_%s", Name); - if ( ServiceExists(MS_SKIN2_ADDICON)) { - if (RegisterIt) { - SKINICONDESC sid = {0}; - sid.cbSize = sizeof(sid); - sid.pszSection = Translate(SectName); - sid.pszName = iconame; - sid.pszDefaultFile = NULL; - sid.pszDescription = Description; - sid.hDefaultIcon = hIcon; - CallService(MS_SKIN2_ADDICON, 0, (LPARAM)&sid); - - if (RegistredOk) - *RegistredOk = TRUE; - } - return ((HICON)CallService(MS_SKIN2_GETICON, 0, (LPARAM)iconame)); + if (phIcolib) { + SKINICONDESC sid = {0}; + sid.cbSize = sizeof(sid); + sid.pszSection = "Toolbar"; + sid.pszName = iconame; + sid.pszDefaultFile = NULL; + sid.pszDescription = Description; + sid.hDefaultIcon = hIcon; + *phIcolib = Skin_AddIcon(&sid); + + if (RegistredOk) + *RegistredOk = TRUE; } + return Skin_GetIcon(iconame); } return hIcon; @@ -296,82 +254,78 @@ INT_PTR TTBAddButton(WPARAM wParam, LPARAM lParam) return -1; int i = nButtonsCount; - TTBButtonV2 but = { 0 }; - if (((TTBButton*)wParam)->cbSize == sizeof(TTBButton)) - memcpy(&but, (void*)wParam, sizeof(TTBButton)); - - if (((TTBButton*)wParam)->cbSize == sizeof(TTBButtonV2)) - memcpy(&but, (void*)wParam, sizeof(TTBButtonV2)); - - if ( but.name == NULL || nameexists(but.name)) { + TTBButton *but = (TTBButton*)wParam; + if (but->cbSize != sizeof(TTBButton) || but->name == NULL || nameexists(but->name)) { ulockbut(); return -1; } - Buttons[i].id = nextButtonId++; - Buttons[i].hbBitmapDown = but.hbBitmapDown; - Buttons[i].hbBitmapUp = but.hbBitmapUp; - Buttons[i].hbDefBitmapDown = but.hbBitmapDown; - Buttons[i].hbDefBitmapUp = but.hbBitmapUp; + TopButtonInt& b = Buttons[i]; + b.id = nextButtonId++; - if (but.pszServiceDown != NULL) Buttons[i].pszServiceDown = strdup(but.pszServiceDown); - if (but.pszServiceUp != NULL) Buttons[i].pszServiceUp = strdup(but.pszServiceUp); - Buttons[i].name = strdup(but.name); - Buttons[i].dwFlags = but.dwFlags; - - if (Buttons[i].dwFlags & TTBBF_DRAWBORDER) { - Buttons[i].hbWBordBitmapDown = DrawBorderForBitmap(Buttons[i].hbBitmapDown, FALSE); - Buttons[i].hbWBordBitmapUp = DrawBorderForBitmap(Buttons[i].hbBitmapUp, TRUE); + if (but->pszServiceDown != NULL) b.pszServiceDown = _strdup(but->pszServiceDown); + if (but->pszServiceUp != NULL) b.pszServiceUp = _strdup(but->pszServiceUp); + b.name = _strdup(but->name); + b.dwFlags = but->dwFlags; + + if (b.dwFlags & TTBBF_ICONBYHANDLE) { + b.hIconHandleDn = but->hIconHandleDn; + b.hIconHandleUp = but->hIconHandleUp; + b.hIconDn = Skin_GetIconByHandle(b.hIconHandleDn); + b.hIconUp = Skin_GetIconByHandle(b.hIconHandleUp); + } + else { + b.hIconDn = but->hIconDn; + b.hIconUp = but->hIconUp; } - Buttons[i].wParamUp = but.wParamUp; - Buttons[i].lParamUp = but.lParamUp; - Buttons[i].wParamDown = but.wParamDown; - Buttons[i].lParamDown = but.lParamDown; - - Buttons[i].dwFlags = but.dwFlags; + if (b.dwFlags & TTBBF_DRAWBORDER) { + b.hbWBordBitmapDown = DrawBorderForBitmap(b.hIconDn, FALSE); + b.hbWBordBitmapUp = DrawBorderForBitmap(b.hIconUp, TRUE); + } - Buttons[i].bPushed = (but.dwFlags&TTBBF_PUSHED)?TRUE:FALSE; + b.wParamUp = but->wParamUp; + b.lParamUp = but->lParamUp; + b.wParamDown = but->wParamDown; + b.lParamDown = but->lParamDown; + + b.bPushed = (but->dwFlags & TTBBF_PUSHED) ? TRUE : FALSE; CreateOneWindow(i); - - Buttons[i].hIconUp = but.hIconUp ; - Buttons[i].hIconDn = but.hIconDn ; - if (UseIcoLib && (!(Buttons[i].dwFlags & TTBBF_ISSEPARATOR))) { + if ( !(b.dwFlags & TTBBF_ISSEPARATOR)) { char buf[256]; - sprintf(buf, "%s_up", Buttons[i].name); - Buttons[i].hIconUp = LoadIconFromLibrary("TopToolBar", buf, buf, but.hIconDn, TRUE, NULL); - sprintf(buf, "%s_dn", Buttons[i].name); - Buttons[i].hIconDn = LoadIconFromLibrary("TopToolBar", buf, buf, but.hIconUp, TRUE, NULL); + sprintf(buf, "%s_up", b.name); + b.hIconUp = LoadIconFromLibrary(buf, buf, b.hIconDn, &b.hIconHandleDn, NULL); + sprintf(buf, "%s_dn", b.name); + b.hIconDn = LoadIconFromLibrary(buf, buf, b.hIconUp, &b.hIconHandleUp, NULL); } - Buttons[i].hwndTip = CreateWindowEx(0, TOOLTIPS_CLASS, NULL, + b.hwndTip = CreateWindowEx(0, TOOLTIPS_CLASS, NULL, WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hwndTopToolBar, NULL, hInst, NULL); - SetWindowPos(Buttons[i].hwndTip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); + SetWindowPos(b.hwndTip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); TOOLINFO ti = { 0 }; ti.cbSize = sizeof(ti); ti.lpszText = _T(""); ti.hinst = hInst; ti.uFlags = TTF_IDISHWND|TTF_SUBCLASS ; - ti.uId = (UINT_PTR)Buttons[i].hwnd; - SendMessage(Buttons[i].hwndTip, TTM_ADDTOOL, 0, (LPARAM)&ti); + ti.uId = (UINT_PTR)b.hwnd; + SendMessage(b.hwndTip, TTM_ADDTOOL, 0, (LPARAM)&ti); - SendMessage(Buttons[i].hwndTip, TTM_ACTIVATE, (WPARAM)(Buttons[i].dwFlags&TTBBF_SHOWTOOLTIP)?TRUE:FALSE, 0); + SendMessage(b.hwndTip, TTM_ACTIVATE, (WPARAM)(b.dwFlags&TTBBF_SHOWTOOLTIP)?TRUE:FALSE, 0); - SetWindowLongPtr(Buttons[i].hwnd, GWLP_USERDATA, Buttons[i].id); + SetWindowLongPtr(b.hwnd, GWLP_USERDATA, b.id); nButtonsCount++; - int retval = Buttons[i].id; + int retval = b.id; DBLoadButtonSettings(i); - applyuserbitmaps(i); SetButtBitmap(i); ulockbut(); @@ -538,39 +492,21 @@ int ArrangeButtons() int SetButtBitmap(int pos) { - int t = IMAGE_BITMAP; - TCHAR *curname = (Buttons[pos].bPushed)?(Buttons[pos].UserDefinedbmDown):(Buttons[pos].UserDefinedbmUp); - int curstyle = GetWindowLongPtr(Buttons[pos].hwnd, GWL_STYLE); curstyle &= (~SS_BITMAP); curstyle &= (~SS_ICON); - if (!UseIcoLib || (Buttons[pos].dwFlags&TTBBF_ISSEPARATOR)) { - if (curname != NULL) { - if ( _tcsstr(curname, _T(".ico"))) - t = IMAGE_ICON; - - curstyle |= (t == IMAGE_ICON || UseIcoLib) ? SS_ICON : SS_BITMAP; - SetWindowLongPtr(Buttons[pos].hwnd, GWL_STYLE, curstyle); - } - else SetWindowLongPtr(Buttons[pos].hwnd, GWL_STYLE, curstyle|(Buttons[pos].hbBitmapDown == NULL?SS_ICON:SS_BITMAP)); - } - else if (GetWindowLongPtr(Buttons[pos].hwnd, GWL_STYLE)&SS_ICON) - SetWindowLongPtr(Buttons[pos].hwnd, GWL_STYLE, curstyle|SS_ICON); + if (Buttons[pos].dwFlags & TTBBF_ISSEPARATOR) + SetWindowLongPtr(Buttons[pos].hwnd, GWL_STYLE, curstyle | SS_BITMAP); + else if (GetWindowLongPtr(Buttons[pos].hwnd, GWL_STYLE) & SS_ICON) + SetWindowLongPtr(Buttons[pos].hwnd, GWL_STYLE, curstyle | SS_ICON); - if ( !UseIcoLib || (Buttons[pos].dwFlags & TTBBF_ISSEPARATOR)) { + if (Buttons[pos].dwFlags & TTBBF_ISSEPARATOR) { if (!(Buttons[pos].dwFlags & TTBBF_DRAWBORDER)) { - if (Buttons[pos].hbBitmapDown == NULL) { - t = IMAGE_ICON; - SendMessage(Buttons[pos].hwnd, STM_SETIMAGE, t, (LPARAM)((Buttons[pos].bPushed)?(Buttons[pos].hIconDn):(Buttons[pos].hIconUp))); - SendMessage(Buttons[pos].hwnd, BM_SETIMAGE, t, (LPARAM)((Buttons[pos].bPushed)?(Buttons[pos].hIconDn):(Buttons[pos].hIconUp))); - } - else { - SendMessage(Buttons[pos].hwnd, STM_SETIMAGE, t, (LPARAM)((Buttons[pos].bPushed)?(Buttons[pos].hbBitmapDown):(Buttons[pos].hbBitmapUp))); - SendMessage(Buttons[pos].hwnd, BM_SETIMAGE, t, (LPARAM)((Buttons[pos].bPushed)?(Buttons[pos].hbBitmapDown):(Buttons[pos].hbBitmapUp))); - } + SendMessage(Buttons[pos].hwnd, STM_SETIMAGE, IMAGE_ICON, (LPARAM)((Buttons[pos].bPushed)?(Buttons[pos].hIconDn):(Buttons[pos].hIconUp))); + SendMessage(Buttons[pos].hwnd, BM_SETIMAGE, IMAGE_ICON, (LPARAM)((Buttons[pos].bPushed)?(Buttons[pos].hIconDn):(Buttons[pos].hIconUp))); } - else SendMessage(Buttons[pos].hwnd, STM_SETIMAGE, t, (LPARAM)((Buttons[pos].bPushed)?(Buttons[pos].hbWBordBitmapDown):(Buttons[pos].hbWBordBitmapUp))); + else SendMessage(Buttons[pos].hwnd, STM_SETIMAGE, IMAGE_ICON, (LPARAM)((Buttons[pos].bPushed)?(Buttons[pos].hbWBordBitmapDown):(Buttons[pos].hbWBordBitmapUp))); } else SendMessage(Buttons[pos].hwnd, BM_SETIMAGE, IMAGE_ICON, (LPARAM)((Buttons[pos].bPushed)?(Buttons[pos].hIconDn):(Buttons[pos].hIconUp))); @@ -648,8 +584,6 @@ INT_PTR TTBGetOptions(WPARAM wParam, LPARAM lParam) if (Buttons[pos].bPushed) lpTTB->dwFlags |= TTBBF_PUSHED; - lpTTB->hbBitmapDown = Buttons[pos].hbBitmapDown; - lpTTB->hbBitmapUp = Buttons[pos].hbBitmapUp; lpTTB->lParamUp = Buttons[pos].lParamUp; lpTTB->wParamUp = Buttons[pos].wParamUp; lpTTB->lParamDown = Buttons[pos].lParamDown; @@ -688,8 +622,8 @@ INT_PTR TTBSetOptions(WPARAM wParam, LPARAM lParam) Buttons[pos].dwFlags = lParam; Buttons[pos].bPushed = (Buttons[pos].dwFlags & TTBBF_PUSHED) ? TRUE : FALSE; if (Buttons[pos].dwFlags & TTBBF_DRAWBORDER) { - Buttons[pos].hbWBordBitmapDown = DrawBorderForBitmap(Buttons[pos].hbBitmapDown, FALSE); - Buttons[pos].hbWBordBitmapUp = DrawBorderForBitmap(Buttons[pos].hbBitmapUp, TRUE); + Buttons[pos].hbWBordBitmapDown = DrawBorderForBitmap(Buttons[pos].hIconDn, FALSE); + Buttons[pos].hbWBordBitmapUp = DrawBorderForBitmap(Buttons[pos].hIconUp, TRUE); } SetButtBitmap(pos); @@ -726,8 +660,6 @@ INT_PTR TTBSetOptions(WPARAM wParam, LPARAM lParam) break; Buttons[pos].dwFlags = lpTTB->dwFlags; - Buttons[pos].hbBitmapDown = lpTTB->hbBitmapDown; - Buttons[pos].hbBitmapUp = lpTTB->hbBitmapUp; Buttons[pos].lParamUp = lpTTB->lParamUp; Buttons[pos].wParamUp = lpTTB->wParamUp; Buttons[pos].lParamDown = lpTTB->lParamDown; @@ -742,8 +674,8 @@ INT_PTR TTBSetOptions(WPARAM wParam, LPARAM lParam) Buttons[pos].pszServiceUp = _strdup(lpTTB->pszServiceUp); if (Buttons[pos].dwFlags & TTBBF_DRAWBORDER) { - Buttons[pos].hbWBordBitmapDown = DrawBorderForBitmap(Buttons[pos].hbBitmapDown, FALSE); - Buttons[pos].hbWBordBitmapUp = DrawBorderForBitmap(Buttons[pos].hbBitmapUp, TRUE); + Buttons[pos].hbWBordBitmapDown = DrawBorderForBitmap(Buttons[pos].hIconDn, FALSE); + Buttons[pos].hbWBordBitmapUp = DrawBorderForBitmap(Buttons[pos].hIconUp, TRUE); } Buttons[pos].bPushed = (Buttons[pos].dwFlags&TTBBF_PUSHED)?TRUE:FALSE; @@ -987,9 +919,9 @@ int OnIconChange(WPARAM wParam, LPARAM lParam) for (int i = 0; i < nButtonsCount; i++) { char buf[256]; sprintf(buf, "%s_up", Buttons[i].name); - Buttons[i].hIconUp = LoadIconFromLibrary("TopToolBar", buf, buf, Buttons[i].hIconUp, FALSE, NULL); + Buttons[i].hIconUp = LoadIconFromLibrary(buf, buf, Buttons[i].hIconUp, FALSE, NULL); sprintf(buf, "%s_dn", Buttons[i].name); - Buttons[i].hIconDn = LoadIconFromLibrary("TopToolBar", buf, buf, Buttons[i].hIconDn, FALSE, NULL); + Buttons[i].hIconDn = LoadIconFromLibrary(buf, buf, Buttons[i].hIconDn, FALSE, NULL); } ulockbut(); RecreateWindows(); @@ -1016,9 +948,6 @@ int OnModulesLoad(WPARAM wParam, LPARAM lParam) hwndContactList = (HWND)CallService(MS_CLUI_GETHWND, 0, 0); OptionsOpened = false; - UseIcoLib = DBGetContactSettingByte(0, TTB_OPTDIR, "UseIcoLib", UseIcoLibDefaultValue); - if (UseIcoLib) - arHooks.insert( HookEvent(ME_SKIN2_ICONSCHANGED, OnIconChange)); hFrameTopWindow = addTopToolBarWindow(hwndContactList); LoadInternalButtons(( HWND )CallService(MS_CLUI_GETHWNDTREE, 0, 0)); @@ -1050,8 +979,10 @@ int LoadToolbarModule() { InitializeCriticalSection(&csButtonsHook); StopArrange = TRUE; + hBmpSeparator = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_SEP)); arHooks.insert( HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoad)); + arHooks.insert( HookEvent(ME_SKIN2_ICONSCHANGED, OnIconChange)); arHooks.insert( HookEvent(ME_OPT_INITIALISE, TTBOptInit)); arServices.insert( CreateServiceFunction(MS_TTB_ADDBUTTON, TTBAddButton)); @@ -1078,6 +1009,7 @@ int UnloadToolbarModule() { SaveAllSeparators(); + DeleteObject(hBmpSeparator); DeleteCriticalSection(&csButtonsHook); return 0; } diff --git a/plugins/TopToolBar/ttbopt.cpp b/plugins/TopToolBar/ttbopt.cpp index e962321008..dadfe7e305 100644 --- a/plugins/TopToolBar/ttbopt.cpp +++ b/plugins/TopToolBar/ttbopt.cpp @@ -4,7 +4,6 @@ static INT_PTR CALLBACK DlgProcTTBBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); extern int ttbOptionsChanged(); -extern HINSTANCE hInst; extern TopButtonInt Buttons[MAX_BUTTONS]; extern int nButtonsCount; @@ -14,124 +13,21 @@ extern SortData arrangedbuts[MAX_BUTTONS]; bool OptionsOpened = false; HWND OptionshWnd = 0; +struct ButtonOptData +{ + char *name; + int pos; + bool show; +}; + struct OrderData { int dragging; HTREEITEM hDragItem; }; -TCHAR *SetEndSlash(TCHAR *str) -{ - if (str == NULL || *str == 0) - return NULL; - - TCHAR *outs = str; - if (str[_tcslen(str)-1] != '\\') { - outs = (TCHAR*)calloc( sizeof(TCHAR), _tcslen(str)+3); - _tcscat(outs, str); - outs[_tcslen(str)] = '\\'; - } - return outs; -} - -bool FileExists(TCHAR *fname) -{ - WIN32_FIND_DATA wfd = { 0 }; - HANDLE h = FindFirstFile(fname, &wfd); - if (h == INVALID_HANDLE_VALUE) - return FALSE; - - FindClose(h); - return TRUE; -} - -TCHAR *ReplaceBadChar(TCHAR *str, TCHAR bad, TCHAR toreplace) -{ - for (int i = 0; str[i] != 0; i++) - if (str[i] == bad) - str[i] = toreplace; - - return str; -} - -TCHAR *ReplaceAll(TCHAR *str) -{ - ReplaceBadChar(str, '\\', '_'); - ReplaceBadChar(str, '/', '_'); - ReplaceBadChar(str, '"', '_'); - ReplaceBadChar(str, '?', '_'); - ReplaceBadChar(str, '|', '_'); - ReplaceBadChar(str, '>', '_'); - ReplaceBadChar(str, '<', '_'); - ReplaceBadChar(str, ':', '_'); - ReplaceBadChar(str, '*', '_'); - return str; -} - -void AssignBitmapsFromDir(TCHAR *dir) -{ - if (dir == NULL || *dir == 0 ) - return; - - dir = SetEndSlash(dir); - lockbut(); - for (int i = 0; i < nButtonsCount; i++) { - TCHAR curnameUP[512], curnameDN[512], ChangedName[512]; - _tcscpy(ChangedName, _A2T(Buttons[i].name)); - ReplaceAll(ChangedName); - - wsprintf(curnameUP, _T("%s%s_UP.bmp"), dir, ChangedName); - wsprintf(curnameDN, _T("%s%s_DN.bmp"), dir, ChangedName); - - if ( FileExists(curnameUP)) { - if (Buttons[i].UserDefinedbmUp != NULL) - mir_free(Buttons[i].UserDefinedbmUp); - Buttons[i].UserDefinedbmUp = mir_tstrdup(curnameUP); - } - - if ( FileExists(curnameDN)) { - if (Buttons[i].UserDefinedbmDown != NULL) - mir_free(Buttons[i].UserDefinedbmDown); - Buttons[i].UserDefinedbmDown = mir_tstrdup(curnameDN); - } - - wsprintf(curnameUP, _T("%s%s_UP.ico"), dir, ChangedName); - wsprintf(curnameDN, _T("%s%s_DN.ico"), dir, ChangedName); - - if ( FileExists(curnameUP)) { - if (Buttons[i].UserDefinedbmUp != NULL) - mir_free(Buttons[i].UserDefinedbmUp); - Buttons[i].UserDefinedbmUp = mir_tstrdup(curnameUP); - } - - if ( FileExists(curnameDN)) { - if (Buttons[i].UserDefinedbmDown != NULL) - mir_free(Buttons[i].UserDefinedbmDown); - Buttons[i].UserDefinedbmDown = mir_tstrdup(curnameDN); - } - } - - ulockbut(); - SetAllBitmaps(); - SaveAllButtonsOptions(); -} - -void ApplyNewDir(HWND hwnd) -{ - TCHAR buf[512], *buf2; - GetDlgItemText(hwnd, IDC_IMGDIR, buf, SIZEOF(buf)); - buf2 = DBGetStringT(0, TTB_OPTDIR, "ImgDir"); - if ( buf2 == NULL || lstrcmp(buf, buf2)) { - DBWriteContactSettingTString(0, TTB_OPTDIR, "ImgDir", buf); - AssignBitmapsFromDir(buf); - } -} - int BuildTree(HWND hwndDlg) { - PostMessage(GetDlgItem(hwndDlg, IDC_BMPUP), STM_SETIMAGE, IMAGE_BITMAP, 0); - PostMessage(GetDlgItem(hwndDlg, IDC_BMPDN), STM_SETIMAGE, IMAGE_BITMAP, 0); - OrderData *dat = (struct OrderData*)GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), GWLP_USERDATA); TVINSERTSTRUCT tvis; @@ -146,7 +42,7 @@ int BuildTree(HWND hwndDlg) for (int i = 0; i < nButtonsCount; i++) { ButtonOptData *PD = (ButtonOptData*)malloc(sizeof(ButtonOptData)); PD->name = Buttons[arrangedbuts[i].oldpos].name; - PD->show = Buttons[arrangedbuts[i].oldpos].dwFlags&TTBBF_VISIBLE?TRUE:FALSE; + PD->show = Buttons[arrangedbuts[i].oldpos].dwFlags & TTBBF_VISIBLE?TRUE:FALSE; PD->pos = arrangedbuts[i].oldpos; tvis.item.lParam = (LPARAM)PD; tvis.item.pszText = TranslateTS( mir_a2t( PD->name)); @@ -200,43 +96,8 @@ int SaveTree(HWND hwndDlg) return (TRUE); } -void SetImagesForCurrent (HWND hwndDlg, int curselect) -{ - int t = IMAGE_BITMAP; - - PostMessage(GetDlgItem(hwndDlg, IDC_BMPUP), STM_SETIMAGE, t, 0); - PostMessage(GetDlgItem(hwndDlg, IDC_BMPDN), STM_SETIMAGE, t, 0); - - TCHAR *curname = Buttons[curselect].UserDefinedbmUp; - if (curname != NULL) { - if ( _tcsstr(curname, _T(".ico"))) - t = IMAGE_ICON; - int st = WS_CHILDWINDOW | SS_NOTIFY | WS_VISIBLE; - st |= (t == IMAGE_ICON) ? SS_ICON : SS_BITMAP; - SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_BMPUP), GWL_STYLE, st); - } - else { - SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_BMPUP), GWL_STYLE, WS_CHILDWINDOW|WS_VISIBLE|SS_NOTIFY|(Buttons[curselect].hbBitmapDown == NULL?SS_ICON:SS_BITMAP)); - t = IMAGE_ICON; - } - - PostMessage(GetDlgItem(hwndDlg, IDC_BMPUP), STM_SETIMAGE, t, (Buttons[curselect].hbBitmapUp == NULL) ? (LPARAM)Buttons[curselect].hIconUp : (LPARAM)Buttons[curselect].hbBitmapUp); - - curname = Buttons[curselect].UserDefinedbmDown; - if (curname != NULL) { - if ( _tcsstr(curname, _T(".ico"))) - t = IMAGE_ICON; - int st = WS_CHILDWINDOW | SS_NOTIFY | WS_VISIBLE; - st |= (t == IMAGE_ICON) ? SS_ICON : SS_BITMAP; - SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_BMPDN), GWL_STYLE, st); - } - else { - SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_BMPDN), GWL_STYLE, WS_CHILDWINDOW|WS_VISIBLE|SS_NOTIFY|(Buttons[curselect].hbBitmapDown == NULL?SS_ICON:SS_BITMAP)); - t = IMAGE_ICON; - } - - PostMessage(GetDlgItem(hwndDlg, IDC_BMPDN), STM_SETIMAGE, t, (Buttons[curselect].hbBitmapDown == NULL) ? (LPARAM)Buttons[curselect].hIconDn : (LPARAM)Buttons[curselect].hbBitmapDown); -} +///////////////////////////////////////////////////////////////////////////////////////// +// Options window: main static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { @@ -244,54 +105,42 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR switch (msg) { case WM_INITDIALOG: - { - TranslateDialogDefault(hwndDlg); - dat = (struct OrderData*)malloc(sizeof(struct OrderData)); - SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), GWLP_USERDATA, (LONG)dat); - dat->dragging = 0; + TranslateDialogDefault(hwndDlg); + dat = (struct OrderData*)malloc(sizeof(struct OrderData)); + SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), GWLP_USERDATA, (LONG)dat); + dat->dragging = 0; - SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), GWL_STYLE)|TVS_NOHSCROLL); - { - HIMAGELIST himlCheckBoxes; - himlCheckBoxes = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR4|ILC_MASK, 2, 2); - ImageList_AddIcon(himlCheckBoxes, LoadIcon(hInst, MAKEINTRESOURCE(IDI_NOTICK))); - ImageList_AddIcon(himlCheckBoxes, LoadIcon(hInst, MAKEINTRESOURCE(IDI_TICK))); - TreeView_SetImageList(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), himlCheckBoxes, TVSIL_NORMAL); - } + SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), GWL_STYLE)|TVS_NOHSCROLL); + { + HIMAGELIST himlCheckBoxes; + himlCheckBoxes = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR4|ILC_MASK, 2, 2); + ImageList_AddIcon(himlCheckBoxes, LoadIcon(hInst, MAKEINTRESOURCE(IDI_NOTICK))); + ImageList_AddIcon(himlCheckBoxes, LoadIcon(hInst, MAKEINTRESOURCE(IDI_TICK))); + TreeView_SetImageList(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), himlCheckBoxes, TVSIL_NORMAL); + } - PostMessage(GetDlgItem(hwndDlg, IDC_BMPUP), STM_SETIMAGE, IMAGE_BITMAP, 0); - PostMessage(GetDlgItem(hwndDlg, IDC_BMPDN), STM_SETIMAGE, IMAGE_BITMAP, 0); - SetDlgItemInt(hwndDlg, IDC_BUTTHEIGHT, DBGetContactSettingByte(0, TTB_OPTDIR, "BUTTHEIGHT", 16), FALSE); - SetDlgItemInt(hwndDlg, IDC_BUTTWIDTH, DBGetContactSettingByte(0, TTB_OPTDIR, "BUTTWIDTH", 20), FALSE); - CheckDlgButton(hwndDlg, IDC_USEMIRANDABUTTON, DBGetContactSettingByte(0, TTB_OPTDIR, "UseMirandaButtonClass", UseMirandaButtonClassDefaultValue)); - CheckDlgButton(hwndDlg, IDC_USEFLAT, DBGetContactSettingByte(0, TTB_OPTDIR, "UseFlatButton", 1)); + SetDlgItemInt(hwndDlg, IDC_BUTTHEIGHT, DBGetContactSettingByte(0, TTB_OPTDIR, "BUTTHEIGHT", 16), FALSE); + SetDlgItemInt(hwndDlg, IDC_BUTTWIDTH, DBGetContactSettingByte(0, TTB_OPTDIR, "BUTTWIDTH", 20), FALSE); + CheckDlgButton(hwndDlg, IDC_USEMIRANDABUTTON, DBGetContactSettingByte(0, TTB_OPTDIR, "UseMirandaButtonClass", UseMirandaButtonClassDefaultValue)); + CheckDlgButton(hwndDlg, IDC_USEFLAT, DBGetContactSettingByte(0, TTB_OPTDIR, "UseFlatButton", 1)); - if ( !ServiceExists(MS_SKIN2_ADDICON)) - EnableWindow(GetDlgItem(hwndDlg, IDC_USEICOLIB), FALSE); + if ( !ServiceExists(MS_SKIN2_ADDICON)) + EnableWindow(GetDlgItem(hwndDlg, IDC_USEICOLIB), FALSE); - CheckDlgButton(hwndDlg, IDC_USEICOLIB, ServiceExists(MS_SKIN2_ADDICON)&&DBGetContactSettingByte(0, TTB_OPTDIR, "UseIcoLib", UseIcoLibDefaultValue)); + CheckDlgButton(hwndDlg, IDC_USEICOLIB, TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_USEICOLIB), FALSE); - BuildTree(hwndDlg); - OptionsOpened = true; - EnableWindow(GetDlgItem(hwndDlg, IDC_ENAME), FALSE); - EnableWindow(GetDlgItem(hwndDlg, IDC_EPATH), FALSE); - EnableWindow(GetDlgItem(hwndDlg, IDC_DELLBUTTON), FALSE); + BuildTree(hwndDlg); + OptionsOpened = true; + EnableWindow(GetDlgItem(hwndDlg, IDC_ENAME), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_EPATH), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_DELLBUTTON), FALSE); - SetDlgItemText(hwndDlg, IDC_IMGDIR, DBGetStringT(0, TTB_OPTDIR, "ImgDir")); - SendMessage(hwndDlg, WM_COMMAND, 0, 0); - OptionshWnd = hwndDlg; - } + SendMessage(hwndDlg, WM_COMMAND, 0, 0); + OptionshWnd = hwndDlg; return TRUE; case WM_COMMAND: - ShowWindow(GetDlgItem(hwndDlg, IDC_BMPUP), IsDlgButtonChecked(hwndDlg, IDC_USEICOLIB)?SW_HIDE:SW_SHOW); - ShowWindow(GetDlgItem(hwndDlg, IDC_BMPDN), IsDlgButtonChecked(hwndDlg, IDC_USEICOLIB)?SW_HIDE:SW_SHOW); - ShowWindow(GetDlgItem(hwndDlg, IDC_DEFAULT), IsDlgButtonChecked(hwndDlg, IDC_USEICOLIB)?SW_HIDE:SW_SHOW); - - ShowWindow(GetDlgItem(hwndDlg, IDC_STATIC1), IsDlgButtonChecked(hwndDlg, IDC_USEICOLIB)?SW_HIDE:SW_SHOW); - ShowWindow(GetDlgItem(hwndDlg, IDC_STATIC2), IsDlgButtonChecked(hwndDlg, IDC_USEICOLIB)?SW_HIDE:SW_SHOW); - ShowWindow(GetDlgItem(hwndDlg, IDC_STATIC3), IsDlgButtonChecked(hwndDlg, IDC_USEICOLIB)?SW_HIDE:SW_SHOW); - EnableWindow(GetDlgItem(hwndDlg, IDC_USEFLAT), IsDlgButtonChecked(hwndDlg, IDC_USEMIRANDABUTTON)); if (HIWORD(wParam) == EN_CHANGE ) { @@ -303,28 +152,12 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR int ctrlid = LOWORD(wParam); SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - if (ctrlid == IDC_OPENIMGDIR) { - TCHAR buf[512]; - BROWSEINFO bi = { 0 }; - bi.hwndOwner = hwndDlg; - bi.pszDisplayName = buf; - bi.lpszTitle = TranslateT("Select Directory"); - bi.ulFlags = BIF_RETURNONLYFSDIRS; - PCIDLIST_ABSOLUTE res = SHBrowseForFolder(&bi); - if (res != NULL) { - if (SHGetPathFromIDList(res, buf) == TRUE) { - SetDlgItemText(hwndDlg, IDC_IMGDIR, buf); - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - } - } - break; - } - if (ctrlid == IDC_LBUTTONSET) { int curselect; TVITEM tvi; tvi.hItem = TreeView_GetSelection(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE)); - if (tvi.hItem == NULL){break;} + if (tvi.hItem == NULL) + break; tvi.mask = TVIF_PARAM; TreeView_GetItem(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), &tvi); @@ -409,93 +242,6 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR } break; } - - if (ctrlid == IDC_DEFAULT) { - TVITEM tvi; - tvi.hItem = TreeView_GetSelection(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE)); - if (tvi.hItem == NULL) - break; - - tvi.mask = TVIF_PARAM; - TreeView_GetItem(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), &tvi); - - int curselect = ((ButtonOptData *)tvi.lParam)->pos; - lockbut(); - - if (Buttons[curselect].UserDefinedbmUp != NULL) mir_free(Buttons[curselect].UserDefinedbmUp); - if (Buttons[curselect].UserDefinedbmDown != NULL) mir_free(Buttons[curselect].UserDefinedbmDown); - Buttons[curselect].UserDefinedbmUp = NULL; - Buttons[curselect].UserDefinedbmDown = NULL; - applyuserbitmaps(curselect); - SetImagesForCurrent(hwndDlg, curselect); - - ulockbut(); - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - } - } - - if ((HIWORD(wParam) == STN_CLICKED || HIWORD(wParam) == STN_DBLCLK)) { - int ctrlid = LOWORD(wParam); - if (ctrlid == IDC_BMPUP || ctrlid == IDC_BMPDN) { - TVITEM tvi; - tvi.hItem = TreeView_GetSelection(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE)); - if (tvi.hItem == NULL) - break; - - tvi.mask = TVIF_PARAM; - TreeView_GetItem(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), &tvi); - if (tvi.lParam == 0) - break; - - int curselect = ((ButtonOptData *)tvi.lParam)->pos; - - TCHAR filename[MAX_PATH], filter[512]; - filename[0] = 0; - _tcscpy(filter, TranslateT("Bitmap/Icon files")); - _tcscat(filter, _T(" (*.bmp;*.ico)")); - - TCHAR *pfilter = filter+_tcslen(filter)+1; - _tcscpy(pfilter, _T("*.bmp;*.ico")); - pfilter += _tcslen(pfilter)+1; - - _tcscpy(pfilter, TranslateT("All Files")); - _tcscat(pfilter, _T("(*)")); - pfilter = pfilter + _tcslen(pfilter)+1; - - _tcscpy(pfilter, _T("*")); - pfilter = pfilter + _tcslen(pfilter)+1; - *pfilter = '\0'; - - OPENFILENAME ofn = {0}; - ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; - ofn.hwndOwner = hwndDlg; - ofn.hInstance = NULL; - ofn.lpstrFilter = filter; - ofn.lpstrFile = filename; - ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; - ofn.nMaxFile = sizeof(filename); - ofn.nMaxFileTitle = MAX_PATH; - ofn.lpstrDefExt = _T("bmp"); - ofn.lpstrTitle = (ctrlid == IDC_BMPUP) ? TranslateT("Select Up Bitmap") : TranslateT("Select Down Bitmap"); - if (GetOpenFileName(&ofn)) { - lockbut(); - if (ctrlid == IDC_BMPUP){ - if (Buttons[curselect].UserDefinedbmUp != NULL) - mir_free(Buttons[curselect].UserDefinedbmUp); - Buttons[curselect].UserDefinedbmUp = mir_tstrdup(ofn.lpstrFile); - } - if (ctrlid == IDC_BMPDN){ - if (Buttons[curselect].UserDefinedbmDown != NULL) - mir_free(Buttons[curselect].UserDefinedbmDown); - Buttons[curselect].UserDefinedbmDown = mir_tstrdup(ofn.lpstrFile); - } - applyuserbitmaps(curselect); - SetImagesForCurrent(hwndDlg, curselect); - - ulockbut(); - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - } - } } break; @@ -513,7 +259,6 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR SaveTree(hwndDlg); - ApplyNewDir(hwndDlg); RecreateWindows(); ArrangeButtons(); } @@ -561,20 +306,10 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR tvi.hItem = hti; TreeView_GetItem(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE), &tvi); - lockbut(); - EnableWindow(GetDlgItem(hwndDlg, IDC_BMPUP), FALSE); - EnableWindow(GetDlgItem(hwndDlg, IDC_BMPDN), FALSE); - - SetImagesForCurrent(hwndDlg, ((ButtonOptData *)tvi.lParam)->pos); - EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVESEP), FALSE); - if (Buttons[((ButtonOptData *)tvi.lParam)->pos].dwFlags&TTBBF_ISSEPARATOR) + if (Buttons[((ButtonOptData *)tvi.lParam)->pos].dwFlags & TTBBF_ISSEPARATOR) EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVESEP), TRUE); - else { - EnableWindow(GetDlgItem(hwndDlg, IDC_BMPUP), TRUE); - EnableWindow(GetDlgItem(hwndDlg, IDC_BMPDN), TRUE); - } EnableWindow(GetDlgItem(hwndDlg, IDC_ENAME), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_EPATH), FALSE); @@ -675,34 +410,8 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR return FALSE; } -int TTBOptInit(WPARAM wParam, LPARAM lParam) -{ - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); - odp.position = 0; - odp.hInstance = hInst; - odp.pszGroup = LPGEN("TopToolBar"); - - if ( !ServiceExists(MS_BACKGROUNDCONFIG_REGISTER)) { - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_TTBBKG); - odp.pszTitle = LPGEN("TTBBackground"); - odp.pfnDlgProc = DlgProcTTBBkgOpts; - odp.flags = ODPF_BOLDGROUPS; - CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp); - } - - ZeroMemory(&odp, sizeof(odp)); - odp.cbSize = sizeof(odp); - odp.position = -1000000000; - odp.hInstance = hInst; - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_BUTORDER); - odp.pszGroup = LPGEN("TopToolBar"); - odp.pszTitle = LPGEN("Buttons"); - odp.pfnDlgProc = ButOrderOpts; - odp.flags = ODPF_BOLDGROUPS|ODPF_EXPERTONLY; - CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp); - return 0; -} +///////////////////////////////////////////////////////////////////////////////////////// +// Options window: background static INT_PTR CALLBACK DlgProcTTBBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { @@ -819,3 +528,34 @@ static INT_PTR CALLBACK DlgProcTTBBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, } return FALSE; } + +///////////////////////////////////////////////////////////////////////////////////////// + +int TTBOptInit(WPARAM wParam, LPARAM lParam) +{ + OPTIONSDIALOGPAGE odp = { 0 }; + odp.cbSize = sizeof(odp); + odp.position = 0; + odp.hInstance = hInst; + odp.pszGroup = LPGEN("TopToolBar"); + + if ( !ServiceExists(MS_BACKGROUNDCONFIG_REGISTER)) { + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_TTBBKG); + odp.pszTitle = LPGEN("TTBBackground"); + odp.pfnDlgProc = DlgProcTTBBkgOpts; + odp.flags = ODPF_BOLDGROUPS; + CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp); + } + + ZeroMemory(&odp, sizeof(odp)); + odp.cbSize = sizeof(odp); + odp.position = -1000000000; + odp.hInstance = hInst; + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_BUTORDER); + odp.pszGroup = LPGEN("TopToolBar"); + odp.pszTitle = LPGEN("Buttons"); + odp.pfnDlgProc = ButOrderOpts; + odp.flags = ODPF_BOLDGROUPS|ODPF_EXPERTONLY; + CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp); + return 0; +} diff --git a/plugins/UserInfoEx/Flags/svc_flags.cpp b/plugins/UserInfoEx/Flags/svc_flags.cpp index 58fe8eec24..49435ec5c0 100644 --- a/plugins/UserInfoEx/Flags/svc_flags.cpp +++ b/plugins/UserInfoEx/Flags/svc_flags.cpp @@ -266,7 +266,7 @@ static void CALLBACK SetExtraImage(LPARAM lParam) { HICON hIcon=LoadFlag(countryNumber); // Returned HICON SHOULDN'T be destroyed, it is managed by IcoLib if(hIcon!=NULL) { phExtraImageList[index]=(HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON,(WPARAM)hIcon,0); - CallService(MS_SKIN2_RELEASEICON,(WPARAM)hIcon,0); /* does NULL check */ + Skin_ReleaseIcon(hIcon); /* does NULL check */ } } iec.hImage=phExtraImageList[index]; @@ -502,7 +502,7 @@ MsgWndData::FlagsIconSet() { /* copy icon as status icon API will call DestroyIcon() on it */ hIcon = LoadFlagIcon(m_contryID); sid.hIcon = (hIcon!=NULL)?CopyIcon(hIcon):NULL; - CallService(MS_SKIN2_RELEASEICON,(WPARAM)hIcon,0); /* does NULL check */ + Skin_ReleaseIcon(hIcon); /* does NULL check */ hIcon = sid.hIcon; sid.dwId = (DWORD)m_contryID; sid.hIconDisabled = sid.hIcon/*NULL*/; @@ -565,14 +565,14 @@ IconList::~IconList() { // const char *pszName; // [Optional] Name of an icon registered with icolib to be used in GUI. static __inline int MessageAPI_AddIcon(const char* pszName, const char* szModul/*StatusIconData *sid*/,int ID, int flags, const char* szTooltip) { - HICON hIcon = (HICON)CallService(MS_SKIN2_GETICON,(WPARAM)0/* =small 1=big*/,(LPARAM)pszName); + HICON hIcon = Skin_GetIcon(pszName); StatusIconData sid = {0}; sid.cbSize = sizeof(sid); sid.szModule = (char*)szModul; sid.dwId = (DWORD)ID; sid.hIcon = (hIcon!=NULL)?CopyIcon(hIcon):NULL; - CallService(MS_SKIN2_RELEASEICON,(WPARAM)hIcon,0); /* does NULL check */ + Skin_ReleaseIcon(hIcon); /* does NULL check */ // sid.hIconDisabled = sid.hIcon/*NULL*/; sid.flags = 0; sid.szTooltip = Translate((char*)CallService(MS_UTILS_GETCOUNTRYBYNUMBER,ID,0)); diff --git a/plugins/UserInfoEx/Flags/svc_flagsicons.cpp b/plugins/UserInfoEx/Flags/svc_flagsicons.cpp index 34fec69c39..a765b8e8f8 100644 --- a/plugins/UserInfoEx/Flags/svc_flagsicons.cpp +++ b/plugins/UserInfoEx/Flags/svc_flagsicons.cpp @@ -141,11 +141,11 @@ HICON LoadFlag(int countryNumber) char szId[20],*szCountry; /* create identifier */ szCountry=(char*)CallService(MS_UTILS_GETCOUNTRYBYNUMBER,countryNumber,0); - if(szCountry==NULL) { + if(szCountry == NULL) szCountry=(char*)CallService(MS_UTILS_GETCOUNTRYBYNUMBER,countryNumber=0xFFFF,0); - } + wsprintfA(szId,(countryNumber==0xFFFF)?"%s_0x%X":"%s_%i","flags",countryNumber); /* buffer safe */ - return (HICON)CallService(MS_SKIN2_GETICON,(WPARAM)0/* =small 1=big*/,(LPARAM)szId); + return Skin_GetIcon(szId); } int CountryNumberToIndex(int countryNumber) @@ -431,7 +431,7 @@ VOID InitIcons() skid.hDefaultIcon=ImageList_ExtractIcon(NULL, himl, index); index = CountryNumberToIndex(countries[i].id); - phIconHandles[index]=(HANDLE)CallService(MS_SKIN2_ADDICON,0,(LPARAM)&skid); + phIconHandles[index] = Skin_AddIcon(&skid); if(skid.hDefaultIcon!=NULL) DestroyIcon(skid.hDefaultIcon); mir_free(skid.ptszDescription); skid.ptszDescription = NULL; } @@ -446,12 +446,11 @@ VOID InitIcons() VOID UninitIcons() { - int i; - char szId[20]; - for(i=0;i #include "mir_icons.h" @@ -26,8 +27,6 @@ Boston, MA 02111-1307, USA. extern HINSTANCE hInst; - - HICON IcoLib_LoadIcon(const char *iconName, BOOL copy) { if (!ServiceExists(MS_SKIN2_GETICON)) @@ -59,13 +58,12 @@ void IcoLib_ReleaseIcon(HICON hIcon) } -void IcoLib_Register(char *name, TCHAR *section, TCHAR *description, int id) +HANDLE IcoLib_Register(char *name, TCHAR *section, TCHAR *description, int id) { HICON hIcon = (HICON) CallService(MS_SKIN2_GETICON, 0, (LPARAM) name); - if (hIcon != NULL) - { + if (hIcon != NULL) { CallService(MS_SKIN2_RELEASEICON, (WPARAM) hIcon, 0); - return; + return NULL; } SKINICONDESC sid = {0}; @@ -77,10 +75,11 @@ void IcoLib_Register(char *name, TCHAR *section, TCHAR *description, int id) int cx = GetSystemMetrics(SM_CXSMICON); sid.hDefaultIcon = (HICON) LoadImage(hInst, MAKEINTRESOURCE(id), IMAGE_ICON, cx, cx, LR_DEFAULTCOLOR | LR_SHARED); - - CallService(MS_SKIN2_ADDICON, 0, (LPARAM)&sid); + HANDLE hRes = Skin_AddIcon(&sid); if (sid.hDefaultIcon) DestroyIcon(sid.hDefaultIcon); + + return hRes; } diff --git a/plugins/Utils/mir_icons.h b/plugins/Utils/mir_icons.h index 178094c803..e1e1a918a3 100644 --- a/plugins/Utils/mir_icons.h +++ b/plugins/Utils/mir_icons.h @@ -23,16 +23,10 @@ Boston, MA 02111-1307, USA. #define _CRT_SECURE_NO_WARNINGS -#include - - -void IcoLib_Register(char *name, TCHAR *section, TCHAR *description, int id); +HANDLE IcoLib_Register(char *name, TCHAR *section, TCHAR *description, int id); HICON IcoLib_LoadIcon(const char *iconName, BOOL copy = FALSE); void IcoLib_ReleaseIcon(const char *iconName); void IcoLib_ReleaseIcon(HICON hIcon); - - - #endif // __MIR_ICONS_H__ diff --git a/plugins/WhenWasIt/WhenWasIt.rc b/plugins/WhenWasIt/WhenWasIt.rc index afe6a7cb4a..97acb82865 100644 --- a/plugins/WhenWasIt/WhenWasIt.rc +++ b/plugins/WhenWasIt/WhenWasIt.rc @@ -27,18 +27,18 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // TEXTINCLUDE // -1 TEXTINCLUDE +1 TEXTINCLUDE BEGIN "resource.h\0" END -2 TEXTINCLUDE +2 TEXTINCLUDE BEGIN "#include ""afxres.h""\r\n" "\0" END -3 TEXTINCLUDE +3 TEXTINCLUDE BEGIN "\r\n" "\0" @@ -159,7 +159,7 @@ END // #ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO +GUIDELINES DESIGNINFO BEGIN IDD_OPT_WWI, DIALOG BEGIN @@ -241,13 +241,6 @@ IDI_REFRESH_USERDETAILS ICON "icons\\refresh.ico" IDI_IMPORT_BIRTHDAYS ICON "icons\\import.ico" IDI_EXPORT_BIRTHDAYS ICON "icons\\export.ico" -///////////////////////////////////////////////////////////////////////////// -// -// Bitmap -// - -IDB_TTB_CHECK BITMAP "icons\\check.bmp" - ///////////////////////////////////////////////////////////////////////////// // // Dialog Info @@ -256,12 +249,12 @@ IDB_TTB_CHECK BITMAP "icons\\check.bmp" IDD_ADD_BIRTHDAY DLGINIT BEGIN IDC_COMPATIBILITY, 0x403, 16, 0 -0x7250, 0x746f, 0x636f, 0x6c6f, 0x6d20, 0x646f, 0x6c75, 0x0065, +0x7250, 0x746f, 0x636f, 0x6c6f, 0x6d20, 0x646f, 0x6c75, 0x0065, IDC_COMPATIBILITY, 0x403, 19, 0 -0x7355, 0x7265, 0x6544, 0x6174, 0x6c69, 0x2073, 0x6f6d, 0x7564, 0x656c, -"\000" +0x7355, 0x7265, 0x6544, 0x6174, 0x6c69, 0x2073, 0x6f6d, 0x7564, 0x656c, +"\000" IDC_COMPATIBILITY, 0x403, 17, 0 -0x426d, 0x7269, 0x6874, 0x6164, 0x2079, 0x6f6d, 0x7564, 0x656c, "\000" +0x426d, 0x7269, 0x6874, 0x6164, 0x2079, 0x6f6d, 0x7564, 0x656c, "\000" 0 END @@ -279,4 +272,3 @@ END ///////////////////////////////////////////////////////////////////////////// #endif // not APSTUDIO_INVOKED - diff --git a/plugins/WhenWasIt/hooked_events.cpp b/plugins/WhenWasIt/hooked_events.cpp index 20e9bfc86d..e24e642612 100644 --- a/plugins/WhenWasIt/hooked_events.cpp +++ b/plugins/WhenWasIt/hooked_events.cpp @@ -84,7 +84,6 @@ int UnhookEvents() UnhookEvent(hExtraImageApply); UnhookEvent(hContactSettingChanged); UnhookEvent(hTopToolBarModuleLoaded); - //UnhookEvent(hContactSendMessage); KillTimers(); @@ -158,8 +157,7 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) cl.pszName = "Add/change user &birthday"; hmAddChangeBirthday = (HANDLE) CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM) &cl); - if(ServiceExists(MS_HOTKEY_REGISTER)) - { + if(ServiceExists(MS_HOTKEY_REGISTER)) { HOTKEYDESC hotkey = {0}; hotkey.cbSize = sizeof(hotkey); hotkey.dwFlags = HKD_TCHAR; @@ -185,13 +183,9 @@ int OnTopToolBarModuleLoaded(WPARAM wParam, LPARAM lParam) ttb.cbSize = sizeof(TTBButton); ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP; ttb.pszServiceDown = MS_WWI_CHECK_BIRTHDAYS; - HBITMAP bitmap = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_TTB_CHECK)); - ttb.hbBitmapUp = (HBITMAP) bitmap; - ttb.hbBitmapDown = (HBITMAP) bitmap; - ttb.name = Translate("Check for birthdays"); + ttb.hIconUp = ttb.hIconDn = hiCheckMenu; + ttb.name = "Check for birthdays"; CallService(MS_TTB_ADDBUTTON, (WPARAM) &ttb, 0); - //DeleteObject(icon); - return 0; } diff --git a/plugins/WhenWasIt/icons/check.bmp b/plugins/WhenWasIt/icons/check.bmp deleted file mode 100644 index cf430c8c6d..0000000000 Binary files a/plugins/WhenWasIt/icons/check.bmp and /dev/null differ diff --git a/plugins/WhenWasIt/resource.h b/plugins/WhenWasIt/resource.h index d04aaf378f..e43831ac79 100644 --- a/plugins/WhenWasIt/resource.h +++ b/plugins/WhenWasIt/resource.h @@ -20,9 +20,7 @@ #define IDI_DTB0 117 #define IDI_DTBMORE 118 #define IDD_ADD_BIRTHDAY 119 -#define IDI_ICON1 120 -#define IDI_ADD 120 -#define IDB_TTB_CHECK 122 +#define IDI_ADD 121 #define IDI_REFRESH_USERDETAILS 123 #define IDI_IMPORT 125 #define IDI_IMPORT_BIRTHDAYS 125 @@ -70,7 +68,7 @@ #define IDC_OPENINBACKGROUND 1047 // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 129 diff --git a/protocols/YAMN/services.cpp b/protocols/YAMN/services.cpp index b0b524eddc..cdb87aecfa 100644 --- a/protocols/YAMN/services.cpp +++ b/protocols/YAMN/services.cpp @@ -312,10 +312,10 @@ int AddTopToolbarIcon(WPARAM,LPARAM) TTBButton btn = { 0 }; btn.cbSize = sizeof(TTBButton); btn.pszServiceUp = MS_YAMN_FORCECHECK; - btn.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP; + btn.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP | TTBBF_ICONBYHANDLE; btn.name = Translate("Check mail"); - btn.hbBitmapUp = LoadBmpFromIcon(g_LoadIconEx(5)); - btn.hbBitmapDown = LoadBmpFromIcon(g_LoadIconEx(6)); + btn.hIconHandleUp = g_GetIconHandle(5); + btn.hIconHandleDn = g_GetIconHandle(6); hTTButton = (HANDLE)CallService(MS_TTB_ADDBUTTON, (WPARAM)&btn, 0); CallService(MS_TTB_SETBUTTONOPTIONS, MAKEWPARAM((WORD)TTBO_TIPNAME, (WORD)hTTButton), (LPARAM)Translate("Check mail")); } -- cgit v1.2.3