- [FORMATTING] Fix indentation in usetup's genlist.

- Remove the obsolete "media/vgafonts/readme.txt" file.

No code changes

svn path=/trunk/; revision=33445
This commit is contained in:
Colin Finck 2008-05-11 15:07:16 +00:00
parent bd846f9aa4
commit 67e88fe072
3 changed files with 228 additions and 238 deletions

View file

@ -36,263 +36,263 @@
PGENERIC_LIST PGENERIC_LIST
CreateGenericList(VOID) CreateGenericList(VOID)
{ {
PGENERIC_LIST List; PGENERIC_LIST List;
List = (PGENERIC_LIST)RtlAllocateHeap(ProcessHeap, List = (PGENERIC_LIST)RtlAllocateHeap(ProcessHeap,
0, 0,
sizeof(GENERIC_LIST)); sizeof(GENERIC_LIST));
if (List == NULL) if (List == NULL)
return NULL; return NULL;
InitializeListHead(&List->ListHead); InitializeListHead(&List->ListHead);
List->Left = 0; List->Left = 0;
List->Top = 0; List->Top = 0;
List->Right = 0; List->Right = 0;
List->Bottom = 0; List->Bottom = 0;
List->CurrentEntry = NULL; List->CurrentEntry = NULL;
return List; return List;
} }
VOID VOID
DestroyGenericList(PGENERIC_LIST List, DestroyGenericList(PGENERIC_LIST List,
BOOLEAN FreeUserData) BOOLEAN FreeUserData)
{ {
PGENERIC_LIST_ENTRY ListEntry; PGENERIC_LIST_ENTRY ListEntry;
PLIST_ENTRY Entry; PLIST_ENTRY Entry;
/* Release list entries */ /* Release list entries */
while (!IsListEmpty (&List->ListHead)) while (!IsListEmpty (&List->ListHead))
{ {
Entry = RemoveHeadList (&List->ListHead); Entry = RemoveHeadList (&List->ListHead);
ListEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry); ListEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry);
/* Release user data */ /* Release user data */
if (FreeUserData && ListEntry->UserData != NULL) if (FreeUserData && ListEntry->UserData != NULL)
RtlFreeHeap (ProcessHeap, 0, ListEntry->UserData); RtlFreeHeap (ProcessHeap, 0, ListEntry->UserData);
/* Release list entry */ /* Release list entry */
RtlFreeHeap (ProcessHeap, 0, ListEntry); RtlFreeHeap (ProcessHeap, 0, ListEntry);
} }
/* Release list head */ /* Release list head */
RtlFreeHeap (ProcessHeap, 0, List); RtlFreeHeap (ProcessHeap, 0, List);
} }
BOOLEAN BOOLEAN
AppendGenericListEntry(PGENERIC_LIST List, AppendGenericListEntry(PGENERIC_LIST List,
PCHAR Text, PCHAR Text,
PVOID UserData, PVOID UserData,
BOOLEAN Current) BOOLEAN Current)
{ {
PGENERIC_LIST_ENTRY Entry; PGENERIC_LIST_ENTRY Entry;
Entry = (PGENERIC_LIST_ENTRY)RtlAllocateHeap(ProcessHeap, Entry = (PGENERIC_LIST_ENTRY)RtlAllocateHeap(ProcessHeap,
0, 0,
sizeof(GENERIC_LIST_ENTRY) + strlen(Text)); sizeof(GENERIC_LIST_ENTRY) + strlen(Text));
if (Entry == NULL) if (Entry == NULL)
return FALSE; return FALSE;
strcpy (Entry->Text, Text); strcpy (Entry->Text, Text);
Entry->UserData = UserData; Entry->UserData = UserData;
InsertTailList(&List->ListHead, InsertTailList(&List->ListHead,
&Entry->Entry); &Entry->Entry);
if (Current || List->CurrentEntry == NULL) if (Current || List->CurrentEntry == NULL)
{ {
List->CurrentEntry = Entry; List->CurrentEntry = Entry;
} }
return TRUE; return TRUE;
} }
static VOID static VOID
DrawListFrame(PGENERIC_LIST GenericList) DrawListFrame(PGENERIC_LIST GenericList)
{ {
COORD coPos; COORD coPos;
DWORD Written; DWORD Written;
SHORT i; SHORT i;
/* Draw upper left corner */ /* Draw upper left corner */
coPos.X = GenericList->Left; coPos.X = GenericList->Left;
coPos.Y = GenericList->Top; coPos.Y = GenericList->Top;
FillConsoleOutputCharacterA (StdOutput, FillConsoleOutputCharacterA (StdOutput,
0xDA, // '+', 0xDA, // '+',
1, 1,
coPos, coPos,
&Written); &Written);
/* Draw upper edge */ /* Draw upper edge */
coPos.X = GenericList->Left + 1; coPos.X = GenericList->Left + 1;
coPos.Y = GenericList->Top; coPos.Y = GenericList->Top;
FillConsoleOutputCharacterA (StdOutput, FillConsoleOutputCharacterA (StdOutput,
0xC4, // '-', 0xC4, // '-',
GenericList->Right - GenericList->Left - 1, GenericList->Right - GenericList->Left - 1,
coPos, coPos,
&Written); &Written);
/* Draw upper right corner */ /* Draw upper right corner */
coPos.X = GenericList->Right; coPos.X = GenericList->Right;
coPos.Y = GenericList->Top; coPos.Y = GenericList->Top;
FillConsoleOutputCharacterA (StdOutput, FillConsoleOutputCharacterA (StdOutput,
0xBF, // '+', 0xBF, // '+',
1, 1,
coPos, coPos,
&Written); &Written);
/* Draw left and right edge */ /* Draw left and right edge */
for (i = GenericList->Top + 1; i < GenericList->Bottom; i++) for (i = GenericList->Top + 1; i < GenericList->Bottom; i++)
{ {
coPos.X = GenericList->Left; coPos.X = GenericList->Left;
coPos.Y = i; coPos.Y = i;
FillConsoleOutputCharacterA (StdOutput, FillConsoleOutputCharacterA (StdOutput,
0xB3, // '|', 0xB3, // '|',
1, 1,
coPos, coPos,
&Written); &Written);
coPos.X = GenericList->Right; coPos.X = GenericList->Right;
FillConsoleOutputCharacterA (StdOutput, FillConsoleOutputCharacterA (StdOutput,
0xB3, //'|', 0xB3, //'|',
1, 1,
coPos, coPos,
&Written); &Written);
} }
/* Draw lower left corner */ /* Draw lower left corner */
coPos.X = GenericList->Left; coPos.X = GenericList->Left;
coPos.Y = GenericList->Bottom; coPos.Y = GenericList->Bottom;
FillConsoleOutputCharacterA (StdOutput, FillConsoleOutputCharacterA (StdOutput,
0xC0, // '+', 0xC0, // '+',
1, 1,
coPos, coPos,
&Written); &Written);
/* Draw lower edge */ /* Draw lower edge */
coPos.X = GenericList->Left + 1; coPos.X = GenericList->Left + 1;
coPos.Y = GenericList->Bottom; coPos.Y = GenericList->Bottom;
FillConsoleOutputCharacterA (StdOutput, FillConsoleOutputCharacterA (StdOutput,
0xC4, // '-', 0xC4, // '-',
GenericList->Right - GenericList->Left - 1, GenericList->Right - GenericList->Left - 1,
coPos, coPos,
&Written); &Written);
/* Draw lower right corner */ /* Draw lower right corner */
coPos.X = GenericList->Right; coPos.X = GenericList->Right;
coPos.Y = GenericList->Bottom; coPos.Y = GenericList->Bottom;
FillConsoleOutputCharacterA (StdOutput, FillConsoleOutputCharacterA (StdOutput,
0xD9, // '+', 0xD9, // '+',
1, 1,
coPos, coPos,
&Written); &Written);
} }
static VOID static VOID
DrawListEntries(PGENERIC_LIST GenericList) DrawListEntries(PGENERIC_LIST GenericList)
{ {
PGENERIC_LIST_ENTRY ListEntry; PGENERIC_LIST_ENTRY ListEntry;
PLIST_ENTRY Entry; PLIST_ENTRY Entry;
COORD coPos; COORD coPos;
DWORD Written; DWORD Written;
USHORT Width; USHORT Width;
coPos.X = GenericList->Left + 1; coPos.X = GenericList->Left + 1;
coPos.Y = GenericList->Top + 1; coPos.Y = GenericList->Top + 1;
Width = GenericList->Right - GenericList->Left - 1; Width = GenericList->Right - GenericList->Left - 1;
Entry = GenericList->ListHead.Flink; Entry = GenericList->ListHead.Flink;
while (Entry != &GenericList->ListHead) while (Entry != &GenericList->ListHead)
{ {
ListEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry); ListEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry);
if (coPos.Y == GenericList->Bottom) if (coPos.Y == GenericList->Bottom)
break; break;
FillConsoleOutputAttribute (StdOutput, FillConsoleOutputAttribute (StdOutput,
(GenericList->CurrentEntry == ListEntry) ? (GenericList->CurrentEntry == ListEntry) ?
FOREGROUND_BLUE | BACKGROUND_WHITE : FOREGROUND_BLUE | BACKGROUND_WHITE :
FOREGROUND_WHITE | BACKGROUND_BLUE, FOREGROUND_WHITE | BACKGROUND_BLUE,
Width, Width,
coPos, coPos,
&Written); &Written);
FillConsoleOutputCharacterA (StdOutput, FillConsoleOutputCharacterA (StdOutput,
' ', ' ',
Width, Width,
coPos, coPos,
&Written); &Written);
coPos.X++; coPos.X++;
WriteConsoleOutputCharacterA (StdOutput, WriteConsoleOutputCharacterA (StdOutput,
ListEntry->Text, ListEntry->Text,
min (strlen(ListEntry->Text), (SIZE_T)Width - 2), min (strlen(ListEntry->Text), (SIZE_T)Width - 2),
coPos, coPos,
&Written); &Written);
coPos.X--; coPos.X--;
coPos.Y++; coPos.Y++;
Entry = Entry->Flink; Entry = Entry->Flink;
} }
while (coPos.Y < GenericList->Bottom) while (coPos.Y < GenericList->Bottom)
{ {
FillConsoleOutputAttribute (StdOutput, FillConsoleOutputAttribute (StdOutput,
FOREGROUND_WHITE | BACKGROUND_BLUE, FOREGROUND_WHITE | BACKGROUND_BLUE,
Width, Width,
coPos, coPos,
&Written); &Written);
FillConsoleOutputCharacterA (StdOutput, FillConsoleOutputCharacterA (StdOutput,
' ', ' ',
Width, Width,
coPos, coPos,
&Written); &Written);
coPos.Y++; coPos.Y++;
} }
} }
VOID VOID
DrawGenericList(PGENERIC_LIST List, DrawGenericList(PGENERIC_LIST List,
SHORT Left, SHORT Left,
SHORT Top, SHORT Top,
SHORT Right, SHORT Right,
SHORT Bottom) SHORT Bottom)
{ {
List->Left = Left; List->Left = Left;
List->Top = Top; List->Top = Top;
List->Right = Right; List->Right = Right;
List->Bottom = Bottom; List->Bottom = Bottom;
DrawListFrame(List); DrawListFrame(List);
if (IsListEmpty(&List->ListHead)) if (IsListEmpty(&List->ListHead))
return; return;
DrawListEntries(List); DrawListEntries(List);
} }
VOID VOID
ScrollDownGenericList (PGENERIC_LIST List) ScrollDownGenericList (PGENERIC_LIST List)
{ {
PLIST_ENTRY Entry; PLIST_ENTRY Entry;
if (List->CurrentEntry == NULL) if (List->CurrentEntry == NULL)
return; return;
if (List->CurrentEntry->Entry.Flink != &List->ListHead) if (List->CurrentEntry->Entry.Flink != &List->ListHead)
{ {
Entry = List->CurrentEntry->Entry.Flink; Entry = List->CurrentEntry->Entry.Flink;
List->CurrentEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry); List->CurrentEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry);
DrawListEntries(List); DrawListEntries(List);
} }
} }
@ -300,74 +300,79 @@ ScrollDownGenericList (PGENERIC_LIST List)
VOID VOID
ScrollUpGenericList (PGENERIC_LIST List) ScrollUpGenericList (PGENERIC_LIST List)
{ {
PLIST_ENTRY Entry; PLIST_ENTRY Entry;
if (List->CurrentEntry == NULL) if (List->CurrentEntry == NULL)
return; return;
if (List->CurrentEntry->Entry.Blink != &List->ListHead) if (List->CurrentEntry->Entry.Blink != &List->ListHead)
{ {
Entry = List->CurrentEntry->Entry.Blink; Entry = List->CurrentEntry->Entry.Blink;
List->CurrentEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry); List->CurrentEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry);
DrawListEntries(List); DrawListEntries(List);
} }
} }
VOID VOID
GenericListKeyPress (PGENERIC_LIST GenericList, CHAR AsciChar) GenericListKeyPress (PGENERIC_LIST GenericList, CHAR AsciChar)
{ {
PGENERIC_LIST_ENTRY ListEntry; PGENERIC_LIST_ENTRY ListEntry;
PLIST_ENTRY Entry; PLIST_ENTRY Entry;
Entry = &GenericList->CurrentEntry->Entry; Entry = &GenericList->CurrentEntry->Entry;
ListEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry); ListEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry);
Reset: Reset:
if (tolower(ListEntry->Text[0]) != AsciChar) if (tolower(ListEntry->Text[0]) != AsciChar)
Entry = GenericList->ListHead.Flink; Entry = GenericList->ListHead.Flink;
while (Entry != &GenericList->ListHead) while (Entry != &GenericList->ListHead)
{ {
ListEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry); ListEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry);
if ((strlen(ListEntry->Text) > 0) && (tolower(ListEntry->Text[0]) == AsciChar))
if ((strlen(ListEntry->Text) > 0) && (tolower(ListEntry->Text[0]) == AsciChar))
{ {
if (CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry) == GenericList->CurrentEntry) if (CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry) == GenericList->CurrentEntry)
{ {
Entry = Entry->Flink; Entry = Entry->Flink;
if (Entry == &GenericList->ListHead) if (Entry == &GenericList->ListHead)
goto Reset; goto Reset;
ListEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry);
if ((strlen(ListEntry->Text) < 1) || (tolower(ListEntry->Text[0]) != AsciChar)) ListEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry);
goto Reset; if ((strlen(ListEntry->Text) < 1) || (tolower(ListEntry->Text[0]) != AsciChar))
goto Reset;
} }
GenericList->CurrentEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry);
break; GenericList->CurrentEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry);
break;
} }
Entry = Entry->Flink;
Entry = Entry->Flink;
} }
if (Entry)
DrawListEntries(GenericList); if (Entry)
DrawListEntries(GenericList);
} }
PGENERIC_LIST_ENTRY PGENERIC_LIST_ENTRY
GetGenericListEntry(PGENERIC_LIST List) GetGenericListEntry(PGENERIC_LIST List)
{ {
return List->CurrentEntry; return List->CurrentEntry;
} }
VOID VOID
SaveGenericListState(PGENERIC_LIST List) SaveGenericListState(PGENERIC_LIST List)
{ {
List->BackupEntry = List->CurrentEntry; List->BackupEntry = List->CurrentEntry;
} }
VOID VOID
RestoreGenericListState(PGENERIC_LIST List) RestoreGenericListState(PGENERIC_LIST List)
{ {
List->CurrentEntry = List->BackupEntry; List->CurrentEntry = List->BackupEntry;
} }
/* EOF */ /* EOF */

