new GUIs for stereo panners
[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
49 PannerUI::PannerUI (boost::shared_ptr<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         //set_size_request_to_display_given_text (pan_automation_state_button, X_("O"), 2, 2);
72         //set_size_request_to_display_given_text (pan_automation_style_button, X_("0"), 2, 2);
73
74         pan_bar_packer.set_size_request (-1, 61);
75         panning_viewport.set_size_request (61, 61);
76
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 (_("Off"), 
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 (4);
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, false);
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_viewport.set_size_request (61, 61);
218                 if (panner) {
219                         panner->set_size_request (61, 61);
220                 }
221                 for (vector<PannerBar*>::iterator i = pan_bars.begin(); i != pan_bars.end(); ++i) {
222                                 (*i)->set_size_request (61, 15);
223                 }
224                 panning_link_button.set_label (_("link"));
225                 break;
226         case Narrow:
227                 panning_viewport.set_size_request (31, 61);
228                 if (panner) {
229                         panner->set_size_request (31, 61);
230                 }
231                 for (vector<PannerBar*>::iterator i = pan_bars.begin(); i != pan_bars.end(); ++i) {
232                                 (*i)->set_size_request (31, 15);
233                 }
234                 panning_link_button.set_label (_("L"));
235                 break;
236         }
237
238         _width = w;
239 }
240
241
242 PannerUI::~PannerUI ()
243 {
244         for (vector<Adjustment*>::iterator i = pan_adjustments.begin(); i != pan_adjustments.end(); ++i) {
245                 delete (*i);
246         }
247         
248         for (vector<PannerBar*>::iterator i = pan_bars.begin(); i != pan_bars.end(); ++i) {
249                 delete (*i);
250         }
251
252         if (panner) {
253                 delete panner;
254         }
255
256         if (pan_menu) {
257                 delete pan_menu;
258         }
259
260 }
261
262
263 void
264 PannerUI::panner_changed ()
265 {
266         ENSURE_GUI_THREAD (mem_fun(*this, &PannerUI::panner_changed));
267         setup_pan ();
268 }
269
270 void
271 PannerUI::update_pan_state ()
272 {
273         /* currently nothing to do */
274         // ENSURE_GUI_THREAD (mem_fun(*this, &PannerUI::update_panner_state));
275 }
276
277 void
278 PannerUI::setup_pan ()
279 {
280         uint32_t nouts = _io->n_outputs ();
281
282         if (nouts == 0 || nouts == 1) {
283
284                 while (!pan_adjustments.empty()) {
285                         delete pan_bars.back();
286                         pan_bars.pop_back ();
287                         delete pan_adjustments.back();
288                         pan_adjustments.pop_back ();
289                 }
290
291         } else if (nouts == 2) {
292
293                 vector<Adjustment*>::size_type asz;
294                 uint32_t npans = _io->panner().size();
295
296                 while (!pan_adjustments.empty()) {
297                         delete pan_bars.back();
298                         pan_bars.pop_back ();
299                         delete pan_adjustments.back();
300                         pan_adjustments.pop_back ();
301                 }
302
303                 while ((asz = pan_adjustments.size()) < npans) {
304
305                         float x;
306                         PannerBar* bc;
307
308                         /* initialize adjustment with current value of panner */
309
310                         _io->panner()[asz]->get_position (x);
311
312                         pan_adjustments.push_back (new Adjustment (x, 0, 1.0, 0.05, 0.1));
313                         pan_adjustments.back()->signal_value_changed().connect (bind (mem_fun(*this, &PannerUI::pan_adjustment_changed), (uint32_t) asz));
314
315                         _io->panner()[asz]->Changed.connect (bind (mem_fun(*this, &PannerUI::pan_value_changed), (uint32_t) asz));
316
317                         bc = new PannerBar (*pan_adjustments[asz], _io->panner()[asz]->control());
318                         
319                         bc->set_name ("PanSlider");
320                         bc->set_shadow_type (Gtk::SHADOW_NONE);
321                         bc->set_style (BarController::Line);
322
323                         bc->StartGesture.connect (bind (mem_fun (*_io, &IO::start_pan_touch), (uint32_t) asz));
324                         bc->StopGesture.connect (bind (mem_fun (*_io, &IO::end_pan_touch), (uint32_t) asz));
325
326                         char buf[64];
327                         snprintf (buf, sizeof (buf), _("panner for channel %zu"), asz + 1);
328                         ARDOUR_UI::instance()->tooltips().set_tip (bc->event_widget(), buf);
329
330                         bc->event_widget().signal_button_release_event().connect
331                                 (bind (mem_fun(*this, &PannerUI::pan_button_event), (uint32_t) asz));
332
333                         pan_bars.push_back (bc);
334                         switch (_width) {
335                         case Wide:
336                                 pan_bars.back()->set_size_request (61, 15);
337                                 break;
338                         case Narrow:
339                                 pan_bars.back()->set_size_request (31, 15);
340                                 break;
341                         }
342
343                         pan_bar_packer.pack_start (*pan_bars.back(), true, true);
344                 }
345
346                 /* now that we actually have the pan bars,
347                    set their sensitivity based on current
348                    automation state.
349                 */
350
351                 update_pan_sensitive ();
352
353                 panning_viewport.remove ();
354                 panning_viewport.add (pan_bar_packer);
355                 panning_viewport.show_all ();
356
357         } else {
358
359                 int w = 0;
360
361                 switch (_width) {
362                 case Wide:
363                         w = 61;
364                         break;
365                 case Narrow:
366                         w = 31;
367                         break;
368                 }
369
370                 if (panner == 0) {
371                         panner = new Panner2d (_io->panner(), w, 61);
372                         panner->set_name ("MixerPanZone");
373                         panner->show ();
374                 }
375                 
376                 update_pan_sensitive ();
377                 panner->reset (_io->n_inputs());
378                 panner->set_size_request (w, 61);
379
380                 /* and finally, add it to the panner frame */
381
382                 panning_viewport.remove ();
383                 panning_viewport.add (*panner);
384                 panning_viewport.show_all ();
385         }
386 }
387
388 bool
389 PannerUI::pan_button_event (GdkEventButton* ev, uint32_t which)
390 {
391         switch (ev->button) {
392         case 3:
393                 if (pan_menu == 0) {
394                         pan_menu = manage (new Menu);
395                         pan_menu->set_name ("ArdourContextMenu");
396                 }
397                 build_pan_menu (which);
398                 pan_menu->popup (1, ev->time);
399                 return true;
400                 break;
401         default:
402                 return false;
403         }
404
405         return false; // what's wrong with gcc?
406 }
407
408 void
409 PannerUI::build_pan_menu (uint32_t which)
410 {
411         using namespace Menu_Helpers;
412         MenuList& items (pan_menu->items());
413
414         items.clear ();
415
416         items.push_back (CheckMenuElem (_("Mute")));
417         
418         /* set state first, connect second */
419
420         (dynamic_cast<CheckMenuItem*> (&items.back()))->set_active (_io->panner()[which]->muted());
421         (dynamic_cast<CheckMenuItem*> (&items.back()))->signal_toggled().connect
422                 (bind (mem_fun(*this, &PannerUI::pan_mute), which));
423
424         items.push_back (CheckMenuElem (_("Bypass"), mem_fun(*this, &PannerUI::pan_bypass_toggle)));
425         bypass_menu_item = static_cast<CheckMenuItem*> (&items.back());
426
427         /* set state first, connect second */
428
429         bypass_menu_item->set_active (_io->panner().bypassed());
430         bypass_menu_item->signal_toggled().connect (mem_fun(*this, &PannerUI::pan_bypass_toggle));
431
432         items.push_back (MenuElem (_("Reset"), mem_fun(*this, &PannerUI::pan_reset)));
433         items.push_back (SeparatorElem());
434         items.push_back (MenuElem (_("Reset all")));
435 }
436
437 void
438 PannerUI::pan_mute (uint32_t which)
439 {
440         StreamPanner* sp = _io->panner()[which];
441         sp->set_muted (!sp->muted());
442 }
443
444 void
445 PannerUI::pan_bypass_toggle ()
446 {
447         if (bypass_menu_item && (_io->panner().bypassed() != bypass_menu_item->get_active())) {
448                 _io->panner().set_bypassed (!_io->panner().bypassed());
449         }
450 }
451
452 void
453 PannerUI::pan_reset ()
454 {
455 }
456
457 void
458 PannerUI::effective_pan_display ()
459 {
460         if (_io->panner().empty()) {
461                 return;
462         }
463
464         switch (_io->n_outputs()) {
465         case 0: 
466         case 1:
467                 /* relax */
468                 break;
469
470         case 2:
471                 update_pan_bars (true);
472                 break;
473
474         default:
475                 //panner->move_puck (pan_value (v, right), 0.5);
476                 break;
477         }
478 }
479
480 void
481 PannerUI::pan_changed (void *src)
482 {
483         if (src == this) {
484                 return;
485         }
486
487         switch (_io->panner().size()) {
488         case 0:
489                 panning_link_direction_button.set_sensitive (false);
490                 panning_link_button.set_sensitive (false);
491                 return;
492         case 1:
493                 panning_link_direction_button.set_sensitive (false);
494                 panning_link_button.set_sensitive (false);
495                 break;
496         default:
497                 panning_link_direction_button.set_sensitive (true);
498                 panning_link_button.set_sensitive (true);
499         }
500
501         uint32_t nouts = _io->n_outputs();
502
503         switch (nouts) {
504         case 0:
505         case 1:
506                 /* relax */
507                 break;
508
509         case 2:
510                 update_pan_bars (false);
511                 break;
512
513         default:
514                 // panner->move_puck (pan_value (pans[0], pans[1]), 0.5);
515                 break;
516         }
517 }
518
519 void
520 PannerUI::pan_adjustment_changed (uint32_t which)
521 {
522         if (!in_pan_update && which < _io->panner().size()) {
523
524                 float xpos;
525                 float val = pan_adjustments[which]->get_value ();
526                 _io->panner()[which]->get_position (xpos);
527
528                 /* add a kinda-sorta detent for the middle */
529                 
530                 if (val != 0.5 && Panner::equivalent (val, 0.5)) {
531                         /* this is going to be reentrant, so just 
532                            return after it.
533                         */
534
535                         in_pan_update = true;
536                         pan_adjustments[which]->set_value (0.5);
537                         in_pan_update = false;
538                         return;
539                 }
540                 
541                 if (!Panner::equivalent (val, xpos)) {
542
543                         _io->panner()[which]->set_position (val);
544                         /* XXX 
545                            the panner objects have no access to the session,
546                            so do this here. ick.
547                         */
548                         _session.set_dirty();
549                 }
550         }
551 }
552
553 void
554 PannerUI::pan_value_changed (uint32_t which)
555 {
556         ENSURE_GUI_THREAD (bind (mem_fun(*this, &PannerUI::pan_value_changed), which));
557                                                            
558         if (_io->n_outputs() > 1 && which < _io->panner().size()) {
559                 float xpos;
560                 float val = pan_adjustments[which]->get_value ();
561
562                 _io->panner()[which]->get_position (xpos);
563
564                 if (!Panner::equivalent (val, xpos)) {
565                         in_pan_update = true;
566                         pan_adjustments[which]->set_value (xpos);
567                         in_pan_update = false;
568                 }
569         }
570 }       
571
572 void
573 PannerUI::update_pan_bars (bool only_if_aplay)
574 {
575         uint32_t n;
576         vector<Adjustment*>::iterator i;
577
578         in_pan_update = true;
579
580         /* this runs during automation playback, and moves the bar controllers
581            and/or pucks around.
582         */
583
584         for (i = pan_adjustments.begin(), n = 0; i != pan_adjustments.end(); ++i, ++n) {
585                 float xpos, val;
586
587                 if (only_if_aplay) {
588                         AutomationList& alist (_io->panner()[n]->automation());
589                         
590                         if (!alist.automation_playback()) {
591                                 continue;
592                         }
593                 }
594
595                 _io->panner()[n]->get_effective_position (xpos);
596                 val = (*i)->get_value ();
597                 
598                 if (!Panner::equivalent (val, xpos)) {
599                         (*i)->set_value (xpos);
600                 }
601         }
602
603         in_pan_update = false;
604 }
605
606 void
607 PannerUI::pan_printer (char *buf, uint32_t len, Adjustment* adj)
608 {
609         float val = adj->get_value();
610
611         if (val == 0.0f) {
612                 snprintf (buf, len, X_("L"));
613         } else if (val == 1.0f) {
614                 snprintf (buf, len, X_("R"));
615         } else if (Panner::equivalent (val, 0.5f)) {
616                 snprintf (buf, len, X_("C"));
617         } else {
618                 /* don't print anything */
619                 buf[0] = '\0';
620         }
621 }
622
623 void
624 PannerUI::update_pan_sensitive ()
625 {
626         bool sensitive = !(_io->panner().automation_state() & Play);
627
628         switch (_io->n_outputs()) {
629         case 0:
630         case 1:
631                 break;
632         case 2:
633                 for (vector<PannerBar*>::iterator i = pan_bars.begin(); i != pan_bars.end(); ++i) {
634                         (*i)->set_sensitive (sensitive);
635                 }
636                 break;
637         default:
638                 if (panner) {
639                         panner->set_sensitive (sensitive);
640                 }
641                 break;
642         }
643 }
644
645 gint
646 PannerUI::pan_automation_state_button_event (GdkEventButton *ev)
647 {
648         using namespace Menu_Helpers;
649
650         if (ev->type == GDK_BUTTON_RELEASE) {
651                 return TRUE;
652         }
653
654         switch (ev->button) {
655         case 1:
656                 pan_astate_menu.popup (1, ev->time);
657                 break;
658         default:
659                 break;
660         }
661
662         return TRUE;
663 }
664
665 gint
666 PannerUI::pan_automation_style_button_event (GdkEventButton *ev)
667 {
668         if (ev->type == GDK_BUTTON_RELEASE) {
669                 return TRUE;
670         }
671
672         switch (ev->button) {
673         case 1:
674                 pan_astyle_menu.popup (1, ev->time);
675                 break;
676         default:
677                 break;
678         }
679         return TRUE;
680 }
681
682 void
683 PannerUI::pan_automation_style_changed ()
684 {
685         ENSURE_GUI_THREAD(mem_fun(*this, &PannerUI::pan_automation_style_changed));
686         
687         switch (_width) {
688         case Wide:
689                 pan_automation_style_button.set_label (astyle_string(_io->panner().automation_style()));
690                 break;
691         case Narrow:
692                 pan_automation_style_button.set_label (short_astyle_string(_io->panner().automation_style()));
693                 break;
694         }
695 }
696
697 void
698 PannerUI::pan_automation_state_changed ()
699 {
700         ENSURE_GUI_THREAD(mem_fun(*this, &PannerUI::pan_automation_state_changed));
701         
702         bool x;
703
704         switch (_width) {
705         case Wide:
706           pan_automation_state_button.set_label (astate_string(_io->panner().automation_state()));
707                 break;
708         case Narrow:
709           pan_automation_state_button.set_label (short_astate_string(_io->panner().automation_state()));
710                 break;
711         }
712
713         /* when creating a new session, we get to create busses (and
714            sometimes tracks) with no outputs by the time they get
715            here.
716         */
717
718         if (_io->panner().empty()) {
719                 return;
720         }
721
722         x = (_io->panner().front()->automation().automation_state() != Off);
723
724         if (pan_automation_state_button.get_active() != x) {
725         ignore_toggle = true;
726                 pan_automation_state_button.set_active (x);
727                 ignore_toggle = false;
728         }
729
730         update_pan_sensitive ();
731
732         /* start watching automation so that things move */
733
734         pan_watching.disconnect();
735
736         if (x) {
737           pan_watching = ARDOUR_UI::RapidScreenUpdate.connect (mem_fun (*this, &PannerUI::effective_pan_display));
738         }
739 }
740
741 string
742 PannerUI::astate_string (AutoState state)
743 {
744         return _astate_string (state, false);
745 }
746
747 string
748 PannerUI::short_astate_string (AutoState state)
749 {
750         return _astate_string (state, true);
751 }
752
753 string
754 PannerUI::_astate_string (AutoState state, bool shrt)
755 {
756         string sstr;
757
758         switch (state) {
759         case Off:
760                 sstr = (shrt ? "O" : _("O"));
761                 break;
762         case Play:
763                 sstr = (shrt ? "P" : _("P"));
764                 break;
765         case Touch:
766                 sstr = (shrt ? "T" : _("T"));
767                 break;
768         case Write:
769                 sstr = (shrt ? "W" : _("W"));
770                 break;
771         }
772
773         return sstr;
774 }
775
776 string
777 PannerUI::astyle_string (AutoStyle style)
778 {
779         return _astyle_string (style, false);
780 }
781
782 string
783 PannerUI::short_astyle_string (AutoStyle style)
784 {
785         return _astyle_string (style, true);
786 }
787
788 string
789 PannerUI::_astyle_string (AutoStyle style, bool shrt)
790 {
791         if (style & Trim) {
792                 return _("Trim");
793         } else {
794                 /* XXX it might different in different languages */
795
796                 return (shrt ? _("Abs") : _("Abs"));
797         }
798 }