mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 06:44:57 +01:00
construct a metronom
This commit is contained in:
parent
c9f9bb263f
commit
2356d63d14
2 changed files with 51 additions and 2 deletions
|
|
@ -562,8 +562,54 @@ ArdourButton::render (cairo_t* cr, cairo_rectangle_t *)
|
|||
cairo_set_source_rgba (cr, 1, 1, 1, 1.0);
|
||||
cairo_fill(cr);
|
||||
#undef ARCARROW
|
||||
|
||||
}
|
||||
else if ((_elements & VectorIcon) && _icon == BtnMetronom) {
|
||||
const double x = get_width() * .5;
|
||||
const double y = get_height() * .5;
|
||||
const double wh = std::min(x, y);
|
||||
const double h = wh * .8;
|
||||
const double w = wh * .5;
|
||||
const double lw = w * .25;
|
||||
|
||||
cairo_rectangle (cr,
|
||||
x - w * .7, y + h * .25,
|
||||
w * 1.4, lw);
|
||||
|
||||
VECTORICONSTROKEFILL;
|
||||
|
||||
cairo_move_to (cr, x - w, y + h);
|
||||
cairo_line_to (cr, x + w, y + h);
|
||||
cairo_line_to (cr, x + w * .35, y - h);
|
||||
cairo_line_to (cr, x - w * .35, y - h);
|
||||
cairo_line_to (cr, x - w, y + h);
|
||||
|
||||
cairo_move_to (cr, x - w + lw, y + h -lw);
|
||||
cairo_line_to (cr, x - w * .35 + lw, y - h + lw);
|
||||
cairo_line_to (cr, x + w * .35 - lw, y - h + lw);
|
||||
cairo_line_to (cr, x + w - lw, y + h -lw);
|
||||
cairo_line_to (cr, x - w + lw, y + h -lw);
|
||||
|
||||
VECTORICONSTROKEFILL;
|
||||
|
||||
// ddx = .70 w = .75 * .5 wh = .375 wh
|
||||
// ddy = .75 h - lw = .75 * .8 wh - wh .5 * .2 = .5 wh
|
||||
// -> angle atan (375 / .5) ~ 36deg
|
||||
const double dx = lw * .2; // 1 - cos(tan^-1(ang))
|
||||
const double dy = lw * .4; // 1 - sin(tan^-1(ang))
|
||||
cairo_move_to (cr, x - w * .3 , y + h * .25 + lw * .5);
|
||||
cairo_line_to (cr, x - w + dx , y - h + lw + dy);
|
||||
cairo_line_to (cr, x - w + lw , y - h + lw);
|
||||
cairo_line_to (cr, x - w * .3 + lw, y + h * .25 + lw * .5);
|
||||
cairo_close_path (cr);
|
||||
|
||||
VECTORICONSTROKEFILL;
|
||||
|
||||
cairo_rectangle (cr,
|
||||
x - w * .7, y + h * .25,
|
||||
w * 1.4, lw);
|
||||
cairo_fill(cr);
|
||||
}
|
||||
|
||||
else if (_elements & VectorIcon) {
|
||||
// missing icon
|
||||
assert(0);
|
||||
|
|
|
|||
|
|
@ -256,7 +256,9 @@ ARDOUR_UI::setup_transport ()
|
|||
|
||||
// auto_input_button.set_text (_("Auto Input"));
|
||||
|
||||
click_button.set_image (get_icon (X_("metronome")));
|
||||
click_button.set_elements ((ArdourButton::Element) (ArdourButton::Edge|ArdourButton::Body|ArdourButton::VectorIcon));
|
||||
click_button.set_icon (ArdourButton::BtnMetronom);
|
||||
|
||||
act = ActionManager::get_action ("Transport", "ToggleClick");
|
||||
click_button.set_related_action (act);
|
||||
click_button.signal_button_press_event().connect (sigc::mem_fun (*this, &ARDOUR_UI::click_button_clicked), false);
|
||||
|
|
@ -365,6 +367,7 @@ ARDOUR_UI::setup_transport ()
|
|||
transport_button_size_group->add_widget (stop_button);
|
||||
|
||||
goto_start_button.set_size_request (28, 44);
|
||||
click_button.set_size_request (32, 44);
|
||||
|
||||
HBox* tbox1 = manage (new HBox);
|
||||
HBox* tbox2 = manage (new HBox);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue