summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2014-09-02 20:43:15 +0200
committerRobin Gareus <robin@gareus.org>2014-09-02 20:43:15 +0200
commit1592d0482891377bbde1462d548151609e0b1130 (patch)
tree7e9acb1732a1ee3a43650c40658c6c1e29c3ecca /gtk2_ardour
parent9cd0af6b5124f30bf6479aa6b2afc9762d553084 (diff)
one off, special case rec-en button for now. (circle may need tweaking)
In the long run we want a class hierarchy: CairoWidget -> ArdourWidget -> ArdourLabel -> ArdourButton -> SpecialArdourButton(s)
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/ardour_button.cc18
-rw-r--r--gtk2_ardour/ardour_button.h1
2 files changed, 19 insertions, 0 deletions
diff --git a/gtk2_ardour/ardour_button.cc b/gtk2_ardour/ardour_button.cc
index 6208deda2a..6d77eac770 100644
--- a/gtk2_ardour/ardour_button.cc
+++ b/gtk2_ardour/ardour_button.cc
@@ -290,6 +290,17 @@ ArdourButton::render (cairo_t* cr, cairo_rectangle_t *)
cairo_restore (cr);
}
}
+ else // rec-en is exclusive to pixbuf (tape machine mode, rec-en)
+ if ((_elements & RecButton)) {
+ const double x = get_width() * .5;
+ const double y = get_height() * .5;
+ cairo_arc (cr, x, y, get_height () *.2 , 0, 2 * M_PI);
+ cairo_set_source_rgba (cr, .0, .0, .0, 1.);
+ cairo_set_line_width(cr, 1);
+ cairo_stroke_preserve (cr);
+ cairo_set_source_rgba (cr, .95, .44, .44, 1.); // #f46f6f
+ cairo_fill(cr);
+ }
int text_margin;
if (get_width() < 75 || (_elements & Menu) ) {
@@ -533,6 +544,13 @@ ArdourButton::on_size_request (Gtk::Requisition* req)
if ((_elements & Menu)) {
req->width += _diameter + 4;
}
+
+ if ((_elements & RecButton) && !_pixbuf) {
+ assert(!(_elements & Text));
+ req->width += char_pixel_height();
+ req->height += char_pixel_height();
+ }
+
req->width += _corner_radius;
}
diff --git a/gtk2_ardour/ardour_button.h b/gtk2_ardour/ardour_button.h
index 0c61a6f101..ec79742782 100644
--- a/gtk2_ardour/ardour_button.h
+++ b/gtk2_ardour/ardour_button.h
@@ -40,6 +40,7 @@ class ArdourButton : public CairoWidget , public Gtkmm2ext::Activatable
unused = 0x10,
Menu = 0x20,
Inactive = 0x40, // no _action is defined AND state is not used
+ RecButton = 0x80, // tenative, see commit message
};
static Element default_elements;