Merge branch 'cst-next' of git://coolstreamtech.de/cst-public-gui-neutrino into ni/cst-next

Origin commit data
------------------
Commit: 8167e518ae
Author: gixxpunk <thomas.harfmann@gmail.com>
Date: 2016-06-26 (Sun, 26 Jun 2016)
This commit is contained in:
gixxpunk
2016-06-26 22:14:15 +02:00
9 changed files with 55 additions and 29 deletions

View File

@@ -119,7 +119,7 @@ void cDvbSubtitleBitmaps::Draw(int &min_x, int &min_y, int &max_x, int &max_y)
double xc = (double) CFrameBuffer::getInstance()->getScreenWidth(true)/(double) 720; double xc = (double) CFrameBuffer::getInstance()->getScreenWidth(true)/(double) 720;
double yc = (double) CFrameBuffer::getInstance()->getScreenHeight(true)/(double) 576; double yc = (double) CFrameBuffer::getInstance()->getScreenHeight(true)/(double) 576;
xc = yc; //FIXME should we scale also to full width ? xc = yc; //FIXME should we scale also to full width ?
int xf = xc * (double) 720; int xf = int(xc * (double) 720);
for (i = 0; i < Count(); i++) { for (i = 0; i < Count(); i++) {
uint32_t * colors = (uint32_t *) sub.rects[i]->pict.data[1]; uint32_t * colors = (uint32_t *) sub.rects[i]->pict.data[1];
@@ -127,15 +127,15 @@ void cDvbSubtitleBitmaps::Draw(int &min_x, int &min_y, int &max_x, int &max_y)
int height = sub.rects[i]->h; int height = sub.rects[i]->h;
int xoff, yoff; int xoff, yoff;
int nw = width == 1280 ? ((double) width / xc) : ((double) width * xc); int nw = int(width == 1280 ? ((double) width / xc) : ((double) width * xc));
int nh = (double) height * yc; int nh = int((double) height * yc);
int xdiff = (wd > xf) ? ((wd - xf) / 2) : 0; int xdiff = (wd > xf) ? ((wd - xf) / 2) : 0;
xoff = sub.rects[i]->x*xc + xstart + xdiff; xoff = int(sub.rects[i]->x*xc + xstart + xdiff);
if(sub.rects[i]->y < 576/2) { if(sub.rects[i]->y < 576/2) {
yoff = ystart + sub.rects[i]->y*yc; yoff = int(ystart + sub.rects[i]->y*yc);
} else { } else {
yoff = yend - ((width == 1280 ? 704:576) - (double) (sub.rects[i]->y + height))*yc - nh; yoff = int(yend - ((width == 1280 ? 704:576) - (double) (sub.rects[i]->y + height))*yc - nh);
if(yoff < ystart) if(yoff < ystart)
yoff = ystart; yoff = ystart;
} }
@@ -343,7 +343,7 @@ int cDvbSubtitleConverter::Action(void)
bitmaps->Del(sb, true); bitmaps->Del(sb, true);
} }
else if (Delta < WaitMs) else if (Delta < WaitMs)
WaitMs = (Delta > SHOW_DELTA) ? Delta - SHOW_DELTA : Delta; WaitMs = int((Delta > SHOW_DELTA) ? Delta - SHOW_DELTA : Delta);
} }
else else
bitmaps->Del(sb, true); bitmaps->Del(sb, true);

View File

@@ -224,6 +224,11 @@ void CCDraw::setFrameThickness(const int& thickness, const int& thickness_sel)
if (fr_thickness_sel != thickness_sel) if (fr_thickness_sel != thickness_sel)
fr_thickness_sel = thickness_sel; fr_thickness_sel = thickness_sel;
//ensure enabled frame if frame width > 0
cc_enable_frame = false;
if (fr_thickness)
cc_enable_frame = true;
} }
bool CCDraw::enableColBodyGradient(const int& enable_mode, const fb_pixel_t& sec_color, const int& direction) bool CCDraw::enableColBodyGradient(const int& enable_mode, const fb_pixel_t& sec_color, const int& direction)

View File

