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, boost::shared_ptr<Route> rt, bool in_mixer)
88 RouteUI (rt, sess, _("Mute"), _("Solo"), _("Record")),
90 _mixer_owned (in_mixer),
91 pre_redirect_box (PreFader, sess, rt, mx.plugin_selector(), mx.selection(), in_mixer),
92 post_redirect_box (PostFader, sess, rt, mx.plugin_selector(), mx.selection(), in_mixer),
94 panners (_route, sess),
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)
104 if (set_color_from_route()) {
105 set_color (unique_random_color());
111 _marked_for_display = false;
113 ignore_comment_edit = false;
114 ignore_toggle = false;
115 ignore_speed_adjustment = false;
120 width_button.add (*(manage (new Gtk::Image (::get_icon("strip_width")))));
121 hide_button.add (*(manage (new Gtk::Image (::get_icon("hide")))));
123 input_label.set_text (_("Input"));
124 input_button.add (input_label);
125 input_button.set_name ("MixerIOButton");
126 input_label.set_name ("MixerIOButtonLabel");
128 output_label.set_text (_("Output"));
129 output_button.add (output_label);
130 output_button.set_name ("MixerIOButton");
131 output_label.set_name ("MixerIOButtonLabel");
133 _route->meter_change.connect (mem_fun(*this, &MixerStrip::meter_changed));
134 meter_point_button.add (meter_point_label);
135 meter_point_button.set_name ("MixerStripMeterPreButton");
136 meter_point_label.set_name ("MixerStripMeterPreButton");
138 switch (_route->meter_point()) {
140 meter_point_label.set_text (_("input"));
144 meter_point_label.set_text (_("pre"));
148 meter_point_label.set_text (_("post"));
152 /* TRANSLATORS: this string should be longest of the strings
153 used to describe meter points. In english, it's "input".
155 set_size_request_to_display_given_text (meter_point_button, _("tupni"), 5, 5);
157 bottom_button_table.attach (meter_point_button, 1, 2, 0, 1);
159 meter_point_button.signal_button_press_event().connect (mem_fun (gpm, &GainMeter::meter_press), false);
160 /* XXX what is this meant to do? */
161 //meter_point_button.signal_button_release_event().connect (mem_fun (gpm, &GainMeter::meter_release), false);
163 hide_button.set_events (hide_button.get_events() & ~(Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK));
165 mute_button->set_name ("MixerMuteButton");
166 solo_button->set_name ("MixerSoloButton");
168 button_table.set_homogeneous (true);
169 button_table.set_spacings (0);
171 button_table.attach (name_button, 0, 2, 0, 1);
172 button_table.attach (input_button, 0, 2, 1, 2);
174 middle_button_table.set_homogeneous (true);
175 middle_button_table.set_spacings (0);
176 middle_button_table.attach (*mute_button, 0, 1, 0, 1);
177 middle_button_table.attach (*solo_button, 1, 2, 0, 1);
179 bottom_button_table.set_col_spacings (0);
180 bottom_button_table.set_homogeneous (true);
181 bottom_button_table.attach (group_button, 0, 1, 0, 1);
183 if (is_audio_track()) {
185 rec_enable_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::rec_enable_press), false);
186 rec_enable_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::rec_enable_release));
188 rec_enable_button->set_name ("MixerRecordEnableButton");
190 boost::shared_ptr<AudioTrack> at = audio_track();
192 at->FreezeChange.connect (mem_fun(*this, &MixerStrip::map_frozen));
194 #ifdef VARISPEED_IN_MIXER_STRIP
195 speed_adjustment.signal_value_changed().connect (mem_fun(*this, &MixerStrip::speed_adjustment_changed));
197 speed_frame.set_name ("BaseFrame");
198 speed_frame.set_shadow_type (Gtk::SHADOW_IN);
199 speed_frame.add (speed_spinner);
201 speed_spinner.set_print_func (speed_printer, 0);
203 ARDOUR_UI::instance()->tooltips().set_tip (speed_spinner, _("Varispeed"));
205 button_table.attach (speed_frame, 0, 2, 5, 6);
206 #endif /* VARISPEED_IN_MIXER_STRIP */
208 button_table.attach (*rec_enable_button, 0, 2, 2, 3);
211 name_button.add (name_label);
212 name_button.set_name ("MixerNameButton");
213 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2);
215 name_label.set_name ("MixerNameButtonLabel");
216 if (_route->phase_invert()) {
217 name_label.set_text (X_("Ø ") + name_label.get_text());
219 name_label.set_text (_route->name());
222 group_button.add (group_label);
223 group_button.set_name ("MixerGroupButton");
224 group_label.set_name ("MixerGroupButtonLabel");
226 comment_button.set_name ("MixerCommentButton");
228 ARDOUR_UI::instance()->tooltips().set_tip (comment_button, _route->comment()=="" ?
229 _("Click to Add/Edit Comments"):
232 comment_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::comment_button_clicked));
234 global_vpacker.set_border_width (0);
235 global_vpacker.set_spacing (0);
237 VBox *whvbox = manage (new VBox);
239 width_button.set_name ("MixerWidthButton");
240 hide_button.set_name ("MixerHideButton");
241 top_event_box.set_name ("MixerTopEventBox");
243 width_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::width_clicked));
244 hide_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::hide_clicked));
246 width_hide_box.pack_start (width_button, false, true);
247 width_hide_box.pack_start (top_event_box, true, true);
248 width_hide_box.pack_end (hide_button, false, true);
249 Gtk::Alignment *gain_meter_alignment = Gtk::manage(new Gtk::Alignment());
250 gain_meter_alignment->set_padding(0, 4, 0, 0);
251 gain_meter_alignment->add(gpm);
253 whvbox->pack_start (width_hide_box, true, true);
255 global_vpacker.pack_start (*whvbox, Gtk::PACK_SHRINK);
256 global_vpacker.pack_start (button_table,Gtk::PACK_SHRINK);
257 global_vpacker.pack_start (pre_redirect_box, true, true);
258 global_vpacker.pack_start (middle_button_table,Gtk::PACK_SHRINK);
259 global_vpacker.pack_start (*gain_meter_alignment,Gtk::PACK_SHRINK);
260 global_vpacker.pack_start (bottom_button_table,Gtk::PACK_SHRINK);
261 global_vpacker.pack_start (post_redirect_box, true, true);
262 global_vpacker.pack_start (panners, Gtk::PACK_SHRINK);
263 global_vpacker.pack_start (output_button, Gtk::PACK_SHRINK);
264 global_vpacker.pack_start (comment_button, Gtk::PACK_SHRINK);
266 if (route()->master() || route()->control()) {
268 if (scrollbar_height == 0) {
269 HScrollbar scrollbar;
270 Gtk::Requisition requisition(scrollbar.size_request ());
271 scrollbar_height = requisition.height;
274 EventBox* spacer = manage (new EventBox);
275 spacer->set_size_request (-1, scrollbar_height);
276 global_vpacker.pack_start (*spacer, false, false);
279 global_frame.add (global_vpacker);
280 global_frame.set_shadow_type (Gtk::SHADOW_IN);
281 global_frame.set_name ("BaseFrame");
285 /* force setting of visible selected status */
288 set_selected (false);
293 _session.engine().Stopped.connect (mem_fun(*this, &MixerStrip::engine_stopped));
294 _session.engine().Running.connect (mem_fun(*this, &MixerStrip::engine_running));
295 _route->input_changed.connect (mem_fun(*this, &MixerStrip::input_changed));
296 _route->output_changed.connect (mem_fun(*this, &MixerStrip::output_changed));
297 _route->mute_changed.connect (mem_fun(*this, &RouteUI::mute_changed));
298 _route->solo_changed.connect (mem_fun(*this, &RouteUI::solo_changed));
299 _route->solo_safe_changed.connect (mem_fun(*this, &RouteUI::solo_changed));
300 _route->mix_group_changed.connect (mem_fun(*this, &MixerStrip::mix_group_changed));
301 _route->panner().Changed.connect (mem_fun(*this, &MixerStrip::connect_to_pan));
303 if (is_audio_track()) {
304 audio_track()->DiskstreamChanged.connect (mem_fun(*this, &MixerStrip::diskstream_changed));
305 get_diskstream()->SpeedChanged.connect (mem_fun(*this, &MixerStrip::speed_changed));
308 _route->name_changed.connect (mem_fun(*this, &RouteUI::name_changed));
309 _route->comment_changed.connect (mem_fun(*this, &MixerStrip::comment_changed));
310 _route->gui_changed.connect (mem_fun(*this, &MixerStrip::route_gui_changed));
312 input_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::input_press), false);
313 output_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::output_press), false);
315 solo_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::solo_press), false);
316 solo_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::solo_release), false);
317 mute_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::mute_press), false);
318 mute_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::mute_release), false);
320 name_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::name_button_button_press), false);
321 group_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::select_mix_group), false);
324 set_stuff_from_route ();
326 /* start off as a passthru strip. we'll correct this, if necessary,
327 in update_diskstream_display().
330 set_name ("AudioTrackStripBase");
332 /* now force an update of all the various elements */
334 pre_redirect_box.update();
335 post_redirect_box.update();
340 mix_group_changed (0);
344 panners.setup_pan ();
346 if (is_audio_track()) {
350 update_diskstream_display ();
351 update_input_display ();
352 update_output_display ();
354 add_events (Gdk::BUTTON_RELEASE_MASK);
357 MixerStrip::~MixerStrip ()
359 GoingAway(); /* EMIT_SIGNAL */
361 if (input_selector) {
362 delete input_selector;
365 if (output_selector) {
366 delete output_selector;
371 MixerStrip::set_stuff_from_route ()
377 /* if width is not set, it will be set by the MixerUI or editor */
379 if ((prop = xml_node->property ("strip_width")) != 0) {
380 set_width (Width (string_2_enum (prop->value(), _width)), this);
383 if ((prop = xml_node->property ("shown_mixer")) != 0) {
384 if (prop->value() == "no") {
385 _marked_for_display = false;
387 _marked_for_display = true;
390 /* backwards compatibility */
391 _marked_for_display = true;
396 MixerStrip::set_width (Width w, void* owner)
398 /* always set the gpm width again, things may be hidden */
401 panners.set_width (w);
402 pre_redirect_box.set_width (w);
403 post_redirect_box.set_width (w);
405 _width_owner = owner;
411 if (_width_owner == this) {
412 xml_node->add_property ("strip_width", enum_2_string (_width));
417 set_size_request (-1, -1);
419 if (rec_enable_button) {
420 ((Gtk::Label*)rec_enable_button->get_child())->set_text (_("record"));
422 ((Gtk::Label*)mute_button->get_child())->set_text (_("Mute"));
423 ((Gtk::Label*)solo_button->get_child())->set_text (_("Solo"));
425 if (_route->comment() == "") {
426 comment_button.unset_bg (STATE_NORMAL);
427 ((Gtk::Label*)comment_button.get_child())->set_text (_("comments"));
429 comment_button.modify_bg (STATE_NORMAL, color());
430 ((Gtk::Label*)comment_button.get_child())->set_text (_("*comments*"));
433 ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (gpm.astyle_string(_route->gain_automation_curve().automation_style()));
434 ((Gtk::Label*)gpm.gain_automation_state_button.get_child())->set_text (gpm.astate_string(_route->gain_automation_curve().automation_state()));
435 ((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text (panners.astyle_string(_route->panner().automation_style()));
436 ((Gtk::Label*)panners.pan_automation_state_button.get_child())->set_text (panners.astate_string(_route->panner().automation_state()));
437 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "long", 2, 2);
441 if (rec_enable_button) {
442 ((Gtk::Label*)rec_enable_button->get_child())->set_text (_("Rec"));
444 ((Gtk::Label*)mute_button->get_child())->set_text (_("M"));
445 ((Gtk::Label*)solo_button->get_child())->set_text (_("S"));
447 if (_route->comment() == "") {
448 comment_button.unset_bg (STATE_NORMAL);
449 ((Gtk::Label*)comment_button.get_child())->set_text (_("Cmt"));
451 comment_button.modify_bg (STATE_NORMAL, color());
452 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Cmt*"));
455 ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (gpm.short_astyle_string(_route->gain_automation_curve().automation_style()));
456 ((Gtk::Label*)gpm.gain_automation_state_button.get_child())->set_text (gpm.short_astate_string(_route->gain_automation_curve().automation_state()));
457 ((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text (panners.short_astyle_string(_route->panner().automation_style()));
458 ((Gtk::Label*)panners.pan_automation_state_button.get_child())->set_text (panners.short_astate_string(_route->panner().automation_state()));
459 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2);
460 set_size_request (max (50, gpm.get_gm_width()), -1);
464 update_input_display ();
465 update_output_display ();
466 mix_group_changed (0);
472 MixerStrip::set_packed (bool yn)
479 xml_node->add_property ("shown_mixer", "yes");
481 xml_node->add_property ("shown_mixer", "no");
487 MixerStrip::output_press (GdkEventButton *ev)
489 using namespace Menu_Helpers;
490 if (!_session.engine().connected()) {
491 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
496 MenuList& citems = output_menu.items();
497 switch (ev->button) {
500 output_menu.set_name ("ArdourContextMenu");
503 citems.push_back (MenuElem (_("Edit"), mem_fun(*this, &MixerStrip::edit_output_configuration)));
504 citems.push_back (SeparatorElem());
505 citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_output)));
506 citems.push_back (SeparatorElem());
508 _session.foreach_connection (this, &MixerStrip::add_connection_to_output_menu);
510 output_menu.popup (1, ev->time);
520 MixerStrip::edit_output_configuration ()
522 if (output_selector == 0) {
523 output_selector = new IOSelectorWindow (_session, _route, false);
526 if (output_selector->is_visible()) {
527 output_selector->get_toplevel()->get_window()->raise();
529 output_selector->show_all ();
534 MixerStrip::edit_input_configuration ()
536 if (input_selector == 0) {
537 input_selector = new IOSelectorWindow (_session, _route, true);
540 if (input_selector->is_visible()) {
541 input_selector->get_toplevel()->get_window()->raise();
543 input_selector->show_all ();
548 MixerStrip::input_press (GdkEventButton *ev)
550 using namespace Menu_Helpers;
552 MenuList& citems = input_menu.items();
553 input_menu.set_name ("ArdourContextMenu");
556 if (!_session.engine().connected()) {
557 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
562 switch (ev->button) {
565 citems.push_back (MenuElem (_("Edit"), mem_fun(*this, &MixerStrip::edit_input_configuration)));
566 citems.push_back (SeparatorElem());
567 citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_input)));
568 citems.push_back (SeparatorElem());
570 _session.foreach_connection (this, &MixerStrip::add_connection_to_input_menu);
572 input_menu.popup (1, ev->time);
582 MixerStrip::connection_input_chosen (ARDOUR::Connection *c)
584 if (!ignore_toggle) {
587 _route->use_input_connection (*c, this);
590 catch (AudioEngine::PortRegistrationFailure& err) {
591 error << _("could not register new ports required for that connection")
598 MixerStrip::connection_output_chosen (ARDOUR::Connection *c)
600 if (!ignore_toggle) {
603 _route->use_output_connection (*c, this);
606 catch (AudioEngine::PortRegistrationFailure& err) {
607 error << _("could not register new ports required for that connection")
614 MixerStrip::add_connection_to_input_menu (ARDOUR::Connection* c)
616 using namespace Menu_Helpers;
618 if (dynamic_cast<InputConnection *> (c) == 0) {
622 MenuList& citems = input_menu.items();
624 if (c->nports() == _route->n_inputs()) {
626 citems.push_back (CheckMenuElem (c->name(), bind (mem_fun(*this, &MixerStrip::connection_input_chosen), c)));
628 ARDOUR::Connection *current = _route->input_connection();
631 ignore_toggle = true;
632 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
633 ignore_toggle = false;
639 MixerStrip::add_connection_to_output_menu (ARDOUR::Connection* c)
641 using namespace Menu_Helpers;
643 if (dynamic_cast<OutputConnection *> (c) == 0) {
647 if (c->nports() == _route->n_outputs()) {
649 MenuList& citems = output_menu.items();
650 citems.push_back (CheckMenuElem (c->name(), bind (mem_fun(*this, &MixerStrip::connection_output_chosen), c)));
652 ARDOUR::Connection *current = _route->output_connection();
655 ignore_toggle = true;
656 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
657 ignore_toggle = false;
663 MixerStrip::update_diskstream_display ()
666 update_input_display ();
668 if (is_audio_track()) {
670 if (input_selector) {
671 input_selector->hide_all ();
678 show_passthru_color ();
683 MixerStrip::connect_to_pan ()
685 ENSURE_GUI_THREAD(mem_fun(*this, &MixerStrip::connect_to_pan));
687 panstate_connection.disconnect ();
688 panstyle_connection.disconnect ();
690 if (!_route->panner().empty()) {
691 StreamPanner* sp = _route->panner().front();
693 panstate_connection = sp->automation().automation_state_changed.connect (mem_fun(panners, &PannerUI::pan_automation_state_changed));
694 panstyle_connection = sp->automation().automation_style_changed.connect (mem_fun(panners, &PannerUI::pan_automation_style_changed));
697 panners.pan_changed (this);
701 MixerStrip::update_input_display ()
703 ARDOUR::Connection *c;
705 if ((c = _route->input_connection()) != 0) {
706 input_label.set_text (c->name());
710 input_label.set_text (_(" Input"));
713 input_label.set_text (_("I"));
717 panners.setup_pan ();
721 MixerStrip::update_output_display ()
723 ARDOUR::Connection *c;
725 if ((c = _route->output_connection()) != 0) {
726 output_label.set_text (c->name());
730 output_label.set_text (_("Output"));
733 output_label.set_text (_("O"));
738 panners.setup_pan ();
742 MixerStrip::fast_update ()
744 gpm.update_meters ();
748 MixerStrip::diskstream_changed ()
750 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_diskstream_display));
754 MixerStrip::input_changed (IOChange change, void *src)
756 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_input_display));
757 set_width(_width, this);
761 MixerStrip::output_changed (IOChange change, void *src)
763 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_output_display));
764 set_width(_width, this);
769 MixerStrip::comment_editor_done_editing()
771 string str = comment_area->get_buffer()->get_text();
772 if (_route->comment() != str) {
773 _route->set_comment (str, this);
779 comment_button.modify_bg (STATE_NORMAL, color());
780 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Comments*"));
782 comment_button.unset_bg (STATE_NORMAL);
783 ((Gtk::Label*)comment_button.get_child())->set_text (_("Comments"));
789 comment_button.modify_bg (STATE_NORMAL, color());
790 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Cmt*"));
792 comment_button.unset_bg (STATE_NORMAL);
793 ((Gtk::Label*)comment_button.get_child())->set_text (_("Cmt"));
798 ARDOUR_UI::instance()->tooltips().set_tip (comment_button,
799 str.empty() ? _("Click to Add/Edit Comments") : str);
805 MixerStrip::comment_button_clicked ()
807 if (comment_window == 0) {
808 setup_comment_editor ();
811 int x, y, cw_width, cw_height;
813 if (comment_window->is_visible()) {
814 comment_window->hide ();
818 comment_window->get_size (cw_width, cw_height);
819 comment_window->get_position(x, y);
820 comment_window->move(x, y - (cw_height / 2) - 45);
822 half the dialog height minus the comments button height
823 with some window decoration fudge thrown in.
826 comment_window->show();
827 comment_window->present();
831 MixerStrip::setup_comment_editor ()
834 title = _route->name();
835 title += _(": comment editor");
837 comment_window = new ArdourDialog (title, false);
838 comment_window->set_position (Gtk::WIN_POS_MOUSE);
839 comment_window->set_skip_taskbar_hint (true);
840 comment_window->signal_hide().connect (mem_fun(*this, &MixerStrip::comment_editor_done_editing));
842 comment_area = manage (new TextView());
843 comment_area->set_name ("MixerTrackCommentArea");
844 comment_area->set_size_request (110, 178);
845 comment_area->set_wrap_mode (WRAP_WORD);
846 comment_area->set_editable (true);
847 comment_area->get_buffer()->set_text (_route->comment());
848 comment_area->show ();
850 comment_window->get_vbox()->pack_start (*comment_area);
851 comment_window->get_action_area()->hide();
855 MixerStrip::comment_changed (void *src)
857 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::comment_changed), src));
860 ignore_comment_edit = true;
862 comment_area->get_buffer()->set_text (_route->comment());
864 ignore_comment_edit = false;
869 MixerStrip::set_mix_group (RouteGroup *rg)
871 _route->set_mix_group (rg, this);
875 MixerStrip::add_mix_group_to_menu (RouteGroup *rg, RadioMenuItem::Group* group)
877 using namespace Menu_Helpers;
879 MenuList& items = group_menu->items();
881 items.push_back (RadioMenuElem (*group, rg->name(), bind (mem_fun(*this, &MixerStrip::set_mix_group), rg)));
883 if (_route->mix_group() == rg) {
884 static_cast<RadioMenuItem*>(&items.back())->set_active ();
889 MixerStrip::select_mix_group (GdkEventButton *ev)
891 using namespace Menu_Helpers;
893 if (group_menu == 0) {
894 group_menu = new Menu;
896 group_menu->set_name ("ArdourContextMenu");
897 MenuList& items = group_menu->items();
898 RadioMenuItem::Group group;
900 switch (ev->button) {
904 items.push_back (RadioMenuElem (group, _("No group"), bind (mem_fun(*this, &MixerStrip::set_mix_group), (RouteGroup *) 0)));
906 _session.foreach_mix_group (bind (mem_fun (*this, &MixerStrip::add_mix_group_to_menu), &group));
908 group_menu->popup (1, ev->time);
919 MixerStrip::mix_group_changed (void *ignored)
921 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::mix_group_changed), ignored));
923 RouteGroup *rg = _route->mix_group();
926 group_label.set_text (rg->name());
930 group_label.set_text (_("Grp"));
933 group_label.set_text (_("~G"));
941 MixerStrip::route_gui_changed (string what_changed, void* ignored)
943 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::route_gui_changed), what_changed, ignored));
945 if (what_changed == "color") {
946 if (set_color_from_route () == 0) {
953 MixerStrip::show_route_color ()
955 name_button.modify_bg (STATE_NORMAL, color());
956 top_event_box.modify_bg (STATE_NORMAL, color());
957 route_active_changed ();
961 MixerStrip::show_passthru_color ()
963 route_active_changed ();
967 MixerStrip::build_route_ops_menu ()
969 using namespace Menu_Helpers;
970 route_ops_menu = manage (new Menu);
971 route_ops_menu->set_name ("ArdourContextMenu");
973 MenuList& items = route_ops_menu->items();
975 items.push_back (MenuElem (_("Rename"), mem_fun(*this, &RouteUI::route_rename)));
976 items.push_back (SeparatorElem());
977 items.push_back (CheckMenuElem (_("Active"), mem_fun (*this, &RouteUI::toggle_route_active)));
978 route_active_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
979 route_active_menu_item->set_active (_route->active());
980 items.push_back (SeparatorElem());
981 items.push_back (CheckMenuElem (_("Invert Polarity"), mem_fun (*this, &RouteUI::toggle_polarity)));
982 polarity_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
983 polarity_menu_item->set_active (_route->phase_invert());
984 items.push_back (CheckMenuElem (_("Protect against denormals"), mem_fun (*this, &RouteUI::toggle_denormal_protection)));
985 denormal_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
986 denormal_menu_item->set_active (_route->denormal_protection());
988 build_remote_control_menu ();
990 items.push_back (SeparatorElem());
991 if (!Profile->get_sae()) {
992 items.push_back (MenuElem (_("Remote Control ID"), *remote_control_menu));
995 items.push_back (SeparatorElem());
996 items.push_back (MenuElem (_("Remove"), mem_fun(*this, &RouteUI::remove_this_route)));
1000 MixerStrip::name_button_button_press (GdkEventButton* ev)
1002 if (ev->button == 1) {
1003 list_route_operations ();
1005 Menu_Helpers::MenuList& items = route_ops_menu->items();
1006 /* do not allow rename if the track is record-enabled */
1007 static_cast<MenuItem*> (&items.front())->set_sensitive (!_route->record_enabled());
1009 route_ops_menu->popup (1, ev->time);
1015 MixerStrip::list_route_operations ()
1017 if (route_ops_menu == 0) {
1018 build_route_ops_menu ();
1021 refresh_remote_control_menu();
1026 MixerStrip::speed_adjustment_changed ()
1028 /* since there is a usable speed adjustment, there has to be a diskstream */
1029 if (!ignore_speed_adjustment) {
1030 get_diskstream()->set_speed (speed_adjustment.get_value());
1035 MixerStrip::speed_changed ()
1037 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_speed_display));
1041 MixerStrip::update_speed_display ()
1045 val = get_diskstream()->speed();
1048 speed_spinner.set_name ("MixerStripSpeedBaseNotOne");
1050 speed_spinner.set_name ("MixerStripSpeedBase");
1053 if (speed_adjustment.get_value() != val) {
1054 ignore_speed_adjustment = true;
1055 speed_adjustment.set_value (val);
1056 ignore_speed_adjustment = false;
1062 MixerStrip::set_selected (bool yn)
1064 AxisView::set_selected (yn);
1066 global_frame.set_shadow_type (Gtk::SHADOW_ETCHED_OUT);
1067 global_frame.set_name ("MixerStripSelectedFrame");
1069 global_frame.set_shadow_type (Gtk::SHADOW_IN);
1070 global_frame.set_name ("MixerStripFrame");
1072 global_frame.queue_draw ();
1076 MixerStrip::name_changed (void *src)
1080 RouteUI::name_changed (src);
1083 name_label.set_text (PBD::short_version (_route->name(), 5));
1086 if (_route->phase_invert()) {
1087 name_label.set_text (X_("Ø ") + name_label.get_text());
1092 MixerStrip::width_clicked ()
1096 set_width (Narrow, this);
1099 set_width (Wide, this);
1105 MixerStrip::hide_clicked ()
1107 // LAME fix to reset the button status for when it is redisplayed (part 1)
1108 hide_button.set_sensitive(false);
1111 Hiding(); /* EMIT_SIGNAL */
1113 _mixer.hide_strip (this);
1117 hide_button.set_sensitive(true);
1121 MixerStrip::set_embedded (bool yn)
1127 MixerStrip::map_frozen ()
1129 ENSURE_GUI_THREAD (mem_fun(*this, &MixerStrip::map_frozen));
1131 boost::shared_ptr<AudioTrack> at = audio_track();
1134 switch (at->freeze_state()) {
1135 case AudioTrack::Frozen:
1136 pre_redirect_box.set_sensitive (false);
1137 post_redirect_box.set_sensitive (false);
1138 speed_spinner.set_sensitive (false);
1141 pre_redirect_box.set_sensitive (true);
1142 post_redirect_box.set_sensitive (true);
1143 speed_spinner.set_sensitive (true);
1144 // XXX need some way, maybe, to retoggle redirect editors
1149 hide_redirect_editors ();
1153 MixerStrip::hide_redirect_editors ()
1155 _route->foreach_redirect (this, &MixerStrip::hide_redirect_editor);
1159 MixerStrip::hide_redirect_editor (boost::shared_ptr<Redirect> redirect)
1161 void* gui = redirect->get_gui ();
1164 static_cast<Gtk::Widget*>(gui)->hide ();
1169 MixerStrip::route_active_changed ()
1171 RouteUI::route_active_changed ();
1173 if (is_audio_track()) {
1174 if (_route->active()) {
1175 set_name ("AudioTrackStripBase");
1176 gpm.set_meter_strip_name ("AudioTrackMetrics");
1178 set_name ("AudioTrackStripBaseInactive");
1179 gpm.set_meter_strip_name ("AudioTrackMetricsInactive");
1181 gpm.set_fader_name ("AudioTrackFader");
1182 } else { // FIXME: assumed audio bus
1183 if (_route->active()) {
1184 set_name ("AudioBusStripBase");
1185 gpm.set_meter_strip_name ("AudioBusMetrics");
1187 set_name ("AudioBusStripBaseInactive");
1188 gpm.set_meter_strip_name ("AudioBusMetricsInactive");
1190 gpm.set_fader_name ("AudioBusFader");
1195 MixerStrip::mix_group() const
1197 return _route->mix_group();
1201 MixerStrip::engine_stopped ()
1206 MixerStrip::engine_running ()
1211 MixerStrip::meter_changed (void *src)
1214 ENSURE_GUI_THREAD (bind (mem_fun(*this, &MixerStrip::meter_changed), src));
1216 switch (_route->meter_point()) {
1218 meter_point_label.set_text (_("input"));
1222 meter_point_label.set_text (_("pre"));
1225 case MeterPostFader:
1226 meter_point_label.set_text (_("post"));
1230 gpm.setup_meters ();
1231 set_width(_width, this);