** wip ** investigate some aspects in usetup partition list ui drawing code

This commit is contained in:
Hermès Bélusca-Maïto
2024-06-25 21:35:25 +02:00
parent 7701545871
commit 7446c77314

View File

@@ -70,10 +70,10 @@ GetPartitionTypeString(
}
}
VOID
static VOID
PrettifySize1(
IN OUT PULONGLONG Size,
OUT PCSTR* Unit)
_Inout_ PULONGLONG Size,
_Out_ PCSTR* Unit)
{
ULONGLONG DiskSize = *Size;
@@ -93,10 +93,10 @@ PrettifySize1(
*Size = DiskSize;
}
VOID
static VOID
PrettifySize2(
IN OUT PULONGLONG Size,
OUT PCSTR* Unit)
_Inout_ PULONGLONG Size,
_Out_ PCSTR* Unit)
{
ULONGLONG PartSize = *Size;
@@ -496,6 +496,7 @@ PrintDiskData(
coPos.X = ListUi->Left + 1;
coPos.Y = ListUi->Top + 1 + ListUi->Line;
/* Fill the list background */
if (ListUi->Line >= 0 && ListUi->Line <= Height)
{
FillConsoleOutputAttribute(StdOutput,
@@ -511,6 +512,7 @@ PrintDiskData(
&Written);
}
/* Print the disk description */
coPos.X++;
if (ListUi->Line >= 0 && ListUi->Line <= Height)
{
@@ -589,11 +591,10 @@ DrawPartitionList(
{
DiskEntry = CONTAINING_RECORD(Entry, DISKENTRY, ListEntry);
/* Counts disk description + empty line */
LastLine += 2;
if (CurrentPartLineFound == FALSE)
{
if (!CurrentPartLineFound)
CurrentPartLine += 2;
}
for (Entry2 = DiskEntry->PrimaryPartListHead.Flink;
Entry2 != &DiskEntry->PrimaryPartListHead;
@@ -601,19 +602,15 @@ DrawPartitionList(
{
PartEntry = CONTAINING_RECORD(Entry2, PARTENTRY, ListEntry);
if (PartEntry == ListUi->CurrentPartition)
{
CurrentPartLineFound = TRUE;
}
if (CurrentPartLineFound == FALSE)
{
CurrentPartLine++;
}
/* Counts partition description line */
LastLine++;
if (!CurrentPartLineFound)
CurrentPartLine++;
}
if (CurrentPartLineFound == FALSE)
if (!CurrentPartLineFound)
{
for (Entry2 = DiskEntry->LogicalPartListHead.Flink;
Entry2 != &DiskEntry->LogicalPartListHead;
@@ -621,41 +618,36 @@ DrawPartitionList(
{
PartEntry = CONTAINING_RECORD(Entry2, PARTENTRY, ListEntry);
if (PartEntry == ListUi->CurrentPartition)
{
CurrentPartLineFound = TRUE;
}
if (CurrentPartLineFound == FALSE)
{
CurrentPartLine++;
}
/* Counts partition description line */
LastLine++;
if (!CurrentPartLineFound)
CurrentPartLine++;
}
}
if (DiskEntry == ListUi->CurrentDisk)
{
CurrentDiskLineFound = TRUE;
}
/* If next disk entry exists, update current lines */
if (Entry->Flink != &List->DiskListHead)
{
if (CurrentDiskLineFound == FALSE)
LastLine++;
if (!CurrentDiskLineFound)
{
CurrentPartLine++;
CurrentDiskLine = CurrentPartLine;
}
LastLine++;
}
/* Otherwise don't */
else
{
LastLine--;
}
}
/* If it possible, make the disk name visible */
/* If possible, make the disk name visible */
if (CurrentPartLine < ListUi->Offset)
{
ListUi->Offset = CurrentPartLine;
@@ -780,12 +772,12 @@ DrawPartitionList(
coPos,
&Written);
}
coPos.X = ListUi->Right - 2;
FillConsoleOutputCharacterA(StdOutput,
CharHorizontalLine, // '-',
2,
coPos,
&Written);
coPos.X = ListUi->Right - 2;
FillConsoleOutputCharacterA(StdOutput,
CharHorizontalLine, // '-',
2,
coPos,
&Written);
}
/* Draw lower right corner */