Merge branch 'check/next-cc'

Compiles on most platforms, starts. Not really tested.

Conflicts:
	acinclude.m4
	lib/libdvbsub/Makefile.am
	lib/libtriple/Makefile.am
	lib/libtuxtxt/Makefile.am
	src/Makefile.am
	src/create_rcsim_h.sh
	src/daemonc/Makefile.am
	src/driver/Makefile.am
	src/driver/audiodec/Makefile.am
	src/driver/pictureviewer/Makefile.am
	src/eitd/Makefile.am
	src/gui/Makefile.am
	src/gui/bouquetlist.cpp
	src/gui/channellist.cpp
	src/gui/scan_setup.cpp
	src/gui/streaminfo2.cpp
	src/gui/streaminfo2.h
	src/gui/update.cpp
	src/gui/widget/Makefile.am
	src/gui/widget/listbox.cpp
	src/neutrino.cpp
	src/nhttpd/tuxboxapi/coolstream/Makefile.am
	src/rcsim.c
	src/system/Makefile.am
	src/zapit/src/Makefile.am
	src/zapit/src/frontend.cpp
	src/zapit/src/zapit.cpp
This commit is contained in:
Stefan Seyfried
2013-10-21 22:58:55 +02:00
186 changed files with 12758 additions and 2268 deletions

View File

@@ -1,6 +1,6 @@
AM_CPPFLAGS = -fno-rtti -fno-exceptions
INCLUDES = \
AM_CPPFLAGS += \
-I$(top_builddir) \
-I$(top_srcdir) \
-I$(top_srcdir)/src \
@@ -13,14 +13,14 @@ INCLUDES = \
if BOXTYPE_COOL
if BOXMODEL_APOLLO
INCLUDES += -I$(top_srcdir)/lib/libcoolstream2
AM_CPPFLAGS += -I$(top_srcdir)/lib/libcoolstream2
else
INCLUDES += -I$(top_srcdir)/lib/libcoolstream
AM_CPPFLAGS += -I$(top_srcdir)/lib/libcoolstream
endif
endif
if USE_STB_HAL
INCLUDES += -I$(STB_HAL_INC)
AM_CPPFLAGS += -I$(STB_HAL_INC)
endif
noinst_LIBRARIES = libneutrino_gui_components.a
@@ -35,6 +35,7 @@ libneutrino_gui_components_a_SOURCES = \
cc_frm_footer.cpp \
cc_frm_header.cpp \
cc_frm_icons.cpp \
cc_frm_signalbars.cpp \
cc_frm_window.cpp \
cc_item.cpp \
cc_item_infobox.cpp \

View File

@@ -51,17 +51,17 @@ class CComponents
///container: for frambuffer properties and pixel buffer
std::vector<comp_fbdata_t> v_fbdata;
///property: x-position on screen
///property: x-position on screen, to alter with setPos() or setDimensionsAll(), see also defines CC_APPEND, CC_CENTERED
int x;
///property: y-position on screen
///property: y-position on screen, to alter setPos() or setDimensionsAll(), see also defines CC_APPEND, CC_CENTERED
int y;
///property: contains real x-position on screen
int cc_xr;
///property: contains real y-position on screen
int cc_yr;
///property: height-dimension on screen
///property: height-dimension on screen, to alter with setHeight() or setDimensionsAll()
int height;
///property: width-dimension on screen
///property: width-dimension on screen, to alter with setWidth() or setDimensionsAll()
int width;
///property: has corners with definied type, types are defined in /driver/frambuffer.h, without effect, if corner_radius=0
int corner_type;
@@ -182,8 +182,8 @@ class CComponents
///Possible corner types are defined in CFrameBuffer (see: driver/framebuffer.h)
///Note: default values are given from settings
inline virtual void setCornerType(const int& type){corner_type = type;};
///set corner radius
inline virtual void setCornerRadius(const int& radius){corner_rad = radius;};
///set corner radius and type
inline virtual void setCorner(const int& radius, const int& type = CORNER_ALL){corner_rad = radius; corner_type = type;};
///get corner types
inline virtual int getCornerType(){return corner_type;};
///get corner radius
@@ -244,6 +244,8 @@ class CComponentsItem : public CComponents
virtual void setParent(CComponentsItem *parent){cc_parent = parent;};
///returns pointer to the form object in which this item is embedded.
virtual CComponentsItem * getParent(){return cc_parent;};
///property: returns true if item is added to a form
virtual bool isAdded();
///abstract: paint item, arg: do_save_bg see paintInit() above
virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES) = 0;

View File

