2 Copyright (C) 2000-2006 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #include <sigc++/bind.h>
24 #include <pbd/convert.h>
25 #include <pbd/enumwriter.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/processor.h>
44 #include <ardour/profile.h>
45 #include <ardour/ladspa_plugin.h>
46 #include <ardour/user_bundle.h>
48 #include "ardour_ui.h"
49 #include "ardour_dialog.h"
50 #include "mixer_strip.h"
53 #include "public_editor.h"
55 #include "io_selector.h"
57 #include "gui_thread.h"
62 using namespace ARDOUR;
65 using namespace Gtkmm2ext;
68 int MixerStrip::scrollbar_height = 0;
70 #ifdef VARISPEED_IN_MIXER_STRIP
72 speed_printer (char buf[32], Gtk::Adjustment& adj, void* arg)
74 float val = adj.get_value ();
79 snprintf (buf, 32, "%.3f", val);
84 MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, bool in_mixer)
86 , RouteUI (sess, _("Mute"), _("Solo"), _("Record"))
88 , _mixer_owned (in_mixer)
89 , pre_processor_box (PreFader, sess, mx.plugin_selector(), mx.selection(), in_mixer)
90 , post_processor_box (PostFader, sess, mx.plugin_selector(), mx.selection(), in_mixer)
94 , middle_button_table (1, 2)
95 , bottom_button_table (1, 2)
96 , meter_point_label (_("pre"))
97 , comment_button (_("Comments"))
98 , speed_adjustment (1.0, 0.001, 4.0, 0.001, 0.1)
99 , speed_spinner (&speed_adjustment, "MixerStripSpeedBase", true)
105 MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, boost::shared_ptr<Route> rt, bool in_mixer)
107 , RouteUI (sess, _("Mute"), _("Solo"), _("Record"))
109 , _mixer_owned (in_mixer)
110 , pre_processor_box (PreFader, sess, mx.plugin_selector(), mx.selection(), in_mixer)
111 , post_processor_box (PostFader, sess, mx.plugin_selector(), mx.selection(), in_mixer)
114 , button_table (3, 2)
115 , middle_button_table (1, 2)
116 , bottom_button_table (1, 2)
117 , meter_point_label (_("pre"))
118 , comment_button (_("Comments"))
119 , speed_adjustment (1.0, 0.001, 4.0, 0.001, 0.1)
120 , speed_spinner (&speed_adjustment, "MixerStripSpeedBase", true)
133 _marked_for_display = false;
135 ignore_comment_edit = false;
136 ignore_toggle = false;
137 ignore_speed_adjustment = false;
145 img = manage (new Gtk::Image (::get_icon("strip_width")));
148 width_button.add (*img);
150 img = manage (new Gtk::Image (::get_icon("hide")));
153 hide_button.add (*img);
155 input_label.set_text (_("Input"));
156 ARDOUR_UI::instance()->set_tip (&input_button, _("Button 1 to choose inputs from a port matrix, button 3 to select inputs from a menu"), "");
157 input_button.add (input_label);
158 input_button.set_name ("MixerIOButton");
159 input_label.set_name ("MixerIOButtonLabel");
161 output_label.set_text (_("Output"));
162 ARDOUR_UI::instance()->set_tip (&output_button, _("Button 1 to choose outputs from a port matrix, button 3 to select inputs from a menu"), "");
163 output_button.add (output_label);
164 output_button.set_name ("MixerIOButton");
165 output_label.set_name ("MixerIOButtonLabel");
167 ARDOUR_UI::instance()->set_tip (&meter_point_button, _("Select metering point"), "");
168 meter_point_button.add (meter_point_label);
169 meter_point_button.set_name ("MixerStripMeterPreButton");
170 meter_point_label.set_name ("MixerStripMeterPreButton");
172 /* TRANSLATORS: this string should be longest of the strings
173 used to describe meter points. In english, it's "input".
175 set_size_request_to_display_given_text (meter_point_button, _("tupni"), 5, 5);
177 bottom_button_table.attach (meter_point_button, 1, 2, 0, 1);
179 meter_point_button.signal_button_press_event().connect (mem_fun (gpm, &GainMeter::meter_press), false);
180 /* XXX what is this meant to do? */
181 //meter_point_button.signal_button_release_event().connect (mem_fun (gpm, &GainMeter::meter_release), false);
183 hide_button.set_events (hide_button.get_events() & ~(Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK));
185 mute_button->set_name ("MixerMuteButton");
186 solo_button->set_name ("MixerSoloButton");
188 button_table.set_homogeneous (true);
189 button_table.set_spacings (0);
191 button_table.attach (name_button, 0, 2, 0, 1);
192 button_table.attach (input_button, 0, 2, 1, 2);
194 middle_button_table.set_homogeneous (true);
195 middle_button_table.set_spacings (0);
196 middle_button_table.attach (*mute_button, 0, 1, 0, 1);
197 middle_button_table.attach (*solo_button, 1, 2, 0, 1);
199 bottom_button_table.set_col_spacings (0);
200 bottom_button_table.set_homogeneous (true);
201 bottom_button_table.attach (group_button, 0, 1, 0, 1);
203 name_button.add (name_label);
204 name_button.set_name ("MixerNameButton");
205 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2);
207 name_label.set_name ("MixerNameButtonLabel");
208 ARDOUR_UI::instance()->set_tip (&group_button, _("Mix group"), "");
209 group_button.add (group_label);
210 group_button.set_name ("MixerGroupButton");
211 group_label.set_name ("MixerGroupButtonLabel");
213 comment_button.set_name ("MixerCommentButton");
215 comment_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::comment_button_clicked));
217 global_vpacker.set_border_width (0);
218 global_vpacker.set_spacing (0);
220 width_button.set_name ("MixerWidthButton");
221 hide_button.set_name ("MixerHideButton");
222 top_event_box.set_name ("MixerTopEventBox");
224 width_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::width_clicked));
225 hide_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::hide_clicked));
227 width_hide_box.pack_start (width_button, false, true);
228 width_hide_box.pack_start (top_event_box, true, true);
229 width_hide_box.pack_end (hide_button, false, true);
230 gain_meter_alignment.set_padding(0, 4, 0, 0);
231 gain_meter_alignment.add(gpm);
233 whvbox.pack_start (width_hide_box, true, true);
235 global_vpacker.pack_start (whvbox, Gtk::PACK_SHRINK);
236 global_vpacker.pack_start (button_table,Gtk::PACK_SHRINK);
237 global_vpacker.pack_start (pre_processor_box, true, true);
238 global_vpacker.pack_start (middle_button_table,Gtk::PACK_SHRINK);
239 global_vpacker.pack_start (gain_meter_alignment,Gtk::PACK_SHRINK);
240 global_vpacker.pack_start (bottom_button_table,Gtk::PACK_SHRINK);
241 global_vpacker.pack_start (post_processor_box, true, true);
242 if (!is_midi_track()) {
243 global_vpacker.pack_start (panners, Gtk::PACK_SHRINK);
245 global_vpacker.pack_start (output_button, Gtk::PACK_SHRINK);
246 global_vpacker.pack_start (comment_button, Gtk::PACK_SHRINK);
248 global_frame.add (global_vpacker);
249 global_frame.set_shadow_type (Gtk::SHADOW_IN);
250 global_frame.set_name ("BaseFrame");
254 /* force setting of visible selected status */
257 set_selected (false);
262 _session.engine().Stopped.connect (mem_fun(*this, &MixerStrip::engine_stopped));
263 _session.engine().Running.connect (mem_fun(*this, &MixerStrip::engine_running));
265 input_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::input_press), false);
266 output_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::output_press), false);
268 solo_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::solo_press), false);
269 solo_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::solo_release), false);
270 mute_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::mute_press), false);
271 mute_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::mute_release), false);
273 /* we don't need this if its not an audio track, but we don't know that yet and it doesn't
277 rec_enable_button->set_name ("MixerRecordEnableButton");
278 rec_enable_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::rec_enable_press), false);
279 rec_enable_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::rec_enable_release));
281 name_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::name_button_button_press), false);
282 group_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::select_mix_group), false);
286 /* start off as a passthru strip. we'll correct this, if necessary,
287 in update_diskstream_display().
290 /* start off as a passthru strip. we'll correct this, if necessary,
291 in update_diskstream_display().
295 set_name ("MidiTrackStripBase");
297 set_name ("AudioTrackStripBase");
299 add_events (Gdk::BUTTON_RELEASE_MASK);
302 MixerStrip::~MixerStrip ()
304 GoingAway(); /* EMIT_SIGNAL */
306 delete input_selector;
307 delete output_selector;
311 MixerStrip::set_route (boost::shared_ptr<Route> rt)
313 if (rec_enable_button->get_parent()) {
314 button_table.remove (*rec_enable_button);
317 #ifdef VARISPEED_IN_MIXER_STRIP
318 if (speed_frame->get_parent()) {
319 button_table.remove (*speed_frame);
323 RouteUI::set_route (rt);
325 delete input_selector;
328 delete output_selector;
333 pre_processor_box.set_route (rt);
334 post_processor_box.set_route (rt);
336 if (set_color_from_route()) {
337 set_color (unique_random_color());
340 if (_mixer_owned && (route()->is_master() || route()->is_control())) {
342 if (scrollbar_height == 0) {
343 HScrollbar scrollbar;
344 Gtk::Requisition requisition(scrollbar.size_request ());
345 scrollbar_height = requisition.height;
348 spacer = manage (new EventBox);
349 spacer->set_size_request (-1, scrollbar_height);
350 global_vpacker.pack_start (*spacer, false, false);
353 if (is_audio_track()) {
355 boost::shared_ptr<AudioTrack> at = audio_track();
357 connections.push_back (at->FreezeChange.connect (mem_fun(*this, &MixerStrip::map_frozen)));
359 #ifdef VARISPEED_IN_MIXER_STRIP
360 speed_adjustment.signal_value_changed().connect (mem_fun(*this, &MixerStrip::speed_adjustment_changed));
362 speed_frame.set_name ("BaseFrame");
363 speed_frame.set_shadow_type (Gtk::SHADOW_IN);
364 speed_frame.add (speed_spinner);
366 speed_spinner.set_print_func (speed_printer, 0);
368 ARDOUR_UI::instance()->tooltips().set_tip (speed_spinner, _("Varispeed"));
370 button_table.attach (speed_frame, 0, 2, 5, 6);
371 #endif /* VARISPEED_IN_MIXER_STRIP */
373 button_table.attach (*rec_enable_button, 0, 2, 2, 3);
374 rec_enable_button->show();
377 if (_route->phase_invert()) {
378 name_label.set_text (X_("Ø ") + name_label.get_text());
380 name_label.set_text (_route->name());
383 switch (_route->meter_point()) {
385 meter_point_label.set_text (_("input"));
389 meter_point_label.set_text (_("pre"));
393 meter_point_label.set_text (_("post"));
397 delete route_ops_menu;
400 ARDOUR_UI::instance()->tooltips().set_tip (comment_button, _route->comment().empty() ?
401 _("Click to Add/Edit Comments"):
404 connections.push_back (_route->meter_change.connect (mem_fun(*this, &MixerStrip::meter_changed)));
405 connections.push_back (_route->input_changed.connect (mem_fun(*this, &MixerStrip::input_changed)));
406 connections.push_back (_route->output_changed.connect (mem_fun(*this, &MixerStrip::output_changed)));
407 connections.push_back (_route->mute_changed.connect (mem_fun(*this, &RouteUI::mute_changed)));
408 connections.push_back (_route->solo_changed.connect (mem_fun(*this, &RouteUI::solo_changed)));
409 connections.push_back (_route->solo_safe_changed.connect (mem_fun(*this, &RouteUI::solo_changed)));
410 connections.push_back (_route->mix_group_changed.connect (mem_fun(*this, &MixerStrip::mix_group_changed)));
411 connections.push_back (_route->panner().Changed.connect (mem_fun(*this, &MixerStrip::connect_to_pan)));
413 if (is_audio_track()) {
414 connections.push_back (audio_track()->DiskstreamChanged.connect (mem_fun(*this, &MixerStrip::diskstream_changed)));
415 connections.push_back (get_diskstream()->SpeedChanged.connect (mem_fun(*this, &MixerStrip::speed_changed)));
418 connections.push_back (_route->NameChanged.connect (mem_fun(*this, &RouteUI::name_changed)));
419 connections.push_back (_route->comment_changed.connect (mem_fun(*this, &MixerStrip::comment_changed)));
420 connections.push_back (_route->gui_changed.connect (mem_fun(*this, &MixerStrip::route_gui_changed)));
422 set_stuff_from_route ();
424 /* now force an update of all the various elements */
426 pre_processor_box.update();
427 post_processor_box.update();
432 mix_group_changed (0);
436 panners.setup_pan ();
438 if (is_audio_track()) {
442 update_diskstream_display ();
443 update_input_display ();
444 update_output_display ();
446 add_events (Gdk::BUTTON_RELEASE_MASK);
448 pre_processor_box.show();
450 if (!route()->is_master() && !route()->is_control()) {
451 /* we don't allow master or control routes to be hidden */
456 width_hide_box.show();
459 global_vpacker.show();
461 middle_button_table.show();
462 bottom_button_table.show();
463 pre_processor_box.show_all ();
466 gain_meter_alignment.show ();
467 post_processor_box.show_all ();
468 gain_unit_button.show();
469 gain_unit_label.show();
470 meter_point_button.show();
471 meter_point_label.show();
472 diskstream_button.show();
473 diskstream_label.show();
476 output_button.show();
480 comment_button.show();
483 speed_spinner.show();
491 MixerStrip::set_stuff_from_route ()
497 /* if width is not set, it will be set by the MixerUI or editor */
499 if ((prop = xml_node->property ("strip-width")) != 0) {
500 set_width (Width (string_2_enum (prop->value(), _width)), this);
503 if ((prop = xml_node->property ("shown-mixer")) != 0) {
504 if (prop->value() == "no") {
505 _marked_for_display = false;
507 _marked_for_display = true;
510 /* backwards compatibility */
511 _marked_for_display = true;
516 MixerStrip::set_width (Width w, void* owner)
518 /* always set the gpm width again, things may be hidden */
521 panners.set_width (w);
522 pre_processor_box.set_width (w);
523 post_processor_box.set_width (w);
525 boost::shared_ptr<AutomationList> gain_automation = _route->gain_control()->alist();
527 _width_owner = owner;
533 if (_width_owner == this) {
534 xml_node->add_property ("strip-width", enum_2_string (_width));
540 if (rec_enable_button) {
541 ((Gtk::Label*)rec_enable_button->get_child())->set_text (_("Record"));
543 ((Gtk::Label*)mute_button->get_child())->set_text (_("Mute"));
544 ((Gtk::Label*)solo_button->get_child())->set_text (_("Solo"));
546 if (_route->comment() == "") {
547 comment_button.unset_bg (STATE_NORMAL);
548 ((Gtk::Label*)comment_button.get_child())->set_text (_("Comments"));
550 comment_button.modify_bg (STATE_NORMAL, color());
551 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Comments*"));
554 ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (gpm.astyle_string(gain_automation->automation_style()));
555 ((Gtk::Label*)gpm.gain_automation_state_button.get_child())->set_text (gpm.astate_string(gain_automation->automation_state()));
556 ((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text (panners.astyle_string(_route->panner().automation_style()));
557 ((Gtk::Label*)panners.pan_automation_state_button.get_child())->set_text (panners.astate_string(_route->panner().automation_state()));
558 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "long", 2, 2);
559 set_size_request (-1, -1);
563 if (rec_enable_button) {
564 ((Gtk::Label*)rec_enable_button->get_child())->set_text (_("Rec"));
566 ((Gtk::Label*)mute_button->get_child())->set_text (_("M"));
567 ((Gtk::Label*)solo_button->get_child())->set_text (_("S"));
569 if (_route->comment() == "") {
570 comment_button.unset_bg (STATE_NORMAL);
571 ((Gtk::Label*)comment_button.get_child())->set_text (_("Cmt"));
573 comment_button.modify_bg (STATE_NORMAL, color());
574 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Cmt*"));
577 ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (gpm.short_astyle_string(gain_automation->automation_style()));
578 ((Gtk::Label*)gpm.gain_automation_state_button.get_child())->set_text (gpm.short_astate_string(gain_automation->automation_state()));
579 ((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text (panners.short_astyle_string(_route->panner().automation_style()));
580 ((Gtk::Label*)panners.pan_automation_state_button.get_child())->set_text (panners.short_astate_string(_route->panner().automation_state()));
581 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2);
582 set_size_request (max (50, gpm.get_gm_width()), -1);
585 update_input_display ();
586 update_output_display ();
587 mix_group_changed (0);
595 MixerStrip::set_packed (bool yn)
602 xml_node->add_property ("shown-mixer", "yes");
604 xml_node->add_property ("shown-mixer", "no");
610 MixerStrip::output_press (GdkEventButton *ev)
612 using namespace Menu_Helpers;
613 if (!_session.engine().connected()) {
614 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
619 MenuList& citems = output_menu.items();
620 switch (ev->button) {
623 edit_output_configuration ();
628 output_menu.set_name ("ArdourContextMenu");
631 citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_output)));
632 citems.push_back (SeparatorElem());
634 ARDOUR::BundleList current = _route->bundles_connected_to_outputs ();
636 boost::shared_ptr<ARDOUR::BundleList> b = _session.bundles ();
637 for (ARDOUR::BundleList::iterator i = b->begin(); i != b->end(); ++i) {
638 add_bundle_to_output_menu (*i, current);
641 output_menu.popup (1, ev->time);
652 MixerStrip::edit_output_configuration ()
654 if (output_selector == 0) {
655 output_selector = new IOSelectorWindow (_session, _route, false);
658 if (output_selector->is_visible()) {
659 output_selector->get_toplevel()->get_window()->raise();
661 output_selector->present ();
666 MixerStrip::edit_input_configuration ()
668 if (input_selector == 0) {
669 input_selector = new IOSelectorWindow (_session, _route, true);
672 if (input_selector->is_visible()) {
673 input_selector->get_toplevel()->get_window()->raise();
675 input_selector->present ();
680 MixerStrip::input_press (GdkEventButton *ev)
682 using namespace Menu_Helpers;
684 MenuList& citems = input_menu.items();
685 input_menu.set_name ("ArdourContextMenu");
688 if (!_session.engine().connected()) {
689 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
694 switch (ev->button) {
697 edit_input_configuration ();
702 citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_input)));
703 citems.push_back (SeparatorElem());
705 ARDOUR::BundleList current = _route->bundles_connected_to_inputs ();
707 boost::shared_ptr<ARDOUR::BundleList> b = _session.bundles ();
708 for (ARDOUR::BundleList::iterator i = b->begin(); i != b->end(); ++i) {
709 add_bundle_to_input_menu (*i, current);
712 input_menu.popup (1, ev->time);
722 MixerStrip::bundle_input_chosen (boost::shared_ptr<ARDOUR::Bundle> c)
724 if (!ignore_toggle) {
727 _route->connect_input_ports_to_bundle (c, this);
730 catch (AudioEngine::PortRegistrationFailure& err) {
731 error << _("could not register new ports required for that bundle")
738 MixerStrip::bundle_output_chosen (boost::shared_ptr<ARDOUR::Bundle> c)
740 if (!ignore_toggle) {
743 _route->connect_output_ports_to_bundle (c, this);
746 catch (AudioEngine::PortRegistrationFailure& err) {
747 error << _("could not register new ports required for that bundle")
754 MixerStrip::add_bundle_to_input_menu (boost::shared_ptr<Bundle> b, ARDOUR::BundleList const & current)
756 using namespace Menu_Helpers;
758 /* the input menu needs to contain only output bundles (that we
759 can connect inputs to */
760 if (b->ports_are_outputs() == false) {
764 MenuList& citems = input_menu.items();
766 if (b->nchannels() == _route->n_inputs().get (b->type ())) {
768 citems.push_back (CheckMenuElem (b->name(), bind (mem_fun(*this, &MixerStrip::bundle_input_chosen), b)));
770 if (std::find (current.begin(), current.end(), b) != current.end()) {
771 ignore_toggle = true;
772 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
773 ignore_toggle = false;
779 MixerStrip::add_bundle_to_output_menu (boost::shared_ptr<Bundle> b, ARDOUR::BundleList const & current)
781 using namespace Menu_Helpers;
783 /* the output menu needs to contain only input bundles (that we
784 can connect outputs to */
785 if (b->ports_are_inputs() == false) {
789 if (b->nchannels() == _route->n_outputs().get (b->type ())) {
791 MenuList& citems = output_menu.items();
792 citems.push_back (CheckMenuElem (b->name(), bind (mem_fun(*this, &MixerStrip::bundle_output_chosen), b)));
794 if (std::find (current.begin(), current.end(), b) != current.end()) {
795 ignore_toggle = true;
796 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
797 ignore_toggle = false;
803 MixerStrip::update_diskstream_display ()
807 if (input_selector) {
808 input_selector->hide_all ();
815 show_passthru_color ();
820 MixerStrip::connect_to_pan ()
822 ENSURE_GUI_THREAD(mem_fun(*this, &MixerStrip::connect_to_pan));
824 panstate_connection.disconnect ();
825 panstyle_connection.disconnect ();
827 boost::shared_ptr<ARDOUR::AutomationControl> pan_control
828 = boost::dynamic_pointer_cast<ARDOUR::AutomationControl>(
829 _route->panner().data().control(Evoral::Parameter( PanAutomation ) ));
832 panstate_connection = pan_control->alist()->automation_state_changed.connect (mem_fun(panners, &PannerUI::pan_automation_state_changed));
833 panstyle_connection = pan_control->alist()->automation_style_changed.connect (mem_fun(panners, &PannerUI::pan_automation_style_changed));
836 panners.pan_changed (this);
840 MixerStrip::update_input_display ()
842 ARDOUR::BundleList c = _route->bundles_connected_to_inputs ();
844 /* XXX: how do we represent >1 connected bundle? */
845 if (c.empty() == false) {
846 input_label.set_text (c[0]->name());
850 input_label.set_text (_(" Input"));
853 input_label.set_text (_("I"));
857 panners.setup_pan ();
861 MixerStrip::update_output_display ()
863 ARDOUR::BundleList c = _route->bundles_connected_to_outputs ();
865 /* XXX: how do we represent >1 connected bundle? */
866 if (c.empty() == false) {
867 output_label.set_text (c[0]->name());
871 output_label.set_text (_("Output"));
874 output_label.set_text (_("O"));
880 panners.setup_pan ();
884 MixerStrip::fast_update ()
886 gpm.update_meters ();
890 MixerStrip::diskstream_changed ()
892 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_diskstream_display));
896 MixerStrip::input_changed (IOChange change, void *src)
898 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_input_display));
899 set_width(_width, this);
903 MixerStrip::output_changed (IOChange change, void *src)
905 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_output_display));
906 set_width(_width, this);
911 MixerStrip::comment_editor_done_editing()
913 string str = comment_area->get_buffer()->get_text();
914 if (_route->comment() != str) {
915 _route->set_comment (str, this);
921 comment_button.modify_bg (STATE_NORMAL, color());
922 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Comments*"));
924 comment_button.unset_bg (STATE_NORMAL);
925 ((Gtk::Label*)comment_button.get_child())->set_text (_("Comments"));
931 comment_button.modify_bg (STATE_NORMAL, color());
932 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Cmt*"));
934 comment_button.unset_bg (STATE_NORMAL);
935 ((Gtk::Label*)comment_button.get_child())->set_text (_("Cmt"));
940 ARDOUR_UI::instance()->tooltips().set_tip (comment_button,
941 str.empty() ? _("Click to Add/Edit Comments") : str);
947 MixerStrip::comment_button_clicked ()
949 if (comment_window == 0) {
950 setup_comment_editor ();
953 int x, y, cw_width, cw_height;
955 if (comment_window->is_visible()) {
956 comment_window->hide ();
960 comment_window->get_size (cw_width, cw_height);
961 comment_window->get_position(x, y);
962 comment_window->move(x, y - (cw_height / 2) - 45);
964 half the dialog height minus the comments button height
965 with some window decoration fudge thrown in.
968 comment_window->show();
969 comment_window->present();
973 MixerStrip::setup_comment_editor ()
976 title = _route->name();
977 title += _(": comment editor");
979 comment_window = new ArdourDialog (title, false);
980 comment_window->set_position (Gtk::WIN_POS_MOUSE);
981 comment_window->set_skip_taskbar_hint (true);
982 comment_window->signal_hide().connect (mem_fun(*this, &MixerStrip::comment_editor_done_editing));
984 comment_area = manage (new TextView());
985 comment_area->set_name ("MixerTrackCommentArea");
986 comment_area->set_size_request (110, 178);
987 comment_area->set_wrap_mode (WRAP_WORD);
988 comment_area->set_editable (true);
989 comment_area->get_buffer()->set_text (_route->comment());
990 comment_area->show ();
992 comment_window->get_vbox()->pack_start (*comment_area);
993 comment_window->get_action_area()->hide();
997 MixerStrip::comment_changed (void *src)
999 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::comment_changed), src));
1002 ignore_comment_edit = true;
1004 comment_area->get_buffer()->set_text (_route->comment());
1006 ignore_comment_edit = false;
1011 MixerStrip::set_mix_group (RouteGroup *rg)
1013 _route->set_mix_group (rg, this);
1017 MixerStrip::add_mix_group_to_menu (RouteGroup *rg, RadioMenuItem::Group* group)
1019 using namespace Menu_Helpers;
1021 MenuList& items = group_menu->items();
1023 items.push_back (RadioMenuElem (*group, rg->name(), bind (mem_fun(*this, &MixerStrip::set_mix_group), rg)));
1025 if (_route->mix_group() == rg) {
1026 static_cast<RadioMenuItem*>(&items.back())->set_active ();
1031 MixerStrip::select_mix_group (GdkEventButton *ev)
1033 using namespace Menu_Helpers;
1035 if (group_menu == 0) {
1036 group_menu = new Menu;
1038 group_menu->set_name ("ArdourContextMenu");
1039 MenuList& items = group_menu->items();
1040 RadioMenuItem::Group group;
1042 switch (ev->button) {
1046 items.push_back (RadioMenuElem (group, _("No group"), bind (mem_fun(*this, &MixerStrip::set_mix_group), (RouteGroup *) 0)));
1048 _session.foreach_mix_group (bind (mem_fun (*this, &MixerStrip::add_mix_group_to_menu), &group));
1050 group_menu->popup (1, ev->time);
1061 MixerStrip::mix_group_changed (void *ignored)
1063 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::mix_group_changed), ignored));
1065 RouteGroup *rg = _route->mix_group();
1068 group_label.set_text (rg->name());
1072 group_label.set_text (_("Grp"));
1075 group_label.set_text (_("~G"));
1083 MixerStrip::route_gui_changed (string what_changed, void* ignored)
1085 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::route_gui_changed), what_changed, ignored));
1087 if (what_changed == "color") {
1088 if (set_color_from_route () == 0) {
1089 show_route_color ();
1095 MixerStrip::show_route_color ()
1097 name_button.modify_bg (STATE_NORMAL, color());
1098 top_event_box.modify_bg (STATE_NORMAL, color());
1099 route_active_changed ();
1103 MixerStrip::show_passthru_color ()
1105 route_active_changed ();
1109 MixerStrip::build_route_ops_menu ()
1111 using namespace Menu_Helpers;
1112 route_ops_menu = new Menu;
1113 route_ops_menu->set_name ("ArdourContextMenu");
1115 MenuList& items = route_ops_menu->items();
1117 items.push_back (MenuElem (_("Rename"), mem_fun(*this, &RouteUI::route_rename)));
1118 items.push_back (SeparatorElem());
1119 items.push_back (CheckMenuElem (_("Active"), mem_fun (*this, &RouteUI::toggle_route_active)));
1120 route_active_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
1121 route_active_menu_item->set_active (_route->active());
1123 items.push_back (SeparatorElem());
1125 items.push_back (MenuElem (_("Adjust latency"), mem_fun (*this, &RouteUI::adjust_latency)));
1127 items.push_back (SeparatorElem());
1128 items.push_back (CheckMenuElem (_("Invert Polarity"), mem_fun (*this, &RouteUI::toggle_polarity)));
1129 polarity_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
1130 polarity_menu_item->set_active (_route->phase_invert());
1131 items.push_back (CheckMenuElem (_("Protect against denormals"), mem_fun (*this, &RouteUI::toggle_denormal_protection)));
1132 denormal_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
1133 denormal_menu_item->set_active (_route->denormal_protection());
1135 if (!Profile->get_sae()) {
1136 build_remote_control_menu ();
1137 items.push_back (SeparatorElem());
1138 items.push_back (MenuElem (_("Remote Control ID"), *remote_control_menu));
1141 items.push_back (SeparatorElem());
1142 items.push_back (MenuElem (_("Remove"), mem_fun(*this, &RouteUI::remove_this_route)));
1146 MixerStrip::name_button_button_press (GdkEventButton* ev)
1148 if (ev->button == 1 || ev->button == 3) {
1149 list_route_operations ();
1151 Menu_Helpers::MenuList& items = route_ops_menu->items();
1152 /* do not allow rename if the track is record-enabled */
1153 static_cast<MenuItem*> (&items.front())->set_sensitive (!_route->record_enabled());
1155 route_ops_menu->popup (1, ev->time);
1161 MixerStrip::list_route_operations ()
1163 if (route_ops_menu == 0) {
1164 build_route_ops_menu ();
1167 refresh_remote_control_menu();
1172 MixerStrip::speed_adjustment_changed ()
1174 /* since there is a usable speed adjustment, there has to be a diskstream */
1175 if (!ignore_speed_adjustment) {
1176 get_diskstream()->set_speed (speed_adjustment.get_value());
1181 MixerStrip::speed_changed ()
1183 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_speed_display));
1187 MixerStrip::update_speed_display ()
1191 val = get_diskstream()->speed();
1194 speed_spinner.set_name ("MixerStripSpeedBaseNotOne");
1196 speed_spinner.set_name ("MixerStripSpeedBase");
1199 if (speed_adjustment.get_value() != val) {
1200 ignore_speed_adjustment = true;
1201 speed_adjustment.set_value (val);
1202 ignore_speed_adjustment = false;
1208 MixerStrip::set_selected (bool yn)
1210 AxisView::set_selected (yn);
1212 global_frame.set_shadow_type (Gtk::SHADOW_ETCHED_OUT);
1213 global_frame.set_name ("MixerStripSelectedFrame");
1215 global_frame.set_shadow_type (Gtk::SHADOW_IN);
1216 global_frame.set_name ("MixerStripFrame");
1218 global_frame.queue_draw ();
1222 MixerStrip::name_changed ()
1226 RouteUI::name_changed ();
1229 name_label.set_text (PBD::short_version (_route->name(), 5));
1232 if (_route->phase_invert()) {
1233 name_label.set_text (X_("Ø ") + name_label.get_text());
1238 MixerStrip::width_clicked ()
1242 set_width (Narrow, this);
1245 set_width (Wide, this);
1251 MixerStrip::hide_clicked ()
1253 // LAME fix to reset the button status for when it is redisplayed (part 1)
1254 hide_button.set_sensitive(false);
1257 Hiding(); /* EMIT_SIGNAL */
1259 _mixer.hide_strip (this);
1263 hide_button.set_sensitive(true);
1267 MixerStrip::set_embedded (bool yn)
1273 MixerStrip::map_frozen ()
1275 ENSURE_GUI_THREAD (mem_fun(*this, &MixerStrip::map_frozen));
1277 boost::shared_ptr<AudioTrack> at = audio_track();
1280 switch (at->freeze_state()) {
1281 case AudioTrack::Frozen:
1282 pre_processor_box.set_sensitive (false);
1283 post_processor_box.set_sensitive (false);
1284 speed_spinner.set_sensitive (false);
1287 pre_processor_box.set_sensitive (true);
1288 post_processor_box.set_sensitive (true);
1289 speed_spinner.set_sensitive (true);
1290 // XXX need some way, maybe, to retoggle redirect editors
1295 hide_redirect_editors ();
1299 MixerStrip::hide_redirect_editors ()
1301 _route->foreach_processor (mem_fun (*this, &MixerStrip::hide_processor_editor));
1305 MixerStrip::hide_processor_editor (boost::weak_ptr<Processor> p)
1307 boost::shared_ptr<Processor> processor (p.lock ());
1312 void* gui = processor->get_gui ();
1315 static_cast<Gtk::Widget*>(gui)->hide ();
1320 MixerStrip::route_active_changed ()
1322 RouteUI::route_active_changed ();
1324 if (is_midi_track()) {
1325 if (_route->active()) {
1326 set_name ("MidiTrackStripBase");
1327 gpm.set_meter_strip_name ("MidiTrackStripBase");
1329 set_name ("MidiTrackStripBaseInactive");
1330 gpm.set_meter_strip_name ("MidiTrackStripBaseInactive");
1332 gpm.set_fader_name ("MidiTrackFader");
1333 } else if (is_audio_track()) {
1334 if (_route->active()) {
1335 set_name ("AudioTrackStripBase");
1336 gpm.set_meter_strip_name ("AudioTrackMetrics");
1338 set_name ("AudioTrackStripBaseInactive");
1339 gpm.set_meter_strip_name ("AudioTrackMetricsInactive");
1341 gpm.set_fader_name ("AudioTrackFader");
1343 if (_route->active()) {
1344 set_name ("AudioBusStripBase");
1345 gpm.set_meter_strip_name ("AudioBusMetrics");
1347 set_name ("AudioBusStripBaseInactive");
1348 gpm.set_meter_strip_name ("AudioBusMetricsInactive");
1350 gpm.set_fader_name ("AudioBusFader");
1352 /* (no MIDI busses yet) */
1357 MixerStrip::mix_group() const
1359 return _route->mix_group();
1363 MixerStrip::engine_stopped ()
1368 MixerStrip::engine_running ()
1373 MixerStrip::meter_changed (void *src)
1376 ENSURE_GUI_THREAD (bind (mem_fun(*this, &MixerStrip::meter_changed), src));
1378 switch (_route->meter_point()) {
1380 meter_point_label.set_text (_("input"));
1384 meter_point_label.set_text (_("pre"));
1387 case MeterPostFader:
1388 meter_point_label.set_text (_("post"));
1392 gpm.setup_meters ();
1393 // reset peak when meter point changes
1394 gpm.reset_peak_display();
1395 set_width(_width, this);