summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkamel5 <vdr.kamel5 (at) gmx (dot) net>2021-06-06 14:59:51 +0200
committerkamel5 <vdr.kamel5 (at) gmx (dot) net>2021-07-12 13:53:53 +0200
commitbde0fc5d1f2766c7376511a629b8667248242db1 (patch)
treedb6f1504a6688213f9cea6724df9083bf19bcfac
parent0d8dc799b8ffc13784ca80a62deae6b53cc655bc (diff)
downloadskin-nopacity-bde0fc5d1f2766c7376511a629b8667248242db1.tar.gz
skin-nopacity-bde0fc5d1f2766c7376511a629b8667248242db1.tar.bz2
Optimize Flush in display menu
These changes ensures that only one flush is active when the fade-in thread is running. The first Pixmap::Lock() in cNopacityDisplayMenu::Action() takes so much longer than the following, Thats why the first Pixmap::Lock() was moved before the while loop. This makes the fade-in softer. The DetailView thread was eliminated.
-rw-r--r--detailview.c115
-rw-r--r--detailview.h12
-rw-r--r--displaymenu.c100
-rw-r--r--displaymenu.h1
-rw-r--r--displaymenuview.c52
-rw-r--r--displaymenuview.h5
-rw-r--r--menudetailview.c8
-rw-r--r--menudetailview.h1
-rw-r--r--menuitem.c18
-rw-r--r--menuitem.h16
-rw-r--r--textwindow.c12
-rw-r--r--textwindow.h2
12 files changed, 164 insertions, 178 deletions
diff --git a/detailview.c b/detailview.c
index beb267d..a40af99 100644
--- a/detailview.c
+++ b/detailview.c
@@ -4,7 +4,7 @@
* cNopacityView
********************************************************************************************/
-cNopacityView::cNopacityView(cOsd *osd) : cThread("DetailView") {
+cNopacityView::cNopacityView(cOsd *osd) {
this->osd = osd;
activeView = 0;
scrollable = false;
@@ -54,7 +54,7 @@ cNopacityView::~cNopacityView(void) {
osd->DestroyPixmap(pixmapTabs);
}
-void cNopacityView::SetGeometry(int x, int y, int width, int height, int border, int headerHeight) {
+void cNopacityView::SetGeometry(int x, int y, int width, int height, int border, int headerHeight) {
this->x = x;
this->y = y;
this->width = width;
@@ -126,7 +126,7 @@ void cNopacityView::DrawTabs(void) {
}
void cNopacityView::ClearContent(void) {
- if (pixmapContent && Running()) {
+ if (pixmapContent) {
osd->DestroyPixmap(pixmapContent);
pixmapContent = NULL;
}
@@ -195,13 +195,13 @@ void cNopacityView::DrawFloatingContent(std::string *infoText, cTvMedia *img, cT
}
cImageLoader imgLoader;
if (imgLoader.LoadPoster(img->path.c_str(), imgWidth, imgHeight)) {
- if (Running() && pixmapContent)
+ if (pixmapContent)
pixmapContent->DrawImage(cPoint(width - imgWidth - border, border), imgLoader.GetImage());
}
if (!img2)
return;
if (imgLoader.LoadPoster(img2->path.c_str(), imgWidth2, imgHeight2)) {
- if (Running() && pixmapContent)
+ if (pixmapContent)
pixmapContent->DrawImage(cPoint(width - imgWidth2 - border, imgHeight + 2*border), imgLoader.GetImage());
}
}
@@ -295,14 +295,10 @@ void cNopacityView::DrawActors(std::vector<cActor> *actors) {
int x = 0;
int y = 2 * border + fontHeaderLarge->Height();
- if (!Running())
- return;
cImageLoader imgLoader;
int actor = 0;
for (int row = 0; row < picLines; row++) {
for (int col = 0; col < picsPerLine; col++) {
- if (!Running())
- return;
if (actor == numActors)
break;
std::string path = actors->at(actor).actorThumb.path;
@@ -311,7 +307,7 @@ void cNopacityView::DrawActors(std::vector<cActor> *actors) {
sstrRole << "\"" << actors->at(actor).role << "\"";
std::string role = sstrRole.str();
if (imgLoader.LoadPoster(path.c_str(), thumbWidth, thumbHeight)) {
- if (Running() && pixmapContent)
+ if (pixmapContent)
pixmapContent->DrawImage(cPoint(x + border, y), imgLoader.GetImage());
}
@@ -321,7 +317,7 @@ void cNopacityView::DrawActors(std::vector<cActor> *actors) {
role = CutText(role, thumbWidth + 2*border, fontSmall);
int xName = x + ((thumbWidth+2*border) - fontSmall->Width(name.c_str()))/2;
int xRole = x + ((thumbWidth+2*border) - fontSmall->Width(role.c_str()))/2;
- if (Running() && pixmapContent) {
+ if (pixmapContent) {
pixmapContent->DrawText(cPoint(xName, y + thumbHeight + border/2), name.c_str(), Theme.Color(clrMenuFontDetailViewText), clrTransparent, fontSmall);
pixmapContent->DrawText(cPoint(xRole, y + thumbHeight + border/2 + fontSmall->Height()), role.c_str(), Theme.Color(clrMenuFontDetailViewText), clrTransparent, fontSmall);
x += thumbWidth + 2*border;
@@ -363,7 +359,7 @@ void cNopacityView::DrawScrollbar(void) {
pixmapScrollbar->DrawRectangle(cRect(3,3 + barTop,geoManager->menuWidthScrollbar-6,barHeight), Theme.Color(clrMenuScrollBar));
}
-bool cNopacityView::KeyUp(void) {
+bool cNopacityView::KeyUp(void) {
if (!scrollable)
return false;
int aktHeight = pixmapContent->DrawPort().Point().Y();
@@ -379,7 +375,7 @@ bool cNopacityView::KeyUp(void) {
return true;
}
-bool cNopacityView::KeyDown(void) {
+bool cNopacityView::KeyDown(void) {
if (!scrollable)
return false;
int aktHeight = pixmapContent->DrawPort().Point().Y();
@@ -409,9 +405,6 @@ cNopacityEPGView::cNopacityEPGView(cOsd *osd) : cNopacityView(osd) {
}
cNopacityEPGView::~cNopacityEPGView(void) {
- Cancel(-1);
- while (Active())
- cCondWait::SleepMs(10);
if (pixmapHeaderEPGImage)
osd->DestroyPixmap(pixmapHeaderEPGImage);
}
@@ -423,6 +416,10 @@ void cNopacityEPGView::SetAlpha(int Alpha) {
pixmapContent->SetAlpha(Alpha);
if (pixmapHeaderEPGImage)
pixmapHeaderEPGImage->SetAlpha(Alpha);
+ if (pixmapScrollbar)
+ pixmapScrollbar->SetAlpha(Alpha);
+ if (pixmapScrollbarBack)
+ pixmapScrollbarBack->SetAlpha(Alpha);
}
void cNopacityEPGView::SetTabs(void) {
@@ -543,26 +540,21 @@ void cNopacityEPGView::DrawImages(void) {
}
}
-void cNopacityEPGView::KeyLeft(void) {
- if (Running())
- return;
+void cNopacityEPGView::KeyLeft(void) {
activeView--;
if (activeView < 0)
activeView = numTabs - 1;
}
-void cNopacityEPGView::KeyRight(void) {
- if (Running())
- return;
+void cNopacityEPGView::KeyRight(void) {
activeView = (activeView + 1) % numTabs;
}
-void cNopacityEPGView::Action(void) {
+void cNopacityEPGView::Render(void) {
ClearContent();
if (!headerDrawn) {
DrawHeader();
DrawHeaderEPGImage();
-// osd->Flush();
headerDrawn = true;
}
if (tabs.size() == 0) {
@@ -582,7 +574,6 @@ void cNopacityEPGView::Action(void) {
break;
}
DrawScrollbar();
- osd->Flush();
}
/********************************************************************************************
@@ -598,9 +589,6 @@ cNopacitySeriesView::cNopacitySeriesView(cOsd *osd, int seriesId, int episodeId)
}
cNopacitySeriesView::~cNopacitySeriesView(void) {
- Cancel(-1);
- while (Active())
- cCondWait::SleepMs(10);
if (pixmapHeaderBanner)
osd->DestroyPixmap(pixmapHeaderBanner);
}
@@ -612,6 +600,10 @@ void cNopacitySeriesView::SetAlpha(int Alpha) {
pixmapContent->SetAlpha(Alpha);
if (pixmapHeaderBanner)
pixmapHeaderBanner->SetAlpha(Alpha);
+ if (pixmapScrollbar)
+ pixmapScrollbar->SetAlpha(Alpha);
+ if (pixmapScrollbarBack)
+ pixmapScrollbarBack->SetAlpha(Alpha);
}
void cNopacitySeriesView::LoadMedia(void) {
@@ -706,7 +698,7 @@ void cNopacitySeriesView::DrawHeaderBanner(void) {
pixmapHeaderBanner->Fill(clrTransparent);
cImageLoader imgLoader;
- if (imgLoader.LoadPoster(bannerPath.c_str(), bannerWidth, bannerHeight) && Running()) {
+ if (imgLoader.LoadPoster(bannerPath.c_str(), bannerWidth, bannerHeight)) {
pixmapHeaderBanner->DrawImage(cPoint(bannerX, bannerY), imgLoader.GetImage());
}
}
@@ -749,29 +741,29 @@ void cNopacitySeriesView::DrawImages(void) {
int yPic = border;
for (int i=0; i < numFanarts; i++) {
if (numBanners > i) {
- if (imgLoader.LoadPoster(series.banners[i].path.c_str(), series.banners[i].width, series.banners[i].height) && Running()) {
+ if (imgLoader.LoadPoster(series.banners[i].path.c_str(), series.banners[i].width, series.banners[i].height)) {
pixmapContent->DrawImage(cPoint((width - series.banners[i].width) / 2, yPic), imgLoader.GetImage());
yPic += series.banners[i].height + border;
}
}
- if (imgLoader.LoadPoster(series.fanarts[i].path.c_str(), fanartWidth, fanartHeight) && Running()) {
+ if (imgLoader.LoadPoster(series.fanarts[i].path.c_str(), fanartWidth, fanartHeight)) {
pixmapContent->DrawImage(cPoint((width - fanartWidth)/2, yPic), imgLoader.GetImage());
yPic += fanartHeight + border;
}
}
if (numPosters >= 1) {
- if (imgLoader.LoadPoster(series.posters[0].path.c_str(), posterWidth, posterHeight) && Running()) {
+ if (imgLoader.LoadPoster(series.posters[0].path.c_str(), posterWidth, posterHeight)) {
pixmapContent->DrawImage(cPoint(border, yPic), imgLoader.GetImage());
yPic += posterHeight + border;
}
}
if (numPosters >= 2) {
- if (imgLoader.LoadPoster(series.posters[1].path.c_str(), posterWidth, posterHeight) && Running()) {
+ if (imgLoader.LoadPoster(series.posters[1].path.c_str(), posterWidth, posterHeight)) {
pixmapContent->DrawImage(cPoint(2 * border + posterWidth, yPic - posterHeight - border), imgLoader.GetImage());
}
}
if (numPosters == 3) {
- if (imgLoader.LoadPoster(series.posters[2].path.c_str(), posterWidth, posterHeight) && Running()) {
+ if (imgLoader.LoadPoster(series.posters[2].path.c_str(), posterWidth, posterHeight)) {
pixmapContent->DrawImage(cPoint((width - posterWidth) / 2, yPic), imgLoader.GetImage());
}
}
@@ -786,26 +778,21 @@ int cNopacitySeriesView::GetRandomPoster(void) {
return randPoster;
}
-void cNopacitySeriesView::KeyLeft(void) {
- if (Running())
- return;
+void cNopacitySeriesView::KeyLeft(void) {
activeView--;
if (activeView < 0)
activeView = mvtCount - 1;
}
-void cNopacitySeriesView::KeyRight(void) {
- if (Running())
- return;
+void cNopacitySeriesView::KeyRight(void) {
activeView = (activeView + 1) % mvtCount;
}
-void cNopacitySeriesView::Action(void) {
+void cNopacitySeriesView::Render(void) {
ClearContent();
if (!headerDrawn) {
DrawHeader();
DrawHeaderBanner();
-// osd->Flush();
headerDrawn = true;
}
if (tabs.size() == 0) {
@@ -847,7 +834,6 @@ void cNopacitySeriesView::Action(void) {
break;
}
DrawScrollbar();
- osd->Flush();
}
/********************************************************************************************
@@ -861,9 +847,6 @@ cNopacityMovieView::cNopacityMovieView(cOsd *osd, int movieId) : cNopacityView(o
}
cNopacityMovieView::~cNopacityMovieView(void) {
- Cancel(-1);
- while (Active())
- cCondWait::SleepMs(10);
if (pixmapHeaderPoster)
osd->DestroyPixmap(pixmapHeaderPoster);
}
@@ -875,6 +858,10 @@ void cNopacityMovieView::SetAlpha(int Alpha) {
pixmapContent->SetAlpha(Alpha);
if (pixmapHeaderPoster)
pixmapHeaderPoster->SetAlpha(Alpha);
+ if (pixmapScrollbar)
+ pixmapScrollbar->SetAlpha(Alpha);
+ if (pixmapScrollbarBack)
+ pixmapScrollbarBack->SetAlpha(Alpha);
}
void cNopacityMovieView::LoadMedia(void) {
@@ -957,7 +944,7 @@ void cNopacityMovieView::DrawHeaderPoster(void) {
pixmapHeaderPoster->Fill(clrTransparent);
cImageLoader imgLoader;
- if (imgLoader.LoadPoster(movie.poster.path.c_str(), posterWidth, posterHeight) && Running()) {
+ if (imgLoader.LoadPoster(movie.poster.path.c_str(), posterWidth, posterHeight)) {
pixmapHeaderPoster->DrawImage(cPoint(posterX, posterY), imgLoader.GetImage());
}
}
@@ -1002,51 +989,46 @@ void cNopacityMovieView::DrawImages(void) {
cImageLoader imgLoader;
int yPic = border;
if (movie.fanart.width > 0 && movie.fanart.height > 0 && movie.fanart.path.size() > 0) {
- if (imgLoader.LoadPoster(movie.fanart.path.c_str(), fanartWidth, fanartHeight) && Running()) {
+ if (imgLoader.LoadPoster(movie.fanart.path.c_str(), fanartWidth, fanartHeight)) {
pixmapContent->DrawImage(cPoint((width - fanartWidth)/2, yPic), imgLoader.GetImage());
yPic += fanartHeight + border;
}
}
if (movie.collectionFanart.width > 0 && movie.collectionFanart.height > 0 && movie.collectionFanart.path.size() > 0) {
- if (imgLoader.LoadPoster(movie.collectionFanart.path.c_str(), collectionFanartWidth, collectionFanartHeight) && Running()) {
+ if (imgLoader.LoadPoster(movie.collectionFanart.path.c_str(), collectionFanartWidth, collectionFanartHeight)) {
pixmapContent->DrawImage(cPoint((width - collectionFanartWidth)/2, yPic), imgLoader.GetImage());
yPic += collectionFanartHeight + border;
}
}
if (movie.poster.width > 0 && movie.poster.height > 0 && movie.poster.path.size() > 0) {
- if (imgLoader.LoadPoster(movie.poster.path.c_str(), movie.poster.width, movie.poster.height) && Running()) {
+ if (imgLoader.LoadPoster(movie.poster.path.c_str(), movie.poster.width, movie.poster.height)) {
pixmapContent->DrawImage(cPoint((width - movie.poster.width) / 2, yPic), imgLoader.GetImage());
yPic += movie.poster.height + border;
}
}
if (movie.collectionPoster.width > 0 && movie.collectionPoster.height > 0 && movie.collectionPoster.path.size() > 0) {
- if (imgLoader.LoadPoster(movie.collectionPoster.path.c_str(), movie.collectionPoster.width, movie.collectionPoster.height) && Running()) {
+ if (imgLoader.LoadPoster(movie.collectionPoster.path.c_str(), movie.collectionPoster.width, movie.collectionPoster.height)) {
pixmapContent->DrawImage(cPoint((width - movie.collectionPoster.width) / 2, yPic), imgLoader.GetImage());
yPic += movie.collectionPoster.height + border;
}
}
}
-void cNopacityMovieView::KeyLeft(void) {
- if (Running())
- return;
+void cNopacityMovieView::KeyLeft(void) {
activeView--;
if (activeView < 0)
activeView = mvtCount - 1;
}
-void cNopacityMovieView::KeyRight(void) {
- if (Running())
- return;
+void cNopacityMovieView::KeyRight(void) {
activeView = (activeView + 1) % mvtCount;
}
-void cNopacityMovieView::Action(void) {
+void cNopacityMovieView::Render(void) {
ClearContent();
if (!headerDrawn) {
DrawHeader();
DrawHeaderPoster();
-// osd->Flush();
headerDrawn = true;
}
if (tabs.size() == 0) {
@@ -1082,7 +1064,6 @@ void cNopacityMovieView::Action(void) {
break;
}
DrawScrollbar();
- osd->Flush();
}
/********************************************************************************************
@@ -1093,9 +1074,6 @@ cNopacityTextView::cNopacityTextView(cOsd *osd) : cNopacityView(osd) {
}
cNopacityTextView::~cNopacityTextView(void) {
- Cancel(-1);
- while (Active())
- cCondWait::SleepMs(10);
}
void cNopacityTextView::SetAlpha(int Alpha) {
@@ -1103,6 +1081,10 @@ void cNopacityTextView::SetAlpha(int Alpha) {
pixmapTabs->SetAlpha(Alpha);
pixmapContentBack->SetAlpha(Alpha);
pixmapContent->SetAlpha(Alpha);
+ if (pixmapScrollbar)
+ pixmapScrollbar->SetAlpha(Alpha);
+ if (pixmapScrollbarBack)
+ pixmapScrollbarBack->SetAlpha(Alpha);
}
void cNopacityTextView::KeyLeft(void) {
@@ -1115,10 +1097,9 @@ void cNopacityTextView::KeyLeft(void) {
newY = 0;
pixmapContent->SetDrawPortPoint(cPoint(0, newY));
DrawScrollbar();
- osd->Flush();
}
-void cNopacityTextView::KeyRight(void) {
+void cNopacityTextView::KeyRight(void) {
if (!pixmapContent)
return;
int aktHeight = pixmapContent->DrawPort().Point().Y();
@@ -1129,13 +1110,11 @@ void cNopacityTextView::KeyRight(void) {
newY = (-1)*(totalHeight - screenHeight);
pixmapContent->SetDrawPortPoint(cPoint(0, newY));
DrawScrollbar();
- osd->Flush();
}
-void cNopacityTextView::Action(void) {
+void cNopacityTextView::Render(void) {
if (pixmapContent)
return;
DrawContent(&infoText);
DrawScrollbar();
- osd->Flush();
}
diff --git a/detailview.h b/detailview.h
index 5a7fca2..3454b28 100644
--- a/detailview.h
+++ b/detailview.h
@@ -28,7 +28,7 @@ enum eMediaViewTabs {
mvtCount
};
-class cNopacityView : public cThread {
+class cNopacityView {
protected:
cOsd *osd;
cPixmap *pixmapHeader;
@@ -87,7 +87,7 @@ public:
virtual void KeyLeft(void) {};
virtual void KeyRight(void) {};
void DrawScrollbar(void);
- virtual void Action(void) {};
+ virtual void Render(void) {};
};
class cNopacityEPGView : public cNopacityView {
@@ -106,7 +106,7 @@ public:
void SetAlpha(int Alpha = 0);
void KeyLeft(void);
void KeyRight(void);
- void Action(void);
+ void Render(void);
};
class cNopacitySeriesView : public cNopacityView {
@@ -128,7 +128,7 @@ public:
void LoadMedia(void);
void KeyLeft(void);
void KeyRight(void);
- void Action(void);
+ void Render(void);
};
class cNopacityMovieView : public cNopacityView {
@@ -148,7 +148,7 @@ public:
void LoadMedia(void);
void KeyLeft(void);
void KeyRight(void);
- void Action(void);
+ void Render(void);
};
class cNopacityTextView : public cNopacityView {
@@ -159,7 +159,7 @@ public:
void SetAlpha(int Alpha = 0);
void KeyLeft(void);
void KeyRight(void);
- void Action(void);
+ void Render(void);
};
#endif //__NOPACITY_DETAILVIEW_H
diff --git a/displaymenu.c b/displaymenu.c
index 474969f..4c0c9af 100644
--- a/displaymenu.c
+++ b/displaymenu.c
@@ -33,10 +33,10 @@ cNopacityDisplayMenu::~cNopacityDisplayMenu(void) {
Cancel(-1);
while (Active())
cCondWait::SleepMs(10);
- if (detailView) {
+ if (detailView)
delete detailView;
- }
- delete menuView;
+ if (menuView)
+ delete menuView;
menuItems.clear();
timers.Clear();
delete osd;
@@ -109,9 +109,6 @@ void cNopacityDisplayMenu::DrawTimers(bool timersChanged, int numConflicts) {
int currentHeight = menuView->GetTimersInitHeight();
if (numConflicts > 0) {
cNopacityTimer *t = menuView->DrawTimerConflict(numConflicts, currentHeight);
- if (initial)
- if (FadeTime)
- t->SetAlpha(0);
currentHeight += t->GetHeight() + geoManager->menuSpace;
timers.Add(t);
}
@@ -120,9 +117,6 @@ void cNopacityDisplayMenu::DrawTimers(bool timersChanged, int numConflicts) {
if (const cTimer *Timer = SortedTimers[i]) {
if (Timer->HasFlags(tfActive)) {
cNopacityTimer *t = menuView->DrawTimer(Timer, currentHeight);
- if (initial)
- if (FadeTime)
- t->SetAlpha(0);
currentHeight += t->GetHeight() + geoManager->menuSpace;
if (currentHeight < maxTimersHeight) {
timers.Add(t);
@@ -257,6 +251,7 @@ void cNopacityDisplayMenu::SetMenuCategory(eMenuCategory MenuCategory) {
void cNopacityDisplayMenu::SetTitle(const char *Title) {
//resetting menuitems if no call to clear
+ DELETENULL(detailView);
menuItems.clear();
int left = 5;
menuView->DestroyHeaderIcon();
@@ -279,16 +274,16 @@ void cNopacityDisplayMenu::SetTitle(const char *Title) {
break;
case mcSchedule:
menuView->ShowHeaderLogo(false);
- left += menuView->ShowHeaderIconChannelLogo(Title);
+ left += menuView->ShowHeaderIconChannelLogo(Title, initial);
break;
case mcRecording:
menuView->ShowHeaderLogo(false);
title = cString::sprintf("%s (%s)", Title, *cVideoDiskUsage::String());
- left += menuView->DrawHeaderIcon(MenuCategory());
+ left += menuView->DrawHeaderIcon(MenuCategory(), initial);
break;
default:
menuView->ShowHeaderLogo(false);
- left += menuView->DrawHeaderIcon(MenuCategory());
+ left += menuView->DrawHeaderIcon(MenuCategory(), initial);
}
menuView->AdjustContentBackground(this->MenuCategory(), menuCategoryLast, videoWindowRect);
menuView->DrawHeaderLabel(left, title);
@@ -365,12 +360,7 @@ bool cNopacityDisplayMenu::SetItemEvent(const cEvent *Event, int Index, bool Cur
}
item->CreatePixmapStatic();
item->CreatePixmapTextScroller(textWidth);
- item->Render();
- if (initial) {
- if (FadeTime) {
- item->SetAlpha(0);
- }
- }
+ item->Render(initial);
} else {
cNopacityMenuItem *item = menuItems[Index].get();
item->SetCurrent(Current);
@@ -401,12 +391,7 @@ bool cNopacityDisplayMenu::SetItemTimer(const cTimer *Timer, int Index, bool Cur
}
item->CreatePixmapStatic();
item->CreatePixmapTextScroller(textWidth);
- item->Render();
- if (initial) {
- if (FadeTime) {
- item->SetAlpha(0);
- }
- }
+ item->Render(initial);
} else {
cNopacityMenuItem *item = menuItems[Index].get();
item->SetCurrent(Current);
@@ -437,12 +422,7 @@ bool cNopacityDisplayMenu::SetItemChannel(const cChannel *Channel, int Index, bo
if (config.GetValue("displayType") == dtGraphical) {
item->CreatePixmapForeground();
}
- item->Render();
- if (initial) {
- if (FadeTime) {
- item->SetAlpha(0);
- }
- }
+ item->Render(initial);
} else {
cNopacityMenuItem *item = menuItems[Index].get();
item->SetCurrent(Current);
@@ -475,12 +455,7 @@ bool cNopacityDisplayMenu::SetItemRecording(const cRecording *Recording, int Ind
if (config.GetValue("displayType") == dtGraphical) {
item->CreatePixmapForeground();
}
- item->Render();
- if (initial) {
- if (FadeTime) {
- item->SetAlpha(0);
- }
- }
+ item->Render(initial);
} else {
cNopacityMenuItem *item = menuItems[Index].get();
item->SetCurrent(Current);
@@ -533,12 +508,7 @@ void cNopacityDisplayMenu::SetItem(const char *Text, int Index, bool Current, bo
item->CreatePixmapStatic();
if (textWidth > 0)
item->CreatePixmapTextScroller(textWidth);
- item->Render();
- if (initial) {
- if (FadeTime) {
- item->SetAlpha(0);
- }
- }
+ item->Render(initial);
}
SetEditableWidth(menuView->GetEditableWidth());
}
@@ -630,8 +600,25 @@ void cNopacityDisplayMenu::SetText(const char *Text, bool FixedFont) {
detailView->Start();
}
+void cNopacityDisplayMenu::SetAlpha(int Alpha, bool Force) {
+ if (menuView && (Force || Running()))
+ menuView->SetAlpha(Alpha);
+ if (detailView && (Force || Running()))
+ detailView->SetAlpha(Alpha);
+ for (auto i = menuItems.begin(); i != menuItems.end(); ++i) {
+ if (*i && (Force || Running())) {
+ cNopacityMenuItem *item = i->get();
+ item->SetAlpha(Alpha);
+ }
+ }
+ for (cNopacityTimer *t = timers.First(); (Force || Running()) && t; t = timers.Next(t))
+ t->SetAlpha(Alpha);
+}
+
void cNopacityDisplayMenu::Flush(void) {
- //int start = cTimeMs::Now();
+ if (Running())
+ return;
+
menuView->DrawDate(initial);
if (MenuCategory() == mcMain) {
if (config.GetValue("showDiscUsage"))
@@ -643,34 +630,35 @@ void cNopacityDisplayMenu::Flush(void) {
if (config.GetValue("showTimers"))
DrawTimers(timersChanged, numConflicts);
}
+ if (detailView)
+ while (detailView->IsRunning())
+ cCondWait::SleepMs(10);
if (initial) {
- if (FadeTime)
+ if (FadeTime) {
+ SetAlpha(0, true);
Start();
+ }
}
- initial = false;
osd->Flush();
+ initial = false;
cDevice::PrimaryDevice()->ScaleVideo(videoWindowRect);
}
void cNopacityDisplayMenu::Action(void) {
+ uint64_t First = cTimeMs::Now();
+ cPixmap::Lock();
+ cPixmap::Unlock();
uint64_t Start = cTimeMs::Now();
+ dsyslog ("skinnopacity: First Lock(): %lims\n", Start - First);
while (Running()) {
uint64_t Now = cTimeMs::Now();
- cPixmap::Lock();
double t = std::min(double(Now - Start) / FadeTime, 1.0);
int Alpha = t * ALPHA_OPAQUE;
- menuView->SetAlpha(Alpha);
- for (auto i = menuItems.begin(); i != menuItems.end(); ++i) {
- if (*i && Running()) {
- cNopacityMenuItem *item = i->get();
- item->SetAlpha(Alpha);
- }
- }
- for (cNopacityTimer *t = timers.First(); Running() && t; t = timers.Next(t))
- t->SetAlpha(Alpha);
- cPixmap::Unlock();
+ cPixmap::Lock();
+ SetAlpha(Alpha);
if (Running())
osd->Flush();
+ cPixmap::Unlock();
int Delta = cTimeMs::Now() - Now;
if (Running() && (Delta < FrameTime))
cCondWait::SleepMs(FrameTime - Delta);
diff --git a/displaymenu.h b/displaymenu.h
index 890ffa5..dff7ae8 100644
--- a/displaymenu.h
+++ b/displaymenu.h
@@ -34,6 +34,7 @@ private:
void DrawTimers(bool timersChanged, int numConflicts);
void SplitItem(const char *Text, cString *strItems, int *tabItems);
void SetButtonPositions(void);
+ void SetAlpha(int Alpha = 0, bool force = false);
virtual void Action(void);
protected:
int Tab(int n);
diff --git a/displaymenuview.c b/displaymenuview.c
index 42c60e0..45804a7 100644
--- a/displaymenuview.c
+++ b/displaymenuview.c
@@ -5,6 +5,7 @@ cNopacityDisplayMenuView::cNopacityDisplayMenuView(cOsd *osd) {
diskUsageAlert = 95;
pixmapHeaderIcon = NULL;
messageBox = NULL;
+ menuAdjustLeft = config.GetValue("menuAdjustLeft");
SetDescriptionTextWindowSize();
CreatePixmaps();
DrawHeaderLogo();
@@ -33,7 +34,7 @@ cNopacityDisplayMenuView::~cNopacityDisplayMenuView(void) {
void cNopacityDisplayMenuView::SetDescriptionTextWindowSize(void) {
int xSchedules, xRecordings, xChannels, xTimers;
int widthSchedules, widthRecordings, widthChannels, widthTimers;
- if (config.GetValue("menuAdjustLeft")) {
+ if (menuAdjustLeft) {
xSchedules = 2 * geoManager->menuSpace
+ geoManager->menuContentWidthSchedules
+ geoManager->menuWidthScrollbar;
@@ -152,22 +153,22 @@ int cNopacityDisplayMenuView::GetContentWidth(eMenuCategory menuCat) {
void cNopacityDisplayMenuView::CreatePixmaps(void) {
pixmapHeader = osd->CreatePixmap(1, cRect(0, 0, geoManager->osdWidth, geoManager->menuHeaderHeight));
pixmapHeaderForeground = osd->CreatePixmap(3, cRect(0, 0, geoManager->osdWidth, geoManager->menuHeaderHeight));
- int dateX = (config.GetValue("menuAdjustLeft")) ? (geoManager->osdWidth - geoManager->menuDateWidth) : 0;
+ int dateX = (menuAdjustLeft) ? (geoManager->osdWidth - geoManager->menuDateWidth) : 0;
pixmapDate = osd->CreatePixmap(2, cRect(dateX, 0, geoManager->menuDateWidth, geoManager->menuHeaderHeight));
- int logoX = (config.GetValue("menuAdjustLeft")) ? 0 : (geoManager->osdWidth - geoManager->menuHeaderVDRLogoWidth);
+ int logoX = (menuAdjustLeft) ? 0 : (geoManager->osdWidth - geoManager->menuHeaderVDRLogoWidth);
pixmapHeaderLogo = osd->CreatePixmap(-1, cRect(logoX, 2, geoManager->menuHeaderVDRLogoWidth, geoManager->menuHeaderHeight - 4));
- int labelX = (config.GetValue("menuAdjustLeft")) ? 0 : geoManager->menuDateWidth;
+ int labelX = (menuAdjustLeft) ? 0 : geoManager->menuDateWidth;
pixmapHeaderLabel = osd->CreatePixmap(2, cRect(labelX, 0, geoManager->osdWidth - geoManager->menuDateWidth, geoManager->menuHeaderHeight));
pixmapFooter = osd->CreatePixmap(2, cRect(0, geoManager->osdHeight - geoManager->menuFooterHeight, geoManager->osdWidth, geoManager->menuFooterHeight));
pixmapFooterBack = osd->CreatePixmap(1, cRect(0, geoManager->osdHeight - geoManager->menuFooterHeight, geoManager->osdWidth, geoManager->menuFooterHeight));
int drawPortWidth = geoManager->osdWidth + geoManager->menuContentWidthFull - geoManager->menuContentWidthMinimum;
pixmapContent = osd->CreatePixmap(1, cRect(0, geoManager->menuHeaderHeight, geoManager->osdWidth, geoManager->menuContentHeight),
cRect(0, 0, drawPortWidth, geoManager->menuContentHeight));
- int diskUsageX = (config.GetValue("menuAdjustLeft")) ? (geoManager->osdWidth - geoManager->menuDiskUsageWidth - 10) : 10;
+ int diskUsageX = (menuAdjustLeft) ? (geoManager->osdWidth - geoManager->menuDiskUsageWidth - 10) : 10;
pixmapDiskUsage = osd->CreatePixmap(2, cRect(diskUsageX, geoManager->menuHeaderHeight + geoManager->menuSpace, geoManager->menuDiskUsageWidth, geoManager->menuDiskUsageHeight));
pixmapDiskUsageIcon = osd->CreatePixmap(3, cRect(diskUsageX + 2, geoManager->menuHeaderHeight + geoManager->menuSpace + 2, geoManager->menuDiskUsageWidth - 4, geoManager->menuDiskUsageHeight - 4));
pixmapDiskUsageLabel = osd->CreatePixmap(4, cRect(diskUsageX + 2, geoManager->menuHeaderHeight + geoManager->menuSpace + 2, geoManager->menuDiskUsageWidth - 4, geoManager->menuDiskUsageHeight - 4));
- int scrollbarX = (config.GetValue("menuAdjustLeft")) ? geoManager->menuContentWidthMain : (geoManager->osdWidth - geoManager->menuContentWidthMain);
+ int scrollbarX = (menuAdjustLeft) ? geoManager->menuContentWidthMain : (geoManager->osdWidth - geoManager->menuContentWidthMain);
pixmapScrollbar = osd->CreatePixmap(3, cRect(scrollbarX, geoManager->menuHeaderHeight + geoManager->menuSpace, geoManager->menuWidthScrollbar, geoManager->menuContentHeight - 2 * geoManager->menuSpace));
pixmapScrollbarBack = osd->CreatePixmap(2, cRect(scrollbarX, geoManager->menuHeaderHeight + geoManager->menuSpace, geoManager->menuWidthScrollbar, geoManager->menuContentHeight - 2 * geoManager->menuSpace));
@@ -176,9 +177,6 @@ void cNopacityDisplayMenuView::CreatePixmaps(void) {
pixmapDiskUsage->Fill(clrTransparent);
pixmapDiskUsageIcon->Fill(clrTransparent);
pixmapDiskUsageLabel->Fill(clrTransparent);
- if (config.GetValue("menuFadeTime")) {
- SetAlpha();
- }
}
void cNopacityDisplayMenuView::SetAlpha(int Alpha) {
@@ -247,7 +245,7 @@ int cNopacityDisplayMenuView::GetMenuTop(int numItems, int itemHeight) {
int cNopacityDisplayMenuView::GetMenuItemLeft(int itemWidth) {
int menuLeft = geoManager->menuSpace;
- if (!config.GetValue("menuAdjustLeft"))
+ if (!menuAdjustLeft)
menuLeft = geoManager->osdWidth - itemWidth - geoManager->menuSpace;
return menuLeft;
}
@@ -310,7 +308,7 @@ void cNopacityDisplayMenuView::DrawBorderDecoration() {
pixmapContent->Fill(clrTransparent);
- if (config.GetValue("menuAdjustLeft")) {
+ if (menuAdjustLeft) {
//Background
pixmapContent->DrawRectangle(cRect(0, 0, geoManager->menuContentWidthFull - radius, geoManager->menuContentHeight), Theme.Color(clrMenuBack));
pixmapContent->DrawRectangle(cRect(geoManager->menuContentWidthFull - radius, 0, geoManager->menuWidthScrollbar + geoManager->menuSpace + radius, geoManager->menuContentHeight), Theme.Color(clrMenuScrollBarBase));
@@ -361,19 +359,19 @@ void cNopacityDisplayMenuView::AdjustContentBackground(eMenuCategory menuCat, eM
int drawportX;
if ((contentWidth != contentWidthLast)||(menuCatLast == mcUndefined)) {
if (contentWidth == geoManager->menuContentWidthFull) {
- drawportX = (config.GetValue("menuAdjustLeft"))?0:(geoManager->menuContentWidthMinimum - geoManager->menuContentWidthFull);
+ drawportX = (menuAdjustLeft)?0:(geoManager->menuContentWidthMinimum - geoManager->menuContentWidthFull);
pixmapContent->SetDrawPortPoint(cPoint(drawportX, 0));
if (config.GetValue("scalePicture")) {
// ask output device to restore full size
vidWin = cDevice::PrimaryDevice()->CanScaleVideo(cRect::Null);
}
} else {
- drawportX = (config.GetValue("menuAdjustLeft"))?(contentWidth - geoManager->menuContentWidthFull):(geoManager->menuContentWidthMinimum - contentWidth);
+ drawportX = (menuAdjustLeft)?(contentWidth - geoManager->menuContentWidthFull):(geoManager->menuContentWidthMinimum - contentWidth);
pixmapContent->SetDrawPortPoint(cPoint(drawportX, 0));
if (config.GetValue("scalePicture")) {
// ask output device to scale down
- int windowX = (config.GetValue("menuAdjustLeft"))?(geoManager->osdLeft + contentWidth + geoManager->menuWidthScrollbar + 2 * geoManager->menuSpace)
- :(geoManager->osdLeft + 2 * geoManager->menuSpace);
+ int windowX = (menuAdjustLeft)?(geoManager->osdLeft + contentWidth + geoManager->menuWidthScrollbar + 2 * geoManager->menuSpace)
+ :(geoManager->osdLeft + 2 * geoManager->menuSpace);
cRect availableRect(
windowX,
geoManager->osdTop + geoManager->menuHeaderHeight,
@@ -385,7 +383,7 @@ void cNopacityDisplayMenuView::AdjustContentBackground(eMenuCategory menuCat, eM
}
osd->DestroyPixmap(pixmapScrollbar);
osd->DestroyPixmap(pixmapScrollbarBack);
- int scrollbarX = (config.GetValue("menuAdjustLeft"))?(contentWidth):(geoManager->osdWidth - contentWidth - geoManager->menuWidthScrollbar);
+ int scrollbarX = (menuAdjustLeft)?(contentWidth):(geoManager->osdWidth - contentWidth - geoManager->menuWidthScrollbar);
pixmapScrollbar = osd->CreatePixmap(3, cRect(scrollbarX , geoManager->menuHeaderHeight + geoManager->menuSpace, geoManager->menuWidthScrollbar, geoManager->menuContentHeight - 2*geoManager->menuSpace));
pixmapScrollbarBack = osd->CreatePixmap(2, cRect(scrollbarX , geoManager->menuHeaderHeight + geoManager->menuSpace, geoManager->menuWidthScrollbar, geoManager->menuContentHeight - 2*geoManager->menuSpace));
pixmapScrollbar->Fill(clrTransparent);
@@ -407,7 +405,7 @@ int cNopacityDisplayMenuView::ShowHeaderLogo(bool show) {
return geoManager->menuHeaderVDRLogoWidth + geoManager->menuSpace;
}
-int cNopacityDisplayMenuView::DrawHeaderIcon(eMenuCategory menuCat) {
+int cNopacityDisplayMenuView::DrawHeaderIcon(eMenuCategory menuCat, bool initial) {
cString icon;
bool drawIcon = true;
switch (menuCat) {
@@ -437,9 +435,12 @@ int cNopacityDisplayMenuView::DrawHeaderIcon(eMenuCategory menuCat) {
int left = 0;
if (drawIcon) {
int iconSize = geoManager->menuHeaderHeight - 4;
- int iconX = (config.GetValue("menuAdjustLeft")) ? 0 : (geoManager->osdWidth - geoManager->menuHeaderHeight);
+ int iconX = (menuAdjustLeft) ? 0 : (geoManager->osdWidth - geoManager->menuHeaderHeight);
pixmapHeaderIcon = osd->CreatePixmap(2, cRect(iconX, 2, iconSize, iconSize));
pixmapHeaderIcon->Fill(clrTransparent);
+ if (initial && config.GetValue("menuFadeTime")) {
+ pixmapHeaderIcon->SetAlpha(0);
+ }
cImage *imgIcon = imgCache->GetSkinIcon(*icon);
if (imgIcon) {
pixmapHeaderIcon->DrawImage(cPoint(0,0), *imgIcon);
@@ -449,7 +450,7 @@ int cNopacityDisplayMenuView::DrawHeaderIcon(eMenuCategory menuCat) {
return left;
}
-int cNopacityDisplayMenuView::ShowHeaderIconChannelLogo(const char *Title) {
+int cNopacityDisplayMenuView::ShowHeaderIconChannelLogo(const char *Title, bool initial) {
int left = 0;
int logoHeight = geoManager->menuHeaderHeight - 4;
cSize logoSize = ScaleToFit(1000,
@@ -457,9 +458,12 @@ int cNopacityDisplayMenuView::ShowHeaderIconChannelLogo(const char *Title) {
config.GetValue("logoWidth"),
config.GetValue("logoHeight"));
int logoWidth = logoSize.Width();
- int iconX = (config.GetValue("menuAdjustLeft")) ? 0 : (geoManager->osdWidth - logoWidth);
+ int iconX = (menuAdjustLeft) ? 0 : (geoManager->osdWidth - logoWidth);
pixmapHeaderIcon = osd->CreatePixmap(2, cRect(iconX, 2, logoWidth, logoHeight));
pixmapHeaderIcon->Fill(clrTransparent);
+ if (initial && config.GetValue("menuFadeTime")) {
+ pixmapHeaderIcon->SetAlpha(0);
+ }
std::string channel = Title;
if (channel.length() == 0)
return left;
@@ -486,7 +490,7 @@ void cNopacityDisplayMenuView::DestroyHeaderIcon(void) {
void cNopacityDisplayMenuView::DrawHeaderLabel(int left, cString label) {
pixmapHeaderLabel->Fill(clrTransparent);
int labelW = fontManager->menuHeader->Width(label);
- int labelX = (config.GetValue("menuAdjustLeft")) ? (left)
+ int labelX = (menuAdjustLeft) ? (left)
: (geoManager->osdWidth - geoManager->menuDateWidth - labelW - left - 2*geoManager->menuSpace);
int labelY = (geoManager->menuHeaderHeight - fontManager->menuHeader->Height())/2;
pixmapHeaderLabel->DrawText(cPoint(labelX, labelY),
@@ -501,7 +505,7 @@ void cNopacityDisplayMenuView::DrawDate(bool initial) {
if (initial || strcmp(date, lastDate)) {
pixmapDate->Fill(clrTransparent);
int dateW = fontManager->menuDate->Width(date);
- int dateX = (config.GetValue("menuAdjustLeft")) ? (geoManager->menuDateWidth - dateW - 2*geoManager->menuSpace) : (geoManager->menuSpace);
+ int dateX = (menuAdjustLeft) ? (geoManager->menuDateWidth - dateW - 2*geoManager->menuSpace) : (geoManager->menuSpace);
pixmapDate->DrawText(cPoint(dateX, (geoManager->menuHeaderHeight - fontManager->menuDate->Height()) / 2), date, Theme.Color(clrMenuFontDate), clrTransparent, fontManager->menuDate);
lastDate = date;
}
@@ -607,7 +611,7 @@ cNopacityTimer *cNopacityDisplayMenuView::DrawTimerConflict(int numConflicts, in
t->SetGeometry(geoManager->menuTimersWidth, y);
t->CreateConflictText();
t->CalculateHeight(geoManager->menuSpace);
- int timerX = (config.GetValue("menuAdjustLeft")) ? (geoManager->osdWidth - geoManager->menuTimersWidth - 10) : 10;
+ int timerX = (menuAdjustLeft) ? (geoManager->osdWidth - geoManager->menuTimersWidth - 10) : 10;
t->CreatePixmaps(timerX);
t->Render();
return t;
@@ -619,7 +623,7 @@ cNopacityTimer *cNopacityDisplayMenuView::DrawTimer(const cTimer *Timer, int y)
t->CreateDate();
t->CreateShowName();
t->CalculateHeight(geoManager->menuSpace);
- int timerX = (config.GetValue("menuAdjustLeft")) ? (geoManager->osdWidth - geoManager->menuTimersWidth - 10) : 10;
+ int timerX = (menuAdjustLeft) ? (geoManager->osdWidth - geoManager->menuTimersWidth - 10) : 10;
t->CreatePixmaps(timerX);
t->Render();
return t;
diff --git a/displaymenuview.h b/displaymenuview.h
index a644c45..d212693 100644
--- a/displaymenuview.h
+++ b/displaymenuview.h
@@ -16,6 +16,7 @@ class cNopacityDisplayMenuView {
cOsd *osd;
cString lastDate;
int diskUsageAlert;
+ bool menuAdjustLeft;
cPixmap *pixmapHeader;
cPixmap *pixmapHeaderForeground;
cPixmap *pixmapHeaderLogo;
@@ -58,8 +59,8 @@ class cNopacityDisplayMenuView {
cRect *GetDescriptionTextWindowSize(eMenuCategory menuCat);
void AdjustContentBackground(eMenuCategory menuCat, eMenuCategory menuCatLast, cRect & vidWin);
int ShowHeaderLogo(bool show);
- int DrawHeaderIcon(eMenuCategory menuCat);
- int ShowHeaderIconChannelLogo(const char *Title);
+ int DrawHeaderIcon(eMenuCategory menuCat, bool initial = false);
+ int ShowHeaderIconChannelLogo(const char *Title, bool initial = false);
void DestroyHeaderIcon(void);
void DrawHeaderLabel(int left, cString label);
void DrawDate(bool initial);
diff --git a/menudetailview.c b/menudetailview.c
index 45a7908..cfbe355 100644
--- a/menudetailview.c
+++ b/menudetailview.c
@@ -127,10 +127,12 @@ void cNopacityDetailView::KeyInput(bool Up, bool Page) {
return;
if (Up && Page) {
view->KeyLeft();
- view->Start();
+ view->Render();
+ osd->Flush();
} else if (!Up && Page) {
view->KeyRight();
- view->Start();
+ view->Render();
+ osd->Flush();
} else if (Up && !Page) {
bool scrolled = view->KeyUp();
if (scrolled) {
@@ -381,9 +383,9 @@ void cNopacityDetailView::Action(void) {
view->SetGeometry(x, top, width, height, border, headerHeight);
view->SetScrollbarPixmaps(scrollBar, scrollBarBack);
view->LoadMedia();
- view->Start();
if (ev)
view->SetAdditionalInfoText(LoadReruns());
else if (rec)
view->SetAdditionalInfoText(LoadRecordingInformation());
+ view->Render();
}
diff --git a/menudetailview.h b/menudetailview.h
index 6f8f270..5fac963 100644
--- a/menudetailview.h
+++ b/menudetailview.h
@@ -45,6 +45,7 @@ public:
void SetRecording(const cRecording *r) { rec = r; };
void SetText(const char *t) { text = t; };
void KeyInput(bool Up, bool Page);
+ bool IsRunning(void) { return Running(); };
};
#endif //__NOPACITY_MENUDETAILVIEW_H
diff --git a/menuitem.c b/menuitem.c
index 718e304..b73c96b 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() {
+void cNopacityMainMenuItem::Render(bool initial) {
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() {
+void cNopacityScheduleMenuItem::Render(bool initial) {
int logoWidth = geoManager->menuLogoWidth;
int logoHeight = geoManager->menuLogoHeight;
textLeft = 5;
@@ -577,6 +577,7 @@ void cNopacityScheduleMenuItem::Render() {
infoTextWindow->SetGeometry(textWindow);
infoTextWindow->SetText(Event->Description());
infoTextWindow->SetPoster(Event, NULL);
+ infoTextWindow->SetInitial(initial);
infoTextWindow->Start();
} else {
//fullscreen mode
@@ -895,7 +896,7 @@ std::string cNopacityChannelMenuItem::readEPG(void) {
return sstrText.str();
}
-void cNopacityChannelMenuItem::Render() {
+void cNopacityChannelMenuItem::Render(bool initial) {
if (selectable) { //Channels
DrawBackground();
DrawChannelLogoBackground();
@@ -924,6 +925,7 @@ void cNopacityChannelMenuItem::Render() {
infoTextWindow = new cNopacityTextWindow(osd, fontEPGWindow, vidWin);
infoTextWindow->SetGeometry(textWindow);
infoTextWindow->SetText(readEPG().c_str());
+ infoTextWindow->SetInitial(initial);
infoTextWindow->Start();
}
} else { //Channelseparators
@@ -1067,7 +1069,7 @@ void cNopacityTimerMenuItem::DrawBackground(int textLeft) {
pixmapStatic->DrawText(cPoint(textLeft + iconSize, (height/2 - fontSmall->Height())/2), *dateTime, clrFont, clrTransparent, fontSmall);
}
-void cNopacityTimerMenuItem::Render() {
+void cNopacityTimerMenuItem::Render(bool initial) {
textLeft = geoManager->menuLogoWidth + geoManager->menuSpace;
if (selectable) {
DrawBackground(textLeft);
@@ -1101,6 +1103,7 @@ void cNopacityTimerMenuItem::Render() {
infoTextWindow->SetGeometry(textWindow);
infoTextWindow->SetText(Event->Description());
infoTextWindow->SetPoster(Event, NULL, false);
+ infoTextWindow->SetInitial(initial);
infoTextWindow->Start();
} else {
//fullscreen mode
@@ -1413,7 +1416,7 @@ void cNopacityRecordingMenuItem::DrawPoster(void) {
}
}
-void cNopacityRecordingMenuItem::Render() {
+void cNopacityRecordingMenuItem::Render(bool initial) {
if (selectable) {
DrawBackground();
if (isFolder) {
@@ -1452,6 +1455,7 @@ void cNopacityRecordingMenuItem::Render() {
infoTextWindow->SetText(Recording->Info()->Description());
if (!infoTextWindow->SetManualPoster(Recording))
infoTextWindow->SetPoster(NULL, Recording);
+ infoTextWindow->SetInitial(initial);
infoTextWindow->Start();
} else {
//fullscreen mode
@@ -1617,7 +1621,7 @@ bool cNopacityDefaultMenuItem::DrawHeaderElement(void) {
return false;
}
-void cNopacityDefaultMenuItem::Render() {
+void cNopacityDefaultMenuItem::Render(bool initial) {
DrawBackground();
pixmapStatic->Fill(clrTransparent);
@@ -1685,7 +1689,7 @@ cNopacityTrackMenuItem::cNopacityTrackMenuItem(cOsd *osd, const char *text) : cN
cNopacityTrackMenuItem::~cNopacityTrackMenuItem(void) {
}
-void cNopacityTrackMenuItem::Render() {
+void cNopacityTrackMenuItem::Render(bool initial) {
eSkinElementType type = (current)?seTracksHigh:seTracks;
if (config.GetValue("displayType") == dtBlending) {
pixmapBackground->Fill(Theme.Color(clrMenuBorder));
diff --git a/menuitem.h b/menuitem.h
index 26fd744..a3bc30e 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() = 0;
+ virtual void Render(bool initial = 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();
+ void Render(bool initial = false);
};
class cNopacityScheduleMenuItem : public cNopacityMenuItem {
@@ -107,7 +107,7 @@ public:
void CreatePixmapTextScroller(int totalWidth);
void CreateText(void);
int CheckScrollable(bool hasIcon);
- void Render();
+ void Render(bool initial = false);
};
class cNopacityChannelMenuItem : public cNopacityMenuItem {
@@ -132,7 +132,7 @@ public:
void CreatePixmapTextScroller(int totalWidth);
void CreateText(void);
int CheckScrollable(bool hasIcon);
- void Render();
+ void Render(bool initial = false);
};
class cNopacityTimerMenuItem : public cNopacityMenuItem {
@@ -153,7 +153,7 @@ public:
void CreatePixmapTextScroller(int totalWidth);
void CreateText(void);
int CheckScrollable(bool hasIcon);
- void Render();
+ void Render(bool initial = false);
};
class cNopacityRecordingMenuItem : public cNopacityMenuItem {
@@ -192,7 +192,7 @@ public:
void CreateText(void);
void SetPoster(void);
int CheckScrollable(bool hasIcon);
- void Render();
+ void Render(bool initial = 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();
+ void Render(bool initial = false);
};
class cNopacityTrackMenuItem : public cNopacityMenuItem {
@@ -218,6 +218,6 @@ private:
public:
cNopacityTrackMenuItem(cOsd *osd, const char *text);
~cNopacityTrackMenuItem(void);
- void Render();
+ void Render(bool initial = false);
};
#endif //__NOPACITY_MENUITEM_H
diff --git a/textwindow.c b/textwindow.c
index 5ead0e9..0849305 100644
--- a/textwindow.c
+++ b/textwindow.c
@@ -172,6 +172,8 @@ void cNopacityTextWindow::CreatePixmap(void) {
pixmapBackground->Fill(Theme.Color(clrMenuBorder));
pixmapBackground->DrawRectangle(cRect(1, 1, geometry->Width(), geometry->Height()), clrBlack);
pixmap->Fill(Theme.Color(clrMenuBack));
+ if (config.GetValue("menuEPGWindowFadeTime"))
+ SetAlpha();
cPixmap::Unlock();
}
@@ -419,7 +421,8 @@ void cNopacityTextWindow::Action(void) {
if (! *text)
return;
- DoSleep(config.GetValue("menuInfoTextDelay")*1000);
+ int initialSleepTime = (initial) ? config.GetValue("menuFadeTime") : 0;
+ DoSleep(initialSleepTime + config.GetValue("menuInfoTextDelay") * 1000);
if (config.GetValue("scalePicture") == 2) {
ScaleVideoWindow();
@@ -440,16 +443,17 @@ void cNopacityTextWindow::Action(void) {
if (Running() && (hasPoster || hasManualPoster)) {
DrawPoster(border);
}
+
//FadeIn
if (config.GetValue("menuEPGWindowFadeTime")) {
- uint64_t Start = cTimeMs::Now();
int FadeTime = config.GetValue("menuEPGWindowFadeTime");
int FadeFrameTime = FadeTime / 10;
+ uint64_t Start = cTimeMs::Now();
while (Running()) {
uint64_t Now = cTimeMs::Now();
- cPixmap::Lock();
double t = std::min(double(Now - Start) / FadeTime, 1.0);
int Alpha = t * ALPHA_OPAQUE;
+ cPixmap::Lock();
SetAlpha(Alpha);
cPixmap::Unlock();
if (Running())
@@ -482,7 +486,7 @@ void cNopacityTextWindow::Action(void) {
drawPortY = pixmap->DrawPort().Y();
drawPortY -= 1;
cPixmap::Unlock();
- if (abs(drawPortY) > maxY) {
+ if (std::abs(drawPortY) > maxY) {
doSleep = true;
DoSleep(scrollDelay);
drawPortY = 0;
diff --git a/textwindow.h b/textwindow.h
index 5522392..7d79c40 100644
--- a/textwindow.h
+++ b/textwindow.h
@@ -16,6 +16,7 @@ private:
int drawportHeight;
cRect *vidWin;
cRect oldVidWin;
+ bool initial = false;
bool scaledWindow;
cString text;
cTextWrapper twTextTall;
@@ -48,6 +49,7 @@ public:
void SetText(cString Text) {text = Text;};
bool SetManualPoster(const cRecording *recording, bool fullscreen = false);
void SetPoster(const cEvent *event, const cRecording *recording, bool fullscreen = false);
+ void SetInitial(bool initial) { this->initial = initial; };
};
#endif //__NOPACITY_TEXTWINDOW_H