summaryrefslogtreecommitdiff
path: root/plugins/UserInfoEx
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-12-01 13:25:11 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-12-01 13:25:11 +0000
commit854959cbc0a1bad2c086214be4d1a829b17a61f3 (patch)
treeee3de50f4b4e57f54ae20d139f97fa469ff90d34 /plugins/UserInfoEx
parent73ddc73d92675399e4619758d4b0881418de0a6d (diff)
icolib: icon creation quirks
git-svn-id: http://svn.miranda-ng.org/main/trunk@2588 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/UserInfoEx')
-rw-r--r--plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp22
-rw-r--r--plugins/UserInfoEx/src/classPsTreeItem.cpp11
-rw-r--r--plugins/UserInfoEx/src/mir_icolib.cpp9
-rw-r--r--plugins/UserInfoEx/src/mir_icolib.h2
4 files changed, 18 insertions, 26 deletions
diff --git a/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp b/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp
index fe4ce708bb..f1b8232871 100644
--- a/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp
+++ b/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp
@@ -415,25 +415,25 @@ VOID InitIcons()
phIconHandles = (HANDLE*)mir_alloc(nCountriesCount*sizeof(HANDLE));
if (phIconHandles != NULL) {
char szId[20];
- SKINICONDESC skid = { sizeof(skid) };
- skid.ptszSection = LPGENT("Country Flags");
- skid.pszName = szId; // name to refer to icon when playing and in db
- skid.cx = GetSystemMetrics(SM_CXSMICON);
- skid.cy = GetSystemMetrics(SM_CYSMICON);
- skid.flags = SIDF_SORTED | SIDF_TCHAR;
+ SKINICONDESC sid = { sizeof(sid) };
+ sid.ptszSection = LPGENT("Country Flags");
+ sid.pszName = szId; // name to refer to icon when playing and in db
+ sid.cx = GetSystemMetrics(SM_CXSMICON);
+ sid.cy = GetSystemMetrics(SM_CYSMICON);
+ sid.flags = SIDF_SORTED | SIDF_TCHAR;
for (int i=0; i < nCountriesCount; i++) {
- skid.ptszDescription = mir_a2t(LPGEN(countries[i].szName));
+ sid.ptszDescription = mir_a2t(LPGEN(countries[i].szName));
/* create identifier */
wsprintfA(szId,(countries[i].id==0xFFFF)?"%s0x%X":"%s%i","flags_",countries[i].id); /* buffer safe */
int index = CountryNumberToBitmapIndex(countries[i].id);
/* create icon */
- skid.hDefaultIcon=ImageList_ExtractIcon(NULL, himl, index);
+ sid.hDefaultIcon = ImageList_ExtractIcon(NULL, himl, index);
index = CountryNumberToIndex(countries[i].id);
- phIconHandles[index] = Skin_AddIcon(&skid);
- if(skid.hDefaultIcon!=NULL) DestroyIcon(skid.hDefaultIcon);
- mir_free(skid.ptszDescription); skid.ptszDescription = NULL;
+ phIconHandles[index] = Skin_AddIcon(&sid);
+ if(sid.hDefaultIcon!=NULL) DestroyIcon(sid.hDefaultIcon);
+ mir_free(sid.ptszDescription); sid.ptszDescription = NULL;
}
}
ImageList_Destroy(himl);
diff --git a/plugins/UserInfoEx/src/classPsTreeItem.cpp b/plugins/UserInfoEx/src/classPsTreeItem.cpp
index c9da4f453d..47d161e573 100644
--- a/plugins/UserInfoEx/src/classPsTreeItem.cpp
+++ b/plugins/UserInfoEx/src/classPsTreeItem.cpp
@@ -361,12 +361,8 @@ INT CPsTreeItem::Icon(HIMAGELIST hIml, OPTIONSDIALOGPAGE *odp, BOOLEAN bInitIcon
LPCSTR pszIconName = IconKey();
// use icolib to handle icons
- if (!(hIcon = IcoLib_GetIcon(pszIconName)))
- {
- SKINICONDESC sid;
-
- ZeroMemory(&sid, sizeof(sid));
- sid.cbSize = sizeof(sid);
+ if (!(hIcon = IcoLib_GetIcon(pszIconName))) {
+ SKINICONDESC sid = { sizeof(sid) };
sid.flags = SIDF_ALL_TCHAR;
sid.cx = GetSystemMetrics(SM_CXSMICON);
sid.cy = GetSystemMetrics(SM_CYSMICON);
@@ -402,7 +398,8 @@ INT CPsTreeItem::Icon(HIMAGELIST hIml, OPTIONSDIALOGPAGE *odp, BOOLEAN bInitIcon
else {
sid.iDefaultIndex = -1;
sid.hDefaultIcon = ProtoIcon();
- if (!sid.hDefaultIcon) sid.hDefaultIcon = ImageList_GetIcon(hIml, 0, ILD_NORMAL);
+ if (!sid.hDefaultIcon)
+ sid.hDefaultIcon = ImageList_GetIcon(hIml, 0, ILD_NORMAL);
}
// add file to icolib
Skin_AddIcon(&sid);
diff --git a/plugins/UserInfoEx/src/mir_icolib.cpp b/plugins/UserInfoEx/src/mir_icolib.cpp
index ef5d22e487..adfa3e5149 100644
--- a/plugins/UserInfoEx/src/mir_icolib.cpp
+++ b/plugins/UserInfoEx/src/mir_icolib.cpp
@@ -380,19 +380,14 @@ HICON IcoLib_RegisterIcon(LPSTR szIconID, LPSTR szDescription, LPSTR szSection,
**/
VOID IcoLib_LoadModule()
{
- LPTSTR szDefaultFile;
- INT_PTR i;
-
- // search for default icon file
- szDefaultFile = IcoLib_GetDefaultIconFileName();
-
+ LPTSTR szDefaultFile = IcoLib_GetDefaultIconFileName();
IcoLib_CheckIconPackVersion(szDefaultFile);
// load default icon if required
ghDefIcon = (HICON)LoadImage(ghInst, MAKEINTRESOURCE(IDI_DEFAULT), IMAGE_ICON,
GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0);
- for (i = 0; i < SIZEOF(icoDesc); i++) {
+ for (int i = 0; i < SIZEOF(icoDesc); i++) {
IcoLib_RegisterIconHandleEx(
icoDesc[i].pszName, icoDesc[i].pszDesc, icoDesc[i].pszSection,
szDefaultFile, icoDesc[i].idResource, icoDesc[i].size, ghDefIcon);
diff --git a/plugins/UserInfoEx/src/mir_icolib.h b/plugins/UserInfoEx/src/mir_icolib.h
index d5ac62e9fa..e1743b18b1 100644
--- a/plugins/UserInfoEx/src/mir_icolib.h
+++ b/plugins/UserInfoEx/src/mir_icolib.h
@@ -138,7 +138,7 @@ typedef struct TIconCtrl
LPTSTR IcoLib_GetDefaultIconFileName();
VOID IcoLib_SetCtrlIcons(HWND hDlg, const ICONCTRL* pCtrl, BYTE numCtrls);
-HANDLE IcoLib_RegisterIconHandle(LPSTR szName, LPSTR szDescription, LPSTR szSection, INT idIcon, INT Size);
+HANDLE IcoLib_RegisterIconHandle(LPSTR szName, LPSTR szDescription, LPSTR szSection, INT idIcon, INT Size);
HICON IcoLib_RegisterIcon(LPSTR szName, LPSTR szDescription, LPSTR szSection, INT idIcon, INT Size);
HICON IcoLib_GetIcon(LPCSTR pszIcon);
HICON IcoLib_GetIconByHandle(HANDLE hIconItem);