Author: hbelusca Date: Mon May 15 16:22:18 2017 New Revision: 74553
URL: http://svn.reactos.org/svn/reactos?rev=74553&view=rev Log: [USETUP]: Factor out the UI-specific code from the GenList code, and wrap it inside a GENERIC_LIST_UI structure. The aim here is to decouple the UI-specific code from code that can be used by both the text-mode USETUP and a future 1st-stage GUI setup. Indeed, the GenLists can actually be used in the 1st-stage GUI; and their contents be displayed inside ListBoxes/ListViews... (this is just one example amongst others).
Additionally (in usetup.c): - Make both FormatPartitionPage and CheckFileSystemPage return PAGE_NUMBERs. - Improve a couple of comments.
Modified: branches/setup_improvements/base/setup/usetup/genlist.c branches/setup_improvements/base/setup/usetup/genlist.h branches/setup_improvements/base/setup/usetup/interface/usetup.c
Modified: branches/setup_improvements/base/setup/usetup/genlist.c URL: http://svn.reactos.org/svn/reactos/branches/setup_improvements/base/setup/us... ============================================================================== --- branches/setup_improvements/base/setup/usetup/genlist.c [iso-8859-1] (original) +++ branches/setup_improvements/base/setup/usetup/genlist.c [iso-8859-1] Mon May 15 16:22:18 2017 @@ -38,7 +38,7 @@ LIST_ENTRY Entry; PGENERIC_LIST List; PVOID UserData; - CHAR Text[1]; + CHAR Text[1]; // FIXME: UI stuff } GENERIC_LIST_ENTRY;
@@ -46,18 +46,11 @@ { LIST_ENTRY ListHead; ULONG NumOfEntries; - - PLIST_ENTRY FirstShown; - PLIST_ENTRY LastShown; - SHORT Left; - SHORT Top; - SHORT Right; - SHORT Bottom; - BOOL Redraw;
PGENERIC_LIST_ENTRY CurrentEntry; PGENERIC_LIST_ENTRY BackupEntry; } GENERIC_LIST; +
PGENERIC_LIST CreateGenericList(VOID) @@ -73,23 +66,16 @@ InitializeListHead(&List->ListHead); List->NumOfEntries = 0;
- List->Left = 0; - List->Top = 0; - List->Right = 0; - List->Bottom = 0; - List->Redraw = TRUE; - List->CurrentEntry = NULL; List->BackupEntry = NULL;
return List; }
- VOID DestroyGenericList( - PGENERIC_LIST List, - BOOLEAN FreeUserData) + IN OUT PGENERIC_LIST List, + IN BOOLEAN FreeUserData) { PGENERIC_LIST_ENTRY ListEntry; PLIST_ENTRY Entry; @@ -112,13 +98,12 @@ RtlFreeHeap (ProcessHeap, 0, List); }
- BOOLEAN AppendGenericListEntry( - PGENERIC_LIST List, - PCHAR Text, - PVOID UserData, - BOOLEAN Current) + IN OUT PGENERIC_LIST List, + IN PCHAR Text, + IN PVOID UserData, + IN BOOLEAN Current) { PGENERIC_LIST_ENTRY Entry;
@@ -145,18 +130,34 @@ }
+VOID +InitGenericListUi( + IN OUT PGENERIC_LIST_UI ListUi, + IN PGENERIC_LIST List) +{ + ListUi->List = List; + ListUi->FirstShown = NULL; + ListUi->LastShown = NULL; + + ListUi->Left = 0; + ListUi->Top = 0; + ListUi->Right = 0; + ListUi->Bottom = 0; + ListUi->Redraw = TRUE; +} + static VOID DrawListFrame( - PGENERIC_LIST GenericList) + IN PGENERIC_LIST_UI ListUi) { COORD coPos; DWORD Written; SHORT i;
/* Draw upper left corner */ - coPos.X = GenericList->Left; - coPos.Y = GenericList->Top; + coPos.X = ListUi->Left; + coPos.Y = ListUi->Top; FillConsoleOutputCharacterA (StdOutput, 0xDA, // '+', 1, @@ -164,17 +165,17 @@ &Written);
/* Draw upper edge */ - coPos.X = GenericList->Left + 1; - coPos.Y = GenericList->Top; + coPos.X = ListUi->Left + 1; + coPos.Y = ListUi->Top; FillConsoleOutputCharacterA (StdOutput, 0xC4, // '-', - GenericList->Right - GenericList->Left - 1, + ListUi->Right - ListUi->Left - 1, coPos, &Written);
/* Draw upper right corner */ - coPos.X = GenericList->Right; - coPos.Y = GenericList->Top; + coPos.X = ListUi->Right; + coPos.Y = ListUi->Top; FillConsoleOutputCharacterA (StdOutput, 0xBF, // '+', 1, @@ -182,9 +183,9 @@ &Written);
/* Draw left and right edge */ - for (i = GenericList->Top + 1; i < GenericList->Bottom; i++) - { - coPos.X = GenericList->Left; + for (i = ListUi->Top + 1; i < ListUi->Bottom; i++) + { + coPos.X = ListUi->Left; coPos.Y = i; FillConsoleOutputCharacterA (StdOutput, 0xB3, // '|', @@ -192,7 +193,7 @@ coPos, &Written);
- coPos.X = GenericList->Right; + coPos.X = ListUi->Right; FillConsoleOutputCharacterA (StdOutput, 0xB3, //'|', 1, @@ -201,8 +202,8 @@ }
/* Draw lower left corner */ - coPos.X = GenericList->Left; - coPos.Y = GenericList->Bottom; + coPos.X = ListUi->Left; + coPos.Y = ListUi->Bottom; FillConsoleOutputCharacterA (StdOutput, 0xC0, // '+', 1, @@ -210,17 +211,17 @@ &Written);
/* Draw lower edge */ - coPos.X = GenericList->Left + 1; - coPos.Y = GenericList->Bottom; + coPos.X = ListUi->Left + 1; + coPos.Y = ListUi->Bottom; FillConsoleOutputCharacterA (StdOutput, 0xC4, // '-', - GenericList->Right - GenericList->Left - 1, + ListUi->Right - ListUi->Left - 1, coPos, &Written);
/* Draw lower right corner */ - coPos.X = GenericList->Right; - coPos.Y = GenericList->Bottom; + coPos.X = ListUi->Right; + coPos.Y = ListUi->Bottom; FillConsoleOutputCharacterA (StdOutput, 0xD9, // '+', 1, @@ -232,29 +233,30 @@ static VOID DrawListEntries( - PGENERIC_LIST GenericList) -{ + IN PGENERIC_LIST_UI ListUi) +{ + PGENERIC_LIST List = ListUi->List; PGENERIC_LIST_ENTRY ListEntry; PLIST_ENTRY Entry; COORD coPos; DWORD Written; USHORT Width;
- coPos.X = GenericList->Left + 1; - coPos.Y = GenericList->Top + 1; - Width = GenericList->Right - GenericList->Left - 1; - - Entry = GenericList->FirstShown; - while (Entry != &GenericList->ListHead) + coPos.X = ListUi->Left + 1; + coPos.Y = ListUi->Top + 1; + Width = ListUi->Right - ListUi->Left - 1; + + Entry = ListUi->FirstShown; + while (Entry != &List->ListHead) { ListEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry);
- if (coPos.Y == GenericList->Bottom) + if (coPos.Y == ListUi->Bottom) break; - GenericList->LastShown = Entry; + ListUi->LastShown = Entry;
FillConsoleOutputAttribute (StdOutput, - (GenericList->CurrentEntry == ListEntry) ? + (List->CurrentEntry == ListEntry) ? FOREGROUND_BLUE | BACKGROUND_WHITE : FOREGROUND_WHITE | BACKGROUND_BLUE, Width, @@ -279,7 +281,7 @@ Entry = Entry->Flink; }
- while (coPos.Y < GenericList->Bottom) + while (coPos.Y < ListUi->Bottom) { FillConsoleOutputAttribute (StdOutput, FOREGROUND_WHITE | BACKGROUND_BLUE, @@ -300,15 +302,16 @@ static VOID DrawScrollBarGenericList( - PGENERIC_LIST GenericList) -{ + IN PGENERIC_LIST_UI ListUi) +{ + PGENERIC_LIST List = ListUi->List; COORD coPos; DWORD Written;
- coPos.X = GenericList->Right + 1; - coPos.Y = GenericList->Top; - - if (GenericList->FirstShown != GenericList->ListHead.Flink) + coPos.X = ListUi->Right + 1; + coPos.Y = ListUi->Top; + + if (ListUi->FirstShown != List->ListHead.Flink) { FillConsoleOutputCharacterA (StdOutput, '\x18', @@ -325,8 +328,8 @@ &Written); }
- coPos.Y = GenericList->Bottom; - if (GenericList->LastShown != GenericList->ListHead.Blink) + coPos.Y = ListUi->Bottom; + if (ListUi->LastShown != List->ListHead.Blink) { FillConsoleOutputCharacterA (StdOutput, '\x19', @@ -348,18 +351,22 @@ static VOID CenterCurrentListItem( - PGENERIC_LIST List) -{ + IN PGENERIC_LIST_UI ListUi) +{ + PGENERIC_LIST List = ListUi->List; PLIST_ENTRY Entry; ULONG MaxVisibleItems, ItemCount, i;
- if ((List->Top == 0 && List->Bottom == 0) || + if ((ListUi->Top == 0 && ListUi->Bottom == 0) || IsListEmpty(&List->ListHead) || List->CurrentEntry == NULL) + { return; - - MaxVisibleItems = (ULONG)(List->Bottom - List->Top - 1); - + } + + MaxVisibleItems = (ULONG)(ListUi->Bottom - ListUi->Top - 1); + +/***************************************** ItemCount = 0; Entry = List->ListHead.Flink; while (Entry != &List->ListHead) @@ -367,6 +374,8 @@ ItemCount++; Entry = Entry->Flink; } +*****************************************/ + ItemCount = List->NumOfEntries; // GetNumberOfListEntries(List);
if (ItemCount > MaxVisibleItems) { @@ -377,7 +386,7 @@ Entry = Entry->Blink; }
- List->FirstShown = Entry; + ListUi->FirstShown = Entry;
for (i = 0; i < MaxVisibleItems; i++) { @@ -385,87 +394,90 @@ Entry = Entry->Flink; }
- List->LastShown = Entry; + ListUi->LastShown = Entry; } }
VOID DrawGenericList( - PGENERIC_LIST List, - SHORT Left, - SHORT Top, - SHORT Right, - SHORT Bottom) -{ - List->FirstShown = List->ListHead.Flink; - List->Left = Left; - List->Top = Top; - List->Right = Right; - List->Bottom = Bottom; - - DrawListFrame(List); + IN PGENERIC_LIST_UI ListUi, + IN SHORT Left, + IN SHORT Top, + IN SHORT Right, + IN SHORT Bottom) +{ + PGENERIC_LIST List = ListUi->List; + + ListUi->FirstShown = List->ListHead.Flink; + ListUi->Left = Left; + ListUi->Top = Top; + ListUi->Right = Right; + ListUi->Bottom = Bottom; + + DrawListFrame(ListUi);
if (IsListEmpty(&List->ListHead)) return;
- CenterCurrentListItem(List); - - DrawListEntries(List); - DrawScrollBarGenericList(List); + CenterCurrentListItem(ListUi); + + DrawListEntries(ListUi); + DrawScrollBarGenericList(ListUi); }
VOID ScrollPageDownGenericList( - PGENERIC_LIST List) + IN PGENERIC_LIST_UI ListUi) { SHORT i;
/* Suspend auto-redraw */ - List->Redraw = FALSE; - - for (i = List->Top + 1; i < List->Bottom - 1; i++) - { - ScrollDownGenericList (List); + ListUi->Redraw = FALSE; + + for (i = ListUi->Top + 1; i < ListUi->Bottom - 1; i++) + { + ScrollDownGenericList(ListUi); }
/* Update user interface */ - DrawListEntries(List); - DrawScrollBarGenericList(List); + DrawListEntries(ListUi); + DrawScrollBarGenericList(ListUi);
/* Re enable auto-redraw */ - List->Redraw = TRUE; + ListUi->Redraw = TRUE; }
VOID ScrollPageUpGenericList( - PGENERIC_LIST List) + IN PGENERIC_LIST_UI ListUi) { SHORT i;
/* Suspend auto-redraw */ - List->Redraw = FALSE; - - for (i = List->Bottom - 1; i > List->Top + 1; i--) - { - ScrollUpGenericList (List); + ListUi->Redraw = FALSE; + + for (i = ListUi->Bottom - 1; i > ListUi->Top + 1; i--) + { + ScrollUpGenericList(ListUi); }
/* Update user interface */ - DrawListEntries(List); - DrawScrollBarGenericList(List); + DrawListEntries(ListUi); + DrawScrollBarGenericList(ListUi);
/* Re enable auto-redraw */ - List->Redraw = TRUE; + ListUi->Redraw = TRUE; }
VOID ScrollDownGenericList( - PGENERIC_LIST List) -{ + IN PGENERIC_LIST_UI ListUi) +{ + PGENERIC_LIST List = ListUi->List; PLIST_ENTRY Entry;
if (List->CurrentEntry == NULL) @@ -474,17 +486,17 @@ if (List->CurrentEntry->Entry.Flink != &List->ListHead) { Entry = List->CurrentEntry->Entry.Flink; - if (List->LastShown == &List->CurrentEntry->Entry) - { - List->FirstShown = List->FirstShown->Flink; - List->LastShown = List->LastShown->Flink; - } - List->CurrentEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry); - - if (List->Redraw) - { - DrawListEntries(List); - DrawScrollBarGenericList(List); + if (ListUi->LastShown == &List->CurrentEntry->Entry) + { + ListUi->FirstShown = ListUi->FirstShown->Flink; + ListUi->LastShown = ListUi->LastShown->Flink; + } + List->CurrentEntry = CONTAINING_RECORD(Entry, GENERIC_LIST_ENTRY, Entry); + + if (ListUi->Redraw) + { + DrawListEntries(ListUi); + DrawScrollBarGenericList(ListUi); } } } @@ -492,9 +504,10 @@
VOID ScrollToPositionGenericList( - PGENERIC_LIST List, - ULONG uIndex) -{ + IN PGENERIC_LIST_UI ListUi, + IN ULONG uIndex) +{ + PGENERIC_LIST List = ListUi->List; PLIST_ENTRY Entry; ULONG uCount = 0;
@@ -506,29 +519,30 @@ if (List->CurrentEntry->Entry.Flink != &List->ListHead) { Entry = List->CurrentEntry->Entry.Flink; - if (List->LastShown == &List->CurrentEntry->Entry) + if (ListUi->LastShown == &List->CurrentEntry->Entry) { - List->FirstShown = List->FirstShown->Flink; - List->LastShown = List->LastShown->Flink; + ListUi->FirstShown = ListUi->FirstShown->Flink; + ListUi->LastShown = ListUi->LastShown->Flink; } - List->CurrentEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry); + List->CurrentEntry = CONTAINING_RECORD(Entry, GENERIC_LIST_ENTRY, Entry); } uCount++; } while (uIndex != uCount);
- if (List->Redraw) - { - DrawListEntries(List); - DrawScrollBarGenericList(List); + if (ListUi->Redraw) + { + DrawListEntries(ListUi); + DrawScrollBarGenericList(ListUi); } }
VOID ScrollUpGenericList( - PGENERIC_LIST List) -{ + IN PGENERIC_LIST_UI ListUi) +{ + PGENERIC_LIST List = ListUi->List; PLIST_ENTRY Entry;
if (List->CurrentEntry == NULL) @@ -537,17 +551,17 @@ if (List->CurrentEntry->Entry.Blink != &List->ListHead) { Entry = List->CurrentEntry->Entry.Blink; - if (List->FirstShown == &List->CurrentEntry->Entry) - { - List->FirstShown = List->FirstShown->Blink; - List->LastShown = List->LastShown->Blink; - } - List->CurrentEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry); - - if (List->Redraw) - { - DrawListEntries(List); - DrawScrollBarGenericList(List); + if (ListUi->FirstShown == &List->CurrentEntry->Entry) + { + ListUi->FirstShown = ListUi->FirstShown->Blink; + ListUi->LastShown = ListUi->LastShown->Blink; + } + List->CurrentEntry = CONTAINING_RECORD(Entry, GENERIC_LIST_ENTRY, Entry); + + if (ListUi->Redraw) + { + DrawListEntries(ListUi); + DrawScrollBarGenericList(ListUi); } } } @@ -555,23 +569,24 @@
VOID RedrawGenericList( - PGENERIC_LIST List) -{ - if (List->CurrentEntry == NULL) + IN PGENERIC_LIST_UI ListUi) +{ + if (ListUi->List->CurrentEntry == NULL) return;
- if (List->Redraw) - { - DrawListEntries(List); - DrawScrollBarGenericList(List); - } -} + if (ListUi->Redraw) + { + DrawListEntries(ListUi); + DrawScrollBarGenericList(ListUi); + } +} +
VOID SetCurrentListEntry( - PGENERIC_LIST List, - PGENERIC_LIST_ENTRY Entry) + IN PGENERIC_LIST List, + IN PGENERIC_LIST_ENTRY Entry) { if (Entry->List != List) return; @@ -581,7 +596,7 @@
PGENERIC_LIST_ENTRY GetCurrentListEntry( - PGENERIC_LIST List) + IN PGENERIC_LIST List) { return List->CurrentEntry; } @@ -589,7 +604,7 @@
PGENERIC_LIST_ENTRY GetFirstListEntry( - PGENERIC_LIST List) + IN PGENERIC_LIST List) { PLIST_ENTRY Entry = List->ListHead.Flink;
@@ -601,7 +616,7 @@
PGENERIC_LIST_ENTRY GetNextListEntry( - PGENERIC_LIST_ENTRY Entry) + IN PGENERIC_LIST_ENTRY Entry) { PLIST_ENTRY Next = Entry->Entry.Flink;
@@ -613,7 +628,7 @@
PVOID GetListEntryUserData( - PGENERIC_LIST_ENTRY Entry) + IN PGENERIC_LIST_ENTRY Entry) { return Entry->UserData; } @@ -621,7 +636,7 @@
LPCSTR GetListEntryText( - PGENERIC_LIST_ENTRY Entry) + IN PGENERIC_LIST_ENTRY Entry) { return Entry->Text; } @@ -629,40 +644,42 @@
ULONG GetNumberOfListEntries( - PGENERIC_LIST List) + IN PGENERIC_LIST List) { return List->NumOfEntries; }
+ VOID GenericListKeyPress( - PGENERIC_LIST GenericList, - CHAR AsciiChar) -{ + IN PGENERIC_LIST_UI ListUi, + IN CHAR AsciiChar) +{ + PGENERIC_LIST List = ListUi->List; PGENERIC_LIST_ENTRY ListEntry; PGENERIC_LIST_ENTRY OldListEntry; BOOLEAN Flag = FALSE;
- ListEntry = GenericList->CurrentEntry; - OldListEntry = GenericList->CurrentEntry; - - GenericList->Redraw = FALSE; + ListEntry = List->CurrentEntry; + OldListEntry = List->CurrentEntry; + + ListUi->Redraw = FALSE;
if ((strlen(ListEntry->Text) > 0) && (tolower(ListEntry->Text[0]) == AsciiChar) && - (GenericList->CurrentEntry->Entry.Flink != &GenericList->ListHead)) - { - ScrollDownGenericList(GenericList); - ListEntry = GenericList->CurrentEntry; + (List->CurrentEntry->Entry.Flink != &List->ListHead)) + { + ScrollDownGenericList(ListUi); + ListEntry = List->CurrentEntry;
if ((strlen(ListEntry->Text) > 0) && (tolower(ListEntry->Text[0]) == AsciiChar)) goto End; }
- while (GenericList->CurrentEntry->Entry.Blink != &GenericList->ListHead) - ScrollUpGenericList(GenericList); - - ListEntry = GenericList->CurrentEntry; + while (List->CurrentEntry->Entry.Blink != &List->ListHead) + ScrollUpGenericList(ListUi); + + ListEntry = List->CurrentEntry;
for (;;) { @@ -672,34 +689,35 @@ break; }
- if (GenericList->CurrentEntry->Entry.Flink == &GenericList->ListHead) + if (List->CurrentEntry->Entry.Flink == &List->ListHead) break;
- ScrollDownGenericList(GenericList); - ListEntry = GenericList->CurrentEntry; + ScrollDownGenericList(ListUi); + ListEntry = List->CurrentEntry; }
if (!Flag) { - while (GenericList->CurrentEntry->Entry.Blink != &GenericList->ListHead) - { - if (GenericList->CurrentEntry != OldListEntry) - ScrollUpGenericList(GenericList); + while (List->CurrentEntry->Entry.Blink != &List->ListHead) + { + if (List->CurrentEntry != OldListEntry) + ScrollUpGenericList(ListUi); else break; } } + End: - DrawListEntries(GenericList); - DrawScrollBarGenericList(GenericList); - - GenericList->Redraw = TRUE; + DrawListEntries(ListUi); + DrawScrollBarGenericList(ListUi); + + ListUi->Redraw = TRUE; }
VOID SaveGenericListState( - PGENERIC_LIST List) + IN PGENERIC_LIST List) { List->BackupEntry = List->CurrentEntry; } @@ -707,15 +725,15 @@
VOID RestoreGenericListState( - PGENERIC_LIST List) + IN PGENERIC_LIST List) { List->CurrentEntry = List->BackupEntry; }
-BOOL +BOOLEAN GenericListHasSingleEntry( - PGENERIC_LIST List) + IN PGENERIC_LIST List) { if (!IsListEmpty(&List->ListHead) && List->ListHead.Flink == List->ListHead.Blink) return TRUE;
Modified: branches/setup_improvements/base/setup/usetup/genlist.h URL: http://svn.reactos.org/svn/reactos/branches/setup_improvements/base/setup/us... ============================================================================== --- branches/setup_improvements/base/setup/usetup/genlist.h [iso-8859-1] (original) +++ branches/setup_improvements/base/setup/usetup/genlist.h [iso-8859-1] Mon May 15 16:22:18 2017 @@ -36,93 +36,115 @@
VOID DestroyGenericList( - PGENERIC_LIST List, - BOOLEAN FreeUserData); + IN OUT PGENERIC_LIST List, + IN BOOLEAN FreeUserData);
BOOLEAN AppendGenericListEntry( - PGENERIC_LIST List, - PCHAR Text, - PVOID UserData, - BOOLEAN Current); + IN OUT PGENERIC_LIST List, + IN PCHAR Text, + IN PVOID UserData, + IN BOOLEAN Current); + +VOID +SetCurrentListEntry( + IN PGENERIC_LIST List, + IN PGENERIC_LIST_ENTRY Entry); + +PGENERIC_LIST_ENTRY +GetCurrentListEntry( + IN PGENERIC_LIST List); + +PGENERIC_LIST_ENTRY +GetFirstListEntry( + IN PGENERIC_LIST List); + +PGENERIC_LIST_ENTRY +GetNextListEntry( + IN PGENERIC_LIST_ENTRY Entry); + +PVOID +GetListEntryUserData( + IN PGENERIC_LIST_ENTRY Entry); + +LPCSTR +GetListEntryText( + IN PGENERIC_LIST_ENTRY Entry); + +ULONG +GetNumberOfListEntries( + IN PGENERIC_LIST List); + +VOID +SaveGenericListState( + IN PGENERIC_LIST List); + +VOID +RestoreGenericListState( + IN PGENERIC_LIST List); + +BOOLEAN +GenericListHasSingleEntry( + IN PGENERIC_LIST List); + + + + +typedef struct _GENERIC_LIST_UI +{ + PGENERIC_LIST List; + + PLIST_ENTRY FirstShown; + PLIST_ENTRY LastShown; + + SHORT Left; + SHORT Top; + SHORT Right; + SHORT Bottom; + BOOL Redraw; +} GENERIC_LIST_UI, *PGENERIC_LIST_UI; + +VOID +InitGenericListUi( + IN OUT PGENERIC_LIST_UI ListUi, + IN PGENERIC_LIST List);
VOID DrawGenericList( - PGENERIC_LIST List, - SHORT Left, - SHORT Top, - SHORT Right, - SHORT Bottom); + IN PGENERIC_LIST_UI ListUi, + IN SHORT Left, + IN SHORT Top, + IN SHORT Right, + IN SHORT Bottom);
VOID ScrollDownGenericList( - PGENERIC_LIST List); + IN PGENERIC_LIST_UI ListUi);
VOID ScrollUpGenericList( - PGENERIC_LIST List); + IN PGENERIC_LIST_UI ListUi);
VOID ScrollPageDownGenericList( - PGENERIC_LIST List); + IN PGENERIC_LIST_UI ListUi);
VOID ScrollPageUpGenericList( - PGENERIC_LIST List); + IN PGENERIC_LIST_UI ListUi);
VOID ScrollToPositionGenericList( - PGENERIC_LIST List, - ULONG uIndex); + IN PGENERIC_LIST_UI ListUi, + IN ULONG uIndex);
VOID RedrawGenericList( - PGENERIC_LIST List); - -VOID -SetCurrentListEntry( - PGENERIC_LIST List, - PGENERIC_LIST_ENTRY Entry); - -PGENERIC_LIST_ENTRY -GetCurrentListEntry( - PGENERIC_LIST List); - -PGENERIC_LIST_ENTRY -GetFirstListEntry( - PGENERIC_LIST List); - -PGENERIC_LIST_ENTRY -GetNextListEntry( - PGENERIC_LIST_ENTRY Entry); - -PVOID -GetListEntryUserData( - PGENERIC_LIST_ENTRY Entry); - -LPCSTR -GetListEntryText( - PGENERIC_LIST_ENTRY Entry); - -ULONG -GetNumberOfListEntries( - PGENERIC_LIST List); - -VOID -SaveGenericListState( - PGENERIC_LIST List); - -VOID -RestoreGenericListState( - PGENERIC_LIST List); + IN PGENERIC_LIST_UI ListUi);
VOID GenericListKeyPress( - PGENERIC_LIST GenericList, - CHAR AsciiChar); - -BOOL -GenericListHasSingleEntry( - PGENERIC_LIST List); + IN PGENERIC_LIST_UI ListUi, + IN CHAR AsciiChar);
/* EOF */
Modified: branches/setup_improvements/base/setup/usetup/interface/usetup.c URL: http://svn.reactos.org/svn/reactos/branches/setup_improvements/base/setup/us... ============================================================================== --- branches/setup_improvements/base/setup/usetup/interface/usetup.c [iso-8859-1] (original) +++ branches/setup_improvements/base/setup/usetup/interface/usetup.c [iso-8859-1] Mon May 15 16:22:18 2017 @@ -639,6 +639,7 @@ static PAGE_NUMBER LanguagePage(PINPUT_RECORD Ir) { + GENERIC_LIST_UI ListUi; PWCHAR NewLanguageId; BOOL RefreshPage = FALSE;
@@ -646,7 +647,6 @@ if (LanguageList == NULL) { LanguageList = CreateLanguageList(SetupInf, DefaultLanguage); - if (LanguageList == NULL) { PopupError("Setup failed to initialize available translations", NULL, NULL, POPUP_WAIT_NONE); @@ -667,13 +667,14 @@ return INTRO_PAGE; }
- DrawGenericList(LanguageList, + InitGenericListUi(&ListUi, LanguageList); + DrawGenericList(&ListUi, 2, 18, xScreen - 3, yScreen - 3);
- ScrollToPositionGenericList(LanguageList, GetDefaultLanguageIndex()); + ScrollToPositionGenericList(&ListUi, GetDefaultLanguageIndex());
MUIDisplayPage(LANGUAGE_PAGE);
@@ -684,25 +685,25 @@ if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */ { - ScrollDownGenericList(LanguageList); + ScrollDownGenericList(&ListUi); RefreshPage = TRUE; } else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */ { - ScrollUpGenericList(LanguageList); + ScrollUpGenericList(&ListUi); RefreshPage = TRUE; } if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_NEXT)) /* PAGE DOWN */ { - ScrollPageDownGenericList(LanguageList); + ScrollPageDownGenericList(&ListUi); RefreshPage = TRUE; } else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_PRIOR)) /* PAGE UP */ { - ScrollPageUpGenericList(LanguageList); + ScrollPageUpGenericList(&ListUi); RefreshPage = TRUE; } else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && @@ -711,7 +712,7 @@ if (ConfirmQuit(Ir) == TRUE) return QUIT_PAGE; else - RedrawGenericList(LanguageList); + RedrawGenericList(&ListUi); } else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ { @@ -732,7 +733,7 @@ else if ((Ir->Event.KeyEvent.uChar.AsciiChar > 0x60) && (Ir->Event.KeyEvent.uChar.AsciiChar < 0x7b)) { /* a-z */ - GenericListKeyPress(LanguageList, Ir->Event.KeyEvent.uChar.AsciiChar); + GenericListKeyPress(&ListUi, Ir->Event.KeyEvent.uChar.AsciiChar); RefreshPage = TRUE; }
@@ -914,12 +915,11 @@ LanguageList = CreateLanguageList(SetupInf, DefaultLanguage);
/* new part */ - wcscpy(SelectedLanguageId,LocaleID); + wcscpy(SelectedLanguageId, LocaleID); LanguageId = (LANGID)(wcstol(SelectedLanguageId, NULL, 16) & 0xFFFF);
/* first we hack LanguageList */ ListEntry = GetFirstListEntry(LanguageList); - while (ListEntry != NULL) { if (!wcsicmp(LocaleID, GetListEntryUserData(ListEntry))) @@ -934,7 +934,6 @@
/* now LayoutList */ ListEntry = GetFirstListEntry(LayoutList); - while (ListEntry != NULL) { if (!wcsicmp(LocaleID, GetListEntryUserData(ListEntry))) @@ -1318,7 +1317,7 @@ * Ir: The PINPUT_RECORD */ static PAGE_NUMBER -HandleGenericList(PGENERIC_LIST GenericList, +HandleGenericList(PGENERIC_LIST_UI ListUi, PAGE_NUMBER nextPage, PINPUT_RECORD Ir) { @@ -1329,45 +1328,45 @@ if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */ { - ScrollDownGenericList(GenericList); + ScrollDownGenericList(ListUi); } else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */ { - ScrollUpGenericList(GenericList); + ScrollUpGenericList(ListUi); } else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_NEXT)) /* PAGE DOWN */ { - ScrollPageDownGenericList(GenericList); + ScrollPageDownGenericList(ListUi); } else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_PRIOR)) /* PAGE UP */ { - ScrollPageUpGenericList(GenericList); + ScrollPageUpGenericList(ListUi); } else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */ { if (ConfirmQuit(Ir) == TRUE) return QUIT_PAGE; - - continue; + else + RedrawGenericList(ListUi); } else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE)) /* ESC */ { - RestoreGenericListState(GenericList); + RestoreGenericListState(ListUi->List); + return nextPage; // Use some "prevPage;" instead? + } + else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ + { return nextPage; } - else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ - { - return nextPage; - } else if ((Ir->Event.KeyEvent.uChar.AsciiChar > 0x60) && (Ir->Event.KeyEvent.uChar.AsciiChar < 0x7b)) { /* a-z */ - GenericListKeyPress(GenericList, Ir->Event.KeyEvent.uChar.AsciiChar); + GenericListKeyPress(ListUi, Ir->Event.KeyEvent.uChar.AsciiChar); } } } @@ -1386,9 +1385,11 @@ static PAGE_NUMBER ComputerSettingsPage(PINPUT_RECORD Ir) { + GENERIC_LIST_UI ListUi; MUIDisplayPage(COMPUTER_SETTINGS_PAGE);
- DrawGenericList(ComputerList, + InitGenericListUi(&ListUi, ComputerList); + DrawGenericList(&ListUi, 2, 18, xScreen - 3, @@ -1396,7 +1397,7 @@
SaveGenericListState(ComputerList);
- return HandleGenericList(ComputerList, DEVICE_SETTINGS_PAGE, Ir); + return HandleGenericList(&ListUi, DEVICE_SETTINGS_PAGE, Ir); }
@@ -1413,9 +1414,11 @@ static PAGE_NUMBER DisplaySettingsPage(PINPUT_RECORD Ir) { + GENERIC_LIST_UI ListUi; MUIDisplayPage(DISPLAY_SETTINGS_PAGE);
- DrawGenericList(DisplayList, + InitGenericListUi(&ListUi, DisplayList); + DrawGenericList(&ListUi, 2, 18, xScreen - 3, @@ -1423,7 +1426,7 @@
SaveGenericListState(DisplayList);
- return HandleGenericList(DisplayList, DEVICE_SETTINGS_PAGE, Ir); + return HandleGenericList(&ListUi, DEVICE_SETTINGS_PAGE, Ir); }
@@ -1440,9 +1443,11 @@ static PAGE_NUMBER KeyboardSettingsPage(PINPUT_RECORD Ir) { + GENERIC_LIST_UI ListUi; MUIDisplayPage(KEYBOARD_SETTINGS_PAGE);
- DrawGenericList(KeyboardList, + InitGenericListUi(&ListUi, KeyboardList); + DrawGenericList(&ListUi, 2, 18, xScreen - 3, @@ -1450,7 +1455,7 @@
SaveGenericListState(KeyboardList);
- return HandleGenericList(KeyboardList, DEVICE_SETTINGS_PAGE, Ir); + return HandleGenericList(&ListUi, DEVICE_SETTINGS_PAGE, Ir); }
@@ -1467,9 +1472,11 @@ static PAGE_NUMBER LayoutSettingsPage(PINPUT_RECORD Ir) { + GENERIC_LIST_UI ListUi; MUIDisplayPage(LAYOUT_SETTINGS_PAGE);
- DrawGenericList(LayoutList, + InitGenericListUi(&ListUi, LayoutList); + DrawGenericList(&ListUi, 2, 18, xScreen - 3, @@ -1477,7 +1484,7 @@
SaveGenericListState(LayoutList);
- return HandleGenericList(LayoutList, DEVICE_SETTINGS_PAGE, Ir); + return HandleGenericList(&ListUi, DEVICE_SETTINGS_PAGE, Ir); }
@@ -2878,7 +2885,7 @@ * RETURNS * Number of the next page. */ -static ULONG +static PAGE_NUMBER FormatPartitionPage(PINPUT_RECORD Ir) { UNICODE_STRING PartitionRootPath; @@ -3068,7 +3075,7 @@ * RETURNS * Number of the next page. */ -static ULONG +static PAGE_NUMBER CheckFileSystemPage(PINPUT_RECORD Ir) { PFILE_SYSTEM_ITEM CurrentFileSystem; @@ -3875,8 +3882,7 @@ * RETURNS * Number of the next page. */ -static -PAGE_NUMBER +static PAGE_NUMBER FileCopyPage(PINPUT_RECORD Ir) { COPYCONTEXT CopyContext; @@ -4073,7 +4079,6 @@ }
/* Set GeoID */ - if (!SetGeoID(MUIGetGeoID())) { MUIDisplayError(ERROR_UPDATE_GEOID, Ir, POPUP_WAIT_ENTER); @@ -4307,7 +4312,7 @@
MUIDisplayPage(BOOT_LOADER_FLOPPY_PAGE);
-// SetStatusText(" Please wait..."); +// CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT));
while (TRUE) { @@ -4471,48 +4476,49 @@ { MUIDisplayPage(QUIT_PAGE);
- /* Destroy partition list */ + /* Destroy the partition list */ if (PartitionList != NULL) { DestroyPartitionList(PartitionList); PartitionList = NULL; }
- /* Destroy filesystem list */ + /* Destroy the filesystem list */ if (FileSystemList != NULL) { DestroyFileSystemList(FileSystemList); FileSystemList = NULL; }
- /* Destroy computer settings list */ + /* Destroy the computer settings list */ if (ComputerList != NULL) { DestroyGenericList(ComputerList, TRUE); ComputerList = NULL; }
- /* Destroy display settings list */ + /* Destroy the display settings list */ if (DisplayList != NULL) { DestroyGenericList(DisplayList, TRUE); DisplayList = NULL; }
- /* Destroy keyboard settings list */ + /* Destroy the keyboard settings list */ if (KeyboardList != NULL) { DestroyGenericList(KeyboardList, TRUE); KeyboardList = NULL; }
- /* Destroy keyboard layout list */ + /* Destroy the keyboard layout list */ if (LayoutList != NULL) { DestroyGenericList(LayoutList, TRUE); LayoutList = NULL; }
+ /* Destroy the languages list */ if (LanguageList != NULL) { DestroyGenericList(LanguageList, FALSE); @@ -4602,6 +4608,7 @@
NtQuerySystemTime(&Time);
+ /* Create the PnP thread in suspended state */ Status = RtlCreateUserThread(NtCurrentProcess(), NULL, TRUE, @@ -4679,9 +4686,7 @@ case SCSI_CONTROLLER_PAGE: Page = ScsiControllerPage(&Ir); break; -#endif - -#if 0 + case OEM_DRIVER_PAGE: Page = OemDriverPage(&Ir); break; @@ -4736,11 +4741,11 @@ break;
case FORMAT_PARTITION_PAGE: - Page = (PAGE_NUMBER) FormatPartitionPage(&Ir); + Page = FormatPartitionPage(&Ir); break;
case CHECK_FILE_SYSTEM_PAGE: - Page = (PAGE_NUMBER) CheckFileSystemPage(&Ir); + Page = CheckFileSystemPage(&Ir); break;
case INSTALL_DIRECTORY_PAGE: