Merge branch 'master' into pu/moviebrowser

Origin commit data
------------------
Commit: 1fc717f56f
Author: vanhofen <vanhofen@gmx.de>
Date: 2016-10-29 (Sat, 29 Oct 2016)
This commit is contained in:
vanhofen
2016-10-29 12:26:05 +02:00
10 changed files with 71 additions and 20 deletions

View File

@@ -199,6 +199,8 @@ CKeyboardInput::CKeyboardInput(const neutrino_locale_t Name, std::string* Value,
caps = 0;
srow = scol = 0;
focus = FOCUS_STRING;
force_saveScreen = false;
pixBuf = NULL;
}
CKeyboardInput::CKeyboardInput(const std::string &Name, std::string *Value, int Size, CChangeObserver* Observ, const char * const Icon, const neutrino_locale_t Hint_1, const neutrino_locale_t Hint_2)
@@ -221,6 +223,8 @@ CKeyboardInput::CKeyboardInput(const std::string &Name, std::string *Value, int
caps = 0;
srow = scol = 0;
focus = FOCUS_STRING;
force_saveScreen = false;
pixBuf = NULL;
}
CKeyboardInput::CKeyboardInput(const std::string &Name, std::string *Value, int Size, CChangeObserver* Observ, const char * const Icon, std::string HintText_1, std::string HintText_2)
@@ -243,6 +247,8 @@ CKeyboardInput::CKeyboardInput(const std::string &Name, std::string *Value, int
caps = 0;
srow = scol = 0;
focus = FOCUS_STRING;
force_saveScreen = false;
pixBuf = NULL;
}
CKeyboardInput::~CKeyboardInput()
@@ -515,6 +521,15 @@ std::string &CKeyboardInput::getValue(void)
return *valueString;
}
void CKeyboardInput::forceSaveScreen(bool enable)
{
force_saveScreen = enable;
if (!enable && pixBuf) {
delete[] pixBuf;
pixBuf = NULL;
}
}
int CKeyboardInput::exec(CMenuTarget* parent, const std::string &)
{
neutrino_msg_t msg;
@@ -528,11 +543,12 @@ int CKeyboardInput::exec(CMenuTarget* parent, const std::string &)
std::string oldval = *valueString;
fb_pixel_t * pixbuf = NULL;
if (!parent) {
pixbuf = new fb_pixel_t[(width + OFFSET_SHADOW) * (height + OFFSET_SHADOW)];
if (pixbuf)
frameBuffer->SaveScreen(x, y, width + OFFSET_SHADOW, height + OFFSET_SHADOW, pixbuf);
if (pixBuf)
delete[] pixBuf;
if (!parent || force_saveScreen) {
pixBuf = new fb_pixel_t[(width + OFFSET_SHADOW) * (height + OFFSET_SHADOW)];
if (pixBuf)
frameBuffer->SaveScreen(x, y, width + OFFSET_SHADOW, height + OFFSET_SHADOW, pixBuf);
}
paint();
@@ -624,10 +640,12 @@ int CKeyboardInput::exec(CMenuTarget* parent, const std::string &)
}
}
if (pixbuf)
if (pixBuf)
{
frameBuffer->RestoreScreen(x, y, width + OFFSET_SHADOW, height + OFFSET_SHADOW, pixbuf);
delete[] pixbuf;
frameBuffer->RestoreScreen(x, y, width + OFFSET_SHADOW, height + OFFSET_SHADOW, pixBuf);
delete[] pixBuf;
pixBuf = NULL;
frameBuffer->blit();
} else
hide();

View File

@@ -101,6 +101,8 @@ class CKeyboardInput : public CMenuTarget
int selected;
bool changed;
CChangeObserver * observ;
bool force_saveScreen;
fb_pixel_t *pixBuf;
virtual void init();
@@ -133,6 +135,8 @@ class CKeyboardInput : public CMenuTarget
void hide();
int exec( CMenuTarget* parent, const std::string & actionKey );
virtual std::string &getValue(void);
void forceSaveScreen(bool enable);
};
#endif

View File

@@ -150,6 +150,8 @@ void CStringInput::init()
y = getScreenStartY(height);
selected = 0;
smstimer = 0;
force_saveScreen = false;
pixBuf = NULL;
}
void CStringInput::NormalKeyPressed(const neutrino_msg_t key)
@@ -377,6 +379,15 @@ std::string &CStringInput::getValue(void)
return *valueString;
}
void CStringInput::forceSaveScreen(bool enable)
{
force_saveScreen = enable;
if (!enable && pixBuf) {
delete[] pixBuf;
pixBuf = NULL;
}
}
int CStringInput::exec( CMenuTarget* parent, const std::string & )
{
neutrino_msg_t msg;
@@ -392,11 +403,12 @@ int CStringInput::exec( CMenuTarget* parent, const std::string & )
if (size > (int) valueString->length())
valueString->append(size - valueString->length(), ' ');
fb_pixel_t * pixbuf = NULL;
if (!parent) {
pixbuf = new fb_pixel_t[(width + OFFSET_SHADOW) * (height + OFFSET_SHADOW)];
if (pixbuf)
frameBuffer->SaveScreen(x, y, width + OFFSET_SHADOW, height + OFFSET_SHADOW, pixbuf);
if (pixBuf)
delete[] pixBuf;
if (!parent || force_saveScreen) {
pixBuf = new fb_pixel_t[(width + OFFSET_SHADOW) * (height + OFFSET_SHADOW)];
if (pixBuf)
frameBuffer->SaveScreen(x, y, width + OFFSET_SHADOW, height + OFFSET_SHADOW, pixBuf);
}
paint();
@@ -517,10 +529,11 @@ int CStringInput::exec( CMenuTarget* parent, const std::string & )
}
}
if (pixbuf)
if (pixBuf)
{
frameBuffer->RestoreScreen(x, y, width + OFFSET_SHADOW, height + OFFSET_SHADOW, pixbuf);
delete[] pixbuf;//Mismatching allocation and deallocation: pixbuf
frameBuffer->RestoreScreen(x, y, width + OFFSET_SHADOW, height + OFFSET_SHADOW, pixBuf);
delete[] pixBuf;
pixBuf = NULL;
frameBuffer->blit();
} else
hide();

View File

@@ -61,6 +61,8 @@ class CStringInput : public CMenuTarget
int size;
int selected;
CChangeObserver * observ;
bool force_saveScreen;
fb_pixel_t *pixBuf;
virtual void init();
@@ -91,6 +93,8 @@ class CStringInput : public CMenuTarget
int exec( CMenuTarget* parent, const std::string & actionKey );
void setMinMax(const int min_value, const int max_value);
virtual std::string &getValue(void);
void forceSaveScreen(bool enable);
};
class CStringInputSMS : public CStringInput