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.
22 #include <sigc++/bind.h>
24 #include "pbd/convert.h"
25 #include "pbd/enumwriter.h"
26 #include "pbd/replace_all.h"
28 #include <gtkmm2ext/gtk_ui.h>
29 #include <gtkmm2ext/utils.h>
30 #include <gtkmm2ext/choice.h>
31 #include <gtkmm2ext/doi.h>
32 #include <gtkmm2ext/slider_controller.h>
33 #include <gtkmm2ext/bindable_button.h>
35 #include "ardour/ardour.h"
36 #include "ardour/amp.h"
37 #include "ardour/session.h"
38 #include "ardour/audioengine.h"
39 #include "ardour/internal_send.h"
40 #include "ardour/route.h"
41 #include "ardour/route_group.h"
42 #include "ardour/audio_track.h"
43 #include "ardour/panner.h"
44 #include "ardour/send.h"
45 #include "ardour/processor.h"
46 #include "ardour/profile.h"
47 #include "ardour/ladspa_plugin.h"
48 #include "ardour/user_bundle.h"
49 #include "ardour/port.h"
51 #include "ardour_ui.h"
52 #include "ardour_dialog.h"
53 #include "mixer_strip.h"
57 #include "public_editor.h"
59 #include "io_selector.h"
61 #include "gui_thread.h"
62 #include "route_group_menu.h"
66 using namespace ARDOUR
;
69 using namespace Gtkmm2ext
;
72 sigc::signal
<void,boost::shared_ptr
<Route
> > MixerStrip::SwitchIO
;
74 int MixerStrip::scrollbar_height
= 0;
75 PBD::Signal1
<void,MixerStrip
*> MixerStrip::CatchDeletion
;
77 MixerStrip::MixerStrip (Mixer_UI
& mx
, Session
* sess
, bool in_mixer
)
81 , _mixer_owned (in_mixer
)
82 , processor_box (sess
, boost::bind (&MixerStrip::plugin_selector
, this), mx
.selection(), this, in_mixer
)
85 , _mono_button (_("Mono"))
87 , solo_led_table (2, 2)
88 , middle_button_table (1, 2)
89 , bottom_button_table (1, 2)
90 , meter_point_label (_("pre"))
91 , comment_button (_("Comments"))
96 /* the editor mixer strip: don't destroy it every time
97 the underlying route goes away.
100 self_destruct
= false;
104 MixerStrip::MixerStrip (Mixer_UI
& mx
, Session
* sess
, boost::shared_ptr
<Route
> rt
, bool in_mixer
)
108 , _mixer_owned (in_mixer
)
109 , processor_box (sess
, sigc::mem_fun(*this, &MixerStrip::plugin_selector
), mx
.selection(), this, in_mixer
)
112 , _mono_button (_("Mono"))
113 , button_table (3, 2)
114 , middle_button_table (1, 2)
115 , bottom_button_table (1, 2)
116 , meter_point_label (_("pre"))
117 , comment_button (_("Comments"))
129 _marked_for_display
= false;
131 ignore_comment_edit
= false;
132 ignore_toggle
= false;
138 /* the length of this string determines the width of the mixer strip when it is set to `wide' */
139 longest_label
= "longest label";
143 img
= manage (new Gtk::Image (::get_icon("strip_width")));
146 width_button
.add (*img
);
148 img
= manage (new Gtk::Image (::get_icon("hide")));
151 hide_button
.add (*img
);
153 input_label
.set_text (_("Input"));
154 ARDOUR_UI::instance()->set_tip (&input_button
, _("Button 1 to choose inputs from a port matrix, button 3 to select inputs from a menu"), "");
155 input_button
.add (input_label
);
156 input_button
.set_name ("MixerIOButton");
157 input_label
.set_name ("MixerIOButtonLabel");
159 Gtkmm2ext::set_size_request_to_display_given_text (input_button
, longest_label
.c_str(), 4, 4);
161 output_label
.set_text (_("Output"));
162 ARDOUR_UI::instance()->set_tip (&output_button
, _("Button 1 to choose outputs from a port matrix, button 3 to select inputs from a menu"), "");
163 output_button
.add (output_label
);
164 output_button
.set_name ("MixerIOButton");
165 output_label
.set_name ("MixerIOButtonLabel");
166 Gtkmm2ext::set_size_request_to_display_given_text (output_button
, longest_label
.c_str(), 4, 4);
168 ARDOUR_UI::instance()->set_tip (&meter_point_button
, _("Select metering point"), "");
169 meter_point_button
.add (meter_point_label
);
170 meter_point_button
.set_name ("MixerStripMeterPreButton");
171 meter_point_label
.set_name ("MixerStripMeterPreButton");
173 /* TRANSLATORS: this string should be longest of the strings
174 used to describe meter points. In english, it's "input".
176 set_size_request_to_display_given_text (meter_point_button
, _("tupni"), 5, 5);
178 bottom_button_table
.attach (meter_point_button
, 1, 2, 0, 1);
180 meter_point_button
.signal_button_press_event().connect (sigc::mem_fun (gpm
, &GainMeter::meter_press
), false);
181 meter_point_button
.signal_button_release_event().connect (sigc::mem_fun (gpm
, &GainMeter::meter_release
), false);
183 hide_button
.set_events (hide_button
.get_events() & ~(Gdk::ENTER_NOTIFY_MASK
|Gdk::LEAVE_NOTIFY_MASK
));
185 mute_button
->set_name ("MixerMuteButton");
186 solo_button
->set_name ("MixerSoloButton");
188 solo_isolated_led
= manage (new LED
);
189 solo_isolated_led
->show ();
190 solo_isolated_led
->set_diameter (6);
191 solo_isolated_led
->set_no_show_all (true);
192 solo_isolated_led
->set_name (X_("SoloIsolatedLED"));
193 solo_isolated_led
->add_events (Gdk::BUTTON_PRESS_MASK
|Gdk::BUTTON_RELEASE_MASK
);
194 solo_isolated_led
->signal_button_release_event().connect (sigc::mem_fun (*this, &RouteUI::solo_isolate_button_release
));
195 UI::instance()->set_tip (solo_isolated_led
, _("Isolate Solo"), "");
197 solo_safe_led
= manage (new LED
);
198 solo_safe_led
->show ();
199 solo_safe_led
->set_diameter (6);
200 solo_safe_led
->set_no_show_all (true);
201 solo_safe_led
->set_name (X_("SoloSafeLED"));
202 solo_safe_led
->add_events (Gdk::BUTTON_PRESS_MASK
|Gdk::BUTTON_RELEASE_MASK
);
203 solo_safe_led
->signal_button_release_event().connect (sigc::mem_fun (*this, &RouteUI::solo_safe_button_release
));
204 UI::instance()->set_tip (solo_safe_led
, _("Lock Solo Status"), "");
206 Label
* iso_label
= manage (new Label (_("iso")));
207 Label
* safe_label
= manage (new Label (_("lock")));
209 iso_label
->set_name (X_("SoloLEDLabel"));
210 safe_label
->set_name (X_("SoloLEDLabel"));
215 solo_led_table
.set_spacings (0);
216 solo_led_table
.set_border_width (1);
217 solo_led_table
.attach (*iso_label
, 0, 1, 0, 1, Gtk::FILL
, Gtk::FILL
);
218 solo_led_table
.attach (*solo_isolated_led
, 1, 2, 0, 1, Gtk::FILL
, Gtk::FILL
);
219 solo_led_table
.attach (*safe_label
, 0, 1, 1, 2, Gtk::FILL
, Gtk::FILL
);
220 solo_led_table
.attach (*solo_safe_led
, 1, 2, 1, 2, Gtk::FILL
, Gtk::FILL
);
222 solo_led_table
.show ();
223 solo_led_box
.pack_end (solo_led_table
, false, false);
224 solo_led_box
.show ();
226 button_table
.set_homogeneous (true);
227 button_table
.set_spacings (0);
229 button_table
.attach (name_button
, 0, 2, 0, 1);
230 button_table
.attach (input_button
, 0, 2, 1, 2);
231 button_table
.attach (_invert_button_box
, 0, 2, 3, 4);
233 middle_button_table
.set_homogeneous (true);
234 middle_button_table
.set_spacings (0);
235 middle_button_table
.attach (*mute_button
, 0, 1, 0, 1);
236 middle_button_table
.attach (*solo_button
, 1, 2, 0, 1);
238 bottom_button_table
.set_col_spacings (0);
239 bottom_button_table
.set_homogeneous (true);
240 bottom_button_table
.attach (group_button
, 0, 1, 0, 1);
242 name_button
.add (name_label
);
243 name_button
.set_name ("MixerNameButton");
244 Gtkmm2ext::set_size_request_to_display_given_text (name_button
, longest_label
.c_str(), 2, 2);
246 name_label
.set_name ("MixerNameButtonLabel");
247 ARDOUR_UI::instance()->set_tip (&group_button
, _("Mix group"), "");
248 group_button
.add (group_label
);
249 group_button
.set_name ("MixerGroupButton");
250 Gtkmm2ext::set_size_request_to_display_given_text (group_button
, "Group", 2, 2);
251 group_label
.set_name ("MixerGroupButtonLabel");
253 comment_button
.set_name ("MixerCommentButton");
254 comment_button
.signal_clicked().connect (sigc::mem_fun(*this, &MixerStrip::comment_button_clicked
));
256 _mono_button
.set_name ("MixerMonoButton");
257 _mono_button
.signal_clicked().connect (sigc::mem_fun (*this, &MixerStrip::mono_button_clicked
));
259 global_vpacker
.set_border_width (0);
260 global_vpacker
.set_spacing (0);
262 width_button
.set_name ("MixerWidthButton");
263 hide_button
.set_name ("MixerHideButton");
264 top_event_box
.set_name ("MixerTopEventBox");
266 width_button
.signal_clicked().connect (sigc::mem_fun(*this, &MixerStrip::width_clicked
));
267 hide_button
.signal_clicked().connect (sigc::mem_fun(*this, &MixerStrip::hide_clicked
));
269 width_hide_box
.pack_start (width_button
, false, true);
270 width_hide_box
.pack_start (top_event_box
, true, true);
271 width_hide_box
.pack_end (hide_button
, false, true);
272 gain_meter_alignment
.set_padding(0, 4, 0, 0);
273 gain_meter_alignment
.add(gpm
);
275 whvbox
.pack_start (width_hide_box
, true, true);
277 global_vpacker
.pack_start (whvbox
, Gtk::PACK_SHRINK
);
278 global_vpacker
.pack_start (button_table
,Gtk::PACK_SHRINK
);
279 global_vpacker
.pack_start (processor_box
, true, true);
280 global_vpacker
.pack_start (panners
, Gtk::PACK_SHRINK
);
281 global_vpacker
.pack_start (solo_led_box
,Gtk::PACK_SHRINK
);
282 global_vpacker
.pack_start (middle_button_table
,Gtk::PACK_SHRINK
);
283 global_vpacker
.pack_start (gain_meter_alignment
,Gtk::PACK_SHRINK
);
284 global_vpacker
.pack_start (bottom_button_table
,Gtk::PACK_SHRINK
);
285 global_vpacker
.pack_start (_mono_button
, Gtk::PACK_SHRINK
);
286 global_vpacker
.pack_start (output_button
, Gtk::PACK_SHRINK
);
287 global_vpacker
.pack_start (comment_button
, Gtk::PACK_SHRINK
);
289 global_frame
.add (global_vpacker
);
290 global_frame
.set_shadow_type (Gtk::SHADOW_IN
);
291 global_frame
.set_name ("BaseFrame");
295 /* force setting of visible selected status */
298 set_selected (false);
303 _session
->engine().Stopped
.connect (*this, invalidator (*this), boost::bind (&MixerStrip::engine_stopped
, this), gui_context());
304 _session
->engine().Running
.connect (*this, invalidator (*this), boost::bind (&MixerStrip::engine_running
, this), gui_context());
306 input_button
.signal_button_press_event().connect (sigc::mem_fun(*this, &MixerStrip::input_press
), false);
307 output_button
.signal_button_press_event().connect (sigc::mem_fun(*this, &MixerStrip::output_press
), false);
309 /* we don't need this if its not an audio track, but we don't know that yet and it doesn't
313 rec_enable_button
->set_name ("MixerRecordEnableButton");
315 /* ditto for this button and busses */
317 name_button
.signal_button_press_event().connect (sigc::mem_fun(*this, &MixerStrip::name_button_button_press
), false);
318 group_button
.signal_button_press_event().connect (sigc::mem_fun(*this, &MixerStrip::select_route_group
), false);
322 /* start off as a passthru strip. we'll correct this, if necessary,
323 in update_diskstream_display().
326 /* start off as a passthru strip. we'll correct this, if necessary,
327 in update_diskstream_display().
331 set_name ("MidiTrackStripBase");
333 set_name ("AudioTrackStripBase");
335 add_events (Gdk::BUTTON_RELEASE_MASK
|
336 Gdk::ENTER_NOTIFY_MASK
|
337 Gdk::LEAVE_NOTIFY_MASK
|
339 Gdk::KEY_RELEASE_MASK
);
341 set_flags (get_flags() | Gtk::CAN_FOCUS
);
343 SwitchIO
.connect (sigc::mem_fun (*this, &MixerStrip::switch_io
));
346 MixerStrip::~MixerStrip ()
348 CatchDeletion (this);
350 delete input_selector
;
351 delete output_selector
;
352 delete comment_window
;
356 MixerStrip::set_route (boost::shared_ptr
<Route
> rt
)
358 if (rec_enable_button
->get_parent()) {
359 button_table
.remove (*rec_enable_button
);
362 if (show_sends_button
->get_parent()) {
363 button_table
.remove (*show_sends_button
);
366 processor_box
.set_route (rt
);
368 RouteUI::set_route (rt
);
370 /* map the current state */
373 update_solo_display ();
375 delete input_selector
;
378 delete output_selector
;
381 revert_to_default_display ();
383 if (set_color_from_route()) {
384 set_color (unique_random_color());
387 if (route()->is_master()) {
388 solo_button
->hide ();
389 solo_led_box
.hide ();
391 solo_button
->show ();
392 solo_led_box
.show ();
395 if (_mixer_owned
&& (route()->is_master() || route()->is_monitor())) {
397 if (scrollbar_height
== 0) {
398 HScrollbar scrollbar
;
399 Gtk::Requisition
requisition(scrollbar
.size_request ());
400 scrollbar_height
= requisition
.height
;
403 spacer
= manage (new EventBox
);
404 spacer
->set_size_request (-1, scrollbar_height
);
405 global_vpacker
.pack_start (*spacer
, false, false);
408 if (is_audio_track()) {
409 boost::shared_ptr
<AudioTrack
> at
= audio_track();
410 at
->FreezeChange
.connect (route_connections
, invalidator (*this), boost::bind (&MixerStrip::map_frozen
, this), gui_context());
413 if (has_audio_outputs ()) {
414 _mono_button
.show ();
417 _mono_button
.hide ();
423 button_table
.attach (*rec_enable_button
, 0, 2, 2, 3);
424 rec_enable_button
->set_sensitive (_session
->writable());
425 rec_enable_button
->show();
431 if (!_route
->is_master()) {
432 button_table
.attach (*show_sends_button
, 0, 2, 2, 3);
433 show_sends_button
->show();
437 switch (_route
->meter_point()) {
439 meter_point_label
.set_text (_("input"));
443 meter_point_label
.set_text (_("pre"));
447 meter_point_label
.set_text (_("post"));
451 meter_point_label
.set_text (_("custom"));
455 delete route_ops_menu
;
458 ARDOUR_UI::instance()->set_tip (comment_button
, _route
->comment().empty() ?
459 _("Click to Add/Edit Comments"):
462 _route
->meter_change
.connect (route_connections
, invalidator (*this), bind (&MixerStrip::meter_changed
, this), gui_context());
463 _route
->input()->changed
.connect (route_connections
, invalidator (*this), ui_bind (&MixerStrip::input_changed
, this, _1
, _2
), gui_context());
464 _route
->output()->changed
.connect (route_connections
, invalidator (*this), ui_bind (&MixerStrip::output_changed
, this, _1
, _2
), gui_context());
465 _route
->route_group_changed
.connect (route_connections
, invalidator (*this), boost::bind (&MixerStrip::route_group_changed
, this), gui_context());
467 if (_route
->panner()) {
468 _route
->panner()->Changed
.connect (route_connections
, invalidator (*this), boost::bind (&MixerStrip::connect_to_pan
, this), gui_context());
471 if (is_audio_track()) {
472 audio_track()->DiskstreamChanged
.connect (route_connections
, invalidator (*this), boost::bind (&MixerStrip::diskstream_changed
, this), gui_context());
475 _route
->comment_changed
.connect (route_connections
, invalidator (*this), ui_bind (&MixerStrip::comment_changed
, this, _1
), gui_context());
476 _route
->gui_changed
.connect (route_connections
, invalidator (*this), ui_bind (&MixerStrip::route_gui_changed
, this, _1
, _2
), gui_context());
478 set_stuff_from_route ();
480 /* now force an update of all the various elements */
483 update_solo_display ();
486 route_group_changed ();
490 panners
.setup_pan ();
492 update_diskstream_display ();
493 update_input_display ();
494 update_output_display ();
496 add_events (Gdk::BUTTON_RELEASE_MASK
);
498 processor_box
.show();
500 if (!route()->is_master() && !route()->is_monitor()) {
501 /* we don't allow master or control routes to be hidden */
506 width_hide_box
.show();
509 global_vpacker
.show();
511 middle_button_table
.show();
512 bottom_button_table
.show();
513 processor_box
.show_all ();
515 gain_meter_alignment
.show ();
516 gain_unit_button
.show();
517 gain_unit_label
.show();
518 meter_point_button
.show();
519 meter_point_label
.show();
520 diskstream_button
.show();
521 diskstream_label
.show();
524 output_button
.show();
528 comment_button
.show();
536 MixerStrip::set_stuff_from_route ()
542 /* if width is not set, it will be set by the MixerUI or editor */
544 if ((prop
= xml_node
->property ("strip-width")) != 0) {
545 set_width_enum (Width (string_2_enum (prop
->value(), _width
)), this);
548 if ((prop
= xml_node
->property ("shown-mixer")) != 0) {
549 if (prop
->value() == "no") {
550 _marked_for_display
= false;
552 _marked_for_display
= true;
555 /* backwards compatibility */
556 _marked_for_display
= true;
561 MixerStrip::set_width_enum (Width w
, void* owner
)
563 /* always set the gpm width again, things may be hidden */
566 panners
.set_width (w
);
568 boost::shared_ptr
<AutomationList
> gain_automation
= _route
->gain_control()->alist();
570 _width_owner
= owner
;
576 if (_width_owner
== this) {
577 xml_node
->add_property ("strip-width", enum_2_string (_width
));
584 if (show_sends_button
) {
585 ((Gtk::Label
*)show_sends_button
->get_child())->set_text (_("Sends"));
588 if (_route
->comment() == "") {
589 comment_button
.unset_bg (STATE_NORMAL
);
590 ((Gtk::Label
*)comment_button
.get_child())->set_text (_("Comments"));
592 comment_button
.modify_bg (STATE_NORMAL
, color());
593 ((Gtk::Label
*)comment_button
.get_child())->set_text (_("*Comments*"));
596 ((Gtk::Label
*)gpm
.gain_automation_style_button
.get_child())->set_text (
597 gpm
.astyle_string(gain_automation
->automation_style()));
598 ((Gtk::Label
*)gpm
.gain_automation_state_button
.get_child())->set_text (
599 gpm
.astate_string(gain_automation
->automation_state()));
601 if (_route
->panner()) {
602 ((Gtk::Label
*)panners
.pan_automation_style_button
.get_child())->set_text (
603 panners
.astyle_string(_route
->panner()->automation_style()));
604 ((Gtk::Label
*)panners
.pan_automation_state_button
.get_child())->set_text (
605 panners
.astate_string(_route
->panner()->automation_state()));
608 Gtkmm2ext::set_size_request_to_display_given_text (name_button
, "long", 2, 2);
609 set_size_request (-1, -1);
613 if (show_sends_button
) {
614 ((Gtk::Label
*)show_sends_button
->get_child())->set_text (_("Snd"));
617 if (_route
->comment() == "") {
618 comment_button
.unset_bg (STATE_NORMAL
);
619 ((Gtk::Label
*)comment_button
.get_child())->set_text (_("Cmt"));
621 comment_button
.modify_bg (STATE_NORMAL
, color());
622 ((Gtk::Label
*)comment_button
.get_child())->set_text (_("*Cmt*"));
625 ((Gtk::Label
*)gpm
.gain_automation_style_button
.get_child())->set_text (
626 gpm
.short_astyle_string(gain_automation
->automation_style()));
627 ((Gtk::Label
*)gpm
.gain_automation_state_button
.get_child())->set_text (
628 gpm
.short_astate_string(gain_automation
->automation_state()));
630 if (_route
->panner()) {
631 ((Gtk::Label
*)panners
.pan_automation_style_button
.get_child())->set_text (
632 panners
.short_astyle_string(_route
->panner()->automation_style()));
633 ((Gtk::Label
*)panners
.pan_automation_state_button
.get_child())->set_text (
634 panners
.short_astate_string(_route
->panner()->automation_state()));
637 Gtkmm2ext::set_size_request_to_display_given_text (name_button
, longest_label
.c_str(), 2, 2);
638 set_size_request (max (50, gpm
.get_gm_width()), -1);
642 processor_box
.set_width (w
);
644 update_input_display ();
645 update_output_display ();
646 route_group_changed ();
652 MixerStrip::set_packed (bool yn
)
659 xml_node
->add_property ("shown-mixer", "yes");
661 xml_node
->add_property ("shown-mixer", "no");
667 MixerStrip::output_press (GdkEventButton
*ev
)
669 using namespace Menu_Helpers
;
670 if (!_session
->engine().connected()) {
671 MessageDialog
msg (_("Not connected to JACK - no I/O changes are possible"));
676 MenuList
& citems
= output_menu
.items();
677 switch (ev
->button
) {
680 edit_output_configuration ();
685 output_menu
.set_name ("ArdourContextMenu");
687 output_menu_bundles
.clear ();
689 citems
.push_back (MenuElem (_("Disconnect"), sigc::mem_fun (*(static_cast<RouteUI
*>(this)), &RouteUI::disconnect_output
)));
690 citems
.push_back (SeparatorElem());
692 ARDOUR::BundleList current
= _route
->output()->bundles_connected ();
694 boost::shared_ptr
<ARDOUR::BundleList
> b
= _session
->bundles ();
696 /* give user bundles first chance at being in the menu */
698 for (ARDOUR::BundleList::iterator i
= b
->begin(); i
!= b
->end(); ++i
) {
699 if (boost::dynamic_pointer_cast
<UserBundle
> (*i
)) {
700 maybe_add_bundle_to_output_menu (*i
, current
);
704 for (ARDOUR::BundleList::iterator i
= b
->begin(); i
!= b
->end(); ++i
) {
705 if (boost::dynamic_pointer_cast
<UserBundle
> (*i
) == 0) {
706 maybe_add_bundle_to_output_menu (*i
, current
);
710 boost::shared_ptr
<ARDOUR::RouteList
> routes
= _session
->get_routes ();
711 for (ARDOUR::RouteList::const_iterator i
= routes
->begin(); i
!= routes
->end(); ++i
) {
712 maybe_add_bundle_to_output_menu ((*i
)->input()->bundle(), current
);
715 if (citems
.size() == 2) {
716 /* no routes added; remove the separator */
720 output_menu
.popup (1, ev
->time
);
731 MixerStrip::edit_output_configuration ()
733 if (output_selector
== 0) {
735 boost::shared_ptr
<Send
> send
;
736 boost::shared_ptr
<IO
> output
;
738 if ((send
= boost::dynamic_pointer_cast
<Send
>(_current_delivery
)) != 0) {
739 if (!boost::dynamic_pointer_cast
<InternalSend
>(send
)) {
740 output
= send
->output();
742 output
= _route
->output ();
745 output
= _route
->output ();
748 output_selector
= new IOSelectorWindow (_session
, output
);
751 if (output_selector
->is_visible()) {
752 output_selector
->get_toplevel()->get_window()->raise();
754 output_selector
->present ();
759 MixerStrip::edit_input_configuration ()
761 if (input_selector
== 0) {
762 input_selector
= new IOSelectorWindow (_session
, _route
->input());
765 if (input_selector
->is_visible()) {
766 input_selector
->get_toplevel()->get_window()->raise();
768 input_selector
->present ();
773 MixerStrip::input_press (GdkEventButton
*ev
)
775 using namespace Menu_Helpers
;
777 MenuList
& citems
= input_menu
.items();
778 input_menu
.set_name ("ArdourContextMenu");
781 if (!_session
->engine().connected()) {
782 MessageDialog
msg (_("Not connected to JACK - no I/O changes are possible"));
787 if (_session
->actively_recording() && _route
->record_enabled())
790 switch (ev
->button
) {
793 edit_input_configuration ();
798 citems
.push_back (MenuElem (_("Disconnect"), sigc::mem_fun (*(static_cast<RouteUI
*>(this)), &RouteUI::disconnect_input
)));
799 citems
.push_back (SeparatorElem());
800 input_menu_bundles
.clear ();
802 ARDOUR::BundleList current
= _route
->input()->bundles_connected ();
804 boost::shared_ptr
<ARDOUR::BundleList
> b
= _session
->bundles ();
806 /* give user bundles first chance at being in the menu */
808 for (ARDOUR::BundleList::iterator i
= b
->begin(); i
!= b
->end(); ++i
) {
809 if (boost::dynamic_pointer_cast
<UserBundle
> (*i
)) {
810 maybe_add_bundle_to_input_menu (*i
, current
);
814 for (ARDOUR::BundleList::iterator i
= b
->begin(); i
!= b
->end(); ++i
) {
815 if (boost::dynamic_pointer_cast
<UserBundle
> (*i
) == 0) {
816 maybe_add_bundle_to_input_menu (*i
, current
);
820 boost::shared_ptr
<ARDOUR::RouteList
> routes
= _session
->get_routes ();
821 for (ARDOUR::RouteList::const_iterator i
= routes
->begin(); i
!= routes
->end(); ++i
) {
822 maybe_add_bundle_to_input_menu ((*i
)->output()->bundle(), current
);
825 if (citems
.size() == 2) {
826 /* no routes added; remove the separator */
830 input_menu
.popup (1, ev
->time
);
840 MixerStrip::bundle_input_toggled (boost::shared_ptr
<ARDOUR::Bundle
> c
)
846 ARDOUR::BundleList current
= _route
->input()->bundles_connected ();
848 if (std::find (current
.begin(), current
.end(), c
) == current
.end()) {
849 _route
->input()->connect_ports_to_bundle (c
, this);
851 _route
->input()->disconnect_ports_from_bundle (c
, this);
856 MixerStrip::bundle_output_toggled (boost::shared_ptr
<ARDOUR::Bundle
> c
)
862 ARDOUR::BundleList current
= _route
->output()->bundles_connected ();
864 if (std::find (current
.begin(), current
.end(), c
) == current
.end()) {
865 _route
->output()->connect_ports_to_bundle (c
, this);
867 _route
->output()->disconnect_ports_from_bundle (c
, this);
872 MixerStrip::maybe_add_bundle_to_input_menu (boost::shared_ptr
<Bundle
> b
, ARDOUR::BundleList
const & current
)
874 using namespace Menu_Helpers
;
876 if (b
->ports_are_outputs() == false || b
->nchannels() != _route
->n_inputs()) {
880 list
<boost::shared_ptr
<Bundle
> >::iterator i
= input_menu_bundles
.begin ();
881 while (i
!= input_menu_bundles
.end() && b
->has_same_ports (*i
) == false) {
885 if (i
!= input_menu_bundles
.end()) {
889 input_menu_bundles
.push_back (b
);
891 MenuList
& citems
= input_menu
.items();
893 std::string n
= b
->name ();
894 replace_all (n
, "_", " ");
896 citems
.push_back (CheckMenuElem (n
, sigc::bind (sigc::mem_fun(*this, &MixerStrip::bundle_input_toggled
), b
)));
898 if (std::find (current
.begin(), current
.end(), b
) != current
.end()) {
899 ignore_toggle
= true;
900 dynamic_cast<CheckMenuItem
*> (&citems
.back())->set_active (true);
901 ignore_toggle
= false;
906 MixerStrip::maybe_add_bundle_to_output_menu (boost::shared_ptr
<Bundle
> b
, ARDOUR::BundleList
const & current
)
908 using namespace Menu_Helpers
;
910 if (b
->ports_are_inputs() == false || b
->nchannels() != _route
->n_outputs()) {
914 list
<boost::shared_ptr
<Bundle
> >::iterator i
= output_menu_bundles
.begin ();
915 while (i
!= output_menu_bundles
.end() && b
->has_same_ports (*i
) == false) {
919 if (i
!= output_menu_bundles
.end()) {
923 output_menu_bundles
.push_back (b
);
925 MenuList
& citems
= output_menu
.items();
927 std::string n
= b
->name ();
928 replace_all (n
, "_", " ");
930 citems
.push_back (CheckMenuElem (n
, sigc::bind (sigc::mem_fun(*this, &MixerStrip::bundle_output_toggled
), b
)));
932 if (std::find (current
.begin(), current
.end(), b
) != current
.end()) {
933 ignore_toggle
= true;
934 dynamic_cast<CheckMenuItem
*> (&citems
.back())->set_active (true);
935 ignore_toggle
= false;
940 MixerStrip::update_diskstream_display ()
944 if (input_selector
) {
945 input_selector
->hide_all ();
952 show_passthru_color ();
957 MixerStrip::connect_to_pan ()
959 ENSURE_GUI_THREAD (*this, &MixerStrip::connect_to_pan
)
961 panstate_connection
.disconnect ();
962 panstyle_connection
.disconnect ();
964 if (!_route
->panner()) {
968 boost::shared_ptr
<ARDOUR::AutomationControl
> pan_control
969 = boost::dynamic_pointer_cast
<ARDOUR::AutomationControl
>(
970 _route
->panner()->control(Evoral::Parameter(PanAutomation
)));
973 pan_control
->alist()->automation_state_changed
.connect (panstate_connection
, invalidator (*this), boost::bind (&PannerUI::pan_automation_state_changed
, &panners
), gui_context());
974 pan_control
->alist()->automation_style_changed
.connect (panstyle_connection
, invalidator (*this), boost::bind (&PannerUI::pan_automation_style_changed
, &panners
), gui_context());
977 panners
.panner_changed (this);
982 * Output port labelling
983 * =====================
985 * Case 1: Each output has one connection, all connections are to system:playback_%i
986 * out 1 -> system:playback_1
987 * out 2 -> system:playback_2
988 * out 3 -> system:playback_3
991 * Case 2: Each output has one connection, all connections are to ardour:track_x/in 1
992 * out 1 -> ardour:track_x/in 1
993 * out 2 -> ardour:track_x/in 2
994 * Display as: track_x
996 * Case 3: Each output has one connection, all connections are to Jack client "program x"
997 * out 1 -> program x:foo
998 * out 2 -> program x:foo
999 * Display as: program x
1001 * Case 4: No connections (Disconnected)
1004 * Default case (unusual routing):
1005 * Display as: *number of connections*
1009 * .-----------------------------------------------.
1011 * | out 1 -> ardour:master/in 1, jamin:input/in 1 |
1012 * | out 2 -> ardour:master/in 2, jamin:input/in 2 |
1013 * '-----------------------------------------------'
1014 * .-----------------------------------------------.
1017 * '-----------------------------------------------'
1021 MixerStrip::update_io_button (boost::shared_ptr
<ARDOUR::Route
> route
, Width width
, bool for_input
)
1026 vector
<string
> port_connections
;
1028 uint32_t total_connection_count
= 0;
1029 uint32_t io_connection_count
= 0;
1030 uint32_t ardour_connection_count
= 0;
1031 uint32_t system_connection_count
= 0;
1032 uint32_t other_connection_count
= 0;
1034 ostringstream label
;
1035 string label_string
;
1038 bool have_label
= false;
1039 bool each_io_has_one_connection
= true;
1041 string connection_name
;
1042 string ardour_track_name
;
1043 string other_connection_type
;
1044 string system_ports
;
1047 ostringstream tooltip
;
1048 char * tooltip_cstr
;
1050 tooltip
<< route
->name();
1053 io_count
= route
->n_inputs().n_total();
1055 io_count
= route
->n_outputs().n_total();
1058 for (io_index
= 0; io_index
< io_count
; ++io_index
) {
1060 port
= route
->input()->nth (io_index
);
1062 port
= route
->output()->nth (io_index
);
1065 port_connections
.clear ();
1066 port
->get_connections(port_connections
);
1067 io_connection_count
= 0;
1069 if (!port_connections
.empty()) {
1070 for (vector
<string
>::iterator i
= port_connections
.begin(); i
!= port_connections
.end(); ++i
) {
1071 string
& connection_name (*i
);
1073 if (io_connection_count
== 0) {
1074 tooltip
<< endl
<< port
->name().substr(port
->name().find("/") + 1) << " -> " << connection_name
;
1076 tooltip
<< ", " << connection_name
;
1079 if (connection_name
.find("ardour:") == 0) {
1080 if (ardour_track_name
.empty()) {
1081 // "ardour:Master/in 1" -> "ardour:Master/"
1082 string::size_type slash
= connection_name
.find("/");
1083 if (slash
!= string::npos
) {
1084 ardour_track_name
= connection_name
.substr(0, slash
+ 1);
1088 if (connection_name
.find(ardour_track_name
) == 0) {
1089 ++ardour_connection_count
;
1091 } else if (connection_name
.find("system:") == 0) {
1093 // "system:capture_123" -> "123"
1094 system_port
= connection_name
.substr(15);
1096 // "system:playback_123" -> "123"
1097 system_port
= connection_name
.substr(16);
1100 if (system_ports
.empty()) {
1101 system_ports
+= system_port
;
1103 system_ports
+= "/" + system_port
;
1106 ++system_connection_count
;
1108 if (other_connection_type
.empty()) {
1109 // "jamin:in 1" -> "jamin:"
1110 other_connection_type
= connection_name
.substr(0, connection_name
.find(":") + 1);
1113 if (connection_name
.find(other_connection_type
) == 0) {
1114 ++other_connection_count
;
1118 ++total_connection_count
;
1119 ++io_connection_count
;
1123 if (io_connection_count
!= 1) {
1124 each_io_has_one_connection
= false;
1128 if (total_connection_count
== 0) {
1129 tooltip
<< endl
<< _("Disconnected");
1132 tooltip_cstr
= new char[tooltip
.str().size() + 1];
1133 strcpy(tooltip_cstr
, tooltip
.str().c_str());
1136 ARDOUR_UI::instance()->set_tip (&input_button
, tooltip_cstr
, "");
1138 ARDOUR_UI::instance()->set_tip (&output_button
, tooltip_cstr
, "");
1141 if (each_io_has_one_connection
) {
1142 if ((total_connection_count
== ardour_connection_count
)) {
1143 // all connections are to the same track in ardour
1144 // "ardour:Master/" -> "Master"
1145 string::size_type slash
= ardour_track_name
.find("/");
1146 if (slash
!= string::npos
) {
1147 label
<< ardour_track_name
.substr(7, slash
- 7);
1151 else if (total_connection_count
== system_connection_count
) {
1152 // all connections are to system ports
1153 label
<< system_ports
;
1156 else if (total_connection_count
== other_connection_count
) {
1157 // all connections are to the same external program eg jamin
1158 // "jamin:" -> "jamin"
1159 label
<< other_connection_type
.substr(0, other_connection_type
.size() - 1);
1165 if (total_connection_count
== 0) {
1169 // Odd configuration
1170 label
<< "*" << total_connection_count
<< "*";
1176 label_string
= label
.str().substr(0, 6);
1179 label_string
= label
.str().substr(0, 3);
1183 label_cstr
= new char[label_string
.size() + 1];
1184 strcpy(label_cstr
, label_string
.c_str());
1187 input_label
.set_text (label_cstr
);
1189 output_label
.set_text (label_cstr
);
1194 MixerStrip::update_input_display ()
1196 update_io_button (_route
, _width
, true);
1197 panners
.setup_pan ();
1201 MixerStrip::update_output_display ()
1203 update_io_button (_route
, _width
, false);
1204 gpm
.setup_meters ();
1205 panners
.setup_pan ();
1209 MixerStrip::fast_update ()
1211 gpm
.update_meters ();
1215 MixerStrip::diskstream_changed ()
1217 Gtkmm2ext::UI::instance()->call_slot (invalidator (*this), boost::bind (&MixerStrip::update_diskstream_display
, this));
1221 MixerStrip::input_changed (IOChange
/*change*/, void */
*src*/
)
1223 Gtkmm2ext::UI::instance()->call_slot (invalidator (*this), boost::bind (&MixerStrip::update_input_display
, this));
1224 set_width_enum (_width
, this);
1228 MixerStrip::output_changed (IOChange
/*change*/, void */
*src*/
)
1230 Gtkmm2ext::UI::instance()->call_slot (invalidator (*this), boost::bind (&MixerStrip::update_output_display
, this));
1231 set_width_enum (_width
, this);
1236 MixerStrip::comment_editor_done_editing()
1238 string str
= comment_area
->get_buffer()->get_text();
1239 if (_route
->comment() != str
) {
1240 _route
->set_comment (str
, this);
1245 if (! str
.empty()) {
1246 comment_button
.modify_bg (STATE_NORMAL
, color());
1247 ((Gtk::Label
*)comment_button
.get_child())->set_text (_("*Comments*"));
1249 comment_button
.unset_bg (STATE_NORMAL
);
1250 ((Gtk::Label
*)comment_button
.get_child())->set_text (_("Comments"));
1255 if (! str
.empty()) {
1256 comment_button
.modify_bg (STATE_NORMAL
, color());
1257 ((Gtk::Label
*)comment_button
.get_child())->set_text (_("*Cmt*"));
1259 comment_button
.unset_bg (STATE_NORMAL
);
1260 ((Gtk::Label
*)comment_button
.get_child())->set_text (_("Cmt"));
1265 ARDOUR_UI::instance()->set_tip (comment_button
,
1266 str
.empty() ? _("Click to Add/Edit Comments") : str
);
1272 MixerStrip::comment_button_clicked ()
1274 if (comment_window
== 0) {
1275 setup_comment_editor ();
1278 int x
, y
, cw_width
, cw_height
;
1280 if (comment_window
->is_visible()) {
1281 comment_window
->hide ();
1285 comment_window
->get_size (cw_width
, cw_height
);
1286 comment_window
->get_position(x
, y
);
1287 comment_window
->move(x
, y
- (cw_height
/ 2) - 45);
1289 half the dialog height minus the comments button height
1290 with some window decoration fudge thrown in.
1293 comment_window
->show();
1294 comment_window
->present();
1298 MixerStrip::setup_comment_editor ()
1301 title
= _route
->name();
1302 title
+= _(": comment editor");
1304 comment_window
= new ArdourDialog (title
, false);
1305 comment_window
->set_position (Gtk::WIN_POS_MOUSE
);
1306 comment_window
->set_skip_taskbar_hint (true);
1307 comment_window
->signal_hide().connect (sigc::mem_fun(*this, &MixerStrip::comment_editor_done_editing
));
1309 comment_area
= manage (new TextView());
1310 comment_area
->set_name ("MixerTrackCommentArea");
1311 comment_area
->set_size_request (110, 178);
1312 comment_area
->set_wrap_mode (WRAP_WORD
);
1313 comment_area
->set_editable (true);
1314 comment_area
->get_buffer()->set_text (_route
->comment());
1315 comment_area
->show ();
1317 comment_window
->get_vbox()->pack_start (*comment_area
);
1318 comment_window
->get_action_area()->hide();
1322 MixerStrip::comment_changed (void *src
)
1324 ENSURE_GUI_THREAD (*this, &MixerStrip::comment_changed
, src
)
1327 ignore_comment_edit
= true;
1329 comment_area
->get_buffer()->set_text (_route
->comment());
1331 ignore_comment_edit
= false;
1336 MixerStrip::set_route_group (RouteGroup
*rg
)
1342 MixerStrip::select_route_group (GdkEventButton
*ev
)
1344 using namespace Menu_Helpers
;
1346 if (ev
->button
== 1) {
1348 if (group_menu
== 0) {
1350 PropertyList
* plist
= new PropertyList();
1352 plist
->add (Properties::gain
, true);
1353 plist
->add (Properties::mute
, true);
1354 plist
->add (Properties::solo
, true);
1356 group_menu
= new RouteGroupMenu (_session
, plist
);
1357 group_menu
->GroupSelected
.connect (sigc::mem_fun (*this, &MixerStrip::set_route_group
));
1360 group_menu
->popup (1, ev
->time
);
1367 MixerStrip::route_group_changed ()
1369 ENSURE_GUI_THREAD (*this, &MixerStrip::route_group_changed
)
1371 RouteGroup
*rg
= _route
->route_group();
1374 group_label
.set_text (PBD::short_version (rg
->name(), 5));
1378 group_label
.set_text (_("Grp"));
1381 group_label
.set_text (_("~G"));
1389 MixerStrip::route_gui_changed (string what_changed
, void*)
1391 ENSURE_GUI_THREAD (*this, &MixerStrip::route_gui_changed
, what_changed
, ignored
)
1393 if (what_changed
== "color") {
1394 if (set_color_from_route () == 0) {
1395 show_route_color ();
1401 MixerStrip::show_route_color ()
1403 name_button
.modify_bg (STATE_NORMAL
, color());
1404 top_event_box
.modify_bg (STATE_NORMAL
, color());
1405 route_active_changed ();
1409 MixerStrip::show_passthru_color ()
1411 route_active_changed ();
1415 MixerStrip::build_route_ops_menu ()
1417 using namespace Menu_Helpers
;
1418 route_ops_menu
= new Menu
;
1419 route_ops_menu
->set_name ("ArdourContextMenu");
1421 MenuList
& items
= route_ops_menu
->items();
1423 items
.push_back (MenuElem (_("Save As Template..."), sigc::mem_fun(*this, &RouteUI::save_as_template
)));
1424 items
.push_back (MenuElem (_("Rename..."), sigc::mem_fun(*this, &RouteUI::route_rename
)));
1425 rename_menu_item
= &items
.back();
1426 items
.push_back (SeparatorElem());
1427 items
.push_back (CheckMenuElem (_("Active"), sigc::mem_fun (*this, &RouteUI::toggle_route_active
)));
1428 route_active_menu_item
= dynamic_cast<CheckMenuItem
*> (&items
.back());
1429 route_active_menu_item
->set_active (_route
->active());
1431 items
.push_back (SeparatorElem());
1433 items
.push_back (MenuElem (_("Adjust Latency..."), sigc::mem_fun (*this, &RouteUI::adjust_latency
)));
1435 items
.push_back (SeparatorElem());
1436 items
.push_back (CheckMenuElem (_("Protect Against Denormals"), sigc::mem_fun (*this, &RouteUI::toggle_denormal_protection
)));
1437 denormal_menu_item
= dynamic_cast<CheckMenuItem
*> (&items
.back());
1438 denormal_menu_item
->set_active (_route
->denormal_protection());
1440 if (!Profile
->get_sae()) {
1441 items
.push_back (SeparatorElem());
1442 items
.push_back (MenuElem (_("Remote Control ID..."), sigc::mem_fun (*this, &RouteUI::open_remote_control_id_dialog
)));
1445 items
.push_back (SeparatorElem());
1446 items
.push_back (MenuElem (_("Remove"), sigc::mem_fun(*this, &RouteUI::remove_this_route
)));
1450 MixerStrip::name_button_button_press (GdkEventButton
* ev
)
1452 if (ev
->button
== 3) {
1453 list_route_operations ();
1455 /* do not allow rename if the track is record-enabled */
1456 rename_menu_item
->set_sensitive (!_route
->record_enabled());
1457 route_ops_menu
->popup (1, ev
->time
);
1459 } else if (ev
->button
== 1) {
1460 revert_to_default_display ();
1467 MixerStrip::list_route_operations ()
1469 if (route_ops_menu
== 0) {
1470 build_route_ops_menu ();
1475 MixerStrip::set_selected (bool yn
)
1477 AxisView::set_selected (yn
);
1479 global_frame
.set_shadow_type (Gtk::SHADOW_ETCHED_OUT
);
1480 global_frame
.set_name ("MixerStripSelectedFrame");
1482 global_frame
.set_shadow_type (Gtk::SHADOW_IN
);
1483 global_frame
.set_name ("MixerStripFrame");
1485 global_frame
.queue_draw ();
1489 MixerStrip::name_changed ()
1493 RouteUI::property_changed (PropertyChange (ARDOUR::Properties::name
));
1496 name_label
.set_text (PBD::short_version (_route
->name(), 5));
1502 MixerStrip::width_clicked ()
1506 set_width_enum (Narrow
, this);
1509 set_width_enum (Wide
, this);
1515 MixerStrip::hide_clicked ()
1517 // LAME fix to reset the button status for when it is redisplayed (part 1)
1518 hide_button
.set_sensitive(false);
1521 Hiding(); /* EMIT_SIGNAL */
1523 _mixer
.hide_strip (this);
1527 hide_button
.set_sensitive(true);
1531 MixerStrip::set_embedded (bool yn
)
1537 MixerStrip::map_frozen ()
1539 ENSURE_GUI_THREAD (*this, &MixerStrip::map_frozen
)
1541 boost::shared_ptr
<AudioTrack
> at
= audio_track();
1544 switch (at
->freeze_state()) {
1545 case AudioTrack::Frozen
:
1546 processor_box
.set_sensitive (false);
1547 hide_redirect_editors ();
1550 processor_box
.set_sensitive (true);
1551 // XXX need some way, maybe, to retoggle redirect editors
1558 MixerStrip::hide_redirect_editors ()
1560 _route
->foreach_processor (sigc::mem_fun (*this, &MixerStrip::hide_processor_editor
));
1564 MixerStrip::hide_processor_editor (boost::weak_ptr
<Processor
> p
)
1566 boost::shared_ptr
<Processor
> processor (p
.lock ());
1571 Gtk::Window
* w
= processor_box
.get_processor_ui (processor
);
1579 MixerStrip::route_active_changed ()
1581 RouteUI::route_active_changed ();
1582 reset_strip_style ();
1586 MixerStrip::reset_strip_style ()
1588 if (_current_delivery
&& boost::dynamic_pointer_cast
<Send
>(_current_delivery
)) {
1590 gpm
.set_fader_name ("SendStripBase");
1594 if (is_midi_track()) {
1595 if (_route
->active()) {
1596 set_name ("MidiTrackStripBase");
1597 gpm
.set_meter_strip_name ("MidiTrackStripBase");
1599 set_name ("MidiTrackStripBaseInactive");
1600 gpm
.set_meter_strip_name ("MidiTrackStripBaseInactive");
1602 gpm
.set_fader_name ("MidiTrackFader");
1603 } else if (is_audio_track()) {
1604 if (_route
->active()) {
1605 set_name ("AudioTrackStripBase");
1606 gpm
.set_meter_strip_name ("AudioTrackMetrics");
1608 set_name ("AudioTrackStripBaseInactive");
1609 gpm
.set_meter_strip_name ("AudioTrackMetricsInactive");
1611 gpm
.set_fader_name ("AudioTrackFader");
1613 if (_route
->active()) {
1614 set_name ("AudioBusStripBase");
1615 gpm
.set_meter_strip_name ("AudioBusMetrics");
1617 set_name ("AudioBusStripBaseInactive");
1618 gpm
.set_meter_strip_name ("AudioBusMetricsInactive");
1620 gpm
.set_fader_name ("AudioBusFader");
1622 /* (no MIDI busses yet) */
1628 MixerStrip::route_group() const
1630 return _route
->route_group();
1634 MixerStrip::engine_stopped ()
1639 MixerStrip::engine_running ()
1643 /** Called when the metering point has changed */
1645 MixerStrip::meter_changed ()
1647 ENSURE_GUI_THREAD (*this, &MixerStrip::meter_changed
)
1649 switch (_route
->meter_point()) {
1651 meter_point_label
.set_text (_("input"));
1655 meter_point_label
.set_text (_("pre"));
1658 case MeterPostFader
:
1659 meter_point_label
.set_text (_("post"));
1663 meter_point_label
.set_text (_("custom"));
1667 gpm
.setup_meters ();
1668 // reset peak when meter point changes
1669 gpm
.reset_peak_display();
1673 MixerStrip::switch_io (boost::shared_ptr
<Route
> target
)
1675 /* don't respond to switch IO signal outside of the mixer window */
1677 if (!_mixer_owned
) {
1681 if (_route
== target
|| _route
->is_master()) {
1682 /* don't change the display for the target or the master bus */
1684 } else if (!is_track() && show_sends_button
) {
1685 /* make sure our show sends button is inactive, and we no longer blink,
1686 since we're not the target.
1688 send_blink_connection
.disconnect ();
1689 show_sends_button
->set_active (false);
1690 show_sends_button
->set_state (STATE_NORMAL
);
1694 /* switch back to default */
1695 revert_to_default_display ();
1699 boost::shared_ptr
<Send
> send
= _route
->internal_send_for (target
);
1704 revert_to_default_display ();
1709 MixerStrip::drop_send ()
1711 boost::shared_ptr
<Send
> current_send
;
1713 if (_current_delivery
&& (current_send
= boost::dynamic_pointer_cast
<Send
>(_current_delivery
))) {
1714 current_send
->set_metering (false);
1717 send_gone_connection
.disconnect ();
1718 input_button
.set_sensitive (true);
1719 output_button
.set_sensitive (true);
1723 MixerStrip::show_send (boost::shared_ptr
<Send
> send
)
1729 _current_delivery
= send
;
1731 send
->set_metering (true);
1732 _current_delivery
->DropReferences
.connect (send_gone_connection
, invalidator (*this), boost::bind (&MixerStrip::revert_to_default_display
, this), gui_context());
1734 gain_meter().set_controls (_route
, send
->meter(), send
->amp());
1735 gain_meter().setup_meters ();
1737 panner_ui().set_panner (_current_delivery
->panner());
1738 panner_ui().setup_pan ();
1740 input_button
.set_sensitive (false);
1742 if (boost::dynamic_pointer_cast
<InternalSend
>(send
)) {
1743 output_button
.set_sensitive (false);
1746 reset_strip_style ();
1750 MixerStrip::revert_to_default_display ()
1752 if (show_sends_button
) {
1753 show_sends_button
->set_active (false);
1758 _current_delivery
= _route
->main_outs();
1760 gain_meter().set_controls (_route
, _route
->shared_peak_meter(), _route
->amp());
1761 gain_meter().setup_meters ();
1763 panner_ui().set_panner (_route
->main_outs()->panner());
1764 panner_ui().setup_pan ();
1766 reset_strip_style ();
1770 MixerStrip::set_button_names ()
1774 rec_enable_button_label
.set_text (_("Rec"));
1775 mute_button_label
.set_text (_("Mute"));
1776 if (_route
&& _route
->solo_safe()) {
1777 solo_button_label
.set_text (X_("!"));
1779 if (!Config
->get_solo_control_is_listen_control()) {
1780 solo_button_label
.set_text (_("Solo"));
1782 switch (Config
->get_listen_position()) {
1783 case AfterFaderListen
:
1784 solo_button_label
.set_text (_("AFL"));
1786 case PreFaderListen
:
1787 solo_button_label
.set_text (_("PFL"));
1795 rec_enable_button_label
.set_text (_("R"));
1796 mute_button_label
.set_text (_("M"));
1797 if (_route
&& _route
->solo_safe()) {
1798 solo_button_label
.set_text (X_("!"));
1799 if (!Config
->get_solo_control_is_listen_control()) {
1800 solo_button_label
.set_text (_("S"));
1802 switch (Config
->get_listen_position()) {
1803 case AfterFaderListen
:
1804 solo_button_label
.set_text (_("A"));
1806 case PreFaderListen
:
1807 solo_button_label
.set_text (_("P"));
1818 MixerStrip::on_key_press_event (GdkEventKey
* ev
)
1820 GdkEventButton fake
;
1821 fake
.type
= GDK_BUTTON_PRESS
;
1823 fake
.state
= ev
->state
;
1825 switch (ev
->keyval
) {
1837 cerr
<< "Stole that r\n";
1838 rec_enable_press (&fake
);
1843 show_sends_press (&fake
);
1848 if (ev
->state
& Keyboard::PrimaryModifier
) {
1858 _route
->set_gain (1.0, this);
1871 MixerStrip::on_key_release_event (GdkEventKey
* ev
)
1873 GdkEventButton fake
;
1874 fake
.type
= GDK_BUTTON_RELEASE
;
1876 fake
.state
= ev
->state
;
1878 switch (ev
->keyval
) {
1880 mute_release (&fake
);
1885 solo_release (&fake
);
1890 cerr
<< "Stole that r\n";
1891 rec_enable_release (&fake
);
1896 show_sends_release (&fake
);
1912 MixerStrip::on_enter_notify_event (GdkEventCrossing
*)
1914 Keyboard::magic_widget_grab_focus ();
1916 if (!panners
._bar_spinner_active
) {
1917 /* This next grab_focus() causes a focus-out event to be sent to, amongst
1918 * other things, panner BarControllers. When they receive it, they abort
1919 * the use of any SpinButton that might be in use to change pan settings.
1920 * Hence we have this horrific hack which stops the grab_focus () call
1921 * happening if a bar spinner is active.
1929 MixerStrip::on_leave_notify_event (GdkEventCrossing
* ev
)
1931 switch (ev
->detail
) {
1932 case GDK_NOTIFY_INFERIOR
:
1935 Keyboard::magic_widget_drop_focus ();
1942 MixerStrip::mono_button_clicked ()
1944 panners
.set_mono (_mono_button
.get_active ());
1948 MixerStrip::plugin_selector()
1950 return _mixer
.plugin_selector();