plugin selector from doug; lots and lots of fixes from karsten
[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/notebook.h>
24 #include <gtkmm/notebook.h>
25 #include <gtkmm/treeview.h>
26 #include <gtkmm2ext/selector.h>
27
28 #include <ardour_dialog.h>
29
30 namespace ARDOUR {
31         class Session;
32         class PluginManager;
33         class Plugin;
34 }
35
36 class PluginSelector : public ArdourDialog 
37 {
38   public:
39         PluginSelector (ARDOUR::PluginManager *);
40         sigc::signal<void,ARDOUR::Plugin *> PluginCreated;
41
42         void set_session (ARDOUR::Session*);
43
44   private:
45         ARDOUR::Session* session;
46         Gtk::Notebook notebook;
47
48         // page 1
49         //Gtkmm2ext::Selector ladspa_display;
50         struct LadspaColumns : public Gtk::TreeModel::ColumnRecord {
51                 LadspaColumns () {
52                         add (name);
53                     add (type);
54                         add (ins);
55                         add (outs);
56                         add (plugin);
57                 }
58             Gtk::TreeModelColumn<std::string> name;
59                 Gtk::TreeModelColumn<std::string> type;
60                 Gtk::TreeModelColumn<std::string> ins;
61                 Gtk::TreeModelColumn<std::string> outs;
62             Gtk::TreeModelColumn<ARDOUR::PluginInfo *> plugin;
63         };
64         LadspaColumns lcols;
65         Glib::RefPtr<Gtk::ListStore> lmodel;
66         Glib::RefPtr<Gtk::TreeSelection> lselection;
67         Gtk::TreeView ladspa_display;
68
69         struct AddedColumns : public Gtk::TreeModel::ColumnRecord {
70                 AddedColumns () {
71                         add (text);
72                         add (plugin);
73                 }
74                 Gtk::TreeModelColumn<std::string> text;
75                 Gtk::TreeModelColumn<ARDOUR::PluginInfo *> plugin;
76         };
77         AddedColumns acols;
78         Glib::RefPtr<Gtk::ListStore> amodel;
79         Glib::RefPtr<Gtk::TreeSelection> aselection;
80         Gtk::TreeView added_list;
81
82         void column_clicked (int column, GtkCList* clist);
83
84 #ifdef VST_SUPPORT
85         // page 2
86         struct VstColumns : public Gtk::TreeModel::ColumnRecord {
87                 VstColumns () {
88                         add (name);
89                         add (ins);
90                         add (outs);
91                         add (plugin);
92                 }
93             Gtk::TreeModelColumn<std::string> name;
94                 Gtk::TreeModelColumn<std::string> ins;
95                 Gtk::TreeModelColumn<std::string> outs;
96             Gtk::TreeModelColumn<ARDOUR::PluginInfo *> plugin;
97         };
98         LadspaColumns vcols;
99         Glib::RefPtr<Gtk::ListStore> vmodel;
100         Glib::RefPtr<Gtk::TreeSelection> vselection;
101         Gtk::TreeView vst_display;
102         static void _vst_refiller (void *);
103         void vst_refiller ();
104 #endif  
105         //Gtkmm2ext::Selector o_selector;
106
107         ARDOUR::PluginInfo* i_selected_plug;
108
109         // We need an integer for the output side because
110         // the name isn't promised to be unique.
111         gint o_selected_plug;
112
113         ARDOUR::PluginManager *manager;
114         list<ARDOUR::PluginInfo*> added_plugins;
115
116         static void _input_refiller (void *);
117         //static void _output_refiller (void *);
118
119         void input_refiller ();
120         void row_clicked(GdkEventButton *);
121         void btn_add_clicked();
122         void btn_remove_clicked();
123         void btn_ok_clicked();
124         void btn_update_clicked();
125         void btn_apply_clicked();
126         void btn_cancel_clicked();
127         void use_plugin (ARDOUR::PluginInfo*);
128         gint wm_close(GdkEventAny* ev);
129 };
130
131 #endif // __ardour_plugin_selector_h__