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.
22 #include <sigc++/bind.h>
24 #include <pbd/convert.h>
26 #include <gtkmm2ext/gtk_ui.h>
27 #include <gtkmm2ext/utils.h>
28 #include <gtkmm2ext/choice.h>
29 #include <gtkmm2ext/stop_signal.h>
30 #include <gtkmm2ext/doi.h>
31 #include <gtkmm2ext/slider_controller.h>
32 #include <gtkmm2ext/bindable_button.h>
34 #include <ardour/ardour.h>
35 #include <ardour/session.h>
36 #include <ardour/audioengine.h>
37 #include <ardour/route.h>
38 #include <ardour/audio_track.h>
39 #include <ardour/audio_diskstream.h>
40 #include <ardour/panner.h>
41 #include <ardour/send.h>
42 #include <ardour/insert.h>
43 #include <ardour/ladspa_plugin.h>
44 #include <ardour/connection.h>
45 #include <ardour/session_connection.h>
47 #include "ardour_ui.h"
48 #include "ardour_dialog.h"
49 #include "mixer_strip.h"
52 #include "public_editor.h"
54 #include "io_selector.h"
56 #include "gui_thread.h"
61 using namespace ARDOUR;
64 using namespace Gtkmm2ext;
66 int MixerStrip::scrollbar_height = 0;
68 #ifdef VARISPEED_IN_MIXER_STRIP
70 speed_printer (char buf[32], Gtk::Adjustment& adj, void* arg)
72 float val = adj.get_value ();
77 snprintf (buf, 32, "%.3f", val);
82 MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, boost::shared_ptr<Route> rt, bool in_mixer)
84 RouteUI (rt, sess, _("Mute"), _("Solo"), _("Record")),
86 pre_redirect_box (PreFader, sess, rt, mx.plugin_selector(), mx.selection(), in_mixer),
87 post_redirect_box (PostFader, sess, rt, mx.plugin_selector(), mx.selection(), in_mixer),
89 panners (_route, sess),
91 middle_button_table (1, 2),
92 bottom_button_table (1, 2),
93 meter_point_label (_("pre")),
94 comment_button (_("Comments")),
95 speed_adjustment (1.0, 0.001, 4.0, 0.001, 0.1),
96 speed_spinner (&speed_adjustment, "MixerStripSpeedBase", true)
99 if (set_color_from_route()) {
100 set_color (unique_random_color());
106 _marked_for_display = false;
108 ignore_comment_edit = false;
109 ignore_toggle = false;
110 ignore_speed_adjustment = false;
114 width_button.add (*(manage (new Gtk::Image (::get_icon("strip_width")))));
115 hide_button.add (*(manage (new Gtk::Image (::get_icon("hide")))));
117 input_label.set_text (_("Input"));
118 input_button.add (input_label);
119 input_button.set_name ("MixerIOButton");
120 input_label.set_name ("MixerIOButtonLabel");
122 output_label.set_text (_("Output"));
123 output_button.add (output_label);
124 output_button.set_name ("MixerIOButton");
125 output_label.set_name ("MixerIOButtonLabel");
127 _route->meter_change.connect (mem_fun(*this, &MixerStrip::meter_changed));
128 meter_point_button.add (meter_point_label);
129 meter_point_button.set_name ("MixerStripMeterPreButton");
130 meter_point_label.set_name ("MixerStripMeterPreButton");
132 switch (_route->meter_point()) {
134 meter_point_label.set_text (_("input"));
138 meter_point_label.set_text (_("pre"));
142 meter_point_label.set_text (_("post"));
146 /* TRANSLATORS: this string should be longest of the strings
147 used to describe meter points. In english, it's "input".
149 set_size_request_to_display_given_text (meter_point_button, _("tupni"), 5, 5);
151 bottom_button_table.attach (meter_point_button, 1, 2, 0, 1);
153 meter_point_button.signal_button_press_event().connect (mem_fun (gpm, &GainMeter::meter_press), false);
154 /* XXX what is this meant to do? */
155 //meter_point_button.signal_button_release_event().connect (mem_fun (gpm, &GainMeter::meter_release), false);
157 hide_button.set_events (hide_button.get_events() & ~(Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK));
159 mute_button->set_name ("MixerMuteButton");
160 solo_button->set_name ("MixerSoloButton");
162 button_table.set_homogeneous (true);
163 button_table.set_spacings (0);
165 button_table.attach (name_button, 0, 2, 0, 1);
166 button_table.attach (input_button, 0, 2, 1, 2);
168 middle_button_table.set_homogeneous (true);
169 middle_button_table.set_spacings (0);
170 middle_button_table.attach (*mute_button, 0, 1, 0, 1);
171 middle_button_table.attach (*solo_button, 1, 2, 0, 1);
173 bottom_button_table.set_col_spacings (0);
174 bottom_button_table.set_homogeneous (true);
175 bottom_button_table.attach (group_button, 0, 1, 0, 1);
177 if (is_audio_track()) {
179 rec_enable_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::rec_enable_press), false);
180 rec_enable_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::rec_enable_release));
182 rec_enable_button->set_name ("MixerRecordEnableButton");
184 AudioTrack* at = audio_track();
186 at->FreezeChange.connect (mem_fun(*this, &MixerStrip::map_frozen));
188 #ifdef VARISPEED_IN_MIXER_STRIP
189 speed_adjustment.signal_value_changed().connect (mem_fun(*this, &MixerStrip::speed_adjustment_changed));
191 speed_frame.set_name ("BaseFrame");
192 speed_frame.set_shadow_type (Gtk::SHADOW_IN);
193 speed_frame.add (speed_spinner);
195 speed_spinner.set_print_func (speed_printer, 0);
197 ARDOUR_UI::instance()->tooltips().set_tip (speed_spinner, _("Varispeed"));
199 button_table.attach (speed_frame, 0, 2, 5, 6);
200 #endif /* VARISPEED_IN_MIXER_STRIP */
202 button_table.attach (*rec_enable_button, 0, 2, 2, 3);
205 name_button.add (name_label);
206 name_button.set_name ("MixerNameButton");
207 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2);
209 name_label.set_name ("MixerNameButtonLabel");
210 if (_route->phase_invert()) {
211 name_label.set_text (X_("Ø ") + name_label.get_text());
213 name_label.set_text (_route->name());
216 group_button.add (group_label);
217 group_button.set_name ("MixerGroupButton");
218 group_label.set_name ("MixerGroupButtonLabel");
220 comment_button.set_name ("MixerCommentButton");
222 ARDOUR_UI::instance()->tooltips().set_tip (comment_button, _route->comment()=="" ?
223 _("Click to Add/Edit Comments"):
226 comment_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::comment_button_clicked));
228 global_vpacker.set_border_width (0);
229 global_vpacker.set_spacing (0);
231 VBox *whvbox = manage (new VBox);
233 width_button.set_name ("MixerWidthButton");
234 hide_button.set_name ("MixerHideButton");
235 top_event_box.set_name ("MixerTopEventBox");
237 width_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::width_clicked));
238 hide_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::hide_clicked));
240 width_hide_box.pack_start (width_button, false, true);
241 width_hide_box.pack_start (top_event_box, true, true);
242 width_hide_box.pack_end (hide_button, false, true);
243 Gtk::Alignment *gain_meter_alignment = Gtk::manage(new Gtk::Alignment());
244 gain_meter_alignment->set_padding(0, 4, 0, 0);
245 gain_meter_alignment->add(gpm);
247 whvbox->pack_start (width_hide_box, true, true);
249 global_vpacker.pack_start (*whvbox, Gtk::PACK_SHRINK);
250 global_vpacker.pack_start (button_table,Gtk::PACK_SHRINK);
251 global_vpacker.pack_start (pre_redirect_box, true, true);
252 global_vpacker.pack_start (middle_button_table,Gtk::PACK_SHRINK);
253 global_vpacker.pack_start (*gain_meter_alignment,Gtk::PACK_SHRINK);
254 global_vpacker.pack_start (bottom_button_table,Gtk::PACK_SHRINK);
255 global_vpacker.pack_start (post_redirect_box, true, true);
256 global_vpacker.pack_start (panners, Gtk::PACK_SHRINK);
257 global_vpacker.pack_start (output_button, Gtk::PACK_SHRINK);
258 global_vpacker.pack_start (comment_button, Gtk::PACK_SHRINK);
260 if (route()->master() || route()->control()) {
262 if (scrollbar_height == 0) {
263 HScrollbar scrollbar;
264 Gtk::Requisition requisition(scrollbar.size_request ());
265 scrollbar_height = requisition.height;
268 EventBox* spacer = manage (new EventBox);
269 spacer->set_size_request (-1, scrollbar_height);
270 global_vpacker.pack_start (*spacer, false, false);
273 global_frame.add (global_vpacker);
274 global_frame.set_shadow_type (Gtk::SHADOW_IN);
275 global_frame.set_name ("BaseFrame");
279 /* force setting of visible selected status */
282 set_selected (false);
287 _session.engine().Stopped.connect (mem_fun(*this, &MixerStrip::engine_stopped));
288 _session.engine().Running.connect (mem_fun(*this, &MixerStrip::engine_running));
289 _route->input_changed.connect (mem_fun(*this, &MixerStrip::input_changed));
290 _route->output_changed.connect (mem_fun(*this, &MixerStrip::output_changed));
291 _route->mute_changed.connect (mem_fun(*this, &RouteUI::mute_changed));
292 _route->solo_changed.connect (mem_fun(*this, &RouteUI::solo_changed));
293 _route->solo_safe_changed.connect (mem_fun(*this, &RouteUI::solo_changed));
294 _route->mix_group_changed.connect (mem_fun(*this, &MixerStrip::mix_group_changed));
295 _route->panner().Changed.connect (mem_fun(*this, &MixerStrip::connect_to_pan));
297 if (is_audio_track()) {
298 audio_track()->DiskstreamChanged.connect (mem_fun(*this, &MixerStrip::diskstream_changed));
299 get_diskstream()->SpeedChanged.connect (mem_fun(*this, &MixerStrip::speed_changed));
302 _route->name_changed.connect (mem_fun(*this, &RouteUI::name_changed));
303 _route->comment_changed.connect (mem_fun(*this, &MixerStrip::comment_changed));
304 _route->gui_changed.connect (mem_fun(*this, &MixerStrip::route_gui_changed));
306 input_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::input_press), false);
307 output_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::output_press), false);
309 solo_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::solo_press), false);
310 solo_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::solo_release), false);
311 mute_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::mute_press), false);
312 mute_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::mute_release), false);
314 name_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::name_button_button_press), false);
315 group_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::select_mix_group), false);
318 set_stuff_from_route ();
320 /* start off as a passthru strip. we'll correct this, if necessary,
321 in update_diskstream_display().
324 set_name ("AudioTrackStripBase");
326 /* now force an update of all the various elements */
328 pre_redirect_box.update();
329 post_redirect_box.update();
334 mix_group_changed (0);
338 panners.setup_pan ();
340 if (is_audio_track()) {
344 update_diskstream_display ();
345 update_input_display ();
346 update_output_display ();
348 add_events (Gdk::BUTTON_RELEASE_MASK);
351 MixerStrip::~MixerStrip ()
353 GoingAway(); /* EMIT_SIGNAL */
355 if (input_selector) {
356 delete input_selector;
359 if (output_selector) {
360 delete output_selector;
365 MixerStrip::set_stuff_from_route ()
371 if ((prop = xml_node->property ("strip_width")) != 0) {
372 if (prop->value() == "wide") {
374 } else if (prop->value() == "narrow") {
378 error << string_compose(_("unknown strip width \"%1\" in XML GUI information"), prop->value()) << endmsg;
386 if ((prop = xml_node->property ("shown_mixer")) != 0) {
387 if (prop->value() == "no") {
388 _marked_for_display = false;
390 _marked_for_display = true;
394 /* backwards compatibility */
395 _marked_for_display = true;
400 MixerStrip::set_width (Width w)
402 /* always set the gpm width again, things may be hidden */
404 panners.set_width (w);
405 pre_redirect_box.set_width (w);
406 post_redirect_box.set_width (w);
418 set_size_request (-1, -1);
419 xml_node->add_property ("strip_width", "wide");
421 if (rec_enable_button) {
422 ((Gtk::Label*)rec_enable_button->get_child())->set_text (_("record"));
424 ((Gtk::Label*)mute_button->get_child())->set_text (_("Mute"));
425 ((Gtk::Label*)solo_button->get_child())->set_text (_("Solo"));
427 if (_route->comment() == "") {
428 comment_button.unset_bg (STATE_NORMAL);
429 ((Gtk::Label*)comment_button.get_child())->set_text (_("comments"));
431 comment_button.modify_bg (STATE_NORMAL, color());
432 ((Gtk::Label*)comment_button.get_child())->set_text (_("*comments*"));
435 ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (gpm.astyle_string(_route->gain_automation_curve().automation_style()));
436 ((Gtk::Label*)gpm.gain_automation_state_button.get_child())->set_text (gpm.astate_string(_route->gain_automation_curve().automation_state()));
437 ((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text (panners.astyle_string(_route->panner().automation_style()));
438 ((Gtk::Label*)panners.pan_automation_state_button.get_child())->set_text (panners.astate_string(_route->panner().automation_state()));
439 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "long", 2, 2);
443 set_size_request (50, -1);
444 xml_node->add_property ("strip_width", "narrow");
446 if (rec_enable_button) {
447 ((Gtk::Label*)rec_enable_button->get_child())->set_text (_("Rec"));
449 ((Gtk::Label*)mute_button->get_child())->set_text (_("M"));
450 ((Gtk::Label*)solo_button->get_child())->set_text (_("S"));
452 if (_route->comment() == "") {
453 comment_button.unset_bg (STATE_NORMAL);
454 ((Gtk::Label*)comment_button.get_child())->set_text (_("Cmt"));
456 comment_button.modify_bg (STATE_NORMAL, color());
457 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Cmt*"));
460 ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (gpm.short_astyle_string(_route->gain_automation_curve().automation_style()));
461 ((Gtk::Label*)gpm.gain_automation_state_button.get_child())->set_text (gpm.short_astate_string(_route->gain_automation_curve().automation_state()));
462 ((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text (panners.short_astyle_string(_route->panner().automation_style()));
463 ((Gtk::Label*)panners.pan_automation_state_button.get_child())->set_text (panners.short_astate_string(_route->panner().automation_state()));
464 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2);
468 update_input_display ();
469 update_output_display ();
470 mix_group_changed (0);
476 MixerStrip::set_packed (bool yn)
483 xml_node->add_property ("shown_mixer", "yes");
485 xml_node->add_property ("shown_mixer", "no");
491 MixerStrip::output_press (GdkEventButton *ev)
493 using namespace Menu_Helpers;
494 if (!_session.engine().connected()) {
495 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
500 MenuList& citems = output_menu.items();
501 switch (ev->button) {
504 output_menu.set_name ("ArdourContextMenu");
507 citems.push_back (MenuElem (_("Edit"), mem_fun(*this, &MixerStrip::edit_output_configuration)));
508 citems.push_back (SeparatorElem());
509 citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_output)));
510 citems.push_back (SeparatorElem());
512 _session.foreach_connection (this, &MixerStrip::add_connection_to_output_menu);
514 output_menu.popup (1, ev->time);
524 MixerStrip::edit_output_configuration ()
526 if (output_selector == 0) {
527 output_selector = new IOSelectorWindow (_session, _route, false);
530 if (output_selector->is_visible()) {
531 output_selector->get_toplevel()->get_window()->raise();
533 output_selector->show_all ();
538 MixerStrip::edit_input_configuration ()
540 if (input_selector == 0) {
541 input_selector = new IOSelectorWindow (_session, _route, true);
544 if (input_selector->is_visible()) {
545 input_selector->get_toplevel()->get_window()->raise();
547 input_selector->show_all ();
552 MixerStrip::input_press (GdkEventButton *ev)
554 using namespace Menu_Helpers;
556 MenuList& citems = input_menu.items();
557 input_menu.set_name ("ArdourContextMenu");
560 if (!_session.engine().connected()) {
561 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
566 switch (ev->button) {
569 citems.push_back (MenuElem (_("Edit"), mem_fun(*this, &MixerStrip::edit_input_configuration)));
570 citems.push_back (SeparatorElem());
571 citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_input)));
572 citems.push_back (SeparatorElem());
574 _session.foreach_connection (this, &MixerStrip::add_connection_to_input_menu);
576 input_menu.popup (1, ev->time);
586 MixerStrip::connection_input_chosen (ARDOUR::Connection *c)
588 if (!ignore_toggle) {
591 _route->use_input_connection (*c, this);
594 catch (AudioEngine::PortRegistrationFailure& err) {
595 error << _("could not register new ports required for that connection")
602 MixerStrip::connection_output_chosen (ARDOUR::Connection *c)
604 if (!ignore_toggle) {
607 _route->use_output_connection (*c, this);
610 catch (AudioEngine::PortRegistrationFailure& err) {
611 error << _("could not register new ports required for that connection")
618 MixerStrip::add_connection_to_input_menu (ARDOUR::Connection* c)
620 using namespace Menu_Helpers;
622 if (dynamic_cast<InputConnection *> (c) == 0) {
626 MenuList& citems = input_menu.items();
628 if (c->nports() == _route->n_inputs()) {
630 citems.push_back (CheckMenuElem (c->name(), bind (mem_fun(*this, &MixerStrip::connection_input_chosen), c)));
632 ARDOUR::Connection *current = _route->input_connection();
635 ignore_toggle = true;
636 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
637 ignore_toggle = false;
643 MixerStrip::add_connection_to_output_menu (ARDOUR::Connection* c)
645 using namespace Menu_Helpers;
647 if (dynamic_cast<OutputConnection *> (c) == 0) {
651 if (c->nports() == _route->n_outputs()) {
653 MenuList& citems = output_menu.items();
654 citems.push_back (CheckMenuElem (c->name(), bind (mem_fun(*this, &MixerStrip::connection_output_chosen), c)));
656 ARDOUR::Connection *current = _route->output_connection();
659 ignore_toggle = true;
660 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
661 ignore_toggle = false;
667 MixerStrip::update_diskstream_display ()
669 if (is_audio_track()) {
673 update_input_display ();
675 if (input_selector) {
676 input_selector->hide_all ();
685 update_input_display ();
686 show_passthru_color ();
691 MixerStrip::connect_to_pan ()
693 ENSURE_GUI_THREAD(mem_fun(*this, &MixerStrip::connect_to_pan));
695 panstate_connection.disconnect ();
696 panstyle_connection.disconnect ();
698 if (!_route->panner().empty()) {
699 StreamPanner* sp = _route->panner().front();
701 panstate_connection = sp->automation().automation_state_changed.connect (mem_fun(panners, &PannerUI::pan_automation_state_changed));
702 panstyle_connection = sp->automation().automation_style_changed.connect (mem_fun(panners, &PannerUI::pan_automation_style_changed));
705 panners.pan_changed (this);
709 MixerStrip::update_input_display ()
711 ARDOUR::Connection *c;
713 if ((c = _route->input_connection()) != 0) {
714 input_label.set_text (c->name());
718 input_label.set_text (_(" Input"));
721 input_label.set_text (_("I"));
725 panners.setup_pan ();
729 MixerStrip::update_output_display ()
731 ARDOUR::Connection *c;
733 if ((c = _route->output_connection()) != 0) {
734 output_label.set_text (c->name());
738 output_label.set_text (_("Output"));
741 output_label.set_text (_("O"));
746 panners.setup_pan ();
750 MixerStrip::fast_update ()
752 gpm.update_meters ();
756 MixerStrip::diskstream_changed ()
758 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_diskstream_display));
762 MixerStrip::input_changed (IOChange change, void *src)
764 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_input_display));
768 MixerStrip::output_changed (IOChange change, void *src)
770 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_output_display));
775 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;
976 route_ops_menu = manage (new Menu);
977 route_ops_menu->set_name ("ArdourContextMenu");
979 MenuList& items = route_ops_menu->items();
981 items.push_back (MenuElem (_("Rename"), mem_fun(*this, &RouteUI::route_rename)));
982 items.push_back (SeparatorElem());
983 items.push_back (CheckMenuElem (_("Active"), mem_fun (*this, &RouteUI::toggle_route_active)));
984 route_active_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
985 route_active_menu_item->set_active (_route->active());
986 items.push_back (SeparatorElem());
987 items.push_back (CheckMenuElem (_("Invert Polarity"), mem_fun (*this, &RouteUI::toggle_polarity)));
988 polarity_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
989 polarity_menu_item->set_active (_route->phase_invert());
991 build_remote_control_menu ();
993 items.push_back (SeparatorElem());
994 items.push_back (MenuElem (_("Remote Control ID"), *remote_control_menu));
996 items.push_back (SeparatorElem());
997 items.push_back (MenuElem (_("Remove"), mem_fun(*this, &RouteUI::remove_this_route)));
1001 MixerStrip::name_button_button_press (GdkEventButton* ev)
1003 if (ev->button == 1) {
1004 list_route_operations ();
1005 route_ops_menu->popup (1, ev->time);
1011 MixerStrip::list_route_operations ()
1013 if (route_ops_menu == 0) {
1014 build_route_ops_menu ();
1017 refresh_remote_control_menu();
1022 MixerStrip::speed_adjustment_changed ()
1024 /* since there is a usable speed adjustment, there has to be a diskstream */
1025 if (!ignore_speed_adjustment) {
1026 get_diskstream()->set_speed (speed_adjustment.get_value());
1031 MixerStrip::speed_changed ()
1033 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_speed_display));
1037 MixerStrip::update_speed_display ()
1041 val = get_diskstream()->speed();
1044 speed_spinner.set_name ("MixerStripSpeedBaseNotOne");
1046 speed_spinner.set_name ("MixerStripSpeedBase");
1049 if (speed_adjustment.get_value() != val) {
1050 ignore_speed_adjustment = true;
1051 speed_adjustment.set_value (val);
1052 ignore_speed_adjustment = false;
1058 MixerStrip::set_selected (bool yn)
1060 AxisView::set_selected (yn);
1062 global_frame.set_shadow_type (Gtk::SHADOW_ETCHED_OUT);
1063 global_frame.set_name ("MixerStripSelectedFrame");
1065 global_frame.set_shadow_type (Gtk::SHADOW_IN);
1066 global_frame.set_name ("MixerStripFrame");
1068 global_frame.queue_draw ();
1072 MixerStrip::name_changed (void *src)
1076 RouteUI::name_changed (src);
1079 name_label.set_text (PBD::short_version (_route->name(), 5));
1082 if (_route->phase_invert()) {
1083 name_label.set_text (X_("Ø ") + name_label.get_text());
1088 MixerStrip::width_clicked ()
1101 MixerStrip::hide_clicked ()
1103 // LAME fix to reset the button status for when it is redisplayed (part 1)
1104 hide_button.set_sensitive(false);
1107 Hiding(); /* EMIT_SIGNAL */
1109 _mixer.hide_strip (this);
1113 hide_button.set_sensitive(true);
1117 MixerStrip::set_embedded (bool yn)
1123 MixerStrip::map_frozen ()
1125 ENSURE_GUI_THREAD (mem_fun(*this, &MixerStrip::map_frozen));
1127 AudioTrack* at = audio_track();
1130 switch (at->freeze_state()) {
1131 case AudioTrack::Frozen:
1132 pre_redirect_box.set_sensitive (false);
1133 post_redirect_box.set_sensitive (false);
1134 speed_spinner.set_sensitive (false);
1137 pre_redirect_box.set_sensitive (true);
1138 post_redirect_box.set_sensitive (true);
1139 speed_spinner.set_sensitive (true);
1143 _route->foreach_redirect (this, &MixerStrip::hide_redirect_editor);
1147 MixerStrip::hide_redirect_editor (boost::shared_ptr<Redirect> redirect)
1149 void* gui = redirect->get_gui ();
1152 static_cast<Gtk::Widget*>(gui)->hide ();
1157 MixerStrip::route_active_changed ()
1159 RouteUI::route_active_changed ();
1161 if (is_audio_track()) {
1162 if (_route->active()) {
1163 set_name ("AudioTrackStripBase");
1164 gpm.set_meter_strip_name ("AudioTrackStripBase");
1166 set_name ("AudioTrackStripBaseInactive");
1167 gpm.set_meter_strip_name ("AudioTrackStripBaseInactive");
1169 gpm.set_fader_name ("AudioTrackFader");
1170 } else { // FIXME: assumed audio bus
1171 if (_route->active()) {
1172 set_name ("AudioBusStripBase");
1173 gpm.set_meter_strip_name ("AudioBusStripBase");
1175 set_name ("AudioBusStripBaseInactive");
1176 gpm.set_meter_strip_name ("AudioBusStripBaseInactive");
1178 gpm.set_fader_name ("AudioBusFader");
1183 MixerStrip::mix_group() const
1185 return _route->mix_group();
1189 MixerStrip::engine_stopped ()
1194 MixerStrip::engine_running ()
1199 MixerStrip::meter_changed (void *src)
1202 ENSURE_GUI_THREAD (bind (mem_fun(*this, &MixerStrip::meter_changed), src));
1204 switch (_route->meter_point()) {
1206 meter_point_label.set_text (_("input"));
1210 meter_point_label.set_text (_("pre"));
1213 case MeterPostFader:
1214 meter_point_label.set_text (_("post"));
1218 gpm.setup_meters ();