diff options
Diffstat (limited to 'tipper/popwin.cpp')
-rw-r--r-- | tipper/popwin.cpp | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/tipper/popwin.cpp b/tipper/popwin.cpp index 8c5b2e9..d217883 100644 --- a/tipper/popwin.cpp +++ b/tipper/popwin.cpp @@ -308,7 +308,29 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa GetClientRect(hwnd, &r); // bg - FillRect(hdc, &r, pwd->bkBrush); + if(options.bg_fn[0]) { + BITMAP bm; + HBITMAP hBg = (HBITMAP)CallService(MS_IMG_LOAD, (WPARAM)options.bg_fn, (LPARAM)IMGL_WCHAR); + if(hBg) { + HDC hdcMem = CreateCompatibleDC(hdc);
+ HBITMAP hbmOld = (HBITMAP)SelectObject(hdcMem, hBg);
+
+ GetObject(hBg, sizeof(bm), &bm);
+
+ if(options.stretch_bg_img) {
+ StretchBlt(hdc, pwd->sb_width, 0, r.right, r.bottom, hdcMem, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY);
+ } else {
+ BitBlt(hdc, pwd->sb_width, 0, r.right, r.bottom, hdcMem, 0, 0, SRCCOPY);
+ }
+
+ SelectObject(hdcMem, hbmOld);
+ DeleteDC(hdcMem); + DeleteObject(hBg); + } else + FillRect(hdc, &r, pwd->bkBrush); + } else + FillRect(hdc, &r, pwd->bkBrush); + // sidebar r_bar = r; r_bar.right = r.left + pwd->sb_width; @@ -667,12 +689,17 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa if(pwd->hContact) ace = (AVATARCACHEENTRY *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)pwd->hContact, 0); else ace = (AVATARCACHEENTRY *)CallService(MS_AV_GETMYAVATAR, 0, (LPARAM)pwd->clcit.proto); if(ace && (ace->dwFlags & AVS_BITMAP_VALID) && !(ace->dwFlags & AVS_HIDEONCLIST)) { - if(ace->bmHeight >= ace->bmWidth) { - pwd->real_av_height = options.av_size; - pwd->real_av_width = (int)(options.av_size * (ace->bmWidth / (double)ace->bmHeight)); + if(options.no_resize_av) { + pwd->real_av_width = ace->bmWidth; + pwd->real_av_height = ace->bmHeight; } else { - pwd->real_av_height = (int)(options.av_size * (ace->bmHeight / (double)ace->bmWidth)); - pwd->real_av_width = options.av_size; + if(ace->bmHeight >= ace->bmWidth) { + pwd->real_av_height = options.av_size; + pwd->real_av_width = (int)(options.av_size * (ace->bmWidth / (double)ace->bmHeight)); + } else { + pwd->real_av_height = (int)(options.av_size * (ace->bmHeight / (double)ace->bmWidth)); + pwd->real_av_width = options.av_size; + } } pwd->av_height = options.av_padding * 2 + pwd->real_av_height; width += pwd->real_av_width + (2 * options.av_padding - options.padding); |