mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-27 15:32:59 +02:00
gui/scan_setup: show unit for motor speed
This commit is contained in:
@@ -1159,6 +1159,7 @@ CMenuOptionNumberChooser::CMenuOptionNumberChooser(const neutrino_locale_t name,
|
||||
|
||||
optionString = non_localized_name;
|
||||
numberFormat = "%d";
|
||||
numberFormatFunction = NULL;
|
||||
observ = Observ;
|
||||
slider_on = sliderOn;
|
||||
}
|
||||
@@ -1187,11 +1188,15 @@ int CMenuOptionNumberChooser::exec(CMenuTarget*)
|
||||
int CMenuOptionNumberChooser::paint(bool selected)
|
||||
{
|
||||
const char * l_option;
|
||||
char option_value[11];
|
||||
char option_value[40];
|
||||
|
||||
if ((localized_value_name == NONEXISTANT_LOCALE) || ((*optionValue) != localized_value))
|
||||
{
|
||||
sprintf(option_value, numberFormat.c_str(), ((*optionValue) + display_offset));
|
||||
if (numberFormatFunction) {
|
||||
std::string s = numberFormatFunction(*optionValue + display_offset);
|
||||
strncpy(option_value, s.c_str(), s.length());
|
||||
} else
|
||||
sprintf(option_value, numberFormat.c_str(), *optionValue + display_offset);
|
||||
l_option = option_value;
|
||||
}
|
||||
else
|
||||
@@ -1243,7 +1248,10 @@ int CMenuOptionNumberChooser::getWidth(void)
|
||||
|
||||
width += (w1 > w2) ? w1 : w2;
|
||||
|
||||
if (numberFormat != "%d") {
|
||||
if (numberFormatFunction) {
|
||||
std::string s = numberFormatFunction(0);
|
||||
width += g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(s.c_str(), true) - g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth("0", true); // arbitrary
|
||||
} else if (numberFormat != "%d") {
|
||||
char format[numberFormat.length()];
|
||||
snprintf(format, numberFormat.length(), numberFormat.c_str(), 0);
|
||||
width += g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(format, true) - g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth("0", true);
|
||||
|
Reference in New Issue
Block a user