2 Copyright (C) 2000-2006 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>
25 #include <pbd/enumwriter.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/processor.h>
44 #include <ardour/ladspa_plugin.h>
45 #include <ardour/bundle.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;
67 int MixerStrip::scrollbar_height = 0;
69 #ifdef VARISPEED_IN_MIXER_STRIP
71 speed_printer (char buf[32], Gtk::Adjustment& adj, void* arg)
73 float val = adj.get_value ();
78 snprintf (buf, 32, "%.3f", val);
83 MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, boost::shared_ptr<Route> rt, bool in_mixer)
85 RouteUI (rt, sess, _("Mute"), _("Solo"), _("Record")),
87 pre_processor_box (PreFader, sess, rt, mx.plugin_selector(), mx.selection(), in_mixer),
88 post_processor_box (PostFader, sess, rt, mx.plugin_selector(), mx.selection(), in_mixer),
90 panners (_route, sess),
92 middle_button_table (1, 2),
93 bottom_button_table (1, 2),
94 meter_point_label (_("pre")),
95 comment_button (_("Comments")),
96 speed_adjustment (1.0, 0.001, 4.0, 0.001, 0.1),
97 speed_spinner (&speed_adjustment, "MixerStripSpeedBase", true)
100 if (set_color_from_route()) {
101 set_color (unique_random_color());
107 _marked_for_display = false;
109 ignore_comment_edit = false;
110 ignore_toggle = false;
111 ignore_speed_adjustment = false;
116 Gtk::Image *width_icon = manage (new Gtk::Image (::get_icon("strip_width")));
117 Gtk::Image *hide_icon = manage (new Gtk::Image (::get_icon("hide")));
118 width_button.add (*width_icon);
119 hide_button.add (*hide_icon);
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_processor_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_processor_box, true, true);
260 if (!is_midi_track())
261 global_vpacker.pack_start (panners, Gtk::PACK_SHRINK);
262 global_vpacker.pack_start (output_button, Gtk::PACK_SHRINK);
263 global_vpacker.pack_start (comment_button, Gtk::PACK_SHRINK);
265 if (route()->is_master() || route()->is_control()) {
267 if (scrollbar_height == 0) {
268 HScrollbar scrollbar;
269 Gtk::Requisition requisition(scrollbar.size_request ());
270 scrollbar_height = requisition.height;
273 EventBox* spacer = manage (new EventBox);
274 spacer->set_size_request (-1, scrollbar_height);
275 global_vpacker.pack_start (*spacer, false, false);
278 global_frame.add (global_vpacker);
279 global_frame.set_shadow_type (Gtk::SHADOW_IN);
280 global_frame.set_name ("BaseFrame");
284 /* force setting of visible selected status */
287 set_selected (false);
292 _session.engine().Stopped.connect (mem_fun(*this, &MixerStrip::engine_stopped));
293 _session.engine().Running.connect (mem_fun(*this, &MixerStrip::engine_running));
294 _route->input_changed.connect (mem_fun(*this, &MixerStrip::input_changed));
295 _route->output_changed.connect (mem_fun(*this, &MixerStrip::output_changed));
296 _route->mute_changed.connect (mem_fun(*this, &RouteUI::mute_changed));
297 _route->solo_changed.connect (mem_fun(*this, &RouteUI::solo_changed));
298 _route->solo_safe_changed.connect (mem_fun(*this, &RouteUI::solo_changed));
299 _route->mix_group_changed.connect (mem_fun(*this, &MixerStrip::mix_group_changed));
300 _route->panner().Changed.connect (mem_fun(*this, &MixerStrip::connect_to_pan));
302 if (is_audio_track()) {
303 audio_track()->DiskstreamChanged.connect (mem_fun(*this, &MixerStrip::diskstream_changed));
304 get_diskstream()->SpeedChanged.connect (mem_fun(*this, &MixerStrip::speed_changed));
307 _route->NameChanged.connect (mem_fun(*this, &RouteUI::name_changed));
308 _route->comment_changed.connect (mem_fun(*this, &MixerStrip::comment_changed));
309 _route->gui_changed.connect (mem_fun(*this, &MixerStrip::route_gui_changed));
311 input_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::input_press), false);
312 output_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::output_press), false);
314 solo_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::solo_press), false);
315 solo_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::solo_release), false);
316 mute_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::mute_press), false);
317 mute_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::mute_release), false);
319 name_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::name_button_button_press), false);
320 group_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::select_mix_group), false);
323 set_stuff_from_route ();
325 /* start off as a passthru strip. we'll correct this, if necessary,
326 in update_diskstream_display().
330 set_name ("MidiTrackStripBase");
332 set_name ("AudioTrackStripBase");
334 /* now force an update of all the various elements */
336 pre_processor_box.update();
337 post_processor_box.update();
342 mix_group_changed (0);
346 panners.setup_pan ();
348 if (is_audio_track()) {
352 update_diskstream_display ();
353 update_input_display ();
354 update_output_display ();
356 add_events (Gdk::BUTTON_RELEASE_MASK);
361 gain_meter_alignment->show();
363 pre_processor_box.show();
366 width_hide_box.show();
368 global_vpacker.show();
370 middle_button_table.show();
371 bottom_button_table.show();
372 gain_unit_button.show();
373 gain_unit_label.show();
374 meter_point_button.show();
375 meter_point_label.show();
376 diskstream_button.show();
377 diskstream_label.show();
380 output_button.show();
384 comment_button.show();
387 speed_spinner.show();
394 MixerStrip::~MixerStrip ()
396 GoingAway(); /* EMIT_SIGNAL */
398 if (input_selector) {
399 delete input_selector;
402 if (output_selector) {
403 delete output_selector;
408 MixerStrip::set_stuff_from_route ()
414 /* if width is not set, it will be set by the MixerUI or editor */
416 if ((prop = xml_node->property ("strip_width")) != 0) {
417 set_width (Width (string_2_enum (prop->value(), _width)), this);
420 if ((prop = xml_node->property ("shown_mixer")) != 0) {
421 if (prop->value() == "no") {
422 _marked_for_display = false;
424 _marked_for_display = true;
427 /* backwards compatibility */
428 _marked_for_display = true;
433 MixerStrip::set_width (Width w, void* owner)
435 /* always set the gpm width again, things may be hidden */
438 panners.set_width (w);
439 pre_processor_box.set_width (w);
440 post_processor_box.set_width (w);
442 boost::shared_ptr<AutomationList> gain_automation = _route->gain_control()->list();
444 _width_owner = owner;
454 if (_width_owner == this) {
455 xml_node->add_property ("strip_width", enum_2_string (_width));
460 set_size_request (-1, -1);
462 if (rec_enable_button) {
463 ((Gtk::Label*)rec_enable_button->get_child())->set_text (_("record"));
465 ((Gtk::Label*)mute_button->get_child())->set_text (_("Mute"));
466 ((Gtk::Label*)solo_button->get_child())->set_text (_("Solo"));
468 if (_route->comment() == "") {
469 comment_button.unset_bg (STATE_NORMAL);
470 ((Gtk::Label*)comment_button.get_child())->set_text (_("comments"));
472 comment_button.modify_bg (STATE_NORMAL, color());
473 ((Gtk::Label*)comment_button.get_child())->set_text (_("*comments*"));
476 ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (gpm.astyle_string(gain_automation->automation_style()));
477 ((Gtk::Label*)gpm.gain_automation_state_button.get_child())->set_text (gpm.astate_string(gain_automation->automation_state()));
478 ((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text (panners.astyle_string(_route->panner().automation_style()));
479 ((Gtk::Label*)panners.pan_automation_state_button.get_child())->set_text (panners.astate_string(_route->panner().automation_state()));
480 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "long", 2, 2);
484 if (rec_enable_button) {
485 ((Gtk::Label*)rec_enable_button->get_child())->set_text (_("Rec"));
487 ((Gtk::Label*)mute_button->get_child())->set_text (_("M"));
488 ((Gtk::Label*)solo_button->get_child())->set_text (_("S"));
490 if (_route->comment() == "") {
491 comment_button.unset_bg (STATE_NORMAL);
492 ((Gtk::Label*)comment_button.get_child())->set_text (_("Cmt"));
494 comment_button.modify_bg (STATE_NORMAL, color());
495 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Cmt*"));
498 ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (gpm.short_astyle_string(gain_automation->automation_style()));
499 ((Gtk::Label*)gpm.gain_automation_state_button.get_child())->set_text (gpm.short_astate_string(gain_automation->automation_state()));
500 ((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text (panners.short_astyle_string(_route->panner().automation_style()));
501 ((Gtk::Label*)panners.pan_automation_state_button.get_child())->set_text (panners.short_astate_string(_route->panner().automation_state()));
502 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2);
503 set_size_request (max (50, gpm.get_gm_width()), -1);
507 update_input_display ();
508 update_output_display ();
509 mix_group_changed (0);
515 MixerStrip::set_packed (bool yn)
522 xml_node->add_property ("shown_mixer", "yes");
524 xml_node->add_property ("shown_mixer", "no");
530 MixerStrip::output_press (GdkEventButton *ev)
532 using namespace Menu_Helpers;
533 if (!_session.engine().connected()) {
534 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
539 MenuList& citems = output_menu.items();
540 switch (ev->button) {
543 output_menu.set_name ("ArdourContextMenu");
546 citems.push_back (MenuElem (_("Edit"), mem_fun(*this, &MixerStrip::edit_output_configuration)));
547 citems.push_back (SeparatorElem());
548 citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_output)));
549 citems.push_back (SeparatorElem());
551 _session.foreach_bundle (
552 bind (mem_fun (*this, &MixerStrip::add_bundle_to_output_menu), _route->output_bundle ())
555 output_menu.popup (1, ev->time);
565 MixerStrip::edit_output_configuration ()
567 if (output_selector == 0) {
568 output_selector = new IOSelectorWindow (_session, _route, false);
571 if (output_selector->is_visible()) {
572 output_selector->get_toplevel()->get_window()->raise();
574 output_selector->present ();
579 MixerStrip::edit_input_configuration ()
581 if (input_selector == 0) {
582 input_selector = new IOSelectorWindow (_session, _route, true);
585 if (input_selector->is_visible()) {
586 input_selector->get_toplevel()->get_window()->raise();
588 input_selector->present ();
593 MixerStrip::input_press (GdkEventButton *ev)
595 using namespace Menu_Helpers;
597 MenuList& citems = input_menu.items();
598 input_menu.set_name ("ArdourContextMenu");
601 if (!_session.engine().connected()) {
602 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
607 switch (ev->button) {
610 citems.push_back (MenuElem (_("Edit"), mem_fun(*this, &MixerStrip::edit_input_configuration)));
611 citems.push_back (SeparatorElem());
612 citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_input)));
613 citems.push_back (SeparatorElem());
615 _session.foreach_bundle (
616 bind (mem_fun (*this, &MixerStrip::add_bundle_to_input_menu), _route->input_bundle ())
619 input_menu.popup (1, ev->time);
629 MixerStrip::bundle_input_chosen (boost::shared_ptr<ARDOUR::Bundle> c)
631 if (!ignore_toggle) {
634 _route->connect_input_ports_to_bundle (c, this);
637 catch (AudioEngine::PortRegistrationFailure& err) {
638 error << _("could not register new ports required for that bundle")
645 MixerStrip::bundle_output_chosen (boost::shared_ptr<ARDOUR::Bundle> c)
647 if (!ignore_toggle) {
650 _route->connect_output_ports_to_bundle (c, this);
653 catch (AudioEngine::PortRegistrationFailure& err) {
654 error << _("could not register new ports required for that bundle")
661 MixerStrip::add_bundle_to_input_menu (boost::shared_ptr<Bundle> b, boost::shared_ptr<Bundle> current)
663 using namespace Menu_Helpers;
665 /* the input menu needs to contain only output bundles (that we
666 can connect inputs to */
667 if (boost::dynamic_pointer_cast<OutputBundle, Bundle> (b) == 0) {
671 MenuList& citems = input_menu.items();
673 if (b->nchannels() == _route->n_inputs().n_total()) {
675 citems.push_back (CheckMenuElem (b->name(), bind (mem_fun(*this, &MixerStrip::bundle_input_chosen), b)));
678 ignore_toggle = true;
679 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
680 ignore_toggle = false;
686 MixerStrip::add_bundle_to_output_menu (boost::shared_ptr<Bundle> b, boost::shared_ptr<Bundle> current)
688 using namespace Menu_Helpers;
690 /* the output menu needs to contain only input bundles (that we
691 can connect outputs to */
692 if (boost::dynamic_pointer_cast<InputBundle, Bundle> (b) == 0) {
697 if (b->nchannels() == _route->n_outputs().n_total()) {
699 MenuList& citems = output_menu.items();
700 citems.push_back (CheckMenuElem (b->name(), bind (mem_fun(*this, &MixerStrip::bundle_output_chosen), b)));
703 ignore_toggle = true;
704 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
705 ignore_toggle = false;
711 MixerStrip::update_diskstream_display ()
717 update_input_display ();
719 if (input_selector) {
720 input_selector->hide_all ();
729 update_input_display ();
730 show_passthru_color ();
735 MixerStrip::connect_to_pan ()
737 ENSURE_GUI_THREAD(mem_fun(*this, &MixerStrip::connect_to_pan));
739 panstate_connection.disconnect ();
740 panstyle_connection.disconnect ();
742 if (!_route->panner().empty()) {
743 StreamPanner* sp = _route->panner().front();
745 panstate_connection = sp->pan_control()->list()->automation_state_changed.connect (mem_fun(panners, &PannerUI::pan_automation_state_changed));
746 panstyle_connection = sp->pan_control()->list()->automation_style_changed.connect (mem_fun(panners, &PannerUI::pan_automation_style_changed));
749 panners.pan_changed (this);
753 MixerStrip::update_input_display ()
755 boost::shared_ptr<ARDOUR::Bundle> c;
757 if ((c = _route->input_bundle()) != 0) {
758 input_label.set_text (c->name());
762 input_label.set_text (_(" Input"));
765 input_label.set_text (_("I"));
769 panners.setup_pan ();
773 MixerStrip::update_output_display ()
775 boost::shared_ptr<ARDOUR::Bundle> c;
777 if ((c = _route->output_bundle()) != 0) {
778 output_label.set_text (c->name());
782 output_label.set_text (_("Output"));
785 output_label.set_text (_("O"));
790 panners.setup_pan ();
794 MixerStrip::fast_update ()
796 gpm.update_meters ();
800 MixerStrip::diskstream_changed ()
802 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_diskstream_display));
806 MixerStrip::input_changed (IOChange change, void *src)
808 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_input_display));
812 MixerStrip::output_changed (IOChange change, void *src)
814 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_output_display));
819 MixerStrip::comment_editor_done_editing()
821 string str = comment_area->get_buffer()->get_text();
822 if (_route->comment() != str) {
823 _route->set_comment (str, this);
829 comment_button.modify_bg (STATE_NORMAL, color());
830 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Comments*"));
832 comment_button.unset_bg (STATE_NORMAL);
833 ((Gtk::Label*)comment_button.get_child())->set_text (_("Comments"));
839 comment_button.modify_bg (STATE_NORMAL, color());
840 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Cmt*"));
842 comment_button.unset_bg (STATE_NORMAL);
843 ((Gtk::Label*)comment_button.get_child())->set_text (_("Cmt"));
848 ARDOUR_UI::instance()->tooltips().set_tip (comment_button,
849 str.empty() ? _("Click to Add/Edit Comments") : str);
855 MixerStrip::comment_button_clicked ()
857 if (comment_window == 0) {
858 setup_comment_editor ();
861 int x, y, cw_width, cw_height;
863 if (comment_window->is_visible()) {
864 comment_window->hide ();
868 comment_window->get_size (cw_width, cw_height);
869 comment_window->get_position(x, y);
870 comment_window->move(x, y - (cw_height / 2) - 45);
872 half the dialog height minus the comments button height
873 with some window decoration fudge thrown in.
876 comment_window->show();
877 comment_window->present();
881 MixerStrip::setup_comment_editor ()
884 title = _route->name();
885 title += _(": comment editor");
887 comment_window = new ArdourDialog (title, false);
888 comment_window->set_position (Gtk::WIN_POS_MOUSE);
889 comment_window->set_skip_taskbar_hint (true);
890 comment_window->signal_hide().connect (mem_fun(*this, &MixerStrip::comment_editor_done_editing));
892 comment_area = manage (new TextView());
893 comment_area->set_name ("MixerTrackCommentArea");
894 comment_area->set_size_request (110, 178);
895 comment_area->set_wrap_mode (WRAP_WORD);
896 comment_area->set_editable (true);
897 comment_area->get_buffer()->set_text (_route->comment());
898 comment_area->show ();
900 comment_window->get_vbox()->pack_start (*comment_area);
901 comment_window->get_action_area()->hide();
905 MixerStrip::comment_changed (void *src)
907 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::comment_changed), src));
910 ignore_comment_edit = true;
912 comment_area->get_buffer()->set_text (_route->comment());
914 ignore_comment_edit = false;
919 MixerStrip::set_mix_group (RouteGroup *rg)
921 _route->set_mix_group (rg, this);
925 MixerStrip::add_mix_group_to_menu (RouteGroup *rg, RadioMenuItem::Group* group)
927 using namespace Menu_Helpers;
929 MenuList& items = group_menu->items();
931 items.push_back (RadioMenuElem (*group, rg->name(), bind (mem_fun(*this, &MixerStrip::set_mix_group), rg)));
933 if (_route->mix_group() == rg) {
934 static_cast<RadioMenuItem*>(&items.back())->set_active ();
939 MixerStrip::select_mix_group (GdkEventButton *ev)
941 using namespace Menu_Helpers;
943 if (group_menu == 0) {
944 group_menu = new Menu;
946 group_menu->set_name ("ArdourContextMenu");
947 MenuList& items = group_menu->items();
948 RadioMenuItem::Group group;
950 switch (ev->button) {
954 items.push_back (RadioMenuElem (group, _("No group"), bind (mem_fun(*this, &MixerStrip::set_mix_group), (RouteGroup *) 0)));
956 _session.foreach_mix_group (bind (mem_fun (*this, &MixerStrip::add_mix_group_to_menu), &group));
958 group_menu->popup (1, ev->time);
969 MixerStrip::mix_group_changed (void *ignored)
971 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::mix_group_changed), ignored));
973 RouteGroup *rg = _route->mix_group();
976 group_label.set_text (rg->name());
980 group_label.set_text (_("Grp"));
983 group_label.set_text (_("~G"));
991 MixerStrip::route_gui_changed (string what_changed, void* ignored)
993 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::route_gui_changed), what_changed, ignored));
995 if (what_changed == "color") {
996 if (set_color_from_route () == 0) {
1003 MixerStrip::show_route_color ()
1005 name_button.modify_bg (STATE_NORMAL, color());
1006 top_event_box.modify_bg (STATE_NORMAL, color());
1007 route_active_changed ();
1011 MixerStrip::show_passthru_color ()
1013 route_active_changed ();
1017 MixerStrip::build_route_ops_menu ()
1019 using namespace Menu_Helpers;
1020 route_ops_menu = manage (new Menu);
1021 route_ops_menu->set_name ("ArdourContextMenu");
1023 MenuList& items = route_ops_menu->items();
1025 items.push_back (MenuElem (_("Rename"), mem_fun(*this, &RouteUI::route_rename)));
1026 items.push_back (SeparatorElem());
1027 items.push_back (CheckMenuElem (_("Active"), mem_fun (*this, &RouteUI::toggle_route_active)));
1028 route_active_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
1029 route_active_menu_item->set_active (_route->active());
1031 items.push_back (SeparatorElem());
1033 items.push_back (MenuElem (_("Adjust latency"), mem_fun (*this, &RouteUI::adjust_latency)));
1035 items.push_back (SeparatorElem());
1036 items.push_back (CheckMenuElem (_("Invert Polarity"), mem_fun (*this, &RouteUI::toggle_polarity)));
1037 polarity_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
1038 polarity_menu_item->set_active (_route->phase_invert());
1039 items.push_back (CheckMenuElem (_("Protect against denormals"), mem_fun (*this, &RouteUI::toggle_denormal_protection)));
1040 denormal_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
1041 denormal_menu_item->set_active (_route->denormal_protection());
1043 build_remote_control_menu ();
1045 items.push_back (SeparatorElem());
1046 items.push_back (MenuElem (_("Remote Control ID"), *remote_control_menu));
1048 items.push_back (SeparatorElem());
1049 items.push_back (MenuElem (_("Remove"), mem_fun(*this, &RouteUI::remove_this_route)));
1053 MixerStrip::name_button_button_press (GdkEventButton* ev)
1055 if (ev->button == 1) {
1056 list_route_operations ();
1058 Menu_Helpers::MenuList& items = route_ops_menu->items();
1059 /* do not allow rename if the track is record-enabled */
1060 static_cast<MenuItem*> (&items.front())->set_sensitive (!_route->record_enabled());
1062 route_ops_menu->popup (1, ev->time);
1068 MixerStrip::list_route_operations ()
1070 if (route_ops_menu == 0) {
1071 build_route_ops_menu ();
1074 refresh_remote_control_menu();
1079 MixerStrip::speed_adjustment_changed ()
1081 /* since there is a usable speed adjustment, there has to be a diskstream */
1082 if (!ignore_speed_adjustment) {
1083 get_diskstream()->set_speed (speed_adjustment.get_value());
1088 MixerStrip::speed_changed ()
1090 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_speed_display));
1094 MixerStrip::update_speed_display ()
1098 val = get_diskstream()->speed();
1101 speed_spinner.set_name ("MixerStripSpeedBaseNotOne");
1103 speed_spinner.set_name ("MixerStripSpeedBase");
1106 if (speed_adjustment.get_value() != val) {
1107 ignore_speed_adjustment = true;
1108 speed_adjustment.set_value (val);
1109 ignore_speed_adjustment = false;
1115 MixerStrip::set_selected (bool yn)
1117 AxisView::set_selected (yn);
1119 global_frame.set_shadow_type (Gtk::SHADOW_ETCHED_OUT);
1120 global_frame.set_name ("MixerStripSelectedFrame");
1122 global_frame.set_shadow_type (Gtk::SHADOW_IN);
1123 global_frame.set_name ("MixerStripFrame");
1125 global_frame.queue_draw ();
1129 MixerStrip::name_changed ()
1133 RouteUI::name_changed ();
1136 name_label.set_text (PBD::short_version (_route->name(), 5));
1139 if (_route->phase_invert()) {
1140 name_label.set_text (X_("Ø ") + name_label.get_text());
1145 MixerStrip::width_clicked ()
1149 set_width (Narrow, this);
1152 set_width (Wide, this);
1158 MixerStrip::hide_clicked ()
1160 // LAME fix to reset the button status for when it is redisplayed (part 1)
1161 hide_button.set_sensitive(false);
1164 Hiding(); /* EMIT_SIGNAL */
1166 _mixer.hide_strip (this);
1170 hide_button.set_sensitive(true);
1174 MixerStrip::set_embedded (bool yn)
1180 MixerStrip::map_frozen ()
1182 ENSURE_GUI_THREAD (mem_fun(*this, &MixerStrip::map_frozen));
1184 boost::shared_ptr<AudioTrack> at = audio_track();
1187 switch (at->freeze_state()) {
1188 case AudioTrack::Frozen:
1189 pre_processor_box.set_sensitive (false);
1190 post_processor_box.set_sensitive (false);
1191 speed_spinner.set_sensitive (false);
1194 pre_processor_box.set_sensitive (true);
1195 post_processor_box.set_sensitive (true);
1196 speed_spinner.set_sensitive (true);
1200 _route->foreach_processor (this, &MixerStrip::hide_processor_editor);
1204 MixerStrip::hide_processor_editor (boost::shared_ptr<Processor> processor)
1206 void* gui = processor->get_gui ();
1209 static_cast<Gtk::Widget*>(gui)->hide ();
1214 MixerStrip::route_active_changed ()
1216 RouteUI::route_active_changed ();
1218 if (is_midi_track()) {
1219 if (_route->active()) {
1220 set_name ("MidiTrackStripBase");
1221 gpm.set_meter_strip_name ("MidiTrackStripBase");
1223 set_name ("MidiTrackStripBaseInactive");
1224 gpm.set_meter_strip_name ("MidiTrackStripBaseInactive");
1226 gpm.set_fader_name ("MidiTrackFader");
1227 } else if (is_audio_track()) {
1228 if (_route->active()) {
1229 set_name ("AudioTrackStripBase");
1230 gpm.set_meter_strip_name ("AudioTrackMetrics");
1232 set_name ("AudioTrackStripBaseInactive");
1233 gpm.set_meter_strip_name ("AudioTrackMetricsInactive");
1235 gpm.set_fader_name ("AudioTrackFader");
1237 if (_route->active()) {
1238 set_name ("AudioBusStripBase");
1239 gpm.set_meter_strip_name ("AudioBusMetrics");
1241 set_name ("AudioBusStripBaseInactive");
1242 gpm.set_meter_strip_name ("AudioBusMetricsInactive");
1244 gpm.set_fader_name ("AudioBusFader");
1246 /* (no MIDI busses yet) */
1251 MixerStrip::mix_group() const
1253 return _route->mix_group();
1257 MixerStrip::engine_stopped ()
1262 MixerStrip::engine_running ()
1267 MixerStrip::meter_changed (void *src)
1270 ENSURE_GUI_THREAD (bind (mem_fun(*this, &MixerStrip::meter_changed), src));
1272 switch (_route->meter_point()) {
1274 meter_point_label.set_text (_("input"));
1278 meter_point_label.set_text (_("pre"));
1281 case MeterPostFader:
1282 meter_point_label.set_text (_("post"));
1286 gpm.setup_meters ();