summaryrefslogtreecommitdiff
path: root/plugins/NewEventNotify/src/options.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/NewEventNotify/src/options.cpp')
-rw-r--r--plugins/NewEventNotify/src/options.cpp148
1 files changed, 87 insertions, 61 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;
}