From e2a1d9a9b2cf04583a3e97a9a2305256357cc443 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 30 May 2016 22:05:22 +0000 Subject: if one is inside WM_PAINT handler, he shall draw! git-svn-id: http://svn.miranda-ng.org/main/trunk@16891 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Weather/src/version.h | 2 +- plugins/Weather/src/weather_mwin.cpp | 15 ++++----------- 2 files changed, 5 insertions(+), 12 deletions(-) (limited to 'plugins/Weather') diff --git a/plugins/Weather/src/version.h b/plugins/Weather/src/version.h index 9b91642276..fde5a5471d 100644 --- a/plugins/Weather/src/version.h +++ b/plugins/Weather/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 4 #define __RELEASE_NUM 0 -#define __BUILD_NUM 2 +#define __BUILD_NUM 3 #include diff --git a/plugins/Weather/src/weather_mwin.cpp b/plugins/Weather/src/weather_mwin.cpp index dd4f4f3029..bb57c61fa8 100644 --- a/plugins/Weather/src/weather_mwin.cpp +++ b/plugins/Weather/src/weather_mwin.cpp @@ -136,7 +136,6 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara RECT r, rc; if (GetUpdateRect(hwnd, &r, FALSE)) { - DBVARIANT dbv = { 0 }; PAINTSTRUCT ps; LOGFONT lfnt, lfnt1; COLORREF fntc, fntc1; @@ -167,8 +166,7 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara fntc1 = CallService(MS_FONT_GETT, (WPARAM)&fntid, (LPARAM)&lfnt1); } - if (db_get_ts(data->hContact, WEATHERCONDITION, "WeatherInfo", &dbv)) - break; + ptrT tszInfo(db_get_tsa(data->hContact, WEATHERCONDITION, "WeatherInfo")); GetClientRect(hwnd, &rc); @@ -198,10 +196,10 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara HFONT hfnt = CreateFontIndirect(&lfnt1); HFONT hfntold = (HFONT)SelectObject(hdc, hfnt); - SIZE fontSize; TCHAR *nick = (TCHAR*)pcli->pfnGetContactDisplayName(data->hContact, 0); + SIZE fontSize; GetTextExtentPoint32(hdc, _T("|"), 1, &fontSize); rc.top += 1; @@ -215,19 +213,18 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara SelectObject(hdc, hfntold); DeleteObject(hfnt); - if (dbv.pszVal) { + if (tszInfo) { HFONT hFont = CreateFontIndirect(&lfnt); HFONT hFontOld = (HFONT)SelectObject(hdc, hFont); SetTextColor(hdc, fntc); - DrawText(hdc, dbv.ptszVal, -1, &rc, DT_LEFT | DT_EXPANDTABS); + DrawText(hdc, tszInfo, -1, &rc, DT_LEFT | DT_EXPANDTABS); SelectObject(hdc, hFontOld); DeleteObject(hFont); } EndPaint(hwnd, &ps); IcoLib_ReleaseIcon(hIcon); - db_free(&dbv); } break; } @@ -284,7 +281,6 @@ void UpdateMwinData(MCONTACT hContact) RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); } - INT_PTR Mwin_MenuClicked(WPARAM wParam, LPARAM) { BOOL addwnd = WindowList_Find(hMwinWindowList, wParam) == NULL; @@ -295,7 +291,6 @@ INT_PTR Mwin_MenuClicked(WPARAM wParam, LPARAM) return 0; } - int BuildContactMenu(WPARAM wparam, LPARAM) { int flags = db_get_dw((MCONTACT)wparam, WEATHERPROTONAME, "mwin", 0) ? CMIF_CHECKED : 0; @@ -303,14 +298,12 @@ int BuildContactMenu(WPARAM wparam, LPARAM) return 0; } - int RedrawFrame(WPARAM, LPARAM) { WindowList_Broadcast(hMwinWindowList, WM_REDRAWWIN, 0, 0); return 0; } - void InitMwin(void) { if (!ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) -- cgit v1.2.3