diff --git a/src/driver/fontrenderer.cpp b/src/driver/fontrenderer.cpp
index 9c50d018d..3d291ae40 100644
--- a/src/driver/fontrenderer.cpp
+++ b/src/driver/fontrenderer.cpp
@@ -99,7 +99,7 @@ FBFontRenderClass::~FBFontRenderClass()
for (fontListEntry * f = font; f; f = g)
{
g = f->next;
- delete f;
+ delete f; f = NULL;
}
FTC_Manager_Done(cacheManager);
diff --git a/src/driver/neutrinofonts.cpp b/src/driver/neutrinofonts.cpp
index 16fa1de89..64da5fe44 100644
--- a/src/driver/neutrinofonts.cpp
+++ b/src/driver/neutrinofonts.cpp
@@ -92,14 +92,18 @@ void CNeutrinoFonts::InitDynFonts()
CNeutrinoFonts::~CNeutrinoFonts()
{
if (!v_share_fonts.empty()) {
- for (unsigned int i = 0; i < v_share_fonts.size(); i++)
+ for (unsigned int i = 0; i < v_share_fonts.size(); i++){
delete v_share_fonts[i].font;
+ v_share_fonts[i].font = NULL;
+ }
v_share_fonts.clear();
}
if (!v_dyn_fonts.empty()) {
- for (unsigned int i = 0; i < v_dyn_fonts.size(); i++)
+ for (unsigned int i = 0; i < v_dyn_fonts.size(); i++){
delete v_dyn_fonts[i].font;
+ v_dyn_fonts[i].font = NULL;
+ }
v_dyn_fonts.clear();
}
if (!vDynSize.empty()) {
@@ -402,8 +406,10 @@ void CNeutrinoFonts::deleteDynFontExtAll()
{
if (!v_dyn_fonts_ext.empty()) {
for (size_t i = 0; i < v_dyn_fonts_ext.size(); ++i) {
- if (v_dyn_fonts_ext[i].font != NULL)
+ if (v_dyn_fonts_ext[i].font != NULL){
delete v_dyn_fonts_ext[i].font;
+ v_dyn_fonts_ext[i].font = NULL;
+ }
}
v_dyn_fonts_ext.clear();
}
diff --git a/src/global.h b/src/global.h
index 7c77611e9..304ccd195 100644
--- a/src/global.h
+++ b/src/global.h
@@ -43,6 +43,7 @@
#define MOVIEPLAYER_START_SCRIPT CONFIGDIR "/movieplayer.start"
#define MOVIEPLAYER_END_SCRIPT CONFIGDIR "/movieplayer.end"
#define NEUTRINO_ENTER_FLASH_SCRIPT CONFIGDIR "/flash.start"
+#define NEUTRINO_APP_START_SCRIPT CONFIGDIR "/neutrino.start"
#define NEUTRINO_NI_MIGRATION_SCRIPT CONFIGDIR "/ni-migration.sh" //NI
#define NEUTRINO_SCAN_SETTINGS_FILE CONFIGDIR "/scan.conf"
diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp
index a5b8e2acc..afedca9ab 100644
--- a/src/gui/channellist.cpp
+++ b/src/gui/channellist.cpp
@@ -2167,7 +2167,8 @@ void CChannelList::paintHead()
header->removeContextButtons();
header->enableClock(true, "%H:%M", "%H %M", true);
- header->getClockObject()->setCorner(RADIUS_LARGE, CORNER_TOP_RIGHT);
+ if (header->getClockObject())
+ header->getClockObject()->setCorner(RADIUS_LARGE, CORNER_TOP_RIGHT);
}else{
if (header->getClockObject()){
header->disableClock();
diff --git a/src/gui/components/Makefile.am b/src/gui/components/Makefile.am
index 0089ac8a1..e43158b13 100644
--- a/src/gui/components/Makefile.am
+++ b/src/gui/components/Makefile.am
@@ -18,6 +18,7 @@ noinst_LIBRARIES = libneutrino_gui_components.a
libneutrino_gui_components_a_SOURCES = \
cc_base.cpp \
+ cc_button_select.cpp \
cc_detailsline.cpp \
cc_draw.cpp \
cc_extra.cpp \
diff --git a/src/gui/components/cc_button_select.cpp b/src/gui/components/cc_button_select.cpp
new file mode 100644
index 000000000..cb396d7cb
--- /dev/null
+++ b/src/gui/components/cc_button_select.cpp
@@ -0,0 +1,82 @@
+/*
+ Based up Neutrino-GUI - Tuxbox-Project
+ Copyright (C) 2001 by Steffen Hehn 'McClean'
+
+ Classes for generic GUI-related components.
+ Copyright (C) 2017, Thilo Graf 'dbt'
+
+ License: GPL
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
+
+#include "config.h"
+#include "cc_button_select.h"
+#include
+
+CCButtonSelect::CCButtonSelect()
+{
+ btn_container = NULL;
+}
+
+CComponentsFrmChain* CCButtonSelect::getButtonChainObject()
+{
+ return btn_container;
+}
+
+CComponentsButton* CCButtonSelect::getSelectedButtonObject()
+{
+ CComponentsButton* ret = static_cast(btn_container->getSelectedItemObject());
+ return ret;
+}
+
+int CCButtonSelect::getSelectedButton()
+{
+ if (btn_container)
+ return btn_container->getSelectedItem();
+ return -1;
+}
+
+void CCButtonSelect::setSelectedButton(size_t item_id,
+ const fb_pixel_t& fr_col,
+ const fb_pixel_t& sel_fr_col,
+ const fb_pixel_t& bg_col,
+ const fb_pixel_t& sel_bg_col,
+ const fb_pixel_t& text_col,
+ const fb_pixel_t& sel_text_col,
+ const int& frame_width,
+ const int& sel_frame_width)
+{
+ CComponentsButton *btn = NULL;
+ if (btn_container){
+ for (size_t i= 0; i< btn_container->size(); i++){
+ CComponentsItem *item = btn_container->getCCItem(i);
+ if (item->getItemType() >= CC_ITEMTYPE_BUTTON && item->getItemType() <= CC_ITEMTYPE_BUTTON_BLUE){
+ btn = static_cast(item);
+ btn->setButtonTextColor(text_col);
+ }
+ }
+ if (!btn)
+ dprintf(DEBUG_NORMAL, "\033[33m[CCButtonSelect]\t[%s - %d], no button object found...\033[0m\n", __func__, __LINE__);
+
+ fb_pixel_t sel_col = fr_col;
+ if (btn_container->size() > 1)
+ sel_col = sel_fr_col; //TODO: make it configurable
+ btn_container->setSelectedItem(item_id, sel_col, fr_col, sel_bg_col, bg_col, frame_width, sel_frame_width);
+
+ getSelectedButtonObject()->setButtonTextColor(sel_text_col);
+ }
+}
+
+
diff --git a/src/gui/components/cc_button_select.h b/src/gui/components/cc_button_select.h
new file mode 100644
index 000000000..ecf35b8dc
--- /dev/null
+++ b/src/gui/components/cc_button_select.h
@@ -0,0 +1,81 @@
+/*
+ Based up Neutrino-GUI - Tuxbox-Project
+ Copyright (C) 2001 by Steffen Hehn 'McClean'
+
+ Classes for generic GUI-related components.
+ Copyright (C) 2017, Thilo Graf 'dbt'
+
+ License: GPL
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
+
+#ifndef __CC_BTN_SEL_H__
+#define __CC_BTN_SEL_H__
+
+
+#include "cc_frm_button.h"
+
+/*!
+Class for inheritation of button select handling inside other CComponentsForm objects and their derivations
+*/
+class CCButtonSelect
+{
+ protected:
+ CComponentsFrmChain *btn_container;
+
+ public:
+ CCButtonSelect();
+
+ ///returns selected button object, return value as pointer to object, NULL means nothing is selected
+ CComponentsButton* getSelectedButtonObject();
+
+ ///returns pointer to internal button container
+ CComponentsFrmChain* getButtonChainObject();
+
+ ///returns id of select button, return value as int, -1 = nothing is selected
+ int getSelectedButton();
+
+ /**Select a definied button inside button chain object
+ * @param[in] item_id
+ * @li optional: expects type size_t
+ * @param[in] fr_col
+ * @li optional: expects type fb_pixel_t, as default frame color
+ * @param[in] sel_fr_col
+ * @li optional: expects type fb_pixel_t, as selected frame color
+ * @param[in] bg_col
+ * @li optional: expects type fb_pixel_t, as default background color
+ * @param[in] sel_bg_col
+ * @li optional: expects type fb_pixel_t, as selected background color
+ * @param[in] text_col
+ * @li optional: expects type fb_pixel_t, as default text color
+ * @param[in] sel_text_col
+ * @li optional: expects type fb_pixel_t, as selected text color
+ * @param[in] frame_width
+ * @li optional: expects type int, default = 1
+ * @param[in] sel_frame_width
+ * @li optional: expects type int, default = 1
+ */
+ void setSelectedButton(size_t item_id,
+ const fb_pixel_t& fr_col = COL_MENUCONTENTSELECTED_PLUS_2,
+ const fb_pixel_t& sel_fr_col = COL_MENUCONTENTSELECTED_PLUS_0,
+ const fb_pixel_t& bg_col = COL_MENUCONTENT_PLUS_0,
+ const fb_pixel_t& sel_bg_col = COL_MENUCONTENTSELECTED_PLUS_0,
+ const fb_pixel_t& text_col = COL_MENUCONTENT_TEXT,
+ const fb_pixel_t& sel_text_col = COL_MENUCONTENTSELECTED_TEXT,
+ const int& frame_width = 1,
+ const int& sel_frame_width = 1);
+};
+
+#endif //__CC_BTN_SEL_H__
diff --git a/src/gui/components/cc_draw.cpp b/src/gui/components/cc_draw.cpp
index 078edf940..c28144444 100644
--- a/src/gui/components/cc_draw.cpp
+++ b/src/gui/components/cc_draw.cpp
@@ -440,11 +440,13 @@ bool CCDraw::CheckFbData(const cc_fbdata_t& fbdata, const char* func, const int
//screen area save
fb_pixel_t* CCDraw::getScreen(int ax, int ay, int dx, int dy)
{
+ fb_pixel_t* pixbuf = NULL;
+
if (dx < 1 || dy < 1 || dx * dy == 0)
return NULL;
+ else
+ pixbuf = new fb_pixel_t[dx * dy];
- dprintf(DEBUG_INFO, "[CCDraw] INFO! [%s - %d], ax = %d, ay = %d, dx = %d, dy = %d\n", __func__, __LINE__, ax, ay, dx, dy);
- fb_pixel_t* pixbuf = new fb_pixel_t[dx * dy];
frameBuffer->waitForIdle("CCDraw::getScreen()");
frameBuffer->SaveScreen(ax, ay, dx, dy, pixbuf);
return pixbuf;
@@ -453,8 +455,14 @@ fb_pixel_t* CCDraw::getScreen(int ax, int ay, int dx, int dy)
cc_screen_data_t CCDraw::getScreenData(const int& ax, const int& ay, const int& dx, const int& dy)
{
cc_screen_data_t res;
+ res.x = res.y = res.dx = res.dy = 0;
res.pixbuf = getScreen(ax, ay, dx, dy);
- res.x = ax; res.y = ay; res.dx = dx; res.dy = dy;
+
+ if (res.pixbuf){
+ res.x = ax; res.y = ay; res.dx = dx; res.dy = dy;
+ }
+ else
+ dprintf(DEBUG_NORMAL, "\033[33m[CCDraw]\[%s - %d], Warning: initialize of screen buffer failed!\033[0m\n", __func__, __LINE__);
return res;
}
diff --git a/src/gui/components/cc_frm.cpp b/src/gui/components/cc_frm.cpp
index 430423045..33dd15c94 100644
--- a/src/gui/components/cc_frm.cpp
+++ b/src/gui/components/cc_frm.cpp
@@ -185,11 +185,10 @@ void CComponentsForm::clear()
return;
for(size_t i=0; igetItemType(), item);
- delete item;
- item = NULL;
+ if (v_cc_items[i]){
+ dprintf(DEBUG_DEBUG, "[CComponentsForm] %s... delete form cc-item %d of %d (type=%d)\taddress = %p\n", __func__, (int)i+1, (int)v_cc_items.size(), v_cc_items[i]->getItemType(), v_cc_items[i]);
+ delete v_cc_items[i];
+ v_cc_items[i] = NULL;
}
}
v_cc_items.clear();
diff --git a/src/gui/components/cc_frm.h b/src/gui/components/cc_frm.h
index f1aba0a9c..0b7b74401 100644
--- a/src/gui/components/cc_frm.h
+++ b/src/gui/components/cc_frm.h
@@ -28,7 +28,7 @@
#include "config.h"
#include "cc_base.h"
#include "cc_item.h"
-#include "cc_frm_scrollbar.h"
+
class CComponentsForm : public CComponentsItem
{
diff --git a/src/gui/components/cc_frm_clock.cpp b/src/gui/components/cc_frm_clock.cpp
index 46d4781df..1beb3d70f 100644
--- a/src/gui/components/cc_frm_clock.cpp
+++ b/src/gui/components/cc_frm_clock.cpp
@@ -112,8 +112,9 @@ CComponentsFrmClock::CComponentsFrmClock( const int& x_pos,
CComponentsFrmClock::~CComponentsFrmClock()
{
- if (cl_timer)
- delete cl_timer;
+ if (cl_timer){
+ delete cl_timer; cl_timer = NULL;
+ }
}
void CComponentsFrmClock::initClockFont(int dx, int dy)
diff --git a/src/gui/components/cc_frm_footer.cpp b/src/gui/components/cc_frm_footer.cpp
index 3532e05f3..74b48d754 100644
--- a/src/gui/components/cc_frm_footer.cpp
+++ b/src/gui/components/cc_frm_footer.cpp
@@ -35,7 +35,7 @@ using namespace std;
//-------------------------------------------------------------------------------------------------------
//sub class CComponentsFooter inherit from CComponentsHeader
-CComponentsFooter::CComponentsFooter(CComponentsForm* parent)
+CComponentsFooter::CComponentsFooter(CComponentsForm* parent):CCButtonSelect()
{
//CComponentsFooter
initVarFooter(1, 1, 0, 0, 0, parent, CC_SHADOW_OFF, COL_FRAME_PLUS_0, COL_MENUFOOT_PLUS_0, COL_SHADOW_PLUS_0);
@@ -47,7 +47,7 @@ CComponentsFooter::CComponentsFooter( const int& x_pos, const int& y_pos, const
int shadow_mode,
fb_pixel_t color_frame,
fb_pixel_t color_body,
- fb_pixel_t color_shadow )
+ fb_pixel_t color_shadow ):CCButtonSelect()
{
//CComponentsFooter
initVarFooter(x_pos, y_pos, w, h, buttons, parent, shadow_mode, color_frame, color_body, color_shadow);
@@ -95,7 +95,6 @@ void CComponentsFooter::initVarFooter( const int& x_pos, const int& y_pos, const
corner_type = CORNER_BOTTOM;
ccf_enable_button_bg = false /*g_settings.theme.Button_gradient*/; //TODO: not implemented at the moment
- chain = NULL;
addContextButton(buttons);
initCCItems();
@@ -108,8 +107,8 @@ void CComponentsFooter::initVarFooter( const int& x_pos, const int& y_pos, const
void CComponentsFooter::setButtonLabels(const struct button_label_cc * const content, const size_t& label_count, const int& chain_width, const int& label_width)
{
/* clean up before init*/
- if (chain)
- chain->clear();
+ if (btn_container)
+ btn_container->clear();
if (label_count == 0)
return;
@@ -150,11 +149,11 @@ void CComponentsFooter::setButtonLabels(const struct button_label_cc * const con
int y_chain = height/2 - h_chain/2;
if (cch_icon_obj)
x_chain = cch_offset+cch_icon_obj->getWidth()+cch_offset;
- if (chain == NULL){
- chain = new CComponentsFrmChain(x_chain, y_chain, w_chain, h_chain, 0, CC_DIR_X, this, CC_SHADOW_OFF, COL_MENUCONTENT_PLUS_6, col_body);
- chain->setAppendOffset(0, 0);
- chain->setCorner(this->corner_rad, this->corner_type);
- chain->doPaintBg(false);
+ if (btn_container == NULL){
+ btn_container = new CComponentsFrmChain(x_chain, y_chain, w_chain, h_chain, 0, CC_DIR_X, this, CC_SHADOW_OFF, COL_MENUCONTENT_PLUS_6, col_body);
+ btn_container->setAppendOffset(0, 0);
+ btn_container->setCorner(this->corner_rad, this->corner_type);
+ btn_container->doPaintBg(false);
}
/* Calculate usable width of button labels inside button object container
@@ -166,11 +165,11 @@ void CComponentsFooter::setButtonLabels(const struct button_label_cc * const con
* button objects itself.
*/
int w_offset = int((label_count-1)*cch_offset);
- int w_btn = chain->getWidth()/label_count - w_offset;
+ int w_btn = btn_container->getWidth()/label_count - w_offset;
if (label_width){
int w_label = label_width;
int w_defined = int(label_width*label_count);
- int w_max = chain->getWidth() - w_offset;
+ int w_max = btn_container->getWidth() - w_offset;
while (w_defined > w_max){
w_label--;
w_defined = int(w_label*label_count) - w_offset;
@@ -182,7 +181,7 @@ void CComponentsFooter::setButtonLabels(const struct button_label_cc * const con
* with default width to chain object.
*/
vector v_btns;
- int h_btn = /*(ccf_enable_button_bg ? */chain->getHeight()-2*fr_thickness/*-OFFSET_INNER_SMALL*//* : height)*/-ccf_button_shadow_width;
+ int h_btn = /*(ccf_enable_button_bg ? */btn_container->getHeight()-2*fr_thickness/*-OFFSET_INNER_SMALL*//* : height)*/-ccf_button_shadow_width;
for (size_t i= 0; i< label_count; i++){
string txt = content[i].locale == NONEXISTANT_LOCALE ? content[i].text : g_Locale->getText(content[i].locale);
string icon_name = string(content[i].button);
@@ -193,7 +192,7 @@ void CComponentsFooter::setButtonLabels(const struct button_label_cc * const con
continue;
}
- int y_btn = chain->getHeight()/2 - h_btn/2;
+ int y_btn = btn_container->getHeight()/2 - h_btn/2;
dprintf(DEBUG_INFO, "[CComponentsFooter] [%s - %d] y_btn [%d] ccf_button_shadow_width [%d]\n", __func__, __LINE__, y_btn, ccf_button_shadow_width);
CComponentsButton *btn = new CComponentsButton(0, y_btn, w_btn, h_btn, txt, icon_name, NULL, false, true, ccf_enable_button_shadow);
@@ -224,27 +223,27 @@ void CComponentsFooter::setButtonLabels(const struct button_label_cc * const con
btn->setButtonFont(NULL);
}
- dprintf(DEBUG_INFO, "[CComponentsFooter] [%s - %d] button %s [%u] btn->getWidth() = %d w_btn = %d, (chain->getWidth() = %d)\n", __func__, __LINE__, txt.c_str(), i, btn->getWidth(), w_btn, chain->getWidth());
+ dprintf(DEBUG_INFO, "[CComponentsFooter] [%s - %d] button %s [%u] btn->getWidth() = %d w_btn = %d, (chain->getWidth() = %d)\n", __func__, __LINE__, txt.c_str(), i, btn->getWidth(), w_btn, btn_container->getWidth());
}
/* add generated button objects to chain object.
*/
if (!v_btns.empty()){
/*add all buttons into button container*/
- chain->addCCItem(v_btns);
+ btn_container->addCCItem(v_btns);
/* set position of labels, as centered inside button container*/
int w_chain_used = 0;
- for (size_t a= 0; a< chain->size(); a++)
- w_chain_used += chain->getCCItem(a)->getWidth();
- w_chain_used += (chain->size()-1)*cch_offset;
+ for (size_t a= 0; a< btn_container->size(); a++)
+ w_chain_used += btn_container->getCCItem(a)->getWidth();
+ w_chain_used += (btn_container->size()-1)*cch_offset;
- int x_btn = chain->getWidth()/2 - w_chain_used/2;
- chain->getCCItem(0)->setXPos(x_btn);
+ int x_btn = btn_container->getWidth()/2 - w_chain_used/2;
+ btn_container->getCCItem(0)->setXPos(x_btn);
- for (size_t c= 1; c< chain->size(); c++){
- x_btn += chain->getCCItem(c-1)->getWidth()+ cch_offset;
- chain->getCCItem(c)->setXPos(x_btn);
+ for (size_t c= 1; c< btn_container->size(); c++){
+ x_btn += btn_container->getCCItem(c-1)->getWidth()+ cch_offset;
+ btn_container->getCCItem(c)->setXPos(x_btn);
}
}
}
@@ -317,49 +316,12 @@ void CComponentsFooter::setButtonLabel( const char *button_icon,
void CComponentsFooter::enableButtonBg(bool enable)
{
ccf_enable_button_bg = enable;
- if (chain) {
- for (size_t i= 0; i< chain->size(); i++)
- chain->getCCItem(i)->doPaintBg(ccf_enable_button_bg);
+ if (btn_container) {
+ for (size_t i= 0; i< btn_container->size(); i++)
+ btn_container->getCCItem(i)->doPaintBg(ccf_enable_button_bg);
}
}
-void CComponentsFooter::setSelectedButton(size_t item_id,
- const fb_pixel_t& fr_col, const fb_pixel_t& sel_fr_col,
- const fb_pixel_t& bg_col, const fb_pixel_t& sel_bg_col,
- const fb_pixel_t& text_col, const fb_pixel_t& sel_text_col,
- const int& frame_width,
- const int& sel_frame_width)
-{
- if (chain){
- for (size_t i= 0; i< chain->size(); i++){
- CComponentsButton *btn = static_cast(chain->getCCItem(i));
- btn->setButtonTextColor(text_col);
- }
- fb_pixel_t sel_col = fr_col;
- if (chain->size() > 1)
- sel_col = sel_fr_col; //TODO: make it configurable
- chain->setSelectedItem(item_id, sel_col, fr_col, sel_bg_col, bg_col, frame_width, sel_frame_width);
-
- getSelectedButtonObject()->setButtonTextColor(sel_text_col);
- }
-}
-
-int CComponentsFooter::getSelectedButton()
-{
- int ret = -1;
- if (chain)
- ret = chain->getSelectedItem();
-
- return ret;
-}
-
-CComponentsButton* CComponentsFooter::getSelectedButtonObject()
-{
- CComponentsButton* ret = static_cast(chain->getSelectedItemObject());
- return ret;
-}
-
-
void CComponentsFooter::paintButtons(const int& x_pos,
const int& y_pos,
const int& w,
@@ -395,12 +357,12 @@ void CComponentsFooter::enableButtonShadow(int mode, const int& shadow_width, bo
ccf_enable_button_shadow = mode;
ccf_button_shadow_width = shadow_width;
ccf_button_shadow_force_paint = force_paint;
- if (chain){
- for(size_t i=0; isize(); i++){
- chain->getCCItem(i)->enableShadow(ccf_enable_button_shadow, ccf_button_shadow_width, ccf_button_shadow_force_paint);
+ if (btn_container){
+ for(size_t i=0; isize(); i++){
+ btn_container->getCCItem(i)->enableShadow(ccf_enable_button_shadow, ccf_button_shadow_width, ccf_button_shadow_force_paint);
//int y_btn = ccf_enable_button_shadow == CC_SHADOW_OFF ? CC_CENTERED : chain->getHeight()/2 - chain->getCCItem(i)->getHeight()/2 - ccf_button_shadow_width;
- int y_btn = chain->getHeight()/2 - chain->getCCItem(i)->getHeight()/2;
- chain->getCCItem(i)->setYPos(y_btn);
+ int y_btn = btn_container->getHeight()/2 - btn_container->getCCItem(i)->getHeight()/2;
+ btn_container->getCCItem(i)->setYPos(y_btn);
}
}
}
diff --git a/src/gui/components/cc_frm_footer.h b/src/gui/components/cc_frm_footer.h
index c9de5b953..2586d1772 100644
--- a/src/gui/components/cc_frm_footer.h
+++ b/src/gui/components/cc_frm_footer.h
@@ -26,6 +26,8 @@
#include "cc_frm_header.h"
#include "cc_frm_button.h"
+#include "cc_button_select.h"
+
#include
#include //for compatibility with 'button_label' type
@@ -39,7 +41,7 @@ to add button labels known by older button handler, to find in gui/widget/button
functionality. Why limited ?: old parameter 'struct button_label' doesn't provide newer parameters.
Missing parameters are filled with default values and must be assigned afterward, if required.
*/
-class CComponentsFooter : public CComponentsHeader
+class CComponentsFooter : public CComponentsHeader, public CCButtonSelect
{
private:
void initVarFooter( const int& x_pos, const int& y_pos, const int& w, const int& h,
@@ -67,9 +69,6 @@ class CComponentsFooter : public CComponentsHeader
///init default fonts for size modes
virtual void initDefaultFonts();
- ///container for button objects
- CComponentsFrmChain *chain;
-
public:
CComponentsFooter(CComponentsForm *parent = NULL);
CComponentsFooter( const int& x_pos, const int& y_pos, const int& w, const int& h = 0,
@@ -114,40 +113,6 @@ class CComponentsFooter : public CComponentsHeader
///disables background of buttons
void disableButtonBg(){enableButtonBg(false);}
- /**Select a definied button inside button chain object
- * @param[in] item_id
- * @li optional: exepts type size_t
- * @param[in] fr_col
- * @li optional: exepts type fb_pixel_t, as default frame color
- * @param[in] sel_fr_col
- * @li optional: exepts type fb_pixel_t, as selected frame color
- * @param[in] bg_col
- * @li optional: exepts type fb_pixel_t, as default background color
- * @param[in] sel_bg_col
- * @li optional: exepts type fb_pixel_t, as selected background color
- * @param[in] text_col
- * @li optional: exepts type fb_pixel_t, as default text color
- * @param[in] sel_text_col
- * @li optional: exepts type fb_pixel_t, as selected text color
- * @param[in] frame_width
- * @li optional: exepts type int, default = 1
- * @param[in] sel_frame_width
- * @li optional: exepts type int, default = 2
- */
- void setSelectedButton(size_t item_id,
- const fb_pixel_t& fr_col = COL_SHADOW_PLUS_0, //NI
- const fb_pixel_t& sel_fr_col = COL_SHADOW_PLUS_0, //NI
- const fb_pixel_t& bg_col = COL_MENUCONTENT_PLUS_0,
- const fb_pixel_t& sel_bg_col = COL_MENUCONTENTSELECTED_PLUS_0,
- const fb_pixel_t& text_col = COL_MENUCONTENT_TEXT,
- const fb_pixel_t& sel_text_col = COL_MENUCONTENTSELECTED_TEXT,
- const int& frame_width = 1,
- const int& sel_frame_width = 1);
- ///returns id of select button, return value as int, -1 = nothing is selected
- int getSelectedButton();
- ///returns selected button object, return value as pointer to object, NULL means nothing is selected
- CComponentsButton* getSelectedButtonObject();
-
/*!
Sets a new text to an already predefined button.
1st parameter 'btn_id' accepts current id of an already defined button. 2nd parameter sets the new text as std::string
@@ -164,10 +129,6 @@ class CComponentsFooter : public CComponentsHeader
///property: set font for label caption, parameter as font object, value NULL causes usage of dynamic font
void setButtonFont(Font* font){ccf_btn_font = font;};
- ///returns pointer to internal button container
- CComponentsFrmChain* getButtonChainObject(){return chain;};
-
-
///this is a nearly methode similar with the older button handler find in gui/widget/buttons.h, some parameters are different, but require minimalized input
///this member sets some basic parameters and will paint concurrently on execute, explicit call of paint() is not required
void paintButtons( const int& x_pos,
@@ -196,4 +157,6 @@ class CComponentsFooter : public CComponentsHeader
void disbaleButtonShadow(){enableButtonShadow(CC_SHADOW_OFF);}
};
+
+
#endif
diff --git a/src/gui/components/cc_frm_header.h b/src/gui/components/cc_frm_header.h
index 586772e77..3d7158d07 100644
--- a/src/gui/components/cc_frm_header.h
+++ b/src/gui/components/cc_frm_header.h
@@ -302,7 +302,7 @@ class CComponentsHeader : public CComponentsForm, public CCTextScreen, CCHeaderT
}
///returns the clock object
- virtual CComponentsFrmClock* getClockObject(){return cch_cl_obj;}
+ CComponentsFrmClock* getClockObject(){return cch_cl_obj;}
///enable display of clock, parameter bool enable, const char* format, bool run
virtual void enableClock(bool enable = true, const char* format = "%H:%M", const char* sec_format_str = NULL, bool run = false);
diff --git a/src/gui/components/cc_item_infobox.cpp b/src/gui/components/cc_item_infobox.cpp
index bc41347b0..2dccb9820 100644
--- a/src/gui/components/cc_item_infobox.cpp
+++ b/src/gui/components/cc_item_infobox.cpp
@@ -51,10 +51,10 @@ CComponentsInfoBox::CComponentsInfoBox( const int& x_pos,
{
cc_item_type = CC_ITEMTYPE_TEXT_INFOBOX;
- x = x_pos;
- y = y_pos;
- width = w;
- height = h;
+ x = x_old = x_pos;
+ y = y_old = y_pos;
+ width = width_old = w;
+ height = height_old = h;
shadow = shadow_mode;
col_frame = color_frame;
cc_enable_frame = true;
@@ -124,7 +124,7 @@ void CComponentsInfoBox::paintPicture()
pic->doPaintBg(false);
//fit icon into frame
- pic->setYPos(y_pic+(height/2-pic->getHeight()/2));
+ pic->setYPos(y_pic+(height-2*fr_thickness)/2-pic->getHeight()/2);
//paint, but set visibility mode
pic->allowPaint(cc_allow_paint);
diff --git a/src/gui/components/cc_item_progressbar.cpp b/src/gui/components/cc_item_progressbar.cpp
index 089fbbab0..1620b0583 100644
--- a/src/gui/components/cc_item_progressbar.cpp
+++ b/src/gui/components/cc_item_progressbar.cpp
@@ -61,10 +61,10 @@ CProgressBar::CProgressBar( const int x_pos,
cc_item_type = CC_ITEMTYPE_PROGRESSBAR;
//CComponents
- x = x_pos;
- y = y_pos;
- width = w;
- height = h;
+ x = x_old = x_pos;
+ y = y_old = y_pos;
+ width = width_old = w;
+ height = height_old = h;
col_frame = color_frame;
col_body = color_body;
@@ -202,6 +202,7 @@ void CProgressBarCache::pbcClear()
if ((*it)->pbc_passive)
free((*it)->pbc_passive);
delete (*it);
+ (*it) = NULL;
}
pbCache.clear();
}
diff --git a/src/gui/components/cc_item_text.h b/src/gui/components/cc_item_text.h
index 5e5d53d48..8f716dc0b 100644
--- a/src/gui/components/cc_item_text.h
+++ b/src/gui/components/cc_item_text.h
@@ -95,8 +95,6 @@ class CComponentsText : public CCTextScreen, public CComponentsItem
///destroy current CTextBox and CBox objects
void clearCCText();
- ///initialize all required attributes for text and send to the CTextBox object
- void initCCText();
///init internal CBox object required by CTextBox object
void initCBox();
@@ -164,6 +162,9 @@ class CComponentsText : public CCTextScreen, public CComponentsItem
///send option to CTextBox object to paint background box behind text or not
virtual inline void doPaintTextBoxBg(bool do_paintbox_bg){ ct_paint_textbg = do_paintbox_bg;};
+ ///initialize all required attributes for text and send to the CTextBox object
+ void initCCText();
+
///set text as string also possible with overloades members for loacales, const char and text file, returns true if text was changed
virtual bool setText(const std::string& stext, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL, const fb_pixel_t& color_text = 0, const int& style = FONT_STYLE_REGULAR);
///set text with const char*, returns true if text was changed
diff --git a/src/gui/components/cc_types.h b/src/gui/components/cc_types.h
index 1db5ed7aa..e24f5cc03 100644
--- a/src/gui/components/cc_types.h
+++ b/src/gui/components/cc_types.h
@@ -34,6 +34,7 @@ struct gradientData_t;
class Font;
class CComponentsForm;
class CComponentsScrollBar;
+class CCButtonSelect;
///cc item types
typedef enum
diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp
index 0dabc9b93..044c29b37 100644
--- a/src/gui/eventlist.cpp
+++ b/src/gui/eventlist.cpp
@@ -897,7 +897,7 @@ void CEventList::paintHead(t_channel_id _channel_id, std::string _channelname, s
header->getChannelLogoObject()->hide();
if (g_settings.channellist_show_channellogo) //NI
header->setChannelLogo(_channel_id,_channelname);
- header->setCaption(_channelname); //NI
+ header->setCaption(_channelname, CCHeaderTypes::CC_TITLE_LEFT);
header->paint(CC_SAVE_SCREEN_NO);
diff --git a/src/gui/filebrowser.cpp b/src/gui/filebrowser.cpp
index 5c4fa4e23..bb3677ece 100644
--- a/src/gui/filebrowser.cpp
+++ b/src/gui/filebrowser.cpp
@@ -42,6 +42,7 @@
#include
#include
#include
+#include
#include
#include
@@ -555,19 +556,29 @@ bool CFileBrowser::readDir_std(const std::string & dirname, CFileList* flist)
struct stat64 statbuf;
dirent64 **namelist;
int n;
+ std::string to_scan_dir = dirname;
- n = scandir64(dirname.c_str(), &namelist, 0, alphasort64);
+ n = scandir64(to_scan_dir.c_str(), &namelist, 0, alphasort64);
if (n < 0)
{
- perror(("Filebrowser scandir: "+dirname).c_str());
+ std::string scn_err = "Filebrowser scandir: " + to_scan_dir + " ";
+ to_scan_dir = "/media/";
+ dprintf(DEBUG_NORMAL, "\033[33m[CFileBrowser]\[%s - %d], %s failed, %s, try fallback to [%s]\033[0m\n", __func__, __LINE__, scn_err.c_str(), strerror(errno), to_scan_dir.c_str());
+ n = scandir64(to_scan_dir.c_str(), &namelist, 0, alphasort64);
+ name = to_scan_dir;
+ }
+
+ if (n < 0){ //fallback failed
+ perror(("Filebrowser scandir: "+to_scan_dir).c_str());
return false;
}
+
for (int i = 0; i < n; i++)
{
CFile file;
if(strcmp(namelist[i]->d_name,".") != 0)
{
- file.Name = dirname + namelist[i]->d_name;
+ file.Name = to_scan_dir + namelist[i]->d_name;
// printf("file.Name: '%s', getFileName: '%s' getPath: '%s'\n",file.Name.c_str(),file.getFileName().c_str(),file.getPath().c_str());
if(stat64((file.Name).c_str(),&statbuf) != 0)
diff --git a/src/gui/lua/lua_api_version.h b/src/gui/lua/lua_api_version.h
index 4320eacbe..6f932f261 100644
--- a/src/gui/lua/lua_api_version.h
+++ b/src/gui/lua/lua_api_version.h
@@ -4,4 +4,4 @@
* to luainstance.h changes
*/
#define LUA_API_VERSION_MAJOR 1
-#define LUA_API_VERSION_MINOR 75
+#define LUA_API_VERSION_MINOR 76
diff --git a/src/gui/lua/lua_cc_text.cpp b/src/gui/lua/lua_cc_text.cpp
index 2cbaa45d3..3e2158e52 100644
--- a/src/gui/lua/lua_cc_text.cpp
+++ b/src/gui/lua/lua_cc_text.cpp
@@ -229,6 +229,7 @@ int CLuaInstCCText::CCTextGetLines(lua_State *L)
}
else {
CTextBox* ctb = D->ct->getCTextBoxObject();
+ D->ct->initCCText();
if (ctb)
lines = (lua_Integer)ctb->getLines();
}
diff --git a/src/gui/pictureviewer.cpp b/src/gui/pictureviewer.cpp
index 8d2a3c186..22327ede3 100644
--- a/src/gui/pictureviewer.cpp
+++ b/src/gui/pictureviewer.cpp
@@ -712,7 +712,7 @@ void CPictureViewerGui::paintItem(int pos)
void CPictureViewerGui::paintHead()
{
- CComponentsHeaderLocalized header(x, y, width, header_height, LOCALE_PICTUREVIEWER_HEAD, NEUTRINO_ICON_PICTUREVIEWER, CComponentsHeaderLocalized::CC_BTN_HELP); //NI
+ CComponentsHeaderLocalized header(x, y, width, header_height, LOCALE_PICTUREVIEWER_HEAD, NEUTRINO_ICON_PICTUREVIEWER, CComponentsHeaderLocalized::CC_BTN_HELP);
#ifdef ENABLE_GUI_MOUNT
header.setContextButton(NEUTRINO_ICON_BUTTON_MENU);
diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp
index 6fe431b4c..7b890a29e 100644
--- a/src/gui/widget/menue.cpp
+++ b/src/gui/widget/menue.cpp
@@ -2346,7 +2346,7 @@ int CMenuSeparator::paint(bool selected)
if ((type & LINE))
{
int grad = g_settings.theme.menu_Separator_gradient_enable ? CC_COLGRAD_COL_DARK_LIGHT_DARK : CC_COLGRAD_OFF;
- paintBoxRel(x+OFFSET_INNER_MID, y+(height>>1), dx-2*OFFSET_INNER_MID, 1, COL_MENUCONTENT_PLUS_1, 0, CORNER_NONE, grad, COL_MENUCONTENT_PLUS_0, CFrameBuffer::gradientHorizontal, CColorGradient::light); //NI
+ paintBoxRel(x+OFFSET_INNER_MID, y+(height>>1), dx-2*OFFSET_INNER_MID, 1, COL_MENUCONTENT_PLUS_1, 0, CORNER_NONE, grad, COL_MENUCONTENT_PLUS_0, CFrameBuffer::gradientHorizontal, CColorGradient::light);
}
if ((type & STRING))
{
diff --git a/src/gui/widget/textbox.cpp b/src/gui/widget/textbox.cpp
index 23ed96132..7a9e326b1 100644
--- a/src/gui/widget/textbox.cpp
+++ b/src/gui/widget/textbox.cpp
@@ -900,6 +900,16 @@ int CTextBox::getLines(const std::string& text)
return count;
}
+int CTextBox::getLines()
+{
+ if (m_cText.empty())
+ return 0;
+
+ refreshTextLineArray();
+
+ return m_nNrOfLines;
+}
+
int CTextBox::getMaxLineWidth(const std::string& text, Font* font)
{
std::string txt = text;
diff --git a/src/gui/widget/textbox.h b/src/gui/widget/textbox.h
index 0c182eaa8..5980985e5 100644
--- a/src/gui/widget/textbox.h
+++ b/src/gui/widget/textbox.h
@@ -164,7 +164,7 @@ class CTextBox : public sigc::trackable
int text_Hborder_width;
int text_Vborder_width;
bool m_FontUseDigitHeight;
-
+
public:
/* Constructor */
CTextBox();
@@ -199,28 +199,30 @@ class CTextBox : public sigc::trackable
void enableUTF8(bool enable = true){m_utf8_encoded = enable;}
void disableUTF8(bool enable = false){enableUTF8(enable);}
- inline bool isPainted(void) {if( frameBuffer == NULL) return (false); else return (true);};
- inline CBox getWindowsPos(void) {return(m_cFrame);};
+ bool isPainted(void) {if( frameBuffer == NULL) return (false); else return (true);};
+ CBox getWindowsPos(void) {return(m_cFrame);};
- inline int getLinesPerPage(void) {return m_nLinesPerPage;};
- inline int getPages(void) {return(m_nNrOfPages);};
- inline int getBackGroundRadius(void) {return(m_nBgRadius);};
+ int getLinesPerPage(void) {return m_nLinesPerPage;};
+ int getPages(void) {return(m_nNrOfPages);};
+ int getBackGroundRadius(void) {return(m_nBgRadius);};
/**
* Returns count of lines of a passed text.
* @param[in] text
- * @li exepts type std::string
+ * @li expects type std::string
* @return count of lines as int
* @see getLines()
*/
- static int getLines(const std::string& text);
+ static int getLines(const std::string& text);
/**
- * Returns count of evaluated lines from an existent CTextBox instance.
+ * Returns count of calculated lines from an existing CTextBox instance.
* @return count of lines as int
* @see static version getLines()
+ * @note Real count of lines will be only returned if CTextBox object is initialized with a valid CBox instance, \n
+ * otherwise count of 0 lines will be returned!
*/
- int getLines(){return(m_nNrOfLines);}
+ int getLines();
/**
* Returns width of largest line from passed text
diff --git a/src/neutrino.cpp b/src/neutrino.cpp
index 737ab6553..e36301450 100644
--- a/src/neutrino.cpp
+++ b/src/neutrino.cpp
@@ -2277,6 +2277,10 @@ void wake_up( bool &wakeup)
int CNeutrinoApp::run(int argc, char **argv)
{
+ puts("[neutrino] executing " NEUTRINO_APP_START_SCRIPT ".");
+ if (my_system(NEUTRINO_APP_START_SCRIPT) != 0)
+ perror(NEUTRINO_APP_START_SCRIPT " failed");
+
CmdParser(argc, argv);
TIMER_START();