summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlouis <louis.braun@gmx.de>2013-02-12 16:37:59 +0100
committerlouis <louis.braun@gmx.de>2013-02-12 16:37:59 +0100
commit702f4d7795fa97d0cb716c7933f83225e85a35e0 (patch)
treee70b222b47e327ec46b3a332bb3043a315dd70b4
parentf04a7865cdab7a6a8d0aa5ec2f062e16bcd27e8e (diff)
downloadskin-nopacity-702f4d7795fa97d0cb716c7933f83225e85a35e0.tar.gz
skin-nopacity-702f4d7795fa97d0cb716c7933f83225e85a35e0.tar.bz2
Introduced rounded corners for menuitems and buttons
-rw-r--r--HISTORY2
-rw-r--r--config.c4
-rw-r--r--config.h2
-rw-r--r--displaymenuview.c17
-rw-r--r--menuitem.c36
-rw-r--r--menuitem.h1
-rw-r--r--po/de_DE.po8
-rw-r--r--setup.c4
8 files changed, 72 insertions, 2 deletions
diff --git a/HISTORY b/HISTORY
index 4f2a973..b068e5e 100644
--- a/HISTORY
+++ b/HISTORY
@@ -129,3 +129,5 @@ Version 0.0.7:
style for this menu will be used.
- Introduced narrow display of timers menu (Usage of narrow timer menu
and width also configurable)
+- Introduced rounded corners for menuitems and buttons configurable via
+ plugin setup menu, corner radius also configurable.
diff --git a/config.c b/config.c
index a02e6fa..e6403fa 100644
--- a/config.c
+++ b/config.c
@@ -54,6 +54,8 @@ cNopacityConfig::cNopacityConfig() {
fontVolume = 0;
//DisplayMenu
scalePicture = 1;
+ roundedCorners = 0;
+ cornerRadius = 12;
narrowMainMenu = 1;
narrowScheduleMenu = 1;
narrowChannelMenu = 1;
@@ -235,6 +237,8 @@ bool cNopacityConfig::SetupParse(const char *Name, const char *Value) {
else if (strcmp(Name, "menuInfoScrollDelay") == 0) menuInfoScrollDelay = atoi(Value);
else if (strcmp(Name, "menuInfoScrollSpeed") == 0) menuInfoScrollSpeed = atoi(Value);
else if (strcmp(Name, "scalePicture") == 0) scalePicture = atoi(Value);
+ else if (strcmp(Name, "roundedCorners") == 0) roundedCorners = atoi(Value);
+ else if (strcmp(Name, "cornerRadius") == 0) cornerRadius = atoi(Value);
else if (strcmp(Name, "narrowMainMenu") == 0) narrowMainMenu = atoi(Value);
else if (strcmp(Name, "narrowScheduleMenu") == 0) narrowScheduleMenu = atoi(Value);
else if (strcmp(Name, "narrowChannelMenu") == 0) narrowChannelMenu = atoi(Value);
diff --git a/config.h b/config.h
index f3a49d3..e9f5d35 100644
--- a/config.h
+++ b/config.h
@@ -76,6 +76,8 @@ class cNopacityConfig {
int fontVolume;
//DisplayMenu
int scalePicture;
+ int roundedCorners;
+ int cornerRadius;
int narrowMainMenu;
int narrowScheduleMenu;
int narrowChannelMenu;
diff --git a/displaymenuview.c b/displaymenuview.c
index 26975ab..a9435dc 100644
--- a/displaymenuview.c
+++ b/displaymenuview.c
@@ -607,6 +607,23 @@ void cNopacityDisplayMenuView::DrawButton(const char *text, int handleImage, tCo
int left = num * buttonWidth + (2*num + 1) * buttonsBorder;
pixmapFooter->DrawRectangle(cRect(left, top, buttonWidth, buttonHeight), borderColor);
pixmapFooter->DrawImage(cPoint(left+2, top+2), handleImage);
+
+ if (config.roundedCorners) {
+ int radius = config.cornerRadius;
+
+ pixmapFooter->DrawEllipse(cRect(left,top,radius,radius), borderColor, -2);
+ pixmapFooter->DrawEllipse(cRect(left-2,top-2,radius,radius), Theme.Color(clrMenuBack), -2);
+
+ pixmapFooter->DrawEllipse(cRect(left + buttonWidth -radius, top,radius,radius), borderColor, -1);
+ pixmapFooter->DrawEllipse(cRect(left + buttonWidth -radius+2,top-2,radius,radius), Theme.Color(clrMenuBack), -1);
+
+ pixmapFooter->DrawEllipse(cRect(left,top + buttonHeight -radius,radius,radius), borderColor, -3);
+ pixmapFooter->DrawEllipse(cRect(left - 2, top + buttonHeight - radius + 2,radius,radius), Theme.Color(clrMenuBack), -3);
+
+ pixmapFooter->DrawEllipse(cRect(left + buttonWidth -radius, top + buttonHeight -radius,radius,radius), borderColor, -4);
+ pixmapFooter->DrawEllipse(cRect(left + buttonWidth -radius + 2, top + buttonHeight -radius + 2,radius,radius), Theme.Color(clrMenuBack), -4);
+ }
+
int textWidth = fontButtons->Width(text);
int textHeight = fontButtons->Height();
pixmapFooter->DrawText(cPoint(left + (buttonWidth-textWidth)/2, top + (buttonHeight-textHeight)/2), text, Theme.Color(clrMenuFontButton), clrTransparent, fontButtons);
diff --git a/menuitem.c b/menuitem.c
index 6301457..4ca37d5 100644
--- a/menuitem.c
+++ b/menuitem.c
@@ -84,6 +84,8 @@ void cNopacityMenuItem::SetBackgrounds(int *handleBackgrounds) {
void cNopacityMenuItem::DrawDelimiter(const char *del, const char *icon, int handleBgrd) {
pixmap->Fill(Theme.Color(clrSeparatorBorder));
pixmap->DrawImage(cPoint(1, 1), handleBgrd);
+ if (config.roundedCorners)
+ DrawRoundedCorners(Theme.Color(clrSeparatorBorder));
cImageLoader imgLoader;
if (!drawn) {
if (imgLoader.LoadIcon(icon, config.iconHeight)) {
@@ -173,6 +175,22 @@ std::string cNopacityMenuItem::CutText(std::string *text, int width, const cFont
return cuttedText;
}
+void cNopacityMenuItem::DrawRoundedCorners(tColor borderColor) {
+ int radius = config.cornerRadius;
+
+ pixmap->DrawEllipse(cRect(0,0,radius,radius), borderColor, -2);
+ pixmap->DrawEllipse(cRect(-1,-1,radius,radius), clrTransparent, -2);
+
+ pixmap->DrawEllipse(cRect(width-radius,0,radius,radius), borderColor, -1);
+ pixmap->DrawEllipse(cRect(width-radius+1,-1,radius,radius), clrTransparent, -1);
+
+ pixmap->DrawEllipse(cRect(0,height-radius,radius,radius), borderColor, -3);
+ pixmap->DrawEllipse(cRect(-1,height-radius+1,radius,radius), clrTransparent, -3);
+
+ pixmap->DrawEllipse(cRect(width-radius,height-radius,radius,radius), borderColor, -4);
+ pixmap->DrawEllipse(cRect(width-radius+1,height-radius+1,radius,radius), clrTransparent, -4);
+}
+
// cNopacityMainMenuItem -------------
cNopacityMainMenuItem::cNopacityMainMenuItem(cOsd *osd, const char *text, bool sel) : cNopacityMenuItem (osd, text, sel) {
}
@@ -279,6 +297,8 @@ void cNopacityMainMenuItem::Render() {
pixmap->Fill(Theme.Color(clrMenuBorder));
int handleBgrd = (current)?handleBackgrounds[3]:handleBackgrounds[2];
pixmap->DrawImage(cPoint(1, 1), handleBgrd);
+ if (config.roundedCorners)
+ DrawRoundedCorners(Theme.Color(clrMenuBorder));
if (selectable) {
cString cIcon = GetIconName();
if (!drawn) {
@@ -442,6 +462,8 @@ void cNopacityScheduleMenuItem::DrawBackground(int textLeft) {
pixmap->Fill(Theme.Color(clrMenuBorder));
pixmap->DrawImage(cPoint(1, 1), handleBgrd);
pixmap->DrawText(cPoint(textLeft, 3), strDateTime.c_str(), Theme.Color(clrMenuFontMenuItem), clrTransparent, font);
+ if (config.roundedCorners)
+ DrawRoundedCorners(Theme.Color(clrMenuBorder));
if (TimerMatch == tmFull) {
cImageLoader imgLoader;
if (imgLoader.LoadIcon("activetimer", 64, 64)) {
@@ -550,6 +572,8 @@ void cNopacityChannelMenuItem::SetTextShort(void) {
void cNopacityChannelMenuItem::DrawBackground(int handleBackground) {
pixmap->Fill(Theme.Color(clrMenuBorder));
pixmap->DrawImage(cPoint(1, 1), handleBackground);
+ if (config.roundedCorners)
+ DrawRoundedCorners(Theme.Color(clrMenuBorder));
int encryptedSize = height/4-2;
int sourceX = config.menuItemLogoWidth + 15;
@@ -668,6 +692,8 @@ void cNopacityTimerMenuItem::SetTextShort(void) {
void cNopacityTimerMenuItem::DrawBackground(int handleBackground, int textLeft) {
pixmap->Fill(Theme.Color(clrMenuBorder));
pixmap->DrawImage(cPoint(1, 1), handleBackground);
+ if (config.roundedCorners)
+ DrawRoundedCorners(Theme.Color(clrMenuBorder));
int iconSize = height/2;
cString iconName("");
bool firstDay = false;
@@ -952,6 +978,8 @@ void cNopacityRecordingMenuItem::Render() {
if (selectable) {
pixmap->Fill(Theme.Color(clrMenuBorder));
pixmap->DrawImage(cPoint(1, 1), handleBgrd);
+ if (config.roundedCorners)
+ DrawRoundedCorners(Theme.Color(clrMenuBorder));
if (isFolder) {
DrawFolderNewSeen();
SetTextShort();
@@ -1038,6 +1066,8 @@ void cNopacityDefaultMenuItem::Render() {
int handleBgrd = (current)?handleBackgrounds[1]:handleBackgrounds[0];
tColor clrFont = (current)?Theme.Color(clrMenuFontMenuItemHigh):Theme.Color(clrMenuFontMenuItem);
pixmap->DrawImage(cPoint(1, 1), handleBgrd);
+ if (config.roundedCorners)
+ DrawRoundedCorners(Theme.Color(clrMenuBorder));
int colWidth = 0;
int colTextWidth = 0;
cString itemText("");
@@ -1055,7 +1085,9 @@ void cNopacityDefaultMenuItem::Render() {
} else {
itemText = itemTabs[i];
}
- pixmap->DrawText(cPoint(tabWidth[i], (height - font->Height()) / 2), *itemText, clrFont, clrTransparent, font);
+ int posX = tabWidth[i];
+ if (i==0) posX += 5;
+ pixmap->DrawText(cPoint(posX, (height - font->Height()) / 2), *itemText, clrFont, clrTransparent, font);
} else {
if (!Running())
SetTextShort();
@@ -1091,5 +1123,7 @@ void cNopacityTrackMenuItem::Render() {
pixmap->Fill(Theme.Color(clrMenuBorder));
int handleBgrd = (current)?handleBackgrounds[1]:handleBackgrounds[0];
pixmap->DrawImage(cPoint(1, 1), handleBgrd);
+ if (config.roundedCorners)
+ DrawRoundedCorners(Theme.Color(clrMenuBorder));
pixmap->DrawText(cPoint(5, (height - font->Height())/2), Text, Theme.Color(clrTracksFontButtons), clrTransparent, font);
}
diff --git a/menuitem.h b/menuitem.h
index 33ed695..2b4396a 100644
--- a/menuitem.h
+++ b/menuitem.h
@@ -32,6 +32,7 @@ protected:
virtual void Action(void);
void DoSleep(int duration);
std::string CutText(std::string *text, int width, const cFont *font);
+ void DrawRoundedCorners(tColor borderColor);
public:
cNopacityMenuItem(cOsd *osd, const char *text, bool sel);
virtual ~cNopacityMenuItem(void);
diff --git a/po/de_DE.po b/po/de_DE.po
index c0cacc8..6b1cfaf 100644
--- a/po/de_DE.po
+++ b/po/de_DE.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: skinnopacity 0.0.1\n"
"Report-Msgid-Bugs-To: <see README>\n"
-"POT-Creation-Date: 2013-02-12 13:50+0100\n"
+"POT-Creation-Date: 2013-02-12 16:07+0100\n"
"PO-Revision-Date: 2012-11-11 17:49+0200\n"
"Last-Translator: louis\n"
"Language-Team: \n"
@@ -128,6 +128,9 @@ msgstr "Schmales Setup Menü verwenden"
msgid "Scale Video size to fit into menu window"
msgstr "TV-Bildgröße in Menüfenster einpassen"
+msgid "Rounded Corners for menu items and buttons"
+msgstr "Abgerundete Ecken für Menüelemente und Buttons"
+
msgid "Fade-In Time in ms (Zero for switching off fading)"
msgstr "Fade-In Zeit in ms (Null zum Abschalten)"
@@ -188,6 +191,9 @@ msgstr "Breite des Timermenüs (Proz. der OSD Breite)"
msgid "Width of Recordings Menu (Percent of OSD Width)"
msgstr "Breite des Aufzeichnugsmenüs (Proz. der OSD Breite)"
+msgid "Radius of rounded corners"
+msgstr "Radius der abgerundeten Ecken"
+
msgid "Size of Disc Usage (square, Percent of OSD Width)"
msgstr "Größe des Festplattenstatus (quadratisch, Proz. der OSD Breite)"
diff --git a/setup.c b/setup.c
index 289e221..d01d788 100644
--- a/setup.c
+++ b/setup.c
@@ -99,6 +99,8 @@ void cNopacitySetup::Store(void) {
SetupStore("volumeBorderBottom", config.volumeBorderBottom);
SetupStore("fontVolume", config.fontVolume);
SetupStore("scalePicture", config.scalePicture);
+ SetupStore("roundedCorners", config.roundedCorners);
+ SetupStore("cornerRadius", config.cornerRadius);
SetupStore("narrowMainMenu", config.narrowMainMenu);
SetupStore("narrowScheduleMenu", config.narrowScheduleMenu);
SetupStore("narrowChannelMenu", config.narrowChannelMenu);
@@ -220,6 +222,7 @@ void cNopacitySetupMenuDisplay::Set(void) {
Add(new cMenuEditBoolItem(tr("Use narrow recording menu"), &tmpNopacityConfig->narrowRecordingMenu));
Add(new cMenuEditBoolItem(tr("Use narrow setup menu"), &tmpNopacityConfig->narrowSetupMenu));
Add(new cMenuEditBoolItem(tr("Scale Video size to fit into menu window"), &tmpNopacityConfig->scalePicture));
+ Add(new cMenuEditBoolItem(tr("Rounded Corners for menu items and buttons"), &tmpNopacityConfig->roundedCorners));
Add(new cMenuEditIntItem(tr("Fade-In Time in ms (Zero for switching off fading)"), &tmpNopacityConfig->menuFadeTime, 0, 1000));
Add(new cMenuEditBoolItem(tr("Display Disk Usage in main menu"), &tmpNopacityConfig->showDiscUsage));
Add(new cMenuEditBoolItem(tr("Display Timers in main menu"), &tmpNopacityConfig->showTimers));
@@ -254,6 +257,7 @@ void cNopacitySetupMenuDisplayGeometry::Set(void) {
Add(new cMenuEditIntItem(tr("Width of Channels Menu (Percent of OSD Width)"), &tmpNopacityConfig->menuWidthChannels, 10, 100));
Add(new cMenuEditIntItem(tr("Width of Timers Menu (Percent of OSD Width)"), &tmpNopacityConfig->menuWidthTimers, 10, 100));
Add(new cMenuEditIntItem(tr("Width of Recordings Menu (Percent of OSD Width)"), &tmpNopacityConfig->menuWidthRecordings, 10, 100));
+ Add(new cMenuEditIntItem(tr("Radius of rounded corners"), &tmpNopacityConfig->cornerRadius, 5, 30));
Add(new cMenuEditIntItem(tr("Size of Disc Usage (square, Percent of OSD Width)"), &tmpNopacityConfig->menuSizeDiskUsage, 2, 100));
Add(new cMenuEditIntItem(tr("Width of Timers Display (Percent of OSD Width)"), &tmpNopacityConfig->menuWidthRightItems, 5, 100));
Add(new cMenuEditIntItem(tr("Height of EPG Info Window (Percent of OSD Height)"), &tmpNopacityConfig->menuHeightInfoWindow, 10, 100));