Merge branch 'ni/tuxbox' into ni/mp/tuxbox

Origin commit data
------------------
Commit: e78936e478
Author: vanhofen <vanhofen@gmx.de>
Date: 2017-05-30 (Tue, 30 May 2017)
This commit is contained in:
vanhofen
2017-05-30 01:27:37 +02:00
37 changed files with 440 additions and 329 deletions

View File

@@ -374,15 +374,16 @@ bool CCDraw::clearFbGradientData()
for(size_t i =0; i< v_fbdata.size() ;i++) {
if (v_fbdata[i].gradient_data){
if (v_fbdata[i].gradient_data->gradientBuf){
dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], clean up gradientBuf \t %p...\033[0m\n", __func__, __LINE__, v_fbdata[i].gradient_data->gradientBuf);
free(v_fbdata[i].gradient_data->gradientBuf);
v_fbdata[i].gradient_data->gradientBuf = NULL;
dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], clean up gradientBuf...\033[0m\n", __func__, __LINE__);
}
if (v_fbdata[i].gradient_data->boxBuf){
dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], clean up boxBuf \t %p...\033[0m\n", __func__, __LINE__, v_fbdata[i].gradient_data->boxBuf);
cs_free_uncached(v_fbdata[i].gradient_data->boxBuf);
v_fbdata[i].gradient_data->boxBuf = NULL;
dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], clean up boxBuf...\033[0m\n", __func__, __LINE__);
}
dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], clean up gradient data \t %p...\033[0m\n", __func__, __LINE__, v_fbdata[i].gradient_data);
delete v_fbdata[i].gradient_data;
v_fbdata[i].gradient_data = NULL;
ret = true;

View File

@@ -112,7 +112,7 @@ void CComponentsButton::initVarButton( const int& x_pos, const int& y_pos, const
cc_item_enabled = enabled;
cc_item_selected = selected;
fr_thickness = 0; //TODO: parts of the GUI still don't use framed buttons
append_x_offset = 6;
append_x_offset = OFFSET_INTER;
append_y_offset = 0;
corner_rad = RADIUS_SMALL;
@@ -187,6 +187,7 @@ void CComponentsButton::initCaption()
}
//set basic properties
int x_offset = (!cc_btn_text_obj || !cc_btn_icon_obj) ? 0 : append_x_offset;
int w_frame = fr_thickness;
int reduce = 2*w_frame;
if (cc_btn_text_obj){
@@ -198,7 +199,7 @@ void CComponentsButton::initCaption()
if (cc_btn_font == NULL)
cc_btn_font = g_Font[SNeutrinoSettings::FONT_TYPE_BUTTON_TEXT];
int w_cap = min(width - append_x_offset - x_cap - reduce, cc_btn_font->getRenderWidth(cc_btn_text));
int w_cap = min(width - x_offset - x_cap - reduce, cc_btn_font->getRenderWidth(cc_btn_text));
int h_cap = min(height - reduce, cc_btn_font->getHeight());
/*NOTE:
paint of centered text in y direction without y_offset
@@ -235,10 +236,10 @@ void CComponentsButton::initCaption()
}
//handle common position of icon and text inside container required for alignment
int w_required = w_frame + append_x_offset;
w_required += cc_btn_icon_obj ? cc_btn_icon_obj->getWidth() + append_x_offset : 0;
int w_required = w_frame + x_offset;
w_required += cc_btn_icon_obj ? cc_btn_icon_obj->getWidth() + x_offset : 0;
w_required += cc_btn_font ? cc_btn_font->getRenderWidth(cc_btn_text) : 0;
w_required += append_x_offset + w_frame;
w_required += x_offset + w_frame;
//dynamic width
if (w_required > width){
@@ -247,10 +248,10 @@ void CComponentsButton::initCaption()
}
//do center
int x_icon = width/2 - w_required/2 /*+ fr_thickness + append_x_offset*/;
int x_icon = width/2 - w_required/2 /*+ fr_thickness + x_offset*/;
int w_icon = 0;
if (cc_btn_icon_obj){
x_icon += w_frame + append_x_offset;
x_icon += w_frame + x_offset;
cc_btn_icon_obj->setXPos(x_icon);
w_icon = cc_btn_icon_obj->getWidth();
/*in case of dynamic changed height of caption or button opbject itself,
@@ -260,7 +261,7 @@ void CComponentsButton::initCaption()
cc_btn_icon_obj->setYPos(y_icon);
}
if (cc_btn_text_obj){
cc_btn_text_obj->setXPos(x_icon + w_icon + append_x_offset);
cc_btn_text_obj->setXPos(x_icon + w_icon + x_offset);
cc_btn_text_obj->setWidth(width - cc_btn_text_obj->getXPos());
}
}

View File

@@ -325,12 +325,14 @@ bool CComponentsFrmClock::startClock()
if (cl_timer == NULL){
cl_timer = new CComponentsTimer(0);
cl_timer->setThreadName("frmClock");
if (cl_timer->OnTimer.empty()){
dprintf(DEBUG_INFO,"\033[33m[CComponentsFrmClock]\t[%s] init slot...\033[0m\n", __func__);
cl_timer->OnTimer.connect(cl_sl_show);
force_paint_bg = true;
}
}
if (cl_timer->OnTimer.empty()){
dprintf(DEBUG_INFO,"\033[33m[CComponentsFrmClock]\t[%s] init slot...\033[0m\n", __func__);
cl_timer->OnTimer.connect(cl_sl_show);
force_paint_bg = true;
}
cl_timer->setTimerInterval(cl_interval);
if (cl_timer->startTimer())
@@ -390,7 +392,7 @@ void CComponentsFrmClock::paint(bool do_save_bg)
void CComponentsFrmClock::setClockFont(Font *font, const int& style)
{
if (cl_font != font || (cl_font != font)){
if (cl_font != font || cl_font_style != style){
if (cl_font != font)
cl_font = font;
if (style != -1)

View File

@@ -232,8 +232,10 @@ void CComponentsHeader::initIcon()
//init cch_icon_obj only if an icon available
if (cch_icon_name.empty()) {
cch_icon_w = 0;
if (cch_icon_obj)
if (cch_icon_obj){
removeCCItem(cch_icon_obj);
cch_icon_obj = NULL;
}
return;
}

View File

@@ -94,7 +94,7 @@ void CComponentsScrollBar::initVarSbForm(const int& count, const fb_pixel_t& col
sb_down_obj = NULL;
sb_segments_obj = NULL;
setCorner(RADIUS_MIN, CORNER_ALL);
setCorner(RADIUS_NONE, CORNER_ALL); //NI
sb_up_icon = frameBuffer->getIconPath(NEUTRINO_ICON_BUTTON_UP) ;
sb_down_icon = frameBuffer->getIconPath(NEUTRINO_ICON_BUTTON_DOWN);

View File

@@ -153,7 +153,7 @@ class CProgressBarCache
static inline unsigned int make16color(__u32 rgb){return 0xFF000000 | rgb;};
void pbcPaintBoxRel(int x, int y, int dx, int dy, fb_pixel_t *pixbuf, fb_pixel_t col);
void pbcPaintBoxRel(int x, int y, int dx, int dy, fb_pixel_t *pixbuf, fb_pixel_t col) const;
void pbcApplyGradient(fb_pixel_t *pixbuf);
void pbcCreateBitmaps();
@@ -185,7 +185,7 @@ class CProgressBarCache
}
void pbcClear();
public:
void pbcPaint(int x, int y, int pbc_active_width, int pbc_passive_width);
void pbcPaint(int x, int y, int pbc_active_width, int pbc_passive_width) const;
static CProgressBarCache *pbcLookup( int dy,
int dx,
int active_col,
@@ -230,7 +230,7 @@ CProgressBarCache *CProgressBarCache::pbcLookup(int dy, int dx, int active_col,
return pbc;
}
void CProgressBarCache::pbcPaint(int x, int y, int pbc_active_width, int pbc_passive_width)
void CProgressBarCache::pbcPaint(int x, int y, int pbc_active_width, int pbc_passive_width) const
{
y += yoff;
static CFrameBuffer *frameBuffer = CFrameBuffer::getInstance();
@@ -258,7 +258,7 @@ void CProgressBarCache::pbcPaint(int x, int y, int pbc_active_width, int pbc_pas
frameBuffer->mark(x, y, x + pbc_width, y + pbc_height);
}
void CProgressBarCache::pbcPaintBoxRel(int x, int y, int dx, int dy, fb_pixel_t *pixbuf, fb_pixel_t col)
void CProgressBarCache::pbcPaintBoxRel(int x, int y, int dx, int dy, fb_pixel_t *pixbuf, fb_pixel_t col) const
{
if (x < 0) {
dx -= x;
@@ -509,23 +509,8 @@ void CProgressBar::paintProgress(bool do_save_bg)
//NI graphic
void CProgressBar::paintGraphic()
{
std::ostringstream buf;
buf.str("");
buf << ICONSDIR_VAR << "/" << graphic_file << ".png";
if (access(buf.str().c_str(), F_OK) != 0) {
buf.str("");
buf << ICONSDIR << "/" << graphic_file << ".png";
}
std::string pb_active_graphic(buf.str());
buf.str("");
buf << ICONSDIR_VAR << "/" << graphic_file << "_passive.png";
if (access(buf.str().c_str(), F_OK) != 0) {
buf.str("");
buf << ICONSDIR << "/" << graphic_file << "_passive.png";
}
std::string pb_passive_graphic(buf.str());
std::string pb_active_graphic(frameBuffer->getIconPath(graphic_file));
std::string pb_passive_graphic(frameBuffer->getIconPath(graphic_file + "_passive"));
//printf("**** %04d::%04d: pb_last_width: %d, pb_active_width: %d, pb_max_width %d\n", pb_x, pb_y, pb_last_width, pb_active_width, pb_max_width);
@@ -548,24 +533,8 @@ void CProgressBar::paintGraphic()
//NI starbar
void CProgressBar::paintStarBar()
{
std::ostringstream buf;
graphic_file = "stars";
buf.str("");
buf << ICONSDIR_VAR << "/" << graphic_file << ".png";
if (access(buf.str().c_str(), F_OK) != 0) {
buf.str("");
buf << ICONSDIR << "/" << graphic_file << ".png";
}
std::string pb_active_graphic(buf.str());
buf.str("");
buf << ICONSDIR_VAR << "/" << graphic_file << "_bg.png";
if (access(buf.str().c_str(), F_OK) != 0) {
buf.str("");
buf << ICONSDIR << "/" << graphic_file << "_bg.png";
}
std::string pb_passive_graphic(buf.str());
std::string pb_active_graphic(frameBuffer->getIconPath(NEUTRINO_ICON_STARS));
std::string pb_passive_graphic(frameBuffer->getIconPath(NEUTRINO_ICON_STARS_BG));
int stars_w = 0, stars_h = 0;
g_PicViewer->getSize(pb_passive_graphic.c_str(), &stars_w, &stars_h);

View File

@@ -136,7 +136,7 @@ class CProgressBar : public CComponentsItem
const int val, const int max_val){x=x_pos; y=y_pos; width=w; height=h; pb_value=val; pb_max_value=max_val;}
//NI graphic
void setGraphic(std::string graphic = "progressbar"){graphic_file = graphic;};
void setGraphic(std::string graphic) { graphic_file = graphic; }
///force update on next paint
void reset() { pb_last_width = -1; }

View File

@@ -144,8 +144,11 @@ bool CComponentsTimer::stopTimer()
{
tm_enable = false;
stopThread();
if(tm_thread == 0)
if(tm_thread == 0){
if (!OnTimer.empty())
OnTimer.clear();
return true;
}
return false;
}