mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-28 16:01:20 +02:00
- menu: always add an offset to menus; not only in round-border-mode
Signed-off-by: Thilo Graf <dbt@novatux.de>
This commit is contained in:
@@ -259,7 +259,7 @@ void CMenuItem::paintItemCaption(const bool select_mode, const char * right_text
|
|||||||
right_bg_col = COL_MENUCONTENTINACTIVE_TEXT;
|
right_bg_col = COL_MENUCONTENTINACTIVE_TEXT;
|
||||||
right_frame_col = COL_MENUCONTENTINACTIVE_TEXT;
|
right_frame_col = COL_MENUCONTENTINACTIVE_TEXT;
|
||||||
}
|
}
|
||||||
CComponentsShapeSquare col(stringstartposOption, y + 2, dx - stringstartposOption + x - 2, item_height - 4, NULL, false, right_frame_col, right_bg_col);
|
CComponentsShapeSquare col(stringstartposOption, y + OFFSET_INNER_SMALL, dx - stringstartposOption + x - OFFSET_INNER_MID, item_height - 2*OFFSET_INNER_SMALL, NULL, false, right_frame_col, right_bg_col);
|
||||||
col.setFrameThickness(3);
|
col.setFrameThickness(3);
|
||||||
col.setCorner(RADIUS_SMALL);
|
col.setCorner(RADIUS_SMALL);
|
||||||
col.paint(false);
|
col.paint(false);
|
||||||
@@ -561,7 +561,7 @@ void CMenuWidget::Init(const std::string &NameString, const std::string &Icon, c
|
|||||||
offx = offy = 0;
|
offx = offy = 0;
|
||||||
from_wizard = SNeutrinoSettings::WIZARD_OFF;
|
from_wizard = SNeutrinoSettings::WIZARD_OFF;
|
||||||
fade = true;
|
fade = true;
|
||||||
sb_width = 0;
|
scrollbar_width = 0;
|
||||||
savescreen = false;
|
savescreen = false;
|
||||||
preselected = -1;
|
preselected = -1;
|
||||||
nextShortcut = 1;
|
nextShortcut = 1;
|
||||||
@@ -1061,7 +1061,7 @@ void CMenuWidget::hide()
|
|||||||
info_box->kill();
|
info_box->kill();
|
||||||
if (details_line)
|
if (details_line)
|
||||||
details_line->hide();
|
details_line->hide();
|
||||||
frameBuffer->paintBackgroundBoxRel(x, y, full_width, full_height + fbutton_height);
|
frameBuffer->paintBackgroundBoxRel(x, y, full_width, full_height);
|
||||||
//paintHint(-1);
|
//paintHint(-1);
|
||||||
}
|
}
|
||||||
paintHint(-1);
|
paintHint(-1);
|
||||||
@@ -1132,10 +1132,10 @@ void CMenuWidget::calcSize()
|
|||||||
}
|
}
|
||||||
/* 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() - hint_height) / 20 * 18; /* make sure its a multiple of 2 */
|
||||||
|
|
||||||
if(height > ((int)frameBuffer->getScreenHeight() - OFFSET_INNER_MID))
|
if (height > ((int)frameBuffer->getScreenHeight() - 2*OFFSET_INNER_MID))
|
||||||
height = frameBuffer->getScreenHeight() - OFFSET_INNER_MID;
|
height = frameBuffer->getScreenHeight() - 2*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 - frameBuffer->scale2Res(48)) {
|
if (neededWidth > width - frameBuffer->scale2Res(48)) {
|
||||||
@@ -1184,14 +1184,21 @@ void CMenuWidget::calcSize()
|
|||||||
|
|
||||||
// shrink menu if less items
|
// shrink menu if less items
|
||||||
height = std::min(height, hheight + maxItemHeight);
|
height = std::min(height, hheight + maxItemHeight);
|
||||||
|
/*
|
||||||
|
Always add a bottom offset.
|
||||||
|
Most menus has an upper offset too,
|
||||||
|
which is added with the intro-items
|
||||||
|
*/
|
||||||
|
height += OFFSET_INNER_MID;
|
||||||
|
|
||||||
//scrollbar width
|
//scrollbar width
|
||||||
sb_width=0;
|
scrollbar_width=0;
|
||||||
if(total_pages > 1)
|
if (total_pages > 1)
|
||||||
sb_width=SCROLLBAR_WIDTH;
|
scrollbar_width = SCROLLBAR_WIDTH;
|
||||||
|
|
||||||
|
full_width = width + scrollbar_width + OFFSET_SHADOW;
|
||||||
|
full_height = height + fbutton_height + OFFSET_SHADOW + OFFSET_INTER; // hintbox is handled separately
|
||||||
|
|
||||||
full_width = /*DETAILSLINE_WIDTH+*/width+sb_width+OFFSET_SHADOW;
|
|
||||||
full_height = height+RADIUS_LARGE+OFFSET_SHADOW*2 /*+hint_height+OFFSET_INTER*/;
|
|
||||||
/* + DETAILSLINE_WIDTH for the hintbox connection line
|
/* + DETAILSLINE_WIDTH for the hintbox connection line
|
||||||
* + center_offset for symmetry
|
* + center_offset for symmetry
|
||||||
* + 20 for setMenuPos calculates 10 pixels border left and right */
|
* + 20 for setMenuPos calculates 10 pixels border left and right */
|
||||||
@@ -1199,7 +1206,7 @@ void CMenuWidget::calcSize()
|
|||||||
int max_possible = (int)frameBuffer->getScreenWidth() - DETAILSLINE_WIDTH - center_offset - 2*OFFSET_INNER_MID;
|
int max_possible = (int)frameBuffer->getScreenWidth() - DETAILSLINE_WIDTH - center_offset - 2*OFFSET_INNER_MID;
|
||||||
if (full_width > max_possible)
|
if (full_width > max_possible)
|
||||||
{
|
{
|
||||||
width = max_possible - sb_width - OFFSET_SHADOW;
|
width = max_possible - scrollbar_width - OFFSET_SHADOW;
|
||||||
full_width = max_possible + center_offset; /* symmetry in MENU_POS_CENTER case */
|
full_width = max_possible + center_offset; /* symmetry in MENU_POS_CENTER case */
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1238,7 +1245,7 @@ void CMenuWidget::paint()
|
|||||||
|
|
||||||
// paint head
|
// paint head
|
||||||
if (header == NULL){
|
if (header == NULL){
|
||||||
header = new CComponentsHeader(x, y, width + sb_width, hheight, getName(), iconfile);
|
header = new CComponentsHeader(x, y, width + scrollbar_width, hheight, getName(), iconfile);
|
||||||
header->enableShadow(CC_SHADOW_RIGHT | CC_SHADOW_CORNER_TOP_RIGHT | CC_SHADOW_CORNER_BOTTOM_RIGHT);
|
header->enableShadow(CC_SHADOW_RIGHT | CC_SHADOW_CORNER_TOP_RIGHT | CC_SHADOW_CORNER_BOTTOM_RIGHT);
|
||||||
header->setOffset(OFFSET_INNER_MID);
|
header->setOffset(OFFSET_INNER_MID);
|
||||||
}
|
}
|
||||||
@@ -1249,16 +1256,16 @@ void CMenuWidget::paint()
|
|||||||
header->enableGradientBgCleanUp(savescreen);
|
header->enableGradientBgCleanUp(savescreen);
|
||||||
header->paint(CC_SAVE_SCREEN_NO);
|
header->paint(CC_SAVE_SCREEN_NO);
|
||||||
|
|
||||||
// paint body shadow
|
// paint body and footer shadow
|
||||||
frameBuffer->paintBoxRel(x+OFFSET_SHADOW, y + hheight + OFFSET_SHADOW, width + sb_width, height - hheight + RADIUS_LARGE + (fbutton_count ? fbutton_height : 0), COL_SHADOW_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM);
|
frameBuffer->paintBoxRel(x + OFFSET_SHADOW, y + hheight + OFFSET_SHADOW, width + scrollbar_width, height - hheight + fbutton_height, COL_SHADOW_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM);
|
||||||
// paint body background
|
// paint body background
|
||||||
frameBuffer->paintBoxRel(x, y+hheight, width + sb_width, height-hheight + RADIUS_LARGE, COL_MENUCONTENT_PLUS_0, RADIUS_LARGE, (fbutton_count ? CORNER_NONE : CORNER_BOTTOM));
|
frameBuffer->paintBoxRel(x, y + hheight, width + scrollbar_width, height - hheight, COL_MENUCONTENT_PLUS_0, RADIUS_LARGE, (fbutton_count ? CORNER_NONE : CORNER_BOTTOM));
|
||||||
|
|
||||||
item_start_y = y+hheight;
|
item_start_y = y+hheight;
|
||||||
paintItems();
|
paintItems();
|
||||||
washidden = false;
|
washidden = false;
|
||||||
if (fbutton_count)
|
if (fbutton_count)
|
||||||
::paintButtons(x, y + height + RADIUS_LARGE, width + sb_width, fbutton_count, fbutton_labels, width, fbutton_height);
|
::paintButtons(x, y + height, width + scrollbar_width, fbutton_count, fbutton_labels, width, fbutton_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMenuWidget::setMenuPos(const int& menu_width)
|
void CMenuWidget::setMenuPos(const int& menu_width)
|
||||||
@@ -1267,7 +1274,7 @@ void CMenuWidget::setMenuPos(const int& menu_width)
|
|||||||
int scr_y = frameBuffer->getScreenY();
|
int scr_y = frameBuffer->getScreenY();
|
||||||
int scr_w = frameBuffer->getScreenWidth();
|
int scr_w = frameBuffer->getScreenWidth();
|
||||||
int scr_h = frameBuffer->getScreenHeight();
|
int scr_h = frameBuffer->getScreenHeight();
|
||||||
int real_h = full_height + fbutton_height + hint_height;
|
int real_h = full_height + hint_height;
|
||||||
int x_old = x;
|
int x_old = x;
|
||||||
int y_old = y;
|
int y_old = y;
|
||||||
//configured positions
|
//configured positions
|
||||||
@@ -1319,11 +1326,11 @@ void CMenuWidget::paintItems()
|
|||||||
// Scrollbar
|
// Scrollbar
|
||||||
if(total_pages>1)
|
if(total_pages>1)
|
||||||
{
|
{
|
||||||
int item_height=height-(item_start_y-y);
|
int scrollbar_height = height - hheight - OFFSET_INNER_MID;
|
||||||
paintScrollBar(x+ width, item_start_y, sb_width, item_height, total_pages, current_page);
|
paintScrollBar(x + width, item_start_y, scrollbar_width, scrollbar_height, total_pages, current_page);
|
||||||
/* background of menu items, paint every time because different items can have
|
/* background of menu items, paint every time because different items can have
|
||||||
* different height and this might leave artifacts otherwise after changing pages */
|
* different height and this might leave artifacts otherwise after changing pages */
|
||||||
frameBuffer->paintBoxRel(x,item_start_y, width,item_height, COL_MENUCONTENT_PLUS_0);
|
frameBuffer->paintBoxRel(x, item_start_y, width, scrollbar_height, COL_MENUCONTENT_PLUS_0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ypos=item_start_y;
|
int ypos=item_start_y;
|
||||||
@@ -1387,7 +1394,7 @@ void CMenuWidget::saveScreen()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
delete[] background;
|
delete[] background;
|
||||||
saveScreen_height = full_height+fbutton_height;
|
saveScreen_height = full_height;
|
||||||
saveScreen_width = full_width;
|
saveScreen_width = full_width;
|
||||||
saveScreen_y = y;
|
saveScreen_y = y;
|
||||||
saveScreen_x = x;
|
saveScreen_x = x;
|
||||||
@@ -1456,15 +1463,15 @@ void CMenuWidget::paintHint(int pos)
|
|||||||
item->hintText = " ";
|
item->hintText = " ";
|
||||||
|
|
||||||
int iheight = item->getHeight();
|
int iheight = item->getHeight();
|
||||||
int rad = RADIUS_LARGE;
|
|
||||||
int xpos = x - DETAILSLINE_WIDTH;
|
int xpos = x - DETAILSLINE_WIDTH;
|
||||||
int ypos2 = y + height + fbutton_height + rad + OFFSET_SHADOW + OFFSET_INTER;
|
int ypos2 = y + full_height;
|
||||||
int iwidth = width+sb_width;
|
int iwidth = width + scrollbar_width;
|
||||||
|
|
||||||
//init details line and infobox dimensions
|
//init details line and infobox dimensions
|
||||||
int ypos1 = item->getYPosition();
|
int ypos1 = item->getYPosition();
|
||||||
int ypos1a = ypos1 + (iheight/2);
|
int ypos1a = ypos1 + (iheight/2);
|
||||||
int ypos2a = ypos2 + (hint_height/2);
|
int ypos2a = ypos2 + (hint_height/2);
|
||||||
|
int rad = RADIUS_LARGE;
|
||||||
int markh = hint_height > rad*2 ? hint_height - rad*2 : hint_height;
|
int markh = hint_height > rad*2 ? hint_height - rad*2 : hint_height;
|
||||||
int imarkh = iheight/2;
|
int imarkh = iheight/2;
|
||||||
|
|
||||||
@@ -1488,7 +1495,7 @@ void CMenuWidget::paintHint(int pos)
|
|||||||
info_box->setFrameThickness(2);
|
info_box->setFrameThickness(2);
|
||||||
info_box->removeLineBreaks(str);
|
info_box->removeLineBreaks(str);
|
||||||
info_box->setText(str, CTextBox::AUTO_WIDTH, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT], COL_MENUCONTENT_TEXT);
|
info_box->setText(str, CTextBox::AUTO_WIDTH, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT], COL_MENUCONTENT_TEXT);
|
||||||
info_box->setCorner(RADIUS_LARGE);
|
info_box->setCorner(rad);
|
||||||
info_box->setColorAll(COL_FRAME_PLUS_0, COL_MENUCONTENTDARK_PLUS_0);
|
info_box->setColorAll(COL_FRAME_PLUS_0, COL_MENUCONTENTDARK_PLUS_0);
|
||||||
info_box->setTextColor(COL_MENUCONTENTDARK_TEXT);
|
info_box->setTextColor(COL_MENUCONTENTDARK_TEXT);
|
||||||
info_box->enableShadow();
|
info_box->enableShadow();
|
||||||
@@ -2280,7 +2287,7 @@ int CMenuSeparator::paint(bool selected)
|
|||||||
item_bgcolor = COL_MENUCONTENT_PLUS_0;
|
item_bgcolor = COL_MENUCONTENT_PLUS_0;
|
||||||
}
|
}
|
||||||
|
|
||||||
frameBuffer->paintBoxRel(x,y, dx, height, item_bgcolor);
|
frameBuffer->paintBoxRel(x, y, dx, height, item_bgcolor);
|
||||||
if ((type & LINE))
|
if ((type & LINE))
|
||||||
{
|
{
|
||||||
int grad = g_settings.theme.menu_Separator_gradient_enable ? CC_COLGRAD_COL_DARK_LIGHT_DARK : CC_COLGRAD_OFF;
|
int grad = g_settings.theme.menu_Separator_gradient_enable ? CC_COLGRAD_COL_DARK_LIGHT_DARK : CC_COLGRAD_OFF;
|
||||||
|
@@ -550,7 +550,7 @@ class CMenuWidget : public CMenuTarget, public CComponentsSignals
|
|||||||
int preselected;
|
int preselected;
|
||||||
int selected;
|
int selected;
|
||||||
int iconOffset;
|
int iconOffset;
|
||||||
int sb_width;
|
int scrollbar_width;
|
||||||
fb_pixel_t *background;
|
fb_pixel_t *background;
|
||||||
int full_width, full_height;
|
int full_width, full_height;
|
||||||
bool savescreen;
|
bool savescreen;
|
||||||
|
Reference in New Issue
Block a user