mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-29 16:31:05 +02:00
remove widest_number definition and usage, add Font::getMaxDigitWidth() method instead
Signed-off-by: M. Liebmann <tuxcode.bbg@gmail.com>
Origin commit data
------------------
Branch: ni/coolstream
Commit: 15b2b2ec05
Author: martii <m4rtii@gmx.de>
Date: 2013-11-29 (Fri, 29 Nov 2013)
------------------
This commit was generated by Migit
This commit is contained in:
@@ -1213,15 +1213,29 @@ int CMenuOptionNumberChooser::getWidth(void)
|
||||
const char * l_optionName = (optionString != NULL) ? optionString : g_Locale->getText(optionName);
|
||||
int width = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(l_optionName, true);
|
||||
|
||||
char tmp[20], *t;
|
||||
int _lower_bound = lower_bound;
|
||||
int _upper_bound = upper_bound;
|
||||
int m = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getMaxDigitWidth();
|
||||
|
||||
snprintf(tmp, sizeof(tmp), "%d", lower_bound);
|
||||
for(t = tmp; *t; t++) if (isdigit((int)*t)) *t = *widest_number;
|
||||
int w1 = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(tmp, true);
|
||||
int w1 = 0;
|
||||
if (_lower_bound < 0) {
|
||||
w1 += g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth("-", true);
|
||||
lower_bound *= -1;
|
||||
}
|
||||
while (_lower_bound > 0) {
|
||||
w1 += m;
|
||||
_lower_bound /= 10;
|
||||
}
|
||||
|
||||
snprintf(tmp, sizeof(tmp), "%d", upper_bound);
|
||||
for(t = tmp; *t; t++) if (isdigit((int)*t)) *t = *widest_number;
|
||||
int w2 = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(tmp, true);
|
||||
int w2 = 0;
|
||||
if (_upper_bound < 0) {
|
||||
w2 += g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth("-", true);
|
||||
_upper_bound *= -1;
|
||||
}
|
||||
while (_upper_bound > 0) {
|
||||
w1 += m;
|
||||
_upper_bound /= 10;
|
||||
}
|
||||
|
||||
width += (w1 > w2) ? w1 : w2;
|
||||
|
||||
|
Reference in New Issue
Block a user