update dropdown triangle
This commit is contained in:
parent
8e3b1c17c1
commit
936cb05989
|
@ -290,7 +290,7 @@ ArdourButton::render (cairo_t* cr, cairo_rectangle_t *)
|
|||
}
|
||||
|
||||
int text_margin;
|
||||
if (get_width() < 75) {
|
||||
if (get_width() < 75 || (_elements & Menu) ) {
|
||||
text_margin = 5;
|
||||
} else {
|
||||
text_margin = 10;
|
||||
|
@ -311,7 +311,7 @@ ArdourButton::render (cairo_t* cr, cairo_rectangle_t *)
|
|||
pango_cairo_show_layout (cr, _layout->gobj());
|
||||
} else if ( (_elements & Indicator) == Indicator) {
|
||||
if (_led_left) {
|
||||
cairo_move_to (cr, rint(text_margin + _diameter + 4),rint((get_height() - _text_height)/2.0));
|
||||
cairo_move_to (cr, rint(text_margin + _diameter + 4), rint((get_height() - _text_height)/2.0));
|
||||
} else {
|
||||
cairo_move_to (cr, rint(text_margin), rint((get_height() - _text_height)/2.0));
|
||||
}
|
||||
|
@ -337,7 +337,7 @@ ArdourButton::render (cairo_t* cr, cairo_rectangle_t *)
|
|||
|
||||
// TODO honor left/right text_margin with min/max()
|
||||
|
||||
cairo_move_to (cr, rint(xa), rint(ya));
|
||||
cairo_move_to (cr, rint(.5 + xa), rint(ya));
|
||||
pango_cairo_update_layout(cr, _layout->gobj());
|
||||
pango_cairo_show_layout (cr, _layout->gobj());
|
||||
cairo_restore (cr);
|
||||
|
@ -347,22 +347,25 @@ ArdourButton::render (cairo_t* cr, cairo_rectangle_t *)
|
|||
|
||||
//Menu "triangle"
|
||||
if (((_elements & Menu)==Menu)) {
|
||||
|
||||
cairo_save (cr);
|
||||
|
||||
const float trih = ceil(_diameter/2.0);
|
||||
const float triw2 = ceil(.577 * _diameter/2.0); // 1/sqrt(3) Equilateral triangle
|
||||
//menu arrow
|
||||
cairo_set_source_rgba (cr, 1, 1, 1, 0.4);
|
||||
cairo_move_to(cr, get_width() - ((_diameter/2.0) + 6.0), get_height()/2.0 +_diameter/4);
|
||||
cairo_rel_line_to(cr, -_diameter/2, -_diameter/2);
|
||||
cairo_rel_line_to(cr, _diameter, 0);
|
||||
cairo_move_to(cr, get_width() - triw2 - 3. , rint((get_height() + trih) / 2.0));
|
||||
cairo_rel_line_to(cr, -triw2, -trih);
|
||||
cairo_rel_line_to(cr, 2. * triw2, 0);
|
||||
cairo_close_path(cr);
|
||||
|
||||
cairo_set_source_rgba (cr, 1, 1, 1, 0.4);
|
||||
cairo_fill_preserve(cr);
|
||||
cairo_fill(cr);
|
||||
|
||||
cairo_move_to(cr, get_width() - triw2 - 3 , rint((get_height() + trih) / 2.0));
|
||||
cairo_rel_line_to(cr, .5 - triw2, .5 - trih);
|
||||
cairo_rel_line_to(cr, 2. * triw2 - 1, 0);
|
||||
cairo_close_path(cr);
|
||||
cairo_set_source_rgba (cr, 0, 0, 0, 0.8);
|
||||
cairo_set_line_width(cr, 0.5);
|
||||
cairo_set_line_width(cr, 1);
|
||||
cairo_stroke(cr);
|
||||
|
||||
cairo_restore (cr);
|
||||
}
|
||||
|
||||
//Indicator LED
|
||||
|
@ -512,7 +515,7 @@ ArdourButton::on_size_request (Gtk::Requisition* req)
|
|||
xpad = 6;
|
||||
}
|
||||
|
||||
if ((_elements & Indicator) && _fixed_diameter) {
|
||||
if ((_elements & Indicator) && _fixed_diameter) {
|
||||
if (_pixbuf) {
|
||||
req->width = _pixbuf->get_width() + lrint (_diameter) + xpad;
|
||||
req->height = max (_pixbuf->get_height(), (int) lrint (_diameter)) + ypad;
|
||||
|
@ -520,7 +523,7 @@ ArdourButton::on_size_request (Gtk::Requisition* req)
|
|||
req->width = _text_width + lrint (_diameter) + xpad * 2; // margin left+right * 2
|
||||
req->height = max (_text_height, (int) lrint (_diameter)) + ypad;
|
||||
}
|
||||
} else {
|
||||
} else {
|
||||
if (_pixbuf) {
|
||||
req->width = _pixbuf->get_width() + xpad;
|
||||
req->height = _pixbuf->get_height() + ypad;
|
||||
|
@ -529,6 +532,10 @@ ArdourButton::on_size_request (Gtk::Requisition* req)
|
|||
req->height = _text_height + ypad;
|
||||
}
|
||||
}
|
||||
|
||||
if ((_elements & Menu)) {
|
||||
req->width += _diameter + 4;
|
||||
}
|
||||
req->width += _corner_radius;
|
||||
}
|
||||
|
||||
|
|
|
@ -219,7 +219,7 @@ static const gchar *_rb_opt_strings[] = {
|
|||
};
|
||||
#endif
|
||||
|
||||
static const gchar *_combo_pad_string = "mm"; ///< ~2em
|
||||
#define COMBO_TRIANGLE_WIDTH 25 // ArdourButton _diameter (11) + 2 * arrow-padding (2*2) + 2 * text-padding (2*5)
|
||||
|
||||
static void
|
||||
pane_size_watcher (Paned* pane)
|
||||
|
@ -3048,7 +3048,7 @@ Editor::build_edit_point_menu ()
|
|||
edit_point_selector.AddMenuElem (MenuElem ( edit_point_strings[(int)EditAtSelectedMarker], sigc::bind (sigc::mem_fun(*this, &Editor::edit_point_selection_done), (EditPoint) EditAtSelectedMarker)));
|
||||
edit_point_selector.AddMenuElem (MenuElem ( edit_point_strings[(int)EditAtMouse], sigc::bind (sigc::mem_fun(*this, &Editor::edit_point_selection_done), (EditPoint) EditAtMouse)));
|
||||
|
||||
set_size_request_to_display_given_text (edit_point_selector, edit_point_strings, _combo_pad_string, 2);
|
||||
set_size_request_to_display_given_text (edit_point_selector, edit_point_strings, COMBO_TRIANGLE_WIDTH, 2);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -3061,7 +3061,7 @@ Editor::build_edit_mode_menu ()
|
|||
edit_mode_selector.AddMenuElem (MenuElem ( edit_mode_strings[(int)Ripple], sigc::bind (sigc::mem_fun(*this, &Editor::edit_mode_selection_done), (EditMode) Ripple)));
|
||||
edit_mode_selector.AddMenuElem (MenuElem ( edit_mode_strings[(int)Lock], sigc::bind (sigc::mem_fun(*this, &Editor::edit_mode_selection_done), (EditMode) Lock)));
|
||||
|
||||
set_size_request_to_display_given_text (edit_mode_selector, edit_mode_strings, _combo_pad_string, 2);
|
||||
set_size_request_to_display_given_text (edit_mode_selector, edit_mode_strings, COMBO_TRIANGLE_WIDTH, 2);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -3073,7 +3073,7 @@ Editor::build_snap_mode_menu ()
|
|||
snap_mode_selector.AddMenuElem (MenuElem ( snap_mode_strings[(int)SnapNormal], sigc::bind (sigc::mem_fun(*this, &Editor::snap_mode_selection_done), (SnapMode) SnapNormal)));
|
||||
snap_mode_selector.AddMenuElem (MenuElem ( snap_mode_strings[(int)SnapMagnetic], sigc::bind (sigc::mem_fun(*this, &Editor::snap_mode_selection_done), (SnapMode) SnapMagnetic)));
|
||||
|
||||
set_size_request_to_display_given_text (snap_mode_selector, snap_mode_strings, _combo_pad_string, 2);
|
||||
set_size_request_to_display_given_text (snap_mode_selector, snap_mode_strings, COMBO_TRIANGLE_WIDTH, 2);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -3112,7 +3112,7 @@ Editor::build_snap_type_menu ()
|
|||
snap_type_selector.AddMenuElem (MenuElem ( snap_type_strings[(int)SnapToRegionSync], sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_selection_done), (SnapType) SnapToRegionSync)));
|
||||
snap_type_selector.AddMenuElem (MenuElem ( snap_type_strings[(int)SnapToRegionBoundary], sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_selection_done), (SnapType) SnapToRegionBoundary)));
|
||||
|
||||
set_size_request_to_display_given_text (snap_type_selector, snap_type_strings, _combo_pad_string, 2);
|
||||
set_size_request_to_display_given_text (snap_type_selector, snap_type_strings, COMBO_TRIANGLE_WIDTH, 2);
|
||||
|
||||
}
|
||||
|
||||
|
@ -3458,7 +3458,7 @@ Editor::build_zoom_focus_menu ()
|
|||
zoom_focus_selector.AddMenuElem (MenuElem ( zoom_focus_strings[(int)ZoomFocusMouse], sigc::bind (sigc::mem_fun(*this, &Editor::zoom_focus_selection_done), (ZoomFocus) ZoomFocusMouse)));
|
||||
zoom_focus_selector.AddMenuElem (MenuElem ( zoom_focus_strings[(int)ZoomFocusEdit], sigc::bind (sigc::mem_fun(*this, &Editor::zoom_focus_selection_done), (ZoomFocus) ZoomFocusEdit)));
|
||||
|
||||
set_size_request_to_display_given_text (zoom_focus_selector, zoom_focus_strings, _combo_pad_string, 2);
|
||||
set_size_request_to_display_given_text (zoom_focus_selector, zoom_focus_strings, COMBO_TRIANGLE_WIDTH, 2);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in New Issue