From 402cf5c0416f7de3bcd9f40d3876d635acc280fc Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 9 Jul 2015 18:50:05 +0000 Subject: finally, normal icolib icons in Popup+ git-svn-id: http://svn.miranda-ng.org/main/trunk@14521 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Popup/src/actions.cpp | 25 +++++------- plugins/Popup/src/headers.h | 8 ++-- plugins/Popup/src/history.cpp | 6 ++- plugins/Popup/src/icons.cpp | 81 ++++++++++++++++++++++++------------- plugins/Popup/src/icons.h | 37 ++--------------- plugins/Popup/src/main.cpp | 18 ++++----- plugins/Popup/src/notifications.cpp | 22 +++------- plugins/Popup/src/notifications.h | 1 + plugins/Popup/src/opt_adv.cpp | 2 +- plugins/Popup/src/opt_class.cpp | 4 +- plugins/Popup/src/opt_contacts.cpp | 16 ++++---- plugins/Popup/src/opt_gen.cpp | 6 +-- plugins/Popup/src/opt_skins.cpp | 4 +- plugins/Popup/src/popup_wnd2.cpp | 18 ++++----- plugins/Popup/src/services.cpp | 6 +-- plugins/Popup/src/srmm_menu.cpp | 8 ++-- plugins/Popup/src/version.h | 2 +- 17 files changed, 120 insertions(+), 144 deletions(-) (limited to 'plugins/Popup/src') diff --git a/plugins/Popup/src/actions.cpp b/plugins/Popup/src/actions.cpp index b897255edc..f6a6b419d9 100644 --- a/plugins/Popup/src/actions.cpp +++ b/plugins/Popup/src/actions.cpp @@ -35,21 +35,14 @@ void LoadActions() { POPUPACTION actions[] = { - { sizeof(POPUPACTION), IcoLib_GetIcon(ICO_ACT_REPLY, 0), LPGEN("General")"/"LPGEN("Quick reply"), 0 }, - { sizeof(POPUPACTION), IcoLib_GetIcon(ICO_ACT_MESS, 0), LPGEN("General")"/"LPGEN("Send message"), 0 }, - { sizeof(POPUPACTION), IcoLib_GetIcon(ICO_ACT_INFO, 0), LPGEN("General")"/"LPGEN("User details"), 0 }, - { sizeof(POPUPACTION), IcoLib_GetIcon(ICO_ACT_MENU, 0), LPGEN("General")"/"LPGEN("Contact menu"), 0 }, - { sizeof(POPUPACTION), IcoLib_GetIcon(ICO_ACT_ADD, 0), LPGEN("General")"/"LPGEN("Add permanently"), 0 }, - { sizeof(POPUPACTION), IcoLib_GetIcon(ICO_ACT_PIN, 0), LPGEN("General")"/"LPGEN("Pin popup"), 0 }, - { sizeof(POPUPACTION), IcoLib_GetIcon(ICO_ACT_CLOSE, 0), LPGEN("General")"/"LPGEN("Dismiss popup"), 0 }, - { sizeof(POPUPACTION), IcoLib_GetIcon(ICO_ACT_COPY, 0), LPGEN("General")"/"LPGEN("Copy to clipboard"), 0 }, - - // remove popup action -#if defined(_DEBUG) - { sizeof(POPUPACTION), IcoLib_GetIcon(ICO_POPUP_ON, 0), "Popup Plus/Test action", PAF_ENABLED }, - { sizeof(POPUPACTION), IcoLib_GetIcon(ICO_ACT_CLOSE, 0), "Popup Plus/Second test action", 0 }, - { sizeof(POPUPACTION), Skin_LoadIcon(SKINICON_OTHER_MIRANDA), "Popup Plus/One more action", PAF_ENABLED }, -#endif + { sizeof(POPUPACTION), LoadIconEx(IDI_ACT_REPLY), LPGEN("General")"/"LPGEN("Quick reply"), 0 }, + { sizeof(POPUPACTION), LoadIconEx(IDI_ACT_MESSAGE), LPGEN("General")"/"LPGEN("Send message"), 0 }, + { sizeof(POPUPACTION), LoadIconEx(IDI_ACT_INFO), LPGEN("General")"/"LPGEN("User details"), 0 }, + { sizeof(POPUPACTION), LoadIconEx(IDI_ACT_MENU), LPGEN("General")"/"LPGEN("Contact menu"), 0 }, + { sizeof(POPUPACTION), LoadIconEx(IDI_ACT_ADD), LPGEN("General")"/"LPGEN("Add permanently"), 0 }, + { sizeof(POPUPACTION), LoadIconEx(IDI_ACT_PIN), LPGEN("General")"/"LPGEN("Pin popup"), 0 }, + { sizeof(POPUPACTION), LoadIconEx(IDI_ACT_CLOSE), LPGEN("General")"/"LPGEN("Dismiss popup"), 0 }, + { sizeof(POPUPACTION), LoadIconEx(IDI_ACT_COPY), LPGEN("General")"/"LPGEN("Copy to clipboard"), 0 }, }; for (int i = 0; i < _countof(actions); ++i) @@ -189,7 +182,7 @@ INT_PTR CALLBACK DlgProcPopupActions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM TranslateDialogDefault(hwnd); - SendDlgItemMessage(hwnd, IDC_ICO_INFO, STM_SETICON, (WPARAM)IcoLib_GetIcon(ICO_MISC_NOTIFY, 0), 0); + SendDlgItemMessage(hwnd, IDC_ICO_INFO, STM_SETICON, (WPARAM)LoadIconEx(IDI_MB_INFO), 0); CheckDlgButton(hwnd, IDC_CHK_ENABLEACTIONS, PopupOptions.actions & ACT_ENABLE ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwnd, IDC_CHK_IMCONTACTSONLY, PopupOptions.actions & ACT_DEF_IMONLY ? BST_CHECKED : BST_UNCHECKED); diff --git a/plugins/Popup/src/headers.h b/plugins/Popup/src/headers.h index 4db076f80a..db8bbf6bee 100644 --- a/plugins/Popup/src/headers.h +++ b/plugins/Popup/src/headers.h @@ -128,10 +128,10 @@ http://miranda-ng.org/distr/ #include "avatars_gif.h" #include "popup_gdiplus.h" -#define PU_MODULCLASS "PopupCLASS" //temp DB modul for this plugin -#define MODULNAME "Popup" -#define MODULNAME_LONG "Popup Plus" -#define MODULNAME_PLU "Popups" +#define PU_MODULCLASS "PopupCLASS" // temp DB modul for this plugin +#define MODULNAME "Popup" +#define MODULNAME_LONG "Popup Plus" +#define MODULNAME_PLU "Popups" INT_PTR svcEnableDisableMenuCommand(WPARAM, LPARAM); diff --git a/plugins/Popup/src/history.cpp b/plugins/Popup/src/history.cpp index b2c2d0473b..3749dc7906 100644 --- a/plugins/Popup/src/history.cpp +++ b/plugins/Popup/src/history.cpp @@ -129,8 +129,9 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM, LPARAM lPara HWND hwndList = GetDlgItem(hwnd, IDC_POPUP_LIST); for (int i = 0; i < arPopupHistory.getCount(); ++i) ListBox_SetItemData(hwndList, ListBox_AddString(hwndList, _T("")), 0); - SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIcon(ICO_HISTORY, 0)); - SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIcon(ICO_HISTORY, 1)); + + SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)LoadIconEx(IDI_HISTORY, false)); + SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)LoadIconEx(IDI_HISTORY, true)); if (gbHppInstalled && PopupOptions.UseHppHistoryLog) { logType = LOG_HPP; @@ -413,6 +414,7 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM, LPARAM lPara ieWindow.hwnd = hwndLog; CallService(MS_HPP_EG_WINDOW, 0, (LPARAM)&ieWindow); } + Window_FreeIcon_IcoLib(hwnd); } return FALSE; // DefWindowProc(hwnd, msg, wParam, lParam); } diff --git a/plugins/Popup/src/icons.cpp b/plugins/Popup/src/icons.cpp index de297c46c8..c23d09e8cb 100644 --- a/plugins/Popup/src/icons.cpp +++ b/plugins/Popup/src/icons.cpp @@ -26,43 +26,66 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static IconItem iconList[] = { // toolbar - { LPGEN("Popups are enabled"), ICO_TB_POPUP_ON, IDI_POPUP }, - { LPGEN("Popups are disabled"), ICO_TB_POPUP_OFF, IDI_NOPOPUP }, + { LPGEN("Popups are enabled"), "TBButton_ToogleUp", IDI_POPUP }, + { LPGEN("Popups are disabled"), "TBButton_ToogleDOWN", IDI_NOPOPUP }, // common popup - { LPGEN("Popups are enabled"), ICO_POPUP_ON, IDI_POPUP }, - { LPGEN("Popups are disabled"), ICO_POPUP_OFF, IDI_NOPOPUP }, - { LPGEN("With \"favorite\" overlay"), ICO_FAV, IDI_PU_FAVOURITE }, - { LPGEN("With \"fullscreen\" overlay"), ICO_FULLSCREEN, IDI_PU_FULLSCREEN }, - { LPGEN("Popup History"), ICO_HISTORY, IDI_HISTORY }, + { LPGEN("Popups are enabled"), "enabled", IDI_POPUP }, + { LPGEN("Popups are disabled"), "disabled", IDI_NOPOPUP }, + { LPGEN("With \"favorite\" overlay"), "favourite", IDI_PU_FAVOURITE }, + { LPGEN("With \"fullscreen\" overlay"), "fullscreen", IDI_PU_FULLSCREEN }, + { LPGEN("Popup History"), "history", IDI_HISTORY }, + + // notifications + { LPGEN("Information"), "info", IDI_MB_INFO }, + { LPGEN("Warning"), "warning", IDI_MB_WARN }, + { LPGEN("Error"), "error", IDI_MB_STOP }, // option - { LPGEN("Refresh skin list"), ICO_OPT_RELOAD, IDI_RELOAD }, - { LPGEN("Popup placement"), ICO_OPT_RESIZE, IDI_RESIZE }, - { LPGEN("OK"), ICO_OPT_OK, IDI_ACT_OK }, - { LPGEN("Cancel"), ICO_OPT_CANCEL, IDI_ACT_CLOSE }, - { LPGEN("Popup group"), ICO_OPT_GROUP, IDI_OPT_GROUP }, - { LPGEN("Show default"), ICO_OPT_DEF, IDI_ACT_OK }, - { LPGEN("Favorite contact"), ICO_OPT_FAV, IDI_OPT_FAVORITE }, - { LPGEN("Show in fullscreen"), ICO_OPT_FULLSCREEN, IDI_OPT_FULLSCREEN }, - { LPGEN("Blocked contact"), ICO_OPT_BLOCK, IDI_OPT_BLOCK }, + { LPGEN("Refresh skin list"), "opt_reload", IDI_RELOAD }, + { LPGEN("Popup placement"), "opt_resize", IDI_RESIZE }, + { LPGEN("OK"), "opt_ok", IDI_ACT_OK }, + { LPGEN("Cancel"), "opt_cancel", IDI_ACT_CLOSE }, + { LPGEN("Popup group"), "opt_group", IDI_OPT_GROUP }, + { LPGEN("Show default"), "opt_default", IDI_ACT_OK }, + { LPGEN("Favorite contact"), "opt_favorite", IDI_OPT_FAVORITE }, + { LPGEN("Show in fullscreen"), "opt_fullscreen", IDI_OPT_FULLSCREEN }, + { LPGEN("Blocked contact"), "opt_block", IDI_OPT_BLOCK }, // action - { LPGEN("Quick reply"), ICO_ACT_REPLY, IDI_ACT_REPLY }, - { LPGEN("Pin popup"), ICO_ACT_PIN, IDI_ACT_PIN }, - { LPGEN("Pinned popup"), ICO_ACT_PINNED, IDI_ACT_PINNED }, - { LPGEN("Send message"), ICO_ACT_MESS, IDI_ACT_MESSAGE }, - { LPGEN("User details"), ICO_ACT_INFO, IDI_ACT_INFO }, - { LPGEN("Contact menu"), ICO_ACT_MENU, IDI_ACT_MENU }, - { LPGEN("Add contact permanently"), ICO_ACT_ADD, IDI_ACT_ADD }, - { LPGEN("Dismiss popup"), ICO_ACT_CLOSE, IDI_ACT_CLOSE }, - { LPGEN("Copy to clipboard"), ICO_ACT_COPY, IDI_ACT_COPY } + { LPGEN("Quick reply"), "act_reply", IDI_ACT_REPLY }, + { LPGEN("Pin popup"), "act_pin", IDI_ACT_PIN }, + { LPGEN("Pinned popup"), "act_pinned", IDI_ACT_PINNED }, + { LPGEN("Send message"), "act_message", IDI_ACT_MESSAGE }, + { LPGEN("User details"), "act_info", IDI_ACT_INFO }, + { LPGEN("Contact menu"), "act_menu", IDI_ACT_MENU }, + { LPGEN("Add contact permanently"), "act_add", IDI_ACT_ADD }, + { LPGEN("Dismiss popup"), "act_close", IDI_ACT_CLOSE }, + { LPGEN("Copy to clipboard"), "act_copy", IDI_ACT_COPY } }; void InitIcons() { - Icon_Register(hInst, SECT_TOLBAR, iconList, 2); - Icon_Register(hInst, SECT_POPUP, iconList + 2, 5); - Icon_Register(hInst, SECT_POPUP SECT_POPUP_OPT, iconList + 7, 9); - Icon_Register(hInst, SECT_POPUP SECT_POPUP_ACT, iconList + 16, 9); + Icon_Register(hInst, SECT_TOLBAR, iconList, 2, MODULNAME); + Icon_Register(hInst, SECT_POPUP, iconList + 2, 8, MODULNAME); + Icon_Register(hInst, SECT_POPUP SECT_POPUP_OPT, iconList + 10, 9, MODULNAME); + Icon_Register(hInst, SECT_POPUP SECT_POPUP_ACT, iconList + 19, 9, MODULNAME); +} + +HICON LoadIconEx(int iconId, bool big) +{ + for (int i = 0; i < _countof(iconList); i++) + if (iconList[i].defIconID == iconId) + return IcoLib_GetIconByHandle(iconList[i].hIcolib, big); + + return NULL; +} + +HANDLE GetIconHandle(int iconId) +{ + for (int i = 0; i < _countof(iconList); i++) + if (iconList[i].defIconID == iconId) + return iconList[i].hIcolib; + + return NULL; } diff --git a/plugins/Popup/src/icons.h b/plugins/Popup/src/icons.h index 40e502686d..edcafaa1c6 100644 --- a/plugins/Popup/src/icons.h +++ b/plugins/Popup/src/icons.h @@ -31,39 +31,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define SECT_POPUP_OPT "/Options" #define SECT_POPUP_MISC "/Misc" -#define ICO_TB_POPUP_ON "TBButton_popup_ToogleUp" -#define ICO_TB_POPUP_OFF "TBButton_popup_ToogleDOWN" -#define ICO_POPUP_ON MODULNAME"_enabled" -#define ICO_POPUP_OFF MODULNAME"_disabled" -#define ICO_FAV MODULNAME"_favourite" -#define ICO_FULLSCREEN MODULNAME"_fullscreen" -#define ICO_HISTORY MODULNAME"_history" - -#define ICO_MISC_NOTIFY MODULNAME"_Misc_Notification" -#define ICO_MISC_WARNING MODULNAME"_Misc_Warning" -#define ICO_MISC_ERROR MODULNAME"_Misc_Error" - -#define ICO_ACT_MESS MODULNAME"_act_message" -#define ICO_ACT_INFO MODULNAME"_act_info" -#define ICO_ACT_MENU MODULNAME"_act_menu" -#define ICO_ACT_ADD MODULNAME"_act_add" -#define ICO_ACT_REPLY MODULNAME"_act_reply" -#define ICO_ACT_PIN MODULNAME"_act_pin" -#define ICO_ACT_PINNED MODULNAME"_act_pinned" -#define ICO_ACT_CLOSE MODULNAME"_act_close" -#define ICO_ACT_COPY MODULNAME"_act_copy" - -#define ICO_OPT_RELOAD MODULNAME"_opt_reload" -#define ICO_OPT_RESIZE MODULNAME"_opt_resize" -#define ICO_OPT_GROUP MODULNAME"_opt_group" -#define ICO_OPT_OK MODULNAME"_opt_ok" -#define ICO_OPT_CANCEL MODULNAME"_opt_cancel" - -#define ICO_OPT_DEF MODULNAME"_opt_default" -#define ICO_OPT_FAV MODULNAME"_opt_favorite" -#define ICO_OPT_FULLSCREEN MODULNAME"_opt_fullscreen" -#define ICO_OPT_BLOCK MODULNAME"_opt_block" - -void InitIcons(); +void InitIcons(); +HICON LoadIconEx(int iconId, bool big = false); +HANDLE GetIconHandle(int iconid); #endif // __icons_h__ diff --git a/plugins/Popup/src/main.cpp b/plugins/Popup/src/main.cpp index 287668c2b1..9ed1bc2215 100644 --- a/plugins/Popup/src/main.cpp +++ b/plugins/Popup/src/main.cpp @@ -114,16 +114,16 @@ static int IconsChanged(WPARAM, LPARAM) HICON hIcon; if (PopupOptions.ModuleIsEnabled == TRUE) { // The module is enabled. // The action to do is "disable popups" (show disabled) and we must write "enable popup" in the new item. - hIcon = IcoLib_GetIcon(ICO_POPUP_ON, 0); + hIcon = LoadIconEx(IDI_POPUP, 0); } else { // The module is disabled. // The action to do is enable popups (show enabled), then write "disable popup" in the new item. - hIcon = IcoLib_GetIcon(ICO_POPUP_OFF, 0); + hIcon = LoadIconEx(IDI_NOPOPUP, 0); } Menu_ModifyItem(hMenuItem, NULL, hIcon); Menu_ModifyItem(hMenuRoot, NULL, hIcon); - Menu_ModifyItem(hMenuItemHistory, NULL, IcoLib_GetIcon(ICO_HISTORY, 0)); + Menu_ModifyItem(hMenuItemHistory, NULL, LoadIconEx(IDI_HISTORY, 0)); return 0; } @@ -136,8 +136,8 @@ static int TTBLoaded(WPARAM, LPARAM) if (PopupOptions.ModuleIsEnabled) ttb.dwFlags |= TTBBF_PUSHED; ttb.name = LPGEN("Toggle Popups"); - ttb.hIconHandleUp = IcoLib_GetIconHandle(ICO_TB_POPUP_OFF); - ttb.hIconHandleDn = IcoLib_GetIconHandle(ICO_TB_POPUP_ON); + ttb.hIconHandleUp = GetIconHandle(IDI_NOPOPUP); + ttb.hIconHandleDn = GetIconHandle(IDI_POPUP); ttb.pszTooltipUp = LPGEN("Enable Popups"); ttb.pszTooltipDn = LPGEN("Disable Popups"); hTTButton = TopToolbar_AddButton(&ttb); @@ -153,14 +153,14 @@ INT_PTR svcEnableDisableMenuCommand(WPARAM, LPARAM) // The action to do is "disable popups" (show disabled) and we must write "enable popup" in the new item. PopupOptions.ModuleIsEnabled = FALSE; db_set_b(NULL, "Popup", "ModuleIsEnabled", FALSE); - Menu_ModifyItem(hMenuItem, LPGENT("Enable Popups"), hIcon = IcoLib_GetIcon(ICO_POPUP_OFF, 0)); + Menu_ModifyItem(hMenuItem, LPGENT("Enable Popups"), hIcon = LoadIconEx(IDI_NOPOPUP)); } else { // The module is disabled. // The action to do is enable popups (show enabled), then write "disable popup" in the new item. PopupOptions.ModuleIsEnabled = TRUE; db_set_b(NULL, "Popup", "ModuleIsEnabled", TRUE); - Menu_ModifyItem(hMenuItem, LPGENT("Disable Popups"), hIcon = IcoLib_GetIcon(ICO_POPUP_ON, 0)); + Menu_ModifyItem(hMenuItem, LPGENT("Disable Popups"), hIcon = LoadIconEx(IDI_POPUP)); } Menu_ModifyItem(hMenuRoot, NULL, hIcon); @@ -185,7 +185,7 @@ void InitMenuItems(void) // Build main menu mi.position = -1000000000 /*1000001*/; mi.name.t = LPGENT(MODULNAME_PLU); - mi.hIcolibItem = IcoLib_GetIcon(PopupOptions.ModuleIsEnabled ? ICO_POPUP_ON : ICO_POPUP_OFF, 0); + mi.hIcolibItem = LoadIconEx(PopupOptions.ModuleIsEnabled ? IDI_POPUP : IDI_NOPOPUP); hMenuRoot = Menu_AddMainMenuItem(&mi); // Add item to main menu @@ -200,7 +200,7 @@ void InitMenuItems(void) CreateServiceFunction(mi.pszService, svcShowHistory); mi.position = 1000000000; mi.name.t = LPGENT("Popup History"); - mi.hIcolibItem = IcoLib_GetIcon(ICO_HISTORY, 0); + mi.hIcolibItem = LoadIconEx(IDI_HISTORY, 0); hMenuItemHistory = Menu_AddMainMenuItem(&mi); } diff --git a/plugins/Popup/src/notifications.cpp b/plugins/Popup/src/notifications.cpp index b42c5ac902..c24f0a2765 100644 --- a/plugins/Popup/src/notifications.cpp +++ b/plugins/Popup/src/notifications.cpp @@ -46,7 +46,7 @@ void LoadNotifications() mir_strncpy(notification.lpzGroup, "Misc", sizeof(notification.lpzName)); mir_strncpy(notification.lpzName, "Warning", sizeof(notification.lpzName)); - notification.lchIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_MB_WARN), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR | LR_SHARED); + notification.lchIcoLib = GetIconHandle(IDI_MB_WARN); notification.colorBack = RGB(210, 210, 150); notification.colorText = RGB(0, 0, 0); notification.iSeconds = 10; @@ -54,7 +54,7 @@ void LoadNotifications() mir_strncpy(notification.lpzGroup, "Misc", sizeof(notification.lpzName)); mir_strncpy(notification.lpzName, "Notification", sizeof(notification.lpzName)); - notification.lchIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_MB_INFO), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR | LR_SHARED); + notification.lchIcoLib = GetIconHandle(IDI_MB_INFO); notification.colorBack = RGB(230, 230, 230); notification.colorText = RGB(0, 0, 0); notification.iSeconds = 7; @@ -62,7 +62,7 @@ void LoadNotifications() mir_strncpy(notification.lpzGroup, "Misc", sizeof(notification.lpzName)); mir_strncpy(notification.lpzName, "Error", sizeof(notification.lpzName)); - notification.lchIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_MB_STOP), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR | LR_SHARED); + notification.lchIcoLib = GetIconHandle(IDI_MB_STOP); notification.colorBack = RGB(191, 0, 0); notification.colorText = RGB(255, 245, 225); notification.iSeconds = -1; @@ -176,6 +176,7 @@ HANDLE RegisterNotification(POPUPNOTIFICATION *notification) ptd->pszTreeRoot = mir_a2t(notification->lpzGroup); ptd->pszDescription = mir_a2t(notification->lpzName); ptd->notification = *notification; + ptd->hIcoLib = notification->lchIcoLib; if (!ptd->notification.lpzLAction) ptd->notification.lpzLAction = POPUP_ACTION_NOTHING; if (!ptd->notification.lpzRAction) ptd->notification.lpzRAction = POPUP_ACTION_DISMISS; LoadNotificationSettings(ptd, "PopupNotifications"); @@ -207,17 +208,6 @@ HANDLE RegisterNotification(POPUPNOTIFICATION *notification) colourid.defcolour = ptd->notification.colorBack; ColourRegister(&colourid); - char section[MAXMODULELABELLENGTH], setting[MAXMODULELABELLENGTH]; - mir_snprintf(section, _countof(section), "Popups/%s", notification->lpzGroup); - mir_snprintf(setting, MODULNAME"_%s_%s", notification->lpzGroup, notification->lpzName); - - SKINICONDESC sid = { 0 }; - sid.section.a = section; - sid.pszName = setting; - sid.description.a = notification->lpzName; - sid.hDefaultIcon = notification->lchIcon; - IcoLib_AddIcon(&sid); - gTreeData.insert(ptd); return (HANDLE)ptd; } @@ -257,9 +247,7 @@ void FillNotificationData(POPUPDATA2 *ppd, DWORD *disableWhen) mir_snprintf(colourid.name, _countof(colourid.name), "%s (colors only)", ptd->notification.lpzName); ppd->colorBack = (COLORREF)CallService(MS_COLOUR_GET, (WPARAM)&colourid, 0); - char setting[MAXMODULELABELLENGTH]; - mir_snprintf(setting, MODULNAME"_%s_%s", ptd->notification.lpzGroup, ptd->notification.lpzName); - ppd->lchIcon = IcoLib_GetIcon(setting); + ppd->lchIcon = IcoLib_GetIconByHandle(ptd->hIcoLib); } bool IsValidNotification(HANDLE hNotification) diff --git a/plugins/Popup/src/notifications.h b/plugins/Popup/src/notifications.h index 4c8547d2f9..7155fb0239 100644 --- a/plugins/Popup/src/notifications.h +++ b/plugins/Popup/src/notifications.h @@ -40,6 +40,7 @@ struct POPUPTREEDATA int timeoutValue; char leftAction[MAXMODULELABELLENGTH]; char rightAction[MAXMODULELABELLENGTH]; + HANDLE hIcoLib; COLORREF colorBack; //really needed ?? COLORREF colorText; //really needed ?? }; diff --git a/plugins/Popup/src/opt_adv.cpp b/plugins/Popup/src/opt_adv.cpp index 1557a5ce16..17bf55f118 100644 --- a/plugins/Popup/src/opt_adv.cpp +++ b/plugins/Popup/src/opt_adv.cpp @@ -112,7 +112,7 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM HWND hCtrl = GetDlgItem(hwnd, IDC_SHOWHISTORY); SendMessage(hCtrl, BUTTONSETASFLATBTN, TRUE, 0); SendMessage(hCtrl, BUTTONADDTOOLTIP, (WPARAM)Translate("Popup History"), 0); - SendMessage(hCtrl, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_HISTORY, 0)); + SendMessage(hCtrl, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx(IDI_HISTORY)); EnableWindow(GetDlgItem(hwnd, IDC_HISTORY_STATIC1), PopupOptions.EnableHistory); EnableWindow(GetDlgItem(hwnd, IDC_HISTORYSIZE), PopupOptions.EnableHistory); diff --git a/plugins/Popup/src/opt_class.cpp b/plugins/Popup/src/opt_class.cpp index 6af58caeb9..44b72ea061 100644 --- a/plugins/Popup/src/opt_class.cpp +++ b/plugins/Popup/src/opt_class.cpp @@ -183,7 +183,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l TreeView_DeleteAllItems(hwndTree); // Treeview create image list HIMAGELIST hImgLst = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR | ILC_COLOR32 | ILC_MASK, 5, num_classes + 1); - ImageList_ReplaceIcon(hImgLst, -1, IcoLib_GetIcon(ICO_OPT_GROUP, 0)); + ImageList_ReplaceIcon(hImgLst, -1, LoadIconEx(IDI_OPT_GROUP)); TreeView_SetImageList(hwndTree, hImgLst, TVSIL_NORMAL); for (i = 0; i < gTreeData.getCount(); ++i) { @@ -223,7 +223,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l (WPARAM)Translate(statusButtons[i].title), 0); } // info icon - SendDlgItemMessage(hwnd, IDC_ICO_INFO, STM_SETICON, (WPARAM)IcoLib_GetIcon(ICO_MISC_NOTIFY, 0), 0); + SendDlgItemMessage(hwnd, IDC_ICO_INFO, STM_SETICON, (WPARAM)LoadIconEx(IDI_MB_INFO), 0); // more button EnableWindow(GetDlgItem(hwnd, IDC_MORE), FALSE); // preview button diff --git a/plugins/Popup/src/opt_contacts.cpp b/plugins/Popup/src/opt_contacts.cpp index 3184928d05..51d4bb8f02 100644 --- a/plugins/Popup/src/opt_contacts.cpp +++ b/plugins/Popup/src/opt_contacts.cpp @@ -46,17 +46,17 @@ INT_PTR CALLBACK DlgProcContactOpts(HWND hwnd, UINT msg, WPARAM, LPARAM lParam) case WM_INITDIALOG: TranslateDialogDefault(hwnd); - SendDlgItemMessage(hwnd, IDC_ICO_AUTO, STM_SETICON, (WPARAM)IcoLib_GetIcon(ICO_OPT_DEF, 0), 0); - SendDlgItemMessage(hwnd, IDC_ICO_FAVORITE, STM_SETICON, (WPARAM)IcoLib_GetIcon(ICO_OPT_FAV, 0), 0); - SendDlgItemMessage(hwnd, IDC_ICO_FULLSCREEN, STM_SETICON, (WPARAM)IcoLib_GetIcon(ICO_OPT_FULLSCREEN, 0), 0); - SendDlgItemMessage(hwnd, IDC_ICO_BLOCK, STM_SETICON, (WPARAM)IcoLib_GetIcon(ICO_OPT_BLOCK, 0), 0); + SendDlgItemMessage(hwnd, IDC_ICO_AUTO, STM_SETICON, (WPARAM)LoadIconEx(IDI_ACT_OK), 0); + SendDlgItemMessage(hwnd, IDC_ICO_FAVORITE, STM_SETICON, (WPARAM)LoadIconEx(IDI_OPT_FAVORITE), 0); + SendDlgItemMessage(hwnd, IDC_ICO_FULLSCREEN, STM_SETICON, (WPARAM)LoadIconEx(IDI_OPT_FULLSCREEN), 0); + SendDlgItemMessage(hwnd, IDC_ICO_BLOCK, STM_SETICON, (WPARAM)LoadIconEx(IDI_OPT_BLOCK), 0); { HIMAGELIST hIml = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 5, 5); ImageList_AddIcon(hIml, Skin_LoadIcon(SKINICON_OTHER_SMALLDOT)); - ImageList_AddIcon(hIml, IcoLib_GetIcon(ICO_OPT_DEF, 0)); - ImageList_AddIcon(hIml, IcoLib_GetIcon(ICO_OPT_FAV, 0)); - ImageList_AddIcon(hIml, IcoLib_GetIcon(ICO_OPT_FULLSCREEN, 0)); - ImageList_AddIcon(hIml, IcoLib_GetIcon(ICO_OPT_BLOCK, 0)); + ImageList_AddIcon(hIml, LoadIconEx(IDI_ACT_OK)); + ImageList_AddIcon(hIml, LoadIconEx(IDI_OPT_FAVORITE)); + ImageList_AddIcon(hIml, LoadIconEx(IDI_OPT_FULLSCREEN)); + ImageList_AddIcon(hIml, LoadIconEx(IDI_OPT_BLOCK)); SendDlgItemMessage(hwnd, IDC_LIST, CLM_SETEXTRAIMAGELIST, 0, (LPARAM)hIml); SendDlgItemMessage(hwnd, IDC_LIST, CLM_SETEXTRACOLUMNS, 4 /*_countof(sttIcons)*/, 0); sttResetListOptions(GetDlgItem(hwnd, IDC_LIST)); diff --git a/plugins/Popup/src/opt_gen.cpp b/plugins/Popup/src/opt_gen.cpp index d3e3c436bb..8ad16037b3 100644 --- a/plugins/Popup/src/opt_gen.cpp +++ b/plugins/Popup/src/opt_gen.cpp @@ -182,7 +182,7 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM HWND hCtrl = GetDlgItem(hwnd, IDC_CUSTOMPOS); SendMessage(hCtrl, BUTTONSETASFLATBTN, TRUE, 0); SendMessage(hCtrl, BUTTONADDTOOLTIP, (WPARAM)_T("Popup area"), BATF_TCHAR); - SendMessage(hCtrl, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_OPT_RESIZE, 0)); + SendMessage(hCtrl, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx(IDI_RESIZE)); } // Spreading combobox { @@ -627,11 +627,11 @@ INT_PTR CALLBACK PositionBoxDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA SendDlgItemMessage(hwndDlg, IDOK, BUTTONSETASFLATBTN, TRUE, 0); SendDlgItemMessage(hwndDlg, IDOK, BUTTONADDTOOLTIP, (WPARAM)_T("OK"), BATF_TCHAR); - SendDlgItemMessage(hwndDlg, IDOK, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_OPT_OK, 0)); + SendDlgItemMessage(hwndDlg, IDOK, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx(IDI_ACT_OK)); SendDlgItemMessage(hwndDlg, IDCANCEL, BUTTONSETASFLATBTN, TRUE, 0); SendDlgItemMessage(hwndDlg, IDCANCEL, BUTTONADDTOOLTIP, (WPARAM)_T("Cancel"), BATF_TCHAR); - SendDlgItemMessage(hwndDlg, IDCANCEL, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_OPT_CANCEL, 0)); + SendDlgItemMessage(hwndDlg, IDCANCEL, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx(IDI_ACT_CLOSE)); SetDlgItemInt(hwndDlg, IDC_TXT_TOP, PopupOptions.gapTop, FALSE); SetDlgItemInt(hwndDlg, IDC_TXT_BOTTOM, PopupOptions.gapBottom, FALSE); diff --git a/plugins/Popup/src/opt_skins.cpp b/plugins/Popup/src/opt_skins.cpp index 858ab90075..92b43c4892 100644 --- a/plugins/Popup/src/opt_skins.cpp +++ b/plugins/Popup/src/opt_skins.cpp @@ -361,7 +361,7 @@ INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR // Skin List reload button SendDlgItemMessage(hwndDlg, IDC_BTN_RELOAD, BUTTONSETASFLATBTN, TRUE, 0); - SendDlgItemMessage(hwndDlg, IDC_BTN_RELOAD, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_OPT_RELOAD, 0)); + SendDlgItemMessage(hwndDlg, IDC_BTN_RELOAD, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx(IDI_RELOAD)); SendDlgItemMessage(hwndDlg, IDC_BTN_RELOAD, BUTTONADDTOOLTIP, (WPARAM)Translate("Refresh List"), 0); // Skin Option List @@ -544,7 +544,7 @@ static void BoxPreview_OnPaint(HWND hwnd, HDC mydc, int mode) HFONT hfnt = (HFONT)SelectObject(mydc, fonts.title); GetClientRect(hwnd, &rc); FillRect(mydc, &rc, hbr); - DrawIconEx(mydc, 10, (rc.bottom - rc.top - 16) / 2, IcoLib_GetIcon(ICO_POPUP_ON, 0), 16, 16, 0, hbr, DI_NORMAL); + DrawIconEx(mydc, 10, (rc.bottom - rc.top - 16) / 2, LoadIconEx(IDI_POPUP), 16, 16, 0, hbr, DI_NORMAL); SetBkMode(mydc, TRANSPARENT); GetClientRect(hwnd, &rc); rc.left += 30; // 10+16+4 -- icon diff --git a/plugins/Popup/src/popup_wnd2.cpp b/plugins/Popup/src/popup_wnd2.cpp index 3c193c4848..337faf1297 100644 --- a/plugins/Popup/src/popup_wnd2.cpp +++ b/plugins/Popup/src/popup_wnd2.cpp @@ -578,7 +578,7 @@ int PopupWnd2::fixActions(POPUPACTION *theActions, int count) if (enableDefaultUsr && isIm && IsActionEnabled("General/Quick reply")) { m_actions[iAction].actionA.cbSize = sizeof(POPUPACTION); - m_actions[iAction].actionA.lchIcon = IcoLib_GetIcon(ICO_ACT_REPLY, iconSize); + m_actions[iAction].actionA.lchIcon = LoadIconEx(IDI_ACT_REPLY, iconSize); mir_strcpy(m_actions[iAction].actionA.lpzTitle, "General/Quick reply"); m_actions[iAction].actionA.wParam = 0; m_actions[iAction].actionA.lParam = ACT_DEF_REPLY; @@ -587,7 +587,7 @@ int PopupWnd2::fixActions(POPUPACTION *theActions, int count) if (enableDefaultUsr && isIm && IsActionEnabled("General/Send message")) { m_actions[iAction].actionA.cbSize = sizeof(POPUPACTION); - m_actions[iAction].actionA.lchIcon = IcoLib_GetIcon(ICO_ACT_MESS, iconSize); + m_actions[iAction].actionA.lchIcon = LoadIconEx(IDI_ACT_MESSAGE, iconSize); mir_strcpy(m_actions[iAction].actionA.lpzTitle, "General/Send message"); m_actions[iAction].actionA.wParam = 0; m_actions[iAction].actionA.lParam = ACT_DEF_MESSAGE; @@ -596,7 +596,7 @@ int PopupWnd2::fixActions(POPUPACTION *theActions, int count) if (enableDefaultUsr && IsActionEnabled("General/User details")) { m_actions[iAction].actionA.cbSize = sizeof(POPUPACTION); - m_actions[iAction].actionA.lchIcon = IcoLib_GetIcon(ICO_ACT_INFO, iconSize); + m_actions[iAction].actionA.lchIcon = LoadIconEx(IDI_ACT_INFO, iconSize); mir_strcpy(m_actions[iAction].actionA.lpzTitle, "General/User details"); m_actions[iAction].actionA.wParam = 0; m_actions[iAction].actionA.lParam = ACT_DEF_DETAILS; @@ -605,7 +605,7 @@ int PopupWnd2::fixActions(POPUPACTION *theActions, int count) if (enableDefaultUsr && IsActionEnabled("General/Contact menu")) { m_actions[iAction].actionA.cbSize = sizeof(POPUPACTION); - m_actions[iAction].actionA.lchIcon = IcoLib_GetIcon(ICO_ACT_MENU, iconSize); + m_actions[iAction].actionA.lchIcon = LoadIconEx(IDI_ACT_MENU, iconSize); mir_strcpy(m_actions[iAction].actionA.lpzTitle, "General/Contact menu"); m_actions[iAction].actionA.wParam = 0; m_actions[iAction].actionA.lParam = ACT_DEF_MENU; @@ -614,7 +614,7 @@ int PopupWnd2::fixActions(POPUPACTION *theActions, int count) if (enableDefaultUsr && db_get_b(m_hContact, "CList", "NotOnList", 0) && IsActionEnabled("General/Add permanently")) { m_actions[iAction].actionA.cbSize = sizeof(POPUPACTION); - m_actions[iAction].actionA.lchIcon = IcoLib_GetIcon(ICO_ACT_ADD, iconSize); + m_actions[iAction].actionA.lchIcon = LoadIconEx(IDI_ACT_ADD, iconSize); mir_strcpy(m_actions[iAction].actionA.lpzTitle, "General/Add permanently"); m_actions[iAction].actionA.wParam = 0; m_actions[iAction].actionA.lParam = ACT_DEF_ADD; @@ -623,7 +623,7 @@ int PopupWnd2::fixActions(POPUPACTION *theActions, int count) if (enableDefaultGen && (m_iTimeout != -1) && IsActionEnabled("General/Pin popup")) { m_actions[iAction].actionA.cbSize = sizeof(POPUPACTION); - m_actions[iAction].actionA.lchIcon = m_bIsPinned ? IcoLib_GetIcon(ICO_ACT_PINNED, iconSize) : IcoLib_GetIcon(ICO_ACT_PIN, iconSize); + m_actions[iAction].actionA.lchIcon = m_bIsPinned ? LoadIconEx(IDI_ACT_PINNED, iconSize) : LoadIconEx(IDI_ACT_PIN, iconSize); mir_strcpy(m_actions[iAction].actionA.lpzTitle, "General/Pin popup"); m_actions[iAction].actionA.wParam = 0; m_actions[iAction].actionA.lParam = ACT_DEF_PIN; @@ -632,7 +632,7 @@ int PopupWnd2::fixActions(POPUPACTION *theActions, int count) if (enableDefaultGen && IsActionEnabled("General/Dismiss popup")) { m_actions[iAction].actionA.cbSize = sizeof(POPUPACTION); - m_actions[iAction].actionA.lchIcon = IcoLib_GetIcon(ICO_ACT_CLOSE, iconSize); + m_actions[iAction].actionA.lchIcon = LoadIconEx(IDI_ACT_CLOSE, iconSize); mir_strcpy(m_actions[iAction].actionA.lpzTitle, "General/Dismiss popup"); m_actions[iAction].actionA.wParam = 0; m_actions[iAction].actionA.lParam = ACT_DEF_DISMISS; @@ -641,7 +641,7 @@ int PopupWnd2::fixActions(POPUPACTION *theActions, int count) if (enableDefaultGen && IsActionEnabled("General/Copy to clipboard")) { m_actions[iAction].actionA.cbSize = sizeof(POPUPACTION); - m_actions[iAction].actionA.lchIcon = IcoLib_GetIcon(ICO_ACT_COPY, iconSize); + m_actions[iAction].actionA.lchIcon = LoadIconEx(IDI_ACT_COPY, iconSize); mir_strcpy(m_actions[iAction].actionA.lpzTitle, "General/Copy to clipboard"); m_actions[iAction].actionA.wParam = 0; m_actions[iAction].actionA.lParam = ACT_DEF_COPY; @@ -982,7 +982,7 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara m_bIsPinned = !m_bIsPinned; { bool iconSize = PopupOptions.actions&ACT_LARGE ? TRUE : FALSE; - PUModifyActionIcon(m_hwnd, wParam, lParam, m_bIsPinned ? IcoLib_GetIcon(ICO_ACT_PINNED, iconSize) : IcoLib_GetIcon(ICO_ACT_PIN, iconSize)); + PUModifyActionIcon(m_hwnd, wParam, lParam, m_bIsPinned ? LoadIconEx(IDI_ACT_PINNED, iconSize) : LoadIconEx(IDI_ACT_PIN, iconSize)); } break; diff --git a/plugins/Popup/src/services.cpp b/plugins/Popup/src/services.cpp index 94d87996b9..900a9908e6 100644 --- a/plugins/Popup/src/services.cpp +++ b/plugins/Popup/src/services.cpp @@ -240,21 +240,21 @@ INT_PTR Popup_ShowMessageW(WPARAM wParam, LPARAM lParam) ppd2.lptzText = (TCHAR*)wParam; switch (lParam & 0x7fffffff) { case SM_ERROR: - ppd2.lchIcon = IcoLib_GetIcon(ICO_MISC_ERROR, 0); + ppd2.lchIcon = LoadIconEx(IDI_MB_STOP, 0); ppd2.colorBack = RGB(191, 0, 0); ppd2.colorText = RGB(255, 245, 225); ppd2.lchNotification = g_hntfError; ppd2.lptzTitle = TranslateT("Error"); break; case SM_WARNING: - ppd2.lchIcon = IcoLib_GetIcon(ICO_MISC_WARNING, 0); + ppd2.lchIcon = LoadIconEx(IDI_MB_WARN, 0); ppd2.colorBack = RGB(210, 210, 150); ppd2.colorText = RGB(0, 0, 0); ppd2.lchNotification = g_hntfWarning; ppd2.lptzTitle = TranslateT("Warning"); break; case SM_NOTIFY: - ppd2.lchIcon = IcoLib_GetIcon(ICO_MISC_NOTIFY, 0); + ppd2.lchIcon = LoadIconEx(IDI_MB_INFO, 0); ppd2.colorBack = RGB(230, 230, 230); ppd2.colorText = RGB(0, 0, 0); ppd2.lchNotification = g_hntfNotification; diff --git a/plugins/Popup/src/srmm_menu.cpp b/plugins/Popup/src/srmm_menu.cpp index bc2769807d..d2792940fa 100644 --- a/plugins/Popup/src/srmm_menu.cpp +++ b/plugins/Popup/src/srmm_menu.cpp @@ -109,22 +109,22 @@ void SrmmMenu_Load() sid.dwId = 0; sid.szTooltip = LPGEN("Popup Mode: Auto"); - sid.hIcon = sid.hIconDisabled = IcoLib_GetIcon(ICO_POPUP_ON, 0); + sid.hIcon = sid.hIconDisabled = LoadIconEx(IDI_POPUP); Srmm_AddIcon(&sid); sid.dwId = 1; sid.szTooltip = LPGEN("Popup Mode: Favorite"); - sid.hIcon = sid.hIconDisabled = IcoLib_GetIcon(ICO_FAV, 0); + sid.hIcon = sid.hIconDisabled = LoadIconEx(IDI_OPT_FAVORITE); Srmm_AddIcon(&sid); sid.dwId = 2; sid.szTooltip = LPGEN("Popup Mode: Ignore fullscreen"); - sid.hIcon = sid.hIconDisabled = IcoLib_GetIcon(ICO_FULLSCREEN, 0); + sid.hIcon = sid.hIconDisabled = LoadIconEx(IDI_OPT_FULLSCREEN); Srmm_AddIcon(&sid); sid.dwId = 3; sid.szTooltip = LPGEN("Popup Mode: Block contact"); - sid.hIcon = sid.hIconDisabled = IcoLib_GetIcon(ICO_POPUP_OFF, 0); + sid.hIcon = sid.hIconDisabled = LoadIconEx(IDI_NOPOPUP); Srmm_AddIcon(&sid); HookEvent(ME_MSG_ICONPRESSED, SrmmMenu_ProcessIconClick); diff --git a/plugins/Popup/src/version.h b/plugins/Popup/src/version.h index 8c2bd1831c..64b2503cdc 100644 --- a/plugins/Popup/src/version.h +++ b/plugins/Popup/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 2 #define __MINOR_VERSION 1 #define __RELEASE_NUM 1 -#define __BUILD_NUM 10 +#define __BUILD_NUM 11 #include -- cgit v1.2.3