1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Improved performance when paging through very long menu lists

This commit is contained in:
Klaus Schmidinger 2004-03-14 10:34:56 +01:00
parent 99f54a7780
commit 5f39e62ea1
3 changed files with 23 additions and 34 deletions

View File

@ -2714,7 +2714,7 @@ Video Disk Recorder Revision History
whether an event is currently running (see MANUAL under "The "Schedule" Menu"
for details).
2004-03-13: Version 1.3.6
2004-03-14: Version 1.3.6
- Completed the Finnish OSD texts (thanks to Rolf Ahrenberg).
- Fixed some descriptor handling in 'libsi' (thanks to Stéphane Esté-Gracias).
@ -2738,3 +2738,4 @@ Video Disk Recorder Revision History
This was also necessary to better display itemized texts.
- Fixed detecting the running status in case an empty EPG event is broadcast (thanks
to Michael Pennewiß for pointing this out).
- Improved performance when paging through very long menu lists.

16
menu.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: menu.c 1.295 2004/03/07 09:40:34 kls Exp $
* $Id: menu.c 1.296 2004/03/14 10:31:13 kls Exp $
*/
#include "menu.h"
@ -1008,13 +1008,8 @@ public:
cMenuTimers::cMenuTimers(void)
:cOsdMenu(tr("Timers"), 2, CHNUMWIDTH, 10, 6, 6)
{
int i = 0;
cTimer *timer;
while ((timer = Timers.Get(i)) != NULL) {
for (cTimer *timer = Timers.First(); timer; timer = Timers.Next(timer))
Add(new cMenuTimerItem(timer));
i++;
}
if (Setup.SortTimers)
Sort();
SetHelp(tr("Edit"), tr("New"), tr("Delete"), Setup.SortTimers ? tr("On/Off") : tr("Mark"));
@ -1493,13 +1488,8 @@ cMenuCommands::cMenuCommands(const char *Title, cCommands *Commands, const char
SetHasHotkeys();
commands = Commands;
parameters = Parameters ? strdup(Parameters) : NULL;
int i = 0;
cCommand *command;
while ((command = commands->Get(i)) != NULL) {
for (cCommand *command = commands->First(); command; command = commands->Next(command))
Add(new cOsdItem(hk(command->Title())));
i++;
}
}
cMenuCommands::~cMenuCommands()

28
osd.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: osd.c 1.44 2004/03/05 15:27:48 kls Exp $
* $Id: osd.c 1.45 2004/03/14 10:33:20 kls Exp $
*/
#include "osd.h"
@ -429,14 +429,11 @@ void cOsdMenu::Display(void)
Interface->Help(helpRed, helpGreen, helpYellow, helpBlue);
int count = Count();
if (count > 0) {
for (int i = 0; i < count; i++) {
cOsdItem *item = Get(i);
if (item)
cStatus::MsgOsdItem(item->Text(), i);
}
int ni = 0;
for (cOsdItem *item = First(); item; item = Next(item))
cStatus::MsgOsdItem(item->Text(), ni++);
if (current < 0)
current = 0; // just for safety - there HAS to be a current item!
int n = 0;
if (current - first >= MAXOSDITEMS || current < first) {
first = current - MAXOSDITEMS / 2;
if (first + MAXOSDITEMS > count)
@ -444,15 +441,15 @@ void cOsdMenu::Display(void)
if (first < 0)
first = 0;
}
for (int i = first; i < count; i++) {
cOsdItem *item = Get(i);
if (item) {
int i = first;
int n = 0;
for (cOsdItem *item = Get(first); item; item = Next(item)) {
item->Display(i - first, i == current ? clrBlack : clrWhite, i == current ? clrCyan : clrBackground);
if (i == current)
cStatus::MsgOsdCurrentItem(item->Text());
}
if (++n == MAXOSDITEMS) //TODO get this from Interface!!!
break;
i++;
}
}
if (!isempty(status))
@ -562,12 +559,13 @@ void cOsdMenu::PageDown(void)
{
current += MAXOSDITEMS;
first += MAXOSDITEMS;
if (current > Count() - 1) {
current = Count() - 1;
first = max(0, Count() - MAXOSDITEMS);
int count = Count();
if (current > count - 1) {
current = count - 1;
first = max(0, count - MAXOSDITEMS);
}
if (SpecialItem(current)) {
current += (current < Count() - 1) ? 1 : -1;
current += (current < count - 1) ? 1 : -1;
first = max(first, current - MAXOSDITEMS);
}
Display();