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::Expander plugin_eq_bin;
97 Gtk::ToggleButton eqgui_toggle;
99 Gtk::Image* focus_out_image;
100 Gtk::Image* focus_in_image;
102 void setting_selected();
103 void save_plugin_setting (void);
104 bool focus_toggled(GdkEventButton*);
105 void bypass_toggled();
106 void toggle_plugin_analysis ();
107 void processor_active_changed (boost::weak_ptr<ARDOUR::Processor> p);
110 class GenericPluginUI : public PlugUIBase, public Gtk::HPaned
113 GenericPluginUI (boost::shared_ptr<ARDOUR::PluginInsert> plug, bool scrollable=false);
116 gint get_preferred_height () { return prefheight; }
117 gint get_preferred_width () { return -1; }
119 bool start_updating(GdkEventAny*);
120 bool stop_updating(GdkEventAny*);
123 Gtk::VBox main_contents;
125 Gtk::HBox settings_box;
128 Gtk::Table button_table;
129 Gtk::Table output_table;
131 Gtk::ScrolledWindow scroller;
132 Gtk::Adjustment hAdjustment;
133 Gtk::Adjustment vAdjustment;
134 Gtk::Viewport scroller_view;
135 Gtk::Menu* automation_menu;
141 Gtkmm2ext::FastMeter *meter;
159 static const int32_t initial_button_rows = 6;
160 static const int32_t initial_button_cols = 1;
161 static const int32_t initial_output_rows = 1;
162 static const int32_t initial_output_cols = 4;
164 /* FIXME: Unify with AutomationController */
165 struct ControlUI : public Gtk::HBox {
167 boost::shared_ptr<ARDOUR::AutomationControl> control;
169 Evoral::Parameter parameter() { return control->parameter(); }
173 Gtk::ComboBoxText* combo;
174 std::map<string, float>* combo_map;
175 Gtk::ToggleButton* button;
176 boost::shared_ptr<AutomationController> controller;
177 Gtkmm2ext::ClickBox* clickbox;
182 Gtk::Button automate_button;
186 Gtk::EventBox *display;
187 Gtk::Label* display_label;
191 MeterInfo * meterinfo;
197 std::vector<ControlUI*> output_controls;
198 sigc::connection screen_update_connection;
199 void output_update();
202 ControlUI* build_control_ui (guint32 port_index, boost::shared_ptr<ARDOUR::AutomationControl>);
203 std::vector<string> setup_scale_values(guint32 port_index, ControlUI* cui);
204 void parameter_changed (ControlUI* cui);
205 void toggle_parameter_changed (ControlUI* cui);
206 void update_control_display (ControlUI* cui);
207 void control_port_toggled (ControlUI* cui);
208 void control_combo_changed (ControlUI* cui);
210 void processor_active_changed (boost::weak_ptr<ARDOUR::Processor>);
212 void astate_clicked (ControlUI*, uint32_t parameter);
213 void automation_state_changed (ControlUI*);
214 void set_automation_state (ARDOUR::AutoState state, ControlUI* cui);
215 void start_touch (ControlUI*);
216 void stop_touch (ControlUI*);
218 void print_parameter (char *buf, uint32_t len, uint32_t param);
221 class PluginUIWindow : public Gtk::Window
224 PluginUIWindow (Gtk::Window*, boost::shared_ptr<ARDOUR::PluginInsert> insert, bool scrollable=false);
227 PlugUIBase& pluginui() { return *_pluginui; }
229 void resize_preferred();
230 void set_parent (Gtk::Window*);
232 bool on_enter_notify_event (GdkEventCrossing*);
233 bool on_leave_notify_event (GdkEventCrossing*);
234 bool on_focus_in_event (GdkEventFocus*);
235 bool on_focus_out_event (GdkEventFocus*);
236 bool on_key_press_event (GdkEventKey*);
237 bool on_key_release_event (GdkEventKey*);
243 PlugUIBase* _pluginui;
249 void app_activated (bool);
250 void plugin_going_away ();
252 bool create_vst_editor (boost::shared_ptr<ARDOUR::PluginInsert>);
253 bool create_audiounit_editor (boost::shared_ptr<ARDOUR::PluginInsert>);
254 bool create_lv2_editor (boost::shared_ptr<ARDOUR::PluginInsert>);
258 class VSTPluginUI : public PlugUIBase, public Gtk::VBox
261 VSTPluginUI (boost::shared_ptr<ARDOUR::PluginInsert>, boost::shared_ptr<ARDOUR::VSTPlugin>);
264 gint get_preferred_height ();
265 gint get_preferred_width ();
266 bool start_updating(GdkEventAny*) {return false;}
267 bool stop_updating(GdkEventAny*) {return false;}
269 int package (Gtk::Window&);
272 boost::shared_ptr<ARDOUR::VSTPlugin> vst;
274 Gtk::HBox preset_box;
277 bool configure_handler (GdkEventConfigure*, Gtk::Socket*);
278 void save_plugin_setting ();
280 #endif // VST_SUPPORT
282 #ifdef HAVE_AUDIOUNITS
283 /* this function has to be in a .mm file */
284 extern PlugUIBase* create_au_gui (boost::shared_ptr<ARDOUR::PluginInsert>, Gtk::VBox**);
287 #endif /* __ardour_plugin_ui_h__ */