ReactOS  0.4.13-dev-99-g7e18b6d
ui.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  tagUI_MENU_INFO
 
struct  tagUIVTBL
 

Macros

#define ATTR(cFore, cBack)   ((cBack << 4)|cFore)
 
#define LIGHT_FILL   0xB0
 
#define MEDIUM_FILL   0xB1
 
#define DARK_FILL   0xB2
 
#define COLOR_BLACK   0
 
#define COLOR_BLUE   1
 
#define COLOR_GREEN   2
 
#define COLOR_CYAN   3
 
#define COLOR_RED   4
 
#define COLOR_MAGENTA   5
 
#define COLOR_BROWN   6
 
#define COLOR_GRAY   7
 
#define COLOR_DARKGRAY   8
 
#define COLOR_LIGHTBLUE   9
 
#define COLOR_LIGHTGREEN   10
 
#define COLOR_LIGHTCYAN   11
 
#define COLOR_LIGHTRED   12
 
#define COLOR_LIGHTMAGENTA   13
 
#define COLOR_YELLOW   14
 
#define COLOR_WHITE   15
 
#define HORZ   (0xc4) /* Single horizontal line */
 
#define D_HORZ   (0xcd) /* Double horizontal line.*/
 
#define VERT   (0xb3) /* Single vertical line */
 
#define D_VERT   (0xba) /* Double vertical line. */
 

Typedefs

typedef struct tagUI_MENU_INFO UI_MENU_INFO
 
typedef struct tagUI_MENU_INFOPUI_MENU_INFO
 
typedef BOOLEAN(* UiMenuKeyPressFilterCallback) (ULONG KeyPress)
 
typedef struct tagUIVTBL UIVTBL
 
typedef struct tagUIVTBLPUIVTBL
 

Functions

BOOLEAN UiInitialize (BOOLEAN ShowGui)
 
VOID UiUnInitialize (PCSTR BootText)
 
VOID UiDrawBackdrop (VOID)
 
VOID UiFillArea (ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, CHAR FillChar, UCHAR Attr)
 
VOID UiDrawShadow (ULONG Left, ULONG Top, ULONG Right, ULONG Bottom)
 
VOID UiDrawBox (ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR VertStyle, UCHAR HorzStyle, BOOLEAN Fill, BOOLEAN Shadow, UCHAR Attr)
 
VOID UiDrawText (ULONG X, ULONG Y, PCSTR Text, UCHAR Attr)
 
VOID UiDrawText2 (ULONG X, ULONG Y, ULONG MaxNumChars, PCSTR Text, UCHAR Attr)
 
VOID UiDrawCenteredText (ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, PCSTR TextString, UCHAR Attr)
 
VOID UiDrawStatusText (PCSTR StatusText)
 
VOID UiUpdateDateTime (VOID)
 
VOID UiInfoBox (PCSTR MessageText)
 
VOID UiMessageBox (PCSTR Format,...)
 
VOID UiMessageBoxCritical (PCSTR MessageText)
 
VOID UiDrawProgressBarCenter (ULONG Position, ULONG Range, PCHAR ProgressText)
 
VOID UiDrawProgressBar (ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, ULONG Position, ULONG Range, PCHAR ProgressText)
 
VOID UiShowMessageBoxesInSection (PCSTR SectionName)
 
VOID UiEscapeString (PCHAR String)
 
BOOLEAN UiEditBox (PCSTR MessageText, PCHAR EditTextBuffer, ULONG Length)
 
UCHAR UiTextToColor (PCSTR ColorText)
 
UCHAR UiTextToFillStyle (PCSTR FillStyleText)
 
VOID UiTruncateStringEllipsis (PCHAR StringText, ULONG MaxChars)
 
VOID UiFadeInBackdrop (VOID)
 
VOID UiFadeOut (VOID)
 
BOOLEAN UiDisplayMenu (PCSTR MenuHeader, PCSTR MenuFooter, BOOLEAN ShowBootOptions, PCSTR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG *SelectedMenuItem, BOOLEAN CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter)
 
VOID UiInit (const char *CmdLine)
 

Variables

ULONG UiScreenWidth
 
ULONG UiScreenHeight
 
UCHAR UiStatusBarFgColor
 
UCHAR UiStatusBarBgColor
 
UCHAR UiBackdropFgColor
 
UCHAR UiBackdropBgColor
 
UCHAR UiBackdropFillStyle
 
UCHAR UiTitleBoxFgColor
 
UCHAR UiTitleBoxBgColor
 
UCHAR UiMessageBoxFgColor
 
UCHAR UiMessageBoxBgColor
 
UCHAR UiMenuFgColor
 
UCHAR UiMenuBgColor
 
UCHAR UiTextColor
 
UCHAR UiSelectedTextColor
 
UCHAR UiSelectedTextBgColor
 
UCHAR UiEditBoxTextColor
 
UCHAR UiEditBoxBgColor
 
CHAR UiTitleBoxTitleText [260]
 
BOOLEAN UiUseSpecialEffects
 
BOOLEAN UiCenterMenu
 
BOOLEAN UiMenuBox
 
CHAR UiTimeText []
 
BOOLEAN UiDrawTime
 
const CHAR UiMonthNames [12][15]
 
UIVTBL UiVtbl
 

