From 124f58006ce473de9dc391c7ced1f12875df080f Mon Sep 17 00:00:00 2001
From: Alexander Lantsev <aunsane@gmail.com>
Date: Mon, 13 Apr 2015 15:12:46 +0000
Subject: dialog fix for SkypeWeb & Tox

git-svn-id: http://svn.miranda-ng.org/main/trunk@12788 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
---
 protocols/SkypeWeb/src/skype_dialogs.h   |  2 +-
 protocols/SkypeWeb/src/skype_options.cpp | 12 ++++------
 protocols/SkypeWeb/src/skype_options.h   |  5 ++--
 protocols/SkypeWeb/src/skype_proto.h     |  2 --
 protocols/Tox/res/resource.rc            |  8 +++----
 protocols/Tox/src/resource.h             |  2 ++
 protocols/Tox/src/tox_options.cpp        | 39 ++++++++++++++++++++++++++++----
 protocols/Tox/src/tox_options.h          | 39 ++++++++++++++++++++++++++++----
 8 files changed, 83 insertions(+), 26 deletions(-)

(limited to 'protocols')

diff --git a/protocols/SkypeWeb/src/skype_dialogs.h b/protocols/SkypeWeb/src/skype_dialogs.h
index 2f9312993e..b573a2d1c3 100644
--- a/protocols/SkypeWeb/src/skype_dialogs.h
+++ b/protocols/SkypeWeb/src/skype_dialogs.h
@@ -49,7 +49,7 @@ protected:
 
 public:
 	CSkypePasswordEditor(CSkypeProto *proto) :
-		CSkypeDlgBase(proto, IDD_PASSWORD_EDITOR, NULL, false), m_ok(this, IDOK),
+		CSkypeDlgBase(proto, IDD_PASSWORD_EDITOR, false), m_ok(this, IDOK),
 		m_password(this, IDC_PASSWORD), m_savePermanently(this, IDC_SAVEPERMANENTLY)
 	{
 		m_ok.OnClick = Callback(this, &CSkypePasswordEditor::OnOk);
diff --git a/protocols/SkypeWeb/src/skype_options.cpp b/protocols/SkypeWeb/src/skype_options.cpp
index 82f12ae358..d7e0396113 100644
--- a/protocols/SkypeWeb/src/skype_options.cpp
+++ b/protocols/SkypeWeb/src/skype_options.cpp
@@ -17,8 +17,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
 
 #include "common.h"
 
-CSkypeOptionsMain::CSkypeOptionsMain(CSkypeProto *proto, int idDialog, HWND hwndParent)
-	: CSkypeDlgBase(proto, idDialog, hwndParent, false),
+CSkypeOptionsMain::CSkypeOptionsMain(CSkypeProto *proto, int idDialog)
+	: CSkypeDlgBase(proto, idDialog, false),
 	m_skypename(this, IDC_SKYPENAME),
 	m_password(this, IDC_PASSWORD),
 	m_group(this, IDC_GROUP),
@@ -59,15 +59,11 @@ int CSkypeProto::OnOptionsInit(WPARAM wParam, LPARAM)
 	OPTIONSDIALOGPAGE odp = { sizeof(odp) };
 	odp.hInstance = g_hInstance;
 	odp.pszTitle = title;
-	odp.flags = ODPF_BOLDGROUPS | ODPF_DONTTRANSLATE;
+	odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
 	odp.pszGroup = LPGEN("Network");
 
 	odp.pszTab = LPGEN("Account");
-	odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS_MAIN);
-	odp.pfnDlgProc = CSkypeOptionsMain::DynamicDlgProc;
-	odp.dwInitParam = (LPARAM)&SkypeMainOptionsParam;
-	SkypeMainOptionsParam.create = CSkypeOptionsMain::CreateOptionsPage;
-	SkypeMainOptionsParam.param = this;
+	odp.pDialog = CSkypeOptionsMain::CreateOptionsPage(this);
 	Options_AddPage(wParam, &odp);
 
 	mir_free(title);
diff --git a/protocols/SkypeWeb/src/skype_options.h b/protocols/SkypeWeb/src/skype_options.h
index 4b5c785337..c593dc1856 100644
--- a/protocols/SkypeWeb/src/skype_options.h
+++ b/protocols/SkypeWeb/src/skype_options.h
@@ -28,7 +28,7 @@ private:
 	CCtrlCheck m_localtime;
 
 protected:
-	CSkypeOptionsMain(CSkypeProto *proto, int idDialog, HWND hwndParent = NULL);
+	CSkypeOptionsMain(CSkypeProto *proto, int idDialog);
 
 	void OnInitDialog();
 	void OnApply();
