diff options
author | George Hazan <ghazan@miranda.im> | 2018-06-05 11:47:37 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-06-05 11:47:37 +0300 |
commit | 11b0f497c9a7d13ea7caba9841d661f72389751c (patch) | |
tree | 40c9d116272d6a4c63a717cd68686a61e6e5c989 | |
parent | 9ff6f169d1e2bd5bc139290d4abd6d7573fa6061 (diff) |
merge of SRMM related changes into stable
36 files changed, 624 insertions, 632 deletions
diff --git a/include/m_chat_int.h b/include/m_chat_int.h index af4f137e07..0e57ab68bc 100644 --- a/include/m_chat_int.h +++ b/include/m_chat_int.h @@ -258,6 +258,7 @@ struct CHAT_MANAGER void (*SetActiveSession)(SESSION_INFO *si);
SESSION_INFO* (*GetActiveSession)(void);
+
SESSION_INFO* (*SM_FindSession)(const wchar_t *pszID, const char *pszModule);
HICON (*SM_GetStatusIcon)(SESSION_INFO *si, USERINFO * ui);
BOOL (*SM_PostMessage)(const wchar_t *pszID, const char *pszModule, UINT msg, WPARAM wParam, LPARAM lParam);
@@ -449,6 +450,7 @@ public: virtual void AddLog();
virtual void CloseTab() {}
+ virtual bool IsActive() const PURE;
virtual void LoadSettings() PURE;
virtual void RedrawLog() {}
virtual void ScrollToBottom() {}
diff --git a/plugins/Import/src/dbrw/dbcontacts.cpp b/plugins/Import/src/dbrw/dbcontacts.cpp index 66ffcb61b9..03780e7e9e 100644 --- a/plugins/Import/src/dbrw/dbcontacts.cpp +++ b/plugins/Import/src/dbrw/dbcontacts.cpp @@ -65,4 +65,4 @@ STDMETHODIMP_(MCONTACT) CDbxSQLite::AddContact(void) STDMETHODIMP_(LONG) CDbxSQLite::DeleteContact(MCONTACT) { return 1; -}
\ No newline at end of file +} diff --git a/plugins/Import/src/dbrw/dbevents.cpp b/plugins/Import/src/dbrw/dbevents.cpp index cc8c04c5b3..062cc79069 100644 --- a/plugins/Import/src/dbrw/dbevents.cpp +++ b/plugins/Import/src/dbrw/dbevents.cpp @@ -181,4 +181,4 @@ STDMETHODIMP_(MEVENT) CDbxSQLite::FindPrevEvent(MCONTACT contactID, MEVENT hDbEv res = sqlite3_column_int(evt_stmts_prep[SQL_EVT_STMT_FINDPREV], 0); sql_reset(evt_stmts_prep[SQL_EVT_STMT_FINDPREV]); return res; -}
\ No newline at end of file +} diff --git a/plugins/Import/src/dbrw/dbintf.cpp b/plugins/Import/src/dbrw/dbintf.cpp index 137b79aaa9..b5ed8b9e67 100644 --- a/plugins/Import/src/dbrw/dbintf.cpp +++ b/plugins/Import/src/dbrw/dbintf.cpp @@ -82,4 +82,4 @@ STDMETHODIMP_(BOOL) CDbxSQLite::MetaMergeHistory(DBCachedContact*, DBCachedConta STDMETHODIMP_(BOOL) CDbxSQLite::MetaSplitHistory(DBCachedContact*, DBCachedContact*) { return FALSE; -}
\ No newline at end of file +} diff --git a/plugins/Import/src/dbrw/dbrw.cpp b/plugins/Import/src/dbrw/dbrw.cpp index 00bf079c05..60765d8f4a 100644 --- a/plugins/Import/src/dbrw/dbrw.cpp +++ b/plugins/Import/src/dbrw/dbrw.cpp @@ -97,4 +97,4 @@ static DATABASELINK dblink = void RegisterDbrw() { RegisterDatabasePlugin(&dblink); -}
\ No newline at end of file +} diff --git a/plugins/Import/src/dbrw/dbrw.h b/plugins/Import/src/dbrw/dbrw.h index 45034fcf3c..cbd09b66a1 100644 --- a/plugins/Import/src/dbrw/dbrw.h +++ b/plugins/Import/src/dbrw/dbrw.h @@ -27,4 +27,4 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define DBRW_SCHEMA_VERSION "2" #define DBRW_HEADER_STR "SQLite format 3" -void RegisterDbrw();
\ No newline at end of file +void RegisterDbrw(); diff --git a/plugins/Import/src/dbrw/dbsettings.cpp b/plugins/Import/src/dbrw/dbsettings.cpp index 64501078c6..ff8060b7fe 100644 --- a/plugins/Import/src/dbrw/dbsettings.cpp +++ b/plugins/Import/src/dbrw/dbsettings.cpp @@ -178,4 +178,4 @@ STDMETHODIMP_(BOOL) CDbxSQLite::EnumContactSettings(MCONTACT hContact, DBSETTING } sql_reset(set_stmts_prep[SQL_SET_STMT_ENUM]); return res; -}
\ No newline at end of file +} diff --git a/plugins/Scriver/res/resource.rc b/plugins/Scriver/res/resource.rc index df6214f896..f352a038b6 100644 --- a/plugins/Scriver/res/resource.rc +++ b/plugins/Scriver/res/resource.rc @@ -25,31 +25,31 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL // Dialog
//
-IDD_OPT_MSGDLG DIALOGEX 2, 0, 304, 230
+IDD_OPT_MSGDLG DIALOGEX 2, 0, 304, 186
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- GROUPBOX "Behavior",IDC_STATIC,0,0,304,176
+ GROUPBOX "Behavior",IDC_STATIC,0,0,304,182
CONTROL "Automatically pop up the window when",IDC_AUTOPOPUP,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,12,155,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,12,155,10
CONTROL "Tree1",IDC_POPLIST,"SysTreeView32",TVS_DISABLEDRAGDROP | TVS_NOTOOLTIPS | TVS_NONEVENHEIGHT | WS_BORDER | WS_HSCROLL | WS_TABSTOP,163,12,98,44
CONTROL "and stay minimized",IDC_STAYMINIMIZED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,23,141,10
- CONTROL "Cascade new windows",IDC_CASCADE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,58,292,10
+ CONTROL "Cascade new windows",IDC_CASCADE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,58,293,10
CONTROL "Save size and location for each contact",IDC_SAVEPERCONTACT,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,69,292,10
- CONTROL "Minimize on send",IDC_AUTOMIN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,80,292,10
- CONTROL "Hide windows on close",IDC_HIDECONTAINERS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,91,292,10
- CONTROL "Send message on 'Enter'",IDC_SENDONENTER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,102,292,10
- CONTROL "Send message on double 'Enter'",IDC_SENDONDBLENTER,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,113,292,10
- CONTROL "Remember unsent messages",IDC_SAVEDRAFTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,124,292,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,69,293,10
+ CONTROL "Minimize on send",IDC_AUTOMIN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,80,293,10
+ CONTROL "Hide windows on close",IDC_HIDECONTAINERS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,91,293,10
+ CONTROL "Remember unsent messages",IDC_SAVEDRAFTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,103,293,10
CONTROL "Delete temporary contacts on closing",IDC_DELTEMP,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,135,292,10
- LTEXT "Show warning when message has not been received after",IDC_STATIC,8,148,201,8
- EDITTEXT IDC_SECONDS,213,146,35,12,ES_RIGHT | ES_NUMBER
- CONTROL "",IDC_SECONDSSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,239,146,11,14
- LTEXT "seconds",IDC_STATIC,253,148,44,8
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,114,293,10
+ LTEXT "Show warning when message has not been received after",IDC_STATIC,6,127,201,8
+ EDITTEXT IDC_SECONDS,213,125,35,12,ES_RIGHT | ES_NUMBER
+ CONTROL "",IDC_SECONDSSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,239,125,11,14
+ LTEXT "seconds",IDC_STATIC,253,127,44,8
+ CONTROL "Send message on 'Enter'",IDC_SENDONENTER,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,6,144,293,10
+ CONTROL "Send message on double 'Enter'",IDC_SENDONDBLENTER,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,6,156,293,10
+ CONTROL "Send message on 'Ctrl+Enter'",IDC_SENDONCTRLENTER,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,6,168,293,10
END
IDD_OPT_MSGTABS DIALOGEX 2, 0, 304, 230
@@ -334,11 +334,11 @@ GUIDELINES DESIGNINFO BEGIN
IDD_OPT_MSGDLG, DIALOG
BEGIN
- VERTGUIDE, 8
+ VERTGUIDE, 6
VERTGUIDE, 22
VERTGUIDE, 51
- VERTGUIDE, 148
- VERTGUIDE, 300
+ VERTGUIDE, 90
+ VERTGUIDE, 299
END
IDD_OPT_MSGTABS, DIALOG
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index 8bc0ff50cc..06ca2fe422 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -1416,6 +1416,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) if (m_hDbEventFirst == 0)
m_hDbEventFirst = hDbEvent;
if (DbEventIsShown(dbei)) {
+ bool bIsActive = IsActive();
if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & (DBEF_SENT))) {
/* store the event when the container is hidden so that clist notifications can be removed */
if (!IsWindowVisible(m_hwndParent) && m_hDbUnreadEventFirst == 0)
diff --git a/plugins/Scriver/src/msgoptions.cpp b/plugins/Scriver/src/msgoptions.cpp index e8876170e3..009e7a78b3 100644 --- a/plugins/Scriver/src/msgoptions.cpp +++ b/plugins/Scriver/src/msgoptions.cpp @@ -180,6 +180,28 @@ void LoadMsgDlgFont(int i, LOGFONT *lf, COLORREF *colour) }
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
+class CBaseOptionDlg : public CDlgBase
+{
+ void ApplyOptions(void*)
+ {
+ ReloadGlobals();
+ WindowList_Broadcast(g_dat.hParentWindowList, DM_OPTIONSAPPLIED, 0, 0);
+ Srmm_Broadcast(DM_OPTIONSAPPLIED, 0, 0);
+ Chat_UpdateOptions();
+ }
+
+public:
+ CBaseOptionDlg(int dlgId) :
+ CDlgBase(g_hInst, dlgId)
+ {
+ m_OnFinishWizard = Callback(this, &CBaseOptionDlg::ApplyOptions);
+ }
+};
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
struct CheckBoxValues_t
{
DWORD style;
@@ -200,399 +222,347 @@ static const struct CheckBoxValues_t statusValues[] = { PF2_ONTHEPHONE, LPGENW("On the phone") }
};
-static void FillCheckBoxTree(HWND hwndTree, const struct CheckBoxValues_t *values, int nValues, DWORD style)
+class CMainOptionsDlg : public CBaseOptionDlg
{
- TVINSERTSTRUCT tvis;
- tvis.hParent = nullptr;
- tvis.hInsertAfter = TVI_LAST;
- tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_STATE;
- for (int i = 0; i < nValues; i++) {
- tvis.item.lParam = values[i].style;
- tvis.item.pszText = TranslateW(values[i].szDescr);
- tvis.item.stateMask = TVIS_STATEIMAGEMASK;
- tvis.item.state = INDEXTOSTATEIMAGEMASK((style & tvis.item.lParam) != 0 ? 2 : 1);
- TreeView_InsertItem(hwndTree, &tvis);
+ CCtrlCheck chkAutoPopup, chkCascade, chkSavePerContact;
+ CCtrlCheck chkSendOnEnter, chkSendOnDblEnter, chkSendOnCtrlEnter;
+ CCtrlTreeView m_tree;
+
+ void FillCheckBoxTree(const struct CheckBoxValues_t *values, int nValues, DWORD style)
+ {
+ TVINSERTSTRUCT tvis;
+ tvis.hParent = nullptr;
+ tvis.hInsertAfter = TVI_LAST;
+ tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_STATE;
+ for (int i = 0; i < nValues; i++) {
+ tvis.item.lParam = values[i].style;
+ tvis.item.pszText = TranslateW(values[i].szDescr);
+ tvis.item.stateMask = TVIS_STATEIMAGEMASK;
+ tvis.item.state = INDEXTOSTATEIMAGEMASK((style & tvis.item.lParam) != 0 ? 2 : 1);
+ m_tree.InsertItem(&tvis);
+ }
}
-}
-static DWORD MakeCheckBoxTreeFlags(HWND hwndTree)
-{
- DWORD flags = 0;
- TVITEM tvi;
- tvi.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE;
- tvi.hItem = TreeView_GetRoot(hwndTree);
- while (tvi.hItem) {
- TreeView_GetItem(hwndTree, &tvi);
- if (((tvi.state & TVIS_STATEIMAGEMASK) >> 12 == 2))
- flags |= tvi.lParam;
- tvi.hItem = TreeView_GetNextSibling(hwndTree, tvi.hItem);
- }
- return flags;
-}
+ DWORD MakeCheckBoxTreeFlags()
+ {
+ DWORD flags = 0;
+ TVITEMEX tvi;
+ tvi.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE;
+ tvi.hItem = m_tree.GetRoot();
+ while (tvi.hItem) {
+ m_tree.GetItem(&tvi);
+ if (((tvi.state & TVIS_STATEIMAGEMASK) >> 12 == 2))
+ flags |= tvi.lParam;
+ tvi.hItem = m_tree.GetNextSibling(tvi.hItem);
+ }
+ return flags;
+ }
-static void ApplyOptions()
-{
- ReloadGlobals();
- WindowList_Broadcast(g_dat.hParentWindowList, DM_OPTIONSAPPLIED, 0, 0);
- Srmm_Broadcast(DM_OPTIONSAPPLIED, 0, 0);
- Chat_UpdateOptions();
-}
+public:
+ CMainOptionsDlg() :
+ CBaseOptionDlg(IDD_OPT_MSGDLG),
+ m_tree(this, IDC_POPLIST),
+ chkCascade(this, IDC_CASCADE),
+ chkAutoPopup(this, IDC_AUTOPOPUP),
+ chkSendOnEnter(this, IDC_SENDONENTER),
+ chkSendOnDblEnter(this, IDC_SENDONDBLENTER),
+ chkSendOnCtrlEnter(this, IDC_SENDONCTRLENTER),
+ chkSavePerContact(this, IDC_SAVEPERCONTACT)
+ {
+ chkCascade.OnChange = Callback(this, &CMainOptionsDlg::onChange_Cascade);
+ chkAutoPopup.OnChange = Callback(this, &CMainOptionsDlg::onChange_AutoPopup);
+ chkSavePerContact.OnChange = Callback(this, &CMainOptionsDlg::onChange_SavePerContact);
+ }
-/////////////////////////////////////////////////////////////////////////////////////////
+ void 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));
+ chkAutoPopup.SetState(db_get_b(0, SRMM_MODULE, SRMSGSET_AUTOPOPUP, SRMSGDEFSET_AUTOPOPUP));
+
+ CheckDlgButton(m_hwnd, IDC_STAYMINIMIZED, db_get_b(0, SRMM_MODULE, SRMSGSET_STAYMINIMIZED, SRMSGDEFSET_STAYMINIMIZED) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_AUTOMIN, db_get_b(0, SRMM_MODULE, SRMSGSET_AUTOMIN, SRMSGDEFSET_AUTOMIN) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_SAVEDRAFTS, db_get_b(0, SRMM_MODULE, SRMSGSET_SAVEDRAFTS, SRMSGDEFSET_SAVEDRAFTS) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_HIDECONTAINERS, db_get_b(0, SRMM_MODULE, SRMSGSET_HIDECONTAINERS, SRMSGDEFSET_HIDECONTAINERS) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_DELTEMP, db_get_b(0, SRMM_MODULE, SRMSGSET_DELTEMP, SRMSGDEFSET_DELTEMP) ? BST_CHECKED : BST_UNCHECKED);
+
+ SendDlgItemMessage(m_hwnd, IDC_SECONDSSPIN, UDM_SETRANGE, 0, MAKELONG(60, 4));
+ SendDlgItemMessage(m_hwnd, IDC_SECONDSSPIN, UDM_SETPOS, 0, db_get_dw(0, SRMM_MODULE, SRMSGSET_MSGTIMEOUT, SRMSGDEFSET_MSGTIMEOUT) / 1000);
+
+ chkCascade.SetState(db_get_b(0, SRMM_MODULE, SRMSGSET_CASCADE, SRMSGDEFSET_CASCADE));
+ chkSavePerContact.SetState(db_get_b(0, SRMM_MODULE, SRMSGSET_SAVEPERCONTACT, SRMSGDEFSET_SAVEPERCONTACT));
+
+ if (db_get_b(0, SRMM_MODULE, SRMSGSET_SENDONENTER, SRMSGDEFSET_SENDONENTER))
+ CheckDlgButton(m_hwnd, IDC_SENDONENTER, BST_CHECKED);
+ else if (db_get_b(0, SRMM_MODULE, SRMSGSET_SENDONDBLENTER, SRMSGDEFSET_SENDONDBLENTER))
+ CheckDlgButton(m_hwnd, IDC_SENDONDBLENTER, BST_CHECKED);
+ else
+ CheckDlgButton(m_hwnd, IDC_SENDONCTRLENTER, BST_CHECKED);
-static INT_PTR CALLBACK DlgProcTabsOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- int bChecked;
+ onChange_AutoPopup(0);
+ }
- switch (msg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
- {
- CheckDlgButton(hwndDlg, IDC_USETABS, db_get_b(0, SRMM_MODULE, SRMSGSET_USETABS, SRMSGDEFSET_USETABS) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_ALWAYSSHOWTABS, !db_get_b(0, SRMM_MODULE, SRMSGSET_HIDEONETAB, SRMSGDEFSET_HIDEONETAB) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_TABSATBOTTOM, db_get_b(0, SRMM_MODULE, SRMSGSET_TABSATBOTTOM, SRMSGDEFSET_TABSATBOTTOM));
- CheckDlgButton(hwndDlg, IDC_SWITCHTOACTIVE, db_get_b(0, SRMM_MODULE, SRMSGSET_SWITCHTOACTIVE, SRMSGDEFSET_SWITCHTOACTIVE) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_TABCLOSEBUTTON, db_get_b(0, SRMM_MODULE, SRMSGSET_TABCLOSEBUTTON, SRMSGDEFSET_TABCLOSEBUTTON) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_LIMITNAMES, db_get_b(0, SRMM_MODULE, SRMSGSET_LIMITNAMES, SRMSGDEFSET_LIMITNAMES) ? BST_CHECKED : BST_UNCHECKED);
- SendDlgItemMessage(hwndDlg, IDC_LIMITNAMESLENSPIN, UDM_SETRANGE, 0, MAKELONG(100, 0));
- SendDlgItemMessage(hwndDlg, IDC_LIMITNAMESLENSPIN, UDM_SETPOS, 0, db_get_w(0, SRMM_MODULE, SRMSGSET_LIMITNAMESLEN, SRMSGDEFSET_LIMITNAMESLEN));
-
- CheckDlgButton(hwndDlg, IDC_LIMITTABS, db_get_b(0, SRMM_MODULE, SRMSGSET_LIMITTABS, SRMSGDEFSET_LIMITTABS) ? BST_CHECKED : BST_UNCHECKED);
- SendDlgItemMessage(hwndDlg, IDC_LIMITTABSNUMSPIN, UDM_SETRANGE, 0, MAKELONG(100, 1));
- SendDlgItemMessage(hwndDlg, IDC_LIMITTABSNUMSPIN, UDM_SETPOS, 0, db_get_w(0, SRMM_MODULE, SRMSGSET_LIMITTABSNUM, SRMSGDEFSET_LIMITTABSNUM));
-
- CheckDlgButton(hwndDlg, IDC_LIMITCHATSTABS, db_get_b(0, SRMM_MODULE, SRMSGSET_LIMITCHATSTABS, SRMSGDEFSET_LIMITCHATSTABS) ? BST_CHECKED : BST_UNCHECKED);
- SendDlgItemMessage(hwndDlg, IDC_LIMITCHATSTABSNUMSPIN, UDM_SETRANGE, 0, MAKELONG(100, 1));
- SendDlgItemMessage(hwndDlg, IDC_LIMITCHATSTABSNUMSPIN, UDM_SETPOS, 0, db_get_w(0, SRMM_MODULE, SRMSGSET_LIMITCHATSTABSNUM, SRMSGDEFSET_LIMITCHATSTABSNUM));
-
- CheckDlgButton(hwndDlg, IDC_SEPARATECHATSCONTAINERS, db_get_b(0, SRMM_MODULE, SRMSGSET_SEPARATECHATSCONTAINERS, SRMSGDEFSET_SEPARATECHATSCONTAINERS) ? BST_CHECKED : BST_UNCHECKED);
-
- bChecked = IsDlgButtonChecked(hwndDlg, IDC_USETABS);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ALWAYSSHOWTABS), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_TABSATBOTTOM), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_SWITCHTOACTIVE), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_TABCLOSEBUTTON), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITNAMES), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_SEPARATECHATSCONTAINERS), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITTABS), bChecked);
- bChecked = IsDlgButtonChecked(hwndDlg, IDC_USETABS) && IsDlgButtonChecked(hwndDlg, IDC_LIMITNAMES);
- EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITNAMESLEN), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITNAMESLENSPIN), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CHARS), bChecked);
- bChecked = IsDlgButtonChecked(hwndDlg, IDC_USETABS) && IsDlgButtonChecked(hwndDlg, IDC_LIMITTABS);
- EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITTABSNUM), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITTABSNUMSPIN), bChecked);
- bChecked = IsDlgButtonChecked(hwndDlg, IDC_USETABS) && IsDlgButtonChecked(hwndDlg, IDC_SEPARATECHATSCONTAINERS);
- EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITCHATSTABS), bChecked);
- bChecked = bChecked && IsDlgButtonChecked(hwndDlg, IDC_LIMITCHATSTABS);
- EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITCHATSTABSNUM), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITCHATSTABSNUMSPIN), bChecked);
- }
- return TRUE;
+ void OnApply() override
+ {
+ db_set_dw(0, SRMM_MODULE, SRMSGSET_POPFLAGS, MakeCheckBoxTreeFlags());
+ db_set_b(0, SRMM_MODULE, SRMSGSET_AUTOPOPUP, chkAutoPopup.GetState());
+ db_set_b(0, SRMM_MODULE, SRMSGSET_STAYMINIMIZED, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_STAYMINIMIZED));
+ db_set_b(0, SRMM_MODULE, SRMSGSET_AUTOMIN, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_AUTOMIN));
+ db_set_b(0, SRMM_MODULE, SRMSGSET_SAVEDRAFTS, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_SAVEDRAFTS));
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_USETABS:
- bChecked = IsDlgButtonChecked(hwndDlg, IDC_USETABS);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ALWAYSSHOWTABS), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_TABSATBOTTOM), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_SWITCHTOACTIVE), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_TABCLOSEBUTTON), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITNAMES), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_SEPARATECHATSCONTAINERS), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITTABS), bChecked);
-
- case IDC_LIMITTABS:
- bChecked = IsDlgButtonChecked(hwndDlg, IDC_USETABS) && IsDlgButtonChecked(hwndDlg, IDC_LIMITTABS);
- EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITTABSNUM), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITTABSNUMSPIN), bChecked);
-
- case IDC_SEPARATECHATSCONTAINERS:
- bChecked = IsDlgButtonChecked(hwndDlg, IDC_USETABS) && IsDlgButtonChecked(hwndDlg, IDC_SEPARATECHATSCONTAINERS);
- EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITCHATSTABS), bChecked);
-
- case IDC_LIMITCHATSTABS:
- bChecked = IsDlgButtonChecked(hwndDlg, IDC_USETABS) && IsDlgButtonChecked(hwndDlg, IDC_SEPARATECHATSCONTAINERS) &&
- IsDlgButtonChecked(hwndDlg, IDC_LIMITCHATSTABS);
- EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITCHATSTABSNUM), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITCHATSTABSNUMSPIN), bChecked);
-
- case IDC_LIMITNAMES:
- bChecked = IsDlgButtonChecked(hwndDlg, IDC_LIMITNAMES) && IsDlgButtonChecked(hwndDlg, IDC_USETABS);
- EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITNAMESLEN), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITNAMESLENSPIN), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CHARS), bChecked);
- break;
- case IDC_LIMITNAMESLEN:
- case IDC_LIMITTABSNUM:
- case IDC_LIMITCHATSTABSNUM:
- if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())
- return 0;
- break;
- }
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
+ db_set_b(0, SRMM_MODULE, SRMSGSET_DELTEMP, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_DELTEMP));
+ db_set_dw(0, SRMM_MODULE, SRMSGSET_MSGTIMEOUT, (DWORD)SendDlgItemMessage(m_hwnd, IDC_SECONDSSPIN, UDM_GETPOS, 0, 0) * 1000);
- case WM_NOTIFY:
- switch (((LPNMHDR)lParam)->idFrom) {
- case 0:
- switch (((LPNMHDR)lParam)->code) {
- case PSN_WIZFINISH:
- ApplyOptions();
- break;
+ db_set_b(0, SRMM_MODULE, SRMSGSET_SENDONENTER, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_SENDONENTER));
+ db_set_b(0, SRMM_MODULE, SRMSGSET_SENDONDBLENTER, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_SENDONDBLENTER));
+ db_set_b(0, SRMM_MODULE, SRMSGSET_SENDONCTRLENTER, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_SENDONCTRLENTER));
- case PSN_APPLY:
- db_set_b(0, SRMM_MODULE, SRMSGSET_USETABS, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_USETABS));
- db_set_b(0, SRMM_MODULE, SRMSGSET_TABSATBOTTOM, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_TABSATBOTTOM));
- db_set_b(0, SRMM_MODULE, SRMSGSET_LIMITNAMES, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_LIMITNAMES));
- db_set_w(0, SRMM_MODULE, SRMSGSET_LIMITNAMESLEN, (WORD)SendDlgItemMessage(hwndDlg, IDC_LIMITNAMESLENSPIN, UDM_GETPOS, 0, 0));
-
- db_set_b(0, SRMM_MODULE, SRMSGSET_LIMITTABS, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_LIMITTABS));
- db_set_w(0, SRMM_MODULE, SRMSGSET_LIMITTABSNUM, (WORD)SendDlgItemMessage(hwndDlg, IDC_LIMITTABSNUMSPIN, UDM_GETPOS, 0, 0));
- db_set_b(0, SRMM_MODULE, SRMSGSET_LIMITCHATSTABS, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_LIMITCHATSTABS));
- db_set_w(0, SRMM_MODULE, SRMSGSET_LIMITCHATSTABSNUM, (WORD)SendDlgItemMessage(hwndDlg, IDC_LIMITCHATSTABSNUMSPIN, UDM_GETPOS, 0, 0));
-
- db_set_b(0, SRMM_MODULE, SRMSGSET_HIDEONETAB, (BYTE)BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_ALWAYSSHOWTABS));
- db_set_b(0, SRMM_MODULE, SRMSGSET_SWITCHTOACTIVE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SWITCHTOACTIVE));
- db_set_b(0, SRMM_MODULE, SRMSGSET_TABCLOSEBUTTON, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_TABCLOSEBUTTON));
- db_set_b(0, SRMM_MODULE, SRMSGSET_SEPARATECHATSCONTAINERS, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SEPARATECHATSCONTAINERS));
- return TRUE;
- }
- }
- break;
+ db_set_b(0, SRMM_MODULE, SRMSGSET_SAVEPERCONTACT, chkSavePerContact.GetState());
+ 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 FALSE;
-}
-/////////////////////////////////////////////////////////////////////////////////////////
+ void onChange_AutoPopup(CCtrlCheck*)
+ {
+ bool bChecked = chkAutoPopup.GetState();
+ m_tree.Enable(bChecked);
+ EnableWindow(GetDlgItem(m_hwnd, IDC_STAYMINIMIZED), bChecked);
+ }
-static INT_PTR CALLBACK DlgProcLayoutOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- int bChecked;
- char str[10];
+ void onChange_Cascade(CCtrlCheck*)
+ {
+ chkSavePerContact.SetState(!chkCascade.GetState());
+ }
- switch (msg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
- CheckDlgButton(hwndDlg, IDC_SHOWSTATUSBAR, db_get_b(0, SRMM_MODULE, SRMSGSET_SHOWSTATUSBAR, SRMSGDEFSET_SHOWSTATUSBAR) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SHOWTITLEBAR, db_get_b(0, SRMM_MODULE, SRMSGSET_SHOWTITLEBAR, SRMSGDEFSET_SHOWTITLEBAR) ? BST_CHECKED : BST_UNCHECKED);
- SetWindowText(GetDlgItem(hwndDlg, IDC_TITLEFORMAT), g_dat.wszTitleFormat);
- CheckDlgButton(hwndDlg, IDC_SHOWTOOLBAR, db_get_b(0, SRMM_MODULE, SRMSGSET_SHOWBUTTONLINE, SRMSGDEFSET_SHOWBUTTONLINE) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SHOWINFOBAR, db_get_b(0, SRMM_MODULE, SRMSGSET_SHOWINFOBAR, SRMSGDEFSET_SHOWINFOBAR) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_TRANSPARENCY, db_get_b(0, SRMM_MODULE, SRMSGSET_USETRANSPARENCY, SRMSGDEFSET_USETRANSPARENCY) ? BST_CHECKED : BST_UNCHECKED);
- SendDlgItemMessage(hwndDlg, IDC_ATRANSPARENCYVALUE, TBM_SETRANGE, FALSE, MAKELONG(0, 255));
- SendDlgItemMessage(hwndDlg, IDC_ATRANSPARENCYVALUE, TBM_SETPOS, TRUE, db_get_dw(0, SRMM_MODULE, SRMSGSET_ACTIVEALPHA, SRMSGDEFSET_ACTIVEALPHA));
- SendDlgItemMessage(hwndDlg, IDC_ITRANSPARENCYVALUE, TBM_SETRANGE, FALSE, MAKELONG(0, 255));
- SendDlgItemMessage(hwndDlg, IDC_ITRANSPARENCYVALUE, TBM_SETPOS, TRUE, db_get_dw(0, SRMM_MODULE, SRMSGSET_INACTIVEALPHA, SRMSGDEFSET_INACTIVEALPHA));
- mir_snprintf(str, "%d%%", (int)(100 * SendDlgItemMessage(hwndDlg, IDC_ATRANSPARENCYVALUE, TBM_GETPOS, 0, 0) / 255));
- SetDlgItemTextA(hwndDlg, IDC_ATRANSPARENCYPERC, str);
- mir_snprintf(str, "%d%%", (int)(100 * SendDlgItemMessage(hwndDlg, IDC_ITRANSPARENCYVALUE, TBM_GETPOS, 0, 0) / 255));
- SetDlgItemTextA(hwndDlg, IDC_ITRANSPARENCYPERC, str);
- SendDlgItemMessage(hwndDlg, IDC_INPUTLINESSPIN, UDM_SETRANGE, 0, MAKELONG(100, 1));
- SendDlgItemMessage(hwndDlg, IDC_INPUTLINESSPIN, UDM_SETPOS, 0, db_get_w(0, SRMM_MODULE, SRMSGSET_AUTORESIZELINES, SRMSGDEFSET_AUTORESIZELINES));
-
- bChecked = IsDlgButtonChecked(hwndDlg, IDC_SHOWTITLEBAR);
- EnableWindow(GetDlgItem(hwndDlg, IDC_TITLEFORMAT), bChecked);
-
- bChecked = IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENCY);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ATRANSPARENCYVALUE), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ATRANSPARENCYPERC), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ITRANSPARENCYVALUE), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ITRANSPARENCYPERC), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_TRANSPARENCYTEXT1), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_TRANSPARENCYTEXT2), bChecked);
-
- CheckDlgButton(hwndDlg, IDC_SHOWPROGRESS, db_get_b(0, SRMM_MODULE, SRMSGSET_SHOWPROGRESS, SRMSGDEFSET_SHOWPROGRESS) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_AVATARSUPPORT, g_dat.flags & SMF_AVATAR);
- return TRUE;
+ void onChange_SavePerContact(CCtrlCheck*)
+ {
+ chkCascade.SetState(!chkSavePerContact.GetState());
+ }
+};
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_TRANSPARENCY:
- bChecked = IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENCY);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ATRANSPARENCYVALUE), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ATRANSPARENCYPERC), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ITRANSPARENCYVALUE), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ITRANSPARENCYPERC), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_TRANSPARENCYTEXT1), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_TRANSPARENCYTEXT2), bChecked);
- break;
+/////////////////////////////////////////////////////////////////////////////////////////
- case IDC_SHOWTITLEBAR:
- bChecked = IsDlgButtonChecked(hwndDlg, IDC_SHOWTITLEBAR);
- EnableWindow(GetDlgItem(hwndDlg, IDC_TITLEFORMAT), bChecked);
+class CTabsOptionsDlg : public CBaseOptionDlg
+{
+ CCtrlCheck chkUseTabs, chkLimitTabs, chkLimitChatTabs, chkLimitNames, chkSeparateChats;
- case IDC_INPUTLINES:
- if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())
- return 0;
- break;
- }
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
+public:
+ CTabsOptionsDlg() :
+ CBaseOptionDlg(IDD_OPT_MSGTABS),
+ chkUseTabs(this, IDC_USETABS),
+ chkLimitTabs(this, IDC_LIMITTABS),
+ chkLimitNames(this, IDC_LIMITNAMES),
+ chkLimitChatTabs(this, IDC_LIMITCHATSTABS),
+ chkSeparateChats(this, IDC_SEPARATECHATSCONTAINERS)
+ {
+ chkUseTabs.OnChange = Callback(this, &CTabsOptionsDlg::onChange_UseTabs);
+ chkLimitTabs.OnChange = Callback(this, &CTabsOptionsDlg::onChange_LimitTabs);
+ chkLimitNames.OnChange = Callback(this, &CTabsOptionsDlg::onChange_LimitNames);
+ chkLimitChatTabs.OnChange = Callback(this, &CTabsOptionsDlg::onChange_LimitChatTabs);
+ chkSeparateChats.OnChange = Callback(this, &CTabsOptionsDlg::onChange_SeparateChats);
+ }
- case WM_HSCROLL:
- mir_snprintf(str, "%d%%", (int)(100 * SendDlgItemMessage(hwndDlg, IDC_ATRANSPARENCYVALUE, TBM_GETPOS, 0, 0) / 256));
- SetDlgItemTextA(hwndDlg, IDC_ATRANSPARENCYPERC, str);
- mir_snprintf(str, "%d%%", (int)(100 * SendDlgItemMessage(hwndDlg, IDC_ITRANSPARENCYVALUE, TBM_GETPOS, 0, 0) / 256));
- SetDlgItemTextA(hwndDlg, IDC_ITRANSPARENCYPERC, str);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
+ void 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);
+ CheckDlgButton(m_hwnd, IDC_TABSATBOTTOM, db_get_b(0, SRMM_MODULE, SRMSGSET_TABSATBOTTOM, SRMSGDEFSET_TABSATBOTTOM));
+ CheckDlgButton(m_hwnd, IDC_SWITCHTOACTIVE, db_get_b(0, SRMM_MODULE, SRMSGSET_SWITCHTOACTIVE, SRMSGDEFSET_SWITCHTOACTIVE) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_TABCLOSEBUTTON, db_get_b(0, SRMM_MODULE, SRMSGSET_TABCLOSEBUTTON, SRMSGDEFSET_TABCLOSEBUTTON) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_LIMITNAMES, db_get_b(0, SRMM_MODULE, SRMSGSET_LIMITNAMES, SRMSGDEFSET_LIMITNAMES) ? BST_CHECKED : BST_UNCHECKED);
+ SendDlgItemMessage(m_hwnd, IDC_LIMITNAMESLENSPIN, UDM_SETRANGE, 0, MAKELONG(100, 0));
+ SendDlgItemMessage(m_hwnd, IDC_LIMITNAMESLENSPIN, UDM_SETPOS, 0, db_get_w(0, SRMM_MODULE, SRMSGSET_LIMITNAMESLEN, SRMSGDEFSET_LIMITNAMESLEN));
+
+ CheckDlgButton(m_hwnd, IDC_LIMITTABS, db_get_b(0, SRMM_MODULE, SRMSGSET_LIMITTABS, SRMSGDEFSET_LIMITTABS) ? BST_CHECKED : BST_UNCHECKED);
+ SendDlgItemMessage(m_hwnd, IDC_LIMITTABSNUMSPIN, UDM_SETRANGE, 0, MAKELONG(100, 1));
+ SendDlgItemMessage(m_hwnd, IDC_LIMITTABSNUMSPIN, UDM_SETPOS, 0, db_get_w(0, SRMM_MODULE, SRMSGSET_LIMITTABSNUM, SRMSGDEFSET_LIMITTABSNUM));
+
+ CheckDlgButton(m_hwnd, IDC_LIMITCHATSTABS, db_get_b(0, SRMM_MODULE, SRMSGSET_LIMITCHATSTABS, SRMSGDEFSET_LIMITCHATSTABS) ? BST_CHECKED : BST_UNCHECKED);
+ SendDlgItemMessage(m_hwnd, IDC_LIMITCHATSTABSNUMSPIN, UDM_SETRANGE, 0, MAKELONG(100, 1));
+ SendDlgItemMessage(m_hwnd, IDC_LIMITCHATSTABSNUMSPIN, UDM_SETPOS, 0, db_get_w(0, SRMM_MODULE, SRMSGSET_LIMITCHATSTABSNUM, SRMSGDEFSET_LIMITCHATSTABSNUM));
+
+ CheckDlgButton(m_hwnd, IDC_SEPARATECHATSCONTAINERS, db_get_b(0, SRMM_MODULE, SRMSGSET_SEPARATECHATSCONTAINERS, SRMSGDEFSET_SEPARATECHATSCONTAINERS) ? BST_CHECKED : BST_UNCHECKED);
+
+ onChange_UseTabs(0);
+ }
- case WM_NOTIFY:
- switch (((LPNMHDR)lParam)->idFrom) {
- case 0:
- switch (((LPNMHDR)lParam)->code) {
- case PSN_WIZFINISH:
- ApplyOptions();
- break;
+ void 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));
+ db_set_b(0, SRMM_MODULE, SRMSGSET_LIMITNAMES, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_LIMITNAMES));
+ db_set_w(0, SRMM_MODULE, SRMSGSET_LIMITNAMESLEN, (WORD)SendDlgItemMessage(m_hwnd, IDC_LIMITNAMESLENSPIN, UDM_GETPOS, 0, 0));
+
+ db_set_b(0, SRMM_MODULE, SRMSGSET_LIMITTABS, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_LIMITTABS));
+ db_set_w(0, SRMM_MODULE, SRMSGSET_LIMITTABSNUM, (WORD)SendDlgItemMessage(m_hwnd, IDC_LIMITTABSNUMSPIN, UDM_GETPOS, 0, 0));
+ db_set_b(0, SRMM_MODULE, SRMSGSET_LIMITCHATSTABS, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_LIMITCHATSTABS));
+ db_set_w(0, SRMM_MODULE, SRMSGSET_LIMITCHATSTABSNUM, (WORD)SendDlgItemMessage(m_hwnd, IDC_LIMITCHATSTABSNUMSPIN, UDM_GETPOS, 0, 0));
+
+ db_set_b(0, SRMM_MODULE, SRMSGSET_HIDEONETAB, (BYTE)BST_UNCHECKED == IsDlgButtonChecked(m_hwnd, IDC_ALWAYSSHOWTABS));
+ 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));
+ }
- case PSN_APPLY:
- GetWindowText(GetDlgItem(hwndDlg, IDC_TITLEFORMAT), g_dat.wszTitleFormat, _countof(g_dat.wszTitleFormat));
- db_set_ws(0, SRMM_MODULE, SRMSGSET_WINDOWTITLE, g_dat.wszTitleFormat);
+ void onChange_UseTabs(CCtrlCheck*)
+ {
+ int bChecked = chkUseTabs.GetState();
+ EnableWindow(GetDlgItem(m_hwnd, IDC_ALWAYSSHOWTABS), bChecked);
+ EnableWindow(GetDlgItem(m_hwnd, IDC_TABSATBOTTOM), bChecked);
+ EnableWindow(GetDlgItem(m_hwnd, IDC_SWITCHTOACTIVE), bChecked);
+ EnableWindow(GetDlgItem(m_hwnd, IDC_TABCLOSEBUTTON), bChecked);
+ EnableWindow(GetDlgItem(m_hwnd, IDC_LIMITNAMES), bChecked);
+ EnableWindow(GetDlgItem(m_hwnd, IDC_SEPARATECHATSCONTAINERS), bChecked);
+ EnableWindow(GetDlgItem(m_hwnd, IDC_LIMITTABS), bChecked);
+
+ onChange_LimitTabs(0);
+ onChange_LimitNames(0);
+ onChange_SeparateChats(0);
+ }
- db_set_b(0, SRMM_MODULE, SRMSGSET_SHOWSTATUSBAR, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWSTATUSBAR));
- db_set_b(0, SRMM_MODULE, SRMSGSET_SHOWTITLEBAR, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWTITLEBAR));
- db_set_b(0, SRMM_MODULE, SRMSGSET_SHOWBUTTONLINE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWTOOLBAR));
- db_set_b(0, SRMM_MODULE, SRMSGSET_SHOWINFOBAR, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWINFOBAR));
+ void onChange_LimitTabs(CCtrlCheck*)
+ {
+ int bChecked = chkUseTabs.GetState() && chkLimitTabs.GetState();
+ EnableWindow(GetDlgItem(m_hwnd, IDC_LIMITTABSNUM), bChecked);
+ EnableWindow(GetDlgItem(m_hwnd, IDC_LIMITTABSNUMSPIN), bChecked);
+ }
- db_set_b(0, SRMM_MODULE, SRMSGSET_USETRANSPARENCY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENCY));
- db_set_dw(0, SRMM_MODULE, SRMSGSET_ACTIVEALPHA, SendDlgItemMessage(hwndDlg, IDC_ATRANSPARENCYVALUE, TBM_GETPOS, 0, 0));
- db_set_dw(0, SRMM_MODULE, SRMSGSET_INACTIVEALPHA, SendDlgItemMessage(hwndDlg, IDC_ITRANSPARENCYVALUE, TBM_GETPOS, 0, 0));
+ void onChange_SeparateChats(CCtrlCheck*)
+ {
+ int bChecked = chkUseTabs.GetState() && chkSeparateChats.GetState();
+ EnableWindow(GetDlgItem(m_hwnd, IDC_LIMITCHATSTABS), bChecked);
- db_set_b(0, SRMM_MODULE, SRMSGSET_SHOWPROGRESS, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWPROGRESS));
+ onChange_LimitChatTabs(0);
+ }
- db_set_b(0, SRMM_MODULE, SRMSGSET_AVATARENABLE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AVATARSUPPORT));
+ void onChange_LimitChatTabs(CCtrlCheck*)
+ {
+ int bChecked = chkUseTabs.GetState() && IsDlgButtonChecked(m_hwnd, IDC_SEPARATECHATSCONTAINERS) && chkLimitChatTabs.GetState();
+ EnableWindow(GetDlgItem(m_hwnd, IDC_LIMITCHATSTABSNUM), bChecked);
+ EnableWindow(GetDlgItem(m_hwnd, IDC_LIMITCHATSTABSNUMSPIN), bChecked);
+ }
- db_set_w(0, SRMM_MODULE, SRMSGSET_AUTORESIZELINES, (WORD)SendDlgItemMessage(hwndDlg, IDC_INPUTLINESSPIN, UDM_GETPOS, 0, 0));
- LoadInfobarFonts();
- return TRUE;
- }
- }
- break;
+ void onChange_LimitNames(CCtrlCheck*)
+ {
+ int bChecked = chkUseTabs.GetState() && chkLimitNames.GetState();
+ EnableWindow(GetDlgItem(m_hwnd, IDC_LIMITNAMESLEN), bChecked);
+ EnableWindow(GetDlgItem(m_hwnd, IDC_LIMITNAMESLENSPIN), bChecked);
+ EnableWindow(GetDlgItem(m_hwnd, IDC_CHARS), bChecked);
}
- return FALSE;
-}
+};
/////////////////////////////////////////////////////////////////////////////////////////
-static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+class CLayoutOptionsDlg : public CBaseOptionDlg
{
- switch (msg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_POPLIST), GWL_STYLE, (GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_POPLIST), GWL_STYLE) & ~WS_BORDER) | TVS_NOHSCROLL | TVS_CHECKBOXES);
- FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_POPLIST), statusValues, sizeof(statusValues) / sizeof(statusValues[0]),
- db_get_dw(0, SRMM_MODULE, SRMSGSET_POPFLAGS, SRMSGDEFSET_POPFLAGS));
- CheckDlgButton(hwndDlg, IDC_AUTOPOPUP, db_get_b(0, SRMM_MODULE, SRMSGSET_AUTOPOPUP, SRMSGDEFSET_AUTOPOPUP) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_STAYMINIMIZED, db_get_b(0, SRMM_MODULE, SRMSGSET_STAYMINIMIZED, SRMSGDEFSET_STAYMINIMIZED) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_AUTOMIN, db_get_b(0, SRMM_MODULE, SRMSGSET_AUTOMIN, SRMSGDEFSET_AUTOMIN) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SAVEDRAFTS, db_get_b(0, SRMM_MODULE, SRMSGSET_SAVEDRAFTS, SRMSGDEFSET_SAVEDRAFTS) ? BST_CHECKED : BST_UNCHECKED);
-
- CheckDlgButton(hwndDlg, IDC_DELTEMP, db_get_b(0, SRMM_MODULE, SRMSGSET_DELTEMP, SRMSGDEFSET_DELTEMP) ? BST_CHECKED : BST_UNCHECKED);
- SendDlgItemMessage(hwndDlg, IDC_SECONDSSPIN, UDM_SETRANGE, 0, MAKELONG(60, 4));
- SendDlgItemMessage(hwndDlg, IDC_SECONDSSPIN, UDM_SETPOS, 0, db_get_dw(0, SRMM_MODULE, SRMSGSET_MSGTIMEOUT, SRMSGDEFSET_MSGTIMEOUT) / 1000);
-
- CheckDlgButton(hwndDlg, IDC_SAVEPERCONTACT, db_get_b(0, SRMM_MODULE, SRMSGSET_SAVEPERCONTACT, SRMSGDEFSET_SAVEPERCONTACT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CASCADE, db_get_b(0, SRMM_MODULE, SRMSGSET_CASCADE, SRMSGDEFSET_CASCADE) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SENDONENTER, db_get_b(0, SRMM_MODULE, SRMSGSET_SENDONENTER, SRMSGDEFSET_SENDONENTER) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SENDONDBLENTER, db_get_b(0, SRMM_MODULE, SRMSGSET_SENDONDBLENTER, SRMSGDEFSET_SENDONDBLENTER) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_HIDECONTAINERS, db_get_b(0, SRMM_MODULE, SRMSGSET_HIDECONTAINERS, SRMSGDEFSET_HIDECONTAINERS) ? BST_CHECKED : BST_UNCHECKED);
-
- EnableWindow(GetDlgItem(hwndDlg, IDC_STAYMINIMIZED), IsDlgButtonChecked(hwndDlg, IDC_AUTOPOPUP));
- EnableWindow(GetDlgItem(hwndDlg, IDC_POPLIST), IsDlgButtonChecked(hwndDlg, IDC_AUTOPOPUP));
- return TRUE;
+ CCtrlCheck chkTransparency, chkShowTitlebar;
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_AUTOPOPUP:
- EnableWindow(GetDlgItem(hwndDlg, IDC_STAYMINIMIZED), IsDlgButtonChecked(hwndDlg, IDC_AUTOPOPUP));
- EnableWindow(GetDlgItem(hwndDlg, IDC_POPLIST), IsDlgButtonChecked(hwndDlg, IDC_AUTOPOPUP));
- break;
- case IDC_AUTOMIN:
- break;
- case IDC_SECONDS:
- if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())
- return 0;
- break;
- case IDC_SENDONENTER:
- CheckDlgButton(hwndDlg, IDC_SENDONDBLENTER, BST_UNCHECKED);
- break;
- case IDC_SENDONDBLENTER:
- CheckDlgButton(hwndDlg, IDC_SENDONENTER, BST_UNCHECKED);
- break;
- case IDC_CASCADE:
- CheckDlgButton(hwndDlg, IDC_SAVEPERCONTACT, BST_UNCHECKED);
- break;
- case IDC_SAVEPERCONTACT:
- CheckDlgButton(hwndDlg, IDC_CASCADE, BST_UNCHECKED);
- break;
- }
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
+public:
+ CLayoutOptionsDlg() :
+ CBaseOptionDlg(IDD_OPT_LAYOUT),
+ chkTransparency(this, IDC_TRANSPARENCY),
+ chkShowTitlebar(this, IDC_SHOWTITLEBAR)
+ {
+ chkTransparency.OnChange = Callback(this, &CLayoutOptionsDlg::onChange_Transparency);
+ chkShowTitlebar.OnChange = Callback(this, &CLayoutOptionsDlg::onChange_ShowTitlebar);
+ }
- case WM_NOTIFY:
- switch (((LPNMHDR)lParam)->idFrom) {
- case IDC_POPLIST:
- if (((LPNMHDR)lParam)->code == NM_CLICK) {
- TVHITTESTINFO hti;
- hti.pt.x = (short)LOWORD(GetMessagePos());
- hti.pt.y = (short)HIWORD(GetMessagePos());
- ScreenToClient(((LPNMHDR)lParam)->hwndFrom, &hti.pt);
- if (TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &hti)) {
- if (hti.flags & TVHT_ONITEMSTATEICON) {
- TVITEM tvi;
- tvi.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
- tvi.hItem = hti.hItem;
- TreeView_GetItem(((LPNMHDR)lParam)->hwndFrom, &tvi);
- tvi.iImage = tvi.iSelectedImage = tvi.iImage == 1 ? 2 : 1;
- TreeView_SetItem(((LPNMHDR)lParam)->hwndFrom, &tvi);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- }
- }
- else if (((LPNMHDR)lParam)->code == TVN_KEYDOWN) {
- if (((LPNMTVKEYDOWN)lParam)->wVKey == VK_SPACE)
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- break;
+ void 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);
+ SetWindowText(GetDlgItem(m_hwnd, IDC_TITLEFORMAT), g_dat.wszTitleFormat);
+ CheckDlgButton(m_hwnd, IDC_SHOWTOOLBAR, db_get_b(0, SRMM_MODULE, SRMSGSET_SHOWBUTTONLINE, SRMSGDEFSET_SHOWBUTTONLINE) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_SHOWINFOBAR, db_get_b(0, SRMM_MODULE, SRMSGSET_SHOWINFOBAR, SRMSGDEFSET_SHOWINFOBAR) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_TRANSPARENCY, db_get_b(0, SRMM_MODULE, SRMSGSET_USETRANSPARENCY, SRMSGDEFSET_USETRANSPARENCY) ? BST_CHECKED : BST_UNCHECKED);
+ SendDlgItemMessage(m_hwnd, IDC_ATRANSPARENCYVALUE, TBM_SETRANGE, FALSE, MAKELONG(0, 255));
+ SendDlgItemMessage(m_hwnd, IDC_ATRANSPARENCYVALUE, TBM_SETPOS, TRUE, db_get_dw(0, SRMM_MODULE, SRMSGSET_ACTIVEALPHA, SRMSGDEFSET_ACTIVEALPHA));
+ SendDlgItemMessage(m_hwnd, IDC_ITRANSPARENCYVALUE, TBM_SETRANGE, FALSE, MAKELONG(0, 255));
+ SendDlgItemMessage(m_hwnd, IDC_ITRANSPARENCYVALUE, TBM_SETPOS, TRUE, db_get_dw(0, SRMM_MODULE, SRMSGSET_INACTIVEALPHA, SRMSGDEFSET_INACTIVEALPHA));
+
+ char str[10];
+ mir_snprintf(str, "%d%%", (int)(100 * SendDlgItemMessage(m_hwnd, IDC_ATRANSPARENCYVALUE, TBM_GETPOS, 0, 0) / 255));
+ SetDlgItemTextA(m_hwnd, IDC_ATRANSPARENCYPERC, str);
+
+ mir_snprintf(str, "%d%%", (int)(100 * SendDlgItemMessage(m_hwnd, IDC_ITRANSPARENCYVALUE, TBM_GETPOS, 0, 0) / 255));
+ SetDlgItemTextA(m_hwnd, IDC_ITRANSPARENCYPERC, str);
+
+ SendDlgItemMessage(m_hwnd, IDC_INPUTLINESSPIN, UDM_SETRANGE, 0, MAKELONG(100, 1));
+ SendDlgItemMessage(m_hwnd, IDC_INPUTLINESSPIN, UDM_SETPOS, 0, db_get_w(0, SRMM_MODULE, SRMSGSET_AUTORESIZELINES, SRMSGDEFSET_AUTORESIZELINES));
+
+ onChange_Transparency(0);
+ onChange_ShowTitlebar(0);
+
+ 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);
+ }
- case 0:
- switch (((LPNMHDR)lParam)->code) {
- case PSN_WIZFINISH:
- ApplyOptions();
- break;
+ void 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);
- case PSN_APPLY:
- db_set_dw(0, SRMM_MODULE, SRMSGSET_POPFLAGS, MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg, IDC_POPLIST)));
- db_set_b(0, SRMM_MODULE, SRMSGSET_AUTOPOPUP, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOPOPUP));
- db_set_b(0, SRMM_MODULE, SRMSGSET_STAYMINIMIZED, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_STAYMINIMIZED));
- db_set_b(0, SRMM_MODULE, SRMSGSET_AUTOMIN, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOMIN));
- db_set_b(0, SRMM_MODULE, SRMSGSET_SAVEDRAFTS, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SAVEDRAFTS));
-
- db_set_b(0, SRMM_MODULE, SRMSGSET_DELTEMP, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DELTEMP));
- db_set_dw(0, SRMM_MODULE, SRMSGSET_MSGTIMEOUT, (DWORD)SendDlgItemMessage(hwndDlg, IDC_SECONDSSPIN, UDM_GETPOS, 0, 0) * 1000);
-
- db_set_b(0, SRMM_MODULE, SRMSGSET_SENDONENTER, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SENDONENTER));
- db_set_b(0, SRMM_MODULE, SRMSGSET_SENDONDBLENTER, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SENDONDBLENTER));
- db_set_b(0, SRMM_MODULE, SRMSGSET_SAVEPERCONTACT, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SAVEPERCONTACT));
- db_set_b(0, SRMM_MODULE, SRMSGSET_CASCADE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CASCADE));
-
- db_set_b(0, SRMM_MODULE, SRMSGSET_HIDECONTAINERS, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_HIDECONTAINERS));
- return TRUE;
- }
+ db_set_b(0, SRMM_MODULE, SRMSGSET_SHOWSTATUSBAR, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_SHOWSTATUSBAR));
+ db_set_b(0, SRMM_MODULE, SRMSGSET_SHOWTITLEBAR, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_SHOWTITLEBAR));
+ db_set_b(0, SRMM_MODULE, SRMSGSET_SHOWBUTTONLINE, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_SHOWTOOLBAR));
+ db_set_b(0, SRMM_MODULE, SRMSGSET_SHOWINFOBAR, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_SHOWINFOBAR));
+
+ db_set_b(0, SRMM_MODULE, SRMSGSET_USETRANSPARENCY, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_TRANSPARENCY));
+ db_set_dw(0, SRMM_MODULE, SRMSGSET_ACTIVEALPHA, SendDlgItemMessage(m_hwnd, IDC_ATRANSPARENCYVALUE, TBM_GETPOS, 0, 0));
+ db_set_dw(0, SRMM_MODULE, SRMSGSET_INACTIVEALPHA, SendDlgItemMessage(m_hwnd, IDC_ITRANSPARENCYVALUE, TBM_GETPOS, 0, 0));
+
+ db_set_b(0, SRMM_MODULE, SRMSGSET_SHOWPROGRESS, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_SHOWPROGRESS));
+
+ db_set_b(0, SRMM_MODULE, SRMSGSET_AVATARENABLE, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_AVATARSUPPORT));
+
+ db_set_w(0, SRMM_MODULE, SRMSGSET_AUTORESIZELINES, (WORD)SendDlgItemMessage(m_hwnd, IDC_INPUTLINESSPIN, UDM_GETPOS, 0, 0));
+ LoadInfobarFonts();
+ }
+
+ void onChange_Transparency(CCtrlCheck*)
+ {
+ int bChecked = IsDlgButtonChecked(m_hwnd, IDC_TRANSPARENCY);
+ EnableWindow(GetDlgItem(m_hwnd, IDC_ATRANSPARENCYVALUE), bChecked);
+ EnableWindow(GetDlgItem(m_hwnd, IDC_ATRANSPARENCYPERC), bChecked);
+ EnableWindow(GetDlgItem(m_hwnd, IDC_ITRANSPARENCYVALUE), bChecked);
+ EnableWindow(GetDlgItem(m_hwnd, IDC_ITRANSPARENCYPERC), bChecked);
+ EnableWindow(GetDlgItem(m_hwnd, IDC_TRANSPARENCYTEXT1), bChecked);
+ EnableWindow(GetDlgItem(m_hwnd, IDC_TRANSPARENCYTEXT2), bChecked);
+ }
+
+ void onChange_ShowTitlebar(CCtrlCheck*)
+ {
+ int bChecked = IsDlgButtonChecked(m_hwnd, IDC_SHOWTITLEBAR);
+ EnableWindow(GetDlgItem(m_hwnd, IDC_TITLEFORMAT), bChecked);
+ }
+
+ INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override
+ {
+ if (msg == WM_HSCROLL) {
+ char str[10];
+ mir_snprintf(str, "%d%%", (int)(100 * SendDlgItemMessage(m_hwnd, IDC_ATRANSPARENCYVALUE, TBM_GETPOS, 0, 0) / 256));
+ SetDlgItemTextA(m_hwnd, IDC_ATRANSPARENCYPERC, str);
+
+ mir_snprintf(str, "%d%%", (int)(100 * SendDlgItemMessage(m_hwnd, IDC_ITRANSPARENCYVALUE, TBM_GETPOS, 0, 0) / 256));
+ SetDlgItemTextA(m_hwnd, IDC_ITRANSPARENCYPERC, str);
+ SendMessage(GetParent(m_hwnd), PSM_CHANGED, 0, 0);
}
- break;
+
+ return CBaseOptionDlg::DlgProc(msg, wParam, lParam);
}
- return FALSE;
-}
+};
/////////////////////////////////////////////////////////////////////////////////////////
-class CLogOptionsDlg : public CDlgBase
+class CLogOptionsDlg : public CBaseOptionDlg
{
+ CCtrlCheck chkLoadUnread, chkLoadCount, chkLoadTime;
+ CCtrlCheck chkShowTime, chkShowDate, chkGroupMsg, chkIndentText;
CCtrlRichEdit m_log;
+ CCtrlHyperlink m_fonts;
- void ShowPreview()
+ void OnChange() override
{
m_log.SetText(L"");
@@ -622,9 +592,25 @@ class CLogOptionsDlg : public CDlgBase public:
CLogOptionsDlg() :
- CDlgBase(g_hInst, IDD_OPT_MSGLOG),
- m_log(this, IDC_SRMM_LOG)
- {}
+ CBaseOptionDlg(IDD_OPT_MSGLOG),
+ m_log(this, IDC_SRMM_LOG),
+ m_fonts(this, IDC_FONTSCOLORS),
+ chkShowTime(this, IDC_SHOWTIMES),
+ chkShowDate(this, IDC_SHOWDATES),
+ chkGroupMsg(this, IDC_GROUPMESSAGES),
+ chkIndentText(this, IDC_INDENTTEXT),
+ chkLoadTime(this, IDC_LOADTIME),
+ chkLoadCount(this, IDC_LOADCOUNT),
+ chkLoadUnread(this, IDC_LOADUNREAD)
+ {
+ m_fonts.OnClick = Callback(this, &CLogOptionsDlg::onClick_Fonts);
+
+ chkLoadTime.OnChange = chkLoadCount.OnChange = chkLoadUnread.OnChange = Callback(this, &CLogOptionsDlg::onChange_Time);
+ chkShowDate.OnChange = Callback(this, &CLogOptionsDlg::onChange_Dates);
+ chkShowTime.OnChange = Callback(this, &CLogOptionsDlg::onChange_Times);
+ chkGroupMsg.OnChange = Callback(this, &CLogOptionsDlg::onChange_GroupMsg);
+ chkIndentText.OnChange = Callback(this, &CLogOptionsDlg::onChange_IndentText);
+ }
virtual void OnInitDialog() override
{
@@ -634,17 +620,13 @@ public: break;
case LOADHISTORY_COUNT:
CheckDlgButton(m_hwnd, IDC_LOADCOUNT, BST_CHECKED);
- EnableWindow(GetDlgItem(m_hwnd, IDC_LOADCOUNTN), TRUE);
- EnableWindow(GetDlgItem(m_hwnd, IDC_LOADCOUNTSPIN), TRUE);
- EnableWindow(GetDlgItem(m_hwnd, IDC_LOADCOUNTTEXT2), TRUE);
break;
case LOADHISTORY_TIME:
CheckDlgButton(m_hwnd, IDC_LOADTIME, BST_CHECKED);
- EnableWindow(GetDlgItem(m_hwnd, IDC_LOADTIMEN), TRUE);
- EnableWindow(GetDlgItem(m_hwnd, IDC_LOADTIMESPIN), TRUE);
- EnableWindow(GetDlgItem(m_hwnd, IDC_STMINSOLD), TRUE);
break;
}
+ onChange_Time(0);
+
SendDlgItemMessage(m_hwnd, IDC_LOADCOUNTSPIN, UDM_SETRANGE, 0, MAKELONG(100, 0));
SendDlgItemMessage(m_hwnd, IDC_LOADCOUNTSPIN, UDM_SETPOS, 0, db_get_w(0, SRMM_MODULE, SRMSGSET_LOADCOUNT, SRMSGDEFSET_LOADCOUNT));
SendDlgItemMessage(m_hwnd, IDC_LOADTIMESPIN, UDM_SETRANGE, 0, MAKELONG(12 * 60, 0));
@@ -658,28 +640,24 @@ public: CheckDlgButton(m_hwnd, IDC_SHOWNAMES, !db_get_b(0, SRMM_MODULE, SRMSGSET_HIDENAMES, SRMSGDEFSET_HIDENAMES) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(m_hwnd, IDC_SHOWTIMES, db_get_b(0, SRMM_MODULE, SRMSGSET_SHOWTIME, SRMSGDEFSET_SHOWTIME) ? BST_CHECKED : BST_UNCHECKED);
- BOOL bChecked = IsDlgButtonChecked(m_hwnd, IDC_SHOWTIMES);
- EnableWindow(GetDlgItem(m_hwnd, IDC_SHOWSECONDS), bChecked);
- EnableWindow(GetDlgItem(m_hwnd, IDC_SHOWDATES), bChecked);
+ onChange_Times(0);
+
CheckDlgButton(m_hwnd, IDC_SHOWSECONDS, db_get_b(0, SRMM_MODULE, SRMSGSET_SHOWSECONDS, SRMSGDEFSET_SHOWSECONDS) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(m_hwnd, IDC_SHOWDATES, db_get_b(0, SRMM_MODULE, SRMSGSET_SHOWDATE, SRMSGDEFSET_SHOWDATE) ? BST_CHECKED : BST_UNCHECKED);
- bChecked = IsDlgButtonChecked(m_hwnd, IDC_SHOWDATES) && IsDlgButtonChecked(m_hwnd, IDC_SHOWTIMES);
- EnableWindow(GetDlgItem(m_hwnd, IDC_USELONGDATE), bChecked);
- EnableWindow(GetDlgItem(m_hwnd, IDC_USERELATIVEDATE), bChecked);
+ onChange_Dates(0);
+
CheckDlgButton(m_hwnd, IDC_USELONGDATE, db_get_b(0, SRMM_MODULE, SRMSGSET_USELONGDATE, SRMSGDEFSET_USELONGDATE) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(m_hwnd, IDC_USERELATIVEDATE, db_get_b(0, SRMM_MODULE, SRMSGSET_USERELATIVEDATE, SRMSGDEFSET_USERELATIVEDATE) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(m_hwnd, IDC_GROUPMESSAGES, db_get_b(0, SRMM_MODULE, SRMSGSET_GROUPMESSAGES, SRMSGDEFSET_GROUPMESSAGES) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(m_hwnd, IDC_MARKFOLLOWUPS, db_get_b(0, SRMM_MODULE, SRMSGSET_MARKFOLLOWUPS, SRMSGDEFSET_MARKFOLLOWUPS) ? BST_CHECKED : BST_UNCHECKED);
- EnableWindow(GetDlgItem(m_hwnd, IDC_MARKFOLLOWUPS), IsDlgButtonChecked(m_hwnd, IDC_GROUPMESSAGES));
+ onChange_GroupMsg(0);
CheckDlgButton(m_hwnd, IDC_MESSAGEONNEWLINE, db_get_b(0, SRMM_MODULE, SRMSGSET_MESSAGEONNEWLINE, SRMSGDEFSET_MESSAGEONNEWLINE) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(m_hwnd, IDC_DRAWLINES, db_get_b(0, SRMM_MODULE, SRMSGSET_DRAWLINES, SRMSGDEFSET_DRAWLINES) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(m_hwnd, IDC_INDENTTEXT, db_get_b(0, SRMM_MODULE, SRMSGSET_INDENTTEXT, SRMSGDEFSET_INDENTTEXT) ? BST_CHECKED : BST_UNCHECKED);
- bChecked = IsDlgButtonChecked(m_hwnd, IDC_INDENTTEXT);
- EnableWindow(GetDlgItem(m_hwnd, IDC_INDENTSIZE), bChecked);
- EnableWindow(GetDlgItem(m_hwnd, IDC_INDENTSPIN), bChecked);
+ onChange_IndentText(0);
SendDlgItemMessage(m_hwnd, IDC_INDENTSPIN, UDM_SETRANGE, 0, MAKELONG(999, 0));
SendDlgItemMessage(m_hwnd, IDC_INDENTSPIN, UDM_SETPOS, 0, db_get_w(0, SRMM_MODULE, SRMSGSET_INDENTSIZE, SRMSGDEFSET_INDENTSIZE));
@@ -695,123 +673,82 @@ public: m_log.SendMsg(EM_AUTOURLDETECT, TRUE, 0);
m_log.SetReadOnly(true);
- ShowPreview();
+ OnChange();
}
- virtual INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override
+ void OnApply() override
{
- BOOL bChecked;
-
- switch (msg) {
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_FONTSCOLORS:
- Options_Open(L"Customize", L"Fonts and colors");
- break;
-
- case IDC_LOADUNREAD:
- case IDC_LOADCOUNT:
- case IDC_LOADTIME:
- bChecked = IsDlgButtonChecked(m_hwnd, IDC_LOADCOUNT);
- EnableWindow(GetDlgItem(m_hwnd, IDC_LOADCOUNTN), bChecked);
- EnableWindow(GetDlgItem(m_hwnd, IDC_LOADCOUNTSPIN), bChecked);
- EnableWindow(GetDlgItem(m_hwnd, IDC_LOADCOUNTTEXT2), bChecked);
- bChecked = IsDlgButtonChecked(m_hwnd, IDC_LOADTIME);
- EnableWindow(GetDlgItem(m_hwnd, IDC_LOADTIMEN), bChecked);
- EnableWindow(GetDlgItem(m_hwnd, IDC_LOADTIMESPIN), bChecked);
- EnableWindow(GetDlgItem(m_hwnd, IDC_STMINSOLD), bChecked);
- break;
+ if (IsDlgButtonChecked(m_hwnd, IDC_LOADCOUNT))
+ db_set_b(0, SRMM_MODULE, SRMSGSET_LOADHISTORY, LOADHISTORY_COUNT);
+ else if (IsDlgButtonChecked(m_hwnd, IDC_LOADTIME))
+ db_set_b(0, SRMM_MODULE, SRMSGSET_LOADHISTORY, LOADHISTORY_TIME);
+ else
+ db_set_b(0, SRMM_MODULE, SRMSGSET_LOADHISTORY, LOADHISTORY_UNREAD);
+ db_set_w(0, SRMM_MODULE, SRMSGSET_LOADCOUNT, (WORD)SendDlgItemMessage(m_hwnd, IDC_LOADCOUNTSPIN, UDM_GETPOS, 0, 0));
+ db_set_w(0, SRMM_MODULE, SRMSGSET_LOADTIME, (WORD)SendDlgItemMessage(m_hwnd, IDC_LOADTIMESPIN, UDM_GETPOS, 0, 0));
+ db_set_b(0, SRMM_MODULE, SRMSGSET_SHOWLOGICONS, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_SHOWLOGICONS));
+ db_set_b(0, SRMM_MODULE, SRMSGSET_HIDENAMES, (BYTE)BST_UNCHECKED == IsDlgButtonChecked(m_hwnd, IDC_SHOWNAMES));
+ db_set_b(0, SRMM_MODULE, SRMSGSET_SHOWTIME, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_SHOWTIMES));
+ db_set_b(0, SRMM_MODULE, SRMSGSET_SHOWSECONDS, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_SHOWSECONDS));
+ db_set_b(0, SRMM_MODULE, SRMSGSET_SHOWDATE, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_SHOWDATES));
+ db_set_b(0, SRMM_MODULE, SRMSGSET_USELONGDATE, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_USELONGDATE));
+ db_set_b(0, SRMM_MODULE, SRMSGSET_USERELATIVEDATE, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_USERELATIVEDATE));
+ db_set_b(0, SRMM_MODULE, SRMSGSET_GROUPMESSAGES, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_GROUPMESSAGES));
+ db_set_b(0, SRMM_MODULE, SRMSGSET_MARKFOLLOWUPS, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_MARKFOLLOWUPS));
+ db_set_b(0, SRMM_MODULE, SRMSGSET_MESSAGEONNEWLINE, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_MESSAGEONNEWLINE));
+ db_set_b(0, SRMM_MODULE, SRMSGSET_DRAWLINES, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_DRAWLINES));
+ db_set_b(0, SRMM_MODULE, SRMSGSET_USEIEVIEW, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_USEIEVIEW));
+ db_set_b(0, SRMM_MODULE, SRMSGSET_INDENTTEXT, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_INDENTTEXT));
+ db_set_w(0, SRMM_MODULE, SRMSGSET_INDENTSIZE, (WORD)SendDlgItemMessage(m_hwnd, IDC_INDENTSPIN, UDM_GETPOS, 0, 0));
+
+ FreeMsgLogIcons();
+ LoadMsgLogIcons();
+ }
- case IDC_SHOWTIMES:
- bChecked = IsDlgButtonChecked(m_hwnd, IDC_SHOWTIMES);
- EnableWindow(GetDlgItem(m_hwnd, IDC_SHOWSECONDS), bChecked);
- EnableWindow(GetDlgItem(m_hwnd, IDC_SHOWDATES), bChecked);
-
- case IDC_SHOWDATES:
- bChecked = IsDlgButtonChecked(m_hwnd, IDC_SHOWDATES) && IsDlgButtonChecked(m_hwnd, IDC_SHOWTIMES);
- EnableWindow(GetDlgItem(m_hwnd, IDC_USELONGDATE), bChecked);
- EnableWindow(GetDlgItem(m_hwnd, IDC_USERELATIVEDATE), bChecked);
-
- case IDC_SHOWNAMES:
- case IDC_SHOWSECONDS:
- case IDC_USELONGDATE:
- case IDC_USERELATIVEDATE:
- case IDC_MARKFOLLOWUPS:
- case IDC_SHOWLOGICONS:
- case IDC_MESSAGEONNEWLINE:
- case IDC_DRAWLINES:
- ShowPreview();
- break;
+ void onClick_Fonts(CCtrlHyperlink*)
+ {
+ Options_Open(L"Customize", L"Fonts and colors");
+ }
- case IDC_GROUPMESSAGES:
- EnableWindow(GetDlgItem(m_hwnd, IDC_MARKFOLLOWUPS), IsDlgButtonChecked(m_hwnd, IDC_GROUPMESSAGES));
- ShowPreview();
- break;
+ void onChange_Time(CCtrlCheck*)
+ {
+ int bChecked = IsDlgButtonChecked(m_hwnd, IDC_LOADCOUNT);
+ EnableWindow(GetDlgItem(m_hwnd, IDC_LOADCOUNTN), bChecked);
+ EnableWindow(GetDlgItem(m_hwnd, IDC_LOADCOUNTSPIN), bChecked);
+ EnableWindow(GetDlgItem(m_hwnd, IDC_LOADCOUNTTEXT2), bChecked);
+
+ bChecked = IsDlgButtonChecked(m_hwnd, IDC_LOADTIME);
+ EnableWindow(GetDlgItem(m_hwnd, IDC_LOADTIMEN), bChecked);
+ EnableWindow(GetDlgItem(m_hwnd, IDC_LOADTIMESPIN), bChecked);
+ EnableWindow(GetDlgItem(m_hwnd, IDC_STMINSOLD), bChecked);
+ }
- case IDC_INDENTTEXT:
- EnableWindow(GetDlgItem(m_hwnd, IDC_INDENTSIZE), IsDlgButtonChecked(m_hwnd, IDC_INDENTTEXT));
- EnableWindow(GetDlgItem(m_hwnd, IDC_INDENTSPIN), IsDlgButtonChecked(m_hwnd, IDC_INDENTTEXT));
- ShowPreview();
- break;
+ void onChange_Times(CCtrlCheck*)
+ {
+ int bChecked = IsDlgButtonChecked(m_hwnd, IDC_SHOWTIMES);
+ EnableWindow(GetDlgItem(m_hwnd, IDC_SHOWSECONDS), bChecked);
+ EnableWindow(GetDlgItem(m_hwnd, IDC_SHOWDATES), bChecked);
- case IDC_INDENTSIZE:
- if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())
- return TRUE;
- ShowPreview();
- break;
+ onChange_Dates(0);
+ }
- case IDC_LOADCOUNTN:
- case IDC_LOADTIMEN:
- if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())
- return TRUE;
- break;
+ void onChange_Dates(CCtrlCheck*)
+ {
+ int bChecked = IsDlgButtonChecked(m_hwnd, IDC_SHOWDATES) && IsDlgButtonChecked(m_hwnd, IDC_SHOWTIMES);
+ EnableWindow(GetDlgItem(m_hwnd, IDC_USELONGDATE), bChecked);
+ EnableWindow(GetDlgItem(m_hwnd, IDC_USERELATIVEDATE), bChecked);
+ }
- case IDC_SRMM_LOG:
- return 0;
- }
- SendMessage(GetParent(m_hwnd), PSM_CHANGED, 0, 0);
- break;
+ void onChange_GroupMsg(CCtrlCheck*)
+ {
+ EnableWindow(GetDlgItem(m_hwnd, IDC_MARKFOLLOWUPS), IsDlgButtonChecked(m_hwnd, IDC_GROUPMESSAGES));
+ }
- case WM_NOTIFY:
- switch (((LPNMHDR)lParam)->idFrom) {
- case 0:
- switch (((LPNMHDR)lParam)->code) {
- case PSN_WIZFINISH:
- ApplyOptions();
- break;
-
- case PSN_APPLY:
- if (IsDlgButtonChecked(m_hwnd, IDC_LOADCOUNT))
- db_set_b(0, SRMM_MODULE, SRMSGSET_LOADHISTORY, LOADHISTORY_COUNT);
- else if (IsDlgButtonChecked(m_hwnd, IDC_LOADTIME))
- db_set_b(0, SRMM_MODULE, SRMSGSET_LOADHISTORY, LOADHISTORY_TIME);
- else
- db_set_b(0, SRMM_MODULE, SRMSGSET_LOADHISTORY, LOADHISTORY_UNREAD);
- db_set_w(0, SRMM_MODULE, SRMSGSET_LOADCOUNT, (WORD)SendDlgItemMessage(m_hwnd, IDC_LOADCOUNTSPIN, UDM_GETPOS, 0, 0));
- db_set_w(0, SRMM_MODULE, SRMSGSET_LOADTIME, (WORD)SendDlgItemMessage(m_hwnd, IDC_LOADTIMESPIN, UDM_GETPOS, 0, 0));
- db_set_b(0, SRMM_MODULE, SRMSGSET_SHOWLOGICONS, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_SHOWLOGICONS));
- db_set_b(0, SRMM_MODULE, SRMSGSET_HIDENAMES, (BYTE)BST_UNCHECKED == IsDlgButtonChecked(m_hwnd, IDC_SHOWNAMES));
- db_set_b(0, SRMM_MODULE, SRMSGSET_SHOWTIME, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_SHOWTIMES));
- db_set_b(0, SRMM_MODULE, SRMSGSET_SHOWSECONDS, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_SHOWSECONDS));
- db_set_b(0, SRMM_MODULE, SRMSGSET_SHOWDATE, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_SHOWDATES));
- db_set_b(0, SRMM_MODULE, SRMSGSET_USELONGDATE, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_USELONGDATE));
- db_set_b(0, SRMM_MODULE, SRMSGSET_USERELATIVEDATE, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_USERELATIVEDATE));
- db_set_b(0, SRMM_MODULE, SRMSGSET_GROUPMESSAGES, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_GROUPMESSAGES));
- db_set_b(0, SRMM_MODULE, SRMSGSET_MARKFOLLOWUPS, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_MARKFOLLOWUPS));
- db_set_b(0, SRMM_MODULE, SRMSGSET_MESSAGEONNEWLINE, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_MESSAGEONNEWLINE));
- db_set_b(0, SRMM_MODULE, SRMSGSET_DRAWLINES, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_DRAWLINES));
- db_set_b(0, SRMM_MODULE, SRMSGSET_USEIEVIEW, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_USEIEVIEW));
- db_set_b(0, SRMM_MODULE, SRMSGSET_INDENTTEXT, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_INDENTTEXT));
- db_set_w(0, SRMM_MODULE, SRMSGSET_INDENTSIZE, (WORD)SendDlgItemMessage(m_hwnd, IDC_INDENTSPIN, UDM_GETPOS, 0, 0));
-
- FreeMsgLogIcons();
- LoadMsgLogIcons();
- return TRUE;
- }
- }
- break;
- }
- return CDlgBase::DlgProc(msg, wParam, lParam);
+ void onChange_IndentText(CCtrlCheck*)
+ {
+ int bChecked = IsDlgButtonChecked(m_hwnd, IDC_INDENTTEXT);
+ EnableWindow(GetDlgItem(m_hwnd, IDC_INDENTSIZE), bChecked);
+ EnableWindow(GetDlgItem(m_hwnd, IDC_INDENTSPIN), bChecked);
}
};
@@ -907,8 +844,8 @@ static INT_PTR CALLBACK DlgProcTypeOptions(HWND hwndDlg, UINT msg, WPARAM wParam EnableWindow(GetDlgItem(hwndDlg, IDC_TYPETRAY), IsDlgButtonChecked(hwndDlg, IDC_SHOWNOTIFY));
EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYTRAY), IsDlgButtonChecked(hwndDlg, IDC_SHOWNOTIFY));
EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYBALLOON), IsDlgButtonChecked(hwndDlg, IDC_SHOWNOTIFY));
+ __fallthrough;
- // fall-thru
case IDC_TYPEWIN:
case IDC_NOTIFYTRAY:
case IDC_NOTIFYBALLOON:
@@ -963,32 +900,29 @@ int OptInitialise(WPARAM wParam, LPARAM) odp.szTitle.a = LPGEN("Message sessions");
odp.flags = ODPF_BOLDGROUPS;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MSGDLG);
- odp.pfnDlgProc = DlgProcOptions;
+ odp.pDialog = new CMainOptionsDlg();
odp.szTab.a = LPGEN("General");
Options_AddPage(wParam, &odp);
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MSGTABS);
- odp.pfnDlgProc = DlgProcTabsOptions;
+ odp.pDialog = new CTabsOptionsDlg();
odp.szTab.a = LPGEN("Tabs");
Options_AddPage(wParam, &odp);
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_LAYOUT);
- odp.pfnDlgProc = DlgProcLayoutOptions;
+ odp.pDialog = new CLayoutOptionsDlg();
odp.szTab.a = LPGEN("Layout");
Options_AddPage(wParam, &odp);
- odp.pszTemplate = nullptr;
- odp.pfnDlgProc = nullptr;
odp.pDialog = new CLogOptionsDlg();
odp.szTab.a = LPGEN("Event log");
Options_AddPage(wParam, &odp);
+ ////////////////////////////////////////////////////////////////////////////////////////
odp.pDialog = nullptr;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS1);
- odp.pfnDlgProc = DlgProcOptions1;
odp.szGroup.a = LPGEN("Message sessions");
odp.szTitle.a = LPGEN("Group chats");
+
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS1);
+ odp.pfnDlgProc = DlgProcOptions1;
odp.szTab.a = LPGEN("General");
Options_AddPage(wParam, &odp);
@@ -997,6 +931,7 @@ int OptInitialise(WPARAM wParam, LPARAM) odp.szTab.a = LPGEN("Event log");
Options_AddPage(wParam, &odp);
+ ////////////////////////////////////////////////////////////////////////////////////////
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MSGTYPE);
odp.szTitle.a = LPGEN("Typing notify");
odp.pfnDlgProc = DlgProcTypeOptions;
@@ -1007,8 +942,8 @@ int OptInitialise(WPARAM wParam, LPARAM) odp.position = 910000002;
odp.hInstance = g_hInst;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONSPOPUP);
- odp.szTitle.a = LPGEN("Messaging");
odp.szGroup.a = LPGEN("Popups");
+ odp.szTitle.a = LPGEN("Messaging");
odp.pfnDlgProc = DlgProcOptionsPopup;
odp.flags = ODPF_BOLDGROUPS;
Options_AddPage(wParam, &odp);
diff --git a/plugins/Scriver/src/msgs.h b/plugins/Scriver/src/msgs.h index 16c6b6e5d6..5abab8fe59 100644 --- a/plugins/Scriver/src/msgs.h +++ b/plugins/Scriver/src/msgs.h @@ -90,6 +90,11 @@ public: virtual void LoadSettings() override;
virtual void SetStatusText(const wchar_t*, HICON) override;
+ bool IsActive() const
+ {
+ return GetActiveWindow() == m_hwndParent && GetForegroundWindow() == m_hwndParent && m_pParent->hwndActive == m_hwnd;
+ }
+
void Reattach(HWND hwndContainer);
ParentWindowData *m_pParent;
@@ -374,6 +379,8 @@ extern int fontOptionsListSize; #define SRMSGDEFSET_SENDONENTER 1
#define SRMSGSET_SENDONDBLENTER "SendOnDblEnter"
#define SRMSGDEFSET_SENDONDBLENTER 0
+#define SRMSGSET_SENDONCTRLENTER "SendOnCtrlEnter"
+#define SRMSGDEFSET_SENDONCTRLENTER 0
#define SRMSGSET_SENDBUTTON "UseSendButton"
#define SRMSGDEFSET_SENDBUTTON 0
#define SRMSGSET_CHARCOUNT "ShowCharCount"
diff --git a/plugins/Scriver/src/resource.h b/plugins/Scriver/src/resource.h index 37bb17e72b..138cce6651 100644 --- a/plugins/Scriver/src/resource.h +++ b/plugins/Scriver/src/resource.h @@ -94,23 +94,24 @@ #define IDC_USERELATIVEDATE 1025
#define IDC_USEIEVIEW 1026
#define IDC_FONTSCOLORS 1027
+#define IDC_LOADUNREAD 1031
#define IDC_SHOWLOGICONS 1032
#define IDC_SHOWTIMES 1033
#define IDC_SHOWDATES 1034
#define IDC_CLIST 1035
#define IDC_GROUPMESSAGES 1036
#define IDC_SAVEPERCONTACT 1037
+#define IDC_LOADCOUNT 1038
#define IDC_LOADCOUNTN 1039
#define IDC_LOADCOUNTSPIN 1040
#define IDC_SHOWSTATUSBAR 1041
#define IDC_SHOWTOOLBAR 1042
-#define IDC_LOADUNREAD 1043
#define IDC_SENDONENTER 1043
-#define IDC_LOADCOUNT 1044
#define IDC_SENDONDBLENTER 1044
#define IDC_LOADTIMEN 1045
#define IDC_LOADTIMESPIN 1046
#define IDC_LOADTIME 1047
+#define IDC_SENDONCTRLENTER 1048
#define IDC_SHOWTITLEBAR 1050
#define IDC_STMINSOLD 1051
#define IDC_SHOWPROGRESS 1052
@@ -247,7 +248,7 @@ //
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 102
+#define _APS_NEXT_RESOURCE_VALUE 103
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1003
#define _APS_NEXT_SYMED_VALUE 101
diff --git a/plugins/TabSRMM/src/chat_tools.cpp b/plugins/TabSRMM/src/chat_tools.cpp index 79bc186c61..c183b7b87b 100644 --- a/plugins/TabSRMM/src/chat_tools.cpp +++ b/plugins/TabSRMM/src/chat_tools.cpp @@ -168,7 +168,7 @@ BOOL DoPopup(SESSION_INFO *si, GCEVENT *gce) if (pContainer->dwFlags & CNT_DONTREPORT && IsIconic(pContainer->m_hwnd)) // in tray counts as "minimised"
goto passed;
if (pContainer->dwFlags & CNT_DONTREPORTUNFOCUSED) {
- if (!IsIconic(pContainer->m_hwnd) && GetForegroundWindow() != pContainer->m_hwnd && GetActiveWindow() != pContainer->m_hwnd)
+ if (!IsIconic(pContainer->m_hwnd) && !pContainer->IsActive())
goto passed;
}
if (pContainer->dwFlags & CNT_ALWAYSREPORTINACTIVE) {
diff --git a/plugins/TabSRMM/src/chat_window.cpp b/plugins/TabSRMM/src/chat_window.cpp index da2636eccf..f7bbfa7bf2 100644 --- a/plugins/TabSRMM/src/chat_window.cpp +++ b/plugins/TabSRMM/src/chat_window.cpp @@ -738,7 +738,7 @@ void CChatRoomDlg::AddLog() DM_AddDivider(); } else { - bool bInactive = (GetForegroundWindow() != m_pContainer->m_hwnd || GetActiveWindow() != m_pContainer->m_hwnd); + bool bInactive = !IsActive(); if (bInactive) DM_AddDivider(); else if (m_pContainer->m_hwndActive != m_hwnd) @@ -1404,7 +1404,7 @@ LRESULT CChatRoomDlg::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) break; case WM_INPUTLANGCHANGE: - if (PluginConfig.m_bAutoLocaleSupport && GetFocus() == m_message.GetHwnd() && m_pContainer->m_hwndActive == m_hwnd && GetForegroundWindow() == m_pContainer->m_hwnd && GetActiveWindow() == m_pContainer->m_hwnd) { + if (PluginConfig.m_bAutoLocaleSupport && GetFocus() == m_message.GetHwnd() && IsActive()) { DM_SaveLocale(wParam, lParam); m_message.SendMsg(EM_SETLANGOPTIONS, 0, (LPARAM)m_message.SendMsg(EM_GETLANGOPTIONS, 0, 0) & ~IMF_AUTOKEYBOARD); return 1; diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp index 48f8eb29e6..fbf5fe0fae 100644 --- a/plugins/TabSRMM/src/container.cpp +++ b/plugins/TabSRMM/src/container.cpp @@ -2297,7 +2297,7 @@ void TSAPI ReflashContainer(TContainerData *pContainer) {
DWORD dwStartTime = pContainer->dwFlashingStarted;
- if (GetForegroundWindow() == pContainer->m_hwnd || GetActiveWindow() == pContainer->m_hwnd) // dont care about active windows
+ if (pContainer->IsActive()) // dont care about active windows
return;
if (pContainer->dwFlags & CNT_NOFLASH || pContainer->dwFlashingStarted == 0)
diff --git a/plugins/TabSRMM/src/eventpopups.cpp b/plugins/TabSRMM/src/eventpopups.cpp index 89d57735f9..9147944ea7 100644 --- a/plugins/TabSRMM/src/eventpopups.cpp +++ b/plugins/TabSRMM/src/eventpopups.cpp @@ -780,7 +780,7 @@ int tabSRMM_ShowPopup(MCONTACT hContact, MEVENT hDbEvent, WORD eventType, int wi goto passed;
if (pContainer->dwFlags & CNT_DONTREPORTUNFOCUSED)
- if (!IsIconic(pContainer->m_hwnd) && GetForegroundWindow() != pContainer->m_hwnd && GetActiveWindow() != pContainer->m_hwnd)
+ if (!IsIconic(pContainer->m_hwnd) && !pContainer->IsActive())
goto passed;
if (pContainer->dwFlags & CNT_ALWAYSREPORTINACTIVE) {
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index 5653d2dd2b..8148fe6d8f 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -1087,7 +1087,7 @@ void CTabBaseDlg::DM_Typing(bool fForceOff) SendMessage(hwndStatus, SB_SETTEXT, 0, (LPARAM)m_wszStatusBar); SendMessage(hwndStatus, SB_SETICON, 0, (LPARAM)PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING]); } - if (IsIconic(hwndContainer) || GetForegroundWindow() != hwndContainer || GetActiveWindow() != hwndContainer) { + if (IsIconic(hwndContainer) || !IsActive()) { SetWindowText(hwndContainer, m_wszStatusBar); m_pContainer->dwFlags |= CNT_NEED_UPDATETITLE; if (!(m_pContainer->dwFlags & CNT_NOFLASH) && PluginConfig.m_FlashOnMTN) @@ -1223,7 +1223,7 @@ void CTabBaseDlg::DM_EventAdded(WPARAM hContact, LPARAM lParam) DM_AddDivider(); } else if (PluginConfig.m_bUseDividers) { - if ((GetForegroundWindow() != m_pContainer->m_hwnd || GetActiveWindow() != m_pContainer->m_hwnd)) + if (!m_pContainer->IsActive()) DM_AddDivider(); else if (m_pContainer->m_hwndActive != m_hwnd) DM_AddDivider(); @@ -1294,8 +1294,8 @@ void CTabBaseDlg::DM_EventAdded(WPARAM hContact, LPARAM lParam) // flash window if it is not focused if (!bDisableNotify && !bIsStatusChangeEvent) - if ((GetActiveWindow() != m_pContainer->m_hwnd || GetForegroundWindow() != m_pContainer->m_hwnd || m_pContainer->m_hwndActive != m_hwnd) && !(dbei.flags & DBEF_SENT)) { - if (!(m_pContainer->dwFlags & CNT_NOFLASH) && (GetActiveWindow() != m_pContainer->m_hwnd || GetForegroundWindow() != m_pContainer->m_hwnd)) + if (!IsActive() && !(dbei.flags & DBEF_SENT)) { + if (!(m_pContainer->dwFlags & CNT_NOFLASH) && !m_pContainer->IsActive()) FlashContainer(m_pContainer, 1, 0); SendMessage(m_pContainer->m_hwnd, DM_SETICON, (WPARAM)this, (LPARAM)Skin_LoadIcon(SKINICON_EVENT_MESSAGE)); m_pContainer->dwFlags |= CNT_NEED_UPDATETITLE; diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index be9485c0e8..f324c074a5 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -2123,7 +2123,7 @@ LRESULT CSrmmWindow::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) break;
case WM_INPUTLANGCHANGE:
- if (PluginConfig.m_bAutoLocaleSupport && GetFocus() == m_message.GetHwnd() && m_pContainer->m_hwndActive == m_hwnd && GetForegroundWindow() == m_pContainer->m_hwnd && GetActiveWindow() == m_pContainer->m_hwnd) {
+ if (PluginConfig.m_bAutoLocaleSupport && GetFocus() == m_message.GetHwnd() && IsActive()) {
DM_SaveLocale(wParam, lParam);
m_message.SendMsg(EM_SETLANGOPTIONS, 0, (LPARAM)m_message.SendMsg(EM_GETLANGOPTIONS, 0, 0) & ~IMF_AUTOKEYBOARD);
return 1;
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index 3d3c676de8..3e3525f856 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -160,7 +160,7 @@ INT_PTR CTabBaseDlg::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) case DM_SETLOCALE:
if (m_dwFlags & MWF_WASBACKGROUNDCREATE)
break;
- if (m_pContainer->m_hwndActive == m_hwnd && PluginConfig.m_bAutoLocaleSupport && m_pContainer->m_hwnd == GetForegroundWindow() && m_pContainer->m_hwnd == GetActiveWindow()) {
+ if (PluginConfig.m_bAutoLocaleSupport && IsActive()) {
if (lParam)
m_hkl = (HKL)lParam;
@@ -355,7 +355,7 @@ int TSAPI MessageWindowOpened(MCONTACT hContact, HWND _hwnd) return 0;
}
if (pContainer->dwFlags & CNT_DONTREPORTUNFOCUSED) {
- if (!IsIconic(pContainer->m_hwnd) && GetForegroundWindow() != pContainer->m_hwnd && GetActiveWindow() != pContainer->m_hwnd)
+ if (!IsIconic(pContainer->m_hwnd) && !pContainer->IsActive())
return 0;
}
if (pContainer->dwFlags & CNT_ALWAYSREPORTINACTIVE) {
diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index 5939a31633..2dd60114c3 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -232,6 +232,10 @@ struct TContainerData void ClearMargins()
{ memset(&mOld, 0xfe, sizeof(mOld));
}
+
+ bool IsActive()
+ { return GetActiveWindow() == m_hwnd && GetForegroundWindow() == m_hwnd;
+ }
};
struct SESSION_INFO;
@@ -380,6 +384,11 @@ public: __forceinline CCtrlRichEdit& GetEntry() { return m_message; }
+ bool IsActive() const override
+ {
+ return m_pContainer->IsActive() && m_pContainer->m_hwndActive == m_hwnd;
+ }
+
HWND DM_CreateClist();
void DM_EventAdded(WPARAM wParam, LPARAM lParam);
void DM_InitRichEdit();
diff --git a/src/core/stdmsg/res/resource.rc b/src/core/stdmsg/res/resource.rc index 78770d7b6a..4e1be5d546 100644 --- a/src/core/stdmsg/res/resource.rc +++ b/src/core/stdmsg/res/resource.rc @@ -41,19 +41,21 @@ BEGIN CONTROL "Close the message window on send",IDC_AUTOCLOSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,50,289,10
CONTROL "Minimize the message window on send",IDC_AUTOMIN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,62,289,10
+ CONTROL "Use the contact's status icon as the window icon",IDC_STATUSWIN,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,75,290,10
CONTROL "Save the window size and location individually for each contact",IDC_SAVEPERCONTACT,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,86,289,10
- CONTROL "Cascade new windows",IDC_CASCADE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,98,289,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,88,289,10
+ CONTROL "Cascade new windows",IDC_CASCADE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,100,289,10
CONTROL "Support CTRL+Up/Down in message area to show previously sent messages",IDC_CTRLSUPPORT,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,110,289,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,112,289,10
CONTROL "Delete temporary contacts when closing message window",IDC_DELTEMP,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,122,287,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,124,287,10
CONTROL "Enable avatar support in the message window",IDC_AVATARSUPPORT,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,135,289,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,137,289,10
- CONTROL "Limit avatar height to",IDC_LIMITAVATARH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,149,126,10
- EDITTEXT IDC_AVATARHEIGHT,148,148,28,13,ES_AUTOHSCROLL
- LTEXT "pixels",IDC_STATIC,181,150,35,8
+ CONTROL "Limit avatar height to",IDC_LIMITAVATARH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,151,126,10
+ EDITTEXT IDC_AVATARHEIGHT,148,150,28,13,ES_AUTOHSCROLL
+ LTEXT "pixels",IDC_STATIC,181,152,35,8
CONTROL "Show 'Send' button",IDC_SHOWSENDBTN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,166,135,10
CONTROL "Show character count",IDC_CHARCOUNT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,179,135,10
diff --git a/src/core/stdmsg/src/chat_manager.cpp b/src/core/stdmsg/src/chat_manager.cpp index fd0bf8cf8a..b4b8c880c3 100644 --- a/src/core/stdmsg/src/chat_manager.cpp +++ b/src/core/stdmsg/src/chat_manager.cpp @@ -90,24 +90,24 @@ static void OnReplaceSession(SESSION_INFO *si) static void OnFlashHighlight(SESSION_INFO *si, int bInactive) { - if (!bInactive) + if (!bInactive || si->pDlg == nullptr) return; - if (!g_Settings.bTabsEnable && si->pDlg && g_Settings.bFlashWindowHighlight) - SetTimer(si->pDlg->GetHwnd(), TIMERID_FLASHWND, 900, nullptr); - if (g_Settings.bTabsEnable && si->pDlg) + if (g_Settings.bTabsEnable) g_pTabDialog->SetMessageHighlight(si->pDlg); + else if (g_Settings.bFlashWindowHighlight) + si->pDlg->StartFlash(); } static void OnFlashWindow(SESSION_INFO *si, int bInactive) { - if (!bInactive) + if (!bInactive || si->pDlg == nullptr) return; - if (!g_Settings.bTabsEnable && si->pDlg && g_Settings.bFlashWindow) - SetTimer(si->pDlg->GetHwnd(), TIMERID_FLASHWND, 900, nullptr); - if (g_Settings.bTabsEnable && si->pDlg) + if (g_Settings.bTabsEnable) g_pTabDialog->SetTabHighlight(si->pDlg); + else if (g_Settings.bFlashWindow) + si->pDlg->StartFlash(); } static BOOL DoTrayIcon(SESSION_INFO *si, GCEVENT *gce) diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp index 61600f5619..99c2e2fd1e 100644 --- a/src/core/stdmsg/src/chat_window.cpp +++ b/src/core/stdmsg/src/chat_window.cpp @@ -28,9 +28,8 @@ static wchar_t szTrimString[] = L":;,.!?\'\"><()[]- \r\n"; ///////////////////////////////////////////////////////////////////////////////////////// -CChatRoomDlg::CChatRoomDlg(CTabbedWindow *pContainer, SESSION_INFO *si) : - CSuper(IDD_CHANNEL, si), - m_pOwner(pContainer), +CChatRoomDlg::CChatRoomDlg(CTabbedWindow *pOwner, SESSION_INFO *si) : + CSuper(pOwner, IDD_CHANNEL, si), m_btnOk(this, IDOK), m_splitterX(this, IDC_SPLITTERX), @@ -100,8 +99,7 @@ void CChatRoomDlg::OnActivate() pci->SetActiveSession(m_si); UpdateStatusBar(); - if (KillTimer(m_hwnd, TIMERID_FLASHWND)) - FlashWindow(m_pOwner->GetHwnd(), FALSE); + StopFlash(); if (db_get_w(m_hContact, m_si->pszModule, "ApparentMode", 0) != 0) db_set_w(m_hContact, m_si->pszModule, "ApparentMode", 0); if (pcli->pfnGetEvent(m_hContact, 0)) @@ -199,7 +197,7 @@ void CChatRoomDlg::onSplitterY(CSplitter *pSplitter) int CChatRoomDlg::GetImageId() const { - if (m_si->wState & GC_EVENT_HIGHLIGHT) + if ((m_si->wState & GC_EVENT_HIGHLIGHT) && (m_nFlash & 1)) return 0; MODULEINFO *mi = pci->MM_FindModule(m_si->pszModule); @@ -297,6 +295,8 @@ void CChatRoomDlg::UpdateOptions() SendMessage(m_pOwner->m_hwndStatus, SB_SETICON, 0, (LPARAM)hIcon); + Window_SetIcon_IcoLib(m_pOwner->GetHwnd(), GetIconHandle("window")); + m_log.SendMsg(EM_SETBKGNDCOLOR, 0, g_Settings.crLogBackground); CHARFORMAT2 cf; @@ -1100,11 +1100,6 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) } break; - case WM_TIMER: - if (wParam == TIMERID_FLASHWND) - FlashWindow(m_pOwner->GetHwnd(), TRUE); - break; - case WM_ACTIVATE: if (LOWORD(wParam) == WA_INACTIVE) { if (g_Settings.bTabsEnable) { diff --git a/src/core/stdmsg/src/globals.cpp b/src/core/stdmsg/src/globals.cpp index 4a3632a363..88ba9ea8e8 100644 --- a/src/core/stdmsg/src/globals.cpp +++ b/src/core/stdmsg/src/globals.cpp @@ -129,6 +129,7 @@ GlobalMessageData::GlobalMessageData() : bDeleteTempCont(SRMMMOD, "DeleteTempCont", false),
bSavePerContact(SRMMMOD, "SavePerContact", false),
bDoNotStealFocus(SRMMMOD, "DoNotStealFocus", false),
+ bUseStatusWinIcon(SRMMMOD, "UseStatusWinIcon", true),
bLimitAvatarHeight(SRMMMOD, "AvatarLimitHeight", true),
iAvatarHeight(SRMMMOD, "AvatarHeight", 60),
diff --git a/src/core/stdmsg/src/globals.h b/src/core/stdmsg/src/globals.h index a0ad036b01..78148da5cd 100644 --- a/src/core/stdmsg/src/globals.h +++ b/src/core/stdmsg/src/globals.h @@ -52,6 +52,7 @@ struct GlobalMessageData CMOption<bool> bDoNotStealFocus;
CMOption<bool> bCascade;
CMOption<bool> bDeleteTempCont;
+ CMOption<bool> bUseStatusWinIcon;
CMOption<bool> bLimitAvatarHeight;
CMOption<WORD> iAvatarHeight;
diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index 3413431016..572ae73bec 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -85,12 +85,11 @@ static void SetEditorText(HWND hwnd, const wchar_t* txt) /////////////////////////////////////////////////////////////////////////////////////////
CSrmmWindow::CSrmmWindow(CTabbedWindow *pOwner, MCONTACT hContact) :
- CSuper(IDD_MSG),
+ CSuper(pOwner, IDD_MSG),
m_splitter(this, IDC_SPLITTERY),
m_avatar(this, IDC_AVATAR),
m_cmdList(20),
- m_bNoActivate(g_dat.bDoNotStealFocus),
- m_pOwner(pOwner)
+ m_bNoActivate(g_dat.bDoNotStealFocus)
{
m_hContact = hContact;
@@ -242,7 +241,7 @@ void CSrmmWindow::OnInitDialog() if (m_bNoActivate) {
SetWindowPos(m_hwnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_SHOWWINDOW);
- SetTimer(m_hwnd, TIMERID_FLASHWND, TIMEOUT_FLASHWND, nullptr);
+ StartFlash();
}
else {
SetWindowPos(m_hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
@@ -314,8 +313,7 @@ void CSrmmWindow::OnActivate() SetFocus(m_message.GetHwnd());
UpdateTitle();
UpdateLastMessage();
- if (KillTimer(m_hwnd, TIMERID_FLASHWND))
- FlashWindow(m_pOwner->GetHwnd(), FALSE);
+ StopFlash();
SendMessage(m_hwnd, DM_UPDATEWINICON, 0, 0);
}
@@ -455,6 +453,9 @@ void CSrmmWindow::OnSplitterMoved(CSplitter *pSplitter) int CSrmmWindow::GetImageId() const
{
+ if (m_nFlash & 1)
+ return 0;
+
return (WORD)pcli->pfnIconFromStatusMode(m_szProto, m_wStatus, m_hContact);
}
@@ -619,7 +620,8 @@ void CSrmmWindow::UpdateIcon(WPARAM wParam) m_hStatusIcon = hIcon;
}
- SendMessage(m_hwnd, DM_UPDATEWINICON, 0, 0);
+ if (g_dat.bUseStatusWinIcon)
+ SendMessage(m_hwnd, DM_UPDATEWINICON, 0, 0);
}
}
@@ -655,12 +657,17 @@ void CSrmmWindow::UpdateTitle() if (m_hContact && m_szProto) {
m_wStatus = db_get_w(m_hContact, m_szProto, "Status", ID_STATUS_OFFLINE);
wchar_t *contactName = Clist_GetContactDisplayName(m_hContact);
- wchar_t *szStatus = Clist_GetStatusModeDescription(m_wStatus, 0);
- mir_snwprintf(newtitle, L"%s (%s): %s", contactName, szStatus, TranslateT("Message session"));
+
+ if (g_dat.bUseStatusWinIcon)
+ mir_snwprintf(newtitle, L"%s - %s", contactName, TranslateT("Message session"));
+ else {
+ wchar_t *szStatus = Clist_GetStatusModeDescription(m_szProto == nullptr ? ID_STATUS_OFFLINE : db_get_w(m_hContact, m_szProto, "Status", ID_STATUS_OFFLINE), 0);
+ mir_snwprintf(newtitle, L"%s (%s): %s", contactName, szStatus, TranslateT("Message session"));
+ }
m_wOldStatus = m_wStatus;
}
- else mir_wstrncpy(newtitle, TranslateT("Message session"), _countof(newtitle));
+ else wcsncpy_s(newtitle, TranslateT("Message session"), _TRUNCATE);
if (this == m_pOwner->CurrPage()) {
wchar_t oldtitle[256];
@@ -1146,6 +1153,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) DBEVENTINFO dbei = {};
db_event_get(hDbEvent, &dbei);
bool isMessage = (dbei.eventType == EVENTTYPE_MESSAGE), isSent = ((dbei.flags & DBEF_SENT) != 0);
+ bool isActive = IsActive();
if (DbEventIsShown(&dbei)) {
// Sounds *only* for sent messages, not for custom events
if (isMessage && !isSent) {
@@ -1165,17 +1173,17 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) // Flash window *only* for messages, not for custom events
if (isMessage && !isSent) {
- if (GetActiveWindow() == m_pOwner->GetHwnd() && GetForegroundWindow() == m_pOwner->GetHwnd()) {
+ if (isActive) {
if (GetWindowLongPtr(m_log.GetHwnd(), GWL_STYLE) & WS_VSCROLL) {
SCROLLINFO si = {};
si.cbSize = sizeof(si);
si.fMask = SIF_PAGE | SIF_RANGE | SIF_POS;
GetScrollInfo(m_log.GetHwnd(), SB_VERT, &si);
if ((si.nPos + (int)si.nPage + 5) < si.nMax)
- SetTimer(m_hwnd, TIMERID_FLASHWND, TIMEOUT_FLASHWND, nullptr);
+ StartFlash();
}
}
- else SetTimer(m_hwnd, TIMERID_FLASHWND, TIMEOUT_FLASHWND, nullptr);
+ else StartFlash();
}
}
}
@@ -1188,13 +1196,8 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_TIMER:
if (wParam == TIMERID_FLASHWND) {
- FlashWindow(m_pOwner->GetHwnd(), TRUE);
- if (m_nFlash > 2 * g_dat.nFlashMax) {
- KillTimer(m_hwnd, TIMERID_FLASHWND);
- FlashWindow(m_pOwner->GetHwnd(), FALSE);
- m_nFlash = 0;
- }
- m_nFlash++;
+ if (m_nFlash > 2 * g_dat.nFlashMax)
+ StopFlash();
}
else if (wParam == TIMERID_TYPE) {
ShowTime(false);
@@ -1382,8 +1385,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) si.fMask = SIF_PAGE | SIF_RANGE | SIF_POS;
GetScrollInfo((HWND)lParam, SB_VERT, &si);
if ((si.nPos + (int)si.nPage + 5) >= si.nMax)
- if (KillTimer(m_hwnd, TIMERID_FLASHWND))
- FlashWindow(m_pOwner->GetHwnd(), FALSE);
+ StopFlash();
}
break;
}
diff --git a/src/core/stdmsg/src/msgoptions.cpp b/src/core/stdmsg/src/msgoptions.cpp index 6c62b74d07..917de61ce3 100644 --- a/src/core/stdmsg/src/msgoptions.cpp +++ b/src/core/stdmsg/src/msgoptions.cpp @@ -153,7 +153,7 @@ statusValues[] = class COptionMainDlg : public CPluginDlgBase
{
CCtrlEdit edtNFlash, edtAvatarH, edtSecs;
- CCtrlCheck chkAutoMin, chkAutoClose, chkSavePerContact, chkDoNotStealFocus;
+ CCtrlCheck chkAutoMin, chkAutoClose, chkSavePerContact, chkDoNotStealFocus, chkStatusWin;
CCtrlCheck chkDelTemp, chkCascade, chkCharCount, chkCtrlSupport;
CCtrlCheck chkAvatar, chkLimitAvatar;
CCtrlCheck chkSendOnEnter, chkSendOnDblEnter, chkSendOnCtrlEnter, chkShowSend, chkShowButtons;
@@ -205,6 +205,7 @@ public: chkShowSend(this, IDC_SHOWSENDBTN),
chkAutoClose(this, IDC_AUTOCLOSE),
chkCharCount(this, IDC_CHARCOUNT),
+ chkStatusWin(this, IDC_STATUSWIN),
chkLimitAvatar(this, IDC_LIMITAVATARH),
chkShowButtons(this, IDC_SHOWBUTTONLINE),
chkCtrlSupport(this, IDC_CTRLSUPPORT),
@@ -234,6 +235,7 @@ public: CreateLink(chkAutoClose, g_dat.bAutoClose);
CreateLink(chkShowSend, g_dat.bSendButton);
CreateLink(chkCharCount, g_dat.bShowReadChar);
+ CreateLink(chkStatusWin, g_dat.bUseStatusWinIcon);
CreateLink(chkShowButtons, g_dat.bShowButtons);
CreateLink(chkCtrlSupport, g_dat.bCtrlSupport);
CreateLink(chkSendOnEnter, g_dat.bSendOnEnter);
diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index 0901f60c96..e94b2386b5 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -24,9 +24,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /////////////////////////////////////////////////////////////////////////////////////////
-CMsgDialog::CMsgDialog(int iDialogId, SESSION_INFO *si)
- : CSuper(g_hInst, iDialogId, si),
- m_btnOk(this, IDOK)
+CMsgDialog::CMsgDialog(CTabbedWindow *pOwner, int iDialogId, SESSION_INFO *si) :
+ CSuper(g_hInst, iDialogId, si),
+ m_btnOk(this, IDOK),
+ m_pOwner(pOwner)
{
m_autoClose = 0;
m_forceResizable = true;
@@ -49,6 +50,14 @@ INT_PTR CMsgDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) OnActivate();
break;
+ case WM_TIMER:
+ if (wParam == TIMERID_FLASHWND) {
+ m_pOwner->FixTabIcons(this);
+ FlashWindow(m_pOwner->GetHwnd(), TRUE);
+ m_nFlash++;
+ }
+ break;
+
case WM_MOUSEACTIVATE:
OnActivate();
SetFocus(m_message.GetHwnd());
@@ -58,6 +67,30 @@ INT_PTR CMsgDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) return CSuper::DlgProc(uMsg, wParam, lParam);
}
+bool CMsgDialog::IsActive() const
+{
+ bool bRes = m_pOwner->IsActive();
+ if (g_Settings.bTabsEnable && bRes)
+ bRes &= m_pOwner->m_tab.GetActivePage() == this;
+
+ return bRes;
+}
+
+void CMsgDialog::StartFlash()
+{
+ ::SetTimer(m_hwnd, TIMERID_FLASHWND, 900, nullptr);
+}
+
+void CMsgDialog::StopFlash()
+{
+ if (::KillTimer(m_hwnd, TIMERID_FLASHWND)) {
+ ::FlashWindow(m_pOwner->GetHwnd(), FALSE);
+
+ m_nFlash = 0;
+ m_pOwner->FixTabIcons(this);
+ }
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
int OnCheckPlugins(WPARAM, LPARAM);
diff --git a/src/core/stdmsg/src/msgs.h b/src/core/stdmsg/src/msgs.h index 07917e2736..7ae389fab0 100644 --- a/src/core/stdmsg/src/msgs.h +++ b/src/core/stdmsg/src/msgs.h @@ -50,10 +50,10 @@ class CMsgDialog : public CSrmmBaseDialog protected:
CCtrlButton m_btnOk;
+ CTabbedWindow *m_pOwner;
+ DWORD m_nFlash = 0;
- CMsgDialog(int idDialog, SESSION_INFO *si = nullptr);
-
- virtual int GetImageId() const PURE;
+ CMsgDialog(CTabbedWindow *pOwner, int idDialog, SESSION_INFO *si = nullptr);
virtual const char* GetProto() const PURE;
virtual int GetStatus() const PURE;
@@ -63,7 +63,13 @@ protected: INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override;
public:
+ virtual int GetImageId() const PURE;
+
void CloseTab() override;
+ bool IsActive() const override;
+
+ void StartFlash();
+ void StopFlash();
__forceinline SESSION_INFO* getChat() const { return m_si; }
};
@@ -96,7 +102,6 @@ class CSrmmWindow : public CMsgDialog RECT m_minEditInit;
int m_windowWasCascaded;
- DWORD m_nFlash;
int m_nTypeSecs, m_nTypeMode;
int m_limitAvatarH;
DWORD m_nLastTyping;
@@ -118,7 +123,6 @@ public: HBITMAP m_avatarPic;
wchar_t *m_wszInitialText;
- CTabbedWindow *m_pOwner;
public:
CSrmmWindow(CTabbedWindow*, MCONTACT hContact);
@@ -174,7 +178,6 @@ class CChatRoomDlg : public CMsgDialog CCtrlButton m_btnOk;
CSplitter m_splitterX, m_splitterY;
- CTabbedWindow *m_pOwner;
int m_iSplitterX, m_iSplitterY;
diff --git a/src/core/stdmsg/src/resource.h b/src/core/stdmsg/src/resource.h index 92b72236fb..affe1f1b02 100644 --- a/src/core/stdmsg/src/resource.h +++ b/src/core/stdmsg/src/resource.h @@ -136,6 +136,7 @@ #define IDC_ERRORTEXT 1596
#define IDC_MSGTEXT 1597
#define IDC_SHOWNOTIFY 1600
+#define IDC_STATUSWIN 1601
#define IDC_TYPEWIN 1602
#define IDC_CHARCOUNT 1603
#define IDC_TYPETRAY 1603
diff --git a/src/core/stdmsg/src/stdafx.h b/src/core/stdmsg/src/stdafx.h index 099a07c086..00b1304b57 100644 --- a/src/core/stdmsg/src/stdafx.h +++ b/src/core/stdmsg/src/stdafx.h @@ -155,13 +155,18 @@ public: CTabbedWindow();
+ bool IsActive() const
+ {
+ return GetActiveWindow() == m_hwnd && GetForegroundWindow() == m_hwnd;
+ }
+
CTabbedWindow* AddPage(MCONTACT hContact, wchar_t *pwszText = nullptr, int iActivate = -1);
CMsgDialog* CurrPage() const;
void AddPage(SESSION_INFO*, int insertAt = -1);
void FixTabIcons(CMsgDialog*);
- void SetMessageHighlight(CChatRoomDlg*);
- void SetTabHighlight(CChatRoomDlg*);
+ void SetMessageHighlight(CMsgDialog*);
+ void SetTabHighlight(CMsgDialog*);
void TabClicked();
virtual void OnInitDialog() override;
diff --git a/src/core/stdmsg/src/tabs.cpp b/src/core/stdmsg/src/tabs.cpp index 8f4595fc1a..67544cb86f 100644 --- a/src/core/stdmsg/src/tabs.cpp +++ b/src/core/stdmsg/src/tabs.cpp @@ -78,16 +78,11 @@ static LRESULT CALLBACK TabSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR if (idx != -1) { CMsgDialog *pDlg = (CMsgDialog*)pOwner->m_tab.GetNthPage(idx); if (pDlg) { - SESSION_INFO *si = pDlg->getChat(); - if (si != nullptr) { - bool bOnline = db_get_w(si->hContact, si->pszModule, "Status", ID_STATUS_OFFLINE) == ID_STATUS_ONLINE; - MODULEINFO *mi = pci->MM_FindModule(si->pszModule); - bDragging = true; - iBeginIndex = idx; - ImageList_BeginDrag(Clist_GetImageList(), bOnline ? mi->OnlineIconIndex : mi->OfflineIconIndex, 8, 8); - ImageList_DragEnter(hwnd, tci.pt.x, tci.pt.y); - SetCapture(hwnd); - } + bDragging = true; + iBeginIndex = idx; + ImageList_BeginDrag(Clist_GetImageList(), pDlg->GetImageId(), 8, 8); + ImageList_DragEnter(hwnd, tci.pt.x, tci.pt.y); + SetCapture(hwnd); } return TRUE; } @@ -309,7 +304,12 @@ void CTabbedWindow::FixTabIcons(CMsgDialog *pDlg) // set the container's icon only if we're processing the current page if (pDlg == CurrPage()) { Window_FreeIcon_IcoLib(m_hwnd); - Window_SetProtoIcon_IcoLib(m_hwnd, pDlg->GetProto(), pDlg->GetStatus()); + if (g_dat.bUseStatusWinIcon) + Window_SetProtoIcon_IcoLib(m_hwnd, pDlg->GetProto(), pDlg->GetStatus()); + else if (pDlg->isChat()) + Window_SetIcon_IcoLib(m_hwnd, GetIconHandle("window")); + else + Window_SetSkinIcon_IcoLib(m_hwnd, SKINICON_EVENT_MESSAGE); } } @@ -332,31 +332,25 @@ void CTabbedWindow::SaveWindowPosition(bool bUpdateSession) } } -void CTabbedWindow::SetMessageHighlight(CChatRoomDlg *pDlg) +void CTabbedWindow::SetMessageHighlight(CMsgDialog *pDlg) { - if (pDlg != nullptr) { - if (m_tab.GetDlgIndex(pDlg) == -1) - return; + if (m_tab.GetDlgIndex(pDlg) == -1) + return; - pDlg->m_si->wState |= GC_EVENT_HIGHLIGHT; - FixTabIcons(pDlg); - if (g_Settings.bFlashWindowHighlight && GetActiveWindow() != m_hwnd && GetForegroundWindow() != m_hwnd) - SetTimer(m_hwnd, TIMERID_FLASHWND, 900, nullptr); - } - else RedrawWindow(m_tab.GetHwnd(), nullptr, nullptr, RDW_INVALIDATE); + pDlg->m_si->wState |= GC_EVENT_HIGHLIGHT; + FixTabIcons(pDlg); + if (g_Settings.bFlashWindowHighlight && pDlg != m_tab.GetActivePage()) + pDlg->StartFlash(); } -void CTabbedWindow::SetTabHighlight(CChatRoomDlg *pDlg) +void CTabbedWindow::SetTabHighlight(CMsgDialog *pDlg) { - if (pDlg != nullptr) { - if (m_tab.GetDlgIndex(pDlg) == -1) - return; + if (m_tab.GetDlgIndex(pDlg) == -1) + return; - FixTabIcons(pDlg); - if (g_Settings.bFlashWindow && GetActiveWindow() != m_hwnd && GetForegroundWindow() != m_hwnd) - SetTimer(m_hwnd, TIMERID_FLASHWND, 900, nullptr); - } - else RedrawWindow(m_tab.GetHwnd(), nullptr, nullptr, RDW_INVALIDATE); + FixTabIcons(pDlg); + if (g_Settings.bFlashWindow && pDlg != m_tab.GetActivePage()) + pDlg->StartFlash(); } void CTabbedWindow::SetWindowPosition() @@ -412,12 +406,13 @@ void CTabbedWindow::TabClicked() pcli->pfnRemoveEvent(s->hContact, GC_FAKE_EVENT); } - FixTabIcons(pDlg); if (!s->pDlg) { pci->ShowRoom(s); SendMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0); } } + + FixTabIcons(pDlg); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -535,11 +530,6 @@ INT_PTR CTabbedWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) } break; - case WM_TIMER: - if (wParam == TIMERID_FLASHWND) - FlashWindow(m_hwnd, TRUE); - break; - case WM_MOVE: SaveWindowPosition(false); break; diff --git a/src/mir_app/src/chat_tools.cpp b/src/mir_app/src/chat_tools.cpp index 71d0a830ea..4da02f7426 100644 --- a/src/mir_app/src/chat_tools.cpp +++ b/src/mir_app/src/chat_tools.cpp @@ -284,7 +284,7 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight if (!gce || !si || gce->bIsMe || si->iType == GCW_SERVER)
return FALSE;
- BOOL bInactive = si->pDlg == nullptr || !ContainsWindow(GetForegroundWindow(), si->pDlg->GetHwnd());
+ BOOL bInactive = si->pDlg == nullptr || !si->pDlg->IsActive();
int iEvent = gce->iType;
diff --git a/src/mir_app/src/proto_opts.cpp b/src/mir_app/src/proto_opts.cpp index 884577650e..f09febbc07 100644 --- a/src/mir_app/src/proto_opts.cpp +++ b/src/mir_app/src/proto_opts.cpp @@ -622,10 +622,8 @@ public: int idx = m_accList.GetCurSel();
if (idx != -1) {
PROTOACCOUNT *pa = (PROTOACCOUNT*)m_accList.GetItemData(idx);
- if (pa) {
+ if (pa)
pa->bAccMgrUIChanged = true;
- NotifyChange();
- }
}
}
};
diff --git a/src/mir_core/src/CCtrlBase.cpp b/src/mir_core/src/CCtrlBase.cpp index e0532b68a7..83d7243ab6 100644 --- a/src/mir_core/src/CCtrlBase.cpp +++ b/src/mir_core/src/CCtrlBase.cpp @@ -96,8 +96,7 @@ void CCtrlBase::NotifyChange() m_bChanged = true; if (m_parentWnd && !m_bSilent) - if (m_parentWnd->IsInitialized()) - ::SendMessage(::GetParent(m_parentWnd->GetHwnd()), PSM_CHANGED, 0, 0); + m_parentWnd->NotifyChange(); OnChange(this); } diff --git a/src/mir_core/src/CDlgBase.cpp b/src/mir_core/src/CDlgBase.cpp index ed3de8d553..e1eee42d94 100644 --- a/src/mir_core/src/CDlgBase.cpp +++ b/src/mir_core/src/CDlgBase.cpp @@ -90,6 +90,11 @@ void CDlgBase::EndModal(INT_PTR nResult) void CDlgBase::NotifyChange(void) { + if (!m_initialized) + return; + + OnChange(); + if (m_hwndParent) SendMessage(m_hwndParent, PSM_CHANGED, (WPARAM)m_hwnd, 0); } |