ReactOS  0.4.14-dev-554-g2f8d847
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_SCREEN_MEM   0xB8000
 
#define TUI_TITLE_BOX_CHAR_HEIGHT   5
 
#define UL   (0xda)
 
#define UR   (0xbf) /* HORZ and VERT */
 
#define LL   (0xc0)
 
#define LR   (0xd9)
 
#define D_UL   (0xc9)
 
#define D_UR   (0xbb) /* D_HORZ and D_VERT */
 
#define D_LL   (0xc8)
 
#define D_LR   (0xbc)
 
#define HD_UL   (0xd5)
 
#define HD_UR   (0xb8) /* D_HORZ and VERT */
 
#define HD_LL   (0xd4)
 
#define HD_LR   (0xbe)
 
#define VD_UL   (0xd6)
 
#define VD_UR   (0xb7) /* HORZ and D_VERT */
 
#define VD_LL   (0xd3)
 
#define VD_LR   (0xbd)
 

Functions

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)
 
BOOLEAN TuiEditBox (PCSTR MessageText, PCHAR EditTextBuffer, ULONG Length)
 
int TuiPrintf (const char *format,...)
 
UCHAR TuiTextToColor (PCSTR ColorText)
 
UCHAR TuiTextToFillStyle (PCSTR FillStyleText)
 
VOID TuiFadeInBackdrop (VOID)
 
VOID TuiFadeOut (VOID)
 
VOID TuiCalcMenuBoxSize (PUI_MENU_INFO MenuInfo)
 
VOID TuiDrawMenu (PUI_MENU_INFO MenuInfo)
 
VOID TuiDrawMenuBox (PUI_MENU_INFO MenuInfo)
 
VOID TuiDrawMenuItem (PUI_MENU_INFO MenuInfo, ULONG MenuItemNumber)
 
ULONG TuiProcessMenuKeyboardEvent (PUI_MENU_INFO MenuInfo, UiMenuKeyPressFilterCallback KeyPressFilter)
 
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 90 of file tui.h.

◆ D_LR

#define D_LR   (0xbc)

Definition at line 91 of file tui.h.

◆ D_UL

#define D_UL   (0xc9)

Definition at line 88 of file tui.h.

◆ D_UR

#define D_UR   (0xbb) /* D_HORZ and D_VERT */

Definition at line 89 of file tui.h.

◆ HD_LL

#define HD_LL   (0xd4)

Definition at line 95 of file tui.h.

◆ HD_LR

#define HD_LR   (0xbe)

Definition at line 96 of file tui.h.

◆ HD_UL

#define HD_UL   (0xd5)

Definition at line 93 of file tui.h.

◆ HD_UR

#define HD_UR   (0xb8) /* D_HORZ and VERT */

Definition at line 94 of file tui.h.

◆ LL

#define LL   (0xc0)

Definition at line 85 of file tui.h.

◆ LR

#define LR   (0xd9)

Definition at line 86 of file tui.h.

◆ TUI_SCREEN_MEM

#define TUI_SCREEN_MEM   0xB8000

Definition at line 22 of file tui.h.

◆ TUI_TITLE_BOX_CHAR_HEIGHT

#define TUI_TITLE_BOX_CHAR_HEIGHT   5

Definition at line 23 of file tui.h.

◆ UL

#define UL   (0xda)

Definition at line 83 of file tui.h.

◆ UR

#define UR   (0xbf) /* HORZ and VERT */

Definition at line 84 of file tui.h.

◆ VD_LL

#define VD_LL   (0xd3)

Definition at line 100 of file tui.h.

◆ VD_LR

#define VD_LR   (0xbd)

Definition at line 101 of file tui.h.

◆ VD_UL

#define VD_UL   (0xd6)

Definition at line 98 of file tui.h.

◆ VD_UR

#define VD_UR   (0xb7) /* HORZ and D_VERT */

Definition at line 99 of file tui.h.

Function Documentation

◆ TuiCalcMenuBoxSize()

VOID TuiCalcMenuBoxSize ( PUI_MENU_INFO  MenuInfo)

Definition at line 171 of file tuimenu.c.

172 {
173  ULONG i;
174  ULONG Width = 0;
175  ULONG Height;
176  ULONG Length;
177 
178  //
179  // Height is the menu item count plus 2 (top border & bottom border)
180  //
181  Height = MenuInfo->MenuItemCount + 2;
182  Height -= 1; // Height is zero-based
183 
184  //
185  // Loop every item
186  //
187  for(i = 0; i < MenuInfo->MenuItemCount; i++)
188  {
189  //
190  // Get the string length and make it become the new width if necessary
191  //
192  if (MenuInfo->MenuItemList[i])
193  {
194  Length = (ULONG)strlen(MenuInfo->MenuItemList[i]);
195  if (Length > Width) Width = Length;
196  }
197  }
198 
199  //
200  // Allow room for left & right borders, plus 8 spaces on each side
201  //
202  Width += 18;
203 
204  //
205  // Check if we're drawing a centered menu
206  //
207  if (UiCenterMenu)
208  {
209  //
210  // Calculate the menu box area for a centered menu
211  //
212  MenuInfo->Left = (UiScreenWidth - Width) / 2;
214  Height) / 2) + TUI_TITLE_BOX_CHAR_HEIGHT;
215  }
216  else
217  {
218  //
219  // Put the menu in the default left-corner position
220  //
221  MenuInfo->Left = -1;
222  MenuInfo->Top = 4;
223  }
224 
225  //
226  // The other margins are the same
227  //
228  MenuInfo->Right = (MenuInfo->Left) + Width;
229  MenuInfo->Bottom = (MenuInfo->Top) + Height;
230 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
ULONG UiScreenHeight
Definition: ui.c:29
#define TUI_TITLE_BOX_CHAR_HEIGHT
Definition: tui.h:23
BOOLEAN UiCenterMenu
Definition: ui.c:52
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
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
menu info structure
Definition: window.h:275
unsigned int ULONG
Definition: retypes.h:1
ULONG UiScreenWidth
Definition: ui.c:28

