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 "plugin_selector.h"
54 #include "public_editor.h"
55 #include "plugin_ui.h"
57 #include "io_selector.h"
59 #include "gui_thread.h"
64 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, boost::shared_ptr<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 middle_button_table (1, 2),
93 bottom_button_table (1, 2),
94 meter_point_label (_("pre")),
95 comment_button (_("Comments")),
96 speed_adjustment (1.0, 0.001, 4.0, 0.001, 0.1),
97 speed_spinner (&speed_adjustment, "MixerStripSpeedBase", true)
100 if (set_color_from_route()) {
101 set_color (unique_random_color());
107 _marked_for_display = false;
109 ignore_comment_edit = false;
110 ignore_toggle = false;
111 ignore_speed_adjustment = false;
115 width_button.add (*(manage (new Gtk::Image (get_xpm("lr.xpm")))));
116 hide_button.add (*(manage (new Gtk::Image (get_xpm("small_x.xpm")))));
118 input_label.set_text (_("Input"));
119 input_button.add (input_label);
120 input_button.set_name ("MixerIOButton");
121 input_label.set_name ("MixerIOButtonLabel");
123 output_label.set_text (_("Output"));
124 output_button.add (output_label);
125 output_button.set_name ("MixerIOButton");
126 output_label.set_name ("MixerIOButtonLabel");
128 _route->meter_change.connect (mem_fun(*this, &MixerStrip::meter_changed));
129 meter_point_button.add (meter_point_label);
130 meter_point_button.set_name ("MixerStripMeterPreButton");
131 meter_point_label.set_name ("MixerStripMeterPreButton");
133 switch (_route->meter_point()) {
135 meter_point_label.set_text (_("input"));
139 meter_point_label.set_text (_("pre"));
143 meter_point_label.set_text (_("post"));
147 /* TRANSLATORS: this string should be longest of the strings
148 used to describe meter points. In english, its "input".
151 set_size_request_to_display_given_text (meter_point_button, _("tupni"), 5, 5);
154 bottom_button_table.attach (meter_point_button, 1, 2, 0, 1);
157 meter_point_button.signal_button_press_event().connect (mem_fun (gpm, &GainMeter::meter_press), false);
158 /* XXX what is this meant to do? */
159 //meter_point_button.signal_button_release_event().connect (mem_fun (gpm, &GainMeter::meter_release), false);
161 solo_button->set_name ("MixerSoloButton");
162 mute_button->set_name ("MixerMuteButton");
164 hide_button.set_events (hide_button.get_events() & ~(Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK));
166 width_button.unset_flags (Gtk::CAN_FOCUS);
167 hide_button.unset_flags (Gtk::CAN_FOCUS);
168 input_button.unset_flags (Gtk::CAN_FOCUS);
169 output_button.unset_flags (Gtk::CAN_FOCUS);
170 solo_button->unset_flags (Gtk::CAN_FOCUS);
171 mute_button->unset_flags (Gtk::CAN_FOCUS);
173 button_table.set_homogeneous (true);
174 button_table.set_spacings (0);
176 button_table.attach (name_button, 0, 2, 0, 1);
177 button_table.attach (input_button, 0, 2, 1, 2);
179 middle_button_table.set_homogeneous (true);
180 middle_button_table.set_spacings (0);
181 middle_button_table.attach (*mute_button, 0, 1, 0, 1);
182 middle_button_table.attach (*solo_button, 1, 2, 0, 1);
184 bottom_button_table.set_col_spacings (0);
185 bottom_button_table.set_homogeneous (true);
186 bottom_button_table.attach (group_button, 0, 1, 0, 1);
188 if (is_audio_track()) {
190 rec_enable_button->set_name ("MixerRecordEnableButton");
191 rec_enable_button->unset_flags (Gtk::CAN_FOCUS);
192 rec_enable_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::rec_enable_press));
194 AudioTrack* at = audio_track();
196 at->FreezeChange.connect (mem_fun(*this, &MixerStrip::map_frozen));
198 #ifdef VARISPEED_IN_MIXER_STRIP
199 speed_adjustment.signal_value_changed().connect (mem_fun(*this, &MixerStrip::speed_adjustment_changed));
201 speed_frame.set_name ("BaseFrame");
202 speed_frame.set_shadow_type (Gtk::SHADOW_IN);
203 speed_frame.add (speed_spinner);
205 speed_spinner.set_print_func (speed_printer, 0);
207 ARDOUR_UI::instance()->tooltips().set_tip (speed_spinner, _("Varispeed"));
209 button_table.attach (speed_frame, 0, 2, 5, 6);
210 #endif /* VARISPEED_IN_MIXER_STRIP */
212 button_table.attach (*rec_enable_button, 0, 2, 2, 3);
215 name_button.add (name_label);
216 name_button.set_name ("MixerNameButton");
217 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2);
219 name_label.set_name ("MixerNameButtonLabel");
220 if (_route->phase_invert()) {
221 name_label.set_text (X_("Ø ") + name_label.get_text());
223 name_label.set_text (_route->name());
226 group_button.add (group_label);
227 group_button.set_name ("MixerGroupButton");
228 group_label.set_name ("MixerGroupButtonLabel");
230 comment_button.set_name ("MixerCommentButton");
232 ARDOUR_UI::instance()->tooltips().set_tip (comment_button, _route->comment()=="" ?
233 _("Click to Add/Edit Comments"):
236 comment_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::comment_button_clicked));
238 global_vpacker.set_border_width (0);
239 global_vpacker.set_spacing (0);
241 Gtk::VBox *whvbox = manage (new Gtk::VBox);
243 width_button.set_name ("MixerWidthButton");
244 hide_button.set_name ("MixerHideButton");
246 width_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::width_clicked));
247 hide_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::hide_clicked));
249 width_hide_box.pack_start (width_button, false, true);
250 width_hide_box.pack_end (hide_button, false, true);
251 Gtk::Alignment *gain_meter_alignment = Gtk::manage(new Gtk::Alignment());
252 gain_meter_alignment->set_padding(0, 4, 0, 0);
253 gain_meter_alignment->add(gpm);
255 whvbox->pack_start (width_hide_box, true, true);
257 global_vpacker.pack_start (*whvbox, Gtk::PACK_SHRINK);
258 global_vpacker.pack_start (button_table,Gtk::PACK_SHRINK);
259 global_vpacker.pack_start (pre_redirect_box, true, true);
260 global_vpacker.pack_start (middle_button_table,Gtk::PACK_SHRINK);
261 global_vpacker.pack_start (*gain_meter_alignment,Gtk::PACK_SHRINK);
262 global_vpacker.pack_start (bottom_button_table,Gtk::PACK_SHRINK);
263 global_vpacker.pack_start (post_redirect_box, true, true);
264 global_vpacker.pack_start (panners, Gtk::PACK_SHRINK);
265 global_vpacker.pack_start (output_button, Gtk::PACK_SHRINK);
266 global_vpacker.pack_start (comment_button, Gtk::PACK_SHRINK);
268 global_frame.add (global_vpacker);
269 global_frame.set_shadow_type (Gtk::SHADOW_IN);
270 global_frame.set_name ("BaseFrame");
274 /* force setting of visible selected status */
277 set_selected (false);
282 _session.engine().Stopped.connect (mem_fun(*this, &MixerStrip::engine_stopped));
283 _session.engine().Running.connect (mem_fun(*this, &MixerStrip::engine_running));
284 _route->input_changed.connect (mem_fun(*this, &MixerStrip::input_changed));
285 _route->output_changed.connect (mem_fun(*this, &MixerStrip::output_changed));
286 _route->mute_changed.connect (mem_fun(*this, &RouteUI::mute_changed));
287 _route->solo_changed.connect (mem_fun(*this, &RouteUI::solo_changed));
288 _route->solo_safe_changed.connect (mem_fun(*this, &RouteUI::solo_changed));
289 _route->mix_group_changed.connect (mem_fun(*this, &MixerStrip::mix_group_changed));
290 _route->panner().Changed.connect (mem_fun(*this, &MixerStrip::connect_to_pan));
292 if (is_audio_track()) {
293 audio_track()->DiskstreamChanged.connect (mem_fun(*this, &MixerStrip::diskstream_changed));
294 get_diskstream()->SpeedChanged.connect (mem_fun(*this, &MixerStrip::speed_changed));
297 _route->name_changed.connect (mem_fun(*this, &RouteUI::name_changed));
298 _route->comment_changed.connect (mem_fun(*this, &MixerStrip::comment_changed));
299 _route->gui_changed.connect (mem_fun(*this, &MixerStrip::route_gui_changed));
301 input_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::input_press), false);
302 output_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::output_press), false);
304 solo_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::solo_press), false);
305 solo_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::solo_release), false);
306 mute_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::mute_press), false);
307 mute_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::mute_release), false);
309 name_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::name_button_button_press), false);
310 group_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::select_mix_group), false);
313 set_stuff_from_route ();
315 /* start off as a passthru strip. we'll correct this, if necessary,
316 in update_diskstream_display().
319 set_name ("AudioTrackStripBase");
321 /* now force an update of all the various elements */
323 pre_redirect_box.update();
324 post_redirect_box.update();
329 mix_group_changed (0);
333 panners.setup_pan ();
335 if (is_audio_track()) {
339 update_diskstream_display ();
340 update_input_display ();
341 update_output_display ();
343 add_events (Gdk::BUTTON_RELEASE_MASK);
346 MixerStrip::~MixerStrip ()
348 GoingAway(); /* EMIT_SIGNAL */
350 if (input_selector) {
351 delete input_selector;
354 if (output_selector) {
355 delete output_selector;
360 MixerStrip::set_stuff_from_route ()
366 if ((prop = xml_node->property ("strip_width")) != 0) {
367 if (prop->value() == "wide") {
369 } else if (prop->value() == "narrow") {
373 error << string_compose(_("unknown strip width \"%1\" in XML GUI information"), prop->value()) << endmsg;
381 if ((prop = xml_node->property ("shown_mixer")) != 0) {
382 if (prop->value() == "no") {
383 _marked_for_display = false;
385 _marked_for_display = true;
389 /* backwards compatibility */
390 _marked_for_display = true;
395 MixerStrip::set_width (Width w)
397 /* always set the gpm width again, things may be hidden */
399 panners.set_width (w);
400 pre_redirect_box.set_width (w);
401 post_redirect_box.set_width (w);
413 set_size_request (-1, -1);
414 xml_node->add_property ("strip_width", "wide");
416 if (rec_enable_button) {
417 rec_enable_button->set_label (_("record"));
419 mute_button->set_label (_("mute"));
420 solo_button->set_label (_("solo"));
422 if (_route->comment() == "") {
423 comment_button.set_label (_("comments"));
425 comment_button.set_label (_("*comments*"));
428 gpm.gain_automation_style_button.set_label (gpm.astyle_string(_route->gain_automation_curve().automation_style()));
429 gpm.gain_automation_state_button.set_label (gpm.astate_string(_route->gain_automation_curve().automation_state()));
430 panners.pan_automation_style_button.set_label (panners.astyle_string(_route->panner().automation_style()));
431 panners.pan_automation_state_button.set_label (panners.astate_string(_route->panner().automation_state()));
432 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "long", 2, 2);
436 set_size_request (50, -1);
437 xml_node->add_property ("strip_width", "narrow");
439 if (rec_enable_button) {
440 rec_enable_button->set_label (_("Rec"));
442 mute_button->set_label (_("M"));
443 solo_button->set_label (_("S"));
445 if (_route->comment() == "") {
446 comment_button.set_label (_("Cmt"));
448 comment_button.set_label (_("*Cmt*"));
451 gpm.gain_automation_style_button.set_label (gpm.short_astyle_string(_route->gain_automation_curve().automation_style()));
452 gpm.gain_automation_state_button.set_label (gpm.short_astate_string(_route->gain_automation_curve().automation_state()));
453 panners.pan_automation_style_button.set_label (panners.short_astyle_string(_route->panner().automation_style()));
454 panners.pan_automation_state_button.set_label (panners.short_astate_string(_route->panner().automation_state()));
455 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2);
459 update_input_display ();
460 update_output_display ();
461 mix_group_changed (0);
467 MixerStrip::set_packed (bool yn)
474 xml_node->add_property ("shown_mixer", "yes");
476 xml_node->add_property ("shown_mixer", "no");
482 MixerStrip::output_press (GdkEventButton *ev)
484 using namespace Menu_Helpers;
485 if (!_session.engine().connected()) {
486 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
491 MenuList& citems = output_menu.items();
492 switch (ev->button) {
495 output_menu.set_name ("ArdourContextMenu");
498 citems.push_back (MenuElem (_("Edit"), mem_fun(*this, &MixerStrip::edit_output_configuration)));
499 citems.push_back (SeparatorElem());
500 citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_output)));
501 citems.push_back (SeparatorElem());
503 _session.foreach_connection (this, &MixerStrip::add_connection_to_output_menu);
505 output_menu.popup (1, ev->time);
515 MixerStrip::edit_output_configuration ()
517 if (output_selector == 0) {
518 output_selector = new IOSelectorWindow (_session, _route, false);
521 if (output_selector->is_visible()) {
522 output_selector->get_toplevel()->get_window()->raise();
524 output_selector->show_all ();
529 MixerStrip::edit_input_configuration ()
531 if (input_selector == 0) {
532 input_selector = new IOSelectorWindow (_session, _route, true);
535 if (input_selector->is_visible()) {
536 input_selector->get_toplevel()->get_window()->raise();
538 input_selector->show_all ();
543 MixerStrip::input_press (GdkEventButton *ev)
545 using namespace Menu_Helpers;
547 MenuList& citems = input_menu.items();
548 input_menu.set_name ("ArdourContextMenu");
551 if (!_session.engine().connected()) {
552 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
557 switch (ev->button) {
561 citems.push_back (MenuElem (_("Edit"), mem_fun(*this, &MixerStrip::edit_input_configuration)));
562 citems.push_back (SeparatorElem());
563 citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_input)));
564 citems.push_back (SeparatorElem());
566 _session.foreach_connection (this, &MixerStrip::add_connection_to_input_menu);
567 input_menu.popup (1, ev->time);
577 MixerStrip::connection_input_chosen (ARDOUR::Connection *c)
579 if (!ignore_toggle) {
582 _route->use_input_connection (*c, this);
585 catch (AudioEngine::PortRegistrationFailure& err) {
586 error << _("could not register new ports required for that connection")
593 MixerStrip::connection_output_chosen (ARDOUR::Connection *c)
595 if (!ignore_toggle) {
598 _route->use_output_connection (*c, this);
601 catch (AudioEngine::PortRegistrationFailure& err) {
602 error << _("could not register new ports required for that connection")
609 MixerStrip::add_connection_to_input_menu (ARDOUR::Connection* c)
611 using namespace Menu_Helpers;
613 if (dynamic_cast<InputConnection *> (c) == 0) {
617 MenuList& citems = input_menu.items();
619 if (c->nports() == _route->n_inputs()) {
621 citems.push_back (CheckMenuElem (c->name(), bind (mem_fun(*this, &MixerStrip::connection_input_chosen), c)));
623 ARDOUR::Connection *current = _route->input_connection();
626 ignore_toggle = true;
627 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
628 ignore_toggle = false;
634 MixerStrip::add_connection_to_output_menu (ARDOUR::Connection* c)
636 using namespace Menu_Helpers;
638 if (dynamic_cast<OutputConnection *> (c) == 0) {
642 if (c->nports() == _route->n_outputs()) {
644 MenuList& citems = output_menu.items();
645 citems.push_back (CheckMenuElem (c->name(), bind (mem_fun(*this, &MixerStrip::connection_output_chosen), c)));
647 ARDOUR::Connection *current = _route->output_connection();
650 ignore_toggle = true;
651 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
652 ignore_toggle = false;
658 MixerStrip::update_diskstream_display ()
660 if (is_audio_track()) {
664 update_input_display ();
666 if (input_selector) {
667 input_selector->hide_all ();
676 update_input_display ();
677 show_passthru_color ();
682 MixerStrip::connect_to_pan ()
684 ENSURE_GUI_THREAD(mem_fun(*this, &MixerStrip::connect_to_pan));
686 panstate_connection.disconnect ();
687 panstyle_connection.disconnect ();
689 if (!_route->panner().empty()) {
690 StreamPanner* sp = _route->panner().front();
692 panstate_connection = sp->automation().automation_state_changed.connect (mem_fun(panners, &PannerUI::pan_automation_state_changed));
693 panstyle_connection = sp->automation().automation_style_changed.connect (mem_fun(panners, &PannerUI::pan_automation_style_changed));
696 panners.pan_changed (this);
700 MixerStrip::update_input_display ()
702 ARDOUR::Connection *c;
704 if ((c = _route->input_connection()) != 0) {
705 input_label.set_text (c->name());
709 input_label.set_text (_(" Input"));
712 input_label.set_text (_("I"));
716 panners.setup_pan ();
720 MixerStrip::update_output_display ()
722 ARDOUR::Connection *c;
724 if ((c = _route->output_connection()) != 0) {
725 output_label.set_text (c->name());
729 output_label.set_text (_("Output"));
732 output_label.set_text (_("O"));
737 panners.setup_pan ();
741 MixerStrip::fast_update ()
743 gpm.update_meters ();
747 MixerStrip::diskstream_changed ()
749 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_diskstream_display));
753 MixerStrip::input_changed (IOChange change, void *src)
755 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_input_display));
759 MixerStrip::output_changed (IOChange change, void *src)
761 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_output_display));
765 MixerStrip::comment_button_clicked ()
767 if (comment_window == 0) {
768 setup_comment_editor ();
771 int x, y, cw_width, cw_height;
773 if (comment_window->is_visible()) {
774 string str = comment_area->get_buffer()->get_text();
775 if (_route->comment() != str) {
776 _route->set_comment (str, this);
782 comment_button.set_label (_("*Comments*"));
784 comment_button.set_label (_("Comments"));
790 comment_button.set_label (_("*Cmt*"));
792 comment_button.set_label (_("Cmt"));
797 ARDOUR_UI::instance()->tooltips().set_tip (comment_button,
798 str.empty() ? _("Click to Add/Edit Comments") : str);
800 comment_window->hide ();
803 comment_window->get_size (cw_width, cw_height);
804 comment_window->get_position(x, y);
805 comment_window->move(x, y - (cw_height / 2) - 45);
807 half the dialog height minus the comments button height
808 with some window decoration fudge thrown in.
811 comment_window->show();
812 comment_window->present();
817 MixerStrip::setup_comment_editor ()
820 title = _route->name();
821 title += _(": comment editor");
823 comment_window = new ArdourDialog (title, false);
824 comment_window->set_position (Gtk::WIN_POS_MOUSE);
825 comment_window->set_skip_taskbar_hint (true);
827 comment_area = manage (new TextView());
828 comment_area->set_name ("MixerTrackCommentArea");
829 comment_area->set_size_request (110, 178);
830 comment_area->set_wrap_mode (WRAP_WORD);
831 comment_area->set_editable (true);
832 comment_area->get_buffer()->set_text (_route->comment());
833 comment_area->show ();
835 comment_window->get_vbox()->pack_start (*comment_area);
836 comment_window->get_action_area()->hide();
840 MixerStrip::comment_changed (void *src)
842 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::comment_changed), src));
845 ignore_comment_edit = true;
847 comment_area->get_buffer()->set_text (_route->comment());
849 ignore_comment_edit = false;
854 MixerStrip::set_mix_group (RouteGroup *rg)
856 _route->set_mix_group (rg, this);
860 MixerStrip::add_mix_group_to_menu (RouteGroup *rg, RadioMenuItem::Group* group)
862 using namespace Menu_Helpers;
864 MenuList& items = group_menu->items();
866 items.push_back (RadioMenuElem (*group, rg->name(), bind (mem_fun(*this, &MixerStrip::set_mix_group), rg)));
868 if (_route->mix_group() == rg) {
869 static_cast<RadioMenuItem*>(&items.back())->set_active ();
874 MixerStrip::select_mix_group (GdkEventButton *ev)
876 using namespace Menu_Helpers;
878 if (group_menu == 0) {
879 group_menu = new Menu;
881 group_menu->set_name ("ArdourContextMenu");
882 MenuList& items = group_menu->items();
883 RadioMenuItem::Group group;
885 switch (ev->button) {
889 items.push_back (RadioMenuElem (group, _("No group"), bind (mem_fun(*this, &MixerStrip::set_mix_group), (RouteGroup *) 0)));
891 _session.foreach_mix_group (bind (mem_fun (*this, &MixerStrip::add_mix_group_to_menu), &group));
893 group_menu->popup (1, ev->time);
904 MixerStrip::mix_group_changed (void *ignored)
906 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::mix_group_changed), ignored));
908 RouteGroup *rg = _route->mix_group();
911 group_label.set_text (rg->name());
915 group_label.set_text (_("Grp"));
918 group_label.set_text (_("~G"));
926 MixerStrip::route_gui_changed (string what_changed, void* ignored)
928 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::route_gui_changed), what_changed, ignored));
930 if (what_changed == "color") {
931 if (set_color_from_route () == 0) {
938 MixerStrip::show_route_color ()
940 name_button.modify_bg (STATE_NORMAL, color());
941 route_active_changed ();
945 MixerStrip::show_passthru_color ()
947 route_active_changed ();
951 MixerStrip::build_route_ops_menu ()
953 using namespace Menu_Helpers;
955 route_ops_menu = manage (new Menu);
956 route_ops_menu->set_name ("ArdourContextMenu");
958 MenuList& items = route_ops_menu->items();
960 items.push_back (MenuElem (_("Rename"), mem_fun(*this, &RouteUI::route_rename)));
961 items.push_back (SeparatorElem());
962 items.push_back (CheckMenuElem (_("Active"), mem_fun (*this, &RouteUI::toggle_route_active)));
963 route_active_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
964 route_active_menu_item->set_active (_route->active());
965 items.push_back (SeparatorElem());
966 items.push_back (CheckMenuElem (_("Invert Polarity"), mem_fun (*this, &RouteUI::toggle_polarity)));
967 polarity_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
968 polarity_menu_item->set_active (_route->phase_invert());
970 build_remote_control_menu ();
972 items.push_back (SeparatorElem());
973 items.push_back (MenuElem (_("Remote Control ID"), *remote_control_menu));
975 items.push_back (SeparatorElem());
976 items.push_back (MenuElem (_("Remove"), mem_fun(*this, &RouteUI::remove_this_route)));
980 MixerStrip::name_button_button_press (GdkEventButton* ev)
982 if (ev->button == 1) {
983 list_route_operations ();
984 route_ops_menu->popup (1, ev->time);
990 MixerStrip::list_route_operations ()
992 if (route_ops_menu == 0) {
993 build_route_ops_menu ();
996 refresh_remote_control_menu();
1001 MixerStrip::speed_adjustment_changed ()
1003 /* since there is a usable speed adjustment, there has to be a diskstream */
1004 if (!ignore_speed_adjustment) {
1005 get_diskstream()->set_speed (speed_adjustment.get_value());
1010 MixerStrip::speed_changed ()
1012 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_speed_display));
1016 MixerStrip::update_speed_display ()
1020 val = get_diskstream()->speed();
1023 speed_spinner.set_name ("MixerStripSpeedBaseNotOne");
1025 speed_spinner.set_name ("MixerStripSpeedBase");
1028 if (speed_adjustment.get_value() != val) {
1029 ignore_speed_adjustment = true;
1030 speed_adjustment.set_value (val);
1031 ignore_speed_adjustment = false;
1037 MixerStrip::set_selected (bool yn)
1039 AxisView::set_selected (yn);
1041 global_frame.set_shadow_type (Gtk::SHADOW_ETCHED_OUT);
1042 global_frame.set_name ("MixerStripSelectedFrame");
1044 global_frame.set_shadow_type (Gtk::SHADOW_IN);
1045 global_frame.set_name ("MixerStripFrame");
1047 global_frame.queue_draw ();
1051 MixerStrip::name_changed (void *src)
1055 RouteUI::name_changed (src);
1058 name_label.set_text (PBD::short_version (_route->name(), 5));
1061 if (_route->phase_invert()) {
1062 name_label.set_text (X_("Ø ") + name_label.get_text());
1067 MixerStrip::width_clicked ()
1080 MixerStrip::hide_clicked ()
1083 Hiding(); /* EMIT_SIGNAL */
1085 _mixer.hide_strip (this);
1090 MixerStrip::set_embedded (bool yn)
1096 MixerStrip::map_frozen ()
1098 ENSURE_GUI_THREAD (mem_fun(*this, &MixerStrip::map_frozen));
1100 AudioTrack* at = audio_track();
1103 switch (at->freeze_state()) {
1104 case AudioTrack::Frozen:
1105 pre_redirect_box.set_sensitive (false);
1106 post_redirect_box.set_sensitive (false);
1107 speed_spinner.set_sensitive (false);
1110 pre_redirect_box.set_sensitive (true);
1111 post_redirect_box.set_sensitive (true);
1112 speed_spinner.set_sensitive (true);
1116 _route->foreach_redirect (this, &MixerStrip::hide_redirect_editor);
1120 MixerStrip::hide_redirect_editor (boost::shared_ptr<Redirect> redirect)
1122 void* gui = redirect->get_gui ();
1125 static_cast<Gtk::Widget*>(gui)->hide ();
1130 MixerStrip::route_active_changed ()
1132 RouteUI::route_active_changed ();
1134 if (is_audio_track()) {
1135 if (_route->active()) {
1136 set_name ("AudioTrackStripBase");
1137 gpm.set_meter_strip_name ("AudioTrackStripBase");
1139 set_name ("AudioTrackStripBaseInactive");
1140 gpm.set_meter_strip_name ("AudioTrackStripBaseInactive");
1142 gpm.set_fader_name ("AudioTrackFader");
1143 } else { // FIXME: assumed audio bus
1144 if (_route->active()) {
1145 set_name ("AudioBusStripBase");
1146 gpm.set_meter_strip_name ("AudioBusStripBase");
1148 set_name ("AudioBusStripBaseInactive");
1149 gpm.set_meter_strip_name ("AudioBusStripBaseInactive");
1151 gpm.set_fader_name ("AudioBusFader");
1156 MixerStrip::mix_group() const
1158 return _route->mix_group();
1162 MixerStrip::engine_stopped ()
1164 input_button.set_sensitive (false);
1165 if (rec_enable_button) {
1166 rec_enable_button->set_sensitive (false);
1168 output_button.set_sensitive (false);
1172 MixerStrip::engine_running ()
1174 input_button.set_sensitive (true);
1175 if (rec_enable_button) {
1176 rec_enable_button->set_sensitive (true);
1178 output_button.set_sensitive (true);
1182 MixerStrip::meter_changed (void *src)
1185 ENSURE_GUI_THREAD (bind (mem_fun(*this, &MixerStrip::meter_changed), src));
1187 switch (_route->meter_point()) {
1189 meter_point_label.set_text (_("input"));
1193 meter_point_label.set_text (_("pre"));
1196 case MeterPostFader:
1197 meter_point_label.set_text (_("post"));
1201 gpm.setup_meters ();