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/stop_signal.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/session.h>
37 #include <ardour/audioengine.h>
38 #include <ardour/route.h>
39 #include <ardour/audio_track.h>
40 #include <ardour/audio_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 "public_editor.h"
55 #include "io_selector.h"
57 #include "gui_thread.h"
62 using namespace ARDOUR;
65 using namespace Gtkmm2ext;
67 #ifdef VARISPEED_IN_MIXER_STRIP
69 speed_printer (char buf[32], Gtk::Adjustment& adj, void* arg)
71 float val = adj.get_value ();
76 snprintf (buf, 32, "%.3f", val);
81 MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, boost::shared_ptr<Route> rt, bool in_mixer)
83 RouteUI (rt, sess, _("Mute"), _("Solo"), _("Record")),
85 pre_redirect_box (PreFader, sess, rt, mx.plugin_selector(), mx.selection(), in_mixer),
86 post_redirect_box (PostFader, sess, rt, mx.plugin_selector(), mx.selection(), in_mixer),
88 panners (_route, sess),
90 middle_button_table (1, 2),
91 bottom_button_table (1, 2),
92 meter_point_label (_("pre")),
93 comment_button (_("Comments")),
94 speed_adjustment (1.0, 0.001, 4.0, 0.001, 0.1),
95 speed_spinner (&speed_adjustment, "MixerStripSpeedBase", true)
98 if (set_color_from_route()) {
99 set_color (unique_random_color());
105 _marked_for_display = false;
107 ignore_comment_edit = false;
108 ignore_toggle = false;
109 ignore_speed_adjustment = false;
113 width_button.add (*(manage (new Gtk::Image (get_xpm("lr.xpm")))));
114 hide_button.add (*(manage (new Gtk::Image (::get_icon("hide")))));
116 input_label.set_text (_("Input"));
117 input_button.add (input_label);
118 input_button.set_name ("MixerIOButton");
119 input_label.set_name ("MixerIOButtonLabel");
121 output_label.set_text (_("Output"));
122 output_button.add (output_label);
123 output_button.set_name ("MixerIOButton");
124 output_label.set_name ("MixerIOButtonLabel");
126 _route->meter_change.connect (mem_fun(*this, &MixerStrip::meter_changed));
127 meter_point_button.add (meter_point_label);
128 meter_point_button.set_name ("MixerStripMeterPreButton");
129 meter_point_label.set_name ("MixerStripMeterPreButton");
131 switch (_route->meter_point()) {
133 meter_point_label.set_text (_("input"));
137 meter_point_label.set_text (_("pre"));
141 meter_point_label.set_text (_("post"));
145 /* TRANSLATORS: this string should be longest of the strings
146 used to describe meter points. In english, it's "input".
148 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);
152 meter_point_button.signal_button_press_event().connect (mem_fun (gpm, &GainMeter::meter_press), false);
153 /* XXX what is this meant to do? */
154 //meter_point_button.signal_button_release_event().connect (mem_fun (gpm, &GainMeter::meter_release), false);
156 solo_button->set_name ("MixerSoloButton");
157 mute_button->set_name ("MixerMuteButton");
159 hide_button.set_events (hide_button.get_events() & ~(Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK));
161 width_button.unset_flags (Gtk::CAN_FOCUS);
162 hide_button.unset_flags (Gtk::CAN_FOCUS);
163 input_button.unset_flags (Gtk::CAN_FOCUS);
164 output_button.unset_flags (Gtk::CAN_FOCUS);
165 solo_button->unset_flags (Gtk::CAN_FOCUS);
166 mute_button->unset_flags (Gtk::CAN_FOCUS);
168 button_table.set_homogeneous (true);
169 button_table.set_spacings (0);
171 button_table.attach (name_button, 0, 2, 0, 1);
172 button_table.attach (input_button, 0, 2, 1, 2);
174 middle_button_table.set_homogeneous (true);
175 middle_button_table.set_spacings (0);
176 middle_button_table.attach (*mute_button, 0, 1, 0, 1);
177 middle_button_table.attach (*solo_button, 1, 2, 0, 1);
179 bottom_button_table.set_col_spacings (0);
180 bottom_button_table.set_homogeneous (true);
181 bottom_button_table.attach (group_button, 0, 1, 0, 1);
183 if (is_audio_track()) {
185 rec_enable_button->set_name ("MixerRecordEnableButton");
186 rec_enable_button->unset_flags (Gtk::CAN_FOCUS);
187 rec_enable_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::rec_enable_press));
189 AudioTrack* at = audio_track();
191 at->FreezeChange.connect (mem_fun(*this, &MixerStrip::map_frozen));
193 #ifdef VARISPEED_IN_MIXER_STRIP
194 speed_adjustment.signal_value_changed().connect (mem_fun(*this, &MixerStrip::speed_adjustment_changed));
196 speed_frame.set_name ("BaseFrame");
197 speed_frame.set_shadow_type (Gtk::SHADOW_IN);
198 speed_frame.add (speed_spinner);
200 speed_spinner.set_print_func (speed_printer, 0);
202 ARDOUR_UI::instance()->tooltips().set_tip (speed_spinner, _("Varispeed"));
204 button_table.attach (speed_frame, 0, 2, 5, 6);
205 #endif /* VARISPEED_IN_MIXER_STRIP */
207 button_table.attach (*rec_enable_button, 0, 2, 2, 3);
210 name_button.add (name_label);
211 name_button.set_name ("MixerNameButton");
212 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2);
214 name_label.set_name ("MixerNameButtonLabel");
215 if (_route->phase_invert()) {
216 name_label.set_text (X_("Ø ") + name_label.get_text());
218 name_label.set_text (_route->name());
221 group_button.add (group_label);
222 group_button.set_name ("MixerGroupButton");
223 group_label.set_name ("MixerGroupButtonLabel");
225 comment_button.set_name ("MixerCommentButton");
227 ARDOUR_UI::instance()->tooltips().set_tip (comment_button, _route->comment()=="" ?
228 _("Click to Add/Edit Comments"):
231 comment_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::comment_button_clicked));
233 global_vpacker.set_border_width (0);
234 global_vpacker.set_spacing (0);
236 Gtk::VBox *whvbox = manage (new Gtk::VBox);
238 width_button.set_name ("MixerWidthButton");
239 hide_button.set_name ("MixerHideButton");
241 width_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::width_clicked));
242 hide_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::hide_clicked));
244 width_hide_box.pack_start (width_button, false, true);
245 width_hide_box.pack_end (hide_button, false, true);
246 Gtk::Alignment *gain_meter_alignment = Gtk::manage(new Gtk::Alignment());
247 gain_meter_alignment->set_padding(0, 4, 0, 0);
248 gain_meter_alignment->add(gpm);
250 whvbox->pack_start (width_hide_box, true, true);
252 global_vpacker.pack_start (*whvbox, Gtk::PACK_SHRINK);
253 global_vpacker.pack_start (button_table,Gtk::PACK_SHRINK);
254 global_vpacker.pack_start (pre_redirect_box, true, true);
255 global_vpacker.pack_start (middle_button_table,Gtk::PACK_SHRINK);
256 global_vpacker.pack_start (*gain_meter_alignment,Gtk::PACK_SHRINK);
257 global_vpacker.pack_start (bottom_button_table,Gtk::PACK_SHRINK);
258 global_vpacker.pack_start (post_redirect_box, true, true);
259 global_vpacker.pack_start (panners, Gtk::PACK_SHRINK);
260 global_vpacker.pack_start (output_button, Gtk::PACK_SHRINK);
261 global_vpacker.pack_start (comment_button, Gtk::PACK_SHRINK);
263 global_frame.add (global_vpacker);
264 global_frame.set_shadow_type (Gtk::SHADOW_IN);
265 global_frame.set_name ("BaseFrame");
269 /* force setting of visible selected status */
272 set_selected (false);
277 _session.engine().Stopped.connect (mem_fun(*this, &MixerStrip::engine_stopped));
278 _session.engine().Running.connect (mem_fun(*this, &MixerStrip::engine_running));
279 _route->input_changed.connect (mem_fun(*this, &MixerStrip::input_changed));
280 _route->output_changed.connect (mem_fun(*this, &MixerStrip::output_changed));
281 _route->mute_changed.connect (mem_fun(*this, &RouteUI::mute_changed));
282 _route->solo_changed.connect (mem_fun(*this, &RouteUI::solo_changed));
283 _route->solo_safe_changed.connect (mem_fun(*this, &RouteUI::solo_changed));
284 _route->mix_group_changed.connect (mem_fun(*this, &MixerStrip::mix_group_changed));
285 _route->panner().Changed.connect (mem_fun(*this, &MixerStrip::connect_to_pan));
287 if (is_audio_track()) {
288 audio_track()->DiskstreamChanged.connect (mem_fun(*this, &MixerStrip::diskstream_changed));
289 get_diskstream()->SpeedChanged.connect (mem_fun(*this, &MixerStrip::speed_changed));
292 _route->name_changed.connect (mem_fun(*this, &RouteUI::name_changed));
293 _route->comment_changed.connect (mem_fun(*this, &MixerStrip::comment_changed));
294 _route->gui_changed.connect (mem_fun(*this, &MixerStrip::route_gui_changed));
296 input_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::input_press), false);
297 output_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::output_press), false);
299 solo_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::solo_press), false);
300 solo_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::solo_release), false);
301 mute_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::mute_press), false);
302 mute_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::mute_release), false);
304 name_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::name_button_button_press), false);
305 group_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::select_mix_group), false);
308 set_stuff_from_route ();
310 /* start off as a passthru strip. we'll correct this, if necessary,
311 in update_diskstream_display().
314 set_name ("AudioTrackStripBase");
316 /* now force an update of all the various elements */
318 pre_redirect_box.update();
319 post_redirect_box.update();
324 mix_group_changed (0);
328 panners.setup_pan ();
330 if (is_audio_track()) {
334 update_diskstream_display ();
335 update_input_display ();
336 update_output_display ();
338 add_events (Gdk::BUTTON_RELEASE_MASK);
341 MixerStrip::~MixerStrip ()
343 GoingAway(); /* EMIT_SIGNAL */
345 if (input_selector) {
346 delete input_selector;
349 if (output_selector) {
350 delete output_selector;
355 MixerStrip::set_stuff_from_route ()
361 if ((prop = xml_node->property ("strip_width")) != 0) {
362 if (prop->value() == "wide") {
364 } else if (prop->value() == "narrow") {
368 error << string_compose(_("unknown strip width \"%1\" in XML GUI information"), prop->value()) << endmsg;
376 if ((prop = xml_node->property ("shown_mixer")) != 0) {
377 if (prop->value() == "no") {
378 _marked_for_display = false;
380 _marked_for_display = true;
384 /* backwards compatibility */
385 _marked_for_display = true;
390 MixerStrip::set_width (Width w)
392 /* always set the gpm width again, things may be hidden */
394 panners.set_width (w);
395 pre_redirect_box.set_width (w);
396 post_redirect_box.set_width (w);
408 set_size_request (-1, -1);
409 xml_node->add_property ("strip_width", "wide");
411 if (rec_enable_button) {
412 rec_enable_button->set_label (_("record"));
414 mute_button->set_label (_("mute"));
415 solo_button->set_label (_("solo"));
417 if (_route->comment() == "") {
418 comment_button.unset_bg (STATE_NORMAL);
419 comment_button.set_label (_("comments"));
421 comment_button.modify_bg (STATE_NORMAL, color());
422 comment_button.set_label (_("*comments*"));
425 gpm.gain_automation_style_button.set_label (gpm.astyle_string(_route->gain_automation_curve().automation_style()));
426 gpm.gain_automation_state_button.set_label (gpm.astate_string(_route->gain_automation_curve().automation_state()));
427 panners.pan_automation_style_button.set_label (panners.astyle_string(_route->panner().automation_style()));
428 panners.pan_automation_state_button.set_label (panners.astate_string(_route->panner().automation_state()));
429 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "long", 2, 2);
433 set_size_request (50, -1);
434 xml_node->add_property ("strip_width", "narrow");
436 if (rec_enable_button) {
437 rec_enable_button->set_label (_("Rec"));
439 mute_button->set_label (_("M"));
440 solo_button->set_label (_("S"));
442 if (_route->comment() == "") {
443 comment_button.unset_bg (STATE_NORMAL);
444 comment_button.set_label (_("Cmt"));
446 comment_button.modify_bg (STATE_NORMAL, color());
447 comment_button.set_label (_("*Cmt*"));
450 gpm.gain_automation_style_button.set_label (gpm.short_astyle_string(_route->gain_automation_curve().automation_style()));
451 gpm.gain_automation_state_button.set_label (gpm.short_astate_string(_route->gain_automation_curve().automation_state()));
452 panners.pan_automation_style_button.set_label (panners.short_astyle_string(_route->panner().automation_style()));
453 panners.pan_automation_state_button.set_label (panners.short_astate_string(_route->panner().automation_state()));
454 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2);
458 update_input_display ();
459 update_output_display ();
460 mix_group_changed (0);
466 MixerStrip::set_packed (bool yn)
473 xml_node->add_property ("shown_mixer", "yes");
475 xml_node->add_property ("shown_mixer", "no");
481 MixerStrip::output_press (GdkEventButton *ev)
483 using namespace Menu_Helpers;
484 if (!_session.engine().connected()) {
485 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
490 MenuList& citems = output_menu.items();
491 switch (ev->button) {
494 output_menu.set_name ("ArdourContextMenu");
497 citems.push_back (MenuElem (_("Edit"), mem_fun(*this, &MixerStrip::edit_output_configuration)));
498 citems.push_back (SeparatorElem());
499 citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_output)));
500 citems.push_back (SeparatorElem());
502 _session.foreach_connection (this, &MixerStrip::add_connection_to_output_menu);
504 output_menu.popup (1, ev->time);
514 MixerStrip::edit_output_configuration ()
516 if (output_selector == 0) {
517 output_selector = new IOSelectorWindow (_session, _route, false);
520 if (output_selector->is_visible()) {
521 output_selector->get_toplevel()->get_window()->raise();
523 output_selector->show_all ();
528 MixerStrip::edit_input_configuration ()
530 if (input_selector == 0) {
531 input_selector = new IOSelectorWindow (_session, _route, true);
534 if (input_selector->is_visible()) {
535 input_selector->get_toplevel()->get_window()->raise();
537 input_selector->show_all ();
542 MixerStrip::input_press (GdkEventButton *ev)
544 using namespace Menu_Helpers;
546 MenuList& citems = input_menu.items();
547 input_menu.set_name ("ArdourContextMenu");
550 if (!_session.engine().connected()) {
551 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
556 switch (ev->button) {
559 citems.push_back (MenuElem (_("Edit"), mem_fun(*this, &MixerStrip::edit_input_configuration)));
560 citems.push_back (SeparatorElem());
561 citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_input)));
562 citems.push_back (SeparatorElem());
564 _session.foreach_connection (this, &MixerStrip::add_connection_to_input_menu);
566 input_menu.popup (1, ev->time);
576 MixerStrip::connection_input_chosen (ARDOUR::Connection *c)
578 if (!ignore_toggle) {
581 _route->use_input_connection (*c, this);
584 catch (AudioEngine::PortRegistrationFailure& err) {
585 error << _("could not register new ports required for that connection")
592 MixerStrip::connection_output_chosen (ARDOUR::Connection *c)
594 if (!ignore_toggle) {
597 _route->use_output_connection (*c, this);
600 catch (AudioEngine::PortRegistrationFailure& err) {
601 error << _("could not register new ports required for that connection")
608 MixerStrip::add_connection_to_input_menu (ARDOUR::Connection* c)
610 using namespace Menu_Helpers;
612 if (dynamic_cast<InputConnection *> (c) == 0) {
616 MenuList& citems = input_menu.items();
618 if (c->nports() == _route->n_inputs()) {
620 citems.push_back (CheckMenuElem (c->name(), bind (mem_fun(*this, &MixerStrip::connection_input_chosen), c)));
622 ARDOUR::Connection *current = _route->input_connection();
625 ignore_toggle = true;
626 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
627 ignore_toggle = false;
633 MixerStrip::add_connection_to_output_menu (ARDOUR::Connection* c)
635 using namespace Menu_Helpers;
637 if (dynamic_cast<OutputConnection *> (c) == 0) {
641 if (c->nports() == _route->n_outputs()) {
643 MenuList& citems = output_menu.items();
644 citems.push_back (CheckMenuElem (c->name(), bind (mem_fun(*this, &MixerStrip::connection_output_chosen), c)));
646 ARDOUR::Connection *current = _route->output_connection();
649 ignore_toggle = true;
650 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
651 ignore_toggle = false;
657 MixerStrip::update_diskstream_display ()
659 if (is_audio_track()) {
663 update_input_display ();
665 if (input_selector) {
666 input_selector->hide_all ();
675 update_input_display ();
676 show_passthru_color ();
681 MixerStrip::connect_to_pan ()
683 ENSURE_GUI_THREAD(mem_fun(*this, &MixerStrip::connect_to_pan));
685 panstate_connection.disconnect ();
686 panstyle_connection.disconnect ();
688 if (!_route->panner().empty()) {
689 StreamPanner* sp = _route->panner().front();
691 panstate_connection = sp->automation().automation_state_changed.connect (mem_fun(panners, &PannerUI::pan_automation_state_changed));
692 panstyle_connection = sp->automation().automation_style_changed.connect (mem_fun(panners, &PannerUI::pan_automation_style_changed));
695 panners.pan_changed (this);
699 MixerStrip::update_input_display ()
701 ARDOUR::Connection *c;
703 if ((c = _route->input_connection()) != 0) {
704 input_label.set_text (c->name());
708 input_label.set_text (_(" Input"));
711 input_label.set_text (_("I"));
715 panners.setup_pan ();
719 MixerStrip::update_output_display ()
721 ARDOUR::Connection *c;
723 if ((c = _route->output_connection()) != 0) {
724 output_label.set_text (c->name());
728 output_label.set_text (_("Output"));
731 output_label.set_text (_("O"));
736 panners.setup_pan ();
740 MixerStrip::fast_update ()
742 gpm.update_meters ();
746 MixerStrip::diskstream_changed ()
748 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_diskstream_display));
752 MixerStrip::input_changed (IOChange change, void *src)
754 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_input_display));
758 MixerStrip::output_changed (IOChange change, void *src)
760 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_output_display));
765 MixerStrip::comment_editor_done_editing() {
766 string str = comment_area->get_buffer()->get_text();
767 if (_route->comment() != str) {
768 _route->set_comment (str, this);
774 comment_button.modify_bg (STATE_NORMAL, color());
775 comment_button.set_label (_("*Comments*"));
777 comment_button.unset_bg (STATE_NORMAL);
778 comment_button.set_label (_("Comments"));
784 comment_button.modify_bg (STATE_NORMAL, color());
785 comment_button.set_label (_("*Cmt*"));
787 comment_button.unset_bg (STATE_NORMAL);
788 comment_button.set_label (_("Cmt"));
793 ARDOUR_UI::instance()->tooltips().set_tip (comment_button,
794 str.empty() ? _("Click to Add/Edit Comments") : str);
800 MixerStrip::comment_button_clicked ()
802 if (comment_window == 0) {
803 setup_comment_editor ();
806 int x, y, cw_width, cw_height;
808 if (comment_window->is_visible()) {
809 comment_window->hide ();
813 comment_window->get_size (cw_width, cw_height);
814 comment_window->get_position(x, y);
815 comment_window->move(x, y - (cw_height / 2) - 45);
817 half the dialog height minus the comments button height
818 with some window decoration fudge thrown in.
821 comment_window->show();
822 comment_window->present();
826 MixerStrip::setup_comment_editor ()
829 title = _route->name();
830 title += _(": comment editor");
832 comment_window = new ArdourDialog (title, false);
833 comment_window->set_position (Gtk::WIN_POS_MOUSE);
834 comment_window->set_skip_taskbar_hint (true);
835 comment_window->signal_hide().connect (mem_fun(*this, &MixerStrip::comment_editor_done_editing));
837 comment_area = manage (new TextView());
838 comment_area->set_name ("MixerTrackCommentArea");
839 comment_area->set_size_request (110, 178);
840 comment_area->set_wrap_mode (WRAP_WORD);
841 comment_area->set_editable (true);
842 comment_area->get_buffer()->set_text (_route->comment());
843 comment_area->show ();
845 comment_window->get_vbox()->pack_start (*comment_area);
846 comment_window->get_action_area()->hide();
850 MixerStrip::comment_changed (void *src)
852 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::comment_changed), src));
855 ignore_comment_edit = true;
857 comment_area->get_buffer()->set_text (_route->comment());
859 ignore_comment_edit = false;
864 MixerStrip::set_mix_group (RouteGroup *rg)
866 _route->set_mix_group (rg, this);
870 MixerStrip::add_mix_group_to_menu (RouteGroup *rg, RadioMenuItem::Group* group)
872 using namespace Menu_Helpers;
874 MenuList& items = group_menu->items();
876 items.push_back (RadioMenuElem (*group, rg->name(), bind (mem_fun(*this, &MixerStrip::set_mix_group), rg)));
878 if (_route->mix_group() == rg) {
879 static_cast<RadioMenuItem*>(&items.back())->set_active ();
884 MixerStrip::select_mix_group (GdkEventButton *ev)
886 using namespace Menu_Helpers;
888 if (group_menu == 0) {
889 group_menu = new Menu;
891 group_menu->set_name ("ArdourContextMenu");
892 MenuList& items = group_menu->items();
893 RadioMenuItem::Group group;
895 switch (ev->button) {
899 items.push_back (RadioMenuElem (group, _("No group"), bind (mem_fun(*this, &MixerStrip::set_mix_group), (RouteGroup *) 0)));
901 _session.foreach_mix_group (bind (mem_fun (*this, &MixerStrip::add_mix_group_to_menu), &group));
903 group_menu->popup (1, ev->time);
914 MixerStrip::mix_group_changed (void *ignored)
916 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::mix_group_changed), ignored));
918 RouteGroup *rg = _route->mix_group();
921 group_label.set_text (rg->name());
925 group_label.set_text (_("Grp"));
928 group_label.set_text (_("~G"));
936 MixerStrip::route_gui_changed (string what_changed, void* ignored)
938 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::route_gui_changed), what_changed, ignored));
940 if (what_changed == "color") {
941 if (set_color_from_route () == 0) {
948 MixerStrip::show_route_color ()
950 name_button.modify_bg (STATE_NORMAL, color());
951 route_active_changed ();
955 MixerStrip::show_passthru_color ()
957 route_active_changed ();
961 MixerStrip::build_route_ops_menu ()
963 using namespace Menu_Helpers;
965 route_ops_menu = manage (new Menu);
966 route_ops_menu->set_name ("ArdourContextMenu");
968 MenuList& items = route_ops_menu->items();
970 items.push_back (MenuElem (_("Rename"), mem_fun(*this, &RouteUI::route_rename)));
971 items.push_back (SeparatorElem());
972 items.push_back (CheckMenuElem (_("Active"), mem_fun (*this, &RouteUI::toggle_route_active)));
973 route_active_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
974 route_active_menu_item->set_active (_route->active());
975 items.push_back (SeparatorElem());
976 items.push_back (CheckMenuElem (_("Invert Polarity"), mem_fun (*this, &RouteUI::toggle_polarity)));
977 polarity_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
978 polarity_menu_item->set_active (_route->phase_invert());
980 build_remote_control_menu ();
982 items.push_back (SeparatorElem());
983 items.push_back (MenuElem (_("Remote Control ID"), *remote_control_menu));
985 items.push_back (SeparatorElem());
986 items.push_back (MenuElem (_("Remove"), mem_fun(*this, &RouteUI::remove_this_route)));
990 MixerStrip::name_button_button_press (GdkEventButton* ev)
992 if (ev->button == 1) {
993 list_route_operations ();
994 route_ops_menu->popup (1, ev->time);
1000 MixerStrip::list_route_operations ()
1002 if (route_ops_menu == 0) {
1003 build_route_ops_menu ();
1006 refresh_remote_control_menu();
1011 MixerStrip::speed_adjustment_changed ()
1013 /* since there is a usable speed adjustment, there has to be a diskstream */
1014 if (!ignore_speed_adjustment) {
1015 get_diskstream()->set_speed (speed_adjustment.get_value());
1020 MixerStrip::speed_changed ()
1022 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_speed_display));
1026 MixerStrip::update_speed_display ()
1030 val = get_diskstream()->speed();
1033 speed_spinner.set_name ("MixerStripSpeedBaseNotOne");
1035 speed_spinner.set_name ("MixerStripSpeedBase");
1038 if (speed_adjustment.get_value() != val) {
1039 ignore_speed_adjustment = true;
1040 speed_adjustment.set_value (val);
1041 ignore_speed_adjustment = false;
1047 MixerStrip::set_selected (bool yn)
1049 AxisView::set_selected (yn);
1051 global_frame.set_shadow_type (Gtk::SHADOW_ETCHED_OUT);
1052 global_frame.set_name ("MixerStripSelectedFrame");
1054 global_frame.set_shadow_type (Gtk::SHADOW_IN);
1055 global_frame.set_name ("MixerStripFrame");
1057 global_frame.queue_draw ();
1061 MixerStrip::name_changed (void *src)
1065 RouteUI::name_changed (src);
1068 name_label.set_text (PBD::short_version (_route->name(), 5));
1071 if (_route->phase_invert()) {
1072 name_label.set_text (X_("Ø ") + name_label.get_text());
1077 MixerStrip::width_clicked ()
1090 MixerStrip::hide_clicked ()
1092 // LAME fix to reset the button status for when it is redisplayed (part 1)
1093 hide_button.set_sensitive(false);
1096 Hiding(); /* EMIT_SIGNAL */
1098 _mixer.hide_strip (this);
1102 hide_button.set_sensitive(true);
1106 MixerStrip::set_embedded (bool yn)
1112 MixerStrip::map_frozen ()
1114 ENSURE_GUI_THREAD (mem_fun(*this, &MixerStrip::map_frozen));
1116 AudioTrack* at = audio_track();
1119 switch (at->freeze_state()) {
1120 case AudioTrack::Frozen:
1121 pre_redirect_box.set_sensitive (false);
1122 post_redirect_box.set_sensitive (false);
1123 speed_spinner.set_sensitive (false);
1126 pre_redirect_box.set_sensitive (true);
1127 post_redirect_box.set_sensitive (true);
1128 speed_spinner.set_sensitive (true);
1132 _route->foreach_redirect (this, &MixerStrip::hide_redirect_editor);
1136 MixerStrip::hide_redirect_editor (boost::shared_ptr<Redirect> redirect)
1138 void* gui = redirect->get_gui ();
1141 static_cast<Gtk::Widget*>(gui)->hide ();
1146 MixerStrip::route_active_changed ()
1148 RouteUI::route_active_changed ();
1150 if (is_audio_track()) {
1151 if (_route->active()) {
1152 set_name ("AudioTrackStripBase");
1153 gpm.set_meter_strip_name ("AudioTrackStripBase");
1155 set_name ("AudioTrackStripBaseInactive");
1156 gpm.set_meter_strip_name ("AudioTrackStripBaseInactive");
1158 gpm.set_fader_name ("AudioTrackFader");
1159 } else { // FIXME: assumed audio bus
1160 if (_route->active()) {
1161 set_name ("AudioBusStripBase");
1162 gpm.set_meter_strip_name ("AudioBusStripBase");
1164 set_name ("AudioBusStripBaseInactive");
1165 gpm.set_meter_strip_name ("AudioBusStripBaseInactive");
1167 gpm.set_fader_name ("AudioBusFader");
1172 MixerStrip::mix_group() const
1174 return _route->mix_group();
1178 MixerStrip::engine_stopped ()
1183 MixerStrip::engine_running ()
1188 MixerStrip::meter_changed (void *src)
1191 ENSURE_GUI_THREAD (bind (mem_fun(*this, &MixerStrip::meter_changed), src));
1193 switch (_route->meter_point()) {
1195 meter_point_label.set_text (_("input"));
1199 meter_point_label.set_text (_("pre"));
1202 case MeterPostFader:
1203 meter_point_label.set_text (_("post"));
1207 gpm.setup_meters ();