diff options
author | David Robillard <d@drobilla.net> | 2007-04-07 06:35:36 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-04-07 06:35:36 +0000 |
commit | 883f2e9f31914912f4c5e19bc9e463fe3663a638 (patch) | |
tree | e58ec7c219241468d4875cac08dfd67b61cb2a67 | |
parent | 6178329ac029b44b7b9b4cfd7185b65aeb3269a9 (diff) | |
download | ingen-883f2e9f31914912f4c5e19bc9e463fe3663a638.tar.gz ingen-883f2e9f31914912f4c5e19bc9e463fe3663a638.tar.bz2 ingen-883f2e9f31914912f4c5e19bc9e463fe3663a638.zip |
Visual tweaks.
Loading range for LV2 plugins (client side).
git-svn-id: http://svn.drobilla.net/lad/ingen@413 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r-- | src/libs/client/NodeModel.h | 2 | ||||
-rw-r--r-- | src/libs/client/PluginModel.h | 25 | ||||
-rw-r--r-- | src/progs/ingenuity/ControlGroups.cpp | 34 | ||||
-rw-r--r-- | src/progs/ingenuity/ControlGroups.h | 23 | ||||
-rw-r--r-- | src/progs/ingenuity/ControlPanel.cpp | 1 | ||||
-rw-r--r-- | src/progs/ingenuity/NodeControlWindow.cpp | 1 | ||||
-rw-r--r-- | src/progs/ingenuity/PatchWindow.cpp | 10 | ||||
-rw-r--r-- | src/progs/ingenuity/ingenuity.glade | 21 | ||||
-rw-r--r-- | src/progs/ingenuity/main.cpp | 15 |
9 files changed, 89 insertions, 43 deletions
diff --git a/src/libs/client/NodeModel.h b/src/libs/client/NodeModel.h index 934261d8..2dd96f35 100644 --- a/src/libs/client/NodeModel.h +++ b/src/libs/client/NodeModel.h @@ -52,7 +52,7 @@ public: const map<int, map<int, string> >& get_programs() const { return _banks; } const string& plugin_uri() const { return _plugin_uri; } - SharedPtr<PluginModel> plugin() const { return _plugin; } + SharedPtr<PluginModel> plugin() const { return _plugin; } int num_ports() const { return _ports.size(); } const PortModelList& ports() const { return _ports; } virtual bool polyphonic() const { return _polyphonic; } diff --git a/src/libs/client/PluginModel.h b/src/libs/client/PluginModel.h index b9f784ed..4c769fdb 100644 --- a/src/libs/client/PluginModel.h +++ b/src/libs/client/PluginModel.h @@ -18,9 +18,13 @@ #ifndef PLUGINMODEL_H #define PLUGINMODEL_H +#include "../../config.h" #include <string> #include <iostream> #include "raul/Path.h" +#ifdef HAVE_SLV2 +#include <slv2/slv2.h> +#endif using std::string; using std::cerr; using std::endl; namespace Ingen { @@ -37,10 +41,19 @@ public: enum Type { LV2, LADSPA, DSSI, Internal, Patch }; PluginModel(const string& uri, const string& type_uri, const string& name) - : _uri(uri), - _name(name) + : _uri(uri) + , _name(name) { set_type_from_uri(type_uri); +#ifdef HAVE_SLV2 + static SLV2Plugins plugins = NULL; + if (!plugins) { + plugins = slv2_plugins_new(); + slv2_plugins_load_all(plugins); + } + + _slv2_plugin = slv2_plugins_get_by_uri(plugins, uri.c_str()); +#endif } Type type() const { return _type; } @@ -87,10 +100,18 @@ public: string default_node_name() { return Raul::Path::nameify(_name); } +#ifdef HAVE_SLV2 + SLV2Plugin slv2_plugin() { return _slv2_plugin; } +#endif + private: Type _type; string _uri; string _name; + +#ifdef HAVE_SLV2 + SLV2Plugin _slv2_plugin; +#endif }; diff --git a/src/progs/ingenuity/ControlGroups.cpp b/src/progs/ingenuity/ControlGroups.cpp index 1b4e95fb..9ea60c5d 100644 --- a/src/progs/ingenuity/ControlGroups.cpp +++ b/src/progs/ingenuity/ControlGroups.cpp @@ -20,6 +20,8 @@ #include "ModelEngineInterface.h" #include "ControlGroups.h" #include "ControlPanel.h" +#include "PluginModel.h" +#include "NodeModel.h" #include "PortModel.h" #include "App.h" @@ -98,12 +100,23 @@ SliderControlGroup::init(ControlPanel* panel, SharedPtr<PortModel> pm, bool sepa min = min_atom.get_float(); max = max_atom.get_float(); } + + const SharedPtr<NodeModel> parent = PtrCast<NodeModel>(pm->parent()); + + if (parent && parent->plugin()->type() == PluginModel::LV2) { + min = slv2_port_get_minimum_value( + parent->plugin()->slv2_plugin(), + slv2_port_by_symbol(pm->path().name().c_str())); + max = slv2_port_get_maximum_value( + parent->plugin()->slv2_plugin(), + slv2_port_by_symbol(pm->path().name().c_str())); + } if (max <= min) max = min + 1.0f; set_name(pm->path().name()); - + _min_spinner->set_value(min); _min_spinner->signal_value_changed().connect(sigc::mem_fun(*this, &SliderControlGroup::min_changed)); _max_spinner->set_value(max); @@ -112,11 +125,11 @@ SliderControlGroup::init(ControlPanel* panel, SharedPtr<PortModel> pm, bool sepa _slider->set_value(_port_model->value()); _slider->signal_event().connect( - sigc::mem_fun(*this, &SliderControlGroup::slider_pressed)); + sigc::mem_fun(*this, &SliderControlGroup::slider_pressed)); _slider->signal_value_changed().connect( - sigc::mem_fun(*this, &SliderControlGroup::update_value_from_slider)); - + sigc::mem_fun(*this, &SliderControlGroup::update_value_from_slider)); + _slider->set_range(min, max); set_value(pm->value()); @@ -128,6 +141,19 @@ SliderControlGroup::init(ControlPanel* panel, SharedPtr<PortModel> pm, bool sepa void +SliderControlGroup::set_value(float val) +{ + _enable_signal = false; + //if (_enabled) { + if (_slider->get_value() != val) + _slider->set_value(val); + //m_value_spinner->set_value(val); + //} + _enable_signal = true; +} + + +void SliderControlGroup::metadata_update(const string& key, const Atom& value) { _enable_signal = false; diff --git a/src/progs/ingenuity/ControlGroups.h b/src/progs/ingenuity/ControlGroups.h index 17a0ac25..1cbf34d7 100644 --- a/src/progs/ingenuity/ControlGroups.h +++ b/src/progs/ingenuity/ControlGroups.h @@ -41,10 +41,9 @@ class ControlGroup : public Gtk::VBox { public: ControlGroup(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& glade_xml); + virtual ~ControlGroup() { delete _separator; } void init(ControlPanel* panel, SharedPtr<PortModel> pm, bool separator); - - ~ControlGroup() { delete _separator; } inline const SharedPtr<PortModel> port_model() const { return _port_model; } @@ -77,14 +76,15 @@ public: void enable(); void disable(); + + void set_min(float val); + void set_max(float val); private: void set_name(const string& name); virtual void metadata_update(const string& key, const Atom& value); - inline void set_value(const float val); - void set_min(float val); - void set_max(float val); + void set_value(float value); void min_changed(); void max_changed(); @@ -106,19 +106,6 @@ private: }; -inline void -SliderControlGroup::set_value(const float val) -{ - _enable_signal = false; - //if (_enabled) { - if (_slider->get_value() != val) - _slider->set_value(val); - //m_value_spinner->set_value(val); - //} - _enable_signal = true; -} - - #if 0 /** A spinbutton for integer controls. diff --git a/src/progs/ingenuity/ControlPanel.cpp b/src/progs/ingenuity/ControlPanel.cpp index 2abd6049..6cbef330 100644 --- a/src/progs/ingenuity/ControlPanel.cpp +++ b/src/progs/ingenuity/ControlPanel.cpp @@ -21,6 +21,7 @@ #include "PatchModel.h" #include "NodeModel.h" #include "PortModel.h" +#include "PluginModel.h" #include "ControlGroups.h" #include "GladeFactory.h" diff --git a/src/progs/ingenuity/NodeControlWindow.cpp b/src/progs/ingenuity/NodeControlWindow.cpp index 8d13ed7e..49578c1d 100644 --- a/src/progs/ingenuity/NodeControlWindow.cpp +++ b/src/progs/ingenuity/NodeControlWindow.cpp @@ -114,7 +114,6 @@ NodeControlWindow::on_show() if ((*i)->is_control() && (*i)->is_input()) App::instance().engine()->request_port_value((*i)->path()); - if (_position_stored) move(_x, _y); diff --git a/src/progs/ingenuity/PatchWindow.cpp b/src/progs/ingenuity/PatchWindow.cpp index a0a0c6a3..22305247 100644 --- a/src/progs/ingenuity/PatchWindow.cpp +++ b/src/progs/ingenuity/PatchWindow.cpp @@ -191,8 +191,16 @@ PatchWindow::set_patch(SharedPtr<PatchModel> patch, SharedPtr<PatchView> view) _breadcrumb_box->build(patch->path(), _view); _breadcrumb_box->show(); + + _menu_view_control_window->property_sensitive() = false; - //m_menu_view_control_window->property_sensitive() = patch->has_control_inputs(); + for (PortModelList::const_iterator p = patch->ports().begin(); + p != patch->ports().end(); ++p) { + if ((*p)->is_control()) { + _menu_view_control_window->property_sensitive() = true; + break; + } + } int width, height; get_size(width, height); diff --git a/src/progs/ingenuity/ingenuity.glade b/src/progs/ingenuity/ingenuity.glade index 16b2bd9a..393b3660 100644 --- a/src/progs/ingenuity/ingenuity.glade +++ b/src/progs/ingenuity/ingenuity.glade @@ -52,7 +52,7 @@ <accelerator key="I" modifiers="GDK_CONTROL_MASK" signal="activate"/> <child internal-child="image"> - <widget class="GtkImage" id="image1987"> + <widget class="GtkImage" id="image2003"> <property name="visible">True</property> <property name="stock">gtk-open</property> <property name="icon_size">1</property> @@ -104,10 +104,9 @@ <property name="label" translatable="yes">Confi_guration</property> <property name="use_underline">True</property> <signal name="activate" handler="on_patch_configuration_menuitem_activate" last_modification_time="Sun, 29 Jan 2006 21:17:26 GMT"/> - <accelerator key="G" modifiers="GDK_CONTROL_MASK" signal="activate"/> <child internal-child="image"> - <widget class="GtkImage" id="image1988"> + <widget class="GtkImage" id="image2004"> <property name="visible">True</property> <property name="stock">gtk-preferences</property> <property name="icon_size">1</property> @@ -237,10 +236,10 @@ <property name="tooltip" translatable="yes">Automatically arrange canvas</property> <property name="label" translatable="yes">_Arrange</property> <property name="use_underline">True</property> - <accelerator key="A" modifiers="GDK_CONTROL_MASK" signal="activate"/> + <accelerator key="G" modifiers="GDK_CONTROL_MASK" signal="activate"/> <child internal-child="image"> - <widget class="GtkImage" id="image1989"> + <widget class="GtkImage" id="image2005"> <property name="visible">True</property> <property name="stock">gtk-sort-ascending</property> <property name="icon_size">1</property> @@ -263,7 +262,7 @@ <accelerator key="C" modifiers="GDK_CONTROL_MASK" signal="activate"/> <child internal-child="image"> - <widget class="GtkImage" id="image1990"> + <widget class="GtkImage" id="image2006"> <property name="visible">True</property> <property name="stock">gtk-preferences</property> <property name="icon_size">1</property> @@ -305,7 +304,7 @@ <signal name="activate" handler="on_patch_destroy_menuitem_activate" last_modification_time="Wed, 25 May 2005 00:22:00 GMT"/> <child internal-child="image"> - <widget class="GtkImage" id="image1991"> + <widget class="GtkImage" id="image2007"> <property name="visible">True</property> <property name="stock">gtk-delete</property> <property name="icon_size">1</property> @@ -342,7 +341,7 @@ <accelerator key="E" modifiers="GDK_CONTROL_MASK" signal="activate"/> <child internal-child="image"> - <widget class="GtkImage" id="image1992"> + <widget class="GtkImage" id="image2008"> <property name="visible">True</property> <property name="stock">gtk-connect</property> <property name="icon_size">1</property> @@ -365,7 +364,7 @@ <accelerator key="T" modifiers="GDK_CONTROL_MASK" signal="activate"/> <child internal-child="image"> - <widget class="GtkImage" id="image1993"> + <widget class="GtkImage" id="image2009"> <property name="visible">True</property> <property name="stock">gtk-index</property> <property name="icon_size">1</property> @@ -388,7 +387,7 @@ <accelerator key="M" modifiers="GDK_CONTROL_MASK" signal="activate"/> <child internal-child="image"> - <widget class="GtkImage" id="image1994"> + <widget class="GtkImage" id="image2010"> <property name="visible">True</property> <property name="stock">gtk-dialog-error</property> <property name="icon_size">1</property> @@ -423,7 +422,7 @@ <signal name="activate" handler="on_right-click_the_canvas_to_add_objects1_activate" last_modification_time="Fri, 16 Jun 2006 17:51:05 GMT"/> <child internal-child="image"> - <widget class="GtkImage" id="image1995"> + <widget class="GtkImage" id="image2011"> <property name="visible">True</property> <property name="stock">gtk-info</property> <property name="icon_size">1</property> diff --git a/src/progs/ingenuity/main.cpp b/src/progs/ingenuity/main.cpp index 96ff7088..a21c0a8d 100644 --- a/src/progs/ingenuity/main.cpp +++ b/src/progs/ingenuity/main.cpp @@ -23,6 +23,9 @@ #ifdef HAVE_LASH #include "LashController.h" #endif +#ifdef HAVE_SLV2 + #include <slv2/slv2.h> +#endif using namespace Ingenuity; @@ -52,20 +55,22 @@ main(int argc, char** argv) /* Load settings */ App::instance().configuration()->load_settings(); App::instance().configuration()->apply_settings(); - -#ifdef HAVE_LASH - lash_args_t* lash_args = lash_extract_args(&argc, &argv); +#ifdef HAVE_SLV2 + slv2_init(); #endif - - //gtk_main.signal_quit().connect(sigc::ptr_fun(cleanup)); #ifdef HAVE_LASH + lash_args_t* lash_args = lash_extract_args(&argc, &argv); LashController* lash_controller = new LashController(lash_args); #endif App::instance().connect_window()->start(); gtk_main.run(); +#ifdef HAVE_SLV2 + slv2_finish(); +#endif + return 0; } |