2 Copyright (C) 2000-2002 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.
23 #include <sigc++/bind.h>
25 #include <pbd/convert.h>
26 #include <pbd/enumwriter.h>
28 #include <gtkmm2ext/gtk_ui.h>
29 #include <gtkmm2ext/utils.h>
30 #include <gtkmm2ext/choice.h>
31 #include <gtkmm2ext/stop_signal.h>
32 #include <gtkmm2ext/doi.h>
33 #include <gtkmm2ext/slider_controller.h>
34 #include <gtkmm2ext/bindable_button.h>
36 #include <ardour/ardour.h>
37 #include <ardour/session.h>
38 #include <ardour/audioengine.h>
39 #include <ardour/route.h>
40 #include <ardour/audio_track.h>
41 #include <ardour/audio_diskstream.h>
42 #include <ardour/panner.h>
43 #include <ardour/send.h>
44 #include <ardour/insert.h>
45 #include <ardour/profile.h>
46 #include <ardour/ladspa_plugin.h>
47 #include <ardour/connection.h>
48 #include <ardour/session_connection.h>
50 #include "ardour_ui.h"
51 #include "ardour_dialog.h"
52 #include "mixer_strip.h"
55 #include "public_editor.h"
57 #include "io_selector.h"
59 #include "gui_thread.h"
64 using namespace ARDOUR;
67 using namespace Gtkmm2ext;
70 int MixerStrip::scrollbar_height = 0;
72 #ifdef VARISPEED_IN_MIXER_STRIP
74 speed_printer (char buf[32], Gtk::Adjustment& adj, void* arg)
76 float val = adj.get_value ();
81 snprintf (buf, 32, "%.3f", val);
86 MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, bool in_mixer)
88 RouteUI (sess, _("Mute"), _("Solo"), _("Record")),
90 _mixer_owned (in_mixer),
91 pre_redirect_box (PreFader, sess, mx.plugin_selector(), mx.selection(), in_mixer),
92 post_redirect_box (PostFader, sess, mx.plugin_selector(), mx.selection(), in_mixer),
96 middle_button_table (1, 2),
97 bottom_button_table (1, 2),
98 meter_point_label (_("pre")),
99 comment_button (_("Comments")),
100 speed_adjustment (1.0, 0.001, 4.0, 0.001, 0.1),
101 speed_spinner (&speed_adjustment, "MixerStripSpeedBase", true)
107 /* the editor mixer strip: don't destroy it every time
108 the underlying route goes away.
111 self_destruct = false;
115 MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, boost::shared_ptr<Route> rt, bool in_mixer)
117 RouteUI (sess, _("Mute"), _("Solo"), _("Record")),
119 _mixer_owned (in_mixer),
120 pre_redirect_box (PreFader, sess, mx.plugin_selector(), mx.selection(), in_mixer),
121 post_redirect_box (PostFader, sess, mx.plugin_selector(), mx.selection(), in_mixer),
125 middle_button_table (1, 2),
126 bottom_button_table (1, 2),
127 meter_point_label (_("pre")),
128 comment_button (_("Comments")),
129 speed_adjustment (1.0, 0.001, 4.0, 0.001, 0.1),
130 speed_spinner (&speed_adjustment, "MixerStripSpeedBase", true)
143 _marked_for_display = false;
145 rename_menu_item = 0;
146 ignore_comment_edit = false;
147 ignore_toggle = false;
148 ignore_speed_adjustment = false;
153 width_button.add (*(manage (new Gtk::Image (::get_icon("strip_width")))));
154 hide_button.add (*(manage (new Gtk::Image (::get_icon("hide")))));
156 input_label.set_text (_("Input"));
157 ARDOUR_UI::instance()->set_tip (&input_button, _("Click to choose inputs"), "");
158 input_button.add (input_label);
159 input_button.set_name ("MixerIOButton");
160 input_label.set_name ("MixerIOButtonLabel");
162 output_label.set_text (_("Output"));
163 ARDOUR_UI::instance()->set_tip (&output_button, _("Click to choose outputs"), "");
164 output_button.add (output_label);
165 output_button.set_name ("MixerIOButton");
166 output_label.set_name ("MixerIOButtonLabel");
168 ARDOUR_UI::instance()->set_tip (&meter_point_button, _("Select metering point"), "");
169 meter_point_button.add (meter_point_label);
170 meter_point_button.set_name ("MixerStripMeterPreButton");
171 meter_point_label.set_name ("MixerStripMeterPreButton");
173 /* TRANSLATORS: this string should be longest of the strings
174 used to describe meter points. In english, it's "input".
176 set_size_request_to_display_given_text (meter_point_button, _("tupni"), 5, 5);
178 bottom_button_table.attach (meter_point_button, 1, 2, 0, 1);
180 meter_point_button.signal_button_press_event().connect (mem_fun (gpm, &GainMeter::meter_press), false);
181 /* XXX what is this meant to do? */
182 //meter_point_button.signal_button_release_event().connect (mem_fun (gpm, &GainMeter::meter_release), false);
184 hide_button.set_events (hide_button.get_events() & ~(Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK));
186 mute_button->set_name ("MixerMuteButton");
187 solo_button->set_name ("MixerSoloButton");
189 button_table.set_homogeneous (true);
190 button_table.set_spacings (0);
192 button_table.attach (name_button, 0, 2, 0, 1);
193 button_table.attach (input_button, 0, 2, 1, 2);
195 middle_button_table.set_homogeneous (true);
196 middle_button_table.set_spacings (0);
197 middle_button_table.attach (*mute_button, 0, 1, 0, 1);
198 middle_button_table.attach (*solo_button, 1, 2, 0, 1);
200 bottom_button_table.set_col_spacings (0);
201 bottom_button_table.set_homogeneous (true);
202 bottom_button_table.attach (group_button, 0, 1, 0, 1);
204 name_button.add (name_label);
205 name_button.set_name ("MixerNameButton");
206 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2);
207 name_label.set_name ("MixerNameButtonLabel");
209 ARDOUR_UI::instance()->set_tip (&group_button, _("Mix group"), "");
210 group_button.add (group_label);
211 group_button.set_name ("MixerGroupButton");
212 Gtkmm2ext::set_size_request_to_display_given_text (group_button, "Group", 2, 2);
214 group_label.set_name ("MixerGroupButtonLabel");
216 comment_button.set_name ("MixerCommentButton");
218 comment_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::comment_button_clicked));
220 global_vpacker.set_border_width (0);
221 global_vpacker.set_spacing (0);
223 VBox *whvbox = manage (new VBox);
225 width_button.set_name ("MixerWidthButton");
226 hide_button.set_name ("MixerHideButton");
227 top_event_box.set_name ("MixerTopEventBox");
229 width_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::width_clicked));
230 hide_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::hide_clicked));
232 width_hide_box.pack_start (width_button, false, true);
233 width_hide_box.pack_start (top_event_box, true, true);
234 width_hide_box.pack_end (hide_button, false, true);
235 Gtk::Alignment *gain_meter_alignment = Gtk::manage(new Gtk::Alignment());
236 gain_meter_alignment->set_padding(0, 4, 0, 0);
237 gain_meter_alignment->add(gpm);
239 whvbox->pack_start (width_hide_box, true, true);
241 global_vpacker.pack_start (*whvbox, Gtk::PACK_SHRINK);
242 global_vpacker.pack_start (button_table,Gtk::PACK_SHRINK);
243 global_vpacker.pack_start (pre_redirect_box, true, true);
244 global_vpacker.pack_start (middle_button_table,Gtk::PACK_SHRINK);
245 global_vpacker.pack_start (*gain_meter_alignment,Gtk::PACK_SHRINK);
246 global_vpacker.pack_start (bottom_button_table,Gtk::PACK_SHRINK);
247 global_vpacker.pack_start (post_redirect_box, true, true);
248 global_vpacker.pack_start (panners, Gtk::PACK_SHRINK);
249 global_vpacker.pack_start (output_button, Gtk::PACK_SHRINK);
250 global_vpacker.pack_start (comment_button, Gtk::PACK_SHRINK);
252 global_frame.add (global_vpacker);
253 global_frame.set_shadow_type (Gtk::SHADOW_IN);
254 global_frame.set_name ("BaseFrame");
258 /* force setting of visible selected status */
261 set_selected (false);
266 _session.engine().Stopped.connect (mem_fun(*this, &MixerStrip::engine_stopped));
267 _session.engine().Running.connect (mem_fun(*this, &MixerStrip::engine_running));
269 input_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::input_press), false);
270 output_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::output_press), false);
272 solo_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::solo_press), false);
273 solo_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::solo_release), false);
274 mute_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::mute_press), false);
275 mute_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::mute_release), false);
277 /* we don't need this if its not an audio track, but we don't know that yet and it doesn't
281 rec_enable_button->set_name ("MixerRecordEnableButton");
282 rec_enable_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::rec_enable_press), false);
283 rec_enable_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::rec_enable_release));
285 name_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::name_button_button_press), false);
286 group_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::select_mix_group), false);
290 /* start off as a passthru strip. we'll correct this, if necessary,
291 in update_diskstream_display().
294 set_name ("AudioTrackStripBase");
296 add_events (Gdk::BUTTON_RELEASE_MASK);
299 MixerStrip::~MixerStrip ()
301 GoingAway(); /* EMIT_SIGNAL */
303 if (input_selector) {
304 delete input_selector;
307 if (output_selector) {
308 delete output_selector;
313 MixerStrip::set_route (boost::shared_ptr<Route> rt)
315 if (rec_enable_button->get_parent()) {
316 button_table.remove (*rec_enable_button);
319 #ifdef VARISPEED_IN_MIXER_STRIP
320 if (speed_frame->get_parent()) {
321 button_table.remove (*speed_frame);
325 RouteUI::set_route (rt);
327 if (input_selector) {
328 delete input_selector;
332 if (output_selector) {
333 delete output_selector;
339 pre_redirect_box.set_route (rt);
340 post_redirect_box.set_route (rt);
342 if (set_color_from_route()) {
343 set_color (unique_random_color());
346 if (_mixer_owned && (route()->master() || route()->control())) {
348 if (scrollbar_height == 0) {
349 HScrollbar scrollbar;
350 Gtk::Requisition requisition(scrollbar.size_request ());
351 scrollbar_height = requisition.height;
354 EventBox* spacer = manage (new EventBox);
355 spacer->set_size_request (-1, scrollbar_height);
356 global_vpacker.pack_start (*spacer, false, false);
359 if (is_audio_track()) {
361 boost::shared_ptr<AudioTrack> at = audio_track();
363 connections.push_back (at->FreezeChange.connect (mem_fun(*this, &MixerStrip::map_frozen)));
365 #ifdef VARISPEED_IN_MIXER_STRIP
366 speed_adjustment.signal_value_changed().connect (mem_fun(*this, &MixerStrip::speed_adjustment_changed));
368 speed_frame.set_name ("BaseFrame");
369 speed_frame.set_shadow_type (Gtk::SHADOW_IN);
370 speed_frame.add (speed_spinner);
372 speed_spinner.set_print_func (speed_printer, 0);
374 ARDOUR_UI::instance()->tooltips().set_tip (speed_spinner, _("Varispeed"));
376 button_table.attach (speed_frame, 0, 2, 5, 6);
377 #endif /* VARISPEED_IN_MIXER_STRIP */
379 button_table.attach (*rec_enable_button, 0, 2, 2, 3);
380 rec_enable_button->set_sensitive (_session.writable());
381 rec_enable_button->show();
384 if (_route->phase_invert()) {
385 name_label.set_text (X_("Ø ") + name_label.get_text());
387 name_label.set_text (_route->name());
390 switch (_route->meter_point()) {
392 meter_point_label.set_text (_("input"));
396 meter_point_label.set_text (_("pre"));
400 meter_point_label.set_text (_("post"));
404 delete route_ops_menu;
407 ARDOUR_UI::instance()->tooltips().set_tip (comment_button, _route->comment().empty() ?
408 _("Click to Add/Edit Comments"):
411 connections.push_back (_route->meter_change.connect (mem_fun(*this, &MixerStrip::meter_changed)));
412 connections.push_back (_route->input_changed.connect (mem_fun(*this, &MixerStrip::input_changed)));
413 connections.push_back (_route->output_changed.connect (mem_fun(*this, &MixerStrip::output_changed)));
414 connections.push_back (_route->mute_changed.connect (mem_fun(*this, &RouteUI::mute_changed)));
415 connections.push_back (_route->solo_changed.connect (mem_fun(*this, &RouteUI::solo_changed)));
416 connections.push_back (_route->solo_safe_changed.connect (mem_fun(*this, &RouteUI::solo_changed)));
417 connections.push_back (_route->mix_group_changed.connect (mem_fun(*this, &MixerStrip::mix_group_changed)));
418 connections.push_back (_route->panner().Changed.connect (mem_fun(*this, &MixerStrip::connect_to_pan)));
420 if (is_audio_track()) {
421 connections.push_back (audio_track()->DiskstreamChanged.connect (mem_fun(*this, &MixerStrip::diskstream_changed)));
422 connections.push_back (get_diskstream()->SpeedChanged.connect (mem_fun(*this, &MixerStrip::speed_changed)));
425 connections.push_back (_route->name_changed.connect (mem_fun(*this, &RouteUI::name_changed)));
426 connections.push_back (_route->comment_changed.connect (mem_fun(*this, &MixerStrip::comment_changed)));
427 connections.push_back (_route->gui_changed.connect (mem_fun(*this, &MixerStrip::route_gui_changed)));
429 set_stuff_from_route ();
431 /* now force an update of all the various elements */
433 pre_redirect_box.update();
434 post_redirect_box.update();
439 mix_group_changed (0);
443 panners.setup_pan ();
445 if (is_audio_track()) {
449 update_diskstream_display ();
450 update_input_display ();
451 update_output_display ();
455 MixerStrip::set_stuff_from_route ()
461 /* if width is not set, it will be set by the MixerUI or editor */
463 if ((prop = xml_node->property ("strip_width")) != 0) {
464 set_width (Width (string_2_enum (prop->value(), _width)), this);
467 if ((prop = xml_node->property ("shown_mixer")) != 0) {
468 if (prop->value() == "no") {
469 _marked_for_display = false;
471 _marked_for_display = true;
474 /* backwards compatibility */
475 _marked_for_display = true;
480 MixerStrip::set_width (Width w, void* owner)
482 /* always set the gpm width again, things may be hidden */
485 panners.set_width (w);
486 pre_redirect_box.set_width (w);
487 post_redirect_box.set_width (w);
489 _width_owner = owner;
495 if (_width_owner == this) {
496 xml_node->add_property ("strip_width", enum_2_string (_width));
502 if (rec_enable_button) {
503 ((Gtk::Label*)rec_enable_button->get_child())->set_text (_("Record"));
505 ((Gtk::Label*)mute_button->get_child())->set_text (_("Mute"));
506 ((Gtk::Label*)solo_button->get_child())->set_text (_("Solo"));
508 if (_route->comment() == "") {
509 comment_button.unset_bg (STATE_NORMAL);
510 ((Gtk::Label*)comment_button.get_child())->set_text (_("Comments"));
512 comment_button.modify_bg (STATE_NORMAL, color());
513 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Comments*"));
516 ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (gpm.astyle_string(_route->gain_automation_curve().automation_style()));
517 ((Gtk::Label*)gpm.gain_automation_state_button.get_child())->set_text (gpm.astate_string(_route->gain_automation_curve().automation_state()));
518 ((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text (panners.astyle_string(_route->panner().automation_style()));
519 ((Gtk::Label*)panners.pan_automation_state_button.get_child())->set_text (panners.astate_string(_route->panner().automation_state()));
520 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "long", 2, 2);
521 set_size_request (-1, -1);
525 if (rec_enable_button) {
526 ((Gtk::Label*)rec_enable_button->get_child())->set_text (_("Rec"));
528 ((Gtk::Label*)mute_button->get_child())->set_text (_("M"));
529 ((Gtk::Label*)solo_button->get_child())->set_text (_("S"));
531 if (_route->comment() == "") {
532 comment_button.unset_bg (STATE_NORMAL);
533 ((Gtk::Label*)comment_button.get_child())->set_text (_("Cmt"));
535 comment_button.modify_bg (STATE_NORMAL, color());
536 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Cmt*"));
539 ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (gpm.short_astyle_string(_route->gain_automation_curve().automation_style()));
540 ((Gtk::Label*)gpm.gain_automation_state_button.get_child())->set_text (gpm.short_astate_string(_route->gain_automation_curve().automation_state()));
541 ((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text (panners.short_astyle_string(_route->panner().automation_style()));
542 ((Gtk::Label*)panners.pan_automation_state_button.get_child())->set_text (panners.short_astate_string(_route->panner().automation_state()));
543 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2);
544 set_size_request (max (50, gpm.get_gm_width()), -1);
547 update_input_display ();
548 update_output_display ();
549 mix_group_changed (0);
557 MixerStrip::set_packed (bool yn)
564 xml_node->add_property ("shown_mixer", "yes");
566 xml_node->add_property ("shown_mixer", "no");
572 MixerStrip::output_press (GdkEventButton *ev)
574 using namespace Menu_Helpers;
575 if (!_session.engine().connected()) {
576 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
581 MenuList& citems = output_menu.items();
582 switch (ev->button) {
585 output_menu.set_name ("ArdourContextMenu");
588 citems.push_back (MenuElem (_("Edit"), mem_fun(*this, &MixerStrip::edit_output_configuration)));
589 citems.push_back (SeparatorElem());
590 citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_output)));
591 citems.push_back (SeparatorElem());
593 _session.foreach_connection (this, &MixerStrip::add_connection_to_output_menu);
595 output_menu.popup (1, ev->time);
605 MixerStrip::edit_output_configuration ()
607 if (output_selector == 0) {
608 output_selector = new IOSelectorWindow (_session, _route, false);
611 if (output_selector->is_visible()) {
612 output_selector->get_toplevel()->get_window()->raise();
614 output_selector->show_all ();
619 MixerStrip::edit_input_configuration ()
621 if (input_selector == 0) {
622 input_selector = new IOSelectorWindow (_session, _route, true);
625 if (input_selector->is_visible()) {
626 input_selector->get_toplevel()->get_window()->raise();
628 input_selector->show_all ();
633 MixerStrip::input_press (GdkEventButton *ev)
635 using namespace Menu_Helpers;
637 MenuList& citems = input_menu.items();
638 input_menu.set_name ("ArdourContextMenu");
641 if (!_session.engine().connected()) {
642 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
647 switch (ev->button) {
650 citems.push_back (MenuElem (_("Edit"), mem_fun(*this, &MixerStrip::edit_input_configuration)));
651 citems.push_back (SeparatorElem());
652 citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_input)));
653 citems.push_back (SeparatorElem());
655 _session.foreach_connection (this, &MixerStrip::add_connection_to_input_menu);
657 input_menu.popup (1, ev->time);
667 MixerStrip::connection_input_chosen (ARDOUR::Connection *c)
669 if (!ignore_toggle) {
672 _route->use_input_connection (*c, this);
675 catch (AudioEngine::PortRegistrationFailure& err) {
676 error << _("could not register new ports required for that connection")
683 MixerStrip::connection_output_chosen (ARDOUR::Connection *c)
685 if (!ignore_toggle) {
688 _route->use_output_connection (*c, this);
691 catch (AudioEngine::PortRegistrationFailure& err) {
692 error << _("could not register new ports required for that connection")
699 MixerStrip::add_connection_to_input_menu (ARDOUR::Connection* c)
701 using namespace Menu_Helpers;
703 if (dynamic_cast<InputConnection *> (c) == 0) {
707 MenuList& citems = input_menu.items();
709 if (c->nports() == _route->n_inputs()) {
711 citems.push_back (CheckMenuElem (c->name(), bind (mem_fun(*this, &MixerStrip::connection_input_chosen), c)));
713 ARDOUR::Connection *current = _route->input_connection();
716 ignore_toggle = true;
717 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
718 ignore_toggle = false;
724 MixerStrip::add_connection_to_output_menu (ARDOUR::Connection* c)
726 using namespace Menu_Helpers;
728 if (dynamic_cast<OutputConnection *> (c) == 0) {
732 if (c->nports() == _route->n_outputs()) {
734 MenuList& citems = output_menu.items();
735 citems.push_back (CheckMenuElem (c->name(), bind (mem_fun(*this, &MixerStrip::connection_output_chosen), c)));
737 ARDOUR::Connection *current = _route->output_connection();
740 ignore_toggle = true;
741 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
742 ignore_toggle = false;
748 MixerStrip::update_diskstream_display ()
751 update_input_display ();
753 if (is_audio_track()) {
755 if (input_selector) {
756 input_selector->hide_all ();
763 show_passthru_color ();
768 MixerStrip::connect_to_pan ()
770 ENSURE_GUI_THREAD(mem_fun(*this, &MixerStrip::connect_to_pan));
772 panstate_connection.disconnect ();
773 panstyle_connection.disconnect ();
775 if (!_route->panner().empty()) {
776 StreamPanner* sp = _route->panner().front();
778 panstate_connection = sp->automation().automation_state_changed.connect (mem_fun(panners, &PannerUI::pan_automation_state_changed));
779 panstyle_connection = sp->automation().automation_style_changed.connect (mem_fun(panners, &PannerUI::pan_automation_style_changed));
782 panners.pan_changed (this);
786 MixerStrip::update_input_display ()
788 ARDOUR::Connection *c;
790 if ((c = _route->input_connection()) != 0) {
791 input_label.set_text (c->name());
795 input_label.set_text (_(" Input"));
798 input_label.set_text (_("I"));
802 panners.setup_pan ();
806 MixerStrip::update_output_display ()
808 ARDOUR::Connection *c;
810 if ((c = _route->output_connection()) != 0) {
811 output_label.set_text (c->name());
815 output_label.set_text (_("Output"));
818 output_label.set_text (_("O"));
824 panners.setup_pan ();
828 MixerStrip::fast_update ()
830 gpm.update_meters ();
834 MixerStrip::diskstream_changed ()
836 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_diskstream_display));
840 MixerStrip::input_changed (IOChange change, void *src)
842 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_input_display));
843 set_width(_width, this);
847 MixerStrip::output_changed (IOChange change, void *src)
849 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_output_display));
850 set_width(_width, this);
855 MixerStrip::comment_editor_done_editing()
857 string str = comment_area->get_buffer()->get_text();
858 if (_route->comment() != str) {
859 _route->set_comment (str, this);
865 comment_button.modify_bg (STATE_NORMAL, color());
866 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Comments*"));
868 comment_button.unset_bg (STATE_NORMAL);
869 ((Gtk::Label*)comment_button.get_child())->set_text (_("Comments"));
875 comment_button.modify_bg (STATE_NORMAL, color());
876 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Cmt*"));
878 comment_button.unset_bg (STATE_NORMAL);
879 ((Gtk::Label*)comment_button.get_child())->set_text (_("Cmt"));
884 ARDOUR_UI::instance()->tooltips().set_tip (comment_button,
885 str.empty() ? _("Click to Add/Edit Comments") : str);
891 MixerStrip::comment_button_clicked ()
893 if (comment_window == 0) {
894 setup_comment_editor ();
897 int x, y, cw_width, cw_height;
899 if (comment_window->is_visible()) {
900 comment_window->hide ();
904 comment_window->get_size (cw_width, cw_height);
905 comment_window->get_position(x, y);
906 comment_window->move(x, y - (cw_height / 2) - 45);
908 half the dialog height minus the comments button height
909 with some window decoration fudge thrown in.
912 comment_window->show();
913 comment_window->present();
917 MixerStrip::setup_comment_editor ()
920 title = _route->name();
921 title += _(": comment editor");
923 comment_window = new ArdourDialog (title, false);
924 comment_window->set_position (Gtk::WIN_POS_MOUSE);
925 comment_window->set_skip_taskbar_hint (true);
926 comment_window->signal_hide().connect (mem_fun(*this, &MixerStrip::comment_editor_done_editing));
928 comment_area = manage (new TextView());
929 comment_area->set_name ("MixerTrackCommentArea");
930 comment_area->set_size_request (110, 178);
931 comment_area->set_wrap_mode (WRAP_WORD);
932 comment_area->set_editable (true);
933 comment_area->get_buffer()->set_text (_route->comment());
934 comment_area->show ();
936 comment_window->get_vbox()->pack_start (*comment_area);
937 comment_window->get_action_area()->hide();
941 MixerStrip::comment_changed (void *src)
943 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::comment_changed), src));
946 ignore_comment_edit = true;
948 comment_area->get_buffer()->set_text (_route->comment());
950 ignore_comment_edit = false;
955 MixerStrip::set_mix_group (RouteGroup *rg)
957 _route->set_mix_group (rg, this);
961 MixerStrip::add_mix_group_to_menu (RouteGroup *rg, RadioMenuItem::Group* group)
963 using namespace Menu_Helpers;
965 MenuList& items = group_menu->items();
967 items.push_back (RadioMenuElem (*group, rg->name(), bind (mem_fun(*this, &MixerStrip::set_mix_group), rg)));
969 if (_route->mix_group() == rg) {
970 static_cast<RadioMenuItem*>(&items.back())->set_active ();
975 MixerStrip::select_mix_group (GdkEventButton *ev)
977 using namespace Menu_Helpers;
979 if (group_menu == 0) {
980 group_menu = new Menu;
982 group_menu->set_name ("ArdourContextMenu");
983 MenuList& items = group_menu->items();
984 RadioMenuItem::Group group;
986 switch (ev->button) {
990 items.push_back (RadioMenuElem (group, _("No group"), bind (mem_fun(*this, &MixerStrip::set_mix_group), (RouteGroup *) 0)));
992 _session.foreach_mix_group (bind (mem_fun (*this, &MixerStrip::add_mix_group_to_menu), &group));
994 group_menu->popup (1, ev->time);
1005 MixerStrip::mix_group_changed (void *ignored)
1007 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::mix_group_changed), ignored));
1009 RouteGroup *rg = _route->mix_group();
1012 group_label.set_text (PBD::short_version (rg->name(), 5));
1016 group_label.set_text (_("Grp"));
1019 group_label.set_text (_("~G"));
1027 MixerStrip::route_gui_changed (string what_changed, void* ignored)
1029 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::route_gui_changed), what_changed, ignored));
1031 if (what_changed == "color") {
1032 if (set_color_from_route () == 0) {
1033 show_route_color ();
1039 MixerStrip::show_route_color ()
1041 name_button.modify_bg (STATE_NORMAL, color());
1042 top_event_box.modify_bg (STATE_NORMAL, color());
1043 route_active_changed ();
1047 MixerStrip::show_passthru_color ()
1049 route_active_changed ();
1053 MixerStrip::build_route_ops_menu ()
1055 using namespace Menu_Helpers;
1056 route_ops_menu = new Menu;
1057 route_ops_menu->set_name ("ArdourContextMenu");
1059 MenuList& items = route_ops_menu->items();
1061 items.push_back (MenuElem (_("Save As Template"), mem_fun(*this, &RouteUI::save_as_template)));
1062 items.push_back (MenuElem (_("Rename"), mem_fun(*this, &RouteUI::route_rename)));
1063 rename_menu_item = &items.back();
1064 items.push_back (SeparatorElem());
1065 items.push_back (CheckMenuElem (_("Active"), mem_fun (*this, &RouteUI::toggle_route_active)));
1066 route_active_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
1067 route_active_menu_item->set_active (_route->active());
1068 items.push_back (SeparatorElem());
1069 items.push_back (CheckMenuElem (_("Invert Polarity"), mem_fun (*this, &RouteUI::toggle_polarity)));
1070 polarity_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
1071 polarity_menu_item->set_active (_route->phase_invert());
1072 items.push_back (CheckMenuElem (_("Protect against denormals"), mem_fun (*this, &RouteUI::toggle_denormal_protection)));
1073 denormal_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
1074 denormal_menu_item->set_active (_route->denormal_protection());
1076 if (!Profile->get_sae()) {
1077 build_remote_control_menu ();
1078 items.push_back (SeparatorElem());
1079 items.push_back (MenuElem (_("Remote Control ID"), *remote_control_menu));
1082 items.push_back (SeparatorElem());
1083 items.push_back (MenuElem (_("Remove"), mem_fun(*this, &RouteUI::remove_this_route)));
1087 MixerStrip::name_button_button_press (GdkEventButton* ev)
1089 if (ev->button == 1 || ev->button == 3) {
1090 list_route_operations ();
1091 /* do not allow rename if the track is record-enabled */
1092 rename_menu_item->set_sensitive (!_route->record_enabled());
1093 route_ops_menu->popup (1, ev->time);
1099 MixerStrip::list_route_operations ()
1101 if (route_ops_menu == 0) {
1102 build_route_ops_menu ();
1105 refresh_remote_control_menu();
1110 MixerStrip::speed_adjustment_changed ()
1112 /* since there is a usable speed adjustment, there has to be a diskstream */
1113 if (!ignore_speed_adjustment) {
1114 get_diskstream()->set_speed (speed_adjustment.get_value());
1119 MixerStrip::speed_changed ()
1121 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_speed_display));
1125 MixerStrip::update_speed_display ()
1129 val = get_diskstream()->speed();
1132 speed_spinner.set_name ("MixerStripSpeedBaseNotOne");
1134 speed_spinner.set_name ("MixerStripSpeedBase");
1137 if (speed_adjustment.get_value() != val) {
1138 ignore_speed_adjustment = true;
1139 speed_adjustment.set_value (val);
1140 ignore_speed_adjustment = false;
1146 MixerStrip::set_selected (bool yn)
1148 AxisView::set_selected (yn);
1150 global_frame.set_shadow_type (Gtk::SHADOW_ETCHED_OUT);
1151 global_frame.set_name ("MixerStripSelectedFrame");
1153 global_frame.set_shadow_type (Gtk::SHADOW_IN);
1154 global_frame.set_name ("MixerStripFrame");
1156 global_frame.queue_draw ();
1160 MixerStrip::name_changed (void *src)
1164 RouteUI::name_changed (src);
1167 name_label.set_text (PBD::short_version (_route->name(), 5));
1170 if (_route->phase_invert()) {
1171 name_label.set_text (X_("Ø ") + name_label.get_text());
1176 MixerStrip::width_clicked ()
1180 set_width (Narrow, this);
1183 set_width (Wide, this);
1189 MixerStrip::hide_clicked ()
1191 // LAME fix to reset the button status for when it is redisplayed (part 1)
1192 hide_button.set_sensitive(false);
1195 Hiding(); /* EMIT_SIGNAL */
1197 _mixer.hide_strip (this);
1201 hide_button.set_sensitive(true);
1205 MixerStrip::set_embedded (bool yn)
1211 MixerStrip::map_frozen ()
1213 ENSURE_GUI_THREAD (mem_fun(*this, &MixerStrip::map_frozen));
1215 boost::shared_ptr<AudioTrack> at = audio_track();
1218 switch (at->freeze_state()) {
1219 case AudioTrack::Frozen:
1220 pre_redirect_box.set_sensitive (false);
1221 post_redirect_box.set_sensitive (false);
1222 speed_spinner.set_sensitive (false);
1225 pre_redirect_box.set_sensitive (true);
1226 post_redirect_box.set_sensitive (true);
1227 speed_spinner.set_sensitive (true);
1228 // XXX need some way, maybe, to retoggle redirect editors
1233 hide_redirect_editors ();
1237 MixerStrip::hide_redirect_editors ()
1239 _route->foreach_redirect (this, &MixerStrip::hide_redirect_editor);
1243 MixerStrip::hide_redirect_editor (boost::shared_ptr<Redirect> redirect)
1245 void* gui = redirect->get_gui ();
1248 static_cast<Gtk::Widget*>(gui)->hide ();
1253 MixerStrip::route_active_changed ()
1255 RouteUI::route_active_changed ();
1257 if (is_audio_track()) {
1258 if (_route->active()) {
1259 set_name ("AudioTrackStripBase");
1260 gpm.set_meter_strip_name ("AudioTrackMetrics");
1262 set_name ("AudioTrackStripBaseInactive");
1263 gpm.set_meter_strip_name ("AudioTrackMetricsInactive");
1265 gpm.set_fader_name ("AudioTrackFader");
1266 } else { // FIXME: assumed audio bus
1267 if (_route->active()) {
1268 set_name ("AudioBusStripBase");
1269 gpm.set_meter_strip_name ("AudioBusMetrics");
1271 set_name ("AudioBusStripBaseInactive");
1272 gpm.set_meter_strip_name ("AudioBusMetricsInactive");
1274 gpm.set_fader_name ("AudioBusFader");
1279 MixerStrip::mix_group() const
1281 return _route->mix_group();
1285 MixerStrip::engine_stopped ()
1290 MixerStrip::engine_running ()
1295 MixerStrip::meter_changed (void *src)
1298 ENSURE_GUI_THREAD (bind (mem_fun(*this, &MixerStrip::meter_changed), src));
1300 switch (_route->meter_point()) {
1302 meter_point_label.set_text (_("input"));
1306 meter_point_label.set_text (_("pre"));
1309 case MeterPostFader:
1310 meter_point_label.set_text (_("post"));
1314 gpm.setup_meters ();
1315 // reset peak when meter point changes
1316 gpm.reset_peak_display();
1317 set_width (_width, this);