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"
27 #include "pbd/stacktrace.h"
29 #include <gtkmm2ext/gtk_ui.h>
30 #include <gtkmm2ext/utils.h>
31 #include <gtkmm2ext/choice.h>
32 #include <gtkmm2ext/doi.h>
33 #include <gtkmm2ext/slider_controller.h>
34 #include <gtkmm2ext/bindable_button.h>
36 #include "ardour/ardour.h"
37 #include "ardour/amp.h"
38 #include "ardour/session.h"
39 #include "ardour/audioengine.h"
40 #include "ardour/internal_send.h"
41 #include "ardour/route.h"
42 #include "ardour/route_group.h"
43 #include "ardour/audio_track.h"
44 #include "ardour/midi_track.h"
45 #include "ardour/pannable.h"
46 #include "ardour/panner.h"
47 #include "ardour/panner_shell.h"
48 #include "ardour/send.h"
49 #include "ardour/processor.h"
50 #include "ardour/profile.h"
51 #include "ardour/ladspa_plugin.h"
52 #include "ardour/user_bundle.h"
53 #include "ardour/port.h"
55 #include "ardour_ui.h"
56 #include "ardour_dialog.h"
57 #include "mixer_strip.h"
60 #include "ardour_button.h"
61 #include "public_editor.h"
63 #include "io_selector.h"
65 #include "gui_thread.h"
66 #include "route_group_menu.h"
70 using namespace ARDOUR;
73 using namespace Gtkmm2ext;
76 int MixerStrip::scrollbar_height = 0;
77 PBD::Signal1<void,MixerStrip*> MixerStrip::CatchDeletion;
79 MixerStrip::MixerStrip (Mixer_UI& mx, Session* sess, bool in_mixer)
83 , _mixer_owned (in_mixer)
84 , processor_box (sess, boost::bind (&MixerStrip::plugin_selector, this), mx.selection(), this, in_mixer)
88 , rec_solo_table (2, 2)
89 , top_button_table (1, 2)
90 , middle_button_table (1, 2)
91 , bottom_button_table (1, 2)
92 , meter_point_label (_("pre"))
93 , midi_input_enable_button (0)
94 , _comment_button (_("Comments"))
95 , _visibility (X_("mixer-strip-visibility"))
100 /* the editor mixer strip: don't destroy it every time
101 the underlying route goes away.
104 self_destruct = false;
108 MixerStrip::MixerStrip (Mixer_UI& mx, Session* sess, boost::shared_ptr<Route> rt, bool in_mixer)
112 , _mixer_owned (in_mixer)
113 , processor_box (sess, sigc::mem_fun(*this, &MixerStrip::plugin_selector), mx.selection(), this, in_mixer)
116 , button_table (3, 1)
117 , middle_button_table (1, 2)
118 , bottom_button_table (1, 2)
119 , meter_point_label (_("pre"))
120 , midi_input_enable_button (0)
121 , _comment_button (_("Comments"))
122 , _visibility (X_("mixer-strip-visibility"))
135 ignore_comment_edit = false;
136 ignore_toggle = false;
142 /* the length of this string determines the width of the mixer strip when it is set to `wide' */
143 longest_label = "longest label";
147 img = manage (new Gtk::Image (::get_icon("strip_width")));
150 width_button.add (*img);
152 img = manage (new Gtk::Image (::get_icon("hide")));
155 hide_button.add (*img);
157 input_label.set_text (_("Input"));
158 ARDOUR_UI::instance()->set_tip (&input_button, _("Button 1 to choose inputs from a port matrix, button 3 to select inputs from a menu"), "");
159 input_button.add (input_label);
160 input_button.set_name ("MixerIOButton");
161 input_label.set_name ("MixerIOButtonLabel");
162 input_button_box.pack_start (input_button, true, true);
164 output_label.set_text (_("Output"));
165 ARDOUR_UI::instance()->set_tip (&output_button, _("Button 1 to choose outputs from a port matrix, button 3 to select inputs from a menu"), "");
166 output_button.add (output_label);
167 output_button.set_name ("MixerIOButton");
168 output_label.set_name ("MixerIOButtonLabel");
169 Gtkmm2ext::set_size_request_to_display_given_text (output_button, longest_label.c_str(), 4, 4);
171 ARDOUR_UI::instance()->set_tip (&meter_point_button, _("Select metering point"), "");
172 meter_point_button.add (meter_point_label);
173 meter_point_button.set_name ("MixerStripMeterPreButton");
174 meter_point_label.set_name ("MixerStripMeterPreButton");
176 /* TRANSLATORS: this string should be longest of the strings
177 used to describe meter points. In english, it's "input".
179 set_size_request_to_display_given_text (meter_point_button, _("tupni"), 5, 5);
181 bottom_button_table.attach (meter_point_button, 1, 2, 0, 1);
183 meter_point_button.signal_button_press_event().connect (sigc::mem_fun (gpm, &GainMeter::meter_press), false);
184 meter_point_button.signal_button_release_event().connect (sigc::mem_fun (gpm, &GainMeter::meter_release), false);
186 hide_button.set_events (hide_button.get_events() & ~(Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK));
188 monitor_input_button->set_diameter (3);
189 monitor_disk_button->set_diameter (3);
191 solo_isolated_led = manage (new ArdourButton (ArdourButton::led_default_elements));
192 solo_isolated_led->show ();
193 solo_isolated_led->set_diameter (3);
194 solo_isolated_led->set_no_show_all (true);
195 solo_isolated_led->set_name (X_("solo isolate"));
196 solo_isolated_led->add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
197 solo_isolated_led->signal_button_release_event().connect (sigc::mem_fun (*this, &RouteUI::solo_isolate_button_release));
198 UI::instance()->set_tip (solo_isolated_led, _("Isolate Solo"), "");
200 solo_safe_led = manage (new ArdourButton (ArdourButton::led_default_elements));
201 solo_safe_led->show ();
202 solo_safe_led->set_diameter (3);
203 solo_safe_led->set_no_show_all (true);
204 solo_safe_led->set_name (X_("solo safe"));
205 solo_safe_led->add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
206 solo_safe_led->signal_button_release_event().connect (sigc::mem_fun (*this, &RouteUI::solo_safe_button_release));
207 UI::instance()->set_tip (solo_safe_led, _("Lock Solo Status"), "");
209 solo_safe_led->set_text (_("lock"));
210 solo_isolated_led->set_text (_("iso"));
212 top_button_table.set_homogeneous (true);
213 top_button_table.set_spacings (2);
214 top_button_table.attach (*monitor_input_button, 0, 1, 0, 1);
215 top_button_table.attach (*monitor_disk_button, 1, 2, 0, 1);
216 top_button_table.show ();
218 rec_solo_table.set_homogeneous (false);
219 rec_solo_table.set_row_spacings (2);
220 rec_solo_table.set_col_spacings (2);
221 rec_solo_table.attach (*solo_isolated_led, 1, 2, 0, 1);
222 rec_solo_table.attach (*solo_safe_led, 1, 2, 1, 2);
223 rec_solo_table.show ();
225 button_table.set_homogeneous (false);
226 button_table.set_spacings (0);
228 button_table.attach (name_button, 0, 1, 0, 1);
229 button_table.attach (input_button_box, 0, 1, 1, 2);
230 button_table.attach (_invert_button_box, 0, 1, 2, 3);
232 middle_button_table.set_homogeneous (true);
233 middle_button_table.set_spacings (0);
234 middle_button_table.attach (*mute_button, 0, 1, 0, 1);
235 middle_button_table.attach (*solo_button, 1, 2, 0, 1);
237 bottom_button_table.set_col_spacings (0);
238 bottom_button_table.set_homogeneous (true);
239 bottom_button_table.attach (group_button, 0, 1, 0, 1);
241 name_button.add (name_label);
242 name_button.set_name ("MixerNameButton");
243 Gtkmm2ext::set_size_request_to_display_given_text (name_button, longest_label.c_str(), 2, 2);
245 name_label.set_name ("MixerNameButtonLabel");
246 ARDOUR_UI::instance()->set_tip (&group_button, _("Mix group"), "");
247 group_button.add (group_label);
248 group_button.set_name ("MixerGroupButton");
249 Gtkmm2ext::set_size_request_to_display_given_text (group_button, "Group", 2, 2);
250 group_label.set_name ("MixerGroupButtonLabel");
252 _comment_button.set_name (X_("MixerCommentButton"));
253 _comment_button.signal_clicked().connect (sigc::mem_fun (*this, &MixerStrip::toggle_comment));
255 global_vpacker.set_border_width (0);
256 global_vpacker.set_spacing (0);
258 width_button.set_name ("MixerWidthButton");
259 hide_button.set_name ("MixerHideButton");
260 top_event_box.set_name ("MixerTopEventBox");
262 width_button.signal_clicked().connect (sigc::mem_fun(*this, &MixerStrip::width_clicked));
263 hide_button.signal_clicked().connect (sigc::mem_fun(*this, &MixerStrip::hide_clicked));
265 width_hide_box.pack_start (width_button, false, true);
266 width_hide_box.pack_start (top_event_box, true, true);
267 width_hide_box.pack_end (hide_button, false, true);
269 whvbox.pack_start (width_hide_box, true, true);
271 global_vpacker.pack_start (whvbox, Gtk::PACK_SHRINK);
272 global_vpacker.pack_start (button_table, Gtk::PACK_SHRINK);
273 global_vpacker.pack_start (processor_box, true, true);
274 global_vpacker.pack_start (panners, Gtk::PACK_SHRINK);
275 global_vpacker.pack_start (top_button_table, Gtk::PACK_SHRINK, 2);
276 global_vpacker.pack_start (rec_solo_table, Gtk::PACK_SHRINK, 2);
277 global_vpacker.pack_start (middle_button_table, Gtk::PACK_SHRINK, 2);
278 global_vpacker.pack_start (gpm, Gtk::PACK_SHRINK);
279 global_vpacker.pack_start (bottom_button_table, Gtk::PACK_SHRINK);
280 global_vpacker.pack_start (output_button, Gtk::PACK_SHRINK);
281 global_vpacker.pack_start (_comment_button, Gtk::PACK_SHRINK);
283 global_frame.add (global_vpacker);
284 global_frame.set_shadow_type (Gtk::SHADOW_IN);
285 global_frame.set_name ("BaseFrame");
289 /* force setting of visible selected status */
292 set_selected (false);
297 _session->engine().Stopped.connect (*this, invalidator (*this), boost::bind (&MixerStrip::engine_stopped, this), gui_context());
298 _session->engine().Running.connect (*this, invalidator (*this), boost::bind (&MixerStrip::engine_running, this), gui_context());
300 input_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MixerStrip::input_press), false);
301 output_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MixerStrip::output_press), false);
303 /* ditto for this button and busses */
305 name_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MixerStrip::name_button_button_press), false);
306 group_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MixerStrip::select_route_group), false);
310 /* start off as a passthru strip. we'll correct this, if necessary,
311 in update_diskstream_display().
314 /* start off as a passthru strip. we'll correct this, if necessary,
315 in update_diskstream_display().
318 if (is_midi_track()) {
319 set_name ("MidiTrackStripBase");
321 set_name ("AudioTrackStripBase");
324 add_events (Gdk::BUTTON_RELEASE_MASK|
325 Gdk::ENTER_NOTIFY_MASK|
326 Gdk::LEAVE_NOTIFY_MASK|
328 Gdk::KEY_RELEASE_MASK);
330 set_flags (get_flags() | Gtk::CAN_FOCUS);
332 AudioEngine::instance()->PortConnectedOrDisconnected.connect (
333 *this, invalidator (*this), boost::bind (&MixerStrip::port_connected_or_disconnected, this, _1, _3), gui_context ()
336 /* Add the widgets under visibility control to the VisibilityGroup; the names used here
337 must be the same as those used in RCOptionEditor so that the configuration changes
338 are recognised when they occur.
340 _visibility.add (&_invert_button_box, X_("PhaseInvert"), _("Phase Invert"));
341 _visibility.add (solo_safe_led, X_("SoloSafe"), _("Solo Safe"), true, boost::bind (&MixerStrip::override_solo_visibility, this));
342 _visibility.add (solo_isolated_led, X_("SoloIsolated"), _("Solo Isolated"), true, boost::bind (&MixerStrip::override_solo_visibility, this));
343 _visibility.add (&_comment_button, X_("Comments"), _("Comments"));
344 _visibility.add (&group_button, X_("Group"), _("Group"));
345 _visibility.add (&meter_point_button, X_("MeterPoint"), _("Meter Point"));
347 parameter_changed (X_("mixer-strip-visibility"));
349 Config->ParameterChanged.connect (_config_connection, MISSING_INVALIDATOR, ui_bind (&MixerStrip::parameter_changed, this, _1), gui_context());
352 MixerStrip::~MixerStrip ()
354 CatchDeletion (this);
356 delete input_selector;
357 delete output_selector;
358 delete comment_window;
362 MixerStrip::set_route (boost::shared_ptr<Route> rt)
364 if (rec_enable_button->get_parent()) {
365 rec_solo_table.remove (*rec_enable_button);
368 if (show_sends_button->get_parent()) {
369 rec_solo_table.remove (*show_sends_button);
372 processor_box.set_route (rt);
374 RouteUI::set_route (rt);
376 /* map the current state */
379 update_solo_display ();
381 delete input_selector;
384 delete output_selector;
387 revert_to_default_display ();
389 if (route()->is_master()) {
390 solo_button->hide ();
391 rec_solo_table.hide ();
393 solo_button->show ();
394 rec_solo_table.show ();
397 if (_mixer_owned && (route()->is_master() || route()->is_monitor())) {
399 if (scrollbar_height == 0) {
400 HScrollbar scrollbar;
401 Gtk::Requisition requisition(scrollbar.size_request ());
402 scrollbar_height = requisition.height;
405 spacer = manage (new EventBox);
406 spacer->set_size_request (-1, scrollbar_height);
407 global_vpacker.pack_start (*spacer, false, false);
411 monitor_input_button->show ();
412 monitor_disk_button->show ();
414 monitor_input_button->hide();
415 monitor_disk_button->hide ();
418 if (is_midi_track()) {
419 if (midi_input_enable_button == 0) {
420 Image* img = manage (new Image (get_icon (X_("midi_socket_small"))));
421 midi_input_enable_button = manage (new StatefulToggleButton);
422 midi_input_enable_button->set_name ("MixerMidiInputEnableButton");
423 midi_input_enable_button->set_image (*img);
424 midi_input_enable_button->signal_button_press_event().connect (sigc::mem_fun (*this, &MixerStrip::input_active_button_press), false);
425 midi_input_enable_button->signal_button_release_event().connect (sigc::mem_fun (*this, &MixerStrip::input_active_button_release), false);
426 ARDOUR_UI::instance()->set_tip (midi_input_enable_button, _("Enable/Disable MIDI input"));
428 input_button_box.remove (*midi_input_enable_button);
430 /* get current state */
431 midi_input_status_changed ();
432 input_button_box.pack_start (*midi_input_enable_button, false, false);
434 midi_track()->InputActiveChanged.connect (route_connections, invalidator (*this), boost::bind (&MixerStrip::midi_input_status_changed, this), gui_context());
436 if (midi_input_enable_button) {
437 /* removal from the container will delete it */
438 input_button_box.remove (*midi_input_enable_button);
439 midi_input_enable_button = 0;
443 if (is_audio_track()) {
444 boost::shared_ptr<AudioTrack> at = audio_track();
445 at->FreezeChange.connect (route_connections, invalidator (*this), boost::bind (&MixerStrip::map_frozen, this), gui_context());
448 if (has_audio_outputs ()) {
456 rec_solo_table.attach (*rec_enable_button, 0, 1, 0, 2);
457 rec_enable_button->set_sensitive (_session->writable());
458 rec_enable_button->show();
464 if (!_route->is_master()) {
465 rec_solo_table.attach (*show_sends_button, 0, 1, 0, 2);
466 show_sends_button->show();
470 meter_point_label.set_text (meter_point_string (_route->meter_point()));
472 delete route_ops_menu;
475 _route->meter_change.connect (route_connections, invalidator (*this), bind (&MixerStrip::meter_changed, this), gui_context());
476 _route->route_group_changed.connect (route_connections, invalidator (*this), boost::bind (&MixerStrip::route_group_changed, this), gui_context());
478 if (_route->panner_shell()) {
479 _route->panner_shell()->Changed.connect (route_connections, invalidator (*this), boost::bind (&MixerStrip::connect_to_pan, this), gui_context());
482 if (is_audio_track()) {
483 audio_track()->DiskstreamChanged.connect (route_connections, invalidator (*this), boost::bind (&MixerStrip::diskstream_changed, this), gui_context());
486 _route->comment_changed.connect (route_connections, invalidator (*this), ui_bind (&MixerStrip::comment_changed, this, _1), gui_context());
488 set_stuff_from_route ();
490 /* now force an update of all the various elements */
493 update_solo_display ();
496 route_group_changed ();
499 panners.setup_pan ();
501 update_diskstream_display ();
502 update_input_display ();
503 update_output_display ();
505 add_events (Gdk::BUTTON_RELEASE_MASK);
507 processor_box.show ();
509 if (!route()->is_master() && !route()->is_monitor()) {
510 /* we don't allow master or control routes to be hidden */
515 width_hide_box.show();
518 global_vpacker.show();
520 middle_button_table.show();
521 bottom_button_table.show();
523 gain_unit_button.show();
524 gain_unit_label.show();
525 meter_point_button.show();
526 meter_point_label.show();
527 diskstream_button.show();
528 diskstream_label.show();
529 input_button_box.show_all();
530 output_button.show();
534 _comment_button.show();
538 parameter_changed ("mixer-strip-visibility");
544 MixerStrip::set_stuff_from_route ()
546 /* if width is not set, it will be set by the MixerUI or editor */
548 string str = gui_property ("strip-width");
550 set_width_enum (Width (string_2_enum (str, _width)), this);
555 MixerStrip::set_width_enum (Width w, void* owner)
557 /* always set the gpm width again, things may be hidden */
560 panners.set_width (w);
562 boost::shared_ptr<AutomationList> gain_automation = _route->gain_control()->alist();
564 _width_owner = owner;
568 if (_width_owner == this) {
569 set_gui_property ("strip-width", enum_2_string (_width));
576 if (show_sends_button) {
577 show_sends_button->set_text (_("Sends"));
580 ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (
581 gpm.astyle_string(gain_automation->automation_style()));
582 ((Gtk::Label*)gpm.gain_automation_state_button.get_child())->set_text (
583 gpm.astate_string(gain_automation->automation_state()));
585 if (_route->panner()) {
586 ((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text (
587 panners.astyle_string(_route->panner()->automation_style()));
588 ((Gtk::Label*)panners.pan_automation_state_button.get_child())->set_text (
589 panners.astate_string(_route->panner()->automation_state()));
592 solo_isolated_led->set_text (_("iso"));
593 solo_safe_led->set_text (_("lock"));
595 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "long", 2, 2);
596 set_size_request (-1, -1);
600 if (show_sends_button) {
601 show_sends_button->set_text (_("Snd"));
604 ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (
605 gpm.short_astyle_string(gain_automation->automation_style()));
606 ((Gtk::Label*)gpm.gain_automation_state_button.get_child())->set_text (
607 gpm.short_astate_string(gain_automation->automation_state()));
609 if (_route->panner()) {
610 ((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text (
611 panners.short_astyle_string(_route->panner()->automation_style()));
612 ((Gtk::Label*)panners.pan_automation_state_button.get_child())->set_text (
613 panners.short_astate_string(_route->panner()->automation_state()));
616 solo_isolated_led->set_text ("");
617 solo_safe_led->set_text ("");
619 Gtkmm2ext::set_size_request_to_display_given_text (name_button, longest_label.c_str(), 2, 2);
620 set_size_request (max (50, gpm.get_gm_width()), -1);
624 processor_box.set_width (w);
626 update_input_display ();
627 update_output_display ();
628 setup_comment_button ();
629 route_group_changed ();
635 MixerStrip::set_packed (bool yn)
640 set_gui_property ("visible", true);
642 set_gui_property ("visible", false);
647 struct RouteCompareByName {
648 bool operator() (boost::shared_ptr<Route> a, boost::shared_ptr<Route> b) {
649 return a->name().compare (b->name()) < 0;
654 MixerStrip::output_press (GdkEventButton *ev)
656 using namespace Menu_Helpers;
657 if (!_session->engine().connected()) {
658 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
663 MenuList& citems = output_menu.items();
664 switch (ev->button) {
667 edit_output_configuration ();
672 output_menu.set_name ("ArdourContextMenu");
674 output_menu_bundles.clear ();
676 citems.push_back (MenuElem (_("Disconnect"), sigc::mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_output)));
678 for (DataType::iterator i = DataType::begin(); i != DataType::end(); ++i) {
681 string_compose ("Add %1 port", (*i).to_i18n_string()),
682 sigc::bind (sigc::mem_fun (*this, &MixerStrip::add_output_port), *i)
687 citems.push_back (SeparatorElem());
689 ARDOUR::BundleList current = _route->output()->bundles_connected ();
691 boost::shared_ptr<ARDOUR::BundleList> b = _session->bundles ();
693 /* give user bundles first chance at being in the menu */
695 for (ARDOUR::BundleList::iterator i = b->begin(); i != b->end(); ++i) {
696 if (boost::dynamic_pointer_cast<UserBundle> (*i)) {
697 maybe_add_bundle_to_output_menu (*i, current);
701 for (ARDOUR::BundleList::iterator i = b->begin(); i != b->end(); ++i) {
702 if (boost::dynamic_pointer_cast<UserBundle> (*i) == 0) {
703 maybe_add_bundle_to_output_menu (*i, current);
707 boost::shared_ptr<ARDOUR::RouteList> routes = _session->get_routes ();
708 RouteList copy = *routes;
709 copy.sort (RouteCompareByName ());
710 for (ARDOUR::RouteList::const_iterator i = copy.begin(); i != copy.end(); ++i) {
711 maybe_add_bundle_to_output_menu ((*i)->input()->bundle(), current);
714 if (citems.size() == 2) {
715 /* no routes added; remove the separator */
719 output_menu.popup (1, ev->time);
730 MixerStrip::edit_output_configuration ()
732 if (output_selector == 0) {
734 boost::shared_ptr<Send> send;
735 boost::shared_ptr<IO> output;
737 if ((send = boost::dynamic_pointer_cast<Send>(_current_delivery)) != 0) {
738 if (!boost::dynamic_pointer_cast<InternalSend>(send)) {
739 output = send->output();
741 output = _route->output ();
744 output = _route->output ();
747 output_selector = new IOSelectorWindow (_session, output);
750 if (output_selector->is_visible()) {
751 output_selector->get_toplevel()->get_window()->raise();
753 output_selector->present ();
758 MixerStrip::edit_input_configuration ()
760 if (input_selector == 0) {
761 input_selector = new IOSelectorWindow (_session, _route->input());
764 if (input_selector->is_visible()) {
765 input_selector->get_toplevel()->get_window()->raise();
767 input_selector->present ();
772 MixerStrip::input_press (GdkEventButton *ev)
774 using namespace Menu_Helpers;
776 MenuList& citems = input_menu.items();
777 input_menu.set_name ("ArdourContextMenu");
780 if (!_session->engine().connected()) {
781 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
786 if (_session->actively_recording() && _route->record_enabled())
789 switch (ev->button) {
792 edit_input_configuration ();
797 citems.push_back (MenuElem (_("Disconnect"), sigc::mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_input)));
799 for (DataType::iterator i = DataType::begin(); i != DataType::end(); ++i) {
802 string_compose ("Add %1 port", (*i).to_i18n_string()),
803 sigc::bind (sigc::mem_fun (*this, &MixerStrip::add_input_port), *i)
808 citems.push_back (SeparatorElem());
809 input_menu_bundles.clear ();
811 ARDOUR::BundleList current = _route->input()->bundles_connected ();
813 boost::shared_ptr<ARDOUR::BundleList> b = _session->bundles ();
815 /* give user bundles first chance at being in the menu */
817 for (ARDOUR::BundleList::iterator i = b->begin(); i != b->end(); ++i) {
818 if (boost::dynamic_pointer_cast<UserBundle> (*i)) {
819 maybe_add_bundle_to_input_menu (*i, current);
823 for (ARDOUR::BundleList::iterator i = b->begin(); i != b->end(); ++i) {
824 if (boost::dynamic_pointer_cast<UserBundle> (*i) == 0) {
825 maybe_add_bundle_to_input_menu (*i, current);
829 boost::shared_ptr<ARDOUR::RouteList> routes = _session->get_routes ();
830 RouteList copy = *routes;
831 copy.sort (RouteCompareByName ());
832 for (ARDOUR::RouteList::const_iterator i = copy.begin(); i != copy.end(); ++i) {
833 maybe_add_bundle_to_input_menu ((*i)->output()->bundle(), current);
836 if (citems.size() == 2) {
837 /* no routes added; remove the separator */
841 input_menu.popup (1, ev->time);
851 MixerStrip::bundle_input_toggled (boost::shared_ptr<ARDOUR::Bundle> c)
857 ARDOUR::BundleList current = _route->input()->bundles_connected ();
859 if (std::find (current.begin(), current.end(), c) == current.end()) {
860 _route->input()->connect_ports_to_bundle (c, this);
862 _route->input()->disconnect_ports_from_bundle (c, this);
867 MixerStrip::bundle_output_toggled (boost::shared_ptr<ARDOUR::Bundle> c)
873 ARDOUR::BundleList current = _route->output()->bundles_connected ();
875 if (std::find (current.begin(), current.end(), c) == current.end()) {
876 _route->output()->connect_ports_to_bundle (c, this);
878 _route->output()->disconnect_ports_from_bundle (c, this);
883 MixerStrip::maybe_add_bundle_to_input_menu (boost::shared_ptr<Bundle> b, ARDOUR::BundleList const & current)
885 using namespace Menu_Helpers;
887 if (b->ports_are_outputs() == false || b->nchannels() != _route->n_inputs()) {
891 list<boost::shared_ptr<Bundle> >::iterator i = input_menu_bundles.begin ();
892 while (i != input_menu_bundles.end() && b->has_same_ports (*i) == false) {
896 if (i != input_menu_bundles.end()) {
900 input_menu_bundles.push_back (b);
902 MenuList& citems = input_menu.items();
904 std::string n = b->name ();
905 replace_all (n, "_", " ");
907 citems.push_back (CheckMenuElem (n, sigc::bind (sigc::mem_fun(*this, &MixerStrip::bundle_input_toggled), b)));
909 if (std::find (current.begin(), current.end(), b) != current.end()) {
910 ignore_toggle = true;
911 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
912 ignore_toggle = false;
917 MixerStrip::maybe_add_bundle_to_output_menu (boost::shared_ptr<Bundle> b, ARDOUR::BundleList const & current)
919 using namespace Menu_Helpers;
921 if (b->ports_are_inputs() == false || b->nchannels() != _route->n_outputs()) {
925 list<boost::shared_ptr<Bundle> >::iterator i = output_menu_bundles.begin ();
926 while (i != output_menu_bundles.end() && b->has_same_ports (*i) == false) {
930 if (i != output_menu_bundles.end()) {
934 output_menu_bundles.push_back (b);
936 MenuList& citems = output_menu.items();
938 std::string n = b->name ();
939 replace_all (n, "_", " ");
941 citems.push_back (CheckMenuElem (n, sigc::bind (sigc::mem_fun(*this, &MixerStrip::bundle_output_toggled), b)));
943 if (std::find (current.begin(), current.end(), b) != current.end()) {
944 ignore_toggle = true;
945 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
946 ignore_toggle = false;
951 MixerStrip::update_diskstream_display ()
955 if (input_selector) {
956 input_selector->hide_all ();
959 route_color_changed ();
963 show_passthru_color ();
968 MixerStrip::connect_to_pan ()
970 ENSURE_GUI_THREAD (*this, &MixerStrip::connect_to_pan)
972 panstate_connection.disconnect ();
973 panstyle_connection.disconnect ();
975 if (!_route->panner()) {
979 boost::shared_ptr<Pannable> p = _route->pannable ();
981 p->automation_state_changed.connect (panstate_connection, invalidator (*this), boost::bind (&PannerUI::pan_automation_state_changed, &panners), gui_context());
982 p->automation_style_changed.connect (panstyle_connection, invalidator (*this), boost::bind (&PannerUI::pan_automation_style_changed, &panners), gui_context());
984 panners.panshell_changed ();
989 * Output port labelling
990 * =====================
992 * Case 1: Each output has one connection, all connections are to system:playback_%i
993 * out 1 -> system:playback_1
994 * out 2 -> system:playback_2
995 * out 3 -> system:playback_3
998 * Case 2: Each output has one connection, all connections are to ardour:track_x/in 1
999 * out 1 -> ardour:track_x/in 1
1000 * out 2 -> ardour:track_x/in 2
1001 * Display as: track_x
1003 * Case 3: Each output has one connection, all connections are to Jack client "program x"
1004 * out 1 -> program x:foo
1005 * out 2 -> program x:foo
1006 * Display as: program x
1008 * Case 4: No connections (Disconnected)
1011 * Default case (unusual routing):
1012 * Display as: *number of connections*
1016 * .-----------------------------------------------.
1018 * | out 1 -> ardour:master/in 1, jamin:input/in 1 |
1019 * | out 2 -> ardour:master/in 2, jamin:input/in 2 |
1020 * '-----------------------------------------------'
1021 * .-----------------------------------------------.
1024 * '-----------------------------------------------'
1028 MixerStrip::update_io_button (boost::shared_ptr<ARDOUR::Route> route, Width width, bool for_input)
1032 boost::shared_ptr<Port> port;
1033 vector<string> port_connections;
1035 uint32_t total_connection_count = 0;
1036 uint32_t io_connection_count = 0;
1037 uint32_t ardour_connection_count = 0;
1038 uint32_t system_connection_count = 0;
1039 uint32_t other_connection_count = 0;
1041 ostringstream label;
1042 string label_string;
1044 bool have_label = false;
1045 bool each_io_has_one_connection = true;
1047 string connection_name;
1048 string ardour_track_name;
1049 string other_connection_type;
1050 string system_ports;
1053 ostringstream tooltip;
1054 char * tooltip_cstr;
1056 tooltip << route->name();
1059 io_count = route->n_inputs().n_total();
1061 io_count = route->n_outputs().n_total();
1064 for (io_index = 0; io_index < io_count; ++io_index) {
1066 port = route->input()->nth (io_index);
1068 port = route->output()->nth (io_index);
1071 port_connections.clear ();
1072 port->get_connections(port_connections);
1073 io_connection_count = 0;
1075 if (!port_connections.empty()) {
1076 for (vector<string>::iterator i = port_connections.begin(); i != port_connections.end(); ++i) {
1077 string& connection_name (*i);
1079 if (io_connection_count == 0) {
1080 tooltip << endl << port->name().substr(port->name().find("/") + 1) << " -> " << connection_name;
1082 tooltip << ", " << connection_name;
1085 if (connection_name.find("ardour:") == 0) {
1086 if (ardour_track_name.empty()) {
1087 // "ardour:Master/in 1" -> "ardour:Master/"
1088 string::size_type slash = connection_name.find("/");
1089 if (slash != string::npos) {
1090 ardour_track_name = connection_name.substr(0, slash + 1);
1094 if (connection_name.find(ardour_track_name) == 0) {
1095 ++ardour_connection_count;
1097 } else if (connection_name.find("system:") == 0) {
1099 // "system:capture_123" -> "123"
1100 system_port = connection_name.substr(15);
1102 // "system:playback_123" -> "123"
1103 system_port = connection_name.substr(16);
1106 if (system_ports.empty()) {
1107 system_ports += system_port;
1109 system_ports += "/" + system_port;
1112 ++system_connection_count;
1114 if (other_connection_type.empty()) {
1115 // "jamin:in 1" -> "jamin:"
1116 other_connection_type = connection_name.substr(0, connection_name.find(":") + 1);
1119 if (connection_name.find(other_connection_type) == 0) {
1120 ++other_connection_count;
1124 ++total_connection_count;
1125 ++io_connection_count;
1129 if (io_connection_count != 1) {
1130 each_io_has_one_connection = false;
1134 if (total_connection_count == 0) {
1135 tooltip << endl << _("Disconnected");
1138 tooltip_cstr = new char[tooltip.str().size() + 1];
1139 strcpy(tooltip_cstr, tooltip.str().c_str());
1142 ARDOUR_UI::instance()->set_tip (&input_button, tooltip_cstr, "");
1144 ARDOUR_UI::instance()->set_tip (&output_button, tooltip_cstr, "");
1147 if (each_io_has_one_connection) {
1148 if ((total_connection_count == ardour_connection_count)) {
1149 // all connections are to the same track in ardour
1150 // "ardour:Master/" -> "Master"
1151 string::size_type slash = ardour_track_name.find("/");
1152 if (slash != string::npos) {
1153 label << ardour_track_name.substr(7, slash - 7);
1157 else if (total_connection_count == system_connection_count) {
1158 // all connections are to system ports
1159 label << system_ports;
1162 else if (total_connection_count == other_connection_count) {
1163 // all connections are to the same external program eg jamin
1164 // "jamin:" -> "jamin"
1165 label << other_connection_type.substr(0, other_connection_type.size() - 1);
1171 if (total_connection_count == 0) {
1175 // Odd configuration
1176 label << "*" << total_connection_count << "*";
1182 label_string = label.str().substr(0, 6);
1185 label_string = label.str().substr(0, 3);
1190 input_label.set_text (label_string);
1192 output_label.set_text (label_string);
1197 MixerStrip::update_input_display ()
1199 update_io_button (_route, _width, true);
1200 panners.setup_pan ();
1204 MixerStrip::update_output_display ()
1206 update_io_button (_route, _width, false);
1207 gpm.setup_meters ();
1208 panners.setup_pan ();
1212 MixerStrip::fast_update ()
1214 gpm.update_meters ();
1218 MixerStrip::diskstream_changed ()
1220 Gtkmm2ext::UI::instance()->call_slot (invalidator (*this), boost::bind (&MixerStrip::update_diskstream_display, this));
1224 MixerStrip::port_connected_or_disconnected (boost::weak_ptr<Port> wa, boost::weak_ptr<Port> wb)
1226 boost::shared_ptr<Port> a = wa.lock ();
1227 boost::shared_ptr<Port> b = wb.lock ();
1229 if ((a && _route->input()->has_port (a)) || (b && _route->input()->has_port (b))) {
1230 update_input_display ();
1231 set_width_enum (_width, this);
1234 if ((a && _route->output()->has_port (a)) || (b && _route->output()->has_port (b))) {
1235 update_output_display ();
1236 set_width_enum (_width, this);
1241 MixerStrip::setup_comment_button ()
1246 if (_route->comment().empty ()) {
1247 _comment_button.unset_bg (STATE_NORMAL);
1248 ((Gtk::Label *) _comment_button.get_child ())->set_text (_("Comments"));
1250 _comment_button.modify_bg (STATE_NORMAL, color ());
1251 ((Gtk::Label *) _comment_button.get_child ())->set_text (_("*Comments*"));
1256 if (_route->comment().empty ()) {
1257 _comment_button.unset_bg (STATE_NORMAL);
1258 ((Gtk::Label *) _comment_button.get_child ())->set_text (_("Cmt"));
1260 _comment_button.modify_bg (STATE_NORMAL, color ());
1261 ((Gtk::Label *) _comment_button.get_child ())->set_text (_("*Cmt*"));
1266 ARDOUR_UI::instance()->set_tip (
1267 _comment_button, _route->comment().empty() ? _("Click to Add/Edit Comments") : _route->comment()
1272 MixerStrip::comment_editor_done_editing ()
1274 string const str = comment_area->get_buffer()->get_text();
1275 if (str == _route->comment ()) {
1279 _route->set_comment (str, this);
1280 setup_comment_button ();
1284 MixerStrip::toggle_comment ()
1286 if (ignore_toggle) {
1290 if (comment_window == 0) {
1291 setup_comment_editor ();
1294 if (comment_window->is_visible ()) {
1295 comment_window->hide ();
1300 title = _route->name();
1301 title += _(": comment editor");
1303 comment_window->set_title (title);
1304 comment_window->present();
1308 MixerStrip::setup_comment_editor ()
1310 comment_window = new ArdourDialog ("", false); // title will be reset to show route
1311 comment_window->set_position (Gtk::WIN_POS_MOUSE);
1312 comment_window->set_skip_taskbar_hint (true);
1313 comment_window->signal_hide().connect (sigc::mem_fun(*this, &MixerStrip::comment_editor_done_editing));
1314 comment_window->set_default_size (400, 200);
1316 comment_area = manage (new TextView());
1317 comment_area->set_name ("MixerTrackCommentArea");
1318 comment_area->set_wrap_mode (WRAP_WORD);
1319 comment_area->set_editable (true);
1320 comment_area->get_buffer()->set_text (_route->comment());
1321 comment_area->show ();
1323 comment_window->get_vbox()->pack_start (*comment_area);
1324 comment_window->get_action_area()->hide();
1328 MixerStrip::comment_changed (void *src)
1330 ENSURE_GUI_THREAD (*this, &MixerStrip::comment_changed, src)
1333 ignore_comment_edit = true;
1335 comment_area->get_buffer()->set_text (_route->comment());
1337 ignore_comment_edit = false;
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);
1360 r.push_back (route ());
1361 group_menu->build (r);
1362 group_menu->menu()->popup (1, ev->time);
1369 MixerStrip::route_group_changed ()
1371 ENSURE_GUI_THREAD (*this, &MixerStrip::route_group_changed)
1373 RouteGroup *rg = _route->route_group();
1376 group_label.set_text (PBD::short_version (rg->name(), 5));
1380 group_label.set_text (_("Grp"));
1383 group_label.set_text (_("~G"));
1390 MixerStrip::route_color_changed ()
1392 name_button.modify_bg (STATE_NORMAL, color());
1393 top_event_box.modify_bg (STATE_NORMAL, color());
1394 reset_strip_style ();
1398 MixerStrip::show_passthru_color ()
1400 reset_strip_style ();
1404 MixerStrip::build_route_ops_menu ()
1406 using namespace Menu_Helpers;
1407 route_ops_menu = new Menu;
1408 route_ops_menu->set_name ("ArdourContextMenu");
1410 MenuList& items = route_ops_menu->items();
1412 items.push_back (CheckMenuElem (_("Comments..."), sigc::mem_fun (*this, &MixerStrip::toggle_comment)));
1413 CheckMenuItem* i = dynamic_cast<CheckMenuItem*> (&items.back ());
1414 i->set_active (comment_window && comment_window->is_visible ());
1415 items.push_back (MenuElem (_("Save As Template..."), sigc::mem_fun(*this, &RouteUI::save_as_template)));
1416 items.push_back (MenuElem (_("Rename..."), sigc::mem_fun(*this, &RouteUI::route_rename)));
1417 rename_menu_item = &items.back();
1419 items.push_back (SeparatorElem());
1420 items.push_back (CheckMenuElem (_("Active")));
1421 i = dynamic_cast<CheckMenuItem *> (&items.back());
1422 i->set_active (_route->active());
1423 i->signal_activate().connect (sigc::bind (sigc::mem_fun (*this, &RouteUI::set_route_active), !_route->active(), false));
1425 items.push_back (SeparatorElem());
1427 items.push_back (MenuElem (_("Adjust Latency..."), sigc::mem_fun (*this, &RouteUI::adjust_latency)));
1429 items.push_back (SeparatorElem());
1430 items.push_back (CheckMenuElem (_("Protect Against Denormals"), sigc::mem_fun (*this, &RouteUI::toggle_denormal_protection)));
1431 denormal_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
1432 denormal_menu_item->set_active (_route->denormal_protection());
1434 if (!Profile->get_sae()) {
1435 items.push_back (SeparatorElem());
1436 items.push_back (MenuElem (_("Remote Control ID..."), sigc::mem_fun (*this, &RouteUI::open_remote_control_id_dialog)));
1439 items.push_back (SeparatorElem());
1440 items.push_back (MenuElem (_("Remove"), sigc::bind (sigc::mem_fun(*this, &RouteUI::remove_this_route), false)));
1444 MixerStrip::name_button_button_press (GdkEventButton* ev)
1446 if (ev->button == 3) {
1447 list_route_operations ();
1449 /* do not allow rename if the track is record-enabled */
1450 rename_menu_item->set_sensitive (!_route->record_enabled());
1451 route_ops_menu->popup (1, ev->time);
1453 } else if (ev->button == 1) {
1454 revert_to_default_display ();
1461 MixerStrip::list_route_operations ()
1463 delete route_ops_menu;
1464 build_route_ops_menu ();
1468 MixerStrip::set_selected (bool yn)
1470 AxisView::set_selected (yn);
1472 global_frame.set_shadow_type (Gtk::SHADOW_ETCHED_OUT);
1473 global_frame.set_name ("MixerStripSelectedFrame");
1475 global_frame.set_shadow_type (Gtk::SHADOW_IN);
1476 global_frame.set_name ("MixerStripFrame");
1478 global_frame.queue_draw ();
1482 MixerStrip::name_changed ()
1486 RouteUI::property_changed (PropertyChange (ARDOUR::Properties::name));
1489 name_label.set_text (PBD::short_version (_route->name(), 5));
1495 MixerStrip::width_clicked ()
1499 set_width_enum (Narrow, this);
1502 set_width_enum (Wide, this);
1508 MixerStrip::hide_clicked ()
1510 // LAME fix to reset the button status for when it is redisplayed (part 1)
1511 hide_button.set_sensitive(false);
1514 Hiding(); /* EMIT_SIGNAL */
1516 _mixer.hide_strip (this);
1520 hide_button.set_sensitive(true);
1524 MixerStrip::set_embedded (bool yn)
1530 MixerStrip::map_frozen ()
1532 ENSURE_GUI_THREAD (*this, &MixerStrip::map_frozen)
1534 boost::shared_ptr<AudioTrack> at = audio_track();
1537 switch (at->freeze_state()) {
1538 case AudioTrack::Frozen:
1539 processor_box.set_sensitive (false);
1540 hide_redirect_editors ();
1543 processor_box.set_sensitive (true);
1544 // XXX need some way, maybe, to retoggle redirect editors
1551 MixerStrip::hide_redirect_editors ()
1553 _route->foreach_processor (sigc::mem_fun (*this, &MixerStrip::hide_processor_editor));
1557 MixerStrip::hide_processor_editor (boost::weak_ptr<Processor> p)
1559 boost::shared_ptr<Processor> processor (p.lock ());
1564 Gtk::Window* w = processor_box.get_processor_ui (processor);
1572 MixerStrip::reset_strip_style ()
1574 if (_current_delivery && boost::dynamic_pointer_cast<Send>(_current_delivery)) {
1576 gpm.set_fader_name ("SendStripBase");
1580 if (is_midi_track()) {
1581 if (_route->active()) {
1582 set_name ("MidiTrackStripBase");
1583 gpm.set_meter_strip_name ("MidiTrackMetrics");
1585 set_name ("MidiTrackStripBaseInactive");
1586 gpm.set_meter_strip_name ("MidiTrackMetricsInactive");
1588 gpm.set_fader_name ("MidiTrackFader");
1589 } else if (is_audio_track()) {
1590 if (_route->active()) {
1591 set_name ("AudioTrackStripBase");
1592 gpm.set_meter_strip_name ("AudioTrackMetrics");
1594 set_name ("AudioTrackStripBaseInactive");
1595 gpm.set_meter_strip_name ("AudioTrackMetricsInactive");
1597 gpm.set_fader_name ("AudioTrackFader");
1599 if (_route->active()) {
1600 set_name ("AudioBusStripBase");
1601 gpm.set_meter_strip_name ("AudioBusMetrics");
1603 set_name ("AudioBusStripBaseInactive");
1604 gpm.set_meter_strip_name ("AudioBusMetricsInactive");
1606 gpm.set_fader_name ("AudioBusFader");
1608 /* (no MIDI busses yet) */
1614 MixerStrip::route_group() const
1616 return _route->route_group();
1620 MixerStrip::engine_stopped ()
1625 MixerStrip::engine_running ()
1630 MixerStrip::meter_point_string (MeterPoint mp)
1641 case MeterPostFader:
1656 /** Called when the metering point has changed */
1658 MixerStrip::meter_changed ()
1660 meter_point_label.set_text (meter_point_string (_route->meter_point()));
1661 gpm.setup_meters ();
1662 // reset peak when meter point changes
1663 gpm.reset_peak_display();
1666 /** The bus that we are displaying sends to has changed, or been turned off.
1667 * @param send_to New bus that we are displaying sends to, or 0.
1670 MixerStrip::bus_send_display_changed (boost::shared_ptr<Route> send_to)
1672 RouteUI::bus_send_display_changed (send_to);
1675 boost::shared_ptr<Send> send = _route->internal_send_for (send_to);
1679 revert_to_default_display ();
1682 revert_to_default_display ();
1687 MixerStrip::drop_send ()
1689 boost::shared_ptr<Send> current_send;
1691 if (_current_delivery && (current_send = boost::dynamic_pointer_cast<Send>(_current_delivery))) {
1692 current_send->set_metering (false);
1695 send_gone_connection.disconnect ();
1696 input_button.set_sensitive (true);
1697 output_button.set_sensitive (true);
1698 group_button.set_sensitive (true);
1699 set_invert_sensitive (true);
1700 meter_point_button.set_sensitive (true);
1701 mute_button->set_sensitive (true);
1702 solo_button->set_sensitive (true);
1703 rec_enable_button->set_sensitive (true);
1704 solo_isolated_led->set_sensitive (true);
1705 solo_safe_led->set_sensitive (true);
1706 monitor_input_button->set_sensitive (true);
1707 monitor_disk_button->set_sensitive (true);
1708 _comment_button.set_sensitive (true);
1712 MixerStrip::set_current_delivery (boost::shared_ptr<Delivery> d)
1714 _current_delivery = d;
1715 DeliveryChanged (_current_delivery);
1719 MixerStrip::show_send (boost::shared_ptr<Send> send)
1725 set_current_delivery (send);
1727 send->set_metering (true);
1728 _current_delivery->DropReferences.connect (send_gone_connection, invalidator (*this), boost::bind (&MixerStrip::revert_to_default_display, this), gui_context());
1730 gain_meter().set_controls (_route, send->meter(), send->amp());
1731 gain_meter().setup_meters ();
1733 panner_ui().set_panner (_current_delivery->panner_shell(), _current_delivery->panner());
1734 panner_ui().setup_pan ();
1736 input_button.set_sensitive (false);
1737 group_button.set_sensitive (false);
1738 set_invert_sensitive (false);
1739 meter_point_button.set_sensitive (false);
1740 mute_button->set_sensitive (false);
1741 solo_button->set_sensitive (false);
1742 rec_enable_button->set_sensitive (false);
1743 solo_isolated_led->set_sensitive (false);
1744 solo_safe_led->set_sensitive (false);
1745 monitor_input_button->set_sensitive (false);
1746 monitor_disk_button->set_sensitive (false);
1747 _comment_button.set_sensitive (false);
1749 if (boost::dynamic_pointer_cast<InternalSend>(send)) {
1750 output_button.set_sensitive (false);
1753 reset_strip_style ();
1757 MixerStrip::revert_to_default_display ()
1761 set_current_delivery (_route->main_outs ());
1763 gain_meter().set_controls (_route, _route->shared_peak_meter(), _route->amp());
1764 gain_meter().setup_meters ();
1766 panner_ui().set_panner (_route->main_outs()->panner_shell(), _route->main_outs()->panner());
1767 panner_ui().setup_pan ();
1769 reset_strip_style ();
1773 MixerStrip::set_button_names ()
1777 rec_enable_button->set_text (_("Rec"));
1778 mute_button->set_text (_("Mute"));
1779 monitor_input_button->set_text (_("In"));
1780 monitor_disk_button->set_text (_("Disk"));
1782 if (_route && _route->solo_safe()) {
1783 if (solo_safe_pixbuf == 0) {
1784 solo_safe_pixbuf = ::get_icon("solo-safe-icon");
1786 solo_button->set_image (solo_safe_pixbuf);
1787 solo_button->set_text (string());
1789 solo_button->set_image (Glib::RefPtr<Gdk::Pixbuf>());
1790 if (!Config->get_solo_control_is_listen_control()) {
1791 solo_button->set_text (_("Solo"));
1793 switch (Config->get_listen_position()) {
1794 case AfterFaderListen:
1795 solo_button->set_text (_("AFL"));
1797 case PreFaderListen:
1798 solo_button->set_text (_("PFL"));
1806 rec_enable_button->set_text (_("R"));
1807 mute_button->set_text (_("M"));
1808 monitor_input_button->set_text (_("I"));
1809 monitor_disk_button->set_text (_("D"));
1810 if (_route && _route->solo_safe()) {
1811 solo_button->remove ();
1812 if (solo_safe_pixbuf == 0) {
1813 solo_safe_pixbuf =::get_icon("solo-safe-icon");
1815 solo_button->set_image (solo_safe_pixbuf);
1816 solo_button->set_text (string());
1818 solo_button->set_image (Glib::RefPtr<Gdk::Pixbuf>());
1819 if (!Config->get_solo_control_is_listen_control()) {
1820 solo_button->set_text (_("S"));
1822 switch (Config->get_listen_position()) {
1823 case AfterFaderListen:
1824 solo_button->set_text (_("A"));
1826 case PreFaderListen:
1827 solo_button->set_text (_("P"));
1838 MixerStrip::on_key_press_event (GdkEventKey* ev)
1840 GdkEventButton fake;
1841 fake.type = GDK_BUTTON_PRESS;
1843 fake.state = ev->state;
1845 switch (ev->keyval) {
1857 rec_enable_press (&fake);
1862 show_sends_press (&fake);
1867 if (ev->state & Keyboard::PrimaryModifier) {
1877 _route->set_gain (1.0, this);
1890 MixerStrip::on_key_release_event (GdkEventKey* ev)
1892 GdkEventButton fake;
1893 fake.type = GDK_BUTTON_RELEASE;
1895 fake.state = ev->state;
1897 switch (ev->keyval) {
1899 mute_release (&fake);
1904 solo_release (&fake);
1909 rec_enable_release (&fake);
1914 show_sends_release (&fake);
1930 MixerStrip::on_enter_notify_event (GdkEventCrossing*)
1932 Keyboard::magic_widget_grab_focus ();
1937 MixerStrip::on_leave_notify_event (GdkEventCrossing* ev)
1939 switch (ev->detail) {
1940 case GDK_NOTIFY_INFERIOR:
1943 Keyboard::magic_widget_drop_focus ();
1950 MixerStrip::plugin_selector()
1952 return _mixer.plugin_selector();
1956 MixerStrip::hide_things ()
1958 processor_box.hide_things ();
1962 MixerStrip::input_active_button_press (GdkEventButton*)
1964 /* nothing happens on press */
1969 MixerStrip::input_active_button_release (GdkEventButton* ev)
1971 boost::shared_ptr<MidiTrack> mt = midi_track ();
1977 if (mt->input_active()) {
1978 if (Keyboard::modifier_state_contains (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::SecondaryModifier))) {
1979 /* turn all other tracks using this input off */
1980 _session->set_exclusive_input_active (mt, false);
1982 mt->set_input_active (false);
1986 if (Keyboard::modifier_state_contains (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::SecondaryModifier))) {
1987 /* turn all other tracks using this input on */
1988 _session->set_exclusive_input_active (mt, true);
1990 mt->set_input_active (true);
1998 MixerStrip::midi_input_status_changed ()
2000 if (midi_input_enable_button) {
2001 boost::shared_ptr<MidiTrack> mt = midi_track ();
2003 midi_input_enable_button->set_active (mt->input_active ());
2008 MixerStrip::state_id () const
2010 return string_compose ("strip %1", _route->id().to_s());
2014 MixerStrip::parameter_changed (string p)
2016 if (p == _visibility.get_state_name()) {
2017 /* The user has made changes to the mixer strip visibility, so get
2018 our VisibilityGroup to reflect these changes in our widgets.
2020 _visibility.set_state (Config->get_mixer_strip_visibility ());
2024 /** Called to decide whether the solo isolate / solo lock button visibility should
2025 * be overridden from that configured by the user. We do this for the master bus.
2027 * @return optional value that is present if visibility state should be overridden.
2029 boost::optional<bool>
2030 MixerStrip::override_solo_visibility () const
2032 if (_route && _route->is_master ()) {
2033 return boost::optional<bool> (false);
2036 return boost::optional<bool> ();
2040 MixerStrip::add_input_port (DataType t)
2042 _route->input()->add_port ("", this, t);
2046 MixerStrip::add_output_port (DataType t)
2048 _route->output()->add_port ("", this, t);