diff options
author | Robin Gareus <robin@gareus.org> | 2015-04-08 10:18:39 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2015-04-08 10:18:39 +0200 |
commit | 47eb9d3fe18c5d215c618cd03b0f00538b9919f2 (patch) | |
tree | 1273d4554fc22a7881aa5025d1a0d47ecc089e05 | |
parent | 2356d63d14b849e08165544fd8d7a8700245efc4 (diff) |
NOOP, cleanup & comments
-rw-r--r-- | gtk2_ardour/ardour_button.cc | 47 | ||||
-rw-r--r-- | gtk2_ardour/ardour_button.h | 16 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui2.cc | 16 |
3 files changed, 41 insertions, 38 deletions
diff --git a/gtk2_ardour/ardour_button.cc b/gtk2_ardour/ardour_button.cc index 184a9a39d0..48d77ea549 100644 --- a/gtk2_ardour/ardour_button.cc +++ b/gtk2_ardour/ardour_button.cc @@ -313,7 +313,9 @@ ArdourButton::render (cairo_t* cr, cairo_rectangle_t *) gdk_cairo_set_source_pixbuf (cr, _pixbuf->gobj(), x, y); cairo_fill (cr); } - else // rec-en is exclusive to pixbuf (tape machine mode, rec-en) + else /* VectorIcons are exclusive to Pixbuf Icons */ + /* TODO separate these into dedicated class + * it may also be efficient to render them only once for every size (image-surface) */ if ((_elements & VectorIcon) && _icon == RecTapeMode) { const double x = get_width() * .5; const double y = get_height() * .5; @@ -323,10 +325,11 @@ ArdourButton::render (cairo_t* cr, cairo_rectangle_t *) cairo_translate(cr, x, y); cairo_arc (cr, 0, 0, r, 0, 2 * M_PI); - if (active_state() == Gtkmm2ext::ExplicitActive) + if (active_state() == Gtkmm2ext::ExplicitActive) { cairo_set_source_rgba (cr, .95, .1, .1, 1.); - else + } else { cairo_set_source_rgba (cr, .95, .44, .44, 1.); // #f46f6f + } cairo_fill_preserve(cr); cairo_set_source_rgba (cr, .0, .0, .0, .5); cairo_set_line_width(cr, 1); @@ -464,7 +467,7 @@ ArdourButton::render (cairo_t* cr, cairo_rectangle_t *) cairo_arc (cr, x, y+r, r * .28, 1.05 * M_PI, 1.95 * M_PI); cairo_stroke(cr); } - else if ((_elements & VectorIcon) && _icon == BtnStop) { + else if ((_elements & VectorIcon) && _icon == TransportStop) { const int wh = std::min (get_width(), get_height()); cairo_rectangle (cr, (get_width() - wh) * .5 + wh * .25, @@ -473,7 +476,7 @@ ArdourButton::render (cairo_t* cr, cairo_rectangle_t *) VECTORICONSTROKEFILL; } - else if ((_elements & VectorIcon) && _icon == BtnPlay) { + else if ((_elements & VectorIcon) && _icon == TransportPlay) { const int wh = std::min (get_width(), get_height()) * .5; const double y = get_height() * .5; const double x = get_width() - wh; @@ -487,7 +490,7 @@ ArdourButton::render (cairo_t* cr, cairo_rectangle_t *) VECTORICONSTROKEFILL; } - else if ((_elements & VectorIcon) && _icon == BtnPanic) { + else if ((_elements & VectorIcon) && _icon == TransportPanic) { const int wh = std::min (get_width(), get_height()) * .1; const double xc = get_width() * .5; const double yh = get_height(); @@ -499,7 +502,7 @@ ArdourButton::render (cairo_t* cr, cairo_rectangle_t *) cairo_arc (cr, xc, yh *.75, wh, 0, 2 * M_PI); VECTORICONSTROKEFILL; } - else if ((_elements & VectorIcon) && (_icon == BtnStart || _icon == BtnEnd || _icon == BtnRange)) { + else if ((_elements & VectorIcon) && (_icon == TransportStart || _icon == TransportEnd || _icon == TransportRange)) { // small play triangle int wh = std::min (get_width(), get_height()); const double y = get_height() * .5; @@ -509,23 +512,23 @@ ArdourButton::render (cairo_t* cr, cairo_rectangle_t *) const float ln = std::min (get_width(), get_height()) * .07; - if (_icon == BtnStart || _icon == BtnRange) { + if (_icon == TransportStart || _icon == TransportRange) { cairo_rectangle (cr, - x - wh - ln, y - tri * 1.7, - ln * 2, tri * 3.4); + x - wh - ln, y - tri * 1.7, + ln * 2, tri * 3.4); VECTORICONSTROKEFILL; } - if (_icon == BtnEnd || _icon == BtnRange) { + if (_icon == TransportEnd || _icon == TransportRange) { cairo_rectangle (cr, - x + wh - ln, y - tri * 1.7, - ln * 2, tri * 3.4); + x + wh - ln, y - tri * 1.7, + ln * 2, tri * 3.4); VECTORICONSTROKEFILL; } - if (_icon == BtnStart) { + if (_icon == TransportStart) { cairo_move_to (cr, x - wh, y); cairo_line_to (cr, x + wh, y - tri); cairo_line_to (cr, x + wh, y + tri); @@ -538,7 +541,7 @@ ArdourButton::render (cairo_t* cr, cairo_rectangle_t *) cairo_close_path (cr); VECTORICONSTROKEFILL; } - else if ((_elements & VectorIcon) && _icon == BtnLoop) { + else if ((_elements & VectorIcon) && _icon == TransportLoop) { const double x = get_width() * .5; const double y = get_height() * .5; const double r = std::min(x, y); @@ -563,7 +566,7 @@ ArdourButton::render (cairo_t* cr, cairo_rectangle_t *) cairo_fill(cr); #undef ARCARROW } - else if ((_elements & VectorIcon) && _icon == BtnMetronom) { + else if ((_elements & VectorIcon) && _icon == TransportMetronom) { const double x = get_width() * .5; const double y = get_height() * .5; const double wh = std::min(x, y); @@ -572,8 +575,8 @@ ArdourButton::render (cairo_t* cr, cairo_rectangle_t *) const double lw = w * .25; cairo_rectangle (cr, - x - w * .7, y + h * .25, - w * 1.4, lw); + x - w * .7, y + h * .25, + w * 1.4, lw); VECTORICONSTROKEFILL; @@ -593,7 +596,8 @@ ArdourButton::render (cairo_t* cr, cairo_rectangle_t *) // 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 + // ang = (ddx/ddy): + // -> angle = atan (ang) = 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); @@ -605,11 +609,10 @@ ArdourButton::render (cairo_t* cr, cairo_rectangle_t *) VECTORICONSTROKEFILL; cairo_rectangle (cr, - x - w * .7, y + h * .25, - w * 1.4, lw); + 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_button.h b/gtk2_ardour/ardour_button.h index 628806e56b..8f24d43927 100644 --- a/gtk2_ardour/ardour_button.h +++ b/gtk2_ardour/ardour_button.h @@ -50,14 +50,14 @@ class ArdourButton : public CairoWidget , public Gtkmm2ext::Activatable CloseCross, StripWidth, DinMidi, - BtnStop, - BtnPlay, - BtnLoop, - BtnRange, - BtnStart, - BtnEnd, - BtnPanic, - BtnMetronom, + TransportStop, + TransportPlay, + TransportLoop, + TransportRange, + TransportStart, + TransportEnd, + TransportPanic, + TransportMetronom, }; static Element default_elements; diff --git a/gtk2_ardour/ardour_ui2.cc b/gtk2_ardour/ardour_ui2.cc index b22cb17075..17c3524cec 100644 --- a/gtk2_ardour/ardour_ui2.cc +++ b/gtk2_ardour/ardour_ui2.cc @@ -257,7 +257,7 @@ ARDOUR_UI::setup_transport () // auto_input_button.set_text (_("Auto Input")); click_button.set_elements ((ArdourButton::Element) (ArdourButton::Edge|ArdourButton::Body|ArdourButton::VectorIcon)); - click_button.set_icon (ArdourButton::BtnMetronom); + click_button.set_icon (ArdourButton::TransportMetronom); act = ActionManager::get_action ("Transport", "ToggleClick"); click_button.set_related_action (act); @@ -275,23 +275,23 @@ ARDOUR_UI::setup_transport () stop_button.set_active (true); goto_start_button.set_elements ((ArdourButton::Element) (ArdourButton::Edge|ArdourButton::Body|ArdourButton::VectorIcon)); - goto_start_button.set_icon (ArdourButton::BtnStart); + goto_start_button.set_icon (ArdourButton::TransportStart); goto_end_button.set_elements ((ArdourButton::Element) (ArdourButton::Edge|ArdourButton::Body|ArdourButton::VectorIcon)); - goto_end_button.set_icon (ArdourButton::BtnEnd); + goto_end_button.set_icon (ArdourButton::TransportEnd); roll_button.set_elements ((ArdourButton::Element) (ArdourButton::Edge|ArdourButton::Body|ArdourButton::VectorIcon)); - roll_button.set_icon (ArdourButton::BtnPlay); + roll_button.set_icon (ArdourButton::TransportPlay); stop_button.set_elements ((ArdourButton::Element) (ArdourButton::Edge|ArdourButton::Body|ArdourButton::VectorIcon)); - stop_button.set_icon (ArdourButton::BtnStop); + stop_button.set_icon (ArdourButton::TransportStop); play_selection_button.set_elements ((ArdourButton::Element) (ArdourButton::Edge|ArdourButton::Body|ArdourButton::VectorIcon)); - play_selection_button.set_icon (ArdourButton::BtnRange); + play_selection_button.set_icon (ArdourButton::TransportRange); auto_loop_button.set_elements ((ArdourButton::Element) (ArdourButton::Edge|ArdourButton::Body|ArdourButton::VectorIcon)); - auto_loop_button.set_icon (ArdourButton::BtnLoop); + auto_loop_button.set_icon (ArdourButton::TransportLoop); rec_button.set_elements ((ArdourButton::Element) (ArdourButton::Edge|ArdourButton::Body|ArdourButton::VectorIcon)); rec_button.set_icon (ArdourButton::RecButton); midi_panic_button.set_elements ((ArdourButton::Element) (ArdourButton::Edge|ArdourButton::Body|ArdourButton::VectorIcon)); - midi_panic_button.set_icon (ArdourButton::BtnPanic); + midi_panic_button.set_icon (ArdourButton::TransportPanic); /* the icon for this has an odd aspect ratio, so fatten up the button */ midi_panic_button.set_size_request (25, -1); |