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/profile.h>
45 #include <ardour/ladspa_plugin.h>
46 #include <ardour/auto_bundle.h>
47 #include <ardour/user_bundle.h>
49 #include "ardour_ui.h"
50 #include "ardour_dialog.h"
51 #include "mixer_strip.h"
54 #include "public_editor.h"
56 #include "io_selector.h"
58 #include "gui_thread.h"
63 using namespace ARDOUR;
66 using namespace Gtkmm2ext;
69 int MixerStrip::scrollbar_height = 0;
71 #ifdef VARISPEED_IN_MIXER_STRIP
73 speed_printer (char buf[32], Gtk::Adjustment& adj, void* arg)
75 float val = adj.get_value ();
80 snprintf (buf, 32, "%.3f", val);
85 MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, boost::shared_ptr<Route> rt, bool in_mixer)
87 RouteUI (rt, sess, _("Mute"), _("Solo"), _("Record")),
89 _mixer_owned (in_mixer),
90 pre_processor_box (PreFader, sess, rt, mx.plugin_selector(), mx.selection(), in_mixer),
91 post_processor_box (PostFader, sess, rt, mx.plugin_selector(), mx.selection(), in_mixer),
93 panners (_route, sess),
95 middle_button_table (1, 2),
96 bottom_button_table (1, 2),
97 meter_point_label (_("pre")),
98 comment_button (_("Comments")),
99 speed_adjustment (1.0, 0.001, 4.0, 0.001, 0.1),
100 speed_spinner (&speed_adjustment, "MixerStripSpeedBase", true)
103 if (set_color_from_route()) {
104 set_color (unique_random_color());
110 if (!_route->is_hidden()) {
111 _marked_for_display = true;
114 ignore_comment_edit = false;
115 ignore_toggle = false;
116 ignore_speed_adjustment = false;
121 Gtk::Image *width_icon = manage (new Gtk::Image (::get_icon("strip_width")));
122 Gtk::Image *hide_icon = manage (new Gtk::Image (::get_icon("hide")));
123 width_button.add (*width_icon);
124 hide_button.add (*hide_icon);
126 input_label.set_text (_("Input"));
127 input_button.add (input_label);
128 input_button.set_name ("MixerIOButton");
129 input_label.set_name ("MixerIOButtonLabel");
131 output_label.set_text (_("Output"));
132 output_button.add (output_label);
133 output_button.set_name ("MixerIOButton");
134 output_label.set_name ("MixerIOButtonLabel");
136 _route->meter_change.connect (mem_fun(*this, &MixerStrip::meter_changed));
137 meter_point_button.add (meter_point_label);
138 meter_point_button.set_name ("MixerStripMeterPreButton");
139 meter_point_label.set_name ("MixerStripMeterPreButton");
141 switch (_route->meter_point()) {
143 meter_point_label.set_text (_("input"));
147 meter_point_label.set_text (_("pre"));
151 meter_point_label.set_text (_("post"));
155 /* TRANSLATORS: this string should be longest of the strings
156 used to describe meter points. In english, it's "input".
158 set_size_request_to_display_given_text (meter_point_button, _("tupni"), 5, 5);
160 bottom_button_table.attach (meter_point_button, 1, 2, 0, 1);
162 meter_point_button.signal_button_press_event().connect (mem_fun (gpm, &GainMeter::meter_press), false);
163 /* XXX what is this meant to do? */
164 //meter_point_button.signal_button_release_event().connect (mem_fun (gpm, &GainMeter::meter_release), false);
166 hide_button.set_events (hide_button.get_events() & ~(Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK));
168 mute_button->set_name ("MixerMuteButton");
169 solo_button->set_name ("MixerSoloButton");
171 button_table.set_homogeneous (true);
172 button_table.set_spacings (0);
174 button_table.attach (name_button, 0, 2, 0, 1);
175 button_table.attach (input_button, 0, 2, 1, 2);
177 middle_button_table.set_homogeneous (true);
178 middle_button_table.set_spacings (0);
179 middle_button_table.attach (*mute_button, 0, 1, 0, 1);
180 middle_button_table.attach (*solo_button, 1, 2, 0, 1);
182 bottom_button_table.set_col_spacings (0);
183 bottom_button_table.set_homogeneous (true);
184 bottom_button_table.attach (group_button, 0, 1, 0, 1);
186 if (is_audio_track()) {
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 */
207 if(rec_enable_button) {
208 rec_enable_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::rec_enable_press), false);
209 rec_enable_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::rec_enable_release));
211 rec_enable_button->set_name ("MixerRecordEnableButton");
212 button_table.attach (*rec_enable_button, 0, 2, 2, 3);
215 name_button.add (name_label);
216 name_button.set_name ("MixerNameButton");
217 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2);
219 name_label.set_name ("MixerNameButtonLabel");
220 if (_route->phase_invert()) {
221 name_label.set_text (X_("Ø ") + name_label.get_text());
223 name_label.set_text (_route->name());
226 group_button.add (group_label);
227 group_button.set_name ("MixerGroupButton");
228 group_label.set_name ("MixerGroupButtonLabel");
230 comment_button.set_name ("MixerCommentButton");
232 ARDOUR_UI::instance()->tooltips().set_tip (comment_button, _route->comment()=="" ?
233 _("Click to Add/Edit Comments"):
236 comment_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::comment_button_clicked));
238 global_vpacker.set_border_width (0);
239 global_vpacker.set_spacing (0);
241 VBox *whvbox = manage (new VBox);
243 width_button.set_name ("MixerWidthButton");
244 hide_button.set_name ("MixerHideButton");
245 top_event_box.set_name ("MixerTopEventBox");
247 width_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::width_clicked));
248 hide_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::hide_clicked));
250 width_hide_box.pack_start (width_button, false, true);
251 width_hide_box.pack_start (top_event_box, true, true);
252 width_hide_box.pack_end (hide_button, false, true);
253 Gtk::Alignment *gain_meter_alignment = Gtk::manage(new Gtk::Alignment());
254 gain_meter_alignment->set_padding(0, 4, 0, 0);
255 gain_meter_alignment->add(gpm);
257 whvbox->pack_start (width_hide_box, true, true);
259 global_vpacker.pack_start (*whvbox, Gtk::PACK_SHRINK);
260 global_vpacker.pack_start (button_table,Gtk::PACK_SHRINK);
261 global_vpacker.pack_start (pre_processor_box, true, true);
262 global_vpacker.pack_start (middle_button_table,Gtk::PACK_SHRINK);
263 global_vpacker.pack_start (*gain_meter_alignment,Gtk::PACK_SHRINK);
264 global_vpacker.pack_start (bottom_button_table,Gtk::PACK_SHRINK);
265 global_vpacker.pack_start (post_processor_box, true, true);
266 if (!is_midi_track()) {
267 global_vpacker.pack_start (panners, Gtk::PACK_SHRINK);
269 global_vpacker.pack_start (output_button, Gtk::PACK_SHRINK);
270 global_vpacker.pack_start (comment_button, Gtk::PACK_SHRINK);
272 if (route()->is_master() || route()->is_control()) {
274 if (scrollbar_height == 0) {
275 HScrollbar scrollbar;
276 Gtk::Requisition requisition(scrollbar.size_request ());
277 scrollbar_height = requisition.height;
280 EventBox* spacer = manage (new EventBox);
281 spacer->set_size_request (-1, scrollbar_height);
282 global_vpacker.pack_start (*spacer, false, false);
285 global_frame.add (global_vpacker);
286 global_frame.set_shadow_type (Gtk::SHADOW_IN);
287 global_frame.set_name ("BaseFrame");
291 /* force setting of visible selected status */
294 set_selected (false);
299 _session.engine().Stopped.connect (mem_fun(*this, &MixerStrip::engine_stopped));
300 _session.engine().Running.connect (mem_fun(*this, &MixerStrip::engine_running));
301 _route->input_changed.connect (mem_fun(*this, &MixerStrip::input_changed));
302 _route->output_changed.connect (mem_fun(*this, &MixerStrip::output_changed));
303 _route->mute_changed.connect (mem_fun(*this, &RouteUI::mute_changed));
304 _route->solo_changed.connect (mem_fun(*this, &RouteUI::solo_changed));
305 _route->solo_safe_changed.connect (mem_fun(*this, &RouteUI::solo_changed));
306 _route->mix_group_changed.connect (mem_fun(*this, &MixerStrip::mix_group_changed));
307 _route->panner().Changed.connect (mem_fun(*this, &MixerStrip::connect_to_pan));
309 if (is_audio_track()) {
310 audio_track()->DiskstreamChanged.connect (mem_fun(*this, &MixerStrip::diskstream_changed));
311 get_diskstream()->SpeedChanged.connect (mem_fun(*this, &MixerStrip::speed_changed));
314 _route->NameChanged.connect (mem_fun(*this, &RouteUI::name_changed));
315 _route->comment_changed.connect (mem_fun(*this, &MixerStrip::comment_changed));
316 _route->gui_changed.connect (mem_fun(*this, &MixerStrip::route_gui_changed));
318 input_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::input_press), false);
319 output_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::output_press), false);
321 solo_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::solo_press), false);
322 solo_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::solo_release), false);
323 mute_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::mute_press), false);
324 mute_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::mute_release), false);
326 name_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::name_button_button_press), false);
327 group_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::select_mix_group), false);
330 set_stuff_from_route ();
332 /* start off as a passthru strip. we'll correct this, if necessary,
333 in update_diskstream_display().
337 set_name ("MidiTrackStripBase");
339 set_name ("AudioTrackStripBase");
341 /* now force an update of all the various elements */
343 pre_processor_box.update();
344 post_processor_box.update();
349 mix_group_changed (0);
353 panners.setup_pan ();
355 if (is_audio_track()) {
359 update_diskstream_display ();
360 update_input_display ();
361 update_output_display ();
363 add_events (Gdk::BUTTON_RELEASE_MASK);
368 gain_meter_alignment->show_all();
370 pre_processor_box.show();
372 if (!route()->is_master() && !route()->is_control()) {
373 /* we don't allow master or control routes to be hidden */
377 width_hide_box.show();
379 global_vpacker.show();
381 middle_button_table.show();
382 bottom_button_table.show();
383 gain_unit_button.show();
384 gain_unit_label.show();
385 meter_point_button.show();
386 meter_point_label.show();
387 diskstream_button.show();
388 diskstream_label.show();
391 output_button.show();
395 comment_button.show();
398 speed_spinner.show();
405 MixerStrip::~MixerStrip ()
407 GoingAway(); /* EMIT_SIGNAL */
409 if (input_selector) {
410 delete input_selector;
413 if (output_selector) {
414 delete output_selector;
419 MixerStrip::set_stuff_from_route ()
425 /* if width is not set, it will be set by the MixerUI or editor */
427 if ((prop = xml_node->property ("strip_width")) != 0) {
428 set_width (Width (string_2_enum (prop->value(), _width)), this);
431 if ((prop = xml_node->property ("shown_mixer")) != 0) {
432 if (prop->value() == "no") {
433 _marked_for_display = false;
435 _marked_for_display = true;
438 /* backwards compatibility */
439 _marked_for_display = true;
444 MixerStrip::set_width (Width w, void* owner)
446 /* always set the gpm width again, things may be hidden */
449 panners.set_width (w);
450 pre_processor_box.set_width (w);
451 post_processor_box.set_width (w);
453 boost::shared_ptr<AutomationList> gain_automation = _route->gain_control()->alist();
455 _width_owner = owner;
461 if (_width_owner == this) {
462 xml_node->add_property ("strip_width", enum_2_string (_width));
467 set_size_request (-1, -1);
469 if (rec_enable_button) {
470 ((Gtk::Label*)rec_enable_button->get_child())->set_text (_("record"));
472 ((Gtk::Label*)mute_button->get_child())->set_text (_("Mute"));
473 ((Gtk::Label*)solo_button->get_child())->set_text (_("Solo"));
475 if (_route->comment() == "") {
476 comment_button.unset_bg (STATE_NORMAL);
477 ((Gtk::Label*)comment_button.get_child())->set_text (_("comments"));
479 comment_button.modify_bg (STATE_NORMAL, color());
480 ((Gtk::Label*)comment_button.get_child())->set_text (_("*comments*"));
483 ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (gpm.astyle_string(gain_automation->automation_style()));
484 ((Gtk::Label*)gpm.gain_automation_state_button.get_child())->set_text (gpm.astate_string(gain_automation->automation_state()));
485 ((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text (panners.astyle_string(_route->panner().automation_style()));
486 ((Gtk::Label*)panners.pan_automation_state_button.get_child())->set_text (panners.astate_string(_route->panner().automation_state()));
487 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "long", 2, 2);
491 if (rec_enable_button) {
492 ((Gtk::Label*)rec_enable_button->get_child())->set_text (_("Rec"));
494 ((Gtk::Label*)mute_button->get_child())->set_text (_("M"));
495 ((Gtk::Label*)solo_button->get_child())->set_text (_("S"));
497 if (_route->comment() == "") {
498 comment_button.unset_bg (STATE_NORMAL);
499 ((Gtk::Label*)comment_button.get_child())->set_text (_("Cmt"));
501 comment_button.modify_bg (STATE_NORMAL, color());
502 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Cmt*"));
505 ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (gpm.short_astyle_string(gain_automation->automation_style()));
506 ((Gtk::Label*)gpm.gain_automation_state_button.get_child())->set_text (gpm.short_astate_string(gain_automation->automation_state()));
507 ((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text (panners.short_astyle_string(_route->panner().automation_style()));
508 ((Gtk::Label*)panners.pan_automation_state_button.get_child())->set_text (panners.short_astate_string(_route->panner().automation_state()));
509 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2);
510 set_size_request (max (50, gpm.get_gm_width()), -1);
514 update_input_display ();
515 update_output_display ();
516 mix_group_changed (0);
522 MixerStrip::set_packed (bool yn)
529 xml_node->add_property ("shown_mixer", "yes");
531 xml_node->add_property ("shown_mixer", "no");
537 MixerStrip::output_press (GdkEventButton *ev)
539 using namespace Menu_Helpers;
540 if (!_session.engine().connected()) {
541 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
546 MenuList& citems = output_menu.items();
547 switch (ev->button) {
551 output_menu.set_name ("ArdourContextMenu");
554 citems.push_back (MenuElem (_("Edit"), mem_fun(*this, &MixerStrip::edit_output_configuration)));
555 citems.push_back (SeparatorElem());
556 citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_output)));
557 citems.push_back (SeparatorElem());
559 std::vector<boost::shared_ptr<Bundle> > current = _route->bundles_connected_to_outputs ();
561 _session.foreach_bundle (
562 bind (mem_fun (*this, &MixerStrip::add_bundle_to_output_menu), current)
565 output_menu.popup (1, ev->time);
576 MixerStrip::edit_output_configuration ()
578 if (output_selector == 0) {
579 output_selector = new IOSelectorWindow (_session, _route, false);
582 if (output_selector->is_visible()) {
583 output_selector->get_toplevel()->get_window()->raise();
585 output_selector->present ();
590 MixerStrip::edit_input_configuration ()
592 if (input_selector == 0) {
593 input_selector = new IOSelectorWindow (_session, _route, true);
596 if (input_selector->is_visible()) {
597 input_selector->get_toplevel()->get_window()->raise();
599 input_selector->present ();
604 MixerStrip::input_press (GdkEventButton *ev)
606 using namespace Menu_Helpers;
608 MenuList& citems = input_menu.items();
609 input_menu.set_name ("ArdourContextMenu");
612 if (!_session.engine().connected()) {
613 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
618 switch (ev->button) {
622 citems.push_back (MenuElem (_("Edit"), mem_fun(*this, &MixerStrip::edit_input_configuration)));
623 citems.push_back (SeparatorElem());
624 citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_input)));
625 citems.push_back (SeparatorElem());
627 std::vector<boost::shared_ptr<Bundle> > current = _route->bundles_connected_to_inputs ();
629 _session.foreach_bundle (
630 bind (mem_fun (*this, &MixerStrip::add_bundle_to_input_menu), current)
633 input_menu.popup (1, ev->time);
643 MixerStrip::bundle_input_chosen (boost::shared_ptr<ARDOUR::Bundle> c)
645 if (!ignore_toggle) {
648 _route->connect_input_ports_to_bundle (c, this);
651 catch (AudioEngine::PortRegistrationFailure& err) {
652 error << _("could not register new ports required for that bundle")
659 MixerStrip::bundle_output_chosen (boost::shared_ptr<ARDOUR::Bundle> c)
661 if (!ignore_toggle) {
664 _route->connect_output_ports_to_bundle (c, this);
667 catch (AudioEngine::PortRegistrationFailure& err) {
668 error << _("could not register new ports required for that bundle")
675 MixerStrip::add_bundle_to_input_menu (boost::shared_ptr<Bundle> b, std::vector<boost::shared_ptr<Bundle> > const & current)
677 using namespace Menu_Helpers;
679 /* the input menu needs to contain only output bundles (that we
680 can connect inputs to */
681 if (b->ports_are_outputs() == false) {
685 MenuList& citems = input_menu.items();
687 if (b->nchannels() == _route->n_inputs()) {
689 citems.push_back (CheckMenuElem (b->name(), bind (mem_fun(*this, &MixerStrip::bundle_input_chosen), b)));
691 if (std::find (current.begin(), current.end(), b) != current.end()) {
692 ignore_toggle = true;
693 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
694 ignore_toggle = false;
700 MixerStrip::add_bundle_to_output_menu (boost::shared_ptr<Bundle> b, std::vector<boost::shared_ptr<Bundle> > const & current)
702 using namespace Menu_Helpers;
704 /* the output menu needs to contain only input bundles (that we
705 can connect outputs to */
706 if (b->ports_are_inputs() == false) {
710 if (b->nchannels() == _route->n_outputs()) {
712 MenuList& citems = output_menu.items();
713 citems.push_back (CheckMenuElem (b->name(), bind (mem_fun(*this, &MixerStrip::bundle_output_chosen), b)));
715 if (std::find (current.begin(), current.end(), b) != current.end()) {
716 ignore_toggle = true;
717 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
718 ignore_toggle = false;
724 MixerStrip::update_diskstream_display ()
728 if (input_selector) {
729 input_selector->hide_all ();
736 show_passthru_color ();
741 MixerStrip::connect_to_pan ()
743 ENSURE_GUI_THREAD(mem_fun(*this, &MixerStrip::connect_to_pan));
745 panstate_connection.disconnect ();
746 panstyle_connection.disconnect ();
748 boost::shared_ptr<ARDOUR::AutomationControl> pan_control
749 = boost::dynamic_pointer_cast<ARDOUR::AutomationControl>(
750 _route->panner().data().control(Evoral::Parameter( PanAutomation ) ));
753 panstate_connection = pan_control->alist()->automation_state_changed.connect (mem_fun(panners, &PannerUI::pan_automation_state_changed));
754 panstyle_connection = pan_control->alist()->automation_style_changed.connect (mem_fun(panners, &PannerUI::pan_automation_style_changed));
757 panners.pan_changed (this);
761 MixerStrip::update_input_display ()
763 std::vector<boost::shared_ptr<ARDOUR::Bundle> > c = _route->bundles_connected_to_inputs ();
765 /* XXX: how do we represent >1 connected bundle? */
766 if (c.empty() == false) {
767 input_label.set_text (c[0]->name());
771 input_label.set_text (_(" Input"));
774 input_label.set_text (_("I"));
778 panners.setup_pan ();
782 MixerStrip::update_output_display ()
784 std::vector<boost::shared_ptr<ARDOUR::Bundle> > c = _route->bundles_connected_to_outputs ();
786 /* XXX: how do we represent >1 connected bundle? */
787 if (c.empty() == false) {
788 output_label.set_text (c[0]->name());
792 output_label.set_text (_("Output"));
795 output_label.set_text (_("O"));
800 panners.setup_pan ();
804 MixerStrip::fast_update ()
806 gpm.update_meters ();
810 MixerStrip::diskstream_changed ()
812 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_diskstream_display));
816 MixerStrip::input_changed (IOChange change, void *src)
818 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_input_display));
819 set_width(_width, this);
823 MixerStrip::output_changed (IOChange change, void *src)
825 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_output_display));
826 set_width(_width, this);
831 MixerStrip::comment_editor_done_editing()
833 string str = comment_area->get_buffer()->get_text();
834 if (_route->comment() != str) {
835 _route->set_comment (str, this);
841 comment_button.modify_bg (STATE_NORMAL, color());
842 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Comments*"));
844 comment_button.unset_bg (STATE_NORMAL);
845 ((Gtk::Label*)comment_button.get_child())->set_text (_("Comments"));
851 comment_button.modify_bg (STATE_NORMAL, color());
852 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Cmt*"));
854 comment_button.unset_bg (STATE_NORMAL);
855 ((Gtk::Label*)comment_button.get_child())->set_text (_("Cmt"));
860 ARDOUR_UI::instance()->tooltips().set_tip (comment_button,
861 str.empty() ? _("Click to Add/Edit Comments") : str);
867 MixerStrip::comment_button_clicked ()
869 if (comment_window == 0) {
870 setup_comment_editor ();
873 int x, y, cw_width, cw_height;
875 if (comment_window->is_visible()) {
876 comment_window->hide ();
880 comment_window->get_size (cw_width, cw_height);
881 comment_window->get_position(x, y);
882 comment_window->move(x, y - (cw_height / 2) - 45);
884 half the dialog height minus the comments button height
885 with some window decoration fudge thrown in.
888 comment_window->show();
889 comment_window->present();
893 MixerStrip::setup_comment_editor ()
896 title = _route->name();
897 title += _(": comment editor");
899 comment_window = new ArdourDialog (title, false);
900 comment_window->set_position (Gtk::WIN_POS_MOUSE);
901 comment_window->set_skip_taskbar_hint (true);
902 comment_window->signal_hide().connect (mem_fun(*this, &MixerStrip::comment_editor_done_editing));
904 comment_area = manage (new TextView());
905 comment_area->set_name ("MixerTrackCommentArea");
906 comment_area->set_size_request (110, 178);
907 comment_area->set_wrap_mode (WRAP_WORD);
908 comment_area->set_editable (true);
909 comment_area->get_buffer()->set_text (_route->comment());
910 comment_area->show ();
912 comment_window->get_vbox()->pack_start (*comment_area);
913 comment_window->get_action_area()->hide();
917 MixerStrip::comment_changed (void *src)
919 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::comment_changed), src));
922 ignore_comment_edit = true;
924 comment_area->get_buffer()->set_text (_route->comment());
926 ignore_comment_edit = false;
931 MixerStrip::set_mix_group (RouteGroup *rg)
933 _route->set_mix_group (rg, this);
937 MixerStrip::add_mix_group_to_menu (RouteGroup *rg, RadioMenuItem::Group* group)
939 using namespace Menu_Helpers;
941 MenuList& items = group_menu->items();
943 items.push_back (RadioMenuElem (*group, rg->name(), bind (mem_fun(*this, &MixerStrip::set_mix_group), rg)));
945 if (_route->mix_group() == rg) {
946 static_cast<RadioMenuItem*>(&items.back())->set_active ();
951 MixerStrip::select_mix_group (GdkEventButton *ev)
953 using namespace Menu_Helpers;
955 if (group_menu == 0) {
956 group_menu = new Menu;
958 group_menu->set_name ("ArdourContextMenu");
959 MenuList& items = group_menu->items();
960 RadioMenuItem::Group group;
962 switch (ev->button) {
966 items.push_back (RadioMenuElem (group, _("No group"), bind (mem_fun(*this, &MixerStrip::set_mix_group), (RouteGroup *) 0)));
968 _session.foreach_mix_group (bind (mem_fun (*this, &MixerStrip::add_mix_group_to_menu), &group));
970 group_menu->popup (1, ev->time);
981 MixerStrip::mix_group_changed (void *ignored)
983 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::mix_group_changed), ignored));
985 RouteGroup *rg = _route->mix_group();
988 group_label.set_text (rg->name());
992 group_label.set_text (_("Grp"));
995 group_label.set_text (_("~G"));
1003 MixerStrip::route_gui_changed (string what_changed, void* ignored)
1005 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::route_gui_changed), what_changed, ignored));
1007 if (what_changed == "color") {
1008 if (set_color_from_route () == 0) {
1009 show_route_color ();
1015 MixerStrip::show_route_color ()
1017 name_button.modify_bg (STATE_NORMAL, color());
1018 top_event_box.modify_bg (STATE_NORMAL, color());
1019 route_active_changed ();
1023 MixerStrip::show_passthru_color ()
1025 route_active_changed ();
1029 MixerStrip::build_route_ops_menu ()
1031 using namespace Menu_Helpers;
1032 route_ops_menu = manage (new Menu);
1033 route_ops_menu->set_name ("ArdourContextMenu");
1035 MenuList& items = route_ops_menu->items();
1037 items.push_back (MenuElem (_("Rename"), mem_fun(*this, &RouteUI::route_rename)));
1038 items.push_back (SeparatorElem());
1039 items.push_back (CheckMenuElem (_("Active"), mem_fun (*this, &RouteUI::toggle_route_active)));
1040 route_active_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
1041 route_active_menu_item->set_active (_route->active());
1043 items.push_back (SeparatorElem());
1045 items.push_back (MenuElem (_("Adjust latency"), mem_fun (*this, &RouteUI::adjust_latency)));
1047 items.push_back (SeparatorElem());
1048 items.push_back (CheckMenuElem (_("Invert Polarity"), mem_fun (*this, &RouteUI::toggle_polarity)));
1049 polarity_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
1050 polarity_menu_item->set_active (_route->phase_invert());
1051 items.push_back (CheckMenuElem (_("Protect against denormals"), mem_fun (*this, &RouteUI::toggle_denormal_protection)));
1052 denormal_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
1053 denormal_menu_item->set_active (_route->denormal_protection());
1055 build_remote_control_menu ();
1057 items.push_back (SeparatorElem());
1058 if (!Profile->get_sae()) {
1059 items.push_back (MenuElem (_("Remote Control ID"), *remote_control_menu));
1062 items.push_back (SeparatorElem());
1063 items.push_back (MenuElem (_("Remove"), mem_fun(*this, &RouteUI::remove_this_route)));
1067 MixerStrip::name_button_button_press (GdkEventButton* ev)
1069 if (ev->button == 1) {
1070 list_route_operations ();
1072 Menu_Helpers::MenuList& items = route_ops_menu->items();
1073 /* do not allow rename if the track is record-enabled */
1074 static_cast<MenuItem*> (&items.front())->set_sensitive (!_route->record_enabled());
1076 route_ops_menu->popup (1, ev->time);
1082 MixerStrip::list_route_operations ()
1084 if (route_ops_menu == 0) {
1085 build_route_ops_menu ();
1088 refresh_remote_control_menu();
1093 MixerStrip::speed_adjustment_changed ()
1095 /* since there is a usable speed adjustment, there has to be a diskstream */
1096 if (!ignore_speed_adjustment) {
1097 get_diskstream()->set_speed (speed_adjustment.get_value());
1102 MixerStrip::speed_changed ()
1104 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_speed_display));
1108 MixerStrip::update_speed_display ()
1112 val = get_diskstream()->speed();
1115 speed_spinner.set_name ("MixerStripSpeedBaseNotOne");
1117 speed_spinner.set_name ("MixerStripSpeedBase");
1120 if (speed_adjustment.get_value() != val) {
1121 ignore_speed_adjustment = true;
1122 speed_adjustment.set_value (val);
1123 ignore_speed_adjustment = false;
1129 MixerStrip::set_selected (bool yn)
1131 AxisView::set_selected (yn);
1133 global_frame.set_shadow_type (Gtk::SHADOW_ETCHED_OUT);
1134 global_frame.set_name ("MixerStripSelectedFrame");
1136 global_frame.set_shadow_type (Gtk::SHADOW_IN);
1137 global_frame.set_name ("MixerStripFrame");
1139 global_frame.queue_draw ();
1143 MixerStrip::name_changed ()
1147 RouteUI::name_changed ();
1150 name_label.set_text (PBD::short_version (_route->name(), 5));
1153 if (_route->phase_invert()) {
1154 name_label.set_text (X_("Ø ") + name_label.get_text());
1159 MixerStrip::width_clicked ()
1163 set_width (Narrow, this);
1166 set_width (Wide, this);
1172 MixerStrip::hide_clicked ()
1174 // LAME fix to reset the button status for when it is redisplayed (part 1)
1175 hide_button.set_sensitive(false);
1178 Hiding(); /* EMIT_SIGNAL */
1180 _mixer.hide_strip (this);
1184 hide_button.set_sensitive(true);
1188 MixerStrip::set_embedded (bool yn)
1194 MixerStrip::map_frozen ()
1196 ENSURE_GUI_THREAD (mem_fun(*this, &MixerStrip::map_frozen));
1198 boost::shared_ptr<AudioTrack> at = audio_track();
1201 switch (at->freeze_state()) {
1202 case AudioTrack::Frozen:
1203 pre_processor_box.set_sensitive (false);
1204 post_processor_box.set_sensitive (false);
1205 speed_spinner.set_sensitive (false);
1208 pre_processor_box.set_sensitive (true);
1209 post_processor_box.set_sensitive (true);
1210 speed_spinner.set_sensitive (true);
1211 // XXX need some way, maybe, to retoggle redirect editors
1216 hide_redirect_editors ();
1220 MixerStrip::hide_redirect_editors ()
1222 _route->foreach_processor (this, &MixerStrip::hide_processor_editor);
1226 MixerStrip::hide_processor_editor (boost::shared_ptr<Processor> processor)
1228 void* gui = processor->get_gui ();
1231 static_cast<Gtk::Widget*>(gui)->hide ();
1236 MixerStrip::route_active_changed ()
1238 RouteUI::route_active_changed ();
1240 if (is_midi_track()) {
1241 if (_route->active()) {
1242 set_name ("MidiTrackStripBase");
1243 gpm.set_meter_strip_name ("MidiTrackStripBase");
1245 set_name ("MidiTrackStripBaseInactive");
1246 gpm.set_meter_strip_name ("MidiTrackStripBaseInactive");
1248 gpm.set_fader_name ("MidiTrackFader");
1249 } else if (is_audio_track()) {
1250 if (_route->active()) {
1251 set_name ("AudioTrackStripBase");
1252 gpm.set_meter_strip_name ("AudioTrackMetrics");
1254 set_name ("AudioTrackStripBaseInactive");
1255 gpm.set_meter_strip_name ("AudioTrackMetricsInactive");
1257 gpm.set_fader_name ("AudioTrackFader");
1259 if (_route->active()) {
1260 set_name ("AudioBusStripBase");
1261 gpm.set_meter_strip_name ("AudioBusMetrics");
1263 set_name ("AudioBusStripBaseInactive");
1264 gpm.set_meter_strip_name ("AudioBusMetricsInactive");
1266 gpm.set_fader_name ("AudioBusFader");
1268 /* (no MIDI busses yet) */
1273 MixerStrip::mix_group() const
1275 return _route->mix_group();
1279 MixerStrip::engine_stopped ()
1284 MixerStrip::engine_running ()
1289 MixerStrip::meter_changed (void *src)
1292 ENSURE_GUI_THREAD (bind (mem_fun(*this, &MixerStrip::meter_changed), src));
1294 switch (_route->meter_point()) {
1296 meter_point_label.set_text (_("input"));
1300 meter_point_label.set_text (_("pre"));
1303 case MeterPostFader:
1304 meter_point_label.set_text (_("post"));
1308 gpm.setup_meters ();
1309 // reset peak when meter point changes
1310 gpm.reset_peak_display();
1311 set_width(_width, this);