Merge remote-tracking branch 'check/next-cc'

untested, probably needs some buildfixing
This commit is contained in:
Stefan Seyfried
2013-12-22 21:25:05 +01:00
67 changed files with 1637 additions and 894 deletions

View File

@@ -1018,6 +1018,7 @@ void CMenuWidget::addIntroItems(neutrino_locale_t subhead_text, neutrino_locale_
{
if (subhead_text != NONEXISTANT_LOCALE)
addItem(new CMenuSeparator(CMenuSeparator::ALIGN_LEFT | CMenuSeparator::SUB_HEAD | CMenuSeparator::STRING, subhead_text));
addItem(GenericMenuSeparator);
if (buttontype != BTN_TYPE_NO)
@@ -1039,7 +1040,7 @@ void CMenuWidget::addIntroItems(neutrino_locale_t subhead_text, neutrino_locale_
if (section_text != NONEXISTANT_LOCALE)
addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, section_text));
else
else if (buttontype != BTN_TYPE_NO)
addItem(GenericMenuSeparatorLine);
}
@@ -1085,7 +1086,7 @@ void CMenuWidget::paintHint(int pos)
if (details_line)
savescreen ? details_line->hide() : details_line->kill();
/* clear info box */
if ((info_box) && (pos == -1))
if ((info_box) && (pos < 0))
savescreen ? info_box->hide(true) : info_box->kill();
hint_painted = false;
}
@@ -1095,8 +1096,10 @@ void CMenuWidget::paintHint(int pos)
CMenuItem* item = items[pos];
if (item->hintIcon.empty() && item->hint == NONEXISTANT_LOCALE) {
if (info_box)
info_box->hide(false);
if (info_box) {
savescreen ? info_box->hide(false) : info_box->kill();
hint_painted = false;
}
return;
}
@@ -1170,6 +1173,7 @@ CMenuOptionNumberChooser::CMenuOptionNumberChooser(const neutrino_locale_t name,
localized_value_name = special_value_name;
optionString = non_localized_name;
numberFormat = "%d";
observ = Observ;
slider_on = sliderOn;
}
@@ -1202,7 +1206,7 @@ int CMenuOptionNumberChooser::paint(bool selected)
if ((localized_value_name == NONEXISTANT_LOCALE) || ((*optionValue) != localized_value))
{
sprintf(option_value, "%d", ((*optionValue) + display_offset));
sprintf(option_value, numberFormat.c_str(), ((*optionValue) + display_offset));
l_option = option_value;
}
else
@@ -1254,6 +1258,12 @@ int CMenuOptionNumberChooser::getWidth(void)
width += (w1 > w2) ? w1 : w2;
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);
}
return width + 10; /* min 10 pixels between option name and value. enough? */
}

View File

@@ -298,6 +298,7 @@ private:
neutrino_locale_t localized_value_name;
bool slider_on;
CChangeObserver * observ;
std::string numberFormat;
public:
CMenuOptionNumberChooser(const neutrino_locale_t name, int * const OptionValue, const bool Active, const int min_value, const int max_value, CChangeObserver * const Observ = NULL, const int print_offset = 0, const int special_value = 0, const neutrino_locale_t special_value_name = NONEXISTANT_LOCALE, const char * non_localized_name = NULL, bool sliderOn = false );
@@ -307,6 +308,7 @@ private:
int exec(CMenuTarget* parent);
int isMenueOptionChooser(void) const{return 1;}
int getWidth(void);
void setNumberFormat(std::string format) { numberFormat = format; }
};
class CMenuOptionChooser : public CAbstractMenuOptionChooser

View File

@@ -135,6 +135,8 @@ CStringInput::~CStringInput()
if(head) {
free(head);
}
g_RCInput->killTimer (smstimer);
}
#define CStringInputSMSButtonsCount 2
@@ -198,6 +200,7 @@ void CStringInput::init()
x = getScreenStartX(width);
y = getScreenStartY(height);
selected = 0;
smstimer = 0;
}
void CStringInput::NormalKeyPressed(const neutrino_msg_t key)
@@ -473,6 +476,12 @@ int CStringInput::exec( CMenuTarget* parent, const std::string & )
if ( msg <= CRCInput::RC_MaxRC )
timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]);
if ((msg == NeutrinoMessages::EVT_TIMER) && (data == smstimer))
msg = CRCInput::RC_right;
if (msg < CRCInput::RC_nokey)
g_RCInput->killTimer (smstimer);
if (msg==CRCInput::RC_left)
{
keyLeftPressed();
@@ -645,7 +654,7 @@ void CStringInput::paint(bool sms)
if (sms)
{
frameBuffer->getIconSize(NEUTRINO_ICON_NUMERIC_PAD, &icol_w, &icol_h);
frameBuffer->paintIcon(NEUTRINO_ICON_NUMERIC_PAD, x + (width/2) - (icol_w/2), tmp_y, 0, COL_MENUCONTENT_TEXT);
frameBuffer->paintIcon(NEUTRINO_ICON_NUMERIC_PAD, x + (width/2) - (icol_w/2), tmp_y, 0, 1, true, true, COL_MENUCONTENT_TEXT);
//buttonbar
::paintButtons(x, y+ hheight+ bheight, width, CStringInputSMSButtonsCount, CStringInputSMSButtons, width, fheight);
@@ -767,6 +776,8 @@ void CStringInputSMS::NormalKeyPressed(const neutrino_msg_t key)
value[selected] = Chars[numericvalue][keyCounter];
last_digit = numericvalue;
paintChar(selected);
g_RCInput->killTimer (smstimer);
smstimer = g_RCInput->addTimer(2*1000*1000);
}
else
{

View File

@@ -51,6 +51,8 @@ class CStringInput : public CMenuTarget
int lower_bound;
int upper_bound;
uint32_t smstimer;
char * head;
neutrino_locale_t name;
neutrino_locale_t hint_1, hint_2;