diff options
author | George Hazan <george.hazan@gmail.com> | 2012-12-02 18:19:49 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-12-02 18:19:49 +0000 |
commit | c4582dd65b444e5dae29ada7cc3f6c9a9c20edf3 (patch) | |
tree | 17a8627550b202d62df8e1df76d2585d3d0cdeaa /src | |
parent | 5ea5feb7e052ca45af7bc9ed76e4a252bd71950d (diff) |
new easy standard way of registering icons: Icon_Register
git-svn-id: http://svn.miranda-ng.org/main/trunk@2601 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r-- | src/core/miranda.h | 1 | ||||
-rw-r--r-- | src/core/stdchat/src/options.cpp | 102 | ||||
-rw-r--r-- | src/core/stdmsg/src/globals.cpp | 37 | ||||
-rw-r--r-- | src/core/stdmsg/src/msglog.cpp | 4 | ||||
-rw-r--r-- | src/core/stdplug.h | 4 | ||||
-rw-r--r-- | src/mir_core/icons.cpp | 77 | ||||
-rw-r--r-- | src/mir_core/mir_core.def | 2 | ||||
-rw-r--r-- | src/mir_core/mir_core_10.vcxproj | 1 | ||||
-rw-r--r-- | src/mir_core/mir_core_10.vcxproj.filters | 3 | ||||
-rw-r--r-- | src/modules/extraicons/IcolibExtraIcon.cpp | 2 | ||||
-rw-r--r-- | src/modules/extraicons/extraicons.cpp | 30 | ||||
-rw-r--r-- | src/modules/icolib/IcoLib.h | 10 | ||||
-rw-r--r-- | src/modules/icolib/skin2icons.cpp | 38 | ||||
-rw-r--r-- | src/modules/icolib/skin2opts.cpp | 20 |
14 files changed, 177 insertions, 154 deletions
diff --git a/src/core/miranda.h b/src/core/miranda.h index 3cfaab2b76..b89eeb3011 100644 --- a/src/core/miranda.h +++ b/src/core/miranda.h @@ -138,7 +138,6 @@ extern HANDLE hOkToExitEvent, hModulesLoadedEvent, hevLoadModule, hevUnloadModul /**** newplugins.cpp *******************************************************************/
char* GetPluginNameByInstance(HINSTANCE hInstance);
-int GetPluginLangByInstance(HINSTANCE hInstance);
int GetPluginFakeId(const MUUID &uuid, int hLangpack);
/**** utf.cpp **************************************************************************/
diff --git a/src/core/stdchat/src/options.cpp b/src/core/stdchat/src/options.cpp index fae3bdd567..8ad41172ce 100644 --- a/src/core/stdchat/src/options.cpp +++ b/src/core/stdchat/src/options.cpp @@ -426,72 +426,52 @@ void RegisterFonts( void ) // add icons to the skinning module
-struct
+static IconItem iconList[] =
{
- int size;
- char* szSection;
- char* szDescr;
- char* szName;
- int defIconID;
-}
-static const iconList[] =
-{
- { 0, LPGEN("Messaging") "/" LPGEN("Group Chats"), LPGEN("Window Icon"), "chat_window", IDI_CHANMGR },
- { 0, LPGEN("Messaging") "/" LPGEN("Group Chats"), LPGEN("Text colour"), "chat_fgcol", IDI_COLOR },
- { 0, LPGEN("Messaging") "/" LPGEN("Group Chats"), LPGEN("Background colour"), "chat_bkgcol", IDI_BKGCOLOR },
- { 0, LPGEN("Messaging") "/" LPGEN("Group Chats"), LPGEN("Bold"), "chat_bold", IDI_BBOLD },
- { 0, LPGEN("Messaging") "/" LPGEN("Group Chats"), LPGEN("Italics"), "chat_italics", IDI_BITALICS },
- { 0, LPGEN("Messaging") "/" LPGEN("Group Chats"), LPGEN("Underlined"), "chat_underline", IDI_BUNDERLINE },
- { 0, LPGEN("Messaging") "/" LPGEN("Group Chats"), LPGEN("Smiley button"), "chat_smiley", IDI_BSMILEY },
- { 0, LPGEN("Messaging") "/" LPGEN("Group Chats"), LPGEN("Room history"), "chat_history", IDI_HISTORY },
- { 0, LPGEN("Messaging") "/" LPGEN("Group Chats"), LPGEN("Room settings"), "chat_settings", IDI_TOPICBUT },
- { 0, LPGEN("Messaging") "/" LPGEN("Group Chats"), LPGEN("Event filter disabled"), "chat_filter", IDI_FILTER },
- { 0, LPGEN("Messaging") "/" LPGEN("Group Chats"), LPGEN("Event filter enabled"), "chat_filter2", IDI_FILTER2 },
- { 0, LPGEN("Messaging") "/" LPGEN("Group Chats"), LPGEN("Hide userlist"), "chat_nicklist", IDI_NICKLIST },
- { 0, LPGEN("Messaging") "/" LPGEN("Group Chats"), LPGEN("Show userlist"), "chat_nicklist2", IDI_NICKLIST2 },
- { 0, LPGEN("Messaging") "/" LPGEN("Group Chats"), LPGEN("Icon overlay"), "chat_overlay", IDI_OVERLAY },
- { 0, LPGEN("Messaging") "/" LPGEN("Group Chats"), LPGEN("Close"), "chat_close", IDI_CLOSE },
-
- { 10, LPGEN("Messaging") "/" LPGEN("Group Chats"), LPGEN("Status 1 (10x10)"), "chat_status0", IDI_STATUS0 },
- { 10, LPGEN("Messaging") "/" LPGEN("Group Chats"), LPGEN("Status 2 (10x10)"), "chat_status1", IDI_STATUS1 },
- { 10, LPGEN("Messaging") "/" LPGEN("Group Chats"), LPGEN("Status 3 (10x10)"), "chat_status2", IDI_STATUS2 },
- { 10, LPGEN("Messaging") "/" LPGEN("Group Chats"), LPGEN("Status 4 (10x10)"), "chat_status3", IDI_STATUS3 },
- { 10, LPGEN("Messaging") "/" LPGEN("Group Chats"), LPGEN("Status 5 (10x10)"), "chat_status4", IDI_STATUS4 },
- { 10, LPGEN("Messaging") "/" LPGEN("Group Chats"), LPGEN("Status 6 (10x10)"), "chat_status5", IDI_STATUS5 },
-
- { 10, LPGEN("Messaging") "/" LPGEN("Group Chats Log"), LPGEN("Message in (10x10)"), "chat_log_message_in", IDI_MESSAGE },
- { 10, LPGEN("Messaging") "/" LPGEN("Group Chats Log"), LPGEN("Message out (10x10)"), "chat_log_message_out", IDI_MESSAGEOUT },
- { 10, LPGEN("Messaging") "/" LPGEN("Group Chats Log"), LPGEN("Action (10x10)"), "chat_log_action", IDI_ACTION },
- { 10, LPGEN("Messaging") "/" LPGEN("Group Chats Log"), LPGEN("Add Status (10x10)"), "chat_log_addstatus", IDI_ADDSTATUS },
- { 10, LPGEN("Messaging") "/" LPGEN("Group Chats Log"), LPGEN("Remove status (10x10)"), "chat_log_removestatus", IDI_REMSTATUS },
- { 10, LPGEN("Messaging") "/" LPGEN("Group Chats Log"), LPGEN("Join (10x10)"), "chat_log_join", IDI_JOIN },
- { 10, LPGEN("Messaging") "/" LPGEN("Group Chats Log"), LPGEN("Leave (10x10)"), "chat_log_part", IDI_PART },
- { 10, LPGEN("Messaging") "/" LPGEN("Group Chats Log"), LPGEN("Quit (10x10)"), "chat_log_quit", IDI_QUIT },
- { 10, LPGEN("Messaging") "/" LPGEN("Group Chats Log"), LPGEN("Kick (10x10)"), "chat_log_kick", IDI_KICK },
- { 10, LPGEN("Messaging") "/" LPGEN("Group Chats Log"), LPGEN("Nickchange (10x10)"), "chat_log_nick", IDI_NICK },
- { 10, LPGEN("Messaging") "/" LPGEN("Group Chats Log"), LPGEN("Notice (10x10)"), "chat_log_notice", IDI_NOTICE },
- { 10, LPGEN("Messaging") "/" LPGEN("Group Chats Log"), LPGEN("Topic (10x10)"), "chat_log_topic", IDI_TOPIC },
- { 10, LPGEN("Messaging") "/" LPGEN("Group Chats Log"), LPGEN("Highlight (10x10)"), "chat_log_highlight", IDI_HIGHLIGHT },
- { 10, LPGEN("Messaging") "/" LPGEN("Group Chats Log"), LPGEN("Information (10x10)"), "chat_log_info", IDI_INFO }
+ { LPGEN("Window Icon"), "chat_window", IDI_CHANMGR, 0 },
+ { LPGEN("Text colour"), "chat_fgcol", IDI_COLOR, 0 },
+ { LPGEN("Background colour"), "chat_bkgcol", IDI_BKGCOLOR, 0 },
+ { LPGEN("Bold"), "chat_bold", IDI_BBOLD, 0 },
+ { LPGEN("Italics"), "chat_italics", IDI_BITALICS, 0 },
+ { LPGEN("Underlined"), "chat_underline", IDI_BUNDERLINE, 0 },
+ { LPGEN("Smiley button"), "chat_smiley", IDI_BSMILEY, 0 },
+ { LPGEN("Room history"), "chat_history", IDI_HISTORY, 0 },
+ { LPGEN("Room settings"), "chat_settings", IDI_TOPICBUT, 0 },
+ { LPGEN("Event filter disabled"), "chat_filter", IDI_FILTER, 0 },
+ { LPGEN("Event filter enabled"), "chat_filter2", IDI_FILTER2, 0 },
+ { LPGEN("Hide userlist"), "chat_nicklist", IDI_NICKLIST, 0 },
+ { LPGEN("Show userlist"), "chat_nicklist2", IDI_NICKLIST2, 0 },
+ { LPGEN("Icon overlay"), "chat_overlay", IDI_OVERLAY, 0 },
+ { LPGEN("Close"), "chat_close", IDI_CLOSE, 0 },
+
+ { LPGEN("Status 1 (10x10)"), "chat_status0", IDI_STATUS0, 10 },
+ { LPGEN("Status 2 (10x10)"), "chat_status1", IDI_STATUS1, 10 },
+ { LPGEN("Status 3 (10x10)"), "chat_status2", IDI_STATUS2, 10 },
+ { LPGEN("Status 4 (10x10)"), "chat_status3", IDI_STATUS3, 10 },
+ { LPGEN("Status 5 (10x10)"), "chat_status4", IDI_STATUS4, 10 },
+ { LPGEN("Status 6 (10x10)"), "chat_status5", IDI_STATUS5, 10 },
+
+ { LPGEN("Message in (10x10)"), "chat_log_message_in", IDI_MESSAGE, 10 },
+ { LPGEN("Message out (10x10)"), "chat_log_message_out", IDI_MESSAGEOUT, 10 },
+ { LPGEN("Action (10x10)"), "chat_log_action", IDI_ACTION, 10 },
+ { LPGEN("Add Status (10x10)"), "chat_log_addstatus", IDI_ADDSTATUS, 10 },
+ { LPGEN("Remove status (10x10)"), "chat_log_removestatus", IDI_REMSTATUS, 10 },
+ { LPGEN("Join (10x10)"), "chat_log_join", IDI_JOIN, 10 },
+ { LPGEN("Leave (10x10)"), "chat_log_part", IDI_PART, 10 },
+ { LPGEN("Quit (10x10)"), "chat_log_quit", IDI_QUIT, 10 },
+ { LPGEN("Kick (10x10)"), "chat_log_kick", IDI_KICK, 10 },
+ { LPGEN("Nickchange (10x10)"), "chat_log_nick", IDI_NICK, 10 },
+ { LPGEN("Notice (10x10)"), "chat_log_notice", IDI_NOTICE, 10 },
+ { LPGEN("Topic (10x10)"), "chat_log_topic", IDI_TOPIC, 10 },
+ { LPGEN("Highlight (10x10)"), "chat_log_highlight", IDI_HIGHLIGHT, 10 },
+ { LPGEN("Information (10x10)"), "chat_log_info", IDI_INFO, 10 }
};
void AddIcons(void)
{
- TCHAR szFile[MAX_PATH];
- GetModuleFileName(g_hInst, szFile, MAX_PATH);
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.ptszDefaultFile = szFile;
- sid.flags = SIDF_PATH_TCHAR;
-
- for (int i = 0; i < SIZEOF(iconList); i++ ) {
- sid.cx = sid.cy = iconList[i].size;
- sid.pszSection = iconList[i].szSection;
- sid.pszDescription = iconList[i].szDescr;
- sid.pszName = iconList[i].szName;
- sid.iDefaultIndex = -iconList[i].defIconID;
- Skin_AddIcon(&sid);
-} }
+ Icon_Register(g_hInst, LPGEN("Messaging") "/" LPGEN("Group Chats"), iconList, 21);
+ Icon_Register(g_hInst, LPGEN("Messaging") "/" LPGEN("Group Chats Log"), iconList+21, 14);
+}
// load icons from the skinning module if available
HICON LoadIconEx( char* pszIcoLibName, BOOL big )
diff --git a/src/core/stdmsg/src/globals.cpp b/src/core/stdmsg/src/globals.cpp index d60ce6d3fc..52e69a8860 100644 --- a/src/core/stdmsg/src/globals.cpp +++ b/src/core/stdmsg/src/globals.cpp @@ -26,43 +26,16 @@ static int dbaddedevent(WPARAM wParam, LPARAM lParam); static int ackevent(WPARAM wParam, LPARAM lParam);
static int AvatarChanged(WPARAM wParam, LPARAM lParam);
-typedef struct IconDefStruct
+IconItem iconList[] =
{
- char *szName;
- char *szDescr;
- int defIconID;
-} IconList;
-
-static const IconList iconList[] =
-{
- { "INCOMING", LPGEN("Incoming message (10x10)"), IDI_INCOMING },
- { "OUTGOING", LPGEN("Outgoing message (10x10)"), IDI_OUTGOING },
- { "NOTICE", LPGEN("Notice (10x10)"), IDI_NOTICE },
+ { LPGEN("Incoming message (10x10)"), "INCOMING", IDI_INCOMING, 10 },
+ { LPGEN("Outgoing message (10x10)"), "OUTGOING", IDI_OUTGOING, 10 },
+ { LPGEN("Notice (10x10)"), "NOTICE", IDI_NOTICE, 10 },
};
-
-HANDLE hIconLibItem[SIZEOF(iconList)];
-
static void InitIcons(void)
{
- char szSettingName[100];
-
- TCHAR szFile[MAX_PATH];
- GetModuleFileName(g_hInst, szFile, SIZEOF(szFile));
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.ptszDefaultFile = szFile;
- sid.pszName = szSettingName;
- sid.pszSection = LPGEN("Messaging");
- sid.flags = SIDF_PATH_TCHAR;
- sid.cx = 10; sid.cy = 10;
-
- for (int i=0; i < SIZEOF(iconList); i++) {
- mir_snprintf(szSettingName, sizeof(szSettingName), "SRMM_%s", iconList[i].szName);
- sid.pszDescription = iconList[i].szDescr;
- sid.iDefaultIndex = -iconList[i].defIconID;
- hIconLibItem[i] = Skin_AddIcon(&sid);
- }
+ Icon_Register(g_hInst, LPGEN("Messaging"), iconList, SIZEOF(iconList), "SRMM");
}
static int IconsChanged(WPARAM wParam, LPARAM lParam)
diff --git a/src/core/stdmsg/src/msglog.cpp b/src/core/stdmsg/src/msglog.cpp index 3596233975..89647cd226 100644 --- a/src/core/stdmsg/src/msglog.cpp +++ b/src/core/stdmsg/src/msglog.cpp @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "commonheaders.h"
-extern HANDLE hIconLibItem[];
+extern IconItem iconList[];
static int logPixelSY;
#define LOGICON_MSG_IN 0
@@ -609,7 +609,7 @@ void LoadMsgLogIcons(void) pBmpBits = (PBYTE) mir_alloc(widthBytes * bih.biHeight);
for (i = 0; i < SIZEOF(pLogIconBmpBits); i++) {
- hIcon = Skin_GetIconByHandle(hIconLibItem[i]);
+ hIcon = Skin_GetIconByHandle(iconList[i].hIcolib);
pLogIconBmpBits[i] = (PBYTE) mir_alloc(RTFPICTHEADERMAXSIZE + (bih.biSize + widthBytes * bih.biHeight) * 2);
//I can't seem to get binary mode working. No matter.
rtfHeaderSize = sprintf((char*)pLogIconBmpBits[i], "{\\pict\\dibitmap0\\wbmbitspixel%u\\wbmplanes1\\wbmwidthbytes%u\\picw%u\\pich%u ", bih.biBitCount, widthBytes, bih.biWidth, bih.biHeight);
diff --git a/src/core/stdplug.h b/src/core/stdplug.h index 00cecdbbfa..f7a6e49522 100644 --- a/src/core/stdplug.h +++ b/src/core/stdplug.h @@ -13,7 +13,7 @@ MIRANDA_EXE_FUNC(HANDLE) IcoLib_AddNewIcon(int hLangpack, SKINICONDESC* sid); MIRANDA_EXE_FUNC(HICON) IcoLib_GetIcon(const char* pszIconName, bool big);
MIRANDA_EXE_FUNC(HICON) IcoLib_GetIconByHandle(HANDLE hItem, bool big);
MIRANDA_EXE_FUNC(HANDLE) IcoLib_IsManaged(HICON hIcon);
-MIRANDA_EXE_FUNC(int) IcoLib_ReleaseIcon(HICON hIcon, char* szIconName, bool big=false);
+MIRANDA_EXE_FUNC(int) IcoLib_ReleaseIcon(HICON hIcon, char* szIconName, bool big=false);
MIRANDA_EXE_FUNC(void) Button_SetIcon_IcoLib(HWND hDlg, int itemId, int iconId, const char* tooltip);
MIRANDA_EXE_FUNC(void) Button_FreeIcon_IcoLib(HWND hDlg, int itemId);
@@ -21,3 +21,5 @@ MIRANDA_EXE_FUNC(void) Button_FreeIcon_IcoLib(HWND hDlg, int itemId); MIRANDA_EXE_FUNC(void) Window_SetIcon_IcoLib(HWND hWnd, int iconId);
MIRANDA_EXE_FUNC(void) Window_SetProtoIcon_IcoLib(HWND hWnd, const char* szProto, int iconId);
MIRANDA_EXE_FUNC(void) Window_FreeIcon_IcoLib(HWND hWnd);
+
+MIRANDA_EXE_FUNC(int) GetPluginLangByInstance(HINSTANCE hInstance);
diff --git a/src/mir_core/icons.cpp b/src/mir_core/icons.cpp new file mode 100644 index 0000000000..74ba02c07c --- /dev/null +++ b/src/mir_core/icons.cpp @@ -0,0 +1,77 @@ +/*
+
+Miranda NG: the free IM client for Microsoft* Windows*
+
+Copyright 2012 Miranda NG project,
+all portions of this codebase are copyrighted to the people
+listed in contributors.txt.
+
+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.
+*/
+
+#include "commonheaders.h"
+
+#include <m_icolib.h>
+#include "..\src\core\stdplug.h"
+
+MIR_CORE_DLL(void) Icon_Register(HINSTANCE hInst, const char *szSection, IconItem *pIcons, size_t iCount, char *prefix, int hLangpack)
+{
+ TCHAR szFile[MAX_PATH];
+ GetModuleFileName(hInst, szFile, MAX_PATH);
+
+ SKINICONDESC sid = { sizeof(sid) };
+ sid.ptszDefaultFile = szFile;
+ sid.pszSection = (char*)szSection;
+ sid.flags = SIDF_PATH_TCHAR;
+
+ for (unsigned i = 0; i < iCount; i++) {
+ char szSetting[100];
+ if (prefix) {
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%s_%s", prefix, pIcons[i].szName);
+ sid.pszName = szSetting;
+ }
+ else sid.pszName = pIcons[i].szName;
+
+ sid.cx = sid.cy = pIcons[i].size;
+ sid.pszDescription = pIcons[i].szDescr;
+ sid.iDefaultIndex = -pIcons[i].defIconID;
+ pIcons[i].hIcolib = (HANDLE)CallService("Skin2/Icons/AddIcon", hLangpack, (LPARAM)&sid);
+ }
+}
+
+MIR_CORE_DLL(void) Icon_RegisterT(HINSTANCE hInst, const TCHAR *szSection, IconItemT *pIcons, size_t iCount, char *prefix, int hLangpack)
+{
+ TCHAR szFile[MAX_PATH];
+ GetModuleFileName(hInst, szFile, MAX_PATH);
+
+ SKINICONDESC sid = { sizeof(sid) };
+ sid.ptszDefaultFile = szFile;
+ sid.ptszSection = (TCHAR*)szSection;
+ sid.flags = SIDF_ALL_TCHAR;
+
+ for (unsigned i = 0; i < iCount; i++) {
+ char szSetting[100];
+ if (prefix) {
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%s_%s", prefix, pIcons[i].szName);
+ sid.pszName = szSetting;
+ }
+ else sid.pszName = pIcons[i].szName;
+
+ sid.cx = sid.cy = pIcons[i].size;
+ sid.ptszDescription = pIcons[i].tszDescr;
+ sid.iDefaultIndex = -pIcons[i].defIconID;
+ pIcons[i].hIcolib = (HANDLE)CallService("Skin2/Icons/AddIcon", hLangpack, (LPARAM)&sid);
+ }
+}
diff --git a/src/mir_core/mir_core.def b/src/mir_core/mir_core.def index df6cce1144..3958995c32 100644 --- a/src/mir_core/mir_core.def +++ b/src/mir_core/mir_core.def @@ -134,3 +134,5 @@ GetSubscribersCount @131 NotifyFastHook @132
db_find_first @133
db_find_next @134
+Icon_Register @135
+Icon_RegisterT @136
diff --git a/src/mir_core/mir_core_10.vcxproj b/src/mir_core/mir_core_10.vcxproj index edabb2b74f..c1cf98d550 100644 --- a/src/mir_core/mir_core_10.vcxproj +++ b/src/mir_core/mir_core_10.vcxproj @@ -27,6 +27,7 @@ </ItemGroup>
<ItemGroup>
<ClCompile Include="cmdline.cpp" />
+ <ClCompile Include="icons.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
diff --git a/src/mir_core/mir_core_10.vcxproj.filters b/src/mir_core/mir_core_10.vcxproj.filters index 61188b5100..9e472906fb 100644 --- a/src/mir_core/mir_core_10.vcxproj.filters +++ b/src/mir_core/mir_core_10.vcxproj.filters @@ -55,6 +55,9 @@ <ClCompile Include="stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="icons.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="commonheaders.h">
diff --git a/src/modules/extraicons/IcolibExtraIcon.cpp b/src/modules/extraicons/IcolibExtraIcon.cpp index 1b18b0f9c8..aa00b0efdc 100644 --- a/src/modules/extraicons/IcolibExtraIcon.cpp +++ b/src/modules/extraicons/IcolibExtraIcon.cpp @@ -82,7 +82,7 @@ int IcolibExtraIcon::setIcon(int id, HANDLE hContact, HANDLE hIcoLib) }
}
- IconItem *p = (IconItem*)hIcoLib;
+ IcolibItem *p = (IcolibItem*)hIcoLib;
char *szName = (p) ? p->name : NULL;
storeIcon(hContact, szName);
diff --git a/src/modules/extraicons/extraicons.cpp b/src/modules/extraicons/extraicons.cpp index a1cfbf8c57..b47a5d4dd9 100644 --- a/src/modules/extraicons/extraicons.cpp +++ b/src/modules/extraicons/extraicons.cpp @@ -507,6 +507,13 @@ static INT_PTR svcExtraIcon_Add(WPARAM wParam, LPARAM lParam) ///////////////////////////////////////////////////////////////////////////////
+static IconItem iconList[] =
+{
+ { LPGEN("Chat Activity"), "ChatActivity", IDI_CHAT },
+ { LPGEN("Male"), "gender_male", IDI_MALE },
+ { LPGEN("Female"), "gender_female", IDI_FEMALE }
+};
+
void LoadExtraIconsModule()
{
DWORD ret = CallService(MS_CLUI_GETCAPS, CLUICAPS_FLAGS2, 0);
@@ -525,28 +532,7 @@ void LoadExtraIconsModule() hEventExtraImageListRebuilding = CreateHookableEvent(ME_CLIST_EXTRA_LIST_REBUILD);
// Icons
- TCHAR tszFile[MAX_PATH];
- GetModuleFileName(NULL, tszFile, MAX_PATH);
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.flags = SIDF_PATH_TCHAR;
- sid.ptszDefaultFile = tszFile;
- sid.pszSection = "Contact List";
-
- sid.pszName = "ChatActivity";
- sid.pszDescription = LPGEN("Chat Activity");
- sid.iDefaultIndex = -IDI_CHAT;
- Skin_AddIcon(&sid);
-
- sid.pszName = "gender_male";
- sid.pszDescription = LPGEN("Male");
- sid.iDefaultIndex = -IDI_MALE;
- Skin_AddIcon(&sid);
-
- sid.pszName = "gender_female";
- sid.pszDescription = LPGEN("Female");
- sid.iDefaultIndex = -IDI_FEMALE;
- Skin_AddIcon(&sid);
+ Icon_Register(NULL, "Contact List", iconList, SIZEOF(iconList));
// Hooks
HookEvent(ME_SYSTEM_MODULESLOADED, &ModulesLoaded);
diff --git a/src/modules/icolib/IcoLib.h b/src/modules/icolib/IcoLib.h index 550de7ad9b..ec93d2af62 100644 --- a/src/modules/icolib/IcoLib.h +++ b/src/modules/icolib/IcoLib.h @@ -56,7 +56,7 @@ struct IconSourceItem int icon_size;
};
-struct IconItem
+struct IcolibItem
{
char* name;
SectionItem* section;
@@ -90,15 +90,15 @@ int IconSourceItem_ReleaseIcon(IconSourceItem* item); HICON IconSourceItem_GetIcon(IconSourceItem* item);
IconSourceItem* GetIconSourceItem(const TCHAR* file, int indx, int cxIcon, int cyIcon);
-IconItem* IcoLib_FindHIcon(HICON hIcon, bool &big);
-IconItem* IcoLib_FindIcon(const char* pszIconName);
+IcolibItem* IcoLib_FindHIcon(HICON hIcon, bool &big);
+IcolibItem* IcoLib_FindIcon(const char* pszIconName);
-HICON IconItem_GetIcon(IconItem* item, bool big);
+HICON IconItem_GetIcon(IcolibItem* item, bool big);
int SkinOptionsInit(WPARAM, LPARAM);
extern CRITICAL_SECTION csIconList;
-extern LIST<IconItem> iconList;
+extern LIST<IcolibItem> iconList;
extern LIST<SectionItem> sectionList;
extern BOOL bNeedRebuild;
diff --git a/src/modules/icolib/skin2icons.cpp b/src/modules/icolib/skin2icons.cpp index eec1dff500..80bcfc5e9e 100644 --- a/src/modules/icolib/skin2icons.cpp +++ b/src/modules/icolib/skin2icons.cpp @@ -82,12 +82,12 @@ static int sttCompareIconSourceItems(const IconSourceItem* p1, const IconSourceI static LIST<IconSourceItem> iconSourceList(20, sttCompareIconSourceItems);
-static int sttCompareIcons(const IconItem* p1, const IconItem* p2)
+static int sttCompareIcons(const IcolibItem* p1, const IcolibItem* p2)
{
return strcmp(p1->name, p2->name);
}
-LIST<IconItem> iconList(20, sttCompareIcons);
+LIST<IcolibItem> iconList(20, sttCompareIcons);
/////////////////////////////////////////////////////////////////////////////////////////
// Utility functions
@@ -447,20 +447,20 @@ static void IcoLib_RemoveSection(SectionItem* section) }
}
-IconItem* IcoLib_FindIcon(const char* pszIconName)
+IcolibItem* IcoLib_FindIcon(const char* pszIconName)
{
int indx;
- IconItem key = { (char*)pszIconName };
+ IcolibItem key = { (char*)pszIconName };
if ((indx = iconList.getIndex(&key)) != -1)
return iconList[ indx ];
return NULL;
}
-IconItem* IcoLib_FindHIcon(HICON hIcon, bool &big)
+IcolibItem* IcoLib_FindHIcon(HICON hIcon, bool &big)
{
for (int i = 0; i < iconList.getCount(); i++) {
- IconItem *p = iconList[i];
+ IcolibItem *p = iconList[i];
if ((void*)p == hIcon) {
big = (p->source_small == NULL);
return p;
@@ -478,7 +478,7 @@ IconItem* IcoLib_FindHIcon(HICON hIcon, bool &big) return NULL;
}
-static void IcoLib_FreeIcon(IconItem* icon)
+static void IcoLib_FreeIcon(IcolibItem* icon)
{
if ( !icon) return;
@@ -510,9 +510,9 @@ HANDLE IcoLib_AddNewIcon(int hLangpack, SKINICONDESC* sid) mir_cslock lck(csIconList);
- IconItem* item = IcoLib_FindIcon(sid->pszName);
+ IcolibItem* item = IcoLib_FindIcon(sid->pszName);
if (!item) {
- item = (IconItem*)mir_calloc(sizeof(IconItem));
+ item = (IcolibItem*)mir_calloc(sizeof(IcolibItem));
item->name = sid->pszName;
iconList.insert(item);
}
@@ -552,7 +552,7 @@ HANDLE IcoLib_AddNewIcon(int hLangpack, SKINICONDESC* sid) if (sid->hDefaultIcon) {
bool big;
- IconItem* def_item = IcoLib_FindHIcon(sid->hDefaultIcon, big);
+ IcolibItem* def_item = IcoLib_FindHIcon(sid->hDefaultIcon, big);
if (def_item) {
item->default_icon = big ? def_item->source_big : def_item->source_small;
item->default_icon->ref_count++;
@@ -581,8 +581,8 @@ static INT_PTR IcoLib_RemoveIcon(WPARAM, LPARAM lParam) mir_cslock lck(csIconList);
int i;
- if ((i = iconList.getIndex((IconItem*)&lParam)) != -1) {
- IconItem *item = iconList[ i ];
+ if ((i = iconList.getIndex((IcolibItem*)&lParam)) != -1) {
+ IcolibItem *item = iconList[ i ];
IcoLib_FreeIcon(item);
iconList.remove(i);
SAFE_FREE((void**)&item);
@@ -600,7 +600,7 @@ void KillModuleIcons(int hLangpack) mir_cslock lck(csIconList);
for (int i = iconList.getCount()-1; i >= 0; i--) {
- IconItem *item = iconList[i];
+ IcolibItem *item = iconList[i];
if ( item->hLangpack == hLangpack) {
IcoLib_FreeIcon(item);
iconList.remove(i);
@@ -612,7 +612,7 @@ void KillModuleIcons(int hLangpack) /////////////////////////////////////////////////////////////////////////////////////////
// IconItem_GetDefaultIcon
-HICON IconItem_GetDefaultIcon(IconItem* item, bool big)
+HICON IconItem_GetDefaultIcon(IcolibItem* item, bool big)
{
HICON hIcon = NULL;
@@ -660,7 +660,7 @@ HICON IconItem_GetDefaultIcon(IconItem* item, bool big) /////////////////////////////////////////////////////////////////////////////////////////
// IconItem_GetIcon
-HICON IconItem_GetIcon(IconItem* item, bool big)
+HICON IconItem_GetIcon(IcolibItem* item, bool big)
{
DBVARIANT dbv = {0};
HICON hIcon = NULL;
@@ -704,7 +704,7 @@ HICON IcoLib_GetIcon(const char* pszIconName, bool big) return hIconBlank;
mir_cslock lck(csIconList);
- IconItem* item = IcoLib_FindIcon(pszIconName);
+ IcolibItem* item = IcoLib_FindIcon(pszIconName);
return (item) ? IconItem_GetIcon(item, big) : NULL;
}
@@ -732,7 +732,7 @@ HICON IcoLib_GetIconByHandle(HANDLE hItem, bool big) return NULL;
mir_cslock lck(csIconList);
- IconItem* pi = (IconItem*)hItem;
+ IcolibItem* pi = (IcolibItem*)hItem;
if ( iconList.getIndex(pi) != -1)
return IconItem_GetIcon(pi, big);
@@ -762,7 +762,7 @@ static INT_PTR IcoLib_AddRef(WPARAM wParam, LPARAM) mir_cslock lck(csIconList);
bool big;
- IconItem *item = IcoLib_FindHIcon((HICON)wParam, big);
+ IcolibItem *item = IcoLib_FindHIcon((HICON)wParam, big);
INT_PTR res = 1;
if (item) {
@@ -865,7 +865,7 @@ void UnloadIcoLibModule(void) DeleteCriticalSection(&csIconList);
for (i = iconList.getCount()-1; i >= 0; i--) {
- IconItem* p = iconList[i];
+ IcolibItem* p = iconList[i];
iconList.remove(i);
IcoLib_FreeIcon(p);
mir_free(p);
diff --git a/src/modules/icolib/skin2opts.cpp b/src/modules/icolib/skin2opts.cpp index 09faff70e9..dc757297df 100644 --- a/src/modules/icolib/skin2opts.cpp +++ b/src/modules/icolib/skin2opts.cpp @@ -73,7 +73,7 @@ int IcoLib_ReleaseIcon(HICON hIcon, char* szIconName, bool big) {
mir_cslock lck(csIconList);
- IconItem *item = NULL;
+ IcolibItem *item = NULL;
if (szIconName)
item = IcoLib_FindIcon(szIconName);
@@ -98,7 +98,7 @@ int IcoLib_ReleaseIcon(HICON hIcon, char* szIconName, bool big) /////////////////////////////////////////////////////////////////////////////////////////
// IconItem_GetIcon_Preview
-HICON IconItem_GetIcon_Preview(IconItem* item)
+HICON IconItem_GetIcon_Preview(IcolibItem* item)
{
HICON hIcon = NULL;
@@ -154,7 +154,7 @@ static void LoadSectionIcons(TCHAR *filename, SectionItem* sectionActive) mir_cslock lck(csIconList);
for (int indx = 0; indx < iconList.getCount(); indx++) {
- IconItem *item = iconList[ indx ];
+ IcolibItem *item = iconList[ indx ];
if (item->default_file && item->section == sectionActive) {
_itot(item->default_indx, path + suffIndx, 10);
@@ -194,7 +194,7 @@ void LoadSubIcons(HWND htv, TCHAR *filename, HTREEITEM hItem) static void UndoChanges(int iconIndx, int cmd)
{
- IconItem *item = iconList[ iconIndx ];
+ IcolibItem *item = iconList[ iconIndx ];
if ( !item->temp_file && !item->temp_icon && item->temp_reset && cmd == ID_CANCELCHANGE)
item->temp_reset = FALSE;
@@ -320,7 +320,7 @@ void DoIconsChanged(HWND hwndDlg) mir_cslock lck(csIconList); // Destroy unused icons
for (int indx = 0; indx < iconList.getCount(); indx++) {
- IconItem *item = iconList[indx];
+ IcolibItem *item = iconList[indx];
if (item->source_small && !item->source_small->icon_ref_count) {
item->source_small->icon_ref_count++;
IconSourceItem_ReleaseIcon(item->source_small);
@@ -783,7 +783,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM mir_cslock lck(csIconList);
for (int indx = 0; indx < iconList.getCount(); indx++) {
- IconItem *item = iconList[indx];
+ IcolibItem *item = iconList[indx];
if (item->section == sectionActive) {
lvi.pszText = item->getDescr();
HICON hIcon = item->temp_icon;
@@ -843,7 +843,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM ListView_GetItem(hPreview, &lvi);
{
mir_cslock lck(csIconList);
- IconItem *item = iconList[ lvi.lParam ];
+ IcolibItem *item = iconList[ lvi.lParam ];
SAFE_FREE((void**)&item->temp_file);
SafeDestroyIcon(&item->temp_icon);
@@ -938,7 +938,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM mir_cslock lck(csIconList);
for (int indx = 0; indx < iconList.getCount(); indx++) {
- IconItem *item = iconList[indx];
+ IcolibItem *item = iconList[indx];
if (item->temp_reset) {
DBDeleteContactSetting(NULL, "SkinIcons", item->name);
if (item->source_small != item->default_icon) {
@@ -960,7 +960,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case IDC_PREVIEW:
if (((LPNMHDR)lParam)->code == LVN_GETINFOTIP) {
- IconItem *item;
+ IcolibItem *item;
NMLVGETINFOTIP *pInfoTip = (NMLVGETINFOTIP *)lParam;
LVITEM lvi;
lvi.mask = LVIF_PARAM;
@@ -1022,7 +1022,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM {
mir_cslock lck(csIconList);
for (int indx = 0; indx < iconList.getCount(); indx++) {
- IconItem *item = iconList[indx];
+ IcolibItem *item = iconList[indx];
SAFE_FREE((void**)&item->temp_file);
SafeDestroyIcon(&item->temp_icon);
|