2 * Copyright (C) 2005-2006 Doug McLain <doug@nostar.net>
3 * Copyright (C) 2005-2006 Taybin Rutkin <taybin@taybin.com>
4 * Copyright (C) 2005-2011 Paul Davis <paul@linuxaudiosystems.com>
5 * Copyright (C) 2006-2012 David Robillard <d@drobilla.net>
6 * Copyright (C) 2006 Nick Mainsbridge <mainsbridge@gmail.com>
7 * Copyright (C) 2009 Carl Hetherington <carl@carlh.net>
8 * Copyright (C) 2014-2019 Robin Gareus <robin@gareus.org>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 #ifndef __ardour_plugin_selector_h__
26 #define __ardour_plugin_selector_h__
28 #include <gtkmm/button.h>
29 #include <gtkmm/checkbutton.h>
30 #include <gtkmm/comboboxtext.h>
31 #include <gtkmm/entry.h>
32 #include <gtkmm/liststore.h>
33 #include <gtkmm/notebook.h>
34 #include <gtkmm/scrolledwindow.h>
35 #include <gtkmm/treemodel.h>
36 #include <gtkmm/treeview.h>
38 #include "widgets/ardour_button.h"
39 #include "widgets/ardour_dropdown.h"
41 #include "gtkmm2ext/dndtreeview.h"
43 #include "ardour/plugin.h"
44 #include "ardour/plugin_manager.h"
45 #include "ardour/session_handle.h"
47 #include "widgets/ardour_button.h"
49 #include "plugin_interest.h"
50 #include "ardour_dialog.h"
57 class PluginSelector : public ArdourDialog
60 PluginSelector (ARDOUR::PluginManager&);
63 void set_interested_object (PluginInterestedObject&);
65 int run (); // XXX should we try not to overload the non-virtual Gtk::Dialog::run() ?
69 Gtk::Menu* plugin_menu ();
75 ArdourWidgets::ArdourButton* _search_name_checkbox;
76 ArdourWidgets::ArdourButton* _search_tags_checkbox;
77 ArdourWidgets::ArdourButton* _search_ignore_checkbox;
79 //radio-button filters
80 Gtk::RadioButton *_fil_effects_radio;
81 Gtk::RadioButton *_fil_instruments_radio;
82 Gtk::RadioButton *_fil_utils_radio;
83 Gtk::RadioButton *_fil_favorites_radio;
84 Gtk::RadioButton *_fil_hidden_radio;
85 Gtk::RadioButton *_fil_all_radio;
87 /* combobox filters */
88 ArdourWidgets::ArdourDropdown _fil_type_combo;
89 ArdourWidgets::ArdourDropdown _fil_creator_combo;
91 PluginInterestedObject* interested_object;
93 Gtk::ScrolledWindow scroller; // Available plugins
94 Gtk::ScrolledWindow ascroller; // Added plugins
96 Gtk::Entry search_entry;
97 Gtk::Button search_clear_button;
99 Gtk::Entry *tag_entry;
100 Gtk::Button* tag_reset_button;
101 void tag_reset_button_clicked ();
103 void set_sensitive_widgets();
105 void search_clear_button_clicked ();
106 void search_entry_changed ();
108 void tag_entry_changed ();
109 sigc::connection tag_entry_connection;
111 void tags_changed ( ARDOUR::PluginType t, std::string unique_id, std::string tag);
113 struct PluginColumns : public Gtk::TreeModel::ColumnRecord {
125 Gtk::TreeModelColumn<bool> favorite;
126 Gtk::TreeModelColumn<bool> hidden;
127 Gtk::TreeModelColumn<std::string> name;
128 Gtk::TreeModelColumn<std::string> type_name;
129 Gtk::TreeModelColumn<std::string> creator;
130 Gtk::TreeModelColumn<std::string> tags;
131 Gtk::TreeModelColumn<std::string> audio_io;
132 Gtk::TreeModelColumn<std::string> midi_io;
133 Gtk::TreeModelColumn<ARDOUR::PluginInfoPtr> plugin;
135 PluginColumns plugin_columns;
136 Glib::RefPtr<Gtk::ListStore> plugin_model;
137 Gtkmm2ext::DnDTreeView<ARDOUR::PluginInfoPtr> plugin_display;
138 Gtk::Button* btn_add;
139 Gtk::Button* btn_remove;
141 struct AddedColumns : public Gtk::TreeModel::ColumnRecord {
146 Gtk::TreeModelColumn<std::string> text;
147 Gtk::TreeModelColumn<ARDOUR::PluginInfoPtr> plugin;
150 Glib::RefPtr<Gtk::ListStore> amodel;
151 Gtk::TreeView added_list;
154 void refiller (const ARDOUR::PluginInfoList& plugs, const::std::string& filterstr, const char* type);
155 void ladspa_refiller (const std::string&);
156 void lv2_refiller (const std::string&);
157 void vst_refiller (const std::string&);
158 void lxvst_refiller (const std::string&);
159 void mac_vst_refiller (const std::string&);
160 void au_refiller (const std::string&);
161 void lua_refiller (const std::string&);
163 Gtk::Menu* _plugin_menu;
164 ARDOUR::PluginManager& manager;
166 void row_activated(Gtk::TreeModel::Path path, Gtk::TreeViewColumn* col);
167 void btn_add_clicked();
168 void btn_remove_clicked();
169 void added_list_selection_changed();
170 void added_row_clicked(GdkEventButton* event);
171 void display_selection_changed();
172 void btn_apply_clicked();
173 ARDOUR::PluginPtr load_plugin (ARDOUR::PluginInfoPtr);
174 bool show_this_plugin (const ARDOUR::PluginInfoPtr&, const std::string&);
176 void favorite_changed (const std::string& path);
177 void hidden_changed (const std::string& path);
180 void plugin_chosen_from_menu (const ARDOUR::PluginInfoPtr&);
182 void plugin_status_changed ( ARDOUR::PluginType t, std::string unique_id, ARDOUR::PluginManager::PluginStatusType s );
184 Gtk::Menu* create_favs_menu (ARDOUR::PluginInfoList&);
185 Gtk::Menu* create_by_creator_menu (ARDOUR::PluginInfoList&);
186 Gtk::Menu* create_by_tags_menu (ARDOUR::PluginInfoList&);
187 void build_plugin_menu ();
188 PBD::ScopedConnectionList plugin_list_changed_connection;
191 bool _need_status_save;
192 bool _need_menu_rebuild;
193 bool _inhibit_refill;
196 #endif // __ardour_plugin_selector_h__