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>
27 #include <gtkmm2ext/gtk_ui.h>
28 #include <gtkmm2ext/utils.h>
29 #include <gtkmm2ext/choice.h>
30 #include <gtkmm2ext/stop_signal.h>
31 #include <gtkmm2ext/doi.h>
32 #include <gtkmm2ext/slider_controller.h>
33 #include <gtkmm2ext/bindable_button.h>
35 #include <ardour/ardour.h>
36 #include <ardour/session.h>
37 #include <ardour/audioengine.h>
38 #include <ardour/route.h>
39 #include <ardour/audio_track.h>
40 #include <ardour/audio_diskstream.h>
41 #include <ardour/panner.h>
42 #include <ardour/send.h>
43 #include <ardour/insert.h>
44 #include <ardour/ladspa_plugin.h>
45 #include <ardour/connection.h>
46 #include <ardour/session_connection.h>
48 #include "ardour_ui.h"
49 #include "ardour_dialog.h"
50 #include "mixer_strip.h"
53 #include "public_editor.h"
55 #include "io_selector.h"
57 #include "gui_thread.h"
62 using namespace ARDOUR;
65 using namespace Gtkmm2ext;
68 int MixerStrip::scrollbar_height = 0;
70 #ifdef VARISPEED_IN_MIXER_STRIP
72 speed_printer (char buf[32], Gtk::Adjustment& adj, void* arg)
74 float val = adj.get_value ();
79 snprintf (buf, 32, "%.3f", val);
84 MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, boost::shared_ptr<Route> rt, bool in_mixer)
86 RouteUI (rt, sess, _("Mute"), _("Solo"), _("Record")),
88 pre_redirect_box (PreFader, sess, rt, mx.plugin_selector(), mx.selection(), in_mixer),
89 post_redirect_box (PostFader, sess, rt, mx.plugin_selector(), mx.selection(), in_mixer),
91 panners (_route, sess),
93 middle_button_table (1, 2),
94 bottom_button_table (1, 2),
95 meter_point_label (_("pre")),
96 comment_button (_("Comments")),
97 speed_adjustment (1.0, 0.001, 4.0, 0.001, 0.1),
98 speed_spinner (&speed_adjustment, "MixerStripSpeedBase", true)
101 if (set_color_from_route()) {
102 set_color (unique_random_color());
108 _marked_for_display = false;
110 ignore_comment_edit = false;
111 ignore_toggle = false;
112 ignore_speed_adjustment = false;
116 width_button.add (*(manage (new Gtk::Image (::get_icon("strip_width")))));
117 hide_button.add (*(manage (new Gtk::Image (::get_icon("hide")))));
119 input_label.set_text (_("Input"));
120 input_button.add (input_label);
121 input_button.set_name ("MixerIOButton");
122 input_label.set_name ("MixerIOButtonLabel");
124 output_label.set_text (_("Output"));
125 output_button.add (output_label);
126 output_button.set_name ("MixerIOButton");
127 output_label.set_name ("MixerIOButtonLabel");
129 _route->meter_change.connect (mem_fun(*this, &MixerStrip::meter_changed));
130 meter_point_button.add (meter_point_label);
131 meter_point_button.set_name ("MixerStripMeterPreButton");
132 meter_point_label.set_name ("MixerStripMeterPreButton");
134 switch (_route->meter_point()) {
136 meter_point_label.set_text (_("input"));
140 meter_point_label.set_text (_("pre"));
144 meter_point_label.set_text (_("post"));
148 /* TRANSLATORS: this string should be longest of the strings
149 used to describe meter points. In english, it's "input".
151 set_size_request_to_display_given_text (meter_point_button, _("tupni"), 5, 5);
153 bottom_button_table.attach (meter_point_button, 1, 2, 0, 1);
155 meter_point_button.signal_button_press_event().connect (mem_fun (gpm, &GainMeter::meter_press), false);
156 /* XXX what is this meant to do? */
157 //meter_point_button.signal_button_release_event().connect (mem_fun (gpm, &GainMeter::meter_release), false);
159 hide_button.set_events (hide_button.get_events() & ~(Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK));
161 mute_button->set_name ("MixerMuteButton");
162 solo_button->set_name ("MixerSoloButton");
164 button_table.set_homogeneous (true);
165 button_table.set_spacings (0);
167 button_table.attach (name_button, 0, 2, 0, 1);
168 button_table.attach (input_button, 0, 2, 1, 2);
170 middle_button_table.set_homogeneous (true);
171 middle_button_table.set_spacings (0);
172 middle_button_table.attach (*mute_button, 0, 1, 0, 1);
173 middle_button_table.attach (*solo_button, 1, 2, 0, 1);
175 bottom_button_table.set_col_spacings (0);
176 bottom_button_table.set_homogeneous (true);
177 bottom_button_table.attach (group_button, 0, 1, 0, 1);
179 if (is_audio_track()) {
181 rec_enable_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::rec_enable_press), false);
182 rec_enable_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::rec_enable_release));
184 rec_enable_button->set_name ("MixerRecordEnableButton");
186 AudioTrack* at = audio_track();
188 at->FreezeChange.connect (mem_fun(*this, &MixerStrip::map_frozen));
190 #ifdef VARISPEED_IN_MIXER_STRIP
191 speed_adjustment.signal_value_changed().connect (mem_fun(*this, &MixerStrip::speed_adjustment_changed));
193 speed_frame.set_name ("BaseFrame");
194 speed_frame.set_shadow_type (Gtk::SHADOW_IN);
195 speed_frame.add (speed_spinner);
197 speed_spinner.set_print_func (speed_printer, 0);
199 ARDOUR_UI::instance()->tooltips().set_tip (speed_spinner, _("Varispeed"));
201 button_table.attach (speed_frame, 0, 2, 5, 6);
202 #endif /* VARISPEED_IN_MIXER_STRIP */
204 button_table.attach (*rec_enable_button, 0, 2, 2, 3);
207 name_button.add (name_label);
208 name_button.set_name ("MixerNameButton");
209 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2);
211 name_label.set_name ("MixerNameButtonLabel");
212 if (_route->phase_invert()) {
213 name_label.set_text (X_("Ø ") + name_label.get_text());
215 name_label.set_text (_route->name());
218 group_button.add (group_label);
219 group_button.set_name ("MixerGroupButton");
220 group_label.set_name ("MixerGroupButtonLabel");
222 comment_button.set_name ("MixerCommentButton");
224 ARDOUR_UI::instance()->tooltips().set_tip (comment_button, _route->comment()=="" ?
225 _("Click to Add/Edit Comments"):
228 comment_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::comment_button_clicked));
230 global_vpacker.set_border_width (0);
231 global_vpacker.set_spacing (0);
233 VBox *whvbox = manage (new VBox);
235 width_button.set_name ("MixerWidthButton");
236 hide_button.set_name ("MixerHideButton");
237 top_event_box.set_name ("MixerTopEventBox");
239 width_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::width_clicked));
240 hide_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::hide_clicked));
242 width_hide_box.pack_start (width_button, false, true);
243 width_hide_box.pack_start (top_event_box, true, true);
244 width_hide_box.pack_end (hide_button, false, true);
245 Gtk::Alignment *gain_meter_alignment = Gtk::manage(new Gtk::Alignment());
246 gain_meter_alignment->set_padding(0, 4, 0, 0);
247 gain_meter_alignment->add(gpm);
249 whvbox->pack_start (width_hide_box, true, true);
251 global_vpacker.pack_start (*whvbox, Gtk::PACK_SHRINK);
252 global_vpacker.pack_start (button_table,Gtk::PACK_SHRINK);
253 global_vpacker.pack_start (pre_redirect_box, true, true);
254 global_vpacker.pack_start (middle_button_table,Gtk::PACK_SHRINK);
255 global_vpacker.pack_start (*gain_meter_alignment,Gtk::PACK_SHRINK);
256 global_vpacker.pack_start (bottom_button_table,Gtk::PACK_SHRINK);
257 global_vpacker.pack_start (post_redirect_box, true, true);
258 global_vpacker.pack_start (panners, Gtk::PACK_SHRINK);
259 global_vpacker.pack_start (output_button, Gtk::PACK_SHRINK);
260 global_vpacker.pack_start (comment_button, Gtk::PACK_SHRINK);
262 if (route()->master() || route()->control()) {
264 if (scrollbar_height == 0) {
265 HScrollbar scrollbar;
266 Gtk::Requisition requisition(scrollbar.size_request ());
267 scrollbar_height = requisition.height;
270 EventBox* spacer = manage (new EventBox);
271 spacer->set_size_request (-1, scrollbar_height);
272 global_vpacker.pack_start (*spacer, false, false);
275 global_frame.add (global_vpacker);
276 global_frame.set_shadow_type (Gtk::SHADOW_IN);
277 global_frame.set_name ("BaseFrame");
281 /* force setting of visible selected status */
284 set_selected (false);
289 _session.engine().Stopped.connect (mem_fun(*this, &MixerStrip::engine_stopped));
290 _session.engine().Running.connect (mem_fun(*this, &MixerStrip::engine_running));
291 _route->input_changed.connect (mem_fun(*this, &MixerStrip::input_changed));
292 _route->output_changed.connect (mem_fun(*this, &MixerStrip::output_changed));
293 _route->mute_changed.connect (mem_fun(*this, &RouteUI::mute_changed));
294 _route->solo_changed.connect (mem_fun(*this, &RouteUI::solo_changed));
295 _route->solo_safe_changed.connect (mem_fun(*this, &RouteUI::solo_changed));
296 _route->mix_group_changed.connect (mem_fun(*this, &MixerStrip::mix_group_changed));
297 _route->panner().Changed.connect (mem_fun(*this, &MixerStrip::connect_to_pan));
299 if (is_audio_track()) {
300 audio_track()->DiskstreamChanged.connect (mem_fun(*this, &MixerStrip::diskstream_changed));
301 get_diskstream()->SpeedChanged.connect (mem_fun(*this, &MixerStrip::speed_changed));
304 _route->name_changed.connect (mem_fun(*this, &RouteUI::name_changed));
305 _route->comment_changed.connect (mem_fun(*this, &MixerStrip::comment_changed));
306 _route->gui_changed.connect (mem_fun(*this, &MixerStrip::route_gui_changed));
308 input_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::input_press), false);
309 output_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::output_press), false);
311 solo_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::solo_press), false);
312 solo_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::solo_release), false);
313 mute_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::mute_press), false);
314 mute_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::mute_release), false);
316 name_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::name_button_button_press), false);
317 group_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::select_mix_group), false);
320 set_stuff_from_route ();
322 /* start off as a passthru strip. we'll correct this, if necessary,
323 in update_diskstream_display().
326 set_name ("AudioTrackStripBase");
328 /* now force an update of all the various elements */
330 pre_redirect_box.update();
331 post_redirect_box.update();
336 mix_group_changed (0);
340 panners.setup_pan ();
342 if (is_audio_track()) {
346 update_diskstream_display ();
347 update_input_display ();
348 update_output_display ();
350 add_events (Gdk::BUTTON_RELEASE_MASK);
353 MixerStrip::~MixerStrip ()
355 GoingAway(); /* EMIT_SIGNAL */
357 if (input_selector) {
358 delete input_selector;
361 if (output_selector) {
362 delete output_selector;
367 MixerStrip::set_stuff_from_route ()
373 if ((prop = xml_node->property ("strip_width")) != 0) {
374 if (prop->value() == "wide") {
376 } else if (prop->value() == "narrow") {
380 error << string_compose(_("unknown strip width \"%1\" in XML GUI information"), prop->value()) << endmsg;
388 if ((prop = xml_node->property ("shown_mixer")) != 0) {
389 if (prop->value() == "no") {
390 _marked_for_display = false;
392 _marked_for_display = true;
395 /* backwards compatibility */
396 _marked_for_display = true;
401 MixerStrip::set_width (Width w)
403 /* always set the gpm width again, things may be hidden */
405 panners.set_width (w);
406 pre_redirect_box.set_width (w);
407 post_redirect_box.set_width (w);
419 set_size_request (-1, -1);
420 xml_node->add_property ("strip_width", "wide");
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 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);
465 set_size_request (max (50, gpm.get_gm_width()), -1);
469 update_input_display ();
470 update_output_display ();
471 mix_group_changed (0);
477 MixerStrip::set_packed (bool yn)
484 xml_node->add_property ("shown_mixer", "yes");
486 xml_node->add_property ("shown_mixer", "no");
492 MixerStrip::output_press (GdkEventButton *ev)
494 using namespace Menu_Helpers;
495 if (!_session.engine().connected()) {
496 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
501 MenuList& citems = output_menu.items();
502 switch (ev->button) {
505 output_menu.set_name ("ArdourContextMenu");
508 citems.push_back (MenuElem (_("Edit"), mem_fun(*this, &MixerStrip::edit_output_configuration)));
509 citems.push_back (SeparatorElem());
510 citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_output)));
511 citems.push_back (SeparatorElem());
513 _session.foreach_connection (this, &MixerStrip::add_connection_to_output_menu);
515 output_menu.popup (1, ev->time);
525 MixerStrip::edit_output_configuration ()
527 if (output_selector == 0) {
528 output_selector = new IOSelectorWindow (_session, _route, false);
531 if (output_selector->is_visible()) {
532 output_selector->get_toplevel()->get_window()->raise();
534 output_selector->show_all ();
539 MixerStrip::edit_input_configuration ()
541 if (input_selector == 0) {
542 input_selector = new IOSelectorWindow (_session, _route, true);
545 if (input_selector->is_visible()) {
546 input_selector->get_toplevel()->get_window()->raise();
548 input_selector->show_all ();
553 MixerStrip::input_press (GdkEventButton *ev)
555 using namespace Menu_Helpers;
557 MenuList& citems = input_menu.items();
558 input_menu.set_name ("ArdourContextMenu");
561 if (!_session.engine().connected()) {
562 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
567 switch (ev->button) {
570 citems.push_back (MenuElem (_("Edit"), mem_fun(*this, &MixerStrip::edit_input_configuration)));
571 citems.push_back (SeparatorElem());
572 citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_input)));
573 citems.push_back (SeparatorElem());
575 _session.foreach_connection (this, &MixerStrip::add_connection_to_input_menu);
577 input_menu.popup (1, ev->time);
587 MixerStrip::connection_input_chosen (ARDOUR::Connection *c)
589 if (!ignore_toggle) {
592 _route->use_input_connection (*c, this);
595 catch (AudioEngine::PortRegistrationFailure& err) {
596 error << _("could not register new ports required for that connection")
603 MixerStrip::connection_output_chosen (ARDOUR::Connection *c)
605 if (!ignore_toggle) {
608 _route->use_output_connection (*c, this);
611 catch (AudioEngine::PortRegistrationFailure& err) {
612 error << _("could not register new ports required for that connection")
619 MixerStrip::add_connection_to_input_menu (ARDOUR::Connection* c)
621 using namespace Menu_Helpers;
623 if (dynamic_cast<InputConnection *> (c) == 0) {
627 MenuList& citems = input_menu.items();
629 if (c->nports() == _route->n_inputs()) {
631 citems.push_back (CheckMenuElem (c->name(), bind (mem_fun(*this, &MixerStrip::connection_input_chosen), c)));
633 ARDOUR::Connection *current = _route->input_connection();
636 ignore_toggle = true;
637 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
638 ignore_toggle = false;
644 MixerStrip::add_connection_to_output_menu (ARDOUR::Connection* c)
646 using namespace Menu_Helpers;
648 if (dynamic_cast<OutputConnection *> (c) == 0) {
652 if (c->nports() == _route->n_outputs()) {
654 MenuList& citems = output_menu.items();
655 citems.push_back (CheckMenuElem (c->name(), bind (mem_fun(*this, &MixerStrip::connection_output_chosen), c)));
657 ARDOUR::Connection *current = _route->output_connection();
660 ignore_toggle = true;
661 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
662 ignore_toggle = false;
668 MixerStrip::update_diskstream_display ()
670 if (is_audio_track()) {
674 update_input_display ();
676 if (input_selector) {
677 input_selector->hide_all ();
686 update_input_display ();
687 show_passthru_color ();
692 MixerStrip::connect_to_pan ()
694 ENSURE_GUI_THREAD(mem_fun(*this, &MixerStrip::connect_to_pan));
696 panstate_connection.disconnect ();
697 panstyle_connection.disconnect ();
699 if (!_route->panner().empty()) {
700 StreamPanner* sp = _route->panner().front();
702 panstate_connection = sp->automation().automation_state_changed.connect (mem_fun(panners, &PannerUI::pan_automation_state_changed));
703 panstyle_connection = sp->automation().automation_style_changed.connect (mem_fun(panners, &PannerUI::pan_automation_style_changed));
706 panners.pan_changed (this);
710 MixerStrip::update_input_display ()
712 ARDOUR::Connection *c;
714 if ((c = _route->input_connection()) != 0) {
715 input_label.set_text (c->name());
719 input_label.set_text (_(" Input"));
722 input_label.set_text (_("I"));
726 panners.setup_pan ();
730 MixerStrip::update_output_display ()
732 ARDOUR::Connection *c;
734 if ((c = _route->output_connection()) != 0) {
735 output_label.set_text (c->name());
739 output_label.set_text (_("Output"));
742 output_label.set_text (_("O"));
747 panners.setup_pan ();
751 MixerStrip::fast_update ()
753 gpm.update_meters ();
757 MixerStrip::diskstream_changed ()
759 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_diskstream_display));
763 MixerStrip::input_changed (IOChange change, void *src)
765 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_input_display));
769 MixerStrip::output_changed (IOChange change, void *src)
771 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_output_display));
776 MixerStrip::comment_editor_done_editing()
778 string str = comment_area->get_buffer()->get_text();
779 if (_route->comment() != str) {
780 _route->set_comment (str, this);
786 comment_button.modify_bg (STATE_NORMAL, color());
787 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Comments*"));
789 comment_button.unset_bg (STATE_NORMAL);
790 ((Gtk::Label*)comment_button.get_child())->set_text (_("Comments"));
796 comment_button.modify_bg (STATE_NORMAL, color());
797 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Cmt*"));
799 comment_button.unset_bg (STATE_NORMAL);
800 ((Gtk::Label*)comment_button.get_child())->set_text (_("Cmt"));
805 ARDOUR_UI::instance()->tooltips().set_tip (comment_button,
806 str.empty() ? _("Click to Add/Edit Comments") : str);
812 MixerStrip::comment_button_clicked ()
814 if (comment_window == 0) {
815 setup_comment_editor ();
818 int x, y, cw_width, cw_height;
820 if (comment_window->is_visible()) {
821 comment_window->hide ();
825 comment_window->get_size (cw_width, cw_height);
826 comment_window->get_position(x, y);
827 comment_window->move(x, y - (cw_height / 2) - 45);
829 half the dialog height minus the comments button height
830 with some window decoration fudge thrown in.
833 comment_window->show();
834 comment_window->present();
838 MixerStrip::setup_comment_editor ()
841 title = _route->name();
842 title += _(": comment editor");
844 comment_window = new ArdourDialog (title, false);
845 comment_window->set_position (Gtk::WIN_POS_MOUSE);
846 comment_window->set_skip_taskbar_hint (true);
847 comment_window->signal_hide().connect (mem_fun(*this, &MixerStrip::comment_editor_done_editing));
849 comment_area = manage (new TextView());
850 comment_area->set_name ("MixerTrackCommentArea");
851 comment_area->set_size_request (110, 178);
852 comment_area->set_wrap_mode (WRAP_WORD);
853 comment_area->set_editable (true);
854 comment_area->get_buffer()->set_text (_route->comment());
855 comment_area->show ();
857 comment_window->get_vbox()->pack_start (*comment_area);
858 comment_window->get_action_area()->hide();
862 MixerStrip::comment_changed (void *src)
864 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::comment_changed), src));
867 ignore_comment_edit = true;
869 comment_area->get_buffer()->set_text (_route->comment());
871 ignore_comment_edit = false;
876 MixerStrip::set_mix_group (RouteGroup *rg)
878 _route->set_mix_group (rg, this);
882 MixerStrip::add_mix_group_to_menu (RouteGroup *rg, RadioMenuItem::Group* group)
884 using namespace Menu_Helpers;
886 MenuList& items = group_menu->items();
888 items.push_back (RadioMenuElem (*group, rg->name(), bind (mem_fun(*this, &MixerStrip::set_mix_group), rg)));
890 if (_route->mix_group() == rg) {
891 static_cast<RadioMenuItem*>(&items.back())->set_active ();
896 MixerStrip::select_mix_group (GdkEventButton *ev)
898 using namespace Menu_Helpers;
900 if (group_menu == 0) {
901 group_menu = new Menu;
903 group_menu->set_name ("ArdourContextMenu");
904 MenuList& items = group_menu->items();
905 RadioMenuItem::Group group;
907 switch (ev->button) {
911 items.push_back (RadioMenuElem (group, _("No group"), bind (mem_fun(*this, &MixerStrip::set_mix_group), (RouteGroup *) 0)));
913 _session.foreach_mix_group (bind (mem_fun (*this, &MixerStrip::add_mix_group_to_menu), &group));
915 group_menu->popup (1, ev->time);
926 MixerStrip::mix_group_changed (void *ignored)
928 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::mix_group_changed), ignored));
930 RouteGroup *rg = _route->mix_group();
933 group_label.set_text (rg->name());
937 group_label.set_text (_("Grp"));
940 group_label.set_text (_("~G"));
948 MixerStrip::route_gui_changed (string what_changed, void* ignored)
950 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::route_gui_changed), what_changed, ignored));
952 if (what_changed == "color") {
953 if (set_color_from_route () == 0) {
960 MixerStrip::show_route_color ()
962 name_button.modify_bg (STATE_NORMAL, color());
963 top_event_box.modify_bg (STATE_NORMAL, color());
964 route_active_changed ();
968 MixerStrip::show_passthru_color ()
970 route_active_changed ();
974 MixerStrip::build_route_ops_menu ()
976 using namespace Menu_Helpers;
977 route_ops_menu = manage (new Menu);
978 route_ops_menu->set_name ("ArdourContextMenu");
980 MenuList& items = route_ops_menu->items();
982 items.push_back (MenuElem (_("Rename"), mem_fun(*this, &RouteUI::route_rename)));
983 items.push_back (SeparatorElem());
984 items.push_back (CheckMenuElem (_("Active"), mem_fun (*this, &RouteUI::toggle_route_active)));
985 route_active_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
986 route_active_menu_item->set_active (_route->active());
987 items.push_back (SeparatorElem());
988 items.push_back (CheckMenuElem (_("Invert Polarity"), mem_fun (*this, &RouteUI::toggle_polarity)));
989 polarity_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
990 polarity_menu_item->set_active (_route->phase_invert());
992 build_remote_control_menu ();
994 items.push_back (SeparatorElem());
995 items.push_back (MenuElem (_("Remote Control ID"), *remote_control_menu));
997 items.push_back (SeparatorElem());
998 items.push_back (MenuElem (_("Remove"), mem_fun(*this, &RouteUI::remove_this_route)));
1002 MixerStrip::name_button_button_press (GdkEventButton* ev)
1004 if (ev->button == 1) {
1005 list_route_operations ();
1007 Menu_Helpers::MenuList& items = route_ops_menu->items();
1008 /* do not allow rename if the track is record-enabled */
1009 static_cast<MenuItem*> (&items.front())->set_sensitive (!_route->record_enabled());
1011 route_ops_menu->popup (1, ev->time);
1017 MixerStrip::list_route_operations ()
1019 if (route_ops_menu == 0) {
1020 build_route_ops_menu ();
1023 refresh_remote_control_menu();
1028 MixerStrip::speed_adjustment_changed ()
1030 /* since there is a usable speed adjustment, there has to be a diskstream */
1031 if (!ignore_speed_adjustment) {
1032 get_diskstream()->set_speed (speed_adjustment.get_value());
1037 MixerStrip::speed_changed ()
1039 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_speed_display));
1043 MixerStrip::update_speed_display ()
1047 val = get_diskstream()->speed();
1050 speed_spinner.set_name ("MixerStripSpeedBaseNotOne");
1052 speed_spinner.set_name ("MixerStripSpeedBase");
1055 if (speed_adjustment.get_value() != val) {
1056 ignore_speed_adjustment = true;
1057 speed_adjustment.set_value (val);
1058 ignore_speed_adjustment = false;
1064 MixerStrip::set_selected (bool yn)
1066 AxisView::set_selected (yn);
1068 global_frame.set_shadow_type (Gtk::SHADOW_ETCHED_OUT);
1069 global_frame.set_name ("MixerStripSelectedFrame");
1071 global_frame.set_shadow_type (Gtk::SHADOW_IN);
1072 global_frame.set_name ("MixerStripFrame");
1074 global_frame.queue_draw ();
1078 MixerStrip::name_changed (void *src)
1082 RouteUI::name_changed (src);
1085 name_label.set_text (PBD::short_version (_route->name(), 5));
1088 if (_route->phase_invert()) {
1089 name_label.set_text (X_("Ø ") + name_label.get_text());
1094 MixerStrip::width_clicked ()
1107 MixerStrip::hide_clicked ()
1109 // LAME fix to reset the button status for when it is redisplayed (part 1)
1110 hide_button.set_sensitive(false);
1113 Hiding(); /* EMIT_SIGNAL */
1115 _mixer.hide_strip (this);
1119 hide_button.set_sensitive(true);
1123 MixerStrip::set_embedded (bool yn)
1129 MixerStrip::map_frozen ()
1131 ENSURE_GUI_THREAD (mem_fun(*this, &MixerStrip::map_frozen));
1133 AudioTrack* at = audio_track();
1136 switch (at->freeze_state()) {
1137 case AudioTrack::Frozen:
1138 pre_redirect_box.set_sensitive (false);
1139 post_redirect_box.set_sensitive (false);
1140 speed_spinner.set_sensitive (false);
1143 pre_redirect_box.set_sensitive (true);
1144 post_redirect_box.set_sensitive (true);
1145 speed_spinner.set_sensitive (true);
1149 _route->foreach_redirect (this, &MixerStrip::hide_redirect_editor);
1153 MixerStrip::hide_redirect_editor (boost::shared_ptr<Redirect> redirect)
1155 void* gui = redirect->get_gui ();
1158 static_cast<Gtk::Widget*>(gui)->hide ();
1163 MixerStrip::route_active_changed ()
1165 RouteUI::route_active_changed ();
1167 if (is_audio_track()) {
1168 if (_route->active()) {
1169 set_name ("AudioTrackStripBase");
1170 gpm.set_meter_strip_name ("AudioTrackStripBase");
1172 set_name ("AudioTrackStripBaseInactive");
1173 gpm.set_meter_strip_name ("AudioTrackStripBaseInactive");
1175 gpm.set_fader_name ("AudioTrackFader");
1176 } else { // FIXME: assumed audio bus
1177 if (_route->active()) {
1178 set_name ("AudioBusStripBase");
1179 gpm.set_meter_strip_name ("AudioBusStripBase");
1181 set_name ("AudioBusStripBaseInactive");
1182 gpm.set_meter_strip_name ("AudioBusStripBaseInactive");
1184 gpm.set_fader_name ("AudioBusFader");
1189 MixerStrip::mix_group() const
1191 return _route->mix_group();
1195 MixerStrip::engine_stopped ()
1200 MixerStrip::engine_running ()
1205 MixerStrip::meter_changed (void *src)
1208 ENSURE_GUI_THREAD (bind (mem_fun(*this, &MixerStrip::meter_changed), src));
1210 switch (_route->meter_point()) {
1212 meter_point_label.set_text (_("input"));
1216 meter_point_label.set_text (_("pre"));
1219 case MeterPostFader:
1220 meter_point_label.set_text (_("post"));
1224 gpm.setup_meters ();