diff options
author | George Hazan <george.hazan@gmail.com> | 2012-11-19 14:06:55 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-11-19 14:06:55 +0000 |
commit | 0a4edf42be37bf12786e668837488ce074f476f2 (patch) | |
tree | e2d4e17f25dc357e1d6bb0bdc15476f3ca148567 /protocols/AimOscar/src | |
parent | 32dedc767dec565c576b78b786e7a95d76ac806e (diff) |
more cleaning of icons' names
git-svn-id: http://svn.miranda-ng.org/main/trunk@2372 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/AimOscar/src')
-rw-r--r-- | protocols/AimOscar/src/theme.cpp | 60 |
1 files changed, 16 insertions, 44 deletions
diff --git a/protocols/AimOscar/src/theme.cpp b/protocols/AimOscar/src/theme.cpp index b0b3fd4ec5..e31cc5d664 100644 --- a/protocols/AimOscar/src/theme.cpp +++ b/protocols/AimOscar/src/theme.cpp @@ -32,8 +32,9 @@ struct _tag_iconList const char* szName;
int defIconID;
const char* szSection;
+ HANDLE hIcolib;
}
-static const iconList[] =
+static iconList[] =
{
{ LPGEN("ICQ"), "icq", IDI_ICQ },
{ LPGEN("Add"), "add", IDI_ADD },
@@ -66,8 +67,6 @@ static const iconList[] = { LPGEN("Not Normal Script"), "nnorm_scrpt", IDI_NNORMALSCRIPT, LPGEN("Profile Editor") },
};
-static HANDLE hIconLibItem[SIZEOF(iconList)];
-
void InitIcons(void)
{
TCHAR szFile[MAX_PATH];
@@ -93,7 +92,7 @@ void InitIcons(void) sid.pszDescription = (char*)iconList[i].szDescr;
sid.iDefaultIndex = -iconList[i].defIconID;
- hIconLibItem[i] = Skin_AddIcon(&sid);
+ iconList[i].hIcolib = Skin_AddIcon(&sid);
}
}
@@ -106,9 +105,10 @@ HICON LoadIconEx(const char* name, bool big) HANDLE GetIconHandle(const char* name)
{
- for (unsigned i=0; i < SIZEOF(iconList); i++)
- if (strcmp(iconList[i].szName, name) == 0)
- return hIconLibItem[i];
+ for (int i=0; i < SIZEOF(iconList); i++)
+ if ( !strcmp(iconList[i].szName, name))
+ return iconList[i].hIcolib;
+
return NULL;
}
@@ -156,31 +156,12 @@ static const char* extra_ES_icon_name[2] = "hiptop",
};
-static HANDLE extra_AT_icon_handle[5];
-static HANDLE extra_ES_icon_handle[2];
-
-static void clear_AT_icon(HANDLE hContact)
-{
- ExtraIcon_Clear(hExtraAT, hContact);
-}
-
-static void clear_ES_icon(HANDLE hContact)
-{
- ExtraIcon_Clear(hExtraES, hContact);
-}
-
static void set_AT_icon(CAimProto* ppro, HANDLE hContact)
{
if (ppro->getByte(hContact, "ChatRoom", 0)) return;
unsigned i = ppro->getByte(hContact, AIM_KEY_AC, 0) - 1;
-
- if (i < 5) {
- char name[64];
- mir_snprintf(name, sizeof(name), "AIM_%s", extra_AT_icon_name[i]);
- ExtraIcon_SetIcon(hExtraAT, hContact, name);
- }
- else ExtraIcon_Clear(hExtraAT, hContact);
+ ExtraIcon_SetIcon(hExtraAT, hContact, (i < 5) ? GetIconHandle(extra_AT_icon_name[i]) : NULL);
}
static void set_ES_icon(CAimProto* ppro, HANDLE hContact)
@@ -188,13 +169,7 @@ static void set_ES_icon(CAimProto* ppro, HANDLE hContact) if (ppro->getByte(hContact, "ChatRoom", 0)) return;
unsigned i = ppro->getByte(hContact, AIM_KEY_ET, 0) - 1;
-
- if (i < 2) {
- char name[64];
- mir_snprintf(name, sizeof(name), "AIM_%s", extra_ES_icon_name[i]);
- ExtraIcon_SetIcon(hExtraES, hContact, name);
- }
- else ExtraIcon_Clear(hExtraES, hContact);
+ ExtraIcon_SetIcon(hExtraAT, hContact, (i < 2) ? GetIconHandle(extra_ES_icon_name[i]) : NULL);
}
void set_contact_icon(CAimProto* ppro, HANDLE hContact)
@@ -206,10 +181,9 @@ void set_contact_icon(CAimProto* ppro, HANDLE hContact) void remove_AT_icons(CAimProto* ppro)
{
HANDLE hContact = db_find_first();
- while (hContact)
- {
+ while (hContact) {
if (ppro->is_my_contact(hContact) && !ppro->getByte(hContact, "ChatRoom", 0))
- clear_AT_icon(hContact);
+ ExtraIcon_Clear(hExtraAT, hContact);
hContact = db_find_next(hContact);
}
@@ -218,10 +192,10 @@ void remove_AT_icons(CAimProto* ppro) void remove_ES_icons(CAimProto* ppro)
{
HANDLE hContact = db_find_first();
- while (hContact)
- {
+ while (hContact) {
if (ppro->is_my_contact(hContact) && !ppro->getByte(hContact, "ChatRoom", 0))
- clear_ES_icon(hContact);
+ ExtraIcon_Clear(hExtraES, hContact);
+
hContact = db_find_next(hContact);
}
}
@@ -229,8 +203,7 @@ void remove_ES_icons(CAimProto* ppro) void add_AT_icons(CAimProto* ppro)
{
HANDLE hContact = db_find_first();
- while (hContact)
- {
+ while (hContact) {
if (ppro->is_my_contact(hContact))
set_AT_icon(ppro, hContact);
@@ -241,8 +214,7 @@ void add_AT_icons(CAimProto* ppro) void add_ES_icons(CAimProto* ppro)
{
HANDLE hContact = db_find_first();
- while (hContact)
- {
+ while (hContact) {
if (ppro->is_my_contact(hContact))
set_ES_icon(ppro, hContact);
|