summaryrefslogtreecommitdiff
path: root/osdbase.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2005-06-18 10:44:30 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2005-06-18 10:44:30 +0200
commit806aeb3c07dafdc92a2028d3600d2a0f2a298ef0 (patch)
treee70eef49cfb9da3cd74727da3e43e29da78ae3ff /osdbase.c
parentf1ccf3712859336561b9f7aeb7162dc97a5088cd (diff)
downloadvdr-806aeb3c07dafdc92a2028d3600d2a0f2a298ef0.tar.gz
vdr-806aeb3c07dafdc92a2028d3600d2a0f2a298ef0.tar.bz2
Implemented wrapping around in menu lists
Diffstat (limited to 'osdbase.c')
-rw-r--r--osdbase.c86
1 files changed, 54 insertions, 32 deletions
diff --git a/osdbase.c b/osdbase.c
index 711bd4cd..98307cd3 100644
--- a/osdbase.c
+++ b/osdbase.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: osdbase.c 1.19 2005/06/17 15:35:27 kls Exp $
+ * $Id: osdbase.c 1.20 2005/06/18 10:30:51 kls Exp $
*/
#include "osdbase.h"
@@ -261,46 +261,64 @@ bool cOsdMenu::SelectableItem(int idx)
void cOsdMenu::CursorUp(void)
{
- if (current > 0) {
- int tmpCurrent = current;
- while (--tmpCurrent >= 0 && !SelectableItem(tmpCurrent))
- ;
- if (tmpCurrent < 0)
- return;
- if (tmpCurrent >= first)
- DisplayCurrent(false);
- current = tmpCurrent;
- if (current < first) {
- first = Setup.MenuScrollPage ? max(0, current - displayMenuItems + 1) : current;
- Display();
+ int tmpCurrent = current;
+ int lastOnScreen = first + displayMenuItems - 1;
+ int last = Count() - 1;
+ while (--tmpCurrent != current) {
+ if (tmpCurrent < 0) {
+ if (Setup.MenuScrollWrap)
+ tmpCurrent = last;
+ else
+ return;
+ }
+ if (SelectableItem(tmpCurrent))
+ break;
}
- else
- DisplayCurrent(true);
+ if (first <= tmpCurrent && tmpCurrent <= lastOnScreen)
+ DisplayCurrent(false);
+ current = tmpCurrent;
+ if (current < first) {
+ first = Setup.MenuScrollPage ? max(0, current - displayMenuItems + 1) : current;
+ Display();
+ }
+ else if (current > lastOnScreen) {
+ first = max(0, current - displayMenuItems + 1);
+ Display();
}
+ else
+ DisplayCurrent(true);
}
void cOsdMenu::CursorDown(void)
{
+ int tmpCurrent = current;
+ int lastOnScreen = first + displayMenuItems - 1;
int last = Count() - 1;
- if (current < last) {
- int lastOnScreen = first + displayMenuItems - 1;
- int tmpCurrent = current;
- while (++tmpCurrent <= last && !SelectableItem(tmpCurrent))
- ;
- if (tmpCurrent > last)
- return;
- if (tmpCurrent <= lastOnScreen)
- DisplayCurrent(false);
- current = tmpCurrent;
- if (current > lastOnScreen) {
- first = Setup.MenuScrollPage ? current : max(0, current - displayMenuItems + 1);
- if (first + displayMenuItems > last)
- first = max(0, last - displayMenuItems + 1);
- Display();
+ while (++tmpCurrent != current) {
+ if (tmpCurrent > last) {
+ if (Setup.MenuScrollWrap)
+ tmpCurrent = 0;
+ else
+ return;
+ }
+ if (SelectableItem(tmpCurrent))
+ break;
}
- else
- DisplayCurrent(true);
+ if (first <= tmpCurrent && tmpCurrent <= lastOnScreen)
+ DisplayCurrent(false);
+ current = tmpCurrent;
+ if (current > lastOnScreen) {
+ first = Setup.MenuScrollPage ? current : max(0, current - displayMenuItems + 1);
+ if (first + displayMenuItems > last)
+ first = max(0, last - displayMenuItems + 1);
+ Display();
+ }
+ else if (current < first) {
+ first = current;
+ Display();
}
+ else
+ DisplayCurrent(true);
}
void cOsdMenu::PageUp(void)
@@ -333,6 +351,8 @@ void cOsdMenu::PageUp(void)
Display();
DisplayCurrent(true);
}
+ else if (Setup.MenuScrollWrap)
+ CursorUp();
}
void cOsdMenu::PageDown(void)
@@ -365,6 +385,8 @@ void cOsdMenu::PageDown(void)
Display();
DisplayCurrent(true);
}
+ else if (Setup.MenuScrollWrap)
+ CursorDown();
}
void cOsdMenu::Mark(void)