ReactOS  0.4.15-dev-2153-g62b4c61
tui.c File Reference
#include <freeldr.h>
Include dependency graph for tui.c:

Go to the source code of this file.

Macros

#define TAG_TUI_SCREENBUFFER   'SiuT'
 
#define TAG_TAG_TUI_PALETTE   'PiuT'
 

Functions

int TuiPrintf (const char *Format,...)
 
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 (ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR VertStyle, UCHAR HorzStyle, BOOLEAN Fill, BOOLEAN Shadow, UCHAR Attr)
 
VOID TuiDrawText (ULONG X, ULONG Y, PCSTR Text, UCHAR Attr)
 
VOID TuiDrawText2 (ULONG X, ULONG Y, ULONG MaxNumChars, PCSTR Text, UCHAR Attr)
 
VOID TuiDrawCenteredText (ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, PCSTR TextString, 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)
 
VOID TuiDrawProgressBarCenter (ULONG Position, ULONG Range, PCHAR ProgressText)
 
VOID TuiDrawProgressBar (ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, ULONG Position, ULONG Range, PCHAR ProgressText)
 
UCHAR TuiTextToColor (PCSTR ColorText)
 
UCHAR TuiTextToFillStyle (PCSTR FillStyleText)
 
VOID TuiFadeInBackdrop (VOID)
 
VOID TuiFadeOut (VOID)
 
BOOLEAN TuiEditBox (PCSTR MessageText, PCHAR EditTextBuffer, ULONG Length)
 

Variables

PVOID TextVideoBuffer = NULL
 
UCHAR MachDefaultTextColor
 
const UIVTBL TuiVtbl
 

Macro Definition Documentation

◆ TAG_TAG_TUI_PALETTE

#define TAG_TAG_TUI_PALETTE   'PiuT'

Definition at line 23 of file tui.c.

◆ TAG_TUI_SCREENBUFFER

#define TAG_TUI_SCREENBUFFER   'SiuT'

Definition at line 22 of file tui.c.

Function Documentation

◆ TuiDrawBackdrop()

VOID TuiDrawBackdrop ( VOID  )

Definition at line 84 of file tui.c.