@@ -165,14 +165,6 @@ int CComponentsForm::getCCItemId(CComponentsItem* cc_Item)
return -1;
}
bool CComponentsForm::isAdded(CComponentsItem* cc_item)
{
bool ret = false;
if (getCCItemId(cc_item) != -1)
ret = true;
return ret;
}
int CComponentsForm::genIndex()
{
int count = v_cc_items.size();
@@ -254,6 +246,12 @@ void CComponentsForm::removeCCItem(const uint& cc_item_id)
#endif
}
void CComponentsForm::removeCCItem(CComponentsItem* cc_Item)
{
uint id = getCCItemId(cc_Item);
removeCCItem(id);
}
void CComponentsForm::exchangeCCItem(const uint& cc_item_id_a, const uint& cc_item_id_b)
{
if (!v_cc_items.empty())
@@ -303,23 +301,35 @@ void CComponentsForm::paintCCItems()
int xpos = cc_item->getXPos();
int ypos = cc_item->getYPos();
//set required x-position to item
//set required x-position to item:
//append vertical
if (xpos == CC_APPEND){
auto_x += append_h_offset;
cc_item->setRealXPos(auto_x + xpos + 1);
auto_x += w_item;
}
//positionize vertical centered
else if (xpos == CC_CENTERED){
auto_x = width/2 - cc_item->getWidth()/2;
cc_item->setRealXPos(this_x + auto_x);
}
else{
cc_item->setRealXPos(this_x + xpos);
auto_x = (cc_item->getRealXPos() + w_item);
}
//set required y-position to item
//append hor
if (ypos == CC_APPEND){
auto_y += append_v_offset;
cc_item->setRealYPos(auto_y + ypos + 1);
auto_y += h_item;
}
//positionize hor centered
else if (ypos == CC_CENTERED){
auto_y = height/2 - cc_item->getHeight()/2;
cc_item->setRealYPos(this_y + auto_y);
}
else{
cc_item->setRealYPos(this_y + ypos);
auto_y = (cc_item->getRealYPos() + h_item);

View File

@@ -58,6 +58,7 @@ class CComponentsForm : public CComponentsItem
virtual void addCCItem(CComponentsItem* cc_Item);
virtual void insertCCItem(const uint& cc_item_id, CComponentsItem* cc_Item);
virtual void removeCCItem(const uint& cc_item_id);
virtual void removeCCItem(CComponentsItem* cc_Item);
virtual void replaceCCItem(const uint& cc_item_id, CComponentsItem* new_cc_Item);
virtual void replaceCCItem(CComponentsItem* old_cc_Item, CComponentsItem* new_cc_Item);
virtual void exchangeCCItem(const uint& item_id_a, const uint& item_id_b);
@@ -68,8 +69,6 @@ class CComponentsForm : public CComponentsItem
virtual void clearCCItems();
virtual void cleanCCForm();
virtual void setAppendOffset(const int &h_offset, const int& v_offset){append_h_offset = h_offset; append_v_offset = v_offset;};
///property: returns true, if item already added to form
virtual bool isAdded(CComponentsItem *cc_item);
};
class CComponentsIconForm : public CComponentsForm
@@ -123,6 +122,7 @@ class CComponentsHeader : public CComponentsForm
Font* cch_font;
int cch_items_y, cch_icon_x, cch_icon_w, cch_text_x, cch_buttons, cch_buttons_w, cch_buttons_h, cch_buttons_space, cch_offset;
std::vector<std::string> v_cch_btn;
int cch_size_mode;
void initIcon();
void initCaption();
@@ -148,6 +148,12 @@ class CComponentsHeader : public CComponentsForm
CC_HEADER_ITEM_TEXT = 1,
CC_HEADER_ITEM_BUTTONS = 2
};
enum
{
CC_HEADER_SIZE_LARGE = 0,
CC_HEADER_SIZE_SMALL = 1
};
CComponentsHeader();
CComponentsHeader(const int x_pos, const int y_pos, const int w, const int h = 0, const std::string& caption = "header", const char* icon_name = NULL, const int buttons = 0, bool has_shadow = CC_SHADOW_OFF,
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
@@ -167,6 +173,7 @@ class CComponentsHeader : public CComponentsForm
virtual void setDefaultButtons(const int buttons);
virtual void setButtonsSpace(const int buttons_space){cch_buttons_space = buttons_space;};
virtual void initCCItems();
virtual void setSizeMode(const int& size_mode){cch_size_mode = size_mode;};
virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
};
@@ -209,7 +216,7 @@ items like text, labels, pictures ...
class CComponentsWindow : public CComponentsForm
{
private:
protected:
///object: header object, to get access to header properties see also getHeaderObject()
CComponentsHeader * ccw_head;
///object: body object, this is the container for all needed items, to add with addWindowItem()
@@ -222,6 +229,8 @@ class CComponentsWindow : public CComponentsForm
const char* ccw_icon_name;
///property: assigned default icon buttons in header, see also getHeaderObject()
int ccw_buttons;
///property: value = true, let show footer
bool ccw_show_footer;
///initialze header object
void initHeader();
@@ -231,8 +240,6 @@ class CComponentsWindow : public CComponentsForm
void initFooter();
///initialze all window objects at once
void initCCWItems();
protected:
///initialize all attributes
void initVarWindow();
@@ -277,6 +284,9 @@ class CComponentsWindow : public CComponentsForm
///add item to body object, also usable is addCCItem() to add items to the windo object
void addWindowItem(CComponentsItem* cc_Item);
///
void showFooter(bool show = true){ccw_show_footer = show;};
///set caption in header with string, see also getHeaderObject()
void setWindowCaption(const std::string& text){ccw_caption = text;};

View File

@@ -46,13 +46,11 @@ CComponentsButton::CComponentsButton( const int x_pos, const int y_pos, const i
cc_btn_icon = icon_name;
cc_btn_capt = caption;
cc_btn_capt_col = COL_MENUCONTENT_TEXT;
cc_btn_text_w = cc_btn_font->getRenderWidth(cc_btn_capt, true);
cc_btn_text_h = cc_btn_font->getHeight();
x = x_pos;
y = y_pos;
width = max(w, cc_btn_text_w);
height = max(h, cc_btn_text_h);
width = w;
height = h;
shadow = has_shadow;
shadow_w = SHADOW_OFFSET;
col_frame = color_frame;
@@ -63,17 +61,40 @@ CComponentsButton::CComponentsButton( const int x_pos, const int y_pos, const i
fr_thickness = FRAME_TH;
}
CComponentsButton::CComponentsButton( const int x_pos, const int y_pos, const int w, const int h,
const neutrino_locale_t& caption_locale, const std::string& icon_name,
bool selected, bool enabled, bool has_shadow,
fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
{
initVarButton();
cc_btn_icon = icon_name;
cc_btn_capt = g_Locale->getText(caption_locale);;
cc_btn_capt_col = COL_MENUCONTENT_TEXT;
x = x_pos;
y = y_pos;
width = w;
height = h;
shadow = has_shadow;
shadow_w = SHADOW_OFFSET;
col_frame = color_frame;
col_body = color_body;
col_shadow = color_shadow;
cc_item_enabled = enabled;
cc_item_selected = selected;
fr_thickness = FRAME_TH;
}
void CComponentsButton::initVarButton()
{
initVarForm();
cc_item_type = CC_ITEMTYPE_BUTTON;
cc_btn_icon_obj = NULL;
cc_btn_capt_obj = NULL;
cc_btn_font = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL];
cc_btn_dy_font = CNeutrinoFonts::getInstance();
cc_btn_font = NULL;
cc_btn_icon = "";
cc_btn_capt = "";
cc_btn_text_w = 0;
cc_btn_text_h = 0;
}
void CComponentsButton::initIcon()
@@ -102,7 +123,7 @@ void CComponentsButton::initIcon()
//set properties to picture object
if (cc_btn_icon_obj){
cc_btn_icon_obj->setPos(icon_x, icon_y);
cc_btn_icon_obj->setDimensionsAll(icon_x, icon_y, icon_w, icon_h);
cc_btn_icon_obj->setPictureAlign(CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER);
cc_btn_icon_obj->doPaintBg(false);
}
@@ -111,36 +132,69 @@ void CComponentsButton::initIcon()
void CComponentsButton::initCaption()
{
if (cc_btn_capt_obj == NULL){
cc_btn_capt_obj = new CComponentsLabel();
//if we have an icon, we must calculate positions for booth items together
//also the icon width and left position = 0
int face_w = 0;
int face_x = 0;
addCCItem(cc_btn_capt_obj);
}
//text position is default centere
int cap_x = (width/2)-(cc_btn_text_w/2);
int cap_y = (height/2)-(cc_btn_text_h/2);
//if we have a icon, then we must calculate centered position for booth items together
//calculate width and left position of icon, if available, picture position is default centered
if (cc_btn_icon_obj){
int face_w = cc_btn_icon_obj->getWidth() + H_SPACE + cc_btn_text_w + 2*fr_thickness;
int face_x = width/2 - face_w/2;
//if found a picture object, then get width from it...
face_w = cc_btn_icon_obj->getWidth();
//...and set position as centered
face_x = width/2 - face_w/2;
cc_btn_icon_obj->setXPos(face_x);
cap_x = face_x + cc_btn_icon_obj->getWidth() + H_SPACE;
}
//init label as caption object and add to container
if (!cc_btn_capt.empty()){
if (cc_btn_capt_obj == NULL){
cc_btn_capt_obj = new CComponentsLabel();
cc_btn_capt_obj->doPaintBg(false);
addCCItem(cc_btn_capt_obj);
}
}else{
if (cc_btn_capt_obj){
delete cc_btn_capt_obj;
cc_btn_capt_obj = NULL;
}
}
//basicly we set caption appended to picture if available and to top border, width = 0
int cap_x = fr_thickness + H_SPACE;
int cap_y = fr_thickness + H_SPACE;
//set properties to label object
if (cc_btn_capt_obj){
cc_btn_capt_obj->setDimensionsAll(cap_x, cap_y, width-cap_x, height);
if (cc_btn_capt_obj){
int cap_w = width - 2*fr_thickness - face_w;
int cap_h = height - 2*fr_thickness - 2*H_SPACE;
if (cc_btn_icon_obj){
cc_btn_icon_obj->setXPos(cap_x);
cap_x += face_w + H_SPACE;
}
cc_btn_capt_obj->setDimensionsAll(cap_x, cap_y, cap_w, cap_h);
cc_btn_font = *cc_btn_dy_font->getDynFont(cap_w, cap_h, cc_btn_capt);
cc_btn_capt_obj->setTextColor(this->cc_item_enabled ? COL_MENUCONTENT_TEXT : COL_MENUCONTENTINACTIVE_TEXT);
cc_btn_capt_obj->setText(cc_btn_capt, CTextBox::NO_AUTO_LINEBREAK, cc_btn_font);
cc_btn_capt_obj->forceTextPaint(); //here required;
cc_btn_capt_obj->doPaintBg(false);
//corner of text item
cc_btn_capt_obj->setCornerRadius(corner_rad-fr_thickness);
cc_btn_capt_obj->setCornerType(corner_type);
cc_btn_capt_obj->setCorner(corner_rad-fr_thickness, corner_type);
}
}
void CComponentsButton::setCaption(const std::string& text)
{
cc_btn_capt = text;
}
void CComponentsButton::setCaption(const neutrino_locale_t locale_text)
{
cc_btn_capt = g_Locale->getText(locale_text);
}
void CComponentsButton::initCCBtnItems()

View File

@@ -26,10 +26,11 @@
#ifndef __CC_BUTTONS_H__
#define __CC_BUTTONS_H__
#include "config.h"
#include <config.h>
#include "cc.h"
#include "cc_frm.h"
#include <string>
#include <driver/neutrinofonts.h>
//! Sub class of CComponentsForm.
/*!
@@ -55,11 +56,8 @@ class CComponentsButton : public CComponentsForm
fb_pixel_t cc_btn_capt_col;
///object: text font
Font* cc_btn_font;
///property: label object width, too long text will be truncated
int cc_btn_text_w;
///property: label object heigth
int cc_btn_text_h;
///object: dynamic font object handler
CNeutrinoFonts *cc_btn_dy_font;
///initialize picture object
void initIcon();
@@ -72,12 +70,24 @@ class CComponentsButton : public CComponentsForm
public:
///basic constructor for button object with most needed params, no button icon is definied here
CComponentsButton( const int x_pos, const int y_pos, const int w, const int h,
const std::string& caption, const std::string& icon_name,
const std::string& caption, const std::string& icon_name = "",
bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF,
fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
CComponentsButton( const int x_pos, const int y_pos, const int w, const int h,
const neutrino_locale_t& caption_locale, const std::string& icon_name = "",
bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF,
fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
///set text color
virtual void setButtonTextColor(fb_pixel_t caption_color){cc_btn_capt_col = caption_color;};
///set caption: parameter as string
virtual void setCaption(const std::string& text);
///set caption: parameter as locale
virtual void setCaption(const neutrino_locale_t locale_text);
///reinitialize items
virtual void Refresh(){initCCBtnItems();};
///paint button object
void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
@@ -151,5 +161,4 @@ class CComponentsButtonBlue : public CComponentsButton
};
};
#endif /*__CC_BUTTONS_H__*/

View File

@@ -38,6 +38,11 @@
using namespace std;
CComponentsFrmClock::CComponentsFrmClock()
{
initVarClock();
}
CComponentsFrmClock::CComponentsFrmClock( const int x_pos, const int y_pos, const int w, const int h,
const char* format_str, bool activ, bool has_shadow,
fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
@@ -87,8 +92,10 @@ CComponentsFrmClock::~CComponentsFrmClock()
void CComponentsFrmClock::initTimeString()
{
time_t tm = time(0);
strftime((char*) &cl_timestr, sizeof(cl_timestr), cl_format_str, localtime(&tm));
struct tm t;
time_t ltime;
ltime=time(&ltime);
strftime((char*) &cl_timestr, sizeof(cl_timestr), cl_format_str, localtime_r(&ltime, &t));
}
// How does it works?
@@ -136,8 +143,7 @@ void CComponentsFrmClock::initCCLockItems()
lbl->doPaintBg(false);
//set corner properties of label item
lbl->setCornerRadius(corner_rad-fr_thickness);
lbl->setCornerType(corner_type);
lbl->setCorner(corner_rad-fr_thickness, corner_type);
//set text border to 0
lbl->setTextBorderWidth(0,0);
@@ -180,7 +186,6 @@ void CComponentsFrmClock::initCCLockItems()
//ensure paint of text and label bg on changed text or painted form background
bool force_txt_and_bg = (lbl->textChanged() || this->paint_bg);
lbl->forceTextPaint(force_txt_and_bg);
lbl->doPaintTextBoxBg(force_txt_and_bg);
//set xpos of item
cl_x += wtmp;

View File

@@ -81,41 +81,42 @@ class CComponentsFrmClock : public CComponentsForm
void initSegmentAlign(int* segment_width, int* segment_height);
public:
CComponentsFrmClock();
CComponentsFrmClock( const int x_pos, const int y_pos, const int w, const int h,
const char* format_str = "%H:%M", bool activ=true, bool has_shadow = CC_SHADOW_OFF,
fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
~CComponentsFrmClock();
virtual ~CComponentsFrmClock();
///set font type for segments
void setClockFont(Font *font){cl_font = font;};
virtual void setClockFont(Font *font){cl_font = font;};
///set text color
void setTextColor(fb_pixel_t color_text){ cl_col_text = color_text;};
virtual void setTextColor(fb_pixel_t color_text){ cl_col_text = color_text;};
///set alignment of timestring, possible modes see align types in cc_types.h
void setClockAlignment(int align_type){cl_align = align_type;};
virtual void setClockAlignment(int align_type){cl_align = align_type;};
///use string expession: "%H:%M" = 12:22, "%H:%M:%S" = 12:22:12
void setClockFormat(const char* format_str){cl_format_str = format_str;};
virtual void setClockFormat(const char* format_str){cl_format_str = format_str;};
///start ticking clock thread, returns true on success, if false causes log output
bool startThread();
virtual bool startThread();
///stop ticking clock thread, returns true on success, if false causes log output
bool stopThread();
virtual bool stopThread();
bool Start();
bool Stop();
virtual bool Start();
virtual bool Stop();
///returns true, if clock is running in thread
bool isClockRun() const {return cl_thread == 0 ? false:true;};
virtual bool isClockRun() const {return cl_thread == 0 ? false:true;};
///set refresh interval in seconds, default value=1 (=1 sec)
void setClockIntervall(const int& seconds){cl_interval = seconds;};
virtual void setClockIntervall(const int& seconds){cl_interval = seconds;};
///show clock on screen
void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
///reinitialize clock contents
void refresh() { initCCLockItems(); }
virtual void refresh() { initCCLockItems(); }
};
#endif

View File

@@ -98,6 +98,7 @@ void CComponentsHeader::initVarHeader()
corner_type = CORNER_TOP;
//init header height
cch_size_mode = CC_HEADER_SIZE_LARGE;
cch_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE];
height = cch_font->getHeight();
@@ -183,13 +184,12 @@ void CComponentsHeader::initIcon()
cch_icon_obj->setPictureAlign(CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER);
//set corner mode of icon item
cch_icon_obj->setCornerRadius(corner_rad-fr_thickness);
int cc_icon_corner_type = corner_type;
if (corner_type == CORNER_TOP_LEFT || corner_type == CORNER_TOP)
cc_icon_corner_type = CORNER_TOP_LEFT;
else
cc_icon_corner_type = CORNER_LEFT;
cch_icon_obj->setCornerType(cc_icon_corner_type);
cch_icon_obj->setCorner(corner_rad-fr_thickness, cc_icon_corner_type);
//global set width of icon object
cch_icon_w = cch_icon_obj->getWidth();
@@ -278,13 +278,12 @@ void CComponentsHeader::initButtons()
cch_btn_obj->addIcon(v_cch_btn);
//set corner mode of button item
cch_btn_obj->setCornerRadius(corner_rad-fr_thickness);
int cc_btn_corner_type = corner_type;
if (corner_type == CORNER_TOP_RIGHT || corner_type == CORNER_TOP)
cc_btn_corner_type = CORNER_TOP_RIGHT;
else
cc_btn_corner_type = CORNER_RIGHT;
cch_btn_obj->setCornerType(cc_btn_corner_type);
cch_btn_obj->setCorner(corner_rad-fr_thickness, cc_btn_corner_type);
//global adapt height
height = max(height, cch_btn_obj->getHeight());
@@ -330,8 +329,7 @@ void CComponentsHeader::initCaption()
cch_text_obj->setColorBody(col_body);
//corner of text item
cch_text_obj->setCornerRadius(corner_rad-fr_thickness);
cch_text_obj->setCornerType(corner_type);
cch_text_obj->setCorner(corner_rad-fr_thickness, corner_type);
/*
global adapt height not needed here again
@@ -343,6 +341,9 @@ void CComponentsHeader::initCaption()
void CComponentsHeader::initCCItems()
{
//set size
cch_font = (cch_size_mode == CC_HEADER_SIZE_LARGE? g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE] : g_Font[SNeutrinoSettings::FONT_TYPE_MENU]);
//init icon
initIcon();

View File

@@ -0,0 +1,370 @@
/*
Based up Neutrino-GUI - Tuxbox-Project
Copyright (C) 2001 by Steffen Hehn 'McClean'
Class for signalbar based up CComponent classes.
Copyright (C) 2013, 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, write to the
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <global.h>
#include <neutrino.h>
#include "cc_frm_signalbars.h"
#include <sstream>
#define SB_MIN_HEIGHT 12
using namespace std;
CSignalBar::CSignalBar()
{
initVarSigBar();
initSBItems();
}
CSignalBar::CSignalBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref)
{
initVarSigBar();
sb_frontend = frontend_ref;
x = xpos;
y = ypos;
width = w;
height = h;
initSBItems();
}
void CSignalBar::initDimensions()
{
//set current required dimensions and font size
sb_item_height = max(height, SB_MIN_HEIGHT) - 2*fr_thickness - append_h_offset;
sb_item_top = height/2 - sb_item_height/2;
if (sb_scale_height == -1)
sb_scale_height = sb_item_height;
//use value in % of signalbox width for scale, rest is reserved for caption
sb_scale_width = width*sb_scale_w_percent/100;
int dx = width - sb_scale_width;
int dy = sb_item_height;
sb_font = *dy_font->getDynFont(dx, dy);
//use 15% for value and name label
sb_vlbl_width = sb_lbl_width = dx /2;
}
void CSignalBar::initSBItems()
{
if (cc_parent){
//use backround color of parent form if signalbar is embedded
col_body = cc_parent->getColorBody();
//and set required color for text to name label
CSignalBox *sbx = static_cast<CSignalBox*>(cc_parent);
sb_caption_color = sbx->getTextColor();
}
//reinit dimensions
initDimensions();
//init items scale, value and name
initSBarScale();
initSBarValue();
initSBarName();
}
void CSignalBar::initVarSigBar()
{
initVarForm();
corner_rad = 0;
corner_type = 0;
append_h_offset = 2;
append_v_offset = 2;
height = SB_MIN_HEIGHT;
sb_scale_height = -1;
sb_scale_w_percent = 60;
dy_font = CNeutrinoFonts::getInstance();
sb_caption_color= COL_INFOBAR_TEXT;
sb_lastsig = 0;
sb_signal = 0;
sb_frontend = NULL;
sb_scale = NULL;
sb_vlbl = NULL;
sb_lbl = NULL;
sb_name = "SIG";
}
void CSignalBar::initSBarScale()
{
//create scale object if required
if (sb_scale == NULL){
sb_scale = new CProgressBar();
//we want colored scale!
sb_scale->setBlink();
}
//move and set dimensions
int scale_y = (sb_item_height/2 - sb_scale_height/2);
sb_scale->setDimensionsAll(fr_thickness, scale_y, sb_scale_width, sb_scale_height);
sb_scale->setColorBody(col_body);
//add scale object to container
if(!sb_scale->isAdded())
addCCItem(sb_scale);
}
void CSignalBar::initSBarValue()
{
//create value label object with basic properties
if (sb_vlbl == NULL){
sb_vlbl = new CComponentsLabel();
sb_vlbl->doPaintBg(false);
sb_vlbl->setText("0%", CTextBox::NO_AUTO_LINEBREAK, sb_font);
}
//move and set dimensions
int vlbl_x = sb_scale->getXPos() + sb_scale_width + append_v_offset;
int vlbl_h = sb_scale->getHeight();
int vlbl_y = sb_item_height/2 + sb_item_top - vlbl_h/2 - append_h_offset;
sb_vlbl->setDimensionsAll(vlbl_x, vlbl_y, sb_vlbl_width, vlbl_h);
//set current text and body color color
sb_vlbl->setTextColor(sb_caption_color);
sb_vlbl->setColorBody(col_body);
//add value label object to container
if (!sb_vlbl->isAdded())
addCCItem(sb_vlbl);
}
void CSignalBar::initSBarName()
{
//create name label object with basic properties
if (sb_lbl == NULL){
sb_lbl = new CComponentsLabel();
sb_lbl->doPaintBg(false);
sb_lbl->setText(sb_name, CTextBox::NO_AUTO_LINEBREAK/* | CTextBox::RIGHT*/, sb_font);
sb_lbl->forceTextPaint();
sb_lbl->doPaintTextBoxBg(true);
}
//move and set dimensions
int lbl_x = sb_vlbl->getXPos()+ sb_vlbl->getWidth();
int lbl_h = sb_vlbl->getHeight();
int lbl_y = sb_item_height/2 + sb_item_top - lbl_h/2 - append_h_offset;
sb_lbl->setDimensionsAll(lbl_x, lbl_y, sb_lbl_width, lbl_h);
//set current text and body color
sb_lbl->setTextColor(sb_caption_color);
sb_lbl->setColorBody(col_body);
//add name label object to container
if (!sb_lbl->isAdded())
addCCItem(sb_lbl);
}
void CSignalBar::Refresh()
{
//get current value from frontend
sb_signal = sb_frontend->getSignalStrength();
//reinit items with current values
initSBItems();
}
void CSignalBar::paintScale()
{
//format signal values
int sig;
sig = (sb_signal & 0xFFFF) * 100 / 65535;
//exit if value too small
if(sig < 5)
return;
//assign current value to scale object and paint new value
if (sb_lastsig != sig) {
sb_lastsig = sig;
sb_scale->setValues(sig, 100);
//string is required
ostringstream i_str;
i_str << sig;
string percent(i_str.str());
percent += "%";
sb_vlbl->setText(percent, CTextBox::NO_AUTO_LINEBREAK | CTextBox::CENTER, sb_font);
//we must force paint backround, because of changing values
sb_vlbl->doPaintBg(true);
sb_vlbl->forceTextPaint();
sb_vlbl->doPaintTextBoxBg(true);
sb_vlbl->setColorBody(col_body);
//repaint labels
for(size_t i=0; i<this->v_cc_items.size(); i++)
v_cc_items[i]->paint(false);
}
}
void CSignalBar::paint(bool do_save_bg)
{
//initialize before and paint frame and body
if (!is_painted){
initSBItems();
paintForm(do_save_bg);
}
//paint current sig value
paintScale();
}
//*******************************************************************************************************************************
CSignalNoiseRatioBar::CSignalNoiseRatioBar()
{
initVarSnrBar();
initSBItems();
}
CSignalNoiseRatioBar::CSignalNoiseRatioBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref)
{
initVarSnrBar();
sb_frontend = frontend_ref;
x = xpos;
y = ypos;
width = w;
height = h;
initSBItems();
}
void CSignalNoiseRatioBar::initVarSnrBar()
{
initVarSigBar();
sb_name = "SNR";
}
void CSignalNoiseRatioBar::Refresh()
{
//get current value from frontend
sb_signal = sb_frontend->getSignalNoiseRatio();
//reinit items with current values
initSBItems();
}
//**********************************************************************************************************************
CSignalBox::CSignalBox(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref)
{
initVarSigBox();
sbx_frontend = frontend_ref;
x = xpos;
y = ypos;
width = w;
height = h;
sbx_bar_height = height/2;
sbx_bar_width = width-2*corner_rad;
sbar = new CSignalBar(sbx_bar_x, 0, sbx_bar_width, sbx_bar_height, sbx_frontend);
sbar->doPaintBg(false);
addCCItem(sbar);
snrbar = new CSignalNoiseRatioBar(sbx_bar_x, CC_APPEND, sbx_bar_width, sbx_bar_height, sbx_frontend);
snrbar->doPaintBg(false);
addCCItem(snrbar);
initSignalItems();
}
void CSignalBox::initVarSigBox()
{
initVarForm();
corner_rad = 0;
sbx_frontend = NULL;
sbar = NULL;
snrbar = NULL;
height = 3* SB_MIN_HEIGHT;
sbx_bar_height = height/2;
sbx_bar_x = corner_rad;
sbx_caption_color = COL_INFOBAR_TEXT;
sbx_scale_w_percent = 60;
}
void CSignalBox::initSignalItems()
{
//set current properties for items
// int cor_rad = corner_rad/2-fr_thickness;
// int corr_y = sbx_bar_height%2;
// int sb_h = sbx_bar_height - corr_y;
int sbar_h = sbx_bar_height - fr_thickness - append_v_offset/2;
int sbar_w = sbx_bar_width - 2*fr_thickness;
int sbar_x = sbx_bar_x + fr_thickness;
int scale_h = sbar_h * 76 / 100;
sbar->setDimensionsAll(sbar_x, fr_thickness, sbar_w, sbar_h);
sbar->setFrontEnd(sbx_frontend);
sbar->setCorner(0);
sbar->setScaleHeight(scale_h);
sbar->setScaleWidth(sbx_scale_w_percent);
snrbar->setDimensionsAll(sbar_x, CC_APPEND, sbar_w, sbar_h);
snrbar->setFrontEnd(sbx_frontend);
snrbar->setCorner(0);
snrbar->setScaleHeight(scale_h);
snrbar->setScaleWidth(sbx_scale_w_percent);
}
void CSignalBox::paintScale()
{
initSignalItems();
//repaint items
sbar->Refresh();
sbar->paint/*Scale*/(false);
snrbar->Refresh();
snrbar->paint/*Scale*/(false);
}
void CSignalBox::paint(bool do_save_bg)
{
//paint frame and body
if (!is_painted){
initSignalItems();
paintForm(do_save_bg);
}
//paint current signal value
paintScale();
}

