diff options
author | René Schümann <white06tiger@gmail.com> | 2013-11-05 16:06:51 +0000 |
---|---|---|
committer | René Schümann <white06tiger@gmail.com> | 2013-11-05 16:06:51 +0000 |
commit | 36dffc5b63263b87e6cf63e74edd404b7ede7c42 (patch) | |
tree | fe1df7704c6f8494725eb8bddd4a3ba9f2a5a388 /plugins/SendScreenshotPlus/src/ctrl_button.cpp | |
parent | 8dcf6f373552f30639b9557c5c11f9c9dc81fef1 (diff) |
// 2 out of X
* cleanup (nothing functional)
commented out unused functions, simplified some code, removed "unused" returns
git-svn-id: http://svn.miranda-ng.org/main/trunk@6787 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/SendScreenshotPlus/src/ctrl_button.cpp')
-rw-r--r-- | plugins/SendScreenshotPlus/src/ctrl_button.cpp | 40 |
1 files changed, 15 insertions, 25 deletions
diff --git a/plugins/SendScreenshotPlus/src/ctrl_button.cpp b/plugins/SendScreenshotPlus/src/ctrl_button.cpp index 3552517c67..62154334a5 100644 --- a/plugins/SendScreenshotPlus/src/ctrl_button.cpp +++ b/plugins/SendScreenshotPlus/src/ctrl_button.cpp @@ -189,13 +189,11 @@ static VOID __fastcall PaintThemeButton(BTNCTRL *ctl, HDC hdcMem, LPRECT rcClien // calculate text rect { - RECT sizeText; - HFONT hOldFont; ccText = GetWindowTextW(ctl->hwnd, wszText, sizeof(wszText) / sizeof(WCHAR)); - if (ccText > 0) { - hOldFont = (HFONT)SelectObject(hdcMem, ctl->hFont); + RECT sizeText; + HFONT hOldFont = (HFONT)SelectObject(hdcMem, ctl->hFont); GetThemeTextExtent( ctl->hThemeButton, @@ -298,13 +296,11 @@ static VOID __fastcall PaintButton(BTNCTRL *ctl, HDC hdcMem, LPRECT rcClient) } // calculate text rect { - SIZE sizeText; - HFONT hOldFont; ccText = GetWindowText(ctl->hwnd, szText, SIZEOF(szText)); - if (ccText > 0) { - hOldFont = (HFONT)SelectObject(hdcMem, ctl->hFont); + SIZE sizeText; + HFONT hOldFont = (HFONT)SelectObject(hdcMem, ctl->hFont); GetTextExtentPoint32(hdcMem, szText, ccText, &sizeText); if (ctl->cHot) { SIZE sizeHot; @@ -445,16 +441,11 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L { PAINTSTRUCT ps; HDC hdcPaint; - HDC hdcMem; - HBITMAP hbmMem; - HDC hOld; - RECT rcClient; - if (hdcPaint = BeginPaint(hwndBtn, &ps)) { - GetClientRect(bct->hwnd, &rcClient); - hdcMem = CreateCompatibleDC(hdcPaint); - hbmMem = CreateCompatibleBitmap(hdcPaint, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top); - hOld = (HDC)SelectObject(hdcMem, hbmMem); + RECT rcClient; GetClientRect(bct->hwnd, &rcClient); + HDC hdcMem = CreateCompatibleDC(hdcPaint); + HBITMAP hbmMem = CreateCompatibleBitmap(hdcPaint, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top); + HDC hOld = (HDC)SelectObject(hdcMem, hbmMem); // If its a push button, check to see if it should stay pressed if ((bct->dwStyle & MBS_PUSHBUTTON) && bct->pbState) bct->stateId = PBS_PRESSED; @@ -611,14 +602,13 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L case WM_TIMER: // use a timer to check if they have did a mouseout if (wParam == BUTTON_POLLID) { RECT rc; - POINT pt; - - GetWindowRect(hwndBtn, &rc); - GetCursorPos(&pt); - if (!PtInRect(&rc, pt)) { // mouse must be gone, trigger mouse leave - PostMessage(hwndBtn, WM_MOUSELEAVE, 0, 0L); - KillTimer(hwndBtn, BUTTON_POLLID); - } + POINT pt; + GetWindowRect(hwndBtn,&rc); + GetCursorPos(&pt); + if(!PtInRect(&rc,pt)){ // mouse must be gone, trigger mouse leave + PostMessage(hwndBtn,WM_MOUSELEAVE,0,0L); + KillTimer(hwndBtn,BUTTON_POLLID); + } } break; case WM_ERASEBKGND: |