85 {
86  //
87  // Fill in the background (excluding title box & status bar)
88  //
89  TuiFillArea(0,
91  UiScreenWidth - 1,
92  UiScreenHeight - 2,
95 
96  //
97  // Draw the title box
98  //
99  TuiDrawBox(0,
100  0,
101  UiScreenWidth - 1,
103  D_VERT,
104  D_HORZ,
105  TRUE,
106  FALSE,
108 
109  //
110  // Draw version text
111  //
112  TuiDrawText(2,
113  1,
116 
117  //
118  // Draw copyright
119  //
120  TuiDrawText(2,
121  2,
122  BY_AUTHOR,
124  TuiDrawText(2,
125  3,
126  AUTHOR_EMAIL,
128 
129  //
130  // Draw help text
131  //
132  TuiDrawText(UiScreenWidth - 16, 3, /*"F1 for Help"*/"F8 for Options", ATTR(UiTitleBoxFgColor, UiTitleBoxBgColor));
133 
134  //
135  // Draw title text
136  //
138  2,
141 
142  //
143  // Update the date & time
144  //
146 
148 }
CHAR UiTitleBoxTitleText[260]
Definition: ui.c:48
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define TRUE
Definition: types.h:120
VOID TuiDrawText(ULONG X, ULONG Y, PCSTR Text, UCHAR Attr)
Definition: tui.c:321
ULONG UiScreenHeight
Definition: ui.c:29
#define TUI_TITLE_BOX_CHAR_HEIGHT
Definition: tui.h:22
UCHAR UiTitleBoxBgColor
Definition: ui.c:37
VOID VideoCopyOffScreenBufferToVRAM(VOID)
Definition: video.c:34
#define FALSE
Definition: types.h:117
VOID TuiDrawBox(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR VertStyle, UCHAR HorzStyle, BOOLEAN Fill, BOOLEAN Shadow, UCHAR Attr)
Definition: tui.c:249
#define ATTR(cFore, cBack)
Definition: ui.h:192
const PCSTR FrLdrVersionString
Definition: freeldr.c:32
#define D_HORZ
Definition: ui.h:229
UCHAR UiBackdropFillStyle
Definition: ui.c:35
#define AUTHOR_EMAIL
Definition: ver.h:25
UCHAR UiTitleBoxFgColor
Definition: ui.c:36
UCHAR UiBackdropBgColor
Definition: ui.c:34
VOID TuiFillArea(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, CHAR FillChar, UCHAR Attr)
Definition: tui.c:154
#define BY_AUTHOR
Definition: ver.h:26
unsigned int ULONG
Definition: retypes.h:1
UCHAR UiBackdropFgColor
Definition: ui.c:33
ULONG UiScreenWidth
Definition: ui.c:28
VOID TuiUpdateDateTime(VOID)
Definition: tui.c:429
#define D_VERT
Definition: ui.h:231

Referenced by TuiFadeInBackdrop().

◆ TuiDrawBox()

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

Definition at line 249 of file tui.c.

250 {
251  UCHAR ULCorner, URCorner, LLCorner, LRCorner;
252 
253  // Calculate the corner values
254  if (HorzStyle == HORZ)
255  {
256  if (VertStyle == VERT)
257  {
258  ULCorner = UL;
259  URCorner = UR;
260  LLCorner = LL;
261  LRCorner = LR;
262  }
263  else // VertStyle == D_VERT
264  {
265  ULCorner = VD_UL;
266  URCorner = VD_UR;
267  LLCorner = VD_LL;
268  LRCorner = VD_LR;
269  }
270  }
271  else // HorzStyle == D_HORZ
272  {
273  if (VertStyle == VERT)
274  {
275  ULCorner = HD_UL;
276  URCorner = HD_UR;
277  LLCorner = HD_LL;
278  LRCorner = HD_LR;
279  }
280  else // VertStyle == D_VERT
281  {
282  ULCorner = D_UL;
283  URCorner = D_UR;
284  LLCorner = D_LL;
285  LRCorner = D_LR;
286  }
287  }
288 
289  // Fill in box background
290  if (Fill)
291  {
292  TuiFillArea(Left, Top, Right, Bottom, ' ', Attr);
293  }
294 
295  // Fill in corners
296  TuiFillArea(Left, Top, Left, Top, ULCorner, Attr);
297  TuiFillArea(Right, Top, Right, Top, URCorner, Attr);
298  TuiFillArea(Left, Bottom, Left, Bottom, LLCorner, Attr);
299  TuiFillArea(Right, Bottom, Right, Bottom, LRCorner, Attr);
300 
301  // Fill in left line
302  TuiFillArea(Left, Top+1, Left, Bottom-1, VertStyle, Attr);
303  // Fill in top line
304  TuiFillArea(Left+1, Top, Right-1, Top, HorzStyle, Attr);
305  // Fill in right line
306  TuiFillArea(Right, Top+1, Right, Bottom-1, VertStyle, Attr);
307  // Fill in bottom line
308  TuiFillArea(Left+1, Bottom, Right-1, Bottom, HorzStyle, Attr);
309 
310  // Draw the shadow
311  if (Shadow)
312  {
313  TuiDrawShadow(Left, Top, Right, Bottom);
314  }
315 }
#define HD_UL
Definition: tui.h:92
#define VD_UL
Definition: tui.h:97
#define LR
Definition: tui.h:85
#define D_UR
Definition: tui.h:88
#define LL
Definition: tui.h:84
void Fill(HDC hdc, LONG x, LONG y, COLORREF color)
Definition: drawing.cpp:109
#define D_UL
Definition: tui.h:87
#define HORZ
Definition: ui.h:228
#define UR
Definition: tui.h:83
#define HD_LL
Definition: tui.h:94
#define VD_UR
Definition: tui.h:98
#define D_LL
Definition: tui.h:89
#define VD_LL
Definition: tui.h:99
#define VD_LR
Definition: tui.h:100
unsigned char UCHAR
Definition: xmlstorage.h:181
VOID TuiDrawShadow(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom)
Definition: tui.c:189
VOID TuiFillArea(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, CHAR FillChar, UCHAR Attr)
Definition: tui.c:154
#define HD_LR
Definition: tui.h:95
static LPHIST_ENTRY Bottom
Definition: history.c:54
#define D_LR
Definition: tui.h:90
#define UL
Definition: tui.h:82
static LPHIST_ENTRY Top
Definition: history.c:53
#define VERT
Definition: ui.h:230
#define HD_UR
Definition: tui.h:93

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

◆ TuiDrawCenteredText()

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

Definition at line 353 of file tui.c.

354 {
355  SIZE_T TextLength;
356  ULONG BoxWidth;
357  ULONG BoxHeight;
358  ULONG LineBreakCount;
359  SIZE_T Index;
360  SIZE_T LastIndex;
361  ULONG RealLeft;
362  ULONG RealTop;
363  ULONG X;
364  ULONG Y;
365  CHAR Temp[2];
366 
367  TextLength = strlen(TextString);
368 
369  // Count the new lines and the box width
370  LineBreakCount = 0;
371  BoxWidth = 0;
372  LastIndex = 0;
373  for (Index=0; Index<TextLength; Index++)
374  {
375  if (TextString[Index] == '\n')
376  {
377  LastIndex = Index;
378  LineBreakCount++;
379  }
380  else
381  {
382  if ((Index - LastIndex) > BoxWidth)
383  {
384  BoxWidth = (ULONG)(Index - LastIndex);
385  }
386  }
387  }
388 
389  BoxHeight = LineBreakCount + 1;
390 
391  RealLeft = (((Right - Left) - BoxWidth) / 2) + Left;
392  RealTop = (((Bottom - Top) - BoxHeight) / 2) + Top;
393 
394  LastIndex = 0;
395  for (Index=0; Index<TextLength; Index++)
396  {
397  if (TextString[Index] == '\n')
398  {
399  RealTop++;
400  LastIndex = 0;
401  }
402  else
403  {
404  X = (ULONG)(RealLeft + LastIndex);
405  Y = RealTop;
406  LastIndex++;
407  Temp[0] = TextString[Index];
408  Temp[1] = 0;
409  TuiDrawText(X, Y, Temp, Attr);
410  }
411  }
412 }
#define Y(I)
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
VOID TuiDrawText(ULONG X, ULONG Y, PCSTR Text, UCHAR Attr)
Definition: tui.c:321
char CHAR
Definition: xmlstorage.h:175
_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 MiniTuiDrawProgressBar(), and TuiDrawProgressBar().

◆ TuiDrawProgressBar()

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

Definition at line 664 of file tui.c.

665 {
666  ULONG i;
667  ULONG ProgressBarWidth = (Right - Left) - 3;
668 
669  // First make sure the progress bar text fits
670  UiTruncateStringEllipsis(ProgressText, ProgressBarWidth - 4);
671 
672  if (Position > Range)
673  {
674  Position = Range;
675  }
676 
677  // Draw the box
679 
680  //
681  // Draw the "Loading..." text
682  //
683  TuiDrawCenteredText(Left + 2, Top + 2, Right - 2, Top + 2, ProgressText, ATTR(UiTextColor, UiMenuBgColor));
684 
685  // Draw the percent complete
686  for (i=0; i<(Position*ProgressBarWidth)/Range; i++)
687  {
688  TuiDrawText(Left+2+i, Top+2, "\xDB", ATTR(UiTextColor, UiMenuBgColor));
689  }
690 
691  // Draw the shadow
692  for (; i<ProgressBarWidth; i++)
693  {
694  TuiDrawText(Left+2+i, Top+2, "\xB2", ATTR(UiTextColor, UiMenuBgColor));
695  }
696 
699 }
UCHAR UiTextColor
Definition: ui.c:42
#define TRUE
Definition: types.h:120
VOID TuiDrawCenteredText(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, PCSTR TextString, UCHAR Attr)
Definition: tui.c:353
VOID TuiDrawText(ULONG X, ULONG Y, PCSTR Text, UCHAR Attr)
Definition: tui.c:321
static COORD Position
Definition: mouse.c:34
#define HORZ
Definition: ui.h:228
VOID VideoCopyOffScreenBufferToVRAM(VOID)
Definition: video.c:34
static ULONG ProgressBarWidth
Definition: inbv.c:87
struct tagRange Range
VOID TuiDrawBox(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR VertStyle, UCHAR HorzStyle, BOOLEAN Fill, BOOLEAN Shadow, UCHAR Attr)
Definition: tui.c:249
#define ATTR(cFore, cBack)
Definition: ui.h:192
UCHAR UiMenuBgColor
Definition: ui.c:41
Definition: range.c:39
VOID UiTruncateStringEllipsis(PCHAR StringText, ULONG MaxChars)
Definition: ui.c:455
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
UCHAR UiMenuFgColor
Definition: ui.c:40
VOID TuiUpdateDateTime(VOID)
Definition: tui.c:429
static LPHIST_ENTRY Top
Definition: history.c:53
#define VERT
Definition: ui.h:230

Referenced by TuiDrawProgressBarCenter().

◆ TuiDrawProgressBarCenter()

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

Definition at line 649 of file tui.c.

650 {
651  ULONG Left, Top, Right, Bottom;
652  ULONG Width = 50; // Allow for 50 "bars"
653  ULONG Height = 2;
654 
655  Left = (UiScreenWidth - Width - 4) / 2;
656  Right = Left + Width + 3;
657  Top = (UiScreenHeight - Height - 2) / 2;
658  Top += 2;
659  Bottom = Top + Height + 1;
660 
661  TuiDrawProgressBar(Left, Top, Right, Bottom, Position, Range, ProgressText);
662 }
static COORD Position
Definition: mouse.c:34
ULONG UiScreenHeight
Definition: ui.c:29
VOID TuiDrawProgressBar(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, ULONG Position, ULONG Range, PCHAR ProgressText)
Definition: tui.c:664
Definition: range.c:39
static LPHIST_ENTRY Bottom
Definition: history.c:54
unsigned int ULONG
Definition: retypes.h:1
ULONG UiScreenWidth
Definition: ui.c:28
static LPHIST_ENTRY Top
Definition: history.c:53

◆ TuiDrawShadow()

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

Definition at line 189 of file tui.c.

190 {
191  PUCHAR ScreenMemory = (PUCHAR)TextVideoBuffer;
192  ULONG Idx;
193 
194  // Shade the bottom of the area
195  if (Bottom < (UiScreenHeight - 1))
196  {
197  if (UiScreenHeight < 34)
198  {
199  Idx=Left + 2;
200  }
201  else
202  {
203  Idx=Left + 1;
204  }
205 
206  for (; Idx<=Right; Idx++)
207  {
208  ScreenMemory[(((Bottom+1)*2)*UiScreenWidth)+(Idx*2)+1] = ATTR(COLOR_GRAY, COLOR_BLACK);
209  }
210  }
211 
212  // Shade the right of the area
213  if (Right < (UiScreenWidth - 1))
214  {
215  for (Idx=Top+1; Idx<=Bottom; Idx++)
216  {
217  ScreenMemory[((Idx*2)*UiScreenWidth)+((Right+1)*2)+1] = ATTR(COLOR_GRAY, COLOR_BLACK);
218  }
219  }
220  if (UiScreenHeight < 34)
221  {
222  if ((Right + 1) < (UiScreenWidth - 1))
223  {
224  for (Idx=Top+1; Idx<=Bottom; Idx++)
225  {
226  ScreenMemory[((Idx*2)*UiScreenWidth)+((Right+2)*2)+1] = ATTR(COLOR_GRAY, COLOR_BLACK);
227  }
228  }
229  }
230 
231  // Shade the bottom right corner
232  if ((Right < (UiScreenWidth - 1)) && (Bottom < (UiScreenHeight - 1)))
233  {
234  ScreenMemory[(((Bottom+1)*2)*UiScreenWidth)+((Right+1)*2)+1] = ATTR(COLOR_GRAY, COLOR_BLACK);
235  }
236  if (UiScreenHeight < 34)
237  {
238  if (((Right + 1) < (UiScreenWidth - 1)) && (Bottom < (UiScreenHeight - 1)))
239  {
240  ScreenMemory[(((Bottom+1)*2)*UiScreenWidth)+((Right+2)*2)+1] = ATTR(COLOR_GRAY, COLOR_BLACK);
241  }
242  }
243 }
#define COLOR_BLACK
Definition: ui.h:204
unsigned char * PUCHAR
Definition: retypes.h:3
ULONG UiScreenHeight
Definition: ui.c:29
#define ATTR(cFore, cBack)
Definition: ui.h:192
PVOID TextVideoBuffer
Definition: tui.c:25
static LPHIST_ENTRY Bottom
Definition: history.c:54
unsigned int ULONG
Definition: retypes.h:1
ULONG UiScreenWidth
Definition: ui.c:28
static LPHIST_ENTRY Top
Definition: history.c:53

Referenced by TuiDrawBox().

◆ TuiDrawStatusText()

VOID TuiDrawStatusText ( PCSTR  StatusText)

Definition at line 414 of file tui.c.

415 {
416  SIZE_T i;
417 
420 
421  for (i=strlen(StatusText)+1; i<UiScreenWidth; i++)
422  {
424  }
425 
427 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
VOID TuiDrawText(ULONG X, ULONG Y, PCSTR Text, UCHAR Attr)
Definition: tui.c:321
ULONG UiScreenHeight
Definition: ui.c:29
VOID VideoCopyOffScreenBufferToVRAM(VOID)
Definition: video.c:34
#define ATTR(cFore, cBack)
Definition: ui.h:192
UCHAR UiStatusBarBgColor
Definition: ui.c:32
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:28
UCHAR UiStatusBarFgColor
Definition: ui.c:31

◆ TuiDrawText()

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

Definition at line 321 of file tui.c.

322 {
323  PUCHAR ScreenMemory = (PUCHAR)TextVideoBuffer;
324  ULONG i, j;
325 
326  // Draw the text
327  for (i = X, j = 0; Text[j] && i < UiScreenWidth; i++, j++)
328  {
329  ScreenMemory[((Y*2)*UiScreenWidth)+(i*2)] = (UCHAR)Text[j];
330  ScreenMemory[((Y*2)*UiScreenWidth)+(i*2)+1] = Attr;
331  }
332 }
#define Y(I)
unsigned char * PUCHAR
Definition: retypes.h:3
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:25
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:28
char * Text
Definition: combotst.c:136

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

◆ TuiDrawText2()

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

Definition at line 340 of file tui.c.

341 {
342  PUCHAR ScreenMemory = (PUCHAR)TextVideoBuffer;
343  ULONG i, j;
344 
345  // Draw the text
346  for (i = X, j = 0; Text[j] && i < UiScreenWidth && (MaxNumChars > 0 ? j < MaxNumChars : TRUE); i++, j++)
347  {
348  ScreenMemory[((Y*2)*UiScreenWidth)+(i*2)] = (UCHAR)Text[j];
349  ScreenMemory[((Y*2)*UiScreenWidth)+(i*2)+1] = Attr;
350  }
351 }
#define Y(I)
#define TRUE
Definition: types.h:120
unsigned char * PUCHAR
Definition: retypes.h:3
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:25
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:28
char * Text
Definition: combotst.c:136

◆ TuiEditBox()

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

Definition at line 819 of file tui.c.

820 {
821  INT width = 8;
822  ULONG height = 1;
823  INT curline = 0;
824  INT k;
825  size_t i , j;
826  INT x1, x2, y1, y2;
827  CHAR temp[260];
828  CHAR key;
829  BOOLEAN Extended;
830  INT EditBoxLine;
831  ULONG EditBoxStartX, EditBoxEndX;
832  INT EditBoxCursorX;
833  ULONG EditBoxTextLength, EditBoxTextPosition;
834  INT EditBoxTextDisplayIndex;
835  BOOLEAN ReturnCode;
837 
838  // Save the screen contents
842 
843  // Find the height
844  for (i=0; i<strlen(MessageText); i++)
845  {
846  if (MessageText[i] == '\n')
847  height++;
848  }
849 
850  // Find the width
851  for (i=0,j=0,k=0; i<height; i++)
852  {
853  while ((MessageText[j] != '\n') && (MessageText[j] != 0))
854  {
855  j++;
856  k++;
857  }
858 
859  if (k > width)
860  width = k;
861 
862  k = 0;
863  j++;
864  }
865 
866  // Calculate box area
867  x1 = (UiScreenWidth - (width+2))/2;
868  x2 = x1 + width + 3;
869  y1 = ((UiScreenHeight - height - 2)/2) + 1;
870  y2 = y1 + height + 4;
871 
872  // Draw the box
874 
875  // Draw the text
876  for (i=0,j=0; i<strlen(MessageText)+1; i++)
877  {
878  if ((MessageText[i] == '\n') || (MessageText[i] == 0))
879  {
880  temp[j] = 0;
881  j = 0;
883  curline++;
884  }
885  else
886  temp[j++] = MessageText[i];
887  }
888 
889  EditBoxTextLength = (ULONG)strlen(EditTextBuffer);
890  EditBoxTextLength = min(EditBoxTextLength, Length - 1);
891  EditBoxTextPosition = 0;
892  EditBoxLine = y2 - 2;
893  EditBoxStartX = x1 + 3;
894  EditBoxEndX = x2 - 3;
895 
896  // Draw the edit box background and the text
897  UiFillArea(EditBoxStartX, EditBoxLine, EditBoxEndX, EditBoxLine, ' ', ATTR(UiEditBoxTextColor, UiEditBoxBgColor));
898  UiDrawText2(EditBoxStartX, EditBoxLine, EditBoxEndX - EditBoxStartX + 1, EditTextBuffer, ATTR(UiEditBoxTextColor, UiEditBoxBgColor));
899 
900  // Show the cursor
901  EditBoxCursorX = EditBoxStartX;
902  MachVideoSetTextCursorPosition(EditBoxCursorX, EditBoxLine);
904 
905  // Draw status text
906  UiDrawStatusText("Press ENTER to continue, or ESC to cancel");
907 
909 
910  //
911  // Enter the text. Please keep in mind that the default input mode
912  // of the edit boxes is in insertion mode, that is, you can insert
913  // text without erasing the existing one.
914  //
915  for (;;)
916  {
917  if (MachConsKbHit())
918  {
919  Extended = FALSE;
920  key = MachConsGetCh();
921  if (key == KEY_EXTENDED)
922  {
923  Extended = TRUE;
924  key = MachConsGetCh();
925  }
926 
927  if (key == KEY_ENTER)
928  {
929  ReturnCode = TRUE;
930  break;
931  }
932  else if (key == KEY_ESC)
933  {
934  ReturnCode = FALSE;
935  break;
936  }
937  else if (key == KEY_BACKSPACE) // Remove a character
938  {
939  if ( (EditBoxTextLength > 0) && (EditBoxTextPosition > 0) &&
940  (EditBoxTextPosition <= EditBoxTextLength) )
941  {
942  EditBoxTextPosition--;
943  memmove(EditTextBuffer + EditBoxTextPosition,
944  EditTextBuffer + EditBoxTextPosition + 1,
945  EditBoxTextLength - EditBoxTextPosition);
946  EditBoxTextLength--;
947  EditTextBuffer[EditBoxTextLength] = 0;
948  }
949  else
950  {
951  MachBeep();
952  }
953  }
954  else if (Extended && key == KEY_DELETE) // Remove a character
955  {
956  if ( (EditBoxTextLength > 0) &&
957  (EditBoxTextPosition < EditBoxTextLength) )
958  {
959  memmove(EditTextBuffer + EditBoxTextPosition,
960  EditTextBuffer + EditBoxTextPosition + 1,
961  EditBoxTextLength - EditBoxTextPosition);
962  EditBoxTextLength--;
963  EditTextBuffer[EditBoxTextLength] = 0;
964  }
965  else
966  {
967  MachBeep();
968  }
969  }
970  else if (Extended && key == KEY_HOME) // Go to the start of the buffer
971  {
972  EditBoxTextPosition = 0;
973  }
974  else if (Extended && key == KEY_END) // Go to the end of the buffer
975  {
976  EditBoxTextPosition = EditBoxTextLength;
977  }
978  else if (Extended && key == KEY_RIGHT) // Go right
979  {
980  if (EditBoxTextPosition < EditBoxTextLength)
981  EditBoxTextPosition++;
982  else
983  MachBeep();
984  }
985  else if (Extended && key == KEY_LEFT) // Go left
986  {
987  if (EditBoxTextPosition > 0)
988  EditBoxTextPosition--;
989  else
990  MachBeep();
991  }
992  else if (!Extended) // Add this key to the buffer
993  {
994  if ( (EditBoxTextLength < Length - 1) &&
995  (EditBoxTextPosition < Length - 1) )
996  {
997  memmove(EditTextBuffer + EditBoxTextPosition + 1,
998  EditTextBuffer + EditBoxTextPosition,
999  EditBoxTextLength - EditBoxTextPosition);
1000  EditTextBuffer[EditBoxTextPosition] = key;
1001  EditBoxTextPosition++;
1002  EditBoxTextLength++;
1003  EditTextBuffer[EditBoxTextLength] = 0;
1004  }
1005  else
1006  {
1007  MachBeep();
1008  }
1009  }
1010  else
1011  {
1012  MachBeep();
1013  }
1014  }
1015 
1016  // Draw the edit box background
1017  UiFillArea(EditBoxStartX, EditBoxLine, EditBoxEndX, EditBoxLine, ' ', ATTR(UiEditBoxTextColor, UiEditBoxBgColor));
1018 
1019  // Fill the text in
1020  if (EditBoxTextPosition > (EditBoxEndX - EditBoxStartX))
1021  {
1022  EditBoxTextDisplayIndex = EditBoxTextPosition - (EditBoxEndX - EditBoxStartX);
1023  EditBoxCursorX = EditBoxEndX;
1024  }
1025  else
1026  {
1027  EditBoxTextDisplayIndex = 0;
1028  EditBoxCursorX = EditBoxStartX + EditBoxTextPosition;
1029  }
1030  UiDrawText2(EditBoxStartX, EditBoxLine, EditBoxEndX - EditBoxStartX + 1, &EditTextBuffer[EditBoxTextDisplayIndex], ATTR(UiEditBoxTextColor, UiEditBoxBgColor));
1031 
1032  // Move the cursor
1033  MachVideoSetTextCursorPosition(EditBoxCursorX, EditBoxLine);
1034 
1036 
1038 
1039  MachHwIdle();
1040  }
1041 
1042  // Hide the cursor again
1044 
1045  // Restore the screen contents
1048 
1049  return ReturnCode;
1050 }
_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:38
char CHAR
Definition: xmlstorage.h:175
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
ULONG UiScreenHeight
Definition: ui.c:29
#define KEY_EXTENDED
Definition: keycodes.h:38
int32_t INT
Definition: typedefs.h:58
VOID VideoCopyOffScreenBufferToVRAM(VOID)
Definition: video.c:34
#define KEY_LEFT
Definition: keycodes.h:47
#define FALSE
Definition: types.h:117
UCHAR UiEditBoxTextColor
Definition: ui.c:45
VOID TuiSaveScreen(PUCHAR Buffer)
Definition: tui.c:524
VOID TuiDrawBox(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR VertStyle, UCHAR HorzStyle, BOOLEAN Fill, BOOLEAN Shadow, UCHAR Attr)
Definition: tui.c:249
#define KEY_RIGHT
Definition: keycodes.h:48
FORCEINLINE PVOID FrLdrTempAlloc(_In_ SIZE_T Size, _In_ ULONG Tag)
Definition: mm.h:182
#define ATTR(cFore, cBack)
Definition: ui.h:192
unsigned char BOOLEAN
VOID UiDrawText(ULONG X, ULONG Y, PCSTR Text, UCHAR Attr)
Definition: ui.c:234
#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:229
VOID UiDrawText2(ULONG X, ULONG Y, ULONG MaxNumChars, PCSTR Text, UCHAR Attr)
Definition: ui.c:239
#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:46
#define KEY_HOME
Definition: keycodes.h:44
VOID UiDrawStatusText(PCSTR StatusText)
Definition: ui.c:249
HKEY key
Definition: reg.c:42
#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:535
static calc_node_t temp
Definition: rpn_ieee.c:38
#define MachVideoSetTextCursorPosition(X, Y)
Definition: machine.h:102
UCHAR UiMessageBoxBgColor
Definition: ui.c:39
#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:219
unsigned int ULONG
Definition: retypes.h:1
ULONG UiScreenWidth
Definition: ui.c:28
VOID TuiUpdateDateTime(VOID)
Definition: tui.c:429
#define KEY_END
Definition: keycodes.h:64
int k
Definition: mpi.c:3369
#define D_VERT
Definition: ui.h:231
#define KEY_ENTER
Definition: keycodes.h:39
Definition: path.c:41
#define TAG_TUI_SCREENBUFFER
Definition: tui.c:22
FORCEINLINE VOID FrLdrTempFree(PVOID Allocation, ULONG Tag)
Definition: mm.h:191

◆ TuiFadeInBackdrop()

VOID TuiFadeInBackdrop ( VOID  )

Definition at line 763 of file tui.c.

764 {
765  PPALETTE_ENTRY TuiFadePalette = NULL;
766 
768  {
769  TuiFadePalette = (PPALETTE_ENTRY)FrLdrTempAlloc(sizeof(PALETTE_ENTRY) * 64,
771 
772  if (TuiFadePalette != NULL)
773  {
774  VideoSavePaletteState(TuiFadePalette, 64);
776  }
777  }
778 
779  // Draw the backdrop and title box
780  TuiDrawBackdrop();
781 
782  if (UiUseSpecialEffects && ! MachVideoIsPaletteFixed() && TuiFadePalette != NULL)
783  {
784  VideoFadeIn(TuiFadePalette, 64);
785  FrLdrTempFree(TuiFadePalette, TAG_TAG_TUI_PALETTE);
786  }
787 }
VOID VideoFadeIn(PPALETTE_ENTRY Palette, ULONG ColorCount)
Definition: video.c:75
VOID VideoSavePaletteState(PPALETTE_ENTRY Palette, ULONG ColorCount)
Definition: video.c:40
FORCEINLINE PVOID FrLdrTempAlloc(_In_ SIZE_T Size, _In_ ULONG Tag)
Definition: mm.h:182
Definition: video.h:11
struct _PALETTE_ENTRY * PPALETTE_ENTRY
VOID TuiDrawBackdrop(VOID)
Definition: tui.c:84
BOOLEAN UiUseSpecialEffects
Definition: ui.c:50
#define TAG_TAG_TUI_PALETTE
Definition: tui.c:23
#define NULL
Definition: types.h:112
#define MachVideoIsPaletteFixed()
Definition: machine.h:110
VOID VideoSetAllColorsToBlack(ULONG ColorCount)
Definition: video.c:63
FORCEINLINE VOID FrLdrTempFree(PVOID Allocation, ULONG Tag)
Definition: mm.h:191

◆ TuiFadeOut()

VOID TuiFadeOut ( VOID  )

Definition at line 789 of file tui.c.

790 {
791  PPALETTE_ENTRY TuiFadePalette = NULL;
792 
794  {
795  TuiFadePalette = (PPALETTE_ENTRY)FrLdrTempAlloc(sizeof(PALETTE_ENTRY) * 64,
797 
798  if (TuiFadePalette != NULL)
799  {
800  VideoSavePaletteState(TuiFadePalette, 64);
801  }
802  }
803 
804  if (UiUseSpecialEffects && ! MachVideoIsPaletteFixed() && TuiFadePalette != NULL)
805  {
806  VideoFadeOut(64);
807  }
808 
810 
811  if (UiUseSpecialEffects && ! MachVideoIsPaletteFixed() && TuiFadePalette != NULL)
812  {
813  VideoRestorePaletteState(TuiFadePalette, 64);
814  FrLdrTempFree(TuiFadePalette, TAG_TAG_TUI_PALETTE);
815  }
816 
817 }
VOID VideoSavePaletteState(PPALETTE_ENTRY Palette, ULONG ColorCount)
Definition: video.c:40
#define FALSE
Definition: types.h:117
FORCEINLINE PVOID FrLdrTempAlloc(_In_ SIZE_T Size, _In_ ULONG Tag)
Definition: mm.h:182
Definition: video.h:11
struct _PALETTE_ENTRY * PPALETTE_ENTRY
VOID VideoFadeOut(ULONG ColorCount)
Definition: video.c:134
BOOLEAN UiUseSpecialEffects
Definition: ui.c:50
#define TAG_TAG_TUI_PALETTE
Definition: tui.c:23
#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:50
FORCEINLINE VOID FrLdrTempFree(PVOID Allocation, ULONG Tag)
Definition: mm.h:191

Referenced by TuiUnInitialize().

◆ TuiFillArea()

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

Definition at line 154 of file tui.c.

155 {
156  PUCHAR ScreenMemory = (PUCHAR)TextVideoBuffer;
157  ULONG i, j;
158 
159  // Clip the area to the screen
160  if ((Left >= UiScreenWidth) || (Top >= UiScreenHeight))
161  {
162  return;
163  }
164  if (Right >= UiScreenWidth)
165  {
166  Right = UiScreenWidth - 1;
167  }
168  if (Bottom >= UiScreenHeight)
169  {
170  Bottom = UiScreenHeight - 1;
171  }
172 
173  // Loop through each line and fill it in
174  for (i=Top; i<=Bottom; i++)
175  {
176  // Loop through each character (column) in the line and fill it in
177  for (j=Left; j<=Right; j++)
178  {
179  ScreenMemory[((i*2)*UiScreenWidth)+(j*2)] = (UCHAR)FillChar;
180  ScreenMemory[((i*2)*UiScreenWidth)+(j*2)+1] = Attr;
181  }
182  }
183 }
unsigned char * PUCHAR
Definition: retypes.h:3
ULONG UiScreenHeight
Definition: ui.c:29
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:25
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:28
static LPHIST_ENTRY Top
Definition: history.c:53

Referenced by MiniTuiDrawBackdrop(), TuiDrawBackdrop(), and TuiDrawBox().

◆ TuiInitialize()

BOOLEAN TuiInitialize ( VOID  )

Definition at line 53 of file tui.c.

54 {
58 
60  if (TextVideoBuffer == NULL)
61  {
62  return FALSE;
63  }
64 
65  return TRUE;
66 }
#define COLOR_BLACK
Definition: ui.h:204
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define ATTR(cFore, cBack)
Definition: ui.h:192
PVOID TextVideoBuffer
Definition: tui.c:25
#define MachVideoClearScreen(Attr)
Definition: machine.h:92
#define MachVideoHideShowTextCursor(Show)
Definition: machine.h:104
#define MachVideoSetTextCursorPosition(X, Y)
Definition: machine.h:102
#define NULL
Definition: types.h:112
PVOID VideoAllocateOffScreenBuffer(VOID)
Definition: video.c:17

◆ TuiMessageBox()

VOID TuiMessageBox ( PCSTR  MessageText)

Definition at line 546 of file tui.c.

547 {
549 
550  // Save the screen contents
554 
555  // Display the message box
556  TuiMessageBoxCritical(MessageText);
557 
558  // Restore the screen contents
561 }
ULONG UiScreenHeight
Definition: ui.c:29
VOID TuiSaveScreen(PUCHAR Buffer)
Definition: tui.c:524
FORCEINLINE PVOID FrLdrTempAlloc(_In_ SIZE_T Size, _In_ ULONG Tag)
Definition: mm.h:182
VOID TuiMessageBoxCritical(PCSTR MessageText)
Definition: tui.c:563
VOID TuiRestoreScreen(PUCHAR Buffer)
Definition: tui.c:535
HANDLE ScreenBuffer
Definition: notevil.c:37
ULONG UiScreenWidth
Definition: ui.c:28
#define TAG_TUI_SCREENBUFFER
Definition: tui.c:22
FORCEINLINE VOID FrLdrTempFree(PVOID Allocation, ULONG Tag)
Definition: mm.h:191

◆ TuiMessageBoxCritical()

VOID TuiMessageBoxCritical ( PCSTR  MessageText)

Definition at line 563 of file tui.c.

564 {
565  int width = 8;
566  unsigned int height = 1;
567  int curline = 0;
568  int k;
569  size_t i , j;
570  int x1, x2, y1, y2;
571  char temp[260];
572  char key;
573 
574  // Find the height
575  for (i=0; i<strlen(MessageText); i++)
576  {
577  if (MessageText[i] == '\n')
578  height++;
579  }
580 
581  // Find the width
582  for (i=0,j=0,k=0; i<height; i++)
583  {
584  while ((MessageText[j] != '\n') && (MessageText[j] != 0))
585  {
586  j++;
587  k++;
588  }
589 
590  if (k > width)
591  width = k;
592 
593  k = 0;
594  j++;
595  }
596 
597  // Calculate box area
598  x1 = (UiScreenWidth - (width+2))/2;
599  x2 = x1 + width + 3;
600  y1 = ((UiScreenHeight - height - 2)/2) + 1;
601  y2 = y1 + height + 4;
602 
603  // Draw the box
605 
606  // Draw the text
607  for (i=0,j=0; i<strlen(MessageText)+1; i++)
608  {
609  if ((MessageText[i] == '\n') || (MessageText[i] == 0))
610  {
611  temp[j] = 0;
612  j = 0;
614  curline++;
615  }
616  else
617  temp[j++] = MessageText[i];
618  }
619 
620  // Draw OK button
621  strcpy(temp, " OK ");
622  UiDrawText(x1+((x2-x1)/2)-3, y2-2, temp, ATTR(COLOR_BLACK, COLOR_GRAY));
623 
624  // Draw status text
625  UiDrawStatusText("Press ENTER to continue");
626 
628 
629  for (;;)
630  {
631  if (MachConsKbHit())
632  {
633  key = MachConsGetCh();
634  if (key == KEY_EXTENDED)
635  key = MachConsGetCh();
636 
637  if ((key == KEY_ENTER) || (key == KEY_SPACE) || (key == KEY_ESC))
638  break;
639  }
640 
642 
644 
645  MachHwIdle();
646  }
647 }
_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:204
#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:38
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
ULONG UiScreenHeight
Definition: ui.c:29
#define KEY_EXTENDED
Definition: keycodes.h:38
VOID VideoCopyOffScreenBufferToVRAM(VOID)
Definition: video.c:34
VOID TuiDrawBox(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR VertStyle, UCHAR HorzStyle, BOOLEAN Fill, BOOLEAN Shadow, UCHAR Attr)
Definition: tui.c:249
#define ATTR(cFore, cBack)
Definition: ui.h:192
VOID UiDrawText(ULONG X, ULONG Y, PCSTR Text, UCHAR Attr)
Definition: ui.c:234
#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:229
#define KEY_ESC
Definition: keycodes.h:49
VOID UiDrawStatusText(PCSTR StatusText)
Definition: ui.c:249
HKEY key
Definition: reg.c:42
_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:39
_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:28
VOID TuiUpdateDateTime(VOID)
Definition: tui.c:429
int k
Definition: mpi.c:3369
#define D_VERT
Definition: ui.h:231
#define KEY_ENTER
Definition: keycodes.h:39
Definition: path.c:41

Referenced by TuiMessageBox().

◆ TuiPrintf()

int TuiPrintf ( const char Format,
  ... 
)

Definition at line 32 of file tui.c.

33 {
34  int i;
35  int Length;
36  va_list ap;
37  CHAR Buffer[512];
38 
39  va_start(ap, Format);
40  Length = _vsnprintf(Buffer, sizeof(Buffer), Format, ap);
41  va_end(ap);
42 
43  if (Length == -1) Length = sizeof(Buffer);
44 
45  for (i = 0; i < Length; i++)
46  {
48  }
49 
50  return Length;
51 }
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
char CHAR
Definition: xmlstorage.h:175
#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 535 of file tui.c.

536 {
537  PUCHAR ScreenMemory = (PUCHAR)TextVideoBuffer;
538  ULONG i;
539 
540  for (i=0; i < (UiScreenWidth * UiScreenHeight * 2); i++)
541  {
542  ScreenMemory[i] = Buffer[i];
543  }
544 }
unsigned char * PUCHAR
Definition: retypes.h:3
ULONG UiScreenHeight
Definition: ui.c:29
Definition: bufpool.h:45
PVOID TextVideoBuffer
Definition: tui.c:25
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:28

Referenced by TuiEditBox(), and TuiMessageBox().

◆ TuiSaveScreen()

VOID TuiSaveScreen ( PUCHAR  Buffer)

Definition at line 524 of file tui.c.

525 {
526  PUCHAR ScreenMemory = (PUCHAR)TextVideoBuffer;
527  ULONG i;
528 
529  for (i=0; i < (UiScreenWidth * UiScreenHeight * 2); i++)
530  {
531  Buffer[i] = ScreenMemory[i];
532  }
533 }
unsigned char * PUCHAR
Definition: retypes.h:3
ULONG UiScreenHeight
Definition: ui.c:29
Definition: bufpool.h:45
PVOID TextVideoBuffer
Definition: tui.c:25
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:28

Referenced by TuiEditBox(), and TuiMessageBox().

◆ TuiTextToColor()

UCHAR TuiTextToColor ( PCSTR  ColorText)

Definition at line 701 of file tui.c.

702 {
703  static const struct
704  {
705  PCSTR ColorName;
706  UCHAR ColorValue;
707  } Colors[] =
708  {
709  {"Black" , COLOR_BLACK },
710  {"Blue" , COLOR_BLUE },
711  {"Green" , COLOR_GREEN },
712  {"Cyan" , COLOR_CYAN },
713  {"Red" , COLOR_RED },
714  {"Magenta", COLOR_MAGENTA},
715  {"Brown" , COLOR_BROWN },
716  {"Gray" , COLOR_GRAY },
717  {"DarkGray" , COLOR_DARKGRAY },
718  {"LightBlue" , COLOR_LIGHTBLUE },
719  {"LightGreen" , COLOR_LIGHTGREEN },
720  {"LightCyan" , COLOR_LIGHTCYAN },
721  {"LightRed" , COLOR_LIGHTRED },
722  {"LightMagenta", COLOR_LIGHTMAGENTA},
723  {"Yellow" , COLOR_YELLOW },
724  {"White" , COLOR_WHITE },
725  };
726  ULONG i;
727 
728  if (_stricmp(ColorText, "Default") == 0)
729  return MachDefaultTextColor;
730 
731  for (i = 0; i < sizeof(Colors)/sizeof(Colors[0]); ++i)
732  {
733  if (_stricmp(ColorText, Colors[i].ColorName) == 0)
734  return Colors[i].ColorValue;
735  }
736 
737  return COLOR_BLACK;
738 }
#define COLOR_YELLOW
Definition: ui.h:219
#define COLOR_BLACK
Definition: ui.h:204
#define COLOR_LIGHTBLUE
Definition: ui.h:214
#define COLOR_LIGHTMAGENTA
Definition: ui.h:218
#define _stricmp
Definition: cat.c:22
#define COLOR_DARKGRAY
Definition: ui.h:213
#define COLOR_RED
Definition: ui.h:208
#define COLOR_BROWN
Definition: ui.h:210
Colors
Definition: ansiprsr.h:4
#define COLOR_CYAN
Definition: ui.h:207
#define COLOR_BLUE
Definition: ui.h:205
#define COLOR_LIGHTCYAN
Definition: ui.h:216
unsigned char UCHAR
Definition: xmlstorage.h:181
#define COLOR_GREEN
Definition: ui.h:206
#define COLOR_LIGHTRED
Definition: ui.h:217
#define COLOR_WHITE
Definition: ui.h:220
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 COLOR_MAGENTA
Definition: ui.h:209
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:215

◆ TuiTextToFillStyle()

UCHAR TuiTextToFillStyle ( PCSTR  FillStyleText)

Definition at line 740 of file tui.c.

741 {
742  static const struct
743  {
744  PCSTR FillStyleName;
745  UCHAR FillStyleValue;
746  } FillStyles[] =
747  {
748  {"Light" , LIGHT_FILL },
749  {"Medium", MEDIUM_FILL},
750  {"Dark" , DARK_FILL },
751  };
752  ULONG i;
753 
754  for (i = 0; i < sizeof(FillStyles)/sizeof(FillStyles[0]); ++i)
755  {
756  if (_stricmp(FillStyleText, FillStyles[i].FillStyleName) == 0)
757  return FillStyles[i].FillStyleValue;
758  }
759 
760  return LIGHT_FILL;
761 }
#define DARK_FILL
Definition: ui.h:199
#define _stricmp
Definition: cat.c:22
#define LIGHT_FILL
Definition: ui.h:197
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
const char * PCSTR
Definition: typedefs.h:52
#define MEDIUM_FILL
Definition: ui.h:198

◆ TuiUnInitialize()

VOID TuiUnInitialize ( VOID  )

Definition at line 68 of file tui.c.

69 {
71  {
72  TuiFadeOut();
73  }
74  else
75  {
77  }
78 
82 }
#define COLOR_BLACK
Definition: ui.h:204
#define TRUE
Definition: types.h:120
VOID TuiFadeOut(VOID)
Definition: tui.c:789
#define FALSE
Definition: types.h:117
#define ATTR(cFore, cBack)
Definition: ui.h:192
#define MachVideoClearScreen(Attr)
Definition: machine.h:92
#define MachVideoHideShowTextCursor(Show)
Definition: machine.h:104
BOOLEAN UiUseSpecialEffects
Definition: ui.c:50
#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 429 of file tui.c.

430 {
431  TIMEINFO* TimeInfo;
432  char DateString[40];
433  CHAR TimeString[40];
434  CHAR TempString[20];
435  BOOLEAN PMHour = FALSE;
436 
437  /* Don't draw the time if this has been disabled */
438  if (!UiDrawTime) return;
439 
440  TimeInfo = ArcGetTime();
441  if (TimeInfo->Year < 1 || 9999 < TimeInfo->Year ||
442  TimeInfo->Month < 1 || 12 < TimeInfo->Month ||
443  TimeInfo->Day < 1 || 31 < TimeInfo->Day ||
444  23 < TimeInfo->Hour ||
445  59 < TimeInfo->Minute ||
446  59 < TimeInfo->Second)
447  {
448  /* This happens on QEmu sometimes. We just skip updating */
449  return;
450  }
451  // Get the month name
452  strcpy(DateString, UiMonthNames[TimeInfo->Month - 1]);
453  // Get the day
454  _itoa(TimeInfo->Day, TempString, 10);
455  // Get the day postfix
456  if (1 == TimeInfo->Day || 21 == TimeInfo->Day || 31 == TimeInfo->Day)
457  {
458  strcat(TempString, "st");
459  }
460  else if (2 == TimeInfo->Day || 22 == TimeInfo->Day)
461  {
462  strcat(TempString, "nd");
463  }
464  else if (3 == TimeInfo->Day || 23 == TimeInfo->Day)
465  {
466  strcat(TempString, "rd");
467  }
468  else
469  {
470  strcat(TempString, "th");
471  }
472 
473  // Add the day to the date
474  strcat(DateString, TempString);
475  strcat(DateString, " ");
476 
477  // Get the year and add it to the date
478  _itoa(TimeInfo->Year, TempString, 10);
479  strcat(DateString, TempString);
480 
481  // Draw the date
483 
484  // Get the hour and change from 24-hour mode to 12-hour
485  if (TimeInfo->Hour > 12)
486  {
487  TimeInfo->Hour -= 12;
488  PMHour = TRUE;
489  }
490  if (TimeInfo->Hour == 0)
491  {
492  TimeInfo->Hour = 12;
493  }
494  _itoa(TimeInfo->Hour, TempString, 10);
495  strcpy(TimeString, " ");
496  strcat(TimeString, TempString);
497  strcat(TimeString, ":");
498  _itoa(TimeInfo->Minute, TempString, 10);
499  if (TimeInfo->Minute < 10)
500  {
501  strcat(TimeString, "0");
502  }
503  strcat(TimeString, TempString);
504  strcat(TimeString, ":");
505  _itoa(TimeInfo->Second, TempString, 10);
506  if (TimeInfo->Second < 10)
507  {
508  strcat(TimeString, "0");
509  }
510  strcat(TimeString, TempString);
511  if (PMHour)
512  {
513  strcat(TimeString, " PM");
514  }
515  else
516  {
517  strcat(TimeString, " AM");
518  }
519 
520  // Draw the time
522 }
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define TRUE
Definition: types.h:120
VOID TuiDrawText(ULONG X, ULONG Y, PCSTR Text, UCHAR Attr)
Definition: tui.c:321
char CHAR
Definition: xmlstorage.h:175
USHORT Second
Definition: fw.h:16
UCHAR UiTitleBoxBgColor
Definition: ui.c:37
USHORT Month
Definition: fw.h:12
USHORT Minute
Definition: fw.h:15
#define FALSE
Definition: types.h:117
Definition: fw.h:9
BOOLEAN UiDrawTime
Definition: ui.c:51
#define ATTR(cFore, cBack)
Definition: ui.h:192
unsigned char BOOLEAN
TIMEINFO * ArcGetTime(VOID)
Definition: arcemul.c:27
_CRTIMP char *__cdecl _itoa(_In_ int _Value, _Pre_notnull_ _Post_z_ char *_Dest, _In_ int _Radix)
USHORT Year
Definition: fw.h:11
UCHAR UiTitleBoxFgColor
Definition: ui.c:36
USHORT Hour
Definition: fw.h:14
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
unsigned int ULONG
Definition: retypes.h:1
const CHAR UiMonthNames[12][15]
Definition: ui.c:56
USHORT Day
Definition: fw.h:13
ULONG UiScreenWidth
Definition: ui.c:28

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

Variable Documentation

◆ MachDefaultTextColor

UCHAR MachDefaultTextColor

Definition at line 111 of file pcvideo.c.

Referenced by TuiTextToColor().

◆ TextVideoBuffer

PVOID TextVideoBuffer = NULL

◆ TuiVtbl

const UIVTBL TuiVtbl
Initial value:
=
{
}
VOID TuiMessageBox(PCSTR MessageText)
Definition: tui.c:546
VOID TuiDrawStatusText(PCSTR StatusText)
Definition: tui.c:414
BOOLEAN TuiEditBox(PCSTR MessageText, PCHAR EditTextBuffer, ULONG Length)
Definition: tui.c:819
VOID TuiDrawCenteredText(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, PCSTR TextString, UCHAR Attr)
Definition: tui.c:353
VOID TuiDrawText(ULONG X, ULONG Y, PCSTR Text, UCHAR Attr)
Definition: tui.c:321
VOID TuiDrawProgressBar(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, ULONG Position, ULONG Range, PCHAR ProgressText)
Definition: tui.c:664
VOID TuiFadeOut(VOID)
Definition: tui.c:789
VOID TuiDrawBox(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR VertStyle, UCHAR HorzStyle, BOOLEAN Fill, BOOLEAN Shadow, UCHAR Attr)
Definition: tui.c:249
UCHAR TuiTextToColor(PCSTR ColorText)
Definition: tui.c:701
UCHAR TuiTextToFillStyle(PCSTR FillStyleText)
Definition: tui.c:740
VOID TuiDrawBackdrop(VOID)
Definition: tui.c:84
VOID TuiFadeInBackdrop(VOID)
Definition: tui.c:763
BOOLEAN TuiInitialize(VOID)
Definition: tui.c:53
VOID TuiDrawShadow(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom)
Definition: tui.c:189
VOID TuiFillArea(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, CHAR FillChar, UCHAR Attr)
Definition: tui.c:154
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: tuimenu.c:17
VOID TuiUnInitialize(VOID)
Definition: tui.c:68
VOID TuiMessageBoxCritical(PCSTR MessageText)
Definition: tui.c:563
VOID TuiDrawText2(ULONG X, ULONG Y, ULONG MaxNumChars, PCSTR Text, UCHAR Attr)
Definition: tui.c:340
VOID TuiDrawProgressBarCenter(ULONG Position, ULONG Range, PCHAR ProgressText)
Definition: tui.c:649
VOID TuiDrawMenu(PUI_MENU_INFO MenuInfo)
Definition: tuimenu.c:233
VOID TuiUpdateDateTime(VOID)
Definition: tui.c:429

Definition at line 1052 of file tui.c.

Referenced by UiInitialize().