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.
21 #include <sigc++/bind.h>
23 #include <pbd/convert.h>
25 #include <gtkmm2ext/gtk_ui.h>
26 #include <gtkmm2ext/utils.h>
27 #include <gtkmm2ext/choice.h>
28 #include <gtkmm2ext/stop_signal.h>
29 #include <gtkmm2ext/doi.h>
30 #include <gtkmm2ext/slider_controller.h>
31 #include <gtkmm2ext/bindable_button.h>
33 #include <ardour/ardour.h>
34 #include <ardour/session.h>
35 #include <ardour/audioengine.h>
36 #include <ardour/route.h>
37 #include <ardour/audio_track.h>
38 #include <ardour/audio_diskstream.h>
39 #include <ardour/panner.h>
40 #include <ardour/send.h>
41 #include <ardour/insert.h>
42 #include <ardour/ladspa_plugin.h>
43 #include <ardour/connection.h>
44 #include <ardour/session_connection.h>
46 #include "ardour_ui.h"
47 #include "ardour_dialog.h"
48 #include "mixer_strip.h"
51 #include "public_editor.h"
53 #include "io_selector.h"
55 #include "gui_thread.h"
60 using namespace ARDOUR;
63 using namespace Gtkmm2ext;
65 #ifdef VARISPEED_IN_MIXER_STRIP
67 speed_printer (char buf[32], Gtk::Adjustment& adj, void* arg)
69 float val = adj.get_value ();
74 snprintf (buf, 32, "%.3f", val);
79 MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, boost::shared_ptr<Route> rt, bool in_mixer)
81 RouteUI (rt, sess, _("Mute"), _("Solo"), _("Record")),
83 pre_redirect_box (PreFader, sess, rt, mx.plugin_selector(), mx.selection(), in_mixer),
84 post_redirect_box (PostFader, sess, rt, mx.plugin_selector(), mx.selection(), in_mixer),
86 panners (_route, sess),
88 middle_button_table (1, 2),
89 bottom_button_table (1, 2),
90 meter_point_label (_("pre")),
91 comment_button (_("Comments")),
92 speed_adjustment (1.0, 0.001, 4.0, 0.001, 0.1),
93 speed_spinner (&speed_adjustment, "MixerStripSpeedBase", true)
96 if (set_color_from_route()) {
97 set_color (unique_random_color());
103 _marked_for_display = false;
105 ignore_comment_edit = false;
106 ignore_toggle = false;
107 ignore_speed_adjustment = false;
111 width_button.add (*(manage (new Gtk::Image (get_xpm("lr.xpm")))));
112 hide_button.add (*(manage (new Gtk::Image (get_xpm("small_x.xpm")))));
114 input_label.set_text (_("Input"));
115 input_button.add (input_label);
116 input_button.set_name ("MixerIOButton");
117 input_label.set_name ("MixerIOButtonLabel");
119 output_label.set_text (_("Output"));
120 output_button.add (output_label);
121 output_button.set_name ("MixerIOButton");
122 output_label.set_name ("MixerIOButtonLabel");
124 _route->meter_change.connect (mem_fun(*this, &MixerStrip::meter_changed));
125 meter_point_button.add (meter_point_label);
126 meter_point_button.set_name ("MixerStripMeterPreButton");
127 meter_point_label.set_name ("MixerStripMeterPreButton");
129 switch (_route->meter_point()) {
131 meter_point_label.set_text (_("input"));
135 meter_point_label.set_text (_("pre"));
139 meter_point_label.set_text (_("post"));
143 /* TRANSLATORS: this string should be longest of the strings
144 used to describe meter points. In english, its "input".
147 set_size_request_to_display_given_text (meter_point_button, _("tupni"), 5, 5);
150 bottom_button_table.attach (meter_point_button, 1, 2, 0, 1);
153 meter_point_button.signal_button_press_event().connect (mem_fun (gpm, &GainMeter::meter_press), false);
154 /* XXX what is this meant to do? */
155 //meter_point_button.signal_button_release_event().connect (mem_fun (gpm, &GainMeter::meter_release), false);
157 solo_button->set_name ("MixerSoloButton");
158 mute_button->set_name ("MixerMuteButton");
160 hide_button.set_events (hide_button.get_events() & ~(Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK));
162 width_button.unset_flags (Gtk::CAN_FOCUS);
163 hide_button.unset_flags (Gtk::CAN_FOCUS);
164 input_button.unset_flags (Gtk::CAN_FOCUS);
165 output_button.unset_flags (Gtk::CAN_FOCUS);
166 solo_button->unset_flags (Gtk::CAN_FOCUS);
167 mute_button->unset_flags (Gtk::CAN_FOCUS);
169 button_table.set_homogeneous (true);
170 button_table.set_spacings (0);
172 button_table.attach (name_button, 0, 2, 0, 1);
173 button_table.attach (input_button, 0, 2, 1, 2);
175 middle_button_table.set_homogeneous (true);
176 middle_button_table.set_spacings (0);
177 middle_button_table.attach (*mute_button, 0, 1, 0, 1);
178 middle_button_table.attach (*solo_button, 1, 2, 0, 1);
180 bottom_button_table.set_col_spacings (0);
181 bottom_button_table.set_homogeneous (true);
182 bottom_button_table.attach (group_button, 0, 1, 0, 1);
184 if (is_audio_track()) {
186 rec_enable_button->set_name ("MixerRecordEnableButton");
187 rec_enable_button->unset_flags (Gtk::CAN_FOCUS);
188 rec_enable_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::rec_enable_press));
190 AudioTrack* at = audio_track();
192 at->FreezeChange.connect (mem_fun(*this, &MixerStrip::map_frozen));
194 #ifdef VARISPEED_IN_MIXER_STRIP
195 speed_adjustment.signal_value_changed().connect (mem_fun(*this, &MixerStrip::speed_adjustment_changed));
197 speed_frame.set_name ("BaseFrame");
198 speed_frame.set_shadow_type (Gtk::SHADOW_IN);
199 speed_frame.add (speed_spinner);
201 speed_spinner.set_print_func (speed_printer, 0);
203 ARDOUR_UI::instance()->tooltips().set_tip (speed_spinner, _("Varispeed"));
205 button_table.attach (speed_frame, 0, 2, 5, 6);
206 #endif /* VARISPEED_IN_MIXER_STRIP */
208 button_table.attach (*rec_enable_button, 0, 2, 2, 3);
211 name_button.add (name_label);
212 name_button.set_name ("MixerNameButton");
213 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2);
215 name_label.set_name ("MixerNameButtonLabel");
216 if (_route->phase_invert()) {
217 name_label.set_text (X_("Ø ") + name_label.get_text());
219 name_label.set_text (_route->name());
222 group_button.add (group_label);
223 group_button.set_name ("MixerGroupButton");
224 group_label.set_name ("MixerGroupButtonLabel");
226 comment_button.set_name ("MixerCommentButton");
228 ARDOUR_UI::instance()->tooltips().set_tip (comment_button, _route->comment()=="" ?
229 _("Click to Add/Edit Comments"):
232 comment_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::comment_button_clicked));
234 global_vpacker.set_border_width (0);
235 global_vpacker.set_spacing (0);
237 Gtk::VBox *whvbox = manage (new Gtk::VBox);
239 width_button.set_name ("MixerWidthButton");
240 hide_button.set_name ("MixerHideButton");
242 width_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::width_clicked));
243 hide_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::hide_clicked));
245 width_hide_box.pack_start (width_button, false, true);
246 width_hide_box.pack_end (hide_button, false, true);
247 Gtk::Alignment *gain_meter_alignment = Gtk::manage(new Gtk::Alignment());
248 gain_meter_alignment->set_padding(0, 4, 0, 0);
249 gain_meter_alignment->add(gpm);
251 whvbox->pack_start (width_hide_box, true, true);
253 global_vpacker.pack_start (*whvbox, Gtk::PACK_SHRINK);
254 global_vpacker.pack_start (button_table,Gtk::PACK_SHRINK);
255 global_vpacker.pack_start (pre_redirect_box, true, true);
256 global_vpacker.pack_start (middle_button_table,Gtk::PACK_SHRINK);
257 global_vpacker.pack_start (*gain_meter_alignment,Gtk::PACK_SHRINK);
258 global_vpacker.pack_start (bottom_button_table,Gtk::PACK_SHRINK);
259 global_vpacker.pack_start (post_redirect_box, true, true);
260 global_vpacker.pack_start (panners, Gtk::PACK_SHRINK);
261 global_vpacker.pack_start (output_button, Gtk::PACK_SHRINK);
262 global_vpacker.pack_start (comment_button, Gtk::PACK_SHRINK);
264 global_frame.add (global_vpacker);
265 global_frame.set_shadow_type (Gtk::SHADOW_IN);
266 global_frame.set_name ("BaseFrame");
270 /* force setting of visible selected status */
273 set_selected (false);
278 _session.engine().Stopped.connect (mem_fun(*this, &MixerStrip::engine_stopped));
279 _session.engine().Running.connect (mem_fun(*this, &MixerStrip::engine_running));
280 _route->input_changed.connect (mem_fun(*this, &MixerStrip::input_changed));
281 _route->output_changed.connect (mem_fun(*this, &MixerStrip::output_changed));
282 _route->mute_changed.connect (mem_fun(*this, &RouteUI::mute_changed));
283 _route->solo_changed.connect (mem_fun(*this, &RouteUI::solo_changed));
284 _route->solo_safe_changed.connect (mem_fun(*this, &RouteUI::solo_changed));
285 _route->mix_group_changed.connect (mem_fun(*this, &MixerStrip::mix_group_changed));
286 _route->panner().Changed.connect (mem_fun(*this, &MixerStrip::connect_to_pan));
288 if (is_audio_track()) {
289 audio_track()->DiskstreamChanged.connect (mem_fun(*this, &MixerStrip::diskstream_changed));
290 get_diskstream()->SpeedChanged.connect (mem_fun(*this, &MixerStrip::speed_changed));
293 _route->name_changed.connect (mem_fun(*this, &RouteUI::name_changed));
294 _route->comment_changed.connect (mem_fun(*this, &MixerStrip::comment_changed));
295 _route->gui_changed.connect (mem_fun(*this, &MixerStrip::route_gui_changed));
297 input_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::input_press), false);
298 output_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::output_press), false);
300 solo_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::solo_press), false);
301 solo_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::solo_release), false);
302 mute_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::mute_press), false);
303 mute_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::mute_release), false);
305 name_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::name_button_button_press), false);
306 group_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::select_mix_group), false);
309 set_stuff_from_route ();
311 /* start off as a passthru strip. we'll correct this, if necessary,
312 in update_diskstream_display().
315 set_name ("AudioTrackStripBase");
317 /* now force an update of all the various elements */
319 pre_redirect_box.update();
320 post_redirect_box.update();
325 mix_group_changed (0);
329 panners.setup_pan ();
331 if (is_audio_track()) {
335 update_diskstream_display ();
336 update_input_display ();
337 update_output_display ();
339 add_events (Gdk::BUTTON_RELEASE_MASK);
342 MixerStrip::~MixerStrip ()
344 GoingAway(); /* EMIT_SIGNAL */
346 if (input_selector) {
347 delete input_selector;
350 if (output_selector) {
351 delete output_selector;
356 MixerStrip::set_stuff_from_route ()
362 if ((prop = xml_node->property ("strip_width")) != 0) {
363 if (prop->value() == "wide") {
365 } else if (prop->value() == "narrow") {
369 error << string_compose(_("unknown strip width \"%1\" in XML GUI information"), prop->value()) << endmsg;
377 if ((prop = xml_node->property ("shown_mixer")) != 0) {
378 if (prop->value() == "no") {
379 _marked_for_display = false;
381 _marked_for_display = true;
385 /* backwards compatibility */
386 _marked_for_display = true;
391 MixerStrip::set_width (Width w)
393 /* always set the gpm width again, things may be hidden */
395 panners.set_width (w);
396 pre_redirect_box.set_width (w);
397 post_redirect_box.set_width (w);
409 set_size_request (-1, -1);
410 xml_node->add_property ("strip_width", "wide");
412 if (rec_enable_button) {
413 rec_enable_button->set_label (_("record"));
415 mute_button->set_label (_("mute"));
416 solo_button->set_label (_("solo"));
418 if (_route->comment() == "") {
419 comment_button.set_label (_("comments"));
421 comment_button.set_label (_("*comments*"));
424 gpm.gain_automation_style_button.set_label (gpm.astyle_string(_route->gain_automation_curve().automation_style()));
425 gpm.gain_automation_state_button.set_label (gpm.astate_string(_route->gain_automation_curve().automation_state()));
426 panners.pan_automation_style_button.set_label (panners.astyle_string(_route->panner().automation_style()));
427 panners.pan_automation_state_button.set_label (panners.astate_string(_route->panner().automation_state()));
428 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "long", 2, 2);
432 set_size_request (50, -1);
433 xml_node->add_property ("strip_width", "narrow");
435 if (rec_enable_button) {
436 rec_enable_button->set_label (_("Rec"));
438 mute_button->set_label (_("M"));
439 solo_button->set_label (_("S"));
441 if (_route->comment() == "") {
442 comment_button.set_label (_("Cmt"));
444 comment_button.set_label (_("*Cmt*"));
447 gpm.gain_automation_style_button.set_label (gpm.short_astyle_string(_route->gain_automation_curve().automation_style()));
448 gpm.gain_automation_state_button.set_label (gpm.short_astate_string(_route->gain_automation_curve().automation_state()));
449 panners.pan_automation_style_button.set_label (panners.short_astyle_string(_route->panner().automation_style()));
450 panners.pan_automation_state_button.set_label (panners.short_astate_string(_route->panner().automation_state()));
451 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2);
455 update_input_display ();
456 update_output_display ();
457 mix_group_changed (0);
463 MixerStrip::set_packed (bool yn)
470 xml_node->add_property ("shown_mixer", "yes");
472 xml_node->add_property ("shown_mixer", "no");
478 MixerStrip::output_press (GdkEventButton *ev)
480 using namespace Menu_Helpers;
481 if (!_session.engine().connected()) {
482 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
487 MenuList& citems = output_menu.items();
488 switch (ev->button) {
491 output_menu.set_name ("ArdourContextMenu");
494 citems.push_back (MenuElem (_("Edit"), mem_fun(*this, &MixerStrip::edit_output_configuration)));
495 citems.push_back (SeparatorElem());
496 citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_output)));
497 citems.push_back (SeparatorElem());
499 _session.foreach_connection (this, &MixerStrip::add_connection_to_output_menu);
501 output_menu.popup (1, ev->time);
511 MixerStrip::edit_output_configuration ()
513 if (output_selector == 0) {
514 output_selector = new IOSelectorWindow (_session, _route, false);
517 if (output_selector->is_visible()) {
518 output_selector->get_toplevel()->get_window()->raise();
520 output_selector->show_all ();
525 MixerStrip::edit_input_configuration ()
527 if (input_selector == 0) {
528 input_selector = new IOSelectorWindow (_session, _route, true);
531 if (input_selector->is_visible()) {
532 input_selector->get_toplevel()->get_window()->raise();
534 input_selector->show_all ();
539 MixerStrip::input_press (GdkEventButton *ev)
541 using namespace Menu_Helpers;
543 MenuList& citems = input_menu.items();
544 input_menu.set_name ("ArdourContextMenu");
547 if (!_session.engine().connected()) {
548 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
553 switch (ev->button) {
557 citems.push_back (MenuElem (_("Edit"), mem_fun(*this, &MixerStrip::edit_input_configuration)));
558 citems.push_back (SeparatorElem());
559 citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_input)));
560 citems.push_back (SeparatorElem());
562 _session.foreach_connection (this, &MixerStrip::add_connection_to_input_menu);
563 input_menu.popup (1, ev->time);
573 MixerStrip::connection_input_chosen (ARDOUR::Connection *c)
575 if (!ignore_toggle) {
578 _route->use_input_connection (*c, this);
581 catch (AudioEngine::PortRegistrationFailure& err) {
582 error << _("could not register new ports required for that connection")
589 MixerStrip::connection_output_chosen (ARDOUR::Connection *c)
591 if (!ignore_toggle) {
594 _route->use_output_connection (*c, this);
597 catch (AudioEngine::PortRegistrationFailure& err) {
598 error << _("could not register new ports required for that connection")
605 MixerStrip::add_connection_to_input_menu (ARDOUR::Connection* c)
607 using namespace Menu_Helpers;
609 if (dynamic_cast<InputConnection *> (c) == 0) {
613 MenuList& citems = input_menu.items();
615 if (c->nports() == _route->n_inputs().get_total()) {
617 citems.push_back (CheckMenuElem (c->name(), bind (mem_fun(*this, &MixerStrip::connection_input_chosen), c)));
619 ARDOUR::Connection *current = _route->input_connection();
622 ignore_toggle = true;
623 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
624 ignore_toggle = false;
630 MixerStrip::add_connection_to_output_menu (ARDOUR::Connection* c)
632 using namespace Menu_Helpers;
634 if (dynamic_cast<OutputConnection *> (c) == 0) {
638 if (c->nports() == _route->n_outputs().get_total()) {
640 MenuList& citems = output_menu.items();
641 citems.push_back (CheckMenuElem (c->name(), bind (mem_fun(*this, &MixerStrip::connection_output_chosen), c)));
643 ARDOUR::Connection *current = _route->output_connection();
646 ignore_toggle = true;
647 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
648 ignore_toggle = false;
654 MixerStrip::update_diskstream_display ()
656 if (is_audio_track()) {
660 update_input_display ();
662 if (input_selector) {
663 input_selector->hide_all ();
672 update_input_display ();
673 show_passthru_color ();
678 MixerStrip::connect_to_pan ()
680 ENSURE_GUI_THREAD(mem_fun(*this, &MixerStrip::connect_to_pan));
682 panstate_connection.disconnect ();
683 panstyle_connection.disconnect ();
685 if (!_route->panner().empty()) {
686 StreamPanner* sp = _route->panner().front();
688 panstate_connection = sp->automation().automation_state_changed.connect (mem_fun(panners, &PannerUI::pan_automation_state_changed));
689 panstyle_connection = sp->automation().automation_style_changed.connect (mem_fun(panners, &PannerUI::pan_automation_style_changed));
692 panners.pan_changed (this);
696 MixerStrip::update_input_display ()
698 ARDOUR::Connection *c;
700 if ((c = _route->input_connection()) != 0) {
701 input_label.set_text (c->name());
705 input_label.set_text (_(" Input"));
708 input_label.set_text (_("I"));
712 panners.setup_pan ();
716 MixerStrip::update_output_display ()
718 ARDOUR::Connection *c;
720 if ((c = _route->output_connection()) != 0) {
721 output_label.set_text (c->name());
725 output_label.set_text (_("Output"));
728 output_label.set_text (_("O"));
733 panners.setup_pan ();
737 MixerStrip::fast_update ()
739 gpm.update_meters ();
743 MixerStrip::diskstream_changed ()
745 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_diskstream_display));
749 MixerStrip::input_changed (IOChange change, void *src)
751 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_input_display));
755 MixerStrip::output_changed (IOChange change, void *src)
757 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_output_display));
761 MixerStrip::comment_button_clicked ()
763 if (comment_window == 0) {
764 setup_comment_editor ();
767 int x, y, cw_width, cw_height;
769 if (comment_window->is_visible()) {
770 string str = comment_area->get_buffer()->get_text();
771 if (_route->comment() != str) {
772 _route->set_comment (str, this);
778 comment_button.set_label (_("*Comments*"));
780 comment_button.set_label (_("Comments"));
786 comment_button.set_label (_("*Cmt*"));
788 comment_button.set_label (_("Cmt"));
793 ARDOUR_UI::instance()->tooltips().set_tip (comment_button,
794 str.empty() ? _("Click to Add/Edit Comments") : str);
796 comment_window->hide ();
799 comment_window->get_size (cw_width, cw_height);
800 comment_window->get_position(x, y);
801 comment_window->move(x, y - (cw_height / 2) - 45);
803 half the dialog height minus the comments button height
804 with some window decoration fudge thrown in.
807 comment_window->show();
808 comment_window->present();
813 MixerStrip::setup_comment_editor ()
816 title = _route->name();
817 title += _(": comment editor");
819 comment_window = new ArdourDialog (title, false);
820 comment_window->set_position (Gtk::WIN_POS_MOUSE);
821 comment_window->set_skip_taskbar_hint (true);
823 comment_area = manage (new TextView());
824 comment_area->set_name ("MixerTrackCommentArea");
825 comment_area->set_size_request (110, 178);
826 comment_area->set_wrap_mode (WRAP_WORD);
827 comment_area->set_editable (true);
828 comment_area->get_buffer()->set_text (_route->comment());
829 comment_area->show ();
831 comment_window->get_vbox()->pack_start (*comment_area);
832 comment_window->get_action_area()->hide();
836 MixerStrip::comment_changed (void *src)
838 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::comment_changed), src));
841 ignore_comment_edit = true;
843 comment_area->get_buffer()->set_text (_route->comment());
845 ignore_comment_edit = false;
850 MixerStrip::set_mix_group (RouteGroup *rg)
852 _route->set_mix_group (rg, this);
856 MixerStrip::add_mix_group_to_menu (RouteGroup *rg, RadioMenuItem::Group* group)
858 using namespace Menu_Helpers;
860 MenuList& items = group_menu->items();
862 items.push_back (RadioMenuElem (*group, rg->name(), bind (mem_fun(*this, &MixerStrip::set_mix_group), rg)));
864 if (_route->mix_group() == rg) {
865 static_cast<RadioMenuItem*>(&items.back())->set_active ();
870 MixerStrip::select_mix_group (GdkEventButton *ev)
872 using namespace Menu_Helpers;
874 if (group_menu == 0) {
875 group_menu = new Menu;
877 group_menu->set_name ("ArdourContextMenu");
878 MenuList& items = group_menu->items();
879 RadioMenuItem::Group group;
881 switch (ev->button) {
885 items.push_back (RadioMenuElem (group, _("No group"), bind (mem_fun(*this, &MixerStrip::set_mix_group), (RouteGroup *) 0)));
887 _session.foreach_mix_group (bind (mem_fun (*this, &MixerStrip::add_mix_group_to_menu), &group));
889 group_menu->popup (1, ev->time);
900 MixerStrip::mix_group_changed (void *ignored)
902 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::mix_group_changed), ignored));
904 RouteGroup *rg = _route->mix_group();
907 group_label.set_text (rg->name());
911 group_label.set_text (_("Grp"));
914 group_label.set_text (_("~G"));
922 MixerStrip::route_gui_changed (string what_changed, void* ignored)
924 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::route_gui_changed), what_changed, ignored));
926 if (what_changed == "color") {
927 if (set_color_from_route () == 0) {
934 MixerStrip::show_route_color ()
936 name_button.modify_bg (STATE_NORMAL, color());
937 route_active_changed ();
941 MixerStrip::show_passthru_color ()
943 route_active_changed ();
947 MixerStrip::build_route_ops_menu ()
949 using namespace Menu_Helpers;
951 route_ops_menu = manage (new Menu);
952 route_ops_menu->set_name ("ArdourContextMenu");
954 MenuList& items = route_ops_menu->items();
956 items.push_back (MenuElem (_("Rename"), mem_fun(*this, &RouteUI::route_rename)));
957 items.push_back (SeparatorElem());
958 items.push_back (CheckMenuElem (_("Active"), mem_fun (*this, &RouteUI::toggle_route_active)));
959 route_active_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
960 route_active_menu_item->set_active (_route->active());
961 items.push_back (SeparatorElem());
962 items.push_back (CheckMenuElem (_("Invert Polarity"), mem_fun (*this, &RouteUI::toggle_polarity)));
963 polarity_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
964 polarity_menu_item->set_active (_route->phase_invert());
966 build_remote_control_menu ();
968 items.push_back (SeparatorElem());
969 items.push_back (MenuElem (_("Remote Control ID"), *remote_control_menu));
971 items.push_back (SeparatorElem());
972 items.push_back (MenuElem (_("Remove"), mem_fun(*this, &RouteUI::remove_this_route)));
976 MixerStrip::name_button_button_press (GdkEventButton* ev)
978 if (ev->button == 1) {
979 list_route_operations ();
980 route_ops_menu->popup (1, ev->time);
986 MixerStrip::list_route_operations ()
988 if (route_ops_menu == 0) {
989 build_route_ops_menu ();
992 refresh_remote_control_menu();
997 MixerStrip::speed_adjustment_changed ()
999 /* since there is a usable speed adjustment, there has to be a diskstream */
1000 if (!ignore_speed_adjustment) {
1001 get_diskstream()->set_speed (speed_adjustment.get_value());
1006 MixerStrip::speed_changed ()
1008 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_speed_display));
1012 MixerStrip::update_speed_display ()
1016 val = get_diskstream()->speed();
1019 speed_spinner.set_name ("MixerStripSpeedBaseNotOne");
1021 speed_spinner.set_name ("MixerStripSpeedBase");
1024 if (speed_adjustment.get_value() != val) {
1025 ignore_speed_adjustment = true;
1026 speed_adjustment.set_value (val);
1027 ignore_speed_adjustment = false;
1033 MixerStrip::set_selected (bool yn)
1035 AxisView::set_selected (yn);
1037 global_frame.set_shadow_type (Gtk::SHADOW_ETCHED_OUT);
1038 global_frame.set_name ("MixerStripSelectedFrame");
1040 global_frame.set_shadow_type (Gtk::SHADOW_IN);
1041 global_frame.set_name ("MixerStripFrame");
1043 global_frame.queue_draw ();
1047 MixerStrip::name_changed (void *src)
1051 RouteUI::name_changed (src);
1054 name_label.set_text (PBD::short_version (_route->name(), 5));
1057 if (_route->phase_invert()) {
1058 name_label.set_text (X_("Ø ") + name_label.get_text());
1063 MixerStrip::width_clicked ()
1076 MixerStrip::hide_clicked ()
1079 Hiding(); /* EMIT_SIGNAL */
1081 _mixer.hide_strip (this);
1086 MixerStrip::set_embedded (bool yn)
1092 MixerStrip::map_frozen ()
1094 ENSURE_GUI_THREAD (mem_fun(*this, &MixerStrip::map_frozen));
1096 AudioTrack* at = audio_track();
1099 switch (at->freeze_state()) {
1100 case AudioTrack::Frozen:
1101 pre_redirect_box.set_sensitive (false);
1102 post_redirect_box.set_sensitive (false);
1103 speed_spinner.set_sensitive (false);
1106 pre_redirect_box.set_sensitive (true);
1107 post_redirect_box.set_sensitive (true);
1108 speed_spinner.set_sensitive (true);
1112 _route->foreach_redirect (this, &MixerStrip::hide_redirect_editor);
1116 MixerStrip::hide_redirect_editor (boost::shared_ptr<Redirect> redirect)
1118 void* gui = redirect->get_gui ();
1121 static_cast<Gtk::Widget*>(gui)->hide ();
1126 MixerStrip::route_active_changed ()
1128 RouteUI::route_active_changed ();
1130 if (is_midi_track()) {
1131 if (_route->active()) {
1132 set_name ("MidiTrackStripBase");
1133 gpm.set_meter_strip_name ("MidiTrackStripBase");
1135 set_name ("MidiTrackStripBaseInactive");
1136 gpm.set_meter_strip_name ("MidiTrackStripBaseInactive");
1138 } else if (is_audio_track()) {
1139 if (_route->active()) {
1140 set_name ("AudioTrackStripBase");
1141 gpm.set_meter_strip_name ("AudioTrackStripBase");
1143 set_name ("AudioTrackStripBaseInactive");
1144 gpm.set_meter_strip_name ("AudioTrackStripBaseInactive");
1146 gpm.set_fader_name ("AudioTrackFader");
1148 if (_route->active()) {
1149 set_name ("AudioBusStripBase");
1150 gpm.set_meter_strip_name ("AudioBusStripBase");
1152 set_name ("AudioBusStripBaseInactive");
1153 gpm.set_meter_strip_name ("AudioBusStripBaseInactive");
1155 gpm.set_fader_name ("AudioBusFader");
1160 MixerStrip::mix_group() const
1162 return _route->mix_group();
1166 MixerStrip::engine_stopped ()
1168 input_button.set_sensitive (false);
1169 if (rec_enable_button) {
1170 rec_enable_button->set_sensitive (false);
1172 output_button.set_sensitive (false);
1176 MixerStrip::engine_running ()
1178 input_button.set_sensitive (true);
1179 if (rec_enable_button) {
1180 rec_enable_button->set_sensitive (true);
1182 output_button.set_sensitive (true);
1186 MixerStrip::meter_changed (void *src)
1189 ENSURE_GUI_THREAD (bind (mem_fun(*this, &MixerStrip::meter_changed), src));
1191 switch (_route->meter_point()) {
1193 meter_point_label.set_text (_("input"));
1197 meter_point_label.set_text (_("pre"));
1200 case MeterPostFader:
1201 meter_point_label.set_text (_("post"));
1205 gpm.setup_meters ();