Macro Definition Documentation

◆ ATTR

#define ATTR (   cFore,
  cBack 
)    ((cBack << 4)|cFore)

Definition at line 152 of file ui.h.

◆ COLOR_BLACK

#define COLOR_BLACK   0

Definition at line 164 of file ui.h.

◆ COLOR_BLUE

#define COLOR_BLUE   1

Definition at line 165 of file ui.h.

◆ COLOR_BROWN

#define COLOR_BROWN   6

Definition at line 170 of file ui.h.

◆ COLOR_CYAN

#define COLOR_CYAN   3

Definition at line 167 of file ui.h.

◆ COLOR_DARKGRAY

#define COLOR_DARKGRAY   8

Definition at line 173 of file ui.h.

◆ COLOR_GRAY

#define COLOR_GRAY   7

Definition at line 171 of file ui.h.

◆ COLOR_GREEN

#define COLOR_GREEN   2

Definition at line 166 of file ui.h.

◆ COLOR_LIGHTBLUE

#define COLOR_LIGHTBLUE   9

Definition at line 174 of file ui.h.

◆ COLOR_LIGHTCYAN

#define COLOR_LIGHTCYAN   11

Definition at line 176 of file ui.h.

◆ COLOR_LIGHTGREEN

#define COLOR_LIGHTGREEN   10

Definition at line 175 of file ui.h.

◆ COLOR_LIGHTMAGENTA

#define COLOR_LIGHTMAGENTA   13

Definition at line 178 of file ui.h.

◆ COLOR_LIGHTRED

#define COLOR_LIGHTRED   12

Definition at line 177 of file ui.h.

◆ COLOR_MAGENTA

#define COLOR_MAGENTA   5

Definition at line 169 of file ui.h.

◆ COLOR_RED

#define COLOR_RED   4

Definition at line 168 of file ui.h.

◆ COLOR_WHITE

#define COLOR_WHITE   15

Definition at line 180 of file ui.h.

◆ COLOR_YELLOW

#define COLOR_YELLOW   14

Definition at line 179 of file ui.h.

◆ D_HORZ

#define D_HORZ   (0xcd) /* Double horizontal line.*/

Definition at line 189 of file ui.h.

◆ D_VERT

#define D_VERT   (0xba) /* Double vertical line. */

Definition at line 191 of file ui.h.

◆ DARK_FILL

#define DARK_FILL   0xB2

Definition at line 159 of file ui.h.

◆ HORZ

#define HORZ   (0xc4) /* Single horizontal line */

Definition at line 188 of file ui.h.

◆ LIGHT_FILL

#define LIGHT_FILL   0xB0

Definition at line 157 of file ui.h.

◆ MEDIUM_FILL

#define MEDIUM_FILL   0xB1

Definition at line 158 of file ui.h.

◆ VERT

#define VERT   (0xb3) /* Single vertical line */

Definition at line 190 of file ui.h.

Typedef Documentation

◆ PUI_MENU_INFO

◆ PUIVTBL

◆ UI_MENU_INFO

◆ UiMenuKeyPressFilterCallback

typedef BOOLEAN(* UiMenuKeyPressFilterCallback) (ULONG KeyPress)

Definition at line 108 of file ui.h.

◆ UIVTBL

Function Documentation

◆ UiDisplayMenu()

BOOLEAN UiDisplayMenu ( PCSTR  MenuHeader,
PCSTR  MenuFooter,
BOOLEAN  ShowBootOptions,
PCSTR  MenuItemList[],
ULONG  MenuItemCount,
ULONG  DefaultMenuItem,
LONG  MenuTimeOut,
ULONG SelectedMenuItem,
BOOLEAN  CanEscape,
UiMenuKeyPressFilterCallback  KeyPressFilter 
)

Definition at line 459 of file ui.c.

460 {
461  return UiVtbl.DisplayMenu(MenuHeader, MenuFooter, ShowBootOptions, MenuItemList, MenuItemCount, DefaultMenuItem, MenuTimeOut, SelectedMenuItem, CanEscape, KeyPressFilter);
462 }
UIVTBL UiVtbl
Definition: ui.c:58
BOOLEAN(* DisplayMenu)(PCSTR MenuHeader, PCSTR MenuFooter, BOOLEAN ShowBootOptions, PCSTR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG *SelectedMenuItem, BOOLEAN CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter)
Definition: ui.h:141

Referenced by DoOptionsMenu(), OptionMenuCustomBoot(), and RunLoader().

◆ UiDrawBackdrop()

VOID UiDrawBackdrop ( VOID  )

◆ UiDrawBox()

VOID UiDrawBox ( ULONG  Left,
ULONG  Top,
ULONG  Right,
ULONG  Bottom,
UCHAR  VertStyle,
UCHAR  HorzStyle,
BOOLEAN  Fill,
BOOLEAN  Shadow,
UCHAR  Attr 
)

Definition at line 256 of file ui.c.

