mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 16:31:11 +02:00
- stringinput: rework dialogs
* fix diplay with all fontsizefactors * dynamical height/width/position of dialogs * dynamical height of buttonbar
This commit is contained in:
@@ -4,13 +4,6 @@
|
|||||||
Copyright (C) 2001 Steffen Hehn 'McClean'
|
Copyright (C) 2001 Steffen Hehn 'McClean'
|
||||||
Homepage: http://dbox.cyberphoria.org/
|
Homepage: http://dbox.cyberphoria.org/
|
||||||
|
|
||||||
Kommentar:
|
|
||||||
|
|
||||||
Diese GUI wurde von Grund auf neu programmiert und sollte nun vom
|
|
||||||
Aufbau und auch den Ausbaumoeglichkeiten gut aussehen. Neutrino basiert
|
|
||||||
auf der Client-Server Idee, diese GUI ist also von der direkten DBox-
|
|
||||||
Steuerung getrennt. Diese wird dann von Daemons uebernommen.
|
|
||||||
|
|
||||||
|
|
||||||
License: GPL
|
License: GPL
|
||||||
|
|
||||||
@@ -50,7 +43,6 @@
|
|||||||
|
|
||||||
CStringInput::CStringInput(const neutrino_locale_t Name, char* Value, const int min_value, const int max_value, int Size, const neutrino_locale_t Hint_1, const neutrino_locale_t Hint_2, const char * const Valid_Chars, CChangeObserver* Observ, const char * const Icon)
|
CStringInput::CStringInput(const neutrino_locale_t Name, char* Value, const int min_value, const int max_value, int Size, const neutrino_locale_t Hint_1, const neutrino_locale_t Hint_2, const char * const Valid_Chars, CChangeObserver* Observ, const char * const Icon)
|
||||||
{
|
{
|
||||||
frameBuffer = CFrameBuffer::getInstance();
|
|
||||||
name = Name;
|
name = Name;
|
||||||
head = NULL;
|
head = NULL;
|
||||||
value = Value;
|
value = Value;
|
||||||
@@ -70,7 +62,6 @@ CStringInput::CStringInput(const neutrino_locale_t Name, char* Value, const int
|
|||||||
|
|
||||||
CStringInput::CStringInput(const neutrino_locale_t Name, char* Value, int Size, const neutrino_locale_t Hint_1, const neutrino_locale_t Hint_2, const char * const Valid_Chars, CChangeObserver* Observ, const char * const Icon)
|
CStringInput::CStringInput(const neutrino_locale_t Name, char* Value, int Size, const neutrino_locale_t Hint_1, const neutrino_locale_t Hint_2, const char * const Valid_Chars, CChangeObserver* Observ, const char * const Icon)
|
||||||
{
|
{
|
||||||
frameBuffer = CFrameBuffer::getInstance();
|
|
||||||
name = Name;
|
name = Name;
|
||||||
head = NULL;
|
head = NULL;
|
||||||
value = Value;
|
value = Value;
|
||||||
@@ -91,7 +82,6 @@ CStringInput::CStringInput(const neutrino_locale_t Name, char* Value, int Size,
|
|||||||
|
|
||||||
CStringInput::CStringInput(const neutrino_locale_t Name, std::string* Value, int Size, const neutrino_locale_t Hint_1, const neutrino_locale_t Hint_2, const char * const Valid_Chars, CChangeObserver* Observ, const char * const Icon)
|
CStringInput::CStringInput(const neutrino_locale_t Name, std::string* Value, int Size, const neutrino_locale_t Hint_1, const neutrino_locale_t Hint_2, const char * const Valid_Chars, CChangeObserver* Observ, const char * const Icon)
|
||||||
{
|
{
|
||||||
frameBuffer = CFrameBuffer::getInstance();
|
|
||||||
name = Name;
|
name = Name;
|
||||||
head = NULL;
|
head = NULL;
|
||||||
value = new char[Size+1];
|
value = new char[Size+1];
|
||||||
@@ -113,7 +103,6 @@ CStringInput::CStringInput(const neutrino_locale_t Name, std::string* Value, int
|
|||||||
|
|
||||||
CStringInput::CStringInput(char * Head, char* Value, int Size, const neutrino_locale_t Hint_1, const neutrino_locale_t Hint_2, const char * const Valid_Chars, CChangeObserver* Observ, const char * const Icon)
|
CStringInput::CStringInput(char * Head, char* Value, int Size, const neutrino_locale_t Hint_1, const neutrino_locale_t Hint_2, const char * const Valid_Chars, CChangeObserver* Observ, const char * const Icon)
|
||||||
{
|
{
|
||||||
frameBuffer = CFrameBuffer::getInstance();
|
|
||||||
head = strdup(Head);
|
head = strdup(Head);
|
||||||
value = Value;
|
value = Value;
|
||||||
valueString = NULL;
|
valueString = NULL;
|
||||||
@@ -141,46 +130,63 @@ CStringInput::~CStringInput()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define CStringInputSMSButtonsCount 2
|
||||||
|
const struct button_label CStringInputSMSButtons[CStringInputSMSButtonsCount] =
|
||||||
|
{
|
||||||
|
{ NEUTRINO_ICON_BUTTON_RED , LOCALE_STRINGINPUT_CAPS },
|
||||||
|
{ NEUTRINO_ICON_BUTTON_YELLOW, LOCALE_STRINGINPUT_CLEAR }
|
||||||
|
};
|
||||||
|
|
||||||
void CStringInput::init()
|
void CStringInput::init()
|
||||||
{
|
{
|
||||||
width = (size*20)+40;
|
frameBuffer = CFrameBuffer::getInstance();
|
||||||
|
|
||||||
if (width<420)
|
|
||||||
width = 420;
|
|
||||||
|
|
||||||
int neededWidth;
|
|
||||||
if(head) {
|
|
||||||
neededWidth = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getRenderWidth(head, true); // UTF-8
|
|
||||||
}
|
|
||||||
else
|
|
||||||
neededWidth = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getRenderWidth(g_Locale->getText(name), true); // UTF-8
|
|
||||||
|
|
||||||
if (!(iconfile.empty()))
|
|
||||||
neededWidth += 28;
|
|
||||||
if (neededWidth+20> width)
|
|
||||||
width = neededWidth+20;
|
|
||||||
|
|
||||||
hheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight();
|
hheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight();
|
||||||
|
iheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_INFO]->getHeight();
|
||||||
|
fheight = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight() + 6; // init min buttonbar height
|
||||||
|
input_h = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight() + 2; // font height + border
|
||||||
|
input_w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth("M") + 2; // hack font width + border
|
||||||
|
offset = 20;
|
||||||
|
|
||||||
|
width = std::max(size*input_w + 2*offset, (int) frameBuffer->getScreenWidth() / 100 * 45);
|
||||||
|
|
||||||
|
int tmp_w = 0;
|
||||||
|
if (head)
|
||||||
|
tmp_w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getRenderWidth(head, true); // UTF-8
|
||||||
|
else
|
||||||
|
tmp_w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getRenderWidth(g_Locale->getText(name), true); // UTF-8
|
||||||
|
|
||||||
if (!(iconfile.empty()))
|
if (!(iconfile.empty()))
|
||||||
{
|
{
|
||||||
int icol_w, icol_h;
|
int icol_w, icol_h;
|
||||||
frameBuffer->getIconSize(iconfile.c_str(), &icol_w, &icol_h);
|
frameBuffer->getIconSize(iconfile.c_str(), &icol_w, &icol_h);
|
||||||
hheight = std::max(hheight, icol_h+4);
|
hheight = std::max(hheight, icol_h + (offset/4));
|
||||||
|
tmp_w += icol_w + (offset/2);
|
||||||
}
|
}
|
||||||
mheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight();
|
width = std::max(width, tmp_w + offset);
|
||||||
iheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_INFO]->getHeight();
|
|
||||||
//footerHeight = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight()+8; //initial height value for buttonbar
|
bheight = input_h + 2*offset;
|
||||||
height = hheight+ mheight + 50;
|
if ((hint_1 != NONEXISTANT_LOCALE) || (hint_2 != NONEXISTANT_LOCALE))
|
||||||
if (hint_1 != NONEXISTANT_LOCALE)
|
|
||||||
{
|
{
|
||||||
height += iheight;
|
if (hint_1 != NONEXISTANT_LOCALE)
|
||||||
|
{
|
||||||
|
tmp_w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_INFO]->getRenderWidth(g_Locale->getText(hint_1), true);
|
||||||
|
width = std::max(width, tmp_w + 2*offset);
|
||||||
|
bheight += iheight;
|
||||||
|
}
|
||||||
if (hint_2 != NONEXISTANT_LOCALE)
|
if (hint_2 != NONEXISTANT_LOCALE)
|
||||||
height += iheight;
|
{
|
||||||
|
tmp_w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_INFO]->getRenderWidth(g_Locale->getText(hint_2), true);
|
||||||
|
width = std::max(width, tmp_w + 2*offset);
|
||||||
|
bheight += iheight;
|
||||||
|
}
|
||||||
|
bheight += offset;
|
||||||
}
|
}
|
||||||
height += g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight()+6; //buttonbar;
|
|
||||||
|
height = hheight+ bheight; // space for the possible numpad and the buttonbar will be added in initSMS()
|
||||||
|
|
||||||
x = frameBuffer->getScreenX() + ((frameBuffer->getScreenWidth() - width)>>1);
|
x = getScreenStartX(width);
|
||||||
y = frameBuffer->getScreenY() + ((frameBuffer->getScreenHeight()-height)>>1);
|
y = getScreenStartY(height);
|
||||||
selected = 0;
|
selected = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -382,8 +388,7 @@ int CStringInput::exec( CMenuTarget* parent, const std::string & )
|
|||||||
|
|
||||||
paint();
|
paint();
|
||||||
|
|
||||||
uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings
|
uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]);
|
||||||
::TIMING_MENU]);
|
|
||||||
|
|
||||||
bool loop=true;
|
bool loop=true;
|
||||||
while (loop)
|
while (loop)
|
||||||
@@ -398,8 +403,7 @@ int CStringInput::exec( CMenuTarget* parent, const std::string & )
|
|||||||
g_RCInput->getMsgAbsoluteTimeout(&msg, &data, &timeoutEnd, true );
|
g_RCInput->getMsgAbsoluteTimeout(&msg, &data, &timeoutEnd, true );
|
||||||
|
|
||||||
if ( msg <= CRCInput::RC_MaxRC )
|
if ( msg <= CRCInput::RC_MaxRC )
|
||||||
timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings
|
timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]);
|
||||||
::TIMING_MENU]);
|
|
||||||
|
|
||||||
if (msg==CRCInput::RC_left)
|
if (msg==CRCInput::RC_left)
|
||||||
{
|
{
|
||||||
@@ -525,58 +529,64 @@ int CStringInput::handleOthers(const neutrino_msg_t /*msg*/, const neutrino_msg_
|
|||||||
|
|
||||||
void CStringInput::hide()
|
void CStringInput::hide()
|
||||||
{
|
{
|
||||||
frameBuffer->paintBackgroundBoxRel(x, y, width, height + hheight);
|
frameBuffer->paintBackgroundBoxRel(x, y, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * CStringInput::getHint1(void)
|
void CStringInput::paint(bool sms)
|
||||||
{
|
{
|
||||||
return g_Locale->getText(hint_1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CStringInput::paint(bool buttons)
|
|
||||||
{
|
|
||||||
int iconoffset;
|
|
||||||
int icol_w, icol_h;
|
|
||||||
int radius;
|
|
||||||
|
|
||||||
/* if there's a button bar below the stringinput (SMS), no rounded corners */
|
|
||||||
if (buttons)
|
|
||||||
radius = 0;
|
|
||||||
else
|
|
||||||
radius = RADIUS_LARGE;
|
|
||||||
|
|
||||||
frameBuffer->paintBoxRel(x, y, width, hheight, COL_MENUHEAD_PLUS_0, RADIUS_LARGE, CORNER_TOP); //round
|
frameBuffer->paintBoxRel(x, y, width, hheight, COL_MENUHEAD_PLUS_0, RADIUS_LARGE, CORNER_TOP); //round
|
||||||
frameBuffer->paintBoxRel(x, y + hheight, width, height - hheight, COL_MENUCONTENT_PLUS_0, radius, CORNER_BOTTOM);
|
frameBuffer->paintBoxRel(x, y + hheight, width, bheight, COL_MENUCONTENT_PLUS_0, sms ? 0 : RADIUS_LARGE, CORNER_BOTTOM);
|
||||||
|
|
||||||
|
int icol_w = 0, icol_h = 0, icol_o = 0;
|
||||||
if (!(iconfile.empty()))
|
if (!(iconfile.empty()))
|
||||||
{
|
{
|
||||||
frameBuffer->getIconSize(iconfile.c_str(), &icol_w, &icol_h);
|
frameBuffer->getIconSize(iconfile.c_str(), &icol_w, &icol_h);
|
||||||
frameBuffer->paintIcon(iconfile, x + 8, y, hheight);
|
frameBuffer->paintIcon(iconfile, x + (offset/2), y, hheight);
|
||||||
iconoffset = icol_w + 10;
|
icol_o = icol_w + (offset/2);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
iconoffset = 0;
|
|
||||||
|
|
||||||
g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->RenderString(x+ 10+ iconoffset, y+ hheight, width- 10- iconoffset, head ? head : g_Locale->getText(name), COL_MENUHEAD, 0, true); // UTF-8
|
g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->RenderString(x+ (offset/2)+ icol_o, y+ hheight, width- (offset/2)- icol_o, head ? head : g_Locale->getText(name), COL_MENUHEAD, 0, true); // UTF-8
|
||||||
|
|
||||||
if (hint_1 != NONEXISTANT_LOCALE)
|
int tmp_y = y+ hheight+ offset+ input_h+ offset;
|
||||||
|
if ((hint_1 != NONEXISTANT_LOCALE) || (hint_2 != NONEXISTANT_LOCALE))
|
||||||
{
|
{
|
||||||
g_Font[SNeutrinoSettings::FONT_TYPE_MENU_INFO]->RenderString(x+ 20, y+ hheight+ mheight+ iheight+ 40, width- 20, getHint1(), COL_MENUCONTENT, 0, true); // UTF-8
|
if (hint_1 != NONEXISTANT_LOCALE)
|
||||||
|
{
|
||||||
|
tmp_y += iheight;
|
||||||
|
g_Font[SNeutrinoSettings::FONT_TYPE_MENU_INFO]->RenderString(x+ offset, tmp_y, width- 2*offset, g_Locale->getText(hint_1), COL_MENUCONTENT, 0, true); // UTF-8
|
||||||
|
}
|
||||||
if (hint_2 != NONEXISTANT_LOCALE)
|
if (hint_2 != NONEXISTANT_LOCALE)
|
||||||
g_Font[SNeutrinoSettings::FONT_TYPE_MENU_INFO]->RenderString(x+ 20, y+ hheight+ mheight+ iheight* 2+ 40, width- 20, g_Locale->getText(hint_2), COL_MENUCONTENT, 0, true); // UTF-8
|
{
|
||||||
|
tmp_y += iheight;
|
||||||
|
g_Font[SNeutrinoSettings::FONT_TYPE_MENU_INFO]->RenderString(x+ offset, tmp_y, width- 2*offset, g_Locale->getText(hint_2), COL_MENUCONTENT, 0, true); // UTF-8
|
||||||
|
}
|
||||||
|
tmp_y += offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
icol_w = icol_h = 0;
|
||||||
|
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);
|
||||||
|
|
||||||
|
//buttonbar
|
||||||
|
::paintButtons(x, y+ hheight+ bheight, width, CStringInputSMSButtonsCount, CStringInputSMSButtons, fheight);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int count=0;count<size;count++)
|
for (int count=0;count<size;count++)
|
||||||
paintChar(count);
|
paintChar(count);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CStringInput::paintChar(int pos)
|
||||||
|
{
|
||||||
|
if(pos<(int)strlen(value))
|
||||||
|
paintChar(pos, value[pos]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CStringInput::paintChar(int pos, const char c)
|
void CStringInput::paintChar(int pos, const char c)
|
||||||
{
|
{
|
||||||
const int xs = 20;
|
int xpos = x+ offset+ pos* input_w;
|
||||||
int ys = mheight;
|
int ypos = y+ hheight+ offset;
|
||||||
int xpos = x+ 20+ pos* xs;
|
|
||||||
int ypos = y+ hheight+ 25;
|
|
||||||
|
|
||||||
char ch[2] = {c, 0};
|
char ch[2] = {c, 0};
|
||||||
|
|
||||||
@@ -594,18 +604,12 @@ void CStringInput::paintChar(int pos, const char c)
|
|||||||
bgcolor = COL_MENUCONTENT_PLUS_0;
|
bgcolor = COL_MENUCONTENT_PLUS_0;
|
||||||
}
|
}
|
||||||
|
|
||||||
frameBuffer->paintBoxRel(xpos, ypos, xs, ys, COL_MENUCONTENT_PLUS_4);
|
frameBuffer->paintBoxRel(xpos, ypos, input_w, input_h, COL_MENUCONTENT_PLUS_2);
|
||||||
frameBuffer->paintBoxRel(xpos+ 1, ypos+ 1, xs- 2, ys- 2, bgcolor);
|
frameBuffer->paintBoxRel(xpos+ 1, ypos+ 1, input_w- 2, input_h- 2, bgcolor);
|
||||||
|
|
||||||
int xfpos = xpos + ((xs- g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(ch))>>1);
|
int ch_w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(ch);
|
||||||
|
int ch_x = xpos + std::max(input_w/2 - ch_w/2, 0);
|
||||||
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(xfpos,ypos+ys, width, ch, color);
|
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(ch_x, ypos+ input_h, ch_w, ch, color);
|
||||||
}
|
|
||||||
|
|
||||||
void CStringInput::paintChar(int pos)
|
|
||||||
{
|
|
||||||
if(pos<(int)strlen(value))
|
|
||||||
paintChar(pos, value[pos]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CStringInputSMS::CStringInputSMS(const neutrino_locale_t Name, std::string* Value, int Size, const neutrino_locale_t Hint_1, const neutrino_locale_t Hint_2, const char * const Valid_Chars, CChangeObserver* Observ, const char * const Icon)
|
CStringInputSMS::CStringInputSMS(const neutrino_locale_t Name, std::string* Value, int Size, const neutrino_locale_t Hint_1, const neutrino_locale_t Hint_2, const char * const Valid_Chars, CChangeObserver* Observ, const char * const Icon)
|
||||||
@@ -616,7 +620,7 @@ CStringInputSMS::CStringInputSMS(const neutrino_locale_t Name, std::string* Valu
|
|||||||
|
|
||||||
CStringInputSMS::CStringInputSMS(const neutrino_locale_t Name, char* Value, int Size, const neutrino_locale_t Hint_1, const neutrino_locale_t Hint_2, const char * const Valid_Chars, CChangeObserver* Observ, const char * const Icon)
|
CStringInputSMS::CStringInputSMS(const neutrino_locale_t Name, char* Value, int Size, const neutrino_locale_t Hint_1, const neutrino_locale_t Hint_2, const char * const Valid_Chars, CChangeObserver* Observ, const char * const Icon)
|
||||||
: CStringInput(Name, Value, Size, Hint_1, Hint_2, Valid_Chars, Observ, Icon)
|
: CStringInput(Name, Value, Size, Hint_1, Hint_2, Valid_Chars, Observ, Icon)
|
||||||
{
|
{
|
||||||
initSMS(Valid_Chars);
|
initSMS(Valid_Chars);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -645,8 +649,23 @@ void CStringInputSMS::initSMS(const char * const Valid_Chars)
|
|||||||
arraySizes[i] = j;
|
arraySizes[i] = j;
|
||||||
}
|
}
|
||||||
|
|
||||||
height+=260;
|
int icol_w = 0, icol_h = 0;
|
||||||
y = ((500-height)>>1);
|
frameBuffer->getIconSize(NEUTRINO_ICON_NUMERIC_PAD, &icol_w, &icol_h);
|
||||||
|
bheight += icol_h + offset;
|
||||||
|
|
||||||
|
icol_w = icol_h = 0;
|
||||||
|
for (int i = 0; i < CStringInputSMSButtonsCount; i++)
|
||||||
|
{
|
||||||
|
// get max iconsize in buttonbar
|
||||||
|
int w = 0, h = 0;
|
||||||
|
frameBuffer->getIconSize(CStringInputSMSButtons[i].button, &w, &h);
|
||||||
|
icol_w = std::max(icol_w, w);
|
||||||
|
icol_h = std::max(icol_h, h);
|
||||||
|
}
|
||||||
|
fheight = std::max(fheight, icol_h + offset/5);
|
||||||
|
|
||||||
|
height = hheight + bheight + fheight;
|
||||||
|
y = getScreenStartY(height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CStringInputSMS::NormalKeyPressed(const neutrino_msg_t key)
|
void CStringInputSMS::NormalKeyPressed(const neutrino_msg_t key)
|
||||||
@@ -745,22 +764,9 @@ void CStringInputSMS::keyRightPressed()
|
|||||||
CStringInput::keyRightPressed();
|
CStringInput::keyRightPressed();
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct button_label CStringInputSMSButtons[2] =
|
|
||||||
{
|
|
||||||
{ NEUTRINO_ICON_BUTTON_RED , LOCALE_STRINGINPUT_CAPS },
|
|
||||||
{ NEUTRINO_ICON_BUTTON_YELLOW, LOCALE_STRINGINPUT_CLEAR }
|
|
||||||
};
|
|
||||||
|
|
||||||
void CStringInputSMS::paint(bool /*unused*/)
|
void CStringInputSMS::paint(bool /*unused*/)
|
||||||
{
|
{
|
||||||
CStringInput::paint(true);
|
CStringInput::paint(true /* sms */);
|
||||||
|
|
||||||
int w = 0, h = 0;
|
|
||||||
frameBuffer->getIconSize(NEUTRINO_ICON_NUMERIC_PAD, &w, &h);
|
|
||||||
frameBuffer->paintIcon(NEUTRINO_ICON_NUMERIC_PAD, x + (width/2) - (w/2), y+ hheight+ mheight+ iheight* 3+ 30, 0, COL_MENUCONTENT);
|
|
||||||
|
|
||||||
//buttonbar
|
|
||||||
::paintButtons(x, y + height, width, 2, CStringInputSMSButtons);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPINInput::paintChar(int pos)
|
void CPINInput::paintChar(int pos)
|
||||||
@@ -877,7 +883,7 @@ const char * CPLPINInput::getHint1(void)
|
|||||||
if (fsk == 0x100)
|
if (fsk == 0x100)
|
||||||
{
|
{
|
||||||
hint_1 = LOCALE_PARENTALLOCK_LOCKEDCHANNEL;
|
hint_1 = LOCALE_PARENTALLOCK_LOCKEDCHANNEL;
|
||||||
return CStringInput::getHint1();
|
return g_Locale->getText(hint_1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -4,13 +4,6 @@
|
|||||||
Copyright (C) 2001 Steffen Hehn 'McClean'
|
Copyright (C) 2001 Steffen Hehn 'McClean'
|
||||||
Homepage: http://dbox.cyberphoria.org/
|
Homepage: http://dbox.cyberphoria.org/
|
||||||
|
|
||||||
Kommentar:
|
|
||||||
|
|
||||||
Diese GUI wurde von Grund auf neu programmiert und sollte nun vom
|
|
||||||
Aufbau und auch den Ausbaumoeglichkeiten gut aussehen. Neutrino basiert
|
|
||||||
auf der Client-Server Idee, diese GUI ist also von der direkten DBox-
|
|
||||||
Steuerung getrennt. Diese wird dann von Daemons uebernommen.
|
|
||||||
|
|
||||||
|
|
||||||
License: GPL
|
License: GPL
|
||||||
|
|
||||||
@@ -49,8 +42,12 @@ class CStringInput : public CMenuTarget
|
|||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
int hheight; // head font height
|
int hheight; // head font height
|
||||||
int mheight; // menu font height
|
|
||||||
int iheight;
|
int iheight;
|
||||||
|
int bheight; // body height
|
||||||
|
int fheight; // footer height
|
||||||
|
int input_h; // input field height
|
||||||
|
int input_w; // input field width
|
||||||
|
int offset;
|
||||||
int lower_bound;
|
int lower_bound;
|
||||||
int upper_bound;
|
int upper_bound;
|
||||||
|
|
||||||
@@ -66,9 +63,8 @@ class CStringInput : public CMenuTarget
|
|||||||
CChangeObserver * observ;
|
CChangeObserver * observ;
|
||||||
|
|
||||||
virtual void init();
|
virtual void init();
|
||||||
virtual const char * getHint1(void);
|
|
||||||
|
|
||||||
virtual void paint(bool buttons = false);
|
virtual void paint(bool sms = false);
|
||||||
virtual void paintChar(int pos, char c);
|
virtual void paintChar(int pos, char c);
|
||||||
virtual void paintChar(int pos);
|
virtual void paintChar(int pos);
|
||||||
|
|
||||||
|
@@ -4,13 +4,6 @@
|
|||||||
Copyright (C) 2001 Steffen Hehn 'McClean'
|
Copyright (C) 2001 Steffen Hehn 'McClean'
|
||||||
Homepage: http://dbox.cyberphoria.org/
|
Homepage: http://dbox.cyberphoria.org/
|
||||||
|
|
||||||
Kommentar:
|
|
||||||
|
|
||||||
Diese GUI wurde von Grund auf neu programmiert und sollte nun vom
|
|
||||||
Aufbau und auch den Ausbaumoeglichkeiten gut aussehen. Neutrino basiert
|
|
||||||
auf der Client-Server Idee, diese GUI ist also von der direkten DBox-
|
|
||||||
Steuerung getrennt. Diese wird dann von Daemons uebernommen.
|
|
||||||
|
|
||||||
|
|
||||||
License: GPL
|
License: GPL
|
||||||
|
|
||||||
@@ -37,6 +30,7 @@
|
|||||||
|
|
||||||
#include <driver/fontrenderer.h>
|
#include <driver/fontrenderer.h>
|
||||||
#include <driver/rcinput.h>
|
#include <driver/rcinput.h>
|
||||||
|
#include <driver/screen_max.h>
|
||||||
|
|
||||||
#include <gui/color.h>
|
#include <gui/color.h>
|
||||||
|
|
||||||
@@ -61,22 +55,41 @@ CExtendedInput::CExtendedInput(const neutrino_locale_t Name, char* Value, const
|
|||||||
|
|
||||||
void CExtendedInput::Init(void)
|
void CExtendedInput::Init(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
frameBuffer = CFrameBuffer::getInstance();
|
frameBuffer = CFrameBuffer::getInstance();
|
||||||
|
|
||||||
hheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight();
|
hheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight();
|
||||||
mheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight();
|
|
||||||
iheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_INFO]->getHeight();
|
iheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_INFO]->getHeight();
|
||||||
|
input_h = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight() + 2; // font height + border
|
||||||
|
input_w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth("M") + 2; // hack font width + border
|
||||||
|
offset = 20;
|
||||||
|
|
||||||
width = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getRenderWidth(g_Locale->getText(name), true) + 20; // UTF-8
|
width = frameBuffer->getScreenWidth() / 100 * 45;
|
||||||
height = hheight+ mheight+ 20;
|
|
||||||
|
|
||||||
if (hint_1 != NONEXISTANT_LOCALE)
|
int tmp_w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getRenderWidth(g_Locale->getText(name), true); // UTF-8
|
||||||
height += iheight;
|
width = std::max(width, tmp_w + offset);
|
||||||
if (hint_2 != NONEXISTANT_LOCALE)
|
|
||||||
height += iheight;
|
|
||||||
|
|
||||||
x = frameBuffer->getScreenX() + ((frameBuffer->getScreenWidth() - width)>>1);
|
bheight = input_h + 2*offset;
|
||||||
y = frameBuffer->getScreenY() + ((frameBuffer->getScreenHeight() - height)>>1);
|
if ((hint_1 != NONEXISTANT_LOCALE) || (hint_2 != NONEXISTANT_LOCALE))
|
||||||
|
{
|
||||||
|
if (hint_1 != NONEXISTANT_LOCALE)
|
||||||
|
{
|
||||||
|
tmp_w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_INFO]->getRenderWidth(g_Locale->getText(hint_1), true);
|
||||||
|
width = std::max(width, tmp_w + 2*offset);
|
||||||
|
bheight += iheight;
|
||||||
|
}
|
||||||
|
if (hint_2 != NONEXISTANT_LOCALE)
|
||||||
|
{
|
||||||
|
tmp_w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_INFO]->getRenderWidth(g_Locale->getText(hint_2), true);
|
||||||
|
width = std::max(width, tmp_w + 2*offset);
|
||||||
|
bheight += iheight;
|
||||||
|
}
|
||||||
|
bheight += offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
height = hheight+ bheight;
|
||||||
|
|
||||||
|
x = getScreenStartX(width);
|
||||||
|
y = getScreenStartY(height);
|
||||||
}
|
}
|
||||||
|
|
||||||
CExtendedInput::~CExtendedInput()
|
CExtendedInput::~CExtendedInput()
|
||||||
@@ -107,32 +120,15 @@ void CExtendedInput::calculateDialog()
|
|||||||
{
|
{
|
||||||
selectedChar = i;
|
selectedChar = i;
|
||||||
}
|
}
|
||||||
maxX = ix > maxX ? ix : maxX;
|
maxX = std::max(ix, maxX);
|
||||||
maxY = iy > maxY ? iy : maxY;
|
maxY = std::max(iy, maxY);
|
||||||
}
|
}
|
||||||
|
|
||||||
width = width > maxX+40 ? width : maxX+40;
|
width = std::max(width, maxX + 2*offset);
|
||||||
height = height > maxY + hheight + mheight ? height : maxY + hheight + mheight;
|
height = std::max(height, maxY + bheight);
|
||||||
|
|
||||||
hintPosY = height -10;
|
x = getScreenStartX(width);
|
||||||
|
y = getScreenStartY(height);
|
||||||
if (hint_1 != NONEXISTANT_LOCALE) {
|
|
||||||
height += iheight;
|
|
||||||
int hw = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_INFO]->getRenderWidth(g_Locale->getText(hint_1), true);
|
|
||||||
if(width < hw + 40)
|
|
||||||
width = hw + 40;
|
|
||||||
}
|
|
||||||
if (hint_2 != NONEXISTANT_LOCALE) {
|
|
||||||
height += iheight;
|
|
||||||
int hw = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_INFO]->getRenderWidth(g_Locale->getText(hint_2), true);
|
|
||||||
if(width < hw)
|
|
||||||
width = hw;
|
|
||||||
}
|
|
||||||
|
|
||||||
x = frameBuffer->getScreenX() + ((frameBuffer->getScreenWidth() - width)>>1);
|
|
||||||
y = frameBuffer->getScreenY() + ((frameBuffer->getScreenHeight() - height)>>1);
|
|
||||||
|
|
||||||
hintPosY += y;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -162,8 +158,7 @@ int CExtendedInput::exec( CMenuTarget* parent, const std::string & )
|
|||||||
strcpy(dispval, value);
|
strcpy(dispval, value);
|
||||||
paint();
|
paint();
|
||||||
|
|
||||||
uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings
|
uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]);
|
||||||
::TIMING_MENU]);
|
|
||||||
|
|
||||||
bool loop=true;
|
bool loop=true;
|
||||||
while (loop)
|
while (loop)
|
||||||
@@ -198,8 +193,8 @@ int CExtendedInput::exec( CMenuTarget* parent, const std::string & )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(found) {
|
if(found) {
|
||||||
inputFields[oldSelectedChar]->paint( x+20, y+hheight +20, false );
|
inputFields[oldSelectedChar]->paint(x+ offset, y+ hheight+ offset, false );
|
||||||
inputFields[selectedChar]->paint( x+20, y+hheight +20, true );
|
inputFields[selectedChar]->paint(x+ offset, y+ hheight+ offset, true );
|
||||||
std::string tmp = value;
|
std::string tmp = value;
|
||||||
CVFD::getInstance()->showMenuText(1, tmp.c_str(), selectedChar+1);
|
CVFD::getInstance()->showMenuText(1, tmp.c_str(), selectedChar+1);
|
||||||
}
|
}
|
||||||
@@ -226,8 +221,8 @@ int CExtendedInput::exec( CMenuTarget* parent, const std::string & )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(found) {
|
if(found) {
|
||||||
inputFields[oldSelectedChar]->paint( x+20, y+hheight +20, false );
|
inputFields[oldSelectedChar]->paint(x+ offset, y+ hheight+ offset, false );
|
||||||
inputFields[selectedChar]->paint( x+20, y+hheight +20, true );
|
inputFields[selectedChar]->paint(x+ offset, y+ hheight+ offset, true );
|
||||||
std::string tmp = value;
|
std::string tmp = value;
|
||||||
CVFD::getInstance()->showMenuText(1, tmp.c_str(), selectedChar+1);
|
CVFD::getInstance()->showMenuText(1, tmp.c_str(), selectedChar+1);
|
||||||
}
|
}
|
||||||
@@ -236,7 +231,7 @@ int CExtendedInput::exec( CMenuTarget* parent, const std::string & )
|
|||||||
|| (msg == CRCInput::RC_up) || (msg == CRCInput::RC_down))
|
|| (msg == CRCInput::RC_up) || (msg == CRCInput::RC_down))
|
||||||
{
|
{
|
||||||
inputFields[selectedChar]->keyPressed(msg);
|
inputFields[selectedChar]->keyPressed(msg);
|
||||||
inputFields[selectedChar]->paint( x+20, y+hheight +20, true );
|
inputFields[selectedChar]->paint(x+ offset, y+ hheight+ offset, true );
|
||||||
}
|
}
|
||||||
else if (msg==CRCInput::RC_ok)
|
else if (msg==CRCInput::RC_ok)
|
||||||
{
|
{
|
||||||
@@ -301,23 +296,29 @@ void CExtendedInput::hide()
|
|||||||
void CExtendedInput::paint()
|
void CExtendedInput::paint()
|
||||||
{
|
{
|
||||||
frameBuffer->paintBoxRel(x, y, width, hheight, COL_MENUHEAD_PLUS_0, RADIUS_LARGE, CORNER_TOP);
|
frameBuffer->paintBoxRel(x, y, width, hheight, COL_MENUHEAD_PLUS_0, RADIUS_LARGE, CORNER_TOP);
|
||||||
frameBuffer->paintBoxRel(x, y + hheight, width, height - hheight, COL_MENUCONTENT_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM);
|
frameBuffer->paintBoxRel(x, y + hheight, width, bheight, COL_MENUCONTENT_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM);
|
||||||
|
|
||||||
g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->RenderString(x+ 10, y+ hheight, width- 10, g_Locale->getText(name), COL_MENUHEAD, 0, true); // UTF-8
|
g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->RenderString(x+ (offset/2), y+ hheight, width- (offset/2), g_Locale->getText(name), COL_MENUHEAD, 0, true); // UTF-8
|
||||||
|
|
||||||
if (hint_1 != NONEXISTANT_LOCALE)
|
int tmp_y = y+ hheight+ offset+ input_h+ offset;
|
||||||
|
|
||||||
|
if ((hint_1 != NONEXISTANT_LOCALE) || (hint_2 != NONEXISTANT_LOCALE))
|
||||||
{
|
{
|
||||||
g_Font[SNeutrinoSettings::FONT_TYPE_MENU_INFO]->RenderString(x+ 20, hintPosY, width- 20, g_Locale->getText(hint_1), COL_MENUCONTENT, 0, true); // UTF-8
|
if (hint_1 != NONEXISTANT_LOCALE)
|
||||||
|
{
|
||||||
|
tmp_y += iheight;
|
||||||
|
g_Font[SNeutrinoSettings::FONT_TYPE_MENU_INFO]->RenderString(x+ offset, tmp_y, width- 2*offset, g_Locale->getText(hint_1), COL_MENUCONTENT, 0, true); // UTF-8
|
||||||
|
}
|
||||||
if (hint_2 != NONEXISTANT_LOCALE)
|
if (hint_2 != NONEXISTANT_LOCALE)
|
||||||
g_Font[SNeutrinoSettings::FONT_TYPE_MENU_INFO]->RenderString(x+ 20, hintPosY + iheight, width- 20, g_Locale->getText(hint_2), COL_MENUCONTENT, 0, true); // UTF-8
|
{
|
||||||
|
tmp_y += iheight;
|
||||||
|
g_Font[SNeutrinoSettings::FONT_TYPE_MENU_INFO]->RenderString(x+ offset, tmp_y, width- 2*offset, g_Locale->getText(hint_2), COL_MENUCONTENT, 0, true); // UTF-8
|
||||||
|
}
|
||||||
|
tmp_y += offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(unsigned int i=0; i<inputFields.size();i++)
|
for(unsigned int i=0; i<inputFields.size();i++)
|
||||||
{
|
inputFields[i]->paint(x+ offset, y+ hheight+ offset, (i== (unsigned int) selectedChar) );
|
||||||
inputFields[i]->paint( x+20, y+hheight +20, (i== (unsigned int) selectedChar) );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
@@ -326,8 +327,8 @@ void CExtendedInput::paint()
|
|||||||
CExtendedInput_Item_Char::CExtendedInput_Item_Char(const std::string & Chars, bool Selectable )
|
CExtendedInput_Item_Char::CExtendedInput_Item_Char(const std::string & Chars, bool Selectable )
|
||||||
{
|
{
|
||||||
frameBuffer = CFrameBuffer::getInstance();
|
frameBuffer = CFrameBuffer::getInstance();
|
||||||
idx = 20;
|
input_h = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight() + 2; // font height + border
|
||||||
idy = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight();
|
input_w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth("M") + 2; // hack font width + border
|
||||||
allowedChars = Chars;
|
allowedChars = Chars;
|
||||||
selectable = Selectable;
|
selectable = Selectable;
|
||||||
}
|
}
|
||||||
@@ -336,7 +337,7 @@ void CExtendedInput_Item_Char::init(int &x, int &y)
|
|||||||
{
|
{
|
||||||
ix = x;
|
ix = x;
|
||||||
iy = y;
|
iy = y;
|
||||||
x += idx;
|
x += input_w;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CExtendedInput_Item_Char::setAllowedChars( const std::string & ac )
|
void CExtendedInput_Item_Char::setAllowedChars( const std::string & ac )
|
||||||
@@ -346,8 +347,10 @@ void CExtendedInput_Item_Char::setAllowedChars( const std::string & ac )
|
|||||||
|
|
||||||
void CExtendedInput_Item_Char::paint(int x, int y, bool focusGained )
|
void CExtendedInput_Item_Char::paint(int x, int y, bool focusGained )
|
||||||
{
|
{
|
||||||
int startx = ix + x;
|
int xpos = ix + x;
|
||||||
int starty = iy + y;
|
int ypos = iy + y;
|
||||||
|
|
||||||
|
char ch[2] = {*data, 0};
|
||||||
|
|
||||||
uint8_t color;
|
uint8_t color;
|
||||||
fb_pixel_t bgcolor;
|
fb_pixel_t bgcolor;
|
||||||
@@ -363,15 +366,12 @@ void CExtendedInput_Item_Char::paint(int x, int y, bool focusGained )
|
|||||||
bgcolor = COL_MENUCONTENT_PLUS_0;
|
bgcolor = COL_MENUCONTENT_PLUS_0;
|
||||||
}
|
}
|
||||||
|
|
||||||
frameBuffer->paintBoxRel( startx, starty, idx, idy, COL_MENUCONTENT_PLUS_4);
|
frameBuffer->paintBoxRel(xpos, ypos, input_w, input_h, COL_MENUCONTENT_PLUS_2);
|
||||||
frameBuffer->paintBoxRel( startx+1, starty+1, idx-2, idy-2, bgcolor);
|
frameBuffer->paintBoxRel(xpos+ 1, ypos+ 1, input_w- 2, input_h- 2, bgcolor);
|
||||||
|
|
||||||
char text[2];
|
int ch_w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(ch);
|
||||||
text[0] = *data;
|
int ch_x = xpos + std::max(input_w/2 - ch_w/2, 0);
|
||||||
text[1] = 0;
|
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(ch_x, ypos+ input_h, ch_w, ch, color);
|
||||||
int xfpos = startx + 1 + ((idx- g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth( text ))>>1);
|
|
||||||
|
|
||||||
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(xfpos,starty+idy, idx, text, color);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CExtendedInput_Item_Char::isAllowedChar( char ch )
|
bool CExtendedInput_Item_Char::isAllowedChar( char ch )
|
||||||
|
@@ -53,8 +53,11 @@ class CExtendedInput : public CMenuTarget
|
|||||||
int height;
|
int height;
|
||||||
int hintPosY;
|
int hintPosY;
|
||||||
int hheight; // head font height
|
int hheight; // head font height
|
||||||
int mheight; // menu font height
|
|
||||||
int iheight;
|
int iheight;
|
||||||
|
int bheight; // body height
|
||||||
|
int input_h; // input field height
|
||||||
|
int input_w; // input field width
|
||||||
|
int offset;
|
||||||
|
|
||||||
std::vector<CExtendedInput_Item*> inputFields;
|
std::vector<CExtendedInput_Item*> inputFields;
|
||||||
int selectedChar;
|
int selectedChar;
|
||||||
@@ -88,7 +91,9 @@ class CExtendedInput_Item
|
|||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
CFrameBuffer *frameBuffer;
|
CFrameBuffer *frameBuffer;
|
||||||
int ix, iy, idx, idy;
|
int input_h; // input field height
|
||||||
|
int input_w; // input field width
|
||||||
|
int ix, iy;
|
||||||
char* data;
|
char* data;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
Reference in New Issue
Block a user