diff options
author | George Hazan <ghazan@miranda.im> | 2018-07-11 17:09:17 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-07-11 17:09:17 +0300 |
commit | b2c91edc9646daa331de71d589e4fec6bdef4945 (patch) | |
tree | 847a77d0686d26e25b126313fbaa8262c81f8d1a /plugins/Scriver/src | |
parent | ae081843e9663b3cb36b17309fbce1d2967315f1 (diff) |
GUI change:
- methods OnInitDialog, OnApply & OnClose of CDlgBase now return true if successful. return of false prevents a dialog from being loaded or left respectively;
- massive code cleaning considering the 'virtual' attribute of overridden methods;
- also fixes #1476 (Don't close "Create new account" window if user not set account name)
Diffstat (limited to 'plugins/Scriver/src')
-rw-r--r-- | plugins/Scriver/src/chat_window.cpp | 3 | ||||
-rw-r--r-- | plugins/Scriver/src/msgdialog.cpp | 3 | ||||
-rw-r--r-- | plugins/Scriver/src/msgoptions.cpp | 24 | ||||
-rw-r--r-- | plugins/Scriver/src/msgs.h | 6 | ||||
-rw-r--r-- | plugins/Scriver/src/msgtimedout.cpp | 3 |
5 files changed, 25 insertions, 14 deletions
diff --git a/plugins/Scriver/src/chat_window.cpp b/plugins/Scriver/src/chat_window.cpp index 079607028d..005c5e1114 100644 --- a/plugins/Scriver/src/chat_window.cpp +++ b/plugins/Scriver/src/chat_window.cpp @@ -207,7 +207,7 @@ CChatRoomDlg::CChatRoomDlg(SESSION_INFO *si) m_splitterY.OnChange = Callback(this, &CChatRoomDlg::OnSplitterY);
}
-void CChatRoomDlg::OnInitDialog()
+bool CChatRoomDlg::OnInitDialog()
{
CSuper::OnInitDialog();
m_si->pDlg = this;
@@ -263,6 +263,7 @@ void CChatRoomDlg::OnInitDialog() SendMessage(m_hwndParent, CM_ADDCHILD, (WPARAM)this, 0);
UpdateNickList();
NotifyEvent(MSG_WINDOW_EVT_OPEN);
+ return true;
}
void CChatRoomDlg::OnDestroy()
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index cda1cc92e1..96bf1e24fc 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -175,7 +175,7 @@ CSrmmWindow::CSrmmWindow(MCONTACT hContact, bool bIncoming) m_splitter.OnChange = Callback(this, &CSrmmWindow::onChanged_Splitter);
}
-void CSrmmWindow::OnInitDialog()
+bool CSrmmWindow::OnInitDialog()
{
CSuper::OnInitDialog();
@@ -371,6 +371,7 @@ void CSrmmWindow::OnInitDialog() SendMessage(m_hwnd, DM_SHOWMESSAGESENDING, 0, 0);
NotifyEvent(MSG_WINDOW_EVT_OPEN);
+ return true;
}
void CSrmmWindow::OnDestroy()
diff --git a/plugins/Scriver/src/msgoptions.cpp b/plugins/Scriver/src/msgoptions.cpp index 3989c80889..f79b71ebb4 100644 --- a/plugins/Scriver/src/msgoptions.cpp +++ b/plugins/Scriver/src/msgoptions.cpp @@ -272,7 +272,7 @@ public: chkSavePerContact.OnChange = Callback(this, &CMainOptionsDlg::onChange_SavePerContact);
}
- void OnInitDialog() override
+ bool OnInitDialog() override
{
SetWindowLongPtr(m_tree.GetHwnd(), GWL_STYLE, (GetWindowLongPtr(m_tree.GetHwnd(), GWL_STYLE) & ~WS_BORDER) | TVS_NOHSCROLL | TVS_CHECKBOXES);
FillCheckBoxTree(statusValues, _countof(statusValues), db_get_dw(0, SRMM_MODULE, SRMSGSET_POPFLAGS, SRMSGDEFSET_POPFLAGS));
@@ -297,9 +297,10 @@ public: cmbSendMode.SetCurSel(g_dat.sendMode);
onChange_AutoPopup(0);
+ return true;
}
- void OnApply() override
+ bool OnApply() override
{
db_set_dw(0, SRMM_MODULE, SRMSGSET_POPFLAGS, MakeCheckBoxTreeFlags());
db_set_b(0, SRMM_MODULE, SRMSGSET_AUTOPOPUP, chkAutoPopup.GetState());
@@ -316,6 +317,7 @@ public: db_set_b(0, SRMM_MODULE, SRMSGSET_CASCADE, chkCascade.GetState());
db_set_b(0, SRMM_MODULE, SRMSGSET_HIDECONTAINERS, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_HIDECONTAINERS));
+ return true;
}
void onChange_AutoPopup(CCtrlCheck*)
@@ -358,7 +360,7 @@ public: chkSeparateChats.OnChange = Callback(this, &CTabsOptionsDlg::onChange_SeparateChats);
}
- void OnInitDialog() override
+ bool OnInitDialog() override
{
CheckDlgButton(m_hwnd, IDC_USETABS, db_get_b(0, SRMM_MODULE, SRMSGSET_USETABS, SRMSGDEFSET_USETABS) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(m_hwnd, IDC_ALWAYSSHOWTABS, !db_get_b(0, SRMM_MODULE, SRMSGSET_HIDEONETAB, SRMSGDEFSET_HIDEONETAB) ? BST_CHECKED : BST_UNCHECKED);
@@ -380,9 +382,10 @@ public: CheckDlgButton(m_hwnd, IDC_SEPARATECHATSCONTAINERS, db_get_b(0, SRMM_MODULE, SRMSGSET_SEPARATECHATSCONTAINERS, SRMSGDEFSET_SEPARATECHATSCONTAINERS) ? BST_CHECKED : BST_UNCHECKED);
onChange_UseTabs(0);
+ return true;
}
- void OnApply() override
+ bool OnApply() override
{
db_set_b(0, SRMM_MODULE, SRMSGSET_USETABS, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_USETABS));
db_set_b(0, SRMM_MODULE, SRMSGSET_TABSATBOTTOM, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_TABSATBOTTOM));
@@ -398,6 +401,7 @@ public: db_set_b(0, SRMM_MODULE, SRMSGSET_SWITCHTOACTIVE, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_SWITCHTOACTIVE));
db_set_b(0, SRMM_MODULE, SRMSGSET_TABCLOSEBUTTON, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_TABCLOSEBUTTON));
db_set_b(0, SRMM_MODULE, SRMSGSET_SEPARATECHATSCONTAINERS, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_SEPARATECHATSCONTAINERS));
+ return true;
}
void onChange_UseTabs(CCtrlCheck*)
@@ -463,7 +467,7 @@ public: chkShowTitlebar.OnChange = Callback(this, &CLayoutOptionsDlg::onChange_ShowTitlebar);
}
- void OnInitDialog() override
+ bool OnInitDialog() override
{
CheckDlgButton(m_hwnd, IDC_SHOWSTATUSBAR, db_get_b(0, SRMM_MODULE, SRMSGSET_SHOWSTATUSBAR, SRMSGDEFSET_SHOWSTATUSBAR) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(m_hwnd, IDC_SHOWTITLEBAR, db_get_b(0, SRMM_MODULE, SRMSGSET_SHOWTITLEBAR, SRMSGDEFSET_SHOWTITLEBAR) ? BST_CHECKED : BST_UNCHECKED);
@@ -491,9 +495,10 @@ public: CheckDlgButton(m_hwnd, IDC_SHOWPROGRESS, db_get_b(0, SRMM_MODULE, SRMSGSET_SHOWPROGRESS, SRMSGDEFSET_SHOWPROGRESS) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(m_hwnd, IDC_AVATARSUPPORT, g_dat.flags & SMF_AVATAR);
+ return true;
}
- void OnApply() override
+ bool OnApply() override
{
GetWindowText(GetDlgItem(m_hwnd, IDC_TITLEFORMAT), g_dat.wszTitleFormat, _countof(g_dat.wszTitleFormat));
db_set_ws(0, SRMM_MODULE, SRMSGSET_WINDOWTITLE, g_dat.wszTitleFormat);
@@ -513,6 +518,7 @@ public: db_set_w(0, SRMM_MODULE, SRMSGSET_AUTORESIZELINES, (WORD)SendDlgItemMessage(m_hwnd, IDC_INPUTLINESSPIN, UDM_GETPOS, 0, 0));
LoadInfobarFonts();
+ return true;
}
void onChange_Transparency(CCtrlCheck*)
@@ -607,7 +613,7 @@ public: chkIndentText.OnChange = Callback(this, &CLogOptionsDlg::onChange_IndentText);
}
- virtual void OnInitDialog() override
+ bool OnInitDialog() override
{
switch (db_get_b(0, SRMM_MODULE, SRMSGSET_LOADHISTORY, SRMSGDEFSET_LOADHISTORY)) {
case LOADHISTORY_UNREAD:
@@ -669,9 +675,10 @@ public: m_log.SetReadOnly(true);
OnChange();
+ return true;
}
- void OnApply() override
+ bool OnApply() override
{
if (IsDlgButtonChecked(m_hwnd, IDC_LOADCOUNT))
db_set_b(0, SRMM_MODULE, SRMSGSET_LOADHISTORY, LOADHISTORY_COUNT);
@@ -698,6 +705,7 @@ public: FreeMsgLogIcons();
LoadMsgLogIcons();
+ return true;
}
void onClick_Fonts(CCtrlHyperlink*)
diff --git a/plugins/Scriver/src/msgs.h b/plugins/Scriver/src/msgs.h index eb3754974f..a1b8704ff6 100644 --- a/plugins/Scriver/src/msgs.h +++ b/plugins/Scriver/src/msgs.h @@ -163,7 +163,7 @@ public: public:
CSrmmWindow(MCONTACT hContact, bool bIncoming);
- void OnInitDialog() override;
+ bool OnInitDialog() override;
void OnDestroy() override;
void ScrollToBottom() override;
@@ -207,7 +207,7 @@ class CChatRoomDlg : public CScriverWindow public:
CChatRoomDlg(SESSION_INFO *si);
- void OnInitDialog() override;
+ bool OnInitDialog() override;
void OnDestroy() override;
INT_PTR DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) override;
@@ -284,7 +284,7 @@ class CErrorDlg : public CDlgBase CCtrlButton m_btnOk, m_btnCancel;
protected:
- void OnInitDialog() override;
+ bool OnInitDialog() override;
public:
CErrorDlg(const wchar_t *pwszDescr, HWND, MessageSendQueueItem*);
diff --git a/plugins/Scriver/src/msgtimedout.cpp b/plugins/Scriver/src/msgtimedout.cpp index 672b5ea81d..c003ab2913 100644 --- a/plugins/Scriver/src/msgtimedout.cpp +++ b/plugins/Scriver/src/msgtimedout.cpp @@ -43,7 +43,7 @@ CErrorDlg::CErrorDlg(const wchar_t *pwszDescr, HWND hWnd, MessageSendQueueItem * m_btnCancel.OnClick = Callback(this, &CErrorDlg::onCancel);
}
-void CErrorDlg::OnInitDialog()
+bool CErrorDlg::OnInitDialog()
{
ShowWindow(GetParent(m_hwndParent), SW_RESTORE);
@@ -59,6 +59,7 @@ void CErrorDlg::OnInitDialog() GetWindowRect(m_hwnd, &rc);
GetWindowRect(GetParent(m_hwndParent), &rcParent);
SetWindowPos(m_hwnd, HWND_TOP, rcParent.left + (rcParent.right - rcParent.left - rc.right + rc.left) / 2, rcParent.top + (rcParent.bottom - rcParent.top - rc.bottom + rc.top) / 2, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
+ return true;
}
void CErrorDlg::onOk(CCtrlButton*)
|