the usual blob of fixes. note the requirement for ComboBoxText::set_active_text()
[ardour.git] / gtk2_ardour / plugin_selector.h
1 /*
2     Copyright (C) 2000 Paul Davis 
3
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.
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., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 */
19
20 #ifndef __ardour_plugin_selector_h__
21 #define __ardour_plugin_selector_h__
22
23 #include <gtkmm/dialog.h>
24 #include <gtkmm/notebook.h>
25 #include <gtkmm/treeview.h>
26 #include <gtkmm2ext/selector.h>
27
28 namespace ARDOUR {
29         class Session;
30         class PluginManager;
31         class Plugin;
32 }
33
34 class PluginSelector : public ArdourDialog
35 {
36   public:
37         PluginSelector (ARDOUR::PluginManager *);
38         sigc::signal<void,ARDOUR::Plugin *> PluginCreated;
39
40         int run (); // XXX should we try not to overload the non-virtual Gtk::Dialog::run() ?
41
42         void set_session (ARDOUR::Session*);
43
44   private:
45         ARDOUR::Session* session;
46         Gtk::Notebook notebook;
47         Gtk::ScrolledWindow lscroller;
48         Gtk::ScrolledWindow vscroller;
49
50         // page 1
51         struct LadspaColumns : public Gtk::TreeModel::ColumnRecord {
52                 LadspaColumns () {
53                         add (name);
54                     add (type);
55                         add (ins);
56                         add (outs);
57                         add (plugin);
58                 }
59             Gtk::TreeModelColumn<std::string> name;
60                 Gtk::TreeModelColumn<std::string> type;
61                 Gtk::TreeModelColumn<std::string> ins;
62                 Gtk::TreeModelColumn<std::string> outs;
63             Gtk::TreeModelColumn<ARDOUR::PluginInfo *> plugin;
64         };
65         LadspaColumns lcols;
66         Glib::RefPtr<Gtk::ListStore> lmodel;
67         Glib::RefPtr<Gtk::TreeSelection> lselection;
68         Gtk::TreeView ladspa_display;
69
70         struct AddedColumns : public Gtk::TreeModel::ColumnRecord {
71                 AddedColumns () {
72                         add (text);
73                         add (plugin);
74                 }
75                 Gtk::TreeModelColumn<std::string> text;
76                 Gtk::TreeModelColumn<ARDOUR::PluginInfo *> plugin;
77         };
78         AddedColumns acols;
79         Glib::RefPtr<Gtk::ListStore> amodel;
80         Glib::RefPtr<Gtk::TreeSelection> aselection;
81         Gtk::TreeView added_list;
82
83 #ifdef VST_SUPPORT
84         // page 2
85         struct VstColumns : public Gtk::TreeModel::ColumnRecord {
86                 VstColumns () {
87                         add (name);
88                         add (ins);
89                         add (outs);
90                         add (plugin);
91                 }
92             Gtk::TreeModelColumn<std::string> name;
93                 Gtk::TreeModelColumn<std::string> ins;
94                 Gtk::TreeModelColumn<std::string> outs;
95             Gtk::TreeModelColumn<ARDOUR::PluginInfo *> plugin;
96         };
97         LadspaColumns vcols;
98         Glib::RefPtr<Gtk::ListStore> vmodel;
99         Glib::RefPtr<Gtk::TreeSelection> vselection;
100         Gtk::TreeView vst_display;
101         static void _vst_refiller (void *);
102         void vst_refiller ();
103 #endif  
104
105         ARDOUR::PluginInfo* i_selected_plug;
106
107         // We need an integer for the output side because
108         // the name isn't promised to be unique.
109         gint o_selected_plug;
110
111         ARDOUR::PluginManager *manager;
112         list<ARDOUR::PluginInfo*> added_plugins;
113
114         static void _input_refiller (void *);
115         
116         void input_refiller ();
117         void row_clicked(GdkEventButton *);
118         void btn_add_clicked();
119         void btn_remove_clicked();
120         void btn_update_clicked();
121         void btn_apply_clicked();
122         void use_plugin (ARDOUR::PluginInfo*);
123         void cleanup ();
124 };
125
126 #endif // __ardour_plugin_selector_h__