diff options
author | louis <louis.braun@gmx.de> | 2015-04-06 13:13:32 +0200 |
---|---|---|
committer | louis <louis.braun@gmx.de> | 2015-04-06 13:13:32 +0200 |
commit | 252bd209395cbad7bec01e7259fca799a696d898 (patch) | |
tree | 545854d59255c93d18f15a812e34835741df7400 | |
parent | 15b166628fe52ba9bc166e0567443824427598fe (diff) | |
download | vdr-plugin-tvguideng-252bd209395cbad7bec01e7259fca799a696d898.tar.gz vdr-plugin-tvguideng-252bd209395cbad7bec01e7259fca799a696d898.tar.bz2 |
added wraparound scrolling in recording menus
-rw-r--r-- | HISTORY | 2 | ||||
-rw-r--r-- | recmenu.c | 87 | ||||
-rw-r--r-- | recmenu.h | 6 | ||||
-rw-r--r-- | recmenus.c | 4 |
4 files changed, 87 insertions, 12 deletions
@@ -23,3 +23,5 @@ Version 0.0.3 Version 0.1.0 +- added wraparound scrolling in recording menus + @@ -97,13 +97,15 @@ eRecMenuState cRecMenu::ProcessKey(eKeys Key) { } else if (state == rmsNotConsumed) {
switch (Key & ~k_Repeat) {
case kUp:
- if (ScrollUp(false))
- Draw();
+ if (!ScrollUp(false))
+ SetLast();
+ Draw();
state = rmsConsumed;
break;
case kDown:
- if (ScrollDown(false))
- Draw();
+ if (!ScrollDown(false))
+ SetFirst();
+ Draw();
state = rmsConsumed;
break;
case kLeft:
@@ -207,9 +209,9 @@ bool cRecMenu::ScrollDown(bool retry) { } else {
SeekForward(false);
if (!retry)
- ScrollDown(true);
+ return ScrollDown(true);
}
- if (footer) {
+ if (footer && active != footer) {
recMenuGrid->SetCurrent(active->Id(), false);
active->SetInactive();
active = footer;
@@ -253,13 +255,25 @@ bool cRecMenu::PageDown(void) { return scrolled;
}
-void cRecMenu::ClearMenuItems(void) {
- menuItems.Clear();
+void cRecMenu::ClearMenuItems(bool deleteItems) {
+ if (deleteItems) {
+ menuItems.Clear();
+ active = NULL;
+ } else {
+ for (cRecMenuItem *current = menuItems.First(); current; current = menuItems.Next(current)) {
+ current->SetNew();
+ }
+ }
+ itemCount = 0;
back->Clear();
scrollBar->Clear();
recMenuGrid->Clear();
+ if (header)
+ header->SetNew();
if (footer)
footer->SetNew();
+ if (active)
+ active->SetInactive();
active = NULL;
}
@@ -291,6 +305,34 @@ void cRecMenu::InitMenuItems(void) { }
}
+void cRecMenu::InitMenuItemsLast(void) {
+ if (menuItems.Count() == 0)
+ return;
+ scrolling = false;
+ menuHeight = 0;
+ stop = menuItems.Last();
+ active = stop;
+ active->SetActive();
+ cRecMenuItem *current = stop;
+ while (current) {
+ int itemHeight = current->GetHeight();
+ if (menuHeight + itemHeight > maxMenuHeight) {
+ scrolling = true;
+ break;
+ }
+ itemCount++;
+ start = current;
+ menuHeight += itemHeight;
+ current = menuItems.Prev(current);
+ }
+ DrawBackground();
+ Flush();
+ if (scrolling) {
+ DrawScrollbar();
+ Flush();
+ }
+}
+
int cRecMenu::GetHeight(void) {
int totalHeight = menuHeight;
if (header)
@@ -362,6 +404,35 @@ bool cRecMenu::SeekBack(bool page) { return false;
}
+void cRecMenu::SetFirst(void) {
+ if (!scrolling) {
+ recMenuGrid->SetCurrent(active->Id(), false);
+ active->SetInactive();
+ active = start;
+ active->SetActive();
+ return;
+ }
+ ClearMenuItems(false);
+ menuItems.First()->SetActive();
+ InitMenuItems();
+}
+
+void cRecMenu::SetLast(void) {
+ if (!scrolling) {
+ recMenuGrid->SetCurrent(active->Id(), false);
+ active->SetInactive();
+ if (footer) {
+ active = footer;
+ } else {
+ active = stop;
+ }
+ active->SetActive();
+ return;
+ }
+ ClearMenuItems(false);
+ InitMenuItemsLast();
+}
+
void cRecMenu::DrawBackground(void) {
back->Clear();
back->ClearTokens();
@@ -27,7 +27,8 @@ private: bool scrolling;
bool SeekForward(bool page);
bool SeekBack(bool page);
- void AdjustActive(bool down);
+ void SetFirst(void);
+ void SetLast(void);
void DrawScrollbar(void);
void DrawHeader(void);
void DrawFooter(void);
@@ -42,8 +43,9 @@ protected: bool ScrollDown(bool retry);
bool PageUp(void);
bool PageDown(void);
- void ClearMenuItems(void);
+ void ClearMenuItems(bool deleteItems);
void InitMenuItems(void);
+ void InitMenuItemsLast(void);
int GetWidth(void) { return menuWidth; };
int GetHeight(void);
public:
@@ -953,7 +953,7 @@ void cRecMenuTimeline::PrevDay(void) { return;
timeStart -= 3600*24;
timeStop -= 3600*24;
- ClearMenuItems();
+ ClearMenuItems(true);
GetTimersForDay();
SetTimers();
InitMenuItems();
@@ -965,7 +965,7 @@ void cRecMenuTimeline::PrevDay(void) { void cRecMenuTimeline::NextDay(void) {
timeStart += 3600*24;
timeStop += 3600*24;
- ClearMenuItems();
+ ClearMenuItems(true);
GetTimersForDay();
SetTimers();
InitMenuItems();
|