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>
26 #include <pbd/enumwriter.h>
28 #include <gtkmm2ext/gtk_ui.h>
29 #include <gtkmm2ext/utils.h>
30 #include <gtkmm2ext/choice.h>
31 #include <gtkmm2ext/stop_signal.h>
32 #include <gtkmm2ext/doi.h>
33 #include <gtkmm2ext/slider_controller.h>
34 #include <gtkmm2ext/bindable_button.h>
36 #include <ardour/ardour.h>
37 #include <ardour/session.h>
38 #include <ardour/audioengine.h>
39 #include <ardour/route.h>
40 #include <ardour/audio_track.h>
41 #include <ardour/audio_diskstream.h>
42 #include <ardour/panner.h>
43 #include <ardour/send.h>
44 #include <ardour/insert.h>
45 #include <ardour/profile.h>
46 #include <ardour/ladspa_plugin.h>
47 #include <ardour/connection.h>
48 #include <ardour/session_connection.h>
50 #include "ardour_ui.h"
51 #include "ardour_dialog.h"
52 #include "mixer_strip.h"
55 #include "public_editor.h"
57 #include "io_selector.h"
59 #include "gui_thread.h"
64 using namespace ARDOUR;
67 using namespace Gtkmm2ext;
70 int MixerStrip::scrollbar_height = 0;
72 #ifdef VARISPEED_IN_MIXER_STRIP
74 speed_printer (char buf[32], Gtk::Adjustment& adj, void* arg)
76 float val = adj.get_value ();
81 snprintf (buf, 32, "%.3f", val);
86 MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, bool in_mixer)
88 RouteUI (sess, _("Mute"), _("Solo"), _("Record")),
90 _mixer_owned (in_mixer),
91 pre_redirect_box (PreFader, sess, mx.plugin_selector(), mx.selection(), in_mixer),
92 post_redirect_box (PostFader, sess, mx.plugin_selector(), mx.selection(), in_mixer),
96 middle_button_table (1, 2),
97 bottom_button_table (1, 2),
98 meter_point_label (_("pre")),
99 comment_button (_("Comments")),
100 speed_adjustment (1.0, 0.001, 4.0, 0.001, 0.1),
101 speed_spinner (&speed_adjustment, "MixerStripSpeedBase", true)
107 MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, boost::shared_ptr<Route> rt, bool in_mixer)
109 RouteUI (sess, _("Mute"), _("Solo"), _("Record")),
111 _mixer_owned (in_mixer),
112 pre_redirect_box (PreFader, sess, mx.plugin_selector(), mx.selection(), in_mixer),
113 post_redirect_box (PostFader, sess, mx.plugin_selector(), mx.selection(), in_mixer),
117 middle_button_table (1, 2),
118 bottom_button_table (1, 2),
119 meter_point_label (_("pre")),
120 comment_button (_("Comments")),
121 speed_adjustment (1.0, 0.001, 4.0, 0.001, 0.1),
122 speed_spinner (&speed_adjustment, "MixerStripSpeedBase", true)
135 _marked_for_display = false;
137 rename_menu_item = 0;
138 ignore_comment_edit = false;
139 ignore_toggle = false;
140 ignore_speed_adjustment = false;
145 width_button.add (*(manage (new Gtk::Image (::get_icon("strip_width")))));
146 hide_button.add (*(manage (new Gtk::Image (::get_icon("hide")))));
148 input_label.set_text (_("Input"));
149 ARDOUR_UI::instance()->set_tip (&input_button, _("Click to choose inputs"), "");
150 input_button.add (input_label);
151 input_button.set_name ("MixerIOButton");
152 input_label.set_name ("MixerIOButtonLabel");
154 output_label.set_text (_("Output"));
155 ARDOUR_UI::instance()->set_tip (&output_button, _("Click to choose outputs"), "");
156 output_button.add (output_label);
157 output_button.set_name ("MixerIOButton");
158 output_label.set_name ("MixerIOButtonLabel");
160 ARDOUR_UI::instance()->set_tip (&meter_point_button, _("Select metering point"), "");
161 meter_point_button.add (meter_point_label);
162 meter_point_button.set_name ("MixerStripMeterPreButton");
163 meter_point_label.set_name ("MixerStripMeterPreButton");
165 /* TRANSLATORS: this string should be longest of the strings
166 used to describe meter points. In english, it's "input".
168 set_size_request_to_display_given_text (meter_point_button, _("tupni"), 5, 5);
170 bottom_button_table.attach (meter_point_button, 1, 2, 0, 1);
172 meter_point_button.signal_button_press_event().connect (mem_fun (gpm, &GainMeter::meter_press), false);
173 /* XXX what is this meant to do? */
174 //meter_point_button.signal_button_release_event().connect (mem_fun (gpm, &GainMeter::meter_release), false);
176 hide_button.set_events (hide_button.get_events() & ~(Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK));
178 mute_button->set_name ("MixerMuteButton");
179 solo_button->set_name ("MixerSoloButton");
181 button_table.set_homogeneous (true);
182 button_table.set_spacings (0);
184 button_table.attach (name_button, 0, 2, 0, 1);
185 button_table.attach (input_button, 0, 2, 1, 2);
187 middle_button_table.set_homogeneous (true);
188 middle_button_table.set_spacings (0);
189 middle_button_table.attach (*mute_button, 0, 1, 0, 1);
190 middle_button_table.attach (*solo_button, 1, 2, 0, 1);
192 bottom_button_table.set_col_spacings (0);
193 bottom_button_table.set_homogeneous (true);
194 bottom_button_table.attach (group_button, 0, 1, 0, 1);
196 name_button.add (name_label);
197 name_button.set_name ("MixerNameButton");
198 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2);
200 name_label.set_name ("MixerNameButtonLabel");
201 ARDOUR_UI::instance()->set_tip (&group_button, _("Mix group"), "");
202 group_button.add (group_label);
203 group_button.set_name ("MixerGroupButton");
204 group_label.set_name ("MixerGroupButtonLabel");
206 comment_button.set_name ("MixerCommentButton");
208 comment_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::comment_button_clicked));
210 global_vpacker.set_border_width (0);
211 global_vpacker.set_spacing (0);
213 VBox *whvbox = manage (new VBox);
215 width_button.set_name ("MixerWidthButton");
216 hide_button.set_name ("MixerHideButton");
217 top_event_box.set_name ("MixerTopEventBox");
219 width_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::width_clicked));
220 hide_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::hide_clicked));
222 width_hide_box.pack_start (width_button, false, true);
223 width_hide_box.pack_start (top_event_box, true, true);
224 width_hide_box.pack_end (hide_button, false, true);
225 Gtk::Alignment *gain_meter_alignment = Gtk::manage(new Gtk::Alignment());
226 gain_meter_alignment->set_padding(0, 4, 0, 0);
227 gain_meter_alignment->add(gpm);
229 whvbox->pack_start (width_hide_box, true, true);
231 global_vpacker.pack_start (*whvbox, Gtk::PACK_SHRINK);
232 global_vpacker.pack_start (button_table,Gtk::PACK_SHRINK);
233 global_vpacker.pack_start (pre_redirect_box, true, true);
234 global_vpacker.pack_start (middle_button_table,Gtk::PACK_SHRINK);
235 global_vpacker.pack_start (*gain_meter_alignment,Gtk::PACK_SHRINK);
236 global_vpacker.pack_start (bottom_button_table,Gtk::PACK_SHRINK);
237 global_vpacker.pack_start (post_redirect_box, true, true);
238 global_vpacker.pack_start (panners, Gtk::PACK_SHRINK);
239 global_vpacker.pack_start (output_button, Gtk::PACK_SHRINK);
240 global_vpacker.pack_start (comment_button, Gtk::PACK_SHRINK);
242 global_frame.add (global_vpacker);
243 global_frame.set_shadow_type (Gtk::SHADOW_IN);
244 global_frame.set_name ("BaseFrame");
248 /* force setting of visible selected status */
251 set_selected (false);
256 _session.engine().Stopped.connect (mem_fun(*this, &MixerStrip::engine_stopped));
257 _session.engine().Running.connect (mem_fun(*this, &MixerStrip::engine_running));
259 input_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::input_press), false);
260 output_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::output_press), false);
262 solo_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::solo_press), false);
263 solo_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::solo_release), false);
264 mute_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::mute_press), false);
265 mute_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::mute_release), false);
267 /* we don't need this if its not an audio track, but we don't know that yet and it doesn't
271 rec_enable_button->set_name ("MixerRecordEnableButton");
272 rec_enable_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::rec_enable_press), false);
273 rec_enable_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::rec_enable_release));
275 name_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::name_button_button_press), false);
276 group_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::select_mix_group), false);
280 /* start off as a passthru strip. we'll correct this, if necessary,
281 in update_diskstream_display().
284 set_name ("AudioTrackStripBase");
286 add_events (Gdk::BUTTON_RELEASE_MASK);
289 MixerStrip::~MixerStrip ()
291 GoingAway(); /* EMIT_SIGNAL */
293 if (input_selector) {
294 delete input_selector;
297 if (output_selector) {
298 delete output_selector;
303 MixerStrip::set_route (boost::shared_ptr<Route> rt)
305 if (rec_enable_button->get_parent()) {
306 button_table.remove (*rec_enable_button);
309 #ifdef VARISPEED_IN_MIXER_STRIP
310 if (speed_frame->get_parent()) {
311 button_table.remove (*speed_frame);
315 RouteUI::set_route (rt);
317 if (input_selector) {
318 delete input_selector;
322 if (output_selector) {
323 delete output_selector;
329 pre_redirect_box.set_route (rt);
330 post_redirect_box.set_route (rt);
332 if (set_color_from_route()) {
333 set_color (unique_random_color());
336 if (_mixer_owned && (route()->master() || route()->control())) {
338 if (scrollbar_height == 0) {
339 HScrollbar scrollbar;
340 Gtk::Requisition requisition(scrollbar.size_request ());
341 scrollbar_height = requisition.height;
344 EventBox* spacer = manage (new EventBox);
345 spacer->set_size_request (-1, scrollbar_height);
346 global_vpacker.pack_start (*spacer, false, false);
349 if (is_audio_track()) {
351 boost::shared_ptr<AudioTrack> at = audio_track();
353 connections.push_back (at->FreezeChange.connect (mem_fun(*this, &MixerStrip::map_frozen)));
355 #ifdef VARISPEED_IN_MIXER_STRIP
356 speed_adjustment.signal_value_changed().connect (mem_fun(*this, &MixerStrip::speed_adjustment_changed));
358 speed_frame.set_name ("BaseFrame");
359 speed_frame.set_shadow_type (Gtk::SHADOW_IN);
360 speed_frame.add (speed_spinner);
362 speed_spinner.set_print_func (speed_printer, 0);
364 ARDOUR_UI::instance()->tooltips().set_tip (speed_spinner, _("Varispeed"));
366 button_table.attach (speed_frame, 0, 2, 5, 6);
367 #endif /* VARISPEED_IN_MIXER_STRIP */
369 button_table.attach (*rec_enable_button, 0, 2, 2, 3);
370 rec_enable_button->show();
373 if (_route->phase_invert()) {
374 name_label.set_text (X_("Ø ") + name_label.get_text());
376 name_label.set_text (_route->name());
379 switch (_route->meter_point()) {
381 meter_point_label.set_text (_("input"));
385 meter_point_label.set_text (_("pre"));
389 meter_point_label.set_text (_("post"));
393 delete route_ops_menu;
396 ARDOUR_UI::instance()->tooltips().set_tip (comment_button, _route->comment().empty() ?
397 _("Click to Add/Edit Comments"):
400 connections.push_back (_route->meter_change.connect (mem_fun(*this, &MixerStrip::meter_changed)));
401 connections.push_back (_route->input_changed.connect (mem_fun(*this, &MixerStrip::input_changed)));
402 connections.push_back (_route->output_changed.connect (mem_fun(*this, &MixerStrip::output_changed)));
403 connections.push_back (_route->mute_changed.connect (mem_fun(*this, &RouteUI::mute_changed)));
404 connections.push_back (_route->solo_changed.connect (mem_fun(*this, &RouteUI::solo_changed)));
405 connections.push_back (_route->solo_safe_changed.connect (mem_fun(*this, &RouteUI::solo_changed)));
406 connections.push_back (_route->mix_group_changed.connect (mem_fun(*this, &MixerStrip::mix_group_changed)));
407 connections.push_back (_route->panner().Changed.connect (mem_fun(*this, &MixerStrip::connect_to_pan)));
409 if (is_audio_track()) {
410 connections.push_back (audio_track()->DiskstreamChanged.connect (mem_fun(*this, &MixerStrip::diskstream_changed)));
411 connections.push_back (get_diskstream()->SpeedChanged.connect (mem_fun(*this, &MixerStrip::speed_changed)));
414 connections.push_back (_route->name_changed.connect (mem_fun(*this, &RouteUI::name_changed)));
415 connections.push_back (_route->comment_changed.connect (mem_fun(*this, &MixerStrip::comment_changed)));
416 connections.push_back (_route->gui_changed.connect (mem_fun(*this, &MixerStrip::route_gui_changed)));
418 set_stuff_from_route ();
420 /* now force an update of all the various elements */
422 pre_redirect_box.update();
423 post_redirect_box.update();
428 mix_group_changed (0);
432 panners.setup_pan ();
434 if (is_audio_track()) {
438 update_diskstream_display ();
439 update_input_display ();
440 update_output_display ();
444 MixerStrip::set_stuff_from_route ()
450 /* if width is not set, it will be set by the MixerUI or editor */
452 if ((prop = xml_node->property ("strip_width")) != 0) {
453 set_width (Width (string_2_enum (prop->value(), _width)), this);
456 if ((prop = xml_node->property ("shown_mixer")) != 0) {
457 if (prop->value() == "no") {
458 _marked_for_display = false;
460 _marked_for_display = true;
463 /* backwards compatibility */
464 _marked_for_display = true;
469 MixerStrip::set_width (Width w, void* owner)
471 /* always set the gpm width again, things may be hidden */
474 panners.set_width (w);
475 pre_redirect_box.set_width (w);
476 post_redirect_box.set_width (w);
478 _width_owner = owner;
484 if (_width_owner == this) {
485 xml_node->add_property ("strip_width", enum_2_string (_width));
491 if (rec_enable_button) {
492 ((Gtk::Label*)rec_enable_button->get_child())->set_text (_("Record"));
494 ((Gtk::Label*)mute_button->get_child())->set_text (_("Mute"));
495 ((Gtk::Label*)solo_button->get_child())->set_text (_("Solo"));
497 if (_route->comment() == "") {
498 comment_button.unset_bg (STATE_NORMAL);
499 ((Gtk::Label*)comment_button.get_child())->set_text (_("Comments"));
501 comment_button.modify_bg (STATE_NORMAL, color());
502 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Comments*"));
505 ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (gpm.astyle_string(_route->gain_automation_curve().automation_style()));
506 ((Gtk::Label*)gpm.gain_automation_state_button.get_child())->set_text (gpm.astate_string(_route->gain_automation_curve().automation_state()));
507 ((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text (panners.astyle_string(_route->panner().automation_style()));
508 ((Gtk::Label*)panners.pan_automation_state_button.get_child())->set_text (panners.astate_string(_route->panner().automation_state()));
509 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "long", 2, 2);
510 set_size_request (-1, -1);
514 if (rec_enable_button) {
515 ((Gtk::Label*)rec_enable_button->get_child())->set_text (_("Rec"));
517 ((Gtk::Label*)mute_button->get_child())->set_text (_("M"));
518 ((Gtk::Label*)solo_button->get_child())->set_text (_("S"));
520 if (_route->comment() == "") {
521 comment_button.unset_bg (STATE_NORMAL);
522 ((Gtk::Label*)comment_button.get_child())->set_text (_("Cmt"));
524 comment_button.modify_bg (STATE_NORMAL, color());
525 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Cmt*"));
528 ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (gpm.short_astyle_string(_route->gain_automation_curve().automation_style()));
529 ((Gtk::Label*)gpm.gain_automation_state_button.get_child())->set_text (gpm.short_astate_string(_route->gain_automation_curve().automation_state()));
530 ((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text (panners.short_astyle_string(_route->panner().automation_style()));
531 ((Gtk::Label*)panners.pan_automation_state_button.get_child())->set_text (panners.short_astate_string(_route->panner().automation_state()));
532 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2);
533 set_size_request (max (50, gpm.get_gm_width()), -1);
536 update_input_display ();
537 update_output_display ();
538 mix_group_changed (0);
546 MixerStrip::set_packed (bool yn)
553 xml_node->add_property ("shown_mixer", "yes");
555 xml_node->add_property ("shown_mixer", "no");
561 MixerStrip::output_press (GdkEventButton *ev)
563 using namespace Menu_Helpers;
564 if (!_session.engine().connected()) {
565 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
570 MenuList& citems = output_menu.items();
571 switch (ev->button) {
574 output_menu.set_name ("ArdourContextMenu");
577 citems.push_back (MenuElem (_("Edit"), mem_fun(*this, &MixerStrip::edit_output_configuration)));
578 citems.push_back (SeparatorElem());
579 citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_output)));
580 citems.push_back (SeparatorElem());
582 _session.foreach_connection (this, &MixerStrip::add_connection_to_output_menu);
584 output_menu.popup (1, ev->time);
594 MixerStrip::edit_output_configuration ()
596 if (output_selector == 0) {
597 output_selector = new IOSelectorWindow (_session, _route, false);
600 if (output_selector->is_visible()) {
601 output_selector->get_toplevel()->get_window()->raise();
603 output_selector->show_all ();
608 MixerStrip::edit_input_configuration ()
610 if (input_selector == 0) {
611 input_selector = new IOSelectorWindow (_session, _route, true);
614 if (input_selector->is_visible()) {
615 input_selector->get_toplevel()->get_window()->raise();
617 input_selector->show_all ();
622 MixerStrip::input_press (GdkEventButton *ev)
624 using namespace Menu_Helpers;
626 MenuList& citems = input_menu.items();
627 input_menu.set_name ("ArdourContextMenu");
630 if (!_session.engine().connected()) {
631 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
636 switch (ev->button) {
639 citems.push_back (MenuElem (_("Edit"), mem_fun(*this, &MixerStrip::edit_input_configuration)));
640 citems.push_back (SeparatorElem());
641 citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_input)));
642 citems.push_back (SeparatorElem());
644 _session.foreach_connection (this, &MixerStrip::add_connection_to_input_menu);
646 input_menu.popup (1, ev->time);
656 MixerStrip::connection_input_chosen (ARDOUR::Connection *c)
658 if (!ignore_toggle) {
661 _route->use_input_connection (*c, this);
664 catch (AudioEngine::PortRegistrationFailure& err) {
665 error << _("could not register new ports required for that connection")
672 MixerStrip::connection_output_chosen (ARDOUR::Connection *c)
674 if (!ignore_toggle) {
677 _route->use_output_connection (*c, this);
680 catch (AudioEngine::PortRegistrationFailure& err) {
681 error << _("could not register new ports required for that connection")
688 MixerStrip::add_connection_to_input_menu (ARDOUR::Connection* c)
690 using namespace Menu_Helpers;
692 if (dynamic_cast<InputConnection *> (c) == 0) {
696 MenuList& citems = input_menu.items();
698 if (c->nports() == _route->n_inputs()) {
700 citems.push_back (CheckMenuElem (c->name(), bind (mem_fun(*this, &MixerStrip::connection_input_chosen), c)));
702 ARDOUR::Connection *current = _route->input_connection();
705 ignore_toggle = true;
706 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
707 ignore_toggle = false;
713 MixerStrip::add_connection_to_output_menu (ARDOUR::Connection* c)
715 using namespace Menu_Helpers;
717 if (dynamic_cast<OutputConnection *> (c) == 0) {
721 if (c->nports() == _route->n_outputs()) {
723 MenuList& citems = output_menu.items();
724 citems.push_back (CheckMenuElem (c->name(), bind (mem_fun(*this, &MixerStrip::connection_output_chosen), c)));
726 ARDOUR::Connection *current = _route->output_connection();
729 ignore_toggle = true;
730 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
731 ignore_toggle = false;
737 MixerStrip::update_diskstream_display ()
740 update_input_display ();
742 if (is_audio_track()) {
744 if (input_selector) {
745 input_selector->hide_all ();
752 show_passthru_color ();
757 MixerStrip::connect_to_pan ()
759 ENSURE_GUI_THREAD(mem_fun(*this, &MixerStrip::connect_to_pan));
761 panstate_connection.disconnect ();
762 panstyle_connection.disconnect ();
764 if (!_route->panner().empty()) {
765 StreamPanner* sp = _route->panner().front();
767 panstate_connection = sp->automation().automation_state_changed.connect (mem_fun(panners, &PannerUI::pan_automation_state_changed));
768 panstyle_connection = sp->automation().automation_style_changed.connect (mem_fun(panners, &PannerUI::pan_automation_style_changed));
771 panners.pan_changed (this);
775 MixerStrip::update_input_display ()
777 ARDOUR::Connection *c;
779 if ((c = _route->input_connection()) != 0) {
780 input_label.set_text (c->name());
784 input_label.set_text (_(" Input"));
787 input_label.set_text (_("I"));
791 panners.setup_pan ();
795 MixerStrip::update_output_display ()
797 ARDOUR::Connection *c;
799 if ((c = _route->output_connection()) != 0) {
800 output_label.set_text (c->name());
804 output_label.set_text (_("Output"));
807 output_label.set_text (_("O"));
813 panners.setup_pan ();
817 MixerStrip::fast_update ()
819 gpm.update_meters ();
823 MixerStrip::diskstream_changed ()
825 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_diskstream_display));
829 MixerStrip::input_changed (IOChange change, void *src)
831 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_input_display));
832 set_width(_width, this);
836 MixerStrip::output_changed (IOChange change, void *src)
838 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_output_display));
839 set_width(_width, this);
844 MixerStrip::comment_editor_done_editing()
846 string str = comment_area->get_buffer()->get_text();
847 if (_route->comment() != str) {
848 _route->set_comment (str, this);
854 comment_button.modify_bg (STATE_NORMAL, color());
855 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Comments*"));
857 comment_button.unset_bg (STATE_NORMAL);
858 ((Gtk::Label*)comment_button.get_child())->set_text (_("Comments"));
864 comment_button.modify_bg (STATE_NORMAL, color());
865 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Cmt*"));
867 comment_button.unset_bg (STATE_NORMAL);
868 ((Gtk::Label*)comment_button.get_child())->set_text (_("Cmt"));
873 ARDOUR_UI::instance()->tooltips().set_tip (comment_button,
874 str.empty() ? _("Click to Add/Edit Comments") : str);
880 MixerStrip::comment_button_clicked ()
882 if (comment_window == 0) {
883 setup_comment_editor ();
886 int x, y, cw_width, cw_height;
888 if (comment_window->is_visible()) {
889 comment_window->hide ();
893 comment_window->get_size (cw_width, cw_height);
894 comment_window->get_position(x, y);
895 comment_window->move(x, y - (cw_height / 2) - 45);
897 half the dialog height minus the comments button height
898 with some window decoration fudge thrown in.
901 comment_window->show();
902 comment_window->present();
906 MixerStrip::setup_comment_editor ()
909 title = _route->name();
910 title += _(": comment editor");
912 comment_window = new ArdourDialog (title, false);
913 comment_window->set_position (Gtk::WIN_POS_MOUSE);
914 comment_window->set_skip_taskbar_hint (true);
915 comment_window->signal_hide().connect (mem_fun(*this, &MixerStrip::comment_editor_done_editing));
917 comment_area = manage (new TextView());
918 comment_area->set_name ("MixerTrackCommentArea");
919 comment_area->set_size_request (110, 178);
920 comment_area->set_wrap_mode (WRAP_WORD);
921 comment_area->set_editable (true);
922 comment_area->get_buffer()->set_text (_route->comment());
923 comment_area->show ();
925 comment_window->get_vbox()->pack_start (*comment_area);
926 comment_window->get_action_area()->hide();
930 MixerStrip::comment_changed (void *src)
932 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::comment_changed), src));
935 ignore_comment_edit = true;
937 comment_area->get_buffer()->set_text (_route->comment());
939 ignore_comment_edit = false;
944 MixerStrip::set_mix_group (RouteGroup *rg)
946 _route->set_mix_group (rg, this);
950 MixerStrip::add_mix_group_to_menu (RouteGroup *rg, RadioMenuItem::Group* group)
952 using namespace Menu_Helpers;
954 MenuList& items = group_menu->items();
956 items.push_back (RadioMenuElem (*group, rg->name(), bind (mem_fun(*this, &MixerStrip::set_mix_group), rg)));
958 if (_route->mix_group() == rg) {
959 static_cast<RadioMenuItem*>(&items.back())->set_active ();
964 MixerStrip::select_mix_group (GdkEventButton *ev)
966 using namespace Menu_Helpers;
968 if (group_menu == 0) {
969 group_menu = new Menu;
971 group_menu->set_name ("ArdourContextMenu");
972 MenuList& items = group_menu->items();
973 RadioMenuItem::Group group;
975 switch (ev->button) {
979 items.push_back (RadioMenuElem (group, _("No group"), bind (mem_fun(*this, &MixerStrip::set_mix_group), (RouteGroup *) 0)));
981 _session.foreach_mix_group (bind (mem_fun (*this, &MixerStrip::add_mix_group_to_menu), &group));
983 group_menu->popup (1, ev->time);
994 MixerStrip::mix_group_changed (void *ignored)
996 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::mix_group_changed), ignored));
998 RouteGroup *rg = _route->mix_group();
1001 group_label.set_text (rg->name());
1005 group_label.set_text (_("Grp"));
1008 group_label.set_text (_("~G"));
1016 MixerStrip::route_gui_changed (string what_changed, void* ignored)
1018 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::route_gui_changed), what_changed, ignored));
1020 if (what_changed == "color") {
1021 if (set_color_from_route () == 0) {
1022 show_route_color ();
1028 MixerStrip::show_route_color ()
1030 name_button.modify_bg (STATE_NORMAL, color());
1031 top_event_box.modify_bg (STATE_NORMAL, color());
1032 route_active_changed ();
1036 MixerStrip::show_passthru_color ()
1038 route_active_changed ();
1042 MixerStrip::build_route_ops_menu ()
1044 using namespace Menu_Helpers;
1045 route_ops_menu = new Menu;
1046 route_ops_menu->set_name ("ArdourContextMenu");
1048 MenuList& items = route_ops_menu->items();
1050 items.push_back (MenuElem (_("Save As Template"), mem_fun(*this, &RouteUI::save_as_template)));
1051 items.push_back (MenuElem (_("Rename"), mem_fun(*this, &RouteUI::route_rename)));
1052 rename_menu_item = &items.back();
1053 items.push_back (SeparatorElem());
1054 items.push_back (CheckMenuElem (_("Active"), mem_fun (*this, &RouteUI::toggle_route_active)));
1055 route_active_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
1056 route_active_menu_item->set_active (_route->active());
1057 items.push_back (SeparatorElem());
1058 items.push_back (CheckMenuElem (_("Invert Polarity"), mem_fun (*this, &RouteUI::toggle_polarity)));
1059 polarity_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
1060 polarity_menu_item->set_active (_route->phase_invert());
1061 items.push_back (CheckMenuElem (_("Protect against denormals"), mem_fun (*this, &RouteUI::toggle_denormal_protection)));
1062 denormal_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
1063 denormal_menu_item->set_active (_route->denormal_protection());
1065 if (!Profile->get_sae()) {
1066 build_remote_control_menu ();
1067 items.push_back (SeparatorElem());
1068 items.push_back (MenuElem (_("Remote Control ID"), *remote_control_menu));
1071 items.push_back (SeparatorElem());
1072 items.push_back (MenuElem (_("Remove"), mem_fun(*this, &RouteUI::remove_this_route)));
1076 MixerStrip::name_button_button_press (GdkEventButton* ev)
1078 if (ev->button == 1 || ev->button == 3) {
1079 list_route_operations ();
1080 /* do not allow rename if the track is record-enabled */
1081 rename_menu_item->set_sensitive (!_route->record_enabled());
1082 route_ops_menu->popup (1, ev->time);
1088 MixerStrip::list_route_operations ()
1090 if (route_ops_menu == 0) {
1091 build_route_ops_menu ();
1094 refresh_remote_control_menu();
1099 MixerStrip::speed_adjustment_changed ()
1101 /* since there is a usable speed adjustment, there has to be a diskstream */
1102 if (!ignore_speed_adjustment) {
1103 get_diskstream()->set_speed (speed_adjustment.get_value());
1108 MixerStrip::speed_changed ()
1110 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_speed_display));
1114 MixerStrip::update_speed_display ()
1118 val = get_diskstream()->speed();
1121 speed_spinner.set_name ("MixerStripSpeedBaseNotOne");
1123 speed_spinner.set_name ("MixerStripSpeedBase");
1126 if (speed_adjustment.get_value() != val) {
1127 ignore_speed_adjustment = true;
1128 speed_adjustment.set_value (val);
1129 ignore_speed_adjustment = false;
1135 MixerStrip::set_selected (bool yn)
1137 AxisView::set_selected (yn);
1139 global_frame.set_shadow_type (Gtk::SHADOW_ETCHED_OUT);
1140 global_frame.set_name ("MixerStripSelectedFrame");
1142 global_frame.set_shadow_type (Gtk::SHADOW_IN);
1143 global_frame.set_name ("MixerStripFrame");
1145 global_frame.queue_draw ();
1149 MixerStrip::name_changed (void *src)
1153 RouteUI::name_changed (src);
1156 name_label.set_text (PBD::short_version (_route->name(), 5));
1159 if (_route->phase_invert()) {
1160 name_label.set_text (X_("Ø ") + name_label.get_text());
1165 MixerStrip::width_clicked ()
1169 set_width (Narrow, this);
1172 set_width (Wide, this);
1178 MixerStrip::hide_clicked ()
1180 // LAME fix to reset the button status for when it is redisplayed (part 1)
1181 hide_button.set_sensitive(false);
1184 Hiding(); /* EMIT_SIGNAL */
1186 _mixer.hide_strip (this);
1190 hide_button.set_sensitive(true);
1194 MixerStrip::set_embedded (bool yn)
1200 MixerStrip::map_frozen ()
1202 ENSURE_GUI_THREAD (mem_fun(*this, &MixerStrip::map_frozen));
1204 boost::shared_ptr<AudioTrack> at = audio_track();
1207 switch (at->freeze_state()) {
1208 case AudioTrack::Frozen:
1209 pre_redirect_box.set_sensitive (false);
1210 post_redirect_box.set_sensitive (false);
1211 speed_spinner.set_sensitive (false);
1214 pre_redirect_box.set_sensitive (true);
1215 post_redirect_box.set_sensitive (true);
1216 speed_spinner.set_sensitive (true);
1217 // XXX need some way, maybe, to retoggle redirect editors
1222 hide_redirect_editors ();
1226 MixerStrip::hide_redirect_editors ()
1228 _route->foreach_redirect (this, &MixerStrip::hide_redirect_editor);
1232 MixerStrip::hide_redirect_editor (boost::shared_ptr<Redirect> redirect)
1234 void* gui = redirect->get_gui ();
1237 static_cast<Gtk::Widget*>(gui)->hide ();
1242 MixerStrip::route_active_changed ()
1244 RouteUI::route_active_changed ();
1246 if (is_audio_track()) {
1247 if (_route->active()) {
1248 set_name ("AudioTrackStripBase");
1249 gpm.set_meter_strip_name ("AudioTrackMetrics");
1251 set_name ("AudioTrackStripBaseInactive");
1252 gpm.set_meter_strip_name ("AudioTrackMetricsInactive");
1254 gpm.set_fader_name ("AudioTrackFader");
1255 } else { // FIXME: assumed audio bus
1256 if (_route->active()) {
1257 set_name ("AudioBusStripBase");
1258 gpm.set_meter_strip_name ("AudioBusMetrics");
1260 set_name ("AudioBusStripBaseInactive");
1261 gpm.set_meter_strip_name ("AudioBusMetricsInactive");
1263 gpm.set_fader_name ("AudioBusFader");
1268 MixerStrip::mix_group() const
1270 return _route->mix_group();
1274 MixerStrip::engine_stopped ()
1279 MixerStrip::engine_running ()
1284 MixerStrip::meter_changed (void *src)
1287 ENSURE_GUI_THREAD (bind (mem_fun(*this, &MixerStrip::meter_changed), src));
1289 switch (_route->meter_point()) {
1291 meter_point_label.set_text (_("input"));
1295 meter_point_label.set_text (_("pre"));
1298 case MeterPostFader:
1299 meter_point_label.set_text (_("post"));
1303 gpm.setup_meters ();
1304 // reset peak when meter point changes
1305 gpm.reset_peak_display();
1306 set_width (_width, this);