From 4486400f900e1e7520ab88e4f8675af395e4cdc5 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 27 Feb 2022 20:35:15 +0300 Subject: NEN: added spin control to prevent entering random values into options --- plugins/NewEventNotify/src/options.cpp | 11 ++++++++--- plugins/NewEventNotify/src/resource.h | 3 ++- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'plugins/NewEventNotify/src') diff --git a/plugins/NewEventNotify/src/options.cpp b/plugins/NewEventNotify/src/options.cpp index 7fb0e21e43..0d6c566b03 100644 --- a/plugins/NewEventNotify/src/options.cpp +++ b/plugins/NewEventNotify/src/options.cpp @@ -349,8 +349,12 @@ public: class COptionsMessageDlg : public COptionsBaseDlg { + CCtrlSpin spinMsgNumber; + void GrabData() { + g_plugin.iNumberMsg = spinMsgNumber.GetPosition(); + g_plugin.bMergePopup = IsDlgButtonChecked(m_hwnd, IDC_CHKMERGEPOPUP); g_plugin.bMsgWindowCheck = IsDlgButtonChecked(m_hwnd, IDC_CHKWINDOWCHECK); g_plugin.bMsgReplyWindow = IsDlgButtonChecked(m_hwnd, IDC_CHKREPLYWINDOW); @@ -360,16 +364,18 @@ class COptionsMessageDlg : public COptionsBaseDlg 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) + COptionsBaseDlg(IDD_OPT_MESSAGE), + spinMsgNumber(this, IDC_SPIN_MSGNUMBER, 10, 1) {} bool OnInitDialog() override { + spinMsgNumber.SetPosition(g_plugin.iNumberMsg); + CheckDlgButton(m_hwnd, IDC_CHKMERGEPOPUP, g_plugin.bMergePopup); CheckDlgButton(m_hwnd, IDC_CHKWINDOWCHECK, g_plugin.bMsgWindowCheck); CheckDlgButton(m_hwnd, IDC_CHKREPLYWINDOW, g_plugin.bMsgReplyWindow); @@ -379,7 +385,6 @@ public: 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; diff --git a/plugins/NewEventNotify/src/resource.h b/plugins/NewEventNotify/src/resource.h index cc09b63989..564dd33c47 100644 --- a/plugins/NewEventNotify/src/resource.h +++ b/plugins/NewEventNotify/src/resource.h @@ -45,6 +45,7 @@ #define IDC_TESTFORREAD 1046 #define IDC_CMDEDITHEADERS 1047 #define IDC_OPT_TREE 1048 +#define IDC_SPIN_MSGNUMBER 1049 // Next default values for new objects // @@ -52,7 +53,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 110 #define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1049 +#define _APS_NEXT_CONTROL_VALUE 1050 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif -- cgit v1.2.3