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 pre_redirect_box (PreFader, sess, rt, mx.plugin_selector(), mx.selection(), in_mixer),
91 post_redirect_box (PostFader, sess, rt, mx.plugin_selector(), mx.selection(), in_mixer),
93 panners (_route, sess),
95 middle_button_table (1, 2),
96 bottom_button_table (1, 2),
97 meter_point_label (_("pre")),
98 comment_button (_("Comments")),
99 speed_adjustment (1.0, 0.001, 4.0, 0.001, 0.1),
100 speed_spinner (&speed_adjustment, "MixerStripSpeedBase", true)
103 if (set_color_from_route()) {
104 set_color (unique_random_color());
110 _marked_for_display = false;
112 ignore_comment_edit = false;
113 ignore_toggle = false;
114 ignore_speed_adjustment = false;
119 width_button.add (*(manage (new Gtk::Image (::get_icon("strip_width")))));
120 hide_button.add (*(manage (new Gtk::Image (::get_icon("hide")))));
122 input_label.set_text (_("Input"));
123 input_button.add (input_label);
124 input_button.set_name ("MixerIOButton");
125 input_label.set_name ("MixerIOButtonLabel");
127 output_label.set_text (_("Output"));
128 output_button.add (output_label);
129 output_button.set_name ("MixerIOButton");
130 output_label.set_name ("MixerIOButtonLabel");
132 _route->meter_change.connect (mem_fun(*this, &MixerStrip::meter_changed));
133 meter_point_button.add (meter_point_label);
134 meter_point_button.set_name ("MixerStripMeterPreButton");
135 meter_point_label.set_name ("MixerStripMeterPreButton");
137 switch (_route->meter_point()) {
139 meter_point_label.set_text (_("input"));
143 meter_point_label.set_text (_("pre"));
147 meter_point_label.set_text (_("post"));
151 /* TRANSLATORS: this string should be longest of the strings
152 used to describe meter points. In english, it's "input".
154 set_size_request_to_display_given_text (meter_point_button, _("tupni"), 5, 5);
156 bottom_button_table.attach (meter_point_button, 1, 2, 0, 1);
158 meter_point_button.signal_button_press_event().connect (mem_fun (gpm, &GainMeter::meter_press), false);
159 /* XXX what is this meant to do? */
160 //meter_point_button.signal_button_release_event().connect (mem_fun (gpm, &GainMeter::meter_release), false);
162 hide_button.set_events (hide_button.get_events() & ~(Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK));
164 mute_button->set_name ("MixerMuteButton");
165 solo_button->set_name ("MixerSoloButton");
167 button_table.set_homogeneous (true);
168 button_table.set_spacings (0);
170 button_table.attach (name_button, 0, 2, 0, 1);
171 button_table.attach (input_button, 0, 2, 1, 2);
173 middle_button_table.set_homogeneous (true);
174 middle_button_table.set_spacings (0);
175 middle_button_table.attach (*mute_button, 0, 1, 0, 1);
176 middle_button_table.attach (*solo_button, 1, 2, 0, 1);
178 bottom_button_table.set_col_spacings (0);
179 bottom_button_table.set_homogeneous (true);
180 bottom_button_table.attach (group_button, 0, 1, 0, 1);
182 if (is_audio_track()) {
184 rec_enable_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::rec_enable_press), false);
185 rec_enable_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::rec_enable_release));
187 rec_enable_button->set_name ("MixerRecordEnableButton");
189 boost::shared_ptr<AudioTrack> at = audio_track();
191 at->FreezeChange.connect (mem_fun(*this, &MixerStrip::map_frozen));
193 #ifdef VARISPEED_IN_MIXER_STRIP
194 speed_adjustment.signal_value_changed().connect (mem_fun(*this, &MixerStrip::speed_adjustment_changed));
196 speed_frame.set_name ("BaseFrame");
197 speed_frame.set_shadow_type (Gtk::SHADOW_IN);
198 speed_frame.add (speed_spinner);
200 speed_spinner.set_print_func (speed_printer, 0);
202 ARDOUR_UI::instance()->tooltips().set_tip (speed_spinner, _("Varispeed"));
204 button_table.attach (speed_frame, 0, 2, 5, 6);
205 #endif /* VARISPEED_IN_MIXER_STRIP */
207 button_table.attach (*rec_enable_button, 0, 2, 2, 3);
210 name_button.add (name_label);
211 name_button.set_name ("MixerNameButton");
212 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2);
214 name_label.set_name ("MixerNameButtonLabel");
215 if (_route->phase_invert()) {
216 name_label.set_text (X_("Ø ") + name_label.get_text());
218 name_label.set_text (_route->name());
221 group_button.add (group_label);
222 group_button.set_name ("MixerGroupButton");
223 group_label.set_name ("MixerGroupButtonLabel");
225 comment_button.set_name ("MixerCommentButton");
227 ARDOUR_UI::instance()->tooltips().set_tip (comment_button, _route->comment()=="" ?
228 _("Click to Add/Edit Comments"):
231 comment_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::comment_button_clicked));
233 global_vpacker.set_border_width (0);
234 global_vpacker.set_spacing (0);
236 VBox *whvbox = manage (new VBox);
238 width_button.set_name ("MixerWidthButton");
239 hide_button.set_name ("MixerHideButton");
240 top_event_box.set_name ("MixerTopEventBox");
242 width_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::width_clicked));
243 hide_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::hide_clicked));
245 width_hide_box.pack_start (width_button, false, true);
246 width_hide_box.pack_start (top_event_box, true, true);
247 width_hide_box.pack_end (hide_button, false, true);
248 Gtk::Alignment *gain_meter_alignment = Gtk::manage(new Gtk::Alignment());
249 gain_meter_alignment->set_padding(0, 4, 0, 0);
250 gain_meter_alignment->add(gpm);
252 whvbox->pack_start (width_hide_box, true, true);
254 global_vpacker.pack_start (*whvbox, Gtk::PACK_SHRINK);
255 global_vpacker.pack_start (button_table,Gtk::PACK_SHRINK);
256 global_vpacker.pack_start (pre_redirect_box, true, true);
257 global_vpacker.pack_start (middle_button_table,Gtk::PACK_SHRINK);
258 global_vpacker.pack_start (*gain_meter_alignment,Gtk::PACK_SHRINK);
259 global_vpacker.pack_start (bottom_button_table,Gtk::PACK_SHRINK);
260 global_vpacker.pack_start (post_redirect_box, true, true);
261 global_vpacker.pack_start (panners, Gtk::PACK_SHRINK);
262 global_vpacker.pack_start (output_button, Gtk::PACK_SHRINK);
263 global_vpacker.pack_start (comment_button, Gtk::PACK_SHRINK);
265 if (route()->master() || route()->control()) {
267 if (scrollbar_height == 0) {
268 HScrollbar scrollbar;
269 Gtk::Requisition requisition(scrollbar.size_request ());
270 scrollbar_height = requisition.height;
273 EventBox* spacer = manage (new EventBox);
274 spacer->set_size_request (-1, scrollbar_height);
275 global_vpacker.pack_start (*spacer, false, false);
278 global_frame.add (global_vpacker);
279 global_frame.set_shadow_type (Gtk::SHADOW_IN);
280 global_frame.set_name ("BaseFrame");
284 /* force setting of visible selected status */
287 set_selected (false);
292 _session.engine().Stopped.connect (mem_fun(*this, &MixerStrip::engine_stopped));
293 _session.engine().Running.connect (mem_fun(*this, &MixerStrip::engine_running));
294 _route->input_changed.connect (mem_fun(*this, &MixerStrip::input_changed));
295 _route->output_changed.connect (mem_fun(*this, &MixerStrip::output_changed));
296 _route->mute_changed.connect (mem_fun(*this, &RouteUI::mute_changed));
297 _route->solo_changed.connect (mem_fun(*this, &RouteUI::solo_changed));
298 _route->solo_safe_changed.connect (mem_fun(*this, &RouteUI::solo_changed));
299 _route->mix_group_changed.connect (mem_fun(*this, &MixerStrip::mix_group_changed));
300 _route->panner().Changed.connect (mem_fun(*this, &MixerStrip::connect_to_pan));
302 if (is_audio_track()) {
303 audio_track()->DiskstreamChanged.connect (mem_fun(*this, &MixerStrip::diskstream_changed));
304 get_diskstream()->SpeedChanged.connect (mem_fun(*this, &MixerStrip::speed_changed));
307 _route->name_changed.connect (mem_fun(*this, &RouteUI::name_changed));
308 _route->comment_changed.connect (mem_fun(*this, &MixerStrip::comment_changed));
309 _route->gui_changed.connect (mem_fun(*this, &MixerStrip::route_gui_changed));
311 input_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::input_press), false);
312 output_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::output_press), false);
314 solo_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::solo_press), false);
315 solo_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::solo_release), false);
316 mute_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::mute_press), false);
317 mute_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::mute_release), false);
319 name_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::name_button_button_press), false);
320 group_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::select_mix_group), false);
323 set_stuff_from_route ();
325 /* start off as a passthru strip. we'll correct this, if necessary,
326 in update_diskstream_display().
329 set_name ("AudioTrackStripBase");
331 /* now force an update of all the various elements */
333 pre_redirect_box.update();
334 post_redirect_box.update();
339 mix_group_changed (0);
343 panners.setup_pan ();
345 if (is_audio_track()) {
349 update_diskstream_display ();
350 update_input_display ();
351 update_output_display ();
353 add_events (Gdk::BUTTON_RELEASE_MASK);
356 MixerStrip::~MixerStrip ()
358 GoingAway(); /* EMIT_SIGNAL */
360 if (input_selector) {
361 delete input_selector;
364 if (output_selector) {
365 delete output_selector;
370 MixerStrip::set_stuff_from_route ()
376 /* if width is not set, it will be set by the MixerUI or editor */
378 if ((prop = xml_node->property ("strip_width")) != 0) {
379 set_width (Width (string_2_enum (prop->value(), _width)), this);
382 if ((prop = xml_node->property ("shown_mixer")) != 0) {
383 if (prop->value() == "no") {
384 _marked_for_display = false;
386 _marked_for_display = true;
389 /* backwards compatibility */
390 _marked_for_display = true;
395 MixerStrip::set_width (Width w, void* owner)
397 /* always set the gpm width again, things may be hidden */
400 panners.set_width (w);
401 pre_redirect_box.set_width (w);
402 post_redirect_box.set_width (w);
404 _width_owner = owner;
414 if (_width_owner == this) {
415 xml_node->add_property ("strip_width", enum_2_string (_width));
420 set_size_request (-1, -1);
422 if (rec_enable_button) {
423 ((Gtk::Label*)rec_enable_button->get_child())->set_text (_("record"));
425 ((Gtk::Label*)mute_button->get_child())->set_text (_("Mute"));
426 ((Gtk::Label*)solo_button->get_child())->set_text (_("Solo"));
428 if (_route->comment() == "") {
429 comment_button.unset_bg (STATE_NORMAL);
430 ((Gtk::Label*)comment_button.get_child())->set_text (_("comments"));
432 comment_button.modify_bg (STATE_NORMAL, color());
433 ((Gtk::Label*)comment_button.get_child())->set_text (_("*comments*"));
436 ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (gpm.astyle_string(_route->gain_automation_curve().automation_style()));
437 ((Gtk::Label*)gpm.gain_automation_state_button.get_child())->set_text (gpm.astate_string(_route->gain_automation_curve().automation_state()));
438 ((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text (panners.astyle_string(_route->panner().automation_style()));
439 ((Gtk::Label*)panners.pan_automation_state_button.get_child())->set_text (panners.astate_string(_route->panner().automation_state()));
440 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "long", 2, 2);
444 if (rec_enable_button) {
445 ((Gtk::Label*)rec_enable_button->get_child())->set_text (_("Rec"));
447 ((Gtk::Label*)mute_button->get_child())->set_text (_("M"));
448 ((Gtk::Label*)solo_button->get_child())->set_text (_("S"));
450 if (_route->comment() == "") {
451 comment_button.unset_bg (STATE_NORMAL);
452 ((Gtk::Label*)comment_button.get_child())->set_text (_("Cmt"));
454 comment_button.modify_bg (STATE_NORMAL, color());
455 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Cmt*"));
458 ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (gpm.short_astyle_string(_route->gain_automation_curve().automation_style()));
459 ((Gtk::Label*)gpm.gain_automation_state_button.get_child())->set_text (gpm.short_astate_string(_route->gain_automation_curve().automation_state()));
460 ((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text (panners.short_astyle_string(_route->panner().automation_style()));
461 ((Gtk::Label*)panners.pan_automation_state_button.get_child())->set_text (panners.short_astate_string(_route->panner().automation_state()));
462 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2);
463 set_size_request (max (50, gpm.get_gm_width()), -1);
467 update_input_display ();
468 update_output_display ();
469 mix_group_changed (0);
475 MixerStrip::set_packed (bool yn)
482 xml_node->add_property ("shown_mixer", "yes");
484 xml_node->add_property ("shown_mixer", "no");
490 MixerStrip::output_press (GdkEventButton *ev)
492 using namespace Menu_Helpers;
493 if (!_session.engine().connected()) {
494 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
499 MenuList& citems = output_menu.items();
500 switch (ev->button) {
503 output_menu.set_name ("ArdourContextMenu");
506 citems.push_back (MenuElem (_("Edit"), mem_fun(*this, &MixerStrip::edit_output_configuration)));
507 citems.push_back (SeparatorElem());
508 citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_output)));
509 citems.push_back (SeparatorElem());
511 _session.foreach_connection (this, &MixerStrip::add_connection_to_output_menu);
513 output_menu.popup (1, ev->time);
523 MixerStrip::edit_output_configuration ()
525 if (output_selector == 0) {
526 output_selector = new IOSelectorWindow (_session, _route, false);
529 if (output_selector->is_visible()) {
530 output_selector->get_toplevel()->get_window()->raise();
532 output_selector->show_all ();
537 MixerStrip::edit_input_configuration ()
539 if (input_selector == 0) {
540 input_selector = new IOSelectorWindow (_session, _route, true);
543 if (input_selector->is_visible()) {
544 input_selector->get_toplevel()->get_window()->raise();
546 input_selector->show_all ();
551 MixerStrip::input_press (GdkEventButton *ev)
553 using namespace Menu_Helpers;
555 MenuList& citems = input_menu.items();
556 input_menu.set_name ("ArdourContextMenu");
559 if (!_session.engine().connected()) {
560 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
565 switch (ev->button) {
568 citems.push_back (MenuElem (_("Edit"), mem_fun(*this, &MixerStrip::edit_input_configuration)));
569 citems.push_back (SeparatorElem());
570 citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_input)));
571 citems.push_back (SeparatorElem());
573 _session.foreach_connection (this, &MixerStrip::add_connection_to_input_menu);
575 input_menu.popup (1, ev->time);
585 MixerStrip::connection_input_chosen (ARDOUR::Connection *c)
587 if (!ignore_toggle) {
590 _route->use_input_connection (*c, this);
593 catch (AudioEngine::PortRegistrationFailure& err) {
594 error << _("could not register new ports required for that connection")
601 MixerStrip::connection_output_chosen (ARDOUR::Connection *c)
603 if (!ignore_toggle) {
606 _route->use_output_connection (*c, this);
609 catch (AudioEngine::PortRegistrationFailure& err) {
610 error << _("could not register new ports required for that connection")
617 MixerStrip::add_connection_to_input_menu (ARDOUR::Connection* c)
619 using namespace Menu_Helpers;
621 if (dynamic_cast<InputConnection *> (c) == 0) {
625 MenuList& citems = input_menu.items();
627 if (c->nports() == _route->n_inputs()) {
629 citems.push_back (CheckMenuElem (c->name(), bind (mem_fun(*this, &MixerStrip::connection_input_chosen), c)));
631 ARDOUR::Connection *current = _route->input_connection();
634 ignore_toggle = true;
635 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
636 ignore_toggle = false;
642 MixerStrip::add_connection_to_output_menu (ARDOUR::Connection* c)
644 using namespace Menu_Helpers;
646 if (dynamic_cast<OutputConnection *> (c) == 0) {
650 if (c->nports() == _route->n_outputs()) {
652 MenuList& citems = output_menu.items();
653 citems.push_back (CheckMenuElem (c->name(), bind (mem_fun(*this, &MixerStrip::connection_output_chosen), c)));
655 ARDOUR::Connection *current = _route->output_connection();
658 ignore_toggle = true;
659 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
660 ignore_toggle = false;
666 MixerStrip::update_diskstream_display ()
668 if (is_audio_track()) {
672 update_input_display ();
674 if (input_selector) {
675 input_selector->hide_all ();
684 update_input_display ();
685 show_passthru_color ();
690 MixerStrip::connect_to_pan ()
692 ENSURE_GUI_THREAD(mem_fun(*this, &MixerStrip::connect_to_pan));
694 panstate_connection.disconnect ();
695 panstyle_connection.disconnect ();
697 if (!_route->panner().empty()) {
698 StreamPanner* sp = _route->panner().front();
700 panstate_connection = sp->automation().automation_state_changed.connect (mem_fun(panners, &PannerUI::pan_automation_state_changed));
701 panstyle_connection = sp->automation().automation_style_changed.connect (mem_fun(panners, &PannerUI::pan_automation_style_changed));
704 panners.pan_changed (this);
708 MixerStrip::update_input_display ()
710 ARDOUR::Connection *c;
712 if ((c = _route->input_connection()) != 0) {
713 input_label.set_text (c->name());
717 input_label.set_text (_(" Input"));
720 input_label.set_text (_("I"));
724 panners.setup_pan ();
728 MixerStrip::update_output_display ()
730 ARDOUR::Connection *c;
732 if ((c = _route->output_connection()) != 0) {
733 output_label.set_text (c->name());
737 output_label.set_text (_("Output"));
740 output_label.set_text (_("O"));
745 panners.setup_pan ();
749 MixerStrip::fast_update ()
751 gpm.update_meters ();
755 MixerStrip::diskstream_changed ()
757 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_diskstream_display));
761 MixerStrip::input_changed (IOChange change, void *src)
763 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_input_display));
767 MixerStrip::output_changed (IOChange change, void *src)
769 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_output_display));
774 MixerStrip::comment_editor_done_editing()
776 string str = comment_area->get_buffer()->get_text();
777 if (_route->comment() != str) {
778 _route->set_comment (str, this);
784 comment_button.modify_bg (STATE_NORMAL, color());
785 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Comments*"));
787 comment_button.unset_bg (STATE_NORMAL);
788 ((Gtk::Label*)comment_button.get_child())->set_text (_("Comments"));
794 comment_button.modify_bg (STATE_NORMAL, color());
795 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Cmt*"));
797 comment_button.unset_bg (STATE_NORMAL);
798 ((Gtk::Label*)comment_button.get_child())->set_text (_("Cmt"));
803 ARDOUR_UI::instance()->tooltips().set_tip (comment_button,
804 str.empty() ? _("Click to Add/Edit Comments") : str);
810 MixerStrip::comment_button_clicked ()
812 if (comment_window == 0) {
813 setup_comment_editor ();
816 int x, y, cw_width, cw_height;
818 if (comment_window->is_visible()) {
819 comment_window->hide ();
823 comment_window->get_size (cw_width, cw_height);
824 comment_window->get_position(x, y);
825 comment_window->move(x, y - (cw_height / 2) - 45);
827 half the dialog height minus the comments button height
828 with some window decoration fudge thrown in.
831 comment_window->show();
832 comment_window->present();
836 MixerStrip::setup_comment_editor ()
839 title = _route->name();
840 title += _(": comment editor");
842 comment_window = new ArdourDialog (title, false);
843 comment_window->set_position (Gtk::WIN_POS_MOUSE);
844 comment_window->set_skip_taskbar_hint (true);
845 comment_window->signal_hide().connect (mem_fun(*this, &MixerStrip::comment_editor_done_editing));
847 comment_area = manage (new TextView());
848 comment_area->set_name ("MixerTrackCommentArea");
849 comment_area->set_size_request (110, 178);
850 comment_area->set_wrap_mode (WRAP_WORD);
851 comment_area->set_editable (true);
852 comment_area->get_buffer()->set_text (_route->comment());
853 comment_area->show ();
855 comment_window->get_vbox()->pack_start (*comment_area);
856 comment_window->get_action_area()->hide();
860 MixerStrip::comment_changed (void *src)
862 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::comment_changed), src));
865 ignore_comment_edit = true;
867 comment_area->get_buffer()->set_text (_route->comment());
869 ignore_comment_edit = false;
874 MixerStrip::set_mix_group (RouteGroup *rg)
876 _route->set_mix_group (rg, this);
880 MixerStrip::add_mix_group_to_menu (RouteGroup *rg, RadioMenuItem::Group* group)
882 using namespace Menu_Helpers;
884 MenuList& items = group_menu->items();
886 items.push_back (RadioMenuElem (*group, rg->name(), bind (mem_fun(*this, &MixerStrip::set_mix_group), rg)));
888 if (_route->mix_group() == rg) {
889 static_cast<RadioMenuItem*>(&items.back())->set_active ();
894 MixerStrip::select_mix_group (GdkEventButton *ev)
896 using namespace Menu_Helpers;
898 if (group_menu == 0) {
899 group_menu = new Menu;
901 group_menu->set_name ("ArdourContextMenu");
902 MenuList& items = group_menu->items();
903 RadioMenuItem::Group group;
905 switch (ev->button) {
909 items.push_back (RadioMenuElem (group, _("No group"), bind (mem_fun(*this, &MixerStrip::set_mix_group), (RouteGroup *) 0)));
911 _session.foreach_mix_group (bind (mem_fun (*this, &MixerStrip::add_mix_group_to_menu), &group));
913 group_menu->popup (1, ev->time);
924 MixerStrip::mix_group_changed (void *ignored)
926 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::mix_group_changed), ignored));
928 RouteGroup *rg = _route->mix_group();
931 group_label.set_text (rg->name());
935 group_label.set_text (_("Grp"));
938 group_label.set_text (_("~G"));
946 MixerStrip::route_gui_changed (string what_changed, void* ignored)
948 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::route_gui_changed), what_changed, ignored));
950 if (what_changed == "color") {
951 if (set_color_from_route () == 0) {
958 MixerStrip::show_route_color ()
960 name_button.modify_bg (STATE_NORMAL, color());
961 top_event_box.modify_bg (STATE_NORMAL, color());
962 route_active_changed ();
966 MixerStrip::show_passthru_color ()
968 route_active_changed ();
972 MixerStrip::build_route_ops_menu ()
974 using namespace Menu_Helpers;
975 route_ops_menu = manage (new Menu);
976 route_ops_menu->set_name ("ArdourContextMenu");
978 MenuList& items = route_ops_menu->items();
980 items.push_back (MenuElem (_("Rename"), mem_fun(*this, &RouteUI::route_rename)));
981 items.push_back (SeparatorElem());
982 items.push_back (CheckMenuElem (_("Active"), mem_fun (*this, &RouteUI::toggle_route_active)));
983 route_active_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
984 route_active_menu_item->set_active (_route->active());
985 items.push_back (SeparatorElem());
986 items.push_back (CheckMenuElem (_("Invert Polarity"), mem_fun (*this, &RouteUI::toggle_polarity)));
987 polarity_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
988 polarity_menu_item->set_active (_route->phase_invert());
989 items.push_back (CheckMenuElem (_("Protect against denormals"), mem_fun (*this, &RouteUI::toggle_denormal_protection)));
990 denormal_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
991 denormal_menu_item->set_active (_route->denormal_protection());
993 build_remote_control_menu ();
995 items.push_back (SeparatorElem());
996 if (!Profile->get_sae()) {
997 items.push_back (MenuElem (_("Remote Control ID"), *remote_control_menu));
1000 items.push_back (SeparatorElem());
1001 items.push_back (MenuElem (_("Remove"), mem_fun(*this, &RouteUI::remove_this_route)));
1005 MixerStrip::name_button_button_press (GdkEventButton* ev)
1007 if (ev->button == 1) {
1008 list_route_operations ();
1010 Menu_Helpers::MenuList& items = route_ops_menu->items();
1011 /* do not allow rename if the track is record-enabled */
1012 static_cast<MenuItem*> (&items.front())->set_sensitive (!_route->record_enabled());
1014 route_ops_menu->popup (1, ev->time);
1020 MixerStrip::list_route_operations ()
1022 if (route_ops_menu == 0) {
1023 build_route_ops_menu ();
1026 refresh_remote_control_menu();
1031 MixerStrip::speed_adjustment_changed ()
1033 /* since there is a usable speed adjustment, there has to be a diskstream */
1034 if (!ignore_speed_adjustment) {
1035 get_diskstream()->set_speed (speed_adjustment.get_value());
1040 MixerStrip::speed_changed ()
1042 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_speed_display));
1046 MixerStrip::update_speed_display ()
1050 val = get_diskstream()->speed();
1053 speed_spinner.set_name ("MixerStripSpeedBaseNotOne");
1055 speed_spinner.set_name ("MixerStripSpeedBase");
1058 if (speed_adjustment.get_value() != val) {
1059 ignore_speed_adjustment = true;
1060 speed_adjustment.set_value (val);
1061 ignore_speed_adjustment = false;
1067 MixerStrip::set_selected (bool yn)
1069 AxisView::set_selected (yn);
1071 global_frame.set_shadow_type (Gtk::SHADOW_ETCHED_OUT);
1072 global_frame.set_name ("MixerStripSelectedFrame");
1074 global_frame.set_shadow_type (Gtk::SHADOW_IN);
1075 global_frame.set_name ("MixerStripFrame");
1077 global_frame.queue_draw ();
1081 MixerStrip::name_changed (void *src)
1085 RouteUI::name_changed (src);
1088 name_label.set_text (PBD::short_version (_route->name(), 5));
1091 if (_route->phase_invert()) {
1092 name_label.set_text (X_("Ø ") + name_label.get_text());
1097 MixerStrip::width_clicked ()
1101 set_width (Narrow, this);
1104 set_width (Wide, this);
1110 MixerStrip::hide_clicked ()
1112 // LAME fix to reset the button status for when it is redisplayed (part 1)
1113 hide_button.set_sensitive(false);
1116 Hiding(); /* EMIT_SIGNAL */
1118 _mixer.hide_strip (this);
1122 hide_button.set_sensitive(true);
1126 MixerStrip::set_embedded (bool yn)
1132 MixerStrip::map_frozen ()
1134 ENSURE_GUI_THREAD (mem_fun(*this, &MixerStrip::map_frozen));
1136 boost::shared_ptr<AudioTrack> at = audio_track();
1139 switch (at->freeze_state()) {
1140 case AudioTrack::Frozen:
1141 pre_redirect_box.set_sensitive (false);
1142 post_redirect_box.set_sensitive (false);
1143 speed_spinner.set_sensitive (false);
1146 pre_redirect_box.set_sensitive (true);
1147 post_redirect_box.set_sensitive (true);
1148 speed_spinner.set_sensitive (true);
1152 _route->foreach_redirect (this, &MixerStrip::hide_redirect_editor);
1156 MixerStrip::hide_redirect_editor (boost::shared_ptr<Redirect> redirect)
1158 void* gui = redirect->get_gui ();
1161 static_cast<Gtk::Widget*>(gui)->hide ();
1166 MixerStrip::route_active_changed ()
1168 RouteUI::route_active_changed ();
1170 if (is_audio_track()) {
1171 if (_route->active()) {
1172 set_name ("AudioTrackStripBase");
1173 gpm.set_meter_strip_name ("AudioTrackMetrics");
1175 set_name ("AudioTrackStripBaseInactive");
1176 gpm.set_meter_strip_name ("AudioTrackMetricsInactive");
1178 gpm.set_fader_name ("AudioTrackFader");
1179 } else { // FIXME: assumed audio bus
1180 if (_route->active()) {
1181 set_name ("AudioBusStripBase");
1182 gpm.set_meter_strip_name ("AudioBusMetrics");
1184 set_name ("AudioBusStripBaseInactive");
1185 gpm.set_meter_strip_name ("AudioBusMetricsInactive");
1187 gpm.set_fader_name ("AudioBusFader");
1192 MixerStrip::mix_group() const
1194 return _route->mix_group();
1198 MixerStrip::engine_stopped ()
1203 MixerStrip::engine_running ()
1208 MixerStrip::meter_changed (void *src)
1211 ENSURE_GUI_THREAD (bind (mem_fun(*this, &MixerStrip::meter_changed), src));
1213 switch (_route->meter_point()) {
1215 meter_point_label.set_text (_("input"));
1219 meter_point_label.set_text (_("pre"));
1222 case MeterPostFader:
1223 meter_point_label.set_text (_("post"));
1227 gpm.setup_meters ();