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()) {
185 boost::shared_ptr<AudioTrack> at = audio_track();
187 at->FreezeChange.connect (mem_fun(*this, &MixerStrip::map_frozen));
189 #ifdef VARISPEED_IN_MIXER_STRIP
190 speed_adjustment.signal_value_changed().connect (mem_fun(*this, &MixerStrip::speed_adjustment_changed));
192 speed_frame.set_name ("BaseFrame");
193 speed_frame.set_shadow_type (Gtk::SHADOW_IN);
194 speed_frame.add (speed_spinner);
196 speed_spinner.set_print_func (speed_printer, 0);
198 ARDOUR_UI::instance()->tooltips().set_tip (speed_spinner, _("Varispeed"));
200 button_table.attach (speed_frame, 0, 2, 5, 6);
201 #endif /* VARISPEED_IN_MIXER_STRIP */
205 if(rec_enable_button) {
206 rec_enable_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::rec_enable_press), false);
207 rec_enable_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::rec_enable_release));
209 rec_enable_button->set_name ("MixerRecordEnableButton");
210 button_table.attach (*rec_enable_button, 0, 2, 2, 3);
213 name_button.add (name_label);
214 name_button.set_name ("MixerNameButton");
215 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2);
217 name_label.set_name ("MixerNameButtonLabel");
218 if (_route->phase_invert()) {
219 name_label.set_text (X_("Ø ") + name_label.get_text());
221 name_label.set_text (_route->name());
224 group_button.add (group_label);
225 group_button.set_name ("MixerGroupButton");
226 group_label.set_name ("MixerGroupButtonLabel");
228 comment_button.set_name ("MixerCommentButton");
230 ARDOUR_UI::instance()->tooltips().set_tip (comment_button, _route->comment()=="" ?
231 _("Click to Add/Edit Comments"):
234 comment_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::comment_button_clicked));
236 global_vpacker.set_border_width (0);
237 global_vpacker.set_spacing (0);
239 VBox *whvbox = manage (new VBox);
241 width_button.set_name ("MixerWidthButton");
242 hide_button.set_name ("MixerHideButton");
243 top_event_box.set_name ("MixerTopEventBox");
245 width_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::width_clicked));
246 hide_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::hide_clicked));
248 width_hide_box.pack_start (width_button, false, true);
249 width_hide_box.pack_start (top_event_box, true, true);
250 width_hide_box.pack_end (hide_button, false, true);
251 Gtk::Alignment *gain_meter_alignment = Gtk::manage(new Gtk::Alignment());
252 gain_meter_alignment->set_padding(0, 4, 0, 0);
253 gain_meter_alignment->add(gpm);
255 whvbox->pack_start (width_hide_box, true, true);
257 global_vpacker.pack_start (*whvbox, Gtk::PACK_SHRINK);
258 global_vpacker.pack_start (button_table,Gtk::PACK_SHRINK);
259 global_vpacker.pack_start (pre_processor_box, true, true);
260 global_vpacker.pack_start (middle_button_table,Gtk::PACK_SHRINK);
261 global_vpacker.pack_start (*gain_meter_alignment,Gtk::PACK_SHRINK);
262 global_vpacker.pack_start (bottom_button_table,Gtk::PACK_SHRINK);
263 global_vpacker.pack_start (post_processor_box, true, true);
264 if (!is_midi_track()) {
265 global_vpacker.pack_start (panners, Gtk::PACK_SHRINK);
267 global_vpacker.pack_start (output_button, Gtk::PACK_SHRINK);
268 global_vpacker.pack_start (comment_button, Gtk::PACK_SHRINK);
270 if (route()->is_master() || route()->is_control()) {
272 if (scrollbar_height == 0) {
273 HScrollbar scrollbar;
274 Gtk::Requisition requisition(scrollbar.size_request ());
275 scrollbar_height = requisition.height;
278 EventBox* spacer = manage (new EventBox);
279 spacer->set_size_request (-1, scrollbar_height);
280 global_vpacker.pack_start (*spacer, false, false);
283 global_frame.add (global_vpacker);
284 global_frame.set_shadow_type (Gtk::SHADOW_IN);
285 global_frame.set_name ("BaseFrame");
289 /* force setting of visible selected status */
292 set_selected (false);
297 _session.engine().Stopped.connect (mem_fun(*this, &MixerStrip::engine_stopped));
298 _session.engine().Running.connect (mem_fun(*this, &MixerStrip::engine_running));
299 _route->input_changed.connect (mem_fun(*this, &MixerStrip::input_changed));
300 _route->output_changed.connect (mem_fun(*this, &MixerStrip::output_changed));
301 _route->mute_changed.connect (mem_fun(*this, &RouteUI::mute_changed));
302 _route->solo_changed.connect (mem_fun(*this, &RouteUI::solo_changed));
303 _route->solo_safe_changed.connect (mem_fun(*this, &RouteUI::solo_changed));
304 _route->mix_group_changed.connect (mem_fun(*this, &MixerStrip::mix_group_changed));
305 _route->panner().Changed.connect (mem_fun(*this, &MixerStrip::connect_to_pan));
307 if (is_audio_track()) {
308 audio_track()->DiskstreamChanged.connect (mem_fun(*this, &MixerStrip::diskstream_changed));
309 get_diskstream()->SpeedChanged.connect (mem_fun(*this, &MixerStrip::speed_changed));
312 _route->NameChanged.connect (mem_fun(*this, &RouteUI::name_changed));
313 _route->comment_changed.connect (mem_fun(*this, &MixerStrip::comment_changed));
314 _route->gui_changed.connect (mem_fun(*this, &MixerStrip::route_gui_changed));
316 input_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::input_press), false);
317 output_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::output_press), false);
319 solo_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::solo_press), false);
320 solo_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::solo_release), false);
321 mute_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::mute_press), false);
322 mute_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::mute_release), false);
324 name_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::name_button_button_press), false);
325 group_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::select_mix_group), false);
328 set_stuff_from_route ();
330 /* start off as a passthru strip. we'll correct this, if necessary,
331 in update_diskstream_display().
335 set_name ("MidiTrackStripBase");
337 set_name ("AudioTrackStripBase");
339 /* now force an update of all the various elements */
341 pre_processor_box.update();
342 post_processor_box.update();
347 mix_group_changed (0);
351 panners.setup_pan ();
353 if (is_audio_track()) {
357 update_diskstream_display ();
358 update_input_display ();
359 update_output_display ();
361 add_events (Gdk::BUTTON_RELEASE_MASK);
366 gain_meter_alignment->show_all();
368 pre_processor_box.show();
370 if (!route()->is_master() && !route()->is_control()) {
371 /* we don't allow master or control routes to be hidden */
375 width_hide_box.show();
377 global_vpacker.show();
379 middle_button_table.show();
380 bottom_button_table.show();
381 gain_unit_button.show();
382 gain_unit_label.show();
383 meter_point_button.show();
384 meter_point_label.show();
385 diskstream_button.show();
386 diskstream_label.show();
389 output_button.show();
393 comment_button.show();
396 speed_spinner.show();
403 MixerStrip::~MixerStrip ()
405 GoingAway(); /* EMIT_SIGNAL */
407 if (input_selector) {
408 delete input_selector;
411 if (output_selector) {
412 delete output_selector;
417 MixerStrip::set_stuff_from_route ()
423 /* if width is not set, it will be set by the MixerUI or editor */
425 if ((prop = xml_node->property ("strip_width")) != 0) {
426 set_width (Width (string_2_enum (prop->value(), _width)), this);
429 if ((prop = xml_node->property ("shown_mixer")) != 0) {
430 if (prop->value() == "no") {
431 _marked_for_display = false;
433 _marked_for_display = true;
436 /* backwards compatibility */
437 _marked_for_display = true;
442 MixerStrip::set_width (Width w, void* owner)
444 /* always set the gpm width again, things may be hidden */
447 panners.set_width (w);
448 pre_processor_box.set_width (w);
449 post_processor_box.set_width (w);
451 boost::shared_ptr<AutomationList> gain_automation = _route->gain_control()->list();
453 _width_owner = owner;
459 if (_width_owner == this) {
460 xml_node->add_property ("strip_width", enum_2_string (_width));
465 set_size_request (-1, -1);
467 if (rec_enable_button) {
468 ((Gtk::Label*)rec_enable_button->get_child())->set_text (_("record"));
470 ((Gtk::Label*)mute_button->get_child())->set_text (_("Mute"));
471 ((Gtk::Label*)solo_button->get_child())->set_text (_("Solo"));
473 if (_route->comment() == "") {
474 comment_button.unset_bg (STATE_NORMAL);
475 ((Gtk::Label*)comment_button.get_child())->set_text (_("comments"));
477 comment_button.modify_bg (STATE_NORMAL, color());
478 ((Gtk::Label*)comment_button.get_child())->set_text (_("*comments*"));
481 ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (gpm.astyle_string(gain_automation->automation_style()));
482 ((Gtk::Label*)gpm.gain_automation_state_button.get_child())->set_text (gpm.astate_string(gain_automation->automation_state()));
483 ((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text (panners.astyle_string(_route->panner().automation_style()));
484 ((Gtk::Label*)panners.pan_automation_state_button.get_child())->set_text (panners.astate_string(_route->panner().automation_state()));
485 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "long", 2, 2);
489 if (rec_enable_button) {
490 ((Gtk::Label*)rec_enable_button->get_child())->set_text (_("Rec"));
492 ((Gtk::Label*)mute_button->get_child())->set_text (_("M"));
493 ((Gtk::Label*)solo_button->get_child())->set_text (_("S"));
495 if (_route->comment() == "") {
496 comment_button.unset_bg (STATE_NORMAL);
497 ((Gtk::Label*)comment_button.get_child())->set_text (_("Cmt"));
499 comment_button.modify_bg (STATE_NORMAL, color());
500 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Cmt*"));
503 ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (gpm.short_astyle_string(gain_automation->automation_style()));
504 ((Gtk::Label*)gpm.gain_automation_state_button.get_child())->set_text (gpm.short_astate_string(gain_automation->automation_state()));
505 ((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text (panners.short_astyle_string(_route->panner().automation_style()));
506 ((Gtk::Label*)panners.pan_automation_state_button.get_child())->set_text (panners.short_astate_string(_route->panner().automation_state()));
507 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2);
508 set_size_request (max (50, gpm.get_gm_width()), -1);
512 update_input_display ();
513 update_output_display ();
514 mix_group_changed (0);
520 MixerStrip::set_packed (bool yn)
527 xml_node->add_property ("shown_mixer", "yes");
529 xml_node->add_property ("shown_mixer", "no");
535 MixerStrip::output_press (GdkEventButton *ev)
537 using namespace Menu_Helpers;
538 if (!_session.engine().connected()) {
539 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
544 MenuList& citems = output_menu.items();
545 switch (ev->button) {
549 output_menu.set_name ("ArdourContextMenu");
552 citems.push_back (MenuElem (_("Edit"), mem_fun(*this, &MixerStrip::edit_output_configuration)));
553 citems.push_back (SeparatorElem());
554 citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_output)));
555 citems.push_back (SeparatorElem());
557 std::vector<boost::shared_ptr<Bundle> > current = _route->bundles_connected_to_outputs ();
559 _session.foreach_bundle (
560 bind (mem_fun (*this, &MixerStrip::add_bundle_to_output_menu), current)
563 output_menu.popup (1, ev->time);
574 MixerStrip::edit_output_configuration ()
576 if (output_selector == 0) {
577 output_selector = new IOSelectorWindow (_session, _route, false);
580 if (output_selector->is_visible()) {
581 output_selector->get_toplevel()->get_window()->raise();
583 output_selector->present ();
588 MixerStrip::edit_input_configuration ()
590 if (input_selector == 0) {
591 input_selector = new IOSelectorWindow (_session, _route, true);
594 if (input_selector->is_visible()) {
595 input_selector->get_toplevel()->get_window()->raise();
597 input_selector->present ();
602 MixerStrip::input_press (GdkEventButton *ev)
604 using namespace Menu_Helpers;
606 MenuList& citems = input_menu.items();
607 input_menu.set_name ("ArdourContextMenu");
610 if (!_session.engine().connected()) {
611 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
616 switch (ev->button) {
620 citems.push_back (MenuElem (_("Edit"), mem_fun(*this, &MixerStrip::edit_input_configuration)));
621 citems.push_back (SeparatorElem());
622 citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_input)));
623 citems.push_back (SeparatorElem());
625 std::vector<boost::shared_ptr<Bundle> > current = _route->bundles_connected_to_inputs ();
627 _session.foreach_bundle (
628 bind (mem_fun (*this, &MixerStrip::add_bundle_to_input_menu), current)
631 input_menu.popup (1, ev->time);
641 MixerStrip::bundle_input_chosen (boost::shared_ptr<ARDOUR::Bundle> c)
643 if (!ignore_toggle) {
646 _route->connect_input_ports_to_bundle (c, this);
649 catch (AudioEngine::PortRegistrationFailure& err) {
650 error << _("could not register new ports required for that bundle")
657 MixerStrip::bundle_output_chosen (boost::shared_ptr<ARDOUR::Bundle> c)
659 if (!ignore_toggle) {
662 _route->connect_output_ports_to_bundle (c, this);
665 catch (AudioEngine::PortRegistrationFailure& err) {
666 error << _("could not register new ports required for that bundle")
673 MixerStrip::add_bundle_to_input_menu (boost::shared_ptr<Bundle> b, std::vector<boost::shared_ptr<Bundle> > const & current)
675 using namespace Menu_Helpers;
677 /* the input menu needs to contain only output bundles (that we
678 can connect inputs to */
679 if (b->ports_are_outputs() == false) {
683 MenuList& citems = input_menu.items();
685 if (b->nchannels() == _route->n_inputs()) {
687 citems.push_back (CheckMenuElem (b->name(), bind (mem_fun(*this, &MixerStrip::bundle_input_chosen), b)));
689 if (std::find (current.begin(), current.end(), b) != current.end()) {
690 ignore_toggle = true;
691 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
692 ignore_toggle = false;
698 MixerStrip::add_bundle_to_output_menu (boost::shared_ptr<Bundle> b, std::vector<boost::shared_ptr<Bundle> > const & current)
700 using namespace Menu_Helpers;
702 /* the output menu needs to contain only input bundles (that we
703 can connect outputs to */
704 if (b->ports_are_inputs() == false) {
708 if (b->nchannels() == _route->n_outputs()) {
710 MenuList& citems = output_menu.items();
711 citems.push_back (CheckMenuElem (b->name(), bind (mem_fun(*this, &MixerStrip::bundle_output_chosen), b)));
713 if (std::find (current.begin(), current.end(), b) != current.end()) {
714 ignore_toggle = true;
715 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
716 ignore_toggle = false;
722 MixerStrip::update_diskstream_display ()
726 if (input_selector) {
727 input_selector->hide_all ();
734 show_passthru_color ();
739 MixerStrip::connect_to_pan ()
741 ENSURE_GUI_THREAD(mem_fun(*this, &MixerStrip::connect_to_pan));
743 panstate_connection.disconnect ();
744 panstyle_connection.disconnect ();
746 if (!_route->panner().empty()) {
747 StreamPanner* sp = _route->panner().front();
749 panstate_connection = sp->pan_control()->list()->automation_state_changed.connect (mem_fun(panners, &PannerUI::pan_automation_state_changed));
750 panstyle_connection = sp->pan_control()->list()->automation_style_changed.connect (mem_fun(panners, &PannerUI::pan_automation_style_changed));
753 panners.pan_changed (this);
757 MixerStrip::update_input_display ()
759 std::vector<boost::shared_ptr<ARDOUR::Bundle> > c = _route->bundles_connected_to_inputs ();
761 /* XXX: how do we represent >1 connected bundle? */
762 if (c.empty() == false) {
763 input_label.set_text (c[0]->name());
767 input_label.set_text (_(" Input"));
770 input_label.set_text (_("I"));
774 panners.setup_pan ();
778 MixerStrip::update_output_display ()
780 std::vector<boost::shared_ptr<ARDOUR::Bundle> > c = _route->bundles_connected_to_outputs ();
782 /* XXX: how do we represent >1 connected bundle? */
783 if (c.empty() == false) {
784 output_label.set_text (c[0]->name());
788 output_label.set_text (_("Output"));
791 output_label.set_text (_("O"));
796 panners.setup_pan ();
800 MixerStrip::fast_update ()
802 gpm.update_meters ();
806 MixerStrip::diskstream_changed ()
808 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_diskstream_display));
812 MixerStrip::input_changed (IOChange change, void *src)
814 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_input_display));
815 set_width(_width, this);
819 MixerStrip::output_changed (IOChange change, void *src)
821 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_output_display));
822 set_width(_width, this);
827 MixerStrip::comment_editor_done_editing()
829 string str = comment_area->get_buffer()->get_text();
830 if (_route->comment() != str) {
831 _route->set_comment (str, this);
837 comment_button.modify_bg (STATE_NORMAL, color());
838 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Comments*"));
840 comment_button.unset_bg (STATE_NORMAL);
841 ((Gtk::Label*)comment_button.get_child())->set_text (_("Comments"));
847 comment_button.modify_bg (STATE_NORMAL, color());
848 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Cmt*"));
850 comment_button.unset_bg (STATE_NORMAL);
851 ((Gtk::Label*)comment_button.get_child())->set_text (_("Cmt"));
856 ARDOUR_UI::instance()->tooltips().set_tip (comment_button,
857 str.empty() ? _("Click to Add/Edit Comments") : str);
863 MixerStrip::comment_button_clicked ()
865 if (comment_window == 0) {
866 setup_comment_editor ();
869 int x, y, cw_width, cw_height;
871 if (comment_window->is_visible()) {
872 comment_window->hide ();
876 comment_window->get_size (cw_width, cw_height);
877 comment_window->get_position(x, y);
878 comment_window->move(x, y - (cw_height / 2) - 45);
880 half the dialog height minus the comments button height
881 with some window decoration fudge thrown in.
884 comment_window->show();
885 comment_window->present();
889 MixerStrip::setup_comment_editor ()
892 title = _route->name();
893 title += _(": comment editor");
895 comment_window = new ArdourDialog (title, false);
896 comment_window->set_position (Gtk::WIN_POS_MOUSE);
897 comment_window->set_skip_taskbar_hint (true);
898 comment_window->signal_hide().connect (mem_fun(*this, &MixerStrip::comment_editor_done_editing));
900 comment_area = manage (new TextView());
901 comment_area->set_name ("MixerTrackCommentArea");
902 comment_area->set_size_request (110, 178);
903 comment_area->set_wrap_mode (WRAP_WORD);
904 comment_area->set_editable (true);
905 comment_area->get_buffer()->set_text (_route->comment());
906 comment_area->show ();
908 comment_window->get_vbox()->pack_start (*comment_area);
909 comment_window->get_action_area()->hide();
913 MixerStrip::comment_changed (void *src)
915 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::comment_changed), src));
918 ignore_comment_edit = true;
920 comment_area->get_buffer()->set_text (_route->comment());
922 ignore_comment_edit = false;
927 MixerStrip::set_mix_group (RouteGroup *rg)
929 _route->set_mix_group (rg, this);
933 MixerStrip::add_mix_group_to_menu (RouteGroup *rg, RadioMenuItem::Group* group)
935 using namespace Menu_Helpers;
937 MenuList& items = group_menu->items();
939 items.push_back (RadioMenuElem (*group, rg->name(), bind (mem_fun(*this, &MixerStrip::set_mix_group), rg)));
941 if (_route->mix_group() == rg) {
942 static_cast<RadioMenuItem*>(&items.back())->set_active ();
947 MixerStrip::select_mix_group (GdkEventButton *ev)
949 using namespace Menu_Helpers;
951 if (group_menu == 0) {
952 group_menu = new Menu;
954 group_menu->set_name ("ArdourContextMenu");
955 MenuList& items = group_menu->items();
956 RadioMenuItem::Group group;
958 switch (ev->button) {
962 items.push_back (RadioMenuElem (group, _("No group"), bind (mem_fun(*this, &MixerStrip::set_mix_group), (RouteGroup *) 0)));
964 _session.foreach_mix_group (bind (mem_fun (*this, &MixerStrip::add_mix_group_to_menu), &group));
966 group_menu->popup (1, ev->time);
977 MixerStrip::mix_group_changed (void *ignored)
979 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::mix_group_changed), ignored));
981 RouteGroup *rg = _route->mix_group();
984 group_label.set_text (rg->name());
988 group_label.set_text (_("Grp"));
991 group_label.set_text (_("~G"));
999 MixerStrip::route_gui_changed (string what_changed, void* ignored)
1001 ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::route_gui_changed), what_changed, ignored));
1003 if (what_changed == "color") {
1004 if (set_color_from_route () == 0) {
1005 show_route_color ();
1011 MixerStrip::show_route_color ()
1013 name_button.modify_bg (STATE_NORMAL, color());
1014 top_event_box.modify_bg (STATE_NORMAL, color());
1015 route_active_changed ();
1019 MixerStrip::show_passthru_color ()
1021 route_active_changed ();
1025 MixerStrip::build_route_ops_menu ()
1027 using namespace Menu_Helpers;
1028 route_ops_menu = manage (new Menu);
1029 route_ops_menu->set_name ("ArdourContextMenu");
1031 MenuList& items = route_ops_menu->items();
1033 items.push_back (MenuElem (_("Rename"), mem_fun(*this, &RouteUI::route_rename)));
1034 items.push_back (SeparatorElem());
1035 items.push_back (CheckMenuElem (_("Active"), mem_fun (*this, &RouteUI::toggle_route_active)));
1036 route_active_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
1037 route_active_menu_item->set_active (_route->active());
1039 items.push_back (SeparatorElem());
1041 items.push_back (MenuElem (_("Adjust latency"), mem_fun (*this, &RouteUI::adjust_latency)));
1043 items.push_back (SeparatorElem());
1044 items.push_back (CheckMenuElem (_("Invert Polarity"), mem_fun (*this, &RouteUI::toggle_polarity)));
1045 polarity_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
1046 polarity_menu_item->set_active (_route->phase_invert());
1047 items.push_back (CheckMenuElem (_("Protect against denormals"), mem_fun (*this, &RouteUI::toggle_denormal_protection)));
1048 denormal_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
1049 denormal_menu_item->set_active (_route->denormal_protection());
1051 build_remote_control_menu ();
1053 items.push_back (SeparatorElem());
1054 if (!Profile->get_sae()) {
1055 items.push_back (MenuElem (_("Remote Control ID"), *remote_control_menu));
1058 items.push_back (SeparatorElem());
1059 items.push_back (MenuElem (_("Remove"), mem_fun(*this, &RouteUI::remove_this_route)));
1063 MixerStrip::name_button_button_press (GdkEventButton* ev)
1065 if (ev->button == 1) {
1066 list_route_operations ();
1068 Menu_Helpers::MenuList& items = route_ops_menu->items();
1069 /* do not allow rename if the track is record-enabled */
1070 static_cast<MenuItem*> (&items.front())->set_sensitive (!_route->record_enabled());
1072 route_ops_menu->popup (1, ev->time);
1078 MixerStrip::list_route_operations ()
1080 if (route_ops_menu == 0) {
1081 build_route_ops_menu ();
1084 refresh_remote_control_menu();
1089 MixerStrip::speed_adjustment_changed ()
1091 /* since there is a usable speed adjustment, there has to be a diskstream */
1092 if (!ignore_speed_adjustment) {
1093 get_diskstream()->set_speed (speed_adjustment.get_value());
1098 MixerStrip::speed_changed ()
1100 Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_speed_display));
1104 MixerStrip::update_speed_display ()
1108 val = get_diskstream()->speed();
1111 speed_spinner.set_name ("MixerStripSpeedBaseNotOne");
1113 speed_spinner.set_name ("MixerStripSpeedBase");
1116 if (speed_adjustment.get_value() != val) {
1117 ignore_speed_adjustment = true;
1118 speed_adjustment.set_value (val);
1119 ignore_speed_adjustment = false;
1125 MixerStrip::set_selected (bool yn)
1127 AxisView::set_selected (yn);
1129 global_frame.set_shadow_type (Gtk::SHADOW_ETCHED_OUT);
1130 global_frame.set_name ("MixerStripSelectedFrame");
1132 global_frame.set_shadow_type (Gtk::SHADOW_IN);
1133 global_frame.set_name ("MixerStripFrame");
1135 global_frame.queue_draw ();
1139 MixerStrip::name_changed ()
1143 RouteUI::name_changed ();
1146 name_label.set_text (PBD::short_version (_route->name(), 5));
1149 if (_route->phase_invert()) {
1150 name_label.set_text (X_("Ø ") + name_label.get_text());
1155 MixerStrip::width_clicked ()
1159 set_width (Narrow, this);
1162 set_width (Wide, this);
1168 MixerStrip::hide_clicked ()
1170 // LAME fix to reset the button status for when it is redisplayed (part 1)
1171 hide_button.set_sensitive(false);
1174 Hiding(); /* EMIT_SIGNAL */
1176 _mixer.hide_strip (this);
1180 hide_button.set_sensitive(true);
1184 MixerStrip::set_embedded (bool yn)
1190 MixerStrip::map_frozen ()
1192 ENSURE_GUI_THREAD (mem_fun(*this, &MixerStrip::map_frozen));
1194 boost::shared_ptr<AudioTrack> at = audio_track();
1197 switch (at->freeze_state()) {
1198 case AudioTrack::Frozen:
1199 pre_processor_box.set_sensitive (false);
1200 post_processor_box.set_sensitive (false);
1201 speed_spinner.set_sensitive (false);
1204 pre_processor_box.set_sensitive (true);
1205 post_processor_box.set_sensitive (true);
1206 speed_spinner.set_sensitive (true);
1207 // XXX need some way, maybe, to retoggle redirect editors
1212 hide_redirect_editors ();
1216 MixerStrip::hide_redirect_editors ()
1218 _route->foreach_processor (this, &MixerStrip::hide_processor_editor);
1222 MixerStrip::hide_processor_editor (boost::shared_ptr<Processor> processor)
1224 void* gui = processor->get_gui ();
1227 static_cast<Gtk::Widget*>(gui)->hide ();
1232 MixerStrip::route_active_changed ()
1234 RouteUI::route_active_changed ();
1236 if (is_midi_track()) {
1237 if (_route->active()) {
1238 set_name ("MidiTrackStripBase");
1239 gpm.set_meter_strip_name ("MidiTrackStripBase");
1241 set_name ("MidiTrackStripBaseInactive");
1242 gpm.set_meter_strip_name ("MidiTrackStripBaseInactive");
1244 gpm.set_fader_name ("MidiTrackFader");
1245 } else if (is_audio_track()) {
1246 if (_route->active()) {
1247 set_name ("AudioTrackStripBase");
1248 gpm.set_meter_strip_name ("AudioTrackMetrics");
1250 set_name ("AudioTrackStripBaseInactive");
1251 gpm.set_meter_strip_name ("AudioTrackMetricsInactive");
1253 gpm.set_fader_name ("AudioTrackFader");
1255 if (_route->active()) {
1256 set_name ("AudioBusStripBase");
1257 gpm.set_meter_strip_name ("AudioBusMetrics");
1259 set_name ("AudioBusStripBaseInactive");
1260 gpm.set_meter_strip_name ("AudioBusMetricsInactive");
1262 gpm.set_fader_name ("AudioBusFader");
1264 /* (no MIDI busses yet) */
1269 MixerStrip::mix_group() const
1271 return _route->mix_group();
1275 MixerStrip::engine_stopped ()
1280 MixerStrip::engine_running ()
1285 MixerStrip::meter_changed (void *src)
1288 ENSURE_GUI_THREAD (bind (mem_fun(*this, &MixerStrip::meter_changed), src));
1290 switch (_route->meter_point()) {
1292 meter_point_label.set_text (_("input"));
1296 meter_point_label.set_text (_("pre"));
1299 case MeterPostFader:
1300 meter_point_label.set_text (_("post"));
1304 gpm.setup_meters ();
1305 // reset peak when meter point changes
1306 gpm.reset_peak_display();
1307 set_width(_width, this);