@@ -420,7 +420,7 @@ void CComponentsFrmClock::setHeight(const int& h)
int f_height = cl_font->getHeight(); int f_height = cl_font->getHeight();
if (h != f_height){ if (h != f_height){
dprintf(DEBUG_NORMAL, "\033[33m[CComponentsFrmClock]\t[%s - %d], font height is different than current height [%d], using [%d] ...\033[0m\n", __func__, __LINE__, h, f_height); dprintf(DEBUG_DEBUG, "\033[33m[CComponentsFrmClock]\t[%s - %d], font height is different than current height [%d], using [%d] ...\033[0m\n", __func__, __LINE__, h, f_height);
CCDraw::setHeight(f_height); CCDraw::setHeight(f_height);
}else }else
CCDraw::setHeight(h); CCDraw::setHeight(h);

View File

@@ -133,7 +133,7 @@ void CComponentsWindow::initVarWindow( const int& x_pos, const int& y_pos, const
ccw_icon_name = iconname; ccw_icon_name = iconname;
dprintf(DEBUG_DEBUG, "[CComponentsWindow] [%s - %d] icon name = %s\n", __func__, __LINE__, ccw_icon_name.c_str()); dprintf(DEBUG_DEBUG, "[CComponentsWindow] [%s - %d] icon name = %s\n", __func__, __LINE__, ccw_icon_name.c_str());
paint_bg = false;
shadow = shadow_mode; shadow = shadow_mode;
col_frame = color_frame; col_frame = color_frame;
col_body = color_body; col_body = color_body;
@@ -215,12 +215,13 @@ void CComponentsWindow::initFooter()
//add of footer item happens initCCWItems() //add of footer item happens initCCWItems()
//set footer properties //set footer properties
if (ccw_footer){ if (ccw_footer){
ccw_footer->setPos(0, CC_APPEND); ccw_footer->setPos(0, cc_yr + height - ccw_footer->getHeight()- fr_thickness);
ccw_footer->setWidth(width-2*fr_thickness); ccw_footer->setWidth(width-2*fr_thickness);
ccw_footer->enableShadow(shadow); ccw_footer->enableShadow(false/*shadow*/);
ccw_footer->setCorner(corner_rad, CORNER_BOTTOM); ccw_footer->setCorner(corner_rad-fr_thickness/2, CORNER_BOTTOM);
ccw_footer->setButtonFont(ccw_button_font); ccw_footer->setButtonFont(ccw_button_font);
ccw_footer->setColorBody(ccw_col_footer); ccw_footer->setColorBody(ccw_col_footer);
ccw_footer->doPaintBg(true);
} }
} }
@@ -240,7 +241,7 @@ void CComponentsWindow::initLeftSideBar()
int h_sbar = height - h_header - h_footer - 2*fr_thickness; int h_sbar = height - h_header - h_footer - 2*fr_thickness;
int w_sbar = ccw_w_sidebar; int w_sbar = ccw_w_sidebar;
ccw_left_sidebar->setDimensionsAll(0, CC_APPEND, w_sbar, h_sbar); ccw_left_sidebar->setDimensionsAll(0, CC_APPEND, w_sbar, h_sbar);
ccw_left_sidebar->doPaintBg(false); ccw_left_sidebar->doPaintBg(true);
} }
} }
@@ -260,7 +261,7 @@ void CComponentsWindow::initRightSideBar()
int h_sbar = height - h_header - h_footer - 2*fr_thickness; int h_sbar = height - h_header - h_footer - 2*fr_thickness;
int w_sbar = ccw_w_sidebar; int w_sbar = ccw_w_sidebar;
ccw_right_sidebar->setDimensionsAll(width - w_sbar, CC_APPEND, w_sbar, h_sbar); ccw_right_sidebar->setDimensionsAll(width - w_sbar, CC_APPEND, w_sbar, h_sbar);
ccw_right_sidebar->doPaintBg(false); ccw_right_sidebar->doPaintBg(true);
} }
} }
@@ -271,25 +272,36 @@ void CComponentsWindow::initBody()
//add of body item happens initCCWItems() //add of body item happens initCCWItems()
//set body properties //set body properties
if (ccw_body){ if (ccw_body){
ccw_body->setCornerType(0); ccw_body->setCorner(corner_rad-fr_thickness/2, CORNER_NONE);
int h_footer = 0; int h_footer = 0;
int h_header = 0; int h_header = 0;
int w_l_sidebar = 0; int w_l_sidebar = 0;
int w_r_sidebar = 0; int w_r_sidebar = 0;
if (ccw_footer) if (ccw_footer){
h_footer = ccw_footer->getHeight(); h_footer = ccw_footer->getHeight();
if (ccw_head) }
if (ccw_head){
h_header = ccw_head->getHeight(); h_header = ccw_head->getHeight();
}
if (ccw_left_sidebar) if (ccw_left_sidebar)
w_l_sidebar = ccw_left_sidebar->getWidth(); w_l_sidebar = ccw_left_sidebar->getWidth();
if (ccw_right_sidebar) if (ccw_right_sidebar)
w_r_sidebar = ccw_right_sidebar->getWidth(); w_r_sidebar = ccw_right_sidebar->getWidth();
int h_body = height - h_header - h_footer - 2*fr_thickness; int h_body = height - h_header - h_footer - fr_thickness;
int x_body = w_l_sidebar; int x_body = w_l_sidebar;
int w_body = width-2*fr_thickness - w_l_sidebar - w_r_sidebar; int w_body = width-2*fr_thickness - w_l_sidebar - w_r_sidebar;
ccw_body->setDimensionsAll(x_body, CC_APPEND, w_body, h_body); ccw_body->setDimensionsAll(x_body, h_header, w_body, h_body);
ccw_body->doPaintBg(false); ccw_body->doPaintBg(true);
//handle corner behavior
if (!ccw_show_header)
ccw_body->setCornerType(CORNER_TOP);
if (!ccw_show_footer)
ccw_body->setCornerType(ccw_body->getCornerType() | CORNER_BOTTOM);
if (!ccw_show_header)
ccw_body->setCornerType(CORNER_TOP);
} }
} }
@@ -340,15 +352,19 @@ void CComponentsWindow::initCCWItems()
//init window body core //init window body core
initBody(); initBody();
//add header, body and footer items only one time /*Add header and footer items as first and body as last item.
Render of items occurs in listed order. So it's better for performance while render of window.
This is something more advantageously because all other items are contained inside body.
So we avoid possible delay while rendering of base items. It looks better on screen.
*/
if (ccw_head) if (ccw_head)
if (!ccw_head->isAdded()) if (!ccw_head->isAdded())
addCCItem(ccw_head); addCCItem(ccw_head);
if (!ccw_body->isAdded())
addCCItem(ccw_body);
if (ccw_footer) if (ccw_footer)
if (!ccw_footer->isAdded()) if (!ccw_footer->isAdded())
addCCItem(ccw_footer); addCCItem(ccw_footer);
if (!ccw_body->isAdded())
addCCItem(ccw_body);
} }
void CComponentsWindow::enableSidebar(const int& sidbar_type) void CComponentsWindow::enableSidebar(const int& sidbar_type)

