From f34f0f4c72dd6238904f715e1c4c6025559e8821 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 10 Feb 2022 22:35:38 +0300 Subject: some fixes for #3027 --- plugins/NewEventNotify/res/resource.rc | 230 +++++++-------- plugins/NewEventNotify/src/options.cpp | 507 +++++++++++++++++++++------------ plugins/NewEventNotify/src/popup.cpp | 26 +- plugins/NewEventNotify/src/resource.h | 34 +-- plugins/NewEventNotify/src/stdafx.h | 47 +-- 5 files changed, 480 insertions(+), 364 deletions(-) diff --git a/plugins/NewEventNotify/res/resource.rc b/plugins/NewEventNotify/res/resource.rc index e8866f9698..8f31179fef 100644 --- a/plugins/NewEventNotify/res/resource.rc +++ b/plugins/NewEventNotify/res/resource.rc @@ -13,125 +13,73 @@ #undef APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources +// English (United States) resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US #pragma code_page(1252) -#endif //_WIN32 ///////////////////////////////////////////////////////////////////////////// // // Dialog // -IDD_OPT DIALOGEX 0, 0, 314, 252 +IDD_OPT_MAIN DIALOGEX 0, 0, 314, 238 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN - GROUPBOX "General options",IDC_STATIC,6,2,199,43 - CONTROL "Show entry in the Popups menu",IDC_CHKMENUITEM,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,10,11,190,10 - CONTROL "Temporarily disable event popups",IDC_CHKDISABLE,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,10,21,190,10 - CONTROL "Show preview of event in popup",IDC_CHKPREVIEW,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,10,31,190,10 - GROUPBOX "Popup options",IDC_STATIC,6,45,199,75 - LTEXT "Message",IDC_STATIC,11,65,44,13 - LTEXT "File",IDC_STATIC,11,91,44,13 - LTEXT "Others",IDC_STATIC,12,104,44,13 - LTEXT "Text",IDC_STATIC,56,54,23,8 - CONTROL "",IDC_COLTEXT_MESSAGE,"ColourPicker",WS_TABSTOP,56,65, - 24,13 - CONTROL "",IDC_COLTEXT_FILE,"ColourPicker",WS_TABSTOP,56,89,24, - 13 - CONTROL "",IDC_COLTEXT_OTHERS,"ColourPicker",WS_TABSTOP,56,101, - 24,13 - LTEXT "Background",IDC_STATIC,86,54,44,8 - CONTROL "",IDC_COLBACK_MESSAGE,"ColourPicker",WS_TABSTOP,86,65, - 24,13 - CONTROL "",IDC_COLBACK_FILE,"ColourPicker",WS_TABSTOP,86,89,24, - 13 - CONTROL "",IDC_COLBACK_OTHERS,"ColourPicker",WS_TABSTOP,86,101, - 24,13 - CONTROL "",IDC_CHKDEFAULTCOL_MESSAGE,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,133,65,11,10 - CONTROL "",IDC_CHKDEFAULTCOL_FILE,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,133,91,11,10 - CONTROL "",IDC_CHKDEFAULTCOL_OTHERS,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,133,103,11,10 - CTEXT "Timeout",IDC_STATIC,144,52,56,10 - EDITTEXT IDC_DELAY_MESSAGE,155,62,26,13,ES_AUTOHSCROLL | - ES_NUMBER - EDITTEXT IDC_DELAY_FILE,155,88,26,13,ES_AUTOHSCROLL | ES_NUMBER - EDITTEXT IDC_DELAY_OTHERS,155,101,26,13,ES_AUTOHSCROLL | - ES_NUMBER - CONTROL "",IDC_CHKINFINITE_MESSAGE,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,185,65,11,10 - CONTROL "",IDC_CHKINFINITE_FILE,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,185,91,11,10 - CONTROL "",IDC_CHKINFINITE_OTHERS,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,185,103,11,10 - GROUPBOX "Notify me of...",IDC_STATIC,208,2,100,56 - CONTROL "Message",IDC_CHKNOTIFY_MESSAGE,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,212,11,90,10 - CONTROL "File",IDC_CHKNOTIFY_FILE,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,212,33,90,10 - CONTROL "Others",IDC_CHKNOTIFY_OTHER,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,212,44,90,10 - GROUPBOX "Left click actions",IDC_STATIC,208,58,100,44 - CONTROL "Dismiss popup",IDC_CHKACTL_DISMISS,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,212,67,90,10 - CONTROL "Open event",IDC_CHKACTL_OPEN,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,212,78,90,10 - CONTROL "Dismiss event",IDC_CHKACTL_REMOVE,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,212,89,90,10 - GROUPBOX "Right click actions",IDC_STATIC,208,102,100,44 - CONTROL "Dismiss popup",IDC_CHKACTR_DISMISS,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,212,111,90,10 - CONTROL "Open event",IDC_CHKACTR_OPEN,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,212,122,90,10 - CONTROL "Dismiss event",IDC_CHKACTR_REMOVE,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,212,133,90,10 - GROUPBOX "Timeout actions",IDC_STATIC,208,147,100,44 - CONTROL "Dismiss popup",IDC_CHKACTTE_DISMISS,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,212,156,90,10 - CONTROL "Open event",IDC_CHKACTTE_OPEN,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,212,167,90,10 - CONTROL "Dismiss event",IDC_CHKACTTE_REMOVE,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,212,178,90,10 - GROUPBOX "Message event only",IDC_STATIC,6,120,199,131 - CONTROL "Don't show popup when message dialog is already open", - IDC_CHKWINDOWCHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, - 10,129,192,10 + CONTROL "",IDC_OPT_TREE,"SysTreeView32",TVS_DISABLEDRAGDROP | WS_BORDER | WS_HSCROLL | WS_TABSTOP,10,0,298,138 + GROUPBOX "Popup options",IDC_STATIC,7,139,298,79 + LTEXT "Text",IDC_STATIC,93,145,23,8 + LTEXT "Background",IDC_STATIC,142,145,44,8 + CTEXT "Timeout",IDC_STATIC,200,145,56,8 + LTEXT "Message",IDC_STATIC,13,158,44,8 + CONTROL "",IDC_COLTEXT_MESSAGE,"ColourPicker",WS_TABSTOP,93,157,39,11 + CONTROL "",IDC_COLBACK_MESSAGE,"ColourPicker",WS_TABSTOP,142,157,39,11 + CONTROL "",IDC_CHKDEFAULTCOL_MESSAGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,190,158,11,10 + EDITTEXT IDC_DELAY_MESSAGE,212,155,26,12,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_CHKINFINITE_MESSAGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,258,158,11,10 + LTEXT "File",IDC_STATIC,13,172,44,8 + CONTROL "",IDC_COLTEXT_FILE,"ColourPicker",WS_TABSTOP,93,171,39,11 + CONTROL "",IDC_COLBACK_FILE,"ColourPicker",WS_TABSTOP,142,171,39,11 + CONTROL "",IDC_CHKDEFAULTCOL_FILE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,190,172,11,10 + EDITTEXT IDC_DELAY_FILE,212,170,26,12,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_CHKINFINITE_FILE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,258,172,11,10 + LTEXT "Errors",IDC_STATIC,13,185,44,8 + CONTROL "",IDC_COLTEXT_ERR,"ColourPicker",WS_TABSTOP,93,185,39,11 + CONTROL "",IDC_COLBACK_ERR,"ColourPicker",WS_TABSTOP,142,185,39,11 + CONTROL "",IDC_CHKDEFAULTCOL_ERR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,190,186,11,10 + EDITTEXT IDC_DELAY_ERR,212,184,26,12,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_CHKINFINITE_ERR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,258,186,11,10 + LTEXT "Others",IDC_STATIC,13,200,44,8 + CONTROL "",IDC_COLTEXT_OTHERS,"ColourPicker",WS_TABSTOP,93,199,39,11 + CONTROL "",IDC_COLBACK_OTHERS,"ColourPicker",WS_TABSTOP,142,199,39,11 + CONTROL "",IDC_CHKDEFAULTCOL_OTHERS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,190,200,11,10 + EDITTEXT IDC_DELAY_OTHERS,212,198,26,12,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_CHKINFINITE_OTHERS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,258,200,11,10 + PUSHBUTTON "Preview",IDC_PREVIEW,245,222,60,12 +END + +IDD_OPT_MESSAGE DIALOGEX 0, 0, 314, 252 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + CONTROL "Don't show popup when message dialog is already open",IDC_CHKWINDOWCHECK, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,8,297,10 CONTROL "Hide popup when sending new message",IDC_CHKHIDESEND, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,138,192,10 - CONTROL "Open reply dialog instead of reading the message", - IDC_CHKREPLYWINDOW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, - 10,147,192,10 - CONTROL "Merge popups from one user",IDC_CHKMERGEPOPUP,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,10,157,192,10 - PUSHBUTTON "Preview",IDC_PREVIEW,228,204,60,12 - CONTROL "Show date",IDC_CHKSHOWDATE,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,20,166,84,10 - CONTROL "Show time",IDC_CHKSHOWTIME,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,20,176,84,10 - CONTROL "Show headers",IDC_CHKSHOWHEADERS,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,20,186,84,10 - LTEXT "Number of begin shown messages",IDC_LBNUMBERMSG,20,195, - 143,8 - EDITTEXT IDC_NUMBERMSG,171,192,26,13,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "Last message display first",IDC_RDNEW,"Button", - BS_AUTORADIOBUTTON,19,205,107,9 - CONTROL "Last message display last",IDC_RDOLD,"Button", - BS_AUTORADIOBUTTON,19,216,111,9 - PUSHBUTTON "Edit",IDC_CMDEDITHEADERS,107,185,36,11 - CONTROL "No popups for RSS contacts",IDC_SUPRESSRSS,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,10,227,192,10 - CONTROL "No popups for read messages",IDC_READCHECK,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,10,237,192,10 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,20,297,10 + CONTROL "Open reply dialog instead of reading the message",IDC_CHKREPLYWINDOW, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,32,297,11 + CONTROL "Merge popups from one user",IDC_CHKMERGEPOPUP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,63,295,10 + CONTROL "Show date",IDC_CHKSHOWDATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,74,227,10 + CONTROL "Show time",IDC_CHKSHOWTIME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,85,214,10 + CONTROL "Show headers",IDC_CHKSHOWHEADERS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,96,220,10 + LTEXT "Number of begin shown messages",IDC_LBNUMBERMSG,15,109,143,8 + EDITTEXT IDC_NUMBERMSG,166,107,48,13,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "Last message display first",IDC_RDNEW,"Button",BS_AUTORADIOBUTTON,14,120,253,9 + CONTROL "Last message display last",IDC_RDOLD,"Button",BS_AUTORADIOBUTTON,14,131,285,9 END @@ -161,20 +109,76 @@ END // #ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO +GUIDELINES DESIGNINFO BEGIN - IDD_OPT, DIALOG + IDD_OPT_MAIN, DIALOG + BEGIN + END + + IDD_OPT_MESSAGE, DIALOG BEGIN - LEFTMARGIN, 0 - RIGHTMARGIN, 308 - VERTGUIDE, 10 - TOPMARGIN, 0 - BOTTOMMARGIN, 252 - HORZGUIDE, 250 END END #endif // APSTUDIO_INVOKED -#endif // English (U.S.) resources + +///////////////////////////////////////////////////////////////////////////// +// +// AFX_DIALOG_LAYOUT +// + +IDD_OPT AFX_DIALOG_LAYOUT +BEGIN + 0 +END + +IDD_OPT_MAIN AFX_DIALOG_LAYOUT +BEGIN + 0 +END + +IDD_OPT_MESSAGE AFX_DIALOG_LAYOUT +BEGIN + 0 +END + +#endif // English (United States) resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// English (United Kingdom) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK +#pragma code_page(1252) + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + +#endif // English (United Kingdom) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + ///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED diff --git a/plugins/NewEventNotify/src/options.cpp b/plugins/NewEventNotify/src/options.cpp index d004a1cfb7..3b0d19c98f 100644 --- a/plugins/NewEventNotify/src/options.cpp +++ b/plugins/NewEventNotify/src/options.cpp @@ -24,8 +24,6 @@ #include "stdafx.h" -BOOL bWmNotify; - void CMPlugin::OptionsRead(void) { bDisable = getBool(OPT_DISABLE, false); @@ -36,25 +34,32 @@ void CMPlugin::OptionsRead(void) bMergePopup = getBool(OPT_MERGEPOPUP, true); bMsgWindowCheck = getBool(OPT_MSGWINDOWCHECK, true); bMsgReplyWindow = getBool(OPT_MSGREPLYWINDOW, false); - bDefaultColorMsg = getBool(OPT_COLDEFAULT_MESSAGE, false); - bDefaultColorFile = getBool(OPT_COLDEFAULT_FILE, false); - bDefaultColorOthers = getBool(OPT_COLDEFAULT_OTHERS, false); - - colBackMsg = getDword(OPT_COLBACK_MESSAGE, DEFAULT_COLBACK); - colTextMsg = getDword(OPT_COLTEXT_MESSAGE, DEFAULT_COLTEXT); - colBackFile = getDword(OPT_COLBACK_FILE, DEFAULT_COLBACK); - colTextFile = getDword(OPT_COLTEXT_FILE, DEFAULT_COLTEXT); - colBackOthers = getDword(OPT_COLBACK_OTHERS, DEFAULT_COLBACK); - colTextOthers = getDword(OPT_COLTEXT_OTHERS, DEFAULT_COLTEXT); - + + msg.bDefault = getBool(OPT_COLDEFAULT_MESSAGE, false); + msg.backColor = getDword(OPT_COLBACK_MESSAGE, DEFAULT_COLBACK); + msg.textColor = getDword(OPT_COLTEXT_MESSAGE, DEFAULT_COLTEXT); + msg.iDelay = getDword(OPT_DELAY_MESSAGE, DEFAULT_DELAY); + + file.bDefault = getBool(OPT_COLDEFAULT_FILE, false); + file.backColor = getDword(OPT_COLBACK_FILE, DEFAULT_COLBACK); + file.textColor = getDword(OPT_COLTEXT_FILE, DEFAULT_COLTEXT); + file.iDelay = getDword(OPT_DELAY_FILE, DEFAULT_DELAY); + + err.bDefault = getBool(OPT_COLDEFAULT_ERR, false); + err.backColor = getDword(OPT_COLBACK_ERR, DEFAULT_COLBACK); + err.textColor = getDword(OPT_COLTEXT_ERR, DEFAULT_COLTEXT); + err.iDelay = getDword(OPT_DELAY_ERR, DEFAULT_DELAY); + + other.bDefault = getBool(OPT_COLDEFAULT_OTHERS, false); + other.backColor = getDword(OPT_COLBACK_OTHERS, DEFAULT_COLBACK); + other.textColor = getDword(OPT_COLTEXT_OTHERS, DEFAULT_COLTEXT); + other.iDelay = getDword(OPT_DELAY_OTHERS, DEFAULT_DELAY); + maskNotify = getByte(OPT_MASKNOTIFY, DEFAULT_MASKNOTIFY); maskActL = getByte(OPT_MASKACTL, DEFAULT_MASKACTL); maskActR = getByte(OPT_MASKACTR, DEFAULT_MASKACTR); maskActTE = getByte(OPT_MASKACTTE, DEFAULT_MASKACTE); - iDelayMsg = getDword(OPT_DELAY_MESSAGE, DEFAULT_DELAY); - iDelayFile = getDword(OPT_DELAY_FILE, DEFAULT_DELAY); - iDelayOthers = getDword(OPT_DELAY_OTHERS, DEFAULT_DELAY); iDelayDefault = DBGetContactSettingRangedWord(NULL, "Popup", "Seconds", SETTING_LIFETIME_DEFAULT, SETTING_LIFETIME_MIN, SETTING_LIFETIME_MAX); bShowDate = getBool(OPT_SHOW_DATE, true); @@ -71,28 +76,40 @@ void CMPlugin::OptionsWrite(void) { setByte(OPT_DISABLE, bDisable); setByte(OPT_MUCDISABLE, bMUCDisable); + setByte(OPT_PREVIEW, bPreview); setByte(OPT_MENUITEM, bMenuitem); - setByte(OPT_COLDEFAULT_MESSAGE, bDefaultColorMsg); - setByte(OPT_COLDEFAULT_FILE, bDefaultColorFile); - setByte(OPT_COLDEFAULT_OTHERS, bDefaultColorOthers); - setDword(OPT_COLBACK_MESSAGE, colBackMsg); - setDword(OPT_COLTEXT_MESSAGE, colTextMsg); - setDword(OPT_COLBACK_FILE, colBackFile); - setDword(OPT_COLTEXT_FILE, colTextFile); - setDword(OPT_COLBACK_OTHERS, colBackOthers); - setDword(OPT_COLTEXT_OTHERS, colTextOthers); + setByte(OPT_MERGEPOPUP, bMergePopup); + setByte(OPT_MSGWINDOWCHECK, bMsgWindowCheck); + setByte(OPT_MSGREPLYWINDOW, bMsgReplyWindow); + + setByte(OPT_COLDEFAULT_MESSAGE, msg.bDefault); + setDword(OPT_COLBACK_MESSAGE, msg.backColor); + setDword(OPT_COLTEXT_MESSAGE, msg.textColor); + setDword(OPT_DELAY_MESSAGE, msg.iDelay); + + setByte(OPT_COLDEFAULT_FILE, file.bDefault); + setDword(OPT_COLBACK_FILE, file.backColor); + setDword(OPT_COLTEXT_FILE, file.textColor); + setDword(OPT_DELAY_FILE, file.iDelay); + + setByte(OPT_COLDEFAULT_ERR, err.bDefault); + setDword(OPT_COLBACK_ERR, err.backColor); + setDword(OPT_COLTEXT_ERR, err.textColor); + setDword(OPT_DELAY_ERR, err.iDelay); + + setByte(OPT_COLDEFAULT_OTHERS, other.bDefault); + setDword(OPT_COLBACK_OTHERS, other.backColor); + setDword(OPT_COLTEXT_OTHERS, other.textColor); + setDword(OPT_DELAY_OTHERS, other.iDelay); + setDword(OPT_LIMITPREVIEW, iLimitPreview); + setByte(OPT_MASKNOTIFY, (uint8_t)maskNotify); setByte(OPT_MASKACTL, (uint8_t)maskActL); setByte(OPT_MASKACTR, (uint8_t)maskActR); setByte(OPT_MASKACTTE, (uint8_t)maskActTE); - setByte(OPT_MSGWINDOWCHECK, bMsgWindowCheck); - setByte(OPT_MSGREPLYWINDOW, bMsgReplyWindow); - setByte(OPT_MERGEPOPUP, bMergePopup); - setDword(OPT_DELAY_MESSAGE, iDelayMsg); - setDword(OPT_DELAY_FILE, iDelayFile); - setDword(OPT_DELAY_OTHERS, iDelayOthers); + setByte(OPT_SHOW_DATE, bShowDate); setByte(OPT_SHOW_TIME, bShowTime); setByte(OPT_SHOW_HEADERS, bShowHeaders); @@ -103,180 +120,290 @@ void CMPlugin::OptionsWrite(void) setByte(OPT_READCHECK, bReadCheck); } -static void SetCheckBoxState(HWND hWnd, int iCtrl, BOOL bState) -{ - CheckDlgButton(hWnd, iCtrl, bState ? BST_CHECKED : BST_UNCHECKED); -} - static void EnableDlgItem(HWND hWnd, int iCtrl, BOOL bEnable) { EnableWindow(GetDlgItem(hWnd, iCtrl), bEnable); } -static void UpdateOptionsDlgItemsState(HWND hWnd) +///////////////////////////////////////////////////////////////////////////////////////// + +class COptionsBaseDlg : public CDlgBase { - //disable color picker when using default colors - EnableDlgItem(hWnd, IDC_COLBACK_MESSAGE, !g_plugin.bDefaultColorMsg); - EnableDlgItem(hWnd, IDC_COLTEXT_MESSAGE, !g_plugin.bDefaultColorMsg); - EnableDlgItem(hWnd, IDC_COLBACK_FILE, !g_plugin.bDefaultColorFile); - EnableDlgItem(hWnd, IDC_COLTEXT_FILE, !g_plugin.bDefaultColorFile); - EnableDlgItem(hWnd, IDC_COLBACK_OTHERS, !g_plugin.bDefaultColorOthers); - EnableDlgItem(hWnd, IDC_COLTEXT_OTHERS, !g_plugin.bDefaultColorOthers); - //disable merge messages options when is not using - EnableDlgItem(hWnd, IDC_CHKSHOWDATE, g_plugin.bMergePopup); - EnableDlgItem(hWnd, IDC_CHKSHOWTIME, g_plugin.bMergePopup); - EnableDlgItem(hWnd, IDC_CHKSHOWHEADERS, g_plugin.bMergePopup); - EnableDlgItem(hWnd, IDC_CMDEDITHEADERS, g_plugin.bMergePopup && g_plugin.bShowHeaders); - EnableDlgItem(hWnd, IDC_NUMBERMSG, g_plugin.bMergePopup); - EnableDlgItem(hWnd, IDC_LBNUMBERMSG, g_plugin.bMergePopup); - EnableDlgItem(hWnd, IDC_RDNEW, g_plugin.bMergePopup && g_plugin.iNumberMsg); - EnableDlgItem(hWnd, IDC_RDOLD, g_plugin.bMergePopup && g_plugin.iNumberMsg); - //disable delay textbox when infinite is checked - EnableDlgItem(hWnd, IDC_DELAY_MESSAGE, g_plugin.iDelayMsg != -1); - EnableDlgItem(hWnd, IDC_DELAY_FILE, g_plugin.iDelayFile != -1); - EnableDlgItem(hWnd, IDC_DELAY_OTHERS, g_plugin.iDelayOthers != -1); -} + void OnFinish(CDlgBase *) + { + g_plugin.OptionsWrite(); + MenuitemUpdate(!g_plugin.bDisable); + } + +public: + COptionsBaseDlg(int iDlg) : + CDlgBase(g_plugin, iDlg) + { + m_OnFinishWizard = Callback(this, &COptionsBaseDlg::OnFinish); + } + + void OnReset() override + { + g_plugin.OptionsRead(); + + // maybe something changed with the mi + MenuitemUpdate(!g_plugin.bDisable); + } +}; + +///////////////////////////////////////////////////////////////////////////////////////// -static INT_PTR CALLBACK OptionsDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +class COptionsMainDlg : public COptionsBaseDlg { - switch (message) { - case WM_INITDIALOG: - TranslateDialogDefault(hWnd); - //make dialog represent the current options - bWmNotify = TRUE; - SendDlgItemMessage(hWnd, IDC_COLBACK_MESSAGE, CPM_SETCOLOUR, 0, g_plugin.colBackMsg); - SendDlgItemMessage(hWnd, IDC_COLTEXT_MESSAGE, CPM_SETCOLOUR, 0, g_plugin.colTextMsg); - SendDlgItemMessage(hWnd, IDC_COLBACK_FILE, CPM_SETCOLOUR, 0, g_plugin.colBackFile); - SendDlgItemMessage(hWnd, IDC_COLTEXT_FILE, CPM_SETCOLOUR, 0, g_plugin.colTextFile); - SendDlgItemMessage(hWnd, IDC_COLBACK_OTHERS, CPM_SETCOLOUR, 0, g_plugin.colBackOthers); - SendDlgItemMessage(hWnd, IDC_COLTEXT_OTHERS, CPM_SETCOLOUR, 0, g_plugin.colTextOthers); - SetCheckBoxState(hWnd, IDC_CHKDEFAULTCOL_MESSAGE, g_plugin.bDefaultColorMsg); - SetCheckBoxState(hWnd, IDC_CHKDEFAULTCOL_FILE, g_plugin.bDefaultColorFile); - SetCheckBoxState(hWnd, IDC_CHKDEFAULTCOL_OTHERS, g_plugin.bDefaultColorOthers); - SetCheckBoxState(hWnd, IDC_CHKMENUITEM, g_plugin.bMenuitem); - SetCheckBoxState(hWnd, IDC_CHKDISABLE, g_plugin.bDisable); - SetCheckBoxState(hWnd, IDC_CHKPREVIEW, g_plugin.bPreview); - SetCheckBoxState(hWnd, IDC_CHKMERGEPOPUP, g_plugin.bMergePopup); - SetCheckBoxState(hWnd, IDC_CHKNOTIFY_MESSAGE, g_plugin.maskNotify & MASK_MESSAGE); - SetCheckBoxState(hWnd, IDC_CHKNOTIFY_FILE, g_plugin.maskNotify & MASK_FILE); - SetCheckBoxState(hWnd, IDC_CHKNOTIFY_OTHER, g_plugin.maskNotify & MASK_OTHER); - SetCheckBoxState(hWnd, IDC_CHKACTL_DISMISS, g_plugin.maskActL & MASK_DISMISS); - SetCheckBoxState(hWnd, IDC_CHKACTL_OPEN, g_plugin.maskActL & MASK_OPEN); - SetCheckBoxState(hWnd, IDC_CHKACTL_REMOVE, g_plugin.maskActL & MASK_REMOVE); - SetCheckBoxState(hWnd, IDC_CHKACTR_DISMISS, g_plugin.maskActR & MASK_DISMISS); - SetCheckBoxState(hWnd, IDC_CHKACTR_OPEN, g_plugin.maskActR & MASK_OPEN); - SetCheckBoxState(hWnd, IDC_CHKACTR_REMOVE, g_plugin.maskActR & MASK_REMOVE); - SetCheckBoxState(hWnd, IDC_CHKACTTE_DISMISS, g_plugin.maskActTE & MASK_DISMISS); - SetCheckBoxState(hWnd, IDC_CHKACTTE_OPEN, g_plugin.maskActTE & MASK_OPEN); - SetCheckBoxState(hWnd, IDC_CHKACTTE_REMOVE, g_plugin.maskActTE & MASK_REMOVE); - SetCheckBoxState(hWnd, IDC_CHKWINDOWCHECK, g_plugin.bMsgWindowCheck); - SetCheckBoxState(hWnd, IDC_CHKREPLYWINDOW, g_plugin.bMsgReplyWindow); - SetCheckBoxState(hWnd, IDC_CHKSHOWDATE, g_plugin.bShowDate); - SetCheckBoxState(hWnd, IDC_CHKSHOWTIME, g_plugin.bShowTime); - SetCheckBoxState(hWnd, IDC_CHKSHOWHEADERS, g_plugin.bShowHeaders); - SetCheckBoxState(hWnd, IDC_RDNEW, !g_plugin.bShowON); - SetCheckBoxState(hWnd, IDC_RDOLD, g_plugin.bShowON); - SetCheckBoxState(hWnd, IDC_CHKHIDESEND, g_plugin.bHideSend); - SetCheckBoxState(hWnd, IDC_SUPRESSRSS, g_plugin.bNoRSS); - SetCheckBoxState(hWnd, IDC_READCHECK, g_plugin.bReadCheck); - SetCheckBoxState(hWnd, IDC_CHKINFINITE_MESSAGE, g_plugin.iDelayMsg == -1); - SetCheckBoxState(hWnd, IDC_CHKINFINITE_FILE, g_plugin.iDelayFile == -1); - SetCheckBoxState(hWnd, IDC_CHKINFINITE_OTHERS, g_plugin.iDelayOthers == -1); - SetDlgItemInt(hWnd, IDC_DELAY_MESSAGE, g_plugin.iDelayMsg != -1 ? g_plugin.iDelayMsg : 0, TRUE); - SetDlgItemInt(hWnd, IDC_DELAY_FILE, g_plugin.iDelayFile != -1 ? g_plugin.iDelayFile : 0, TRUE); - SetDlgItemInt(hWnd, IDC_DELAY_OTHERS, g_plugin.iDelayOthers != -1 ? g_plugin.iDelayOthers : 0, TRUE); - SetDlgItemInt(hWnd, IDC_NUMBERMSG, g_plugin.iNumberMsg, FALSE); - //update items' states - UpdateOptionsDlgItemsState(hWnd); - bWmNotify = FALSE; - return TRUE; - - case WM_COMMAND: - if (!bWmNotify) { - switch (LOWORD(wParam)) { - case IDC_PREVIEW: - PopupPreview(); - break; - default: - //update options - g_plugin.maskNotify = (IsDlgButtonChecked(hWnd, IDC_CHKNOTIFY_MESSAGE) ? MASK_MESSAGE : 0) | - (IsDlgButtonChecked(hWnd, IDC_CHKNOTIFY_FILE) ? MASK_FILE : 0) | - (IsDlgButtonChecked(hWnd, IDC_CHKNOTIFY_OTHER) ? MASK_OTHER : 0); - g_plugin.maskActL = (IsDlgButtonChecked(hWnd, IDC_CHKACTL_DISMISS) ? MASK_DISMISS : 0) | - (IsDlgButtonChecked(hWnd, IDC_CHKACTL_OPEN) ? MASK_OPEN : 0) | - (IsDlgButtonChecked(hWnd, IDC_CHKACTL_REMOVE) ? MASK_REMOVE : 0); - g_plugin.maskActR = (IsDlgButtonChecked(hWnd, IDC_CHKACTR_DISMISS) ? MASK_DISMISS : 0) | - (IsDlgButtonChecked(hWnd, IDC_CHKACTR_OPEN) ? MASK_OPEN : 0) | - (IsDlgButtonChecked(hWnd, IDC_CHKACTR_REMOVE) ? MASK_REMOVE : 0); - g_plugin.maskActTE = (IsDlgButtonChecked(hWnd, IDC_CHKACTTE_DISMISS) ? MASK_DISMISS : 0) | - (IsDlgButtonChecked(hWnd, IDC_CHKACTTE_OPEN) ? MASK_OPEN : 0) | - (IsDlgButtonChecked(hWnd, IDC_CHKACTTE_REMOVE) ? MASK_REMOVE : 0); - g_plugin.bDefaultColorMsg = IsDlgButtonChecked(hWnd, IDC_CHKDEFAULTCOL_MESSAGE); - g_plugin.bDefaultColorFile = IsDlgButtonChecked(hWnd, IDC_CHKDEFAULTCOL_FILE); - g_plugin.bDefaultColorOthers = IsDlgButtonChecked(hWnd, IDC_CHKDEFAULTCOL_OTHERS); - g_plugin.bMenuitem = IsDlgButtonChecked(hWnd, IDC_CHKMENUITEM); - g_plugin.bDisable = IsDlgButtonChecked(hWnd, IDC_CHKDISABLE); - g_plugin.bPreview = IsDlgButtonChecked(hWnd, IDC_CHKPREVIEW); - g_plugin.iDelayMsg = IsDlgButtonChecked(hWnd, IDC_CHKINFINITE_MESSAGE) ? -1 : (uint32_t)GetDlgItemInt(hWnd, IDC_DELAY_MESSAGE, nullptr, FALSE); - g_plugin.iDelayFile = IsDlgButtonChecked(hWnd, IDC_CHKINFINITE_FILE) ? -1 : (uint32_t)GetDlgItemInt(hWnd, IDC_DELAY_FILE, nullptr, FALSE); - g_plugin.iDelayOthers = IsDlgButtonChecked(hWnd, IDC_CHKINFINITE_OTHERS) ? -1 : (uint32_t)GetDlgItemInt(hWnd, IDC_DELAY_OTHERS, nullptr, FALSE); - g_plugin.bMergePopup = IsDlgButtonChecked(hWnd, IDC_CHKMERGEPOPUP); - g_plugin.bMsgWindowCheck = IsDlgButtonChecked(hWnd, IDC_CHKWINDOWCHECK); - g_plugin.bMsgReplyWindow = IsDlgButtonChecked(hWnd, IDC_CHKREPLYWINDOW); - g_plugin.bShowDate = IsDlgButtonChecked(hWnd, IDC_CHKSHOWDATE); - g_plugin.bShowTime = IsDlgButtonChecked(hWnd, IDC_CHKSHOWTIME); - g_plugin.bShowHeaders = IsDlgButtonChecked(hWnd, IDC_CHKSHOWHEADERS); - g_plugin.bShowON = IsDlgButtonChecked(hWnd, IDC_RDOLD); - g_plugin.bShowON = BST_UNCHECKED == IsDlgButtonChecked(hWnd, IDC_RDNEW); - g_plugin.bHideSend = IsDlgButtonChecked(hWnd, IDC_CHKHIDESEND); - g_plugin.iNumberMsg = GetDlgItemInt(hWnd, IDC_NUMBERMSG, nullptr, FALSE); - g_plugin.bNoRSS = IsDlgButtonChecked(hWnd, IDC_SUPRESSRSS); - g_plugin.bReadCheck = IsDlgButtonChecked(hWnd, IDC_READCHECK); - //update items' states - UpdateOptionsDlgItemsState(hWnd); - if (HIWORD(wParam) == CPN_COLOURCHANGED) { - g_plugin.colBackMsg = SendDlgItemMessage(hWnd, IDC_COLBACK_MESSAGE, CPM_GETCOLOUR, 0, 0); - g_plugin.colTextMsg = SendDlgItemMessage(hWnd, IDC_COLTEXT_MESSAGE, CPM_GETCOLOUR, 0, 0); - g_plugin.colBackFile = SendDlgItemMessage(hWnd, IDC_COLBACK_FILE, CPM_GETCOLOUR, 0, 0); - g_plugin.colTextFile = SendDlgItemMessage(hWnd, IDC_COLTEXT_FILE, CPM_GETCOLOUR, 0, 0); - g_plugin.colBackOthers = SendDlgItemMessage(hWnd, IDC_COLBACK_OTHERS, CPM_GETCOLOUR, 0, 0); - g_plugin.colTextOthers = SendDlgItemMessage(hWnd, IDC_COLTEXT_OTHERS, CPM_GETCOLOUR, 0, 0); - } - //send changes to mi - MenuitemUpdate(!g_plugin.bDisable); - //enable "Apply" button - SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0); - break; - } - } - break; - - case WM_NOTIFY: - switch (((LPNMHDR)lParam)->code) { - case PSN_APPLY: - g_plugin.OptionsWrite(); - break; - - case PSN_RESET: - g_plugin.OptionsRead(); - - //maybe something changed with the mi - MenuitemUpdate(!g_plugin.bDisable); - break; - } - break; + CCtrlCheck chkDefaultColorMsg, chkDefaultColorFile, chkDefaultColorErr, chkDefaultColorOthers; + CCtrlColor clrBackMessage, clrTextMessage, clrBackFile, clrTextFile, clrBackErr, clrTextErr, clrBackOther, clrTextOther; + CCtrlButton btnPreview; + CCtrlTreeOpts m_opts; + + void GrabData() + { + m_opts.OnApply(); + + // update options + g_plugin.msg.bDefault = IsDlgButtonChecked(m_hwnd, IDC_CHKDEFAULTCOL_MESSAGE); + g_plugin.msg.backColor = clrBackMessage.GetColor(); + g_plugin.msg.textColor = clrTextMessage.GetColor(); + g_plugin.msg.iDelay = IsDlgButtonChecked(m_hwnd, IDC_CHKINFINITE_MESSAGE) ? -1 : (uint32_t)GetDlgItemInt(m_hwnd, IDC_DELAY_MESSAGE, nullptr, FALSE); + + g_plugin.file.bDefault = IsDlgButtonChecked(m_hwnd, IDC_CHKDEFAULTCOL_FILE); + g_plugin.file.backColor = clrBackFile.GetColor(); + g_plugin.file.textColor = clrBackFile.GetColor(); + g_plugin.file.iDelay = IsDlgButtonChecked(m_hwnd, IDC_CHKINFINITE_FILE) ? -1 : (uint32_t)GetDlgItemInt(m_hwnd, IDC_DELAY_FILE, nullptr, FALSE); + + g_plugin.err.bDefault = IsDlgButtonChecked(m_hwnd, IDC_CHKDEFAULTCOL_ERR); + g_plugin.err.backColor = clrBackErr.GetColor(); + g_plugin.err.textColor = clrTextErr.GetColor(); + g_plugin.err.iDelay = IsDlgButtonChecked(m_hwnd, IDC_CHKINFINITE_ERR) ? -1 : (uint32_t)GetDlgItemInt(m_hwnd, IDC_DELAY_ERR, nullptr, FALSE); + + g_plugin.other.bDefault = IsDlgButtonChecked(m_hwnd, IDC_CHKDEFAULTCOL_OTHERS); + g_plugin.other.backColor = clrBackOther.GetColor(); + g_plugin.other.textColor = clrTextOther.GetColor(); + g_plugin.other.iDelay = IsDlgButtonChecked(m_hwnd, IDC_CHKINFINITE_OTHERS) ? -1 : (uint32_t)GetDlgItemInt(m_hwnd, IDC_DELAY_OTHERS, nullptr, FALSE); } - return FALSE; -} + +public: + COptionsMainDlg() : + COptionsBaseDlg(IDD_OPT_MAIN), + m_opts(this, IDC_OPT_TREE), + btnPreview(this, IDC_PREVIEW), + clrBackMessage(this, IDC_COLBACK_MESSAGE), + clrTextMessage(this, IDC_COLTEXT_MESSAGE), + clrBackFile(this, IDC_COLBACK_FILE), + clrTextFile(this, IDC_COLTEXT_FILE), + clrBackErr(this, IDC_COLBACK_ERR), + clrTextErr(this, IDC_COLTEXT_ERR), + clrBackOther(this, IDC_COLBACK_OTHERS), + clrTextOther(this, IDC_COLTEXT_OTHERS), + chkDefaultColorMsg(this, IDC_CHKDEFAULTCOL_MESSAGE), + chkDefaultColorFile(this, IDC_CHKDEFAULTCOL_FILE), + chkDefaultColorErr(this, IDC_CHKDEFAULTCOL_ERR), + chkDefaultColorOthers(this, IDC_CHKDEFAULTCOL_OTHERS) + { + auto *pwszSection = TranslateT("General options"); + m_opts.AddOption(pwszSection, TranslateT("Show entry in the Popups menu"), g_plugin.bMenuitem); + m_opts.AddOption(pwszSection, TranslateT("Temporarily disable event popups"), g_plugin.bDisable); + m_opts.AddOption(pwszSection, TranslateT("Show preview of event in popup"), g_plugin.bPreview); + + pwszSection = TranslateT("Notify me of..."); + m_opts.AddOption(pwszSection, TranslateT("Message"), g_plugin.maskNotify, MASK_MESSAGE); + m_opts.AddOption(pwszSection, TranslateT("File"), g_plugin.maskNotify, MASK_FILE); + m_opts.AddOption(pwszSection, TranslateT("Others"), g_plugin.maskNotify, MASK_OTHER); + + pwszSection = TranslateT("Left click actions"); + m_opts.AddOption(pwszSection, TranslateT("Dismiss popup"), g_plugin.maskActL, MASK_DISMISS); + m_opts.AddOption(pwszSection, TranslateT("Open event"), g_plugin.maskActL, MASK_OPEN); + m_opts.AddOption(pwszSection, TranslateT("Dismiss event"), g_plugin.maskActL, MASK_REMOVE); + + pwszSection = TranslateT("Right click actions"); + m_opts.AddOption(pwszSection, TranslateT("Dismiss popup"), g_plugin.maskActL, MASK_DISMISS); + m_opts.AddOption(pwszSection, TranslateT("Open event"), g_plugin.maskActL, MASK_OPEN); + m_opts.AddOption(pwszSection, TranslateT("Dismiss event"), g_plugin.maskActL, MASK_REMOVE); + + pwszSection = TranslateT("Timeout actions"); + m_opts.AddOption(pwszSection, TranslateT("Dismiss popup"), g_plugin.maskActTE, MASK_DISMISS); + m_opts.AddOption(pwszSection, TranslateT("Open event"), g_plugin.maskActTE, MASK_OPEN); + m_opts.AddOption(pwszSection, TranslateT("Dismiss event"), g_plugin.maskActTE, MASK_REMOVE); + + pwszSection = TranslateT("Misc options"); + m_opts.AddOption(pwszSection, TranslateT("No popups for RSS contacts"), g_plugin.bNoRSS); + m_opts.AddOption(pwszSection, TranslateT("No popups for read messages"), g_plugin.bReadCheck); + + btnPreview.OnClick = Callback(this, &COptionsMainDlg::onClick_Preview); + + chkDefaultColorMsg.OnChange = Callback(this, &COptionsMainDlg::onChange_DefaultMsg); + chkDefaultColorFile.OnChange = Callback(this, &COptionsMainDlg::onChange_DefaultFile); + chkDefaultColorErr.OnChange = Callback(this, &COptionsMainDlg::onChange_DefaultErr); + chkDefaultColorOthers.OnChange = Callback(this, &COptionsMainDlg::onChange_DefaultOther); + } + + bool OnInitDialog() override + { + // make dialog represent the current options + clrBackMessage.SetColor(g_plugin.msg.backColor); + clrTextMessage.SetColor(g_plugin.msg.textColor); + clrBackFile.SetColor(g_plugin.file.backColor); + clrTextFile.SetColor(g_plugin.file.textColor); + clrBackErr.SetColor(g_plugin.err.backColor); + clrTextErr.SetColor(g_plugin.err.textColor); + clrBackOther.SetColor(g_plugin.other.backColor); + clrTextOther.SetColor(g_plugin.other.textColor); + + chkDefaultColorMsg.SetState(g_plugin.msg.bDefault); + chkDefaultColorFile.SetState(g_plugin.file.bDefault); + chkDefaultColorErr.SetState(g_plugin.err.bDefault); + chkDefaultColorOthers.SetState(g_plugin.other.bDefault); + + CheckDlgButton(m_hwnd, IDC_CHKINFINITE_MESSAGE, g_plugin.msg.iDelay == -1); + CheckDlgButton(m_hwnd, IDC_CHKINFINITE_FILE, g_plugin.file.iDelay == -1); + CheckDlgButton(m_hwnd, IDC_CHKINFINITE_ERR, g_plugin.err.iDelay == -1); + CheckDlgButton(m_hwnd, IDC_CHKINFINITE_OTHERS, g_plugin.other.iDelay == -1); + + SetDlgItemInt(m_hwnd, IDC_DELAY_MESSAGE, g_plugin.msg.iDelay != -1 ? g_plugin.msg.iDelay : 0, TRUE); + SetDlgItemInt(m_hwnd, IDC_DELAY_FILE, g_plugin.file.iDelay != -1 ? g_plugin.file.iDelay : 0, TRUE); + SetDlgItemInt(m_hwnd, IDC_DELAY_ERR, g_plugin.err.iDelay != -1 ? g_plugin.err.iDelay : 0, TRUE); + SetDlgItemInt(m_hwnd, IDC_DELAY_OTHERS, g_plugin.other.iDelay != -1 ? g_plugin.other.iDelay : 0, TRUE); + + OnChange(); + return true; + } + + bool OnApply() override + { + GrabData(); + return true; + } + + void OnChange() override + { + GrabData(); + + // disable delay textbox when infinite is checked + EnableDlgItem(m_hwnd, IDC_DELAY_MESSAGE, g_plugin.msg.iDelay != -1); + EnableDlgItem(m_hwnd, IDC_DELAY_FILE, g_plugin.file.iDelay != -1); + EnableDlgItem(m_hwnd, IDC_DELAY_ERR, g_plugin.err.iDelay != -1); + EnableDlgItem(m_hwnd, IDC_DELAY_OTHERS, g_plugin.other.iDelay != -1); + } + + void onClick_Preview(CCtrlButton *) + { + GrabData(); + PopupShow(0, 0, EVENTTYPE_MESSAGE); + PopupShow(0, 0, EVENTTYPE_FILE); + PopupShow(0, 0, -1); + } + + void onChange_DefaultMsg(CCtrlCheck *) + { + bool bEnabled = chkDefaultColorMsg.GetState(); + clrBackMessage.Enable(!bEnabled); + clrTextMessage.Enable(!bEnabled); + } + + void onChange_DefaultFile(CCtrlCheck *) + { + bool bEnabled = chkDefaultColorFile.GetState(); + clrBackFile.Enable(!bEnabled); + clrTextFile.Enable(!bEnabled); + } + + void onChange_DefaultErr(CCtrlCheck *) + { + bool bEnabled = chkDefaultColorErr.GetState(); + clrBackErr.Enable(!bEnabled); + clrTextErr.Enable(!bEnabled); + } + + void onChange_DefaultOther(CCtrlCheck *) + { + bool bEnabled = chkDefaultColorOthers.GetState(); + clrBackOther.Enable(!bEnabled); + clrTextOther.Enable(!bEnabled); + } +}; + +///////////////////////////////////////////////////////////////////////////////////////// + +class COptionsMessageDlg : public COptionsBaseDlg +{ + void GrabData() + { + g_plugin.bMergePopup = IsDlgButtonChecked(m_hwnd, IDC_CHKMERGEPOPUP); + g_plugin.bMsgWindowCheck = IsDlgButtonChecked(m_hwnd, IDC_CHKWINDOWCHECK); + g_plugin.bMsgReplyWindow = IsDlgButtonChecked(m_hwnd, IDC_CHKREPLYWINDOW); + g_plugin.bShowDate = IsDlgButtonChecked(m_hwnd, IDC_CHKSHOWDATE); + g_plugin.bShowTime = IsDlgButtonChecked(m_hwnd, IDC_CHKSHOWTIME); + g_plugin.bShowHeaders = IsDlgButtonChecked(m_hwnd, IDC_CHKSHOWHEADERS); + g_plugin.bShowON = IsDlgButtonChecked(m_hwnd, IDC_RDOLD); + g_plugin.bShowON = BST_UNCHECKED == IsDlgButtonChecked(m_hwnd, IDC_RDNEW); + g_plugin.bHideSend = IsDlgButtonChecked(m_hwnd, IDC_CHKHIDESEND); + g_plugin.iNumberMsg = GetDlgItemInt(m_hwnd, IDC_NUMBERMSG, nullptr, FALSE); + } + +public: + COptionsMessageDlg() : + COptionsBaseDlg(IDD_OPT_MESSAGE) + {} + + bool OnInitDialog() override + { + CheckDlgButton(m_hwnd, IDC_CHKMERGEPOPUP, g_plugin.bMergePopup); + CheckDlgButton(m_hwnd, IDC_CHKWINDOWCHECK, g_plugin.bMsgWindowCheck); + CheckDlgButton(m_hwnd, IDC_CHKREPLYWINDOW, g_plugin.bMsgReplyWindow); + CheckDlgButton(m_hwnd, IDC_CHKSHOWDATE, g_plugin.bShowDate); + CheckDlgButton(m_hwnd, IDC_CHKSHOWTIME, g_plugin.bShowTime); + CheckDlgButton(m_hwnd, IDC_CHKSHOWHEADERS, g_plugin.bShowHeaders); + CheckDlgButton(m_hwnd, IDC_RDNEW, !g_plugin.bShowON); + CheckDlgButton(m_hwnd, IDC_RDOLD, g_plugin.bShowON); + CheckDlgButton(m_hwnd, IDC_CHKHIDESEND, g_plugin.bHideSend); + SetDlgItemInt(m_hwnd, IDC_NUMBERMSG, g_plugin.iNumberMsg, FALSE); + + OnChange(); + return true; + } + + void OnChange() override + { + GrabData(); + + // disable merge messages options when is not using + EnableDlgItem(m_hwnd, IDC_CHKSHOWDATE, g_plugin.bMergePopup); + EnableDlgItem(m_hwnd, IDC_CHKSHOWTIME, g_plugin.bMergePopup); + EnableDlgItem(m_hwnd, IDC_CHKSHOWHEADERS, g_plugin.bMergePopup); + EnableDlgItem(m_hwnd, IDC_CMDEDITHEADERS, g_plugin.bMergePopup && g_plugin.bShowHeaders); + EnableDlgItem(m_hwnd, IDC_NUMBERMSG, g_plugin.bMergePopup); + EnableDlgItem(m_hwnd, IDC_LBNUMBERMSG, g_plugin.bMergePopup); + EnableDlgItem(m_hwnd, IDC_RDNEW, g_plugin.bMergePopup && g_plugin.iNumberMsg); + EnableDlgItem(m_hwnd, IDC_RDOLD, g_plugin.bMergePopup && g_plugin.iNumberMsg); + } + + bool OnApply() override + { + GrabData(); + return true; + } +}; + +///////////////////////////////////////////////////////////////////////////////////////// +// Module entry point int OptionsAdd(WPARAM addInfo, LPARAM) { OPTIONSDIALOGPAGE odp = {}; - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT); + odp.flags = ODPF_BOLDGROUPS; odp.szTitle.a = LPGEN("Event Notify"); odp.szGroup.a = LPGEN("Popups"); - odp.flags = ODPF_BOLDGROUPS; - odp.pfnDlgProc = OptionsDlgProc; + + odp.szTab.a = LPGEN("Main"); + odp.pDialog = new COptionsMainDlg(); + g_plugin.addOptions(addInfo, &odp); + + odp.szTab.a = LPGEN("Message events"); + odp.pDialog = new COptionsMessageDlg(); g_plugin.addOptions(addInfo, &odp); return 0; } diff --git a/plugins/NewEventNotify/src/popup.cpp b/plugins/NewEventNotify/src/popup.cpp index 71bb4a55f5..f5724dfc44 100644 --- a/plugins/NewEventNotify/src/popup.cpp +++ b/plugins/NewEventNotify/src/popup.cpp @@ -359,27 +359,27 @@ int PopupShow(MCONTACT hContact, MEVENT hEvent, UINT eventType) case EVENTTYPE_MESSAGE: if (!(g_plugin.maskNotify & MASK_MESSAGE)) return 1; pudw.lchIcon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE); - pudw.colorBack = g_plugin.bDefaultColorMsg ? 0 : g_plugin.colBackMsg; - pudw.colorText = g_plugin.bDefaultColorMsg ? 0 : g_plugin.colTextMsg; - iSeconds = g_plugin.iDelayMsg; + pudw.colorBack = g_plugin.msg.bDefault ? 0 : g_plugin.msg.backColor; + pudw.colorText = g_plugin.msg.bDefault ? 0 : g_plugin.msg.textColor; + iSeconds = g_plugin.msg.iDelay; sampleEvent = TranslateT("This is a sample message event :-)"); break; case EVENTTYPE_FILE: if (!(g_plugin.maskNotify & MASK_FILE)) return 1; pudw.lchIcon = Skin_LoadIcon(SKINICON_EVENT_FILE); - pudw.colorBack = g_plugin.bDefaultColorFile ? 0 : g_plugin.colBackFile; - pudw.colorText = g_plugin.bDefaultColorFile ? 0 : g_plugin.colTextFile; - iSeconds = g_plugin.iDelayFile; + pudw.colorBack = g_plugin.file.bDefault ? 0 : g_plugin.file.backColor; + pudw.colorText = g_plugin.file.bDefault ? 0 : g_plugin.file.textColor; + iSeconds = g_plugin.file.iDelay; sampleEvent = TranslateT("This is a sample file event :-D"); break; default: if (!(g_plugin.maskNotify & MASK_OTHER)) return 1; pudw.lchIcon = Skin_LoadIcon(SKINICON_OTHER_MIRANDA); - pudw.colorBack = g_plugin.bDefaultColorOthers ? 0 : g_plugin.colBackOthers; - pudw.colorText = g_plugin.bDefaultColorOthers ? 0 : g_plugin.colTextOthers; - iSeconds = g_plugin.iDelayOthers; + pudw.colorBack = g_plugin.other.bDefault ? 0 : g_plugin.other.backColor; + pudw.colorText = g_plugin.other.bDefault ? 0 : g_plugin.other.textColor; + iSeconds = g_plugin.other.iDelay; sampleEvent = TranslateT("This is a sample other event ;-D"); break; } @@ -518,11 +518,3 @@ int PopupUpdate(MCONTACT hContact, MEVENT hEvent) PUChangeTextW(pdata->hWnd, lpzText); return 0; } - -int PopupPreview() -{ - PopupShow(0, 0, EVENTTYPE_MESSAGE); - PopupShow(0, 0, EVENTTYPE_FILE); - PopupShow(0, 0, -1); - return 0; -} diff --git a/plugins/NewEventNotify/src/resource.h b/plugins/NewEventNotify/src/resource.h index 07feaa4615..de868af136 100644 --- a/plugins/NewEventNotify/src/resource.h +++ b/plugins/NewEventNotify/src/resource.h @@ -1,28 +1,21 @@ //{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. -// Used by ..\res\resource.rc +// Used by C:\Users\georg\DiskW\miranda-ng\plugins\NewEventNotify\res\resource.rc // -#define IDD_OPT 101 +#define IDD_OPT_MAIN 101 +#define IDD_OPT_MESSAGE 102 #define IDC_PREVIEW 1000 -#define IDC_CHKNOTIFY_MESSAGE 1001 -#define IDC_CHKNOTIFY_FILE 1003 -#define IDC_CHKNOTIFY_OTHER 1004 -#define IDC_CHKMENUITEM 1005 -#define IDC_CHKDISABLE 1006 -#define IDC_CHKACTL_DISMISS 1007 -#define IDC_CHKACTL_OPEN 1008 -#define IDC_CHKACTL_REMOVE 1009 -#define IDC_CHKACTR_DISMISS 1010 -#define IDC_CHKACTR_OPEN 1011 -#define IDC_CHKACTR_REMOVE 1012 #define IDC_CHKWINDOWCHECK 1013 #define IDC_CHKREPLYWINDOW 1014 -#define IDC_CHKPREVIEW 1015 +#define IDC_DELAY_ERR 1015 #define IDC_CHKINFINITE 1016 #define IDC_CHKHIDESEND 1016 #define IDC_CHKDEFAULTCOL_MESSAGE 1017 #define IDC_COLBACK_MESSAGE 1018 #define IDC_COLTEXT_MESSAGE 1019 +#define IDC_COLBACK_ERR 1020 +#define IDC_COLTEXT_ERR 1021 +#define IDC_CHKDEFAULTCOL_ERR 1022 #define IDC_CHKDEFAULTCOL_FILE 1023 #define IDC_COLBACK_FILE 1024 #define IDC_COLTEXT_FILE 1025 @@ -32,7 +25,9 @@ #define IDC_MERGEPOPUP 1029 #define IDC_CHKINFINITE_MESSAGE 1029 #define IDC_CHKMERGEPOPUP 1030 +#define IDC_COLTEXT_MESSAGE2 1030 #define IDC_DELAY_MESSAGE 1031 +#define IDC_CHKINFINITE_ERR 1032 #define IDC_DELAY_FILE 1033 #define IDC_DELAY_OTHERS 1034 #define IDC_NUMBERMSG 1035 @@ -44,22 +39,17 @@ #define IDC_LBNUMBERMSG 1041 #define IDC_CHKINFINITE_FILE 1043 #define IDC_CHKINFINITE_OTHERS 1044 -#define IDC_CHKMERGEPOPUP2 1045 -#define IDC_SUPRESSRSS 1045 #define IDC_TESTFORREAD 1046 -#define IDC_READCHECK 1046 #define IDC_CMDEDITHEADERS 1047 -#define IDC_CHKACTTE_DISMISS 1049 -#define IDC_CHKACTTE_OPEN 1050 -#define IDC_CHKACTTE_REMOVE 1051 +#define IDC_OPT_TREE 1048 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 108 +#define _APS_NEXT_RESOURCE_VALUE 110 #define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1048 +#define _APS_NEXT_CONTROL_VALUE 1049 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/plugins/NewEventNotify/src/stdafx.h b/plugins/NewEventNotify/src/stdafx.h index 9ef71031b2..6c1a0e4527 100644 --- a/plugins/NewEventNotify/src/stdafx.h +++ b/plugins/NewEventNotify/src/stdafx.h @@ -90,15 +90,27 @@ #define OPT_PREVIEW "Preview" #define OPT_MENUITEM "MenuItem" #define OPT_LIMITPREVIEW "LimitPreview" + #define OPT_COLDEFAULT_MESSAGE "DefaultColorMsg" #define OPT_COLBACK_MESSAGE "ColorBackMsg" #define OPT_COLTEXT_MESSAGE "ColorTextMsg" +#define OPT_DELAY_MESSAGE "DelayMessage" + #define OPT_COLDEFAULT_FILE "DefaultColorFile" #define OPT_COLBACK_FILE "ColorBackFile" #define OPT_COLTEXT_FILE "ColorTextFile" +#define OPT_DELAY_FILE "DelayFile" + +#define OPT_COLDEFAULT_ERR "DefaultColorErr" +#define OPT_COLBACK_ERR "ColorBackErr" +#define OPT_COLTEXT_ERR "ColorTextErr" +#define OPT_DELAY_ERR "DelayErr" + #define OPT_COLDEFAULT_OTHERS "DefaultColorOthers" #define OPT_COLBACK_OTHERS "ColorBackOthers" #define OPT_COLTEXT_OTHERS "ColorTextOthers" +#define OPT_DELAY_OTHERS "DelayOthers" + #define OPT_MASKNOTIFY "Notify" #define OPT_MASKACTL "ActionLeft" #define OPT_MASKACTR "ActionRight" @@ -106,9 +118,6 @@ #define OPT_MSGWINDOWCHECK "WindowCheck" #define OPT_MSGREPLYWINDOW "ReplyWindow" #define OPT_MERGEPOPUP "MergePopup" -#define OPT_DELAY_MESSAGE "DelayMessage" -#define OPT_DELAY_FILE "DelayFile" -#define OPT_DELAY_OTHERS "DelayOthers" #define OPT_SHOW_DATE "ShowDate" #define OPT_SHOW_TIME "ShowTime" #define OPT_SHOW_HEADERS "ShowHeaders" @@ -149,9 +158,6 @@ struct CMPlugin : public PLUGIN bool bMUCDisable; bool bPreview; bool bMenuitem; - bool bDefaultColorMsg; - bool bDefaultColorFile; - bool bDefaultColorOthers; bool bDisableNonMessage; bool bMsgWindowCheck; bool bMsgReplyWindow; @@ -166,21 +172,19 @@ struct CMPlugin : public PLUGIN bool bReadCheck; bool bWindowCheck; - COLORREF colBackMsg; - COLORREF colTextMsg; - COLORREF colBackFile; - COLORREF colTextFile; - COLORREF colBackOthers; - COLORREF colTextOthers; - - UINT maskNotify; - UINT maskActL; - UINT maskActR; - UINT maskActTE; - - int iDelayMsg; - int iDelayFile; - int iDelayOthers; + struct + { + COLORREF backColor, textColor; + int iDelay; + bool bDefault; + + } msg, file, err, other; + + uint32_t maskNotify; + uint32_t maskActL; + uint32_t maskActR; + uint32_t maskActTE; + int iDelayDefault; int iLimitPreview; @@ -212,7 +216,6 @@ struct PLUGIN_DATA int PopupShow(MCONTACT hContact, MEVENT hEvent, UINT eventType); int PopupUpdate(MCONTACT hContact, MEVENT hEvent); -int PopupPreview(); int PopupAct(HWND hWnd, UINT mask, PLUGIN_DATA *pdata); int OptionsAdd(WPARAM addInfo, LPARAM); int Opt_DisableNEN(BOOL Status); -- cgit v1.2.3