allow dragging of automation lines (Ben Loftis, backported from 2.X)
[ardour.git] / gtk2_ardour / mixer_strip.cc
1 /*
2     Copyright (C) 2000-2006 Paul Davis
3
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.
8
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.
13
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.
17 */
18
19 #include <cmath>
20 #include <algorithm>
21
22 #include <sigc++/bind.h>
23
24 #include "pbd/convert.h"
25 #include "pbd/enumwriter.h"
26 #include "pbd/replace_all.h"
27
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>
35
36 #include "ardour/ardour.h"
37 #include "ardour/session.h"
38 #include "ardour/audioengine.h"
39 #include "ardour/route.h"
40 #include "ardour/route_group.h"
41 #include "ardour/audio_track.h"
42 #include "ardour/audio_diskstream.h"
43 #include "ardour/panner.h"
44 #include "ardour/send.h"
45 #include "ardour/processor.h"
46 #include "ardour/profile.h"
47 #include "ardour/ladspa_plugin.h"
48 #include "ardour/user_bundle.h"
49
50 #include "ardour_ui.h"
51 #include "ardour_dialog.h"
52 #include "mixer_strip.h"
53 #include "mixer_ui.h"
54 #include "keyboard.h"
55 #include "public_editor.h"
56 #include "send_ui.h"
57 #include "io_selector.h"
58 #include "utils.h"
59 #include "gui_thread.h"
60
61 #include "i18n.h"
62
63 using namespace sigc;
64 using namespace ARDOUR;
65 using namespace PBD;
66 using namespace Gtk;
67 using namespace Gtkmm2ext;
68 using namespace std;
69
70 int MixerStrip::scrollbar_height = 0;
71
72 #ifdef VARISPEED_IN_MIXER_STRIP
73 static void 
74 speed_printer (char buf[32], Gtk::Adjustment& adj, void* arg)
75 {
76         float val = adj.get_value ();
77
78         if (val == 1.0) {
79                 strcpy (buf, "1");
80         } else {
81                 snprintf (buf, 32, "%.3f", val);
82         }
83 }
84 #endif 
85
86 MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, bool in_mixer)
87         : AxisView(sess)
88         , RouteUI (sess, _("Mute"), _("Solo"), _("Record"))
89         ,_mixer(mx)
90         , _mixer_owned (in_mixer)
91         , pre_processor_box (PreFader, sess, mx.plugin_selector(), mx.selection(), in_mixer)
92         , post_processor_box (PostFader, sess, mx.plugin_selector(), mx.selection(), in_mixer)
93         , gpm (sess)
94         , panners (sess)
95         , button_table (3, 2)
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)
102                          
103 {
104         init ();
105 }
106
107 MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, boost::shared_ptr<Route> rt, bool in_mixer)
108         : AxisView(sess)
109         , RouteUI (sess, _("Mute"), _("Solo"), _("Record"))
110         ,_mixer(mx)
111         , _mixer_owned (in_mixer)
112         , pre_processor_box (PreFader, sess, mx.plugin_selector(), mx.selection(), in_mixer)
113         , post_processor_box (PostFader, sess, mx.plugin_selector(), mx.selection(), in_mixer)
114         , gpm (sess)
115         , panners (sess)
116         , button_table (3, 2)
117         , middle_button_table (1, 2)
118         , bottom_button_table (1, 2)
119         , meter_point_label (_("pre"))
120         , comment_button (_("Comments"))
121         , speed_adjustment (1.0, 0.001, 4.0, 0.001, 0.1)
122         , speed_spinner (&speed_adjustment, "MixerStripSpeedBase", true)
123                          
124 {
125         init ();
126         set_route (rt);
127 }
128
129 void
130 MixerStrip::init ()
131 {
132         input_selector = 0;
133         output_selector = 0;
134         group_menu = 0;
135         _marked_for_display = false;
136         route_ops_menu = 0;
137         ignore_comment_edit = false;
138         ignore_toggle = false;
139         ignore_speed_adjustment = false;
140         comment_window = 0;
141         comment_area = 0;
142         _width_owner = 0;
143         spacer = 0;
144
145         Gtk::Image* img;
146
147         img = manage (new Gtk::Image (::get_icon("strip_width")));
148         img->show ();
149
150         width_button.add (*img);
151
152         img = manage (new Gtk::Image (::get_icon("hide")));
153         img->show ();
154
155         hide_button.add (*img);
156
157         input_label.set_text (_("Input"));
158         ARDOUR_UI::instance()->set_tip (&input_button, _("Button 1 to choose inputs from a port matrix, button 3 to select inputs from a menu"), "");
159         input_button.add (input_label);
160         input_button.set_name ("MixerIOButton");
161         input_label.set_name ("MixerIOButtonLabel");
162         Gtkmm2ext::set_size_request_to_display_given_text (input_button, "longest label", 4, 4);
163
164         output_label.set_text (_("Output"));
165         ARDOUR_UI::instance()->set_tip (&output_button, _("Button 1 to choose outputs from a port matrix, button 3 to select inputs from a menu"), "");
166         output_button.add (output_label);
167         output_button.set_name ("MixerIOButton");
168         output_label.set_name ("MixerIOButtonLabel");
169         Gtkmm2ext::set_size_request_to_display_given_text (output_button, "longest label", 4, 4);
170
171         ARDOUR_UI::instance()->set_tip (&meter_point_button, _("Select metering point"), "");
172         meter_point_button.add (meter_point_label);
173         meter_point_button.set_name ("MixerStripMeterPreButton");
174         meter_point_label.set_name ("MixerStripMeterPreButton");
175         
176         /* TRANSLATORS: this string should be longest of the strings
177            used to describe meter points. In english, it's "input".
178         */
179         set_size_request_to_display_given_text (meter_point_button, _("tupni"), 5, 5);
180     
181         bottom_button_table.attach (meter_point_button, 1, 2, 0, 1);
182     
183         meter_point_button.signal_button_press_event().connect (mem_fun (gpm, &GainMeter::meter_press), false);
184         /* XXX what is this meant to do? */
185         //meter_point_button.signal_button_release_event().connect (mem_fun (gpm, &GainMeter::meter_release), false);
186
187         hide_button.set_events (hide_button.get_events() & ~(Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK));
188
189         mute_button->set_name ("MixerMuteButton");
190         solo_button->set_name ("MixerSoloButton");
191
192         button_table.set_homogeneous (true);
193         button_table.set_spacings (0);
194
195         button_table.attach (name_button, 0, 2, 0, 1);
196         button_table.attach (input_button, 0, 2, 1, 2);
197
198         middle_button_table.set_homogeneous (true);
199         middle_button_table.set_spacings (0);
200         middle_button_table.attach (*mute_button, 0, 1, 0, 1);
201         middle_button_table.attach (*solo_button, 1, 2, 0, 1);
202
203         bottom_button_table.set_col_spacings (0);
204         bottom_button_table.set_homogeneous (true);
205         bottom_button_table.attach (group_button, 0, 1, 0, 1);
206         
207         name_button.add (name_label);
208         name_button.set_name ("MixerNameButton");
209         Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2);
210
211         name_label.set_name ("MixerNameButtonLabel");
212         ARDOUR_UI::instance()->set_tip (&group_button, _("Mix group"), "");
213         group_button.add (group_label);
214         group_button.set_name ("MixerGroupButton");
215         group_label.set_name ("MixerGroupButtonLabel");
216
217         comment_button.set_name ("MixerCommentButton");
218
219         comment_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::comment_button_clicked));
220         
221         global_vpacker.set_border_width (0);
222         global_vpacker.set_spacing (0);
223
224         width_button.set_name ("MixerWidthButton");
225         hide_button.set_name ("MixerHideButton");
226         top_event_box.set_name ("MixerTopEventBox");
227
228         width_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::width_clicked));
229         hide_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::hide_clicked));
230
231         width_hide_box.pack_start (width_button, false, true);
232         width_hide_box.pack_start (top_event_box, true, true);
233         width_hide_box.pack_end (hide_button, false, true);
234         gain_meter_alignment.set_padding(0, 4, 0, 0);
235         gain_meter_alignment.add(gpm);
236
237         whvbox.pack_start (width_hide_box, true, true);
238
239         global_vpacker.pack_start (whvbox, Gtk::PACK_SHRINK);
240         global_vpacker.pack_start (button_table,Gtk::PACK_SHRINK);
241         global_vpacker.pack_start (pre_processor_box, true, true);
242         global_vpacker.pack_start (middle_button_table,Gtk::PACK_SHRINK);
243         global_vpacker.pack_start (gain_meter_alignment,Gtk::PACK_SHRINK);
244         global_vpacker.pack_start (bottom_button_table,Gtk::PACK_SHRINK);
245         global_vpacker.pack_start (post_processor_box, true, true);
246         if (!is_midi_track()) {
247                 global_vpacker.pack_start (panners, Gtk::PACK_SHRINK);
248         }
249         global_vpacker.pack_start (output_button, Gtk::PACK_SHRINK);
250         global_vpacker.pack_start (comment_button, Gtk::PACK_SHRINK);
251
252         global_frame.add (global_vpacker);
253         global_frame.set_shadow_type (Gtk::SHADOW_IN);
254         global_frame.set_name ("BaseFrame");
255
256         add (global_frame);
257
258         /* force setting of visible selected status */
259
260         _selected = true;
261         set_selected (false);
262
263         _packed = false;
264         _embedded = false;
265
266         _session.engine().Stopped.connect (mem_fun(*this, &MixerStrip::engine_stopped));
267         _session.engine().Running.connect (mem_fun(*this, &MixerStrip::engine_running));
268
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);
271
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);
276
277         /* we don't need this if its not an audio track, but we don't know that yet and it doesn't
278            hurt (much).
279         */
280
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));
284
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);
287
288         _width = (Width) -1;
289
290         /* start off as a passthru strip. we'll correct this, if necessary,
291            in update_diskstream_display().
292         */
293
294         /* start off as a passthru strip. we'll correct this, if necessary,
295            in update_diskstream_display().
296         */
297
298         if (is_midi_track())
299                 set_name ("MidiTrackStripBase");
300         else
301                 set_name ("AudioTrackStripBase");
302
303         add_events (Gdk::BUTTON_RELEASE_MASK);
304 }
305
306 MixerStrip::~MixerStrip ()
307 {
308         GoingAway(); /* EMIT_SIGNAL */
309
310         delete input_selector;
311         delete output_selector;
312 }
313
314 void
315 MixerStrip::set_route (boost::shared_ptr<Route> rt)
316 {
317         if (rec_enable_button->get_parent()) {
318                 button_table.remove (*rec_enable_button);
319         }
320
321 #ifdef VARISPEED_IN_MIXER_STRIP
322         if (speed_frame->get_parent()) {
323                 button_table.remove (*speed_frame);
324         }
325 #endif
326
327         RouteUI::set_route (rt);
328
329         delete input_selector;
330         input_selector = 0;
331
332         delete output_selector;
333         output_selector = 0;
334
335         panners.set_io (rt);
336         gpm.set_io (rt);
337         pre_processor_box.set_route (rt);
338         post_processor_box.set_route (rt);
339
340         if (set_color_from_route()) {
341                 set_color (unique_random_color());
342         }
343
344         if (_mixer_owned && (route()->is_master() || route()->is_control())) {
345                 
346                 if (scrollbar_height == 0) {
347                         HScrollbar scrollbar;
348                         Gtk::Requisition requisition(scrollbar.size_request ());
349                         scrollbar_height = requisition.height;
350                 }
351
352                 spacer = manage (new EventBox);
353                 spacer->set_size_request (-1, scrollbar_height);
354                 global_vpacker.pack_start (*spacer, false, false);
355         }
356
357         if (is_audio_track()) {
358
359                 boost::shared_ptr<AudioTrack> at = audio_track();
360
361                 connections.push_back (at->FreezeChange.connect (mem_fun(*this, &MixerStrip::map_frozen)));
362
363 #ifdef VARISPEED_IN_MIXER_STRIP
364                 speed_adjustment.signal_value_changed().connect (mem_fun(*this, &MixerStrip::speed_adjustment_changed));
365                 
366                 speed_frame.set_name ("BaseFrame");
367                 speed_frame.set_shadow_type (Gtk::SHADOW_IN);
368                 speed_frame.add (speed_spinner);
369                 
370                 speed_spinner.set_print_func (speed_printer, 0);
371
372                 ARDOUR_UI::instance()->tooltips().set_tip (speed_spinner, _("Varispeed"));
373
374                 button_table.attach (speed_frame, 0, 2, 5, 6);
375 #endif /* VARISPEED_IN_MIXER_STRIP */
376
377                 button_table.attach (*rec_enable_button, 0, 2, 2, 3);
378                 rec_enable_button->show();
379         }
380
381         if (_route->phase_invert()) {
382                 name_label.set_text (X_("Ø ") + name_label.get_text());
383         } else {
384                 name_label.set_text (_route->name());
385         }
386
387         switch (_route->meter_point()) {
388         case MeterInput:
389                 meter_point_label.set_text (_("input"));
390                 break;
391                 
392         case MeterPreFader:
393                 meter_point_label.set_text (_("pre"));
394                 break;
395                 
396         case MeterPostFader:
397                 meter_point_label.set_text (_("post"));
398                 break;
399         }
400
401         delete route_ops_menu;
402         route_ops_menu = 0;
403         
404         ARDOUR_UI::instance()->tooltips().set_tip (comment_button, _route->comment().empty() ?
405                                                    _("Click to Add/Edit Comments"):
406                                                    _route->comment());
407
408         connections.push_back (_route->meter_change.connect (mem_fun(*this, &MixerStrip::meter_changed)));
409         connections.push_back (_route->input_changed.connect (mem_fun(*this, &MixerStrip::input_changed)));
410         connections.push_back (_route->output_changed.connect (mem_fun(*this, &MixerStrip::output_changed)));
411         connections.push_back (_route->mute_changed.connect (mem_fun(*this, &RouteUI::mute_changed)));
412         connections.push_back (_route->solo_changed.connect (mem_fun(*this, &RouteUI::solo_changed)));
413         connections.push_back (_route->solo_safe_changed.connect (mem_fun(*this, &RouteUI::solo_changed)));
414         connections.push_back (_route->mix_group_changed.connect (mem_fun(*this, &MixerStrip::mix_group_changed)));
415         connections.push_back (_route->panner().Changed.connect (mem_fun(*this, &MixerStrip::connect_to_pan)));
416
417         if (is_audio_track()) {
418                 connections.push_back (audio_track()->DiskstreamChanged.connect (mem_fun(*this, &MixerStrip::diskstream_changed)));
419                 connections.push_back (get_diskstream()->SpeedChanged.connect (mem_fun(*this, &MixerStrip::speed_changed)));
420         }
421
422         connections.push_back (_route->NameChanged.connect (mem_fun(*this, &RouteUI::name_changed)));
423         connections.push_back (_route->comment_changed.connect (mem_fun(*this, &MixerStrip::comment_changed)));
424         connections.push_back (_route->gui_changed.connect (mem_fun(*this, &MixerStrip::route_gui_changed)));
425
426         set_stuff_from_route ();
427
428         /* now force an update of all the various elements */
429
430         pre_processor_box.update();
431         post_processor_box.update();
432         mute_changed (0);
433         solo_changed (0);
434         name_changed ();
435         comment_changed (0);
436         mix_group_changed (0);
437
438         connect_to_pan ();
439
440         panners.setup_pan ();
441
442         if (is_audio_track()) {
443                 speed_changed ();
444         }
445
446         update_diskstream_display ();
447         update_input_display ();
448         update_output_display ();
449
450         add_events (Gdk::BUTTON_RELEASE_MASK);
451
452         pre_processor_box.show();
453
454         if (!route()->is_master() && !route()->is_control()) {
455                 /* we don't allow master or control routes to be hidden */
456                 hide_button.show();
457         }
458
459         width_button.show();
460         width_hide_box.show();
461         whvbox.show ();
462         global_frame.show();
463         global_vpacker.show();
464         button_table.show();
465         middle_button_table.show();
466         bottom_button_table.show();
467         pre_processor_box.show_all ();
468         gpm.show_all ();
469         panners.show_all ();
470         gain_meter_alignment.show ();
471         post_processor_box.show_all ();
472         gain_unit_button.show();
473         gain_unit_label.show();
474         meter_point_button.show();
475         meter_point_label.show();
476         diskstream_button.show();
477         diskstream_label.show();
478         input_button.show();
479         input_label.show();
480         output_button.show();
481         output_label.show();
482         name_label.show();
483         name_button.show();
484         comment_button.show();
485         group_button.show();
486         group_label.show();
487         speed_spinner.show();
488         speed_label.show();
489         speed_frame.show();
490
491         show ();
492 }
493
494 void
495 MixerStrip::set_stuff_from_route ()
496 {
497         XMLProperty *prop;
498
499         ensure_xml_node ();
500
501         /* if width is not set, it will be set by the MixerUI or editor */
502
503         if ((prop = xml_node->property ("strip-width")) != 0) {
504                 set_width (Width (string_2_enum (prop->value(), _width)), this);
505         }
506
507         if ((prop = xml_node->property ("shown-mixer")) != 0) {
508                 if (prop->value() == "no") {
509                         _marked_for_display = false;
510                 } else {
511                         _marked_for_display = true;
512                 }
513         } else {
514                 /* backwards compatibility */
515                 _marked_for_display = true;
516         }
517 }
518
519 void
520 MixerStrip::set_width (Width w, void* owner)
521 {
522         /* always set the gpm width again, things may be hidden */
523
524         gpm.set_width (w);
525         panners.set_width (w);
526         pre_processor_box.set_width (w);
527         post_processor_box.set_width (w);
528
529         boost::shared_ptr<AutomationList> gain_automation = _route->gain_control()->alist();
530
531         _width_owner = owner;
532
533         ensure_xml_node ();
534         
535         _width = w;
536
537         if (_width_owner == this) {
538                 xml_node->add_property ("strip-width", enum_2_string (_width));
539         }
540
541         switch (w) {
542         case Wide:
543
544                 if (rec_enable_button)  {
545                         ((Gtk::Label*)rec_enable_button->get_child())->set_text (_("Record"));
546                 }
547                 ((Gtk::Label*)mute_button->get_child())->set_text  (_("Mute"));
548                 ((Gtk::Label*)solo_button->get_child())->set_text (_("Solo"));
549
550                 if (_route->comment() == "") {
551                        comment_button.unset_bg (STATE_NORMAL);
552                        ((Gtk::Label*)comment_button.get_child())->set_text (_("Comments"));
553                 } else {
554                        comment_button.modify_bg (STATE_NORMAL, color());
555                        ((Gtk::Label*)comment_button.get_child())->set_text (_("*Comments*"));
556                 }
557
558                 ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (gpm.astyle_string(gain_automation->automation_style()));
559                 ((Gtk::Label*)gpm.gain_automation_state_button.get_child())->set_text (gpm.astate_string(gain_automation->automation_state()));
560                 ((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text (panners.astyle_string(_route->panner().automation_style()));
561                 ((Gtk::Label*)panners.pan_automation_state_button.get_child())->set_text (panners.astate_string(_route->panner().automation_state()));
562                 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "long", 2, 2);
563                 set_size_request (-1, -1);
564                 break;
565
566         case Narrow:
567                 if (rec_enable_button) {
568                         ((Gtk::Label*)rec_enable_button->get_child())->set_text (_("Rec"));
569                 }
570                 ((Gtk::Label*)mute_button->get_child())->set_text (_("M"));
571                 ((Gtk::Label*)solo_button->get_child())->set_text (_("S"));
572
573                 if (_route->comment() == "") {
574                        comment_button.unset_bg (STATE_NORMAL);
575                        ((Gtk::Label*)comment_button.get_child())->set_text (_("Cmt"));
576                 } else {
577                        comment_button.modify_bg (STATE_NORMAL, color());
578                        ((Gtk::Label*)comment_button.get_child())->set_text (_("*Cmt*"));
579                 }
580
581                 ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (gpm.short_astyle_string(gain_automation->automation_style()));
582                 ((Gtk::Label*)gpm.gain_automation_state_button.get_child())->set_text (gpm.short_astate_string(gain_automation->automation_state()));
583                 ((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text (panners.short_astyle_string(_route->panner().automation_style()));
584                 ((Gtk::Label*)panners.pan_automation_state_button.get_child())->set_text (panners.short_astate_string(_route->panner().automation_state()));
585                 Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2);
586                 set_size_request (max (50, gpm.get_gm_width()), -1);
587                 break;
588         }
589         update_input_display ();
590         update_output_display ();
591         mix_group_changed (0);
592         name_changed ();
593 #ifdef GTKOSX
594         WidthChanged();
595 #endif
596 }
597
598 void
599 MixerStrip::set_packed (bool yn)
600 {
601         _packed = yn;
602
603         ensure_xml_node ();
604
605         if (_packed) {
606                 xml_node->add_property ("shown-mixer", "yes");
607         } else {
608                 xml_node->add_property ("shown-mixer", "no");
609         }
610 }
611
612
613 gint
614 MixerStrip::output_press (GdkEventButton *ev)
615 {
616         using namespace Menu_Helpers;
617         if (!_session.engine().connected()) {
618                 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
619                 msg.run ();
620                 return true;
621         }
622
623         MenuList& citems = output_menu.items();
624         switch (ev->button) {
625
626         case 1:
627                 edit_output_configuration ();
628                 break;
629                 
630         case 3:
631         {
632                 output_menu.set_name ("ArdourContextMenu");
633                 citems.clear();
634                 
635                 citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_output)));
636                 citems.push_back (SeparatorElem());
637
638                 ARDOUR::BundleList current = _route->bundles_connected_to_outputs ();
639
640                 boost::shared_ptr<ARDOUR::BundleList> b = _session.bundles ();
641                 for (ARDOUR::BundleList::iterator i = b->begin(); i != b->end(); ++i) {
642                         maybe_add_bundle_to_output_menu (*i, current);
643                 }
644
645                 boost::shared_ptr<ARDOUR::RouteList> routes = _session.get_routes ();
646                 for (ARDOUR::RouteList::const_iterator i = routes->begin(); i != routes->end(); ++i) {
647                         maybe_add_bundle_to_output_menu ((*i)->bundle_for_inputs(), current);
648                 }
649
650                 if (citems.size() == 2) {
651                         /* no routes added; remove the separator */
652                         citems.pop_back ();
653                 }
654
655                 output_menu.popup (1, ev->time);
656                 break;
657         }
658
659         default:
660                 break;
661         }
662         return TRUE;
663 }
664
665 void
666 MixerStrip::edit_output_configuration ()
667 {
668         if (output_selector == 0) {
669                 output_selector = new IOSelectorWindow (_session, _route, false);
670         } 
671
672         if (output_selector->is_visible()) {
673                 output_selector->get_toplevel()->get_window()->raise();
674         } else {
675                 output_selector->present ();
676         }
677 }
678
679 void
680 MixerStrip::edit_input_configuration ()
681 {
682         if (input_selector == 0) {
683                 input_selector = new IOSelectorWindow (_session, _route, true);
684         } 
685
686         if (input_selector->is_visible()) {
687                 input_selector->get_toplevel()->get_window()->raise();
688         } else {
689                 input_selector->present ();
690         }
691 }
692
693 gint
694 MixerStrip::input_press (GdkEventButton *ev)
695 {
696         using namespace Menu_Helpers;
697
698         MenuList& citems = input_menu.items();
699         input_menu.set_name ("ArdourContextMenu");
700         citems.clear();
701         
702         if (!_session.engine().connected()) {
703                 MessageDialog msg (_("Not connected to JACK - no I/O changes are possible"));
704                 msg.run ();
705                 return true;
706         }
707
708         switch (ev->button) {
709
710         case 1:
711                 edit_input_configuration ();
712                 break;
713
714         case 3:
715         {
716                 citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_input)));
717                 citems.push_back (SeparatorElem());
718
719                 ARDOUR::BundleList current = _route->bundles_connected_to_inputs ();
720
721                 boost::shared_ptr<ARDOUR::BundleList> b = _session.bundles ();
722                 for (ARDOUR::BundleList::iterator i = b->begin(); i != b->end(); ++i) {
723                         maybe_add_bundle_to_input_menu (*i, current);
724                 }
725
726                 boost::shared_ptr<ARDOUR::RouteList> routes = _session.get_routes ();
727                 for (ARDOUR::RouteList::const_iterator i = routes->begin(); i != routes->end(); ++i) {
728                         maybe_add_bundle_to_input_menu ((*i)->bundle_for_outputs(), current);
729                 }
730
731                 if (citems.size() == 2) {
732                         /* no routes added; remove the separator */
733                         citems.pop_back ();
734                 }
735
736                 input_menu.popup (1, ev->time);
737                 break;
738         }
739         default:
740                 break;
741         }
742         return TRUE;
743 }
744
745 void
746 MixerStrip::bundle_input_toggled (boost::shared_ptr<ARDOUR::Bundle> c)
747 {
748         if (ignore_toggle) {
749                 return;
750         }
751
752         ARDOUR::BundleList current = _route->bundles_connected_to_inputs ();
753
754         if (std::find (current.begin(), current.end(), c) == current.end()) {
755                 _route->connect_input_ports_to_bundle (c, this);
756         } else {
757                 _route->disconnect_input_ports_from_bundle (c, this);
758         }
759 }
760
761 void
762 MixerStrip::bundle_output_toggled (boost::shared_ptr<ARDOUR::Bundle> c)
763 {
764         if (ignore_toggle) {
765                 return;
766         }
767
768         ARDOUR::BundleList current = _route->bundles_connected_to_outputs ();
769
770         if (std::find (current.begin(), current.end(), c) == current.end()) {
771                 _route->connect_output_ports_to_bundle (c, this);
772         } else {
773                 _route->disconnect_output_ports_from_bundle (c, this);
774         }
775 }
776
777 void
778 MixerStrip::maybe_add_bundle_to_input_menu (boost::shared_ptr<Bundle> b, ARDOUR::BundleList const & current)
779 {
780         using namespace Menu_Helpers;
781
782         if (b->ports_are_outputs() == false ||
783             route()->default_type() != b->type() ||
784             b->nchannels() != _route->n_inputs().get (b->type ())) {
785                 
786                 return;
787         }
788
789         MenuList& citems = input_menu.items();
790         
791         std::string n = b->name ();
792         replace_all (n, "_", " ");
793         
794         citems.push_back (CheckMenuElem (n, bind (mem_fun(*this, &MixerStrip::bundle_input_toggled), b)));
795         
796         if (std::find (current.begin(), current.end(), b) != current.end()) {
797                 ignore_toggle = true;
798                 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
799                 ignore_toggle = false;
800         }
801 }
802
803 void
804 MixerStrip::maybe_add_bundle_to_output_menu (boost::shared_ptr<Bundle> b, ARDOUR::BundleList const & current)
805 {
806         using namespace Menu_Helpers;
807
808         if (b->ports_are_inputs() == false ||
809             route()->default_type() != b->type() ||
810             b->nchannels() != _route->n_outputs().get (b->type ())) {
811                 
812                 return;
813         }
814
815         MenuList& citems = output_menu.items();
816         
817         std::string n = b->name ();
818         replace_all (n, "_", " ");
819         
820         citems.push_back (CheckMenuElem (n, bind (mem_fun(*this, &MixerStrip::bundle_output_toggled), b)));
821         
822         if (std::find (current.begin(), current.end(), b) != current.end()) {
823                 ignore_toggle = true;
824                 dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
825                 ignore_toggle = false;
826         }
827 }
828
829 void
830 MixerStrip::update_diskstream_display ()
831 {
832         if (is_track()) {
833
834                 if (input_selector) {
835                         input_selector->hide_all ();
836                 }
837
838                 show_route_color ();
839
840         } else {
841
842                 show_passthru_color ();
843         }
844 }
845
846 void
847 MixerStrip::connect_to_pan ()
848 {
849         ENSURE_GUI_THREAD(mem_fun(*this, &MixerStrip::connect_to_pan));
850
851         panstate_connection.disconnect ();
852         panstyle_connection.disconnect ();
853
854                 boost::shared_ptr<ARDOUR::AutomationControl> pan_control
855                         = boost::dynamic_pointer_cast<ARDOUR::AutomationControl>(
856                                 _route->panner().data().control(Evoral::Parameter( PanAutomation ) ));
857
858         if (pan_control) {
859                 panstate_connection = pan_control->alist()->automation_state_changed.connect (mem_fun(panners, &PannerUI::pan_automation_state_changed));
860                 panstyle_connection = pan_control->alist()->automation_style_changed.connect (mem_fun(panners, &PannerUI::pan_automation_style_changed));
861         }
862
863         panners.pan_changed (this);
864 }
865
866 void
867 MixerStrip::update_input_display ()
868 {
869         ARDOUR::BundleList const c = _route->bundles_connected_to_inputs ();
870
871         if (c.size() > 1) {
872                 input_label.set_text (_("Inputs"));
873         } else if (c.size() == 1) {
874                 input_label.set_text (c[0]->name ());
875         } else {
876                 switch (_width) {
877                 case Wide:
878                         input_label.set_text (_(" Input"));
879                         break;
880                 case Narrow:
881                         input_label.set_text (_("I"));
882                         break;
883                 }
884         }
885         panners.setup_pan ();
886 }
887
888 void
889 MixerStrip::update_output_display ()
890 {
891         ARDOUR::BundleList const c = _route->bundles_connected_to_outputs ();
892
893         /* XXX: how do we represent >1 connected bundle? */
894         if (c.size() > 1) {
895                 output_label.set_text (_("Outputs"));
896         } else if (c.size() == 1) {
897                 output_label.set_text (c[0]->name());
898         } else {
899                 switch (_width) {
900                 case Wide:
901                         output_label.set_text (_("Output"));
902                         break;
903                 case Narrow:
904                         output_label.set_text (_("O"));
905                         break;
906                 }
907         }
908
909         gpm.setup_meters ();
910         panners.setup_pan ();
911 }
912
913 void
914 MixerStrip::fast_update ()
915 {
916         gpm.update_meters ();
917 }
918
919 void
920 MixerStrip::diskstream_changed ()
921 {
922         Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_diskstream_display));
923 }       
924
925 void
926 MixerStrip::input_changed (IOChange change, void *src)
927 {
928         Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_input_display));
929         set_width(_width, this);
930 }
931
932 void
933 MixerStrip::output_changed (IOChange change, void *src)
934 {
935         Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_output_display));
936         set_width(_width, this);
937 }
938
939
940 void 
941 MixerStrip::comment_editor_done_editing() 
942 {
943         string str =  comment_area->get_buffer()->get_text();
944         if (_route->comment() != str) {
945                 _route->set_comment (str, this);
946
947                 switch (_width) {
948                    
949                 case Wide:
950                         if (! str.empty()) {
951                                 comment_button.modify_bg (STATE_NORMAL, color());
952                                 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Comments*"));
953                         } else {
954                                 comment_button.unset_bg (STATE_NORMAL);
955                                 ((Gtk::Label*)comment_button.get_child())->set_text (_("Comments"));
956                         }
957                         break;
958                    
959                 case Narrow:
960                         if (! str.empty()) {
961                                 comment_button.modify_bg (STATE_NORMAL, color());
962                                 ((Gtk::Label*)comment_button.get_child())->set_text (_("*Cmt*"));
963                         } else {
964                                 comment_button.unset_bg (STATE_NORMAL);
965                                 ((Gtk::Label*)comment_button.get_child())->set_text (_("Cmt"));
966                         } 
967                         break;
968                 }
969                  
970                 ARDOUR_UI::instance()->tooltips().set_tip (comment_button, 
971                                 str.empty() ? _("Click to Add/Edit Comments") : str);
972         }
973
974 }
975
976 void
977 MixerStrip::comment_button_clicked ()
978 {
979         if (comment_window == 0) {
980                 setup_comment_editor ();
981         }
982
983     int x, y, cw_width, cw_height;
984
985         if (comment_window->is_visible()) {
986                 comment_window->hide ();
987                 return;
988         }
989
990         comment_window->get_size (cw_width, cw_height);
991         comment_window->get_position(x, y);
992         comment_window->move(x, y - (cw_height / 2) - 45);
993         /* 
994            half the dialog height minus the comments button height 
995            with some window decoration fudge thrown in.
996         */
997
998         comment_window->show();
999         comment_window->present();
1000 }
1001
1002 void
1003 MixerStrip::setup_comment_editor ()
1004 {
1005         string title;
1006         title = _route->name();
1007         title += _(": comment editor");
1008
1009         comment_window = new ArdourDialog (title, false);
1010         comment_window->set_position (Gtk::WIN_POS_MOUSE);
1011         comment_window->set_skip_taskbar_hint (true);
1012         comment_window->signal_hide().connect (mem_fun(*this, &MixerStrip::comment_editor_done_editing));
1013
1014         comment_area = manage (new TextView());
1015         comment_area->set_name ("MixerTrackCommentArea");
1016         comment_area->set_size_request (110, 178);
1017         comment_area->set_wrap_mode (WRAP_WORD);
1018         comment_area->set_editable (true);
1019         comment_area->get_buffer()->set_text (_route->comment());
1020         comment_area->show ();
1021
1022         comment_window->get_vbox()->pack_start (*comment_area);
1023         comment_window->get_action_area()->hide();
1024 }
1025
1026 void
1027 MixerStrip::comment_changed (void *src)
1028 {
1029         ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::comment_changed), src));
1030         
1031         if (src != this) {
1032                 ignore_comment_edit = true;
1033                 if (comment_area) {
1034                         comment_area->get_buffer()->set_text (_route->comment());
1035                 }
1036                 ignore_comment_edit = false;
1037         }
1038 }
1039
1040 void
1041 MixerStrip::set_mix_group (RouteGroup *rg)
1042 {
1043         _route->set_mix_group (rg, this);
1044 }
1045
1046 void
1047 MixerStrip::add_mix_group_to_menu (RouteGroup *rg, RadioMenuItem::Group* group)
1048 {
1049         using namespace Menu_Helpers;
1050
1051         MenuList& items = group_menu->items();
1052
1053         items.push_back (RadioMenuElem (*group, rg->name(), bind (mem_fun(*this, &MixerStrip::set_mix_group), rg)));
1054
1055         if (_route->mix_group() == rg) {
1056                 static_cast<RadioMenuItem*>(&items.back())->set_active ();
1057         }
1058 }
1059
1060 bool
1061 MixerStrip::select_mix_group (GdkEventButton *ev)
1062 {
1063         using namespace Menu_Helpers;
1064
1065         if (group_menu == 0) {
1066                 group_menu = new Menu;
1067         } 
1068         group_menu->set_name ("ArdourContextMenu");
1069         MenuList& items = group_menu->items();
1070         RadioMenuItem::Group group;
1071
1072         switch (ev->button) {
1073         case 1:
1074
1075                 items.clear ();
1076                 items.push_back (RadioMenuElem (group, _("No group"), bind (mem_fun(*this, &MixerStrip::set_mix_group), (RouteGroup *) 0)));
1077
1078                 _session.foreach_mix_group (bind (mem_fun (*this, &MixerStrip::add_mix_group_to_menu), &group));
1079
1080                 group_menu->popup (1, ev->time);
1081                 break;
1082
1083         default:
1084                 break;
1085         }
1086         
1087         return true;
1088 }       
1089
1090 void
1091 MixerStrip::mix_group_changed (void *ignored)
1092 {
1093         ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::mix_group_changed), ignored));
1094         
1095         RouteGroup *rg = _route->mix_group();
1096         
1097         if (rg) {
1098                 group_label.set_text (rg->name());
1099         } else {
1100                 switch (_width) {
1101                 case Wide:
1102                         group_label.set_text (_("Grp"));
1103                         break;
1104                 case Narrow:
1105                         group_label.set_text (_("~G"));
1106                         break;
1107                 }
1108         }
1109 }
1110
1111
1112 void 
1113 MixerStrip::route_gui_changed (string what_changed, void* ignored)
1114 {
1115         ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::route_gui_changed), what_changed, ignored));
1116         
1117         if (what_changed == "color") {
1118                 if (set_color_from_route () == 0) {
1119                         show_route_color ();
1120                 }
1121         }
1122 }
1123
1124 void
1125 MixerStrip::show_route_color ()
1126 {
1127         name_button.modify_bg (STATE_NORMAL, color());
1128         top_event_box.modify_bg (STATE_NORMAL, color());
1129         route_active_changed ();
1130 }
1131
1132 void
1133 MixerStrip::show_passthru_color ()
1134 {
1135         route_active_changed ();
1136 }
1137
1138 void
1139 MixerStrip::build_route_ops_menu ()
1140 {
1141         using namespace Menu_Helpers;
1142         route_ops_menu = new Menu;
1143         route_ops_menu->set_name ("ArdourContextMenu");
1144
1145         MenuList& items = route_ops_menu->items();
1146
1147         items.push_back (MenuElem (_("Save As Template"), mem_fun(*this, &RouteUI::save_as_template)));
1148         items.push_back (MenuElem (_("Rename"), mem_fun(*this, &RouteUI::route_rename)));
1149         items.push_back (SeparatorElem());
1150         items.push_back (CheckMenuElem (_("Active"), mem_fun (*this, &RouteUI::toggle_route_active)));
1151         route_active_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
1152         route_active_menu_item->set_active (_route->active());
1153
1154         items.push_back (SeparatorElem());
1155
1156         items.push_back (MenuElem (_("Adjust latency"), mem_fun (*this, &RouteUI::adjust_latency)));
1157
1158         items.push_back (SeparatorElem());
1159         items.push_back (CheckMenuElem (_("Invert Polarity"), mem_fun (*this, &RouteUI::toggle_polarity)));
1160         polarity_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
1161         polarity_menu_item->set_active (_route->phase_invert());
1162         items.push_back (CheckMenuElem (_("Protect against denormals"), mem_fun (*this, &RouteUI::toggle_denormal_protection)));
1163         denormal_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
1164         denormal_menu_item->set_active (_route->denormal_protection());
1165
1166         if (!Profile->get_sae()) {
1167                 build_remote_control_menu ();
1168                 items.push_back (SeparatorElem());
1169                 items.push_back (MenuElem (_("Remote Control ID"), *remote_control_menu));
1170         }
1171
1172         items.push_back (SeparatorElem());
1173         items.push_back (MenuElem (_("Remove"), mem_fun(*this, &RouteUI::remove_this_route)));
1174 }
1175
1176 gint
1177 MixerStrip::name_button_button_press (GdkEventButton* ev)
1178 {
1179         if (ev->button == 1 || ev->button == 3) {
1180                 list_route_operations ();
1181
1182                 Menu_Helpers::MenuList& items = route_ops_menu->items();
1183                 /* do not allow rename if the track is record-enabled */
1184                 static_cast<MenuItem*> (&items.front())->set_sensitive (!_route->record_enabled());
1185
1186                 route_ops_menu->popup (1, ev->time);
1187         }
1188         return FALSE;
1189 }
1190
1191 void
1192 MixerStrip::list_route_operations ()
1193 {
1194         if (route_ops_menu == 0) {
1195                 build_route_ops_menu ();
1196         }
1197         
1198         refresh_remote_control_menu();
1199 }
1200
1201
1202 void
1203 MixerStrip::speed_adjustment_changed ()
1204 {
1205         /* since there is a usable speed adjustment, there has to be a diskstream */
1206         if (!ignore_speed_adjustment) {
1207                 get_diskstream()->set_speed (speed_adjustment.get_value());
1208         }
1209 }
1210
1211 void
1212 MixerStrip::speed_changed ()
1213 {
1214         Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_speed_display));
1215 }
1216
1217 void
1218 MixerStrip::update_speed_display ()
1219 {
1220         float val;
1221         
1222         val = get_diskstream()->speed();
1223
1224         if (val != 1.0) {
1225                 speed_spinner.set_name ("MixerStripSpeedBaseNotOne");
1226         } else {
1227                 speed_spinner.set_name ("MixerStripSpeedBase");
1228         }
1229
1230         if (speed_adjustment.get_value() != val) {
1231                 ignore_speed_adjustment = true;
1232                 speed_adjustment.set_value (val);
1233                 ignore_speed_adjustment = false;
1234         }
1235 }                       
1236
1237
1238 void
1239 MixerStrip::set_selected (bool yn)
1240 {
1241         AxisView::set_selected (yn);
1242         if (_selected) {
1243                 global_frame.set_shadow_type (Gtk::SHADOW_ETCHED_OUT);
1244                 global_frame.set_name ("MixerStripSelectedFrame");
1245         } else {
1246                 global_frame.set_shadow_type (Gtk::SHADOW_IN);
1247                 global_frame.set_name ("MixerStripFrame");
1248         }
1249         global_frame.queue_draw ();
1250 }
1251
1252 void
1253 MixerStrip::name_changed ()
1254 {
1255         switch (_width) {
1256         case Wide:
1257                 RouteUI::name_changed ();
1258                 break;
1259         case Narrow:
1260                 name_label.set_text (PBD::short_version (_route->name(), 5));
1261                 break;
1262         }
1263         if (_route->phase_invert()) {
1264                 name_label.set_text (X_("Ø ") + name_label.get_text());
1265         }
1266 }
1267
1268 void
1269 MixerStrip::width_clicked ()
1270 {
1271         switch (_width) {
1272         case Wide:
1273                 set_width (Narrow, this);
1274                 break;
1275         case Narrow:
1276                 set_width (Wide, this);
1277                 break;
1278         }
1279 }
1280
1281 void
1282 MixerStrip::hide_clicked ()
1283 {
1284     // LAME fix to reset the button status for when it is redisplayed (part 1)
1285     hide_button.set_sensitive(false);
1286     
1287         if (_embedded) {
1288                  Hiding(); /* EMIT_SIGNAL */
1289         } else {
1290                 _mixer.hide_strip (this);
1291         }
1292         
1293     // (part 2)
1294         hide_button.set_sensitive(true);
1295 }
1296
1297 void
1298 MixerStrip::set_embedded (bool yn)
1299 {
1300         _embedded = yn;
1301 }
1302
1303 void
1304 MixerStrip::map_frozen ()
1305 {
1306         ENSURE_GUI_THREAD (mem_fun(*this, &MixerStrip::map_frozen));
1307
1308         boost::shared_ptr<AudioTrack> at = audio_track();
1309
1310         if (at) {
1311                 switch (at->freeze_state()) {
1312                 case AudioTrack::Frozen:
1313                         pre_processor_box.set_sensitive (false);
1314                         post_processor_box.set_sensitive (false);
1315                         speed_spinner.set_sensitive (false);
1316                         break;
1317                 default:
1318                         pre_processor_box.set_sensitive (true);
1319                         post_processor_box.set_sensitive (true);
1320                         speed_spinner.set_sensitive (true);
1321                         // XXX need some way, maybe, to retoggle redirect editors
1322                         break;
1323                 }
1324         }
1325         
1326         hide_redirect_editors ();
1327 }
1328
1329 void
1330 MixerStrip::hide_redirect_editors ()
1331 {
1332         _route->foreach_processor (mem_fun (*this, &MixerStrip::hide_processor_editor));
1333 }
1334
1335 void
1336 MixerStrip::hide_processor_editor (boost::weak_ptr<Processor> p)
1337 {
1338         boost::shared_ptr<Processor> processor (p.lock ());
1339         if (!processor) {
1340                 return;
1341         }
1342         
1343         void* gui = processor->get_gui ();
1344         
1345         if (gui) {
1346                 static_cast<Gtk::Widget*>(gui)->hide ();
1347         }
1348 }
1349
1350 void
1351 MixerStrip::route_active_changed ()
1352 {
1353         RouteUI::route_active_changed ();
1354
1355         if (is_midi_track()) {
1356                 if (_route->active()) {
1357                         set_name ("MidiTrackStripBase");
1358                         gpm.set_meter_strip_name ("MidiTrackStripBase");
1359                 } else {
1360                         set_name ("MidiTrackStripBaseInactive");
1361                         gpm.set_meter_strip_name ("MidiTrackStripBaseInactive");
1362                 }
1363                 gpm.set_fader_name ("MidiTrackFader");
1364         } else if (is_audio_track()) {
1365                 if (_route->active()) {
1366                         set_name ("AudioTrackStripBase");
1367                         gpm.set_meter_strip_name ("AudioTrackMetrics");
1368                 } else {
1369                         set_name ("AudioTrackStripBaseInactive");
1370                         gpm.set_meter_strip_name ("AudioTrackMetricsInactive");
1371                 }
1372                 gpm.set_fader_name ("AudioTrackFader");
1373         } else {
1374                 if (_route->active()) {
1375                         set_name ("AudioBusStripBase");
1376                         gpm.set_meter_strip_name ("AudioBusMetrics");
1377                 } else {
1378                         set_name ("AudioBusStripBaseInactive");
1379                         gpm.set_meter_strip_name ("AudioBusMetricsInactive");
1380                 }
1381                 gpm.set_fader_name ("AudioBusFader");
1382                 
1383                 /* (no MIDI busses yet) */
1384         }
1385 }
1386
1387 RouteGroup*
1388 MixerStrip::mix_group() const
1389 {
1390         return _route->mix_group();
1391 }
1392
1393 void
1394 MixerStrip::engine_stopped ()
1395 {
1396 }
1397
1398 void
1399 MixerStrip::engine_running ()
1400 {
1401 }
1402
1403 void
1404 MixerStrip::meter_changed (void *src)
1405 {
1406
1407         ENSURE_GUI_THREAD (bind (mem_fun(*this, &MixerStrip::meter_changed), src));
1408
1409         switch (_route->meter_point()) {
1410         case MeterInput:
1411                 meter_point_label.set_text (_("input"));
1412                 break;
1413
1414         case MeterPreFader:
1415                 meter_point_label.set_text (_("pre"));
1416                 break;
1417                 
1418         case MeterPostFader:
1419                 meter_point_label.set_text (_("post"));
1420                 break;
1421         }
1422
1423         gpm.setup_meters ();
1424         // reset peak when meter point changes
1425         gpm.reset_peak_display();
1426         set_width(_width, this);
1427 }
1428