2004-05-30 14:54:02 +00:00
|
|
|
/*
|
|
|
|
* ReactOS kernel
|
|
|
|
* Copyright (C) 2004 ReactOS Team
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
2009-10-27 10:34:16 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2004-05-30 14:54:02 +00:00
|
|
|
*/
|
2006-11-10 21:00:24 +00:00
|
|
|
/* COPYRIGHT: See COPYING in the top level directory
|
2004-05-30 14:54:02 +00:00
|
|
|
* PROJECT: ReactOS text-mode setup
|
2015-09-13 16:40:36 +00:00
|
|
|
* FILE: base/setup/usetup/genlist.c
|
2004-05-30 14:54:02 +00:00
|
|
|
* PURPOSE: Generic list functions
|
2018-05-27 19:33:07 +00:00
|
|
|
* PROGRAMMER: Christoph von Wittich <christoph at reactos.org>
|
2004-05-30 14:54:02 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* INCLUDES *****************************************************************/
|
2004-05-28 12:14:00 +00:00
|
|
|
|
2006-08-31 09:13:03 +00:00
|
|
|
#include "usetup.h"
|
2004-05-28 12:14:00 +00:00
|
|
|
|
2010-06-07 21:38:49 +00:00
|
|
|
#define NDEBUG
|
2004-05-28 12:14:00 +00:00
|
|
|
#include <debug.h>
|
|
|
|
|
|
|
|
/* FUNCTIONS ****************************************************************/
|
|
|
|
|
2017-05-15 16:22:18 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2014-05-12 14:17:37 +00:00
|
|
|
static
|
|
|
|
VOID
|
|
|
|
DrawListFrame(
|
2017-05-15 16:22:18 +00:00
|
|
|
IN PGENERIC_LIST_UI ListUi)
|
2004-05-28 12:14:00 +00:00
|
|
|
{
|
2008-05-11 15:07:16 +00:00
|
|
|
COORD coPos;
|
|
|
|
DWORD Written;
|
|
|
|
SHORT i;
|
|
|
|
|
|
|
|
/* Draw upper left corner */
|
2017-05-15 16:22:18 +00:00
|
|
|
coPos.X = ListUi->Left;
|
|
|
|
coPos.Y = ListUi->Top;
|
2008-05-11 15:07:16 +00:00
|
|
|
FillConsoleOutputCharacterA (StdOutput,
|
|
|
|
0xDA, // '+',
|
|
|
|
1,
|
|
|
|
coPos,
|
|
|
|
&Written);
|
|
|
|
|
|
|
|
/* Draw upper edge */
|
2017-05-15 16:22:18 +00:00
|
|
|
coPos.X = ListUi->Left + 1;
|
|
|
|
coPos.Y = ListUi->Top;
|
2008-05-11 15:07:16 +00:00
|
|
|
FillConsoleOutputCharacterA (StdOutput,
|
|
|
|
0xC4, // '-',
|
2017-05-15 16:22:18 +00:00
|
|
|
ListUi->Right - ListUi->Left - 1,
|
2008-05-11 15:07:16 +00:00
|
|
|
coPos,
|
|
|
|
&Written);
|
|
|
|
|
|
|
|
/* Draw upper right corner */
|
2017-05-15 16:22:18 +00:00
|
|
|
coPos.X = ListUi->Right;
|
|
|
|
coPos.Y = ListUi->Top;
|
2008-05-11 15:07:16 +00:00
|
|
|
FillConsoleOutputCharacterA (StdOutput,
|
|
|
|
0xBF, // '+',
|
|
|
|
1,
|
|
|
|
coPos,
|
|
|
|
&Written);
|
|
|
|
|
|
|
|
/* Draw left and right edge */
|
2017-05-15 16:22:18 +00:00
|
|
|
for (i = ListUi->Top + 1; i < ListUi->Bottom; i++)
|
2004-05-28 12:14:00 +00:00
|
|
|
{
|
2017-05-15 16:22:18 +00:00
|
|
|
coPos.X = ListUi->Left;
|
2008-05-11 15:07:16 +00:00
|
|
|
coPos.Y = i;
|
|
|
|
FillConsoleOutputCharacterA (StdOutput,
|
|
|
|
0xB3, // '|',
|
|
|
|
1,
|
|
|
|
coPos,
|
|
|
|
&Written);
|
|
|
|
|
2017-05-15 16:22:18 +00:00
|
|
|
coPos.X = ListUi->Right;
|
2008-05-11 15:07:16 +00:00
|
|
|
FillConsoleOutputCharacterA (StdOutput,
|
|
|
|
0xB3, //'|',
|
|
|
|
1,
|
|
|
|
coPos,
|
|
|
|
&Written);
|
2004-05-28 12:14:00 +00:00
|
|
|
}
|
|
|
|
|
2008-05-11 15:07:16 +00:00
|
|
|
/* Draw lower left corner */
|
2017-05-15 16:22:18 +00:00
|
|
|
coPos.X = ListUi->Left;
|
|
|
|
coPos.Y = ListUi->Bottom;
|
2008-05-11 15:07:16 +00:00
|
|
|
FillConsoleOutputCharacterA (StdOutput,
|
|
|
|
0xC0, // '+',
|
|
|
|
1,
|
|
|
|
coPos,
|
|
|
|
&Written);
|
|
|
|
|
|
|
|
/* Draw lower edge */
|
2017-05-15 16:22:18 +00:00
|
|
|
coPos.X = ListUi->Left + 1;
|
|
|
|
coPos.Y = ListUi->Bottom;
|
2008-05-11 15:07:16 +00:00
|
|
|
FillConsoleOutputCharacterA (StdOutput,
|
|
|
|
0xC4, // '-',
|
2017-05-15 16:22:18 +00:00
|
|
|
ListUi->Right - ListUi->Left - 1,
|
2008-05-11 15:07:16 +00:00
|
|
|
coPos,
|
|
|
|
&Written);
|
|
|
|
|
|
|
|
/* Draw lower right corner */
|
2017-05-15 16:22:18 +00:00
|
|
|
coPos.X = ListUi->Right;
|
|
|
|
coPos.Y = ListUi->Bottom;
|
2008-05-11 15:07:16 +00:00
|
|
|
FillConsoleOutputCharacterA (StdOutput,
|
|
|
|
0xD9, // '+',
|
|
|
|
1,
|
|
|
|
coPos,
|
|
|
|
&Written);
|
2004-05-28 12:14:00 +00:00
|
|
|
}
|
|
|
|
|
2014-05-12 14:17:37 +00:00
|
|
|
static
|
|
|
|
VOID
|
|
|
|
DrawListEntries(
|
2017-05-15 16:22:18 +00:00
|
|
|
IN PGENERIC_LIST_UI ListUi)
|
2004-05-28 12:14:00 +00:00
|
|
|
{
|
2017-05-15 16:22:18 +00:00
|
|
|
PGENERIC_LIST List = ListUi->List;
|
2008-05-11 15:07:16 +00:00
|
|
|
PGENERIC_LIST_ENTRY ListEntry;
|
|
|
|
PLIST_ENTRY Entry;
|
|
|
|
COORD coPos;
|
|
|
|
DWORD Written;
|
|
|
|
USHORT Width;
|
|
|
|
|
2017-05-15 16:22:18 +00:00
|
|
|
coPos.X = ListUi->Left + 1;
|
|
|
|
coPos.Y = ListUi->Top + 1;
|
|
|
|
Width = ListUi->Right - ListUi->Left - 1;
|
2008-05-11 15:07:16 +00:00
|
|
|
|
2017-05-15 16:22:18 +00:00
|
|
|
Entry = ListUi->FirstShown;
|
|
|
|
while (Entry != &List->ListHead)
|
2004-05-28 12:14:00 +00:00
|
|
|
{
|
[SETUPLIB][USETUP] Introduce a 'SetupLib' library. CORE-13544
- Create the beginnings of a "setuplib" library, whose aim is to be shared between the (currently existing) 1st-stage text-mode installer, and the (future) 1st-stage GUI installer.
- Finish to split the GenList and PartList codes into their UI part, which remain in usetup, and their algorithmic part, which go into setuplib.
- Move SetMountedDeviceValue into the PartList module.
- Split the FileSystem list code into its UI and the algorithmic part (which goes into setuplib under the name fsutil.c).
* The algo part is meant to be able to manage the filesystems available on the running system, similarly to what is mostly done (in scattered form) in fmifs, format, chkdsk / autochk codes...
It also manages the partition filesystem recognition, using OS routines.
* The UI part manages the FS list as it appears on screen, showing only the possible FSes that can be used to format the selected partition (a bit similar to what we do in the shell32's drive.c, etc...).
- Adapt the calling code to these changes.
- Remove some "host" code that was dating back from the dark old times.
svn path=/branches/setup_improvements/; revision=74570
svn path=/branches/setup_improvements/; revision=74659
2017-05-17 23:37:41 +00:00
|
|
|
ListEntry = CONTAINING_RECORD(Entry, GENERIC_LIST_ENTRY, Entry);
|
2008-05-11 15:07:16 +00:00
|
|
|
|
2017-05-15 16:22:18 +00:00
|
|
|
if (coPos.Y == ListUi->Bottom)
|
2008-05-11 15:07:16 +00:00
|
|
|
break;
|
2017-05-15 16:22:18 +00:00
|
|
|
ListUi->LastShown = Entry;
|
2008-05-11 15:07:16 +00:00
|
|
|
|
|
|
|
FillConsoleOutputAttribute (StdOutput,
|
2017-05-15 16:22:18 +00:00
|
|
|
(List->CurrentEntry == ListEntry) ?
|
2008-05-11 15:07:16 +00:00
|
|
|
FOREGROUND_BLUE | BACKGROUND_WHITE :
|
|
|
|
FOREGROUND_WHITE | BACKGROUND_BLUE,
|
|
|
|
Width,
|
|
|
|
coPos,
|
|
|
|
&Written);
|
|
|
|
|
|
|
|
FillConsoleOutputCharacterA (StdOutput,
|
|
|
|
' ',
|
|
|
|
Width,
|
|
|
|
coPos,
|
|
|
|
&Written);
|
|
|
|
|
|
|
|
coPos.X++;
|
|
|
|
WriteConsoleOutputCharacterA (StdOutput,
|
|
|
|
ListEntry->Text,
|
|
|
|
min (strlen(ListEntry->Text), (SIZE_T)Width - 2),
|
|
|
|
coPos,
|
|
|
|
&Written);
|
|
|
|
coPos.X--;
|
|
|
|
|
|
|
|
coPos.Y++;
|
|
|
|
Entry = Entry->Flink;
|
2004-05-28 12:14:00 +00:00
|
|
|
}
|
|
|
|
|
2017-05-15 16:22:18 +00:00
|
|
|
while (coPos.Y < ListUi->Bottom)
|
2004-05-28 12:14:00 +00:00
|
|
|
{
|
2008-05-11 15:07:16 +00:00
|
|
|
FillConsoleOutputAttribute (StdOutput,
|
|
|
|
FOREGROUND_WHITE | BACKGROUND_BLUE,
|
|
|
|
Width,
|
|
|
|
coPos,
|
|
|
|
&Written);
|
|
|
|
|
|
|
|
FillConsoleOutputCharacterA (StdOutput,
|
|
|
|
' ',
|
|
|
|
Width,
|
|
|
|
coPos,
|
|
|
|
&Written);
|
|
|
|
coPos.Y++;
|
2004-05-28 12:14:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-05-12 14:17:37 +00:00
|
|
|
static
|
|
|
|
VOID
|
|
|
|
DrawScrollBarGenericList(
|
2017-05-15 16:22:18 +00:00
|
|
|
IN PGENERIC_LIST_UI ListUi)
|
2008-05-13 11:29:56 +00:00
|
|
|
{
|
2017-05-15 16:22:18 +00:00
|
|
|
PGENERIC_LIST List = ListUi->List;
|
2008-05-13 11:29:56 +00:00
|
|
|
COORD coPos;
|
2008-05-13 11:43:39 +00:00
|
|
|
DWORD Written;
|
2008-05-13 11:29:56 +00:00
|
|
|
|
2017-05-15 16:22:18 +00:00
|
|
|
coPos.X = ListUi->Right + 1;
|
|
|
|
coPos.Y = ListUi->Top;
|
2008-05-13 11:29:56 +00:00
|
|
|
|
2017-05-15 16:22:18 +00:00
|
|
|
if (ListUi->FirstShown != List->ListHead.Flink)
|
2008-05-13 11:43:39 +00:00
|
|
|
{
|
2008-05-13 11:29:56 +00:00
|
|
|
FillConsoleOutputCharacterA (StdOutput,
|
|
|
|
'\x18',
|
|
|
|
1,
|
|
|
|
coPos,
|
|
|
|
&Written);
|
2008-05-13 11:43:39 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-05-13 11:29:56 +00:00
|
|
|
FillConsoleOutputCharacterA (StdOutput,
|
|
|
|
' ',
|
|
|
|
1,
|
|
|
|
coPos,
|
|
|
|
&Written);
|
2008-05-13 11:43:39 +00:00
|
|
|
}
|
|
|
|
|
2017-05-15 16:22:18 +00:00
|
|
|
coPos.Y = ListUi->Bottom;
|
|
|
|
if (ListUi->LastShown != List->ListHead.Blink)
|
2008-05-13 11:43:39 +00:00
|
|
|
{
|
2008-05-13 11:29:56 +00:00
|
|
|
FillConsoleOutputCharacterA (StdOutput,
|
|
|
|
'\x19',
|
|
|
|
1,
|
|
|
|
coPos,
|
|
|
|
&Written);
|
2008-05-13 11:43:39 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-05-13 11:29:56 +00:00
|
|
|
FillConsoleOutputCharacterA (StdOutput,
|
|
|
|
' ',
|
|
|
|
1,
|
|
|
|
coPos,
|
|
|
|
&Written);
|
2008-05-13 11:43:39 +00:00
|
|
|
}
|
2008-05-13 11:29:56 +00:00
|
|
|
}
|
2004-05-28 12:14:00 +00:00
|
|
|
|
2015-12-07 16:10:09 +00:00
|
|
|
static
|
|
|
|
VOID
|
|
|
|
CenterCurrentListItem(
|
2017-05-15 16:22:18 +00:00
|
|
|
IN PGENERIC_LIST_UI ListUi)
|
2015-12-07 16:10:09 +00:00
|
|
|
{
|
2017-05-15 16:22:18 +00:00
|
|
|
PGENERIC_LIST List = ListUi->List;
|
2015-12-07 16:10:09 +00:00
|
|
|
PLIST_ENTRY Entry;
|
|
|
|
ULONG MaxVisibleItems, ItemCount, i;
|
|
|
|
|
2017-05-15 16:22:18 +00:00
|
|
|
if ((ListUi->Top == 0 && ListUi->Bottom == 0) ||
|
2015-12-07 16:10:09 +00:00
|
|
|
IsListEmpty(&List->ListHead) ||
|
|
|
|
List->CurrentEntry == NULL)
|
2017-05-15 16:22:18 +00:00
|
|
|
{
|
2015-12-07 16:10:09 +00:00
|
|
|
return;
|
2017-05-15 16:22:18 +00:00
|
|
|
}
|
2015-12-07 16:10:09 +00:00
|
|
|
|
2017-05-15 16:22:18 +00:00
|
|
|
MaxVisibleItems = (ULONG)(ListUi->Bottom - ListUi->Top - 1);
|
2015-12-07 16:10:09 +00:00
|
|
|
|
2017-05-15 16:22:18 +00:00
|
|
|
/*****************************************
|
2015-12-07 16:10:09 +00:00
|
|
|
ItemCount = 0;
|
|
|
|
Entry = List->ListHead.Flink;
|
|
|
|
while (Entry != &List->ListHead)
|
|
|
|
{
|
|
|
|
ItemCount++;
|
|
|
|
Entry = Entry->Flink;
|
|
|
|
}
|
2017-05-15 16:22:18 +00:00
|
|
|
*****************************************/
|
|
|
|
ItemCount = List->NumOfEntries; // GetNumberOfListEntries(List);
|
2015-12-07 16:10:09 +00:00
|
|
|
|
|
|
|
if (ItemCount > MaxVisibleItems)
|
|
|
|
{
|
|
|
|
Entry = &List->CurrentEntry->Entry;
|
|
|
|
for (i = 0; i < MaxVisibleItems / 2; i++)
|
|
|
|
{
|
|
|
|
if (Entry->Blink != &List->ListHead)
|
|
|
|
Entry = Entry->Blink;
|
|
|
|
}
|
|
|
|
|
2017-05-15 16:22:18 +00:00
|
|
|
ListUi->FirstShown = Entry;
|
2015-12-07 16:10:09 +00:00
|
|
|
|
|
|
|
for (i = 0; i < MaxVisibleItems; i++)
|
|
|
|
{
|
|
|
|
if (Entry->Flink != &List->ListHead)
|
|
|
|
Entry = Entry->Flink;
|
|
|
|
}
|
|
|
|
|
2017-05-15 16:22:18 +00:00
|
|
|
ListUi->LastShown = Entry;
|
2015-12-07 16:10:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-05-28 12:14:00 +00:00
|
|
|
VOID
|
2014-05-12 14:17:37 +00:00
|
|
|
DrawGenericList(
|
2017-05-15 16:22:18 +00:00
|
|
|
IN PGENERIC_LIST_UI ListUi,
|
|
|
|
IN SHORT Left,
|
|
|
|
IN SHORT Top,
|
|
|
|
IN SHORT Right,
|
|
|
|
IN SHORT Bottom)
|
2004-05-28 12:14:00 +00:00
|
|
|
{
|
2017-05-15 16:22:18 +00:00
|
|
|
PGENERIC_LIST List = ListUi->List;
|
2004-05-28 12:14:00 +00:00
|
|
|
|
2017-05-15 16:22:18 +00:00
|
|
|
ListUi->FirstShown = List->ListHead.Flink;
|
|
|
|
ListUi->Left = Left;
|
|
|
|
ListUi->Top = Top;
|
|
|
|
ListUi->Right = Right;
|
|
|
|
ListUi->Bottom = Bottom;
|
|
|
|
|
|
|
|
DrawListFrame(ListUi);
|
2004-05-28 12:14:00 +00:00
|
|
|
|
2008-05-11 15:07:16 +00:00
|
|
|
if (IsListEmpty(&List->ListHead))
|
|
|
|
return;
|
2004-05-28 12:14:00 +00:00
|
|
|
|
2017-05-15 16:22:18 +00:00
|
|
|
CenterCurrentListItem(ListUi);
|
2015-12-07 16:10:09 +00:00
|
|
|
|
2017-05-15 16:22:18 +00:00
|
|
|
DrawListEntries(ListUi);
|
|
|
|
DrawScrollBarGenericList(ListUi);
|
2004-05-28 12:14:00 +00:00
|
|
|
}
|
|
|
|
|
[SETUPLIB][USETUP] Introduce a 'SetupLib' library. CORE-13544
- Create the beginnings of a "setuplib" library, whose aim is to be shared between the (currently existing) 1st-stage text-mode installer, and the (future) 1st-stage GUI installer.
- Finish to split the GenList and PartList codes into their UI part, which remain in usetup, and their algorithmic part, which go into setuplib.
- Move SetMountedDeviceValue into the PartList module.
- Split the FileSystem list code into its UI and the algorithmic part (which goes into setuplib under the name fsutil.c).
* The algo part is meant to be able to manage the filesystems available on the running system, similarly to what is mostly done (in scattered form) in fmifs, format, chkdsk / autochk codes...
It also manages the partition filesystem recognition, using OS routines.
* The UI part manages the FS list as it appears on screen, showing only the possible FSes that can be used to format the selected partition (a bit similar to what we do in the shell32's drive.c, etc...).
- Adapt the calling code to these changes.
- Remove some "host" code that was dating back from the dark old times.
svn path=/branches/setup_improvements/; revision=74570
svn path=/branches/setup_improvements/; revision=74659
2017-05-17 23:37:41 +00:00
|
|
|
VOID
|
|
|
|
ScrollDownGenericList(
|
|
|
|
IN PGENERIC_LIST_UI ListUi)
|
|
|
|
{
|
|
|
|
PGENERIC_LIST List = ListUi->List;
|
|
|
|
PLIST_ENTRY Entry;
|
|
|
|
|
|
|
|
if (List->CurrentEntry == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (List->CurrentEntry->Entry.Flink != &List->ListHead)
|
|
|
|
{
|
|
|
|
Entry = List->CurrentEntry->Entry.Flink;
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
VOID
|
|
|
|
ScrollUpGenericList(
|
|
|
|
IN PGENERIC_LIST_UI ListUi)
|
|
|
|
{
|
|
|
|
PGENERIC_LIST List = ListUi->List;
|
|
|
|
PLIST_ENTRY Entry;
|
|
|
|
|
|
|
|
if (List->CurrentEntry == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (List->CurrentEntry->Entry.Blink != &List->ListHead)
|
|
|
|
{
|
|
|
|
Entry = List->CurrentEntry->Entry.Blink;
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-05-12 14:17:37 +00:00
|
|
|
|
2008-05-14 14:01:06 +00:00
|
|
|
VOID
|
2014-05-12 14:17:37 +00:00
|
|
|
ScrollPageDownGenericList(
|
2017-05-15 16:22:18 +00:00
|
|
|
IN PGENERIC_LIST_UI ListUi)
|
2008-05-14 14:01:06 +00:00
|
|
|
{
|
|
|
|
SHORT i;
|
|
|
|
|
|
|
|
/* Suspend auto-redraw */
|
2017-05-15 16:22:18 +00:00
|
|
|
ListUi->Redraw = FALSE;
|
2008-05-14 14:01:06 +00:00
|
|
|
|
2017-05-15 16:22:18 +00:00
|
|
|
for (i = ListUi->Top + 1; i < ListUi->Bottom - 1; i++)
|
2008-05-14 14:01:06 +00:00
|
|
|
{
|
2017-05-15 16:22:18 +00:00
|
|
|
ScrollDownGenericList(ListUi);
|
2008-05-14 14:01:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Update user interface */
|
2017-05-15 16:22:18 +00:00
|
|
|
DrawListEntries(ListUi);
|
|
|
|
DrawScrollBarGenericList(ListUi);
|
2008-05-14 14:01:06 +00:00
|
|
|
|
|
|
|
/* Re enable auto-redraw */
|
2017-05-15 16:22:18 +00:00
|
|
|
ListUi->Redraw = TRUE;
|
2008-05-14 14:01:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
VOID
|
2014-05-12 14:17:37 +00:00
|
|
|
ScrollPageUpGenericList(
|
2017-05-15 16:22:18 +00:00
|
|
|
IN PGENERIC_LIST_UI ListUi)
|
2008-05-14 14:01:06 +00:00
|
|
|
{
|
|
|
|
SHORT i;
|
|
|
|
|
|
|
|
/* Suspend auto-redraw */
|
2017-05-15 16:22:18 +00:00
|
|
|
ListUi->Redraw = FALSE;
|
2008-05-14 14:01:06 +00:00
|
|
|
|
2017-05-15 16:22:18 +00:00
|
|
|
for (i = ListUi->Bottom - 1; i > ListUi->Top + 1; i--)
|
2008-05-14 14:01:06 +00:00
|
|
|
{
|
2017-05-15 16:22:18 +00:00
|
|
|
ScrollUpGenericList(ListUi);
|
2008-05-14 14:01:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Update user interface */
|
2017-05-15 16:22:18 +00:00
|
|
|
DrawListEntries(ListUi);
|
|
|
|
DrawScrollBarGenericList(ListUi);
|
2008-05-14 14:01:06 +00:00
|
|
|
|
|
|
|
/* Re enable auto-redraw */
|
2017-05-15 16:22:18 +00:00
|
|
|
ListUi->Redraw = TRUE;
|
2008-05-14 14:01:06 +00:00
|
|
|
}
|
2004-05-28 12:14:00 +00:00
|
|
|
|
2008-06-02 15:34:57 +00:00
|
|
|
VOID
|
2014-05-12 14:17:37 +00:00
|
|
|
ScrollToPositionGenericList(
|
2017-05-15 16:22:18 +00:00
|
|
|
IN PGENERIC_LIST_UI ListUi,
|
|
|
|
IN ULONG uIndex)
|
2008-06-02 15:34:57 +00:00
|
|
|
{
|
2017-05-15 16:22:18 +00:00
|
|
|
PGENERIC_LIST List = ListUi->List;
|
2008-06-02 15:34:57 +00:00
|
|
|
PLIST_ENTRY Entry;
|
|
|
|
ULONG uCount = 0;
|
|
|
|
|
2012-02-27 22:46:20 +00:00
|
|
|
if (List->CurrentEntry == NULL || uIndex == 0)
|
2008-06-02 15:34:57 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if (List->CurrentEntry->Entry.Flink != &List->ListHead)
|
|
|
|
{
|
|
|
|
Entry = List->CurrentEntry->Entry.Flink;
|
2017-05-15 16:22:18 +00:00
|
|
|
if (ListUi->LastShown == &List->CurrentEntry->Entry)
|
2008-06-02 15:34:57 +00:00
|
|
|
{
|
2017-05-15 16:22:18 +00:00
|
|
|
ListUi->FirstShown = ListUi->FirstShown->Flink;
|
|
|
|
ListUi->LastShown = ListUi->LastShown->Flink;
|
2008-06-02 15:34:57 +00:00
|
|
|
}
|
2017-05-15 16:22:18 +00:00
|
|
|
List->CurrentEntry = CONTAINING_RECORD(Entry, GENERIC_LIST_ENTRY, Entry);
|
2008-06-02 15:34:57 +00:00
|
|
|
}
|
|
|
|
uCount++;
|
|
|
|
}
|
|
|
|
while (uIndex != uCount);
|
|
|
|
|
2017-05-15 16:22:18 +00:00
|
|
|
if (ListUi->Redraw)
|
2008-06-02 15:34:57 +00:00
|
|
|
{
|
2017-05-15 16:22:18 +00:00
|
|
|
DrawListEntries(ListUi);
|
|
|
|
DrawScrollBarGenericList(ListUi);
|
2008-06-02 15:34:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-01-19 09:47:27 +00:00
|
|
|
VOID
|
2014-05-12 14:17:37 +00:00
|
|
|
RedrawGenericList(
|
2017-05-15 16:22:18 +00:00
|
|
|
IN PGENERIC_LIST_UI ListUi)
|
2014-01-19 09:47:27 +00:00
|
|
|
{
|
2017-05-15 16:22:18 +00:00
|
|
|
if (ListUi->List->CurrentEntry == NULL)
|
2014-01-19 09:47:27 +00:00
|
|
|
return;
|
|
|
|
|
2017-05-15 16:22:18 +00:00
|
|
|
if (ListUi->Redraw)
|
2014-01-19 09:47:27 +00:00
|
|
|
{
|
2017-05-15 16:22:18 +00:00
|
|
|
DrawListEntries(ListUi);
|
|
|
|
DrawScrollBarGenericList(ListUi);
|
2014-01-19 09:47:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-01-23 16:14:50 +00:00
|
|
|
VOID
|
2014-05-12 14:17:37 +00:00
|
|
|
GenericListKeyPress(
|
2017-05-15 16:22:18 +00:00
|
|
|
IN PGENERIC_LIST_UI ListUi,
|
|
|
|
IN CHAR AsciiChar)
|
2008-01-23 16:14:50 +00:00
|
|
|
{
|
2017-05-15 16:22:18 +00:00
|
|
|
PGENERIC_LIST List = ListUi->List;
|
2008-05-11 15:07:16 +00:00
|
|
|
PGENERIC_LIST_ENTRY ListEntry;
|
2008-06-17 20:10:07 +00:00
|
|
|
PGENERIC_LIST_ENTRY OldListEntry;
|
|
|
|
BOOLEAN Flag = FALSE;
|
2008-01-23 17:14:08 +00:00
|
|
|
|
2017-05-15 16:22:18 +00:00
|
|
|
ListEntry = List->CurrentEntry;
|
|
|
|
OldListEntry = List->CurrentEntry;
|
2008-01-23 17:14:08 +00:00
|
|
|
|
2017-05-15 16:22:18 +00:00
|
|
|
ListUi->Redraw = FALSE;
|
2008-01-23 17:14:08 +00:00
|
|
|
|
2016-02-02 02:23:56 +00:00
|
|
|
if ((strlen(ListEntry->Text) > 0) && (tolower(ListEntry->Text[0]) == AsciiChar) &&
|
2017-05-15 16:22:18 +00:00
|
|
|
(List->CurrentEntry->Entry.Flink != &List->ListHead))
|
2008-01-23 16:14:50 +00:00
|
|
|
{
|
2017-05-15 16:22:18 +00:00
|
|
|
ScrollDownGenericList(ListUi);
|
|
|
|
ListEntry = List->CurrentEntry;
|
2008-05-11 15:07:16 +00:00
|
|
|
|
2016-02-02 02:23:56 +00:00
|
|
|
if ((strlen(ListEntry->Text) > 0) && (tolower(ListEntry->Text[0]) == AsciiChar))
|
2008-06-17 20:10:07 +00:00
|
|
|
goto End;
|
|
|
|
}
|
2008-05-11 15:07:16 +00:00
|
|
|
|
2017-05-15 16:22:18 +00:00
|
|
|
while (List->CurrentEntry->Entry.Blink != &List->ListHead)
|
|
|
|
ScrollUpGenericList(ListUi);
|
2008-05-11 15:07:16 +00:00
|
|
|
|
2017-05-15 16:22:18 +00:00
|
|
|
ListEntry = List->CurrentEntry;
|
2008-06-17 20:10:07 +00:00
|
|
|
|
|
|
|
for (;;)
|
|
|
|
{
|
2016-02-02 02:23:56 +00:00
|
|
|
if ((strlen(ListEntry->Text) > 0) && (tolower(ListEntry->Text[0]) == AsciiChar))
|
2008-06-17 20:10:07 +00:00
|
|
|
{
|
|
|
|
Flag = TRUE;
|
2008-05-11 15:07:16 +00:00
|
|
|
break;
|
2008-01-23 16:14:50 +00:00
|
|
|
}
|
2008-05-11 15:07:16 +00:00
|
|
|
|
2017-05-15 16:22:18 +00:00
|
|
|
if (List->CurrentEntry->Entry.Flink == &List->ListHead)
|
2008-06-17 20:10:07 +00:00
|
|
|
break;
|
|
|
|
|
2017-05-15 16:22:18 +00:00
|
|
|
ScrollDownGenericList(ListUi);
|
|
|
|
ListEntry = List->CurrentEntry;
|
2008-06-17 20:10:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!Flag)
|
|
|
|
{
|
2017-05-15 16:22:18 +00:00
|
|
|
while (List->CurrentEntry->Entry.Blink != &List->ListHead)
|
2008-06-17 20:10:07 +00:00
|
|
|
{
|
2017-05-15 16:22:18 +00:00
|
|
|
if (List->CurrentEntry != OldListEntry)
|
|
|
|
ScrollUpGenericList(ListUi);
|
2008-06-17 20:10:07 +00:00
|
|
|
else
|
|
|
|
break;
|
|
|
|
}
|
2008-01-23 16:14:50 +00:00
|
|
|
}
|
2017-05-15 16:22:18 +00:00
|
|
|
|
2008-06-17 20:10:07 +00:00
|
|
|
End:
|
2017-05-15 16:22:18 +00:00
|
|
|
DrawListEntries(ListUi);
|
|
|
|
DrawScrollBarGenericList(ListUi);
|
2008-05-11 15:07:16 +00:00
|
|
|
|
2017-05-15 16:22:18 +00:00
|
|
|
ListUi->Redraw = TRUE;
|
2008-01-23 16:14:50 +00:00
|
|
|
}
|
2004-05-28 12:14:00 +00:00
|
|
|
|
|
|
|
/* EOF */
|