diff options
author | George Hazan <ghazan@miranda.im> | 2023-01-02 19:28:15 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2023-01-02 19:28:15 +0300 |
commit | 3048f93e6482ee4a939fac2d5eb815d67a8b4837 (patch) | |
tree | d06017df5dfd869211d0506e5db6673102aac36b /plugins/NewEventNotify/src | |
parent | 4472fde0ecb0438fc6e366c45d65b8ec988ab587 (diff) |
fixes #3280 (NewEventNotify: настройка цветов всплывающих окон)
Diffstat (limited to 'plugins/NewEventNotify/src')
-rw-r--r-- | plugins/NewEventNotify/src/options.cpp | 148 | ||||
-rw-r--r-- | plugins/NewEventNotify/src/resource.h | 6 | ||||
-rw-r--r-- | plugins/NewEventNotify/src/version.h | 2 |
3 files changed, 91 insertions, 65 deletions
diff --git a/plugins/NewEventNotify/src/options.cpp b/plugins/NewEventNotify/src/options.cpp index 43e4d2d950..84f25493d7 100644 --- a/plugins/NewEventNotify/src/options.cpp +++ b/plugins/NewEventNotify/src/options.cpp @@ -143,18 +143,83 @@ public: class COptionsMainDlg : public COptionsBaseDlg
{
- CCtrlSpin spinLimit, spinMessage, spinFile, spinErr, spinOther;
- CCtrlCheck chkLimit, chkDefaultColorMsg, chkDefaultColorFile, chkDefaultColorErr, chkDefaultColorOthers;
- CCtrlColor clrBackMessage, clrTextMessage, clrBackFile, clrTextFile, clrBackErr, clrTextErr, clrBackOther, clrTextOther;
- CCtrlButton btnPreview;
+ CCtrlSpin spinLimit;
+ CCtrlCheck chkLimit;
CCtrlTreeOpts m_opts;
- void GrabData()
+public:
+ COptionsMainDlg() :
+ COptionsBaseDlg(IDD_OPT_MAIN),
+ m_opts(this, IDC_OPT_TREE),
+ chkLimit(this, IDC_LIMITPREVIEW),
+ spinLimit(this, IDC_MESSAGEPREVIEWLIMITSPIN, 1000)
{
- m_opts.OnApply();
+ auto *pwszSection = TranslateT("General options");
+ m_opts.AddOption(pwszSection, TranslateT("Show preview of event in popup"), g_plugin.bPreview);
+ m_opts.AddOption(pwszSection, TranslateT("Enable event notifications for instant messages"), g_plugin.bPopups);
+ m_opts.AddOption(pwszSection, TranslateT("Enable event notifications for group chats"), g_plugin.bMucPopups);
+
+ pwszSection = TranslateT("Notify me of...");
+ m_opts.AddOption(pwszSection, TranslateT("Message"), g_plugin.maskNotify, MASK_MESSAGE);
+ m_opts.AddOption(pwszSection, TranslateT("Error"), g_plugin.maskNotify, MASK_ERROR);
+ 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.maskActR, MASK_DISMISS);
+ m_opts.AddOption(pwszSection, TranslateT("Open event"), g_plugin.maskActR, MASK_OPEN);
+ m_opts.AddOption(pwszSection, TranslateT("Dismiss event"), g_plugin.maskActR, 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);
+
+ chkLimit.OnChange = Callback(this, &COptionsMainDlg::onChange_Limit);
+ }
+
+ bool OnInitDialog() override
+ {
+ chkLimit.SetState(g_plugin.iLimitPreview > 0);
+ spinLimit.SetPosition(g_plugin.iLimitPreview);
+ return true;
+ }
+
+ bool OnApply() override
+ {
g_plugin.iLimitPreview = (chkLimit.GetState()) ? spinLimit.GetPosition() : 0;
+ m_opts.OnApply();
+ return true;
+ }
+
+ void onChange_Limit(CCtrlCheck *)
+ {
+ bool bEnabled = chkLimit.GetState();
+ spinLimit.Enable(bEnabled);
+ EnableDlgItem(m_hwnd, IDC_MESSAGEPREVIEWLIMIT, bEnabled);
+ }
+};
+
+/////////////////////////////////////////////////////////////////////////////////////////
+class COptionsEventsDlg : public COptionsBaseDlg
+{
+ CCtrlSpin spinMessage, spinFile, spinErr, spinOther;
+ CCtrlCheck chkDefaultColorMsg, chkDefaultColorFile, chkDefaultColorErr, chkDefaultColorOthers;
+ CCtrlColor clrBackMessage, clrTextMessage, clrBackFile, clrTextFile, clrBackErr, clrTextErr, clrBackOther, clrTextOther;
+ CCtrlButton btnPreview;
+
+ void GrabData()
+ {
// update options
g_plugin.msg.bDefault = IsDlgButtonChecked(m_hwnd, IDC_CHKDEFAULTCOL_MESSAGE);
g_plugin.msg.backColor = clrBackMessage.GetColor();
@@ -178,9 +243,8 @@ class COptionsMainDlg : public COptionsBaseDlg }
public:
- COptionsMainDlg() :
- COptionsBaseDlg(IDD_OPT_MAIN),
- m_opts(this, IDC_OPT_TREE),
+ COptionsEventsDlg() :
+ COptionsBaseDlg(IDD_OPT_EVENT_TYPES),
btnPreview(this, IDC_PREVIEW),
clrBackMessage(this, IDC_COLBACK_MESSAGE),
clrTextMessage(this, IDC_COLTEXT_MESSAGE),
@@ -194,66 +258,31 @@ public: chkDefaultColorFile(this, IDC_CHKDEFAULTCOL_FILE),
chkDefaultColorErr(this, IDC_CHKDEFAULTCOL_ERR),
chkDefaultColorOthers(this, IDC_CHKDEFAULTCOL_OTHERS),
- chkLimit(this, IDC_LIMITPREVIEW),
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 preview of event in popup"), g_plugin.bPreview);
- m_opts.AddOption(pwszSection, TranslateT("Enable event notifications for instant messages"), g_plugin.bPopups);
- m_opts.AddOption(pwszSection, TranslateT("Enable event notifications for group chats"), g_plugin.bMucPopups);
-
- pwszSection = TranslateT("Notify me of...");
- m_opts.AddOption(pwszSection, TranslateT("Message"), g_plugin.maskNotify, MASK_MESSAGE);
- m_opts.AddOption(pwszSection, TranslateT("Error"), g_plugin.maskNotify, MASK_ERROR);
- 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.maskActR, MASK_DISMISS);
- m_opts.AddOption(pwszSection, TranslateT("Open event"), g_plugin.maskActR, MASK_OPEN);
- m_opts.AddOption(pwszSection, TranslateT("Dismiss event"), g_plugin.maskActR, 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);
-
- chkLimit.OnChange = Callback(this, &COptionsMainDlg::onChange_Limit);
- 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);
+ btnPreview.OnClick = Callback(this, &COptionsEventsDlg::onClick_Preview);
+
+ chkDefaultColorMsg.OnChange = Callback(this, &COptionsEventsDlg::onChange_DefaultMsg);
+ chkDefaultColorFile.OnChange = Callback(this, &COptionsEventsDlg::onChange_DefaultFile);
+ chkDefaultColorErr.OnChange = Callback(this, &COptionsEventsDlg::onChange_DefaultErr);
+ chkDefaultColorOthers.OnChange = Callback(this, &COptionsEventsDlg::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);
- chkLimit.SetState(g_plugin.iLimitPreview > 0);
- spinLimit.SetPosition(g_plugin.iLimitPreview);
+ clrTextMessage.SetColor(g_plugin.msg.textColor);
+ clrTextFile.SetColor(g_plugin.file.textColor);
+ clrTextErr.SetColor(g_plugin.err.textColor);
+ clrTextOther.SetColor(g_plugin.other.textColor);
chkDefaultColorMsg.SetState(g_plugin.msg.bDefault);
chkDefaultColorFile.SetState(g_plugin.file.bDefault);
@@ -284,13 +313,6 @@ public: PopupShow(0, 0, -1);
}
- void onChange_Limit(CCtrlCheck *)
- {
- bool bEnabled = chkLimit.GetState();
- spinLimit.Enable(bEnabled);
- EnableDlgItem(m_hwnd, IDC_MESSAGEPREVIEWLIMIT, bEnabled);
- }
-
void onChange_DefaultMsg(CCtrlCheck *)
{
bool bEnabled = chkDefaultColorMsg.GetState();
@@ -403,5 +425,9 @@ int OptionsAdd(WPARAM addInfo, LPARAM) odp.szTab.a = LPGEN("Message events");
odp.pDialog = new COptionsMessageDlg();
g_plugin.addOptions(addInfo, &odp);
+
+ odp.szTab.a = LPGEN("Event types");
+ odp.pDialog = new COptionsEventsDlg();
+ g_plugin.addOptions(addInfo, &odp);
return 0;
}
diff --git a/plugins/NewEventNotify/src/resource.h b/plugins/NewEventNotify/src/resource.h index f2479a2699..9cfe804873 100644 --- a/plugins/NewEventNotify/src/resource.h +++ b/plugins/NewEventNotify/src/resource.h @@ -1,9 +1,10 @@ //{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
-// Used by C:\Users\georg\DiskW\miranda-ng\plugins\NewEventNotify\res\resource.rc
+// Used by W:\miranda-ng\plugins\NewEventNotify\res\resource.rc
//
#define IDD_OPT_MAIN 101
#define IDD_OPT_MESSAGE 102
+#define IDD_OPT_EVENT_TYPES 103
#define IDC_PREVIEW 1000
#define IDC_LIMITPREVIEW 1001
#define IDC_MESSAGEPREVIEWLIMIT 1002
@@ -28,7 +29,6 @@ #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
@@ -50,7 +50,7 @@ //
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 110
+#define _APS_NEXT_RESOURCE_VALUE 111
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1043
#define _APS_NEXT_SYMED_VALUE 101
diff --git a/plugins/NewEventNotify/src/version.h b/plugins/NewEventNotify/src/version.h index 5695e9b7e3..f01c9e64d9 100644 --- a/plugins/NewEventNotify/src/version.h +++ b/plugins/NewEventNotify/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0
#define __MINOR_VERSION 2
#define __RELEASE_NUM 2
-#define __BUILD_NUM 5
+#define __BUILD_NUM 6
#include <stdver.h>
|