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