mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-30 08:51:04 +02:00
Merge branch 'ni/tuxbox' into ni/mp/tuxbox
Conflicts:
src/gui/components/cc_frm_footer.cpp
Origin commit data
------------------
Branch: ni/coolstream
Commit: c68ae57571
Author: vanhofen <vanhofen@gmx.de>
Date: 2017-06-15 (Thu, 15 Jun 2017)
------------------
This commit was generated by Migit
This commit is contained in:
@@ -35,7 +35,7 @@ using namespace std;
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
//sub class CComponentsFooter inherit from CComponentsHeader
|
||||
CComponentsFooter::CComponentsFooter(CComponentsForm* parent)
|
||||
CComponentsFooter::CComponentsFooter(CComponentsForm* parent):CCButtonSelect()
|
||||
{
|
||||
//CComponentsFooter
|
||||
initVarFooter(1, 1, 0, 0, 0, parent, CC_SHADOW_OFF, COL_FRAME_PLUS_0, COL_MENUFOOT_PLUS_0, COL_SHADOW_PLUS_0);
|
||||
@@ -47,7 +47,7 @@ CComponentsFooter::CComponentsFooter( const int& x_pos, const int& y_pos, const
|
||||
int shadow_mode,
|
||||
fb_pixel_t color_frame,
|
||||
fb_pixel_t color_body,
|
||||
fb_pixel_t color_shadow )
|
||||
fb_pixel_t color_shadow ):CCButtonSelect()
|
||||
{
|
||||
//CComponentsFooter
|
||||
initVarFooter(x_pos, y_pos, w, h, buttons, parent, shadow_mode, color_frame, color_body, color_shadow);
|
||||
@@ -95,7 +95,6 @@ void CComponentsFooter::initVarFooter( const int& x_pos, const int& y_pos, const
|
||||
corner_type = CORNER_BOTTOM;
|
||||
|
||||
ccf_enable_button_bg = false /*g_settings.theme.Button_gradient*/; //TODO: not implemented at the moment
|
||||
chain = NULL;
|
||||
|
||||
addContextButton(buttons);
|
||||
initCCItems();
|
||||
@@ -108,8 +107,8 @@ void CComponentsFooter::initVarFooter( const int& x_pos, const int& y_pos, const
|
||||
void CComponentsFooter::setButtonLabels(const struct button_label_cc * const content, const size_t& label_count, const int& chain_width, const int& label_width)
|
||||
{
|
||||
/* clean up before init*/
|
||||
if (chain)
|
||||
chain->clear();
|
||||
if (btn_container)
|
||||
btn_container->clear();
|
||||
|
||||
if (label_count == 0)
|
||||
return;
|
||||
@@ -150,11 +149,11 @@ void CComponentsFooter::setButtonLabels(const struct button_label_cc * const con
|
||||
int y_chain = height/2 - h_chain/2;
|
||||
if (cch_icon_obj)
|
||||
x_chain = cch_offset+cch_icon_obj->getWidth()+cch_offset;
|
||||
if (chain == NULL){
|
||||
chain = new CComponentsFrmChain(x_chain, y_chain, w_chain, h_chain, 0, CC_DIR_X, this, CC_SHADOW_OFF, COL_MENUCONTENT_PLUS_6, col_body);
|
||||
chain->setAppendOffset(0, 0);
|
||||
chain->setCorner(this->corner_rad, this->corner_type);
|
||||
chain->doPaintBg(false);
|
||||
if (btn_container == NULL){
|
||||
btn_container = new CComponentsFrmChain(x_chain, y_chain, w_chain, h_chain, 0, CC_DIR_X, this, CC_SHADOW_OFF, COL_MENUCONTENT_PLUS_6, col_body);
|
||||
btn_container->setAppendOffset(0, 0);
|
||||
btn_container->setCorner(this->corner_rad, this->corner_type);
|
||||
btn_container->doPaintBg(false);
|
||||
}
|
||||
|
||||
/* Calculate usable width of button labels inside button object container
|
||||
@@ -166,11 +165,11 @@ void CComponentsFooter::setButtonLabels(const struct button_label_cc * const con
|
||||
* button objects itself.
|
||||
*/
|
||||
int w_offset = int((label_count-1)*cch_offset);
|
||||
int w_btn = chain->getWidth()/label_count - w_offset;
|
||||
int w_btn = btn_container->getWidth()/label_count - w_offset;
|
||||
if (label_width){
|
||||
int w_label = label_width;
|
||||
int w_defined = int(label_width*label_count);
|
||||
int w_max = chain->getWidth() - w_offset;
|
||||
int w_max = btn_container->getWidth() - w_offset;
|
||||
while (w_defined > w_max){
|
||||
w_label--;
|
||||
w_defined = int(w_label*label_count) - w_offset;
|
||||
@@ -182,7 +181,7 @@ void CComponentsFooter::setButtonLabels(const struct button_label_cc * const con
|
||||
* with default width to chain object.
|
||||
*/
|
||||
vector<CComponentsItem*> v_btns;
|
||||
int h_btn = /*(ccf_enable_button_bg ? */chain->getHeight()-2*fr_thickness/*-OFFSET_INNER_SMALL*//* : height)*/-ccf_button_shadow_width;
|
||||
int h_btn = /*(ccf_enable_button_bg ? */btn_container->getHeight()-2*fr_thickness/*-OFFSET_INNER_SMALL*//* : height)*/-ccf_button_shadow_width;
|
||||
for (size_t i= 0; i< label_count; i++){
|
||||
string txt = content[i].locale == NONEXISTANT_LOCALE ? content[i].text : g_Locale->getText(content[i].locale);
|
||||
string icon_name = string(content[i].button);
|
||||
@@ -193,7 +192,7 @@ void CComponentsFooter::setButtonLabels(const struct button_label_cc * const con
|
||||
continue;
|
||||
}
|
||||
|
||||
int y_btn = chain->getHeight()/2 - h_btn/2;
|
||||
int y_btn = btn_container->getHeight()/2 - h_btn/2;
|
||||
dprintf(DEBUG_INFO, "[CComponentsFooter] [%s - %d] y_btn [%d] ccf_button_shadow_width [%d]\n", __func__, __LINE__, y_btn, ccf_button_shadow_width);
|
||||
CComponentsButton *btn = new CComponentsButton(0, y_btn, w_btn, h_btn, txt, icon_name, NULL, false, true, ccf_enable_button_shadow);
|
||||
|
||||
@@ -224,27 +223,27 @@ void CComponentsFooter::setButtonLabels(const struct button_label_cc * const con
|
||||
btn->setButtonFont(NULL);
|
||||
}
|
||||
|
||||
dprintf(DEBUG_INFO, "[CComponentsFooter] [%s - %d] button %s [%zu] btn->getWidth() = %d w_btn = %d, (chain->getWidth() = %d)\n", __func__, __LINE__, txt.c_str(), i, btn->getWidth(), w_btn, chain->getWidth());
|
||||
dprintf(DEBUG_INFO, "[CComponentsFooter] [%s - %d] button %s [%zu] btn->getWidth() = %d w_btn = %d, (chain->getWidth() = %d)\n", __func__, __LINE__, txt.c_str(), i, btn->getWidth(), w_btn, btn_container->getWidth());
|
||||
}
|
||||
|
||||
/* add generated button objects to chain object.
|
||||
*/
|
||||
if (!v_btns.empty()){
|
||||
/*add all buttons into button container*/
|
||||
chain->addCCItem(v_btns);
|
||||
btn_container->addCCItem(v_btns);
|
||||
|
||||
/* set position of labels, as centered inside button container*/
|
||||
int w_chain_used = 0;
|
||||
for (size_t a= 0; a< chain->size(); a++)
|
||||
w_chain_used += chain->getCCItem(a)->getWidth();
|
||||
w_chain_used += (chain->size()-1)*cch_offset;
|
||||
for (size_t a= 0; a< btn_container->size(); a++)
|
||||
w_chain_used += btn_container->getCCItem(a)->getWidth();
|
||||
w_chain_used += (btn_container->size()-1)*cch_offset;
|
||||
|
||||
int x_btn = chain->getWidth()/2 - w_chain_used/2;
|
||||
chain->getCCItem(0)->setXPos(x_btn);
|
||||
int x_btn = btn_container->getWidth()/2 - w_chain_used/2;
|
||||
btn_container->getCCItem(0)->setXPos(x_btn);
|
||||
|
||||
for (size_t c= 1; c< chain->size(); c++){
|
||||
x_btn += chain->getCCItem(c-1)->getWidth()+ cch_offset;
|
||||
chain->getCCItem(c)->setXPos(x_btn);
|
||||
for (size_t c= 1; c< btn_container->size(); c++){
|
||||
x_btn += btn_container->getCCItem(c-1)->getWidth()+ cch_offset;
|
||||
btn_container->getCCItem(c)->setXPos(x_btn);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -317,49 +316,12 @@ void CComponentsFooter::setButtonLabel( const char *button_icon,
|
||||
void CComponentsFooter::enableButtonBg(bool enable)
|
||||
{
|
||||
ccf_enable_button_bg = enable;
|
||||
if (chain) {
|
||||
for (size_t i= 0; i< chain->size(); i++)
|
||||
chain->getCCItem(i)->doPaintBg(ccf_enable_button_bg);
|
||||
if (btn_container) {
|
||||
for (size_t i= 0; i< btn_container->size(); i++)
|
||||
btn_container->getCCItem(i)->doPaintBg(ccf_enable_button_bg);
|
||||
}
|
||||
}
|
||||
|
||||
void CComponentsFooter::setSelectedButton(size_t item_id,
|
||||
const fb_pixel_t& fr_col, const fb_pixel_t& sel_fr_col,
|
||||
const fb_pixel_t& bg_col, const fb_pixel_t& sel_bg_col,
|
||||
const fb_pixel_t& text_col, const fb_pixel_t& sel_text_col,
|
||||
const int& frame_width,
|
||||
const int& sel_frame_width)
|
||||
{
|
||||
if (chain){
|
||||
for (size_t i= 0; i< chain->size(); i++){
|
||||
CComponentsButton *btn = static_cast<CComponentsButton*>(chain->getCCItem(i));
|
||||
btn->setButtonTextColor(text_col);
|
||||
}
|
||||
fb_pixel_t sel_col = fr_col;
|
||||
if (chain->size() > 1)
|
||||
sel_col = sel_fr_col; //TODO: make it configurable
|
||||
chain->setSelectedItem(item_id, sel_col, fr_col, sel_bg_col, bg_col, frame_width, sel_frame_width);
|
||||
|
||||
getSelectedButtonObject()->setButtonTextColor(sel_text_col);
|
||||
}
|
||||
}
|
||||
|
||||
int CComponentsFooter::getSelectedButton()
|
||||
{
|
||||
int ret = -1;
|
||||
if (chain)
|
||||
ret = chain->getSelectedItem();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
CComponentsButton* CComponentsFooter::getSelectedButtonObject()
|
||||
{
|
||||
CComponentsButton* ret = static_cast<CComponentsButton*>(chain->getSelectedItemObject());
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void CComponentsFooter::paintButtons(const int& x_pos,
|
||||
const int& y_pos,
|
||||
const int& w,
|
||||
@@ -395,12 +357,12 @@ void CComponentsFooter::enableButtonShadow(int mode, const int& shadow_width, bo
|
||||
ccf_enable_button_shadow = mode;
|
||||
ccf_button_shadow_width = shadow_width;
|
||||
ccf_button_shadow_force_paint = force_paint;
|
||||
if (chain){
|
||||
for(size_t i=0; i<chain->size(); i++){
|
||||
chain->getCCItem(i)->enableShadow(ccf_enable_button_shadow, ccf_button_shadow_width, ccf_button_shadow_force_paint);
|
||||
if (btn_container){
|
||||
for(size_t i=0; i<btn_container->size(); i++){
|
||||
btn_container->getCCItem(i)->enableShadow(ccf_enable_button_shadow, ccf_button_shadow_width, ccf_button_shadow_force_paint);
|
||||
//int y_btn = ccf_enable_button_shadow == CC_SHADOW_OFF ? CC_CENTERED : chain->getHeight()/2 - chain->getCCItem(i)->getHeight()/2 - ccf_button_shadow_width;
|
||||
int y_btn = chain->getHeight()/2 - chain->getCCItem(i)->getHeight()/2;
|
||||
chain->getCCItem(i)->setYPos(y_btn);
|
||||
int y_btn = btn_container->getHeight()/2 - btn_container->getCCItem(i)->getHeight()/2;
|
||||
btn_container->getCCItem(i)->setYPos(y_btn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user