Merge remote-tracking branch 'check/next-cc'

build-tested only, needs fixing

Conflicts:
	data/locale/deutsch.locale
	data/locale/english.locale
	src/Makefile.am
	src/driver/rcinput.cpp
	src/driver/streamts.cpp
	src/eitd/sectionsd.cpp
	src/gui/Makefile.am
	src/gui/bouquetlist.cpp
	src/gui/hdd_menu.cpp
	src/gui/luainstance.cpp
	src/gui/luainstance.h
	src/gui/moviebrowser.cpp
	src/gui/movieplayer.cpp
	src/gui/pluginlist.cpp
	src/gui/plugins.cpp
	src/gui/plugins.h
	src/gui/scan.cpp
	src/gui/scan_setup.cpp
	src/gui/user_menue.cpp
	src/gui/videosettings.cpp
	src/gui/widget/menue.cpp
	src/neutrino.cpp
	src/neutrinoMessages.h
	src/system/locals.h
	src/system/locals_intern.h
	src/zapit/include/zapit/scan.h
	src/zapit/src/femanager.cpp
	src/zapit/src/frontend.cpp
	src/zapit/src/getservices.cpp
	src/zapit/src/transponder.cpp
This commit is contained in:
Stefan Seyfried
2014-04-27 19:14:06 +02:00
178 changed files with 6683 additions and 3601 deletions

View File

