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 Gtk::Image *width_icon = manage (new Gtk::Image (::get_icon("strip_width")));
118 Gtk::Image *hide_icon = manage (new Gtk::Image (::get_icon("hide")));
119 width_button.add (*width_icon);
120 hide_button.add (*hide_icon);
122 input_label.set_text (_("Input"));
123 input_button.add (input_label);
124 input_button.set_name ("MixerIOButton");
125 input_label.set_name ("MixerIOButtonLabel");
127 output_label.set_text (_("Output"));
128 output_button.add (output_label);
129 output_button.set_name ("MixerIOButton");
130 output_label.set_name ("MixerIOButtonLabel");
132 _route->meter_change.connect (mem_fun(*this, &MixerStrip::meter_changed));
133 meter_point_button.add (meter_point_label);
134 meter_point_button.set_name ("MixerStripMeterPreButton");
135 meter_point_label.set_name ("MixerStripMeterPreButton");
137 switch (_route->meter_point()) {
139 meter_point_label.set_text (_("input"));
143 meter_point_label.set_text (_("pre"));
147 meter_point_label.set_text (_("post"));
151 /* TRANSLATORS: this string should be longest of the strings
152 used to describe meter points. In english, it's "input".
154 set_size_request_to_display_given_text (meter_point_button, _("tupni"), 5, 5);
156 bottom_button_table.attach (meter_point_button, 1, 2, 0, 1);
158 meter_point_button.signal_button_press_event().connect (mem_fun (gpm, &GainMeter::meter_press), false);
159 /* XXX what is this meant to do? */
160 //meter_point_button.signal_button_release_event().connect (mem_fun (gpm, &GainMeter::meter_release), false);
162 hide_button.set_events (hide_button.get_events() & ~(Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK));
164 mute_button->set_name ("MixerMuteButton");
165 solo_button->set_name ("MixerSoloButton");
167 button_table.set_homogeneous (true);
168 button_table.set_spacings (0);
170 button_table.attach (name_button, 0, 2, 0, 1);
171 button_table.attach (input_button, 0, 2, 1, 2);
173 middle_button_table.set_homogeneous (true);
174 middle_button_table.set_spacings (0);
175 middle_button_table.attach (*mute_button, 0, 1, 0, 1);
176 middle_button_table.attach (*solo_button, 1, 2, 0, 1);
178 bottom_button_table.set_col_spacings (0);
179 bottom_button_table.set_homogeneous (true);
180 bottom_button_table.attach (group_button, 0, 1, 0, 1);
182 if (is_audio_track()) {
184 rec_enable_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::rec_enable_press), false);
185 rec_enable_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::rec_enable_release));
187 rec_enable_button->set_name ("MixerRecordEnableButton");
189 boost::shared_ptr<AudioTrack> at = audio_track();
191 at->FreezeChange.connect (mem_fun(*this, &MixerStrip::map_frozen));
193 #ifdef VARISPEED_IN_MIXER_STRIP
194 speed_adjustment.signal_value_changed().connect (mem_fun(*this, &MixerStrip::speed_adjustment_changed));
196 speed_frame.set_name ("BaseFrame");
197 speed_frame.set_shadow_type (Gtk::SHADOW_IN);
198 speed_frame.add (speed_spinner);
200 speed_spinner.set_print_func (speed_printer, 0);
202 ARDOUR_UI::instance()->tooltips().set_tip (speed_spinner, _("Varispeed"));
204 button_table.attach (speed_frame, 0, 2, 5, 6);
205 #endif /* VARISPEED_IN_MIXER_STRIP */
207 button_table.attach (*rec_enable_button, 0, 2, 2, 3);
210 name_button.add (name_label);
211 name_button.set_name ("MixerNameButton");
212 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2);
214 name_label.set_name ("MixerNameButtonLabel");
215 if (_route->phase_invert()) {
216 name_label.set_text (X_("Ø ") + name_label.get_text());
218 name_label.set_text (_route->name());
221 group_button.add (group_label);
222 group_button.set_name ("MixerGroupButton");
223 group_label.set_name ("MixerGroupButtonLabel");
225 comment_button.set_name ("MixerCommentButton");
227 ARDOUR_UI::instance()->tooltips().set_tip (comment_button, _route->comment()=="" ?
228 _("Click to Add/Edit Comments"):
231 comment_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::comment_button_clicked));
233 global_vpacker.set_border_width (0);
234 global_vpacker.set_spacing (0);
236 VBox *whvbox = manage (new VBox);
238 width_button.set_name ("MixerWidthButton");
239 hide_button.set_name ("MixerHideButton");
240 top_event_box.set_name ("MixerTopEventBox");
242 width_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::width_clicked));
243 hide_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::hide_clicked));
245 width_hide_box.pack_start (width_button, false, true);
246 width_hide_box.pack_start (top_event_box, true, true);
247 width_hide_box.pack_end (hide_button, false, true);
248 Gtk::Alignment *gain_meter_alignment = Gtk::manage(new Gtk::Alignment());
249 gain_meter_alignment->set_padding(0, 4, 0, 0);
250 gain_meter_alignment->add(gpm);
252 whvbox->pack_start (width_hide_box, true, true);
254 global_vpacker.pack_start (*whvbox, Gtk::PACK_SHRINK);
255 global_vpacker.pack_start (button_table,Gtk::PACK_SHRINK);
256 global_vpacker.pack_start (pre_processor_box, true, true);
257 global_vpacker.pack_start (middle_button_table,Gtk::PACK_SHRINK);
258 global_vpacker.pack_start (*gain_meter_alignment,Gtk::PACK_SHRINK);
259 global_vpacker.pack_start (bottom_button_table,Gtk::PACK_SHRINK);
260 global_vpacker.pack_start (post_processor_box, true, true);
261 if (!is_midi_track())
262 global_vpacker.pack_start (panners, Gtk::PACK_SHRINK);
263 global_vpacker.pack_start (output_button, Gtk::PACK_SHRINK);
264 global_vpacker.pack_start (comment_button, Gtk::PACK_SHRINK);
266 if (route()->is_master() || route()->is_control()) {
268 if (scrollbar_height == 0) {
269 HScrollbar scrollbar;
270 Gtk::Requisition requisition(scrollbar.size_request ());
271 scrollbar_height = requisition.height;
274 EventBox* spacer = manage (new EventBox);
275 spacer->set_size_request (-1, scrollbar_height);
276 global_vpacker.pack_start (*spacer, false, false);
279 global_frame.add (global_vpacker);
280 global_frame.set_shadow_type (Gtk::SHADOW_IN);
281 global_frame.set_name ("BaseFrame");
285 /* force setting of visible selected status */
288 set_selected (false);
293 _session.engine().Stopped.connect (mem_fun(*this, &MixerStrip::engine_stopped));
294 _session.engine().Running.connect (mem_fun(*this, &MixerStrip::engine_running));
295 _route->input_changed.connect (mem_fun(*this, &MixerStrip::input_changed));
296 _route->output_changed.connect (mem_fun(*this, &MixerStrip::output_changed));
297 _route->mute_changed.connect (mem_fun(*this, &RouteUI::mute_changed));
298 _route->solo_changed.connect (mem_fun(*this, &RouteUI::solo_changed));
299 _route->solo_safe_changed.connect (mem_fun(*this, &RouteUI::solo_changed));
300 _route->mix_group_changed.connect (mem_fun(*this, &MixerStrip::mix_group_changed));
301 _route->panner().Changed.connect (mem_fun(*this, &MixerStrip::connect_to_pan));
303 if (is_audio_track()) {
304 audio_track()->DiskstreamChanged.connect (mem_fun(*this, &MixerStrip::diskstream_changed));
305 get_diskstream()->SpeedChanged.connect (mem_fun(*this, &MixerStrip::speed_changed));
308 _route->NameChanged.connect (mem_fun(*this, &RouteUI::name_changed));
309 _route->comment_changed.connect (mem_fun(*this, &MixerStrip::comment_changed));
310 _route->gui_changed.connect (mem_fun(*this, &MixerStrip::route_gui_changed));
312 input_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::input_press), false);
313 output_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::output_press), false);
315 solo_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::solo_press), false);
316 solo_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::solo_release), false);
317 mute_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::mute_press), false);
318 mute_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::mute_release), false);
320 name_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::name_button_button_press), false);
321 group_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::select_mix_group), false);
324 set_stuff_from_route ();
326 /* start off as a passthru strip. we'll correct this, if necessary,
327 in update_diskstream_display().
331 set_name ("MidiTrackStripBase");
333 set_name ("AudioTrackStripBase");
335 /* now force an update of all the various elements */
337 pre_processor_box.update();
338 post_processor_box.update();
343 mix_group_changed (0);
347 panners.setup_pan ();
349 if (is_audio_track()) {
353 update_diskstream_display ();
354 update_input_display ();
355 update_output_display ();
357 add_events (Gdk::BUTTON_RELEASE_MASK);
362 gain_meter_alignment->show();
364 pre_processor_box.show();
367 width_hide_box.show();
369 global_vpacker.show();
371 middle_button_table.show();
372 bottom_button_table.show();
373 gain_unit_button.show();
374 gain_unit_label.show();
375 meter_point_button.show();
376 meter_point_label.show();
377 diskstream_button.show();
378 diskstream_label.show();
381 output_button.show();
385 comment_button.show();
388 speed_spinner.show();
395 MixerStrip::~MixerStrip ()
397 GoingAway(); /* EMIT_SIGNAL */
399 if (input_selector) {
400 delete input_selector;
403 if (output_selector) {
404 delete output_selector;
409 MixerStrip::set_stuff_from_route ()
415 /* if width is not set, it will be set by the MixerUI or editor */
417 if ((prop = xml_node->property ("strip_width")) != 0) {
418 set_width (Width (string_2_enum (prop->value(), _width)), this);
421 if ((prop = xml_node->property ("shown_mixer")) != 0) {
422 if (prop->value() == "no") {
423 _marked_for_display = false;
425 _marked_for_display = true;
428 /* backwards compatibility */
429 _marked_for_display = true;
434 MixerStrip::set_width (Width w, void* owner)
436 /* always set the gpm width again, things may be hidden */
439 panners.set_width (w);
440 pre_processor_box.set_width (w);
441 post_processor_box.set_width (w);
443 boost::shared_ptr<AutomationList> gain_automation = _route->gain_control()->list();
445 _width_owner = owner;
455 if (_width_owner == this) {
456 xml_node->add_property ("strip_width", enum_2_string (_width));
461 set_size_request (-1, -1);
463 if (rec_enable_button) {
464 ((Gtk::Label*)rec_enable_button->get_child())->set_text (_("record"));
466 ((Gtk::Label*)mute_button->get_child())->set_text (_("Mute"));
467 ((Gtk::Label*)solo_button->get_child())->set_text (_("Solo"));
469 if (_route->comment() == "") {
470 comment_button.unset_bg (STATE_NORMAL);
471 ((Gtk::Label*)comment_button.get_child())->set_text (_("comments"));
473 comment_button.modify_bg (STATE_NORMAL, color());
474 ((Gtk::Label*)comment_button.get_child())->set_text (_("*comments*"));
477 ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (gpm.astyle_string(gain_automation->automation_style()));
478 ((Gtk::Label*)gpm.gain_automation_state_button.get_child())->set_text (gpm.astate_string(gain_automation->automation_state()));
479 ((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text (panners.astyle_string(_route->panner().automation_style()));
480 ((Gtk::Label*)panners.pan_automation_state_button.get_child())->set_text (panners.astate_string(_route->panner().automation_state()));
481 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "long", 2, 2);
485 if (rec_enable_button) {
486 ((Gtk::Label*)rec_enable_button->get_child())->set_text (_("Rec"));
488 ((Gtk::Label*)mute_button->get_child())->set_text (_("M"));
489 ((Gtk::Label*)solo_button->get_child())->set_text (_("S"));
491 if (_route->comment() == "") {
492 comment_button.unset_bg (STATE_NORMAL);
493 ((Gtk::Label*)comment_button.get_child())->set_text (_("Cmt"));
495 comment_button.modify_bg (STATE_NORMAL, color());
496 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Cmt*"));
499 ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (gpm.short_astyle_string(gain_automation->automation_style()));
500 ((Gtk::Label*)gpm.gain_automation_state_button.get_child())->set_text (gpm.short_astate_string(gain_automation->automation_state()));
501 ((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text (panners.short_astyle_string(_route->panner().automation_style()));
502 ((Gtk::Label*)panners.pan_automation_state_button.get_child())->set_text (panners.short_astate_string(_route->panner().automation_state()));
503 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2);
504 set_size_request (max (50, gpm.get_gm_width()), -1);
508 update_input_display ();
509 update_output_display ();
510 mix_group_changed (0);
516 MixerStrip::set_packed (bool yn)
523 xml_node->add_property ("shown_mixer", "yes");
525 xml_node->add_property ("shown_mixer", "no");
531 MixerStrip::output_press (GdkEventButton *ev)
533 using namespace Menu_Helpers;
534 if (!_session.engine().connected()) {
535 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
540 MenuList& citems = output_menu.items();
541 switch (ev->button) {
544 output_menu.set_name ("ArdourContextMenu");
547 citems.push_back (MenuElem (_("Edit"), mem_fun(*this, &MixerStrip::edit_output_configuration)));
548 citems.push_back (SeparatorElem());
549 citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_output)));
550 citems.push_back (SeparatorElem());
552 _session.foreach_bundle (this, &MixerStrip::add_bundle_to_output_menu);
554 output_menu.popup (1, ev->time);
564 MixerStrip::edit_output_configuration ()
566 if (output_selector == 0) {
567 output_selector = new IOSelectorWindow (_session, _route, false);
570 if (output_selector->is_visible()) {
571 output_selector->get_toplevel()->get_window()->raise();
573 output_selector->present ();
578 MixerStrip::edit_input_configuration ()
580 if (input_selector == 0) {
581 input_selector = new IOSelectorWindow (_session, _route, true);
584 if (input_selector->is_visible()) {
585 input_selector->get_toplevel()->get_window()->raise();
587 input_selector->present ();
592 MixerStrip::input_press (GdkEventButton *ev)
594 using namespace Menu_Helpers;
596 MenuList& citems = input_menu.items();
597 input_menu.set_name ("ArdourContextMenu");
600 if (!_session.engine().connected()) {
601 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
606 switch (ev->button) {
609 citems.push_back (MenuElem (_("Edit"), mem_fun(*this, &MixerStrip::edit_input_configuration)));
610 citems.push_back (SeparatorElem());
611 citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_input)));
612 citems.push_back (SeparatorElem());
614 _session.foreach_bundle (this, &MixerStrip::add_bundle_to_input_menu);
616 input_menu.popup (1, ev->time);
626 MixerStrip::bundle_input_chosen (ARDOUR::Bundle *c)
628 if (!ignore_toggle) {
631 _route->use_input_bundle (*c, this);
634 catch (AudioEngine::PortRegistrationFailure& err) {
635 error << _("could not register new ports required for that bundle")
642 MixerStrip::bundle_output_chosen (ARDOUR::Bundle *c)
644 if (!ignore_toggle) {
647 _route->use_output_bundle (*c, this);
650 catch (AudioEngine::PortRegistrationFailure& err) {
651 error << _("could not register new ports required for that bundle")
658 MixerStrip::add_bundle_to_input_menu (ARDOUR::Bundle* c)
660 using namespace Menu_Helpers;
662 if (dynamic_cast<InputBundle *> (c) == 0) {
666 MenuList& citems = input_menu.items();
668 if (c->nchannels() == _route->n_inputs().n_total()) {
670 citems.push_back (CheckMenuElem (c->name(), bind (mem_fun(*this, &MixerStrip::bundle_input_chosen), c)));
672 ARDOUR::Bundle *current = _route->input_bundle();
675 ignore_toggle = true;
676 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
677 ignore_toggle = false;
683 MixerStrip::add_bundle_to_output_menu (ARDOUR::Bundle* c)
685 using namespace Menu_Helpers;
687 if (dynamic_cast<OutputBundle *> (c) == 0) {
691 if (c->nchannels() == _route->n_outputs().n_total()) {
693 MenuList& citems = output_menu.items();
694 citems.push_back (CheckMenuElem (c->name(), bind (mem_fun(*this, &MixerStrip::bundle_output_chosen), c)));
696 ARDOUR::Bundle *current = _route->output_bundle();
699 ignore_toggle = true;
700 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
701 ignore_toggle = false;
707 MixerStrip::update_diskstream_display ()
713 update_input_display ();
715 if (input_selector) {
716 input_selector->hide_all ();
725 update_input_display ();
726 show_passthru_color ();
731 MixerStrip::connect_to_pan ()
733 ENSURE_GUI_THREAD(mem_fun(*this, &MixerStrip::connect_to_pan));
735 panstate_connection.disconnect ();
736 panstyle_connection.disconnect ();
738 if (!_route->panner().empty()) {
739 StreamPanner* sp = _route->panner().front();
741 panstate_connection = sp->pan_control()->list()->automation_state_changed.connect (mem_fun(panners, &PannerUI::pan_automation_state_changed));
742 panstyle_connection = sp->pan_control()->list()->automation_style_changed.connect (mem_fun(panners, &PannerUI::pan_automation_style_changed));
745 panners.pan_changed (this);
749 MixerStrip::update_input_display ()
753 if ((c = _route->input_bundle()) != 0) {
754 input_label.set_text (c->name());
758 input_label.set_text (_(" Input"));
761 input_label.set_text (_("I"));
765 panners.setup_pan ();
769 MixerStrip::update_output_display ()
773 if ((c = _route->output_bundle()) != 0) {
774 output_label.set_text (c->name());
778 output_label.set_text (_("Output"));
781 output_label.set_text (_("O"));
786 panners.setup_pan ();
790 MixerStrip::fast_update ()
792 gpm.update_meters ();
796 MixerStrip::diskstream_changed ()
798 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_diskstream_display));
802 MixerStrip::input_changed (IOChange change, void *src)
804 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_input_display));
808 MixerStrip::output_changed (IOChange change, void *src)
810 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_output_display));
815 MixerStrip::comment_editor_done_editing()
817 string str = comment_area->get_buffer()->get_text();
818 if (_route->comment() != str) {
819 _route->set_comment (str, this);
825 comment_button.modify_bg (STATE_NORMAL, color());
826 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Comments*"));
828 comment_button.unset_bg (STATE_NORMAL);
829 ((Gtk::Label*)comment_button.get_child())->set_text (_("Comments"));
835 comment_button.modify_bg (STATE_NORMAL, color());
836 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Cmt*"));
838 comment_button.unset_bg (STATE_NORMAL);
839 ((Gtk::Label*)comment_button.get_child())->set_text (_("Cmt"));
844 ARDOUR_UI::instance()->tooltips().set_tip (comment_button,
845 str.empty() ? _("Click to Add/Edit Comments") : str);
851 MixerStrip::comment_button_clicked ()
853 if (comment_window == 0) {
854 setup_comment_editor ();
857 int x, y, cw_width, cw_height;
859 if (comment_window->is_visible()) {
860 comment_window->hide ();
864 comment_window->get_size (cw_width, cw_height);
865 comment_window->get_position(x, y);
866 comment_window->move(x, y - (cw_height / 2) - 45);
868 half the dialog height minus the comments button height
869 with some window decoration fudge thrown in.
872 comment_window->show();
873 comment_window->present();
877 MixerStrip::setup_comment_editor ()
880 title = _route->name();
881 title += _(": comment editor");
883 comment_window = new ArdourDialog (title, false);
884 comment_window->set_position (Gtk::WIN_POS_MOUSE);
885 comment_window->set_skip_taskbar_hint (true);
886 comment_window->signal_hide().connect (mem_fun(*this, &MixerStrip::comment_editor_done_editing));
888 comment_area = manage (new TextView());
889 comment_area->set_name ("MixerTrackCommentArea");
890 comment_area->set_size_request (110, 178);
891 comment_area->set_wrap_mode (WRAP_WORD);
892 comment_area->set_editable (true);
893 comment_area->get_buffer()->set_text (_route->comment());
894 comment_area->show ();
896 comment_window->get_vbox()->pack_start (*comment_area);
897 comment_window->get_action_area()->hide();
901 MixerStrip::comment_changed (void *src)
903 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::comment_changed), src));
906 ignore_comment_edit = true;
908 comment_area->get_buffer()->set_text (_route->comment());
910 ignore_comment_edit = false;
915 MixerStrip::set_mix_group (RouteGroup *rg)
917 _route->set_mix_group (rg, this);
921 MixerStrip::add_mix_group_to_menu (RouteGroup *rg, RadioMenuItem::Group* group)
923 using namespace Menu_Helpers;
925 MenuList& items = group_menu->items();
927 items.push_back (RadioMenuElem (*group, rg->name(), bind (mem_fun(*this, &MixerStrip::set_mix_group), rg)));
929 if (_route->mix_group() == rg) {
930 static_cast<RadioMenuItem*>(&items.back())->set_active ();
935 MixerStrip::select_mix_group (GdkEventButton *ev)
937 using namespace Menu_Helpers;
939 if (group_menu == 0) {
940 group_menu = new Menu;
942 group_menu->set_name ("ArdourContextMenu");
943 MenuList& items = group_menu->items();
944 RadioMenuItem::Group group;
946 switch (ev->button) {
950 items.push_back (RadioMenuElem (group, _("No group"), bind (mem_fun(*this, &MixerStrip::set_mix_group), (RouteGroup *) 0)));
952 _session.foreach_mix_group (bind (mem_fun (*this, &MixerStrip::add_mix_group_to_menu), &group));
954 group_menu->popup (1, ev->time);
965 MixerStrip::mix_group_changed (void *ignored)
967 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::mix_group_changed), ignored));
969 RouteGroup *rg = _route->mix_group();
972 group_label.set_text (rg->name());
976 group_label.set_text (_("Grp"));
979 group_label.set_text (_("~G"));
987 MixerStrip::route_gui_changed (string what_changed, void* ignored)
989 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::route_gui_changed), what_changed, ignored));
991 if (what_changed == "color") {
992 if (set_color_from_route () == 0) {
999 MixerStrip::show_route_color ()
1001 name_button.modify_bg (STATE_NORMAL, color());
1002 top_event_box.modify_bg (STATE_NORMAL, color());
1003 route_active_changed ();
1007 MixerStrip::show_passthru_color ()
1009 route_active_changed ();
1013 MixerStrip::build_route_ops_menu ()
1015 using namespace Menu_Helpers;
1016 route_ops_menu = manage (new Menu);
1017 route_ops_menu->set_name ("ArdourContextMenu");
1019 MenuList& items = route_ops_menu->items();
1021 items.push_back (MenuElem (_("Rename"), mem_fun(*this, &RouteUI::route_rename)));
1022 items.push_back (SeparatorElem());
1023 items.push_back (CheckMenuElem (_("Active"), mem_fun (*this, &RouteUI::toggle_route_active)));
1024 route_active_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
1025 route_active_menu_item->set_active (_route->active());
1027 items.push_back (SeparatorElem());
1029 items.push_back (MenuElem (_("Adjust latency"), mem_fun (*this, &RouteUI::adjust_latency)));
1031 items.push_back (SeparatorElem());
1032 items.push_back (CheckMenuElem (_("Invert Polarity"), mem_fun (*this, &RouteUI::toggle_polarity)));
1033 polarity_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
1034 polarity_menu_item->set_active (_route->phase_invert());
1035 items.push_back (CheckMenuElem (_("Protect against denormals"), mem_fun (*this, &RouteUI::toggle_denormal_protection)));
1036 denormal_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
1037 denormal_menu_item->set_active (_route->denormal_protection());
1039 build_remote_control_menu ();
1041 items.push_back (SeparatorElem());
1042 items.push_back (MenuElem (_("Remote Control ID"), *remote_control_menu));
1044 items.push_back (SeparatorElem());
1045 items.push_back (MenuElem (_("Remove"), mem_fun(*this, &RouteUI::remove_this_route)));
1049 MixerStrip::name_button_button_press (GdkEventButton* ev)
1051 if (ev->button == 1) {
1052 list_route_operations ();
1054 Menu_Helpers::MenuList& items = route_ops_menu->items();
1055 /* do not allow rename if the track is record-enabled */
1056 static_cast<MenuItem*> (&items.front())->set_sensitive (!_route->record_enabled());
1058 route_ops_menu->popup (1, ev->time);
1064 MixerStrip::list_route_operations ()
1066 if (route_ops_menu == 0) {
1067 build_route_ops_menu ();
1070 refresh_remote_control_menu();
1075 MixerStrip::speed_adjustment_changed ()
1077 /* since there is a usable speed adjustment, there has to be a diskstream */
1078 if (!ignore_speed_adjustment) {
1079 get_diskstream()->set_speed (speed_adjustment.get_value());
1084 MixerStrip::speed_changed ()
1086 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_speed_display));
1090 MixerStrip::update_speed_display ()
1094 val = get_diskstream()->speed();
1097 speed_spinner.set_name ("MixerStripSpeedBaseNotOne");
1099 speed_spinner.set_name ("MixerStripSpeedBase");
1102 if (speed_adjustment.get_value() != val) {
1103 ignore_speed_adjustment = true;
1104 speed_adjustment.set_value (val);
1105 ignore_speed_adjustment = false;
1111 MixerStrip::set_selected (bool yn)
1113 AxisView::set_selected (yn);
1115 global_frame.set_shadow_type (Gtk::SHADOW_ETCHED_OUT);
1116 global_frame.set_name ("MixerStripSelectedFrame");
1118 global_frame.set_shadow_type (Gtk::SHADOW_IN);
1119 global_frame.set_name ("MixerStripFrame");
1121 global_frame.queue_draw ();
1125 MixerStrip::name_changed ()
1129 RouteUI::name_changed ();
1132 name_label.set_text (PBD::short_version (_route->name(), 5));
1135 if (_route->phase_invert()) {
1136 name_label.set_text (X_("Ø ") + name_label.get_text());
1141 MixerStrip::width_clicked ()
1145 set_width (Narrow, this);
1148 set_width (Wide, this);
1154 MixerStrip::hide_clicked ()
1156 // LAME fix to reset the button status for when it is redisplayed (part 1)
1157 hide_button.set_sensitive(false);
1160 Hiding(); /* EMIT_SIGNAL */
1162 _mixer.hide_strip (this);
1166 hide_button.set_sensitive(true);
1170 MixerStrip::set_embedded (bool yn)
1176 MixerStrip::map_frozen ()
1178 ENSURE_GUI_THREAD (mem_fun(*this, &MixerStrip::map_frozen));
1180 boost::shared_ptr<AudioTrack> at = audio_track();
1183 switch (at->freeze_state()) {
1184 case AudioTrack::Frozen:
1185 pre_processor_box.set_sensitive (false);
1186 post_processor_box.set_sensitive (false);
1187 speed_spinner.set_sensitive (false);
1190 pre_processor_box.set_sensitive (true);
1191 post_processor_box.set_sensitive (true);
1192 speed_spinner.set_sensitive (true);
1196 _route->foreach_processor (this, &MixerStrip::hide_processor_editor);
1200 MixerStrip::hide_processor_editor (boost::shared_ptr<Processor> processor)
1202 void* gui = processor->get_gui ();
1205 static_cast<Gtk::Widget*>(gui)->hide ();
1210 MixerStrip::route_active_changed ()
1212 RouteUI::route_active_changed ();
1214 if (is_midi_track()) {
1215 if (_route->active()) {
1216 set_name ("MidiTrackStripBase");
1217 gpm.set_meter_strip_name ("MidiTrackStripBase");
1219 set_name ("MidiTrackStripBaseInactive");
1220 gpm.set_meter_strip_name ("MidiTrackStripBaseInactive");
1222 gpm.set_fader_name ("MidiTrackFader");
1223 } else if (is_audio_track()) {
1224 if (_route->active()) {
1225 set_name ("AudioTrackStripBase");
1226 gpm.set_meter_strip_name ("AudioTrackStripBase");
1228 set_name ("AudioTrackStripBaseInactive");
1229 gpm.set_meter_strip_name ("AudioTrackStripBaseInactive");
1231 gpm.set_fader_name ("AudioTrackFader");
1233 if (_route->active()) {
1234 set_name ("AudioBusStripBase");
1235 gpm.set_meter_strip_name ("AudioBusStripBase");
1237 set_name ("AudioBusStripBaseInactive");
1238 gpm.set_meter_strip_name ("AudioBusStripBaseInactive");
1240 gpm.set_fader_name ("AudioBusFader");
1242 /* (no MIDI busses yet) */
1247 MixerStrip::mix_group() const
1249 return _route->mix_group();
1253 MixerStrip::engine_stopped ()
1258 MixerStrip::engine_running ()
1263 MixerStrip::meter_changed (void *src)
1266 ENSURE_GUI_THREAD (bind (mem_fun(*this, &MixerStrip::meter_changed), src));
1268 switch (_route->meter_point()) {
1270 meter_point_label.set_text (_("input"));
1274 meter_point_label.set_text (_("pre"));
1277 case MeterPostFader:
1278 meter_point_label.set_text (_("post"));
1282 gpm.setup_meters ();