diff options
author | George Hazan <george.hazan@gmail.com> | 2012-11-19 12:51:53 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-11-19 12:51:53 +0000 |
commit | 32dedc767dec565c576b78b786e7a95d76ac806e (patch) | |
tree | 0f2eb209b3716569a8e3c3ef146a91f402ebbb4d /plugins | |
parent | adf7367cfdb57b32aadeb74af45dce9a6a3c02a5 (diff) |
- added another helper, ExtraIcon_Clear, to remove an icon from slot;
- added ability to pass IcoLib handles instead of icons' names
git-svn-id: http://svn.miranda-ng.org/main/trunk@2371 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/BuddyExpectator/src/BuddyExpectator.cpp | 6 | ||||
-rw-r--r-- | plugins/CountryFlags/src/extraimg.cpp | 2 | ||||
-rw-r--r-- | plugins/IgnoreState/src/main.cpp | 2 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/Flags/svc_flags.cpp | 22 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/svc_email.cpp | 7 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/svc_gender.cpp | 17 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/svc_homepage.cpp | 9 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/svc_phone.cpp | 17 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/svc_reminder.cpp | 20 | ||||
-rw-r--r-- | plugins/WhenWasIt/src/notifiers.cpp | 2 |
10 files changed, 35 insertions, 69 deletions
diff --git a/plugins/BuddyExpectator/src/BuddyExpectator.cpp b/plugins/BuddyExpectator/src/BuddyExpectator.cpp index 03b793ad09..b0798c59a4 100644 --- a/plugins/BuddyExpectator/src/BuddyExpectator.cpp +++ b/plugins/BuddyExpectator/src/BuddyExpectator.cpp @@ -153,7 +153,7 @@ LRESULT CALLBACK MissYouPopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPA if ( !db_get_b(PUGetContact(hWnd), MODULE_NAME, "MissYouNotifyAlways", 0)) {
db_set_b(PUGetContact(hWnd), MODULE_NAME, "MissYou", 0);
if (options.MissYouIcon)
- ExtraIcon_SetIcon(hExtraIcon, PUGetContact(hWnd), "");
+ ExtraIcon_Clear(hExtraIcon, PUGetContact(hWnd));
}
PUDeletePopUp(hWnd);
}
@@ -167,7 +167,7 @@ LRESULT CALLBACK MissYouPopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPA if (wParam == 1) {
db_set_b(PUGetContact(hWnd), MODULE_NAME, "MissYou", 0);
if (options.MissYouIcon)
- ExtraIcon_SetIcon(hExtraIcon, PUGetContact(hWnd), "");
+ ExtraIcon_Clear(hExtraIcon, PUGetContact(hWnd));
PUDeletePopUp(hWnd);
}
break;
@@ -449,7 +449,7 @@ INT_PTR MenuMissYouClick(WPARAM wParam, LPARAM lParam) if (db_get_b((HANDLE)wParam, MODULE_NAME, "MissYou", 0)) {
db_set_b((HANDLE)wParam, MODULE_NAME, "MissYou", 0);
if (options.MissYouIcon)
- ExtraIcon_SetIcon(hExtraIcon, (HANDLE)wParam, "");
+ ExtraIcon_Clear(hExtraIcon, (HANDLE)wParam);
}
else {
db_set_b((HANDLE)wParam, MODULE_NAME, "MissYou", 1);
diff --git a/plugins/CountryFlags/src/extraimg.cpp b/plugins/CountryFlags/src/extraimg.cpp index dcb8f33773..433cbfb664 100644 --- a/plugins/CountryFlags/src/extraimg.cpp +++ b/plugins/CountryFlags/src/extraimg.cpp @@ -66,7 +66,7 @@ static void RemoveExtraImages(void) {
HANDLE hContact = db_find_first();
while (hContact != NULL) {
- ExtraIcon_SetIcon(hExtraIcon, hContact, (HANDLE)0);
+ ExtraIcon_Clear(hExtraIcon, hContact);
hContact = db_find_next(hContact);
}
}
diff --git a/plugins/IgnoreState/src/main.cpp b/plugins/IgnoreState/src/main.cpp index 886219e20f..5826b55bcc 100644 --- a/plugins/IgnoreState/src/main.cpp +++ b/plugins/IgnoreState/src/main.cpp @@ -101,7 +101,7 @@ void applyExtraImage(HANDLE hContact) if (ignore == 1)
ExtraIcon_SetIcon(hExtraIcon, hContact, "ignore_full");
else if (ignore == 0)
- ExtraIcon_SetIcon(hExtraIcon, hContact, "");
+ ExtraIcon_Clear(hExtraIcon, hContact);
else if (isIgnored(hContact, IGNOREEVENT_MESSAGE))
ExtraIcon_SetIcon(hExtraIcon, hContact, "ignore_mess");
else
diff --git a/plugins/UserInfoEx/src/Flags/svc_flags.cpp b/plugins/UserInfoEx/src/Flags/svc_flags.cpp index c864e0bca8..e3b59f47f8 100644 --- a/plugins/UserInfoEx/src/Flags/svc_flags.cpp +++ b/plugins/UserInfoEx/src/Flags/svc_flags.cpp @@ -234,30 +234,20 @@ static INT_PTR ServiceDetectContactOriginCountry(WPARAM wParam,LPARAM lParam) static void CALLBACK SetExtraImage(LPARAM lParam)
{
/* get contact's country */
- int countryNumber = ServiceDetectContactOriginCountry((WPARAM)lParam,0);;
-
- EXTRAICON ico = { sizeof(ico) };
- ico.hContact = (HANDLE)lParam;
- ico.hExtraIcon = hExtraIconSvc;
- ico.icoName = (char*)0; //preset
+ int countryNumber = ServiceDetectContactOriginCountry((WPARAM)lParam,0);
if (countryNumber != 0xFFFF || gFlagsOpts.bUseUnknownFlag) {
char szId[20];
- mir_snprintf(szId, SIZEOF(szId), (countryNumber==0xFFFF)?"%s_0x%X":"%s_%i","flags",countryNumber); /* buffer safe */
- ico.icoName = szId;
+ mir_snprintf(szId, SIZEOF(szId), (countryNumber == 0xFFFF) ? "%s_0x%X" : "%s_%i","flags", countryNumber); /* buffer safe */
+ ExtraIcon_SetIcon(hExtraIconSvc, (HANDLE)lParam, szId);
}
- CallService(MS_EXTRAICON_SET_ICON, (WPARAM)&ico, 0);
+ else ExtraIcon_Clear(hExtraIconSvc, (HANDLE)lParam);
}
static void CALLBACK RemoveExtraImages(LPARAM lParam)
{
- EXTRAICON ico = { sizeof(ico) };
- ico.hExtraIcon = hExtraIconSvc;
- ico.icoName = 0; /* invalidate icon for contact*/
/* enum all contacts */
- for (HANDLE hContact = DB::Contact::FindFirst(); hContact != NULL; hContact = DB::Contact::FindNext(hContact)) {
- ico.hContact = hContact;
- CallService(MS_EXTRAICON_SET_ICON, (WPARAM)&ico, 0);
- }
+ for (HANDLE hContact = DB::Contact::FindFirst(); hContact != NULL; hContact = DB::Contact::FindNext(hContact))
+ ExtraIcon_Clear(hExtraIconSvc, hContact);
}
// always call in context of main thread
diff --git a/plugins/UserInfoEx/src/svc_email.cpp b/plugins/UserInfoEx/src/svc_email.cpp index 5b886b72a3..f0915e64fe 100644 --- a/plugins/UserInfoEx/src/svc_email.cpp +++ b/plugins/UserInfoEx/src/svc_email.cpp @@ -146,13 +146,8 @@ static INT_PTR MenuCommand(WPARAM wParam,LPARAM lParam) static INT OnCListApplyIcons(WPARAM wParam, LPARAM lParam)
{
LPSTR val = Get((HANDLE)wParam);
-
- EXTRAICON ico = { sizeof(ico) };
- ico.hContact=(HANDLE)wParam;
- ico.hExtraIcon=ghExtraIconSvc;
- ico.icoName=val?ICO_BTN_EMAIL:(char *)0;
+ ExtraIcon_SetIcon(ghExtraIconSvc, (HANDLE)wParam, (val) ? ICO_BTN_EMAIL: 0);
mir_free(val);
- CallService(MS_EXTRAICON_SET_ICON, (WPARAM)&ico, 0);
return 0;
}
diff --git a/plugins/UserInfoEx/src/svc_gender.cpp b/plugins/UserInfoEx/src/svc_gender.cpp index 68d6f5b8ec..f849569644 100644 --- a/plugins/UserInfoEx/src/svc_gender.cpp +++ b/plugins/UserInfoEx/src/svc_gender.cpp @@ -81,20 +81,13 @@ BYTE GenderOf(HANDLE hContact) static INT OnCListApplyIcons(HANDLE hContact, LPARAM)
{
if (ghExtraIconSvc != INVALID_HANDLE_VALUE) {
- EXTRAICON ico = { sizeof(ico) };
- ico.hContact = hContact;
- ico.hExtraIcon = ghExtraIconSvc;
+ char *icoName;
switch (GenderOf(hContact)) {
- case 'M':
- ico.icoName = ICO_COMMON_MALE;
- break;
- case 'F':
- ico.icoName = ICO_COMMON_FEMALE;
- break;
- default:
- ico.icoName = NULL;
+ case 'M': icoName = ICO_COMMON_MALE; break;
+ case 'F': icoName = ICO_COMMON_FEMALE; break;
+ default: icoName = NULL;
}
- CallService(MS_EXTRAICON_SET_ICON, (WPARAM)&ico, 0);
+ ExtraIcon_SetIcon(ghExtraIconSvc, hContact, icoName);
}
return 0;
}
diff --git a/plugins/UserInfoEx/src/svc_homepage.cpp b/plugins/UserInfoEx/src/svc_homepage.cpp index 8c3cf5ff3d..e5d31746f2 100644 --- a/plugins/UserInfoEx/src/svc_homepage.cpp +++ b/plugins/UserInfoEx/src/svc_homepage.cpp @@ -109,13 +109,8 @@ static INT_PTR MenuCommand(WPARAM wParam, LPARAM lParam) static INT OnCListApplyIcons(HANDLE hContact, LPARAM)
{
LPSTR val = Get(hContact);
- if (ghExtraIconSvc != INVALID_HANDLE_VALUE) {
- EXTRAICON ico = { sizeof(ico) };
- ico.hContact = hContact;
- ico.hExtraIcon = ghExtraIconSvc;
- ico.icoName = (val) ? ICO_BTN_GOTO : NULL;
- CallService(MS_EXTRAICON_SET_ICON, (WPARAM)&ico, 0);
- }
+ if (ghExtraIconSvc != INVALID_HANDLE_VALUE)
+ ExtraIcon_SetIcon(ghExtraIconSvc, hContact, (val) ? ICO_BTN_GOTO : NULL);
MIR_FREE(val);
return 0;
}
diff --git a/plugins/UserInfoEx/src/svc_phone.cpp b/plugins/UserInfoEx/src/svc_phone.cpp index 941003716b..9490a563e9 100644 --- a/plugins/UserInfoEx/src/svc_phone.cpp +++ b/plugins/UserInfoEx/src/svc_phone.cpp @@ -102,20 +102,13 @@ static INT_PTR Get(HANDLE hContact) static INT OnCListApplyIcons(HANDLE hContact, LPARAM)
{
- EXTRAICON ico = { sizeof(ico) };
- ico.hContact = hContact;
- ico.hExtraIcon = ghExtraIconSvc;
+ char *icoName;
switch (Get(hContact)) {
- case PHONE_NORMAL:
- ico.icoName = ICO_BTN_PHONE;
- break;
- case PHONE_SMS:
- ico.icoName = ICO_BTN_CELLULAR;
- break;
- default:
- ico.icoName = NULL;
+ case PHONE_NORMAL: icoName = ICO_BTN_PHONE; break;
+ case PHONE_SMS: icoName = ICO_BTN_CELLULAR; break;
+ default: icoName = NULL;
}
- CallService(MS_EXTRAICON_SET_ICON, (WPARAM)&ico, 0);
+ ExtraIcon_SetIcon(ghExtraIconSvc, hContact, icoName);
return 0;
}
diff --git a/plugins/UserInfoEx/src/svc_reminder.cpp b/plugins/UserInfoEx/src/svc_reminder.cpp index 91f19eb804..660d2de23e 100644 --- a/plugins/UserInfoEx/src/svc_reminder.cpp +++ b/plugins/UserInfoEx/src/svc_reminder.cpp @@ -187,31 +187,31 @@ static HICON GetAnnivIcon(const CEvent &evt) static VOID NotifyWithExtraIcon(HANDLE hContact, const CEvent &evt)
{
if (gRemindOpts.bCListExtraIcon) {
- CHAR szIcon[MAXSETTING];
-
- EXTRAICON ico = { sizeof(ico) };
- ico.hContact = hContact;
- ico.hExtraIcon = ExtraIcon;
+ char szIcon[MAXSETTING], *icoName;
+
switch (evt._eType) {
case CEvent::BIRTHDAY:
if (evt._wDaysLeft > 9)
- ico.icoName = ICO_RMD_DTAX;
+ icoName = ICO_RMD_DTAX;
else {
mir_snprintf(szIcon, SIZEOF(szIcon), MODNAME"_rmd_dtb%u", evt._wDaysLeft);
- ico.icoName = szIcon;
+ icoName = szIcon;
}
break;
case CEvent::ANNIVERSARY:
if (evt._wDaysLeft > 9)
- ico.icoName = ICO_RMD_DTAX;
+ icoName = ICO_RMD_DTAX;
else {
mir_snprintf(szIcon, SIZEOF(szIcon), MODNAME"_rmd_dta%u", evt._wDaysLeft);
- ico.icoName = szIcon;
+ icoName = szIcon;
}
break;
+
+ default:
+ return;
}
- CallService(MS_EXTRAICON_SET_ICON, (WPARAM)&ico, 0);
+ ExtraIcon_SetIcon(ExtraIcon, hContact, icoName);
}
}
diff --git a/plugins/WhenWasIt/src/notifiers.cpp b/plugins/WhenWasIt/src/notifiers.cpp index 2cc37e28a8..ec7950655b 100644 --- a/plugins/WhenWasIt/src/notifiers.cpp +++ b/plugins/WhenWasIt/src/notifiers.cpp @@ -231,7 +231,7 @@ int SoundNotifyBirthday(int dtb) int ClearClistIcon(HANDLE hContact)
{
- return ExtraIcon_SetIcon(hWWIExtraIcons, hContact, INVALID_HANDLE_VALUE);
+ return ExtraIcon_Clear(hWWIExtraIcons, hContact);
}
int RefreshContactListIcons(HANDLE hContact)
|