summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkamel5 <vdr.kamel5 (at) gmx (dot) net>2021-06-18 11:56:56 +0200
committerkamel5 <vdr.kamel5 (at) gmx (dot) net>2021-07-12 14:00:56 +0200
commitc4a7ae1df83fdbd9a8d6a5b78377d8e75d2254be (patch)
tree6adfe7a4ef9761b4751e827505f9e6f6b7c6e0ce
parentbde0fc5d1f2766c7376511a629b8667248242db1 (diff)
downloadskin-nopacity-c4a7ae1df83fdbd9a8d6a5b78377d8e75d2254be.tar.gz
skin-nopacity-c4a7ae1df83fdbd9a8d6a5b78377d8e75d2254be.tar.bz2
Add fade-out to display menu
-rw-r--r--config.c1
-rw-r--r--displaymenu.c36
-rw-r--r--displaymenu.h5
-rw-r--r--menuitem.c22
-rw-r--r--menuitem.h16
-rw-r--r--setup.c1
6 files changed, 53 insertions, 28 deletions
diff --git a/config.c b/config.c
index c883473..0b8fd57 100644
--- a/config.c
+++ b/config.c
@@ -81,6 +81,7 @@ void cNopacityConfig::LoadDefaults(void) {
conf.insert(std::pair<std::string, int>("menuChannelDisplayTime", 1));
conf.insert(std::pair<std::string, int>("numEPGEntriesChannelsMenu", 15));
conf.insert(std::pair<std::string, int>("menuFadeTime", 0));
+ conf.insert(std::pair<std::string, int>("menuFadeOutTime", 0));
conf.insert(std::pair<std::string, int>("menuEPGWindowFadeTime", 300));
conf.insert(std::pair<std::string, int>("menuWidthMain", 30));
conf.insert(std::pair<std::string, int>("menuWidthSchedules", 30));
diff --git a/displaymenu.c b/displaymenu.c
index 4c0c9af..412612f 100644
--- a/displaymenu.c
+++ b/displaymenu.c
@@ -13,8 +13,9 @@ namespace PluginRemoteTimers {
cNopacityDisplayMenu::cNopacityDisplayMenu(void) : cThread("DisplayMenu") {
menuCategoryLast = mcUndefined;
- FadeTime = config.GetValue("menuFadeTime");
- FrameTime = FadeTime / 10;
+ menuFadeTime = config.GetValue("menuFadeTime");
+ menuFadeOutTime = config.GetValue("menuFadeOutTime");
+ fadeout = false;
initial = true;
diskUsageDrawn = false;
timersDrawn = false;
@@ -30,9 +31,17 @@ cNopacityDisplayMenu::cNopacityDisplayMenu(void) : cThread("DisplayMenu") {
}
cNopacityDisplayMenu::~cNopacityDisplayMenu(void) {
- Cancel(-1);
- while (Active())
+ if (osd && menuFadeOutTime) {
+ fadeout = true;
+ Start();
+ }
+ int count = 0;
+ while (Active()) {
cCondWait::SleepMs(10);
+ count++;
+ if (count > 200)
+ Cancel(1);
+ }
if (detailView)
delete detailView;
if (menuView)
@@ -194,6 +203,8 @@ int cNopacityDisplayMenu::MaxItems(void) {
}
void cNopacityDisplayMenu::Clear(void) {
+ if (menuFadeOutTime)
+ return;
DELETENULL(detailView);
menuItems.clear();
}
@@ -360,7 +371,7 @@ bool cNopacityDisplayMenu::SetItemEvent(const cEvent *Event, int Index, bool Cur
}
item->CreatePixmapStatic();
item->CreatePixmapTextScroller(textWidth);
- item->Render(initial);
+ item->Render(initial, fadeout);
} else {
cNopacityMenuItem *item = menuItems[Index].get();
item->SetCurrent(Current);
@@ -391,7 +402,7 @@ bool cNopacityDisplayMenu::SetItemTimer(const cTimer *Timer, int Index, bool Cur
}
item->CreatePixmapStatic();
item->CreatePixmapTextScroller(textWidth);
- item->Render(initial);
+ item->Render(initial, fadeout);
} else {
cNopacityMenuItem *item = menuItems[Index].get();
item->SetCurrent(Current);
@@ -422,7 +433,7 @@ bool cNopacityDisplayMenu::SetItemChannel(const cChannel *Channel, int Index, bo
if (config.GetValue("displayType") == dtGraphical) {
item->CreatePixmapForeground();
}
- item->Render(initial);
+ item->Render(initial, fadeout);
} else {
cNopacityMenuItem *item = menuItems[Index].get();
item->SetCurrent(Current);
@@ -455,7 +466,7 @@ bool cNopacityDisplayMenu::SetItemRecording(const cRecording *Recording, int Ind
if (config.GetValue("displayType") == dtGraphical) {
item->CreatePixmapForeground();
}
- item->Render(initial);
+ item->Render(initial, fadeout);
} else {
cNopacityMenuItem *item = menuItems[Index].get();
item->SetCurrent(Current);
@@ -508,7 +519,7 @@ void cNopacityDisplayMenu::SetItem(const char *Text, int Index, bool Current, bo
item->CreatePixmapStatic();
if (textWidth > 0)
item->CreatePixmapTextScroller(textWidth);
- item->Render(initial);
+ item->Render(initial, fadeout);
}
SetEditableWidth(menuView->GetEditableWidth());
}
@@ -634,7 +645,7 @@ void cNopacityDisplayMenu::Flush(void) {
while (detailView->IsRunning())
cCondWait::SleepMs(10);
if (initial) {
- if (FadeTime) {
+ if (menuFadeTime) {
SetAlpha(0, true);
Start();
}
@@ -645,6 +656,9 @@ void cNopacityDisplayMenu::Flush(void) {
}
void cNopacityDisplayMenu::Action(void) {
+ int x = (fadeout) ? 255 : 0;
+ int FadeTime = (fadeout) ? menuFadeOutTime : menuFadeTime;
+ int FrameTime = FadeTime / 10;
uint64_t First = cTimeMs::Now();
cPixmap::Lock();
cPixmap::Unlock();
@@ -653,7 +667,7 @@ void cNopacityDisplayMenu::Action(void) {
while (Running()) {
uint64_t Now = cTimeMs::Now();
double t = std::min(double(Now - Start) / FadeTime, 1.0);
- int Alpha = t * ALPHA_OPAQUE;
+ int Alpha = std::abs(x - (int(t * ALPHA_OPAQUE)));
cPixmap::Lock();
SetAlpha(Alpha);
if (Running())
diff --git a/displaymenu.h b/displaymenu.h
index dff7ae8..640e970 100644
--- a/displaymenu.h
+++ b/displaymenu.h
@@ -15,8 +15,9 @@ private:
cNopacityDisplayMenuView *menuView;
cNopacityDetailView *detailView;
eMenuCategory menuCategoryLast;
- int FrameTime;
- int FadeTime;
+ int menuFadeTime = 0;
+ int menuFadeOutTime = 0;
+ bool fadeout;
bool initial;
bool diskUsageDrawn;
int lastDiskUsageState;
diff --git a/menuitem.c b/menuitem.c
index b73c96b..6c514c1 100644
--- a/menuitem.c
+++ b/menuitem.c
@@ -414,7 +414,7 @@ void cNopacityMainMenuItem::SetTextShort(void) {
pixmapTextScroller->DrawText(cPoint(x, (height - font->Height())/2), strEntry.c_str(), clrFont, clrTransparent, font);
}
-void cNopacityMainMenuItem::Render(bool initial) {
+void cNopacityMainMenuItem::Render(bool initial, bool fadeout) {
DrawBackground();
if (selectable) {
if (config.GetValue("useMenuIcons")) {
@@ -536,7 +536,7 @@ void cNopacityScheduleMenuItem::SetTextShort(void) {
pixmapTextScroller->DrawText(cPoint(5, titleY + font->Height() - 2), strSubTitle.c_str(), clrFont, clrTransparent, fontSmall);
}
-void cNopacityScheduleMenuItem::Render(bool initial) {
+void cNopacityScheduleMenuItem::Render(bool initial, bool fadeout) {
int logoWidth = geoManager->menuLogoWidth;
int logoHeight = geoManager->menuLogoHeight;
textLeft = 5;
@@ -572,6 +572,7 @@ void cNopacityScheduleMenuItem::Render(bool initial) {
}
if (current && Event) {
if (config.GetValue("menuSchedulesWindowMode") == 0) {
+ if (!fadeout) {
//window mode
infoTextWindow = new cNopacityTextWindow(osd, fontEPGWindow, vidWin);
infoTextWindow->SetGeometry(textWindow);
@@ -579,6 +580,7 @@ void cNopacityScheduleMenuItem::Render(bool initial) {
infoTextWindow->SetPoster(Event, NULL);
infoTextWindow->SetInitial(initial);
infoTextWindow->Start();
+ }
} else {
//fullscreen mode
infoTextWindow = new cNopacityTextWindow(osd, fontEPGWindow, fontEPGWindowLarge);
@@ -896,7 +898,7 @@ std::string cNopacityChannelMenuItem::readEPG(void) {
return sstrText.str();
}
-void cNopacityChannelMenuItem::Render(bool initial) {
+void cNopacityChannelMenuItem::Render(bool initial, bool fadeout) {
if (selectable) { //Channels
DrawBackground();
DrawChannelLogoBackground();
@@ -922,11 +924,13 @@ void cNopacityChannelMenuItem::Render(bool initial) {
infoTextWindow = NULL;
}
if (current && Channel && (config.GetValue("menuChannelDisplayMode") == 0)) {
+ if (!fadeout) {
infoTextWindow = new cNopacityTextWindow(osd, fontEPGWindow, vidWin);
infoTextWindow->SetGeometry(textWindow);
infoTextWindow->SetText(readEPG().c_str());
infoTextWindow->SetInitial(initial);
infoTextWindow->Start();
+ }
}
} else { //Channelseparators
DrawDelimiter(Channel->Name(), "skinIcons/channeldelimiter", (config.GetValue("displayType")!=dtFlat )?seChannels:seNone);
@@ -1069,7 +1073,7 @@ void cNopacityTimerMenuItem::DrawBackground(int textLeft) {
pixmapStatic->DrawText(cPoint(textLeft + iconSize, (height/2 - fontSmall->Height())/2), *dateTime, clrFont, clrTransparent, fontSmall);
}
-void cNopacityTimerMenuItem::Render(bool initial) {
+void cNopacityTimerMenuItem::Render(bool initial, bool fadeout) {
textLeft = geoManager->menuLogoWidth + geoManager->menuSpace;
if (selectable) {
DrawBackground(textLeft);
@@ -1098,6 +1102,7 @@ void cNopacityTimerMenuItem::Render(bool initial) {
const cEvent *Event = Timer->Event();
if (current && Event) {
if (config.GetValue("menuTimersWindowMode") == 0) {
+ if (!fadeout) {
//window mode
infoTextWindow = new cNopacityTextWindow(osd, fontEPGWindow, vidWin);
infoTextWindow->SetGeometry(textWindow);
@@ -1105,6 +1110,7 @@ void cNopacityTimerMenuItem::Render(bool initial) {
infoTextWindow->SetPoster(Event, NULL, false);
infoTextWindow->SetInitial(initial);
infoTextWindow->Start();
+ }
} else {
//fullscreen mode
infoTextWindow = new cNopacityTextWindow(osd, fontEPGWindow, fontEPGWindowLarge);
@@ -1416,7 +1422,7 @@ void cNopacityRecordingMenuItem::DrawPoster(void) {
}
}
-void cNopacityRecordingMenuItem::Render(bool initial) {
+void cNopacityRecordingMenuItem::Render(bool initial, bool fadeout) {
if (selectable) {
DrawBackground();
if (isFolder) {
@@ -1449,6 +1455,7 @@ void cNopacityRecordingMenuItem::Render(bool initial) {
}
if (current) {
if (config.GetValue("menuRecordingsWindowMode") == 0) {
+ if (!fadeout) {
//window mode
infoTextWindow = new cNopacityTextWindow(osd, fontEPGWindow, vidWin);
infoTextWindow->SetGeometry(textWindow);
@@ -1457,6 +1464,7 @@ void cNopacityRecordingMenuItem::Render(bool initial) {
infoTextWindow->SetPoster(NULL, Recording);
infoTextWindow->SetInitial(initial);
infoTextWindow->Start();
+ }
} else {
//fullscreen mode
infoTextWindow = new cNopacityTextWindow(osd, fontEPGWindow, fontEPGWindowLarge);
@@ -1621,7 +1629,7 @@ bool cNopacityDefaultMenuItem::DrawHeaderElement(void) {
return false;
}
-void cNopacityDefaultMenuItem::Render(bool initial) {
+void cNopacityDefaultMenuItem::Render(bool initial, bool fadeout) {
DrawBackground();
pixmapStatic->Fill(clrTransparent);
@@ -1689,7 +1697,7 @@ cNopacityTrackMenuItem::cNopacityTrackMenuItem(cOsd *osd, const char *text) : cN
cNopacityTrackMenuItem::~cNopacityTrackMenuItem(void) {
}
-void cNopacityTrackMenuItem::Render(bool initial) {
+void cNopacityTrackMenuItem::Render(bool initial, bool fadeout) {
eSkinElementType type = (current)?seTracksHigh:seTracks;
if (config.GetValue("displayType") == dtBlending) {
pixmapBackground->Fill(Theme.Color(clrMenuBorder));
diff --git a/menuitem.h b/menuitem.h
index a3bc30e..29c4059 100644
--- a/menuitem.h
+++ b/menuitem.h
@@ -54,7 +54,7 @@ public:
virtual void CreateText(void) {};
virtual void SetPoster(void) {};
virtual int CheckScrollable(bool hasIcon) {return 0;};
- virtual void Render(bool initial = false) = 0;
+ virtual void Render(bool initial = false, bool fadeout = false) = 0;
};
// avoid confusion between vdr swap() and std::swap() for std::unique_ptr<cNopacityMenuItem>
@@ -78,7 +78,7 @@ public:
void CreatePixmapTextScroller(int totalWidth);
void CreateText(void);
int CheckScrollable(bool hasIcon);
- void Render(bool initial = false);
+ void Render(bool initial = false, bool fadeout = false);
};
class cNopacityScheduleMenuItem : public cNopacityMenuItem {
@@ -107,7 +107,7 @@ public:
void CreatePixmapTextScroller(int totalWidth);
void CreateText(void);
int CheckScrollable(bool hasIcon);
- void Render(bool initial = false);
+ void Render(bool initial = false, bool fadeout = false);
};
class cNopacityChannelMenuItem : public cNopacityMenuItem {
@@ -132,7 +132,7 @@ public:
void CreatePixmapTextScroller(int totalWidth);
void CreateText(void);
int CheckScrollable(bool hasIcon);
- void Render(bool initial = false);
+ void Render(bool initial = false, bool fadeout = false);
};
class cNopacityTimerMenuItem : public cNopacityMenuItem {
@@ -153,7 +153,7 @@ public:
void CreatePixmapTextScroller(int totalWidth);
void CreateText(void);
int CheckScrollable(bool hasIcon);
- void Render(bool initial = false);
+ void Render(bool initial = false, bool fadeout = false);
};
class cNopacityRecordingMenuItem : public cNopacityMenuItem {
@@ -192,7 +192,7 @@ public:
void CreateText(void);
void SetPoster(void);
int CheckScrollable(bool hasIcon);
- void Render(bool initial = false);
+ void Render(bool initial = false, bool fadeout = false);
};
class cNopacityDefaultMenuItem : public cNopacityMenuItem {
@@ -210,7 +210,7 @@ public:
cNopacityDefaultMenuItem(cOsd *osd, const char *text, bool sel);
~cNopacityDefaultMenuItem(void);
int CheckScrollable(bool hasIcon);
- void Render(bool initial = false);
+ void Render(bool initial = false, bool fadeout = false);
};
class cNopacityTrackMenuItem : public cNopacityMenuItem {
@@ -218,6 +218,6 @@ private:
public:
cNopacityTrackMenuItem(cOsd *osd, const char *text);
~cNopacityTrackMenuItem(void);
- void Render(bool initial = false);
+ void Render(bool initial = false, bool fadeout = false);
};
#endif //__NOPACITY_MENUITEM_H
diff --git a/setup.c b/setup.c
index 912f615..2e908c0 100644
--- a/setup.c
+++ b/setup.c
@@ -163,6 +163,7 @@ void cNopacitySetupMenuDisplay::Set(void) {
Add(new cMenuEditIntItem(cString::sprintf("%s%s", *spacer, tr("Radius of rounded corners")), tmpConf->GetValueRef("cornerRadius"), 5, 30));
Add(new cMenuEditBoolItem(tr("Use Channel Logo background"), tmpConf->GetValueRef("menuChannelLogoBackground")));
Add(new cMenuEditIntItem(tr("Fade-In Time in ms (Zero for switching off fading)"), tmpConf->GetValueRef("menuFadeTime"), 0, 1000));
+ Add(new cMenuEditIntItem(tr("Fade-In Time in ms (Zero for switching off fading)"), tmpConf->GetValueRef("menuFadeOutTime"), 0, 1000));
Add(new cMenuEditStraItem(tr("Menu Items Scroll Style"), tmpConf->GetValueRef("scrollMode"), 2, scrollMode));
Add(new cMenuEditStraItem(tr("Menu Items Scrolling Speed"), tmpConf->GetValueRef("menuScrollSpeed"), 4, scrollSpeed));
Add(new cMenuEditIntItem(tr("Menu Items Scrolling Delay in s"), tmpConf->GetValueRef("menuScrollDelay"), 0, 3));