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>
46 #include <ardour/session_bundle.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_processor_box (PreFader, sess, rt, mx.plugin_selector(), mx.selection(), in_mixer),
89 post_processor_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;
117 width_button.add (*(manage (new Gtk::Image (::get_icon("strip_width")))));
118 hide_button.add (*(manage (new Gtk::Image (::get_icon("hide")))));
120 input_label.set_text (_("Input"));
121 input_button.add (input_label);
122 input_button.set_name ("MixerIOButton");
123 input_label.set_name ("MixerIOButtonLabel");
125 output_label.set_text (_("Output"));
126 output_button.add (output_label);
127 output_button.set_name ("MixerIOButton");
128 output_label.set_name ("MixerIOButtonLabel");
130 _route->meter_change.connect (mem_fun(*this, &MixerStrip::meter_changed));
131 meter_point_button.add (meter_point_label);
132 meter_point_button.set_name ("MixerStripMeterPreButton");
133 meter_point_label.set_name ("MixerStripMeterPreButton");
135 switch (_route->meter_point()) {
137 meter_point_label.set_text (_("input"));
141 meter_point_label.set_text (_("pre"));
145 meter_point_label.set_text (_("post"));
149 /* TRANSLATORS: this string should be longest of the strings
150 used to describe meter points. In english, it's "input".
152 set_size_request_to_display_given_text (meter_point_button, _("tupni"), 5, 5);
154 bottom_button_table.attach (meter_point_button, 1, 2, 0, 1);
156 meter_point_button.signal_button_press_event().connect (mem_fun (gpm, &GainMeter::meter_press), false);
157 /* XXX what is this meant to do? */
158 //meter_point_button.signal_button_release_event().connect (mem_fun (gpm, &GainMeter::meter_release), false);
160 hide_button.set_events (hide_button.get_events() & ~(Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK));
162 mute_button->set_name ("MixerMuteButton");
163 solo_button->set_name ("MixerSoloButton");
165 button_table.set_homogeneous (true);
166 button_table.set_spacings (0);
168 button_table.attach (name_button, 0, 2, 0, 1);
169 button_table.attach (input_button, 0, 2, 1, 2);
171 middle_button_table.set_homogeneous (true);
172 middle_button_table.set_spacings (0);
173 middle_button_table.attach (*mute_button, 0, 1, 0, 1);
174 middle_button_table.attach (*solo_button, 1, 2, 0, 1);
176 bottom_button_table.set_col_spacings (0);
177 bottom_button_table.set_homogeneous (true);
178 bottom_button_table.attach (group_button, 0, 1, 0, 1);
180 if (is_audio_track()) {
182 rec_enable_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::rec_enable_press), false);
183 rec_enable_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::rec_enable_release));
185 rec_enable_button->set_name ("MixerRecordEnableButton");
187 boost::shared_ptr<AudioTrack> at = audio_track();
189 at->FreezeChange.connect (mem_fun(*this, &MixerStrip::map_frozen));
191 #ifdef VARISPEED_IN_MIXER_STRIP
192 speed_adjustment.signal_value_changed().connect (mem_fun(*this, &MixerStrip::speed_adjustment_changed));
194 speed_frame.set_name ("BaseFrame");
195 speed_frame.set_shadow_type (Gtk::SHADOW_IN);
196 speed_frame.add (speed_spinner);
198 speed_spinner.set_print_func (speed_printer, 0);
200 ARDOUR_UI::instance()->tooltips().set_tip (speed_spinner, _("Varispeed"));
202 button_table.attach (speed_frame, 0, 2, 5, 6);
203 #endif /* VARISPEED_IN_MIXER_STRIP */
205 button_table.attach (*rec_enable_button, 0, 2, 2, 3);
208 name_button.add (name_label);
209 name_button.set_name ("MixerNameButton");
210 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2);
212 name_label.set_name ("MixerNameButtonLabel");
213 if (_route->phase_invert()) {
214 name_label.set_text (X_("Ø ") + name_label.get_text());
216 name_label.set_text (_route->name());
219 group_button.add (group_label);
220 group_button.set_name ("MixerGroupButton");
221 group_label.set_name ("MixerGroupButtonLabel");
223 comment_button.set_name ("MixerCommentButton");
225 ARDOUR_UI::instance()->tooltips().set_tip (comment_button, _route->comment()=="" ?
226 _("Click to Add/Edit Comments"):
229 comment_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::comment_button_clicked));
231 global_vpacker.set_border_width (0);
232 global_vpacker.set_spacing (0);
234 VBox *whvbox = manage (new VBox);
236 width_button.set_name ("MixerWidthButton");
237 hide_button.set_name ("MixerHideButton");
238 top_event_box.set_name ("MixerTopEventBox");
240 width_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::width_clicked));
241 hide_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::hide_clicked));
243 width_hide_box.pack_start (width_button, false, true);
244 width_hide_box.pack_start (top_event_box, true, true);
245 width_hide_box.pack_end (hide_button, false, true);
246 Gtk::Alignment *gain_meter_alignment = Gtk::manage(new Gtk::Alignment());
247 gain_meter_alignment->set_padding(0, 4, 0, 0);
248 gain_meter_alignment->add(gpm);
250 whvbox->pack_start (width_hide_box, true, true);
252 global_vpacker.pack_start (*whvbox, Gtk::PACK_SHRINK);
253 global_vpacker.pack_start (button_table,Gtk::PACK_SHRINK);
254 global_vpacker.pack_start (pre_processor_box, true, true);
255 global_vpacker.pack_start (middle_button_table,Gtk::PACK_SHRINK);
256 global_vpacker.pack_start (*gain_meter_alignment,Gtk::PACK_SHRINK);
257 global_vpacker.pack_start (bottom_button_table,Gtk::PACK_SHRINK);
258 global_vpacker.pack_start (post_processor_box, true, true);
259 if (!is_midi_track())
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()->is_master() || route()->is_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->NameChanged.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().
329 set_name ("MidiTrackStripBase");
331 set_name ("AudioTrackStripBase");
333 /* now force an update of all the various elements */
335 pre_processor_box.update();
336 post_processor_box.update();
341 mix_group_changed (0);
345 panners.setup_pan ();
347 if (is_audio_track()) {
351 update_diskstream_display ();
352 update_input_display ();
353 update_output_display ();
355 add_events (Gdk::BUTTON_RELEASE_MASK);
361 width_hide_box.show();
363 global_vpacker.show();
365 middle_button_table.show();
366 bottom_button_table.show();
367 gain_unit_button.show();
368 gain_unit_label.show();
369 meter_point_button.show();
370 meter_point_label.show();
371 diskstream_button.show();
372 diskstream_label.show();
375 output_button.show();
378 comment_button.show();
381 speed_spinner.show();
386 MixerStrip::~MixerStrip ()
388 GoingAway(); /* EMIT_SIGNAL */
390 if (input_selector) {
391 delete input_selector;
394 if (output_selector) {
395 delete output_selector;
400 MixerStrip::set_stuff_from_route ()
406 /* if width is not set, it will be set by the MixerUI or editor */
408 if ((prop = xml_node->property ("strip_width")) != 0) {
409 set_width (Width (string_2_enum (prop->value(), _width)), this);
412 if ((prop = xml_node->property ("shown_mixer")) != 0) {
413 if (prop->value() == "no") {
414 _marked_for_display = false;
416 _marked_for_display = true;
419 /* backwards compatibility */
420 _marked_for_display = true;
425 MixerStrip::set_width (Width w, void* owner)
427 /* always set the gpm width again, things may be hidden */
430 panners.set_width (w);
431 pre_processor_box.set_width (w);
432 post_processor_box.set_width (w);
434 boost::shared_ptr<AutomationList> gain_automation = _route->gain_control()->list();
436 _width_owner = owner;
446 if (_width_owner == this) {
447 xml_node->add_property ("strip_width", enum_2_string (_width));
452 set_size_request (-1, -1);
454 if (rec_enable_button) {
455 ((Gtk::Label*)rec_enable_button->get_child())->set_text (_("record"));
457 ((Gtk::Label*)mute_button->get_child())->set_text (_("Mute"));
458 ((Gtk::Label*)solo_button->get_child())->set_text (_("Solo"));
460 if (_route->comment() == "") {
461 comment_button.unset_bg (STATE_NORMAL);
462 ((Gtk::Label*)comment_button.get_child())->set_text (_("comments"));
464 comment_button.modify_bg (STATE_NORMAL, color());
465 ((Gtk::Label*)comment_button.get_child())->set_text (_("*comments*"));
468 ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (gpm.astyle_string(gain_automation->automation_style()));
469 ((Gtk::Label*)gpm.gain_automation_state_button.get_child())->set_text (gpm.astate_string(gain_automation->automation_state()));
470 ((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text (panners.astyle_string(_route->panner().automation_style()));
471 ((Gtk::Label*)panners.pan_automation_state_button.get_child())->set_text (panners.astate_string(_route->panner().automation_state()));
472 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "long", 2, 2);
476 if (rec_enable_button) {
477 ((Gtk::Label*)rec_enable_button->get_child())->set_text (_("Rec"));
479 ((Gtk::Label*)mute_button->get_child())->set_text (_("M"));
480 ((Gtk::Label*)solo_button->get_child())->set_text (_("S"));
482 if (_route->comment() == "") {
483 comment_button.unset_bg (STATE_NORMAL);
484 ((Gtk::Label*)comment_button.get_child())->set_text (_("Cmt"));
486 comment_button.modify_bg (STATE_NORMAL, color());
487 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Cmt*"));
490 ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (gpm.short_astyle_string(gain_automation->automation_style()));
491 ((Gtk::Label*)gpm.gain_automation_state_button.get_child())->set_text (gpm.short_astate_string(gain_automation->automation_state()));
492 ((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text (panners.short_astyle_string(_route->panner().automation_style()));
493 ((Gtk::Label*)panners.pan_automation_state_button.get_child())->set_text (panners.short_astate_string(_route->panner().automation_state()));
494 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2);
495 set_size_request (max (50, gpm.get_gm_width()), -1);
499 update_input_display ();
500 update_output_display ();
501 mix_group_changed (0);
507 MixerStrip::set_packed (bool yn)
514 xml_node->add_property ("shown_mixer", "yes");
516 xml_node->add_property ("shown_mixer", "no");
522 MixerStrip::output_press (GdkEventButton *ev)
524 using namespace Menu_Helpers;
525 if (!_session.engine().connected()) {
526 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
531 MenuList& citems = output_menu.items();
532 switch (ev->button) {
535 output_menu.set_name ("ArdourContextMenu");
538 citems.push_back (MenuElem (_("Edit"), mem_fun(*this, &MixerStrip::edit_output_configuration)));
539 citems.push_back (SeparatorElem());
540 citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_output)));
541 citems.push_back (SeparatorElem());
543 _session.foreach_bundle (this, &MixerStrip::add_bundle_to_output_menu);
545 output_menu.popup (1, ev->time);
555 MixerStrip::edit_output_configuration ()
557 if (output_selector == 0) {
558 output_selector = new IOSelectorWindow (_session, _route, false);
561 if (output_selector->is_visible()) {
562 output_selector->get_toplevel()->get_window()->raise();
564 output_selector->present ();
569 MixerStrip::edit_input_configuration ()
571 if (input_selector == 0) {
572 input_selector = new IOSelectorWindow (_session, _route, true);
575 if (input_selector->is_visible()) {
576 input_selector->get_toplevel()->get_window()->raise();
578 input_selector->present ();
583 MixerStrip::input_press (GdkEventButton *ev)
585 using namespace Menu_Helpers;
587 MenuList& citems = input_menu.items();
588 input_menu.set_name ("ArdourContextMenu");
591 if (!_session.engine().connected()) {
592 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
597 switch (ev->button) {
600 citems.push_back (MenuElem (_("Edit"), mem_fun(*this, &MixerStrip::edit_input_configuration)));
601 citems.push_back (SeparatorElem());
602 citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_input)));
603 citems.push_back (SeparatorElem());
605 _session.foreach_bundle (this, &MixerStrip::add_bundle_to_input_menu);
607 input_menu.popup (1, ev->time);
617 MixerStrip::bundle_input_chosen (ARDOUR::Bundle *c)
619 if (!ignore_toggle) {
622 _route->use_input_bundle (*c, this);
625 catch (AudioEngine::PortRegistrationFailure& err) {
626 error << _("could not register new ports required for that bundle")
633 MixerStrip::bundle_output_chosen (ARDOUR::Bundle *c)
635 if (!ignore_toggle) {
638 _route->use_output_bundle (*c, this);
641 catch (AudioEngine::PortRegistrationFailure& err) {
642 error << _("could not register new ports required for that bundle")
649 MixerStrip::add_bundle_to_input_menu (ARDOUR::Bundle* c)
651 using namespace Menu_Helpers;
653 if (dynamic_cast<InputBundle *> (c) == 0) {
657 MenuList& citems = input_menu.items();
659 if (c->nchannels() == _route->n_inputs().n_total()) {
661 citems.push_back (CheckMenuElem (c->name(), bind (mem_fun(*this, &MixerStrip::bundle_input_chosen), c)));
663 ARDOUR::Bundle *current = _route->input_bundle();
666 ignore_toggle = true;
667 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
668 ignore_toggle = false;
674 MixerStrip::add_bundle_to_output_menu (ARDOUR::Bundle* c)
676 using namespace Menu_Helpers;
678 if (dynamic_cast<OutputBundle *> (c) == 0) {
682 if (c->nchannels() == _route->n_outputs().n_total()) {
684 MenuList& citems = output_menu.items();
685 citems.push_back (CheckMenuElem (c->name(), bind (mem_fun(*this, &MixerStrip::bundle_output_chosen), c)));
687 ARDOUR::Bundle *current = _route->output_bundle();
690 ignore_toggle = true;
691 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
692 ignore_toggle = false;
698 MixerStrip::update_diskstream_display ()
704 update_input_display ();
706 if (input_selector) {
707 input_selector->hide_all ();
716 update_input_display ();
717 show_passthru_color ();
722 MixerStrip::connect_to_pan ()
724 ENSURE_GUI_THREAD(mem_fun(*this, &MixerStrip::connect_to_pan));
726 panstate_connection.disconnect ();
727 panstyle_connection.disconnect ();
729 if (!_route->panner().empty()) {
730 StreamPanner* sp = _route->panner().front();
732 panstate_connection = sp->pan_control()->list()->automation_state_changed.connect (mem_fun(panners, &PannerUI::pan_automation_state_changed));
733 panstyle_connection = sp->pan_control()->list()->automation_style_changed.connect (mem_fun(panners, &PannerUI::pan_automation_style_changed));
736 panners.pan_changed (this);
740 MixerStrip::update_input_display ()
744 if ((c = _route->input_bundle()) != 0) {
745 input_label.set_text (c->name());
749 input_label.set_text (_(" Input"));
752 input_label.set_text (_("I"));
756 panners.setup_pan ();
760 MixerStrip::update_output_display ()
764 if ((c = _route->output_bundle()) != 0) {
765 output_label.set_text (c->name());
769 output_label.set_text (_("Output"));
772 output_label.set_text (_("O"));
777 panners.setup_pan ();
781 MixerStrip::fast_update ()
783 gpm.update_meters ();
787 MixerStrip::diskstream_changed ()
789 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_diskstream_display));
793 MixerStrip::input_changed (IOChange change, void *src)
795 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_input_display));
799 MixerStrip::output_changed (IOChange change, void *src)
801 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_output_display));
806 MixerStrip::comment_editor_done_editing()
808 string str = comment_area->get_buffer()->get_text();
809 if (_route->comment() != str) {
810 _route->set_comment (str, this);
816 comment_button.modify_bg (STATE_NORMAL, color());
817 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Comments*"));
819 comment_button.unset_bg (STATE_NORMAL);
820 ((Gtk::Label*)comment_button.get_child())->set_text (_("Comments"));
826 comment_button.modify_bg (STATE_NORMAL, color());
827 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Cmt*"));
829 comment_button.unset_bg (STATE_NORMAL);
830 ((Gtk::Label*)comment_button.get_child())->set_text (_("Cmt"));
835 ARDOUR_UI::instance()->tooltips().set_tip (comment_button,
836 str.empty() ? _("Click to Add/Edit Comments") : str);
842 MixerStrip::comment_button_clicked ()
844 if (comment_window == 0) {
845 setup_comment_editor ();
848 int x, y, cw_width, cw_height;
850 if (comment_window->is_visible()) {
851 comment_window->hide ();
855 comment_window->get_size (cw_width, cw_height);
856 comment_window->get_position(x, y);
857 comment_window->move(x, y - (cw_height / 2) - 45);
859 half the dialog height minus the comments button height
860 with some window decoration fudge thrown in.
863 comment_window->show();
864 comment_window->present();
868 MixerStrip::setup_comment_editor ()
871 title = _route->name();
872 title += _(": comment editor");
874 comment_window = new ArdourDialog (title, false);
875 comment_window->set_position (Gtk::WIN_POS_MOUSE);
876 comment_window->set_skip_taskbar_hint (true);
877 comment_window->signal_hide().connect (mem_fun(*this, &MixerStrip::comment_editor_done_editing));
879 comment_area = manage (new TextView());
880 comment_area->set_name ("MixerTrackCommentArea");
881 comment_area->set_size_request (110, 178);
882 comment_area->set_wrap_mode (WRAP_WORD);
883 comment_area->set_editable (true);
884 comment_area->get_buffer()->set_text (_route->comment());
885 comment_area->show ();
887 comment_window->get_vbox()->pack_start (*comment_area);
888 comment_window->get_action_area()->hide();
892 MixerStrip::comment_changed (void *src)
894 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::comment_changed), src));
897 ignore_comment_edit = true;
899 comment_area->get_buffer()->set_text (_route->comment());
901 ignore_comment_edit = false;
906 MixerStrip::set_mix_group (RouteGroup *rg)
908 _route->set_mix_group (rg, this);
912 MixerStrip::add_mix_group_to_menu (RouteGroup *rg, RadioMenuItem::Group* group)
914 using namespace Menu_Helpers;
916 MenuList& items = group_menu->items();
918 items.push_back (RadioMenuElem (*group, rg->name(), bind (mem_fun(*this, &MixerStrip::set_mix_group), rg)));
920 if (_route->mix_group() == rg) {
921 static_cast<RadioMenuItem*>(&items.back())->set_active ();
926 MixerStrip::select_mix_group (GdkEventButton *ev)
928 using namespace Menu_Helpers;
930 if (group_menu == 0) {
931 group_menu = new Menu;
933 group_menu->set_name ("ArdourContextMenu");
934 MenuList& items = group_menu->items();
935 RadioMenuItem::Group group;
937 switch (ev->button) {
941 items.push_back (RadioMenuElem (group, _("No group"), bind (mem_fun(*this, &MixerStrip::set_mix_group), (RouteGroup *) 0)));
943 _session.foreach_mix_group (bind (mem_fun (*this, &MixerStrip::add_mix_group_to_menu), &group));
945 group_menu->popup (1, ev->time);
956 MixerStrip::mix_group_changed (void *ignored)
958 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::mix_group_changed), ignored));
960 RouteGroup *rg = _route->mix_group();
963 group_label.set_text (rg->name());
967 group_label.set_text (_("Grp"));
970 group_label.set_text (_("~G"));
978 MixerStrip::route_gui_changed (string what_changed, void* ignored)
980 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::route_gui_changed), what_changed, ignored));
982 if (what_changed == "color") {
983 if (set_color_from_route () == 0) {
990 MixerStrip::show_route_color ()
992 name_button.modify_bg (STATE_NORMAL, color());
993 top_event_box.modify_bg (STATE_NORMAL, color());
994 route_active_changed ();
998 MixerStrip::show_passthru_color ()
1000 route_active_changed ();
1004 MixerStrip::build_route_ops_menu ()
1006 using namespace Menu_Helpers;
1007 route_ops_menu = manage (new Menu);
1008 route_ops_menu->set_name ("ArdourContextMenu");
1010 MenuList& items = route_ops_menu->items();
1012 items.push_back (MenuElem (_("Rename"), mem_fun(*this, &RouteUI::route_rename)));
1013 items.push_back (SeparatorElem());
1014 items.push_back (CheckMenuElem (_("Active"), mem_fun (*this, &RouteUI::toggle_route_active)));
1015 route_active_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
1016 route_active_menu_item->set_active (_route->active());
1018 items.push_back (SeparatorElem());
1020 items.push_back (MenuElem (_("Adjust latency"), mem_fun (*this, &RouteUI::adjust_latency)));
1022 items.push_back (SeparatorElem());
1023 items.push_back (CheckMenuElem (_("Invert Polarity"), mem_fun (*this, &RouteUI::toggle_polarity)));
1024 polarity_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
1025 polarity_menu_item->set_active (_route->phase_invert());
1026 items.push_back (CheckMenuElem (_("Protect against denormals"), mem_fun (*this, &RouteUI::toggle_denormal_protection)));
1027 denormal_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
1028 denormal_menu_item->set_active (_route->denormal_protection());
1030 build_remote_control_menu ();
1032 items.push_back (SeparatorElem());
1033 items.push_back (MenuElem (_("Remote Control ID"), *remote_control_menu));
1035 items.push_back (SeparatorElem());
1036 items.push_back (MenuElem (_("Remove"), mem_fun(*this, &RouteUI::remove_this_route)));
1040 MixerStrip::name_button_button_press (GdkEventButton* ev)
1042 if (ev->button == 1) {
1043 list_route_operations ();
1045 Menu_Helpers::MenuList& items = route_ops_menu->items();
1046 /* do not allow rename if the track is record-enabled */
1047 static_cast<MenuItem*> (&items.front())->set_sensitive (!_route->record_enabled());
1049 route_ops_menu->popup (1, ev->time);
1055 MixerStrip::list_route_operations ()
1057 if (route_ops_menu == 0) {
1058 build_route_ops_menu ();
1061 refresh_remote_control_menu();
1066 MixerStrip::speed_adjustment_changed ()
1068 /* since there is a usable speed adjustment, there has to be a diskstream */
1069 if (!ignore_speed_adjustment) {
1070 get_diskstream()->set_speed (speed_adjustment.get_value());
1075 MixerStrip::speed_changed ()
1077 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_speed_display));
1081 MixerStrip::update_speed_display ()
1085 val = get_diskstream()->speed();
1088 speed_spinner.set_name ("MixerStripSpeedBaseNotOne");
1090 speed_spinner.set_name ("MixerStripSpeedBase");
1093 if (speed_adjustment.get_value() != val) {
1094 ignore_speed_adjustment = true;
1095 speed_adjustment.set_value (val);
1096 ignore_speed_adjustment = false;
1102 MixerStrip::set_selected (bool yn)
1104 AxisView::set_selected (yn);
1106 global_frame.set_shadow_type (Gtk::SHADOW_ETCHED_OUT);
1107 global_frame.set_name ("MixerStripSelectedFrame");
1109 global_frame.set_shadow_type (Gtk::SHADOW_IN);
1110 global_frame.set_name ("MixerStripFrame");
1112 global_frame.queue_draw ();
1116 MixerStrip::name_changed ()
1120 RouteUI::name_changed ();
1123 name_label.set_text (PBD::short_version (_route->name(), 5));
1126 if (_route->phase_invert()) {
1127 name_label.set_text (X_("Ø ") + name_label.get_text());
1132 MixerStrip::width_clicked ()
1136 set_width (Narrow, this);
1139 set_width (Wide, this);
1145 MixerStrip::hide_clicked ()
1147 // LAME fix to reset the button status for when it is redisplayed (part 1)
1148 hide_button.set_sensitive(false);
1151 Hiding(); /* EMIT_SIGNAL */
1153 _mixer.hide_strip (this);
1157 hide_button.set_sensitive(true);
1161 MixerStrip::set_embedded (bool yn)
1167 MixerStrip::map_frozen ()
1169 ENSURE_GUI_THREAD (mem_fun(*this, &MixerStrip::map_frozen));
1171 boost::shared_ptr<AudioTrack> at = audio_track();
1174 switch (at->freeze_state()) {
1175 case AudioTrack::Frozen:
1176 pre_processor_box.set_sensitive (false);
1177 post_processor_box.set_sensitive (false);
1178 speed_spinner.set_sensitive (false);
1181 pre_processor_box.set_sensitive (true);
1182 post_processor_box.set_sensitive (true);
1183 speed_spinner.set_sensitive (true);
1187 _route->foreach_processor (this, &MixerStrip::hide_processor_editor);
1191 MixerStrip::hide_processor_editor (boost::shared_ptr<Processor> processor)
1193 void* gui = processor->get_gui ();
1196 static_cast<Gtk::Widget*>(gui)->hide ();
1201 MixerStrip::route_active_changed ()
1203 RouteUI::route_active_changed ();
1205 if (is_midi_track()) {
1206 if (_route->active()) {
1207 set_name ("MidiTrackStripBase");
1208 gpm.set_meter_strip_name ("MidiTrackStripBase");
1210 set_name ("MidiTrackStripBaseInactive");
1211 gpm.set_meter_strip_name ("MidiTrackStripBaseInactive");
1213 gpm.set_fader_name ("MidiTrackFader");
1214 } else if (is_audio_track()) {
1215 if (_route->active()) {
1216 set_name ("AudioTrackStripBase");
1217 gpm.set_meter_strip_name ("AudioTrackStripBase");
1219 set_name ("AudioTrackStripBaseInactive");
1220 gpm.set_meter_strip_name ("AudioTrackStripBaseInactive");
1222 gpm.set_fader_name ("AudioTrackFader");
1224 if (_route->active()) {
1225 set_name ("AudioBusStripBase");
1226 gpm.set_meter_strip_name ("AudioBusStripBase");
1228 set_name ("AudioBusStripBaseInactive");
1229 gpm.set_meter_strip_name ("AudioBusStripBaseInactive");
1231 gpm.set_fader_name ("AudioBusFader");
1233 /* (no MIDI busses yet) */
1238 MixerStrip::mix_group() const
1240 return _route->mix_group();
1244 MixerStrip::engine_stopped ()
1249 MixerStrip::engine_running ()
1254 MixerStrip::meter_changed (void *src)
1257 ENSURE_GUI_THREAD (bind (mem_fun(*this, &MixerStrip::meter_changed), src));
1259 switch (_route->meter_point()) {
1261 meter_point_label.set_text (_("input"));
1265 meter_point_label.set_text (_("pre"));
1268 case MeterPostFader:
1269 meter_point_label.set_text (_("post"));
1273 gpm.setup_meters ();