From 680873487c4a7987012606119a744e5ca725ad30 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 13 Apr 2019 20:22:59 +0300 Subject: merge with trunk --- plugins/AuthState/src/main.cpp | 2 +- plugins/CrashDumper/src/crshdmp.cpp | 22 +- plugins/CrashDumper/src/crshdmp_icons.cpp | 18 - plugins/CrashDumper/src/stdafx.h | 2 - plugins/CrashDumper/src/ui.cpp | 4 +- plugins/FTPFileYM/src/manager.cpp | 8 +- plugins/FingerprintNG/src/fingerprint.cpp | 6 +- plugins/HistorySweeperLight/src/main.cpp | 8 +- plugins/HistorySweeperLight/src/options.cpp | 74 +- plugins/HistorySweeperLight/src/stdafx.h | 3 - plugins/IEView/src/Options.cpp | 6 +- plugins/Import/src/main.cpp | 2 +- plugins/Import/src/stdafx.h | 1 - plugins/Import/src/utils.cpp | 9 - plugins/Import/src/wizard.cpp | 2 +- plugins/KeyboardNotify/src/ignore.cpp | 14 +- plugins/KeyboardNotify/src/stdafx.h | 1 + plugins/MenuItemEx/res/resource.rc | 24 +- plugins/MenuItemEx/src/images.cpp | 26 +- plugins/MenuItemEx/src/images.h | 3 +- plugins/MenuItemEx/src/main.cpp | 107 +- plugins/MenuItemEx/src/resource.h | 24 +- plugins/MirLua/src/Modules/m_icolib.cpp | 4 +- plugins/MirLua/src/icons.cpp | 18 - plugins/MirLua/src/options.cpp | 10 +- plugins/MirLua/src/stdafx.h | 2 - plugins/NewXstatusNotify/src/indsnd.cpp | 4 +- plugins/NoHistory/src/dllmain.cpp | 12 +- plugins/NoHistory/src/icons.cpp | 14 - plugins/NoHistory/src/icons.h | 2 - plugins/NoHistory/src/options.cpp | 9 +- plugins/Popup/src/actions.cpp | 18 +- plugins/Popup/src/history.cpp | 2 +- plugins/Popup/src/icons.cpp | 40 +- plugins/Popup/src/icons.h | 37 - plugins/Popup/src/main.cpp | 4 +- plugins/Popup/src/notifications.cpp | 6 +- plugins/Popup/src/opt_adv.cpp | 2 +- plugins/Popup/src/opt_class.cpp | 4 +- plugins/Popup/src/opt_contacts.cpp | 18 +- plugins/Popup/src/opt_gen.cpp | 6 +- plugins/Popup/src/opt_skins.cpp | 2 +- plugins/Popup/src/popup_wnd2.cpp | 18 +- plugins/Popup/src/services.cpp | 6 +- plugins/Popup/src/srmm_menu.cpp | 4 +- plugins/Popup/src/stdafx.h | 3 +- plugins/Scriver/src/chat_main.cpp | 3 +- plugins/Scriver/src/chat_window.cpp | 10 +- plugins/Scriver/src/globals.cpp | 145 ++- plugins/Scriver/src/globals.h | 1 - plugins/Scriver/src/msgdialog.cpp | 8 +- plugins/Scriver/src/msglog.cpp | 6 +- plugins/Scriver/src/msgs.cpp | 6 +- plugins/SecureIM/src/loadicons.cpp | 2 +- plugins/SimpleStatusMsg/src/awaymsg.cpp | 4 +- plugins/SimpleStatusMsg/src/main.cpp | 6 +- plugins/SimpleStatusMsg/src/msgbox.cpp | 42 +- plugins/SimpleStatusMsg/src/simplestatusmsg.h | 5 +- plugins/SimpleStatusMsg/src/utils.cpp | 31 +- plugins/StartupSilence/src/main.cpp | 24 +- plugins/StartupSilence/src/stdafx.h | 11 +- plugins/UserInfoEx/src/classMAnnivDate.cpp | 34 +- plugins/UserInfoEx/src/ctrl_button.cpp | 2 +- plugins/UserInfoEx/src/ctrl_contact.cpp | 1220 ++++++++++---------- plugins/UserInfoEx/src/ctrl_contact.h | 26 +- plugins/UserInfoEx/src/dlg_anniversarylist.cpp | 2 +- plugins/UserInfoEx/src/dlg_msgbox.cpp | 26 +- plugins/UserInfoEx/src/dlg_propsheet.cpp | 24 +- .../UserInfoEx/src/ex_import/dlg_ExImModules.cpp | 278 +++-- .../UserInfoEx/src/ex_import/dlg_ExImProgress.cpp | 6 +- plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp | 8 +- plugins/UserInfoEx/src/init.cpp | 6 +- plugins/UserInfoEx/src/mir_icolib.cpp | 162 +-- plugins/UserInfoEx/src/mir_icolib.h | 94 +- plugins/UserInfoEx/src/mir_menuitems.cpp | 52 +- plugins/UserInfoEx/src/psp_anniversary.cpp | 12 +- plugins/UserInfoEx/src/psp_contact.cpp | 40 +- plugins/UserInfoEx/src/psp_general.cpp | 6 +- plugins/UserInfoEx/src/psp_options.cpp | 6 +- plugins/UserInfoEx/src/psp_origin.cpp | 4 +- plugins/UserInfoEx/src/svc_email.cpp | 6 +- plugins/UserInfoEx/src/svc_gender.cpp | 12 +- plugins/UserInfoEx/src/svc_homepage.cpp | 6 +- plugins/UserInfoEx/src/svc_phone.cpp | 12 +- plugins/UserInfoEx/src/svc_refreshci.cpp | 16 +- plugins/UserInfoEx/src/svc_reminder.cpp | 48 +- 86 files changed, 1351 insertions(+), 1672 deletions(-) delete mode 100644 plugins/Popup/src/icons.h (limited to 'plugins') diff --git a/plugins/AuthState/src/main.cpp b/plugins/AuthState/src/main.cpp index ffc7e229f5..fe60e1c114 100644 --- a/plugins/AuthState/src/main.cpp +++ b/plugins/AuthState/src/main.cpp @@ -152,7 +152,7 @@ int onPrebuildContactMenu(WPARAM hContact, LPARAM) int onModulesLoaded(WPARAM, LPARAM) { // extra icons - hExtraIcon = ExtraIcon_RegisterIcolib("authstate", LPGEN("Auth state"), iconList[ICON_BOTH].szName); + hExtraIcon = ExtraIcon_RegisterIcolib("authstate", LPGEN("Auth state"), iconList[ICON_BOTH].hIcolib); // Set initial value for all contacts for (auto &hContact : Contacts()) diff --git a/plugins/CrashDumper/src/crshdmp.cpp b/plugins/CrashDumper/src/crshdmp.cpp index 7d9baf7c23..24eb33fd0b 100644 --- a/plugins/CrashDumper/src/crshdmp.cpp +++ b/plugins/CrashDumper/src/crshdmp.cpp @@ -184,24 +184,24 @@ static int ToolbarModulesLoaded(WPARAM, LPARAM) TTBButton ttb = {}; ttb.pszService = MS_CRASHDUMPER_STORETOCLIP; ttb.name = ttb.pszTooltipUp = LPGEN("Version Information To Clipboard"); - ttb.hIconHandleUp = GetIconHandle(IDI_VITOCLIP); + ttb.hIconHandleUp = g_plugin.getIconHandle(IDI_VITOCLIP); ttb.dwFlags = TTBBF_VISIBLE; g_plugin.addTTB(&ttb); ttb.pszService = MS_CRASHDUMPER_STORETOFILE; ttb.name = ttb.pszTooltipUp = LPGEN("Version Information To File"); - ttb.hIconHandleUp = GetIconHandle(IDI_VITOFILE); + ttb.hIconHandleUp = g_plugin.getIconHandle(IDI_VITOFILE); ttb.dwFlags = 0; g_plugin.addTTB(&ttb); ttb.pszService = MS_CRASHDUMPER_VIEWINFO; ttb.name = ttb.pszTooltipUp = LPGEN("Show Version Information"); - ttb.hIconHandleUp = GetIconHandle(IDI_VISHOW); + ttb.hIconHandleUp = g_plugin.getIconHandle(IDI_VISHOW); g_plugin.addTTB(&ttb); ttb.pszService = MS_CRASHDUMPER_UPLOAD; ttb.name = ttb.pszTooltipUp = LPGEN("Upload Version Information"); - ttb.hIconHandleUp = GetIconHandle(IDI_VIUPLOAD); + ttb.hIconHandleUp = g_plugin.getIconHandle(IDI_VIUPLOAD); g_plugin.addTTB(&ttb); return 0; } @@ -224,48 +224,48 @@ static int ModulesLoaded(WPARAM, LPARAM) } CMenuItem mi(&g_plugin); - mi.root = g_plugin.addRootMenu(MO_MAIN, LPGENW("Version Information"), 2000089999, GetIconHandle(IDI_VI)); + mi.root = g_plugin.addRootMenu(MO_MAIN, LPGENW("Version Information"), 2000089999, g_plugin.getIconHandle(IDI_VI)); Menu_ConfigureItem(mi.root, MCI_OPT_UID, "9A7A9C76-7FD8-4C05-B402-6C46060C2D78"); SET_UID(mi, 0x52930e40, 0xb2ee, 0x4433, 0xad, 0x77, 0xf5, 0x42, 0xe, 0xf6, 0x57, 0xc1); mi.position = 2000089995; mi.name.a = LPGEN("Copy to clipboard"); - mi.hIcolibItem = GetIconHandle(IDI_VITOCLIP); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_VITOCLIP); mi.pszService = MS_CRASHDUMPER_STORETOCLIP; Menu_AddMainMenuItem(&mi); SET_UID(mi, 0x54109094, 0x494e, 0x4535, 0x9c, 0x3a, 0xf6, 0x9e, 0x9a, 0xf7, 0xcd, 0xbe); mi.position = 2000089996; mi.name.a = LPGEN("Store to file"); - mi.hIcolibItem = GetIconHandle(IDI_VITOFILE); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_VITOFILE); mi.pszService = MS_CRASHDUMPER_STORETOFILE; Menu_AddMainMenuItem(&mi); SET_UID(mi, 0x4004f9ee, 0x2c5a, 0x420a, 0xb1, 0x54, 0x3e, 0x47, 0xc1, 0xde, 0x46, 0xec); mi.position = 2000089997; mi.name.a = LPGEN("Show"); - mi.hIcolibItem = GetIconHandle(IDI_VISHOW); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_VISHOW); mi.pszService = MS_CRASHDUMPER_VIEWINFO; Menu_AddMainMenuItem(&mi); SET_UID(mi, 0x8526469a, 0x8ab4, 0x4dd4, 0xad, 0xbf, 0x51, 0xfd, 0x71, 0x10, 0xd3, 0x3c); mi.position = 2000089998; mi.name.a = LPGEN("Show with DLLs"); - mi.hIcolibItem = GetIconHandle(IDI_VIUPLOAD); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_VIUPLOAD); mi.pszService = MS_CRASHDUMPER_VIEWINFO; Menu_ConfigureItem(Menu_AddMainMenuItem(&mi), MCI_OPT_EXECPARAM, 1); SET_UID(mi, 0xc6e3b558, 0xe1e8, 0x4cce, 0x96, 0x8, 0xc6, 0x89, 0x1b, 0x79, 0xf3, 0x7e); mi.position = 2000089999; mi.name.a = LPGEN("Upload"); - mi.hIcolibItem = GetIconHandle(IDI_VIUPLOAD); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_VIUPLOAD); mi.pszService = MS_CRASHDUMPER_UPLOAD; Menu_AddMainMenuItem(&mi); SET_UID(mi, 0xa23da95a, 0x7624, 0x4343, 0x8c, 0xc0, 0xa6, 0x16, 0xbc, 0x30, 0x13, 0x8c); mi.position = 2000089999; mi.name.a = LPGEN("Copy link to clipboard"); - mi.hIcolibItem = GetIconHandle(IDI_LINKTOCLIP);//need icon + mi.hIcolibItem = g_plugin.getIconHandle(IDI_LINKTOCLIP);//need icon mi.pszService = MS_CRASHDUMPER_URLTOCLIP; Menu_AddMainMenuItem(&mi); diff --git a/plugins/CrashDumper/src/crshdmp_icons.cpp b/plugins/CrashDumper/src/crshdmp_icons.cpp index e1dcd040ca..909b90d505 100644 --- a/plugins/CrashDumper/src/crshdmp_icons.cpp +++ b/plugins/CrashDumper/src/crshdmp_icons.cpp @@ -32,21 +32,3 @@ void InitIcons(void) { g_plugin.registerIcon(LPGEN("Crash Dumper"), iconList, MODULENAME); } - -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 nullptr; -} - -HANDLE GetIconHandle(int iconId) -{ - for (int i = 0; i < _countof(iconList); i++) - if (iconList[i].defIconID == iconId) - return iconList[i].hIcolib; - - return nullptr; -} diff --git a/plugins/CrashDumper/src/stdafx.h b/plugins/CrashDumper/src/stdafx.h index c6ace054d4..588c8ce737 100644 --- a/plugins/CrashDumper/src/stdafx.h +++ b/plugins/CrashDumper/src/stdafx.h @@ -150,8 +150,6 @@ void OpenAuthUrl(const char* url); void __cdecl VersionInfoUploadThread(void* arg); void InitIcons(void); -HICON LoadIconEx(int iconId, bool big = false); -HANDLE GetIconHandle(int iconId); int OptionsInit(WPARAM wParam, LPARAM); INT_PTR ViewVersionInfo(WPARAM wParam, LPARAM); diff --git a/plugins/CrashDumper/src/ui.cpp b/plugins/CrashDumper/src/ui.cpp index 67a73d1bb7..50c7dd944c 100644 --- a/plugins/CrashDumper/src/ui.cpp +++ b/plugins/CrashDumper/src/ui.cpp @@ -44,7 +44,7 @@ public: bool OnInitDialog() override { - Window_SetIcon_IcoLib(m_hwnd, GetIconHandle(IDI_VI)); + Window_SetIcon_IcoLib(m_hwnd, g_plugin.getIconHandle(IDI_VI)); { CHARFORMAT2 chf; chf.cbSize = sizeof(chf); @@ -317,7 +317,7 @@ void ShowMessage(int type, const wchar_t *format, ...) va_end(va); mir_wstrcpy(ppd.lpwzContactName, _A2W(MODULENAME)); - ppd.lchIcon = LoadIconEx(IDI_VI); + ppd.lchIcon = g_plugin.getIcon(IDI_VI); ppd.PluginWindowProc = DlgProcPopup; ppd.PluginData = (void*)type; PUAddPopupW(&ppd); diff --git a/plugins/FTPFileYM/src/manager.cpp b/plugins/FTPFileYM/src/manager.cpp index c4ea35a8f3..98f6818a23 100644 --- a/plugins/FTPFileYM/src/manager.cpp +++ b/plugins/FTPFileYM/src/manager.cpp @@ -66,10 +66,10 @@ void Manager::initImageList() char buff[256]; m_himlStates = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, ServerList::FTP_COUNT + 4, 0); - ImageList_AddIcon(m_himlStates, Skin_LoadIcon(SKINICON_OTHER_DELETE)); // image index 0 is useless for INDEXTOSTATEIMAGEMASK - ImageList_AddIcon(m_himlStates, Skin_LoadIcon(SKINICON_OTHER_DELETE)); - ImageList_AddIcon(m_himlStates, Skin_LoadIcon(SKINICON_OTHER_NOTICK)); - ImageList_AddIcon(m_himlStates, Skin_LoadIcon(SKINICON_OTHER_TICK)); + ImageList_AddSkinIcon(m_himlStates, SKINICON_OTHER_DELETE); // image index 0 is useless for INDEXTOSTATEIMAGEMASK + ImageList_AddSkinIcon(m_himlStates, SKINICON_OTHER_DELETE); + ImageList_AddSkinIcon(m_himlStates, SKINICON_OTHER_NOTICK); + ImageList_AddSkinIcon(m_himlStates, SKINICON_OTHER_TICK); for (int i = 0; i < ServerList::FTP_COUNT; i++) { mir_snprintf(buff, "ftp%d", i); diff --git a/plugins/FingerprintNG/src/fingerprint.cpp b/plugins/FingerprintNG/src/fingerprint.cpp index c0ac0410c9..83ae37180d 100644 --- a/plugins/FingerprintNG/src/fingerprint.cpp +++ b/plugins/FingerprintNG/src/fingerprint.cpp @@ -887,6 +887,9 @@ int OnModulesLoaded(WPARAM, LPARAM) RegisterIcons(); + hExtraIcon = ExtraIcon_RegisterCallback("Client", LPGEN("Fingerprint"), "client_Miranda_unknown", + OnExtraIconListRebuild, OnExtraImageApply, OnExtraIconClick); + if (g_plugin.getByte("StatusBarIcon", 1)) { StatusIconData sid = {}; sid.szModule = MODULENAME; @@ -907,7 +910,4 @@ void InitFingerModule() CreateServiceFunction(MS_FP_SAMECLIENTSW, ServiceSameClientsW); CreateServiceFunction(MS_FP_GETCLIENTDESCRW, ServiceGetClientDescrW); CreateServiceFunction(MS_FP_GETCLIENTICONW, ServiceGetClientIconW); - - hExtraIcon = ExtraIcon_RegisterCallback("Client", LPGEN("Fingerprint"), "client_Miranda_unknown", - OnExtraIconListRebuild, OnExtraImageApply, OnExtraIconClick); } diff --git a/plugins/HistorySweeperLight/src/main.cpp b/plugins/HistorySweeperLight/src/main.cpp index 7d4ecd5311..416c83f319 100644 --- a/plugins/HistorySweeperLight/src/main.cpp +++ b/plugins/HistorySweeperLight/src/main.cpp @@ -70,7 +70,7 @@ static int OnModulesLoaded(WPARAM, LPARAM) StatusIconData sid = {}; sid.szModule = MODULENAME; - sid.hIcon = LoadIconEx("actG"); + sid.hIcon = g_plugin.getIcon(IDI_ACTG); if (sweep == 0) sid.szTooltip.w = LPGENW("Keep all events"); else if (sweep == 1) @@ -84,17 +84,17 @@ static int OnModulesLoaded(WPARAM, LPARAM) Srmm_AddIcon(&sid, &g_plugin); sid.dwId = 1; - sid.hIcon = LoadIconEx("act1"); + sid.hIcon = g_plugin.getIcon(IDI_ACT1); sid.szTooltip.w = time_stamp_strings[g_plugin.getByte("StartupShutdownOlder", 0)]; Srmm_AddIcon(&sid, &g_plugin); sid.dwId = 2; - sid.hIcon = LoadIconEx("act2"); + sid.hIcon = g_plugin.getIcon(IDI_ACT2); sid.szTooltip.w = keep_strings[g_plugin.getByte("StartupShutdownKeep", 0)]; Srmm_AddIcon(&sid, &g_plugin); sid.dwId = 3; - sid.hIcon = LoadIconEx("actDel"); + sid.hIcon = g_plugin.getIcon(IDI_ACTDEL); sid.szTooltip.w = LPGENW("Delete all events"); Srmm_AddIcon(&sid, &g_plugin); diff --git a/plugins/HistorySweeperLight/src/options.cpp b/plugins/HistorySweeperLight/src/options.cpp index 4dc71814f8..50db5990f5 100644 --- a/plugins/HistorySweeperLight/src/options.cpp +++ b/plugins/HistorySweeperLight/src/options.cpp @@ -21,6 +21,25 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" +///////////////////////////////////////////////////////////////////////////////////////// + +static IconItem iconList[] = +{ + { LPGEN("Default Action"), "actG", IDI_ACTG }, + { LPGEN("Action 1"), "act1", IDI_ACT1 }, + { LPGEN("Action 2"), "act2", IDI_ACT2 }, + { LPGEN("Delete All"), "actDel", IDI_ACTDEL } +}; + +static HANDLE hIconLibItem[_countof(iconList)]; + +void InitIcons(void) +{ + g_plugin.registerIcon(MODULENAME, iconList, MODULENAME); +} + +///////////////////////////////////////////////////////////////////////////////////////// + // Time Stamps strings wchar_t* time_stamp_strings[] = { @@ -44,44 +63,6 @@ wchar_t* keep_strings[] = LPGENW("Keep 50 last events") }; -static IconItem iconList[] = -{ - { LPGEN("Default Action"), "actG", IDI_ACTG }, - { LPGEN("Action 1"), "act1", IDI_ACT1 }, - { LPGEN("Action 2"), "act2", IDI_ACT2 }, - { LPGEN("Delete All"), "actDel", IDI_ACTDEL } -}; - -static HANDLE hIconLibItem[_countof(iconList)]; - -void InitIcons(void) -{ - g_plugin.registerIcon(MODULENAME, iconList, MODULENAME); -} - -HICON LoadIconEx(const char* name) -{ - char szSettingName[100]; - mir_snprintf(szSettingName, "%s_%s", MODULENAME, name); - return IcoLib_GetIcon(szSettingName); -} - -HANDLE GetIconHandle(const char* name) -{ - for (auto &it : iconList) - if (mir_strcmp(it.szName, name) == 0) - return ⁢ - - return nullptr; -} - -void ReleaseIconEx(const char* name) -{ - char szSettingName[100]; - mir_snprintf(szSettingName, "%s_%s", MODULENAME, name); - IcoLib_Release(szSettingName); -} - HANDLE hAllContacts, hSystemHistory; static void ShowAllContactIcons(HWND hwndList) @@ -182,20 +163,17 @@ INT_PTR CALLBACK DlgProcHSOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM lParam) TranslateDialogDefault(hwndDlg); { HIMAGELIST hIml = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_MASK | ILC_COLOR32, 2, 2); + ImageList_AddSkinIcon(hIml, SKINICON_OTHER_SMALLDOT); - HICON hIcon = Skin_LoadIcon(SKINICON_OTHER_SMALLDOT); - ImageList_AddIcon(hIml, hIcon); - IcoLib_ReleaseIcon(hIcon); - - hIcon = LoadIconEx("act1"); + HICON hIcon = g_plugin.getIcon(IDI_ACT1); ImageList_AddIcon(hIml, hIcon); SendDlgItemMessage(hwndDlg, IDC_ACT1, STM_SETICON, (WPARAM)hIcon, 0); - hIcon = LoadIconEx("act2"); + hIcon = g_plugin.getIcon(IDI_ACT2); ImageList_AddIcon(hIml, hIcon); SendDlgItemMessage(hwndDlg, IDC_ACT2, STM_SETICON, (WPARAM)hIcon, 0); - hIcon = LoadIconEx("actDel"); + hIcon = g_plugin.getIcon(IDI_ACTDEL); ImageList_AddIcon(hIml, hIcon); SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_SETEXTRAIMAGELIST, 0, (LPARAM)hIml); @@ -206,9 +184,9 @@ INT_PTR CALLBACK DlgProcHSOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM lParam) case WM_DESTROY: ImageList_Destroy((HIMAGELIST)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETEXTRAIMAGELIST, 0, 0)); - ReleaseIconEx("act1"); - ReleaseIconEx("act2"); - ReleaseIconEx("actDel"); + g_plugin.releaseIcon(IDI_ACT1); + g_plugin.releaseIcon(IDI_ACT2); + g_plugin.releaseIcon(IDI_ACTDEL); break; case WM_COMMAND: diff --git a/plugins/HistorySweeperLight/src/stdafx.h b/plugins/HistorySweeperLight/src/stdafx.h index 5d68a9c2bb..73df99ec90 100644 --- a/plugins/HistorySweeperLight/src/stdafx.h +++ b/plugins/HistorySweeperLight/src/stdafx.h @@ -60,9 +60,6 @@ extern wchar_t* time_stamp_strings[]; extern wchar_t* keep_strings[]; int HSOptInitialise(WPARAM wParam, LPARAM lParam); void InitIcons(void); -void ReleaseIconEx(const char* name); -HICON LoadIconEx(const char* name); -HANDLE GetIconHandle(const char* name); // historysweeper.c void ShutdownAction(void); diff --git a/plugins/IEView/src/Options.cpp b/plugins/IEView/src/Options.cpp index b4dc6a1f85..e5bcbb89f8 100644 --- a/plugins/IEView/src/Options.cpp +++ b/plugins/IEView/src/Options.cpp @@ -287,11 +287,7 @@ static void RefreshProtoIcons() ImageList_AddIcon(hProtocolImageList, hIcon); DestroyIcon(hIcon); } - else { - hIcon = (HICON)Skin_LoadIcon(SKINICON_OTHER_MIRANDA); - ImageList_AddIcon(hProtocolImageList, hIcon); - IcoLib_ReleaseIcon(hIcon); - } + else ImageList_AddSkinIcon(hProtocolImageList, SKINICON_OTHER_MIRANDA); } } diff --git a/plugins/Import/src/main.cpp b/plugins/Import/src/main.cpp index 7c48eab1ff..046d463f39 100644 --- a/plugins/Import/src/main.cpp +++ b/plugins/Import/src/main.cpp @@ -62,7 +62,7 @@ static int ModulesLoaded(WPARAM, LPARAM) // menu item CMenuItem mi(&g_plugin); SET_UID(mi, 0x20ffaf55, 0xafa0, 0x4da3, 0xa9, 0x46, 0x20, 0x51, 0xa0, 0x24, 0xb, 0x41); - mi.hIcolibItem = GetIconHandle(IDI_IMPORT); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_IMPORT); mi.name.a = LPGEN("&Import..."); mi.position = 500050000; mi.pszService = MS_IMPORT_SERVICE; diff --git a/plugins/Import/src/stdafx.h b/plugins/Import/src/stdafx.h index 415eed700a..85e8f728d3 100644 --- a/plugins/Import/src/stdafx.h +++ b/plugins/Import/src/stdafx.h @@ -201,7 +201,6 @@ extern bool g_bServiceMode, g_bSendQuit; extern int g_iImportOptions; extern MCONTACT g_hImportContact; -HANDLE GetIconHandle(int iIconId); void RegisterIcons(void); void RegisterMContacts(); diff --git a/plugins/Import/src/utils.cpp b/plugins/Import/src/utils.cpp index efff680e92..51965cacef 100644 --- a/plugins/Import/src/utils.cpp +++ b/plugins/Import/src/utils.cpp @@ -187,15 +187,6 @@ static IconItem iconList[] = { LPGEN("Import..."), "import_main", IDI_IMPORT } }; -HANDLE GetIconHandle(int iIconId) -{ - for (auto &it : iconList) - if (it.defIconID == iIconId) - return it.hIcolib; - - return nullptr; -} - void RegisterIcons() { g_plugin.registerIcon("Import", iconList); diff --git a/plugins/Import/src/wizard.cpp b/plugins/Import/src/wizard.cpp index 15669a0b35..2767a2ffc2 100644 --- a/plugins/Import/src/wizard.cpp +++ b/plugins/Import/src/wizard.cpp @@ -120,7 +120,7 @@ public: { Utils_RestoreWindowPosition(m_hwnd, 0, IMPORT_MODULE, "wiz"); - Window_SetIcon_IcoLib(m_hwnd, GetIconHandle(IDI_IMPORT)); + Window_SetIcon_IcoLib(m_hwnd, g_plugin.getIconHandle(IDI_IMPORT)); g_hwndWizard = m_hwnd; if (m_pFirstPage) diff --git a/plugins/KeyboardNotify/src/ignore.cpp b/plugins/KeyboardNotify/src/ignore.cpp index bf8f81bdcf..fd9808108c 100644 --- a/plugins/KeyboardNotify/src/ignore.cpp +++ b/plugins/KeyboardNotify/src/ignore.cpp @@ -195,13 +195,13 @@ INT_PTR CALLBACK DlgProcIgnoreOptions(HWND hwndDlg, UINT msg, WPARAM, LPARAM lPa TranslateDialogDefault(hwndDlg); { HIMAGELIST hIml=ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 3+IGNOREEVENT_MAX, 3+IGNOREEVENT_MAX); - ImageList_AddIcon(hIml, Skin_LoadIcon(SKINICON_OTHER_SMALLDOT)); - ImageList_AddIcon(hIml, Skin_LoadIcon(SKINICON_OTHER_FILLEDBLOB)); - ImageList_AddIcon(hIml, Skin_LoadIcon(SKINICON_OTHER_EMPTYBLOB)); - ImageList_AddIcon(hIml, Skin_LoadIcon(SKINICON_EVENT_MESSAGE)); - ImageList_AddIcon(hIml, Skin_LoadIcon(SKINICON_EVENT_URL)); - ImageList_AddIcon(hIml, Skin_LoadIcon(SKINICON_EVENT_FILE)); - ImageList_AddIcon(hIml, Skin_LoadIcon(SKINICON_OTHER_MIRANDA)); + ImageList_AddSkinIcon(hIml, SKINICON_OTHER_SMALLDOT); + ImageList_AddSkinIcon(hIml, SKINICON_OTHER_FILLEDBLOB); + ImageList_AddSkinIcon(hIml, SKINICON_OTHER_EMPTYBLOB); + ImageList_AddSkinIcon(hIml, SKINICON_EVENT_MESSAGE); + ImageList_AddSkinIcon(hIml, SKINICON_EVENT_URL); + ImageList_AddSkinIcon(hIml, SKINICON_EVENT_FILE); + ImageList_AddSkinIcon(hIml, SKINICON_OTHER_MIRANDA); SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_SETEXTRAIMAGELIST, 0, (LPARAM)hIml); for (int i=0; i < _countof(hIcons); i++) hIcons[i] = ImageList_GetIcon(hIml, 1+i, ILD_NORMAL); diff --git a/plugins/KeyboardNotify/src/stdafx.h b/plugins/KeyboardNotify/src/stdafx.h index 3b01954284..cce961e02f 100644 --- a/plugins/KeyboardNotify/src/stdafx.h +++ b/plugins/KeyboardNotify/src/stdafx.h @@ -31,6 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include +#include #include #include #include diff --git a/plugins/MenuItemEx/res/resource.rc b/plugins/MenuItemEx/res/resource.rc index 3ca94c4cd4..d14c78be5d 100644 --- a/plugins/MenuItemEx/res/resource.rc +++ b/plugins/MenuItemEx/res/resource.rc @@ -26,18 +26,18 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. -IDI_ICON0 ICON "hide_from_list.ico" -IDI_ICON1 ICON "Always Visible.ico" -IDI_ICON2 ICON "Never Visible.ico" -IDI_ICON3 ICON "copyid_overlay.ico" -IDI_ICON6 ICON "change_proto.ico" -IDI_ICON7 ICON "ignore_list.ico" -IDI_ICON8 ICON "show_in_list.ico" -IDI_ICON9 ICON "msg_status.ico" -IDI_ICON10 ICON "msg_xstatus.ico" -IDI_ICON11 ICON "copyip_overlay.ico" -IDI_ICON12 ICON "recv_files.ico" -IDI_ICON13 ICON "CopyMirVer.ico" +IDI_HIDE ICON "hide_from_list.ico" +IDI_VISIBLE ICON "Always Visible.ico" +IDI_INVISIBLE ICON "Never Visible.ico" +IDI_COPYID ICON "copyid_overlay.ico" +IDI_PROTOCOL ICON "change_proto.ico" +IDI_IGNORE ICON "ignore_list.ico" +IDI_SHOWINLIST ICON "show_in_list.ico" +IDI_COPYSTATUS ICON "msg_status.ico" +IDI_COPYXSTATUS ICON "msg_xstatus.ico" +IDI_COPYIP ICON "copyip_overlay.ico" +IDI_BROWSE ICON "recv_files.ico" +IDI_MIRVER ICON "CopyMirVer.ico" ///////////////////////////////////////////////////////////////////////////// // diff --git a/plugins/MenuItemEx/src/images.cpp b/plugins/MenuItemEx/src/images.cpp index f59b4c2c4e..4d2189a8d9 100644 --- a/plugins/MenuItemEx/src/images.cpp +++ b/plugins/MenuItemEx/src/images.cpp @@ -304,33 +304,30 @@ HICON MakeHalfAlphaIcon(HICON SourceIcon) //} -HICON BindOverlayIcon(HICON SourceIcon, LPCSTR OverlayIconName) +HICON BindOverlayIcon(HICON SourceIcon, int iIcon) { + HICON TempIcon = CopyIcon(SourceIcon); ICONINFO OverlayIconInfo, TargetIconInfo; - BITMAP OverlayBitmapInfo, TargetBitmapInfo; - HBITMAP OldOverlayBitmap, OldTargetBitmap; - HICON OverlayIcon, TargetIcon, TempIcon; - HDC OverlayDC, TargetDC; - BLENDFUNCTION bf = { 0, 0, 255, 1 }; - - TempIcon = CopyIcon(SourceIcon); if (!GetIconInfo(TempIcon, &TargetIconInfo)) return nullptr; MakeBitmap32(&TargetIconInfo.hbmColor); CorrectBitmap32Alpha(TargetIconInfo.hbmColor, FALSE); + + BITMAP OverlayBitmapInfo, TargetBitmapInfo; GetObject(TargetIconInfo.hbmColor, sizeof(BITMAP), &TargetBitmapInfo); - OverlayIcon = IcoLib_GetIcon(OverlayIconName); + HICON OverlayIcon = g_plugin.getIcon(iIcon); if (!GetIconInfo(OverlayIcon, &OverlayIconInfo) || !GetObject(OverlayIconInfo.hbmColor, sizeof(BITMAP), &OverlayBitmapInfo)) return nullptr; - TargetDC = CreateCompatibleDC(nullptr); - OldTargetBitmap = (HBITMAP)SelectObject(TargetDC, TargetIconInfo.hbmColor); + HDC TargetDC = CreateCompatibleDC(nullptr); + HBITMAP OldTargetBitmap = (HBITMAP)SelectObject(TargetDC, TargetIconInfo.hbmColor); - OverlayDC = CreateCompatibleDC(nullptr); - OldOverlayBitmap = (HBITMAP)SelectObject(OverlayDC, OverlayIconInfo.hbmColor); + HDC OverlayDC = CreateCompatibleDC(nullptr); + HBITMAP OldOverlayBitmap = (HBITMAP)SelectObject(OverlayDC, OverlayIconInfo.hbmColor); + BLENDFUNCTION bf = { 0, 0, 255, 1 }; AlphaBlend(TargetDC, 0, 0, TargetBitmapInfo.bmWidth, TargetBitmapInfo.bmHeight, OverlayDC, 0, 0, OverlayBitmapInfo.bmWidth, OverlayBitmapInfo.bmHeight, bf); @@ -340,9 +337,8 @@ HICON BindOverlayIcon(HICON SourceIcon, LPCSTR OverlayIconName) BitBlt(TargetDC, 0, 0, TargetBitmapInfo.bmWidth, TargetBitmapInfo.bmHeight, OverlayDC, 0, 0, SRCCOPY); - TargetIcon = CreateIconIndirect(&TargetIconInfo); + HICON TargetIcon = CreateIconIndirect(&TargetIconInfo); DestroyIcon(TempIcon); - //DestroyIcon(OverlayIcon); SelectObject(TargetDC, OldTargetBitmap); DeleteObject(TargetIconInfo.hbmColor); diff --git a/plugins/MenuItemEx/src/images.h b/plugins/MenuItemEx/src/images.h index c935ec8659..5c4cf01060 100644 --- a/plugins/MenuItemEx/src/images.h +++ b/plugins/MenuItemEx/src/images.h @@ -1,8 +1,7 @@ #ifndef __IMAGE_UTILS_H__ #define __IMAGE_UTILS_H__ -HICON BindOverlayIcon(HICON, LPCSTR); -//HICON MakeGrayscaleIcon(HICON); +HICON BindOverlayIcon(HICON, int iIcon); HICON MakeHalfAlphaIcon(HICON); #endif // __IMAGE_UTILS_H__ diff --git a/plugins/MenuItemEx/src/main.cpp b/plugins/MenuItemEx/src/main.cpp index 48d89f3b61..5a1c87ab99 100644 --- a/plugins/MenuItemEx/src/main.cpp +++ b/plugins/MenuItemEx/src/main.cpp @@ -22,13 +22,31 @@ PROTOACCOUNT **accs; int protoCount; CMPlugin g_plugin; -struct { +static IconItem iconList[] = +{ + { LPGEN("Hide from list"), "hidefl", IDI_HIDE }, + { LPGEN("Always visible"), "vis", IDI_VISIBLE }, + { LPGEN("Never visible"), "invis", IDI_INVISIBLE }, + { LPGEN("Copy ID"), "copyid", IDI_COPYID }, + { LPGEN("Copy to Account"), "protocol", IDI_PROTOCOL }, + { LPGEN("Ignore"), "ignore", IDI_IGNORE }, + { LPGEN("Show in list"), "showil", IDI_SHOWINLIST }, + { LPGEN("Copy Status Message"), "copysm1", IDI_COPYSTATUS }, + { LPGEN("Copy xStatus Message"), "copysm2", IDI_COPYXSTATUS }, + { LPGEN("Copy IP"), "copyip", IDI_COPYIP }, + { LPGEN("Browse Received Files"), "recfiles", IDI_BROWSE }, + { LPGEN("Copy MirVer"), "copymver", IDI_MIRVER }, +}; + +struct +{ char *module; char *name; wchar_t *fullName; char flag; } -static const statusMsg[] = { +static const statusMsg[] = +{ { "CList", "StatusMsg", LPGENW("Status message"), 1 }, { nullptr, "XStatusName", LPGENW("xStatus title"), 4 }, { nullptr, "XStatusMsg", LPGENW("xStatus message"), 2 }, @@ -37,25 +55,8 @@ static const statusMsg[] = { { "AdvStatus", "activity/text", LPGENW("Activity text"), 8 } }; -static IconItem iconList[] = { - { LPGEN("Hide from list"), "miex_hidefl", IDI_ICON0 }, - { LPGEN("Show in list"), "miex_showil", IDI_ICON8 }, - { LPGEN("Always visible"), "miex_vis", IDI_ICON1 }, - { LPGEN("Never visible"), "miex_invis", IDI_ICON2 }, - { LPGEN("Copy to Account"), "miex_protocol", IDI_ICON6 }, - { LPGEN("Ignore"), "miex_ignore", IDI_ICON7 }, - { LPGEN("Browse Received Files"), "miex_recfiles", IDI_ICON12 }, - { LPGEN("Copy MirVer"), "miex_copymver", IDI_ICON13 } -}; - -static IconItem overlayIconList[] = { - { LPGEN("Copy ID"), "miex_copyid", IDI_ICON3 }, - { LPGEN("Copy Status Message"), "miex_copysm1", IDI_ICON9 }, - { LPGEN("Copy xStatus Message"), "miex_copysm2", IDI_ICON10 }, - { LPGEN("Copy IP"), "miex_copyip", IDI_ICON11 } -}; - -struct { +struct +{ wchar_t* name; int type; int icon; @@ -86,16 +87,19 @@ PLUGININFOEX pluginInfoEx = { CMPlugin::CMPlugin() : PLUGIN(MODULENAME, pluginInfoEx) -{} +{ +} ///////////////////////////////////////////////////////////////////////////////////////// -struct ModSetLinkLinkItem { // code from dbe++ plugin by Bio +struct ModSetLinkLinkItem +{ // code from dbe++ plugin by Bio char *name; BYTE *next; //struct ModSetLinkLinkItem }; -struct ModuleSettingLL { +struct ModuleSettingLL +{ struct ModSetLinkLinkItem *first; struct ModSetLinkLinkItem *last; }; @@ -108,16 +112,14 @@ static int GetSetting(MCONTACT hContact, const char *szModule, const char *szSet static int enumModulesSettingsProc(const char *szName, void *lParam) { ModuleSettingLL *msll = (ModuleSettingLL *)lParam; - if (!msll->first) - { + if (!msll->first) { msll->first = (struct ModSetLinkLinkItem *)malloc(sizeof(struct ModSetLinkLinkItem)); if (!msll->first) return 1; msll->first->name = _strdup(szName); msll->first->next = nullptr; msll->last = msll->first; } - else - { + else { struct ModSetLinkLinkItem *item = (struct ModSetLinkLinkItem *)malloc(sizeof(struct ModSetLinkLinkItem)); if (!item) return 1; msll->last->next = (BYTE*)item; @@ -130,22 +132,18 @@ static int enumModulesSettingsProc(const char *szName, void *lParam) static void FreeModuleSettingLL(ModuleSettingLL* msll) { - if (msll) - { + if (msll) { struct ModSetLinkLinkItem *item = msll->first; struct ModSetLinkLinkItem *temp; - while (item) - { - if (item->name) - { + while (item) { + if (item->name) { free(item->name); item->name = nullptr; } temp = item; item = (struct ModSetLinkLinkItem *)item->next; - if (temp) - { + if (temp) { free(temp); temp = nullptr; } @@ -410,7 +408,7 @@ static void ModifyCopyID(MCONTACT hContact, BOOL bShowID, BOOL bTrimID) HICON hIconCID = (HICON)CallProtoService(szProto, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0); { - HICON hIcon = BindOverlayIcon(hIconCID, "miex_copyid"); + HICON hIcon = BindOverlayIcon(hIconCID, IDI_COPYID); DestroyIcon(hIconCID); hIconCID = hIcon; } @@ -444,7 +442,7 @@ static void ModifyStatusMsg(MCONTACT hContact) HICON hIconSMsg = (HICON)CallProtoService(szProto, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0); { - HICON hIcon = BindOverlayIcon(hIconSMsg, (StatusMsgExists(hContact) & 2) ? "miex_copysm2" : "miex_copysm1"); + HICON hIcon = BindOverlayIcon(hIconSMsg, (StatusMsgExists(hContact) & 2) ? IDI_COPYXSTATUS : IDI_COPYSTATUS); DestroyIcon(hIconSMsg); hIconSMsg = hIcon; } @@ -463,7 +461,7 @@ static void ModifyCopyIP(MCONTACT hContact) HICON hIconCIP = (HICON)CallProtoService(szProto, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0); { - HICON hIcon = BindOverlayIcon(hIconCIP, "miex_copyip"); + HICON hIcon = BindOverlayIcon(hIconCIP, IDI_COPYIP); DestroyIcon(hIconCIP); hIconCIP = hIcon; } @@ -778,10 +776,8 @@ static int EnumProtoSubmenu(WPARAM, LPARAM) int pos = 1000; if (protoCount) // remove old items { - for (int i = 0; i < protoCount; i++) - { - if (hProtoItem[i]) - { + for (int i = 0; i < protoCount; i++) { + if (hProtoItem[i]) { Menu_RemoveItem(hProtoItem[i]); hProtoItem[i] = nullptr; } @@ -790,8 +786,7 @@ static int EnumProtoSubmenu(WPARAM, LPARAM) Proto_EnumAccounts(&protoCount, &accs); if (protoCount > MAX_PROTOS) protoCount = MAX_PROTOS; - for (int i = 0; i < protoCount; i++) - { + for (int i = 0; i < protoCount; i++) { hProtoItem[i] = AddSubmenuItem(hmenuProto, accs[i]->tszAccountName, Skin_LoadProtoIcon(accs[i]->szModuleName, ID_STATUS_ONLINE), CMIF_SYSTEM | CMIF_KEEPUNTRANSLATED, MS_PROTO, pos++, (INT_PTR)accs[i]->szModuleName); @@ -824,8 +819,7 @@ static int TabsrmmButtonsInit(WPARAM, LPARAM) static void TabsrmmButtonsModify(MCONTACT hContact) { - if (!DirectoryExists(hContact)) - { + if (!DirectoryExists(hContact)) { BBButton bbd = {}; bbd.pszModuleName = MODULENAME; bbd.bbbFlags = BBSF_DISABLED | BBSF_HIDDEN; @@ -873,7 +867,7 @@ static int PluginInit(WPARAM, LPARAM) mi.position++; mi.name.w = LPGENW("Ignore"); mi.pszService = nullptr; - mi.hIcolibItem = IcoLib_GetIcon("miex_ignore"); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_IGNORE); hmenuIgnore = Menu_AddContactMenuItem(&mi); hIgnoreItem[0] = AddSubmenuItem(hmenuIgnore, ii[0].name, Skin_LoadIcon(ii[0].icon), 0, MS_IGNORE, pos, ii[0].type); @@ -881,7 +875,7 @@ static int PluginInit(WPARAM, LPARAM) for (int i = 1; i < _countof(ii); i++) hIgnoreItem[i] = AddSubmenuItem(hmenuIgnore, ii[i].name, Skin_LoadIcon(ii[i].icon), 0, MS_IGNORE, pos++, ii[i].type); - AddSubmenuItem(hmenuIgnore, LPGENW("Open ignore settings"), IcoLib_GetIcon("miex_ignore"), 0, MS_OPENIGNORE, pos, 0); + AddSubmenuItem(hmenuIgnore, LPGENW("Open ignore settings"), g_plugin.getIcon(IDI_IGNORE), 0, MS_OPENIGNORE, pos, 0); pos += 100000; // insert separator @@ -889,7 +883,7 @@ static int PluginInit(WPARAM, LPARAM) mi.position++; mi.name.w = LPGENW("Copy to Account"); mi.pszService = MS_PROTO; - mi.hIcolibItem = IcoLib_GetIcon("miex_protocol"); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_PROTOCOL); hmenuProto = Menu_AddContactMenuItem(&mi); EnumProtoSubmenu(0, 0); @@ -906,7 +900,7 @@ static int PluginInit(WPARAM, LPARAM) mi.position++; mi.name.w = LPGENW("Browse Received Files"); mi.pszService = MS_RECVFILES; - mi.hIcolibItem = IcoLib_GetIcon("miex_recfiles"); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_BROWSE); hmenuRecvFiles = Menu_AddContactMenuItem(&mi); SET_UID(mi, 0xf750f36b, 0x284f, 0x4841, 0x83, 0x18, 0xc7, 0x10, 0x4, 0x73, 0xea, 0x22); @@ -928,9 +922,9 @@ static int PluginInit(WPARAM, LPARAM) mi.pszService = MS_COPYMIRVER; hmenuCopyMirVer = Menu_AddContactMenuItem(&mi); - hIcons[0] = IcoLib_GetIcon("miex_copymver"); - hIcons[1] = IcoLib_GetIcon("miex_vis"); - hIcons[2] = IcoLib_GetIcon("miex_invis"); + hIcons[0] = g_plugin.getIcon(IDI_MIRVER); + hIcons[1] = g_plugin.getIcon(IDI_VISIBLE); + hIcons[2] = g_plugin.getIcon(IDI_INVISIBLE); hIcons[3] = MakeHalfAlphaIcon(hIcons[1]); hIcons[4] = MakeHalfAlphaIcon(hIcons[2]); @@ -940,10 +934,11 @@ static int PluginInit(WPARAM, LPARAM) return 0; } +///////////////////////////////////////////////////////////////////////////////////////// + int CMPlugin::Load() { - g_plugin.registerIcon(LPGEN("MenuItemEx"), iconList); - g_plugin.registerIcon(LPGEN("MenuItemEx"), overlayIconList); + g_plugin.registerIcon(LPGEN("MenuItemEx"), iconList, "miex"); CreateServiceFunction(MS_SETINVIS, onSetInvis); CreateServiceFunction(MS_SETVIS, onSetVis); diff --git a/plugins/MenuItemEx/src/resource.h b/plugins/MenuItemEx/src/resource.h index 1b51b15fe4..2cc96bb73b 100644 --- a/plugins/MenuItemEx/src/resource.h +++ b/plugins/MenuItemEx/src/resource.h @@ -4,18 +4,18 @@ // #define IDD_OPTIONS 101 #define IDD_AUTHREQ 103 -#define IDI_ICON0 110 -#define IDI_ICON1 111 -#define IDI_ICON2 112 -#define IDI_ICON3 113 -#define IDI_ICON6 116 -#define IDI_ICON7 117 -#define IDI_ICON8 118 -#define IDI_ICON9 119 -#define IDI_ICON10 120 -#define IDI_ICON11 121 -#define IDI_ICON12 122 -#define IDI_ICON13 123 +#define IDI_HIDE 110 +#define IDI_VISIBLE 111 +#define IDI_INVISIBLE 112 +#define IDI_COPYID 113 +#define IDI_PROTOCOL 116 +#define IDI_IGNORE 117 +#define IDI_SHOWINLIST 118 +#define IDI_COPYSTATUS 119 +#define IDI_COPYXSTATUS 120 +#define IDI_COPYIP 121 +#define IDI_BROWSE 122 +#define IDI_MIRVER 123 #define IDC_VIS 1000 #define IDC_REASON 1001 #define IDC_HIDE 1002 diff --git a/plugins/MirLua/src/Modules/m_icolib.cpp b/plugins/MirLua/src/Modules/m_icolib.cpp index 3f94e26894..97fa50ccb3 100644 --- a/plugins/MirLua/src/Modules/m_icolib.cpp +++ b/plugins/MirLua/src/Modules/m_icolib.cpp @@ -57,7 +57,7 @@ static int lua_AddIcon(lua_State *L) sid.description.w = mir_utf8decodeW(luaL_checkstring(L, 2)); sid.section.w = mir_utf8decodeW(luaL_optstring(L, 3, MODULENAME)); sid.defaultFile.w = mir_utf8decodeW(lua_tostring(L, 4)); - sid.hDefaultIcon = GetIcon(IDI_SCRIPT); + sid.hDefaultIcon = g_plugin.getIcon(IDI_SCRIPT); if (sid.defaultFile.w == nullptr) { sid.defaultFile.w = (wchar_t*)mir_calloc(MAX_PATH + 1); @@ -133,7 +133,7 @@ static int lua_RemoveIcon(lua_State *L) static luaL_Reg icolibApi[] = { { "AddIcon", lua_AddIcon }, - { "GetIcon", lua_GetIcon }, + { "g_plugin.getIcon", lua_GetIcon }, { "GetHandle", lua_GetIconHandle }, { "GetIconHandle", lua_GetIconHandle }, { "RemoveIcon", lua_RemoveIcon }, diff --git a/plugins/MirLua/src/icons.cpp b/plugins/MirLua/src/icons.cpp index 52940084f3..74e4d28136 100644 --- a/plugins/MirLua/src/icons.cpp +++ b/plugins/MirLua/src/icons.cpp @@ -14,21 +14,3 @@ void LoadIcons() { g_plugin.registerIcon(MODULENAME, Icons, MODULENAME); } - -HICON GetIcon(int iconId) -{ - for (auto &it : Icons) - if (it.defIconID == iconId) - return IcoLib_GetIconByHandle(it.hIcolib); - - return nullptr; -} - -HANDLE GetIconHandle(int iconId) -{ - for (auto &it : Icons) - if (it.defIconID == iconId) - return it.hIcolib; - - return nullptr; -} \ No newline at end of file diff --git a/plugins/MirLua/src/options.cpp b/plugins/MirLua/src/options.cpp index 83a8b9d7c8..f96a4a15a3 100644 --- a/plugins/MirLua/src/options.cpp +++ b/plugins/MirLua/src/options.cpp @@ -50,11 +50,11 @@ bool CMLuaOptionsMain::OnInitDialog() m_scriptsList.SetExtendedListViewStyle(LVS_EX_SUBITEMIMAGES | LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES | LVS_EX_INFOTIP); HIMAGELIST hImageList = m_scriptsList.CreateImageList(LVSIL_SMALL); - ImageList_AddIcon(hImageList, GetIcon(IDI_LOADED)); - ImageList_AddIcon(hImageList, GetIcon(IDI_FAILED)); - ImageList_AddIcon(hImageList, GetIcon(IDI_OPEN)); - ImageList_AddIcon(hImageList, GetIcon(IDI_RELOAD)); - ImageList_AddIcon(hImageList, GetIcon(IDI_COMPILE)); + ImageList_AddIcon(hImageList, g_plugin.getIcon(IDI_LOADED)); + ImageList_AddIcon(hImageList, g_plugin.getIcon(IDI_FAILED)); + ImageList_AddIcon(hImageList, g_plugin.getIcon(IDI_OPEN)); + ImageList_AddIcon(hImageList, g_plugin.getIcon(IDI_RELOAD)); + ImageList_AddIcon(hImageList, g_plugin.getIcon(IDI_COMPILE)); wchar_t scriptDir[MAX_PATH]; FoldersGetCustomPathT(g_hScriptsFolder, scriptDir, _countof(scriptDir), VARSW(MIRLUA_PATHT)); diff --git a/plugins/MirLua/src/stdafx.h b/plugins/MirLua/src/stdafx.h index cd4873de17..9c88b62ad4 100644 --- a/plugins/MirLua/src/stdafx.h +++ b/plugins/MirLua/src/stdafx.h @@ -72,8 +72,6 @@ void LoadNetlib(); void UnloadNetlib(); void LoadIcons(); -HICON GetIcon(int iconId); -HANDLE GetIconHandle(int iconId); /* utils */ diff --git a/plugins/NewXstatusNotify/src/indsnd.cpp b/plugins/NewXstatusNotify/src/indsnd.cpp index fc5b01d5e7..1dbbf99795 100644 --- a/plugins/NewXstatusNotify/src/indsnd.cpp +++ b/plugins/NewXstatusNotify/src/indsnd.cpp @@ -95,7 +95,7 @@ HIMAGELIST GetStatusIconsImgList(char *szProto) if (hList != nullptr) { for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX; i++) ImageList_AddIcon(hList, Skin_LoadProtoIcon(szProto, i)); - ImageList_AddIcon(hList, Skin_LoadIcon(SKINICON_OTHER_USERONLINE)); + ImageList_AddSkinIcon(hList, SKINICON_OTHER_USERONLINE); } } @@ -439,7 +439,7 @@ INT_PTR CALLBACK DlgProcFiltering(HWND hwndDlg, UINT msg, WPARAM, LPARAM lParam) ImageList_AddIcon(hImageList, IcoLib_GetIconByHandle(iconList[ICO_ENABLEALL].hIcolib)); SendDlgItemMessage(hwndDlg, IDC_ENABLEALLICON, STM_SETICON, (WPARAM)ImageList_GetIcon(hImageList, EXTRA_IMAGE_ENABLEALL, ILD_NORMAL), 0); - ImageList_AddIcon(hImageList, Skin_LoadIcon(SKINICON_OTHER_SMALLDOT)); + ImageList_AddSkinIcon(hImageList, SKINICON_OTHER_SMALLDOT); SendDlgItemMessage(hwndDlg, IDC_INDSNDLIST, CLM_SETEXTRAIMAGELIST, 0, (LPARAM)hImageList); SendDlgItemMessage(hwndDlg, IDC_INDSNDLIST, CLM_SETEXTRACOLUMNS, 8, 0); diff --git a/plugins/NoHistory/src/dllmain.cpp b/plugins/NoHistory/src/dllmain.cpp index 08412fae4f..d2a8de5f9e 100644 --- a/plugins/NoHistory/src/dllmain.cpp +++ b/plugins/NoHistory/src/dllmain.cpp @@ -142,9 +142,9 @@ int PrebuildContactMenu(WPARAM hContact, LPARAM) Menu_ShowItem(hMenuToggle, false); else { if (remove) - Menu_ModifyItem(hMenuToggle, LPGENW("Enable History"), hIconKeep); + Menu_ModifyItem(hMenuToggle, LPGENW("Enable History"), g_plugin.getIconHandle(IDI_HKEEP)); else - Menu_ModifyItem(hMenuToggle, LPGENW("Disable History"), hIconRemove); + Menu_ModifyItem(hMenuToggle, LPGENW("Disable History"), g_plugin.getIconHandle(IDI_HREMOVE)); } Menu_ShowItem(hMenuClear, !chat_room && db_event_count(hContact) > 0); @@ -210,12 +210,12 @@ void SrmmMenu_Load() sid.dwId = 0; sid.szTooltip.a = LPGEN("History Enabled"); - sid.hIcon = sid.hIconDisabled = hIconKeep; + sid.hIcon = sid.hIconDisabled = g_plugin.getIcon(IDI_HKEEP); Srmm_AddIcon(&sid, &g_plugin); sid.dwId = 1; sid.szTooltip.a = LPGEN("History Disabled"); - sid.hIcon = sid.hIconDisabled = hIconRemove; + sid.hIcon = sid.hIconDisabled = g_plugin.getIcon(IDI_HREMOVE); Srmm_AddIcon(&sid, &g_plugin); // hook the window events so that we can can change the status of the icon @@ -235,14 +235,14 @@ static int ModulesLoaded(WPARAM, LPARAM) mi.position = -300010; mi.name.w = LPGENW("Disable History"); mi.pszService = MS_NOHISTORY_TOGGLE; - mi.hIcolibItem = hIconRemove; + mi.hIcolibItem = g_plugin.getIconHandle(IDI_HREMOVE); hMenuToggle = Menu_AddContactMenuItem(&mi); SET_UID(mi, 0x1c4b1c21, 0xc0d1, 0x44d1, 0xb5, 0x3c, 0xc7, 0x8d, 0xcf, 0x96, 0x51, 0xd7); mi.position = -300005; mi.name.w = LPGENW("Clear History"); mi.pszService = MS_NOHISTORY_CLEAR; - mi.hIcolibItem = hIconClear; + mi.hIcolibItem = g_plugin.getIconHandle(IDI_HCLEAR); hMenuClear = Menu_AddContactMenuItem(&mi); // add icon to srmm status icons diff --git a/plugins/NoHistory/src/icons.cpp b/plugins/NoHistory/src/icons.cpp index b24cadf3c2..3b8dfbf2b6 100644 --- a/plugins/NoHistory/src/icons.cpp +++ b/plugins/NoHistory/src/icons.cpp @@ -1,7 +1,5 @@ #include "stdafx.h" -HICON hIconRemove, hIconKeep, hIconClear; - static IconItem iconList[] = { { LPGEN("Disable"), "remove", IDI_HREMOVE }, @@ -9,19 +7,7 @@ static IconItem iconList[] = { LPGEN("Clear"), "clear", IDI_HCLEAR }, }; -int ReloadIcons(WPARAM, LPARAM) -{ - hIconRemove = IcoLib_GetIconByHandle(iconList[0].hIcolib); - hIconKeep = IcoLib_GetIconByHandle(iconList[1].hIcolib); - hIconClear = IcoLib_GetIconByHandle(iconList[2].hIcolib); - return 0; -} - void InitIcons() { g_plugin.registerIcon(LPGEN("No History"), iconList, MODULENAME); - - ReloadIcons(0, 0); - - HookEvent(ME_SKIN_ICONSCHANGED, ReloadIcons); } diff --git a/plugins/NoHistory/src/icons.h b/plugins/NoHistory/src/icons.h index cfd2288c52..911549a8cd 100644 --- a/plugins/NoHistory/src/icons.h +++ b/plugins/NoHistory/src/icons.h @@ -1,8 +1,6 @@ #ifndef _ICONS_INC #define _ICONS_INC -extern HICON hIconRemove, hIconKeep, hIconClear; - void InitIcons(); #endif diff --git a/plugins/NoHistory/src/options.cpp b/plugins/NoHistory/src/options.cpp index c7e2a35027..3107787b21 100644 --- a/plugins/NoHistory/src/options.cpp +++ b/plugins/NoHistory/src/options.cpp @@ -102,11 +102,12 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA hwndList = GetDlgItem(hwndDlg, IDC_LIST); { HIMAGELIST hIml = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 2, 2); - ImageList_AddIcon(hIml, hIconKeep); - ImageList_AddIcon(hIml, hIconRemove); + g_plugin.addImgListIcon(hIml, IDI_HKEEP); + g_plugin.addImgListIcon(hIml, IDI_HREMOVE); SendMessage(hwndList, CLM_SETEXTRAIMAGELIST, 0, (LPARAM)hIml); - SendDlgItemMessage(hwndDlg, IDC_PIC_KEEP, STM_SETICON, (WPARAM)hIconKeep, 0); - SendDlgItemMessage(hwndDlg, IDC_PIC_REMOVE, STM_SETICON, (WPARAM)hIconRemove, 0); + + SendDlgItemMessage(hwndDlg, IDC_PIC_KEEP, STM_SETICON, (WPARAM)g_plugin.getIcon(IDI_HKEEP), 0); + SendDlgItemMessage(hwndDlg, IDC_PIC_REMOVE, STM_SETICON, (WPARAM)g_plugin.getIcon(IDI_HREMOVE), 0); } ResetListOptions(hwndList); SendMessage(hwndList, CLM_SETEXTRACOLUMNS, 1, 0); diff --git a/plugins/Popup/src/actions.cpp b/plugins/Popup/src/actions.cpp index 867e4d48bf..8b5d58d027 100644 --- a/plugins/Popup/src/actions.cpp +++ b/plugins/Popup/src/actions.cpp @@ -35,14 +35,14 @@ void LoadActions() { POPUPACTION actions[] = { - { 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 }, + { sizeof(POPUPACTION), g_plugin.getIcon(IDI_ACT_REPLY), LPGEN("General") "/" LPGEN("Quick reply"), 0 }, + { sizeof(POPUPACTION), g_plugin.getIcon(IDI_ACT_MESSAGE), LPGEN("General") "/" LPGEN("Send message"), 0 }, + { sizeof(POPUPACTION), g_plugin.getIcon(IDI_ACT_INFO), LPGEN("General") "/" LPGEN("User details"), 0 }, + { sizeof(POPUPACTION), g_plugin.getIcon(IDI_ACT_MENU), LPGEN("General") "/" LPGEN("Contact menu"), 0 }, + { sizeof(POPUPACTION), g_plugin.getIcon(IDI_ACT_ADD), LPGEN("General") "/" LPGEN("Add permanently"), 0 }, + { sizeof(POPUPACTION), g_plugin.getIcon(IDI_ACT_PIN), LPGEN("General") "/" LPGEN("Pin popup"), 0 }, + { sizeof(POPUPACTION), g_plugin.getIcon(IDI_ACT_CLOSE), LPGEN("General") "/" LPGEN("Dismiss popup"), 0 }, + { sizeof(POPUPACTION), g_plugin.getIcon(IDI_ACT_COPY), LPGEN("General") "/" LPGEN("Copy to clipboard"), 0 }, }; for (auto &it : actions) @@ -181,7 +181,7 @@ INT_PTR CALLBACK DlgProcPopupActions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM TranslateDialogDefault(hwnd); - SendDlgItemMessage(hwnd, IDC_ICO_INFO, STM_SETICON, (WPARAM)LoadIconEx(IDI_MB_INFO), 0); + SendDlgItemMessage(hwnd, IDC_ICO_INFO, STM_SETICON, (WPARAM)g_plugin.getIcon(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/history.cpp b/plugins/Popup/src/history.cpp index dd9f6afa62..db4f52baa2 100644 --- a/plugins/Popup/src/history.cpp +++ b/plugins/Popup/src/history.cpp @@ -132,7 +132,7 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM, LPARAM lPara ListBox_SetItemData(hwndList, ListBox_AddString(hwndList, L""), 0); } - Window_SetIcon_IcoLib(hwnd, GetIconHandle(IDI_HISTORY)); + Window_SetIcon_IcoLib(hwnd, g_plugin.getIconHandle(IDI_HISTORY)); if (gbHppInstalled && PopupOptions.UseHppHistoryLog) { logType = LOG_HPP; diff --git a/plugins/Popup/src/icons.cpp b/plugins/Popup/src/icons.cpp index 083593ac11..7e0df28a29 100644 --- a/plugins/Popup/src/icons.cpp +++ b/plugins/Popup/src/icons.cpp @@ -66,41 +66,7 @@ static IconItem iconList3[] = void InitIcons() { - g_plugin.registerIcon(SECT_POPUP, iconList1, MODULENAME); - g_plugin.registerIcon(SECT_POPUP SECT_POPUP_OPT, iconList2, MODULENAME); - g_plugin.registerIcon(SECT_POPUP SECT_POPUP_ACT, iconList3, MODULENAME); -} - -HICON LoadIconEx(int iconId, bool big) -{ - for (auto &it : iconList1) - if (it.defIconID == iconId) - return IcoLib_GetIconByHandle(it.hIcolib, big); - - for (auto &it : iconList2) - if (it.defIconID == iconId) - return IcoLib_GetIconByHandle(it.hIcolib, big); - - for (auto &it : iconList3) - if (it.defIconID == iconId) - return IcoLib_GetIconByHandle(it.hIcolib, big); - - return nullptr; -} - -HANDLE GetIconHandle(int iconId) -{ - for (auto &it : iconList1) - if (it.defIconID == iconId) - return it.hIcolib; - - for (auto &it : iconList2) - if (it.defIconID == iconId) - return it.hIcolib; - - for (auto &it : iconList3) - if (it.defIconID == iconId) - return it.hIcolib; - - return nullptr; + g_plugin.registerIcon(MODULNAME_PLU, iconList1, MODULENAME); + g_plugin.registerIcon(MODULNAME_PLU "/Options", iconList2, MODULENAME); + g_plugin.registerIcon(MODULNAME_PLU "/Actions", iconList3, MODULENAME); } diff --git a/plugins/Popup/src/icons.h b/plugins/Popup/src/icons.h deleted file mode 100644 index ad7ee64153..0000000000 --- a/plugins/Popup/src/icons.h +++ /dev/null @@ -1,37 +0,0 @@ -/* -Popup Plus plugin for Miranda IM - -Copyright © 2002 Luca Santarelli, -© 2004-2007 Victor Pavlychko -© 2010 MPK -© 2010 Merlin_de - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#ifndef __icons_h__ -#define __icons_h__ - -//ICONS -#define SECT_POPUP MODULNAME_PLU -#define SECT_POPUP_ACT "/Actions" -#define SECT_POPUP_OPT "/Options" -#define SECT_POPUP_MISC "/Misc" - -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 7dbf9a39fb..05923e9312 100644 --- a/plugins/Popup/src/main.cpp +++ b/plugins/Popup/src/main.cpp @@ -114,7 +114,7 @@ static int IconsChanged(WPARAM, LPARAM) Menu_ModifyItem(hMenuItem, nullptr, hIcon); Menu_ModifyItem(hMenuRoot, nullptr, hIcon); - Menu_ModifyItem(hMenuItemHistory, nullptr, GetIconHandle(IDI_HISTORY)); + Menu_ModifyItem(hMenuItemHistory, nullptr, g_plugin.getIconHandle(IDI_HISTORY)); return 0; } @@ -191,7 +191,7 @@ void InitMenuItems(void) CreateServiceFunction(mi.pszService, svcShowHistory); mi.position = 1000000000; mi.name.w = LPGENW("Popup history"); - mi.hIcolibItem = GetIconHandle(IDI_HISTORY); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_HISTORY); hMenuItemHistory = Menu_AddMainMenuItem(&mi); } diff --git a/plugins/Popup/src/notifications.cpp b/plugins/Popup/src/notifications.cpp index 48dc3c4f5c..c6a507893a 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.lchIcoLib = GetIconHandle(IDI_MB_WARN); + notification.lchIcoLib = g_plugin.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.lchIcoLib = GetIconHandle(IDI_MB_INFO); + notification.lchIcoLib = g_plugin.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.lchIcoLib = GetIconHandle(IDI_MB_STOP); + notification.lchIcoLib = g_plugin.getIconHandle(IDI_MB_STOP); notification.colorBack = RGB(191, 0, 0); notification.colorText = RGB(255, 245, 225); notification.iSeconds = -1; diff --git a/plugins/Popup/src/opt_adv.cpp b/plugins/Popup/src/opt_adv.cpp index 04dfe50948..a6bb89eacd 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)LoadIconEx(IDI_HISTORY)); + SendMessage(hCtrl, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(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 f68cca8e11..d2eb116c6e 100644 --- a/plugins/Popup/src/opt_class.cpp +++ b/plugins/Popup/src/opt_class.cpp @@ -178,7 +178,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, LoadIconEx(IDI_OPT_GROUP)); + ImageList_ReplaceIcon(hImgLst, -1, g_plugin.getIcon(IDI_OPT_GROUP)); TreeView_SetImageList(hwndTree, hImgLst, TVSIL_NORMAL); for (auto &p : gTreeData) { @@ -218,7 +218,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l (WPARAM)Translate(it.title), 0); } // info icon - SendDlgItemMessage(hwnd, IDC_ICO_INFO, STM_SETICON, (WPARAM)LoadIconEx(IDI_MB_INFO), 0); + SendDlgItemMessage(hwnd, IDC_ICO_INFO, STM_SETICON, (WPARAM)g_plugin.getIcon(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 af65fe46f5..55b17d1655 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)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); + SendDlgItemMessage(hwnd, IDC_ICO_AUTO, STM_SETICON, (WPARAM)g_plugin.getIcon(IDI_ACT_OK), 0); + SendDlgItemMessage(hwnd, IDC_ICO_FAVORITE, STM_SETICON, (WPARAM)g_plugin.getIcon(IDI_OPT_FAVORITE), 0); + SendDlgItemMessage(hwnd, IDC_ICO_FULLSCREEN, STM_SETICON, (WPARAM)g_plugin.getIcon(IDI_OPT_FULLSCREEN), 0); + SendDlgItemMessage(hwnd, IDC_ICO_BLOCK, STM_SETICON, (WPARAM)g_plugin.getIcon(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, 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)); + ImageList_AddSkinIcon(hIml, SKINICON_OTHER_SMALLDOT); + g_plugin.addImgListIcon(hIml, IDI_ACT_OK); + g_plugin.addImgListIcon(hIml, IDI_OPT_FAVORITE); + g_plugin.addImgListIcon(hIml, IDI_OPT_FULLSCREEN); + g_plugin.addImgListIcon(hIml, 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 ebe0c4d6e0..6503332b2c 100644 --- a/plugins/Popup/src/opt_gen.cpp +++ b/plugins/Popup/src/opt_gen.cpp @@ -181,7 +181,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)L"Popup area", BATF_UNICODE); - SendMessage(hCtrl, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx(IDI_RESIZE)); + SendMessage(hCtrl, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(IDI_RESIZE)); } // Spreading combobox { @@ -623,11 +623,11 @@ INT_PTR CALLBACK PositionBoxDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA SendDlgItemMessage(hwndDlg, IDOK, BUTTONSETASFLATBTN, TRUE, 0); SendDlgItemMessage(hwndDlg, IDOK, BUTTONADDTOOLTIP, (WPARAM)L"OK", BATF_UNICODE); - SendDlgItemMessage(hwndDlg, IDOK, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx(IDI_ACT_OK)); + SendDlgItemMessage(hwndDlg, IDOK, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(IDI_ACT_OK)); SendDlgItemMessage(hwndDlg, IDCANCEL, BUTTONSETASFLATBTN, TRUE, 0); SendDlgItemMessage(hwndDlg, IDCANCEL, BUTTONADDTOOLTIP, (WPARAM)L"Cancel", BATF_UNICODE); - SendDlgItemMessage(hwndDlg, IDCANCEL, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx(IDI_ACT_CLOSE)); + SendDlgItemMessage(hwndDlg, IDCANCEL, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(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 458cf19f6a..43267d16b4 100644 --- a/plugins/Popup/src/opt_skins.cpp +++ b/plugins/Popup/src/opt_skins.cpp @@ -348,7 +348,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)LoadIconEx(IDI_RELOAD)); + SendDlgItemMessage(hwndDlg, IDC_BTN_RELOAD, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(IDI_RELOAD)); SendDlgItemMessage(hwndDlg, IDC_BTN_RELOAD, BUTTONADDTOOLTIP, (WPARAM)Translate("Refresh List"), 0); // Skin Option List diff --git a/plugins/Popup/src/popup_wnd2.cpp b/plugins/Popup/src/popup_wnd2.cpp index 1f7fa7b44c..16c0c2c5de 100644 --- a/plugins/Popup/src/popup_wnd2.cpp +++ b/plugins/Popup/src/popup_wnd2.cpp @@ -544,7 +544,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 = LoadIconEx(IDI_ACT_REPLY, iconSize); + m_actions[iAction].actionA.lchIcon = g_plugin.getIcon(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; @@ -553,7 +553,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 = LoadIconEx(IDI_ACT_MESSAGE, iconSize); + m_actions[iAction].actionA.lchIcon = g_plugin.getIcon(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; @@ -562,7 +562,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 = LoadIconEx(IDI_ACT_INFO, iconSize); + m_actions[iAction].actionA.lchIcon = g_plugin.getIcon(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; @@ -571,7 +571,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 = LoadIconEx(IDI_ACT_MENU, iconSize); + m_actions[iAction].actionA.lchIcon = g_plugin.getIcon(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; @@ -580,7 +580,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 = LoadIconEx(IDI_ACT_ADD, iconSize); + m_actions[iAction].actionA.lchIcon = g_plugin.getIcon(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; @@ -589,7 +589,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 ? LoadIconEx(IDI_ACT_PINNED, iconSize) : LoadIconEx(IDI_ACT_PIN, iconSize); + m_actions[iAction].actionA.lchIcon = m_bIsPinned ? g_plugin.getIcon(IDI_ACT_PINNED, iconSize) : g_plugin.getIcon(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; @@ -598,7 +598,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 = LoadIconEx(IDI_ACT_CLOSE, iconSize); + m_actions[iAction].actionA.lchIcon = g_plugin.getIcon(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; @@ -607,7 +607,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 = LoadIconEx(IDI_ACT_COPY, iconSize); + m_actions[iAction].actionA.lchIcon = g_plugin.getIcon(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; @@ -941,7 +941,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 ? LoadIconEx(IDI_ACT_PINNED, iconSize) : LoadIconEx(IDI_ACT_PIN, iconSize)); + PUModifyActionIcon(m_hwnd, wParam, lParam, m_bIsPinned ? g_plugin.getIcon(IDI_ACT_PINNED, iconSize) : g_plugin.getIcon(IDI_ACT_PIN, iconSize)); } break; diff --git a/plugins/Popup/src/services.cpp b/plugins/Popup/src/services.cpp index 9a87bbcf81..cafe1a5093 100644 --- a/plugins/Popup/src/services.cpp +++ b/plugins/Popup/src/services.cpp @@ -237,21 +237,21 @@ INT_PTR Popup_ShowMessageW(WPARAM wParam, LPARAM lParam) ppd2.szText.w = (wchar_t*)wParam; switch (lParam & 0x7fffffff) { case SM_ERROR: - ppd2.lchIcon = LoadIconEx(IDI_MB_STOP, 0); + ppd2.lchIcon = g_plugin.getIcon(IDI_MB_STOP, 0); ppd2.colorBack = RGB(191, 0, 0); ppd2.colorText = RGB(255, 245, 225); ppd2.lchNotification = g_hntfError; ppd2.szTitle.w = TranslateT("Error"); break; case SM_WARNING: - ppd2.lchIcon = LoadIconEx(IDI_MB_WARN, 0); + ppd2.lchIcon = g_plugin.getIcon(IDI_MB_WARN, 0); ppd2.colorBack = RGB(210, 210, 150); ppd2.colorText = RGB(0, 0, 0); ppd2.lchNotification = g_hntfWarning; ppd2.szTitle.w = TranslateT("Warning"); break; case SM_NOTIFY: - ppd2.lchIcon = LoadIconEx(IDI_MB_INFO, 0); + ppd2.lchIcon = g_plugin.getIcon(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 885bb4fa38..cf52439b79 100644 --- a/plugins/Popup/src/srmm_menu.cpp +++ b/plugins/Popup/src/srmm_menu.cpp @@ -108,12 +108,12 @@ void SrmmMenu_Load() sid.dwId = 1; sid.szTooltip.a = LPGEN("Popup Mode: Favorite"); - sid.hIcon = sid.hIconDisabled = LoadIconEx(IDI_OPT_FAVORITE); + sid.hIcon = sid.hIconDisabled = g_plugin.getIcon(IDI_OPT_FAVORITE); Srmm_AddIcon(&sid, &g_plugin); sid.dwId = 2; sid.szTooltip.a = LPGEN("Popup Mode: Ignore fullscreen"); - sid.hIcon = sid.hIconDisabled = LoadIconEx(IDI_OPT_FULLSCREEN); + sid.hIcon = sid.hIconDisabled = g_plugin.getIcon(IDI_OPT_FULLSCREEN); Srmm_AddIcon(&sid, &g_plugin); sid.dwId = 3; diff --git a/plugins/Popup/src/stdafx.h b/plugins/Popup/src/stdafx.h index d91eb951ec..f463dd9f86 100644 --- a/plugins/Popup/src/stdafx.h +++ b/plugins/Popup/src/stdafx.h @@ -123,7 +123,6 @@ struct CMPlugin : public PLUGIN #include "services.h" #include "srmm_menu.h" #include "bitmap_funcs.h" -#include "icons.h" #include "font.h" #include "formula.h" #include "skin.h" @@ -141,4 +140,6 @@ struct CMPlugin : public PLUGIN INT_PTR svcEnableDisableMenuCommand(WPARAM, LPARAM); +void InitIcons(); + #endif //HEADERS_H diff --git a/plugins/Scriver/src/chat_main.cpp b/plugins/Scriver/src/chat_main.cpp index 9bd5f5b4f2..6fdf6ac8bc 100644 --- a/plugins/Scriver/src/chat_main.cpp +++ b/plugins/Scriver/src/chat_main.cpp @@ -88,8 +88,7 @@ static MODULEINFO* MM_CreateModule() static void OnCreateModule(MODULEINFO *mi) { HIMAGELIST hList = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 0, 0); - - int overlayIcon = ImageList_AddIcon(hList, GetCachedIcon("chat_overlay")); + int overlayIcon = g_plugin.addImgListIcon(hList, IDI_OVERLAY); ImageList_SetOverlayImage(hList, overlayIcon, 1); int index = ImageList_AddIcon(hList, Skin_LoadProtoIcon(mi->pszModule, ID_STATUS_ONLINE)); diff --git a/plugins/Scriver/src/chat_window.cpp b/plugins/Scriver/src/chat_window.cpp index d3b8863594..9b31e2e3bc 100644 --- a/plugins/Scriver/src/chat_window.cpp +++ b/plugins/Scriver/src/chat_window.cpp @@ -346,7 +346,7 @@ void CChatRoomDlg::onClick_ShowList(CCtrlButton *pButton) return; m_bNicklistEnabled = !m_bNicklistEnabled; - pButton->SendMsg(BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon(m_bNicklistEnabled ? "chat_nicklist" : "chat_nicklist2")); + pButton->SendMsg(BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(m_bNicklistEnabled ? IDI_NICKLIST : IDI_NICKLIST2)); ScrollToBottom(); Resize(); } @@ -357,7 +357,7 @@ void CChatRoomDlg::onClick_Filter(CCtrlButton *pButton) return; m_bFilterEnabled = !m_bFilterEnabled; - pButton->SendMsg(BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon(m_bFilterEnabled ? "chat_filter" : "chat_filter2")); + pButton->SendMsg(BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(m_bFilterEnabled ? IDI_FILTER : IDI_FILTER2)); if (m_bFilterEnabled && db_get_b(0, CHAT_MODULE, "RightClickFilter", 0) == 0) ShowFilterMenu(); else @@ -450,8 +450,8 @@ void CChatRoomDlg::UpdateNickList() void CChatRoomDlg::UpdateOptions() { - m_btnNickList.SendMsg(BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon(m_bNicklistEnabled ? "chat_nicklist" : "chat_nicklist2")); - m_btnFilter.SendMsg(BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon(m_bFilterEnabled ? "chat_filter" : "chat_filter2")); + m_btnNickList.SendMsg(BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(m_bNicklistEnabled ? IDI_NICKLIST : IDI_NICKLIST2)); + m_btnFilter.SendMsg(BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(m_bFilterEnabled ? IDI_FILTER : IDI_FILTER2)); m_btnBold.Enable(m_si->pMI->bBold); m_btnItalic.Enable(m_si->pMI->bItalics); @@ -523,7 +523,7 @@ void CChatRoomDlg::UpdateTitle() TitleBarData tbd = {}; tbd.hIcon = (m_si->wStatus == ID_STATUS_ONLINE) ? m_si->pMI->hOnlineIcon : m_si->pMI->hOfflineIcon; tbd.hIconBig = (m_si->wStatus == ID_STATUS_ONLINE) ? m_si->pMI->hOnlineIconBig : m_si->pMI->hOfflineIconBig; - tbd.hIconNot = (m_si->wState & (GC_EVENT_HIGHLIGHT | STATE_TALK)) ? GetCachedIcon("chat_overlay") : nullptr; + tbd.hIconNot = (m_si->wState & (GC_EVENT_HIGHLIGHT | STATE_TALK)) ? g_plugin.getIcon(IDI_OVERLAY) : nullptr; int nUsers = m_si->getUserList().getCount(); wchar_t szTemp[512]; diff --git a/plugins/Scriver/src/globals.cpp b/plugins/Scriver/src/globals.cpp index 6a06f414d7..0e4ba89823 100644 --- a/plugins/Scriver/src/globals.cpp +++ b/plugins/Scriver/src/globals.cpp @@ -25,86 +25,86 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. GlobalMessageData g_dat; -static const char *buttonIcons[] = +static int buttonIcons[] = { - "scriver_CLOSEX", "scriver_QUOTE", "scriver_ADD", nullptr, - "scriver_USERDETAILS", "scriver_HISTORY", "scriver_SEND" + IDI_CLOSEX, IDI_QUOTE, IDI_ADDCONTACT, 0, + IDI_USERDETAILS, IDI_HISTORY, IDI_SEND }; -static const char *chatButtonIcons[] = +static int chatButtonIcons[] = { - "scriver_CLOSEX", "chat_bold", "chat_italics", "chat_underline", - "chat_fgcol", "chat_bkgcol", "chat_history", "chat_filter", - "chat_settings", "chat_nicklist", "scriver_SEND" + IDI_CLOSEX, IDI_BBOLD, IDI_BITALICS, IDI_BUNDERLINE, + IDI_COLOR, IDI_BKGCOLOR, IDI_HISTORY, IDI_FILTER, + IDI_TOPICBUT, IDI_NICKLIST, IDI_SEND }; static IconItem iconList1[] = { - { LPGEN("Add contact"), "scriver_ADD", IDI_ADDCONTACT }, // 1 - { LPGEN("User's details"), "scriver_USERDETAILS", IDI_USERDETAILS }, // 2 - { LPGEN("User's history"), "scriver_HISTORY", IDI_HISTORY }, // 3 - { LPGEN("Send message"), "scriver_SEND", IDI_SEND }, // 4 - { LPGEN("Smiley button"), "scriver_SMILEY", IDI_SMILEY }, // 5 - { LPGEN("User is typing"), "scriver_TYPING", IDI_TYPING }, // 6 - { LPGEN("Typing notification off"), "scriver_TYPINGOFF", IDI_TYPINGOFF }, // 7 - { LPGEN("Sending"), "scriver_DELIVERING", IDI_TIMESTAMP }, // 8 - { LPGEN("Quote button"), "scriver_QUOTE", IDI_QUOTE }, // 9 - { LPGEN("Close button"), "scriver_CLOSEX", IDI_CLOSEX }, // 10 - { LPGEN("Icon overlay"), "scriver_OVERLAY", IDI_OVERLAY }, // 11 - { LPGEN("Incoming message (10x10)"),"scriver_INCOMING", IDI_INCOMING, 10}, // 12 - { LPGEN("Outgoing message (10x10)"),"scriver_OUTGOING", IDI_OUTGOING, 10}, // 13 - { LPGEN("Notice (10x10)"), "scriver_NOTICE", IDI_NOTICE, 10}, // 14 + { LPGEN("Add contact"), "ADD", IDI_ADDCONTACT }, // 1 + { LPGEN("User's details"), "USERDETAILS", IDI_USERDETAILS }, // 2 + { LPGEN("User's history"), "HISTORY", IDI_HISTORY }, // 3 + { LPGEN("Send message"), "SEND", IDI_SEND }, // 4 + { LPGEN("Smiley button"), "SMILEY", IDI_SMILEY }, // 5 + { LPGEN("User is typing"), "TYPING", IDI_TYPING }, // 6 + { LPGEN("Typing notification off"), "TYPINGOFF", IDI_TYPINGOFF }, // 7 + { LPGEN("Sending"), "DELIVERING", IDI_TIMESTAMP }, // 8 + { LPGEN("Quote button"), "QUOTE", IDI_QUOTE }, // 9 + { LPGEN("Close button"), "CLOSEX", IDI_CLOSEX }, // 10 + { LPGEN("Icon overlay"), "OVERLAY", IDI_OVERLAY }, // 11 + { LPGEN("Incoming message (10x10)"),"INCOMING", IDI_INCOMING, 10}, // 12 + { LPGEN("Outgoing message (10x10)"),"OUTGOING", IDI_OUTGOING, 10}, // 13 + { LPGEN("Notice (10x10)"), "NOTICE", IDI_NOTICE, 10}, // 14 }; static IconItem iconList2[] = { - { LPGEN("Window Icon"), "chat_window", IDI_CHANMGR }, // 1 - { LPGEN("Text color"), "chat_fgcol", IDI_COLOR }, // 2 - { LPGEN("Background color") , "chat_bkgcol", IDI_BKGCOLOR }, // 3 - { LPGEN("Bold"), "chat_bold", IDI_BBOLD }, // 4 - { LPGEN("Italics"), "chat_italics", IDI_BITALICS }, // 5 - { LPGEN("Underlined"), "chat_underline", IDI_BUNDERLINE }, // 6 - { LPGEN("Smiley button"), "chat_smiley", IDI_SMILEY }, // 7 - { LPGEN("Room history"), "chat_history", IDI_HISTORY }, // 8 - { LPGEN("Room settings"), "chat_settings", IDI_TOPICBUT }, // 9 - { LPGEN("Event filter disabled"), "chat_filter", IDI_FILTER }, // 10 - { LPGEN("Event filter enabled"), "chat_filter2", IDI_FILTER2 }, // 11 - { LPGEN("Hide nick list"), "chat_nicklist", IDI_NICKLIST }, // 12 - { LPGEN("Show nick list"), "chat_nicklist2", IDI_NICKLIST2 }, // 13 - { LPGEN("Icon overlay"), "chat_overlay", IDI_OVERLAY }, // 14 - { LPGEN("Status 1 (10x10)"), "chat_status0", IDI_STATUS0, 10}, // 15 - { LPGEN("Status 2 (10x10)"), "chat_status1", IDI_STATUS1, 10}, // 16 - { LPGEN("Status 3 (10x10)"), "chat_status2", IDI_STATUS2, 10}, // 17 - { LPGEN("Status 4 (10x10)"), "chat_status3", IDI_STATUS3, 10}, // 18 - { LPGEN("Status 5 (10x10)"), "chat_status4", IDI_STATUS4, 10}, // 19 - { LPGEN("Status 6 (10x10)"), "chat_status5", IDI_STATUS5, 10}, // 20 + { LPGEN("Window Icon"), "window", IDI_CHANMGR }, // 1 + { LPGEN("Text color"), "fgcol", IDI_COLOR }, // 2 + { LPGEN("Background color") , "bkgcol", IDI_BKGCOLOR }, // 3 + { LPGEN("Bold"), "bold", IDI_BBOLD }, // 4 + { LPGEN("Italics"), "italics", IDI_BITALICS }, // 5 + { LPGEN("Underlined"), "underline", IDI_BUNDERLINE }, // 6 + { LPGEN("Smiley button"), "smiley", IDI_SMILEY }, // 7 + { LPGEN("Room history"), "history", IDI_HISTORY }, // 8 + { LPGEN("Room settings"), "settings", IDI_TOPICBUT }, // 9 + { LPGEN("Event filter disabled"), "filter", IDI_FILTER }, // 10 + { LPGEN("Event filter enabled"), "filter2", IDI_FILTER2 }, // 11 + { LPGEN("Hide nick list"), "nicklist", IDI_NICKLIST }, // 12 + { LPGEN("Show nick list"), "nicklist2", IDI_NICKLIST2 }, // 13 + { LPGEN("Icon overlay"), "overlay", IDI_OVERLAY }, // 14 + { LPGEN("Status 1 (10x10)"), "status0", IDI_STATUS0, 10}, // 15 + { LPGEN("Status 2 (10x10)"), "status1", IDI_STATUS1, 10}, // 16 + { LPGEN("Status 3 (10x10)"), "status2", IDI_STATUS2, 10}, // 17 + { LPGEN("Status 4 (10x10)"), "status3", IDI_STATUS3, 10}, // 18 + { LPGEN("Status 5 (10x10)"), "status4", IDI_STATUS4, 10}, // 19 + { LPGEN("Status 6 (10x10)"), "status5", IDI_STATUS5, 10}, // 20 }; static IconItem iconList3[] = { - { LPGEN("Message in (10x10)"), "chat_log_message_in", IDI_INCOMING, 10}, // 1 - { LPGEN("Message out (10x10)"), "chat_log_message_out", IDI_OUTGOING, 10}, // 2 - { LPGEN("Action (10x10)"), "chat_log_action", IDI_ACTION, 10}, // 3 - { LPGEN("Add Status (10x10)"), "chat_log_addstatus", IDI_ADDSTATUS,10}, // 4 - { LPGEN("Remove status (10x10)"), "chat_log_removestatus", IDI_REMSTATUS,10}, // 5 - { LPGEN("Join (10x10)"), "chat_log_join", IDI_JOIN, 10}, // 6 - { LPGEN("Leave (10x10)"), "chat_log_part", IDI_PART, 10}, // 7 - { LPGEN("Quit (10x10)"), "chat_log_quit", IDI_QUIT, 10}, // 8 - { LPGEN("Kick (10x10)"), "chat_log_kick", IDI_KICK, 10}, // 9 - { LPGEN("Nickchange (10x10)"), "chat_log_nick", IDI_NICK, 10}, // 10 - { LPGEN("Notice (10x10)"), "chat_log_notice", IDI_CHAT_NOTICE, 10}, // 11 - { LPGEN("Topic (10x10)"), "chat_log_topic", IDI_TOPIC, 10}, // 12 - { LPGEN("Highlight (10x10)"), "chat_log_highlight", IDI_NOTICE, 10}, // 13 - { LPGEN("Information (10x10)"), "chat_log_info", IDI_INFO, 10}, // 14 + { LPGEN("Message in (10x10)"), "log_message_in", IDI_INCOMING, 10}, // 1 + { LPGEN("Message out (10x10)"), "log_message_out", IDI_OUTGOING, 10}, // 2 + { LPGEN("Action (10x10)"), "log_action", IDI_ACTION, 10}, // 3 + { LPGEN("Add Status (10x10)"), "log_addstatus", IDI_ADDSTATUS,10}, // 4 + { LPGEN("Remove status (10x10)"), "log_removestatus", IDI_REMSTATUS,10}, // 5 + { LPGEN("Join (10x10)"), "log_join", IDI_JOIN, 10}, // 6 + { LPGEN("Leave (10x10)"), "log_part", IDI_PART, 10}, // 7 + { LPGEN("Quit (10x10)"), "log_quit", IDI_QUIT, 10}, // 8 + { LPGEN("Kick (10x10)"), "log_kick", IDI_KICK, 10}, // 9 + { LPGEN("Nickchange (10x10)"), "log_nick", IDI_NICK, 10}, // 10 + { LPGEN("Notice (10x10)"), "log_notice", IDI_CHAT_NOTICE, 10}, // 11 + { LPGEN("Topic (10x10)"), "log_topic", IDI_TOPIC, 10}, // 12 + { LPGEN("Highlight (10x10)"), "log_highlight", IDI_NOTICE, 10}, // 13 + { LPGEN("Information (10x10)"), "log_info", IDI_INFO, 10}, // 14 }; void RegisterIcons(void) { HookEvent(ME_SKIN_ICONSCHANGED, IconsChanged); - g_plugin.registerIcon(LPGEN("Single Messaging"), iconList1); - g_plugin.registerIcon(LPGEN("Group chats"), iconList2); - g_plugin.registerIcon(LPGEN("Single Messaging"), iconList3); + g_plugin.registerIcon(LPGEN("Single Messaging"), iconList1, "scriver"); + g_plugin.registerIcon(LPGEN("Group chats"), iconList2, "chat"); + g_plugin.registerIcon(LPGEN("Single Messaging"), iconList3, "chat"); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -215,23 +215,6 @@ void ReleaseIcons() IcoLib_ReleaseIcon(g_dat.hIconChatBig); } -HICON GetCachedIcon(const char *name) -{ - for (auto &it : iconList1) - if (!mir_strcmp(it.szName, name)) - return IcoLib_GetIconByHandle(it.hIcolib); - - for (auto &it : iconList2) - if (!mir_strcmp(it.szName, name)) - return IcoLib_GetIconByHandle(it.hIcolib); - - for (auto &it : iconList3) - if (!mir_strcmp(it.szName, name)) - return IcoLib_GetIconByHandle(it.hIcolib); - - return nullptr; -} - void LoadGlobalIcons() { g_dat.hMsgIcon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE); @@ -244,18 +227,20 @@ void LoadGlobalIcons() ImageList_RemoveAll(g_dat.hSearchEngineIconList); for (auto &it : buttonIcons) { - if (it == nullptr) + if (it == 0) ImageList_AddIcon_ProtoEx(g_dat.hButtonIconList, nullptr, ID_STATUS_OFFLINE); else - ImageList_AddIcon(g_dat.hButtonIconList, GetCachedIcon(it)); + g_plugin.addImgListIcon(g_dat.hButtonIconList, it); } for (auto &it : chatButtonIcons) - ImageList_AddIcon(g_dat.hChatButtonIconList, GetCachedIcon(it)); + g_plugin.addImgListIcon(g_dat.hChatButtonIconList, it); - ImageList_AddIcon(g_dat.hHelperIconList, GetCachedIcon("scriver_OVERLAY")); - int overlayIcon = ImageList_AddIcon(g_dat.hHelperIconList, GetCachedIcon("scriver_OVERLAY")); + g_plugin.addImgListIcon(g_dat.hHelperIconList, IDI_OVERLAY); + + int overlayIcon = g_plugin.addImgListIcon(g_dat.hHelperIconList, IDI_OVERLAY); ImageList_SetOverlayImage(g_dat.hHelperIconList, overlayIcon, 1); + for (int i = IDI_GOOGLE; i < IDI_LASTICON; i++) { HICON hIcon = (HICON)LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(i), IMAGE_ICON, 0, 0, 0); ImageList_AddIcon(g_dat.hSearchEngineIconList, hIcon); diff --git a/plugins/Scriver/src/globals.h b/plugins/Scriver/src/globals.h index 7bb80122aa..da1b381213 100644 --- a/plugins/Scriver/src/globals.h +++ b/plugins/Scriver/src/globals.h @@ -128,7 +128,6 @@ void ReloadGlobals(); void RegisterIcons(); void ReleaseIcons(); void LoadGlobalIcons(); -HICON GetCachedIcon(const char *name); void RegisterFontServiceFonts(); int ImageList_AddIcon_Ex(HIMAGELIST hIml, int id); diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index 91db9a165a..9444c5078b 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -584,7 +584,7 @@ void CSrmmWindow::onChanged_Splitter(CSplitter *pSplitter) HICON CSrmmWindow::GetTabIcon() { if (m_bShowTyping) - return GetCachedIcon("scriver_TYPING"); + return g_plugin.getIcon(IDI_TYPING); if (m_iShowUnread != 0) return m_hStatusIconOverlay; @@ -595,7 +595,7 @@ HICON CSrmmWindow::GetTabIcon() void CSrmmWindow::GetTitlebarIcon(TitleBarData *tbd) { if (m_bShowTyping && (g_dat.flags2 & SMF2_SHOWTYPINGWIN)) - tbd->hIconNot = tbd->hIcon = GetCachedIcon("scriver_TYPING"); + tbd->hIconNot = tbd->hIcon = g_plugin.getIcon(IDI_TYPING); else if (m_iShowUnread && (GetActiveWindow() != m_hwndParent || GetForegroundWindow() != m_hwndParent)) { tbd->hIcon = m_hStatusIcon; tbd->hIconNot = g_dat.hMsgIcon; @@ -747,12 +747,12 @@ void CSrmmWindow::UpdateStatusBar() StatusBarData sbd = { 0 }; sbd.iFlags = SBDF_TEXT | SBDF_ICON; if (m_iMessagesInProgress && (g_dat.flags & SMF_SHOWPROGRESS)) { - sbd.hIcon = GetCachedIcon("scriver_DELIVERING"); + sbd.hIcon = g_plugin.getIcon(IDI_TIMESTAMP); sbd.pszText = szText; mir_snwprintf(szText, TranslateT("Sending in progress: %d message(s) left..."), m_iMessagesInProgress); } else if (m_nTypeSecs) { - sbd.hIcon = GetCachedIcon("scriver_TYPING"); + sbd.hIcon = g_plugin.getIcon(IDI_TYPING); sbd.pszText = szText; mir_snwprintf(szText, TranslateT("%s is typing a message..."), Clist_GetContactDisplayName(m_hContact)); m_nTypeSecs--; diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp index bcea9f130e..67de067e91 100644 --- a/plugins/Scriver/src/msglog.cpp +++ b/plugins/Scriver/src/msglog.cpp @@ -793,17 +793,17 @@ void LoadMsgLogIcons(void) for (int i = 0; i < _countof(pLogIconBmpBits); i++) { switch (i) { case LOGICON_MSG_IN: - ImageList_AddIcon(g_hImageList, GetCachedIcon("scriver_INCOMING")); + g_plugin.addImgListIcon(g_hImageList, IDI_INCOMING); hIcon = ImageList_GetIcon(g_hImageList, LOGICON_MSG_IN, ILD_NORMAL); hBrush = hInBkgBrush; break; case LOGICON_MSG_OUT: - ImageList_AddIcon(g_hImageList, GetCachedIcon("scriver_OUTGOING")); + g_plugin.addImgListIcon(g_hImageList, IDI_OUTGOING); hIcon = ImageList_GetIcon(g_hImageList, LOGICON_MSG_OUT, ILD_NORMAL); hBrush = hOutBkgBrush; break; case LOGICON_MSG_NOTICE: - ImageList_AddIcon(g_hImageList, GetCachedIcon("scriver_NOTICE")); + g_plugin.addImgListIcon(g_hImageList, IDI_NOTICE); hIcon = ImageList_GetIcon(g_hImageList, LOGICON_MSG_NOTICE, ILD_NORMAL); hBrush = hBkgBrush; break; diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp index 8355dc8868..5b16986d68 100644 --- a/plugins/Scriver/src/msgs.cpp +++ b/plugins/Scriver/src/msgs.cpp @@ -205,7 +205,7 @@ static int TypingMessage(WPARAM hContact, LPARAM lParam) cle.hContact = hContact; cle.hDbEvent = 1; cle.flags = CLEF_ONLYAFEW | CLEF_UNICODE; - cle.hIcon = GetCachedIcon("scriver_TYPING"); + cle.hIcon = g_plugin.getIcon(IDI_TYPING); cle.pszService = MS_MSG_TYPINGMESSAGE; cle.szTooltip.w = szTip; g_clistApi.pfnAddEvent(&cle); @@ -402,8 +402,8 @@ static void RegisterStatusIcons() StatusIconData sid = {}; sid.szModule = SRMM_MODULE; sid.dwId = 1; - sid.hIcon = GetCachedIcon("scriver_TYPING"); - sid.hIconDisabled = GetCachedIcon("scriver_TYPINGOFF"); + sid.hIcon = g_plugin.getIcon(IDI_TYPING); + sid.hIconDisabled = g_plugin.getIcon(IDI_TYPINGOFF); sid.flags = MBF_HIDDEN; Srmm_AddIcon(&sid, &g_plugin); } diff --git a/plugins/SecureIM/src/loadicons.cpp b/plugins/SecureIM/src/loadicons.cpp index 6ae33f233d..5a1eea67a3 100644 --- a/plugins/SecureIM/src/loadicons.cpp +++ b/plugins/SecureIM/src/loadicons.cpp @@ -42,7 +42,7 @@ static icons[] = { IDI_OV_RSA, TBL_ICO, ICO_OV_RSA, MODULENAME "/" LPGEN("Overlays"), "sim_ov_rsa", LPGEN("RSA/AES mode") }, }; -HINSTANCE LoadIconsPack(const char* szIconsPack) +HINSTANCE LoadIconsPack(const char *szIconsPack) { HINSTANCE hNewIconInst = LoadLibrary(szIconsPack); if (hNewIconInst != nullptr) { diff --git a/plugins/SimpleStatusMsg/src/awaymsg.cpp b/plugins/SimpleStatusMsg/src/awaymsg.cpp index d5ce014c16..0e0b646b29 100644 --- a/plugins/SimpleStatusMsg/src/awaymsg.cpp +++ b/plugins/SimpleStatusMsg/src/awaymsg.cpp @@ -353,7 +353,7 @@ int LoadAwayMsgModule(void) SET_UID(mi, 0x311124e9, 0xb477, 0x42ef, 0x84, 0xd2, 0xc, 0x6c, 0x50, 0x3f, 0x4a, 0x84); CreateServiceFunction(MS_SIMPLESTATUSMSG_COPYMSG, CopyAwayMsgCommand); mi.position = -2000006000; - mi.hIcolibItem = GetIconHandle(IDI_COPY); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_COPY); mi.name.w = LPGENW("Copy Away message"); mi.pszService = MS_SIMPLESTATUSMSG_COPYMSG; hCopyMsgMenuItem = Menu_AddContactMenuItem(&mi); @@ -361,7 +361,7 @@ int LoadAwayMsgModule(void) SET_UID(mi, 0xe2c75070, 0x455d, 0x455f, 0xbf, 0x53, 0x86, 0x64, 0xbc, 0x14, 0xa1, 0xbe); CreateServiceFunction(MS_SIMPLESTATUSMSG_GOTOURLMSG, GoToURLMsgCommand); mi.position = -2000007000; - mi.hIcolibItem = GetIconHandle(IDI_GOTOURL); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_GOTOURL); mi.name.w = LPGENW("&Go to URL in Away message"); mi.pszService = MS_SIMPLESTATUSMSG_GOTOURLMSG; hGoToURLMenuItem = Menu_AddContactMenuItem(&mi); diff --git a/plugins/SimpleStatusMsg/src/main.cpp b/plugins/SimpleStatusMsg/src/main.cpp index a72084c738..ff3b8dde0e 100644 --- a/plugins/SimpleStatusMsg/src/main.cpp +++ b/plugins/SimpleStatusMsg/src/main.cpp @@ -1221,13 +1221,13 @@ VOID CALLBACK UpdateMsgTimerProc(HWND, UINT, UINT_PTR, DWORD) static int AddTopToolbarButton(WPARAM, LPARAM) { TTBButton tbb = {}; - tbb.hIconHandleUp = tbb.hIconHandleDn = GetIconHandle(IDI_CSMSG); + tbb.hIconHandleUp = tbb.hIconHandleDn = g_plugin.getIconHandle(IDI_CSMSG); tbb.pszService = MS_SIMPLESTATUSMSG_SHOWDIALOGINT; tbb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP; tbb.name = tbb.pszTooltipUp = LPGEN("Change status message"); hTTBButton = g_plugin.addTTB(&tbb); - ReleaseIconEx("csmsg"); + g_plugin.releaseIcon(IDI_CSMSG); return 0; } @@ -1270,7 +1270,7 @@ static int ChangeStatusMsgPrebuild(WPARAM, LPARAM) mi.flags = CMIF_UNICODE; if (!g_plugin.getByte("ShowStatusMenuItem", 1)) mi.flags |= CMIF_HIDDEN; - mi.hIcolibItem = GetIconHandle(IDI_CSMSG); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_CSMSG); mi.pszService = MS_SIMPLESTATUSMSG_SHOWDIALOGINT; mi.name.w = LPGENW("Status message..."); mi.position = 2000200000; diff --git a/plugins/SimpleStatusMsg/src/msgbox.cpp b/plugins/SimpleStatusMsg/src/msgbox.cpp index 4ae688bf8c..248c97eeb8 100644 --- a/plugins/SimpleStatusMsg/src/msgbox.cpp +++ b/plugins/SimpleStatusMsg/src/msgbox.cpp @@ -943,11 +943,11 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA copy_init_data->m_bOnStartup = init_data->m_bOnStartup; //Load Icons - copy_init_data->icon[I_ICON_DEL] = LoadIconEx("cross"); - copy_init_data->icon[I_ICON_HIST] = LoadIconEx("recent"); - copy_init_data->icon[I_ICON_MSG] = LoadIconEx("predef"); - copy_init_data->icon[I_ICON_ADD] = LoadIconEx("add"); - copy_init_data->icon[I_ICON_CLEAR] = LoadIconEx("clear"); + copy_init_data->icon[I_ICON_DEL] = g_plugin.getIcon(IDI_CROSS); + copy_init_data->icon[I_ICON_HIST] = g_plugin.getIcon(IDI_HISTORY); + copy_init_data->icon[I_ICON_MSG] = g_plugin.getIcon(IDI_MESSAGE); + copy_init_data->icon[I_ICON_ADD] = g_plugin.getIcon(IDI_PLUS); + copy_init_data->icon[I_ICON_CLEAR] = g_plugin.getIcon(IDI_CHIST); if (copy_init_data->m_iDlgFlags & DLG_SHOW_STATUS_ICONS) copy_init_data->status_icons = AddStatusIconsToImageList(init_data->m_szProto, copy_init_data->m_iStatusModes); if (copy_init_data->m_iDlgFlags & DLG_SHOW_LIST_ICONS) @@ -1542,16 +1542,18 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA break; case DM_SIMPAWAY_CHANGEICONS: - ReleaseIconEx("cross"); - ReleaseIconEx("recent"); - ReleaseIconEx("predef"); - ReleaseIconEx("add"); - ReleaseIconEx("clear"); - msgbox_data->icon[I_ICON_DEL] = LoadIconEx("cross"); - msgbox_data->icon[I_ICON_HIST] = LoadIconEx("recent"); - msgbox_data->icon[I_ICON_MSG] = LoadIconEx("predef"); - msgbox_data->icon[I_ICON_ADD] = LoadIconEx("add"); - msgbox_data->icon[I_ICON_CLEAR] = LoadIconEx("clear"); + g_plugin.releaseIcon(IDI_CROSS); + g_plugin.releaseIcon(IDI_HISTORY); + g_plugin.releaseIcon(IDI_MESSAGE); + g_plugin.releaseIcon(IDI_PLUS); + g_plugin.releaseIcon(IDI_CHIST); + + msgbox_data->icon[I_ICON_DEL] = g_plugin.getIcon(IDI_CROSS); + msgbox_data->icon[I_ICON_HIST] = g_plugin.getIcon(IDI_HISTORY); + msgbox_data->icon[I_ICON_MSG] = g_plugin.getIcon(IDI_MESSAGE); + msgbox_data->icon[I_ICON_ADD] = g_plugin.getIcon(IDI_PLUS); + msgbox_data->icon[I_ICON_CLEAR] = g_plugin.getIcon(IDI_CHIST); + if (msgbox_data->m_iDlgFlags & DLG_SHOW_LIST_ICONS) for (int i = 0; i < 5; ++i) ImageList_ReplaceIcon(msgbox_data->other_icons, i, msgbox_data->icon[i]); @@ -1602,11 +1604,11 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA ImageList_Destroy(msgbox_data->status_icons); ImageList_Destroy(msgbox_data->other_icons); - ReleaseIconEx("cross"); - ReleaseIconEx("recent"); - ReleaseIconEx("predef"); - ReleaseIconEx("add"); - ReleaseIconEx("clear"); + g_plugin.releaseIcon(IDI_CROSS); + g_plugin.releaseIcon(IDI_HISTORY); + g_plugin.releaseIcon(IDI_MESSAGE); + g_plugin.releaseIcon(IDI_PLUS); + g_plugin.releaseIcon(IDI_CHIST); Window_FreeIcon_IcoLib(hwndDlg); hwndSAMsgDialog = nullptr; diff --git a/plugins/SimpleStatusMsg/src/simplestatusmsg.h b/plugins/SimpleStatusMsg/src/simplestatusmsg.h index 08b03f1d15..a18012a5fe 100644 --- a/plugins/SimpleStatusMsg/src/simplestatusmsg.h +++ b/plugins/SimpleStatusMsg/src/simplestatusmsg.h @@ -89,11 +89,10 @@ int InitOptions(WPARAM wParam, LPARAM lParam); /* utils.cpp */ void IconsInit(void); -HICON LoadIconEx(const char* name); -HANDLE GetIconHandle(int iconId); -void ReleaseIconEx(const char* name); + HANDLE HookProtoEvent(const char *szModule, const char *szEvent, MIRANDAHOOKPARAM hookProc); void UnhookProtoEvents(void); + int GetRandom(int from, int to); const wchar_t *GetDefaultMessage(int status); const char *StatusModeToDbSetting(int status, const char *suffix); diff --git a/plugins/SimpleStatusMsg/src/utils.cpp b/plugins/SimpleStatusMsg/src/utils.cpp index 00e507f834..a3ba96c977 100644 --- a/plugins/SimpleStatusMsg/src/utils.cpp +++ b/plugins/SimpleStatusMsg/src/utils.cpp @@ -20,8 +20,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "stdafx.h" -static LIST arProtoHooks(5); - static IconItem iconList[] = { { LPGEN("Delete selected"), "cross", IDI_CROSS }, @@ -30,7 +28,7 @@ static IconItem iconList[] = { LPGEN("Add to predefined"), "add", IDI_PLUS }, { LPGEN("Clear history"), "clear", IDI_CHIST }, { LPGEN("Copy Away message"), "copy", IDI_COPY }, - { LPGEN("Change status message"), "csmsg", IDI_CSMSG, }, + { LPGEN("Change status message"), "csmsg", IDI_CSMSG }, { LPGEN("Go to URL in Away message"), "gotourl", IDI_GOTOURL } }; @@ -39,28 +37,9 @@ void IconsInit(void) g_plugin.registerIcon(LPGEN("Simple Status Message"), iconList, MODULENAME); } -HICON LoadIconEx(const char *name) -{ - char szSettingName[100]; - mir_snprintf(szSettingName, "SimpleStatusMsg_%s", name); - return IcoLib_GetIcon(szSettingName); -} - -HANDLE GetIconHandle(int iconId) -{ - for (int i = 0; i < _countof(iconList); i++) - if (iconList[i].defIconID == iconId) - return iconList[i].hIcolib; - - return nullptr; -} +///////////////////////////////////////////////////////////////////////////////////////// -void ReleaseIconEx(const char *name) -{ - char szSettingName[100]; - mir_snprintf(szSettingName, "SimpleStatusMsg_%s", name); - IcoLib_Release(szSettingName); -} +static LIST arProtoHooks(5); HANDLE HookProtoEvent(const char *szModule, const char *szEvent, MIRANDAHOOKPARAM hookProc) { @@ -78,7 +57,9 @@ void UnhookProtoEvents(void) arProtoHooks.destroy(); } +///////////////////////////////////////////////////////////////////////////////////////// // Generate random number in a specified range + int GetRandom(int from, int to) { if ((to - from) < 1) @@ -88,7 +69,9 @@ int GetRandom(int from, int to) return ((randnum % (to - from + 1)) + from); } +///////////////////////////////////////////////////////////////////////////////////////// // From SRAway module + const wchar_t *GetDefaultMessage(int status) { switch (status) { diff --git a/plugins/StartupSilence/src/main.cpp b/plugins/StartupSilence/src/main.cpp index e2f8ab22be..5a2241f494 100644 --- a/plugins/StartupSilence/src/main.cpp +++ b/plugins/StartupSilence/src/main.cpp @@ -27,7 +27,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. CMPlugin g_plugin; HGENMENU hSSMenuToggleOnOff; -HANDLE GetIconHandle(char *szIcon); HANDLE hOptionsInitialize; HANDLE hTTBarloaded = nullptr; HANDLE Buttons = nullptr; @@ -93,7 +92,7 @@ static void __cdecl AdvSt(void*) if (PopUp == 1) { lpwzText = NonStatusAllow == 1 ? ALL_DISABLED_FLT : ALL_DISABLED; - ppd.lchIcon = IcoLib_GetIconByHandle((NonStatusAllow == 1) ? GetIconHandle(ALL_ENABLED_FLT) : GetIconHandle(MENU_NAME)); + ppd.lchIcon = IcoLib_GetIconByHandle((NonStatusAllow == 1) ? g_plugin.getIconHandle(IDI_SSFILTEREDON) : g_plugin.getIconHandle(IDI_SSICON)); ppd.lchContact = NULL; ppd.iSeconds = PopUpTime; wcsncpy_s(ppd.lpwzText, lpwzText, _TRUNCATE); @@ -108,7 +107,7 @@ static void __cdecl AdvSt(void*) if (PopUp == 1) { lpwzText = (DefEnabled == 1 && DefPopup == 1) ? TranslateT(ALL_ENABLED_FLT) : ALL_ENABLED; - ppd.lchIcon = IcoLib_GetIconByHandle((DefEnabled == 1 && DefPopup == 1) ? GetIconHandle(ALL_ENABLED_FLT) : GetIconHandle(MENU_NAME)); + ppd.lchIcon = IcoLib_GetIconByHandle((DefEnabled == 1 && DefPopup == 1) ? g_plugin.getIconHandle(IDI_SSFILTEREDON) : g_plugin.getIconHandle(IDI_SSICON)); wcsncpy_s(ppd.lpwzText, lpwzText, _TRUNCATE); PUAddPopupW(&ppd); } @@ -213,7 +212,7 @@ static INT_PTR StartupSilenceEnabled(WPARAM, LPARAM) if (PopUp == 1) { wchar_t * lpwzText = Enabled == 1 ? S_MODE_CHANGEDON : S_MODE_CHANGEDOFF; POPUPDATAW ppd; - ppd.lchIcon = IcoLib_GetIconByHandle((Enabled == 1) ? GetIconHandle(ENABLE_SILENCE) : GetIconHandle(DISABLE_SILENCE)); + ppd.lchIcon = IcoLib_GetIconByHandle((Enabled == 1) ? g_plugin.getIconHandle(IDI_SSENABLE) : g_plugin.getIconHandle(IDI_SSDISABLE)); ppd.lchContact = NULL; ppd.iSeconds = PopUpTime; wcsncpy_s(ppd.lpwzText, lpwzText, _TRUNCATE); @@ -237,7 +236,7 @@ static INT_PTR InitMenu() CMenuItem mi(&g_plugin); SET_UID(mi, 0x9100c881, 0x6f76, 0x4cb5, 0x97, 0x66, 0xeb, 0xf5, 0xc5, 0x22, 0x46, 0x1f); mi.position = 100000000; - mi.hIcolibItem = GetIconHandle(MENU_NAME); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_SSICON); mi.name.a = MENU_NAME; mi.pszService = SS_SERVICE_NAME; hSSMenuToggleOnOff = Menu_AddMainMenuItem(&mi); @@ -248,9 +247,9 @@ static INT_PTR InitMenu() void UpdateMenu() { if (Enabled == 1) - Menu_ModifyItem(hSSMenuToggleOnOff, _A2W(DISABLE_SILENCE), GetIconHandle(DISABLE_SILENCE)); + Menu_ModifyItem(hSSMenuToggleOnOff, _A2W(DISABLE_SILENCE), g_plugin.getIconHandle(IDI_SSDISABLE)); else - Menu_ModifyItem(hSSMenuToggleOnOff, _A2W(ENABLE_SILENCE), GetIconHandle(ENABLE_SILENCE)); + Menu_ModifyItem(hSSMenuToggleOnOff, _A2W(ENABLE_SILENCE), g_plugin.getIconHandle(IDI_SSENABLE)); UpdateTTB(); } @@ -266,8 +265,8 @@ static int CreateTTButtons(WPARAM, LPARAM) TTBButton ttb = {}; ttb.dwFlags = (Enabled == 1 ? 0 : TTBBF_PUSHED) | TTBBF_VISIBLE | TTBBF_ASPUSHBUTTON; ttb.pszService = SS_SERVICE_NAME; - ttb.hIconHandleDn = GetIconHandle(DISABLE_SILENCETTB); - ttb.hIconHandleUp = GetIconHandle(ENABLE_SILENCETTB); + ttb.hIconHandleDn = g_plugin.getIconHandle(IDI_SSDISABLETTB); + ttb.hIconHandleUp = g_plugin.getIconHandle(IDI_SSENABLETTB); ttb.name = TTBNAME; ttb.pszTooltipUp = SS_IS_ON; ttb.pszTooltipDn = SS_IS_OFF; @@ -284,13 +283,6 @@ void RemoveTTButtons() ttbButtons.destroy(); } -HANDLE GetIconHandle(char *szIcon) -{ - char szSettingName[64]; - mir_snprintf(szSettingName, "%s_%s", MENU_NAME, szIcon); - return IcoLib_GetIconHandle(szSettingName); -} - static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { diff --git a/plugins/StartupSilence/src/stdafx.h b/plugins/StartupSilence/src/stdafx.h index 0eff5b5fce..97a37291c3 100644 --- a/plugins/StartupSilence/src/stdafx.h +++ b/plugins/StartupSilence/src/stdafx.h @@ -67,11 +67,12 @@ struct CMPlugin : public PLUGIN #define NEEDTTBMOD TranslateT("You have to install TopToolBar plugin to use this option.") #define NEEDPOPUP TranslateT("You have to install popup plugin to use this option.") -static IconItem iconList[] = { - { MENU_NAME, MENU_NAME, IDI_SSICON}, - { ALL_ENABLED_FLT, ALL_ENABLED_FLT, IDI_SSFILTEREDON}, - { DISABLE_SILENCE, DISABLE_SILENCE, IDI_SSDISABLE}, - { ENABLE_SILENCE, ENABLE_SILENCE, IDI_SSENABLE} +static IconItem iconList[] = +{ + { MENU_NAME, MENU_NAME, IDI_SSICON }, + { ALL_ENABLED_FLT, ALL_ENABLED_FLT, IDI_SSFILTEREDON }, + { DISABLE_SILENCE, DISABLE_SILENCE, IDI_SSDISABLE }, + { ENABLE_SILENCE, ENABLE_SILENCE, IDI_SSENABLE } }; static IconItem iconttbList[] = { diff --git a/plugins/UserInfoEx/src/classMAnnivDate.cpp b/plugins/UserInfoEx/src/classMAnnivDate.cpp index 69d0aad715..fc32530755 100644 --- a/plugins/UserInfoEx/src/classMAnnivDate.cpp +++ b/plugins/UserInfoEx/src/classMAnnivDate.cpp @@ -215,23 +215,23 @@ struct WORD startDays; WORD endDays; LPCTSTR szZodiac; - LPCSTR szZodiacIcon; + int szZodiacIcon; } static zodiac[] = { - { 80, 110, LPGENW("Aries"), ICO_ZOD_ARIES }, // Widder - { 111, 140, LPGENW("Taurus"), ICO_ZOD_TAURUS }, // Stier - { 141, 172, LPGENW("Gemini"), ICO_ZOD_GEMINI }, // Zwillinge - { 173, 203, LPGENW("Cancer"), ICO_ZOD_CANCER }, // Krebs - { 204, 235, LPGENW("Leo"), ICO_ZOD_LEO }, // Löwe - { 236, 266, LPGENW("Virgo"), ICO_ZOD_VIRGO }, // Jungfrau - { 267, 296, LPGENW("Libra"), ICO_ZOD_LIBRA }, // Waage - { 297, 326, LPGENW("Scorpio"), ICO_ZOD_SCORPIO }, // Scorpion - { 327, 355, LPGENW("Sagittarius"), ICO_ZOD_SAGITTARIUS }, // Schütze - { 356, 364, LPGENW("Capricorn"), ICO_ZOD_CAPRICORN }, // Steinbock - { 1, 19, LPGENW("Capricorn"), ICO_ZOD_CAPRICORN }, // Steinbock - { 20, 49, LPGENW("Aquarius"), ICO_ZOD_AQUARIUS }, // Wassermann - { 50, 79, LPGENW("Pisces"), ICO_ZOD_PISCES }, // Fische - { 0, 0, nullptr, "" } // end of array + { 80, 110, LPGENW("Aries"), IDI_ZOD_ARIES }, // Widder + { 111, 140, LPGENW("Taurus"), IDI_ZOD_TAURUS }, // Stier + { 141, 172, LPGENW("Gemini"), IDI_ZOD_GEMINI }, // Zwillinge + { 173, 203, LPGENW("Cancer"), IDI_ZOD_CANCER }, // Krebs + { 204, 235, LPGENW("Leo"), IDI_ZOD_LEO }, // Löwe + { 236, 266, LPGENW("Virgo"), IDI_ZOD_VIRGO }, // Jungfrau + { 267, 296, LPGENW("Libra"), IDI_ZOD_LIBRA }, // Waage + { 297, 326, LPGENW("Scorpio"), IDI_ZOD_SCORPIO }, // Scorpion + { 327, 355, LPGENW("Sagittarius"), IDI_ZOD_SAGITTARIUS }, // Schütze + { 356, 364, LPGENW("Capricorn"), IDI_ZOD_CAPRICORN }, // Steinbock + { 1, 19, LPGENW("Capricorn"), IDI_ZOD_CAPRICORN }, // Steinbock + { 20, 49, LPGENW("Aquarius"), IDI_ZOD_AQUARIUS }, // Wassermann + { 50, 79, LPGENW("Pisces"), IDI_ZOD_PISCES }, // Fische + { 0, 0, nullptr, 0 } // end of array }; MZodiac MAnnivDate::Zodiac() @@ -242,7 +242,7 @@ MZodiac MAnnivDate::Zodiac() for (i = 0; i < 13 && (wDays < zodiac[i].startDays || wDays > zodiac[i].endDays); i++); MZodiac mZodiac; - mZodiac.hIcon = IcoLib_GetIcon(zodiac[i].szZodiacIcon); + mZodiac.hIcon = g_plugin.getIcon(zodiac[i].szZodiacIcon); mZodiac.pszName = zodiac[i].szZodiac; return mZodiac; } @@ -692,7 +692,7 @@ static WORD AskUser(MCONTACT hContact, MAnnivDate *pOldCustomDate, MAnnivDate *p MB.cbSize = sizeof(MSGBOX); MB.hParent = nullptr; - MB.hiLogo = IcoLib_GetIcon(ICO_DLG_ANNIVERSARY); + MB.hiLogo = g_plugin.getIcon(IDI_ANNIVERSARY); MB.hiMsg = nullptr; MB.uType = MB_YESALLNO|MB_ICON_QUESTION|MB_INFOBAR|MB_NOPOPUP; MB.ptszTitle = LPGENW("Update custom birthday"); diff --git a/plugins/UserInfoEx/src/ctrl_button.cpp b/plugins/UserInfoEx/src/ctrl_button.cpp index 6f88bd700b..07ba971802 100644 --- a/plugins/UserInfoEx/src/ctrl_button.cpp +++ b/plugins/UserInfoEx/src/ctrl_button.cpp @@ -371,7 +371,7 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L bct->hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT); bct->dwStyle = cs->style; if (cs->style & MBS_DOWNARROW) - bct->arrow = IcoLib_GetIcon(ICO_BTN_DOWNARROW); + bct->arrow = g_plugin.getIcon(IDI_BTN_DOWNARROW); LoadTheme(bct); SetWindowLongPtr(hwndBtn, 0, (LONG_PTR)bct); if (cs->lpszName) SetWindowText(hwndBtn, cs->lpszName); diff --git a/plugins/UserInfoEx/src/ctrl_contact.cpp b/plugins/UserInfoEx/src/ctrl_contact.cpp index d8084daaed..95abf7ae15 100644 --- a/plugins/UserInfoEx/src/ctrl_contact.cpp +++ b/plugins/UserInfoEx/src/ctrl_contact.cpp @@ -37,11 +37,11 @@ typedef struct TCbExItem DWORD dwID; wchar_t szCat[MAX_CAT]; LPTSTR pszVal; - LPCSTR pszIcon; + int iIcon; HICON hIcon; } CBEXITEMINTERN, *LPCBEXITEMINTERN; -typedef struct TComboEx +typedef struct TComboEx { LPCBEXITEMINTERN pItems; int numItems; @@ -72,12 +72,12 @@ static int CheckPhoneSyntax(LPTSTR pszSrc, LPTSTR szNumber, WORD cchNumber, int& { int lenNum = 0; BYTE hasLeftBreaket = FALSE, - hasRightBreaket = FALSE; + hasRightBreaket = FALSE; if (!szNumber || !pszSrc || !*pszSrc || !cchNumber) return 0; *szNumber = 0; errorPos = -1; - + if (*pszSrc != '+') { errorPos = 2; // set cursor after first digit *(szNumber + lenNum++) = '+'; @@ -87,47 +87,47 @@ static int CheckPhoneSyntax(LPTSTR pszSrc, LPTSTR szNumber, WORD cchNumber, int& for (; lenNum < cchNumber - 1 && *pszSrc != 0; pszSrc++) { switch (*pszSrc) { - case '(': - if (hasLeftBreaket) { - if (errorPos == -1) errorPos = lenNum; - break; - } - if (*(szNumber + lenNum - 1) != ' ') { - *(szNumber + lenNum++) = ' '; - if (errorPos == -1) errorPos = lenNum + 1; - } - *(szNumber + lenNum++) = *pszSrc; - hasLeftBreaket = TRUE; + case '(': + if (hasLeftBreaket) { + if (errorPos == -1) errorPos = lenNum; break; + } + if (*(szNumber + lenNum - 1) != ' ') { + *(szNumber + lenNum++) = ' '; + if (errorPos == -1) errorPos = lenNum + 1; + } + *(szNumber + lenNum++) = *pszSrc; + hasLeftBreaket = TRUE; + break; - case ')': - if (hasRightBreaket) { - if (errorPos == -1) errorPos = lenNum; - break; - } - *(szNumber + lenNum++) = *pszSrc; - if (*(pszSrc + 1) != ' ') { - *(szNumber + lenNum++) = ' '; - if (errorPos == -1) errorPos = lenNum; - } - hasRightBreaket = TRUE; + case ')': + if (hasRightBreaket) { + if (errorPos == -1) errorPos = lenNum; break; + } + *(szNumber + lenNum++) = *pszSrc; + if (*(pszSrc + 1) != ' ') { + *(szNumber + lenNum++) = ' '; + if (errorPos == -1) errorPos = lenNum; + } + hasRightBreaket = TRUE; + break; - case ' ': - if (*(szNumber + lenNum - 1) != ' ') { - *(szNumber + lenNum++) = *pszSrc; - } - else - if (errorPos == -1) errorPos = lenNum; - break; + case ' ': + if (*(szNumber + lenNum - 1) != ' ') { + *(szNumber + lenNum++) = *pszSrc; + } + else + if (errorPos == -1) errorPos = lenNum; + break; - default: - if (*pszSrc >= '0' && *pszSrc <= '9' || *pszSrc == '-') { - *(szNumber + lenNum++) = *pszSrc; - } - // remember first error position - else if (errorPos == -1) errorPos = lenNum; - break; + default: + if (*pszSrc >= '0' && *pszSrc <= '9' || *pszSrc == '-') { + *(szNumber + lenNum++) = *pszSrc; + } + // remember first error position + else if (errorPos == -1) errorPos = lenNum; + break; } } *(szNumber + lenNum) = 0; @@ -142,19 +142,19 @@ static int CheckPhoneSyntax(LPTSTR pszSrc, LPTSTR szNumber, WORD cchNumber, int& **/ static INT_PTR CALLBACK DlgProc_EMail(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - LPCBEXITEM cbi = (LPCBEXITEM)GetUserData(hDlg); + CBEXITEM *cbi = (CBEXITEM*)GetUserData(hDlg); switch (msg) { case WM_INITDIALOG: - cbi = (LPCBEXITEM)lParam; + cbi = (CBEXITEM*)lParam; if (!cbi) return FALSE; SetUserData(hDlg, lParam); - SendDlgItemMessage(hDlg, IDC_HEADERBAR, WM_SETICON, 0, (LPARAM)IcoLib_GetIcon(ICO_DLG_EMAIL, TRUE)); + SendDlgItemMessage(hDlg, IDC_HEADERBAR, WM_SETICON, 0, (LPARAM)g_plugin.getIcon(IDI_DLG_EMAIL, true)); if (g_plugin.getByte(SET_ICONS_BUTTONS, 1)) { - SendDlgItemMessage(hDlg, IDOK, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_BTN_OK)); - SendDlgItemMessage(hDlg, IDCANCEL, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_BTN_CANCEL)); + SendDlgItemMessage(hDlg, IDOK, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(IDI_BTN_OK)); + SendDlgItemMessage(hDlg, IDCANCEL, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(IDI_BTN_CLOSE)); } if (*cbi->pszVal) @@ -186,7 +186,8 @@ static INT_PTR CALLBACK DlgProc_EMail(HWND hDlg, UINT msg, WPARAM wParam, LPARAM case WM_COMMAND: switch (LOWORD(wParam)) { - case IDOK: { + case IDOK: + { if (HIWORD(wParam) == BN_CLICKED) { if (cbi->pszVal && cbi->ccVal > 0) GetDlgItemText(hDlg, EDIT_EMAIL, cbi->pszVal, cbi->ccVal); @@ -195,26 +196,27 @@ static INT_PTR CALLBACK DlgProc_EMail(HWND hDlg, UINT msg, WPARAM wParam, LPARAM } break; } - case IDCANCEL: { - if (HIWORD(wParam) == BN_CLICKED) + case IDCANCEL: + { + if (HIWORD(wParam) == BN_CLICKED) EndDialog(hDlg, LOWORD(wParam)); break; } - case EDIT_EMAIL: - if (HIWORD(wParam) == EN_UPDATE) { - wchar_t szText[MAXDATASIZE]; - LPTSTR pszAdd, pszDot; - if (PtrIsValid(cbi)) { - GetWindowText((HWND)lParam, szText, _countof(szText)); - EnableWindow(GetDlgItem(hDlg, IDOK), - ((pszAdd = wcschr(szText, '@')) && + case EDIT_EMAIL: + if (HIWORD(wParam) == EN_UPDATE) { + wchar_t szText[MAXDATASIZE]; + LPTSTR pszAdd, pszDot; + if (PtrIsValid(cbi)) { + GetWindowText((HWND)lParam, szText, _countof(szText)); + EnableWindow(GetDlgItem(hDlg, IDOK), + ((pszAdd = wcschr(szText, '@')) && *(pszAdd + 1) != '.' && (pszDot = wcschr(pszAdd, '.')) && *(pszDot + 1) && mir_wstrcmp(szText, cbi->pszVal))); - } } - break; + } + break; } break; } @@ -229,7 +231,7 @@ static INT_PTR CALLBACK DlgProc_EMail(HWND hDlg, UINT msg, WPARAM wParam, LPARAM **/ INT_PTR CALLBACK DlgProc_Phone(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - LPCBEXITEM cbi = (LPCBEXITEM)GetUserData(hDlg); + CBEXITEM *cbi = (CBEXITEM*)GetUserData(hDlg); static int noRecursion = 0; switch (msg) { @@ -239,14 +241,14 @@ INT_PTR CALLBACK DlgProc_Phone(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam LPIDSTRLIST pCountries; HWND hCombo = GetDlgItem(hDlg, EDIT_COUNTRY); - cbi = (LPCBEXITEM)lParam; + cbi = (CBEXITEM*)lParam; if (!cbi) return FALSE; SetUserData(hDlg, lParam); - SendDlgItemMessage(hDlg, IDC_HEADERBAR, WM_SETICON, 0, (LPARAM)IcoLib_GetIcon(ICO_DLG_PHONE, TRUE)); + SendDlgItemMessage(hDlg, IDC_HEADERBAR, WM_SETICON, 0, (LPARAM)g_plugin.getIcon(IDI_DLG_PHONE, TRUE)); if (g_plugin.getByte(SET_ICONS_BUTTONS, 1)) { - SendDlgItemMessage(hDlg, IDOK, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_BTN_OK)); - SendDlgItemMessage(hDlg, IDCANCEL, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_BTN_CANCEL)); + SendDlgItemMessage(hDlg, IDOK, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(IDI_BTN_OK)); + SendDlgItemMessage(hDlg, IDCANCEL, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(IDI_BTN_CLOSE)); } // translate Userinfo buttons @@ -290,28 +292,28 @@ INT_PTR CALLBACK DlgProc_Phone(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam case WM_COMMAND: switch (LOWORD(wParam)) { - case IDOK: - if (HIWORD(wParam) == BN_CLICKED) { - wchar_t szText[MAXDATASIZE]; - int errorPos; - - if (!GetDlgItemText(hDlg, EDIT_PHONE, szText, _countof(szText)) || !CheckPhoneSyntax(szText, cbi->pszVal, cbi->ccVal, errorPos) || errorPos > -1) { - MsgErr(hDlg, TranslateT("The phone number should start with a + and consist of\nnumbers, spaces, brackets and hyphens only.")); - break; - } - // save category string - GetDlgItemText(hDlg, EDIT_CATEGORY, cbi->pszCat, cbi->ccCat); + case IDOK: + if (HIWORD(wParam) == BN_CLICKED) { + wchar_t szText[MAXDATASIZE]; + int errorPos; - // save SMS flag - if ((int)IsDlgButtonChecked(hDlg, CHECK_SMS) != ((cbi->wFlags & CBEXIF_SMS) == CBEXIF_SMS)) - cbi->wFlags ^= CBEXIF_SMS; + if (!GetDlgItemText(hDlg, EDIT_PHONE, szText, _countof(szText)) || !CheckPhoneSyntax(szText, cbi->pszVal, cbi->ccVal, errorPos) || errorPos > -1) { + MsgErr(hDlg, TranslateT("The phone number should start with a + and consist of\nnumbers, spaces, brackets and hyphens only.")); + break; } - __fallthrough; + // save category string + GetDlgItemText(hDlg, EDIT_CATEGORY, cbi->pszCat, cbi->ccCat); - case IDCANCEL: - if (HIWORD(wParam) == BN_CLICKED) - EndDialog(hDlg, wParam); - break; + // save SMS flag + if ((int)IsDlgButtonChecked(hDlg, CHECK_SMS) != ((cbi->wFlags & CBEXIF_SMS) == CBEXIF_SMS)) + cbi->wFlags ^= CBEXIF_SMS; + } + __fallthrough; + + case IDCANCEL: + if (HIWORD(wParam) == BN_CLICKED) + EndDialog(hDlg, wParam); + break; case EDIT_COUNTRY: if (HIWORD(wParam) != CBN_SELCHANGE) @@ -396,156 +398,156 @@ INT_PTR CALLBACK DlgProc_Phone(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam * lParam - message specific * return: message specific **/ -static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { LPCBEX cbex = (LPCBEX)GetWindowLongPtr(hwnd, 0); switch (msg) { - /** - * name: WM_NCCREATE - * desc: is called to initiate the window creation - * param: wParam - not used - * lParam - pointer to a CREATESTRUCT - * - * return: FALSE on error, TRUE if initialisation was ok - **/ - case WM_NCCREATE: - { - LPCREATESTRUCT cs = (LPCREATESTRUCT)lParam; - - if (!(cbex = (LPCBEX)mir_calloc(1*sizeof(CBEX)))) - return FALSE; - SetWindowLongPtr(hwnd, 0, (LONG_PTR)cbex); - cbex->bLocked = 1; - cbex->hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT); - cbex->hInstance = cs->hInstance; - cbex->iSelectedItem = -1; - cbex->rect.left = cs->x; - cbex->rect.top = cs->y; - cbex->rect.right = cs->x + cs->cx; - cbex->rect.bottom = cs->y + cs->cy; - return TRUE; - } - - /** + /** * name: WM_NCCREATE - * desc: is called to create all subitems + * desc: is called to initiate the window creation * param: wParam - not used - * lParam - not used + * lParam - pointer to a CREATESTRUCT * * return: FALSE on error, TRUE if initialisation was ok **/ + case WM_NCCREATE: + { + LPCREATESTRUCT cs = (LPCREATESTRUCT)lParam; + + if (!(cbex = (LPCBEX)mir_calloc(1 * sizeof(CBEX)))) + return FALSE; + SetWindowLongPtr(hwnd, 0, (LONG_PTR)cbex); + cbex->bLocked = 1; + cbex->hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT); + cbex->hInstance = cs->hInstance; + cbex->iSelectedItem = -1; + cbex->rect.left = cs->x; + cbex->rect.top = cs->y; + cbex->rect.right = cs->x + cs->cx; + cbex->rect.bottom = cs->y + cs->cy; + return TRUE; + } + + /** + * name: WM_NCCREATE + * desc: is called to create all subitems + * param: wParam - not used + * lParam - not used + * + * return: FALSE on error, TRUE if initialisation was ok + **/ case WM_CREATE: - { - WORD wHeight = (WORD)(cbex->rect.bottom - cbex->rect.top); - WORD wWidth = 130; - WORD x = 0; + { + WORD wHeight = (WORD)(cbex->rect.bottom - cbex->rect.top); + WORD wWidth = 130; + WORD x = 0; - if (!(cbex->hBtnEdit = CreateWindowEx(WS_EX_NOPARENTNOTIFY, - UINFOBUTTONCLASS, + if (!(cbex->hBtnEdit = CreateWindowEx(WS_EX_NOPARENTNOTIFY, + UINFOBUTTONCLASS, L"none", - WS_VISIBLE|WS_CHILD|WS_TABSTOP, 0, 0, + WS_VISIBLE | WS_CHILD | WS_TABSTOP, 0, 0, wWidth, wHeight, hwnd, nullptr, cbex->hInstance, nullptr))) { - cbex->bLocked = 0; - return FALSE; - } - x += wWidth + 2; - wWidth = wHeight; - if (!(cbex->hBtnMenu = CreateWindowEx(WS_EX_NOPARENTNOTIFY, + cbex->bLocked = 0; + return FALSE; + } + x += wWidth + 2; + wWidth = wHeight; + if (!(cbex->hBtnMenu = CreateWindowEx(WS_EX_NOPARENTNOTIFY, UINFOBUTTONCLASS, nullptr, - WS_VISIBLE|WS_CHILD|WS_TABSTOP|MBS_PUSHBUTTON|MBS_DOWNARROW, + WS_VISIBLE | WS_CHILD | WS_TABSTOP | MBS_PUSHBUTTON | MBS_DOWNARROW, x, 0, wWidth, wHeight, hwnd, nullptr, cbex->hInstance, nullptr))) { - DestroyWindow(cbex->hBtnEdit); - cbex->bLocked = 0; - return FALSE; - } - x += wWidth + 2; - wWidth = (WORD)(cbex->rect.right - cbex->rect.left - x - (2 * (wHeight + 2))); - if (!(cbex->hEdit = CreateWindowEx(WS_EX_CLIENTEDGE, - L"Edit", + DestroyWindow(cbex->hBtnEdit); + cbex->bLocked = 0; + return FALSE; + } + x += wWidth + 2; + wWidth = (WORD)(cbex->rect.right - cbex->rect.left - x - (2 * (wHeight + 2))); + if (!(cbex->hEdit = CreateWindowEx(WS_EX_CLIENTEDGE, + L"Edit", nullptr, - WS_VISIBLE|WS_CHILD|WS_TABSTOP|ES_AUTOHSCROLL, + WS_VISIBLE | WS_CHILD | WS_TABSTOP | ES_AUTOHSCROLL, x, 1, - wWidth, wHeight - 2, + wWidth, wHeight - 2, hwnd, nullptr, cbex->hInstance, nullptr))) { - DestroyWindow(cbex->hBtnEdit); - DestroyWindow(cbex->hBtnMenu); - cbex->bLocked = 0; - return FALSE; - } - x += wWidth + 2; - wWidth = wHeight; - if (!(cbex->hBtnAdd = CreateWindowEx(WS_EX_NOPARENTNOTIFY, + DestroyWindow(cbex->hBtnEdit); + DestroyWindow(cbex->hBtnMenu); + cbex->bLocked = 0; + return FALSE; + } + x += wWidth + 2; + wWidth = wHeight; + if (!(cbex->hBtnAdd = CreateWindowEx(WS_EX_NOPARENTNOTIFY, UINFOBUTTONCLASS, nullptr, - WS_VISIBLE|WS_CHILD|WS_TABSTOP|MBS_FLAT, + WS_VISIBLE | WS_CHILD | WS_TABSTOP | MBS_FLAT, x, 0, wWidth, wHeight, hwnd, nullptr, cbex->hInstance, nullptr))) { - DestroyWindow(cbex->hBtnEdit); - DestroyWindow(cbex->hBtnMenu); - DestroyWindow(cbex->hEdit); - cbex->bLocked = 0; - return FALSE; - } - x += wWidth + 2; - if (!(cbex->hBtnDel = CreateWindowEx(WS_EX_NOPARENTNOTIFY, + DestroyWindow(cbex->hBtnEdit); + DestroyWindow(cbex->hBtnMenu); + DestroyWindow(cbex->hEdit); + cbex->bLocked = 0; + return FALSE; + } + x += wWidth + 2; + if (!(cbex->hBtnDel = CreateWindowEx(WS_EX_NOPARENTNOTIFY, UINFOBUTTONCLASS, nullptr, - WS_VISIBLE|WS_CHILD|WS_TABSTOP|MBS_FLAT, + WS_VISIBLE | WS_CHILD | WS_TABSTOP | MBS_FLAT, x, 0, wWidth, wHeight, hwnd, nullptr, cbex->hInstance, nullptr))) { - DestroyWindow(cbex->hBtnEdit); - DestroyWindow(cbex->hBtnMenu); - DestroyWindow(cbex->hEdit); - DestroyWindow(cbex->hBtnAdd); + DestroyWindow(cbex->hBtnEdit); + DestroyWindow(cbex->hBtnMenu); + DestroyWindow(cbex->hEdit); + DestroyWindow(cbex->hBtnAdd); + cbex->bLocked = 0; + return FALSE; + } + + // set ids + SetWindowLongPtr(cbex->hBtnEdit, GWLP_ID, BTN_EDIT); + SetWindowLongPtr(cbex->hBtnMenu, GWLP_ID, BTN_MENU); + SetWindowLongPtr(cbex->hEdit, GWLP_ID, EDIT_VALUE); + SetWindowLongPtr(cbex->hBtnAdd, GWLP_ID, BTN_ADD); + SetWindowLongPtr(cbex->hBtnDel, GWLP_ID, BTN_DEL); + // set fonts & maximum edit control charachters + SendMessage(cbex->hEdit, WM_SETFONT, (WPARAM)cbex->hFont, NULL); + SendMessage(cbex->hEdit, EM_LIMITTEXT, (WPARAM)MAXDATASIZE, NULL); + // add tooltips + SendMessage(cbex->hBtnMenu, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Choose the item to display"), MBBF_TCHAR); + SendMessage(cbex->hBtnEdit, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Edit the currently displayed item"), MBBF_TCHAR); + SendMessage(cbex->hBtnAdd, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Add a new custom item"), MBBF_TCHAR); + SendMessage(cbex->hBtnDel, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Delete the selected item"), MBBF_TCHAR); + // reload icons + CtrlContactWndProc(hwnd, WM_SETICON, NULL, NULL); cbex->bLocked = 0; - return FALSE; + return TRUE; } - // set ids - SetWindowLongPtr(cbex->hBtnEdit, GWLP_ID, BTN_EDIT); - SetWindowLongPtr(cbex->hBtnMenu, GWLP_ID, BTN_MENU); - SetWindowLongPtr(cbex->hEdit, GWLP_ID, EDIT_VALUE); - SetWindowLongPtr(cbex->hBtnAdd, GWLP_ID, BTN_ADD); - SetWindowLongPtr(cbex->hBtnDel, GWLP_ID, BTN_DEL); - // set fonts & maximum edit control charachters - SendMessage(cbex->hEdit, WM_SETFONT, (WPARAM)cbex->hFont, NULL); - SendMessage(cbex->hEdit, EM_LIMITTEXT, (WPARAM)MAXDATASIZE, NULL); - // add tooltips - SendMessage(cbex->hBtnMenu, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Choose the item to display"), MBBF_TCHAR); - SendMessage(cbex->hBtnEdit, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Edit the currently displayed item"), MBBF_TCHAR); - SendMessage(cbex->hBtnAdd, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Add a new custom item"), MBBF_TCHAR); - SendMessage(cbex->hBtnDel, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Delete the selected item"), MBBF_TCHAR); - // reload icons - CtrlContactWndProc(hwnd, WM_SETICON, NULL, NULL); - cbex->bLocked = 0; - return TRUE; - } - - /** - * name: WM_DESTROY - * desc: default destroy message, so clear up memory - * param: wParam - not used - * lParam - not used - * return: return value of DefWindowProc - **/ + /** + * name: WM_DESTROY + * desc: default destroy message, so clear up memory + * param: wParam - not used + * lParam - not used + * return: return value of DefWindowProc + **/ case WM_DESTROY: CtrlContactWndProc(hwnd, CBEXM_DELALLITEMS, NULL, NULL); DestroyWindow(cbex->hBtnEdit); @@ -556,15 +558,15 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L MIR_FREE(cbex); break; - /** - * name: WM_CTLCOLOREDIT - * desc: is called on a paint message for a dialog item to determine its colour scheme - * param: wParam - pointer to a HDC - * lParam - pointer to a HWND - * return: a brush - **/ + /** + * name: WM_CTLCOLOREDIT + * desc: is called on a paint message for a dialog item to determine its colour scheme + * param: wParam - pointer to a HDC + * lParam - pointer to a HWND + * return: a brush + **/ case WM_CTLCOLOREDIT: - if (!g_plugin.getByte(SET_PROPSHEET_SHOWCOLOURS, 1) || (HWND)lParam != cbex->hEdit || !cbex->pItems || cbex->iSelectedItem < 0) + if (!g_plugin.getByte(SET_PROPSHEET_SHOWCOLOURS, 1) || (HWND)lParam != cbex->hEdit || !cbex->pItems || cbex->iSelectedItem < 0) break; return Ctrl_SetTextColour((HDC)wParam, cbex->pItems[cbex->iSelectedItem].wFlags); @@ -572,39 +574,39 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L if ((HWND)lParam == cbex->hEdit) return (INT_PTR)GetSysColor(COLOR_WINDOW); return FALSE; - /** - * name: WM_SETICON - * desc: updates the icons of this control - * param: wParam - not used - * lParam - not used - * return: always 0 - **/ + /** + * name: WM_SETICON + * desc: updates the icons of this control + * param: wParam - not used + * lParam - not used + * return: always 0 + **/ case WM_SETICON: - { - HICON hIcon = IcoLib_GetIcon(ICO_BTN_ADD); - SendMessage(cbex->hBtnAdd, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon); - SetWindowText(cbex->hBtnAdd, (hIcon ? L"" : L"+")); + { + HICON hIcon = g_plugin.getIcon(IDI_BTN_ADD); + SendMessage(cbex->hBtnAdd, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon); + SetWindowText(cbex->hBtnAdd, (hIcon ? L"" : L"+")); - hIcon = IcoLib_GetIcon(ICO_BTN_DELETE); - SendMessage(cbex->hBtnDel, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon); - SetWindowText(cbex->hBtnDel, (hIcon ? L"" : L"-")); + hIcon = g_plugin.getIcon(IDI_BTN_DELETE); + SendMessage(cbex->hBtnDel, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon); + SetWindowText(cbex->hBtnDel, (hIcon ? L"" : L"-")); - if (cbex->pItems && cbex->numItems > 0) { - for (int i = 0; i < cbex->numItems; i++) - cbex->pItems[i].hIcon = IcoLib_GetIcon(cbex->pItems[i].pszIcon); + if (cbex->pItems && cbex->numItems > 0) { + for (int i = 0; i < cbex->numItems; i++) + cbex->pItems[i].hIcon = g_plugin.getIcon(cbex->pItems[i].iIcon); - if (cbex->iSelectedItem >= 0 && cbex->iSelectedItem < cbex->numItems) - SendMessage(cbex->hBtnEdit, BM_SETIMAGE, IMAGE_ICON, (LPARAM)cbex->pItems[cbex->iSelectedItem].hIcon); + if (cbex->iSelectedItem >= 0 && cbex->iSelectedItem < cbex->numItems) + SendMessage(cbex->hBtnEdit, BM_SETIMAGE, IMAGE_ICON, (LPARAM)cbex->pItems[cbex->iSelectedItem].hIcon); + } + return 0; } - return 0; - } case WM_COMMAND: switch (LOWORD(wParam)) { - /** - * name: BTN_MENU - * desc: the button to dropdown the list to show all items is pressed - **/ + /** + * name: BTN_MENU + * desc: the button to dropdown the list to show all items is pressed + **/ case BTN_MENU: if (HIWORD(wParam) == BN_CLICKED) { POINT pt = { 0, 0 }; @@ -617,7 +619,7 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L MENUITEMINFO mii = { 0 }; mii.cbSize = sizeof(mii); - mii.fMask = MIIM_ID|MIIM_STRING|MIIM_FTYPE|MIIM_STATE; + mii.fMask = MIIM_ID | MIIM_STRING | MIIM_FTYPE | MIIM_STATE; mii.fType = MFT_STRING; // insert the items @@ -642,7 +644,7 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L } ClientToScreen((HWND)lParam, &pt); GetClientRect((HWND)lParam, &rc); - i = TrackPopupMenuEx(hMenu, TPM_RIGHTALIGN|TPM_RETURNCMD, pt.x + rc.right, pt.y + rc.bottom, hwnd, nullptr); + i = TrackPopupMenuEx(hMenu, TPM_RIGHTALIGN | TPM_RETURNCMD, pt.x + rc.right, pt.y + rc.bottom, hwnd, nullptr); SendMessage(cbex->hBtnMenu, BM_SETCHECK, NULL, NULL); if (i >= CBEXM_MENIITEMFIRST && i < CBEXM_MENIITEMFIRST + cbex->numItems) { CtrlContactWndProc(hwnd, CBEXM_SETCURSEL, (WPARAM)i - CBEXM_MENIITEMFIRST, NULL); @@ -652,10 +654,10 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L } break; - /** - * name: BTN_ADD - * desc: the button to add a new entry is pressed - **/ + /** + * name: BTN_ADD + * desc: the button to add a new entry is pressed + **/ case BTN_ADD: if (HIWORD(wParam) == BN_CLICKED) { DLGPROC dlgProc; @@ -668,24 +670,24 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L SetFocus((HWND)lParam); if (!(hDlgDetails = GetParent(GetParent(hwnd)))) return 1; if (SendMessage(hDlgDetails, PSM_ISLOCKED, NULL, NULL)) return 0; - + switch (GetWindowLongPtr(hwnd, GWLP_ID)) { - case EDIT_PHONE: - dlgID = IDD_ADDPHONE; - dlgProc = DlgProc_Phone; - cbi.pszIcon = ICO_BTN_CUSTOMPHONE; - break; - case EDIT_EMAIL: - dlgID = IDD_ADDEMAIL; - dlgProc = DlgProc_EMail; - cbi.pszIcon = ICO_BTN_EMAIL; - break; - default: - return 1; + case EDIT_PHONE: + dlgID = IDD_ADDPHONE; + dlgProc = DlgProc_Phone; + cbi.iIcon = IDI_BTN_CUSTOMPHONE; + break; + case EDIT_EMAIL: + dlgID = IDD_ADDEMAIL; + dlgProc = DlgProc_EMail; + cbi.iIcon = IDI_BTN_EMAIL; + break; + default: + return 1; } - + cbi.iItem = -1; - cbi.wMask = CBEXIM_CAT|CBEXIM_VAL|CBEXIM_FLAGS|CBEXIM_ICONTEXT; + cbi.wMask = CBEXIM_CAT | CBEXIM_VAL | CBEXIM_FLAGS | CBEXIM_ICONTEXT; cbi.pszCat = szCat; cbi.pszVal = szVal; cbi.ccCat = MAX_CAT; @@ -695,7 +697,7 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L if (DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(dlgID), GetParent(hwnd), dlgProc, (LPARAM)&cbi) == IDOK) { MCONTACT hContact = NULL; - + SendMessage(hDlgDetails, PSM_GETCONTACT, NULL, (LPARAM)&hContact); if (hContact) cbi.wFlags |= CTRLF_HASCUSTOM; cbi.wFlags |= CTRLF_CHANGED; @@ -709,10 +711,10 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L } break; - /** - * name: BTN_EDIT - * desc: the button to edit an existing entry is pressed - **/ + /** + * name: BTN_EDIT + * desc: the button to edit an existing entry is pressed + **/ case BTN_EDIT: if (HIWORD(wParam) == BN_CLICKED) { DLGPROC dlgProc; @@ -728,20 +730,20 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L if (!cbex->pItems || cbex->iSelectedItem == -1) return 0; switch (GetWindowLongPtr(hwnd, GWLP_ID)) { - case EDIT_PHONE: - dlgID = IDD_ADDPHONE; - dlgProc = DlgProc_Phone; - break; - case EDIT_EMAIL: - dlgID = IDD_ADDEMAIL; - dlgProc = DlgProc_EMail; - break; - default: - return 1; + case EDIT_PHONE: + dlgID = IDD_ADDPHONE; + dlgProc = DlgProc_Phone; + break; + case EDIT_EMAIL: + dlgID = IDD_ADDEMAIL; + dlgProc = DlgProc_EMail; + break; + default: + return 1; } cbi.iItem = cbex->iSelectedItem; cbi.dwID = 0; - cbi.wMask = CBEXIM_CAT|CBEXIM_VAL|CBEXIM_FLAGS; + cbi.wMask = CBEXIM_CAT | CBEXIM_VAL | CBEXIM_FLAGS; cbi.pszCat = szCat; cbi.pszVal = szVal; cbi.ccCat = MAX_CAT; @@ -765,32 +767,31 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L } break; - /** - * name: BTN_DEL - * desc: the button to delete an existing entry is pressed - **/ + /** + * name: BTN_DEL + * desc: the button to delete an existing entry is pressed + **/ case BTN_DEL: if (HIWORD(wParam) == BN_CLICKED) { HWND hDlgDetails; MSGBOX mBox; wchar_t szMsg[MAXDATASIZE]; - + SetFocus((HWND)lParam); if (!(hDlgDetails = GetParent(GetParent(hwnd))) || - SendMessage(hDlgDetails, PSM_ISLOCKED, NULL, NULL) || - !cbex->pItems || - cbex->iSelectedItem < 0 || - cbex->iSelectedItem >= cbex->numItems || - FAILED(mir_snwprintf(szMsg, TranslateT("Do you really want to delete the current selected item?\n\t%s\n\t%s"), + SendMessage(hDlgDetails, PSM_ISLOCKED, NULL, NULL) || + !cbex->pItems || + cbex->iSelectedItem < 0 || + cbex->iSelectedItem >= cbex->numItems || + FAILED(mir_snwprintf(szMsg, TranslateT("Do you really want to delete the current selected item?\n\t%s\n\t%s"), cbex->pItems[cbex->iSelectedItem].szCat, cbex->pItems[cbex->iSelectedItem].pszVal)) - ) - { - return 1; + ) { + return 1; } mBox.cbSize = sizeof(MSGBOX); mBox.hParent = hDlgDetails; - mBox.hiLogo = IcoLib_GetIcon(ICO_DLG_PHONE); - mBox.uType = MB_YESNO|MB_ICON_QUESTION|MB_NOPOPUP; + mBox.hiLogo = g_plugin.getIcon(IDI_DLG_PHONE); + mBox.uType = MB_YESNO | MB_ICON_QUESTION | MB_NOPOPUP; mBox.ptszTitle = TranslateT("Delete"); mBox.ptszMsg = szMsg; if (IDYES == MsgBoxService(NULL, (LPARAM)&mBox)) { @@ -802,16 +803,16 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L cbex->pItems[cbex->iSelectedItem].wFlags |= CTRLF_CHANGED; } // clear values for customized database entry - else - if (cbex->pItems[cbex->iSelectedItem].dwID != 0) { - MIR_FREE(cbex->pItems[cbex->iSelectedItem].pszVal); - *cbex->pItems[cbex->iSelectedItem].szCat = 0; - cbex->pItems[cbex->iSelectedItem].wFlags |= CTRLF_CHANGED|CBEXIF_DELETED; - CtrlContactWndProc(hwnd, CBEXM_SETCURSEL, cbex->iSelectedItem - 1, FALSE); - } - // delete default entry else - CtrlContactWndProc(hwnd, CBEXM_DELITEM, NULL, cbex->iSelectedItem); + if (cbex->pItems[cbex->iSelectedItem].dwID != 0) { + MIR_FREE(cbex->pItems[cbex->iSelectedItem].pszVal); + *cbex->pItems[cbex->iSelectedItem].szCat = 0; + cbex->pItems[cbex->iSelectedItem].wFlags |= CTRLF_CHANGED | CBEXIF_DELETED; + CtrlContactWndProc(hwnd, CBEXM_SETCURSEL, cbex->iSelectedItem - 1, FALSE); + } + // delete default entry + else + CtrlContactWndProc(hwnd, CBEXM_DELITEM, NULL, cbex->iSelectedItem); SendMessage(hDlgDetails, PSM_CHANGED, NULL, NULL); cbex->bIsChanged = TRUE; @@ -820,30 +821,30 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L } break; - /** - * name: EDIT_VALUE - * desc: the edit control wants us to act - **/ + /** + * name: EDIT_VALUE + * desc: the edit control wants us to act + **/ case EDIT_VALUE: switch (HIWORD(wParam)) { - case EN_UPDATE: + case EN_UPDATE: { wchar_t szVal[MAXDATASIZE] = { 0 }; int ccVal; MCONTACT hContact; HWND hDlgDetails = GetParent(GetParent(hwnd)); - + EnableWindow(cbex->hBtnDel, GetWindowTextLength(cbex->hEdit) > 0); if (SendMessage(hDlgDetails, PSM_ISLOCKED, NULL, NULL) || - cbex->bLocked || - !cbex->pItems || - cbex->iSelectedItem < 0 || + cbex->bLocked || + !cbex->pItems || + cbex->iSelectedItem < 0 || cbex->iSelectedItem >= cbex->numItems) return 1; // get the edit control's text value and check it for syntax switch (GetWindowLongPtr(hwnd, GWLP_ID)) { - case EDIT_PHONE: + case EDIT_PHONE: { int errorPos; wchar_t szEdit[MAXDATASIZE]; @@ -856,17 +857,17 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L } break; } - case EDIT_EMAIL: - ccVal = GetWindowText(cbex->hEdit, szVal, _countof(szVal)); - break; - default: - ccVal = GetWindowText(cbex->hEdit, szVal, _countof(szVal)); - break; + case EDIT_EMAIL: + ccVal = GetWindowText(cbex->hEdit, szVal, _countof(szVal)); + break; + default: + ccVal = GetWindowText(cbex->hEdit, szVal, _countof(szVal)); + break; } - + SendMessage(hDlgDetails, PSM_GETCONTACT, NULL, (LPARAM)&hContact); if ((cbex->pItems[cbex->iSelectedItem].wFlags & CTRLF_CHANGED) && !(hContact && (cbex->pItems[cbex->iSelectedItem].wFlags & CTRLF_HASCUSTOM))) return 0; - + if (*szVal == 0 || !cbex->pItems[cbex->iSelectedItem].pszVal || mir_wstrcmp(szVal, cbex->pItems[cbex->iSelectedItem].pszVal)) { cbex->pItems[cbex->iSelectedItem].wFlags |= CTRLF_CHANGED; cbex->pItems[cbex->iSelectedItem].wFlags |= (hContact ? CTRLF_HASCUSTOM : CTRLF_HASPROTO); @@ -876,10 +877,10 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L } return 0; } - case EN_KILLFOCUS: + case EN_KILLFOCUS: { int ccText; - + if (!cbex->pItems || cbex->iSelectedItem < 0 || cbex->iSelectedItem >= cbex->numItems) return 1; if (!(cbex->pItems[cbex->iSelectedItem].wFlags & CTRLF_CHANGED)) return 0; @@ -895,10 +896,10 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L cbex->bIsChanged = TRUE; } else - if (cbex->pItems[cbex->iSelectedItem].pszVal = (LPTSTR)mir_realloc(cbex->pItems[cbex->iSelectedItem].pszVal, (ccText + 2) * sizeof(wchar_t))) { - cbex->pItems[cbex->iSelectedItem].pszVal[ccText + 1] = 0; - GetWindowText(cbex->hEdit, cbex->pItems[cbex->iSelectedItem].pszVal, ccText + 1); - } + if (cbex->pItems[cbex->iSelectedItem].pszVal = (LPTSTR)mir_realloc(cbex->pItems[cbex->iSelectedItem].pszVal, (ccText + 2) * sizeof(wchar_t))) { + cbex->pItems[cbex->iSelectedItem].pszVal[ccText + 1] = 0; + GetWindowText(cbex->hEdit, cbex->pItems[cbex->iSelectedItem].pszVal, ccText + 1); + } return 0; } } @@ -906,237 +907,237 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L } break; - /** - * name: CBEXM_ADDITEM - * desc: add a item to the control - * param: wParam - not used - * lParam - (LPCBEXITEM)&item - * return: CB_ERR on failure, new item index if successful - **/ + /** + * name: CBEXM_ADDITEM + * desc: add a item to the control + * param: wParam - not used + * lParam - (LPCBEXITEM)&item + * return: CB_ERR on failure, new item index if successful + **/ case CBEXM_ADDITEM: - { - LPCBEXITEM pItem = (LPCBEXITEM)lParam; - - if (!pItem) return FALSE; - - // if an item with the id of pItem exists, change it instead of adding a new one - // but only if it has not been changed by the user yet. - if ((pItem->wMask & CBEXIM_ID) && cbex->pItems && pItem->dwID != 0) { - int iIndex; - - for (iIndex = 0; iIndex < cbex->numItems; iIndex++) { - if (cbex->pItems[iIndex].dwID == pItem->dwID) { - pItem->iItem = iIndex; - if (cbex->pItems[iIndex].wFlags & CTRLF_CHANGED) - pItem->wFlags |= CTRLF_CHANGED; - else - CtrlContactWndProc(hwnd, CBEXM_SETITEM, 0, lParam); - return iIndex; - } - } - } + { + CBEXITEM *pItem = (CBEXITEM*)lParam; - // add a new item to the combobox - if (!(cbex->pItems = (LPCBEXITEMINTERN)mir_realloc(cbex->pItems, (cbex->numItems + 1) * sizeof(CBEXITEMINTERN)))) { - cbex->numItems = 0; - return CB_ERR; - } - - // set the ID - cbex->pItems[cbex->numItems].dwID = (pItem->wMask & CBEXIM_ID) ? pItem->dwID : 0; + if (!pItem) return FALSE; - // set category string - if (!pItem->pszCat || !pItem->pszCat[0] || !mir_wstrncpy(cbex->pItems[cbex->numItems].szCat, pItem->pszCat, MAX_CAT)) { - mir_snwprintf(cbex->pItems[cbex->numItems].szCat, L"%s %d", TranslateT("Other"), ++cbex->numOther); - } + // if an item with the id of pItem exists, change it instead of adding a new one + // but only if it has not been changed by the user yet. + if ((pItem->wMask & CBEXIM_ID) && cbex->pItems && pItem->dwID != 0) { + int iIndex; - // set value string - if ((pItem->wMask & CBEXIM_VAL) && pItem->pszVal && pItem->pszVal[0]) - cbex->pItems[cbex->numItems].pszVal = mir_wstrdup(pItem->pszVal); - else - cbex->pItems[cbex->numItems].pszVal = nullptr; - // set icon - if ((pItem->wMask & CBEXIM_ICONTEXT) && pItem->pszIcon) { - cbex->pItems[cbex->numItems].pszIcon = pItem->pszIcon; - cbex->pItems[cbex->numItems].hIcon = IcoLib_GetIcon(pItem->pszIcon); - } - // set flags - cbex->pItems[cbex->numItems].wFlags = (pItem->wMask & CBEXIM_CAT) ? pItem->wFlags : 0; - - cbex->numItems++; - return cbex->numItems; - } + for (iIndex = 0; iIndex < cbex->numItems; iIndex++) { + if (cbex->pItems[iIndex].dwID == pItem->dwID) { + pItem->iItem = iIndex; + if (cbex->pItems[iIndex].wFlags & CTRLF_CHANGED) + pItem->wFlags |= CTRLF_CHANGED; + else + CtrlContactWndProc(hwnd, CBEXM_SETITEM, 0, lParam); + return iIndex; + } + } + } - /** - * name: CBEXM_SETITEM - * desc: Set an item's information of the control. - * If iItem member of CBEXITEM is -1, the currently selected item is changed. - * param: wParam - not used - * lParam - (LPCBEXITEM)&item - * return: CB_ERR on failure, new item index if successful - **/ - case CBEXM_SETITEM: - { - LPCBEXITEM pItem = (LPCBEXITEM)lParam; + // add a new item to the combobox + if (!(cbex->pItems = (LPCBEXITEMINTERN)mir_realloc(cbex->pItems, (cbex->numItems + 1) * sizeof(CBEXITEMINTERN)))) { + cbex->numItems = 0; + return CB_ERR; + } - if (!PtrIsValid(pItem) || !pItem->wMask || !PtrIsValid(cbex->pItems)) return FALSE; - if (pItem->iItem == -1) pItem->iItem = cbex->iSelectedItem; - if (pItem->iItem < 0 || pItem->iItem >= cbex->numItems) return FALSE; + // set the ID + cbex->pItems[cbex->numItems].dwID = (pItem->wMask & CBEXIM_ID) ? pItem->dwID : 0; - // set new category string - if (pItem->wMask & CBEXIM_CAT) { // set category string - if (!pItem->pszCat || !pItem->pszCat[0] || !mir_wstrncpy(cbex->pItems[pItem->iItem].szCat, pItem->pszCat, _countof(cbex->pItems[pItem->iItem].szCat))) - mir_snwprintf(cbex->pItems[pItem->iItem].szCat, L"%s %d", TranslateT("Other"), ++cbex->numOther); - if (pItem->iItem == cbex->iSelectedItem) - SetWindowText(cbex->hBtnEdit, cbex->pItems[pItem->iItem].szCat); - } - // set new value - if (pItem->wMask & CBEXIM_VAL) { - MIR_FREE(cbex->pItems[pItem->iItem].pszVal); - if (pItem->pszVal && pItem->pszVal[0]) - cbex->pItems[pItem->iItem].pszVal = mir_wstrdup(pItem->pszVal); - if (pItem->iItem == cbex->iSelectedItem) - SetWindowText(cbex->hEdit, cbex->pItems[pItem->iItem].pszVal ? cbex->pItems[pItem->iItem].pszVal : L""); - } + if (!pItem->pszCat || !pItem->pszCat[0] || !mir_wstrncpy(cbex->pItems[cbex->numItems].szCat, pItem->pszCat, MAX_CAT)) { + mir_snwprintf(cbex->pItems[cbex->numItems].szCat, L"%s %d", TranslateT("Other"), ++cbex->numOther); + } - // set icon - if ((pItem->wMask & CBEXIM_ICONTEXT) && pItem->pszIcon) { - cbex->pItems[pItem->iItem].pszIcon = pItem->pszIcon; - cbex->pItems[pItem->iItem].hIcon = IcoLib_GetIcon(pItem->pszIcon); - if (pItem->iItem == cbex->iSelectedItem) - SendMessage(cbex->hBtnEdit, BM_SETIMAGE, IMAGE_ICON, (LPARAM)cbex->pItems[pItem->iItem].hIcon); + // set value string + if ((pItem->wMask & CBEXIM_VAL) && pItem->pszVal && pItem->pszVal[0]) + cbex->pItems[cbex->numItems].pszVal = mir_wstrdup(pItem->pszVal); + else + cbex->pItems[cbex->numItems].pszVal = nullptr; + // set icon + if ((pItem->wMask & CBEXIM_ICONTEXT) && pItem->iIcon) { + cbex->pItems[cbex->numItems].iIcon = pItem->iIcon; + cbex->pItems[cbex->numItems].hIcon = g_plugin.getIcon(pItem->iIcon); + } + // set flags + cbex->pItems[cbex->numItems].wFlags = (pItem->wMask & CBEXIM_CAT) ? pItem->wFlags : 0; + + cbex->numItems++; + return cbex->numItems; } - if (pItem->wMask & CBEXIM_FLAGS) { - cbex->pItems[pItem->iItem].wFlags = pItem->wFlags; - CtrlContactWndProc(hwnd, CBEXM_ENABLEITEM, NULL, NULL); + + /** + * name: CBEXM_SETITEM + * desc: Set an item's information of the control. + * If iItem member of CBEXITEM is -1, the currently selected item is changed. + * param: wParam - not used + * lParam - (LPCBEXITEM)&item + * return: CB_ERR on failure, new item index if successful + **/ + case CBEXM_SETITEM: + { + CBEXITEM *pItem = (CBEXITEM *)lParam; + + if (!PtrIsValid(pItem) || !pItem->wMask || !PtrIsValid(cbex->pItems)) return FALSE; + if (pItem->iItem == -1) pItem->iItem = cbex->iSelectedItem; + if (pItem->iItem < 0 || pItem->iItem >= cbex->numItems) return FALSE; + + // set new category string + if (pItem->wMask & CBEXIM_CAT) { + // set category string + if (!pItem->pszCat || !pItem->pszCat[0] || !mir_wstrncpy(cbex->pItems[pItem->iItem].szCat, pItem->pszCat, _countof(cbex->pItems[pItem->iItem].szCat))) + mir_snwprintf(cbex->pItems[pItem->iItem].szCat, L"%s %d", TranslateT("Other"), ++cbex->numOther); + if (pItem->iItem == cbex->iSelectedItem) + SetWindowText(cbex->hBtnEdit, cbex->pItems[pItem->iItem].szCat); + } + // set new value + if (pItem->wMask & CBEXIM_VAL) { + MIR_FREE(cbex->pItems[pItem->iItem].pszVal); + if (pItem->pszVal && pItem->pszVal[0]) + cbex->pItems[pItem->iItem].pszVal = mir_wstrdup(pItem->pszVal); + if (pItem->iItem == cbex->iSelectedItem) + SetWindowText(cbex->hEdit, cbex->pItems[pItem->iItem].pszVal ? cbex->pItems[pItem->iItem].pszVal : L""); + } + + // set icon + if ((pItem->wMask & CBEXIM_ICONTEXT) && pItem->iIcon) { + cbex->pItems[pItem->iItem].iIcon = pItem->iIcon; + cbex->pItems[pItem->iItem].hIcon = g_plugin.getIcon(pItem->iIcon); + if (pItem->iItem == cbex->iSelectedItem) + SendMessage(cbex->hBtnEdit, BM_SETIMAGE, IMAGE_ICON, (LPARAM)cbex->pItems[pItem->iItem].hIcon); + } + if (pItem->wMask & CBEXIM_FLAGS) { + cbex->pItems[pItem->iItem].wFlags = pItem->wFlags; + CtrlContactWndProc(hwnd, CBEXM_ENABLEITEM, NULL, NULL); + } + return TRUE; } - return TRUE; - } - /** - * name: CBEXM_GETITEM - * desc: Get an item from the control. - * If iItem member of CBEXITEM is -1, the currently selected item is returned. - * param: wParam - not used - * lParam - (LPCBEXITEM)&item - * return: CB_ERR on failure, new item index if successful - **/ + /** + * name: CBEXM_GETITEM + * desc: Get an item from the control. + * If iItem member of CBEXITEM is -1, the currently selected item is returned. + * param: wParam - not used + * lParam - (LPCBEXITEM)&item + * return: CB_ERR on failure, new item index if successful + **/ case CBEXM_GETITEM: - { - LPCBEXITEM pItem = (LPCBEXITEM)lParam; + { + CBEXITEM *pItem = (CBEXITEM *)lParam; - if (!pItem || !cbex->pItems) return FALSE; - - // try to find item by id - if ((pItem->wMask & CBEXIM_ID) && pItem->dwID != 0) { - int i; + if (!pItem || !cbex->pItems) return FALSE; - for (i = 0; i < cbex->numItems; i++) { - if (cbex->pItems[i].dwID == pItem->dwID) - break; + // try to find item by id + if ((pItem->wMask & CBEXIM_ID) && pItem->dwID != 0) { + int i; + + for (i = 0; i < cbex->numItems; i++) { + if (cbex->pItems[i].dwID == pItem->dwID) + break; + } + pItem->iItem = i; } - pItem->iItem = i; - } - else - if (pItem->iItem == -1) pItem->iItem = cbex->iSelectedItem; - if (pItem->iItem < 0 || pItem->iItem >= cbex->numItems) return FALSE; - - // return only currently selected itemindex - if (!pItem->wMask) return TRUE; - // return the unique id - if (pItem->wMask & CBEXIM_ID) - pItem->dwID = cbex->pItems[pItem->iItem].dwID; - // return category string - if ((pItem->wMask & CBEXIM_CAT) && pItem->pszCat) { - if (*cbex->pItems[pItem->iItem].szCat != 0) - mir_wstrncpy(pItem->pszCat, cbex->pItems[pItem->iItem].szCat, pItem->ccCat - 1); - else - *pItem->pszCat = 0; - } - // return value string - if ((pItem->wMask & CBEXIM_VAL) && pItem->pszVal) { - if (cbex->pItems[pItem->iItem].pszVal) - mir_wstrncpy(pItem->pszVal, cbex->pItems[pItem->iItem].pszVal, pItem->ccVal - 1); else - *pItem->pszVal = 0; + if (pItem->iItem == -1) pItem->iItem = cbex->iSelectedItem; + if (pItem->iItem < 0 || pItem->iItem >= cbex->numItems) return FALSE; + + // return only currently selected itemindex + if (!pItem->wMask) return TRUE; + // return the unique id + if (pItem->wMask & CBEXIM_ID) + pItem->dwID = cbex->pItems[pItem->iItem].dwID; + // return category string + if ((pItem->wMask & CBEXIM_CAT) && pItem->pszCat) { + if (*cbex->pItems[pItem->iItem].szCat != 0) + mir_wstrncpy(pItem->pszCat, cbex->pItems[pItem->iItem].szCat, pItem->ccCat - 1); + else + *pItem->pszCat = 0; + } + // return value string + if ((pItem->wMask & CBEXIM_VAL) && pItem->pszVal) { + if (cbex->pItems[pItem->iItem].pszVal) + mir_wstrncpy(pItem->pszVal, cbex->pItems[pItem->iItem].pszVal, pItem->ccVal - 1); + else + *pItem->pszVal = 0; + } + // return the icon + if (pItem->wMask & CBEXIM_ICONTEXT) + pItem->iIcon = cbex->pItems[pItem->iItem].iIcon; + // return the flags + if (pItem->wMask & CBEXIM_FLAGS) + pItem->wFlags = cbex->pItems[pItem->iItem].wFlags; + return TRUE; } - // return the icon - if (pItem->wMask & CBEXIM_ICONTEXT) - pItem->pszIcon = cbex->pItems[pItem->iItem].pszIcon; - // return the flags - if (pItem->wMask & CBEXIM_FLAGS) - pItem->wFlags = cbex->pItems[pItem->iItem].wFlags; - return TRUE; - } - /** - * name: CBEXM_DELITEM - * desc: delete an item from the control - * param: wParam - not used - * lParam - item index - * return: CB_ERR on failure, new item index if successful - **/ + /** + * name: CBEXM_DELITEM + * desc: delete an item from the control + * param: wParam - not used + * lParam - item index + * return: CB_ERR on failure, new item index if successful + **/ case CBEXM_DELITEM: - { - if (!cbex->pItems || (int)lParam < 0 || (int)lParam >= cbex->numItems || (cbex->pItems[lParam].wFlags & CBEXIF_CATREADONLY)) - return FALSE; - MIR_FREE(cbex->pItems[(int)lParam].pszVal); - memmove(cbex->pItems + (int)lParam, - cbex->pItems + (int)lParam + 1, - (cbex->numItems - (int)lParam - 1) * sizeof(CBEXITEMINTERN)); - cbex->numItems--; - memset((cbex->pItems + cbex->numItems), 0, sizeof(CBEXITEMINTERN)); - CtrlContactWndProc(hwnd, CBEXM_SETCURSEL, lParam - 1, FALSE); - return TRUE; - } + { + if (!cbex->pItems || (int)lParam < 0 || (int)lParam >= cbex->numItems || (cbex->pItems[lParam].wFlags & CBEXIF_CATREADONLY)) + return FALSE; + MIR_FREE(cbex->pItems[(int)lParam].pszVal); + memmove(cbex->pItems + (int)lParam, + cbex->pItems + (int)lParam + 1, + (cbex->numItems - (int)lParam - 1) * sizeof(CBEXITEMINTERN)); + cbex->numItems--; + memset((cbex->pItems + cbex->numItems), 0, sizeof(CBEXITEMINTERN)); + CtrlContactWndProc(hwnd, CBEXM_SETCURSEL, lParam - 1, FALSE); + return TRUE; + } - /** - * name: CBEXM_DELITEM - * desc: delete an item from the control - * param: wParam - not used - * lParam - item index - * return: CB_ERR on failure, new item index if successful - **/ + /** + * name: CBEXM_DELITEM + * desc: delete an item from the control + * param: wParam - not used + * lParam - item index + * return: CB_ERR on failure, new item index if successful + **/ case CBEXM_DELALLITEMS: - { - int i; + { + int i; - if (PtrIsValid(cbex)) { - if (PtrIsValid(cbex->pItems)) { - for (i = 0; i < cbex->numItems; i++) { - MIR_FREE(cbex->pItems[i].pszVal); + if (PtrIsValid(cbex)) { + if (PtrIsValid(cbex->pItems)) { + for (i = 0; i < cbex->numItems; i++) { + MIR_FREE(cbex->pItems[i].pszVal); + } + MIR_FREE(cbex->pItems); + cbex->pItems = nullptr; } - MIR_FREE(cbex->pItems); - cbex->pItems = nullptr; + cbex->numItems = 0; + cbex->iSelectedItem = -1; + SetWindowText(cbex->hEdit, L""); + SetWindowText(cbex->hBtnEdit, L""); + SendMessage(cbex->hBtnEdit, WM_SETICON, NULL, NULL); } - cbex->numItems = 0; - cbex->iSelectedItem = -1; - SetWindowText(cbex->hEdit, L""); - SetWindowText(cbex->hBtnEdit, L""); - SendMessage(cbex->hBtnEdit, WM_SETICON, NULL, NULL); + return TRUE; } - return TRUE; - } - /** - * name: CBEXM_ENABLEITEM - * desc: enables or disables the current item - * param: wParam - not used - * lParam - not used - * return: always 0 - **/ + /** + * name: CBEXM_ENABLEITEM + * desc: enables or disables the current item + * param: wParam - not used + * lParam - not used + * return: always 0 + **/ case CBEXM_ENABLEITEM: if (cbex->iSelectedItem >= 0 && cbex->iSelectedItem < cbex->numItems) { MCONTACT hContact; BYTE bEnabled; - + PSGetContact(GetParent(hwnd), hContact); - bEnabled = !hContact || - (cbex->pItems[cbex->iSelectedItem].wFlags & CTRLF_HASCUSTOM) || - !(cbex->pItems[cbex->iSelectedItem].wFlags & (CTRLF_HASPROTO|CTRLF_HASMETA)) || - !g_plugin.getByte(SET_PROPSHEET_PCBIREADONLY, 0); + bEnabled = !hContact || + (cbex->pItems[cbex->iSelectedItem].wFlags & CTRLF_HASCUSTOM) || + !(cbex->pItems[cbex->iSelectedItem].wFlags & (CTRLF_HASPROTO | CTRLF_HASMETA)) || + !g_plugin.getByte(SET_PROPSHEET_PCBIREADONLY, 0); EnableWindow(cbex->hBtnEdit, bEnabled); EnableWindow(cbex->hBtnDel, bEnabled && GetWindowTextLength(cbex->hEdit) > 0); @@ -1144,72 +1145,72 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L } break; - /** - * name: CBEXM_ISCHANGED - * desc: returns whether the control contains changed values or not - * param: wParam - not used - * lParam - not used - * return: TRUE if control was changed, FALSE if nothing was edited - **/ + /** + * name: CBEXM_ISCHANGED + * desc: returns whether the control contains changed values or not + * param: wParam - not used + * lParam - not used + * return: TRUE if control was changed, FALSE if nothing was edited + **/ case CBEXM_ISCHANGED: return cbex->bIsChanged; - /** - * name: CBEXM_RESETCHANGED - * desc: resets changed flag to FALSE - * param: wParam - not used - * lParam - not used - * return: always FALSE - **/ + /** + * name: CBEXM_RESETCHANGED + * desc: resets changed flag to FALSE + * param: wParam - not used + * lParam - not used + * return: always FALSE + **/ case CBEXM_RESETCHANGED: cbex->bIsChanged = 0; return 0; - /** - * name: CBEXM_SETCURSEL - * desc: selects a certain item - * param: wParam - index of the item to select - * lParam - (BYTE)bValid - if TRUE, the next item with a value is selected - * return: always FALSE - **/ + /** + * name: CBEXM_SETCURSEL + * desc: selects a certain item + * param: wParam - index of the item to select + * lParam - (BYTE)bValid - if TRUE, the next item with a value is selected + * return: always FALSE + **/ case CBEXM_SETCURSEL: - { - int i; - - if (!cbex->pItems) return 1; - if ((int)wParam < 0 || (int)wParam >= cbex->numItems) wParam = max(cbex->iSelectedItem, 0); - cbex->bLocked = 1; - - if ((BYTE)lParam == TRUE) { - i = (int)wParam; - - cbex->iSelectedItem = (int)wParam; - while (i < cbex->numItems) { - if (cbex->pItems[i].pszVal && *cbex->pItems[i].pszVal) { - cbex->iSelectedItem = i; - break; + { + int i; + + if (!cbex->pItems) return 1; + if ((int)wParam < 0 || (int)wParam >= cbex->numItems) wParam = max(cbex->iSelectedItem, 0); + cbex->bLocked = 1; + + if ((BYTE)lParam == TRUE) { + i = (int)wParam; + + cbex->iSelectedItem = (int)wParam; + while (i < cbex->numItems) { + if (cbex->pItems[i].pszVal && *cbex->pItems[i].pszVal) { + cbex->iSelectedItem = i; + break; + } + i++; } - i++; - } - } - else { - // search for the next none deleted item - for (i = (int)wParam; i < cbex->numItems && *cbex->pItems[i].szCat == 0; i++); - if (i == cbex->numItems && (int)wParam > 0) { - for (i = 0; i < (int)wParam && *cbex->pItems[i].szCat == 0; i++); - cbex->iSelectedItem = i == (int)wParam ? 0 : i; } - else - cbex->iSelectedItem = i; + else { + // search for the next none deleted item + for (i = (int)wParam; i < cbex->numItems && *cbex->pItems[i].szCat == 0; i++); + if (i == cbex->numItems && (int)wParam > 0) { + for (i = 0; i < (int)wParam && *cbex->pItems[i].szCat == 0; i++); + cbex->iSelectedItem = i == (int)wParam ? 0 : i; + } + else + cbex->iSelectedItem = i; + } + SetWindowText(cbex->hBtnEdit, cbex->pItems[cbex->iSelectedItem].szCat); + SetWindowText(cbex->hEdit, cbex->pItems[cbex->iSelectedItem].pszVal ? cbex->pItems[cbex->iSelectedItem].pszVal : L""); + SendMessage(cbex->hBtnEdit, BM_SETIMAGE, IMAGE_ICON, (LPARAM)cbex->pItems[cbex->iSelectedItem].hIcon); + CtrlContactWndProc(hwnd, CBEXM_ENABLEITEM, NULL, NULL); + cbex->bLocked = 0; + return 0; } - SetWindowText(cbex->hBtnEdit, cbex->pItems[cbex->iSelectedItem].szCat); - SetWindowText(cbex->hEdit, cbex->pItems[cbex->iSelectedItem].pszVal ? cbex->pItems[cbex->iSelectedItem].pszVal : L""); - SendMessage(cbex->hBtnEdit, BM_SETIMAGE, IMAGE_ICON, (LPARAM)cbex->pItems[cbex->iSelectedItem].hIcon); - CtrlContactWndProc(hwnd, CBEXM_ENABLEITEM, NULL, NULL); - cbex->bLocked = 0; - return 0; - } case CBEXM_SORT: if (cbex->numItems > 4) { qsort(cbex->pItems + 3, cbex->numItems - 3, sizeof(CBEXITEMINTERN), compareProc); @@ -1249,20 +1250,20 @@ int CtrlContactUnLoadModule() int CtrlContactLoadModule() { WNDCLASSEX wc; - + memset(&wc, 0, sizeof(wc)); - wc.cbSize = sizeof(wc); - wc.lpszClassName = UINFOCOMBOEXCLASS; - wc.lpfnWndProc = CtrlContactWndProc; - wc.hCursor = LoadCursor(nullptr, IDC_ARROW); - wc.cbWndExtra = sizeof(LPCBEX); - wc.hbrBackground = (HBRUSH)GetStockObject(COLOR_WINDOW); - wc.style = CS_GLOBALCLASS; + wc.cbSize = sizeof(wc); + wc.lpszClassName = UINFOCOMBOEXCLASS; + wc.lpfnWndProc = CtrlContactWndProc; + wc.hCursor = LoadCursor(nullptr, IDC_ARROW); + wc.cbWndExtra = sizeof(LPCBEX); + wc.hbrBackground = (HBRUSH)GetStockObject(COLOR_WINDOW); + wc.style = CS_GLOBALCLASS; RegisterClassEx(&wc); return 0; } - + /** * name: CtrlContactAddItemFromDB * desc: add a item read from db to the combobox @@ -1278,20 +1279,20 @@ int CtrlContactLoadModule() * FALSE - if item is added or updated successfully **/ int CtrlContactAddItemFromDB( - HWND hCtrl, - LPCSTR szIcon, - LPTSTR szItem, - MCONTACT hContact, - LPCSTR pszModule, - LPCSTR pszProto, - LPCSTR szSettingVal) + HWND hCtrl, + int iIcon, + LPTSTR szItem, + MCONTACT hContact, + LPCSTR pszModule, + LPCSTR pszProto, + LPCSTR szSettingVal) { DBVARIANT dbv; CBEXITEM cbi; cbi.pszVal = nullptr; cbi.dwID = mir_hashstr(szSettingVal); - cbi.wFlags = CBEXIF_CATREADONLY|DB::Setting::GetTStringCtrl(hContact, pszModule, pszModule, pszProto, szSettingVal, &dbv); + cbi.wFlags = CBEXIF_CATREADONLY | DB::Setting::GetTStringCtrl(hContact, pszModule, pszModule, pszProto, szSettingVal, &dbv); if (dbv.type >= DBVT_WCHAR) { // no value read from database if (cbi.wFlags == CBEXIF_CATREADONLY) @@ -1307,7 +1308,7 @@ int CtrlContactAddItemFromDB( cbi.pszCat = szItem; cbi.iItem = -1; cbi.wMask = CBEXIM_ALL; - cbi.pszIcon = szIcon; + cbi.iIcon = iIcon; SendMessage(hCtrl, CBEXM_ADDITEM, NULL, (LPARAM)&cbi); db_free(&dbv); return (cbi.wFlags & CTRLF_CHANGED) == CTRLF_CHANGED; @@ -1328,14 +1329,14 @@ int CtrlContactAddItemFromDB( * FALSE - if all items were added or updated successfully **/ int CtrlContactAddMyItemsFromDB( - HWND hCtrl, - LPCSTR szIcon, - WORD wForcedFlags, - MCONTACT hContact, - LPCSTR pszModule, - LPCSTR pszProto, - LPCSTR szFormatCat, - LPCSTR szFormatVal) + HWND hCtrl, + int iIcon, + WORD wForcedFlags, + MCONTACT hContact, + LPCSTR pszModule, + LPCSTR pszProto, + LPCSTR szFormatCat, + LPCSTR szFormatVal) { CBEXITEM cbi; DBVARIANT dbv; @@ -1347,13 +1348,12 @@ int CtrlContactAddMyItemsFromDB( memset(&cbi, 0, sizeof(cbi)); cbi.iItem = -1; cbi.wMask = CBEXIM_ALL; - cbi.pszIcon = szIcon; + cbi.iIcon = iIcon; for (i = 0; SUCCEEDED(mir_snprintf(pszSetting, szFormatVal, i)) && (cbi.wFlags = DB::Setting::GetTStringCtrl(hContact, pszModule, pszModule, pszProto, pszSetting, &dbv)); - i++) - { + i++) { // read value cbi.dwID = mir_hashstr(pszSetting); cbi.pszVal = dbv.pwszVal; @@ -1367,10 +1367,10 @@ int CtrlContactAddMyItemsFromDB( dbv.type = DBVT_DELETED; } else - if (cbi.wFlags & CTRLF_HASPROTO) { - if (DB::Setting::GetTString(hContact, pszProto, pszSetting, &dbv)) - dbv.type = DBVT_DELETED; - } + if (cbi.wFlags & CTRLF_HASPROTO) { + if (DB::Setting::GetTString(hContact, pszProto, pszSetting, &dbv)) + dbv.type = DBVT_DELETED; + } if (dbv.type > DBVT_DELETED && dbv.pwszVal && *dbv.pwszVal) { cbi.pszCat = dbv.pwszVal; @@ -1383,12 +1383,12 @@ int CtrlContactAddMyItemsFromDB( *sms = 0; } cbi.wFlags |= wForcedFlags; - if (CB_ERR == SendMessage(hCtrl, CBEXM_ADDITEM, NULL, (LPARAM)&cbi)) + if (CB_ERR == SendMessage(hCtrl, CBEXM_ADDITEM, NULL, (LPARAM)&cbi)) break; bAnyItemIsChanged |= (cbi.wFlags & CTRLF_CHANGED) == CTRLF_CHANGED; - if (cbi.pszCat) { + if (cbi.pszCat) { mir_free(cbi.pszCat); - cbi.pszCat = nullptr; + cbi.pszCat = nullptr; } if (cbi.pszVal) { mir_free(cbi.pszVal); @@ -1406,18 +1406,18 @@ int CtrlContactAddMyItemsFromDB( * return: always 0 **/ int CtrlContactWriteItemToDB( - HWND hCtrl, - MCONTACT hContact, - LPCSTR pszModule, - LPCSTR pszProto, - LPCSTR pszSetting) + HWND hCtrl, + MCONTACT hContact, + LPCSTR pszModule, + LPCSTR pszProto, + LPCSTR pszSetting) { wchar_t szVal[MAXDATASIZE]; CBEXITEM cbi; if (!CtrlContactWndProc(hCtrl, CBEXM_ISCHANGED, NULL, NULL)) return 1; - cbi.wMask = CBEXIM_ID|CBEXIM_VAL|CBEXIM_FLAGS; + cbi.wMask = CBEXIM_ID | CBEXIM_VAL | CBEXIM_FLAGS; cbi.pszVal = szVal; cbi.ccVal = MAXDATASIZE - 4; cbi.iItem = 0; @@ -1447,13 +1447,13 @@ int CtrlContactWriteItemToDB( * return: always 0 **/ int CtrlContactWriteMyItemsToDB( - HWND hCtrl, - int iFirstItem, - MCONTACT hContact, - LPCSTR pszModule, - LPCSTR pszProto, - LPCSTR szFormatCat, - LPCSTR szFormatVal) + HWND hCtrl, + int iFirstItem, + MCONTACT hContact, + LPCSTR pszModule, + LPCSTR pszProto, + LPCSTR szFormatCat, + LPCSTR szFormatVal) { CHAR pszSetting[MAXSETTING]; wchar_t szCat[MAX_CAT]; @@ -1465,17 +1465,17 @@ int CtrlContactWriteMyItemsToDB( if (!CtrlContactWndProc(hCtrl, CBEXM_ISCHANGED, NULL, NULL)) return 1; if (!hContact && !(pszModule = pszProto)) return 1; - + pszOther = TranslateT("Other"); ccOther = mir_wstrlen(pszOther); - cbi.wMask = CBEXIM_CAT|CBEXIM_VAL|CBEXIM_FLAGS; + cbi.wMask = CBEXIM_CAT | CBEXIM_VAL | CBEXIM_FLAGS; cbi.pszCat = szCat; cbi.ccCat = MAX_CAT; cbi.pszVal = szVal; cbi.ccVal = MAXDATASIZE - 4; cbi.iItem = iFirstItem; cbi.dwID = 0; - + while (CtrlContactWndProc(hCtrl, CBEXM_GETITEM, NULL, (LPARAM)&cbi) && cbi.iItem < 50) { if (!(cbi.wFlags & CBEXIF_DELETED) && *szVal) { if (cbi.wFlags & CBEXIF_SMS) { @@ -1492,10 +1492,10 @@ int CtrlContactWriteMyItemsToDB( cbi.wFlags &= ~CTRLF_CHANGED; cbi.wMask = CBEXIM_FLAGS; CtrlContactWndProc(hCtrl, CBEXM_SETITEM, NULL, (LPARAM)&cbi); - cbi.wMask = CBEXIM_CAT|CBEXIM_VAL|CBEXIM_FLAGS; + cbi.wMask = CBEXIM_CAT | CBEXIM_VAL | CBEXIM_FLAGS; i++; } - + cbi.iItem++; } DB::Setting::DeleteArray(hContact, pszModule, szFormatCat, i); diff --git a/plugins/UserInfoEx/src/ctrl_contact.h b/plugins/UserInfoEx/src/ctrl_contact.h index 6216035542..df3e9f8858 100644 --- a/plugins/UserInfoEx/src/ctrl_contact.h +++ b/plugins/UserInfoEx/src/ctrl_contact.h @@ -54,23 +54,23 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define CBEXIF_SMS (CTRLF_FIRST * 2) #define CBEXIF_DELETED (CTRLF_FIRST * 4) -typedef struct TComboExItem +struct CBEXITEM { - WORD wMask; // determines which element of this structure is valid - WORD wFlags; // standard control flags - int iItem; // position of the item in the data array - DWORD dwID; // unique number for each setting read from db to identify it, new entries have dwID = 0 - LPTSTR pszCat; // pointer to a descriptive category string to set or retrieve for the data entry - WORD ccCat; - LPTSTR pszVal; - WORD ccVal; - LPCSTR pszIcon; -} CBEXITEM, *LPCBEXITEM; + WORD wMask; // determines which element of this structure is valid + WORD wFlags; // standard control flags + int iItem; // position of the item in the data array + DWORD dwID; // unique number for each setting read from db to identify it, new entries have dwID = 0 + LPTSTR pszCat; // pointer to a descriptive category string to set or retrieve for the data entry + WORD ccCat; + LPTSTR pszVal; + WORD ccVal; + int iIcon; +}; int CtrlContactLoadModule(); int CtrlContactUnLoadModule(); -int CtrlContactAddItemFromDB(HWND hCtrl, LPCSTR szIcon, LPTSTR szItem, MCONTACT hContact, LPCSTR pszModule, LPCSTR pszProto, LPCSTR szSettingVal); -int CtrlContactAddMyItemsFromDB(HWND hCtrl, LPCSTR szIcon, WORD wForcedFlags, MCONTACT hContact, LPCSTR pszModule, LPCSTR pszProto, LPCSTR szFormatCat, LPCSTR szFormatVal); +int CtrlContactAddItemFromDB(HWND hCtrl, int iIcon, LPTSTR szItem, MCONTACT hContact, LPCSTR pszModule, LPCSTR pszProto, LPCSTR szSettingVal); +int CtrlContactAddMyItemsFromDB(HWND hCtrl, int iIcon, WORD wForcedFlags, MCONTACT hContact, LPCSTR pszModule, LPCSTR pszProto, LPCSTR szFormatCat, LPCSTR szFormatVal); int CtrlContactWriteItemToDB(HWND hCtrl, MCONTACT hContact, LPCSTR pszModule, LPCSTR pszProto, LPCSTR pszSetting); int CtrlContactWriteMyItemsToDB(HWND hCtrl, int iFirstItem, MCONTACT hContact, LPCSTR pszModule, LPCSTR pszProto, LPCSTR szFormatCat, LPCSTR szFormatVal); diff --git a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp index 3c3993eb9b..0533f11e57 100644 --- a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp +++ b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp @@ -283,7 +283,7 @@ class CAnnivList break; // set icons - hIcon = IcoLib_GetIcon(ICO_DLG_ANNIVERSARY); + hIcon = g_plugin.getIcon(IDI_ANNIVERSARY); SendDlgItemMessage(hDlg, IDC_HEADERBAR, WM_SETICON, 0, (LPARAM)hIcon); SendMessage(hDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon); diff --git a/plugins/UserInfoEx/src/dlg_msgbox.cpp b/plugins/UserInfoEx/src/dlg_msgbox.cpp index 80d049ec74..f335833190 100644 --- a/plugins/UserInfoEx/src/dlg_msgbox.cpp +++ b/plugins/UserInfoEx/src/dlg_msgbox.cpp @@ -107,53 +107,53 @@ static void MakePopupAction(POPUPACTION &pa, int id) switch (id) { case IDOK: - pa.lchIcon = IcoLib_GetIcon(ICO_BTN_OK); + pa.lchIcon = g_plugin.getIcon(IDI_BTN_OK); mir_strcpy(pa.lpzTitle, MODULENAME"/Ok"); break; case IDCLOSE: case IDCANCEL: - pa.lchIcon = IcoLib_GetIcon(ICO_BTN_CANCEL); + pa.lchIcon = g_plugin.getIcon(IDI_BTN_CLOSE); mir_strcpy(pa.lpzTitle, MODULENAME"/Cancel"); break; case IDABORT: - pa.lchIcon = IcoLib_GetIcon(ICO_BTN_CANCEL); + pa.lchIcon = g_plugin.getIcon(IDI_BTN_CLOSE); mir_strcpy(pa.lpzTitle, MODULENAME"/Abort"); break; case IDRETRY: - pa.lchIcon = IcoLib_GetIcon(ICO_BTN_UPDATE); + pa.lchIcon = g_plugin.getIcon(IDI_BTN_UPDATE); mir_strcpy(pa.lpzTitle, MODULENAME"/Retry"); break; case IDIGNORE: - pa.lchIcon = IcoLib_GetIcon(ICO_BTN_OK); + pa.lchIcon = g_plugin.getIcon(IDI_BTN_OK); mir_strcpy(pa.lpzTitle, MODULENAME"/Ignore"); break; case IDYES: - pa.lchIcon = IcoLib_GetIcon(ICO_BTN_OK); + pa.lchIcon = g_plugin.getIcon(IDI_BTN_OK); mir_strcpy(pa.lpzTitle, MODULENAME"/Yes"); break; case IDNO: - pa.lchIcon = IcoLib_GetIcon(ICO_BTN_CANCEL); + pa.lchIcon = g_plugin.getIcon(IDI_BTN_CLOSE); mir_strcpy(pa.lpzTitle, MODULENAME"/No"); break; case IDHELP: - pa.lchIcon = IcoLib_GetIcon(ICO_BTN_CANCEL); + pa.lchIcon = g_plugin.getIcon(IDI_BTN_CLOSE); mir_strcpy(pa.lpzTitle, MODULENAME"/Help"); break; case IDALL: - pa.lchIcon = IcoLib_GetIcon(ICO_BTN_OK); + pa.lchIcon = g_plugin.getIcon(IDI_BTN_OK); mir_strcpy(pa.lpzTitle, MODULENAME"/All"); break; case IDNONE: - pa.lchIcon = IcoLib_GetIcon(ICO_BTN_CANCEL); + pa.lchIcon = g_plugin.getIcon(IDI_BTN_CLOSE); mir_strcpy(pa.lpzTitle, MODULENAME"/None"); } } @@ -198,7 +198,7 @@ static INT_PTR CALLBACK MsgBoxProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM l // set infobar's logo icon SendDlgItemMessage(hDlg, ICO_DLGLOGO, STM_SETIMAGE, IMAGE_ICON, - (pMsgBox->hiLogo ? (LPARAM)pMsgBox->hiLogo : (LPARAM)IcoLib_GetIcon(ICO_DLG_DETAILS,TRUE))); + (pMsgBox->hiLogo ? (LPARAM)pMsgBox->hiLogo : (LPARAM)g_plugin.getIcon(IDI_DLG_DETAILS, true))); // enable headerbar ShowWindow(GetDlgItem(hDlg, TXT_NAME), SW_SHOW); @@ -667,7 +667,7 @@ INT_PTR CALLBACK MsgBox(HWND hParent, UINT uType, LPCTSTR pszTitle, LPCTSTR pszI MSGBOX mb = { 0 }; mb.cbSize = sizeof(MSGBOX); mb.hParent = hParent; - mb.hiLogo = IcoLib_GetIcon(ICO_COMMON_MAIN); + mb.hiLogo = g_plugin.getIcon(IDI_MAIN); mb.hiMsg = nullptr; mb.ptszTitle = TranslateW(pszTitle); mb.ptszInfoText = TranslateW(pszInfo); @@ -694,7 +694,7 @@ INT_PTR CALLBACK MsgErr(HWND hParent, LPCTSTR pszFormat, ...) MSGBOX mb = {0}; mb.cbSize = sizeof(MSGBOX); mb.hParent = hParent; - mb.hiLogo = IcoLib_GetIcon(ICO_COMMON_MAIN); + mb.hiLogo = g_plugin.getIcon(IDI_MAIN); mb.hiMsg = nullptr; mb.ptszTitle = tszTitle; mb.ptszMsg = tszMsg; diff --git a/plugins/UserInfoEx/src/dlg_propsheet.cpp b/plugins/UserInfoEx/src/dlg_propsheet.cpp index 4356f92b7b..666dbf5235 100644 --- a/plugins/UserInfoEx/src/dlg_propsheet.cpp +++ b/plugins/UserInfoEx/src/dlg_propsheet.cpp @@ -240,9 +240,9 @@ static INT_PTR ShowDialog(WPARAM wParam, LPARAM) return 1; } - HICON hDefIcon = IcoLib_GetIcon(ICO_TREE_DEFAULT); + HICON hDefIcon = g_plugin.getIcon(IDI_LST_FOLDER); if (!hDefIcon) - hDefIcon = (HICON)IcoLib_GetIcon(ICO_COMMON_DEFAULT, false); + hDefIcon = (HICON)g_plugin.getIcon(IDI_DEFAULT, false); // add the default icon to imagelist ImageList_AddIcon(psh._hImages, hDefIcon); @@ -486,9 +486,9 @@ void DlgContactInfoInitTreeIcons() metrics.x = GetSystemMetrics(SM_CXSMICON); metrics.y = GetSystemMetrics(SM_CYSMICON); if (psh._hImages = ImageList_Create(metrics.x, metrics.y, ILC_COLOR32 | ILC_MASK, 0, 1)) { - HICON hDefIcon = IcoLib_GetIcon(ICO_TREE_DEFAULT); + HICON hDefIcon = g_plugin.getIcon(IDI_LST_FOLDER); if (!hDefIcon) - hDefIcon = (HICON)IcoLib_GetIcon(ICO_COMMON_DEFAULT, false); + hDefIcon = (HICON)g_plugin.getIcon(IDI_DEFAULT, false); // add the default icon to imagelist ImageList_AddIcon(psh._hImages, hDefIcon); @@ -590,7 +590,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar ShowWindow(GetDlgItem(hDlg, IDC_PAGETITLEBG2), !IsAeroMode()); // set icons - Window_SetIcon_IcoLib(hDlg, IcoLib_GetIconHandle(ICO_COMMON_MAIN)); + Window_SetIcon_IcoLib(hDlg, g_plugin.getIconHandle(IDI_MAIN)); DlgProc(hDlg, HM_RELOADICONS, NULL, NULL); // load basic protocol for current contact (for faster load later on and better handling for owner protocol) @@ -908,11 +908,11 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar HWND hCtrl; HICON hIcon; static const ICONCTRL idIcon[] = { - { ICO_DLG_DETAILS, STM_SETIMAGE, ICO_DLGLOGO }, - { ICO_BTN_UPDATE, BM_SETIMAGE, BTN_UPDATE }, - { ICO_BTN_OK, BM_SETIMAGE, IDOK }, - { ICO_BTN_CANCEL, BM_SETIMAGE, IDCANCEL }, - { ICO_BTN_APPLY, BM_SETIMAGE, IDAPPLY } + { IDI_DLG_DETAILS, STM_SETIMAGE, ICO_DLGLOGO }, + { IDI_BTN_UPDATE, BM_SETIMAGE, BTN_UPDATE }, + { IDI_BTN_OK, BM_SETIMAGE, IDOK }, + { IDI_BTN_CLOSE, BM_SETIMAGE, IDCANCEL }, + { IDI_BTN_APPLY, BM_SETIMAGE, IDAPPLY } }; const int numIconsToSet = g_plugin.getByte(SET_ICONS_BUTTONS, 1) ? _countof(idIcon) : 1; @@ -920,12 +920,12 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar IcoLib_SetCtrlIcons(hDlg, idIcon, numIconsToSet); if (hCtrl = GetDlgItem(hDlg, BTN_IMPORT)) { - hIcon = IcoLib_GetIcon(ICO_BTN_IMPORT); + hIcon = g_plugin.getIcon(IDI_IMPORT); SendMessage(hCtrl, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon); SetWindowText(hCtrl, hIcon ? L"" : L"I"); } if (hCtrl = GetDlgItem(hDlg, BTN_EXPORT)) { - hIcon = IcoLib_GetIcon(ICO_BTN_EXPORT); + hIcon = g_plugin.getIcon(IDI_EXPORT); SendMessage(hCtrl, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon); SetWindowText(hCtrl, hIcon ? L"" : L"E"); } diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp index 689e72c564..9a8e0f11d9 100644 --- a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp +++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp @@ -25,7 +25,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * typedefs ***********************************************************************************************************/ -typedef struct { +typedef struct +{ lpExImParam ExImContact; DB::CEnumList* pModules; } EXPORTDATA, *LPEXPORTDATA; @@ -34,14 +35,14 @@ typedef struct { * modules stuff ***********************************************************************************************************/ -/** - * name: ExportTree_AppendModuleList - * desc: according to the checked list items create the module list for exporting - * param: hTree - handle to the window of the treeview - * hParent - parent tree item for the item to add - * pModules - module list to fill - * return: nothing - **/ + /** + * name: ExportTree_AppendModuleList + * desc: according to the checked list items create the module list for exporting + * param: hTree - handle to the window of the treeview + * hParent - parent tree item for the item to add + * pModules - module list to fill + * return: nothing + **/ void ExportTree_AppendModuleList(HWND hTree, HTREEITEM hParent, DB::CEnumList* pModules) { TVITEMA tvi; @@ -51,7 +52,7 @@ void ExportTree_AppendModuleList(HWND hTree, HTREEITEM hParent, DB::CEnumList* p CHAR szModule[MAXSETTING]; // add optional items - tvi.mask = TVIF_STATE|TVIF_TEXT; + tvi.mask = TVIF_STATE | TVIF_TEXT; tvi.stateMask = TVIS_STATEIMAGEMASK; tvi.pszText = szModule; tvi.cchTextMax = _countof(szModule); @@ -62,9 +63,8 @@ void ExportTree_AppendModuleList(HWND hTree, HTREEITEM hParent, DB::CEnumList* p ( tvi.state == INDEXTOSTATEIMAGEMASK(0) || tvi.state == INDEXTOSTATEIMAGEMASK(2) - ) - ) - { + ) + ) { pModules->Insert(tvi.pszText); } } @@ -93,8 +93,7 @@ HTREEITEM ExportTree_FindItem(HWND hTree, HTREEITEM hParent, LPSTR pszText) for (tvi.hItem = TreeView_GetChild(hTree, hParent); tvi.hItem != nullptr; - tvi.hItem = TreeView_GetNextSibling(hTree, tvi.hItem)) - { + tvi.hItem = TreeView_GetNextSibling(hTree, tvi.hItem)) { if (SendMessageA(hTree, TVM_GETITEMA, NULL, (LPARAM)&tvi) && !mir_strcmpi(tvi.pszText, pszText)) return tvi.hItem; } @@ -109,7 +108,7 @@ HTREEITEM ExportTree_FindItem(HWND hTree, HTREEITEM hParent, LPSTR pszText) * pszDesc - item label * bUseImages - icons are loaded * bState - 0-hide checkbox/1-unchecked/2-checked - * return: return handle to added treeitem + * return: return handle to added treeitem **/ HTREEITEM ExportTree_AddItem(HWND hTree, HTREEITEM hParent, LPSTR pszDesc, BYTE bUseImages, BYTE bState) { @@ -120,7 +119,7 @@ HTREEITEM ExportTree_AddItem(HWND hTree, HTREEITEM hParent, LPSTR pszDesc, BYTE tvii.hInsertAfter = TVI_SORT; tvii.itemex.mask = TVIF_TEXT; if (bUseImages) { - tvii.itemex.mask |= TVIF_IMAGE|TVIF_SELECTEDIMAGE; + tvii.itemex.mask |= TVIF_IMAGE | TVIF_SELECTEDIMAGE; tvii.itemex.iImage = tvii.itemex.iSelectedImage = 1; } tvii.itemex.pszText = pszDesc; @@ -143,7 +142,7 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar LPEXPORTDATA pDat = (LPEXPORTDATA)GetUserData(hDlg); switch (uMsg) { - case WM_INITDIALOG: + case WM_INITDIALOG: { BYTE bImagesLoaded = 0; @@ -155,17 +154,17 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar // init the datastructure if (!(pDat = (LPEXPORTDATA)mir_alloc(sizeof(EXPORTDATA)))) return FALSE; - pDat->ExImContact = ((LPEXPORTDATA)lParam)->ExImContact; - pDat->pModules = ((LPEXPORTDATA)lParam)->pModules; + pDat->ExImContact = ((LPEXPORTDATA)lParam)->ExImContact; + pDat->pModules = ((LPEXPORTDATA)lParam)->pModules; SetUserData(hDlg, pDat); // set icons { const ICONCTRL idIcon[] = { - { ICO_DLG_EXPORT, WM_SETICON, NULL }, - { ICO_DLG_EXPORT, STM_SETIMAGE, ICO_DLGLOGO }, - { ICO_BTN_EXPORT, BM_SETIMAGE, IDOK }, - { ICO_BTN_CANCEL, BM_SETIMAGE, IDCANCEL } + { IDI_EXPORT, WM_SETICON, NULL }, + { IDI_EXPORT, STM_SETIMAGE, ICO_DLGLOGO }, + { IDI_EXPORT, BM_SETIMAGE, IDOK }, + { IDI_BTN_CLOSE, BM_SETIMAGE, IDCANCEL } }; const int numIconsToSet = g_plugin.getByte(SET_ICONS_BUTTONS, 1) ? _countof(idIcon) : 2; IcoLib_SetCtrlIcons(hDlg, idIcon, numIconsToSet); @@ -174,15 +173,13 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar OSVERSIONINFO osvi; osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); if (GetVersionEx(&osvi)) { - HIMAGELIST hImages = ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON), - ((osvi.dwPlatformId == VER_PLATFORM_WIN32_NT && osvi.dwMajorVersion >= 5 && osvi.dwMinorVersion >= 1) ? ILC_COLOR32 : ILC_COLOR16)|ILC_MASK,0, 1); - if (hImages != nullptr) - { + HIMAGELIST hImages = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), + ((osvi.dwPlatformId == VER_PLATFORM_WIN32_NT && osvi.dwMajorVersion >= 5 && osvi.dwMinorVersion >= 1) ? ILC_COLOR32 : ILC_COLOR16) | ILC_MASK, 0, 1); + if (hImages != nullptr) { SendMessage(hTree, TVM_SETIMAGELIST, TVSIL_NORMAL, (LPARAM)hImages); - - HICON hIcon; - bImagesLoaded = ((((hIcon = IcoLib_GetIcon(ICO_LST_MODULES)) != nullptr) && 0 == ImageList_AddIcon(hImages, hIcon)) - && (((hIcon = IcoLib_GetIcon(ICO_LST_FOLDER)) != nullptr) && 1 == ImageList_AddIcon(hImages, hIcon))); + g_plugin.addImgListIcon(hImages, IDI_LST_MODULES); + g_plugin.addImgListIcon(hImages, IDI_LST_FOLDER); + bImagesLoaded = true; } } } @@ -195,29 +192,29 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar } // Set the Window Title and description { - LPCTSTR name = nullptr; - wchar_t oldTitle[MAXDATASIZE], - newTitle[MAXDATASIZE]; + LPCTSTR name = nullptr; + wchar_t oldTitle[MAXDATASIZE], + newTitle[MAXDATASIZE]; switch (pDat->ExImContact->Typ) { - case EXIM_ALL: - case EXIM_GROUP: - name = TranslateT("All Contacts"); - break; - case EXIM_CONTACT: - if (pDat->ExImContact->hContact == NULL) { - name = TranslateT("Owner"); - } - else { - name = Clist_GetContactDisplayName(pDat->ExImContact->hContact); - } - break; - case EXIM_SUBGROUP: - name = (LPCTSTR) pDat->ExImContact->ptszName; - break; - case EXIM_ACCOUNT: - PROTOACCOUNT* acc = Proto_GetAccount(pDat->ExImContact->pszName); - name = (LPCTSTR) acc->tszAccountName; - break; + case EXIM_ALL: + case EXIM_GROUP: + name = TranslateT("All Contacts"); + break; + case EXIM_CONTACT: + if (pDat->ExImContact->hContact == NULL) { + name = TranslateT("Owner"); + } + else { + name = Clist_GetContactDisplayName(pDat->ExImContact->hContact); + } + break; + case EXIM_SUBGROUP: + name = (LPCTSTR)pDat->ExImContact->ptszName; + break; + case EXIM_ACCOUNT: + PROTOACCOUNT* acc = Proto_GetAccount(pDat->ExImContact->pszName); + name = (LPCTSTR)acc->tszAccountName; + break; } TranslateDialogDefault(hDlg); //to translate oldTitle GetWindowText(hDlg, oldTitle, _countof(oldTitle)); @@ -241,11 +238,11 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar // add items that are always exported tviiT.hParent = TVI_ROOT; tviiT.hInsertAfter = TVI_FIRST; - tviiT.itemex.mask = TVIF_TEXT|TVIF_STATE; + tviiT.itemex.mask = TVIF_TEXT | TVIF_STATE; tviiT.itemex.pszText = TranslateT("Required modules"); tviiT.itemex.state = tviiT.itemex.stateMask = TVIS_EXPANDED; if (bImagesLoaded) { - tviiT.itemex.mask |= TVIF_IMAGE|TVIF_SELECTEDIMAGE; + tviiT.itemex.mask |= TVIF_IMAGE | TVIF_SELECTEDIMAGE; tviiT.itemex.iImage = tviiT.itemex.iSelectedImage = 0; } if (hItemEssential = TreeView_InsertItem(hTree, &tviiT)) { @@ -275,8 +272,7 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar if (!Modules.EnumModules()) // init Modul list { - for (auto &p : Modules) - { + for (auto &p : Modules) { /*Filter/ if (!DB::Module::IsMeta(p))/end Filter*/ { @@ -284,44 +280,38 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar if (pDat->ExImContact->Typ != EXIM_CONTACT) // TRUE = All Contacts { MCONTACT hContact; - - for (hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) - { + + for (hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) { // ignore empty modules if (!DB::Module::IsEmpty(hContact, p)) { pszProto = Proto_GetBaseAccountName(hContact); // Filter by mode - switch (pDat->ExImContact->Typ) - { - case EXIM_ALL: - case EXIM_GROUP: - break; - case EXIM_SUBGROUP: - if (mir_wstrncmp(pDat->ExImContact->ptszName, DB::Setting::GetTString(hContact, "CList", "Group"), mir_wstrlen(pDat->ExImContact->ptszName))) { - continue; - } - break; - case EXIM_ACCOUNT: - if (mir_strcmp(pDat->ExImContact->pszName, pszProto)) { - continue; - } - break; + switch (pDat->ExImContact->Typ) { + case EXIM_ALL: + case EXIM_GROUP: + break; + case EXIM_SUBGROUP: + if (mir_wstrncmp(pDat->ExImContact->ptszName, DB::Setting::GetTString(hContact, "CList", "Group"), mir_wstrlen(pDat->ExImContact->ptszName))) { + continue; + } + break; + case EXIM_ACCOUNT: + if (mir_strcmp(pDat->ExImContact->pszName, pszProto)) { + continue; + } + break; } // contact's base protocol is to be added to the treeview uniquely - if (!mir_strcmpi(p, pszProto)) - { + if (!mir_strcmpi(p, pszProto)) { if (!ExportTree_FindItem(hTree, hItemEssential, p)) - { ExportTree_AddItem(hTree, hItemEssential, p, bImagesLoaded, 0); - } break; } // add optional module, which is valid for at least one contact /*/Filter/*/ - if (mir_strcmpi(p, USERINFO) && mir_strcmpi(p, MOD_MBIRTHDAY) && mir_strcmpi(p, META_PROTO)) - { + if (mir_strcmpi(p, USERINFO) && mir_strcmpi(p, MOD_MBIRTHDAY) && mir_strcmpi(p, META_PROTO)) { ExportTree_AddItem(hTree, hItemOptional, p, bImagesLoaded, 1); break; } @@ -336,8 +326,7 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar (!pDat->ExImContact->hContact || mir_strcmpi(p, pszProto)) && //mir_strcmpi(p, "Protocol") && mir_strcmpi(p, USERINFO) && - mir_strcmpi(p, MOD_MBIRTHDAY)) - { + mir_strcmpi(p, MOD_MBIRTHDAY)) { ExportTree_AddItem(hTree, hItemOptional, (LPSTR)p, bImagesLoaded, 1); } } // end @@ -346,74 +335,72 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar } } TranslateDialogDefault(hDlg); - return TRUE; } - case WM_CTLCOLORSTATIC: - if (GetDlgItem(hDlg, STATIC_WHITERECT) == (HWND)lParam || GetDlgItem(hDlg, ICO_DLGLOGO) == (HWND)lParam) { - SetBkColor((HDC)wParam, RGB(255, 255, 255)); - return (INT_PTR)GetStockObject(WHITE_BRUSH); - } - SetBkMode((HDC)wParam, TRANSPARENT); - return (INT_PTR)GetStockObject(NULL_BRUSH); - - case WM_COMMAND: - switch (LOWORD(wParam)) { - case IDOK: - { - HWND hTree = GetDlgItem(hDlg, IDC_TREE); - HTREEITEM hParent; - - // search the tree item of optional items - for (hParent = TreeView_GetRoot(hTree); - hParent != nullptr; - hParent = TreeView_GetNextSibling(hTree, hParent)) - { - ExportTree_AppendModuleList(hTree, hParent, pDat->pModules); - } - return EndDialog(hDlg, IDOK); + return TRUE; + + case WM_CTLCOLORSTATIC: + if (GetDlgItem(hDlg, STATIC_WHITERECT) == (HWND)lParam || GetDlgItem(hDlg, ICO_DLGLOGO) == (HWND)lParam) { + SetBkColor((HDC)wParam, RGB(255, 255, 255)); + return (INT_PTR)GetStockObject(WHITE_BRUSH); + } + SetBkMode((HDC)wParam, TRANSPARENT); + return (INT_PTR)GetStockObject(NULL_BRUSH); + + case WM_COMMAND: + switch (LOWORD(wParam)) { + case IDOK: + { + HWND hTree = GetDlgItem(hDlg, IDC_TREE); + HTREEITEM hParent; + + // search the tree item of optional items + for (hParent = TreeView_GetRoot(hTree); + hParent != nullptr; + hParent = TreeView_GetNextSibling(hTree, hParent)) { + ExportTree_AppendModuleList(hTree, hParent, pDat->pModules); } - case IDCANCEL: - return EndDialog(hDlg, IDCANCEL); - - case BTN_CHECK: - case BTN_UNCHECK: - { - HWND hTree = GetDlgItem(hDlg, IDC_TREE); - LPCSTR pszRoot = Translate("Optional modules"); - TVITEMA tvi; - CHAR szText[128]; - - tvi.mask = TVIF_TEXT; - tvi.pszText = szText; - tvi.cchTextMax = _countof(szText); - - // search the tree item of optional items - for (tvi.hItem = (HTREEITEM)SendMessageA(hTree, TVM_GETNEXTITEM, TVGN_ROOT, NULL); - tvi.hItem != nullptr && SendMessageA(hTree, TVM_GETITEMA, 0, (LPARAM)&tvi); - tvi.hItem = (HTREEITEM)SendMessageA(hTree, TVM_GETNEXTITEM, TVGN_NEXT, (LPARAM)tvi.hItem)) - { - if (!mir_strcmpi(tvi.pszText, pszRoot)) { - tvi.mask = TVIF_STATE; - tvi.state = INDEXTOSTATEIMAGEMASK(LOWORD(wParam) == BTN_UNCHECK ? 1 : 2); - tvi.stateMask = TVIS_STATEIMAGEMASK; - - for (tvi.hItem = (HTREEITEM)SendMessageA(hTree, TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)tvi.hItem); - tvi.hItem != nullptr; - tvi.hItem = (HTREEITEM)SendMessageA(hTree, TVM_GETNEXTITEM, TVGN_NEXT, (LPARAM)tvi.hItem)) - { - SendMessageA(hTree, TVM_SETITEMA, NULL, (LPARAM)&tvi); - } - break; + return EndDialog(hDlg, IDOK); + } + case IDCANCEL: + return EndDialog(hDlg, IDCANCEL); + + case BTN_CHECK: + case BTN_UNCHECK: + { + HWND hTree = GetDlgItem(hDlg, IDC_TREE); + LPCSTR pszRoot = Translate("Optional modules"); + TVITEMA tvi; + CHAR szText[128]; + + tvi.mask = TVIF_TEXT; + tvi.pszText = szText; + tvi.cchTextMax = _countof(szText); + + // search the tree item of optional items + for (tvi.hItem = (HTREEITEM)SendMessageA(hTree, TVM_GETNEXTITEM, TVGN_ROOT, NULL); + tvi.hItem != nullptr && SendMessageA(hTree, TVM_GETITEMA, 0, (LPARAM)&tvi); + tvi.hItem = (HTREEITEM)SendMessageA(hTree, TVM_GETNEXTITEM, TVGN_NEXT, (LPARAM)tvi.hItem)) { + if (!mir_strcmpi(tvi.pszText, pszRoot)) { + tvi.mask = TVIF_STATE; + tvi.state = INDEXTOSTATEIMAGEMASK(LOWORD(wParam) == BTN_UNCHECK ? 1 : 2); + tvi.stateMask = TVIS_STATEIMAGEMASK; + + for (tvi.hItem = (HTREEITEM)SendMessageA(hTree, TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)tvi.hItem); + tvi.hItem != nullptr; + tvi.hItem = (HTREEITEM)SendMessageA(hTree, TVM_GETNEXTITEM, TVGN_NEXT, (LPARAM)tvi.hItem)) { + SendMessageA(hTree, TVM_SETITEMA, NULL, (LPARAM)&tvi); } + break; } - break; } + break; } - break; + } + break; - case WM_DESTROY: - mir_free(pDat); - break; + case WM_DESTROY: + mir_free(pDat); + break; } return 0; } @@ -434,4 +421,3 @@ int DlgExImModules_SelectModulesToExport(lpExImParam ExImContact, DB::CEnumList* dat.pModules = pModules; return (IDOK != DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_EXPORT), hParent, SelectModulesToExport_DlgProc, (LPARAM)&dat)); } - diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp index 8e4ca959ae..3535f8d261 100644 --- a/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp +++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp @@ -38,9 +38,9 @@ INT_PTR CALLBACK DlgProcProgress(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPar case WM_INITDIALOG: { const ICONCTRL idIcon[] = { - { ICO_DLG_IMPORT, WM_SETICON, NULL }, - { ICO_DLG_IMPORT, STM_SETIMAGE, ICO_DLGLOGO }, - { ICO_BTN_CANCEL, BM_SETIMAGE, IDCANCEL } + { IDI_IMPORT, WM_SETICON, NULL }, + { IDI_IMPORT, STM_SETIMAGE, ICO_DLGLOGO }, + { IDI_BTN_CLOSE, BM_SETIMAGE, IDCANCEL } }; const int numIconsToSet = g_plugin.getByte(SET_ICONS_BUTTONS, 1) ? _countof(idIcon) : 2; IcoLib_SetCtrlIcons(hDlg, idIcon, numIconsToSet); diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp index 67344160c0..8dd883c6c8 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp @@ -30,10 +30,10 @@ INT_PTR CALLBACK DlgProc_DataHistory(HWND hDlg, UINT msg, WPARAM wParam, LPARAM TranslateDialogDefault(hDlg); { const ICONCTRL idIcon[] = { - { ICO_DLG_EXPORT, WM_SETICON, NULL }, - { ICO_DLG_EXPORT, STM_SETIMAGE, ICO_DLGLOGO }, - { ICO_BTN_EXPORT, BM_SETIMAGE, IDOK }, - { ICO_BTN_CANCEL, BM_SETIMAGE, IDCANCEL } + { IDI_EXPORT, WM_SETICON, NULL }, + { IDI_EXPORT, STM_SETIMAGE, ICO_DLGLOGO }, + { IDI_EXPORT, BM_SETIMAGE, IDOK }, + { IDI_BTN_CLOSE, BM_SETIMAGE, IDCANCEL } }; const int numIconsToSet = g_plugin.getByte(SET_ICONS_BUTTONS, 1) ? _countof(idIcon) : 2; IcoLib_SetCtrlIcons(hDlg, idIcon, numIconsToSet); diff --git a/plugins/UserInfoEx/src/init.cpp b/plugins/UserInfoEx/src/init.cpp index 6d017b966f..cc5389422a 100644 --- a/plugins/UserInfoEx/src/init.cpp +++ b/plugins/UserInfoEx/src/init.cpp @@ -67,18 +67,18 @@ static int OnTopToolBarLoaded(WPARAM, LPARAM) TTBButton ttb = {}; ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP; ttb.pszService = MS_USERINFO_SHOWDIALOG; - ttb.hIconHandleUp = IcoLib_GetIconHandle(ICO_COMMON_MAIN); + ttb.hIconHandleUp = g_plugin.getIconHandle(IDI_MAIN); ttb.name = ttb.pszTooltipUp = LPGEN("User &details"); g_plugin.addTTB(&ttb); ttb.dwFlags = TTBBF_SHOWTOOLTIP; ttb.pszService = MS_USERINFO_REMINDER_LIST; - ttb.hIconHandleUp = IcoLib_GetIconHandle(ICO_COMMON_ANNIVERSARY); + ttb.hIconHandleUp = g_plugin.getIconHandle(IDI_ANNIVERSARY); ttb.name = ttb.pszTooltipUp = LPGEN("Anniversary list"); g_plugin.addTTB(&ttb); ttb.pszService = MS_USERINFO_REMINDER_CHECK; - ttb.hIconHandleUp = IcoLib_GetIconHandle(ICO_COMMON_BIRTHDAY); + ttb.hIconHandleUp = g_plugin.getIconHandle(IDI_BIRTHDAY); ttb.name = ttb.pszTooltipUp = LPGEN("Check anniversaries"); g_plugin.addTTB(&ttb); return 0; diff --git a/plugins/UserInfoEx/src/mir_icolib.cpp b/plugins/UserInfoEx/src/mir_icolib.cpp index a703d3d457..8d13206a7c 100644 --- a/plugins/UserInfoEx/src/mir_icolib.cpp +++ b/plugins/UserInfoEx/src/mir_icolib.cpp @@ -23,109 +23,109 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static IconItem common[] = { - { LPGEN("Main"), ICO_COMMON_MAIN, IDI_MAIN }, - { LPGEN("Default"), ICO_COMMON_DEFAULT, IDI_DEFAULT } + { LPGEN("Main"), "common_main", IDI_MAIN }, + { LPGEN("Default"), "common_default", IDI_DEFAULT } }; static IconItem icons1[] = { // common - { ICO_COMMON_IM, LPGEN("IM naming"), IDI_MIRANDA }, - { ICO_COMMON_PASSWORD, LPGEN("Password"), IDI_PASSWORD }, - { ICO_COMMON_FEMALE, LPGEN("Female"), IDI_FEMALE }, - { ICO_COMMON_MALE, LPGEN("Male"), IDI_MALE }, - { ICO_COMMON_BIRTHDAY, LPGEN("Birthday"), IDI_BIRTHDAY }, - { ICO_COMMON_CLOCK, LPGEN("Timezone"), IDI_CLOCK, 32 }, - { ICO_COMMON_MARITAL, LPGEN("Marital status"), IDI_MARITAL }, - { ICO_COMMON_ADDRESS, LPGEN("Address"), IDI_TREE_ADDRESS }, - { ICO_COMMON_ANNIVERSARY,LPGEN("Anniversary"), IDI_ANNIVERSARY }, + { "common_im", LPGEN("IM naming"), IDI_MIRANDA }, + { "common_password", LPGEN("Password"), IDI_PASSWORD }, + { "common_female", LPGEN("Female"), IDI_FEMALE }, + { "common_male", LPGEN("Male"), IDI_MALE }, + { "common_birthday", LPGEN("Birthday"), IDI_BIRTHDAY }, + { "common_clock", LPGEN("Timezone"), IDI_CLOCK, 32 }, + { "common_marital", LPGEN("Marital status"), IDI_MARITAL }, + { "common_address", LPGEN("Address"), IDI_TREE_ADDRESS }, + { "common_anniversary", LPGEN("Anniversary"), IDI_ANNIVERSARY }, // zodiac - { ICO_ZOD_AQUARIUS, LPGEN("Aquarius"), IDI_ZOD_AQUARIUS, 128 }, - { ICO_ZOD_ARIES, LPGEN("Aries"), IDI_ZOD_ARIES, 128 }, - { ICO_ZOD_CANCER, LPGEN("Cancer"), IDI_ZOD_CANCER, 128 }, - { ICO_ZOD_CAPRICORN, LPGEN("Capricorn"), IDI_ZOD_CAPRICORN, 128 }, - { ICO_ZOD_GEMINI, LPGEN("Gemini"), IDI_ZOD_GEMINI, 128 }, - { ICO_ZOD_LEO, LPGEN("Leo"), IDI_ZOD_LEO, 128 }, - { ICO_ZOD_LIBRA, LPGEN("Libra"), IDI_ZOD_LIBRA, 128 }, - { ICO_ZOD_PISCES, LPGEN("Pisces"), IDI_ZOD_PISCES, 128 }, - { ICO_ZOD_SAGITTARIUS, LPGEN("Sagittarius"), IDI_ZOD_SAGITTARIUS, 128 }, - { ICO_ZOD_SCORPIO, LPGEN("Scorpio"), IDI_ZOD_SCORPIO, 128 }, - { ICO_ZOD_TAURUS, LPGEN("Taurus"), IDI_ZOD_TAURUS, 128 }, - { ICO_ZOD_VIRGO, LPGEN("Virgo"), IDI_ZOD_VIRGO, 128 }, + { "zod_aquarius", LPGEN("Aquarius"), IDI_ZOD_AQUARIUS, 128 }, + { "zod_aries", LPGEN("Aries"), IDI_ZOD_ARIES, 128 }, + { "zod_cancer", LPGEN("Cancer"), IDI_ZOD_CANCER, 128 }, + { "zod_capricorn", LPGEN("Capricorn"), IDI_ZOD_CAPRICORN, 128 }, + { "zod_gemini", LPGEN("Gemini"), IDI_ZOD_GEMINI, 128 }, + { "zod_leo", LPGEN("Leo"), IDI_ZOD_LEO, 128 }, + { "zod_libra", LPGEN("Libra"), IDI_ZOD_LIBRA, 128 }, + { "zod_pisces", LPGEN("Pisces"), IDI_ZOD_PISCES, 128 }, + { "zod_sagittarius", LPGEN("Sagittarius"), IDI_ZOD_SAGITTARIUS, 128 }, + { "zod_scorpio", LPGEN("Scorpio"), IDI_ZOD_SCORPIO, 128 }, + { "zod_taurus", LPGEN("Taurus"), IDI_ZOD_TAURUS, 128 }, + { "zod_virgo", LPGEN("Virgo"), IDI_ZOD_VIRGO, 128 }, // lists - { ICO_LST_MODULES, LPGEN("Export: modules"), IDI_LST_MODULES }, - { ICO_LST_FOLDER, LPGEN("Export: folder"), IDI_LST_FOLDER }, + { "lst_modules", LPGEN("Export: modules"), IDI_LST_MODULES }, + { "lst_folder", LPGEN("Export: folder"), IDI_LST_FOLDER }, }; static IconItem icons2[] = { // tree - { ICO_TREE_DEFAULT, LPGEN("Default"), IDI_LST_FOLDER }, + { "tree_default", LPGEN("Default"), IDI_LST_FOLDER }, }; static IconItem icons3[] = { // dialogs - { ICO_DLG_DETAILS, LPGEN("Details info bar"), IDI_DLG_DETAILS, 48 }, - { ICO_DLG_PHONE, LPGEN("Phone info bar"), IDI_DLG_PHONE, 32 }, - { ICO_DLG_EMAIL, LPGEN("E-mail info bar"), IDI_DLG_EMAIL, 32 }, - { ICO_DLG_EXPORT, LPGEN("Export VCard"), IDI_EXPORT, 32 }, - { ICO_DLG_IMPORT, LPGEN("Import VCard"), IDI_IMPORT, 32 }, - { ICO_DLG_ANNIVERSARY, LPGEN("Anniversary info bar"), IDI_ANNIVERSARY, 32 }, + { "dlg_details", LPGEN("Details info bar"), IDI_DLG_DETAILS, 48 }, + { "dlg_phone", LPGEN("Phone info bar"), IDI_DLG_PHONE, 32 }, + { "dlg_email", LPGEN("E-mail info bar"), IDI_DLG_EMAIL, 32 }, + { "dlg_export", LPGEN("Export VCard"), IDI_EXPORT, 32 }, + { "dlg_import", LPGEN("Import VCard"), IDI_IMPORT, 32 }, + { "dlg_anniversary", LPGEN("Anniversary info bar"), IDI_ANNIVERSARY, 32 }, }; static IconItem icons4[] = { // button icons - { ICO_BTN_UPDATE, LPGEN("Update"), IDI_BTN_UPDATE }, - { ICO_BTN_IMPORT, LPGEN("Import"), IDI_IMPORT }, - { ICO_BTN_EXPORT, LPGEN("Export"), IDI_EXPORT }, - { ICO_BTN_OK, LPGEN("OK"), IDI_BTN_OK }, - { ICO_BTN_CANCEL, LPGEN("Cancel"), IDI_BTN_CLOSE }, - { ICO_BTN_APPLY, LPGEN("Apply"), IDI_BTN_APPLY }, - { ICO_BTN_GOTO, LPGEN("Goto"), IDI_BTN_GOTO }, - { ICO_BTN_PHONE, LPGEN("Phone"), IDI_BTN_PHONE }, - { ICO_BTN_FAX, LPGEN("Fax"), IDI_BTN_FAX }, - { ICO_BTN_CELLULAR, LPGEN("Cellular"), IDI_BTN_CELLULAR }, - { ICO_BTN_CUSTOMPHONE, LPGEN("Custom phone"), IDI_BTN_CUSTOMPHONE }, - { ICO_BTN_EMAIL, LPGEN("E-mail"), IDI_BTN_EMAIL }, - { ICO_BTN_DOWNARROW, LPGEN("Down arrow"), IDI_BTN_DOWNARROW }, - { ICO_BTN_ADD, LPGEN("Add"), IDI_BTN_ADD }, - { ICO_BTN_EDIT, LPGEN("Edit"), IDI_BTN_EDIT }, - { ICO_BTN_DELETE, LPGEN("Delete"), IDI_BTN_DELETE }, - { ICO_BTN_SEARCH, LPGEN("Search"), IDI_SEARCH }, - { ICO_BTN_EXIMPORT, LPGEN("Export/import"), IDI_BTN_EXIMPORT }, - { ICO_BTN_BDAY_BACKUP, LPGEN("Backup birthday"), IDI_BTN_BIRTHDAY_BACKUP }, + { "btn_update", LPGEN("Update"), IDI_BTN_UPDATE }, + { "btn_import", LPGEN("Import"), IDI_IMPORT }, + { "btn_export", LPGEN("Export"), IDI_EXPORT }, + { "btn_ok", LPGEN("OK"), IDI_BTN_OK }, + { "btn_cancel", LPGEN("Cancel"), IDI_BTN_CLOSE }, + { "btn_apply", LPGEN("Apply"), IDI_BTN_APPLY }, + { "btn_goto", LPGEN("Goto"), IDI_BTN_GOTO }, + { "btn_phone", LPGEN("Phone"), IDI_BTN_PHONE }, + { "btn_fax", LPGEN("Fax"), IDI_BTN_FAX }, + { "btn_cellular", LPGEN("Cellular"), IDI_BTN_CELLULAR }, + { "btn_customphone", LPGEN("Custom phone"), IDI_BTN_CUSTOMPHONE }, + { "btn_email", LPGEN("E-mail"), IDI_BTN_EMAIL }, + { "btn_downarrow", LPGEN("Down arrow"), IDI_BTN_DOWNARROW }, + { "btn_add", LPGEN("Add"), IDI_BTN_ADD }, + { "btn_edit", LPGEN("Edit"), IDI_BTN_EDIT }, + { "btn_delete", LPGEN("Delete"), IDI_BTN_DELETE }, + { "btn_search", LPGEN("Search"), IDI_SEARCH }, + { "btn_eximport", LPGEN("Export/import"), IDI_BTN_EXIMPORT }, + { "btn_bdaybackup", LPGEN("Backup birthday"), IDI_BTN_BIRTHDAY_BACKUP }, }; static IconItem icons5[] = { // birthday and anniversary - { ICO_RMD_DTB0, LPGEN("Birthday today"), IDI_RMD_DTB0 }, - { ICO_RMD_DTB1, LPGEN("Birthday tomorrow"), IDI_RMD_DTB1 }, - { ICO_RMD_DTB2, LPGEN("Birthday in 2 days"), IDI_RMD_DTB2 }, - { ICO_RMD_DTB3, LPGEN("Birthday in 3 days"), IDI_RMD_DTB3 }, - { ICO_RMD_DTB4, LPGEN("Birthday in 4 days"), IDI_RMD_DTB4 }, - { ICO_RMD_DTB5, LPGEN("Birthday in 5 days"), IDI_RMD_DTB5 }, - { ICO_RMD_DTB6, LPGEN("Birthday in 6 days"), IDI_RMD_DTB6 }, - { ICO_RMD_DTB7, LPGEN("Birthday in 7 days"), IDI_RMD_DTB7 }, - { ICO_RMD_DTB8, LPGEN("Birthday in 8 days"), IDI_RMD_DTB8 }, - { ICO_RMD_DTB9, LPGEN("Birthday in 9 days"), IDI_RMD_DTB9 }, - { ICO_RMD_DTBX, LPGEN("Birthday later"), IDI_RMD_DTBX }, - - { ICO_RMD_DTA0, LPGEN("Anniversary today"), IDI_RMD_DTA0 }, - { ICO_RMD_DTA1, LPGEN("Anniversary tomorrow"), IDI_RMD_DTA1 }, - { ICO_RMD_DTA2, LPGEN("Anniversary in 2 days"), IDI_RMD_DTA2 }, - { ICO_RMD_DTA3, LPGEN("Anniversary in 3 days"), IDI_RMD_DTA3 }, - { ICO_RMD_DTA4, LPGEN("Anniversary in 4 days"), IDI_RMD_DTA4 }, - { ICO_RMD_DTA5, LPGEN("Anniversary in 5 days"), IDI_RMD_DTA5 }, - { ICO_RMD_DTA6, LPGEN("Anniversary in 6 days"), IDI_RMD_DTA6 }, - { ICO_RMD_DTA7, LPGEN("Anniversary in 7 days"), IDI_RMD_DTA7 }, - { ICO_RMD_DTA8, LPGEN("Anniversary in 8 days"), IDI_RMD_DTA8 }, - { ICO_RMD_DTA9, LPGEN("Anniversary in 9 days"), IDI_RMD_DTA9 }, - { ICO_RMD_DTAX, LPGEN("Anniversary later"), IDI_RMD_DTAX }, + { "rmd_dtb0", LPGEN("Birthday today"), IDI_RMD_DTB0 }, + { "rmd_dtb1", LPGEN("Birthday tomorrow"), IDI_RMD_DTB1 }, + { "rmd_dtb2", LPGEN("Birthday in 2 days"), IDI_RMD_DTB2 }, + { "rmd_dtb3", LPGEN("Birthday in 3 days"), IDI_RMD_DTB3 }, + { "rmd_dtb4", LPGEN("Birthday in 4 days"), IDI_RMD_DTB4 }, + { "rmd_dtb5", LPGEN("Birthday in 5 days"), IDI_RMD_DTB5 }, + { "rmd_dtb6", LPGEN("Birthday in 6 days"), IDI_RMD_DTB6 }, + { "rmd_dtb7", LPGEN("Birthday in 7 days"), IDI_RMD_DTB7 }, + { "rmd_dtb8", LPGEN("Birthday in 8 days"), IDI_RMD_DTB8 }, + { "rmd_dtb9", LPGEN("Birthday in 9 days"), IDI_RMD_DTB9 }, + { "rmd_dtbx", LPGEN("Birthday later"), IDI_RMD_DTBX }, + + { "rmd_dta0", LPGEN("Anniversary today"), IDI_RMD_DTA0 }, + { "rmd_dta1", LPGEN("Anniversary tomorrow"), IDI_RMD_DTA1 }, + { "rmd_dta2", LPGEN("Anniversary in 2 days"), IDI_RMD_DTA2 }, + { "rmd_dta3", LPGEN("Anniversary in 3 days"), IDI_RMD_DTA3 }, + { "rmd_dta4", LPGEN("Anniversary in 4 days"), IDI_RMD_DTA4 }, + { "rmd_dta5", LPGEN("Anniversary in 5 days"), IDI_RMD_DTA5 }, + { "rmd_dta6", LPGEN("Anniversary in 6 days"), IDI_RMD_DTA6 }, + { "rmd_dta7", LPGEN("Anniversary in 7 days"), IDI_RMD_DTA7 }, + { "rmd_dta8", LPGEN("Anniversary in 8 days"), IDI_RMD_DTA8 }, + { "rmd_dta9", LPGEN("Anniversary in 9 days"), IDI_RMD_DTA9 }, + { "rmd_dtax", LPGEN("Anniversary later"), IDI_RMD_DTAX }, }; ///////////////////////////////////////////////////////////////////////////////////////// @@ -182,7 +182,7 @@ static HINSTANCE IcoLib_CheckIconPackVersion(wchar_t *szIconPack) void IcoLib_SetCtrlIcons(HWND hDlg, const ICONCTRL *pCtrl, BYTE numCtrls) { for (int i = 0; i < numCtrls; i++) { - HICON hIcon = IcoLib_GetIcon(pCtrl[i].pszIcon); + HICON hIcon = g_plugin.getIcon(pCtrl[i].iIcon); if (!pCtrl[i].idCtrl) { SendMessage(hDlg, pCtrl[i].Message, ICON_BIG, (LPARAM)hIcon); continue; @@ -206,16 +206,16 @@ void IcoLib_SetCtrlIcons(HWND hDlg, const ICONCTRL *pCtrl, BYTE numCtrls) void IcoLib_LoadModule() { - g_plugin.registerIcon(SECT_COMMON, common); + g_plugin.registerIcon(SECT_COMMON, common, MODULENAME); wchar_t *szDefaultFile = IcoLib_GetDefaultIconFileName(); HINSTANCE hIconPack = IcoLib_CheckIconPackVersion(szDefaultFile); if (hIconPack) { - Icon_Register(hIconPack, SECT_COMMON, icons1, _countof(icons1), 0, &g_plugin); - Icon_Register(hIconPack, SECT_TREE, icons2, _countof(icons2), 0, &g_plugin); - Icon_Register(hIconPack, SECT_DLG, icons3, _countof(icons3), 0, &g_plugin); - Icon_Register(hIconPack, SECT_BUTTONS, icons4, _countof(icons4), 0, &g_plugin); - Icon_Register(hIconPack, SECT_REMIND, icons5, _countof(icons5), 0, &g_plugin); + Icon_Register(hIconPack, SECT_COMMON, icons1, _countof(icons1), MODULENAME, &g_plugin); + Icon_Register(hIconPack, SECT_TREE, icons2, _countof(icons2), MODULENAME, &g_plugin); + Icon_Register(hIconPack, SECT_DLG, icons3, _countof(icons3), MODULENAME, &g_plugin); + Icon_Register(hIconPack, SECT_BUTTONS, icons4, _countof(icons4), MODULENAME, &g_plugin); + Icon_Register(hIconPack, SECT_REMIND, icons5, _countof(icons5), MODULENAME, &g_plugin); FreeLibrary(hIconPack); } } diff --git a/plugins/UserInfoEx/src/mir_icolib.h b/plugins/UserInfoEx/src/mir_icolib.h index de9424ac25..e632d47394 100644 --- a/plugins/UserInfoEx/src/mir_icolib.h +++ b/plugins/UserInfoEx/src/mir_icolib.h @@ -29,101 +29,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define SECT_TREE LPGEN("Extended user info") "/" LPGEN("Treeview") #define SECT_REMIND LPGEN("Extended user info") "/" LPGEN("Reminder") -// icons -#define ICO_COMMON_MAIN MODULENAME"_common_main" -#define ICO_COMMON_DEFAULT MODULENAME"_common_default" -#define ICO_COMMON_IM MODULENAME"_common_im" -#define ICO_COMMON_FEMALE MODULENAME"_common_female" -#define ICO_COMMON_MALE MODULENAME"_common_male" -#define ICO_COMMON_BIRTHDAY MODULENAME"_common_birthday" -#define ICO_COMMON_ANNIVERSARY MODULENAME"_common_anniversary" -#define ICO_COMMON_CLOCK MODULENAME"_common_clock" -#define ICO_COMMON_MARITAL MODULENAME"_common_marital" -#define ICO_COMMON_PASSWORD MODULENAME"_common_password" -#define ICO_COMMON_ADDRESS MODULENAME"_common_address" -#define ICO_DLG_DETAILS MODULENAME"_dlg_details" -#define ICO_DLG_PHONE MODULENAME"_dlg_phone" -#define ICO_DLG_EMAIL MODULENAME"_dlg_email" -#define ICO_DLG_EXPORT MODULENAME"_dlg_export" -#define ICO_DLG_IMPORT MODULENAME"_dlg_import" -#define ICO_DLG_ANNIVERSARY MODULENAME"_dlg_anniversary" -#define ICO_DLG_SEARCH MODULENAME"_dlg_search" -#define ICO_LST_MODULES MODULENAME"_lst_modules" -#define ICO_LST_FOLDER MODULENAME"_lst_folder" -#define ICO_BTN_UPDATE MODULENAME"_btn_update" -#define ICO_BTN_OK MODULENAME"_btn_ok" -#define ICO_BTN_CANCEL MODULENAME"_btn_cancel" -#define ICO_BTN_APPLY MODULENAME"_btn_apply" -#define ICO_BTN_GOTO MODULENAME"_btn_goto" -#define ICO_BTN_ADD MODULENAME"_btn_add" -#define ICO_BTN_EDIT MODULENAME"_btn_edit" -#define ICO_BTN_DELETE MODULENAME"_btn_delete" -#define ICO_BTN_IMPORT MODULENAME"_btn_import" -#define ICO_BTN_EXPORT MODULENAME"_btn_export" -#define ICO_BTN_NOTES MODULENAME"_btn_notes" -#define ICO_BTN_ABOUT MODULENAME"_btn_about" -#define ICO_BTN_PROFILE MODULENAME"_btn_profile" -#define ICO_BTN_DOWNARROW MODULENAME"_btn_downarrow" -#define ICO_BTN_PHONE MODULENAME"_btn_phone" -#define ICO_BTN_FAX MODULENAME"_btn_fax" -#define ICO_BTN_CELLULAR MODULENAME"_btn_cellular" -#define ICO_BTN_CUSTOMPHONE MODULENAME"_btn_customphone" -#define ICO_BTN_EMAIL MODULENAME"_btn_email" -#define ICO_BTN_SEARCH MODULENAME"_btn_search" -#define ICO_BTN_EXIMPORT MODULENAME"_btn_eximport" -#define ICO_BTN_BDAY_BACKUP MODULENAME"_btn_bdaybackup" -#define ICO_BTN_YES MODULENAME"_btn_yes" -#define ICO_BTN_NO MODULENAME"_btn_no" -#define ICO_BTN_IGNORE MODULENAME"_btn_ignore" -#define ICO_ZOD_AQUARIUS MODULENAME"_zod_aquarius" -#define ICO_ZOD_ARIES MODULENAME"_zod_aries" -#define ICO_ZOD_CANCER MODULENAME"_zod_cancer" -#define ICO_ZOD_CAPRICORN MODULENAME"_zod_capricorn" -#define ICO_ZOD_GEMINI MODULENAME"_zod_gemini" -#define ICO_ZOD_LEO MODULENAME"_zod_leo" -#define ICO_ZOD_LIBRA MODULENAME"_zod_libra" -#define ICO_ZOD_PISCES MODULENAME"_zod_pisces" -#define ICO_ZOD_SAGITTARIUS MODULENAME"_zod_sagittarius" -#define ICO_ZOD_SCORPIO MODULENAME"_zod_scorpio" -#define ICO_ZOD_TAURUS MODULENAME"_zod_taurus" -#define ICO_ZOD_VIRGO MODULENAME"_zod_virgo" -#define ICO_TREE_DEFAULT MODULENAME"_tree_default" - -#define ICO_RMD_DTB0 MODULENAME"_rmd_dtb0" -#define ICO_RMD_DTB1 MODULENAME"_rmd_dtb1" -#define ICO_RMD_DTB2 MODULENAME"_rmd_dtb2" -#define ICO_RMD_DTB3 MODULENAME"_rmd_dtb3" -#define ICO_RMD_DTB4 MODULENAME"_rmd_dtb4" -#define ICO_RMD_DTB5 MODULENAME"_rmd_dtb5" -#define ICO_RMD_DTB6 MODULENAME"_rmd_dtb6" -#define ICO_RMD_DTB7 MODULENAME"_rmd_dtb7" -#define ICO_RMD_DTB8 MODULENAME"_rmd_dtb8" -#define ICO_RMD_DTB9 MODULENAME"_rmd_dtb9" -#define ICO_RMD_DTBX MODULENAME"_rmd_dtbx" - -#define ICO_RMD_DTA0 MODULENAME"_rmd_dta0" -#define ICO_RMD_DTA1 MODULENAME"_rmd_dta1" -#define ICO_RMD_DTA2 MODULENAME"_rmd_dta2" -#define ICO_RMD_DTA3 MODULENAME"_rmd_dta3" -#define ICO_RMD_DTA4 MODULENAME"_rmd_dta4" -#define ICO_RMD_DTA5 MODULENAME"_rmd_dta5" -#define ICO_RMD_DTA6 MODULENAME"_rmd_dta6" -#define ICO_RMD_DTA7 MODULENAME"_rmd_dta7" -#define ICO_RMD_DTA8 MODULENAME"_rmd_dta8" -#define ICO_RMD_DTA9 MODULENAME"_rmd_dta9" -#define ICO_RMD_DTAX MODULENAME"_rmd_dtax" - #define SET_ICONS_CHECKFILEVERSION "CheckIconPackVersion" #define SET_ICONS_BUTTONS "ButtonIcons" #define ICONINDEX(id) max((min((id), IDI_LASTICON)) - IDI_FIRST_ICON, 0) -typedef struct TIconCtrl +struct ICONCTRL { - LPCSTR pszIcon; - UINT Message; - WORD idCtrl; -} ICONCTRL, *LPICONCTRL; + int iIcon; + UINT Message; + WORD idCtrl; +}; LPTSTR IcoLib_GetDefaultIconFileName(); void IcoLib_SetCtrlIcons(HWND hDlg, const ICONCTRL* pCtrl, BYTE numCtrls); diff --git a/plugins/UserInfoEx/src/mir_menuitems.cpp b/plugins/UserInfoEx/src/mir_menuitems.cpp index 8b33978a46..f3c1c6200c 100644 --- a/plugins/UserInfoEx/src/mir_menuitems.cpp +++ b/plugins/UserInfoEx/src/mir_menuitems.cpp @@ -96,7 +96,7 @@ void RebuildContact() //cascade all SET_UID(mi, 0xeb3736b6, 0x3b6, 0x40fa, 0xa7, 0xe5, 0xbb, 0x40, 0xeb, 0x55, 0xf7, 0x84); mi.position = 1000050000; - mi.hIcolibItem = IcoLib_GetIcon(ICO_COMMON_MAIN); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_MAIN); mi.name.a = MODULELONGNAME; mhRoot = Menu_AddContactMenuItem(&mi); hMenuItem[0] = mhRoot; @@ -106,7 +106,7 @@ void RebuildContact() //cascade Ex/Import SET_UID(mi, 0x100de420, 0x4835, 0x4f8d, 0xbd, 0x58, 0x4f, 0x31, 0xcc, 0xe6, 0xc1, 0xa8); mi.position = 1000050100; - mi.hIcolibItem = IcoLib_GetIcon(ICO_BTN_EXIMPORT); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_BTN_EXIMPORT); mi.name.a = LPGEN("Export/import contact"); mhExIm = Menu_AddContactMenuItem(&mi); hMenuItem[0] = mhExIm; @@ -123,7 +123,7 @@ void RebuildContact() mi.pszService = MS_USERINFO_SHOWDIALOG; mi.name.a = LPGEN("User &details"); mi.position = 1000050000; - mi.hIcolibItem = IcoLib_GetIcon(ICO_COMMON_MAIN); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_MAIN); hMenuItem[1] = Menu_AddContactMenuItem(&mi); Menu_ConfigureItem(hMenuItem[1], MCI_OPT_HOTKEY, MAKELPARAM(VK_F3, MOD_ALT)); @@ -136,7 +136,7 @@ void RebuildContact() mi.pszService = MS_USERINFO_VCARD_EXPORT; mi.name.a = mhExIm != NULL ? LPGEN("&Export") : LPGEN("&Export user details"); mi.position = 1000050200; - mi.hIcolibItem = IcoLib_GetIcon(ICO_BTN_EXPORT); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_EXPORT); hMenuItem[2] = Menu_AddContactMenuItem(&mi); // Import @@ -144,7 +144,7 @@ void RebuildContact() mi.pszService = MS_USERINFO_VCARD_IMPORT; mi.name.a = mhExIm != NULL ? LPGEN("&Import") : LPGEN("&Import user details"); mi.position = 1000050300; - mi.hIcolibItem = IcoLib_GetIcon(ICO_BTN_IMPORT); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_IMPORT); hMenuItem[3] = Menu_AddContactMenuItem(&mi); } @@ -188,7 +188,7 @@ void RebuildMain() //cascade all SET_UID(mi, 0x17d277d5, 0x2772, 0x40c6, 0xbd, 0xbb, 0x2c, 0x3a, 0xcc, 0xda, 0xc, 0x72); mi.position = 500050000; - mi.hIcolibItem = IcoLib_GetIcon(ICO_COMMON_MAIN); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_MAIN); mi.name.a = MODULELONGNAME; mhRoot = Menu_AddMainMenuItem(&mi); hMenuItem[item++] = mhRoot; @@ -198,7 +198,7 @@ void RebuildMain() //cascade Ex/Import SET_UID(mi, 0x80666af7, 0x1c92, 0x4ea6, 0xa8, 0xdc, 0x25, 0x88, 0x88, 0x27, 0x92, 0x68); mi.position = 500050000; - mi.hIcolibItem = IcoLib_GetIcon(ICO_BTN_EXIMPORT); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_BTN_EXIMPORT); mi.name.a = LPGEN("Export/import contact"); mhExIm = Menu_AddMainMenuItem(&mi); hMenuItem[item++] = mhExIm; @@ -215,7 +215,7 @@ void RebuildMain() mi.pszService = MS_USERINFO_SHOWDIALOG; mi.name.a = LPGEN("View/change my &details..."); mi.position = 500050000; - mi.hIcolibItem = IcoLib_GetIcon(ICO_COMMON_MAIN); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_MAIN); hMenuItem[item++] = Menu_AddMainMenuItem(&mi); // VCard's Ex/Import menuitems @@ -226,7 +226,7 @@ void RebuildMain() mi.pszService = MS_USERINFO_VCARD_EXPORTALL; mi.name.a = LPGEN("Export all contacts"); mi.position = 500150000; - mi.hIcolibItem = IcoLib_GetIcon(ICO_BTN_EXPORT); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_EXPORT); hMenuItem[item++] = Menu_AddMainMenuItem(&mi); // Import @@ -234,7 +234,7 @@ void RebuildMain() mi.pszService = MS_USERINFO_VCARD_IMPORTALL; mi.name.a = LPGEN("Import all contacts"); mi.position = 500151000; - mi.hIcolibItem = IcoLib_GetIcon(ICO_BTN_IMPORT); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_IMPORT); hMenuItem[item++] = Menu_AddMainMenuItem(&mi); // reminder @@ -248,7 +248,7 @@ void RebuildMain() mi.pszService = MS_USERINFO_REMINDER_AGGRASIVEBACKUP; mi.name.a = LPGEN("Backup birthdays"); mi.position = 500253000; - mi.hIcolibItem = IcoLib_GetIcon(ICO_BTN_BDAY_BACKUP); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_BTN_BIRTHDAY_BACKUP); hMenuItem[item++] = Menu_AddMainMenuItem(&mi); // Check anniversaries @@ -256,7 +256,7 @@ void RebuildMain() mi.pszService = MS_USERINFO_REMINDER_CHECK; mi.name.a = LPGEN("Check anniversaries"); mi.position = 500251000; - mi.hIcolibItem = IcoLib_GetIcon(ICO_BTN_SEARCH); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_SEARCH); hMenuItem[item++] = Menu_AddMainMenuItem(&mi); } else { @@ -269,7 +269,7 @@ void RebuildMain() mi.pszService = MS_USERINFO_REFRESH; mi.name.a = LPGEN("Refresh contact details"); mi.position = 500254000; - mi.hIcolibItem = IcoLib_GetIcon(ICO_BTN_UPDATE); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_BTN_UPDATE); hMenuItem[item++] = Menu_AddMainMenuItem(&mi); // anniversary list @@ -277,7 +277,7 @@ void RebuildMain() mi.pszService = MS_USERINFO_REMINDER_LIST; mi.name.a = LPGEN("Anniversary list"); mi.position = 500252000; - mi.hIcolibItem = IcoLib_GetIcon(ICO_COMMON_ANNIVERSARY); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_ANNIVERSARY); hMenuItem[item++] = Menu_AddMainMenuItem(&mi); } @@ -326,7 +326,7 @@ void RebuildGroup() //cascade all SET_UID(mi, 0xfefe20db, 0x431f, 0x4fef, 0x9d, 0xa6, 0x70, 0xcd, 0x25, 0xf1, 0x2f, 0x1d); mi.position = 250000; - mi.hIcolibItem = IcoLib_GetIcon(ICO_COMMON_MAIN); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_MAIN); mi.name.a = MODULELONGNAME; mhRoot = Menu_AddGroupMenuItem(&mi); hMenuItem[item++] = mhRoot; @@ -336,7 +336,7 @@ void RebuildGroup() //cascade Ex/Import SET_UID(mi, 0x3ec4da1, 0x8a1a, 0x4734, 0xba, 0x99, 0x7, 0x9c, 0x2, 0x46, 0xff, 0xec); mi.position = 250100; - mi.hIcolibItem = IcoLib_GetIcon(ICO_BTN_EXIMPORT); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_BTN_EXIMPORT); mi.name.a = LPGEN("Export/import contact"); mhExIm = Menu_AddGroupMenuItem(&mi); hMenuItem[item++] = mhExIm; @@ -355,7 +355,7 @@ void RebuildGroup() mi.pszService = MS_USERINFO_VCARD_EXPORTALL; mi.name.a = LPGEN("Export all contacts"); mi.position = 250200; - mi.hIcolibItem = IcoLib_GetIcon(ICO_BTN_EXPORT); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_EXPORT); hMenuItem[item++] = Menu_AddGroupMenuItem(&mi); // Import @@ -363,7 +363,7 @@ void RebuildGroup() mi.pszService = MS_USERINFO_VCARD_IMPORTALL; mi.name.a = LPGEN("Import all contacts"); mi.position = 250300; - mi.hIcolibItem = IcoLib_GetIcon(ICO_BTN_IMPORT); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_IMPORT); hMenuItem[item++] = Menu_AddGroupMenuItem(&mi); } @@ -418,7 +418,7 @@ void RebuildSubGroup() //cascade all SET_UID(mi, 0x77b46004, 0xe845, 0x41f4, 0x9a, 0x56, 0x72, 0xd9, 0xa5, 0x61, 0x4d, 0x5); mi.position = 1050000; - mi.hIcolibItem = IcoLib_GetIcon(ICO_COMMON_MAIN); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_MAIN); mi.name.a = MODULELONGNAME; mhRoot = Menu_AddSubGroupMenuItem(&mi); hMenuItem[item++] = mhRoot; @@ -428,7 +428,7 @@ void RebuildSubGroup() //cascade Ex/Import SET_UID(mi, 0xac5e810b, 0x4b41, 0x477c, 0x98, 0xfe, 0x8, 0x88, 0xec, 0x6f, 0xc3, 0xcf); mi.position = 1050100; - mi.hIcolibItem = IcoLib_GetIcon(ICO_BTN_EXIMPORT); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_BTN_EXIMPORT); mi.name.a = LPGEN("Export/import group"); mhExIm = Menu_AddSubGroupMenuItem(&mi); hMenuItem[item++] = mhExIm; @@ -448,7 +448,7 @@ void RebuildSubGroup() if (!ServiceExists(mi.pszService)) CreateServiceFunction(mi.pszService, svcExIm_Group_Service); mi.name.a = mhExIm != NULL ? LPGEN("&Export") : LPGEN("&Export group"); mi.position = 1050200; - mi.hIcolibItem = IcoLib_GetIcon(ICO_BTN_EXPORT); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_EXPORT); gmp.wParam = TRUE; hMenuItem[item++] = Menu_AddSubGroupMenuItem(&mi, &gmp); @@ -458,7 +458,7 @@ void RebuildSubGroup() if (!ServiceExists(mi.pszService)) CreateServiceFunction(mi.pszService, svcExIm_Group_Service); mi.name.a = mhExIm != NULL ? LPGEN("&Import") : LPGEN("&Import group"); mi.position = 1050300; - mi.hIcolibItem = IcoLib_GetIcon(ICO_BTN_IMPORT); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_IMPORT); gmp.wParam = FALSE; hMenuItem[item++] = Menu_AddSubGroupMenuItem(&mi, &gmp); } @@ -539,7 +539,7 @@ INT_PTR RebuildAccount(WPARAM, LPARAM lParam) case 5: // cascade all mi.position = 50100; - mi.hIcolibItem = IcoLib_GetIcon(ICO_COMMON_MAIN); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_MAIN); mi.name.a = MODULELONGNAME; hMenuItemAccount[mItems*i + item] = Menu_AddStatusMenuItem(&mi, pa->szModuleName); mhRoot = hMenuItemAccount[mItems*i + item++]; @@ -548,7 +548,7 @@ INT_PTR RebuildAccount(WPARAM, LPARAM lParam) case 9: // cascade Ex/Import mi.position = 50100; - mi.hIcolibItem = IcoLib_GetIcon(ICO_BTN_EXIMPORT); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_BTN_EXIMPORT); mi.name.a = LPGEN("Export/import"); hMenuItemAccount[mItems*i + item] = Menu_AddStatusMenuItem(&mi, pa->szModuleName); mhRoot = hMenuItemAccount[mItems*i + item++]; @@ -567,7 +567,7 @@ INT_PTR RebuildAccount(WPARAM, LPARAM lParam) CreateServiceFunction(mi.pszService, svcExIm_Account_Service); mi.name.a = LPGEN("&Export xml"); mi.position = 50200; - mi.hIcolibItem = IcoLib_GetIcon(ICO_BTN_EXPORT); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_EXPORT); hMenuItemAccount[mItems*i + item++] = Menu_AddStatusMenuItem(&mi, pa->szModuleName); // Import @@ -575,7 +575,7 @@ INT_PTR RebuildAccount(WPARAM, LPARAM lParam) CreateServiceFunction(mi.pszService, svcExIm_Account_Service); mi.name.a = LPGEN("&Import xml"); mi.position = 50300; - mi.hIcolibItem = IcoLib_GetIcon(ICO_BTN_IMPORT); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_IMPORT); hMenuItemAccount[mItems*i + item++] = Menu_AddStatusMenuItem(&mi, pa->szModuleName); } return 0; diff --git a/plugins/UserInfoEx/src/psp_anniversary.cpp b/plugins/UserInfoEx/src/psp_anniversary.cpp index a75ad3d52f..a185512b59 100644 --- a/plugins/UserInfoEx/src/psp_anniversary.cpp +++ b/plugins/UserInfoEx/src/psp_anniversary.cpp @@ -45,10 +45,10 @@ static INT_PTR CALLBACK DlgProc_AnniversaryEditor(HWND hDlg, UINT uMsg, WPARAM w // set icons if (g_plugin.getByte(SET_ICONS_BUTTONS, 1)) { - SendDlgItemMessage(hDlg, IDOK, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_BTN_OK)); - SendDlgItemMessage(hDlg, IDCANCEL, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_BTN_CANCEL)); + SendDlgItemMessage(hDlg, IDOK, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(IDI_BTN_OK)); + SendDlgItemMessage(hDlg, IDCANCEL, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(IDI_BTN_CLOSE)); } - SendDlgItemMessage(hDlg, IDC_HEADERBAR, WM_SETICON, 0, (LPARAM)IcoLib_GetIcon(ICO_DLG_ANNIVERSARY, TRUE)); + SendDlgItemMessage(hDlg, IDC_HEADERBAR, WM_SETICON, 0, (LPARAM)g_plugin.getIcon(IDI_ANNIVERSARY, true)); // translate controls SendDlgItemMessage(hDlg, IDOK, BUTTONTRANSLATE, NULL, NULL); @@ -146,9 +146,9 @@ INT_PTR CALLBACK PSPProcAnniversary(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM case PSN_ICONCHANGED: { const ICONCTRL idIcon[] = { - { ICO_COMMON_BIRTHDAY, STM_SETIMAGE, ICO_BIRTHDAY }, - { ICO_BTN_ADD, BM_SETIMAGE, BTN_ADD }, - { ICO_BTN_DELETE, BM_SETIMAGE, BTN_DELETE } + { IDI_BIRTHDAY, STM_SETIMAGE, ICO_BIRTHDAY }, + { IDI_BTN_ADD, BM_SETIMAGE, BTN_ADD }, + { IDI_BTN_DELETE, BM_SETIMAGE, BTN_DELETE } }; IcoLib_SetCtrlIcons(hDlg, idIcon, _countof(idIcon)); } diff --git a/plugins/UserInfoEx/src/psp_contact.cpp b/plugins/UserInfoEx/src/psp_contact.cpp index 75eb8909ec..0a2f3c857e 100644 --- a/plugins/UserInfoEx/src/psp_contact.cpp +++ b/plugins/UserInfoEx/src/psp_contact.cpp @@ -84,18 +84,18 @@ INT_PTR CALLBACK PSPProcContactHome(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM // phone numbers hCtrl = GetDlgItem(hDlg, EDIT_PHONE); - bChanged |= CtrlContactAddItemFromDB(hCtrl, ICO_BTN_PHONE, TranslateT(SET_CONTACT_PHONE), hContact, USERINFO, pszProto, SET_CONTACT_PHONE); - bChanged |= CtrlContactAddItemFromDB(hCtrl, ICO_BTN_FAX, TranslateT(SET_CONTACT_FAX), hContact, USERINFO, pszProto, SET_CONTACT_FAX); - bChanged |= CtrlContactAddItemFromDB(hCtrl, ICO_BTN_CELLULAR, TranslateT(SET_CONTACT_CELLULAR), hContact, USERINFO, pszProto, SET_CONTACT_CELLULAR); - bChanged |= CtrlContactAddMyItemsFromDB(hCtrl, ICO_BTN_CUSTOMPHONE, 0, hContact, USERINFO, pszProto, SET_CONTACT_MYPHONE_CAT, SET_CONTACT_MYPHONE_VAL); + bChanged |= CtrlContactAddItemFromDB(hCtrl, IDI_BTN_PHONE, TranslateT(SET_CONTACT_PHONE), hContact, USERINFO, pszProto, SET_CONTACT_PHONE); + bChanged |= CtrlContactAddItemFromDB(hCtrl, IDI_BTN_FAX, TranslateT(SET_CONTACT_FAX), hContact, USERINFO, pszProto, SET_CONTACT_FAX); + bChanged |= CtrlContactAddItemFromDB(hCtrl, IDI_BTN_CELLULAR, TranslateT(SET_CONTACT_CELLULAR), hContact, USERINFO, pszProto, SET_CONTACT_CELLULAR); + bChanged |= CtrlContactAddMyItemsFromDB(hCtrl, IDI_BTN_CUSTOMPHONE, 0, hContact, USERINFO, pszProto, SET_CONTACT_MYPHONE_CAT, SET_CONTACT_MYPHONE_VAL); SendMessage(hCtrl, CBEXM_SETCURSEL, (WPARAM)-1, TRUE); // emails hCtrl = GetDlgItem(hDlg, EDIT_EMAIL); - bChanged |= CtrlContactAddItemFromDB(hCtrl, ICO_BTN_EMAIL, TranslateT("Primary e-mail"), hContact, USERINFO, pszProto, SET_CONTACT_EMAIL); - bChanged |= CtrlContactAddItemFromDB(hCtrl, ICO_BTN_EMAIL, TranslateT("Secondary e-mail"), hContact, USERINFO, pszProto, SET_CONTACT_EMAIL0); - bChanged |= CtrlContactAddItemFromDB(hCtrl, ICO_BTN_EMAIL, TranslateT("Tertiary e-mail"), hContact, USERINFO, pszProto, SET_CONTACT_EMAIL1); - bChanged |= CtrlContactAddMyItemsFromDB(hCtrl, ICO_BTN_EMAIL, 0, hContact, USERINFO, pszProto, SET_CONTACT_MYEMAIL_CAT, SET_CONTACT_MYEMAIL_VAL); + bChanged |= CtrlContactAddItemFromDB(hCtrl, IDI_BTN_EMAIL, TranslateT("Primary e-mail"), hContact, USERINFO, pszProto, SET_CONTACT_EMAIL); + bChanged |= CtrlContactAddItemFromDB(hCtrl, IDI_BTN_EMAIL, TranslateT("Secondary e-mail"), hContact, USERINFO, pszProto, SET_CONTACT_EMAIL0); + bChanged |= CtrlContactAddItemFromDB(hCtrl, IDI_BTN_EMAIL, TranslateT("Tertiary e-mail"), hContact, USERINFO, pszProto, SET_CONTACT_EMAIL1); + bChanged |= CtrlContactAddMyItemsFromDB(hCtrl, IDI_BTN_EMAIL, 0, hContact, USERINFO, pszProto, SET_CONTACT_MYEMAIL_CAT, SET_CONTACT_MYEMAIL_VAL); SendMessage(hCtrl, CBEXM_SETCURSEL, (WPARAM)-1, TRUE); SetWindowLongPtr(hDlg, DWLP_MSGRESULT, bChanged ? PSP_CHANGED : 0); } @@ -124,11 +124,11 @@ INT_PTR CALLBACK PSPProcContactHome(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM case PSN_ICONCHANGED: { - HICON hIcon = IcoLib_GetIcon(ICO_BTN_GOTO); + HICON hIcon = g_plugin.getIcon(IDI_BTN_GOTO); SendDlgItemMessage(hDlg, BTN_GOTO, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon); SetDlgItemText(hDlg, BTN_GOTO, hIcon ? L"" : L"->"); - hIcon = IcoLib_GetIcon(ICO_COMMON_ADDRESS); + hIcon = g_plugin.getIcon(IDI_TREE_ADDRESS); SendDlgItemMessage(hDlg, ICO_ADDRESS, STM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon); ShowWindow(GetDlgItem(hDlg, ICO_ADDRESS), hIcon ? SW_SHOW : SW_HIDE); @@ -228,18 +228,18 @@ INT_PTR CALLBACK PSPProcContactWork(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM // phone numbers hCtrl = GetDlgItem(hDlg, EDIT_PHONE); - bChanged |= CtrlContactAddItemFromDB(hCtrl, ICO_BTN_PHONE, TranslateT(SET_CONTACT_PHONE), hContact, USERINFO, pszProto, SET_CONTACT_COMPANY_PHONE); - bChanged |= CtrlContactAddItemFromDB(hCtrl, ICO_BTN_FAX, TranslateT(SET_CONTACT_FAX), hContact, USERINFO, pszProto, SET_CONTACT_COMPANY_FAX); - bChanged |= CtrlContactAddItemFromDB(hCtrl, ICO_BTN_CELLULAR, TranslateT(SET_CONTACT_CELLULAR), hContact, USERINFO, pszProto, SET_CONTACT_COMPANY_CELLULAR); - bChanged |= CtrlContactAddMyItemsFromDB(hCtrl, ICO_BTN_CUSTOMPHONE, 0, hContact, USERINFO, pszProto, SET_CONTACT_COMPANY_MYPHONE_CAT, SET_CONTACT_COMPANY_MYPHONE_VAL); + bChanged |= CtrlContactAddItemFromDB(hCtrl, IDI_BTN_PHONE, TranslateT(SET_CONTACT_PHONE), hContact, USERINFO, pszProto, SET_CONTACT_COMPANY_PHONE); + bChanged |= CtrlContactAddItemFromDB(hCtrl, IDI_BTN_FAX, TranslateT(SET_CONTACT_FAX), hContact, USERINFO, pszProto, SET_CONTACT_COMPANY_FAX); + bChanged |= CtrlContactAddItemFromDB(hCtrl, IDI_BTN_CELLULAR, TranslateT(SET_CONTACT_CELLULAR), hContact, USERINFO, pszProto, SET_CONTACT_COMPANY_CELLULAR); + bChanged |= CtrlContactAddMyItemsFromDB(hCtrl, IDI_BTN_CUSTOMPHONE, 0, hContact, USERINFO, pszProto, SET_CONTACT_COMPANY_MYPHONE_CAT, SET_CONTACT_COMPANY_MYPHONE_VAL); SendMessage(hCtrl, CBEXM_SETCURSEL, (WPARAM)-1, TRUE); // emails hCtrl = GetDlgItem(hDlg, EDIT_EMAIL); - bChanged |= CtrlContactAddItemFromDB(hCtrl, ICO_BTN_EMAIL, TranslateT("Primary e-mail"), hContact, USERINFO, pszProto, SET_CONTACT_COMPANY_EMAIL); - bChanged |= CtrlContactAddItemFromDB(hCtrl, ICO_BTN_EMAIL, TranslateT("Secondary e-mail"), hContact, USERINFO, pszProto, SET_CONTACT_COMPANY_EMAIL0); - bChanged |= CtrlContactAddItemFromDB(hCtrl, ICO_BTN_EMAIL, TranslateT("Tertiary e-mail"), hContact, USERINFO, pszProto, SET_CONTACT_COMPANY_EMAIL1); - bChanged |= CtrlContactAddMyItemsFromDB(hCtrl, ICO_BTN_EMAIL, 0, hContact, USERINFO, pszProto, SET_CONTACT_COMPANY_MYEMAIL_CAT, SET_CONTACT_COMPANY_MYEMAIL_VAL); + bChanged |= CtrlContactAddItemFromDB(hCtrl, IDI_BTN_EMAIL, TranslateT("Primary e-mail"), hContact, USERINFO, pszProto, SET_CONTACT_COMPANY_EMAIL); + bChanged |= CtrlContactAddItemFromDB(hCtrl, IDI_BTN_EMAIL, TranslateT("Secondary e-mail"), hContact, USERINFO, pszProto, SET_CONTACT_COMPANY_EMAIL0); + bChanged |= CtrlContactAddItemFromDB(hCtrl, IDI_BTN_EMAIL, TranslateT("Tertiary e-mail"), hContact, USERINFO, pszProto, SET_CONTACT_COMPANY_EMAIL1); + bChanged |= CtrlContactAddMyItemsFromDB(hCtrl, IDI_BTN_EMAIL, 0, hContact, USERINFO, pszProto, SET_CONTACT_COMPANY_MYEMAIL_CAT, SET_CONTACT_COMPANY_MYEMAIL_VAL); SendMessage(hCtrl, CBEXM_SETCURSEL, (WPARAM)-1, TRUE); SetWindowLongPtr(hDlg, DWLP_MSGRESULT, bChanged ? PSP_CHANGED : 0); } @@ -268,11 +268,11 @@ INT_PTR CALLBACK PSPProcContactWork(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM case PSN_ICONCHANGED: { - HICON hIcon = IcoLib_GetIcon(ICO_BTN_GOTO); + HICON hIcon = g_plugin.getIcon(IDI_BTN_GOTO); SendDlgItemMessage(hDlg, BTN_GOTO, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon); SetDlgItemText(hDlg, BTN_GOTO, hIcon ? L"" : L"->"); - hIcon = IcoLib_GetIcon(ICO_COMMON_ADDRESS); + hIcon = g_plugin.getIcon(IDI_TREE_ADDRESS); SendDlgItemMessage(hDlg, ICO_ADDRESS, STM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon); ShowWindow(GetDlgItem(hDlg, ICO_ADDRESS), hIcon ? SW_SHOW : SW_HIDE); diff --git a/plugins/UserInfoEx/src/psp_general.cpp b/plugins/UserInfoEx/src/psp_general.cpp index 3dc0e6de02..fbfc25c044 100644 --- a/plugins/UserInfoEx/src/psp_general.cpp +++ b/plugins/UserInfoEx/src/psp_general.cpp @@ -127,9 +127,9 @@ INT_PTR CALLBACK PSPProcGeneral(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar case PSN_ICONCHANGED: { const ICONCTRL idIcon[] = { - { ICO_COMMON_FEMALE, STM_SETIMAGE, ICO_FEMALE }, - { ICO_COMMON_MALE, STM_SETIMAGE, ICO_MALE }, - { ICO_COMMON_MARITAL, STM_SETIMAGE, ICO_MARITAL }, + { IDI_FEMALE, STM_SETIMAGE, ICO_FEMALE }, + { IDI_MALE, STM_SETIMAGE, ICO_MALE }, + { IDI_MARITAL, STM_SETIMAGE, ICO_MARITAL }, }; IcoLib_SetCtrlIcons(hDlg, idIcon, _countof(idIcon)); } diff --git a/plugins/UserInfoEx/src/psp_options.cpp b/plugins/UserInfoEx/src/psp_options.cpp index 9d8d704089..06bf4e6e1b 100644 --- a/plugins/UserInfoEx/src/psp_options.cpp +++ b/plugins/UserInfoEx/src/psp_options.cpp @@ -590,7 +590,7 @@ static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam TranslateDialogDefault(hDlg); ShowWindow(GetDlgItem(hDlg, CHECK_REMIND_SECURED), SW_SHOW); - SendDlgItemMessage(hDlg, ICO_BIRTHDAY, STM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_DLG_ANNIVERSARY, TRUE)); + SendDlgItemMessage(hDlg, ICO_BIRTHDAY, STM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(IDI_ANNIVERSARY, true)); // set colours SendDlgItemMessage(hDlg, EDIT_REMIND, EM_LIMITTEXT, 2, 0); @@ -888,7 +888,7 @@ static INT_PTR CALLBACK DlgProc_Popups(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR // Birthday mir_wstrncpy(ppd.lpwzContactName, TranslateT("Birthday"), _countof(ppd.lpwzContactName)); - ppd.lchIcon = IcoLib_GetIcon(ICO_RMD_DTB0); + ppd.lchIcon = g_plugin.getIcon(IDI_RMD_DTB0); if (IsDlgButtonChecked(hDlg, CHECK_OPT_POPUP_WINCLR)) { ppd.colorBack = GetSysColor(COLOR_BTNFACE); ppd.colorText = GetSysColor(COLOR_WINDOWTEXT); @@ -901,7 +901,7 @@ static INT_PTR CALLBACK DlgProc_Popups(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR // Anniversary mir_wstrncpy(ppd.lpwzContactName, TranslateT("Anniversary"), _countof(ppd.lpwzContactName)); - ppd.lchIcon = IcoLib_GetIcon(ICO_RMD_DTAX); + ppd.lchIcon = g_plugin.getIcon(IDI_RMD_DTAX); if (IsDlgButtonChecked(hDlg, CHECK_OPT_POPUP_WINCLR)) { ppd.colorBack = GetSysColor(COLOR_BTNFACE); ppd.colorText = GetSysColor(COLOR_WINDOWTEXT); diff --git a/plugins/UserInfoEx/src/psp_origin.cpp b/plugins/UserInfoEx/src/psp_origin.cpp index 5c804278d4..2d8d48faa5 100644 --- a/plugins/UserInfoEx/src/psp_origin.cpp +++ b/plugins/UserInfoEx/src/psp_origin.cpp @@ -106,8 +106,8 @@ INT_PTR CALLBACK PSPProcOrigin(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara case PSN_ICONCHANGED: { const ICONCTRL idIcon[] = { - { ICO_COMMON_ADDRESS, STM_SETIMAGE, ICO_ADDRESS }, - { ICO_COMMON_CLOCK, STM_SETIMAGE, ICO_CLOCK }, + { IDI_TREE_ADDRESS, STM_SETIMAGE, ICO_ADDRESS }, + { IDI_CLOCK, STM_SETIMAGE, ICO_CLOCK }, }; IcoLib_SetCtrlIcons(hDlg, idIcon, _countof(idIcon)); diff --git a/plugins/UserInfoEx/src/svc_email.cpp b/plugins/UserInfoEx/src/svc_email.cpp index 7652aba64f..2195bf7064 100644 --- a/plugins/UserInfoEx/src/svc_email.cpp +++ b/plugins/UserInfoEx/src/svc_email.cpp @@ -127,7 +127,7 @@ static INT_PTR MenuCommand(WPARAM wParam,LPARAM lParam) static int OnCListApplyIcons(WPARAM wParam, LPARAM) { LPSTR val = Get(wParam); - ExtraIcon_SetIconByName(ghExtraIconSvc, wParam, (val) ? ICO_BTN_EMAIL : nullptr); + ExtraIcon_SetIcon(ghExtraIconSvc, wParam, (val) ? g_plugin.getIconHandle(IDI_DLG_EMAIL) : nullptr); mir_free(val); return 0; } @@ -186,7 +186,7 @@ void SvcEMailRebuildMenu() CMenuItem mi(&g_plugin); SET_UID(mi, 0x61d8e25a, 0x92e, 0x4470, 0x84, 0x57, 0x5e, 0x52, 0x17, 0x7f, 0xfa, 0x3); mi.position = -2000010000; - mi.hIcolibItem = IcoLib_GetIcon(ICO_BTN_EMAIL); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_DLG_EMAIL); mi.name.a = "&E-mail"; mi.pszService = MS_EMAIL_SENDEMAIL; ghMenuItem = Menu_AddContactMenuItem(&mi); @@ -229,7 +229,7 @@ bool SvcEMailEnableExtraIcons(bool bEnable, bool bUpdateDB) hApplyIconHook = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, OnCListApplyIcons); if (ghExtraIconSvc == INVALID_HANDLE_VALUE) - ghExtraIconSvc = ExtraIcon_RegisterIcolib("email", LPGEN("E-mail (UInfoEx)"), ICO_BTN_EMAIL); + ghExtraIconSvc = ExtraIcon_RegisterIcolib("email", LPGEN("E-mail (UInfoEx)"), g_plugin.getIconHandle(IDI_BTN_EMAIL)); } else { // E-mail uncheckt if (hChangedHook) { diff --git a/plugins/UserInfoEx/src/svc_gender.cpp b/plugins/UserInfoEx/src/svc_gender.cpp index bd57c715c5..39a6c19af1 100644 --- a/plugins/UserInfoEx/src/svc_gender.cpp +++ b/plugins/UserInfoEx/src/svc_gender.cpp @@ -72,13 +72,13 @@ BYTE GenderOf(MCONTACT hContact) static int OnCListApplyIcons(MCONTACT hContact, LPARAM) { if (ghExtraIconSvc != INVALID_HANDLE_VALUE) { - char *icoName; + HANDLE hIcon; switch (GenderOf(hContact)) { - case 'M': icoName = ICO_COMMON_MALE; break; - case 'F': icoName = ICO_COMMON_FEMALE; break; - default: icoName = nullptr; + case 'M': hIcon = g_plugin.getIconHandle(IDI_MALE); break; + case 'F': hIcon = g_plugin.getIconHandle(IDI_FEMALE); break; + default: hIcon = nullptr; } - ExtraIcon_SetIconByName(ghExtraIconSvc, hContact, icoName); + ExtraIcon_SetIcon(ghExtraIconSvc, hContact, hIcon); } return 0; } @@ -117,7 +117,7 @@ bool SvcGenderEnableExtraIcons(bool bEnable, bool bUpdateDB) if (g_eiGender) { // Gender checked or dropdown select if (ghExtraIconSvc == INVALID_HANDLE_VALUE) - ghExtraIconSvc = ExtraIcon_RegisterIcolib("gender", LPGEN("Gender (UInfoEx)"), ICO_COMMON_MALE); + ghExtraIconSvc = ExtraIcon_RegisterIcolib("gender", LPGEN("Gender (UInfoEx)"), g_plugin.getIconHandle(IDI_MALE)); // hook events if (hChangedHook == nullptr) diff --git a/plugins/UserInfoEx/src/svc_homepage.cpp b/plugins/UserInfoEx/src/svc_homepage.cpp index 8361873cb6..21822d1dd2 100644 --- a/plugins/UserInfoEx/src/svc_homepage.cpp +++ b/plugins/UserInfoEx/src/svc_homepage.cpp @@ -93,7 +93,7 @@ static int OnCListApplyIcons(MCONTACT hContact, LPARAM) { LPSTR val = Get(hContact); if (ghExtraIconSvc != INVALID_HANDLE_VALUE) - ExtraIcon_SetIconByName(ghExtraIconSvc, hContact, (val) ? ICO_BTN_GOTO : nullptr); + ExtraIcon_SetIcon(ghExtraIconSvc, hContact, (val) ? g_plugin.getIconHandle(IDI_BTN_GOTO) : nullptr); MIR_FREE(val); return 0; } @@ -156,7 +156,7 @@ void SvcHomepageRebuildMenu() CMenuItem mi(&g_plugin); SET_UID(mi, 0xdb78c16e, 0x50db, 0x4a40, 0x80, 0x0, 0xd1, 0xa4, 0x1c, 0x1b, 0xa3, 0x2d); mi.position = -2000010000; - mi.hIcolibItem = IcoLib_GetIcon(ICO_BTN_GOTO); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_BTN_GOTO); mi.name.a = LPGEN("&Homepage"); mi.pszService = MS_USERINFO_HOMEPAGE_OPENURL; ghMenuItem = Menu_AddContactMenuItem(&mi); @@ -189,7 +189,7 @@ bool SvcHomepageEnableExtraIcons(bool bEnable, bool bUpdateDB) hApplyIconHook = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, (MIRANDAHOOK)OnCListApplyIcons); if (ghExtraIconSvc == INVALID_HANDLE_VALUE) - ghExtraIconSvc = ExtraIcon_RegisterIcolib("homepage", LPGEN("Homepage (UInfoEx)"), ICO_BTN_GOTO); + ghExtraIconSvc = ExtraIcon_RegisterIcolib("homepage", LPGEN("Homepage (UInfoEx)"), g_plugin.getIconHandle(IDI_BTN_GOTO)); } else { if (hChangedHook) { diff --git a/plugins/UserInfoEx/src/svc_phone.cpp b/plugins/UserInfoEx/src/svc_phone.cpp index 49215d1471..97d436a458 100644 --- a/plugins/UserInfoEx/src/svc_phone.cpp +++ b/plugins/UserInfoEx/src/svc_phone.cpp @@ -88,13 +88,13 @@ static INT_PTR Get(MCONTACT hContact) static int OnCListApplyIcons(MCONTACT hContact, LPARAM) { - char *icoName; + HANDLE hIcon; switch (Get(hContact)) { - case PHONE_NORMAL: icoName = ICO_BTN_PHONE; break; - case PHONE_SMS: icoName = ICO_BTN_CELLULAR; break; - default: icoName = nullptr; + case PHONE_NORMAL: hIcon = g_plugin.getIconHandle(IDI_BTN_PHONE); break; + case PHONE_SMS: hIcon = g_plugin.getIconHandle(IDI_BTN_CELLULAR); break; + default: hIcon = nullptr; } - ExtraIcon_SetIconByName(ghExtraIconSvc, hContact, icoName); + ExtraIcon_SetIcon(ghExtraIconSvc, hContact, hIcon); return 0; } @@ -146,7 +146,7 @@ bool SvcPhoneEnableExtraIcons(bool bEnable, bool bUpdateDB) hApplyIconHook = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, (MIRANDAHOOK)OnCListApplyIcons); if (ghExtraIconSvc == INVALID_HANDLE_VALUE) - ghExtraIconSvc = ExtraIcon_RegisterIcolib("sms", LPGEN("Phone (UInfoEx)"), ICO_BTN_CELLULAR); + ghExtraIconSvc = ExtraIcon_RegisterIcolib("sms", LPGEN("Phone (UInfoEx)"), g_plugin.getIconHandle(IDI_BTN_CELLULAR)); } else { if (hChangedHook) { diff --git a/plugins/UserInfoEx/src/svc_refreshci.cpp b/plugins/UserInfoEx/src/svc_refreshci.cpp index 0d7bc2b4de..9b28bfe730 100644 --- a/plugins/UserInfoEx/src/svc_refreshci.cpp +++ b/plugins/UserInfoEx/src/svc_refreshci.cpp @@ -221,9 +221,9 @@ class CDlgUpdProgress : public CUpdProgress case WM_INITDIALOG: { const ICONCTRL idIcon[] = { - { ICO_BTN_UPDATE, WM_SETICON, NULL }, - { ICO_BTN_DOWNARROW, BM_SETIMAGE, IDSKIP }, - { ICO_BTN_CANCEL, BM_SETIMAGE, IDCANCEL } + { IDI_BTN_UPDATE, WM_SETICON, NULL }, + { IDI_BTN_DOWNARROW, BM_SETIMAGE, IDSKIP }, + { IDI_BTN_CLOSE, BM_SETIMAGE, IDCANCEL } }; IcoLib_SetCtrlIcons(hWnd, idIcon, g_plugin.getByte(SET_ICONS_BUTTONS, 1) ? 2 : 1); @@ -373,7 +373,7 @@ public: _popupButtons[0].cbSize = sizeof(POPUPACTION); _popupButtons[0].flags = PAF_ENABLED; - _popupButtons[0].lchIcon = IcoLib_GetIcon(ICO_BTN_DOWNARROW); + _popupButtons[0].lchIcon = g_plugin.getIcon(IDI_BTN_DOWNARROW); _popupButtons[0].wParam = MAKEWORD(IDSKIP, BN_CLICKED); _popupButtons[0].lParam = NULL; mir_strcpy(_popupButtons[0].lpzTitle, MODULENAME"/Hide"); @@ -381,7 +381,7 @@ public: // cancel button _popupButtons[1].cbSize = sizeof(POPUPACTION); _popupButtons[1].flags = PAF_ENABLED; - _popupButtons[1].lchIcon = IcoLib_GetIcon(ICO_BTN_CANCEL); + _popupButtons[1].lchIcon = g_plugin.getIcon(IDI_BTN_CLOSE); _popupButtons[1].wParam = MAKEWORD(IDCANCEL, BN_CLICKED); _popupButtons[1].lParam = NULL; mir_strcpy(_popupButtons[1].lpzTitle, MODULENAME"/Cancel"); @@ -394,7 +394,7 @@ public: virtual HWND Create(LPCTSTR szTitle, PUpdCallback pFnCallBack) { POPUPDATAW ppd; - ppd.lchIcon = IcoLib_GetIcon(ICO_BTN_UPDATE); + ppd.lchIcon = g_plugin.getIcon(IDI_BTN_UPDATE); ppd.iSeconds = -1; ppd.PluginData = this; ppd.PluginWindowProc = CPopupUpdProgress::WndProc; @@ -565,7 +565,7 @@ class CContactUpdater : public CContactQueue // reset menu if (hMenuItemRefresh) - Menu_ModifyItem(hMenuItemRefresh, LPGENW("Refresh contact details"), IcoLib_GetIconHandle(ICO_BTN_UPDATE)); + Menu_ModifyItem(hMenuItemRefresh, LPGENW("Refresh contact details"), g_plugin.getIconHandle(IDI_BTN_UPDATE)); } /** @@ -645,7 +645,7 @@ public: // if there are contacts in the queue, change the main menu item to indicate it is meant for canceling. if (hMenuItemRefresh && Size() > 0) - Menu_ModifyItem(hMenuItemRefresh, LPGENW("Abort Refreshing Contact Details"), IcoLib_GetIconHandle(ICO_BTN_CANCEL)); + Menu_ModifyItem(hMenuItemRefresh, LPGENW("Abort Refreshing Contact Details"), g_plugin.getIconHandle(IDI_BTN_CLOSE)); } void Cancel() diff --git a/plugins/UserInfoEx/src/svc_reminder.cpp b/plugins/UserInfoEx/src/svc_reminder.cpp index 6f6b207e52..93ec9fbad0 100644 --- a/plugins/UserInfoEx/src/svc_reminder.cpp +++ b/plugins/UserInfoEx/src/svc_reminder.cpp @@ -141,25 +141,19 @@ static HICON GetAnnivIcon(const CEvent &evt) { HICON hIcon = nullptr; - CHAR szIcon[MAXSETTING]; - switch (evt._eType) { case CEvent::BIRTHDAY: if (evt._wDaysLeft > 9) - hIcon = IcoLib_GetIcon(ICO_RMD_DTBX); - else { - mir_snprintf(szIcon, MODULENAME"_rmd_dtb%u", evt._wDaysLeft); - hIcon = IcoLib_GetIcon(szIcon); - } + hIcon = g_plugin.getIcon(IDI_RMD_DTBX); + else + hIcon = g_plugin.getIcon(IDI_RMD_DTB0 + evt._wDaysLeft); break; case CEvent::ANNIVERSARY: if (evt._wDaysLeft > 9) - hIcon = IcoLib_GetIcon(ICO_RMD_DTAX); - else { - mir_snprintf(szIcon, MODULENAME"_rmd_dta%u", evt._wDaysLeft); - hIcon = IcoLib_GetIcon(szIcon); - } + hIcon = g_plugin.getIcon(IDI_RMD_DTAX); + else + hIcon = g_plugin.getIcon(IDI_RMD_DTA0 + evt._wDaysLeft); } return hIcon; } @@ -176,31 +170,27 @@ static HICON GetAnnivIcon(const CEvent &evt) static void NotifyWithExtraIcon(MCONTACT hContact, const CEvent &evt) { if (gRemindOpts.bCListExtraIcon) { - char szIcon[MAXSETTING], *icoName; - + int iIcon; + switch (evt._eType) { case CEvent::BIRTHDAY: if (evt._wDaysLeft > 9) - icoName = ICO_RMD_DTAX; - else { - mir_snprintf(szIcon, MODULENAME"_rmd_dtb%u", evt._wDaysLeft); - icoName = szIcon; - } + iIcon = IDI_RMD_DTBX; + else + iIcon = IDI_RMD_DTB0 + evt._wDaysLeft; break; case CEvent::ANNIVERSARY: if (evt._wDaysLeft > 9) - icoName = ICO_RMD_DTAX; - else { - mir_snprintf(szIcon, MODULENAME"_rmd_dta%u", evt._wDaysLeft); - icoName = szIcon; - } + iIcon = IDI_RMD_DTAX; + else + iIcon = IDI_RMD_DTA0 + evt._wDaysLeft; break; default: return; } - ExtraIcon_SetIconByName(ExtraIcon, hContact, icoName); + ExtraIcon_SetIcon(ExtraIcon, hContact, g_plugin.getIconHandle(iIcon)); } } @@ -318,12 +308,12 @@ static void NotifyFlashCListIcon(MCONTACT hContact, const CEvent &evt) switch (evt._eType) { case CEvent::BIRTHDAY: mir_snwprintf(szMsg, TranslateT("%s has %s today."), Clist_GetContactDisplayName(hContact), TranslateT("Birthday")); - cle.hIcon = IcoLib_GetIcon(ICO_COMMON_BIRTHDAY); + cle.hIcon = g_plugin.getIcon(IDI_BIRTHDAY); break; case CEvent::ANNIVERSARY: mir_snwprintf(szMsg, TranslateT("%s has %s today."), Clist_GetContactDisplayName(hContact), TranslateT("an anniversary")); - cle.hIcon = IcoLib_GetIcon(ICO_COMMON_ANNIVERSARY); + cle.hIcon = g_plugin.getIcon(IDI_ANNIVERSARY); break; default: @@ -714,7 +704,7 @@ static INT_PTR BackupBirthdayService(WPARAM hContact, LPARAM lParam) MSGBOX mBox; mBox.cbSize = sizeof(MSGBOX); mBox.hParent = nullptr; - mBox.hiLogo = IcoLib_GetIcon(ICO_COMMON_BIRTHDAY); + mBox.hiLogo = g_plugin.getIcon(IDI_BIRTHDAY); mBox.uType = MB_ICON_INFO; mBox.ptszTitle = TranslateT("Update custom birthday"); mBox.ptszMsg = TranslateT("Backing up and syncing all birthdays complete!"); @@ -884,7 +874,7 @@ void SvcReminderLoadModule(void) g_plugin.addHotkey(&hk); if (g_plugin.getByte(SET_REMIND_ENABLED, DEFVAL_REMIND_ENABLED) != REMIND_OFF && ExtraIcon == INVALID_HANDLE_VALUE) - ExtraIcon = ExtraIcon_RegisterIcolib("Reminder", LPGEN("Reminder (UInfoEx)"), ICO_COMMON_ANNIVERSARY); + ExtraIcon = ExtraIcon_RegisterIcolib("Reminder", LPGEN("Reminder (UInfoEx)"), g_plugin.getIconHandle(IDI_ANNIVERSARY)); } /** -- cgit v1.2.3