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 ignore_comment_edit = false;
138 ignore_toggle = false;
139 ignore_speed_adjustment = false;
144 width_button.add (*(manage (new Gtk::Image (::get_icon("strip_width")))));
145 hide_button.add (*(manage (new Gtk::Image (::get_icon("hide")))));
147 input_label.set_text (_("Input"));
148 ARDOUR_UI::instance()->set_tip (&input_button, _("Click to choose inputs"), "");
149 input_button.add (input_label);
150 input_button.set_name ("MixerIOButton");
151 input_label.set_name ("MixerIOButtonLabel");
153 output_label.set_text (_("Output"));
154 ARDOUR_UI::instance()->set_tip (&output_button, _("Click to choose outputs"), "");
155 output_button.add (output_label);
156 output_button.set_name ("MixerIOButton");
157 output_label.set_name ("MixerIOButtonLabel");
159 ARDOUR_UI::instance()->set_tip (&meter_point_button, _("Select metering point"), "");
160 meter_point_button.add (meter_point_label);
161 meter_point_button.set_name ("MixerStripMeterPreButton");
162 meter_point_label.set_name ("MixerStripMeterPreButton");
164 /* TRANSLATORS: this string should be longest of the strings
165 used to describe meter points. In english, it's "input".
167 set_size_request_to_display_given_text (meter_point_button, _("tupni"), 5, 5);
169 bottom_button_table.attach (meter_point_button, 1, 2, 0, 1);
171 meter_point_button.signal_button_press_event().connect (mem_fun (gpm, &GainMeter::meter_press), false);
172 /* XXX what is this meant to do? */
173 //meter_point_button.signal_button_release_event().connect (mem_fun (gpm, &GainMeter::meter_release), false);
175 hide_button.set_events (hide_button.get_events() & ~(Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK));
177 mute_button->set_name ("MixerMuteButton");
178 solo_button->set_name ("MixerSoloButton");
180 button_table.set_homogeneous (true);
181 button_table.set_spacings (0);
183 button_table.attach (name_button, 0, 2, 0, 1);
184 button_table.attach (input_button, 0, 2, 1, 2);
186 middle_button_table.set_homogeneous (true);
187 middle_button_table.set_spacings (0);
188 middle_button_table.attach (*mute_button, 0, 1, 0, 1);
189 middle_button_table.attach (*solo_button, 1, 2, 0, 1);
191 bottom_button_table.set_col_spacings (0);
192 bottom_button_table.set_homogeneous (true);
193 bottom_button_table.attach (group_button, 0, 1, 0, 1);
195 name_button.add (name_label);
196 name_button.set_name ("MixerNameButton");
197 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2);
199 name_label.set_name ("MixerNameButtonLabel");
200 ARDOUR_UI::instance()->set_tip (&group_button, _("Mix group"), "");
201 group_button.add (group_label);
202 group_button.set_name ("MixerGroupButton");
203 group_label.set_name ("MixerGroupButtonLabel");
205 comment_button.set_name ("MixerCommentButton");
207 comment_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::comment_button_clicked));
209 global_vpacker.set_border_width (0);
210 global_vpacker.set_spacing (0);
212 VBox *whvbox = manage (new VBox);
214 width_button.set_name ("MixerWidthButton");
215 hide_button.set_name ("MixerHideButton");
216 top_event_box.set_name ("MixerTopEventBox");
218 width_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::width_clicked));
219 hide_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::hide_clicked));
221 width_hide_box.pack_start (width_button, false, true);
222 width_hide_box.pack_start (top_event_box, true, true);
223 width_hide_box.pack_end (hide_button, false, true);
224 Gtk::Alignment *gain_meter_alignment = Gtk::manage(new Gtk::Alignment());
225 gain_meter_alignment->set_padding(0, 4, 0, 0);
226 gain_meter_alignment->add(gpm);
228 whvbox->pack_start (width_hide_box, true, true);
230 global_vpacker.pack_start (*whvbox, Gtk::PACK_SHRINK);
231 global_vpacker.pack_start (button_table,Gtk::PACK_SHRINK);
232 global_vpacker.pack_start (pre_redirect_box, true, true);
233 global_vpacker.pack_start (middle_button_table,Gtk::PACK_SHRINK);
234 global_vpacker.pack_start (*gain_meter_alignment,Gtk::PACK_SHRINK);
235 global_vpacker.pack_start (bottom_button_table,Gtk::PACK_SHRINK);
236 global_vpacker.pack_start (post_redirect_box, true, true);
237 global_vpacker.pack_start (panners, Gtk::PACK_SHRINK);
238 global_vpacker.pack_start (output_button, Gtk::PACK_SHRINK);
239 global_vpacker.pack_start (comment_button, Gtk::PACK_SHRINK);
241 global_frame.add (global_vpacker);
242 global_frame.set_shadow_type (Gtk::SHADOW_IN);
243 global_frame.set_name ("BaseFrame");
247 /* force setting of visible selected status */
250 set_selected (false);
255 _session.engine().Stopped.connect (mem_fun(*this, &MixerStrip::engine_stopped));
256 _session.engine().Running.connect (mem_fun(*this, &MixerStrip::engine_running));
258 input_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::input_press), false);
259 output_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::output_press), false);
261 solo_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::solo_press), false);
262 solo_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::solo_release), false);
263 mute_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::mute_press), false);
264 mute_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::mute_release), false);
266 /* we don't need this if its not an audio track, but we don't know that yet and it doesn't
270 rec_enable_button->set_name ("MixerRecordEnableButton");
271 rec_enable_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::rec_enable_press), false);
272 rec_enable_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::rec_enable_release));
274 name_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::name_button_button_press), false);
275 group_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::select_mix_group), false);
279 /* start off as a passthru strip. we'll correct this, if necessary,
280 in update_diskstream_display().
283 set_name ("AudioTrackStripBase");
285 add_events (Gdk::BUTTON_RELEASE_MASK);
288 MixerStrip::~MixerStrip ()
290 GoingAway(); /* EMIT_SIGNAL */
292 if (input_selector) {
293 delete input_selector;
296 if (output_selector) {
297 delete output_selector;
302 MixerStrip::set_route (boost::shared_ptr<Route> rt)
304 if (rec_enable_button->get_parent()) {
305 button_table.remove (*rec_enable_button);
308 #ifdef VARISPEED_IN_MIXER_STRIP
309 if (speed_frame->get_parent()) {
310 button_table.remove (*speed_frame);
314 RouteUI::set_route (rt);
316 if (input_selector) {
317 delete input_selector;
321 if (output_selector) {
322 delete output_selector;
328 pre_redirect_box.set_route (rt);
329 post_redirect_box.set_route (rt);
331 if (set_color_from_route()) {
332 set_color (unique_random_color());
335 if (_mixer_owned && (route()->master() || route()->control())) {
337 if (scrollbar_height == 0) {
338 HScrollbar scrollbar;
339 Gtk::Requisition requisition(scrollbar.size_request ());
340 scrollbar_height = requisition.height;
343 EventBox* spacer = manage (new EventBox);
344 spacer->set_size_request (-1, scrollbar_height);
345 global_vpacker.pack_start (*spacer, false, false);
348 if (is_audio_track()) {
350 boost::shared_ptr<AudioTrack> at = audio_track();
352 connections.push_back (at->FreezeChange.connect (mem_fun(*this, &MixerStrip::map_frozen)));
354 #ifdef VARISPEED_IN_MIXER_STRIP
355 speed_adjustment.signal_value_changed().connect (mem_fun(*this, &MixerStrip::speed_adjustment_changed));
357 speed_frame.set_name ("BaseFrame");
358 speed_frame.set_shadow_type (Gtk::SHADOW_IN);
359 speed_frame.add (speed_spinner);
361 speed_spinner.set_print_func (speed_printer, 0);
363 ARDOUR_UI::instance()->tooltips().set_tip (speed_spinner, _("Varispeed"));
365 button_table.attach (speed_frame, 0, 2, 5, 6);
366 #endif /* VARISPEED_IN_MIXER_STRIP */
368 button_table.attach (*rec_enable_button, 0, 2, 2, 3);
369 rec_enable_button->show();
372 if (_route->phase_invert()) {
373 name_label.set_text (X_("Ø ") + name_label.get_text());
375 name_label.set_text (_route->name());
378 switch (_route->meter_point()) {
380 meter_point_label.set_text (_("input"));
384 meter_point_label.set_text (_("pre"));
388 meter_point_label.set_text (_("post"));
392 ARDOUR_UI::instance()->tooltips().set_tip (comment_button, _route->comment().empty() ?
393 _("Click to Add/Edit Comments"):
396 connections.push_back (_route->meter_change.connect (mem_fun(*this, &MixerStrip::meter_changed)));
397 connections.push_back (_route->input_changed.connect (mem_fun(*this, &MixerStrip::input_changed)));
398 connections.push_back (_route->output_changed.connect (mem_fun(*this, &MixerStrip::output_changed)));
399 connections.push_back (_route->mute_changed.connect (mem_fun(*this, &RouteUI::mute_changed)));
400 connections.push_back (_route->solo_changed.connect (mem_fun(*this, &RouteUI::solo_changed)));
401 connections.push_back (_route->solo_safe_changed.connect (mem_fun(*this, &RouteUI::solo_changed)));
402 connections.push_back (_route->mix_group_changed.connect (mem_fun(*this, &MixerStrip::mix_group_changed)));
403 connections.push_back (_route->panner().Changed.connect (mem_fun(*this, &MixerStrip::connect_to_pan)));
405 if (is_audio_track()) {
406 connections.push_back (audio_track()->DiskstreamChanged.connect (mem_fun(*this, &MixerStrip::diskstream_changed)));
407 connections.push_back (get_diskstream()->SpeedChanged.connect (mem_fun(*this, &MixerStrip::speed_changed)));
410 connections.push_back (_route->name_changed.connect (mem_fun(*this, &RouteUI::name_changed)));
411 connections.push_back (_route->comment_changed.connect (mem_fun(*this, &MixerStrip::comment_changed)));
412 connections.push_back (_route->gui_changed.connect (mem_fun(*this, &MixerStrip::route_gui_changed)));
414 set_stuff_from_route ();
416 /* now force an update of all the various elements */
418 pre_redirect_box.update();
419 post_redirect_box.update();
424 mix_group_changed (0);
428 panners.setup_pan ();
430 if (is_audio_track()) {
434 update_diskstream_display ();
435 update_input_display ();
436 update_output_display ();
440 MixerStrip::set_stuff_from_route ()
446 /* if width is not set, it will be set by the MixerUI or editor */
448 if ((prop = xml_node->property ("strip_width")) != 0) {
449 set_width (Width (string_2_enum (prop->value(), _width)), this);
452 if ((prop = xml_node->property ("shown_mixer")) != 0) {
453 if (prop->value() == "no") {
454 _marked_for_display = false;
456 _marked_for_display = true;
459 /* backwards compatibility */
460 _marked_for_display = true;
465 MixerStrip::set_width (Width w, void* owner)
467 /* always set the gpm width again, things may be hidden */
470 panners.set_width (w);
471 pre_redirect_box.set_width (w);
472 post_redirect_box.set_width (w);
474 _width_owner = owner;
480 if (_width_owner == this) {
481 xml_node->add_property ("strip_width", enum_2_string (_width));
487 if (rec_enable_button) {
488 ((Gtk::Label*)rec_enable_button->get_child())->set_text (_("Record"));
490 ((Gtk::Label*)mute_button->get_child())->set_text (_("Mute"));
491 ((Gtk::Label*)solo_button->get_child())->set_text (_("Solo"));
493 if (_route->comment() == "") {
494 comment_button.unset_bg (STATE_NORMAL);
495 ((Gtk::Label*)comment_button.get_child())->set_text (_("Comments"));
497 comment_button.modify_bg (STATE_NORMAL, color());
498 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Comments*"));
501 ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (gpm.astyle_string(_route->gain_automation_curve().automation_style()));
502 ((Gtk::Label*)gpm.gain_automation_state_button.get_child())->set_text (gpm.astate_string(_route->gain_automation_curve().automation_state()));
503 ((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text (panners.astyle_string(_route->panner().automation_style()));
504 ((Gtk::Label*)panners.pan_automation_state_button.get_child())->set_text (panners.astate_string(_route->panner().automation_state()));
505 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "long", 2, 2);
506 set_size_request (-1, -1);
510 if (rec_enable_button) {
511 ((Gtk::Label*)rec_enable_button->get_child())->set_text (_("Rec"));
513 ((Gtk::Label*)mute_button->get_child())->set_text (_("M"));
514 ((Gtk::Label*)solo_button->get_child())->set_text (_("S"));
516 if (_route->comment() == "") {
517 comment_button.unset_bg (STATE_NORMAL);
518 ((Gtk::Label*)comment_button.get_child())->set_text (_("Cmt"));
520 comment_button.modify_bg (STATE_NORMAL, color());
521 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Cmt*"));
524 ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (gpm.short_astyle_string(_route->gain_automation_curve().automation_style()));
525 ((Gtk::Label*)gpm.gain_automation_state_button.get_child())->set_text (gpm.short_astate_string(_route->gain_automation_curve().automation_state()));
526 ((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text (panners.short_astyle_string(_route->panner().automation_style()));
527 ((Gtk::Label*)panners.pan_automation_state_button.get_child())->set_text (panners.short_astate_string(_route->panner().automation_state()));
528 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2);
529 set_size_request (max (50, gpm.get_gm_width()), -1);
532 update_input_display ();
533 update_output_display ();
534 mix_group_changed (0);
542 MixerStrip::set_packed (bool yn)
549 xml_node->add_property ("shown_mixer", "yes");
551 xml_node->add_property ("shown_mixer", "no");
557 MixerStrip::output_press (GdkEventButton *ev)
559 using namespace Menu_Helpers;
560 if (!_session.engine().connected()) {
561 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
566 MenuList& citems = output_menu.items();
567 switch (ev->button) {
570 output_menu.set_name ("ArdourContextMenu");
573 citems.push_back (MenuElem (_("Edit"), mem_fun(*this, &MixerStrip::edit_output_configuration)));
574 citems.push_back (SeparatorElem());
575 citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_output)));
576 citems.push_back (SeparatorElem());
578 _session.foreach_connection (this, &MixerStrip::add_connection_to_output_menu);
580 output_menu.popup (1, ev->time);
590 MixerStrip::edit_output_configuration ()
592 if (output_selector == 0) {
593 output_selector = new IOSelectorWindow (_session, _route, false);
596 if (output_selector->is_visible()) {
597 output_selector->get_toplevel()->get_window()->raise();
599 output_selector->show_all ();
604 MixerStrip::edit_input_configuration ()
606 if (input_selector == 0) {
607 input_selector = new IOSelectorWindow (_session, _route, true);
610 if (input_selector->is_visible()) {
611 input_selector->get_toplevel()->get_window()->raise();
613 input_selector->show_all ();
618 MixerStrip::input_press (GdkEventButton *ev)
620 using namespace Menu_Helpers;
622 MenuList& citems = input_menu.items();
623 input_menu.set_name ("ArdourContextMenu");
626 if (!_session.engine().connected()) {
627 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
632 switch (ev->button) {
635 citems.push_back (MenuElem (_("Edit"), mem_fun(*this, &MixerStrip::edit_input_configuration)));
636 citems.push_back (SeparatorElem());
637 citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_input)));
638 citems.push_back (SeparatorElem());
640 _session.foreach_connection (this, &MixerStrip::add_connection_to_input_menu);
642 input_menu.popup (1, ev->time);
652 MixerStrip::connection_input_chosen (ARDOUR::Connection *c)
654 if (!ignore_toggle) {
657 _route->use_input_connection (*c, this);
660 catch (AudioEngine::PortRegistrationFailure& err) {
661 error << _("could not register new ports required for that connection")
668 MixerStrip::connection_output_chosen (ARDOUR::Connection *c)
670 if (!ignore_toggle) {
673 _route->use_output_connection (*c, this);
676 catch (AudioEngine::PortRegistrationFailure& err) {
677 error << _("could not register new ports required for that connection")
684 MixerStrip::add_connection_to_input_menu (ARDOUR::Connection* c)
686 using namespace Menu_Helpers;
688 if (dynamic_cast<InputConnection *> (c) == 0) {
692 MenuList& citems = input_menu.items();
694 if (c->nports() == _route->n_inputs()) {
696 citems.push_back (CheckMenuElem (c->name(), bind (mem_fun(*this, &MixerStrip::connection_input_chosen), c)));
698 ARDOUR::Connection *current = _route->input_connection();
701 ignore_toggle = true;
702 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
703 ignore_toggle = false;
709 MixerStrip::add_connection_to_output_menu (ARDOUR::Connection* c)
711 using namespace Menu_Helpers;
713 if (dynamic_cast<OutputConnection *> (c) == 0) {
717 if (c->nports() == _route->n_outputs()) {
719 MenuList& citems = output_menu.items();
720 citems.push_back (CheckMenuElem (c->name(), bind (mem_fun(*this, &MixerStrip::connection_output_chosen), c)));
722 ARDOUR::Connection *current = _route->output_connection();
725 ignore_toggle = true;
726 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
727 ignore_toggle = false;
733 MixerStrip::update_diskstream_display ()
736 update_input_display ();
738 if (is_audio_track()) {
740 if (input_selector) {
741 input_selector->hide_all ();
748 show_passthru_color ();
753 MixerStrip::connect_to_pan ()
755 ENSURE_GUI_THREAD(mem_fun(*this, &MixerStrip::connect_to_pan));
757 panstate_connection.disconnect ();
758 panstyle_connection.disconnect ();
760 if (!_route->panner().empty()) {
761 StreamPanner* sp = _route->panner().front();
763 panstate_connection = sp->automation().automation_state_changed.connect (mem_fun(panners, &PannerUI::pan_automation_state_changed));
764 panstyle_connection = sp->automation().automation_style_changed.connect (mem_fun(panners, &PannerUI::pan_automation_style_changed));
767 panners.pan_changed (this);
771 MixerStrip::update_input_display ()
773 ARDOUR::Connection *c;
775 if ((c = _route->input_connection()) != 0) {
776 input_label.set_text (c->name());
780 input_label.set_text (_(" Input"));
783 input_label.set_text (_("I"));
787 panners.setup_pan ();
791 MixerStrip::update_output_display ()
793 ARDOUR::Connection *c;
795 if ((c = _route->output_connection()) != 0) {
796 output_label.set_text (c->name());
800 output_label.set_text (_("Output"));
803 output_label.set_text (_("O"));
809 panners.setup_pan ();
813 MixerStrip::fast_update ()
815 gpm.update_meters ();
819 MixerStrip::diskstream_changed ()
821 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_diskstream_display));
825 MixerStrip::input_changed (IOChange change, void *src)
827 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_input_display));
828 set_width(_width, this);
832 MixerStrip::output_changed (IOChange change, void *src)
834 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_output_display));
835 set_width(_width, this);
840 MixerStrip::comment_editor_done_editing()
842 string str = comment_area->get_buffer()->get_text();
843 if (_route->comment() != str) {
844 _route->set_comment (str, this);
850 comment_button.modify_bg (STATE_NORMAL, color());
851 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Comments*"));
853 comment_button.unset_bg (STATE_NORMAL);
854 ((Gtk::Label*)comment_button.get_child())->set_text (_("Comments"));
860 comment_button.modify_bg (STATE_NORMAL, color());
861 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Cmt*"));
863 comment_button.unset_bg (STATE_NORMAL);
864 ((Gtk::Label*)comment_button.get_child())->set_text (_("Cmt"));
869 ARDOUR_UI::instance()->tooltips().set_tip (comment_button,
870 str.empty() ? _("Click to Add/Edit Comments") : str);
876 MixerStrip::comment_button_clicked ()
878 if (comment_window == 0) {
879 setup_comment_editor ();
882 int x, y, cw_width, cw_height;
884 if (comment_window->is_visible()) {
885 comment_window->hide ();
889 comment_window->get_size (cw_width, cw_height);
890 comment_window->get_position(x, y);
891 comment_window->move(x, y - (cw_height / 2) - 45);
893 half the dialog height minus the comments button height
894 with some window decoration fudge thrown in.
897 comment_window->show();
898 comment_window->present();
902 MixerStrip::setup_comment_editor ()
905 title = _route->name();
906 title += _(": comment editor");
908 comment_window = new ArdourDialog (title, false);
909 comment_window->set_position (Gtk::WIN_POS_MOUSE);
910 comment_window->set_skip_taskbar_hint (true);
911 comment_window->signal_hide().connect (mem_fun(*this, &MixerStrip::comment_editor_done_editing));
913 comment_area = manage (new TextView());
914 comment_area->set_name ("MixerTrackCommentArea");
915 comment_area->set_size_request (110, 178);
916 comment_area->set_wrap_mode (WRAP_WORD);
917 comment_area->set_editable (true);
918 comment_area->get_buffer()->set_text (_route->comment());
919 comment_area->show ();
921 comment_window->get_vbox()->pack_start (*comment_area);
922 comment_window->get_action_area()->hide();
926 MixerStrip::comment_changed (void *src)
928 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::comment_changed), src));
931 ignore_comment_edit = true;
933 comment_area->get_buffer()->set_text (_route->comment());
935 ignore_comment_edit = false;
940 MixerStrip::set_mix_group (RouteGroup *rg)
942 _route->set_mix_group (rg, this);
946 MixerStrip::add_mix_group_to_menu (RouteGroup *rg, RadioMenuItem::Group* group)
948 using namespace Menu_Helpers;
950 MenuList& items = group_menu->items();
952 items.push_back (RadioMenuElem (*group, rg->name(), bind (mem_fun(*this, &MixerStrip::set_mix_group), rg)));
954 if (_route->mix_group() == rg) {
955 static_cast<RadioMenuItem*>(&items.back())->set_active ();
960 MixerStrip::select_mix_group (GdkEventButton *ev)
962 using namespace Menu_Helpers;
964 if (group_menu == 0) {
965 group_menu = new Menu;
967 group_menu->set_name ("ArdourContextMenu");
968 MenuList& items = group_menu->items();
969 RadioMenuItem::Group group;
971 switch (ev->button) {
975 items.push_back (RadioMenuElem (group, _("No group"), bind (mem_fun(*this, &MixerStrip::set_mix_group), (RouteGroup *) 0)));
977 _session.foreach_mix_group (bind (mem_fun (*this, &MixerStrip::add_mix_group_to_menu), &group));
979 group_menu->popup (1, ev->time);
990 MixerStrip::mix_group_changed (void *ignored)
992 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::mix_group_changed), ignored));
994 RouteGroup *rg = _route->mix_group();
997 group_label.set_text (rg->name());
1001 group_label.set_text (_("Grp"));
1004 group_label.set_text (_("~G"));
1012 MixerStrip::route_gui_changed (string what_changed, void* ignored)
1014 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::route_gui_changed), what_changed, ignored));
1016 if (what_changed == "color") {
1017 if (set_color_from_route () == 0) {
1018 show_route_color ();
1024 MixerStrip::show_route_color ()
1026 name_button.modify_bg (STATE_NORMAL, color());
1027 top_event_box.modify_bg (STATE_NORMAL, color());
1028 route_active_changed ();
1032 MixerStrip::show_passthru_color ()
1034 route_active_changed ();
1038 MixerStrip::build_route_ops_menu ()
1040 using namespace Menu_Helpers;
1041 route_ops_menu = manage (new Menu);
1042 route_ops_menu->set_name ("ArdourContextMenu");
1044 MenuList& items = route_ops_menu->items();
1046 items.push_back (MenuElem (_("Rename"), mem_fun(*this, &RouteUI::route_rename)));
1047 items.push_back (SeparatorElem());
1048 items.push_back (CheckMenuElem (_("Active"), mem_fun (*this, &RouteUI::toggle_route_active)));
1049 route_active_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
1050 route_active_menu_item->set_active (_route->active());
1051 items.push_back (SeparatorElem());
1052 items.push_back (CheckMenuElem (_("Invert Polarity"), mem_fun (*this, &RouteUI::toggle_polarity)));
1053 polarity_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
1054 polarity_menu_item->set_active (_route->phase_invert());
1055 items.push_back (CheckMenuElem (_("Protect against denormals"), mem_fun (*this, &RouteUI::toggle_denormal_protection)));
1056 denormal_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
1057 denormal_menu_item->set_active (_route->denormal_protection());
1059 build_remote_control_menu ();
1061 items.push_back (SeparatorElem());
1062 if (!Profile->get_sae()) {
1063 items.push_back (MenuElem (_("Remote Control ID"), *remote_control_menu));
1066 items.push_back (SeparatorElem());
1067 items.push_back (MenuElem (_("Remove"), mem_fun(*this, &RouteUI::remove_this_route)));
1071 MixerStrip::name_button_button_press (GdkEventButton* ev)
1073 if (ev->button == 1) {
1074 list_route_operations ();
1076 Menu_Helpers::MenuList& items = route_ops_menu->items();
1077 /* do not allow rename if the track is record-enabled */
1078 static_cast<MenuItem*> (&items.front())->set_sensitive (!_route->record_enabled());
1080 route_ops_menu->popup (1, ev->time);
1086 MixerStrip::list_route_operations ()
1088 if (route_ops_menu == 0) {
1089 build_route_ops_menu ();
1092 refresh_remote_control_menu();
1097 MixerStrip::speed_adjustment_changed ()
1099 /* since there is a usable speed adjustment, there has to be a diskstream */
1100 if (!ignore_speed_adjustment) {
1101 get_diskstream()->set_speed (speed_adjustment.get_value());
1106 MixerStrip::speed_changed ()
1108 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_speed_display));
1112 MixerStrip::update_speed_display ()
1116 val = get_diskstream()->speed();
1119 speed_spinner.set_name ("MixerStripSpeedBaseNotOne");
1121 speed_spinner.set_name ("MixerStripSpeedBase");
1124 if (speed_adjustment.get_value() != val) {
1125 ignore_speed_adjustment = true;
1126 speed_adjustment.set_value (val);
1127 ignore_speed_adjustment = false;
1133 MixerStrip::set_selected (bool yn)
1135 AxisView::set_selected (yn);
1137 global_frame.set_shadow_type (Gtk::SHADOW_ETCHED_OUT);
1138 global_frame.set_name ("MixerStripSelectedFrame");
1140 global_frame.set_shadow_type (Gtk::SHADOW_IN);
1141 global_frame.set_name ("MixerStripFrame");
1143 global_frame.queue_draw ();
1147 MixerStrip::name_changed (void *src)
1151 RouteUI::name_changed (src);
1154 name_label.set_text (PBD::short_version (_route->name(), 5));
1157 if (_route->phase_invert()) {
1158 name_label.set_text (X_("Ø ") + name_label.get_text());
1163 MixerStrip::width_clicked ()
1167 set_width (Narrow, this);
1170 set_width (Wide, this);
1176 MixerStrip::hide_clicked ()
1178 // LAME fix to reset the button status for when it is redisplayed (part 1)
1179 hide_button.set_sensitive(false);
1182 Hiding(); /* EMIT_SIGNAL */
1184 _mixer.hide_strip (this);
1188 hide_button.set_sensitive(true);
1192 MixerStrip::set_embedded (bool yn)
1198 MixerStrip::map_frozen ()
1200 ENSURE_GUI_THREAD (mem_fun(*this, &MixerStrip::map_frozen));
1202 boost::shared_ptr<AudioTrack> at = audio_track();
1205 switch (at->freeze_state()) {
1206 case AudioTrack::Frozen:
1207 pre_redirect_box.set_sensitive (false);
1208 post_redirect_box.set_sensitive (false);
1209 speed_spinner.set_sensitive (false);
1212 pre_redirect_box.set_sensitive (true);
1213 post_redirect_box.set_sensitive (true);
1214 speed_spinner.set_sensitive (true);
1215 // XXX need some way, maybe, to retoggle redirect editors
1220 hide_redirect_editors ();
1224 MixerStrip::hide_redirect_editors ()
1226 _route->foreach_redirect (this, &MixerStrip::hide_redirect_editor);
1230 MixerStrip::hide_redirect_editor (boost::shared_ptr<Redirect> redirect)
1232 void* gui = redirect->get_gui ();
1235 static_cast<Gtk::Widget*>(gui)->hide ();
1240 MixerStrip::route_active_changed ()
1242 RouteUI::route_active_changed ();
1244 if (is_audio_track()) {
1245 if (_route->active()) {
1246 set_name ("AudioTrackStripBase");
1247 gpm.set_meter_strip_name ("AudioTrackMetrics");
1249 set_name ("AudioTrackStripBaseInactive");
1250 gpm.set_meter_strip_name ("AudioTrackMetricsInactive");
1252 gpm.set_fader_name ("AudioTrackFader");
1253 } else { // FIXME: assumed audio bus
1254 if (_route->active()) {
1255 set_name ("AudioBusStripBase");
1256 gpm.set_meter_strip_name ("AudioBusMetrics");
1258 set_name ("AudioBusStripBaseInactive");
1259 gpm.set_meter_strip_name ("AudioBusMetricsInactive");
1261 gpm.set_fader_name ("AudioBusFader");
1266 MixerStrip::mix_group() const
1268 return _route->mix_group();
1272 MixerStrip::engine_stopped ()
1277 MixerStrip::engine_running ()
1282 MixerStrip::meter_changed (void *src)
1285 ENSURE_GUI_THREAD (bind (mem_fun(*this, &MixerStrip::meter_changed), src));
1287 switch (_route->meter_point()) {
1289 meter_point_label.set_text (_("input"));
1293 meter_point_label.set_text (_("pre"));
1296 case MeterPostFader:
1297 meter_point_label.set_text (_("post"));
1301 gpm.setup_meters ();
1302 // reset peak when meter point changes
1303 gpm.reset_peak_display();
1304 set_width (_width, this);