From e408bf603abd2e8afa2c838a411ad52f5a6a7c92 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 1 Mar 2022 20:49:55 +0300 Subject: NEN: spin controls instead of additional checkboxes --- plugins/NewEventNotify/src/options.cpp | 40 ++++++----------- plugins/NewEventNotify/src/resource.h | 78 +++++++++++++++++----------------- 2 files changed, 53 insertions(+), 65 deletions(-) (limited to 'plugins/NewEventNotify/src') diff --git a/plugins/NewEventNotify/src/options.cpp b/plugins/NewEventNotify/src/options.cpp index 35e1b7cef4..c035cd93f1 100644 --- a/plugins/NewEventNotify/src/options.cpp +++ b/plugins/NewEventNotify/src/options.cpp @@ -155,7 +155,7 @@ public: class COptionsMainDlg : public COptionsBaseDlg { - CCtrlSpin spinLimit; + CCtrlSpin spinLimit, spinMessage, spinFile, spinErr, spinOther; CCtrlCheck chkLimit, chkDefaultColorMsg, chkDefaultColorFile, chkDefaultColorErr, chkDefaultColorOthers; CCtrlColor clrBackMessage, clrTextMessage, clrBackFile, clrTextFile, clrBackErr, clrTextErr, clrBackOther, clrTextOther; CCtrlButton btnPreview; @@ -171,22 +171,22 @@ class COptionsMainDlg : public COptionsBaseDlg 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.msg.iDelay = spinMessage.GetPosition(); g_plugin.file.bDefault = IsDlgButtonChecked(m_hwnd, IDC_CHKDEFAULTCOL_FILE); g_plugin.file.backColor = clrBackFile.GetColor(); g_plugin.file.textColor = clrTextFile.GetColor(); - g_plugin.file.iDelay = IsDlgButtonChecked(m_hwnd, IDC_CHKINFINITE_FILE) ? -1 : (uint32_t)GetDlgItemInt(m_hwnd, IDC_DELAY_FILE, nullptr, FALSE); + g_plugin.file.iDelay = spinFile.GetPosition(); 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.err.iDelay = spinErr.GetPosition(); 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); + g_plugin.other.iDelay = spinOther.GetPosition(); } public: @@ -207,7 +207,11 @@ public: chkDefaultColorErr(this, IDC_CHKDEFAULTCOL_ERR), chkDefaultColorOthers(this, IDC_CHKDEFAULTCOL_OTHERS), chkLimit(this, IDC_LIMITPREVIEW), - spinLimit(this, IDC_MESSAGEPREVIEWLIMITSPIN, 1000) + spinErr(this, IDC_SPIN_ERR, 1000, -1), + spinFile(this, IDC_SPIN_FILE, 1000, -1), + spinLimit(this, IDC_MESSAGEPREVIEWLIMITSPIN, 1000), + spinOther(this, IDC_SPIN_OTHERS, 1000, -1), + spinMessage(this, IDC_SPIN_MESSAGE, 1000, -1) { auto *pwszSection = TranslateT("General options"); m_opts.AddOption(pwszSection, TranslateT("Show entry in the Popups menu"), g_plugin.bMenuitem); @@ -269,16 +273,11 @@ public: 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); + spinMessage.SetPosition(g_plugin.msg.iDelay); + spinFile.SetPosition(g_plugin.file.iDelay); + spinErr.SetPosition(g_plugin.err.iDelay); + spinOther.SetPosition(g_plugin.other.iDelay); - 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; } @@ -289,17 +288,6 @@ public: 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(); diff --git a/plugins/NewEventNotify/src/resource.h b/plugins/NewEventNotify/src/resource.h index 564dd33c47..d44a36aa76 100644 --- a/plugins/NewEventNotify/src/resource.h +++ b/plugins/NewEventNotify/src/resource.h @@ -8,44 +8,44 @@ #define IDC_LIMITPREVIEW 1001 #define IDC_MESSAGEPREVIEWLIMIT 1002 #define IDC_MESSAGEPREVIEWLIMITSPIN 1003 -#define IDC_CHKWINDOWCHECK 1013 -#define IDC_CHKREPLYWINDOW 1014 -#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 -#define IDC_CHKDEFAULTCOL_OTHERS 1026 -#define IDC_COLBACK_OTHERS 1027 -#define IDC_COLTEXT_OTHERS 1028 -#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 -#define IDC_CHKSHOWDATE 1036 -#define IDC_CHKSHOWTIME 1037 -#define IDC_CHKSHOWHEADERS 1038 -#define IDC_RDNEW 1039 -#define IDC_RDOLD 1040 -#define IDC_LBNUMBERMSG 1041 -#define IDC_CHKINFINITE_FILE 1043 -#define IDC_CHKINFINITE_OTHERS 1044 -#define IDC_TESTFORREAD 1046 -#define IDC_CMDEDITHEADERS 1047 -#define IDC_OPT_TREE 1048 -#define IDC_SPIN_MSGNUMBER 1049 +#define IDC_CHKWINDOWCHECK 1004 +#define IDC_CHKREPLYWINDOW 1005 +#define IDC_DELAY_ERR 1006 +#define IDC_CHKINFINITE 1007 +#define IDC_CHKHIDESEND 1008 +#define IDC_CHKDEFAULTCOL_MESSAGE 1009 +#define IDC_COLBACK_MESSAGE 1010 +#define IDC_COLTEXT_MESSAGE 1011 +#define IDC_COLBACK_ERR 1012 +#define IDC_COLTEXT_ERR 1013 +#define IDC_CHKDEFAULTCOL_ERR 1014 +#define IDC_CHKDEFAULTCOL_FILE 1015 +#define IDC_COLBACK_FILE 1016 +#define IDC_COLTEXT_FILE 1017 +#define IDC_CHKDEFAULTCOL_OTHERS 1018 +#define IDC_COLBACK_OTHERS 1019 +#define IDC_COLTEXT_OTHERS 1020 +#define IDC_MERGEPOPUP 1021 +#define IDC_SPIN_MESSAGE 1022 +#define IDC_CHKMERGEPOPUP 1023 +#define IDC_COLTEXT_MESSAGE2 1024 +#define IDC_DELAY_MESSAGE 1025 +#define IDC_SPIN_ERR 1026 +#define IDC_DELAY_FILE 1027 +#define IDC_DELAY_OTHERS 1028 +#define IDC_NUMBERMSG 1029 +#define IDC_CHKSHOWDATE 1030 +#define IDC_CHKSHOWTIME 1031 +#define IDC_CHKSHOWHEADERS 1032 +#define IDC_RDNEW 1033 +#define IDC_RDOLD 1034 +#define IDC_LBNUMBERMSG 1035 +#define IDC_SPIN_FILE 1036 +#define IDC_SPIN_OTHERS 1037 +#define IDC_TESTFORREAD 1038 +#define IDC_CMDEDITHEADERS 1030 +#define IDC_OPT_TREE 1040 +#define IDC_SPIN_MSGNUMBER 1041 // Next default values for new objects // @@ -53,7 +53,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 110 #define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1050 +#define _APS_NEXT_CONTROL_VALUE 1043 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif -- cgit v1.2.3