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:
130
footer.c
130
footer.c
@@ -6,16 +6,13 @@
|
||||
cFooter::cFooter(cChannelGroups *channelGroups) {
|
||||
this->channelGroups = channelGroups;
|
||||
currentGroup = -1;
|
||||
buttonBorder = 20;
|
||||
buttonWidth = (tvguideConfig.osdWidth - tvguideConfig.timeLineWidth - 5*buttonBorder)/4;
|
||||
buttonHeight= tvguideConfig.footerHeight - 2*buttonBorder;
|
||||
buttonY = (tvguideConfig.footerHeight - buttonHeight)/2;
|
||||
buttonY = (geoManager.footerHeight - geoManager.buttonHeight)/2;
|
||||
SetButtonPositions();
|
||||
|
||||
footer = osdManager.requestPixmap(2, cRect( tvguideConfig.timeLineWidth,
|
||||
tvguideConfig.osdHeight - tvguideConfig.footerHeight,
|
||||
tvguideConfig.osdWidth - tvguideConfig.timeLineWidth,
|
||||
tvguideConfig.footerHeight),
|
||||
footer = osdManager.requestPixmap(2, cRect( 0,
|
||||
geoManager.osdHeight - geoManager.footerHeight,
|
||||
geoManager.osdWidth,
|
||||
geoManager.footerHeight),
|
||||
cRect::Null);
|
||||
footer->Fill(clrTransparent);
|
||||
}
|
||||
@@ -24,6 +21,49 @@ cFooter::~cFooter(void) {
|
||||
osdManager.releasePixmap(footer);
|
||||
}
|
||||
|
||||
void cFooter::drawRedButton() {
|
||||
cString text(tr("Search & Rec"));
|
||||
DrawButton(*text, theme.Color(clrButtonRed), theme.Color(clrButtonRedBorder), oeButtonRed, positionButtons[0]);
|
||||
}
|
||||
|
||||
void cFooter::drawGreenButton() {
|
||||
cString text = cString::sprintf("%d %s", tvguideConfig.jumpChannels, tr("Channels back"));
|
||||
DrawButton(*text, theme.Color(clrButtonGreen), theme.Color(clrButtonGreenBorder), oeButtonGreen, positionButtons[1]);
|
||||
}
|
||||
|
||||
void cFooter::drawGreenButton(const char *text) {
|
||||
std::string cuttedText = CutText(text, geoManager.buttonWidth-6, fontManager.FontButton);
|
||||
DrawButton(cuttedText.c_str(), theme.Color(clrButtonGreen), theme.Color(clrButtonGreenBorder), oeButtonGreen, positionButtons[1]);
|
||||
}
|
||||
|
||||
void cFooter::drawYellowButton() {
|
||||
cString text = cString::sprintf("%d %s", tvguideConfig.jumpChannels, tr("Channels forward"));
|
||||
DrawButton(*text, theme.Color(clrButtonYellow), theme.Color(clrButtonYellowBorder), oeButtonYellow, positionButtons[2]);
|
||||
}
|
||||
|
||||
void cFooter::drawYellowButton(const char *text) {
|
||||
std::string cuttedText = CutText(text, geoManager.buttonWidth-6, fontManager.FontButton);
|
||||
DrawButton(cuttedText.c_str(), theme.Color(clrButtonYellow), theme.Color(clrButtonYellowBorder), oeButtonYellow, positionButtons[2]);
|
||||
}
|
||||
|
||||
void cFooter::drawBlueButton() {
|
||||
cString text;
|
||||
if (tvguideConfig.blueKeyMode == 0)
|
||||
text = tr("Switch to Channel");
|
||||
else if (tvguideConfig.blueKeyMode == 1)
|
||||
text = tr("Detailed EPG");
|
||||
DrawButton(*text, theme.Color(clrButtonBlue), theme.Color(clrButtonBlueBorder), oeButtonBlue, positionButtons[3]);
|
||||
}
|
||||
|
||||
void cFooter::UpdateGroupButtons(const cChannel *channel) {
|
||||
int group = channelGroups->GetGroup(channel);
|
||||
if (group != currentGroup) {
|
||||
currentGroup = group;
|
||||
drawGreenButton(channelGroups->GetPrev(group));
|
||||
drawYellowButton(channelGroups->GetNext(group));
|
||||
}
|
||||
}
|
||||
|
||||
void cFooter::SetButtonPositions(void) {
|
||||
for (int i=0; i < 4; i++) {
|
||||
positionButtons[i] = -1;
|
||||
@@ -54,62 +94,26 @@ void cFooter::SetButtonPositions(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void cFooter::DrawButton(const char *text, tColor color, tColor borderColor, int num) {
|
||||
tColor colorTextBack = (tvguideConfig.useBlending==0)?color:clrTransparent;
|
||||
int left = num * buttonWidth + (num + 1) * buttonBorder;
|
||||
footer->DrawRectangle(cRect(left, buttonY, buttonWidth, buttonHeight), borderColor);
|
||||
if (tvguideConfig.useBlending) {
|
||||
void cFooter::DrawButton(const char *text, tColor color, tColor borderColor, eOsdElementType buttonType, int num) {
|
||||
tColor colorTextBack = (tvguideConfig.style == eStyleFlat)?color:clrTransparent;
|
||||
int left = num * geoManager.buttonWidth + (2 * num + 1) * geoManager.buttonBorder;
|
||||
|
||||
if ((tvguideConfig.style == eStyleBlendingMagick) || (tvguideConfig.style == eStyleBlendingDefault)) {
|
||||
cImageLoader imgLoader;
|
||||
imgLoader.DrawBackground(theme.Color(clrButtonBlend), color, buttonWidth-4, buttonHeight-4);
|
||||
imgLoader.DrawBackground(theme.Color(clrButtonBlend), color, geoManager.buttonWidth-4, geoManager.buttonHeight-4);
|
||||
footer->DrawRectangle(cRect(left, buttonY, geoManager.buttonWidth, geoManager.buttonHeight), borderColor);
|
||||
footer->DrawImage(cPoint(left+2, buttonY+2), imgLoader.GetImage());
|
||||
} else if (tvguideConfig.style == eStyleGraphical) {
|
||||
cImage *button = imgCache.GetOsdElement(buttonType);
|
||||
if (button) {
|
||||
footer->DrawImage(cPoint(left, buttonY), *button);
|
||||
}
|
||||
} else {
|
||||
footer->DrawRectangle(cRect(left, buttonY, buttonWidth, buttonHeight), borderColor);
|
||||
footer->DrawRectangle(cRect(left+2, buttonY+2, buttonWidth-4, buttonHeight-4), color);
|
||||
footer->DrawRectangle(cRect(left, buttonY, geoManager.buttonWidth, geoManager.buttonHeight), borderColor);
|
||||
footer->DrawRectangle(cRect(left+2, buttonY+2, geoManager.buttonWidth-4, geoManager.buttonHeight-4), color);
|
||||
}
|
||||
int textWidth = tvguideConfig.FontButton->Width(text);
|
||||
int textHeight = tvguideConfig.FontButton->Height();
|
||||
footer->DrawText(cPoint(left + (buttonWidth-textWidth)/2, buttonY + (buttonHeight-textHeight)/2), text, theme.Color(clrFontButtons), colorTextBack, tvguideConfig.FontButton);
|
||||
}
|
||||
|
||||
void cFooter::drawRedButton() {
|
||||
cString text(tr("Search & Rec"));
|
||||
DrawButton(*text, theme.Color(clrButtonRed), theme.Color(clrButtonRedBorder), positionButtons[0]);
|
||||
}
|
||||
|
||||
void cFooter::drawGreenButton() {
|
||||
cString text = cString::sprintf("%d %s", tvguideConfig.jumpChannels, tr("Channels back"));
|
||||
DrawButton(*text, theme.Color(clrButtonGreen), theme.Color(clrButtonGreenBorder), positionButtons[1]);
|
||||
}
|
||||
|
||||
void cFooter::drawGreenButton(const char *text) {
|
||||
std::string cuttedText = CutText(text, buttonWidth-6, tvguideConfig.FontButton);
|
||||
DrawButton(cuttedText.c_str(), theme.Color(clrButtonGreen), theme.Color(clrButtonGreenBorder), positionButtons[1]);
|
||||
}
|
||||
|
||||
void cFooter::drawYellowButton() {
|
||||
cString text = cString::sprintf("%d %s", tvguideConfig.jumpChannels, tr("Channels forward"));
|
||||
DrawButton(*text, theme.Color(clrButtonYellow), theme.Color(clrButtonYellowBorder), positionButtons[2]);
|
||||
}
|
||||
|
||||
void cFooter::drawYellowButton(const char *text) {
|
||||
std::string cuttedText = CutText(text, buttonWidth-6, tvguideConfig.FontButton);
|
||||
DrawButton(cuttedText.c_str(), theme.Color(clrButtonYellow), theme.Color(clrButtonYellowBorder), positionButtons[2]);
|
||||
}
|
||||
|
||||
void cFooter::drawBlueButton() {
|
||||
cString text;
|
||||
if (tvguideConfig.blueKeyMode == 0)
|
||||
text = tr("Switch to Channel");
|
||||
else if (tvguideConfig.blueKeyMode == 1)
|
||||
text = tr("Detailed EPG");
|
||||
DrawButton(*text, theme.Color(clrButtonBlue), theme.Color(clrButtonBlueBorder), positionButtons[3]);
|
||||
}
|
||||
|
||||
void cFooter::UpdateGroupButtons(const cChannel *channel) {
|
||||
int group = channelGroups->GetGroup(channel);
|
||||
if (group != currentGroup) {
|
||||
currentGroup = group;
|
||||
drawGreenButton(channelGroups->GetPrev(group));
|
||||
drawYellowButton(channelGroups->GetNext(group));
|
||||
}
|
||||
}
|
||||
|
||||
int textWidth = fontManager.FontButton->Width(text);
|
||||
int textHeight = fontManager.FontButton->Height();
|
||||
footer->DrawText(cPoint(left + (geoManager.buttonWidth-textWidth)/2, buttonY + (geoManager.buttonHeight-textHeight)/2), text, theme.Color(clrFontButtons), colorTextBack, fontManager.FontButton);
|
||||
}
|
Reference in New Issue
Block a user