diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2015-09-13 09:59:50 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2015-09-13 09:59:50 +0000 |
commit | 5d2ff1117e800b1fb31e3eafb5769c4499ec30a1 (patch) | |
tree | 389a5912b866fba5712ed4da50e659f92f686d48 /protocols/SkypeWeb | |
parent | 68ff208f0ed66fe1873c10d215f54e89ec309611 (diff) |
SkypeWeb: correct icon handling
git-svn-id: http://svn.miranda-ng.org/main/trunk@15341 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/SkypeWeb')
-rw-r--r-- | protocols/SkypeWeb/src/main.cpp | 2 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_events.cpp | 4 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_icons.cpp | 47 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_icons.h | 29 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_menus.cpp | 13 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_popups.cpp | 6 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_proto.cpp | 2 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_proto.h | 8 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_trouter.cpp | 2 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/stdafx.h | 2 |
10 files changed, 22 insertions, 93 deletions
diff --git a/protocols/SkypeWeb/src/main.cpp b/protocols/SkypeWeb/src/main.cpp index 732c570d59..de9d3c8164 100644 --- a/protocols/SkypeWeb/src/main.cpp +++ b/protocols/SkypeWeb/src/main.cpp @@ -83,8 +83,6 @@ extern "C" int __declspec(dllexport) Load(void) extern "C" int __declspec(dllexport) Unload(void)
{
- CSkypeProto::UninitIcons();
- CSkypeProto::UninitMenus();
DestroyHookableEvent(g_hCallEvent);
diff --git a/protocols/SkypeWeb/src/skype_events.cpp b/protocols/SkypeWeb/src/skype_events.cpp index 15b9979c2a..a631d734ad 100644 --- a/protocols/SkypeWeb/src/skype_events.cpp +++ b/protocols/SkypeWeb/src/skype_events.cpp @@ -204,12 +204,12 @@ INT_PTR CSkypeProto::EventGetIcon(WPARAM wParam, LPARAM lParam) case SKYPE_DB_EVENT_TYPE_CALL_INFO:
case SKYPE_DB_EVENT_TYPE_INCOMING_CALL:
{
- icon = IcoLib_GetIconByHandle(GetIconHandle("inc_call"));
+ icon = GetIcon(IDI_CALL);
break;
}
case SKYPE_DB_EVENT_TYPE_ACTION:
{
- icon = IcoLib_GetIconByHandle(GetIconHandle("me_action"));
+ icon = GetIcon(IDI_ACTION_ME);
break;
}
case SKYPE_DB_EVENT_TYPE_FILETRANSFER_INFO:
diff --git a/protocols/SkypeWeb/src/skype_icons.cpp b/protocols/SkypeWeb/src/skype_icons.cpp index ee5d6d904a..883a067a1a 100644 --- a/protocols/SkypeWeb/src/skype_icons.cpp +++ b/protocols/SkypeWeb/src/skype_icons.cpp @@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
-IconInfo CSkypeProto::Icons[] =
+IconItemT CSkypeProto::Icons[] =
{
{ LPGENT("Protocol icon"), "main", IDI_SKYPE },
{ LPGENT("Create new chat icon"), "conference", IDI_CONFERENCE },
@@ -32,50 +32,21 @@ IconInfo CSkypeProto::Icons[] = void CSkypeProto::InitIcons()
{
- TCHAR szFile[MAX_PATH];
- GetModuleFileName(g_hInstance, szFile, MAX_PATH);
-
- char szSettingName[100];
- TCHAR szSectionName[100];
-
- SKINICONDESC sid = { 0 };
- sid.flags = SIDF_ALL_TCHAR;
- sid.defaultFile.t = szFile;
- sid.pszName = szSettingName;
- sid.section.t = szSectionName;
-
- mir_sntprintf(szSectionName, _T("%s/%s"), LPGENT("Protocols"), LPGENT(MODULE));
- for (int i = 0; i < _countof(Icons); i++)
- {
- mir_snprintf(szSettingName, "%s_%s", MODULE, Icons[i].Name);
-
- sid.description.t = Icons[i].Description;
- sid.iDefaultIndex = -Icons[i].IconId;
- Icons[i].Handle = IcoLib_AddIcon(&sid);
- }
-
+ Icon_RegisterT(g_hInstance, LPGENT("Protocols") "/" LPGENT(MODULE), Icons, _countof(Icons), MODULE);
}
-HANDLE CSkypeProto::GetIconHandle(const char *name)
+HICON CSkypeProto::GetIcon(int iconId)
{
for (size_t i = 0; i < _countof(Icons); i++)
- if (mir_strcmpi(Icons[i].Name, name) == 0)
- return Icons[i].Handle;
+ if (Icons[i].defIconID == iconId)
+ return IcoLib_GetIconByHandle(Icons[i].hIcolib);
return 0;
}
-HANDLE CSkypeProto::Skin_GetIconHandle(const char *name)
-{
- char iconName[100];
- mir_snprintf(iconName, "%s_%s", MODULE, name);
- HANDLE hIcon = IcoLib_GetIconHandle(iconName);
- if (hIcon == NULL)
- hIcon = GetIconHandle(name);
- return hIcon;
-}
-
-void CSkypeProto::UninitIcons()
+HANDLE CSkypeProto::GetIconHandle(int iconId)
{
for (size_t i = 0; i < _countof(Icons); i++)
- IcoLib_RemoveIcon(Icons[i].Name);
+ if (Icons[i].defIconID == iconId)
+ return Icons[i].hIcolib;
+ return 0;
}
\ No newline at end of file diff --git a/protocols/SkypeWeb/src/skype_icons.h b/protocols/SkypeWeb/src/skype_icons.h deleted file mode 100644 index c3f09fb91d..0000000000 --- a/protocols/SkypeWeb/src/skype_icons.h +++ /dev/null @@ -1,29 +0,0 @@ -/*
-Copyright (c) 2015 Miranda NG project (http://miranda-ng.org)
-
-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 version 2
-of the License.
-
-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, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _SKYPE_ICONS_H_
-#define _SKYPE_ICONS_H_
-
-struct IconInfo
-{
- TCHAR *Description;
- char *Name;
- int IconId;
- HANDLE Handle;
-};
-
-#endif //_SKYPE_ICONS_H_
\ No newline at end of file diff --git a/protocols/SkypeWeb/src/skype_menus.cpp b/protocols/SkypeWeb/src/skype_menus.cpp index e34f8f888d..7e4fb713e6 100644 --- a/protocols/SkypeWeb/src/skype_menus.cpp +++ b/protocols/SkypeWeb/src/skype_menus.cpp @@ -84,7 +84,7 @@ void CSkypeProto::InitMenus() mi.pszService = MODULE"/GetHistory";
mi.name.t = LPGENT("Get server history");
mi.position = CMI_POSITION + CMI_GETSERVERHISTORY;
- mi.hIcolibItem = GetIconHandle("synchistory");
+ mi.hIcolibItem = GetIconHandle(IDI_SYNCHISTORY);
SET_UID(mi, 0xc9a64e98, 0x9257, 0x4b52, 0x98, 0xdd, 0x7f, 0x56, 0xb3, 0x90, 0xe3, 0xde);
ContactMenuItems[CMI_GETSERVERHISTORY] = Menu_AddContactMenuItem(&mi);
CreateServiceFunction(mi.pszService, GlobalService<&CSkypeProto::GetContactHistory>);
@@ -92,7 +92,7 @@ void CSkypeProto::InitMenus() mi.pszService = MODULE"/BlockContact";
mi.name.t = LPGENT("Block contact");
mi.position = CMI_POSITION + CMI_BLOCK;
- mi.hIcolibItem = GetIconHandle("user_block");
+ mi.hIcolibItem = GetIconHandle(IDI_BLOCKUSER);
SET_UID(mi ,0xc6169b8f, 0x53ab, 0x4242, 0xbe, 0x90, 0xe2, 0x4a, 0xa5, 0x73, 0x88, 0x32);
ContactMenuItems[CMI_BLOCK] = Menu_AddContactMenuItem(&mi);
CreateServiceFunction(mi.pszService, GlobalService<&CSkypeProto::BlockContact>);
@@ -100,17 +100,12 @@ void CSkypeProto::InitMenus() mi.pszService = MODULE"/UnblockContact";
mi.name.t = LPGENT("Unblock contact");
mi.position = CMI_POSITION + CMI_UNBLOCK;
- mi.hIcolibItem = GetIconHandle("user_unblock");
+ mi.hIcolibItem = GetIconHandle(IDI_UNBLOCKUSER);
SET_UID(mi, 0x88542f43, 0x7448, 0x48d0, 0x81, 0xa3, 0x26, 0x0, 0x4f, 0x37, 0xee, 0xe0);
ContactMenuItems[CMI_UNBLOCK] = Menu_AddContactMenuItem(&mi);
CreateServiceFunction(mi.pszService, GlobalService<&CSkypeProto::UnblockContact>);
}
-void CSkypeProto::UninitMenus()
-{
-}
-
-
int CSkypeProto::OnInitStatusMenu()
{
CMenuItem mi;
@@ -120,7 +115,7 @@ int CSkypeProto::OnInitStatusMenu() CreateProtoService(mi.pszService, &CSkypeProto::SvcCreateChat);
mi.name.a = LPGEN("Create new chat");
mi.position = SMI_POSITION + SMI_CREATECHAT;
- mi.hIcolibItem = GetIconHandle("conference");
+ mi.hIcolibItem = GetIconHandle(IDI_CONFERENCE);
Menu_AddProtoMenuItem(&mi, m_szModuleName);
return 0;
}
\ No newline at end of file diff --git a/protocols/SkypeWeb/src/skype_popups.cpp b/protocols/SkypeWeb/src/skype_popups.cpp index 52646ecb98..0ca5aab40b 100644 --- a/protocols/SkypeWeb/src/skype_popups.cpp +++ b/protocols/SkypeWeb/src/skype_popups.cpp @@ -11,7 +11,7 @@ void CSkypeProto::InitPopups() mir_snprintf(name, "%s_%s", m_szModuleName, "Notification");
ppc.ptszDescription = desc;
ppc.pszName = name;
- ppc.hIcon = IcoLib_GetIconByHandle(GetIconHandle("notify"));
+ ppc.hIcon = GetIcon(IDI_NOTIFY);
ppc.colorBack = RGB(255, 255, 255);
ppc.colorText = RGB(0, 0, 0);
ppc.iSeconds = 5;
@@ -21,7 +21,7 @@ void CSkypeProto::InitPopups() mir_snprintf(name, "%s_%s", m_szModuleName, "Error");
ppc.ptszDescription = desc;
ppc.pszName = name;
- ppc.hIcon = IcoLib_GetIconByHandle(GetIconHandle("error"));
+ ppc.hIcon = GetIcon(IDI_ERRORICON);
ppc.colorBack = RGB(255, 255, 255);
ppc.colorText = RGB(0, 0, 0);
ppc.iSeconds = -1;
@@ -31,7 +31,7 @@ void CSkypeProto::InitPopups() mir_snprintf(name, "%s_%s", m_szModuleName, "Call");
ppc.ptszDescription = desc;
ppc.pszName = name;
- ppc.hIcon = IcoLib_GetIconByHandle(GetIconHandle("inc_call"));
+ ppc.hIcon = GetIcon(IDI_CALL);
ppc.colorBack = RGB(255, 255, 255);
ppc.colorText = RGB(0, 0, 0);
ppc.iSeconds = 30;
diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index d2eeaf0b68..d8b5c823b4 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -24,8 +24,6 @@ CSkypeProto::CSkypeProto(const char* protoName, const TCHAR* userName) : m_GCCreateDialogs(1),
m_OutMessages(3, PtrKeySortT)
{
- m_hProtoIcon = Icons[0].Handle;
-
InitNetwork();
requestQueue = new RequestQueue(m_hNetlibUser);
diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index 491f93eadb..2edf1a3ac4 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -59,11 +59,9 @@ public: // icons
static void InitIcons();
- static void UninitIcons();
// menus
static void InitMenus();
- static void UninitMenus();
//popups
void InitPopups();
@@ -162,9 +160,9 @@ private: void SendRequest(HttpRequest *request, SkypeResponseWithArgCallback response, void *arg);
// icons
- static IconInfo Icons[];
- static HANDLE GetIconHandle(const char *name);
- static HANDLE Skin_GetIconHandle(const char *name);
+ static IconItemT Icons[];
+ static HICON GetIcon(int iconId);
+ static HANDLE GetIconHandle(int iconId);
// menus
static HGENMENU ContactMenuItems[CMI_MAX];
diff --git a/protocols/SkypeWeb/src/skype_trouter.cpp b/protocols/SkypeWeb/src/skype_trouter.cpp index d2bde973d0..d53ce95b0f 100644 --- a/protocols/SkypeWeb/src/skype_trouter.cpp +++ b/protocols/SkypeWeb/src/skype_trouter.cpp @@ -204,7 +204,7 @@ void CSkypeProto::OnTrouterEvent(const JSONNode &body, const JSONNode &) cle.hContact = hContact;
cle.hDbEvent = hEvent;
cle.lParam = SKYPE_DB_EVENT_TYPE_INCOMING_CALL;
- cle.hIcon = IcoLib_GetIconByHandle(GetIconHandle("inc_call"));
+ cle.hIcon = GetIcon(IDI_CALL);
CMStringA service(FORMAT, "%s/IncomingCallCLE", GetContactProto(hContact));
cle.pszService = service.GetBuffer();
diff --git a/protocols/SkypeWeb/src/stdafx.h b/protocols/SkypeWeb/src/stdafx.h index 6c4329b524..3cd549bc7e 100644 --- a/protocols/SkypeWeb/src/stdafx.h +++ b/protocols/SkypeWeb/src/stdafx.h @@ -101,13 +101,11 @@ struct MessageId #include "version.h"
#include "resource.h"
-#include "skype_icons.h"
#include "skype_menus.h"
#include "skype_dialogs.h"
#include "skype_options.h"
#include "skype_trouter.h"
#include "skype_db.h"
-//#include "skype_chatrooms.h"
#include "skype_utils.h"
#include "http_request.h"
#include "requests\login.h"
|