summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/libs/client/NodeModel.cpp2
-rw-r--r--src/libs/client/PluginModel.cpp28
-rw-r--r--src/libs/client/PluginModel.hpp4
-rw-r--r--src/libs/gui/PatchCanvas.cpp23
4 files changed, 50 insertions, 7 deletions
diff --git a/src/libs/client/NodeModel.cpp b/src/libs/client/NodeModel.cpp
index fff01aee..b429d356 100644
--- a/src/libs/client/NodeModel.cpp
+++ b/src/libs/client/NodeModel.cpp
@@ -176,8 +176,6 @@ NodeModel::port_value_range(SharedPtr<PortModel> port, float& min, float& max)
min = min_atom.get_float();
if (max_atom.type() == Atom::FLOAT)
max = max_atom.get_float();
-
- cerr << port->path() << " VALUE RANGE: " << min << ", " << max << endl;
}
diff --git a/src/libs/client/PluginModel.cpp b/src/libs/client/PluginModel.cpp
index 8a9ecc7d..0e6c06b3 100644
--- a/src/libs/client/PluginModel.cpp
+++ b/src/libs/client/PluginModel.cpp
@@ -166,6 +166,34 @@ PluginModel::ui(EngineInterface* engine, NodeModel* node) const
return ret;
}
+
+const string&
+PluginModel::icon_path() const
+{
+ if (_icon_path == "" && _type == LV2)
+ _icon_path = get_lv2_icon_path(_slv2_plugin);
+
+ return _icon_path;
+}
+
+
+string
+PluginModel::get_lv2_icon_path(SLV2Plugin plugin)
+{
+ string result;
+ SLV2Values paths = slv2_plugin_get_value(plugin, SLV2_URI,
+ "http://ll-plugins.nongnu.org/lv2/namespace#svgIcon");
+
+ if (slv2_values_size(paths) > 0) {
+ SLV2Value value = slv2_values_get_at(paths, 0);
+ if (slv2_value_is_uri(value))
+ result = slv2_uri_to_path(slv2_value_as_string(value));
+ slv2_values_free(paths);
+ }
+
+ return result;
+}
+
#endif
} // namespace Client
diff --git a/src/libs/client/PluginModel.hpp b/src/libs/client/PluginModel.hpp
index 56b33723..75cf70f5 100644
--- a/src/libs/client/PluginModel.hpp
+++ b/src/libs/client/PluginModel.hpp
@@ -90,6 +90,9 @@ public:
}
SLV2UIInstance ui(Ingen::Shared::EngineInterface* engine, NodeModel* node) const;
+
+ const string& icon_path() const;
+ static string get_lv2_icon_path(SLV2Plugin plugin);
#endif
static void set_rdf_world(Raul::RDF::World& world) {
@@ -109,6 +112,7 @@ private:
static SLV2Plugins _slv2_plugins;
SLV2Plugin _slv2_plugin;
+ mutable string _icon_path;
#endif
static Raul::RDF::World* _rdf_world;
diff --git a/src/libs/gui/PatchCanvas.cpp b/src/libs/gui/PatchCanvas.cpp
index 35e8ad71..d67f301c 100644
--- a/src/libs/gui/PatchCanvas.cpp
+++ b/src/libs/gui/PatchCanvas.cpp
@@ -157,11 +157,24 @@ PatchCanvas::build_plugin_class_menu(Gtk::Menu* menu,
// Add plugins
for (Store::Plugins::const_iterator i = plugins.begin(); i != plugins.end(); ++i) {
SLV2Plugin p = i->second->slv2_plugin();
+
if (p && slv2_plugin_get_class(p) == plugin_class) {
- menu->items().push_back(Gtk::Menu_Helpers::MenuElem(i->second->name(),
- sigc::bind(sigc::mem_fun(this, &PatchCanvas::load_plugin),
- i->second)));
- ++num_items;
+ Glib::RefPtr<Gdk::Pixbuf> icon;
+ string icon_path = PluginModel::get_lv2_icon_path(p);
+
+ if (icon_path != "")
+ icon = Gdk::Pixbuf::create_from_file(icon_path, 20, 20);
+
+ if (icon) {
+ Gtk::Image* image = new Gtk::Image(icon);
+ menu->items().push_back(Gtk::Menu_Helpers::ImageMenuElem(i->second->name(),
+ *image,
+ sigc::bind(sigc::mem_fun(this, &PatchCanvas::load_plugin), i->second)));
+ } else {
+ menu->items().push_back(Gtk::Menu_Helpers::MenuElem(i->second->name(),
+ sigc::bind(sigc::mem_fun(this, &PatchCanvas::load_plugin), i->second)));
+ ++num_items;
+ }
}
}
@@ -176,7 +189,7 @@ PatchCanvas::build_plugin_menu()
_menu->items().push_back(Gtk::Menu_Helpers::ImageMenuElem("Plugin",
*(manage(new Gtk::Image(Gtk::Stock::EXECUTE, Gtk::ICON_SIZE_MENU)))));
- Gtk::MenuItem* plugin_menu_item = &(_menu->items().back());
+ Gtk::MenuItem* plugin_menu_item = &(_menu->items().back());
Gtk::Menu* plugin_menu = Gtk::manage(new Gtk::Menu());
plugin_menu_item->set_submenu(*plugin_menu);
_menu->reorder_child(*plugin_menu_item, 2);