View File

@@ -0,0 +1,288 @@
/*
Based up Neutrino-GUI - Tuxbox-Project
Copyright (C) 2001 by Steffen Hehn 'McClean'
Class for signalbar based up CComponent classes.
Copyright (C) 2013, 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, write to the
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef __SIGNALBARS_H__
#define __SIGNALBARS_H__
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <global.h>
#include <neutrino.h>
#include <gui/components/cc_frm.h>
#include <gui/components/cc_item_progressbar.h>
#include <gui/components/cc_item_text.h>
#include <zapit/include/zapit/frontend_c.h>
#include <driver/neutrinofonts.h>
/// Basic class for signalbars
/*!
Basic attributes and member functions for items.
These class provides basic attributes and members to show frontend values in signalbars.
CSignalBar() and their sub classes based up CComponentsForm() and are usable like other CComponentsItems()
CSignalBar() is intended to show signal rate.
*/
class CSignalBar : public CComponentsForm
{
public:
///refresh current item properties, use this before paintScale().
void Refresh();
protected:
///object: current frontend
CFrontend *sb_frontend;
///object: scale bar
CProgressBar *sb_scale;
///object: value caption
CComponentsLabel *sb_vlbl;
///object: caption for signal name
CComponentsLabel *sb_lbl;
///object: current font
Font *sb_font;
///object: dynamic font object handler
CNeutrinoFonts *dy_font;
///property: text color, see also setTextColor()
fb_pixel_t sb_caption_color;
///property: item top position
int sb_item_top;
///property: height of items
int sb_item_height;
///property: height of scale
int sb_scale_height;
///property: width of progressbar
int sb_scale_width;
///property: width of value caption
int sb_vlbl_width;
///property: width of caption
int sb_lbl_width;
///cache last assingned signal value
int sb_lastsig;
///current signal value
uint16_t sb_signal;
///allowed width of scale bar from full width in %, rest used by caption, default value = 60% of width, use setScaleWidth() to set this value
short sb_scale_w_percent;
///initialize all needed basich attributes and objects
void initVarSigBar();
///initianlize position and dimensions of signalbar container
void initDimensions();
///initialize scale object
void initSBarScale();
///initialize value caption object, this contains the value of current frontend data, signal or noise rate
void initSBarValue();
///initialize caption object, this contains the unit (e.g %) or name of value (e.g. SIG)
void initSBarName();
///initialize all required objects at once, see also Refresh()
void initSBItems();
///reinitialize current signal values and paint new values, required after Refresh()
void paintScale();
///property: contains the name of signal type in the caption object, see also setName()
std::string sb_name;
public:
CSignalBar();
///basic component class constructor for signal.
CSignalBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref);
///assigns the current used frontend, simplified a tuner object, see frontend_c.h
virtual void setFrontEnd(CFrontend *frontend_ref){sb_frontend = frontend_ref;};
///assigns font for caption
virtual void setTextFont(Font* font_text){sb_font = font_text;};
///sets the caption color, see also property 'sb_caption_color'
virtual void setTextColor(const fb_pixel_t& caption_color){ sb_caption_color = caption_color;};
///assigns the height of scale
virtual void setScaleHeight(const int& scale_height){sb_scale_height = scale_height;};
///assigns the width of scale
virtual void setScaleWidth(const short & scale_width_percent){sb_scale_w_percent = scale_width_percent;};
///assigns the name of signal value in the caption object, see also sb_name
virtual void setName(const std::string& name){sb_name = name;};
///returns the scale object, type = CProgressBar*
virtual CProgressBar* getScaleObject(){return sb_scale;};
///returns the caption object, type = CComponentsLabel*
virtual CComponentsLabel* getLabelObject(){return sb_lbl;};
///paint this items
virtual void paint(bool do_save_bg);
};
/// Sub class of CSignalBar()
/*!
This class use basic attributes and members from CSignalBar() to show frontend values.
CSignalNoiseRatioBar() is intended to show signal noise ratio value.
*/
class CSignalNoiseRatioBar : public CSignalBar
{
public:
///refresh current item properties, use this before paintScale().
void Refresh();
protected:
///initialize all needed basic attributes and objects
void initVarSnrBar();
public:
CSignalNoiseRatioBar();
///basic component class constructor for signal noise ratio.
CSignalNoiseRatioBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref);
};
/// Class CSignalBox() provides CSignalBar(), CSignalNoiseRatioBar() scales at once.
/*!
Provides basic attributes and member functions for CComponentItems in
additional of CSignalBar()- and CSignalNoiseRatioBar()-objects.
To add a signalbox object to your code add this to a header file:
#include <gui/widget/signalbars.h>
class CSampleClass
{
private:
//other stuff;
CSignalBox * signalbox;
public:
CSampleClass();
~CSampleClass();
void showSNR();
//other stuff;
};
//add this to your costructor into the code file:
CSampleClass::CSampleClass()
{
//other stuff;
signalbox = NULL;
}
CStreamInfo2::~CStreamInfo2 ()
{
//other stuff to clean;
delete signalbox;
//other stuff to clean;
}
void CSampleClass::showSNR()
{
if (signalbox == NULL){
signalbox = new CSignalBox(10, 100, 500, 38, frontend);
// signalbox->setCornerRadius(0); //optional
// signalbox->setColorBody(COL_BLACK); //optional
signalbox->setColorBody(COL_MENUHEAD_PLUS_0);q
signalbox->doPaintBg(false);
//if you want to add the object to a CC-Container (e.g. CComponentsWindow()), remove this line:
signalbox->paint(false);
//and add this lines:
// if (!ignalbox->isAdded())
// addCCItem(signalbox);
//Note: signal box objects deallocate together with the CC-Container!
}
else{
signalbox->paintScale();
}
}
void CSampleClass::hide ()
{
//other code;
//Note: not required if signalbox is added to a CC-Container!
signalbox->hide(true);
delete signalbox;
signalbox = NULL;
//other code;
}
*/
class CSignalBox : public CComponentsForm
{
private:
///object: current frontend
CFrontend *sbx_frontend;
///object: current signalbar
CSignalBar *sbar;
///object: current signal noise ratio bar
CSignalNoiseRatioBar *snrbar;
///property: height of signalbars
int sbx_bar_height;
///property: width of signalbars
int sbx_bar_width;
///property: x position of signalbars
int sbx_bar_x;
///property: text color, see also setTextColor()
fb_pixel_t sbx_caption_color;
///allowed width of scale bar from full width in %, rest used by caption, default value = 60% of width, use setScaleWidth() to set this value
short sbx_scale_w_percent;
///initialize all needed basic attributes and objects
void initVarSigBox();
///initialize general properties of signal items
void initSignalItems();
///paint items with new values, required after Refresh()
void paintScale();
public:
///class constructor for signal noise ratio.
CSignalBox(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref);
///returns the signal object, type = CSignalBar*
CSignalBar* getScaleObject(){return sbar;};
///returns the signal noise ratio object, type = CSignalNoiseRatioBar*
CSignalNoiseRatioBar* getLabelObject(){return snrbar;};
///sets the caption color of signalbars, see also property 'sbx_caption_color'
void setTextColor(const fb_pixel_t& caption_color){ sbx_caption_color = caption_color;};
///get caption color of signalbars, see also property 'sbx_caption_color'
fb_pixel_t getTextColor(){return sbx_caption_color;};
///assigns the width of scale
void setScaleWidth(const short & scale_width_percent){sbx_scale_w_percent = scale_width_percent;};
///paint items
void paint(bool do_save_bg);
};
#endif

