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"
59 #include "ardour_button.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 , rec_solo_table (2, 2)
90 , top_button_table (1, 2)
91 , middle_button_table (1, 2)
92 , bottom_button_table (1, 2)
93 , meter_point_label (_("pre"))
94 , midi_input_enable_button (0)
99 /* the editor mixer strip: don't destroy it every time
100 the underlying route goes away.
103 self_destruct = false;
107 MixerStrip::MixerStrip (Mixer_UI& mx, Session* sess, boost::shared_ptr<Route> rt, bool in_mixer)
111 , _mixer_owned (in_mixer)
112 , processor_box (sess, sigc::mem_fun(*this, &MixerStrip::plugin_selector), mx.selection(), this, in_mixer)
115 , button_table (3, 1)
116 , middle_button_table (1, 2)
117 , bottom_button_table (1, 2)
118 , meter_point_label (_("pre"))
119 , midi_input_enable_button (0)
132 ignore_comment_edit = false;
133 ignore_toggle = false;
139 /* the length of this string determines the width of the mixer strip when it is set to `wide' */
140 longest_label = "longest label";
144 img = manage (new Gtk::Image (::get_icon("strip_width")));
147 width_button.add (*img);
149 img = manage (new Gtk::Image (::get_icon("hide")));
152 hide_button.add (*img);
154 input_label.set_text (_("Input"));
155 ARDOUR_UI::instance()->set_tip (&input_button, _("Button 1 to choose inputs from a port matrix, button 3 to select inputs from a menu"), "");
156 input_button.add (input_label);
157 input_button.set_name ("MixerIOButton");
158 input_label.set_name ("MixerIOButtonLabel");
159 input_button_box.pack_start (input_button, true, true);
161 output_label.set_text (_("Output"));
162 ARDOUR_UI::instance()->set_tip (&output_button, _("Button 1 to choose outputs from a port matrix, button 3 to select inputs from a menu"), "");
163 output_button.add (output_label);
164 output_button.set_name ("MixerIOButton");
165 output_label.set_name ("MixerIOButtonLabel");
166 Gtkmm2ext::set_size_request_to_display_given_text (output_button, longest_label.c_str(), 4, 4);
168 ARDOUR_UI::instance()->set_tip (&meter_point_button, _("Select metering point"), "");
169 meter_point_button.add (meter_point_label);
170 meter_point_button.set_name ("MixerStripMeterPreButton");
171 meter_point_label.set_name ("MixerStripMeterPreButton");
173 /* TRANSLATORS: this string should be longest of the strings
174 used to describe meter points. In english, it's "input".
176 set_size_request_to_display_given_text (meter_point_button, _("tupni"), 5, 5);
178 bottom_button_table.attach (meter_point_button, 1, 2, 0, 1);
180 meter_point_button.signal_button_press_event().connect (sigc::mem_fun (gpm, &GainMeter::meter_press), false);
181 meter_point_button.signal_button_release_event().connect (sigc::mem_fun (gpm, &GainMeter::meter_release), false);
183 hide_button.set_events (hide_button.get_events() & ~(Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK));
185 mute_button->set_name ("MixerMuteButton");
186 solo_button->set_name ("MixerSoloButton");
188 monitor_input_button->set_diameter (3);
189 monitor_disk_button->set_diameter (3);
191 solo_isolated_led = manage (new ArdourButton);
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);
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 (true);
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 (true);
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 global_vpacker.set_border_width (0);
253 global_vpacker.set_spacing (0);
255 width_button.set_name ("MixerWidthButton");
256 hide_button.set_name ("MixerHideButton");
257 top_event_box.set_name ("MixerTopEventBox");
259 width_button.signal_clicked().connect (sigc::mem_fun(*this, &MixerStrip::width_clicked));
260 hide_button.signal_clicked().connect (sigc::mem_fun(*this, &MixerStrip::hide_clicked));
262 width_hide_box.pack_start (width_button, false, true);
263 width_hide_box.pack_start (top_event_box, true, true);
264 width_hide_box.pack_end (hide_button, false, true);
266 whvbox.pack_start (width_hide_box, true, true);
268 global_vpacker.pack_start (whvbox, Gtk::PACK_SHRINK);
269 global_vpacker.pack_start (button_table, Gtk::PACK_SHRINK);
270 global_vpacker.pack_start (processor_box, true, true);
271 global_vpacker.pack_start (panners, Gtk::PACK_SHRINK);
272 global_vpacker.pack_start (top_button_table, Gtk::PACK_SHRINK, 2);
273 global_vpacker.pack_start (rec_solo_table, Gtk::PACK_SHRINK, 2);
274 global_vpacker.pack_start (middle_button_table, Gtk::PACK_SHRINK, 2);
275 global_vpacker.pack_start (gpm, Gtk::PACK_SHRINK);
276 global_vpacker.pack_start (bottom_button_table, Gtk::PACK_SHRINK);
277 global_vpacker.pack_start (output_button, Gtk::PACK_SHRINK);
279 global_frame.add (global_vpacker);
280 global_frame.set_shadow_type (Gtk::SHADOW_IN);
281 global_frame.set_name ("BaseFrame");
285 /* force setting of visible selected status */
288 set_selected (false);
293 _session->engine().Stopped.connect (*this, invalidator (*this), boost::bind (&MixerStrip::engine_stopped, this), gui_context());
294 _session->engine().Running.connect (*this, invalidator (*this), boost::bind (&MixerStrip::engine_running, this), gui_context());
296 input_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MixerStrip::input_press), false);
297 output_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MixerStrip::output_press), false);
299 /* we don't need this if its not an audio track, but we don't know that yet and it doesn't
303 rec_enable_button->set_name ("MixerRecordEnableButton");
305 /* ditto for this button and busses */
307 name_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MixerStrip::name_button_button_press), false);
308 group_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MixerStrip::select_route_group), false);
312 /* start off as a passthru strip. we'll correct this, if necessary,
313 in update_diskstream_display().
316 /* start off as a passthru strip. we'll correct this, if necessary,
317 in update_diskstream_display().
321 set_name ("MidiTrackStripBase");
323 set_name ("AudioTrackStripBase");
325 add_events (Gdk::BUTTON_RELEASE_MASK|
326 Gdk::ENTER_NOTIFY_MASK|
327 Gdk::LEAVE_NOTIFY_MASK|
329 Gdk::KEY_RELEASE_MASK);
331 set_flags (get_flags() | Gtk::CAN_FOCUS);
333 SwitchIO.connect (sigc::mem_fun (*this, &MixerStrip::switch_io));
335 AudioEngine::instance()->PortConnectedOrDisconnected.connect (
336 *this, invalidator (*this), boost::bind (&MixerStrip::port_connected_or_disconnected, this, _1, _3), gui_context ()
340 MixerStrip::~MixerStrip ()
342 CatchDeletion (this);
344 delete input_selector;
345 delete output_selector;
346 delete comment_window;
350 MixerStrip::set_route (boost::shared_ptr<Route> rt)
352 if (rec_enable_button->get_parent()) {
353 rec_solo_table.remove (*rec_enable_button);
356 if (show_sends_button->get_parent()) {
357 rec_solo_table.remove (*show_sends_button);
360 processor_box.set_route (rt);
362 RouteUI::set_route (rt);
364 /* map the current state */
367 update_solo_display ();
369 delete input_selector;
372 delete output_selector;
375 revert_to_default_display ();
377 if (route()->is_master()) {
378 solo_button->hide ();
379 rec_solo_table.hide ();
381 solo_button->show ();
382 rec_solo_table.show ();
385 if (_mixer_owned && (route()->is_master() || route()->is_monitor())) {
387 if (scrollbar_height == 0) {
388 HScrollbar scrollbar;
389 Gtk::Requisition requisition(scrollbar.size_request ());
390 scrollbar_height = requisition.height;
393 spacer = manage (new EventBox);
394 spacer->set_size_request (-1, scrollbar_height);
395 global_vpacker.pack_start (*spacer, false, false);
399 monitor_input_button->show ();
400 monitor_disk_button->show ();
402 monitor_input_button->hide();
403 monitor_disk_button->hide ();
406 if (is_midi_track()) {
407 if (midi_input_enable_button == 0) {
408 Image* img = manage (new Image (get_icon (X_("midi_socket_small"))));
409 midi_input_enable_button = manage (new StatefulToggleButton);
410 midi_input_enable_button->set_name ("MixerMidiInputEnableButton");
411 midi_input_enable_button->set_image (*img);
412 midi_input_enable_button->signal_button_press_event().connect (sigc::mem_fun (*this, &MixerStrip::input_active_button_press), false);
413 midi_input_enable_button->signal_button_release_event().connect (sigc::mem_fun (*this, &MixerStrip::input_active_button_release), false);
414 ARDOUR_UI::instance()->set_tip (midi_input_enable_button, _("Enable/Disable MIDI input"));
416 input_button_box.remove (*midi_input_enable_button);
418 /* get current state */
419 midi_input_status_changed ();
420 input_button_box.pack_start (*midi_input_enable_button, false, false);
422 midi_track()->InputActiveChanged.connect (route_connections, invalidator (*this), boost::bind (&MixerStrip::midi_input_status_changed, this), gui_context());
424 if (midi_input_enable_button) {
425 /* removal from the container will delete it */
426 input_button_box.remove (*midi_input_enable_button);
427 midi_input_enable_button = 0;
431 if (is_audio_track()) {
432 boost::shared_ptr<AudioTrack> at = audio_track();
433 at->FreezeChange.connect (route_connections, invalidator (*this), boost::bind (&MixerStrip::map_frozen, this), gui_context());
436 if (has_audio_outputs ()) {
444 rec_solo_table.attach (*rec_enable_button, 0, 1, 0, 2);
445 rec_enable_button->set_sensitive (_session->writable());
446 rec_enable_button->show();
452 if (!_route->is_master()) {
453 rec_solo_table.attach (*show_sends_button, 0, 1, 0, 2);
454 show_sends_button->show();
458 meter_point_label.set_text (meter_point_string (_route->meter_point()));
460 delete route_ops_menu;
463 _route->meter_change.connect (route_connections, invalidator (*this), bind (&MixerStrip::meter_changed, this), gui_context());
464 _route->route_group_changed.connect (route_connections, invalidator (*this), boost::bind (&MixerStrip::route_group_changed, this), gui_context());
466 if (_route->panner_shell()) {
467 _route->panner_shell()->Changed.connect (route_connections, invalidator (*this), boost::bind (&MixerStrip::connect_to_pan, this), gui_context());
470 if (is_audio_track()) {
471 audio_track()->DiskstreamChanged.connect (route_connections, invalidator (*this), boost::bind (&MixerStrip::diskstream_changed, this), gui_context());
474 _route->comment_changed.connect (route_connections, invalidator (*this), ui_bind (&MixerStrip::comment_changed, this, _1), gui_context());
476 set_stuff_from_route ();
478 /* now force an update of all the various elements */
481 update_solo_display ();
484 route_group_changed ();
487 panners.setup_pan ();
489 update_diskstream_display ();
490 update_input_display ();
491 update_output_display ();
493 add_events (Gdk::BUTTON_RELEASE_MASK);
495 processor_box.show ();
497 if (!route()->is_master() && !route()->is_monitor()) {
498 /* we don't allow master or control routes to be hidden */
503 width_hide_box.show();
506 global_vpacker.show();
508 middle_button_table.show();
509 bottom_button_table.show();
511 gain_unit_button.show();
512 gain_unit_label.show();
513 meter_point_button.show();
514 meter_point_label.show();
515 diskstream_button.show();
516 diskstream_label.show();
517 input_button_box.show_all();
518 output_button.show();
529 MixerStrip::set_stuff_from_route ()
531 /* if width is not set, it will be set by the MixerUI or editor */
533 string str = gui_property ("strip-width");
535 set_width_enum (Width (string_2_enum (str, _width)), this);
540 MixerStrip::set_width_enum (Width w, void* owner)
542 /* always set the gpm width again, things may be hidden */
545 panners.set_width (w);
547 boost::shared_ptr<AutomationList> gain_automation = _route->gain_control()->alist();
549 _width_owner = owner;
553 if (_width_owner == this) {
554 set_gui_property ("strip-width", enum_2_string (_width));
561 if (show_sends_button) {
562 ((Gtk::Label*)show_sends_button->get_child())->set_text (_("Sends"));
565 ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (
566 gpm.astyle_string(gain_automation->automation_style()));
567 ((Gtk::Label*)gpm.gain_automation_state_button.get_child())->set_text (
568 gpm.astate_string(gain_automation->automation_state()));
570 if (_route->panner()) {
571 ((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text (
572 panners.astyle_string(_route->panner()->automation_style()));
573 ((Gtk::Label*)panners.pan_automation_state_button.get_child())->set_text (
574 panners.astate_string(_route->panner()->automation_state()));
577 solo_isolated_led->set_text (_("iso"));
578 solo_safe_led->set_text (_("lock"));
580 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "long", 2, 2);
581 set_size_request (-1, -1);
585 if (show_sends_button) {
586 ((Gtk::Label*)show_sends_button->get_child())->set_text (_("Snd"));
589 ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (
590 gpm.short_astyle_string(gain_automation->automation_style()));
591 ((Gtk::Label*)gpm.gain_automation_state_button.get_child())->set_text (
592 gpm.short_astate_string(gain_automation->automation_state()));
594 if (_route->panner()) {
595 ((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text (
596 panners.short_astyle_string(_route->panner()->automation_style()));
597 ((Gtk::Label*)panners.pan_automation_state_button.get_child())->set_text (
598 panners.short_astate_string(_route->panner()->automation_state()));
601 solo_isolated_led->set_text ("");
602 solo_safe_led->set_text ("");
604 Gtkmm2ext::set_size_request_to_display_given_text (name_button, longest_label.c_str(), 2, 2);
605 set_size_request (max (50, gpm.get_gm_width()), -1);
609 processor_box.set_width (w);
611 update_input_display ();
612 update_output_display ();
613 route_group_changed ();
619 MixerStrip::set_packed (bool yn)
624 set_gui_property ("visible", true);
626 set_gui_property ("visible", false);
631 struct RouteCompareByName {
632 bool operator() (boost::shared_ptr<Route> a, boost::shared_ptr<Route> b) {
633 return a->name().compare (b->name()) < 0;
638 MixerStrip::output_press (GdkEventButton *ev)
640 using namespace Menu_Helpers;
641 if (!_session->engine().connected()) {
642 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
647 MenuList& citems = output_menu.items();
648 switch (ev->button) {
651 edit_output_configuration ();
656 output_menu.set_name ("ArdourContextMenu");
658 output_menu_bundles.clear ();
660 citems.push_back (MenuElem (_("Disconnect"), sigc::mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_output)));
661 citems.push_back (SeparatorElem());
663 ARDOUR::BundleList current = _route->output()->bundles_connected ();
665 boost::shared_ptr<ARDOUR::BundleList> b = _session->bundles ();
667 /* give user bundles first chance at being in the menu */
669 for (ARDOUR::BundleList::iterator i = b->begin(); i != b->end(); ++i) {
670 if (boost::dynamic_pointer_cast<UserBundle> (*i)) {
671 maybe_add_bundle_to_output_menu (*i, current);
675 for (ARDOUR::BundleList::iterator i = b->begin(); i != b->end(); ++i) {
676 if (boost::dynamic_pointer_cast<UserBundle> (*i) == 0) {
677 maybe_add_bundle_to_output_menu (*i, current);
681 boost::shared_ptr<ARDOUR::RouteList> routes = _session->get_routes ();
682 RouteList copy = *routes;
683 copy.sort (RouteCompareByName ());
684 for (ARDOUR::RouteList::const_iterator i = copy.begin(); i != copy.end(); ++i) {
685 maybe_add_bundle_to_output_menu ((*i)->input()->bundle(), current);
688 if (citems.size() == 2) {
689 /* no routes added; remove the separator */
693 output_menu.popup (1, ev->time);
704 MixerStrip::edit_output_configuration ()
706 if (output_selector == 0) {
708 boost::shared_ptr<Send> send;
709 boost::shared_ptr<IO> output;
711 if ((send = boost::dynamic_pointer_cast<Send>(_current_delivery)) != 0) {
712 if (!boost::dynamic_pointer_cast<InternalSend>(send)) {
713 output = send->output();
715 output = _route->output ();
718 output = _route->output ();
721 output_selector = new IOSelectorWindow (_session, output);
724 if (output_selector->is_visible()) {
725 output_selector->get_toplevel()->get_window()->raise();
727 output_selector->present ();
732 MixerStrip::edit_input_configuration ()
734 if (input_selector == 0) {
735 input_selector = new IOSelectorWindow (_session, _route->input());
738 if (input_selector->is_visible()) {
739 input_selector->get_toplevel()->get_window()->raise();
741 input_selector->present ();
746 MixerStrip::input_press (GdkEventButton *ev)
748 using namespace Menu_Helpers;
750 MenuList& citems = input_menu.items();
751 input_menu.set_name ("ArdourContextMenu");
754 if (!_session->engine().connected()) {
755 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
760 if (_session->actively_recording() && _route->record_enabled())
763 switch (ev->button) {
766 edit_input_configuration ();
771 citems.push_back (MenuElem (_("Disconnect"), sigc::mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_input)));
772 citems.push_back (SeparatorElem());
773 input_menu_bundles.clear ();
775 ARDOUR::BundleList current = _route->input()->bundles_connected ();
777 boost::shared_ptr<ARDOUR::BundleList> b = _session->bundles ();
779 /* give user bundles first chance at being in the menu */
781 for (ARDOUR::BundleList::iterator i = b->begin(); i != b->end(); ++i) {
782 if (boost::dynamic_pointer_cast<UserBundle> (*i)) {
783 maybe_add_bundle_to_input_menu (*i, current);
787 for (ARDOUR::BundleList::iterator i = b->begin(); i != b->end(); ++i) {
788 if (boost::dynamic_pointer_cast<UserBundle> (*i) == 0) {
789 maybe_add_bundle_to_input_menu (*i, current);
793 boost::shared_ptr<ARDOUR::RouteList> routes = _session->get_routes ();
794 RouteList copy = *routes;
795 copy.sort (RouteCompareByName ());
796 for (ARDOUR::RouteList::const_iterator i = copy.begin(); i != copy.end(); ++i) {
797 maybe_add_bundle_to_input_menu ((*i)->output()->bundle(), current);
800 if (citems.size() == 2) {
801 /* no routes added; remove the separator */
805 input_menu.popup (1, ev->time);
815 MixerStrip::bundle_input_toggled (boost::shared_ptr<ARDOUR::Bundle> c)
821 ARDOUR::BundleList current = _route->input()->bundles_connected ();
823 if (std::find (current.begin(), current.end(), c) == current.end()) {
824 _route->input()->connect_ports_to_bundle (c, this);
826 _route->input()->disconnect_ports_from_bundle (c, this);
831 MixerStrip::bundle_output_toggled (boost::shared_ptr<ARDOUR::Bundle> c)
837 ARDOUR::BundleList current = _route->output()->bundles_connected ();
839 if (std::find (current.begin(), current.end(), c) == current.end()) {
840 _route->output()->connect_ports_to_bundle (c, this);
842 _route->output()->disconnect_ports_from_bundle (c, this);
847 MixerStrip::maybe_add_bundle_to_input_menu (boost::shared_ptr<Bundle> b, ARDOUR::BundleList const & current)
849 using namespace Menu_Helpers;
851 if (b->ports_are_outputs() == false || b->nchannels() != _route->n_inputs()) {
855 list<boost::shared_ptr<Bundle> >::iterator i = input_menu_bundles.begin ();
856 while (i != input_menu_bundles.end() && b->has_same_ports (*i) == false) {
860 if (i != input_menu_bundles.end()) {
864 input_menu_bundles.push_back (b);
866 MenuList& citems = input_menu.items();
868 std::string n = b->name ();
869 replace_all (n, "_", " ");
871 citems.push_back (CheckMenuElem (n, sigc::bind (sigc::mem_fun(*this, &MixerStrip::bundle_input_toggled), b)));
873 if (std::find (current.begin(), current.end(), b) != current.end()) {
874 ignore_toggle = true;
875 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
876 ignore_toggle = false;
881 MixerStrip::maybe_add_bundle_to_output_menu (boost::shared_ptr<Bundle> b, ARDOUR::BundleList const & current)
883 using namespace Menu_Helpers;
885 if (b->ports_are_inputs() == false || b->nchannels() != _route->n_outputs()) {
889 list<boost::shared_ptr<Bundle> >::iterator i = output_menu_bundles.begin ();
890 while (i != output_menu_bundles.end() && b->has_same_ports (*i) == false) {
894 if (i != output_menu_bundles.end()) {
898 output_menu_bundles.push_back (b);
900 MenuList& citems = output_menu.items();
902 std::string n = b->name ();
903 replace_all (n, "_", " ");
905 citems.push_back (CheckMenuElem (n, sigc::bind (sigc::mem_fun(*this, &MixerStrip::bundle_output_toggled), b)));
907 if (std::find (current.begin(), current.end(), b) != current.end()) {
908 ignore_toggle = true;
909 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
910 ignore_toggle = false;
915 MixerStrip::update_diskstream_display ()
919 if (input_selector) {
920 input_selector->hide_all ();
923 route_color_changed ();
927 show_passthru_color ();
932 MixerStrip::connect_to_pan ()
934 ENSURE_GUI_THREAD (*this, &MixerStrip::connect_to_pan)
936 panstate_connection.disconnect ();
937 panstyle_connection.disconnect ();
939 if (!_route->panner()) {
943 boost::shared_ptr<Pannable> p = _route->pannable ();
945 p->automation_state_changed.connect (panstate_connection, invalidator (*this), boost::bind (&PannerUI::pan_automation_state_changed, &panners), gui_context());
946 p->automation_style_changed.connect (panstyle_connection, invalidator (*this), boost::bind (&PannerUI::pan_automation_style_changed, &panners), gui_context());
948 panners.panshell_changed ();
953 * Output port labelling
954 * =====================
956 * Case 1: Each output has one connection, all connections are to system:playback_%i
957 * out 1 -> system:playback_1
958 * out 2 -> system:playback_2
959 * out 3 -> system:playback_3
962 * Case 2: Each output has one connection, all connections are to ardour:track_x/in 1
963 * out 1 -> ardour:track_x/in 1
964 * out 2 -> ardour:track_x/in 2
965 * Display as: track_x
967 * Case 3: Each output has one connection, all connections are to Jack client "program x"
968 * out 1 -> program x:foo
969 * out 2 -> program x:foo
970 * Display as: program x
972 * Case 4: No connections (Disconnected)
975 * Default case (unusual routing):
976 * Display as: *number of connections*
980 * .-----------------------------------------------.
982 * | out 1 -> ardour:master/in 1, jamin:input/in 1 |
983 * | out 2 -> ardour:master/in 2, jamin:input/in 2 |
984 * '-----------------------------------------------'
985 * .-----------------------------------------------.
988 * '-----------------------------------------------'
992 MixerStrip::update_io_button (boost::shared_ptr<ARDOUR::Route> route, Width width, bool for_input)
997 vector<string> port_connections;
999 uint32_t total_connection_count = 0;
1000 uint32_t io_connection_count = 0;
1001 uint32_t ardour_connection_count = 0;
1002 uint32_t system_connection_count = 0;
1003 uint32_t other_connection_count = 0;
1005 ostringstream label;
1006 string label_string;
1008 bool have_label = false;
1009 bool each_io_has_one_connection = true;
1011 string connection_name;
1012 string ardour_track_name;
1013 string other_connection_type;
1014 string system_ports;
1017 ostringstream tooltip;
1018 char * tooltip_cstr;
1020 tooltip << route->name();
1023 io_count = route->n_inputs().n_total();
1025 io_count = route->n_outputs().n_total();
1028 for (io_index = 0; io_index < io_count; ++io_index) {
1030 port = route->input()->nth (io_index);
1032 port = route->output()->nth (io_index);
1035 port_connections.clear ();
1036 port->get_connections(port_connections);
1037 io_connection_count = 0;
1039 if (!port_connections.empty()) {
1040 for (vector<string>::iterator i = port_connections.begin(); i != port_connections.end(); ++i) {
1041 string& connection_name (*i);
1043 if (io_connection_count == 0) {
1044 tooltip << endl << port->name().substr(port->name().find("/") + 1) << " -> " << connection_name;
1046 tooltip << ", " << connection_name;
1049 if (connection_name.find("ardour:") == 0) {
1050 if (ardour_track_name.empty()) {
1051 // "ardour:Master/in 1" -> "ardour:Master/"
1052 string::size_type slash = connection_name.find("/");
1053 if (slash != string::npos) {
1054 ardour_track_name = connection_name.substr(0, slash + 1);
1058 if (connection_name.find(ardour_track_name) == 0) {
1059 ++ardour_connection_count;
1061 } else if (connection_name.find("system:") == 0) {
1063 // "system:capture_123" -> "123"
1064 system_port = connection_name.substr(15);
1066 // "system:playback_123" -> "123"
1067 system_port = connection_name.substr(16);
1070 if (system_ports.empty()) {
1071 system_ports += system_port;
1073 system_ports += "/" + system_port;
1076 ++system_connection_count;
1078 if (other_connection_type.empty()) {
1079 // "jamin:in 1" -> "jamin:"
1080 other_connection_type = connection_name.substr(0, connection_name.find(":") + 1);
1083 if (connection_name.find(other_connection_type) == 0) {
1084 ++other_connection_count;
1088 ++total_connection_count;
1089 ++io_connection_count;
1093 if (io_connection_count != 1) {
1094 each_io_has_one_connection = false;
1098 if (total_connection_count == 0) {
1099 tooltip << endl << _("Disconnected");
1102 tooltip_cstr = new char[tooltip.str().size() + 1];
1103 strcpy(tooltip_cstr, tooltip.str().c_str());
1106 ARDOUR_UI::instance()->set_tip (&input_button, tooltip_cstr, "");
1108 ARDOUR_UI::instance()->set_tip (&output_button, tooltip_cstr, "");
1111 if (each_io_has_one_connection) {
1112 if ((total_connection_count == ardour_connection_count)) {
1113 // all connections are to the same track in ardour
1114 // "ardour:Master/" -> "Master"
1115 string::size_type slash = ardour_track_name.find("/");
1116 if (slash != string::npos) {
1117 label << ardour_track_name.substr(7, slash - 7);
1121 else if (total_connection_count == system_connection_count) {
1122 // all connections are to system ports
1123 label << system_ports;
1126 else if (total_connection_count == other_connection_count) {
1127 // all connections are to the same external program eg jamin
1128 // "jamin:" -> "jamin"
1129 label << other_connection_type.substr(0, other_connection_type.size() - 1);
1135 if (total_connection_count == 0) {
1139 // Odd configuration
1140 label << "*" << total_connection_count << "*";
1146 label_string = label.str().substr(0, 6);
1149 label_string = label.str().substr(0, 3);
1154 input_label.set_text (label_string);
1156 output_label.set_text (label_string);
1161 MixerStrip::update_input_display ()
1163 update_io_button (_route, _width, true);
1164 panners.setup_pan ();
1168 MixerStrip::update_output_display ()
1170 update_io_button (_route, _width, false);
1171 gpm.setup_meters ();
1172 panners.setup_pan ();
1176 MixerStrip::fast_update ()
1178 gpm.update_meters ();
1182 MixerStrip::diskstream_changed ()
1184 Gtkmm2ext::UI::instance()->call_slot (invalidator (*this), boost::bind (&MixerStrip::update_diskstream_display, this));
1188 MixerStrip::port_connected_or_disconnected (Port* a, Port* b)
1190 if (_route->input()->has_port (a) || _route->input()->has_port (b)) {
1191 update_input_display ();
1192 set_width_enum (_width, this);
1195 if (_route->output()->has_port (a) || _route->output()->has_port (b)) {
1196 update_output_display ();
1197 set_width_enum (_width, this);
1202 MixerStrip::comment_editor_done_editing ()
1204 ignore_toggle = true;
1205 _comment_menu_item->set_active (false);
1206 ignore_toggle = false;
1208 string const str = comment_area->get_buffer()->get_text();
1209 if (str == _route->comment ()) {
1213 _route->set_comment (str, this);
1217 MixerStrip::toggle_comment ()
1219 if (ignore_toggle) {
1223 if (comment_window == 0) {
1224 setup_comment_editor ();
1227 if (comment_window->is_visible ()) {
1228 comment_window->hide ();
1233 title = _route->name();
1234 title += _(": comment editor");
1236 comment_window->set_title (title);
1237 comment_window->present();
1241 MixerStrip::setup_comment_editor ()
1243 comment_window = new ArdourDialog ("", false); // title will be reset to show route
1244 comment_window->set_position (Gtk::WIN_POS_MOUSE);
1245 comment_window->set_skip_taskbar_hint (true);
1246 comment_window->signal_hide().connect (sigc::mem_fun(*this, &MixerStrip::comment_editor_done_editing));
1247 comment_window->set_default_size (400, 200);
1249 comment_area = manage (new TextView());
1250 comment_area->set_name ("MixerTrackCommentArea");
1251 comment_area->set_wrap_mode (WRAP_WORD);
1252 comment_area->set_editable (true);
1253 comment_area->get_buffer()->set_text (_route->comment());
1254 comment_area->show ();
1256 comment_window->get_vbox()->pack_start (*comment_area);
1257 comment_window->get_action_area()->hide();
1261 MixerStrip::comment_changed (void *src)
1263 ENSURE_GUI_THREAD (*this, &MixerStrip::comment_changed, src)
1266 ignore_comment_edit = true;
1268 comment_area->get_buffer()->set_text (_route->comment());
1270 ignore_comment_edit = false;
1275 MixerStrip::select_route_group (GdkEventButton *ev)
1277 using namespace Menu_Helpers;
1279 if (ev->button == 1) {
1281 if (group_menu == 0) {
1283 PropertyList* plist = new PropertyList();
1285 plist->add (Properties::gain, true);
1286 plist->add (Properties::mute, true);
1287 plist->add (Properties::solo, true);
1289 group_menu = new RouteGroupMenu (_session, plist);
1293 r.push_back (route ());
1294 group_menu->build (r);
1295 group_menu->menu()->popup (1, ev->time);
1302 MixerStrip::route_group_changed ()
1304 ENSURE_GUI_THREAD (*this, &MixerStrip::route_group_changed)
1306 RouteGroup *rg = _route->route_group();
1309 group_label.set_text (PBD::short_version (rg->name(), 5));
1313 group_label.set_text (_("Grp"));
1316 group_label.set_text (_("~G"));
1323 MixerStrip::route_color_changed ()
1325 name_button.modify_bg (STATE_NORMAL, color());
1326 top_event_box.modify_bg (STATE_NORMAL, color());
1327 reset_strip_style ();
1331 MixerStrip::show_passthru_color ()
1333 reset_strip_style ();
1337 MixerStrip::build_route_ops_menu ()
1339 using namespace Menu_Helpers;
1340 route_ops_menu = new Menu;
1341 route_ops_menu->set_name ("ArdourContextMenu");
1343 MenuList& items = route_ops_menu->items();
1345 items.push_back (CheckMenuElem (_("Comments..."), sigc::mem_fun (*this, &MixerStrip::toggle_comment)));
1346 _comment_menu_item = dynamic_cast<CheckMenuItem*> (&items.back ());
1347 items.push_back (MenuElem (_("Save As Template..."), sigc::mem_fun(*this, &RouteUI::save_as_template)));
1348 items.push_back (MenuElem (_("Rename..."), sigc::mem_fun(*this, &RouteUI::route_rename)));
1349 rename_menu_item = &items.back();
1350 items.push_back (SeparatorElem());
1351 items.push_back (CheckMenuElem (_("Active")));
1352 CheckMenuItem* i = dynamic_cast<CheckMenuItem *> (&items.back());
1353 i->set_active (_route->active());
1354 i->signal_activate().connect (sigc::bind (sigc::mem_fun (*this, &RouteUI::set_route_active), !_route->active(), false));
1356 items.push_back (SeparatorElem());
1358 items.push_back (MenuElem (_("Adjust Latency..."), sigc::mem_fun (*this, &RouteUI::adjust_latency)));
1360 items.push_back (SeparatorElem());
1361 items.push_back (CheckMenuElem (_("Protect Against Denormals"), sigc::mem_fun (*this, &RouteUI::toggle_denormal_protection)));
1362 denormal_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
1363 denormal_menu_item->set_active (_route->denormal_protection());
1365 if (!Profile->get_sae()) {
1366 items.push_back (SeparatorElem());
1367 items.push_back (MenuElem (_("Remote Control ID..."), sigc::mem_fun (*this, &RouteUI::open_remote_control_id_dialog)));
1370 items.push_back (SeparatorElem());
1371 items.push_back (MenuElem (_("Remove"), sigc::bind (sigc::mem_fun(*this, &RouteUI::remove_this_route), false)));
1375 MixerStrip::name_button_button_press (GdkEventButton* ev)
1377 if (ev->button == 3) {
1378 list_route_operations ();
1380 /* do not allow rename if the track is record-enabled */
1381 rename_menu_item->set_sensitive (!_route->record_enabled());
1382 route_ops_menu->popup (1, ev->time);
1384 } else if (ev->button == 1) {
1385 revert_to_default_display ();
1392 MixerStrip::list_route_operations ()
1394 delete route_ops_menu;
1395 build_route_ops_menu ();
1399 MixerStrip::set_selected (bool yn)
1401 AxisView::set_selected (yn);
1403 global_frame.set_shadow_type (Gtk::SHADOW_ETCHED_OUT);
1404 global_frame.set_name ("MixerStripSelectedFrame");
1406 global_frame.set_shadow_type (Gtk::SHADOW_IN);
1407 global_frame.set_name ("MixerStripFrame");
1409 global_frame.queue_draw ();
1413 MixerStrip::name_changed ()
1417 RouteUI::property_changed (PropertyChange (ARDOUR::Properties::name));
1420 name_label.set_text (PBD::short_version (_route->name(), 5));
1426 MixerStrip::width_clicked ()
1430 set_width_enum (Narrow, this);
1433 set_width_enum (Wide, this);
1439 MixerStrip::hide_clicked ()
1441 // LAME fix to reset the button status for when it is redisplayed (part 1)
1442 hide_button.set_sensitive(false);
1445 Hiding(); /* EMIT_SIGNAL */
1447 _mixer.hide_strip (this);
1451 hide_button.set_sensitive(true);
1455 MixerStrip::set_embedded (bool yn)
1461 MixerStrip::map_frozen ()
1463 ENSURE_GUI_THREAD (*this, &MixerStrip::map_frozen)
1465 boost::shared_ptr<AudioTrack> at = audio_track();
1468 switch (at->freeze_state()) {
1469 case AudioTrack::Frozen:
1470 processor_box.set_sensitive (false);
1471 hide_redirect_editors ();
1474 processor_box.set_sensitive (true);
1475 // XXX need some way, maybe, to retoggle redirect editors
1482 MixerStrip::hide_redirect_editors ()
1484 _route->foreach_processor (sigc::mem_fun (*this, &MixerStrip::hide_processor_editor));
1488 MixerStrip::hide_processor_editor (boost::weak_ptr<Processor> p)
1490 boost::shared_ptr<Processor> processor (p.lock ());
1495 Gtk::Window* w = processor_box.get_processor_ui (processor);
1503 MixerStrip::reset_strip_style ()
1505 if (_current_delivery && boost::dynamic_pointer_cast<Send>(_current_delivery)) {
1507 gpm.set_fader_name ("SendStripBase");
1511 if (is_midi_track()) {
1512 if (_route->active()) {
1513 set_name ("MidiTrackStripBase");
1514 gpm.set_meter_strip_name ("MidiTrackMetrics");
1516 set_name ("MidiTrackStripBaseInactive");
1517 gpm.set_meter_strip_name ("MidiTrackMetricsInactive");
1519 gpm.set_fader_name ("MidiTrackFader");
1520 } else if (is_audio_track()) {
1521 if (_route->active()) {
1522 set_name ("AudioTrackStripBase");
1523 gpm.set_meter_strip_name ("AudioTrackMetrics");
1525 set_name ("AudioTrackStripBaseInactive");
1526 gpm.set_meter_strip_name ("AudioTrackMetricsInactive");
1528 gpm.set_fader_name ("AudioTrackFader");
1530 if (_route->active()) {
1531 set_name ("AudioBusStripBase");
1532 gpm.set_meter_strip_name ("AudioBusMetrics");
1534 set_name ("AudioBusStripBaseInactive");
1535 gpm.set_meter_strip_name ("AudioBusMetricsInactive");
1537 gpm.set_fader_name ("AudioBusFader");
1539 /* (no MIDI busses yet) */
1545 MixerStrip::route_group() const
1547 return _route->route_group();
1551 MixerStrip::engine_stopped ()
1556 MixerStrip::engine_running ()
1561 MixerStrip::meter_point_string (MeterPoint mp)
1572 case MeterPostFader:
1587 /** Called when the metering point has changed */
1589 MixerStrip::meter_changed ()
1591 meter_point_label.set_text (meter_point_string (_route->meter_point()));
1592 gpm.setup_meters ();
1593 // reset peak when meter point changes
1594 gpm.reset_peak_display();
1598 MixerStrip::switch_io (boost::shared_ptr<Route> target)
1600 /* don't respond to switch IO signal outside of the mixer window */
1602 if (!_mixer_owned) {
1606 if (_route == target || _route->is_master()) {
1607 /* don't change the display for the target or the master bus */
1609 } else if (!is_track() && show_sends_button) {
1610 /* make sure our show sends button is inactive, and we no longer blink,
1611 since we're not the target.
1613 send_blink_connection.disconnect ();
1614 show_sends_button->set_active (false);
1615 show_sends_button->set_state (STATE_NORMAL);
1619 /* switch back to default */
1620 revert_to_default_display ();
1624 boost::shared_ptr<Send> send = _route->internal_send_for (target);
1629 revert_to_default_display ();
1634 MixerStrip::drop_send ()
1636 boost::shared_ptr<Send> current_send;
1638 if (_current_delivery && (current_send = boost::dynamic_pointer_cast<Send>(_current_delivery))) {
1639 current_send->set_metering (false);
1642 send_gone_connection.disconnect ();
1643 input_button.set_sensitive (true);
1644 output_button.set_sensitive (true);
1645 group_button.set_sensitive (true);
1646 set_invert_sensitive (true);
1647 meter_point_button.set_sensitive (true);
1648 mute_button->set_sensitive (true);
1649 solo_button->set_sensitive (true);
1650 rec_enable_button->set_sensitive (true);
1651 solo_isolated_led->set_sensitive (true);
1652 solo_safe_led->set_sensitive (true);
1653 monitor_input_button->set_sensitive (true);
1654 monitor_disk_button->set_sensitive (true);
1658 MixerStrip::set_current_delivery (boost::shared_ptr<Delivery> d)
1660 _current_delivery = d;
1661 DeliveryChanged (_current_delivery);
1665 MixerStrip::show_send (boost::shared_ptr<Send> send)
1671 set_current_delivery (send);
1673 send->set_metering (true);
1674 _current_delivery->DropReferences.connect (send_gone_connection, invalidator (*this), boost::bind (&MixerStrip::revert_to_default_display, this), gui_context());
1676 gain_meter().set_controls (_route, send->meter(), send->amp());
1677 gain_meter().setup_meters ();
1679 panner_ui().set_panner (_current_delivery->panner_shell(), _current_delivery->panner());
1680 panner_ui().setup_pan ();
1682 input_button.set_sensitive (false);
1683 group_button.set_sensitive (false);
1684 set_invert_sensitive (false);
1685 meter_point_button.set_sensitive (false);
1686 mute_button->set_sensitive (false);
1687 solo_button->set_sensitive (false);
1688 rec_enable_button->set_sensitive (false);
1689 solo_isolated_led->set_sensitive (false);
1690 solo_safe_led->set_sensitive (false);
1691 monitor_input_button->set_sensitive (false);
1692 monitor_disk_button->set_sensitive (false);
1694 if (boost::dynamic_pointer_cast<InternalSend>(send)) {
1695 output_button.set_sensitive (false);
1698 reset_strip_style ();
1702 MixerStrip::revert_to_default_display ()
1704 if (show_sends_button) {
1705 show_sends_button->set_active (false);
1710 set_current_delivery (_route->main_outs ());
1712 gain_meter().set_controls (_route, _route->shared_peak_meter(), _route->amp());
1713 gain_meter().setup_meters ();
1715 panner_ui().set_panner (_route->main_outs()->panner_shell(), _route->main_outs()->panner());
1716 panner_ui().setup_pan ();
1718 reset_strip_style ();
1722 MixerStrip::set_button_names ()
1726 rec_enable_button_label.set_text (_("Rec"));
1727 mute_button_label.set_text (_("Mute"));
1728 monitor_input_button->set_text (_("In"));
1729 monitor_disk_button->set_text (_("Disk"));
1731 if (_route && _route->solo_safe()) {
1732 solo_button->remove ();
1733 if (solo_safe_image == 0) {
1734 solo_safe_image = new Gtk::Image (::get_icon("solo-safe-enabled"));
1735 solo_safe_image->show ();
1737 solo_button->add (*solo_safe_image);
1739 solo_button->remove ();
1740 solo_button->add (solo_button_label);
1741 solo_button_label.show ();
1742 if (!Config->get_solo_control_is_listen_control()) {
1743 solo_button_label.set_text (_("Solo"));
1745 switch (Config->get_listen_position()) {
1746 case AfterFaderListen:
1747 solo_button_label.set_text (_("AFL"));
1749 case PreFaderListen:
1750 solo_button_label.set_text (_("PFL"));
1758 rec_enable_button_label.set_text (_("R"));
1759 mute_button_label.set_text (_("M"));
1760 monitor_input_button->set_text (_("I"));
1761 monitor_disk_button->set_text (_("D"));
1762 if (_route && _route->solo_safe()) {
1763 solo_button->remove ();
1764 if (solo_safe_image == 0) {
1765 solo_safe_image = new Gtk::Image (::get_icon("solo-safe-enabled"));
1766 solo_safe_image->show ();
1768 solo_button->add (*solo_safe_image);
1770 solo_button->remove ();
1771 solo_button->add (solo_button_label);
1772 solo_button_label.show ();
1773 if (!Config->get_solo_control_is_listen_control()) {
1774 solo_button_label.set_text (_("S"));
1776 switch (Config->get_listen_position()) {
1777 case AfterFaderListen:
1778 solo_button_label.set_text (_("A"));
1780 case PreFaderListen:
1781 solo_button_label.set_text (_("P"));
1792 MixerStrip::on_key_press_event (GdkEventKey* ev)
1794 GdkEventButton fake;
1795 fake.type = GDK_BUTTON_PRESS;
1797 fake.state = ev->state;
1799 switch (ev->keyval) {
1811 rec_enable_press (&fake);
1816 show_sends_press (&fake);
1821 if (ev->state & Keyboard::PrimaryModifier) {
1831 _route->set_gain (1.0, this);
1844 MixerStrip::on_key_release_event (GdkEventKey* ev)
1846 GdkEventButton fake;
1847 fake.type = GDK_BUTTON_RELEASE;
1849 fake.state = ev->state;
1851 switch (ev->keyval) {
1853 mute_release (&fake);
1858 solo_release (&fake);
1863 rec_enable_release (&fake);
1868 show_sends_release (&fake);
1884 MixerStrip::on_enter_notify_event (GdkEventCrossing*)
1886 Keyboard::magic_widget_grab_focus ();
1891 MixerStrip::on_leave_notify_event (GdkEventCrossing* ev)
1893 switch (ev->detail) {
1894 case GDK_NOTIFY_INFERIOR:
1897 Keyboard::magic_widget_drop_focus ();
1904 MixerStrip::plugin_selector()
1906 return _mixer.plugin_selector();
1910 MixerStrip::hide_things ()
1912 processor_box.hide_things ();
1916 MixerStrip::input_active_button_press (GdkEventButton*)
1918 /* nothing happens on press */
1923 MixerStrip::input_active_button_release (GdkEventButton* ev)
1925 boost::shared_ptr<MidiTrack> mt = midi_track ();
1931 if (mt->input_active()) {
1932 if (Keyboard::modifier_state_contains (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::SecondaryModifier))) {
1933 /* turn all other tracks using this input off */
1934 _session->set_exclusive_input_active (mt, false);
1936 mt->set_input_active (false);
1940 if (Keyboard::modifier_state_contains (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::SecondaryModifier))) {
1941 /* turn all other tracks using this input on */
1942 _session->set_exclusive_input_active (mt, true);
1944 mt->set_input_active (true);
1952 MixerStrip::midi_input_status_changed ()
1954 if (midi_input_enable_button) {
1955 boost::shared_ptr<MidiTrack> mt = midi_track ();
1957 midi_input_enable_button->set_active (mt->input_active ());
1962 MixerStrip::state_id () const
1964 return string_compose ("strip %1", _route->id().to_s());