@@ -36,7 +36,8 @@ protected:
 public:
 	static CDlgBase *CreateAccountManagerPage(void *param, HWND owner)
 	{
-		CSkypeOptionsMain *page = new CSkypeOptionsMain((CSkypeProto*)param, IDD_ACCOUNT_MANAGER, owner);
+		CSkypeOptionsMain *page = new CSkypeOptionsMain((CSkypeProto*)param, IDD_ACCOUNT_MANAGER);
+		page->SetParent(owner);
 		page->Show();
 		return page;
 	}
diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h
index 180bfdc8f2..adbde10032 100644
--- a/protocols/SkypeWeb/src/skype_proto.h
+++ b/protocols/SkypeWeb/src/skype_proto.h
@@ -126,8 +126,6 @@ private:
 	int OnInitStatusMenu();
 
 	// options
-	CSkypeDlgBase::CreateParam SkypeMainOptionsParam;
-
 	int __cdecl OnOptionsInit(WPARAM wParam, LPARAM lParam);
 
 	// login
diff --git a/protocols/Tox/res/resource.rc b/protocols/Tox/res/resource.rc
index f6fc1c7c96..b2f892f7ae 100644
--- a/protocols/Tox/res/resource.rc
+++ b/protocols/Tox/res/resource.rc
@@ -186,12 +186,12 @@ FONT 8, "MS Shell Dlg", 400, 0, 0x1
 BEGIN
     GROUPBOX        "Multimedia",-1,7,7,296,89
     LTEXT           "Audio input device",-1,12,17,60,8
-    COMBOBOX        IDC_COMBO_AUDIOINPUT,12,26,138,30,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
+    COMBOBOX        IDC_AUDIOINPUT,12,26,138,30,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
     LTEXT           "Audio output device",-1,12,42,65,8
-    COMBOBOX        IDC_COMBO_AUDIOOUTPUT,12,52,138,30,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
+    COMBOBOX        IDC_AUDIOOUTPUT,12,52,138,30,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
     CONTROL         "Filter audio",IDC_AUDIOFILTER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,157,28,51,10
-    LTEXT           "Video input device",-1,15,68,59,8
-    COMBOBOX        IDC_COMBO_VIDEOINPUT,12,78,138,30,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
+    LTEXT           "Video input device",-1,15,68,59,8,NOT WS_VISIBLE
+    COMBOBOX        IDC_COMBO_VIDEOINPUT,12,78,138,30,CBS_DROPDOWN | CBS_SORT | NOT WS_VISIBLE | WS_VSCROLL | WS_TABSTOP
 END
 
 IDD_CHATROOM_INVITE DIALOGEX 0, 0, 190, 179
diff --git a/protocols/Tox/src/resource.h b/protocols/Tox/src/resource.h
index 69770bb555..35c43d6488 100644
--- a/protocols/Tox/src/resource.h
+++ b/protocols/Tox/src/resource.h
@@ -36,7 +36,9 @@
 #define IDC_PORT                        1019
 #define IDC_PKEY                        1020
 #define IDC_COMBO_AUDIOINPUT            1021
+#define IDC_AUDIOINPUT                  1021
 #define IDC_COMBO_AUDIOOUTPUT           1022
+#define IDC_AUDIOOUTPUT                 1022
 #define IDC_AUDIOFILTER                 1023
 #define IDC_COMBO_VIDEOINPUT            1024
 
diff --git a/protocols/Tox/src/tox_options.cpp b/protocols/Tox/src/tox_options.cpp
index 25443fb59e..49860ff5bd 100644
--- a/protocols/Tox/src/tox_options.cpp
+++ b/protocols/Tox/src/tox_options.cpp
@@ -1,6 +1,6 @@
 #include "common.h"
 
-CToxOptionsMain::CToxOptionsMain(CToxProto *proto, int idDialog, HWND hwndParent)
+CToxOptionsMain::CToxOptionsMain(CToxProto *proto, int idDialog)
 	: CToxDlgBase(proto, idDialog, false),
 	m_toxAddress(this, IDC_TOXID), m_toxAddressCopy(this, IDC_CLIPBOARD),
 	m_profileCreate(this, IDC_PROFILE_NEW), m_profileImport(this, IDC_PROFILE_IMPORT),
