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