ReactOS  0.4.15-dev-5462-g4d0d22a
tui.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define TUI_TITLE_BOX_CHAR_HEIGHT   5
 
#define UL   0xDA /* HORZ and VERT */
 
#define UR   0xBF
 
#define LL   0xC0
 
#define LR   0xD9
 
#define D_UL   0xC9 /* D_HORZ and D_VERT */
 
#define D_UR   0xBB
 
#define D_LL   0xC8
 
#define D_LR   0xBC
 
#define HD_UL   0xD5 /* D_HORZ and VERT */
 
#define HD_UR   0xB8
 
#define HD_LL   0xD4
 
#define HD_LR   0xBE
 
#define VD_UL   0xD6 /* HORZ and D_VERT */
 
#define VD_UR   0xB7
 
#define VD_LL   0xD3
 
#define VD_LR   0xBD
 

Functions

INT TuiPrintf (_In_ PCSTR Format,...)
 
VOID TuiTruncateStringEllipsis (_Inout_z_ PSTR StringText, _In_ ULONG MaxChars)
 
BOOLEAN TuiInitialize (VOID)
 
VOID TuiUnInitialize (VOID)
 
VOID TuiDrawBackdrop (VOID)
 
VOID TuiFillArea (ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, CHAR FillChar, UCHAR Attr)
 
VOID TuiDrawShadow (ULONG Left, ULONG Top, ULONG Right, ULONG Bottom)
 
VOID TuiDrawBox (_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Right, _In_ ULONG Bottom, _In_ UCHAR VertStyle, _In_ UCHAR HorzStyle, _In_ BOOLEAN Fill, _In_ BOOLEAN Shadow, _In_ UCHAR Attr)
 
VOID TuiDrawBoxTopLine (_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Right, _In_ UCHAR VertStyle, _In_ UCHAR HorzStyle, _In_ UCHAR Attr)
 
VOID TuiDrawBoxBottomLine (_In_ ULONG Left, _In_ ULONG Bottom, _In_ ULONG Right, _In_ UCHAR VertStyle, _In_ UCHAR HorzStyle, _In_ UCHAR Attr)
 
VOID TuiDrawText (_In_ ULONG X, _In_ ULONG Y, _In_ PCSTR Text, _In_ UCHAR Attr)
 
VOID TuiDrawText2 (_In_ ULONG X, _In_ ULONG Y, _In_opt_ ULONG MaxNumChars, _In_reads_or_z_(MaxNumChars) PCSTR Text, _In_ UCHAR Attr)
 
VOID TuiDrawCenteredText (_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Right, _In_ ULONG Bottom, _In_ PCSTR TextString, _In_ UCHAR Attr)
 
VOID TuiDrawStatusText (PCSTR StatusText)
 
VOID TuiUpdateDateTime (VOID)
 
VOID TuiSaveScreen (PUCHAR Buffer)
 
VOID TuiRestoreScreen (PUCHAR Buffer)
 
VOID TuiMessageBox (PCSTR MessageText)
 
VOID TuiMessageBoxCritical (PCSTR MessageText)
 
BOOLEAN TuiEditBox (PCSTR MessageText, PCHAR EditTextBuffer, ULONG Length)
 
UCHAR TuiTextToColor (PCSTR ColorText)
 
UCHAR TuiTextToFillStyle (PCSTR FillStyleText)
 
VOID TuiFadeInBackdrop (VOID)
 
VOID TuiFadeOut (VOID)
 
VOID TuiDrawMenu (_In_ PUI_MENU_INFO MenuInfo)
 
VOID TuiDrawMenuBox (_In_ PUI_MENU_INFO MenuInfo)
 
VOID TuiDrawMenuItem (_In_ PUI_MENU_INFO MenuInfo, _In_ ULONG MenuItemNumber)
 
BOOLEAN TuiDisplayMenu (IN PCSTR MenuHeader, IN PCSTR MenuFooter OPTIONAL, IN BOOLEAN ShowBootOptions, IN PCSTR MenuItemList[], IN ULONG MenuItemCount, IN ULONG DefaultMenuItem, IN LONG MenuTimeOut, OUT PULONG SelectedMenuItem, IN BOOLEAN CanEscape, IN UiMenuKeyPressFilterCallback KeyPressFilter OPTIONAL, IN PVOID Context OPTIONAL)
 

Variables

const UIVTBL TuiVtbl
 

Macro Definition Documentation

◆ D_LL

#define D_LL   0xC8

Definition at line 155 of file tui.h.

◆ D_LR

#define D_LR   0xBC

Definition at line 156 of file tui.h.

◆ D_UL

#define D_UL   0xC9 /* D_HORZ and D_VERT */

Definition at line 153 of file tui.h.

◆ D_UR

#define D_UR   0xBB

Definition at line 154 of file tui.h.

◆ HD_LL

#define HD_LL   0xD4

Definition at line 160 of file tui.h.

◆ HD_LR

#define HD_LR   0xBE

Definition at line 161 of file tui.h.

◆ HD_UL

#define HD_UL   0xD5 /* D_HORZ and VERT */

Definition at line 158 of file tui.h.

◆ HD_UR

#define HD_UR   0xB8

Definition at line 159 of file tui.h.

◆ LL

#define LL   0xC0

Definition at line 150 of file tui.h.

◆ LR

#define LR   0xD9

Definition at line 151 of file tui.h.

◆ TUI_TITLE_BOX_CHAR_HEIGHT

#define TUI_TITLE_BOX_CHAR_HEIGHT   5

Definition at line 33 of file tui.h.

◆ UL

#define UL   0xDA /* HORZ and VERT */

Definition at line 148 of file tui.h.

◆ UR

#define UR   0xBF

Definition at line 149 of file tui.h.

◆ VD_LL

#define VD_LL   0xD3

Definition at line 165 of file tui.h.

◆ VD_LR

#define VD_LR   0xBD

Definition at line 166 of file tui.h.

◆ VD_UL

#define VD_UL   0xD6 /* HORZ and D_VERT */

Definition at line 163 of file tui.h.

◆ VD_UR

#define VD_UR   0xB7

Definition at line 164 of file tui.h.

Function Documentation

◆ TuiDisplayMenu()

BOOLEAN TuiDisplayMenu ( IN PCSTR  MenuHeader,
IN PCSTR MenuFooter  OPTIONAL,
IN BOOLEAN  ShowBootOptions,
IN PCSTR  MenuItemList[],
IN ULONG  MenuItemCount,
IN ULONG  DefaultMenuItem,
IN LONG  MenuTimeOut,
OUT PULONG  SelectedMenuItem,
IN BOOLEAN  CanEscape,
IN UiMenuKeyPressFilterCallback KeyPressFilter  OPTIONAL,
IN PVOID Context  OPTIONAL 
)

Definition at line 30 of file tuimenu.c.

42 {
43  UI_MENU_INFO MenuInformation;
44  ULONG LastClockSecond;
45  ULONG CurrentClockSecond;
46  ULONG KeyPress;
47 
48  /*
49  * Before taking any default action if there is no timeout,
50  * check whether the supplied key filter callback function
51  * may handle a specific user keypress. If it does, the
52  * timeout is cancelled.
53  */
54  if (!MenuTimeOut && KeyPressFilter && MachConsKbHit())
55  {
56  /* Get the key (get the extended key if needed) */
57  KeyPress = MachConsGetCh();
58  if (KeyPress == KEY_EXTENDED)
59  KeyPress = MachConsGetCh();
60 
61  /*
62  * Call the supplied key filter callback function to see
63  * if it is going to handle this keypress.
64  */
65  if (KeyPressFilter(KeyPress, DefaultMenuItem, Context))
66  {
67  /* It processed the key character, cancel the timeout */
68  MenuTimeOut = -1;
69  }
70  }
71 
72  /* Check if there is no timeout */
73  if (!MenuTimeOut)
74  {
75  /* Return the default selected item */
76  if (SelectedMenuItem) *SelectedMenuItem = DefaultMenuItem;
77  return TRUE;
78  }
79 
80  /* Setup the MENU_INFO structure */
81  MenuInformation.MenuHeader = MenuHeader;
82  MenuInformation.MenuFooter = MenuFooter;
83  MenuInformation.ShowBootOptions = ShowBootOptions;
84  MenuInformation.MenuItemList = MenuItemList;
85  MenuInformation.MenuItemCount = MenuItemCount;
86  MenuInformation.MenuTimeRemaining = MenuTimeOut;
87  MenuInformation.SelectedMenuItem = DefaultMenuItem;
88  MenuInformation.Context = Context;
89 
90  /* Calculate the size of the menu box */
91  TuiCalcMenuBoxSize(&MenuInformation);
92 
93  /* Draw the menu */
94 #ifdef _M_ARM
95  UiDrawMenu(&MenuInformation);
96 #else
97  UiVtbl.DrawMenu(&MenuInformation);
98 #endif
99 
100  /* Get the current second of time */
101  LastClockSecond = ArcGetTime()->Second;
102 
103  /* Process keys */
104  while (TRUE)
105  {
106  /* Process key presses */
107  KeyPress = TuiProcessMenuKeyboardEvent(&MenuInformation, KeyPressFilter);
108 
109  /* Check for ENTER or ESC */
110  if (KeyPress == KEY_ENTER) break;
111  if (CanEscape && KeyPress == KEY_ESC) return FALSE;
112 
113  /* Get the updated time, and check if more than a second has elapsed */
114  CurrentClockSecond = ArcGetTime()->Second;
115  if (CurrentClockSecond != LastClockSecond)
116  {
117  /* Update the time information */
118  LastClockSecond = CurrentClockSecond;
119 
120 #ifndef _M_ARM // FIXME: Theme-specific
121  /* Update the date & time */
123 #endif
124 
125  /* If there is a countdown, update it */
126  if (MenuInformation.MenuTimeRemaining > 0)
127  {
128  MenuInformation.MenuTimeRemaining--;
129  TuiDrawMenuTimeout(&MenuInformation);
130  }
131  else if (MenuInformation.MenuTimeRemaining == 0)
132  {
133  /* A timeout occurred, exit this loop and return selection */
134 #ifndef _M_ARM
136 #endif
137  break;
138  }
139 #ifndef _M_ARM
141 #endif
142  }
143 
144 #ifndef _M_ARM
145  MachHwIdle();
146 #endif
147  }
148 
149  /* Return the selected item */
150  if (SelectedMenuItem) *SelectedMenuItem = MenuInformation.SelectedMenuItem;
151  return TRUE;
152 }
PCSTR MenuHeader
Definition: ui.h:203
ULONG MenuItemCount
Definition: ui.h:208
LONG MenuTimeRemaining
Definition: ui.h:209
#define MachConsGetCh()
Definition: machine.h:90
#define MachHwIdle()
Definition: machine.h:137
#define TRUE
Definition: types.h:120
VOID TuiUpdateDateTime(VOID)
Definition: tui.c:552
USHORT Second
Definition: fw.h:16
static VOID TuiCalcMenuBoxSize(_In_ PUI_MENU_INFO MenuInfo)
Definition: tuimenu.c:155
#define KEY_EXTENDED
Definition: keycodes.h:38
VOID VideoCopyOffScreenBufferToVRAM(VOID)
Definition: video.c:39
PVOID Context
Definition: ui.h:211
UIVTBL UiVtbl
Definition: ui.c:70
#define FALSE
Definition: types.h:117
BOOLEAN ShowBootOptions
Definition: ui.h:205
static VOID TuiDrawMenuTimeout(_In_ PUI_MENU_INFO MenuInfo)
Definition: tuimenu.c:274
TIMEINFO * ArcGetTime(VOID)
Definition: arcemul.c:27
#define MachConsKbHit()
Definition: machine.h:88
#define KEY_ESC
Definition: keycodes.h:49
ULONG SelectedMenuItem
Definition: ui.h:210
VOID(* DrawMenu)(PUI_MENU_INFO MenuInfo)
Definition: ui.h:297
struct tagContext Context
Definition: acpixf.h:1038
unsigned int ULONG
Definition: retypes.h:1
PCSTR MenuFooter
Definition: ui.h:204
static ULONG TuiProcessMenuKeyboardEvent(_In_ PUI_MENU_INFO MenuInfo, _In_ UiMenuKeyPressFilterCallback KeyPressFilter)
Definition: tuimenu.c:527
PCSTR * MenuItemList
Definition: ui.h:207
#define KEY_ENTER
Definition: keycodes.h:39

