Author: dchapyshev Date: Tue Jun 17 15:10:07 2008 New Revision: 34002
URL: http://svn.reactos.org/svn/reactos?rev=34002&view=rev Log: - Add correct scrolling by keypress
Modified: trunk/reactos/base/setup/usetup/genlist.c
Modified: trunk/reactos/base/setup/usetup/genlist.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/genlist.c... ============================================================================== --- trunk/reactos/base/setup/usetup/genlist.c [iso-8859-1] (original) +++ trunk/reactos/base/setup/usetup/genlist.c [iso-8859-1] Tue Jun 17 15:10:07 2008 @@ -538,42 +538,59 @@ GenericListKeyPress (PGENERIC_LIST GenericList, CHAR AsciChar) { PGENERIC_LIST_ENTRY ListEntry; - PLIST_ENTRY Entry; - - Entry = &GenericList->CurrentEntry->Entry; - ListEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry); - -Reset: - - if (tolower(ListEntry->Text[0]) != AsciChar) - Entry = GenericList->ListHead.Flink; - - while (Entry != &GenericList->ListHead) - { - ListEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry); - + PGENERIC_LIST_ENTRY OldListEntry; + BOOLEAN Flag = FALSE; + + ListEntry = GenericList->CurrentEntry; + OldListEntry = GenericList->CurrentEntry; + + GenericList->Redraw = FALSE; + + if ((strlen(ListEntry->Text) > 0) && (tolower(ListEntry->Text[0]) == AsciChar) && + (GenericList->CurrentEntry->Entry.Flink != &GenericList->ListHead)) + { + ScrollDownGenericList(GenericList); + ListEntry = GenericList->CurrentEntry; + + if ((strlen(ListEntry->Text) > 0) && (tolower(ListEntry->Text[0]) == AsciChar)) + goto End; + } + + while (GenericList->CurrentEntry->Entry.Blink != &GenericList->ListHead) + ScrollUpGenericList(GenericList); + + ListEntry = GenericList->CurrentEntry; + + for (;;) + { if ((strlen(ListEntry->Text) > 0) && (tolower(ListEntry->Text[0]) == AsciChar)) { - if (CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry) == GenericList->CurrentEntry) - { - Entry = Entry->Flink; - if (Entry == &GenericList->ListHead) - goto Reset; - - ListEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry); - if ((strlen(ListEntry->Text) < 1) || (tolower(ListEntry->Text[0]) != AsciChar)) - goto Reset; - } - - GenericList->CurrentEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry); + Flag = TRUE; break; }
- Entry = Entry->Flink; - } - - if (Entry) - DrawListEntries(GenericList); + if (GenericList->CurrentEntry->Entry.Flink == &GenericList->ListHead) + break; + + ScrollDownGenericList(GenericList); + ListEntry = GenericList->CurrentEntry; + } + + if (!Flag) + { + while (GenericList->CurrentEntry->Entry.Blink != &GenericList->ListHead) + { + if (GenericList->CurrentEntry != OldListEntry) + ScrollUpGenericList(GenericList); + else + break; + } + } +End: + DrawListEntries(GenericList); + DrawScrollBarGenericList(GenericList); + + GenericList->Redraw = TRUE; }