View File

@@ -140,6 +140,7 @@ void CComponentsWindow::initVarWindow()
ccw_caption = "";
ccw_icon_name = NULL;
ccw_buttons = 0; //no header buttons
ccw_show_footer = true;
setShadowOnOff(true);
}
@@ -160,7 +161,7 @@ void CComponentsWindow::initHeader()
//set header properties
if (ccw_head){
ccw_head->setPos(0, 0);
ccw_head->setWidth(width);
ccw_head->setWidth(width-2*fr_thickness);
ccw_head->setIcon(ccw_icon_name);
ccw_head->setCaption(ccw_caption);
ccw_head->initCCItems();
@@ -179,10 +180,12 @@ void CComponentsWindow::initBody()
//set body properties
if (ccw_body){
ccw_body->setCornerType(0);
int fh = ccw_footer->getHeight();
int fh = 0;
if (ccw_footer)
fh = ccw_footer->getHeight();
int hh = ccw_head->getHeight();
int h_body = height - hh - fh;
ccw_body->setDimensionsAll(0, CC_APPEND, width, h_body);
int h_body = height - hh - fh - 2*fr_thickness;
ccw_body->setDimensionsAll(0, CC_APPEND, width-2*fr_thickness, h_body);
ccw_body->doPaintBg(false);
}
}
@@ -199,7 +202,7 @@ void CComponentsWindow::initFooter()
//set footer properties
if (ccw_footer){
ccw_footer->setPos(0, CC_APPEND);
ccw_footer->setWidth(width);
ccw_footer->setWidth(width-2*fr_thickness);
ccw_footer->setShadowOnOff(shadow);
}
}
@@ -216,16 +219,26 @@ void CComponentsWindow::initCCWItems()
printf("[CComponentsWindow] [%s - %d] init items...\n", __FUNCTION__, __LINE__);
#endif
initHeader();
initFooter();
//add footer if required
if (ccw_show_footer){
initFooter();
}else{
if (ccw_footer != NULL){
removeCCItem(ccw_footer);
ccw_footer = NULL;
}
}
initBody();
//add header, body and footer items only one time
if (!isAdded(ccw_head))
if (!ccw_head->isAdded())
addCCItem(ccw_head);
if (!isAdded(ccw_body))
if (!ccw_body->isAdded())
addCCItem(ccw_body);
if (!isAdded(ccw_footer))
addCCItem(ccw_footer);
if (ccw_footer)
if (!ccw_footer->isAdded())
addCCItem(ccw_footer);
}
void CComponentsWindow::paint(bool do_save_bg)