Referenced by TuiDisplayMenu().

◆ 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 17 of file tuimenu.c.

29 {
30  UI_MENU_INFO MenuInformation;
31  ULONG LastClockSecond;
32  ULONG CurrentClockSecond;
33  ULONG KeyPress;
34 
35  //
36  // Before taking any default action if there is no timeout,
37  // check whether the supplied key filter callback function
38  // may handle a specific user keypress. If it does, the
39  // timeout is cancelled.
40  //
41  if (!MenuTimeOut && KeyPressFilter && MachConsKbHit())
42  {
43  //
44  // Get the key (get the extended key if needed)
45  //
46  KeyPress = MachConsGetCh();
47  if (KeyPress == KEY_EXTENDED)
48  KeyPress = MachConsGetCh();
49 
50  //
51  // Call the supplied key filter callback function to see
52  // if it is going to handle this keypress.
53  //
54  if (KeyPressFilter(KeyPress, DefaultMenuItem, Context))
55  {
56  //
57  // It processed the key character, cancel the timeout
58  //
59  MenuTimeOut = -1;
60  }
61  }
62 
63  //
64  // Check if there's no timeout
65  //
66  if (!MenuTimeOut)
67  {
68  //
69  // Return the default selected item
70  //
71  if (SelectedMenuItem) *SelectedMenuItem = DefaultMenuItem;
72  return TRUE;
73  }
74 
75  //
76  // Setup the MENU_INFO structure
77  //
78  MenuInformation.MenuHeader = MenuHeader;
79  MenuInformation.MenuFooter = MenuFooter;
80  MenuInformation.ShowBootOptions = ShowBootOptions;
81  MenuInformation.MenuItemList = MenuItemList;
82  MenuInformation.MenuItemCount = MenuItemCount;
83  MenuInformation.MenuTimeRemaining = MenuTimeOut;
84  MenuInformation.SelectedMenuItem = DefaultMenuItem;
85  MenuInformation.Context = Context;
86 
87  //
88  // Calculate the size of the menu box
89  //
90  TuiCalcMenuBoxSize(&MenuInformation);
91 
92  //
93  // Draw the menu
94  //
95  UiVtbl.DrawMenu(&MenuInformation);
96 
97  //
98  // Get the current second of time
99  //
100  LastClockSecond = ArcGetTime()->Second;
101 
102  //
103  // Process keys
104  //
105  while (TRUE)
106  {
107  //
108  // Process key presses
109  //
110  KeyPress = TuiProcessMenuKeyboardEvent(&MenuInformation, KeyPressFilter);
111 
112  //
113  // Check for ENTER or ESC
114  //
115  if (KeyPress == KEY_ENTER) break;
116  if (CanEscape && KeyPress == KEY_ESC) return FALSE;
117 
118  //
119  // Update the date & time
120  //
123 
124  //
125  // Check if there is a countdown
126  //
127  if (MenuInformation.MenuTimeRemaining > 0)
128  {
129  //
130  // Get the updated time, seconds only
131  //
132  CurrentClockSecond = ArcGetTime()->Second;
133 
134  //
135  // Check if more then a second has now elapsed
136  //
137  if (CurrentClockSecond != LastClockSecond)
138  {
139  //
140  // Update the time information
141  //
142  LastClockSecond = CurrentClockSecond;
143  MenuInformation.MenuTimeRemaining--;
144 
145  //
146  // Update the menu
147  //
148  TuiDrawMenuBox(&MenuInformation);
150  }
151  }
152  else if (MenuInformation.MenuTimeRemaining == 0)
153  {
154  //
155  // A time out occurred, exit this loop and return default OS
156  //
157  break;
158  }
159 
160  MachHwIdle();
161  }
162 
163  //
164  // Return the selected item
165  //
166  if (SelectedMenuItem) *SelectedMenuItem = MenuInformation.SelectedMenuItem;
167  return TRUE;
168 }
PCSTR MenuHeader
Definition: ui.h:103
ULONG MenuItemCount
Definition: ui.h:108
LONG MenuTimeRemaining
Definition: ui.h:109
#define TRUE
Definition: types.h:120
#define MachConsGetCh()
Definition: machine.h:90
#define MachHwIdle()
Definition: machine.h:137
VOID TuiUpdateDateTime(VOID)
Definition: tui.c:428
USHORT Second
Definition: fw.h:16
VOID TuiCalcMenuBoxSize(PUI_MENU_INFO MenuInfo)
Definition: tuimenu.c:171
#define KEY_EXTENDED
Definition: keycodes.h:23
VOID VideoCopyOffScreenBufferToVRAM(VOID)
Definition: video.c:34
PVOID Context
Definition: ui.h:111
UIVTBL UiVtbl
Definition: ui.c:58
BOOLEAN ShowBootOptions
Definition: ui.h:105
TIMEINFO * ArcGetTime(VOID)
Definition: arcemul.c:27
#define MachConsKbHit()
Definition: machine.h:88
#define KEY_ESC
Definition: keycodes.h:34
ULONG SelectedMenuItem
Definition: ui.h:110
ULONG TuiProcessMenuKeyboardEvent(PUI_MENU_INFO MenuInfo, UiMenuKeyPressFilterCallback KeyPressFilter)
Definition: tuimenu.c:476
VOID(* DrawMenu)(PUI_MENU_INFO MenuInfo)
Definition: ui.h:182
VOID TuiDrawMenuBox(PUI_MENU_INFO MenuInfo)
Definition: tuimenu.c:270
struct tagContext Context
Definition: acpixf.h:1030
unsigned int ULONG
Definition: retypes.h:1
PCSTR MenuFooter
Definition: ui.h:104
PCSTR * MenuItemList
Definition: ui.h:107
#define KEY_ENTER
Definition: keycodes.h:24

