From 98cc3ea974062d69d7d2f80957724c7997ab21a3 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 12 Apr 2019 20:18:21 +0300 Subject: wiping custom icolib functions: StdMsg --- src/core/stdmsg/src/chat_options.cpp | 91 +++++++++++++++--------------------- src/core/stdmsg/src/chat_window.cpp | 12 ++--- src/core/stdmsg/src/msgs.cpp | 16 +++---- src/core/stdmsg/src/stdafx.h | 2 - src/core/stdmsg/src/tabs.cpp | 2 +- 5 files changed, 53 insertions(+), 70 deletions(-) (limited to 'src/core/stdmsg') diff --git a/src/core/stdmsg/src/chat_options.cpp b/src/core/stdmsg/src/chat_options.cpp index ded9c7b1c7..0248407244 100644 --- a/src/core/stdmsg/src/chat_options.cpp +++ b/src/core/stdmsg/src/chat_options.cpp @@ -137,67 +137,52 @@ static INT CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lp, LPARAM p static IconItem iconList1[] = { - { LPGEN("Window icon"), "chat_window", IDI_CHANMGR, 0 }, - { LPGEN("Text color"), "chat_fgcol", IDI_COLOR, 0 }, - { LPGEN("Background color"), "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 nick list"), "chat_nicklist", IDI_NICKLIST, 0 }, - { LPGEN("Show nick list"), "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("Window icon"), "window", IDI_CHANMGR }, + { LPGEN("Text color"), "fgcol", IDI_COLOR }, + { LPGEN("Background color"), "bkgcol", IDI_BKGCOLOR }, + { LPGEN("Bold"), "bold", IDI_BBOLD }, + { LPGEN("Italics"), "italics", IDI_BITALICS }, + { LPGEN("Underlined"), "underline", IDI_BUNDERLINE }, + { LPGEN("Smiley button"), "smiley", IDI_BSMILEY }, + { LPGEN("Room history"), "history", IDI_HISTORY }, + { LPGEN("Room settings"), "settings", IDI_TOPICBUT }, + { LPGEN("Event filter disabled"), "filter", IDI_FILTER }, + { LPGEN("Event filter enabled"), "filter2", IDI_FILTER2 }, + { LPGEN("Hide nick list"), "nicklist", IDI_NICKLIST }, + { 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[] = { - { 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("Nick change (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 } + { LPGEN("Message in (10x10)"), "log_message_in", IDI_MESSAGE, 10 }, + { LPGEN("Message out (10x10)"), "log_message_out", IDI_MESSAGEOUT, 10 }, + { LPGEN("Action (10x10)"), "log_action", IDI_ACTION, 10 }, + { LPGEN("Add status (10x10)"), "log_addstatus", IDI_ADDSTATUS, 10 }, + { LPGEN("Remove status (10x10)"), "log_removestatus", IDI_REMSTATUS, 10 }, + { LPGEN("Join (10x10)"), "log_join", IDI_JOIN, 10 }, + { LPGEN("Leave (10x10)"), "log_part", IDI_PART, 10 }, + { LPGEN("Quit (10x10)"), "log_quit", IDI_QUIT, 10 }, + { LPGEN("Kick (10x10)"), "log_kick", IDI_KICK, 10 }, + { LPGEN("Nick change (10x10)"), "log_nick", IDI_NICK, 10 }, + { LPGEN("Notice (10x10)"), "log_notice", IDI_NOTICE, 10 }, + { LPGEN("Topic (10x10)"), "log_topic", IDI_TOPIC, 10 }, + { LPGEN("Highlight (10x10)"), "log_highlight", IDI_HIGHLIGHT, 10 }, + { LPGEN("Information (10x10)"), "log_info", IDI_INFO, 10 } }; void AddIcons(void) { - g_plugin.registerIcon(LPGEN("Messaging") "/" LPGEN("Group chats"), iconList1); - g_plugin.registerIcon(LPGEN("Messaging") "/" LPGEN("Group chats log"), iconList2); -} - -// load icons from the skinning module if available -HICON LoadIconEx(const char *pszIcoLibName, bool big) -{ - char szTemp[256]; - mir_snprintf(szTemp, "chat_%s", pszIcoLibName); - return IcoLib_GetIcon(szTemp, big); -} - -HANDLE GetIconHandle(const char *pszIcoLibName) -{ - char szTemp[256]; - mir_snprintf(szTemp, "chat_%s", pszIcoLibName); - return IcoLib_GetIconHandle(szTemp); + g_plugin.registerIcon(LPGEN("Messaging") "/" LPGEN("Group chats"), iconList1, "chat"); + g_plugin.registerIcon(LPGEN("Messaging") "/" LPGEN("Group chats log"), iconList2, "chat"); } ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp index 1ea4206a6d..02662b6d9a 100644 --- a/src/core/stdmsg/src/chat_window.cpp +++ b/src/core/stdmsg/src/chat_window.cpp @@ -113,7 +113,7 @@ void CChatRoomDlg::onClick_Filter(CCtrlButton *pButton) return; m_bFilterEnabled = !m_bFilterEnabled; - m_btnFilter.SendMsg(BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx(m_bFilterEnabled ? "filter" : "filter2", FALSE)); + m_btnFilter.SendMsg(BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(m_bFilterEnabled ? IDI_FILTER : IDI_FILTER2, FALSE)); if (m_bFilterEnabled && db_get_b(0, CHAT_MODULE, "RightClickFilter", 0) == 0) ShowFilterMenu(); else @@ -126,7 +126,7 @@ void CChatRoomDlg::onClick_NickList(CCtrlButton *pButton) return; m_bNicklistEnabled = !m_bNicklistEnabled; - pButton->SendMsg(BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx(m_bNicklistEnabled ? "nicklist" : "nicklist2", FALSE)); + pButton->SendMsg(BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(m_bNicklistEnabled ? IDI_NICKLIST : IDI_NICKLIST2, FALSE)); ScrollToBottom(); Resize(); @@ -271,8 +271,8 @@ void CChatRoomDlg::UpdateNickList() void CChatRoomDlg::UpdateOptions() { - m_btnNickList.SendMsg(BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx(m_bNicklistEnabled ? "nicklist" : "nicklist2", FALSE)); - m_btnFilter.SendMsg(BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx(m_bFilterEnabled ? "filter" : "filter2", FALSE)); + m_btnNickList.SendMsg(BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(m_bNicklistEnabled ? IDI_NICKLIST : IDI_NICKLIST2, FALSE)); + m_btnFilter.SendMsg(BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(m_bFilterEnabled ? IDI_FILTER : IDI_FILTER2, FALSE)); MODULEINFO *mi = m_si->pMI; EnableWindow(m_btnBold.GetHwnd(), mi->bBold); @@ -291,7 +291,7 @@ void CChatRoomDlg::UpdateOptions() SendMessage(m_pOwner->m_hwndStatus, SB_SETICON, 0, (LPARAM)hIcon); - Window_SetIcon_IcoLib(m_pOwner->GetHwnd(), GetIconHandle("window")); + Window_SetIcon_IcoLib(m_pOwner->GetHwnd(), g_plugin.getIconHandle(IDI_CHANMGR)); m_log.SendMsg(EM_SETBKGNDCOLOR, 0, g_Settings.crLogBackground); @@ -1141,7 +1141,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) break; case DM_UPDATETITLE: - if (lParam == 0 || lParam == m_hContact) + if (lParam == 0 || lParam == (LPARAM)m_hContact) UpdateTitle(); break; diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index ac88cf3e9c..84fad84fba 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -387,35 +387,35 @@ int RegisterToolbarIcons(WPARAM, LPARAM) bbd.bbbFlags = BBBF_ISPUSHBUTTON | BBBF_ISCHATBUTTON | BBBF_CREATEBYID; bbd.dwButtonID = IDC_SRMM_BOLD; bbd.dwDefPos = 10; - bbd.hIcon = GetIconHandle("bold"); + bbd.hIcon = g_plugin.getIconHandle(IDI_BBOLD); bbd.pwszText = LPGENW("&Bold"); bbd.pwszTooltip = LPGENW("Make the text bold (Ctrl+B)"); Srmm_AddButton(&bbd, &g_plugin); bbd.dwButtonID = IDC_SRMM_ITALICS; bbd.dwDefPos = 15; - bbd.hIcon = GetIconHandle("italics"); + bbd.hIcon = g_plugin.getIconHandle(IDI_BITALICS); bbd.pwszText = LPGENW("&Italic"); bbd.pwszTooltip = LPGENW("Make the text italicized (Ctrl+I)"); Srmm_AddButton(&bbd, &g_plugin); bbd.dwButtonID = IDC_SRMM_UNDERLINE; bbd.dwDefPos = 20; - bbd.hIcon = GetIconHandle("underline"); + bbd.hIcon = g_plugin.getIconHandle(IDI_BUNDERLINE); bbd.pwszText = LPGENW("&Underline"); bbd.pwszTooltip = LPGENW("Make the text underlined (Ctrl+U)"); Srmm_AddButton(&bbd, &g_plugin); bbd.dwButtonID = IDC_SRMM_COLOR; bbd.dwDefPos = 25; - bbd.hIcon = GetIconHandle("fgcol"); + bbd.hIcon = g_plugin.getIconHandle(IDI_COLOR); bbd.pwszText = LPGENW("&Color"); bbd.pwszTooltip = LPGENW("Select a foreground color for the text (Ctrl+K)"); Srmm_AddButton(&bbd, &g_plugin); bbd.dwButtonID = IDC_SRMM_BKGCOLOR; bbd.dwDefPos = 30; - bbd.hIcon = GetIconHandle("bkgcol"); + bbd.hIcon = g_plugin.getIconHandle(IDI_BKGCOLOR); bbd.pwszText = LPGENW("&Background color"); bbd.pwszTooltip = LPGENW("Select a background color for the text (Ctrl+L)"); Srmm_AddButton(&bbd, &g_plugin); @@ -423,21 +423,21 @@ int RegisterToolbarIcons(WPARAM, LPARAM) bbd.bbbFlags = BBBF_ISCHATBUTTON | BBBF_ISRSIDEBUTTON | BBBF_CREATEBYID; bbd.dwButtonID = IDC_SRMM_CHANMGR; bbd.dwDefPos = 30; - bbd.hIcon = GetIconHandle("settings"); + bbd.hIcon = g_plugin.getIconHandle(IDI_TOPICBUT); bbd.pwszText = LPGENW("&Room settings"); bbd.pwszTooltip = LPGENW("Control this room (Ctrl+O)"); Srmm_AddButton(&bbd, &g_plugin); bbd.dwButtonID = IDC_SRMM_SHOWNICKLIST; bbd.dwDefPos = 20; - bbd.hIcon = GetIconHandle("nicklist"); + bbd.hIcon = g_plugin.getIconHandle(IDI_NICKLIST); bbd.pwszText = LPGENW("&Show/hide nick list"); bbd.pwszTooltip = LPGENW("Show/hide the nick list (Ctrl+N)"); Srmm_AddButton(&bbd, &g_plugin); bbd.dwButtonID = IDC_SRMM_FILTER; bbd.dwDefPos = 10; - bbd.hIcon = GetIconHandle("filter"); + bbd.hIcon = g_plugin.getIconHandle(IDI_FILTER); bbd.pwszText = LPGENW("&Filter"); bbd.pwszTooltip = LPGENW("Enable/disable the event filter (Ctrl+F)"); Srmm_AddButton(&bbd, &g_plugin); diff --git a/src/core/stdmsg/src/stdafx.h b/src/core/stdmsg/src/stdafx.h index 37e5664275..b24778cf89 100644 --- a/src/core/stdmsg/src/stdafx.h +++ b/src/core/stdmsg/src/stdafx.h @@ -134,8 +134,6 @@ SESSION_INFO* SM_GetNextWindow(SESSION_INFO *si); // options.cpp void AddIcons(void); -HICON LoadIconEx(const char *pszIcoLibName, bool big); -HANDLE GetIconHandle(const char *pszIcolibName); // tools.cpp void SetButtonsPos(HWND hwndDlg, bool bIsChat); diff --git a/src/core/stdmsg/src/tabs.cpp b/src/core/stdmsg/src/tabs.cpp index f295a01338..a5f12c1c1b 100644 --- a/src/core/stdmsg/src/tabs.cpp +++ b/src/core/stdmsg/src/tabs.cpp @@ -279,7 +279,7 @@ void CTabbedWindow::FixTabIcons(CMsgDialog *pDlg) if (g_dat.bUseStatusWinIcon) Window_SetProtoIcon_IcoLib(m_hwnd, pDlg->GetProto(), pDlg->GetStatus()); else if (pDlg->isChat()) - Window_SetIcon_IcoLib(m_hwnd, GetIconHandle("window")); + Window_SetIcon_IcoLib(m_hwnd, g_plugin.getIconHandle(IDI_CHANMGR)); else Window_SetSkinIcon_IcoLib(m_hwnd, SKINICON_EVENT_MESSAGE); } -- cgit v1.2.3