summaryrefslogtreecommitdiff
path: root/gtk2_ardour/tempo_curve.cc
diff options
context:
space:
mode:
authornick_m <mainsbridge@gmail.com>2017-02-27 17:53:31 +1100
committerRobin Gareus <robin@gareus.org>2017-02-27 20:16:10 +0100
commit4496babc8f00169130bde964961e368d332cc66b (patch)
treee977b422beba972f835ad5675a39a800450e1bc3 /gtk2_ardour/tempo_curve.cc
parentf4575442634bcecf3caa633b849502491ed19ae7 (diff)
initial rework of tempo text display (numbers are curve items)
- move tempo numbers to a layer above the curve. - the offset of the text box in Marker is horrible here. what to do?
Diffstat (limited to 'gtk2_ardour/tempo_curve.cc')
-rw-r--r--gtk2_ardour/tempo_curve.cc32
1 files changed, 31 insertions, 1 deletions
diff --git a/gtk2_ardour/tempo_curve.cc b/gtk2_ardour/tempo_curve.cc
index c43e91c9ac..720418e030 100644
--- a/gtk2_ardour/tempo_curve.cc
+++ b/gtk2_ardour/tempo_curve.cc
@@ -37,7 +37,8 @@ TempoCurve::TempoCurve (PublicEditor& ed, ArdourCanvas::Container& parent, guint
, _min_tempo (temp.note_types_per_minute())
, _max_tempo (temp.note_types_per_minute())
, _tempo (temp)
-
+ , _start_text (0)
+ , _end_text (0)
{
frame_position = frame;
unit_position = editor.sample_to_pixel (frame);
@@ -55,6 +56,18 @@ TempoCurve::TempoCurve (PublicEditor& ed, ArdourCanvas::Container& parent, guint
points = new ArdourCanvas::Points ();
_curve->set (*points);
+ _start_text = new ArdourCanvas::Text (group);
+ _end_text = new ArdourCanvas::Text (group);
+ _start_text->set_font_description (ARDOUR_UI_UTILS::get_font_for_style (N_("MarkerText")));
+ _end_text->set_font_description (ARDOUR_UI_UTILS::get_font_for_style (N_("MarkerText")));
+ _start_text->set_color (RGBA_TO_UINT (255,255,255,255));
+ _end_text->set_color (RGBA_TO_UINT (255,255,255,255));
+ char buf[10];
+ snprintf (buf, sizeof (buf), "%.3f/%.0f", _tempo.note_types_per_minute(), _tempo.note_type());
+ _start_text->set (buf);
+ snprintf (buf, sizeof (buf), "%.3f", _tempo.end_note_types_per_minute());
+ _end_text->set (buf);
+
set_color_rgba (rgba);
editor.ZoomChanged.connect (sigc::mem_fun (*this, &TempoCurve::reposition));
@@ -147,6 +160,23 @@ TempoCurve::set_position (framepos_t frame, framepos_t end_frame)
}
_curve->set (*points);
+
+ char buf[10];
+ snprintf (buf, sizeof (buf), "%.3f/%.0f", _tempo.note_types_per_minute(), _tempo.note_type());
+ _start_text->set (buf);
+ snprintf (buf, sizeof (buf), "%.3f", _tempo.end_note_types_per_minute());
+ _end_text->set (buf);
+
+ _start_text->set_position (ArdourCanvas::Duple (10, .5 ));
+ _end_text->set_position (ArdourCanvas::Duple (editor.sample_to_pixel (end_frame - frame) - _end_text->text_width() - 10, .5 ));
+
+ if (_end_text->text_width() + _start_text->text_width() + 20 > editor.sample_to_pixel (end_frame - frame)) {
+ _start_text->hide();
+ _end_text->hide();
+ } else {
+ _start_text->show();
+ _end_text->show();
+ }
}
void