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)
This commit is contained in:
Robin Gareus 2014-09-02 20:43:15 +02:00
parent 9cd0af6b51
commit 1592d04828
2 changed files with 19 additions and 0 deletions

View File

@ -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;
}

View File

@ -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;