From e5cb033463036b182fb6e5e3eed50a14987f5300 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 7 Jun 2015 18:19:34 +0000 Subject: SKINICONDESC -> MAllStrings git-svn-id: http://svn.miranda-ng.org/main/trunk@14054 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/clist/genmenu.cpp | 6 +++--- src/modules/icolib/skin2icons.cpp | 21 +++++++++------------ src/modules/skin/skinicons.cpp | 28 ++++++++++++++-------------- 3 files changed, 26 insertions(+), 29 deletions(-) (limited to 'src/modules') diff --git a/src/modules/clist/genmenu.cpp b/src/modules/clist/genmenu.cpp index c085c0d201..c8ea4e0c33 100644 --- a/src/modules/clist/genmenu.cpp +++ b/src/modules/clist/genmenu.cpp @@ -1079,11 +1079,11 @@ static int MO_RegisterIcon(PMO_IntMenuItem pmi, void*) } } - SKINICONDESC sid = { sizeof(sid) }; + SKINICONDESC sid = { 0 }; sid.flags = SIDF_TCHAR; - sid.ptszSection = sectionName; + sid.section.t = sectionName; sid.pszName = iconame; - sid.ptszDescription = descr; + sid.description.t = descr; sid.hDefaultIcon = hIcon; pmi->hIcolibItem = IcoLib_AddNewIcon(0, &sid); diff --git a/src/modules/icolib/skin2icons.cpp b/src/modules/icolib/skin2icons.cpp index 2f5bfed191..5b41b14e36 100644 --- a/src/modules/icolib/skin2icons.cpp +++ b/src/modules/icolib/skin2icons.cpp @@ -499,17 +499,14 @@ static void IcoLib_FreeIcon(IcolibItem* icon) ///////////////////////////////////////////////////////////////////////////////////////// // IcoLib_AddNewIcon -HANDLE IcoLib_AddNewIcon(int hLangpack, SKINICONDESC* sid) +HANDLE IcoLib_AddNewIcon(int hLangpack, SKINICONDESC *sid) { - if (sid->cbSize != sizeof(SKINICONDESC)) - return NULL; - bool utf = (sid->flags & SIDF_UNICODE) != 0; bool utf_path = (sid->flags & SIDF_PATH_UNICODE) != 0; mir_cslock lck(csIconList); - IcolibItem* item = IcoLib_FindIcon(sid->pszName); + IcolibItem *item = IcoLib_FindIcon(sid->pszName); if (!item) { item = (IcolibItem*)mir_calloc(sizeof(IcolibItem)); item->name = sid->pszName; @@ -519,12 +516,12 @@ HANDLE IcoLib_AddNewIcon(int hLangpack, SKINICONDESC* sid) item->name = mir_strdup(sid->pszName); if (utf) { - item->description = mir_u2t(sid->pwszDescription); - item->section = IcoLib_AddSection(sid->pwszSection, TRUE); + item->description = mir_u2t(sid->description.w); + item->section = IcoLib_AddSection(sid->section.w, TRUE); } else { - item->description = mir_a2t(sid->pszDescription); - WCHAR* pwszSection = sid->pszSection ? mir_a2u(sid->pszSection) : NULL; + item->description = mir_a2t(sid->description.a); + WCHAR *pwszSection = sid->section.a ? mir_a2u(sid->section.a) : NULL; item->section = IcoLib_AddSection(pwszSection, TRUE); SAFE_FREE((void**)&pwszSection); } @@ -535,12 +532,12 @@ HANDLE IcoLib_AddNewIcon(int hLangpack, SKINICONDESC* sid) } else item->orderID = 0; - if (sid->pszDefaultFile) { + if (sid->defaultFile.a) { WCHAR fileFull[ MAX_PATH ]; if (utf_path) - PathToAbsoluteT(sid->pwszDefaultFile, fileFull); + PathToAbsoluteT(sid->defaultFile.w, fileFull); else - PathToAbsoluteT(_A2T(sid->pszDefaultFile), fileFull); + PathToAbsoluteT(_A2T(sid->defaultFile.a), fileFull); item->default_file = mir_wstrdup(fileFull); } item->default_indx = sid->iDefaultIndex; diff --git a/src/modules/skin/skinicons.cpp b/src/modules/skin/skinicons.cpp index 2382da9976..1b8b9de3be 100644 --- a/src/modules/skin/skinicons.cpp +++ b/src/modules/skin/skinicons.cpp @@ -280,8 +280,8 @@ HICON LoadSkinProtoIcon(const char *szProto, int status, bool big) TCHAR tszSection[MAX_PATH]; mir_sntprintf(tszSection, SIZEOF(tszSection), _T(PROTOCOLS_PREFIX)_T("/%s"), pa->tszAccountName); - SKINICONDESC sid = { sizeof(sid) }; - sid.ptszSection = tszSection; + SKINICONDESC sid = { 0 }; + sid.section.t = tszSection; sid.flags = SIDF_ALL_TCHAR; str = _tcsrchr(szPath, '\\'); @@ -289,19 +289,19 @@ HICON LoadSkinProtoIcon(const char *szProto, int status, bool big) *str = 0; mir_sntprintf(szFullPath, SIZEOF(szFullPath), _T("%s\\Icons\\proto_%S.dll"), szPath, pa->szProtoName); if (GetFileAttributes(szFullPath) != INVALID_FILE_ATTRIBUTES) - sid.ptszDefaultFile = szFullPath; + sid.defaultFile.t = szFullPath; else { mir_sntprintf(szFullPath, SIZEOF(szFullPath), _T("%s\\Plugins\\%S.dll"), szPath, szProto); - if ((int)ExtractIconEx(szFullPath, statusIcons[statusIndx].resource_id, NULL, &hIcon, 1) > 0) { + if (int(ExtractIconEx(szFullPath, statusIcons[statusIndx].resource_id, NULL, &hIcon, 1)) > 0) { DestroyIcon(hIcon); - sid.ptszDefaultFile = szFullPath; + sid.defaultFile.t = szFullPath; hIcon = NULL; } - if (sid.pszDefaultFile == NULL) { + if (sid.defaultFile.a == NULL) { if (str != NULL) *str = '\\'; - sid.ptszDefaultFile = szPath; + sid.defaultFile.t = szPath; } } // @@ -319,7 +319,7 @@ HICON LoadSkinProtoIcon(const char *szProto, int status, bool big) // format: core_%s%d mir_snprintf(iconName, SIZEOF(iconName), "%s%s%d", statusIconsFmt, szProto, i); sid.pszName = iconName; - sid.ptszDescription = cli.pfnGetStatusModeDescription(statusIcons[i].id, 0); + sid.description.t = cli.pfnGetStatusModeDescription(statusIcons[i].id, 0); sid.iDefaultIndex = statusIcons[i].resource_id; IcoLib_AddNewIcon(0, &sid); } @@ -472,8 +472,8 @@ int LoadSkinIcons(void) TCHAR modulePath[MAX_PATH]; GetModuleFileName(NULL, modulePath, SIZEOF(modulePath)); - SKINICONDESC sid = { sizeof(sid) }; - sid.ptszDefaultFile = modulePath; + SKINICONDESC sid = { 0 }; + sid.defaultFile.t = modulePath; sid.flags = SIDF_PATH_TCHAR; sid.pszName = iconName; @@ -482,22 +482,22 @@ int LoadSkinIcons(void) // for (i=0; i < SIZEOF(mainIcons); i++) { mir_snprintf(iconName, SIZEOF(iconName), "%s%d", mainIconsFmt, i); - sid.pszSection = mainIcons[i].section == NULL ? LPGEN("Main icons") : (char*)mainIcons[i].section; - sid.pszDescription = (char*)mainIcons[i].description; + sid.section.a = mainIcons[i].section == NULL ? LPGEN("Main icons") : (char*)mainIcons[i].section; + sid.description.a = (char*)mainIcons[i].description; sid.iDefaultIndex = mainIcons[i].resource_id; mainIcons[i].hIcolib = IcoLib_AddNewIcon(0, &sid); } // // Add global icons to list // - sid.pszSection = PROTOCOLS_PREFIX "/" LPGEN("Global"); + sid.section.a = PROTOCOLS_PREFIX "/" LPGEN("Global"); // // Asterisk is used, to avoid conflict with proto-plugins // 'coz users can't rename it to name with '*' for (i=0; i < SIZEOF(statusIcons); i++) { mir_snprintf(iconName, SIZEOF(iconName), "%s%s%d", statusIconsFmt, GLOBAL_PROTO_NAME, i); sid.pszName = iconName; - sid.pszDescription = (char*)statusIcons[i].description; + sid.description.a = (char*)statusIcons[i].description; sid.iDefaultIndex = statusIcons[i].resource_id; statusIcons[i].hIcolib = IcoLib_AddNewIcon(0, &sid); } -- cgit v1.2.3