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/SimpleStatusMsg/src/utils.cpp | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) (limited to 'plugins/SimpleStatusMsg/src') 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; } -- cgit v1.2.3