mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-04 12:45:45 +01:00
Allow left-click on MetaButton Dropdown indicator
This commit is contained in:
parent
ccc2273d54
commit
fb6b64f736
4 changed files with 90 additions and 19 deletions
|
|
@ -397,7 +397,10 @@ ArdourButton::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_
|
|||
if (_elements & Menu) {
|
||||
//if this is a DropDown with an icon, then we need to
|
||||
//move the icon left slightly to accomomodate the arrow
|
||||
x -= _diameter - 2;
|
||||
x -= _diameter + 4;
|
||||
}
|
||||
if (_elements & MetaMenu) {
|
||||
x -= 2;
|
||||
}
|
||||
cairo_rectangle (cr, x, y, _pixbuf->get_width(), _pixbuf->get_height());
|
||||
gdk_cairo_set_source_pixbuf (cr, _pixbuf->gobj(), x, y);
|
||||
|
|
@ -410,6 +413,9 @@ ArdourButton::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_
|
|||
if (_elements & Menu) {
|
||||
vw -= _diameter + 4;
|
||||
}
|
||||
if (_elements & MetaMenu) {
|
||||
vw -= 2;
|
||||
}
|
||||
if (_elements & Indicator) {
|
||||
vw -= _diameter + .5 * text_margin;
|
||||
if (_led_left) {
|
||||
|
|
@ -459,7 +465,7 @@ ArdourButton::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_
|
|||
Gtkmm2ext::set_source_rgba (cr, text_color);
|
||||
const double text_ypos = round ((get_height() - _text_height) * .5);
|
||||
|
||||
if (_elements & Menu) {
|
||||
if ((_elements & (Menu | MetaMenu)) == Menu) {
|
||||
// always left align (dropdown)
|
||||
cairo_move_to (cr, text_margin, text_ypos);
|
||||
pango_cairo_show_layout (cr, _layout->gobj());
|
||||
|
|
@ -493,6 +499,9 @@ ArdourButton::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_
|
|||
}
|
||||
|
||||
cairo_device_to_user(cr, &ww, &wh);
|
||||
if (_elements & MetaMenu) {
|
||||
ww -= _diameter + 6;
|
||||
}
|
||||
xa = text_margin + (ww - _text_width - 2 * text_margin) * _xalign;
|
||||
ya = (wh - _text_height) * _yalign;
|
||||
|
||||
|
|
@ -532,6 +541,14 @@ ArdourButton::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_
|
|||
cairo_stroke(cr);
|
||||
}
|
||||
|
||||
if (_elements & MetaMenu) {
|
||||
cairo_move_to(cr, get_width() - floor (_diameter) - 5.5 , 1);
|
||||
cairo_line_to(cr, get_width() - floor (_diameter) - 5.5 , get_height () -1);
|
||||
cairo_set_source_rgba (cr, 0, 0, 0, 0.8);
|
||||
cairo_set_line_width(cr, 1);
|
||||
cairo_stroke(cr);
|
||||
}
|
||||
|
||||
//Indicator LED
|
||||
if ((_elements & ColorBox)==ColorBox) {
|
||||
cairo_save (cr);
|
||||
|
|
@ -748,10 +765,14 @@ ArdourButton::on_size_request (Gtk::Requisition* req)
|
|||
req->height = std::max (req->height, (int) lrint (_diameter) + 4);
|
||||
}
|
||||
|
||||
if ((_elements & Menu)) {
|
||||
if (_elements & Menu) {
|
||||
req->width += _diameter + 4;
|
||||
}
|
||||
|
||||
if (_elements & MetaMenu) {
|
||||
req->width += 2; // seprator line
|
||||
}
|
||||
|
||||
if (_elements & (VectorIcon | IconRenderCallback)) {
|
||||
const int wh = std::max (8., std::max (ceil (TRACKHEADERBTNW * char_avg_pixel_width()), ceil (char_pixel_height() * BASELINESTRETCH + 1.)));
|
||||
req->width += wh;
|
||||
|
|
@ -776,7 +797,7 @@ ArdourButton::on_size_request (Gtk::Requisition* req)
|
|||
req->width = req->height;
|
||||
if (req->height < req->width)
|
||||
req->height = req->width;
|
||||
} else if (_sizing_texts.empty() && _text_width > 0 && !(_elements & Menu)) {
|
||||
} else if (_sizing_texts.empty() && _text_width > 0 && ((_elements & (Menu | MetaMenu)) != (Menu | MetaMenu))) {
|
||||
// properly centered text for those elements that are centered
|
||||
// (no sub-pixel offset)
|
||||
if ((req->width - _text_width) & 1) { ++req->width; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue