summaryrefslogtreecommitdiffstats
path: root/src/libs/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/gui')
-rw-r--r--src/libs/gui/App.cpp19
-rw-r--r--src/libs/gui/App.hpp16
-rw-r--r--src/libs/gui/LoadPluginWindow.cpp25
-rw-r--r--src/libs/gui/LoadPluginWindow.hpp2
-rw-r--r--src/libs/gui/PatchCanvas.cpp7
5 files changed, 38 insertions, 31 deletions
diff --git a/src/libs/gui/App.cpp b/src/libs/gui/App.cpp
index fde2fdaa..997ae791 100644
--- a/src/libs/gui/App.cpp
+++ b/src/libs/gui/App.cpp
@@ -355,6 +355,25 @@ App::quit()
}
+Glib::RefPtr<Gdk::Pixbuf>
+App::icon_from_path(const string& path)
+{
+ map<string, Glib::RefPtr<Gdk::Pixbuf> >::iterator iter = _icons.find(path);
+
+ if (iter != _icons.end())
+ return iter->second;
+
+ Glib::RefPtr<Gdk::Pixbuf> buf;
+ try {
+ buf = Gdk::Pixbuf::create_from_file(path, 20, 20);
+ _icons.insert(make_pair(path, buf));
+ } catch (...) {
+ buf = Glib::RefPtr<Gdk::Pixbuf>(0);
+ }
+ return buf;
+}
+
+
} // namespace GUI
} // namespace Ingen
diff --git a/src/libs/gui/App.hpp b/src/libs/gui/App.hpp
index 0b351003..a54db98f 100644
--- a/src/libs/gui/App.hpp
+++ b/src/libs/gui/App.hpp
@@ -93,13 +93,15 @@ public:
void port_activity(Port* port);
- ConnectWindow* connect_window() const { return _connect_window; }
- Gtk::AboutDialog* about_dialog() const { return _about_dialog; }
- MessagesWindow* messages_dialog() const { return _messages_window; }
- PatchTreeWindow* patch_tree() const { return _patch_tree_window; }
- Configuration* configuration() const { return _configuration; }
- WindowFactory* window_factory() const { return _window_factory; }
+ ConnectWindow* connect_window() const { return _connect_window; }
+ Gtk::AboutDialog* about_dialog() const { return _about_dialog; }
+ MessagesWindow* messages_dialog() const { return _messages_window; }
+ PatchTreeWindow* patch_tree() const { return _patch_tree_window; }
+ Configuration* configuration() const { return _configuration; }
+ WindowFactory* window_factory() const { return _window_factory; }
+ Glib::RefPtr<Gdk::Pixbuf> icon_from_path(const string& path);
+
const SharedPtr<EngineInterface>& engine() const { return _engine; }
const SharedPtr<SigClientInterface>& client() const { return _client; }
const SharedPtr<Store>& store() const { return _store; }
@@ -139,6 +141,8 @@ protected:
PatchTreeWindow* _patch_tree_window;
Gtk::AboutDialog* _about_dialog;
WindowFactory* _window_factory;
+
+ map<string, Glib::RefPtr<Gdk::Pixbuf> > _icons;
Ingen::Shared::World* _world;
diff --git a/src/libs/gui/LoadPluginWindow.cpp b/src/libs/gui/LoadPluginWindow.cpp
index cc488210..5abbcb72 100644
--- a/src/libs/gui/LoadPluginWindow.cpp
+++ b/src/libs/gui/LoadPluginWindow.cpp
@@ -54,6 +54,7 @@ LoadPluginWindow::LoadPluginWindow(BaseObjectType* cobject, const Glib::RefPtr<G
// Set up the plugins list
_plugins_liststore = Gtk::ListStore::create(_plugins_columns);
_plugins_treeview->set_model(_plugins_liststore);
+ _plugins_treeview->append_column("", _plugins_columns._col_icon);
_plugins_treeview->append_column("Name", _plugins_columns._col_name);
_plugins_treeview->append_column("Type", _plugins_columns._col_type);
_plugins_treeview->append_column("URI", _plugins_columns._col_uri);
@@ -61,9 +62,9 @@ LoadPluginWindow::LoadPluginWindow(BaseObjectType* cobject, const Glib::RefPtr<G
//m_plugins_treeview->append_column("Label", _plugins_columns._col_label);
// This could be nicer.. store the TreeViewColumns locally maybe?
- _plugins_treeview->get_column(0)->set_sort_column(_plugins_columns._col_name);
- _plugins_treeview->get_column(1)->set_sort_column(_plugins_columns._col_type);
- _plugins_treeview->get_column(2)->set_sort_column(_plugins_columns._col_uri);
+ _plugins_treeview->get_column(1)->set_sort_column(_plugins_columns._col_name);
+ _plugins_treeview->get_column(2)->set_sort_column(_plugins_columns._col_type);
+ _plugins_treeview->get_column(3)->set_sort_column(_plugins_columns._col_uri);
//m_plugins_treeview->get_column(3)->set_sort_column(_plugins_columns._col_library);
//m_plugins_treeview->get_column(4)->set_sort_column(_plugins_columns._col_label);
for (int i=0; i < 3; ++i)
@@ -218,6 +219,7 @@ LoadPluginWindow::set_plugins(const Raul::Table<string, SharedPtr<PluginModel> >
Gtk::TreeModel::iterator iter = _plugins_liststore->append();
Gtk::TreeModel::Row row = *iter;
+ row[_plugins_columns._col_icon] = App::instance().icon_from_path(plugin->icon_path());
row[_plugins_columns._col_name] = plugin->name();
//row[_plugins_columns._col_label] = plugin->plug_label();
if (!strcmp(plugin->type_uri(), "ingen:Internal"))
@@ -298,22 +300,6 @@ LoadPluginWindow::generate_module_name(int offset)
SharedPtr<PluginModel> plugin = row.get_value(_plugins_columns._col_plugin_model);
return plugin->default_node_name(_patch);
}
- /*char num_buf[3];
- for (uint i=0; i < 99; ++i) {
- name = plugin->default_node_name();
- if (name == "")
- name = plugin->name().substr(0, plugin->name().find(' '));
- if (i+offset != 0) {
- snprintf(num_buf, 3, "%d", i+offset+1);
- name += "_";
- name += num_buf;
- }
- if (!_patch->get_node(name))
- break;
- else
- name = "";
- }
- }*/
return name;
}
@@ -440,6 +426,7 @@ LoadPluginWindow::clear_clicked()
set_plugins(App::instance().store()->plugins());
}
+
bool
LoadPluginWindow::on_key_press_event(GdkEventKey* event)
{
diff --git a/src/libs/gui/LoadPluginWindow.hpp b/src/libs/gui/LoadPluginWindow.hpp
index 4ab4b0e7..da87be79 100644
--- a/src/libs/gui/LoadPluginWindow.hpp
+++ b/src/libs/gui/LoadPluginWindow.hpp
@@ -44,6 +44,7 @@ class ModelColumns : public Gtk::TreeModel::ColumnRecord
{
public:
ModelColumns() {
+ add(_col_icon);
add(_col_name);
add(_col_type);
add(_col_uri);
@@ -53,6 +54,7 @@ public:
add(_col_plugin_model);
}
+ Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> > _col_icon;
Gtk::TreeModelColumn<Glib::ustring> _col_name;
Gtk::TreeModelColumn<Glib::ustring> _col_type;
Gtk::TreeModelColumn<Glib::ustring> _col_uri;
diff --git a/src/libs/gui/PatchCanvas.cpp b/src/libs/gui/PatchCanvas.cpp
index d67f301c..0b136014 100644
--- a/src/libs/gui/PatchCanvas.cpp
+++ b/src/libs/gui/PatchCanvas.cpp
@@ -159,12 +159,7 @@ PatchCanvas::build_plugin_class_menu(Gtk::Menu* menu,
SLV2Plugin p = i->second->slv2_plugin();
if (p && slv2_plugin_get_class(p) == plugin_class) {
- 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);
-
+ Glib::RefPtr<Gdk::Pixbuf> icon = App::instance().icon_from_path(PluginModel::get_lv2_icon_path(p));
if (icon) {
Gtk::Image* image = new Gtk::Image(icon);
menu->items().push_back(Gtk::Menu_Helpers::ImageMenuElem(i->second->name(),