From 3b3bdf6af13a209838d2a99efdc23bfd35f02f3d Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 19 Jun 2012 18:48:35 +0000 Subject: tabSRMM button sync git-svn-id: http://svn.miranda-ng.org/main/trunk@486 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- include/m_button.h | 14 +++--- plugins/TabSRMM/chat/window.cpp | 4 +- plugins/TabSRMM/include/themes.h | 11 +++-- plugins/TabSRMM/src/TSButton.cpp | 4 +- plugins/TabSRMM/src/buttonsbar.cpp | 6 +-- plugins/TabSRMM/src/msgdialog.cpp | 12 +++--- plugins/TabSRMM/src/sidebar.cpp | 6 +-- plugins/WhenWasIt/hooked_events.cpp | 2 +- src/modules/button/button.cpp | 86 ++++++++++++++++++++----------------- 9 files changed, 75 insertions(+), 70 deletions(-) diff --git a/include/m_button.h b/include/m_button.h index 2e8f9e4cf9..503c435cf6 100644 --- a/include/m_button.h +++ b/include/m_button.h @@ -56,13 +56,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Only works on MButtonClass buttons #define BUTTONSETASFLATBTN (WM_USER+4) -// Sets the button type as a flat button without borders v0.3.3+ -// wParam = TRUE/FALSE default on/off -// lParam = not used -// Usage: SendMessage(hwndbutton, BUTTONSETASFLATBTN, 1, 0); -// Only works on MButtonClass buttons -#define BUTTONSETASTHEMEDBTN (WM_USER+5) - // Sets a tooltip for the button v0.3.3+ // wParam = (WPARAM)(char *)szTip // lParam = not used @@ -76,5 +69,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define BUTTONADDTOOLTIP (WM_USER+5) +// Sets the button type as a flat button without borders v0.3.3+ +// wParam = TRUE/FALSE default on/off +// lParam = not used +// Usage: SendMessage(hwndbutton, BUTTONSETASFLATBTN, 1, 0); +// Only works on MButtonClass buttons +#define BUTTONSETASTHEMEDBTN (WM_USER+6) + #endif // M_BUTTON_H__ diff --git a/plugins/TabSRMM/chat/window.cpp b/plugins/TabSRMM/chat/window.cpp index 2401db2d0a..0925f5209b 100644 --- a/plugins/TabSRMM/chat/window.cpp +++ b/plugins/TabSRMM/chat/window.cpp @@ -2053,9 +2053,9 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar GetMYUIN(dat); GetMyNick(dat); - SendDlgItemMessage(hwndDlg, IDC_CHAT_TOGGLESIDEBAR, BUTTONSETASTHEMED, PluginConfig.m_bIsXP, 0); + SendDlgItemMessage(hwndDlg, IDC_CHAT_TOGGLESIDEBAR, BUTTONSETASTHEMEDBTN, PluginConfig.m_bIsXP, 0); SendDlgItemMessage(hwndDlg, IDC_CHAT_TOGGLESIDEBAR, BUTTONSETCONTAINER, (LPARAM)dat->pContainer, 0); - SendDlgItemMessage(hwndDlg, IDC_CHAT_TOGGLESIDEBAR, BUTTONSETASFLATBTN, TRUE, 0); + SendDlgItemMessage(hwndDlg, IDC_CHAT_TOGGLESIDEBAR, BUTTONSETASFLATBTN, FALSE, 0); SendDlgItemMessage(hwndDlg, IDC_CHAT_TOGGLESIDEBAR, BUTTONSETASTOOLBARBUTTON, TRUE, 0); SendDlgItemMessage(hwndDlg, IDC_CHAT_TOGGLESIDEBAR, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Expand or collapse the side bar"), 1); diff --git a/plugins/TabSRMM/include/themes.h b/plugins/TabSRMM/include/themes.h index 2079b2eaa0..a714f4040d 100644 --- a/plugins/TabSRMM/include/themes.h +++ b/plugins/TabSRMM/include/themes.h @@ -57,17 +57,16 @@ typedef struct { HANDLE hThemeButton; HANDLE hThemeToolbar; BOOL bThemed; - BOOL bToolbarButton; // is a toolbar button (important for aero background rendering) - BOOL bTitleButton; - TCHAR cHot; + BOOL bToolbarButton; // is a toolbar button (important for aero background rendering) + BOOL bTitleButton; + TCHAR cHot; int flatBtn; int dimmed; - HICON overlay; - struct TContainerData *pContainer; + HICON overlay; + struct TContainerData *pContainer; CSideBarButton *sitem; } MButtonCtrl; -#define BUTTONSETASTHEMED (BUTTONSETASFLATBTN + 10) #define BUTTONSETASDIMMED (BUTTONSETASFLATBTN + 11) #define BUTTONSETCONTAINER (BUTTONSETASFLATBTN + 12) #define BUTTONSETASTITLE (BUTTONSETASFLATBTN + 13) diff --git a/plugins/TabSRMM/src/TSButton.cpp b/plugins/TabSRMM/src/TSButton.cpp index 7c47c1d05a..2c911bc849 100644 --- a/plugins/TabSRMM/src/TSButton.cpp +++ b/plugins/TabSRMM/src/TSButton.cpp @@ -285,7 +285,7 @@ nonflat_themed: } /* - * render content + * render content */ if (ctl->arrow) { rcContent.top += 2; @@ -553,7 +553,7 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, bct->flatBtn = (wParam != 0); InvalidateRect(bct->hwnd, NULL, TRUE); break; - case BUTTONSETASTHEMED: + case BUTTONSETASTHEMEDBTN: bct->bThemed = (wParam != 0); break; case BUTTONSETASDIMMED: diff --git a/plugins/TabSRMM/src/buttonsbar.cpp b/plugins/TabSRMM/src/buttonsbar.cpp index 29d15161fb..b75d554fb3 100644 --- a/plugins/TabSRMM/src/buttonsbar.cpp +++ b/plugins/TabSRMM/src/buttonsbar.cpp @@ -567,8 +567,8 @@ void TSAPI BB_InitDlgButtons(TWindowData *dat) if (!cbd->bDummy && !GetDlgItem(hdlg, cbd->dwButtonCID)) hwndBtn = CreateWindowEx(0, _T("TSButtonClass"), _T(""), WS_CHILD | WS_VISIBLE | WS_TABSTOP, rect.right - rwidth + gap, splitterY, cbd->iButtonWidth, DPISCALEY_S(22), hdlg, (HMENU) cbd->dwButtonCID, g_hInst, NULL); if (!cbd->bDummy && hwndBtn) { - SendMessage(hwndBtn, BUTTONSETASFLATBTN, TRUE, 0); - SendMessage(hwndBtn, BUTTONSETASTHEMED, isThemed != 0, 0); + SendMessage(hwndBtn, BUTTONSETASFLATBTN, FALSE, 0); + SendMessage(hwndBtn, BUTTONSETASTHEMEDBTN, isThemed != 0, 0); if (cbd->hIcon) SendMessage(hwndBtn, BM_SETIMAGE, IMAGE_ICON, (LPARAM)CallService(MS_SKIN2_GETICONBYHANDLE, 0, (LPARAM)cbd->hIcon)); if (cbd->ptszTooltip) @@ -606,7 +606,7 @@ void TSAPI BB_InitDlgButtons(TWindowData *dat) dat->iButtonBarReallyNeeds += cbd->iButtonWidth + gap; if (!cbd->bDummy && hwndBtn) { SendMessage(hwndBtn, BUTTONSETASFLATBTN, TRUE, 0); - SendMessage(hwndBtn, BUTTONSETASTHEMED, isThemed != 0, 0); + SendMessage(hwndBtn, BUTTONSETASTHEMEDBTN, isThemed != 0, 0); if (cbd->hIcon) SendMessage(hwndBtn, BM_SETIMAGE, IMAGE_ICON, (LPARAM)CallService(MS_SKIN2_GETICONBYHANDLE, 0, (LPARAM)cbd->hIcon)); if (cbd->ptszTooltip) diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index c174aed362..7465fe311f 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -1460,11 +1460,11 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP isThemed = FALSE; } - SendMessage(GetDlgItem(hwndDlg, IDC_ADD), BUTTONSETASFLATBTN, TRUE, 0); - SendMessage(GetDlgItem(hwndDlg, IDC_CANCELADD), BUTTONSETASFLATBTN, TRUE, 0); + SendMessage(GetDlgItem(hwndDlg, IDC_ADD), BUTTONSETASFLATBTN, FALSE, 0); + SendMessage(GetDlgItem(hwndDlg, IDC_CANCELADD), BUTTONSETASFLATBTN, FALSE, 0); - SendDlgItemMessage(hwndDlg, IDC_TOGGLESIDEBAR, BUTTONSETASFLATBTN, TRUE, 0); - SendDlgItemMessage(hwndDlg, IDC_TOGGLESIDEBAR, BUTTONSETASTHEMED, isThemed != 0, 0); + SendDlgItemMessage(hwndDlg, IDC_TOGGLESIDEBAR, BUTTONSETASFLATBTN, FALSE, 0); + SendDlgItemMessage(hwndDlg, IDC_TOGGLESIDEBAR, BUTTONSETASTHEMEDBTN, isThemed != 0, 0); SendDlgItemMessage(hwndDlg, IDC_TOGGLESIDEBAR, BUTTONSETCONTAINER, (LPARAM)m_pContainer, 0); SendDlgItemMessage(hwndDlg, IDC_TOGGLESIDEBAR, BUTTONSETASTOOLBARBUTTON, TRUE, 0); @@ -1487,8 +1487,8 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP UINT _ctrls[] = {IDC_RETRY, IDC_CANCELSEND, IDC_MSGSENDLATER}; for(i = 0; i < 3; i++) { SendDlgItemMessage(hwndDlg, _ctrls[i], BUTTONSETASPUSHBTN, TRUE, 0); - SendDlgItemMessage(hwndDlg, _ctrls[i], BUTTONSETASFLATBTN, TRUE, 0); - SendDlgItemMessage(hwndDlg, _ctrls[i], BUTTONSETASTHEMED, TRUE, 0); + SendDlgItemMessage(hwndDlg, _ctrls[i], BUTTONSETASFLATBTN, FALSE, 0); + SendDlgItemMessage(hwndDlg, _ctrls[i], BUTTONSETASTHEMEDBTN, TRUE, 0); } } diff --git a/plugins/TabSRMM/src/sidebar.cpp b/plugins/TabSRMM/src/sidebar.cpp index 481e00f171..f3c514c588 100644 --- a/plugins/TabSRMM/src/sidebar.cpp +++ b/plugins/TabSRMM/src/sidebar.cpp @@ -111,8 +111,8 @@ void CSideBarButton::_create() if(m_hwnd) { ::SendMessage(m_hwnd, BUTTONSETASSIDEBARBUTTON, (WPARAM)this, 0); - ::SendMessage(m_hwnd, BUTTONSETASFLATBTN, TRUE, 0); - ::SendMessage(m_hwnd, BUTTONSETASTHEMED, TRUE, 0); + ::SendMessage(m_hwnd, BUTTONSETASFLATBTN, FALSE, 0); + ::SendMessage(m_hwnd, BUTTONSETASTHEMEDBTN, TRUE, 0); ::SendMessage(m_hwnd, BUTTONSETCONTAINER, (LPARAM)m_sideBar->getContainer(), 0); m_buttonControl = (MButtonCtrl *)::GetWindowLongPtr(m_hwnd, 0); } @@ -354,7 +354,7 @@ void CSideBarButton::activateSession() const } /** - * show the context menu (same as on tabs + * show the context menu (same as on tabs */ void CSideBarButton::invokeContextMenu() { diff --git a/plugins/WhenWasIt/hooked_events.cpp b/plugins/WhenWasIt/hooked_events.cpp index 3b9d2dadef..e6be71994b 100644 --- a/plugins/WhenWasIt/hooked_events.cpp +++ b/plugins/WhenWasIt/hooked_events.cpp @@ -165,7 +165,7 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) Hotkey_Register(&hotkey); hotkey.pszName = "wwi_check_birthdays"; - hotkey.ptszDescription = LPGENT("Check for birthdays"); + hotkey.pszDescription = LPGEN("Check for birthdays"); hotkey.pszService = MS_WWI_CHECK_BIRTHDAYS; Hotkey_Register(&hotkey); diff --git a/src/modules/button/button.cpp b/src/modules/button/button.cpp index 752e4da1bb..bf5b2b6893 100644 --- a/src/modules/button/button.cpp +++ b/src/modules/button/button.cpp @@ -316,9 +316,9 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L } break; // DONT! fall thru - case WM_NCDESTROY: + case WM_NCDESTROY: mir_free(bct); - break; + break; case WM_SETTEXT: bct->cHot = 0; @@ -383,33 +383,35 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L case WM_NCPAINT: case WM_PAINT: - { - PAINTSTRUCT ps; - HDC hdcPaint = BeginPaint(hwndDlg, &ps); - if (hdcPaint) { - PaintWorker(bct, hdcPaint); - EndPaint(hwndDlg, &ps); + { + PAINTSTRUCT ps; + HDC hdcPaint = BeginPaint(hwndDlg, &ps); + if (hdcPaint) { + PaintWorker(bct, hdcPaint); + EndPaint(hwndDlg, &ps); + } } break; - } + case BM_SETIMAGE: - { - HGDIOBJ hnd = NULL; - if (bct->hIcon) hnd = bct->hIcon; - else if (bct->hBitmap) hnd = bct->hBitmap; - - if (wParam == IMAGE_ICON) { - bct->hIcon = (HICON)lParam; - bct->hBitmap = NULL; - InvalidateRect(bct->hwnd, NULL, TRUE); - } - else if (wParam == IMAGE_BITMAP) { - bct->hBitmap = (HBITMAP)lParam; - bct->hIcon = NULL; - InvalidateRect(bct->hwnd, NULL, TRUE); + { + HGDIOBJ hnd = NULL; + if (bct->hIcon) hnd = bct->hIcon; + else if (bct->hBitmap) hnd = bct->hBitmap; + + if (wParam == IMAGE_ICON) { + bct->hIcon = (HICON)lParam; + bct->hBitmap = NULL; + InvalidateRect(bct->hwnd, NULL, TRUE); + } + else if (wParam == IMAGE_BITMAP) { + bct->hBitmap = (HBITMAP)lParam; + bct->hIcon = NULL; + InvalidateRect(bct->hwnd, NULL, TRUE); + } } return (LRESULT)hnd; - } + case BM_GETIMAGE: if (bct->hIcon) return (LRESULT)bct->hIcon; else if (bct->hBitmap) return (LRESULT)bct->hBitmap; @@ -513,6 +515,7 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L mir_free(ti.lpszText); } break; + case WM_SETFOCUS: // set keybord focus and redraw bct->focus = 1; InvalidateRect(bct->hwnd, NULL, TRUE); @@ -547,23 +550,24 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L break; case WM_LBUTTONUP: - { - int showClick = 0; - if (bct->bIsPushBtn) { - if (bct->bIsPushed) bct->bIsPushed = 0; - else bct->bIsPushed = 1; - } - if (bct->stateId != PBS_DISABLED) { // don't change states if disabled - if (bct->stateId == PBS_PRESSED) - showClick = 1; - if (msg == WM_LBUTTONUP) bct->stateId = PBS_HOT; - else bct->stateId = PBS_NORMAL; - InvalidateRect(bct->hwnd, NULL, TRUE); + { + int showClick = 0; + if (bct->bIsPushBtn) { + if (bct->bIsPushed) bct->bIsPushed = 0; + else bct->bIsPushed = 1; + } + if (bct->stateId != PBS_DISABLED) { // don't change states if disabled + if (bct->stateId == PBS_PRESSED) + showClick = 1; + if (msg == WM_LBUTTONUP) bct->stateId = PBS_HOT; + else bct->stateId = PBS_NORMAL; + InvalidateRect(bct->hwnd, NULL, TRUE); + } + if (showClick) // Tell your daddy you got clicked. + SendMessage(GetParent(hwndDlg), WM_COMMAND, MAKELONG(GetDlgCtrlID(hwndDlg), BN_CLICKED), (LPARAM)hwndDlg); } - if (showClick) // Tell your daddy you got clicked. - 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; @@ -572,11 +576,13 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L // Call timer, used to start cheesy TrackMouseEvent faker SetTimer(hwndDlg, BUTTON_POLLID, BUTTON_POLLDELAY, NULL); 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); + + POINT pt; GetCursorPos(&pt); if ( !PtInRect(&rc, pt)) { // mouse must be gone, trigger mouse leave PostMessage(hwndDlg, WM_MOUSELEAVE, 0, 0L); -- cgit v1.2.3