X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Ftempo_curve.cc;h=db675c9c5f710116c00aed5e2594a2d6299a34e6;hb=cf52d6e4b40111eb04b244ec054055a4ec15dbe0;hp=cac512c0b2b34ca3b74b55eade3608fc26b5357b;hpb=a9921c10eb7d498946c756c184ae67422bff76c0;p=ardour.git diff --git a/gtk2_ardour/tempo_curve.cc b/gtk2_ardour/tempo_curve.cc index cac512c0b2..db675c9c5f 100644 --- a/gtk2_ardour/tempo_curve.cc +++ b/gtk2_ardour/tempo_curve.cc @@ -16,7 +16,7 @@ #include -#include "i18n.h" +#include "pbd/i18n.h" PBD::Signal1 TempoCurve::CatchDeletion; @@ -128,22 +128,22 @@ TempoCurve::set_position (framepos_t frame, framepos_t end_frame) points->push_back (ArdourCanvas::Duple (ArdourCanvas::COORD_MAX - 5.0, y_pos)); } else { - const framepos_t frame_step = (end_frame - frame) / 5; + const framepos_t frame_step = max ((end_frame - frame) / 5, (framepos_t) 1); framepos_t current_frame = frame; while (current_frame < (end_frame - frame_step)) { const double tempo_at = _tempo.tempo_at_frame (current_frame, editor.session()->frame_rate()) * _tempo.note_type(); - const double y_pos = (curve_height) - (((tempo_at - _min_tempo) / (_max_tempo - _min_tempo)) * curve_height); + const double y_pos = max ((curve_height) - (((tempo_at - _min_tempo) / (_max_tempo - _min_tempo)) * curve_height), 0.0); - points->push_back (ArdourCanvas::Duple (editor.sample_to_pixel (current_frame - frame), y_pos)); + points->push_back (ArdourCanvas::Duple (editor.sample_to_pixel (current_frame - frame), min (y_pos, curve_height))); current_frame += frame_step; } const double tempo_at = _tempo.tempo_at_frame (end_frame, editor.session()->frame_rate()) * _tempo.note_type(); - const double y_pos = (curve_height) - (((tempo_at - _min_tempo) / (_max_tempo - _min_tempo)) * curve_height); + const double y_pos = max ((curve_height) - (((tempo_at - _min_tempo) / (_max_tempo - _min_tempo)) * curve_height), 0.0); - points->push_back (ArdourCanvas::Duple (editor.sample_to_pixel ((end_frame - 1) - frame), y_pos)); + points->push_back (ArdourCanvas::Duple (editor.sample_to_pixel ((end_frame - 1) - frame), min (y_pos, curve_height))); } _curve->set (*points); @@ -175,7 +175,7 @@ void TempoCurve::set_color_rgba (uint32_t c) { _color = c; - _curve->set_fill_color (UIConfiguration::instance().color_mod ("color 62", "selection rect")); + _curve->set_fill_color (UIConfiguration::instance().color_mod ("tempo curve", "selection rect")); _curve->set_outline_color (_color); }