Merge remote-tracking branch 'tuxbox/master'

* needs compile fixes
* needs additional tests, of course :-)
This commit is contained in:
Stefan Seyfried
2016-10-22 11:37:40 +02:00
346 changed files with 13372 additions and 6088 deletions

View File

@@ -28,7 +28,6 @@
#include <neutrino.h>
#include <gui/widget/buttons.h>
#include <gui/customcolor.h>
#include <system/settings.h>
#include <driver/stacktrace.h>
@@ -97,7 +96,7 @@ int paintButtons( const button_label_ext * const content,
int *wantedheight)
{
CFrameBuffer *frameBuffer = CFrameBuffer::getInstance();
Font * font = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL];
Font * font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_FOOT];
int cnt = count;
int x_footer = x;
int y_footer = y;
@@ -195,7 +194,7 @@ int paintButtons( const button_label_ext * const content,
//paint footer
if (w_footer > 0)
frameBuffer->paintBoxRel(x_footer, y_footer, w_footer, h_footer, COL_INFOBAR_SHADOW_PLUS_1, RADIUS_LARGE, CORNER_BOTTOM); //round
frameBuffer->paintBoxRel(x_footer, y_footer, w_footer, h_footer, COL_MENUFOOT_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM); //round
//baseline
@@ -221,12 +220,15 @@ int paintButtons( const button_label_ext * const content,
}
if (spacing >= 0)
{ /* add half of the inter-object space to the */
spacing /= count_labels; /* left and right (this might break vertical */
x_button += spacing / 2; /* alignment, but nobody is using this (yet) */
} /* and I'm don't know how it should work. */
{
int tmp = count_labels ? count_labels : 1;//avoid division by zero
/* add half of the inter-object space to the */
spacing /= tmp; /* left and right (this might break vertical */
x_button += spacing / 2; /* alignment, but nobody is using this (yet) */
} /* and I'm don't know how it should work. */
else
{
w_text = w_text ? w_text : 1;
/* shorten captions relative to their length */
for (int i = 0; i < cnt; i++)
fwidth[i] = (fwidth[i] * (w_text + spacing)) / w_text; /* spacing is negative...*/
@@ -247,7 +249,7 @@ int paintButtons( const button_label_ext * const content,
// paint icon and text
frameBuffer->paintIcon(icon, x_button , y_base - iconh[j]/2);
x_caption = x_button + iconw[j] + h_space;
font->RenderString(x_caption, y_caption, fwidth[j], caption, COL_INFOBAR_SHADOW_TEXT);
font->RenderString(x_caption, y_caption, fwidth[j], caption, COL_MENUFOOT_TEXT);
/* set next startposition x, if text is length=0 then offset is =renderwidth of icon,
* for generating buttons without captions,
@@ -281,7 +283,7 @@ int paintButtons( const button_label_ext * const content,
* stuff below here was obviously not tested recently
* vertical_paint optional, default value is false (horizontal) sets direction of painted buttons
* fcolor optional, default value is COL_INFOBAR_SHADOW_TEXT, use it to render font with other color
* fcolor optional, default value is COL_MENUFOOT_TEXT, use it to render font with other color
* alt_buttontext optional, default NULL, overwrites button caption at definied buttonlabel id (see parameter alt_buttontext_id) with this text
* alt_buttontext_id optional, default 0, means id from buttonlable struct which text you will change
* show optional, default value is true (show button), if false, then no show and return the height of the button.
@@ -303,7 +305,7 @@ int paintButtons( const int &x,
const std::vector<neutrino_locale_t>& /*all_buttontext_id*/)
{
CFrameBuffer *frameBuffer = CFrameBuffer::getInstance();
Font * font = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL];
Font * font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_FOOT];
uint cnt = count;
int x_footer = x;
int y_footer = y;
@@ -389,7 +391,7 @@ int paintButtons( const int &x,
//paint footer
if (w_footer > 0)
frameBuffer->paintBoxRel(x_footer, y_footer, w_footer, h_footer, COL_INFOBAR_SHADOW_PLUS_1, RADIUS_LARGE, CORNER_BOTTOM); //round
frameBuffer->paintBoxRel(x_footer, y_footer, w_footer, h_footer, COL_MENUFOOT_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM); //round
//baseline
@@ -410,8 +412,9 @@ int paintButtons( const int &x,
else
{
/* shorten captions relative to their length */
int tmp = w_text ? w_text : 1;//avoid division by zero
for (i = 0; i < cnt; i++)
fwidth[i] = (fwidth[i] * (w_text + spacing)) / w_text; /* spacing is negative...*/
fwidth[i] = (fwidth[i] * (w_text + spacing)) / tmp; /* spacing is negative...*/
spacing = 0;
}

View File

@@ -83,7 +83,7 @@ int paintButtons( const int &x,
const int &footerheight = 0,
std::string tmp = "", /* just to make sure compilation breaks */
bool vertical_paint = false,
const uint32_t fcolor = COL_INFOBAR_SHADOW_TEXT,
const uint32_t fcolor = COL_MENUFOOT_TEXT,
const char * alt_buttontext = NULL,
const uint &buttontext_id = 0,
bool show = true,

View File

@@ -229,17 +229,16 @@ int CColorChooser::exec(CMenuTarget* parent, const std::string &)
*value[VALUE_ALPHA] = a_alt;
loop = false;
break;
case CRCInput::RC_sat:
case CRCInput::RC_favorites:
break;
case CRCInput::RC_timeout:
case CRCInput::RC_ok:
loop = false;
break;
default:
if ( CNeutrinoApp::getInstance()->handleMsg( msg, data ) & messages_return::cancel_all )
if (CNeutrinoApp::getInstance()->listModeKey(msg))
{
break;
}
else if ( CNeutrinoApp::getInstance()->handleMsg( msg, data ) & messages_return::cancel_all )
{
loop = false;
res = menu_return::RETURN_EXIT_ALL;

View File

@@ -174,10 +174,10 @@ void CHintBox::refresh(void)
return;
}
//window->paintBoxRel(borderwidth, height, width, borderwidth, COL_INFOBAR_SHADOW_PLUS_0);
//window->paintBoxRel(width, borderwidth, borderwidth, height - borderwidth, COL_INFOBAR_SHADOW_PLUS_0);
window->paintBoxRel(width - 20, borderwidth, borderwidth + 20, height - borderwidth - 20, COL_INFOBAR_SHADOW_PLUS_0, RADIUS_LARGE, CORNER_TOP); // right
window->paintBoxRel(borderwidth, height-20, width, borderwidth+20, COL_INFOBAR_SHADOW_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM); // bottom
//window->paintBoxRel(borderwidth, height, width, borderwidth, COL_SHADOW_PLUS_0);
//window->paintBoxRel(width, borderwidth, borderwidth, height - borderwidth, COL_SHADOW_PLUS_0);
window->paintBoxRel(width - 20, borderwidth, borderwidth + 20, height - borderwidth - 20, COL_SHADOW_PLUS_0, RADIUS_LARGE, CORNER_TOP); // right
window->paintBoxRel(borderwidth, height-20, width, borderwidth+20, COL_SHADOW_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM); // bottom
CComponentsHeader header(window->x, window->y, width, theight, caption, iconfile);
header.paint(CC_SAVE_SCREEN_NO);
@@ -210,9 +210,9 @@ void CHintBox::refresh(void)
if (entries_per_page < line.size())
{
ypos = theight + (fheight >> 1);
window->paintBoxRel(width - 15, ypos , 15, entries_per_page * fheight, COL_MENUCONTENT_PLUS_1);
window->paintBoxRel(width - 15, ypos, 15, entries_per_page * fheight, COL_SCROLLBAR_PASSIVE_PLUS_0);
unsigned int marker_size = (entries_per_page * fheight) / ((line.size() + entries_per_page - 1) / entries_per_page);
window->paintBoxRel(width - 13, ypos + current_page * marker_size, 11, marker_size , COL_MENUCONTENT_PLUS_3);
window->paintBoxRel(width - 13, ypos + current_page * marker_size, 11, marker_size, COL_SCROLLBAR_ACTIVE_PLUS_0);
}
}
@@ -290,7 +290,8 @@ int ShowHint(const char * const Caption, const char * const Text, const int Widt
else
hintBox->scroll_down();
}
else if((msg == CRCInput::RC_sat) || (msg == CRCInput::RC_favorites)) {
else if (CNeutrinoApp::getInstance()->listModeKey(msg)) {
// do nothing
}
else if(msg == CRCInput::RC_mode) {
res = messages_return::handled;

View File

@@ -47,9 +47,7 @@ CHintBoxExt::CHintBoxExt(const neutrino_locale_t Caption, const char * const Tex
{
m_message = strdup(Text);
char *begin = m_message;
begin = strtok(m_message, "\n");
char *begin = strtok(m_message, "\n");
while (begin != NULL)
{
std::vector<Drawable*> oneLine;
@@ -67,9 +65,7 @@ CHintBoxExt::CHintBoxExt(const std::string &CaptionString, const char * const Te
{
m_message = strdup(Text);
char *begin = m_message;
begin = strtok(m_message, "\n");
char *begin = strtok(m_message, "\n");
while (begin != NULL)
{
std::vector<Drawable*> oneLine;
@@ -203,7 +199,7 @@ void CHintBoxExt::init(const neutrino_locale_t Caption, const std::string &Capti
// printf("pages: %d, startEntryVec: %d\n",page+1,m_startEntryOfPage.size()-1);
// printf("maxEntries: %d\n", m_maxEntriesPerPage);
m_width = w_max(maxWidth,SHADOW_OFFSET);
m_width = w_max(maxWidth,OFFSET_SHADOW);
m_currentPage = 0;
m_pages = page + 1;
unsigned int additional_width;
@@ -231,7 +227,7 @@ void CHintBoxExt::init(const neutrino_locale_t Caption, const std::string &Capti
/* if the output does not fit, make sure we at least
* stay inside the screen... */
m_width = w_max(m_width ,SHADOW_OFFSET);
m_width = w_max(m_width ,OFFSET_SHADOW);
if (maxLineWidth + scrollWidth > m_width)
maxLineWidth = m_width - scrollWidth;
@@ -254,10 +250,10 @@ void CHintBoxExt::paint(bool toround)
}
bgPainted = false;
m_window = new CFBWindow(getScreenStartX(m_width + SHADOW_OFFSET),
getScreenStartY(m_height + SHADOW_OFFSET),
m_width + SHADOW_OFFSET,
m_height + SHADOW_OFFSET);
m_window = new CFBWindow(getScreenStartX(m_width + OFFSET_SHADOW),
getScreenStartY(m_height + OFFSET_SHADOW),
m_width + OFFSET_SHADOW,
m_height + OFFSET_SHADOW);
refresh(toround);
}
@@ -271,7 +267,7 @@ void CHintBoxExt::refresh(bool toround)
if (!bgPainted) {
// bottom, right shadow
m_window->paintBoxRel(SHADOW_OFFSET, SHADOW_OFFSET, m_width, m_height, COL_INFOBAR_SHADOW_PLUS_0, RADIUS_LARGE, toround ? CORNER_ALL : CORNER_BOTTOM | CORNER_TOP_RIGHT);
m_window->paintBoxRel(OFFSET_SHADOW, OFFSET_SHADOW, m_width, m_height, COL_SHADOW_PLUS_0, RADIUS_LARGE, toround ? CORNER_ALL : CORNER_BOTTOM | CORNER_TOP_RIGHT);
bgPainted = true;
}
@@ -343,9 +339,9 @@ void CHintBoxExt::refresh(bool toround)
{
// yPos = m_theight + (m_fheight >> 1);
yPos = m_theight;
m_window->paintBoxRel(m_width - 15, yPos, 15, m_maxEntriesPerPage * m_fheight, COL_MENUCONTENT_PLUS_1);
m_window->paintBoxRel(m_width - 15, yPos, 15, m_maxEntriesPerPage * m_fheight, COL_SCROLLBAR_PASSIVE_PLUS_0);
unsigned int marker_size = (m_maxEntriesPerPage * m_fheight) / m_pages;
m_window->paintBoxRel(m_width - 13, yPos + m_currentPage * marker_size, 11, marker_size, COL_MENUCONTENT_PLUS_3);
m_window->paintBoxRel(m_width - 13, yPos + m_currentPage * marker_size, 11, marker_size, COL_SCROLLBAR_ACTIVE_PLUS_0);
}
}

View File

@@ -179,6 +179,9 @@
#define NEUTRINO_ICON_RECORDING_EVENT_MARKER "rec_event_marker"
#define NEUTRINO_ICON_ZAP "zap"
#define NEUTRINO_ICON_PIP "pip"
#define NEUTRINO_ICON_STAR_ON "star-on"
#define NEUTRINO_ICON_STAR_OFF "star-off"
#define NEUTRINO_ICON_TMDB "tmdb"
#define DUMMY_ICON "dummy"
@@ -204,6 +207,7 @@
#define NEUTRINO_ICON_HINT_SHUTDOWN "hint_shutdown"
#define NEUTRINO_ICON_HINT_INFO "hint_info"
#define NEUTRINO_ICON_HINT_CI "hint_ci"
#define NEUTRINO_ICON_HINT_ADZAP "hint_adzap"
/* media */
#define NEUTRINO_ICON_HINT_APLAY "hint_aplay"
#define NEUTRINO_ICON_HINT_INET_RADIO "hint_inetradio"

View File

@@ -530,9 +530,9 @@ int CKeyboardInput::exec(CMenuTarget* parent, const std::string &)
fb_pixel_t * pixbuf = NULL;
if (!parent) {
pixbuf = new fb_pixel_t[(width + SHADOW_OFFSET) * (height + SHADOW_OFFSET)];
pixbuf = new fb_pixel_t[(width + OFFSET_SHADOW) * (height + OFFSET_SHADOW)];
if (pixbuf)
frameBuffer->SaveScreen(x, y, width + SHADOW_OFFSET, height + SHADOW_OFFSET, pixbuf);
frameBuffer->SaveScreen(x, y, width + OFFSET_SHADOW, height + OFFSET_SHADOW, pixbuf);
}
paint();
@@ -610,8 +610,9 @@ int CKeyboardInput::exec(CMenuTarget* parent, const std::string &)
loop = false;
res = menu_return::RETURN_EXIT_REPAINT;
}
else if ((msg ==CRCInput::RC_sat) || (msg == CRCInput::RC_favorites))
else if (CNeutrinoApp::getInstance()->listModeKey(msg))
{
// do nothing
}
else
{
@@ -625,7 +626,7 @@ int CKeyboardInput::exec(CMenuTarget* parent, const std::string &)
if (pixbuf)
{
frameBuffer->RestoreScreen(x, y, width + SHADOW_OFFSET, height + SHADOW_OFFSET, pixbuf);
frameBuffer->RestoreScreen(x, y, width + OFFSET_SHADOW, height + OFFSET_SHADOW, pixbuf);
delete[] pixbuf;
} else
hide();
@@ -643,7 +644,7 @@ int CKeyboardInput::exec(CMenuTarget* parent, const std::string &)
void CKeyboardInput::hide()
{
frameBuffer->paintBackgroundBoxRel(x, y, width + SHADOW_OFFSET, height + SHADOW_OFFSET);
frameBuffer->paintBackgroundBoxRel(x, y, width + OFFSET_SHADOW, height + OFFSET_SHADOW);
}
int CKeyboardInput::paintFooter(bool show)
@@ -667,7 +668,7 @@ int CKeyboardInput::paintFooter(bool show)
void CKeyboardInput::paint()
{
frameBuffer->paintBoxRel(x + SHADOW_OFFSET, y + SHADOW_OFFSET, width, height, COL_MENUCONTENTDARK_PLUS_0, RADIUS_LARGE, CORNER_ALL); //round
frameBuffer->paintBoxRel(x + OFFSET_SHADOW, y + OFFSET_SHADOW, width, height, COL_SHADOW_PLUS_0, RADIUS_LARGE, CORNER_ALL); //round
frameBuffer->paintBoxRel(x, y + hheight, width, bheight, COL_MENUCONTENT_PLUS_0);
CComponentsHeader header(x, y, width, hheight, head, iconfile);
@@ -714,19 +715,10 @@ void CKeyboardInput::paintChar(int pos, std::string &c)
fb_pixel_t color;
fb_pixel_t bgcolor;
if (pos == selected)
{
color = COL_MENUCONTENTSELECTED_TEXT;
bgcolor = COL_MENUCONTENTSELECTED_PLUS_0;
}
else
{
color = COL_MENUCONTENT_TEXT;
bgcolor = COL_MENUCONTENT_PLUS_0;
}
getItemColors(color, bgcolor, pos == selected);
frameBuffer->paintBoxRel(xpos, ypos, input_w, input_h, COL_MENUCONTENT_PLUS_2);
frameBuffer->paintBoxRel(xpos+ 1, ypos+ 1, input_w- 2, input_h- 2, bgcolor);
frameBuffer->paintBoxRel(xpos, ypos, input_w, input_h, bgcolor);
frameBuffer->paintBoxFrame(xpos, ypos, input_w, input_h, 1, COL_MENUCONTENT_PLUS_2);
int ch_w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(c);
int ch_x = xpos + std::max(input_w/2 - ch_w/2, 0);
@@ -748,19 +740,16 @@ void CKeyboardInput::paintKey(int row, int column)
//key_y = y+ hheight+ offset+ input_h+ offset;
int ypos = key_y + (key_h + KEY_BORDER)*row;
int i_selected = (focus == FOCUS_KEY && row == srow && column == scol);
fb_pixel_t color;
fb_pixel_t bgcolor;
if (focus == FOCUS_KEY && row == srow && column == scol) {
color = COL_MENUCONTENTSELECTED_TEXT;
bgcolor = COL_MENUCONTENTSELECTED_PLUS_0;
} else {
color = COL_MENUCONTENT_TEXT;
bgcolor = COL_MENUCONTENT_PLUS_0;
}
int radius = CORNER_RADIUS_SMALL;
getItemColors(color, bgcolor, i_selected);
int radius = RADIUS_SMALL;
frameBuffer->paintBoxRel(xpos, ypos, key_w, key_h, bgcolor, radius);
frameBuffer->paintBoxFrame(xpos, ypos, key_w, key_h, KEY_FRAME_WIDTH, COL_MENUCONTENT_PLUS_6, radius);
frameBuffer->paintBoxFrame(xpos, ypos, key_w, key_h, KEY_FRAME_WIDTH, COL_FRAME_PLUS_0, radius);
if (keyboard[row][column].empty())
return;

View File

@@ -68,14 +68,14 @@ void CListBox::paint()
int ypos = y+ theight;
int sb = fheight* listmaxshow;
frameBuffer->paintBoxRel(x+ width- 15,ypos, 15, sb, COL_MENUCONTENT_PLUS_1);
frameBuffer->paintBoxRel(x+ width- 15,ypos, 15, sb, COL_SCROLLBAR_PASSIVE_PLUS_0);
int sbc= ((getItemCount()- 1)/ listmaxshow)+ 1;
int sbs= (selected/listmaxshow);
if (sbc < 1)
sbc = 1;
frameBuffer->paintBoxRel(x+ width- 13, ypos+ 2+ sbs * (sb-4)/sbc, 11, (sb-4)/sbc, COL_MENUCONTENT_PLUS_3);
frameBuffer->paintBoxRel(x+ width- 13, ypos+ 2+ sbs * (sb-4)/sbc, 11, (sb-4)/sbc, COL_SCROLLBAR_ACTIVE_PLUS_0);
}
void CListBox::paintHead()
@@ -125,16 +125,7 @@ void CListBox::paintItem(unsigned int /*itemNr*/, int paintNr, bool pselected)
fb_pixel_t color;
fb_pixel_t bgcolor;
if (pselected)
{
color = COL_MENUCONTENTSELECTED_TEXT;
bgcolor = COL_MENUCONTENTSELECTED_PLUS_0;
}
else
{
color = COL_MENUCONTENT_TEXT;
bgcolor = COL_MENUCONTENT_PLUS_0;
}
getItemColors(color, bgcolor, pselected);
frameBuffer->paintBoxRel(x,ypos, width- 15, getItemHeight(), bgcolor);
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + 10, ypos+ fheight, width-20, "demo", color);
@@ -221,13 +212,13 @@ int CListBox::exec(CMenuTarget* parent, const std::string & /*actionKey*/)
{
onBlueKeyPressed();
}
else if ((msg ==CRCInput::RC_sat) || (msg == CRCInput::RC_favorites))
else if (CNeutrinoApp::getInstance()->listModeKey(msg))
{
// do nothing
}
else
{
CNeutrinoApp::getInstance()->handleMsg( msg, data );
// kein canceling...
}
}

View File

@@ -66,17 +66,11 @@
#define MIN_WINDOW_WIDTH (frameBuffer->getScreenWidth() >> 1)
#define MIN_WINDOW_HEIGHT 40
#define TITLE_BACKGROUND_COLOR ((CFBWindow::color_t)COL_MENUHEAD_PLUS_0)
#define HEADER_LIST_BACKGROUND_COLOR ((CFBWindow::color_t)COL_MENUCONTENT_PLUS_0)
#define LIST_BACKGROUND_COLOR ((CFBWindow::color_t)COL_MENUCONTENT_PLUS_0)
//#define LIST_BACKGROUND_COLOR_SELECTED ((CFBWindow::color_t)COL_MENUCONTENT_PLUS_1)
#define LIST_BACKGROUND_COLOR_SELECTED ((CFBWindow::color_t)COL_MENUCONTENTSELECTED_PLUS_0)
#define TITLE_BACKGROUND_COLOR COL_MENUHEAD_PLUS_0
#define TITLE_FONT_COLOR COL_MENUHEAD_TEXT
#define HEADER_LIST_BACKGROUND_COLOR COL_MENUCONTENT_PLUS_0
#define HEADER_LIST_FONT_COLOR COL_MENUCONTENT_TEXT
#define LIST_FONT_COLOR COL_MENUCONTENT_TEXT
//#define LIST_FONT_COLOR_SELECTED COL_MENUCONTENT_TEXT
#define LIST_FONT_COLOR_SELECTED COL_MENUCONTENTSELECTED_TEXT
#define FONT_LIST g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO2]
#define FONT_HEADER_LIST g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO1]
@@ -377,12 +371,12 @@ void CListFrame::refreshScroll(void)
if (m_nNrOfPages > 1)
{
frameBuffer->paintBoxRel(m_cFrameScrollRel.iX+m_cFrame.iX, m_cFrameScrollRel.iY+m_cFrame.iY,
m_cFrameScrollRel.iWidth, m_cFrameScrollRel.iHeight, COL_MENUCONTENT_PLUS_1);
m_cFrameScrollRel.iWidth, m_cFrameScrollRel.iHeight, COL_SCROLLBAR_PASSIVE_PLUS_0);
unsigned int marker_size = m_cFrameScrollRel.iHeight / m_nNrOfPages;
frameBuffer->paintBoxRel(m_cFrameScrollRel.iX + SCROLL_MARKER_BORDER+m_cFrame.iX,
m_cFrameScrollRel.iY + m_nCurrentPage * marker_size +m_cFrame.iY,
m_cFrameScrollRel.iWidth - (2*SCROLL_MARKER_BORDER),
marker_size, COL_MENUCONTENT_PLUS_3);
marker_size, COL_SCROLLBAR_ACTIVE_PLUS_0);
}
else
{
@@ -410,7 +404,7 @@ void CListFrame::refreshList(void)
//TRACE("[CListFrame]->refreshList: %d\r\n",m_nCurrentLine);
if( frameBuffer == NULL) return;
frameBuffer->paintBoxRel(m_cFrameListRel.iX+m_cFrame.iX, m_cFrameListRel.iY+m_cFrame.iY,
m_cFrameListRel.iWidth, m_cFrameListRel.iHeight, LIST_BACKGROUND_COLOR);
m_cFrameListRel.iWidth, m_cFrameListRel.iHeight, COL_MENUCONTENT_PLUS_0);
if( m_nNrOfLines <= 0)
return;
@@ -432,27 +426,19 @@ void CListFrame::refreshLine(int line)
if((line < m_nCurrentLine) && (line > m_nCurrentLine + m_nLinesPerPage))
return;
uint32_t color, bgcolor;
fb_pixel_t color, bgcolor;
int rel_line = line - m_nCurrentLine;
int y = m_cFrameListRel.iY + TEXT_BORDER_WIDTH + (rel_line*m_nFontListHeight);
int radius = 0;
bool selected = (line == m_nSelectedLine && m_showSelection == true);
bool marked = (!m_pLines->marked.empty() && m_pLines->marked[line]);
if(line == m_nSelectedLine && m_showSelection == true)
{
color = marked ? COL_MENUCONTENTINACTIVE_TEXT : LIST_FONT_COLOR_SELECTED;
bgcolor = marked ? COL_MENUCONTENTSELECTED_PLUS_2 : LIST_BACKGROUND_COLOR_SELECTED;
getItemColors(color, bgcolor, selected, marked);
if (selected || marked)
radius = RADIUS_LARGE;
}
else if (marked) {
color = COL_MENUCONTENT_TEXT;
bgcolor = COL_MENUCONTENT_PLUS_2;
}
else
{
color = LIST_FONT_COLOR;
bgcolor = LIST_BACKGROUND_COLOR;
}
frameBuffer->paintBoxRel(m_cFrameListRel.iX+m_cFrame.iX, y+m_cFrame.iY,
m_cFrameListRel.iWidth, m_nFontListHeight, bgcolor, radius);

View File

@@ -253,7 +253,7 @@ void CMenuItem::paintItemCaption(const bool select_mode, const char * right_text
fb_pixel_t right_frame_col, right_bg_col;
if (active) {
right_bg_col = right_bgcol;
right_frame_col = COL_MENUCONTENT_PLUS_6;
right_frame_col = COL_FRAME_PLUS_0;
}
else {
right_bg_col = COL_MENUCONTENTINACTIVE_TEXT;
@@ -261,7 +261,7 @@ void CMenuItem::paintItemCaption(const bool select_mode, const char * right_text
}
CComponentsShapeSquare col(stringstartposOption, y + 2, dx - stringstartposOption + x - 2, item_height - 4, NULL, false, right_frame_col, right_bg_col);
col.setFrameThickness(3);
col.setCorner(RADIUS_LARGE);
col.setCorner(RADIUS_SMALL);
col.paint(false);
}
if (*right_text) {
@@ -379,7 +379,7 @@ void CMenuItem::paintItemButton(const bool select_mode, int item_height, const c
if (icon_w>0 && icon_h>0)
{
icon_painted = frameBuffer->paintIcon(iconName_Info_right, dx + icon_start_x - (icon_w + 20), y+ ((item_height/2- icon_h/2)) );
frameBuffer->paintIcon(iconName_Info_right, dx + icon_start_x - (icon_w + 20), y+ ((item_height/2- icon_h/2)) );
}
}
}
@@ -677,8 +677,10 @@ void CMenuWidget::resetWidget(bool delete_items)
{
for(unsigned int count=0;count<items.size();count++) {
CMenuItem * item = items[count];
if (delete_items && !item->isStatic)
if (delete_items && !item->isStatic){
delete item;
item = NULL;
}
}
items.clear();
@@ -811,6 +813,10 @@ int CMenuWidget::exec(CMenuTarget* parent, const std::string &)
if (titem->isSelectable()) {
items[selected]->paint( false );
selected= i;
if (selected > page_start[current_page + 1] || selected < page_start[current_page]) {
/* different page */
paintItems();
}
paintHint(selected);
pos = selected;
if (titem->directKeyOK)
@@ -959,12 +965,8 @@ int CMenuWidget::exec(CMenuTarget* parent, const std::string &)
break;
case (CRCInput::RC_timeout):
break;
case (CRCInput::RC_sat):
case (CRCInput::RC_favorites):
g_RCInput->postMsg (msg, 0);
//close any menue on dbox-key
case (CRCInput::RC_setup):
//close any menu on menu-key
{
msg = CRCInput::RC_timeout;
retval = menu_return::RETURN_EXIT_ALL;
@@ -981,7 +983,12 @@ int CMenuWidget::exec(CMenuTarget* parent, const std::string &)
break;
default:
if ( CNeutrinoApp::getInstance()->handleMsg( msg, data ) & messages_return::cancel_all ) {
if (CNeutrinoApp::getInstance()->listModeKey(msg)) {
g_RCInput->postMsg (msg, 0);
retval = menu_return::RETURN_EXIT_ALL;
msg = CRCInput::RC_timeout;
}
else if ( CNeutrinoApp::getInstance()->handleMsg( msg, data ) & messages_return::cancel_all ) {
retval = menu_return::RETURN_EXIT_ALL;
msg = CRCInput::RC_timeout;
}
@@ -1184,8 +1191,8 @@ void CMenuWidget::calcSize()
if(total_pages > 1)
sb_width=15;
full_width = /*ConnectLineBox_Width+*/width+sb_width+SHADOW_OFFSET;
full_height = height+RADIUS_LARGE+SHADOW_OFFSET*2 /*+hint_height+INFO_BOX_Y_OFFSET*/;
full_width = /*ConnectLineBox_Width+*/width+sb_width+OFFSET_SHADOW;
full_height = height+RADIUS_LARGE+OFFSET_SHADOW*2 /*+hint_height+OFFSET_INTER*/;
/* + ConnectLineBox_Width for the hintbox connection line
* + center_offset for symmetry
* + 20 for setMenuPos calculates 10 pixels border left and right */
@@ -1193,7 +1200,7 @@ void CMenuWidget::calcSize()
int max_possible = (int)frameBuffer->getScreenWidth() - ConnectLineBox_Width - center_offset - 20;
if (full_width > max_possible)
{
width = max_possible - sb_width - SHADOW_OFFSET;
width = max_possible - sb_width - OFFSET_SHADOW;
full_width = max_possible + center_offset; /* symmetry in MENU_POS_CENTER case */
}
@@ -1235,14 +1242,14 @@ void CMenuWidget::paint()
header->enableShadow(CC_SHADOW_RIGHT);
header->setOffset(10);
}
header->setColorBody(COL_MENUHEAD_PLUS_0);
header->setColorShadow(COL_MENUCONTENTDARK_PLUS_0);
header->setColorAll(COL_FRAME_PLUS_0, COL_MENUHEAD_PLUS_0, COL_SHADOW_PLUS_0);
header->setCaptionColor(COL_MENUHEAD_TEXT);
header->enableColBodyGradient(g_settings.theme.menu_Head_gradient, COL_MENUCONTENT_PLUS_0);
header->enableGradientBgCleanUp(savescreen);
header->paint(CC_SAVE_SCREEN_NO);
// paint body shadow
frameBuffer->paintBoxRel(x+SHADOW_OFFSET, y + hheight + SHADOW_OFFSET, width + sb_width, height - hheight + RADIUS_LARGE + (fbutton_count ? fbutton_height : 0), COL_MENUCONTENTDARK_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM);
frameBuffer->paintBoxRel(x+OFFSET_SHADOW, y + hheight + OFFSET_SHADOW, width + sb_width, height - hheight + RADIUS_LARGE + (fbutton_count ? fbutton_height : 0), COL_SHADOW_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM);
// paint body background
frameBuffer->paintBoxRel(x, y+hheight, width + sb_width, height-hheight + RADIUS_LARGE, COL_MENUCONTENT_PLUS_0, RADIUS_LARGE, (fbutton_count ? CORNER_NONE : CORNER_BOTTOM));
@@ -1302,9 +1309,9 @@ void CMenuWidget::paintItems()
//Item not currently on screen
if (selected >= 0)
{
while (selected < page_start[current_page])
while (current_page > 0 && selected < page_start[current_page])
current_page--;
while (selected >= page_start[current_page + 1])
while (current_page+1 < page_start.size() && selected >= page_start[current_page + 1])
current_page++;
}
@@ -1312,8 +1319,8 @@ void CMenuWidget::paintItems()
if(total_pages>1)
{
int item_height=height-(item_start_y-y);
frameBuffer->paintBoxRel(x+ width,item_start_y, 15, item_height, COL_MENUCONTENT_PLUS_1, RADIUS_MIN);
frameBuffer->paintBoxRel(x+ width +2, item_start_y+ 2+ current_page*(item_height-4)/total_pages, 11, (item_height-4)/total_pages, COL_MENUCONTENT_PLUS_3, RADIUS_MIN);
frameBuffer->paintBoxRel(x+ width,item_start_y, 15, item_height, COL_SCROLLBAR_PASSIVE_PLUS_0, RADIUS_MIN);
frameBuffer->paintBoxRel(x+ width +2, item_start_y+ 2+ current_page*(item_height-4)/total_pages, 11, (item_height-4)/total_pages, COL_SCROLLBAR_ACTIVE_PLUS_0, RADIUS_MIN);
/* background of menu items, paint every time because different items can have
* different height and this might leave artifacts otherwise after changing pages */
frameBuffer->paintBoxRel(x,item_start_y, width,item_height, COL_MENUCONTENT_PLUS_0);
@@ -1420,7 +1427,8 @@ void CMenuWidget::paintHint(int pos)
/* clear info box */
if ((info_box) && (pos < 0))
savescreen ? info_box->hide() : info_box->kill();
hint_painted = false;
if (info_box)
hint_painted = info_box->isPainted();
}
if (pos < 0)
return;
@@ -1430,7 +1438,7 @@ void CMenuWidget::paintHint(int pos)
if (!item->hintIcon && item->hint == NONEXISTANT_LOCALE && item->hintText.empty()) {
if (info_box) {
savescreen ? info_box->hide() : info_box->kill();
hint_painted = false;
hint_painted = info_box->isPainted();
}
return;
}
@@ -1441,15 +1449,15 @@ void CMenuWidget::paintHint(int pos)
int iheight = item->getHeight();
int rad = RADIUS_LARGE;
int xpos = x - ConnectLineBox_Width;
int ypos2 = y + height + fbutton_height + rad + SHADOW_OFFSET + INFO_BOX_Y_OFFSET;
int ypos2 = y + height + fbutton_height + rad + OFFSET_SHADOW + OFFSET_INTER;
int iwidth = width+sb_width;
//init details line and infobox dimensions
int ypos1 = item->getYPosition();
int ypos1a = ypos1 + (iheight/2)-2;
int ypos2a = ypos2 + (hint_height/2)-2;
int ypos1a = ypos1 + (iheight/2);
int ypos2a = ypos2 + (hint_height/2);
int markh = hint_height > rad*2 ? hint_height - rad*2 : hint_height;
int imarkh = iheight/2+1;
int imarkh = iheight/2;
//init details line
if (details_line == NULL)
@@ -1472,10 +1480,11 @@ void CMenuWidget::paintHint(int pos)
info_box->removeLineBreaks(str);
info_box->setText(str, CTextBox::AUTO_WIDTH, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT], COL_MENUCONTENT_TEXT);
info_box->setCorner(RADIUS_LARGE);
info_box->setColorAll(COL_MENUCONTENT_PLUS_6, COL_MENUCONTENTDARK_PLUS_0, COL_MENUCONTENTDARK_PLUS_0);
info_box->setColorAll(COL_FRAME_PLUS_0, COL_MENUCONTENTDARK_PLUS_0);
info_box->setTextColor(COL_MENUCONTENTDARK_TEXT);
info_box->enableShadow();
info_box->setPicture(item->hintIcon ? item->hintIcon : "");
info_box->enableColBodyGradient(g_settings.theme.menu_Hint_gradient, COL_INFOBAR_SHADOW_PLUS_1, g_settings.theme.menu_Hint_gradient_direction);// COL_INFOBAR_SHADOW_PLUS_1 is default footer color
info_box->enableColBodyGradient(g_settings.theme.menu_Hint_gradient, COL_MENUFOOT_PLUS_0, g_settings.theme.menu_Hint_gradient_direction);// COL_MENUFOOT_PLUS_0 is default footer color
//paint result
if (details_line)
@@ -1989,12 +1998,11 @@ int CMenuOptionChooser::paint( bool selected)
int CMenuOptionChooser::getWidth(void)
{
int ow = 0;
int tw = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(getName());
int width = tw;
for(unsigned int count = 0; count < options.size(); count++) {
ow = 0;
int ow = 0;
if (options[count].valname)
ow = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(options[count].valname);
else
@@ -2251,7 +2259,7 @@ CMenuSeparator::CMenuSeparator(const int Type, const neutrino_locale_t Text, boo
nameString = "";
}
CMenuSeparator::CMenuSeparator(const int Type, const std::string Text, bool IsStatic) : CMenuItem(false, CRCInput::RC_nokey, NULL, NULL, IsStatic)
CMenuSeparator::CMenuSeparator(const int Type, const std::string &Text, bool IsStatic) : CMenuItem(false, CRCInput::RC_nokey, NULL, NULL, IsStatic)
{
type = Type;
name = NONEXISTANT_LOCALE;

View File

@@ -190,7 +190,7 @@ class CMenuItem : public CComponentsSignals
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; }
void setHint(const char * const icon, const std::string &text) { hintIcon = (icon && *icon) ? icon : NULL; hintText = text; }
void setLua(lua_State *_luaState, std::string &_luaAction, std::string &_luaId) { luaState = _luaState; luaAction = _luaAction; luaId = _luaId; };
virtual const char *getName();
@@ -226,7 +226,7 @@ class CMenuSeparator : public CMenuItem
CMenuSeparator(const int Type = 0, const neutrino_locale_t Text = NONEXISTANT_LOCALE, bool IsStatic = false);
CMenuSeparator(const int Type, const std::string Text, bool IsStatic = false);
CMenuSeparator(const int Type, const std::string &Text, bool IsStatic = false);
virtual ~CMenuSeparator(){}
int paint(bool selected=false);

View File

@@ -73,9 +73,9 @@ void CMessageBox::Init(const CMessageBox::result_ &Default, const uint32_t ShowB
ih = std::max(h, ih);
i_maxw = std::max(w, i_maxw);
}
fh = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight();
b_height = std::max(fh, ih) + 8 + (RADIUS_LARGE / 2);
m_bbheight = b_height + fh/2 + ButtonSpacing;
fh = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_FOOT]->getHeight();
b_height = std::max(fh, ih) + 8 + (RADIUS_MID / 2);
m_bbheight = b_height + fh/2 + ButtonSpacing + OFFSET_SHADOW;
result = Default;
b_width = getButtonWidth();
if (ShowButtons & CMessageBox::mbBtnAlignCenter1)
@@ -131,7 +131,7 @@ int CMessageBox::getButtonWidth()
neutrino_locale_t localeMsg[localeMsgCount] = {LOCALE_MESSAGEBOX_YES, LOCALE_MESSAGEBOX_NO, LOCALE_MESSAGEBOX_CANCEL, LOCALE_MESSAGEBOX_OK, LOCALE_MESSAGEBOX_BACK};
int MaxButtonTextWidth = 0;
for (int i = 0; i < localeMsgCount; i++)
MaxButtonTextWidth = std::max(g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getRenderWidth(g_Locale->getText(localeMsg[i])), MaxButtonTextWidth);
MaxButtonTextWidth = std::max(g_Font[SNeutrinoSettings::FONT_TYPE_MENU_FOOT]->getRenderWidth(g_Locale->getText(localeMsg[i])), MaxButtonTextWidth);
return MaxButtonTextWidth + i_maxw + 36 + (RADIUS_LARGE / 2);
}
@@ -172,13 +172,15 @@ void CMessageBox::paintButtons()
color = COL_MENUCONTENTSELECTED_TEXT;
bgcolor = COL_MENUCONTENTSELECTED_PLUS_0;
} else {
color = COL_INFOBAR_SHADOW_TEXT;
bgcolor = COL_INFOBAR_SHADOW_PLUS_0;
color = COL_MENUCONTENTINACTIVE_TEXT;
bgcolor = COL_MENUCONTENTINACTIVE_PLUS_0;
}
CFrameBuffer::getInstance()->getIconSize(Buttons[i].icon, &iw, &ih);
m_window->paintBoxRel(xpos, ypos, b_width, b_height, (CFBWindow::color_t)bgcolor, RADIUS_LARGE);
m_window->paintBoxRel(xpos + OFFSET_SHADOW, ypos + OFFSET_SHADOW, b_width, b_height, COL_SHADOW_PLUS_0, RADIUS_MID);
m_window->paintBoxRel(xpos, ypos, b_width, b_height, (CFBWindow::color_t)bgcolor, RADIUS_MID);
m_window->paintBoxFrame(xpos, ypos, b_width, b_height, 1, COL_SHADOW_PLUS_0, RADIUS_MID);
m_window->paintIcon(Buttons[i].icon, xpos + ((b_height - ih) / 2), ypos + ((b_height - ih) / 2), ih);
m_window->RenderString(g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], xpos + iw + 17, ypos + fh + ((b_height - fh) / 2),
m_window->RenderString(g_Font[SNeutrinoSettings::FONT_TYPE_MENU_FOOT], xpos + iw + 17, ypos + fh + ((b_height - fh) / 2),
b_width - (iw + 21), Buttons[i].text, (CFBWindow::color_t)color);
xpos += b_width + ButtonDistance;
}
@@ -231,7 +233,7 @@ int CMessageBox::exec(int timeout)
result = mbrYes;
loop = false;
}
else if(msg==CRCInput::RC_right)
else if(msg==CRCInput::RC_right && ButtonCount > 1)
{
bool ok = false;
while (!ok)
@@ -255,7 +257,7 @@ int CMessageBox::exec(int timeout)
paintButtons();
}
}
else if(msg==CRCInput::RC_left)
else if(msg==CRCInput::RC_left && ButtonCount > 1)
{
bool ok = false;
while (!ok)
@@ -271,8 +273,9 @@ int CMessageBox::exec(int timeout)
{
loop = false;
}
else if((msg == CRCInput::RC_sat) || (msg == CRCInput::RC_favorites))
else if (CNeutrinoApp::getInstance()->listModeKey(msg) || (msg == CRCInput::RC_spkr))
{
// do nothing
}
else if (CNeutrinoApp::getInstance()->handleMsg(msg, data) & messages_return::cancel_all)
{
@@ -289,7 +292,10 @@ int CMessageBox::exec(int timeout)
int ShowMsg(const neutrino_locale_t Caption, const char * const Text, const CMessageBox::result_ &Default, const uint32_t ShowButtons, const char * const Icon, const int Width, const int timeout, bool returnDefaultOnTimeout)
{
CMessageBox* messageBox = new CMessageBox(Caption, Text, Width, Icon, Default, ShowButtons);
std::string tmpText = "msg error";
if(Text)
tmpText = Text;
CMessageBox* messageBox = new CMessageBox(Caption, tmpText.c_str(), Width, Icon, Default, ShowButtons);
messageBox->returnDefaultValueOnTimeout(returnDefaultOnTimeout);
messageBox->exec(timeout);
int res = messageBox->result;
@@ -300,7 +306,10 @@ int ShowMsg(const neutrino_locale_t Caption, const char * const Text, const CMes
int ShowMsg(const std::string &Caption, const char * const Text, const CMessageBox::result_ &Default, const uint32_t ShowButtons, const char * const Icon, const int Width, const int timeout, bool returnDefaultOnTimeout)
{
CMessageBox* messageBox = new CMessageBox(Caption, Text, Width, Icon, Default, ShowButtons);
std::string tmpText = "msg error";
if(Text)
tmpText = Text;
CMessageBox* messageBox = new CMessageBox(Caption, tmpText.c_str(), Width, Icon, Default, ShowButtons);
messageBox->returnDefaultValueOnTimeout(returnDefaultOnTimeout);
messageBox->exec(timeout);
int res = messageBox->result;

View File

@@ -67,7 +67,7 @@
#define MIN_WINDOW_HEIGHT 40
#define DEFAULT_TITLE_FONT g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]
#define DEFAULT_FOOT_FONT g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]
#define DEFAULT_FOOT_FONT g_Font[SNeutrinoSettings::FONT_TYPE_MENU_FOOT]
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
@@ -356,10 +356,12 @@ void CMsgBox::refreshFoot(void)
}
else
{
color = COL_INFOBAR_SHADOW_TEXT;
bgcolor = COL_INFOBAR_SHADOW_PLUS_0;
color = COL_MENUCONTENTINACTIVE_TEXT;
bgcolor = COL_MENUCONTENTINACTIVE_PLUS_0;
}
m_pcWindow->paintBoxRel(xpos+m_cBoxFrame.iX + OFFSET_SHADOW, m_cBoxFrameFootRel.iY + (ADD_FOOT_HEIGHT>>1)+m_cBoxFrame.iY + OFFSET_SHADOW, ButtonWidth, m_nFontFootHeight + 4, COL_SHADOW_PLUS_0, RADIUS_MID);
m_pcWindow->paintBoxRel(xpos+m_cBoxFrame.iX, m_cBoxFrameFootRel.iY + (ADD_FOOT_HEIGHT>>1)+m_cBoxFrame.iY, ButtonWidth, m_nFontFootHeight + 4, (CFBWindow::color_t)bgcolor, RADIUS_MID);
m_pcWindow->paintBoxFrame(xpos+m_cBoxFrame.iX, m_cBoxFrameFootRel.iY + (ADD_FOOT_HEIGHT>>1)+m_cBoxFrame.iY, ButtonWidth, m_nFontFootHeight + 4, 1, COL_SHADOW_PLUS_0, RADIUS_MID);
m_pcWindow->paintIcon(NEUTRINO_ICON_BUTTON_RED, xpos + 14+m_cBoxFrame.iX, m_cBoxFrameFootRel.iY + (ADD_FOOT_HEIGHT>>1)+m_cBoxFrame.iY);
/*m_pcWindow->RenderString(*/
m_pcFontFoot->RenderString(xpos + 43+m_cBoxFrame.iX, m_cBoxFrameFootRel.iY + m_nFontFootHeight + 4 + (ADD_FOOT_HEIGHT>>1)+m_cBoxFrame.iY, ButtonWidth - 53, g_Locale->getText(LOCALE_MESSAGEBOX_YES), (CFBWindow::color_t)color);
@@ -377,11 +379,12 @@ void CMsgBox::refreshFoot(void)
}
else
{
color = COL_INFOBAR_SHADOW_TEXT;
bgcolor = COL_INFOBAR_SHADOW_PLUS_0;
color = COL_MENUCONTENTINACTIVE_TEXT;
bgcolor = COL_MENUCONTENTINACTIVE_PLUS_0;
}
m_pcWindow->paintBoxRel(xpos+m_cBoxFrame.iX + OFFSET_SHADOW, m_cBoxFrameFootRel.iY + (ADD_FOOT_HEIGHT>>1)+m_cBoxFrame.iY + OFFSET_SHADOW, ButtonWidth, m_nFontFootHeight + 4, COL_SHADOW_PLUS_0, RADIUS_MID);
m_pcWindow->paintBoxRel(xpos+m_cBoxFrame.iX, m_cBoxFrameFootRel.iY + (ADD_FOOT_HEIGHT>>1)+m_cBoxFrame.iY, ButtonWidth, m_nFontFootHeight + 4, (CFBWindow::color_t)bgcolor, RADIUS_MID);
m_pcWindow->paintBoxFrame(xpos+m_cBoxFrame.iX, m_cBoxFrameFootRel.iY + (ADD_FOOT_HEIGHT>>1)+m_cBoxFrame.iY, ButtonWidth, m_nFontFootHeight + 4, 1, COL_SHADOW_PLUS_0, RADIUS_MID);
m_pcWindow->paintIcon(NEUTRINO_ICON_BUTTON_GREEN, xpos + 14+m_cBoxFrame.iX, m_cBoxFrameFootRel.iY + (ADD_FOOT_HEIGHT>>1)+m_cBoxFrame.iY);
/*m_pcWindow->RenderString(*/
m_pcFontFoot->RenderString(xpos + 43+m_cBoxFrame.iX, m_cBoxFrameFootRel.iY + m_nFontFootHeight + 4 + (ADD_FOOT_HEIGHT>>1)+m_cBoxFrame.iY, ButtonWidth- 53, g_Locale->getText(LOCALE_MESSAGEBOX_NO), (CFBWindow::color_t)color);
@@ -399,11 +402,12 @@ void CMsgBox::refreshFoot(void)
}
else
{
color = COL_INFOBAR_SHADOW_TEXT;
bgcolor = COL_INFOBAR_SHADOW_PLUS_0;
color = COL_MENUCONTENTINACTIVE_TEXT;
bgcolor = COL_MENUCONTENTINACTIVE_PLUS_0;
}
m_pcWindow->paintBoxRel(xpos+m_cBoxFrame.iX + OFFSET_SHADOW, m_cBoxFrameFootRel.iY + (ADD_FOOT_HEIGHT>>1)+m_cBoxFrame.iY + OFFSET_SHADOW, ButtonWidth, m_nFontFootHeight + 4, COL_SHADOW_PLUS_0, RADIUS_MID);
m_pcWindow->paintBoxRel(xpos+m_cBoxFrame.iX, m_cBoxFrameFootRel.iY + (ADD_FOOT_HEIGHT>>1)+m_cBoxFrame.iY, ButtonWidth, m_nFontFootHeight + 4, (CFBWindow::color_t)bgcolor, RADIUS_MID);
m_pcWindow->paintBoxFrame(xpos+m_cBoxFrame.iX, m_cBoxFrameFootRel.iY + (ADD_FOOT_HEIGHT>>1)+m_cBoxFrame.iY, ButtonWidth, m_nFontFootHeight + 4, 1, COL_SHADOW_PLUS_0, RADIUS_MID);
m_pcWindow->paintIcon(NEUTRINO_ICON_BUTTON_HOME, xpos+10+m_cBoxFrame.iX, m_cBoxFrameFootRel.iY + (ADD_FOOT_HEIGHT>>1)+m_cBoxFrame.iY);
/*m_pcWindow->RenderString(*/
m_pcFontFoot->RenderString(xpos + 43+m_cBoxFrame.iX, m_cBoxFrameFootRel.iY + m_nFontFootHeight + 2 + (ADD_FOOT_HEIGHT>>1)+m_cBoxFrame.iY, ButtonWidth- 53, g_Locale->getText((m_nFootButtons & mbCancel) ? LOCALE_MESSAGEBOX_CANCEL : LOCALE_MESSAGEBOX_BACK), (CFBWindow::color_t)color);
@@ -480,7 +484,7 @@ void CMsgBox::refreshBorder(void)
m_cBoxFrame.iHeight - m_nWindowFrameBorderWidth+m_cBoxFrame.iY - RADIUS_LARGE,
m_cBoxFrame.iWidth - m_nWindowFrameBorderWidth - RADIUS_LARGE,
m_nWindowFrameBorderWidth + RADIUS_LARGE,
COL_INFOBAR_SHADOW_PLUS_0,
COL_SHADOW_PLUS_0,
RADIUS_LARGE, CORNER_BOTTOM_LEFT);
//draw right shadow
@@ -488,7 +492,7 @@ void CMsgBox::refreshBorder(void)
m_nWindowFrameBorderWidth+m_cBoxFrame.iY,
m_nWindowFrameBorderWidth + RADIUS_LARGE,
m_cBoxFrame.iHeight - m_nWindowFrameBorderWidth,
COL_INFOBAR_SHADOW_PLUS_0,
COL_SHADOW_PLUS_0,
RADIUS_LARGE, CORNER_RIGHT);
}
@@ -619,6 +623,13 @@ void CMsgBox::refresh(void)
refreshTitle();
refreshFoot();
//draw body
m_pcWindow->paintBoxRel( m_cBoxFrameText.iX,
m_cBoxFrameText.iY,
m_cBoxFrameText.iWidth,
m_cBoxFrameText.iHeight,
COL_MENUCONTENT_PLUS_0);
// rep-draw textbox if there is one
if(m_pcTextBox != NULL)
{
@@ -719,8 +730,9 @@ int CMsgBox::exec( int timeout, int returnDefaultOnTimeout)
{
loop = false;
}
else if ((msg ==CRCInput::RC_sat) || (msg == CRCInput::RC_favorites))
else if (CNeutrinoApp::getInstance()->listModeKey(msg))
{
// do nothing
}
else if (CNeutrinoApp::getInstance()->handleMsg(msg, data) & messages_return::cancel_all)
{
@@ -750,7 +762,6 @@ bool CMsgBox::setText(const std::string* newText)
// update text in textbox if there is one
if(m_pcTextBox != NULL && newText != NULL)
{
lresult = m_pcTextBox->setText(newText);
if(m_nMode & AUTO_WIDTH || m_nMode & AUTO_HIGH)
{
/* window might changed in size ...*/
@@ -768,6 +779,8 @@ bool CMsgBox::setText(const std::string* newText)
m_cBoxFrame.iY = g_settings.screen_StartY + ((g_settings.screen_EndY - g_settings.screen_StartY - m_cBoxFrame.iHeight) >>1);
}
}
lresult = m_pcTextBox->setText(newText);
}
return(lresult);

View File

@@ -69,9 +69,9 @@ void CProgressWindow::Init()
local_bar->allowPaint(false);
local_bar->setDimensionsAll(x_item, y_item, w_item, h_pbar);
local_bar->setColorBody(col_body);
local_bar->setActiveColor(COL_MENUCONTENT_PLUS_7);
local_bar->setActiveColor(COL_PROGRESSBAR_ACTIVE_PLUS_0);
local_bar->setFrameThickness(w_bar_frame);
local_bar->setColorFrame(COL_MENUCONTENT_PLUS_7);
local_bar->setColorFrame(COL_PROGRESSBAR_ACTIVE_PLUS_0);
addWindowItem(local_bar);
y_item += 2*h_pbar;
@@ -80,9 +80,9 @@ void CProgressWindow::Init()
global_bar->allowPaint(false);
global_bar->setDimensionsAll(x_item, y_item, w_item, h_pbar);
global_bar->setColorBody(col_body);
global_bar->setActiveColor(COL_MENUCONTENT_PLUS_7);
global_bar->setActiveColor(COL_PROGRESSBAR_ACTIVE_PLUS_0);
global_bar->setFrameThickness(w_bar_frame);
global_bar->setColorFrame(COL_MENUCONTENT_PLUS_7);
global_bar->setColorFrame(COL_PROGRESSBAR_ACTIVE_PLUS_0);
addWindowItem(global_bar);
y_item += 2*h_pbar;

View File

@@ -51,10 +51,14 @@ CShellWindow::CShellWindow(const std::string &Command, const int Mode, int *Res,
textBox = NULL;
frameBuffer = CFrameBuffer::getInstance();
command = Command;
mode = Mode;
res = Res;
setCommand(Command, Mode, Res, auto_exec);
}
void CShellWindow::setCommand(const std::string &Command, const int Mode, int* Res, bool auto_exec)
{
command = Command;
mode = Mode;
res = Res;
if (auto_exec)
exec();
}
@@ -233,7 +237,7 @@ void CShellWindow::showResult()
show_button = true;
}
else if (mode & ACKNOWLEDGE_EVENT){
if (*res != 0){
if (res && *res != 0){
OnResultError(res);
if (OnResultError.empty())
DisplayErrorMessage("Error while execution of task. Please see window for details!");

View File

@@ -56,6 +56,10 @@ class CShellWindow : public sigc::trackable
};
CShellWindow(const std::string &Command, const int Mode = 0, int* Res = NULL, bool auto_exec = true);
~CShellWindow();
void setCommand(const std::string &Command, const int Mode = 0, int* Res = NULL, bool auto_exec = true);
std::string getCommand(){return command;}
int getMode(){return mode;}
void exec();
/*!

View File

@@ -108,7 +108,7 @@ void CStringInput::init()
#endif
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
fheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_FOOT]->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;
@@ -394,9 +394,9 @@ int CStringInput::exec( CMenuTarget* parent, const std::string & )
fb_pixel_t * pixbuf = NULL;
if (!parent) {
pixbuf = new fb_pixel_t[(width + SHADOW_OFFSET) * (height + SHADOW_OFFSET)];
pixbuf = new fb_pixel_t[(width + OFFSET_SHADOW) * (height + OFFSET_SHADOW)];
if (pixbuf)
frameBuffer->SaveScreen(x, y, width + SHADOW_OFFSET, height + SHADOW_OFFSET, pixbuf);
frameBuffer->SaveScreen(x, y, width + OFFSET_SHADOW, height + OFFSET_SHADOW, pixbuf);
}
paint();
@@ -494,8 +494,9 @@ int CStringInput::exec( CMenuTarget* parent, const std::string & )
loop=false;
res = menu_return::RETURN_EXIT_REPAINT;
}
else if ((msg ==CRCInput::RC_sat) || (msg == CRCInput::RC_favorites))
else if (CNeutrinoApp::getInstance()->listModeKey(msg))
{
// do nothing
}
else
{
@@ -518,7 +519,7 @@ int CStringInput::exec( CMenuTarget* parent, const std::string & )
if (pixbuf)
{
frameBuffer->RestoreScreen(x, y, width + SHADOW_OFFSET, height + SHADOW_OFFSET, pixbuf);
frameBuffer->RestoreScreen(x, y, width + OFFSET_SHADOW, height + OFFSET_SHADOW, pixbuf);
delete[] pixbuf;//Mismatching allocation and deallocation: pixbuf
frameBuffer->blit();
} else
@@ -540,13 +541,13 @@ 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->paintBackgroundBoxRel(x, y, width + OFFSET_SHADOW, height + OFFSET_SHADOW);
frameBuffer->blit();
}
void CStringInput::paint(bool sms)
{
frameBuffer->paintBoxRel(x + SHADOW_OFFSET, y + SHADOW_OFFSET, width, height, COL_MENUCONTENTDARK_PLUS_0, RADIUS_LARGE, CORNER_ALL); //round
frameBuffer->paintBoxRel(x + OFFSET_SHADOW, y + OFFSET_SHADOW, width, height, COL_SHADOW_PLUS_0, RADIUS_LARGE, CORNER_ALL); //round
frameBuffer->paintBoxRel(x, y + hheight, width, bheight, COL_MENUCONTENT_PLUS_0, sms ? 0 : RADIUS_LARGE, CORNER_BOTTOM);
CComponentsHeader header(x, y, width, hheight, head, iconfile);
@@ -600,19 +601,10 @@ void CStringInput::paintChar(int pos, const char c)
fb_pixel_t color;
fb_pixel_t bgcolor;
if (pos == selected)
{
color = COL_MENUCONTENTSELECTED_TEXT;
bgcolor = COL_MENUCONTENTSELECTED_PLUS_0;
}
else
{
color = COL_MENUCONTENT_TEXT;
bgcolor = COL_MENUCONTENT_PLUS_0;
}
getItemColors(color, bgcolor, pos == selected);
frameBuffer->paintBoxRel(xpos, ypos, input_w, input_h, COL_MENUCONTENT_PLUS_2);
frameBuffer->paintBoxRel(xpos+ 1, ypos+ 1, input_w- 2, input_h- 2, bgcolor);
frameBuffer->paintBoxRel(xpos, ypos, input_w, input_h, bgcolor);
frameBuffer->paintBoxFrame(xpos, ypos, input_w, input_h, 1, COL_MENUCONTENT_PLUS_2);
int ch_w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(ch);
int ch_x = xpos + std::max(input_w/2 - ch_w/2, 0);
@@ -900,7 +892,7 @@ const char * CPLPINInput::getHint1(void)
}
}
#define borderwidth SHADOW_OFFSET // FIXME: do we need border around ??
#define borderwidth OFFSET_SHADOW // FIXME: do we need border around ??
int CPLPINInput::exec( CMenuTarget* parent, const std::string & )
{

View File

@@ -95,7 +95,6 @@ class CStringInput : public CMenuTarget
class CStringInputSMS : public CStringInput
{
bool capsMode;
int arraySizes[10];
char Chars[10][10]; // maximal 10 character in one CharList entry!

View File

@@ -251,14 +251,14 @@ int CExtendedInput::exec( CMenuTarget* parent, const std::string & )
timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]);
}
} else {
//keine <20>nderungen - beenden ok
loop=false;
if(cancel != NULL)
*cancel = true;
}
}
else if ((msg ==CRCInput::RC_sat) || (msg == CRCInput::RC_favorites))
else if (CNeutrinoApp::getInstance()->listModeKey(msg))
{
// do nothing
}
else if ( CNeutrinoApp::getInstance()->handleMsg( msg, data ) & messages_return::cancel_all )
{
@@ -310,7 +310,6 @@ void CExtendedInput::paint()
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_TEXT);
}
tmp_y += offset;
}
for(unsigned int i=0; i<inputFields.size();i++)
@@ -351,19 +350,10 @@ void CExtendedInput_Item_Char::paint(int x, int y, bool focusGained )
fb_pixel_t color;
fb_pixel_t bgcolor;
if (focusGained)
{
color = COL_MENUCONTENTSELECTED_TEXT;
bgcolor = COL_MENUCONTENTSELECTED_PLUS_0;
}
else
{
color = COL_MENUCONTENT_TEXT;
bgcolor = COL_MENUCONTENT_PLUS_0;
}
getItemColors(color, bgcolor, focusGained);
frameBuffer->paintBoxRel(xpos, ypos, input_w, input_h, COL_MENUCONTENT_PLUS_2);
frameBuffer->paintBoxRel(xpos+ 1, ypos+ 1, input_w- 2, input_h- 2, bgcolor);
frameBuffer->paintBoxRel(xpos, ypos, input_w, input_h, bgcolor);
frameBuffer->paintBoxFrame(xpos, ypos, input_w, input_h, 1, COL_MENUCONTENT_PLUS_2);
int ch_w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(ch);
int ch_x = xpos + std::max(input_w/2 - ch_w/2, 0);

View File

@@ -51,6 +51,8 @@
****************************************************************************/
//#define VISUAL_DEBUG
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -59,6 +61,9 @@
#include <system/debug.h>
#include "textbox.h"
#include <gui/widget/icons.h>
#ifdef VISUAL_DEBUG
#include <gui/color_custom.h>
#endif
#define SCROLL_FRAME_WIDTH 10
#define SCROLL_MARKER_BORDER 2
@@ -69,7 +74,6 @@
#define MIN_WINDOW_WIDTH ((g_settings.screen_EndX - g_settings.screen_StartX)>>1)
#define MIN_WINDOW_HEIGHT 40
CTextBox::CTextBox(const char * text, Font* font_text, const int pmode,
const CBox* position, CFBWindow::color_t textBackgroundColor)
{
@@ -97,7 +101,7 @@ CTextBox::CTextBox(const char * text, Font* font_text, const int pmode,
//TRACE(" CTextBox::m_cText: %d, m_nMode %d\t\r\n",m_cText.size(),m_nMode);
m_textBackgroundColor = textBackgroundColor;
m_textBackgroundColor = m_old_textBackgroundColor = textBackgroundColor;
m_nFontTextHeight = getFontTextHeight();
//TRACE("[CTextBox] %s Line %d\r\n", __FUNCTION__, __LINE__);
@@ -160,8 +164,8 @@ void CTextBox::initVar(void)
m_nLinesPerPage = 0;
m_nCurrentLine = 0;
m_nCurrentPage = 0;
text_Hborder_width = 8; //border left and right
text_Vborder_width = 8; //border top and buttom
text_Hborder_width = OFFSET_INNER_MID; //border left and right
text_Vborder_width = OFFSET_INNER_MID; //border top and buttom
m_cFrame.iX = m_old_x = g_settings.screen_StartX + ((g_settings.screen_EndX - g_settings.screen_StartX - MIN_WINDOW_WIDTH) >>1);
m_cFrame.iWidth = m_old_dx = MIN_WINDOW_WIDTH;
@@ -249,7 +253,7 @@ void CTextBox::reSizeMainFrameWidth(int textWidth)
{
//TRACE("[CTextBox]->%s: \ntext width: %d\n m_cFrame.iWidth: %d\n m_cFrameTextRel.iWidth: %d\n m_nMaxWidth: %d\n m_nMinWidth: %d\n",__FUNCTION__, textWidth, m_cFrame.iWidth, m_cFrameTextRel.iWidth, m_nMaxWidth, m_nMinWidth);
int iNewWindowWidth = textWidth + m_cFrameScrollRel.iWidth + 2*text_Hborder_width;
int iNewWindowWidth = textWidth + m_cFrameScrollRel.iWidth + 2*text_Hborder_width;
if( iNewWindowWidth > m_nMaxWidth)
iNewWindowWidth = m_nMaxWidth;
@@ -494,12 +498,12 @@ void CTextBox::refreshScroll(void)
{
frameBuffer->paintBoxRel(m_cFrameScrollRel.iX+m_cFrame.iX, m_cFrameScrollRel.iY+m_cFrame.iY,
m_cFrameScrollRel.iWidth, m_cFrameScrollRel.iHeight,
COL_MENUCONTENT_PLUS_1);
COL_SCROLLBAR_PASSIVE_PLUS_0);
unsigned int marker_size = m_cFrameScrollRel.iHeight / m_nNrOfPages;
frameBuffer->paintBoxRel(m_cFrameScrollRel.iX + SCROLL_MARKER_BORDER+m_cFrame.iX,
m_cFrameScrollRel.iY + m_nCurrentPage * marker_size+m_cFrame.iY,
m_cFrameScrollRel.iWidth - 2*SCROLL_MARKER_BORDER,
marker_size, COL_MENUCONTENT_PLUS_3);
marker_size, COL_SCROLLBAR_ACTIVE_PLUS_0);
m_has_scrolled = true;
}
else
@@ -563,7 +567,7 @@ void CTextBox::refreshText(void)
//bg variables
int ax = m_cFrameTextRel.iX+m_cFrame.iX;
int ay = m_cFrameTextRel.iY+m_cFrame.iY;
int dx = m_cFrameTextRel.iWidth;
int dx = m_old_cText != m_cText || m_nNrOfPages>1 ? m_cFrameTextRel.iWidth : m_nMaxTextWidth;
int dy = m_cFrameTextRel.iHeight;
//find changes
@@ -602,7 +606,8 @@ void CTextBox::refreshText(void)
clearScreenBuffer();
if (allow_paint_bg){
//TRACE("[CTextBox] %s paint bg %d\r\n", __FUNCTION__, __LINE__);
frameBuffer->paintBoxRel(ax, ay, dx, dy, m_textBackgroundColor, m_nBgRadius, m_nBgRadiusType);
//paint full background only on new text, otherwise paint required background
frameBuffer->paintBoxRel(ax, ay, dx, dy, m_textBackgroundColor, m_nBgRadius, m_nBgRadiusType);
}
}
else{
@@ -642,23 +647,33 @@ void CTextBox::refreshText(void)
// fit into mid of frame space
y += m_nFontTextHeight + ((m_cFrameTextRel.iHeight - m_nFontTextHeight * lines) >> 1);
#ifdef VISUAL_DEBUG
frameBuffer->paintBoxRel(m_cFrame.iX, m_cFrame.iY, m_cFrame.iWidth, m_cFrame.iHeight, COL_GREEN);
#endif
for(i = m_nCurrentLine; i < m_nNrOfLines && i < m_nCurrentLine + m_nLinesPerPage; i++)
{
//calculate centered xpos
if( m_nMode & CENTER ){
x_center = ((m_cFrameTextRel.iWidth - m_pcFontText->getRenderWidth(m_cLineArray[i], m_utf8_encoded))>>1) - text_Hborder_width;
}
else if ( m_nMode & RIGHT ){
x_center = ((m_cFrameTextRel.iWidth - m_pcFontText->getRenderWidth(m_cLineArray[i], m_utf8_encoded)) - text_Hborder_width*2);
if ( m_nMode & SCROLL )
//calculate xpos
if ((m_nMode & CENTER) || (m_nMode & RIGHT))
{
x_center = m_cFrameTextRel.iWidth - m_cFrameTextRel.iX - 2*text_Hborder_width - m_pcFontText->getRenderWidth(m_cLineArray[i], m_utf8_encoded);
if (m_nMode & CENTER)
x_center /= 2;
if (m_nMode & SCROLL)
x_center -= SCROLL_FRAME_WIDTH;
}
x_center = std::max(x_center, 0);
int tx = m_cFrame.iX + m_cFrameTextRel.iX + text_Hborder_width + x_center;
int ty = m_cFrame.iY + y;
int tw = m_cFrameTextRel.iWidth - m_cFrameTextRel.iX - 2*text_Hborder_width - x_center;
#ifdef VISUAL_DEBUG
int th = m_nFontTextHeight;
frameBuffer->paintBoxRel(tx, ty-th, tw, th, COL_RED);
#endif
//TRACE("[CTextBox] %s Line %d m_cFrame.iX %d m_cFrameTextRel.iX %d\r\n", __FUNCTION__, __LINE__, m_cFrame.iX, m_cFrameTextRel.iX);
m_pcFontText->RenderString(m_cFrame.iX + m_cFrameTextRel.iX + text_Hborder_width + x_center,
y+m_cFrame.iY, m_cFrameTextRel.iWidth, m_cLineArray[i].c_str(),
m_textColor, 0, m_renderMode | (m_utf8_encoded) ? Font::IS_UTF8 : 0);
m_pcFontText->RenderString(tx, ty, tw, m_cLineArray[i].c_str(), m_textColor, 0, m_renderMode | (m_utf8_encoded) ? Font::IS_UTF8 : 0);
m_old_cText = m_cText;
y += m_nFontTextHeight;
}

View File

@@ -61,7 +61,6 @@
#include <driver/fb_window.h>
#include <gui/color.h>
#include <gui/customcolor.h>
#include <sigc++/signal.h>
#define TRACE printf
#define TRACE_1 printf