View file

@ -29,23 +29,23 @@
typedef struct _GENERIC_LIST_ENTRY typedef struct _GENERIC_LIST_ENTRY
{ {
LIST_ENTRY Entry; LIST_ENTRY Entry;
PVOID UserData; PVOID UserData;
CHAR Text[1]; CHAR Text[1];
} GENERIC_LIST_ENTRY, *PGENERIC_LIST_ENTRY; } GENERIC_LIST_ENTRY, *PGENERIC_LIST_ENTRY;
typedef struct _GENERIC_LIST typedef struct _GENERIC_LIST
{ {
LIST_ENTRY ListHead; LIST_ENTRY ListHead;
SHORT Left; SHORT Left;
SHORT Top; SHORT Top;
SHORT Right; SHORT Right;
SHORT Bottom; SHORT Bottom;
PGENERIC_LIST_ENTRY CurrentEntry; PGENERIC_LIST_ENTRY CurrentEntry;
PGENERIC_LIST_ENTRY BackupEntry; PGENERIC_LIST_ENTRY BackupEntry;
} GENERIC_LIST, *PGENERIC_LIST; } GENERIC_LIST, *PGENERIC_LIST;
@ -55,20 +55,20 @@ CreateGenericList(VOID);
VOID VOID
DestroyGenericList(PGENERIC_LIST List, DestroyGenericList(PGENERIC_LIST List,
BOOLEAN FreeUserData); BOOLEAN FreeUserData);
BOOLEAN BOOLEAN
AppendGenericListEntry(PGENERIC_LIST List, AppendGenericListEntry(PGENERIC_LIST List,
PCHAR Text, PCHAR Text,
PVOID UserData, PVOID UserData,
BOOLEAN Current); BOOLEAN Current);
VOID VOID
DrawGenericList(PGENERIC_LIST List, DrawGenericList(PGENERIC_LIST List,
SHORT Left, SHORT Left,
SHORT Top, SHORT Top,
SHORT Right, SHORT Right,
SHORT Bottom); SHORT Bottom);
VOID VOID
ScrollDownGenericList(PGENERIC_LIST List); ScrollDownGenericList(PGENERIC_LIST List);

View file

@ -1,15 +0,0 @@
Until a better solution is found (like extending cabman) please recreate vgafont.bin
with 7-Zip or a similar compression tool. The file has to be in standard zip format without
compression. (CompressionMethod = 0)
sources:
http://opengrok.creo.hu/dragonfly/xref/src/share/syscons/fonts/cp437-8x8.fnt
http://opengrok.creo.hu/dragonfly/xref/src/share/syscons/fonts/cp850-8x8.fnt
http://opengrok.creo.hu/dragonfly/xref/src/share/syscons/fonts/cp865-8x8.fnt
http://opengrok.creo.hu/dragonfly/xref/src/share/syscons/fonts/cp866-8x8.fnt
http://packages.debian.org/en/etch/all/console-data/ file: gr737-8x8.psf
http://packages.debian.org/en/etch/all/console-data/ file: lat2-08.psf (as a base), remade several
glyphs (by GreatLord), corrected the aligning and cleaned up some of the fonts, finally changed from
ISO to DOS ASCII standard CP852 (by Caemyr)
http://cman.us/files/cp775-8x8.zip