View File

@@ -151,3 +151,12 @@ int CComponentsItem::getItemType()
#endif
return -1;
}
//returns true if current item is added to a form
bool CComponentsItem::isAdded()
{
if (cc_parent)
return true;
return false;
}

View File

@@ -206,3 +206,58 @@ void CComponentsPicture::hide(bool no_restore)
hideCCItem(no_restore);
pic_painted = false;
}
CComponentsChannelLogo::CComponentsChannelLogo( const int x_pos, const int y_pos, const int w, const int h,
const uint64_t& channelId, const std::string& channelName,
const int alignment, bool has_shadow,
fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow)
:CComponentsPicture(x_pos, y_pos, w, h,
"", alignment, has_shadow,
color_frame, color_background, color_shadow)
{
channel_id = channelId;
channel_name = channelName;
initVarPictureChannellLogo();
}
void CComponentsChannelLogo::setPicture(const std::string& picture_name)
{
pic_name = picture_name;
channel_id = 0;
channel_name = "";
initVarPictureChannellLogo();
}
void CComponentsChannelLogo::setChannel(const uint64_t& channelId, const std::string& channelName)
{
channel_id = channelId;
channel_name = channelName;
initVarPictureChannellLogo();
}
void CComponentsChannelLogo::initVarPictureChannellLogo()
{
string tmp_logo = pic_name;
has_logo = false;
if (!(channel_id == 0 && channel_name.empty() && pic_name.empty()))
has_logo = GetLogoName(channel_id, channel_name, pic_name, &pic_width, &pic_height);
if (!has_logo)
pic_name = tmp_logo;
// #ifdef DEBUG_CC
printf(" [CComponentsChannelLogo] %s: init image: %s (has_logo=%d, channel_id=%lld)\n", __FUNCTION__, pic_name.c_str(), has_logo, channel_id);
// #endif
initVarPicture();
}
void CComponentsChannelLogo::paint(bool do_save_bg)
{
initVarPictureChannellLogo();
paintInit(do_save_bg);
paintPicture();
has_logo = false; //reset
}