257 {
258  UiVtbl.DrawBox(Left, Top, Right, Bottom, VertStyle, HorzStyle, Fill, Shadow, Attr);
259 }
void Fill(HDC hdc, LONG x, LONG y, COLORREF color)
Definition: drawing.cpp:109
UIVTBL UiVtbl
Definition: ui.c:58
VOID(* DrawBox)(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR VertStyle, UCHAR HorzStyle, BOOLEAN Fill, BOOLEAN Shadow, UCHAR Attr)
Definition: ui.h:125
static LPHIST_ENTRY Bottom
Definition: history.c:54
static LPHIST_ENTRY Top
Definition: history.c:53

Referenced by TuiDrawMenuBox(), and UiInfoBox().

◆ UiDrawCenteredText()

VOID UiDrawCenteredText ( ULONG  Left,
ULONG  Top,
ULONG  Right,
ULONG  Bottom,
PCSTR  TextString,
UCHAR  Attr 
)

Definition at line 271 of file ui.c.

272 {
273  UiVtbl.DrawCenteredText(Left, Top, Right, Bottom, TextString, Attr);
274 }
UIVTBL UiVtbl
Definition: ui.c:58
static LPHIST_ENTRY Bottom
Definition: history.c:54
VOID(* DrawCenteredText)(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, PCSTR TextString, UCHAR Attr)
Definition: ui.h:128
static LPHIST_ENTRY Top
Definition: history.c:53

Referenced by UiInfoBox().

◆ UiDrawProgressBar()

VOID UiDrawProgressBar ( ULONG  Left,
ULONG  Top,
ULONG  Right,
ULONG  Bottom,
ULONG  Position,
ULONG  Range,
PCHAR  ProgressText 
)

Definition at line 378 of file ui.c.

379 {
380  UiVtbl.DrawProgressBar(Left, Top, Right, Bottom, Position, Range, ProgressText);
381 }
static COORD Position
Definition: mouse.c:34
UIVTBL UiVtbl
Definition: ui.c:58
Definition: range.c:43
static LPHIST_ENTRY Bottom
Definition: history.c:54
VOID(* DrawProgressBar)(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, ULONG Position, ULONG Range, PCHAR ProgressText)
Definition: ui.h:134
static LPHIST_ENTRY Top
Definition: history.c:53

◆ UiDrawProgressBarCenter()

VOID UiDrawProgressBarCenter ( ULONG  Position,
ULONG  Range,
PCHAR  ProgressText 
)

Definition at line 373 of file ui.c.

374 {
375  UiVtbl.DrawProgressBarCenter(Position, Range, ProgressText);
376 }
static COORD Position
Definition: mouse.c:34
VOID(* DrawProgressBarCenter)(ULONG Position, ULONG Range, PCHAR ProgressText)
Definition: ui.h:133
UIVTBL UiVtbl
Definition: ui.c:58
Definition: range.c:43

Referenced by LoadAndBootWindows(), LoadAndBootWindowsCommon(), LoadModule(), LoadReactOSSetup(), and RamDiskLoadVirtualFile().

◆ UiDrawShadow()

VOID UiDrawShadow ( ULONG  Left,
ULONG  Top,
ULONG  Right,
ULONG  Bottom 
)

Definition at line 251 of file ui.c.

252 {
253  UiVtbl.DrawShadow(Left, Top, Right, Bottom);
254 }
UIVTBL UiVtbl
Definition: ui.c:58
VOID(* DrawShadow)(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom)
Definition: ui.h:124
static LPHIST_ENTRY Bottom
Definition: history.c:54
static LPHIST_ENTRY Top
Definition: history.c:53

◆ UiDrawStatusText()

VOID UiDrawStatusText ( PCSTR  StatusText)

Definition at line 276 of file ui.c.

277 {
278  UiVtbl.DrawStatusText(StatusText);
279 }
UIVTBL UiVtbl
Definition: ui.c:58
VOID(* DrawStatusText)(PCSTR StatusText)
Definition: ui.h:129

Referenced by LoadReactOSSetup(), TuiEditBox(), TuiMessageBoxCritical(), UiUnInitialize(), and WinLdrSetupEms().

◆ UiDrawText()

VOID UiDrawText ( ULONG  X,
ULONG  Y,
PCSTR  Text,
UCHAR  Attr 
)

Definition at line 261 of file ui.c.

262 {
263  UiVtbl.DrawText(X, Y, Text, Attr);
264 }
#define Y(I)
VOID(* DrawText)(ULONG X, ULONG Y, PCSTR Text, UCHAR Attr)
Definition: ui.h:126
UIVTBL UiVtbl
Definition: ui.c:58
char * Text
Definition: combotst.c:136

Referenced by DisplayBootTimeOptions(), TuiDrawMenuBox(), TuiDrawMenuItem(), TuiEditBox(), and TuiMessageBoxCritical().

◆ UiDrawText2()

VOID UiDrawText2 ( ULONG  X,
ULONG  Y,
ULONG  MaxNumChars,
PCSTR  Text,
UCHAR  Attr 
)

Definition at line 266 of file ui.c.

267 {
268  UiVtbl.DrawText2(X, Y, MaxNumChars, Text, Attr);
269 }
#define Y(I)
UIVTBL UiVtbl
Definition: ui.c:58
VOID(* DrawText2)(ULONG X, ULONG Y, ULONG MaxNumChars, PCSTR Text, UCHAR Attr)
Definition: ui.h:127
char * Text
Definition: combotst.c:136

Referenced by TuiEditBox().

