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 "widgets/ardour_button.h"
34 #include "widgets/ardour_dropdown.h"
36 #include "gtkmm2ext/dndtreeview.h"
38 #include "ardour/plugin.h"
39 #include "ardour/plugin_manager.h"
40 #include "ardour/session_handle.h"
42 #include "widgets/ardour_button.h"
44 #include "plugin_interest.h"
45 #include "ardour_dialog.h"
52 class PluginSelector : public ArdourDialog
55 PluginSelector (ARDOUR::PluginManager&);
58 void set_interested_object (PluginInterestedObject&);
60 int run (); // XXX should we try not to overload the non-virtual Gtk::Dialog::run() ?
64 Gtk::Menu* plugin_menu ();
70 ArdourWidgets::ArdourButton* _search_name_checkbox;
71 ArdourWidgets::ArdourButton* _search_tags_checkbox;
72 ArdourWidgets::ArdourButton* _search_ignore_checkbox;
74 //radio-button filters
75 Gtk::RadioButton *_fil_effects_radio;
76 Gtk::RadioButton *_fil_instruments_radio;
77 Gtk::RadioButton *_fil_utils_radio;
78 Gtk::RadioButton *_fil_favorites_radio;
79 Gtk::RadioButton *_fil_hidden_radio;
80 Gtk::RadioButton *_fil_all_radio;
82 /* combobox filters */
83 ArdourWidgets::ArdourDropdown _fil_type_combo;
84 ArdourWidgets::ArdourDropdown _fil_creator_combo;
86 PluginInterestedObject* interested_object;
88 Gtk::ScrolledWindow scroller; // Available plugins
89 Gtk::ScrolledWindow ascroller; // Added plugins
91 Gtk::Entry search_entry;
92 Gtk::Button search_clear_button;
94 Gtk::Entry *tag_entry;
95 Gtk::Button* tag_reset_button;
96 void tag_reset_button_clicked ();
98 void set_sensitive_widgets();
100 void search_clear_button_clicked ();
101 void search_entry_changed ();
103 void tag_entry_changed ();
104 sigc::connection tag_entry_connection;
106 void tags_changed ( ARDOUR::PluginType t, std::string unique_id, std::string tag);
108 struct PluginColumns : public Gtk::TreeModel::ColumnRecord {
120 Gtk::TreeModelColumn<bool> favorite;
121 Gtk::TreeModelColumn<bool> hidden;
122 Gtk::TreeModelColumn<std::string> name;
123 Gtk::TreeModelColumn<std::string> type_name;
124 Gtk::TreeModelColumn<std::string> creator;
125 Gtk::TreeModelColumn<std::string> tags;
126 Gtk::TreeModelColumn<std::string> audio_io;
127 Gtk::TreeModelColumn<std::string> midi_io;
128 Gtk::TreeModelColumn<ARDOUR::PluginInfoPtr> plugin;
130 PluginColumns plugin_columns;
131 Glib::RefPtr<Gtk::ListStore> plugin_model;
132 Gtkmm2ext::DnDTreeView<ARDOUR::PluginInfoPtr> plugin_display;
133 Gtk::Button* btn_add;
134 Gtk::Button* btn_remove;
136 struct AddedColumns : public Gtk::TreeModel::ColumnRecord {
141 Gtk::TreeModelColumn<std::string> text;
142 Gtk::TreeModelColumn<ARDOUR::PluginInfoPtr> plugin;
145 Glib::RefPtr<Gtk::ListStore> amodel;
146 Gtk::TreeView added_list;
149 void refiller (const ARDOUR::PluginInfoList& plugs, const::std::string& filterstr, const char* type);
150 void ladspa_refiller (const std::string&);
151 void lv2_refiller (const std::string&);
152 void vst_refiller (const std::string&);
153 void lxvst_refiller (const std::string&);
154 void mac_vst_refiller (const std::string&);
155 void au_refiller (const std::string&);
156 void lua_refiller (const std::string&);
158 Gtk::Menu* _plugin_menu;
159 ARDOUR::PluginManager& manager;
161 void row_activated(Gtk::TreeModel::Path path, Gtk::TreeViewColumn* col);
162 void btn_add_clicked();
163 void btn_remove_clicked();
164 void added_list_selection_changed();
165 void added_row_clicked(GdkEventButton* event);
166 void display_selection_changed();
167 void btn_apply_clicked();
168 ARDOUR::PluginPtr load_plugin (ARDOUR::PluginInfoPtr);
169 bool show_this_plugin (const ARDOUR::PluginInfoPtr&, const std::string&);
171 void setup_search_string (std::string&);
173 void favorite_changed (const std::string& path);
174 void hidden_changed (const std::string& path);
177 void plugin_chosen_from_menu (const ARDOUR::PluginInfoPtr&);
179 void plugin_status_changed ( ARDOUR::PluginType t, std::string unique_id, ARDOUR::PluginManager::PluginStatusType s );
181 Gtk::Menu* create_favs_menu (ARDOUR::PluginInfoList&);
182 Gtk::Menu* create_by_creator_menu (ARDOUR::PluginInfoList&);
183 Gtk::Menu* create_by_tags_menu (ARDOUR::PluginInfoList&);
184 void build_plugin_menu ();
185 PBD::ScopedConnectionList plugin_list_changed_connection;
188 bool _need_status_save;
189 bool _need_menu_rebuild;
191 bool _inhibit_refill;
194 #endif // __ardour_plugin_selector_h__