mirror of
https://projects.vdr-developer.org/git/vdr-plugin-tvguide.git
synced 2023-10-05 13:01:48 +00:00
Version 1.2.0pre
This commit is contained in:
@@ -6,34 +6,12 @@
|
||||
cStatusHeader::cStatusHeader(void) {
|
||||
color = theme.Color(clrStatusHeader);
|
||||
colorBlending = theme.Color(clrStatusHeaderBlending);
|
||||
height = tvguideConfig.statusHeaderHeight;
|
||||
if (tvguideConfig.scaleVideo) {
|
||||
width = tvguideConfig.osdWidth - height * 16 / 9;
|
||||
} else {
|
||||
width = tvguideConfig.osdWidth;
|
||||
}
|
||||
int tvFrameWidth = tvguideConfig.osdWidth - width;
|
||||
height = geoManager.statusHeaderHeight;
|
||||
width = geoManager.statusHeaderContentWidth;
|
||||
tvFrameWidth = geoManager.tvFrameWidth;
|
||||
pixmap = osdManager.requestPixmap(1, cRect(0, 0, width, height));
|
||||
pixmapText = osdManager.requestPixmap(2, cRect(0, 0, width, height));
|
||||
pixmapText->Fill(clrTransparent);
|
||||
|
||||
pixmapTVFrame = osdManager.requestPixmap(1, cRect(width, 0, tvFrameWidth, height));
|
||||
pixmapTVFrame->Fill(clrTransparent);
|
||||
if (tvguideConfig.decorateVideo) {
|
||||
int radius = 16;
|
||||
int frame = 10;
|
||||
pixmapTVFrame->DrawRectangle(cRect(0, 0, tvFrameWidth, frame), theme.Color(clrBackground));
|
||||
pixmapTVFrame->DrawEllipse(cRect(frame,frame,radius,radius), theme.Color(clrBackground), -2);
|
||||
pixmapTVFrame->DrawRectangle(cRect(tvFrameWidth - frame, frame, frame, height - 2*frame), theme.Color(clrBackground));
|
||||
pixmapTVFrame->DrawEllipse(cRect(tvFrameWidth - radius - frame, frame, radius, radius), theme.Color(clrBackground), -1);
|
||||
pixmapTVFrame->DrawRectangle(cRect(0, frame, frame, height - 2*frame), theme.Color(clrBackground));
|
||||
pixmapTVFrame->DrawEllipse(cRect(frame, height - radius - frame, radius, radius), theme.Color(clrBackground), -3);
|
||||
pixmapTVFrame->DrawRectangle(cRect(0, height - frame, tvFrameWidth, frame), theme.Color(clrBackground));
|
||||
pixmapTVFrame->DrawEllipse(cRect(tvFrameWidth - radius - frame, height - radius - frame, radius, radius), theme.Color(clrBackground), -4);
|
||||
|
||||
}
|
||||
drawBackground();
|
||||
drawBorder();
|
||||
}
|
||||
|
||||
cStatusHeader::~cStatusHeader(void) {
|
||||
@@ -45,10 +23,32 @@ cStatusHeader::~cStatusHeader(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void cStatusHeader::Draw(void) {
|
||||
pixmapText->Fill(clrTransparent);
|
||||
pixmapTVFrame->Fill(clrTransparent);
|
||||
if (tvguideConfig.style == eStyleGraphical) {
|
||||
if (tvguideConfig.scaleVideo) {
|
||||
drawBackgroundGraphical(bgStatusHeaderWindowed);
|
||||
cImage *tvFrameBack = imgCache.GetOsdElement(oeStatusHeaderTVFrame);
|
||||
if (tvFrameBack)
|
||||
pixmapTVFrame->DrawImage(cPoint(0,0), *tvFrameBack);
|
||||
} else {
|
||||
drawBackgroundGraphical(bgStatusHeaderFull);
|
||||
}
|
||||
|
||||
} else {
|
||||
if (tvguideConfig.decorateVideo) {
|
||||
DecorateVideoFrame();
|
||||
}
|
||||
drawBackground();
|
||||
drawBorder();
|
||||
}
|
||||
}
|
||||
|
||||
void cStatusHeader::ScaleVideo(void) {
|
||||
if (tvguideConfig.scaleVideo) {
|
||||
int width = height * 16 / 9;
|
||||
int x = osdManager.Left() + tvguideConfig.osdWidth - width;
|
||||
int x = osdManager.Left() + geoManager.osdWidth - width;
|
||||
int y = osdManager.Top();
|
||||
cRect availableRect(x, y, width, height);
|
||||
cRect vidWin = cDevice::PrimaryDevice()->CanScaleVideo(availableRect);
|
||||
@@ -58,8 +58,8 @@ void cStatusHeader::ScaleVideo(void) {
|
||||
|
||||
void cStatusHeader::DrawInfoText(cGrid *grid) {
|
||||
int border = 10;
|
||||
int textWidth = width - 2 * border;
|
||||
tColor colorTextBack = (tvguideConfig.useBlending==0)?color:clrTransparent;
|
||||
int textWidth = width - 2 * border - geoManager.clockWidth - 2;
|
||||
tColor colorTextBack = (tvguideConfig.style == eStyleFlat)?color:clrTransparent;
|
||||
pixmapText->Fill(clrTransparent);
|
||||
int x = border;
|
||||
int y = border;
|
||||
@@ -74,29 +74,29 @@ void cStatusHeader::DrawInfoText(cGrid *grid) {
|
||||
cString title("");
|
||||
title = cString::sprintf(": %s", event->Title());
|
||||
cString header = cString::sprintf("%s%s", *time, *title);
|
||||
header = CutText(*header, textWidth, tvguideConfig.FontStatusHeaderLarge).c_str();
|
||||
pixmapText->DrawText(cPoint(x,y), *header, theme.Color(clrFont), colorTextBack, tvguideConfig.FontStatusHeaderLarge);
|
||||
y += tvguideConfig.FontStatusHeaderLarge->Height() + border;
|
||||
header = CutText(*header, textWidth, fontManager.FontStatusHeaderLarge).c_str();
|
||||
pixmapText->DrawText(cPoint(x,y), *header, theme.Color(clrFont), colorTextBack, fontManager.FontStatusHeaderLarge);
|
||||
y += fontManager.FontStatusHeaderLarge->Height() + border;
|
||||
int heightText = pixmapText->ViewPort().Height() - y;
|
||||
cTextWrapper description;
|
||||
description.Set(event->Description(), tvguideConfig.FontStatusHeader, textWidth);
|
||||
int lineHeight = tvguideConfig.FontStatusHeader->Height();
|
||||
description.Set(event->Description(), fontManager.FontStatusHeader, textWidth);
|
||||
int lineHeight = fontManager.FontStatusHeader->Height();
|
||||
int textLines = description.Lines();
|
||||
int maxLines = heightText / lineHeight;
|
||||
int lines = min(textLines, maxLines);
|
||||
for (int i = 0; i < lines-1; i++) {
|
||||
pixmapText->DrawText(cPoint(x,y), description.GetLine(i), theme.Color(clrFont), colorTextBack, tvguideConfig.FontStatusHeader);
|
||||
pixmapText->DrawText(cPoint(x,y), description.GetLine(i), theme.Color(clrFont), colorTextBack, fontManager.FontStatusHeader);
|
||||
y += lineHeight;
|
||||
}
|
||||
cString lastLine = description.GetLine(lines-1);
|
||||
if (textLines > maxLines) {
|
||||
lastLine = cString::sprintf("%s...", *lastLine);
|
||||
}
|
||||
pixmapText->DrawText(cPoint(x,y), *lastLine, theme.Color(clrFont), colorTextBack, tvguideConfig.FontStatusHeader);
|
||||
pixmapText->DrawText(cPoint(x,y), *lastLine, theme.Color(clrFont), colorTextBack, fontManager.FontStatusHeader);
|
||||
} else {
|
||||
int heightText = pixmapText->ViewPort().Height() - y;
|
||||
y += (heightText - tvguideConfig.FontStatusHeaderLarge->Height() - 2*border)/2;
|
||||
pixmapText->DrawText(cPoint(x,y), *grid->getText(), theme.Color(clrFont), colorTextBack, tvguideConfig.FontStatusHeaderLarge);
|
||||
y += (heightText - fontManager.FontStatusHeaderLarge->Height() - 2*border)/2;
|
||||
pixmapText->DrawText(cPoint(x,y), *grid->getText(), theme.Color(clrFont), colorTextBack, fontManager.FontStatusHeaderLarge);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,3 +130,16 @@ int cStatusHeader::DrawPoster(const cEvent *event, int x, int y, int height, int
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void cStatusHeader::DecorateVideoFrame(void) {
|
||||
int radius = 16;
|
||||
int frame = 10;
|
||||
pixmapTVFrame->DrawRectangle(cRect(0, 0, tvFrameWidth, frame), theme.Color(clrBackground));
|
||||
pixmapTVFrame->DrawEllipse(cRect(frame,frame,radius,radius), theme.Color(clrBackground), -2);
|
||||
pixmapTVFrame->DrawRectangle(cRect(tvFrameWidth - frame, frame, frame, height - 2*frame), theme.Color(clrBackground));
|
||||
pixmapTVFrame->DrawEllipse(cRect(tvFrameWidth - radius - frame, frame, radius, radius), theme.Color(clrBackground), -1);
|
||||
pixmapTVFrame->DrawRectangle(cRect(0, frame, frame, height - 2*frame), theme.Color(clrBackground));
|
||||
pixmapTVFrame->DrawEllipse(cRect(frame, height - radius - frame, radius, radius), theme.Color(clrBackground), -3);
|
||||
pixmapTVFrame->DrawRectangle(cRect(0, height - frame, tvFrameWidth, frame), theme.Color(clrBackground));
|
||||
pixmapTVFrame->DrawEllipse(cRect(tvFrameWidth - radius - frame, height - radius - frame, radius, radius), theme.Color(clrBackground), -4);
|
||||
}
|
Reference in New Issue
Block a user