diff options
author | George Hazan <ghazan@miranda.im> | 2021-03-13 17:50:26 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2021-03-13 17:50:26 +0300 |
commit | 6a53de3a1f093a92126c0a86ec5f7ad52e3caf15 (patch) | |
tree | 1ad2a8af28b31966d67da9cea875e7a7c2b9025e | |
parent | b10f9d1556172e721e5a0c345f67f4827408a6db (diff) |
Group chats API:
- for #2574: fixes icons problem after unloading tabSRMM;
- status icons extracted to the separate array;
- another group chat icons are hidden completely to restrict access to them
41 files changed, 82 insertions, 127 deletions
diff --git a/include/m_chat_int.h b/include/m_chat_int.h index 8318ba2371..194f9723c8 100644 --- a/include/m_chat_int.h +++ b/include/m_chat_int.h @@ -66,13 +66,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define ICON_REMSTATUS 12
#define ICON_TOPIC 13
-#define ICON_STATUS0 14
-#define ICON_STATUS1 15
-#define ICON_STATUS2 16
-#define ICON_STATUS3 17
-#define ICON_STATUS4 18
-#define ICON_STATUS5 19
-
#define CHATMODE_NORMAL 0
#define CHATMODE_MUTE 1
#define CHATMODE_UNMUTE 2
@@ -341,7 +334,7 @@ struct CHAT_MANAGER int logPixelSY, logPixelSX;
char *szActiveWndModule;
wchar_t *szActiveWndID;
- HICON hIcons[30];
+ HICON hStatusIcons[STATUSICONCOUNT];
HBRUSH hListBkgBrush, hListSelectedBkgBrush;
HANDLE hevWinPopup, hevPreCreate;
FONTINFO aFonts[OPTIONS_FONTCOUNT];
diff --git a/plugins/Scriver/res/resource.rc b/plugins/Scriver/res/resource.rc index 51cf4dac29..4164a6a1af 100644 --- a/plugins/Scriver/res/resource.rc +++ b/plugins/Scriver/res/resource.rc @@ -502,18 +502,6 @@ IDI_FILTER ICON "chat/filter.ico" IDI_NICKLIST ICON "chat/nicklist.ico"
-IDI_STATUS3 ICON "chat/4.ico"
-
-IDI_STATUS2 ICON "chat/3.ico"
-
-IDI_STATUS4 ICON "chat/5.ico"
-
-IDI_STATUS1 ICON "chat/2.ico"
-
-IDI_STATUS0 ICON "chat/1.ico"
-
-IDI_STATUS5 ICON "chat/6.ico"
-
IDI_OVERLAY ICON "chat/overlay.ico"
IDI_NICKLIST2 ICON "chat/nicklist2.ico"
diff --git a/plugins/Scriver/src/globals.cpp b/plugins/Scriver/src/globals.cpp index 6c017b7266..1978bdbbd0 100644 --- a/plugins/Scriver/src/globals.cpp +++ b/plugins/Scriver/src/globals.cpp @@ -72,12 +72,6 @@ static IconItem iconList2[] = { LPGEN("Hide nick list"), "nicklist", IDI_NICKLIST }, // 12
{ LPGEN("Show nick list"), "nicklist2", IDI_NICKLIST2 }, // 13
{ LPGEN("Icon overlay"), "overlay", IDI_OVERLAY }, // 14
- { LPGEN("Status 1 (10x10)"), "status0", IDI_STATUS0, 10}, // 15
- { LPGEN("Status 2 (10x10)"), "status1", IDI_STATUS1, 10}, // 16
- { LPGEN("Status 3 (10x10)"), "status2", IDI_STATUS2, 10}, // 17
- { LPGEN("Status 4 (10x10)"), "status3", IDI_STATUS3, 10}, // 18
- { LPGEN("Status 5 (10x10)"), "status4", IDI_STATUS4, 10}, // 19
- { LPGEN("Status 6 (10x10)"), "status5", IDI_STATUS5, 10}, // 20
};
static IconItem iconList3[] =
diff --git a/plugins/Scriver/src/resource.h b/plugins/Scriver/src/resource.h index 14f62efbaa..4793e60cde 100644 --- a/plugins/Scriver/src/resource.h +++ b/plugins/Scriver/src/resource.h @@ -59,12 +59,6 @@ #define IDI_ADDSTATUS 441
#define IDI_REMSTATUS 442
#define IDI_ACTION 443
-#define IDI_STATUS3 453
-#define IDI_STATUS2 454
-#define IDI_STATUS4 455
-#define IDI_STATUS1 456
-#define IDI_STATUS0 457
-#define IDI_STATUS5 458
#define IDI_OVERLAY 460
#define IDI_NICKLIST2 461
#define IDI_FILTER2 462
diff --git a/plugins/TabSRMM/TabSRMM_icons/NOVA/res/ICONS_NOVA.rc b/plugins/TabSRMM/TabSRMM_icons/NOVA/res/ICONS_NOVA.rc index 4b819348ad..d256512598 100644 --- a/plugins/TabSRMM/TabSRMM_icons/NOVA/res/ICONS_NOVA.rc +++ b/plugins/TabSRMM/TabSRMM_icons/NOVA/res/ICONS_NOVA.rc @@ -74,8 +74,6 @@ IDI_CONFIGSIDEBAR ICON "sbaroptions.ico" IDI_RECENTLIST ICON "recentlist.ico"
IDI_USERPREFS ICON "userprefs.ico"
-IDI_TAG1 ICON "chat\\tag1.ico"
-IDI_TAG2 ICON "chat\\tag2.ico"
IDI_TOPICBUT ICON "chat\\topicbut.ico"
IDI_JOIN ICON "chat\\join.ico"
IDI_TOPIC ICON "chat\\topic.ico"
@@ -95,12 +93,7 @@ IDI_BKGCOLOR ICON "chat\\bkgcolor.ico" IDI_CHANMGR ICON "chat\\window.ico"
IDI_FILTER ICON "chat\\filter.ico"
IDI_BLANK ICON "chat\\blank.ico"
-IDI_STATUS3 ICON "chat\\4.ico"
-IDI_STATUS2 ICON "chat\\3.ico"
-IDI_STATUS4 ICON "chat\\5.ico"
-IDI_STATUS1 ICON "chat\\2.ico"
IDI_STATUS0 ICON "chat\\blank.ico"
-IDI_STATUS5 ICON "chat\\6.ico"
IDI_OVERLAY ICON "chat\\overlay.ico"
IDI_FILTER2 ICON "chat\\filter2.ico"
IDI_SHOWNICKLIST ICON "chat\\nicklist_show.ico"
diff --git a/plugins/TabSRMM/TabSRMM_icons/NOVA/res/chat/2.ico b/plugins/TabSRMM/TabSRMM_icons/NOVA/res/chat/2.ico Binary files differdeleted file mode 100644 index 5c1dc06fbc..0000000000 --- a/plugins/TabSRMM/TabSRMM_icons/NOVA/res/chat/2.ico +++ /dev/null diff --git a/plugins/TabSRMM/TabSRMM_icons/NOVA/res/chat/3.ico b/plugins/TabSRMM/TabSRMM_icons/NOVA/res/chat/3.ico Binary files differdeleted file mode 100644 index f103719b68..0000000000 --- a/plugins/TabSRMM/TabSRMM_icons/NOVA/res/chat/3.ico +++ /dev/null diff --git a/plugins/TabSRMM/TabSRMM_icons/NOVA/res/chat/4.ico b/plugins/TabSRMM/TabSRMM_icons/NOVA/res/chat/4.ico Binary files differdeleted file mode 100644 index 47d8f35fe2..0000000000 --- a/plugins/TabSRMM/TabSRMM_icons/NOVA/res/chat/4.ico +++ /dev/null diff --git a/plugins/TabSRMM/TabSRMM_icons/NOVA/res/chat/5.ico b/plugins/TabSRMM/TabSRMM_icons/NOVA/res/chat/5.ico Binary files differdeleted file mode 100644 index 7008463787..0000000000 --- a/plugins/TabSRMM/TabSRMM_icons/NOVA/res/chat/5.ico +++ /dev/null diff --git a/plugins/TabSRMM/TabSRMM_icons/NOVA/res/chat/6.ico b/plugins/TabSRMM/TabSRMM_icons/NOVA/res/chat/6.ico Binary files differdeleted file mode 100644 index 8a681faeb7..0000000000 --- a/plugins/TabSRMM/TabSRMM_icons/NOVA/res/chat/6.ico +++ /dev/null diff --git a/plugins/TabSRMM/TabSRMM_icons/NOVA/res/chat/tag1.ico b/plugins/TabSRMM/TabSRMM_icons/NOVA/res/chat/tag1.ico Binary files differdeleted file mode 100644 index 4db0312d9d..0000000000 --- a/plugins/TabSRMM/TabSRMM_icons/NOVA/res/chat/tag1.ico +++ /dev/null diff --git a/plugins/TabSRMM/TabSRMM_icons/NOVA/res/chat/tag2.ico b/plugins/TabSRMM/TabSRMM_icons/NOVA/res/chat/tag2.ico Binary files differdeleted file mode 100644 index 5b5197a9cd..0000000000 --- a/plugins/TabSRMM/TabSRMM_icons/NOVA/res/chat/tag2.ico +++ /dev/null diff --git a/plugins/TabSRMM/TabSRMM_icons/resource.h b/plugins/TabSRMM/TabSRMM_icons/resource.h index dcd14ae711..180af77975 100644 --- a/plugins/TabSRMM/TabSRMM_icons/resource.h +++ b/plugins/TabSRMM/TabSRMM_icons/resource.h @@ -76,12 +76,6 @@ #define IDI_FILTER 203
#define IDI_FILTER2 204
#define IDI_OVERLAY 205
-#define IDI_STATUS3 206
-#define IDI_STATUS2 207
-#define IDI_STATUS4 208
-#define IDI_STATUS1 209
-#define IDI_STATUS0 210
-#define IDI_STATUS5 211
#define IDI_BLANK 212
#define IDI_SHOWNICKLIST 213
#define IDI_HIDENICKLIST 214
@@ -102,8 +96,6 @@ #define IDI_REMSTATUS 261
#define IDI_ACTION 262
#define IDI_HIGHLIGHT 263
-#define IDI_TAG1 264
-#define IDI_TAG2 265
diff --git a/plugins/TabSRMM/res/resource.rc b/plugins/TabSRMM/res/resource.rc index e89cb0eba5..dc5fdca0c8 100644 --- a/plugins/TabSRMM/res/resource.rc +++ b/plugins/TabSRMM/res/resource.rc @@ -9,7 +9,6 @@ //
#include <winres.h>
#include "..\..\..\include\statusmodes.h"
-#include "..\..\..\include\chat_resource.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
@@ -874,7 +873,6 @@ END BEGIN
"#include <winres.h>\r\n"
"#include ""..\\..\\..\\include\\statusmodes.h""\r\n"
- "#include ""..\\..\\..\\include\\chat_resource.h""\r\n"
"\0"
END
diff --git a/plugins/TabSRMM/src/chat_options.cpp b/plugins/TabSRMM/src/chat_options.cpp index eb503962bd..8dc2d8a2b6 100644 --- a/plugins/TabSRMM/src/chat_options.cpp +++ b/plugins/TabSRMM/src/chat_options.cpp @@ -183,13 +183,6 @@ static IconItem _icons[] = {
{ LPGEN("Window Icon"), "chat_window", IDI_CHANMGR },
{ LPGEN("Icon overlay"), "chat_overlay", IDI_OVERLAY },
-
- { LPGEN("Status 1 (10x10)"), "chat_status0", IDI_STATUS0 },
- { LPGEN("Status 2 (10x10)"), "chat_status1", IDI_STATUS1 },
- { LPGEN("Status 3 (10x10)"), "chat_status2", IDI_STATUS2 },
- { LPGEN("Status 4 (10x10)"), "chat_status3", IDI_STATUS3 },
- { LPGEN("Status 5 (10x10)"), "chat_status4", IDI_STATUS4 },
- { LPGEN("Status 6 (10x10)"), "chat_status5", IDI_STATUS5 }
};
static IconItem _logicons[] =
diff --git a/plugins/TabSRMM/src/chat_tools.cpp b/plugins/TabSRMM/src/chat_tools.cpp index 612f82a317..6d06b3c25c 100644 --- a/plugins/TabSRMM/src/chat_tools.cpp +++ b/plugins/TabSRMM/src/chat_tools.cpp @@ -194,7 +194,7 @@ passed: }
if (iNewEvent == GC_EVENT_MESSAGE) {
- ShowPopup(si->hContact, si, g_chatApi.hIcons[ICON_MESSAGE], si->pszModule, si->ptszName, clr ? clr : g_chatApi.aFonts[9].color,
+ ShowPopup(si->hContact, si, g_chatApi.getIcon(GC_EVENT_MESSAGE), si->pszModule, si->ptszName, clr ? clr : g_chatApi.aFonts[9].color,
TranslateT("%s%s says:%s %s"), bbStart, gce->pszNick.w, bbEnd, g_chatApi.RemoveFormatting(gce->pszText.w));
}
else oldDoPopup(si, gce);
@@ -292,15 +292,16 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight // dialog event processing
if (dat) {
+ HICON hIconHighlight = g_chatApi.getIcon(GC_EVENT_HIGHLIGHT), hIconMessage = g_chatApi.getIcon(GC_EVENT_MESSAGE);
HICON hNotifyIcon = (bManyFix && !bInactive) ? 0 : g_chatApi.getIcon(iEvent);
- BOOL bForcedIcon = (hNotifyIcon == g_chatApi.hIcons[ICON_HIGHLIGHT] || hNotifyIcon == g_chatApi.hIcons[ICON_MESSAGE]);
+ BOOL bForcedIcon = (hNotifyIcon == hIconHighlight || hNotifyIcon == hIconMessage);
if ((iEvent & si->iLogTrayFlags) || bForcedIcon) {
if (!bActiveTab) {
- if (hNotifyIcon == g_chatApi.hIcons[ICON_HIGHLIGHT])
+ if (hNotifyIcon == hIconHighlight)
dat->m_iFlashIcon = hNotifyIcon;
else {
- if (dat->m_iFlashIcon != g_chatApi.hIcons[ICON_HIGHLIGHT] && dat->m_iFlashIcon != g_chatApi.hIcons[ICON_MESSAGE])
+ if (dat->m_iFlashIcon != hIconHighlight && dat->m_iFlashIcon != hIconMessage)
dat->m_iFlashIcon = hNotifyIcon;
}
dat->m_bCanFlashTab = TRUE;
@@ -344,7 +345,7 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight }
HICON hIcon = (HICON)SendMessage(dat->m_pContainer->m_hwnd, WM_GETICON, ICON_BIG, 0);
- if (hNotifyIcon == g_chatApi.hIcons[ICON_HIGHLIGHT] || (hIcon != g_chatApi.hIcons[ICON_MESSAGE] && hIcon != g_chatApi.hIcons[ICON_HIGHLIGHT])) {
+ if (hNotifyIcon == hIconHighlight || (hIcon != hIconMessage && hIcon != hIconHighlight)) {
dat->m_pContainer->SetIcon(dat, hNotifyIcon);
dat->m_pContainer->m_flags.m_bNeedsUpdateTitle = true;
}
diff --git a/plugins/TabSRMM/src/hotkeyhandler.cpp b/plugins/TabSRMM/src/hotkeyhandler.cpp index 36c712279d..547105fd7a 100644 --- a/plugins/TabSRMM/src/hotkeyhandler.cpp +++ b/plugins/TabSRMM/src/hotkeyhandler.cpp @@ -198,7 +198,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP HICON hIcon;
if (dis->itemData > 0)
- hIcon = (dis->itemData & 0x10000000) ? g_chatApi.hIcons[ICON_HIGHLIGHT] : PluginConfig.g_IconMsgEvent;
+ hIcon = (dis->itemData & 0x10000000) ? g_chatApi.getIcon(GC_EVENT_HIGHLIGHT) : PluginConfig.g_IconMsgEvent;
else if (dat != nullptr) {
hIcon = dat->GetMyContactIcon(nullptr);
idle = dat->m_idle;
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 0350f55db8..677efc63e9 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -2923,7 +2923,7 @@ INT_PTR CMsgDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) int nickIndex = 0;
for (int i = 0; i < STATUSICONCOUNT; i++) {
- if (hIcon == g_chatApi.hIcons[ICON_STATUS0 + i]) {
+ if (hIcon == g_chatApi.hStatusIcons[i]) {
nickIndex = i;
break;
}
diff --git a/src/core/stdmsg/res/1.ico b/src/core/stdmsg/res/1.ico Binary files differdeleted file mode 100644 index 61fa00e172..0000000000 --- a/src/core/stdmsg/res/1.ico +++ /dev/null diff --git a/src/core/stdmsg/res/2.ico b/src/core/stdmsg/res/2.ico Binary files differdeleted file mode 100644 index 5c1dc06fbc..0000000000 --- a/src/core/stdmsg/res/2.ico +++ /dev/null diff --git a/src/core/stdmsg/res/3.ico b/src/core/stdmsg/res/3.ico Binary files differdeleted file mode 100644 index f103719b68..0000000000 --- a/src/core/stdmsg/res/3.ico +++ /dev/null diff --git a/src/core/stdmsg/res/4.ico b/src/core/stdmsg/res/4.ico Binary files differdeleted file mode 100644 index 47d8f35fe2..0000000000 --- a/src/core/stdmsg/res/4.ico +++ /dev/null diff --git a/src/core/stdmsg/res/5.ico b/src/core/stdmsg/res/5.ico Binary files differdeleted file mode 100644 index 7008463787..0000000000 --- a/src/core/stdmsg/res/5.ico +++ /dev/null diff --git a/src/core/stdmsg/res/6.ico b/src/core/stdmsg/res/6.ico Binary files differdeleted file mode 100644 index 8a681faeb7..0000000000 --- a/src/core/stdmsg/res/6.ico +++ /dev/null diff --git a/src/core/stdmsg/res/resource.rc b/src/core/stdmsg/res/resource.rc index d7cc7e427b..752f5c20a8 100644 --- a/src/core/stdmsg/res/resource.rc +++ b/src/core/stdmsg/res/resource.rc @@ -461,18 +461,6 @@ IDI_NICKLIST ICON "nicklist.ico" IDI_BLANK ICON "blank.ico"
-IDI_STATUS3 ICON "4.ico"
-
-IDI_STATUS2 ICON "3.ico"
-
-IDI_STATUS4 ICON "5.ico"
-
-IDI_STATUS1 ICON "2.ico"
-
-IDI_STATUS0 ICON "1.ico"
-
-IDI_STATUS5 ICON "6.ico"
-
IDI_CLOSE ICON "close.ico"
IDI_OVERLAY ICON "overlay.ico"
diff --git a/src/core/stdmsg/src/chat_options.cpp b/src/core/stdmsg/src/chat_options.cpp index 97cd62c2bb..17f73d4a7a 100644 --- a/src/core/stdmsg/src/chat_options.cpp +++ b/src/core/stdmsg/src/chat_options.cpp @@ -102,13 +102,6 @@ static IconItem iconList1[] = { LPGEN("Show nick list"), "nicklist2", IDI_NICKLIST2 }, { LPGEN("Icon overlay"), "overlay", IDI_OVERLAY }, { LPGEN("Close"), "close", IDI_CLOSE }, - - { LPGEN("Status 1 (10x10)"), "status0", IDI_STATUS0, 10 }, - { LPGEN("Status 2 (10x10)"), "status1", IDI_STATUS1, 10 }, - { LPGEN("Status 3 (10x10)"), "status2", IDI_STATUS2, 10 }, - { LPGEN("Status 4 (10x10)"), "status3", IDI_STATUS3, 10 }, - { LPGEN("Status 5 (10x10)"), "status4", IDI_STATUS4, 10 }, - { LPGEN("Status 6 (10x10)"), "status5", IDI_STATUS5, 10 } }; static IconItem iconList2[] = diff --git a/src/core/stdmsg/src/resource.h b/src/core/stdmsg/src/resource.h index 78bd1288d8..d3e1b94b91 100644 --- a/src/core/stdmsg/src/resource.h +++ b/src/core/stdmsg/src/resource.h @@ -38,12 +38,6 @@ #define IDI_TAG1 149
#define IDI_TAG2 150
#define IDR_MENU 151
-#define IDI_STATUS3 153
-#define IDI_STATUS2 154
-#define IDI_STATUS4 155
-#define IDI_STATUS1 156
-#define IDI_STATUS0 157
-#define IDI_STATUS5 158
#define IDI_CLOSE 159
#define IDI_OVERLAY 160
#define IDI_NICKLIST2 161
diff --git a/plugins/Scriver/res/chat/1.ico b/src/mir_app/res/chat/1.ico Binary files differindex 61fa00e172..61fa00e172 100644 --- a/plugins/Scriver/res/chat/1.ico +++ b/src/mir_app/res/chat/1.ico diff --git a/plugins/Scriver/res/chat/2.ico b/src/mir_app/res/chat/2.ico Binary files differindex 5c1dc06fbc..5c1dc06fbc 100644 --- a/plugins/Scriver/res/chat/2.ico +++ b/src/mir_app/res/chat/2.ico diff --git a/plugins/Scriver/res/chat/3.ico b/src/mir_app/res/chat/3.ico Binary files differindex f103719b68..f103719b68 100644 --- a/plugins/Scriver/res/chat/3.ico +++ b/src/mir_app/res/chat/3.ico diff --git a/plugins/Scriver/res/chat/4.ico b/src/mir_app/res/chat/4.ico Binary files differindex 47d8f35fe2..47d8f35fe2 100644 --- a/plugins/Scriver/res/chat/4.ico +++ b/src/mir_app/res/chat/4.ico diff --git a/plugins/Scriver/res/chat/5.ico b/src/mir_app/res/chat/5.ico Binary files differindex 7008463787..7008463787 100644 --- a/plugins/Scriver/res/chat/5.ico +++ b/src/mir_app/res/chat/5.ico diff --git a/plugins/Scriver/res/chat/6.ico b/src/mir_app/res/chat/6.ico Binary files differindex 8a681faeb7..8a681faeb7 100644 --- a/plugins/Scriver/res/chat/6.ico +++ b/src/mir_app/res/chat/6.ico diff --git a/src/mir_app/res/resource.rc b/src/mir_app/res/resource.rc index 8a87c31d8d..f26b13ec84 100644 --- a/src/mir_app/res/resource.rc +++ b/src/mir_app/res/resource.rc @@ -1407,6 +1407,17 @@ IDI_SOUND ICON "sound.ico" IDI_DATABASE ICON "database.ico"
+IDI_STATUS0 ICON "chat/1.ico"
+
+IDI_STATUS1 ICON "chat/2.ico"
+
+IDI_STATUS2 ICON "chat/3.ico"
+
+IDI_STATUS3 ICON "chat/4.ico"
+
+IDI_STATUS4 ICON "chat/5.ico"
+
+IDI_STATUS5 ICON "chat/6.ico"
/////////////////////////////////////////////////////////////////////////////
//
diff --git a/src/mir_app/src/chat.h b/src/mir_app/src/chat.h index 790bb5ec18..88f9660f17 100644 --- a/src/mir_app/src/chat.h +++ b/src/mir_app/src/chat.h @@ -35,6 +35,7 @@ extern int g_cbSession, g_cbModuleInfo, g_iFontMode; extern wchar_t *g_szFontGroup;
extern mir_cs csChat;
+extern HICON g_hChatIcons[20];
extern DWORD g_dwDiskLogFlags;
extern HCURSOR g_hCurHyperlinkHand;
extern char* pLogIconBmpBits[14];
diff --git a/src/mir_app/src/chat_log.cpp b/src/mir_app/src/chat_log.cpp index ff61461d4f..86072e9ccb 100644 --- a/src/mir_app/src/chat_log.cpp +++ b/src/mir_app/src/chat_log.cpp @@ -435,7 +435,7 @@ void LoadMsgLogBitmaps(void) pLogIconBmpBits[i] = (char*)mir_alloc(size);
size_t rtfHeaderSize = mir_snprintf((char *)pLogIconBmpBits[i], size, "{\\pict\\dibitmap0\\wbmbitspixel%u\\wbmplanes1\\wbmwidthbytes%u\\picw%u\\pich%u ", bih.biBitCount, widthBytes, bih.biWidth, bih.biHeight);
- HICON hIcon = g_chatApi.hIcons[i];
+ HICON hIcon = g_hChatIcons[i];
HBITMAP hoBmp = (HBITMAP)SelectObject(hdcMem, hBmp);
FillRect(hdcMem, &rc, hBkgBrush);
DrawIconEx(hdcMem, 0, 0, hIcon, bih.biWidth, bih.biHeight, 0, nullptr, DI_NORMAL);
diff --git a/src/mir_app/src/chat_manager.cpp b/src/mir_app/src/chat_manager.cpp index 9c50e4a51d..07c7ecbbf1 100644 --- a/src/mir_app/src/chat_manager.cpp +++ b/src/mir_app/src/chat_manager.cpp @@ -288,9 +288,9 @@ static HICON SM_GetStatusIcon(SESSION_INFO *si, USERINFO *ui) STATUSINFO *ti = g_chatApi.TM_FindStatus(si->pStatuses, g_chatApi.TM_WordToString(si->pStatuses, ui->Status));
if (ti != nullptr)
- return g_chatApi.hIcons[ICON_STATUS0 + ti->iIconIndex];
+ return g_chatApi.hStatusIcons[ti->iIconIndex];
- return g_chatApi.hIcons[ICON_STATUS0];
+ return g_chatApi.hStatusIcons[0];
}
BOOL SM_AddEvent(const wchar_t *pszID, const char *pszModule, GCEVENT *gce, bool bIsHighlighted)
@@ -997,6 +997,7 @@ MIR_APP_DLL(CHAT_MANAGER*) Chat_CustomizeApi(const CHAT_MANAGER_INITDATA *pInit) ResetApi();
+ LoadChatIcons();
RegisterFonts();
OptionsInit();
return &g_chatApi;
diff --git a/src/mir_app/src/chat_opts.cpp b/src/mir_app/src/chat_opts.cpp index c05953a187..b5078a8778 100644 --- a/src/mir_app/src/chat_opts.cpp +++ b/src/mir_app/src/chat_opts.cpp @@ -26,6 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. extern SESSION_INFO g_TabSession;
+HICON g_hChatIcons[20];
DWORD g_dwDiskLogFlags;
HPLUGIN g_pChatPlugin;
GlobalLogSettingsBase *g_Settings;
diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp index 36422461a6..c3a3f69005 100644 --- a/src/mir_app/src/chat_svc.cpp +++ b/src/mir_app/src/chat_svc.cpp @@ -49,26 +49,27 @@ static HANDLE void LoadChatIcons(void)
{
- g_chatApi.hIcons[ICON_ACTION] = LoadIconEx("log_action", FALSE);
- g_chatApi.hIcons[ICON_ADDSTATUS] = LoadIconEx("log_addstatus", FALSE);
- g_chatApi.hIcons[ICON_HIGHLIGHT] = LoadIconEx("log_highlight", FALSE);
- g_chatApi.hIcons[ICON_INFO] = LoadIconEx("log_info", FALSE);
- g_chatApi.hIcons[ICON_JOIN] = LoadIconEx("log_join", FALSE);
- g_chatApi.hIcons[ICON_KICK] = LoadIconEx("log_kick", FALSE);
- g_chatApi.hIcons[ICON_MESSAGE] = LoadIconEx("log_message_in", FALSE);
- g_chatApi.hIcons[ICON_MESSAGEOUT] = LoadIconEx("log_message_out", FALSE);
- g_chatApi.hIcons[ICON_NICK] = LoadIconEx("log_nick", FALSE);
- g_chatApi.hIcons[ICON_NOTICE] = LoadIconEx("log_notice", FALSE);
- g_chatApi.hIcons[ICON_PART] = LoadIconEx("log_part", FALSE);
- g_chatApi.hIcons[ICON_QUIT] = LoadIconEx("log_quit", FALSE);
- g_chatApi.hIcons[ICON_REMSTATUS] = LoadIconEx("log_removestatus", FALSE);
- g_chatApi.hIcons[ICON_TOPIC] = LoadIconEx("log_topic", FALSE);
- g_chatApi.hIcons[ICON_STATUS0] = LoadIconEx("status0", FALSE);
- g_chatApi.hIcons[ICON_STATUS1] = LoadIconEx("status1", FALSE);
- g_chatApi.hIcons[ICON_STATUS2] = LoadIconEx("status2", FALSE);
- g_chatApi.hIcons[ICON_STATUS3] = LoadIconEx("status3", FALSE);
- g_chatApi.hIcons[ICON_STATUS4] = LoadIconEx("status4", FALSE);
- g_chatApi.hIcons[ICON_STATUS5] = LoadIconEx("status5", FALSE);
+ g_hChatIcons[ICON_ACTION] = LoadIconEx("log_action", FALSE);
+ g_hChatIcons[ICON_ADDSTATUS] = LoadIconEx("log_addstatus", FALSE);
+ g_hChatIcons[ICON_HIGHLIGHT] = LoadIconEx("log_highlight", FALSE);
+ g_hChatIcons[ICON_INFO] = LoadIconEx("log_info", FALSE);
+ g_hChatIcons[ICON_JOIN] = LoadIconEx("log_join", FALSE);
+ g_hChatIcons[ICON_KICK] = LoadIconEx("log_kick", FALSE);
+ g_hChatIcons[ICON_MESSAGE] = LoadIconEx("log_message_in", FALSE);
+ g_hChatIcons[ICON_MESSAGEOUT] = LoadIconEx("log_message_out", FALSE);
+ g_hChatIcons[ICON_NICK] = LoadIconEx("log_nick", FALSE);
+ g_hChatIcons[ICON_NOTICE] = LoadIconEx("log_notice", FALSE);
+ g_hChatIcons[ICON_PART] = LoadIconEx("log_part", FALSE);
+ g_hChatIcons[ICON_QUIT] = LoadIconEx("log_quit", FALSE);
+ g_hChatIcons[ICON_REMSTATUS] = LoadIconEx("log_removestatus", FALSE);
+ g_hChatIcons[ICON_TOPIC] = LoadIconEx("log_topic", FALSE);
+
+ g_chatApi.hStatusIcons[0] = g_plugin.getIcon(IDI_STATUS0);
+ g_chatApi.hStatusIcons[1] = g_plugin.getIcon(IDI_STATUS1);
+ g_chatApi.hStatusIcons[2] = g_plugin.getIcon(IDI_STATUS2);
+ g_chatApi.hStatusIcons[3] = g_plugin.getIcon(IDI_STATUS3);
+ g_chatApi.hStatusIcons[4] = g_plugin.getIcon(IDI_STATUS4);
+ g_chatApi.hStatusIcons[5] = g_plugin.getIcon(IDI_STATUS5);
FreeMsgLogBitmaps();
LoadMsgLogBitmaps();
@@ -862,6 +863,18 @@ static int ModulesLoaded(WPARAM, LPARAM) return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
+static IconItem iconList[] =
+{
+ { LPGEN("Status 1 (10x10)"), "status0", IDI_STATUS0, 10 },
+ { LPGEN("Status 2 (10x10)"), "status1", IDI_STATUS1, 10 },
+ { LPGEN("Status 3 (10x10)"), "status2", IDI_STATUS2, 10 },
+ { LPGEN("Status 4 (10x10)"), "status3", IDI_STATUS3, 10 },
+ { LPGEN("Status 5 (10x10)"), "status4", IDI_STATUS4, 10 },
+ { LPGEN("Status 6 (10x10)"), "status5", IDI_STATUS5, 10 }
+};
+
static bool bInited = false;
int LoadChatModule(void)
@@ -879,6 +892,8 @@ int LoadChatModule(void) g_chatApi.hevPreCreate = CreateHookableEvent(ME_MSG_PRECREATEEVENT);
g_chatApi.hevWinPopup = CreateHookableEvent(ME_MSG_WINDOWPOPUP);
+ g_plugin.registerIcon(LPGEN("Messaging") "/" LPGEN("Group chats"), iconList, "chat");
+
g_plugin.addSound("ChatHighlight", LPGENW("Group chats"), LPGENW("Message is highlighted"));
g_plugin.addSound("ChatAction", LPGENW("Group chats"), LPGENW("User has performed an action"));
g_plugin.addSound("ChatJoin", LPGENW("Group chats"), LPGENW("User has joined"));
diff --git a/src/mir_app/src/chat_tools.cpp b/src/mir_app/src/chat_tools.cpp index 8bd5321b66..980fcd2ea8 100644 --- a/src/mir_app/src/chat_tools.cpp +++ b/src/mir_app/src/chat_tools.cpp @@ -101,23 +101,22 @@ wchar_t* RemoveFormatting(const wchar_t *pszWord) HICON CHAT_MANAGER::getIcon(int iEventType) const
{
+ if (iEventType & GC_EVENT_HIGHLIGHT)
+ return g_hChatIcons[ICON_HIGHLIGHT];
+
switch (iEventType) {
- case GC_EVENT_MESSAGE | GC_EVENT_HIGHLIGHT:
- case GC_EVENT_ACTION | GC_EVENT_HIGHLIGHT:
- return hIcons[ICON_HIGHLIGHT];
-
- case GC_EVENT_MESSAGE: return g_chatApi.hIcons[ICON_MESSAGE];
- case GC_EVENT_ACTION: return g_chatApi.hIcons[ICON_ACTION];
- case GC_EVENT_JOIN: return g_chatApi.hIcons[ICON_JOIN];
- case GC_EVENT_PART: return g_chatApi.hIcons[ICON_PART];
- case GC_EVENT_QUIT: return g_chatApi.hIcons[ICON_QUIT];
- case GC_EVENT_NICK: return g_chatApi.hIcons[ICON_NICK];
- case GC_EVENT_KICK: return g_chatApi.hIcons[ICON_KICK];
- case GC_EVENT_NOTICE: return g_chatApi.hIcons[ICON_NOTICE];
- case GC_EVENT_TOPIC: return g_chatApi.hIcons[ICON_TOPIC];
- case GC_EVENT_INFORMATION: return g_chatApi.hIcons[ICON_INFO];
- case GC_EVENT_ADDSTATUS: return g_chatApi.hIcons[ICON_ADDSTATUS];
- case GC_EVENT_REMOVESTATUS: return g_chatApi.hIcons[ICON_REMSTATUS];
+ case GC_EVENT_MESSAGE: return g_hChatIcons[ICON_MESSAGE];
+ case GC_EVENT_ACTION: return g_hChatIcons[ICON_ACTION];
+ case GC_EVENT_JOIN: return g_hChatIcons[ICON_JOIN];
+ case GC_EVENT_PART: return g_hChatIcons[ICON_PART];
+ case GC_EVENT_QUIT: return g_hChatIcons[ICON_QUIT];
+ case GC_EVENT_NICK: return g_hChatIcons[ICON_NICK];
+ case GC_EVENT_KICK: return g_hChatIcons[ICON_KICK];
+ case GC_EVENT_NOTICE: return g_hChatIcons[ICON_NOTICE];
+ case GC_EVENT_TOPIC: return g_hChatIcons[ICON_TOPIC];
+ case GC_EVENT_INFORMATION: return g_hChatIcons[ICON_INFO];
+ case GC_EVENT_ADDSTATUS: return g_hChatIcons[ICON_ADDSTATUS];
+ case GC_EVENT_REMOVESTATUS: return g_hChatIcons[ICON_REMSTATUS];
default:
return nullptr;
}
diff --git a/src/mir_app/src/resource.h b/src/mir_app/src/resource.h index 776a7ee737..e8d0a5bb05 100644 --- a/src/mir_app/src/resource.h +++ b/src/mir_app/src/resource.h @@ -171,6 +171,12 @@ #define IDI_AUTH_REVOKE 327
#define IDI_SOUND 328
#define IDI_DATABASE 329
+#define IDI_STATUS0 330
+#define IDI_STATUS1 331
+#define IDI_STATUS2 332
+#define IDI_STATUS3 333
+#define IDI_STATUS4 334
+#define IDI_STATUS5 335
#define IDI_ONTHEPHONE 1002
#define IDC_MESSAGE 1002
#define IDC_LANGINFOFRAME 1002
|