Mixer strip & ui layout changes
[ardour.git] / gtk2_ardour / panner_ui.cc
1 /*
2   Copyright (C) 2004 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   $Id$
19 */
20
21 #include <limits.h>
22
23 #include <ardour/io.h>
24 #include <ardour/dB.h>
25 #include <gtkmm2ext/utils.h>
26 #include <gtkmm2ext/stop_signal.h>
27 #include <gtkmm2ext/barcontroller.h>
28 #include <midi++/manager.h>
29 #include <pbd/fastlog.h>
30
31 #include "ardour_ui.h"
32 #include "panner_ui.h"
33 #include "panner2d.h"
34 #include "utils.h"
35 #include "gui_thread.h"
36
37 #include <ardour/session.h>
38 #include <ardour/panner.h>
39 #include <ardour/route.h>
40
41 #include "i18n.h"
42
43 using namespace ARDOUR;
44 using namespace Gtkmm2ext;
45 using namespace Gtk;
46 using namespace sigc;
47
48
49 PannerUI::PannerUI (IO& io, Session& s)
50         : _io (io),
51           _session (s),
52           hAdjustment(0.0, 0.0, 0.0),
53           vAdjustment(0.0, 0.0, 0.0),
54           panning_viewport(hAdjustment, vAdjustment),
55           panning_up_arrow (Gtk::ARROW_UP, Gtk::SHADOW_OUT),
56           panning_down_arrow (Gtk::ARROW_DOWN, Gtk::SHADOW_OUT),
57           panning_link_button (_("link")),
58           pan_automation_style_button (""),
59           pan_automation_state_button ("")
60 {
61         ignore_toggle = false;
62         pan_menu = 0;
63         in_pan_update = false;
64
65         pan_automation_style_button.set_name ("MixerAutomationModeButton");
66         pan_automation_state_button.set_name ("MixerAutomationPlaybackButton");
67
68         ARDOUR_UI::instance()->tooltips().set_tip (pan_automation_state_button, _("Pan automation mode"));
69         ARDOUR_UI::instance()->tooltips().set_tip (pan_automation_style_button, _("Pan automation type"));
70
71         pan_bar_packer.set_size_request (-1, 61);
72         panning_viewport.set_size_request (61, 61);
73
74         panning_viewport.set_name (X_("BaseFrame"));
75
76         ARDOUR_UI::instance()->tooltips().set_tip (panning_link_button,
77                                                    _("panning link control"));
78         ARDOUR_UI::instance()->tooltips().set_tip (panning_link_direction_button,
79                                                    _("panning link direction"));
80
81         pan_automation_style_button.unset_flags (Gtk::CAN_FOCUS);
82         pan_automation_state_button.unset_flags (Gtk::CAN_FOCUS);
83
84         using namespace Menu_Helpers;
85         pan_astate_menu.items().push_back (MenuElem (_("Isolate"), 
86                                                      bind (mem_fun (_io.panner(), &Panner::set_automation_state), (AutoState) Off)));
87         pan_astate_menu.items().push_back (MenuElem (_("Play"),
88                                                      bind (mem_fun (_io.panner(), &Panner::set_automation_state), (AutoState) Play)));
89         pan_astate_menu.items().push_back (MenuElem (_("Write"),
90                                                      bind (mem_fun (_io.panner(), &Panner::set_automation_state), (AutoState) Write)));
91         pan_astate_menu.items().push_back (MenuElem (_("Touch"),
92                                                      bind (mem_fun (_io.panner(), &Panner::set_automation_state), (AutoState) Touch)));
93
94         pan_astyle_menu.items().push_back (MenuElem (_("Trim")));
95         pan_astyle_menu.items().push_back (MenuElem (_("Abs")));
96
97         pan_astate_menu.set_name ("ArdourContextMenu");
98         pan_astyle_menu.set_name ("ArdourContextMenu");
99
100         pan_automation_style_button.signal_button_press_event().connect (mem_fun(*this, &PannerUI::pan_automation_style_button_event), false);
101         pan_automation_state_button.signal_button_press_event().connect (mem_fun(*this, &PannerUI::pan_automation_state_button_event), false);
102
103         Gtk::HBox* pan_button_hbox = manage (new Gtk::HBox());
104
105         panning_link_box.pack_start (panning_link_button, true, true);
106         panning_link_box.pack_start (panning_link_direction_button, true, true);
107         pan_button_hbox->pack_start (panning_link_box, true, true);
108         pan_button_hbox->pack_start (pan_automation_state_button, true, true);
109
110         panning_link_button.set_name (X_("PanningLinkButton"));
111         panning_link_direction_button.set_name (X_("PanningLinkDirectionButton"));
112
113         /* the pixmap will be reset at some point, but the key thing is that
114            we need a pixmap in the button just to get started.
115         */
116
117         panning_link_direction_button.add (*(manage (new Image (get_xpm("forwardblarrow.xpm")))));
118
119         panning_link_direction_button.signal_clicked().connect
120                 (mem_fun(*this, &PannerUI::panning_link_direction_clicked));
121
122         panning_link_button.signal_button_press_event().connect
123                 (mem_fun(*this, &PannerUI::panning_link_button_press));
124         panning_link_button.signal_button_release_event().connect
125                 (mem_fun(*this, &PannerUI::panning_link_button_release));
126
127         panning_up.set_border_width (3);
128         panning_down.set_border_width (3);
129         panning_up.add (panning_up_arrow);
130         panning_down.add (panning_down_arrow);
131         panning_up.set_name (X_("PanScrollerBase"));
132         panning_down.set_name (X_("PanScrollerBase"));
133         panning_up_arrow.set_name (X_("PanScrollerArrow"));
134         panning_down_arrow.set_name (X_("PanScrollerArrow"));
135
136         pan_vbox.set_spacing (4);
137         pan_vbox.pack_start (panning_viewport, Gtk::PACK_SHRINK);
138         pan_vbox.pack_start (*pan_button_hbox, Gtk::PACK_SHRINK);
139
140         pack_start (pan_vbox, true, false);
141
142         panner = 0;
143
144         _io.panner().Changed.connect (mem_fun(*this, &PannerUI::panner_changed));
145         _io.panner().LinkStateChanged.connect (mem_fun(*this, &PannerUI::update_pan_linkage));
146         _io.panner().StateChanged.connect (mem_fun(*this, &PannerUI::update_pan_state));
147
148         pan_changed (0);
149         update_pan_sensitive ();
150         update_pan_linkage ();
151         pan_automation_state_changed ();
152 }
153
154 gint
155 PannerUI::panning_link_button_press (GdkEventButton* ev)
156 {
157         return stop_signal (panning_link_button, "button-press-event");
158 }
159
160 gint
161 PannerUI::panning_link_button_release (GdkEventButton* ev)
162 {
163         if (!ignore_toggle) {
164                 _io.panner().set_linked (!_io.panner().linked());
165         }
166         return TRUE;
167 }
168
169 void
170 PannerUI::panning_link_direction_clicked()
171 {
172         switch (_io.panner().link_direction()) {
173         case Panner::SameDirection:
174                 _io.panner().set_link_direction (Panner::OppositeDirection);
175                 break;
176         default:
177                 _io.panner().set_link_direction (Panner::SameDirection);
178                 break;
179         }
180 }
181
182 void
183 PannerUI::update_pan_linkage ()
184 {
185         ENSURE_GUI_THREAD(mem_fun(*this, &PannerUI::update_pan_linkage));
186         
187         bool x = _io.panner().linked();
188         bool bx = panning_link_button.get_active();
189         
190         if (x != bx) {
191                 
192                 ignore_toggle = true;
193                 panning_link_button.set_active (x);
194                 ignore_toggle = false;
195         }
196
197         panning_link_direction_button.set_sensitive (x);
198
199         switch (_io.panner().link_direction()) {
200         case Panner::SameDirection:
201                 panning_link_direction_button.set_image (*(manage (new Image (get_xpm ("forwardblarrow.xpm")))));
202                 break;
203         default:
204                 panning_link_direction_button.set_image (*(manage (new Image (get_xpm("revdblarrow.xpm")))));
205                 break;
206         }
207 }
208
209 void
210 PannerUI::set_width (Width w)
211 {
212         switch (w) {
213         case Wide:
214                 panning_viewport.set_size_request (61, 61);
215                 if (panner) {
216                         panner->set_size_request (61, 61);
217                 }
218                 for (vector<BarController*>::iterator i = pan_bars.begin(); i != pan_bars.end(); ++i) {
219                                 (*i)->set_size_request (61, 15);
220                 }
221                 panning_link_button.set_label (_("link"));
222                 break;
223         case Narrow:
224                 panning_viewport.set_size_request (31, 61);
225                 if (panner) {
226                         panner->set_size_request (31, 61);
227                 }
228                 for (vector<BarController*>::iterator i = pan_bars.begin(); i != pan_bars.end(); ++i) {
229                                 (*i)->set_size_request (31, 15);
230                 }
231                 panning_link_button.set_label (_("L"));
232                 break;
233         }
234
235         _width = w;
236 }
237
238
239 PannerUI::~PannerUI ()
240 {
241         for (vector<Adjustment*>::iterator i = pan_adjustments.begin(); i != pan_adjustments.end(); ++i) {
242                 delete (*i);
243         }
244         
245         for (vector<BarController*>::iterator i = pan_bars.begin(); i != pan_bars.end(); ++i) {
246                 delete (*i);
247         }
248
249         if (panner) {
250                 delete panner;
251         }
252
253         if (pan_menu) {
254                 delete pan_menu;
255         }
256
257 }
258
259
260 void
261 PannerUI::panner_changed ()
262 {
263         ENSURE_GUI_THREAD (mem_fun(*this, &PannerUI::panner_changed));
264         setup_pan ();
265 }
266
267 void
268 PannerUI::update_pan_state ()
269 {
270         /* currently nothing to do */
271         // ENSURE_GUI_THREAD (mem_fun(*this, &PannerUI::update_panner_state));
272 }
273
274 void
275 PannerUI::setup_pan ()
276 {
277         uint32_t nouts = _io.n_outputs ();
278
279         if (nouts == 0 || nouts == 1) {
280
281                 while (!pan_adjustments.empty()) {
282                         delete pan_bars.back();
283                         pan_bars.pop_back ();
284                         delete pan_adjustments.back();
285                         pan_adjustments.pop_back ();
286                 }
287
288         } else if (nouts == 2) {
289
290                 vector<Adjustment*>::size_type asz;
291                 uint32_t npans = _io.panner().size();
292
293                 while (!pan_adjustments.empty()) {
294                         delete pan_bars.back();
295                         pan_bars.pop_back ();
296                         delete pan_adjustments.back();
297                         pan_adjustments.pop_back ();
298                 }
299
300                 while ((asz = pan_adjustments.size()) < npans) {
301
302                         float x;
303                         BarController* bc;
304
305                         /* initialize adjustment with current value of panner */
306
307                         _io.panner()[asz]->get_position (x);
308
309                         pan_adjustments.push_back (new Adjustment (x, 0, 1.0, 0.05, 0.1));
310                         pan_adjustments.back()->signal_value_changed().connect (bind (mem_fun(*this, &PannerUI::pan_adjustment_changed), (uint32_t) asz));
311
312                         _io.panner()[asz]->Changed.connect (bind (mem_fun(*this, &PannerUI::pan_value_changed), (uint32_t) asz));
313
314                         bc = new BarController (*pan_adjustments[asz], 
315                                                 &_io.panner()[asz]->midi_control(),
316                                                 bind (mem_fun(*this, &PannerUI::pan_printer), pan_adjustments[asz]));
317                         
318                         if (_session.midi_port()) {
319                                 _io.panner()[asz]->reset_midi_control (_session.midi_port(), true);
320                         }
321                         
322                         bc->set_name ("PanSlider");
323                         bc->set_shadow_type (Gtk::SHADOW_NONE);
324                         bc->set_style (BarController::Line);
325
326                         bc->StartGesture.connect (bind (mem_fun (_io, &IO::start_pan_touch), (uint32_t) asz));
327                         bc->StopGesture.connect (bind (mem_fun (_io, &IO::end_pan_touch), (uint32_t) asz));
328
329                         char buf[64];
330 #ifdef __APPLE__
331                         snprintf (buf, sizeof (buf), _("panner for channel %lu"), asz + 1);
332 #else
333                         snprintf (buf, sizeof (buf), _("panner for channel %u"), asz + 1);
334 #endif
335                         ARDOUR_UI::instance()->tooltips().set_tip (bc->event_widget(), buf);
336
337                         bc->event_widget().signal_button_release_event().connect
338                                 (bind (mem_fun(*this, &PannerUI::pan_button_event), (uint32_t) asz));
339
340                         pan_bars.push_back (bc);
341                         switch (_width) {
342                         case Wide:
343                                 pan_bars.back()->set_size_request (61, 15);
344                                 break;
345                         case Narrow:
346                                 pan_bars.back()->set_size_request (31, 15);
347                                 break;
348                         }
349
350                         pan_bar_packer.pack_start (*pan_bars.back(), false, false);
351                 }
352
353                 /* now that we actually have the pan bars,
354                    set their sensitivity based on current
355                    automation state.
356                 */
357
358                 update_pan_sensitive ();
359
360                 panning_viewport.remove ();
361                 panning_viewport.add (pan_bar_packer);
362                 panning_viewport.show_all ();
363
364         } else {
365
366                 int w = 0;
367
368                 switch (_width) {
369                 case Wide:
370                         w = 61;
371                         break;
372                 case Narrow:
373                         w = 31;
374                         break;
375                 }
376
377                 if (panner == 0) {
378                         panner = new Panner2d (_io.panner(), w, 61);
379                         panner->set_name ("MixerPanZone");
380                         panner->show ();
381                 }
382                 
383                 update_pan_sensitive ();
384                 panner->reset (_io.n_inputs());
385                 panner->set_size_request (w, 61);
386
387                 /* and finally, add it to the panner frame */
388
389                 panning_viewport.remove ();
390                 panning_viewport.add (*panner);
391                 panning_viewport.show_all ();
392         }
393 }
394
395 gint
396 PannerUI::pan_button_event (GdkEventButton* ev, uint32_t which)
397 {
398         switch (ev->button) {
399         case 3:
400                 if (pan_menu == 0) {
401                         pan_menu = manage (new Menu);
402                         pan_menu->set_name ("ArdourContextMenu");
403                 }
404                 build_pan_menu (which);
405                 pan_menu->popup (1, ev->time);
406                 return TRUE;
407                 break;
408         default:
409                 return FALSE;
410         }
411
412         return FALSE; // what's wrong with gcc?
413 }
414
415 void
416 PannerUI::build_pan_menu (uint32_t which)
417 {
418         using namespace Menu_Helpers;
419         MenuList& items (pan_menu->items());
420
421         items.clear ();
422
423         items.push_back (CheckMenuElem (_("Mute")));
424         
425         /* set state first, connect second */
426
427         (dynamic_cast<CheckMenuItem*> (&items.back()))->set_active (_io.panner()[which]->muted());
428         (dynamic_cast<CheckMenuItem*> (&items.back()))->signal_toggled().connect
429                 (bind (mem_fun(*this, &PannerUI::pan_mute), which));
430
431         items.push_back (CheckMenuElem (_("Bypass"), mem_fun(*this, &PannerUI::pan_bypass_toggle)));
432         bypass_menu_item = static_cast<CheckMenuItem*> (&items.back());
433
434         /* set state first, connect second */
435
436         bypass_menu_item->set_active (_io.panner().bypassed());
437         bypass_menu_item->signal_toggled().connect (mem_fun(*this, &PannerUI::pan_bypass_toggle));
438
439         items.push_back (MenuElem (_("Reset"), mem_fun(*this, &PannerUI::pan_reset)));
440         items.push_back (SeparatorElem());
441         items.push_back (MenuElem (_("Reset all")));
442 }
443
444 void
445 PannerUI::pan_mute (uint32_t which)
446 {
447         StreamPanner* sp = _io.panner()[which];
448         sp->set_muted (!sp->muted());
449 }
450
451 void
452 PannerUI::pan_bypass_toggle ()
453 {
454         if (bypass_menu_item && (_io.panner().bypassed() != bypass_menu_item->get_active())) {
455                 _io.panner().set_bypassed (!_io.panner().bypassed());
456         }
457 }
458
459 void
460 PannerUI::pan_reset ()
461 {
462 }
463
464 void
465 PannerUI::effective_pan_display ()
466 {
467         if (_io.panner().empty()) {
468                 return;
469         }
470
471         switch (_io.n_outputs()) {
472         case 0: 
473         case 1:
474                 /* relax */
475                 break;
476
477         case 2:
478                 update_pan_bars (true);
479                 break;
480
481         default:
482                 //panner->move_puck (pan_value (v, right), 0.5);
483                 break;
484         }
485 }
486
487 void
488 PannerUI::pan_changed (void *src)
489 {
490         if (src == this) {
491                 return;
492         }
493
494         switch (_io.panner().size()) {
495         case 0:
496                 panning_link_box.set_sensitive (false);
497                 return;
498         case 1:
499                 panning_link_box.set_sensitive (false);
500                 break;
501         default:
502                 panning_link_box.set_sensitive (true);
503         }
504
505         uint32_t nouts = _io.n_outputs();
506
507         switch (nouts) {
508         case 0:
509         case 1:
510                 /* relax */
511                 break;
512
513         case 2:
514                 update_pan_bars (false);
515                 break;
516
517         default:
518                 // panner->move_puck (pan_value (pans[0], pans[1]), 0.5);
519                 break;
520         }
521 }
522
523 void
524 PannerUI::pan_adjustment_changed (uint32_t which)
525 {
526         if (!in_pan_update && which < _io.panner().size()) {
527
528                 float xpos;
529                 float val = pan_adjustments[which]->get_value ();
530                 _io.panner()[which]->get_position (xpos);
531
532                 /* add a kinda-sorta detent for the middle */
533                 
534                 if (val != 0.5 && Panner::equivalent (val, 0.5)) {
535                         /* this is going to be reentrant, so just 
536                            return after it.
537                         */
538
539                         in_pan_update = true;
540                         pan_adjustments[which]->set_value (0.5);
541                         in_pan_update = false;
542                         return;
543                 }
544                 
545                 if (!Panner::equivalent (val, xpos)) {
546
547                         _io.panner()[which]->set_position (val);
548                         /* XXX 
549                            the panner objects have no access to the session,
550                            so do this here. ick.
551                         */
552                         _session.set_dirty();
553                 }
554         }
555 }
556
557 void
558 PannerUI::pan_value_changed (uint32_t which)
559 {
560         ENSURE_GUI_THREAD (bind (mem_fun(*this, &PannerUI::pan_value_changed), which));
561                                                            
562         if (_io.n_outputs() > 1 && which < _io.panner().size()) {
563                 float xpos;
564                 float val = pan_adjustments[which]->get_value ();
565
566                 _io.panner()[which]->get_position (xpos);
567
568                 if (!Panner::equivalent (val, xpos)) {
569                         in_pan_update = true;
570                         pan_adjustments[which]->set_value (xpos);
571                         in_pan_update = false;
572                 }
573         }
574 }       
575
576 void
577 PannerUI::update_pan_bars (bool only_if_aplay)
578 {
579         uint32_t n;
580         vector<Adjustment*>::iterator i;
581
582         in_pan_update = true;
583
584         /* this runs during automation playback, and moves the bar controllers
585            and/or pucks around.
586         */
587
588         for (i = pan_adjustments.begin(), n = 0; i != pan_adjustments.end(); ++i, ++n) {
589                 float xpos, val;
590
591                 if (only_if_aplay) {
592                         AutomationList& alist (_io.panner()[n]->automation());
593                         
594                         if (!alist.automation_playback()) {
595                                 continue;
596                         }
597                 }
598
599                 _io.panner()[n]->get_effective_position (xpos);
600                 val = (*i)->get_value ();
601                 
602                 if (!Panner::equivalent (val, xpos)) {
603                         (*i)->set_value (xpos);
604                 }
605         }
606
607         in_pan_update = false;
608 }
609
610 void
611 PannerUI::pan_printer (char *buf, uint32_t len, Adjustment* adj)
612 {
613         float val = adj->get_value();
614
615         if (val == 0.0f) {
616                 snprintf (buf, len, X_("L"));
617         } else if (val == 1.0f) {
618                 snprintf (buf, len, X_("R"));
619         } else if (Panner::equivalent (val, 0.5f)) {
620                 snprintf (buf, len, X_("C"));
621         } else {
622                 /* don't print anything */
623                 buf[0] = '\0';
624         }
625 }
626
627 void
628 PannerUI::update_pan_sensitive ()
629 {
630         bool sensitive = !(_io.panner().automation_state() & Play);
631
632         switch (_io.n_outputs()) {
633         case 0:
634         case 1:
635                 break;
636         case 2:
637                 for (vector<BarController*>::iterator i = pan_bars.begin(); i != pan_bars.end(); ++i) {
638                         (*i)->set_sensitive (sensitive);
639                 }
640                 break;
641         default:
642                 if (panner) {
643                         panner->set_sensitive (sensitive);
644                 }
645                 break;
646         }
647 }
648
649 gint
650 PannerUI::pan_automation_state_button_event (GdkEventButton *ev)
651 {
652         using namespace Menu_Helpers;
653
654         if (ev->type == GDK_BUTTON_RELEASE) {
655                 return TRUE;
656         }
657
658         switch (ev->button) {
659         case 1:
660                 pan_astate_menu.popup (1, ev->time);
661                 break;
662         default:
663                 break;
664         }
665
666         return TRUE;
667 }
668
669 gint
670 PannerUI::pan_automation_style_button_event (GdkEventButton *ev)
671 {
672         if (ev->type == GDK_BUTTON_RELEASE) {
673                 return TRUE;
674         }
675
676         switch (ev->button) {
677         case 1:
678                 pan_astyle_menu.popup (1, ev->time);
679                 break;
680         default:
681                 break;
682         }
683         return TRUE;
684 }
685
686 void
687 PannerUI::pan_automation_style_changed ()
688 {
689         ENSURE_GUI_THREAD(mem_fun(*this, &PannerUI::pan_automation_style_changed));
690         
691         switch (_width) {
692         case Wide:
693                 pan_automation_style_button.set_label (astyle_string(_io.panner().automation_style()));
694                 break;
695         case Narrow:
696                 pan_automation_style_button.set_label (short_astyle_string(_io.panner().automation_style()));
697                 break;
698         }
699 }
700
701 void
702 PannerUI::pan_automation_state_changed ()
703 {
704         ENSURE_GUI_THREAD(mem_fun(*this, &PannerUI::pan_automation_state_changed));
705         
706         bool x;
707
708         switch (_width) {
709         case Wide:
710           pan_automation_state_button.set_label (astate_string(_io.panner().automation_state()));
711                 break;
712         case Narrow:
713           pan_automation_state_button.set_label (short_astate_string(_io.panner().automation_state()));
714                 break;
715         }
716
717         /* when creating a new session, we get to create busses (and
718            sometimes tracks) with no outputs by the time they get
719            here.
720         */
721
722         if (_io.panner().empty()) {
723                 return;
724         }
725
726         x = (_io.panner().front()->automation().automation_state() != Off);
727
728         if (pan_automation_state_button.get_active() != x) {
729         ignore_toggle = true;
730                 pan_automation_state_button.set_active (x);
731                 ignore_toggle = false;
732         }
733
734         update_pan_sensitive ();
735
736         /* start watching automation so that things move */
737
738         pan_watching.disconnect();
739
740         if (x) {
741           pan_watching = ARDOUR_UI::RapidScreenUpdate.connect (mem_fun (*this, &PannerUI::effective_pan_display));
742         }
743 }
744
745 string
746 PannerUI::astate_string (AutoState state)
747 {
748         return _astate_string (state, false);
749 }
750
751 string
752 PannerUI::short_astate_string (AutoState state)
753 {
754         return _astate_string (state, true);
755 }
756
757 string
758 PannerUI::_astate_string (AutoState state, bool shrt)
759 {
760         string sstr;
761
762         switch (state) {
763         case Off:
764                 sstr = (shrt ? "I" : _("I"));
765                 break;
766         case Play:
767                 sstr = (shrt ? "P" : _("P"));
768                 break;
769         case Touch:
770                 sstr = (shrt ? "T" : _("T"));
771                 break;
772         case Write:
773                 sstr = (shrt ? "W" : _("W"));
774                 break;
775         }
776
777         return sstr;
778 }
779
780 string
781 PannerUI::astyle_string (AutoStyle style)
782 {
783         return _astyle_string (style, false);
784 }
785
786 string
787 PannerUI::short_astyle_string (AutoStyle style)
788 {
789         return _astyle_string (style, true);
790 }
791
792 string
793 PannerUI::_astyle_string (AutoStyle style, bool shrt)
794 {
795         if (style & Trim) {
796                 return _("Trim");
797         } else {
798                 /* XXX it might different in different languages */
799
800                 return (shrt ? _("Abs") : _("Abs"));
801         }
802 }