Delete trailing whitespace
[ardour.git] / gtk2_ardour / lv2_plugin_ui.h
1 /*
2     Copyright (C) 2008-2011 Paul Davis
3     Author: David Robillard
4
5     This program is free software; you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation; either version 2 of the License, or
8     (at your option) any later version.
9
10     This program is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14
15     You should have received a copy of the GNU General Public License
16     along with this program; if not, write to the Free Software
17     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
19 */
20
21 #ifndef __ardour_lv2_plugin_ui_h__
22 #define __ardour_lv2_plugin_ui_h__
23
24 #ifdef WAF_BUILD
25 #include "gtk2ardour-config.h"
26 #endif
27
28 #include <vector>
29 #include <map>
30 #include <list>
31
32 #include <sigc++/signal.h>
33 #include <gtkmm/widget.h>
34
35 #include "ardour_dialog.h"
36 #include "ardour/types.h"
37 #include "plugin_ui.h"
38
39 #ifdef LV2_SUPPORT
40
41 #include "lv2_external_ui.h"
42
43 namespace ARDOUR {
44         class PluginInsert;
45         class LV2Plugin;
46 }
47
48 class LV2PluginUI : public PlugUIBase, public Gtk::VBox
49 {
50   public:
51         LV2PluginUI (boost::shared_ptr<ARDOUR::PluginInsert>, boost::shared_ptr<ARDOUR::LV2Plugin>);
52         ~LV2PluginUI ();
53
54         gint get_preferred_height ();
55         gint get_preferred_width ();
56         bool start_updating(GdkEventAny*);
57         bool stop_updating(GdkEventAny*);
58
59         int package (Gtk::Window&);
60
61   private:
62
63         void parameter_changed (uint32_t, float);
64
65         boost::shared_ptr<ARDOUR::LV2Plugin> _lv2;
66         std::vector<int> _output_ports;
67         sigc::connection _screen_update_connection;
68
69         Gtk::Widget* _gui_widget;
70         float*       _values;
71         std::vector<boost::shared_ptr<ARDOUR::AutomationControl> > _controllables;
72
73         struct lv2_external_ui_host _external_ui_host;
74         LV2_Feature _external_ui_feature;
75         struct lv2_external_ui* _external_ui_ptr;
76         Gtk::Window* _win_ptr;
77
78         static void on_external_ui_closed(void* controller);
79
80         void* _inst;
81
82         static void lv2_ui_write(
83                         void*       controller,
84                         uint32_t    port_index,
85                         uint32_t    buffer_size,
86                         uint32_t    format,
87                         const void* buffer);
88
89         void lv2ui_instantiate(const std::string& title);
90         void lv2ui_free();
91
92         void parameter_update(uint32_t, float);
93         bool configure_handler (GdkEventConfigure*);
94         void save_plugin_setting ();
95         void output_update();
96         bool is_update_wanted(uint32_t index);
97
98         virtual bool on_window_show(const std::string& title);
99         virtual void on_window_hide();
100 };
101
102 #endif // LV2_SUPPORT
103
104 #endif /* __ardour_lv2_plugin_ui_h__ */
105