[USETUP] Implement CreateProgressBarEx() (#791)
authorBișoc George <fraizeraust99@gmail.com>
Tue, 21 Aug 2018 13:49:54 +0000 (15:49 +0200)
committerHermès BÉLUSCA - MAÏTO <hermes.belusca-maito@reactos.org>
Tue, 21 Aug 2018 13:49:54 +0000 (15:49 +0200)
Improve the progress bar functions:
- Add a member in the struct, which will be used as a bar colour parameter for the new CreateProgressBarEx().
- CreateProgressBar() which will now invoke the Ex variant without the additional parameter.

base/setup/usetup/progress.c
base/setup/usetup/progress.h

index 3aa9e2a..71f9ae9 100644 (file)
@@ -219,7 +219,7 @@ DrawProgressBar(
     for (coPos.Y = Bar->Top + 2; coPos.Y <= Bar->Bottom - 1; coPos.Y++)
     {
         FillConsoleOutputAttribute(StdOutput,
-                                   FOREGROUND_YELLOW | BACKGROUND_BLUE,
+                                   Bar->ProgressColour,
                                    Bar->Width - 2,
                                    coPos,
                                    &Written);
@@ -234,7 +234,7 @@ DrawProgressBar(
 
 
 PPROGRESSBAR
-CreateProgressBar(
+CreateProgressBarEx(
     SHORT Left,
     SHORT Top,
     SHORT Right,
@@ -242,6 +242,7 @@ CreateProgressBar(
     SHORT TextTop,
     SHORT TextRight,
     IN BOOLEAN DoubleEdge,
+    SHORT ProgressColour,
     CHAR *Text)
 {
     PPROGRESSBAR Bar;
@@ -259,6 +260,7 @@ CreateProgressBar(
     Bar->TextTop = TextTop;
     Bar->TextRight = TextRight;
     Bar->Double = DoubleEdge;
+    Bar->ProgressColour = ProgressColour;
     Bar->Text = Text;
 
     Bar->Width = Bar->Right - Bar->Left + 1;
@@ -274,6 +276,25 @@ CreateProgressBar(
     return Bar;
 }
 
+PPROGRESSBAR
+CreateProgressBar(
+    SHORT Left,
+    SHORT Top,
+    SHORT Right,
+    SHORT Bottom,
+    SHORT TextTop,
+    SHORT TextRight,
+    IN BOOLEAN DoubleEdge,
+    CHAR *Text)
+{
+
+    /* Call the Ex variant of the function */
+    return CreateProgressBarEx(Left, Top, Right, Bottom,
+                               TextTop, TextRight,
+                               DoubleEdge,
+                               FOREGROUND_YELLOW | BACKGROUND_BLUE,
+                               Text);
+}
 
 VOID
 DestroyProgressBar(
index 4799225..ee438e9 100644 (file)
@@ -44,11 +44,24 @@ typedef struct _PROGRESS
     ULONG CurrentStep;
 
     BOOLEAN Double;
+    SHORT ProgressColour;
     CHAR *Text;
 } PROGRESSBAR, *PPROGRESSBAR;
 
 /* FUNCTIONS ****************************************************************/
 
+PPROGRESSBAR
+CreateProgressBarEx(
+    SHORT Left,
+    SHORT Top,
+    SHORT Right,
+    SHORT Bottom,
+    SHORT TextTop,
+    SHORT TextRight,
+    IN BOOLEAN DoubleEdge,
+    SHORT ProgressColour,
+    CHAR *Text);
+
 PPROGRESSBAR
 CreateProgressBar(
     SHORT Left,