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/ladspa_plugin.h>
46 #include <ardour/connection.h>
47 #include <ardour/session_connection.h>
49 #include "ardour_ui.h"
50 #include "ardour_dialog.h"
51 #include "mixer_strip.h"
54 #include "public_editor.h"
56 #include "io_selector.h"
58 #include "gui_thread.h"
63 using namespace ARDOUR;
66 using namespace Gtkmm2ext;
69 int MixerStrip::scrollbar_height = 0;
71 #ifdef VARISPEED_IN_MIXER_STRIP
73 speed_printer (char buf[32], Gtk::Adjustment& adj, void* arg)
75 float val = adj.get_value ();
80 snprintf (buf, 32, "%.3f", val);
85 MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, boost::shared_ptr<Route> rt, bool in_mixer)
87 RouteUI (rt, sess, _("Mute"), _("Solo"), _("Record")),
89 pre_redirect_box (PreFader, sess, rt, mx.plugin_selector(), mx.selection(), in_mixer),
90 post_redirect_box (PostFader, sess, rt, mx.plugin_selector(), mx.selection(), in_mixer),
92 panners (_route, sess),
94 middle_button_table (1, 2),
95 bottom_button_table (1, 2),
96 meter_point_label (_("pre")),
97 comment_button (_("Comments")),
98 speed_adjustment (1.0, 0.001, 4.0, 0.001, 0.1),
99 speed_spinner (&speed_adjustment, "MixerStripSpeedBase", true)
102 if (set_color_from_route()) {
103 set_color (unique_random_color());
109 _marked_for_display = false;
111 ignore_comment_edit = false;
112 ignore_toggle = false;
113 ignore_speed_adjustment = false;
118 width_button.add (*(manage (new Gtk::Image (::get_icon("strip_width")))));
119 hide_button.add (*(manage (new Gtk::Image (::get_icon("hide")))));
121 input_label.set_text (_("Input"));
122 input_button.add (input_label);
123 input_button.set_name ("MixerIOButton");
124 input_label.set_name ("MixerIOButtonLabel");
126 output_label.set_text (_("Output"));
127 output_button.add (output_label);
128 output_button.set_name ("MixerIOButton");
129 output_label.set_name ("MixerIOButtonLabel");
131 _route->meter_change.connect (mem_fun(*this, &MixerStrip::meter_changed));
132 meter_point_button.add (meter_point_label);
133 meter_point_button.set_name ("MixerStripMeterPreButton");
134 meter_point_label.set_name ("MixerStripMeterPreButton");
136 switch (_route->meter_point()) {
138 meter_point_label.set_text (_("input"));
142 meter_point_label.set_text (_("pre"));
146 meter_point_label.set_text (_("post"));
150 /* TRANSLATORS: this string should be longest of the strings
151 used to describe meter points. In english, it's "input".
153 set_size_request_to_display_given_text (meter_point_button, _("tupni"), 5, 5);
155 bottom_button_table.attach (meter_point_button, 1, 2, 0, 1);
157 meter_point_button.signal_button_press_event().connect (mem_fun (gpm, &GainMeter::meter_press), false);
158 /* XXX what is this meant to do? */
159 //meter_point_button.signal_button_release_event().connect (mem_fun (gpm, &GainMeter::meter_release), false);
161 hide_button.set_events (hide_button.get_events() & ~(Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK));
163 mute_button->set_name ("MixerMuteButton");
164 solo_button->set_name ("MixerSoloButton");
166 button_table.set_homogeneous (true);
167 button_table.set_spacings (0);
169 button_table.attach (name_button, 0, 2, 0, 1);
170 button_table.attach (input_button, 0, 2, 1, 2);
172 middle_button_table.set_homogeneous (true);
173 middle_button_table.set_spacings (0);
174 middle_button_table.attach (*mute_button, 0, 1, 0, 1);
175 middle_button_table.attach (*solo_button, 1, 2, 0, 1);
177 bottom_button_table.set_col_spacings (0);
178 bottom_button_table.set_homogeneous (true);
179 bottom_button_table.attach (group_button, 0, 1, 0, 1);
181 if (is_audio_track()) {
183 rec_enable_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::rec_enable_press), false);
184 rec_enable_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::rec_enable_release));
186 rec_enable_button->set_name ("MixerRecordEnableButton");
188 boost::shared_ptr<AudioTrack> at = audio_track();
190 at->FreezeChange.connect (mem_fun(*this, &MixerStrip::map_frozen));
192 #ifdef VARISPEED_IN_MIXER_STRIP
193 speed_adjustment.signal_value_changed().connect (mem_fun(*this, &MixerStrip::speed_adjustment_changed));
195 speed_frame.set_name ("BaseFrame");
196 speed_frame.set_shadow_type (Gtk::SHADOW_IN);
197 speed_frame.add (speed_spinner);
199 speed_spinner.set_print_func (speed_printer, 0);
201 ARDOUR_UI::instance()->tooltips().set_tip (speed_spinner, _("Varispeed"));
203 button_table.attach (speed_frame, 0, 2, 5, 6);
204 #endif /* VARISPEED_IN_MIXER_STRIP */
206 button_table.attach (*rec_enable_button, 0, 2, 2, 3);
209 name_button.add (name_label);
210 name_button.set_name ("MixerNameButton");
211 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2);
213 name_label.set_name ("MixerNameButtonLabel");
214 if (_route->phase_invert()) {
215 name_label.set_text (X_("Ø ") + name_label.get_text());
217 name_label.set_text (_route->name());
220 group_button.add (group_label);
221 group_button.set_name ("MixerGroupButton");
222 group_label.set_name ("MixerGroupButtonLabel");
224 comment_button.set_name ("MixerCommentButton");
226 ARDOUR_UI::instance()->tooltips().set_tip (comment_button, _route->comment()=="" ?
227 _("Click to Add/Edit Comments"):
230 comment_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::comment_button_clicked));
232 global_vpacker.set_border_width (0);
233 global_vpacker.set_spacing (0);
235 VBox *whvbox = manage (new VBox);
237 width_button.set_name ("MixerWidthButton");
238 hide_button.set_name ("MixerHideButton");
239 top_event_box.set_name ("MixerTopEventBox");
241 width_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::width_clicked));
242 hide_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::hide_clicked));
244 width_hide_box.pack_start (width_button, false, true);
245 width_hide_box.pack_start (top_event_box, true, true);
246 width_hide_box.pack_end (hide_button, false, true);
247 Gtk::Alignment *gain_meter_alignment = Gtk::manage(new Gtk::Alignment());
248 gain_meter_alignment->set_padding(0, 4, 0, 0);
249 gain_meter_alignment->add(gpm);
251 whvbox->pack_start (width_hide_box, true, true);
253 global_vpacker.pack_start (*whvbox, Gtk::PACK_SHRINK);
254 global_vpacker.pack_start (button_table,Gtk::PACK_SHRINK);
255 global_vpacker.pack_start (pre_redirect_box, true, true);
256 global_vpacker.pack_start (middle_button_table,Gtk::PACK_SHRINK);
257 global_vpacker.pack_start (*gain_meter_alignment,Gtk::PACK_SHRINK);
258 global_vpacker.pack_start (bottom_button_table,Gtk::PACK_SHRINK);
259 global_vpacker.pack_start (post_redirect_box, true, true);
260 global_vpacker.pack_start (panners, Gtk::PACK_SHRINK);
261 global_vpacker.pack_start (output_button, Gtk::PACK_SHRINK);
262 global_vpacker.pack_start (comment_button, Gtk::PACK_SHRINK);
264 if (route()->master() || route()->control()) {
266 if (scrollbar_height == 0) {
267 HScrollbar scrollbar;
268 Gtk::Requisition requisition(scrollbar.size_request ());
269 scrollbar_height = requisition.height;
272 EventBox* spacer = manage (new EventBox);
273 spacer->set_size_request (-1, scrollbar_height);
274 global_vpacker.pack_start (*spacer, false, false);
277 global_frame.add (global_vpacker);
278 global_frame.set_shadow_type (Gtk::SHADOW_IN);
279 global_frame.set_name ("BaseFrame");
283 /* force setting of visible selected status */
286 set_selected (false);
291 _session.engine().Stopped.connect (mem_fun(*this, &MixerStrip::engine_stopped));
292 _session.engine().Running.connect (mem_fun(*this, &MixerStrip::engine_running));
293 _route->input_changed.connect (mem_fun(*this, &MixerStrip::input_changed));
294 _route->output_changed.connect (mem_fun(*this, &MixerStrip::output_changed));
295 _route->mute_changed.connect (mem_fun(*this, &RouteUI::mute_changed));
296 _route->solo_changed.connect (mem_fun(*this, &RouteUI::solo_changed));
297 _route->solo_safe_changed.connect (mem_fun(*this, &RouteUI::solo_changed));
298 _route->mix_group_changed.connect (mem_fun(*this, &MixerStrip::mix_group_changed));
299 _route->panner().Changed.connect (mem_fun(*this, &MixerStrip::connect_to_pan));
301 if (is_audio_track()) {
302 audio_track()->DiskstreamChanged.connect (mem_fun(*this, &MixerStrip::diskstream_changed));
303 get_diskstream()->SpeedChanged.connect (mem_fun(*this, &MixerStrip::speed_changed));
306 _route->name_changed.connect (mem_fun(*this, &RouteUI::name_changed));
307 _route->comment_changed.connect (mem_fun(*this, &MixerStrip::comment_changed));
308 _route->gui_changed.connect (mem_fun(*this, &MixerStrip::route_gui_changed));
310 input_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::input_press), false);
311 output_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::output_press), false);
313 solo_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::solo_press), false);
314 solo_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::solo_release), false);
315 mute_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::mute_press), false);
316 mute_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::mute_release), false);
318 name_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::name_button_button_press), false);
319 group_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::select_mix_group), false);
322 set_stuff_from_route ();
324 /* start off as a passthru strip. we'll correct this, if necessary,
325 in update_diskstream_display().
328 set_name ("AudioTrackStripBase");
330 /* now force an update of all the various elements */
332 pre_redirect_box.update();
333 post_redirect_box.update();
338 mix_group_changed (0);
342 panners.setup_pan ();
344 if (is_audio_track()) {
348 update_diskstream_display ();
349 update_input_display ();
350 update_output_display ();
352 add_events (Gdk::BUTTON_RELEASE_MASK);
355 MixerStrip::~MixerStrip ()
357 GoingAway(); /* EMIT_SIGNAL */
359 if (input_selector) {
360 delete input_selector;
363 if (output_selector) {
364 delete output_selector;
369 MixerStrip::set_stuff_from_route ()
375 /* if width is not set, it will be set by the MixerUI or editor */
377 if ((prop = xml_node->property ("strip_width")) != 0) {
378 set_width (Width (string_2_enum (prop->value(), _width)), this);
381 if ((prop = xml_node->property ("shown_mixer")) != 0) {
382 if (prop->value() == "no") {
383 _marked_for_display = false;
385 _marked_for_display = true;
388 /* backwards compatibility */
389 _marked_for_display = true;
394 MixerStrip::set_width (Width w, void* owner)
396 /* always set the gpm width again, things may be hidden */
399 panners.set_width (w);
400 pre_redirect_box.set_width (w);
401 post_redirect_box.set_width (w);
403 _width_owner = owner;
413 if (_width_owner == this) {
414 xml_node->add_property ("strip_width", enum_2_string (_width));
419 set_size_request (-1, -1);
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 if (rec_enable_button) {
444 ((Gtk::Label*)rec_enable_button->get_child())->set_text (_("Rec"));
446 ((Gtk::Label*)mute_button->get_child())->set_text (_("M"));
447 ((Gtk::Label*)solo_button->get_child())->set_text (_("S"));
449 if (_route->comment() == "") {
450 comment_button.unset_bg (STATE_NORMAL);
451 ((Gtk::Label*)comment_button.get_child())->set_text (_("Cmt"));
453 comment_button.modify_bg (STATE_NORMAL, color());
454 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Cmt*"));
457 ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (gpm.short_astyle_string(_route->gain_automation_curve().automation_style()));
458 ((Gtk::Label*)gpm.gain_automation_state_button.get_child())->set_text (gpm.short_astate_string(_route->gain_automation_curve().automation_state()));
459 ((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text (panners.short_astyle_string(_route->panner().automation_style()));
460 ((Gtk::Label*)panners.pan_automation_state_button.get_child())->set_text (panners.short_astate_string(_route->panner().automation_state()));
461 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2);
462 set_size_request (max (50, gpm.get_gm_width()), -1);
466 update_input_display ();
467 update_output_display ();
468 mix_group_changed (0);
474 MixerStrip::set_packed (bool yn)
481 xml_node->add_property ("shown_mixer", "yes");
483 xml_node->add_property ("shown_mixer", "no");
489 MixerStrip::output_press (GdkEventButton *ev)
491 using namespace Menu_Helpers;
492 if (!_session.engine().connected()) {
493 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
498 MenuList& citems = output_menu.items();
499 switch (ev->button) {
502 output_menu.set_name ("ArdourContextMenu");
505 citems.push_back (MenuElem (_("Edit"), mem_fun(*this, &MixerStrip::edit_output_configuration)));
506 citems.push_back (SeparatorElem());
507 citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_output)));
508 citems.push_back (SeparatorElem());
510 _session.foreach_connection (this, &MixerStrip::add_connection_to_output_menu);
512 output_menu.popup (1, ev->time);
522 MixerStrip::edit_output_configuration ()
524 if (output_selector == 0) {
525 output_selector = new IOSelectorWindow (_session, _route, false);
528 if (output_selector->is_visible()) {
529 output_selector->get_toplevel()->get_window()->raise();
531 output_selector->show_all ();
536 MixerStrip::edit_input_configuration ()
538 if (input_selector == 0) {
539 input_selector = new IOSelectorWindow (_session, _route, true);
542 if (input_selector->is_visible()) {
543 input_selector->get_toplevel()->get_window()->raise();
545 input_selector->show_all ();
550 MixerStrip::input_press (GdkEventButton *ev)
552 using namespace Menu_Helpers;
554 MenuList& citems = input_menu.items();
555 input_menu.set_name ("ArdourContextMenu");
558 if (!_session.engine().connected()) {
559 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
564 switch (ev->button) {
567 citems.push_back (MenuElem (_("Edit"), mem_fun(*this, &MixerStrip::edit_input_configuration)));
568 citems.push_back (SeparatorElem());
569 citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_input)));
570 citems.push_back (SeparatorElem());
572 _session.foreach_connection (this, &MixerStrip::add_connection_to_input_menu);
574 input_menu.popup (1, ev->time);
584 MixerStrip::connection_input_chosen (ARDOUR::Connection *c)
586 if (!ignore_toggle) {
589 _route->use_input_connection (*c, this);
592 catch (AudioEngine::PortRegistrationFailure& err) {
593 error << _("could not register new ports required for that connection")
600 MixerStrip::connection_output_chosen (ARDOUR::Connection *c)
602 if (!ignore_toggle) {
605 _route->use_output_connection (*c, this);
608 catch (AudioEngine::PortRegistrationFailure& err) {
609 error << _("could not register new ports required for that connection")
616 MixerStrip::add_connection_to_input_menu (ARDOUR::Connection* c)
618 using namespace Menu_Helpers;
620 if (dynamic_cast<InputConnection *> (c) == 0) {
624 MenuList& citems = input_menu.items();
626 if (c->nports() == _route->n_inputs()) {
628 citems.push_back (CheckMenuElem (c->name(), bind (mem_fun(*this, &MixerStrip::connection_input_chosen), c)));
630 ARDOUR::Connection *current = _route->input_connection();
633 ignore_toggle = true;
634 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
635 ignore_toggle = false;
641 MixerStrip::add_connection_to_output_menu (ARDOUR::Connection* c)
643 using namespace Menu_Helpers;
645 if (dynamic_cast<OutputConnection *> (c) == 0) {
649 if (c->nports() == _route->n_outputs()) {
651 MenuList& citems = output_menu.items();
652 citems.push_back (CheckMenuElem (c->name(), bind (mem_fun(*this, &MixerStrip::connection_output_chosen), c)));
654 ARDOUR::Connection *current = _route->output_connection();
657 ignore_toggle = true;
658 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
659 ignore_toggle = false;
665 MixerStrip::update_diskstream_display ()
667 if (is_audio_track()) {
671 update_input_display ();
673 if (input_selector) {
674 input_selector->hide_all ();
683 update_input_display ();
684 show_passthru_color ();
689 MixerStrip::connect_to_pan ()
691 ENSURE_GUI_THREAD(mem_fun(*this, &MixerStrip::connect_to_pan));
693 panstate_connection.disconnect ();
694 panstyle_connection.disconnect ();
696 if (!_route->panner().empty()) {
697 StreamPanner* sp = _route->panner().front();
699 panstate_connection = sp->automation().automation_state_changed.connect (mem_fun(panners, &PannerUI::pan_automation_state_changed));
700 panstyle_connection = sp->automation().automation_style_changed.connect (mem_fun(panners, &PannerUI::pan_automation_style_changed));
703 panners.pan_changed (this);
707 MixerStrip::update_input_display ()
709 ARDOUR::Connection *c;
711 if ((c = _route->input_connection()) != 0) {
712 input_label.set_text (c->name());
716 input_label.set_text (_(" Input"));
719 input_label.set_text (_("I"));
723 panners.setup_pan ();
727 MixerStrip::update_output_display ()
729 ARDOUR::Connection *c;
731 if ((c = _route->output_connection()) != 0) {
732 output_label.set_text (c->name());
736 output_label.set_text (_("Output"));
739 output_label.set_text (_("O"));
744 panners.setup_pan ();
748 MixerStrip::fast_update ()
750 gpm.update_meters ();
754 MixerStrip::diskstream_changed ()
756 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_diskstream_display));
760 MixerStrip::input_changed (IOChange change, void *src)
762 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_input_display));
766 MixerStrip::output_changed (IOChange change, void *src)
768 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_output_display));
773 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;
974 route_ops_menu = manage (new Menu);
975 route_ops_menu->set_name ("ArdourContextMenu");
977 MenuList& items = route_ops_menu->items();
979 items.push_back (MenuElem (_("Rename"), mem_fun(*this, &RouteUI::route_rename)));
980 items.push_back (SeparatorElem());
981 items.push_back (CheckMenuElem (_("Active"), mem_fun (*this, &RouteUI::toggle_route_active)));
982 route_active_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
983 route_active_menu_item->set_active (_route->active());
984 items.push_back (SeparatorElem());
985 items.push_back (CheckMenuElem (_("Invert Polarity"), mem_fun (*this, &RouteUI::toggle_polarity)));
986 polarity_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
987 polarity_menu_item->set_active (_route->phase_invert());
988 items.push_back (CheckMenuElem (_("Protect against denormals"), mem_fun (*this, &RouteUI::toggle_denormal_protection)));
989 denormal_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
990 denormal_menu_item->set_active (_route->denormal_protection());
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 ()
1098 set_width (Narrow, this);
1101 set_width (Wide, this);
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 boost::shared_ptr<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 ();