66e105e40c5add6adb10514285bd9d685d2626ab
[ardour.git] / gtk2_ardour / plugin_presets_ui.h
1 /*
2  * Copyright (C) 2018 Robin Gareus <robin@gareus.org>
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
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.
13  *
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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17  */
18
19 #ifndef _gtkardour_plugin_presets_ui_h_
20 #define _gtkardour_plugin_presets_ui_h_
21
22 #include <gtkmm/label.h>
23 #include <gtkmm/liststore.h>
24 #include <gtkmm/scrolledwindow.h>
25 #include <gtkmm/table.h>
26 #include <gtkmm/textview.h>
27 #include <gtkmm/treemodel.h>
28 #include <gtkmm/treestore.h>
29 #include <gtkmm/treeview.h>
30
31 #include "widgets/ardour_button.h"
32
33 #include "ardour/plugin_insert.h"
34
35 class PluginPresetsUI : public Gtk::Table
36 {
37 public:
38         PluginPresetsUI (boost::shared_ptr<ARDOUR::PluginInsert>);
39
40 private:
41         void update_preset_list ();
42         void preset_selected ();
43         void row_activated (Gtk::TreeModel::Path, Gtk::TreeViewColumn*);
44         void load_preset ();
45
46         boost::shared_ptr<ARDOUR::PluginInsert> _insert;
47         PBD::ScopedConnectionList _preset_connections;
48
49         struct PluginPresetModelColumns : public Gtk::TreeModel::ColumnRecord {
50                 PluginPresetModelColumns () {
51                         add (name);
52                         add (description);
53                         add (plugin_preset);
54                 }
55
56                 Gtk::TreeModelColumn<std::string> name;
57                 Gtk::TreeModelColumn<std::string> description;
58                 Gtk::TreeModelColumn<ARDOUR::Plugin::PresetRecord> plugin_preset;
59         };
60
61         ArdourWidgets::ArdourButton  _load_button;
62
63         PluginPresetModelColumns     _plugin_preset_columns;
64         Gtk::TreeView                _plugin_preset_display;
65         Glib::RefPtr<Gtk::TreeStore> _plugin_preset_model;
66         Gtk::ScrolledWindow          _preset_scroller;
67         Gtk::TextView                _preset_desc;
68 };
69
70 #endif