From ccf47720ab16979672b328927e558fcb49314538 Mon Sep 17 00:00:00 2001 From: xenakios Date: Wed, 7 Feb 2018 14:52:22 +0200 Subject: [PATCH] Waveform length display improvement. Draw waveform texts brighter. --- Source/PS_Source/globals.h | 16 ++++++++++++++++ Source/PluginEditor.cpp | 4 ++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Source/PS_Source/globals.h b/Source/PS_Source/globals.h index b139620..e8ab891 100644 --- a/Source/PS_Source/globals.h +++ b/Source/PS_Source/globals.h @@ -207,6 +207,22 @@ inline void callGUI(T* ap, F&& f, bool async) } } +inline String secondsToString2(double secs) +{ + RelativeTime rt(secs); + String result; + result.preallocateBytes(32); + bool empty = true; + if ((int)rt.inHours()>0) + result << String((int)rt.inHours() % 24).paddedLeft('0', empty ? 1 : 2) << ':'; + result << String((int)rt.inMinutes() % 60).paddedLeft('0', 2) << ':'; + result << String((int)rt.inSeconds() % 60).paddedLeft('0', 2); + auto millis = (int)rt.inMilliseconds() % 1000; + if (millis > 0) + result << '.' << String(millis).paddedLeft('0', 3); + return result.trimEnd(); +} + inline String secondsToString(double seconds) { int64_t durintseconds = seconds; diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp index c98a518..4b7c6ff 100644 --- a/Source/PluginEditor.cpp +++ b/Source/PluginEditor.cpp @@ -494,9 +494,9 @@ void WaveformComponent::paint(Graphics & g) double pos = jmap(m_rec_pos, m_view_range.getStart(), m_view_range.getEnd(), 0, getWidth()); g.fillRect((int)pos, m_topmargin, 1, getHeight() - m_topmargin); } - g.setColour(Colours::aqua.darker()); + g.setColour(Colours::aqua); g.drawText(GetFileCallback().getFileName(), 2, m_topmargin + 2, getWidth(), 20, Justification::topLeft); - g.drawText(secondsToString(thumblen), getWidth() - 200, m_topmargin + 2, 200, 20, Justification::topRight); + g.drawText(secondsToString2(thumblen), getWidth() - 200, m_topmargin + 2, 200, 20, Justification::topRight); } void WaveformComponent::timerCallback()