summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY5
-rw-r--r--config.c2
-rw-r--r--config.h1
-rw-r--r--displaymenu.c9
-rw-r--r--displaymenuview.c10
-rw-r--r--displayreplay.c4
-rw-r--r--displayvolume.c85
-rw-r--r--displayvolume.h5
-rw-r--r--setup.c2
9 files changed, 93 insertions, 30 deletions
diff --git a/HISTORY b/HISTORY
index 723ef5f..c67b25c 100644
--- a/HISTORY
+++ b/HISTORY
@@ -46,3 +46,8 @@ VDR Plugin 'nOpacity' Revision History
- Avoided some compiler warnings
- Clear Message Box in Menu also if Caller not clears it himself
- Fixed bug when calculating height of schedules menu item
+
+- Fixed a bug displaying wrong colors in replay progressbar (thanks @maverick-me)
+- Fixes a bug that individually set up color buttons were not assumed
+ (thanks @maverick-me)
+- optical redesign of displayVolume (thanks @maverick-me)
diff --git a/config.c b/config.c
index 7368aad..d9fe332 100644
--- a/config.c
+++ b/config.c
@@ -49,6 +49,7 @@ cNopacityConfig::cNopacityConfig() {
volumeFadeTime = 300;
volumeWidth = 40;
volumeHeight = 10;
+ volumeBorderBottom = 10;
fontVolume = 0;
//DisplayMenu
scalePicture = 1;
@@ -165,6 +166,7 @@ bool cNopacityConfig::SetupParse(const char *Name, const char *Value) {
else if (strcmp(Name, "volumeFadeTime") == 0) volumeFadeTime = atoi(Value);
else if (strcmp(Name, "volumeWidth") == 0) volumeWidth = atoi(Value);
else if (strcmp(Name, "volumeHeight") == 0) volumeHeight = atoi(Value);
+ else if (strcmp(Name, "volumeBorderBottom") == 0) volumeBorderBottom = atoi(Value);
else if (strcmp(Name, "fontVolume") == 0) fontVolume = atoi(Value);
else if (strcmp(Name, "menuFadeTime") == 0) menuFadeTime = atoi(Value);
else if (strcmp(Name, "scalePicture") == 0) scalePicture = atoi(Value);
diff --git a/config.h b/config.h
index 507968d..65479dd 100644
--- a/config.h
+++ b/config.h
@@ -71,6 +71,7 @@ class cNopacityConfig {
int volumeFrameTime;
int volumeWidth;
int volumeHeight;
+ int volumeBorderBottom;
int fontVolume;
//DisplayMenu
int scalePicture;
diff --git a/displaymenu.c b/displaymenu.c
index ea1a868..6a2d982 100644
--- a/displaymenu.c
+++ b/displaymenu.c
@@ -214,23 +214,24 @@ void cNopacityDisplayMenu::SetTitle(const char *Title) {
}
void cNopacityDisplayMenu::SetButtons(const char *Red, const char *Green, const char *Yellow, const char *Blue) {
+ tColor lutBg[] = { Theme.Color(clrButtonRedBorder), Theme.Color(clrButtonGreenBorder), Theme.Color(clrButtonYellowBorder), Theme.Color(clrButtonBlueBorder) };
if (Red) {
- menuView->DrawButton(Red, handleButtons[0], Theme.Color(clrButtonRedBorder), 0);
+ menuView->DrawButton(Red, handleButtons[0], lutBg[Setup.ColorKey0], 0);
} else
menuView->ClearButton(0);
if (Green) {
- menuView->DrawButton(Green, handleButtons[1], Theme.Color(clrButtonGreenBorder), 1);
+ menuView->DrawButton(Green, handleButtons[1], lutBg[Setup.ColorKey1], 1);
} else
menuView->ClearButton(1);
if (Yellow) {
- menuView->DrawButton(Yellow, handleButtons[2], Theme.Color(clrButtonYellowBorder), 2);
+ menuView->DrawButton(Yellow, handleButtons[2], lutBg[Setup.ColorKey2], 2);
} else
menuView->ClearButton(2);
if (Blue) {
- menuView->DrawButton(Blue, handleButtons[3], Theme.Color(clrButtonBlueBorder), 3);
+ menuView->DrawButton(Blue, handleButtons[3], lutBg[Setup.ColorKey3], 3);
} else
menuView->ClearButton(3);
}
diff --git a/displaymenuview.c b/displaymenuview.c
index 9bc89d0..abd921c 100644
--- a/displaymenuview.c
+++ b/displaymenuview.c
@@ -253,13 +253,15 @@ void cNopacityDisplayMenuView::CreateBackgroundImages(int *handleBackgrounds, in
imgLoader.DrawBackground(Theme.Color(clrMenuItemHigh), Theme.Color(clrMenuItemHighBlend), menuItemWidthMain-2, menuItemHeightSchedule-2);
handleBackgrounds[5] = cOsdProvider::StoreImage(imgLoader.GetImage());
- imgLoader.DrawBackground(Theme.Color(clrMenuBack), Theme.Color(clrButtonRed), buttonWidth-4, buttonHeight-4);
+ tColor lutBg[] = { Theme.Color(clrButtonRed), Theme.Color(clrButtonGreen), Theme.Color(clrButtonYellow), Theme.Color(clrButtonBlue) };
+
+ imgLoader.DrawBackground(Theme.Color(clrMenuBack), lutBg[Setup.ColorKey0], buttonWidth-4, buttonHeight-4);
handleButtons[0] = cOsdProvider::StoreImage(imgLoader.GetImage());
- imgLoader.DrawBackground(Theme.Color(clrMenuBack), Theme.Color(clrButtonGreen), buttonWidth-4, buttonHeight-4);
+ imgLoader.DrawBackground(Theme.Color(clrMenuBack), lutBg[Setup.ColorKey1], buttonWidth-4, buttonHeight-4);
handleButtons[1] = cOsdProvider::StoreImage(imgLoader.GetImage());
- imgLoader.DrawBackground(Theme.Color(clrMenuBack), Theme.Color(clrButtonYellow), buttonWidth-4, buttonHeight-4);
+ imgLoader.DrawBackground(Theme.Color(clrMenuBack), lutBg[Setup.ColorKey2], buttonWidth-4, buttonHeight-4);
handleButtons[2] = cOsdProvider::StoreImage(imgLoader.GetImage());
- imgLoader.DrawBackground(Theme.Color(clrMenuBack), Theme.Color(clrButtonBlue), buttonWidth-4, buttonHeight-4);
+ imgLoader.DrawBackground(Theme.Color(clrMenuBack), lutBg[Setup.ColorKey3], buttonWidth-4, buttonHeight-4);
handleButtons[3] = cOsdProvider::StoreImage(imgLoader.GetImage());
}
diff --git a/displayreplay.c b/displayreplay.c
index 70beea4..728dd16 100644
--- a/displayreplay.c
+++ b/displayreplay.c
@@ -244,9 +244,9 @@ void cNopacityDisplayReplay::SetProgress(int Current, int Total) {
int barWidth = width - 2*progressBarHeight;
cProgressBar pb(barWidth, progressBarHeight-2, Current, Total, marks, Theme.Color(clrReplayProgressSeen), Theme.Color(clrReplayProgressRest), Theme.Color(clrReplayProgressSelected), Theme.Color(clrReplayProgressMark), Theme.Color(clrReplayProgressCurrent));
pixmapProgressBar->DrawEllipse(cRect(progressBarHeight/2, 0, progressBarHeight, progressBarHeight), Theme.Color(clrProgressBarBack));
- pixmapProgressBar->DrawEllipse(cRect(barWidth + progressBarHeight/2, 0, progressBarHeight, progressBarHeight), Theme.Color(clrProgressBarBack));
+ pixmapProgressBar->DrawEllipse(cRect(barWidth + progressBarHeight/2, 0, progressBarHeight, progressBarHeight), Theme.Color(clrReplayProgressRest));
pixmapProgressBar->DrawRectangle(cRect( progressBarHeight, 0, barWidth, progressBarHeight), Theme.Color(clrProgressBarBack));
- pixmapProgressBar->DrawEllipse(cRect(progressBarHeight/2+1, 1, progressBarHeight-1, progressBarHeight-2), Theme.Color(clrProgressBar));
+ pixmapProgressBar->DrawEllipse(cRect(progressBarHeight/2+1, 1, progressBarHeight-1, progressBarHeight-2), Theme.Color(clrReplayProgressSeen));
pixmapProgressBar->DrawBitmap(cPoint(progressBarHeight, 1), pb);
}
diff --git a/displayvolume.c b/displayvolume.c
index c6e6a81..46eba0c 100644
--- a/displayvolume.c
+++ b/displayvolume.c
@@ -7,20 +7,26 @@ cNopacityDisplayVolume::cNopacityDisplayVolume(void) {
muted = false;
FrameTime = config.volumeFrameTime;
FadeTime = config.volumeFadeTime;
-
- width = cOsd::OsdHeight() * config.volumeWidth / 100;
+
+ width = cOsd::OsdWidth() * config.volumeWidth / 100;
height = cOsd::OsdHeight() * config.volumeHeight / 100;
- int top = (cOsd::OsdHeight() - height) / 2;
+ int top = (cOsd::OsdHeight() - height) - config.volumeBorderBottom;
int left = (cOsd::OsdWidth() - width) / 2;
osd = CreateOsd(left, top, width, height);
- pixmapContent = osd->CreatePixmap(1, cRect(0, 0, width, height));
- pixmapContent->Fill(Theme.Color(clrMenuBorder));
- cImageLoader imgLoader;
- imgLoader.DrawBackground(Theme.Color(clrMenuItem), Theme.Color(clrMenuItemBlend), width-2, height-2);
- pixmapContent->DrawImage(cPoint(1,1), imgLoader.GetImage());
-
+
+ pixmapBackgroundTop = osd->CreatePixmap(1, cRect(0, 0, width, height/2));
+ pixmapBackgroundBottom = osd->CreatePixmap(1, cRect(0, height/2, width, height/2));
+
+ DrawBlendedBackground(pixmapBackgroundTop, Theme.Color(clrChannelBackground), Theme.Color(clrChannelBackBlend), true);
+ DrawBlendedBackground(pixmapBackgroundBottom, Theme.Color(clrChannelBackground), Theme.Color(clrChannelBackBlend), false);
+
+ pixmapBackgroundTop->DrawEllipse(cRect(0, 0, height/4, height/4), clrTransparent, -2);
+ pixmapBackgroundTop->DrawEllipse(cRect(width - height/4, 0, height/4, height/4), clrTransparent, -1);
+ pixmapBackgroundBottom->DrawEllipse(cRect(0, height/4, height/4, height/4), clrTransparent, -3);
+ pixmapBackgroundBottom->DrawEllipse(cRect(width - height/4, height/4, height/4, height/4), clrTransparent, -4);
+
labelHeight = height/3;
pixmapLabel = osd->CreatePixmap(2, cRect(0, 5, width, labelHeight));
progressBarWidth = 0.9 * width;
@@ -30,7 +36,8 @@ cNopacityDisplayVolume::cNopacityDisplayVolume(void) {
pixmapProgressBar = osd->CreatePixmap(2, cRect((width - progressBarWidth) / 2, (height - progressBarHeight)*2/3, progressBarWidth, progressBarHeight));
if (config.volumeFadeTime) {
- pixmapContent->SetAlpha(0);
+ pixmapBackgroundTop->SetAlpha(0);
+ pixmapBackgroundBottom->SetAlpha(0);
pixmapProgressBar->SetAlpha(0);
pixmapLabel->SetAlpha(0);
}
@@ -38,7 +45,8 @@ cNopacityDisplayVolume::cNopacityDisplayVolume(void) {
}
cNopacityDisplayVolume::~cNopacityDisplayVolume() {
- osd->DestroyPixmap(pixmapContent);
+ osd->DestroyPixmap(pixmapBackgroundTop);
+ osd->DestroyPixmap(pixmapBackgroundBottom);
osd->DestroyPixmap(pixmapLabel);
osd->DestroyPixmap(pixmapProgressBar);
delete font;
@@ -53,17 +61,55 @@ void cNopacityDisplayVolume::SetVolume(int Current, int Total, bool Mute) {
cBitmap bmMute(mute_xpm);
pixmapLabel->DrawBitmap(cPoint(width - 2*bmMute.Width(), (labelHeight - bmMute.Height()) / 2), bmMute, Theme.Color(clrDiskAlert), clrTransparent);
}
+ DrawProgressBar(Current, Total);
+}
+
+void cNopacityDisplayVolume::DrawProgressBar(int Current, int Total) {
pixmapProgressBar->Fill(clrTransparent);
double percent = ((double)Current) / (double)Total;
int barWidth = progressBarWidth - progressBarHeight;
- pixmapProgressBar->DrawEllipse(cRect(0, 0, progressBarHeight, progressBarHeight), Theme.Color(clrProgressBarBack));
- pixmapProgressBar->DrawEllipse(cRect(progressBarWidth - progressBarHeight, 0, progressBarHeight, progressBarHeight), Theme.Color(clrProgressBarBack));
- pixmapProgressBar->DrawRectangle(cRect(progressBarHeight/2, 0, progressBarWidth - progressBarHeight, progressBarHeight), Theme.Color(clrProgressBarBack));
- if (Current > 0) {
- pixmapProgressBar->DrawEllipse(cRect(1, 1, progressBarHeight-2, progressBarHeight-2), Theme.Color(clrProgressBar));
- pixmapProgressBar->DrawEllipse(cRect(barWidth * percent - 1, 1, progressBarHeight-2, progressBarHeight-2), Theme.Color(clrProgressBar));
- pixmapProgressBar->DrawRectangle(cRect(progressBarHeight / 2 - 1, 1, barWidth * percent - 2, progressBarHeight - 2), Theme.Color(clrProgressBar));
+ if ((Current > 0) || (Total > 0)) {
+ pixmapProgressBar->DrawEllipse(cRect(0, 0, progressBarHeight, progressBarHeight), Theme.Color(clrProgressBarBack));
+ pixmapProgressBar->DrawEllipse(cRect(progressBarWidth - progressBarHeight, 0, progressBarHeight, progressBarHeight), Theme.Color(clrProgressBarBack));
+ pixmapProgressBar->DrawRectangle(cRect(progressBarHeight/2, 0, progressBarWidth - progressBarHeight, progressBarHeight), Theme.Color(clrProgressBarBack));
+
+ pixmapProgressBar->DrawEllipse(cRect(1, 1, progressBarHeight-2, progressBarHeight-2), Theme.Color(clrProgressBarBlend));
+ if (Current > 0) {
+ tColor colAct = DrawProgressbarBackground(progressBarHeight / 2 - 1, 1, barWidth * percent - 2, progressBarHeight - 2);
+ pixmapProgressBar->DrawEllipse(cRect(barWidth * percent, 1, progressBarHeight-2, progressBarHeight-2), colAct);
+ }
+ }
+}
+
+tColor cNopacityDisplayVolume::DrawProgressbarBackground(int left, int top, int width, int height) {
+
+ tColor clr1 = Theme.Color(clrProgressBar);
+ tColor clr2 = Theme.Color(clrProgressBarBlend);
+ tColor clr = 0x00000000;
+ int step = width / 256;
+ int alpha = 0x0;
+ int alphaStep;
+ int maximum = 0;
+ if (step == 0) { //width < 256
+ step = 1;
+ alphaStep = 256 / width;
+ maximum = width;
+ } else { //width > 256
+ alphaStep = 0x1;
+ maximum = 256;
+ }
+ int x = 0;
+ for (int i = 0; i < maximum; i++) {
+ x = left + i*step;
+ clr = AlphaBlend(clr1, clr2, alpha);
+ pixmapProgressBar->DrawRectangle(cRect(x,top,step,height), clr);
+ alpha += alphaStep;
+ }
+ if (step > 0) {
+ int rest = width - step*256;
+ pixmapProgressBar->DrawRectangle(cRect(left+step*256, top, rest, height), clr);
}
+ return clr;
}
void cNopacityDisplayVolume::Flush(void) {
@@ -81,7 +127,8 @@ void cNopacityDisplayVolume::Action(void) {
cPixmap::Lock();
double t = min(double(Now - Start) / FadeTime, 1.0);
int Alpha = t * ALPHA_OPAQUE;
- pixmapContent->SetAlpha(Alpha);
+ pixmapBackgroundTop->SetAlpha(Alpha);
+ pixmapBackgroundBottom->SetAlpha(Alpha);
pixmapProgressBar->SetAlpha(Alpha);
pixmapLabel->SetAlpha(Alpha);
osd->Flush();
diff --git a/displayvolume.h b/displayvolume.h
index 0ba696e..6217a81 100644
--- a/displayvolume.h
+++ b/displayvolume.h
@@ -11,11 +11,14 @@ private:
int labelHeight;
int progressBarWidth, progressBarHeight;
cOsd *osd;
- cPixmap *pixmapContent;
+ cPixmap *pixmapBackgroundTop;
+ cPixmap *pixmapBackgroundBottom;
cPixmap *pixmapProgressBar;
cPixmap *pixmapLabel;
cFont *font;
virtual void Action(void);
+ void DrawProgressBar(int Current, int Total);
+ tColor DrawProgressbarBackground(int left, int top, int width, int height);
public:
cNopacityDisplayVolume(void);
virtual ~cNopacityDisplayVolume();
diff --git a/setup.c b/setup.c
index 84a2479..92726b1 100644
--- a/setup.c
+++ b/setup.c
@@ -89,6 +89,7 @@ void cNopacitySetup::Store(void) {
SetupStore("volumeFadeTime", config.volumeFadeTime);
SetupStore("volumeWidth", config.volumeWidth);
SetupStore("volumeHeight", config.volumeHeight);
+ SetupStore("volumeBorderBottom", config.volumeBorderBottom);
SetupStore("fontVolume", config.fontVolume);
SetupStore("scalePicture", config.scalePicture);
SetupStore("menuFadeTime", config.menuFadeTime);
@@ -295,6 +296,7 @@ void cNopacitySetupVolumeDisplay::Set(void) {
Add(new cMenuEditIntItem(tr("Fade-In Time in ms (Zero for switching off fading)"), &tmpNopacityConfig->volumeFadeTime, 0, 1000));
Add(new cMenuEditIntItem(tr("Width of Volume Display (Percent of OSD Height)"), &tmpNopacityConfig->volumeWidth, 10, 100));
Add(new cMenuEditIntItem(tr("Hight of Volume Display (Percent of OSD Height)"), &tmpNopacityConfig->volumeHeight, 5, 100));
+ Add(new cMenuEditIntItem(tr("Bottom Border Height"), &tmpNopacityConfig->volumeBorderBottom, 0, 1000));
Add(new cMenuEditIntItem(tr("Adjust Font Size"), &tmpNopacityConfig->fontVolume, -30, 30));
SetCurrent(Get(currentItem));