summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY2
-rw-r--r--baserender.c12
-rw-r--r--baserender.h13
-rw-r--r--displaychannel.c4
-rw-r--r--displaymenu.c60
-rw-r--r--displaymenu.h2
-rw-r--r--imageloader.c67
-rw-r--r--imageloader.h2
8 files changed, 89 insertions, 73 deletions
diff --git a/HISTORY b/HISTORY
index efe0a4e2..d7ac5290 100644
--- a/HISTORY
+++ b/HISTORY
@@ -8,10 +8,12 @@ VDR Plugin 'skinflatplus' Revision History
- [fix] no scrollbar in some situations
- [fix] remove button border if button is not shown
- [fix] menuitem progressbar overlay itemtext
+- [fix] fixes in TopBar while icon set
- [add] add support for menu SetItemChannel
- [add] add support for menu SetItemTimer
- [update] add Patch from MegaV0lt, support for simple aspect & format, new icons
- [update] only log not loaded images
+- [update] imageloader logging
2013-11-24: Version 0.1.0 - MegaV0lt Version
Special thanks to MegaV0lt@VDR-Portal for
diff --git a/baserender.c b/baserender.c
index f59bd8b9..2d9cbcfd 100644
--- a/baserender.c
+++ b/baserender.c
@@ -17,6 +17,8 @@ cFlatBaseRender::cFlatBaseRender(void) {
topBarLastDate = "";
topBarUpdateTitle = false;
topBarHeight = 0;
+ topBarExtraIconSet = false;
+ topBarMenuIconSet = false;
marginItem = 5;
@@ -129,6 +131,8 @@ void cFlatBaseRender::TopBarSetExtraIcon(cString icon) {
}
void cFlatBaseRender::TopBarSetMenuIcon(cString icon) {
+ if( !strcmp(*icon, "") )
+ return;
topBarMenuIcon = icon;
topBarMenuIconSet = true;
topBarUpdateTitle = true;
@@ -590,22 +594,22 @@ void cFlatBaseRender::ProgressBarCreate(int Left, int Top, int Width, int Height
void cFlatBaseRender::ProgressBarDraw(int Current, int Total) {
ProgressBarDrawRaw(progressBarPixmap, progressBarPixmapBg, cRect(0, 0, progressBarWidth, progressBarHeight),
cRect(0, 0, progressBarWidth+progressBarMarginVer*2, progressBarHeight+progressBarMarginHor*2),
- Current, Total, progressBarColorFg, progressBarColorBarFg, progressBarColorBg, ProgressType);
+ Current, Total, progressBarColorFg, progressBarColorBarFg, progressBarColorBg, ProgressType, progressBarSetBackground);
}
void cFlatBaseRender::ProgressBarDrawBgColor(void) {
progressBarPixmapBg->Fill(progressBarColorBg);
}
-void cFlatBaseRender::ProgressBarDrawRaw(cPixmap *Pixmap, cPixmap *PixmapBg, cRect rect, cRect rectBg, int Current, int Total, tColor ColorFg, tColor ColorBarFg, tColor ColorBg, int Type) {
+void cFlatBaseRender::ProgressBarDrawRaw(cPixmap *Pixmap, cPixmap *PixmapBg, cRect rect, cRect rectBg, int Current, int Total, tColor ColorFg, tColor ColorBarFg, tColor ColorBg, int Type, bool SetBackground) {
int Middle = rect.Height()/2;
double percentLeft = ((double)Current) / (double)Total;
- if( PixmapBg && progressBarSetBackground )
+ if( PixmapBg && SetBackground )
PixmapBg->DrawRectangle(cRect( rectBg.Left(), rectBg.Top(), rectBg.Width(), rectBg.Height()), ColorBg);
- if( progressBarSetBackground ) {
+ if( SetBackground ) {
if( PixmapBg == Pixmap )
Pixmap->DrawRectangle(cRect( rect.Left(), rect.Top(), rect.Width(), rect.Height()), ColorBg);
else
diff --git a/baserender.h b/baserender.h
index 0ba8be0c..80e5e244 100644
--- a/baserender.h
+++ b/baserender.h
@@ -5,11 +5,12 @@
#include <list>
enum eBorder {
- BorderMenuItem = 1,
- BorderRecordJump = 2,
- BorderMenuRecord = 3,
- BorderMessage = 4,
- BorderButton = 5
+ BorderMenuItem,
+ BorderRecordJump,
+ BorderMenuRecord,
+ BorderMessage,
+ BorderButton,
+ BorderContent
};
struct sDecorBorder {
@@ -133,7 +134,7 @@ class cFlatBaseRender
void MessageSet(eMessageType Type, const char *Text);
void MessageClear(void);
- void ProgressBarDrawRaw(cPixmap *Pixmap, cPixmap *PixmapBg, cRect rec, cRect recBg, int Current, int Total, tColor ColorFg, tColor ColorBarFg, tColor ColorBg, int Type);
+ void ProgressBarDrawRaw(cPixmap *Pixmap, cPixmap *PixmapBg, cRect rec, cRect recBg, int Current, int Total, tColor ColorFg, tColor ColorBarFg, tColor ColorBg, int Type, bool SetBackground);
void ProgressBarCreate(int Left, int Top, int Width, int Height, int MarginHor, int MarginVer, tColor ColorFg, tColor ColorBarFg, tColor ColorBg, int Type, bool SetBackground = false);
void ProgressBarDrawBgColor(void);
void ProgressBarDraw(int Current, int Total);
diff --git a/displaychannel.c b/displaychannel.c
index ecbfe7a6..af6567d8 100644
--- a/displaychannel.c
+++ b/displaychannel.c
@@ -419,7 +419,7 @@ void cFlatDisplayChannel::SignalQualityDraw(void) {
int progressWidth = signalWidth / 2 - progressLeft - marginItem;
ProgressBarDrawRaw(chanInfoBottomPixmap, chanInfoBottomPixmap, cRect(progressLeft, progressTop, progressWidth, Config.decorProgressSignalSize),
cRect(progressLeft, progressTop, progressWidth, Config.decorProgressSignalSize), SignalStrength, 100,
- Config.decorProgressSignalFg, Config.decorProgressSignalBarFg, Config.decorProgressSignalBg, Config.decorProgressSignalType);
+ Config.decorProgressSignalFg, Config.decorProgressSignalBarFg, Config.decorProgressSignalBg, Config.decorProgressSignalType, false);
left = signalWidth / 2 + marginItem;
chanInfoBottomPixmap->DrawText(cPoint(left, top), "SNR",
@@ -429,7 +429,7 @@ void cFlatDisplayChannel::SignalQualityDraw(void) {
ProgressBarDrawRaw(chanInfoBottomPixmap, chanInfoBottomPixmap, cRect(progressLeft, progressTop, progressWidth, Config.decorProgressSignalSize),
cRect(progressLeft, progressTop, progressWidth, Config.decorProgressSignalSize), SignalQuality, 100,
- Config.decorProgressSignalFg, Config.decorProgressSignalBarFg, Config.decorProgressSignalBg, Config.decorProgressSignalType);
+ Config.decorProgressSignalFg, Config.decorProgressSignalBarFg, Config.decorProgressSignalBg, Config.decorProgressSignalType, false);
}
void cFlatDisplayChannel::Flush(void) {
diff --git a/displaymenu.c b/displaymenu.c
index 8fc53f59..48de48e5 100644
--- a/displaymenu.c
+++ b/displaymenu.c
@@ -88,10 +88,10 @@ cFlatDisplayMenu::~cFlatDisplayMenu() {
}
void cFlatDisplayMenu::SetMenuCategory(eMenuCategory MenuCategory) {
- if( menuCategory == 8 && MenuCategory == 7 ) {
- DecorBorderClearByFrom(BorderMenuItem);
+ //if( menuCategory == 8 && MenuCategory == 7 ) {
+ // DecorBorderClearByFrom(BorderMenuItem);
ItemBorderClear();
- }
+ //}
menuCategory = MenuCategory;
@@ -297,9 +297,6 @@ void cFlatDisplayMenu::SetItem(const char *Text, int Index, bool Current, bool S
bool isRunning = false;
int xt = Tab(i);
- int xt2 = Tab(i+1);
- if( xt2 == 0 )
- xt2 = menuItemWidth;
if( xt >= menuItemWidth )
continue;
@@ -351,26 +348,26 @@ void cFlatDisplayMenu::SetItem(const char *Text, int Index, bool Current, bool S
default:
break;
}
- } else if (isRecording || hasEventtimer || haspartEventtimer || hasVPS || isRunning) {
+ } else if( isRecording || hasEventtimer || haspartEventtimer || hasVPS || isRunning ) {
// program schedule menu
- if (isRecording)
+ if( isRecording )
menuPixmap->DrawBitmap(cPoint(xOff, y + (lh - bmRec->Height()) / 2), *bmRec, ColorFg, ColorBg);
else {
- if (hasEventtimer)
+ if( hasEventtimer )
menuPixmap->DrawBitmap(cPoint(xOff, y + (lh - bmClock->Height()) / 2), *bmClock, ColorFg, ColorBg);
- if (haspartEventtimer)
+ if( haspartEventtimer )
menuPixmap->DrawBitmap(cPoint(xOff + (bmClock->Height() - bmClocksml->Height()) / 2, y + (lh - bmClocksml->Height()) / 2), *bmClocksml, ColorFg, ColorBg);
}
xOff += bmClock->Width(); // clock is wider than rec
- if (hasVPS)
+ if( hasVPS )
menuPixmap->DrawBitmap(cPoint(xOff, y + (lh - bmVPS->Height()) / 2), *bmVPS, ColorFg, ColorBg);
xOff += bmVPS->Width();
if( isRunning )
menuPixmap->DrawText(cPoint(xOff, y), "*", ColorFg, ColorBg, font, AvailableTextWidth - xOff);
- } else if (isnewrecording) {
+ } else if( isnewrecording ) {
// recordings menu
menuPixmap->DrawText(cPoint(xOff, y), buffer, ColorFg, ColorBg, font, AvailableTextWidth - xOff);
@@ -388,13 +385,18 @@ void cFlatDisplayMenu::SetItem(const char *Text, int Index, bool Current, bool S
ColorBarFg = Config.decorProgressMenuItemCurBarFg;
ColorBg = Config.decorProgressMenuItemCurBg;
}
- DrawProgressBarFromText(y + (itemHeight-Config.MenuItemPadding)/2 - Config.decorProgressMenuItemSize/2 - Config.decorBorderMenuItemSize,
- xt + Config.decorBorderMenuItemSize, colWidth, s, ColorFg, ColorBarFg, ColorBg);
+ cRect rec = cRect(xt + Config.decorBorderMenuItemSize,
+ y + (itemHeight-Config.MenuItemPadding)/2 - Config.decorProgressMenuItemSize/2 - Config.decorBorderMenuItemSize,
+ colWidth, Config.decorProgressMenuItemSize);
+ cRect recBG = cRect(xt + Config.decorBorderMenuItemSize - marginItem, y,
+ colWidth + marginItem*2, fontHeight);
+
+ DrawProgressBarFromText(rec, recBG, s, ColorFg, ColorBarFg, ColorBg);
} else {
if( (menuCategory == mcMain || menuCategory == mcSetup) && Config.MenuItemIconsShow) {
cString cIcon = GetIconName( MainMenuText(s) );
cImageLoader imgLoader;
- if (imgLoader.LoadIcon(*cIcon, fontHeight -marginItem*2)) {
+ if (imgLoader.LoadIcon(*cIcon, fontHeight - marginItem*2)) {
menuIconsPixmap->DrawImage(cPoint(xt + Config.decorBorderMenuItemSize + marginItem, y + marginItem), imgLoader.GetImage());
} else {
if (imgLoader.LoadIcon("menuIcons/blank", fontHeight)) {
@@ -404,7 +406,7 @@ void cFlatDisplayMenu::SetItem(const char *Text, int Index, bool Current, bool S
menuPixmap->DrawText(cPoint(fontHeight + marginItem*2 + xt + Config.decorBorderMenuItemSize, y), s, ColorFg, ColorBg, font,
AvailableTextWidth - xt - marginItem*2 - fontHeight);
} else {
- menuPixmap->DrawText(cPoint(xt + Config.decorBorderMenuItemSize, y), s, ColorFg, ColorBg, font, xt2 - xt);
+ menuPixmap->DrawText(cPoint(xt + Config.decorBorderMenuItemSize, y), s, ColorFg, ColorBg, font);
}
}
}
@@ -538,7 +540,7 @@ bool cFlatDisplayMenu::CheckProgressBar(const char *text) {
return false;
}
-void cFlatDisplayMenu::DrawProgressBarFromText(int Top, int Left, int Width, const char *bar, tColor ColorFg, tColor ColorBarFg, tColor ColorBg) {
+void cFlatDisplayMenu::DrawProgressBarFromText(cRect rec, cRect recBg, const char *bar, tColor ColorFg, tColor ColorBarFg, tColor ColorBg) {
const char *p = bar + 1;
bool isProgressbar = true;
int total = 0;
@@ -554,10 +556,9 @@ void cFlatDisplayMenu::DrawProgressBarFromText(int Top, int Left, int Width, con
}
}
if (isProgressbar) {
- double progress = (double)now/(double)total;
- ProgressBarDrawRaw(menuPixmap, menuPixmap, cRect(Left, Top, Width, Config.decorProgressMenuItemSize),
- cRect(Left, Top, Width, Config.decorProgressMenuItemSize), progress*total, total,
- ColorFg, ColorBarFg, ColorBg, Config.decorProgressMenuItemType);
+ double progress = (double)now / (double)total;
+ ProgressBarDrawRaw(menuPixmap, menuPixmap, rec, recBg, progress*total, total,
+ ColorFg, ColorBarFg, ColorBg, Config.decorProgressMenuItemType, true);
}
}
@@ -711,11 +712,11 @@ bool cFlatDisplayMenu::SetItemChannel(const cChannel *Channel, int Index, bool C
if( Current )
ProgressBarDrawRaw(menuPixmap, menuPixmap, cRect( PBLeft, PBTop, PBWidth, Config.decorProgressMenuItemSize),
cRect( PBLeft, PBTop, PBWidth, Config.decorProgressMenuItemSize), progress, 100,
- Config.decorProgressMenuItemCurFg, Config.decorProgressMenuItemCurBarFg, Config.decorProgressMenuItemCurBg, Config.decorProgressMenuItemType);
+ Config.decorProgressMenuItemCurFg, Config.decorProgressMenuItemCurBarFg, Config.decorProgressMenuItemCurBg, Config.decorProgressMenuItemType, false);
else
ProgressBarDrawRaw(menuPixmap, menuPixmap, cRect( PBLeft, PBTop, PBWidth, Config.decorProgressMenuItemSize),
cRect( PBLeft, PBTop, PBWidth, Config.decorProgressMenuItemSize), progress, 100,
- Config.decorProgressMenuItemFg, Config.decorProgressMenuItemBarFg, Config.decorProgressMenuItemBg, Config.decorProgressMenuItemType);
+ Config.decorProgressMenuItemFg, Config.decorProgressMenuItemBarFg, Config.decorProgressMenuItemBg, Config.decorProgressMenuItemType, false);
Left += Width + marginItem;
}
@@ -860,8 +861,13 @@ void cFlatDisplayMenu::DrawItemExtraEvent(const cEvent *Event) {
ContentSet( text.str().c_str(), Theme.Color(clrMenuEventFontInfo), Theme.Color(clrMenuEventBg) );
- DecorBorderDraw(cLeft, cTop, cWidth, ContentGetHeight(), Config.decorBorderMenuContentSize, Config.decorBorderMenuContentType,
- Config.decorBorderMenuContentFg, Config.decorBorderMenuContentBg);
+ DecorBorderClearByFrom(BorderContent);
+ if( Config.MenuContentFullSize )
+ DecorBorderDraw(cLeft, cTop, cWidth, ContentGetHeight(), Config.decorBorderMenuContentSize, Config.decorBorderMenuContentType,
+ Config.decorBorderMenuContentFg, Config.decorBorderMenuContentBg, BorderContent);
+ else
+ DecorBorderDraw(cLeft, cTop, cWidth, ContentGetTextHeight(), Config.decorBorderMenuContentSize, Config.decorBorderMenuContentType,
+ Config.decorBorderMenuContentFg, Config.decorBorderMenuContentBg, BorderContent);
}
bool cFlatDisplayMenu::SetItemTimer(const cTimer *Timer, int Index, bool Current, bool Selectable) {
@@ -1484,9 +1490,9 @@ void cFlatDisplayMenu::SetText(const char *Text, bool FixedFont) {
}
if( FixedFont )
- ContentCreate(Left, Top, Width, Height, 2);
+ ContentCreate(Left, Top, Width, Height, 1);
else
- ContentCreate(Left, Top, Width, Height, 2);
+ ContentCreate(Left, Top, Width, Height, 1);
ContentSet( Text, Theme.Color(clrMenuTextFont), Theme.Color(clrMenuTextBg) );
diff --git a/displaymenu.h b/displaymenu.h
index 8fd51368..090a56b0 100644
--- a/displaymenu.h
+++ b/displaymenu.h
@@ -41,7 +41,7 @@ class cFlatDisplayMenu : public cFlatBaseRender, public cSkinDisplayMenu {
void DrawScrollbar(int Total, int Offset, int Shown, int Top, int Height, bool CanScrollUp, bool CanScrollDown);
int ItemsHeight(void);
bool CheckProgressBar(const char *text);
- void DrawProgressBarFromText(int Top, int Left, int Width, const char *bar, tColor ColorFg, tColor ColorBarFg, tColor ColorBg);
+ void DrawProgressBarFromText(cRect rec, cRect recBg, const char *bar, tColor ColorFg, tColor ColorBarFg, tColor ColorBg);
cBitmap *bmNew, *bmRec, *bmArrowTurn, *bmClock, *bmClocksml, *bmVPS;
static cBitmap bmCNew, bmCRec, bmCArrowTurn, bmCClock, bmCClocksml, bmCHD, bmCVPS;
diff --git a/imageloader.c b/imageloader.c
index 27aae363..fd8e6a35 100644
--- a/imageloader.c
+++ b/imageloader.c
@@ -24,9 +24,12 @@ bool cImageLoader::LoadLogo(const char *logo, int width = -1, int height = -1) {
return false;
std::string logoLower = logo;
toLowerCase(logoLower);
- bool success = LoadImage(logoLower.c_str(), Config.logoPath, logoExtension);
- if( !success )
+ cString File = cString::sprintf("%s/%s.%s", *Config.logoPath, logoLower.c_str(), *logoExtension);
+ bool success = LoadImage(File);
+ if( !success ) {
+ dsyslog("imageloader LoadLogo: %s could not be loaded", *File);
return false;
+ }
if( height != 0 || width != 0 ) {
buffer.sample( Geometry(width, height) );
@@ -47,13 +50,15 @@ int cImageLoader::Width(void) {
bool cImageLoader::LoadIcon(const char *cIcon, int size) {
if (size==0)
return false;
- cString iconThemePath = cString::sprintf("%s%s/", *Config.iconPath, Setup.OSDTheme);
- bool success = LoadImage(cString(cIcon), iconThemePath, "png");
+ cString File = cString::sprintf("%s%s/%s.%s", *Config.iconPath, Setup.OSDTheme, cIcon, *logoExtension);
+ bool success = LoadImage(File);
if( !success ) {
- iconThemePath = cString::sprintf("%s%s/", *Config.iconPath, "default");
- success = LoadImage(cString(cIcon), iconThemePath, "png");
- if( !success )
+ File = cString::sprintf("%s%s/%s.%s", *Config.iconPath, "default", cIcon, *logoExtension);
+ success = LoadImage(File);
+ if( !success ) {
+ dsyslog("imageloader LoadIcon: %s could not be loaded", *File);
return false;
+ }
}
if( size >= 0 )
buffer.sample(Geometry(size, size));
@@ -61,28 +66,31 @@ bool cImageLoader::LoadIcon(const char *cIcon, int size) {
}
bool cImageLoader::LoadIcon(const char *cIcon, int width, int height, bool preserveAspect) {
- try {
- if ((width == 0)||(height==0))
- return false;
- cString iconThemePath = cString::sprintf("%s%s/", *Config.iconPath, Setup.OSDTheme);
- bool success = LoadImage(cString(cIcon), iconThemePath, "png");
- if( !success ) {
- iconThemePath = cString::sprintf("%s%s/", *Config.iconPath, "default");
- success = LoadImage(cString(cIcon), iconThemePath, "png");
- if( !success )
+ try {
+ if ((width == 0)||(height==0))
return false;
+ cString File = cString::sprintf("%s%s/%s.%s", *Config.iconPath, Setup.OSDTheme, cIcon, *logoExtension);
+
+ bool success = LoadImage(File);
+ if( !success ) {
+ File = cString::sprintf("%s%s/%s.%s", *Config.iconPath, "default", cIcon, *logoExtension);
+ success = LoadImage(File);
+ if( !success ) {
+ dsyslog("imageloader LoadIcon: %s could not be loaded", *File);
+ return false;
+ }
+ }
+ if (preserveAspect) {
+ buffer.sample(Geometry(width, height));
+ } else {
+ cString geometry = cString::sprintf("%dx%d!", width, height);
+ buffer.scale(Geometry(*geometry));
+ }
+ return true;
}
- if (preserveAspect) {
- buffer.sample(Geometry(width, height));
- } else {
- cString geometry = cString::sprintf("%dx%d!", width, height);
- buffer.scale(Geometry(*geometry));
+ catch (...) {
+ return false;
}
- return true;
- }
- catch (...) {
- return false;
- }
}
cImage cImageLoader::GetImage() {
@@ -120,15 +128,10 @@ void cImageLoader::toLowerCase(std::string &str) {
}
}
-bool cImageLoader::LoadImage(cString FileName, cString Path, cString Extension) {
- cString File = "";
+bool cImageLoader::LoadImage(cString File) {
try {
- File = cString::sprintf("%s%s.%s", *Path, *FileName, *Extension);
- //dsyslog("imageloader: trying to load: %s", *File);
buffer.read(*File);
- //dsyslog("imageloader: %s sucessfully loaded", *File);
} catch (...) {
- dsyslog("imageloader: %s could not be loaded", *File);
return false;
}
return true;
diff --git a/imageloader.h b/imageloader.h
index 9b073701..fc9a3186 100644
--- a/imageloader.h
+++ b/imageloader.h
@@ -31,5 +31,5 @@ private:
Image buffer;
Color Argb2Color(tColor col);
void toLowerCase(std::string &str);
- bool LoadImage(cString FileName, cString Path, cString Extension);
+ bool LoadImage(cString File);
};