@@ -8,7 +8,6 @@ CToxOptionsMain::CToxOptionsMain(CToxProto *proto, int idDialog, HWND hwndParent
 	m_password(this, IDC_PASSWORD), m_group(this, IDC_GROUP),
 	m_enableUdp(this, IDC_ENABLE_UDP), m_enableIPv6(this, IDC_ENABLE_IPV6)
 {
-	SetParent(hwndParent);
 
 	CreateLink(m_toxAddress, TOX_SETTINGS_ID, _T(""));
 	CreateLink(m_nickname, "Nick", _T(""));
@@ -148,6 +147,33 @@ void CToxOptionsMain::OnApply()
 
 /////////////////////////////////////////////////////////////////////////////////
 
+CToxOptionsMultimedia::CToxOptionsMultimedia(CToxProto *proto)
+	: CToxDlgBase(proto, IDD_OPTIONS_AV, false),
+	m_audioInput(this, IDC_AUDIOINPUT), m_audioOutput(this, IDC_AUDIOOUTPUT)
+{
+	m_audioInput.OnChange = Callback(this, &CToxOptionsMultimedia::AudioInput_OnClick);
+	m_audioOutput.OnChange = Callback(this, &CToxOptionsMultimedia::AudioOutput_OnClick);
+}
+
+void CToxOptionsMultimedia::OnInitDialog()
+{
+	CToxDlgBase::OnInitDialog();
+}
+
+void CToxOptionsMultimedia::AudioInput_OnClick(CCtrlData*)
+{
+}
+
+void CToxOptionsMultimedia::AudioOutput_OnClick(CCtrlData*)
+{
+}
+
+void CToxOptionsMultimedia::OnApply()
+{
+}
+
+/////////////////////////////////////////////////////////////////////////////////
+
 CToxNodeEditor::CToxNodeEditor(int iItem, CCtrlListView *m_nodes)
 	: CSuper(g_hInstance, IDD_NODE_EDITOR),
 	m_ipv4(this, IDC_IPV4), m_ipv6(this, IDC_IPV6),
@@ -482,11 +508,16 @@ int CToxProto::OnOptionsInit(WPARAM wParam, LPARAM)
 	odp.ptszGroup = LPGENT("Network");
 
 	odp.ptszTab = LPGENT("Account");
-	odp.pDialog = new CToxOptionsMain(this, IDD_OPTIONS_MAIN);
+	odp.pDialog = CToxOptionsMain::CreateOptionsPage(this);
+	Options_AddPage(wParam, &odp);
+
+	odp.ptszTab = LPGENT("Multimedia");
+	odp.pDialog = CToxOptionsMultimedia::CreateOptionsPage(this);
 	Options_AddPage(wParam, &odp);
 
 	odp.ptszTab = LPGENT("Nodes");
-	odp.pDialog = new CToxOptionsNodeList(this);
+	odp.pDialog = CToxOptionsNodeList::CreateOptionsPage(this);
 	Options_AddPage(wParam, &odp);
+
 	return 0;
 }
diff --git a/protocols/Tox/src/tox_options.h b/protocols/Tox/src/tox_options.h
index afda3aee4e..6edc2688e6 100644
--- a/protocols/Tox/src/tox_options.h
+++ b/protocols/Tox/src/tox_options.h
@@ -30,14 +30,41 @@ protected:
 	void OnApply();
 
 public:
-	CToxOptionsMain(CToxProto *proto, int idDialog, HWND hwndParent = NULL);
+	CToxOptionsMain(CToxProto *proto, int idDialog);
 
 	static CDlgBase *CreateAccountManagerPage(void *param, HWND owner)
 	{
-		CToxOptionsMain *page = new CToxOptionsMain((CToxProto*)param, IDD_ACCOUNT_MANAGER, owner);
+		CToxOptionsMain *page = new CToxOptionsMain((CToxProto*)param, IDD_ACCOUNT_MANAGER);
+		page->SetParent(owner);
 		page->Show();
 		return page;
 	}
+
+	static CDlgBase *CreateOptionsPage(void *param) { return new CToxOptionsMain((CToxProto*)param, IDD_OPTIONS_MAIN); }
+};
+
+/////////////////////////////////////////////////////////////////////////////////
+
+class CToxOptionsMultimedia : public CToxDlgBase
+{
+private:
+	typedef CToxDlgBase CSuper;
+
+	CCtrlCombo m_audioInput;
+	CCtrlCombo m_audioOutput;
+
+protected:
+	void OnInitDialog();
+
+	void AudioInput_OnClick(CCtrlData*);
+	void AudioOutput_OnClick(CCtrlData*);
+
+	void OnApply();
+
+public:
+	CToxOptionsMultimedia(CToxProto *proto);
+
+	static CDlgBase *CreateOptionsPage(void *param) { return new CToxOptionsMultimedia((CToxProto*)param); }
 };
 
 /////////////////////////////////////////////////////////////////////////////////
@@ -92,9 +119,6 @@ private:
 	CCtrlNodeList m_nodes;
 	CCtrlButton m_addNode;
 
-public:
-	CToxOptionsNodeList(CToxProto *proto);
-
 protected:
 	void OnInitDialog();
 	void OnApply();
@@ -103,6 +127,11 @@ protected:
 	void OnNodeListDoubleClick(CCtrlBase*);
 	void OnNodeListClick(CCtrlListView::TEventInfo *evt);
 	void OnNodeListKeyDown(CCtrlListView::TEventInfo *evt);
+
+public:
+	CToxOptionsNodeList(CToxProto *proto);
+
+	static CDlgBase *CreateOptionsPage(void *param) { return new CToxOptionsNodeList((CToxProto*)param); }
 };
 
 #endif //_TOX_OPTIONS_H_
\ No newline at end of file
-- 
cgit v1.2.3