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/togglebutton.h>
38 #include <gtkmm/socket.h>
39 #include <gtkmm/comboboxtext.h>
40 #include <gtkmm/socket.h>
42 #include <ardour/types.h>
44 #include "ardour_dialog.h"
45 #include "latency_gui.h"
46 #include "automation_controller.h"
61 class HSliderController;
68 class PlugUIBase : public virtual sigc::trackable
71 PlugUIBase (boost::shared_ptr<ARDOUR::PluginInsert>);
72 virtual ~PlugUIBase() {}
74 virtual gint get_preferred_height () = 0;
75 virtual gint get_preferred_width () = 0;
76 virtual bool start_updating(GdkEventAny*) = 0;
77 virtual bool stop_updating(GdkEventAny*) = 0;
79 virtual void activate () {}
80 virtual void deactivate () {}
82 virtual void update_presets ();
85 boost::shared_ptr<ARDOUR::PluginInsert> insert;
86 boost::shared_ptr<ARDOUR::Plugin> plugin;
87 Gtk::ComboBoxText preset_combo;
88 Gtk::Button save_button;
89 Gtk::ToggleButton bypass_button;
91 LatencyGUI latency_gui;
93 void setting_selected();
94 void save_plugin_setting (void);
95 void bypass_toggled();
96 void processor_active_changed (boost::weak_ptr<ARDOUR::Processor> p);
99 class GenericPluginUI : public PlugUIBase, public Gtk::HPaned
102 GenericPluginUI (boost::shared_ptr<ARDOUR::PluginInsert> plug, bool scrollable=false);
105 gint get_preferred_height () { return prefheight; }
106 gint get_preferred_width () { return -1; }
108 bool start_updating(GdkEventAny*);
109 bool stop_updating(GdkEventAny*);
112 Gtk::VBox main_contents;
114 Gtk::HBox settings_box;
117 Gtk::Table button_table;
118 Gtk::Table output_table;
120 Gtk::ToggleButton eqgui_toggle;
122 Gtk::ScrolledWindow scroller;
123 Gtk::Adjustment hAdjustment;
124 Gtk::Adjustment vAdjustment;
125 Gtk::Viewport scroller_view;
126 Gtk::Menu* automation_menu;
132 Gtkmm2ext::FastMeter *meter;
150 static const int32_t initial_button_rows = 6;
151 static const int32_t initial_button_cols = 1;
152 static const int32_t initial_output_rows = 1;
153 static const int32_t initial_output_cols = 4;
155 /* FIXME: Unify with AutomationController */
156 struct ControlUI : public Gtk::HBox {
158 boost::shared_ptr<ARDOUR::AutomationControl> control;
160 Evoral::Parameter parameter() { return control->parameter(); }
164 Gtk::ComboBoxText* combo;
165 std::map<string, float>* combo_map;
166 Gtk::ToggleButton* button;
167 boost::shared_ptr<AutomationController> controller;
168 Gtkmm2ext::ClickBox* clickbox;
173 Gtk::Button automate_button;
177 Gtk::EventBox *display;
178 Gtk::Label* display_label;
182 MeterInfo * meterinfo;
188 std::vector<ControlUI*> output_controls;
189 sigc::connection screen_update_connection;
190 void output_update();
193 ControlUI* build_control_ui (guint32 port_index, boost::shared_ptr<ARDOUR::AutomationControl>);
194 std::vector<string> setup_scale_values(guint32 port_index, ControlUI* cui);
195 void parameter_changed (ControlUI* cui);
196 void update_control_display (ControlUI* cui);
197 void control_port_toggled (ControlUI* cui);
198 void control_combo_changed (ControlUI* cui);
200 void processor_active_changed (boost::weak_ptr<ARDOUR::Processor>);
202 void astate_clicked (ControlUI*, uint32_t parameter);
203 void automation_state_changed (ControlUI*);
204 void set_automation_state (ARDOUR::AutoState state, ControlUI* cui);
205 void start_touch (ControlUI*);
206 void stop_touch (ControlUI*);
208 void toggle_plugin_analysis ();
210 void print_parameter (char *buf, uint32_t len, uint32_t param);
213 class PluginUIWindow : public Gtk::Window
216 PluginUIWindow (Gtk::Window*, boost::shared_ptr<ARDOUR::PluginInsert> insert, bool scrollable=false);
219 PlugUIBase& pluginui() { return *_pluginui; }
221 void resize_preferred();
222 void set_parent (Gtk::Window*);
224 bool on_enter_notify_event (GdkEventCrossing*);
225 bool on_leave_notify_event (GdkEventCrossing*);
226 bool on_key_press_event (GdkEventKey*);
227 bool on_key_release_event (GdkEventKey*);
233 PlugUIBase* _pluginui;
239 void app_activated (bool);
240 void plugin_going_away ();
242 bool create_vst_editor (boost::shared_ptr<ARDOUR::PluginInsert>);
243 bool create_audiounit_editor (boost::shared_ptr<ARDOUR::PluginInsert>);
244 bool create_lv2_editor (boost::shared_ptr<ARDOUR::PluginInsert>);
248 class VSTPluginUI : public PlugUIBase, public Gtk::VBox
251 VSTPluginUI (boost::shared_ptr<ARDOUR::PluginInsert>, boost::shared_ptr<ARDOUR::VSTPlugin>);
254 gint get_preferred_height ();
255 gint get_preferred_width ();
256 bool start_updating(GdkEventAny*) {return false;}
257 bool stop_updating(GdkEventAny*) {return false;}
259 int package (Gtk::Window&);
262 boost::shared_ptr<ARDOUR::VSTPlugin> vst;
264 Gtk::HBox preset_box;
267 bool configure_handler (GdkEventConfigure*, Gtk::Socket*);
268 void save_plugin_setting ();
270 #endif // VST_SUPPORT
272 #ifdef HAVE_AUDIOUNITS
273 /* this function has to be in a .mm file */
274 extern PlugUIBase* create_au_gui (boost::shared_ptr<ARDOUR::PluginInsert>, Gtk::VBox**);
277 #endif /* __ardour_plugin_ui_h__ */