left / right scroll page up / down in recmenu result lists

This commit is contained in:
louis 2014-01-18 14:10:42 +01:00
parent 662a17df88
commit 475964a781
3 changed files with 94 additions and 6 deletions

View File

@ -108,3 +108,4 @@ Version 1.1.0
- Favorites menu with EPG Search favorite timers with blue key - Favorites menu with EPG Search favorite timers with blue key
- Display baseline for current time - Display baseline for current time
- Added possibility to create timer from favorites results - Added possibility to create timer from favorites results
- left / right scroll page up / down in recmenu result lists

View File

@ -150,7 +150,7 @@ void cRecMenu::AddMenuItem(cRecMenuItem *item, bool inFront) {
menuItems.push_front(item); menuItems.push_front(item);
} }
bool cRecMenu::AddMenuItemInitial(cRecMenuItem *item) { 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) { if (totalHeight >= geoManager.osdHeight) {
@ -161,9 +161,14 @@ bool cRecMenu::AddMenuItemInitial(cRecMenuItem *item) {
} }
return false; return false;
} }
stopIndex++;
numItems++; numItems++;
menuItems.push_back(item); if (!inFront) {
stopIndex++;
menuItems.push_back(item);
} else {
startIndex--;
menuItems.push_front(item);
}
return true; return true;
} }
@ -315,6 +320,86 @@ bool cRecMenu::ScrollDown(void) {
return true; return true;
} }
void cRecMenu::PageUp(void) {
cRecMenuItem *activeItem = GetActiveMenuItem();
if (!activeItem)
return;
if (!scrollable) {
JumpBegin();
return;
}
int newActive = GetActive() - numItems;
if (newActive < 0)
newActive = 0;
activeItem->setInactive();
activeItem->setBackground();
ClearMenuItems();
currentHeight = 0;
stopIndex = startIndex;
numItems = 0;
cRecMenuItem *newItem = NULL;
bool spaceLeft = true;
while (newItem = GetMenuItem(startIndex-1)) {
if (startIndex-1 == newActive)
newItem->setActive();
spaceLeft = AddMenuItemInitial(newItem, true);
if (!spaceLeft)
break;
}
if (spaceLeft) {
while (newItem = GetMenuItem(stopIndex)) {
spaceLeft = AddMenuItemInitial(newItem);
if (!spaceLeft)
break;
}
}
if (GetActive() == numItems)
menuItems.front()->setActive();
if (CalculateHeight(true))
CreatePixmap();
Arrange(deleteMenuItems);
Display(deleteMenuItems);
}
void cRecMenu::PageDown(void) {
cRecMenuItem *activeItem = GetActiveMenuItem();
if (!activeItem)
return;
if (!scrollable) {
JumpEnd();
return;
}
int newActive = GetActive() + numItems;
activeItem->setInactive();
activeItem->setBackground();
ClearMenuItems();
currentHeight = 0;
numItems = 0;
startIndex = stopIndex;
cRecMenuItem *newItem = NULL;
bool spaceLeft = true;
while (newItem = GetMenuItem(stopIndex)) {
if (stopIndex == newActive)
newItem->setActive();
spaceLeft = AddMenuItemInitial(newItem);
if (!spaceLeft)
break;
}
if (spaceLeft) {
while (newItem = GetMenuItem(startIndex-1)) {
spaceLeft = AddMenuItemInitial(newItem, true);
if (!spaceLeft)
break;
}
}
if (GetActive() == GetTotalNumMenuItems())
menuItems.back()->setActive();
if (CalculateHeight(true))
CreatePixmap();
Arrange(deleteMenuItems);
Display(deleteMenuItems);
}
void cRecMenu::JumpBegin(void) { void cRecMenu::JumpBegin(void) {
cRecMenuItem *activeItem = GetActiveMenuItem(); cRecMenuItem *activeItem = GetActiveMenuItem();
if (!scrollable) { if (!scrollable) {
@ -551,11 +636,11 @@ eRecMenuState cRecMenu::ProcessKey(eKeys Key) {
state = rmsConsumed; state = rmsConsumed;
break; break;
case kLeft: case kLeft:
JumpBegin(); PageUp();
state = rmsConsumed; state = rmsConsumed;
break; break;
case kRight: case kRight:
JumpEnd(); PageDown();
state = rmsConsumed; state = rmsConsumed;
break; break;
default: default:

View File

@ -16,6 +16,8 @@ private:
bool ActivatePrev(void); bool ActivatePrev(void);
bool ScrollUp(void); bool ScrollUp(void);
bool ScrollDown(void); bool ScrollDown(void);
void PageUp(void);
void PageDown(void);
void JumpBegin(void); void JumpBegin(void);
void JumpEnd(void); void JumpEnd(void);
protected: protected:
@ -39,7 +41,7 @@ protected:
void SetFooter(cRecMenuItem *footer); void SetFooter(cRecMenuItem *footer);
void ClearMenuItems(bool destructor = false); void ClearMenuItems(bool destructor = false);
void InitMenu(bool complete); void InitMenu(bool complete);
bool AddMenuItemInitial(cRecMenuItem *item); bool AddMenuItemInitial(cRecMenuItem *item, bool inFront = false);
void AddMenuItem(cRecMenuItem *item, bool inFront = false); void AddMenuItem(cRecMenuItem *item, bool inFront = false);
void DrawScrollBar(void); void DrawScrollBar(void);
cImage *createScrollbar(int width, int height, tColor clrBgr, tColor clrBlend); cImage *createScrollbar(int width, int height, tColor clrBgr, tColor clrBlend);