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;
85 ArdourWidgets::ArdourDropdown _fil_channel_combo;
87 PluginInterestedObject* interested_object;
89 Gtk::ScrolledWindow scroller; // Available plugins
90 Gtk::ScrolledWindow ascroller; // Added plugins
92 Gtk::Entry search_entry;
93 Gtk::Button search_clear_button;
95 Gtk::Entry *tag_entry;
96 Gtk::Button* tag_reset_button;
97 void tag_reset_button_clicked ();
99 void set_sensitive_widgets();
101 void search_clear_button_clicked ();
102 void search_entry_changed ();
104 void tag_entry_changed ();
105 sigc::connection tag_entry_connection;
107 void tags_changed ( ARDOUR::PluginType t, std::string unique_id, std::string tag);
109 struct PluginColumns : public Gtk::TreeModel::ColumnRecord {
121 Gtk::TreeModelColumn<bool> favorite;
122 Gtk::TreeModelColumn<bool> hidden;
123 Gtk::TreeModelColumn<std::string> name;
124 Gtk::TreeModelColumn<std::string> type_name;
125 Gtk::TreeModelColumn<std::string> creator;
126 Gtk::TreeModelColumn<std::string> tags;
127 Gtk::TreeModelColumn<std::string> audio_io;
128 Gtk::TreeModelColumn<std::string> midi_io;
129 Gtk::TreeModelColumn<ARDOUR::PluginInfoPtr> plugin;
131 PluginColumns plugin_columns;
132 Glib::RefPtr<Gtk::ListStore> plugin_model;
133 Gtkmm2ext::DnDTreeView<ARDOUR::PluginInfoPtr> plugin_display;
134 Gtk::Button* btn_add;
135 Gtk::Button* btn_remove;
137 struct AddedColumns : public Gtk::TreeModel::ColumnRecord {
142 Gtk::TreeModelColumn<std::string> text;
143 Gtk::TreeModelColumn<ARDOUR::PluginInfoPtr> plugin;
146 Glib::RefPtr<Gtk::ListStore> amodel;
147 Gtk::TreeView added_list;
150 void refiller (const ARDOUR::PluginInfoList& plugs, const::std::string& filterstr, const char* type);
151 void ladspa_refiller (const std::string&);
152 void lv2_refiller (const std::string&);
153 void vst_refiller (const std::string&);
154 void lxvst_refiller (const std::string&);
155 void mac_vst_refiller (const std::string&);
156 void au_refiller (const std::string&);
157 void lua_refiller (const std::string&);
159 Gtk::Menu* _plugin_menu;
160 ARDOUR::PluginManager& manager;
162 void row_activated(Gtk::TreeModel::Path path, Gtk::TreeViewColumn* col);
163 void btn_add_clicked();
164 void btn_remove_clicked();
165 void added_list_selection_changed();
166 void added_row_clicked(GdkEventButton* event);
167 void display_selection_changed();
168 void btn_apply_clicked();
169 ARDOUR::PluginPtr load_plugin (ARDOUR::PluginInfoPtr);
170 bool show_this_plugin (const ARDOUR::PluginInfoPtr&, const std::string&);
172 void setup_search_string (std::string&);
174 void favorite_changed (const std::string& path);
175 void hidden_changed (const std::string& path);
178 void plugin_chosen_from_menu (const ARDOUR::PluginInfoPtr&);
180 void plugin_status_changed ( ARDOUR::PluginType t, std::string unique_id, ARDOUR::PluginManager::PluginStatusType s );
182 Gtk::Menu* create_favs_menu (ARDOUR::PluginInfoList&);
183 Gtk::Menu* create_by_creator_menu (ARDOUR::PluginInfoList&);
184 Gtk::Menu* create_by_tags_menu (ARDOUR::PluginInfoList&);
185 void build_plugin_menu ();
186 PBD::ScopedConnectionList plugin_list_changed_connection;
189 bool _need_status_save;
190 bool _need_menu_rebuild;
192 bool _inhibit_refill;
195 #endif // __ardour_plugin_selector_h__