summaryrefslogtreecommitdiff
path: root/plugins/UserInfoEx
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-06-10 14:46:58 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-06-10 14:46:58 +0000
commit101ca36412b3e7b8851b6b48a4f6cbc17d9f9eff (patch)
treea846c60f7c2a7df17b694deba92e7f6df3bbb882 /plugins/UserInfoEx
parenta3fdadd09f12f6b246b11a5156bf6f0358e9a5f8 (diff)
bitmap operations were removed from TopToolBar and replaced with IcoLib
git-svn-id: http://svn.miranda-ng.org/main/trunk@379 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/UserInfoEx')
-rw-r--r--plugins/UserInfoEx/Flags/svc_flags.cpp8
-rw-r--r--plugins/UserInfoEx/Flags/svc_flagsicons.cpp15
-rw-r--r--plugins/UserInfoEx/dlg_anniversarylist.cpp50
-rw-r--r--plugins/UserInfoEx/mir_icolib.cpp65
-rw-r--r--plugins/UserInfoEx/mir_icolib.h1
-rw-r--r--plugins/UserInfoEx/psp_base.cpp2
-rw-r--r--plugins/UserInfoEx/svc_email.cpp2
-rw-r--r--plugins/UserInfoEx/svc_gender.cpp4
-rw-r--r--plugins/UserInfoEx/svc_homepage.cpp2
-rw-r--r--plugins/UserInfoEx/svc_phone.cpp4
-rw-r--r--plugins/UserInfoEx/svc_reminder.cpp46
11 files changed, 76 insertions, 123 deletions
diff --git a/plugins/UserInfoEx/Flags/svc_flags.cpp b/plugins/UserInfoEx/Flags/svc_flags.cpp
index 58fe8eec24..49435ec5c0 100644
--- a/plugins/UserInfoEx/Flags/svc_flags.cpp
+++ b/plugins/UserInfoEx/Flags/svc_flags.cpp
@@ -266,7 +266,7 @@ static void CALLBACK SetExtraImage(LPARAM lParam) {
HICON hIcon=LoadFlag(countryNumber); // Returned HICON SHOULDN'T be destroyed, it is managed by IcoLib
if(hIcon!=NULL) {
phExtraImageList[index]=(HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON,(WPARAM)hIcon,0);
- CallService(MS_SKIN2_RELEASEICON,(WPARAM)hIcon,0); /* does NULL check */
+ Skin_ReleaseIcon(hIcon); /* does NULL check */
}
}
iec.hImage=phExtraImageList[index];
@@ -502,7 +502,7 @@ MsgWndData::FlagsIconSet() {
/* copy icon as status icon API will call DestroyIcon() on it */
hIcon = LoadFlagIcon(m_contryID);
sid.hIcon = (hIcon!=NULL)?CopyIcon(hIcon):NULL;
- CallService(MS_SKIN2_RELEASEICON,(WPARAM)hIcon,0); /* does NULL check */
+ Skin_ReleaseIcon(hIcon); /* does NULL check */
hIcon = sid.hIcon;
sid.dwId = (DWORD)m_contryID;
sid.hIconDisabled = sid.hIcon/*NULL*/;
@@ -565,14 +565,14 @@ IconList::~IconList() {
// const char *pszName; // [Optional] Name of an icon registered with icolib to be used in GUI.
static __inline int MessageAPI_AddIcon(const char* pszName, const char* szModul/*StatusIconData *sid*/,int ID, int flags, const char* szTooltip)
{
- HICON hIcon = (HICON)CallService(MS_SKIN2_GETICON,(WPARAM)0/* =small 1=big*/,(LPARAM)pszName);
+ HICON hIcon = Skin_GetIcon(pszName);
StatusIconData sid = {0};
sid.cbSize = sizeof(sid);
sid.szModule = (char*)szModul;
sid.dwId = (DWORD)ID;
sid.hIcon = (hIcon!=NULL)?CopyIcon(hIcon):NULL;
- CallService(MS_SKIN2_RELEASEICON,(WPARAM)hIcon,0); /* does NULL check */
+ Skin_ReleaseIcon(hIcon); /* does NULL check */
// sid.hIconDisabled = sid.hIcon/*NULL*/;
sid.flags = 0;
sid.szTooltip = Translate((char*)CallService(MS_UTILS_GETCOUNTRYBYNUMBER,ID,0));
diff --git a/plugins/UserInfoEx/Flags/svc_flagsicons.cpp b/plugins/UserInfoEx/Flags/svc_flagsicons.cpp
index 34fec69c39..a765b8e8f8 100644
--- a/plugins/UserInfoEx/Flags/svc_flagsicons.cpp
+++ b/plugins/UserInfoEx/Flags/svc_flagsicons.cpp
@@ -141,11 +141,11 @@ HICON LoadFlag(int countryNumber)
char szId[20],*szCountry;
/* create identifier */
szCountry=(char*)CallService(MS_UTILS_GETCOUNTRYBYNUMBER,countryNumber,0);
- if(szCountry==NULL) {
+ if(szCountry == NULL)
szCountry=(char*)CallService(MS_UTILS_GETCOUNTRYBYNUMBER,countryNumber=0xFFFF,0);
- }
+
wsprintfA(szId,(countryNumber==0xFFFF)?"%s_0x%X":"%s_%i","flags",countryNumber); /* buffer safe */
- return (HICON)CallService(MS_SKIN2_GETICON,(WPARAM)0/* =small 1=big*/,(LPARAM)szId);
+ return Skin_GetIcon(szId);
}
int CountryNumberToIndex(int countryNumber)
@@ -431,7 +431,7 @@ VOID InitIcons()
skid.hDefaultIcon=ImageList_ExtractIcon(NULL, himl, index);
index = CountryNumberToIndex(countries[i].id);
- phIconHandles[index]=(HANDLE)CallService(MS_SKIN2_ADDICON,0,(LPARAM)&skid);
+ phIconHandles[index] = Skin_AddIcon(&skid);
if(skid.hDefaultIcon!=NULL) DestroyIcon(skid.hDefaultIcon);
mir_free(skid.ptszDescription); skid.ptszDescription = NULL;
}
@@ -446,12 +446,11 @@ VOID InitIcons()
VOID UninitIcons()
{
- int i;
- char szId[20];
- for(i=0;i<nCountriesCount;++i) {
+ for(int i=0;i<nCountriesCount;++i) {
/* create identifier */
+ char szId[20];
wsprintfA(szId,(countries[i].id==0xFFFF)?"%s0x%X":"%s%i","flags_",countries[i].id); /* buffer safe */
- CallService(MS_SKIN2_REMOVEICON,0,(LPARAM)&szId);
+ Skin_RemoveIcon(szId);
}
mir_free(phIconHandles); /* does NULL check */
}
diff --git a/plugins/UserInfoEx/dlg_anniversarylist.cpp b/plugins/UserInfoEx/dlg_anniversarylist.cpp
index a7af16c239..8a41aa0138 100644
--- a/plugins/UserInfoEx/dlg_anniversarylist.cpp
+++ b/plugins/UserInfoEx/dlg_anniversarylist.cpp
@@ -1087,26 +1087,16 @@ INT_PTR DlgAnniversaryListShow(WPARAM wParam, LPARAM lParam)
*
* @return nothing
**/
+
VOID DlgAnniversaryListOnTopToolBarLoaded()
{
- TTBButton ttb;
- HICON hIcon;
- ICONINFO ii;
-
- hIcon = IcoLib_RegisterIcon(TBB_ICONAME, LPGEN("Anniversary list"),
- SECT_TOOLBAR, IDI_ANNIVERSARY, 0);
- if (hIcon) {
- GetIconInfo(hIcon, &ii);
-
- ZeroMemory(&ttb, sizeof(TTBButton));
- ttb.cbSize = sizeof(TTBButton);
- ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP;
- ttb.pszServiceDown = MS_USERINFO_REMINDER_LIST;
- ttb.hbBitmapUp = ttb.hbBitmapDown = ii.hbmColor;
- ttb.name = Translate("Anniversary list");
-
- CallService(MS_TTB_ADDBUTTON, (WPARAM) &ttb, 0);
- }
+ TTBButton ttb = { 0 };
+ ttb.cbSize = sizeof(ttb);
+ ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP | TTBBF_ICONBYHANDLE;
+ ttb.pszServiceDown = MS_USERINFO_REMINDER_LIST;
+ ttb.hIconHandleDn = ttb.hIconHandleUp = Skin_GetIconHandle(ICO_COMMON_ANNIVERSARY);
+ ttb.name = "Anniversary list";
+ CallService(MS_TTB_ADDBUTTON, (WPARAM) &ttb, 0);
}
/**
@@ -1119,22 +1109,14 @@ VOID DlgAnniversaryListOnTopToolBarLoaded()
**/
VOID DlgAnniversaryListOnToolBarLoaded()
{
- TBButton tbb;
-
- ZeroMemory(&tbb, sizeof(tbb));
- tbb.cbSize = sizeof(tbb);
- tbb.tbbFlags = TBBF_VISIBLE | TBBF_SHOWTOOLTIP;
- tbb.defPos = 2100;
- tbb.pszButtonName =
- tbb.pszButtonID = TBB_IDBTN;
- tbb.pszServiceName = MS_USERINFO_REMINDER_LIST;
- tbb.pszTooltipDn =
- tbb.pszTooltipUp = LPGEN("Anniversary list");
- tbb.hPrimaryIconHandle =
- tbb.hSecondaryIconHandle =
- IcoLib_RegisterIconHandle(TBB_ICONAME, tbb.pszTooltipUp,
- SECT_TOOLBAR, IDI_ANNIVERSARY, 0);
-
+ TBButton tbb = { 0 };
+ tbb.cbSize = sizeof(tbb);
+ tbb.tbbFlags = TBBF_VISIBLE | TBBF_SHOWTOOLTIP;
+ tbb.defPos = 2100;
+ tbb.pszButtonName = tbb.pszButtonID = TBB_IDBTN;
+ tbb.pszServiceName = MS_USERINFO_REMINDER_LIST;
+ tbb.pszTooltipDn = tbb.pszTooltipUp = LPGEN("Anniversary list");
+ tbb.hPrimaryIconHandle = tbb.hSecondaryIconHandle = Skin_GetIconHandle(ICO_COMMON_ANNIVERSARY);
CallService(MS_TB_ADDBUTTON, 0, (LPARAM) &tbb);
}
diff --git a/plugins/UserInfoEx/mir_icolib.cpp b/plugins/UserInfoEx/mir_icolib.cpp
index 4e8da429a6..ef5d22e487 100644
--- a/plugins/UserInfoEx/mir_icolib.cpp
+++ b/plugins/UserInfoEx/mir_icolib.cpp
@@ -210,7 +210,7 @@ static VOID IcoLib_CheckIconPackVersion(LPTSTR szIconPack)
**/
HICON IcoLib_GetIcon(LPCSTR pszIcon)
{
- return (pszIcon) ? (HICON)CallService(MS_SKIN2_GETICON, NULL, (LPARAM) pszIcon) : NULL;
+ return (pszIcon) ? Skin_GetIcon(pszIcon) : NULL;
}
/**
@@ -222,7 +222,7 @@ HICON IcoLib_GetIcon(LPCSTR pszIcon)
**/
HICON IcoLib_GetIconByHandle(HANDLE hIconItem)
{
- return (HICON)CallService(MS_SKIN2_GETICONBYHANDLE, NULL, (LPARAM) hIconItem);
+ return Skin_GetIconByHandle(hIconItem);
}
/**
@@ -288,54 +288,42 @@ static HANDLE IcoLib_RegisterIconHandleEx(LPSTR szIconID, LPSTR szDescription, L
{
HANDLE hIconHandle = NULL;
- if (szIconID && szDescription && szSection)
- {
- SKINICONDESC sid;
-
- ZeroMemory(&sid, sizeof(sid));
+ if (szIconID && szDescription && szSection) {
+ SKINICONDESC sid = { 0 };
sid.cbSize = sizeof(sid);
sid.flags = SIDF_ALL_TCHAR;
sid.pszName = szIconID;
sid.ptszDescription = mir_a2t(szDescription);
sid.ptszSection = mir_a2t(szSection);
- if (sid.ptszDescription && sid.ptszSection)
- {
- switch (Size)
- {
- // small icons (16x16)
- case 0:
- {
- sid.cx = GetSystemMetrics(SM_CXSMICON);
- sid.cy = GetSystemMetrics(SM_CYSMICON);
- break;
- }
- // normal icons (32x32)
- case 1:
- {
- sid.cx = GetSystemMetrics(SM_CXICON);
- sid.cy = GetSystemMetrics(SM_CYICON);
- break;
- }
- // custom icon size
- default:
- {
- sid.cx = sid.cy = Size;
- break;
- }
+ if (sid.ptszDescription && sid.ptszSection) {
+ switch (Size) {
+ // small icons (16x16)
+ case 0:
+ sid.cx = GetSystemMetrics(SM_CXSMICON);
+ sid.cy = GetSystemMetrics(SM_CYSMICON);
+ break;
+
+ // normal icons (32x32)
+ case 1:
+ sid.cx = GetSystemMetrics(SM_CXICON);
+ sid.cy = GetSystemMetrics(SM_CYICON);
+ break;
+
+ // custom icon size
+ default:
+ sid.cx = sid.cy = Size;
+ break;
}
sid.ptszDefaultFile = szDefaultFile;
if (sid.ptszDefaultFile && sid.ptszDefaultFile[0])
- {
- sid.iDefaultIndex = ICONINDEX(idIcon);
- }
- else
- {
+ sid.iDefaultIndex = -idIcon;
+ else {
sid.hDefaultIcon = hDefIcon;
sid.iDefaultIndex = -1;
}
- hIconHandle = (HANDLE) CallService(MS_SKIN2_ADDICON, 0, (LPARAM)&sid);
+ hIconHandle = Skin_AddIcon(&sid);
}
MIR_FREE(sid.ptszDescription);
MIR_FREE(sid.ptszSection);
@@ -404,8 +392,7 @@ VOID IcoLib_LoadModule()
ghDefIcon = (HICON)LoadImage(ghInst, MAKEINTRESOURCE(IDI_DEFAULT), IMAGE_ICON,
GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0);
- for (i = 0; i < SIZEOF(icoDesc); i++)
- {
+ for (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/mir_icolib.h b/plugins/UserInfoEx/mir_icolib.h
index 632f80b0ec..d5ac62e9fa 100644
--- a/plugins/UserInfoEx/mir_icolib.h
+++ b/plugins/UserInfoEx/mir_icolib.h
@@ -39,7 +39,6 @@ Last change by : $Author: ing.u.horn $
#define SECT_BUTTONS "UserInfoEx/Buttons"
#define SECT_TREE "UserInfoEx/TreeView"
#define SECT_REMIND "UserInfoEx/Reminder"
-#define SECT_TOOLBAR "ToolBar" // global toolbar section as used by modern clist
// icons
#define ICO_COMMON_IM MODNAME"_common_im"
diff --git a/plugins/UserInfoEx/psp_base.cpp b/plugins/UserInfoEx/psp_base.cpp
index 0762178e96..e015131ad6 100644
--- a/plugins/UserInfoEx/psp_base.cpp
+++ b/plugins/UserInfoEx/psp_base.cpp
@@ -34,7 +34,7 @@ VOID UpDate_CountryIcon(HWND hCtrl, int countryID) {
HICON hIcon = LoadFlagIcon(countryID);
HICON hOld = Static_SetIcon(hCtrl, hIcon);
ShowWindow(hCtrl, hIcon ? SW_SHOW : SW_HIDE);
- CallService(MS_SKIN2_RELEASEICON, (WPARAM)hOld, 0);
+ Skin_ReleaseIcon(hOld);
}
/**
diff --git a/plugins/UserInfoEx/svc_email.cpp b/plugins/UserInfoEx/svc_email.cpp
index 446556431f..2d74c96e75 100644
--- a/plugins/UserInfoEx/svc_email.cpp
+++ b/plugins/UserInfoEx/svc_email.cpp
@@ -142,7 +142,7 @@ static INT OnCListRebuildIcons(WPARAM wParam, LPARAM lParam)
{
HICON hIcon = IcoLib_GetIcon(ICO_BTN_EMAIL);
ghExtraIconDef = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)hIcon, 0);
- CallService(MS_SKIN2_RELEASEICON,(WPARAM)hIcon,0);
+ Skin_ReleaseIcon(hIcon);
return 0;
}
diff --git a/plugins/UserInfoEx/svc_gender.cpp b/plugins/UserInfoEx/svc_gender.cpp
index 128b9fe97e..433a7664b9 100644
--- a/plugins/UserInfoEx/svc_gender.cpp
+++ b/plugins/UserInfoEx/svc_gender.cpp
@@ -76,10 +76,10 @@ static INT OnCListRebuildIcons(WPARAM wParam, LPARAM lParam)
{
HICON hIcon = IcoLib_GetIcon(ICO_COMMON_FEMALE);
ghExtraIconF = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)hIcon, 0);
- CallService(MS_SKIN2_RELEASEICON,(WPARAM)hIcon,0);
+ Skin_ReleaseIcon(hIcon);
hIcon = IcoLib_GetIcon(ICO_COMMON_MALE);
ghExtraIconM = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)hIcon, 0);
- CallService(MS_SKIN2_RELEASEICON,(WPARAM)hIcon,0);
+ Skin_ReleaseIcon(hIcon);
return 0;
}
diff --git a/plugins/UserInfoEx/svc_homepage.cpp b/plugins/UserInfoEx/svc_homepage.cpp
index 856a1fc68d..4d0ac22554 100644
--- a/plugins/UserInfoEx/svc_homepage.cpp
+++ b/plugins/UserInfoEx/svc_homepage.cpp
@@ -104,7 +104,7 @@ static INT OnCListRebuildIcons(WPARAM wParam, LPARAM lParam)
{
HICON hIcon = IcoLib_GetIcon(ICO_BTN_GOTO);
ghExtraIconDef = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)hIcon, 0);
- CallService(MS_SKIN2_RELEASEICON,(WPARAM)hIcon,0);
+ Skin_ReleaseIcon(hIcon);
return 0;
}
diff --git a/plugins/UserInfoEx/svc_phone.cpp b/plugins/UserInfoEx/svc_phone.cpp
index 4ddf2a1e5d..fab967c9a1 100644
--- a/plugins/UserInfoEx/svc_phone.cpp
+++ b/plugins/UserInfoEx/svc_phone.cpp
@@ -98,10 +98,10 @@ static INT OnCListRebuildIcons(WPARAM wParam, LPARAM lParam)
{
HICON hIcon = IcoLib_GetIcon(ICO_BTN_PHONE);
ghExtraIconDef[0] = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)hIcon, 0);
- CallService(MS_SKIN2_RELEASEICON,(WPARAM)hIcon,0);
+ Skin_ReleaseIcon(hIcon);
hIcon = IcoLib_GetIcon(ICO_BTN_CELLULAR);
ghExtraIconDef[1] = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)hIcon, 0);
- CallService(MS_SKIN2_RELEASEICON,(WPARAM)hIcon,0);
+ Skin_ReleaseIcon(hIcon);
return 0;
}
diff --git a/plugins/UserInfoEx/svc_reminder.cpp b/plugins/UserInfoEx/svc_reminder.cpp
index 29441a8fc2..41940ac9f4 100644
--- a/plugins/UserInfoEx/svc_reminder.cpp
+++ b/plugins/UserInfoEx/svc_reminder.cpp
@@ -202,15 +202,12 @@ static HANDLE AddCListExtraIcon(const CEvent &evt)
{
hClistIcon = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)hIco, 0);
if (hClistIcon == (HANDLE)CALLSERVICE_NOTFOUND)
- {
hClistIcon = INVALID_HANDLE_VALUE;
- }
- CallService(MS_SKIN2_RELEASEICON,(WPARAM)hIco,0);
- }
- else
- {
- hClistIcon = INVALID_HANDLE_VALUE;
+
+ Skin_ReleaseIcon(hIco);
}
+ else hClistIcon = INVALID_HANDLE_VALUE;
+
return hClistIcon;
}
@@ -907,28 +904,18 @@ static INT OnContactSettingChanged(HANDLE hContact, DBCONTACTWRITESETTING* pdbcw
int hTTButton = -1;
VOID SvcReminderOnTopToolBarLoaded()
{
- HICON hIcon = IcoLib_RegisterIcon(TBB_ICONAME, "Check anniversaries", SECT_TOOLBAR, IDI_BIRTHDAY, 0);
- if (hIcon)
- { /* for later merge
- ICONINFO ii;
- TTBButton ttb;
-
- GetIconInfo(hIcon, &ii);
- */
- TTBButtonV2 ttb;
- ZeroMemory(&ttb, sizeof(TTBButtonV2));
- ttb.cbSize = sizeof(TTBButtonV2);
-
- ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP;
- ttb.pszServiceDown = MS_USERINFO_REMINDER_CHECK;
- ttb.name = Translate("Check anniversaries");
- ttb.hIconUp = ttb.hIconDn = hIcon;
- ttb.tooltipUp = ttb.tooltipDn = Translate("Check anniversaries");
+ TTBButton ttb = { 0 };
+ ttb.cbSize = sizeof(ttb);
+
+ ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP | TTBBF_ICONBYHANDLE;
+ ttb.pszServiceDown = MS_USERINFO_REMINDER_CHECK;
+ ttb.name = "Check anniversaries";
+ ttb.hIconHandleDn = ttb.hIconHandleUp = Skin_GetIconHandle(ICO_COMMON_BIRTHDAY);
+ ttb.tooltipUp = ttb.tooltipDn = "Check anniversaries";
- hTTButton = CallService(MS_TTB_ADDBUTTON, (WPARAM) &ttb, 0);
- if (hTTButton)
- CallService(MS_TTB_SETBUTTONOPTIONS, MAKEWPARAM(TTBO_TIPNAME, hTTButton), (LPARAM)(Translate("Check anniversaries")));
- }
+ hTTButton = CallService(MS_TTB_ADDBUTTON, (WPARAM) &ttb, 0);
+ if (hTTButton)
+ CallService(MS_TTB_SETBUTTONOPTIONS, MAKEWPARAM(TTBO_TIPNAME, hTTButton), (LPARAM)"Check anniversaries");
}
/**
@@ -952,8 +939,7 @@ VOID SvcReminderOnToolBarLoaded()
tbb.pszServiceName = MS_USERINFO_REMINDER_CHECK;
tbb.pszTooltipDn =
tbb.pszTooltipUp = LPGEN("Check anniversaries");
- tbb.hPrimaryIconHandle =
- tbb.hSecondaryIconHandle = IcoLib_RegisterIconHandle(TBB_ICONAME, tbb.pszButtonName, SECT_TOOLBAR, IDI_BIRTHDAY, 0);
+ tbb.hPrimaryIconHandle = tbb.hSecondaryIconHandle = Skin_GetIconHandle(ICO_COMMON_BIRTHDAY);
CallService(MS_TB_ADDBUTTON, 0, (LPARAM) &tbb);
}