mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-09-02 18:31:22 +02:00
Merge branch 'check/next-cc'
Only compile-tested.
This commit is contained in:
@@ -108,14 +108,15 @@ void CComponents::paintFbItems(bool do_save_bg)
|
||||
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)){
|
||||
// printf(" [CComponents] WARNING:\n [%s - %d], dx = %d\n dy = %d\n", __FUNCTION__, __LINE__, v_fbdata[i].dx, v_fbdata[i].dy);
|
||||
#ifdef DEBUG_CC
|
||||
printf(" [CComponents] WARNING: [%s - %d], dx = %d dy = %d\n", __FUNCTION__, __LINE__, v_fbdata[i].dx, v_fbdata[i].dy);
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
#if 0
|
||||
if ((v_fbdata[i].x == 0) || (v_fbdata[i].y == 0)){
|
||||
printf(" [CComponents] WARNING:\n [%s - %d], x = %d\n y = %d\n", __FUNCTION__, __LINE__, v_fbdata[i].x, v_fbdata[i].y);
|
||||
printf(" [CComponents] WARNING: [%s - %d], x = %d y = %d\n", __FUNCTION__, __LINE__, v_fbdata[i].x, v_fbdata[i].y);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
int fbtype = v_fbdata[i].fbdata_type;
|
||||
#ifdef DEBUG_CC
|
||||
|
@@ -33,7 +33,7 @@
|
||||
#include <driver/pictureviewer/pictureviewer.h>
|
||||
#include <gui/widget/icons.h>
|
||||
|
||||
//#define DEBUG_CC
|
||||
|
||||
|
||||
/// Basic component class.
|
||||
/*!
|
||||
@@ -45,6 +45,8 @@ 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
|
||||
@@ -97,8 +99,6 @@ class CComponents
|
||||
///mode: true=allows painting of item, see also allowPaint()
|
||||
bool cc_allow_paint;
|
||||
|
||||
///initialize of basic attributes, no parameters required
|
||||
void initVarBasic();
|
||||
///rendering of framebuffer elements at once,
|
||||
///elements are contained in v_fbdata, presumes added frambuffer elements with paintInit(),
|
||||
///parameter do_save_bg=true, saves background of element to pixel buffer, this can be restore with hide()
|
||||
@@ -216,6 +216,9 @@ 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;
|
||||
@@ -242,8 +245,6 @@ 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);
|
||||
|
||||
///initialize all required attributes
|
||||
void initVarItem();
|
||||
|
||||
public:
|
||||
CComponentsItem();
|
||||
|
@@ -69,9 +69,6 @@ CComponentsDetailLine::CComponentsDetailLine(const int x_pos, const int y_pos_to
|
||||
|
||||
void CComponentsDetailLine::initVarDline()
|
||||
{
|
||||
//CComponents
|
||||
initVarBasic();
|
||||
|
||||
shadow_w = 1;
|
||||
|
||||
//CComponentsDetailLine
|
||||
@@ -80,8 +77,6 @@ void CComponentsDetailLine::initVarDline()
|
||||
|
||||
CComponentsDetailLine::~CComponentsDetailLine()
|
||||
{
|
||||
hide(); //restore background
|
||||
clear();
|
||||
}
|
||||
|
||||
// y_top (=y)
|
||||
|
@@ -76,8 +76,6 @@ void CComponentsForm::cleanCCForm()
|
||||
#endif
|
||||
|
||||
clearCCItems();
|
||||
clearSavedScreen();
|
||||
clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -105,8 +103,6 @@ void CComponentsForm::clearCCItems()
|
||||
|
||||
void CComponentsForm::initVarForm()
|
||||
{
|
||||
//CComponentsItem
|
||||
initVarItem();
|
||||
|
||||
|
||||
//simple default dimensions
|
||||
|
@@ -37,9 +37,10 @@
|
||||
|
||||
class CComponentsForm : public CComponentsItem
|
||||
{
|
||||
private:
|
||||
void initVarForm();
|
||||
protected:
|
||||
std::vector<CComponentsItem*> v_cc_items;
|
||||
void initVarForm();
|
||||
void paintForm(bool do_save_bg);
|
||||
///generates next possible index for an item, see also cc_item_index, getIndex(), setIndex()
|
||||
int genIndex();
|
||||
@@ -112,6 +113,8 @@ class CComponentsIconForm : public CComponentsForm
|
||||
|
||||
class CComponentsHeader : public CComponentsForm
|
||||
{
|
||||
private:
|
||||
void initVarHeader();
|
||||
protected:
|
||||
CComponentsPicture * cch_icon_obj;
|
||||
CComponentsText * cch_text_obj;
|
||||
@@ -131,8 +134,6 @@ class CComponentsHeader : public CComponentsForm
|
||||
void initDefaultButtons();
|
||||
void initButtonFormSize();
|
||||
|
||||
void initVarHeader();
|
||||
|
||||
public:
|
||||
enum
|
||||
{
|
||||
@@ -317,6 +318,9 @@ class CComponentsWindow : public CComponentsForm
|
||||
|
||||
///refresh position and dimension and reinitialize elemenatary properties
|
||||
void Refresh(){initCCWItems();};
|
||||
|
||||
///paint all window items, this overwriting paint() from CComponentsForm
|
||||
virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
|
||||
};
|
||||
|
||||
|
||||
|
@@ -88,7 +88,6 @@ CComponentsButton::CComponentsButton( const int x_pos, const int y_pos, const i
|
||||
|
||||
void CComponentsButton::initVarButton()
|
||||
{
|
||||
initVarForm();
|
||||
cc_item_type = CC_ITEMTYPE_BUTTON;
|
||||
cc_btn_icon_obj = NULL;
|
||||
cc_btn_capt_obj = NULL;
|
||||
|
@@ -29,6 +29,7 @@
|
||||
|
||||
#include <global.h>
|
||||
#include <neutrino.h>
|
||||
#include <driver/neutrinofonts.h>
|
||||
|
||||
#include "cc_frm_clock.h"
|
||||
#include <time.h>
|
||||
@@ -60,32 +61,32 @@ CComponentsFrmClock::CComponentsFrmClock( const int x_pos, const int y_pos, cons
|
||||
col_body = color_body;
|
||||
col_shadow = color_shadow;
|
||||
|
||||
cl_format_str = format_str;
|
||||
paintClock = false;
|
||||
activeClock = activ;
|
||||
if (activeClock)
|
||||
startThread();
|
||||
|
||||
cl_format_str = format_str;
|
||||
}
|
||||
|
||||
void CComponentsFrmClock::initVarClock()
|
||||
{
|
||||
initVarForm();
|
||||
cc_item_type = CC_ITEMTYPE_FRM_CLOCK;
|
||||
corner_rad = RADIUS_SMALL;
|
||||
cc_item_type = CC_ITEMTYPE_FRM_CLOCK;
|
||||
corner_rad = RADIUS_SMALL;
|
||||
|
||||
cl_font = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO];
|
||||
cl_col_text = COL_MENUCONTENT_TEXT;
|
||||
cl_format_str = "%H:%M";
|
||||
cl_align = CC_ALIGN_VER_CENTER | CC_ALIGN_HOR_CENTER;
|
||||
cl_font_type = SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO;
|
||||
cl_font = &g_Font[cl_font_type];
|
||||
dyn_font_size = 0;
|
||||
|
||||
cl_thread = 0;
|
||||
cl_interval = 1;
|
||||
cl_col_text = COL_MENUCONTENT_TEXT;
|
||||
cl_format_str = "%H:%M";
|
||||
cl_align = CC_ALIGN_VER_CENTER | CC_ALIGN_HOR_CENTER;
|
||||
|
||||
cl_thread = 0;
|
||||
cl_interval = 1;
|
||||
}
|
||||
|
||||
CComponentsFrmClock::~CComponentsFrmClock()
|
||||
{
|
||||
cleanCCForm();
|
||||
if (activeClock)
|
||||
stopThread();
|
||||
}
|
||||
@@ -118,8 +119,8 @@ void CComponentsFrmClock::initCCLockItems()
|
||||
string s_time = cl_timestr;
|
||||
|
||||
//get minimal required height, width from raw text
|
||||
int min_text_w = cl_font->getRenderWidth(s_time, true);;
|
||||
int min_text_h = cl_font->getHeight();
|
||||
int min_text_w = (*getClockFont())->getRenderWidth(s_time, true);;
|
||||
int min_text_h = (*getClockFont())->getHeight();
|
||||
height = max(height, min_text_h);
|
||||
width = max(width, min_text_w);
|
||||
|
||||
@@ -150,7 +151,13 @@ void CComponentsFrmClock::initCCLockItems()
|
||||
}
|
||||
}
|
||||
|
||||
//modifie available lable items with current segment chars
|
||||
int w_tmp;
|
||||
int minSepWidth = (*getClockFont())->getRenderWidth(":", true);
|
||||
w_tmp = (*getClockFont())->getRenderWidth(".", true);
|
||||
if (w_tmp > minSepWidth)
|
||||
minSepWidth = w_tmp;
|
||||
|
||||
//modify available label items with current segment chars
|
||||
for (size_t i = 0; i < v_cc_items.size(); i++)
|
||||
{
|
||||
//v_cc_items are only available as CComponent-items here, so we must cast them before
|
||||
@@ -170,23 +177,35 @@ void CComponentsFrmClock::initCCLockItems()
|
||||
string stmp = s_time.substr(i, 1);
|
||||
|
||||
//get width of current segment
|
||||
int wtmp = cl_font->getRenderWidth(stmp, true);
|
||||
int wtmp;
|
||||
char c = stmp.at(0);
|
||||
switch (c) {
|
||||
case '0' ... '9':
|
||||
wtmp = (*getClockFont())->getMaxDigitWidth();
|
||||
break;
|
||||
case '.':
|
||||
case ':':
|
||||
wtmp = minSepWidth;
|
||||
break;
|
||||
default:
|
||||
wtmp = (*getClockFont())->getRenderWidth(stmp, true);
|
||||
}
|
||||
|
||||
//set size, text, color of current item
|
||||
lbl->setDimensionsAll(cl_x, cl_y, wtmp, cl_h);
|
||||
lbl->setTextColor(cl_col_text);
|
||||
lbl->setColorAll(col_frame, col_body, col_shadow);
|
||||
lbl->setText(stmp, CTextBox::CENTER, cl_font);
|
||||
lbl->setText(stmp, CTextBox::CENTER, *getClockFont());
|
||||
|
||||
//use matching height for digits for better vertical centerring into form
|
||||
CTextBox* ctb = lbl->getCTextBoxObject();
|
||||
if (ctb)
|
||||
ctb->setFontUseDigitHeight();
|
||||
|
||||
#if 0
|
||||
//ensure paint of text and label bg on changed text or painted form background
|
||||
bool force_txt_and_bg = (lbl->textChanged() || this->paint_bg);
|
||||
lbl->forceTextPaint(force_txt_and_bg);
|
||||
|
||||
#endif
|
||||
//set xpos of item
|
||||
cl_x += wtmp;
|
||||
|
||||
@@ -252,12 +271,7 @@ void* CComponentsFrmClock::initClockThread(void *arg)
|
||||
time_t count = time(0);
|
||||
//start loop for paint
|
||||
while(1) {
|
||||
sleep(clock->cl_interval);
|
||||
|
||||
if (clock->paintClock) {
|
||||
//refresh item property values
|
||||
clock->refresh();
|
||||
|
||||
//paint segements, but wihtout saved backgrounds
|
||||
clock->paint(CC_SAVE_SCREEN_NO);
|
||||
count = time(0);
|
||||
@@ -266,6 +280,7 @@ void* CComponentsFrmClock::initClockThread(void *arg)
|
||||
clock->cl_thread = 0;
|
||||
break;
|
||||
}
|
||||
sleep(clock->cl_interval);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -335,3 +350,24 @@ void CComponentsFrmClock::paint(bool do_save_bg)
|
||||
//paint form contents
|
||||
paintForm(do_save_bg);
|
||||
}
|
||||
|
||||
void CComponentsFrmClock::setClockFontSize(int size)
|
||||
{
|
||||
int tmp_w = 0;
|
||||
dyn_font_size = size;
|
||||
cl_font = CNeutrinoFonts::getInstance()->getDynFont(tmp_w, dyn_font_size, "", CNeutrinoFonts::FONT_STYLE_BOLD, CNeutrinoFonts::FONT_ID_INFOCLOCK);
|
||||
}
|
||||
|
||||
void CComponentsFrmClock::setClockFont(int font)
|
||||
{
|
||||
cl_font_type = font;
|
||||
cl_font = &g_Font[cl_font_type];
|
||||
}
|
||||
|
||||
Font** CComponentsFrmClock::getClockFont()
|
||||
{
|
||||
if (dyn_font_size == 0)
|
||||
cl_font = &g_Font[cl_font_type];
|
||||
return cl_font;
|
||||
|
||||
}
|
||||
|
@@ -62,7 +62,11 @@ class CComponentsFrmClock : public CComponentsForm
|
||||
bool activeClock;
|
||||
|
||||
///object: font render object
|
||||
Font *cl_font;
|
||||
Font **cl_font;
|
||||
|
||||
int cl_font_type;
|
||||
int dyn_font_size;
|
||||
|
||||
///text color
|
||||
int cl_col_text;
|
||||
///time format
|
||||
@@ -80,6 +84,9 @@ class CComponentsFrmClock : public CComponentsForm
|
||||
///initialize of general alignment of timestring segments within form area
|
||||
void initSegmentAlign(int* segment_width, int* segment_height);
|
||||
|
||||
///return pointer of font object
|
||||
inline Font** getClockFont();
|
||||
|
||||
public:
|
||||
CComponentsFrmClock();
|
||||
CComponentsFrmClock( const int x_pos, const int y_pos, const int w, const int h,
|
||||
@@ -87,8 +94,9 @@ class CComponentsFrmClock : public CComponentsForm
|
||||
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();
|
||||
|
||||
///set font type for segments
|
||||
virtual void setClockFont(Font *font){cl_font = font;};
|
||||
///set font type or font size for segments
|
||||
virtual void setClockFont(int font);
|
||||
virtual void setClockFontSize(int size);
|
||||
|
||||
///set text color
|
||||
virtual void setTextColor(fb_pixel_t color_text){ cl_col_text = color_text;};
|
||||
|
@@ -77,7 +77,6 @@ void CComponentsExtTextForm::initVarExtTextForm(const int x_pos, const int y_pos
|
||||
fb_pixel_t text_color,
|
||||
fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
|
||||
{
|
||||
initVarForm();
|
||||
cc_item_type = CC_ITEMTYPE_FRM_EXT_TEXT;
|
||||
x = x_pos;
|
||||
y = y_pos;
|
||||
@@ -135,7 +134,7 @@ void CComponentsExtTextForm::initText()
|
||||
{
|
||||
//initialize text object
|
||||
if (ccx_text_obj == NULL){
|
||||
ccx_text_obj = new CComponentsLabel();
|
||||
ccx_text_obj = new CComponentsText();
|
||||
ccx_text_obj->doPaintBg(false);
|
||||
}
|
||||
|
||||
|
@@ -65,9 +65,6 @@ CComponentsFooter::CComponentsFooter( const int x_pos, const int y_pos, const in
|
||||
|
||||
void CComponentsFooter::initVarFooter()
|
||||
{
|
||||
//CComponentsHeader
|
||||
initVarHeader();
|
||||
|
||||
cc_item_type = CC_ITEMTYPE_FOOTER;
|
||||
corner_rad = RADIUS_LARGE;
|
||||
corner_type = CORNER_BOTTOM;
|
||||
|
@@ -90,8 +90,6 @@ CComponentsHeader::CComponentsHeader( const int x_pos, const int y_pos, const in
|
||||
|
||||
void CComponentsHeader::initVarHeader()
|
||||
{
|
||||
//CComponentsForm
|
||||
initVarForm();
|
||||
cc_item_type = CC_ITEMTYPE_FRM_HEADER;
|
||||
col_body = COL_MENUHEAD_PLUS_0;
|
||||
corner_rad = RADIUS_LARGE,
|
||||
@@ -128,7 +126,6 @@ CComponentsHeader::~CComponentsHeader()
|
||||
printf("[~CComponentsHeader] [%s - %d] delete...\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
v_cch_btn.clear();
|
||||
cleanCCForm();
|
||||
}
|
||||
|
||||
void CComponentsHeader::setCaption(const std::string& caption, const int& align_mode)
|
||||
|
@@ -60,8 +60,6 @@ CComponentsIconForm::CComponentsIconForm(const int x_pos, const int y_pos, const
|
||||
|
||||
void CComponentsIconForm::initVarIconForm()
|
||||
{
|
||||
//CComponentsForm
|
||||
initVarForm();
|
||||
cc_item_type = CC_ITEMTYPE_FRM_ICONFORM;
|
||||
|
||||
//set default width and height to 0, this causes a dynamic adaptation of width and height of form
|
||||
|
@@ -39,10 +39,11 @@ using namespace std;
|
||||
CSignalBar::CSignalBar()
|
||||
{
|
||||
initVarSigBar();
|
||||
sb_name = "SIG";
|
||||
initSBItems();
|
||||
}
|
||||
|
||||
CSignalBar::CSignalBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref)
|
||||
CSignalBar::CSignalBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref, const string& sbname)
|
||||
{
|
||||
initVarSigBar();
|
||||
sb_frontend = frontend_ref;
|
||||
@@ -50,6 +51,7 @@ CSignalBar::CSignalBar(const int& xpos, const int& ypos, const int& w, const int
|
||||
y = ypos;
|
||||
width = w;
|
||||
height = h;
|
||||
sb_name = sbname;
|
||||
|
||||
initSBItems();
|
||||
}
|
||||
@@ -95,7 +97,6 @@ void CSignalBar::initSBItems()
|
||||
|
||||
void CSignalBar::initVarSigBar()
|
||||
{
|
||||
initVarForm();
|
||||
corner_rad = 0;
|
||||
corner_type = 0;
|
||||
append_h_offset = 2;
|
||||
@@ -107,6 +108,7 @@ void CSignalBar::initVarSigBar()
|
||||
dy_font = CNeutrinoFonts::getInstance();
|
||||
|
||||
sb_caption_color= COL_INFOBAR_TEXT;
|
||||
sb_val_mode = CTextBox::NO_AUTO_LINEBREAK | CTextBox::RIGHT;
|
||||
|
||||
sb_lastsig = 0;
|
||||
sb_signal = 0;
|
||||
@@ -115,7 +117,6 @@ void CSignalBar::initVarSigBar()
|
||||
sb_scale = NULL;
|
||||
sb_vlbl = NULL;
|
||||
sb_lbl = NULL;
|
||||
sb_name = "SIG";
|
||||
}
|
||||
|
||||
void CSignalBar::initSBarScale()
|
||||
@@ -144,7 +145,7 @@ void CSignalBar::initSBarValue()
|
||||
if (sb_vlbl == NULL){
|
||||
sb_vlbl = new CComponentsLabel();
|
||||
sb_vlbl->doPaintBg(false);
|
||||
sb_vlbl->setText("0%", CTextBox::NO_AUTO_LINEBREAK, sb_font);
|
||||
sb_vlbl->setText(" 0%", sb_val_mode, sb_font);
|
||||
}
|
||||
|
||||
//move and set dimensions
|
||||
@@ -217,7 +218,7 @@ void CSignalBar::paintScale()
|
||||
i_str << sig;
|
||||
string percent(i_str.str());
|
||||
percent += "%";
|
||||
sb_vlbl->setText(percent, CTextBox::NO_AUTO_LINEBREAK | CTextBox::CENTER, sb_font);
|
||||
sb_vlbl->setText(percent, sb_val_mode, sb_font);
|
||||
|
||||
//we must force paint backround, because of changing values
|
||||
sb_vlbl->doPaintBg(true);
|
||||
@@ -245,30 +246,6 @@ void CSignalBar::paint(bool do_save_bg)
|
||||
|
||||
|
||||
//*******************************************************************************************************************************
|
||||
CSignalNoiseRatioBar::CSignalNoiseRatioBar()
|
||||
{
|
||||
initVarSnrBar();
|
||||
initSBItems();
|
||||
}
|
||||
|
||||
CSignalNoiseRatioBar::CSignalNoiseRatioBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref)
|
||||
{
|
||||
initVarSnrBar();
|
||||
sb_frontend = frontend_ref;
|
||||
x = xpos;
|
||||
y = ypos;
|
||||
width = w;
|
||||
height = h;
|
||||
|
||||
initSBItems();
|
||||
}
|
||||
|
||||
void CSignalNoiseRatioBar::initVarSnrBar()
|
||||
{
|
||||
initVarSigBar();
|
||||
sb_name = "SNR";
|
||||
}
|
||||
|
||||
void CSignalNoiseRatioBar::Refresh()
|
||||
{
|
||||
//get current value from frontend
|
||||
@@ -306,7 +283,6 @@ CSignalBox::CSignalBox(const int& xpos, const int& ypos, const int& w, const int
|
||||
|
||||
void CSignalBox::initVarSigBox()
|
||||
{
|
||||
initVarForm();
|
||||
corner_rad = 0;
|
||||
|
||||
sbx_frontend = NULL;
|
||||
|
@@ -31,8 +31,7 @@
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
// #include <global.h>
|
||||
// #include <neutrino.h>
|
||||
|
||||
#include <gui/components/cc_frm.h>
|
||||
#include <gui/components/cc_item_progressbar.h>
|
||||
#include <gui/components/cc_item_text.h>
|
||||
@@ -82,6 +81,8 @@ class CSignalBar : public CComponentsForm
|
||||
int sb_vlbl_width;
|
||||
///property: width of caption
|
||||
int sb_lbl_width;
|
||||
///property: text mode of value, predefined type = CTextBox::NO_AUTO_LINEBREAK | CTextBox::CENTER
|
||||
int sb_val_mode;
|
||||
|
||||
///cache last assingned signal value
|
||||
int sb_lastsig;
|
||||
@@ -114,7 +115,7 @@ class CSignalBar : public CComponentsForm
|
||||
public:
|
||||
CSignalBar();
|
||||
///basic component class constructor for signal.
|
||||
CSignalBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref);
|
||||
CSignalBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref, const std::string& sb_name = "SIG");
|
||||
|
||||
///assigns the current used frontend, simplified a tuner object, see frontend_c.h
|
||||
virtual void setFrontEnd(CFrontend *frontend_ref){sb_frontend = frontend_ref;};
|
||||
@@ -131,8 +132,10 @@ class CSignalBar : public CComponentsForm
|
||||
|
||||
///returns the scale object, type = CProgressBar*
|
||||
virtual CProgressBar* getScaleObject(){return sb_scale;};
|
||||
///returns the caption object, type = CComponentsLabel*
|
||||
virtual CComponentsLabel* getLabelObject(){return sb_lbl;};
|
||||
///returns the value label object, type = CComponentsLabel*
|
||||
virtual CComponentsLabel* getLabelValObject(){return sb_vlbl;};
|
||||
///returns the name label object, type = CComponentsLabel*
|
||||
virtual CComponentsLabel* getLabelNameObject(){return sb_lbl;};
|
||||
|
||||
///paint this items
|
||||
virtual void paint(bool do_save_bg);
|
||||
@@ -151,14 +154,11 @@ class CSignalNoiseRatioBar : public CSignalBar
|
||||
///refresh current item properties, use this before paintScale().
|
||||
void Refresh();
|
||||
|
||||
protected:
|
||||
///initialize all needed basic attributes and objects
|
||||
void initVarSnrBar();
|
||||
|
||||
public:
|
||||
CSignalNoiseRatioBar();
|
||||
CSignalNoiseRatioBar(){};
|
||||
///basic component class constructor for signal noise ratio.
|
||||
CSignalNoiseRatioBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref);
|
||||
CSignalNoiseRatioBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref)
|
||||
: CSignalBar(xpos, ypos, w, h, frontend_ref, "SNR"){};
|
||||
};
|
||||
|
||||
/// Class CSignalBox() provides CSignalBar(), CSignalNoiseRatioBar() scales at once.
|
||||
@@ -168,7 +168,7 @@ additional of CSignalBar()- and CSignalNoiseRatioBar()-objects.
|
||||
|
||||
|
||||
To add a signalbox object to your code add this to a header file:
|
||||
#include <gui/widget/signalbars.h>
|
||||
#include <gui/components/cc_frm_signalbars.h>
|
||||
|
||||
class CSampleClass
|
||||
{
|
||||
@@ -278,7 +278,7 @@ class CSignalBox : public CComponentsForm
|
||||
///get caption color of signalbars, see also property 'sbx_caption_color'
|
||||
fb_pixel_t getTextColor(){return sbx_caption_color;};
|
||||
|
||||
///assigns the width of scale
|
||||
///assigns the width of scale in percent related of full width of signal box, the rest is reserved for text
|
||||
void setScaleWidth(const short & scale_width_percent){sbx_scale_w_percent = scale_width_percent;};
|
||||
|
||||
///paint items
|
||||
|
@@ -119,13 +119,11 @@ CComponentsWindow::~CComponentsWindow()
|
||||
#ifdef DEBUG_CC
|
||||
printf("[~CComponentsWindow] [%s - %d] delete...\n", __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
cleanCCForm();
|
||||
}
|
||||
|
||||
void CComponentsWindow::initVarWindow()
|
||||
{
|
||||
//CComponentsForm
|
||||
initVarForm();
|
||||
cc_item_type = CC_ITEMTYPE_FRM_WINDOW;
|
||||
|
||||
//using current screen settings for default dimensions
|
||||
@@ -254,3 +252,11 @@ void CComponentsWindow::initCCWItems()
|
||||
addCCItem(ccw_footer);
|
||||
}
|
||||
|
||||
void CComponentsWindow::paint(bool do_save_bg)
|
||||
{
|
||||
//prepare items before paint
|
||||
initCCWItems();
|
||||
|
||||
//paint form contents
|
||||
paintForm(do_save_bg);
|
||||
}
|
||||
|
@@ -52,7 +52,6 @@ CComponentsItem::CComponentsItem()
|
||||
void CComponentsItem::initVarItem()
|
||||
{
|
||||
//CComponents
|
||||
initVarBasic();
|
||||
cc_item_index = CC_NO_INDEX;
|
||||
cc_item_enabled = true;
|
||||
cc_item_selected = false;
|
||||
|
@@ -66,18 +66,12 @@ CComponentsInfoBox::CComponentsInfoBox(const int x_pos, const int y_pos, const i
|
||||
|
||||
CComponentsInfoBox::~CComponentsInfoBox()
|
||||
{
|
||||
hide();
|
||||
clearSavedScreen();
|
||||
clearCCText();
|
||||
delete pic;
|
||||
delete cctext;
|
||||
clear();
|
||||
}
|
||||
|
||||
void CComponentsInfoBox::initVarInfobox()
|
||||
{
|
||||
//CComponents, CComponentsItem, CComponentsText
|
||||
initVarText();
|
||||
cc_item_type = CC_ITEMTYPE_TEXT_INFOBOX;
|
||||
|
||||
//CComponentsInfoBox
|
||||
|
@@ -57,7 +57,6 @@ void CComponentsPicture::init( int x_pos, int y_pos, const string& image_name, c
|
||||
fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow)
|
||||
{
|
||||
//CComponents, CComponentsItem
|
||||
initVarItem();
|
||||
cc_item_type = CC_ITEMTYPE_PICTURE;
|
||||
|
||||
//CComponentsPicture
|
||||
|
@@ -76,7 +76,6 @@ CProgressBar::CProgressBar( const int x_pos, const int y_pos, const int w, const
|
||||
void CProgressBar::initVarProgressbar()
|
||||
{
|
||||
//CComponentsItem
|
||||
initVarItem();
|
||||
cc_item_type = CC_ITEMTYPE_PROGRESSBAR;
|
||||
|
||||
//CProgressBar
|
||||
@@ -150,7 +149,8 @@ void CProgressBar::paintSimple()
|
||||
{
|
||||
// progress value
|
||||
if (pb_active_width != pb_last_width){
|
||||
paintShapes(pb_x, pb_y, pb_active_width, pb_height, pb_active_col); // active bar
|
||||
if (pb_active_width)
|
||||
paintShapes(pb_x, pb_y, pb_active_width, pb_height, pb_active_col); // active bar
|
||||
paintShapes(pb_start_x_passive, pb_y, pb_passive_width, pb_height, pb_passive_col); // passive bar
|
||||
}
|
||||
|
||||
@@ -214,7 +214,8 @@ void CProgressBar::paintAdvanced()
|
||||
for (j = 0; j < hcnt; j++) {
|
||||
int sh_x = pb_x + i * itemw;
|
||||
int sh_y = py + j * itemh;
|
||||
paintShapes(sh_x, sh_y, pointx, pointy, color);
|
||||
//paintShapes(sh_x, sh_y, pointx, pointy, color);
|
||||
frameBuffer->paintBoxRel(sh_x, sh_y, pointx, pointy, color);
|
||||
}
|
||||
}
|
||||
step = yw - rd - 1;
|
||||
@@ -230,7 +231,8 @@ void CProgressBar::paintAdvanced()
|
||||
for (j = 0; j < hcnt; j++) {
|
||||
int sh_x = pb_x + i * itemw;
|
||||
int sh_y = py + j * itemh;
|
||||
paintShapes(sh_x, sh_y, pointx, pointy, color);
|
||||
//paintShapes(sh_x, sh_y, pointx, pointy, color);
|
||||
frameBuffer->paintBoxRel(sh_x, sh_y, pointx, pointy, color);
|
||||
}
|
||||
}
|
||||
off = diff;
|
||||
@@ -248,7 +250,8 @@ void CProgressBar::paintAdvanced()
|
||||
for (j = 0; j < hcnt; j++) {
|
||||
int sh_x = pb_x + i * itemw;
|
||||
int sh_y = py + j * itemh;
|
||||
paintShapes(sh_x, sh_y, pointx, pointy, color);
|
||||
//paintShapes(sh_x, sh_y, pointx, pointy, color);
|
||||
frameBuffer->paintBoxRel(sh_x, sh_y, pointx, pointy, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -256,7 +259,8 @@ void CProgressBar::paintAdvanced()
|
||||
for (j = 0; j < hcnt; j++) {
|
||||
int sh_x = pb_x + i * itemw;
|
||||
int sh_y = py + j * itemh;
|
||||
paintShapes(sh_x, sh_y, pointx, pointy, pb_passive_col); //fill passive
|
||||
//paintShapes(sh_x, sh_y, pointx, pointy, pb_passive_col); //fill passive
|
||||
frameBuffer->paintBoxRel(sh_x, sh_y, pointx, pointy, pb_passive_col);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -38,7 +38,6 @@ using namespace std;
|
||||
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)
|
||||
{
|
||||
//CComponentsItem
|
||||
initVarItem();
|
||||
cc_item_type = CC_ITEMTYPE_SHAPE_SQUARE;
|
||||
|
||||
x = x_pos;
|
||||
@@ -64,7 +63,6 @@ CComponentsShapeCircle::CComponentsShapeCircle( int x_pos, int y_pos, int diam,
|
||||
fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
|
||||
{
|
||||
//CComponents, CComponentsItem
|
||||
initVarItem();
|
||||
cc_item_type = CC_ITEMTYPE_SHAPE_CIRCLE;
|
||||
|
||||
//CComponents
|
||||
|
@@ -78,16 +78,13 @@ CComponentsText::CComponentsText( const int x_pos, const int y_pos, const int w,
|
||||
CComponentsText::~CComponentsText()
|
||||
{
|
||||
hide();
|
||||
clearSavedScreen();
|
||||
clearCCText();
|
||||
clear();
|
||||
}
|
||||
|
||||
|
||||
void CComponentsText::initVarText()
|
||||
{
|
||||
//CComponents, CComponentsItem
|
||||
initVarItem();
|
||||
cc_item_type = CC_ITEMTYPE_TEXT;
|
||||
|
||||
//CComponentsText
|
||||
|
@@ -43,7 +43,6 @@ using namespace std;
|
||||
CComponentsPIP::CComponentsPIP( const int x_pos, const int y_pos, const int percent, bool has_shadow)
|
||||
{
|
||||
//CComponents, CComponentsItem
|
||||
initVarItem();
|
||||
cc_item_type = CC_ITEMTYPE_PIP;
|
||||
|
||||
//CComponentsPIP
|
||||
@@ -68,8 +67,6 @@ CComponentsPIP::~CComponentsPIP()
|
||||
{
|
||||
hide();
|
||||
videoDecoder->Pig(-1, -1, -1, -1);
|
||||
clearSavedScreen();
|
||||
clear();
|
||||
}
|
||||
|
||||
void CComponentsPIP::paint(bool do_save_bg)
|
||||
|
@@ -30,6 +30,8 @@
|
||||
#include <system/localize.h>
|
||||
#include <driver/fontrenderer.h>
|
||||
|
||||
// #define DEBUG_CC
|
||||
|
||||
///cc item types
|
||||
typedef enum
|
||||
{
|
||||
|
@@ -356,7 +356,7 @@ void CComponentsItemBox::calSizeOfElements()
|
||||
digit_h = font_text->getDigitHeight();
|
||||
digit_offset = font_text->getDigitOffset();
|
||||
v_element_data[i].height = digit_h + (int)((float)digit_offset*1.5);
|
||||
// v_element_data[i].width = font_text->getRenderWidth(widest_number)*4 + font->getRenderWidth(":");
|
||||
// v_element_data[i].width = font_text->getMaxDigitWidth() + font->getRenderWidth(":");
|
||||
v_element_data[i].width = font_text->getRenderWidth(timestr);
|
||||
v_element_data[i].element = timestr;
|
||||
}
|
||||
|
Reference in New Issue
Block a user