From ab53b72bf7067feb9dede0fd76b5a3cbc13863b9 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 2 Jun 2015 15:55:48 +0000 Subject: - old PNG conversion code (png2dib, dib2png) removed; - m_png.h also removed; - all calls of LoadImage replaced with CallService(MS_IMG_LOAD); - four invalid CloseHandle() calls removed; - massive code cleaning for Popup, HistoryStats & SplashScreen plugins git-svn-id: http://svn.miranda-ng.org/main/trunk@13974 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Popup/src/notifications.cpp | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) (limited to 'plugins/Popup/src/notifications.cpp') diff --git a/plugins/Popup/src/notifications.cpp b/plugins/Popup/src/notifications.cpp index 58d0461124..b5a9740f46 100644 --- a/plugins/Popup/src/notifications.cpp +++ b/plugins/Popup/src/notifications.cpp @@ -27,13 +27,11 @@ HANDLE g_hntfError, g_hntfWarning, g_hntfNotification; #define PopupNotificationData_SIGNATURE 0x11BEDA1A - int TreeDataSortFunc(const POPUPTREEDATA *p1, const POPUPTREEDATA *p2) { if (int cmp = mir_tstrcmp(p1->pszTreeRoot, p2->pszTreeRoot)) return cmp; return mir_tstrcmp(p1->pszDescription, p2->pszDescription); - } LIST gTreeData(20, TreeDataSortFunc); @@ -229,12 +227,8 @@ HANDLE FindTreeData(LPTSTR group, LPTSTR name, BYTE typ) { for (int i = 0; i < gTreeData.getCount(); i++) { POPUPTREEDATA *p = gTreeData[i]; - if (p->typ == typ && - (!group || (mir_tstrcmp(p->pszTreeRoot, group) == 0)) && - (!name || (mir_tstrcmp(p->pszDescription, name) == 0))) - { + if (p->typ == typ && (!group || (mir_tstrcmp(p->pszTreeRoot, group) == 0)) && (!name || (mir_tstrcmp(p->pszDescription, name) == 0))) return p; - } } return NULL; } @@ -251,14 +245,14 @@ void FillNotificationData(POPUPDATA2 *ppd, DWORD *disableWhen) ppd->iSeconds = ptd->timeoutValue; *disableWhen = ptd->enabled ? ptd->disableWhen : 0xFFFFFFFF; - LOGFONTA lf; // dummy to make FS happy (use LOGFONTA coz we use MS_FONT_GET) - FontID fontid = { 0 }; // use ansi version of fontID coz POPUPNOTIFICATION use char + LOGFONTA lf; // dummy to make FS happy (use LOGFONTA coz we use MS_FONT_GET) + FontID fontid = { 0 }; // use ansi version of fontID coz POPUPNOTIFICATION use char fontid.cbSize = sizeof(fontid); mir_snprintf(fontid.group, SIZEOF(fontid.group), PU_FNT_AND_COLOR"/%s", ptd->notification.lpzGroup); mir_snprintf(fontid.name, SIZEOF(fontid.name), "%s (colors only)", ptd->notification.lpzName); ppd->colorText = (COLORREF)CallService(MS_FONT_GET, (WPARAM)&fontid, (LPARAM)&lf); - ColourID colourid = { 0 }; // use ansi version of ColourID coz POPUPNOTIFICATION use char + ColourID colourid = { 0 }; // use ansi version of ColourID coz POPUPNOTIFICATION use char colourid.cbSize = sizeof(colourid); mir_snprintf(colourid.group, SIZEOF(colourid.group), PU_FNT_AND_COLOR"/%s", ptd->notification.lpzGroup); mir_snprintf(colourid.name, SIZEOF(colourid.name), "%s (colors only)", ptd->notification.lpzName); @@ -274,8 +268,7 @@ bool IsValidNotification(HANDLE hNotification) if (!hNotification) return false; bool res = false; - __try - { + __try { if (((POPUPTREEDATA *)hNotification)->signature == PopupNotificationData_SIGNATURE) res = true; } @@ -293,8 +286,7 @@ bool PerformAction(HANDLE hNotification, HWND hwnd, UINT message, WPARAM wparam, POPUPTREEDATA *ptd = (POPUPTREEDATA *)hNotification; char *lpzAction = NULL; - switch (message) - { + switch (message) { case WM_LBUTTONUP: case WM_COMMAND: lpzAction = ptd->leftAction; @@ -312,14 +304,12 @@ bool PerformAction(HANDLE hNotification, HWND hwnd, UINT message, WPARAM wparam, if (!mir_strcmp(lpzAction, POPUP_ACTION_NOTHING)) return true; - if (!mir_strcmp(lpzAction, POPUP_ACTION_DISMISS)) - { + if (!mir_strcmp(lpzAction, POPUP_ACTION_DISMISS)) { PUDeletePopup(hwnd); return true; } - for (int i = 0; i < ptd->notification.actionCount; ++i) - { + for (int i = 0; i < ptd->notification.actionCount; ++i) { if (!(ptd->notification.lpActions[i].dwFlags&PNAF_CALLBACK)) continue; if (mir_strcmp(ptd->notification.lpActions[i].lpzTitle, lpzAction)) -- cgit v1.2.3