summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2015-04-08 01:28:52 +0200
committerRobin Gareus <robin@gareus.org>2015-04-08 01:28:52 +0200
commit2356d63d14b849e08165544fd8d7a8700245efc4 (patch)
tree2d2943ce137055b643d9dd7b89eb894f40bfb216
parentc9f9bb263fc3f96e383216d515c62ac6706b56da (diff)
construct a metronom
-rw-r--r--gtk2_ardour/ardour_button.cc46
-rw-r--r--gtk2_ardour/ardour_ui2.cc5
2 files changed, 50 insertions, 1 deletions
diff --git a/gtk2_ardour/ardour_button.cc b/gtk2_ardour/ardour_button.cc
index 7ab1304fa5..184a9a39d0 100644
--- a/gtk2_ardour/ardour_button.cc
+++ b/gtk2_ardour/ardour_button.cc
@@ -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);
diff --git a/gtk2_ardour/ardour_ui2.cc b/gtk2_ardour/ardour_ui2.cc
index 2abca97503..b22cb17075 100644
--- a/gtk2_ardour/ardour_ui2.cc
+++ b/gtk2_ardour/ardour_ui2.cc
@@ -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);