2 Copyright (C) 2000 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifndef __ardour_plugin_selector_h__
21 #define __ardour_plugin_selector_h__
23 #include <gtkmm/button.h>
24 #include <gtkmm/checkbutton.h>
25 #include <gtkmm/comboboxtext.h>
26 #include <gtkmm/entry.h>
27 #include <gtkmm/liststore.h>
28 #include <gtkmm/notebook.h>
29 #include <gtkmm/scrolledwindow.h>
30 #include <gtkmm/treemodel.h>
31 #include <gtkmm/treeview.h>
33 #include "gtkmm2ext/dndtreeview.h"
35 #include "ardour/plugin.h"
36 #include "ardour/plugin_manager.h"
37 #include "ardour/session_handle.h"
39 #include "widgets/ardour_button.h"
41 #include "plugin_interest.h"
42 #include "ardour_dialog.h"
49 class PluginSelector : public ArdourDialog
52 PluginSelector (ARDOUR::PluginManager&);
55 void set_interested_object (PluginInterestedObject&);
57 int run (); // XXX should we try not to overload the non-virtual Gtk::Dialog::run() ?
61 Gtk::Menu* plugin_menu ();
67 Gtk::CheckButton *_search_name_checkbox;
68 Gtk::CheckButton *_search_tags_checkbox;
69 Gtk::CheckButton *_search_ignore_checkbox;
71 //radio-button filters
72 Gtk::RadioButton *_fil_effects_radio;
73 Gtk::RadioButton *_fil_instruments_radio;
74 Gtk::RadioButton *_fil_utils_radio;
75 Gtk::RadioButton *_fil_favorites_radio;
76 Gtk::RadioButton *_fil_hidden_radio;
77 Gtk::RadioButton *_fil_all_radio;
80 Gtk::ComboBoxText *_fil_type_combo;
81 Gtk::ComboBoxText *_fil_creator_combo;
82 Gtk::ComboBoxText *_fil_channel_combo;
84 PluginInterestedObject* interested_object;
86 Gtk::ScrolledWindow scroller; // Available plugins
87 Gtk::ScrolledWindow ascroller; // Added plugins
89 Gtk::Entry search_entry;
90 Gtk::Button search_clear_button;
92 Gtk::Entry *tag_entry;
93 void tag_reset_button_clicked ();
95 void set_sensitive_widgets();
97 void search_clear_button_clicked ();
98 void search_entry_changed ();
100 void tag_entry_changed ();
101 sigc::connection tag_entry_connection;
103 void tags_changed ( ARDOUR::PluginType t, std::string unique_id, std::string tag);
105 struct PluginColumns : public Gtk::TreeModel::ColumnRecord {
117 Gtk::TreeModelColumn<bool> favorite;
118 Gtk::TreeModelColumn<bool> hidden;
119 Gtk::TreeModelColumn<std::string> name;
120 Gtk::TreeModelColumn<std::string> type_name;
121 Gtk::TreeModelColumn<std::string> creator;
122 Gtk::TreeModelColumn<std::string> tags;
123 Gtk::TreeModelColumn<std::string> audio_io;
124 Gtk::TreeModelColumn<std::string> midi_io;
125 Gtk::TreeModelColumn<ARDOUR::PluginInfoPtr> plugin;
127 PluginColumns plugin_columns;
128 Glib::RefPtr<Gtk::ListStore> plugin_model;
129 Gtkmm2ext::DnDTreeView<ARDOUR::PluginInfoPtr> plugin_display;
130 Gtk::Button* btn_add;
131 Gtk::Button* btn_remove;
133 struct AddedColumns : public Gtk::TreeModel::ColumnRecord {
138 Gtk::TreeModelColumn<std::string> text;
139 Gtk::TreeModelColumn<ARDOUR::PluginInfoPtr> plugin;
142 Glib::RefPtr<Gtk::ListStore> amodel;
143 Gtk::TreeView added_list;
146 void refiller (const ARDOUR::PluginInfoList& plugs, const::std::string& filterstr, const char* type);
147 void ladspa_refiller (const std::string&);
148 void lv2_refiller (const std::string&);
149 void vst_refiller (const std::string&);
150 void lxvst_refiller (const std::string&);
151 void mac_vst_refiller (const std::string&);
152 void au_refiller (const std::string&);
153 void lua_refiller (const std::string&);
155 Gtk::Menu* _plugin_menu;
156 ARDOUR::PluginManager& manager;
158 void row_activated(Gtk::TreeModel::Path path, Gtk::TreeViewColumn* col);
159 void btn_add_clicked();
160 void btn_remove_clicked();
161 void added_list_selection_changed();
162 void added_row_clicked(GdkEventButton* event);
163 void display_selection_changed();
164 void btn_apply_clicked();
165 ARDOUR::PluginPtr load_plugin (ARDOUR::PluginInfoPtr);
166 bool show_this_plugin (const ARDOUR::PluginInfoPtr&, const std::string&);
168 void setup_search_string (std::string&);
170 void favorite_changed (const std::string& path);
171 void hidden_changed (const std::string& path);
174 void plugin_chosen_from_menu (const ARDOUR::PluginInfoPtr&);
176 void plugin_status_changed ( ARDOUR::PluginType t, std::string unique_id, ARDOUR::PluginManager::PluginStatusType s );
178 Gtk::Menu* create_favs_menu (ARDOUR::PluginInfoList&);
179 Gtk::Menu* create_by_creator_menu (ARDOUR::PluginInfoList&);
180 Gtk::Menu* create_by_tags_menu (ARDOUR::PluginInfoList&);
181 void build_plugin_menu ();
182 PBD::ScopedConnectionList plugin_list_changed_connection;
185 bool _need_status_save;
186 bool _need_menu_rebuild;
191 #endif // __ardour_plugin_selector_h__