13
0

add "close/cross" special button

This commit is contained in:
Robin Gareus 2014-09-03 22:07:25 +02:00
parent a2a399d6f9
commit a99bd28950
2 changed files with 14 additions and 1 deletions

View File

@ -352,6 +352,18 @@ ArdourButton::render (cairo_t* cr, cairo_rectangle_t *)
cairo_set_line_width(cr, 1); cairo_set_line_width(cr, 1);
cairo_stroke(cr); cairo_stroke(cr);
} }
else if (_elements & CloseCross) {
const double x = get_width() * .5;
const double y = get_height() * .5;
const double o = std::min(x, y) * .4;
ArdourCanvas::set_source_rgba (cr, text_color);
cairo_set_line_width(cr, 1);
cairo_move_to(cr, x-o, y-o);
cairo_line_to(cr, x+o, y+o);
cairo_move_to(cr, x+o, y-o);
cairo_line_to(cr, x-o, y+o);
cairo_stroke(cr);
}
int text_margin; int text_margin;
if (get_width() < 75 || (_elements & Menu) ) { if (get_width() < 75 || (_elements & Menu) ) {
@ -596,7 +608,7 @@ ArdourButton::on_size_request (Gtk::Requisition* req)
req->width += _diameter + 4; req->width += _diameter + 4;
} }
if ((_elements & RecButton) && !_pixbuf) { if ((_elements & (RecButton | CloseCross)) && !_pixbuf) {
assert(!(_elements & Text)); assert(!(_elements & Text));
req->width += std::max(char_pixel_width(), char_pixel_height()); req->width += std::max(char_pixel_width(), char_pixel_height());
req->height += std::max(char_pixel_width(), char_pixel_height()); req->height += std::max(char_pixel_width(), char_pixel_height());

View File

@ -42,6 +42,7 @@ class ArdourButton : public CairoWidget , public Gtkmm2ext::Activatable
Inactive = 0x40, // no _action is defined AND state is not used Inactive = 0x40, // no _action is defined AND state is not used
RecButton = 0x80, // tentative, see commit message RecButton = 0x80, // tentative, see commit message
RecTapeMode = 0x100, // tentative RecTapeMode = 0x100, // tentative
CloseCross = 0x200, // tentative
}; };
static Element default_elements; static Element default_elements;