From e28f96ae7343c798f338eb07be77a064fc145bfe Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 5 Oct 2018 14:14:51 -0400 Subject: tweak up display of "time since last msg" for transport masters --- gtk2_ardour/transport_masters_dialog.cc | 21 ++++++++++++++++++--- 1 file 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 (""); } } } -- cgit v1.2.3