Revert "CMenuOptionNumberChooser: expand localize functionality for any number"

This reverts commit 1a68428f80 because of many
bothering compiler warnings:
extended initializer lists only available with -std=c++11 or -std=gnu++11


Origin commit data
------------------
Commit: adb80290ba
Author: vanhofen <vanhofen@gmx.de>
Date: 2018-04-04 (Wed, 04 Apr 2018)
This commit is contained in:
vanhofen
2018-04-04 23:12:16 +02:00
parent 1a68428f80
commit 952c6a58f2
4 changed files with 20 additions and 28 deletions

View File

@@ -1118,12 +1118,12 @@ void COsdSetup::showOsdTimeoutSetup(CMenuWidget* menu_timeout)
std::string nf("%d ");
nf += g_Locale->getText(LOCALE_UNIT_SHORT_SECOND);
for (int i = 0; i < SNeutrinoSettings::TIMING_SETTING_COUNT; i++)
{
CMenuOptionNumberChooser *ch = new CMenuOptionNumberChooser(timing_setting[i].name, &g_settings.timing[i], true, 0, 240);
ch->setNumberFormat(nf);
ch->setLocalizedValue(0, LOCALE_OPTIONS_OFF);
ch->setLocalizedValue(0);
ch->setLocalizedValueName(LOCALE_OPTIONS_OFF);
ch->setHint("", timing_setting[i].hint);
menu_timeout->addItem(ch);
}

View File

@@ -172,7 +172,8 @@ int CVfdSetup::showSetup()
{
// allow to set scroll_repeats
CMenuOptionNumberChooser * nc = new CMenuOptionNumberChooser(LOCALE_LCDMENU_SCROLL_REPEATS, &g_settings.lcd_scroll, vfd_enabled, 0, 999, this);
nc->setLocalizedValue(0, LOCALE_OPTIONS_OFF);
nc->setLocalizedValue(0);
nc->setLocalizedValueName(LOCALE_OPTIONS_OFF);
nc->setHint("", LOCALE_MENU_HINT_VFD_SCROLL);
vfds->addItem(nc);
}

View File

@@ -1644,7 +1644,8 @@ void CMenuOptionNumberChooser::init( const neutrino_locale_t& lName,
lower_bound = min_value;
upper_bound = max_value;
display_offset = print_offset;
setLocalizedValue (special_value, special_value_name);
localized_value = special_value;
localized_value_name = special_value_name;
observ = Observ;
slider_on = sliderOn;
@@ -1708,9 +1709,7 @@ int CMenuOptionNumberChooser::paint(bool selected)
const char * l_option;
char option_value[40];
for (size_t i = 0; i < localized.size(); i++)
{
if ((localized[i].value_name == NONEXISTANT_LOCALE) || ((*optionValue) != localized[i].value))
if ((localized_value_name == NONEXISTANT_LOCALE) || ((*optionValue) != localized_value))
{
if (numberFormatFunction) {
std::string s = numberFormatFunction(*optionValue + display_offset);
@@ -1720,11 +1719,7 @@ int CMenuOptionNumberChooser::paint(bool selected)
l_option = option_value;
}
else
{
l_option = g_Locale->getText(localized[i].value_name);
break;
}
}
l_option = g_Locale->getText(localized_value_name);
//paint item
prepareItem(selected, height);

View File

@@ -326,13 +326,8 @@ private:
int display_offset;
typedef struct localized_value_t
{
int value;
neutrino_locale_t value_name;
} localized_value_struct_t;
std::vector<localized_value_t> localized;
int localized_value;
neutrino_locale_t localized_value_name;
bool slider_on;
bool numeric_input;
CChangeObserver * observ;
@@ -370,7 +365,8 @@ private:
void setNumberFormat(std::string format) { numberFormat = format; }
void setNumberFormat(std::string (*fun)(int)) { numberFormatFunction = fun; }
void setNumericInput(bool _numeric_input) { numeric_input = _numeric_input; }
void setLocalizedValue(int special_value, neutrino_locale_t special_value_name) { localized.push_back({special_value, special_value_name}); }
void setLocalizedValue(int special_value) { localized_value = special_value; }
void setLocalizedValueName(neutrino_locale_t special_value_name) { localized_value_name = special_value_name; }
};
class CMenuOptionChooserOptions