summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/TabSRMM')
-rw-r--r--plugins/TabSRMM/res/resource.rc39
-rw-r--r--plugins/TabSRMM/src/eventpopups.cpp120
2 files changed, 92 insertions, 67 deletions
diff --git a/plugins/TabSRMM/res/resource.rc b/plugins/TabSRMM/res/resource.rc
index f36ed8aeda..f22a4f8169 100644
--- a/plugins/TabSRMM/res/resource.rc
+++ b/plugins/TabSRMM/res/resource.rc
@@ -85,29 +85,29 @@ BEGIN
LTEXT "Text",IDC_STATIC,60,167,23,8
LTEXT "Background",IDC_STATIC,86,167,47,8
CTEXT "Timeout (seconds, 0 = default, -1 = no timeout)",IDC_STATIC,134,167,168,8
- LTEXT "Message",IDC_STATIC,11,181,44,13
- CONTROL "",IDC_COLTEXT_MESSAGE,"ColourPicker",WS_TABSTOP,56,179,24,13
- CONTROL "",IDC_COLBACK_MESSAGE,"ColourPicker",WS_TABSTOP,92,179,24,13
+ LTEXT "Message",IDC_STATIC,11,180,44,10
+ CONTROL "",IDC_COLTEXT_MESSAGE,"ColourPicker",WS_TABSTOP,56,179,24,12
+ CONTROL "",IDC_COLBACK_MESSAGE,"ColourPicker",WS_TABSTOP,92,179,24,12
CONTROL "Use default colors",IDC_CHKDEFAULTCOL_MESSAGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,123,179,72,12
- LTEXT "Others",IDC_STATIC,12,197,44,11
- CONTROL "",IDC_COLTEXT_OTHERS,"ColourPicker",WS_TABSTOP,56,195,24,13
- CONTROL "",IDC_COLBACK_OTHERS,"ColourPicker",WS_TABSTOP,92,195,24,13
+ LTEXT "Others",IDC_STATIC,12,197,44,9
+ CONTROL "",IDC_COLTEXT_OTHERS,"ColourPicker",WS_TABSTOP,56,195,24,12
+ CONTROL "",IDC_COLBACK_OTHERS,"ColourPicker",WS_TABSTOP,92,195,24,12
CONTROL "Use default colors",IDC_CHKDEFAULTCOL_OTHERS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,123,195,72,12
EDITTEXT IDC_DELAY_MESSAGE,210,179,46,12,ES_AUTOHSCROLL | ES_NUMBER
- CONTROL "",IDC_DELAY_MESSAGE_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,197,179,9,13
+ CONTROL "",IDC_DELAY_MESSAGE_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,254,178,9,13
EDITTEXT IDC_DELAY_OTHERS,210,195,46,12,ES_AUTOHSCROLL | ES_NUMBER
- CONTROL "",IDC_DELAY_OTHERS_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,199,196,11,13
+ CONTROL "",IDC_DELAY_OTHERS_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,253,195,11,13
PUSHBUTTON "Preview",IDC_PREVIEW,261,178,48,61
- CONTROL "",IDC_EVENTOPTIONS,"SysTreeView32",TVS_DISABLEDRAGDROP | TVS_SHOWSELALWAYS | WS_BORDER | WS_HSCROLL | WS_TABSTOP,6,8,303,109
- CONTROL "",IDC_COLTEXT_MUC,"ColourPicker",WS_TABSTOP,56,211,24,13
- CONTROL "",IDC_COLBACK_MUC,"ColourPicker",WS_TABSTOP,92,211,24,13
+ CONTROL "",IDC_EVENTOPTIONS,"SysTreeView32",TVS_DISABLEDRAGDROP | TVS_SHOWSELALWAYS | WS_BORDER | WS_HSCROLL | WS_TABSTOP,6,8,303,110
+ CONTROL "",IDC_COLTEXT_MUC,"ColourPicker",WS_TABSTOP,56,211,24,12
+ CONTROL "",IDC_COLBACK_MUC,"ColourPicker",WS_TABSTOP,92,211,24,12
CONTROL "Use default colors",IDC_CHKDEFAULTCOL_MUC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,123,211,72,12
- LTEXT "Group chats",IDC_STATIC,12,212,44,11
+ LTEXT "Group chats",IDC_STATIC,12,212,44,10
EDITTEXT IDC_DELAY_MUC,210,211,46,12,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_DELAY_MESSAGE_MUC_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,253,211,9,13
- LTEXT "Errors",IDC_STATIC,12,227,44,11
- CONTROL "",IDC_COLTEXT_ERR,"ColourPicker",WS_TABSTOP,56,227,24,13
- CONTROL "",IDC_COLBACK_ERR,"ColourPicker",WS_TABSTOP,92,227,24,13
+ LTEXT "Errors",IDC_STATIC,12,228,44,10
+ CONTROL "",IDC_COLTEXT_ERR,"ColourPicker",WS_TABSTOP,56,227,24,12
+ CONTROL "",IDC_COLBACK_ERR,"ColourPicker",WS_TABSTOP,92,227,24,12
CONTROL "Use default colors",IDC_CHKDEFAULTCOL_ERR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,123,227,72,12
EDITTEXT IDC_DELAY_ERR,210,227,46,12,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_DELAY_ERR_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,253,227,9,13
@@ -821,6 +821,10 @@ BEGIN
BEGIN
END
+ IDD_POPUP_OPT, DIALOG
+ BEGIN
+ END
+
IDD_USERPREFS, DIALOG
BEGIN
BOTTOMMARGIN, 166
@@ -916,6 +920,11 @@ BEGIN
0
END
+IDD_POPUP_OPT AFX_DIALOG_LAYOUT
+BEGIN
+ 0
+END
+
#endif // Neutral resources
/////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/TabSRMM/src/eventpopups.cpp b/plugins/TabSRMM/src/eventpopups.cpp
index e97c92355a..cf039d8c53 100644
--- a/plugins/TabSRMM/src/eventpopups.cpp
+++ b/plugins/TabSRMM/src/eventpopups.cpp
@@ -488,8 +488,11 @@ static TOptionListGroup lvGroupsNEN[] =
class CPopupOptionsDlg : public CDlgBase
{
+ NEN_OPTIONS tmpOpts;
+
CCtrlTreeView eventOptions;
CCtrlButton btnPreview, btnModes;
+ CCtrlCheck chkMessage, chkOthers, chkMuc, chkErr;
CCtrlColor mucBack, mucText, msgBack, msgText, otherBack, otherText, errBack, errText;
public:
@@ -505,56 +508,63 @@ public:
otherText(this, IDC_COLTEXT_OTHERS),
btnModes(this, IDC_POPUPSTATUSMODES),
btnPreview(this, IDC_PREVIEW),
- eventOptions(this, IDC_EVENTOPTIONS)
+ eventOptions(this, IDC_EVENTOPTIONS),
+ chkMessage(this, IDC_CHKDEFAULTCOL_MESSAGE),
+ chkOthers(this, IDC_CHKDEFAULTCOL_OTHERS),
+ chkErr(this, IDC_CHKDEFAULTCOL_ERR),
+ chkMuc(this, IDC_CHKDEFAULTCOL_MUC)
+
{
btnModes.OnClick = Callback(this, &CPopupOptionsDlg::onClick_Modes);
btnPreview.OnClick = Callback(this, &CPopupOptionsDlg::onClick_Preview);
+
+ tmpOpts = nen_options;
}
bool OnInitDialog() override
{
TreeViewInit(eventOptions, lvGroupsNEN, lvItemsNEN, 0, 0, TRUE);
- msgBack.SetColor(nen_options.colBackMsg);
- msgText.SetColor(nen_options.colTextMsg);
- otherBack.SetColor(nen_options.colBackOthers);
- otherText.SetColor(nen_options.colTextOthers);
- errBack.SetColor(nen_options.colBackErr);
- errText.SetColor(nen_options.colTextErr);
- CheckDlgButton(m_hwnd, IDC_CHKDEFAULTCOL_MESSAGE, nen_options.bDefaultColorMsg ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(m_hwnd, IDC_CHKDEFAULTCOL_OTHERS, nen_options.bDefaultColorOthers ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(m_hwnd, IDC_CHKDEFAULTCOL_ERR, nen_options.bDefaultColorErr ? BST_CHECKED : BST_UNCHECKED);
+ msgBack.SetColor(tmpOpts.colBackMsg);
+ msgText.SetColor(tmpOpts.colTextMsg);
+ otherBack.SetColor(tmpOpts.colBackOthers);
+ otherText.SetColor(tmpOpts.colTextOthers);
+ errBack.SetColor(tmpOpts.colBackErr);
+ errText.SetColor(tmpOpts.colTextErr);
+ chkMessage.SetState(tmpOpts.bDefaultColorMsg);
+ chkOthers.SetState(tmpOpts.bDefaultColorOthers);
+ chkErr.SetState(tmpOpts.bDefaultColorErr);
mucText.SetColor(g_Settings.crPUTextColour);
mucBack.SetColor(g_Settings.crPUBkgColour);
- CheckDlgButton(m_hwnd, IDC_CHKDEFAULTCOL_MUC, g_Settings.iPopupStyle == 2 ? BST_CHECKED : BST_UNCHECKED);
+ chkMuc.SetState(g_Settings.iPopupStyle == 2);
SendDlgItemMessage(m_hwnd, IDC_DELAY_MESSAGE_SPIN, UDM_SETRANGE, 0, MAKELONG(3600, -1));
SendDlgItemMessage(m_hwnd, IDC_DELAY_OTHERS_SPIN, UDM_SETRANGE, 0, MAKELONG(3600, -1));
SendDlgItemMessage(m_hwnd, IDC_DELAY_MESSAGE_MUC_SPIN, UDM_SETRANGE, 0, MAKELONG(3600, -1));
SendDlgItemMessage(m_hwnd, IDC_DELAY_ERR_SPIN, UDM_SETRANGE, 0, MAKELONG(3600, -1));
- SendDlgItemMessage(m_hwnd, IDC_DELAY_MESSAGE_SPIN, UDM_SETPOS, 0, (LPARAM)nen_options.iDelayMsg);
- SendDlgItemMessage(m_hwnd, IDC_DELAY_OTHERS_SPIN, UDM_SETPOS, 0, (LPARAM)nen_options.iDelayOthers);
- SendDlgItemMessage(m_hwnd, IDC_DELAY_ERR_SPIN, UDM_SETPOS, 0, (LPARAM)nen_options.iDelayErr);
+ SendDlgItemMessage(m_hwnd, IDC_DELAY_MESSAGE_SPIN, UDM_SETPOS, 0, (LPARAM)tmpOpts.iDelayMsg);
+ SendDlgItemMessage(m_hwnd, IDC_DELAY_OTHERS_SPIN, UDM_SETPOS, 0, (LPARAM)tmpOpts.iDelayOthers);
+ SendDlgItemMessage(m_hwnd, IDC_DELAY_ERR_SPIN, UDM_SETPOS, 0, (LPARAM)tmpOpts.iDelayErr);
SendDlgItemMessage(m_hwnd, IDC_DELAY_MESSAGE_MUC_SPIN, UDM_SETPOS, 0, (LPARAM)g_Settings.iPopupTimeout);
- msgBack.Enable(!nen_options.bDefaultColorMsg);
- msgText.Enable(!nen_options.bDefaultColorMsg);
- otherBack.Enable(!nen_options.bDefaultColorOthers);
- otherText.Enable(!nen_options.bDefaultColorOthers);
- errBack.Enable(!nen_options.bDefaultColorErr);
- errText.Enable(!nen_options.bDefaultColorErr);
+ msgBack.Enable(!tmpOpts.bDefaultColorMsg);
+ msgText.Enable(!tmpOpts.bDefaultColorMsg);
+ otherBack.Enable(!tmpOpts.bDefaultColorOthers);
+ otherText.Enable(!tmpOpts.bDefaultColorOthers);
+ errBack.Enable(!tmpOpts.bDefaultColorErr);
+ errText.Enable(!tmpOpts.bDefaultColorErr);
mucText.Enable(g_Settings.iPopupStyle == 3);
mucBack.Enable(g_Settings.iPopupStyle == 3);
CheckDlgButton(m_hwnd, IDC_MUC_LOGCOLORS, g_Settings.iPopupStyle < 2 ? BST_CHECKED : BST_UNCHECKED);
Utils::enableDlgControl(m_hwnd, IDC_MUC_LOGCOLORS, g_Settings.iPopupStyle != 2);
- SetDlgItemInt(m_hwnd, IDC_MESSAGEPREVIEWLIMIT, nen_options.iLimitPreview, FALSE);
- CheckDlgButton(m_hwnd, IDC_LIMITPREVIEW, (nen_options.iLimitPreview > 0) ? BST_CHECKED : BST_UNCHECKED);
- SendDlgItemMessage(m_hwnd, IDC_MESSAGEPREVIEWLIMITSPIN, UDM_SETRANGE, 0, MAKELONG(2048, nen_options.iLimitPreview > 0 ? 50 : 0));
- SendDlgItemMessage(m_hwnd, IDC_MESSAGEPREVIEWLIMITSPIN, UDM_SETPOS, 0, (LPARAM)nen_options.iLimitPreview);
+ SetDlgItemInt(m_hwnd, IDC_MESSAGEPREVIEWLIMIT, tmpOpts.iLimitPreview, FALSE);
+ CheckDlgButton(m_hwnd, IDC_LIMITPREVIEW, (tmpOpts.iLimitPreview > 0) ? BST_CHECKED : BST_UNCHECKED);
+ SendDlgItemMessage(m_hwnd, IDC_MESSAGEPREVIEWLIMITSPIN, UDM_SETRANGE, 0, MAKELONG(2048, tmpOpts.iLimitPreview > 0 ? 50 : 0));
+ SendDlgItemMessage(m_hwnd, IDC_MESSAGEPREVIEWLIMITSPIN, UDM_SETPOS, 0, (LPARAM)tmpOpts.iLimitPreview);
Utils::enableDlgControl(m_hwnd, IDC_MESSAGEPREVIEWLIMIT, IsDlgButtonChecked(m_hwnd, IDC_LIMITPREVIEW) != 0);
Utils::enableDlgControl(m_hwnd, IDC_MESSAGEPREVIEWLIMITSPIN, IsDlgButtonChecked(m_hwnd, IDC_LIMITPREVIEW) != 0);
return true;
@@ -562,6 +572,8 @@ public:
bool OnApply() override
{
+ nen_options = tmpOpts;
+
// scan the tree view and obtain the options...
TreeViewToDB(eventOptions, lvItemsNEN, nullptr, nullptr);
@@ -575,11 +587,16 @@ public:
return true;
}
+ void OnReset() override
+ {
+ NEN_ReadOptions(&tmpOpts);
+ }
+
INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override
{
if (msg == WM_COMMAND && wParam == DM_STATUSMASKSET) {
db_set_dw(0, MODULE, "statusmask", (DWORD)lParam);
- nen_options.dwStatusMask = (int)lParam;
+ tmpOpts.dwStatusMask = (int)lParam;
}
return CDlgBase::DlgProc(msg, wParam, lParam);
@@ -587,17 +604,17 @@ public:
void onClick_Preview(CCtrlButton *)
{
- PopupShowT(&nen_options, 0, 0, EVENTTYPE_MESSAGE, nullptr);
+ PopupShowT(&tmpOpts, 0, 0, EVENTTYPE_MESSAGE, nullptr);
}
void onClick_Modes(CCtrlButton *)
{
- CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CHOOSESTATUSMODES), m_hwnd, DlgProcSetupStatusModes, db_get_dw(0, MODULE, "statusmask", (DWORD)-1));
+ CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CHOOSESTATUSMODES), m_hwnd, DlgProcSetupStatusModes, db_get_dw(0, MODULE, "statusmask", -1));
}
void OnChange() override
{
- if (IsDlgButtonChecked(m_hwnd, IDC_CHKDEFAULTCOL_MUC))
+ if (chkMuc.GetState())
g_Settings.iPopupStyle = 2;
else if (IsDlgButtonChecked(m_hwnd, IDC_MUC_LOGCOLORS))
g_Settings.iPopupStyle = 1;
@@ -606,26 +623,25 @@ public:
Utils::enableDlgControl(m_hwnd, IDC_MUC_LOGCOLORS, g_Settings.iPopupStyle != 2);
- nen_options.bDefaultColorMsg = IsDlgButtonChecked(m_hwnd, IDC_CHKDEFAULTCOL_MESSAGE);
- nen_options.bDefaultColorOthers = IsDlgButtonChecked(m_hwnd, IDC_CHKDEFAULTCOL_OTHERS);
- nen_options.bDefaultColorErr = IsDlgButtonChecked(m_hwnd, IDC_CHKDEFAULTCOL_ERR);
-
- nen_options.iDelayMsg = SendDlgItemMessage(m_hwnd, IDC_DELAY_MESSAGE_SPIN, UDM_GETPOS, 0, 0);
- nen_options.iDelayOthers = SendDlgItemMessage(m_hwnd, IDC_DELAY_OTHERS_SPIN, UDM_GETPOS, 0, 0);
- nen_options.iDelayErr = SendDlgItemMessage(m_hwnd, IDC_DELAY_ERR_SPIN, UDM_GETPOS, 0, 0);
+ tmpOpts.bDefaultColorMsg = chkMessage.GetState();
+ tmpOpts.bDefaultColorOthers = chkOthers.GetState();
+ tmpOpts.bDefaultColorErr = chkErr.GetState();
+ tmpOpts.iDelayMsg = SendDlgItemMessage(m_hwnd, IDC_DELAY_MESSAGE_SPIN, UDM_GETPOS, 0, 0);
+ tmpOpts.iDelayOthers = SendDlgItemMessage(m_hwnd, IDC_DELAY_OTHERS_SPIN, UDM_GETPOS, 0, 0);
+ tmpOpts.iDelayErr = SendDlgItemMessage(m_hwnd, IDC_DELAY_ERR_SPIN, UDM_GETPOS, 0, 0);
g_Settings.iPopupTimeout = SendDlgItemMessage(m_hwnd, IDC_DELAY_MESSAGE_MUC_SPIN, UDM_GETPOS, 0, 0);
if (IsDlgButtonChecked(m_hwnd, IDC_LIMITPREVIEW))
- nen_options.iLimitPreview = GetDlgItemInt(m_hwnd, IDC_MESSAGEPREVIEWLIMIT, nullptr, FALSE);
+ tmpOpts.iLimitPreview = GetDlgItemInt(m_hwnd, IDC_MESSAGEPREVIEWLIMIT, nullptr, FALSE);
else
- nen_options.iLimitPreview = 0;
- msgBack.Enable(!nen_options.bDefaultColorMsg);
- msgText.Enable(!nen_options.bDefaultColorMsg);
- otherBack.Enable(!nen_options.bDefaultColorOthers);
- otherText.Enable(!nen_options.bDefaultColorOthers);
- errBack.Enable(!nen_options.bDefaultColorErr);
- errText.Enable(!nen_options.bDefaultColorErr);
+ tmpOpts.iLimitPreview = 0;
+ msgBack.Enable(!tmpOpts.bDefaultColorMsg);
+ msgText.Enable(!tmpOpts.bDefaultColorMsg);
+ otherBack.Enable(!tmpOpts.bDefaultColorOthers);
+ otherText.Enable(!tmpOpts.bDefaultColorOthers);
+ errBack.Enable(!tmpOpts.bDefaultColorErr);
+ errText.Enable(!tmpOpts.bDefaultColorErr);
mucText.Enable(g_Settings.iPopupStyle == 3);
mucBack.Enable(g_Settings.iPopupStyle == 3);
@@ -633,17 +649,17 @@ public:
Utils::enableDlgControl(m_hwnd, IDC_MESSAGEPREVIEWLIMITSPIN, IsDlgButtonChecked(m_hwnd, IDC_LIMITPREVIEW) != 0);
// disable delay textbox when infinite is checked
- Utils::enableDlgControl(m_hwnd, IDC_DELAY_MESSAGE, nen_options.iDelayMsg != -1);
- Utils::enableDlgControl(m_hwnd, IDC_DELAY_OTHERS, nen_options.iDelayOthers != -1);
- Utils::enableDlgControl(m_hwnd, IDC_DELAY_ERR, nen_options.iDelayErr != -1);
+ Utils::enableDlgControl(m_hwnd, IDC_DELAY_MESSAGE, tmpOpts.iDelayMsg != -1);
+ Utils::enableDlgControl(m_hwnd, IDC_DELAY_OTHERS, tmpOpts.iDelayOthers != -1);
+ Utils::enableDlgControl(m_hwnd, IDC_DELAY_ERR, tmpOpts.iDelayErr != -1);
Utils::enableDlgControl(m_hwnd, IDC_DELAY_MUC, g_Settings.iPopupTimeout != -1);
- nen_options.colBackMsg = msgBack.GetColor();
- nen_options.colTextMsg = msgText.GetColor();
- nen_options.colBackOthers = otherBack.GetColor();
- nen_options.colTextOthers = otherText.GetColor();
- nen_options.colBackErr = errBack.GetColor();
- nen_options.colTextErr = errText.GetColor();
+ tmpOpts.colBackMsg = msgBack.GetColor();
+ tmpOpts.colTextMsg = msgText.GetColor();
+ tmpOpts.colBackOthers = otherBack.GetColor();
+ tmpOpts.colTextOthers = otherText.GetColor();
+ tmpOpts.colBackErr = errBack.GetColor();
+ tmpOpts.colTextErr = errText.GetColor();
g_Settings.crPUBkgColour = mucBack.GetColor();
g_Settings.crPUTextColour = mucText.GetColor();
}