Merge branch 'pu/fb-setmode' of https://github.com/tuxbox-neutrino/gui-neutrino into ni/tuxbox

Origin commit data
------------------
Branch: ni/coolstream
Commit: e2cf02f310
Author: vanhofen <vanhofen@gmx.de>
Date: 2017-03-13 (Mon, 13 Mar 2017)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2017-03-13 11:40:34 +01:00
2 changed files with 19 additions and 10 deletions

View File

@@ -615,6 +615,7 @@ void CMenuWidget::Init(const std::string &NameString, const std::string &Icon, c
selected = (widget_index == NO_WIDGET_ID ? preselected : mglobal->v_selected[widget_index]); selected = (widget_index == NO_WIDGET_ID ? preselected : mglobal->v_selected[widget_index]);
//dimension //dimension
mwidth_save = mwidth;
min_width = 0; min_width = 0;
width = 0; /* is set in paint() */ width = 0; /* is set in paint() */
if (mwidth > 100){ if (mwidth > 100){
@@ -1114,6 +1115,13 @@ void CMenuWidget::checkHints()
void CMenuWidget::calcSize() void CMenuWidget::calcSize()
{ {
// recalc min_width
min_width = 0;
int mwidth = std::min(mwidth_save, 100);
min_width = frameBuffer->getScreenWidth(true) * mwidth / 100;
if (min_width > (int)frameBuffer->getScreenWidth())
min_width = frameBuffer->getScreenWidth();
width = min_width; width = min_width;
int wi, hi; int wi, hi;
@@ -1122,35 +1130,35 @@ void CMenuWidget::calcSize()
if (items[i]->iconName_Info_right) { if (items[i]->iconName_Info_right) {
frameBuffer->getIconSize(items[i]->iconName_Info_right, &wi, &hi); frameBuffer->getIconSize(items[i]->iconName_Info_right, &wi, &hi);
if ((wi > 0) && (hi > 0)) if ((wi > 0) && (hi > 0))
wi += 10; wi += OFFSET_INNER_MID;
else else
wi = 0; wi = 0;
} }
int tmpw = items[i]->getWidth() + 10 + 10 + wi; /* 10 pixels to the left and right of the text */ int tmpw = items[i]->getWidth() + 2*OFFSET_INNER_MID + wi; /* 10 pixels to the left and right of the text */
if (tmpw > width) if (tmpw > width)
width = tmpw; width = tmpw;
} }
hint_height = 0; hint_height = 0;
if(g_settings.show_menu_hints && has_hints) { if(g_settings.show_menu_hints && has_hints) {
hint_height = 60; //TODO: rework calculation of hint_height hint_height = frameBuffer->scale2Res(60); //TODO: rework calculation of hint_height
int fheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]->getHeight(); int fheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]->getHeight();
int h_tmp = 16 + 2*fheight; int h_tmp = OFFSET_INNER_LARGE + 2*fheight;
/* assuming all hint icons has the same size ! */ /* assuming all hint icons has the same size ! */
int iw, ih; int iw, ih;
frameBuffer->getIconSize(NEUTRINO_ICON_HINT_TVMODE, &iw, &ih); frameBuffer->getIconSize(NEUTRINO_ICON_HINT_TVMODE, &iw, &ih);
h_tmp = std::max(h_tmp, ih+10); h_tmp = std::max(h_tmp, ih+OFFSET_INNER_MID);
hint_height = std::max(h_tmp, hint_height); hint_height = std::max(h_tmp, hint_height);
} }
/* set the max height to 9/10 of usable screen height /* set the max height to 9/10 of usable screen height
debatable, if the callers need a possibility to set this */ debatable, if the callers need a possibility to set this */
height = (frameBuffer->getScreenHeight() - fbutton_height - hint_height) / 20 * 18; /* make sure its a multiple of 2 */ height = (frameBuffer->getScreenHeight() - fbutton_height - hint_height) / 20 * 18; /* make sure its a multiple of 2 */
if(height > ((int)frameBuffer->getScreenHeight() - 10)) if(height > ((int)frameBuffer->getScreenHeight() - OFFSET_INNER_MID))
height = frameBuffer->getScreenHeight() - 10; height = frameBuffer->getScreenHeight() - OFFSET_INNER_MID;
int neededWidth = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getRenderWidth(getName()); int neededWidth = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getRenderWidth(getName());
if (neededWidth > width-48) { if (neededWidth > width - frameBuffer->scale2Res(48)) {
width= neededWidth+ 49; width = neededWidth + frameBuffer->scale2Res(48)+1;
} }
hheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); hheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight();
@@ -1184,7 +1192,7 @@ void CMenuWidget::calcSize()
iconOffset = w; iconOffset = w;
} }
iconOffset += 10; iconOffset += OFFSET_INNER_MID;
width += iconOffset; width += iconOffset;
if (fbutton_count) if (fbutton_count)

View File

@@ -513,6 +513,7 @@ class CMenuWidget : public CMenuTarget, public CComponentsSignals
std::string iconfile; std::string iconfile;
int min_width; int min_width;
int mwidth_save;
int width; int width;
int height; int height;
int hheight; // header int hheight; // header