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