summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlouis <louis.braun@gmx.de>2015-04-06 13:13:32 +0200
committerlouis <louis.braun@gmx.de>2015-04-06 13:13:32 +0200
commit252bd209395cbad7bec01e7259fca799a696d898 (patch)
tree545854d59255c93d18f15a812e34835741df7400
parent15b166628fe52ba9bc166e0567443824427598fe (diff)
downloadvdr-plugin-tvguideng-252bd209395cbad7bec01e7259fca799a696d898.tar.gz
vdr-plugin-tvguideng-252bd209395cbad7bec01e7259fca799a696d898.tar.bz2
added wraparound scrolling in recording menus
-rw-r--r--HISTORY2
-rw-r--r--recmenu.c87
-rw-r--r--recmenu.h6
-rw-r--r--recmenus.c4
4 files changed, 87 insertions, 12 deletions
diff --git a/HISTORY b/HISTORY
index e46f505..1c66623 100644
--- a/HISTORY
+++ b/HISTORY
@@ -23,3 +23,5 @@ Version 0.0.3
Version 0.1.0
+- added wraparound scrolling in recording menus
+
diff --git a/recmenu.c b/recmenu.c
index 3bba818..e26b502 100644
--- a/recmenu.c
+++ b/recmenu.c
@@ -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();
diff --git a/recmenu.h b/recmenu.h
index 0ec317e..bd7a3df 100644
--- a/recmenu.h
+++ b/recmenu.h
@@ -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:
diff --git a/recmenus.c b/recmenus.c
index 0216b71..e6cdff2 100644
--- a/recmenus.c
+++ b/recmenus.c
@@ -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();