◆ TuiDrawBackdrop()

VOID TuiDrawBackdrop ( VOID  )

Definition at line 83 of file tui.c.

84 {
85  //
86  // Fill in the background (excluding title box & status bar)
87  //
88  TuiFillArea(0,
90  UiScreenWidth - 1,
91  UiScreenHeight - 2,
94 
95  //
96  // Draw the title box
97  //
98  TuiDrawBox(0,
99  0,
100  UiScreenWidth - 1,
102  D_VERT,
103  D_HORZ,
104  TRUE,
105  FALSE,
107 
108  //
109  // Draw version text
110  //
111  TuiDrawText(2,
112  1,
115 
116  //
117  // Draw copyright
118  //
119  TuiDrawText(2,
120  2,
121  BY_AUTHOR,
123  TuiDrawText(2,
124  3,
125  AUTHOR_EMAIL,
127 
128  //
129  // Draw help text
130  //
131  TuiDrawText(UiScreenWidth - 16, 3, /*"F1 for Help"*/"F8 for Options", ATTR(UiTitleBoxFgColor, UiTitleBoxBgColor));
132 
133  //
134  // Draw title text
135  //
137  2,
140 
141  //
142  // Update the date & time
143  //
145 
147 }
#define TRUE
Definition: types.h:120
CHAR UiTitleBoxTitleText[260]
Definition: ui.c:48
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
VOID TuiDrawText(ULONG X, ULONG Y, PCSTR Text, UCHAR Attr)
Definition: tui.c:320
ULONG UiScreenHeight
Definition: ui.c:29
#define TUI_TITLE_BOX_CHAR_HEIGHT
Definition: tui.h:23
UCHAR UiTitleBoxBgColor
Definition: ui.c:37
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:248
#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:153
#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:428
#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 248 of file tui.c.

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

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 352 of file tui.c.

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

◆ TuiDrawMenu()

VOID TuiDrawMenu ( PUI_MENU_INFO  MenuInfo)

Definition at line 233 of file tuimenu.c.

234 {
235  ULONG i;
236 
237  //
238  // Draw the backdrop
239  //
240  UiDrawBackdrop();
241 
242  //
243  // Update the status bar
244  //
245  UiVtbl.DrawStatusText("Use \x18 and \x19 to select, then press ENTER.");
246 
247  //
248  // Draw the menu box
249  //
251 
252  //
253  // Draw each line of the menu
254  //
255  for (i = 0; i < MenuInfo->MenuItemCount; i++)
256  {
258  }
259 
260  /* Display the boot options if needed */
261  if (MenuInfo->ShowBootOptions)
262  {
264  }
265 
267 }
VOID VideoCopyOffScreenBufferToVRAM(VOID)
Definition: video.c:34
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
UIVTBL UiVtbl
Definition: ui.c:58
VOID UiDrawBackdrop(VOID)
Definition: ui.c:214
menu info structure
Definition: window.h:275
VOID(* DrawStatusText)(PCSTR StatusText)
Definition: ui.h:157
VOID TuiDrawMenuBox(PUI_MENU_INFO MenuInfo)
Definition: tuimenu.c:270
VOID DisplayBootTimeOptions(VOID)
Definition: options.c:181
unsigned int ULONG
Definition: retypes.h:1
VOID TuiDrawMenuItem(PUI_MENU_INFO MenuInfo, ULONG MenuItemNumber)
Definition: tuimenu.c:395

◆ TuiDrawMenuBox()

VOID TuiDrawMenuBox ( PUI_MENU_INFO  MenuInfo)

Definition at line 270 of file tuimenu.c.

271 {
272  CHAR MenuLineText[80], TempString[80];
273  ULONG i;
274 
275  //
276  // Draw the menu box if requested
277  //
278  if (UiMenuBox)
279  {
280  UiDrawBox(MenuInfo->Left,
281  MenuInfo->Top,
282  MenuInfo->Right,
283  MenuInfo->Bottom,
284  D_VERT,
285  D_HORZ,
286  FALSE, // Filled
287  TRUE, // Shadow
289  }
290 
291  //
292  // If there is a timeout draw the time remaining
293  //
294  if (MenuInfo->MenuTimeRemaining >= 0)
295  {
296  //
297  // Copy the integral time text string, and remove the last 2 chars
298  //
299  strcpy(TempString, UiTimeText);
300  i = (ULONG)strlen(TempString);
301  TempString[i - 2] = 0;
302 
303  //
304  // Display the first part of the string and the remaining time
305  //
306  strcpy(MenuLineText, TempString);
307  _itoa(MenuInfo->MenuTimeRemaining, TempString, 10);
308  strcat(MenuLineText, TempString);
309 
310  //
311  // Add the last 2 chars
312  //
313  strcat(MenuLineText, &UiTimeText[i - 2]);
314 
315  //
316  // Check if this is a centered menu
317  //
318  if (UiCenterMenu)
319  {
320  //
321  // Display it in the center of the menu
322  //
323  UiDrawText(MenuInfo->Right - (ULONG)strlen(MenuLineText) - 1,
324  MenuInfo->Bottom,
325  MenuLineText,
327  }
328  else
329  {
330  //
331  // Display under the menu directly
332  //
333  UiDrawText(0,
334  MenuInfo->Bottom + 4,
335  MenuLineText,
337  }
338  }
339  else
340  {
341  //
342  // Erase the timeout string with spaces, and 0-terminate for sure
343  //
344  for (i=0; i<sizeof(MenuLineText)-1; i++)
345  {
346  MenuLineText[i] = ' ';
347  }
348  MenuLineText[sizeof(MenuLineText)-1] = 0;
349 
350  //
351  // Draw this "empty" string to erase
352  //
353  if (UiCenterMenu)
354  {
355  UiDrawText(MenuInfo->Right - (ULONG)strlen(MenuLineText) - 1,
356  MenuInfo->Bottom,
357  MenuLineText,
359  }
360  else
361  {
362  UiDrawText(0,
363  MenuInfo->Bottom + 4,
364  MenuLineText,
366  }
367  }
368 
369  //
370  // Loop each item
371  //
372  for (i = 0; i < MenuInfo->MenuItemCount; i++)
373  {
374  //
375  // Check if it's a separator
376  //
377  if (MenuInfo->MenuItemList[i] == NULL)
378  {
379  //
380  // Draw the separator line
381  //
382  UiDrawText(MenuInfo->Left,
383  MenuInfo->Top + i + 1,
384  "\xC7",
386  UiDrawText(MenuInfo->Right,
387  MenuInfo->Top + i + 1,
388  "\xB6",
390  }
391  }
392 }
#define TRUE
Definition: types.h:120
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
CHAR UiTimeText[]
Definition: ui.c:54
char CHAR
Definition: xmlstorage.h:175
BOOLEAN UiCenterMenu
Definition: ui.c:52
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 ATTR(cFore, cBack)
Definition: ui.h:192
smooth NULL
Definition: ftsmooth.c:416
VOID UiDrawText(ULONG X, ULONG Y, PCSTR Text, UCHAR Attr)
Definition: ui.c:234
_CRTIMP char *__cdecl _itoa(_In_ int _Value, _Pre_notnull_ _Post_z_ char *_Dest, _In_ int _Radix)
#define D_HORZ
Definition: ui.h:229
BOOLEAN UiMenuBox
Definition: ui.c:53
VOID UiDrawBox(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR VertStyle, UCHAR HorzStyle, BOOLEAN Fill, BOOLEAN Shadow, UCHAR Attr)
Definition: ui.c:229
UCHAR UiMenuBgColor
Definition: ui.c:41
menu info structure
Definition: window.h:275
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
unsigned int ULONG
Definition: retypes.h:1
UCHAR UiMenuFgColor
Definition: ui.c:40
#define D_VERT
Definition: ui.h:231

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

◆ TuiDrawMenuItem()

VOID TuiDrawMenuItem ( PUI_MENU_INFO  MenuInfo,
ULONG  MenuItemNumber 
)

Definition at line 395 of file tuimenu.c.

397 {
398  ULONG i;
399  CHAR MenuLineText[80];
400  ULONG SpaceTotal;
401  ULONG SpaceLeft;
402  ULONG SpaceRight = 0;
403  UCHAR Attribute = ATTR(UiTextColor, UiMenuBgColor);
404 
405  //
406  // Check if using centered menu
407  //
408  if (UiCenterMenu)
409  {
410  //
411  // We will want the string centered so calculate
412  // how many spaces will be to the left and right
413  //
414  SpaceTotal = (MenuInfo->Right - MenuInfo->Left - 2) -
415  (ULONG)(MenuInfo->MenuItemList[MenuItemNumber] ?
416  strlen(MenuInfo->MenuItemList[MenuItemNumber]) : 0);
417  SpaceLeft = (SpaceTotal / 2) + 1;
418  SpaceRight = (SpaceTotal - SpaceLeft) + 1;
419 
420  //
421  // Insert the spaces on the left
422  //
423  for (i = 0; i < SpaceLeft; i++) MenuLineText[i] = ' ';
424  MenuLineText[i] = '\0';
425  }
426  else
427  {
428  //
429  // Simply left-align it
430  //
431  MenuLineText[0] = '\0';
432  strcat(MenuLineText, " ");
433  }
434 
435  //
436  // Now append the text string
437  //
438  if (MenuInfo->MenuItemList[MenuItemNumber])
439  strcat(MenuLineText, MenuInfo->MenuItemList[MenuItemNumber]);
440 
441  //
442  // Check if using centered menu, and add spaces on the right if so
443  //
444  if (UiCenterMenu) for (i=0; i < SpaceRight; i++) strcat(MenuLineText, " ");
445 
446  //
447  // If it is a separator
448  //
449  if (MenuInfo->MenuItemList[MenuItemNumber] == NULL)
450  {
451  //
452  // Make it a separator line and use menu colors
453  //
454  memset(MenuLineText, 0, 80);
455  memset(MenuLineText, 0xC4, (MenuInfo->Right - MenuInfo->Left - 1));
456  Attribute = ATTR(UiMenuFgColor, UiMenuBgColor);
457  }
458  else if (MenuItemNumber == MenuInfo->SelectedMenuItem)
459  {
460  //
461  // If this is the selected item, use the selected colors
462  //
464  }
465 
466  //
467  // Draw the item
468  //
469  UiDrawText(MenuInfo->Left + 1,
470  MenuInfo->Top + 1 + MenuItemNumber,
471  MenuLineText,
472  Attribute);
473 }
UCHAR UiTextColor
Definition: ui.c:42
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char CHAR
Definition: xmlstorage.h:175
BOOLEAN UiCenterMenu
Definition: ui.c:52
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 ATTR(cFore, cBack)
Definition: ui.h:192
smooth NULL
Definition: ftsmooth.c:416
VOID UiDrawText(ULONG X, ULONG Y, PCSTR Text, UCHAR Attr)
Definition: ui.c:234
unsigned char UCHAR
Definition: xmlstorage.h:181
UCHAR UiMenuBgColor
Definition: ui.c:41
menu info structure
Definition: window.h:275
UCHAR UiSelectedTextBgColor
Definition: ui.c:44
unsigned int ULONG
Definition: retypes.h:1
UCHAR UiMenuFgColor
Definition: ui.c:40
#define memset(x, y, z)
Definition: compat.h:39
UCHAR UiSelectedTextColor
Definition: ui.c:43

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

◆ TuiDrawProgressBar()

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

Definition at line 663 of file tui.c.

664 {
665  ULONG i;
666  ULONG ProgressBarWidth = (Right - Left) - 3;
667 
668  // First make sure the progress bar text fits
669  UiTruncateStringEllipsis(ProgressText, ProgressBarWidth - 4);
670 
671  if (Position > Range)
672  {
673  Position = Range;
674  }
675 
676  // Draw the box
678 
679  //
680  // Draw the "Loading..." text
681  //
682  TuiDrawCenteredText(Left + 2, Top + 2, Right - 2, Top + 2, ProgressText, ATTR(UiTextColor, UiMenuBgColor));
683 
684  // Draw the percent complete
685  for (i=0; i<(Position*ProgressBarWidth)/Range; i++)
686  {
687  TuiDrawText(Left+2+i, Top+2, "\xDB", ATTR(UiTextColor, UiMenuBgColor));
688  }
689 
690  // Draw the shadow
691  for (; i<ProgressBarWidth; i++)
692  {
693  TuiDrawText(Left+2+i, Top+2, "\xB2", ATTR(UiTextColor, UiMenuBgColor));
694  }
695 
698 }
#define TRUE
Definition: types.h:120
UCHAR UiTextColor
Definition: ui.c:42
VOID TuiDrawCenteredText(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, PCSTR TextString, UCHAR Attr)
Definition: tui.c:352
VOID TuiDrawText(ULONG X, ULONG Y, PCSTR Text, UCHAR Attr)
Definition: tui.c:320
static COORD Position
Definition: mouse.c:34
#define HORZ
Definition: ui.h:228
VOID VideoCopyOffScreenBufferToVRAM(VOID)
Definition: video.c:34
struct tagRange Range
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 TuiDrawBox(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR VertStyle, UCHAR HorzStyle, BOOLEAN Fill, BOOLEAN Shadow, UCHAR Attr)
Definition: tui.c:248
#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
unsigned int ULONG
Definition: retypes.h:1
UCHAR UiMenuFgColor
Definition: ui.c:40
VOID TuiUpdateDateTime(VOID)
Definition: tui.c:428
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 648 of file tui.c.

649 {
650  ULONG Left, Top, Right, Bottom;
651  ULONG Width = 50; // Allow for 50 "bars"
652  ULONG Height = 2;
653 
654  Left = (UiScreenWidth - Width - 4) / 2;
655  Right = Left + Width + 3;
656  Top = (UiScreenHeight - Height - 2) / 2;
657  Top += 2;
658  Bottom = Top + Height + 1;
659 
660  TuiDrawProgressBar(Left, Top, Right, Bottom, Position, Range, ProgressText);
661 }
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:663
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 188 of file tui.c.

189 {
190  PUCHAR ScreenMemory = (PUCHAR)TextVideoBuffer;
191  ULONG Idx;
192 
193  // Shade the bottom of the area
194  if (Bottom < (UiScreenHeight - 1))
195  {
196  if (UiScreenHeight < 34)
197  {
198  Idx=Left + 2;
199  }
200  else
201  {
202  Idx=Left + 1;
203  }
204 
205  for (; Idx<=Right; Idx++)
206  {
207  ScreenMemory[(((Bottom+1)*2)*UiScreenWidth)+(Idx*2)+1] = ATTR(COLOR_GRAY, COLOR_BLACK);
208  }
209  }
210 
211  // Shade the right of the area
212  if (Right < (UiScreenWidth - 1))
213  {
214  for (Idx=Top+1; Idx<=Bottom; Idx++)
215  {
216  ScreenMemory[((Idx*2)*UiScreenWidth)+((Right+1)*2)+1] = ATTR(COLOR_GRAY, COLOR_BLACK);
217  }
218  }
219  if (UiScreenHeight < 34)
220  {
221  if ((Right + 1) < (UiScreenWidth - 1))
222  {
223  for (Idx=Top+1; Idx<=Bottom; Idx++)
224  {
225  ScreenMemory[((Idx*2)*UiScreenWidth)+((Right+2)*2)+1] = ATTR(COLOR_GRAY, COLOR_BLACK);
226  }
227  }
228  }
229 
230  // Shade the bottom right corner
231  if ((Right < (UiScreenWidth - 1)) && (Bottom < (UiScreenHeight - 1)))
232  {
233  ScreenMemory[(((Bottom+1)*2)*UiScreenWidth)+((Right+1)*2)+1] = ATTR(COLOR_GRAY, COLOR_BLACK);
234  }
235  if (UiScreenHeight < 34)
236  {
237  if (((Right + 1) < (UiScreenWidth - 1)) && (Bottom < (UiScreenHeight - 1)))
238  {
239  ScreenMemory[(((Bottom+1)*2)*UiScreenWidth)+((Right+2)*2)+1] = ATTR(COLOR_GRAY, COLOR_BLACK);
240  }
241  }
242 }
#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 413 of file tui.c.

414 {
415  SIZE_T i;
416 
419 
420  for (i=strlen(StatusText)+1; i<UiScreenWidth; i++)
421  {
423  }
424 
426 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
VOID TuiDrawText(ULONG X, ULONG Y, PCSTR Text, UCHAR Attr)
Definition: tui.c:320
ULONG UiScreenHeight
Definition: ui.c:29
VOID VideoCopyOffScreenBufferToVRAM(VOID)
Definition: video.c:34
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 ATTR(cFore, cBack)
Definition: ui.h:192
UCHAR UiStatusBarBgColor
Definition: ui.c:32
ULONG_PTR SIZE_T
Definition: typedefs.h:78
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 320 of file tui.c.

321 {
322  PUCHAR ScreenMemory = (PUCHAR)TextVideoBuffer;
323  ULONG i, j;
324 
325  // Draw the text
326  for (i = X, j = 0; Text[j] && i < UiScreenWidth; i++, j++)
327  {
328  ScreenMemory[((Y*2)*UiScreenWidth)+(i*2)] = (UCHAR)Text[j];
329  ScreenMemory[((Y*2)*UiScreenWidth)+(i*2)+1] = Attr;
330  }
331 }
#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 i
Definition: glfuncs.h:248
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
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 339 of file tui.c.

340 {
341  PUCHAR ScreenMemory = (PUCHAR)TextVideoBuffer;
342  ULONG i, j;
343 
344  // Draw the text
345  for (i = X, j = 0; Text[j] && i < UiScreenWidth && (MaxNumChars > 0 ? j < MaxNumChars : TRUE); i++, j++)
346  {
347  ScreenMemory[((Y*2)*UiScreenWidth)+(i*2)] = (UCHAR)Text[j];
348  ScreenMemory[((Y*2)*UiScreenWidth)+(i*2)+1] = Attr;
349  }
350 }
#define TRUE
Definition: types.h:120
#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 i
Definition: glfuncs.h:248
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
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 815 of file tui.c.

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

◆ TuiFadeInBackdrop()

VOID TuiFadeInBackdrop ( VOID  )

Definition at line 759 of file tui.c.

760 {
761  PPALETTE_ENTRY TuiFadePalette = NULL;
762 
764  {
765  TuiFadePalette = (PPALETTE_ENTRY)FrLdrTempAlloc(sizeof(PALETTE_ENTRY) * 64,
767 
768  if (TuiFadePalette != NULL)
769  {
770  VideoSavePaletteState(TuiFadePalette, 64);
772  }
773  }
774 
775  // Draw the backdrop and title box
776  TuiDrawBackdrop();
777 
778  if (UiUseSpecialEffects && ! MachVideoIsPaletteFixed() && TuiFadePalette != NULL)
779  {
780  VideoFadeIn(TuiFadePalette, 64);
781  FrLdrTempFree(TuiFadePalette, TAG_TAG_TUI_PALETTE);
782  }
783 }
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:177
smooth NULL
Definition: ftsmooth.c:416
Definition: video.h:11
struct _PALETTE_ENTRY * PPALETTE_ENTRY
VOID TuiDrawBackdrop(VOID)
Definition: tui.c:83
BOOLEAN UiUseSpecialEffects
Definition: ui.c:50
#define TAG_TAG_TUI_PALETTE
Definition: tui.c:23
#define MachVideoIsPaletteFixed()
Definition: machine.h:110
VOID VideoSetAllColorsToBlack(ULONG ColorCount)
Definition: video.c:63
FORCEINLINE VOID FrLdrTempFree(PVOID Allocation, ULONG Tag)
Definition: mm.h:186

◆ TuiFadeOut()

VOID TuiFadeOut ( VOID  )

Definition at line 785 of file tui.c.

786 {
787  PPALETTE_ENTRY TuiFadePalette = NULL;
788 
790  {
791  TuiFadePalette = (PPALETTE_ENTRY)FrLdrTempAlloc(sizeof(PALETTE_ENTRY) * 64,
793 
794  if (TuiFadePalette != NULL)
795  {
796  VideoSavePaletteState(TuiFadePalette, 64);
797  }
798  }
799 
800  if (UiUseSpecialEffects && ! MachVideoIsPaletteFixed() && TuiFadePalette != NULL)
801  {
802  VideoFadeOut(64);
803  }
804 
806 
807  if (UiUseSpecialEffects && ! MachVideoIsPaletteFixed() && TuiFadePalette != NULL)
808  {
809  VideoRestorePaletteState(TuiFadePalette, 64);
810  FrLdrTempFree(TuiFadePalette, TAG_TAG_TUI_PALETTE);
811  }
812 
813 }
VOID VideoSavePaletteState(PPALETTE_ENTRY Palette, ULONG ColorCount)
Definition: video.c:40
FORCEINLINE PVOID FrLdrTempAlloc(_In_ SIZE_T Size, _In_ ULONG Tag)
Definition: mm.h:177
smooth NULL
Definition: ftsmooth.c:416
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 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:186

Referenced by TuiUnInitialize().

◆ TuiFillArea()

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

Definition at line 153 of file tui.c.

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

53 {
57 
59  if (TextVideoBuffer == NULL)
60  {
61  return FALSE;
62  }
63 
64  return TRUE;
65 }
#define TRUE
Definition: types.h:120
#define COLOR_BLACK
Definition: ui.h:204
#define ATTR(cFore, cBack)
Definition: ui.h:192
smooth NULL
Definition: ftsmooth.c:416
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
PVOID VideoAllocateOffScreenBuffer(VOID)
Definition: video.c:17

◆ TuiMessageBox()

VOID TuiMessageBox ( PCSTR  MessageText)

Definition at line 545 of file tui.c.

546 {
548 
549  // Save the screen contents
553 
554  // Display the message box
555  TuiMessageBoxCritical(MessageText);
556 
557  // Restore the screen contents
560 }
ULONG UiScreenHeight
Definition: ui.c:29
VOID TuiSaveScreen(PUCHAR Buffer)
Definition: tui.c:523
FORCEINLINE PVOID FrLdrTempAlloc(_In_ SIZE_T Size, _In_ ULONG Tag)
Definition: mm.h:177
VOID TuiMessageBoxCritical(PCSTR MessageText)
Definition: tui.c:562
VOID TuiRestoreScreen(PUCHAR Buffer)
Definition: tui.c:534
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:186

◆ TuiMessageBoxCritical()

VOID TuiMessageBoxCritical ( PCSTR  MessageText)

Definition at line 562 of file tui.c.

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

Referenced by TuiMessageBox().

◆ TuiPrintf()

int TuiPrintf ( const char format,
  ... 
)

Definition at line 31 of file tui.c.

32 {
33  int i;
34  int Length;
35  va_list ap;
36  CHAR Buffer[512];
37 
38  va_start(ap, Format);
39  Length = _vsnprintf(Buffer, sizeof(Buffer), Format, ap);
40  va_end(ap);
41 
42  if (Length == -1) Length = sizeof(Buffer);
43 
44  for (i = 0; i < Length; i++)
45  {
47  }
48 
49  return Length;
50 }
char CHAR
Definition: xmlstorage.h:175
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 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
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define va_start(ap, A)
Definition: acmsvcex.h:91
#define _vsnprintf
Definition: xmlstorage.h:202
void int int ULONGLONG int va_list * ap
Definition: winesup.h:32
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34

Referenced by MachInit().

◆ TuiProcessMenuKeyboardEvent()

ULONG TuiProcessMenuKeyboardEvent ( PUI_MENU_INFO  MenuInfo,
UiMenuKeyPressFilterCallback  KeyPressFilter 
)

Definition at line 476 of file tuimenu.c.

478 {
479  ULONG KeyEvent = 0;
480  ULONG Selected, Count;
481 
482  //
483  // Check for a keypress
484  //
485  if (!MachConsKbHit())
486  return 0; // None, bail out
487 
488  //
489  // Check if the timeout is not already complete
490  //
491  if (MenuInfo->MenuTimeRemaining != -1)
492  {
493  //
494  // Cancel it and remove it
495  //
496  MenuInfo->MenuTimeRemaining = -1;
497  TuiDrawMenuBox(MenuInfo); // FIXME: Remove for minimal UI too
498  }
499 
500  //
501  // Get the key (get the extended key if needed)
502  //
503  KeyEvent = MachConsGetCh();
504  if (KeyEvent == KEY_EXTENDED)
505  KeyEvent = MachConsGetCh();
506 
507  //
508  // Call the supplied key filter callback function to see
509  // if it is going to handle this keypress.
510  //
511  if (KeyPressFilter &&
512  KeyPressFilter(KeyEvent, MenuInfo->SelectedMenuItem, MenuInfo->Context))
513  {
514  //
515  // It processed the key character, so redraw and exit
516  //
518  return 0;
519  }
520 
521  //
522  // Process the key
523  //
524  if ((KeyEvent == KEY_UP ) || (KeyEvent == KEY_DOWN) ||
525  (KeyEvent == KEY_HOME) || (KeyEvent == KEY_END ))
526  {
527  //
528  // Get the current selected item and count
529  //
530  Selected = MenuInfo->SelectedMenuItem;
531  Count = MenuInfo->MenuItemCount - 1;
532 
533  //
534  // Check the key and change the selected menu item
535  //
536  if ((KeyEvent == KEY_UP) && (Selected > 0))
537  {
538  //
539  // Deselect previous item and go up
540  //
541  MenuInfo->SelectedMenuItem--;
542  TuiDrawMenuItem(MenuInfo, Selected);
543  Selected--;
544 
545  // Skip past any separators
546  if ((Selected > 0) &&
547  (MenuInfo->MenuItemList[Selected] == NULL))
548  {
549  MenuInfo->SelectedMenuItem--;
550  }
551  }
552  else if ( ((KeyEvent == KEY_UP) && (Selected == 0)) ||
553  (KeyEvent == KEY_END) )
554  {
555  //
556  // Go to the end
557  //
558  MenuInfo->SelectedMenuItem = Count;
559  TuiDrawMenuItem(MenuInfo, Selected);
560  }
561  else if ((KeyEvent == KEY_DOWN) && (Selected < Count))
562  {
563  //
564  // Deselect previous item and go down
565  //
566  MenuInfo->SelectedMenuItem++;
567  TuiDrawMenuItem(MenuInfo, Selected);
568  Selected++;
569 
570  // Skip past any separators
571  if ((Selected < Count) &&
572  (MenuInfo->MenuItemList[Selected] == NULL))
573  {
574  MenuInfo->SelectedMenuItem++;
575  }
576  }
577  else if ( ((KeyEvent == KEY_DOWN) && (Selected == Count)) ||
578  (KeyEvent == KEY_HOME) )
579  {
580  //
581  // Go to the beginning
582  //
583  MenuInfo->SelectedMenuItem = 0;
584  TuiDrawMenuItem(MenuInfo, Selected);
585  }
586 
587  //
588  // Select new item and update video buffer
589  //
590  TuiDrawMenuItem(MenuInfo, MenuInfo->SelectedMenuItem);
592  }
593 
594  //
595  // Return the pressed key
596  //
597  return KeyEvent;
598 }
#define MachConsGetCh()
Definition: machine.h:90
#define KEY_DOWN
Definition: keycodes.h:31
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
#define KEY_EXTENDED
Definition: keycodes.h:23
VOID VideoCopyOffScreenBufferToVRAM(VOID)
Definition: video.c:34
UIVTBL UiVtbl
Definition: ui.c:58
smooth NULL
Definition: ftsmooth.c:416
#define MachConsKbHit()
Definition: machine.h:88
#define KEY_HOME
Definition: keycodes.h:29
menu info structure
Definition: window.h:275
VOID(* DrawMenu)(PUI_MENU_INFO MenuInfo)
Definition: ui.h:182
#define KEY_UP
Definition: keycodes.h:30
VOID TuiDrawMenuBox(PUI_MENU_INFO MenuInfo)
Definition: tuimenu.c:270
unsigned int ULONG
Definition: retypes.h:1
#define KEY_END
Definition: keycodes.h:49
VOID TuiDrawMenuItem(PUI_MENU_INFO MenuInfo, ULONG MenuItemNumber)
Definition: tuimenu.c:395

Referenced by TuiDisplayMenu().

◆ TuiRestoreScreen()

VOID TuiRestoreScreen ( PUCHAR  Buffer)

Definition at line 534 of file tui.c.

535 {
536  PUCHAR ScreenMemory = (PUCHAR)TextVideoBuffer;
537  ULONG i;
538 
539  for (i=0; i < (UiScreenWidth * UiScreenHeight * 2); i++)
540  {
541  ScreenMemory[i] = Buffer[i];
542  }
543 }
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 i
Definition: glfuncs.h:248
Definition: bufpool.h:45
PVOID TextVideoBuffer
Definition: tui.c:25
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 523 of file tui.c.

524 {
525  PUCHAR ScreenMemory = (PUCHAR)TextVideoBuffer;
526  ULONG i;
527 
528  for (i=0; i < (UiScreenWidth * UiScreenHeight * 2); i++)
529  {
530  Buffer[i] = ScreenMemory[i];
531  }
532 }
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 i
Definition: glfuncs.h:248
Definition: bufpool.h:45
PVOID TextVideoBuffer
Definition: tui.c:25
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 700 of file tui.c.

701 {
702  static const struct
703  {
704  PCSTR ColorName;
705  UCHAR ColorValue;
706  } Colors[] =
707  {
708  {"Black" , COLOR_BLACK },
709  {"Blue" , COLOR_BLUE },
710  {"Green" , COLOR_GREEN },
711  {"Cyan" , COLOR_CYAN },
712  {"Red" , COLOR_RED },
713  {"Magenta", COLOR_MAGENTA},
714  {"Brown" , COLOR_BROWN },
715  {"Gray" , COLOR_GRAY },
716  {"DarkGray" , COLOR_DARKGRAY },
717  {"LightBlue" , COLOR_LIGHTBLUE },
718  {"LightGreen" , COLOR_LIGHTGREEN },
719  {"LightCyan" , COLOR_LIGHTCYAN },
720  {"LightRed" , COLOR_LIGHTRED },
721  {"LightMagenta", COLOR_LIGHTMAGENTA},
722  {"Yellow" , COLOR_YELLOW },
723  {"White" , COLOR_WHITE },
724  };
725  ULONG i;
726 
727  for (i = 0; i < sizeof(Colors)/sizeof(Colors[0]); ++i)
728  {
729  if (_stricmp(ColorText, Colors[i].ColorName) == 0)
730  return Colors[i].ColorValue;
731  }
732 
733  return COLOR_BLACK;
734 }
#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
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_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
#define COLOR_MAGENTA
Definition: ui.h:209
unsigned int ULONG
Definition: retypes.h:1
const char * PCSTR
Definition: typedefs.h:51
#define COLOR_LIGHTGREEN
Definition: ui.h:215

◆ TuiTextToFillStyle()

UCHAR TuiTextToFillStyle ( PCSTR  FillStyleText)

Definition at line 736 of file tui.c.

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

◆ TuiUnInitialize()

VOID TuiUnInitialize ( VOID  )

Definition at line 67 of file tui.c.

68 {
70  {
71  TuiFadeOut();
72  }
73  else
74  {
76  }
77 
81 }
#define TRUE
Definition: types.h:120
#define COLOR_BLACK
Definition: ui.h:204
VOID TuiFadeOut(VOID)
Definition: tui.c:785
#define ATTR(cFore, cBack)
Definition: ui.h:192
smooth NULL
Definition: ftsmooth.c:416
#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 MachVideoSetDisplayMode(Mode, Init)
Definition: machine.h:94

◆ TuiUpdateDateTime()

VOID TuiUpdateDateTime ( VOID  )

Definition at line 428 of file tui.c.

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

◆ TuiVtbl

const UIVTBL TuiVtbl

Definition at line 1048 of file tui.c.

Referenced by UiInitialize().