Esempio n. 1
0
static
VOID
DrawProgressBar(
    IN PPROGRESSBAR Bar)
{
    COORD coPos;
    DWORD Written;
    PROGRESSBAR BarBorder = *Bar;
    CHAR TextBuffer[256];

    /* Draw the progress bar "border" border */
    if (Bar->DoubleEdge)
    {
        BarBorder.Top -= 5;
        BarBorder.Bottom += 2;
        BarBorder.Right += 5;
        BarBorder.Left -= 5;
        DrawThickBorder(&BarBorder);
    }

    /* Draw the progress bar border */
    DrawBorder(Bar);

    /* Display the description text */
    if (Bar->DescriptionText)
        CONSOLE_SetTextXY(Bar->TextTop, Bar->TextRight, Bar->DescriptionText);

    /* Always update and display the progress */
    if (Bar->UpdateProgressProc &&
        Bar->UpdateProgressProc(Bar, TRUE, TextBuffer, ARRAYSIZE(TextBuffer)))
    {
        coPos.X = Bar->Left + (Bar->Width - strlen(TextBuffer) + 1) / 2;
        coPos.Y = Bar->Top;
        WriteConsoleOutputCharacterA(StdOutput,
                                     TextBuffer,
                                     strlen(TextBuffer),
                                     coPos,
                                     &Written);
    }

    /* Draw the empty bar */
    coPos.X = Bar->Left + 1;
    for (coPos.Y = Bar->Top + 2; coPos.Y <= Bar->Bottom - 1; coPos.Y++)
    {
        FillConsoleOutputAttribute(StdOutput,
                                   Bar->ProgressColour,
                                   Bar->Width - 2,
                                   coPos,
                                   &Written);

        FillConsoleOutputCharacterA(StdOutput,
                                    ' ',
                                    Bar->Width - 2,
                                    coPos,
                                    &Written);
    }
}
Esempio n. 2
0
VOID
DrawFileSystemList(
    IN PFILE_SYSTEM_LIST List)
{
    PLIST_ENTRY ListEntry;
    PFILE_SYSTEM_ITEM Item;
    COORD coPos;
    DWORD Written;
    ULONG Index = 0;
    CHAR Buffer[70];

    ListEntry = List->ListHead.Flink;
    while (ListEntry != &List->ListHead)
    {
        Item = CONTAINING_RECORD(ListEntry, FILE_SYSTEM_ITEM, ListEntry);

        coPos.X = List->Left;
        coPos.Y = List->Top + (SHORT)Index;
        FillConsoleOutputAttribute(StdOutput,
                                   FOREGROUND_WHITE | BACKGROUND_BLUE,
                                   sizeof(Buffer),
                                   coPos,
                                   &Written);
        FillConsoleOutputCharacterA(StdOutput,
                                    ' ',
                                    sizeof(Buffer),
                                    coPos,
                                    &Written);

        if (Item->FileSystemName)
        {
            if (Item->QuickFormat)
                snprintf(Buffer, sizeof(Buffer), MUIGetString(STRING_FORMATDISK1), Item->FileSystemName);
            else
                snprintf(Buffer, sizeof(Buffer), MUIGetString(STRING_FORMATDISK2), Item->FileSystemName);
        }
        else
            snprintf(Buffer, sizeof(Buffer), MUIGetString(STRING_KEEPFORMAT));

        if (ListEntry == &List->Selected->ListEntry)
            CONSOLE_SetInvertedTextXY(List->Left,
                                      List->Top + (SHORT)Index,
                                      Buffer);
        else
            CONSOLE_SetTextXY(List->Left,
                              List->Top + (SHORT)Index,
                              Buffer);
        Index++;
        ListEntry = ListEntry->Flink;
    }
}