summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2018-10-05 14:14:51 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2018-10-05 14:15:02 -0400
commite28f96ae7343c798f338eb07be77a064fc145bfe (patch)
tree049ef3e562fd6009e3e9b816b8f585c7934d8664
parentf0a395e7cdbe210823c2732d0d15d8cbe76d3cc7 (diff)
tweak up display of "time since last msg" for transport masters
-rw-r--r--gtk2_ardour/transport_masters_dialog.cc21
1 files changed, 18 insertions, 3 deletions
diff --git a/gtk2_ardour/transport_masters_dialog.cc b/gtk2_ardour/transport_masters_dialog.cc
index ae84ec4639..2c74dbe458 100644
--- a/gtk2_ardour/transport_masters_dialog.cc
+++ b/gtk2_ardour/transport_masters_dialog.cc
@@ -473,11 +473,17 @@ TransportMastersWidget::Row::update (Session* s, samplepos_t now)
last.set_text ("");
}
current.set_text (Timecode::timecode_format_time (t));
- timestamp.set_markup (tm->position_string());
delta.set_markup (tm->delta_string ());
char gap[32];
- snprintf (gap, sizeof (gap), "%.3fs", (when - now) / (float) AudioEngine::instance()->sample_rate());
+ const float seconds = (when - now) / (float) AudioEngine::instance()->sample_rate();
+ if (abs (seconds) < 1.0) {
+ snprintf (gap, sizeof (gap), "%.3fs", seconds);
+ } else if (abs (seconds) < 4.0) {
+ snprintf (gap, sizeof (gap), "%ds", (int) floor (seconds));
+ } else {
+ snprintf (gap, sizeof (gap), "%s", _(">4s ago"));
+ }
timestamp.set_text (gap);
save_when = when;
@@ -486,10 +492,19 @@ TransportMastersWidget::Row::update (Session* s, samplepos_t now)
if (save_when) {
char gap[32];
- snprintf (gap, sizeof (gap), "%.3fs", (save_when - now) / (float) AudioEngine::instance()->sample_rate());
+ const float seconds = (when - now) / (float) AudioEngine::instance()->sample_rate();
+ if (abs (seconds) < 1.0) {
+ snprintf (gap, sizeof (gap), "%.3fs", seconds);
+ } else if (abs (seconds) < 4.0) {
+ snprintf (gap, sizeof (gap), "%ds", (int) floor (seconds));
+ } else {
+ snprintf (gap, sizeof (gap), "%s", _(">4s ago"));
+ }
timestamp.set_text (gap);
save_when = when;
}
+ delta.set_text ("");
+ current.set_text ("");
}
}
}