mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-09-02 18:31:12 +02:00
Fixes for non-standart icon sizes. Not complete yet, work in progress. Probably will broke commit #568
git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@569 e54a6e83-5905-42d5-8d5c-058d10e6a962
Origin commit data
------------------
Branch: ni/coolstream
Commit: 56674d5561
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2010-05-06 (Thu, 06 May 2010)
------------------
This commit was generated by Migit
This commit is contained in:
@@ -26,22 +26,24 @@
|
||||
#include <gui/widget/buttons.h>
|
||||
|
||||
#include <gui/color.h>
|
||||
|
||||
#if 1
|
||||
void paintButtons(CFrameBuffer * const frameBuffer, Font * const font, const CLocaleManager * const localemanager, const int x, const int y, const unsigned int buttonwidth, const unsigned int count, const struct button_label * const content)
|
||||
{
|
||||
for (unsigned int i = 0; i < count; i++)
|
||||
{
|
||||
#if 0
|
||||
int iw, ih, yy;
|
||||
int fh = font->getHeight();
|
||||
frameBuffer->getIconSize(content[i].button, &iw, &ih);
|
||||
yy = y + (fh - ih)/2;
|
||||
frameBuffer->paintIcon(content[i].button, x + i * buttonwidth, yy);
|
||||
font->RenderString(x + i * buttonwidth + iw + 5, y + 19, buttonwidth - iw - 5, localemanager->getText(content[i].locale), COL_INFOBAR, 0, true); // UTF-8
|
||||
#else
|
||||
frameBuffer->paintIcon(content[i].button, x + i * buttonwidth, y);
|
||||
//FIXME why y+19 ??
|
||||
font->RenderString(x + i * buttonwidth + 20, y + 19, buttonwidth - 20, localemanager->getText(content[i].locale), COL_INFOBAR, 0, true); // UTF-8
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
void paintButtons(CFrameBuffer * const frameBuffer, Font * const font, const CLocaleManager * const localemanager, const int x, const int y, const unsigned int buttonwidth, const unsigned int height, const unsigned int count, const struct button_label * const content)
|
||||
{
|
||||
int iw, ih;
|
||||
for (unsigned int i = 0; i < count; i++)
|
||||
{
|
||||
int fh = font->getHeight();
|
||||
frameBuffer->getIconSize(content[i].button, &iw, &ih);
|
||||
frameBuffer->paintIcon(content[i].button, x + i * buttonwidth, y, height);
|
||||
font->RenderString(x + i * buttonwidth + iw + 5, y + (height-fh)/2 + fh, buttonwidth - iw - 5, localemanager->getText(content[i].locale), COL_INFOBAR, 0, true); // UTF-8
|
||||
}
|
||||
}
|
||||
|
@@ -33,5 +33,6 @@ typedef struct button_label
|
||||
} button_label_struct;
|
||||
|
||||
void paintButtons(CFrameBuffer * const frameBuffer, Font * const font, const CLocaleManager * const localemanager, const int x, const int y, const unsigned int buttonwidth, const unsigned int count, const struct button_label * const content);
|
||||
void paintButtons(CFrameBuffer * const frameBuffer, Font * const font, const CLocaleManager * const localemanager, const int x, const int y, const unsigned int buttonwidth, const unsigned int height, const unsigned int count, const struct button_label * const content);
|
||||
|
||||
#endif /* __gui_widget_buttons_h__ */
|
||||
|
@@ -208,6 +208,8 @@ int CColorChooser::exec(CMenuTarget* parent, const std::string &)
|
||||
*value[VALUE_B] = b_alt;
|
||||
if (value[VALUE_ALPHA])
|
||||
*value[VALUE_ALPHA] = a_alt;
|
||||
loop = false;
|
||||
break;
|
||||
|
||||
case CRCInput::RC_sat:
|
||||
case CRCInput::RC_favorites:
|
||||
|
@@ -161,8 +161,11 @@ void CHintBox::refresh(void)
|
||||
|
||||
if (!iconfile.empty())
|
||||
{
|
||||
window->paintIcon(iconfile.c_str(), 8, 5);
|
||||
window->RenderString(g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE], 40, theight, width - 40, g_Locale->getText(caption), (CFBWindow::color_t)COL_MENUHEAD, 0, true); // UTF-8
|
||||
int iw, ih;
|
||||
CFrameBuffer::getInstance()->getIconSize(iconfile.c_str(), &iw, &ih);
|
||||
//window->paintIcon(iconfile.c_str(), 8, 5);
|
||||
window->paintIcon(iconfile.c_str(), 10, 0, theight);
|
||||
window->RenderString(g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE], iw+20, theight, width - 20-iw, g_Locale->getText(caption), (CFBWindow::color_t)COL_MENUHEAD, 0, true); // UTF-8
|
||||
}
|
||||
else
|
||||
window->RenderString(g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE], 10, theight, width - 10, g_Locale->getText(caption), (CFBWindow::color_t)COL_MENUHEAD, 0, true); // UTF-8
|
||||
|
@@ -181,9 +181,18 @@ int CListBox::exec(CMenuTarget* parent, const std::string & /*actionKey*/)
|
||||
|
||||
step = ((int) msg == g_settings.key_channelList_pageup) ? listmaxshow : 1; // browse or step 1
|
||||
selected -= step;
|
||||
|
||||
if((prev_selected-step) < 0) {
|
||||
if(prev_selected != 0 && step != 1)
|
||||
selected = 0;
|
||||
else
|
||||
selected = getItemCount() - 1;
|
||||
}
|
||||
|
||||
#if 0
|
||||
if((prev_selected-step) < 0) // because of uint
|
||||
selected = getItemCount() - 1;
|
||||
|
||||
#endif
|
||||
paintItem(prev_selected - liststart);
|
||||
unsigned int oldliststart = liststart;
|
||||
liststart = (selected/listmaxshow)*listmaxshow;
|
||||
@@ -198,17 +207,28 @@ int CListBox::exec(CMenuTarget* parent, const std::string & /*actionKey*/)
|
||||
{
|
||||
if(getItemCount()!=0) {
|
||||
unsigned int step = 0;
|
||||
int prev_selected = selected;
|
||||
unsigned int prev_selected = selected;
|
||||
|
||||
step = ((int) msg == g_settings.key_channelList_pagedown) ? listmaxshow : 1; // browse or step 1
|
||||
selected += step;
|
||||
|
||||
if(selected >= getItemCount()) {
|
||||
if((getItemCount() - listmaxshow -1 < prev_selected) && (prev_selected != (getItemCount() - 1)) && (step != 1))
|
||||
selected = getItemCount() - 1;
|
||||
else if (((getItemCount() / listmaxshow) + 1) * listmaxshow == getItemCount() + listmaxshow) // last page has full entries
|
||||
selected = 0;
|
||||
else
|
||||
selected = ((step == listmaxshow) && (selected < (((getItemCount() / listmaxshow)+1) * listmaxshow))) ? (getItemCount() - 1) : 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
if(selected >= getItemCount()) {
|
||||
if (((getItemCount() / listmaxshow) + 1) * listmaxshow == getItemCount() + listmaxshow) // last page has full entries
|
||||
selected = 0;
|
||||
else
|
||||
selected = ((step == listmaxshow) && (selected < (((getItemCount() / listmaxshow) + 1) * listmaxshow))) ? (getItemCount() - 1) : 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
paintItem(prev_selected - liststart);
|
||||
unsigned int oldliststart = liststart;
|
||||
|
@@ -44,6 +44,8 @@ class CListBox : public CMenuWidget
|
||||
|
||||
int fheight;
|
||||
int theight;
|
||||
int iheight;
|
||||
int iconoffset;
|
||||
|
||||
unsigned int selected;
|
||||
unsigned int liststart;
|
||||
|
@@ -97,7 +97,6 @@ void CMessageBox::paintButtons()
|
||||
uint8_t color;
|
||||
fb_pixel_t bgcolor;
|
||||
|
||||
//m_window->paintBoxRel(0, m_height - (m_fheight << 1), m_width, (m_fheight << 1), (CFBWindow::color_t)COL_MENUCONTENT_PLUS_0);
|
||||
m_window->paintBoxRel(0, m_height - (m_fheight << 1), m_width, (m_fheight << 1), (CFBWindow::color_t)COL_MENUCONTENT_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM);
|
||||
|
||||
//irgendwann alle vergleichen - aber cancel ist sicher der l<>ngste
|
||||
@@ -105,13 +104,11 @@ void CMessageBox::paintButtons()
|
||||
|
||||
int ButtonWidth = 20 + 33 + MaxButtonTextWidth;
|
||||
|
||||
// int ButtonSpacing = 40;
|
||||
// int startpos = (m_width - ((ButtonWidth*3)+(ButtonSpacing*2))) / 2;
|
||||
|
||||
int ButtonSpacing = (m_width - 20 - (ButtonWidth * 3)) / 2;
|
||||
if(ButtonSpacing <= 5) ButtonSpacing = 5;
|
||||
|
||||
int xpos = 10;
|
||||
int iw, ih;
|
||||
|
||||
if (showbuttons & mbYes)
|
||||
{
|
||||
@@ -125,14 +122,15 @@ void CMessageBox::paintButtons()
|
||||
color = COL_INFOBAR_SHADOW;
|
||||
bgcolor = COL_INFOBAR_SHADOW_PLUS_0;
|
||||
}
|
||||
//m_window->paintBoxRel(xpos, m_height - m_fheight - 20, ButtonWidth, m_fheight, (CFBWindow::color_t)bgcolor);
|
||||
CFrameBuffer::getInstance()->getIconSize(NEUTRINO_ICON_BUTTON_RED, &iw, &ih);
|
||||
m_window->paintBoxRel(xpos, m_height - m_fheight - 20, ButtonWidth, m_fheight, (CFBWindow::color_t)bgcolor, RADIUS_LARGE);//round
|
||||
m_window->paintIcon(NEUTRINO_ICON_BUTTON_RED, xpos + 14, m_height - m_fheight - 15);
|
||||
//m_window->paintIcon(NEUTRINO_ICON_BUTTON_RED, xpos + 14, m_height - m_fheight - 15);
|
||||
//m_window->RenderString(g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], xpos + 43, m_height-m_fheight+4, ButtonWidth- 53, g_Locale->getText(LOCALE_MESSAGEBOX_YES), (CFBWindow::color_t)color, 0, true); // UTF-8
|
||||
m_window->paintIcon(NEUTRINO_ICON_BUTTON_RED, xpos + 14, m_height - m_fheight - 20, m_fheight);
|
||||
m_window->RenderString(g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], xpos + 43, m_height-m_fheight+4, ButtonWidth- 53, g_Locale->getText(LOCALE_MESSAGEBOX_YES), (CFBWindow::color_t)color, 0, true); // UTF-8
|
||||
xpos += ButtonWidth + ButtonSpacing;
|
||||
}
|
||||
|
||||
|
||||
if (showbuttons & mbNo)
|
||||
{
|
||||
if (result == mbrNo)
|
||||
@@ -146,9 +144,9 @@ void CMessageBox::paintButtons()
|
||||
bgcolor = COL_INFOBAR_SHADOW_PLUS_0;
|
||||
}
|
||||
|
||||
//m_window->paintBoxRel(xpos, m_height-m_fheight-20, ButtonWidth, m_fheight, (CFBWindow::color_t)bgcolor);
|
||||
m_window->paintBoxRel(xpos, m_height-m_fheight-20, ButtonWidth, m_fheight, (CFBWindow::color_t)bgcolor, RADIUS_LARGE);//round
|
||||
m_window->paintIcon(NEUTRINO_ICON_BUTTON_GREEN, xpos+14, m_height-m_fheight-15);
|
||||
//m_window->paintIcon(NEUTRINO_ICON_BUTTON_GREEN, xpos+14, m_height-m_fheight-15);
|
||||
m_window->paintIcon(NEUTRINO_ICON_BUTTON_GREEN, xpos+14, m_height-m_fheight - 20, m_fheight);
|
||||
m_window->RenderString(g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], xpos + 43, m_height-m_fheight+4, ButtonWidth- 53, g_Locale->getText(LOCALE_MESSAGEBOX_NO), (CFBWindow::color_t)color, 0, true); // UTF-8
|
||||
xpos += ButtonWidth + ButtonSpacing;
|
||||
}
|
||||
@@ -167,9 +165,9 @@ void CMessageBox::paintButtons()
|
||||
bgcolor = COL_INFOBAR_SHADOW_PLUS_0;
|
||||
}
|
||||
|
||||
//m_window->paintBoxRel(xpos, m_height-m_fheight-20, ButtonWidth, m_fheight, (CFBWindow::color_t)bgcolor);
|
||||
m_window->paintBoxRel(xpos, m_height-m_fheight-20, ButtonWidth, m_fheight, (CFBWindow::color_t)bgcolor, RADIUS_LARGE);//round
|
||||
m_window->paintIcon(NEUTRINO_ICON_BUTTON_HOME, xpos+10, m_height-m_fheight-19);
|
||||
//m_window->paintIcon(NEUTRINO_ICON_BUTTON_HOME, xpos+10, m_height-m_fheight-19);
|
||||
m_window->paintIcon(NEUTRINO_ICON_BUTTON_HOME, xpos+14, m_height-m_fheight - 20, m_fheight);
|
||||
m_window->RenderString(g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], xpos + 43, m_height-m_fheight+4, ButtonWidth- 53, g_Locale->getText((showbuttons & mbCancel) ? LOCALE_MESSAGEBOX_CANCEL : LOCALE_MESSAGEBOX_BACK), (CFBWindow::color_t)color, 0, true); // UTF-8
|
||||
}
|
||||
}
|
||||
|
@@ -134,6 +134,12 @@ void CStringInput::init()
|
||||
width = neededWidth+20;
|
||||
|
||||
hheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight();
|
||||
if (!(iconfile.empty()))
|
||||
{
|
||||
int icol_w, icol_h;
|
||||
frameBuffer->getIconSize(iconfile.c_str(), &icol_w, &icol_h);
|
||||
hheight = std::max(hheight, icol_h+4);
|
||||
}
|
||||
mheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight();
|
||||
iheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_INFO]->getHeight();
|
||||
|
||||
@@ -474,16 +480,16 @@ const char * CStringInput::getHint1(void)
|
||||
void CStringInput::paint()
|
||||
{
|
||||
int iconoffset;
|
||||
int icol_w, icol_h;
|
||||
|
||||
//frameBuffer->paintBoxRel(x, y, width, hheight, COL_MENUHEAD_PLUS_0);
|
||||
//frameBuffer->paintBoxRel(x, y + hheight, width, height - hheight, COL_MENUCONTENT_PLUS_0);
|
||||
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_LARGE, CORNER_BOTTOM);//round
|
||||
|
||||
if (!(iconfile.empty()))
|
||||
{
|
||||
frameBuffer->paintIcon(iconfile, x + 8, y + 5);
|
||||
iconoffset = 28;
|
||||
frameBuffer->getIconSize(iconfile.c_str(), &icol_w, &icol_h);
|
||||
frameBuffer->paintIcon(iconfile, x + 8, y, hheight);
|
||||
iconoffset = icol_w + 10;
|
||||
}
|
||||
else
|
||||
iconoffset = 0;
|
||||
@@ -580,7 +586,6 @@ void CStringInputSMS::initSMS(const char * const Valid_Chars)
|
||||
y = ((500-height)>>1);
|
||||
}
|
||||
|
||||
|
||||
void CStringInputSMS::NormalKeyPressed(const neutrino_msg_t key)
|
||||
{
|
||||
if (CRCInput::isNumeric(key))
|
||||
@@ -687,14 +692,23 @@ const struct button_label CStringInputSMSButtons[2] =
|
||||
|
||||
void CStringInputSMS::paint()
|
||||
{
|
||||
int icol_w, icol_h;
|
||||
int bh, bw, fh;
|
||||
|
||||
CStringInput::paint();
|
||||
|
||||
fh = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight();
|
||||
frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_RED, &icol_w, &icol_h);
|
||||
bh = std::max(fh, icol_h+4);
|
||||
bw = (width - 20) / 2;
|
||||
|
||||
frameBuffer->paintIcon(NEUTRINO_ICON_NUMERIC_PAD, x+20+140, y+ hheight+ mheight+ iheight* 3+ 30, 0, COL_MENUCONTENT);
|
||||
|
||||
frameBuffer->paintBoxRel(x,y+height-25, width,25, COL_MENUHEAD_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM);
|
||||
frameBuffer->paintHLine(x, x+width, y+height-25, COL_INFOBAR_SHADOW_PLUS_0);
|
||||
frameBuffer->paintBoxRel(x, y+height-bh, width, bh, COL_MENUHEAD_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM);
|
||||
//frameBuffer->paintHLine(x, x+width, y+height-25, COL_INFOBAR_SHADOW_PLUS_0);
|
||||
|
||||
::paintButtons(frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, x + 8, y+height-25+1, 230, 2, CStringInputSMSButtons);
|
||||
//::paintButtons(frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, x + 8, y+height-25+1, 230, 2, CStringInputSMSButtons);
|
||||
::paintButtons(frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, x + 10, y+height-bh, bw, bh, 2, CStringInputSMSButtons);
|
||||
}
|
||||
|
||||
void CPINInput::paintChar(int pos)
|
||||
|
Reference in New Issue
Block a user