From e7b27fcbba01c7002c2fbfe7239a0f488c813fc1 Mon Sep 17 00:00:00 2001 From: martii Date: Sun, 8 Dec 2013 10:36:22 +0100 Subject: [PATCH] gui/bedit/bouqueteditor: use Font::getMaxDigitWidth() Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/4dcc804a39630b1480185534f352c741fa049aa6 Author: martii Date: 2013-12-08 (Sun, 08 Dec 2013) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/bedit/bouqueteditor_channels.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/gui/bedit/bouqueteditor_channels.cpp b/src/gui/bedit/bouqueteditor_channels.cpp index 9b87c2a3b..fa2c3d9a4 100644 --- a/src/gui/bedit/bouqueteditor_channels.cpp +++ b/src/gui/bedit/bouqueteditor_channels.cpp @@ -139,16 +139,12 @@ void CBEChannelWidget::paint() liststart = (selected/listmaxshow)*listmaxshow; int lastnum = liststart + listmaxshow; - if(lastnum<10) - numwidth = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->getRenderWidth("0"); - else if(lastnum<100) - numwidth = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->getRenderWidth("00"); - else if(lastnum<1000) - numwidth = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->getRenderWidth("000"); - else if(lastnum<10000) - numwidth = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->getRenderWidth("0000"); - else // if(lastnum<100000) - numwidth = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->getRenderWidth("00000"); + int maxDigitWidth = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->getMaxDigitWidth(); + int _lastnum = lastnum; + while (_lastnum) { + numwidth += maxDigitWidth; + _lastnum /= 10; + } for(unsigned int count=0;count