ReactOS  0.4.13-dev-464-g6b95727
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 NTAPI TuiCalcMenuBoxSize (PUI_MENU_INFO MenuInfo)
 
VOID TuiDrawMenu (PUI_MENU_INFO MenuInfo)
 
VOID NTAPI TuiDrawMenuBox (PUI_MENU_INFO MenuInfo)
 
VOID NTAPI TuiDrawMenuItem (PUI_MENU_INFO MenuInfo, ULONG MenuItemNumber)
 
ULONG NTAPI TuiProcessMenuKeyboardEvent (PUI_MENU_INFO MenuInfo, UiMenuKeyPressFilterCallback KeyPressFilter)
 
BOOLEAN TuiDisplayMenu (PCSTR MenuHeader, PCSTR MenuFooter, BOOLEAN ShowBootOptions, PCSTR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG *SelectedMenuItem, BOOLEAN CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter)
 

Variables

const UIVTBL TuiVtbl
 

Macro Definition Documentation

◆ D_LL

#define D_LL   (0xc8)

Definition at line 77 of file tui.h.

◆ D_LR

#define D_LR   (0xbc)

Definition at line 78 of file tui.h.

◆ D_UL

#define D_UL   (0xc9)

Definition at line 75 of file tui.h.

◆ D_UR

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

Definition at line 76 of file tui.h.

◆ HD_LL

#define HD_LL   (0xd4)

Definition at line 82 of file tui.h.

◆ HD_LR

#define HD_LR   (0xbe)

Definition at line 83 of file tui.h.

◆ HD_UL

#define HD_UL   (0xd5)

Definition at line 80 of file tui.h.

◆ HD_UR

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

Definition at line 81 of file tui.h.

◆ LL

#define LL   (0xc0)

Definition at line 72 of file tui.h.

◆ LR

#define LR   (0xd9)

Definition at line 73 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 70 of file tui.h.

◆ UR

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

Definition at line 71 of file tui.h.

◆ VD_LL

#define VD_LL   (0xd3)

Definition at line 87 of file tui.h.

◆ VD_LR

#define VD_LR   (0xbd)

Definition at line 88 of file tui.h.

◆ VD_UL

#define VD_UL   (0xd6)

Definition at line 85 of file tui.h.

◆ VD_UR

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

Definition at line 86 of file tui.h.

Function Documentation

◆ TuiCalcMenuBoxSize()

VOID NTAPI TuiCalcMenuBoxSize ( PUI_MENU_INFO  MenuInfo)

Definition at line 173 of file tuimenu.c.

174 {
175  ULONG i;
176  ULONG Width = 0;
177  ULONG Height;
178  ULONG Length;
179 
180  //
181  // Height is the menu item count plus 2 (top border & bottom border)
182  //
183  Height = MenuInfo->MenuItemCount + 2;
184  Height -= 1; // Height is zero-based
185 
186  //
187  // Loop every item
188  //
189  for(i = 0; i < MenuInfo->MenuItemCount; i++)
190  {
191  //
192  // Get the string length and make it become the new width if necessary
193  //
194  if (MenuInfo->MenuItemList[i])
195  {
196  Length = (ULONG)strlen(MenuInfo->MenuItemList[i]);
197  if (Length > Width) Width = Length;
198  }
199  }
200 
201  //
202  // Allow room for left & right borders, plus 8 spaces on each side
203  //
204  Width += 18;
205 
206  //
207  // Check if we're drawing a centered menu
208  //
209  if (UiCenterMenu)
210  {
211  //
212  // Calculate the menu box area for a centered menu
213  //
214  MenuInfo->Left = (UiScreenWidth - Width) / 2;
216  Height) / 2) + TUI_TITLE_BOX_CHAR_HEIGHT;
217  }
218  else
219  {
220  //
221  // Put the menu in the default left-corner position
222  //
223  MenuInfo->Left = -1;
224  MenuInfo->Top = 4;
225  }
226 
227  //
228  // The other margins are the same
229  //
230  MenuInfo->Right = (MenuInfo->Left) + Width;
231  MenuInfo->Bottom = (MenuInfo->Top) + Height;
232 }
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 ( PCSTR  MenuHeader,
PCSTR  MenuFooter,
BOOLEAN  ShowBootOptions,
PCSTR  MenuItemList[],
ULONG  MenuItemCount,
ULONG  DefaultMenuItem,
LONG  MenuTimeOut,
ULONG SelectedMenuItem,
BOOLEAN  CanEscape,
UiMenuKeyPressFilterCallback  KeyPressFilter 
)

