summaryrefslogtreecommitdiff
path: root/recmenu.c
diff options
context:
space:
mode:
authorkamel5 <vdr.kamel5 (at) gmx (dot) net>2019-06-16 14:01:22 +0200
committerkamel5 <vdr.kamel5 (at) gmx (dot) net>2019-06-16 14:01:22 +0200
commit763f9d4e528f42526ea978d2f0ca168a04491805 (patch)
treea342fd7cd4784bb123d2d286a94de398f22cefce /recmenu.c
parent82e404a74e7f470998771267e36292fd2651d59d (diff)
downloadvdr-plugin-tvguide-763f9d4e528f42526ea978d2f0ca168a04491805.tar.gz
vdr-plugin-tvguide-763f9d4e528f42526ea978d2f0ca168a04491805.tar.bz2
Changes in recmenu.c
Diffstat (limited to 'recmenu.c')
-rw-r--r--recmenu.c45
1 files changed, 26 insertions, 19 deletions
diff --git a/recmenu.c b/recmenu.c
index 1c8166c..4243666 100644
--- a/recmenu.c
+++ b/recmenu.c
@@ -5,7 +5,7 @@
cRecMenu::cRecMenu(void) {
border = geoManager.borderRecMenus;
- height = 2*border;
+ height = 2 * border;
headerHeight = 0;
footerHeight = 0;
currentHeight = 0;
@@ -54,25 +54,29 @@ int cRecMenu::CalculateOptimalWidth(void) {
}
bool cRecMenu::CalculateHeight(bool reDraw) {
- int newHeight = 2*border;
- if (header)
+ int newHeight = 2 * border;
+ bool returnvalue = false;
+ if (header) {
newHeight += headerHeight;
+ }
for (std::list<cRecMenuItem*>::iterator item = menuItems.begin(); item != menuItems.end(); item++) {
- newHeight += (*item)->GetHeight();
+ newHeight += (*item)->GetHeight();
}
- if (footer)
+ if (footer) {
newHeight += footerHeight;
+ }
y = (geoManager.osdHeight - newHeight) / 2;
if (newHeight != height) {
height = newHeight;
- if (scrollable && !reDraw) {
- width += scrollbarWidth + border;
- }
- return true;
+ returnvalue = true;
}
- return false;
+ if (scrollable && !reDraw) {
+ width += scrollbarWidth + border;
+ returnvalue = true;
+ }
+ return returnvalue;
}
void cRecMenu::CreatePixmap(void) {
@@ -141,7 +145,6 @@ void cRecMenu::InitMenu(bool complete) {
}
-
void cRecMenu::AddMenuItem(cRecMenuItem *item, bool inFront) {
item->Show();
if (!inFront)
@@ -153,7 +156,7 @@ void cRecMenu::AddMenuItem(cRecMenuItem *item, bool inFront) {
bool cRecMenu::AddMenuItemInitial(cRecMenuItem *item, bool inFront) {
currentHeight += item->GetHeight();
int totalHeight = headerHeight + footerHeight + currentHeight + 2*border;
- if (totalHeight >= geoManager.osdHeight - 10) {
+ if (totalHeight >= geoManager.osdHeight - 80) {
scrollable = true;
currentHeight -= item->GetHeight();
if (deleteMenuItems) {
@@ -434,14 +437,16 @@ void cRecMenu::JumpBegin(void) {
if (currentItem >= numItems)
break;
}
- Arrange(true);
+ if (CalculateHeight(true))
+ CreatePixmap();
+ Arrange(false);
startIndex = 0;
- stopIndex = numItems-1;
+ stopIndex = numItems - 1;
cRecMenuItem *first = menuItems.front();
first->setActive();
first->setBackground();
first->Draw();
- Display(true);
+ Display(false);
}
}
@@ -470,7 +475,7 @@ void cRecMenu::JumpEnd(void) {
activeItem->setBackground();
ClearMenuItems();
int totalNumItems = GetTotalNumMenuItems();
- int currentItem = totalNumItems-1;
+ int currentItem = totalNumItems - 1;
int itemsAdded = 0;
cRecMenuItem *newItem = NULL;
while (newItem = GetMenuItem(currentItem)) {
@@ -480,7 +485,9 @@ void cRecMenu::JumpEnd(void) {
if (itemsAdded >= numItems)
break;
}
- Arrange(true);
+ if (CalculateHeight(true))
+ CreatePixmap();
+ Arrange(false);
stopIndex = totalNumItems;
startIndex = stopIndex - numItems;
if (footer) {
@@ -493,7 +500,7 @@ void cRecMenu::JumpEnd(void) {
last->setBackground();
last->Draw();
}
- Display(true);
+ Display(false);
}
}
@@ -692,4 +699,4 @@ cImage *cRecMenu::createScrollbar(int width, int height, tColor clrBgr, tColor c
}
}
return image;
-} \ No newline at end of file
+}