2 Copyright (C) 2000 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.
21 #ifndef __ardour_plugin_ui_h__
22 #define __ardour_plugin_ui_h__
28 #include <sigc++/signal.h>
30 #include <gtkmm/button.h>
31 #include <gtkmm/box.h>
32 #include <gtkmm/table.h>
33 #include <gtkmm/eventbox.h>
34 #include <gtkmm/viewport.h>
35 #include <gtkmm/scrolledwindow.h>
36 #include <gtkmm/label.h>
37 #include <gtkmm/menu.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_dialog.h>
45 #include <ardour/types.h>
60 class HSliderController;
67 class PlugUIBase : public virtual sigc::trackable
70 PlugUIBase (ARDOUR::PluginInsert&);
71 virtual ~PlugUIBase() {}
73 virtual gint get_preferred_height () = 0;
74 virtual bool start_updating(GdkEventAny*) = 0;
75 virtual bool stop_updating(GdkEventAny*) = 0;
78 ARDOUR::PluginInsert& insert;
79 ARDOUR::Plugin& plugin;
80 Gtk::ComboBoxText combo;
81 Gtk::Button save_button;
82 Gtk::ToggleButton bypass_button;
84 void setting_selected();
85 void save_plugin_setting (void);
86 void bypass_toggled();
89 class PluginUI : public PlugUIBase, public Gtk::VBox
92 PluginUI (ARDOUR::AudioEngine &, ARDOUR::PluginInsert& plug, bool scrollable=false);
95 gint get_preferred_height () { return prefheight; }
97 bool start_updating(GdkEventAny*);
98 bool stop_updating(GdkEventAny*);
101 ARDOUR::AudioEngine &engine;
102 Gtk::HBox settings_box;
105 Gtk::EventBox name_ebox;
107 Gtk::Table button_table;
108 Gtk::Table output_table;
110 Gtk::ScrolledWindow scroller;
111 Gtk::Adjustment hAdjustment;
112 Gtk::Adjustment vAdjustment;
113 Gtk::Viewport scroller_view;
114 Gtk::Label nameinfo_label;
115 Gtk::Label paraminfo_label;
116 Gtk::Label makerinfo_label;
117 Gtk::Menu* automation_menu;
119 bool setting_name_status;
125 Gtkmm2ext::FastMeter *meter;
143 static const int32_t initial_button_rows = 6;
144 static const int32_t initial_button_cols = 1;
145 static const int32_t initial_output_rows = 1;
146 static const int32_t initial_output_cols = 4;
148 struct ControlUI : public Gtk::HBox {
154 Gtk::Adjustment* adjustment;
155 Gtk::ComboBoxText* combo;
156 std::map<string, float>* combo_map;
157 Gtk::ToggleButton* button;
158 Gtkmm2ext::BarController* control;
159 Gtkmm2ext::ClickBox* clickbox;
164 Gtk::Button automate_button;
168 Gtk::EventBox *display;
169 Gtk::Label* display_label;
173 MeterInfo * meterinfo;
179 std::vector<ControlUI*> output_controls;
180 sigc::connection screen_update_connection;
181 void output_update();
183 void build (ARDOUR::AudioEngine &);
184 ControlUI* build_control_ui (ARDOUR::AudioEngine &, guint32 port_index, MIDI::Controllable *);
185 std::vector<string> setup_scale_values(guint32 port_index, ControlUI* cui);
186 void control_adjustment_changed (ControlUI* cui);
187 void parameter_changed (uint32_t, float, ControlUI* cui);
188 void update_control_display (ControlUI* cui);
189 void control_port_toggled (ControlUI* cui);
190 void control_combo_changed (ControlUI* cui);
192 void redirect_active_changed (ARDOUR::Redirect*, void*);
194 void astate_clicked (ControlUI*, uint32_t parameter);
195 void automation_state_changed (ControlUI*);
196 void set_automation_state (ARDOUR::AutoState state, ControlUI* cui);
197 void start_touch (ControlUI*);
198 void stop_touch (ControlUI*);
200 void print_parameter (char *buf, uint32_t len, uint32_t param);
203 class PluginUIWindow : public ArdourDialog
206 PluginUIWindow (ARDOUR::AudioEngine &, ARDOUR::PluginInsert& insert, bool scrollable=false);
209 PlugUIBase& pluginui() { return *_pluginui; }
211 void resize_preferred();
214 PlugUIBase* _pluginui;
215 void plugin_going_away (ARDOUR::Redirect*);
220 class VSTPluginUI : public PlugUIBase, public Gtk::VBox
223 VSTPluginUI (ARDOUR::PluginInsert&, ARDOUR::VSTPlugin&);
226 gint get_preferred_height ();
227 bool start_updating(GdkEventAny*) {}
228 bool stop_updating(GdkEventAny*) {}
230 int package (Gtk::Window&);
233 ARDOUR::VSTPlugin& vst;
235 Gtk::HBox preset_box;
238 gboolean configure_handler (GdkEventConfigure*, GtkSocket*);
239 void save_plugin_setting ();
243 #endif /* __ardour_plugin_ui_h__ */