View File

@@ -89,4 +89,27 @@ class CComponentsPicture : public CComponentsItem
virtual void setMaxHeight(const int h_max){pic_max_h = h_max;};
};
class CComponentsChannelLogo : public CComponentsPicture, CPictureViewer
{
protected:
///initialize all required attributes
void initVarPictureChannellLogo();
private:
uint64_t channel_id;
std::string channel_name;
bool has_logo;
public:
CComponentsChannelLogo( const int x_pos, const int y_pos, const int w, const int h,
const uint64_t& channelId =0, const std::string& channelName = "",
const int alignment = CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER, bool has_shadow = CC_SHADOW_OFF,
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_background = 0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
void setChannel(const uint64_t& channelId, const std::string& channelName);
void setPicture(const std::string& picture_name);
bool hasLogo(){return has_logo;};
void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
};
#endif

View File

@@ -199,8 +199,7 @@ void CComponentsText::setText(const int digit, const int mode, Font* font_text)
setText(s_digit, mode, font_text);
}
//set text lines directly from a file, returns true on succsess
bool CComponentsText::setTextFromFile(const string& path_to_textfile, const int mode, Font* font_text)
string CComponentsText::getTextFromFile(const string& path_to_textfile)
{
string file = path_to_textfile;
string txt = "";
@@ -208,7 +207,7 @@ bool CComponentsText::setTextFromFile(const string& path_to_textfile, const int
ifstream in (file.c_str(), ios::in);
if (!in){
printf("[CComponentsText] [%s - %d] error while open %s -> %s\n", __FUNCTION__, __LINE__, file.c_str(), strerror(errno));
return false;
return "";
}
string line;
@@ -217,8 +216,19 @@ bool CComponentsText::setTextFromFile(const string& path_to_textfile, const int
}
in.close();
setText(txt, mode, font_text);
return txt;
}
//set text lines directly from a file, returns true on succsess
bool CComponentsText::setTextFromFile(const string& path_to_textfile, const int mode, Font* font_text)
{
string txt = getTextFromFile(path_to_textfile);
if (txt.empty())
return false;
setText(txt, mode, font_text);
return true;
}

View File

@@ -118,6 +118,8 @@ class CComponentsText : public CComponentsItem, public CBox
virtual void setText(const int digit, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL);
///set text directly from a textfile, path as string is required
virtual bool setTextFromFile(const std::string& path_to_textfile, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL);
///get text directly from a textfile, path as string is required
virtual std::string getTextFromFile(const std::string& path_to_textfile);
///helper to remove linebreak chars from a string if needed
virtual void removeLineBreaks(std::string& str);

View File

@@ -89,10 +89,10 @@ void CComponentsPIP::paint(bool do_save_bg)
}
if(CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_tv){
videoDecoder->Pig(pig_x+2, pig_y, pig_w, pig_h, screen_w, screen_h);
videoDecoder->Pig(pig_x, pig_y, pig_w, pig_h, screen_w, screen_h);
}
else{ //paint an alternate image if no tv mode available
CComponentsPicture pic = CComponentsPicture (pig_x, pig_y, pig_w, pig_h, pic_name, CC_ALIGN_LEFT);
CComponentsPicture pic = CComponentsPicture (pig_x, pig_y, pig_w, pig_h, pic_name, CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER);
pic.paint(CC_SAVE_SCREEN_NO);
}

View File

@@ -134,7 +134,12 @@ typedef struct comp_element_data_t
#define CC_SAVE_SCREEN_NO false
#define CC_NO_INDEX -1
///predefined parameters for auto positionizing of embedded items inside a parent form
///CC_APPEND used for x or y position or booth. An item with this parameter will paint automatically arranged side by side
#define CC_APPEND -1
///CC CENTERED used for x or y position or booth. An item with this parameter will paint automatically centered
#define CC_CENTERED -2