}
} else if ((ts = dynamic_cast<TempoSection*>(*i)) != 0) {
- if (ts->type() == TempoSection::Constant) {
- if (ts->note_type() != 4.0) {
- snprintf (buf, sizeof (buf), "%.3f/%.0f", ts->note_types_per_minute(), ts->note_type());
- } else {
- snprintf (buf, sizeof (buf), "%.3f", ts->note_types_per_minute());
- }
- } else {
- if (ts->note_type() != 4.0) {
- snprintf (buf, sizeof (buf), "%.3f/%.0f>%.3f", ts->note_types_per_minute(), ts->note_type(), ts->end_note_types_per_minute());
- } else {
- snprintf (buf, sizeof (buf), "%.3f>%.3f", ts->note_types_per_minute(), ts->end_note_types_per_minute());
- }
- }
max_tempo = max (max_tempo, ts->note_types_per_minute());
max_tempo = max (max_tempo, ts->end_note_types_per_minute());
min_tempo = min (min_tempo, ts->note_types_per_minute());
tempo_curves.push_back (new TempoCurve (*this, *tempo_group, tc_color,
*(const_cast<TempoSection*>(ts)), ts->frame(), false));
+ const std::string tname (X_(""));
if (ts->position_lock_style() == MusicTime) {
- metric_marks.push_back (new TempoMarker (*this, *tempo_group, UIConfiguration::instance().color ("tempo marker music"), buf,
+ metric_marks.push_back (new TempoMarker (*this, *tempo_group, UIConfiguration::instance().color ("tempo marker music"), tname,
*(const_cast<TempoSection*>(ts))));
} else {
- metric_marks.push_back (new TempoMarker (*this, *tempo_group, UIConfiguration::instance().color ("tempo marker"), buf,
+ metric_marks.push_back (new TempoMarker (*this, *tempo_group, UIConfiguration::instance().color ("tempo marker"), tname,
*(const_cast<TempoSection*>(ts))));
}
if (prev_ts && abs (prev_ts->end_note_types_per_minute() - ts->note_types_per_minute()) < 1.0) {
if ((ts = &tempo_marker->tempo()) != 0) {
tempo_marker->set_position (ts->frame ());
- char buf[64];
if (prev_ts && abs (prev_ts->end_note_types_per_minute() - ts->note_types_per_minute()) < 1.0) {
tempo_marker->set_points_color (UIConfiguration::instance().color ("tempo marker music"));
tempo_marker->set_points_color (UIConfiguration::instance().color ("tempo marker"));
}
- if (ts->type() == TempoSection::Constant) {
- if (ts->note_type() != 4.0) {
- snprintf (buf, sizeof (buf), "%.3f/%.0f", ts->note_types_per_minute(), ts->note_type());
- } else {
- snprintf (buf, sizeof (buf), "%.3f", ts->note_types_per_minute());
- }
- } else {
- if (ts->note_type() != 4.0) {
- snprintf (buf, sizeof (buf), "%.3f/%.0f>%.3f", ts->note_types_per_minute(), ts->note_type(), ts->end_note_types_per_minute());
- } else {
- snprintf (buf, sizeof (buf), "%.3f>%.3f", ts->note_types_per_minute(), ts->end_note_types_per_minute());
- }
- }
-
- tempo_marker->set_name (buf);
-
max_tempo = max (max_tempo, ts->note_types_per_minute());
max_tempo = max (max_tempo, ts->end_note_types_per_minute());
min_tempo = min (min_tempo, ts->note_types_per_minute());
, _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);
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));
}
_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