mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-31 17:31:11 +02:00
neutrino: sync keybind and usermenu code with neutrino-mp, code (C) martii
Origin commit data
------------------
Commit: 420af7a4dc
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2014-09-05 (Fri, 05 Sep 2014)
This commit is contained in:
@@ -284,7 +284,7 @@ int ShowHint(const char * const Caption, const char * const Text, const int Widt
|
||||
res = messages_return::handled;
|
||||
break;
|
||||
}
|
||||
else if((msg == CRCInput::RC_next) || (msg == CRCInput::RC_prev)) {
|
||||
else if((msg == (neutrino_msg_t) g_settings.key_switchformat) || (msg == (neutrino_msg_t) g_settings.key_next43mode)) {
|
||||
res = messages_return::cancel_all;
|
||||
g_RCInput->postMsg(msg, data);
|
||||
}
|
||||
|
@@ -64,7 +64,7 @@ public:
|
||||
|
||||
|
||||
|
||||
CKeyChooser::CKeyChooser(int * const Key, const neutrino_locale_t title, const std::string & Icon) : CMenuWidget(title, Icon)
|
||||
CKeyChooser::CKeyChooser(unsigned int * const Key, const neutrino_locale_t title, const std::string & Icon) : CMenuWidget(title, Icon)
|
||||
{
|
||||
frameBuffer = CFrameBuffer::getInstance();
|
||||
key = Key;
|
||||
@@ -76,7 +76,7 @@ CKeyChooser::CKeyChooser(int * const Key, const neutrino_locale_t title, const s
|
||||
addItem(GenericMenuSeparatorLine);
|
||||
addItem(GenericMenuBack);
|
||||
addItem(GenericMenuSeparatorLine);
|
||||
addItem(new CMenuForwarder(LOCALE_KEYCHOOSERMENU_SETNEW , true, NULL, keyChooser));
|
||||
addItem(new CMenuForwarder(LOCALE_KEYCHOOSERMENU_SETNEW, true, NULL, keyChooser));
|
||||
addItem(new CMenuForwarder(LOCALE_KEYCHOOSERMENU_SETNONE, true, NULL, keyDeleter));
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ void CKeyChooser::paint()
|
||||
}
|
||||
|
||||
//*****************************
|
||||
CKeyChooserItem::CKeyChooserItem(const neutrino_locale_t Name, int * Key)
|
||||
CKeyChooserItem::CKeyChooserItem(const neutrino_locale_t Name, unsigned int * Key)
|
||||
{
|
||||
name = Name;
|
||||
key = Key;
|
||||
@@ -117,7 +117,7 @@ int CKeyChooserItem::exec(CMenuTarget* parent, const std::string &)
|
||||
parent->hide();
|
||||
|
||||
paint();
|
||||
|
||||
CFrameBuffer::getInstance()->blit();
|
||||
g_RCInput->clearRCMsg();
|
||||
g_RCInput->setLongPressAny(true);
|
||||
|
||||
@@ -147,6 +147,7 @@ int CKeyChooserItem::exec(CMenuTarget* parent, const std::string &)
|
||||
void CKeyChooserItem::hide()
|
||||
{
|
||||
CFrameBuffer::getInstance()->paintBackgroundBoxRel(x, y, width, height);
|
||||
CFrameBuffer::getInstance()->blit();
|
||||
}
|
||||
|
||||
void CKeyChooserItem::paint()
|
||||
|
@@ -49,13 +49,13 @@ class CKeyChooser : public CMenuWidget
|
||||
{
|
||||
private:
|
||||
CFrameBuffer *frameBuffer;
|
||||
int* key;
|
||||
unsigned int * key;
|
||||
std::string keyName;
|
||||
CKeyChooserItem *keyChooser;
|
||||
CKeyChooserItemNoKey *keyDeleter;
|
||||
|
||||
public:
|
||||
CKeyChooser(int * const Key, const neutrino_locale_t title, const std::string & Icon = "");
|
||||
CKeyChooser(unsigned int * const Key, const neutrino_locale_t title, const std::string & Icon = "");
|
||||
~CKeyChooser();
|
||||
|
||||
void paint();
|
||||
@@ -72,13 +72,13 @@ class CKeyChooserItem : public CMenuTarget
|
||||
int height;
|
||||
|
||||
neutrino_locale_t name;
|
||||
int * key;
|
||||
unsigned int * key;
|
||||
|
||||
void paint();
|
||||
|
||||
public:
|
||||
|
||||
CKeyChooserItem(const neutrino_locale_t Name, int *Key);
|
||||
CKeyChooserItem(const neutrino_locale_t Name, unsigned int *Key);
|
||||
|
||||
void hide();
|
||||
int exec(CMenuTarget* parent, const std::string & actionKey);
|
||||
@@ -87,11 +87,11 @@ class CKeyChooserItem : public CMenuTarget
|
||||
|
||||
class CKeyChooserItemNoKey : public CMenuTarget
|
||||
{
|
||||
int *key;
|
||||
unsigned int * key;
|
||||
|
||||
public:
|
||||
|
||||
CKeyChooserItemNoKey(int *Key)
|
||||
CKeyChooserItemNoKey(unsigned int *Key)
|
||||
{
|
||||
key=Key;
|
||||
};
|
||||
|
@@ -189,10 +189,10 @@ int CListBox::exec(CMenuTarget* parent, const std::string & /*actionKey*/)
|
||||
{
|
||||
loop = false;
|
||||
}
|
||||
else if (msg == CRCInput::RC_up || (int) msg == g_settings.key_channelList_pageup)
|
||||
else if (msg == CRCInput::RC_up || (int) msg == g_settings.key_pageup)
|
||||
{
|
||||
if(getItemCount()!=0) {
|
||||
int step = (msg == (neutrino_msg_t)g_settings.key_channelList_pageup) ? listmaxshow : 1; // browse or step 1
|
||||
int step = (msg == (neutrino_msg_t)g_settings.key_pageup) ? listmaxshow : 1; // browse or step 1
|
||||
int new_selected = selected - step;
|
||||
|
||||
if (new_selected < 0) {
|
||||
@@ -204,10 +204,10 @@ int CListBox::exec(CMenuTarget* parent, const std::string & /*actionKey*/)
|
||||
updateSelection(new_selected);
|
||||
}
|
||||
}
|
||||
else if (msg == CRCInput::RC_down || (int) msg == g_settings.key_channelList_pagedown)
|
||||
else if (msg == CRCInput::RC_down || (int) msg == g_settings.key_pagedown)
|
||||
{
|
||||
if(getItemCount()!=0) {
|
||||
int step = ((int) msg == g_settings.key_channelList_pagedown) ? listmaxshow : 1; // browse or step 1
|
||||
int step = ((int) msg == g_settings.key_pagedown) ? listmaxshow : 1; // browse or step 1
|
||||
int new_selected = selected + step;
|
||||
if (new_selected >= (int) getItemCount()) {
|
||||
if ((getItemCount() - listmaxshow -1 < selected) && (selected != (getItemCount() - 1)) && (step != 1))
|
||||
|
@@ -45,13 +45,11 @@
|
||||
#include <gui/components/cc.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#if ENABLE_LUA
|
||||
extern "C" {
|
||||
#include <lua.h>
|
||||
#include <lauxlib.h>
|
||||
#include <lualib.h>
|
||||
}
|
||||
#endif
|
||||
|
||||
#define NO_WIDGET_ID -1
|
||||
|
||||
@@ -77,12 +75,10 @@ class CChangeObserver
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#if ENABLE_LUA
|
||||
virtual bool changeNotify(lua_State * /*L*/, const std::string & /*luaId*/, const std::string & /*luaAction*/, void * /*Data*/)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
class CMenuTarget
|
||||
@@ -109,11 +105,9 @@ class CMenuItem
|
||||
fb_pixel_t item_color, item_bgcolor;
|
||||
|
||||
void initItemColors(const bool select_mode);
|
||||
#if ENABLE_LUA
|
||||
lua_State *luaState;
|
||||
std::string luaAction;
|
||||
std::string luaId;
|
||||
#endif
|
||||
neutrino_locale_t name;
|
||||
std::string nameString;
|
||||
neutrino_locale_t desc;
|
||||
@@ -176,9 +170,7 @@ class CMenuItem
|
||||
virtual int isMenueOptionChooser(void) const{return 0;}
|
||||
void setHint(const char * const icon, const neutrino_locale_t text) { hintIcon = (icon && *icon) ? icon : NULL; hint = text; }
|
||||
void setHint(const char * const icon, const std::string text) { hintIcon = (icon && *icon) ? icon : NULL; hintText = text; }
|
||||
#if ENABLE_LUA
|
||||
void setLua(lua_State *_luaState, std::string &_luaAction, std::string &_luaId) { luaState = _luaState; luaAction = _luaAction; luaId = _luaId; };
|
||||
#endif
|
||||
virtual const char *getName();
|
||||
virtual void setName(const std::string& text);
|
||||
virtual void setName(const neutrino_locale_t text);
|
||||
|
@@ -32,6 +32,7 @@
|
||||
#include <driver/fontrenderer.h>
|
||||
#include <driver/rcinput.h>
|
||||
#include <driver/screen_max.h>
|
||||
#include <driver/display.h>
|
||||
|
||||
#include <gui/color.h>
|
||||
|
||||
@@ -159,7 +160,7 @@ void CStringInput::NormalKeyPressed(const neutrino_msg_t key)
|
||||
if (selected >= (int)valueString->length())
|
||||
valueString->append(selected - valueString->length() + 1, ' ');
|
||||
valueString->at(selected) = validchars[CRCInput::getNumericValue(key)];
|
||||
int current_value = atoi((*valueString).c_str());
|
||||
int current_value = atoi(*valueString);
|
||||
int tmp = current_value;
|
||||
if (lower_bound != -1 || upper_bound != -1)
|
||||
{
|
||||
@@ -258,7 +259,7 @@ void CStringInput::keyUpPressed()
|
||||
npos = 0;
|
||||
valueString->at(selected)=validchars[npos];
|
||||
|
||||
int current_value = atoi((*valueString).c_str());
|
||||
int current_value = atoi(*valueString);
|
||||
int tmp = current_value;
|
||||
if (lower_bound != -1 || upper_bound != -1)
|
||||
{
|
||||
@@ -294,7 +295,7 @@ void CStringInput::keyDownPressed()
|
||||
npos = strlen(validchars)-1;
|
||||
valueString->at(selected)=validchars[npos];
|
||||
|
||||
int current_value = atoi((*valueString).c_str());
|
||||
int current_value = atoi(*valueString);
|
||||
int tmp = current_value;
|
||||
if (lower_bound != -1 || upper_bound != -1)
|
||||
{
|
||||
@@ -405,6 +406,7 @@ int CStringInput::exec( CMenuTarget* parent, const std::string & )
|
||||
bool loop=true;
|
||||
while (loop)
|
||||
{
|
||||
frameBuffer->blit();
|
||||
if (*valueString != dispval)
|
||||
{
|
||||
CVFD::getInstance()->showMenuText(1,valueString->c_str() , selected+1);
|
||||
@@ -469,10 +471,10 @@ int CStringInput::exec( CMenuTarget* parent, const std::string & )
|
||||
else if (msg==CRCInput::RC_down)
|
||||
{
|
||||
keyDownPressed();
|
||||
} else if (msg==CRCInput::RC_plus)
|
||||
} else if (msg==(neutrino_msg_t)g_settings.key_volumeup)
|
||||
{
|
||||
keyPlusPressed();
|
||||
} else if (msg==CRCInput::RC_minus)
|
||||
} else if (msg==(neutrino_msg_t)g_settings.key_volumedown)
|
||||
{
|
||||
keyMinusPressed();
|
||||
}
|
||||
@@ -516,6 +518,7 @@ int CStringInput::exec( CMenuTarget* parent, const std::string & )
|
||||
{
|
||||
frameBuffer->RestoreScreen(x, y, width + SHADOW_OFFSET, height + SHADOW_OFFSET, pixbuf);
|
||||
delete[] pixbuf;//Mismatching allocation and deallocation: pixbuf
|
||||
frameBuffer->blit();
|
||||
} else
|
||||
hide();
|
||||
|
||||
@@ -536,6 +539,7 @@ int CStringInput::handleOthers(const neutrino_msg_t /*msg*/, const neutrino_msg_
|
||||
void CStringInput::hide()
|
||||
{
|
||||
frameBuffer->paintBackgroundBoxRel(x, y, width + SHADOW_OFFSET, height + SHADOW_OFFSET);
|
||||
frameBuffer->blit();
|
||||
}
|
||||
|
||||
void CStringInput::paint(bool sms)
|
||||
@@ -803,6 +807,7 @@ int CPINInput::exec( CMenuTarget* parent, const std::string & )
|
||||
|
||||
while(loop)
|
||||
{
|
||||
frameBuffer->blit();
|
||||
g_RCInput->getMsg( &msg, &data, 300 );
|
||||
|
||||
if (msg==CRCInput::RC_left)
|
||||
|
@@ -31,6 +31,7 @@
|
||||
#include <driver/fontrenderer.h>
|
||||
#include <driver/rcinput.h>
|
||||
#include <driver/screen_max.h>
|
||||
#include <driver/display.h>
|
||||
|
||||
#include <gui/color.h>
|
||||
|
||||
@@ -66,7 +67,7 @@ void CExtendedInput::Init(void)
|
||||
|
||||
width = frameBuffer->getScreenWidth() / 100 * 45;
|
||||
|
||||
int tmp_w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getRenderWidth(g_Locale->getText(name));
|
||||
int tmp_w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getRenderWidth(g_Locale->getText(name)); // UTF-8
|
||||
width = std::max(width, tmp_w + offset);
|
||||
|
||||
bheight = input_h + 2*offset;
|
||||
@@ -151,6 +152,7 @@ int CExtendedInput::exec( CMenuTarget* parent, const std::string & )
|
||||
std::string oldval = *valueString;
|
||||
std::string dispval = *valueString;
|
||||
paint();
|
||||
frameBuffer->blit();
|
||||
|
||||
uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]);
|
||||
|
||||
@@ -265,6 +267,7 @@ int CExtendedInput::exec( CMenuTarget* parent, const std::string & )
|
||||
*cancel = true;
|
||||
res = menu_return::RETURN_EXIT_ALL;
|
||||
}
|
||||
frameBuffer->blit();
|
||||
}
|
||||
|
||||
hide();
|
||||
@@ -282,6 +285,7 @@ int CExtendedInput::exec( CMenuTarget* parent, const std::string & )
|
||||
void CExtendedInput::hide()
|
||||
{
|
||||
frameBuffer->paintBackgroundBoxRel(x, y, width, height);
|
||||
frameBuffer->blit();
|
||||
}
|
||||
|
||||
void CExtendedInput::paint()
|
||||
@@ -604,7 +608,7 @@ CTimeInput::CTimeInput(const neutrino_locale_t Name, std::string* Value, const n
|
||||
{
|
||||
valueString = Value;
|
||||
frameBuffer = CFrameBuffer::getInstance();
|
||||
#if 0
|
||||
#if 1
|
||||
// As nobody else seems to use this class I feel free to make some minor (and mostly backwards-compatible)
|
||||
// adjustments to make it suitable for movieplayer playtime selection ... --martii
|
||||
|
||||
@@ -688,7 +692,7 @@ void CIntInput::onBeforeExec()
|
||||
|
||||
void CIntInput::onAfterExec()
|
||||
{
|
||||
*myValue = atoi((*valueString).c_str());
|
||||
*myValue = atoi(*valueString);
|
||||
}
|
||||
|
||||
//-----------------------------#################################-------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user