View File

@@ -111,8 +111,8 @@ void CComponentsItem::paintInit(bool do_save_bg)
{true, CC_FBDATA_TYPE_BGSCREEN, ix, iy, width+isw/2, height+isw/2, 0, 0, 0, 0, NULL, NULL, NULL, false}, //buffered bg {true, CC_FBDATA_TYPE_BGSCREEN, ix, iy, width+isw/2, height+isw/2, 0, 0, 0, 0, NULL, NULL, NULL, false}, //buffered bg
{sh_r, CC_FBDATA_TYPE_SHADOW_BOX, ixsr, iy+isw/2, isw, height, col_shadow, corner_rad, corner_type & CORNER_RIGHT, 0, NULL, NULL, NULL, false}, //shadow right {sh_r, CC_FBDATA_TYPE_SHADOW_BOX, ixsr, iy+isw/2, isw, height, col_shadow, corner_rad, corner_type & CORNER_RIGHT, 0, NULL, NULL, NULL, false}, //shadow right
{sh_b, CC_FBDATA_TYPE_SHADOW_BOX, ix+isw/2, iysb, width, isw, col_shadow, corner_rad, corner_type & CORNER_BOTTOM, 0, NULL, NULL, NULL, false}, //shadow bottom {sh_b, CC_FBDATA_TYPE_SHADOW_BOX, ix+isw/2, iysb, width, isw, col_shadow, corner_rad, corner_type & CORNER_BOTTOM, 0, NULL, NULL, NULL, false}, //shadow bottom
{true, CC_FBDATA_TYPE_FRAME, ix, iy, width, height, col_frame_cur, corner_rad, corner_type, th, NULL, NULL, NULL, false}, //frame
{true, CC_FBDATA_TYPE_BOX, ix+th, iy+th, width-2*th, height-2*th, col_body, rad, corner_type, 0, NULL, NULL, NULL, false}, //body {true, CC_FBDATA_TYPE_BOX, ix+th, iy+th, width-2*th, height-2*th, col_body, rad, corner_type, 0, NULL, NULL, NULL, false}, //body
{true, CC_FBDATA_TYPE_FRAME, ix, iy, width, height, col_frame_cur, corner_rad, corner_type, th, NULL, NULL, NULL, false} //frame
}; };
for(size_t i =0; i< (sizeof(fbdata) / sizeof(fbdata[0])) ;i++) { for(size_t i =0; i< (sizeof(fbdata) / sizeof(fbdata[0])) ;i++) {

View File

@@ -1102,6 +1102,8 @@ void CUpnpBrowserGui::paintItemInfo(UPnPEntry *entry)
int y_image = ibox.getYPos() + ibox.getHeight()/2 - h_image/2; int y_image = ibox.getYPos() + ibox.getHeight()/2 - h_image/2;
if (!image){ if (!image){
image = new CComponentsPicture(100, y_image, tmpname, NULL, CC_SHADOW_OFF, COL_MENUCONTENTDARK_PLUS_0); image = new CComponentsPicture(100, y_image, tmpname, NULL, CC_SHADOW_OFF, COL_MENUCONTENTDARK_PLUS_0);
image->doPaintBg(false);
image->SetTransparent(CFrameBuffer::TM_BLACK);
} }
image->setPicture(tmpname); image->setPicture(tmpname);
image->setHeight(h_image, true); image->setHeight(h_image, true);
@@ -1191,9 +1193,9 @@ void CUpnpBrowserGui::paintDetails(UPnPEntry *entry, bool use_playing)
text += "\n" + entry->album; text += "\n" + entry->album;
ibox.setText(text, CTextBox::AUTO_WIDTH); ibox.setText(text, CTextBox::AUTO_WIDTH);
ibox.paint0(); ibox.paint0();
if (image)
image->paint0();
} }
if (image)
image->paint0();
timebox.paint0(); timebox.paint0();
} }
} }

