diff --git a/HISTORY b/HISTORY index 70c973b..be50ba6 100644 --- a/HISTORY +++ b/HISTORY @@ -93,3 +93,4 @@ Version 1.1.0 - Fixed Bug 1484 - Added Event Short Text (if available) to RecName (Closes Ticket 1490) - Fixed OSD Background Color (Closes Ticket 1474) +- Rounded Corners for color buttons (Closes Ticket 1475) diff --git a/footer.c b/footer.c index 2014905..348da30 100644 --- a/footer.c +++ b/footer.c @@ -102,6 +102,11 @@ void cFooter::DrawButton(const char *text, tColor color, tColor borderColor, eOs imgLoader.DrawBackground(theme.Color(clrButtonBlend), color, geoManager.buttonWidth-4, geoManager.buttonHeight-4); footer->DrawRectangle(cRect(left, buttonY, geoManager.buttonWidth, geoManager.buttonHeight), borderColor); footer->DrawImage(cPoint(left+2, buttonY+2), imgLoader.GetImage()); + if (tvguideConfig.roundedCorners) { + int borderRadius = 12; + int borderWidth = 2; + DrawRoundedCorners(footer, left, buttonY, geoManager.buttonWidth, geoManager.buttonHeight, borderRadius, borderWidth, borderColor); + } } else if (tvguideConfig.style == eStyleGraphical) { cImage *button = imgCache.GetOsdElement(buttonType); if (button) { @@ -109,7 +114,12 @@ void cFooter::DrawButton(const char *text, tColor color, tColor borderColor, eOs } } else { footer->DrawRectangle(cRect(left, buttonY, geoManager.buttonWidth, geoManager.buttonHeight), borderColor); - footer->DrawRectangle(cRect(left+2, buttonY+2, geoManager.buttonWidth-4, geoManager.buttonHeight-4), color); + footer->DrawRectangle(cRect(left+1, buttonY+1, geoManager.buttonWidth-2, geoManager.buttonHeight-2), color); + if (tvguideConfig.roundedCorners) { + int borderRadius = 12; + int borderWidth = 1; + DrawRoundedCorners(footer, left, buttonY, geoManager.buttonWidth, geoManager.buttonHeight, borderRadius, borderWidth, borderColor); + } } int textWidth = fontManager.FontButton->Width(text); diff --git a/themes/tvguide-iceblue.theme b/themes/tvguide-iceblue.theme index ce60ded..7da7143 100644 --- a/themes/tvguide-iceblue.theme +++ b/themes/tvguide-iceblue.theme @@ -18,13 +18,13 @@ clrTimeline1Blending = 00000000 clrTimeline2 = FF000000 clrTimeline2Blending = 00000000 clrButtonRed = FFBB0000 -clrButtonRedBorder = FFBB0000 +clrButtonRedBorder = FF000000 clrButtonGreen = FF00BB00 -clrButtonGreenBorder = FF00BB00 +clrButtonGreenBorder = FF000000 clrButtonYellow = FFBBBB00 -clrButtonYellowBorder = FFBBBB00 +clrButtonYellowBorder = FF000000 clrButtonBlue = FF0000BB -clrButtonBlueBorder = FF0000BB +clrButtonBlueBorder = FF000000 clrRecMenuBackground = AA000000 clrRecMenuTimerConflictBackground = FFCCCCCC clrRecMenuTimerConflictBar = FF222222 diff --git a/tools.c b/tools.c index 92fb4a8..d22f6b0 100644 --- a/tools.c +++ b/tools.c @@ -5,6 +5,7 @@ #include #include #include +#include #include "tools.h" @@ -51,6 +52,23 @@ std::string StrToLowerCase(std::string str) { return lowerCase; } +void DrawRoundedCorners(cPixmap *p, int posX, int posY, int width, int height, int radius, int borderWidth, tColor borderColor) { + if( height > 2*radius) { + p->DrawEllipse(cRect(posX, posY, radius, radius), borderColor, -2); + p->DrawEllipse(cRect(posX - borderWidth, posY - borderWidth, radius, radius), clrTransparent, -2); + + p->DrawEllipse(cRect(posX+width - radius, posY, radius, radius), borderColor, -1); + p->DrawEllipse(cRect(posX+width - radius + borderWidth, posY - borderWidth, radius, radius), clrTransparent, -1); + + p->DrawEllipse(cRect(posX, posY + height - radius, radius, radius), borderColor, -3); + p->DrawEllipse(cRect(posX - borderWidth, posY + height - radius + borderWidth, radius, radius), clrTransparent, -3); + + p->DrawEllipse(cRect(posX + width - radius, posY + height - radius, radius, radius), borderColor, -4); + p->DrawEllipse(cRect(posX + width - radius + borderWidth, posY + height - radius + borderWidth, radius, radius), clrTransparent, -4); + } +} + + /**************************************************************************************** * SPLTSTRING ****************************************************************************************/ diff --git a/tools.h b/tools.h index f17bb9c..fd0a768 100644 --- a/tools.h +++ b/tools.h @@ -7,6 +7,7 @@ std::string CutText(std::string text, int width, const cFont *font); std::string StrToLowerCase(std::string str); +void DrawRoundedCorners(cPixmap *p, int posX, int posY, int width, int height, int radius, int borderWidth, tColor borderColor); class splitstring : public std::string { std::vector flds;