summaryrefslogtreecommitdiff
path: root/libs/surfaces
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2011-05-04 09:22:11 +0000
committerCarl Hetherington <carl@carlh.net>2011-05-04 09:22:11 +0000
commitba8a593c294456e0b6e033e39d22eccd0548f7b5 (patch)
treed65ba1e32d2431ebc9174a1f0467f479aaeee3c9 /libs/surfaces
parentcff8af89deb16130fa290fc9e6af8093f682c50b (diff)
Add small GUI to select Mackie / BCF2000 emulation for the mackie surface.
git-svn-id: svn://localhost/ardour2/branches/3.0@9467 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/surfaces')
-rw-r--r--libs/surfaces/mackie/gui.cc97
-rw-r--r--libs/surfaces/mackie/mackie_control_protocol.cc1
-rw-r--r--libs/surfaces/mackie/mackie_control_protocol.h7
-rw-r--r--libs/surfaces/mackie/wscript4
4 files changed, 108 insertions, 1 deletions
diff --git a/libs/surfaces/mackie/gui.cc b/libs/surfaces/mackie/gui.cc
new file mode 100644
index 0000000000..2742dc8c9c
--- /dev/null
+++ b/libs/surfaces/mackie/gui.cc
@@ -0,0 +1,97 @@
+/*
+ Copyright (C) 2010 Paul Davis
+
+ 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, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include <gtkmm/comboboxtext.h>
+#include <gtkmm/box.h>
+#include "gtkmm2ext/utils.h"
+#include "ardour/rc_configuration.h"
+#include "mackie_control_protocol.h"
+#include "i18n.h"
+
+using namespace std;
+
+class MackieControlProtocolGUI : public Gtk::VBox
+{
+public:
+ MackieControlProtocolGUI (MackieControlProtocol &);
+
+private:
+
+ void surface_combo_changed ();
+
+ MackieControlProtocol& _cp;
+ Gtk::ComboBoxText _surface_combo;
+};
+
+void*
+MackieControlProtocol::get_gui () const
+{
+ if (!_gui) {
+ const_cast<MackieControlProtocol*>(this)->build_gui ();
+ }
+
+ return _gui;
+}
+
+void
+MackieControlProtocol::tear_down_gui ()
+{
+ delete (MackieControlProtocolGUI*) _gui;
+}
+
+void
+MackieControlProtocol::build_gui ()
+{
+ _gui = (void *) new MackieControlProtocolGUI (*this);
+}
+
+MackieControlProtocolGUI::MackieControlProtocolGUI (MackieControlProtocol& p)
+ : _cp (p)
+{
+ Gtk::HBox* hbox = Gtk::manage (new Gtk::HBox);
+ hbox->set_spacing (4);
+ hbox->pack_start (*manage (new Gtk::Label (_("Surface to support:"))));
+ hbox->pack_start (_surface_combo);
+
+ vector<string> surfaces;
+ surfaces.push_back (_("Mackie Control"));
+ surfaces.push_back (_("Behringer BCF2000"));
+ Gtkmm2ext::set_popdown_strings (_surface_combo, surfaces);
+
+ if (ARDOUR::Config->get_mackie_emulation () == X_("mcu")) {
+ _surface_combo.set_active_text (surfaces.front ());
+ } else {
+ _surface_combo.set_active_text (surfaces.back ());
+ }
+
+ pack_start (*hbox);
+
+ show_all ();
+
+ _surface_combo.signal_changed().connect (sigc::mem_fun (*this, &MackieControlProtocolGUI::surface_combo_changed));
+}
+
+void
+MackieControlProtocolGUI::surface_combo_changed ()
+{
+ if (_surface_combo.get_active_text() == _("Mackie Control")) {
+ ARDOUR::Config->set_mackie_emulation (X_("mcu"));
+ } else {
+ ARDOUR::Config->set_mackie_emulation (X_("bcf"));
+ }
+}
diff --git a/libs/surfaces/mackie/mackie_control_protocol.cc b/libs/surfaces/mackie/mackie_control_protocol.cc
index 005d28f7aa..63a8dde543 100644
--- a/libs/surfaces/mackie/mackie_control_protocol.cc
+++ b/libs/surfaces/mackie/mackie_control_protocol.cc
@@ -83,6 +83,7 @@ MackieControlProtocol::MackieControlProtocol (Session& session)
, _timecode_type (ARDOUR::AnyTime::BBT)
, _input_bundle (new ARDOUR::Bundle (_("Mackie Control In"), true))
, _output_bundle (new ARDOUR::Bundle (_("Mackie Control Out"), false))
+ , _gui (0)
{
DEBUG_TRACE (DEBUG::MackieControl, "MackieControlProtocol::MackieControlProtocol\n");
}
diff --git a/libs/surfaces/mackie/mackie_control_protocol.h b/libs/surfaces/mackie/mackie_control_protocol.h
index 458dc86172..5147586787 100644
--- a/libs/surfaces/mackie/mackie_control_protocol.h
+++ b/libs/surfaces/mackie/mackie_control_protocol.h
@@ -87,6 +87,10 @@ class MackieControlProtocol
std::list<boost::shared_ptr<ARDOUR::Bundle> > bundles ();
+ bool has_editor () const { return true; }
+ void* get_gui () const;
+ void tear_down_gui ();
+
// control events
void handle_control_event(Mackie::SurfacePort & port, Mackie::Control & control, const Mackie::ControlState & state);
@@ -344,6 +348,9 @@ class MackieControlProtocol
boost::shared_ptr<ARDOUR::Bundle> _input_bundle;
// Bundle to represent our output ports
boost::shared_ptr<ARDOUR::Bundle> _output_bundle;
+
+ void build_gui ();
+ void* _gui;
};
#endif // ardour_mackie_control_protocol_h
diff --git a/libs/surfaces/mackie/wscript b/libs/surfaces/mackie/wscript
index 437865ec9c..f091acb148 100644
--- a/libs/surfaces/mackie/wscript
+++ b/libs/surfaces/mackie/wscript
@@ -25,6 +25,7 @@ def build(bld):
bcf_surface_generated.cc
controls.cc
dummy_port.cc
+ gui.cc
interface.cc
mackie_button_handler.cc
mackie_control_protocol.cc
@@ -45,7 +46,8 @@ def build(bld):
obj.includes = ['.', './mackie']
obj.name = 'libardour_mcp'
obj.target = 'ardour_mcp'
- obj.uselib_local = 'libardour libardour_cp'
+ obj.uselib = 'GTKMM'
+ obj.uselib_local = 'libardour libardour_cp libgtkmm2ext'
obj.vnum = LIBARDOUR_MCP_LIB_VERSION
obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3', 'surfaces')