From eec361608fde60d63fe4511e26e3b95c7f72be13 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 5 Jun 2016 16:11:08 +0000 Subject: - fix for #1059; - direct unsafe work with icons replaces with Window_SetIcon_IcoLib / Window_SetSkinIcon_IcoLib; - code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@16917 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- bin10/lib/mir_app.lib | Bin 71170 -> 71436 bytes bin10/lib/mir_app64.lib | Bin 68716 -> 68966 bytes bin12/lib/mir_app.lib | Bin 71170 -> 71436 bytes bin12/lib/mir_app64.lib | Bin 68716 -> 68966 bytes bin14/lib/mir_app.lib | Bin 71170 -> 71436 bytes bin14/lib/mir_app64.lib | Bin 68716 -> 68966 bytes include/m_icolib.h | 3 +- plugins/AddContactPlus/src/addcontact.cpp | 11 +- plugins/BasicHistory/src/HistoryWindow.cpp | 12 +- plugins/Clist_nicer/src/clistmenus.cpp | 2 +- plugins/CrashDumper/src/ui.cpp | 10 +- plugins/Db3x_mmap/src/ui.cpp | 2 +- plugins/FTPFileYM/src/dialog.cpp | 2 +- plugins/FTPFileYM/src/manager.cpp | 2 +- plugins/FTPFileYM/src/utils.cpp | 9 +- plugins/FTPFileYM/src/utils.h | 4 +- plugins/FileAsMessage/src/dialog.cpp | 11 +- plugins/FileAsMessage/src/main.cpp | 5 +- plugins/FileAsMessage/src/main.h | 1 + plugins/Import/src/wizard.cpp | 3 +- plugins/MyDetails/src/services.cpp | 178 ++++----- plugins/NewAwaySysMod/src/ReadAwayMsg.cpp | 7 +- plugins/NewAwaySysMod/src/SetAwayMsg.cpp | 10 +- plugins/NotesAndReminders/src/notes.cpp | 12 +- plugins/NotesAndReminders/src/reminders.cpp | 8 +- plugins/PluginUpdater/src/DlgListNew.cpp | 6 +- plugins/PluginUpdater/src/DlgUpdate.cpp | 5 +- plugins/Popup/src/history.cpp | 3 +- plugins/Quotes/src/CurrencyConverter.cpp | 9 +- plugins/SMS/src/senddlg.cpp | 2 +- plugins/SeenPlugin/src/history.cpp | 3 +- plugins/SeenPlugin/src/stdafx.h | 1 + plugins/SendScreenshotPlus/src/CSend.cpp | 2 +- plugins/SendScreenshotPlus/src/UAboutForm.cpp | 3 +- plugins/SendScreenshotPlus/src/UMainForm.cpp | 4 +- plugins/SimpleStatusMsg/src/awaymsg.cpp | 196 +++++---- plugins/SimpleStatusMsg/src/msgbox.cpp | 10 +- plugins/SpellChecker/src/ardialog.cpp | 4 +- plugins/TabSRMM/src/containeroptions.cpp | 548 +++++++++++++------------- plugins/TabSRMM/src/generic_msghandlers.cpp | 2 +- plugins/TabSRMM/src/utils.cpp | 3 +- plugins/UserInfoEx/src/dlg_propsheet.cpp | 4 +- plugins/Weather/src/weather_ini.cpp | 6 +- plugins/Weather/src/weather_userinfo.cpp | 12 +- plugins/WhenWasIt/src/dlg_handlers.cpp | 12 +- plugins/YAMN/src/browser/badconnect.cpp | 3 +- plugins/YAMN/src/browser/mailbrowser.cpp | 11 +- plugins/YAPP/src/yapp_history_dlg.cpp | 5 +- protocols/AimOscar/src/theme.cpp | 22 +- protocols/AimOscar/src/theme.h | 2 - protocols/AimOscar/src/ui.cpp | 9 +- protocols/Dummy/src/dummy_options.cpp | 6 +- protocols/FacebookRM/src/captcha.cpp | 6 +- protocols/FacebookRM/src/dialogs.cpp | 5 +- protocols/Gadu-Gadu/src/gg.h | 2 - protocols/Gadu-Gadu/src/groupchat.cpp | 7 +- protocols/Gadu-Gadu/src/icolib.cpp | 12 - protocols/Gadu-Gadu/src/image.cpp | 6 +- protocols/Gadu-Gadu/src/sessions.cpp | 4 +- protocols/Gadu-Gadu/src/userutils.cpp | 4 +- protocols/IRCG/src/ircproto.cpp | 2 +- protocols/IRCG/src/options.cpp | 18 - protocols/IRCG/src/services.cpp | 2 +- protocols/IRCG/src/stdafx.h | 6 +- protocols/IRCG/src/windows.cpp | 14 +- protocols/IcqOscarJ/src/icq_firstrun.cpp | 6 +- protocols/IcqOscarJ/src/icq_xstatus.cpp | 6 +- protocols/IcqOscarJ/src/loginpassword.cpp | 6 +- protocols/JabberG/src/jabber_adhoc.cpp | 2 +- protocols/JabberG/src/jabber_captcha.cpp | 5 +- protocols/JabberG/src/jabber_chat.cpp | 6 +- protocols/JabberG/src/jabber_console.cpp | 14 +- protocols/JabberG/src/jabber_form.cpp | 2 +- protocols/JabberG/src/jabber_frame.cpp | 6 +- protocols/JabberG/src/jabber_groupchat.cpp | 2 +- protocols/JabberG/src/jabber_icolib.cpp | 16 +- protocols/JabberG/src/jabber_opt.cpp | 57 ++- protocols/JabberG/src/jabber_password.cpp | 2 +- protocols/JabberG/src/jabber_privacy.cpp | 8 +- protocols/JabberG/src/jabber_treelist.cpp | 2 +- protocols/JabberG/src/jabber_userinfo.cpp | 7 +- protocols/JabberG/src/jabber_xstatus.cpp | 2 +- protocols/JabberG/src/stdafx.h | 19 +- protocols/MRA/src/Mra_functions.cpp | 2 +- protocols/MSN/src/msn_menu.cpp | 3 +- protocols/Steam/src/steam_dialogs.cpp | 9 +- protocols/Tlen/src/stdafx.h | 2 + protocols/Tlen/src/tlen.cpp | 2 +- protocols/Tlen/src/tlen_svc.cpp | 7 +- protocols/Tox/src/tox_multimedia.cpp | 3 +- protocols/VKontakte/src/vk_dialogs.cpp | 12 +- protocols/Yahoo/src/chat.cpp | 12 +- protocols/Yahoo/src/services.cpp | 9 +- protocols/Yahoo/src/stdafx.h | 1 + protocols/Yahoo/src/user_info.cpp | 4 - src/core/stdchat/src/options.cpp | 7 + src/core/stdchat/src/stdafx.h | 1 + src/core/stdchat/src/window.cpp | 3 +- src/core/stdfile/src/filerecvdlg.cpp | 2 +- src/core/stdfile/src/filesenddlg.cpp | 2 +- src/core/stdfile/src/ftmanager.cpp | 2 +- src/core/stdhelp/src/about.cpp | 2 +- src/core/stdmsg/src/msgdialog.cpp | 6 +- src/core/stdmsg/src/msgs.h | 1 + src/core/stdmsg/src/msgtimedout.cpp | 4 +- src/core/stduihist/src/history.cpp | 2 +- src/core/stduserinfo/src/userinfo.cpp | 2 +- src/mir_app/src/addcontact.cpp | 2 +- src/mir_app/src/enterstring.cpp | 3 +- src/mir_app/src/findadd.cpp | 2 +- src/mir_app/src/icolib.cpp | 18 +- src/mir_app/src/meta_addto.cpp | 4 +- src/mir_app/src/meta_edit.cpp | 10 +- src/mir_app/src/meta_main.cpp | 6 +- src/mir_app/src/meta_menu.cpp | 18 +- src/mir_app/src/metacontacts.h | 4 +- src/mir_app/src/mir_app.def | 3 +- src/mir_app/src/mir_app64.def | 3 +- src/mir_app/src/options.cpp | 2 +- src/mir_app/src/profilemanager.cpp | 1 + src/mir_app/src/proto_opts.cpp | 2 +- src/mir_app/src/proto_ui.cpp | 3 +- src/mir_app/src/skinicons.cpp | 20 +- 123 files changed, 755 insertions(+), 887 deletions(-) diff --git a/bin10/lib/mir_app.lib b/bin10/lib/mir_app.lib index 0a10ea673b..b70e0fd8f2 100644 Binary files a/bin10/lib/mir_app.lib and b/bin10/lib/mir_app.lib differ diff --git a/bin10/lib/mir_app64.lib b/bin10/lib/mir_app64.lib index 6e0db7fe4b..757ed886fc 100644 Binary files a/bin10/lib/mir_app64.lib and b/bin10/lib/mir_app64.lib differ diff --git a/bin12/lib/mir_app.lib b/bin12/lib/mir_app.lib index 0a10ea673b..b70e0fd8f2 100644 Binary files a/bin12/lib/mir_app.lib and b/bin12/lib/mir_app.lib differ diff --git a/bin12/lib/mir_app64.lib b/bin12/lib/mir_app64.lib index 6e0db7fe4b..757ed886fc 100644 Binary files a/bin12/lib/mir_app64.lib and b/bin12/lib/mir_app64.lib differ diff --git a/bin14/lib/mir_app.lib b/bin14/lib/mir_app.lib index 0a10ea673b..b70e0fd8f2 100644 Binary files a/bin14/lib/mir_app.lib and b/bin14/lib/mir_app.lib differ diff --git a/bin14/lib/mir_app64.lib b/bin14/lib/mir_app64.lib index 6e0db7fe4b..757ed886fc 100644 Binary files a/bin14/lib/mir_app64.lib and b/bin14/lib/mir_app64.lib differ diff --git a/include/m_icolib.h b/include/m_icolib.h index a615e090f9..cdef7dfae6 100644 --- a/include/m_icolib.h +++ b/include/m_icolib.h @@ -117,7 +117,8 @@ MIR_APP_DLL(void) Button_FreeIcon_IcoLib(HWND hDlg, int itemId); /////////////////////////////////////////////////////////////////////////////// // Helper to apply an icolib's icon to a window -MIR_APP_DLL(void) Window_SetIcon_IcoLib(HWND hWnd, int iconId); +MIR_APP_DLL(void) Window_SetIcon_IcoLib(HWND hWnd, HANDLE hIcolib); +MIR_APP_DLL(void) Window_SetSkinIcon_IcoLib(HWND hWnd, int iconId); MIR_APP_DLL(void) Window_SetProtoIcon_IcoLib(HWND hWnd, const char *szProto, int iconId); MIR_APP_DLL(void) Window_FreeIcon_IcoLib(HWND hWnd); diff --git a/plugins/AddContactPlus/src/addcontact.cpp b/plugins/AddContactPlus/src/addcontact.cpp index e4138f02ec..3acc9154e0 100644 --- a/plugins/AddContactPlus/src/addcontact.cpp +++ b/plugins/AddContactPlus/src/addcontact.cpp @@ -164,8 +164,8 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM) Utils_RestoreWindowPositionNoSize(hdlg, NULL, "AddContact", ""); TranslateDialogDefault(hdlg); - SendMessage(hdlg, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIcon(ICON_ADD,1)); - SendMessage(hdlg, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIcon(ICON_ADD)); + Window_SetIcon_IcoLib(hdlg, IcoLib_GetIconHandle(ICON_ADD)); + HookEventMessage(ME_SKIN2_ICONSCHANGED, hdlg, DM_ADDCONTACT_CHANGEICONS); HookEventMessage(ME_PROTO_ACCLISTCHANGED, hdlg, DM_ADDCONTACT_CHANGEACCLIST); { @@ -324,8 +324,8 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM) break; case DM_ADDCONTACT_CHANGEICONS: - IcoLib_ReleaseIcon((HICON)SendMessage(hdlg, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIcon(ICON_ADD, 1))); - IcoLib_ReleaseIcon((HICON)SendMessage(hdlg, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIcon(ICON_ADD))); + Window_FreeIcon_IcoLib(hdlg); + Window_SetIcon_IcoLib(hdlg, IcoLib_GetIconHandle(ICON_ADD)); break; case DM_ADDCONTACT_CHANGEACCLIST: @@ -334,8 +334,7 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM) case WM_DESTROY: hAddDlg = NULL; - IcoLib_ReleaseIcon((HICON)SendMessage(hdlg, WM_SETICON, ICON_BIG, 0)); - IcoLib_ReleaseIcon((HICON)SendMessage(hdlg, WM_SETICON, ICON_SMALL, 0)); + Window_FreeIcon_IcoLib(hdlg); ImageList_Destroy((HIMAGELIST)SendDlgItemMessage(hdlg, IDC_PROTO, CBEM_GETIMAGELIST, 0, 0)); if (acs) { db_set_s(NULL, "AddContact", "LastProto", acs->proto); diff --git a/plugins/BasicHistory/src/HistoryWindow.cpp b/plugins/BasicHistory/src/HistoryWindow.cpp index a1ad2df7d8..8cc82337da 100644 --- a/plugins/BasicHistory/src/HistoryWindow.cpp +++ b/plugins/BasicHistory/src/HistoryWindow.cpp @@ -1006,8 +1006,8 @@ void HistoryWindow::Initialise() ResetCList(m_hWnd); RestorePos(); - SendMessage(m_hWnd, WM_SETICON, ICON_BIG, (LPARAM)Skin_LoadIcon(SKINICON_OTHER_HISTORY, true)); - SendMessage(m_hWnd, WM_SETICON, ICON_SMALL, (LPARAM)Skin_LoadIcon(SKINICON_OTHER_HISTORY)); + Window_SetSkinIcon_IcoLib(m_hWnd, SKINICON_OTHER_HISTORY); + SendMessage(editWindow, EM_AUTOURLDETECT, TRUE, 0); SendMessage(editWindow, EM_SETEVENTMASK, 0, ENM_LINK | ENM_SELCHANGE | ENM_KEYEVENTS | ENM_MOUSEEVENTS); SendMessage(editWindow, EM_SETEDITSTYLE, SES_EXTENDBACKCOLOR, SES_EXTENDBACKCOLOR); @@ -1098,13 +1098,9 @@ void HistoryWindow::Initialise() void HistoryWindow::Destroy() { - HICON hIcon = (HICON)SendMessage(m_hWnd, WM_SETICON, ICON_BIG, 0); - IcoLib_ReleaseIcon(hIcon); - - hIcon = (HICON)SendMessage(m_hWnd, WM_SETICON, ICON_SMALL, 0); - IcoLib_ReleaseIcon(hIcon); - + Window_FreeIcon_IcoLib(m_hWnd); isDestroyed = true; + HistoryWindow::Close(this); } diff --git a/plugins/Clist_nicer/src/clistmenus.cpp b/plugins/Clist_nicer/src/clistmenus.cpp index 203f0faf2f..89b287527c 100644 --- a/plugins/Clist_nicer/src/clistmenus.cpp +++ b/plugins/Clist_nicer/src/clistmenus.cpp @@ -105,7 +105,7 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA mir_sntprintf(szTitle, TranslateT("Contact list display and ignore options for %s"), contact ? contact->szText : pcli->pfnGetContactDisplayName(hContact, 0)); SetWindowText(hWnd, szTitle); - SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)Skin_LoadIcon(SKINICON_OTHER_MIRANDA)); + Window_SetSkinIcon_IcoLib(hWnd, SKINICON_OTHER_MIRANDA); pCaps = CallProtoService(contact ? contact->proto : GetContactProto(hContact), PS_GETCAPS, PFLAGNUM_1, 0); Utils::enableDlgControl(hWnd, IDC_IGN_ALWAYSONLINE, pCaps & PF1_INVISLIST ? TRUE : FALSE); Utils::enableDlgControl(hWnd, IDC_IGN_ALWAYSOFFLINE, pCaps & PF1_VISLIST ? TRUE : FALSE); diff --git a/plugins/CrashDumper/src/ui.cpp b/plugins/CrashDumper/src/ui.cpp index 41cc0f34fb..34f82b15a3 100644 --- a/plugins/CrashDumper/src/ui.cpp +++ b/plugins/CrashDumper/src/ui.cpp @@ -64,10 +64,8 @@ INT_PTR CALLBACK DlgProcView(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); + Window_SetIcon_IcoLib(hwndDlg, GetIconHandle(IDI_VI)); { - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)LoadIconEx(IDI_VI, true)); - SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIconEx(IDI_VI)); - CHARFORMAT2 chf; chf.cbSize = sizeof(chf); SendDlgItemMessage(hwndDlg, IDC_VIEWVERSIONINFO, EM_GETCHARFORMAT, SCF_DEFAULT, (LPARAM)&chf); @@ -165,8 +163,7 @@ INT_PTR CALLBACK DlgProcView(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara case WM_DESTROY: hViewWnd = NULL; - IcoLib_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_BIG, 0)); - IcoLib_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, 0)); + Window_FreeIcon_IcoLib(hwndDlg); Utils_SaveWindowPosition(hwndDlg, NULL, PluginName, "ViewInfo_"); if (servicemode) PostQuitMessage(0); @@ -291,8 +288,7 @@ LRESULT CALLBACK DlgProcPopup(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) break; case UM_FREEPLUGINDATA: - IcoLib_ReleaseIcon((HICON)SendMessage(hWnd, WM_SETICON, ICON_BIG, 0)); - IcoLib_ReleaseIcon((HICON)SendMessage(hWnd, WM_SETICON, ICON_SMALL, 0)); + Window_FreeIcon_IcoLib(hWnd); break; } diff --git a/plugins/Db3x_mmap/src/ui.cpp b/plugins/Db3x_mmap/src/ui.cpp index aab9ca348e..e29e8f0ec2 100644 --- a/plugins/Db3x_mmap/src/ui.cpp +++ b/plugins/Db3x_mmap/src/ui.cpp @@ -229,7 +229,7 @@ static INT_PTR CALLBACK sttChangePassword(HWND hwndDlg, UINT uMsg, WPARAM wParam case WM_DESTROY: KillTimer(hwndDlg, 1); - IcoLib_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_SMALL, 0)); + Window_FreeIcon_IcoLib(hwndDlg); } return FALSE; diff --git a/plugins/FTPFileYM/src/dialog.cpp b/plugins/FTPFileYM/src/dialog.cpp index e6eda61bd5..3e6fc46699 100644 --- a/plugins/FTPFileYM/src/dialog.cpp +++ b/plugins/FTPFileYM/src/dialog.cpp @@ -170,7 +170,7 @@ INT_PTR CALLBACK UploadDialog::UploadDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)Utils::loadIconEx("main")); + Window_SetIcon_IcoLib(hwndDlg, Utils::getIconHandle("main")); mir_subclassWindow(GetDlgItem(hwndDlg, IDC_TAB), TabControlProc); { diff --git a/plugins/FTPFileYM/src/manager.cpp b/plugins/FTPFileYM/src/manager.cpp index ebe4755682..8d68a8f1c6 100644 --- a/plugins/FTPFileYM/src/manager.cpp +++ b/plugins/FTPFileYM/src/manager.cpp @@ -223,8 +223,8 @@ INT_PTR CALLBACK Manager::ManagerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); + Window_SetIcon_IcoLib(hwndDlg, Utils::getIconHandle("main")); - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)Utils::loadIconEx("main")); SendDlgItemMessage(hwndDlg, IDC_BTN_SELECTALL, BUTTONSETASFLATBTN, 0, 0); SendDlgItemMessage(hwndDlg, IDC_BTN_SELECTALL, BM_SETIMAGE, IMAGE_ICON, (LPARAM)Skin_LoadIcon(SKINICON_OTHER_TICK)); SendDlgItemMessage(hwndDlg, IDC_BTN_SELECTALL, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Select All"), BATF_TCHAR); diff --git a/plugins/FTPFileYM/src/utils.cpp b/plugins/FTPFileYM/src/utils.cpp index ad47a3badf..896445784c 100644 --- a/plugins/FTPFileYM/src/utils.cpp +++ b/plugins/FTPFileYM/src/utils.cpp @@ -44,13 +44,20 @@ int Utils::msgBoxA(char *szMsg, UINT uType) return MessageBoxA(hwnd, szMsg, Translate("FTP File"), uType); } -HICON Utils::loadIconEx(char *szName) +HICON Utils::loadIconEx(const char *szName) { char buff[100]; mir_snprintf(buff, "%s_%s", MODULE, szName); return IcoLib_GetIcon(buff); } +HANDLE Utils::getIconHandle(const char *szName) +{ + char buff[100]; + mir_snprintf(buff, "%s_%s", MODULE, szName); + return IcoLib_GetIconHandle(buff); +} + TCHAR* Utils::getFileNameFromPath(TCHAR *stzPath) { TCHAR *pch = _tcsrchr(stzPath, '\\'); diff --git a/plugins/FTPFileYM/src/utils.h b/plugins/FTPFileYM/src/utils.h index 10a0031a09..7c83869ade 100644 --- a/plugins/FTPFileYM/src/utils.h +++ b/plugins/FTPFileYM/src/utils.h @@ -30,7 +30,9 @@ public: static int msgBox(TCHAR *szMsg, UINT uType); static int msgBoxA(char *szMsg, UINT uType); static int getDeleteTimeMin(); - static HICON loadIconEx(char *szName); + + static HICON loadIconEx(const char *szName); + static HANDLE getIconHandle(const char *szName); static TCHAR *getFileNameFromPath(TCHAR *stzPath); static TCHAR *getTextFragment(TCHAR *stzText, size_t length, TCHAR *buff); diff --git a/plugins/FileAsMessage/src/dialog.cpp b/plugins/FileAsMessage/src/dialog.cpp index 5c2329fcc5..8092c804a8 100644 --- a/plugins/FileAsMessage/src/dialog.cpp +++ b/plugins/FileAsMessage/src/dialog.cpp @@ -994,12 +994,9 @@ INT_PTR CALLBACK DialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) hwndStatus = CreateStatusWindow(WS_CHILD | WS_VISIBLE, "", hDlg, IDC_STATUS); SetWindowLongPtr(hDlg, GWLP_USERDATA, (LONG_PTR)dat); WindowList_Add(hFileList, hDlg, dat->hContact); - SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)hIcons[ICON_MAIN]); - SendMessage(hDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcons[ICON_MAIN]); + Window_SetIcon_IcoLib(hDlg, iconList[ICON_MAIN].hIcolib); SendDlgItemMessage(hDlg, IDC_STOP, BUTTONADDTOOLTIP, (WPARAM)Translate(hint_controls[ICON_STOP]), 0); - //SetDlgItemText(hDlg, IDC_FILENAME, "C:\\!Developer\\!Miranda\\miranda\\bin\\release\\emo\\biggrin.gif"); - mir_subclassWindow(GetDlgItem(hDlg, IDC_PROGRESS), ProgressWndProc); SendDlgItemMessage(hDlg, IDC_PLAY, BUTTONSETASFLATBTN, 0, 0); @@ -1008,9 +1005,6 @@ INT_PTR CALLBACK DialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) SendDlgItemMessage(hDlg, IDC_STOP, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcons[ICON_STOP]); dat->setState(STATE_IDLE); - //ShowWindow(hDlg, SW_HIDE); - //UpdateWindow(hDlg); - if (dat->inSend) PostMessage(hDlg, WM_COMMAND, IDC_BROWSE, NULL); @@ -1024,8 +1018,7 @@ INT_PTR CALLBACK DialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) return TRUE; } case WM_FE_SKINCHANGE: - SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)hIcons[ICON_MAIN]); - SendMessage(hDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcons[ICON_MAIN]); + Window_SetIcon_IcoLib(hDlg, iconList[ICON_MAIN].hIcolib); dat->setState(dat->iState); SendDlgItemMessage(hDlg, IDC_STOP, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcons[ICON_STOP]); diff --git a/plugins/FileAsMessage/src/main.cpp b/plugins/FileAsMessage/src/main.cpp index 71adae048a..3345635863 100644 --- a/plugins/FileAsMessage/src/main.cpp +++ b/plugins/FileAsMessage/src/main.cpp @@ -26,7 +26,7 @@ HANDLE hHookDbSettingChange, hHookContactAdded, hHookSkinIconsChanged; HICON hIcons[5]; -static IconItem iconList[] = +IconItem iconList[] = { { LPGEN("Play"), "FePlay", IDI_PLAY }, { LPGEN("Pause"), "FePause", IDI_PAUSE }, @@ -47,7 +47,6 @@ int OnSkinIconsChanged(WPARAM wParam, LPARAM lParam) hIcons[indx] = IcoLib_GetIconByHandle(iconList[indx].hIcolib); WindowList_Broadcast(hFileList, WM_FE_SKINCHANGE, 0, 0); - return 0; } @@ -181,7 +180,7 @@ static int OnModulesLoaded(WPARAM wparam, LPARAM lparam) CMenuItem mi; SET_UID(mi, 0xe4a98d2a, 0xa54a, 0x4db1, 0x8d, 0x29, 0xd, 0x5c, 0xf1, 0x10, 0x69, 0x35); mi.position = 200011; - mi.hIcolibItem = hIcons[ICON_MAIN]; + mi.hIcolibItem = iconList[ICON_MAIN].hIcolib; mi.name.a = LPGEN("File As Message..."); mi.pszService = SERVICE_NAME "/FESendFile"; mi.flags = CMIF_NOTOFFLINE; diff --git a/plugins/FileAsMessage/src/main.h b/plugins/FileAsMessage/src/main.h index 1063fb8668..f828789264 100644 --- a/plugins/FileAsMessage/src/main.h +++ b/plugins/FileAsMessage/src/main.h @@ -45,6 +45,7 @@ extern MWindowList hFileList; extern HANDLE hEventNewFile; extern HICON hIcons[5]; +extern IconItem iconList[]; ulong memcrc32(uchar *ptr, int size, ulong crc); INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); diff --git a/plugins/Import/src/wizard.cpp b/plugins/Import/src/wizard.cpp index 2c22254df5..7232aec1fd 100644 --- a/plugins/Import/src/wizard.cpp +++ b/plugins/Import/src/wizard.cpp @@ -99,8 +99,7 @@ INT_PTR CALLBACK WizardDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lP SetWindowPos(hwndPage, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOSIZE); ShowWindow(hwndPage, SW_SHOW); ShowWindow(hdlg, SW_SHOW); - SendMessage(hdlg, WM_SETICON, ICON_SMALL, (LPARAM)GetIcon(IDI_IMPORT)); - SendMessage(hdlg, WM_SETICON, ICON_BIG, (LPARAM)GetIcon(IDI_IMPORT, true)); + Window_SetIcon_IcoLib(hdlg, GetIconHandle(IDI_IMPORT)); return TRUE; case WIZM_GOTOPAGE: diff --git a/plugins/MyDetails/src/services.cpp b/plugins/MyDetails/src/services.cpp index f4e3d4f616..16fcf7eb93 100644 --- a/plugins/MyDetails/src/services.cpp +++ b/plugins/MyDetails/src/services.cpp @@ -38,72 +38,72 @@ static INT_PTR CALLBACK DlgProcSetNickname(HWND hwndDlg, UINT msg, WPARAM wParam return TRUE; case WMU_SETDATA: - { - int proto_num = (int)wParam; + { + int proto_num = (int)wParam; - SetWindowLongPtr(hwndDlg, GWLP_USERDATA, proto_num); + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, proto_num); - if (proto_num == -1) { - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)Skin_LoadIcon(SKINICON_OTHER_MIRANDA)); + if (proto_num == -1) { + Window_SetSkinIcon_IcoLib(hwndDlg, SKINICON_OTHER_MIRANDA); - // All protos have the same nick? - if (protocols->GetSize() > 0) { - TCHAR *nick = protocols->Get(0)->nickname; + // All protos have the same nick? + if (protocols->GetSize() > 0) { + TCHAR *nick = protocols->Get(0)->nickname; - bool foundDefNick = true; - for (int i = 1; foundDefNick && i < protocols->GetSize(); i++) { - if (mir_tstrcmpi(protocols->Get(i)->nickname, nick) != 0) { - foundDefNick = false; - break; + bool foundDefNick = true; + for (int i = 1; foundDefNick && i < protocols->GetSize(); i++) { + if (mir_tstrcmpi(protocols->Get(i)->nickname, nick) != 0) { + foundDefNick = false; + break; + } } + + if (foundDefNick) + if (mir_tstrcmpi(protocols->default_nick, nick) != 0) + mir_tstrcpy(protocols->default_nick, nick); } - if (foundDefNick) - if (mir_tstrcmpi(protocols->default_nick, nick) != 0) - mir_tstrcpy(protocols->default_nick, nick); + SetDlgItemText(hwndDlg, IDC_NICKNAME, protocols->default_nick); + SendDlgItemMessage(hwndDlg, IDC_NICKNAME, EM_LIMITTEXT, MS_MYDETAILS_GETMYNICKNAME_BUFFER_SIZE, 0); } + else { + Protocol *proto = protocols->Get(proto_num); - SetDlgItemText(hwndDlg, IDC_NICKNAME, protocols->default_nick); - SendDlgItemMessage(hwndDlg, IDC_NICKNAME, EM_LIMITTEXT, MS_MYDETAILS_GETMYNICKNAME_BUFFER_SIZE, 0); - } - else { - Protocol *proto = protocols->Get(proto_num); + TCHAR tmp[128]; + mir_sntprintf(tmp, TranslateT("Set my nickname for %s"), proto->description); - TCHAR tmp[128]; - mir_sntprintf(tmp, TranslateT("Set my nickname for %s"), proto->description); + SetWindowText(hwndDlg, tmp); - SetWindowText(hwndDlg, tmp); + HICON hIcon = (HICON)CallProtoService(proto->name, PS_LOADICON, PLI_PROTOCOL, 0); + if (hIcon != NULL) { + SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon); + DestroyIcon(hIcon); + } - HICON hIcon = (HICON)CallProtoService(proto->name, PS_LOADICON, PLI_PROTOCOL, 0); - if (hIcon != NULL) { - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon); - DestroyIcon(hIcon); + SetDlgItemText(hwndDlg, IDC_NICKNAME, proto->nickname); + SendDlgItemMessage(hwndDlg, IDC_NICKNAME, EM_LIMITTEXT, + min(MS_MYDETAILS_GETMYNICKNAME_BUFFER_SIZE, proto->GetNickMaxLength()), 0); } - SetDlgItemText(hwndDlg, IDC_NICKNAME, proto->nickname); - SendDlgItemMessage(hwndDlg, IDC_NICKNAME, EM_LIMITTEXT, - min(MS_MYDETAILS_GETMYNICKNAME_BUFFER_SIZE, proto->GetNickMaxLength()), 0); + return TRUE; } - return TRUE; - } - case WM_COMMAND: switch (wParam) { case IDOK: - { - TCHAR tmp[MS_MYDETAILS_GETMYNICKNAME_BUFFER_SIZE]; - GetDlgItemText(hwndDlg, IDC_NICKNAME, tmp, _countof(tmp)); + { + TCHAR tmp[MS_MYDETAILS_GETMYNICKNAME_BUFFER_SIZE]; + GetDlgItemText(hwndDlg, IDC_NICKNAME, tmp, _countof(tmp)); - LONG_PTR proto_num = GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - if (proto_num == -1) - protocols->SetNicks(tmp); - else - protocols->Get(proto_num)->SetNick(tmp); + LONG_PTR proto_num = GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + if (proto_num == -1) + protocols->SetNicks(tmp); + else + protocols->Get(proto_num)->SetNick(tmp); - DestroyWindow(hwndDlg); - break; - } + DestroyWindow(hwndDlg); + break; + } case IDCANCEL: DestroyWindow(hwndDlg); break; @@ -300,7 +300,8 @@ static LRESULT CALLBACK StatusMsgEditSubclassProc(HWND hwnd, UINT msg, WPARAM wP return mir_callNextSubclass(hwnd, StatusMsgEditSubclassProc, msg, wParam, lParam); } -struct SetStatusMessageData { +struct SetStatusMessageData +{ int status; int proto_num; }; @@ -315,64 +316,64 @@ static INT_PTR CALLBACK DlgProcSetStatusMessage(HWND hwndDlg, UINT msg, WPARAM w return TRUE; case WMU_SETDATA: - { - SetStatusMessageData *data = (SetStatusMessageData *)malloc(sizeof(SetStatusMessageData)); - data->status = (int)wParam; - data->proto_num = (int)lParam; + { + SetStatusMessageData *data = (SetStatusMessageData *)malloc(sizeof(SetStatusMessageData)); + data->status = (int)wParam; + data->proto_num = (int)lParam; - SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)data); + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)data); - if (data->proto_num >= 0) { - Protocol *proto = protocols->Get(data->proto_num); + if (data->proto_num >= 0) { + Protocol *proto = protocols->Get(data->proto_num); - HICON hIcon = (HICON)CallProtoService(proto->name, PS_LOADICON, PLI_PROTOCOL, 0); - if (hIcon != NULL) { - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon); - DestroyIcon(hIcon); - } + HICON hIcon = (HICON)CallProtoService(proto->name, PS_LOADICON, PLI_PROTOCOL, 0); + if (hIcon != NULL) { + SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon); + DestroyIcon(hIcon); + } - TCHAR title[256]; - mir_sntprintf(title, TranslateT("Set my status message for %s"), proto->description); - SetWindowText(hwndDlg, title); + TCHAR title[256]; + mir_sntprintf(title, TranslateT("Set my status message for %s"), proto->description); + SetWindowText(hwndDlg, title); - SetDlgItemText(hwndDlg, IDC_STATUSMESSAGE, proto->GetStatusMsg()); - } - else if (data->status != 0) { - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)Skin_LoadProtoIcon(NULL, data->status)); + SetDlgItemText(hwndDlg, IDC_STATUSMESSAGE, proto->GetStatusMsg()); + } + else if (data->status != 0) { + Window_SetProtoIcon_IcoLib(hwndDlg, NULL, data->status); - TCHAR title[256]; - mir_sntprintf(title, TranslateT("Set my status message for %s"), pcli->pfnGetStatusModeDescription(data->status, 0)); - SetWindowText(hwndDlg, title); + TCHAR title[256]; + mir_sntprintf(title, TranslateT("Set my status message for %s"), pcli->pfnGetStatusModeDescription(data->status, 0)); + SetWindowText(hwndDlg, title); - SetDlgItemText(hwndDlg, IDC_STATUSMESSAGE, protocols->GetDefaultStatusMsg(data->status)); - } - else { - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)Skin_LoadIcon(SKINICON_OTHER_MIRANDA)); + SetDlgItemText(hwndDlg, IDC_STATUSMESSAGE, protocols->GetDefaultStatusMsg(data->status)); + } + else { + Window_SetSkinIcon_IcoLib(hwndDlg, SKINICON_OTHER_MIRANDA); - SetDlgItemText(hwndDlg, IDC_STATUSMESSAGE, protocols->GetDefaultStatusMsg()); + SetDlgItemText(hwndDlg, IDC_STATUSMESSAGE, protocols->GetDefaultStatusMsg()); + } } - return TRUE; - } + case WM_COMMAND: switch (wParam) { case IDOK: - { - TCHAR tmp[MS_MYDETAILS_GETMYSTATUSMESSAGE_BUFFER_SIZE]; - GetDlgItemText(hwndDlg, IDC_STATUSMESSAGE, tmp, _countof(tmp)); + { + TCHAR tmp[MS_MYDETAILS_GETMYSTATUSMESSAGE_BUFFER_SIZE]; + GetDlgItemText(hwndDlg, IDC_STATUSMESSAGE, tmp, _countof(tmp)); - SetStatusMessageData *data = (SetStatusMessageData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + SetStatusMessageData *data = (SetStatusMessageData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - if (data->proto_num >= 0) - protocols->Get(data->proto_num)->SetStatusMsg(tmp); - else if (data->status == 0) - protocols->SetStatusMsgs(tmp); - else - protocols->SetStatusMsgs(data->status, tmp); + if (data->proto_num >= 0) + protocols->Get(data->proto_num)->SetStatusMsg(tmp); + else if (data->status == 0) + protocols->SetStatusMsgs(tmp); + else + protocols->SetStatusMsgs(data->status, tmp); - DestroyWindow(hwndDlg); - } - break; + DestroyWindow(hwndDlg); + } + break; case IDCANCEL: DestroyWindow(hwndDlg); @@ -388,6 +389,7 @@ static INT_PTR CALLBACK DlgProcSetStatusMessage(HWND hwndDlg, UINT msg, WPARAM w SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_STATUSMESSAGE), GWLP_WNDPROC, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_STATUSMESSAGE), GWLP_USERDATA)); free((SetStatusMessageData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA)); + Window_FreeIcon_IcoLib(hwndDlg); InterlockedExchange(&status_msg_dialog_open, 0); break; } diff --git a/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp b/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp index 6eb8f63e33..1be72fc1aa 100644 --- a/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp +++ b/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp @@ -52,12 +52,9 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); + Window_SetSkinIcon_IcoLib(hwndDlg, SKINICON_OTHER_MIRANDA); + Utils_RestoreWindowPosition(hwndDlg, NULL, MOD_NAME, RAMDLGSIZESETTING); { - HICON hTitleIcon = Skin_LoadIcon(SKINICON_OTHER_MIRANDA); - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hTitleIcon); - SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)hTitleIcon); - Utils_RestoreWindowPosition(hwndDlg, NULL, MOD_NAME, RAMDLGSIZESETTING); - READAWAYMSGDATA *awayData = new READAWAYMSGDATA; SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)awayData); awayData->hContact = lParam; diff --git a/plugins/NewAwaySysMod/src/SetAwayMsg.cpp b/plugins/NewAwaySysMod/src/SetAwayMsg.cpp index 08a1a30865..87d0a4f376 100644 --- a/plugins/NewAwaySysMod/src/SetAwayMsg.cpp +++ b/plugins/NewAwaySysMod/src/SetAwayMsg.cpp @@ -479,20 +479,12 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA g_SetAwayMsgPage.SetWnd(hwndDlg); g_SetAwayMsgPage.DBToMemToPage(); - HICON hTitleIconBigElse = Skin_LoadIcon(SKINICON_OTHER_MIRANDA, true); - char *szProto = dat->hInitContact ? GetContactProto(dat->hInitContact) : dat->szProtocol; int Status = 0; Status = g_ProtoStates[dat->szProtocol].m_status; - HICON hTitleIcon = Skin_LoadProtoIcon(szProto, Status); - HICON hTitleIconBig = Skin_LoadProtoIcon(szProto, Status, true); - if (hTitleIconBig == NULL || (HICON)CALLSERVICE_NOTFOUND == hTitleIconBig) - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hTitleIconBigElse); - else - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hTitleIconBig); + Window_SetProtoIcon_IcoLib(hwndDlg, szProto, Status); - SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)hTitleIcon); SendDlgItemMessage(hwndDlg, IDC_SAWAYMSG_MSGDATA, EM_LIMITTEXT, AWAY_MSGDATA_MAX, 0); SendDlgItemMessage(hwndDlg, IDC_SAWAYMSG_STATIC_IGNOREICON, STM_SETIMAGE, IMAGE_ICON, (LPARAM)GetIcon(IDI_IGNORE)); diff --git a/plugins/NotesAndReminders/src/notes.cpp b/plugins/NotesAndReminders/src/notes.cpp index b017f04e94..06e3c87cc0 100644 --- a/plugins/NotesAndReminders/src/notes.cpp +++ b/plugins/NotesAndReminders/src/notes.cpp @@ -1921,12 +1921,7 @@ INT_PTR CALLBACK DlgProcViewNotes(HWND Dialog,UINT Message,WPARAM wParam,LPARAM break; case WM_INITDIALOG: { - HWND H; - - HICON hIcon = IcoLib_GetIconByHandle(iconList[13].hIcolib, ICON_SMALL); - SendMessage(Dialog, WM_SETICON, (WPARAM)ICON_SMALL, (LPARAM)hIcon); - hIcon = IcoLib_GetIconByHandle(iconList[13].hIcolib, ICON_BIG); - SendMessage(Dialog, WM_SETICON, (WPARAM)ICON_BIG, (LPARAM)hIcon); + Window_SetIcon_IcoLib(Dialog, iconList[13].hIcolib); SetWindowText(Dialog, LPGENT("Notes")); @@ -1934,7 +1929,7 @@ INT_PTR CALLBACK DlgProcViewNotes(HWND Dialog,UINT Message,WPARAM wParam,LPARAM SetDlgItemText(Dialog,IDC_REMINDERDATA, _T("")); - H = GetDlgItem(Dialog,IDC_LISTREMINDERS); + HWND H = GetDlgItem(Dialog,IDC_LISTREMINDERS); lvCol.mask = LVCF_TEXT | LVCF_WIDTH; S = TranslateT("Note text"); @@ -1984,8 +1979,7 @@ INT_PTR CALLBACK DlgProcViewNotes(HWND Dialog,UINT Message,WPARAM wParam,LPARAM case WM_DESTROY: ListNotesVisible = FALSE; - IcoLib_ReleaseIcon((HICON)SendMessage(Dialog, WM_SETICON, ICON_BIG, 0)); - IcoLib_ReleaseIcon((HICON)SendMessage(Dialog, WM_SETICON, ICON_SMALL, 0)); + Window_FreeIcon_IcoLib(Dialog); return TRUE; case WM_NOTIFY: diff --git a/plugins/NotesAndReminders/src/reminders.cpp b/plugins/NotesAndReminders/src/reminders.cpp index 42f011736e..ffea8e7052 100644 --- a/plugins/NotesAndReminders/src/reminders.cpp +++ b/plugins/NotesAndReminders/src/reminders.cpp @@ -2398,10 +2398,7 @@ INT_PTR CALLBACK DlgProcViewReminders(HWND Dialog,UINT Message,WPARAM wParam,LPA break; case WM_INITDIALOG: { - HICON hIcon = IcoLib_GetIconByHandle(iconList[6].hIcolib, ICON_SMALL); - SendMessage(Dialog, WM_SETICON, (WPARAM)ICON_SMALL, (LPARAM)hIcon); - hIcon = IcoLib_GetIconByHandle(iconList[6].hIcolib, ICON_BIG); - SendMessage(Dialog, WM_SETICON, (WPARAM)ICON_BIG, (LPARAM)hIcon); + Window_SetIcon_IcoLib(Dialog, iconList[6].hIcolib); TranslateDialogDefault(Dialog); SetDlgItemText(Dialog,IDC_REMINDERDATA, _T("")); @@ -2542,8 +2539,7 @@ INT_PTR CALLBACK DlgProcViewReminders(HWND Dialog,UINT Message,WPARAM wParam,LPA } } case WM_DESTROY: - IcoLib_ReleaseIcon((HICON)SendMessage(Dialog, WM_SETICON, ICON_BIG, 0)); - IcoLib_ReleaseIcon((HICON)SendMessage(Dialog, WM_SETICON, ICON_SMALL, 0)); + Window_FreeIcon_IcoLib(Dialog); break; } return FALSE; diff --git a/plugins/PluginUpdater/src/DlgListNew.cpp b/plugins/PluginUpdater/src/DlgListNew.cpp index 0bd2dd9a0e..6f15fc8024 100644 --- a/plugins/PluginUpdater/src/DlgListNew.cpp +++ b/plugins/PluginUpdater/src/DlgListNew.cpp @@ -153,8 +153,7 @@ INT_PTR CALLBACK DlgList(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) TranslateDialogDefault( hDlg ); oldWndProc = (WNDPROC)SetWindowLongPtr(hwndList, GWLP_WNDPROC, (LONG_PTR)PluginListWndProc); - SendMessage(hDlg, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIconByHandle(iconList[2].hIcolib, 1)); - SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIconByHandle(iconList[2].hIcolib)); + Window_SetIcon_IcoLib(hDlg, iconList[2].hIcolib); { HIMAGELIST hIml = ImageList_Create(16, 16, ILC_MASK | ILC_COLOR32, 4, 0); ImageList_AddIconFromIconLib(hIml, 1); @@ -328,8 +327,7 @@ INT_PTR CALLBACK DlgList(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) case WM_DESTROY: Utils_SaveWindowPosition(hDlg, NULL, MODNAME, "ListWindow"); - IcoLib_ReleaseIcon((HICON)SendMessage(hDlg, WM_SETICON, ICON_BIG, 0)); - IcoLib_ReleaseIcon((HICON)SendMessage(hDlg, WM_SETICON, ICON_SMALL, 0)); + Window_FreeIcon_IcoLib(hDlg); hwndDialog = NULL; delete (OBJLIST *)GetWindowLongPtr(hDlg, GWLP_USERDATA); SetWindowLongPtr(hDlg, GWLP_USERDATA, 0); diff --git a/plugins/PluginUpdater/src/DlgUpdate.cpp b/plugins/PluginUpdater/src/DlgUpdate.cpp index 413c4bff83..f81db0c705 100644 --- a/plugins/PluginUpdater/src/DlgUpdate.cpp +++ b/plugins/PluginUpdater/src/DlgUpdate.cpp @@ -167,8 +167,7 @@ static INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM TranslateDialogDefault(hDlg); SendMessage(hwndList, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES); #if MIRANDA_VER >= 0x0A00 - SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIconByHandle(iconList[0].hIcolib)); - SendMessage(hDlg, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIconByHandle(iconList[0].hIcolib, 1)); + Window_SetIcon_IcoLib(hDlg, iconList[0].hIcolib); #else SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIcon("check_update")); SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIcon("check_update",1)); @@ -349,7 +348,7 @@ static INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM break; case WM_DESTROY: - IcoLib_ReleaseIcon((HICON)SendMessage(hDlg, WM_SETICON, ICON_SMALL, 0)); + Window_FreeIcon_IcoLib(hDlg); Utils_SaveWindowPosition(hDlg, NULL, MODNAME, "ConfirmWindow"); hwndDialog = NULL; delete (OBJLIST *)GetWindowLongPtr(hDlg, GWLP_USERDATA); diff --git a/plugins/Popup/src/history.cpp b/plugins/Popup/src/history.cpp index 5f7c6cf14c..e341bc103b 100644 --- a/plugins/Popup/src/history.cpp +++ b/plugins/Popup/src/history.cpp @@ -130,8 +130,7 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM, LPARAM lPara for (int i = 0; i < arPopupHistory.getCount(); ++i) ListBox_SetItemData(hwndList, ListBox_AddString(hwndList, _T("")), 0); - SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)LoadIconEx(IDI_HISTORY, false)); - SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)LoadIconEx(IDI_HISTORY, true)); + Window_SetIcon_IcoLib(hwnd, GetIconHandle(IDI_HISTORY)); if (gbHppInstalled && PopupOptions.UseHppHistoryLog) { logType = LOG_HPP; diff --git a/plugins/Quotes/src/CurrencyConverter.cpp b/plugins/Quotes/src/CurrencyConverter.cpp index 874eaa626b..9836b1e365 100644 --- a/plugins/Quotes/src/CurrencyConverter.cpp +++ b/plugins/Quotes/src/CurrencyConverter.cpp @@ -89,8 +89,7 @@ INT_PTR CALLBACK CurrencyConverterDlgProc(HWND hDlg, UINT msg, WPARAM wp, LPARAM assert(hWL); WindowList_Add(hWL, hDlg, NULL); - ::SendMessage(hDlg, WM_SETICON, FALSE, LPARAM(Quotes_LoadIconEx(IDI_ICON_CURRENCY_CONVERTER))); - ::SendMessage(hDlg, WM_SETICON, TRUE, LPARAM(Quotes_LoadIconEx(IDI_ICON_CURRENCY_CONVERTER, true))); + Window_SetIcon_IcoLib(hDlg, Quotes_GetIconHandle(IDI_ICON_CURRENCY_CONVERTER)); HWND hcbxFrom = ::GetDlgItem(hDlg, IDC_COMBO_CONVERT_FROM); HWND hcbxTo = ::GetDlgItem(hDlg, IDC_COMBO_CONVERT_INTO); @@ -146,7 +145,11 @@ INT_PTR CALLBACK CurrencyConverterDlgProc(HWND hDlg, UINT msg, WPARAM wp, LPARAM EndDialog(hDlg, 0); } return TRUE; - + + case WM_DESTROY: + Window_FreeIcon_IcoLib(hDlg); + break; + case WM_COMMAND: switch (LOWORD(wp)) { case IDC_COMBO_CONVERT_FROM: diff --git a/plugins/SMS/src/senddlg.cpp b/plugins/SMS/src/senddlg.cpp index 0f9a499655..f43e280559 100644 --- a/plugins/SMS/src/senddlg.cpp +++ b/plugins/SMS/src/senddlg.cpp @@ -86,7 +86,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARA mir_subclassWindow(GetDlgItem(hWndDlg, IDC_MESSAGE), MessageSubclassProc); - SendMessage(hWndDlg, WM_SETICON, ICON_BIG, (LPARAM)Skin_LoadIcon(SKINICON_OTHER_SMS)); + Window_SetSkinIcon_IcoLib(hWndDlg, SKINICON_OTHER_SMS); SendDlgItemMessage(hWndDlg, IDC_HISTORY, BM_SETIMAGE, IMAGE_ICON, (LPARAM)Skin_LoadIcon(SKINICON_OTHER_HISTORY)); { HICON hIcon; diff --git a/plugins/SeenPlugin/src/history.cpp b/plugins/SeenPlugin/src/history.cpp index 2f22076d5d..fd214f674c 100644 --- a/plugins/SeenPlugin/src/history.cpp +++ b/plugins/SeenPlugin/src/history.cpp @@ -178,8 +178,7 @@ INT_PTR CALLBACK HistoryDlgProc(HWND hwndDlg, UINT Message, WPARAM wparam, LPARA pcli->pfnGetContactDisplayName(hContact, 0), TranslateT("last seen history")); SetWindowText(hwndDlg, sztemp); - SendMessage(hwndDlg, WM_SETICON, (WPARAM)ICON_BIG, (LPARAM)Skin_LoadIcon(SKINICON_OTHER_MIRANDA)); - SendMessage(hwndDlg, WM_SETICON, (WPARAM)ICON_SMALL, (LPARAM)Skin_LoadIcon(SKINICON_OTHER_MIRANDA)); + Window_SetSkinIcon_IcoLib(hwndDlg, SKINICON_OTHER_MIRANDA); if (db_get_b(hContact, S_MOD, "OnlineAlert", 0)) CheckDlgButton(hwndDlg, IDC_STATUSCHANGE, BST_CHECKED); diff --git a/plugins/SeenPlugin/src/stdafx.h b/plugins/SeenPlugin/src/stdafx.h index 09aac51737..c1371e94ed 100644 --- a/plugins/SeenPlugin/src/stdafx.h +++ b/plugins/SeenPlugin/src/stdafx.h @@ -36,6 +36,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include +#include #include #include #include diff --git a/plugins/SendScreenshotPlus/src/CSend.cpp b/plugins/SendScreenshotPlus/src/CSend.cpp index 4c35fd5a52..b2524bf315 100644 --- a/plugins/SendScreenshotPlus/src/CSend.cpp +++ b/plugins/SendScreenshotPlus/src/CSend.cpp @@ -91,8 +91,8 @@ INT_PTR CALLBACK CSend::ResultDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, switch (uMsg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); + Window_SetIcon_IcoLib(hwndDlg, GetIconHandle(ICO_MAIN)); { - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)GetIcon(ICO_MAIN)); CSend* self = (CSend*)lParam; TCHAR* tmp = mir_tstrdup(TranslateT("Resulting URL from\n")); mir_tstradd(tmp, self->m_pszSendTyp); diff --git a/plugins/SendScreenshotPlus/src/UAboutForm.cpp b/plugins/SendScreenshotPlus/src/UAboutForm.cpp index aa9fb69f7f..f11938d868 100644 --- a/plugins/SendScreenshotPlus/src/UAboutForm.cpp +++ b/plugins/SendScreenshotPlus/src/UAboutForm.cpp @@ -123,8 +123,7 @@ LRESULT TfrmAbout::wmInitdialog(WPARAM, LPARAM) mir_free(pszText); } - SendMessage(m_hWnd, WM_SETICON, ICON_BIG, (LPARAM)GetIcon(ICO_MAIN)); - SendMessage(m_hWnd, WM_SETICON, ICON_SMALL, (LPARAM)GetIcon(ICO_MAINXS)); + Window_SetIcon_IcoLib(m_hWnd, GetIconHandle(ICO_MAIN)); //init controls btnPageClick(); diff --git a/plugins/SendScreenshotPlus/src/UMainForm.cpp b/plugins/SendScreenshotPlus/src/UMainForm.cpp index cca5519a55..2832444bef 100644 --- a/plugins/SendScreenshotPlus/src/UMainForm.cpp +++ b/plugins/SendScreenshotPlus/src/UMainForm.cpp @@ -173,8 +173,8 @@ void TfrmMain::wmInitdialog(WPARAM, LPARAM) { HWND hCtrl; /// Taskbar and Window icon - SendMessage(m_hWnd, WM_SETICON, ICON_BIG, (LPARAM)GetIcon(ICO_MAIN)); - SendMessage(m_hWnd, WM_SETICON, ICON_SMALL, (LPARAM)GetIcon(ICO_MAINXS)); + Window_SetIcon_IcoLib(m_hWnd, GetIconHandle(ICO_MAIN)); + TCHAR *pt = mir_tstrdup(pcli->pfnGetContactDisplayName(m_hContact, 0)); if (pt && (m_hContact != 0)) { CMString string; diff --git a/plugins/SimpleStatusMsg/src/awaymsg.cpp b/plugins/SimpleStatusMsg/src/awaymsg.cpp index cb3d7eaf0c..1671584e39 100644 --- a/plugins/SimpleStatusMsg/src/awaymsg.cpp +++ b/plugins/SimpleStatusMsg/src/awaymsg.cpp @@ -69,42 +69,41 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP AwayMsgDlgData *dat = (AwayMsgDlgData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); switch (message) { - case WM_INITDIALOG: - TranslateDialogDefault(hwndDlg); - dat = (AwayMsgDlgData *)mir_alloc(sizeof(AwayMsgDlgData)); - SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat); + case WM_INITDIALOG: + TranslateDialogDefault(hwndDlg); + dat = (AwayMsgDlgData *)mir_alloc(sizeof(AwayMsgDlgData)); + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat); + + dat->hContact = lParam; + dat->hSeq = (HANDLE)CallContactService(dat->hContact, PSS_GETAWAYMSG, 0, 0); + dat->hAwayMsgEvent = dat->hSeq ? HookEventMessage(ME_PROTO_ACK, hwndDlg, HM_AWAYMSG) : NULL; + WindowList_Add(hWindowList, hwndDlg, dat->hContact); + { + TCHAR str[256], format[128]; + TCHAR *contactName = (TCHAR *)pcli->pfnGetContactDisplayName(dat->hContact, 0); + char *szProto = GetContactProto(dat->hContact); + WORD dwStatus = db_get_w(dat->hContact, szProto, "Status", ID_STATUS_OFFLINE); + TCHAR *status = pcli->pfnGetStatusModeDescription(dwStatus, 0); - dat->hContact = lParam; - dat->hSeq = (HANDLE)CallContactService(dat->hContact, PSS_GETAWAYMSG, 0, 0); - dat->hAwayMsgEvent = dat->hSeq ? HookEventMessage(ME_PROTO_ACK, hwndDlg, HM_AWAYMSG) : NULL; - WindowList_Add(hWindowList, hwndDlg, dat->hContact); - { - TCHAR str[256], format[128]; - TCHAR *contactName = (TCHAR *)pcli->pfnGetContactDisplayName(dat->hContact, 0); - char *szProto = GetContactProto(dat->hContact); - WORD dwStatus = db_get_w(dat->hContact, szProto, "Status", ID_STATUS_OFFLINE); - TCHAR *status = pcli->pfnGetStatusModeDescription(dwStatus, 0); - - GetWindowText(hwndDlg, format, _countof(format)); - mir_sntprintf(str, format, status, contactName); - SetWindowText(hwndDlg, str); - if (dat->hSeq) { - GetDlgItemText(hwndDlg, IDC_RETRIEVING, format, _countof(format)); - mir_sntprintf(str, format, status); - } - else { - mir_sntprintf(str, TranslateT("Failed to retrieve %s message."), status); - SetDlgItemText(hwndDlg, IDOK, TranslateT("&Close")); - } - SetDlgItemText(hwndDlg, IDC_RETRIEVING, str); - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)Skin_LoadProtoIcon(szProto, dwStatus)); - SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)Skin_LoadProtoIcon(szProto, dwStatus)); - EnableWindow(GetDlgItem(hwndDlg, IDC_COPY), FALSE); + GetWindowText(hwndDlg, format, _countof(format)); + mir_sntprintf(str, format, status, contactName); + SetWindowText(hwndDlg, str); + if (dat->hSeq) { + GetDlgItemText(hwndDlg, IDC_RETRIEVING, format, _countof(format)); + mir_sntprintf(str, format, status); + } + else { + mir_sntprintf(str, TranslateT("Failed to retrieve %s message."), status); + SetDlgItemText(hwndDlg, IDOK, TranslateT("&Close")); } - Utils_RestoreWindowPosition(hwndDlg, lParam, "SRAway", "AwayMsgDlg"); - return TRUE; + SetDlgItemText(hwndDlg, IDC_RETRIEVING, str); + Window_SetProtoIcon_IcoLib(hwndDlg, szProto, dwStatus); + EnableWindow(GetDlgItem(hwndDlg, IDC_COPY), FALSE); + } + Utils_RestoreWindowPosition(hwndDlg, lParam, "SRAway", "AwayMsgDlg"); + return TRUE; - case HM_AWAYMSG: + case HM_AWAYMSG: { ACKDATA *ack = (ACKDATA *)lParam; if (ack->hContact != dat->hContact || ack->type != ACKTYPE_AWAYMSG) @@ -128,53 +127,52 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP break; } - case WM_COMMAND: - switch (LOWORD(wParam)) { - case IDCANCEL: - case IDOK: - DestroyWindow(hwndDlg); - break; + case WM_COMMAND: + switch (LOWORD(wParam)) { + case IDCANCEL: + case IDOK: + DestroyWindow(hwndDlg); + break; - case IDC_COPY: - if (!OpenClipboard(hwndDlg)) + case IDC_COPY: + if (!OpenClipboard(hwndDlg)) + break; + if (EmptyClipboard()) { + TCHAR msg[1024]; + int len = GetDlgItemText(hwndDlg, IDC_MSG, msg, _countof(msg)); + if (len) { + LPTSTR lptstrCopy; + HGLOBAL hglbCopy = GlobalAlloc(GMEM_MOVEABLE, (len + 1) * sizeof(TCHAR)); + if (hglbCopy == NULL) { + CloseClipboard(); break; - if (EmptyClipboard()) { - TCHAR msg[1024]; - int len = GetDlgItemText(hwndDlg, IDC_MSG, msg, _countof(msg)); - if (len) { - LPTSTR lptstrCopy; - HGLOBAL hglbCopy = GlobalAlloc(GMEM_MOVEABLE, (len + 1) * sizeof(TCHAR)); - if (hglbCopy == NULL) { - CloseClipboard(); - break; - } - lptstrCopy = (LPTSTR)GlobalLock(hglbCopy); - memcpy(lptstrCopy, msg, len * sizeof(TCHAR)); - lptstrCopy[len] = (TCHAR)0; - GlobalUnlock(hglbCopy); - - SetClipboardData(CF_UNICODETEXT, hglbCopy); - - } } - CloseClipboard(); - break; - } - break; + lptstrCopy = (LPTSTR)GlobalLock(hglbCopy); + memcpy(lptstrCopy, msg, len * sizeof(TCHAR)); + lptstrCopy[len] = (TCHAR)0; + GlobalUnlock(hglbCopy); - case WM_CLOSE: - DestroyWindow(hwndDlg); - break; + SetClipboardData(CF_UNICODETEXT, hglbCopy); - case WM_DESTROY: - if (dat->hAwayMsgEvent) - UnhookEvent(dat->hAwayMsgEvent); - Utils_SaveWindowPosition(hwndDlg, dat->hContact, "SRAway", "AwayMsgDlg"); - WindowList_Remove(hWindowList, hwndDlg); - IcoLib_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_BIG, NULL)); - IcoLib_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, NULL)); - mir_free(dat); + } + } + CloseClipboard(); break; + } + break; + + case WM_CLOSE: + DestroyWindow(hwndDlg); + break; + + case WM_DESTROY: + if (dat->hAwayMsgEvent) + UnhookEvent(dat->hAwayMsgEvent); + Utils_SaveWindowPosition(hwndDlg, dat->hContact, "SRAway", "AwayMsgDlg"); + WindowList_Remove(hWindowList, hwndDlg); + Window_FreeIcon_IcoLib(hwndDlg); + mir_free(dat); + break; } return FALSE; } @@ -185,8 +183,7 @@ static INT_PTR GetMessageCommand(WPARAM wParam, LPARAM) SetForegroundWindow(hwnd); SetFocus(hwnd); } - else - CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_READAWAYMSG), NULL, ReadAwayMsgDlgProc, wParam); + else CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_READAWAYMSG), NULL, ReadAwayMsgDlgProc, wParam); return 0; } @@ -195,12 +192,9 @@ static INT_PTR CALLBACK CopyAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP AwayMsgDlgData *dat = (AwayMsgDlgData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); switch (message) { - case WM_INITDIALOG: + case WM_INITDIALOG: + TranslateDialogDefault(hwndDlg); { - TCHAR str[256], format[128]; - TCHAR *contactName; - - TranslateDialogDefault(hwndDlg); dat = (AwayMsgDlgData *)mir_alloc(sizeof(AwayMsgDlgData)); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat); @@ -208,16 +202,17 @@ static INT_PTR CALLBACK CopyAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP dat->hSeq = (HANDLE)CallContactService(dat->hContact, PSS_GETAWAYMSG, 0, 0); dat->hAwayMsgEvent = dat->hSeq ? HookEventMessage(ME_PROTO_ACK, hwndDlg, HM_AWAYMSG) : NULL; WindowList_Add(hWindowList2, hwndDlg, dat->hContact); - contactName = (TCHAR *)pcli->pfnGetContactDisplayName(dat->hContact, 0); + TCHAR *contactName = pcli->pfnGetContactDisplayName(dat->hContact, 0); + TCHAR str[256], format[128]; GetWindowText(hwndDlg, format, _countof(format)); mir_sntprintf(str, format, contactName); SetWindowText(hwndDlg, str); if (!dat->hSeq) DestroyWindow(hwndDlg); - return TRUE; } + return TRUE; - case HM_AWAYMSG: + case HM_AWAYMSG: { ACKDATA *ack = (ACKDATA *)lParam; if (ack->hContact != dat->hContact || ack->type != ACKTYPE_AWAYMSG) { @@ -261,27 +256,27 @@ static INT_PTR CALLBACK CopyAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP } CloseClipboard(); DestroyWindow(hwndDlg); - break; } + break; - case WM_COMMAND: - switch (LOWORD(wParam)) { - case IDCANCEL: - case IDOK: - DestroyWindow(hwndDlg); - break; - } - break; - - case WM_CLOSE: + case WM_COMMAND: + switch (LOWORD(wParam)) { + case IDCANCEL: + case IDOK: DestroyWindow(hwndDlg); break; + } + break; - case WM_DESTROY: - if (dat->hAwayMsgEvent) UnhookEvent(dat->hAwayMsgEvent); - WindowList_Remove(hWindowList2, hwndDlg); - mir_free(dat); - break; + case WM_CLOSE: + DestroyWindow(hwndDlg); + break; + + case WM_DESTROY: + if (dat->hAwayMsgEvent) UnhookEvent(dat->hAwayMsgEvent); + WindowList_Remove(hWindowList2, hwndDlg); + mir_free(dat); + break; } return FALSE; } @@ -414,6 +409,5 @@ int LoadAwayMsgModule(void) hGoToURLMenuItem = Menu_AddContactMenuItem(&mi); HookEvent(ME_CLIST_PREBUILDCONTACTMENU, AwayMsgPreBuildMenu); - return 0; } diff --git a/plugins/SimpleStatusMsg/src/msgbox.cpp b/plugins/SimpleStatusMsg/src/msgbox.cpp index 2e92192c4b..13b3da336a 100644 --- a/plugins/SimpleStatusMsg/src/msgbox.cpp +++ b/plugins/SimpleStatusMsg/src/msgbox.cpp @@ -804,8 +804,8 @@ void ChangeDlgStatus(HWND hwndDlg, struct MsgBoxData *msgbox_data, int iStatus) else if (iStatus > ID_STATUS_CURRENT) iStatus = GetCurrentStatus(NULL); - IcoLib_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)Skin_LoadProtoIcon(msgbox_data->m_szProto, iStatus))); - IcoLib_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)Skin_LoadProtoIcon(msgbox_data->m_szProto, iStatus))); + Window_FreeIcon_IcoLib(hwndDlg); + Window_SetProtoIcon_IcoLib(hwndDlg, msgbox_data->m_szProto, iStatus); if (!bDisabled && ((Proto_Status2Flag(iStatus) & msgbox_data->m_iStatusMsgModes) || (iStatus == ID_STATUS_OFFLINE && (Proto_Status2Flag(ID_STATUS_INVISIBLE) & msgbox_data->m_iStatusMsgModes)))) @@ -923,8 +923,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA icoStatus = init_data->m_iStatus; if (icoStatus < ID_STATUS_OFFLINE) icoStatus = ID_STATUS_OFFLINE; - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)Skin_LoadProtoIcon(init_data->m_szProto, icoStatus)); - SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)Skin_LoadProtoIcon(init_data->m_szProto, icoStatus)); + Window_SetProtoIcon_IcoLib(hwndDlg, init_data->m_szProto, icoStatus); copy_init_data = (struct MsgBoxData *)mir_alloc(sizeof(struct MsgBoxData)); @@ -1615,8 +1614,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA ReleaseIconEx("predef"); ReleaseIconEx("add"); ReleaseIconEx("clear"); - IcoLib_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_BIG, 0)); - IcoLib_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, 0)); + Window_FreeIcon_IcoLib(hwndDlg); hwndSAMsgDialog = NULL; mir_free(msgbox_data); diff --git a/plugins/SpellChecker/src/ardialog.cpp b/plugins/SpellChecker/src/ardialog.cpp index ad468dcef2..3b1258508f 100644 --- a/plugins/SpellChecker/src/ardialog.cpp +++ b/plugins/SpellChecker/src/ardialog.cpp @@ -165,9 +165,7 @@ static INT_PTR CALLBACK AddReplacementDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_OLD), GWLP_USERDATA, (LONG_PTR)data); mir_subclassWindow(GetDlgItem(hwndDlg, IDC_OLD), OnlyCharsEditProc); - HICON hIcon = IcoLib_GetIcon("spellchecker_enabled"); - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon); - IcoLib_ReleaseIcon(hIcon); + Window_SetIcon_IcoLib(hwndDlg, IcoLib_GetIconHandle("spellchecker_enabled")); SendDlgItemMessage(hwndDlg, IDC_OLD, EM_LIMITTEXT, 256, 0); SendDlgItemMessage(hwndDlg, IDC_NEW, EM_LIMITTEXT, 256, 0); diff --git a/plugins/TabSRMM/src/containeroptions.cpp b/plugins/TabSRMM/src/containeroptions.cpp index de8422eaf1..3ada2917fa 100644 --- a/plugins/TabSRMM/src/containeroptions.cpp +++ b/plugins/TabSRMM/src/containeroptions.cpp @@ -99,7 +99,8 @@ void TSAPI ApplyContainerSetting(TContainerData *pContainer, DWORD flags, UINT m #define NR_O_PAGES 10 #define NR_O_OPTIONSPERPAGE 10 -static struct _tagPages { +static struct _tagPages +{ const TCHAR *szTitle, *szDesc; UINT uIds[10]; } o_pages[] = { @@ -140,98 +141,98 @@ INT_PTR CALLBACK DlgProcContainerOptions(HWND hwndDlg, UINT msg, WPARAM wParam, TContainerData *pContainer = (TContainerData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); switch (msg) { - case WM_INITDIALOG: { - TVINSERTSTRUCT tvis = { 0 }; - int nr_layouts = 0; - const TSideBarLayout *sblayouts = CSideBar::getLayouts(nr_layouts); - - SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam); - pContainer = (TContainerData*)lParam; - pContainer->hWndOptions = hwndDlg; + case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); - SetWindowText(hwndDlg, TranslateT("Container options")); - TCHAR szNewTitle[128]; - mir_sntprintf(szNewTitle, _T("%s"), !mir_tstrcmp(pContainer->szName, _T("default")) ? - TranslateT("Default container") : pContainer->szName); - SetDlgItemText(hwndDlg, IDC_HEADERBAR, szNewTitle); - Utils::enableDlgControl(hwndDlg, IDC_O_HIDETITLE, !CSkin::m_frameSkins); - CheckDlgButton(hwndDlg, IDC_CNTPRIVATE, pContainer->settings->fPrivate ? BST_CHECKED : BST_UNCHECKED); - - SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Tabs at the top")); - SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Tabs at the bottom")); - SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Switch bar on the left side")); - SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Switch bar on the right side")); - - SendDlgItemMessage(hwndDlg, IDC_AVATARMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Globally on")); - SendDlgItemMessage(hwndDlg, IDC_AVATARMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("On, if present")); - SendDlgItemMessage(hwndDlg, IDC_AVATARMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Globally OFF")); - SendDlgItemMessage(hwndDlg, IDC_AVATARMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("On, if present, always in bottom display")); - - SendDlgItemMessage(hwndDlg, IDC_OWNAVATARMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("On, if present")); - SendDlgItemMessage(hwndDlg, IDC_OWNAVATARMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Don't show them")); - - for (int i = 0; i < nr_layouts; i++) - SendDlgItemMessage(hwndDlg, IDC_SBARLAYOUT, CB_INSERTSTRING, -1, (LPARAM)TranslateTS(sblayouts[i].szName)); - - /* bits 24 - 31 of dwFlagsEx hold the side bar layout id */ - SendDlgItemMessage(hwndDlg, IDC_SBARLAYOUT, CB_SETCURSEL, (WPARAM)((pContainer->settings->dwFlagsEx & 0xff000000) >> 24), 0); - - - SendMessage(hwndDlg, DM_SC_INITDIALOG, 0, (LPARAM)pContainer->settings); - SendDlgItemMessage(hwndDlg, IDC_TITLEFORMAT, EM_LIMITTEXT, TITLE_FORMATLEN - 1, 0); - SetDlgItemText(hwndDlg, IDC_TITLEFORMAT, pContainer->settings->szTitleFormat); - SetDlgItemText(hwndDlg, IDC_THEME, pContainer->szRelThemeFile); - for (int i = 0; i < NR_O_PAGES; i++) { - tvis.hParent = NULL; - tvis.hInsertAfter = TVI_LAST; - tvis.item.mask = TVIF_TEXT | TVIF_PARAM; - tvis.item.pszText = TranslateTS(o_pages[i].szTitle); - tvis.item.lParam = i; - HTREEITEM hItem = TreeView_InsertItem(hwndTree, &tvis); - if (i == 0) - SendMessage(hwndTree, TVM_SELECTITEM, TVGN_CARET, (LPARAM)hItem); - for (int j = 0; j < NR_O_OPTIONSPERPAGE && o_pages[i].uIds[j] != 0; j++) - Utils::showDlgControl(hwndDlg, o_pages[i].uIds[j], SW_HIDE); - ShowPage(hwndDlg, i, FALSE); - } - SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)Skin_LoadIcon(SKINICON_EVENT_MESSAGE)); - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)Skin_LoadIcon(SKINICON_EVENT_MESSAGE, true)); - ShowPage(hwndDlg, 0, TRUE); - SetFocus(hwndTree); - Utils::enableDlgControl(hwndDlg, IDC_APPLY, false); + { + TVINSERTSTRUCT tvis = { 0 }; + int nr_layouts = 0; + const TSideBarLayout *sblayouts = CSideBar::getLayouts(nr_layouts); + + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam); + pContainer = (TContainerData*)lParam; + pContainer->hWndOptions = hwndDlg; + SetWindowText(hwndDlg, TranslateT("Container options")); + TCHAR szNewTitle[128]; + mir_sntprintf(szNewTitle, _T("%s"), !mir_tstrcmp(pContainer->szName, _T("default")) ? + TranslateT("Default container") : pContainer->szName); + SetDlgItemText(hwndDlg, IDC_HEADERBAR, szNewTitle); + Utils::enableDlgControl(hwndDlg, IDC_O_HIDETITLE, !CSkin::m_frameSkins); + CheckDlgButton(hwndDlg, IDC_CNTPRIVATE, pContainer->settings->fPrivate ? BST_CHECKED : BST_UNCHECKED); + + SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Tabs at the top")); + SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Tabs at the bottom")); + SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Switch bar on the left side")); + SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Switch bar on the right side")); + + SendDlgItemMessage(hwndDlg, IDC_AVATARMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Globally on")); + SendDlgItemMessage(hwndDlg, IDC_AVATARMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("On, if present")); + SendDlgItemMessage(hwndDlg, IDC_AVATARMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Globally OFF")); + SendDlgItemMessage(hwndDlg, IDC_AVATARMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("On, if present, always in bottom display")); + + SendDlgItemMessage(hwndDlg, IDC_OWNAVATARMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("On, if present")); + SendDlgItemMessage(hwndDlg, IDC_OWNAVATARMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Don't show them")); + + for (int i = 0; i < nr_layouts; i++) + SendDlgItemMessage(hwndDlg, IDC_SBARLAYOUT, CB_INSERTSTRING, -1, (LPARAM)TranslateTS(sblayouts[i].szName)); + + /* bits 24 - 31 of dwFlagsEx hold the side bar layout id */ + SendDlgItemMessage(hwndDlg, IDC_SBARLAYOUT, CB_SETCURSEL, (WPARAM)((pContainer->settings->dwFlagsEx & 0xff000000) >> 24), 0); + + + SendMessage(hwndDlg, DM_SC_INITDIALOG, 0, (LPARAM)pContainer->settings); + SendDlgItemMessage(hwndDlg, IDC_TITLEFORMAT, EM_LIMITTEXT, TITLE_FORMATLEN - 1, 0); + SetDlgItemText(hwndDlg, IDC_TITLEFORMAT, pContainer->settings->szTitleFormat); + SetDlgItemText(hwndDlg, IDC_THEME, pContainer->szRelThemeFile); + for (int i = 0; i < NR_O_PAGES; i++) { + tvis.hParent = NULL; + tvis.hInsertAfter = TVI_LAST; + tvis.item.mask = TVIF_TEXT | TVIF_PARAM; + tvis.item.pszText = TranslateTS(o_pages[i].szTitle); + tvis.item.lParam = i; + HTREEITEM hItem = TreeView_InsertItem(hwndTree, &tvis); + if (i == 0) + SendMessage(hwndTree, TVM_SELECTITEM, TVGN_CARET, (LPARAM)hItem); + for (int j = 0; j < NR_O_OPTIONSPERPAGE && o_pages[i].uIds[j] != 0; j++) + Utils::showDlgControl(hwndDlg, o_pages[i].uIds[j], SW_HIDE); + ShowPage(hwndDlg, i, FALSE); + } + Window_SetSkinIcon_IcoLib(hwndDlg, SKINICON_EVENT_MESSAGE); + ShowPage(hwndDlg, 0, TRUE); + SetFocus(hwndTree); + Utils::enableDlgControl(hwndDlg, IDC_APPLY, false); - HFONT hFont = (HFONT)SendDlgItemMessage(hwndDlg, IDC_DESC, WM_GETFONT, 0, 0); - LOGFONT lf = { 0 }; + HFONT hFont = (HFONT)SendDlgItemMessage(hwndDlg, IDC_DESC, WM_GETFONT, 0, 0); + LOGFONT lf = { 0 }; - GetObject(hFont, sizeof(lf), &lf); - lf.lfHeight = (int)(lf.lfHeight * 1.2); - hFont = CreateFontIndirect(&lf); + GetObject(hFont, sizeof(lf), &lf); + lf.lfHeight = (int)(lf.lfHeight * 1.2); + hFont = CreateFontIndirect(&lf); - SendDlgItemMessage(hwndDlg, IDC_TITLEBOX, WM_SETFONT, (WPARAM)hFont, TRUE); + SendDlgItemMessage(hwndDlg, IDC_TITLEBOX, WM_SETFONT, (WPARAM)hFont, TRUE); - if (pContainer->isCloned && pContainer->hContactFrom != 0) { - Utils::showDlgControl(hwndDlg, IDC_CNTPRIVATE, SW_HIDE); - Utils::showDlgControl(hwndDlg, IDC_O_CNTPRIVATE, SW_HIDE); + if (pContainer->isCloned && pContainer->hContactFrom != 0) { + Utils::showDlgControl(hwndDlg, IDC_CNTPRIVATE, SW_HIDE); + Utils::showDlgControl(hwndDlg, IDC_O_CNTPRIVATE, SW_HIDE); + } } return FALSE; - } case WM_CTLCOLOREDIT: case WM_CTLCOLORSTATIC: - { - HWND hwndChild = (HWND)lParam; - UINT id = GetDlgCtrlID(hwndChild); - - if (hwndChild == GetDlgItem(hwndDlg, IDC_TITLEBOX)) - ::SetTextColor((HDC)wParam, RGB(60, 60, 150)); - else if (hwndChild == GetDlgItem(hwndDlg, IDC_DESC)) - ::SetTextColor((HDC)wParam, RGB(160, 50, 50)); - - if (id == IDC_TSLABEL_REOPENWARN) - break; - SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW)); - return (INT_PTR)GetSysColorBrush(COLOR_WINDOW); - } + { + HWND hwndChild = (HWND)lParam; + UINT id = GetDlgCtrlID(hwndChild); + + if (hwndChild == GetDlgItem(hwndDlg, IDC_TITLEBOX)) + ::SetTextColor((HDC)wParam, RGB(60, 60, 150)); + else if (hwndChild == GetDlgItem(hwndDlg, IDC_DESC)) + ::SetTextColor((HDC)wParam, RGB(160, 50, 50)); + + if (id == IDC_TSLABEL_REOPENWARN) + break; + SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW)); + return (INT_PTR)GetSysColorBrush(COLOR_WINDOW); + } case WM_NOTIFY: if (wParam == IDC_SECTIONTREE && ((LPNMHDR)lParam)->code == TVN_SELCHANGED) { @@ -249,47 +250,50 @@ INT_PTR CALLBACK DlgProcContainerOptions(HWND hwndDlg, UINT msg, WPARAM wParam, case WM_COMMAND: switch (LOWORD(wParam)) { - case IDC_CNTPRIVATE: { + case IDC_CNTPRIVATE: + { - if (IsDlgButtonChecked(hwndDlg, IDC_CNTPRIVATE)) { - Utils::ReadPrivateContainerSettings(pContainer, true); - pContainer->settings->fPrivate = true; - } - else { - if (pContainer->settings != &PluginConfig.globalContainerSettings) { - char szCname[40]; - mir_snprintf(szCname, "%s%d_Blob", CNT_BASEKEYNAME, pContainer->iContainerIndex); + if (IsDlgButtonChecked(hwndDlg, IDC_CNTPRIVATE)) { + Utils::ReadPrivateContainerSettings(pContainer, true); + pContainer->settings->fPrivate = true; + } + else { + if (pContainer->settings != &PluginConfig.globalContainerSettings) { + char szCname[40]; + mir_snprintf(szCname, "%s%d_Blob", CNT_BASEKEYNAME, pContainer->iContainerIndex); + pContainer->settings->fPrivate = false; + db_set_blob(0, SRMSGMOD_T, szCname, pContainer->settings, sizeof(TContainerSettings)); + mir_free(pContainer->settings); + } + pContainer->settings = &PluginConfig.globalContainerSettings; pContainer->settings->fPrivate = false; - db_set_blob(0, SRMSGMOD_T, szCname, pContainer->settings, sizeof(TContainerSettings)); - mir_free(pContainer->settings); } - pContainer->settings = &PluginConfig.globalContainerSettings; - pContainer->settings->fPrivate = false; + SendMessage(hwndDlg, DM_SC_INITDIALOG, 0, (LPARAM)pContainer->settings); + goto do_apply; + } + case IDC_TRANSPARENCY: + { + bool isTrans = IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENCY) != 0; + Utils::enableDlgControl(hwndDlg, IDC_TRANSPARENCY_ACTIVE, isTrans); + Utils::enableDlgControl(hwndDlg, IDC_TRANSPARENCY_INACTIVE, isTrans); + goto do_apply; } - SendMessage(hwndDlg, DM_SC_INITDIALOG, 0, (LPARAM)pContainer->settings); - goto do_apply; - } - case IDC_TRANSPARENCY: { - bool isTrans = IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENCY) != 0; - Utils::enableDlgControl(hwndDlg, IDC_TRANSPARENCY_ACTIVE, isTrans); - Utils::enableDlgControl(hwndDlg, IDC_TRANSPARENCY_INACTIVE, isTrans); - goto do_apply; - } case IDC_SECTIONTREE: case IDC_DESC: return 0; - case IDC_SAVESIZEASGLOBAL: { - WINDOWPLACEMENT wp = { 0 }; - - wp.length = sizeof(wp); - if (GetWindowPlacement(pContainer->hwnd, &wp)) { - db_set_dw(0, SRMSGMOD_T, "splitx", wp.rcNormalPosition.left); - db_set_dw(0, SRMSGMOD_T, "splity", wp.rcNormalPosition.top); - db_set_dw(0, SRMSGMOD_T, "splitwidth", wp.rcNormalPosition.right - wp.rcNormalPosition.left); - db_set_dw(0, SRMSGMOD_T, "splitheight", wp.rcNormalPosition.bottom - wp.rcNormalPosition.top); + case IDC_SAVESIZEASGLOBAL: + { + WINDOWPLACEMENT wp = { 0 }; + + wp.length = sizeof(wp); + if (GetWindowPlacement(pContainer->hwnd, &wp)) { + db_set_dw(0, SRMSGMOD_T, "splitx", wp.rcNormalPosition.left); + db_set_dw(0, SRMSGMOD_T, "splity", wp.rcNormalPosition.top); + db_set_dw(0, SRMSGMOD_T, "splitwidth", wp.rcNormalPosition.right - wp.rcNormalPosition.left); + db_set_dw(0, SRMSGMOD_T, "splitheight", wp.rcNormalPosition.bottom - wp.rcNormalPosition.top); + } + break; } - break; - } case IDC_O_ENABLESOUNDS: SendMessage(hwndDlg, DM_SC_CONFIG, 0, 0); break; @@ -297,23 +301,23 @@ INT_PTR CALLBACK DlgProcContainerOptions(HWND hwndDlg, UINT msg, WPARAM wParam, if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()) return TRUE; goto do_apply; - case IDC_SELECTTHEME: { - const wchar_t *szFileName = GetThemeFileName(0); + case IDC_SELECTTHEME: + { + const wchar_t *szFileName = GetThemeFileName(0); - if (PathFileExists(szFileName)) { - SetDlgItemText(hwndDlg, IDC_THEME, szFileName); - goto do_apply; + if (PathFileExists(szFileName)) { + SetDlgItemText(hwndDlg, IDC_THEME, szFileName); + goto do_apply; + } + break; } - break; - } case IDC_O_HELP_TITLEFORMAT: Utils_OpenUrl("http://wiki.miranda-ng.org/index.php?title=Plugin:TabSRMM/en/Title_bar_formatting"); break; case IDOK: - case IDC_APPLY: { - + case IDC_APPLY: SendMessage(hwndDlg, DM_SC_BUILDLIST, 0, (LPARAM)pContainer->settings); pContainer->settings->dwTransparency = MAKELONG((WORD)SendDlgItemMessage(hwndDlg, IDC_TRANSPARENCY_ACTIVE, TBM_GETPOS, 0, 0), @@ -364,7 +368,6 @@ INT_PTR CALLBACK DlgProcContainerOptions(HWND hwndDlg, UINT msg, WPARAM wParam, ShowWindow(pContainer->hwnd, SW_HIDE); { RECT rc; - GetWindowRect(pContainer->hwnd, &rc); SetWindowPos(pContainer->hwnd, 0, rc.left, rc.top, (rc.right - rc.left) - 1, (rc.bottom - rc.top) - 1, SWP_NOZORDER | SWP_DRAWFRAME | SWP_FRAMECHANGED); SetWindowPos(pContainer->hwnd, 0, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), SWP_NOZORDER | SWP_DRAWFRAME | SWP_SHOWWINDOW); @@ -376,174 +379,180 @@ INT_PTR CALLBACK DlgProcContainerOptions(HWND hwndDlg, UINT msg, WPARAM wParam, Utils::enableDlgControl(hwndDlg, IDC_APPLY, false); break; - } + case IDCANCEL: DestroyWindow(hwndDlg); return TRUE; default: - do_apply : Utils::enableDlgControl(hwndDlg, IDC_APPLY, true); +do_apply: Utils::enableDlgControl(hwndDlg, IDC_APPLY, true); break; } break; - case DM_SC_INITDIALOG: { - TContainerSettings* cs = (TContainerSettings *)lParam; - DWORD dwFlags = cs->dwFlags; - DWORD dwTransparency = cs->dwTransparency; - DWORD dwFlagsEx = cs->dwFlagsEx; - BOOL fAllowTrans = FALSE; + case DM_SC_INITDIALOG: + { + TContainerSettings* cs = (TContainerSettings *)lParam; - if (PluginConfig.m_WinVerMajor >= 6) - fAllowTrans = TRUE; - else - fAllowTrans = (!CSkin::m_skinEnabled); - - MY_CheckDlgButton(hwndDlg, IDC_O_HIDETITLE, dwFlags & CNT_NOTITLE); - MY_CheckDlgButton(hwndDlg, IDC_O_DONTREPORT, dwFlags & CNT_DONTREPORT); - MY_CheckDlgButton(hwndDlg, IDC_O_NOTABS, dwFlags & CNT_HIDETABS); - MY_CheckDlgButton(hwndDlg, IDC_O_STICKY, dwFlags & CNT_STICKY); - MY_CheckDlgButton(hwndDlg, IDC_O_FLASHNEVER, dwFlags & CNT_NOFLASH); - MY_CheckDlgButton(hwndDlg, IDC_O_FLASHALWAYS, dwFlags & CNT_FLASHALWAYS); - MY_CheckDlgButton(hwndDlg, IDC_O_FLASHDEFAULT, !((dwFlags & CNT_NOFLASH) || (dwFlags & CNT_FLASHALWAYS))); - MY_CheckDlgButton(hwndDlg, IDC_TRANSPARENCY, dwFlags & CNT_TRANSPARENCY); - MY_CheckDlgButton(hwndDlg, IDC_DONTREPORTUNFOCUSED2, dwFlags & CNT_DONTREPORTUNFOCUSED); - MY_CheckDlgButton(hwndDlg, IDC_DONTREPORTFOCUSED2, dwFlags & CNT_DONTREPORTFOCUSED); - MY_CheckDlgButton(hwndDlg, IDC_ALWAYSPOPUPSINACTIVE, dwFlags & CNT_ALWAYSREPORTINACTIVE); - MY_CheckDlgButton(hwndDlg, IDC_CNTNOSTATUSBAR, dwFlags & CNT_NOSTATUSBAR); - MY_CheckDlgButton(hwndDlg, IDC_HIDEMENUBAR, dwFlags & CNT_NOMENUBAR); - MY_CheckDlgButton(hwndDlg, IDC_HIDETOOLBAR, dwFlags & CNT_HIDETOOLBAR); - MY_CheckDlgButton(hwndDlg, IDC_BOTTOMTOOLBAR, dwFlags & CNT_BOTTOMTOOLBAR); - MY_CheckDlgButton(hwndDlg, IDC_UIDSTATUSBAR, dwFlags & CNT_UINSTATUSBAR); - MY_CheckDlgButton(hwndDlg, IDC_VERTICALMAX, dwFlags & CNT_VERTICALMAX); - MY_CheckDlgButton(hwndDlg, IDC_AUTOSPLITTER, dwFlags & CNT_AUTOSPLITTER); - MY_CheckDlgButton(hwndDlg, IDC_AVATARSONTASKBAR, dwFlags & CNT_AVATARSONTASKBAR); - MY_CheckDlgButton(hwndDlg, IDC_INFOPANEL, dwFlags & CNT_INFOPANEL); - MY_CheckDlgButton(hwndDlg, IDC_USEGLOBALSIZE, dwFlags & CNT_GLOBALSIZE); - - MY_CheckDlgButton(hwndDlg, IDC_FLASHICON, dwFlagsEx & TCF_FLASHICON); - MY_CheckDlgButton(hwndDlg, IDC_FLASHLABEL, dwFlagsEx & TCF_FLASHLABEL); - MY_CheckDlgButton(hwndDlg, IDC_CLOSEBUTTONONTABS, dwFlagsEx & TCF_CLOSEBUTTON); - - MY_CheckDlgButton(hwndDlg, IDC_SINGLEROWTAB, dwFlagsEx & TCF_SINGLEROWTABCONTROL); - MY_CheckDlgButton(hwndDlg, IDC_BUTTONTABS, dwFlagsEx & TCF_FLAT); - - MY_CheckDlgButton(hwndDlg, IDC_O_ENABLESOUNDS, !(dwFlags & CNT_NOSOUND)); - MY_CheckDlgButton(hwndDlg, IDC_O_SOUNDSMINIMIZED, dwFlagsEx & CNT_EX_SOUNDS_MINIMIZED); - MY_CheckDlgButton(hwndDlg, IDC_O_SOUNDSUNFOCUSED, dwFlagsEx & CNT_EX_SOUNDS_UNFOCUSED); - MY_CheckDlgButton(hwndDlg, IDC_O_SOUNDSINACTIVE, dwFlagsEx & CNT_EX_SOUNDS_INACTIVETABS); - MY_CheckDlgButton(hwndDlg, IDC_O_SOUNDSFOCUSED, dwFlagsEx & CNT_EX_SOUNDS_FOCUSED); - - SendMessage(hwndDlg, DM_SC_CONFIG, 0, 0); - - if (!(dwFlagsEx & (TCF_SBARLEFT | TCF_SBARRIGHT))) - SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_SETCURSEL, dwFlags & CNT_TABSBOTTOM ? 1 : 0, 0); - else - SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_SETCURSEL, dwFlagsEx & TCF_SBARLEFT ? 2 : 3, 0); + DWORD dwFlags = cs->dwFlags; + DWORD dwTransparency = cs->dwTransparency; + DWORD dwFlagsEx = cs->dwFlagsEx; + BOOL fAllowTrans = FALSE; - if (LOBYTE(LOWORD(GetVersion())) >= 5 && fAllowTrans) - CheckDlgButton(hwndDlg, IDC_TRANSPARENCY, dwFlags & CNT_TRANSPARENCY ? BST_CHECKED : BST_UNCHECKED); - else - CheckDlgButton(hwndDlg, IDC_TRANSPARENCY, BST_UNCHECKED); + if (PluginConfig.m_WinVerMajor >= 6) + fAllowTrans = TRUE; + else + fAllowTrans = (!CSkin::m_skinEnabled); + + MY_CheckDlgButton(hwndDlg, IDC_O_HIDETITLE, dwFlags & CNT_NOTITLE); + MY_CheckDlgButton(hwndDlg, IDC_O_DONTREPORT, dwFlags & CNT_DONTREPORT); + MY_CheckDlgButton(hwndDlg, IDC_O_NOTABS, dwFlags & CNT_HIDETABS); + MY_CheckDlgButton(hwndDlg, IDC_O_STICKY, dwFlags & CNT_STICKY); + MY_CheckDlgButton(hwndDlg, IDC_O_FLASHNEVER, dwFlags & CNT_NOFLASH); + MY_CheckDlgButton(hwndDlg, IDC_O_FLASHALWAYS, dwFlags & CNT_FLASHALWAYS); + MY_CheckDlgButton(hwndDlg, IDC_O_FLASHDEFAULT, !((dwFlags & CNT_NOFLASH) || (dwFlags & CNT_FLASHALWAYS))); + MY_CheckDlgButton(hwndDlg, IDC_TRANSPARENCY, dwFlags & CNT_TRANSPARENCY); + MY_CheckDlgButton(hwndDlg, IDC_DONTREPORTUNFOCUSED2, dwFlags & CNT_DONTREPORTUNFOCUSED); + MY_CheckDlgButton(hwndDlg, IDC_DONTREPORTFOCUSED2, dwFlags & CNT_DONTREPORTFOCUSED); + MY_CheckDlgButton(hwndDlg, IDC_ALWAYSPOPUPSINACTIVE, dwFlags & CNT_ALWAYSREPORTINACTIVE); + MY_CheckDlgButton(hwndDlg, IDC_CNTNOSTATUSBAR, dwFlags & CNT_NOSTATUSBAR); + MY_CheckDlgButton(hwndDlg, IDC_HIDEMENUBAR, dwFlags & CNT_NOMENUBAR); + MY_CheckDlgButton(hwndDlg, IDC_HIDETOOLBAR, dwFlags & CNT_HIDETOOLBAR); + MY_CheckDlgButton(hwndDlg, IDC_BOTTOMTOOLBAR, dwFlags & CNT_BOTTOMTOOLBAR); + MY_CheckDlgButton(hwndDlg, IDC_UIDSTATUSBAR, dwFlags & CNT_UINSTATUSBAR); + MY_CheckDlgButton(hwndDlg, IDC_VERTICALMAX, dwFlags & CNT_VERTICALMAX); + MY_CheckDlgButton(hwndDlg, IDC_AUTOSPLITTER, dwFlags & CNT_AUTOSPLITTER); + MY_CheckDlgButton(hwndDlg, IDC_AVATARSONTASKBAR, dwFlags & CNT_AVATARSONTASKBAR); + MY_CheckDlgButton(hwndDlg, IDC_INFOPANEL, dwFlags & CNT_INFOPANEL); + MY_CheckDlgButton(hwndDlg, IDC_USEGLOBALSIZE, dwFlags & CNT_GLOBALSIZE); + + MY_CheckDlgButton(hwndDlg, IDC_FLASHICON, dwFlagsEx & TCF_FLASHICON); + MY_CheckDlgButton(hwndDlg, IDC_FLASHLABEL, dwFlagsEx & TCF_FLASHLABEL); + MY_CheckDlgButton(hwndDlg, IDC_CLOSEBUTTONONTABS, dwFlagsEx & TCF_CLOSEBUTTON); + + MY_CheckDlgButton(hwndDlg, IDC_SINGLEROWTAB, dwFlagsEx & TCF_SINGLEROWTABCONTROL); + MY_CheckDlgButton(hwndDlg, IDC_BUTTONTABS, dwFlagsEx & TCF_FLAT); + + MY_CheckDlgButton(hwndDlg, IDC_O_ENABLESOUNDS, !(dwFlags & CNT_NOSOUND)); + MY_CheckDlgButton(hwndDlg, IDC_O_SOUNDSMINIMIZED, dwFlagsEx & CNT_EX_SOUNDS_MINIMIZED); + MY_CheckDlgButton(hwndDlg, IDC_O_SOUNDSUNFOCUSED, dwFlagsEx & CNT_EX_SOUNDS_UNFOCUSED); + MY_CheckDlgButton(hwndDlg, IDC_O_SOUNDSINACTIVE, dwFlagsEx & CNT_EX_SOUNDS_INACTIVETABS); + MY_CheckDlgButton(hwndDlg, IDC_O_SOUNDSFOCUSED, dwFlagsEx & CNT_EX_SOUNDS_FOCUSED); + + SendMessage(hwndDlg, DM_SC_CONFIG, 0, 0); + + if (!(dwFlagsEx & (TCF_SBARLEFT | TCF_SBARRIGHT))) + SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_SETCURSEL, dwFlags & CNT_TABSBOTTOM ? 1 : 0, 0); + else + SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_SETCURSEL, dwFlagsEx & TCF_SBARLEFT ? 2 : 3, 0); - Utils::enableDlgControl(hwndDlg, IDC_TRANSPARENCY, PluginConfig.m_WinVerMajor >= 5 && fAllowTrans); + if (LOBYTE(LOWORD(GetVersion())) >= 5 && fAllowTrans) + CheckDlgButton(hwndDlg, IDC_TRANSPARENCY, dwFlags & CNT_TRANSPARENCY ? BST_CHECKED : BST_UNCHECKED); + else + CheckDlgButton(hwndDlg, IDC_TRANSPARENCY, BST_UNCHECKED); + + Utils::enableDlgControl(hwndDlg, IDC_TRANSPARENCY, PluginConfig.m_WinVerMajor >= 5 && fAllowTrans); - bool isTrans = IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENCY) != 0; - Utils::enableDlgControl(hwndDlg, IDC_TRANSPARENCY_ACTIVE, isTrans); - Utils::enableDlgControl(hwndDlg, IDC_TRANSPARENCY_INACTIVE, isTrans); + bool isTrans = IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENCY) != 0; + Utils::enableDlgControl(hwndDlg, IDC_TRANSPARENCY_ACTIVE, isTrans); + Utils::enableDlgControl(hwndDlg, IDC_TRANSPARENCY_INACTIVE, isTrans); - SendDlgItemMessage(hwndDlg, IDC_TRANSPARENCY_ACTIVE, TBM_SETRANGE, 0, (LPARAM)MAKELONG(50, 255)); - SendDlgItemMessage(hwndDlg, IDC_TRANSPARENCY_INACTIVE, TBM_SETRANGE, 0, (LPARAM)MAKELONG(50, 255)); + SendDlgItemMessage(hwndDlg, IDC_TRANSPARENCY_ACTIVE, TBM_SETRANGE, 0, (LPARAM)MAKELONG(50, 255)); + SendDlgItemMessage(hwndDlg, IDC_TRANSPARENCY_INACTIVE, TBM_SETRANGE, 0, (LPARAM)MAKELONG(50, 255)); - SendDlgItemMessage(hwndDlg, IDC_TRANSPARENCY_ACTIVE, TBM_SETPOS, TRUE, (LPARAM)LOWORD(dwTransparency)); - SendDlgItemMessage(hwndDlg, IDC_TRANSPARENCY_INACTIVE, TBM_SETPOS, TRUE, (LPARAM)HIWORD(dwTransparency)); + SendDlgItemMessage(hwndDlg, IDC_TRANSPARENCY_ACTIVE, TBM_SETPOS, TRUE, (LPARAM)LOWORD(dwTransparency)); + SendDlgItemMessage(hwndDlg, IDC_TRANSPARENCY_INACTIVE, TBM_SETPOS, TRUE, (LPARAM)HIWORD(dwTransparency)); - Utils::enableDlgControl(hwndDlg, IDC_O_DONTREPORT, !nen_options.bWindowCheck); - Utils::enableDlgControl(hwndDlg, IDC_DONTREPORTUNFOCUSED2, !nen_options.bWindowCheck); - Utils::enableDlgControl(hwndDlg, IDC_DONTREPORTFOCUSED2, !nen_options.bWindowCheck); - Utils::enableDlgControl(hwndDlg, IDC_ALWAYSPOPUPSINACTIVE, !nen_options.bWindowCheck); + Utils::enableDlgControl(hwndDlg, IDC_O_DONTREPORT, !nen_options.bWindowCheck); + Utils::enableDlgControl(hwndDlg, IDC_DONTREPORTUNFOCUSED2, !nen_options.bWindowCheck); + Utils::enableDlgControl(hwndDlg, IDC_DONTREPORTFOCUSED2, !nen_options.bWindowCheck); + Utils::enableDlgControl(hwndDlg, IDC_ALWAYSPOPUPSINACTIVE, !nen_options.bWindowCheck); - SendDlgItemMessage(hwndDlg, IDC_AVATARMODE, CB_SETCURSEL, (WPARAM)cs->avatarMode, 0); - SendDlgItemMessage(hwndDlg, IDC_OWNAVATARMODE, CB_SETCURSEL, (WPARAM)cs->ownAvatarMode, 0); + SendDlgItemMessage(hwndDlg, IDC_AVATARMODE, CB_SETCURSEL, (WPARAM)cs->avatarMode, 0); + SendDlgItemMessage(hwndDlg, IDC_OWNAVATARMODE, CB_SETCURSEL, (WPARAM)cs->ownAvatarMode, 0); - Utils::showDlgControl(hwndDlg, IDC_O_EXPLAINGLOBALNOTIFY, nen_options.bWindowCheck ? SW_SHOW : SW_HIDE); + Utils::showDlgControl(hwndDlg, IDC_O_EXPLAINGLOBALNOTIFY, nen_options.bWindowCheck ? SW_SHOW : SW_HIDE); - SendDlgItemMessage(hwndDlg, IDC_AUTOCLOSETABSPIN, UDM_SETRANGE, 0, MAKELONG(1000, 0)); - SendDlgItemMessage(hwndDlg, IDC_AUTOCLOSETABSPIN, UDM_SETPOS, 0, (LPARAM)cs->autoCloseSeconds); + SendDlgItemMessage(hwndDlg, IDC_AUTOCLOSETABSPIN, UDM_SETRANGE, 0, MAKELONG(1000, 0)); + SendDlgItemMessage(hwndDlg, IDC_AUTOCLOSETABSPIN, UDM_SETPOS, 0, (LPARAM)cs->autoCloseSeconds); + } break; - } - case DM_SC_CONFIG: { - bool bEnable = IsDlgButtonChecked(hwndDlg, IDC_O_ENABLESOUNDS) != 0; - Utils::enableDlgControl(hwndDlg, IDC_O_SOUNDSINACTIVE, bEnable); - Utils::enableDlgControl(hwndDlg, IDC_O_SOUNDSUNFOCUSED, bEnable); - Utils::enableDlgControl(hwndDlg, IDC_O_SOUNDSMINIMIZED, bEnable); - Utils::enableDlgControl(hwndDlg, IDC_O_SOUNDSFOCUSED, bEnable); + case DM_SC_CONFIG: + { + bool bEnable = IsDlgButtonChecked(hwndDlg, IDC_O_ENABLESOUNDS) != 0; + Utils::enableDlgControl(hwndDlg, IDC_O_SOUNDSINACTIVE, bEnable); + Utils::enableDlgControl(hwndDlg, IDC_O_SOUNDSUNFOCUSED, bEnable); + Utils::enableDlgControl(hwndDlg, IDC_O_SOUNDSMINIMIZED, bEnable); + Utils::enableDlgControl(hwndDlg, IDC_O_SOUNDSFOCUSED, bEnable); + } return 0; - } - case DM_SC_BUILDLIST: { - DWORD dwNewFlags = 0, dwNewFlagsEx = 0; - TContainerSettings* cs = (TContainerSettings *)lParam; - - dwNewFlags = (IsDlgButtonChecked(hwndDlg, IDC_O_HIDETITLE) ? CNT_NOTITLE : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_O_DONTREPORT) ? CNT_DONTREPORT : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_O_NOTABS) ? CNT_HIDETABS : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_O_STICKY) ? CNT_STICKY : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_O_FLASHALWAYS) ? CNT_FLASHALWAYS : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_O_FLASHNEVER) ? CNT_NOFLASH : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENCY) ? CNT_TRANSPARENCY : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_DONTREPORTUNFOCUSED2) ? CNT_DONTREPORTUNFOCUSED : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_DONTREPORTFOCUSED2) ? CNT_DONTREPORTFOCUSED : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_ALWAYSPOPUPSINACTIVE) ? CNT_ALWAYSREPORTINACTIVE : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_CNTNOSTATUSBAR) ? CNT_NOSTATUSBAR : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_HIDEMENUBAR) ? CNT_NOMENUBAR : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_HIDETOOLBAR) ? CNT_HIDETOOLBAR : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_BOTTOMTOOLBAR) ? CNT_BOTTOMTOOLBAR : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_UIDSTATUSBAR) ? CNT_UINSTATUSBAR : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_USEGLOBALSIZE) ? CNT_GLOBALSIZE : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_INFOPANEL) ? CNT_INFOPANEL : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_O_ENABLESOUNDS) ? 0 : CNT_NOSOUND) | - (IsDlgButtonChecked(hwndDlg, IDC_AVATARSONTASKBAR) ? CNT_AVATARSONTASKBAR : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_VERTICALMAX) ? CNT_VERTICALMAX : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_AUTOSPLITTER) ? CNT_AUTOSPLITTER : 0) | - (CNT_NEWCONTAINERFLAGS); - - LRESULT iTabMode = SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_GETCURSEL, 0, 0); - LRESULT iTabLayout = SendDlgItemMessage(hwndDlg, IDC_SBARLAYOUT, CB_GETCURSEL, 0, 0); - - dwNewFlagsEx = 0; - - if (iTabMode < 2) - dwNewFlags = ((iTabMode == 1) ? (dwNewFlags | CNT_TABSBOTTOM) : (dwNewFlags & ~CNT_TABSBOTTOM)); - else { - dwNewFlags &= ~CNT_TABSBOTTOM; - dwNewFlagsEx = iTabMode == 2 ? TCF_SBARLEFT : TCF_SBARRIGHT; - } + case DM_SC_BUILDLIST: + { + DWORD dwNewFlags = 0, dwNewFlagsEx = 0; + TContainerSettings* cs = (TContainerSettings *)lParam; + + dwNewFlags = (IsDlgButtonChecked(hwndDlg, IDC_O_HIDETITLE) ? CNT_NOTITLE : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_O_DONTREPORT) ? CNT_DONTREPORT : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_O_NOTABS) ? CNT_HIDETABS : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_O_STICKY) ? CNT_STICKY : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_O_FLASHALWAYS) ? CNT_FLASHALWAYS : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_O_FLASHNEVER) ? CNT_NOFLASH : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENCY) ? CNT_TRANSPARENCY : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_DONTREPORTUNFOCUSED2) ? CNT_DONTREPORTUNFOCUSED : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_DONTREPORTFOCUSED2) ? CNT_DONTREPORTFOCUSED : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_ALWAYSPOPUPSINACTIVE) ? CNT_ALWAYSREPORTINACTIVE : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_CNTNOSTATUSBAR) ? CNT_NOSTATUSBAR : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_HIDEMENUBAR) ? CNT_NOMENUBAR : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_HIDETOOLBAR) ? CNT_HIDETOOLBAR : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_BOTTOMTOOLBAR) ? CNT_BOTTOMTOOLBAR : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_UIDSTATUSBAR) ? CNT_UINSTATUSBAR : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_USEGLOBALSIZE) ? CNT_GLOBALSIZE : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_INFOPANEL) ? CNT_INFOPANEL : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_O_ENABLESOUNDS) ? 0 : CNT_NOSOUND) | + (IsDlgButtonChecked(hwndDlg, IDC_AVATARSONTASKBAR) ? CNT_AVATARSONTASKBAR : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_VERTICALMAX) ? CNT_VERTICALMAX : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_AUTOSPLITTER) ? CNT_AUTOSPLITTER : 0) | + (CNT_NEWCONTAINERFLAGS); + + LRESULT iTabMode = SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_GETCURSEL, 0, 0); + LRESULT iTabLayout = SendDlgItemMessage(hwndDlg, IDC_SBARLAYOUT, CB_GETCURSEL, 0, 0); + + dwNewFlagsEx = 0; + + if (iTabMode < 2) + dwNewFlags = ((iTabMode == 1) ? (dwNewFlags | CNT_TABSBOTTOM) : (dwNewFlags & ~CNT_TABSBOTTOM)); + else { + dwNewFlags &= ~CNT_TABSBOTTOM; + dwNewFlagsEx = iTabMode == 2 ? TCF_SBARLEFT : TCF_SBARRIGHT; + } - dwNewFlagsEx |= ((IsDlgButtonChecked(hwndDlg, IDC_FLASHICON) ? TCF_FLASHICON : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_FLASHLABEL) ? TCF_FLASHLABEL : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_BUTTONTABS) ? TCF_FLAT : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_CLOSEBUTTONONTABS) ? TCF_CLOSEBUTTON : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_SINGLEROWTAB) ? TCF_SINGLEROWTABCONTROL : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_O_SOUNDSMINIMIZED) ? CNT_EX_SOUNDS_MINIMIZED : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_O_SOUNDSUNFOCUSED) ? CNT_EX_SOUNDS_UNFOCUSED : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_O_SOUNDSFOCUSED) ? CNT_EX_SOUNDS_FOCUSED : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_O_SOUNDSINACTIVE) ? CNT_EX_SOUNDS_INACTIVETABS : 0) - ); - - /* bits 24 - 31 of dwFlagsEx hold the sidebar layout id */ - dwNewFlagsEx |= ((int)((iTabLayout << 24) & 0xff000000)); - - if (IsDlgButtonChecked(hwndDlg, IDC_O_FLASHDEFAULT)) - dwNewFlags &= ~(CNT_FLASHALWAYS | CNT_NOFLASH); - - cs->dwFlags = dwNewFlags; - cs->dwFlagsEx = dwNewFlagsEx; - cs->autoCloseSeconds = (WORD)SendDlgItemMessage(hwndDlg, IDC_AUTOCLOSETABSPIN, UDM_GETPOS, 0, 0); + dwNewFlagsEx |= ((IsDlgButtonChecked(hwndDlg, IDC_FLASHICON) ? TCF_FLASHICON : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_FLASHLABEL) ? TCF_FLASHLABEL : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_BUTTONTABS) ? TCF_FLAT : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_CLOSEBUTTONONTABS) ? TCF_CLOSEBUTTON : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_SINGLEROWTAB) ? TCF_SINGLEROWTABCONTROL : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_O_SOUNDSMINIMIZED) ? CNT_EX_SOUNDS_MINIMIZED : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_O_SOUNDSUNFOCUSED) ? CNT_EX_SOUNDS_UNFOCUSED : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_O_SOUNDSFOCUSED) ? CNT_EX_SOUNDS_FOCUSED : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_O_SOUNDSINACTIVE) ? CNT_EX_SOUNDS_INACTIVETABS : 0) + ); + + /* bits 24 - 31 of dwFlagsEx hold the sidebar layout id */ + dwNewFlagsEx |= ((int)((iTabLayout << 24) & 0xff000000)); + + if (IsDlgButtonChecked(hwndDlg, IDC_O_FLASHDEFAULT)) + dwNewFlags &= ~(CNT_FLASHALWAYS | CNT_NOFLASH); + + cs->dwFlags = dwNewFlags; + cs->dwFlagsEx = dwNewFlagsEx; + cs->autoCloseSeconds = (WORD)SendDlgItemMessage(hwndDlg, IDC_AUTOCLOSETABSPIN, UDM_GETPOS, 0, 0); + } break; - } - case WM_DESTROY: { + + case WM_DESTROY: + Window_FreeIcon_IcoLib(hwndDlg); pContainer->hWndOptions = 0; SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0); @@ -551,6 +560,5 @@ INT_PTR CALLBACK DlgProcContainerOptions(HWND hwndDlg, UINT msg, WPARAM wParam, DeleteObject(hFont); break; } - } return FALSE; } diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index 141a1fbbd9..be944454c7 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -617,7 +617,7 @@ static INT_PTR CALLBACK DlgProcAbout(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR TranslateT("Version"), __MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM, v[3]); SetDlgItemText(hwndDlg, IDC_HEADERBAR, tStr); } - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)Skin_LoadIcon(SKINICON_EVENT_MESSAGE, true)); + Window_SetSkinIcon_IcoLib(hwndDlg, SKINICON_EVENT_MESSAGE); return TRUE; case WM_COMMAND: diff --git a/plugins/TabSRMM/src/utils.cpp b/plugins/TabSRMM/src/utils.cpp index 17e2680ba5..44f123e657 100644 --- a/plugins/TabSRMM/src/utils.cpp +++ b/plugins/TabSRMM/src/utils.cpp @@ -1175,8 +1175,7 @@ INT_PTR CALLBACK CWarning::dlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP m_hwnd = hwnd; ::SetWindowTextW(hwnd, TranslateT("TabSRMM warning message")); - ::SendMessage(hwnd, WM_SETICON, ICON_BIG, LPARAM(::Skin_LoadIcon(SKINICON_OTHER_MIRANDA, true))); - ::SendMessage(hwnd, WM_SETICON, ICON_SMALL, LPARAM(::Skin_LoadIcon(SKINICON_OTHER_MIRANDA))); + ::Window_SetSkinIcon_IcoLib(hwnd, SKINICON_OTHER_MIRANDA); ::SendDlgItemMessage(hwnd, IDC_WARNTEXT, EM_AUTOURLDETECT, TRUE, 0); ::SendDlgItemMessage(hwnd, IDC_WARNTEXT, EM_SETEVENTMASK, 0, ENM_LINK); diff --git a/plugins/UserInfoEx/src/dlg_propsheet.cpp b/plugins/UserInfoEx/src/dlg_propsheet.cpp index 148d7dad7f..f5f6a127ba 100644 --- a/plugins/UserInfoEx/src/dlg_propsheet.cpp +++ b/plugins/UserInfoEx/src/dlg_propsheet.cpp @@ -711,8 +711,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar ShowWindow(GetDlgItem(hDlg, IDC_PAGETITLEBG2), !IsAeroMode()); // set icons - SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIcon(ICO_COMMON_MAIN, false)); - SendMessage(hDlg, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIcon(ICO_COMMON_MAIN, true)); + Window_SetIcon_IcoLib(hDlg, IcoLib_GetIconHandle(ICO_COMMON_MAIN)); DlgProc(hDlg, HM_RELOADICONS, NULL, NULL); // load basic protocol for current contact (for faster load later on and better handling for owner protocol) @@ -1611,6 +1610,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar ResetUpdateInfo(pPs); // avoid any further message processing for this dialog page + Window_FreeIcon_IcoLib(hDlg); WindowList_Remove(g_hWindowList, hDlg); SetUserData(hDlg, NULL); diff --git a/plugins/Weather/src/weather_ini.cpp b/plugins/Weather/src/weather_ini.cpp index 31d3f28b6f..4bc8be70fe 100644 --- a/plugins/Weather/src/weather_ini.cpp +++ b/plugins/Weather/src/weather_ini.cpp @@ -163,8 +163,7 @@ static INT_PTR CALLBACK DlgProcSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR SendDlgItemMessage(hwndDlg, IDC_STEP4, BUTTONSETASFLATBTN, TRUE, 0); // set icons - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)LoadIconEx("main", TRUE)); - SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIconEx("main", FALSE)); + Window_SetIcon_IcoLib(hwndDlg, GetIconHandle("main")); WindowList_Add(hWindowList, hwndDlg, NULL); ShowWindow(hwndDlg, SW_SHOW); @@ -213,8 +212,7 @@ static INT_PTR CALLBACK DlgProcSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR break; case WM_DESTROY: - ReleaseIconEx((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_BIG, 0)); - ReleaseIconEx((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, 0)); + Window_FreeIcon_IcoLib(hwndDlg); break; } return FALSE; diff --git a/plugins/Weather/src/weather_userinfo.cpp b/plugins/Weather/src/weather_userinfo.cpp index cc99987a51..22b185c261 100644 --- a/plugins/Weather/src/weather_userinfo.cpp +++ b/plugins/Weather/src/weather_userinfo.cpp @@ -130,11 +130,9 @@ static INT_PTR CALLBACK DlgProcMoreData(HWND hwndDlg, UINT msg, WPARAM wParam, L DBDataManage(hContact, WDBM_DETAILDISPLAY, (WPARAM)hwndDlg, 0); // set icons - { - WORD statusIcon = db_get_w(hContact, WEATHERPROTONAME, "StatusIcon", 0); - ReleaseIconEx((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)Skin_LoadProtoIcon(WEATHERPROTONAME, statusIcon, true))); - ReleaseIconEx((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)Skin_LoadProtoIcon(WEATHERPROTONAME, statusIcon))); - } + Window_FreeIcon_IcoLib(hwndDlg); + Window_SetProtoIcon_IcoLib(hwndDlg, WEATHERPROTONAME, db_get_w(hContact, WEATHERPROTONAME, "StatusIcon", 0)); + RedrawWindow(GetDlgItem(hwndDlg, IDC_HEADERBAR), NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); break; @@ -227,9 +225,7 @@ static INT_PTR CALLBACK DlgProcMoreData(HWND hwndDlg, UINT msg, WPARAM wParam, L break; case WM_DESTROY: - ReleaseIconEx((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_BIG, 0)); - ReleaseIconEx((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, 0)); - + Window_FreeIcon_IcoLib(hwndDlg); Utils_SaveWindowPosition(hwndDlg, NULL, WEATHERPROTONAME, "BriefInfo_"); WindowList_Remove(hDataWindowList, hwndDlg); break; diff --git a/plugins/WhenWasIt/src/dlg_handlers.cpp b/plugins/WhenWasIt/src/dlg_handlers.cpp index 34b2f11524..f7f3945f39 100644 --- a/plugins/WhenWasIt/src/dlg_handlers.cpp +++ b/plugins/WhenWasIt/src/dlg_handlers.cpp @@ -403,7 +403,7 @@ INT_PTR CALLBACK DlgProcAddBirthday(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l WindowList_Add(hAddBirthdayWndsList, hWnd, hContact); Utils_RestoreWindowPositionNoSize(hWnd, hContact, ModuleName, "BirthdayWnd"); - SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIconByHandle(hAddBirthdayContact, 1)); + Window_SetIcon_IcoLib(hWnd, hAddBirthdayContact); for (int i = 0; i < cSaveModule; i++) SendDlgItemMessage(hWnd, IDC_COMPATIBILITY, CB_ADDSTRING, 0, (LPARAM)TranslateTS(szSaveModule[i])); @@ -473,7 +473,7 @@ INT_PTR CALLBACK DlgProcAddBirthday(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l case WM_DESTROY: RefreshContactListIcons(hContact); //the birthday might be changed, refresh icon. - IcoLib_ReleaseIcon((HICON)SendMessage(hWnd, WM_GETICON, ICON_BIG, 0)); + Window_FreeIcon_IcoLib(hWnd); Utils_SaveWindowPosition(hWnd, hContact, ModuleName, "BirthdayWnd"); WindowList_Remove(hAddBirthdayWndsList, hWnd); break; @@ -716,7 +716,7 @@ INT_PTR CALLBACK DlgProcBirthdays(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hWnd); - SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIconByHandle(hListMenu)); + Window_SetIcon_IcoLib(hWnd, hListMenu); { HWND hList = GetDlgItem(hWnd, IDC_BIRTHDAYS_LIST); @@ -832,7 +832,7 @@ INT_PTR CALLBACK DlgProcBirthdays(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa case WM_DESTROY: hBirthdaysDlg = NULL; Utils_SaveWindowPosition(hWnd, NULL, ModuleName, "BirthdayList"); - IcoLib_ReleaseIcon((HICON)SendMessage(hWnd, WM_GETICON, ICON_BIG, 0)); + Window_FreeIcon_IcoLib(hWnd); lastColumn = -1; break; @@ -848,9 +848,9 @@ INT_PTR CALLBACK DlgProcUpcoming(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hWnd); + Window_SetIcon_IcoLib(hWnd, hListMenu); { timeout = commonData.cDlgTimeout; - SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIconByHandle(hListMenu)); HWND hList = GetDlgItem(hWnd, IDC_UPCOMING_LIST); mir_subclassWindow(hList, BirthdaysListSubclassProc); @@ -960,7 +960,7 @@ INT_PTR CALLBACK DlgProcUpcoming(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar case WM_DESTROY: hUpcomingDlg = NULL; Utils_SaveWindowPosition(hWnd, NULL, ModuleName, "BirthdayListUpcoming"); - IcoLib_ReleaseIcon((HICON)SendMessage(hWnd, WM_GETICON, ICON_BIG, 0)); + Window_FreeIcon_IcoLib(hWnd); KillTimer(hWnd, UPCOMING_TIMER_ID); break; } diff --git a/plugins/YAMN/src/browser/badconnect.cpp b/plugins/YAMN/src/browser/badconnect.cpp index 69274be795..6b86acf6d9 100644 --- a/plugins/YAMN/src/browser/badconnect.cpp +++ b/plugins/YAMN/src/browser/badconnect.cpp @@ -230,8 +230,7 @@ void __cdecl BadConnection(void *Param) __try { hBadConnect = CreateDialogParam(YAMNVar.hInst, MAKEINTRESOURCE(IDD_DLGBADCONNECT), NULL, DlgProcYAMNBadConnection, (LPARAM)&MyParam); - SendMessage(hBadConnect, WM_SETICON, ICON_BIG, (LPARAM)g_LoadIconEx(3)); - SendMessage(hBadConnect, WM_SETICON, ICON_SMALL, (LPARAM)g_LoadIconEx(3)); + Window_SetIcon_IcoLib(hBadConnect, g_GetIconHandle(3)); #ifdef DEBUG_SYNCHRO DebugLog(SynchroFile,"BadConnect:ActualAccountSO-read wait\n"); diff --git a/plugins/YAMN/src/browser/mailbrowser.cpp b/plugins/YAMN/src/browser/mailbrowser.cpp index 498f96a54a..c9ec017cbc 100644 --- a/plugins/YAMN/src/browser/mailbrowser.cpp +++ b/plugins/YAMN/src/browser/mailbrowser.cpp @@ -1268,8 +1268,7 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR HWND hListView = GetDlgItem(hDlg, IDC_LISTHEADERS); mir_subclassWindow(GetDlgItem(hDlg, IDC_SPLITTER), SplitterSubclassProc); SetWindowLongPtr(hDlg, DWLP_USER, (LONG_PTR)MailParam); - SendMessage(hDlg, WM_SETICON, (WPARAM)ICON_BIG, (LPARAM)g_LoadIconEx(2, true)); - SendMessage(hDlg, WM_SETICON, (WPARAM)ICON_SMALL, (LPARAM)g_LoadIconEx(2)); + Window_SetIcon_IcoLib(hDlg, g_GetIconHandle(2)); ListView_SetUnicodeFormat(hListView, TRUE); ListView_SetExtendedListViewStyle(hListView, LVS_EX_FULLROWSELECT); @@ -1476,6 +1475,7 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR return (INT_PTR)GetSysColorBrush(COLOR_WINDOW); case WM_DESTROY: + Window_FreeIcon_IcoLib(hDlg); { RECT coord; if (GetWindowRect(hDlg, &coord)) { @@ -1706,6 +1706,8 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR LVCOLUMN ColInfo; HYAMNMAIL Parser; + Window_FreeIcon_IcoLib(hDlg); + struct CMailWinUserInfo *mwui = (struct CMailWinUserInfo *)GetWindowLongPtr(hDlg, DWLP_USER); if (NULL == (ActualAccount = GetWindowAccount(hDlg))) break; @@ -1783,6 +1785,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR PostQuitMessage(0); } break; + case WM_SHOWWINDOW: { struct CMailWinUserInfo *mwui = (struct CMailWinUserInfo *)GetWindowLongPtr(hDlg, DWLP_USER); @@ -1791,6 +1794,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR return 0; mwui->Seen = TRUE; } + case WM_YAMN_CHANGESTATUS: if (NULL == (ActualAccount = GetWindowAccount(hDlg))) break; @@ -2340,8 +2344,7 @@ void __cdecl MailBrowser(void *Param) WndFound = TRUE; if ((hMailBrowser == NULL) && ((MyParam.nflags & YAMN_ACC_MSG) || (MyParam.nflags & YAMN_ACC_ICO) || (MyParam.nnflags & YAMN_ACC_MSG))) { hMailBrowser = CreateDialogParamW(YAMNVar.hInst, MAKEINTRESOURCEW(IDD_DLGVIEWMESSAGES), NULL, DlgProcYAMNMailBrowser, (LPARAM)&MyParam); - SendMessage(hMailBrowser, WM_SETICON, (WPARAM)ICON_BIG, (LPARAM)g_LoadIconEx(2, true)); - SendMessage(hMailBrowser, WM_SETICON, (WPARAM)ICON_SMALL, (LPARAM)g_LoadIconEx(2)); + Window_SetIcon_IcoLib(hMailBrowser, g_GetIconHandle(2)); MoveWindow(hMailBrowser, PosX, PosY, SizeX, SizeY, TRUE); } diff --git a/plugins/YAPP/src/yapp_history_dlg.cpp b/plugins/YAPP/src/yapp_history_dlg.cpp index b8173a6f67..33cb01c1a2 100644 --- a/plugins/YAPP/src/yapp_history_dlg.cpp +++ b/plugins/YAPP/src/yapp_history_dlg.cpp @@ -580,12 +580,9 @@ INT_PTR CALLBACK DlgProcHistLst(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara switch (msg) { case WM_INITDIALOG: bInitializing = 1; + Window_SetIcon_IcoLib(hWnd, IcoLib_GetIconHandle(ICO_HISTORY)); { int renderer = lstPopupHistory.GetRenderer(); - - SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIcon(ICO_HISTORY,0)); - SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIcon(ICO_HISTORY,1)); - LoadRenderer(hWnd, renderer); TranslateDialogDefault(hWnd); diff --git a/protocols/AimOscar/src/theme.cpp b/protocols/AimOscar/src/theme.cpp index 139b7ca412..134011214f 100644 --- a/protocols/AimOscar/src/theme.cpp +++ b/protocols/AimOscar/src/theme.cpp @@ -57,7 +57,7 @@ static IconItem iconList[] = void InitIcons(void) { Icon_Register(hInstance, "Protocols/AIM", iconList, 14, "AIM"); - Icon_Register(hInstance, "Protocols/AIM/" LPGEN("Profile Editor"), iconList+14, 14, "AIM"); + Icon_Register(hInstance, "Protocols/AIM/" LPGEN("Profile Editor"), iconList + 14, 14, "AIM"); } HICON LoadIconEx(const char *name, bool big) @@ -69,8 +69,8 @@ HICON LoadIconEx(const char *name, bool big) HANDLE GetIconHandle(const char *name) { - for (int i=0; i < _countof(iconList); i++) - if ( !mir_strcmp(iconList[i].szName, name)) + for (int i = 0; i < _countof(iconList); i++) + if (!mir_strcmp(iconList[i].szName, name)) return iconList[i].hIcolib; return NULL; @@ -83,12 +83,6 @@ void ReleaseIconEx(const char *name, bool big) IcoLib_Release(szSettingName, big); } -void Window_SetIcon(HWND hWnd, const char* name) -{ - SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)LoadIconEx( name, true )); - SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)LoadIconEx( name )); -} - ///////////////////////////////////////////////////////////////////////////////////////// // Extra Icons @@ -139,14 +133,14 @@ void set_contact_icon(CAimProto* ppro, MCONTACT hContact) void remove_AT_icons(CAimProto* ppro) { for (MCONTACT hContact = db_find_first(ppro->m_szModuleName); hContact; hContact = db_find_next(hContact, ppro->m_szModuleName)) - if (!ppro->isChatRoom(hContact)) + if (!ppro->isChatRoom(hContact)) ExtraIcon_Clear(hExtraAT, hContact); } void remove_ES_icons(CAimProto* ppro) { for (MCONTACT hContact = db_find_first(ppro->m_szModuleName); hContact; hContact = db_find_next(hContact, ppro->m_szModuleName)) - if (!ppro->isChatRoom(hContact)) + if (!ppro->isChatRoom(hContact)) ExtraIcon_Clear(hExtraES, hContact); } @@ -230,7 +224,7 @@ void CAimProto::InitMainMenus(void) CreateProtoService(mi.pszService, &CAimProto::JoinChatUI); mi.position = 201003; mi.hIcolibItem = GetIconHandle("aol"); - mi.name.a = LPGEN( "Join Chat Room" ); + mi.name.a = LPGEN("Join Chat Room"); m_hMainMenu[2] = Menu_AddProtoMenuItem(&mi, m_szModuleName); } @@ -239,7 +233,7 @@ void CAimProto::InitContactMenus(void) CMenuItem mi; SET_UID(mi, 0xb961e2af, 0x87a, 0x4fbf, 0xb5, 0x32, 0x6, 0xe2, 0x18, 0xad, 0x29, 0xac); - CreateProtoService("/GetHTMLAwayMsg",&CAimProto::GetHTMLAwayMsg); + CreateProtoService("/GetHTMLAwayMsg", &CAimProto::GetHTMLAwayMsg); mi.pszService = "/GetHTMLAwayMsg"; mi.position = -2000006000; mi.hIcolibItem = GetIconHandle("away"); @@ -257,7 +251,7 @@ void CAimProto::InitContactMenus(void) Menu_AddContactMenuItem(&mi, m_szModuleName); SET_UID(mi, 0x3928ba10, 0x69bc, 0x4ec9, 0x96, 0x48, 0xa4, 0x1b, 0xbe, 0x58, 0x4a, 0x7e); - CreateProtoService("/AddToServerList", &CAimProto::AddToServerList); + CreateProtoService("/AddToServerList", &CAimProto::AddToServerList); mi.pszService = "/AddToServerList"; mi.position = -2000005080; mi.hIcolibItem = GetIconHandle("add"); diff --git a/protocols/AimOscar/src/theme.h b/protocols/AimOscar/src/theme.h index 70baf03d61..73fde85851 100644 --- a/protocols/AimOscar/src/theme.h +++ b/protocols/AimOscar/src/theme.h @@ -26,8 +26,6 @@ HICON LoadIconEx(const char *name, bool big = false); HANDLE GetIconHandle(const char *name); void ReleaseIconEx(const char *name, bool big = false); -void Window_SetIcon(HWND hWnd, const char *name); - void add_AT_icons(CAimProto* ppro); void remove_AT_icons(CAimProto* ppro); void add_ES_icons(CAimProto* ppro); diff --git a/protocols/AimOscar/src/ui.cpp b/protocols/AimOscar/src/ui.cpp index 08efc8b35f..d8df3f87f6 100755 --- a/protocols/AimOscar/src/ui.cpp +++ b/protocols/AimOscar/src/ui.cpp @@ -1155,7 +1155,8 @@ INT_PTR CALLBACK instant_idle_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); ppro = (CAimProto*)lParam; { - Window_SetIcon(hwndDlg, "idle"); + Window_SetIcon_IcoLib(hwndDlg, GetIconHandle("idle")); + unsigned long it = ppro->getDword(AIM_KEY_IIT, 0); unsigned long hours = it / 60; unsigned long minutes = it % 60; @@ -1216,7 +1217,7 @@ INT_PTR CALLBACK join_chat_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); ppro = (CAimProto*)lParam; - Window_SetIcon(hwndDlg, "aol"); + Window_SetIcon_IcoLib(hwndDlg, GetIconHandle("aol")); break; case WM_CLOSE: @@ -1325,7 +1326,7 @@ INT_PTR CALLBACK invite_to_chat_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); param = (invite_chat_param*)lParam; - Window_SetIcon(hwndDlg, "aol"); + Window_SetIcon_IcoLib(hwndDlg, GetIconHandle("aol")); SetDlgItemTextA(hwndDlg, IDC_ROOMNAME, param->id); SetDlgItemTextA(hwndDlg, IDC_MSG, Translate("Join me in this buddy chat!")); break; @@ -1414,7 +1415,7 @@ INT_PTR CALLBACK chat_request_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); param = (invite_chat_req_param*)lParam; - Window_SetIcon(hwndDlg, "aol"); + Window_SetIcon_IcoLib(hwndDlg, GetIconHandle("aol")); SetDlgItemTextA(hwndDlg, IDC_ROOMNAME, strrchr(param->cnp->id, '-') + 1); SetDlgItemTextA(hwndDlg, IDC_SCREENNAME, param->name); diff --git a/protocols/Dummy/src/dummy_options.cpp b/protocols/Dummy/src/dummy_options.cpp index 7f86602d08..935dc955ff 100644 --- a/protocols/Dummy/src/dummy_options.cpp +++ b/protocols/Dummy/src/dummy_options.cpp @@ -46,8 +46,7 @@ INT_PTR CALLBACK DummyAccountProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM ppro = (CDummyProto*)lParam; SetWindowLongPtr( hwndDlg, GWLP_USERDATA, lParam ); - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIconByHandle(ppro->m_hProtoIcon, true)); - SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIconByHandle(ppro->m_hProtoIcon)); + Window_SetIcon_IcoLib(hwndDlg, ppro->m_hProtoIcon); { SendDlgItemMessageA(hwndDlg, IDC_TEMPLATE, CB_INSERTSTRING, 0, reinterpret_cast(Translate(templates[0].name))); for (size_t i = 1; i < _countof(templates); i++) @@ -108,8 +107,7 @@ INT_PTR CALLBACK DummyAccountProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM break; case WM_DESTROY: - IcoLib_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_BIG, 0)); - IcoLib_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_SMALL, 0)); + Window_FreeIcon_IcoLib(hwndDlg); break; } diff --git a/protocols/FacebookRM/src/captcha.cpp b/protocols/FacebookRM/src/captcha.cpp index 1a1d167e3f..c1e82e8865 100644 --- a/protocols/FacebookRM/src/captcha.cpp +++ b/protocols/FacebookRM/src/captcha.cpp @@ -39,8 +39,7 @@ static INT_PTR CALLBACK CaptchaFormDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIconByHandle(GetIconHandle("key"), TRUE)); - SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIconByHandle(GetIconHandle("key"))); + Window_SetIcon_IcoLib(hwndDlg, GetIconHandle("key")); params = (CAPTCHA_FORM_PARAMS*)lParam; SetDlgItemText(hwndDlg, IDC_INSTRUCTION, TranslateT("Enter the text you see")); @@ -95,8 +94,7 @@ static INT_PTR CALLBACK CaptchaFormDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam break; case WM_DESTROY: - IcoLib_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_BIG, 0)); - IcoLib_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, 0)); + Window_FreeIcon_IcoLib(hwndDlg); break; } return FALSE; diff --git a/protocols/FacebookRM/src/dialogs.cpp b/protocols/FacebookRM/src/dialogs.cpp index 85571b2508..60ad764628 100644 --- a/protocols/FacebookRM/src/dialogs.cpp +++ b/protocols/FacebookRM/src/dialogs.cpp @@ -193,7 +193,7 @@ INT_PTR CALLBACK FBMindProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lpara { TranslateDialogDefault(hwnd); - SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIconByHandle(GetIconHandle("mind"))); + Window_SetIcon_IcoLib(hwnd, GetIconHandle("mind")); data = reinterpret_cast(lparam); @@ -650,8 +650,7 @@ CFacebookGuardDialog::CFacebookGuardDialog(FacebookProto *proto, const char *fb_ void CFacebookGuardDialog::OnInitDialog() { - SendMessage(m_hwnd, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIconByHandle(GetIconHandle("facebook"), TRUE)); - SendMessage(m_hwnd, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIconByHandle(GetIconHandle("facebook"))); + Window_SetIcon_IcoLib(m_hwnd, GetIconHandle("facebook")); SendMessage(m_text.GetHwnd(), EM_LIMITTEXT, 6, 0); diff --git a/protocols/Gadu-Gadu/src/gg.h b/protocols/Gadu-Gadu/src/gg.h index 7a8d0978e2..a06ed4dfb2 100644 --- a/protocols/Gadu-Gadu/src/gg.h +++ b/protocols/Gadu-Gadu/src/gg.h @@ -322,8 +322,6 @@ void gg_icolib_init(); HICON LoadIconEx(const char* name, bool big); HANDLE GetIconHandle(int iconId); void ReleaseIconEx(const char* name, bool big); -void WindowSetIcon(HWND hWnd, const char* name); -void WindowFreeIcon(HWND hWnd); /* URI parser functions */ void gg_links_instancemenu_init(); diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp index ba8ad0b620..305e398548 100644 --- a/protocols/Gadu-Gadu/src/groupchat.cpp +++ b/protocols/Gadu-Gadu/src/groupchat.cpp @@ -442,7 +442,7 @@ static INT_PTR CALLBACK gg_gc_openconfdlg(HWND hwndDlg, UINT message, WPARAM wPa SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)lParam); TranslateDialogDefault(hwndDlg); - WindowSetIcon(hwndDlg, "conference"); + Window_SetIcon_IcoLib(hwndDlg, GetIconHandle(IDI_CONFERENCE)); gg_gc_resetclistopts(GetDlgItem(hwndDlg, IDC_CLIST)); // Hook MetaContacts event (if available) @@ -567,8 +567,9 @@ static INT_PTR CALLBACK gg_gc_openconfdlg(HWND hwndDlg, UINT message, WPARAM wPa case WM_DESTROY: { HANDLE hMetaContactsEvent = (HANDLE)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - if (hMetaContactsEvent) UnhookEvent(hMetaContactsEvent); - WindowFreeIcon(hwndDlg); + if (hMetaContactsEvent) + UnhookEvent(hMetaContactsEvent); + Window_FreeIcon_IcoLib(hwndDlg); break; } } diff --git a/protocols/Gadu-Gadu/src/icolib.cpp b/protocols/Gadu-Gadu/src/icolib.cpp index ea6e2503a2..0a81610891 100644 --- a/protocols/Gadu-Gadu/src/icolib.cpp +++ b/protocols/Gadu-Gadu/src/icolib.cpp @@ -69,15 +69,3 @@ void ReleaseIconEx(const char* name, bool big) mir_snprintf(szSettingName, "%s_%s", GGDEF_PROTO, name); IcoLib_Release(szSettingName, big); } - -void WindowSetIcon(HWND hWnd, const char* name) -{ - SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)LoadIconEx(name, TRUE)); - SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)LoadIconEx(name, FALSE)); -} - -void WindowFreeIcon(HWND hWnd) -{ - IcoLib_ReleaseIcon((HICON)SendMessage(hWnd, WM_SETICON, ICON_BIG, 0)); - IcoLib_ReleaseIcon((HICON)SendMessage(hWnd, WM_SETICON, ICON_SMALL, 0)); -} diff --git a/protocols/Gadu-Gadu/src/image.cpp b/protocols/Gadu-Gadu/src/image.cpp index 2f9d849c7e..87ccaa2a54 100644 --- a/protocols/Gadu-Gadu/src/image.cpp +++ b/protocols/Gadu-Gadu/src/image.cpp @@ -416,8 +416,8 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP SendDlgItemMessage(hwndDlg, IDC_IMG_SAVE, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Save image to disk"), BATF_TCHAR); // Set main window image - WindowSetIcon(hwndDlg, "image"); - + Window_SetIcon_IcoLib(hwndDlg, GetIconHandle(IDI_IMAGE)); + TCHAR *szName = pcli->pfnGetContactDisplayName(dat->hContact, 0), szTitle[128]; if (dat->bReceiving) mir_sntprintf(szTitle, TranslateT("Image from %s"), szName); @@ -519,7 +519,7 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP ReleaseIconEx("next", FALSE); ReleaseIconEx("delete", FALSE); ReleaseIconEx("save", FALSE); - WindowFreeIcon(hwndDlg); + Window_FreeIcon_IcoLib(hwndDlg); gg->gg_EnterCriticalSection(&gg->img_mutex, "gg_img_dlgproc", 58, "img_mutex", 1); list_remove(&gg->imagedlgs, dat, 1); gg->gg_LeaveCriticalSection(&gg->img_mutex, "gg_img_dlgproc", 58, 1, "img_mutex", 1); diff --git a/protocols/Gadu-Gadu/src/sessions.cpp b/protocols/Gadu-Gadu/src/sessions.cpp index 6ef0fafce7..ba881c9d3a 100644 --- a/protocols/Gadu-Gadu/src/sessions.cpp +++ b/protocols/Gadu-Gadu/src/sessions.cpp @@ -170,7 +170,7 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w GetWindowText(hwndDlg, oldTitle, _countof(oldTitle)); mir_sntprintf(newTitle, oldTitle, gg->m_tszUserName); SetWindowText(hwndDlg, newTitle); - WindowSetIcon(hwndDlg, "sessions"); + Window_SetIcon_IcoLib(hwndDlg, GetIconHandle(IDI_SESSIONS)); if (hHandCursor == NULL) hHandCursor = LoadCursor(NULL, IDC_HAND); @@ -383,7 +383,7 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w HANDLE hProtoAckEvent = (HANDLE)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); if (hProtoAckEvent) UnhookEvent(hProtoAckEvent); gg->hwndSessionsDlg = NULL; - WindowFreeIcon(hwndDlg); + Window_FreeIcon_IcoLib(hwndDlg); break; } } diff --git a/protocols/Gadu-Gadu/src/userutils.cpp b/protocols/Gadu-Gadu/src/userutils.cpp index e513112247..90cc89579a 100644 --- a/protocols/Gadu-Gadu/src/userutils.cpp +++ b/protocols/Gadu-Gadu/src/userutils.cpp @@ -211,7 +211,7 @@ INT_PTR CALLBACK gg_userutildlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); - WindowSetIcon(hwndDlg, "settings"); + Window_SetIcon_IcoLib(hwndDlg, GetIconHandle(IDI_SETTINGS)); dat = (GGUSERUTILDLGDATA *)lParam; SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam); if (dat) SetDlgItemTextA(hwndDlg, IDC_EMAIL, dat->email); // Readup email @@ -271,7 +271,7 @@ INT_PTR CALLBACK gg_userutildlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA break; case WM_DESTROY: - WindowFreeIcon(hwndDlg); + Window_FreeIcon_IcoLib(hwndDlg); break; } return FALSE; diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp index 98de854279..0f4caf2a54 100644 --- a/protocols/IRCG/src/ircproto.cpp +++ b/protocols/IRCG/src/ircproto.cpp @@ -719,7 +719,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")); - WindowSetIcon(hwnd, IDI_MAIN); + Window_SetIcon_IcoLib(hwnd, GetIconHandle(IDI_MAIN)); ShowWindow(hwnd, SW_SHOW); SetActiveWindow(hwnd); } diff --git a/protocols/IRCG/src/options.cpp b/protocols/IRCG/src/options.cpp index 4fe3b827e4..7d13696798 100644 --- a/protocols/IRCG/src/options.cpp +++ b/protocols/IRCG/src/options.cpp @@ -228,24 +228,6 @@ HANDLE GetIconHandle(int iconId) return NULL; } -void ReleaseIconEx(HICON hIcon) -{ - if (hIcon) - IcoLib_ReleaseIcon(hIcon); -} - -void WindowSetIcon(HWND hWnd, int iconId) -{ - SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)LoadIconEx(iconId, true)); - SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)LoadIconEx(iconId)); -} - -void WindowFreeIcon(HWND hWnd) -{ - ReleaseIconEx((HICON)SendMessage(hWnd, WM_SETICON, ICON_BIG, 0)); - ReleaseIconEx((HICON)SendMessage(hWnd, WM_SETICON, ICON_SMALL, 0)); -} - ///////////////////////////////////////////////////////////////////////////////////////// // code page handler diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp index 46241256c7..19909dfc4b 100644 --- a/protocols/IRCG/src/services.cpp +++ b/protocols/IRCG/src/services.cpp @@ -351,7 +351,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")); - WindowSetIcon(m_quickDlg->GetHwnd(), IDI_QUICK); + Window_SetIcon_IcoLib(m_quickDlg->GetHwnd(), GetIconHandle(IDI_QUICK)); } ShowWindow(m_quickDlg->GetHwnd(), SW_SHOW); diff --git a/protocols/IRCG/src/stdafx.h b/protocols/IRCG/src/stdafx.h index bc450f78ac..6870a538d2 100644 --- a/protocols/IRCG/src/stdafx.h +++ b/protocols/IRCG/src/stdafx.h @@ -610,15 +610,11 @@ void InitServers(void); void RereadServers(void); void InitContactMenus(void); -void UninitContactMenus(void); - -void WindowSetIcon(HWND hWnd, int iconId); -void WindowFreeIcon(HWND hWnd); +void UninitContactMenus(void); void InitIcons(void); HICON LoadIconEx(int iIndex, bool big = false); HANDLE GetIconHandle(int iconId); -void ReleaseIconEx(HICON hIcon); //tools.cpp int __stdcall WCCmp(const TCHAR* wild, const TCHAR* string); diff --git a/protocols/IRCG/src/windows.cpp b/protocols/IRCG/src/windows.cpp index fded5db590..78417104da 100644 --- a/protocols/IRCG/src/windows.cpp +++ b/protocols/IRCG/src/windows.cpp @@ -87,7 +87,7 @@ void CWhoisDlg::OnInitDialog() CCoolIrcDlg::OnInitDialog(); - WindowSetIcon(m_hwnd, IDI_WHOIS); + Window_SetIcon_IcoLib(m_hwnd, GetIconHandle(IDI_WHOIS)); } void CWhoisDlg::OnClose() @@ -208,7 +208,7 @@ CNickDlg::CNickDlg(CIrcProto *_pro) void CNickDlg::OnInitDialog() { CCoolIrcDlg::OnInitDialog(); - WindowSetIcon(m_hwnd, IDI_RENAME); + Window_SetIcon_IcoLib(m_hwnd, GetIconHandle(IDI_RENAME)); DBVARIANT dbv; if (!m_proto->getTString("RecentNicks", &dbv)) { @@ -292,7 +292,7 @@ void CListDlg::OnInitDialog() m_list.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT); m_list2.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT); - WindowSetIcon(m_hwnd, IDI_LIST); + Window_SetIcon_IcoLib(m_hwnd, GetIconHandle(IDI_LIST)); m_status.SetText(TranslateT("Please wait...")); } @@ -714,7 +714,7 @@ void CQuestionDlg::OnInitDialog() { CCoolIrcDlg::OnInitDialog(); - WindowSetIcon(m_hwnd, IDI_IRCQUESTION); + Window_SetIcon_IcoLib(m_hwnd, GetIconHandle(IDI_IRCQUESTION)); } void CQuestionDlg::OnClose() @@ -873,7 +873,7 @@ void CManagerDlg::OnInitDialog() HWND hwndEdit = ChildWindowFromPoint(m_topic.GetHwnd(), pt); mir_subclassWindow(hwndEdit, MgrEditSubclassProc); - WindowSetIcon(m_hwnd, IDI_MANAGER); + Window_SetIcon_IcoLib(m_hwnd, GetIconHandle(IDI_MANAGER)); m_list.SendMsg(LB_SETHORIZONTALEXTENT, 750, NULL); m_radio1.SetState(true); @@ -1395,8 +1395,8 @@ void CCoolIrcDlg::OnDestroy() SendDlgItemMessage(m_hwnd, IDC_CAPTION, WM_SETFONT, SendDlgItemMessage(m_hwnd, IDOK, WM_GETFONT, 0, 0), 0); DeleteObject(hFont); - ReleaseIconEx((HICON)SendDlgItemMessage(m_hwnd, IDC_LOGO, STM_SETICON, 0, 0)); - WindowFreeIcon(m_hwnd); + IcoLib_ReleaseIcon((HICON)SendDlgItemMessage(m_hwnd, IDC_LOGO, STM_SETICON, 0, 0)); + Window_FreeIcon_IcoLib(m_hwnd); } INT_PTR CCoolIrcDlg::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) diff --git a/protocols/IcqOscarJ/src/icq_firstrun.cpp b/protocols/IcqOscarJ/src/icq_firstrun.cpp index 91a5de00f0..6edbd69a04 100644 --- a/protocols/IcqOscarJ/src/icq_firstrun.cpp +++ b/protocols/IcqOscarJ/src/icq_firstrun.cpp @@ -50,8 +50,7 @@ INT_PTR CALLBACK icq_FirstRunDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR ppro = (CIcqProto*)lParam; SetWindowLongPtr( hwndDlg, GWLP_USERDATA, lParam ); - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIconByHandle(ppro->m_hProtoIcon, true)); - SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIconByHandle(ppro->m_hProtoIcon)); + Window_SetIcon_IcoLib(hwndDlg, ppro->m_hProtoIcon); SendDlgItemMessage(hwndDlg, IDC_PW, EM_LIMITTEXT, PASSWORDMAXLEN - 1, 0); @@ -59,8 +58,7 @@ INT_PTR CALLBACK icq_FirstRunDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR return TRUE; case WM_DESTROY: - IcoLib_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_BIG, 0)); - IcoLib_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_SMALL, 0)); + Window_FreeIcon_IcoLib(hwndDlg); break; case WM_CLOSE: diff --git a/protocols/IcqOscarJ/src/icq_xstatus.cpp b/protocols/IcqOscarJ/src/icq_xstatus.cpp index d2443c4943..6d428290aa 100644 --- a/protocols/IcqOscarJ/src/icq_xstatus.cpp +++ b/protocols/IcqOscarJ/src/icq_xstatus.cpp @@ -758,10 +758,8 @@ static INT_PTR CALLBACK SetXStatusDlgProc(HWND hwndDlg, UINT message, WPARAM wPa db_set_utf(NULL, dat->ppro->m_szModuleName, DBSETTING_XSTATUS_NAME, szValue); SAFE_FREE(&szValue); - if (dat->bXStatus) { - IcoLib_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_BIG, 0)); - IcoLib_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_SMALL, 0)); - } + if (dat->bXStatus) + Window_FreeIcon_IcoLib(hwndDlg); } dat->ppro->updateServerCustomStatus(TRUE); } diff --git a/protocols/IcqOscarJ/src/loginpassword.cpp b/protocols/IcqOscarJ/src/loginpassword.cpp index 81ea3741ed..02cfbbd7eb 100644 --- a/protocols/IcqOscarJ/src/loginpassword.cpp +++ b/protocols/IcqOscarJ/src/loginpassword.cpp @@ -36,8 +36,7 @@ INT_PTR CALLBACK LoginPasswdDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA ppro = (CIcqProto*)lParam; SetWindowLongPtr( hwndDlg, GWLP_USERDATA, lParam ); - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIconByHandle(ppro->m_hProtoIcon, true)); - SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIconByHandle(ppro->m_hProtoIcon)); + Window_SetIcon_IcoLib(hwndDlg, ppro->m_hProtoIcon); { DWORD dwUin = ppro->getContactUin(NULL); @@ -52,8 +51,7 @@ INT_PTR CALLBACK LoginPasswdDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA break; case WM_DESTROY: - IcoLib_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_BIG, 0)); - IcoLib_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_SMALL, 0)); + Window_FreeIcon_IcoLib(hwndDlg); break; case WM_CLOSE: diff --git a/protocols/JabberG/src/jabber_adhoc.cpp b/protocols/JabberG/src/jabber_adhoc.cpp index e18b14207d..1c2c64c15d 100644 --- a/protocols/JabberG/src/jabber_adhoc.cpp +++ b/protocols/JabberG/src/jabber_adhoc.cpp @@ -494,7 +494,7 @@ static INT_PTR CALLBACK JabberAdHoc_CommandDlgProc(HWND hwndDlg, UINT msg, WPARA case WM_DESTROY: JabberFormDestroyUI(GetDlgItem(hwndDlg, IDC_FRAME)); - WindowFreeIcon(hwndDlg); + Window_FreeIcon_IcoLib(hwndDlg); dat->proto->m_hwndCommandWindow = NULL; mir_free(dat->ResponderJID); diff --git a/protocols/JabberG/src/jabber_captcha.cpp b/protocols/JabberG/src/jabber_captcha.cpp index 607bb047a2..5119579a86 100644 --- a/protocols/JabberG/src/jabber_captcha.cpp +++ b/protocols/JabberG/src/jabber_captcha.cpp @@ -44,8 +44,7 @@ INT_PTR CALLBACK JabberCaptchaFormDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, switch (msg) { case WM_INITDIALOG: { TranslateDialogDefault(hwndDlg); - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)Skin_LoadIcon(IDI_KEYS, true)); - SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)Skin_LoadIcon(IDI_KEYS)); + Window_SetSkinIcon_IcoLib(hwndDlg, IDI_KEYS); params = (CAPTCHA_FORM_PARAMS*)lParam; LPCTSTR hint = params->hint; @@ -104,7 +103,7 @@ INT_PTR CALLBACK JabberCaptchaFormDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, break; case WM_DESTROY: - WindowFreeIcon(hwndDlg); + Window_FreeIcon_IcoLib(hwndDlg); break; } return FALSE; diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp index 23bfb6e3f0..be0f1efadf 100644 --- a/protocols/JabberG/src/jabber_chat.cpp +++ b/protocols/JabberG/src/jabber_chat.cpp @@ -976,9 +976,9 @@ static INT_PTR CALLBACK sttUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam break; case WM_DESTROY: - WindowFreeIcon(hwndDlg); - g_ReleaseIcon((HICON)SendDlgItemMessage(hwndDlg, IDC_BTN_AFFILIATION, BM_SETIMAGE, IMAGE_ICON, 0)); - g_ReleaseIcon((HICON)SendDlgItemMessage(hwndDlg, IDC_BTN_ROLE, BM_SETIMAGE, IMAGE_ICON, 0)); + Window_FreeIcon_IcoLib(hwndDlg); + IcoLib_ReleaseIcon((HICON)SendDlgItemMessage(hwndDlg, IDC_BTN_AFFILIATION, BM_SETIMAGE, IMAGE_ICON, 0)); + IcoLib_ReleaseIcon((HICON)SendDlgItemMessage(hwndDlg, IDC_BTN_ROLE, BM_SETIMAGE, IMAGE_ICON, 0)); if (dat) { SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0); mir_free(dat); diff --git a/protocols/JabberG/src/jabber_console.cpp b/protocols/JabberG/src/jabber_console.cpp index 9b55445cd9..721fed6aac 100644 --- a/protocols/JabberG/src/jabber_console.cpp +++ b/protocols/JabberG/src/jabber_console.cpp @@ -380,7 +380,7 @@ void CJabberDlgConsole::OnInitDialog() for (int i=0; i < _countof(filter_modes); i++) if (filter_modes[i].type == m_proto->m_filterInfo.type) { - g_ReleaseIcon((HICON)SendDlgItemMessage(m_hwnd, IDC_BTN_FILTER, BM_SETIMAGE, IMAGE_ICON, (LPARAM)m_proto->LoadIconEx(filter_modes[i].icon))); + IcoLib_ReleaseIcon((HICON)SendDlgItemMessage(m_hwnd, IDC_BTN_FILTER, BM_SETIMAGE, IMAGE_ICON, (LPARAM)m_proto->LoadIconEx(filter_modes[i].icon))); SendDlgItemMessage(m_hwnd, IDC_BTN_FILTER, BM_SETIMAGE, IMAGE_ICON, (LPARAM)m_proto->LoadIconEx(filter_modes[i].icon)); break; } @@ -406,11 +406,11 @@ void CJabberDlgConsole::OnClose() void CJabberDlgConsole::OnDestroy() { - g_ReleaseIcon((HICON)SendDlgItemMessage(m_hwnd, IDC_BTN_MSG, BM_SETIMAGE, IMAGE_ICON, 0)); - g_ReleaseIcon((HICON)SendDlgItemMessage(m_hwnd, IDC_BTN_PRESENCE, BM_SETIMAGE, IMAGE_ICON, 0)); - g_ReleaseIcon((HICON)SendDlgItemMessage(m_hwnd, IDC_BTN_IQ, BM_SETIMAGE, IMAGE_ICON, 0)); - g_ReleaseIcon((HICON)SendDlgItemMessage(m_hwnd, IDC_BTN_FILTER, BM_SETIMAGE, IMAGE_ICON, 0)); - g_ReleaseIcon((HICON)SendDlgItemMessage(m_hwnd, IDC_BTN_FILTER_REFRESH, BM_SETIMAGE, IMAGE_ICON, 0)); + IcoLib_ReleaseIcon((HICON)SendDlgItemMessage(m_hwnd, IDC_BTN_MSG, BM_SETIMAGE, IMAGE_ICON, 0)); + IcoLib_ReleaseIcon((HICON)SendDlgItemMessage(m_hwnd, IDC_BTN_PRESENCE, BM_SETIMAGE, IMAGE_ICON, 0)); + IcoLib_ReleaseIcon((HICON)SendDlgItemMessage(m_hwnd, IDC_BTN_IQ, BM_SETIMAGE, IMAGE_ICON, 0)); + IcoLib_ReleaseIcon((HICON)SendDlgItemMessage(m_hwnd, IDC_BTN_FILTER, BM_SETIMAGE, IMAGE_ICON, 0)); + IcoLib_ReleaseIcon((HICON)SendDlgItemMessage(m_hwnd, IDC_BTN_FILTER_REFRESH, BM_SETIMAGE, IMAGE_ICON, 0)); m_proto->m_pDlgConsole = NULL; CSuper::OnDestroy(); @@ -580,7 +580,7 @@ INT_PTR CJabberDlgConsole::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) m_proto->m_filterInfo.type = (TFilterInfo::Type)(res - 1); for (i = 0; i < _countof(filter_modes); i++) { if (filter_modes[i].type == m_proto->m_filterInfo.type) { - g_ReleaseIcon((HICON)SendDlgItemMessage(m_hwnd, IDC_BTN_FILTER, BM_SETIMAGE, IMAGE_ICON, (LPARAM)m_proto->LoadIconEx(filter_modes[i].icon))); + IcoLib_ReleaseIcon((HICON)SendDlgItemMessage(m_hwnd, IDC_BTN_FILTER, BM_SETIMAGE, IMAGE_ICON, (LPARAM)m_proto->LoadIconEx(filter_modes[i].icon))); break; } } diff --git a/protocols/JabberG/src/jabber_form.cpp b/protocols/JabberG/src/jabber_form.cpp index e871ca0eb2..c8ad8a03b7 100644 --- a/protocols/JabberG/src/jabber_form.cpp +++ b/protocols/JabberG/src/jabber_form.cpp @@ -376,7 +376,7 @@ TJabberFormControlInfo *JabberFormAppendControl(HWND hwndStatic, TJabberFormLayo return item; } -void JabberFormAddListItem(TJabberFormControlInfo *item, const TCHAR *text, bool selected) +static void JabberFormAddListItem(TJabberFormControlInfo *item, const TCHAR *text, bool selected) { DWORD dwIndex; switch (item->type) { diff --git a/protocols/JabberG/src/jabber_frame.cpp b/protocols/JabberG/src/jabber_frame.cpp index 2703d09625..d6bf5afce7 100644 --- a/protocols/JabberG/src/jabber_frame.cpp +++ b/protocols/JabberG/src/jabber_frame.cpp @@ -364,7 +364,7 @@ void CJabberInfoFrame::PaintCompact(HDC hdc) HICON hIcon = IcoLib_GetIconByHandle(item.m_hIcolibIcon); if (hIcon) { DrawIconEx(hdc, SZ_FRAMEPADDING, (rc.bottom-cy_icon)/2, hIcon, cx_icon, cy_icon, 0, NULL, DI_NORMAL); - g_ReleaseIcon(hIcon); + IcoLib_ReleaseIcon(hIcon); } } @@ -379,7 +379,7 @@ void CJabberInfoFrame::PaintCompact(HDC hdc) DrawIconEx(hdc, cx, (rc.bottom-cy_icon)/2, hIcon, cx_icon, cy_icon, 0, NULL, DI_NORMAL); cx -= cx_icon; - g_ReleaseIcon(hIcon); + IcoLib_ReleaseIcon(hIcon); SetToolTip(item.m_tooltipId, &item.m_rcItem, item.m_pszText); } @@ -424,7 +424,7 @@ void CJabberInfoFrame::PaintNormal(HDC hdc) DrawIconEx(hdc, cx, cy + (line_height-cy_icon)/2, hIcon, cx_icon, cy_icon, 0, NULL, DI_NORMAL); cx += cx_icon + SZ_ICONSPACING; - g_ReleaseIcon(hIcon); + IcoLib_ReleaseIcon(hIcon); } } diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp index 5f15f762f1..348f62bfda 100644 --- a/protocols/JabberG/src/jabber_groupchat.cpp +++ b/protocols/JabberG/src/jabber_groupchat.cpp @@ -479,7 +479,7 @@ void CJabberDlgGcJoin::OnInitDialog() void CJabberDlgGcJoin::OnDestroy() { - g_ReleaseIcon((HICON)SendDlgItemMessage(m_hwnd, IDC_BOOKMARKS, BM_SETIMAGE, IMAGE_ICON, 0)); + IcoLib_ReleaseIcon((HICON)SendDlgItemMessage(m_hwnd, IDC_BOOKMARKS, BM_SETIMAGE, IMAGE_ICON, 0)); m_proto->m_pDlgJabberJoinGroupchat = NULL; DeleteObject((HFONT)SendDlgItemMessage(m_hwnd, IDC_TXT_RECENT, WM_GETFONT, 0, 0)); diff --git a/protocols/JabberG/src/jabber_icolib.cpp b/protocols/JabberG/src/jabber_icolib.cpp index 1db364b465..01361f011c 100644 --- a/protocols/JabberG/src/jabber_icolib.cpp +++ b/protocols/JabberG/src/jabber_icolib.cpp @@ -552,26 +552,12 @@ HICON g_LoadIconEx(const char* name, bool big) return IcoLib_GetIcon(szSettingName, big); } -void g_ReleaseIcon(HICON hIcon) -{ - if (hIcon) - IcoLib_ReleaseIcon(hIcon); -} - void ImageList_AddIcon_Icolib(HIMAGELIST hIml, HICON hIcon) { ImageList_AddIcon(hIml, hIcon); - g_ReleaseIcon(hIcon); + IcoLib_ReleaseIcon(hIcon); } void WindowSetIcon(HWND hWnd, CJabberProto *proto, const char* name) { - SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)proto->LoadIconEx(name, true)); - SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)proto->LoadIconEx(name)); -} - -void WindowFreeIcon(HWND hWnd) -{ - g_ReleaseIcon((HICON)SendMessage(hWnd, WM_SETICON, ICON_BIG, 0)); - g_ReleaseIcon((HICON)SendMessage(hWnd, WM_SETICON, ICON_SMALL, 0)); } diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp index 8130aa286c..28e5f33660 100644 --- a/protocols/JabberG/src/jabber_opt.cpp +++ b/protocols/JabberG/src/jabber_opt.cpp @@ -1393,45 +1393,42 @@ static INT_PTR CALLBACK JabberRosterOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wP CJabberProto *ppro = (CJabberProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); switch (msg) { + case WM_INITDIALOG: + ppro = (CJabberProto*)lParam; + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); + + TranslateDialogDefault(hwndDlg); + WindowSetIcon(hwndDlg, ppro, "Agents"); + + Utils_RestoreWindowPosition(hwndDlg, NULL, ppro->m_szModuleName, "rosterCtrlWnd_"); + + ListView_SetExtendedListViewStyle(GetDlgItem(hwndDlg, IDC_ROSTER), LVS_EX_CHECKBOXES | LVS_EX_BORDERSELECT /*| LVS_EX_FULLROWSELECT*/ | LVS_EX_GRIDLINES /*| LVS_EX_HEADERDRAGDROP*/); + mir_subclassWindow(GetDlgItem(hwndDlg, IDC_ROSTER), _RosterNewListProc); + _RosterListClear(hwndDlg); + ppro->rrud.hwndDlg = hwndDlg; + ppro->rrud.bReadyToDownload = TRUE; + ppro->rrud.bReadyToUpload = FALSE; + SendMessage(hwndDlg, JM_STATUSCHANGED, 0, 0); + return TRUE; + case JM_STATUSCHANGED: { int count = ListView_GetItemCount(GetDlgItem(hwndDlg, IDC_ROSTER)); EnableWindow(GetDlgItem(hwndDlg, IDC_DOWNLOAD), ppro->m_bJabberOnline); EnableWindow(GetDlgItem(hwndDlg, IDC_UPLOAD), count && ppro->m_bJabberOnline); EnableWindow(GetDlgItem(hwndDlg, IDC_EXPORT), count > 0); - break; - } - case WM_CLOSE: - { - DestroyWindow(hwndDlg); - break; - } - case WM_DESTROY: - { - Utils_SaveWindowPosition(hwndDlg, NULL, ppro->m_szModuleName, "rosterCtrlWnd_"); - ppro->rrud.hwndDlg = NULL; - WindowFreeIcon(hwndDlg); - break; } - case WM_INITDIALOG: - { - ppro = (CJabberProto*)lParam; - SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); - - TranslateDialogDefault(hwndDlg); - WindowSetIcon(hwndDlg, ppro, "Agents"); + break; - Utils_RestoreWindowPosition(hwndDlg, NULL, ppro->m_szModuleName, "rosterCtrlWnd_"); + case WM_CLOSE: + DestroyWindow(hwndDlg); + break; - ListView_SetExtendedListViewStyle(GetDlgItem(hwndDlg, IDC_ROSTER), LVS_EX_CHECKBOXES | LVS_EX_BORDERSELECT /*| LVS_EX_FULLROWSELECT*/ | LVS_EX_GRIDLINES /*| LVS_EX_HEADERDRAGDROP*/); - mir_subclassWindow(GetDlgItem(hwndDlg, IDC_ROSTER), _RosterNewListProc); - _RosterListClear(hwndDlg); - ppro->rrud.hwndDlg = hwndDlg; - ppro->rrud.bReadyToDownload = TRUE; - ppro->rrud.bReadyToUpload = FALSE; - SendMessage(hwndDlg, JM_STATUSCHANGED, 0, 0); - } - return TRUE; + case WM_DESTROY: + Utils_SaveWindowPosition(hwndDlg, NULL, ppro->m_szModuleName, "rosterCtrlWnd_"); + ppro->rrud.hwndDlg = NULL; + Window_FreeIcon_IcoLib(hwndDlg); + break; case WM_GETMINMAXINFO: { diff --git a/protocols/JabberG/src/jabber_password.cpp b/protocols/JabberG/src/jabber_password.cpp index 3ca63f9121..4fe3ae4ab0 100644 --- a/protocols/JabberG/src/jabber_password.cpp +++ b/protocols/JabberG/src/jabber_password.cpp @@ -90,7 +90,7 @@ static INT_PTR CALLBACK JabberChangePasswordDlgProc(HWND hwndDlg, UINT msg, WPAR break; case WM_DESTROY: ppro->m_hwndJabberChangePassword = NULL; - WindowFreeIcon(hwndDlg); + Window_FreeIcon_IcoLib(hwndDlg); break; } diff --git a/protocols/JabberG/src/jabber_privacy.cpp b/protocols/JabberG/src/jabber_privacy.cpp index 0f56b27c7a..3dd5805f00 100644 --- a/protocols/JabberG/src/jabber_privacy.cpp +++ b/protocols/JabberG/src/jabber_privacy.cpp @@ -545,10 +545,10 @@ public: void OnDestroy() { - g_ReleaseIcon((HICON)SendDlgItemMessage(m_hwnd, IDC_ICO_MESSAGE, STM_SETICON, 0, 0)); - g_ReleaseIcon((HICON)SendDlgItemMessage(m_hwnd, IDC_ICO_QUERY, STM_SETICON, 0, 0)); - g_ReleaseIcon((HICON)SendDlgItemMessage(m_hwnd, IDC_ICO_PRESENCEIN, STM_SETICON, 0, 0)); - g_ReleaseIcon((HICON)SendDlgItemMessage(m_hwnd, IDC_ICO_PRESENCEOUT, STM_SETICON, 0, 0)); + IcoLib_ReleaseIcon((HICON)SendDlgItemMessage(m_hwnd, IDC_ICO_MESSAGE, STM_SETICON, 0, 0)); + IcoLib_ReleaseIcon((HICON)SendDlgItemMessage(m_hwnd, IDC_ICO_QUERY, STM_SETICON, 0, 0)); + IcoLib_ReleaseIcon((HICON)SendDlgItemMessage(m_hwnd, IDC_ICO_PRESENCEIN, STM_SETICON, 0, 0)); + IcoLib_ReleaseIcon((HICON)SendDlgItemMessage(m_hwnd, IDC_ICO_PRESENCEOUT, STM_SETICON, 0, 0)); m_proto->m_hwndPrivacyRule = NULL; } }; diff --git a/protocols/JabberG/src/jabber_treelist.cpp b/protocols/JabberG/src/jabber_treelist.cpp index ea66936cad..33d0acf232 100644 --- a/protocols/JabberG/src/jabber_treelist.cpp +++ b/protocols/JabberG/src/jabber_treelist.cpp @@ -249,7 +249,7 @@ int TreeList_AddIcon(HWND hwnd, HICON hIcon, int iOverlay) { HIMAGELIST hIml = ListView_GetImageList(hwnd, LVSIL_SMALL); int idx = ImageList_AddIcon(hIml, hIcon); - g_ReleaseIcon(hIcon); + IcoLib_ReleaseIcon(hIcon); if (iOverlay) ImageList_SetOverlayImage(hIml, idx, iOverlay); return idx; } diff --git a/protocols/JabberG/src/jabber_userinfo.cpp b/protocols/JabberG/src/jabber_userinfo.cpp index 380e1c05ad..7601a92287 100644 --- a/protocols/JabberG/src/jabber_userinfo.cpp +++ b/protocols/JabberG/src/jabber_userinfo.cpp @@ -190,7 +190,7 @@ static HTREEITEM sttFillInfoLine(HWND hwndTree, HTREEITEM htiRoot, HICON hIcon, tvis.itemex.mask |= TVIF_IMAGE|TVIF_SELECTEDIMAGE; tvis.itemex.iImage = tvis.itemex.iSelectedImage = ImageList_AddIcon(himl, hIcon); - g_ReleaseIcon(hIcon); + IcoLib_ReleaseIcon(hIcon); } if (hti) { @@ -439,8 +439,7 @@ static INT_PTR CALLBACK JabberUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa // lParam is hContact TranslateDialogDefault(hwndDlg); - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)Skin_LoadIcon(SKINICON_OTHER_USERDETAILS, true)); - SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)Skin_LoadIcon(SKINICON_OTHER_USERDETAILS)); + Window_SetSkinIcon_IcoLib(hwndDlg, SKINICON_OTHER_USERDETAILS); dat = (JabberUserInfoDlgData *)mir_alloc(sizeof(JabberUserInfoDlgData)); memset(dat, 0, sizeof(JabberUserInfoDlgData)); @@ -585,7 +584,7 @@ static INT_PTR CALLBACK JabberUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa } WindowList_Remove(hUserInfoList, hwndDlg); ImageList_Destroy(TreeView_SetImageList(GetDlgItem(hwndDlg, IDC_TV_INFO), NULL, TVSIL_NORMAL)); - WindowFreeIcon(hwndDlg); + Window_FreeIcon_IcoLib(hwndDlg); break; } return FALSE; diff --git a/protocols/JabberG/src/jabber_xstatus.cpp b/protocols/JabberG/src/jabber_xstatus.cpp index a4ac9974ed..e654238361 100644 --- a/protocols/JabberG/src/jabber_xstatus.cpp +++ b/protocols/JabberG/src/jabber_xstatus.cpp @@ -155,7 +155,7 @@ private: bool m_subitem; CStatusMode(LPARAM id, char *name, HICON hIcon, TCHAR *title, bool subitem): m_id(id), m_name(name), m_hIcon(hIcon), m_title(title), m_subitem(subitem) {} - ~CStatusMode() { g_ReleaseIcon(m_hIcon); } + ~CStatusMode() { IcoLib_ReleaseIcon(m_hIcon); } }; OBJLIST m_modes; diff --git a/protocols/JabberG/src/stdafx.h b/protocols/JabberG/src/stdafx.h index b625d69ecd..429ec8f418 100644 --- a/protocols/JabberG/src/stdafx.h +++ b/protocols/JabberG/src/stdafx.h @@ -624,7 +624,6 @@ LPARAM TreeList_GetData(HTREELISTITEM hItem); HTREELISTITEM TreeList_GetRoot(HWND hwnd); int TreeList_GetChildrenCount(HTREELISTITEM hItem); HTREELISTITEM TreeList_GetChild(HTREELISTITEM hItem, int i); -void sttTreeList_RecursiveApply(HTREELISTITEM hItem, void (*func)(HTREELISTITEM, LPARAM), LPARAM data); void TreeList_Update(HWND hwnd); BOOL TreeList_ProcessMessage(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, UINT idc, BOOL *result); @@ -645,11 +644,8 @@ void JabberFormDestroyUI(HWND hwndStatic); void JabberFormSetInstruction(HWND hwndForm, const TCHAR *text); HJFORMLAYOUT JabberFormCreateLayout(HWND hwndStatic); // use mir_free to destroy HJFORMCTRL JabberFormAppendControl(HWND hwndStatic, HJFORMLAYOUT layout_info, TJabberFormControlType type, const TCHAR *labelStr, const TCHAR *valueStr); -void JabberFormAddListItem(HJFORMCTRL item, const TCHAR *text, bool selected); void JabberFormLayoutControls(HWND hwndStatic, HJFORMLAYOUT layout_info, int *formHeight); -void JabberFormCreateDialog(HXML xNode, TCHAR* defTitle, JABBER_FORM_SUBMIT_FUNC pfnSubmit, void *userdata); - HXML JabberFormGetData(HWND hwndStatic, HXML xNode); //---- jabber_icolib.c ---------------------------------------------- @@ -658,13 +654,9 @@ void g_IconsInit(); void g_XstatusIconsInit(); HANDLE g_GetIconHandle(int iconId); HICON g_LoadIconEx(const char* name, bool big = false); -void g_ReleaseIcon(HICON hIcon); void ImageList_AddIcon_Icolib(HIMAGELIST hIml, HICON hIcon); void WindowSetIcon(HWND hWnd, CJabberProto *proto, const char* name); -void WindowFreeIcon(HWND hWnd); - -int ReloadIconsEventHook(WPARAM wParam, LPARAM lParam); //---- jabber_libstr.c ---------------------------------------------- @@ -729,7 +721,7 @@ struct TStringPairs const char* operator[](const char* name) const; int numElems; - TStringPairsElem* elems; + TStringPairsElem *elems; }; typedef char JabberShaStrBuf[2*MIR_SHA1_HASH_SIZE + 1]; @@ -753,9 +745,9 @@ LPCTSTR __stdcall JabberGetPictureType(HXML node, const char *picBuf); TCHAR* time2str(time_t _time, TCHAR *buf, size_t bufLen); time_t str2time(const TCHAR*); -const TCHAR *JabberStrIStr(const TCHAR *str, const TCHAR *substr); -void JabberCopyText(HWND hwnd, const TCHAR *text); -CJabberProto *JabberChooseInstance(bool bIsLink=false); +const TCHAR* JabberStrIStr(const TCHAR *str, const TCHAR *substr); +void JabberCopyText(HWND hwnd, const TCHAR *text); +CJabberProto* JabberChooseInstance(bool bIsLink=false); bool JabberReadXep203delay(HXML node, time_t &msgTime); @@ -766,7 +758,4 @@ void UIShowControls(HWND hwndDlg, int *idList, int nCmdShow); void JabberUserInfoUpdate(MCONTACT hContact); -//---- jabber_iq_handlers.cpp -BOOL GetOSDisplayString(LPTSTR pszOS, int BUFSIZE); - #endif diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp index 1ce63f67ba..6f399df52c 100644 --- a/protocols/MRA/src/Mra_functions.cpp +++ b/protocols/MRA/src/Mra_functions.cpp @@ -1106,7 +1106,7 @@ INT_PTR CALLBACK SendReplyBlogStatusDlgProc(HWND hWndDlg, UINT message, WPARAM w mir_subclassWindow(GetDlgItem(hWndDlg, IDC_MSG_TO_SEND), MessageEditSubclassProc); SendMessage(hWndEdit, EM_LIMITTEXT, MICBLOG_STATUS_MAX, 0); - SendMessage(hWndDlg, WM_SETICON, ICON_BIG, (LPARAM)IconLibGetIcon(gdiMenuItems[4].hIcolib)); + Window_SetIcon_IcoLib(hWndDlg, gdiMenuItems[4].hIcolib); // blog status message CMStringW szBuff; diff --git a/protocols/MSN/src/msn_menu.cpp b/protocols/MSN/src/msn_menu.cpp index d607bb1dbb..532242e257 100644 --- a/protocols/MSN/src/msn_menu.cpp +++ b/protocols/MSN/src/msn_menu.cpp @@ -194,8 +194,7 @@ static INT_PTR CALLBACK DlgProcSetNickname(HWND hwndDlg, UINT msg, WPARAM wParam SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); CMsnProto* proto = (CMsnProto*)lParam; - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)LoadIconEx("main", true)); - SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIconEx("main")); + Window_SetIcon_IcoLib(hwndDlg, GetIconHandle("main")); SendDlgItemMessage(hwndDlg, IDC_NICKNAME, EM_LIMITTEXT, 129, 0); DBVARIANT dbv; diff --git a/protocols/Steam/src/steam_dialogs.cpp b/protocols/Steam/src/steam_dialogs.cpp index 9bbdd73b7f..8cab0aecf3 100644 --- a/protocols/Steam/src/steam_dialogs.cpp +++ b/protocols/Steam/src/steam_dialogs.cpp @@ -11,8 +11,7 @@ void CSteamPasswordEditor::OnInitDialog() { char iconName[100]; mir_snprintf(iconName, "%s_%s", MODULE, "main"); - SendMessage(m_hwnd, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIcon(iconName, true)); - SendMessage(m_hwnd, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIcon(iconName, false)); + Window_SetIcon_IcoLib(m_hwnd, IcoLib_GetIconHandle(iconName)); SendMessage(m_password.GetHwnd(), EM_LIMITTEXT, 64, 0); @@ -52,8 +51,7 @@ void CSteamGuardDialog::OnInitDialog() { char iconName[100]; mir_snprintf(iconName, "%s_%s", MODULE, "main"); - SendMessage(m_hwnd, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIcon(iconName, true)); - SendMessage(m_hwnd, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIcon(iconName, false)); + Window_SetIcon_IcoLib(m_hwnd, iconName); SendMessage(m_text.GetHwnd(), EM_LIMITTEXT, 5, 0); @@ -100,8 +98,7 @@ void CSteamCaptchaDialog::OnInitDialog() { char iconName[100]; mir_snprintf(iconName, "%s_%s", MODULE, "main"); - SendMessage(m_hwnd, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIcon(iconName, true)); - SendMessage(m_hwnd, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIcon(iconName, false)); + Window_SetIcon_IcoLib(m_hwnd, IcoLib_GetIconHandle(iconName)); SendMessage(m_text.GetHwnd(), EM_LIMITTEXT, 6, 0); diff --git a/protocols/Tlen/src/stdafx.h b/protocols/Tlen/src/stdafx.h index cc69fef948..9341656dc3 100644 --- a/protocols/Tlen/src/stdafx.h +++ b/protocols/Tlen/src/stdafx.h @@ -64,6 +64,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include +#include #include #include #include @@ -429,6 +430,7 @@ extern HANDLE hMainThread; * Function declarations *******************************************************************/ HICON GetIcolibIcon(int iconId); +HANDLE GetIconHandle(int iconId); void ReleaseIcolibIcon(HICON hIcon); void __cdecl TlenServerThread(ThreadData *info); diff --git a/protocols/Tlen/src/tlen.cpp b/protocols/Tlen/src/tlen.cpp index 250c5ae023..e7ce5b729b 100644 --- a/protocols/Tlen/src/tlen.cpp +++ b/protocols/Tlen/src/tlen.cpp @@ -80,7 +80,7 @@ static IconItem iconList[] = { LPGEN("Send image"), "IMAGE", IDI_IMAGE } }; -static HANDLE GetIconHandle(int iconId) +HANDLE GetIconHandle(int iconId) { for (int i = 0; i < _countof(iconList); i++) if (iconList[i].defIconID == iconId) diff --git a/protocols/Tlen/src/tlen_svc.cpp b/protocols/Tlen/src/tlen_svc.cpp index ab0cb4324c..9ce4fc360e 100644 --- a/protocols/Tlen/src/tlen_svc.cpp +++ b/protocols/Tlen/src/tlen_svc.cpp @@ -1057,13 +1057,10 @@ static INT_PTR CALLBACK TlenChangeAvatarDlgProc(HWND hwndDlg, UINT msg, WPARAM w switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); - { - HICON hIcon = GetIcolibIcon(IDI_TLEN); - SendMessage(hwndDlg, WM_SETICON, (WPARAM)ICON_BIG, (LPARAM)hIcon); - ReleaseIcolibIcon(hIcon); - } + Window_SetIcon_IcoLib(hwndDlg, GetIconHandle(IDI_TLEN)); CheckDlgButton(hwndDlg, IDC_PUBLICAVATAR, BST_CHECKED); return TRUE; + case WM_COMMAND: switch (LOWORD(wParam)) { case IDOK: diff --git a/protocols/Tox/src/tox_multimedia.cpp b/protocols/Tox/src/tox_multimedia.cpp index 8bc9fd8dd3..48526fa19e 100644 --- a/protocols/Tox/src/tox_multimedia.cpp +++ b/protocols/Tox/src/tox_multimedia.cpp @@ -28,8 +28,7 @@ void CToxCallDlgBase::SetIcon(const char *name) { char iconName[100]; mir_snprintf(iconName, "%s_%s", MODULE, name); - SendMessage(m_hwnd, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIcon(iconName, false)); - SendMessage(m_hwnd, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIcon(iconName, true)); + Window_SetIcon_IcoLib(m_hwnd, IcoLib_GetIconHandle(iconName)); } void CToxCallDlgBase::SetTitle(const TCHAR *title) diff --git a/protocols/VKontakte/src/vk_dialogs.cpp b/protocols/VKontakte/src/vk_dialogs.cpp index ed601d1a76..21fe217e6d 100644 --- a/protocols/VKontakte/src/vk_dialogs.cpp +++ b/protocols/VKontakte/src/vk_dialogs.cpp @@ -34,8 +34,7 @@ CVkCaptchaForm::CVkCaptchaForm(CVkProto *proto, CAPTCHA_FORM_PARAMS *param) : void CVkCaptchaForm::OnInitDialog() { - SendMessage(m_hwnd, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIconByHandle(GetIconHandle(IDI_KEYS), TRUE)); - SendMessage(m_hwnd, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIconByHandle(GetIconHandle(IDI_KEYS))); + Window_SetIcon_IcoLib(m_hwnd, GetIconHandle(IDI_KEYS)); m_btnOk.Disable(); m_btnOpenInBrowser.Enable((m_param->bmp != NULL)); @@ -83,8 +82,7 @@ INT_PTR CVkCaptchaForm::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) void CVkCaptchaForm::OnDestroy() { - IcoLib_ReleaseIcon((HICON)SendMessage(m_hwnd, WM_SETICON, ICON_BIG, 0)); - IcoLib_ReleaseIcon((HICON)SendMessage(m_hwnd, WM_SETICON, ICON_SMALL, 0)); + Window_FreeIcon_IcoLib(m_hwnd); } void CVkCaptchaForm::On_btnOpenInBrowser_Click(CCtrlButton*) @@ -120,8 +118,7 @@ CVkWallPostForm::CVkWallPostForm(CVkProto *proto, WALLPOST_FORM_PARAMS *param) : void CVkWallPostForm::OnInitDialog() { - SendMessage(m_hwnd, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIconByHandle(GetIconHandle(IDI_WALL), TRUE)); - SendMessage(m_hwnd, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIconByHandle(GetIconHandle(IDI_WALL))); + Window_SetIcon_IcoLib(m_hwnd, GetIconHandle(IDI_WALL)); CMString tszTitle(FORMAT, _T("%s %s"), TranslateT("Wall message for"), m_param->ptszNick); SetCaption(tszTitle); @@ -131,8 +128,7 @@ void CVkWallPostForm::OnInitDialog() void CVkWallPostForm::OnDestroy() { - IcoLib_ReleaseIcon((HICON)SendMessage(m_hwnd, WM_SETICON, ICON_BIG, 0)); - IcoLib_ReleaseIcon((HICON)SendMessage(m_hwnd, WM_SETICON, ICON_SMALL, 0)); + Window_FreeIcon_IcoLib(m_hwnd); } void CVkWallPostForm::On_btnShare_Click(CCtrlButton*) diff --git a/protocols/Yahoo/src/chat.cpp b/protocols/Yahoo/src/chat.cpp index f80fa58e97..6071675b01 100644 --- a/protocols/Yahoo/src/chat.cpp +++ b/protocols/Yahoo/src/chat.cpp @@ -423,8 +423,7 @@ INT_PTR CALLBACK InviteToChatDialog(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); param = (InviteChatParam*)lParam; - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)param->ppro->LoadIconEx("yahoo", true)); - SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)param->ppro->LoadIconEx("yahoo")); + Window_SetIcon_IcoLib(hwndDlg, param->ppro->GetIconHandle(IDI_YAHOO)); SetDlgItemTextA(hwndDlg, IDC_ROOMNAME, param->room); SetDlgItemText(hwndDlg, IDC_MSG, TranslateT("Join My Conference...")); @@ -435,8 +434,7 @@ INT_PTR CALLBACK InviteToChatDialog(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR break; case WM_NCDESTROY: - param->ppro->ReleaseIconEx("yahoo", true); - param->ppro->ReleaseIconEx("yahoo"); + Window_FreeIcon_IcoLib(hwndDlg); delete param; break; @@ -516,8 +514,7 @@ INT_PTR CALLBACK ChatRequestDialog(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); param = (InviteChatReqParam*)lParam; - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)param->ppro->LoadIconEx("yahoo", true)); - SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)param->ppro->LoadIconEx("yahoo")); + Window_SetIcon_IcoLib(hwndDlg, param->ppro->GetIconHandle(IDI_YAHOO)); SetDlgItemTextA(hwndDlg, IDC_SCREENNAME, param->who); SetDlgItemText(hwndDlg, IDC_MSG, param->msg); @@ -529,8 +526,7 @@ INT_PTR CALLBACK ChatRequestDialog(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA break; case WM_NCDESTROY: - param->ppro->ReleaseIconEx("yahoo", true); - param->ppro->ReleaseIconEx("yahoo"); + Window_FreeIcon_IcoLib(hwndDlg); delete param; break; diff --git a/protocols/Yahoo/src/services.cpp b/protocols/Yahoo/src/services.cpp index 7e25b7c459..9e4635ab47 100644 --- a/protocols/Yahoo/src/services.cpp +++ b/protocols/Yahoo/src/services.cpp @@ -120,8 +120,7 @@ static INT_PTR CALLBACK DlgProcSetCustStat(HWND hwndDlg, UINT msg, WPARAM wParam CYahooProto* ppro = (CYahooProto*)lParam; SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)ppro->LoadIconEx("yahoo", true)); - SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)ppro->LoadIconEx("yahoo")); + Window_SetIcon_IcoLib(hwndDlg, ppro->GetIconHandle(IDI_YAHOO)); if (!ppro->getString(YAHOO_CUSTSTATDB, &dbv)) { SetDlgItemTextA(hwndDlg, IDC_CUSTSTAT, dbv.pszVal); @@ -185,11 +184,7 @@ static INT_PTR CALLBACK DlgProcSetCustStat(HWND hwndDlg, UINT msg, WPARAM wParam break; case WM_DESTROY: - { - CYahooProto* ppro = (CYahooProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - ppro->ReleaseIconEx("yahoo", true); - ppro->ReleaseIconEx("yahoo"); - } + Window_FreeIcon_IcoLib(hwndDlg); break; } return FALSE; diff --git a/protocols/Yahoo/src/stdafx.h b/protocols/Yahoo/src/stdafx.h index 1a15b46d58..cd3dc79f7d 100644 --- a/protocols/Yahoo/src/stdafx.h +++ b/protocols/Yahoo/src/stdafx.h @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include diff --git a/protocols/Yahoo/src/user_info.cpp b/protocols/Yahoo/src/user_info.cpp index a6a8c89f1a..016053a9ad 100644 --- a/protocols/Yahoo/src/user_info.cpp +++ b/protocols/Yahoo/src/user_info.cpp @@ -27,10 +27,6 @@ static INT_PTR CALLBACK YahooUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM, LPA case WM_INITDIALOG: // lParam is hContact TranslateDialogDefault(hwndDlg); - - //SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)Skin_LoadIcon(SKINICON_OTHER_USERDETAILS)); - - break; case WM_NOTIFY: diff --git a/src/core/stdchat/src/options.cpp b/src/core/stdchat/src/options.cpp index a3abd05109..b5ddfdc7d4 100644 --- a/src/core/stdchat/src/options.cpp +++ b/src/core/stdchat/src/options.cpp @@ -313,6 +313,13 @@ HICON LoadIconEx(const char *pszIcoLibName, bool big) return IcoLib_GetIcon(szTemp, big); } +HANDLE GetIconHandle(const char *pszIcoLibName) +{ + char szTemp[256]; + mir_snprintf(szTemp, "chat_%s", pszIcoLibName); + return IcoLib_GetIconHandle(szTemp); +} + static void InitSetting(TCHAR** ppPointer, char* pszSetting, TCHAR* pszDefault) { DBVARIANT dbv; diff --git a/src/core/stdchat/src/stdafx.h b/src/core/stdchat/src/stdafx.h index ec6be80973..5acc72626b 100644 --- a/src/core/stdchat/src/stdafx.h +++ b/src/core/stdchat/src/stdafx.h @@ -149,6 +149,7 @@ SESSION_INFO* SM_GetNextWindow(SESSION_INFO *si); int OptionsInitialize(WPARAM wParam, LPARAM lParam); void AddIcons(void); HICON LoadIconEx(const char *pszIcoLibName, bool big); +HANDLE GetIconHandle(const char *pszIcolibName); // services.c void ShowRoom(SESSION_INFO *si, WPARAM wp, BOOL bSetForeground); diff --git a/src/core/stdchat/src/window.cpp b/src/core/stdchat/src/window.cpp index 00abe9297a..eff7d1c9bd 100644 --- a/src/core/stdchat/src/window.cpp +++ b/src/core/stdchat/src/window.cpp @@ -1268,8 +1268,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar SendMessage(hwndDlg, GC_FIXTABICONS, 0, 0); SendMessage(si->hwndStatus, SB_SETICON, 0, (LPARAM)hIcon); - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)LoadIconEx("window", TRUE)); - SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIconEx("window", FALSE)); + Window_SetIcon_IcoLib(hwndDlg, GetIconHandle("window")); SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETBKGNDCOLOR, 0, g_Settings.crLogBackground); diff --git a/src/core/stdfile/src/filerecvdlg.cpp b/src/core/stdfile/src/filerecvdlg.cpp index 47254f5499..cbed678e37 100644 --- a/src/core/stdfile/src/filerecvdlg.cpp +++ b/src/core/stdfile/src/filerecvdlg.cpp @@ -197,7 +197,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l EnumChildWindows(hwndDlg, ClipSiblingsChildEnumProc, 0); - Window_SetIcon_IcoLib(hwndDlg, SKINICON_EVENT_FILE); + Window_SetSkinIcon_IcoLib(hwndDlg, SKINICON_EVENT_FILE); Button_SetIcon_IcoLib(hwndDlg, IDC_ADD, SKINICON_OTHER_ADDCONTACT, LPGEN("Add contact permanently to list")); Button_SetIcon_IcoLib(hwndDlg, IDC_DETAILS, SKINICON_OTHER_USERDETAILS, LPGEN("View user's details")); Button_SetIcon_IcoLib(hwndDlg, IDC_HISTORY, SKINICON_OTHER_HISTORY, LPGEN("View user's history")); diff --git a/src/core/stdfile/src/filesenddlg.cpp b/src/core/stdfile/src/filesenddlg.cpp index 2a5d28c7ef..54c6a9a786 100644 --- a/src/core/stdfile/src/filesenddlg.cpp +++ b/src/core/stdfile/src/filesenddlg.cpp @@ -218,7 +218,7 @@ INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l EnumChildWindows(hwndDlg, ClipSiblingsChildEnumProc, 0); mir_subclassWindow(GetDlgItem(hwndDlg, IDC_MSG), SendEditSubclassProc); - Window_SetIcon_IcoLib(hwndDlg, SKINICON_EVENT_FILE); + Window_SetSkinIcon_IcoLib(hwndDlg, SKINICON_EVENT_FILE); Button_SetIcon_IcoLib(hwndDlg, IDC_DETAILS, SKINICON_OTHER_USERDETAILS, LPGEN("View user's details")); Button_SetIcon_IcoLib(hwndDlg, IDC_HISTORY, SKINICON_OTHER_HISTORY, LPGEN("View user's history")); Button_SetIcon_IcoLib(hwndDlg, IDC_USERMENU, SKINICON_OTHER_DOWNARROW, LPGEN("User menu")); diff --git a/src/core/stdfile/src/ftmanager.cpp b/src/core/stdfile/src/ftmanager.cpp index f5e42cb3d9..12548bab1e 100644 --- a/src/core/stdfile/src/ftmanager.cpp +++ b/src/core/stdfile/src/ftmanager.cpp @@ -268,7 +268,7 @@ static INT_PTR CALLBACK FtMgrDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM HWND hwndTab = GetDlgItem(hwnd, IDC_TABS); TranslateDialogDefault(hwnd); - Window_SetIcon_IcoLib(hwnd, SKINICON_EVENT_FILE); + Window_SetSkinIcon_IcoLib(hwnd, SKINICON_EVENT_FILE); dat = (struct TFtMgrData *)mir_calloc(sizeof(struct TFtMgrData)); diff --git a/src/core/stdhelp/src/about.cpp b/src/core/stdhelp/src/about.cpp index 1f96c32d13..d7f21012bf 100644 --- a/src/core/stdhelp/src/about.cpp +++ b/src/core/stdhelp/src/about.cpp @@ -77,7 +77,7 @@ INT_PTR CALLBACK DlgProcAbout(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar } FreeResource(hRes); } - Window_SetIcon_IcoLib(hwndDlg, SKINICON_OTHER_MIRANDA); + Window_SetSkinIcon_IcoLib(hwndDlg, SKINICON_OTHER_MIRANDA); return TRUE; case WM_COMMAND: diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index 22bf436713..9e43d2cf48 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -909,13 +909,11 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l if (dat->szProto) { WORD wStatus = db_get_w(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE); - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)Skin_LoadProtoIcon(dat->szProto, wStatus, true)); - SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)Skin_LoadProtoIcon(dat->szProto, wStatus)); + Window_SetProtoIcon_IcoLib(hwndDlg, dat->szProto, wStatus); break; } } - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)Skin_LoadIcon(SKINICON_EVENT_MESSAGE, true)); - SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)Skin_LoadIcon(SKINICON_EVENT_MESSAGE)); + Window_SetSkinIcon_IcoLib(hwndDlg, SKINICON_EVENT_MESSAGE); break; case DM_USERNAMETOCLIP: diff --git a/src/core/stdmsg/src/msgs.h b/src/core/stdmsg/src/msgs.h index 31a1c643cf..ac5c99a003 100644 --- a/src/core/stdmsg/src/msgs.h +++ b/src/core/stdmsg/src/msgs.h @@ -127,6 +127,7 @@ int DbEventIsForMsgWindow(DBEVENTINFO *dbei); int DbEventIsShown(DBEVENTINFO *dbei); void StreamInEvents(HWND hwndDlg, MEVENT hDbEventFirst, int count, int fAppend); int SendMessageDirect(const TCHAR *szMsg, MCONTACT hContact, char *szProto); +INT_PTR SendMessageCmd(MCONTACT hContact, char *msg, int isWchar); void LoadMsgLogIcons(void); void FreeMsgLogIcons(void); diff --git a/src/core/stdmsg/src/msgtimedout.cpp b/src/core/stdmsg/src/msgtimedout.cpp index 187bc43f41..0f3d4ac508 100644 --- a/src/core/stdmsg/src/msgtimedout.cpp +++ b/src/core/stdmsg/src/msgtimedout.cpp @@ -28,9 +28,7 @@ struct ErrorDlgParam TMsgQueue *item; }; -INT_PTR SendMessageCmd(MCONTACT hContact, char* msg, int isWchar); - -static INT_PTR CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +INT_PTR CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { TMsgQueue *item = (TMsgQueue*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); diff --git a/src/core/stduihist/src/history.cpp b/src/core/stduihist/src/history.cpp index 16d78a9144..f1e6b26602 100644 --- a/src/core/stduihist/src/history.cpp +++ b/src/core/stduihist/src/history.cpp @@ -211,7 +211,7 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP mir_sntprintf(str, TranslateT("History for %s"), contactName); SetWindowText(hwndDlg, str); } - Window_SetIcon_IcoLib(hwndDlg, SKINICON_OTHER_HISTORY); + Window_SetSkinIcon_IcoLib(hwndDlg, SKINICON_OTHER_HISTORY); SendMessage(hwndDlg, DM_HREBUILD, 0, 0); return TRUE; diff --git a/src/core/stduserinfo/src/userinfo.cpp b/src/core/stduserinfo/src/userinfo.cpp index 947112d355..23009dcaa5 100644 --- a/src/core/stduserinfo/src/userinfo.cpp +++ b/src/core/stduserinfo/src/userinfo.cpp @@ -238,7 +238,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); - Window_SetIcon_IcoLib(hwndDlg, SKINICON_OTHER_USERDETAILS); + Window_SetSkinIcon_IcoLib(hwndDlg, SKINICON_OTHER_USERDETAILS); { PROPSHEETHEADER *psh = (PROPSHEETHEADER*)lParam; dat = (DetailsData*)mir_calloc(sizeof(DetailsData)); diff --git a/src/mir_app/src/addcontact.cpp b/src/mir_app/src/addcontact.cpp index 24aff743ff..0a712d6833 100644 --- a/src/mir_app/src/addcontact.cpp +++ b/src/mir_app/src/addcontact.cpp @@ -65,7 +65,7 @@ public: void OnInitDialog() { char szUin[10]; - Window_SetIcon_IcoLib(m_hwnd, SKINICON_OTHER_ADDCONTACT); + Window_SetSkinIcon_IcoLib(m_hwnd, SKINICON_OTHER_ADDCONTACT); if (m_acs.handleType == HANDLE_EVENT) { DWORD dwUin; DBEVENTINFO dbei = { sizeof(dbei) }; diff --git a/src/mir_app/src/enterstring.cpp b/src/mir_app/src/enterstring.cpp index 144cfae239..1a54815172 100644 --- a/src/mir_app/src/enterstring.cpp +++ b/src/mir_app/src/enterstring.cpp @@ -94,8 +94,7 @@ static INT_PTR CALLBACK sttEnterStringDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)Skin_LoadIcon(SKINICON_OTHER_RENAME, true)); - SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)Skin_LoadIcon(SKINICON_OTHER_RENAME, false)); + Window_SetSkinIcon_IcoLib(hwndDlg, SKINICON_OTHER_RENAME); params = (EnterStringFormParam *)lParam; SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)params); SetWindowText(hwndDlg, params->caption); diff --git a/src/mir_app/src/findadd.cpp b/src/mir_app/src/findadd.cpp index 6c6523b2d9..a2177c7a27 100644 --- a/src/mir_app/src/findadd.cpp +++ b/src/mir_app/src/findadd.cpp @@ -319,7 +319,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); - Window_SetIcon_IcoLib(hwndDlg, SKINICON_OTHER_FINDUSER); + Window_SetSkinIcon_IcoLib(hwndDlg, SKINICON_OTHER_FINDUSER); dat = (FindAddDlgData*)mir_calloc(sizeof(FindAddDlgData)); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat); dat->notSearchedYet = 1; diff --git a/src/mir_app/src/icolib.cpp b/src/mir_app/src/icolib.cpp index ed0177275b..e77cc58a59 100644 --- a/src/mir_app/src/icolib.cpp +++ b/src/mir_app/src/icolib.cpp @@ -662,15 +662,15 @@ HICON IconItem_GetIcon(HANDLE hIcoLib, bool big) big = big && !item->cx; IconSourceItem* &source = big ? item->source_big : item->source_small; - - DBVARIANT dbv = { 0 }; - if (!source && !db_get_ts(NULL, "SkinIcons", item->name, &dbv)) { - TCHAR tszFullPath[MAX_PATH]; - PathToAbsoluteT(dbv.ptszVal, tszFullPath); - int cx = item->cx ? item->cx : (big ? g_iIconX : g_iIconSX); - int cy = item->cy ? item->cy : (big ? g_iIconY : g_iIconSY); - source = GetIconSourceItemFromPath(tszFullPath, cx, cy); - db_free(&dbv); + if (source == NULL) { + ptrT tszCustomPath(db_get_tsa(NULL, "SkinIcons", item->name)); + if (tszCustomPath != NULL) { + TCHAR tszFullPath[MAX_PATH]; + PathToAbsoluteT(tszCustomPath, tszFullPath); + int cx = item->cx ? item->cx : (big ? g_iIconX : g_iIconSX); + int cy = item->cy ? item->cy : (big ? g_iIconY : g_iIconSY); + source = GetIconSourceItemFromPath(tszFullPath, cx, cy); + } } HICON hIcon = NULL; diff --git a/src/mir_app/src/meta_addto.cpp b/src/mir_app/src/meta_addto.cpp index 6b461e3a82..e51af79104 100644 --- a/src/mir_app/src/meta_addto.cpp +++ b/src/mir_app/src/meta_addto.cpp @@ -135,7 +135,7 @@ static INT_PTR CALLBACK Meta_SelectDialogProc(HWND hwndDlg, UINT msg, WPARAM wPa SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); // user data is contact handle - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)LoadIconEx(I_ADD)); + Window_SetIcon_IcoLib(hwndDlg, Meta_GetIconHandle(I_ADD)); // Initialize the graphical part CheckDlgButton(hwndDlg, IDC_ONLYAVAIL, BST_CHECKED); // Initially checked; display all metacontacts is only an option @@ -199,7 +199,7 @@ static INT_PTR CALLBACK Meta_SelectDialogProc(HWND hwndDlg, UINT msg, WPARAM wPa case WM_DESTROY: // Free all allocated memory and return the focus to the CList HWND clist = GetParent(hwndDlg); - IcoLib_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_BIG, 0)); + Window_FreeIcon_IcoLib(hwndDlg); EndDialog(hwndDlg, TRUE); SetFocus(clist); return TRUE; diff --git a/src/mir_app/src/meta_edit.cpp b/src/mir_app/src/meta_edit.cpp index 74380b78d6..87dc0aa609 100644 --- a/src/mir_app/src/meta_edit.cpp +++ b/src/mir_app/src/meta_edit.cpp @@ -32,7 +32,7 @@ struct MCONTACT hDefaultContact; // HANDLE of the new default contact MCONTACT hOfflineContact; int num_deleted, // DWORD number of deleted contacts - num_contacts; // DWORD number of contacts + num_contacts; // DWORD number of contacts MCONTACT hDeletedContacts[MAX_CONTACTS]; // HANDLEs of the subcontacts to be removed from this metacontact MCONTACT hContact[MAX_CONTACTS]; // HANDLEs of the subcontacts, in the order they should be in } @@ -197,7 +197,7 @@ LRESULT ProcessCustomDraw(LPARAM lParam) * * @param hwndDlg : HANDLE to the 'Edit' Dialog. * @param uMsg : Specifies the message received by this dialog. -* @param wParam : Specifies additional message-specific information. +* @param wParam : Specifies additional message-specific information. * @param lParam : Specifies additional message-specific information (handle of MetaContact to edit) * * @return TRUE if the dialog processed the message, FALSE if it did not. @@ -213,7 +213,7 @@ static INT_PTR CALLBACK Meta_EditDialogProc(HWND hwndDlg, UINT msg, WPARAM wPara switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)LoadIconEx(I_EDIT)); + Window_SetIcon_IcoLib(hwndDlg, Meta_GetIconHandle(I_EDIT)); { DBCachedContact *cc = currDb->m_cache->GetCachedContact(lParam); if (cc == NULL) { @@ -287,7 +287,7 @@ static INT_PTR CALLBACK Meta_EditDialogProc(HWND hwndDlg, UINT msg, WPARAM wPara // enable buttons EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_REM), sel != -1); EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_SETDEFAULT), sel != -1 && g_data.hContact[sel] != g_data.hDefaultContact); - + EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_UP), sel > 0); EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_DOWN), (sel != -1 && sel < g_data.num_contacts - 1)); @@ -428,7 +428,7 @@ static INT_PTR CALLBACK Meta_EditDialogProc(HWND hwndDlg, UINT msg, WPARAM wPara return TRUE; case WM_DESTROY: - IcoLib_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_BIG, 0)); + Window_FreeIcon_IcoLib(hwndDlg); EndDialog(hwndDlg, IDCANCEL); break; } diff --git a/src/mir_app/src/meta_main.cpp b/src/mir_app/src/meta_main.cpp index 2b49613832..352e3d3ffc 100644 --- a/src/mir_app/src/meta_main.cpp +++ b/src/mir_app/src/meta_main.cpp @@ -37,14 +37,14 @@ static IconItem iconList[] = { { LPGEN("Remove"), "remove", IDI_MCREMOVE }, }; -HANDLE GetIconHandle(IconIndex i) +HANDLE Meta_GetIconHandle(IconIndex i) { return iconList[i].hIcolib; } -HICON LoadIconEx(IconIndex i) +HICON Meta_LoadIconEx(IconIndex i, bool big) { - return IcoLib_GetIcon(iconList[i].szName); + return IcoLib_GetIcon(iconList[i].szName, big); } void UnloadMetacontacts(void) diff --git a/src/mir_app/src/meta_menu.cpp b/src/mir_app/src/meta_menu.cpp index 7c6cf58832..b2ded22f38 100644 --- a/src/mir_app/src/meta_menu.cpp +++ b/src/mir_app/src/meta_menu.cpp @@ -342,9 +342,9 @@ INT_PTR Meta_OnOff(WPARAM, LPARAM) bool bToggled = !db_mc_isEnabled(); db_set_b(0, META_PROTO, "Enabled", bToggled); if (bToggled) - Menu_ModifyItem(hMenuOnOff, LPGENT("Toggle metacontacts off"), GetIconHandle(I_MENU)); + Menu_ModifyItem(hMenuOnOff, LPGENT("Toggle metacontacts off"), Meta_GetIconHandle(I_MENU)); else - Menu_ModifyItem(hMenuOnOff, LPGENT("Toggle metacontacts on"), GetIconHandle(I_MENUOFF)); + Menu_ModifyItem(hMenuOnOff, LPGENT("Toggle metacontacts on"), Meta_GetIconHandle(I_MENUOFF)); db_mc_enable(bToggled); Meta_HideMetaContacts(!bToggled); @@ -360,7 +360,7 @@ void InitMenus() // main menu item SET_UID(mi, 0x8999a6ca, 0x9c66, 0x49c1, 0xad, 0xe1, 0x48, 0x17, 0x28, 0xb, 0x94, 0x86); - mi.hIcolibItem = GetIconHandle(I_MENU); + mi.hIcolibItem = Meta_GetIconHandle(I_MENU); mi.name.a = LPGEN("Toggle metacontacts off"); mi.pszService = "MetaContacts/OnOff"; mi.position = 500010000; @@ -368,35 +368,35 @@ void InitMenus() // contact menu items SET_UID(mi, 0x48cdb295, 0x858f, 0x4f4f, 0x80, 0xc7, 0x50, 0x49, 0x91, 0x75, 0xa6, 0x63); - mi.hIcolibItem = GetIconHandle(I_CONVERT); + mi.hIcolibItem = Meta_GetIconHandle(I_CONVERT); mi.position = -200010; mi.name.a = LPGEN("Convert to metacontact"); mi.pszService = "MetaContacts/Convert"; hMenuConvert = Menu_AddContactMenuItem(&mi); SET_UID(mi, 0xf1437693, 0x69f5, 0x48b0, 0x89, 0xed, 0x29, 0x2c, 0x20, 0x1f, 0xed, 0x3e); - mi.hIcolibItem = GetIconHandle(I_ADD); + mi.hIcolibItem = Meta_GetIconHandle(I_ADD); mi.position = -200009; mi.name.a = LPGEN("Add to existing metacontact..."); mi.pszService = "MetaContacts/AddTo"; hMenuAdd = Menu_AddContactMenuItem(&mi); SET_UID(mi, 0x1673fd9e, 0x8d30, 0x4e07, 0x9f, 0x1b, 0xec, 0x92, 0xc0, 0x10, 0x90, 0x64); - mi.hIcolibItem = GetIconHandle(I_EDIT); + mi.hIcolibItem = Meta_GetIconHandle(I_EDIT); mi.position = -200010; mi.name.a = LPGEN("Edit metacontact..."); mi.pszService = "MetaContacts/Edit"; hMenuEdit = Menu_AddContactMenuItem(&mi); SET_UID(mi, 0x38b7400, 0x685a, 0x497d, 0xbc, 0x15, 0x99, 0x45, 0xcc, 0x1d, 0x9d, 0xaf); - mi.hIcolibItem = GetIconHandle(I_SETDEFAULT); + mi.hIcolibItem = Meta_GetIconHandle(I_SETDEFAULT); mi.position = -200009; mi.name.a = LPGEN("Set as metacontact default"); mi.pszService = "MetaContacts/Default"; hMenuDefault = Menu_AddContactMenuItem(&mi); SET_UID(mi, 0x102849ca, 0x9d2f, 0x4265, 0x81, 0xdc, 0x5d, 0xc8, 0x82, 0xb7, 0x70, 0xe5); - mi.hIcolibItem = GetIconHandle(I_REMOVE); + mi.hIcolibItem = Meta_GetIconHandle(I_REMOVE); mi.position = -200008; mi.name.a = LPGEN("Delete metacontact"); mi.pszService = "MetaContacts/Delete"; @@ -427,7 +427,7 @@ void InitMenus() if (!db_mc_isEnabled()) { // modify main menu item - Menu_ModifyItem(hMenuOnOff, LPGENT("Toggle metacontacts on"), GetIconHandle(I_MENUOFF)); + Menu_ModifyItem(hMenuOnOff, LPGENT("Toggle metacontacts on"), Meta_GetIconHandle(I_MENUOFF)); Meta_HideMetaContacts(true); } else { diff --git a/src/mir_app/src/metacontacts.h b/src/mir_app/src/metacontacts.h index 2c4ff0715c..e0a3210c2e 100644 --- a/src/mir_app/src/metacontacts.h +++ b/src/mir_app/src/metacontacts.h @@ -104,8 +104,8 @@ int Meta_ReadOptions(); void CreateApiServices(); typedef enum {I_MENUOFF, I_MENU, I_CONVERT, I_ADD, I_EDIT, I_SETDEFAULT, I_REMOVE} IconIndex; -HICON LoadIconEx(IconIndex i); -HANDLE GetIconHandle(IconIndex i); +HICON Meta_LoadIconEx(IconIndex i, bool big = false); +HANDLE Meta_GetIconHandle(IconIndex i); extern HANDLE hEventForceSend, hEventUnforceSend, hSubcontactsChanged; extern POINT menuMousePoint; diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 07184f4596..613e3436c9 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -15,7 +15,7 @@ IcoLib_GetIconHandle @12 IcoLib_IsManaged @13 IcoLib_ReleaseIcon @14 Window_FreeIcon_IcoLib @15 -Window_SetIcon_IcoLib @16 +Window_SetSkinIcon_IcoLib @16 Window_SetProtoIcon_IcoLib @17 ProtoServiceExists @18 mir_main @19 @@ -262,3 +262,4 @@ Clist_GroupAdded @260 Contact_GetInfo @261 Clist_ContactToHItem @262 Clist_ContactToItemHandle @263 +Window_SetSkinIcon_IcoLib @264 diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 962847263d..d5a9fc3bc0 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -15,7 +15,7 @@ IcoLib_GetIconHandle @12 IcoLib_IsManaged @13 IcoLib_ReleaseIcon @14 Window_FreeIcon_IcoLib @15 -Window_SetIcon_IcoLib @16 +Window_SetSkinIcon_IcoLib @16 Window_SetProtoIcon_IcoLib @17 ProtoServiceExists @18 mir_main @19 @@ -262,3 +262,4 @@ Clist_GroupAdded @260 Contact_GetInfo @261 Clist_ContactToHItem @262 Clist_ContactToItemHandle @263 +Window_SetSkinIcon_IcoLib @264 diff --git a/src/mir_app/src/options.cpp b/src/mir_app/src/options.cpp index 3650a76fe3..bb41ab3100 100644 --- a/src/mir_app/src/options.cpp +++ b/src/mir_app/src/options.cpp @@ -769,7 +769,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L SetWindowLongPtr(hdlg, GWLP_USERDATA, (LONG_PTR)dat); Utils_RestoreWindowPositionNoSize(hdlg, NULL, "Options", ""); - Window_SetIcon_IcoLib(hdlg, SKINICON_OTHER_OPTIONS); + Window_SetSkinIcon_IcoLib(hdlg, SKINICON_OTHER_OPTIONS); EnableWindow(GetDlgItem(hdlg, IDC_APPLY), FALSE); { COMBOBOXINFO cbi; diff --git a/src/mir_app/src/profilemanager.cpp b/src/mir_app/src/profilemanager.cpp index a04f18ae16..8828a2de55 100644 --- a/src/mir_app/src/profilemanager.cpp +++ b/src/mir_app/src/profilemanager.cpp @@ -597,6 +597,7 @@ public: virtual void OnInitDialog() { + // MUST NOT be replaced with Window_SetIcon_IcoLib!!! SendMessage(m_hwnd, WM_SETICON, ICON_SMALL, (LPARAM)LoadImage(g_hInst, MAKEINTRESOURCE(IDI_DETAILSLOGO), IMAGE_ICON, g_iIconSX, g_iIconSY, 0)); SendMessage(m_hwnd, WM_SETICON, ICON_BIG, (LPARAM)LoadImage(g_hInst, MAKEINTRESOURCE(IDI_DETAILSLOGO), IMAGE_ICON, g_iIconX, g_iIconY, 0)); diff --git a/src/mir_app/src/proto_opts.cpp b/src/mir_app/src/proto_opts.cpp index f7a72e5d70..43178651aa 100644 --- a/src/mir_app/src/proto_opts.cpp +++ b/src/mir_app/src/proto_opts.cpp @@ -481,7 +481,7 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM switch (message) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); - Window_SetIcon_IcoLib(hwndDlg, SKINICON_OTHER_ACCMGR); + Window_SetSkinIcon_IcoLib(hwndDlg, SKINICON_OTHER_ACCMGR); dat = (TAccMgrData *)mir_alloc(sizeof(TAccMgrData)); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat); diff --git a/src/mir_app/src/proto_ui.cpp b/src/mir_app/src/proto_ui.cpp index 2e3f0cb564..7d54485e58 100644 --- a/src/mir_app/src/proto_ui.cpp +++ b/src/mir_app/src/proto_ui.cpp @@ -80,8 +80,7 @@ INT_PTR CProtoIntDlgBase::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) return result; case WM_DESTROY: - IcoLib_ReleaseIcon((HICON)SendMessage(m_hwnd, WM_SETICON, ICON_BIG, 0)); - IcoLib_ReleaseIcon((HICON)SendMessage(m_hwnd, WM_SETICON, ICON_SMALL, 0)); + Window_FreeIcon_IcoLib(m_hwnd); m_proto_interface->WindowUnsubscribe(m_hwnd); break; diff --git a/src/mir_app/src/skinicons.cpp b/src/mir_app/src/skinicons.cpp index daea186017..b1639ae6a2 100644 --- a/src/mir_app/src/skinicons.cpp +++ b/src/mir_app/src/skinicons.cpp @@ -188,28 +188,34 @@ int ImageList_ReplaceIcon_IconLibLoaded(HIMAGELIST hIml, int nIndex, HICON hIcon return res; } -MIR_APP_DLL(void) Window_SetIcon_IcoLib(HWND hWnd, int iconId) +MIR_APP_DLL(void) Window_SetIcon_IcoLib(HWND hWnd, HANDLE hIcolib) { - SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)Skin_LoadIcon(iconId, true)); - SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)Skin_LoadIcon(iconId)); + SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIconByHandle(hIcolib, true)); + SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIconByHandle(hIcolib, false)); +} + +MIR_APP_DLL(void) Window_SetSkinIcon_IcoLib(HWND hWnd, int iconId) +{ + SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)Skin_LoadIcon(iconId, true)); + SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)Skin_LoadIcon(iconId, false)); } MIR_APP_DLL(void) Window_SetProtoIcon_IcoLib(HWND hWnd, const char *szProto, int iconId) { - SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)Skin_LoadProtoIcon(szProto, iconId, true)); - SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)Skin_LoadProtoIcon(szProto, iconId)); + SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)Skin_LoadProtoIcon(szProto, iconId, true)); + SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)Skin_LoadProtoIcon(szProto, iconId, false)); } MIR_APP_DLL(void) Window_FreeIcon_IcoLib(HWND hWnd) { IcoLib_ReleaseIcon((HICON)SendMessage(hWnd, WM_SETICON, ICON_BIG, 0), true); - IcoLib_ReleaseIcon((HICON)SendMessage(hWnd, WM_SETICON, ICON_SMALL, 0)); + IcoLib_ReleaseIcon((HICON)SendMessage(hWnd, WM_SETICON, ICON_SMALL, 0), false); } MIR_APP_DLL(void) Button_SetIcon_IcoLib(HWND hwndDlg, int itemId, int iconId, const char *tooltip) { HWND hWnd = GetDlgItem(hwndDlg, itemId); - SendMessage(hWnd, BM_SETIMAGE, IMAGE_ICON, (LPARAM)Skin_LoadIcon(iconId)); + SendMessage(hWnd, BM_SETIMAGE, IMAGE_ICON, (LPARAM)Skin_LoadIcon(iconId, false)); SendMessage(hWnd, BUTTONSETASFLATBTN, TRUE, 0); SendMessage(hWnd, BUTTONADDTOOLTIP, (WPARAM)tooltip, 0); } -- cgit v1.2.3