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;
393 /* backwards compatibility */
394 _marked_for_display = true;
399 MixerStrip::set_width (Width w)
401 /* always set the gpm width again, things may be hidden */
403 panners.set_width (w);
404 pre_redirect_box.set_width (w);
405 post_redirect_box.set_width (w);
417 set_size_request (-1, -1);
418 xml_node->add_property ("strip_width", "wide");
420 if (rec_enable_button) {
421 ((Gtk::Label*)rec_enable_button->get_child())->set_text (_("record"));
423 ((Gtk::Label*)mute_button->get_child())->set_text (_("Mute"));
424 ((Gtk::Label*)solo_button->get_child())->set_text (_("Solo"));
426 if (_route->comment() == "") {
427 comment_button.unset_bg (STATE_NORMAL);
428 ((Gtk::Label*)comment_button.get_child())->set_text (_("comments"));
430 comment_button.modify_bg (STATE_NORMAL, color());
431 ((Gtk::Label*)comment_button.get_child())->set_text (_("*comments*"));
434 ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (gpm.astyle_string(_route->gain_automation_curve().automation_style()));
435 ((Gtk::Label*)gpm.gain_automation_state_button.get_child())->set_text (gpm.astate_string(_route->gain_automation_curve().automation_state()));
436 ((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text (panners.astyle_string(_route->panner().automation_style()));
437 ((Gtk::Label*)panners.pan_automation_state_button.get_child())->set_text (panners.astate_string(_route->panner().automation_state()));
438 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "long", 2, 2);
442 set_size_request (50, -1);
443 xml_node->add_property ("strip_width", "narrow");
445 if (rec_enable_button) {
446 ((Gtk::Label*)rec_enable_button->get_child())->set_text (_("Rec"));
448 ((Gtk::Label*)mute_button->get_child())->set_text (_("M"));
449 ((Gtk::Label*)solo_button->get_child())->set_text (_("S"));
451 if (_route->comment() == "") {
452 comment_button.unset_bg (STATE_NORMAL);
453 ((Gtk::Label*)comment_button.get_child())->set_text (_("Cmt"));
455 comment_button.modify_bg (STATE_NORMAL, color());
456 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Cmt*"));
459 ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (gpm.short_astyle_string(_route->gain_automation_curve().automation_style()));
460 ((Gtk::Label*)gpm.gain_automation_state_button.get_child())->set_text (gpm.short_astate_string(_route->gain_automation_curve().automation_state()));
461 ((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text (panners.short_astyle_string(_route->panner().automation_style()));
462 ((Gtk::Label*)panners.pan_automation_state_button.get_child())->set_text (panners.short_astate_string(_route->panner().automation_state()));
463 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2);
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() {
775 string str = comment_area->get_buffer()->get_text();
776 if (_route->comment() != str) {
777 _route->set_comment (str, this);
783 comment_button.modify_bg (STATE_NORMAL, color());
784 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Comments*"));
786 comment_button.unset_bg (STATE_NORMAL);
787 ((Gtk::Label*)comment_button.get_child())->set_text (_("Comments"));
793 comment_button.modify_bg (STATE_NORMAL, color());
794 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Cmt*"));
796 comment_button.unset_bg (STATE_NORMAL);
797 ((Gtk::Label*)comment_button.get_child())->set_text (_("Cmt"));
802 ARDOUR_UI::instance()->tooltips().set_tip (comment_button,
803 str.empty() ? _("Click to Add/Edit Comments") : str);
809 MixerStrip::comment_button_clicked ()
811 if (comment_window == 0) {
812 setup_comment_editor ();
815 int x, y, cw_width, cw_height;
817 if (comment_window->is_visible()) {
818 comment_window->hide ();
822 comment_window->get_size (cw_width, cw_height);
823 comment_window->get_position(x, y);
824 comment_window->move(x, y - (cw_height / 2) - 45);
826 half the dialog height minus the comments button height
827 with some window decoration fudge thrown in.
830 comment_window->show();
831 comment_window->present();
835 MixerStrip::setup_comment_editor ()
838 title = _route->name();
839 title += _(": comment editor");
841 comment_window = new ArdourDialog (title, false);
842 comment_window->set_position (Gtk::WIN_POS_MOUSE);
843 comment_window->set_skip_taskbar_hint (true);
844 comment_window->signal_hide().connect (mem_fun(*this, &MixerStrip::comment_editor_done_editing));
846 comment_area = manage (new TextView());
847 comment_area->set_name ("MixerTrackCommentArea");
848 comment_area->set_size_request (110, 178);
849 comment_area->set_wrap_mode (WRAP_WORD);
850 comment_area->set_editable (true);
851 comment_area->get_buffer()->set_text (_route->comment());
852 comment_area->show ();
854 comment_window->get_vbox()->pack_start (*comment_area);
855 comment_window->get_action_area()->hide();
859 MixerStrip::comment_changed (void *src)
861 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::comment_changed), src));
864 ignore_comment_edit = true;
866 comment_area->get_buffer()->set_text (_route->comment());
868 ignore_comment_edit = false;
873 MixerStrip::set_mix_group (RouteGroup *rg)
875 _route->set_mix_group (rg, this);
879 MixerStrip::add_mix_group_to_menu (RouteGroup *rg, RadioMenuItem::Group* group)
881 using namespace Menu_Helpers;
883 MenuList& items = group_menu->items();
885 items.push_back (RadioMenuElem (*group, rg->name(), bind (mem_fun(*this, &MixerStrip::set_mix_group), rg)));
887 if (_route->mix_group() == rg) {
888 static_cast<RadioMenuItem*>(&items.back())->set_active ();
893 MixerStrip::select_mix_group (GdkEventButton *ev)
895 using namespace Menu_Helpers;
897 if (group_menu == 0) {
898 group_menu = new Menu;
900 group_menu->set_name ("ArdourContextMenu");
901 MenuList& items = group_menu->items();
902 RadioMenuItem::Group group;
904 switch (ev->button) {
908 items.push_back (RadioMenuElem (group, _("No group"), bind (mem_fun(*this, &MixerStrip::set_mix_group), (RouteGroup *) 0)));
910 _session.foreach_mix_group (bind (mem_fun (*this, &MixerStrip::add_mix_group_to_menu), &group));
912 group_menu->popup (1, ev->time);
923 MixerStrip::mix_group_changed (void *ignored)
925 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::mix_group_changed), ignored));
927 RouteGroup *rg = _route->mix_group();
930 group_label.set_text (rg->name());
934 group_label.set_text (_("Grp"));
937 group_label.set_text (_("~G"));
945 MixerStrip::route_gui_changed (string what_changed, void* ignored)
947 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::route_gui_changed), what_changed, ignored));
949 if (what_changed == "color") {
950 if (set_color_from_route () == 0) {
957 MixerStrip::show_route_color ()
959 name_button.modify_bg (STATE_NORMAL, color());
960 top_event_box.modify_bg (STATE_NORMAL, color());
961 route_active_changed ();
965 MixerStrip::show_passthru_color ()
967 route_active_changed ();
971 MixerStrip::build_route_ops_menu ()
973 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());
990 build_remote_control_menu ();
992 items.push_back (SeparatorElem());
993 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 ();
1004 route_ops_menu->popup (1, ev->time);
1010 MixerStrip::list_route_operations ()
1012 if (route_ops_menu == 0) {
1013 build_route_ops_menu ();
1016 refresh_remote_control_menu();
1021 MixerStrip::speed_adjustment_changed ()
1023 /* since there is a usable speed adjustment, there has to be a diskstream */
1024 if (!ignore_speed_adjustment) {
1025 get_diskstream()->set_speed (speed_adjustment.get_value());
1030 MixerStrip::speed_changed ()
1032 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_speed_display));
1036 MixerStrip::update_speed_display ()
1040 val = get_diskstream()->speed();
1043 speed_spinner.set_name ("MixerStripSpeedBaseNotOne");
1045 speed_spinner.set_name ("MixerStripSpeedBase");
1048 if (speed_adjustment.get_value() != val) {
1049 ignore_speed_adjustment = true;
1050 speed_adjustment.set_value (val);
1051 ignore_speed_adjustment = false;
1057 MixerStrip::set_selected (bool yn)
1059 AxisView::set_selected (yn);
1061 global_frame.set_shadow_type (Gtk::SHADOW_ETCHED_OUT);
1062 global_frame.set_name ("MixerStripSelectedFrame");
1064 global_frame.set_shadow_type (Gtk::SHADOW_IN);
1065 global_frame.set_name ("MixerStripFrame");
1067 global_frame.queue_draw ();
1071 MixerStrip::name_changed (void *src)
1075 RouteUI::name_changed (src);
1078 name_label.set_text (PBD::short_version (_route->name(), 5));
1081 if (_route->phase_invert()) {
1082 name_label.set_text (X_("Ø ") + name_label.get_text());
1087 MixerStrip::width_clicked ()
1100 MixerStrip::hide_clicked ()
1102 // LAME fix to reset the button status for when it is redisplayed (part 1)
1103 hide_button.set_sensitive(false);
1106 Hiding(); /* EMIT_SIGNAL */
1108 _mixer.hide_strip (this);
1112 hide_button.set_sensitive(true);
1116 MixerStrip::set_embedded (bool yn)
1122 MixerStrip::map_frozen ()
1124 ENSURE_GUI_THREAD (mem_fun(*this, &MixerStrip::map_frozen));
1126 AudioTrack* at = audio_track();
1129 switch (at->freeze_state()) {
1130 case AudioTrack::Frozen:
1131 pre_redirect_box.set_sensitive (false);
1132 post_redirect_box.set_sensitive (false);
1133 speed_spinner.set_sensitive (false);
1136 pre_redirect_box.set_sensitive (true);
1137 post_redirect_box.set_sensitive (true);
1138 speed_spinner.set_sensitive (true);
1142 _route->foreach_redirect (this, &MixerStrip::hide_redirect_editor);
1146 MixerStrip::hide_redirect_editor (boost::shared_ptr<Redirect> redirect)
1148 void* gui = redirect->get_gui ();
1151 static_cast<Gtk::Widget*>(gui)->hide ();
1156 MixerStrip::route_active_changed ()
1158 RouteUI::route_active_changed ();
1160 if (is_audio_track()) {
1161 if (_route->active()) {
1162 set_name ("AudioTrackStripBase");
1163 gpm.set_meter_strip_name ("AudioTrackStripBase");
1165 set_name ("AudioTrackStripBaseInactive");
1166 gpm.set_meter_strip_name ("AudioTrackStripBaseInactive");
1168 gpm.set_fader_name ("AudioTrackFader");
1169 } else { // FIXME: assumed audio bus
1170 if (_route->active()) {
1171 set_name ("AudioBusStripBase");
1172 gpm.set_meter_strip_name ("AudioBusStripBase");
1174 set_name ("AudioBusStripBaseInactive");
1175 gpm.set_meter_strip_name ("AudioBusStripBaseInactive");
1177 gpm.set_fader_name ("AudioBusFader");
1182 MixerStrip::mix_group() const
1184 return _route->mix_group();
1188 MixerStrip::engine_stopped ()
1193 MixerStrip::engine_running ()
1198 MixerStrip::meter_changed (void *src)
1201 ENSURE_GUI_THREAD (bind (mem_fun(*this, &MixerStrip::meter_changed), src));
1203 switch (_route->meter_point()) {
1205 meter_point_label.set_text (_("input"));
1209 meter_point_label.set_text (_("pre"));
1212 case MeterPostFader:
1213 meter_point_label.set_text (_("post"));
1217 gpm.setup_meters ();