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/midi_track.h"
44 #include "ardour/pannable.h"
45 #include "ardour/panner.h"
46 #include "ardour/panner_shell.h"
47 #include "ardour/send.h"
48 #include "ardour/processor.h"
49 #include "ardour/profile.h"
50 #include "ardour/ladspa_plugin.h"
51 #include "ardour/user_bundle.h"
52 #include "ardour/port.h"
54 #include "ardour_ui.h"
55 #include "ardour_dialog.h"
56 #include "mixer_strip.h"
60 #include "public_editor.h"
62 #include "io_selector.h"
64 #include "gui_thread.h"
65 #include "route_group_menu.h"
69 using namespace ARDOUR;
72 using namespace Gtkmm2ext;
75 sigc::signal<void,boost::shared_ptr<Route> > MixerStrip::SwitchIO;
77 int MixerStrip::scrollbar_height = 0;
78 PBD::Signal1<void,MixerStrip*> MixerStrip::CatchDeletion;
80 MixerStrip::MixerStrip (Mixer_UI& mx, Session* sess, bool in_mixer)
84 , _mixer_owned (in_mixer)
85 , processor_box (sess, boost::bind (&MixerStrip::plugin_selector, this), mx.selection(), this, in_mixer)
89 , solo_led_table (2, 2)
90 , middle_button_table (2, 2)
91 , bottom_button_table (1, 2)
92 , meter_point_label (_("pre"))
93 , midi_input_enable_button (0)
98 /* the editor mixer strip: don't destroy it every time
99 the underlying route goes away.
102 self_destruct = false;
106 MixerStrip::MixerStrip (Mixer_UI& mx, Session* sess, boost::shared_ptr<Route> rt, bool in_mixer)
110 , _mixer_owned (in_mixer)
111 , processor_box (sess, sigc::mem_fun(*this, &MixerStrip::plugin_selector), mx.selection(), this, in_mixer)
114 , button_table (3, 1)
115 , middle_button_table (2, 2)
116 , bottom_button_table (1, 2)
117 , meter_point_label (_("pre"))
118 , midi_input_enable_button (0)
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");
158 input_button_box.pack_start (input_button, true, true);
160 output_label.set_text (_("Output"));
161 ARDOUR_UI::instance()->set_tip (&output_button, _("Button 1 to choose outputs from a port matrix, button 3 to select inputs from a menu"), "");
162 output_button.add (output_label);
163 output_button.set_name ("MixerIOButton");
164 output_label.set_name ("MixerIOButtonLabel");
165 Gtkmm2ext::set_size_request_to_display_given_text (output_button, longest_label.c_str(), 4, 4);
167 ARDOUR_UI::instance()->set_tip (&meter_point_button, _("Select metering point"), "");
168 meter_point_button.add (meter_point_label);
169 meter_point_button.set_name ("MixerStripMeterPreButton");
170 meter_point_label.set_name ("MixerStripMeterPreButton");
172 /* TRANSLATORS: this string should be longest of the strings
173 used to describe meter points. In english, it's "input".
175 set_size_request_to_display_given_text (meter_point_button, _("tupni"), 5, 5);
177 bottom_button_table.attach (meter_point_button, 1, 2, 0, 1);
179 meter_point_button.signal_button_press_event().connect (sigc::mem_fun (gpm, &GainMeter::meter_press), false);
180 meter_point_button.signal_button_release_event().connect (sigc::mem_fun (gpm, &GainMeter::meter_release), false);
182 hide_button.set_events (hide_button.get_events() & ~(Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK));
184 mute_button->set_name ("MixerMuteButton");
185 solo_button->set_name ("MixerSoloButton");
187 monitor_input_button->set_name ("MixerMonitorInputButton");
188 monitor_disk_button->set_name ("MixerMonitorInputButton");
190 solo_isolated_led = manage (new LED);
191 solo_isolated_led->show ();
192 solo_isolated_led->set_diameter (6);
193 solo_isolated_led->set_no_show_all (true);
194 solo_isolated_led->set_name (X_("SoloIsolatedLED"));
195 solo_isolated_led->add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
196 solo_isolated_led->signal_button_release_event().connect (sigc::mem_fun (*this, &RouteUI::solo_isolate_button_release));
197 UI::instance()->set_tip (solo_isolated_led, _("Isolate Solo"), "");
199 solo_safe_led = manage (new LED);
200 solo_safe_led->show ();
201 solo_safe_led->set_diameter (6);
202 solo_safe_led->set_no_show_all (true);
203 solo_safe_led->set_name (X_("SoloSafeLED"));
204 solo_safe_led->add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
205 solo_safe_led->signal_button_release_event().connect (sigc::mem_fun (*this, &RouteUI::solo_safe_button_release));
206 UI::instance()->set_tip (solo_safe_led, _("Lock Solo Status"), "");
208 _iso_label = manage (new Label (_("iso")));
209 _safe_label = manage (new Label (_("lock")));
211 _iso_label->set_name (X_("SoloLEDLabel"));
212 _safe_label->set_name (X_("SoloLEDLabel"));
215 _safe_label->show ();
217 solo_led_table.set_spacings (0);
218 solo_led_table.set_border_width (1);
219 solo_led_table.attach (*_iso_label, 0, 1, 0, 1, Gtk::FILL, Gtk::FILL);
220 solo_led_table.attach (*solo_isolated_led, 1, 2, 0, 1, Gtk::FILL, Gtk::FILL);
221 solo_led_table.attach (*_safe_label, 0, 1, 1, 2, Gtk::FILL, Gtk::FILL);
222 solo_led_table.attach (*solo_safe_led, 1, 2, 1, 2, Gtk::FILL, Gtk::FILL);
224 solo_led_table.show ();
225 below_panner_box.set_border_width (2);
226 below_panner_box.set_spacing (2);
227 below_panner_box.pack_end (solo_led_table, false, false);
228 below_panner_box.show ();
230 button_table.set_homogeneous (true);
231 button_table.set_spacings (0);
233 button_table.attach (name_button, 0, 1, 0, 1);
234 button_table.attach (input_button_box, 0, 1, 1, 2);
235 button_table.attach (_invert_button_box, 0, 1, 2, 3);
237 middle_button_table.set_homogeneous (true);
238 middle_button_table.set_spacings (0);
239 middle_button_table.attach (*mute_button, 0, 1, 0, 1);
240 middle_button_table.attach (*solo_button, 1, 2, 0, 1);
241 middle_button_table.attach (*monitor_input_button, 0, 1, 1, 2);
242 middle_button_table.attach (*monitor_disk_button, 1, 2, 1, 2);
244 bottom_button_table.set_col_spacings (0);
245 bottom_button_table.set_homogeneous (true);
246 bottom_button_table.attach (group_button, 0, 1, 0, 1);
248 name_button.add (name_label);
249 name_button.set_name ("MixerNameButton");
250 Gtkmm2ext::set_size_request_to_display_given_text (name_button, longest_label.c_str(), 2, 2);
252 name_label.set_name ("MixerNameButtonLabel");
253 ARDOUR_UI::instance()->set_tip (&group_button, _("Mix group"), "");
254 group_button.add (group_label);
255 group_button.set_name ("MixerGroupButton");
256 Gtkmm2ext::set_size_request_to_display_given_text (group_button, "Group", 2, 2);
257 group_label.set_name ("MixerGroupButtonLabel");
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);
273 whvbox.pack_start (width_hide_box, true, true);
275 global_vpacker.pack_start (whvbox, Gtk::PACK_SHRINK);
276 global_vpacker.pack_start (button_table, Gtk::PACK_SHRINK);
277 global_vpacker.pack_start (processor_box, true, true);
278 global_vpacker.pack_start (panners, Gtk::PACK_SHRINK);
279 global_vpacker.pack_start (below_panner_box, Gtk::PACK_SHRINK);
280 global_vpacker.pack_start (middle_button_table, Gtk::PACK_SHRINK);
281 global_vpacker.pack_start (gpm, Gtk::PACK_SHRINK);
282 global_vpacker.pack_start (bottom_button_table, Gtk::PACK_SHRINK);
283 global_vpacker.pack_start (output_button, Gtk::PACK_SHRINK);
285 global_frame.add (global_vpacker);
286 global_frame.set_shadow_type (Gtk::SHADOW_IN);
287 global_frame.set_name ("BaseFrame");
291 /* force setting of visible selected status */
294 set_selected (false);
299 _session->engine().Stopped.connect (*this, invalidator (*this), boost::bind (&MixerStrip::engine_stopped, this), gui_context());
300 _session->engine().Running.connect (*this, invalidator (*this), boost::bind (&MixerStrip::engine_running, this), gui_context());
302 input_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MixerStrip::input_press), false);
303 output_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MixerStrip::output_press), false);
305 /* we don't need this if its not an audio track, but we don't know that yet and it doesn't
309 rec_enable_button->set_name ("MixerRecordEnableButton");
311 /* ditto for this button and busses */
313 name_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MixerStrip::name_button_button_press), false);
314 group_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MixerStrip::select_route_group), false);
318 /* start off as a passthru strip. we'll correct this, if necessary,
319 in update_diskstream_display().
322 /* start off as a passthru strip. we'll correct this, if necessary,
323 in update_diskstream_display().
327 set_name ("MidiTrackStripBase");
329 set_name ("AudioTrackStripBase");
331 add_events (Gdk::BUTTON_RELEASE_MASK|
332 Gdk::ENTER_NOTIFY_MASK|
333 Gdk::LEAVE_NOTIFY_MASK|
335 Gdk::KEY_RELEASE_MASK);
337 set_flags (get_flags() | Gtk::CAN_FOCUS);
339 SwitchIO.connect (sigc::mem_fun (*this, &MixerStrip::switch_io));
341 AudioEngine::instance()->PortConnectedOrDisconnected.connect (
342 *this, invalidator (*this), boost::bind (&MixerStrip::port_connected_or_disconnected, this, _1, _3), gui_context ()
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 below_panner_box.remove (*rec_enable_button);
362 if (show_sends_button->get_parent()) {
363 below_panner_box.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 (route()->is_master()) {
384 solo_button->hide ();
385 below_panner_box.hide ();
387 solo_button->show ();
388 below_panner_box.show ();
391 if (_mixer_owned && (route()->is_master() || route()->is_monitor())) {
393 if (scrollbar_height == 0) {
394 HScrollbar scrollbar;
395 Gtk::Requisition requisition(scrollbar.size_request ());
396 scrollbar_height = requisition.height;
399 spacer = manage (new EventBox);
400 spacer->set_size_request (-1, scrollbar_height);
401 global_vpacker.pack_start (*spacer, false, false);
405 monitor_input_button->show ();
406 monitor_disk_button->show ();
408 monitor_input_button->hide();
409 monitor_disk_button->hide ();
412 if (is_midi_track()) {
413 if (midi_input_enable_button == 0) {
414 Image* img = manage (new Image (get_icon (X_("midi_socket_small"))));
415 midi_input_enable_button = manage (new StatefulToggleButton);
416 midi_input_enable_button->set_name ("MixerMidiInputEnableButton");
417 midi_input_enable_button->set_image (*img);
418 midi_input_enable_button->signal_button_press_event().connect (sigc::mem_fun (*this, &MixerStrip::input_active_button_press), false);
419 midi_input_enable_button->signal_button_release_event().connect (sigc::mem_fun (*this, &MixerStrip::input_active_button_release), false);
420 ARDOUR_UI::instance()->set_tip (midi_input_enable_button, _("Enable/Disable MIDI input"));
422 input_button_box.remove (*midi_input_enable_button);
424 /* get current state */
425 midi_input_status_changed ();
426 input_button_box.pack_start (*midi_input_enable_button, false, false);
428 midi_track()->InputActiveChanged.connect (route_connections, invalidator (*this), boost::bind (&MixerStrip::midi_input_status_changed, this), gui_context());
430 if (midi_input_enable_button) {
431 /* removal from the container will delete it */
432 input_button_box.remove (*midi_input_enable_button);
433 midi_input_enable_button = 0;
437 if (is_audio_track()) {
438 boost::shared_ptr<AudioTrack> at = audio_track();
439 at->FreezeChange.connect (route_connections, invalidator (*this), boost::bind (&MixerStrip::map_frozen, this), gui_context());
442 if (has_audio_outputs ()) {
450 below_panner_box.pack_start (*rec_enable_button);
451 rec_enable_button->set_sensitive (_session->writable());
452 rec_enable_button->show();
458 if (!_route->is_master()) {
459 below_panner_box.pack_start (*show_sends_button);
460 show_sends_button->show();
464 meter_point_label.set_text (meter_point_string (_route->meter_point()));
466 delete route_ops_menu;
469 _route->meter_change.connect (route_connections, invalidator (*this), bind (&MixerStrip::meter_changed, this), gui_context());
470 _route->route_group_changed.connect (route_connections, invalidator (*this), boost::bind (&MixerStrip::route_group_changed, this), gui_context());
472 if (_route->panner_shell()) {
473 _route->panner_shell()->Changed.connect (route_connections, invalidator (*this), boost::bind (&MixerStrip::connect_to_pan, this), gui_context());
476 if (is_audio_track()) {
477 audio_track()->DiskstreamChanged.connect (route_connections, invalidator (*this), boost::bind (&MixerStrip::diskstream_changed, this), gui_context());
480 _route->comment_changed.connect (route_connections, invalidator (*this), ui_bind (&MixerStrip::comment_changed, this, _1), gui_context());
482 set_stuff_from_route ();
484 /* now force an update of all the various elements */
487 update_solo_display ();
490 route_group_changed ();
493 panners.setup_pan ();
495 update_diskstream_display ();
496 update_input_display ();
497 update_output_display ();
499 add_events (Gdk::BUTTON_RELEASE_MASK);
501 processor_box.show ();
503 if (!route()->is_master() && !route()->is_monitor()) {
504 /* we don't allow master or control routes to be hidden */
509 width_hide_box.show();
512 global_vpacker.show();
514 middle_button_table.show();
515 bottom_button_table.show();
517 gain_unit_button.show();
518 gain_unit_label.show();
519 meter_point_button.show();
520 meter_point_label.show();
521 diskstream_button.show();
522 diskstream_label.show();
523 input_button_box.show_all();
524 output_button.show();
535 MixerStrip::set_stuff_from_route ()
537 /* if width is not set, it will be set by the MixerUI or editor */
539 string str = gui_property ("strip-width");
541 set_width_enum (Width (string_2_enum (str, _width)), this);
546 MixerStrip::set_width_enum (Width w, void* owner)
548 /* always set the gpm width again, things may be hidden */
551 panners.set_width (w);
553 boost::shared_ptr<AutomationList> gain_automation = _route->gain_control()->alist();
555 _width_owner = owner;
559 if (_width_owner == this) {
560 set_gui_property ("strip-width", enum_2_string (_width));
567 if (show_sends_button) {
568 ((Gtk::Label*)show_sends_button->get_child())->set_text (_("Sends"));
571 ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (
572 gpm.astyle_string(gain_automation->automation_style()));
573 ((Gtk::Label*)gpm.gain_automation_state_button.get_child())->set_text (
574 gpm.astate_string(gain_automation->automation_state()));
576 if (_route->panner()) {
577 ((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text (
578 panners.astyle_string(_route->panner()->automation_style()));
579 ((Gtk::Label*)panners.pan_automation_state_button.get_child())->set_text (
580 panners.astate_string(_route->panner()->automation_state()));
584 _safe_label->show ();
586 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "long", 2, 2);
587 set_size_request (-1, -1);
591 if (show_sends_button) {
592 ((Gtk::Label*)show_sends_button->get_child())->set_text (_("Snd"));
595 ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (
596 gpm.short_astyle_string(gain_automation->automation_style()));
597 ((Gtk::Label*)gpm.gain_automation_state_button.get_child())->set_text (
598 gpm.short_astate_string(gain_automation->automation_state()));
600 if (_route->panner()) {
601 ((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text (
602 panners.short_astyle_string(_route->panner()->automation_style()));
603 ((Gtk::Label*)panners.pan_automation_state_button.get_child())->set_text (
604 panners.short_astate_string(_route->panner()->automation_state()));
608 _safe_label->hide ();
610 Gtkmm2ext::set_size_request_to_display_given_text (name_button, longest_label.c_str(), 2, 2);
611 set_size_request (max (50, gpm.get_gm_width()), -1);
615 processor_box.set_width (w);
617 update_input_display ();
618 update_output_display ();
619 route_group_changed ();
625 MixerStrip::set_packed (bool yn)
630 set_gui_property ("visible", true);
632 set_gui_property ("visible", false);
637 struct RouteCompareByName {
638 bool operator() (boost::shared_ptr<Route> a, boost::shared_ptr<Route> b) {
639 return a->name().compare (b->name()) < 0;
644 MixerStrip::output_press (GdkEventButton *ev)
646 using namespace Menu_Helpers;
647 if (!_session->engine().connected()) {
648 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
653 MenuList& citems = output_menu.items();
654 switch (ev->button) {
657 edit_output_configuration ();
662 output_menu.set_name ("ArdourContextMenu");
664 output_menu_bundles.clear ();
666 citems.push_back (MenuElem (_("Disconnect"), sigc::mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_output)));
667 citems.push_back (SeparatorElem());
669 ARDOUR::BundleList current = _route->output()->bundles_connected ();
671 boost::shared_ptr<ARDOUR::BundleList> b = _session->bundles ();
673 /* give user bundles first chance at being in the menu */
675 for (ARDOUR::BundleList::iterator i = b->begin(); i != b->end(); ++i) {
676 if (boost::dynamic_pointer_cast<UserBundle> (*i)) {
677 maybe_add_bundle_to_output_menu (*i, current);
681 for (ARDOUR::BundleList::iterator i = b->begin(); i != b->end(); ++i) {
682 if (boost::dynamic_pointer_cast<UserBundle> (*i) == 0) {
683 maybe_add_bundle_to_output_menu (*i, current);
687 boost::shared_ptr<ARDOUR::RouteList> routes = _session->get_routes ();
688 RouteList copy = *routes;
689 copy.sort (RouteCompareByName ());
690 for (ARDOUR::RouteList::const_iterator i = copy.begin(); i != copy.end(); ++i) {
691 maybe_add_bundle_to_output_menu ((*i)->input()->bundle(), current);
694 if (citems.size() == 2) {
695 /* no routes added; remove the separator */
699 output_menu.popup (1, ev->time);
710 MixerStrip::edit_output_configuration ()
712 if (output_selector == 0) {
714 boost::shared_ptr<Send> send;
715 boost::shared_ptr<IO> output;
717 if ((send = boost::dynamic_pointer_cast<Send>(_current_delivery)) != 0) {
718 if (!boost::dynamic_pointer_cast<InternalSend>(send)) {
719 output = send->output();
721 output = _route->output ();
724 output = _route->output ();
727 output_selector = new IOSelectorWindow (_session, output);
730 if (output_selector->is_visible()) {
731 output_selector->get_toplevel()->get_window()->raise();
733 output_selector->present ();
738 MixerStrip::edit_input_configuration ()
740 if (input_selector == 0) {
741 input_selector = new IOSelectorWindow (_session, _route->input());
744 if (input_selector->is_visible()) {
745 input_selector->get_toplevel()->get_window()->raise();
747 input_selector->present ();
752 MixerStrip::input_press (GdkEventButton *ev)
754 using namespace Menu_Helpers;
756 MenuList& citems = input_menu.items();
757 input_menu.set_name ("ArdourContextMenu");
760 if (!_session->engine().connected()) {
761 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
766 if (_session->actively_recording() && _route->record_enabled())
769 switch (ev->button) {
772 edit_input_configuration ();
777 citems.push_back (MenuElem (_("Disconnect"), sigc::mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_input)));
778 citems.push_back (SeparatorElem());
779 input_menu_bundles.clear ();
781 ARDOUR::BundleList current = _route->input()->bundles_connected ();
783 boost::shared_ptr<ARDOUR::BundleList> b = _session->bundles ();
785 /* give user bundles first chance at being in the menu */
787 for (ARDOUR::BundleList::iterator i = b->begin(); i != b->end(); ++i) {
788 if (boost::dynamic_pointer_cast<UserBundle> (*i)) {
789 maybe_add_bundle_to_input_menu (*i, current);
793 for (ARDOUR::BundleList::iterator i = b->begin(); i != b->end(); ++i) {
794 if (boost::dynamic_pointer_cast<UserBundle> (*i) == 0) {
795 maybe_add_bundle_to_input_menu (*i, current);
799 boost::shared_ptr<ARDOUR::RouteList> routes = _session->get_routes ();
800 RouteList copy = *routes;
801 copy.sort (RouteCompareByName ());
802 for (ARDOUR::RouteList::const_iterator i = copy.begin(); i != copy.end(); ++i) {
803 maybe_add_bundle_to_input_menu ((*i)->output()->bundle(), current);
806 if (citems.size() == 2) {
807 /* no routes added; remove the separator */
811 input_menu.popup (1, ev->time);
821 MixerStrip::bundle_input_toggled (boost::shared_ptr<ARDOUR::Bundle> c)
827 ARDOUR::BundleList current = _route->input()->bundles_connected ();
829 if (std::find (current.begin(), current.end(), c) == current.end()) {
830 _route->input()->connect_ports_to_bundle (c, this);
832 _route->input()->disconnect_ports_from_bundle (c, this);
837 MixerStrip::bundle_output_toggled (boost::shared_ptr<ARDOUR::Bundle> c)
843 ARDOUR::BundleList current = _route->output()->bundles_connected ();
845 if (std::find (current.begin(), current.end(), c) == current.end()) {
846 _route->output()->connect_ports_to_bundle (c, this);
848 _route->output()->disconnect_ports_from_bundle (c, this);
853 MixerStrip::maybe_add_bundle_to_input_menu (boost::shared_ptr<Bundle> b, ARDOUR::BundleList const & current)
855 using namespace Menu_Helpers;
857 if (b->ports_are_outputs() == false || b->nchannels() != _route->n_inputs()) {
861 list<boost::shared_ptr<Bundle> >::iterator i = input_menu_bundles.begin ();
862 while (i != input_menu_bundles.end() && b->has_same_ports (*i) == false) {
866 if (i != input_menu_bundles.end()) {
870 input_menu_bundles.push_back (b);
872 MenuList& citems = input_menu.items();
874 std::string n = b->name ();
875 replace_all (n, "_", " ");
877 citems.push_back (CheckMenuElem (n, sigc::bind (sigc::mem_fun(*this, &MixerStrip::bundle_input_toggled), b)));
879 if (std::find (current.begin(), current.end(), b) != current.end()) {
880 ignore_toggle = true;
881 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
882 ignore_toggle = false;
887 MixerStrip::maybe_add_bundle_to_output_menu (boost::shared_ptr<Bundle> b, ARDOUR::BundleList const & current)
889 using namespace Menu_Helpers;
891 if (b->ports_are_inputs() == false || b->nchannels() != _route->n_outputs()) {
895 list<boost::shared_ptr<Bundle> >::iterator i = output_menu_bundles.begin ();
896 while (i != output_menu_bundles.end() && b->has_same_ports (*i) == false) {
900 if (i != output_menu_bundles.end()) {
904 output_menu_bundles.push_back (b);
906 MenuList& citems = output_menu.items();
908 std::string n = b->name ();
909 replace_all (n, "_", " ");
911 citems.push_back (CheckMenuElem (n, sigc::bind (sigc::mem_fun(*this, &MixerStrip::bundle_output_toggled), b)));
913 if (std::find (current.begin(), current.end(), b) != current.end()) {
914 ignore_toggle = true;
915 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
916 ignore_toggle = false;
921 MixerStrip::update_diskstream_display ()
925 if (input_selector) {
926 input_selector->hide_all ();
929 route_color_changed ();
933 show_passthru_color ();
938 MixerStrip::connect_to_pan ()
940 ENSURE_GUI_THREAD (*this, &MixerStrip::connect_to_pan)
942 panstate_connection.disconnect ();
943 panstyle_connection.disconnect ();
945 if (!_route->panner()) {
949 boost::shared_ptr<Pannable> p = _route->pannable ();
951 p->automation_state_changed.connect (panstate_connection, invalidator (*this), boost::bind (&PannerUI::pan_automation_state_changed, &panners), gui_context());
952 p->automation_style_changed.connect (panstyle_connection, invalidator (*this), boost::bind (&PannerUI::pan_automation_style_changed, &panners), gui_context());
954 panners.panshell_changed ();
959 * Output port labelling
960 * =====================
962 * Case 1: Each output has one connection, all connections are to system:playback_%i
963 * out 1 -> system:playback_1
964 * out 2 -> system:playback_2
965 * out 3 -> system:playback_3
968 * Case 2: Each output has one connection, all connections are to ardour:track_x/in 1
969 * out 1 -> ardour:track_x/in 1
970 * out 2 -> ardour:track_x/in 2
971 * Display as: track_x
973 * Case 3: Each output has one connection, all connections are to Jack client "program x"
974 * out 1 -> program x:foo
975 * out 2 -> program x:foo
976 * Display as: program x
978 * Case 4: No connections (Disconnected)
981 * Default case (unusual routing):
982 * Display as: *number of connections*
986 * .-----------------------------------------------.
988 * | out 1 -> ardour:master/in 1, jamin:input/in 1 |
989 * | out 2 -> ardour:master/in 2, jamin:input/in 2 |
990 * '-----------------------------------------------'
991 * .-----------------------------------------------.
994 * '-----------------------------------------------'
998 MixerStrip::update_io_button (boost::shared_ptr<ARDOUR::Route> route, Width width, bool for_input)
1003 vector<string> port_connections;
1005 uint32_t total_connection_count = 0;
1006 uint32_t io_connection_count = 0;
1007 uint32_t ardour_connection_count = 0;
1008 uint32_t system_connection_count = 0;
1009 uint32_t other_connection_count = 0;
1011 ostringstream label;
1012 string label_string;
1014 bool have_label = false;
1015 bool each_io_has_one_connection = true;
1017 string connection_name;
1018 string ardour_track_name;
1019 string other_connection_type;
1020 string system_ports;
1023 ostringstream tooltip;
1024 char * tooltip_cstr;
1026 tooltip << route->name();
1029 io_count = route->n_inputs().n_total();
1031 io_count = route->n_outputs().n_total();
1034 for (io_index = 0; io_index < io_count; ++io_index) {
1036 port = route->input()->nth (io_index);
1038 port = route->output()->nth (io_index);
1041 port_connections.clear ();
1042 port->get_connections(port_connections);
1043 io_connection_count = 0;
1045 if (!port_connections.empty()) {
1046 for (vector<string>::iterator i = port_connections.begin(); i != port_connections.end(); ++i) {
1047 string& connection_name (*i);
1049 if (io_connection_count == 0) {
1050 tooltip << endl << port->name().substr(port->name().find("/") + 1) << " -> " << connection_name;
1052 tooltip << ", " << connection_name;
1055 if (connection_name.find("ardour:") == 0) {
1056 if (ardour_track_name.empty()) {
1057 // "ardour:Master/in 1" -> "ardour:Master/"
1058 string::size_type slash = connection_name.find("/");
1059 if (slash != string::npos) {
1060 ardour_track_name = connection_name.substr(0, slash + 1);
1064 if (connection_name.find(ardour_track_name) == 0) {
1065 ++ardour_connection_count;
1067 } else if (connection_name.find("system:") == 0) {
1069 // "system:capture_123" -> "123"
1070 system_port = connection_name.substr(15);
1072 // "system:playback_123" -> "123"
1073 system_port = connection_name.substr(16);
1076 if (system_ports.empty()) {
1077 system_ports += system_port;
1079 system_ports += "/" + system_port;
1082 ++system_connection_count;
1084 if (other_connection_type.empty()) {
1085 // "jamin:in 1" -> "jamin:"
1086 other_connection_type = connection_name.substr(0, connection_name.find(":") + 1);
1089 if (connection_name.find(other_connection_type) == 0) {
1090 ++other_connection_count;
1094 ++total_connection_count;
1095 ++io_connection_count;
1099 if (io_connection_count != 1) {
1100 each_io_has_one_connection = false;
1104 if (total_connection_count == 0) {
1105 tooltip << endl << _("Disconnected");
1108 tooltip_cstr = new char[tooltip.str().size() + 1];
1109 strcpy(tooltip_cstr, tooltip.str().c_str());
1112 ARDOUR_UI::instance()->set_tip (&input_button, tooltip_cstr, "");
1114 ARDOUR_UI::instance()->set_tip (&output_button, tooltip_cstr, "");
1117 if (each_io_has_one_connection) {
1118 if ((total_connection_count == ardour_connection_count)) {
1119 // all connections are to the same track in ardour
1120 // "ardour:Master/" -> "Master"
1121 string::size_type slash = ardour_track_name.find("/");
1122 if (slash != string::npos) {
1123 label << ardour_track_name.substr(7, slash - 7);
1127 else if (total_connection_count == system_connection_count) {
1128 // all connections are to system ports
1129 label << system_ports;
1132 else if (total_connection_count == other_connection_count) {
1133 // all connections are to the same external program eg jamin
1134 // "jamin:" -> "jamin"
1135 label << other_connection_type.substr(0, other_connection_type.size() - 1);
1141 if (total_connection_count == 0) {
1145 // Odd configuration
1146 label << "*" << total_connection_count << "*";
1152 label_string = label.str().substr(0, 6);
1155 label_string = label.str().substr(0, 3);
1160 input_label.set_text (label_string);
1162 output_label.set_text (label_string);
1167 MixerStrip::update_input_display ()
1169 update_io_button (_route, _width, true);
1170 panners.setup_pan ();
1174 MixerStrip::update_output_display ()
1176 update_io_button (_route, _width, false);
1177 gpm.setup_meters ();
1178 panners.setup_pan ();
1182 MixerStrip::fast_update ()
1184 gpm.update_meters ();
1188 MixerStrip::diskstream_changed ()
1190 Gtkmm2ext::UI::instance()->call_slot (invalidator (*this), boost::bind (&MixerStrip::update_diskstream_display, this));
1194 MixerStrip::port_connected_or_disconnected (Port* a, Port* b)
1196 if (_route->input()->has_port (a) || _route->input()->has_port (b)) {
1197 update_input_display ();
1198 set_width_enum (_width, this);
1201 if (_route->output()->has_port (a) || _route->output()->has_port (b)) {
1202 update_output_display ();
1203 set_width_enum (_width, this);
1208 MixerStrip::comment_editor_done_editing ()
1210 ignore_toggle = true;
1211 _comment_menu_item->set_active (false);
1212 ignore_toggle = false;
1214 string const str = comment_area->get_buffer()->get_text();
1215 if (str == _route->comment ()) {
1219 _route->set_comment (str, this);
1223 MixerStrip::toggle_comment ()
1225 if (ignore_toggle) {
1229 if (comment_window == 0) {
1230 setup_comment_editor ();
1233 if (comment_window->is_visible ()) {
1234 comment_window->hide ();
1239 title = _route->name();
1240 title += _(": comment editor");
1242 comment_window->set_title (title);
1243 comment_window->present();
1247 MixerStrip::setup_comment_editor ()
1249 comment_window = new ArdourDialog ("", false); // title will be reset to show route
1250 comment_window->set_position (Gtk::WIN_POS_MOUSE);
1251 comment_window->set_skip_taskbar_hint (true);
1252 comment_window->signal_hide().connect (sigc::mem_fun(*this, &MixerStrip::comment_editor_done_editing));
1253 comment_window->set_default_size (400, 200);
1255 comment_area = manage (new TextView());
1256 comment_area->set_name ("MixerTrackCommentArea");
1257 comment_area->set_wrap_mode (WRAP_WORD);
1258 comment_area->set_editable (true);
1259 comment_area->get_buffer()->set_text (_route->comment());
1260 comment_area->show ();
1262 comment_window->get_vbox()->pack_start (*comment_area);
1263 comment_window->get_action_area()->hide();
1267 MixerStrip::comment_changed (void *src)
1269 ENSURE_GUI_THREAD (*this, &MixerStrip::comment_changed, src)
1272 ignore_comment_edit = true;
1274 comment_area->get_buffer()->set_text (_route->comment());
1276 ignore_comment_edit = false;
1281 MixerStrip::select_route_group (GdkEventButton *ev)
1283 using namespace Menu_Helpers;
1285 if (ev->button == 1) {
1287 if (group_menu == 0) {
1289 PropertyList* plist = new PropertyList();
1291 plist->add (Properties::gain, true);
1292 plist->add (Properties::mute, true);
1293 plist->add (Properties::solo, true);
1295 group_menu = new RouteGroupMenu (_session, plist);
1299 r.push_back (route ());
1300 group_menu->build (r);
1301 group_menu->menu()->popup (1, ev->time);
1308 MixerStrip::route_group_changed ()
1310 ENSURE_GUI_THREAD (*this, &MixerStrip::route_group_changed)
1312 RouteGroup *rg = _route->route_group();
1315 group_label.set_text (PBD::short_version (rg->name(), 5));
1319 group_label.set_text (_("Grp"));
1322 group_label.set_text (_("~G"));
1329 MixerStrip::route_color_changed ()
1331 name_button.modify_bg (STATE_NORMAL, color());
1332 top_event_box.modify_bg (STATE_NORMAL, color());
1333 reset_strip_style ();
1337 MixerStrip::show_passthru_color ()
1339 reset_strip_style ();
1343 MixerStrip::build_route_ops_menu ()
1345 using namespace Menu_Helpers;
1346 route_ops_menu = new Menu;
1347 route_ops_menu->set_name ("ArdourContextMenu");
1349 MenuList& items = route_ops_menu->items();
1351 items.push_back (CheckMenuElem (_("Comments..."), sigc::mem_fun (*this, &MixerStrip::toggle_comment)));
1352 _comment_menu_item = dynamic_cast<CheckMenuItem*> (&items.back ());
1353 items.push_back (MenuElem (_("Save As Template..."), sigc::mem_fun(*this, &RouteUI::save_as_template)));
1354 items.push_back (MenuElem (_("Rename..."), sigc::mem_fun(*this, &RouteUI::route_rename)));
1355 rename_menu_item = &items.back();
1356 items.push_back (SeparatorElem());
1357 items.push_back (CheckMenuElem (_("Active")));
1358 CheckMenuItem* i = dynamic_cast<CheckMenuItem *> (&items.back());
1359 i->set_active (_route->active());
1360 i->signal_activate().connect (sigc::bind (sigc::mem_fun (*this, &RouteUI::set_route_active), !_route->active(), false));
1362 items.push_back (SeparatorElem());
1364 items.push_back (MenuElem (_("Adjust Latency..."), sigc::mem_fun (*this, &RouteUI::adjust_latency)));
1366 items.push_back (SeparatorElem());
1367 items.push_back (CheckMenuElem (_("Protect Against Denormals"), sigc::mem_fun (*this, &RouteUI::toggle_denormal_protection)));
1368 denormal_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
1369 denormal_menu_item->set_active (_route->denormal_protection());
1371 if (!Profile->get_sae()) {
1372 items.push_back (SeparatorElem());
1373 items.push_back (MenuElem (_("Remote Control ID..."), sigc::mem_fun (*this, &RouteUI::open_remote_control_id_dialog)));
1376 items.push_back (SeparatorElem());
1377 items.push_back (MenuElem (_("Remove"), sigc::bind (sigc::mem_fun(*this, &RouteUI::remove_this_route), false)));
1381 MixerStrip::name_button_button_press (GdkEventButton* ev)
1383 if (ev->button == 3) {
1384 list_route_operations ();
1386 /* do not allow rename if the track is record-enabled */
1387 rename_menu_item->set_sensitive (!_route->record_enabled());
1388 route_ops_menu->popup (1, ev->time);
1390 } else if (ev->button == 1) {
1391 revert_to_default_display ();
1398 MixerStrip::list_route_operations ()
1400 delete route_ops_menu;
1401 build_route_ops_menu ();
1405 MixerStrip::set_selected (bool yn)
1407 AxisView::set_selected (yn);
1409 global_frame.set_shadow_type (Gtk::SHADOW_ETCHED_OUT);
1410 global_frame.set_name ("MixerStripSelectedFrame");
1412 global_frame.set_shadow_type (Gtk::SHADOW_IN);
1413 global_frame.set_name ("MixerStripFrame");
1415 global_frame.queue_draw ();
1419 MixerStrip::name_changed ()
1423 RouteUI::property_changed (PropertyChange (ARDOUR::Properties::name));
1426 name_label.set_text (PBD::short_version (_route->name(), 5));
1432 MixerStrip::width_clicked ()
1436 set_width_enum (Narrow, this);
1439 set_width_enum (Wide, this);
1445 MixerStrip::hide_clicked ()
1447 // LAME fix to reset the button status for when it is redisplayed (part 1)
1448 hide_button.set_sensitive(false);
1451 Hiding(); /* EMIT_SIGNAL */
1453 _mixer.hide_strip (this);
1457 hide_button.set_sensitive(true);
1461 MixerStrip::set_embedded (bool yn)
1467 MixerStrip::map_frozen ()
1469 ENSURE_GUI_THREAD (*this, &MixerStrip::map_frozen)
1471 boost::shared_ptr<AudioTrack> at = audio_track();
1474 switch (at->freeze_state()) {
1475 case AudioTrack::Frozen:
1476 processor_box.set_sensitive (false);
1477 hide_redirect_editors ();
1480 processor_box.set_sensitive (true);
1481 // XXX need some way, maybe, to retoggle redirect editors
1488 MixerStrip::hide_redirect_editors ()
1490 _route->foreach_processor (sigc::mem_fun (*this, &MixerStrip::hide_processor_editor));
1494 MixerStrip::hide_processor_editor (boost::weak_ptr<Processor> p)
1496 boost::shared_ptr<Processor> processor (p.lock ());
1501 Gtk::Window* w = processor_box.get_processor_ui (processor);
1509 MixerStrip::reset_strip_style ()
1511 if (_current_delivery && boost::dynamic_pointer_cast<Send>(_current_delivery)) {
1513 gpm.set_fader_name ("SendStripBase");
1517 if (is_midi_track()) {
1518 if (_route->active()) {
1519 set_name ("MidiTrackStripBase");
1520 gpm.set_meter_strip_name ("MidiTrackMetrics");
1522 set_name ("MidiTrackStripBaseInactive");
1523 gpm.set_meter_strip_name ("MidiTrackMetricsInactive");
1525 gpm.set_fader_name ("MidiTrackFader");
1526 } else if (is_audio_track()) {
1527 if (_route->active()) {
1528 set_name ("AudioTrackStripBase");
1529 gpm.set_meter_strip_name ("AudioTrackMetrics");
1531 set_name ("AudioTrackStripBaseInactive");
1532 gpm.set_meter_strip_name ("AudioTrackMetricsInactive");
1534 gpm.set_fader_name ("AudioTrackFader");
1536 if (_route->active()) {
1537 set_name ("AudioBusStripBase");
1538 gpm.set_meter_strip_name ("AudioBusMetrics");
1540 set_name ("AudioBusStripBaseInactive");
1541 gpm.set_meter_strip_name ("AudioBusMetricsInactive");
1543 gpm.set_fader_name ("AudioBusFader");
1545 /* (no MIDI busses yet) */
1551 MixerStrip::route_group() const
1553 return _route->route_group();
1557 MixerStrip::engine_stopped ()
1562 MixerStrip::engine_running ()
1567 MixerStrip::meter_point_string (MeterPoint mp)
1578 case MeterPostFader:
1593 /** Called when the metering point has changed */
1595 MixerStrip::meter_changed ()
1597 meter_point_label.set_text (meter_point_string (_route->meter_point()));
1598 gpm.setup_meters ();
1599 // reset peak when meter point changes
1600 gpm.reset_peak_display();
1604 MixerStrip::switch_io (boost::shared_ptr<Route> target)
1606 /* don't respond to switch IO signal outside of the mixer window */
1608 if (!_mixer_owned) {
1612 if (_route == target || _route->is_master()) {
1613 /* don't change the display for the target or the master bus */
1615 } else if (!is_track() && show_sends_button) {
1616 /* make sure our show sends button is inactive, and we no longer blink,
1617 since we're not the target.
1619 send_blink_connection.disconnect ();
1620 show_sends_button->set_active (false);
1621 show_sends_button->set_state (STATE_NORMAL);
1625 /* switch back to default */
1626 revert_to_default_display ();
1630 boost::shared_ptr<Send> send = _route->internal_send_for (target);
1635 revert_to_default_display ();
1640 MixerStrip::drop_send ()
1642 boost::shared_ptr<Send> current_send;
1644 if (_current_delivery && (current_send = boost::dynamic_pointer_cast<Send>(_current_delivery))) {
1645 current_send->set_metering (false);
1648 send_gone_connection.disconnect ();
1649 input_button.set_sensitive (true);
1650 output_button.set_sensitive (true);
1651 group_button.set_sensitive (true);
1652 set_invert_sensitive (true);
1653 meter_point_button.set_sensitive (true);
1654 mute_button->set_sensitive (true);
1655 solo_button->set_sensitive (true);
1656 rec_enable_button->set_sensitive (true);
1657 solo_isolated_led->set_sensitive (true);
1658 solo_safe_led->set_sensitive (true);
1659 monitor_input_button->set_sensitive (true);
1660 monitor_disk_button->set_sensitive (true);
1664 MixerStrip::set_current_delivery (boost::shared_ptr<Delivery> d)
1666 _current_delivery = d;
1667 DeliveryChanged (_current_delivery);
1671 MixerStrip::show_send (boost::shared_ptr<Send> send)
1677 set_current_delivery (send);
1679 send->set_metering (true);
1680 _current_delivery->DropReferences.connect (send_gone_connection, invalidator (*this), boost::bind (&MixerStrip::revert_to_default_display, this), gui_context());
1682 gain_meter().set_controls (_route, send->meter(), send->amp());
1683 gain_meter().setup_meters ();
1685 panner_ui().set_panner (_current_delivery->panner_shell(), _current_delivery->panner());
1686 panner_ui().setup_pan ();
1688 input_button.set_sensitive (false);
1689 group_button.set_sensitive (false);
1690 set_invert_sensitive (false);
1691 meter_point_button.set_sensitive (false);
1692 mute_button->set_sensitive (false);
1693 solo_button->set_sensitive (false);
1694 rec_enable_button->set_sensitive (false);
1695 solo_isolated_led->set_sensitive (false);
1696 solo_safe_led->set_sensitive (false);
1697 monitor_input_button->set_sensitive (false);
1698 monitor_disk_button->set_sensitive (false);
1700 if (boost::dynamic_pointer_cast<InternalSend>(send)) {
1701 output_button.set_sensitive (false);
1704 reset_strip_style ();
1708 MixerStrip::revert_to_default_display ()
1710 if (show_sends_button) {
1711 show_sends_button->set_active (false);
1716 set_current_delivery (_route->main_outs ());
1718 gain_meter().set_controls (_route, _route->shared_peak_meter(), _route->amp());
1719 gain_meter().setup_meters ();
1721 panner_ui().set_panner (_route->main_outs()->panner_shell(), _route->main_outs()->panner());
1722 panner_ui().setup_pan ();
1724 reset_strip_style ();
1728 MixerStrip::set_button_names ()
1732 rec_enable_button_label.set_text (_("Rec"));
1733 mute_button_label.set_text (_("Mute"));
1734 monitor_input_button_label.set_text (_("In"));
1735 monitor_disk_button_label.set_text (_("Disk"));
1736 if (_route && _route->solo_safe()) {
1737 solo_button_label.set_text (X_("!"));
1739 if (!Config->get_solo_control_is_listen_control()) {
1740 solo_button_label.set_text (_("Solo"));
1742 switch (Config->get_listen_position()) {
1743 case AfterFaderListen:
1744 solo_button_label.set_text (_("AFL"));
1746 case PreFaderListen:
1747 solo_button_label.set_text (_("PFL"));
1755 rec_enable_button_label.set_text (_("R"));
1756 mute_button_label.set_text (_("M"));
1757 monitor_input_button_label.set_text (_("I"));
1758 monitor_disk_button_label.set_text (_("D"));
1759 if (_route && _route->solo_safe()) {
1760 solo_button_label.set_text (X_("!"));
1761 if (!Config->get_solo_control_is_listen_control()) {
1762 solo_button_label.set_text (_("S"));
1764 switch (Config->get_listen_position()) {
1765 case AfterFaderListen:
1766 solo_button_label.set_text (_("A"));
1768 case PreFaderListen:
1769 solo_button_label.set_text (_("P"));
1780 MixerStrip::on_key_press_event (GdkEventKey* ev)
1782 GdkEventButton fake;
1783 fake.type = GDK_BUTTON_PRESS;
1785 fake.state = ev->state;
1787 switch (ev->keyval) {
1799 rec_enable_press (&fake);
1804 show_sends_press (&fake);
1809 if (ev->state & Keyboard::PrimaryModifier) {
1819 _route->set_gain (1.0, this);
1832 MixerStrip::on_key_release_event (GdkEventKey* ev)
1834 GdkEventButton fake;
1835 fake.type = GDK_BUTTON_RELEASE;
1837 fake.state = ev->state;
1839 switch (ev->keyval) {
1841 mute_release (&fake);
1846 solo_release (&fake);
1851 rec_enable_release (&fake);
1856 show_sends_release (&fake);
1872 MixerStrip::on_enter_notify_event (GdkEventCrossing*)
1874 Keyboard::magic_widget_grab_focus ();
1879 MixerStrip::on_leave_notify_event (GdkEventCrossing* ev)
1881 switch (ev->detail) {
1882 case GDK_NOTIFY_INFERIOR:
1885 Keyboard::magic_widget_drop_focus ();
1892 MixerStrip::plugin_selector()
1894 return _mixer.plugin_selector();
1898 MixerStrip::hide_things ()
1900 processor_box.hide_things ();
1904 MixerStrip::input_active_button_press (GdkEventButton*)
1906 /* nothing happens on press */
1911 MixerStrip::input_active_button_release (GdkEventButton* ev)
1913 boost::shared_ptr<MidiTrack> mt = midi_track ();
1919 if (mt->input_active()) {
1920 if (Keyboard::modifier_state_contains (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::SecondaryModifier))) {
1921 /* turn all other tracks using this input off */
1922 _session->set_exclusive_input_active (mt, false);
1924 mt->set_input_active (false);
1928 if (Keyboard::modifier_state_contains (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::SecondaryModifier))) {
1929 /* turn all other tracks using this input on */
1930 _session->set_exclusive_input_active (mt, true);
1932 mt->set_input_active (true);
1940 MixerStrip::midi_input_status_changed ()
1942 if (midi_input_enable_button) {
1943 boost::shared_ptr<MidiTrack> mt = midi_track ();
1945 midi_input_enable_button->set_active (mt->input_active ());
1950 MixerStrip::state_id () const
1952 return string_compose ("strip %1", _route->id().to_s());