From fb8d04451e6808b1c88116c7d6d6c473831c5a2b Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 27 Jan 2013 13:58:20 +0000 Subject: strange icolib manager in ICQ killed and replaced with the standard icolib calls. rip... git-svn-id: http://svn.miranda-ng.org/main/trunk@3304 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/IcqOscarJ/icqoscar8_10.vcxproj | 2 - protocols/IcqOscarJ/icqoscar8_10.vcxproj.filters | 4 -- protocols/IcqOscarJ/icqoscar8_11.vcxproj | 2 - protocols/IcqOscarJ/icqoscar8_11.vcxproj.filters | 4 -- protocols/IcqOscarJ/src/UI/loginpassword.cpp | 36 +++++----- protocols/IcqOscarJ/src/globals.h | 5 +- protocols/IcqOscarJ/src/iconlib.cpp | 91 ------------------------ protocols/IcqOscarJ/src/iconlib.h | 52 -------------- protocols/IcqOscarJ/src/icq_firstrun.cpp | 15 ++-- protocols/IcqOscarJ/src/icq_menu.cpp | 8 +-- protocols/IcqOscarJ/src/icq_popups.cpp | 2 +- protocols/IcqOscarJ/src/icq_proto.cpp | 26 +++---- protocols/IcqOscarJ/src/icq_proto.h | 2 +- protocols/IcqOscarJ/src/icq_xstatus.cpp | 54 +++++--------- protocols/IcqOscarJ/src/icqoscar.h | 2 +- protocols/IcqOscarJ/src/init.cpp | 27 +++---- protocols/IcqOscarJ/src/utilities.h | 1 - 17 files changed, 71 insertions(+), 262 deletions(-) delete mode 100644 protocols/IcqOscarJ/src/iconlib.cpp delete mode 100644 protocols/IcqOscarJ/src/iconlib.h (limited to 'protocols/IcqOscarJ') diff --git a/protocols/IcqOscarJ/icqoscar8_10.vcxproj b/protocols/IcqOscarJ/icqoscar8_10.vcxproj index 74324f6cbb..37b254bbed 100644 --- a/protocols/IcqOscarJ/icqoscar8_10.vcxproj +++ b/protocols/IcqOscarJ/icqoscar8_10.vcxproj @@ -203,7 +203,6 @@ - @@ -278,7 +277,6 @@ - diff --git a/protocols/IcqOscarJ/icqoscar8_10.vcxproj.filters b/protocols/IcqOscarJ/icqoscar8_10.vcxproj.filters index ac583f1be6..c91460a53f 100644 --- a/protocols/IcqOscarJ/icqoscar8_10.vcxproj.filters +++ b/protocols/IcqOscarJ/icqoscar8_10.vcxproj.filters @@ -47,9 +47,6 @@ Header Files - - Header Files - Header Files @@ -250,7 +247,6 @@ - diff --git a/protocols/IcqOscarJ/icqoscar8_11.vcxproj b/protocols/IcqOscarJ/icqoscar8_11.vcxproj index 9407316284..58fbaedc8a 100644 --- a/protocols/IcqOscarJ/icqoscar8_11.vcxproj +++ b/protocols/IcqOscarJ/icqoscar8_11.vcxproj @@ -207,7 +207,6 @@ - @@ -282,7 +281,6 @@ - diff --git a/protocols/IcqOscarJ/icqoscar8_11.vcxproj.filters b/protocols/IcqOscarJ/icqoscar8_11.vcxproj.filters index ac583f1be6..c91460a53f 100644 --- a/protocols/IcqOscarJ/icqoscar8_11.vcxproj.filters +++ b/protocols/IcqOscarJ/icqoscar8_11.vcxproj.filters @@ -47,9 +47,6 @@ Header Files - - Header Files - Header Files @@ -250,7 +247,6 @@ - diff --git a/protocols/IcqOscarJ/src/UI/loginpassword.cpp b/protocols/IcqOscarJ/src/UI/loginpassword.cpp index ab65212331..be7c4717bb 100644 --- a/protocols/IcqOscarJ/src/UI/loginpassword.cpp +++ b/protocols/IcqOscarJ/src/UI/loginpassword.cpp @@ -40,10 +40,10 @@ INT_PTR CALLBACK LoginPasswdDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA ppro = (CIcqProto*)lParam; SetWindowLongPtr( hwndDlg, GWLP_USERDATA, lParam ); - { - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)ppro->m_hIconProtocol->GetIcon(true)); - SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)ppro->m_hIconProtocol->GetIcon()); + SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)Skin_GetIconByHandle(ppro->m_hIconProtocol, true)); + SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)Skin_GetIconByHandle(ppro->m_hIconProtocol)); + { DWORD dwUin = ppro->getContactUin(NULL); char pszUIN[MAX_PATH], str[MAX_PATH]; @@ -57,8 +57,8 @@ INT_PTR CALLBACK LoginPasswdDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA break; case WM_DESTROY: - ppro->m_hIconProtocol->ReleaseIcon(true); - ppro->m_hIconProtocol->ReleaseIcon(); + Skin_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_BIG, 0)); + Skin_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_SMALL, 0)); break; case WM_CLOSE: @@ -66,24 +66,22 @@ INT_PTR CALLBACK LoginPasswdDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA break; case WM_COMMAND: - { - switch (LOWORD(wParam)) { - case IDOK: - ppro->m_bRememberPwd = (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SAVEPASS); - ppro->setSettingByte(NULL, "RememberPass", ppro->m_bRememberPwd); + switch (LOWORD(wParam)) { + case IDOK: + ppro->m_bRememberPwd = (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SAVEPASS); + ppro->setSettingByte(NULL, "RememberPass", ppro->m_bRememberPwd); - GetDlgItemTextA(hwndDlg, IDC_LOGINPW, ppro->m_szPassword, sizeof(ppro->m_szPassword)); + GetDlgItemTextA(hwndDlg, IDC_LOGINPW, ppro->m_szPassword, sizeof(ppro->m_szPassword)); - ppro->icq_login(ppro->m_szPassword); + ppro->icq_login(ppro->m_szPassword); - EndDialog(hwndDlg, IDOK); - break; + EndDialog(hwndDlg, IDOK); + break; - case IDCANCEL: - ppro->SetCurrentStatus(ID_STATUS_OFFLINE); - EndDialog(hwndDlg, IDCANCEL); - break; - } + case IDCANCEL: + ppro->SetCurrentStatus(ID_STATUS_OFFLINE); + EndDialog(hwndDlg, IDCANCEL); + break; } break; } diff --git a/protocols/IcqOscarJ/src/globals.h b/protocols/IcqOscarJ/src/globals.h index f179110030..ff421db79f 100644 --- a/protocols/IcqOscarJ/src/globals.h +++ b/protocols/IcqOscarJ/src/globals.h @@ -38,9 +38,8 @@ typedef char uid_str[MAX_PATH]; extern HINSTANCE hInst; extern DWORD MIRANDA_VERSION; -extern HANDLE hExtraXStatus; - -extern IcqIconHandle hStaticIcons[]; +extern HANDLE hExtraXStatus; +extern IconItem g_IconsList[]; extern const int moodXStatus[]; diff --git a/protocols/IcqOscarJ/src/iconlib.cpp b/protocols/IcqOscarJ/src/iconlib.cpp deleted file mode 100644 index baf4793114..0000000000 --- a/protocols/IcqOscarJ/src/iconlib.cpp +++ /dev/null @@ -1,91 +0,0 @@ -// ---------------------------------------------------------------------------80 -// ICQ plugin for Miranda Instant Messenger -// ________________________________________ -// -// Copyright © 2000-2001 Richard Hughes, Roland Rabien, Tristan Van de Vreede -// Copyright © 2001-2002 Jon Keating, Richard Hughes -// Copyright © 2002-2004 Martin Öberg, Sam Kothari, Robert Rainwater -// Copyright © 2004-2010 Joe Kucera -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// ----------------------------------------------------------------------------- -// DESCRIPTION: -// -// Support for IcoLib plug-in -// -// ----------------------------------------------------------------------------- -#include "icqoscar.h" -#include "m_icolib.h" - -IcqIconHandle IconLibDefine(const char *desc, const char *section, const char *module, const char *ident, const TCHAR *def_file, int def_idx) -{ - SKINICONDESC sid = { sizeof(sid) }; - sid.pwszSection = make_unicode_string(section); - sid.pwszDescription = make_unicode_string(desc); - sid.flags = SIDF_ALL_TCHAR; - - char szName[MAX_PATH + 128]; - null_snprintf(szName, sizeof(szName), "%s_%s", module ? module : ICQ_PROTOCOL_NAME, ident); - sid.pszName = szName; - sid.ptszDefaultFile = (TCHAR*)def_file; - sid.iDefaultIndex = def_idx; - - IcqIconHandle hIcon = (IcqIconHandle)SAFE_MALLOC(sizeof(IcqIconHandle_s)); - hIcon->szName = null_strdup(sid.pszName); - hIcon->hIcoLib = Skin_AddIcon(&sid); - - SAFE_FREE(&sid.pwszSection); - SAFE_FREE(&sid.pwszDescription); - - return hIcon; -} - - -void IconLibRemove(IcqIconHandle *phIcon) -{ - if (phIcon && *phIcon) - { - IcqIconHandle hIcon = *phIcon; - - CallService(MS_SKIN2_REMOVEICON, 0, (LPARAM)hIcon->szName); - SAFE_FREE(&hIcon->szName); - SAFE_FREE((void**)phIcon); - } -} - - -HANDLE IcqIconHandle_s::Handle() -{ - if (this) - return hIcoLib; - - return NULL; -} - - -HICON IcqIconHandle_s::GetIcon(bool big) -{ - if (this) - return Skin_GetIconByHandle(hIcoLib, big); - - return NULL; -} - -void IcqIconHandle_s::ReleaseIcon(bool big) -{ - Skin_ReleaseIcon(szName, big); -} - diff --git a/protocols/IcqOscarJ/src/iconlib.h b/protocols/IcqOscarJ/src/iconlib.h deleted file mode 100644 index 3a7482f872..0000000000 --- a/protocols/IcqOscarJ/src/iconlib.h +++ /dev/null @@ -1,52 +0,0 @@ -// ---------------------------------------------------------------------------80 -// ICQ plugin for Miranda Instant Messenger -// ________________________________________ -// -// Copyright © 2000-2001 Richard Hughes, Roland Rabien, Tristan Van de Vreede -// Copyright © 2001-2002 Jon Keating, Richard Hughes -// Copyright © 2002-2004 Martin Öberg, Sam Kothari, Robert Rainwater -// Copyright © 2004-2009 Joe Kucera -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// -// ----------------------------------------------------------------------------- -// DESCRIPTION: -// -// Headers for IconLib Plugin / module support -// -// ----------------------------------------------------------------------------- -#ifndef __ICONLIB_H -#define __ICONLIB_H - - -struct IcqIconHandle_s -{ - char *szName; - HANDLE hIcoLib; - - HANDLE Handle(); - HICON GetIcon(bool big = false); - void ReleaseIcon(bool big = false); -}; - -typedef IcqIconHandle_s *IcqIconHandle; - - -IcqIconHandle IconLibDefine(const char *desc, const char *section, const char *module, const char *ident, const TCHAR *def_file, int def_idx); -void IconLibRemove(IcqIconHandle *phIcon); - - - -#endif /* __ICONLIB_H */ diff --git a/protocols/IcqOscarJ/src/icq_firstrun.cpp b/protocols/IcqOscarJ/src/icq_firstrun.cpp index 1208d6d0ec..a80557cba4 100644 --- a/protocols/IcqOscarJ/src/icq_firstrun.cpp +++ b/protocols/IcqOscarJ/src/icq_firstrun.cpp @@ -56,19 +56,18 @@ INT_PTR CALLBACK icq_FirstRunDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR ppro = (CIcqProto*)lParam; SetWindowLongPtr( hwndDlg, GWLP_USERDATA, lParam ); - { - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)ppro->m_hIconProtocol->GetIcon(true)); - SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)ppro->m_hIconProtocol->GetIcon()); - SendDlgItemMessage(hwndDlg, IDC_PW, EM_LIMITTEXT, PASSWORDMAXLEN - 1, 0); + SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)Skin_GetIconByHandle(ppro->m_hIconProtocol, true)); + SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)Skin_GetIconByHandle(ppro->m_hIconProtocol)); + + SendDlgItemMessage(hwndDlg, IDC_PW, EM_LIMITTEXT, PASSWORDMAXLEN - 1, 0); - accountLoadDetails(ppro, hwndDlg); - } + accountLoadDetails(ppro, hwndDlg); return TRUE; case WM_DESTROY: - ppro->m_hIconProtocol->ReleaseIcon(true); - ppro->m_hIconProtocol->ReleaseIcon(); + Skin_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_BIG, 0)); + Skin_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_SMALL, 0)); break; case WM_CLOSE: diff --git a/protocols/IcqOscarJ/src/icq_menu.cpp b/protocols/IcqOscarJ/src/icq_menu.cpp index ae012d26a5..c15f1526be 100644 --- a/protocols/IcqOscarJ/src/icq_menu.cpp +++ b/protocols/IcqOscarJ/src/icq_menu.cpp @@ -132,7 +132,7 @@ void g_MenuInit(void) // "Request authorization" mi.pszName = LPGEN("Request authorization"); mi.position = 1000030000; - mi.icolibItem = hStaticIcons[ISI_AUTH_REQUEST]->Handle(); + mi.icolibItem = g_IconsList[ISI_AUTH_REQUEST].hIcolib; strcpy(pszDest, MS_REQ_AUTH); g_hContactMenuItems[ICMI_AUTH_REQUEST] = Menu_AddContactMenuItem(&mi); g_hContactMenuSvc[ICMI_AUTH_REQUEST] = CreateServiceFunction( str, IcqMenuHandleRequestAuth ); @@ -140,7 +140,7 @@ void g_MenuInit(void) // "Grant authorization" mi.pszName = LPGEN("Grant authorization"); mi.position = 1000029999; - mi.icolibItem = hStaticIcons[ISI_AUTH_GRANT]->Handle(); + mi.icolibItem = g_IconsList[ISI_AUTH_GRANT].hIcolib; strcpy(pszDest, MS_GRANT_AUTH); g_hContactMenuItems[ICMI_AUTH_GRANT] = Menu_AddContactMenuItem(&mi); g_hContactMenuSvc[ICMI_AUTH_GRANT] = CreateServiceFunction(mi.pszService, IcqMenuHandleGrantAuth); @@ -148,7 +148,7 @@ void g_MenuInit(void) // "Revoke authorization" mi.pszName = LPGEN("Revoke authorization"); mi.position = 1000029998; - mi.icolibItem = hStaticIcons[ISI_AUTH_REVOKE]->Handle(); + mi.icolibItem = g_IconsList[ISI_AUTH_REVOKE].hIcolib; strcpy(pszDest, MS_REVOKE_AUTH); g_hContactMenuItems[ICMI_AUTH_REVOKE] = Menu_AddContactMenuItem(&mi); g_hContactMenuSvc[ICMI_AUTH_REVOKE] = CreateServiceFunction(mi.pszService, IcqMenuHandleRevokeAuth); @@ -156,7 +156,7 @@ void g_MenuInit(void) // "Add to server list" mi.pszName = LPGEN("Add to server list"); mi.position = -2049999999; - mi.icolibItem = hStaticIcons[ISI_ADD_TO_SERVLIST]->Handle(); + mi.icolibItem = g_IconsList[ISI_ADD_TO_SERVLIST].hIcolib; strcpy(pszDest, MS_ICQ_ADDSERVCONTACT); g_hContactMenuItems[ICMI_ADD_TO_SERVLIST] = Menu_AddContactMenuItem(&mi); g_hContactMenuSvc[ICMI_ADD_TO_SERVLIST] = CreateServiceFunction(mi.pszService, IcqMenuHandleAddServContact); diff --git a/protocols/IcqOscarJ/src/icq_popups.cpp b/protocols/IcqOscarJ/src/icq_popups.cpp index 21ca36348d..1420cd4365 100644 --- a/protocols/IcqOscarJ/src/icq_popups.cpp +++ b/protocols/IcqOscarJ/src/icq_popups.cpp @@ -259,7 +259,7 @@ int CIcqProto::ShowPopUpMsg(HANDLE hContact, const char *szTitle, const char *sz return -1; } if (!getSettingByte(NULL, "PopupsSysIcons", DEFAULT_POPUPS_SYS_ICONS)) - ppd.lchIcon = m_hIconProtocol->GetIcon(); + ppd.lchIcon = Skin_GetIconByHandle(m_hIconProtocol); else ppd.lchIcon = (HICON)LoadImage( NULL, rsIcon, IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED); if (getSettingByte(NULL, "PopupsWinColors", DEFAULT_POPUPS_WIN_COLORS)) diff --git a/protocols/IcqOscarJ/src/icq_proto.cpp b/protocols/IcqOscarJ/src/icq_proto.cpp index 50771cb011..2b8293ef0a 100644 --- a/protocols/IcqOscarJ/src/icq_proto.cpp +++ b/protocols/IcqOscarJ/src/icq_proto.cpp @@ -164,17 +164,10 @@ cheekySearchId( -1 ) // Custom caps CreateProtoService(PS_ICQ_ADDCAPABILITY, &CIcqProto::IcqAddCapability); CreateProtoService(PS_ICQ_CHECKCAPABILITY, &CIcqProto::IcqCheckCapability); - { - // Initialize IconLib icons - char szSectionName[MAX_PATH], *szAccountName = tchar_to_utf8(m_tszUserName); - null_snprintf(szSectionName, sizeof(szSectionName), "Protocols/%s/Accounts", ICQ_PROTOCOL_NAME); - - TCHAR lib[MAX_PATH]; - GetModuleFileName(hInst, lib, MAX_PATH); - m_hIconProtocol = IconLibDefine(szAccountName, szSectionName, m_szModuleName, "main", lib, -IDI_ICQ); - SAFE_FREE(&szAccountName); - } + IconItemT protoIcon = { m_tszUserName, "main", IDI_ICQ }; + Icon_RegisterT(hInst, _T("Protocols/ICQ/Accounts"), &protoIcon, 1, m_szModuleName); + m_hIconProtocol = protoIcon.hIcolib; // Reset a bunch of session specific settings UpdateGlobalSettings(); @@ -281,7 +274,7 @@ CIcqProto::~CIcqProto() SAFE_FREE(&m_modeMsgs.szFfc); // Remove account icons - IconLibRemove(&m_hIconProtocol); + Skin_RemoveIconHandle(m_hIconProtocol); NetLog_Server("%s: Protocol instance '%s' destroyed.", ICQ_PROTOCOL_NAME, m_szModuleName); @@ -804,18 +797,17 @@ HICON __cdecl CIcqProto::GetIcon( int iconIndex ) if (LOWORD(iconIndex) == PLI_PROTOCOL) { if (iconIndex & PLIF_ICOLIBHANDLE) - return (HICON)m_hIconProtocol->Handle(); + return (HICON)m_hIconProtocol; bool big = (iconIndex & PLIF_SMALL) == 0; - HICON hIcon = m_hIconProtocol->GetIcon(big); + HICON hIcon = Skin_GetIconByHandle(m_hIconProtocol, big); if (iconIndex & PLIF_ICOLIB) return hIcon; - hIcon = CopyIcon(hIcon); - m_hIconProtocol->ReleaseIcon(big); - return hIcon; - + HICON hIconNew = CopyIcon(hIcon); + Skin_ReleaseIcon(hIcon); + return hIconNew; } return NULL; } diff --git a/protocols/IcqOscarJ/src/icq_proto.h b/protocols/IcqOscarJ/src/icq_proto.h index 2c0d1a12ae..28a005dfe6 100644 --- a/protocols/IcqOscarJ/src/icq_proto.h +++ b/protocols/IcqOscarJ/src/icq_proto.h @@ -153,7 +153,7 @@ struct CIcqProto : public PROTO_INTERFACE, public MZeroedObject int __cdecl OnPreBuildStatusMenu( WPARAM, LPARAM ); //====| Data |======================================================================== - IcqIconHandle m_hIconProtocol; + HANDLE m_hIconProtocol; HANDLE m_hServerNetlibUser, m_hDirectNetlibUser; BYTE m_bGatewayMode; diff --git a/protocols/IcqOscarJ/src/icq_xstatus.cpp b/protocols/IcqOscarJ/src/icq_xstatus.cpp index 11a9f782ad..d62a5f1f5b 100644 --- a/protocols/IcqOscarJ/src/icq_xstatus.cpp +++ b/protocols/IcqOscarJ/src/icq_xstatus.cpp @@ -34,9 +34,9 @@ void CListShowMenuItem(HANDLE hMenuItem, BYTE bShow); -static IcqIconHandle hXStatusIcons[XSTATUS_COUNT]; -static int hXStatusCListIcons[XSTATUS_COUNT]; -static BOOL bXStatusCListIconsValid[XSTATUS_COUNT]; +static HANDLE hXStatusIcons[XSTATUS_COUNT]; +static int hXStatusCListIcons[XSTATUS_COUNT]; +static BOOL bXStatusCListIconsValid[XSTATUS_COUNT]; int OnReloadIcons(WPARAM wParam, LPARAM lParam) { @@ -166,23 +166,14 @@ HICON CIcqProto::getXStatusIcon(int bStatus, UINT flags) HICON icon = NULL; if (bStatus > 0 && bStatus <= XSTATUS_COUNT) - icon = hXStatusIcons[bStatus - 1]->GetIcon((flags & LR_BIGICON) != 0); + icon = Skin_GetIconByHandle(hXStatusIcons[bStatus-1], (flags & LR_BIGICON) != 0); return (flags & LR_SHARED || !icon) ? icon : CopyIcon(icon); } -void releaseXStatusIcon(int bStatus, UINT flags) -{ - if (bStatus > 0 && bStatus <= XSTATUS_COUNT) { - IcqIconHandle p = hXStatusIcons[bStatus - 1]; - if (p) - p->ReleaseIcon((flags & LR_BIGICON) != 0); - } -} - void setContactExtraIcon(HANDLE hContact, int xstatus) { - ExtraIcon_SetIcon(hExtraXStatus, hContact, (xstatus > 0) ? hXStatusIcons[xstatus-1]->Handle() : NULL); + ExtraIcon_SetIcon(hExtraXStatus, hContact, (xstatus > 0) ? hXStatusIcons[xstatus-1] : NULL); } #define NULLCAP {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} @@ -767,8 +758,8 @@ static INT_PTR CALLBACK SetXStatusDlgProc(HWND hwndDlg,UINT message,WPARAM wPara SAFE_FREE(&szValue); if (dat->bXStatus) { - releaseXStatusIcon(dat->bXStatus, LR_BIGICON); - releaseXStatusIcon(dat->bXStatus, 0); + Skin_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_BIG, 0)); + Skin_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_SMALL, 0)); } } dat->ppro->updateServerCustomStatus(TRUE); @@ -891,7 +882,7 @@ void CIcqProto::InitXStatusItems(BOOL bAllowStatus) CreateProtoServiceParam(srvFce+len, &CIcqProto::menuXStatus, i); mi.flags = (i ? CMIF_ICONFROMICOLIB : 0) | (bXStatus == i?CMIF_CHECKED:0); - mi.icolibItem = i ? hXStatusIcons[i-1]->Handle() : NULL; + mi.icolibItem = i ? hXStatusIcons[i-1] : NULL; mi.pszName = i ? (char*)nameXStatus[i-1] : (char *)LPGEN("None"); mi.pszService = srvFce; mi.pszContactOwner = m_szModuleName; @@ -906,16 +897,19 @@ void CIcqProto::InitXStatusItems(BOOL bAllowStatus) void InitXStatusIcons() { TCHAR lib[2*MAX_PATH] = {0}; - TCHAR *icon_lib = InitXStatusIconLibrary(lib, SIZEOF(lib)); - char szSection[MAX_PATH + 64]; - null_snprintf(szSection, sizeof(szSection), "Protocols/ICQ/Custom Status"); + SKINICONDESC sid = { sizeof(sid) }; + sid.pszSection = "Protocols/" ICQ_PROTOCOL_NAME "/Custom Status"; + sid.flags = SIDF_PATH_TCHAR; + sid.ptszDefaultFile = InitXStatusIconLibrary(lib, SIZEOF(lib)); for (int i = 0; i < XSTATUS_COUNT; i++) { - char szTemp[64]; - - null_snprintf(szTemp, sizeof(szTemp), "xstatus%d", i); - hXStatusIcons[i] = IconLibDefine(nameXStatus[i], szSection, "icq", szTemp, icon_lib, -(IDI_XSTATUS1+i)); + char szTemp[100]; + null_snprintf(szTemp, sizeof(szTemp), "icq_xstatus%d", i); + sid.pszName = szTemp; + sid.pszDescription = (LPSTR)nameXStatus[i]; + sid.iDefaultIndex = -(IDI_XSTATUS1+i); + hXStatusIcons[i] = Skin_AddIcon(&sid); } // initialize arrays for CList custom status icons @@ -923,16 +917,6 @@ void InitXStatusIcons() memset(hXStatusCListIcons, -1, sizeof(hXStatusCListIcons)); } -void UninitXStatusIcons() -{ - for (int i = 0; i < XSTATUS_COUNT; i++) - IconLibRemove(&hXStatusIcons[i]); - - // clear clist icon state indicators - memset(bXStatusCListIconsValid, 0, sizeof(bXStatusCListIconsValid)); -} - - INT_PTR CIcqProto::ShowXStatusDetails(WPARAM wParam, LPARAM lParam) { InitXStatusData init; @@ -1149,7 +1133,7 @@ INT_PTR CIcqProto::RequestAdvStatusIconIdx(WPARAM wParam, LPARAM lParam) // mark icon index in the array as valid bXStatusCListIconsValid[bXStatus-1] = TRUE; - releaseXStatusIcon(bXStatus, 0); + Skin_ReleaseIcon(hXStatusIcon); } } diff --git a/protocols/IcqOscarJ/src/icqoscar.h b/protocols/IcqOscarJ/src/icqoscar.h index 92ed19550b..52c9d1d117 100644 --- a/protocols/IcqOscarJ/src/icqoscar.h +++ b/protocols/IcqOscarJ/src/icqoscar.h @@ -88,6 +88,7 @@ #include #include #include +#include #include #include #include @@ -97,7 +98,6 @@ // ICQ plugin includes #include "version.h" -#include "iconlib.h" #include "globals.h" #include "i18n.h" #include "icq_db.h" diff --git a/protocols/IcqOscarJ/src/init.cpp b/protocols/IcqOscarJ/src/init.cpp index ef2c5ea8f8..5271be4849 100644 --- a/protocols/IcqOscarJ/src/init.cpp +++ b/protocols/IcqOscarJ/src/init.cpp @@ -36,8 +36,7 @@ HINSTANCE hInst; int hLangpack; CLIST_INTERFACE *pcli; -IcqIconHandle hStaticIcons[4]; -HANDLE hExtraXStatus; +HANDLE hExtraXStatus; PLUGININFOEX pluginInfo = { sizeof(PLUGININFOEX), @@ -81,6 +80,14 @@ static int icqProtoUninit( PROTO_INTERFACE* ppro ) return 0; } +IconItem g_IconsList[4] = +{ + { LPGEN("Request authorization"), "req_auth", IDI_AUTH_ASK }, + { LPGEN("Grant authorization"), "grant_auth", IDI_AUTH_GRANT }, + { LPGEN("Revoke authorization"), "revoke_auth", IDI_AUTH_REVOKE }, + { LPGEN("Add to server list"), "add_to_server", IDI_SERVLIST_ADD } +}; + extern "C" int __declspec(dllexport) Load(void) { mir_getLP( &pluginInfo ); @@ -105,15 +112,7 @@ extern "C" int __declspec(dllexport) Load(void) CreateServiceFunction(ICQ_DB_GETEVENTTEXT_MISSEDMESSAGE, icq_getEventTextMissedMessage); // Define global icons - char szSectionName[MAX_PATH]; - null_snprintf(szSectionName, sizeof(szSectionName), "Protocols/%s", ICQ_PROTOCOL_NAME); - - TCHAR lib[MAX_PATH]; - GetModuleFileName(hInst, lib, MAX_PATH); - hStaticIcons[ISI_AUTH_REQUEST] = IconLibDefine(LPGEN("Request authorization"), szSectionName, NULL, "req_auth", lib, -IDI_AUTH_ASK); - hStaticIcons[ISI_AUTH_GRANT] = IconLibDefine(LPGEN("Grant authorization"), szSectionName, NULL, "grant_auth", lib, -IDI_AUTH_GRANT); - hStaticIcons[ISI_AUTH_REVOKE] = IconLibDefine(LPGEN("Revoke authorization"), szSectionName, NULL, "revoke_auth", lib, -IDI_AUTH_REVOKE); - hStaticIcons[ISI_ADD_TO_SERVLIST] = IconLibDefine(LPGEN("Add to server list"), szSectionName, NULL, "add_to_server", lib, -IDI_SERVLIST_ADD); + Icon_Register(hInst, "Protocols", g_IconsList, SIZEOF(g_IconsList), ICQ_PROTOCOL_NAME); // Init extra statuses InitXStatusIcons(); @@ -128,15 +127,9 @@ extern "C" int __declspec(dllexport) Load(void) extern "C" int __declspec(dllexport) Unload(void) { - // Release static icon handles - for (int i = 0; i < SIZEOF(hStaticIcons); i++) - IconLibRemove(&hStaticIcons[i]); - // destroying contact menu g_MenuUninit(); - UninitXStatusIcons(); - g_Instances.destroy(); return 0; } diff --git a/protocols/IcqOscarJ/src/utilities.h b/protocols/IcqOscarJ/src/utilities.h index b83f4c1c8a..fe01ea8c34 100644 --- a/protocols/IcqOscarJ/src/utilities.h +++ b/protocols/IcqOscarJ/src/utilities.h @@ -186,7 +186,6 @@ int ListBoxAddStringUtf(HWND hList, const char *szString); int MessageBoxUtf(HWND hWnd, const char *szText, const char *szCaption, UINT uType); void InitXStatusIcons(); -void UninitXStatusIcons(); void setContactExtraIcon(HANDLE hContact, int xstatus); int OnReloadIcons(WPARAM wParam, LPARAM lParam); -- cgit v1.2.3