From f12d8b56f2894e94491bd7424d69f595d285f01f Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 3 Nov 2012 20:16:42 +0000 Subject: no more MS_CLIST_EXTRA_ADD_ICON in the application code git-svn-id: http://svn.miranda-ng.org/main/trunk@2175 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/UserInfoEx/src/Flags/svc_flags.cpp | 4 +- plugins/UserInfoEx/src/Flags/svc_flags.h | 9 +-- plugins/UserInfoEx/src/svc_reminder.cpp | 118 +++++------------------------ 3 files changed, 23 insertions(+), 108 deletions(-) (limited to 'plugins/UserInfoEx') diff --git a/plugins/UserInfoEx/src/Flags/svc_flags.cpp b/plugins/UserInfoEx/src/Flags/svc_flags.cpp index 359d574b30..ed43e04161 100644 --- a/plugins/UserInfoEx/src/Flags/svc_flags.cpp +++ b/plugins/UserInfoEx/src/Flags/svc_flags.cpp @@ -43,7 +43,6 @@ FLAGSOPTIONS gFlagsOpts; /* Misc */ int nCountriesCount; struct CountryListEntry *countries; -static HANDLE *phExtraImageList = NULL; //return value(s) from MS_CLIST_EXTRA_ADD_ICON static HANDLE hExtraIconSvc = INVALID_HANDLE_VALUE; /* hook */ static HANDLE hRebuildIconsHook = NULL; @@ -344,7 +343,7 @@ VOID SvcFlagsEnableExtraIcons(BYTE bColumn, BOOLEAN bUpdateDB) mir_snprintf(szId, SIZEOF(szId), (langid==0xFFFF)?"%s_0x%X":"%s_%i","flags",langid); /* buffer safe */ ico.descIcon = szId; hExtraIconSvc = (HANDLE)CallService(MS_EXTRAICON_REGISTER, (WPARAM)&ico, 0); - if(hExtraIconSvc) + if (hExtraIconSvc) HookEvent(ME_DB_CONTACT_SETTINGCHANGED, OnExtraIconSvcChanged); } @@ -620,7 +619,6 @@ void SvcFlagsUnloadModule() { UnhookEvent(hRebuildIconsHook); UnhookEvent(hApplyIconHook); UnhookEvent(hIconsChangedHook); - mir_free(phExtraImageList); /* does NULL check */ //Uninit message winsow UnhookEvent(hMsgWndEventHook); for(int i = 0; i < gMsgWndList.getCount(); i++) { diff --git a/plugins/UserInfoEx/src/Flags/svc_flags.h b/plugins/UserInfoEx/src/Flags/svc_flags.h index e7f97ab963..a597f67e8a 100644 --- a/plugins/UserInfoEx/src/Flags/svc_flags.h +++ b/plugins/UserInfoEx/src/Flags/svc_flags.h @@ -70,11 +70,10 @@ class MsgWndData { class IconList { public: - int m_ID; - HANDLE m_hIcon; //register - HANDLE m_hImage; //return value from MS_CLIST_EXTRA_ADD_ICON -INVALID_HANDLE_VALUE; //preset - BYTE m_TypeFlag; - StatusIconData m_StatusIconData; + int m_ID; + HANDLE m_hIcon; //register + BYTE m_TypeFlag; + StatusIconData m_StatusIconData; IconList(StatusIconData* sid); // IconList(HWND hwnd, HANDLE hContact); diff --git a/plugins/UserInfoEx/src/svc_reminder.cpp b/plugins/UserInfoEx/src/svc_reminder.cpp index bfde666a9b..ae7de9fb81 100644 --- a/plugins/UserInfoEx/src/svc_reminder.cpp +++ b/plugins/UserInfoEx/src/svc_reminder.cpp @@ -148,114 +148,32 @@ BOOLEAN CEvent::operator << (const CEvent& evt) * * @return The function returns icolib's icon if found or NULL otherwise. **/ + static HICON GetAnnivIcon(const CEvent &evt) { HICON hIcon = NULL; CHAR szIcon[MAXSETTING]; - switch (evt._eType) - { - case CEvent::BIRTHDAY: - { - if (evt._wDaysLeft > 9) - { - hIcon = IcoLib_GetIcon(ICO_RMD_DTBX); - } - else - { - mir_snprintf(szIcon, SIZEOF(szIcon), MODNAME"_rmd_dtb%u", evt._wDaysLeft); - hIcon = IcoLib_GetIcon(szIcon); - } - } - break; - - case CEvent::ANNIVERSARY: - { - if (evt._wDaysLeft > 9) - { - hIcon = IcoLib_GetIcon(ICO_RMD_DTAX); - } - else - { - mir_snprintf(szIcon, SIZEOF(szIcon), MODNAME"_rmd_dta%u", evt._wDaysLeft); - hIcon = IcoLib_GetIcon(szIcon); - } - } - } - return hIcon; -} - -/** - * This function adds the icon for the given anniversary, which is the given number of days - * in advance to the contact list's imagelist. - * - * @param evt - structure specifying the next anniversary - * - * @return The function returns the clist's extra icon handle if found and successfully added. - **/ -static HANDLE AddCListExtraIcon(const CEvent &evt) -{ - HANDLE hClistIcon; - HICON hIco = GetAnnivIcon(evt); - if (hIco) - { - hClistIcon = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)hIco, 0); - if (hClistIcon == (HANDLE)CALLSERVICE_NOTFOUND) - hClistIcon = INVALID_HANDLE_VALUE; - - Skin_ReleaseIcon(hIco); - } - else hClistIcon = INVALID_HANDLE_VALUE; - - return hClistIcon; -} - -/** - * This function returns the clist extra icon handle for the given anniversary. - * - * @param evt - structure specifying the next anniversary - * - * @return The function returns the clist extra icon handle for the given anniversary. - **/ -static HANDLE GetCListExtraIcon(const CEvent &evt) -{ - if (gRemindOpts.bCListExtraIcon) - { - WORD wIndex = evt._wDaysLeft; - - switch (evt._eType) - { - case CEvent::BIRTHDAY: - { - if (wIndex >= SIZEOF(ghCListBirthdayIcons)) - { - wIndex = SIZEOF(ghCListBirthdayIcons) - 1; - } - // add the icon to clists imagelist if required - if (ghCListBirthdayIcons[wIndex] == INVALID_HANDLE_VALUE) - { - ghCListBirthdayIcons[wIndex] = AddCListExtraIcon(evt); - } - } - return ghCListBirthdayIcons[wIndex]; - - case CEvent::ANNIVERSARY: - { - if (wIndex >= SIZEOF(ghCListAnnivIcons)) - { - wIndex = SIZEOF(ghCListAnnivIcons) - 1; - } - // add the icon to clists imagelist if required - if (ghCListAnnivIcons[wIndex] == INVALID_HANDLE_VALUE) - { - ghCListAnnivIcons[wIndex] = AddCListExtraIcon(evt); - } - } - return ghCListAnnivIcons[wIndex]; + switch (evt._eType) { + case CEvent::BIRTHDAY: + if (evt._wDaysLeft > 9) + hIcon = IcoLib_GetIcon(ICO_RMD_DTBX); + else { + mir_snprintf(szIcon, SIZEOF(szIcon), MODNAME"_rmd_dtb%u", evt._wDaysLeft); + hIcon = IcoLib_GetIcon(szIcon); + } + break; + + case CEvent::ANNIVERSARY: + if (evt._wDaysLeft > 9) + hIcon = IcoLib_GetIcon(ICO_RMD_DTAX); + else { + mir_snprintf(szIcon, SIZEOF(szIcon), MODNAME"_rmd_dta%u", evt._wDaysLeft); + hIcon = IcoLib_GetIcon(szIcon); } } - return INVALID_HANDLE_VALUE; + return hIcon; } /** -- cgit v1.2.3