From 1860018b201d995ed051c0affb72d5a1d09fa02e Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 1 Dec 2012 20:32:13 +0000 Subject: SKINICONDESC initialization - end of story git-svn-id: http://svn.miranda-ng.org/main/trunk@2598 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/AddContactPlus/src/main.cpp | 4 +- plugins/BASS_interface/src/Main.cpp | 3 +- plugins/BossKeyPlus/src/BossKey.cpp | 3 +- plugins/Clist_nicer/src/clui.cpp | 3 +- plugins/CrashDumper/src/crshdmp_icons.cpp | 13 ++-- plugins/Db_autobackups/src/main.cpp | 3 +- plugins/HistorySweeperLight/src/options.cpp | 3 +- plugins/MenuItemEx/src/main.cpp | 3 +- plugins/MirOTR/MirOTR/src/icons.cpp | 3 +- plugins/NewsAggregator/Src/Icons.cpp | 26 +++---- plugins/NotesAndReminders/src/main.cpp | 50 +++++++------- plugins/Ping/src/utils.cpp | 81 +++++++++++----------- plugins/Quotes/src/IconLib.cpp | 35 +++++----- plugins/Scriver/src/globals.cpp | 3 +- plugins/SimpleStatusMsg/src/utils.cpp | 35 +++++----- plugins/SmileyAdd/src/main.cpp | 86 ++++++++---------------- plugins/StatusPlugins/StartupStatus/toolbars.cpp | 3 +- plugins/TabSRMM/src/chat/options.cpp | 3 +- plugins/TabSRMM/src/msgs.cpp | 3 +- plugins/Variables/src/variables.cpp | 3 +- plugins/YAMN/src/main.cpp | 22 +++--- 21 files changed, 164 insertions(+), 224 deletions(-) (limited to 'plugins') diff --git a/plugins/AddContactPlus/src/main.cpp b/plugins/AddContactPlus/src/main.cpp index 6f4c69cab3..61f3c1ed38 100644 --- a/plugins/AddContactPlus/src/main.cpp +++ b/plugins/AddContactPlus/src/main.cpp @@ -136,10 +136,10 @@ static int CreateButton(WPARAM, LPARAM) static int OnModulesLoaded(WPARAM, LPARAM) { - SKINICONDESC sid = {0}; TCHAR szFile[MAX_PATH]; GetModuleFileName(hInst, szFile, MAX_PATH); - sid.cbSize = sizeof(SKINICONDESC); + + SKINICONDESC sid = { sizeof(sid) }; sid.flags = SIDF_ALL_TCHAR; sid.ptszDefaultFile = szFile; sid.ptszSection = LPGENT("AddContact+"); diff --git a/plugins/BASS_interface/src/Main.cpp b/plugins/BASS_interface/src/Main.cpp index e34d9da35f..d981658be9 100644 --- a/plugins/BASS_interface/src/Main.cpp +++ b/plugins/BASS_interface/src/Main.cpp @@ -315,8 +315,7 @@ void InitIcons(void) TCHAR szFile[MAX_PATH]; GetModuleFileName(hInst, szFile, SIZEOF(szFile)); - SKINICONDESC sid = {0}; - sid.cbSize = sizeof(SKINICONDESC); + SKINICONDESC sid = { sizeof(sid) }; sid.ptszDefaultFile = szFile; sid.cx = sid.cy = 16; sid.pszSection = ModuleName; diff --git a/plugins/BossKeyPlus/src/BossKey.cpp b/plugins/BossKeyPlus/src/BossKey.cpp index fc198b6820..23f2ed6ac9 100644 --- a/plugins/BossKeyPlus/src/BossKey.cpp +++ b/plugins/BossKeyPlus/src/BossKey.cpp @@ -601,8 +601,7 @@ static int IcoLibInit (void) // Icolib support TCHAR tszFile[MAX_PATH]; GetModuleFileName(g_hInstance, tszFile, MAX_PATH); - SKINICONDESC sid = {0}; - sid.cbSize = sizeof(SKINICONDESC); + SKINICONDESC sid = { sizeof(sid) }; sid.flags = SIDF_ALL_TCHAR; sid.ptszDefaultFile = tszFile; sid.cx = sid.cy = 16; diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp index 5f2059e0ea..2d9c063b41 100644 --- a/plugins/Clist_nicer/src/clui.cpp +++ b/plugins/Clist_nicer/src/clui.cpp @@ -300,8 +300,7 @@ static void InitIcoLib() int i, version = 0; char szBuffer[128]; - SKINICONDESC sid = {0}; - sid.cbSize = sizeof(SKINICONDESC); + SKINICONDESC sid = { sizeof(sid) }; sid.flags = SIDF_PATH_TCHAR; sid.pszSection = LPGEN("CList - Nicer/Default"); sid.ptszDefaultFile = szFilename; diff --git a/plugins/CrashDumper/src/crshdmp_icons.cpp b/plugins/CrashDumper/src/crshdmp_icons.cpp index 766be7d8cc..670adae90c 100644 --- a/plugins/CrashDumper/src/crshdmp_icons.cpp +++ b/plugins/CrashDumper/src/crshdmp_icons.cpp @@ -38,19 +38,16 @@ static HANDLE hIconLibItem[SIZEOF(iconList)]; void InitIcons(void) { - char szFile[MAX_PATH]; char szSettingName[100]; - SKINICONDESC sid = {0}; + TCHAR szFile[MAX_PATH]; + GetModuleFileName(hInst, szFile, SIZEOF(szFile)); - sid.cbSize = sizeof(SKINICONDESC); - sid.pszDefaultFile = szFile; + SKINICONDESC sid = { sizeof(sid) }; + sid.ptszDefaultFile = szFile; sid.pszName = szSettingName; sid.pszSection = (char*)PluginName; - GetModuleFileNameA(hInst, szFile, MAX_PATH); - - for (unsigned i = 0; i < SIZEOF(iconList); i++) - { + for (unsigned i = 0; i < SIZEOF(iconList); i++) { mir_snprintf(szSettingName, sizeof(szSettingName), "%s_%s", PluginName, iconList[i].szName); sid.pszDescription = (char*)iconList[i].szDescr; diff --git a/plugins/Db_autobackups/src/main.cpp b/plugins/Db_autobackups/src/main.cpp index 6e3cbd5239..d971559218 100644 --- a/plugins/Db_autobackups/src/main.cpp +++ b/plugins/Db_autobackups/src/main.cpp @@ -66,8 +66,7 @@ static void IcoLibInit(void) TCHAR tszFile[MAX_PATH]; GetModuleFileName(hInst, tszFile, MAX_PATH); - SKINICONDESC sid = {0}; - sid.cbSize = sizeof(SKINICONDESC); + SKINICONDESC sid = { sizeof(sid) }; sid.ptszDefaultFile = tszFile; sid.ptszSection = _T("Database/Database Backups"); sid.flags = SIDF_ALL_TCHAR; diff --git a/plugins/HistorySweeperLight/src/options.cpp b/plugins/HistorySweeperLight/src/options.cpp index 68731558f0..f086285349 100644 --- a/plugins/HistorySweeperLight/src/options.cpp +++ b/plugins/HistorySweeperLight/src/options.cpp @@ -65,8 +65,7 @@ void InitIcons(void) TCHAR szFile[MAX_PATH]; GetModuleFileName(hInst, szFile, SIZEOF(szFile)); - SKINICONDESC sid = { 0 }; - sid.cbSize = sizeof(SKINICONDESC); + SKINICONDESC sid = { sizeof(sid) }; sid.ptszDefaultFile = szFile; sid.cx = sid.cy = 16; sid.pszSection = ModuleName; diff --git a/plugins/MenuItemEx/src/main.cpp b/plugins/MenuItemEx/src/main.cpp index c01630d821..b64897b109 100644 --- a/plugins/MenuItemEx/src/main.cpp +++ b/plugins/MenuItemEx/src/main.cpp @@ -236,8 +236,7 @@ static void IconsInit() TCHAR tszFile[MAX_PATH]; GetModuleFileName(hinstance, tszFile, MAX_PATH); - SKINICONDESC sid = {0}; - sid.cbSize = sizeof(SKINICONDESC); + SKINICONDESC sid = { sizeof(sid) }; sid.flags = SIDF_ALL_TCHAR; sid.ptszDefaultFile = tszFile; sid.cx = sid.cy = 16; diff --git a/plugins/MirOTR/MirOTR/src/icons.cpp b/plugins/MirOTR/MirOTR/src/icons.cpp index 181c57e492..10f140ff22 100644 --- a/plugins/MirOTR/MirOTR/src/icons.cpp +++ b/plugins/MirOTR/MirOTR/src/icons.cpp @@ -24,8 +24,7 @@ void InitIcons() { GetModuleFileName(hInst, szFile, SIZEOF(szFile)); - SKINICONDESC sid = {0}; - sid.cbSize = sizeof(SKINICONDESC); + SKINICONDESC sid = { sizeof(sid) }; sid.ptszDefaultFile = szFile; sid.ptszSection = _T(MODULENAME); sid.flags = SIDF_ALL_TCHAR; diff --git a/plugins/NewsAggregator/Src/Icons.cpp b/plugins/NewsAggregator/Src/Icons.cpp index 5cd94ff76d..9ba2b0c79b 100644 --- a/plugins/NewsAggregator/Src/Icons.cpp +++ b/plugins/NewsAggregator/Src/Icons.cpp @@ -21,7 +21,7 @@ Boston, MA 02111-1307, USA. struct _tag_iconList { - TCHAR* szDescr; + char* szDescr; char* szName; int defIconID; HANDLE hIconLibItem; @@ -29,34 +29,30 @@ struct _tag_iconList static iconList[] = { - { LPGENT("Protocol icon"), "main", IDI_ICON }, - { LPGENT("Check All Feeds"), "checkall", IDI_CHECKALL }, - { LPGENT("Add Feed"), "addfeed", IDI_ADDFEED }, - { LPGENT("Import Feeds"), "importfeeds", IDI_IMPORTFEEDS }, - { LPGENT("Export Feeds"), "exportfeeds", IDI_EXPORTFEEDS }, - { LPGENT("Check Feed"), "checkfeed", IDI_CHECKALL }, + { LPGEN("Protocol icon"), "main", IDI_ICON }, + { LPGEN("Check All Feeds"), "checkall", IDI_CHECKALL }, + { LPGEN("Add Feed"), "addfeed", IDI_ADDFEED }, + { LPGEN("Import Feeds"), "importfeeds", IDI_IMPORTFEEDS }, + { LPGEN("Export Feeds"), "exportfeeds", IDI_EXPORTFEEDS }, + { LPGEN("Check Feed"), "checkfeed", IDI_CHECKALL } }; VOID InitIcons() { - TCHAR szFile[MAX_PATH]; char szSettingName[100]; - SKINICONDESC sid = {0}; - unsigned i; - + TCHAR szFile[MAX_PATH]; GetModuleFileName(hInst, szFile, MAX_PATH); - sid.cbSize = sizeof(SKINICONDESC); + SKINICONDESC sid = { sizeof(sid) }; sid.flags = SIDF_ALL_TCHAR; sid.ptszDefaultFile = szFile; sid.pszName = szSettingName; sid.ptszSection = _T("News Aggregator"); - for (i = 0; i < SIZEOF(iconList); i++) - { + for (int i = 0; i < SIZEOF(iconList); i++) { mir_snprintf(szSettingName, SIZEOF(szSettingName), "%s_%s", MODULE, iconList[i].szName); - sid.ptszDescription = iconList[i].szDescr; + sid.pszDescription = iconList[i].szDescr; sid.iDefaultIndex = -iconList[i].defIconID; iconList[i].hIconLibItem = Skin_AddIcon(&sid); } diff --git a/plugins/NotesAndReminders/src/main.cpp b/plugins/NotesAndReminders/src/main.cpp index 6150abb40d..a94eee9a94 100644 --- a/plugins/NotesAndReminders/src/main.cpp +++ b/plugins/NotesAndReminders/src/main.cpp @@ -92,52 +92,48 @@ INT_PTR PluginMenuCommandDeleteReminders(WPARAM w,LPARAM l) struct { - TCHAR* szDescr; + char* szDescr; char* szName; int defIconID; } static const iconList[] = { - {LPGENT("New Reminder"), "AddReminder", IDI_ADDREMINDER}, - {LPGENT("Delete All Notes"), "DeleteIcon", IDI_DELETEICON}, - {LPGENT("New Note"), "NoteIcon", IDI_NOTEICON}, - {LPGENT("Show/Hide Notes"), "ShowHide", IDI_SHOWHIDE}, - {LPGENT("On Top Caption Icon"), "CaptionIcon", IDI_CAPTIONICON}, - {LPGENT("Delete All Reminders"), "DeleteReminder", IDI_DELETEREMINDER}, - {LPGENT("View Reminders"), "ViewReminders", IDI_VIEWREMINDERS}, - {LPGENT("Not on Top Caption Icon"), "CaptionIconNotTop", IDI_CAPTIONICONNOTTOP}, - {LPGENT("Hide Note Icon"), "HideNote", IDI_HIDENOTE}, - {LPGENT("Remove Note Icon"), "RemoveNote", IDI_REMOVENOTE}, - {LPGENT("Reminder Icon"), "Reminder", IDI_REMINDER}, - {LPGENT("Bring All to Front"), "BringFront", IDI_BRINGFRONT}, - {LPGENT("Play Sound Icon"), "PlaySound", IDI_PLAYSOUND}, - {LPGENT("View Notes"), "ViewNotes", IDI_VIEWNOTES}, - {LPGENT("New Note"), "NewNote", IDI_NOTEICON}, - {LPGENT("New Reminder"), "NewReminder", IDI_ADDREMINDER} + { LPGEN("New Reminder"), "AddReminder", IDI_ADDREMINDER}, + { LPGEN("Delete All Notes"), "DeleteIcon", IDI_DELETEICON}, + { LPGEN("New Note"), "NoteIcon", IDI_NOTEICON}, + { LPGEN("Show/Hide Notes"), "ShowHide", IDI_SHOWHIDE}, + { LPGEN("On Top Caption Icon"), "CaptionIcon", IDI_CAPTIONICON}, + { LPGEN("Delete All Reminders"), "DeleteReminder", IDI_DELETEREMINDER}, + { LPGEN("View Reminders"), "ViewReminders", IDI_VIEWREMINDERS}, + { LPGEN("Not on Top Caption Icon"), "CaptionIconNotTop", IDI_CAPTIONICONNOTTOP}, + { LPGEN("Hide Note Icon"), "HideNote", IDI_HIDENOTE}, + { LPGEN("Remove Note Icon"), "RemoveNote", IDI_REMOVENOTE}, + { LPGEN("Reminder Icon"), "Reminder", IDI_REMINDER}, + { LPGEN("Bring All to Front"), "BringFront", IDI_BRINGFRONT}, + { LPGEN("Play Sound Icon"), "PlaySound", IDI_PLAYSOUND}, + { LPGEN("View Notes"), "ViewNotes", IDI_VIEWNOTES}, + { LPGEN("New Note"), "NewNote", IDI_NOTEICON}, + { LPGEN("New Reminder"), "NewReminder", IDI_ADDREMINDER} }; HANDLE hIconLibItem[SIZEOF(iconList)]; void InitIcons(void) { - int i; char szSettingName[100]; - SKINICONDESC sid = {0}; - TCHAR szFile[MAX_PATH]; + TCHAR szFile[MAX_PATH]; GetModuleFileName(hinstance, szFile, SIZEOF(szFile)); - sid.cbSize = sizeof(SKINICONDESC); + SKINICONDESC sid = { sizeof(sid) }; sid.ptszDefaultFile = szFile; sid.pszName = szSettingName; - sid.ptszSection = _T(MODULENAME); - sid.flags = SIDF_ALL_TCHAR; + sid.pszSection = MODULENAME; + sid.flags = SIDF_PATH_TCHAR; - for (i = 0; i < SIZEOF(iconList); i++) - { + for (int i = 0; i < SIZEOF(iconList); i++) { mir_snprintf(szSettingName, SIZEOF(szSettingName), "%s_%s", MODULENAME, iconList[i].szName); - - sid.ptszDescription = iconList[i].szDescr; + sid.pszDescription = iconList[i].szDescr; sid.iDefaultIndex = -iconList[i].defIconID; hIconLibItem[i] = Skin_AddIcon(&sid); } diff --git a/plugins/Ping/src/utils.cpp b/plugins/Ping/src/utils.cpp index 4350fe2e16..22b8b2e63d 100644 --- a/plugins/Ping/src/utils.cpp +++ b/plugins/Ping/src/utils.cpp @@ -304,7 +304,8 @@ HANDLE hIcoLibIconsChanged; HICON hIconResponding, hIconNotResponding, hIconTesting, hIconDisabled; -int ReloadIcons(WPARAM wParam, LPARAM lParam) { +int ReloadIcons(WPARAM wParam, LPARAM lParam) +{ hIconResponding = Skin_GetIcon("ping_responding"); hIconNotResponding = Skin_GetIcon("ping_not_responding"); hIconTesting = Skin_GetIcon("ping_testing"); @@ -318,48 +319,44 @@ void InitUtils() { TCHAR file[MAX_PATH]; GetModuleFileName(hInst,file,MAX_PATH); - { - SKINICONDESC sid = {0}; - - sid.cbSize = sizeof(SKINICONDESC); - sid.ptszSection = LPGENT("Ping"); - sid.flags = SIDF_PATH_TCHAR; - - sid.pszDescription = LPGEN("Responding"); - sid.pszName = "ping_responding"; - sid.ptszDefaultFile = file; - sid.iDefaultIndex = -IDI_ICON_RESPONDING; - Skin_AddIcon(&sid); - - sid.pszDescription = LPGEN("Not Responding"); - sid.pszName = "ping_not_responding"; - sid.ptszDefaultFile = file; - sid.iDefaultIndex = -IDI_ICON_NOTRESPONDING; - Skin_AddIcon(&sid); - - sid.pszDescription = LPGEN("Testing"); - sid.pszName = "ping_testing"; - sid.ptszDefaultFile = file; - sid.iDefaultIndex = -IDI_ICON_TESTING; - Skin_AddIcon(&sid); - - sid.pszDescription = LPGEN("Disabled"); - sid.pszName = "ping_disabled"; - sid.ptszDefaultFile = file; - sid.iDefaultIndex = -IDI_ICON_DISABLED; - Skin_AddIcon(&sid); - - hIconResponding = Skin_GetIcon("ping_responding"); - hIconNotResponding = Skin_GetIcon("ping_not_responding"); - hIconTesting = Skin_GetIcon("ping_testing"); - hIconDisabled = Skin_GetIcon("ping_disabled"); - - hIcoLibIconsChanged = HookEvent(ME_SKIN2_ICONSCHANGED, ReloadIcons); - } - if(ServiceExists(MS_POPUP_REGISTERCLASS)) { - POPUPCLASS test = {0}; - test.cbSize = sizeof(test); + SKINICONDESC sid = { sizeof(sid) }; + sid.ptszSection = LPGENT("Ping"); + sid.flags = SIDF_PATH_TCHAR; + + sid.pszDescription = LPGEN("Responding"); + sid.pszName = "ping_responding"; + sid.ptszDefaultFile = file; + sid.iDefaultIndex = -IDI_ICON_RESPONDING; + Skin_AddIcon(&sid); + + sid.pszDescription = LPGEN("Not Responding"); + sid.pszName = "ping_not_responding"; + sid.ptszDefaultFile = file; + sid.iDefaultIndex = -IDI_ICON_NOTRESPONDING; + Skin_AddIcon(&sid); + + sid.pszDescription = LPGEN("Testing"); + sid.pszName = "ping_testing"; + sid.ptszDefaultFile = file; + sid.iDefaultIndex = -IDI_ICON_TESTING; + Skin_AddIcon(&sid); + + sid.pszDescription = LPGEN("Disabled"); + sid.pszName = "ping_disabled"; + sid.ptszDefaultFile = file; + sid.iDefaultIndex = -IDI_ICON_DISABLED; + Skin_AddIcon(&sid); + + hIconResponding = Skin_GetIcon("ping_responding"); + hIconNotResponding = Skin_GetIcon("ping_not_responding"); + hIconTesting = Skin_GetIcon("ping_testing"); + hIconDisabled = Skin_GetIcon("ping_disabled"); + + hIcoLibIconsChanged = HookEvent(ME_SKIN2_ICONSCHANGED, ReloadIcons); + + if (ServiceExists(MS_POPUP_REGISTERCLASS)) { + POPUPCLASS test = { sizeof(test) }; test.flags = PCF_TCHAR; test.hIcon = hIconResponding; test.iSeconds = -1; diff --git a/plugins/Quotes/src/IconLib.cpp b/plugins/Quotes/src/IconLib.cpp index 9ac96599a5..e7caa1fd36 100644 --- a/plugins/Quotes/src/IconLib.cpp +++ b/plugins/Quotes/src/IconLib.cpp @@ -17,7 +17,7 @@ namespace { struct CIconList { - TCHAR* szDescr; + char* szDescr; char* szName; int defIconID; HANDLE hIconLibItem; @@ -25,38 +25,35 @@ namespace CIconList iconList[] = { - { _T("Protocol icon"), ICON_STR_MAIN, IDI_ICON_MAIN }, - { _T("Quote/Rate up"), ICON_STR_QUOTE_UP, IDI_ICON_UP }, - { _T("Quote/Rate down"), ICON_STR_QUOTE_DOWN, IDI_ICON_DOWN }, - { _T("Quote/Rate not changed"), ICON_STR_QUOTE_NOT_CHANGED, IDI_ICON_NOTCHANGED }, - { _T("Quote Section"), ICON_STR_SECTION, IDI_ICON_SECTION }, - { _T("Quote"), ICON_STR_QUOTE, IDI_ICON_QUOTE }, - { _T("Currency Converter"), ICON_STR_CURRENCY_CONVERTER, IDI_ICON_CURRENCY_CONVERTER }, - { _T("Refresh"), ICON_STR_REFRESH, IDI_ICON_REFRESH }, - { _T("Export"), ICON_STR_EXPORT, IDI_ICON_EXPORT }, - { _T("Swap button"), ICON_STR_SWAP, IDI_ICON_SWAP }, - { _T("Import"), ICON_STR_IMPORT, IDI_ICON_IMPORT } + { LPGEN("Protocol icon"), ICON_STR_MAIN, IDI_ICON_MAIN }, + { LPGEN("Quote/Rate up"), ICON_STR_QUOTE_UP, IDI_ICON_UP }, + { LPGEN("Quote/Rate down"), ICON_STR_QUOTE_DOWN, IDI_ICON_DOWN }, + { LPGEN("Quote/Rate not changed"), ICON_STR_QUOTE_NOT_CHANGED, IDI_ICON_NOTCHANGED }, + { LPGEN("Quote Section"), ICON_STR_SECTION, IDI_ICON_SECTION }, + { LPGEN("Quote"), ICON_STR_QUOTE, IDI_ICON_QUOTE }, + { LPGEN("Currency Converter"), ICON_STR_CURRENCY_CONVERTER, IDI_ICON_CURRENCY_CONVERTER }, + { LPGEN("Refresh"), ICON_STR_REFRESH, IDI_ICON_REFRESH }, + { LPGEN("Export"), ICON_STR_EXPORT, IDI_ICON_EXPORT }, + { LPGEN("Swap button"), ICON_STR_SWAP, IDI_ICON_SWAP }, + { LPGEN("Import"), ICON_STR_IMPORT, IDI_ICON_IMPORT } }; } void Quotes_IconsInit() { - USES_CONVERSION; - - SKINICONDESC sid = {0}; TCHAR szFile[MAX_PATH]; ::GetModuleFileName(g_hInstance, szFile, MAX_PATH); - sid.cbSize = sizeof(SKINICONDESC); + SKINICONDESC sid = { sizeof(sid) }; sid.ptszDefaultFile = szFile; sid.cx = sid.cy = 16; - sid.flags = SIDF_ALL_TCHAR; - sid.ptszSection = A2T(QUOTES_PROTOCOL_NAME); + sid.flags = SIDF_PATH_TCHAR; + sid.pszSection = QUOTES_PROTOCOL_NAME; for (int i = 0; i < SIZEOF(iconList); i++) { std::string sName = Quotes_MakeIconName( iconList[i].szName); sid.pszName = const_cast(sName.c_str()); - sid.ptszDescription = iconList[i].szDescr; + sid.pszDescription = iconList[i].szDescr; sid.iDefaultIndex = -iconList[i].defIconID; iconList[i].hIconLibItem = Skin_AddIcon(&sid); } diff --git a/plugins/Scriver/src/globals.cpp b/plugins/Scriver/src/globals.cpp index 1c71dbb959..8fe9d37619 100644 --- a/plugins/Scriver/src/globals.cpp +++ b/plugins/Scriver/src/globals.cpp @@ -157,8 +157,7 @@ void RegisterIcons(void) char szSection[200]; GetModuleFileName(g_hInst, path, MAX_PATH); - SKINICONDESC sid = { 0 }; - sid.cbSize = sizeof(SKINICONDESC); + SKINICONDESC sid = { sizeof(sid) }; sid.flags = SIDF_PATH_TCHAR; sid.ptszDefaultFile = path; sid.pszSection = szSection; diff --git a/plugins/SimpleStatusMsg/src/utils.cpp b/plugins/SimpleStatusMsg/src/utils.cpp index 013d8e5971..7c706e7818 100644 --- a/plugins/SimpleStatusMsg/src/utils.cpp +++ b/plugins/SimpleStatusMsg/src/utils.cpp @@ -27,13 +27,14 @@ static int HookCount = 0; static int ProtoHookCount = 0; static int ServiceCount = 0; -struct tagiconList +struct { - const TCHAR *szDescr; - const char *szName; - int defIconID; + TCHAR *szDescr; + char *szName; + int defIconID; + HANDLE hIcolib; } -static const iconList[] = +static iconList[] = { { LPGENT("Delete Selected"), "cross", IDI_CROSS }, { LPGENT("Recent Message"), "recent", IDI_HISTORY }, @@ -45,26 +46,22 @@ static const iconList[] = { LPGENT("Go to URL in Away Message"), "gotourl", IDI_GOTOURL } }; -HANDLE hIconLibItem[SIZEOF(iconList)]; - void IconsInit(void) { - SKINICONDESC sid = {0}; - char szFile[MAX_PATH]; - char szSettingName[100]; + TCHAR szFile[MAX_PATH]; + GetModuleFileName(g_hInst, szFile, SIZEOF(szFile)); - GetModuleFileNameA(g_hInst, szFile, MAX_PATH); - sid.cbSize = sizeof(SKINICONDESC); - sid.flags = SIDF_TCHAR; - sid.pszDefaultFile = szFile; + SKINICONDESC sid = { sizeof(sid) }; + sid.flags = SIDF_ALL_TCHAR; + sid.ptszDefaultFile = szFile; sid.ptszSection = _T("Simple Status Message"); - for (int i = 0; i < SIZEOF(iconList); i++) - { + for (int i = 0; i < SIZEOF(iconList); i++) { + char szSettingName[100]; mir_snprintf(szSettingName, SIZEOF(szSettingName), "SimpleStatusMsg_%s", iconList[i].szName); sid.pszName = szSettingName; sid.ptszDescription = (TCHAR*)iconList[i].szDescr; sid.iDefaultIndex = -iconList[i].defIconID; - hIconLibItem[i] = Skin_AddIcon(&sid); + iconList[i].hIcolib = Skin_AddIcon(&sid); } } @@ -78,7 +75,9 @@ HICON LoadIconEx(const char* name) HANDLE GetIconHandle(int iconId) { for(int i = 0; i < SIZEOF(iconList); i++) - if (iconList[i].defIconID == iconId) return hIconLibItem[i]; + if (iconList[i].defIconID == iconId) + return iconList[i].hIcolib; + return NULL; } diff --git a/plugins/SmileyAdd/src/main.cpp b/plugins/SmileyAdd/src/main.cpp index cbf4531f0c..61e4b2bbb8 100644 --- a/plugins/SmileyAdd/src/main.cpp +++ b/plugins/SmileyAdd/src/main.cpp @@ -33,14 +33,8 @@ extern LIST menuHandleArray; char* metaProtoName; - - -//static globals -static HANDLE hHooks[7]; -static HANDLE hService[13]; int hLangpack; - static const PLUGININFOEX pluginInfoEx = { sizeof(PLUGININFOEX), @@ -51,19 +45,11 @@ static const PLUGININFOEX pluginInfoEx = "borkra@miranda-im.org", "Copyright© 2004 - 2012 Boris Krasnovskiy, portions by Rein-Peter de Boer", "http://miranda-ng.org/", - // "http://miranda-ng.org/", UNICODE_AWARE, // {BD542BB4-5AE4-4d0e-A435-BA8DBE39607F} { 0xbd542bb4, 0x5ae4, 0x4d0e, { 0xa4, 0x35, 0xba, 0x8d, 0xbe, 0x39, 0x60, 0x7f } } }; -static SKINICONDESC skinDesc = -{ - sizeof(SKINICONDESC), "SmileyAdd", NULL, - "SmileyAdd_ButtonSmiley", NULL, -IDI_SMILINGICON -}; - - extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD /* mirandaVersion */) { return (PLUGININFOEX*)&pluginInfoEx; @@ -77,9 +63,13 @@ static int ModulesLoaded(WPARAM, LPARAM) char path[MAX_PATH]; GetModuleFileNameA(g_hInst, path, MAX_PATH); - skinDesc.pszDefaultFile = path; - skinDesc.pszDescription = LPGEN("Button Smiley"); - HANDLE hSkinIcon = Skin_AddIcon(&skinDesc); + SKINICONDESC sid = { sizeof(SKINICONDESC) }; + sid.pszName = "SmileyAdd_ButtonSmiley"; + sid.pszSection = "SmileyAdd"; + sid.pszDescription = LPGEN("Button Smiley"); + sid.pszDefaultFile = path; + sid.iDefaultIndex = -IDI_SMILINGICON; + HANDLE hSkinIcon = Skin_AddIcon(&sid); INT_PTR temp = CallService(MS_MC_GETPROTOCOLNAME, 0, 0); metaProtoName = mir_strdup(temp == CALLSERVICE_NOTFOUND ? NULL : (char*)temp); @@ -112,11 +102,9 @@ static int MirandaShutdown(WPARAM, LPARAM) extern "C" __declspec(dllexport) int Load(void) { - mir_getLP(&pluginInfoEx); - if (ServiceExists(MS_SMILEYADD_REPLACESMILEYS)) - { + if (ServiceExists(MS_SMILEYADD_REPLACESMILEYS)) { static const TCHAR errmsg[] = _T("Only one instance of SmileyAdd could be executed.\n") _T("Remove duplicate instances from 'Plugins' directory"); ReportError(TranslateTS(errmsg)); @@ -133,48 +121,35 @@ extern "C" __declspec(dllexport) int Load(void) // create smiley events hEvent1 = CreateHookableEvent(ME_SMILEYADD_OPTIONSCHANGED); - hHooks[0] = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); - hHooks[1] = HookEvent(ME_SYSTEM_PRESHUTDOWN, MirandaShutdown); - hHooks[2] = HookEvent(ME_OPT_INITIALISE, SmileysOptionsInitialize); - hHooks[3] = HookEvent(ME_CLIST_PREBUILDCONTACTMENU, RebuildContactMenu); - hHooks[4] = HookEvent(ME_SMILEYADD_OPTIONSCHANGED, UpdateSrmmDlg); - hHooks[5] = HookEvent(ME_PROTO_ACCLISTCHANGED, AccountListChanged); - hHooks[6] = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, DbSettingChanged); + HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); + HookEvent(ME_SYSTEM_PRESHUTDOWN, MirandaShutdown); + HookEvent(ME_OPT_INITIALISE, SmileysOptionsInitialize); + HookEvent(ME_CLIST_PREBUILDCONTACTMENU, RebuildContactMenu); + HookEvent(ME_SMILEYADD_OPTIONSCHANGED, UpdateSrmmDlg); + HookEvent(ME_PROTO_ACCLISTCHANGED, AccountListChanged); + HookEvent(ME_DB_CONTACT_SETTINGCHANGED, DbSettingChanged); //create the smiley services - hService[0] = CreateServiceFunction(MS_SMILEYADD_REPLACESMILEYS, ReplaceSmileysCommand); - hService[1] = CreateServiceFunction(MS_SMILEYADD_GETSMILEYICON, GetSmileyIconCommand); - hService[2] = CreateServiceFunction(MS_SMILEYADD_SHOWSELECTION, ShowSmileySelectionCommand); - hService[3] = CreateServiceFunction(MS_SMILEYADD_GETINFO, GetInfoCommand); - hService[4] = CreateServiceFunction(MS_SMILEYADD_GETINFO2, GetInfoCommand2); - hService[5] = CreateServiceFunction(MS_SMILEYADD_PARSE, ParseText); - hService[6] = CreateServiceFunction(MS_SMILEYADD_REGISTERCATEGORY, RegisterPack); - hService[7] = CreateServiceFunction(MS_SMILEYADD_BATCHPARSE, ParseTextBatch); - hService[8] = CreateServiceFunction(MS_SMILEYADD_BATCHFREE, FreeTextBatch); - hService[9] = CreateServiceFunction(MS_SMILEYADD_CUSTOMCATMENU, CustomCatMenu); - hService[10] = CreateServiceFunction(MS_SMILEYADD_RELOAD, ReloadPack); - hService[11] = CreateServiceFunction(MS_SMILEYADD_LOADCONTACTSMILEYS, LoadContactSmileys); - - - hService[12] = CreateServiceFunction(MS_SMILEYADD_PARSEW, ParseTextW); - - + CreateServiceFunction(MS_SMILEYADD_REPLACESMILEYS, ReplaceSmileysCommand); + CreateServiceFunction(MS_SMILEYADD_GETSMILEYICON, GetSmileyIconCommand); + CreateServiceFunction(MS_SMILEYADD_SHOWSELECTION, ShowSmileySelectionCommand); + CreateServiceFunction(MS_SMILEYADD_GETINFO, GetInfoCommand); + CreateServiceFunction(MS_SMILEYADD_GETINFO2, GetInfoCommand2); + CreateServiceFunction(MS_SMILEYADD_PARSE, ParseText); + CreateServiceFunction(MS_SMILEYADD_REGISTERCATEGORY, RegisterPack); + CreateServiceFunction(MS_SMILEYADD_BATCHPARSE, ParseTextBatch); + CreateServiceFunction(MS_SMILEYADD_BATCHFREE, FreeTextBatch); + CreateServiceFunction(MS_SMILEYADD_CUSTOMCATMENU, CustomCatMenu); + CreateServiceFunction(MS_SMILEYADD_RELOAD, ReloadPack); + CreateServiceFunction(MS_SMILEYADD_LOADCONTACTSMILEYS, LoadContactSmileys); + CreateServiceFunction(MS_SMILEYADD_PARSEW, ParseTextW); return 0; } - extern "C" __declspec(dllexport) int Unload(void) { - int i; - RemoveDialogBoxHook(); - for (i=0; i