Author: ekohl
Date: Mon Dec 7 16:10:09 2015
New Revision: 70287
URL:
http://svn.reactos.org/svn/reactos?rev=70287&view=rev
Log:
[USETUP]
Center the current list item before drawing the list.
#CORE-10659 #resolve
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.…
==============================================================================
--- trunk/reactos/base/setup/usetup/genlist.c [iso-8859-1] (original)
+++ trunk/reactos/base/setup/usetup/genlist.c [iso-8859-1] Mon Dec 7 16:10:09 2015
@@ -341,6 +341,51 @@
}
+static
+VOID
+CenterCurrentListItem(
+ PGENERIC_LIST List)
+{
+ PLIST_ENTRY Entry;
+ ULONG MaxVisibleItems, ItemCount, i;
+
+ if ((List->Top == 0 && List->Bottom == 0) ||
+ IsListEmpty(&List->ListHead) ||
+ List->CurrentEntry == NULL)
+ return;
+
+ MaxVisibleItems = (ULONG)(List->Bottom - List->Top - 1);
+
+ ItemCount = 0;
+ Entry = List->ListHead.Flink;
+ while (Entry != &List->ListHead)
+ {
+ ItemCount++;
+ Entry = Entry->Flink;
+ }
+
+ if (ItemCount > MaxVisibleItems)
+ {
+ Entry = &List->CurrentEntry->Entry;
+ for (i = 0; i < MaxVisibleItems / 2; i++)
+ {
+ if (Entry->Blink != &List->ListHead)
+ Entry = Entry->Blink;
+ }
+
+ List->FirstShown = Entry;
+
+ for (i = 0; i < MaxVisibleItems; i++)
+ {
+ if (Entry->Flink != &List->ListHead)
+ Entry = Entry->Flink;
+ }
+
+ List->LastShown = Entry;
+ }
+}
+
+
VOID
DrawGenericList(
PGENERIC_LIST List,
@@ -359,6 +404,8 @@
if (IsListEmpty(&List->ListHead))
return;
+
+ CenterCurrentListItem(List);
DrawListEntries(List);
DrawScrollBarGenericList(List);