2 * Copyright (C) 2005-2006 Taybin Rutkin <taybin@taybin.com>
3 * Copyright (C) 2005-2017 Paul Davis <paul@linuxaudiosystems.com>
4 * Copyright (C) 2006-2011 David Robillard <d@drobilla.net>
5 * Copyright (C) 2006 Nick Mainsbridge <mainsbridge@gmail.com>
6 * Copyright (C) 2007-2011 Carl Hetherington <carl@carlh.net>
7 * Copyright (C) 2013-2019 Robin Gareus <robin@gareus.org>
8 * Copyright (C) 2014-2017 Ben Loftis <ben@harrisonconsoles.com>
9 * Copyright (C) 2016-2017 Julien "_FrnchFrgg_" RIVAUD <frnchfrgg@free.fr>
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License along
22 * with this program; if not, write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 #ifndef __ardour_mixer_strip__
27 #define __ardour_mixer_strip__
33 #include <gtkmm/adjustment.h>
34 #include <gtkmm/button.h>
35 #include <gtkmm/box.h>
36 #include <gtkmm/eventbox.h>
37 #include <gtkmm/frame.h>
38 #include <gtkmm/label.h>
39 #include <gtkmm/menu.h>
40 #include <gtkmm/sizegroup.h>
41 #include <gtkmm/textview.h>
42 #include <gtkmm/togglebutton.h>
44 #include "pbd/stateful.h"
46 #include "ardour/types.h"
47 #include "ardour/ardour.h"
48 #include "ardour/processor.h"
50 #include "pbd/fastlog.h"
52 #include "widgets/ardour_button.h"
53 #include "widgets/ardour_knob.h"
55 #include "axis_view.h"
56 #include "control_slave_ui.h"
58 #include "gain_meter.h"
59 #include "panner_ui.h"
61 #include "processor_box.h"
62 #include "visibility_group.h"
79 class MotionController;
83 class MixerStrip : public AxisView, public RouteUI, public Gtk::EventBox
86 MixerStrip (Mixer_UI&, ARDOUR::Session*, boost::shared_ptr<ARDOUR::Route>, bool in_mixer = true);
87 MixerStrip (Mixer_UI&, ARDOUR::Session*, bool in_mixer = true);
90 std::string name() const;
91 Gdk::Color color () const;
92 bool marked_for_display () const;
93 bool set_marked_for_display (bool);
95 boost::shared_ptr<ARDOUR::Stripable> stripable() const { return RouteUI::stripable(); }
97 void set_width_enum (Width, void* owner);
98 Width get_width_enum () const { return _width; }
99 void* width_owner () const { return _width_owner; }
101 GainMeter& gain_meter() { return gpm; }
102 PannerUI& panner_ui() { return panners; }
103 PluginSelector* plugin_selector();
106 void set_embedded (bool);
108 void set_route (boost::shared_ptr<ARDOUR::Route>);
109 void set_button_names ();
110 void show_send (boost::shared_ptr<ARDOUR::Send>);
111 void revert_to_default_display ();
113 /** @return the delivery that is being edited using our fader; it will be the
114 * last send passed to \ref show_send() , or our route's main out delivery.
116 boost::shared_ptr<ARDOUR::Delivery> current_delivery () const {
117 return _current_delivery;
120 bool mixer_owned () const {
124 /* used for screenshots */
125 void hide_master_spacer (bool);
129 sigc::signal<void> WidthChanged;
131 /** The delivery that we are handling the level for with our fader has changed */
132 PBD::Signal1<void, boost::weak_ptr<ARDOUR::Delivery> > DeliveryChanged;
134 static PBD::Signal1<void,MixerStrip*> CatchDeletion;
136 std::string state_id() const;
138 void parameter_changed (std::string);
139 void route_active_changed ();
141 void copy_processors ();
142 void cut_processors ();
143 void paste_processors ();
144 void select_all_processors ();
145 void deselect_all_processors ();
146 bool delete_processors (); //note: returns false if nothing was deleted
147 void toggle_processors ();
150 void set_selected (bool yn);
152 static MixerStrip* entered_mixer_strip() { return _entered_mixer_strip; }
155 friend class Mixer_UI;
156 void set_packed (bool yn);
157 bool packed () { return _packed; }
159 void set_stuff_from_route ();
172 ArdourWidgets::ArdourButton hide_button;
173 ArdourWidgets::ArdourButton width_button;
174 ArdourWidgets::ArdourButton number_label;
175 Gtk::HBox width_hide_box;
176 Gtk::EventBox spacer;
179 bool width_button_pressed (GdkEventButton *);
181 Gtk::Frame global_frame;
182 Gtk::VBox global_vpacker;
184 ProcessorBox processor_box;
188 Glib::RefPtr<Gtk::SizeGroup> button_size_group;
190 Gtk::Table rec_mon_table;
191 Gtk::Table solo_iso_table;
192 Gtk::Table mute_solo_table;
193 Gtk::Table bottom_button_table;
195 void vca_assign (boost::shared_ptr<ARDOUR::VCA>);
196 void vca_unassign (boost::shared_ptr<ARDOUR::VCA>);
198 void meter_changed ();
199 void monitor_changed ();
200 void monitor_section_added_or_removed ();
202 ArdourWidgets::ArdourButton input_button;
203 ArdourWidgets::ArdourButton output_button;
205 ArdourWidgets::ArdourButton* monitor_section_button;
207 void input_button_resized (Gtk::Allocation&);
208 void output_button_resized (Gtk::Allocation&);
209 void comment_button_resized (Gtk::Allocation&);
211 ArdourWidgets::ArdourButton* midi_input_enable_button;
212 Gtk::HBox input_button_box;
214 std::string longest_label;
216 void midi_input_status_changed ();
217 bool input_active_button_press (GdkEventButton*);
218 bool input_active_button_release (GdkEventButton*);
220 void help_count_plugins (boost::weak_ptr<ARDOUR::Processor>);
221 uint32_t _plugin_insert_cnt;
223 gint mark_update_safe ();
224 guint32 mode_switch_in_progress;
226 ArdourWidgets::ArdourButton name_button;
227 ArdourWidgets::ArdourButton _comment_button;
228 ArdourWidgets::ArdourKnob trim_control;
230 void trim_start_touch ();
231 void trim_end_touch ();
233 void setup_comment_button ();
235 ArdourWidgets::ArdourButton group_button;
236 RouteGroupMenu* group_menu;
238 gint input_press (GdkEventButton *);
239 gint input_release (GdkEventButton *);
241 gint output_press (GdkEventButton *);
242 gint output_release (GdkEventButton *);
244 Gtk::Menu input_menu;
245 std::list<boost::shared_ptr<ARDOUR::Bundle> > input_menu_bundles;
246 void maybe_add_bundle_to_input_menu (boost::shared_ptr<ARDOUR::Bundle>, ARDOUR::BundleList const &);
248 Gtk::Menu output_menu;
249 std::list<boost::shared_ptr<ARDOUR::Bundle> > output_menu_bundles;
250 void maybe_add_bundle_to_output_menu (boost::shared_ptr<ARDOUR::Bundle>, ARDOUR::BundleList const &,
251 ARDOUR::DataType type = ARDOUR::DataType::NIL);
253 void bundle_input_chosen (boost::shared_ptr<ARDOUR::Bundle>);
254 void bundle_output_chosen (boost::shared_ptr<ARDOUR::Bundle>);
256 void diskstream_changed ();
257 void io_changed_proxy ();
259 Gtk::Menu *send_action_menu;
260 void build_send_action_menu ();
262 PBD::ScopedConnection panstate_connection;
263 PBD::ScopedConnection panstyle_connection;
264 void connect_to_pan ();
265 void update_panner_choices ();
266 void update_trim_control ();
268 void update_diskstream_display ();
269 void update_input_display ();
270 void update_output_display ();
272 void set_automated_controls_sensitivity (bool yn);
274 Gtk::Menu* route_ops_menu;
275 void build_route_ops_menu ();
276 gboolean name_button_button_press (GdkEventButton*);
277 gboolean number_button_button_press (GdkEventButton*);
278 void list_route_operations ();
280 bool select_route_group (GdkEventButton *);
281 void route_group_changed ();
283 Gtk::Style *passthru_style;
285 void route_color_changed ();
286 void show_passthru_color ();
288 void route_property_changed (const PBD::PropertyChange&);
289 void name_button_resized (Gtk::Allocation&);
290 void name_changed ();
291 void update_speed_display ();
293 void hide_processor_editor (boost::weak_ptr<ARDOUR::Processor> processor);
294 void hide_redirect_editors ();
296 bool ignore_speed_adjustment;
298 static MixerStrip* _entered_mixer_strip;
300 virtual void bus_send_display_changed (boost::shared_ptr<ARDOUR::Route>);
302 void set_current_delivery (boost::shared_ptr<ARDOUR::Delivery>);
305 PBD::ScopedConnection send_gone_connection;
307 void reset_strip_style ();
309 ARDOUR::DataType guess_main_type(bool for_input, bool favor_connected = true) const;
311 void update_io_button (bool input_button);
312 void port_connected_or_disconnected (boost::weak_ptr<ARDOUR::Port>, boost::weak_ptr<ARDOUR::Port>);
314 bool mixer_strip_enter_event ( GdkEventCrossing * );
315 bool mixer_strip_leave_event ( GdkEventCrossing * );
317 /** A VisibilityGroup to manage the visibility of some of our controls.
318 * We fill it with the controls that are being managed, using the same names
319 * as those used with _mixer_strip_visibility in RCOptionEditor. Then
320 * this VisibilityGroup is configured by changes to the RC variable
321 * mixer-element-visibility, which happen when the user makes changes in
322 * the RC option editor.
324 VisibilityGroup _visibility;
325 boost::optional<bool> override_solo_visibility () const;
327 PBD::ScopedConnectionList _config_connection;
329 void add_input_port (ARDOUR::DataType);
330 void add_output_port (ARDOUR::DataType);
332 bool _suspend_menu_callbacks;
333 bool level_meter_button_press (GdkEventButton *);
334 void popup_level_meter_menu (GdkEventButton *);
335 void add_level_meter_item_point (Gtk::Menu_Helpers::MenuList &, Gtk::RadioMenuItem::Group &, std::string const &, ARDOUR::MeterPoint);
336 void add_level_meter_item_type (Gtk::Menu_Helpers::MenuList &, Gtk::RadioMenuItem::Group &, std::string const &, ARDOUR::MeterType);
337 void set_meter_point (ARDOUR::MeterPoint);
338 void set_meter_type (ARDOUR::MeterType);
339 PBD::ScopedConnection _level_meter_connection;
341 std::string meter_point_string (ARDOUR::MeterPoint);
343 void update_track_number_visibility ();
345 ControlSlaveUI control_slave_ui;
348 #endif /* __ardour_mixer_strip__ */