From 467362f58489b114e0d03ba54c954ef39c4db91e Mon Sep 17 00:00:00 2001 From: jp9000 Date: Wed, 11 Dec 2013 21:50:10 -0700 Subject: [PATCH] added new settings management base class, updated main settings form, added to build files --- obs/CMakeLists.txt | 1 + obs/forms/OBSWindows.cpp | 42 ++++++++++++++---------------- obs/forms/OBSWindows.fbp | 46 ++++++++++++++++----------------- obs/forms/OBSWindows.h | 46 ++++++++++++++++----------------- obs/makefile.am | 1 + obs/platform-nix.cpp | 2 +- obs/platform-osx.cpp | 2 +- obs/settings-basic-general.cpp | 39 ++++++++++++++++++++++++++++ obs/settings-basic.hpp | 29 +++++++++++++++++++++ obs/settings.hpp | 29 +++++++++++++++++++++ obs/window-settings-basic.cpp | 29 +++++++++++++++++++++ obs/window-settings-basic.hpp | 25 +++++++++++++++--- vs/2010/OBS/OBS.vcxproj | 3 +++ vs/2010/OBS/OBS.vcxproj.filters | 9 +++++++ 14 files changed, 227 insertions(+), 76 deletions(-) create mode 100644 obs/settings-basic-general.cpp create mode 100644 obs/settings-basic.hpp create mode 100644 obs/settings.hpp diff --git a/obs/CMakeLists.txt b/obs/CMakeLists.txt index 3721327d9..3db0544a8 100644 --- a/obs/CMakeLists.txt +++ b/obs/CMakeLists.txt @@ -43,6 +43,7 @@ endif() add_executable(obs window-main-basic.cpp window-settings-basic.cpp + settings-basic-general.cpp wx-subclass.cpp wx-wrappers.cpp obs-app.cpp diff --git a/obs/forms/OBSWindows.cpp b/obs/forms/OBSWindows.cpp index 941e4466c..aa62ba636 100644 --- a/obs/forms/OBSWindows.cpp +++ b/obs/forms/OBSWindows.cpp @@ -416,8 +416,8 @@ OBSBasicSettingsBase::OBSBasicSettingsBase( wxWindow* parent, wxWindowID id, con wxBoxSizer* bSizer31; bSizer31 = new wxBoxSizer( wxVERTICAL ); - m_listbook1 = new wxListbook( this, ID_SETTINGS_LIST, wxDefaultPosition, wxDefaultSize, wxLB_DEFAULT ); - generalPanel = new wxPanel( m_listbook1, ID_SETTINGS_GENERAL, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + settingsList = new wxListbook( this, ID_SETTINGS_LIST, wxDefaultPosition, wxDefaultSize, wxLB_DEFAULT ); + generalPanel = new wxPanel( settingsList, ID_SETTINGS_GENERAL, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); wxBoxSizer* bSizer32; bSizer32 = new wxBoxSizer( wxVERTICAL ); @@ -443,8 +443,8 @@ OBSBasicSettingsBase::OBSBasicSettingsBase( wxWindow* parent, wxWindowID id, con generalPanel->SetSizer( bSizer32 ); generalPanel->Layout(); bSizer32->Fit( generalPanel ); - m_listbook1->AddPage( generalPanel, _("Settings.General"), true ); - outputsPanel = new wxPanel( m_listbook1, ID_SETTINGS_OUTPUTS, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + settingsList->AddPage( generalPanel, _("Settings.General"), false ); + outputsPanel = new wxPanel( settingsList, ID_SETTINGS_OUTPUTS, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); wxBoxSizer* bSizer33; bSizer33 = new wxBoxSizer( wxVERTICAL ); @@ -452,8 +452,8 @@ OBSBasicSettingsBase::OBSBasicSettingsBase( wxWindow* parent, wxWindowID id, con outputsPanel->SetSizer( bSizer33 ); outputsPanel->Layout(); bSizer33->Fit( outputsPanel ); - m_listbook1->AddPage( outputsPanel, _("Settings.Outputs"), false ); - videoPanel = new wxPanel( m_listbook1, ID_SETTINGS_VIDEO, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + settingsList->AddPage( outputsPanel, _("Settings.Outputs"), false ); + videoPanel = new wxPanel( settingsList, ID_SETTINGS_VIDEO, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); wxBoxSizer* bSizer34; bSizer34 = new wxBoxSizer( wxVERTICAL ); @@ -536,7 +536,7 @@ OBSBasicSettingsBase::OBSBasicSettingsBase( wxWindow* parent, wxWindowID id, con wxBoxSizer* bSizer46; bSizer46 = new wxBoxSizer( wxHORIZONTAL ); - fpsIntegerScroller = new wxSpinCtrl( m_panel14, ID_FPS_INTEGER, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 60, 30 ); + fpsIntegerScroller = new wxSpinCtrl( m_panel14, ID_FPS_INTEGER, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 120, 30 ); bSizer46->Add( fpsIntegerScroller, 0, wxTOP|wxBOTTOM|wxRIGHT, 2 ); @@ -590,8 +590,8 @@ OBSBasicSettingsBase::OBSBasicSettingsBase( wxWindow* parent, wxWindowID id, con videoPanel->SetSizer( bSizer34 ); videoPanel->Layout(); bSizer34->Fit( videoPanel ); - m_listbook1->AddPage( videoPanel, _("Settings.Video"), false ); - audioPanel = new wxPanel( m_listbook1, ID_SETTINGS_AUDIO, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + settingsList->AddPage( videoPanel, _("Settings.Video"), true ); + audioPanel = new wxPanel( settingsList, ID_SETTINGS_AUDIO, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); wxBoxSizer* bSizer36; bSizer36 = new wxBoxSizer( wxVERTICAL ); @@ -645,15 +645,15 @@ OBSBasicSettingsBase::OBSBasicSettingsBase( wxWindow* parent, wxWindowID id, con audioPanel->SetSizer( bSizer36 ); audioPanel->Layout(); bSizer36->Fit( audioPanel ); - m_listbook1->AddPage( audioPanel, _("Settings.Audio"), false ); + settingsList->AddPage( audioPanel, _("Settings.Audio"), false ); /*#ifndef __WXGTK__ // Small icon style not supported in GTK - wxListView* m_listbook1ListView = m_listbook1->GetListView(); - long m_listbook1Flags = m_listbook1ListView->GetWindowStyleFlag(); - m_listbook1Flags = ( m_listbook1Flags & ~wxLC_ICON ) | wxLC_SMALL_ICON; - m_listbook1ListView->SetWindowStyleFlag( m_listbook1Flags ); + wxListView* settingsListListView = settingsList->GetListView(); + long settingsListFlags = settingsListListView->GetWindowStyleFlag(); + settingsListFlags = ( settingsListFlags & ~wxLC_ICON ) | wxLC_SMALL_ICON; + settingsListListView->SetWindowStyleFlag( settingsListFlags ); #endif*/ - bSizer31->Add( m_listbook1, 1, wxEXPAND | wxALL, 5 ); + bSizer31->Add( settingsList, 1, wxEXPAND | wxALL, 5 ); bSizer30->Add( bSizer31, 1, wxEXPAND, 5 ); @@ -680,18 +680,14 @@ OBSBasicSettingsBase::OBSBasicSettingsBase( wxWindow* parent, wxWindowID id, con this->Centre( wxBOTH ); // Connect Events - generalPanel->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( OBSBasicSettingsBase::generalPanelUpdateUI ), NULL, this ); - outputsPanel->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( OBSBasicSettingsBase::outputsPanelUpdateUI ), NULL, this ); - videoPanel->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( OBSBasicSettingsBase::videoPanelUpdateUI ), NULL, this ); - audioPanel->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( OBSBasicSettingsBase::audioPanelUpdateUI ), NULL, this ); + settingsList->Connect( wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED, wxListbookEventHandler( OBSBasicSettingsBase::PageChanged ), NULL, this ); + settingsList->Connect( wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING, wxListbookEventHandler( OBSBasicSettingsBase::PageChanging ), NULL, this ); } OBSBasicSettingsBase::~OBSBasicSettingsBase() { // Disconnect Events - generalPanel->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( OBSBasicSettingsBase::generalPanelUpdateUI ), NULL, this ); - outputsPanel->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( OBSBasicSettingsBase::outputsPanelUpdateUI ), NULL, this ); - videoPanel->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( OBSBasicSettingsBase::videoPanelUpdateUI ), NULL, this ); - audioPanel->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( OBSBasicSettingsBase::audioPanelUpdateUI ), NULL, this ); + settingsList->Disconnect( wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED, wxListbookEventHandler( OBSBasicSettingsBase::PageChanged ), NULL, this ); + settingsList->Disconnect( wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING, wxListbookEventHandler( OBSBasicSettingsBase::PageChanging ), NULL, this ); } diff --git a/obs/forms/OBSWindows.fbp b/obs/forms/OBSWindows.fbp index 6fce1be21..9cb8b5749 100644 --- a/obs/forms/OBSWindows.fbp +++ b/obs/forms/OBSWindows.fbp @@ -2808,7 +2808,7 @@ 0 1 - m_listbook1 + settingsList 1 @@ -2835,8 +2835,8 @@ - - + PageChanged + PageChanging @@ -2893,7 +2893,7 @@ 1 - protected + public 1 Resizable @@ -3086,7 +3086,7 @@ 1 - protected + public 1 Resizable @@ -3181,7 +3181,7 @@ 1 - protected + public 1 Resizable @@ -3460,7 +3460,7 @@ 1 - protected + public 1 Resizable @@ -3634,7 +3634,7 @@ 1 - protected + public 1 Resizable @@ -3808,7 +3808,7 @@ 1 - protected + public 1 Resizable @@ -3982,7 +3982,7 @@ 1 - protected + public 1 Resizable @@ -4084,7 +4084,7 @@ 1 - protected + public 1 Resizable @@ -4344,7 +4344,7 @@ 1 - protected + public 1 Resizable @@ -4508,7 +4508,7 @@ 1 - protected + public 1 Resizable @@ -4673,7 +4673,7 @@ 0 ID_FPS_INTEGER 30 - 60 + 120 0 @@ -4686,7 +4686,7 @@ 1 - protected + public 1 Resizable @@ -4948,7 +4948,7 @@ 1 - protected + public 1 Resizable @@ -5118,7 +5118,7 @@ 1 - protected + public 1 Resizable @@ -5290,7 +5290,7 @@ 1 - protected + public 1 Resizable @@ -5577,7 +5577,7 @@ 1 - protected + public 1 Resizable @@ -5751,7 +5751,7 @@ 1 - protected + public 1 Resizable @@ -5925,7 +5925,7 @@ 1 - protected + public 1 Resizable @@ -6099,7 +6099,7 @@ 1 - protected + public 1 Resizable @@ -6273,7 +6273,7 @@ 1 - protected + public 1 Resizable diff --git a/obs/forms/OBSWindows.h b/obs/forms/OBSWindows.h index 608c8d196..a96d8b748 100644 --- a/obs/forms/OBSWindows.h +++ b/obs/forms/OBSWindows.h @@ -194,58 +194,56 @@ class OBSBasicSettingsBase : public DialogSubclass private: protected: - wxListbook* m_listbook1; - wxPanel* generalPanel; + wxListbook* settingsList; wxStaticText* m_staticText27; - wxComboBox* languageList; - wxPanel* outputsPanel; wxPanel* videoPanel; wxStaticText* m_staticText6; - wxComboBox* videoAdapterList; wxStaticText* m_staticText8; - wxComboBox* baseResList; wxStaticText* m_staticText10; - wxComboBox* downscaleResList; wxStaticText* m_staticText11; - wxComboBox* filterList; - wxCheckBox* disableAeroCheckbox; wxStaticLine* m_staticline1; wxStaticText* m_staticText22; - wxChoicebook* fpsTypeList; wxPanel* m_panel13; - wxComboBox* fpsCommonList; wxPanel* m_panel14; - wxSpinCtrl* fpsIntegerScroller; wxPanel* m_panel15; wxStaticText* m_staticText20; - wxSpinCtrl* fpsNumeratorScroller; wxStaticText* m_staticText21; - wxSpinCtrl* fpsDenominatorScroller; wxPanel* m_panel16; - wxSpinCtrl* fpsNanosecondsScroller; wxPanel* audioPanel; wxStaticText* m_staticText23; - wxComboBox* desktopAudioDeviceList; wxStaticText* m_staticText24; - wxComboBox* auxAudioDeviceList1; wxStaticText* m_staticText241; - wxComboBox* auxAudioDeviceList2; wxStaticText* m_staticText242; - wxComboBox* auxAudioDeviceList3; wxStaticText* m_staticText243; - wxComboBox* auxAudioDeviceList4; wxButton* okButton; wxButton* cancelButton; wxButton* applyButton; // Virtual event handlers, overide them in your derived class - virtual void generalPanelUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); } - virtual void outputsPanelUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); } - virtual void videoPanelUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); } - virtual void audioPanelUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); } + virtual void PageChanged( wxListbookEvent& event ) { event.Skip(); } + virtual void PageChanging( wxListbookEvent& event ) { event.Skip(); } public: + wxPanel* generalPanel; + wxComboBox* languageList; + wxPanel* outputsPanel; + wxComboBox* videoAdapterList; + wxComboBox* baseResList; + wxComboBox* downscaleResList; + wxComboBox* filterList; + wxCheckBox* disableAeroCheckbox; + wxChoicebook* fpsTypeList; + wxComboBox* fpsCommonList; + wxSpinCtrl* fpsIntegerScroller; + wxSpinCtrl* fpsNumeratorScroller; + wxSpinCtrl* fpsDenominatorScroller; + wxSpinCtrl* fpsNanosecondsScroller; + wxComboBox* desktopAudioDeviceList; + wxComboBox* auxAudioDeviceList1; + wxComboBox* auxAudioDeviceList2; + wxComboBox* auxAudioDeviceList3; + wxComboBox* auxAudioDeviceList4; OBSBasicSettingsBase( wxWindow* parent, wxWindowID id = ID_OBS_BASIC_SETTINGS, const wxString& title = _("Settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 872,686 ), long style = wxDEFAULT_DIALOG_STYLE ); ~OBSBasicSettingsBase(); diff --git a/obs/makefile.am b/obs/makefile.am index 3c11e97a1..21d509493 100644 --- a/obs/makefile.am +++ b/obs/makefile.am @@ -14,6 +14,7 @@ obs_PROGRAMS = obs obs_LDADD = $(top_srcdir)/libobs/libobs.la obs_SOURCES = window-main-basic.cpp \ window-settings-basic.cpp \ + settings-basic-general.cpp \ obs-app.cpp \ wx-subclass.cpp \ wx-wrappers.cpp \ diff --git a/obs/platform-nix.cpp b/obs/platform-nix.cpp index dfc3bcee1..88dd77cbd 100644 --- a/obs/platform-nix.cpp +++ b/obs/platform-nix.cpp @@ -21,5 +21,5 @@ bool GetDataFilePath(const char *data, string &output) { // TODO - return true; + return false; } diff --git a/obs/platform-osx.cpp b/obs/platform-osx.cpp index dfc3bcee1..88dd77cbd 100644 --- a/obs/platform-osx.cpp +++ b/obs/platform-osx.cpp @@ -21,5 +21,5 @@ bool GetDataFilePath(const char *data, string &output) { // TODO - return true; + return false; } diff --git a/obs/settings-basic-general.cpp b/obs/settings-basic-general.cpp new file mode 100644 index 000000000..ec74df76a --- /dev/null +++ b/obs/settings-basic-general.cpp @@ -0,0 +1,39 @@ +/****************************************************************************** + Copyright (C) 2013 by Hugh Bailey + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +******************************************************************************/ + +#include "settings-basic.hpp" +#include "obs-app.hpp" + +#include +using namespace std; + +class GeneralSettings : public BasicSettingsData { +public: + GeneralSettings(OBSBasicSettings *window); + + virtual void Apply(); +}; + +GeneralSettings::GeneralSettings(OBSBasicSettings *window) + : BasicSettingsData(window) +{ +} + +void GeneralSettings::Apply() +{ + +} diff --git a/obs/settings-basic.hpp b/obs/settings-basic.hpp new file mode 100644 index 000000000..5274b7062 --- /dev/null +++ b/obs/settings-basic.hpp @@ -0,0 +1,29 @@ +/****************************************************************************** + Copyright (C) 2013 by Hugh Bailey + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +******************************************************************************/ + +#pragma once + +#include "settings.hpp" +#include "window-settings-basic.hpp" + +class BasicSettingsData : public SettingsData { +protected: + OBSBasicSettings *window; + +public: + inline BasicSettingsData(OBSBasicSettings *window) : window(window) {} +}; diff --git a/obs/settings.hpp b/obs/settings.hpp new file mode 100644 index 000000000..e623f25a5 --- /dev/null +++ b/obs/settings.hpp @@ -0,0 +1,29 @@ +/****************************************************************************** + Copyright (C) 2013 by Hugh Bailey + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +******************************************************************************/ + +#pragma once + +class SettingsData { +protected: + bool dataChanged; + +public: + virtual ~SettingsData() {} + virtual void Apply()=0; + + inline bool DataChanged() const {return dataChanged;} +}; diff --git a/obs/window-settings-basic.cpp b/obs/window-settings-basic.cpp index aa164a67b..704981fac 100644 --- a/obs/window-settings-basic.cpp +++ b/obs/window-settings-basic.cpp @@ -1,2 +1,31 @@ +/****************************************************************************** + Copyright (C) 2013 by Hugh Bailey + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +******************************************************************************/ + #include "window-settings-basic.hpp" +OBSBasicSettings::OBSBasicSettings(wxWindow *parent) + : OBSBasicSettingsBase(parent) +{ +} + +void OBSBasicSettings::PageChanged(wxListbookEvent &event) +{ +} + +void OBSBasicSettings::PageChanging(wxListbookEvent &event) +{ +} diff --git a/obs/window-settings-basic.hpp b/obs/window-settings-basic.hpp index f34372bd8..3d8bb3aef 100644 --- a/obs/window-settings-basic.hpp +++ b/obs/window-settings-basic.hpp @@ -1,3 +1,20 @@ +/****************************************************************************** + Copyright (C) 2013 by Hugh Bailey + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +******************************************************************************/ + #pragma once #include "forms/OBSWindows.h" @@ -5,9 +22,9 @@ class OBSBasicSettings : public OBSBasicSettingsBase { protected: + virtual void PageChanged(wxListbookEvent &event); + virtual void PageChanging(wxListbookEvent &event); + public: - inline OBSBasicSettings(wxWindow *parent) - : OBSBasicSettingsBase(parent) - { - } + OBSBasicSettings(wxWindow *parent); }; diff --git a/vs/2010/OBS/OBS.vcxproj b/vs/2010/OBS/OBS.vcxproj index 9e36e39d6..002186baf 100644 --- a/vs/2010/OBS/OBS.vcxproj +++ b/vs/2010/OBS/OBS.vcxproj @@ -170,6 +170,7 @@ + @@ -180,6 +181,8 @@ + + diff --git a/vs/2010/OBS/OBS.vcxproj.filters b/vs/2010/OBS/OBS.vcxproj.filters index 5f35a93d8..78cca2a7b 100644 --- a/vs/2010/OBS/OBS.vcxproj.filters +++ b/vs/2010/OBS/OBS.vcxproj.filters @@ -39,6 +39,9 @@ Source Files + + Source Files + @@ -65,5 +68,11 @@ Header Files + + Header Files + + + Header Files + \ No newline at end of file -- GitLab