2 Copyright (C) 2000-2006 Paul Davis
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.
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.
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.
20 #ifndef __ardour_plugin_ui_h__
21 #define __ardour_plugin_ui_h__
27 #include <sigc++/signal.h>
29 #include <gtkmm/button.h>
30 #include <gtkmm/box.h>
31 #include <gtkmm/table.h>
32 #include <gtkmm/eventbox.h>
33 #include <gtkmm/viewport.h>
34 #include <gtkmm/scrolledwindow.h>
35 #include <gtkmm/label.h>
36 #include <gtkmm/menu.h>
37 #include <gtkmm/image.h>
38 #include <gtkmm/adjustment.h>
39 #include <gtkmm/togglebutton.h>
40 #include <gtkmm/socket.h>
41 #include <gtkmm/comboboxtext.h>
42 #include <gtkmm/socket.h>
44 #include "ardour/types.h"
46 #include "ardour_dialog.h"
47 #include "latency_gui.h"
48 #include "automation_controller.h"
63 class HSliderController;
70 class PlugUIBase : public virtual sigc::trackable
73 PlugUIBase (boost::shared_ptr<ARDOUR::PluginInsert>);
74 virtual ~PlugUIBase() {}
76 virtual gint get_preferred_height () = 0;
77 virtual gint get_preferred_width () = 0;
78 virtual bool start_updating(GdkEventAny*) = 0;
79 virtual bool stop_updating(GdkEventAny*) = 0;
81 virtual void activate () {}
82 virtual void deactivate () {}
84 virtual void update_presets ();
87 boost::shared_ptr<ARDOUR::PluginInsert> insert;
88 boost::shared_ptr<ARDOUR::Plugin> plugin;
89 Gtk::ComboBoxText preset_combo;
90 Gtk::Button save_button;
91 Gtk::ToggleButton bypass_button;
92 Gtk::EventBox focus_button;
94 LatencyGUI latency_gui;
96 Gtk::Image* focus_out_image;
97 Gtk::Image* focus_in_image;
99 void setting_selected();
100 void save_plugin_setting (void);
101 bool focus_toggled(GdkEventButton*);
102 void bypass_toggled();
103 void processor_active_changed (boost::weak_ptr<ARDOUR::Processor> p);
106 class GenericPluginUI : public PlugUIBase, public Gtk::HPaned
109 GenericPluginUI (boost::shared_ptr<ARDOUR::PluginInsert> plug, bool scrollable=false);
112 gint get_preferred_height () { return prefheight; }
113 gint get_preferred_width () { return -1; }
115 bool start_updating(GdkEventAny*);
116 bool stop_updating(GdkEventAny*);
119 Gtk::VBox main_contents;
121 Gtk::HBox settings_box;
124 Gtk::Table button_table;
125 Gtk::Table output_table;
127 Gtk::ToggleButton eqgui_toggle;
129 Gtk::ScrolledWindow scroller;
130 Gtk::Adjustment hAdjustment;
131 Gtk::Adjustment vAdjustment;
132 Gtk::Viewport scroller_view;
133 Gtk::Menu* automation_menu;
139 Gtkmm2ext::FastMeter *meter;
157 static const int32_t initial_button_rows = 6;
158 static const int32_t initial_button_cols = 1;
159 static const int32_t initial_output_rows = 1;
160 static const int32_t initial_output_cols = 4;
162 /* FIXME: Unify with AutomationController */
163 struct ControlUI : public Gtk::HBox {
165 boost::shared_ptr<ARDOUR::AutomationControl> control;
167 Evoral::Parameter parameter() { return control->parameter(); }
171 Gtk::ComboBoxText* combo;
172 std::map<string, float>* combo_map;
173 Gtk::ToggleButton* button;
174 boost::shared_ptr<AutomationController> controller;
175 Gtkmm2ext::ClickBox* clickbox;
180 Gtk::Button automate_button;
184 Gtk::EventBox *display;
185 Gtk::Label* display_label;
189 MeterInfo * meterinfo;
195 std::vector<ControlUI*> output_controls;
196 sigc::connection screen_update_connection;
197 void output_update();
200 ControlUI* build_control_ui (guint32 port_index, boost::shared_ptr<ARDOUR::AutomationControl>);
201 std::vector<string> setup_scale_values(guint32 port_index, ControlUI* cui);
202 void parameter_changed (ControlUI* cui);
203 void update_control_display (ControlUI* cui);
204 void control_port_toggled (ControlUI* cui);
205 void control_combo_changed (ControlUI* cui);
207 void processor_active_changed (boost::weak_ptr<ARDOUR::Processor>);
209 void astate_clicked (ControlUI*, uint32_t parameter);
210 void automation_state_changed (ControlUI*);
211 void set_automation_state (ARDOUR::AutoState state, ControlUI* cui);
212 void start_touch (ControlUI*);
213 void stop_touch (ControlUI*);
215 void toggle_plugin_analysis ();
217 void print_parameter (char *buf, uint32_t len, uint32_t param);
220 class PluginUIWindow : public Gtk::Window
223 PluginUIWindow (Gtk::Window*, boost::shared_ptr<ARDOUR::PluginInsert> insert, bool scrollable=false);
226 PlugUIBase& pluginui() { return *_pluginui; }
228 void resize_preferred();
229 void set_parent (Gtk::Window*);
231 bool on_enter_notify_event (GdkEventCrossing*);
232 bool on_leave_notify_event (GdkEventCrossing*);
233 bool on_focus_in_event (GdkEventFocus*);
234 bool on_focus_out_event (GdkEventFocus*);
235 bool on_key_press_event (GdkEventKey*);
236 bool on_key_release_event (GdkEventKey*);
242 PlugUIBase* _pluginui;
248 void app_activated (bool);
249 void plugin_going_away ();
251 bool create_vst_editor (boost::shared_ptr<ARDOUR::PluginInsert>);
252 bool create_audiounit_editor (boost::shared_ptr<ARDOUR::PluginInsert>);
253 bool create_lv2_editor (boost::shared_ptr<ARDOUR::PluginInsert>);
257 class VSTPluginUI : public PlugUIBase, public Gtk::VBox
260 VSTPluginUI (boost::shared_ptr<ARDOUR::PluginInsert>, boost::shared_ptr<ARDOUR::VSTPlugin>);
263 gint get_preferred_height ();
264 gint get_preferred_width ();
265 bool start_updating(GdkEventAny*) {return false;}
266 bool stop_updating(GdkEventAny*) {return false;}
268 int package (Gtk::Window&);
271 boost::shared_ptr<ARDOUR::VSTPlugin> vst;
273 Gtk::HBox preset_box;
276 bool configure_handler (GdkEventConfigure*, Gtk::Socket*);
277 void save_plugin_setting ();
279 #endif // VST_SUPPORT
281 #ifdef HAVE_AUDIOUNITS
282 /* this function has to be in a .mm file */
283 extern PlugUIBase* create_au_gui (boost::shared_ptr<ARDOUR::PluginInsert>, Gtk::VBox**);
286 #endif /* __ardour_plugin_ui_h__ */