summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2022-03-01 20:49:55 +0300
committerGeorge Hazan <ghazan@miranda.im>2022-03-01 20:49:55 +0300
commite408bf603abd2e8afa2c838a411ad52f5a6a7c92 (patch)
tree84b8c9265d6e312aaa8442989eacfbfee4fe5a99 /plugins
parent7213d3ecea3157b42f82964a4e6b89f241e8462b (diff)
NEN: spin controls instead of additional checkboxes
Diffstat (limited to 'plugins')
-rw-r--r--plugins/NewEventNotify/res/resource.rc34
-rw-r--r--plugins/NewEventNotify/src/options.cpp40
-rw-r--r--plugins/NewEventNotify/src/resource.h78
3 files changed, 70 insertions, 82 deletions
diff --git a/plugins/NewEventNotify/res/resource.rc b/plugins/NewEventNotify/res/resource.rc
index b164f67480..ab1cef6785 100644
--- a/plugins/NewEventNotify/res/resource.rc
+++ b/plugins/NewEventNotify/res/resource.rc
@@ -39,29 +39,29 @@ BEGIN
LTEXT "Background",IDC_STATIC,142,149,44,8
CTEXT "Timeout",IDC_STATIC,200,149,56,8
LTEXT "Message",IDC_STATIC,13,162,44,8
- CONTROL "",IDC_COLTEXT_MESSAGE,"ColourPicker",WS_TABSTOP,93,161,39,11
- CONTROL "",IDC_COLBACK_MESSAGE,"ColourPicker",WS_TABSTOP,142,161,39,11
- CONTROL "",IDC_CHKDEFAULTCOL_MESSAGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,190,162,11,10
- EDITTEXT IDC_DELAY_MESSAGE,212,159,26,12,ES_AUTOHSCROLL | ES_NUMBER
- CONTROL "",IDC_CHKINFINITE_MESSAGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,258,162,11,10
+ CONTROL "",IDC_COLTEXT_MESSAGE,"ColourPicker",WS_TABSTOP,93,161,39,10
+ CONTROL "",IDC_COLBACK_MESSAGE,"ColourPicker",WS_TABSTOP,142,161,39,10
+ CONTROL "",IDC_CHKDEFAULTCOL_MESSAGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,190,161,11,10
+ EDITTEXT IDC_DELAY_MESSAGE,212,160,26,12,ES_AUTOHSCROLL | ES_NUMBER
+ CONTROL "",IDC_SPIN_MESSAGE,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,258,160,11,12
LTEXT "File",IDC_STATIC,13,175,44,8
- CONTROL "",IDC_COLTEXT_FILE,"ColourPicker",WS_TABSTOP,93,174,39,11
- CONTROL "",IDC_COLBACK_FILE,"ColourPicker",WS_TABSTOP,142,174,39,11
- CONTROL "",IDC_CHKDEFAULTCOL_FILE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,190,175,11,10
+ CONTROL "",IDC_COLTEXT_FILE,"ColourPicker",WS_TABSTOP,93,174,39,10
+ CONTROL "",IDC_COLBACK_FILE,"ColourPicker",WS_TABSTOP,142,174,39,10
+ CONTROL "",IDC_CHKDEFAULTCOL_FILE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,190,174,11,10
EDITTEXT IDC_DELAY_FILE,212,173,26,12,ES_AUTOHSCROLL | ES_NUMBER
- CONTROL "",IDC_CHKINFINITE_FILE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,258,175,11,10
+ CONTROL "",IDC_SPIN_FILE,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,258,173,11,12
LTEXT "Errors",IDC_STATIC,13,187,44,8
- CONTROL "",IDC_COLTEXT_ERR,"ColourPicker",WS_TABSTOP,93,187,39,11
- CONTROL "",IDC_COLBACK_ERR,"ColourPicker",WS_TABSTOP,142,187,39,11
- CONTROL "",IDC_CHKDEFAULTCOL_ERR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,190,188,11,10
+ CONTROL "",IDC_COLTEXT_ERR,"ColourPicker",WS_TABSTOP,93,187,39,10
+ CONTROL "",IDC_COLBACK_ERR,"ColourPicker",WS_TABSTOP,142,187,39,10
+ CONTROL "",IDC_CHKDEFAULTCOL_ERR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,190,187,11,10
EDITTEXT IDC_DELAY_ERR,212,186,26,12,ES_AUTOHSCROLL | ES_NUMBER
- CONTROL "",IDC_CHKINFINITE_ERR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,258,188,11,10
+ CONTROL "",IDC_SPIN_ERR,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,258,186,11,12
LTEXT "Others",IDC_STATIC,13,201,44,8
- CONTROL "",IDC_COLTEXT_OTHERS,"ColourPicker",WS_TABSTOP,93,200,39,11
- CONTROL "",IDC_COLBACK_OTHERS,"ColourPicker",WS_TABSTOP,142,200,39,11
- CONTROL "",IDC_CHKDEFAULTCOL_OTHERS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,190,201,11,10
+ CONTROL "",IDC_COLTEXT_OTHERS,"ColourPicker",WS_TABSTOP,93,200,39,10
+ CONTROL "",IDC_COLBACK_OTHERS,"ColourPicker",WS_TABSTOP,142,200,39,10
+ CONTROL "",IDC_CHKDEFAULTCOL_OTHERS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,190,200,11,10
EDITTEXT IDC_DELAY_OTHERS,212,199,26,12,ES_AUTOHSCROLL | ES_NUMBER
- CONTROL "",IDC_CHKINFINITE_OTHERS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,258,201,11,10
+ CONTROL "",IDC_SPIN_OTHERS,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,258,199,11,12
PUSHBUTTON "Preview",IDC_PREVIEW,239,218,60,13
END
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