diff --git a/src/gui/components/cc_item.cpp b/src/gui/components/cc_item.cpp index 076f743ab..7e10a52a0 100644 --- a/src/gui/components/cc_item.cpp +++ b/src/gui/components/cc_item.cpp @@ -74,120 +74,120 @@ void CComponentsItem::paintInit(bool do_save_bg) //calculate current needed frame thickeness and color, if item selected or not fb_pixel_t col_frame_cur = col_frame; - int th = fr_thickness; + int th = cc_enable_frame ? fr_thickness : 0; if (v_fbdata.empty()){ - //calculate current needed corner radius for body box, depends of frame thickness - int rad = (th) ? corner_rad-th : corner_rad; - //and ensure max radius < dimensions - rad = min(min(rad, corner_rad), min(width, height)); + //set current position and dimensions + int ix = x, iy = y, dx = width, dy = height; + + //and ensure sw is not larger than body dimensions, max x% + int sw = (shadow) ? min(shadow_w, min(dx, dy)*50/100) : 0; - int sw = (shadow) ? shadow_w : 0; + //set current needed corner main box radius + int box_rad = corner_rad; + + //and ensure max main box radius < dimensions + if (2*box_rad > dy) + box_rad -= max(0, 2*box_rad-dy); + if (2*box_rad > dx) + box_rad -= max(0, 2*box_rad-dy); + + //Workaround: ensure radius values >= 0, framebuffer methode paintBoxRel() gets confused + box_rad = max(box_rad-th, 0); - //if item is bound on a parent form,... - int ix = x, iy = y; fb_pixel_t col_shadow_clean = 0; + //if item is bound on a parent form,... if (cc_parent){ - //we must use real x/y values and from parent form as reference + //...we must use real x/y values and from parent form as reference ix = cc_xr; iy = cc_yr; - //we must use color of parent body instead screen background + //...we must use color of parent body instead screen background col_shadow_clean = cc_parent->getColorBody(); } -// //handle shadow width -// if (width <= sw || height <= sw){ //don't use shadow, if item dimensions too small -// dprintf(DEBUG_NORMAL, "\033[33m[CComponentsItem]\t[%s - %d] shadow dimensions too small sw=%d, shadow is disabled set dimension to 0\033[0m\n",__func__, __LINE__, sw); -// shadow = CC_SHADOW_OFF; -// sw = 0; -// } + ///evaluate shadow layer parts + //handle general shadow corner dimensions + int sh_cdx = box_rad+sw+th; //width + int sh_cdy = box_rad+sw+th; //height + + //adapt shadow corner dimensions if body dimensions are too small, use an offset if required + int sh_cdx_size_offset, sh_cdy_size_offset = 0; + if (sh_cdy*2 > dy) + sh_cdy_size_offset = sh_cdy*2-dy; + if (sh_cdx*2 > dx) + sh_cdx_size_offset = sh_cdx*2-dx; - //evaluate shadow layer parts - //handle shadow corner dimensions - int sh_cdx = rad+sw, sh_cdy = rad+sw; - //handle shadow positions //...corner bottom right - int sh_cbr_x = ix+width-sh_cdx+sw; - int sh_cbr_y = iy+height-sh_cdy+sw; - + int sh_cbr_x = ix+dx-sh_cdx+sw; + int sh_cbr_y = iy+dy-sh_cdy+sw; + //...corner top right int sh_ctr_x = sh_cbr_x; int sh_ctr_y = iy+sw; - + //...corner bottom left int sh_cbl_x = ix+sw; int sh_cbl_y = sh_cbr_y; - + + //handle general shadow bar dimensions + int sh_bdx = dx-sh_cdx-sh_cdx; + int sh_rdy = dy-sh_cdy-sh_cdy; + //...bar bottom int sh_bx = sh_cbl_x+sh_cdx; - int sh_by = iy+height; - int sh_bdx = width-sh_cdx-sh_cdx; - + int sh_by = iy+dy; + //...bar right - int sh_rx = ix+width; + int sh_rx = ix+dx; int sh_ry = sh_ctr_y+sh_cdy; - int sh_rdy = height-sh_cdy-sh_cdy; - + //corners bool sh_ctr = (shadow & CC_SHADOW_CORNER_TOP_RIGHT); bool sh_cbr = (shadow & CC_SHADOW_CORNER_BOTTOM_RIGHT); bool sh_cbl = (shadow & CC_SHADOW_CORNER_BOTTOM_LEFT); - //...bars + //...shadow bar right bool sh_br = (shadow & CC_SHADOW_RIGHT); - printf("<<<<<<<<<<setCorner(RADIUS_LARGE, CORNER_TOP_RIGHT); }else header->setDimensionsAll(head_x, ChanNameY, head_w, time_height); @@ -470,7 +470,7 @@ void CInfoViewer::paintBody() //set corner and shadow modes, consider virtual zap mode body->setCorner(RADIUS_LARGE, (zap_mode) ? CORNER_BOTTOM : CORNER_NONE); - body->enableShadow(zap_mode ? CC_SHADOW_ON : CC_SHADOW_RIGHT); + body->enableShadow(zap_mode ? CC_SHADOW_ON : CC_SHADOW_RIGHT | CC_SHADOW_CORNER_TOP_RIGHT | CC_SHADOW_CORNER_BOTTOM_RIGHT); body->setColorBody(g_settings.theme.infobar_gradient_body ? COL_MENUHEAD_PLUS_0 : COL_INFOBAR_PLUS_0); body->enableColBodyGradient(g_settings.theme.infobar_gradient_body, COL_INFOBAR_PLUS_0, g_settings.theme.infobar_gradient_body_direction); diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp index 03130bc26..9d9b84fd7 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -398,8 +398,8 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) } else if (actionKey == "square"){ if (sq == NULL){ - sq = new CComponentsShapeSquare (100, 220, 100, 100, NULL, CC_SHADOW_ON, COL_MENUCONTENT_PLUS_6, COL_LIGHT_GRAY, COL_RED); - sq->setCorner(11, CORNER_BOTTOM_LEFT); + sq = new CComponentsShapeSquare (0, 0, 100, 100, NULL, CC_SHADOW_ON, COL_OLIVE, COL_LIGHT_GRAY, COL_RED); + sq->enableFrame(true,1); } if (!sq->isPainted()) diff --git a/src/gui/upnpbrowser.cpp b/src/gui/upnpbrowser.cpp index f6c34630a..3d80069a1 100644 --- a/src/gui/upnpbrowser.cpp +++ b/src/gui/upnpbrowser.cpp @@ -989,7 +989,7 @@ void CUpnpBrowserGui::paintDevices() // Head CComponentsHeaderLocalized header(m_x, m_header_y, m_width, m_header_height, LOCALE_UPNPBROWSER_HEAD, NEUTRINO_ICON_UPNP); - header.enableShadow(CC_SHADOW_RIGHT, -1, true); + header.enableShadow( CC_SHADOW_RIGHT | CC_SHADOW_CORNER_TOP_RIGHT | CC_SHADOW_CORNER_BOTTOM_RIGHT, -1, true); if (CNeutrinoApp::getInstance()->isMuted()) //TODO: consider mute mode on runtime header.addContextButton(NEUTRINO_ICON_BUTTON_MUTE_SMALL); else diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 32533c863..ffb9c478e 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -1240,7 +1240,7 @@ void CMenuWidget::paint() // paint head if (header == NULL){ header = new CComponentsHeader(x, y, width + sb_width, hheight, getName(), iconfile); - header->enableShadow(CC_SHADOW_RIGHT); + header->enableShadow(CC_SHADOW_RIGHT | CC_SHADOW_CORNER_TOP_RIGHT | CC_SHADOW_CORNER_BOTTOM_RIGHT); header->setOffset(10); } header->setColorAll(COL_FRAME_PLUS_0, COL_MENUHEAD_PLUS_0, COL_SHADOW_PLUS_0);