summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-12-02 18:19:49 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-12-02 18:19:49 +0000
commitc4582dd65b444e5dae29ada7cc3f6c9a9c20edf3 (patch)
tree17a8627550b202d62df8e1df76d2585d3d0cdeaa /src/core
parent5ea5feb7e052ca45af7bc9ed76e4a252bd71950d (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/core')
-rw-r--r--src/core/miranda.h1
-rw-r--r--src/core/stdchat/src/options.cpp102
-rw-r--r--src/core/stdmsg/src/globals.cpp37
-rw-r--r--src/core/stdmsg/src/msglog.cpp4
-rw-r--r--src/core/stdplug.h4
5 files changed, 51 insertions, 97 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);