◆ UiEditBox()

BOOLEAN UiEditBox ( PCSTR  MessageText,
PCHAR  EditTextBuffer,
ULONG  Length 
)

Definition at line 474 of file ui.c.

475 {
476  return UiVtbl.EditBox(MessageText, EditTextBuffer, Length);
477 }
UIVTBL UiVtbl
Definition: ui.c:58
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
BOOLEAN(* EditBox)(PCSTR MessageText, PCHAR EditTextBuffer, ULONG Length)
Definition: ui.h:135

Referenced by DoOptionsMenu(), and OptionMenuCustomBootReactOS().

◆ UiEscapeString()

VOID UiEscapeString ( PCHAR  String)

Definition at line 433 of file ui.c.

434 {
435  ULONG Idx;
436 
437  for (Idx=0; Idx<strlen(String); Idx++)
438  {
439  // Escape the new line characters
440  if (String[Idx] == '\\' && String[Idx+1] == 'n')
441  {
442  // Escape the character
443  String[Idx] = '\n';
444 
445  // Move the rest of the string up
446  strcpy(&String[Idx+1], &String[Idx+2]);
447  }
448  }
449 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
static WCHAR String[]
Definition: stringtable.c:55
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
unsigned int ULONG
Definition: retypes.h:1

Referenced by UiShowMessageBoxesInSection().

◆ UiFadeInBackdrop()

VOID UiFadeInBackdrop ( VOID  )

Definition at line 464 of file ui.c.

465 {
467 }
VOID(* FadeInBackdrop)(VOID)
Definition: ui.h:138
UIVTBL UiVtbl
Definition: ui.c:58

Referenced by UiInitialize().

◆ UiFadeOut()

VOID UiFadeOut ( VOID  )

Definition at line 469 of file ui.c.

470 {
471  UiVtbl.FadeOut();
472 }
UIVTBL UiVtbl
Definition: ui.c:58
VOID(* FadeOut)(VOID)
Definition: ui.h:139

◆ UiFillArea()

VOID UiFillArea ( ULONG  Left,
ULONG  Top,
ULONG  Right,
ULONG  Bottom,
CHAR  FillChar,
UCHAR  Attr 
)

Definition at line 246 of file ui.c.

247 {
248  UiVtbl.FillArea(Left, Top, Right, Bottom, FillChar, Attr);
249 }
UIVTBL UiVtbl
Definition: ui.c:58
VOID(* FillArea)(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, CHAR FillChar, UCHAR Attr)
Definition: ui.h:123
static LPHIST_ENTRY Bottom
Definition: history.c:54
static LPHIST_ENTRY Top
Definition: history.c:53

Referenced by TuiEditBox().

◆ UiInfoBox()

VOID UiInfoBox ( PCSTR  MessageText)

Definition at line 286 of file ui.c.

287 {
288  SIZE_T TextLength;
289  ULONG BoxWidth;
290  ULONG BoxHeight;
291  ULONG LineBreakCount;
292  SIZE_T Index;
293  SIZE_T LastIndex;
294  ULONG Left;
295  ULONG Top;
296  ULONG Right;
297  ULONG Bottom;
298 
299  TextLength = strlen(MessageText);
300 
301  // Count the new lines and the box width
302  LineBreakCount = 0;
303  BoxWidth = 0;
304  LastIndex = 0;
305  for (Index=0; Index<TextLength; Index++)
306  {
307  if (MessageText[Index] == '\n')
308  {
309  LastIndex = Index;
310  LineBreakCount++;
311  }
312  else
313  {
314  if ((Index - LastIndex) > BoxWidth)
315  {
316  BoxWidth = (ULONG)(Index - LastIndex);
317  }
318  }
319  }
320 
321  // Calc the box width & height
322  BoxWidth += 6;
323  BoxHeight = LineBreakCount + 4;
324 
325  // Calc the box coordinates
326  Left = (UiScreenWidth / 2) - (BoxWidth / 2);
327  Top =(UiScreenHeight / 2) - (BoxHeight / 2);
328  Right = (UiScreenWidth / 2) + (BoxWidth / 2);
329  Bottom = (UiScreenHeight / 2) + (BoxHeight / 2);
330 
331  // Draw the box
332  UiDrawBox(Left,
333  Top,
334  Right,
335  Bottom,
336  VERT,
337  HORZ,
338  TRUE,
339  TRUE,
341  );
342 
343  // Draw the text
344  UiDrawCenteredText(Left, Top, Right, Bottom, MessageText, ATTR(UiTextColor, UiMenuBgColor));
345 }
#define TRUE
Definition: types.h:120
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define HORZ
Definition: ui.h:188
ULONG UiScreenWidth
Definition: ui.c:28
#define ATTR(cFore, cBack)
Definition: ui.h:152
UCHAR UiTextColor
Definition: ui.c:42
VOID UiDrawBox(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR VertStyle, UCHAR HorzStyle, BOOLEAN Fill, BOOLEAN Shadow, UCHAR Attr)
Definition: ui.c:256
static const UCHAR Index[8]
Definition: usbohci.c:18
VOID UiDrawCenteredText(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, PCSTR TextString, UCHAR Attr)
Definition: ui.c:271
ULONG UiScreenHeight
Definition: ui.c:29
UCHAR UiMenuBgColor
Definition: ui.c:41
ULONG_PTR SIZE_T
Definition: typedefs.h:78
static LPHIST_ENTRY Bottom
Definition: history.c:54
UCHAR UiMenuFgColor
Definition: ui.c:40
unsigned int ULONG
Definition: retypes.h:1
static LPHIST_ENTRY Top
Definition: history.c:53
#define VERT
Definition: ui.h:190

Referenced by UiUnInitialize().

◆ UiInit()

VOID UiInit ( const char CmdLine)

◆ UiInitialize()

BOOLEAN UiInitialize ( BOOLEAN  ShowGui)

Definition at line 84 of file ui.c.

85 {
86  VIDEODISPLAYMODE UiDisplayMode; // Tells us if we are in text or graphics mode
87  BOOLEAN UiMinimal = FALSE; // Tells us if we are using a minimal console-like UI
88  ULONG_PTR SectionId;
89  CHAR DisplayModeText[260];
90  CHAR SettingText[260];
91  ULONG Depth;
92 
93  if (!ShowGui)
94  {
95  if (!UiVtbl.Initialize())
96  {
98  return FALSE;
99  }
100  return TRUE;
101  }
102 
103  TRACE("Initializing User Interface.\n");
104  TRACE("Reading in UI settings from [Display] section.\n");
105 
106  DisplayModeText[0] = '\0';
107  if (IniOpenSection("Display", &SectionId))
108  {
109  if (!IniReadSettingByName(SectionId, "DisplayMode", DisplayModeText, sizeof(DisplayModeText)))
110  {
111  DisplayModeText[0] = '\0';
112  }
113  if (IniReadSettingByName(SectionId, "MinimalUI", SettingText, sizeof(SettingText)))
114  {
115  UiMinimal = (_stricmp(SettingText, "Yes") == 0 && strlen(SettingText) == 3);
116  }
117  }
118 
119  UiDisplayMode = MachVideoSetDisplayMode(DisplayModeText, TRUE);
121 
122  if (VideoTextMode == UiDisplayMode)
123  UiVtbl = (UiMinimal ? MiniTuiVtbl : TuiVtbl);
124  else
125  UiVtbl = GuiVtbl;
126 
127  if (!UiVtbl.Initialize())
128  {
130  return FALSE;
131  }
132 
133  if (IniOpenSection("Display", &SectionId))
134  {
135  if (IniReadSettingByName(SectionId, "TitleText", SettingText, sizeof(SettingText)))
136  {
137  strcpy(UiTitleBoxTitleText, SettingText);
138  }
139  if (IniReadSettingByName(SectionId, "TimeText", SettingText, sizeof(SettingText)))
140  {
141  strcpy(UiTimeText, SettingText);
142  }
143  if (IniReadSettingByName(SectionId, "StatusBarColor", SettingText, sizeof(SettingText)))
144  {
145  UiStatusBarBgColor = UiTextToColor(SettingText);
146  }
147  if (IniReadSettingByName(SectionId, "StatusBarTextColor", SettingText, sizeof(SettingText)))
148  {
149  UiStatusBarFgColor = UiTextToColor(SettingText);
150  }
151  if (IniReadSettingByName(SectionId, "BackdropTextColor", SettingText, sizeof(SettingText)))
152  {
153  UiBackdropFgColor = UiTextToColor(SettingText);
154  }
155  if (IniReadSettingByName(SectionId, "BackdropColor", SettingText, sizeof(SettingText)))
156  {
157  UiBackdropBgColor = UiTextToColor(SettingText);
158  }
159  if (IniReadSettingByName(SectionId, "BackdropFillStyle", SettingText, sizeof(SettingText)))
160  {
161  UiBackdropFillStyle = UiTextToFillStyle(SettingText);
162  }
163  if (IniReadSettingByName(SectionId, "TitleBoxTextColor", SettingText, sizeof(SettingText)))
164  {
165  UiTitleBoxFgColor = UiTextToColor(SettingText);
166  }
167  if (IniReadSettingByName(SectionId, "TitleBoxColor", SettingText, sizeof(SettingText)))
168  {
169  UiTitleBoxBgColor = UiTextToColor(SettingText);
170  }
171  if (IniReadSettingByName(SectionId, "MessageBoxTextColor", SettingText, sizeof(SettingText)))
172  {
173  UiMessageBoxFgColor = UiTextToColor(SettingText);
174  }
175  if (IniReadSettingByName(SectionId, "MessageBoxColor", SettingText, sizeof(SettingText)))
176  {
177  UiMessageBoxBgColor = UiTextToColor(SettingText);
178  }
179  if (IniReadSettingByName(SectionId, "MenuTextColor", SettingText, sizeof(SettingText)))
180  {
181  UiMenuFgColor = UiTextToColor(SettingText);
182  }
183  if (IniReadSettingByName(SectionId, "MenuColor", SettingText, sizeof(SettingText)))
184  {
185  UiMenuBgColor = UiTextToColor(SettingText);
186  }
187  if (IniReadSettingByName(SectionId, "TextColor", SettingText, sizeof(SettingText)))
188  {
189  UiTextColor = UiTextToColor(SettingText);
190  }
191  if (IniReadSettingByName(SectionId, "SelectedTextColor", SettingText, sizeof(SettingText)))
192  {
193  UiSelectedTextColor = UiTextToColor(SettingText);
194  }
195  if (IniReadSettingByName(SectionId, "SelectedColor", SettingText, sizeof(SettingText)))
196  {
197  UiSelectedTextBgColor = UiTextToColor(SettingText);
198  }
199  if (IniReadSettingByName(SectionId, "EditBoxTextColor", SettingText, sizeof(SettingText)))
200  {
201  UiEditBoxTextColor = UiTextToColor(SettingText);
202  }
203  if (IniReadSettingByName(SectionId, "EditBoxColor", SettingText, sizeof(SettingText)))
204  {
205  UiEditBoxBgColor = UiTextToColor(SettingText);
206  }
207  if (IniReadSettingByName(SectionId, "SpecialEffects", SettingText, sizeof(SettingText)))
208  {
209  UiUseSpecialEffects = (_stricmp(SettingText, "Yes") == 0 && strlen(SettingText) == 3);
210  }
211  if (IniReadSettingByName(SectionId, "ShowTime", SettingText, sizeof(SettingText)))
212  {
213  UiDrawTime = (_stricmp(SettingText, "Yes") == 0 && strlen(SettingText) == 3);
214  }
215  if (IniReadSettingByName(SectionId, "MenuBox", SettingText, sizeof(SettingText)))
216  {
217  UiMenuBox = (_stricmp(SettingText, "Yes") == 0 && strlen(SettingText) == 3);
218  }
219  if (IniReadSettingByName(SectionId, "CenterMenu", SettingText, sizeof(SettingText)))
220  {
221  UiCenterMenu = (_stricmp(SettingText, "Yes") == 0 && strlen(SettingText) == 3);
222  }
223  }
224 
225  // Draw the backdrop and fade it in if special effects are enabled
227 
228  TRACE("UiInitialize() returning TRUE.\n");
229  return TRUE;
230 }
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION _In_ ULONG _In_ SIZE_T _In_ ULONG _In_ USHORT Depth
Definition: exfuncs.h:656
const UIVTBL GuiVtbl
Definition: gui.c:85
#define TRUE
Definition: types.h:120
UCHAR UiStatusBarFgColor
Definition: ui.c:31
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
const UIVTBL MiniTuiVtbl
Definition: minitui.c:137
CHAR UiTimeText[260]
Definition: ui.c:54
UCHAR UiEditBoxTextColor
Definition: ui.c:45
#define MachVideoGetDisplaySize(W, H, D)
Definition: machine.h:94
char CHAR
Definition: xmlstorage.h:175
UCHAR UiMessageBoxBgColor
Definition: ui.c:39
UCHAR UiTitleBoxFgColor
Definition: ui.c:36
BOOLEAN UiCenterMenu
Definition: ui.c:52
#define _stricmp
Definition: cat.c:22
UCHAR UiMessageBoxFgColor
Definition: ui.c:38
UCHAR UiBackdropFgColor
Definition: ui.c:33
uint32_t ULONG_PTR
Definition: typedefs.h:63
BOOLEAN UiMenuBox
Definition: ui.c:53
UCHAR UiTextToFillStyle(PCSTR FillStyleText)
Definition: ui.c:368
ULONG UiScreenWidth
Definition: ui.c:28
VOID UiFadeInBackdrop(VOID)
Definition: ui.c:464
UCHAR UiTitleBoxBgColor
Definition: ui.c:37
UIVTBL UiVtbl
Definition: ui.c:58
UCHAR UiStatusBarBgColor
Definition: ui.c:32
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
BOOLEAN UiUseSpecialEffects
Definition: ui.c:50
BOOLEAN UiDrawTime
Definition: ui.c:51
UCHAR UiTextColor
Definition: ui.c:42
BOOLEAN IniReadSettingByName(ULONG_PTR SectionId, PCSTR SettingName, PCHAR Buffer, ULONG BufferSize)
Definition: inifile.c:147
#define TRACE(s)
Definition: solgame.cpp:4
BOOLEAN(* Initialize)(VOID)
Definition: ui.h:119
BOOLEAN IniOpenSection(PCSTR SectionName, ULONG_PTR *SectionId)
Definition: inifile.c:25
UCHAR UiSelectedTextBgColor
Definition: ui.c:44
UCHAR UiBackdropFillStyle
Definition: ui.c:35
UCHAR UiBackdropBgColor
Definition: ui.c:34
ULONG UiScreenHeight
Definition: ui.c:29
enum tagVIDEODISPLAYMODE VIDEODISPLAYMODE
UCHAR UiMenuBgColor
Definition: ui.c:41
CHAR UiTitleBoxTitleText[260]
Definition: ui.c:48
UCHAR UiTextToColor(PCSTR ColorText)
Definition: ui.c:363
#define MachVideoSetDisplayMode(Mode, Init)
Definition: machine.h:92
UCHAR UiMenuFgColor
Definition: ui.c:40
UCHAR UiSelectedTextColor
Definition: ui.c:43
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
unsigned int ULONG
Definition: retypes.h:1
const UIVTBL TuiVtbl
Definition: tui.c:1044
UCHAR UiEditBoxBgColor
Definition: ui.c:46

Referenced by BootMain(), and RunLoader().

◆ UiMessageBox()

VOID UiMessageBox ( PCSTR  Format,
  ... 
)

◆ UiMessageBoxCritical()

VOID UiMessageBoxCritical ( PCSTR  MessageText)

Definition at line 358 of file ui.c.

359 {
360  UiVtbl.MessageBoxCritical(MessageText);
361 }
UIVTBL UiVtbl
Definition: ui.c:58
VOID(* MessageBoxCritical)(PCSTR MessageText)
Definition: ui.h:132

Referenced by BootMain(), IniFileInitialize(), KeBugCheckEx(), MmAllocateHighestMemoryBelowAddress(), MmAllocateMemoryAtAddress(), MmAllocateMemoryWithType(), and RunLoader().

◆ UiShowMessageBoxesInSection()

VOID UiShowMessageBoxesInSection ( PCSTR  SectionName)

Definition at line 383 of file ui.c.

384 {
385  ULONG Idx;
386  CHAR SettingName[80];
387  CHAR SettingValue[80];
388  PCHAR MessageBoxText;
389  ULONG MessageBoxTextSize;
390  ULONG_PTR SectionId;
391 
392  if (!IniOpenSection(SectionName, &SectionId))
393  {
394  return;
395  }
396 
397  //
398  // Find all the message box settings and run them
399  //
400  for (Idx=0; Idx<IniGetNumSectionItems(SectionId); Idx++)
401  {
402  IniReadSettingByNumber(SectionId, Idx, SettingName, sizeof(SettingName), SettingValue, sizeof(SettingValue));
403 
404  if (_stricmp(SettingName, "MessageBox") == 0)
405  {
406  // Get the real length of the MessageBox text
407  MessageBoxTextSize = IniGetSectionSettingValueSize(SectionId, Idx);
408 
409  //if (MessageBoxTextSize > 0)
410  {
411  // Allocate enough memory to hold the text
412  MessageBoxText = FrLdrTempAlloc(MessageBoxTextSize, TAG_UI_TEXT);
413 
414  if (MessageBoxText)
415  {
416  // Get the MessageBox text
417  IniReadSettingByNumber(SectionId, Idx, SettingName, sizeof(SettingName), MessageBoxText, MessageBoxTextSize);
418 
419  // Fix it up
420  UiEscapeString(MessageBoxText);
421 
422  // Display it
423  UiMessageBox(MessageBoxText);
424 
425  // Free the memory
426  FrLdrTempFree(MessageBoxText, TAG_UI_TEXT);
427  }
428  }
429  }
430  }
431 }
signed char * PCHAR
Definition: retypes.h:7
VOID UiEscapeString(PCHAR String)
Definition: ui.c:433
char CHAR
Definition: xmlstorage.h:175
#define _stricmp
Definition: cat.c:22
uint32_t ULONG_PTR
Definition: typedefs.h:63
FORCEINLINE PVOID FrLdrTempAlloc(_In_ SIZE_T Size, _In_ ULONG Tag)
Definition: mm.h:177
BOOLEAN IniOpenSection(PCSTR SectionName, ULONG_PTR *SectionId)
Definition: inifile.c:25
ULONG IniGetSectionSettingValueSize(ULONG_PTR SectionId, ULONG SettingIndex)
Definition: inifile.c:101
#define TAG_UI_TEXT
Definition: ui.c:24
VOID UiMessageBox(PCSTR Format,...)
Definition: ui.c:347
unsigned int ULONG
Definition: retypes.h:1
ULONG IniGetNumSectionItems(ULONG_PTR SectionId)
Definition: inifile.c:54
BOOLEAN IniReadSettingByNumber(ULONG_PTR SectionId, ULONG SettingNumber, PCHAR SettingName, ULONG NameSize, PCHAR SettingValue, ULONG ValueSize)
Definition: inifile.c:114
FORCEINLINE VOID FrLdrTempFree(PVOID Allocation, ULONG Tag)
Definition: mm.h:186

Referenced by RunLoader().

◆ UiTextToColor()

UCHAR UiTextToColor ( PCSTR  ColorText)

Definition at line 363 of file ui.c.

364 {
365  return UiVtbl.TextToColor(ColorText);
366 }
UCHAR(* TextToColor)(PCSTR ColorText)
Definition: ui.h:136
UIVTBL UiVtbl
Definition: ui.c:58

Referenced by UiInitialize().

◆ UiTextToFillStyle()

UCHAR UiTextToFillStyle ( PCSTR  FillStyleText)

Definition at line 368 of file ui.c.

369 {
370  return UiVtbl.TextToFillStyle(FillStyleText);
371 }
UIVTBL UiVtbl
Definition: ui.c:58
UCHAR(* TextToFillStyle)(PCSTR FillStyleText)
Definition: ui.h:137

Referenced by UiInitialize().

◆ UiTruncateStringEllipsis()

VOID UiTruncateStringEllipsis ( PCHAR  StringText,
ULONG  MaxChars 
)

Definition at line 451 of file ui.c.

452 {
453  if (strlen(StringText) > MaxChars)
454  {
455  strcpy(&StringText[MaxChars - 3], "...");
456  }
457 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388

Referenced by MiniTuiDrawProgressBar(), and TuiDrawProgressBar().

◆ UiUnInitialize()

VOID UiUnInitialize ( PCSTR  BootText)

Definition at line 232 of file ui.c.

233 {
234  UiDrawBackdrop();
235  UiDrawStatusText(BootText);
236  UiInfoBox(BootText);
237 
239 }
VOID UiInfoBox(PCSTR MessageText)
Definition: ui.c:286
UIVTBL UiVtbl
Definition: ui.c:58
VOID UiDrawStatusText(PCSTR StatusText)
Definition: ui.c:276
VOID UiDrawBackdrop(VOID)
Definition: ui.c:241
VOID(* UnInitialize)(VOID)
Definition: ui.h:120

Referenced by RunLoader().

◆ UiUpdateDateTime()

VOID UiUpdateDateTime ( VOID  )

Definition at line 281 of file ui.c.

282 {
284 }
UIVTBL UiVtbl
Definition: ui.c:58
VOID(* UpdateDateTime)(VOID)
Definition: ui.h:130

Variable Documentation

◆ UiBackdropBgColor

UCHAR UiBackdropBgColor

Definition at line 34 of file ui.c.

Referenced by TuiDrawBackdrop(), and UiInitialize().

◆ UiBackdropFgColor

UCHAR UiBackdropFgColor

Definition at line 33 of file ui.c.

Referenced by TuiDrawBackdrop(), and UiInitialize().

◆ UiBackdropFillStyle

UCHAR UiBackdropFillStyle

Definition at line 35 of file ui.c.

Referenced by TuiDrawBackdrop(), and UiInitialize().

◆ UiCenterMenu

BOOLEAN UiCenterMenu

Definition at line 52 of file ui.c.

Referenced by TuiCalcMenuBoxSize(), TuiDrawMenuBox(), TuiDrawMenuItem(), and UiInitialize().

◆ UiDrawTime

BOOLEAN UiDrawTime

Definition at line 51 of file ui.c.

Referenced by TuiUpdateDateTime(), and UiInitialize().

◆ UiEditBoxBgColor

UCHAR UiEditBoxBgColor

Definition at line 46 of file ui.c.

Referenced by TuiEditBox(), and UiInitialize().

◆ UiEditBoxTextColor

UCHAR UiEditBoxTextColor

Definition at line 45 of file ui.c.

Referenced by TuiEditBox(), and UiInitialize().

◆ UiMenuBgColor

◆ UiMenuBox

BOOLEAN UiMenuBox

Definition at line 53 of file ui.c.

Referenced by TuiDrawMenuBox(), and UiInitialize().

◆ UiMenuFgColor

UCHAR UiMenuFgColor

◆ UiMessageBoxBgColor

UCHAR UiMessageBoxBgColor

Definition at line 39 of file ui.c.

Referenced by TuiEditBox(), TuiMessageBoxCritical(), and UiInitialize().

◆ UiMessageBoxFgColor

UCHAR UiMessageBoxFgColor

Definition at line 38 of file ui.c.

Referenced by TuiEditBox(), TuiMessageBoxCritical(), and UiInitialize().

◆ UiMonthNames

const CHAR UiMonthNames[12][15]

Definition at line 56 of file ui.c.

Referenced by TuiUpdateDateTime().

◆ UiScreenHeight

◆ UiScreenWidth

◆ UiSelectedTextBgColor

UCHAR UiSelectedTextBgColor

Definition at line 44 of file ui.c.

Referenced by TuiDrawMenuItem(), and UiInitialize().

◆ UiSelectedTextColor

UCHAR UiSelectedTextColor

Definition at line 43 of file ui.c.

Referenced by TuiDrawMenuItem(), and UiInitialize().

◆ UiStatusBarBgColor

UCHAR UiStatusBarBgColor

Definition at line 32 of file ui.c.

Referenced by TuiDrawStatusText(), and UiInitialize().

◆ UiStatusBarFgColor

UCHAR UiStatusBarFgColor

Definition at line 31 of file ui.c.

Referenced by TuiDrawStatusText(), and UiInitialize().

◆ UiTextColor

UCHAR UiTextColor

◆ UiTimeText

CHAR UiTimeText[]

Definition at line 54 of file ui.c.

Referenced by TuiDrawMenuBox(), and UiInitialize().

◆ UiTitleBoxBgColor

UCHAR UiTitleBoxBgColor

Definition at line 37 of file ui.c.

Referenced by TuiDrawBackdrop(), TuiUpdateDateTime(), and UiInitialize().

◆ UiTitleBoxFgColor

UCHAR UiTitleBoxFgColor

Definition at line 36 of file ui.c.

Referenced by TuiDrawBackdrop(), TuiUpdateDateTime(), and UiInitialize().

◆ UiTitleBoxTitleText

CHAR UiTitleBoxTitleText[260]

Definition at line 48 of file ui.c.

Referenced by TuiDrawBackdrop(), and UiInitialize().

◆ UiUseSpecialEffects

BOOLEAN UiUseSpecialEffects

Definition at line 50 of file ui.c.

Referenced by TuiFadeInBackdrop(), TuiFadeOut(), TuiUnInitialize(), and UiInitialize().

◆ UiVtbl