◆ TuiDrawBackdrop()

VOID TuiDrawBackdrop ( VOID  )

Definition at line 275 of file tui.c.

276 {
277  /* Fill in the background (excluding title box & status bar) */
278  TuiFillArea(0,
280  UiScreenWidth - 1,
281  UiScreenHeight - 2,
284 
285  /* Draw the title box */
286  TuiDrawBox(0,
287  0,
288  UiScreenWidth - 1,
290  D_VERT,
291  D_HORZ,
292  TRUE,
293  FALSE,
295 
296  /* Draw version text */
297  TuiDrawText(2,
298  1,
301 
302  /* Draw copyright */
303  TuiDrawText(2,
304  2,
305  BY_AUTHOR,
307  TuiDrawText(2,
308  3,
309  AUTHOR_EMAIL,
311 
312  /* Draw help text */
313  TuiDrawText(UiScreenWidth - 16, 3,
314  /*"F1 for Help"*/ "F8 for Options",
316 
317  /* Draw title text */
319  2,
322 
323  /* Update the date & time */
326 }
CHAR UiTitleBoxTitleText[260]
Definition: ui.c:49
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define TRUE
Definition: types.h:120
ULONG UiScreenHeight
Definition: ui.c:57
#define TUI_TITLE_BOX_CHAR_HEIGHT
Definition: tui.h:33
UCHAR UiTitleBoxBgColor
Definition: ui.c:33
VOID VideoCopyOffScreenBufferToVRAM(VOID)
Definition: video.c:39
VOID TuiDrawText(_In_ ULONG X, _In_ ULONG Y, _In_ PCSTR Text, _In_ UCHAR Attr)
Definition: tui.c:72
VOID TuiDrawBox(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Right, _In_ ULONG Bottom, _In_ UCHAR VertStyle, _In_ UCHAR HorzStyle, _In_ BOOLEAN Fill, _In_ BOOLEAN Shadow, _In_ UCHAR Attr)
Definition: tui.c:507
#define FALSE
Definition: types.h:117
#define ATTR(cFore, cBack)
Definition: ui.h:314
const PCSTR FrLdrVersionString
Definition: freeldr.c:32
#define D_HORZ
Definition: ui.h:344
UCHAR UiBackdropFillStyle
Definition: ui.c:31
#define AUTHOR_EMAIL
Definition: ver.h:25
UCHAR UiTitleBoxFgColor
Definition: ui.c:32
UCHAR UiBackdropBgColor
Definition: ui.c:30
VOID TuiFillArea(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, CHAR FillChar, UCHAR Attr)
Definition: tui.c:332
#define BY_AUTHOR
Definition: ver.h:26
unsigned int ULONG
Definition: retypes.h:1
UCHAR UiBackdropFgColor
Definition: ui.c:29
ULONG UiScreenWidth
Definition: ui.c:56
VOID TuiUpdateDateTime(VOID)
Definition: tui.c:552
#define D_VERT
Definition: ui.h:346

Referenced by TuiFadeInBackdrop().

◆ TuiDrawBox()

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

Definition at line 507 of file tui.c.

517 {
518  /* Fill in the box background */
519  if (Fill)
520  TuiFillArea(Left, Top, Right, Bottom, ' ', Attr);
521 
522  /* Fill in the top horizontal line */
523  TuiDrawBoxTopLine(Left, Top, Right, VertStyle, HorzStyle, Attr);
524 
525  /* Fill in the vertical left and right lines */
526  TuiFillArea(Left, Top+1, Left, Bottom-1, VertStyle, Attr);
527  TuiFillArea(Right, Top+1, Right, Bottom-1, VertStyle, Attr);
528 
529  /* Fill in the bottom horizontal line */
530  TuiDrawBoxBottomLine(Left, Bottom, Right, VertStyle, HorzStyle, Attr);
531 
532  /* Draw the shadow */
533  if (Shadow)
534  TuiDrawShadow(Left, Top, Right, Bottom);
535 }
void Fill(HDC hdc, LONG x, LONG y, COLORREF color)
Definition: drawing.cpp:109
VOID TuiDrawBoxBottomLine(_In_ ULONG Left, _In_ ULONG Bottom, _In_ ULONG Right, _In_ UCHAR VertStyle, _In_ UCHAR HorzStyle, _In_ UCHAR Attr)
Definition: tui.c:463
VOID TuiDrawShadow(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom)
Definition: tui.c:362
VOID TuiFillArea(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, CHAR FillChar, UCHAR Attr)
Definition: tui.c:332
VOID TuiDrawBoxTopLine(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Right, _In_ UCHAR VertStyle, _In_ UCHAR HorzStyle, _In_ UCHAR Attr)
Definition: tui.c:419
static LPHIST_ENTRY Bottom
Definition: history.c:54
static LPHIST_ENTRY Top
Definition: history.c:53

Referenced by TuiDrawBackdrop(), TuiDrawProgressBar(), TuiEditBox(), and TuiMessageBoxCritical().

◆ TuiDrawBoxBottomLine()

VOID TuiDrawBoxBottomLine ( _In_ ULONG  Left,
_In_ ULONG  Bottom,
_In_ ULONG  Right,
_In_ UCHAR  VertStyle,
_In_ UCHAR  HorzStyle,
_In_ UCHAR  Attr 
)

Definition at line 463 of file tui.c.

470 {
471  UCHAR LLCorner, LRCorner;
472 
473  /* Calculate the corner values */
474  if (HorzStyle == HORZ)
475  {
476  if (VertStyle == VERT)
477  {
478  LLCorner = LL;
479  LRCorner = LR;
480  }
481  else // VertStyle == D_VERT
482  {
483  LLCorner = VD_LL;
484  LRCorner = VD_LR;
485  }
486  }
487  else // HorzStyle == D_HORZ
488  {
489  if (VertStyle == VERT)
490  {
491  LLCorner = HD_LL;
492  LRCorner = HD_LR;
493  }
494  else // VertStyle == D_VERT
495  {
496  LLCorner = D_LL;
497  LRCorner = D_LR;
498  }
499  }
500 
501  TuiFillArea(Left, Bottom, Left, Bottom, LLCorner, Attr);
502  TuiFillArea(Left+1, Bottom, Right-1, Bottom, HorzStyle, Attr);
503  TuiFillArea(Right, Bottom, Right, Bottom, LRCorner, Attr);
504 }
#define LR
Definition: tui.h:151
#define LL
Definition: tui.h:150
#define HORZ
Definition: ui.h:343
#define HD_LL
Definition: tui.h:160
#define D_LL
Definition: tui.h:155
#define VD_LL
Definition: tui.h:165
#define VD_LR
Definition: tui.h:166
unsigned char UCHAR
Definition: xmlstorage.h:181
VOID TuiFillArea(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, CHAR FillChar, UCHAR Attr)
Definition: tui.c:332
#define HD_LR
Definition: tui.h:161
static LPHIST_ENTRY Bottom
Definition: history.c:54
#define D_LR
Definition: tui.h:156
#define VERT
Definition: ui.h:345

Referenced by TuiDrawBox(), and TuiDrawMenuTimeout().

◆ TuiDrawBoxTopLine()

VOID TuiDrawBoxTopLine ( _In_ ULONG  Left,
_In_ ULONG  Top,
_In_ ULONG  Right,
_In_ UCHAR  VertStyle,
_In_ UCHAR  HorzStyle,
_In_ UCHAR  Attr 
)

Definition at line 419 of file tui.c.

426 {
427  UCHAR ULCorner, URCorner;
428 
429  /* Calculate the corner values */
430  if (HorzStyle == HORZ)
431  {
432  if (VertStyle == VERT)
433  {
434  ULCorner = UL;
435  URCorner = UR;
436  }
437  else // VertStyle == D_VERT
438  {
439  ULCorner = VD_UL;
440  URCorner = VD_UR;
441  }
442  }
443  else // HorzStyle == D_HORZ
444  {
445  if (VertStyle == VERT)
446  {
447  ULCorner = HD_UL;
448  URCorner = HD_UR;
449  }
450  else // VertStyle == D_VERT
451  {
452  ULCorner = D_UL;
453  URCorner = D_UR;
454  }
455  }
456 
457  TuiFillArea(Left, Top, Left, Top, ULCorner, Attr);
458  TuiFillArea(Left+1, Top, Right-1, Top, HorzStyle, Attr);
459  TuiFillArea(Right, Top, Right, Top, URCorner, Attr);
460 }
#define HD_UL
Definition: tui.h:158
#define VD_UL
Definition: tui.h:163
#define D_UR
Definition: tui.h:154
#define D_UL
Definition: tui.h:153
#define HORZ
Definition: ui.h:343
#define UR
Definition: tui.h:149
#define VD_UR
Definition: tui.h:164
unsigned char UCHAR
Definition: xmlstorage.h:181
VOID TuiFillArea(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, CHAR FillChar, UCHAR Attr)
Definition: tui.c:332
#define UL
Definition: tui.h:148
static LPHIST_ENTRY Top
Definition: history.c:53
#define VERT
Definition: ui.h:345
#define HD_UR
Definition: tui.h:159

Referenced by TuiDrawBox().

◆ TuiDrawCenteredText()

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

Definition at line 119 of file tui.c.

126 {
127  SIZE_T TextLength;
128  SIZE_T Index, LastIndex;
129  ULONG LineBreakCount;
130  ULONG BoxWidth, BoxHeight;
131  ULONG RealLeft, RealTop;
132  ULONG X, Y;
133  CHAR Temp[2];
134 
135  /* Query text length */
136  TextLength = strlen(TextString);
137 
138  /* Count the new lines and the box width */
139  LineBreakCount = 0;
140  BoxWidth = 0;
141  LastIndex = 0;
142  for (Index = 0; Index < TextLength; Index++)
143  {
144  /* Scan for new lines */
145  if (TextString[Index] == '\n')
146  {
147  /* Remember the new line */
148  LastIndex = Index;
149  LineBreakCount++;
150  }
151  else
152  {
153  /* Check for new larger box width */
154  if ((Index - LastIndex) > BoxWidth)
155  {
156  /* Update it */
157  BoxWidth = (ULONG)(Index - LastIndex);
158  }
159  }
160  }
161 
162  /* Base the box height on the number of lines */
163  BoxHeight = LineBreakCount + 1;
164 
165  /*
166  * Create the centered coordinates.
167  * Here, the Left/Top/Right/Bottom rectangle is a hint, around
168  * which we center the "real" text rectangle RealLeft/RealTop.
169  */
170  RealLeft = (Left + Right - BoxWidth + 1) / 2;
171  RealTop = (Top + Bottom - BoxHeight + 1) / 2;
172 
173  /* Now go for a second scan */
174  LastIndex = 0;
175  for (Index = 0; Index < TextLength; Index++)
176  {
177  /* Look for new lines again */
178  if (TextString[Index] == '\n')
179  {
180  /* Update where the text should start */
181  RealTop++;
182  LastIndex = 0;
183  }
184  else
185  {
186  /* We've got a line of text to print, do it */
187  X = (ULONG)(RealLeft + LastIndex);
188  Y = RealTop;
189  LastIndex++;
190  Temp[0] = TextString[Index];
191  Temp[1] = 0;
192  TuiDrawText(X, Y, Temp, Attr);
193  }
194  }
195 }
#define Y(I)
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char CHAR
Definition: xmlstorage.h:175
VOID TuiDrawText(_In_ ULONG X, _In_ ULONG Y, _In_ PCSTR Text, _In_ UCHAR Attr)
Definition: tui.c:72
_In_ WDFCOLLECTION _In_ ULONG Index
ULONG_PTR SIZE_T
Definition: typedefs.h:80
static LPHIST_ENTRY Bottom
Definition: history.c:54
unsigned int ULONG
Definition: retypes.h:1
static LPHIST_ENTRY Top
Definition: history.c:53
#define X(b, s)

Referenced by MiniTuiSetProgressBarText(), and TuiSetProgressBarText().

◆ TuiDrawMenu()

VOID TuiDrawMenu ( _In_ PUI_MENU_INFO  MenuInfo)

Definition at line 204 of file tuimenu.c.

206 {
207  ULONG i;
208 
209 #ifndef _M_ARM // FIXME: Theme-specific
210  /* Draw the backdrop */
211  UiDrawBackdrop();
212 #else
213 
214  /* No GUI status bar text, just minimal text. Show the menu header. */
215  if (MenuInfo->MenuHeader)
216  {
217  UiDrawText(0,
218  MenuInfo->Top - 2,
219  MenuInfo->MenuHeader,
221  }
222 
223 #endif
224 
225  /* Draw the menu box */
227 
228  /* Draw each line of the menu */
229  for (i = 0; i < MenuInfo->MenuItemCount; ++i)
230  {
232  }
233 
234 #ifndef _M_ARM // FIXME: Theme-specific
235 
236  /* Update the status bar */
237  UiVtbl.DrawStatusText("Use \x18 and \x19 to select, then press ENTER.");
238 
239 #else
240 
241  /* Now tell the user how to choose */
242  UiDrawText(0,
243  MenuInfo->Bottom + 1,
244  "Use \x18 and \x19 to move the highlight to your choice.",
246  UiDrawText(0,
247  MenuInfo->Bottom + 2,
248  "Press ENTER to choose.",
250 
251  /* And show the menu footer */
252  if (MenuInfo->MenuFooter)
253  {
254  UiDrawText(0,
255  UiScreenHeight - 4,
256  MenuInfo->MenuFooter,
258  }
259 
260 #endif
261 
262  /* Display the boot options if needed */
263  if (MenuInfo->ShowBootOptions)
264  {
266  }
267 
268 #ifndef _M_ARM
270 #endif
271 }
ULONG UiScreenHeight
Definition: ui.c:57
VOID VideoCopyOffScreenBufferToVRAM(VOID)
Definition: video.c:39
UIVTBL UiVtbl
Definition: ui.c:70
VOID TuiDrawMenuBox(_In_ PUI_MENU_INFO MenuInfo)
Definition: tuimenu.c:400
#define ATTR(cFore, cBack)
Definition: ui.h:314
VOID UiDrawText(_In_ ULONG X, _In_ ULONG Y, _In_ PCSTR Text, _In_ UCHAR Attr)
Definition: ui.c:260
VOID TuiDrawMenuItem(_In_ PUI_MENU_INFO MenuInfo, _In_ ULONG MenuItemNumber)
Definition: tuimenu.c:426
UCHAR UiMenuBgColor
Definition: ui.c:37
VOID UiDrawBackdrop(VOID)
Definition: ui.c:239
menu info structure
Definition: window.h:275
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
VOID(* DrawStatusText)(PCSTR StatusText)
Definition: ui.h:257
VOID DisplayBootTimeOptions(VOID)
Definition: options.c:181
unsigned int ULONG
Definition: retypes.h:1
UCHAR UiMenuFgColor
Definition: ui.c:36

◆ TuiDrawMenuBox()

VOID TuiDrawMenuBox ( _In_ PUI_MENU_INFO  MenuInfo)

Definition at line 400 of file tuimenu.c.

402 {
403 #ifndef _M_ARM // FIXME: Theme-specific
404  /* Draw the menu box if requested */
405  if (UiMenuBox)
406  {
407  UiDrawBox(MenuInfo->Left,
408  MenuInfo->Top,
409  MenuInfo->Right,
410  MenuInfo->Bottom,
411  D_VERT,
412  D_HORZ,
413  FALSE, // Filled
414  TRUE, // Shadow
416  }
417 
418  /* Update the date & time */
420 #endif
421 
423 }
#define TRUE
Definition: types.h:120
VOID TuiUpdateDateTime(VOID)
Definition: tui.c:552
#define FALSE
Definition: types.h:117
static VOID TuiDrawMenuTimeout(_In_ PUI_MENU_INFO MenuInfo)
Definition: tuimenu.c:274
#define ATTR(cFore, cBack)
Definition: ui.h:314
#define D_HORZ
Definition: ui.h:344
BOOLEAN UiMenuBox
Definition: ui.c:45
VOID UiDrawBox(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR VertStyle, UCHAR HorzStyle, BOOLEAN Fill, BOOLEAN Shadow, UCHAR Attr)
Definition: ui.c:254
UCHAR UiMenuBgColor
Definition: ui.c:37
menu info structure
Definition: window.h:275
UCHAR UiMenuFgColor
Definition: ui.c:36
#define D_VERT
Definition: ui.h:346

Referenced by MiniTuiDrawMenu(), and TuiDrawMenu().

◆ TuiDrawMenuItem()

VOID TuiDrawMenuItem ( _In_ PUI_MENU_INFO  MenuInfo,
_In_ ULONG  MenuItemNumber 
)

Definition at line 426 of file tuimenu.c.

429 {
430  ULONG SpaceLeft;
431  ULONG SpaceRight;
432  UCHAR Attribute;
433  CHAR MenuLineText[80];
434 
435  /* If this is a separator */
436  if (MenuInfo->MenuItemList[MenuItemNumber] == NULL)
437  {
438 #ifndef _M_ARM // FIXME: Theme-specific
439  /* Draw its left box corner */
440  if (UiMenuBox)
441  {
442  UiDrawText(MenuInfo->Left,
443  MenuInfo->Top + 1 + MenuItemNumber,
444  "\xC7",
446  }
447 #endif
448 
449  /* Make it a separator line and use menu colors */
450  RtlZeroMemory(MenuLineText, sizeof(MenuLineText));
451  RtlFillMemory(MenuLineText,
452  min(sizeof(MenuLineText), (MenuInfo->Right - MenuInfo->Left - 1)),
453  0xC4);
454 
455  /* Draw the item */
456  UiDrawText(MenuInfo->Left + 1,
457  MenuInfo->Top + 1 + MenuItemNumber,
458  MenuLineText,
460 
461 #ifndef _M_ARM // FIXME: Theme-specific
462  /* Draw its right box corner */
463  if (UiMenuBox)
464  {
465  UiDrawText(MenuInfo->Right,
466  MenuInfo->Top + 1 + MenuItemNumber,
467  "\xB6",
469  }
470 #endif
471 
472  /* We are done */
473  return;
474  }
475 
476  /* This is not a separator */
477  ASSERT(MenuInfo->MenuItemList[MenuItemNumber]);
478 
479 #ifndef _M_ARM
480  /* Check if using centered menu */
481  if (UiCenterMenu)
482  {
483  /*
484  * We will want the string centered so calculate
485  * how many spaces will be to the left and right.
486  */
487  ULONG SpaceTotal =
488  (MenuInfo->Right - MenuInfo->Left - 2) -
489  (ULONG)strlen(MenuInfo->MenuItemList[MenuItemNumber]);
490  SpaceLeft = (SpaceTotal / 2) + 1;
491  SpaceRight = (SpaceTotal - SpaceLeft) + 1;
492  }
493  else
494 #endif
495  {
496  /* Simply left-align it */
497  SpaceLeft = 4;
498  SpaceRight = 0;
499  }
500 
501  /* Format the item text string */
502  RtlStringCbPrintfA(MenuLineText, sizeof(MenuLineText),
503  "%*s%s%*s",
504  SpaceLeft, "", // Left padding
505  MenuInfo->MenuItemList[MenuItemNumber],
506  SpaceRight, ""); // Right padding
507 
508  if (MenuItemNumber == MenuInfo->SelectedMenuItem)
509  {
510  /* If this is the selected item, use the selected colors */
512  }
513  else
514  {
515  /* Normal item colors */
516  Attribute = ATTR(UiTextColor, UiMenuBgColor);
517  }
518 
519  /* Draw the item */
520  UiDrawText(MenuInfo->Left + 1,
521  MenuInfo->Top + 1 + MenuItemNumber,
522  MenuLineText,
523  Attribute);
524 }
UCHAR UiTextColor
Definition: ui.c:38
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char CHAR
Definition: xmlstorage.h:175
BOOLEAN UiCenterMenu
Definition: ui.c:46
#define ATTR(cFore, cBack)
Definition: ui.h:314
VOID UiDrawText(_In_ ULONG X, _In_ ULONG Y, _In_ PCSTR Text, _In_ UCHAR Attr)
Definition: ui.c:260
NTSTRSAFEVAPI RtlStringCbPrintfA(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,...)
Definition: ntstrsafe.h:1148
#define ASSERT(a)
Definition: mode.c:44
BOOLEAN UiMenuBox
Definition: ui.c:45
#define RtlFillMemory(Dest, Length, Fill)
Definition: winternl.h:593
unsigned char UCHAR
Definition: xmlstorage.h:181
UCHAR UiMenuBgColor
Definition: ui.c:37
menu info structure
Definition: window.h:275
UCHAR UiSelectedTextBgColor
Definition: ui.c:40
#define min(a, b)
Definition: monoChain.cc:55
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
UCHAR UiMenuFgColor
Definition: ui.c:36
UCHAR UiSelectedTextColor
Definition: ui.c:39

Referenced by MiniTuiDrawMenu(), TuiDrawMenu(), and TuiProcessMenuKeyboardEvent().

◆ TuiDrawShadow()

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

Definition at line 362 of file tui.c.

363 {
364  PUCHAR ScreenMemory = (PUCHAR)TextVideoBuffer;
365  ULONG Idx;
366 
367  /* Shade the bottom of the area */
368  if (Bottom < (UiScreenHeight - 1))
369  {
370  if (UiScreenHeight < 34)
371  Idx = Left + 2;
372  else
373  Idx = Left + 1;
374 
375  for (; Idx <= Right; ++Idx)
376  {
377  ScreenMemory[(((Bottom+1)*2)*UiScreenWidth)+(Idx*2)+1] = ATTR(COLOR_GRAY, COLOR_BLACK);
378  }
379  }
380 
381  /* Shade the right of the area */
382  if (Right < (UiScreenWidth - 1))
383  {
384  for (Idx=Top+1; Idx<=Bottom; Idx++)
385  {
386  ScreenMemory[((Idx*2)*UiScreenWidth)+((Right+1)*2)+1] = ATTR(COLOR_GRAY, COLOR_BLACK);
387  }
388  }
389  if (UiScreenHeight < 34)
390  {
391  if ((Right + 1) < (UiScreenWidth - 1))
392  {
393  for (Idx=Top+1; Idx<=Bottom; Idx++)
394  {
395  ScreenMemory[((Idx*2)*UiScreenWidth)+((Right+2)*2)+1] = ATTR(COLOR_GRAY, COLOR_BLACK);
396  }
397  }
398  }
399 
400  /* Shade the bottom right corner */
401  if ((Right < (UiScreenWidth - 1)) && (Bottom < (UiScreenHeight - 1)))
402  {
403  ScreenMemory[(((Bottom+1)*2)*UiScreenWidth)+((Right+1)*2)+1] = ATTR(COLOR_GRAY, COLOR_BLACK);
404  }
405  if (UiScreenHeight < 34)
406  {
407  if (((Right + 1) < (UiScreenWidth - 1)) && (Bottom < (UiScreenHeight - 1)))
408  {
409  ScreenMemory[(((Bottom+1)*2)*UiScreenWidth)+((Right+2)*2)+1] = ATTR(COLOR_GRAY, COLOR_BLACK);
410  }
411  }
412 }
#define COLOR_BLACK
Definition: ui.h:319
unsigned char * PUCHAR
Definition: retypes.h:3
ULONG UiScreenHeight
Definition: ui.c:57
#define ATTR(cFore, cBack)
Definition: ui.h:314
PVOID TextVideoBuffer
Definition: tui.c:23
static LPHIST_ENTRY Bottom
Definition: history.c:54
unsigned int ULONG
Definition: retypes.h:1
ULONG UiScreenWidth
Definition: ui.c:56
static LPHIST_ENTRY Top
Definition: history.c:53

Referenced by TuiDrawBox().

◆ TuiDrawStatusText()

VOID TuiDrawStatusText ( PCSTR  StatusText)

Definition at line 537 of file tui.c.

538 {
539  SIZE_T i;
540 
543 
544  for (i=strlen(StatusText)+1; i<UiScreenWidth; i++)
545  {
547  }
548 
550 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
ULONG UiScreenHeight
Definition: ui.c:57
VOID VideoCopyOffScreenBufferToVRAM(VOID)
Definition: video.c:39
VOID TuiDrawText(_In_ ULONG X, _In_ ULONG Y, _In_ PCSTR Text, _In_ UCHAR Attr)
Definition: tui.c:72
#define ATTR(cFore, cBack)
Definition: ui.h:314
UCHAR UiStatusBarBgColor
Definition: ui.c:28
ULONG_PTR SIZE_T
Definition: typedefs.h:80
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int ULONG
Definition: retypes.h:1
ULONG UiScreenWidth
Definition: ui.c:56
UCHAR UiStatusBarFgColor
Definition: ui.c:27

◆ TuiDrawText()

VOID TuiDrawText ( _In_ ULONG  X,
_In_ ULONG  Y,
_In_ PCSTR  Text,
_In_ UCHAR  Attr 
)

Definition at line 72 of file tui.c.

77 {
78  TuiDrawText2(X, Y, 0 /*(ULONG)strlen(Text)*/, Text, Attr);
79 }
#define Y(I)
VOID TuiDrawText2(_In_ ULONG X, _In_ ULONG Y, _In_opt_ ULONG MaxNumChars, _In_reads_or_z_(MaxNumChars) PCSTR Text, _In_ UCHAR Attr)
Definition: tui.c:89
char * Text
Definition: combotst.c:136

Referenced by TuiDrawBackdrop(), TuiDrawCenteredText(), TuiDrawStatusText(), and TuiUpdateDateTime().

◆ TuiDrawText2()

VOID TuiDrawText2 ( _In_ ULONG  X,
_In_ ULONG  Y,
_In_opt_ ULONG  MaxNumChars,
_In_reads_or_z_(MaxNumChars) PCSTR  Text,
_In_ UCHAR  Attr 
)

Definition at line 89 of file tui.c.

95 {
96 #ifndef _M_ARM
97  PUCHAR ScreenMemory = (PUCHAR)TextVideoBuffer;
98 #endif
99  ULONG i, j;
100 
101  /* Don't display anything if we are out of the screen */
102  if ((X >= UiScreenWidth) || (Y >= UiScreenHeight))
103  return;
104 
105  /* Draw the text, not exceeding the width */
106  for (i = X, j = 0; Text[j] && i < UiScreenWidth && (MaxNumChars > 0 ? j < MaxNumChars : TRUE); i++, j++)
107  {
108 #ifndef _M_ARM
109  ScreenMemory[((Y*2)*UiScreenWidth)+(i*2)] = (UCHAR)Text[j];
110  ScreenMemory[((Y*2)*UiScreenWidth)+(i*2)+1] = Attr;
111 #else
112  /* Write the character */
113  MachVideoPutChar(Text[j], Attr, i, Y);
114 #endif
115  }
116 }
#define Y(I)
#define TRUE
Definition: types.h:120
unsigned char * PUCHAR
Definition: retypes.h:3
ULONG UiScreenHeight
Definition: ui.c:57
#define MachVideoPutChar(Ch, Attr, X, Y)
Definition: machine.h:106
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
PVOID TextVideoBuffer
Definition: tui.c:23
unsigned char UCHAR
Definition: xmlstorage.h:181
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int ULONG
Definition: retypes.h:1
ULONG UiScreenWidth
Definition: ui.c:56
char * Text
Definition: combotst.c:136

Referenced by TuiDrawText().

◆ TuiEditBox()

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

Definition at line 984 of file tui.c.

985 {
986  INT width = 8;
987  ULONG height = 1;
988  INT curline = 0;
989  INT k;
990  size_t i , j;
991  INT x1, x2, y1, y2;
992  CHAR temp[260];
993  CHAR key;
994  BOOLEAN Extended;
995  INT EditBoxLine;
996  ULONG EditBoxStartX, EditBoxEndX;
997  INT EditBoxCursorX;
998  ULONG EditBoxTextLength, EditBoxTextPosition;
999  INT EditBoxTextDisplayIndex;
1000  BOOLEAN ReturnCode;
1002 
1003  // Save the screen contents
1007 
1008  // Find the height
1009  for (i=0; i<strlen(MessageText); i++)
1010  {
1011  if (MessageText[i] == '\n')
1012  height++;
1013  }
1014 
1015  // Find the width
1016  for (i=0,j=0,k=0; i<height; i++)
1017  {
1018  while ((MessageText[j] != '\n') && (MessageText[j] != 0))
1019  {
1020  j++;
1021  k++;
1022  }
1023 
1024  if (k > width)
1025  width = k;
1026 
1027  k = 0;
1028  j++;
1029  }
1030 
1031  // Calculate box area
1032  x1 = (UiScreenWidth - (width+2))/2;
1033  x2 = x1 + width + 3;
1034  y1 = ((UiScreenHeight - height - 2)/2) + 1;
1035  y2 = y1 + height + 4;
1036 
1037  // Draw the box
1039 
1040  // Draw the text
1041  for (i=0,j=0; i<strlen(MessageText)+1; i++)
1042  {
1043  if ((MessageText[i] == '\n') || (MessageText[i] == 0))
1044  {
1045  temp[j] = 0;
1046  j = 0;
1048  curline++;
1049  }
1050  else
1051  temp[j++] = MessageText[i];
1052  }
1053 
1054  EditBoxTextLength = (ULONG)strlen(EditTextBuffer);
1055  EditBoxTextLength = min(EditBoxTextLength, Length - 1);
1056  EditBoxTextPosition = 0;
1057  EditBoxLine = y2 - 2;
1058  EditBoxStartX = x1 + 3;
1059  EditBoxEndX = x2 - 3;
1060 
1061  // Draw the edit box background and the text
1062  UiFillArea(EditBoxStartX, EditBoxLine, EditBoxEndX, EditBoxLine, ' ', ATTR(UiEditBoxTextColor, UiEditBoxBgColor));
1063  UiDrawText2(EditBoxStartX, EditBoxLine, EditBoxEndX - EditBoxStartX + 1, EditTextBuffer, ATTR(UiEditBoxTextColor, UiEditBoxBgColor));
1064 
1065  // Show the cursor
1066  EditBoxCursorX = EditBoxStartX;
1067  MachVideoSetTextCursorPosition(EditBoxCursorX, EditBoxLine);
1069 
1070  // Draw status text
1071  UiDrawStatusText("Press ENTER to continue, or ESC to cancel");
1072 
1074 
1075  //
1076  // Enter the text. Please keep in mind that the default input mode
1077  // of the edit boxes is in insertion mode, that is, you can insert
1078  // text without erasing the existing one.
1079  //
1080  for (;;)
1081  {
1082  if (MachConsKbHit())
1083  {
1084  Extended = FALSE;
1085  key = MachConsGetCh();
1086  if (key == KEY_EXTENDED)
1087  {
1088  Extended = TRUE;
1089  key = MachConsGetCh();
1090  }
1091 
1092  if (key == KEY_ENTER)
1093  {
1094  ReturnCode = TRUE;
1095  break;
1096  }
1097  else if (key == KEY_ESC)
1098  {
1099  ReturnCode = FALSE;
1100  break;
1101  }
1102  else if (key == KEY_BACKSPACE) // Remove a character
1103  {
1104  if ( (EditBoxTextLength > 0) && (EditBoxTextPosition > 0) &&
1105  (EditBoxTextPosition <= EditBoxTextLength) )
1106  {
1107  EditBoxTextPosition--;
1108  memmove(EditTextBuffer + EditBoxTextPosition,
1109  EditTextBuffer + EditBoxTextPosition + 1,
1110  EditBoxTextLength - EditBoxTextPosition);
1111  EditBoxTextLength--;
1112  EditTextBuffer[EditBoxTextLength] = 0;
1113  }
1114  else
1115  {
1116  MachBeep();
1117  }
1118  }
1119  else if (Extended && key == KEY_DELETE) // Remove a character
1120  {
1121  if ( (EditBoxTextLength > 0) &&
1122  (EditBoxTextPosition < EditBoxTextLength) )
1123  {
1124  memmove(EditTextBuffer + EditBoxTextPosition,
1125  EditTextBuffer + EditBoxTextPosition + 1,
1126  EditBoxTextLength - EditBoxTextPosition);
1127  EditBoxTextLength--;
1128  EditTextBuffer[EditBoxTextLength] = 0;
1129  }
1130  else
1131  {
1132  MachBeep();
1133  }
1134  }
1135  else if (Extended && key == KEY_HOME) // Go to the start of the buffer
1136  {
1137  EditBoxTextPosition = 0;
1138  }
1139  else if (Extended && key == KEY_END) // Go to the end of the buffer
1140  {
1141  EditBoxTextPosition = EditBoxTextLength;
1142  }
1143  else if (Extended && key == KEY_RIGHT) // Go right
1144  {
1145  if (EditBoxTextPosition < EditBoxTextLength)
1146  EditBoxTextPosition++;
1147  else
1148  MachBeep();
1149  }
1150  else if (Extended && key == KEY_LEFT) // Go left
1151  {
1152  if (EditBoxTextPosition > 0)
1153  EditBoxTextPosition--;
1154  else
1155  MachBeep();
1156  }
1157  else if (!Extended) // Add this key to the buffer
1158  {
1159  if ( (EditBoxTextLength < Length - 1) &&
1160  (EditBoxTextPosition < Length - 1) )
1161  {
1162  memmove(EditTextBuffer + EditBoxTextPosition + 1,
1163  EditTextBuffer + EditBoxTextPosition,
1164  EditBoxTextLength - EditBoxTextPosition);
1165  EditTextBuffer[EditBoxTextPosition] = key;
1166  EditBoxTextPosition++;
1167  EditBoxTextLength++;
1168  EditTextBuffer[EditBoxTextLength] = 0;
1169  }
1170  else
1171  {
1172  MachBeep();
1173  }
1174  }
1175  else
1176  {
1177  MachBeep();
1178  }
1179  }
1180 
1181  // Draw the edit box background
1182  UiFillArea(EditBoxStartX, EditBoxLine, EditBoxEndX, EditBoxLine, ' ', ATTR(UiEditBoxTextColor, UiEditBoxBgColor));
1183 
1184  // Fill the text in
1185  if (EditBoxTextPosition > (EditBoxEndX - EditBoxStartX))
1186  {
1187  EditBoxTextDisplayIndex = EditBoxTextPosition - (EditBoxEndX - EditBoxStartX);
1188  EditBoxCursorX = EditBoxEndX;
1189  }
1190  else
1191  {
1192  EditBoxTextDisplayIndex = 0;
1193  EditBoxCursorX = EditBoxStartX + EditBoxTextPosition;
1194  }
1195  UiDrawText2(EditBoxStartX, EditBoxLine, EditBoxEndX - EditBoxStartX + 1, &EditTextBuffer[EditBoxTextDisplayIndex], ATTR(UiEditBoxTextColor, UiEditBoxBgColor));
1196 
1197  // Move the cursor
1198  MachVideoSetTextCursorPosition(EditBoxCursorX, EditBoxLine);
1199 
1201 
1203 
1204  MachHwIdle();
1205  }
1206 
1207  // Hide the cursor again
1209 
1210  // Restore the screen contents
1213 
1214  return ReturnCode;
1215 }
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3706
GLint GLint GLsizei width
Definition: gl.h:1546
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define MachConsGetCh()
Definition: machine.h:90
#define MachHwIdle()
Definition: machine.h:137
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define TRUE
Definition: types.h:120
UCHAR UiMessageBoxFgColor
Definition: ui.c:34
char CHAR
Definition: xmlstorage.h:175
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
VOID UiDrawText2(_In_ ULONG X, _In_ ULONG Y, _In_opt_ ULONG MaxNumChars, _In_reads_or_z_(MaxNumChars) PCSTR Text, _In_ UCHAR Attr)
Definition: ui.c:270
ULONG UiScreenHeight
Definition: ui.c:57
#define KEY_EXTENDED
Definition: keycodes.h:38
int32_t INT
Definition: typedefs.h:58
VOID VideoCopyOffScreenBufferToVRAM(VOID)
Definition: video.c:39
#define KEY_LEFT
Definition: keycodes.h:47
VOID TuiDrawBox(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Right, _In_ ULONG Bottom, _In_ UCHAR VertStyle, _In_ UCHAR HorzStyle, _In_ BOOLEAN Fill, _In_ BOOLEAN Shadow, _In_ UCHAR Attr)
Definition: tui.c:507
#define FALSE
Definition: types.h:117
UCHAR UiEditBoxTextColor
Definition: ui.c:41
VOID TuiSaveScreen(PUCHAR Buffer)
Definition: tui.c:620
#define KEY_RIGHT
Definition: keycodes.h:48
FORCEINLINE PVOID FrLdrTempAlloc(_In_ SIZE_T Size, _In_ ULONG Tag)
Definition: mm.h:188
#define ATTR(cFore, cBack)
Definition: ui.h:314
VOID UiDrawText(_In_ ULONG X, _In_ ULONG Y, _In_ PCSTR Text, _In_ UCHAR Attr)
Definition: ui.c:260
unsigned char BOOLEAN
#define MachConsKbHit()
Definition: machine.h:88
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define D_HORZ
Definition: ui.h:344
#define KEY_DELETE
Definition: keycodes.h:41
#define KEY_ESC
Definition: keycodes.h:49
#define MachBeep()
Definition: machine.h:118
#define KEY_BACKSPACE
Definition: keycodes.h:40
UCHAR UiEditBoxBgColor
Definition: ui.c:42
#define KEY_HOME
Definition: keycodes.h:44
VOID UiDrawStatusText(PCSTR StatusText)
Definition: ui.c:292
HKEY key
Definition: reg.c:28
#define MachVideoHideShowTextCursor(Show)
Definition: machine.h:104
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG _In_ LONG y2
Definition: winddi.h:3706
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
VOID TuiRestoreScreen(PUCHAR Buffer)
Definition: tui.c:631
static calc_node_t temp
Definition: rpn_ieee.c:38
#define MachVideoSetTextCursorPosition(X, Y)
Definition: machine.h:102
UCHAR UiMessageBoxBgColor
Definition: ui.c:35
#define min(a, b)
Definition: monoChain.cc:55
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3706
HANDLE ScreenBuffer
Definition: notevil.c:37
VOID UiFillArea(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, CHAR FillChar, UCHAR Attr)
Definition: ui.c:244
unsigned int ULONG
Definition: retypes.h:1
ULONG UiScreenWidth
Definition: ui.c:56
VOID TuiUpdateDateTime(VOID)
Definition: tui.c:552
#define KEY_END
Definition: keycodes.h:64
int k
Definition: mpi.c:3369
#define D_VERT
Definition: ui.h:346
#define KEY_ENTER
Definition: keycodes.h:39
Definition: copy.c:22
#define TAG_TUI_SCREENBUFFER
Definition: tui.c:201
FORCEINLINE VOID FrLdrTempFree(PVOID Allocation, ULONG Tag)
Definition: mm.h:197

◆ TuiFadeInBackdrop()

VOID TuiFadeInBackdrop ( VOID  )

Definition at line 928 of file tui.c.

929 {
930  PPALETTE_ENTRY TuiFadePalette = NULL;
931 
933  {
934  TuiFadePalette = (PPALETTE_ENTRY)FrLdrTempAlloc(sizeof(PALETTE_ENTRY) * 64,
936 
937  if (TuiFadePalette != NULL)
938  {
939  VideoSavePaletteState(TuiFadePalette, 64);
941  }
942  }
943 
944  // Draw the backdrop and title box
945  TuiDrawBackdrop();
946 
947  if (UiUseSpecialEffects && ! MachVideoIsPaletteFixed() && TuiFadePalette != NULL)
948  {
949  VideoFadeIn(TuiFadePalette, 64);
950  FrLdrTempFree(TuiFadePalette, TAG_TUI_PALETTE);
951  }
952 }
VOID VideoFadeIn(PPALETTE_ENTRY Palette, ULONG ColorCount)
Definition: video.c:80
VOID VideoSavePaletteState(PPALETTE_ENTRY Palette, ULONG ColorCount)
Definition: video.c:45
FORCEINLINE PVOID FrLdrTempAlloc(_In_ SIZE_T Size, _In_ ULONG Tag)
Definition: mm.h:188
Definition: video.h:11
struct _PALETTE_ENTRY * PPALETTE_ENTRY
VOID TuiDrawBackdrop(VOID)
Definition: tui.c:275
#define TAG_TUI_PALETTE
Definition: tui.c:202
BOOLEAN UiUseSpecialEffects
Definition: ui.c:47
#define NULL
Definition: types.h:112
#define MachVideoIsPaletteFixed()
Definition: machine.h:110
VOID VideoSetAllColorsToBlack(ULONG ColorCount)
Definition: video.c:68
FORCEINLINE VOID FrLdrTempFree(PVOID Allocation, ULONG Tag)
Definition: mm.h:197

◆ TuiFadeOut()

VOID TuiFadeOut ( VOID  )

Definition at line 954 of file tui.c.

955 {
956  PPALETTE_ENTRY TuiFadePalette = NULL;
957 
959  {
960  TuiFadePalette = (PPALETTE_ENTRY)FrLdrTempAlloc(sizeof(PALETTE_ENTRY) * 64,
962 
963  if (TuiFadePalette != NULL)
964  {
965  VideoSavePaletteState(TuiFadePalette, 64);
966  }
967  }
968 
969  if (UiUseSpecialEffects && ! MachVideoIsPaletteFixed() && TuiFadePalette != NULL)
970  {
971  VideoFadeOut(64);
972  }
973 
975 
976  if (UiUseSpecialEffects && ! MachVideoIsPaletteFixed() && TuiFadePalette != NULL)
977  {
978  VideoRestorePaletteState(TuiFadePalette, 64);
979  FrLdrTempFree(TuiFadePalette, TAG_TUI_PALETTE);
980  }
981 
982 }
VOID VideoSavePaletteState(PPALETTE_ENTRY Palette, ULONG ColorCount)
Definition: video.c:45
#define FALSE
Definition: types.h:117
FORCEINLINE PVOID FrLdrTempAlloc(_In_ SIZE_T Size, _In_ ULONG Tag)
Definition: mm.h:188
Definition: video.h:11
struct _PALETTE_ENTRY * PPALETTE_ENTRY
VOID VideoFadeOut(ULONG ColorCount)
Definition: video.c:139
#define TAG_TUI_PALETTE
Definition: tui.c:202
BOOLEAN UiUseSpecialEffects
Definition: ui.c:47
#define NULL
Definition: types.h:112
#define MachVideoSetDisplayMode(Mode, Init)
Definition: machine.h:94
#define MachVideoIsPaletteFixed()
Definition: machine.h:110
VOID VideoRestorePaletteState(PPALETTE_ENTRY Palette, ULONG ColorCount)
Definition: video.c:55
FORCEINLINE VOID FrLdrTempFree(PVOID Allocation, ULONG Tag)
Definition: mm.h:197

Referenced by TuiUnInitialize().

◆ TuiFillArea()

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

Definition at line 332 of file tui.c.

333 {
334  PUCHAR ScreenMemory = (PUCHAR)TextVideoBuffer;
335  ULONG i, j;
336 
337  /* Clip the area to the screen */
338  if ((Left >= UiScreenWidth) || (Top >= UiScreenHeight))
339  {
340  return;
341  }
342  if (Right >= UiScreenWidth)
343  Right = UiScreenWidth - 1;
344  if (Bottom >= UiScreenHeight)
345  Bottom = UiScreenHeight - 1;
346 
347  /* Loop through each line and column and fill it in */
348  for (i = Top; i <= Bottom; ++i)
349  {
350  for (j = Left; j <= Right; ++j)
351  {
352  ScreenMemory[((i*2)*UiScreenWidth)+(j*2)] = (UCHAR)FillChar;
353  ScreenMemory[((i*2)*UiScreenWidth)+(j*2)+1] = Attr;
354  }
355  }
356 }
unsigned char * PUCHAR
Definition: retypes.h:3
ULONG UiScreenHeight
Definition: ui.c:57
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
PVOID TextVideoBuffer
Definition: tui.c:23
unsigned char UCHAR
Definition: xmlstorage.h:181
static LPHIST_ENTRY Bottom
Definition: history.c:54
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int ULONG
Definition: retypes.h:1
ULONG UiScreenWidth
Definition: ui.c:56
static LPHIST_ENTRY Top
Definition: history.c:53

Referenced by MiniTuiDrawBackdrop(), MiniTuiSetProgressBarText(), MiniTuiTickProgressBar(), TuiDrawBackdrop(), TuiDrawBox(), TuiDrawBoxBottomLine(), TuiDrawBoxTopLine(), TuiDrawMenuTimeout(), TuiSetProgressBarText(), and TuiTickProgressBar().

◆ TuiInitialize()

BOOLEAN TuiInitialize ( VOID  )

Definition at line 206 of file tui.c.

207 {
211 
213  if (TextVideoBuffer == NULL)
214  {
215  return FALSE;
216  }
217 
218  /* Load default settings with "Full" TUI Theme */
219 
236 
237  UiShowTime = TRUE;
238  UiMenuBox = TRUE;
239  UiCenterMenu = TRUE;
241 
242  // TODO: Have a boolean to show/hide title box?
244  "Boot Menu");
245 
247  "[Time Remaining: %d]");
248 
249  return TRUE;
250 }
UCHAR UiTextColor
Definition: ui.c:38
#define COLOR_YELLOW
Definition: ui.h:334
#define COLOR_BLACK
Definition: ui.h:319
CHAR UiTitleBoxTitleText[260]
Definition: ui.c:49
#define TRUE
Definition: types.h:120
UCHAR UiMessageBoxFgColor
Definition: ui.c:34
UCHAR UiTitleBoxBgColor
Definition: ui.c:33
BOOLEAN UiCenterMenu
Definition: ui.c:46
NTSTRSAFEAPI RtlStringCbCopyA(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ NTSTRSAFE_PCSTR pszSrc)
Definition: ntstrsafe.h:156
#define FALSE
Definition: types.h:117
UCHAR UiEditBoxTextColor
Definition: ui.c:41
#define ATTR(cFore, cBack)
Definition: ui.h:314
#define COLOR_RED
Definition: ui.h:323
BOOLEAN UiMenuBox
Definition: ui.c:45
PVOID TextVideoBuffer
Definition: tui.c:23
#define COLOR_CYAN
Definition: ui.h:322
UCHAR UiBackdropFillStyle
Definition: ui.c:31
UCHAR UiEditBoxBgColor
Definition: ui.c:42
#define COLOR_BLUE
Definition: ui.h:320
UCHAR UiStatusBarBgColor
Definition: ui.c:28
#define MachVideoClearScreen(Attr)
Definition: machine.h:92
UCHAR UiMenuBgColor
Definition: ui.c:37
UCHAR UiTitleBoxFgColor
Definition: ui.c:32
#define MachVideoHideShowTextCursor(Show)
Definition: machine.h:104
BOOLEAN UiUseSpecialEffects
Definition: ui.c:47
#define COLOR_WHITE
Definition: ui.h:335
UCHAR UiBackdropBgColor
Definition: ui.c:30
UCHAR UiSelectedTextBgColor
Definition: ui.c:40
#define MachVideoSetTextCursorPosition(X, Y)
Definition: machine.h:102
UCHAR UiMessageBoxBgColor
Definition: ui.c:35
#define NULL
Definition: types.h:112
PVOID VideoAllocateOffScreenBuffer(VOID)
Definition: video.c:17
UCHAR UiBackdropFgColor
Definition: ui.c:29
UCHAR UiMenuFgColor
Definition: ui.c:36
CHAR UiTimeText[260]
Definition: ui.c:50
#define MEDIUM_FILL
Definition: ui.h:308
UCHAR UiStatusBarFgColor
Definition: ui.c:27
UCHAR UiSelectedTextColor
Definition: ui.c:39
BOOLEAN UiShowTime
Definition: ui.c:44

Referenced by MiniTuiInitialize().

◆ TuiMessageBox()

VOID TuiMessageBox ( PCSTR  MessageText)

Definition at line 642 of file tui.c.

643 {
645 
646  // Save the screen contents
650 
651  // Display the message box
652  TuiMessageBoxCritical(MessageText);
653 
654  // Restore the screen contents
657 }
ULONG UiScreenHeight
Definition: ui.c:57
VOID TuiSaveScreen(PUCHAR Buffer)
Definition: tui.c:620
FORCEINLINE PVOID FrLdrTempAlloc(_In_ SIZE_T Size, _In_ ULONG Tag)
Definition: mm.h:188
VOID TuiMessageBoxCritical(PCSTR MessageText)
Definition: tui.c:659
VOID TuiRestoreScreen(PUCHAR Buffer)
Definition: tui.c:631
HANDLE ScreenBuffer
Definition: notevil.c:37
ULONG UiScreenWidth
Definition: ui.c:56
#define TAG_TUI_SCREENBUFFER
Definition: tui.c:201
FORCEINLINE VOID FrLdrTempFree(PVOID Allocation, ULONG Tag)
Definition: mm.h:197

◆ TuiMessageBoxCritical()

VOID TuiMessageBoxCritical ( PCSTR  MessageText)

Definition at line 659 of file tui.c.

660 {
661  int width = 8;
662  unsigned int height = 1;
663  int curline = 0;
664  int k;
665  size_t i , j;
666  int x1, x2, y1, y2;
667  char temp[260];
668  char key;
669 
670  // Find the height
671  for (i=0; i<strlen(MessageText); i++)
672  {
673  if (MessageText[i] == '\n')
674  height++;
675  }
676 
677  // Find the width
678  for (i=0,j=0,k=0; i<height; i++)
679  {
680  while ((MessageText[j] != '\n') && (MessageText[j] != 0))
681  {
682  j++;
683  k++;
684  }
685 
686  if (k > width)
687  width = k;
688 
689  k = 0;
690  j++;
691  }
692 
693  // Calculate box area
694  x1 = (UiScreenWidth - (width+2))/2;
695  x2 = x1 + width + 3;
696  y1 = ((UiScreenHeight - height - 2)/2) + 1;
697  y2 = y1 + height + 4;
698 
699  // Draw the box
701 
702  // Draw the text
703  for (i=0,j=0; i<strlen(MessageText)+1; i++)
704  {
705  if ((MessageText[i] == '\n') || (MessageText[i] == 0))
706  {
707  temp[j] = 0;
708  j = 0;
710  curline++;
711  }
712  else
713  temp[j++] = MessageText[i];
714  }
715 
716  // Draw OK button
717  strcpy(temp, " OK ");
718  UiDrawText(x1+((x2-x1)/2)-3, y2-2, temp, ATTR(COLOR_BLACK, COLOR_GRAY));
719 
720  // Draw status text
721  UiDrawStatusText("Press ENTER to continue");
722 
724 
725  for (;;)
726  {
727  if (MachConsKbHit())
728  {
729  key = MachConsGetCh();
730  if (key == KEY_EXTENDED)
731  key = MachConsGetCh();
732 
733  if ((key == KEY_ENTER) || (key == KEY_SPACE) || (key == KEY_ESC))
734  break;
735  }
736 
738 
740 
741  MachHwIdle();
742  }
743 }
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3706
GLint GLint GLsizei width
Definition: gl.h:1546
#define MachConsGetCh()
Definition: machine.h:90
#define COLOR_BLACK
Definition: ui.h:319
#define MachHwIdle()
Definition: machine.h:137
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define TRUE
Definition: types.h:120
UCHAR UiMessageBoxFgColor
Definition: ui.c:34
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
ULONG UiScreenHeight
Definition: ui.c:57
#define KEY_EXTENDED
Definition: keycodes.h:38
VOID VideoCopyOffScreenBufferToVRAM(VOID)
Definition: video.c:39
VOID TuiDrawBox(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Right, _In_ ULONG Bottom, _In_ UCHAR VertStyle, _In_ UCHAR HorzStyle, _In_ BOOLEAN Fill, _In_ BOOLEAN Shadow, _In_ UCHAR Attr)
Definition: tui.c:507
#define ATTR(cFore, cBack)
Definition: ui.h:314
VOID UiDrawText(_In_ ULONG X, _In_ ULONG Y, _In_ PCSTR Text, _In_ UCHAR Attr)
Definition: ui.c:260
#define MachConsKbHit()
Definition: machine.h:88
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define D_HORZ
Definition: ui.h:344
#define KEY_ESC
Definition: keycodes.h:49
VOID UiDrawStatusText(PCSTR StatusText)
Definition: ui.c:292
HKEY key
Definition: reg.c:28
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG _In_ LONG y2
Definition: winddi.h:3706
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static calc_node_t temp
Definition: rpn_ieee.c:38
#define KEY_SPACE
Definition: keycodes.h:42
UCHAR UiMessageBoxBgColor
Definition: ui.c:35
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3706
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
ULONG UiScreenWidth
Definition: ui.c:56
VOID TuiUpdateDateTime(VOID)
Definition: tui.c:552
int k
Definition: mpi.c:3369
#define D_VERT
Definition: ui.h:346
#define KEY_ENTER
Definition: keycodes.h:39
Definition: copy.c:22

Referenced by TuiMessageBox().

◆ TuiPrintf()

INT TuiPrintf ( _In_ PCSTR  Format,
  ... 
)

Definition at line 33 of file tui.c.

35 {
36  INT i;
37  INT Length;
38  va_list ap;
39  CHAR Buffer[512];
40 
41  va_start(ap, Format);
42  Length = _vsnprintf(Buffer, sizeof(Buffer), Format, ap);
43  va_end(ap);
44 
45  if (Length == -1)
46  Length = (INT)sizeof(Buffer);
47 
48  for (i = 0; i < Length; i++)
49  {
51  }
52 
53  return Length;
54 }
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
char CHAR
Definition: xmlstorage.h:175
#define INT
Definition: polytest.cpp:20
int32_t INT
Definition: typedefs.h:58
#define va_end(ap)
Definition: acmsvcex.h:90
char * va_list
Definition: acmsvcex.h:78
Definition: bufpool.h:45
#define MachConsPutChar(Ch)
Definition: machine.h:86
va_start(ap, x)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define _vsnprintf
Definition: xmlstorage.h:202
void int int ULONGLONG int va_list * ap
Definition: winesup.h:32

Referenced by MachInit().

◆ TuiRestoreScreen()

VOID TuiRestoreScreen ( PUCHAR  Buffer)

Definition at line 631 of file tui.c.

632 {
633  PUCHAR ScreenMemory = (PUCHAR)TextVideoBuffer;
634  ULONG i;
635 
636  for (i=0; i < (UiScreenWidth * UiScreenHeight * 2); i++)
637  {
638  ScreenMemory[i] = Buffer[i];
639  }
640 }
unsigned char * PUCHAR
Definition: retypes.h:3
ULONG UiScreenHeight
Definition: ui.c:57
Definition: bufpool.h:45
PVOID TextVideoBuffer
Definition: tui.c:23
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int ULONG
Definition: retypes.h:1
ULONG UiScreenWidth
Definition: ui.c:56

Referenced by TuiEditBox(), and TuiMessageBox().

◆ TuiSaveScreen()

VOID TuiSaveScreen ( PUCHAR  Buffer)

Definition at line 620 of file tui.c.

621 {
622  PUCHAR ScreenMemory = (PUCHAR)TextVideoBuffer;
623  ULONG i;
624 
625  for (i=0; i < (UiScreenWidth * UiScreenHeight * 2); i++)
626  {
627  Buffer[i] = ScreenMemory[i];
628  }
629 }
unsigned char * PUCHAR
Definition: retypes.h:3
ULONG UiScreenHeight
Definition: ui.c:57
Definition: bufpool.h:45
PVOID TextVideoBuffer
Definition: tui.c:23
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int ULONG
Definition: retypes.h:1
ULONG UiScreenWidth
Definition: ui.c:56

Referenced by TuiEditBox(), and TuiMessageBox().

◆ TuiTextToColor()

UCHAR TuiTextToColor ( PCSTR  ColorText)

Definition at line 865 of file tui.c.

866 {
867  static const struct
868  {
869  PCSTR ColorName;
870  UCHAR ColorValue;
871  } Colors[] =
872  {
873  {"Black" , COLOR_BLACK },
874  {"Blue" , COLOR_BLUE },
875  {"Green" , COLOR_GREEN },
876  {"Cyan" , COLOR_CYAN },
877  {"Red" , COLOR_RED },
878  {"Magenta", COLOR_MAGENTA},
879  {"Brown" , COLOR_BROWN },
880  {"Gray" , COLOR_GRAY },
881  {"DarkGray" , COLOR_DARKGRAY },
882  {"LightBlue" , COLOR_LIGHTBLUE },
883  {"LightGreen" , COLOR_LIGHTGREEN },
884  {"LightCyan" , COLOR_LIGHTCYAN },
885  {"LightRed" , COLOR_LIGHTRED },
886  {"LightMagenta", COLOR_LIGHTMAGENTA},
887  {"Yellow" , COLOR_YELLOW },
888  {"White" , COLOR_WHITE },
889  };
890  ULONG i;
891 
892  if (_stricmp(ColorText, "Default") == 0)
893  return MachDefaultTextColor;
894 
895  for (i = 0; i < RTL_NUMBER_OF(Colors); ++i)
896  {
897  if (_stricmp(ColorText, Colors[i].ColorName) == 0)
898  return Colors[i].ColorValue;
899  }
900 
901  return COLOR_BLACK;
902 }
#define COLOR_YELLOW
Definition: ui.h:334
#define COLOR_BLACK
Definition: ui.h:319
#define COLOR_LIGHTBLUE
Definition: ui.h:329
#define COLOR_LIGHTMAGENTA
Definition: ui.h:333
#define _stricmp
Definition: cat.c:22
#define COLOR_DARKGRAY
Definition: ui.h:328
#define COLOR_RED
Definition: ui.h:323
#define COLOR_BROWN
Definition: ui.h:325
Colors
Definition: ansiprsr.h:4
#define COLOR_CYAN
Definition: ui.h:322
#define COLOR_BLUE
Definition: ui.h:320
#define COLOR_LIGHTCYAN
Definition: ui.h:331
unsigned char UCHAR
Definition: xmlstorage.h:181
#define COLOR_GREEN
Definition: ui.h:321
#define COLOR_LIGHTRED
Definition: ui.h:332
#define COLOR_WHITE
Definition: ui.h:335
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
#define COLOR_MAGENTA
Definition: ui.h:324
UCHAR MachDefaultTextColor
Definition: pcvideo.c:111
unsigned int ULONG
Definition: retypes.h:1
const char * PCSTR
Definition: typedefs.h:52
#define COLOR_LIGHTGREEN
Definition: ui.h:330

Referenced by MiniTuiInitialize().

◆ TuiTextToFillStyle()

UCHAR TuiTextToFillStyle ( PCSTR  FillStyleText)

Definition at line 904 of file tui.c.

905 {
906  static const struct
907  {
908  PCSTR FillStyleName;
909  UCHAR FillStyleValue;
910  } FillStyles[] =
911  {
912  {"None" , ' '},
913  {"Light" , LIGHT_FILL },
914  {"Medium", MEDIUM_FILL},
915  {"Dark" , DARK_FILL },
916  };
917  ULONG i;
918 
919  for (i = 0; i < RTL_NUMBER_OF(FillStyles); ++i)
920  {
921  if (_stricmp(FillStyleText, FillStyles[i].FillStyleName) == 0)
922  return FillStyles[i].FillStyleValue;
923  }
924 
925  return LIGHT_FILL;
926 }
#define DARK_FILL
Definition: ui.h:309
#define _stricmp
Definition: cat.c:22
#define LIGHT_FILL
Definition: ui.h:307
unsigned char UCHAR
Definition: xmlstorage.h:181
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
unsigned int ULONG
Definition: retypes.h:1
const char * PCSTR
Definition: typedefs.h:52
#define MEDIUM_FILL
Definition: ui.h:308

◆ TuiTruncateStringEllipsis()

VOID TuiTruncateStringEllipsis ( _Inout_z_ PSTR  StringText,
_In_ ULONG  MaxChars 
)

Definition at line 57 of file tui.c.

60 {
61  /* If it's too large, just add some ellipsis past the maximum */
62  if (strlen(StringText) > MaxChars)
63  strcpy(&StringText[MaxChars - 3], "...");
64 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388

Referenced by MiniTuiSetProgressBarText(), and TuiSetProgressBarText().

◆ TuiUnInitialize()

VOID TuiUnInitialize ( VOID  )

Definition at line 252 of file tui.c.

253 {
254  /* Do nothing if already uninitialized */
255  if (!TextVideoBuffer)
256  return;
257 
259  {
260  TuiFadeOut();
261  }
262  else
263  {
265  }
266 
269 
273 }
#define COLOR_BLACK
Definition: ui.h:319
#define TRUE
Definition: types.h:120
VOID VideoFreeOffScreenBuffer(VOID)
Definition: video.c:30
VOID TuiFadeOut(VOID)
Definition: tui.c:954
#define FALSE
Definition: types.h:117
#define ATTR(cFore, cBack)
Definition: ui.h:314
PVOID TextVideoBuffer
Definition: tui.c:23
#define MachVideoClearScreen(Attr)
Definition: machine.h:92
#define MachVideoHideShowTextCursor(Show)
Definition: machine.h:104
BOOLEAN UiUseSpecialEffects
Definition: ui.c:47
#define MachVideoSetTextCursorPosition(X, Y)
Definition: machine.h:102
#define NULL
Definition: types.h:112
#define MachVideoSetDisplayMode(Mode, Init)
Definition: machine.h:94

◆ TuiUpdateDateTime()

VOID TuiUpdateDateTime ( VOID  )

Definition at line 552 of file tui.c.

553 {
554  TIMEINFO* TimeInfo;
555  PCSTR DayPostfix;
556  BOOLEAN PMHour = FALSE;
557  CHAR Buffer[40];
558 
559  /* Don't draw the time if this has been disabled */
560  if (!UiShowTime) return;
561 
562  TimeInfo = ArcGetTime();
563  if (TimeInfo->Year < 1 || 9999 < TimeInfo->Year ||
564  TimeInfo->Month < 1 || 12 < TimeInfo->Month ||
565  TimeInfo->Day < 1 || 31 < TimeInfo->Day ||
566  23 < TimeInfo->Hour ||
567  59 < TimeInfo->Minute ||
568  59 < TimeInfo->Second)
569  {
570  /* This happens on QEmu sometimes. We just skip updating. */
571  return;
572  }
573 
574  /* Get the day postfix */
575  if (1 == TimeInfo->Day || 21 == TimeInfo->Day || 31 == TimeInfo->Day)
576  DayPostfix = "st";
577  else if (2 == TimeInfo->Day || 22 == TimeInfo->Day)
578  DayPostfix = "nd";
579  else if (3 == TimeInfo->Day || 23 == TimeInfo->Day)
580  DayPostfix = "rd";
581  else
582  DayPostfix = "th";
583 
584  /* Build the date string in format: "MMMM dx yyyy" */
586  "%s %d%s %d",
587  UiMonthNames[TimeInfo->Month - 1],
588  TimeInfo->Day,
589  DayPostfix,
590  TimeInfo->Year);
591 
592  /* Draw the date */
595 
596  /* Get the hour and change from 24-hour mode to 12-hour */
597  if (TimeInfo->Hour > 12)
598  {
599  TimeInfo->Hour -= 12;
600  PMHour = TRUE;
601  }
602  if (TimeInfo->Hour == 0)
603  {
604  TimeInfo->Hour = 12;
605  }
606 
607  /* Build the time string in format: "h:mm:ss tt" */
609  " %d:%02d:%02d %s",
610  TimeInfo->Hour,
611  TimeInfo->Minute,
612  TimeInfo->Second,
613  PMHour ? "PM" : "AM");
614 
615  /* Draw the time */
618 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define TRUE
Definition: types.h:120
char CHAR
Definition: xmlstorage.h:175
const PCSTR UiMonthNames[12]
Definition: ui.c:52
USHORT Second
Definition: fw.h:16
UCHAR UiTitleBoxBgColor
Definition: ui.c:33
USHORT Month
Definition: fw.h:12
VOID TuiDrawText(_In_ ULONG X, _In_ ULONG Y, _In_ PCSTR Text, _In_ UCHAR Attr)
Definition: tui.c:72
USHORT Minute
Definition: fw.h:15
#define FALSE
Definition: types.h:117
Definition: fw.h:9
#define ATTR(cFore, cBack)
Definition: ui.h:314
unsigned char BOOLEAN
Definition: bufpool.h:45
TIMEINFO * ArcGetTime(VOID)
Definition: arcemul.c:27
NTSTRSAFEVAPI RtlStringCbPrintfA(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,...)
Definition: ntstrsafe.h:1148
USHORT Year
Definition: fw.h:11
UCHAR UiTitleBoxFgColor
Definition: ui.c:32
USHORT Hour
Definition: fw.h:14
unsigned int ULONG
Definition: retypes.h:1
USHORT Day
Definition: fw.h:13
const char * PCSTR
Definition: typedefs.h:52
ULONG UiScreenWidth
Definition: ui.c:56
BOOLEAN UiShowTime
Definition: ui.c:44

Referenced by MiniTuiTickProgressBar(), TuiDisplayMenu(), TuiDrawBackdrop(), TuiDrawMenuBox(), TuiEditBox(), TuiMessageBoxCritical(), and TuiTickProgressBar().

Variable Documentation

◆ TuiVtbl

const UIVTBL TuiVtbl

Definition at line 1217 of file tui.c.

Referenced by UiInitialize().