mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-09-02 10:21:04 +02:00
Merge remote-tracking branch 'tuxbox/master'
Origin commit data
------------------
Commit: a409047714
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2017-01-22 (Sun, 22 Jan 2017)
This commit is contained in:
@@ -668,13 +668,18 @@ void CCDraw::kill(const fb_pixel_t& bg_color, const int& corner_radius, const in
|
||||
int r = v_fbdata[i].r;
|
||||
if (corner_radius > -1)
|
||||
r = corner_radius;
|
||||
frameBuffer->paintBoxRel(v_fbdata[i].x,
|
||||
v_fbdata[i].y,
|
||||
v_fbdata[i].dx,
|
||||
v_fbdata[i].dy,
|
||||
bg_color,
|
||||
r,
|
||||
corner_type);
|
||||
|
||||
if (v_fbdata[i].dx > 0 && v_fbdata[i].dy > 0){
|
||||
frameBuffer->paintBoxRel(v_fbdata[i].x,
|
||||
v_fbdata[i].y,
|
||||
v_fbdata[i].dx,
|
||||
v_fbdata[i].dy,
|
||||
bg_color,
|
||||
r,
|
||||
corner_type);
|
||||
}else
|
||||
dprintf(DEBUG_DEBUG, "\033[33m[CCDraw][%s - %d], WARNING! render with bad dimensions [dx = %d dy = %d]\033[0m\n", __func__, __LINE__, v_fbdata[i].dx, v_fbdata[i].dy );
|
||||
|
||||
if (v_fbdata[i].frame_thickness)
|
||||
frameBuffer->paintBoxFrame(v_fbdata[i].x,
|
||||
v_fbdata[i].y,
|
||||
@@ -733,18 +738,21 @@ void CCDraw::paintTrigger()
|
||||
hide();
|
||||
}
|
||||
|
||||
bool CCDraw::paintBlink(CComponentsTimer* Timer)
|
||||
{
|
||||
if (Timer){
|
||||
Timer->OnTimer.connect(cc_draw_trigger_slot);
|
||||
return Timer->isRun();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CCDraw::paintBlink(const int& interval, bool is_nano)
|
||||
{
|
||||
if (cc_draw_timer == NULL){
|
||||
if (cc_draw_timer == NULL)
|
||||
cc_draw_timer = new CComponentsTimer(interval, is_nano);
|
||||
if (cc_draw_timer->OnTimer.empty()){
|
||||
cc_draw_timer->OnTimer.connect(cc_draw_trigger_slot);
|
||||
}
|
||||
}
|
||||
if (cc_draw_timer)
|
||||
return cc_draw_timer->isRun();
|
||||
|
||||
return false;
|
||||
return paintBlink(cc_draw_timer);
|
||||
}
|
||||
|
||||
bool CCDraw::cancelBlink(bool keep_on_screen)
|
||||
|
@@ -312,6 +312,17 @@ class CCDraw : public COSDFader, public CComponentsSignals
|
||||
///paint item, same like paint(CC_SAVE_SCREEN_YES) but without any argument
|
||||
virtual void paint1(){paint(CC_SAVE_SCREEN_YES);}
|
||||
|
||||
/**paint item with blink effect
|
||||
* This should work with all cc item types.
|
||||
*
|
||||
* @return bool returns true if effect is successful started
|
||||
*
|
||||
* @param[in] CComponentsTimer* pointer to timer object, Note: This object must be created and distroy outside
|
||||
* of this methode.
|
||||
* @see overloaded version of paintBlink()
|
||||
*/
|
||||
virtual bool paintBlink(CComponentsTimer* Timer);
|
||||
|
||||
/**paint item with blink effect
|
||||
* This should work with all cc item types.
|
||||
*
|
||||
|
@@ -375,9 +375,9 @@ void CComponentsForm::paintCCItems()
|
||||
|
||||
//init and handle scrollbar
|
||||
getPageCount();
|
||||
int y_sb = this_y+1;
|
||||
int y_sb = this_y;
|
||||
int x_sb = this_x + width - w_sb;
|
||||
int h_sb = height-2;
|
||||
int h_sb = height;
|
||||
if (sb == NULL){
|
||||
sb = new CComponentsScrollBar(x_sb, y_sb, w_sb, h_sb);
|
||||
}else{
|
||||
@@ -636,9 +636,9 @@ void CComponentsForm::ScrollPage(int direction, bool do_paint)
|
||||
int target_page_id = (int)page_count - 1;
|
||||
int target_page = (int)cur_page;
|
||||
|
||||
if (direction == SCROLL_P_DOWN)
|
||||
if (direction == SCROLL_P_UP)
|
||||
target_page = target_page+1 > target_page_id ? 0 : target_page+1;
|
||||
else if (direction == SCROLL_P_UP)
|
||||
else if (direction == SCROLL_P_DOWN)
|
||||
target_page = target_page-1 < 0 ? target_page_id : target_page-1;
|
||||
|
||||
if (do_paint)
|
||||
|
@@ -33,7 +33,6 @@
|
||||
#include <system/debug.h>
|
||||
#include "cc_frm_button.h"
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
CComponentsButton::CComponentsButton( const int& x_pos, const int& y_pos, const int& w, const int& h,
|
||||
@@ -44,7 +43,7 @@ CComponentsButton::CComponentsButton( const int& x_pos, const int& y_pos, const
|
||||
int shadow_mode,
|
||||
fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
|
||||
{
|
||||
cc_btn_capt_locale = NONEXISTANT_LOCALE;
|
||||
cc_btn_text_locale = NONEXISTANT_LOCALE;
|
||||
initVarButton(x_pos, y_pos, w, h, caption, icon_name, parent, selected, enabled, shadow_mode, color_frame, color_body, color_shadow);
|
||||
}
|
||||
|
||||
@@ -56,8 +55,8 @@ CComponentsButton::CComponentsButton( const int& x_pos, const int& y_pos, const
|
||||
int shadow_mode,
|
||||
fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
|
||||
{
|
||||
cc_btn_capt_locale = caption_locale;
|
||||
initVarButton(x_pos, y_pos, w, h, g_Locale->getText(cc_btn_capt_locale), icon_name, parent, selected, enabled, shadow_mode, color_frame, color_body, color_shadow);
|
||||
cc_btn_text_locale = caption_locale;
|
||||
initVarButton(x_pos, y_pos, w, h, g_Locale->getText(cc_btn_text_locale), icon_name, parent, selected, enabled, shadow_mode, color_frame, color_body, color_shadow);
|
||||
}
|
||||
|
||||
CComponentsButton::CComponentsButton( const int& x_pos, const int& y_pos, const int& w, const int& h,
|
||||
@@ -81,8 +80,8 @@ CComponentsButton::CComponentsButton( const int& x_pos, const int& y_pos, const
|
||||
fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
|
||||
{
|
||||
string _icon_name = icon_name == NULL ? "" : string(icon_name);
|
||||
cc_btn_capt_locale = caption_locale;
|
||||
initVarButton(x_pos, y_pos, w, h, g_Locale->getText(cc_btn_capt_locale), _icon_name, parent, selected, enabled, shadow_mode, color_frame, color_body, color_shadow);
|
||||
cc_btn_text_locale = caption_locale;
|
||||
initVarButton(x_pos, y_pos, w, h, g_Locale->getText(cc_btn_text_locale), _icon_name, parent, selected, enabled, shadow_mode, color_frame, color_body, color_shadow);
|
||||
}
|
||||
|
||||
void CComponentsButton::initVarButton( const int& x_pos, const int& y_pos, const int& w, const int& h,
|
||||
@@ -116,14 +115,14 @@ void CComponentsButton::initVarButton( const int& x_pos, const int& y_pos, const
|
||||
append_y_offset = 0;
|
||||
corner_rad = RADIUS_SMALL;
|
||||
|
||||
cc_btn_capt_col = cc_body_gradient_enable ? COL_BUTTON_TEXT_ENABLED : COL_MENUFOOT_TEXT;
|
||||
cc_btn_capt_disable_col = cc_body_gradient_enable ? COL_BUTTON_TEXT_DISABLED : COL_MENUCONTENTINACTIVE_TEXT;
|
||||
cc_btn_text_col = cc_body_gradient_enable ? COL_BUTTON_TEXT_ENABLED : COL_MENUFOOT_TEXT;
|
||||
cc_btn_text_disable_col = cc_body_gradient_enable ? COL_BUTTON_TEXT_DISABLED : COL_MENUCONTENTINACTIVE_TEXT;
|
||||
cc_btn_icon_obj = NULL;
|
||||
cc_btn_capt_obj = NULL;
|
||||
cc_btn_text_obj = NULL;
|
||||
cc_btn_dy_font = CNeutrinoFonts::getInstance();
|
||||
cc_btn_font = NULL;
|
||||
cc_btn_icon = icon_name;
|
||||
cc_btn_capt = caption;
|
||||
cc_btn_text = caption;
|
||||
cc_directKey = CRCInput::RC_nokey;
|
||||
cc_directKeyAlt = cc_directKey;
|
||||
cc_btn_result = -1;
|
||||
@@ -172,30 +171,35 @@ void CComponentsButton::initIcon()
|
||||
void CComponentsButton::initCaption()
|
||||
{
|
||||
//init label as caption object and add to container
|
||||
if (!cc_btn_capt.empty()){
|
||||
if (cc_btn_capt_obj == NULL){
|
||||
cc_btn_capt_obj = new CComponentsLabel();
|
||||
cc_btn_capt_obj->doPaintBg(false);
|
||||
cc_btn_capt_obj->doPaintTextBoxBg(false);
|
||||
cc_btn_capt_obj->enableTboxSaveScreen(cc_txt_save_screen);
|
||||
addCCItem(cc_btn_capt_obj);
|
||||
if (!cc_btn_text.empty()){
|
||||
if (cc_btn_text_obj == NULL){
|
||||
cc_btn_text_obj = new CComponentsLabel();
|
||||
cc_btn_text_obj->doPaintBg(false);
|
||||
cc_btn_text_obj->doPaintTextBoxBg(false);
|
||||
cc_btn_text_obj->enableTboxSaveScreen(cc_txt_save_screen);
|
||||
addCCItem(cc_btn_text_obj);
|
||||
}
|
||||
}else{
|
||||
if (cc_btn_capt_obj){
|
||||
delete cc_btn_capt_obj;
|
||||
cc_btn_capt_obj = NULL;
|
||||
if (cc_btn_text_obj){
|
||||
delete cc_btn_text_obj;
|
||||
cc_btn_text_obj = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
//set basic properties
|
||||
int w_frame = fr_thickness;
|
||||
if (cc_btn_capt_obj){
|
||||
int reduce = 2*w_frame;
|
||||
if (cc_btn_text_obj){
|
||||
//position and size
|
||||
int x_cap = w_frame;
|
||||
x_cap += cc_btn_icon_obj ? cc_btn_icon_obj->getWidth() : 0;
|
||||
|
||||
int w_cap = width - w_frame - append_x_offset - x_cap - w_frame;
|
||||
int h_cap = (height*85/100) - 2*w_frame;
|
||||
/* use system defined font as default if not defined */
|
||||
if (cc_btn_font == NULL)
|
||||
cc_btn_font = g_Font[SNeutrinoSettings::FONT_TYPE_BUTTON_TEXT];
|
||||
|
||||
int w_cap = min(width - append_x_offset - x_cap - reduce, cc_btn_font->getRenderWidth(cc_btn_text));
|
||||
int h_cap = min(height - reduce, cc_btn_font->getHeight());
|
||||
/*NOTE:
|
||||
paint of centered text in y direction without y_offset
|
||||
looks unlovely displaced in y direction especially besides small icons and inside small areas,
|
||||
@@ -204,42 +208,41 @@ void CComponentsButton::initCaption()
|
||||
*/
|
||||
int y_cap = height/2 - h_cap/2;
|
||||
|
||||
cc_btn_capt_obj->setDimensionsAll(x_cap, y_cap, w_cap, h_cap);
|
||||
cc_btn_text_obj->setDimensionsAll(x_cap, y_cap, w_cap, h_cap);
|
||||
|
||||
//text and font
|
||||
Font* def_font = *cc_btn_dy_font->getDynFont(w_cap, h_cap, cc_btn_capt);
|
||||
if (cc_btn_font == NULL){
|
||||
/* use dynamic font as default font if no font defined */
|
||||
cc_btn_font = def_font;
|
||||
}else{
|
||||
/* if button dimension too small, use dynamic font as default font size, this ignores possible defined font
|
||||
* Otherwise definied font will be used.
|
||||
*/
|
||||
if (cc_btn_font->getHeight() > h_cap){
|
||||
cc_btn_font = def_font;
|
||||
}
|
||||
}
|
||||
/* If button dimension too small, use dynamic font, this ignores possible defined font
|
||||
* Otherwise definied font will be used. Button dimensions are calculated from parent container (e.g. footer...).
|
||||
* These dimensions must be enough to display complete content like possible icon and without truncated text.
|
||||
*/
|
||||
Font *tmp_font = cc_btn_font;
|
||||
if ((tmp_font->getHeight()-reduce) > (height-reduce) && (tmp_font->getRenderWidth(cc_btn_text)-reduce) > width-reduce)
|
||||
tmp_font = *cc_btn_dy_font->getDynFont(w_cap, h_cap, cc_btn_text);
|
||||
if ((cc_btn_font->getHeight()-reduce) > (height-reduce))
|
||||
tmp_font = *cc_btn_dy_font->getDynFont(w_cap, h_cap, cc_btn_text);
|
||||
|
||||
cc_btn_capt_obj->setText(cc_btn_capt, CTextBox::NO_AUTO_LINEBREAK, cc_btn_font);
|
||||
cc_btn_capt_obj->forceTextPaint(); //here required;
|
||||
cc_btn_capt_obj->getCTextBoxObject()->setTextBorderWidth(0,0);
|
||||
cc_btn_font = tmp_font;
|
||||
|
||||
cc_btn_text_obj->setText(cc_btn_text, CTextBox::NO_AUTO_LINEBREAK, cc_btn_font);
|
||||
cc_btn_text_obj->forceTextPaint(); //here required;
|
||||
cc_btn_text_obj->getCTextBoxObject()->setTextBorderWidth(0,0);
|
||||
|
||||
//set color
|
||||
cc_btn_capt_obj->setTextColor(this->cc_item_enabled ? cc_btn_capt_col : cc_btn_capt_disable_col);
|
||||
cc_btn_text_obj->setTextColor(this->cc_item_enabled ? cc_btn_text_col : cc_btn_text_disable_col);
|
||||
|
||||
//corner of text item
|
||||
cc_btn_capt_obj->setCorner(corner_rad-w_frame, corner_type);
|
||||
cc_btn_text_obj->setCorner(corner_rad-w_frame, corner_type);
|
||||
}
|
||||
|
||||
//handle common position of icon and text inside container required for alignment
|
||||
int w_required = w_frame + append_x_offset;
|
||||
w_required += cc_btn_icon_obj ? cc_btn_icon_obj->getWidth() + append_x_offset : 0;
|
||||
w_required += cc_btn_font ? cc_btn_font->getRenderWidth(cc_btn_capt) : 0;
|
||||
w_required += cc_btn_font ? cc_btn_font->getRenderWidth(cc_btn_text) : 0;
|
||||
w_required += append_x_offset + w_frame;
|
||||
|
||||
//dynamic width
|
||||
if (w_required > width){
|
||||
dprintf(DEBUG_INFO, "[CComponentsButton] [%s - %d] width of button (%s) will be changed: defined width=%d, required width=%d\n", __func__, __LINE__, cc_btn_capt.c_str(), width, w_required);
|
||||
dprintf(DEBUG_INFO, "[CComponentsButton] [%s - %d] width of button (%s) will be changed: defined width=%d, required width=%d\n", __func__, __LINE__, cc_btn_text.c_str(), width, w_required);
|
||||
width = max(w_required, width);
|
||||
}
|
||||
|
||||
@@ -256,22 +259,22 @@ void CComponentsButton::initCaption()
|
||||
int y_icon = height/2 - cc_btn_icon_obj->getHeight()/2;
|
||||
cc_btn_icon_obj->setYPos(y_icon);
|
||||
}
|
||||
if (cc_btn_capt_obj){
|
||||
cc_btn_capt_obj->setXPos(x_icon + w_icon + append_x_offset);
|
||||
cc_btn_capt_obj->setWidth(width - cc_btn_capt_obj->getXPos());
|
||||
if (cc_btn_text_obj){
|
||||
cc_btn_text_obj->setXPos(x_icon + w_icon + append_x_offset);
|
||||
cc_btn_text_obj->setWidth(width - cc_btn_text_obj->getXPos());
|
||||
}
|
||||
}
|
||||
|
||||
void CComponentsButton::setCaption(const std::string& text)
|
||||
{
|
||||
cc_btn_capt = text;
|
||||
cc_btn_text = text;
|
||||
initCCBtnItems();
|
||||
}
|
||||
|
||||
void CComponentsButton::setCaption(const neutrino_locale_t locale_text)
|
||||
{
|
||||
cc_btn_capt_locale = locale_text;
|
||||
setCaption(g_Locale->getText(cc_btn_capt_locale));
|
||||
cc_btn_text_locale = locale_text;
|
||||
setCaption(g_Locale->getText(cc_btn_text_locale));
|
||||
}
|
||||
|
||||
void CComponentsButton::initCCBtnItems()
|
||||
|
@@ -50,7 +50,7 @@ class CComponentsButton : public CComponentsFrmChain, public CCTextScreen
|
||||
///object: picture object
|
||||
CComponentsPictureScalable *cc_btn_icon_obj;
|
||||
///object: label object
|
||||
CComponentsLabel *cc_btn_capt_obj;
|
||||
CComponentsLabel *cc_btn_text_obj;
|
||||
|
||||
///initialize all required attributes and objects
|
||||
void initVarButton( const int& x_pos, const int& y_pos, const int& w, const int& h,
|
||||
@@ -63,9 +63,9 @@ class CComponentsButton : public CComponentsFrmChain, public CCTextScreen
|
||||
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;
|
||||
std::string cc_btn_text;
|
||||
///property: button text as locale, see also setCaption() and getCaptionLocale()
|
||||
neutrino_locale_t cc_btn_capt_locale;
|
||||
neutrino_locale_t cc_btn_text_locale;
|
||||
|
||||
///property: icon name, only icons supported, to find in gui/widget/icons.h
|
||||
std::string cc_btn_icon;
|
||||
@@ -80,9 +80,9 @@ class CComponentsButton : public CComponentsFrmChain, public CCTextScreen
|
||||
int cc_btn_alias;
|
||||
|
||||
///property: text color
|
||||
fb_pixel_t cc_btn_capt_col;
|
||||
fb_pixel_t cc_btn_text_col;
|
||||
///property: text color for disabled button
|
||||
fb_pixel_t cc_btn_capt_disable_col;
|
||||
fb_pixel_t cc_btn_text_disable_col;
|
||||
///object: text font
|
||||
Font* cc_btn_font;
|
||||
///object: dynamic font object handler
|
||||
@@ -135,7 +135,7 @@ class CComponentsButton : public CComponentsFrmChain, public CCTextScreen
|
||||
fb_pixel_t color_frame = COL_SHADOW_PLUS_0, fb_pixel_t color_body = COL_BUTTON_BODY, fb_pixel_t color_shadow = COL_SHADOW_PLUS_0);
|
||||
|
||||
///set text color
|
||||
inline virtual void setButtonTextColor(fb_pixel_t caption_color){cc_btn_capt_col = caption_color;};
|
||||
inline virtual void setButtonTextColor(fb_pixel_t caption_color){cc_btn_text_col = caption_color;};
|
||||
|
||||
/**Member to modify background behavior of embeded caption object.
|
||||
* @param[in] mode
|
||||
@@ -164,9 +164,9 @@ class CComponentsButton : public CComponentsFrmChain, public CCTextScreen
|
||||
virtual void setCaption(const neutrino_locale_t locale_text);
|
||||
|
||||
///get caption, type as std::string
|
||||
inline virtual std::string getCaptionString(){return cc_btn_capt;};
|
||||
inline virtual std::string getCaptionString(){return cc_btn_text;};
|
||||
///get loacalized caption id, type = neutrino_locale_t
|
||||
inline virtual neutrino_locale_t getCaptionLocale(){return cc_btn_capt_locale;};
|
||||
inline virtual neutrino_locale_t getCaptionLocale(){return cc_btn_text_locale;};
|
||||
|
||||
///property: set font for label caption, parameter as font object, value NULL causes usaage of dynamic font
|
||||
virtual void setButtonFont(Font* font){cc_btn_font = font; initCCBtnItems();};
|
||||
|
@@ -75,11 +75,8 @@ CComponentsFrmClock::CComponentsFrmClock( const int& x_pos,
|
||||
//init default font
|
||||
cl_font = font;
|
||||
cl_font_style = font_style;
|
||||
if (cl_font == NULL){
|
||||
int dx = 0;
|
||||
int dy = 30;
|
||||
setClockFont(*CNeutrinoFonts::getInstance()->getDynFont(dx, dy, cl_format_str, cl_font_style));
|
||||
}
|
||||
if (cl_font == NULL)
|
||||
initClockFont(0, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight());
|
||||
|
||||
//init general clock dimensions
|
||||
height = cl_font->getHeight();
|
||||
@@ -114,6 +111,11 @@ CComponentsFrmClock::~CComponentsFrmClock()
|
||||
delete cl_timer;
|
||||
}
|
||||
|
||||
void CComponentsFrmClock::initClockFont(int dx, int dy)
|
||||
{
|
||||
setClockFont(*CNeutrinoFonts::getInstance()->getDynFont(dx, dy, cl_format_str, cl_font_style));
|
||||
}
|
||||
|
||||
|
||||
void CComponentsFrmClock::initTimeString()
|
||||
{
|
||||
@@ -260,12 +262,12 @@ void CComponentsFrmClock::initCCLockItems()
|
||||
lbl->doPaintTextBoxBg(paint_bg);
|
||||
bool save_txt_screen = cc_txt_save_screen || (!paint_bg || cc_body_gradient_enable);
|
||||
lbl->enableTboxSaveScreen(save_txt_screen);
|
||||
|
||||
#if 0
|
||||
//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);
|
||||
@@ -380,14 +382,12 @@ void CComponentsFrmClock::paint(bool do_save_bg)
|
||||
|
||||
void CComponentsFrmClock::setClockFont(Font *font, const int& style)
|
||||
{
|
||||
if (cl_font != font)
|
||||
cl_font = font;
|
||||
|
||||
if (style != -1)
|
||||
cl_font_style = style;
|
||||
|
||||
// setHeight(cl_font->getHeight());
|
||||
// setWidth(cl_font->getRenderWidth(cl_format_str));
|
||||
if (cl_font != font || (cl_font != font)){
|
||||
if (cl_font != font)
|
||||
cl_font = font;
|
||||
if (style != -1)
|
||||
cl_font_style = style;
|
||||
}
|
||||
initCCLockItems();
|
||||
}
|
||||
|
||||
|
@@ -88,9 +88,8 @@ class CComponentsFrmClock : public CComponentsForm, public CCTextScreen
|
||||
bool stopClock();
|
||||
///switch between primary and secondary format
|
||||
void toggleFormat();
|
||||
|
||||
///return pointer of font object
|
||||
Font* getClockFont();
|
||||
///init internal font
|
||||
void initClockFont(int dx, int dy);
|
||||
|
||||
public:
|
||||
|
||||
@@ -121,6 +120,9 @@ class CComponentsFrmClock : public CComponentsForm, public CCTextScreen
|
||||
*/
|
||||
void setClockFont(Font * font, const int& style = -1);
|
||||
|
||||
///return pointer of font object
|
||||
Font* getClockFont();
|
||||
|
||||
///set text color
|
||||
virtual void setTextColor(fb_pixel_t color_text){ cl_col_text = color_text;}
|
||||
|
||||
@@ -132,6 +134,8 @@ class CComponentsFrmClock : public CComponentsForm, public CCTextScreen
|
||||
///use string expession: "%H:%M" = 12:22, "%H:%M:%S" = 12:22:12
|
||||
///set current time format string, 1st parameter set the default format, 2nd parameter sets an alternatively format for use as blink effect
|
||||
virtual void setClockFormat(const char* prformat_str, const char* secformat_str = NULL);
|
||||
///get current time format string,
|
||||
std::string getClockFormat(){return cl_format;}
|
||||
|
||||
///start and paint ticking clock
|
||||
virtual bool Start();
|
||||
|
@@ -68,6 +68,12 @@ void CComponentsFooter::initVarFooter( const int& x_pos, const int& y_pos, const
|
||||
//init footer width
|
||||
width = w == 0 ? frameBuffer->getScreenWidth(true) : w;
|
||||
|
||||
//init default fonts
|
||||
initDefaultFonts();
|
||||
|
||||
//init default button text font
|
||||
ccf_btn_font = g_Font[SNeutrinoSettings::FONT_TYPE_BUTTON_TEXT];
|
||||
|
||||
//init footer height
|
||||
initCaptionFont();
|
||||
height = max(h, cch_font->getHeight());
|
||||
@@ -88,7 +94,6 @@ void CComponentsFooter::initVarFooter( const int& x_pos, const int& y_pos, const
|
||||
corner_type = CORNER_BOTTOM;
|
||||
|
||||
ccf_enable_button_bg = false /*g_settings.theme.Button_gradient*/; //TODO: not implemented at the moment
|
||||
ccf_btn_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_FOOT];
|
||||
chain = NULL;
|
||||
|
||||
addContextButton(buttons);
|
||||
@@ -132,11 +137,14 @@ void CComponentsFooter::setButtonLabels(const struct button_label_s * const cont
|
||||
* With this container we can work inside footer as primary container (in this context '=this') and the parent for the button label container (chain object).
|
||||
* Button label container (chain object) itself is concurrent to the parent object for button objects.
|
||||
*/
|
||||
int dist = height/2-cch_offset;
|
||||
int h_chain = ccf_btn_font->getHeight() > height+dist ? height-dist : ccf_btn_font->getHeight()+dist;
|
||||
int x_chain = width/2 - w_chain/2;
|
||||
int y_chain = height/2 - h_chain/2;
|
||||
if (cch_icon_obj)
|
||||
x_chain = cch_offset+cch_icon_obj->getWidth()+cch_offset;
|
||||
if (chain == NULL){
|
||||
chain = new CComponentsFrmChain(x_chain, 0, w_chain, height, 0, CC_DIR_X, this, CC_SHADOW_OFF, COL_MENUCONTENT_PLUS_6, col_body);
|
||||
chain = new CComponentsFrmChain(x_chain, y_chain, w_chain, h_chain, 0, CC_DIR_X, this, CC_SHADOW_OFF, COL_MENUCONTENT_PLUS_6, col_body);
|
||||
chain->setAppendOffset(0, 0);
|
||||
chain->setCorner(this->corner_rad, this->corner_type);
|
||||
chain->doPaintBg(false);
|
||||
@@ -167,7 +175,7 @@ void CComponentsFooter::setButtonLabels(const struct button_label_s * const cont
|
||||
* with default width to chain object.
|
||||
*/
|
||||
vector<CComponentsItem*> v_btns;
|
||||
int h_btn = /*(ccf_enable_button_bg ? */(height*85/100)-2*fr_thickness-OFFSET_INNER_SMALL/* : height)*/-ccf_button_shadow_width;
|
||||
int h_btn = /*(ccf_enable_button_bg ? */chain->getHeight()-2*fr_thickness/*-OFFSET_INNER_SMALL*//* : height)*/-ccf_button_shadow_width;
|
||||
for (size_t i= 0; i< label_count; i++){
|
||||
string txt = content[i].text;
|
||||
string icon_name = string(content[i].button);
|
||||
@@ -421,8 +429,15 @@ void CComponentsFooter::enableButtonShadow(int mode, const int& shadow_width, bo
|
||||
if (chain){
|
||||
for(size_t i=0; i<chain->size(); i++){
|
||||
chain->getCCItem(i)->enableShadow(ccf_enable_button_shadow, ccf_button_shadow_width, ccf_button_shadow_force_paint);
|
||||
int y_btn = ccf_enable_button_shadow == CC_SHADOW_OFF ? CC_CENTERED : chain->getHeight()/2 - chain->getCCItem(i)->getHeight()/2 - ccf_button_shadow_width;
|
||||
//int y_btn = ccf_enable_button_shadow == CC_SHADOW_OFF ? CC_CENTERED : chain->getHeight()/2 - chain->getCCItem(i)->getHeight()/2 - ccf_button_shadow_width;
|
||||
int y_btn = chain->getHeight()/2 - chain->getCCItem(i)->getHeight()/2;
|
||||
chain->getCCItem(i)->setYPos(y_btn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CComponentsFooter::initDefaultFonts()
|
||||
{
|
||||
l_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE];
|
||||
s_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_FOOT];
|
||||
}
|
||||
|
@@ -84,6 +84,9 @@ class CComponentsFooter : public CComponentsHeader
|
||||
///property: set font for label caption, see also setButtonFont()
|
||||
Font* ccf_btn_font;
|
||||
|
||||
///init default fonts for size modes
|
||||
virtual void initDefaultFonts();
|
||||
|
||||
///container for button objects
|
||||
CComponentsFrmChain *chain;
|
||||
|
||||
@@ -201,7 +204,7 @@ class CComponentsFooter : public CComponentsHeader
|
||||
const struct button_label * const content,
|
||||
const int& label_width = 0,
|
||||
const int& context_buttons = 0,
|
||||
Font* font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_FOOT],
|
||||
Font* font = g_Font[SNeutrinoSettings::FONT_TYPE_BUTTON_TEXT],
|
||||
bool do_save_bg = CC_SAVE_SCREEN_NO
|
||||
);
|
||||
|
||||
|
@@ -93,12 +93,12 @@ void CComponentsHeader::initVarHeader( const int& x_pos, const int& y_pos, const
|
||||
|
||||
//init header width
|
||||
width = width_old = w == 0 ? frameBuffer->getScreenWidth(true) : w;
|
||||
height = height_old = h;
|
||||
|
||||
//init header default height
|
||||
height = height_old = max(h, g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight());
|
||||
|
||||
cch_size_mode = CC_HEADER_SIZE_LARGE;
|
||||
initCaptionFont(); //sets cch_font and calculate height if required;
|
||||
cch_font = NULL;
|
||||
initDefaultFonts();
|
||||
cch_size_mode = CC_HEADER_SIZE_LARGE;
|
||||
CNeutrinoApp::getInstance()->OnAfterSetupFonts.connect(sigc::mem_fun(this, &CComponentsHeader::resetFont));
|
||||
|
||||
shadow = shadow_mode;
|
||||
col_frame = col_frame_old = color_frame;
|
||||
@@ -160,27 +160,36 @@ void CComponentsHeader::setCaption(neutrino_locale_t caption_locale, const int&
|
||||
|
||||
void CComponentsHeader::setCaptionFont(Font* font)
|
||||
{
|
||||
initCaptionFont(font); //cch_font = font
|
||||
cch_font = font;
|
||||
}
|
||||
|
||||
void CComponentsHeader::initCaptionFont(Font* font)
|
||||
void CComponentsHeader::resetFont()
|
||||
{
|
||||
Font *l_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE];
|
||||
Font *s_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU];
|
||||
if (cch_font){
|
||||
dprintf(DEBUG_DEBUG, "\033[33m[CComponentsHeader][%s - %d] reset header font \033[0m\n", __func__, __LINE__);
|
||||
cch_font = NULL;
|
||||
}
|
||||
initDefaultFonts();
|
||||
}
|
||||
|
||||
if (font == NULL){
|
||||
void CComponentsHeader::initDefaultFonts()
|
||||
{
|
||||
l_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE];
|
||||
s_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU];
|
||||
}
|
||||
|
||||
void CComponentsHeader::initCaptionFont()
|
||||
{
|
||||
if (cch_font == NULL){
|
||||
cch_font = (cch_size_mode == CC_HEADER_SIZE_LARGE? l_font : s_font);
|
||||
|
||||
//select matching height
|
||||
if (cch_size_mode == CC_HEADER_SIZE_LARGE)
|
||||
height = std::max(height, l_font->getHeight());
|
||||
else
|
||||
height = std::min(height, s_font->getHeight());
|
||||
}
|
||||
else{
|
||||
cch_font = font;
|
||||
else
|
||||
height = std::max(height, cch_font->getHeight());
|
||||
}
|
||||
}
|
||||
|
||||
void CComponentsHeader::setIcon(const char* icon_name)
|
||||
@@ -227,11 +236,10 @@ void CComponentsHeader::initIcon()
|
||||
cch_icon_obj->doPaintBg(false);
|
||||
|
||||
//set corner mode of icon item
|
||||
int cc_icon_corner_type = corner_type;
|
||||
int cc_icon_corner_type = CORNER_LEFT;
|
||||
if (corner_type == CORNER_TOP_LEFT || corner_type == CORNER_TOP)
|
||||
cc_icon_corner_type = CORNER_TOP_LEFT;
|
||||
else
|
||||
cc_icon_corner_type = CORNER_LEFT;
|
||||
|
||||
cch_icon_obj->setCorner(corner_rad-fr_thickness, cc_icon_corner_type);
|
||||
|
||||
//global set width of icon object
|
||||
@@ -275,14 +283,14 @@ void CComponentsHeader::addContextButton(const int& buttons)
|
||||
addContextButton(NEUTRINO_ICON_BUTTON_OKAY);
|
||||
if (buttons & CC_BTN_MUTE)
|
||||
addContextButton(NEUTRINO_ICON_BUTTON_MUTE);
|
||||
if (buttons & CC_BTN_TOP)
|
||||
addContextButton(NEUTRINO_ICON_BUTTON_TOP);
|
||||
if (buttons & CC_BTN_UP)
|
||||
addContextButton(NEUTRINO_ICON_BUTTON_UP);
|
||||
if (buttons & CC_BTN_DOWN)
|
||||
addContextButton(NEUTRINO_ICON_BUTTON_DOWN);
|
||||
if (buttons & CC_BTN_RIGHT)
|
||||
addContextButton(NEUTRINO_ICON_BUTTON_RIGHT);
|
||||
if (buttons & CC_BTN_LEFT)
|
||||
addContextButton(NEUTRINO_ICON_BUTTON_LEFT);
|
||||
if (buttons & CC_BTN_RIGHT)
|
||||
addContextButton(NEUTRINO_ICON_BUTTON_RIGHT);
|
||||
if (buttons & CC_BTN_FORWARD)
|
||||
addContextButton(NEUTRINO_ICON_BUTTON_FORWARD);
|
||||
if (buttons & CC_BTN_BACKWARD)
|
||||
@@ -331,11 +339,10 @@ void CComponentsHeader::initButtons()
|
||||
cch_btn_obj->addIcon(v_cch_btn);
|
||||
|
||||
//set corner mode of button item
|
||||
int cc_btn_corner_type = corner_type;
|
||||
int cc_btn_corner_type = CORNER_RIGHT;
|
||||
if (corner_type == CORNER_TOP_RIGHT || corner_type == CORNER_TOP)
|
||||
cc_btn_corner_type = CORNER_TOP_RIGHT;
|
||||
else
|
||||
cc_btn_corner_type = CORNER_RIGHT;
|
||||
|
||||
cch_btn_obj->setCorner(corner_rad-fr_thickness, cc_btn_corner_type);
|
||||
|
||||
//global adapt height
|
||||
@@ -408,11 +415,10 @@ void CComponentsHeader::initClock()
|
||||
cch_cl_obj->setClockFormat(cch_cl_format, cch_cl_sec_format);
|
||||
|
||||
//set corner mode of button item
|
||||
int cc_btn_corner_type = corner_type;
|
||||
int cc_btn_corner_type = CORNER_RIGHT;
|
||||
if (corner_type == CORNER_TOP_RIGHT || corner_type == CORNER_TOP)
|
||||
cc_btn_corner_type = CORNER_TOP_RIGHT;
|
||||
else
|
||||
cc_btn_corner_type = CORNER_RIGHT;
|
||||
|
||||
cch_cl_obj->setCorner(corner_rad-fr_thickness, cc_btn_corner_type);
|
||||
|
||||
//global adapt height
|
||||
@@ -513,12 +519,12 @@ void CComponentsHeader::initCaption()
|
||||
|
||||
void CComponentsHeader::initCCItems()
|
||||
{
|
||||
//set basic properties
|
||||
Init(x, y, width, height, col_frame, col_body, col_shadow);
|
||||
|
||||
//set size
|
||||
initCaptionFont();
|
||||
|
||||
//set basic properties
|
||||
Init(x, y, width, height, col_frame, col_body, col_shadow);
|
||||
|
||||
//init icon
|
||||
initIcon();
|
||||
|
||||
|
@@ -67,7 +67,9 @@ class CComponentsHeader : public CComponentsForm, public CCTextScreen
|
||||
///property: caption text color, see also setCaptionColor()
|
||||
fb_pixel_t cch_col_text;
|
||||
///property: caption font, see also setCaptionFont()
|
||||
Font* cch_font;
|
||||
Font* cch_font, *l_font, *s_font;
|
||||
///reset font
|
||||
void resetFont();
|
||||
|
||||
///property: internal y-position for all items
|
||||
int cch_items_y;
|
||||
@@ -99,7 +101,9 @@ class CComponentsHeader : public CComponentsForm, public CCTextScreen
|
||||
bool cch_cl_enable_run;
|
||||
|
||||
///init font object and recalculates height if required
|
||||
void initCaptionFont(Font* font = NULL);
|
||||
void initCaptionFont();
|
||||
///init default fonts for size modes
|
||||
virtual void initDefaultFonts();
|
||||
///sub: init icon object
|
||||
void initIcon();
|
||||
///sub: init caption object
|
||||
@@ -136,13 +140,44 @@ class CComponentsHeader : public CComponentsForm, public CCTextScreen
|
||||
virtual void setCaption(neutrino_locale_t caption_locale, const int& align_mode = CTextBox::NO_AUTO_LINEBREAK, const fb_pixel_t& text_color = COL_MENUHEAD_TEXT);
|
||||
|
||||
///set alignment of caption within header, possible paramters are CTextBox::CENTER, CTextBox::NO_AUTO_LINEBREAK
|
||||
virtual void setCaptionAlignment(const int& align_mode){cch_caption_align = align_mode;};
|
||||
///set text font object for caption
|
||||
virtual void setCaptionAlignment(const int& align_mode){cch_caption_align = align_mode;}
|
||||
|
||||
/**Set text font for title.
|
||||
* Internal default font is g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE] and
|
||||
* default height of header object is calculated from this font type.
|
||||
* Height can be changed with modes by setSizeMode(), setHeight() or constructor.
|
||||
* @return void
|
||||
*
|
||||
* @param[in] font exepts font object, type Font*
|
||||
* @see getCaptionFont(), setSizeMode(),
|
||||
* setCaptionColor(),
|
||||
* setCaptionAlignment(),
|
||||
* setCaption()
|
||||
*/
|
||||
virtual void setCaptionFont(Font* font);
|
||||
///returns font object of title caption
|
||||
virtual Font* getCaptionFont(){return cch_font;};
|
||||
virtual Font* getCaptionFont(){return cch_font;}
|
||||
///set text color for caption
|
||||
virtual void setCaptionColor(fb_pixel_t text_color){cch_col_text = text_color;};
|
||||
virtual void setCaptionColor(fb_pixel_t text_color){cch_col_text = text_color;}
|
||||
|
||||
enum
|
||||
{
|
||||
CC_HEADER_SIZE_LARGE = 0,
|
||||
CC_HEADER_SIZE_SMALL = 1
|
||||
};
|
||||
/**Set size mode of header.
|
||||
* These modes are using fonts SNeutrinoSettings::FONT_TYPE_MENU_TITLE for large mode (default)
|
||||
* and SNeutrinoSettings::FONT_TYPE_MENU for small mode to set required height.
|
||||
* If other size wanted then use set setCaptionFont() and setHeight()
|
||||
* @return void
|
||||
*
|
||||
* @param[in] size_mode exepts type int (enums)
|
||||
* possible modes are:
|
||||
* CC_HEADER_SIZE_LARGE
|
||||
* CC_HEADER_SIZE_SMALL
|
||||
* @see setCaption(), setHeight()
|
||||
*/
|
||||
virtual void setSizeMode(const int& size_mode){cch_size_mode = size_mode; initCCItems();}
|
||||
|
||||
///set offset between items
|
||||
virtual void setOffset(const int offset){cch_offset = offset;};
|
||||
@@ -182,10 +217,10 @@ class CComponentsHeader : public CComponentsForm, public CCTextScreen
|
||||
CC_BTN_MUTE_ZAP_INACTIVE = 0x200,
|
||||
CC_BTN_OKAY = 0x400,
|
||||
CC_BTN_MUTE = 0x800,
|
||||
CC_BTN_TOP = 0x1000,
|
||||
CC_BTN_UP = 0x1000,
|
||||
CC_BTN_DOWN = 0x2000,
|
||||
CC_BTN_RIGHT = 0x4000,
|
||||
CC_BTN_LEFT = 0x8000,
|
||||
CC_BTN_LEFT = 0x4000,
|
||||
CC_BTN_RIGHT = 0x8000,
|
||||
CC_BTN_FORWARD = 0x10000,
|
||||
CC_BTN_BACKWARD = 0x20000,
|
||||
CC_BTN_PAUSE = 0x40000,
|
||||
@@ -198,14 +233,6 @@ class CComponentsHeader : public CComponentsForm, public CCTextScreen
|
||||
///set offset between icons within context button object
|
||||
virtual void setButtonsSpace(const int buttons_space){cch_buttons_space = buttons_space;}
|
||||
|
||||
enum
|
||||
{
|
||||
CC_HEADER_SIZE_LARGE = 0,
|
||||
CC_HEADER_SIZE_SMALL = 1
|
||||
};
|
||||
///set size of header, possible values are CC_HEADER_SIZE_LARGE, CC_HEADER_SIZE_SMALL
|
||||
virtual void setSizeMode(const int& size_mode){cch_size_mode = size_mode; initCCItems();}
|
||||
|
||||
///init all items within header object
|
||||
virtual void initCCItems();
|
||||
///returns the text object
|
||||
|
@@ -25,7 +25,6 @@
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <global.h>
|
||||
#include <neutrino.h>
|
||||
#include "cc_frm_scrollbar.h"
|
||||
#include "system/debug.h"
|
||||
@@ -76,13 +75,16 @@ void CComponentsScrollBar::initVarSbForm(const int& count)
|
||||
cc_item_type = CC_ITEMTYPE_FRM_SCROLLBAR;
|
||||
fr_thickness = 0;
|
||||
|
||||
append_x_offset = 0;
|
||||
append_y_offset = 2;
|
||||
append_x_offset = OFFSET_INNER_MIN;
|
||||
append_y_offset = OFFSET_INNER_MIN;
|
||||
|
||||
sb_up_obj = sb_down_obj = NULL;
|
||||
sb_up_obj = NULL;
|
||||
sb_down_obj = NULL;
|
||||
sb_segments_obj = NULL;
|
||||
|
||||
sb_up_icon = frameBuffer->getIconPath(NEUTRINO_ICON_BUTTON_TOP) ;
|
||||
setCorner(RADIUS_MIN, CORNER_ALL);
|
||||
|
||||
sb_up_icon = frameBuffer->getIconPath(NEUTRINO_ICON_BUTTON_UP) ;
|
||||
sb_down_icon = frameBuffer->getIconPath(NEUTRINO_ICON_BUTTON_DOWN);
|
||||
|
||||
sb_segments_count = count;
|
||||
@@ -110,40 +112,38 @@ void CComponentsScrollBar::initTopNaviIcon()
|
||||
{
|
||||
//initialize icon object
|
||||
if (sb_up_obj == NULL){
|
||||
sb_up_obj = new CComponentsPicture(CC_CENTERED, fr_thickness, sb_up_icon, this);
|
||||
sb_up_obj = new CComponentsPicture(CC_CENTERED, fr_thickness, width-2*fr_thickness, width-2*fr_thickness, sb_up_icon, this);
|
||||
sb_up_obj->SetTransparent(CFrameBuffer::TM_BLACK);
|
||||
sb_up_obj->doPaintBg(false);
|
||||
}
|
||||
sb_up_obj->setWidth(width-2*fr_thickness);
|
||||
}
|
||||
|
||||
void CComponentsScrollBar::initBottomNaviIcon()
|
||||
{
|
||||
//initialize icon object
|
||||
if (sb_down_obj == NULL){
|
||||
sb_down_obj = new CComponentsPicture(CC_CENTERED, CC_APPEND, sb_down_icon, this);
|
||||
sb_down_obj = new CComponentsPicture(CC_CENTERED, height - width-2*fr_thickness, width-2*fr_thickness, 0, sb_down_icon, this);
|
||||
sb_down_obj->SetTransparent(CFrameBuffer::TM_BLACK);
|
||||
sb_down_obj->doPaintBg(false);
|
||||
}
|
||||
sb_down_obj->setWidth(width-2*fr_thickness);
|
||||
}
|
||||
|
||||
void CComponentsScrollBar::initSegments()
|
||||
{
|
||||
//init dimensions for segments
|
||||
int w_seg = width - 4*fr_thickness;
|
||||
//never read int h_seg = height - (sb_segments_count-1)*append_y_offset;
|
||||
int w_seg = width - 2*fr_thickness - 2*append_x_offset;
|
||||
if (w_seg < 0)
|
||||
w_seg = 0;
|
||||
|
||||
//calculate height of segment container
|
||||
int h_seg_obj = height - 2*sb_up_obj->getHeight() - 3*append_y_offset;
|
||||
if(h_seg_obj < 0)
|
||||
int h_seg_obj = height - 2*fr_thickness - 2*sb_up_obj->getHeight() - 2*append_y_offset;
|
||||
if (h_seg_obj < 0)
|
||||
h_seg_obj = 0;
|
||||
|
||||
//init segment container
|
||||
if (sb_segments_obj == NULL){
|
||||
sb_segments_obj = new CComponentsFrmChain(CC_CENTERED, CC_APPEND, w_seg, h_seg_obj, NULL, CC_DIR_Y, this, false);
|
||||
sb_segments_obj->setFrameThickness(0/*,0*/);
|
||||
sb_segments_obj->setAppendOffset(0, 3);
|
||||
sb_segments_obj->setFrameThickness(0);
|
||||
}else
|
||||
sb_segments_obj->setDimensionsAll(CC_CENTERED, CC_APPEND, w_seg, h_seg_obj);
|
||||
|
||||
@@ -154,9 +154,9 @@ void CComponentsScrollBar::initSegments()
|
||||
sb_segments_obj->clear();
|
||||
|
||||
//set y position of 1st segment and set height of segments
|
||||
int y_seg = 1+ append_y_offset;
|
||||
int y_seg = append_y_offset;
|
||||
int h_seg = sb_segments_obj->getHeight()/sb_segments_count - append_y_offset;
|
||||
if(h_seg < 0)
|
||||
if (h_seg < 0)
|
||||
h_seg = 0;
|
||||
|
||||
//create and add segments to segment container
|
||||
@@ -189,3 +189,20 @@ void CComponentsScrollBar::initSegments()
|
||||
sb_segments_obj->front()->setCorner(RADIUS_MIN, CORNER_TOP);
|
||||
sb_segments_obj->back()->setCorner(RADIUS_MIN, CORNER_BOTTOM);
|
||||
}
|
||||
|
||||
|
||||
void paintScrollBar( const int &x_pos,
|
||||
const int &y_pos,
|
||||
const int &w,
|
||||
const int &h,
|
||||
const int& count,
|
||||
const int& current_num,
|
||||
int shadow_mode,
|
||||
fb_pixel_t color_frame,
|
||||
fb_pixel_t color_body,
|
||||
fb_pixel_t color_shadow)
|
||||
{
|
||||
CComponentsScrollBar scrollbar(x_pos, y_pos, w, h, count, NULL, shadow_mode, color_frame, color_body, color_shadow);
|
||||
scrollbar.setMarkID(current_num);
|
||||
scrollbar.paint0();
|
||||
}
|
||||
|
@@ -24,6 +24,8 @@
|
||||
#ifndef __CC_FORM_SCROLLBAR_H__
|
||||
#define __CC_FORM_SCROLLBAR_H__
|
||||
|
||||
#include <global.h>
|
||||
|
||||
#include "cc_frm_chain.h"
|
||||
#include "cc_item_picture.h"
|
||||
|
||||
@@ -60,24 +62,95 @@ class CComponentsScrollBar : public CComponentsFrmChain
|
||||
void initVarSbForm( const int& count);
|
||||
|
||||
public:
|
||||
CComponentsScrollBar( const int &x_pos, const int &y_pos, const int &w = 15, const int &h = 40,
|
||||
const int& count = 1,
|
||||
/**Class constructor to generate individual scrollbar objects
|
||||
*
|
||||
* @param[in] x_pos exepts type int, x position on screen
|
||||
* @param[in] x_pos exepts type int, y position on screen modes are:
|
||||
* @param[in] w exepts type int, width of scrollbar object
|
||||
* @param[in] h exepts type int, height of scrollbar object
|
||||
* @param[in] count optional, exepts type int, count of pages, default 1
|
||||
*
|
||||
* usual paraemters:
|
||||
* @param[in] parent optional, exepts type pointer to a parent CComponentsForm object, default NULL
|
||||
* @param[in] shadow_mode optional, exepts type int defined by shadow mode enums, default CC_SHADOW_OFF
|
||||
* @param[in] color_frame optional, exepts type fb_pixel_t, default COL_SCROLLBAR_ACTIVE_PLUS_0
|
||||
* @param[in] color_body optional, exepts type fb_pixel_t, default COL_SCROLLBAR_PASSIVE_PLUS_0
|
||||
* @param[in] color_shadow optional, exepts type fb_pixel_t, default COL_SHADOW_PLUS_0
|
||||
*/
|
||||
CComponentsScrollBar( const int &x_pos,
|
||||
const int &y_pos,
|
||||
const int &w = SCROLLBAR_WIDTH,
|
||||
const int &h = 0,
|
||||
const int& count = 1,
|
||||
CComponentsForm *parent = NULL,
|
||||
int shadow_mode = CC_SHADOW_OFF,
|
||||
fb_pixel_t color_frame = COL_SCROLLBAR_ACTIVE_PLUS_0,
|
||||
fb_pixel_t color_body = COL_SCROLLBAR_PASSIVE_PLUS_0,
|
||||
int shadow_mode = CC_SHADOW_OFF,
|
||||
fb_pixel_t color_frame = COL_SCROLLBAR_ACTIVE_PLUS_0,
|
||||
fb_pixel_t color_body = COL_SCROLLBAR_PASSIVE_PLUS_0,
|
||||
fb_pixel_t color_shadow = COL_SHADOW_PLUS_0);
|
||||
// ~CComponentsScrollBar(); //inherited from CComponentsForm
|
||||
|
||||
///set marked segment, 1st = 0, 2nd = 1 ...
|
||||
void setMarkID(const int& mark_id){sb_mark_id = mark_id; initSegments();};
|
||||
///get current assigned marked id
|
||||
/**Set current page number
|
||||
* @return void
|
||||
*
|
||||
* @param[in] mark_id exepts type int, this sets the current selected page number.
|
||||
*
|
||||
* @see getMarkID()
|
||||
*/
|
||||
void setMarkID(const int& mark_id){sb_mark_id = mark_id; initSegments();}
|
||||
|
||||
/**Gets current page number
|
||||
* @return int
|
||||
*
|
||||
* @see setMarkID()
|
||||
*/
|
||||
int getMarkID(){return sb_mark_id;};
|
||||
|
||||
///Sets count of scrollbar segments and is similar e.g. page count. Each segment is assigned to an id. Starting with id 0...n see also setMarkID(), getMarkID().
|
||||
/**Sets count of possible scrollbar segments (e.g. page count) and
|
||||
* current selected page at once .
|
||||
* Each segment is assigned to a page number. Starting with id 0...n
|
||||
* @return void
|
||||
*
|
||||
* @param[in] segment_count exepts type int, sets the current count of pages.
|
||||
* @param[in] mark_id optional, exepts type int, sets the current selected page number, default = 0
|
||||
* @see also setMarkID()
|
||||
* getMarkID()
|
||||
*/
|
||||
void setSegmentCount(const int& segment_count, const int& mark_id = 0);
|
||||
///Get count of current scrollbar segments
|
||||
|
||||
/**Get count of current scrollbar segments (page count)
|
||||
* @return int
|
||||
*
|
||||
* @see setSegmentCount()
|
||||
*/
|
||||
int getSegmentCount(){return sb_segments_count;}
|
||||
};
|
||||
|
||||
/**Small and easy to apply scrollbar paint methode without expilcit object declaration
|
||||
* @return void
|
||||
*
|
||||
* @param[in] x_pos exepts type int, x position on screen
|
||||
* @param[in] x_pos exepts type int, y position on screen modes are:
|
||||
* @param[in] w exepts type int, width of scrollbar object
|
||||
* @param[in] h exepts type int, height of scrollbar object
|
||||
* @param[in] count exepts type int, count of pages, default 1
|
||||
* @param[in] current_num exepts type int, current selected page, default 0
|
||||
*
|
||||
* usual paraemters:
|
||||
* @param[in] parent optional, exepts type pointer to a parent CComponentsForm object, default NULL
|
||||
* @param[in] shadow_mode optional, exepts type int defined by shadow mode enums, default CC_SHADOW_OFF
|
||||
* @param[in] color_frame optional, exepts type fb_pixel_t, default COL_SCROLLBAR_ACTIVE_PLUS_0
|
||||
* @param[in] color_body optional, exepts type fb_pixel_t, default COL_SCROLLBAR_PASSIVE_PLUS_0
|
||||
* @param[in] color_shadow optional, exepts type fb_pixel_t, default COL_SHADOW_PLUS_0
|
||||
*/
|
||||
void paintScrollBar( const int &x_pos,
|
||||
const int &y_pos,
|
||||
const int &w,
|
||||
const int &h,
|
||||
const int& count,
|
||||
const int& current_num,
|
||||
int shadow_mode = CC_SHADOW_OFF,
|
||||
fb_pixel_t color_frame = COL_SCROLLBAR_ACTIVE_PLUS_0,
|
||||
fb_pixel_t color_body = COL_SCROLLBAR_PASSIVE_PLUS_0,
|
||||
fb_pixel_t color_shadow = COL_SHADOW_PLUS_0);
|
||||
|
||||
#endif
|
||||
|
@@ -145,7 +145,7 @@ void CComponentsWindow::initVarWindow( const int& x_pos, const int& y_pos, const
|
||||
ccw_right_sidebar= NULL;
|
||||
ccw_body = NULL;
|
||||
ccw_footer = NULL;
|
||||
ccw_button_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_FOOT];
|
||||
ccw_button_font = g_Font[SNeutrinoSettings::FONT_TYPE_BUTTON_TEXT];
|
||||
|
||||
ccw_buttons = 0; //no header buttons
|
||||
ccw_show_footer = true;
|
||||
|
@@ -72,8 +72,8 @@ CProgressBar::CProgressBar( const int x_pos,
|
||||
pb_active_col = active_col;
|
||||
pb_passive_col = passive_col;
|
||||
|
||||
pb_design = &g_settings.progressbar_design;
|
||||
pb_gradient = &g_settings.progressbar_gradient;
|
||||
pb_design = &g_settings.theme.progressbar_design;
|
||||
pb_gradient = &g_settings.theme.progressbar_gradient;
|
||||
pb_type = PB_REDLEFT;
|
||||
|
||||
pb_last_width = -1;
|
||||
@@ -441,7 +441,7 @@ void CProgressBar::paintProgress(bool do_save_bg)
|
||||
return;
|
||||
}
|
||||
if (pb_type == PB_TIMESCALE)
|
||||
setRgb(g_settings.progressbar_timescale_red, g_settings.progressbar_timescale_green, g_settings.progressbar_timescale_yellow);
|
||||
setRgb(g_settings.theme.progressbar_timescale_red, g_settings.theme.progressbar_timescale_green, g_settings.theme.progressbar_timescale_yellow);
|
||||
|
||||
if (!pb_red && !pb_yellow && !pb_green)
|
||||
pb_green = 1;
|
||||
@@ -463,7 +463,7 @@ void CProgressBar::paintProgress(bool do_save_bg)
|
||||
paintInit(do_save_bg);
|
||||
|
||||
//progress
|
||||
bool pb_invert = (pb_type == PB_REDRIGHT) || ((pb_type == PB_TIMESCALE) && g_settings.progressbar_timescale_invert);
|
||||
bool pb_invert = (pb_type == PB_REDRIGHT) || ((pb_type == PB_TIMESCALE) && g_settings.theme.progressbar_timescale_invert);
|
||||
|
||||
if (cc_allow_paint){
|
||||
if (!is_painted || (pb_active_width != pb_last_width)) {
|
||||
|
@@ -152,10 +152,10 @@ class CProgressBar : public CComponentsItem
|
||||
|
||||
void setType(pb_type_t type);
|
||||
|
||||
//set design (overides g_settings.progressbar_design)
|
||||
//set design (overides g_settings.theme.progressbar_design)
|
||||
void setDesign(int &design) { pb_design = &design; }
|
||||
|
||||
//set gradient (overides g_settings.progressbar_gradient)
|
||||
//set gradient (overides g_settings.theme.progressbar_gradient)
|
||||
void setGradient(int &gradient) { pb_gradient = &gradient; }
|
||||
};
|
||||
|
||||
|
@@ -92,10 +92,7 @@ void CComponentsText::initVarText( const int x_pos, const int y_pos, const int w
|
||||
width = width_old = w;
|
||||
height = height_old = h;
|
||||
|
||||
/* we need a minimal borderwith of 1px because the edge-smoothing
|
||||
(or fontrenderer?) otherwise will paint single pixels outside the
|
||||
defined area. e.g. 'j' is leaving such residues */
|
||||
ct_text_Hborder = 1;
|
||||
ct_text_Hborder = 0;
|
||||
ct_text_Vborder = 0;
|
||||
|
||||
shadow = shadow_mode;
|
||||
|
@@ -98,7 +98,8 @@ void CComponentsTimer::initThread()
|
||||
if (res != 0){
|
||||
dprintf(DEBUG_NORMAL,"\033[33m[CComponentsTimer] [%s - %d] ERROR! pthread_create\033[0m\n", __func__, __LINE__);
|
||||
return;
|
||||
}
|
||||
}else
|
||||
dprintf(DEBUG_DEBUG,"\033[33m[CComponentsTimer] [%s - %d] started thread ID:%ld \033[0m\n", __func__, __LINE__, pthread_self());
|
||||
|
||||
if (res == 0)
|
||||
CNeutrinoApp::getInstance()->OnBeforeRestart.connect(sl_stop_timer);
|
||||
@@ -107,22 +108,22 @@ void CComponentsTimer::initThread()
|
||||
|
||||
void CComponentsTimer::stopThread()
|
||||
{
|
||||
if(tm_thread) {
|
||||
//ensure disconnecting possible slots
|
||||
while (!sl_stop_timer.empty())
|
||||
sl_stop_timer.disconnect();
|
||||
|
||||
while(tm_thread) {
|
||||
int thres = pthread_cancel(tm_thread);
|
||||
if (thres != 0)
|
||||
dprintf(DEBUG_NORMAL,"\033[33m[CComponentsTimer] [%s - %d] ERROR! pthread_cancel\033[0m\n", __func__, __LINE__);
|
||||
dprintf(DEBUG_NORMAL,"\033[33m[CComponentsTimer] [%s - %d] ERROR! pthread_cancel, error [%d] %s\033[0m\n", __func__, __LINE__, thres, strerror(thres));
|
||||
|
||||
thres = pthread_join(tm_thread, NULL);
|
||||
void* res;
|
||||
thres = pthread_join(tm_thread, &res);
|
||||
|
||||
if (thres != 0)
|
||||
dprintf(DEBUG_NORMAL, "\033[33m[CComponentsTimer] [%s - %d] ERROR! pthread_join\033[0m\n", __func__, __LINE__);
|
||||
|
||||
if (thres == 0){
|
||||
if (res != PTHREAD_CANCELED)
|
||||
dprintf(DEBUG_NORMAL, "\033[33m[CComponentsTimer] [%s - %d] ERROR! pthread_join, thread ID:%ld, error [%d] %s\033[0m\n", __func__, __LINE__, pthread_self(), thres, strerror(thres));
|
||||
else
|
||||
tm_thread = 0;
|
||||
//ensure disconnect of unused slot
|
||||
while (!sl_stop_timer.empty())
|
||||
sl_stop_timer.disconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user