Waveform length display improvement. Draw waveform texts brighter.

This commit is contained in:
xenakios 2018-02-07 14:52:22 +02:00
parent 28f8aabbf3
commit ccf47720ab
2 changed files with 18 additions and 2 deletions

View File

@ -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) inline String secondsToString(double seconds)
{ {
int64_t durintseconds = seconds; int64_t durintseconds = seconds;

View File

@ -494,9 +494,9 @@ void WaveformComponent::paint(Graphics & g)
double pos = jmap<double>(m_rec_pos, m_view_range.getStart(), m_view_range.getEnd(), 0, getWidth()); double pos = jmap<double>(m_rec_pos, m_view_range.getStart(), m_view_range.getEnd(), 0, getWidth());
g.fillRect((int)pos, m_topmargin, 1, getHeight() - m_topmargin); 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(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() void WaveformComponent::timerCallback()