2 Copyright (C) 2000-2002 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.
23 #include <sigc++/bind.h>
25 #include <pbd/convert.h>
27 #include <gtkmm2ext/gtk_ui.h>
28 #include <gtkmm2ext/utils.h>
29 #include <gtkmm2ext/choice.h>
30 #include <gtkmm2ext/slider_controller.h>
31 #include <gtkmm2ext/stop_signal.h>
32 #include <gtkmm2ext/bindable_button.h>
33 #include <gtkmm2ext/doi.h>
35 #include <ardour/ardour.h>
36 #include <ardour/session.h>
37 #include <ardour/audioengine.h>
38 #include <ardour/route.h>
39 #include <ardour/audio_track.h>
40 #include <ardour/diskstream.h>
41 #include <ardour/panner.h>
42 #include <ardour/send.h>
43 #include <ardour/insert.h>
44 #include <ardour/ladspa_plugin.h>
45 #include <ardour/connection.h>
46 #include <ardour/session_connection.h>
48 #include "ardour_ui.h"
49 #include "ardour_dialog.h"
50 #include "mixer_strip.h"
53 #include "plugin_selector.h"
54 #include "public_editor.h"
56 #include "plugin_ui.h"
58 #include "io_selector.h"
60 #include "gui_thread.h"
65 using namespace ARDOUR;
67 using namespace Gtkmm2ext;
69 #ifdef VARISPEED_IN_MIXER_STRIP
71 speed_printer (char buf[32], Gtk::Adjustment& adj, void* arg)
73 float val = adj.get_value ();
78 snprintf (buf, 32, "%.3f", val);
83 MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, Route& rt, bool in_mixer)
85 RouteUI (rt, sess, _("mute"), _("solo"), _("RECORD")),
87 pre_redirect_box (PreFader, sess, rt, mx.plugin_selector(), mx.selection(), in_mixer),
88 post_redirect_box (PostFader, sess, rt, mx.plugin_selector(), mx.selection(), in_mixer),
90 panners (_route, sess),
92 gain_automation_style_button (""),
93 gain_automation_state_button (""),
94 pan_automation_style_button (""),
95 pan_automation_state_button (""),
96 comment_button (_("Comments")),
97 speed_adjustment (1.0, 0.001, 4.0, 0.001, 0.1),
98 speed_spinner (&speed_adjustment, "MixerStripSpeedBase", true)
101 if (set_color_from_route()) {
102 set_color (unique_random_color());
108 _marked_for_display = false;
110 ignore_comment_edit = false;
111 ignore_toggle = false;
112 ignore_speed_adjustment = false;
116 width_button.add (*(manage (new Gtk::Image (get_xpm("lr.xpm")))));
117 hide_button.add (*(manage (new Gtk::Image (get_xpm("small_x.xpm")))));
120 input_label.set_text (_("INPUT"));
121 input_button.add (input_label);
122 input_button.set_name ("MixerIOButton");
123 input_label.set_name ("MixerIOButtonLabel");
125 output_label.set_text (_("OUTPUT"));
126 output_button.add (output_label);
127 output_button.set_name ("MixerIOButton");
128 output_label.set_name ("MixerIOButtonLabel");
130 rec_enable_button->set_name ("MixerRecordEnableButton");
131 rec_enable_button->unset_flags (Gtk::CAN_FOCUS);
133 solo_button->set_name ("MixerSoloButton");
134 mute_button->set_name ("MixerMuteButton");
135 gain_automation_style_button.set_name ("MixerAutomationModeButton");
136 gain_automation_state_button.set_name ("MixerAutomationPlaybackButton");
137 pan_automation_style_button.set_name ("MixerAutomationModeButton");
138 pan_automation_state_button.set_name ("MixerAutomationPlaybackButton");
140 ARDOUR_UI::instance()->tooltips().set_tip (pan_automation_state_button, _("Pan automation mode"));
141 ARDOUR_UI::instance()->tooltips().set_tip (gain_automation_state_button, _("Gain automation mode"));
143 ARDOUR_UI::instance()->tooltips().set_tip (pan_automation_style_button, _("Pan automation type"));
144 ARDOUR_UI::instance()->tooltips().set_tip (gain_automation_style_button, _("Gain automation type"));
146 hide_button.set_events (hide_button.get_events() & ~(Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK));
148 width_button.unset_flags (Gtk::CAN_FOCUS);
149 hide_button.unset_flags (Gtk::CAN_FOCUS);
150 input_button.unset_flags (Gtk::CAN_FOCUS);
151 output_button.unset_flags (Gtk::CAN_FOCUS);
152 solo_button->unset_flags (Gtk::CAN_FOCUS);
153 mute_button->unset_flags (Gtk::CAN_FOCUS);
154 gain_automation_style_button.unset_flags (Gtk::CAN_FOCUS);
155 gain_automation_state_button.unset_flags (Gtk::CAN_FOCUS);
156 pan_automation_style_button.unset_flags (Gtk::CAN_FOCUS);
157 pan_automation_state_button.unset_flags (Gtk::CAN_FOCUS);
159 button_table.set_homogeneous (true);
160 button_table.set_spacings (0);
162 button_table.attach (name_button, 0, 2, 0, 1);
163 button_table.attach (group_button, 0, 2, 1, 2);
164 button_table.attach (input_button, 0, 2, 2, 3);
166 button_table.attach (*solo_button, 0, 1, 3, 4);
167 button_table.attach (*mute_button, 1, 2, 3, 4);
169 button_table.attach (gain_automation_state_button, 0, 1, 4, 5);
170 button_table.attach (pan_automation_state_button, 1, 2, 4, 5);
172 using namespace Menu_Helpers;
174 gain_astate_menu.items().push_back (MenuElem (_("off"),
175 bind (mem_fun (_route, &IO::set_gain_automation_state), (AutoState) Off)));
176 gain_astate_menu.items().push_back (MenuElem (_("play"),
177 bind (mem_fun (_route, &IO::set_gain_automation_state), (AutoState) Play)));
178 gain_astate_menu.items().push_back (MenuElem (_("write"),
179 bind (mem_fun (_route, &IO::set_gain_automation_state), (AutoState) Write)));
180 gain_astate_menu.items().push_back (MenuElem (_("touch"),
181 bind (mem_fun (_route, &IO::set_gain_automation_state), (AutoState) Touch)));
183 gain_astyle_menu.items().push_back (MenuElem (_("trim")));
184 gain_astyle_menu.items().push_back (MenuElem (_("abs")));
186 pan_astate_menu.items().push_back (MenuElem (_("off"),
187 bind (mem_fun (_route.panner(), &Panner::set_automation_state), (AutoState) Off)));
188 pan_astate_menu.items().push_back (MenuElem (_("play"),
189 bind (mem_fun (_route.panner(), &Panner::set_automation_state), (AutoState) Play)));
190 pan_astate_menu.items().push_back (MenuElem (_("write"),
191 bind (mem_fun (_route.panner(), &Panner::set_automation_state), (AutoState) Write)));
192 pan_astate_menu.items().push_back (MenuElem (_("touch"),
193 bind (mem_fun (_route.panner(), &Panner::set_automation_state), (AutoState) Touch)));
195 pan_astyle_menu.items().push_back (MenuElem (_("trim")));
196 pan_astyle_menu.items().push_back (MenuElem (_("abs")));
198 gain_astate_menu.set_name ("ArdourContextMenu");
199 gain_astyle_menu.set_name ("ArdourContextMenu");
200 pan_astate_menu.set_name ("ArdourContextMenu");
201 pan_astyle_menu.set_name ("ArdourContextMenu");
203 ARDOUR_UI::instance()->tooltips().set_tip (gain_automation_style_button, _("gain automation mode"));
204 ARDOUR_UI::instance()->tooltips().set_tip (pan_automation_style_button, _("pan automation mode"));
205 ARDOUR_UI::instance()->tooltips().set_tip (gain_automation_state_button, _("gain automation state"));
206 ARDOUR_UI::instance()->tooltips().set_tip (pan_automation_state_button, _("pan automation state"));
208 if (is_audio_track()) {
210 AudioTrack* at = dynamic_cast<AudioTrack*>(&_route);
212 at->FreezeChange.connect (mem_fun(*this, &MixerStrip::map_frozen));
214 #ifdef VARISPEED_IN_MIXER_STRIP
215 speed_adjustment.signal_value_changed().connect (mem_fun(*this, &MixerStrip::speed_adjustment_changed));
217 speed_frame.set_name ("BaseFrame");
218 speed_frame.set_shadow_type (Gtk::SHADOW_IN);
219 speed_frame.add (speed_spinner);
221 speed_spinner.set_print_func (speed_printer, 0);
223 ARDOUR_UI::instance()->tooltips().set_tip (speed_spinner, _("varispeed"));
225 button_table.attach (speed_frame, 0, 2, 5, 6);
226 #endif /* VARISPEED_IN_MIXER_STRIP */
228 button_table.attach (*rec_enable_button, 0, 2, 5, 6);
231 name_button.add (name_label);
232 name_button.set_name ("MixerNameButton");
233 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2);
235 name_label.set_name ("MixerNameButtonLabel");
236 name_label.set_text (_route.name());
238 group_button.add (group_label);
239 group_button.set_name ("MixerGroupButton");
240 group_label.set_name ("MixerGroupButtonLabel");
242 comment_button.set_name ("MixerCommentButton");
244 ARDOUR_UI::instance()->tooltips().set_tip (comment_button, _route.comment()=="" ?
245 _("Click to Add/Edit Comments"):
248 comment_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::comment_button_clicked));
250 global_vpacker.set_border_width (0);
251 global_vpacker.set_spacing (0);
253 Gtk::VBox *whvbox = manage (new Gtk::VBox);
255 width_button.set_name ("MixerWidthButton");
256 hide_button.set_name ("MixerHideButton");
258 width_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::width_clicked));
259 hide_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::hide_clicked));
261 width_hide_box.pack_start (width_button, false, true);
262 width_hide_box.pack_end (hide_button, false, true);
264 whvbox->pack_start (width_hide_box, true, true);
266 global_vpacker.pack_start (*whvbox, Gtk::PACK_SHRINK);
267 global_vpacker.pack_start (button_table,Gtk::PACK_SHRINK);
268 global_vpacker.pack_start (pre_redirect_box, true, true);
269 global_vpacker.pack_start (gpm, Gtk::PACK_SHRINK, 4);
270 global_vpacker.pack_start (post_redirect_box, true, true);
271 global_vpacker.pack_start (panners, Gtk::PACK_SHRINK);
272 global_vpacker.pack_start (output_button, Gtk::PACK_SHRINK);
273 global_vpacker.pack_start (comment_button, Gtk::PACK_SHRINK);
275 global_frame.add (global_vpacker);
276 global_frame.set_shadow_type (Gtk::SHADOW_IN);
277 global_frame.set_name ("BaseFrame");
281 /* force setting of visible selected status */
284 set_selected (false);
289 _route.input_changed.connect (mem_fun(*this, &MixerStrip::input_changed));
290 _route.output_changed.connect (mem_fun(*this, &MixerStrip::output_changed));
291 _route.mute_changed.connect (mem_fun(*this, &RouteUI::mute_changed));
292 _route.solo_changed.connect (mem_fun(*this, &RouteUI::solo_changed));
293 _route.solo_safe_changed.connect (mem_fun(*this, &RouteUI::solo_changed));
294 _route.mix_group_changed.connect (mem_fun(*this, &MixerStrip::mix_group_changed));
295 _route.gain_automation_curve().automation_state_changed.connect (mem_fun(*this, &MixerStrip::gain_automation_state_changed));
296 _route.gain_automation_curve().automation_style_changed.connect (mem_fun(*this, &MixerStrip::gain_automation_style_changed));
297 _route.panner().Changed.connect (mem_fun(*this, &MixerStrip::connect_to_pan));
299 if (is_audio_track()) {
300 audio_track()->diskstream_changed.connect (mem_fun(*this, &MixerStrip::diskstream_changed));
301 get_diskstream()->speed_changed.connect (mem_fun(*this, &MixerStrip::speed_changed));
304 _route.name_changed.connect (mem_fun(*this, &RouteUI::name_changed));
305 _route.comment_changed.connect (mem_fun(*this, &MixerStrip::comment_changed));
306 _route.gui_changed.connect (mem_fun(*this, &MixerStrip::route_gui_changed));
308 input_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::input_press), false);
309 output_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::output_press), false);
311 rec_enable_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::rec_enable_press));
312 solo_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::solo_press), false);
313 solo_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::solo_release), false);
314 mute_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::mute_press), false);
315 mute_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::mute_release), false);
317 gain_automation_style_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::gain_automation_style_button_event), false);
318 gain_automation_style_button.signal_button_release_event().connect (mem_fun(*this, &MixerStrip::gain_automation_style_button_event), false);
319 pan_automation_style_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::pan_automation_style_button_event), false);
320 pan_automation_style_button.signal_button_release_event().connect (mem_fun(*this, &MixerStrip::pan_automation_style_button_event), false);
322 gain_automation_state_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::gain_automation_state_button_event), false);
323 pan_automation_state_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::pan_automation_state_button_event), false);
325 name_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::name_button_button_press), false);
327 group_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::select_mix_group), false);
330 set_stuff_from_route ();
332 /* start off as a passthru strip. we'll correct this, if necessary,
333 in update_diskstream_display().
336 set_name ("AudioTrackStripBase");
338 /* now force an update of all the various elements */
340 pre_redirect_box.update();
341 post_redirect_box.update();
346 mix_group_changed (0);
347 gain_automation_state_changed ();
348 pan_automation_state_changed ();
351 panners.setup_pan ();
353 if (is_audio_track()) {
357 update_diskstream_display ();
358 update_input_display ();
359 update_output_display ();
361 add_events (Gdk::BUTTON_RELEASE_MASK);
364 MixerStrip::~MixerStrip ()
366 GoingAway(); /* EMIT_SIGNAL */
368 if (input_selector) {
369 delete input_selector;
372 if (output_selector) {
373 delete output_selector;
378 MixerStrip::set_stuff_from_route ()
384 if ((prop = xml_node->property ("strip_width")) != 0) {
385 if (prop->value() == "wide") {
387 } else if (prop->value() == "narrow") {
391 error << string_compose(_("unknown strip width \"%1\" in XML GUI information"), prop->value()) << endmsg;
399 if ((prop = xml_node->property ("shown_mixer")) != 0) {
400 if (prop->value() == "no") {
401 _marked_for_display = false;
403 _marked_for_display = true;
407 /* backwards compatibility */
408 _marked_for_display = true;
413 MixerStrip::set_width (Width w)
415 /* always set the gpm width again, things may be hidden */
417 panners.set_width (w);
418 pre_redirect_box.set_width (w);
419 post_redirect_box.set_width (w);
431 set_size_request (-1, -1);
432 xml_node->add_property ("strip_width", "wide");
434 rec_enable_button->set_label (_("RECORD"));
435 mute_button->set_label (_("mute"));
436 solo_button->set_label (_("solo"));
438 if (_route.comment() == "") {
439 comment_button.set_label (_("Comments"));
441 comment_button.set_label (_("*Comments*"));
444 gain_automation_style_button.set_label (astyle_string(_route.gain_automation_curve().automation_style()));
445 gain_automation_state_button.set_label (astate_string(_route.gain_automation_curve().automation_state()));
446 pan_automation_style_button.set_label (astyle_string(_route.panner().automation_style()));
447 pan_automation_state_button.set_label (astate_string(_route.panner().automation_state()));
448 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "long", 2, 2);
452 set_size_request (50, -1);
453 xml_node->add_property ("strip_width", "narrow");
455 rec_enable_button->set_label (_("REC"));
456 mute_button->set_label (_("m"));
457 solo_button->set_label (_("s"));
459 if (_route.comment() == "") {
460 comment_button.set_label (_("Cmt"));
462 comment_button.set_label (_("*Cmt*"));
465 gain_automation_style_button.set_label (short_astyle_string(_route.gain_automation_curve().automation_style()));
466 gain_automation_state_button.set_label (short_astate_string(_route.gain_automation_curve().automation_state()));
467 pan_automation_style_button.set_label (short_astyle_string(_route.panner().automation_style()));
468 pan_automation_state_button.set_label (short_astate_string(_route.panner().automation_state()));
469 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2);
473 update_input_display ();
474 update_output_display ();
475 mix_group_changed (0);
481 MixerStrip::set_packed (bool yn)
488 xml_node->add_property ("shown_mixer", "yes");
490 xml_node->add_property ("shown_mixer", "no");
496 MixerStrip::output_press (GdkEventButton *ev)
498 using namespace Menu_Helpers;
500 if (!_session.engine().connected()) {
501 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
506 MenuList& citems = output_menu.items();
507 output_menu.set_name ("ArdourContextMenu");
510 citems.push_back (MenuElem (_("Edit"), mem_fun(*this, &MixerStrip::edit_output_configuration)));
511 citems.push_back (SeparatorElem());
512 citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_output)));
513 citems.push_back (SeparatorElem());
515 _session.foreach_connection (this, &MixerStrip::add_connection_to_output_menu);
517 output_menu.popup (1, ev->time);
523 MixerStrip::edit_output_configuration ()
525 if (output_selector == 0) {
526 output_selector = new IOSelectorWindow (_session, _route, false);
529 if (output_selector->is_visible()) {
530 output_selector->get_toplevel()->get_window()->raise();
532 output_selector->show_all ();
537 MixerStrip::edit_input_configuration ()
539 if (input_selector == 0) {
540 input_selector = new IOSelectorWindow (_session, _route, true);
543 if (input_selector->is_visible()) {
544 input_selector->get_toplevel()->get_window()->raise();
546 input_selector->show_all ();
551 MixerStrip::input_press (GdkEventButton *ev)
553 using namespace Menu_Helpers;
555 MenuList& citems = input_menu.items();
556 input_menu.set_name ("ArdourContextMenu");
559 if (!_session.engine().connected()) {
560 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
565 #if ADVANCED_ROUTE_DISKSTREAM_CONNECTIVITY
566 if (is_audio_track()) {
567 citems.push_back (MenuElem (_("Track"), mem_fun(*this, &MixerStrip::select_stream_input)));
570 citems.push_back (MenuElem (_("Edit"), mem_fun(*this, &MixerStrip::edit_input_configuration)));
571 citems.push_back (SeparatorElem());
572 citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_input)));
573 citems.push_back (SeparatorElem());
575 _session.foreach_connection (this, &MixerStrip::add_connection_to_input_menu);
576 input_menu.popup (1, ev->time);
582 MixerStrip::connection_input_chosen (ARDOUR::Connection *c)
584 if (!ignore_toggle) {
587 _route.use_input_connection (*c, this);
590 catch (AudioEngine::PortRegistrationFailure& err) {
591 error << _("could not register new ports required for that connection")
598 MixerStrip::connection_output_chosen (ARDOUR::Connection *c)
600 if (!ignore_toggle) {
603 _route.use_output_connection (*c, this);
606 catch (AudioEngine::PortRegistrationFailure& err) {
607 error << _("could not register new ports required for that connection")
614 MixerStrip::add_connection_to_input_menu (ARDOUR::Connection* c)
616 using namespace Menu_Helpers;
618 if (dynamic_cast<InputConnection *> (c) == 0) {
622 MenuList& citems = input_menu.items();
624 if (c->nports() == _route.n_inputs()) {
626 citems.push_back (CheckMenuElem (c->name(), bind (mem_fun(*this, &MixerStrip::connection_input_chosen), c)));
628 ARDOUR::Connection *current = _route.input_connection();
631 ignore_toggle = true;
632 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
633 ignore_toggle = false;
639 MixerStrip::add_connection_to_output_menu (ARDOUR::Connection* c)
641 using namespace Menu_Helpers;
643 if (dynamic_cast<OutputConnection *> (c) == 0) {
647 if (c->nports() == _route.n_outputs()) {
649 MenuList& citems = output_menu.items();
650 citems.push_back (CheckMenuElem (c->name(), bind (mem_fun(*this, &MixerStrip::connection_output_chosen), c)));
652 ARDOUR::Connection *current = _route.output_connection();
655 ignore_toggle = true;
656 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
657 ignore_toggle = false;
663 MixerStrip::select_stream_input ()
665 using namespace Menu_Helpers;
667 Menu *stream_menu = manage (new Menu);
668 MenuList& items = stream_menu->items();
669 stream_menu->set_name ("ArdourContextMenu");
671 Session::DiskStreamList streams = _session.disk_streams();
673 for (Session::DiskStreamList::iterator i = streams.begin(); i != streams.end(); ++i) {
675 if (!(*i)->hidden()) {
677 items.push_back (CheckMenuElem ((*i)->name(), bind (mem_fun(*this, &MixerStrip::stream_input_chosen), *i)));
679 if (get_diskstream() == *i) {
680 ignore_toggle = true;
681 static_cast<CheckMenuItem *> (&items.back())->set_active (true);
682 ignore_toggle = false;
687 stream_menu->popup (1, 0);
691 MixerStrip::stream_input_chosen (DiskStream *stream)
693 if (is_audio_track()) {
694 audio_track()->set_diskstream (*stream, this);
699 MixerStrip::update_diskstream_display ()
701 if (is_audio_track()) {
705 update_input_display ();
707 if (input_selector) {
708 input_selector->hide_all ();
717 update_input_display ();
718 show_passthru_color ();
723 MixerStrip::connect_to_pan ()
725 ENSURE_GUI_THREAD(mem_fun(*this, &MixerStrip::connect_to_pan));
727 panstate_connection.disconnect ();
728 panstyle_connection.disconnect ();
730 if (!_route.panner().empty()) {
731 StreamPanner* sp = _route.panner().front();
733 panstate_connection = sp->automation().automation_state_changed.connect (mem_fun(*this, &MixerStrip::pan_automation_state_changed));
734 panstyle_connection = sp->automation().automation_style_changed.connect (mem_fun(*this, &MixerStrip::pan_automation_style_changed));
737 panners.pan_changed (this);
741 MixerStrip::update_input_display ()
743 ARDOUR::Connection *c;
745 if ((c = _route.input_connection()) != 0) {
746 input_label.set_text (c->name());
750 input_label.set_text (_("INPUT"));
753 input_label.set_text (_("IN"));
758 panners.setup_pan ();
762 MixerStrip::update_output_display ()
764 ARDOUR::Connection *c;
766 if ((c = _route.output_connection()) != 0) {
767 output_label.set_text (c->name());
771 output_label.set_text (_("OUTPUT"));
774 output_label.set_text (_("OUT"));
780 panners.setup_pan ();
784 MixerStrip::fast_update ()
786 gpm.update_meters ();
790 MixerStrip::gain_automation_state_button_event (GdkEventButton *ev)
792 if (ev->type == GDK_BUTTON_RELEASE) {
796 switch (ev->button) {
798 switch (ev->button) {
800 gain_astate_menu.popup (1, ev->time);
811 MixerStrip::gain_automation_style_button_event (GdkEventButton *ev)
813 if (ev->type == GDK_BUTTON_PRESS || ev->type == GDK_2BUTTON_PRESS) {
817 switch (ev->button) {
819 gain_astyle_menu.popup (1, ev->time);
828 MixerStrip::pan_automation_state_button_event (GdkEventButton *ev)
830 using namespace Menu_Helpers;
832 if (ev->type == GDK_BUTTON_RELEASE) {
836 switch (ev->button) {
838 pan_astate_menu.popup (1, ev->time);
848 MixerStrip::pan_automation_style_button_event (GdkEventButton *ev)
850 switch (ev->button) {
852 pan_astyle_menu.popup (1, ev->time);
861 MixerStrip::astate_string (AutoState state)
863 return _astate_string (state, false);
867 MixerStrip::short_astate_string (AutoState state)
869 return _astate_string (state, true);
873 MixerStrip::_astate_string (AutoState state, bool shrt)
879 sstr = (shrt ? "--" : _("off"));
882 sstr = (shrt ? "P" : _("aplay"));
885 sstr = (shrt ? "T" : _("touch"));
888 sstr = (shrt ? "W" : _("awrite"));
896 MixerStrip::astyle_string (AutoStyle style)
898 return _astyle_string (style, false);
902 MixerStrip::short_astyle_string (AutoStyle style)
904 return _astyle_string (style, true);
908 MixerStrip::_astyle_string (AutoStyle style, bool shrt)
913 /* XXX it might different in different languages */
915 return (shrt ? _("abs") : _("abs"));
920 MixerStrip::diskstream_changed (void *src)
922 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_diskstream_display));
926 MixerStrip::gain_automation_style_changed ()
930 gain_automation_style_button.set_label (astyle_string(_route.gain_automation_curve().automation_style()));
933 gain_automation_style_button.set_label (short_astyle_string(_route.gain_automation_curve().automation_style()));
939 MixerStrip::gain_automation_state_changed ()
941 ENSURE_GUI_THREAD(mem_fun(*this, &MixerStrip::gain_automation_state_changed));
947 gain_automation_state_button.set_label (astate_string(_route.gain_automation_curve().automation_state()));
950 gain_automation_state_button.set_label (short_astate_string(_route.gain_automation_curve().automation_state()));
954 x = (_route.gain_automation_state() != Off);
956 if (gain_automation_state_button.get_active() != x) {
957 ignore_toggle = true;
958 gain_automation_state_button.set_active (x);
959 ignore_toggle = false;
962 gpm.update_gain_sensitive ();
964 /* start watching automation so that things move */
966 gain_watching.disconnect();
969 gain_watching = ARDOUR_UI::RapidScreenUpdate.connect (mem_fun (gpm, &GainMeter::effective_gain_display));
974 MixerStrip::pan_automation_style_changed ()
976 ENSURE_GUI_THREAD(mem_fun(*this, &MixerStrip::pan_automation_style_changed));
980 pan_automation_style_button.set_label (astyle_string(_route.panner().automation_style()));
983 pan_automation_style_button.set_label (short_astyle_string(_route.panner().automation_style()));
989 MixerStrip::pan_automation_state_changed ()
991 ENSURE_GUI_THREAD(mem_fun(*this, &MixerStrip::pan_automation_state_changed));
997 pan_automation_state_button.set_label (astate_string(_route.panner().automation_state()));
1000 pan_automation_state_button.set_label (short_astate_string(_route.panner().automation_state()));
1004 /* when creating a new session, we get to create busses (and
1005 sometimes tracks) with no outputs by the time they get
1009 if (_route.panner().empty()) {
1013 x = (_route.panner().front()->automation().automation_state() != Off);
1015 if (pan_automation_state_button.get_active() != x) {
1016 ignore_toggle = true;
1017 pan_automation_state_button.set_active (x);
1018 ignore_toggle = false;
1021 panners.update_pan_sensitive ();
1023 /* start watching automation so that things move */
1025 pan_watching.disconnect();
1028 pan_watching = ARDOUR_UI::RapidScreenUpdate.connect (mem_fun (panners, &PannerUI::effective_pan_display));
1033 MixerStrip::input_changed (IOChange change, void *src)
1035 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_input_display));
1039 MixerStrip::output_changed (IOChange change, void *src)
1041 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_output_display));
1045 MixerStrip::comment_button_clicked ()
1047 if (comment_window == 0) {
1048 setup_comment_editor ();
1051 int x, y, cw_width, cw_height;
1053 if (comment_window->is_visible()) {
1054 string str = comment_area->get_buffer()->get_text();
1055 if (_route.comment() != str) {
1056 _route.set_comment (str, this);
1061 if (! str.empty()) {
1062 comment_button.set_label (_("*Comments*"));
1064 comment_button.set_label (_("Comments"));
1069 if (! str.empty()) {
1070 comment_button.set_label (_("*Cmt*"));
1072 comment_button.set_label (_("Cmt"));
1077 ARDOUR_UI::instance()->tooltips().set_tip (comment_button,
1078 str.empty() ? _("Click to Add/Edit Comments") : str);
1080 comment_window->hide ();
1083 comment_window->get_size (cw_width, cw_height);
1084 comment_window->get_position(x, y);
1085 comment_window->move(x, y - (cw_height / 2) - 45);
1087 half the dialog height minus the comments button height
1088 with some window decoration fudge thrown in.
1091 comment_window->show();
1092 comment_window->present();
1097 MixerStrip::setup_comment_editor ()
1100 title = _route.name();
1101 title += _(": comment editor");
1103 comment_window = new ArdourDialog (title, false);
1104 comment_window->set_position (Gtk::WIN_POS_MOUSE);
1105 comment_window->set_skip_taskbar_hint (true);
1107 comment_area = manage (new TextView());
1108 comment_area->set_name ("MixerTrackCommentArea");
1109 comment_area->set_size_request (110, 178);
1110 comment_area->set_wrap_mode (WRAP_WORD);
1111 comment_area->set_editable (true);
1112 comment_area->get_buffer()->set_text (_route.comment());
1113 comment_area->show ();
1115 comment_window->get_vbox()->pack_start (*comment_area);
1116 comment_window->get_action_area()->hide();
1120 MixerStrip::comment_changed (void *src)
1122 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::comment_changed), src));
1125 ignore_comment_edit = true;
1127 comment_area->get_buffer()->set_text (_route.comment());
1129 ignore_comment_edit = false;
1134 MixerStrip::set_mix_group (RouteGroup *rg)
1136 _route.set_mix_group (rg, this);
1140 MixerStrip::add_mix_group_to_menu (RouteGroup *rg, RadioMenuItem::Group* group)
1142 using namespace Menu_Helpers;
1144 MenuList& items = group_menu->items();
1146 items.push_back (RadioMenuElem (*group, rg->name(), bind (mem_fun(*this, &MixerStrip::set_mix_group), rg)));
1148 if (_route.mix_group() == rg) {
1149 static_cast<RadioMenuItem*>(&items.back())->set_active ();
1154 MixerStrip::select_mix_group (GdkEventButton *ev)
1156 using namespace Menu_Helpers;
1158 if (group_menu == 0) {
1159 group_menu = new Menu;
1161 group_menu->set_name ("ArdourContextMenu");
1162 MenuList& items = group_menu->items();
1163 RadioMenuItem::Group group;
1166 items.push_back (RadioMenuElem (group, _("no group"), bind (mem_fun(*this, &MixerStrip::set_mix_group), (RouteGroup *) 0)));
1168 _session.foreach_mix_group (bind (mem_fun (*this, &MixerStrip::add_mix_group_to_menu), &group));
1170 group_menu->popup (1, ev->time);
1176 MixerStrip::mix_group_changed (void *ignored)
1178 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::mix_group_changed), ignored));
1180 RouteGroup *rg = _route.mix_group();
1183 group_label.set_text (rg->name());
1187 group_label.set_text (_("no group"));
1190 group_label.set_text (_("~G"));
1198 MixerStrip::route_gui_changed (string what_changed, void* ignored)
1200 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::route_gui_changed), what_changed, ignored));
1202 if (what_changed == "color") {
1203 if (set_color_from_route () == 0) {
1204 show_route_color ();
1210 MixerStrip::show_route_color ()
1212 name_button.modify_bg (STATE_NORMAL, color());
1213 route_active_changed ();
1217 MixerStrip::show_passthru_color ()
1219 route_active_changed ();
1223 MixerStrip::build_route_ops_menu ()
1225 using namespace Menu_Helpers;
1227 route_ops_menu = manage (new Menu);
1228 route_ops_menu->set_name ("ArdourContextMenu");
1230 MenuList& items = route_ops_menu->items();
1232 items.push_back (MenuElem (_("Rename"), mem_fun(*this, &RouteUI::route_rename)));
1233 items.push_back (SeparatorElem());
1234 items.push_back (CheckMenuElem (_("Active"), mem_fun (*this, &RouteUI::toggle_route_active)));
1235 route_active_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
1236 route_active_menu_item->set_active (_route.active());
1237 items.push_back (SeparatorElem());
1238 items.push_back (CheckMenuElem (_("Invert Polarity"), mem_fun (*this, &RouteUI::toggle_polarity)));
1239 polarity_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
1240 polarity_menu_item->set_active (_route.phase_invert());
1242 build_remote_control_menu ();
1244 items.push_back (SeparatorElem());
1245 items.push_back (MenuElem (_("Remote Control ID"), *remote_control_menu));
1247 items.push_back (SeparatorElem());
1248 items.push_back (MenuElem (_("Remove"), mem_fun(*this, &RouteUI::remove_this_route)));
1252 MixerStrip::name_button_button_press (GdkEventButton* ev)
1254 if (ev->button == 1) {
1255 list_route_operations ();
1256 route_ops_menu->popup (1, ev->time);
1262 MixerStrip::list_route_operations ()
1264 if (route_ops_menu == 0) {
1265 build_route_ops_menu ();
1268 refresh_remote_control_menu();
1273 MixerStrip::speed_adjustment_changed ()
1275 /* since there is a usable speed adjustment, there has to be a diskstream */
1276 if (!ignore_speed_adjustment) {
1277 get_diskstream()->set_speed (speed_adjustment.get_value());
1282 MixerStrip::speed_changed ()
1284 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_speed_display));
1288 MixerStrip::update_speed_display ()
1292 val = get_diskstream()->speed();
1295 speed_spinner.set_name ("MixerStripSpeedBaseNotOne");
1297 speed_spinner.set_name ("MixerStripSpeedBase");
1300 if (speed_adjustment.get_value() != val) {
1301 ignore_speed_adjustment = true;
1302 speed_adjustment.set_value (val);
1303 ignore_speed_adjustment = false;
1309 MixerStrip::set_selected (bool yn)
1311 AxisView::set_selected (yn);
1313 global_frame.set_shadow_type (Gtk::SHADOW_ETCHED_OUT);
1314 global_frame.set_name ("MixerStripSelectedFrame");
1316 global_frame.set_shadow_type (Gtk::SHADOW_IN);
1317 global_frame.set_name ("MixerStripFrame");
1319 global_frame.queue_draw ();
1323 MixerStrip::name_changed (void *src)
1327 RouteUI::name_changed (src);
1330 name_label.set_text (PBD::short_version (_route.name(), 5));
1336 MixerStrip::width_clicked ()
1349 MixerStrip::hide_clicked ()
1352 Hiding(); /* EMIT_SIGNAL */
1354 _mixer.hide_strip (this);
1359 MixerStrip::set_embedded (bool yn)
1365 MixerStrip::map_frozen ()
1367 ENSURE_GUI_THREAD (mem_fun(*this, &MixerStrip::map_frozen));
1369 AudioTrack* at = dynamic_cast<AudioTrack*>(&_route);
1372 switch (at->freeze_state()) {
1373 case AudioTrack::Frozen:
1374 pre_redirect_box.set_sensitive (false);
1375 post_redirect_box.set_sensitive (false);
1376 speed_spinner.set_sensitive (false);
1379 pre_redirect_box.set_sensitive (true);
1380 post_redirect_box.set_sensitive (true);
1381 speed_spinner.set_sensitive (true);
1385 _route.foreach_redirect (this, &MixerStrip::hide_redirect_editor);
1389 MixerStrip::hide_redirect_editor (Redirect* redirect)
1391 void* gui = redirect->get_gui ();
1394 static_cast<Gtk::Widget*>(gui)->hide ();
1399 MixerStrip::route_active_changed ()
1401 RouteUI::route_active_changed ();
1403 if (is_audio_track()) {
1404 if (_route.active()) {
1405 set_name ("AudioTrackStripBase");
1406 gpm.set_meter_strip_name ("AudioTrackStripBase");
1408 set_name ("AudioTrackStripBaseInactive");
1409 gpm.set_meter_strip_name ("AudioTrackStripBaseInactive");
1411 gpm.set_fader_name ("AudioTrackFader");
1413 if (_route.active()) {
1414 set_name ("AudioBusStripBase");
1415 gpm.set_meter_strip_name ("AudioBusStripBase");
1417 set_name ("AudioBusStripBaseInactive");
1418 gpm.set_meter_strip_name ("AudioBusStripBaseInactive");
1420 gpm.set_fader_name ("AudioBusFader");
1425 MixerStrip::mix_group() const
1427 return _route.mix_group();