2 Copyright (C) 2010 Paul Davis
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.
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.
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.
24 #include <pangomm/layout.h>
26 #include "pbd/compose.h"
27 #include "pbd/error.h"
28 #include "pbd/stacktrace.h"
30 #include "gtkmm2ext/utils.h"
31 #include "gtkmm2ext/rgb_macros.h"
32 #include "gtkmm2ext/gui_thread.h"
34 #include "ardour/rc_configuration.h" // for widget prelight preference
36 #include "ardour_button.h"
37 #include "ardour_ui.h"
38 #include "global_signals.h"
42 #define REFLECTION_HEIGHT 2
52 ArdourButton::Element ArdourButton::default_elements = ArdourButton::Element (ArdourButton::Edge|ArdourButton::Body|ArdourButton::Text);
53 ArdourButton::Element ArdourButton::led_default_elements = ArdourButton::Element (ArdourButton::default_elements|ArdourButton::Indicator);
54 ArdourButton::Element ArdourButton::just_led_default_elements = ArdourButton::Element (ArdourButton::Edge|ArdourButton::Body|ArdourButton::Indicator);
55 bool ArdourButton::_flat_buttons = false;
57 ArdourButton::ArdourButton (Element e)
59 , _tweaks (Tweaks (0))
63 , _corner_radius (4.0)
70 , fill_start_inactive_color (0)
71 , fill_end_inactive_color (0)
72 , fill_start_active_color (0)
73 , fill_end_active_color (0)
74 , text_active_color(0)
75 , text_inactive_color(0)
77 , led_inactive_color(0)
79 , fill_pattern_active (0)
81 , led_inset_pattern (0)
82 , reflection_pattern (0)
84 , _act_on_release (true)
86 , _fixed_diameter (true)
87 , _distinct_led_click (false)
90 ColorsChanged.connect (sigc::mem_fun (*this, &ArdourButton::color_handler));
93 ArdourButton::ArdourButton (const std::string& str, Element e)
95 , _tweaks (Tweaks (0))
99 , _corner_radius (4.0)
106 , fill_start_inactive_color (0)
107 , fill_end_inactive_color (0)
108 , fill_start_active_color (0)
109 , fill_end_active_color (0)
110 , text_active_color(0)
111 , text_inactive_color(0)
112 , led_active_color(0)
113 , led_inactive_color(0)
115 , fill_pattern_active (0)
117 , led_inset_pattern (0)
118 , reflection_pattern (0)
120 , _act_on_release (true)
122 , _fixed_diameter (true)
123 , _distinct_led_click (false)
129 ArdourButton::~ArdourButton()
134 cairo_pattern_destroy (shine_pattern);
138 cairo_pattern_destroy (fill_pattern);
141 if (fill_pattern_active) {
142 cairo_pattern_destroy (fill_pattern_active);
145 if (led_inset_pattern) {
146 cairo_pattern_destroy (led_inset_pattern);
149 if (reflection_pattern) {
150 cairo_pattern_destroy (reflection_pattern);
156 ArdourButton::set_text (const std::string& str)
160 if (!_layout && !_text.empty()) {
161 _layout = Pango::Layout::create (get_pango_context());
165 _layout->set_text (str);
172 ArdourButton::set_markup (const std::string& str)
177 _layout = Pango::Layout::create (get_pango_context());
180 _layout->set_markup (str);
185 ArdourButton::set_angle (const double angle)
191 ArdourButton::set_alignment (const float xa, const float ya)
198 ArdourButton::render (cairo_t* cr, cairo_rectangle_t *)
200 void (*rounded_function)(cairo_t*, double, double, double, double, double);
202 switch (_corner_mask) {
203 case 0x1: /* upper left only */
204 rounded_function = Gtkmm2ext::rounded_top_left_rectangle;
206 case 0x2: /* upper right only */
207 rounded_function = Gtkmm2ext::rounded_top_right_rectangle;
209 case 0x3: /* upper only */
210 rounded_function = Gtkmm2ext::rounded_top_rectangle;
212 /* should really have functions for lower right, lower left,
213 lower only, but for now, we don't
216 rounded_function = Gtkmm2ext::rounded_rectangle;
219 if (!_fixed_diameter) {
220 _diameter = std::min (get_width(), get_height());
225 if ((_elements & Body)==Body) {
226 if (_elements & Edge) {
228 cairo_set_source_rgba (cr, 0, 0, 0, 1);
229 rounded_function(cr, 0, 0, get_width(), get_height(), _corner_radius);
232 rounded_function (cr, 1, 1, get_width()-2, get_height()-2, _corner_radius - 1.5);
234 rounded_function (cr, 0, 0, get_width(), get_height(), _corner_radius);
237 if (active_state() == Gtkmm2ext::ImplicitActive) {
239 if (!(_tweaks & ImplicitUsesSolidColor)) {
240 cairo_set_source (cr, fill_pattern);
242 cairo_set_source (cr, fill_pattern_active);
246 if (!(_tweaks & ImplicitUsesSolidColor)) {
248 UINT_TO_RGBA (fill_end_active_color, &r, &g, &b, &a);
249 cairo_set_line_width (cr, 1.0);
250 rounded_function (cr, 2, 2, get_width()-4, get_height()-4, _corner_radius - 1.5);
251 cairo_set_source_rgba (cr, r/255.0, g/255.0, b/255.0, a/255.0);
255 } else if (active_state() == Gtkmm2ext::ExplicitActive || ((_elements & Indicator)==Indicator) ) {
258 cairo_set_source (cr, fill_pattern_active);
264 cairo_set_source (cr, fill_pattern);
270 if ( ((_elements & Inset)==Inset) && (active_state() != Gtkmm2ext::ExplicitActive) ) {
272 if ( !_flat_buttons ) {
273 float rheight = get_height()*0.5-REFLECTION_HEIGHT;
274 Gtkmm2ext::rounded_rectangle (cr, 2, 3, get_width()-4, rheight, _corner_radius-1);
275 cairo_set_source (cr, shine_pattern);
279 if (active_state() == Gtkmm2ext::ExplicitActive) {
281 UINT_TO_RGBA (fill_start_active_color, &r, &g, &b, &a);
282 cairo_set_line_width (cr, 2.0);
283 rounded_function (cr, 2, 2, get_width()-4, get_height()-4, _corner_radius - 2.0);
284 cairo_set_source_rgba (cr, r/255.0, g/255.0, b/255.0, a/255.0);
289 UINT_TO_RGBA (fill_start_inactive_color, &r, &g, &b, &a);
290 cairo_set_line_width (cr, 2.0);
291 rounded_function (cr, 2, 2, get_width()-4, get_height()-4, _corner_radius - 2.0);
292 cairo_set_source_rgba (cr, r/255.0, g/255.0, b/255.0, a/255.0);
301 x = (get_width() - _pixbuf->get_width())/2.0;
302 y = (get_height() - _pixbuf->get_height())/2.0;
304 cairo_rectangle (cr, x, y, _pixbuf->get_width(), _pixbuf->get_height());
305 gdk_cairo_set_source_pixbuf (cr, _pixbuf->gobj(), x, y);
313 if (get_width() < 75) {
319 if ( ((_elements & Text)==Text) && !_text.empty()) {
321 cairo_rectangle (cr, 2, 1, get_width()-4, get_height()-2);
325 cairo_set_source_rgba (cr, text_r, text_g, text_b, text_a);
327 if ( (_elements & Menu) == Menu) {
328 cairo_move_to (cr, text_margin, get_height()/2.0 - _text_height/2.0);
329 pango_cairo_show_layout (cr, _layout->gobj());
330 } else if ( (_elements & Indicator) == Indicator) {
332 cairo_move_to (cr, text_margin + _diameter + 4, get_height()/2.0 - _text_height/2.0);
334 cairo_move_to (cr, text_margin, get_height()/2.0 - _text_height/2.0);
336 pango_cairo_show_layout (cr, _layout->gobj());
344 cairo_save (cr); // TODO retain rotataion.. adj. LED,...
345 cairo_rotate(cr, _angle * M_PI / 180.0);
346 cairo_device_to_user(cr, &ww, &wh);
347 xa = (ww - _text_width) * _xalign;
348 ya = (wh - _text_height) * _yalign;
350 /* quick hack for left/bottom alignment at -90deg
351 * TODO this should be generalized incl rotation.
352 * currently only 'user' of this API is meter_strip.cc
354 if (_xalign < 0) xa = (ww * fabs(_xalign) + text_margin);
356 // TODO honor left/right text_margin with min/max()
358 cairo_move_to (cr, xa, ya);
359 pango_cairo_update_layout(cr, _layout->gobj());
360 pango_cairo_show_layout (cr, _layout->gobj());
363 /* use old center'ed layout for follow up items - until rotation/aligment code is completed */
364 cairo_move_to (cr, (get_width() - _text_width)/2.0, get_height()/2.0 - _text_height/2.0);
369 if (((_elements & Menu)==Menu)) {
373 cairo_translate (cr, 0,0 );
376 cairo_set_source_rgba (cr, 1, 1, 1, 0.4);
377 cairo_move_to(cr, get_width() - ((_diameter/2.0) + 6.0), get_height()/2.0 +_diameter/4);
378 cairo_rel_line_to(cr, -_diameter/2, -_diameter/2);
379 cairo_rel_line_to(cr, _diameter, 0);
380 cairo_close_path(cr);
386 if (((_elements & Indicator)==Indicator)) {
388 /* move to the center of the indicator/led */
392 if (_elements & Text) {
394 cairo_translate (cr, text_margin + (_diameter/2.0), get_height()/2.0);
396 cairo_translate (cr, get_width() - ((_diameter/2.0) + 4.0), get_height()/2.0);
399 cairo_translate (cr, get_width()/2.0, get_height()/2.0);
403 cairo_arc (cr, 0, 0, _diameter/2, 0, 2 * M_PI);
404 cairo_set_source (cr, led_inset_pattern);
408 cairo_set_source_rgb (cr, 0, 0, 0);
409 cairo_arc (cr, 0, 0, _diameter/2-2, 0, 2 * M_PI);
413 cairo_set_source_rgba (cr, led_r, led_g, led_b, led_a);
414 cairo_arc (cr, 0, 0, _diameter/2-3, 0, 2 * M_PI);
421 /* a partially transparent gray layer to indicate insensitivity */
423 if ((visual_state() & Gtkmm2ext::Insensitive)) {
424 rounded_function (cr, 0, 0, get_width(), get_height(), _corner_radius);
425 cairo_set_source_rgba (cr, 0.505, 0.517, 0.525, 0.6);
430 bool show_reflection = (active_state() == Gtkmm2ext::ExplicitActive);
431 show_reflection &= !_flat_buttons;
432 show_reflection &= !((_elements & Indicator)==Indicator);
433 if ( show_reflection ) {
434 float rheight = get_height()*0.5-REFLECTION_HEIGHT;
435 Gtkmm2ext::rounded_rectangle (cr, 2, get_height()*0.5-1, get_width()-4, rheight, _corner_radius-1);
436 cairo_set_source (cr, shine_pattern);
440 /* if requested, show hovering */
442 if (ARDOUR::Config->get_widget_prelight()
443 && !((visual_state() & Gtkmm2ext::Insensitive))) {
445 rounded_function (cr, 0, 0, get_width(), get_height(), _corner_radius);
446 cairo_set_source_rgba (cr, 0.905, 0.917, 0.925, 0.2);
453 ArdourButton::set_diameter (float d)
455 _diameter = (d*2) + 5.0;
457 if (_diameter != 0.0) {
458 _fixed_diameter = true;
466 ArdourButton::set_corner_radius (float r)
473 ArdourButton::on_size_request (Gtk::Requisition* req)
478 CairoWidget::on_size_request (req);
480 if ((_elements & Text) && !_text.empty()) {
481 _layout->get_pixel_size (_text_width, _text_height);
482 if (_text_width + _diameter < 75) {
496 if ((_elements & Indicator) && _fixed_diameter) {
498 req->width = _pixbuf->get_width() + lrint (_diameter) + xpad;
499 req->height = max (_pixbuf->get_height(), (int) lrint (_diameter)) + ypad;
501 req->width = _text_width + lrint (_diameter) + xpad * 2; // margin left+right * 2
502 req->height = max (_text_height, (int) lrint (_diameter)) + ypad;
506 req->width = _pixbuf->get_width() + xpad;
507 req->height = _pixbuf->get_height() + ypad;
509 req->width = _text_width + xpad;
510 req->height = _text_height + ypad;
513 req->width += _corner_radius;
517 * This sets the colors used for rendering based on the name of the button, and
518 * thus uses information from the GUI config data.
521 ArdourButton::set_colors ()
523 std::string name = get_name();
525 border_color = ARDOUR_UI::config()->color_by_name ("button border");
527 fill_start_active_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1: fill start active", name));
528 fill_end_active_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1: fill end active", name));
530 fill_start_inactive_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1: fill start", name));
531 fill_end_inactive_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1: fill end", name));
533 text_active_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1: text active", name));
534 text_inactive_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1: text", name));
536 led_active_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1: led active", name));
537 led_inactive_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1: led", name));
540 * This sets the colors used for rendering based on two fixed values, rather
541 * than basing them on the button name, and thus information in the GUI config
544 void ArdourButton::set_fixed_colors (const uint32_t color_active, const uint32_t color_inactive)
546 set_name (""); /* this will trigger a "style-changed" message and then
550 fill_start_active_color = fill_end_active_color = color_active;
552 unsigned char r, g, b, a;
553 UINT_TO_RGBA(color_active, &r, &g, &b, &a);
555 double white_contrast = (max (double(r), 255.) - min (double(r), 255.)) +
556 (max (double(g), 255.) - min (double(g), 255.)) +
557 (max (double(b), 255.) - min (double(b), 255.));
559 double black_contrast = (max (double(r), 0.) - min (double(r), 0.)) +
560 (max (double(g), 0.) - min (double(g), 0.)) +
561 (max (double(b), 0.) - min (double(b), 0.));
564 text_inactive_color = (white_contrast > black_contrast) ?
565 RGBA_TO_UINT(255, 255, 255, 255) : /* use white */
566 RGBA_TO_UINT( 0, 0, 0, 255); /* use black */
568 fill_start_inactive_color = fill_end_inactive_color = color_inactive;
570 /* XXX what about led colors ? */
576 ArdourButton::build_patterns ()
578 uint32_t start_color;
585 cairo_pattern_destroy (shine_pattern);
590 cairo_pattern_destroy (fill_pattern);
594 if (fill_pattern_active) {
595 cairo_pattern_destroy (fill_pattern_active);
596 fill_pattern_active = 0;
599 if (_elements & Body) {
602 end_color = start_color = fill_start_active_color;
604 start_color = fill_start_active_color;
605 end_color = fill_end_active_color;
607 UINT_TO_RGBA (start_color, &r, &g, &b, &a);
614 shine_pattern = cairo_pattern_create_linear (0.0, 0.0, 0.0, get_height());
615 cairo_pattern_add_color_stop_rgba (shine_pattern, 0, 1,1,1,0.0);
616 cairo_pattern_add_color_stop_rgba (shine_pattern, 0.5, 1,1,1,0.1);
617 cairo_pattern_add_color_stop_rgba (shine_pattern, 0.7, 1,1,1,0.2);
618 cairo_pattern_add_color_stop_rgba (shine_pattern, 1, 1,1,1,0.1);
620 fill_pattern = cairo_pattern_create_linear (0.0, 0.0, 0.0, get_height()-3);
622 end_color = start_color = fill_start_inactive_color;
624 start_color = fill_start_inactive_color;
625 end_color = fill_end_inactive_color;
627 UINT_TO_RGBA (start_color, &r, &g, &b, &a);
628 cairo_pattern_add_color_stop_rgba (fill_pattern, 0, r/255.0,g/255.0,b/255.0, a/255.0);
629 UINT_TO_RGBA (end_color, &r, &g, &b, &a);
630 cairo_pattern_add_color_stop_rgba (fill_pattern, 1, r/255.0,g/255.0,b/255.0, a/255.0);
632 fill_pattern_active = cairo_pattern_create_linear (0.0, 0.0, 0.0, get_height()-3);
634 if (active_state() == Gtkmm2ext::ImplicitActive && (_tweaks & ImplicitUsesSolidColor)) {
635 end_color = start_color = led_active_color;
637 end_color = start_color = fill_end_active_color;
640 if (active_state() == Gtkmm2ext::ImplicitActive && (_tweaks & ImplicitUsesSolidColor)) {
641 end_color = start_color = led_active_color;
643 start_color = fill_start_active_color;
644 end_color = fill_end_active_color;
647 UINT_TO_RGBA (start_color, &r, &g, &b, &a);
648 cairo_pattern_add_color_stop_rgba (fill_pattern_active, 0, r/255.0,g/255.0,b/255.0, a/255.0);
649 UINT_TO_RGBA (end_color, &r, &g, &b, &a);
650 cairo_pattern_add_color_stop_rgba (fill_pattern_active, 1, r/255.0,g/255.0,b/255.0, a/255.0);
653 if (led_inset_pattern) {
654 cairo_pattern_destroy (led_inset_pattern);
657 if (reflection_pattern) {
658 cairo_pattern_destroy (reflection_pattern);
661 if (_elements & Indicator) {
662 led_inset_pattern = cairo_pattern_create_linear (0.0, 0.0, 0.0, _diameter);
663 cairo_pattern_add_color_stop_rgba (led_inset_pattern, 0, 0,0,0, 0.4);
664 cairo_pattern_add_color_stop_rgba (led_inset_pattern, 1, 1,1,1, 0.7);
666 reflection_pattern = cairo_pattern_create_linear (0.0, 0.0, 0.0, _diameter/2-3);
667 cairo_pattern_add_color_stop_rgba (reflection_pattern, 0, 1,1,1, active_state() ? 0.4 : 0.2);
668 cairo_pattern_add_color_stop_rgba (reflection_pattern, 1, 1,1,1, 0.0);
671 if (active_state() == Gtkmm2ext::ExplicitActive || ((_tweaks & ImplicitUsesSolidColor) && active_state() == Gtkmm2ext::ImplicitActive)) {
672 text_color = text_active_color;
673 led_color = led_active_color;
675 text_color = text_inactive_color;
676 led_color = led_inactive_color;
679 UINT_TO_RGBA (text_color, &r, &g, &b, &a);
684 UINT_TO_RGBA (led_color, &r, &g, &b, &a);
694 ArdourButton::set_led_left (bool yn)
700 ArdourButton::on_button_press_event (GdkEventButton *ev)
702 if ((_elements & Indicator) && _led_rect && _distinct_led_click) {
703 if (ev->x >= _led_rect->x && ev->x < _led_rect->x + _led_rect->width &&
704 ev->y >= _led_rect->y && ev->y < _led_rect->y + _led_rect->height) {
709 if (_tweaks & ShowClick) {
710 set_active_state (Gtkmm2ext::ExplicitActive);
713 if (binding_proxy.button_press_handler (ev)) {
717 if (!_act_on_release) {
719 _action->activate ();
728 ArdourButton::on_button_release_event (GdkEventButton *ev)
730 if (_hovering && (_elements & Indicator) && _led_rect && _distinct_led_click) {
731 if (ev->x >= _led_rect->x && ev->x < _led_rect->x + _led_rect->width &&
732 ev->y >= _led_rect->y && ev->y < _led_rect->y + _led_rect->height) {
733 signal_led_clicked(); /* EMIT SIGNAL */
738 if (_tweaks & ShowClick) {
739 unset_active_state ();
745 if (_act_on_release) {
747 _action->activate ();
757 ArdourButton::set_distinct_led_click (bool yn)
759 _distinct_led_click = yn;
764 ArdourButton::color_handler ()
772 ArdourButton::on_size_allocate (Allocation& alloc)
774 CairoWidget::on_size_allocate (alloc);
780 ArdourButton::set_controllable (boost::shared_ptr<Controllable> c)
782 watch_connection.disconnect ();
783 binding_proxy.set_controllable (c);
787 ArdourButton::watch ()
789 boost::shared_ptr<Controllable> c (binding_proxy.get_controllable ());
792 warning << _("button cannot watch state of non-existing Controllable\n") << endmsg;
796 c->Changed.connect (watch_connection, invalidator(*this), boost::bind (&ArdourButton::controllable_changed, this), gui_context());
800 ArdourButton::controllable_changed ()
802 float val = binding_proxy.get_controllable()->get_value();
804 if (fabs (val) >= 0.5f) {
805 set_active_state (Gtkmm2ext::ExplicitActive);
807 unset_active_state ();
812 ArdourButton::set_related_action (RefPtr<Action> act)
814 Gtkmm2ext::Activatable::set_related_action (act);
818 action_tooltip_changed ();
820 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (_action);
823 tact->signal_toggled().connect (sigc::mem_fun (*this, &ArdourButton::action_toggled));
826 _action->connect_property_changed ("sensitive", sigc::mem_fun (*this, &ArdourButton::action_sensitivity_changed));
827 _action->connect_property_changed ("visible", sigc::mem_fun (*this, &ArdourButton::action_visibility_changed));
828 _action->connect_property_changed ("tooltip", sigc::mem_fun (*this, &ArdourButton::action_tooltip_changed));
833 ArdourButton::action_toggled ()
835 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (_action);
838 if (tact->get_active()) {
839 set_active_state (Gtkmm2ext::ExplicitActive);
841 unset_active_state ();
847 ArdourButton::on_style_changed (const RefPtr<Gtk::Style>&)
854 ArdourButton::on_name_changed ()
861 ArdourButton::setup_led_rect ()
865 if (get_width() < 75) {
871 if (_elements & Indicator) {
872 _led_rect = new cairo_rectangle_t;
874 if (_elements & Text) {
876 _led_rect->x = text_margin;
878 _led_rect->x = get_width() - text_margin - _diameter/2.0;
882 _led_rect->x = get_width()/2.0 - _diameter/2.0;
885 _led_rect->y = get_height()/2.0 - _diameter/2.0;
886 _led_rect->width = _diameter;
887 _led_rect->height = _diameter;
896 ArdourButton::set_image (const RefPtr<Gdk::Pixbuf>& img)
903 ArdourButton::set_active_state (Gtkmm2ext::ActiveState s)
905 bool changed = (_active_state != s);
906 CairoWidget::set_active_state (s);
914 ArdourButton::set_visual_state (Gtkmm2ext::VisualState s)
916 bool changed = (_visual_state != s);
917 CairoWidget::set_visual_state (s);
925 ArdourButton::on_enter_notify_event (GdkEventCrossing* ev)
929 if (ARDOUR::Config->get_widget_prelight()) {
933 return CairoWidget::on_enter_notify_event (ev);
937 ArdourButton::on_leave_notify_event (GdkEventCrossing* ev)
941 if (ARDOUR::Config->get_widget_prelight()) {
945 return CairoWidget::on_leave_notify_event (ev);
949 ArdourButton::set_tweaks (Tweaks t)
958 ArdourButton::action_sensitivity_changed ()
960 if (_action->property_sensitive ()) {
961 set_visual_state (Gtkmm2ext::VisualState (visual_state() & ~Gtkmm2ext::Insensitive));
963 set_visual_state (Gtkmm2ext::VisualState (visual_state() | Gtkmm2ext::Insensitive));
970 ArdourButton::action_visibility_changed ()
972 if (_action->property_visible ()) {
980 ArdourButton::action_tooltip_changed ()
982 string str = _action->property_tooltip().get_value();
983 ARDOUR_UI::instance()->set_tip (*this, str);
987 ArdourButton::set_rounded_corner_mask (int mask)
994 ArdourButton::set_elements (Element e)
1000 ArdourButton::add_elements (Element e)
1002 _elements = (ArdourButton::Element) (_elements | e);
1006 ArdourButton::set_flat_buttons (bool yn)