diff options
Diffstat (limited to 'osdbase.c')
-rw-r--r-- | osdbase.c | 86 |
1 files changed, 54 insertions, 32 deletions
@@ -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) |