diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2015-09-13 09:25:50 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2015-09-13 09:25:50 +0000 |
commit | 437b5d6ab1333635cf5ba38e2d9e639448ab34bc (patch) | |
tree | 797b0149e6906fa8872ec6eb13884de5481ee79c /protocols | |
parent | f5584d8ae977f278ae9735f53ab868c8574c2451 (diff) |
Tox: removed useless own bicycle
git-svn-id: http://svn.miranda-ng.org/main/trunk@15339 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/Tox/src/tox.cpp | 5 | ||||
-rw-r--r-- | protocols/Tox/src/tox_events.cpp | 2 | ||||
-rw-r--r-- | protocols/Tox/src/tox_icons.cpp | 56 | ||||
-rw-r--r-- | protocols/Tox/src/tox_menus.cpp | 8 | ||||
-rw-r--r-- | protocols/Tox/src/tox_multimedia.cpp | 2 | ||||
-rw-r--r-- | protocols/Tox/src/tox_proto.h | 8 |
6 files changed, 10 insertions, 71 deletions
diff --git a/protocols/Tox/src/tox.cpp b/protocols/Tox/src/tox.cpp index 3643149fbd..5e45668519 100644 --- a/protocols/Tox/src/tox.cpp +++ b/protocols/Tox/src/tox.cpp @@ -58,13 +58,8 @@ extern "C" int __declspec(dllexport) Load(void) extern "C" int __declspec(dllexport) Unload(void)
{
- CToxProto::UninitIcons();
- CToxProto::UninitMenus();
-
if (g_hToxLibrary)
- {
FreeLibrary(g_hToxLibrary);
- }
return 0;
}
\ No newline at end of file diff --git a/protocols/Tox/src/tox_events.cpp b/protocols/Tox/src/tox_events.cpp index e667bd8bd6..80ddf9b809 100644 --- a/protocols/Tox/src/tox_events.cpp +++ b/protocols/Tox/src/tox_events.cpp @@ -28,6 +28,6 @@ void CToxProto::InitCustomDbEvents() dbEventType.eventType = DB_EVENT_CALL;
dbEventType.descr = Translate("Call");
- dbEventType.eventIcon = GetIconHandle("audio_start");
+ dbEventType.eventIcon = GetIconHandle(IDI_AUDIO_START);
CallService(MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&dbEventType);
}
\ No newline at end of file diff --git a/protocols/Tox/src/tox_icons.cpp b/protocols/Tox/src/tox_icons.cpp index 756fc13bad..d049880361 100644 --- a/protocols/Tox/src/tox_icons.cpp +++ b/protocols/Tox/src/tox_icons.cpp @@ -1,6 +1,6 @@ #include "stdafx.h"
-IconInfo CToxProto::Icons[] =
+IconItemT CToxProto::Icons[] =
{
{ LPGENT("Protocol icon"), "main", IDI_TOX },
{ LPGENT("Audio call"), "audio_call", IDI_AUDIO_CALL },
@@ -11,60 +11,14 @@ IconInfo CToxProto::Icons[] = void CToxProto::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);
- }
-}
-
-HICON CToxProto::GetIcon(const char *name, bool size)
-{
- for (size_t i = 0; i < _countof(Icons); i++)
- if (mir_strcmpi(Icons[i].Name, name) == 0)
- return IcoLib_GetIconByHandle(Icons[i].Handle, size);
-
- return NULL;
+ Icon_RegisterT(g_hInstance, LPGENT("Protocols") "/" LPGENT(MODULE), Icons, _countof(Icons), MODULE);
}
-HANDLE CToxProto::GetIconHandle(const char *name)
+HANDLE CToxProto::GetIconHandle(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 Icons[i].hIcolib;
return NULL;
-}
-
-HANDLE CToxProto::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 CToxProto::UninitIcons()
-{
- for (size_t i = 0; i < _countof(Icons); i++)
- IcoLib_RemoveIcon(Icons[i].Name);
}
\ No newline at end of file diff --git a/protocols/Tox/src/tox_menus.cpp b/protocols/Tox/src/tox_menus.cpp index 1bf262ae60..6da8d1bc93 100644 --- a/protocols/Tox/src/tox_menus.cpp +++ b/protocols/Tox/src/tox_menus.cpp @@ -39,8 +39,6 @@ void CToxProto::InitMenus() {
HookEvent(ME_CLIST_PREBUILDCONTACTMENU, &CToxProto::PrebuildContactMenu);
- //hChooserMenu = Menu_AddObject("SkypeAccountChooser", LPGEN("Skype menu chooser"), 0, "Skype/MenuChoose");
-
CMenuItem mi;
mi.flags = CMIF_TCHAR;
@@ -67,15 +65,11 @@ void CToxProto::InitMenus() mi.pszService = MODULE"/Audio/Call";
mi.name.t = LPGENT("Call");
mi.position = -2000020000 + CMI_AUDIO_CALL;
- mi.hIcolibItem = GetIconHandle("audio_start");
+ mi.hIcolibItem = GetIconHandle(IDI_AUDIO_START);
ContactMenuItems[CMI_AUDIO_CALL] = Menu_AddContactMenuItem(&mi);
CreateServiceFunction(mi.pszService, GlobalService<&CToxProto::OnSendAudioCall>);
}
-void CToxProto::UninitMenus()
-{
-}
-
int CToxProto::OnInitStatusMenu()
{
CMenuItem mi;
diff --git a/protocols/Tox/src/tox_multimedia.cpp b/protocols/Tox/src/tox_multimedia.cpp index 2bdbb34a49..2479f4ba95 100644 --- a/protocols/Tox/src/tox_multimedia.cpp +++ b/protocols/Tox/src/tox_multimedia.cpp @@ -314,7 +314,7 @@ INT_PTR CToxProto::OnRecvAudioCall(WPARAM hContact, LPARAM lParam) cle.hContact = hContact;
cle.hDbEvent = hEvent;
cle.lParam = DB_EVENT_CALL;
- cle.hIcon = IcoLib_GetIconByHandle(GetIconHandle("audio_ring"));
+ cle.hIcon = IcoLib_GetIconByHandle(GetIconHandle(IDI_AUDIO_RING));
TCHAR szTooltip[MAX_PATH];
mir_sntprintf(szTooltip, TranslateT("Incoming call from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
diff --git a/protocols/Tox/src/tox_proto.h b/protocols/Tox/src/tox_proto.h index 5c42073af0..f465dcd713 100644 --- a/protocols/Tox/src/tox_proto.h +++ b/protocols/Tox/src/tox_proto.h @@ -72,11 +72,9 @@ public: // icons
static void InitIcons();
- static void UninitIcons();
// menus
static void InitMenus();
- static void UninitMenus();
// events
void InitCustomDbEvents();
@@ -135,10 +133,8 @@ private: void UninitNetlib();
// icons
- static IconInfo Icons[];
- static HICON GetIcon(const char *name, bool size = false);
- static HANDLE GetIconHandle(const char *name);
- static HANDLE Skin_GetIconHandle(const char *name);
+ static IconItemT Icons[];
+ static HANDLE GetIconHandle(int iconId);
// menus
static HGENMENU ContactMenuItems[CMI_MAX];
|