[ros-diffs] [dchapyshev] 34002: - Add correct scrolling by keypress

dchapyshev at svn.reactos.org dchapyshev at svn.reactos.org
Tue Jun 17 22:10:07 CEST 2008


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?rev=34002&r1=34001&r2=34002&view=diff
==============================================================================
--- 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;
 }
 
 



More information about the Ros-diffs mailing list