Definition at line 17 of file tuimenu.c.

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

◆ TuiDrawBackdrop()

VOID TuiDrawBackdrop ( VOID  )

Definition at line 81 of file tui.c.

82 {
83  //
84  // Fill in the background (excluding title box & status bar)
85  //
86  TuiFillArea(0,
88  UiScreenWidth - 1,
89  UiScreenHeight - 2,
92 
93  //
94  // Draw the title box
95  //
96  TuiDrawBox(0,
97  0,
98  UiScreenWidth - 1,
100  D_VERT,
101  D_HORZ,
102  TRUE,
103  FALSE,
105 
106  //
107  // Draw version text
108  //
109  TuiDrawText(2,
110  1,
113 
114  //
115  // Draw copyright
116  //
117  TuiDrawText(2,
118  2,
119  BY_AUTHOR,
121  TuiDrawText(2,
122  3,
123  AUTHOR_EMAIL,
125 
126  //
127  // Draw help text
128  //
129  TuiDrawText(UiScreenWidth - 16, 3, /*"F1 for Help"*/"F8 for Options", ATTR(UiTitleBoxFgColor, UiTitleBoxBgColor));
130 
131  //
132  // Draw title text
133  //
135  2,
138 
139  //
140  // Update the date & time
141  //
143 
145 }
#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:318
ULONG UiScreenHeight
Definition: ui.c:29
#define TUI_TITLE_BOX_CHAR_HEIGHT
Definition: tui.h:23
UCHAR UiTitleBoxBgColor
Definition: ui.c:37
const PCSTR GetFreeLoaderVersionString(VOID)
Definition: version.c:32
VOID TuiDrawBox(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR VertStyle, UCHAR HorzStyle, BOOLEAN Fill, BOOLEAN Shadow, UCHAR Attr)
Definition: tui.c:246
#define ATTR(cFore, cBack)
Definition: ui.h:152
#define D_HORZ
Definition: ui.h:189
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:151
#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 VideoCopyOffScreenBufferToVRAM(VOID)
Definition: video.c:41
VOID TuiUpdateDateTime(VOID)
Definition: tui.c:426
#define D_VERT
Definition: ui.h:191

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

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

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

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

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

◆ TuiDrawMenuBox()

VOID NTAPI TuiDrawMenuBox ( PUI_MENU_INFO  MenuInfo)

Definition at line 273 of file tuimenu.c.

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

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

◆ TuiDrawMenuItem()

VOID NTAPI TuiDrawMenuItem ( PUI_MENU_INFO  MenuInfo,
ULONG  MenuItemNumber 
)

Definition at line 399 of file tuimenu.c.

401 {
402  ULONG i;
403  CHAR MenuLineText[80];
404  ULONG SpaceTotal;
405  ULONG SpaceLeft;
406  ULONG SpaceRight = 0;
407  UCHAR Attribute = ATTR(UiTextColor, UiMenuBgColor);
408 
409  //
410  // Check if using centered menu
411  //
412  if (UiCenterMenu)
413  {
414  //
415  // We will want the string centered so calculate
416  // how many spaces will be to the left and right
417  //
418  SpaceTotal = (MenuInfo->Right - MenuInfo->Left - 2) -
419  (ULONG)(MenuInfo->MenuItemList[MenuItemNumber] ?
420  strlen(MenuInfo->MenuItemList[MenuItemNumber]) : 0);
421  SpaceLeft = (SpaceTotal / 2) + 1;
422  SpaceRight = (SpaceTotal - SpaceLeft) + 1;
423 
424  //
425  // Insert the spaces on the left
426  //
427  for (i = 0; i < SpaceLeft; i++) MenuLineText[i] = ' ';
428  MenuLineText[i] = '\0';
429  }
430  else
431  {
432  //
433  // Simply left-align it
434  //
435  MenuLineText[0] = '\0';
436  strcat(MenuLineText, " ");
437  }
438 
439  //
440  // Now append the text string
441  //
442  if (MenuInfo->MenuItemList[MenuItemNumber])
443  strcat(MenuLineText, MenuInfo->MenuItemList[MenuItemNumber]);
444 
445  //
446  // Check if using centered menu, and add spaces on the right if so
447  //
448  if (UiCenterMenu) for (i=0; i < SpaceRight; i++) strcat(MenuLineText, " ");
449 
450  //
451  // If it is a separator
452  //
453  if (MenuInfo->MenuItemList[MenuItemNumber] == NULL)
454  {
455  //
456  // Make it a separator line and use menu colors
457  //
458  memset(MenuLineText, 0, 80);
459  memset(MenuLineText, 0xC4, (MenuInfo->Right - MenuInfo->Left - 1));
460  Attribute = ATTR(UiMenuFgColor, UiMenuBgColor);
461  }
462  else if (MenuItemNumber == MenuInfo->SelectedMenuItem)
463  {
464  //
465  // If this is the selected item, use the selected colors
466  //
468  }
469 
470  //
471  // Draw the item
472  //
473  UiDrawText(MenuInfo->Left + 1,
474  MenuInfo->Top + 1 + MenuItemNumber,
475  MenuLineText,
476  Attribute);
477 }
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:152
smooth NULL
Definition: ftsmooth.c:416
VOID UiDrawText(ULONG X, ULONG Y, PCSTR Text, UCHAR Attr)
Definition: ui.c:261
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 666 of file tui.c.

667 {
668  ULONG i;
669  ULONG ProgressBarWidth = (Right - Left) - 3;
670 
671  // First make sure the progress bar text fits
672  UiTruncateStringEllipsis(ProgressText, ProgressBarWidth - 4);
673 
674  if (Position > Range)
675  {
676  Position = Range;
677  }
678 
679  // Draw the box
681 
682  //
683  // Draw the "Loading..." text
684  //
685  TuiDrawCenteredText(Left + 2, Top + 2, Right - 2, Top + 2, ProgressText, ATTR(UiTextColor, UiMenuBgColor));
686 
687  // Draw the percent complete
688  for (i=0; i<(Position*ProgressBarWidth)/Range; i++)
689  {
690  TuiDrawText(Left+2+i, Top+2, "\xDB", ATTR(UiTextColor, UiMenuBgColor));
691  }
692 
693  // Draw the shadow
694  for (; i<ProgressBarWidth; i++)
695  {
696  TuiDrawText(Left+2+i, Top+2, "\xB2", ATTR(UiTextColor, UiMenuBgColor));
697  }
698 
701 }
#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:350
VOID TuiDrawText(ULONG X, ULONG Y, PCSTR Text, UCHAR Attr)
Definition: tui.c:318
static COORD Position
Definition: mouse.c:34
#define HORZ
Definition: ui.h:188
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:246
#define ATTR(cFore, cBack)
Definition: ui.h:152
UCHAR UiMenuBgColor
Definition: ui.c:41
Definition: range.c:43
VOID UiTruncateStringEllipsis(PCHAR StringText, ULONG MaxChars)
Definition: ui.c:451
static LPHIST_ENTRY Bottom
Definition: history.c:54
unsigned int ULONG
Definition: retypes.h:1
UCHAR UiMenuFgColor
Definition: ui.c:40
VOID VideoCopyOffScreenBufferToVRAM(VOID)
Definition: video.c:41
VOID TuiUpdateDateTime(VOID)
Definition: tui.c:426
static LPHIST_ENTRY Top
Definition: history.c:53
#define VERT
Definition: ui.h:190

Referenced by TuiDrawProgressBarCenter().

◆ TuiDrawProgressBarCenter()

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

Definition at line 651 of file tui.c.

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

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

412 {
413  SIZE_T i;
414 
417 
418  for (i=strlen(StatusText)+1; i<UiScreenWidth; i++)
419  {
421  }
422 
424 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
VOID TuiDrawText(ULONG X, ULONG Y, PCSTR Text, UCHAR Attr)
Definition: tui.c:318
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
#define ATTR(cFore, cBack)
Definition: ui.h:152
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
VOID VideoCopyOffScreenBufferToVRAM(VOID)
Definition: video.c:41
UCHAR UiStatusBarFgColor
Definition: ui.c:31

◆ TuiDrawText()

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

Definition at line 318 of file tui.c.

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

338 {
339  PUCHAR ScreenMemory = (PUCHAR)TextVideoBuffer;
340  ULONG i, j;
341 
342  // Draw the text
343  for (i = X, j = 0; Text[j] && i < UiScreenWidth && (MaxNumChars > 0 ? j < MaxNumChars : TRUE); i++, j++)
344  {
345  ScreenMemory[((Y*2)*UiScreenWidth)+(i*2)] = (UCHAR)Text[j];
346  ScreenMemory[((Y*2)*UiScreenWidth)+(i*2)+1] = Attr;
347  }
348 }
#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 = 0;
886  EditBoxTextPosition = 0;
887  EditBoxLine = y2 - 2;
888  EditBoxStartX = x1 + 3;
889  EditBoxEndX = x2 - 3;
890  UiFillArea(EditBoxStartX, EditBoxLine, EditBoxEndX, EditBoxLine, ' ', ATTR(UiEditBoxTextColor, UiEditBoxBgColor));
891 
892  // Show the cursor
893  EditBoxCursorX = EditBoxStartX;
894  MachVideoSetTextCursorPosition(EditBoxCursorX, EditBoxLine);
896 
897  // Draw status text
898  UiDrawStatusText("Press ENTER to continue, or ESC to cancel");
899 
901 
902  //
903  // Enter the text. Please keep in mind that the default input mode
904  // of the edit boxes is in insertion mode, that is, you can insert
905  // text without erasing the existing one.
906  //
907  for (;;)
908  {
909  if (MachConsKbHit())
910  {
911  Extended = FALSE;
912  key = MachConsGetCh();
913  if(key == KEY_EXTENDED)
914  {
915  Extended = TRUE;
916  key = MachConsGetCh();
917  }
918 
919  if(key == KEY_ENTER)
920  {
921  ReturnCode = TRUE;
922  break;
923  }
924  else if(key == KEY_ESC)
925  {
926  ReturnCode = FALSE;
927  break;
928  }
929  else if (key == KEY_BACKSPACE) // Remove a character
930  {
931  if ( (EditBoxTextLength > 0) && (EditBoxTextPosition > 0) &&
932  (EditBoxTextPosition <= EditBoxTextLength) )
933  {
934  EditBoxTextPosition--;
935  memmove(EditTextBuffer + EditBoxTextPosition,
936  EditTextBuffer + EditBoxTextPosition + 1,
937  EditBoxTextLength - EditBoxTextPosition);
938  EditBoxTextLength--;
939  EditTextBuffer[EditBoxTextLength] = 0;
940  }
941  else
942  {
943  MachBeep();
944  }
945  }
946  else if (Extended && key == KEY_DELETE) // Remove a character
947  {
948  if ( (EditBoxTextLength > 0) &&
949  (EditBoxTextPosition < EditBoxTextLength) )
950  {
951  memmove(EditTextBuffer + EditBoxTextPosition,
952  EditTextBuffer + EditBoxTextPosition + 1,
953  EditBoxTextLength - EditBoxTextPosition);
954  EditBoxTextLength--;
955  EditTextBuffer[EditBoxTextLength] = 0;
956  }
957  else
958  {
959  MachBeep();
960  }
961  }
962  else if (Extended && key == KEY_HOME) // Go to the start of the buffer
963  {
964  EditBoxTextPosition = 0;
965  }
966  else if (Extended && key == KEY_END) // Go to the end of the buffer
967  {
968  EditBoxTextPosition = EditBoxTextLength;
969  }
970  else if (Extended && key == KEY_RIGHT) // Go right
971  {
972  if (EditBoxTextPosition < EditBoxTextLength)
973  EditBoxTextPosition++;
974  else
975  MachBeep();
976  }
977  else if (Extended && key == KEY_LEFT) // Go left
978  {
979  if (EditBoxTextPosition > 0)
980  EditBoxTextPosition--;
981  else
982  MachBeep();
983  }
984  else if (!Extended) // Add this key to the buffer
985  {
986  if ( (EditBoxTextLength < Length - 1) &&
987  (EditBoxTextPosition < Length - 1) )
988  {
989  memmove(EditTextBuffer + EditBoxTextPosition + 1,
990  EditTextBuffer + EditBoxTextPosition,
991  EditBoxTextLength - EditBoxTextPosition);
992  EditTextBuffer[EditBoxTextPosition] = key;
993  EditBoxTextPosition++;
994  EditBoxTextLength++;
995  EditTextBuffer[EditBoxTextLength] = 0;
996  }
997  else
998  {
999  MachBeep();
1000  }
1001  }
1002  else
1003  {
1004  MachBeep();
1005  }
1006  }
1007 
1008  // Draw the edit box background
1009  UiFillArea(EditBoxStartX, EditBoxLine, EditBoxEndX, EditBoxLine, ' ', ATTR(UiEditBoxTextColor, UiEditBoxBgColor));
1010 
1011  // Fill the text in
1012  if (EditBoxTextPosition > (EditBoxEndX - EditBoxStartX))
1013  {
1014  EditBoxTextDisplayIndex = EditBoxTextPosition - (EditBoxEndX - EditBoxStartX);
1015  EditBoxCursorX = EditBoxEndX;
1016  }
1017  else
1018  {
1019  EditBoxTextDisplayIndex = 0;
1020  EditBoxCursorX = EditBoxStartX + EditBoxTextPosition;
1021  }
1022  UiDrawText2(EditBoxStartX, EditBoxLine, EditBoxEndX - EditBoxStartX + 1, &EditTextBuffer[EditBoxTextDisplayIndex], ATTR(UiEditBoxTextColor, UiEditBoxBgColor));
1023 
1024  // Move the cursor
1025  MachVideoSetTextCursorPosition(EditBoxCursorX, EditBoxLine);
1026 
1028 
1030 
1031  MachHwIdle();
1032  }
1033 
1034  // Hide the cursor again
1036 
1037  // Restore the screen contents
1040 
1041  return ReturnCode;
1042 }
_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:88
#define MachHwIdle()
Definition: machine.h:131
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
#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:521
VOID TuiDrawBox(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR VertStyle, UCHAR HorzStyle, BOOLEAN Fill, BOOLEAN Shadow, UCHAR Attr)
Definition: tui.c:246
#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:152
unsigned char BOOLEAN
VOID UiDrawText(ULONG X, ULONG Y, PCSTR Text, UCHAR Attr)
Definition: ui.c:261
#define MachConsKbHit()
Definition: machine.h:86
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:189
VOID UiDrawText2(ULONG X, ULONG Y, ULONG MaxNumChars, PCSTR Text, UCHAR Attr)
Definition: ui.c:266
#define KEY_DELETE
Definition: keycodes.h:26
#define KEY_ESC
Definition: keycodes.h:34
#define MachBeep()
Definition: machine.h:114
#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:276
HKEY key
Definition: reg.c:42
#define MachVideoHideShowTextCursor(Show)
Definition: machine.h:100
_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:532
static calc_node_t temp
Definition: rpn_ieee.c:38
#define MachVideoSetTextCursorPosition(X, Y)
Definition: machine.h:98
UCHAR UiMessageBoxBgColor
Definition: ui.c:39
_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:246
unsigned int ULONG
Definition: retypes.h:1
ULONG UiScreenWidth
Definition: ui.c:28
VOID VideoCopyOffScreenBufferToVRAM(VOID)
Definition: video.c:41
VOID TuiUpdateDateTime(VOID)
Definition: tui.c:426
#define KEY_END
Definition: keycodes.h:49
int k
Definition: mpi.c:3369
#define D_VERT
Definition: ui.h:191
#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 }
struct PALETTE_ENTRY * PPALETTE_ENTRY
FORCEINLINE PVOID FrLdrTempAlloc(_In_ SIZE_T Size, _In_ ULONG Tag)
Definition: mm.h:177
smooth NULL
Definition: ftsmooth.c:416
VOID TuiDrawBackdrop(VOID)
Definition: tui.c:81
Definition: video.h:23
VOID VideoSavePaletteState(PPALETTE_ENTRY Palette, ULONG ColorCount)
Definition: palette.c:21
BOOLEAN UiUseSpecialEffects
Definition: ui.c:50
#define TAG_TAG_TUI_PALETTE
Definition: tui.c:23
VOID VideoSetAllColorsToBlack(ULONG ColorCount)
Definition: fade.c:26
#define MachVideoIsPaletteFixed()
Definition: machine.h:106
VOID VideoFadeIn(PPALETTE_ENTRY Palette, ULONG ColorCount)
Definition: fade.c:38
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 VideoFadeOut(ULONG ColorCount)
Definition: fade.c:98
struct PALETTE_ENTRY * PPALETTE_ENTRY
FORCEINLINE PVOID FrLdrTempAlloc(_In_ SIZE_T Size, _In_ ULONG Tag)
Definition: mm.h:177
smooth NULL
Definition: ftsmooth.c:416
Definition: video.h:23
VOID VideoRestorePaletteState(PPALETTE_ENTRY Palette, ULONG ColorCount)
Definition: palette.c:31
VOID VideoSavePaletteState(PPALETTE_ENTRY Palette, ULONG ColorCount)
Definition: palette.c:21
BOOLEAN UiUseSpecialEffects
Definition: ui.c:50
#define TAG_TAG_TUI_PALETTE
Definition: tui.c:23
#define MachVideoSetDisplayMode(Mode, Init)
Definition: machine.h:92
#define MachVideoIsPaletteFixed()
Definition: machine.h:106
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 151 of file tui.c.

152 {
153  PUCHAR ScreenMemory = (PUCHAR)TextVideoBuffer;
154  ULONG i, j;
155 
156  // Clip the area to the screen
157  if ((Left >= UiScreenWidth) || (Top >= UiScreenHeight))
158  {
159  return;
160  }
161  if (Right >= UiScreenWidth)
162  {
163  Right = UiScreenWidth - 1;
164  }
165  if (Bottom >= UiScreenHeight)
166  {
167  Bottom = UiScreenHeight - 1;
168  }
169 
170  // Loop through each line and fill it in
171  for (i=Top; i<=Bottom; i++)
172  {
173  // Loop through each character (column) in the line and fill it in
174  for (j=Left; j<=Right; j++)
175  {
176  ScreenMemory[((i*2)*UiScreenWidth)+(j*2)] = (UCHAR)FillChar;
177  ScreenMemory[((i*2)*UiScreenWidth)+(j*2)+1] = Attr;
178  }
179  }
180 }
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 {
56 
58  if (TextVideoBuffer == NULL)
59  {
60  return FALSE;
61  }
62 
63  return TRUE;
64 }
#define TRUE
Definition: types.h:120
PVOID VideoAllocateOffScreenBuffer(VOID)
Definition: video.c:24
#define COLOR_BLACK
Definition: ui.h:164
#define ATTR(cFore, cBack)
Definition: ui.h:152
smooth NULL
Definition: ftsmooth.c:416
PVOID TextVideoBuffer
Definition: tui.c:25
#define MachVideoClearScreen(Attr)
Definition: machine.h:90
#define MachVideoHideShowTextCursor(Show)
Definition: machine.h:100

◆ TuiMessageBox()

VOID TuiMessageBox ( PCSTR  MessageText)

Definition at line 543 of file tui.c.

544 {
546 
547  // Save the screen contents
551 
552  // Display the message box
553  TuiMessageBoxCritical(MessageText);
554 
555  // Restore the screen contents
558 }
ULONG UiScreenHeight
Definition: ui.c:29
VOID TuiSaveScreen(PUCHAR Buffer)
Definition: tui.c:521
FORCEINLINE PVOID FrLdrTempAlloc(_In_ SIZE_T Size, _In_ ULONG Tag)
Definition: mm.h:177
VOID TuiMessageBoxCritical(PCSTR MessageText)
Definition: tui.c:560
VOID TuiRestoreScreen(PUCHAR Buffer)
Definition: tui.c:532
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 560 of file tui.c.

561 {
562  int width = 8;
563  unsigned int height = 1;
564  int curline = 0;
565  int k;
566  size_t i , j;
567  int x1, x2, y1, y2;
568  char temp[260];
569  char key;
570 
571  // Find the height
572  for (i=0; i<strlen(MessageText); i++)
573  {
574  if (MessageText[i] == '\n')
575  height++;
576  }
577 
578  // Find the width
579  for (i=0,j=0,k=0; i<height; i++)
580  {
581  while ((MessageText[j] != '\n') && (MessageText[j] != 0))
582  {
583  j++;
584  k++;
585  }
586 
587  if (k > width)
588  width = k;
589 
590  k = 0;
591  j++;
592  }
593 
594  // Calculate box area
595  x1 = (UiScreenWidth - (width+2))/2;
596  x2 = x1 + width + 3;
597  y1 = ((UiScreenHeight - height - 2)/2) + 1;
598  y2 = y1 + height + 4;
599 
600  // Draw the box
602 
603  // Draw the text
604  for (i=0,j=0; i<strlen(MessageText)+1; i++)
605  {
606  if ((MessageText[i] == '\n') || (MessageText[i] == 0))
607  {
608  temp[j] = 0;
609  j = 0;
611  curline++;
612  }
613  else
614  temp[j++] = MessageText[i];
615  }
616 
617  // Draw OK button
618  strcpy(temp, " OK ");
619  UiDrawText(x1+((x2-x1)/2)-3, y2-2, temp, ATTR(COLOR_BLACK, COLOR_GRAY));
620 
621  // Draw status text
622  UiDrawStatusText("Press ENTER to continue");
623 
625 
626  for (;;)
627  {
628  if (MachConsKbHit())
629  {
630  key = MachConsGetCh();
631  if(key == KEY_EXTENDED)
632  key = MachConsGetCh();
633 
634  if(key == KEY_ENTER)
635  break;
636  else if(key == KEY_SPACE)
637  break;
638  else if(key == KEY_ESC)
639  break;
640  }
641 
643 
645 
646  MachHwIdle();
647  }
648 
649 }
_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:88
#define COLOR_BLACK
Definition: ui.h:164
#define MachHwIdle()
Definition: machine.h:131
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
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:246
#define ATTR(cFore, cBack)
Definition: ui.h:152
VOID UiDrawText(ULONG X, ULONG Y, PCSTR Text, UCHAR Attr)
Definition: ui.c:261
#define MachConsKbHit()
Definition: machine.h:86
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:189
#define KEY_ESC
Definition: keycodes.h:34
VOID UiDrawStatusText(PCSTR StatusText)
Definition: ui.c:276
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 VideoCopyOffScreenBufferToVRAM(VOID)
Definition: video.c:41
VOID TuiUpdateDateTime(VOID)
Definition: tui.c:426
int k
Definition: mpi.c:3369
#define D_VERT
Definition: ui.h:191
#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:84
_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 NTAPI TuiProcessMenuKeyboardEvent ( PUI_MENU_INFO  MenuInfo,
UiMenuKeyPressFilterCallback  KeyPressFilter 
)

Definition at line 481 of file tuimenu.c.

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

Referenced by TuiDisplayMenu().

◆ TuiRestoreScreen()

VOID TuiRestoreScreen ( PUCHAR  Buffer)

Definition at line 532 of file tui.c.

533 {
534  PUCHAR ScreenMemory = (PUCHAR)TextVideoBuffer;
535  ULONG i;
536 
537  for (i=0; i < (UiScreenWidth * UiScreenHeight * 2); i++)
538  {
539  ScreenMemory[i] = Buffer[i];
540  }
541 }
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 521 of file tui.c.

522 {
523  PUCHAR ScreenMemory = (PUCHAR)TextVideoBuffer;
524  ULONG i;
525 
526  for (i=0; i < (UiScreenWidth * UiScreenHeight * 2); i++)
527  {
528  Buffer[i] = ScreenMemory[i];
529  }
530 }
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 703 of file tui.c.

704 {
705  if (_stricmp(ColorText, "Black") == 0)
706  return COLOR_BLACK;
707  else if (_stricmp(ColorText, "Blue") == 0)
708  return COLOR_BLUE;
709  else if (_stricmp(ColorText, "Green") == 0)
710  return COLOR_GREEN;
711  else if (_stricmp(ColorText, "Cyan") == 0)
712  return COLOR_CYAN;
713  else if (_stricmp(ColorText, "Red") == 0)
714  return COLOR_RED;
715  else if (_stricmp(ColorText, "Magenta") == 0)
716  return COLOR_MAGENTA;
717  else if (_stricmp(ColorText, "Brown") == 0)
718  return COLOR_BROWN;
719  else if (_stricmp(ColorText, "Gray") == 0)
720  return COLOR_GRAY;
721  else if (_stricmp(ColorText, "DarkGray") == 0)
722  return COLOR_DARKGRAY;
723  else if (_stricmp(ColorText, "LightBlue") == 0)
724  return COLOR_LIGHTBLUE;
725  else if (_stricmp(ColorText, "LightGreen") == 0)
726  return COLOR_LIGHTGREEN;
727  else if (_stricmp(ColorText, "LightCyan") == 0)
728  return COLOR_LIGHTCYAN;
729  else if (_stricmp(ColorText, "LightRed") == 0)
730  return COLOR_LIGHTRED;
731  else if (_stricmp(ColorText, "LightMagenta") == 0)
732  return COLOR_LIGHTMAGENTA;
733  else if (_stricmp(ColorText, "Yellow") == 0)
734  return COLOR_YELLOW;
735  else if (_stricmp(ColorText, "White") == 0)
736  return COLOR_WHITE;
737 
738  return COLOR_BLACK;
739 }
#define COLOR_YELLOW
Definition: ui.h:179
#define COLOR_BLACK
Definition: ui.h:164
#define COLOR_LIGHTBLUE
Definition: ui.h:174
#define COLOR_LIGHTMAGENTA
Definition: ui.h:178
#define _stricmp
Definition: cat.c:22
#define COLOR_DARKGRAY
Definition: ui.h:173
#define COLOR_RED
Definition: ui.h:168
#define COLOR_BROWN
Definition: ui.h:170
#define COLOR_CYAN
Definition: ui.h:167
#define COLOR_BLUE
Definition: ui.h:165
#define COLOR_LIGHTCYAN
Definition: ui.h:176
#define COLOR_GREEN
Definition: ui.h:166
#define COLOR_LIGHTRED
Definition: ui.h:177
#define COLOR_WHITE
Definition: ui.h:180
#define COLOR_MAGENTA
Definition: ui.h:169
#define COLOR_LIGHTGREEN
Definition: ui.h:175

◆ TuiTextToFillStyle()

UCHAR TuiTextToFillStyle ( PCSTR  FillStyleText)

Definition at line 741 of file tui.c.

742 {
743  if (_stricmp(FillStyleText, "Light") == 0)
744  {
745  return LIGHT_FILL;
746  }
747  else if (_stricmp(FillStyleText, "Medium") == 0)
748  {
749  return MEDIUM_FILL;
750  }
751  else if (_stricmp(FillStyleText, "Dark") == 0)
752  {
753  return DARK_FILL;
754  }
755 
756  return LIGHT_FILL;
757 }
#define DARK_FILL
Definition: ui.h:159
#define _stricmp
Definition: cat.c:22
#define LIGHT_FILL
Definition: ui.h:157
#define MEDIUM_FILL
Definition: ui.h:158

◆ TuiUnInitialize()

VOID TuiUnInitialize ( VOID  )

Definition at line 66 of file tui.c.

67 {
69  {
70  TuiFadeOut();
71  }
72  else
73  {
75  }
76 
79 }
#define TRUE
Definition: types.h:120
#define COLOR_BLACK
Definition: ui.h:164
VOID TuiFadeOut(VOID)
Definition: tui.c:785
#define ATTR(cFore, cBack)
Definition: ui.h:152
smooth NULL
Definition: ftsmooth.c:416
#define MachVideoClearScreen(Attr)
Definition: machine.h:90
#define MachVideoHideShowTextCursor(Show)
Definition: machine.h:100
BOOLEAN UiUseSpecialEffects
Definition: ui.c:50
#define MachVideoSetDisplayMode(Mode, Init)
Definition: machine.h:92

◆ TuiUpdateDateTime()

VOID TuiUpdateDateTime ( VOID  )

Definition at line 426 of file tui.c.

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

Referenced by UiInitialize().