From d0176baeca0f8ff96209560dfdc2a91ec871288a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 26 Jul 2020 18:18:43 +0300 Subject: fixes #2501 (Ability to disable incoming sounds in chats is lost) --- src/mir_app/mir_app.vcxproj | 91 +++++++++++++ src/mir_app/mir_app.vcxproj.filters | 263 ++++++++++++++++++++++++++++++++++++ src/mir_app/res/resource.rc | 173 +++++++++++++++++++++++- src/mir_app/src/chat.h | 4 + src/mir_app/src/chat_opts.cpp | 5 +- src/mir_app/src/chat_tools.cpp | 5 +- src/mir_app/src/chat_ui.cpp | 119 ++++++++++++++++ src/mir_app/src/resource.h | 63 ++++++++- src/mir_app/src/srmm_toolbar.cpp | 5 +- 9 files changed, 720 insertions(+), 8 deletions(-) create mode 100644 src/mir_app/src/chat_ui.cpp (limited to 'src/mir_app') diff --git a/src/mir_app/mir_app.vcxproj b/src/mir_app/mir_app.vcxproj index 3c7ca84a6f..c054553f42 100644 --- a/src/mir_app/mir_app.vcxproj +++ b/src/mir_app/mir_app.vcxproj @@ -36,6 +36,7 @@ + @@ -207,7 +208,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/mir_app/mir_app.vcxproj.filters b/src/mir_app/mir_app.vcxproj.filters index 8dbf493879..0d94a10dcc 100644 --- a/src/mir_app/mir_app.vcxproj.filters +++ b/src/mir_app/mir_app.vcxproj.filters @@ -386,6 +386,9 @@ Source Files + + Source Files + @@ -460,5 +463,265 @@ + + Resource Files + + + Resource Files + + + Resource Files + + + + + + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + \ No newline at end of file diff --git a/src/mir_app/res/resource.rc b/src/mir_app/res/resource.rc index 1a3e54ef0b..8a5b27754c 100644 --- a/src/mir_app/res/resource.rc +++ b/src/mir_app/res/resource.rc @@ -791,8 +791,84 @@ BEGIN CONTROL "",IDC_HIDEOFFLINEOPTS,"SysTreeView32",TVS_DISABLEDRAGDROP | TVS_NOTOOLTIPS | TVS_NONEVENHEIGHT | WS_BORDER | WS_HSCROLL | WS_TABSTOP,183,24,105,104 END +IDD_OPT_CHAT_EVENTS DIALOGEX 0, 0, 306, 194 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + GROUPBOX "Default settings for known event types",IDC_STATIC,7,5,293,153 + LTEXT "Show when filter is active",IDC_STATIC,12,16,119,8,SS_CENTERIMAGE + CTEXT "Log to file",IDC_STATIC,260,16,37,8,SS_CENTERIMAGE + CTEXT "Popup",IDC_STATIC,142,16,31,8,SS_CENTERIMAGE + CTEXT "Tray",IDC_STATIC,181,16,31,8,SS_CENTERIMAGE + CTEXT "Sound",IDC_STATIC,221,16,31,8,SS_CENTERIMAGE + CONTROL "Actions",IDC_1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,28,120,10 + CONTROL "Messages",IDC_2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,38,120,10 + CONTROL "Nick changes",IDC_3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,48,120,10 + CONTROL "Users joining",IDC_4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,58,120,10 + CONTROL "Users leaving",IDC_5,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,68,120,10 + CONTROL "Topic changes",IDC_6,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,78,120,10 + CONTROL "Status changes",IDC_7,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,88,120,10 + CONTROL "Information",IDC_8,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,98,120,10 + CONTROL "Disconnects",IDC_9,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,108,120,10 + CONTROL "User kicks",IDC_10,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,118,120,10 + CONTROL "Notices",IDC_11,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,128,120,10 + CONTROL "",IDC_P1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,153,28,21,10 + CONTROL "",IDC_P2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,153,38,21,10 + CONTROL "",IDC_P3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,153,48,21,10 + CONTROL "",IDC_P4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,153,58,21,10 + CONTROL "",IDC_P5,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,153,68,21,10 + CONTROL "",IDC_P6,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,153,78,21,10 + CONTROL "",IDC_P7,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,153,88,21,10 + CONTROL "",IDC_P8,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,153,98,21,10 + CONTROL "",IDC_P9,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,153,108,21,10 + CONTROL "",IDC_P10,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,153,118,21,10 + CONTROL "",IDC_P11,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,153,128,21,10 + CONTROL "",IDC_P12,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,153,138,21,10 + CONTROL "",IDC_T1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,193,28,21,10 + CONTROL "",IDC_T2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,193,38,21,10 + CONTROL "",IDC_T3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,193,48,21,10 + CONTROL "",IDC_T4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,193,58,21,10 + CONTROL "",IDC_T5,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,193,68,21,10 + CONTROL "",IDC_T6,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,193,78,21,10 + CONTROL "",IDC_T7,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,193,88,21,10 + CONTROL "",IDC_T8,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,193,98,21,10 + CONTROL "",IDC_T9,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,193,108,21,10 + CONTROL "",IDC_T10,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,193,118,21,10 + CONTROL "",IDC_T11,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,193,128,21,10 + CONTROL "",IDC_T12,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,193,138,21,10 + CONTROL "",IDC_S1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,233,28,21,10 + CONTROL "",IDC_S2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,233,38,21,10 + CONTROL "",IDC_S3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,233,48,21,10 + CONTROL "",IDC_S4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,233,58,21,10 + CONTROL "",IDC_S5,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,233,68,21,10 + CONTROL "",IDC_S6,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,233,78,21,10 + CONTROL "",IDC_S7,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,233,88,21,10 + CONTROL "",IDC_S8,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,233,98,21,10 + CONTROL "",IDC_S9,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,233,108,21,10 + CONTROL "",IDC_S10,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,233,118,21,10 + CONTROL "",IDC_S11,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,233,128,21,10 + CONTROL "",IDC_S12,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,233,138,21,10 + CONTROL "",IDC_L1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,274,28,21,10 + CONTROL "",IDC_L2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,274,38,21,10 + CONTROL "",IDC_L3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,274,48,21,10 + CONTROL "",IDC_L4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,274,58,21,10 + CONTROL "",IDC_L5,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,274,68,21,10 + CONTROL "",IDC_L6,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,274,78,21,10 + CONTROL "",IDC_L7,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,274,88,21,10 + CONTROL "",IDC_L8,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,274,98,21,10 + CONTROL "",IDC_L9,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,274,108,21,10 + CONTROL "",IDC_L10,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,274,118,21,10 + CONTROL "",IDC_L11,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,274,128,21,10 + CONTROL "Show icons in tray only when the chat room is not active",IDC_TRAYONLYFORINACTIVE, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,164,279,8 + LTEXT "Highlight event",IDC_STATIC,42,139,100,12 + CONTROL "Show popups only when the chat room is not active",IDC_POPUPONLYFORINACTIVE, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,176,279,8 +END + IDD_EMPTY DIALOGEX 0, 0, 212, 131 -STYLE DS_FIXEDSYS | WS_POPUP +STYLE DS_FIXEDSYS | WS_POPUP | WS_CAPTION CAPTION "Hidden window" BEGIN END @@ -1094,6 +1170,10 @@ BEGIN IDD_OPT_CLIST, DIALOG BEGIN END + + IDD_OPT_CHAT_EVENTS, DIALOG + BEGIN + END END #endif // APSTUDIO_INVOKED @@ -1133,6 +1213,7 @@ END IDR_CREDITS TEXT "../../docs/contributors.txt" + ///////////////////////////////////////////////////////////////////////////// // // Icon @@ -1141,97 +1222,182 @@ IDR_CREDITS TEXT "../../docs/contributors.txt" // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. IDI_MIRANDA ICON "miranda_logo.ico" + IDI_MIRANDAWEBSITE ICON "miranda_home.ico" + IDI_DETAILSLOGO ICON "miranda_manager.ico" + IDI_USERDETAILS ICON "contact_view_details.ico" + IDI_ADDCONTACT ICON "contact_add.ico" + IDI_RENAME ICON "contact_rename.ico" + IDI_DELETE ICON "contact_delete.ico" + IDI_GROUPSHUT ICON "group_closed.ico" + IDI_GROUPOPEN ICON "group_opened.ico" + IDI_USERONLINE ICON "status_user_online.ico" + IDI_ONLINE ICON "status_online.ico" + IDI_AWAY ICON "status_away.ico" + IDI_NA ICON "status_NA.ico" + IDI_OCCUPIED ICON "status_occupied.ico" + IDI_DND ICON "status_DND.ico" + IDI_FREE4CHAT ICON "status_free4chat.ico" + IDI_INVISIBLE ICON "status_invisible.ico" + IDI_ONTHEPHONE ICON "status_on_the_phone.ico" + IDI_OUTTOLUNCH ICON "status_out2lunch.ico" + IDI_OFFLINE ICON "status_offline.ico" + IDI_LOAD ICON "icon_connecting.ico" + IDI_TYPING ICON "icon_typing.ico" + IDI_FINDUSER ICON "icon_find_user.ico" + IDI_SEARCHALL ICON "icon_search_all.ico" + IDI_OPTIONS ICON "icon_options.ico" + IDI_ACCMGR ICON "icon_accmgr.ico" + IDI_MAINMENU ICON "icon_mainmenu.ico" + IDI_HELP ICON "icon_help.ico" + IDI_RECVMSG ICON "icon_message.ico" + IDI_FILE ICON "icon_file.ico" + IDI_HISTORY ICON "icon_history.ico" + IDI_URL ICON "icon_url.ico" + IDI_SMS ICON "icon_sms.ico" + IDI_SENDEMAIL ICON "icon_mail.ico" + IDI_SMALLDOT ICON "icon_small_dot.ico" + IDI_FILLEDBLOB ICON "icon_auth_request.ico" + IDI_EMPTYBLOB ICON "icon_all.ico" + IDI_DOWNARROW ICON "icon_down_arrow.ico" + IDI_NOTICK ICON "check_off.ico" + IDI_TICK ICON "check_on.ico" + IDI_UNICODE ICON "icon_unicode.ico" + IDI_ANSI ICON "icon_ansi.ico" + IDI_LOADED_GRAY ICON "icon_loaded_gray.ico" + IDI_NOTLOADED ICON "icon_notloaded.ico" + IDI_NOTLOADED_GRAY ICON "icon_notloaded_gray.ico" + IDI_FRAME ICON "icon_frame.ico" + IDI_MFATAL ICON "icon_fatal.ico" + IDI_MERROR ICON "icon_error.ico" + IDI_MWARNING ICON "icon_warning.ico" + IDI_MINFO ICON "icon_notify.ico" + IDI_BLANK ICON "_blank.ico" + IDI_UNDO ICON "icon_undo.ico" + IDI_WINDOW ICON "icon_window.ico" + IDI_WINDOWS ICON "icon_windows.ico" + IDI_JOINCHAT ICON "chat_join.ico" + IDI_LEAVECHAT ICON "chat_leave.ico" + IDI_STATUS_LOCKED ICON "status_locked.ico" + IDI_SHOWHIDE ICON "Icon_show_hide.ico" + IDI_EXIT ICON "Icon_exit.ico" + IDI_MOVETOGROUP ICON "contact_groups.ico" + IDI_ON ICON "On.ico" + IDI_OFF ICON "Off.ico" + IDI_ALWAYSVIS ICON "always_visible.ico" + IDI_NEVERVIS ICON "never_visible.ico" + IDI_CHAT ICON "chat_channel.ico" + IDI_MALE ICON "male.ico" + IDI_FEMALE ICON "female.ico" + IDI_AUTH_ADD ICON "auth_add.ico" + IDI_AUTH_GRANT ICON "auth_grant.ico" + IDI_AUTH_REQUEST ICON "auth_request.ico" + IDI_AUTH_REVOKE ICON "auth_revoke.ico" + IDI_MCMENU ICON "meta_menu.ico" + IDI_MCMENUOFF ICON "meta_menuof.ico" + IDI_MCEDIT ICON "meta_edit.ico" + IDI_MCREMOVE ICON "meta_remove2.ico" + IDI_MCCONVERT ICON "meta_convert.ico" + IDI_MCADD ICON "meta_add.ico" + IDI_MCSETDEFAULT ICON "meta_set_as_default.ico" + IDI_ADDGROUP ICON "addgroup.ico" + IDI_POPUP ICON "icon_popup.ico" + IDI_NOPOPUP ICON "icon_popup_no.ico" + IDI_PASSWORD ICON "icon_password.ico" + ///////////////////////////////////////////////////////////////////////////// // // Cursor // IDC_HYPERLINKHAND CURSOR "cursor_hyperlink.cur" + IDC_DROP CURSOR "cursor_drag_copy.cur" + IDC_DROPUSER CURSOR "cursor_drop_user.cur" + ///////////////////////////////////////////////////////////////////////////// // // Menu @@ -1379,6 +1545,11 @@ BEGIN 0 END +IDD_OPT_CHAT_EVENTS AFX_DIALOG_LAYOUT +BEGIN + 0 +END + #endif // English (United States) resources ///////////////////////////////////////////////////////////////////////////// diff --git a/src/mir_app/src/chat.h b/src/mir_app/src/chat.h index e3fa0461fa..2ac72235f9 100644 --- a/src/mir_app/src/chat.h +++ b/src/mir_app/src/chat.h @@ -43,6 +43,8 @@ extern LIST g_arSessions; extern MWindowList g_hWindowList; extern HANDLE hevSendEvent, hevBuildMenuEvent; +extern CMOption g_bChatTrayInactive, g_bChatPopupInactive; + // log.c void LoadMsgLogBitmaps(void); void FreeMsgLogBitmaps(void); @@ -94,6 +96,8 @@ INT_PTR LeaveChat(WPARAM wParam, LPARAM lParam); int PrebuildContactMenu(WPARAM wParam, LPARAM lParam); // options.c +void ChatOptionsInit(WPARAM wParam); + int OptionsInit(void); int OptionsUnInit(void); void LoadMsgDlgFont(int i, LOGFONT * lf, COLORREF * colour); diff --git a/src/mir_app/src/chat_opts.cpp b/src/mir_app/src/chat_opts.cpp index 450a1629c7..229f7da5a7 100644 --- a/src/mir_app/src/chat_opts.cpp +++ b/src/mir_app/src/chat_opts.cpp @@ -33,6 +33,7 @@ wchar_t *g_szFontGroup; #define FONTF_BOLD 1 #define FONTF_ITALIC 2 + struct FontOptionsList { LPCTSTR szDescr; @@ -220,8 +221,8 @@ void LoadGlobalSettings(void) g_Settings->crUserListColor = db_get_dw(0, CHATFONT_MODULE, "Font18Col", RGB(0, 0, 0)); g_Settings->crUserListHeadingsColor = db_get_dw(0, CHATFONT_MODULE, "Font19Col", RGB(170, 170, 170)); g_Settings->bStripFormat = db_get_b(0, CHAT_MODULE, "StripFormatting", 0) != 0; - g_Settings->bTrayIconInactiveOnly = db_get_b(0, CHAT_MODULE, "TrayIconInactiveOnly", 1) != 0; - g_Settings->bPopupInactiveOnly = db_get_b(0, CHAT_MODULE, "PopupInactiveOnly", 1) != 0; + g_Settings->bTrayIconInactiveOnly = g_bChatTrayInactive; + g_Settings->bPopupInactiveOnly = g_bChatPopupInactive; g_Settings->bAddColonToAutoComplete = db_get_b(0, CHAT_MODULE, "AddColonToAutoComplete", 1) != 0; g_Settings->iPopupStyle = db_get_b(0, CHAT_MODULE, "PopupStyle", 1); g_Settings->iPopupTimeout = db_get_w(0, CHAT_MODULE, "PopupTimeout", 3); diff --git a/src/mir_app/src/chat_tools.cpp b/src/mir_app/src/chat_tools.cpp index d3a190b80b..335ab64cbc 100644 --- a/src/mir_app/src/chat_tools.cpp +++ b/src/mir_app/src/chat_tools.cpp @@ -358,8 +358,9 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight break; } - if (szSound && (bInactive || !g_Settings->bSoundsFocus)) - Skin_PlaySound(szSound); + if (db_get_dw(0, CHAT_MODULE, "SoundFlags", GC_EVENT_HIGHLIGHT) & iEvent) + if (szSound && (bInactive || !g_Settings->bSoundsFocus)) + Skin_PlaySound(szSound); } return TRUE; diff --git a/src/mir_app/src/chat_ui.cpp b/src/mir_app/src/chat_ui.cpp new file mode 100644 index 0000000000..db2fbeaeee --- /dev/null +++ b/src/mir_app/src/chat_ui.cpp @@ -0,0 +1,119 @@ +/* +Chat module plugin for Miranda IM + +Copyright 2000-12 Miranda IM, 2012-20 Miranda NG team, +all portions of this codebase are copyrighted to the people +listed in contributors.txt. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "stdafx.h" + +#include "chat.h" + +CMOption g_bChatPopupInactive(CHAT_MODULE, "PopupInactiveOnly", true); +CMOption g_bChatTrayInactive(CHAT_MODULE, "TrayIconInactiveOnly", true); + +///////////////////////////////////////////////////////////////////////////////////////// +// Group chat - Events + +#define NR_GC_EVENTS 12 + +static UINT _eventorder[] = +{ + GC_EVENT_ACTION, + GC_EVENT_MESSAGE, + GC_EVENT_NICK, + GC_EVENT_JOIN, + GC_EVENT_PART, + GC_EVENT_TOPIC, + GC_EVENT_ADDSTATUS, + GC_EVENT_INFORMATION, + GC_EVENT_QUIT, + GC_EVENT_KICK, + GC_EVENT_NOTICE, + GC_EVENT_HIGHLIGHT +}; + +class CChatEventOptionDlg : public CDlgBase +{ + CCtrlCheck chkTray, chkPopup; + +public: + CChatEventOptionDlg() : + CDlgBase(g_plugin, IDD_OPT_CHAT_EVENTS), + chkTray(this, IDC_TRAYONLYFORINACTIVE), + chkPopup(this, IDC_POPUPONLYFORINACTIVE) + { + CreateLink(chkTray, g_bChatTrayInactive); + CreateLink(chkPopup, g_bChatPopupInactive); + } + + bool OnInitDialog() override + { + DWORD dwFilterFlags = db_get_dw(0, CHAT_MODULE, "FilterFlags", GC_EVENT_ALL); + DWORD dwTrayFlags = db_get_dw(0, CHAT_MODULE, "TrayIconFlags", GC_EVENT_HIGHLIGHT); + DWORD dwPopupFlags = db_get_dw(0, CHAT_MODULE, "PopupFlags", GC_EVENT_HIGHLIGHT); + DWORD dwSoundFlags = db_get_dw(0, CHAT_MODULE, "SoundFlags", GC_EVENT_HIGHLIGHT); + DWORD dwLogFlags = db_get_dw(0, CHAT_MODULE, "DiskLogFlags", GC_EVENT_ALL); + + for (int i = 0; i < _countof(_eventorder); i++) { + if (_eventorder[i] != GC_EVENT_HIGHLIGHT) { + CheckDlgButton(m_hwnd, IDC_1 + i, dwFilterFlags & _eventorder[i] ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(m_hwnd, IDC_L1 + i, dwLogFlags & _eventorder[i] ? BST_CHECKED : BST_UNCHECKED); + } + CheckDlgButton(m_hwnd, IDC_P1 + i, dwPopupFlags & _eventorder[i] ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(m_hwnd, IDC_T1 + i, dwTrayFlags & _eventorder[i] ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(m_hwnd, IDC_S1 + i, dwSoundFlags & _eventorder[i] ? BST_CHECKED : BST_UNCHECKED); + } + return true; + } + + bool OnApply() override + { + DWORD dwFilterFlags = 0, dwTrayFlags = 0, dwPopupFlags = 0, dwSoundFlags = 0, dwLogFlags = 0; + + for (int i = 0; i < _countof(_eventorder); i++) { + if (_eventorder[i] != GC_EVENT_HIGHLIGHT) { + dwFilterFlags |= (IsDlgButtonChecked(m_hwnd, IDC_1 + i) ? _eventorder[i] : 0); + dwLogFlags |= (IsDlgButtonChecked(m_hwnd, IDC_L1 + i) ? _eventorder[i] : 0); + } + dwSoundFlags |= (IsDlgButtonChecked(m_hwnd, IDC_S1 + i) ? _eventorder[i] : 0); + dwPopupFlags |= (IsDlgButtonChecked(m_hwnd, IDC_P1 + i) ? _eventorder[i] : 0); + dwTrayFlags |= (IsDlgButtonChecked(m_hwnd, IDC_T1 + i) ? _eventorder[i] : 0); + } + db_set_dw(0, CHAT_MODULE, "FilterFlags", dwFilterFlags); + db_set_dw(0, CHAT_MODULE, "PopupFlags", dwPopupFlags); + db_set_dw(0, CHAT_MODULE, "SoundFlags", dwSoundFlags); + db_set_dw(0, CHAT_MODULE, "TrayIconFlags", dwTrayFlags); + db_set_dw(0, CHAT_MODULE, "DiskLogFlags", dwLogFlags); + + LoadGlobalSettings(); + return true; + } +}; + +void ChatOptionsInit(WPARAM wParam) +{ + OPTIONSDIALOGPAGE odp = {}; + odp.flags = ODPF_BOLDGROUPS; + odp.position = 910000000; + odp.szGroup.a = LPGEN("Message sessions"); + odp.szTitle.a = LPGEN("Group chats"); + odp.szTab.a = LPGEN("Events and filters"); + odp.pDialog = new CChatEventOptionDlg(); + g_plugin.addOptions(wParam, &odp); +} diff --git a/src/mir_app/src/resource.h b/src/mir_app/src/resource.h index add1f10211..491cacf3d6 100644 --- a/src/mir_app/src/resource.h +++ b/src/mir_app/src/resource.h @@ -26,6 +26,7 @@ #define IDI_ADDGROUP 117 #define IDD_EMPTY 118 #define IDD_OPT_CLIST 119 +#define IDD_OPT_CHAT_EVENTS 120 #define IDD_AUTHREQ 121 #define IDD_DETAILS 125 #define IDD_HISTORY 127 @@ -214,6 +215,8 @@ #define IDC_SHOWNAMES 1031 #define IDC_ABOUT 1032 #define IDC_MYNOTES 1033 +#define IDC_TRAYONLYFORINACTIVE 1034 +#define IDC_POPUPONLYFORINACTIVE 1035 #define IDC_URLS 1037 #define IDC_COLORTEXT 1038 #define IDC_REPLY 1039 @@ -558,6 +561,64 @@ #define IDC_EFFECT_COLOUR_TEXT1 1853 #define IDC_EFFECT_COLOUR_SPIN1 1854 #define IDC_EXTRAORDER 1889 +#define IDC_1 4200 +#define IDC_2 4201 +#define IDC_3 4202 +#define IDC_4 4203 +#define IDC_5 4204 +#define IDC_6 4205 +#define IDC_7 4206 +#define IDC_8 4207 +#define IDC_9 4208 +#define IDC_10 4209 +#define IDC_11 4210 +#define IDC_P1 4300 +#define IDC_P2 4301 +#define IDC_P3 4302 +#define IDC_P4 4303 +#define IDC_P5 4304 +#define IDC_P6 4305 +#define IDC_P7 4306 +#define IDC_P8 4307 +#define IDC_P9 4308 +#define IDC_P10 4309 +#define IDC_P11 4310 +#define IDC_P12 4311 +#define IDC_T1 4400 +#define IDC_T2 4401 +#define IDC_T3 4402 +#define IDC_T4 4403 +#define IDC_T5 4404 +#define IDC_T6 4405 +#define IDC_T7 4406 +#define IDC_T8 4407 +#define IDC_T9 4408 +#define IDC_T10 4409 +#define IDC_T11 4410 +#define IDC_T12 4411 +#define IDC_L1 4500 +#define IDC_L2 4501 +#define IDC_L3 4502 +#define IDC_L4 4503 +#define IDC_L5 4504 +#define IDC_L6 4505 +#define IDC_L7 4506 +#define IDC_L8 4507 +#define IDC_L9 4508 +#define IDC_L10 4509 +#define IDC_L11 4510 +#define IDC_S1 4600 +#define IDC_S2 4601 +#define IDC_S3 4602 +#define IDC_S4 4603 +#define IDC_S5 4604 +#define IDC_S6 4605 +#define IDC_S7 4606 +#define IDC_S8 4607 +#define IDC_S9 4608 +#define IDC_S10 4609 +#define IDC_S11 4610 +#define IDC_S12 4611 #define IDC_EFFECT_COLOUR_TEXT2 11803 #define IDC_EFFECT_COLOUR_SPIN2 11806 #define IDI_SEARCHALL 32548 @@ -603,7 +664,7 @@ // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 331 +#define _APS_NEXT_RESOURCE_VALUE 332 #define _APS_NEXT_COMMAND_VALUE 40018 #define _APS_NEXT_CONTROL_VALUE 1749 #define _APS_NEXT_SYMED_VALUE 101 diff --git a/src/mir_app/src/srmm_toolbar.cpp b/src/mir_app/src/srmm_toolbar.cpp index 5aa899f31b..7b8ecfd5f6 100644 --- a/src/mir_app/src/srmm_toolbar.cpp +++ b/src/mir_app/src/srmm_toolbar.cpp @@ -777,6 +777,7 @@ static int SrmmOptionsInit(WPARAM wParam, LPARAM) odp.pDialog = new CSrmmToolbarOptions(); g_plugin.addOptions(wParam, &odp); + ChatOptionsInit(wParam); SrmmLogOptionsInit(wParam); return 0; } @@ -801,6 +802,8 @@ static void CALLBACK SrmmLoadToolbar() { NotifyEventHooks(hHookToolBarLoadedEvt, 0, 0); DestroyHookableEvent(hHookToolBarLoadedEvt); + + HookEvent(ME_OPT_INITIALISE, SrmmOptionsInit); } static int ConvertToolbarData(const char *szSetting, void*) @@ -817,8 +820,6 @@ void LoadSrmmToolbarModule() { CreateServiceFunction("SRMsg/BroadcastMessage", BroadcastMessage); - HookEvent(ME_OPT_INITIALISE, SrmmOptionsInit); - Miranda_WaitOnHandle(SrmmLoadToolbar); hHookButtonPressedEvt = CreateHookableEvent(ME_MSG_BUTTONPRESSED); -- cgit v1.2.3