View File

@@ -692,8 +692,10 @@ void CMenuWidget::resetWidget(bool delete_items)
{ {
for(unsigned int count=0;count<items.size();count++) { for(unsigned int count=0;count<items.size();count++) {
CMenuItem * item = items[count]; CMenuItem * item = items[count];
if (delete_items && !item->isStatic) if (delete_items && !item->isStatic){
delete item; delete item;
item = NULL;
}
} }
items.clear(); items.clear();

View File

@@ -271,7 +271,7 @@ int CMessageBox::exec(int timeout)
{ {
loop = false; loop = false;
} }
else if((msg == CRCInput::RC_sat) || (msg == CRCInput::RC_favorites) || (msg == CRCInput::RC_www) || (msg == CRCInput::RC_spkr) ) else if((msg == CRCInput::RC_sat) || (msg == CRCInput::RC_favorites) || (msg == CRCInput::RC_www) || (msg == CRCInput::RC_spkr))
{ {
} }
else if (CNeutrinoApp::getInstance()->handleMsg(msg, data) & messages_return::cancel_all) else if (CNeutrinoApp::getInstance()->handleMsg(msg, data) & messages_return::cancel_all)

View File

@@ -563,7 +563,7 @@ void CTextBox::refreshText(void)
//bg variables //bg variables
int ax = m_cFrameTextRel.iX+m_cFrame.iX; int ax = m_cFrameTextRel.iX+m_cFrame.iX;
int ay = m_cFrameTextRel.iY+m_cFrame.iY; int ay = m_cFrameTextRel.iY+m_cFrame.iY;
int dx = m_cFrameTextRel.iWidth; int dx = m_old_cText != m_cText ? m_cFrameTextRel.iWidth : m_nMaxTextWidth;
int dy = m_cFrameTextRel.iHeight; int dy = m_cFrameTextRel.iHeight;
//find changes //find changes
@@ -602,6 +602,7 @@ void CTextBox::refreshText(void)
clearScreenBuffer(); clearScreenBuffer();
if (allow_paint_bg){ if (allow_paint_bg){
//TRACE("[CTextBox] %s paint bg %d\r\n", __FUNCTION__, __LINE__); //TRACE("[CTextBox] %s paint bg %d\r\n", __FUNCTION__, __LINE__);
//paint full background only on new text, otherwise paint required background
frameBuffer->paintBoxRel(ax, ay, dx, dy, m_textBackgroundColor, m_nBgRadius, m_nBgRadiusType); frameBuffer->paintBoxRel(ax, ay, dx, dy, m_textBackgroundColor, m_nBgRadius, m_nBgRadiusType);
} }
} }