mirror of
https://projects.vdr-developer.org/git/vdr-plugin-tvguide.git
synced 2023-10-05 15:01:48 +02:00
Changes in recmenu.c
This commit is contained in:
parent
82e404a74e
commit
763f9d4e52
37
recmenu.c
37
recmenu.c
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
cRecMenu::cRecMenu(void) {
|
cRecMenu::cRecMenu(void) {
|
||||||
border = geoManager.borderRecMenus;
|
border = geoManager.borderRecMenus;
|
||||||
height = 2*border;
|
height = 2 * border;
|
||||||
headerHeight = 0;
|
headerHeight = 0;
|
||||||
footerHeight = 0;
|
footerHeight = 0;
|
||||||
currentHeight = 0;
|
currentHeight = 0;
|
||||||
@ -54,25 +54,29 @@ int cRecMenu::CalculateOptimalWidth(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool cRecMenu::CalculateHeight(bool reDraw) {
|
bool cRecMenu::CalculateHeight(bool reDraw) {
|
||||||
int newHeight = 2*border;
|
int newHeight = 2 * border;
|
||||||
if (header)
|
bool returnvalue = false;
|
||||||
|
if (header) {
|
||||||
newHeight += headerHeight;
|
newHeight += headerHeight;
|
||||||
|
}
|
||||||
for (std::list<cRecMenuItem*>::iterator item = menuItems.begin(); item != menuItems.end(); item++) {
|
for (std::list<cRecMenuItem*>::iterator item = menuItems.begin(); item != menuItems.end(); item++) {
|
||||||
newHeight += (*item)->GetHeight();
|
newHeight += (*item)->GetHeight();
|
||||||
}
|
}
|
||||||
if (footer)
|
if (footer) {
|
||||||
newHeight += footerHeight;
|
newHeight += footerHeight;
|
||||||
|
}
|
||||||
|
|
||||||
y = (geoManager.osdHeight - newHeight) / 2;
|
y = (geoManager.osdHeight - newHeight) / 2;
|
||||||
|
|
||||||
if (newHeight != height) {
|
if (newHeight != height) {
|
||||||
height = newHeight;
|
height = newHeight;
|
||||||
|
returnvalue = true;
|
||||||
|
}
|
||||||
if (scrollable && !reDraw) {
|
if (scrollable && !reDraw) {
|
||||||
width += scrollbarWidth + border;
|
width += scrollbarWidth + border;
|
||||||
|
returnvalue = true;
|
||||||
}
|
}
|
||||||
return true;
|
return returnvalue;
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void cRecMenu::CreatePixmap(void) {
|
void cRecMenu::CreatePixmap(void) {
|
||||||
@ -141,7 +145,6 @@ void cRecMenu::InitMenu(bool complete) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void cRecMenu::AddMenuItem(cRecMenuItem *item, bool inFront) {
|
void cRecMenu::AddMenuItem(cRecMenuItem *item, bool inFront) {
|
||||||
item->Show();
|
item->Show();
|
||||||
if (!inFront)
|
if (!inFront)
|
||||||
@ -153,7 +156,7 @@ void cRecMenu::AddMenuItem(cRecMenuItem *item, bool inFront) {
|
|||||||
bool cRecMenu::AddMenuItemInitial(cRecMenuItem *item, bool inFront) {
|
bool cRecMenu::AddMenuItemInitial(cRecMenuItem *item, bool inFront) {
|
||||||
currentHeight += item->GetHeight();
|
currentHeight += item->GetHeight();
|
||||||
int totalHeight = headerHeight + footerHeight + currentHeight + 2*border;
|
int totalHeight = headerHeight + footerHeight + currentHeight + 2*border;
|
||||||
if (totalHeight >= geoManager.osdHeight - 10) {
|
if (totalHeight >= geoManager.osdHeight - 80) {
|
||||||
scrollable = true;
|
scrollable = true;
|
||||||
currentHeight -= item->GetHeight();
|
currentHeight -= item->GetHeight();
|
||||||
if (deleteMenuItems) {
|
if (deleteMenuItems) {
|
||||||
@ -434,14 +437,16 @@ void cRecMenu::JumpBegin(void) {
|
|||||||
if (currentItem >= numItems)
|
if (currentItem >= numItems)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Arrange(true);
|
if (CalculateHeight(true))
|
||||||
|
CreatePixmap();
|
||||||
|
Arrange(false);
|
||||||
startIndex = 0;
|
startIndex = 0;
|
||||||
stopIndex = numItems-1;
|
stopIndex = numItems - 1;
|
||||||
cRecMenuItem *first = menuItems.front();
|
cRecMenuItem *first = menuItems.front();
|
||||||
first->setActive();
|
first->setActive();
|
||||||
first->setBackground();
|
first->setBackground();
|
||||||
first->Draw();
|
first->Draw();
|
||||||
Display(true);
|
Display(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -470,7 +475,7 @@ void cRecMenu::JumpEnd(void) {
|
|||||||
activeItem->setBackground();
|
activeItem->setBackground();
|
||||||
ClearMenuItems();
|
ClearMenuItems();
|
||||||
int totalNumItems = GetTotalNumMenuItems();
|
int totalNumItems = GetTotalNumMenuItems();
|
||||||
int currentItem = totalNumItems-1;
|
int currentItem = totalNumItems - 1;
|
||||||
int itemsAdded = 0;
|
int itemsAdded = 0;
|
||||||
cRecMenuItem *newItem = NULL;
|
cRecMenuItem *newItem = NULL;
|
||||||
while (newItem = GetMenuItem(currentItem)) {
|
while (newItem = GetMenuItem(currentItem)) {
|
||||||
@ -480,7 +485,9 @@ void cRecMenu::JumpEnd(void) {
|
|||||||
if (itemsAdded >= numItems)
|
if (itemsAdded >= numItems)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Arrange(true);
|
if (CalculateHeight(true))
|
||||||
|
CreatePixmap();
|
||||||
|
Arrange(false);
|
||||||
stopIndex = totalNumItems;
|
stopIndex = totalNumItems;
|
||||||
startIndex = stopIndex - numItems;
|
startIndex = stopIndex - numItems;
|
||||||
if (footer) {
|
if (footer) {
|
||||||
@ -493,7 +500,7 @@ void cRecMenu::JumpEnd(void) {
|
|||||||
last->setBackground();
|
last->setBackground();
|
||||||
last->Draw();
|
last->Draw();
|
||||||
}
|
}
|
||||||
Display(true);
|
Display(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user