From 9f478bb53be99c6ad5cf69c1a61cc14900cf72b8 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Wed, 13 Aug 2014 18:05:18 +0000 Subject: icons registration moved to Load() git-svn-id: http://svn.miranda-ng.org/main/trunk@10180 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/New_GPG/src/init.cpp | 5 +++-- plugins/NewsAggregator/Src/NewsAggregator.cpp | 2 ++ plugins/NewsAggregator/Src/Services.cpp | 1 - plugins/OpenFolder/src/openFolder.cpp | 7 ++++--- plugins/Ping/src/common.h | 2 ++ plugins/Ping/src/ping.cpp | 12 ++++++++++++ plugins/Ping/src/utils.cpp | 14 +------------- plugins/Rate/src/main.cpp | 14 +++++++------- plugins/Sessions/Src/Main.cpp | 7 ++++--- plugins/SimpleStatusMsg/src/main.cpp | 3 ++- plugins/SmileyAdd/src/main.cpp | 4 ++-- plugins/Weather/src/weather.cpp | 3 ++- 12 files changed, 41 insertions(+), 33 deletions(-) diff --git a/plugins/New_GPG/src/init.cpp b/plugins/New_GPG/src/init.cpp index b84b2c5c15..4e8c83192c 100644 --- a/plugins/New_GPG/src/init.cpp +++ b/plugins/New_GPG/src/init.cpp @@ -67,6 +67,7 @@ INT_PTR ExportGpGKeys(WPARAM w, LPARAM l); INT_PTR ImportGpGKeys(WPARAM w, LPARAM l); int onExtraImageListRebuilding(WPARAM, LPARAM); int onExtraImageApplying(WPARAM wParam, LPARAM); +void InitIconLib(); void init_vars() { @@ -116,14 +117,12 @@ static int OnModulesLoaded(WPARAM wParam,LPARAM lParam) int onIconPressed(WPARAM wParam, LPARAM lParam); int onProtoAck(WPARAM, LPARAM); INT_PTR onSendFile(WPARAM, LPARAM); - void InitIconLib(); void InitCheck(); void FirstRun(); FirstRun(); if(!db_get_b(NULL, szGPGModuleName, "FirstRun", 1)) InitCheck(); - InitIconLib(); HICON IconLibGetIcon(const char* ident); @@ -224,6 +223,8 @@ extern "C" int __declspec(dllexport) Load() mi.pszService="/ImportGPGKeys"; hImportGpgKeys = Menu_AddMainMenuItem(&mi); + InitIconLib(); + g_hCLIcon = ExtraIcon_Register(szGPGModuleName, Translate("GPG encryption status"), "secured", onExtraImageListRebuilding, onExtraImageApplying); return 0; diff --git a/plugins/NewsAggregator/Src/NewsAggregator.cpp b/plugins/NewsAggregator/Src/NewsAggregator.cpp index 2d045613cd..81e853d9a8 100644 --- a/plugins/NewsAggregator/Src/NewsAggregator.cpp +++ b/plugins/NewsAggregator/Src/NewsAggregator.cpp @@ -99,6 +99,8 @@ extern "C" __declspec(dllexport) int Load(void) hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL+HKCOMB_A, 'O') | HKF_MIRANDA_LOCAL; Hotkey_Register(&hkd); + InitIcons(); + return 0; } diff --git a/plugins/NewsAggregator/Src/Services.cpp b/plugins/NewsAggregator/Src/Services.cpp index 54d7914ca9..0fe243e9f3 100644 --- a/plugins/NewsAggregator/Src/Services.cpp +++ b/plugins/NewsAggregator/Src/Services.cpp @@ -58,7 +58,6 @@ int NewsAggrInit(WPARAM wParam, LPARAM lParam) } NetlibInit(); - InitIcons(); InitMenu(); HookEvent(ME_TTB_MODULELOADED, OnToolbarLoaded); diff --git a/plugins/OpenFolder/src/openFolder.cpp b/plugins/OpenFolder/src/openFolder.cpp index 17e242acac..631102fd26 100644 --- a/plugins/OpenFolder/src/openFolder.cpp +++ b/plugins/OpenFolder/src/openFolder.cpp @@ -59,9 +59,6 @@ static int ModulesLoaded(WPARAM wParam, LPARAM lParam) { HookEvent(ME_TTB_MODULELOADED, ToptoolBarHook); - // icolib (0.7+) - Icon_Register(hInst, LPGEN("Open Folder"), &icon, 1, OPENFOLDER_MODULE_NAME); - // hotkeys service (0.8+) HOTKEYDESC hotkey = { 0 }; hotkey.cbSize = sizeof(hotkey); @@ -104,6 +101,10 @@ extern "C" int __declspec( dllexport ) Load() hServiceOpenFolder = CreateServiceFunction(MS_OPENFOLDER_OPEN, MenuCommand_OpenFolder); HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); + + // icolib (0.7+) + Icon_Register(hInst, LPGEN("Open Folder"), &icon, 1, OPENFOLDER_MODULE_NAME); + return 0; } diff --git a/plugins/Ping/src/common.h b/plugins/Ping/src/common.h index 35792e7ea7..8e4398b4b9 100644 --- a/plugins/Ping/src/common.h +++ b/plugins/Ping/src/common.h @@ -134,4 +134,6 @@ extern CRITICAL_SECTION thread_finished_cs, list_changed_cs, data_list_cs; extern PINGLIST data_list; +int ReloadIcons(WPARAM, LPARAM); + #endif diff --git a/plugins/Ping/src/ping.cpp b/plugins/Ping/src/ping.cpp index 64dd259a65..d63cbcbe9c 100644 --- a/plugins/Ping/src/ping.cpp +++ b/plugins/Ping/src/ping.cpp @@ -117,6 +117,14 @@ int OnModulesLoaded(WPARAM, LPARAM) { return 0; } +static IconItem iconList[] = +{ + { LPGEN("Responding"), "ping_responding", IDI_ICON_RESPONDING }, + { LPGEN("Not Responding"), "ping_not_responding", IDI_ICON_NOTRESPONDING }, + { LPGEN("Testing"), "ping_testing", IDI_ICON_TESTING }, + { LPGEN("Disabled"), "ping_disabled", IDI_ICON_DISABLED }, +}; + extern "C" __declspec(dllexport) int Load(void) { //if(init_raw_ping()) { @@ -148,6 +156,10 @@ extern "C" __declspec(dllexport) int Load(void) HookEvent(ME_SYSTEM_PRESHUTDOWN, OnShutdown); + Icon_Register(hInst, LPGEN("Ping"), iconList, SIZEOF(iconList)); + + HookEvent(ME_SKIN2_ICONSCHANGED, ReloadIcons); + return 0; } diff --git a/plugins/Ping/src/utils.cpp b/plugins/Ping/src/utils.cpp index 6d089eb633..814e4d6f81 100644 --- a/plugins/Ping/src/utils.cpp +++ b/plugins/Ping/src/utils.cpp @@ -307,7 +307,7 @@ static int OnShutdown(WPARAM, LPARAM) return 0; } -static int ReloadIcons(WPARAM, LPARAM) +int ReloadIcons(WPARAM, LPARAM) { hIconResponding = Skin_GetIcon("ping_responding"); hIconNotResponding = Skin_GetIcon("ping_not_responding"); @@ -318,25 +318,13 @@ static int ReloadIcons(WPARAM, LPARAM) return 0; } -static IconItem iconList[] = -{ - { LPGEN("Responding"), "ping_responding", IDI_ICON_RESPONDING }, - { LPGEN("Not Responding"), "ping_not_responding", IDI_ICON_NOTRESPONDING }, - { LPGEN("Testing"), "ping_testing", IDI_ICON_TESTING }, - { LPGEN("Disabled"), "ping_disabled", IDI_ICON_DISABLED }, -}; - void InitUtils() { - Icon_Register(hInst, LPGEN("Ping"), iconList, SIZEOF(iconList)); - hIconResponding = Skin_GetIcon("ping_responding"); hIconNotResponding = Skin_GetIcon("ping_not_responding"); hIconTesting = Skin_GetIcon("ping_testing"); hIconDisabled = Skin_GetIcon("ping_disabled"); - HookEvent(ME_SKIN2_ICONSCHANGED, ReloadIcons); - POPUPCLASS test = { sizeof(test) }; test.flags = PCF_TCHAR; test.hIcon = hIconResponding; diff --git a/plugins/Rate/src/main.cpp b/plugins/Rate/src/main.cpp index 4abd350ee4..806981626d 100644 --- a/plugins/Rate/src/main.cpp +++ b/plugins/Rate/src/main.cpp @@ -99,9 +99,6 @@ static IconItem iconList[] = int onModulesLoaded(WPARAM wParam,LPARAM lParam) { - // IcoLib support - Icon_Register(g_hInst, LPGEN("Contact rate"), iconList, SIZEOF(iconList)); - // Set initial value for all contacts for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) setExtraIcon(hContact, -1, FALSE); @@ -123,11 +120,14 @@ extern "C" int __declspec(dllexport) Load(void) { mir_getLP(&pluginInfo); - HookEvent(ME_SYSTEM_MODULESLOADED, onModulesLoaded); - HookEvent(ME_DB_CONTACT_SETTINGCHANGED, onContactSettingChanged); + HookEvent(ME_SYSTEM_MODULESLOADED, onModulesLoaded); + HookEvent(ME_DB_CONTACT_SETTINGCHANGED, onContactSettingChanged); + + // IcoLib support + Icon_Register(g_hInst, LPGEN("Contact rate"), iconList, SIZEOF(iconList)); - // Extra icon support - hExtraIcon = ExtraIcon_Register("contact_rate", LPGEN("Contact rate"), "rate_high"); + // Extra icon support + hExtraIcon = ExtraIcon_Register("contact_rate", LPGEN("Contact rate"), "rate_high"); return 0; } diff --git a/plugins/Sessions/Src/Main.cpp b/plugins/Sessions/Src/Main.cpp index 14fbd88a4a..85cf801d6a 100644 --- a/plugins/Sessions/Src/Main.cpp +++ b/plugins/Sessions/Src/Main.cpp @@ -883,9 +883,6 @@ static int PluginInit(WPARAM wparam,LPARAM lparam) hkd.pszService = MS_SESSIONS_CLOSESESSION; Hotkey_Register(&hkd); - // Icons - Icon_Register(hinstance, MODNAME, iconList, SIZEOF(iconList)); - // Main menu CLISTMENUITEM cl = { sizeof(cl) }; cl.position = 1000000000; @@ -977,5 +974,9 @@ extern "C" __declspec(dllexport) int Load(void) HookEvent(ME_SYSTEM_MODULESLOADED, PluginInit); HookEvent(ME_SYSTEM_OKTOEXIT, OkToExit); HookEvent(ME_SYSTEM_PRESHUTDOWN, SessionPreShutdown); + + // Icons + Icon_Register(hinstance, MODNAME, iconList, SIZEOF(iconList)); + return 0; } diff --git a/plugins/SimpleStatusMsg/src/main.cpp b/plugins/SimpleStatusMsg/src/main.cpp index aceecf50d1..e4f4006455 100644 --- a/plugins/SimpleStatusMsg/src/main.cpp +++ b/plugins/SimpleStatusMsg/src/main.cpp @@ -1774,7 +1774,6 @@ static int OnModulesLoaded(WPARAM wParam, LPARAM lParam) #ifdef _DEBUG log2file("### Session started ###"); #endif - IconsInit(); OnAccListChanged(0, 0); LoadAwayMsgModule(); @@ -1919,6 +1918,8 @@ extern "C" int __declspec(dllexport) Load(void) HookEvent(ME_SYSTEM_OKTOEXIT, OnOkToExit); HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreShutdown); + IconsInit(); + return 0; } diff --git a/plugins/SmileyAdd/src/main.cpp b/plugins/SmileyAdd/src/main.cpp index 30d45f33fc..3738dfb9f8 100644 --- a/plugins/SmileyAdd/src/main.cpp +++ b/plugins/SmileyAdd/src/main.cpp @@ -50,8 +50,6 @@ static IconItem icon = { LPGEN("Button smiley"), "SmileyAdd_ButtonSmiley", IDI_S static int ModulesLoaded(WPARAM, LPARAM) { - Icon_Register(g_hInst, "SmileyAdd", &icon, 1); - CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIF_ROOTPOPUP; mi.popupPosition = 2000070050; @@ -90,6 +88,8 @@ extern "C" __declspec(dllexport) int Load(void) InitImageCache(); + Icon_Register(g_hInst, "SmileyAdd", &icon, 1); + g_SmileyCategories.SetSmileyPackStore(&g_SmileyPacks); opt.Load(); diff --git a/plugins/Weather/src/weather.cpp b/plugins/Weather/src/weather.cpp index 58b6f60f74..2d20cdf3be 100644 --- a/plugins/Weather/src/weather.cpp +++ b/plugins/Weather/src/weather.cpp @@ -122,7 +122,6 @@ int WeatherInit(WPARAM wParam,LPARAM lParam) // initialize netlib NetlibInit(); - InitIcons(); InitMwin(); // load weather menu items @@ -185,6 +184,8 @@ extern "C" int __declspec(dllexport) Load(void) // load options and set defaults LoadOptions(); + InitIcons(); + // reset the weather data at startup for individual contacts EraseAllInfo(); -- cgit v1.2.3