Fix glitching on "events" (like loop markers) due to taking the processing offset...
[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 #include <ardour/plugin.h>
29 #include "plugin_interest.h"
30
31 namespace ARDOUR {
32         class Session;
33         class PluginManager;
34 }
35
36 class PluginSelector : public ArdourDialog
37 {
38   public:
39         PluginSelector (ARDOUR::PluginManager *);
40
41         void set_interested_object (PluginInterestedObject&);
42         
43         int run (); // XXX should we try not to overload the non-virtual Gtk::Dialog::run() ?
44
45         void set_session (ARDOUR::Session*);
46         void on_show ();
47
48         Gtk::Menu& plugin_menu ();
49
50   private:
51         PluginInterestedObject* interested_object;
52
53         ARDOUR::Session* session;
54         Gtk::ScrolledWindow scroller;   // Available plugins
55         Gtk::ScrolledWindow ascroller;  // Added plugins
56
57         Gtk::ComboBoxText filter_mode;
58         Gtk::Entry filter_entry;
59         Gtk::Button filter_button;
60
61         void filter_button_clicked ();
62         void filter_entry_changed ();
63         void filter_mode_changed ();
64         
65         struct PluginColumns : public Gtk::TreeModel::ColumnRecord {
66                 PluginColumns () {
67                         add (favorite);
68                         add (name);
69                         add (type_name);
70                         add (category);
71                         add (creator);
72                         add (ins);
73                         add (outs);
74                         add (plugin);
75                 }
76                 Gtk::TreeModelColumn<bool> favorite;
77                 Gtk::TreeModelColumn<std::string> name;
78                 Gtk::TreeModelColumn<std::string> type_name;
79                 Gtk::TreeModelColumn<std::string> category;
80                 Gtk::TreeModelColumn<std::string> creator;
81                 Gtk::TreeModelColumn<std::string> ins;
82                 Gtk::TreeModelColumn<std::string> outs;
83                 Gtk::TreeModelColumn<ARDOUR::PluginInfoPtr> plugin;
84         };
85         PluginColumns plugin_columns;
86         Glib::RefPtr<Gtk::ListStore> plugin_model;
87         Gtk::TreeView plugin_display;
88         Gtk::Button* btn_add;
89         Gtk::Button* btn_remove;
90
91         struct AddedColumns : public Gtk::TreeModel::ColumnRecord {
92                 AddedColumns () {
93                         add (text);
94                         add (plugin);
95                 }
96                 Gtk::TreeModelColumn<std::string> text;
97                 Gtk::TreeModelColumn<ARDOUR::PluginInfoPtr> plugin;
98         };
99         AddedColumns acols;
100         Glib::RefPtr<Gtk::ListStore> amodel;
101         Gtk::TreeView added_list;
102
103         void refill ();
104         void refiller (const ARDOUR::PluginInfoList& plugs, const::std::string& filterstr, const char* type);
105         void ladspa_refiller (const std::string&);
106         void lv2_refiller (const std::string&);
107         void vst_refiller (const std::string&);
108         void au_refiller (const std::string&);
109
110         ARDOUR::PluginManager *manager;
111
112         void row_clicked(GdkEventButton *);
113         void btn_add_clicked();
114         void btn_remove_clicked();
115         void btn_update_clicked();
116         void added_list_selection_changed();
117         void display_selection_changed();
118         void btn_apply_clicked();
119         ARDOUR::PluginPtr load_plugin (ARDOUR::PluginInfoPtr);
120         bool show_this_plugin (const ARDOUR::PluginInfoPtr&, const std::string&);
121         void setup_filter_string (std::string&);
122
123         void favorite_changed (const Glib::ustring& path);
124         bool in_row_change;
125
126         void plugin_chosen_from_menu (const ARDOUR::PluginInfoPtr&);
127         Gtk::Menu* _menu;
128         void show_manager ();
129 };
130
131 #endif // __ardour_plugin_selector_h__
132