summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-04-01 14:04:49 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-04-01 14:04:49 +0300
commitc04b64dd007293f45f6059c02073c45fc9211409 (patch)
tree9e479ca4428d83861a9cc477dd5961eacaf959ad
parent6293b72f7df8704c3b2494fb3c22494118cbcd6a (diff)
StdMsg: tab options moved from chats to a tab in Messaging Options
-rw-r--r--src/core/stdmsg/res/resource.rc12
-rw-r--r--src/core/stdmsg/src/chat_options.cpp23
-rw-r--r--src/core/stdmsg/src/msgoptions.cpp63
-rw-r--r--src/core/stdmsg/src/resource.h5
4 files changed, 83 insertions, 20 deletions
diff --git a/src/core/stdmsg/res/resource.rc b/src/core/stdmsg/res/resource.rc
index f40dbdc22e..8ef67f08ea 100644
--- a/src/core/stdmsg/res/resource.rc
+++ b/src/core/stdmsg/res/resource.rc
@@ -116,6 +116,18 @@ BEGIN
LTEXT "minutes old",IDC_STMINSOLD,189,138,82,8,WS_DISABLED
END
+IDD_OPT_TABS DIALOGEX 0, 0, 283, 80
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+EXSTYLE WS_EX_CONTROLPARENT
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
+BEGIN
+ CONTROL "Use a tabbed interface",IDC_USETABS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,11,263,13
+ CONTROL "Close tab on double click",IDC_CLOSETABS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,26,246,10
+ CONTROL "Restore previously open tabs when showing the window",IDC_RESTORETABS,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,39,250,10
+ CONTROL "Show tabs at the bottom",IDC_TABSBOTTOM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,52,233,10
+END
+
IDD_OPT_MSGTYPE DIALOGEX 0, 0, 283, 234
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
diff --git a/src/core/stdmsg/src/chat_options.cpp b/src/core/stdmsg/src/chat_options.cpp
index 6f8abaac8d..d256035917 100644
--- a/src/core/stdmsg/src/chat_options.cpp
+++ b/src/core/stdmsg/src/chat_options.cpp
@@ -30,13 +30,6 @@ struct branch_t
HTREEITEM hItem;
};
-static branch_t branch0[] = {
- { LPGENW("Use a tabbed interface"), "Tabs", 0, true },
- { LPGENW("Close tab on double click"), "TabCloseOnDblClick", 0, false },
- { LPGENW("Restore previously open tabs when showing the window"), "TabRestore", 0, false },
- { LPGENW("Show tabs at the bottom"), "TabBottom", 0, false },
-};
-
static branch_t branch1[] = {
{ LPGENW("Send message by pressing the 'Enter' key"), "SendOnEnter", 0, true },
{ LPGENW("Send message by pressing the 'Enter' key twice"), "SendOnDblEnter", 0, false },
@@ -334,7 +327,6 @@ static INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM, LPARAM
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHECKBOXES), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHECKBOXES), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES);
- hListHeading0 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Options for using a tabbed interface"), db_get_b(0, CHAT_MODULE, "Branch0Exp", 0) ? TRUE : FALSE);
hListHeading1 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Appearance and functionality of chat room windows"), db_get_b(0, CHAT_MODULE, "Branch1Exp", 0) ? TRUE : FALSE);
hListHeading2 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Appearance of the message log"), db_get_b(0, CHAT_MODULE, "Branch2Exp", 0) ? TRUE : FALSE);
hListHeading3 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Default events to show in new chat rooms if the 'event filter' is enabled"), db_get_b(0, CHAT_MODULE, "Branch3Exp", 0) ? TRUE : FALSE);
@@ -342,7 +334,7 @@ static INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM, LPARAM
hListHeading5 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Icons to display in the tray"), db_get_b(0, CHAT_MODULE, "Branch5Exp", 0) ? TRUE : FALSE);
if (PopupInstalled)
hListHeading6 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Popups to display"), db_get_b(0, CHAT_MODULE, "Branch6Exp", 0) ? TRUE : FALSE);
- FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading0, branch0, _countof(branch0), 0);
+
FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading1, branch1, _countof(branch1), 0);
FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading2, branch2, _countof(branch2), 0);
FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading3, branch3, _countof(branch3), 0x03E0);
@@ -410,8 +402,6 @@ static INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM, LPARAM
case 0:
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
- BYTE b = db_get_b(0, CHAT_MODULE, "Tabs", 1);
- SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch0, _countof(branch0));
SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch1, _countof(branch1));
SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch2, _countof(branch2));
SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch3, _countof(branch3));
@@ -421,13 +411,7 @@ static INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM, LPARAM
SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch6, _countof(branch6));
pci->ReloadSettings();
-
- if (b != db_get_b(0, CHAT_MODULE, "Tabs", 1)) {
- pci->SM_BroadcastMessage(nullptr, WM_CLOSE, 0, 1, FALSE);
- g_Settings.bTabsEnable = db_get_b(0, CHAT_MODULE, "Tabs", 1) != 0;
- }
- else Chat_UpdateOptions();
-
+ Chat_UpdateOptions();
return TRUE;
}
}
@@ -444,8 +428,7 @@ static INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM, LPARAM
db_set_b(0, CHAT_MODULE, "Branch4Exp", b);
b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading5, TVIS_EXPANDED)&TVIS_EXPANDED ? 1 : 0;
db_set_b(0, CHAT_MODULE, "Branch5Exp", b);
- b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading0, TVIS_EXPANDED)&TVIS_EXPANDED ? 1 : 0;
- db_set_b(0, CHAT_MODULE, "Branch0Exp", b);
+
if (PopupInstalled) {
b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading6, TVIS_EXPANDED)&TVIS_EXPANDED ? 1 : 0;
db_set_b(0, CHAT_MODULE, "Branch6Exp", b);
diff --git a/src/core/stdmsg/src/msgoptions.cpp b/src/core/stdmsg/src/msgoptions.cpp
index 8dfeb617a8..83e4707513 100644
--- a/src/core/stdmsg/src/msgoptions.cpp
+++ b/src/core/stdmsg/src/msgoptions.cpp
@@ -322,6 +322,8 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP
return FALSE;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
static HBRUSH hBkgColourBrush;
@@ -545,6 +547,61 @@ static INT_PTR CALLBACK DlgProcTypeOptions(HWND hwndDlg, UINT msg, WPARAM wParam
return FALSE;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
+class COptionsTabDlg : public CDlgBase
+{
+ CCtrlCheck m_chkTabs, m_chkTabsBottom, m_chkTabsClose, m_chkTabsRestore;
+
+public:
+ COptionsTabDlg() :
+ CDlgBase(g_hInst, IDD_OPT_TABS),
+ m_chkTabs(this, IDC_USETABS),
+ m_chkTabsBottom(this, IDC_TABSBOTTOM),
+ m_chkTabsClose(this, IDC_CLOSETABS),
+ m_chkTabsRestore(this, IDC_RESTORETABS)
+ {
+ m_chkTabs.OnChange = Callback(this, &COptionsTabDlg::onChange_Tabs);
+ }
+
+ virtual void OnInitDialog() override
+ {
+ m_chkTabs.SetState(db_get_b(0, CHAT_MODULE, "Tabs", 1));
+ m_chkTabsBottom.SetState(db_get_b(0, CHAT_MODULE, "TabBottom", 1));
+ m_chkTabsClose.SetState(db_get_b(0, CHAT_MODULE, "TabCloseOnDblClick", 1));
+ m_chkTabsRestore.SetState(db_get_b(0, CHAT_MODULE, "TabRestore", 1));
+ onChange_Tabs(&m_chkTabs);
+ }
+
+ virtual void OnApply() override
+ {
+ BYTE bOldValue = db_get_b(0, CHAT_MODULE, "Tabs", 1);
+
+ db_set_b(0, CHAT_MODULE, "Tabs", m_chkTabs.GetState());
+ db_set_b(0, CHAT_MODULE, "TabBottom", m_chkTabsBottom.GetState());
+ db_set_b(0, CHAT_MODULE, "TabCloseOnDblClick", m_chkTabsClose.GetState());
+ db_set_b(0, CHAT_MODULE, "TabRestore", m_chkTabsRestore.GetState());
+
+ pci->ReloadSettings();
+
+ if (bOldValue != db_get_b(0, CHAT_MODULE, "Tabs", 1)) {
+ pci->SM_BroadcastMessage(nullptr, WM_CLOSE, 0, 1, FALSE);
+ g_Settings.bTabsEnable = db_get_b(0, CHAT_MODULE, "Tabs", 1) != 0;
+ }
+ else Chat_UpdateOptions();
+ }
+
+ void onChange_Tabs(CCtrlCheck *pCheck)
+ {
+ bool bEnabled = pCheck->GetState() != 0;
+ m_chkTabsBottom.Enable(bEnabled);
+ m_chkTabsClose.Enable(bEnabled);
+ m_chkTabsRestore.Enable(bEnabled);
+ }
+};
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
static int OptInitialise(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = {};
@@ -568,6 +625,12 @@ static int OptInitialise(WPARAM wParam, LPARAM)
odp.pfnDlgProc = DlgProcTypeOptions;
Options_AddPage(wParam, &odp);
+ odp.pszTemplate = nullptr;
+ odp.pfnDlgProc = nullptr;
+ odp.szTab.a = LPGEN("Tabs");
+ odp.pDialog = new COptionsTabDlg();
+ Options_AddPage(wParam, &odp);
+
ChatOptionsInitialize(wParam);
return 0;
}
diff --git a/src/core/stdmsg/src/resource.h b/src/core/stdmsg/src/resource.h
index 46ef9d8e5d..38d733161d 100644
--- a/src/core/stdmsg/src/resource.h
+++ b/src/core/stdmsg/src/resource.h
@@ -9,6 +9,7 @@
#define IDD_FILTER 105
#define IDD_OPTIONSPOPUP 106
#define IDD_CONTAINER 107
+#define IDD_OPT_TABS 108
#define IDI_BUNDERLINE 120
#define IDI_BBOLD 121
#define IDI_BITALICS 122
@@ -158,6 +159,10 @@
#define IDC_TXT_TITLE1 1617
#define IDC_TXT_TITLE2 1618
#define IDC_TXT_TITLE3 1619
+#define IDC_USETABS 1620
+#define IDC_CLOSETABS 1621
+#define IDC_RESTORETABS 1622
+#define IDC_TABSBOTTOM 1623
#define IDM_CUT 40000
#define IDM_COPY 40001