summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libs/client/OSCClientReceiver.cpp2
-rw-r--r--src/libs/client/PluginModel.cpp88
-rw-r--r--src/libs/client/PluginModel.hpp2
-rw-r--r--src/libs/gui/NodeMenu.cpp15
-rw-r--r--src/libs/gui/NodeMenu.hpp2
-rw-r--r--src/libs/gui/NodeModule.cpp30
-rw-r--r--src/libs/gui/ingen_gui.glade16
7 files changed, 126 insertions, 29 deletions
diff --git a/src/libs/client/OSCClientReceiver.cpp b/src/libs/client/OSCClientReceiver.cpp
index d6ce3f81..63bf5b69 100644
--- a/src/libs/client/OSCClientReceiver.cpp
+++ b/src/libs/client/OSCClientReceiver.cpp
@@ -39,7 +39,7 @@ OSCClientReceiver::OSCClientReceiver(int listen_port)
// _receiving_node_num_ports(0),
// _num_received_ports(0)
{
- start(true);
+ start(false);
}
diff --git a/src/libs/client/PluginModel.cpp b/src/libs/client/PluginModel.cpp
index 10c767ff..442cbb43 100644
--- a/src/libs/client/PluginModel.cpp
+++ b/src/libs/client/PluginModel.cpp
@@ -52,34 +52,84 @@ PluginModel::default_node_name(SharedPtr<PatchModel> parent)
return name;
}
-#ifdef HAVE_SLV2
-void*
-PluginModel::gui()
+
+void
+lv2_ui_write(LV2UI_Controller controller,
+ uint32_t port,
+ uint32_t buffer_size,
+ const void* buffer)
{
- assert(_type == LV2);
+ cerr << "********* LV2 UI WRITE" << endl;
+}
+
+
+void
+lv2_ui_command(LV2UI_Controller controller,
+ uint32_t argc,
+ const char* const* argv)
+{
+ cerr << "********* LV2 UI COMMAND" << endl;
+}
+
- Glib::Mutex::Lock(_rdf_world->mutex());
+void
+lv2_ui_program_change(LV2UI_Controller controller,
+ unsigned char program)
+{
+ cerr << "********* LV2 UI PROGRAM CHANGE" << endl;
+}
+
- SLV2Values gui = slv2_plugin_get_guis(_slv2_plugin);
- if (slv2_values_size(gui) > 0) {
- printf("\tGUI:\n");
- for (unsigned i=0; i < slv2_values_size(gui); ++i) {
- printf("\t\t%s\n", slv2_value_as_uri(slv2_values_get_at(gui, i)));
-
- SLV2Value binary = slv2_plugin_get_gui_library_uri(_slv2_plugin, slv2_values_get_at(gui, i));
-
- printf("\t\t\tType: %s\n", slv2_gui_type_get_uri(slv2_value_as_gui_type(
- slv2_values_get_at(gui, i))));
+void
+lv2_ui_program_save(LV2UI_Controller controller,
+ unsigned char program,
+ const char* name)
+{
+ cerr << "********* LV2 UI PROGRAM SAVE" << endl;
+}
+
+#ifdef HAVE_SLV2
+SLV2UIInstance
+PluginModel::ui()
+{
+ if (_type != LV2)
+ return NULL;
+
+ Glib::Mutex::Lock(_rdf_world->mutex());
+
+ SLV2UIInstance ret = NULL;
+
+ SLV2Values ui = slv2_plugin_get_uis(_slv2_plugin);
+ if (slv2_values_size(ui) > 0) {
+ printf("\tUIs:\n");
+ for (unsigned i=0; i < slv2_values_size(ui); ++i) {
+ printf("\t\t%s\n", slv2_value_as_uri(slv2_values_get_at(ui, i)));
+
+ SLV2Value binary = slv2_plugin_get_ui_library_uri(_slv2_plugin, slv2_values_get_at(ui, i));
+
+ printf("\t\t\tType: %s\n", slv2_ui_type_get_uri(slv2_value_as_ui_type(
+ slv2_values_get_at(ui, i))));
+
if (binary)
- printf("\t\t\tBinary: %s\n", slv2_value_as_uri(binary));
-
+ printf("\t\t\tBinary: %s\n", slv2_value_as_uri(binary));
+
slv2_value_free(binary);
}
+
+ if (slv2_values_size(ui) > 1)
+ printf("WARNING: Multiple UIs found, using the first...");
+
+ ret = slv2_plugin_ui_instantiate(_slv2_plugin,
+ slv2_values_get_at(ui, 0),
+ lv2_ui_write, lv2_ui_command,
+ lv2_ui_program_change, lv2_ui_program_save,
+ NULL, NULL);
}
- slv2_values_free(gui);
- return NULL;
+ slv2_values_free(ui);
+
+ return ret;
}
#endif
diff --git a/src/libs/client/PluginModel.hpp b/src/libs/client/PluginModel.hpp
index ba5598c0..bcf2645c 100644
--- a/src/libs/client/PluginModel.hpp
+++ b/src/libs/client/PluginModel.hpp
@@ -107,7 +107,7 @@ public:
_slv2_plugins = slv2_world_get_all_plugins(_slv2_world);
}
- void* gui();
+ SLV2UIInstance ui();
#endif
static void set_rdf_world(Raul::RDF::World& world) {
diff --git a/src/libs/gui/NodeMenu.cpp b/src/libs/gui/NodeMenu.cpp
index 54966e7e..9c2d978e 100644
--- a/src/libs/gui/NodeMenu.cpp
+++ b/src/libs/gui/NodeMenu.cpp
@@ -37,10 +37,13 @@ NodeMenu::NodeMenu(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml
Gtk::Menu* node_menu = NULL;
xml->get_widget("node_menu", node_menu);
xml->get_widget("node_controls_menuitem", _controls_menuitem);
+ xml->get_widget("node_gui_menuitem", _gui_menuitem);
node_menu->remove(*_controls_menuitem);
+ node_menu->remove(*_gui_menuitem);
items().push_front(Gtk::Menu_Helpers::SeparatorElem());
insert(*_controls_menuitem, 0);
+ insert(*_gui_menuitem, 0);
}
@@ -52,12 +55,24 @@ NodeMenu::init(SharedPtr<NodeModel> node)
_controls_menuitem->signal_activate().connect(sigc::bind(
sigc::mem_fun(App::instance().window_factory(), &WindowFactory::present_controls),
node));
+
+ if (node->plugin()->ui())
+ _gui_menuitem->signal_activate().connect(sigc::mem_fun(this, &NodeMenu::show_gui));
+ //else
+ // _gui_menuitem->hide();
_enable_signal = true;
}
void
+NodeMenu::show_gui()
+{
+ cerr << "SHOW GUI" << endl;
+}
+
+
+void
NodeMenu::on_menu_clone()
{
cerr << "[NodeMenu] FIXME: clone broken\n";
diff --git a/src/libs/gui/NodeMenu.hpp b/src/libs/gui/NodeMenu.hpp
index 20bc62e7..50226837 100644
--- a/src/libs/gui/NodeMenu.hpp
+++ b/src/libs/gui/NodeMenu.hpp
@@ -55,11 +55,13 @@ protected:
virtual void enable_controls_menuitem();
virtual void disable_controls_menuitem();
+ void show_gui();
void on_menu_clone();
void on_menu_learn();
Gtk::MenuItem* _controls_menuitem;
+ Gtk::MenuItem* _gui_menuitem;
};
diff --git a/src/libs/gui/NodeModule.cpp b/src/libs/gui/NodeModule.cpp
index e1839f37..25cc4aa1 100644
--- a/src/libs/gui/NodeModule.cpp
+++ b/src/libs/gui/NodeModule.cpp
@@ -51,9 +51,7 @@ NodeModule::NodeModule(boost::shared_ptr<PatchCanvas> canvas, SharedPtr<NodeMode
node->signal_metadata.connect(sigc::mem_fun(this, &NodeModule::set_metadata));
node->signal_polyphonic.connect(sigc::mem_fun(this, &NodeModule::set_stacked_border));
node->signal_renamed.connect(sigc::mem_fun(this, &NodeModule::rename));
-
- signal_clicked.connect(sigc::mem_fun(this, &NodeModule::on_click));
-
+
set_stacked_border(node->polyphonic());
}
@@ -123,15 +121,31 @@ NodeModule::show_control_window()
{
#ifdef HAVE_SLV2
if (_node->plugin()->type() == PluginModel::LV2) {
- GtkWidget* gui = (GtkWidget*)_node->plugin()->gui();
- if (gui) {
- cerr << "GUI!\n";
+ // FIXME: check type
+
+ SLV2UIInstance ui = _node->plugin()->ui();
+ if (ui) {
+ cerr << "Showing LV2 GUI" << endl;
+ // FIXME: leak
+ GtkWidget* c_widget = (GtkWidget*)slv2_ui_instance_get_widget(_node->plugin()->ui());
+ Gtk::Window* win = new Gtk::Window();
+ Gtk::Widget* widget = Glib::wrap(c_widget);
+ win->add(*widget);
+ widget->show_all();
+ win->show_all();
+ win->present();
+ widget->show_all();
+ win->show_all();
} else {
- cerr << "No gui :(\n";
+ cerr << "No LV2 GUI, showing builtin controls" << endl;
+ App::instance().window_factory()->present_controls(_node);
}
+ } else {
+ App::instance().window_factory()->present_controls(_node);
}
-#endif
+#else
App::instance().window_factory()->present_controls(_node);
+#endif
}
diff --git a/src/libs/gui/ingen_gui.glade b/src/libs/gui/ingen_gui.glade
index 498faad4..65c2ffdd 100644
--- a/src/libs/gui/ingen_gui.glade
+++ b/src/libs/gui/ingen_gui.glade
@@ -3168,5 +3168,21 @@ Thank you for contributing.</property>
</child>
</widget>
</child>
+ <child>
+ <widget class="GtkImageMenuItem" id="node_gui_menuitem">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="tooltip" translatable="yes">Show this node's custom graphical interface</property>
+ <property name="label" translatable="yes">GUI</property>
+ <property name="use_underline">True</property>
+ <child internal-child="image">
+ <widget class="GtkImage" id="menu-item-image22">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="stock">gtk-edit</property>
+ </widget>
+ </child>
+ </widget>
+ </child>
</widget>
</glade-interface>