Merge remote-tracking branch 'tuxbox/master'

This commit is contained in:
Stefan Seyfried
2017-02-11 11:18:45 +01:00
32 changed files with 217 additions and 174 deletions

View File

@@ -99,9 +99,10 @@ void Helpbox::addLine(const std::string& icon, const std::string& text, const in
if (!text.empty()){
int x_text = w_picon + (picon ? OFFSET_INNER_MID : 0);
CComponentsText * txt = new CComponentsText(x_text, 0, line->getWidth()-x_text, 0, text, text_mode, font);
txt->doPaintBg(false);
txt->forceTextPaint();
#if 0 //"contrast agent", if you want to see where the text items are drawn.
txt->setColorBody(COL_RED);
txt->doPaintBg(true);
#endif
int lines = txt->getCTextBoxObject()->getLines();
txt_height = std::max(lines*font->getHeight(), h_line);

View File

@@ -534,50 +534,57 @@ CMenuGlobal* CMenuGlobal::getInstance()
CMenuWidget::CMenuWidget()
{
nameString = g_Locale->getText(NONEXISTANT_LOCALE);
name = NONEXISTANT_LOCALE;
iconfile = "";
selected = -1;
Init("", "", 0, 0);
}
CMenuWidget::CMenuWidget(const neutrino_locale_t Name, const std::string & Icon, const int mwidth, const mn_widget_id_t &w_index)
{
Init(g_Locale->getText(Name), Icon, mwidth, w_index);
}
CMenuWidget::CMenuWidget(const std::string &Name, const std::string & Icon, const int mwidth, const mn_widget_id_t &w_index)
{
Init(Name, Icon, mwidth, w_index);
}
void CMenuWidget::Init(const std::string &NameString, const std::string &Icon, const int mwidth, const mn_widget_id_t &w_index)
{
//pos
x = y = 0;
//caption and icon
nameString = NameString;
iconfile = Icon;
//basic attributes
iconOffset = 0;
offx = offy = 0;
from_wizard = SNeutrinoSettings::WIZARD_OFF;
fade = true;
sb_width = 0;
savescreen = false;
background = NULL;
preselected = -1;
nextShortcut = 1;
current_page = 0;
has_hints = false;
brief_hints = BRIEF_HINT_NO;
hint_painted = false;
hint_height = 0;
fbutton_count = 0;
fbutton_labels = NULL;
fbutton_width = 0;
fbutton_height = 0;
saveScreen_width = 0;
saveScreen_height = 0;
//objects
background = NULL;
details_line = NULL;
info_box = NULL;
header = NULL;
nextShortcut = 1;
x = y = 0;
}
frameBuffer = CFrameBuffer::getInstance();
mglobal = CMenuGlobal::getInstance(); //create CMenuGlobal instance only here
CMenuWidget::CMenuWidget(const neutrino_locale_t Name, const std::string & Icon, const int mwidth, const mn_widget_id_t &w_index)
{
name = Name;
nameString = g_Locale->getText(Name);
preselected = -1;
Init(Icon, mwidth, w_index);
}
CMenuWidget::CMenuWidget(const std::string &Name, const std::string & Icon, const int mwidth, const mn_widget_id_t &w_index)
{
name = NONEXISTANT_LOCALE;
nameString = Name;
preselected = -1;
Init(Icon, mwidth, w_index);
}
void CMenuWidget::Init(const std::string &Icon, const int mwidth, const mn_widget_id_t &w_index)
{
mglobal = CMenuGlobal::getInstance(); //create CMenuGlobal instance only here
frameBuffer = CFrameBuffer::getInstance();
iconfile = Icon;
details_line = NULL;
info_box = NULL;
header = NULL;
//handle select values
if(w_index > MN_WIDGET_ID_MAX){
//error
@@ -592,40 +599,18 @@ void CMenuWidget::Init(const std::string &Icon, const int mwidth, const mn_widge
//overwrite preselected value with global select value
selected = (widget_index == NO_WIDGET_ID ? preselected : mglobal->v_selected[widget_index]);
//dimension
min_width = 0;
width = 0; /* is set in paint() */
if (mwidth > 100)
{
if (mwidth > 100){
/* warn about abuse until we found all offenders... */
fprintf(stderr, "Warning: %s (%s) (%s) mwidth over 100%%: %d\n", __FUNCTION__, nameString.c_str(), Icon.c_str(), mwidth);
}
else
{
else{
min_width = frameBuffer->getScreenWidth(true) * mwidth / 100;
if(min_width > (int) frameBuffer->getScreenWidth())
min_width = frameBuffer->getScreenWidth();
}
current_page = 0;
offx = offy = 0;
from_wizard = SNeutrinoSettings::WIZARD_OFF;
fade = true;
savescreen = false;
background = NULL;
has_hints = false;
brief_hints = BRIEF_HINT_NO;
hint_painted = false;
hint_height = 0;
fbutton_count = 0;
fbutton_labels = NULL;
fbutton_width = 0;
fbutton_height = 0;
nextShortcut = 1;
saveScreen_width = 0;
saveScreen_height = 0;
x = y = 0;
}
void CMenuWidget::move(int xoff, int yoff)
@@ -729,8 +714,6 @@ CMenuItem* CMenuWidget::getItem(const uint& item_id)
const char *CMenuWidget::getName()
{
if (name != NONEXISTANT_LOCALE)
return g_Locale->getText(name);
return nameString.c_str();
}
@@ -1256,8 +1239,6 @@ void CMenuWidget::paint()
header->setCaptionColor(COL_MENUHEAD_TEXT);
header->enableColBodyGradient(g_settings.theme.menu_Head_gradient, COL_MENUCONTENT_PLUS_0);
header->enableGradientBgCleanUp(savescreen);
if (header->isPainted())
header->kill(header->getColorBody());
header->paint(CC_SAVE_SCREEN_NO);
// paint body shadow

View File

@@ -504,7 +504,7 @@ class CMenuWidget : public CMenuTarget, public CComponentsSignals
unsigned int saveScreen_x;
protected:
std::string nameString;
neutrino_locale_t name;
CFrameBuffer *frameBuffer;
std::vector<CMenuItem*> items;
std::vector<int> page_start;
@@ -544,7 +544,7 @@ class CMenuWidget : public CMenuTarget, public CComponentsSignals
bool washidden;
int nextShortcut;
void Init(const std::string & Icon, const int mwidth, const mn_widget_id_t &w_index);
void Init(const std::string &NameString, const std::string & Icon, const int mwidth, const mn_widget_id_t &w_index);
virtual void paintItems();
void checkHints();
void calcSize();

View File

@@ -659,6 +659,7 @@ void CTextBox::refreshText(void)
if (allow_paint_bg){
//TRACE("[CTextBox] %s restore bg %d\r\n", __FUNCTION__, __LINE__);
frameBuffer->RestoreScreen(ax, ay, dx, dy, m_bgpixbuf);
m_bg_painted = true;
}
}
}
@@ -720,7 +721,7 @@ void CTextBox::refreshText(void)
frameBuffer->paintBoxRel(tx, ty-th, tw, th, COL_RED, m_nBgRadius, m_nBgRadiusType);
#endif
//TRACE("[CTextBox] %s Line %d m_cFrame.iX %d m_cFrameTextRel.iX %d\r\n", __FUNCTION__, __LINE__, m_cFrame.iX, m_cFrameTextRel.iX);
if (m_bg_painted || m_old_cText != m_cText)
if (m_bg_painted || (m_old_cText != m_cText))
m_pcFontText->RenderString(tx, ty, tw, m_cLineArray[i].c_str(), m_textColor, 0, m_renderMode | ((m_utf8_encoded) ? Font::IS_UTF8 : 0));
y += m_nFontTextHeight;
}