summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libs/client/PluginModel.h10
-rw-r--r--src/progs/ingenuity/LoadPluginWindow.cpp29
-rw-r--r--src/progs/ingenuity/LoadPluginWindow.h3
3 files changed, 36 insertions, 6 deletions
diff --git a/src/libs/client/PluginModel.h b/src/libs/client/PluginModel.h
index 6614a3b6..d15d0ff4 100644
--- a/src/libs/client/PluginModel.h
+++ b/src/libs/client/PluginModel.h
@@ -41,7 +41,7 @@ class PatchModel;
class PluginModel
{
public:
- enum Type { LV2, LADSPA, DSSI, Internal, Patch };
+ enum Type { Internal=0, LV2, DSSI, LADSPA, Patch };
PluginModel(const string& uri, const string& type_uri, const string& name)
: _uri(uri)
@@ -78,10 +78,10 @@ public:
}*/
const char* const type_uri() const {
- if (_type == LV2) return "ingen:LV2Plugin";
- else if (_type == LADSPA) return "ingen:LADSPAPlugin";
- else if (_type == DSSI) return "ingen:DSSIPlugin";
- else if (_type == Internal) return "ingen:InternalPlugin";
+ if (_type == LV2) return "ingen:LV2";
+ else if (_type == LADSPA) return "ingen:LADSPA";
+ else if (_type == DSSI) return "ingen:DSSI";
+ else if (_type == Internal) return "ingen:Internal";
else if (_type == Patch) return "ingen:Patch";
else return "";
}
diff --git a/src/progs/ingenuity/LoadPluginWindow.cpp b/src/progs/ingenuity/LoadPluginWindow.cpp
index 2e58c67c..3607ba23 100644
--- a/src/progs/ingenuity/LoadPluginWindow.cpp
+++ b/src/progs/ingenuity/LoadPluginWindow.cpp
@@ -66,6 +66,8 @@ LoadPluginWindow::LoadPluginWindow(BaseObjectType* cobject, const Glib::RefPtr<G
//m_plugins_treeview->get_column(4)->set_sort_column(_plugins_columns._col_label);
for (int i=0; i < 3; ++i)
_plugins_treeview->get_column(i)->set_resizable(true);
+
+ _plugins_liststore->set_default_sort_func(sigc::mem_fun(this, &LoadPluginWindow::plugin_compare));
// Set up the search criteria combobox
_criteria_liststore = Gtk::ListStore::create(_criteria_columns);
@@ -182,6 +184,20 @@ LoadPluginWindow::on_show()
}
+int
+LoadPluginWindow::plugin_compare(const Gtk::TreeModel::iterator& a_i,
+ const Gtk::TreeModel::iterator& b_i)
+{
+ SharedPtr<PluginModel> a = a_i->get_value(_plugins_columns._col_plugin_model);
+ SharedPtr<PluginModel> b = b_i->get_value(_plugins_columns._col_plugin_model);
+
+ if (a->type() == b->type())
+ return strcmp(a->name().c_str(), b->name().c_str());
+ else
+ return ((int)a->type() < (int)b->type()) ? -1 : 1;
+}
+
+
void
LoadPluginWindow::set_plugin_list(const std::map<string, SharedPtr<PluginModel> >& m)
{
@@ -195,13 +211,24 @@ LoadPluginWindow::set_plugin_list(const std::map<string, SharedPtr<PluginModel>
row[_plugins_columns._col_name] = plugin->name();
//row[_plugins_columns._col_label] = plugin->plug_label();
- row[_plugins_columns._col_type] = plugin->type_uri();
+ if (plugin->type_uri() == "ingen:Internal")
+ row[_plugins_columns._col_type] = "Internal";
+ else if (plugin->type_uri() == "ingen:LV2")
+ row[_plugins_columns._col_type] = "LV2";
+ else if (plugin->type_uri() == "ingen:DSSI")
+ row[_plugins_columns._col_type] = "DSSI";
+ else if (plugin->type_uri() == "ingen:LADSPA")
+ row[_plugins_columns._col_type] = "LADSPA";
+ else
+ row[_plugins_columns._col_type] = plugin->type_uri();
row[_plugins_columns._col_uri] = plugin->uri();
row[_plugins_columns._col_label] = plugin->name();
//row[_plugins_columns._col_library] = plugin->lib_name();
row[_plugins_columns._col_plugin_model] = plugin;
}
+ _plugins_liststore->set_sort_column(Gtk::TreeSortable::DEFAULT_SORT_COLUMN_ID, Gtk::SORT_ASCENDING);
+
_plugins_treeview->columns_autosize();
}
diff --git a/src/progs/ingenuity/LoadPluginWindow.h b/src/progs/ingenuity/LoadPluginWindow.h
index b474311c..39329f0e 100644
--- a/src/progs/ingenuity/LoadPluginWindow.h
+++ b/src/progs/ingenuity/LoadPluginWindow.h
@@ -109,6 +109,9 @@ private:
void clear_clicked();
void name_changed();
+ int plugin_compare(const Gtk::TreeModel::iterator& a,
+ const Gtk::TreeModel::iterator& b);
+
void plugin_activated(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* col);
void plugin_selection_changed();
string generate_module_name(int offset = 0);