- Implement generic list PageUp/PageDown
authorMarc Piulachs <marc.piulachs@live.com>
Wed, 14 May 2008 14:01:06 +0000 (14:01 +0000)
committerMarc Piulachs <marc.piulachs@live.com>
Wed, 14 May 2008 14:01:06 +0000 (14:01 +0000)
svn path=/trunk/; revision=33512

reactos/base/setup/usetup/genlist.c
reactos/base/setup/usetup/genlist.h
reactos/base/setup/usetup/interface/usetup.c

index 6227181..330e93e 100644 (file)
@@ -52,6 +52,7 @@ typedef struct _GENERIC_LIST
     SHORT Top;
     SHORT Right;
     SHORT Bottom;
+    BOOL Redraw;
 
     PGENERIC_LIST_ENTRY CurrentEntry;
     PGENERIC_LIST_ENTRY BackupEntry;
@@ -74,6 +75,7 @@ CreateGenericList(VOID)
     List->Top = 0;
     List->Right = 0;
     List->Bottom = 0;
+    List->Redraw = TRUE;
 
     List->CurrentEntry = NULL;
 
@@ -351,6 +353,47 @@ DrawGenericList(PGENERIC_LIST List,
     DrawScrollBarGenericList(List);
 }
 
+VOID
+ScrollPageDownGenericList (PGENERIC_LIST List)
+{
+    SHORT i;
+
+    /* Suspend auto-redraw */
+    List->Redraw = FALSE;
+
+    for (i = List->Top + 1; i < List->Bottom - 1; i++)
+    {
+        ScrollDownGenericList (List);
+    }
+
+    /* Update user interface */
+    DrawListEntries(List);
+    DrawScrollBarGenericList(List);
+
+    /* Re enable auto-redraw */
+    List->Redraw = TRUE;
+}
+
+VOID
+ScrollPageUpGenericList (PGENERIC_LIST List)
+{
+    SHORT i;
+
+    /* Suspend auto-redraw */
+    List->Redraw = FALSE;
+
+    for (i = List->Bottom - 1; i > List->Top + 1; i--)
+    {
+         ScrollUpGenericList (List);
+    }
+
+    /* Update user interface */
+    DrawListEntries(List);
+    DrawScrollBarGenericList(List);
+
+    /* Re enable auto-redraw */
+    List->Redraw = TRUE;
+}
 
 VOID
 ScrollDownGenericList (PGENERIC_LIST List)
@@ -370,8 +413,11 @@ ScrollDownGenericList (PGENERIC_LIST List)
         }
         List->CurrentEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry);
 
-        DrawListEntries(List);
-        DrawScrollBarGenericList(List);
+        if (List->Redraw)
+        {
+            DrawListEntries(List);
+            DrawScrollBarGenericList(List);
+        }
     }
 }
 
@@ -394,8 +440,11 @@ ScrollUpGenericList (PGENERIC_LIST List)
         }
         List->CurrentEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry);
 
-        DrawListEntries(List);
-        DrawScrollBarGenericList(List);
+        if (List->Redraw)
+        {
+            DrawListEntries(List);
+            DrawScrollBarGenericList(List);
+        }
     }
 }
 
index cd06af3..90058fd 100644 (file)
@@ -61,6 +61,12 @@ ScrollDownGenericList(PGENERIC_LIST List);
 VOID
 ScrollUpGenericList(PGENERIC_LIST List);
 
+VOID
+ScrollPageDownGenericList(PGENERIC_LIST List);
+
+VOID
+ScrollPageUpGenericList(PGENERIC_LIST List);
+
 VOID
 SetCurrentListEntry(PGENERIC_LIST List, PGENERIC_LIST_ENTRY Entry);
 
index f3c6031..9fbd0af 100644 (file)
@@ -621,21 +621,37 @@ LanguagePage(PINPUT_RECORD Ir)
         if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
             (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN))  /* DOWN */
         {
-#if 0 //Dynamically update user interface
-            SelectedLanguageId = (PWCHAR)LanguageList->CurrentEntry->UserData;
+#if 0
+            SelectedLanguageId = (PWCHAR)GetListEntryUserData(GetCurrentListEntry(LanguageList));
+
+            /* Redraw language selection page in native language */
             MUIDisplayPage(LANGUAGE_PAGE);
 #endif
+
             ScrollDownGenericList (LanguageList);
         }
         else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
                  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP))  /* UP */
         {
 #if 0
-            SelectedLanguageId = (PWCHAR)LanguageList->CurrentEntry->UserData;
+            SelectedLanguageId = (PWCHAR)GetListEntryUserData(GetCurrentListEntry(LanguageList));
+
+            /* Redraw language selection page in native language */
             MUIDisplayPage(LANGUAGE_PAGE);
 #endif
+
             ScrollUpGenericList (LanguageList);
         }
+        if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
+            (Ir->Event.KeyEvent.wVirtualKeyCode == VK_NEXT))  /* PAGE DOWN */
+        {
+            ScrollPageDownGenericList (LanguageList);
+        }
+        else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
+                 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_PRIOR))  /* PAGE UP */
+        {
+            ScrollPageUpGenericList (LanguageList);
+        }
         else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
                  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3))  /* F3 */
         {
@@ -1269,6 +1285,16 @@ LayoutSettingsPage(PINPUT_RECORD Ir)
         {
             ScrollUpGenericList (LayoutList);
         }
+        if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
+            (Ir->Event.KeyEvent.wVirtualKeyCode == VK_NEXT))  /* PAGE DOWN */
+        {
+            ScrollPageDownGenericList (LayoutList);
+        }
+        else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
+                 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_PRIOR))  /* PAGE UP */
+        {
+            ScrollPageUpGenericList (LayoutList);
+        }
         else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
                  (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3))  /* F3 */
         {
@@ -1287,6 +1313,11 @@ LayoutSettingsPage(PINPUT_RECORD Ir)
         {
             return DEVICE_SETTINGS_PAGE;
         }
+        else if ((Ir->Event.KeyEvent.uChar.AsciiChar > 0x60) && (Ir->Event.KeyEvent.uChar.AsciiChar < 0x7b))
+        {
+            /* a-z */
+            GenericListKeyPress (LayoutList , Ir->Event.KeyEvent.uChar.AsciiChar);
+        }
     }
 
     return DISPLAY_SETTINGS_PAGE;