diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2011-11-18 18:22:00 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2011-11-18 18:22:00 +0000 |
commit | 7b7b2e394c89554f14df4ac09736458dca7e7069 (patch) | |
tree | 956edeca6e0a391a94e6663536ad1728bc170c00 /gtk2_ardour | |
parent | 792df333a2ac2904002affcd311bebd6f65c239a (diff) |
correctly display negative delta values in audio clocks
git-svn-id: svn://localhost/ardour2/branches/3.0@10682 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/audio_clock.cc | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/gtk2_ardour/audio_clock.cc b/gtk2_ardour/audio_clock.cc index dde1c70b71..c424840662 100644 --- a/gtk2_ardour/audio_clock.cc +++ b/gtk2_ardour/audio_clock.cc @@ -777,7 +777,7 @@ AudioClock::set_minsec (framepos_t when, bool force) left -= (framecnt_t) floor (secs * _session->frame_rate()); millisecs = floor (left * 1000.0 / (float) _session->frame_rate()); - snprintf (buf, sizeof (buf), "%02" PRIu32 ":%02" PRIu32 ":%02" PRIu32 ".%03" PRIu32, hrs, mins, secs, millisecs); + snprintf (buf, sizeof (buf), "%02" PRId32 ":%02" PRId32 ":%02" PRId32 ".%03" PRId32, hrs, mins, secs, millisecs); _layout->set_text (buf); } @@ -786,24 +786,31 @@ AudioClock::set_timecode (framepos_t when, bool force) { char buf[32]; Timecode::Time TC; - + bool negative; + if (_off) { _layout->set_text ("\u2012\u2012:\u2012\u2012:\u2012\u2012:\u2012\u2012"); if (_left_layout) { _left_layout->set_text (""); _right_layout->set_text (""); - } +} return; } + negative = when < 0; + + if (negative) { + when = -when; + } + if (is_duration) { _session->timecode_duration (when, TC); } else { _session->timecode_time (when, TC); } - if (TC.negative) { + if (TC.negative || negative) { snprintf (buf, sizeof (buf), "-%02" PRIu32 ":%02" PRIu32 ":%02" PRIu32 ":%02" PRIu32, TC.hours, TC.minutes, TC.seconds, TC.frames); } else { snprintf (buf, sizeof (buf), " %02" PRIu32 ":%02" PRIu32 ":%02" PRIu32 ":%02" PRIu32, TC.hours, TC.minutes, TC.seconds, TC.frames); @@ -829,6 +836,7 @@ AudioClock::set_bbt (framepos_t when, bool force) { char buf[16]; Timecode::BBT_Time BBT; + bool negative; if (_off) { _layout->set_text ("\u2012\u2012|\u2012\u2012|\u2012\u2012\u2012\u2012"); @@ -839,6 +847,12 @@ AudioClock::set_bbt (framepos_t when, bool force) return; } + negative = when < 0; + + if (negative) { + when = -when; + } + /* handle a common case */ if (is_duration) { if (when == 0) { @@ -854,7 +868,12 @@ AudioClock::set_bbt (framepos_t when, bool force) _session->tempo_map().bbt_time (when, BBT); } - snprintf (buf, sizeof (buf), "%02" PRIu32 "|%02" PRIu32 "|%04" PRIu32, BBT.bars, BBT.beats, BBT.ticks); + if (negative) { + snprintf (buf, sizeof (buf), "-%02" PRIu32 "|%02" PRIu32 "|%04" PRIu32, BBT.bars, BBT.beats, BBT.ticks); + } else { + snprintf (buf, sizeof (buf), " %02" PRIu32 "|%02" PRIu32 "|%04" PRIu32, BBT.bars, BBT.beats, BBT.ticks); + } + _layout->set_text (buf); if (_right_layout) { |