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 _marked_for_display = false;
112 ignore_comment_edit = false;
113 ignore_toggle = false;
114 ignore_speed_adjustment = false;
119 Gtk::Image *width_icon = manage (new Gtk::Image (::get_icon("strip_width")));
120 Gtk::Image *hide_icon = manage (new Gtk::Image (::get_icon("hide")));
121 width_button.add (*width_icon);
122 hide_button.add (*hide_icon);
124 input_label.set_text (_("Input"));
125 input_button.add (input_label);
126 input_button.set_name ("MixerIOButton");
127 input_label.set_name ("MixerIOButtonLabel");
129 output_label.set_text (_("Output"));
130 output_button.add (output_label);
131 output_button.set_name ("MixerIOButton");
132 output_label.set_name ("MixerIOButtonLabel");
134 _route->meter_change.connect (mem_fun(*this, &MixerStrip::meter_changed));
135 meter_point_button.add (meter_point_label);
136 meter_point_button.set_name ("MixerStripMeterPreButton");
137 meter_point_label.set_name ("MixerStripMeterPreButton");
139 switch (_route->meter_point()) {
141 meter_point_label.set_text (_("input"));
145 meter_point_label.set_text (_("pre"));
149 meter_point_label.set_text (_("post"));
153 /* TRANSLATORS: this string should be longest of the strings
154 used to describe meter points. In english, it's "input".
156 set_size_request_to_display_given_text (meter_point_button, _("tupni"), 5, 5);
158 bottom_button_table.attach (meter_point_button, 1, 2, 0, 1);
160 meter_point_button.signal_button_press_event().connect (mem_fun (gpm, &GainMeter::meter_press), false);
161 /* XXX what is this meant to do? */
162 //meter_point_button.signal_button_release_event().connect (mem_fun (gpm, &GainMeter::meter_release), false);
164 hide_button.set_events (hide_button.get_events() & ~(Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK));
166 mute_button->set_name ("MixerMuteButton");
167 solo_button->set_name ("MixerSoloButton");
169 button_table.set_homogeneous (true);
170 button_table.set_spacings (0);
172 button_table.attach (name_button, 0, 2, 0, 1);
173 button_table.attach (input_button, 0, 2, 1, 2);
175 middle_button_table.set_homogeneous (true);
176 middle_button_table.set_spacings (0);
177 middle_button_table.attach (*mute_button, 0, 1, 0, 1);
178 middle_button_table.attach (*solo_button, 1, 2, 0, 1);
180 bottom_button_table.set_col_spacings (0);
181 bottom_button_table.set_homogeneous (true);
182 bottom_button_table.attach (group_button, 0, 1, 0, 1);
184 if (is_audio_track()) {
186 rec_enable_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::rec_enable_press), false);
187 rec_enable_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::rec_enable_release));
189 rec_enable_button->set_name ("MixerRecordEnableButton");
191 boost::shared_ptr<AudioTrack> at = audio_track();
193 at->FreezeChange.connect (mem_fun(*this, &MixerStrip::map_frozen));
195 #ifdef VARISPEED_IN_MIXER_STRIP
196 speed_adjustment.signal_value_changed().connect (mem_fun(*this, &MixerStrip::speed_adjustment_changed));
198 speed_frame.set_name ("BaseFrame");
199 speed_frame.set_shadow_type (Gtk::SHADOW_IN);
200 speed_frame.add (speed_spinner);
202 speed_spinner.set_print_func (speed_printer, 0);
204 ARDOUR_UI::instance()->tooltips().set_tip (speed_spinner, _("Varispeed"));
206 button_table.attach (speed_frame, 0, 2, 5, 6);
207 #endif /* VARISPEED_IN_MIXER_STRIP */
209 button_table.attach (*rec_enable_button, 0, 2, 2, 3);
212 name_button.add (name_label);
213 name_button.set_name ("MixerNameButton");
214 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2);
216 name_label.set_name ("MixerNameButtonLabel");
217 if (_route->phase_invert()) {
218 name_label.set_text (X_("Ø ") + name_label.get_text());
220 name_label.set_text (_route->name());
223 group_button.add (group_label);
224 group_button.set_name ("MixerGroupButton");
225 group_label.set_name ("MixerGroupButtonLabel");
227 comment_button.set_name ("MixerCommentButton");
229 ARDOUR_UI::instance()->tooltips().set_tip (comment_button, _route->comment()=="" ?
230 _("Click to Add/Edit Comments"):
233 comment_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::comment_button_clicked));
235 global_vpacker.set_border_width (0);
236 global_vpacker.set_spacing (0);
238 VBox *whvbox = manage (new VBox);
240 width_button.set_name ("MixerWidthButton");
241 hide_button.set_name ("MixerHideButton");
242 top_event_box.set_name ("MixerTopEventBox");
244 width_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::width_clicked));
245 hide_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::hide_clicked));
247 width_hide_box.pack_start (width_button, false, true);
248 width_hide_box.pack_start (top_event_box, true, true);
249 width_hide_box.pack_end (hide_button, false, true);
250 Gtk::Alignment *gain_meter_alignment = Gtk::manage(new Gtk::Alignment());
251 gain_meter_alignment->set_padding(0, 4, 0, 0);
252 gain_meter_alignment->add(gpm);
254 whvbox->pack_start (width_hide_box, true, true);
256 global_vpacker.pack_start (*whvbox, Gtk::PACK_SHRINK);
257 global_vpacker.pack_start (button_table,Gtk::PACK_SHRINK);
258 global_vpacker.pack_start (pre_processor_box, true, true);
259 global_vpacker.pack_start (middle_button_table,Gtk::PACK_SHRINK);
260 global_vpacker.pack_start (*gain_meter_alignment,Gtk::PACK_SHRINK);
261 global_vpacker.pack_start (bottom_button_table,Gtk::PACK_SHRINK);
262 global_vpacker.pack_start (post_processor_box, true, true);
263 if (!is_midi_track())
264 global_vpacker.pack_start (panners, Gtk::PACK_SHRINK);
265 global_vpacker.pack_start (output_button, Gtk::PACK_SHRINK);
266 global_vpacker.pack_start (comment_button, Gtk::PACK_SHRINK);
268 if (route()->is_master() || route()->is_control()) {
270 if (scrollbar_height == 0) {
271 HScrollbar scrollbar;
272 Gtk::Requisition requisition(scrollbar.size_request ());
273 scrollbar_height = requisition.height;
276 EventBox* spacer = manage (new EventBox);
277 spacer->set_size_request (-1, scrollbar_height);
278 global_vpacker.pack_start (*spacer, false, false);
281 global_frame.add (global_vpacker);
282 global_frame.set_shadow_type (Gtk::SHADOW_IN);
283 global_frame.set_name ("BaseFrame");
287 /* force setting of visible selected status */
290 set_selected (false);
295 _session.engine().Stopped.connect (mem_fun(*this, &MixerStrip::engine_stopped));
296 _session.engine().Running.connect (mem_fun(*this, &MixerStrip::engine_running));
297 _route->input_changed.connect (mem_fun(*this, &MixerStrip::input_changed));
298 _route->output_changed.connect (mem_fun(*this, &MixerStrip::output_changed));
299 _route->mute_changed.connect (mem_fun(*this, &RouteUI::mute_changed));
300 _route->solo_changed.connect (mem_fun(*this, &RouteUI::solo_changed));
301 _route->solo_safe_changed.connect (mem_fun(*this, &RouteUI::solo_changed));
302 _route->mix_group_changed.connect (mem_fun(*this, &MixerStrip::mix_group_changed));
303 _route->panner().Changed.connect (mem_fun(*this, &MixerStrip::connect_to_pan));
305 if (is_audio_track()) {
306 audio_track()->DiskstreamChanged.connect (mem_fun(*this, &MixerStrip::diskstream_changed));
307 get_diskstream()->SpeedChanged.connect (mem_fun(*this, &MixerStrip::speed_changed));
310 _route->NameChanged.connect (mem_fun(*this, &RouteUI::name_changed));
311 _route->comment_changed.connect (mem_fun(*this, &MixerStrip::comment_changed));
312 _route->gui_changed.connect (mem_fun(*this, &MixerStrip::route_gui_changed));
314 input_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::input_press), false);
315 output_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::output_press), false);
317 solo_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::solo_press), false);
318 solo_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::solo_release), false);
319 mute_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::mute_press), false);
320 mute_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::mute_release), false);
322 name_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::name_button_button_press), false);
323 group_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::select_mix_group), false);
326 set_stuff_from_route ();
328 /* start off as a passthru strip. we'll correct this, if necessary,
329 in update_diskstream_display().
333 set_name ("MidiTrackStripBase");
335 set_name ("AudioTrackStripBase");
337 /* now force an update of all the various elements */
339 pre_processor_box.update();
340 post_processor_box.update();
345 mix_group_changed (0);
349 panners.setup_pan ();
351 if (is_audio_track()) {
355 update_diskstream_display ();
356 update_input_display ();
357 update_output_display ();
359 add_events (Gdk::BUTTON_RELEASE_MASK);
364 gain_meter_alignment->show_all();
366 pre_processor_box.show();
368 if (!route()->is_master() && !route()->is_control()) {
369 /* we don't allow master or control routes to be hidden */
373 width_hide_box.show();
375 global_vpacker.show();
377 middle_button_table.show();
378 bottom_button_table.show();
379 gain_unit_button.show();
380 gain_unit_label.show();
381 meter_point_button.show();
382 meter_point_label.show();
383 diskstream_button.show();
384 diskstream_label.show();
387 output_button.show();
391 comment_button.show();
394 speed_spinner.show();
401 MixerStrip::~MixerStrip ()
403 GoingAway(); /* EMIT_SIGNAL */
405 if (input_selector) {
406 delete input_selector;
409 if (output_selector) {
410 delete output_selector;
415 MixerStrip::set_stuff_from_route ()
421 /* if width is not set, it will be set by the MixerUI or editor */
423 if ((prop = xml_node->property ("strip_width")) != 0) {
424 set_width (Width (string_2_enum (prop->value(), _width)), this);
427 if ((prop = xml_node->property ("shown_mixer")) != 0) {
428 if (prop->value() == "no") {
429 _marked_for_display = false;
431 _marked_for_display = true;
434 /* backwards compatibility */
435 _marked_for_display = true;
440 MixerStrip::set_width (Width w, void* owner)
442 /* always set the gpm width again, things may be hidden */
445 panners.set_width (w);
446 pre_processor_box.set_width (w);
447 post_processor_box.set_width (w);
449 boost::shared_ptr<AutomationList> gain_automation = _route->gain_control()->list();
451 _width_owner = owner;
457 if (_width_owner == this) {
458 xml_node->add_property ("strip_width", enum_2_string (_width));
463 set_size_request (-1, -1);
465 if (rec_enable_button) {
466 ((Gtk::Label*)rec_enable_button->get_child())->set_text (_("record"));
468 ((Gtk::Label*)mute_button->get_child())->set_text (_("Mute"));
469 ((Gtk::Label*)solo_button->get_child())->set_text (_("Solo"));
471 if (_route->comment() == "") {
472 comment_button.unset_bg (STATE_NORMAL);
473 ((Gtk::Label*)comment_button.get_child())->set_text (_("comments"));
475 comment_button.modify_bg (STATE_NORMAL, color());
476 ((Gtk::Label*)comment_button.get_child())->set_text (_("*comments*"));
479 ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (gpm.astyle_string(gain_automation->automation_style()));
480 ((Gtk::Label*)gpm.gain_automation_state_button.get_child())->set_text (gpm.astate_string(gain_automation->automation_state()));
481 ((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text (panners.astyle_string(_route->panner().automation_style()));
482 ((Gtk::Label*)panners.pan_automation_state_button.get_child())->set_text (panners.astate_string(_route->panner().automation_state()));
483 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "long", 2, 2);
487 if (rec_enable_button) {
488 ((Gtk::Label*)rec_enable_button->get_child())->set_text (_("Rec"));
490 ((Gtk::Label*)mute_button->get_child())->set_text (_("M"));
491 ((Gtk::Label*)solo_button->get_child())->set_text (_("S"));
493 if (_route->comment() == "") {
494 comment_button.unset_bg (STATE_NORMAL);
495 ((Gtk::Label*)comment_button.get_child())->set_text (_("Cmt"));
497 comment_button.modify_bg (STATE_NORMAL, color());
498 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Cmt*"));
501 ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (gpm.short_astyle_string(gain_automation->automation_style()));
502 ((Gtk::Label*)gpm.gain_automation_state_button.get_child())->set_text (gpm.short_astate_string(gain_automation->automation_state()));
503 ((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text (panners.short_astyle_string(_route->panner().automation_style()));
504 ((Gtk::Label*)panners.pan_automation_state_button.get_child())->set_text (panners.short_astate_string(_route->panner().automation_state()));
505 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2);
506 set_size_request (max (50, gpm.get_gm_width()), -1);
510 update_input_display ();
511 update_output_display ();
512 mix_group_changed (0);
518 MixerStrip::set_packed (bool yn)
525 xml_node->add_property ("shown_mixer", "yes");
527 xml_node->add_property ("shown_mixer", "no");
533 MixerStrip::output_press (GdkEventButton *ev)
535 using namespace Menu_Helpers;
536 if (!_session.engine().connected()) {
537 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
542 MenuList& citems = output_menu.items();
543 switch (ev->button) {
547 output_menu.set_name ("ArdourContextMenu");
550 citems.push_back (MenuElem (_("Edit"), mem_fun(*this, &MixerStrip::edit_output_configuration)));
551 citems.push_back (SeparatorElem());
552 citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_output)));
553 citems.push_back (SeparatorElem());
555 std::vector<boost::shared_ptr<Bundle> > current = _route->bundles_connected_to_outputs ();
557 _session.foreach_bundle (
558 bind (mem_fun (*this, &MixerStrip::add_bundle_to_output_menu), current)
561 output_menu.popup (1, ev->time);
572 MixerStrip::edit_output_configuration ()
574 if (output_selector == 0) {
575 output_selector = new IOSelectorWindow (_session, _route, false);
578 if (output_selector->is_visible()) {
579 output_selector->get_toplevel()->get_window()->raise();
581 output_selector->present ();
586 MixerStrip::edit_input_configuration ()
588 if (input_selector == 0) {
589 input_selector = new IOSelectorWindow (_session, _route, true);
592 if (input_selector->is_visible()) {
593 input_selector->get_toplevel()->get_window()->raise();
595 input_selector->present ();
600 MixerStrip::input_press (GdkEventButton *ev)
602 using namespace Menu_Helpers;
604 MenuList& citems = input_menu.items();
605 input_menu.set_name ("ArdourContextMenu");
608 if (!_session.engine().connected()) {
609 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
614 switch (ev->button) {
618 citems.push_back (MenuElem (_("Edit"), mem_fun(*this, &MixerStrip::edit_input_configuration)));
619 citems.push_back (SeparatorElem());
620 citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_input)));
621 citems.push_back (SeparatorElem());
623 std::vector<boost::shared_ptr<Bundle> > current = _route->bundles_connected_to_inputs ();
625 _session.foreach_bundle (
626 bind (mem_fun (*this, &MixerStrip::add_bundle_to_input_menu), current)
629 input_menu.popup (1, ev->time);
639 MixerStrip::bundle_input_chosen (boost::shared_ptr<ARDOUR::Bundle> c)
641 if (!ignore_toggle) {
644 _route->connect_input_ports_to_bundle (c, this);
647 catch (AudioEngine::PortRegistrationFailure& err) {
648 error << _("could not register new ports required for that bundle")
655 MixerStrip::bundle_output_chosen (boost::shared_ptr<ARDOUR::Bundle> c)
657 if (!ignore_toggle) {
660 _route->connect_output_ports_to_bundle (c, this);
663 catch (AudioEngine::PortRegistrationFailure& err) {
664 error << _("could not register new ports required for that bundle")
671 MixerStrip::add_bundle_to_input_menu (boost::shared_ptr<Bundle> b, std::vector<boost::shared_ptr<Bundle> > const & current)
673 using namespace Menu_Helpers;
675 /* the input menu needs to contain only output bundles (that we
676 can connect inputs to */
677 if (b->ports_are_outputs() == false) {
681 MenuList& citems = input_menu.items();
683 if (b->nchannels() == _route->n_inputs().n_total()) {
685 citems.push_back (CheckMenuElem (b->name(), bind (mem_fun(*this, &MixerStrip::bundle_input_chosen), b)));
687 if (std::find (current.begin(), current.end(), b) != current.end()) {
688 ignore_toggle = true;
689 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
690 ignore_toggle = false;
696 MixerStrip::add_bundle_to_output_menu (boost::shared_ptr<Bundle> b, std::vector<boost::shared_ptr<Bundle> > const & current)
698 using namespace Menu_Helpers;
700 /* the output menu needs to contain only input bundles (that we
701 can connect outputs to */
702 if (b->ports_are_inputs() == false) {
706 if (b->nchannels() == _route->n_outputs().n_total()) {
708 MenuList& citems = output_menu.items();
709 citems.push_back (CheckMenuElem (b->name(), bind (mem_fun(*this, &MixerStrip::bundle_output_chosen), b)));
711 if (std::find (current.begin(), current.end(), b) != current.end()) {
712 ignore_toggle = true;
713 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
714 ignore_toggle = false;
720 MixerStrip::update_diskstream_display ()
724 if (input_selector) {
725 input_selector->hide_all ();
732 show_passthru_color ();
737 MixerStrip::connect_to_pan ()
739 ENSURE_GUI_THREAD(mem_fun(*this, &MixerStrip::connect_to_pan));
741 panstate_connection.disconnect ();
742 panstyle_connection.disconnect ();
744 if (!_route->panner().empty()) {
745 StreamPanner* sp = _route->panner().front();
747 panstate_connection = sp->pan_control()->list()->automation_state_changed.connect (mem_fun(panners, &PannerUI::pan_automation_state_changed));
748 panstyle_connection = sp->pan_control()->list()->automation_style_changed.connect (mem_fun(panners, &PannerUI::pan_automation_style_changed));
751 panners.pan_changed (this);
755 MixerStrip::update_input_display ()
757 std::vector<boost::shared_ptr<ARDOUR::Bundle> > c = _route->bundles_connected_to_inputs ();
759 /* XXX: how do we represent >1 connected bundle? */
760 if (c.empty() == false) {
761 input_label.set_text (c[0]->name());
765 input_label.set_text (_(" Input"));
768 input_label.set_text (_("I"));
772 panners.setup_pan ();
776 MixerStrip::update_output_display ()
778 std::vector<boost::shared_ptr<ARDOUR::Bundle> > c = _route->bundles_connected_to_outputs ();
780 /* XXX: how do we represent >1 connected bundle? */
781 if (c.empty() == false) {
782 output_label.set_text (c[0]->name());
786 output_label.set_text (_("Output"));
789 output_label.set_text (_("O"));
794 panners.setup_pan ();
798 MixerStrip::fast_update ()
800 gpm.update_meters ();
804 MixerStrip::diskstream_changed ()
806 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_diskstream_display));
810 MixerStrip::input_changed (IOChange change, void *src)
812 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_input_display));
813 set_width(_width, this);
817 MixerStrip::output_changed (IOChange change, void *src)
819 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_output_display));
820 set_width(_width, this);
825 MixerStrip::comment_editor_done_editing()
827 string str = comment_area->get_buffer()->get_text();
828 if (_route->comment() != str) {
829 _route->set_comment (str, this);
835 comment_button.modify_bg (STATE_NORMAL, color());
836 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Comments*"));
838 comment_button.unset_bg (STATE_NORMAL);
839 ((Gtk::Label*)comment_button.get_child())->set_text (_("Comments"));
845 comment_button.modify_bg (STATE_NORMAL, color());
846 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Cmt*"));
848 comment_button.unset_bg (STATE_NORMAL);
849 ((Gtk::Label*)comment_button.get_child())->set_text (_("Cmt"));
854 ARDOUR_UI::instance()->tooltips().set_tip (comment_button,
855 str.empty() ? _("Click to Add/Edit Comments") : str);
861 MixerStrip::comment_button_clicked ()
863 if (comment_window == 0) {
864 setup_comment_editor ();
867 int x, y, cw_width, cw_height;
869 if (comment_window->is_visible()) {
870 comment_window->hide ();
874 comment_window->get_size (cw_width, cw_height);
875 comment_window->get_position(x, y);
876 comment_window->move(x, y - (cw_height / 2) - 45);
878 half the dialog height minus the comments button height
879 with some window decoration fudge thrown in.
882 comment_window->show();
883 comment_window->present();
887 MixerStrip::setup_comment_editor ()
890 title = _route->name();
891 title += _(": comment editor");
893 comment_window = new ArdourDialog (title, false);
894 comment_window->set_position (Gtk::WIN_POS_MOUSE);
895 comment_window->set_skip_taskbar_hint (true);
896 comment_window->signal_hide().connect (mem_fun(*this, &MixerStrip::comment_editor_done_editing));
898 comment_area = manage (new TextView());
899 comment_area->set_name ("MixerTrackCommentArea");
900 comment_area->set_size_request (110, 178);
901 comment_area->set_wrap_mode (WRAP_WORD);
902 comment_area->set_editable (true);
903 comment_area->get_buffer()->set_text (_route->comment());
904 comment_area->show ();
906 comment_window->get_vbox()->pack_start (*comment_area);
907 comment_window->get_action_area()->hide();
911 MixerStrip::comment_changed (void *src)
913 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::comment_changed), src));
916 ignore_comment_edit = true;
918 comment_area->get_buffer()->set_text (_route->comment());
920 ignore_comment_edit = false;
925 MixerStrip::set_mix_group (RouteGroup *rg)
927 _route->set_mix_group (rg, this);
931 MixerStrip::add_mix_group_to_menu (RouteGroup *rg, RadioMenuItem::Group* group)
933 using namespace Menu_Helpers;
935 MenuList& items = group_menu->items();
937 items.push_back (RadioMenuElem (*group, rg->name(), bind (mem_fun(*this, &MixerStrip::set_mix_group), rg)));
939 if (_route->mix_group() == rg) {
940 static_cast<RadioMenuItem*>(&items.back())->set_active ();
945 MixerStrip::select_mix_group (GdkEventButton *ev)
947 using namespace Menu_Helpers;
949 if (group_menu == 0) {
950 group_menu = new Menu;
952 group_menu->set_name ("ArdourContextMenu");
953 MenuList& items = group_menu->items();
954 RadioMenuItem::Group group;
956 switch (ev->button) {
960 items.push_back (RadioMenuElem (group, _("No group"), bind (mem_fun(*this, &MixerStrip::set_mix_group), (RouteGroup *) 0)));
962 _session.foreach_mix_group (bind (mem_fun (*this, &MixerStrip::add_mix_group_to_menu), &group));
964 group_menu->popup (1, ev->time);
975 MixerStrip::mix_group_changed (void *ignored)
977 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::mix_group_changed), ignored));
979 RouteGroup *rg = _route->mix_group();
982 group_label.set_text (rg->name());
986 group_label.set_text (_("Grp"));
989 group_label.set_text (_("~G"));
997 MixerStrip::route_gui_changed (string what_changed, void* ignored)
999 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::route_gui_changed), what_changed, ignored));
1001 if (what_changed == "color") {
1002 if (set_color_from_route () == 0) {
1003 show_route_color ();
1009 MixerStrip::show_route_color ()
1011 name_button.modify_bg (STATE_NORMAL, color());
1012 top_event_box.modify_bg (STATE_NORMAL, color());
1013 route_active_changed ();
1017 MixerStrip::show_passthru_color ()
1019 route_active_changed ();
1023 MixerStrip::build_route_ops_menu ()
1025 using namespace Menu_Helpers;
1026 route_ops_menu = manage (new Menu);
1027 route_ops_menu->set_name ("ArdourContextMenu");
1029 MenuList& items = route_ops_menu->items();
1031 items.push_back (MenuElem (_("Rename"), mem_fun(*this, &RouteUI::route_rename)));
1032 items.push_back (SeparatorElem());
1033 items.push_back (CheckMenuElem (_("Active"), mem_fun (*this, &RouteUI::toggle_route_active)));
1034 route_active_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
1035 route_active_menu_item->set_active (_route->active());
1037 items.push_back (SeparatorElem());
1039 items.push_back (MenuElem (_("Adjust latency"), mem_fun (*this, &RouteUI::adjust_latency)));
1041 items.push_back (SeparatorElem());
1042 items.push_back (CheckMenuElem (_("Invert Polarity"), mem_fun (*this, &RouteUI::toggle_polarity)));
1043 polarity_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
1044 polarity_menu_item->set_active (_route->phase_invert());
1045 items.push_back (CheckMenuElem (_("Protect against denormals"), mem_fun (*this, &RouteUI::toggle_denormal_protection)));
1046 denormal_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
1047 denormal_menu_item->set_active (_route->denormal_protection());
1049 build_remote_control_menu ();
1051 items.push_back (SeparatorElem());
1052 if (!Profile->get_sae()) {
1053 items.push_back (MenuElem (_("Remote Control ID"), *remote_control_menu));
1056 items.push_back (SeparatorElem());
1057 items.push_back (MenuElem (_("Remove"), mem_fun(*this, &RouteUI::remove_this_route)));
1061 MixerStrip::name_button_button_press (GdkEventButton* ev)
1063 if (ev->button == 1) {
1064 list_route_operations ();
1066 Menu_Helpers::MenuList& items = route_ops_menu->items();
1067 /* do not allow rename if the track is record-enabled */
1068 static_cast<MenuItem*> (&items.front())->set_sensitive (!_route->record_enabled());
1070 route_ops_menu->popup (1, ev->time);
1076 MixerStrip::list_route_operations ()
1078 if (route_ops_menu == 0) {
1079 build_route_ops_menu ();
1082 refresh_remote_control_menu();
1087 MixerStrip::speed_adjustment_changed ()
1089 /* since there is a usable speed adjustment, there has to be a diskstream */
1090 if (!ignore_speed_adjustment) {
1091 get_diskstream()->set_speed (speed_adjustment.get_value());
1096 MixerStrip::speed_changed ()
1098 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_speed_display));
1102 MixerStrip::update_speed_display ()
1106 val = get_diskstream()->speed();
1109 speed_spinner.set_name ("MixerStripSpeedBaseNotOne");
1111 speed_spinner.set_name ("MixerStripSpeedBase");
1114 if (speed_adjustment.get_value() != val) {
1115 ignore_speed_adjustment = true;
1116 speed_adjustment.set_value (val);
1117 ignore_speed_adjustment = false;
1123 MixerStrip::set_selected (bool yn)
1125 AxisView::set_selected (yn);
1127 global_frame.set_shadow_type (Gtk::SHADOW_ETCHED_OUT);
1128 global_frame.set_name ("MixerStripSelectedFrame");
1130 global_frame.set_shadow_type (Gtk::SHADOW_IN);
1131 global_frame.set_name ("MixerStripFrame");
1133 global_frame.queue_draw ();
1137 MixerStrip::name_changed ()
1141 RouteUI::name_changed ();
1144 name_label.set_text (PBD::short_version (_route->name(), 5));
1147 if (_route->phase_invert()) {
1148 name_label.set_text (X_("Ø ") + name_label.get_text());
1153 MixerStrip::width_clicked ()
1157 set_width (Narrow, this);
1160 set_width (Wide, this);
1166 MixerStrip::hide_clicked ()
1168 // LAME fix to reset the button status for when it is redisplayed (part 1)
1169 hide_button.set_sensitive(false);
1172 Hiding(); /* EMIT_SIGNAL */
1174 _mixer.hide_strip (this);
1178 hide_button.set_sensitive(true);
1182 MixerStrip::set_embedded (bool yn)
1188 MixerStrip::map_frozen ()
1190 ENSURE_GUI_THREAD (mem_fun(*this, &MixerStrip::map_frozen));
1192 boost::shared_ptr<AudioTrack> at = audio_track();
1195 switch (at->freeze_state()) {
1196 case AudioTrack::Frozen:
1197 pre_processor_box.set_sensitive (false);
1198 post_processor_box.set_sensitive (false);
1199 speed_spinner.set_sensitive (false);
1202 pre_processor_box.set_sensitive (true);
1203 post_processor_box.set_sensitive (true);
1204 speed_spinner.set_sensitive (true);
1205 // XXX need some way, maybe, to retoggle redirect editors
1211 hide_redirect_editors ();
1215 MixerStrip::hide_redirect_editors ()
1217 _route->foreach_processor (this, &MixerStrip::hide_processor_editor);
1221 MixerStrip::hide_processor_editor (boost::shared_ptr<Processor> processor)
1223 void* gui = processor->get_gui ();
1226 static_cast<Gtk::Widget*>(gui)->hide ();
1231 MixerStrip::route_active_changed ()
1233 RouteUI::route_active_changed ();
1235 if (is_midi_track()) {
1236 if (_route->active()) {
1237 set_name ("MidiTrackStripBase");
1238 gpm.set_meter_strip_name ("MidiTrackStripBase");
1240 set_name ("MidiTrackStripBaseInactive");
1241 gpm.set_meter_strip_name ("MidiTrackStripBaseInactive");
1243 gpm.set_fader_name ("MidiTrackFader");
1244 } else if (is_audio_track()) {
1245 if (_route->active()) {
1246 set_name ("AudioTrackStripBase");
1247 gpm.set_meter_strip_name ("AudioTrackMetrics");
1249 set_name ("AudioTrackStripBaseInactive");
1250 gpm.set_meter_strip_name ("AudioTrackMetricsInactive");
1252 gpm.set_fader_name ("AudioTrackFader");
1254 if (_route->active()) {
1255 set_name ("AudioBusStripBase");
1256 gpm.set_meter_strip_name ("AudioBusMetrics");
1258 set_name ("AudioBusStripBaseInactive");
1259 gpm.set_meter_strip_name ("AudioBusMetricsInactive");
1261 gpm.set_fader_name ("AudioBusFader");
1263 /* (no MIDI busses yet) */
1268 MixerStrip::mix_group() const
1270 return _route->mix_group();
1274 MixerStrip::engine_stopped ()
1279 MixerStrip::engine_running ()
1284 MixerStrip::meter_changed (void *src)
1287 ENSURE_GUI_THREAD (bind (mem_fun(*this, &MixerStrip::meter_changed), src));
1289 switch (_route->meter_point()) {
1291 meter_point_label.set_text (_("input"));
1295 meter_point_label.set_text (_("pre"));
1298 case MeterPostFader:
1299 meter_point_label.set_text (_("post"));
1303 gpm.setup_meters ();
1304 set_width(_width, this);