@@ -3,7 +3,7 @@
Copyright (C) 2001 by Steffen Hehn 'McClean'
Classes for generic GUI-related components.
Copyright (C) 2012, 2013, Thilo Graf 'dbt'
Copyright (C) 2012-2014, Thilo Graf 'dbt'
Copyright (C) 2012, Michael Liebmann 'micha-bbg'
License: GPL
@@ -31,30 +31,11 @@
#include <global.h>
#include <neutrino.h>
#include "cc_base.h"
#include <system/debug.h>
using namespace std;
//abstract basic class CComponents
CComponents::CComponents()
{
initVarBasic();
}
CComponents::~CComponents()
{
hide();
clearSavedScreen();
clearFbData();
}
void CComponents::clearSavedScreen()
{
if (saved_screen.pixbuf)
delete[] saved_screen.pixbuf;
saved_screen.pixbuf = NULL;
}
void CComponents::initVarBasic()
{
x = saved_screen.x = 0;
y = saved_screen.y = 0;
@@ -73,7 +54,7 @@ void CComponents::initVarBasic()
shadow_w = SHADOW_OFFSET;
fr_thickness = 0;
fr_thickness_sel = 3;
firstPaint = true;
is_painted = false;
paint_bg = true;
@@ -83,17 +64,55 @@ void CComponents::initVarBasic()
saved_screen.pixbuf = NULL;
}
CComponents::~CComponents()
{
hide();
clearSavedScreen();
clearFbData();
}
void CComponents::clearSavedScreen()
{
if (saved_screen.pixbuf)
delete[] saved_screen.pixbuf;
saved_screen.pixbuf = NULL;
}
bool CComponents::CheckFbData(const comp_fbdata_t& fbdata, const char* func, const int line)
{
int32_t rows = fbdata.dx / (int32_t)frameBuffer->getScreenWidth(true) - 1 + fbdata.y;
int32_t rest = fbdata.dx % (int32_t)frameBuffer->getScreenWidth(true);
int32_t end = rows * (int32_t)frameBuffer->getScreenWidth(true) + rest;
if ( (fbdata.x < 0 || fbdata.y < 0) ||
(end >= (int32_t)frameBuffer->getScreenWidth(true)*(int32_t)frameBuffer->getScreenHeight(true))
) {
dprintf(DEBUG_NORMAL, "[CComponents] ERROR! Position < 0 or > FB end [%s - %d]\n\tx = %d y = %d\n\tdx = %d dy = %d\n",
func, line,
fbdata.x, fbdata.y,
fbdata.dx, fbdata.dy);
return false;
}
if (fbdata.dx == 0 || fbdata.dy == 0) {
dprintf(DEBUG_DEBUG,"[CComponents] INFO! dx and/or dy = 0 [%s - %d]\n\tx = %d y = %d\n\tdx = %d dy = %d\n",
func, line,
fbdata.x, fbdata.y,
fbdata.dx, fbdata.dy);
return false;
}
return true;
}
//paint framebuffer stuff and fill buffer
void CComponents::paintFbItems(bool do_save_bg)
{
//save background before first paint, do_save_bg must be true
if (firstPaint && do_save_bg) {
if (firstPaint && do_save_bg){
for(size_t i=0; i<v_fbdata.size(); i++){
if (v_fbdata[i].fbdata_type == CC_FBDATA_TYPE_BGSCREEN){
if ((v_fbdata[i].x <= 0) || (v_fbdata[i].y <= 0))
printf("\33[31m\t[CComponents] WARNING! Position <= 0 [%s - %d], x = %d y = %d\n\033[37m", __func__, __LINE__, v_fbdata[i].x, v_fbdata[i].y);
#ifdef DEBUG_CC
printf("\t[CComponents]\n\t[%s - %d] firstPaint->save screen: %d, fbdata_type: %d\n\tx = %d\n\ty = %d\n\tdx = %d\n\tdy = %d\n",
if (!CheckFbData(v_fbdata[i], __func__, __LINE__)){
break;
}
dprintf(DEBUG_DEBUG, "[CComponents]\n\t[%s - %d] firstPaint->save screen: %d, fbdata_type: %d\n\tx = %d\n\ty = %d\n\tdx = %d\n\tdy = %d\n",
__func__,
__LINE__,
firstPaint,
@@ -102,31 +121,26 @@ void CComponents::paintFbItems(bool do_save_bg)
v_fbdata[i].y,
v_fbdata[i].dx,
v_fbdata[i].dy);
#endif
saved_screen.x = v_fbdata[i].x;
saved_screen.y = v_fbdata[i].y;
saved_screen.dx = v_fbdata[i].dx;
saved_screen.dy = v_fbdata[i].dy;
clearSavedScreen();
saved_screen.pixbuf = getScreen(saved_screen.x, saved_screen.y, saved_screen.dx, saved_screen.dy);
firstPaint = false;
break;
}
saved_screen.x = v_fbdata[i].x;
saved_screen.y = v_fbdata[i].y;
saved_screen.dx = v_fbdata[i].dx;
saved_screen.dy = v_fbdata[i].dy;
clearSavedScreen();
saved_screen.pixbuf = getScreen(saved_screen.x, saved_screen.y, saved_screen.dx, saved_screen.dy);
firstPaint = false;
break;
}
}
for(size_t i=0; i< v_fbdata.size() ;i++){
// Don't paint if dx or dy are 0
if ((v_fbdata[i].dx == 0) || (v_fbdata[i].dy == 0)){
#ifdef DEBUG_CC
printf("\t[CComponents] WARNING: [%s - %d], dx = %d dy = %d\n", __func__, __LINE__, v_fbdata[i].dx, v_fbdata[i].dy);
#endif
for(size_t i=0; i< v_fbdata.size(); i++){
// Don't paint on dimension or position error dx or dy are 0
if (!CheckFbData(v_fbdata[i], __func__, __LINE__)){
continue;
}
int fbtype = v_fbdata[i].fbdata_type;
#ifdef DEBUG_CC
printf("\t[CComponents]\n\t[%s - %d], fbdata_[%d]\n\tx = %d\n\ty = %d\n\tdx = %d\n\tdy = %d\n",
dprintf(DEBUG_DEBUG, "[CComponents]\n\t[%s - %d], fbdata_[%d]\n\tx = %d\n\ty = %d\n\tdx = %d\n\tdy = %d\n",
__func__,
__LINE__,
(int)i,
@@ -134,7 +148,7 @@ void CComponents::paintFbItems(bool do_save_bg)
v_fbdata[i].y,
v_fbdata[i].dx,
v_fbdata[i].dy);
#endif
//some elements can be assembled from lines and must be handled as one unit (see details line),
//so all individual backgrounds of boxes must be saved and painted in "firstpaint mode"
if (firstPaint){
@@ -224,10 +238,20 @@ void CComponents::kill()
}
//clean old screen buffer
inline void CComponents::clearFbData()
void CComponents::clearFbData()
{
for(size_t i =0; i< v_fbdata.size() ;i++)
if (v_fbdata[i].pixbuf)
delete[] v_fbdata[i].pixbuf;
v_fbdata.clear();
}
inline void CComponents::setXPos(const int& xpos)
{
x = xpos;
}
inline void CComponents::setYPos(const int& ypos)
{
y = ypos;
}

View File

@@ -3,7 +3,7 @@
Copyright (C) 2001 by Steffen Hehn 'McClean'
Classes for generic GUI-related components.
Copyright (C) 2012, 2013, Thilo Graf 'dbt'
Copyright (C) 2012-2014, Thilo Graf 'dbt'
License: GPL
@@ -33,8 +33,6 @@
#include <driver/pictureviewer/pictureviewer.h>
#include <gui/widget/icons.h>
/// Basic component class.
/*!
Basic attributes and member functions for component sub classes
@@ -45,9 +43,7 @@ class CComponents
private:
///pixel buffer handling, returns pixel buffer depends of given parameters
fb_pixel_t* getScreen(int ax, int ay, int dx, int dy);
///initialize of basic attributes, no parameters required
void initVarBasic();
protected:
///object: framebuffer object, usable in all sub classes
CFrameBuffer * frameBuffer;
@@ -104,6 +100,9 @@ class CComponents
///parameter do_save_bg=true, saves background of element to pixel buffer, this can be restore with hide()
void paintFbItems(bool do_save_bg = true);
///check current fbdtata position and dimensions, parameter fbdata is an element of v_fbdata, returns false on error
bool CheckFbData(const comp_fbdata_t& fbdata, const char* func, const int line);
///clean up old screen buffer saved in v_fbdata
virtual void clearFbData();
@@ -117,11 +116,11 @@ class CComponents
CComponents();
virtual~CComponents();
///set screen x-position
inline virtual void setXPos(const int& xpos){x = xpos;};
///set screen y-position,
inline virtual void setYPos(const int& ypos){y = ypos;};
///set x and y position
///set screen x-position, parameter as int
virtual void setXPos(const int& xpos);
///set screen y-position, parameter as int
virtual void setYPos(const int& ypos);
///set x and y position at once
///Note: position of bound components (items) means position related within parent form, not for screen!
///to set the real screen position, look at setRealPos()
inline virtual void setPos(const int& xpos, const int& ypos){x = xpos; y = ypos;};
@@ -218,9 +217,6 @@ class CComponents
class CComponentsItem : public CComponents
{
private:
///initialize all required attributes
void initVarItem();
protected:
///property: define of item type, see cc_types.h for possible types
int cc_item_type;
@@ -235,7 +231,7 @@ class CComponentsItem : public CComponents
///Pointer to the form object in which this item is embedded.
///Is typically the type CComponentsForm or derived classes, default intialized with NULL
CComponentsItem *cc_parent;
CComponentsForm *cc_parent;
///hides item, arg: no_restore=true causes no restore of background, but clean up pixel buffer if required
void hideCCItem(bool no_restore = false);
@@ -247,14 +243,17 @@ class CComponentsItem : public CComponents
///an item will be hide or overpainted with other methods, or it's embedded (bound) in a parent form.
void paintInit(bool do_save_bg);
///add "this" current item to parent
void initParent(CComponentsForm* parent);
public:
CComponentsItem();
CComponentsItem(CComponentsForm *parent = NULL);
///sets pointer to the form object in which this item is embedded.
virtual void setParent(CComponentsItem *parent){cc_parent = parent;};
virtual void setParent(CComponentsForm *parent){cc_parent = parent;};
///returns pointer to the form object in which this item is embedded.
virtual CComponentsItem * getParent(){return cc_parent;};
virtual CComponentsForm* getParent(){return cc_parent;};
///property: returns true if item is added to a form
virtual bool isAdded();
@@ -283,6 +282,21 @@ class CComponentsItem : public CComponents
///set an index to item, see also attribut cc_item_index.
///To generate an index, use genIndex()
virtual void setIndex(const int& index){cc_item_index = index;};
///set screen x-position, parameter as uint8_t, percent x value related to current width of parent form or screen
virtual void setXPosP(const uint8_t& xpos_percent);
///set screen y-position, parameter as uint8_t, percent y value related to current height of parent form or screen
virtual void setYPosP(const uint8_t& ypos_percent);
///set x and y position as percent value related to current parent form or screen dimensions at once
virtual void setPosP(const uint8_t& xpos_percent, const uint8_t& ypos_percent);
///do center item on screen or within a parent form, parameter along_mode assigns direction of centering
virtual void setCenterPos(int along_mode = CC_ALONG_X | CC_ALONG_Y);
///set item height, parameter as uint8_t, as percent value related to current height of parent form or screen
virtual void setHeightP(const uint8_t& h_percent);
///set item width, parameter as uint8_t, as percent value related to current width of parent form or screen
virtual void setWidthP(const uint8_t& w_percent);
};
#endif

View File

@@ -31,24 +31,21 @@
#include "cc_frm.h"
#include <stdlib.h>
#include <algorithm>
#include <system/debug.h>
using namespace std;
//-------------------------------------------------------------------------------------------------------
//sub class CComponentsForm from CComponentsItem
CComponentsForm::CComponentsForm()
CComponentsForm::CComponentsForm( const int x_pos, const int y_pos, const int w, const int h,
CComponentsForm* parent,
bool has_shadow,
fb_pixel_t color_frame,
fb_pixel_t color_body,
fb_pixel_t color_shadow)
:CComponentsItem(parent)
{
//CComponentsForm
initVarForm();
}
cc_item_type = CC_ITEMTYPE_FRM;
CComponentsForm::CComponentsForm(const int x_pos, const int y_pos, const int w, const int h, bool has_shadow,
fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
{
//CComponentsForm
initVarForm();
//CComponents
x = x_pos;
y = y_pos;
cc_xr = x;
@@ -60,6 +57,16 @@ CComponentsForm::CComponentsForm(const int x_pos, const int y_pos, const int w,
col_frame = color_frame;
col_body = color_body;
col_shadow = color_shadow;
shadow_w = SHADOW_OFFSET;
corner_rad = RADIUS_LARGE;
corner_type = CORNER_ALL;
cc_item_index = 0;
v_cc_items.clear();
append_x_offset = 0;
append_y_offset = 0;
}
CComponentsForm::~CComponentsForm()
@@ -72,15 +79,12 @@ void CComponentsForm::clear()
{
if (v_cc_items.empty())
return;
#ifdef DEBUG_CC
printf(" [CComponentsForm] %s... delete %d cc-item(s) \n", __func__, (int)v_cc_items.size());
#endif
for(size_t i=0; i<v_cc_items.size(); i++) {
if (v_cc_items[i]){
#ifdef DEBUG_CC
printf(" [CComponentsForm] %s... delete form cc-item %d of %d (type=%d)\n", __func__, (int)i+1, (int)v_cc_items.size(), v_cc_items[i]->getItemType());
#endif
dprintf(DEBUG_DEBUG, "[CComponentsForm] %s... delete form cc-item %d of %d (type=%d)\n", __func__, (int)i+1, (int)v_cc_items.size(), v_cc_items[i]->getItemType());
delete v_cc_items[i];
v_cc_items[i] = NULL;
}
@@ -89,54 +93,25 @@ void CComponentsForm::clear()
}
void CComponentsForm::initVarForm()
{
//simple default dimensions
x = 0;
y = 0;
width = 150;
height = 150;
shadow = CC_SHADOW_OFF;
shadow_w = SHADOW_OFFSET;
col_frame = COL_MENUCONTENT_PLUS_6;
col_body = COL_MENUCONTENT_PLUS_0;
col_shadow = COL_MENUCONTENTDARK_PLUS_0;
corner_rad = RADIUS_LARGE;
corner_type = CORNER_ALL;
cc_item_index = 0;
//CComponentsForm
v_cc_items.clear();
cc_item_type = CC_ITEMTYPE_FRM;
append_x_offset = 0;
append_y_offset = 0;
}
void CComponentsForm::addCCItem(CComponentsItem* cc_Item)
{
if (cc_Item){
#ifdef DEBUG_CC
printf(" [CComponentsForm] %s-%d try to add cc_Item [type %d] to form [current index=%d] \n", __func__, __LINE__, cc_Item->getItemType(), cc_item_index);
#endif
dprintf(DEBUG_DEBUG, "[CComponentsForm] %s-%d try to add cc_Item [type %d] to form [current index=%d] \n", __func__, __LINE__, cc_Item->getItemType(), cc_item_index);
cc_Item->setParent(this);
v_cc_items.push_back(cc_Item);
#ifdef DEBUG_CC
printf(" added cc_Item [type %d] to form [current index=%d] \n", cc_Item->getItemType(), cc_item_index);
#endif
dprintf(DEBUG_DEBUG, "\tadded cc_Item [type %d] to form [current index=%d] \n", cc_Item->getItemType(), cc_item_index);
//assign item index
int new_index = genIndex();
cc_Item->setIndex(new_index);
#ifdef DEBUG_CC
printf(" %s-%d parent index = %d, assigned index ======> %d\n", __func__, __LINE__, cc_item_index, new_index);
#endif
dprintf(DEBUG_DEBUG, "\t%s-%d parent index = %d, assigned index ======> %d\n", __func__, __LINE__, cc_item_index, new_index);
}
#ifdef DEBUG_CC
else
printf(" [CComponentsForm] %s-%d tried to add an empty or invalide cc_item !!!\n", __func__, __LINE__);
#endif
dprintf(DEBUG_NORMAL, "[CComponentsForm] %s-%d tried to add an empty or invalide cc_item !!!\n", __func__, __LINE__);
}
void CComponentsForm::addCCItem(const std::vector<CComponentsItem*> &cc_Items)
@@ -177,7 +152,7 @@ void CComponentsForm::replaceCCItem(const uint& cc_item_id, CComponentsItem* new
if (!v_cc_items.empty()){
CComponentsItem* old_Item = v_cc_items[cc_item_id];
if (old_Item){
CComponentsItem * old_parent = old_Item->getParent();
CComponentsForm * old_parent = old_Item->getParent();
new_cc_Item->setParent(old_parent);
new_cc_Item->setIndex(old_parent->getIndex());
delete old_Item;
@@ -185,11 +160,8 @@ void CComponentsForm::replaceCCItem(const uint& cc_item_id, CComponentsItem* new
v_cc_items[cc_item_id] = new_cc_Item;
}
}
#ifdef DEBUG_CC
else
printf("[CComponentsForm] %s replace cc_Item not possible, v_cc_items is empty\n", __func__);
#endif
dprintf(DEBUG_NORMAL, "[CComponentsForm] %s replace cc_Item not possible, v_cc_items is empty\n", __func__);
}
void CComponentsForm::replaceCCItem(CComponentsItem* old_cc_Item, CComponentsItem* new_cc_Item)
@@ -201,17 +173,13 @@ void CComponentsForm::insertCCItem(const uint& cc_item_id, CComponentsItem* cc_I
{
if (cc_Item == NULL){
#ifdef DEBUG_CC
printf("[CComponentsForm] %s parameter: cc_Item = %p...\n", __func__, cc_Item);
#endif
dprintf(DEBUG_DEBUG, "[CComponentsForm] %s parameter: cc_Item = %p...\n", __func__, cc_Item);
return;
}
if (v_cc_items.empty()){
addCCItem(cc_Item);
#ifdef DEBUG_CC
printf("[CComponentsForm] %s insert cc_Item not possible, v_cc_items is empty, cc_Item added\n", __func__);
#endif
dprintf(DEBUG_DEBUG, "[CComponentsForm] %s insert cc_Item not possible, v_cc_items is empty, cc_Item added\n", __func__);
}else{
v_cc_items.insert(v_cc_items.begin()+cc_item_id, cc_Item);
cc_Item->setParent(this);
@@ -228,12 +196,11 @@ void CComponentsForm::removeCCItem(const uint& cc_item_id)
delete v_cc_items[cc_item_id];
v_cc_items[cc_item_id] = NULL;
v_cc_items.erase(v_cc_items.begin()+cc_item_id);
dprintf(DEBUG_DEBUG, "[CComponentsForm] %s removing cc_Item [id=%u]...\n", __func__, cc_item_id);
}
}
#ifdef DEBUG_CC
else
printf("[CComponentsForm] %s removing cc_Item not possible, v_cc_items is empty...\n", __func__);
#endif
dprintf(DEBUG_NORMAL, "[CComponentsForm] %s removing of cc_Item [id=%u] not possible, v_cc_items is empty...\n", __func__, cc_item_id);
}
void CComponentsForm::removeCCItem(CComponentsItem* cc_Item)

View File

@@ -31,8 +31,6 @@
class CComponentsForm : public CComponentsItem
{
private:
void initVarForm();
protected:
std::vector<CComponentsItem*> v_cc_items;
void paintForm(bool do_save_bg);
@@ -42,10 +40,12 @@ class CComponentsForm : public CComponentsItem
int append_x_offset;
int append_y_offset;
public:
CComponentsForm();
CComponentsForm(const int x_pos, const int y_pos, const int w, const int h, bool has_shadow = CC_SHADOW_OFF,
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
CComponentsForm( const int x_pos = 0, const int y_pos = 0, const int w = 800, const int h = 600,
CComponentsForm *parent = NULL,
bool has_shadow = CC_SHADOW_OFF,
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6,
fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0,
fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
virtual ~CComponentsForm();
void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);

View File

@@ -3,7 +3,7 @@
Copyright (C) 2001 by Steffen Hehn 'McClean'
Classes for generic GUI-related components.
Copyright (C) 2012, 2013, Thilo Graf 'dbt'
Copyright (C) 2012-2014, Thilo Graf 'dbt'
License: GPL
@@ -37,41 +37,41 @@
using namespace std;
CComponentsButton::CComponentsButton( const int x_pos, const int y_pos, const int w, const int h,
CComponentsButton::CComponentsButton( const int& x_pos, const int& y_pos, const int& w, const int& h,
const std::string& caption, const std::string& icon_name,
bool selected, bool enabled, bool has_shadow,
CComponentsForm* parent,
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 = caption;
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;
cc_btn_capt_locale = NONEXISTANT_LOCALE;
initVarButton(x_pos, y_pos, w, h, caption, icon_name, parent, selected, enabled, has_shadow, color_frame, color_body, color_shadow);
}
CComponentsButton::CComponentsButton( const int x_pos, const int y_pos, const int w, const int h,
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,
CComponentsForm* parent,
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_locale = caption_locale;
cc_btn_capt = g_Locale->getText(cc_btn_capt_locale);
cc_btn_capt_col = COL_MENUCONTENT_TEXT;
initVarButton(x_pos, y_pos, w, h, g_Locale->getText(cc_btn_capt_locale), icon_name, parent, selected, enabled, has_shadow, color_frame, color_body, color_shadow);
}
void CComponentsButton::initVarButton( const int& x_pos, const int& y_pos, const int& w, const int& h,
const std::string& caption,
const std::string& icon_name,
CComponentsForm* parent,
bool selected,
bool enabled,
bool has_shadow,
fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
{
cc_item_type = CC_ITEMTYPE_BUTTON;
x = x_pos;
y = y_pos;
width = w;
@@ -84,18 +84,16 @@ CComponentsButton::CComponentsButton( const int x_pos, const int y_pos, const i
cc_item_enabled = enabled;
cc_item_selected = selected;
fr_thickness = FRAME_TH;
}
void CComponentsButton::initVarButton()
{
cc_item_type = CC_ITEMTYPE_BUTTON;
cc_btn_capt_col = COL_MENUCONTENT_TEXT;
cc_btn_icon_obj = NULL;
cc_btn_capt_obj = NULL;
cc_btn_dy_font = CNeutrinoFonts::getInstance();
cc_btn_font = NULL;
cc_btn_icon = "";
cc_btn_capt = "";
cc_btn_capt_locale = NONEXISTANT_LOCALE;
cc_btn_icon = icon_name;
cc_btn_capt = caption;
initParent(parent);
}
void CComponentsButton::initIcon()
@@ -195,7 +193,7 @@ void CComponentsButton::setCaption(const std::string& text)
void CComponentsButton::setCaption(const neutrino_locale_t locale_text)
{
cc_btn_capt_locale = locale_text;
cc_btn_capt = g_Locale->getText(cc_btn_capt_locale);
setCaption(g_Locale->getText(cc_btn_capt_locale));
}
void CComponentsButton::initCCBtnItems()

View File

@@ -45,7 +45,14 @@ class CComponentsButton : public CComponentsForm
CComponentsLabel *cc_btn_capt_obj;
///initialize all required attributes and objects
void initVarButton();
void initVarButton( const int& x_pos, const int& y_pos, const int& w, const int& h,
const std::string& caption,
const std::string& icon_name,
CComponentsForm* parent,
bool selected,
bool enabled,
bool has_shadow,
fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow);
///property: button text as string, see also setCaption() and getCaptionString()
std::string cc_btn_capt;
@@ -72,13 +79,21 @@ 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,
CComponentsButton( const int& x_pos, const int& y_pos, const int& w, const int& h,
const std::string& caption, const std::string& icon_name = "",
bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF,
CComponentsForm *parent = NULL,
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,
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 = "",
CComponentsForm *parent = NULL,
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
@@ -108,19 +123,25 @@ Shows a button box with caption and prepared red icon.
class CComponentsButtonRed : public CComponentsButton
{
public:
CComponentsButtonRed( const int x_pos, const int y_pos, const int w, const int h,
CComponentsButtonRed( const int& x_pos, const int& y_pos, const int& w, const int& h,
const std::string& caption,
bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF,
CComponentsForm *parent = NULL,
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(x_pos, y_pos, w, h, caption, NEUTRINO_ICON_BUTTON_RED, selected, enabled, has_shadow, color_frame, color_body, color_shadow)
:CComponentsButton(x_pos, y_pos, w, h, caption, NEUTRINO_ICON_BUTTON_RED, parent, selected, enabled, has_shadow, color_frame, color_body, color_shadow)
{
cc_item_type = CC_ITEMTYPE_BUTTON_RED;
};
CComponentsButtonRed( const int x_pos, const int y_pos, const int w, const int h,
CComponentsButtonRed( const int& x_pos, const int& y_pos, const int& w, const int& h,
const neutrino_locale_t& caption_locale,
bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF,
CComponentsForm *parent = NULL,
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(x_pos, y_pos, w, h, caption_locale, NEUTRINO_ICON_BUTTON_RED, selected, enabled, has_shadow, color_frame, color_body, color_shadow)
:CComponentsButton(x_pos, y_pos, w, h, caption_locale, NEUTRINO_ICON_BUTTON_RED, parent, selected, enabled, has_shadow, color_frame, color_body, color_shadow)
{
cc_item_type = CC_ITEMTYPE_BUTTON_RED;
};
@@ -133,19 +154,25 @@ Shows a button box with caption and prepared green icon.
class CComponentsButtonGreen : public CComponentsButton
{
public:
CComponentsButtonGreen( const int x_pos, const int y_pos, const int w, const int h,
CComponentsButtonGreen( const int& x_pos, const int& y_pos, const int& w, const int& h,
const std::string& caption,
bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF,
CComponentsForm *parent = NULL,
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(x_pos, y_pos, w, h, caption, NEUTRINO_ICON_BUTTON_GREEN, selected, enabled, has_shadow, color_frame, color_body, color_shadow)
:CComponentsButton(x_pos, y_pos, w, h, caption, NEUTRINO_ICON_BUTTON_GREEN, parent, selected, enabled, has_shadow, color_frame, color_body, color_shadow)
{
cc_item_type = CC_ITEMTYPE_BUTTON_GREEN;
};
CComponentsButtonGreen( const int x_pos, const int y_pos, const int w, const int h,
CComponentsButtonGreen( const int& x_pos, const int& y_pos, const int& w, const int& h,
const neutrino_locale_t& caption_locale,
bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF,
CComponentsForm *parent = NULL,
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(x_pos, y_pos, w, h, caption_locale, NEUTRINO_ICON_BUTTON_GREEN, selected, enabled, has_shadow, color_frame, color_body, color_shadow)
:CComponentsButton(x_pos, y_pos, w, h, caption_locale, NEUTRINO_ICON_BUTTON_GREEN, parent, selected, enabled, has_shadow, color_frame, color_body, color_shadow)
{
cc_item_type = CC_ITEMTYPE_BUTTON_GREEN;
};
@@ -158,19 +185,25 @@ Shows a button box with caption and prepared yellow icon.
class CComponentsButtonYellow : public CComponentsButton
{
public:
CComponentsButtonYellow( const int x_pos, const int y_pos, const int w, const int h,
CComponentsButtonYellow( const int& x_pos, const int& y_pos, const int& w, const int& h,
const std::string& caption,
bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF,
CComponentsForm *parent = NULL,
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(x_pos, y_pos, w, h, caption, NEUTRINO_ICON_BUTTON_YELLOW, selected, enabled, has_shadow, color_frame, color_body, color_shadow)
:CComponentsButton(x_pos, y_pos, w, h, caption, NEUTRINO_ICON_BUTTON_YELLOW, parent, selected, enabled, has_shadow, color_frame, color_body, color_shadow)
{
cc_item_type = CC_ITEMTYPE_BUTTON_YELLOW;
};
CComponentsButtonYellow( const int x_pos, const int y_pos, const int w, const int h,
CComponentsButtonYellow( const int& x_pos, const int& y_pos, const int& w, const int& h,
const neutrino_locale_t& caption_locale,
bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF,
CComponentsForm *parent = NULL,
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(x_pos, y_pos, w, h, caption_locale, NEUTRINO_ICON_BUTTON_YELLOW, selected, enabled, has_shadow, color_frame, color_body, color_shadow)
:CComponentsButton(x_pos, y_pos, w, h, caption_locale, NEUTRINO_ICON_BUTTON_YELLOW, parent, selected, enabled, has_shadow, color_frame, color_body, color_shadow)
{
cc_item_type = CC_ITEMTYPE_BUTTON_YELLOW;
};
@@ -183,19 +216,25 @@ Shows a button box with caption and prepared blue icon.
class CComponentsButtonBlue : public CComponentsButton
{
public:
CComponentsButtonBlue( const int x_pos, const int y_pos, const int w, const int h,
CComponentsButtonBlue( const int& x_pos, const int& y_pos, const int& w, const int& h,
const std::string& caption,
bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF,
CComponentsForm *parent = NULL,
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(x_pos, y_pos, w, h, caption, NEUTRINO_ICON_BUTTON_BLUE, selected, enabled, has_shadow, color_frame, color_body, color_shadow)
:CComponentsButton(x_pos, y_pos, w, h, caption, NEUTRINO_ICON_BUTTON_BLUE, parent, selected, enabled, has_shadow, color_frame, color_body, color_shadow)
{
cc_item_type = CC_ITEMTYPE_BUTTON_BLUE;
};
CComponentsButtonBlue( const int x_pos, const int y_pos, const int w, const int h,
CComponentsButtonBlue( const int& x_pos, const int& y_pos, const int& w, const int& h,
const neutrino_locale_t& caption_locale,
bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF,
CComponentsForm *parent = NULL,
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(x_pos, y_pos, w, h, caption_locale, NEUTRINO_ICON_BUTTON_BLUE, selected, enabled, has_shadow, color_frame, color_body, color_shadow)
:CComponentsButton(x_pos, y_pos, w, h, caption_locale, NEUTRINO_ICON_BUTTON_BLUE, parent, selected, enabled, has_shadow, color_frame, color_body, color_shadow)
{
cc_item_type = CC_ITEMTYPE_BUTTON_BLUE;
};

View File

@@ -3,7 +3,7 @@
Copyright (C) 2001 by Steffen Hehn 'McClean'
Classes for generic GUI-related components.
Copyright (C) 2013, Thilo Graf 'dbt'
Copyright (C) 2013-2014, Thilo Graf 'dbt'
License: GPL
@@ -31,23 +31,21 @@ using namespace std;
//sub class CComponentsFrmChain
CComponentsFrmChain::CComponentsFrmChain( const int& x_pos, const int& y_pos, const int& w, const int& h,
const std::vector<CComponentsItem*> *v_items,
bool horizontal,
bool dynamic_width,
bool dynamic_height,
int direction,
CComponentsForm* parent,
bool has_shadow,
fb_pixel_t& color_frame,
fb_pixel_t& color_body,
fb_pixel_t& color_shadow)
{
initVarChain(x_pos, y_pos, w, h, v_items, horizontal, dynamic_width, dynamic_height, has_shadow, color_frame, color_body, color_shadow);
initVarChain(x_pos, y_pos, w, h, v_items, direction, parent, has_shadow, color_frame, color_body, color_shadow);
}
void CComponentsFrmChain::initVarChain( const int& x_pos, const int& y_pos, const int& w, const int& h,
const std::vector<CComponentsItem*> *v_items,
bool horizontal,
bool dynamic_width,
bool dynamic_height,
int direction,
CComponentsForm* parent,
bool has_shadow,
fb_pixel_t& color_frame,
fb_pixel_t& color_body,
@@ -66,61 +64,49 @@ void CComponentsFrmChain::initVarChain( const int& x_pos, const int& y_pos, cons
col_body = color_body;
col_shadow = color_shadow;
chn_horizontal = horizontal;
chn_dyn_height = dynamic_height;
chn_dyn_width = dynamic_width;
chn_direction = direction;
if (v_items){
if (v_items)
addCCItem(*v_items);
initCChainItems();
}
initChainItems();
initParent(parent);
}
void CComponentsFrmChain::initCChainItems()
void CComponentsFrmChain::setDirection(int direction)
{
if (!v_cc_items.empty()){
if (chn_dyn_height)
height = 0;
if (chn_dyn_width)
width = 0;
}
chn_direction = direction;
initChainItems();
};
void CComponentsFrmChain::initChainItems()
{
//init required dimensions, preferred are current width and height
int w_tmp = width;
int h_tmp = height;
//exit if no item available
if (v_cc_items.empty())
return;
//set new values
w_tmp = append_x_offset;
h_tmp = append_y_offset;
for (size_t i= 0; i< v_cc_items.size(); i++){
//set general start position for all items
if (i == 0)
v_cc_items[i]->setPos(0, 0);
//set arrangement with required direction
if (chn_horizontal){
if (i > 0)
v_cc_items[i]->setPos(CC_APPEND, 0);
}
else{
if (i > 0)
v_cc_items[i]->setPos(0, CC_APPEND);
if (chn_direction & CC_DIR_X){
w_tmp += v_cc_items[i]->getWidth();
w_tmp += append_x_offset;
v_cc_items[i]->setPos(CC_APPEND, CC_CENTERED);
}
//assign size
if (chn_horizontal){
//assign dynamic width
if (chn_dyn_width)
width += v_cc_items[i]->getWidth();
//assign dynamic height
if (chn_dyn_height)
height = max(v_cc_items[i]->getHeight(), height);
else
v_cc_items[i]->setHeight(height);
}
else{
//assign dynamic height
if (chn_dyn_height)
height += v_cc_items[i]->getHeight();
//assign dynamic width
if (chn_dyn_width)
width = max(v_cc_items[i]->getWidth(), width);
else
v_cc_items[i]->setWidth(width);
if (chn_direction & CC_DIR_Y){
h_tmp += v_cc_items[i]->getHeight();
h_tmp += append_y_offset;
v_cc_items[i]->setPos(CC_CENTERED, CC_APPEND);
}
}
width = max (w_tmp, width);
height = max (h_tmp, height);
}

View File

@@ -3,7 +3,7 @@
Copyright (C) 2001 by Steffen Hehn 'McClean'
Classes for generic GUI-related components.
Copyright (C) 2013, Thilo Graf 'dbt'
Copyright (C) 2013-2014, Thilo Graf 'dbt'
License: GPL
@@ -36,43 +36,46 @@ You can set default form parameters like position, size, colors etc. and additi
to display with defined direction.
*/
//direction types
enum
{
CC_DIR_X = 0x1,
CC_DIR_Y = 0x2
};
class CComponentsFrmChain : public CComponentsForm
{
private:
///property: defined arrangement mode of items, can be vertical or horizontal
int chn_horizontal;
///property: defines height from sum of all contained items
bool chn_dyn_height;
///property: defines width from sum of all contained items
bool chn_dyn_width;
///init all required variables
void initVarChain( const int& x_pos, const int& y_pos, const int& w, const int& h,
const std::vector<CComponentsItem*> *v_items,
bool horizontal,
bool dynamic_width,
bool dynamic_height,
int direction,
CComponentsForm* parent,
bool has_shadow,
fb_pixel_t& color_frame,
fb_pixel_t& color_body,
fb_pixel_t& color_shadow);
void initCChainItems();
protected:
///property: mode for arrangement direction of items, see also setDirection(), getDirection()
int chn_direction;
void initChainItems();
public:
CComponentsFrmChain( const int& x_pos = 1, const int& y_pos = 1, const int& w = 720, const int& h = 32,
const std::vector<CComponentsItem*> *v_items = NULL,
bool horizontal = true,
bool dynamic_width = false,
bool dynamic_height = false,
int direction = CC_DIR_X,
CComponentsForm* parent = NULL,
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);
// ~CComponentsSlider(); //inherited from CComponentsForm
///defines mode for arrangement direction of items, see also chn_direction
virtual void setDirection(int direction);
///gets the mode of arrangment direction
virtual int getDirection(){return chn_direction;};
};
#endif

View File

@@ -41,16 +41,12 @@ using namespace std;
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,
const char* format_str,
bool activ,
CComponentsForm* parent,
bool has_shadow,
fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
{
initVarClock(x_pos, y_pos, w, h, format_str, activ, has_shadow, color_frame, color_body, color_shadow);
}
void CComponentsFrmClock::initVarClock( 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)
{
x = x_pos;
y = y_pos;
@@ -80,14 +76,17 @@ void CComponentsFrmClock::initVarClock( const int& x_pos, const int& y_pos, cons
paintClock = false;
activeClock = activ;
initCCLockItems();
initParent(parent);
if (activeClock)
startThread();
}
CComponentsFrmClock::~CComponentsFrmClock()
{
if (activeClock)
stopThread();
stopThread();
}
void CComponentsFrmClock::initTimeString()

View File

@@ -57,7 +57,7 @@ class CComponentsFrmClock : public CComponentsForm
///raw time chars
char cl_timestr[20];
///allow to paint clock within thread and is not similar to cc_allow_paint
///handle paint clock within thread and is not similar to cc_allow_paint
bool paintClock;
//TODO: please add comments!
bool activeClock;
@@ -77,11 +77,6 @@ class CComponentsFrmClock : public CComponentsForm
///time string align, default allign is ver and hor centered
int cl_align;
///initialize all attributes and required objects
void initVarClock( 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);
///initialize clock contents
void initCCLockItems();
///initialize timestring, called in initCCLockItems()
@@ -94,7 +89,10 @@ class CComponentsFrmClock : public CComponentsForm
public:
CComponentsFrmClock( const int& x_pos = 1, const int& y_pos = 1, const int& w = 200, const int& h = 48,
const char* format_str = "%H:%M", bool activ=false, bool has_shadow = CC_SHADOW_OFF,
const char* format_str = "%H:%M",
bool activ=false,
CComponentsForm *parent = NULL,
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);
virtual ~CComponentsFrmClock();

View File

@@ -36,28 +36,32 @@ using namespace std;
CComponentsExtTextForm::CComponentsExtTextForm( const int& x_pos, const int& y_pos, const int& w, const int& h,
const std::string& label_text, const std::string& text,
CComponentsForm* parent,
bool has_shadow,
fb_pixel_t label_color,
fb_pixel_t text_color,
fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
{
initVarExtTextForm(x_pos, y_pos, w, h, label_text, text, has_shadow, label_color, text_color, color_frame, color_body, color_shadow);
initVarExtTextForm(x_pos, y_pos, w, h, label_text, text, parent, has_shadow, label_color, text_color, color_frame, color_body, color_shadow);
initCCTextItems();
}
CComponentsExtTextFormLocalized::CComponentsExtTextFormLocalized(const int& x_pos, const int& y_pos, const int& w, const int& h,
const neutrino_locale_t& locale_label_text, const neutrino_locale_t& locale_text,
CComponentsForm* parent,
bool has_shadow,
fb_pixel_t label_color,
fb_pixel_t text_color,
fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
: CComponentsExtTextForm( x_pos, y_pos, w, h,
g_Locale->getText(locale_label_text), g_Locale->getText(locale_text),
parent,
has_shadow,
label_color, text_color, color_frame, color_body, color_shadow){};
void CComponentsExtTextForm::initVarExtTextForm(const int& x_pos, const int& y_pos, const int& w, const int& h,
const std::string& label_text, const std::string& text,
CComponentsForm* parent,
bool has_shadow,
fb_pixel_t label_color,
fb_pixel_t text_color,
@@ -90,7 +94,8 @@ void CComponentsExtTextForm::initVarExtTextForm(const int& x_pos, const int& y_p
int dx = 0, dy = DEF_HEIGHT;
ccx_font = *(CNeutrinoFonts::getInstance()->getDynFont(dx, dy));
ccx_label_align = ccx_text_align = CTextBox::NO_AUTO_LINEBREAK;
initParent(parent);
}

View File

@@ -68,6 +68,7 @@ class CComponentsExtTextForm : public CComponentsForm
///initialize basic variables
void initVarExtTextForm(const int& x_pos, const int& y_pos, const int& w, const int& h,
const std::string& label_text, const std::string& text,
CComponentsForm* parent,
bool has_shadow,
fb_pixel_t label_color,
fb_pixel_t text_color,
@@ -77,10 +78,13 @@ class CComponentsExtTextForm : public CComponentsForm
///advanced constructor for CComponentsExtTextForm, provides parameters for the most required properties, and caption as string
CComponentsExtTextForm( const int& x_pos = 1, const int& y_pos = 1, const int& w = 300, const int& h = 48,
const std::string& label_text = "", const std::string& text = "",
CComponentsForm *parent = NULL,
bool has_shadow = CC_SHADOW_OFF,
fb_pixel_t label_color = COL_MENUCONTENTINACTIVE_TEXT,
fb_pixel_t text_color = COL_MENUCONTENT_TEXT,
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6,
fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0,
fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
// ~CComponentsExtTextForm(); //inherited from CComponentsForm
///assigns texts for label and text, parameter as string, parameter Font is optional for required font type, default font is dependently from defined item height
@@ -119,6 +123,7 @@ class CComponentsExtTextFormLocalized : public CComponentsExtTextForm
///advanced constructor for CComponentsExtTextForm, provides parameters for the most required properties, and caption as locales
CComponentsExtTextFormLocalized(const int& x_pos = 1, const int& y_pos = 1, const int& w = 300, const int& h = 48,
const neutrino_locale_t& locale_label_text = NONEXISTANT_LOCALE, const neutrino_locale_t& locale_text = NONEXISTANT_LOCALE,
CComponentsForm *parent = NULL,
bool has_shadow = CC_SHADOW_OFF,
fb_pixel_t label_color = COL_MENUCONTENTINACTIVE_TEXT,
fb_pixel_t text_color = COL_MENUCONTENT_TEXT,

View File

@@ -3,7 +3,7 @@
Copyright (C) 2001 by Steffen Hehn 'McClean'
Classes for generic GUI-related components.
Copyright (C) 2013, Thilo Graf 'dbt'
Copyright (C) 2013-2014, Thilo Graf 'dbt'
License: GPL
@@ -33,25 +33,27 @@ using namespace std;
//-------------------------------------------------------------------------------------------------------
//sub class CComponentsFooter inherit from CComponentsHeader
CComponentsFooter::CComponentsFooter()
CComponentsFooter::CComponentsFooter(CComponentsForm* parent)
{
//CComponentsFooter
initVarFooter(1, 1, 0, 0);
initVarFooter(1, 1, 0, 0, 0, parent);
}
CComponentsFooter::CComponentsFooter( const int& x_pos, const int& y_pos, const int& w, const int& h,
const int& buttons,
CComponentsForm* parent,
bool has_shadow,
fb_pixel_t color_frame,
fb_pixel_t color_body,
fb_pixel_t color_shadow )
{
//CComponentsFooter
initVarFooter(x_pos, y_pos, w, h, buttons, has_shadow, color_frame, color_body, color_shadow);
initVarFooter(x_pos, y_pos, w, h, buttons, parent, has_shadow, color_frame, color_body, color_shadow);
}
void CComponentsFooter::initVarFooter( const int& x_pos, const int& y_pos, const int& w, const int& h,
const int& buttons,
CComponentsForm* parent,
bool has_shadow,
fb_pixel_t color_frame,
fb_pixel_t color_body,
@@ -71,7 +73,6 @@ void CComponentsFooter::initVarFooter( const int& x_pos, const int& y_pos, const
else
height = cch_font->getHeight();
cch_buttons = buttons;
shadow = has_shadow;
col_frame = color_frame;
col_body = color_body;
@@ -80,6 +81,7 @@ void CComponentsFooter::initVarFooter( const int& x_pos, const int& y_pos, const
corner_rad = RADIUS_LARGE;
corner_type = CORNER_BOTTOM;
initDefaultButtons();
addContextButton(buttons);
initCCItems();
initParent(parent);
}

View File

@@ -36,14 +36,16 @@ class CComponentsFooter : public CComponentsHeader
protected:
void initVarFooter( const int& x_pos, const int& y_pos, const int& w, const int& h = 0,
const int& buttons = 0,
CComponentsForm *parent = NULL,
bool has_shadow = CC_SHADOW_OFF,
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6,
fb_pixel_t color_body = COL_INFOBAR_SHADOW_PLUS_1,
fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
public:
CComponentsFooter();
CComponentsFooter(CComponentsForm *parent = NULL);
CComponentsFooter( const int& x_pos, const int& y_pos, const int& w, const int& h = 0,
const int& buttons = 0,
CComponentsForm *parent = NULL,
bool has_shadow = CC_SHADOW_OFF,
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6,
fb_pixel_t color_body = COL_INFOBAR_SHADOW_PLUS_1,

View File

@@ -29,33 +29,35 @@
#include <global.h>
#include <neutrino.h>
#include "cc_frm_header.h"
#include <system/debug.h>
using namespace std;
//-------------------------------------------------------------------------------------------------------
//sub class CComponentsHeader inherit from CComponentsForm
CComponentsHeader::CComponentsHeader()
CComponentsHeader::CComponentsHeader(CComponentsForm* parent)
{
//CComponentsHeader
initVarHeader(1, 1, 0, 0, "", "", 0);
initVarHeader(1, 1, 0, 0, "", "", 0, parent);
}
CComponentsHeader::CComponentsHeader( const int& x_pos, const int& y_pos, const int& w, const int& h,
const std::string& caption,
const std::string& icon_name,
const int& buttons,
CComponentsForm* parent,
bool has_shadow,
fb_pixel_t color_frame,
fb_pixel_t color_body,
fb_pixel_t color_shadow)
{
initVarHeader(x_pos, y_pos, w, h, caption, icon_name, buttons, has_shadow, color_frame, color_body, color_shadow);
initVarHeader(x_pos, y_pos, w, h, caption, icon_name, buttons, parent, has_shadow, color_frame, color_body, color_shadow);
}
CComponentsHeaderLocalized::CComponentsHeaderLocalized( const int& x_pos, const int& y_pos, const int& w, const int& h,
neutrino_locale_t caption_locale,
const std::string& icon_name,
const int& buttons,
CComponentsForm* parent,
bool has_shadow,
fb_pixel_t color_frame,
fb_pixel_t color_body,
@@ -63,6 +65,7 @@ CComponentsHeaderLocalized::CComponentsHeaderLocalized( const int& x_pos, const
:CComponentsHeader( x_pos, y_pos, w, h,
g_Locale->getText(caption_locale),
icon_name, buttons,
parent,
has_shadow,
color_frame, color_body, color_shadow){};
@@ -70,6 +73,7 @@ void CComponentsHeader::initVarHeader( const int& x_pos, const int& y_pos, const
const std::string& caption,
const std::string& icon_name,
const int& buttons,
CComponentsForm* parent,
bool has_shadow,
fb_pixel_t color_frame,
fb_pixel_t color_body,
@@ -96,7 +100,6 @@ void CComponentsHeader::initVarHeader( const int& x_pos, const int& y_pos, const
col_body = COL_MENUHEAD_PLUS_0;
cch_text = caption;
cch_icon_name = icon_name;
cch_buttons = buttons;
corner_rad = RADIUS_LARGE,
corner_type = CORNER_TOP;
@@ -111,19 +114,16 @@ void CComponentsHeader::initVarHeader( const int& x_pos, const int& y_pos, const
cch_icon_x = cch_offset;
cch_icon_w = 0;
cch_text_x = cch_offset;
cch_buttons_w = 0;
cch_buttons_h = 0;
cch_buttons_space = cch_offset;
initDefaultButtons();
addContextButton(buttons);
initCCItems();
initParent(parent);
}
CComponentsHeader::~CComponentsHeader()
{
#ifdef DEBUG_CC
printf("[~CComponentsHeader] [%s - %d] delete...\n", __func__, __LINE__);
#endif
dprintf(DEBUG_DEBUG, "[~CComponentsHeader] [%s - %d] delete...\n", __func__, __LINE__);
v_cch_btn.clear();
}
@@ -167,7 +167,7 @@ void CComponentsHeader::initCaptionFont(Font* font)
void CComponentsHeader::setIcon(const char* icon_name)
{
if (icon_name){
string s_icon = static_cast<string>(icon_name);
string s_icon = string(icon_name);
setIcon(s_icon);
}
else
@@ -191,20 +191,12 @@ void CComponentsHeader::initIcon()
return;
}
//create instance for cch_icon_obj
//create instance for cch_icon_obj and add to container at once
if (cch_icon_obj == NULL){
#ifdef DEBUG_CC
printf(" [CComponentsHeader]\n [%s - %d] init header icon: %s\n", __func__, __LINE__, cch_icon_name.c_str());
#endif
cch_icon_obj = new CComponentsPicture(cch_icon_x, cch_items_y, 0, 0, cch_icon_name);
dprintf(DEBUG_DEBUG, "[CComponentsHeader]\n [%s - %d] init header icon: %s\n", __func__, __LINE__, cch_icon_name.c_str());
cch_icon_obj = new CComponentsPicture(cch_icon_x, cch_items_y, 0, 0, cch_icon_name, CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER, this);
}
//add item only one time
if (!cch_icon_obj->isAdded())
addCCItem(cch_icon_obj); //icon
//set properties for icon object
if (cch_icon_obj){
//get dimensions of header icon
@@ -214,7 +206,6 @@ void CComponentsHeader::initIcon()
cch_icon_obj->setWidth(iw);
cch_icon_obj->setHeight(ih);
cch_icon_obj->doPaintBg(false);
cch_icon_obj->setPictureAlign(CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER);
//set corner mode of icon item
int cc_icon_corner_type = corner_type;
@@ -235,57 +226,36 @@ void CComponentsHeader::initIcon()
}
}
void CComponentsHeader::addButtonIcon(const std::string& button_name)
void CComponentsHeader::addContextButton(const std::string& button_name)
{
v_cch_btn.push_back(button_name);
initButtons();
dprintf(DEBUG_DEBUG, "[CComponentsHeader] %s added %d default buttons...\n", __func__, (int)v_cch_btn.size());
}
void CComponentsHeader::removeButtonIcons()
void CComponentsHeader::addContextButton(const std::vector<std::string>& v_button_names)
{
for (size_t i= 0; i< v_button_names.size(); i++)
addContextButton(v_button_names[i]);
}
void CComponentsHeader::addContextButton(const int& buttons)
{
if (buttons & CC_BTN_EXIT)
addContextButton(NEUTRINO_ICON_BUTTON_HOME);
if (buttons & CC_BTN_HELP)
addContextButton(NEUTRINO_ICON_BUTTON_HELP);
if (buttons & CC_BTN_INFO)
addContextButton(NEUTRINO_ICON_BUTTON_INFO);
if (buttons & CC_BTN_MENU)
addContextButton(NEUTRINO_ICON_BUTTON_MENU);
}
void CComponentsHeader::removeContextButtons()
{
dprintf(DEBUG_DEBUG, "[CComponentsHeader]\t [%s - %d] removing %u context buttons...\n", __func__, __LINE__, v_cch_btn.size());
v_cch_btn.clear();
cch_btn_obj->removeAllIcons();
initButtons();
}
void CComponentsHeader::initDefaultButtons()
{
if (cch_buttons & CC_BTN_EXIT)
v_cch_btn.push_back(NEUTRINO_ICON_BUTTON_HOME);
if (cch_buttons & CC_BTN_HELP)
v_cch_btn.push_back(NEUTRINO_ICON_BUTTON_HELP);
if (cch_buttons & CC_BTN_INFO)
v_cch_btn.push_back(NEUTRINO_ICON_BUTTON_INFO);
if (cch_buttons & CC_BTN_MENU)
v_cch_btn.push_back(NEUTRINO_ICON_BUTTON_MENU);
#ifdef DEBUG_CC
printf("[CComponentsHeader] %s added %d default buttons...\n", __func__, (int)v_cch_btn.size());
#endif
}
void CComponentsHeader::setDefaultButtons(const int buttons)
{
cch_buttons = buttons;
v_cch_btn.clear();
initDefaultButtons();
}
// calculate minimal width of icon form
void CComponentsHeader::initButtonFormSize()
{
cch_buttons_w = 0;
cch_buttons_h = 0;
if (cch_btn_obj == NULL)
return;
for(size_t i=0; i<v_cch_btn.size(); i++){
int bw, bh;
frameBuffer->getIconSize(v_cch_btn[i].c_str(), &bw, &bh);
cch_buttons_w += (bw + cch_buttons_space);
cch_buttons_h = std::max(cch_buttons_h, bh);
}
cch_buttons_w -= cch_buttons_space;
if (cch_btn_obj)
cch_btn_obj->clear();;
}
void CComponentsHeader::initButtons()
@@ -293,30 +263,21 @@ void CComponentsHeader::initButtons()
//exit if no button defined
if (v_cch_btn.empty()){
if (cch_btn_obj)
delete cch_btn_obj;
cch_btn_obj = NULL;
cch_btn_obj->clear(); //clean up, but hold instance
return;
}
initButtonFormSize();
//create instance for header buttons chain object and add to container
if (cch_btn_obj == NULL){
cch_btn_obj = new CComponentsIconForm();
#ifdef DEBUG_CC
printf(" [CComponentsHeader]\n [%s - %d] init header buttons...\n", __func__, __LINE__);
#endif
dprintf(DEBUG_DEBUG, "[CComponentsHeader]\n [%s - %d] init header buttons...\n", __func__, __LINE__);
cch_btn_obj = new CComponentsIconForm(this);
}
//add button form only one time
if (!cch_btn_obj->isAdded())
addCCItem(cch_btn_obj); //buttons
//set button form properties
if (cch_btn_obj){
cch_btn_obj->setDimensionsAll(width-cch_offset-cch_buttons_w, cch_items_y, cch_buttons_w, cch_buttons_h);
cch_btn_obj->setDimensionsAll(0, cch_items_y, 0, 0);
cch_btn_obj->doPaintBg(false);
cch_btn_obj->setIconOffset(cch_buttons_space);
cch_btn_obj->setIconAlign(CComponentsIconForm::CC_ICONS_FRM_ALIGN_RIGHT);
cch_btn_obj->setAppendOffset(cch_buttons_space, 0);
cch_btn_obj->removeAllIcons();
cch_btn_obj->addIcon(v_cch_btn);
@@ -350,14 +311,19 @@ void CComponentsHeader::initCaption()
//calc width of text object in header
cc_text_w = width-cch_text_x-cch_offset;
if (cch_buttons_w)
cc_text_w -= cch_buttons_w-cch_offset;
int buttons_w = 0;
if (cch_btn_obj){
//get width of buttons object
buttons_w = cch_btn_obj->getWidth();
//set x position of buttons
cch_btn_obj->setXPos(width - buttons_w);
}
//set required width of caption object
cc_text_w -= buttons_w-cch_offset;
//create cch_text_obj and add to collection
if (cch_text_obj == NULL){
#ifdef DEBUG_CC
printf(" [CComponentsHeader]\n [%s - %d] init header text: %s [ x %d w %d ]\n", __func__, __LINE__, cch_text.c_str(), cch_text_x, cc_text_w);
#endif
dprintf(DEBUG_DEBUG, "[CComponentsHeader]\n [%s - %d] init header text: %s [ x %d w %d ]\n", __func__, __LINE__, cch_text.c_str(), cch_text_x, cc_text_w);
cch_text_obj = new CComponentsText();
}
@@ -371,7 +337,7 @@ void CComponentsHeader::initCaption()
if (cch_caption_align == CTextBox::CENTER)
cch_text_x = CC_CENTERED;
cch_text_obj->setDimensionsAll(cch_text_x, cch_items_y, cc_text_w, height);
cch_text_obj->doPaintBg(false);
cch_text_obj->doPaintBg(true);
cch_text_obj->setText(cch_text, cch_caption_align, cch_font);
cch_text_obj->forceTextPaint(); //here required
cch_text_obj->setTextColor(cch_col_text);

View File

@@ -42,6 +42,7 @@ class CComponentsHeader : public CComponentsForm
const std::string& caption = "header",
const std::string& = "",
const int& buttons = 0,
CComponentsForm *parent = NULL,
bool has_shadow = CC_SHADOW_OFF,
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6,
fb_pixel_t color_body = COL_MENUHEAD_PLUS_0,
@@ -52,7 +53,7 @@ class CComponentsHeader : public CComponentsForm
CComponentsPicture * cch_icon_obj;
///object: caption object, see also setCaption()
CComponentsText * cch_text_obj;
///object: context button object, see also addButtonIcon(), removeButtonIcons()
///object: context button object, see also addContextButton(), removeContextButtons()
CComponentsIconForm * cch_btn_obj;
///property: caption text, see also setCaption()
@@ -72,17 +73,11 @@ class CComponentsHeader : public CComponentsForm
int cch_icon_w;
///property: internal x-position for caption object
int cch_text_x;
///property: internal context button definition button icons, see modes CC_BTN_HELP, CC_BTN_INFO, CC_BTN_MENU, CC_BTN_EXIT
int cch_buttons;
///property: internal width for context button object
int cch_buttons_w;
///property: internal height for context button object
int cch_buttons_h;
///property: internal offset of context button icons within context button object
int cch_buttons_space;
///property: internal offset for header items
int cch_offset;
///property: internal container of icon names for context button object, see also addButtonIcon()
///property: internal container of icon names for context button object, see also addContextButton()
std::vector<std::string> v_cch_btn;
///property: size of header, possible values are CC_HEADER_SIZE_LARGE, CC_HEADER_SIZE_SMALL
int cch_size_mode;
@@ -97,10 +92,6 @@ class CComponentsHeader : public CComponentsForm
void initCaption();
///sub: init context button object
void initButtons();
///sub: init default buttons for context button object
void initDefaultButtons();
///sub: init default buttons for context button object
void initButtonFormSize();
public:
enum
@@ -110,11 +101,12 @@ class CComponentsHeader : public CComponentsForm
CC_HEADER_ITEM_BUTTONS = 2
};
CComponentsHeader();
CComponentsHeader(CComponentsForm *parent = NULL);
CComponentsHeader( const int& x_pos, const int& y_pos, const int& w, const int& h = 0,
const std::string& caption = "",
const std::string& = "",
const int& buttons = 0,
CComponentsForm *parent = NULL,
bool has_shadow = CC_SHADOW_OFF,
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6,
fb_pixel_t color_body = COL_MENUHEAD_PLUS_0,
@@ -141,10 +133,23 @@ class CComponentsHeader : public CComponentsForm
///set name of icon
virtual void setIcon(const std::string& icon_name);
///add separate button icons to context button object
virtual void addButtonIcon(const std::string& button_name);
///remove button icons from context button object
virtual void removeButtonIcons();
///context buttons are to find on the right part of header
///add a single context button icon to the header object, arg as string, icon will just add, existing icons are preserved
virtual void addContextButton(const std::string& button_name);
///add a group of context button icons to the header object, arg as string vector, icons will just add, existing icons are preserved
virtual void addContextButton(const std::vector<std::string>& v_button_names);
///add a single context button icon or combined button icons to the header object, possible types are for example: CC_BTN_HELP, CC_BTN_INFO, CC_BTN_MENU, CC_BTN_EXIT
///icons will just add, existing icons are preserved
virtual void addContextButton(const int& buttons);
///remove context buttons from context button object
virtual void removeContextButtons();
///sets a single context button icon to the header object, arg as string, existing buttons are removed
virtual void setContextButton(const std::string& button_name){removeContextButtons(); addContextButton(button_name);};
///sets a group of context button icons to the header object, arg as string vector, existing buttons are removed
virtual void setContextButton(const std::vector<std::string>& v_button_names){removeContextButtons(); addContextButton(v_button_names);};
///sets a single context button icon or combined button icons to the header object, possible types are for example: CC_BTN_HELP, CC_BTN_INFO, CC_BTN_MENU, CC_BTN_EXIT
///existing buttons are removed
virtual void setContextButton(const int& buttons){removeContextButtons(); addContextButton(buttons);};
enum
{
@@ -154,8 +159,6 @@ class CComponentsHeader : public CComponentsForm
CC_BTN_EXIT = 0x80
};
///set internal context button icons, possible modes CC_BTN_HELP, CC_BTN_INFO, CC_BTN_MENU, CC_BTN_EXIT
virtual void setDefaultButtons(const int buttons);
///set offset between icons within context button object
virtual void setButtonsSpace(const int buttons_space){cch_buttons_space = buttons_space;};
@@ -188,6 +191,7 @@ class CComponentsHeaderLocalized : public CComponentsHeader
neutrino_locale_t caption_locale = NONEXISTANT_LOCALE,
const std::string& = "",
const int& buttons = 0,
CComponentsForm *parent = NULL,
bool has_shadow = CC_SHADOW_OFF,
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6,
fb_pixel_t color_body = COL_MENUHEAD_PLUS_0,

View File

@@ -33,21 +33,23 @@
using namespace std;
//sub class CComponentsIconForm inherit from CComponentsForm
CComponentsIconForm::CComponentsIconForm()
CComponentsIconForm::CComponentsIconForm(CComponentsForm* parent)
{
initVarIconForm(1, 1, 0, 0, vector<string>());
initVarIconForm(1, 1, 0, 0, vector<string>(), parent);
}
CComponentsIconForm::CComponentsIconForm( const int &x_pos, const int &y_pos, const int &w, const int &h,
const std::vector<std::string> &v_icon_names,
CComponentsForm* parent,
bool has_shadow,
fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
{
initVarIconForm(x_pos, y_pos, w, h, v_icon_names, has_shadow, color_frame, color_body, color_shadow);
initVarIconForm(x_pos, y_pos, w, h, v_icon_names, parent, has_shadow, color_frame, color_body, color_shadow);
}
void CComponentsIconForm::initVarIconForm( const int &x_pos, const int &y_pos, const int &w, const int &h,
const std::vector<std::string> &v_icon_names,
CComponentsForm* parent,
bool has_shadow,
fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
{
@@ -63,51 +65,52 @@ void CComponentsIconForm::initVarIconForm( const int &x_pos, const int &y_pos, c
col_body = color_body;
col_shadow = color_shadow;
ccif_offset = 2;
ccif_icon_align = CC_ICONS_FRM_ALIGN_LEFT;
chn_direction = CC_DIR_X;
append_y_offset = 2;
initChainItems();
initParent(parent);
}
void CComponentsIconForm::addIcon(const std::string& icon_name)
{
v_icons.push_back(icon_name);
//create new cc-picture item object
CComponentsPicture *ccp = new CComponentsPicture(0, 0, 0, 0, icon_name, CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER, this);
ccp->doPaintBg(false);
initChainItems();
}
void CComponentsIconForm::addIcon(std::vector<std::string> icon_name)
{
for (size_t i= 0; i< icon_name.size(); i++)
v_icons.push_back(icon_name[i]);
addIcon(icon_name[i]);
}
void CComponentsIconForm::insertIcon(const uint& icon_id, const std::string& icon_name)
{
v_icons.insert(v_icons.begin()+icon_id, icon_name);
//create new cc-picture item object
CComponentsPicture *ccp = new CComponentsPicture(0, 0, 0, 0, icon_name, CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER);
ccp->doPaintBg(false);
insertCCItem(icon_id, ccp);
initChainItems();
}
void CComponentsIconForm::removeIcon(const uint& icon_id)
{
v_icons.erase(v_icons.begin()+icon_id);
}
void CComponentsIconForm::removeIcon(const std::string& icon_name)
{
int id = getIconId(icon_name);
removeIcon(id);
}
int CComponentsIconForm::getIconId(const std::string& icon_name)
{
for (size_t i= 0; i< v_icons.size(); i++)
if (v_icons[i] == icon_name)
return i;
return -1;
removeCCItem(icon_id);
initChainItems();
}
//For existing instances it's recommended
//to remove old items before add new icons, otherwise icons will be appended.
void CComponentsIconForm::removeAllIcons()
void CComponentsIconForm::removeAllIcons()//TODO
{
clear();
v_icons.clear();
initChainItems();
}
//get maximal form height depends of biggest icon height, but don't touch defined form height
@@ -120,72 +123,3 @@ void CComponentsIconForm::initMaxHeight(int *pheight)
}
}
void CComponentsIconForm::initCCIcons()
{
int ccp_y = 0;
int ccp_h = 0;
int ccp_w = 0;
//calculate start pos of first icon
int ccp_x = 0 + fr_thickness; //CC_ICONS_FRM_ALIGN_LEFT;
if (ccif_icon_align == CC_ICONS_FRM_ALIGN_RIGHT)
ccp_x += (width - fr_thickness);
//get width of first icon
frameBuffer->getIconSize(v_icons[0].c_str(), &ccp_w, &ccp_h);
//get maximal form height
int h = 0;
initMaxHeight(&h);
//set xpos of first icon with right alignment, icon must positionized on the right border reduced with icon width
if (ccif_icon_align == CC_ICONS_FRM_ALIGN_RIGHT)
ccp_x -= ccp_w;
//init and add item objects
size_t i_cnt = v_icons.size(); //icon count
for (size_t i= 0; i< i_cnt; i++){
//create new cc-picture item object
CComponentsPicture *ccp = new CComponentsPicture(ccp_x, ccp_y, ccp_w, h, v_icons[i]);
ccp->setPictureAlign(CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER);
ccp->doPaintBg(false);
//add item to form
addCCItem(ccp);
//reset current width for next object
ccp_w = 0;
//get next icon size if available
size_t next_i = i+1;
if (next_i != i_cnt)
frameBuffer->getIconSize(v_icons[next_i].c_str(), &ccp_w, &ccp_h);
//set next icon position
int tmp_offset = ( i<i_cnt ? ccif_offset : 0 );
if (ccif_icon_align == CC_ICONS_FRM_ALIGN_LEFT)
ccp_x += (ccp->getWidth() + tmp_offset);
if (ccif_icon_align == CC_ICONS_FRM_ALIGN_RIGHT)
ccp_x -= (ccp_w + tmp_offset);
}
//calculate width and height of form
int w_tmp = 0;
int h_tmp = 0;
for (size_t i= 0; i< i_cnt; i++){
w_tmp += v_cc_items[i]->getWidth()+ccif_offset+fr_thickness;
h_tmp = max(h_tmp, v_cc_items[i]->getHeight()+2*fr_thickness);
}
width = max(w_tmp, width);
height = max(h_tmp, height);
}
void CComponentsIconForm::paint(bool do_save_bg)
{
//init and add icons
initCCIcons();
//paint form contents
paintForm(do_save_bg);
}

View File

@@ -24,51 +24,39 @@
#ifndef __CC_FORM_ICONS_H__
#define __CC_FORM_ICONS_H__
#include "cc_frm.h"
#include "cc_frm_chain.h"
class CComponentsIconForm : public CComponentsForm
class CComponentsIconForm : public CComponentsFrmChain
{
private:
std::vector<std::string> v_icons;
int ccif_offset, ccif_icon_align;
void initMaxHeight(int *pheight);
protected:
void initVarIconForm( const int &x_pos, const int &y_pos, const int &w, const int &h,
const std::vector<std::string> &v_icon_names,
CComponentsForm* parent,
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);
public:
CComponentsIconForm();
CComponentsIconForm(CComponentsForm *parent = NULL);
CComponentsIconForm( const int &x_pos, const int &y_pos, const int &w, const int &h,
const std::vector<std::string> &v_icon_names,
CComponentsForm *parent = NULL,
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);
// ~CComponentsIconForm(); //inherited from CComponentsForm
void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
void initCCIcons();
void addIcon(const std::string& icon_name);
void addIcon(std::vector<std::string> icon_name);
void removeIcons(){v_icons.clear();};
void insertIcon(const uint& icon_id, const std::string& icon_name);
void removeIcon(const uint& icon_id);
void removeIcon(const std::string& icon_name);
void removeAllIcons();
void setIconOffset(const int offset){ccif_offset = offset;};
enum //alignements
{
CC_ICONS_FRM_ALIGN_RIGHT ,
CC_ICONS_FRM_ALIGN_LEFT
};
void setIconAlign(int alignment){ccif_icon_align = alignment;};
int getIconId(const std::string& icon_name);
};
#endif

View File

@@ -3,7 +3,7 @@
Copyright (C) 2001 by Steffen Hehn 'McClean'
Class for signalbar based up CComponent classes.
Copyright (C) 2013, Thilo Graf 'dbt'
Copyright (C) 2013-1014, Thilo Graf 'dbt'
License: GPL
@@ -37,16 +37,17 @@
using namespace std;
CSignalBar::CSignalBar()
CSignalBar::CSignalBar(CComponentsForm *parent)
{
initVarSigBar();
sb_name = "SIG";
initDimensions();
initSBItems();
initParent(parent);
}
CSignalBar::CSignalBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref, const string& sbname)
CSignalBar::CSignalBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref, const string& sbname, CComponentsForm *parent)
{
initVarSigBar();
sb_frontend = frontend_ref;
@@ -58,6 +59,7 @@ CSignalBar::CSignalBar(const int& xpos, const int& ypos, const int& w, const int
initDimensions();
initSBItems();
initParent(parent);
}
void CSignalBar::initDimensions()
@@ -256,7 +258,7 @@ void CSignalNoiseRatioBar::Refresh()
//**********************************************************************************************************************
CSignalBox::CSignalBox(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref, const bool vert)
CSignalBox::CSignalBox(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref, const bool vert, CComponentsForm *parent)
{
initVarSigBox();
vertical = vert;
@@ -284,6 +286,7 @@ CSignalBox::CSignalBox(const int& xpos, const int& ypos, const int& w, const int
addCCItem(snrbar);
initSignalItems();
initParent(parent);
}
void CSignalBox::initVarSigBox()

View File

@@ -3,7 +3,7 @@
Copyright (C) 2001 by Steffen Hehn 'McClean'
Class for signalbar based up CComponent classes.
Copyright (C) 2013, Thilo Graf 'dbt'
Copyright (C) 2013-2014, Thilo Graf 'dbt'
License: GPL
@@ -110,9 +110,9 @@ class CSignalBar : public CComponentsForm
std::string sb_name;
public:
CSignalBar();
CSignalBar(CComponentsForm *parent = NULL);
///basic component class constructor for signal.
CSignalBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref, const std::string& sb_name = "SIG");
CSignalBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref, const std::string& sb_name = "SIG", CComponentsForm *parent = NULL);
///assigns the current used frontend, simplified a tuner object, see frontend_c.h
virtual void setFrontEnd(CFrontend *frontend_ref){sb_frontend = frontend_ref;};
@@ -157,10 +157,11 @@ class CSignalNoiseRatioBar : public CSignalBar
void Refresh();
public:
CSignalNoiseRatioBar(){};
CSignalNoiseRatioBar(CComponentsForm *parent = NULL)
: CSignalBar(parent){};
///basic component class constructor for signal noise ratio.
CSignalNoiseRatioBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref)
: CSignalBar(xpos, ypos, w, h, frontend_ref, "SNR"){};
CSignalNoiseRatioBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref, CComponentsForm *parent = NULL)
: CSignalBar(xpos, ypos, w, h, frontend_ref, "SNR", parent){};
};
/// Class CSignalBox() provides CSignalBar(), CSignalNoiseRatioBar() scales at once.
@@ -268,7 +269,7 @@ class CSignalBox : public CComponentsForm
public:
///class constructor for signal noise ratio.
CSignalBox(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref = NULL, const bool vertical = true);
CSignalBox(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref = NULL, const bool vertical = true, CComponentsForm *parent = NULL);
///returns the signal object, type = CSignalBar*
CSignalBar* getScaleObject(){return sbar;};

View File

@@ -3,7 +3,7 @@
Copyright (C) 2001 by Steffen Hehn 'McClean'
Classes for generic GUI-related components.
Copyright (C) 2013, Thilo Graf 'dbt'
Copyright (C) 2013-2014, Thilo Graf 'dbt'
License: GPL
@@ -33,20 +33,7 @@ CComponentsSlider::CComponentsSlider( const int& x_pos, const int& y_pos, const
const int& current_value,
const int& min_value,
const int& max_value,
bool has_shadow,
fb_pixel_t& color_frame,
fb_pixel_t& color_body,
fb_pixel_t& color_shadow)
{
initVarSlider(x_pos, y_pos, w, h, current_value, min_value, max_value, has_shadow, color_frame, color_body, color_shadow);
initCCSlItems();
}
void CComponentsSlider::initVarSlider( const int& x_pos, const int& y_pos, const int& w, const int& h,
const int& current_value,
const int& min_value,
const int& max_value,
CComponentsForm *parent,
bool has_shadow,
fb_pixel_t& color_frame,
fb_pixel_t& color_body,
@@ -74,6 +61,9 @@ void CComponentsSlider::initVarSlider( const int& x_pos, const int& y_pos, const
csl_body_icon = NEUTRINO_ICON_VOLUMEBODY;
csl_slider_icon =NEUTRINO_ICON_VOLUMESLIDER2;
initCCSlItems();
initParent(parent);
}
//set current value

View File

@@ -3,7 +3,7 @@
Copyright (C) 2001 by Steffen Hehn 'McClean'
Classes for generic GUI-related components.
Copyright (C) 2013, Thilo Graf 'dbt'
Copyright (C) 2013-2014, Thilo Graf 'dbt'
License: GPL
@@ -60,23 +60,12 @@ class CComponentsSlider : public CComponentsForm
///init all items at once
void initCCSlItems();
///init all required variables
void initVarSlider( const int& x_pos, const int& y_pos, const int& w, const int& h,
const int& current_value,
const int& min_value,
const int& max_value,
bool has_shadow,
fb_pixel_t& color_frame,
fb_pixel_t& color_body,
fb_pixel_t& color_shadow);
protected:
public:
CComponentsSlider( const int& x_pos = 1, const int& y_pos = 1, const int& w = 120+16, const int& h = 32,
CComponentsSlider( const int& x_pos = 0, const int& y_pos = 0, const int& w = 120+16, const int& h = 32,
const int& current_value = 0,
const int& min_value = 0,
const int& max_value = 100,
CComponentsForm *parent = NULL,
bool has_shadow = CC_SHADOW_OFF,
fb_pixel_t& color_frame = COL_MENUCONTENT_PLUS_6,
fb_pixel_t& color_body = COL_MENUHEAD_PLUS_0,

View File

@@ -3,7 +3,7 @@
Copyright (C) 2001 by Steffen Hehn 'McClean'
Classes for generic GUI-related components.
Copyright (C) 2012, 2013, 2014 Thilo Graf 'dbt'
Copyright (C) 2012-2014 Thilo Graf 'dbt'
Copyright (C) 2012, Michael Liebmann 'micha-bbg'
License: GPL
@@ -29,62 +29,66 @@
#include <global.h>
#include <neutrino.h>
#include "cc_frm_window.h"
#include <driver/screen_max.h>
#include <system/debug.h>
using namespace std;
//-------------------------------------------------------------------------------------------------------
//sub class CComponentsWindow inherit from CComponentsForm
CComponentsWindow::CComponentsWindow()
CComponentsWindow::CComponentsWindow(CComponentsForm *parent)
{
initVarWindow();
initVarWindow(0, 0, 800, 600, "", "", parent);
}
CComponentsWindow::CComponentsWindow( const int& x_pos, const int& y_pos, const int& w, const int& h,
neutrino_locale_t locale_caption,
const string& iconname,
CComponentsForm *parent,
bool has_shadow,
fb_pixel_t color_frame,
fb_pixel_t color_body,
fb_pixel_t color_shadow)
{
string s_caption = locale_caption != NONEXISTANT_LOCALE ? g_Locale->getText(locale_caption) : "";
initVarWindow(x_pos, y_pos, w, h, s_caption, iconname, has_shadow, color_frame, color_body, color_shadow);
initVarWindow(x_pos, y_pos, w, h, s_caption, iconname, parent, has_shadow, color_frame, color_body, color_shadow);
}
CComponentsWindow::CComponentsWindow( const int& x_pos, const int& y_pos, const int& w, const int& h,
const string& caption,
const string& iconname,
CComponentsForm *parent,
bool has_shadow,
fb_pixel_t color_frame,
fb_pixel_t color_body,
fb_pixel_t color_shadow)
{
initVarWindow(x_pos, y_pos, w, h, caption, iconname, has_shadow, color_frame, color_body, color_shadow);
initVarWindow(x_pos, y_pos, w, h, caption, iconname, parent, has_shadow, color_frame, color_body, color_shadow);
}
CComponentsWindowMax::CComponentsWindowMax( const string& caption,
const string& iconname,
CComponentsForm *parent,
bool has_shadow,
fb_pixel_t color_frame,
fb_pixel_t color_body,
fb_pixel_t color_shadow)
:CComponentsWindow(0, 0, 0, 0, caption,
iconname, has_shadow, color_frame, color_body, color_shadow){};
iconname, parent, has_shadow, color_frame, color_body, color_shadow){};
CComponentsWindowMax::CComponentsWindowMax( neutrino_locale_t locale_caption,
const string& iconname,
CComponentsForm *parent,
bool has_shadow,
fb_pixel_t color_frame,
fb_pixel_t color_body,
fb_pixel_t color_shadow)
:CComponentsWindow(0, 0, 0, 0,
locale_caption != NONEXISTANT_LOCALE ? g_Locale->getText(locale_caption) : "",
iconname, has_shadow, color_frame, color_body, color_shadow){};
iconname, parent, has_shadow, color_frame, color_body, color_shadow){};
void CComponentsWindow::initVarWindow( const int& x_pos, const int& y_pos, const int& w, const int& h,
const string& caption,
const string& iconname,
CComponentsForm *parent,
bool has_shadow,
fb_pixel_t color_frame,
fb_pixel_t color_body,
@@ -104,9 +108,9 @@ void CComponentsWindow::initVarWindow( const int& x_pos, const int& y_pos, const
ccw_caption = caption;
ccw_icon_name = iconname;
#ifdef DEBUG_CC
printf("[CComponentsWindow] [%s - %d] icon name = %s\n", __func__, __LINE__, ccw_icon_name.c_str());
#endif
dprintf(DEBUG_DEBUG, "[CComponentsWindow] [%s - %d] icon name = %s\n", __func__, __LINE__, ccw_icon_name.c_str());
shadow = has_shadow;
col_frame = color_frame;
col_body = color_body;
@@ -122,6 +126,7 @@ void CComponentsWindow::initVarWindow( const int& x_pos, const int& y_pos, const
ccw_align_mode = CTextBox::NO_AUTO_LINEBREAK;
initCCWItems();
initParent(parent);
}
void CComponentsWindow::initWindowSize()
@@ -146,11 +151,6 @@ void CComponentsWindow::initWindowPos()
y = frameBuffer->getScreenY();
}
void CComponentsWindow::doCenter(){
x = cc_parent ? cc_parent->getWidth() - width/2 : getScreenStartX(width);
y = cc_parent ? cc_parent->getHeight() - height/2 : getScreenStartY(height);
}
void CComponentsWindow::setWindowCaption(neutrino_locale_t locale_text, const int& align_mode)
{
ccw_caption = g_Locale->getText(locale_text);
@@ -168,7 +168,7 @@ void CComponentsWindow::initHeader()
ccw_head->setPos(0, 0);
ccw_head->setIcon(ccw_icon_name);
ccw_head->setCaption(ccw_caption, ccw_align_mode);
ccw_head->setDefaultButtons(ccw_buttons);
ccw_head->setContextButton(ccw_buttons);
ccw_head->setCorner(corner_rad, CORNER_TOP);
}
}
@@ -209,9 +209,8 @@ void CComponentsWindow::initBody()
void CComponentsWindow::initCCWItems()
{
#ifdef DEBUG_CC
printf("[CComponentsWindow] [%s - %d] init items...\n", __func__, __LINE__);
#endif
dprintf(DEBUG_DEBUG, "[CComponentsWindow] [%s - %d] init items...\n", __func__, __LINE__);
//add/remove header if required
if (ccw_show_header){
initHeader();

View File

@@ -86,12 +86,11 @@ class CComponentsWindow : public CComponentsForm
void initVarWindow( const int& x_pos = CC_CENTERED, const int& y_pos = CC_CENTERED, const int& w = 0, const int& h = 0,
const std::string& caption = "",
const std::string& iconname = "",
CComponentsForm *parent = NULL,
bool has_shadow = CC_SHADOW_OFF,
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6,
fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0,
fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
///allow centering of window on screen, mostly senseful for window object without parent
void doCenter();
///initialize width and height
void initWindowSize();
///initialize position
@@ -103,12 +102,13 @@ class CComponentsWindow : public CComponentsForm
CC_WINDOW_ITEM_HEADER = 0
};
///simple constructor for CComponentsWindow, this shows a window over full screen
CComponentsWindow();
CComponentsWindow(CComponentsForm *parent = NULL);
///advanced constructor for CComponentsWindow, provides parameters for the most required properties, and caption as string, x_pos or y_pos = 0 will center window
CComponentsWindow( const int& x_pos, const int& y_pos, const int& w, const int& h,
const std::string& caption = "",
const std::string& iconname = "",
CComponentsForm *parent = NULL,
bool has_shadow = CC_SHADOW_OFF,
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6,
fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0,
@@ -118,6 +118,7 @@ class CComponentsWindow : public CComponentsForm
CComponentsWindow( const int& x_pos, const int& y_pos, const int& w, const int& h,
neutrino_locale_t locale_text = NONEXISTANT_LOCALE,
const std::string& iconname = "",
CComponentsForm *parent = NULL,
bool has_shadow = CC_SHADOW_OFF,
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6,
fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0,
@@ -165,6 +166,7 @@ class CComponentsWindowMax : public CComponentsWindow
public:
///simple constructor for CComponentsWindow, provides parameters for caption as string and icon, this shows a centered window based up current screen settings
CComponentsWindowMax( const std::string& caption, const std::string& iconname = "",
CComponentsForm *parent = NULL,
bool has_shadow = CC_SHADOW_OFF,
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6,
fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0,
@@ -172,6 +174,7 @@ class CComponentsWindowMax : public CComponentsWindow
///simple constructor for CComponentsWindow, provides parameters for caption from locales and icon, this shows a centered window based up current screen settings
CComponentsWindowMax( neutrino_locale_t locale_caption, const std::string& iconname = "",
CComponentsForm *parent = NULL,
bool has_shadow = CC_SHADOW_OFF,
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6,
fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0,

View File

@@ -3,7 +3,7 @@
Copyright (C) 2001 by Steffen Hehn 'McClean'
Classes for generic GUI-related components.
Copyright (C) 2012, 2013, Thilo Graf 'dbt'
Copyright (C) 2012-2014, Thilo Graf 'dbt'
Copyright (C) 2012, Michael Liebmann 'micha-bbg'
License: GPL
@@ -31,17 +31,10 @@
#include <global.h>
#include <neutrino.h>
#include "cc_base.h"
#include <driver/screen_max.h>
#include <system/debug.h>
using namespace std;
//abstract sub class CComponentsItem from CComponents
CComponentsItem::CComponentsItem()
{
//CComponentsItem
initVarItem();
cc_item_type = CC_ITEMTYPE_BASE;
}
// y
// x+------f-r-a-m-e-------+
// | |
@@ -49,13 +42,21 @@ CComponentsItem::CComponentsItem()
// | |
// +--------width---------+
void CComponentsItem::initVarItem()
//abstract sub class CComponentsItem from CComponents
CComponentsItem::CComponentsItem(CComponentsForm* parent)
{
//CComponents
cc_item_type = CC_ITEMTYPE_BASE;
cc_item_index = CC_NO_INDEX;
cc_item_enabled = true;
cc_item_selected = false;
cc_parent = NULL;
initParent(parent);
}
void CComponentsItem::initParent(CComponentsForm* parent)
{
cc_parent = parent;
if (cc_parent)
cc_parent->addCCItem(this);
}
// Paint container background in cc-items with shadow, background and frame.
@@ -99,9 +100,9 @@ void CComponentsItem::paintInit(bool do_save_bg)
continue;
v_fbdata.push_back(fbdata[i]);
}
#ifdef DEBUG_CC
printf("[CComponentsItem] %s:\ncc_item_type: %d\ncc_item_index = %d\nheight = %d\nwidth = %d\n", __func__, cc_item_type, cc_item_index, height, width);
#endif
dprintf(DEBUG_DEBUG, "[CComponentsItem] %s:\ncc_item_type: %d\ncc_item_index = %d\nheight = %d\nwidth = %d\n", __func__, cc_item_type, cc_item_index, height, width);
paintFbItems(do_save_bg);
}
@@ -149,9 +150,9 @@ int CComponentsItem::getItemType()
if (i == cc_item_type)
return i;
}
#ifdef DEBUG_CC
printf("[CComponentsItem] %s: unknown item type requested...\n", __func__);
#endif
dprintf(DEBUG_DEBUG, "[CComponentsItem] %s: unknown item type requested...\n", __func__);
return -1;
}
@@ -163,3 +164,39 @@ bool CComponentsItem::isAdded()
return false;
}
void CComponentsItem::setXPosP(const uint8_t& xpos_percent)
{
int x_tmp = cc_parent ? xpos_percent*cc_parent->getWidth() : xpos_percent*frameBuffer->getScreenWidth();
x = x_tmp/100;
}
void CComponentsItem::setYPosP(const uint8_t& ypos_percent)
{
int y_tmp = cc_parent ? ypos_percent*cc_parent->getHeight() : ypos_percent*frameBuffer->getScreenHeight();
x = y_tmp/100;
}
void CComponentsItem::setPosP(const uint8_t& xpos_percent, const uint8_t& ypos_percent)
{
setXPosP(xpos_percent);
setYPosP(ypos_percent);
}
void CComponentsItem::setCenterPos(int along_mode)
{
if (along_mode & CC_ALONG_X)
x = cc_parent ? cc_parent->getWidth() - width/2 : getScreenStartX(width);
if (along_mode & CC_ALONG_Y)
y = cc_parent ? cc_parent->getHeight() - height/2 : getScreenStartY(height);
}
void CComponentsItem::setHeightP(const uint8_t& h_percent)
{
height = cc_parent ? h_percent*cc_parent->getWidth()/100 : h_percent*frameBuffer->getScreenWidth()/100;
}
void CComponentsItem::setWidthP(const uint8_t& w_percent)
{
width = cc_parent ? w_percent*cc_parent->getHeight()/100 : w_percent*frameBuffer->getScreenHeight()/100;
}

View File

@@ -3,7 +3,7 @@
Copyright (C) 2001 by Steffen Hehn 'McClean'
Classes for generic GUI-related components.
Copyright (C) 2012, 2013, Thilo Graf 'dbt'
Copyright (C) 2012-2014, Thilo Graf 'dbt'
Copyright (C) 2012, Michael Liebmann 'micha-bbg'
License: GPL
@@ -35,20 +35,16 @@
using namespace std;
//sub class CComponentsInfoBox from CComponentsItem
CComponentsInfoBox::CComponentsInfoBox()
CComponentsInfoBox::CComponentsInfoBox( const int& x_pos, const int& y_pos, const int& w, const int& h,
std::string info_text,
const int mode,
Font* font_text,
CComponentsForm *parent,
bool has_shadow,
fb_pixel_t color_text, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
{
//CComponentsInfoBox
initVarInfobox();
}
cc_item_type = CC_ITEMTYPE_TEXT_INFOBOX;
CComponentsInfoBox::CComponentsInfoBox(const int x_pos, const int y_pos, const int w, const int h,
std::string info_text, const int mode, Font* font_text,
bool has_shadow,
fb_pixel_t color_text, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
{
//CComponentsInfoBox
initVarInfobox();
x = x_pos;
y = y_pos;
width = w;
@@ -62,6 +58,13 @@ CComponentsInfoBox::CComponentsInfoBox(const int x_pos, const int y_pos, const i
ct_text_mode = mode;
ct_font = font_text;
ct_col_text = color_text;
//CComponentsInfoBox
pic = NULL;
cctext = NULL;
pic_name = "";
x_offset = 10;
initParent(parent);
}
CComponentsInfoBox::~CComponentsInfoBox()
@@ -70,15 +73,17 @@ CComponentsInfoBox::~CComponentsInfoBox()
delete cctext;
}
void CComponentsInfoBox::initVarInfobox()
void CComponentsInfoBox::setPicture(const std::string& picture_name)
{
cc_item_type = CC_ITEMTYPE_TEXT_INFOBOX;
pic_name = picture_name;
}
//CComponentsInfoBox
pic = NULL;
cctext = NULL;
pic_name = "";
x_offset = 10;
void CComponentsInfoBox::setPicture(const char* picture_name)
{
string s_tmp = "";
if (picture_name)
s_tmp = string(picture_name);
setPicture(s_tmp);
}
void CComponentsInfoBox::paintPicture()

View File

@@ -3,7 +3,7 @@
Copyright (C) 2001 by Steffen Hehn 'McClean'
Classes for generic GUI-related components.
Copyright (C) 2012, 2013, Thilo Graf 'dbt'
Copyright (C) 2012-2014, Thilo Graf 'dbt'
License: GPL
@@ -52,8 +52,6 @@ class CComponentsInfoBox : public CComponentsText
///property: path or default name of displayed image
std::string pic_default_name;
///initialize all needed default attributes
void initVarInfobox();
///paint picture, used in initVarInfobox()
void paintPicture();
///property: path or name of displayed image
@@ -63,9 +61,11 @@ class CComponentsInfoBox : public CComponentsText
///object: internal used CTextBox object
CComponentsText * cctext;
CComponentsInfoBox();
CComponentsInfoBox( const int x_pos, const int y_pos, const int w, const int h,
std::string info_text = "", const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL,
CComponentsInfoBox( const int& x_pos = 0, const int& y_pos = 0, const int& w = 800, const int& h = 600,
std::string info_text = "",
const int mode = CTextBox::AUTO_WIDTH,
Font* font_text = NULL,
CComponentsForm *parent = NULL,
bool has_shadow = CC_SHADOW_OFF,
fb_pixel_t color_text = COL_MENUCONTENT_TEXT, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
@@ -73,8 +73,10 @@ class CComponentsInfoBox : public CComponentsText
///set property: space around fram and beetween picture and textbox
inline void setSpaceOffset(const int offset){x_offset = offset;};
///set property: path or name of displayed image
inline void setPicture(const std::string& picture_name){pic_name = picture_name;};
///set property: path or name of displayed image, parameter as string
void setPicture(const std::string& picture_name);
///set property: path or name of displayed image, parameter as const char*
void setPicture(const char* picture_name);
///paint item
void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);

View File

@@ -3,7 +3,7 @@
Copyright (C) 2001 by Steffen Hehn 'McClean'
Classes for generic GUI-related components.
Copyright (C) 2012, 2013, Thilo Graf 'dbt'
Copyright (C) 2012-2014, Thilo Graf 'dbt'
Copyright (C) 2012, Michael Liebmann 'micha-bbg'
License: GPL
@@ -32,7 +32,7 @@
#include <neutrino.h>
#include "cc_item_picture.h"
#include <unistd.h>
#include <system/debug.h>
extern CPictureViewer * g_PicViewer;
using namespace std;
@@ -41,13 +41,20 @@ using namespace std;
//-------------------------------------------------------------------------------------------------------
//sub class CComponentsPicture from CComponentsItem
CComponentsPicture::CComponentsPicture( const int &x_pos, const int &y_pos, const int &w, const int &h,
const std::string& image_name, const int &alignment, bool has_shadow,
const std::string& image_name,
const int &alignment,
CComponentsForm *parent,
bool has_shadow,
fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow)
{
init(x_pos, y_pos, w, h, image_name, alignment, has_shadow, color_frame, color_background, color_shadow);
init(x_pos, y_pos, w, h, image_name, alignment, parent, has_shadow, color_frame, color_background, color_shadow);
}
void CComponentsPicture::init( const int &x_pos, const int &y_pos, const int &w, const int &h, const string& image_name, const int &alignment, bool has_shadow,
void CComponentsPicture::init( const int &x_pos, const int &y_pos, const int &w, const int &h,
const string& image_name,
const int &alignment,
CComponentsForm *parent,
bool has_shadow,
fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow)
{
//CComponents, CComponentsItem
@@ -79,6 +86,7 @@ void CComponentsPicture::init( const int &x_pos, const int &y_pos, const int &w,
pic_width = pic_height = 0;
initCCItem();
initParent(parent);
}
void CComponentsPicture::setPicture(const std::string& picture_name)
@@ -87,6 +95,13 @@ void CComponentsPicture::setPicture(const std::string& picture_name)
initCCItem();
}
void CComponentsPicture::setPicture(const char* picture_name)
{
string s_tmp = "";
if (picture_name)
s_tmp = string(picture_name);
setPicture(s_tmp);
}
void CComponentsPicture::setPictureAlign(const int alignment)
{
@@ -133,10 +148,8 @@ void CComponentsPicture::initCCItem()
g_PicViewer->rescaleImageDimensions(&pic_width, &pic_height, pic_max_w, pic_max_h);
}
#ifdef DEBUG_CC
if (pic_width == 0 || pic_height == 0)
printf("[CComponentsPicture] %s file: %s, no icon dimensions found! width = %d, height = %d\n", __func__, pic_name.c_str(), pic_width, pic_height);
#endif
dprintf(DEBUG_DEBUG, "[CComponentsPicture] %s file: %s, no icon dimensions found! width = %d, height = %d\n", __func__, pic_name.c_str(), pic_width, pic_height);
initPosition();
@@ -144,10 +157,8 @@ void CComponentsPicture::initCCItem()
width = max(max(pic_width, pic_max_w), width) + sw ;
height = max(max(pic_height, pic_max_h), height) + sw ;
#ifdef DEBUG_CC
printf("[CComponentsPicture] %s initialized Image: ====>> %s\n\titem x = %d\n\tdx = %d (image dx = %d)\n\titem y = %d\n\titem dy = %d (image dy = %d)\n",
dprintf(DEBUG_DEBUG, "[CComponentsPicture] %s initialized Image: ====>> %s\n\titem x = %d\n\tdx = %d (image dx = %d)\n\titem y = %d\n\titem dy = %d (image dy = %d)\n",
__func__, pic_name.c_str(), x, width, pic_width, y, height, pic_height);
#endif
}
void CComponentsPicture::initPosition()
@@ -182,9 +193,8 @@ void CComponentsPicture::paintPicture()
pic_painted = false;
if (do_paint && cc_allow_paint){
#ifdef DEBUG_CC
printf(" [CComponentsPicture] %s: paint image: %s (do_paint=%d) with mode %d\n", __func__, pic_name.c_str(), do_paint, pic_paint_mode);
#endif
dprintf(DEBUG_DEBUG, "[CComponentsPicture] %s: paint image: %s (do_paint=%d) with mode %d\n", __func__, pic_name.c_str(), do_paint, pic_paint_mode);
if (pic_paint_mode == CC_PIC_IMAGE_MODE_OFF)
pic_painted = frameBuffer->paintIcon(pic_name, pic_x, pic_y, 0 /*pic_max_h*/, pic_offset, pic_paint, pic_paintBg, col_body);
else if (pic_paint_mode == CC_PIC_IMAGE_MODE_ON)
@@ -210,11 +220,14 @@ void CComponentsPicture::hide(bool no_restore)
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,
const uint64_t& channelId,
const std::string& channelName,
const int &alignment,
CComponentsForm *parent,
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,
"", alignment, parent, has_shadow,
color_frame, color_background, color_shadow)
{
channel_id = channelId;
@@ -230,6 +243,14 @@ void CComponentsChannelLogo::setPicture(const std::string& picture_name)
initVarPictureChannellLogo();
}
void CComponentsChannelLogo::setPicture(const char* picture_name)
{
string s_tmp = "";
if (picture_name)
s_tmp = string(picture_name);
this->setPicture(s_tmp);
}
void CComponentsChannelLogo::setChannel(const uint64_t& channelId, const std::string& channelName)
{
channel_id = channelId;
@@ -248,10 +269,8 @@ void CComponentsChannelLogo::initVarPictureChannellLogo()
if (!has_logo)
pic_name = tmp_logo;
#ifdef DEBUG_CC
printf("\t[CComponentsChannelLogo] %s: init image: %s (has_logo=%d, channel_id=%" PRIu64 ")\n", __func__, pic_name.c_str(), has_logo, channel_id);
#endif
dprintf(DEBUG_DEBUG, "\t[CComponentsChannelLogo] %s: init image: %s (has_logo=%d, channel_id=%" PRIu64 ")\n", __func__, pic_name.c_str(), has_logo, channel_id);
initCCItem();
}

View File

@@ -3,7 +3,7 @@
Copyright (C) 2001 by Steffen Hehn 'McClean'
Classes for generic GUI-related components.
Copyright (C) 2012, 2013, Thilo Graf 'dbt'
Copyright (C) 2012-2014, Thilo Graf 'dbt'
Copyright (C) 2012, Michael Liebmann 'micha-bbg'
License: GPL
@@ -63,6 +63,7 @@ class CComponentsPicture : public CComponentsItem
void init( const int &x_pos, const int &y_pos, const int &w, const int &h,
const std::string& image_name,
const int &alignment,
CComponentsForm *parent,
bool has_shadow,
fb_pixel_t color_frame,
fb_pixel_t color_background,
@@ -78,6 +79,7 @@ class CComponentsPicture : public CComponentsItem
CComponentsPicture( const int &x_pos, const int &y_pos, const int &w, const int &h,
const std::string& image_name,
const int &alignment = CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER,
CComponentsForm *parent = NULL,
bool has_shadow = CC_SHADOW_OFF,
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6,
fb_pixel_t color_background = 0,
@@ -87,9 +89,12 @@ class CComponentsPicture : public CComponentsItem
virtual inline void setPicturePaint(bool paint_p){pic_paint = paint_p;};
virtual inline void setPicturePaintBackground(bool paintBg){pic_paintBg = paintBg;};
virtual void setPicture(const std::string& picture_name);
virtual void setPicture(const char* picture_name);
virtual void setPictureAlign(const int alignment);
///return paint mode of internal image, true=image was painted, please do not to confuse with isPainted()! isPainted() is related to item itself.
virtual inline bool isPicPainted(){return pic_painted;};
virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
virtual void hide(bool no_restore = false);
virtual inline void getPictureSize(int *pwidth, int *pheight){*pwidth=pic_width; *pheight=pic_height;};
@@ -113,6 +118,7 @@ class CComponentsChannelLogo : public CComponentsPicture, CPictureViewer
const uint64_t& channelId =0,
const std::string& channelName = "",
const int &alignment = CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER,
CComponentsForm *parent = NULL,
bool has_shadow = CC_SHADOW_OFF,
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6,
fb_pixel_t color_background = 0,
@@ -120,6 +126,7 @@ class CComponentsChannelLogo : public CComponentsPicture, CPictureViewer
void setChannel(const uint64_t& channelId, const std::string& channelName);
void setPicture(const std::string& picture_name);
void setPicture(const char* picture_name);
bool hasLogo(){return has_logo;};
void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
};

View File

@@ -2,7 +2,7 @@
Based up Neutrino-GUI - Tuxbox-Project
Copyright (C) 2001 by Steffen Hehn 'McClean'
(C) 2008, 2013 by Thilo Graf
(C) 2008,2013,2014 by Thilo Graf
(C) 2009,2010,2013 Stefan Seyfried
License: GPL
@@ -39,19 +39,16 @@
#define GREEN 0x00FF00
#define YELLOW 0xFFFF00
CProgressBar::CProgressBar()
{
initVarProgressbar();
}
CProgressBar::CProgressBar( const int x_pos, const int y_pos, const int w, const int h,
fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow,
const fb_pixel_t active_col, const fb_pixel_t passive_col,
const bool blinkenlights,
const int r, const int g, const int b,
const bool inv)
const bool inv,
CComponentsForm *parent)
{
initVarProgressbar();
//CComponentsItem
cc_item_type = CC_ITEMTYPE_PROGRESSBAR;
//CComponents
x = x_pos;
@@ -70,24 +67,9 @@ CProgressBar::CProgressBar( const int x_pos, const int y_pos, const int w, const
pb_yellow = b;
pb_active_col = active_col;
pb_passive_col = passive_col;
}
void CProgressBar::initVarProgressbar()
{
//CComponentsItem
cc_item_type = CC_ITEMTYPE_PROGRESSBAR;
//CProgressBar
pb_blink = false;
pb_invert = false;
pb_bl_changed = g_settings.progressbar_color;
pb_last_width = -1;
pb_red = 40;
pb_green = 100;
pb_yellow = 70;
pb_active_col = COL_INFOBAR_PLUS_7;
pb_passive_col = COL_INFOBAR_PLUS_3;
pb_value = 0;
pb_max_value = 0;
pb_paint_zero = false;
@@ -100,7 +82,8 @@ void CProgressBar::initVarProgressbar()
pb_height = 0;
pb_start_x_passive = 0;
pb_passive_width = width;
}
initParent(parent);
}
//calculate bar dimensions
void CProgressBar::initDimensions()
@@ -138,7 +121,7 @@ void CProgressBar::initDimensions()
void CProgressBar::paintShapes(int &shx, int &shy, int &shw, int &shh, fb_pixel_t &col)
{
CComponentsShapeSquare shape(shx, shy, shw, shh, false);
CComponentsShapeSquare shape(shx, shy, shw, shh, NULL, false);
shape.setColorBody(col);
shape.allowPaint(cc_allow_paint);
shape.paint(false);

View File

@@ -2,7 +2,7 @@
Based up Neutrino-GUI - Tuxbox-Project
Copyright (C) 2001 by Steffen Hehn 'McClean'
(C) 2008, 2013 by Thilo Graf
(C) 2008,2013,2014 by Thilo Graf
(C) 2009,2010,2013 Stefan Seyfried
License: GPL
@@ -50,7 +50,8 @@
#define __CC_PROGRESSBAR_H__
#include "config.h"
#include <gui/components/cc_base.h>
#include "cc_base.h"
#include <string>
class CProgressBar : public CComponentsItem
@@ -110,14 +111,14 @@ class CProgressBar : public CComponentsItem
///inv: false => red on the left side, true: red on right side.
///active_col, passive_col: sets colors for displayed values, activ_col means the the displayed progress
///color_frame, color_body, color_shadow: colores of progressbar for frame, body and shadow, Note: color of frame is ineffective on fr_thickness = 0
CProgressBar();
CProgressBar( const int x_pos, const int y_pos,
CProgressBar( const int x_pos = 0, const int y_pos = 0,
const int w = -1, const int h = -1,
fb_pixel_t color_frame = 0, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0,
const fb_pixel_t active_col = COL_INFOBAR_PLUS_7, const fb_pixel_t passive_col = COL_INFOBAR_PLUS_3,
const bool blinkenlights = false,
const int r = 40, const int g = 100, const int b =70,
const bool inv = false );
const bool inv = false,
CComponentsForm *parent = NULL);
///set up to display available values

View File

@@ -3,7 +3,7 @@
Copyright (C) 2001 by Steffen Hehn 'McClean'
Classes for generic GUI-related components.
Copyright (C) 2012, 2013, Thilo Graf 'dbt'
Copyright (C) 2012-2014, Thilo Graf 'dbt'
Copyright (C) 2012, Michael Liebmann 'micha-bbg'
License: GPL
@@ -35,7 +35,10 @@
using namespace std;
//sub class CComponentsShapeSquare from CComponentsItem
CComponentsShapeSquare::CComponentsShapeSquare(const int x_pos, const int y_pos, const int w, const int h, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
CComponentsShapeSquare::CComponentsShapeSquare( const int x_pos, const int y_pos, const int w, const int h,
CComponentsForm *parent,
bool has_shadow,
fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
{
//CComponentsItem
cc_item_type = CC_ITEMTYPE_SHAPE_SQUARE;
@@ -49,6 +52,7 @@ CComponentsShapeSquare::CComponentsShapeSquare(const int x_pos, const int y_pos,
col_frame = color_frame;
col_body = color_body;
col_shadow = color_shadow;
initParent(parent);
}
void CComponentsShapeSquare::paint(bool do_save_bg)
@@ -59,8 +63,10 @@ void CComponentsShapeSquare::paint(bool do_save_bg)
//-------------------------------------------------------------------------------------------------------
//sub class CComponentsShapeCircle from CComponentsItem
CComponentsShapeCircle::CComponentsShapeCircle( int x_pos, int y_pos, int diam, bool has_shadow,
fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
CComponentsShapeCircle::CComponentsShapeCircle( int x_pos, int y_pos, int diam,
CComponentsForm *parent,
bool has_shadow,
fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
{
//CComponents, CComponentsItem
cc_item_type = CC_ITEMTYPE_SHAPE_CIRCLE;
@@ -80,6 +86,7 @@ CComponentsShapeCircle::CComponentsShapeCircle( int x_pos, int y_pos, int diam,
//CComponentsItem
corner_rad = d/2;
initParent(parent);
}
// y

View File

@@ -3,7 +3,7 @@
Copyright (C) 2001 by Steffen Hehn 'McClean'
Classes for generic GUI-related components.
Copyright (C) 2012, 2013, Thilo Graf 'dbt'
Copyright (C) 2012-2014 Thilo Graf 'dbt'
License: GPL
@@ -43,7 +43,9 @@ class CComponentsShapeCircle : public CComponentsItem
///property: diam
int d;
public:
CComponentsShapeCircle( const int x_pos, const int y_pos, const int diam, bool has_shadow = CC_SHADOW_ON,
CComponentsShapeCircle( const int x_pos, const int y_pos, const int diam,
CComponentsForm *parent = NULL,
bool has_shadow = CC_SHADOW_ON,
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
///set property: diam
@@ -58,7 +60,9 @@ class CComponentsShapeCircle : public CComponentsItem
class CComponentsShapeSquare : public CComponentsItem
{
public:
CComponentsShapeSquare( const int x_pos, const int y_pos, const int w, const int h, bool has_shadow = CC_SHADOW_ON,
CComponentsShapeSquare( const int x_pos, const int y_pos, const int w, const int h,
CComponentsForm *parent = NULL,
bool has_shadow = CC_SHADOW_ON,
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);

View File

@@ -3,7 +3,7 @@
Copyright (C) 2001 by Steffen Hehn 'McClean'
Classes for generic GUI-related components.
Copyright (C) 2012, 2013, Thilo Graf 'dbt'
Copyright (C) 2012-2014, Thilo Graf 'dbt'
Copyright (C) 2012, Michael Liebmann 'micha-bbg'
License: GPL
@@ -34,46 +34,31 @@
#include <sstream>
#include <fstream>
#include <errno.h>
#include <system/debug.h>
using namespace std;
//sub class CComponentsText from CComponentsItem
CComponentsText::CComponentsText()
{
//CComponentsText
initVarText();
initCCText();
}
CComponentsText::CComponentsText( const int x_pos, const int y_pos, const int w, const int h,
std::string text, const int mode, Font* font_text,
CComponentsText::CComponentsText( CComponentsForm *parent,
const int x_pos, const int y_pos, const int w, const int h,
std::string text,
const int mode,
Font* font_text,
bool has_shadow,
fb_pixel_t color_text, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
{
//CComponentsText
initVarText();
//CComponents
x = x_pos,
y = y_pos,
width = w;
height = h;
col_frame = color_frame;
col_body = color_body;
col_shadow = color_shadow;
shadow = has_shadow;
ct_font = font_text;
ct_text = text;
ct_text_mode = mode;
ct_col_text = color_text;
initCCText();
initVarText(x_pos, y_pos, w, h, text, mode, font_text, parent, has_shadow, color_text, color_frame, color_body, color_shadow);
}
CComponentsText::CComponentsText( const int x_pos, const int y_pos, const int w, const int h,
std::string text,
const int mode,
Font* font_text,
CComponentsForm *parent,
bool has_shadow,
fb_pixel_t color_text, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
{
initVarText(x_pos, y_pos, w, h, text, mode, font_text, parent, has_shadow, color_text, color_frame, color_body, color_shadow);
}
CComponentsText::~CComponentsText()
{
@@ -82,18 +67,26 @@ CComponentsText::~CComponentsText()
}
void CComponentsText::initVarText()
void CComponentsText::initVarText( const int x_pos, const int y_pos, const int w, const int h,
std::string text,
const int mode,
Font* font_text,
CComponentsForm *parent,
bool has_shadow,
fb_pixel_t color_text, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
{
//CComponents, CComponentsItem
cc_item_type = CC_ITEMTYPE_TEXT;
//CComponentsText
ct_font = NULL;
cc_item_type = CC_ITEMBOX_TEXT;
ct_font = font_text;
ct_textbox = NULL;
ct_text = "";
ct_text = text;
ct_old_text = ct_text;
ct_text_mode = CTextBox::AUTO_WIDTH;
ct_text_mode = mode;
x = x_pos;
y = y_pos;
width = w;
height = h;
pX = &x;
pY = &y;
pHeight = &height;
@@ -105,11 +98,19 @@ void CComponentsText::initVarText()
ct_text_Hborder = 1;
ct_text_Vborder = 0;
ct_col_text = COL_MENUCONTENT_TEXT;
shadow = has_shadow;
ct_col_text = color_text;
ct_old_col_text = 0;
col_frame = color_frame;
col_body = color_body;
col_shadow = color_shadow;
ct_text_sent = false;
ct_paint_textbg = false;
ct_force_text_paint = false;
initCCText();
initParent(parent);
}
@@ -168,9 +169,8 @@ void CComponentsText::initCCText()
ct_old_text = ct_text;
ct_old_col_text = ct_col_text;
}
#ifdef DEBUG_CC
printf(" [CComponentsText] [%s - %d] init text: %s [x %d, y %d, w %d, h %d]\n", __func__, __LINE__, ct_text.c_str(), this->iX, this->iY, this->iWidth, this->iHeight);
#endif
dprintf(DEBUG_DEBUG, "[CComponentsText] [%s - %d] init text: %s [x %d, y %d, w %d, h %d]\n", __func__, __LINE__, ct_text.c_str(), this->iX, this->iY, this->iWidth, this->iHeight);
}
void CComponentsText::clearCCText()
@@ -186,9 +186,8 @@ void CComponentsText::setText(const std::string& stext, const int mode, Font* fo
ct_text = stext;
ct_text_mode = mode;
ct_font = font_text;
#ifdef DEBUG_CC
printf(" [CComponentsText] [%s - %d] ct_text: %s \n", __func__, __LINE__, ct_text.c_str());
#endif
dprintf(DEBUG_DEBUG, "[CComponentsText] [%s - %d] ct_text: %s \n", __func__, __LINE__, ct_text.c_str());
}
void CComponentsText::setText(neutrino_locale_t locale_text, int mode, Font* font_text)
@@ -286,7 +285,7 @@ string CComponentsText::iToString(int int_val)
//helper, get lines per textbox page
int CComponentsText::getTextLinesAutoHeight(const int& textMaxHeight, const int& textWidth, const int& mode)
{
CComponentsText box;
CBox box;
box.iX = 0;
box.iY = 0;
box.iWidth = textWidth;

View File

@@ -3,7 +3,7 @@
Copyright (C) 2001 by Steffen Hehn 'McClean'
Classes for generic GUI-related components.
Copyright (C) 2012, 2013, Thilo Graf 'dbt'
Copyright (C) 2012-2014, Thilo Graf 'dbt'
License: GPL
@@ -72,8 +72,14 @@ class CComponentsText : public CComponentsItem, public CBox
///helper: convert int to string
static std::string iToString(int int_val); //helper to convert int to string
///initialize all required default attributes
void initVarText();
///initialize all required attributes
void initVarText( const int x_pos, const int y_pos, const int w, const int h,
std::string text,
const int mode,
Font* font_text,
CComponentsForm *parent,
bool has_shadow,
fb_pixel_t color_text, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow);
///destroy current CTextBox and CBox objects
void clearCCText();
@@ -83,11 +89,22 @@ class CComponentsText : public CComponentsItem, public CBox
///paint CCItem backckrond (if paint_bg=true), apply initCCText() and send paint() to the CTextBox object
void paintText(bool do_save_bg = CC_SAVE_SCREEN_YES);
public:
CComponentsText();
CComponentsText( const int x_pos, const int y_pos, const int w, const int h,
std::string text = "", const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL,
CComponentsText( const int x_pos = 10, const int y_pos = 10, const int w = 150, const int h = 50,
std::string text = "",
const int mode = CTextBox::AUTO_WIDTH,
Font* font_text = NULL,
CComponentsForm *parent = NULL,
bool has_shadow = CC_SHADOW_OFF,
fb_pixel_t color_text = COL_MENUCONTENT_TEXT, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
CComponentsText( CComponentsForm *parent,
const int x_pos = 10, const int y_pos = 10, const int w = 150, const int h = 50,
std::string text = "",
const int mode = CTextBox::AUTO_WIDTH,
Font* font_text = NULL,
bool has_shadow = CC_SHADOW_OFF,
fb_pixel_t color_text = COL_MENUCONTENT_TEXT, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
virtual ~CComponentsText();
///default members to paint a text box and hide painted text
@@ -151,10 +168,16 @@ class CComponentsLabel : public CComponentsText
{
public:
CComponentsLabel( const int x_pos = 10, const int y_pos = 10, const int w = 150, const int h = 50,
std::string text = "", const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL,
std::string text = "",
const int mode = CTextBox::AUTO_WIDTH,
Font* font_text = NULL,
CComponentsForm *parent = NULL,
bool has_shadow = CC_SHADOW_OFF,
fb_pixel_t color_text = COL_MENUCONTENTINACTIVE_TEXT, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0)
:CComponentsText(x_pos, y_pos, w, h, text, mode, font_text, has_shadow, color_text, color_frame, color_body, color_shadow)
fb_pixel_t color_text = COL_MENUCONTENTINACTIVE_TEXT,
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6,
fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0,
fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0)
:CComponentsText(x_pos, y_pos, w, h, text, mode, font_text, parent, has_shadow, color_text, color_frame, color_body, color_shadow)
{
cc_item_type = CC_ITEMTYPE_LABEL;
};

View File

@@ -3,7 +3,7 @@
Copyright (C) 2001 by Steffen Hehn 'McClean'
Classes for generic GUI-related components.
Copyright (C) 2012, 2013, Thilo Graf 'dbt'
Copyright (C) 2012-2014, Thilo Graf 'dbt'
Copyright (C) 2012, Michael Liebmann 'micha-bbg'
License: GPL
@@ -40,7 +40,10 @@ using namespace std;
//-------------------------------------------------------------------------------------------------------
//sub class CComponentsPIP from CComponentsItem
CComponentsPIP::CComponentsPIP( const int x_pos, const int y_pos, const int percent, bool has_shadow)
CComponentsPIP::CComponentsPIP( const int x_pos, const int y_pos, const int percent,
CComponentsForm *parent,
bool has_shadow,
fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
{
//CComponents, CComponentsItem
cc_item_type = CC_ITEMTYPE_PIP;
@@ -58,9 +61,13 @@ CComponentsPIP::CComponentsPIP( const int x_pos, const int y_pos, const int perc
height = percent*screen_h/100;
shadow = has_shadow;
shadow_w = SHADOW_OFFSET;
col_frame = COL_BACKGROUND;
col_body = COL_BACKGROUND;
col_shadow = COL_MENUCONTENTDARK_PLUS_0;
col_frame = color_frame;
col_body = color_body;
col_shadow = color_shadow;
fr_thickness = 2;
corner_rad = RADIUS_SMALL;
corner_type = CORNER_ALL;
initParent(parent);
}
CComponentsPIP::~CComponentsPIP()
@@ -92,7 +99,8 @@ void CComponentsPIP::paint(bool do_save_bg)
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_HOR_CENTER | CC_ALIGN_VER_CENTER);
CComponentsPicture pic = CComponentsPicture (pig_x, pig_y, pig_w, pig_h, pic_name, CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER, NULL, false, col_frame, col_frame);
pic.setCorner(corner_rad, corner_type);
pic.paint(CC_SAVE_SCREEN_NO);
}
}

View File

@@ -3,7 +3,7 @@
Copyright (C) 2001 by Steffen Hehn 'McClean'
Classes for generic GUI-related components.
Copyright (C) 2012, 2013, Thilo Graf 'dbt'
Copyright (C) 2012-2014, Thilo Graf 'dbt'
License: GPL
@@ -50,7 +50,10 @@ class CComponentsPIP : public CComponentsItem
std::string pic_name;
public:
///constructor: initialize of position like all other items with x and y values, but dimensions in percent
CComponentsPIP( const int x_pos, const int y_pos, const int percent = 30, bool has_shadow = CC_SHADOW_OFF);
CComponentsPIP( const int x_pos = 0, const int y_pos = 0, const int percent = 30,
CComponentsForm *parent = NULL,
bool has_shadow = CC_SHADOW_OFF,
fb_pixel_t color_frame = COL_BLACK, fb_pixel_t color_body = COL_BACKGROUND, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
~CComponentsPIP();
///set property: width of tv box in pixel

View File

@@ -3,7 +3,7 @@
Copyright (C) 2001 by Steffen Hehn 'McClean'
Classes for generic GUI-related components.
Copyright (C) 2012, 2013, Thilo Graf 'dbt'
Copyright (C) 2012-2014, Thilo Graf 'dbt'
License: GPL
@@ -30,7 +30,9 @@
#include <system/localize.h>
#include <driver/fontrenderer.h>
// #define DEBUG_CC
class CComponentsForm;
///cc item types
typedef enum
@@ -110,6 +112,13 @@ enum
CC_ALIGN_VER_CENTER = 32
};
//item centering modes, see also CComponentsItem::setCenterPos()
enum
{
CC_ALONG_X = 1,
CC_ALONG_Y = 2
};
enum
{
CC_ITEMBOX_ICON,