From 00c78ff657f997727c6ed7a66edde98c6036ed30 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 12 Apr 2019 19:18:33 +0300 Subject: wiping custom icolib functions: IRC --- protocols/IRCG/src/clist.cpp | 2 +- protocols/IRCG/src/ircproto.cpp | 2 +- protocols/IRCG/src/options.cpp | 36 +++++++++--------------------------- protocols/IRCG/src/services.cpp | 18 +++++++++--------- protocols/IRCG/src/stdafx.h | 2 -- protocols/IRCG/src/windows.cpp | 22 +++++++++++----------- 6 files changed, 31 insertions(+), 51 deletions(-) diff --git a/protocols/IRCG/src/clist.cpp b/protocols/IRCG/src/clist.cpp index 4cffc5dd14..02739d42e0 100644 --- a/protocols/IRCG/src/clist.cpp +++ b/protocols/IRCG/src/clist.cpp @@ -66,7 +66,7 @@ BOOL CIrcProto::CList_AddDCCChat(const CMStringW& name, const CMStringW& hostmas cle.hContact = hContact; cle.hDbEvent = -100; cle.flags = CLEF_UNICODE; - cle.hIcon = LoadIconEx(IDI_DCC); + cle.hIcon = g_plugin.getIcon(IDI_DCC); mir_snprintf(szService, "%s/DblClickEvent", m_szModuleName); cle.pszService = szService; mir_snwprintf(szNick, TranslateT("CTCP chat request from %s"), name.c_str()); diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp index 83225e0699..d05c5a5027 100644 --- a/protocols/IRCG/src/ircproto.cpp +++ b/protocols/IRCG/src/ircproto.cpp @@ -706,7 +706,7 @@ int CIrcProto::SetStatusInternal(int iNewStatus, bool bIsInternal) SetWindowTextA(hwnd, "Miranda IRC"); SetDlgItemText(hwnd, IDC_TEXT, TranslateT("Please choose an IRC-network to go online. This network will be the default.")); SetDlgItemText(hwnd, IDC_CAPTION, TranslateT("Default network")); - Window_SetIcon_IcoLib(hwnd, GetIconHandle(IDI_MAIN)); + Window_SetIcon_IcoLib(hwnd, g_plugin.getIconHandle(IDI_MAIN)); ShowWindow(hwnd, SW_SHOW); SetActiveWindow(hwnd); } diff --git a/protocols/IRCG/src/options.cpp b/protocols/IRCG/src/options.cpp index accfb1ac39..1ce7754a22 100644 --- a/protocols/IRCG/src/options.cpp +++ b/protocols/IRCG/src/options.cpp @@ -212,24 +212,6 @@ void InitIcons(void) g_plugin.registerIcon("Protocols/IRC", iconList, "IRC"); } -HICON LoadIconEx(int iconId, bool big) -{ - for (auto &it : iconList) - if (it.defIconID == iconId) - return IcoLib_GetIconByHandle(it.hIcolib, big); - - return nullptr; -} - -HANDLE GetIconHandle(int iconId) -{ - for (auto &it : iconList) - if (it.defIconID == iconId) - return it.hIcolib; - - return nullptr; -} - ///////////////////////////////////////////////////////////////////////////////////////// // code page handler @@ -437,16 +419,16 @@ static TDbSetting ConnectSettings[] = { FIELD_OFFSET(CIrcProto, m_autoOnlineNotification), "AutoOnlineNotification", DBVT_BYTE }, }; -CConnectPrefsDlg::CConnectPrefsDlg(CIrcProto* _pro) +CConnectPrefsDlg::CConnectPrefsDlg(CIrcProto *_pro) : CProtoDlgBase(_pro, IDD_PREFS_CONNECT), m_serverCombo(this, IDC_SERVERCOMBO), m_server(this, IDC_SERVER), m_port(this, IDC_PORT), m_port2(this, IDC_PORT2), m_pass(this, IDC_PASS), - m_add(this, IDC_ADDSERVER, LoadIconEx(IDI_ADD), LPGEN("Add a new network")), - m_edit(this, IDC_EDITSERVER, LoadIconEx(IDI_EDIT), LPGEN("Edit this network")), - m_del(this, IDC_DELETESERVER, LoadIconEx(IDI_DELETE), LPGEN("Delete this network")), + m_add(this, IDC_ADDSERVER, g_plugin.getIcon(IDI_ADD), LPGEN("Add a new network")), + m_edit(this, IDC_EDITSERVER, g_plugin.getIcon(IDI_EDIT), LPGEN("Edit this network")), + m_del(this, IDC_DELETESERVER, g_plugin.getIcon(IDI_DELETE), LPGEN("Delete this network")), m_nick(this, IDC_NICK), m_nick2(this, IDC_NICK2), m_name(this, IDC_NAME), @@ -989,8 +971,8 @@ COtherPrefsDlg::COtherPrefsDlg(CIrcProto *_pro) : m_autodetect(this, IDC_UTF_AUTODETECT), m_quitMessage(this, IDC_QUITMESSAGE), m_alias(this, IDC_ALIASEDIT), - m_add(this, IDC_ADD, LoadIconEx(IDI_ADD), LPGEN("Click to set commands that will be performed for this event")), - m_delete(this, IDC_DELETE, LoadIconEx(IDI_DELETE), LPGEN("Click to delete the commands for this event")), + m_add(this, IDC_ADD, g_plugin.getIcon(IDI_ADD), LPGEN("Click to set commands that will be performed for this event")), + m_delete(this, IDC_DELETE, g_plugin.getIcon(IDI_DELETE), LPGEN("Click to delete the commands for this event")), m_performlistModified(false) { m_performCombo.OnChange = Callback(this, &COtherPrefsDlg::OnPerformCombo); @@ -1395,9 +1377,9 @@ void CIrcProto::RewriteIgnoreSettings(void) CIgnorePrefsDlg::CIgnorePrefsDlg(CIrcProto* _pro) : CProtoDlgBase(_pro, IDD_PREFS_IGNORE), m_list(this, IDC_LIST), - m_add(this, IDC_ADD, LoadIconEx(IDI_ADD), LPGEN("Add new ignore")), - m_edit(this, IDC_EDIT, LoadIconEx(IDI_EDIT), LPGEN("Edit this ignore")), - m_del(this, IDC_DELETE, LoadIconEx(IDI_DELETE), LPGEN("Delete this ignore")), + m_add(this, IDC_ADD, g_plugin.getIcon(IDI_ADD), LPGEN("Add new ignore")), + m_edit(this, IDC_EDIT, g_plugin.getIcon(IDI_EDIT), LPGEN("Edit this ignore")), + m_del(this, IDC_DELETE, g_plugin.getIcon(IDI_DELETE), LPGEN("Delete this ignore")), m_enable(this, IDC_ENABLEIGNORE), m_ignoreChat(this, IDC_IGNORECHAT), m_ignoreFile(this, IDC_IGNOREFILE), diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp index fe3908b465..8b91562f6f 100644 --- a/protocols/IRCG/src/services.cpp +++ b/protocols/IRCG/src/services.cpp @@ -27,7 +27,7 @@ void CIrcProto::OnBuildProtoMenu() mi.root = Menu_GetProtocolRoot(this); mi.name.a = LPGEN("&Quick connect"); - mi.hIcolibItem = GetIconHandle(IDI_QUICK); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_QUICK); mi.pszService = IRC_QUICKCONNECT; mi.position = 201001; hMenuQuick = Menu_AddProtoMenuItem(&mi, m_szModuleName); @@ -41,20 +41,20 @@ void CIrcProto::OnBuildProtoMenu() hMenuJoin = Menu_AddProtoMenuItem(&mi, m_szModuleName); mi.name.a = LPGEN("&Change your nickname"); - mi.hIcolibItem = GetIconHandle(IDI_RENAME); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_RENAME); mi.pszService = IRC_CHANGENICK; mi.position = 201003; hMenuNick = Menu_AddProtoMenuItem(&mi, m_szModuleName); mi.name.a = LPGEN("Show the &list of available channels"); - mi.hIcolibItem = GetIconHandle(IDI_LIST); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_LIST); mi.pszService = IRC_SHOWLIST; mi.position = 201004; hMenuList = Menu_AddProtoMenuItem(&mi, m_szModuleName); if (m_useServer) mi.flags &= ~CMIF_GRAYED; mi.name.a = LPGEN("&Show the server window"); - mi.hIcolibItem = GetIconHandle(IDI_SERVER); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_SERVER); mi.pszService = IRC_SHOWSERVER; mi.position = 201005; hMenuServer = Menu_AddProtoMenuItem(&mi, m_szModuleName); @@ -109,7 +109,7 @@ void InitContactMenus(void) SET_UID(mi, 0x5f01196f, 0xfbcd, 0x4034, 0xbd, 0x90, 0x12, 0xa0, 0x20, 0x68, 0x15, 0xc0); mi.name.a = LPGEN("Channel &settings"); - mi.hIcolibItem = GetIconHandle(IDI_MANAGER); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_MANAGER); mir_strcpy(d, IRC_UM_CHANSETTINGS); mi.position = 500090002; hUMenuChanSettings = Menu_AddContactMenuItem(&mi); @@ -117,7 +117,7 @@ void InitContactMenus(void) SET_UID(mi, 0x778eb1f6, 0x73c4, 0x4951, 0xb2, 0xca, 0xa1, 0x69, 0x94, 0x7b, 0xb7, 0x87); mi.name.a = LPGEN("&WhoIs info"); - mi.hIcolibItem = GetIconHandle(IDI_WHOIS); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_WHOIS); mir_strcpy(d, IRC_UM_WHOIS); mi.position = 500090001; hUMenuWhois = Menu_AddContactMenuItem(&mi); @@ -125,7 +125,7 @@ void InitContactMenus(void) SET_UID(mi, 0x1c51ae05, 0x9eee, 0x4887, 0x88, 0x96, 0x55, 0xd2, 0xdd, 0xf9, 0x25, 0x6f); mi.name.a = LPGEN("Di&sconnect"); - mi.hIcolibItem = GetIconHandle(IDI_DELETE); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_DELETE); mir_strcpy(d, IRC_UM_DISCONNECT); mi.position = 500090001; hUMenuDisconnect = Menu_AddContactMenuItem(&mi); @@ -133,7 +133,7 @@ void InitContactMenus(void) SET_UID(mi, 0xc6169b8f, 0x53ab, 0x4242, 0xbe, 0x90, 0xe2, 0x4a, 0xa5, 0x73, 0x88, 0x32); mi.name.a = LPGEN("&Add to ignore list"); - mi.hIcolibItem = GetIconHandle(IDI_BLOCK); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_BLOCK); mir_strcpy(d, IRC_UM_IGNORE); mi.position = 500090002; hUMenuIgnore = Menu_AddContactMenuItem(&mi); @@ -324,7 +324,7 @@ INT_PTR __cdecl CIrcProto::OnQuickConnectMenuCommand(WPARAM, LPARAM) SetWindowText(m_quickDlg->GetHwnd(), TranslateT("Quick connect")); SetDlgItemText(m_quickDlg->GetHwnd(), IDC_TEXT, TranslateT("Please select IRC network and enter the password if needed")); SetDlgItemText(m_quickDlg->GetHwnd(), IDC_CAPTION, TranslateT("Quick connect")); - Window_SetIcon_IcoLib(m_quickDlg->GetHwnd(), GetIconHandle(IDI_QUICK)); + Window_SetIcon_IcoLib(m_quickDlg->GetHwnd(), g_plugin.getIconHandle(IDI_QUICK)); } ShowWindow(m_quickDlg->GetHwnd(), SW_SHOW); diff --git a/protocols/IRCG/src/stdafx.h b/protocols/IRCG/src/stdafx.h index 37343328b9..4f79b0249a 100644 --- a/protocols/IRCG/src/stdafx.h +++ b/protocols/IRCG/src/stdafx.h @@ -219,8 +219,6 @@ void InitContactMenus(void); void UninitContactMenus(void); void InitIcons(void); -HICON LoadIconEx(int iIndex, bool big = false); -HANDLE GetIconHandle(int iconId); // tools.cpp int __stdcall WCCmp(const wchar_t* wild, const wchar_t* string); diff --git a/protocols/IRCG/src/windows.cpp b/protocols/IRCG/src/windows.cpp index 252417b914..c1f4aa254b 100644 --- a/protocols/IRCG/src/windows.cpp +++ b/protocols/IRCG/src/windows.cpp @@ -87,7 +87,7 @@ bool CWhoisDlg::OnInitDialog() CCoolIrcDlg::OnInitDialog(); - Window_SetIcon_IcoLib(m_hwnd, GetIconHandle(IDI_WHOIS)); + Window_SetIcon_IcoLib(m_hwnd, g_plugin.getIconHandle(IDI_WHOIS)); return true; } @@ -210,7 +210,7 @@ CNickDlg::CNickDlg(CIrcProto *_pro) bool CNickDlg::OnInitDialog() { CCoolIrcDlg::OnInitDialog(); - Window_SetIcon_IcoLib(m_hwnd, GetIconHandle(IDI_RENAME)); + Window_SetIcon_IcoLib(m_hwnd, g_plugin.getIconHandle(IDI_RENAME)); DBVARIANT dbv; if (!m_proto->getWString("RecentNicks", &dbv)) { @@ -296,7 +296,7 @@ bool CListDlg::OnInitDialog() m_list.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT); m_list2.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT); - Window_SetIcon_IcoLib(m_hwnd, GetIconHandle(IDI_LIST)); + Window_SetIcon_IcoLib(m_hwnd, g_plugin.getIconHandle(IDI_LIST)); m_status.SetText(TranslateT("Please wait...")); return true; } @@ -724,7 +724,7 @@ bool CQuestionDlg::OnInitDialog() { CCoolIrcDlg::OnInitDialog(); - Window_SetIcon_IcoLib(m_hwnd, GetIconHandle(IDI_IRCQUESTION)); + Window_SetIcon_IcoLib(m_hwnd, g_plugin.getIconHandle(IDI_IRCQUESTION)); return true; } @@ -808,11 +808,11 @@ CManagerDlg::CManagerDlg(CIrcProto *_pro) m_limit(this, IDC_LIMIT), m_topic(this, IDC_TOPIC), - m_add(this, IDC_ADD, LoadIconEx(IDI_ADD), LPGEN("Add ban/invite/exception")), - m_edit(this, IDC_EDIT, LoadIconEx(IDI_EDIT), LPGEN("Edit selected ban/invite/exception")), - m_remove(this, IDC_REMOVE, LoadIconEx(IDI_DELETE), LPGEN("Delete selected ban/invite/exception")), - m_applyModes(this, IDC_APPLYMODES, LoadIconEx(IDI_APPLY), LPGEN("Set these modes for the channel")), - m_applyTopic(this, IDC_APPLYTOPIC, LoadIconEx(IDI_APPLY), LPGEN("Set this topic for the channel")), + m_add(this, IDC_ADD, g_plugin.getIcon(IDI_ADD), LPGEN("Add ban/invite/exception")), + m_edit(this, IDC_EDIT, g_plugin.getIcon(IDI_EDIT), LPGEN("Edit selected ban/invite/exception")), + m_remove(this, IDC_REMOVE, g_plugin.getIcon(IDI_DELETE), LPGEN("Delete selected ban/invite/exception")), + m_applyModes(this, IDC_APPLYMODES, g_plugin.getIcon(IDI_APPLY), LPGEN("Set these modes for the channel")), + m_applyTopic(this, IDC_APPLYTOPIC, g_plugin.getIcon(IDI_APPLY), LPGEN("Set this topic for the channel")), m_radio1(this, IDC_RADIO1), m_radio2(this, IDC_RADIO2), @@ -885,7 +885,7 @@ bool CManagerDlg::OnInitDialog() HWND hwndEdit = ChildWindowFromPoint(m_topic.GetHwnd(), pt); mir_subclassWindow(hwndEdit, MgrEditSubclassProc); - Window_SetIcon_IcoLib(m_hwnd, GetIconHandle(IDI_MANAGER)); + Window_SetIcon_IcoLib(m_hwnd, g_plugin.getIconHandle(IDI_MANAGER)); m_list.SendMsg(LB_SETHORIZONTALEXTENT, 750, NULL); m_radio1.SetState(true); @@ -1398,7 +1398,7 @@ bool CCoolIrcDlg::OnInitDialog() hFont = CreateFontIndirect(&lf); SendDlgItemMessage(m_hwnd, IDC_CAPTION, WM_SETFONT, (WPARAM)hFont, 0); - SendDlgItemMessage(m_hwnd, IDC_LOGO, STM_SETICON, (LPARAM)(HICON)LoadIconEx(IDI_LOGO), 0); + SendDlgItemMessage(m_hwnd, IDC_LOGO, STM_SETICON, (LPARAM)(HICON)g_plugin.getIcon(IDI_LOGO), 0); return true; } -- cgit v1.2.3