diff options
author | George Hazan <george.hazan@gmail.com> | 2013-06-18 14:12:13 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-06-18 14:12:13 +0000 |
commit | 81337e86426dd4a79836554342bdc2e7e6195769 (patch) | |
tree | 4854edef6130b994f3611eb1a035b5de8b37f5cc /plugins/ModernOpt | |
parent | 4f14e4f86d5855d75c0941f9b8495e5a2e522087 (diff) |
massive extinction of stupid service name's buffers
git-svn-id: http://svn.miranda-ng.org/main/trunk@5010 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/ModernOpt')
-rw-r--r-- | plugins/ModernOpt/src/mopt_selector.cpp | 80 |
1 files changed, 38 insertions, 42 deletions
diff --git a/plugins/ModernOpt/src/mopt_selector.cpp b/plugins/ModernOpt/src/mopt_selector.cpp index 126622113a..73316f82a0 100644 --- a/plugins/ModernOpt/src/mopt_selector.cpp +++ b/plugins/ModernOpt/src/mopt_selector.cpp @@ -27,59 +27,55 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static void sttApplySkin(MODERNOPTOBJECT *obj, TCHAR *fn)
{
- char svc[128];
- mir_snprintf(svc, SIZEOF(svc), "%s%s", obj->lpzThemeModuleName, TS_SKIN_APPLY);
- CallService(svc, NULL, (LPARAM)fn);
+ CallProtoService(obj->lpzThemeModuleName, TS_SKIN_APPLY, NULL, (LPARAM)fn);
}
static TCHAR *sttGetActiveSkin(MODERNOPTOBJECT *obj)
{
- char svc[128];
- mir_snprintf(svc, SIZEOF(svc), "%s%s", obj->lpzThemeModuleName, TS_SKIN_ACTIVE);
- return ServiceExists(svc) ? (TCHAR *)CallService(svc, 0, 0) : 0;
+ return ProtoServiceExists(obj->lpzThemeModuleName, TS_SKIN_ACTIVE) ?
+ (TCHAR*)CallProtoService(obj->lpzThemeModuleName, TS_SKIN_ACTIVE, 0, 0) : 0;
}
static void sttPreviewSkin(MODERNOPTOBJECT *obj, TCHAR *fn, LPDRAWITEMSTRUCT lps)
{
if (!fn) return;
- char svc[128];
- mir_snprintf(svc, SIZEOF(svc), "%s%s", obj->lpzThemeModuleName, TS_SKIN_PREVIEW);
- if (ServiceExists(svc))
- CallService(svc, (WPARAM)lps, (LPARAM)fn);
- else {
- char *afn = mir_t2a(fn);
- char *fnpreview = (char *)mir_alloc(lstrlenA(afn) + 10);
- lstrcpyA(fnpreview, afn);
- lstrcatA(fnpreview, ".png");
- HBITMAP hbmPreview = (HBITMAP)CallService(MS_UTILS_LOADBITMAP, 0, (LPARAM)fnpreview);
- mir_free(afn);
- mir_free(fnpreview);
-
- if (!hbmPreview) return;
-
- BITMAP bmp;
- GetObject(hbmPreview, sizeof(bmp), &bmp);
-
- SIZE szDst = { abs(bmp.bmWidth), abs(bmp.bmHeight) };
- if ((szDst.cx > lps->rcItem.right-lps->rcItem.left) || (szDst.cy > lps->rcItem.bottom-lps->rcItem.top)) {
- float q = min(
- float(lps->rcItem.right-lps->rcItem.left) / szDst.cx,
- float(lps->rcItem.bottom-lps->rcItem.top) / szDst.cy);
- szDst.cx *= q;
- szDst.cy *= q;
- }
- POINT ptDst = {
- (lps->rcItem.left+lps->rcItem.right-szDst.cx) / 2,
- (lps->rcItem.top+lps->rcItem.bottom-szDst.cy) / 2 };
-
- HDC hdc = CreateCompatibleDC(lps->hDC);
- SelectObject(hdc, hbmPreview);
- SetStretchBltMode(hdc, HALFTONE);
- StretchBlt(lps->hDC, ptDst.x, ptDst.y, szDst.cx, szDst.cy, hdc, 0, 0, abs(bmp.bmWidth), abs(bmp.bmHeight), SRCCOPY);
- DeleteDC(hdc);
- DeleteObject(hbmPreview);
+ if ( ProtoServiceExists(obj->lpzThemeModuleName, TS_SKIN_PREVIEW)) {
+ CallProtoService(obj->lpzThemeModuleName, TS_SKIN_PREVIEW, (WPARAM)lps, (LPARAM)fn);
+ return;
+ }
+
+ char *afn = mir_t2a(fn);
+ char *fnpreview = (char *)mir_alloc(lstrlenA(afn) + 10);
+ lstrcpyA(fnpreview, afn);
+ lstrcatA(fnpreview, ".png");
+ HBITMAP hbmPreview = (HBITMAP)CallService(MS_UTILS_LOADBITMAP, 0, (LPARAM)fnpreview);
+ mir_free(afn);
+ mir_free(fnpreview);
+
+ if (!hbmPreview) return;
+
+ BITMAP bmp;
+ GetObject(hbmPreview, sizeof(bmp), &bmp);
+
+ SIZE szDst = { abs(bmp.bmWidth), abs(bmp.bmHeight) };
+ if ((szDst.cx > lps->rcItem.right-lps->rcItem.left) || (szDst.cy > lps->rcItem.bottom-lps->rcItem.top)) {
+ float q = min(
+ float(lps->rcItem.right-lps->rcItem.left) / szDst.cx,
+ float(lps->rcItem.bottom-lps->rcItem.top) / szDst.cy);
+ szDst.cx *= q;
+ szDst.cy *= q;
}
+ POINT ptDst = {
+ (lps->rcItem.left+lps->rcItem.right-szDst.cx) / 2,
+ (lps->rcItem.top+lps->rcItem.bottom-szDst.cy) / 2 };
+
+ HDC hdc = CreateCompatibleDC(lps->hDC);
+ SelectObject(hdc, hbmPreview);
+ SetStretchBltMode(hdc, HALFTONE);
+ StretchBlt(lps->hDC, ptDst.x, ptDst.y, szDst.cx, szDst.cy, hdc, 0, 0, abs(bmp.bmWidth), abs(bmp.bmHeight), SRCCOPY);
+ DeleteDC(hdc);
+ DeleteObject(hbmPreview);
}
struct TSkinListItem
|