[USETUP] DrawProgressBar(): Draw the progress bar borders first, then draw its contents.

This commit is contained in:
Hermès Bélusca-Maïto 2018-08-26 16:41:43 +02:00
parent 8f63c209bc
commit 914769a14a
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0

View file

@ -8,7 +8,6 @@
/* FUNCTIONS ****************************************************************/ /* FUNCTIONS ****************************************************************/
static static
VOID VOID
DrawBorder( DrawBorder(
@ -92,7 +91,6 @@ DrawBorder(
&Written); &Written);
} }
static static
VOID VOID
DrawThickBorder( DrawThickBorder(
@ -176,7 +174,6 @@ DrawThickBorder(
&Written); &Written);
} }
static static
VOID VOID
DrawProgressBar( DrawProgressBar(
@ -187,6 +184,22 @@ DrawProgressBar(
DWORD Written; DWORD Written;
PROGRESSBAR BarBorder = *Bar; PROGRESSBAR BarBorder = *Bar;
/* Draw the progress bar "border" border */
if (Bar->Double)
{
BarBorder.Top -= 5;
BarBorder.Bottom += 2;
BarBorder.Right += 5;
BarBorder.Left -= 5;
DrawThickBorder(&BarBorder);
}
/* Draw the progress bar border */
DrawBorder(Bar);
/* Write the text associated with the bar */
CONSOLE_SetTextXY(Bar->TextTop, Bar->TextRight, Bar->Text);
/* Print percentage */ /* Print percentage */
sprintf(TextBuffer, "%-3lu%%", Bar->Percent); sprintf(TextBuffer, "%-3lu%%", Bar->Percent);
@ -198,23 +211,7 @@ DrawProgressBar(
coPos, coPos,
&Written); &Written);
/* Draw the progress bar border */ /* Draw the empty bar */
DrawBorder(Bar);
/* Write Text Associated with Bar */
CONSOLE_SetTextXY(Bar->TextTop, Bar->TextRight, Bar->Text);
/* Draw the progress bar "border" border */
if (Bar->Double)
{
BarBorder.Top -= 5;
BarBorder.Bottom += 2;
BarBorder.Right += 5;
BarBorder.Left -= 5;
DrawThickBorder(&BarBorder);
}
/* Draw the bar */
coPos.X = Bar->Left + 1; coPos.X = Bar->Left + 1;
for (coPos.Y = Bar->Top + 2; coPos.Y <= Bar->Bottom - 1; coPos.Y++) for (coPos.Y = Bar->Top + 2; coPos.Y <= Bar->Bottom - 1; coPos.Y++)
{ {
@ -315,7 +312,6 @@ ProgressSetStepCount(
DrawProgressBar(Bar); DrawProgressBar(Bar);
} }
VOID VOID
ProgressNextStep( ProgressNextStep(
PPROGRESSBAR Bar) PPROGRESSBAR Bar)
@ -323,7 +319,6 @@ ProgressNextStep(
ProgressSetStep(Bar, Bar->CurrentStep + 1); ProgressSetStep(Bar, Bar->CurrentStep + 1);
} }
VOID VOID
ProgressSetStep( ProgressSetStep(
PPROGRESSBAR Bar, PPROGRESSBAR Bar,