From 12beb33c57f5bf932e9ce5b3f23dffcfcdff3d4a Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Thu, 12 Nov 2020 17:13:23 +0100 Subject: [PATCH] Cosmetics --- .../thirdparty/libopenui/src/numberedit.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/radio/src/thirdparty/libopenui/src/numberedit.cpp b/radio/src/thirdparty/libopenui/src/numberedit.cpp index 1a0e9e417..ab2b0c0af 100644 --- a/radio/src/thirdparty/libopenui/src/numberedit.cpp +++ b/radio/src/thirdparty/libopenui/src/numberedit.cpp @@ -44,12 +44,22 @@ void NumberEdit::paint(BitmapBuffer * dc) else textColor = DISABLE_COLOR; - if (displayFunction) + if (displayFunction) { displayFunction(dc, textColor, value); - else if (value == 0 && !zeroText.empty()) + } + else if (value == 0 && !zeroText.empty()) { dc->drawText(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, zeroText.c_str(), textColor | textFlags); - else - dc->drawNumber(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, value, textColor | textFlags, 0, prefix.c_str(), suffix.c_str()); + if (textFlags & RIGHT) + dc->drawText(rect.w - FIELD_PADDING_LEFT, FIELD_PADDING_TOP, zeroText.c_str(), textColor | textFlags); + else + dc->drawText(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, zeroText.c_str(), textColor | textFlags); + } + else { + if (textFlags & RIGHT) + dc->drawNumber(rect.w - FIELD_PADDING_LEFT, FIELD_PADDING_TOP, value, textColor | textFlags, 0, prefix.c_str(), suffix.c_str()); + else + dc->drawNumber(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, value, textColor | textFlags, 0, prefix.c_str(), suffix.c_str()); + } } void NumberEdit::onEvent(event_t event)