3 * Copyright (C) 1998-2003 Brian Palmer <brianp@sginet.com>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 PVOID TextVideoBuffer
= NULL
;
26 * Prints formatted text to the screen
28 int TuiPrintf(const char *Format
, ...)
36 Length
= _vsnprintf(Buffer
, sizeof(Buffer
), Format
, ap
);
39 if (Length
== -1) Length
= sizeof(Buffer
);
41 for (i
= 0; i
< Length
; i
++)
43 MachConsPutChar(Buffer
[i
]);
49 BOOLEAN
TuiInitialize(VOID
)
51 MachVideoClearScreen(ATTR(COLOR_WHITE
, COLOR_BLACK
));
52 MachVideoHideShowTextCursor(FALSE
);
54 TextVideoBuffer
= VideoAllocateOffScreenBuffer();
55 if (TextVideoBuffer
== NULL
)
63 VOID
TuiUnInitialize(VOID
)
65 if (UiUseSpecialEffects
)
71 MachVideoSetDisplayMode(NULL
, FALSE
);
75 MachVideoHideShowTextCursor(TRUE
);
78 VOID
TuiDrawBackdrop(VOID
)
81 // Fill in the background (excluding title box & status bar)
84 TUI_TITLE_BOX_CHAR_HEIGHT
,
88 ATTR(UiBackdropFgColor
, UiBackdropBgColor
));
96 TUI_TITLE_BOX_CHAR_HEIGHT
- 1,
101 ATTR(UiTitleBoxFgColor
, UiTitleBoxBgColor
));
108 GetFreeLoaderVersionString(),
109 ATTR(UiTitleBoxFgColor
, UiTitleBoxBgColor
));
117 ATTR(UiTitleBoxFgColor
, UiTitleBoxBgColor
));
121 ATTR(UiTitleBoxFgColor
, UiTitleBoxBgColor
));
126 TuiDrawText(UiScreenWidth
- 16, 3, /*"F1 for Help"*/"F8 for Options", ATTR(UiTitleBoxFgColor
, UiTitleBoxBgColor
));
131 TuiDrawText( (UiScreenWidth
/ 2) - ((ULONG
)strlen(UiTitleBoxTitleText
) / 2),
134 ATTR(UiTitleBoxFgColor
, UiTitleBoxBgColor
));
139 TuiDrawStatusText("Welcome to FreeLoader!");
142 // Update the date & time
146 VideoCopyOffScreenBufferToVRAM();
151 * This function assumes coordinates are zero-based
153 VOID
TuiFillArea(ULONG Left
, ULONG Top
, ULONG Right
, ULONG Bottom
, CHAR FillChar
, UCHAR Attr
/* Color Attributes */)
155 PUCHAR ScreenMemory
= (PUCHAR
)TextVideoBuffer
;
158 // Clip the area to the screen
159 if ((Left
>= UiScreenWidth
) || (Top
>= UiScreenHeight
))
163 if (Right
>= UiScreenWidth
)
165 Right
= UiScreenWidth
- 1;
167 if (Bottom
>= UiScreenHeight
)
169 Bottom
= UiScreenHeight
- 1;
172 // Loop through each line and fill it in
173 for (i
=Top
; i
<=Bottom
; i
++)
175 // Loop through each character (column) in the line and fill it in
176 for (j
=Left
; j
<=Right
; j
++)
178 ScreenMemory
[((i
*2)*UiScreenWidth
)+(j
*2)] = (UCHAR
)FillChar
;
179 ScreenMemory
[((i
*2)*UiScreenWidth
)+(j
*2)+1] = Attr
;
186 * This function assumes coordinates are zero-based
188 VOID
TuiDrawShadow(ULONG Left
, ULONG Top
, ULONG Right
, ULONG Bottom
)
190 PUCHAR ScreenMemory
= (PUCHAR
)TextVideoBuffer
;
193 // Shade the bottom of the area
194 if (Bottom
< (UiScreenHeight
- 1))
196 if (UiScreenHeight
< 34)
205 for (; Idx
<=Right
; Idx
++)
207 ScreenMemory
[(((Bottom
+1)*2)*UiScreenWidth
)+(Idx
*2)+1] = ATTR(COLOR_GRAY
, COLOR_BLACK
);
211 // Shade the right of the area
212 if (Right
< (UiScreenWidth
- 1))
214 for (Idx
=Top
+1; Idx
<=Bottom
; Idx
++)
216 ScreenMemory
[((Idx
*2)*UiScreenWidth
)+((Right
+1)*2)+1] = ATTR(COLOR_GRAY
, COLOR_BLACK
);
219 if (UiScreenHeight
< 34)
221 if ((Right
+ 1) < (UiScreenWidth
- 1))
223 for (Idx
=Top
+1; Idx
<=Bottom
; Idx
++)
225 ScreenMemory
[((Idx
*2)*UiScreenWidth
)+((Right
+2)*2)+1] = ATTR(COLOR_GRAY
, COLOR_BLACK
);
230 // Shade the bottom right corner
231 if ((Right
< (UiScreenWidth
- 1)) && (Bottom
< (UiScreenHeight
- 1)))
233 ScreenMemory
[(((Bottom
+1)*2)*UiScreenWidth
)+((Right
+1)*2)+1] = ATTR(COLOR_GRAY
, COLOR_BLACK
);
235 if (UiScreenHeight
< 34)
237 if (((Right
+ 1) < (UiScreenWidth
- 1)) && (Bottom
< (UiScreenHeight
- 1)))
239 ScreenMemory
[(((Bottom
+1)*2)*UiScreenWidth
)+((Right
+2)*2)+1] = ATTR(COLOR_GRAY
, COLOR_BLACK
);
246 * This function assumes coordinates are zero-based
248 VOID
TuiDrawBox(ULONG Left
, ULONG Top
, ULONG Right
, ULONG Bottom
, UCHAR VertStyle
, UCHAR HorzStyle
, BOOLEAN Fill
, BOOLEAN Shadow
, UCHAR Attr
)
250 UCHAR ULCorner
, URCorner
, LLCorner
, LRCorner
;
252 // Calculate the corner values
253 if (HorzStyle
== HORZ
)
255 if (VertStyle
== VERT
)
262 else // VertStyle == D_VERT
270 else // HorzStyle == D_HORZ
272 if (VertStyle
== VERT
)
279 else // VertStyle == D_VERT
288 // Fill in box background
291 TuiFillArea(Left
, Top
, Right
, Bottom
, ' ', Attr
);
295 TuiFillArea(Left
, Top
, Left
, Top
, ULCorner
, Attr
);
296 TuiFillArea(Right
, Top
, Right
, Top
, URCorner
, Attr
);
297 TuiFillArea(Left
, Bottom
, Left
, Bottom
, LLCorner
, Attr
);
298 TuiFillArea(Right
, Bottom
, Right
, Bottom
, LRCorner
, Attr
);
301 TuiFillArea(Left
, Top
+1, Left
, Bottom
-1, VertStyle
, Attr
);
303 TuiFillArea(Left
+1, Top
, Right
-1, Top
, HorzStyle
, Attr
);
304 // Fill in right line
305 TuiFillArea(Right
, Top
+1, Right
, Bottom
-1, VertStyle
, Attr
);
306 // Fill in bottom line
307 TuiFillArea(Left
+1, Bottom
, Right
-1, Bottom
, HorzStyle
, Attr
);
312 TuiDrawShadow(Left
, Top
, Right
, Bottom
);
318 * This function assumes coordinates are zero-based
320 VOID
TuiDrawText(ULONG X
, ULONG Y
, PCSTR Text
, UCHAR Attr
)
322 PUCHAR ScreenMemory
= (PUCHAR
)TextVideoBuffer
;
326 for (i
=X
, j
=0; Text
[j
] && i
<UiScreenWidth
; i
++,j
++)
328 ScreenMemory
[((Y
*2)*UiScreenWidth
)+(i
*2)] = (UCHAR
)Text
[j
];
329 ScreenMemory
[((Y
*2)*UiScreenWidth
)+(i
*2)+1] = Attr
;
333 VOID
TuiDrawCenteredText(ULONG Left
, ULONG Top
, ULONG Right
, ULONG Bottom
, PCSTR TextString
, UCHAR Attr
)
338 ULONG LineBreakCount
;
347 TextLength
= strlen(TextString
);
349 // Count the new lines and the box width
353 for (Index
=0; Index
<TextLength
; Index
++)
355 if (TextString
[Index
] == '\n')
362 if ((Index
- LastIndex
) > BoxWidth
)
364 BoxWidth
= (ULONG
)(Index
- LastIndex
);
369 BoxHeight
= LineBreakCount
+ 1;
371 RealLeft
= (((Right
- Left
) - BoxWidth
) / 2) + Left
;
372 RealTop
= (((Bottom
- Top
) - BoxHeight
) / 2) + Top
;
375 for (Index
=0; Index
<TextLength
; Index
++)
377 if (TextString
[Index
] == '\n')
384 X
= (ULONG
)(RealLeft
+ LastIndex
);
387 Temp
[0] = TextString
[Index
];
389 TuiDrawText(X
, Y
, Temp
, Attr
);
394 VOID
TuiDrawStatusText(PCSTR StatusText
)
398 TuiDrawText(0, UiScreenHeight
-1, " ", ATTR(UiStatusBarFgColor
, UiStatusBarBgColor
));
399 TuiDrawText(1, UiScreenHeight
-1, StatusText
, ATTR(UiStatusBarFgColor
, UiStatusBarBgColor
));
401 for (i
=strlen(StatusText
)+1; i
<UiScreenWidth
; i
++)
403 TuiDrawText((ULONG
)i
, UiScreenHeight
-1, " ", ATTR(UiStatusBarFgColor
, UiStatusBarBgColor
));
406 VideoCopyOffScreenBufferToVRAM();
409 VOID
TuiUpdateDateTime(VOID
)
415 BOOLEAN PMHour
= FALSE
;
417 /* Don't draw the time if this has been disabled */
418 if (!UiDrawTime
) return;
420 TimeInfo
= ArcGetTime();
421 if (TimeInfo
->Year
< 1 || 9999 < TimeInfo
->Year
||
422 TimeInfo
->Month
< 1 || 12 < TimeInfo
->Month
||
423 TimeInfo
->Day
< 1 || 31 < TimeInfo
->Day
||
424 23 < TimeInfo
->Hour
||
425 59 < TimeInfo
->Minute
||
426 59 < TimeInfo
->Second
)
428 /* This happens on QEmu sometimes. We just skip updating */
431 // Get the month name
432 strcpy(DateString
, UiMonthNames
[TimeInfo
->Month
- 1]);
434 _itoa(TimeInfo
->Day
, TempString
, 10);
435 // Get the day postfix
436 if (1 == TimeInfo
->Day
|| 21 == TimeInfo
->Day
|| 31 == TimeInfo
->Day
)
438 strcat(TempString
, "st");
440 else if (2 == TimeInfo
->Day
|| 22 == TimeInfo
->Day
)
442 strcat(TempString
, "nd");
444 else if (3 == TimeInfo
->Day
|| 23 == TimeInfo
->Day
)
446 strcat(TempString
, "rd");
450 strcat(TempString
, "th");
453 // Add the day to the date
454 strcat(DateString
, TempString
);
455 strcat(DateString
, " ");
457 // Get the year and add it to the date
458 _itoa(TimeInfo
->Year
, TempString
, 10);
459 strcat(DateString
, TempString
);
462 TuiDrawText(UiScreenWidth
-(ULONG
)strlen(DateString
)-2, 1, DateString
, ATTR(UiTitleBoxFgColor
, UiTitleBoxBgColor
));
464 // Get the hour and change from 24-hour mode to 12-hour
465 if (TimeInfo
->Hour
> 12)
467 TimeInfo
->Hour
-= 12;
470 if (TimeInfo
->Hour
== 0)
474 _itoa(TimeInfo
->Hour
, TempString
, 10);
475 strcpy(TimeString
, " ");
476 strcat(TimeString
, TempString
);
477 strcat(TimeString
, ":");
478 _itoa(TimeInfo
->Minute
, TempString
, 10);
479 if (TimeInfo
->Minute
< 10)
481 strcat(TimeString
, "0");
483 strcat(TimeString
, TempString
);
484 strcat(TimeString
, ":");
485 _itoa(TimeInfo
->Second
, TempString
, 10);
486 if (TimeInfo
->Second
< 10)
488 strcat(TimeString
, "0");
490 strcat(TimeString
, TempString
);
493 strcat(TimeString
, " PM");
497 strcat(TimeString
, " AM");
501 TuiDrawText(UiScreenWidth
-(ULONG
)strlen(TimeString
)-2, 2, TimeString
, ATTR(UiTitleBoxFgColor
, UiTitleBoxBgColor
));
504 VOID
TuiSaveScreen(PUCHAR Buffer
)
506 PUCHAR ScreenMemory
= (PUCHAR
)TextVideoBuffer
;
509 for (i
=0; i
< (UiScreenWidth
* UiScreenHeight
* 2); i
++)
511 Buffer
[i
] = ScreenMemory
[i
];
515 VOID
TuiRestoreScreen(PUCHAR Buffer
)
517 PUCHAR ScreenMemory
= (PUCHAR
)TextVideoBuffer
;
520 for (i
=0; i
< (UiScreenWidth
* UiScreenHeight
* 2); i
++)
522 ScreenMemory
[i
] = Buffer
[i
];
526 VOID
TuiMessageBox(PCSTR MessageText
)
530 // Save the screen contents
531 ScreenBuffer
= MmHeapAlloc(UiScreenWidth
* UiScreenHeight
* 2);
532 TuiSaveScreen(ScreenBuffer
);
534 // Display the message box
535 TuiMessageBoxCritical(MessageText
);
537 // Restore the screen contents
538 TuiRestoreScreen(ScreenBuffer
);
539 MmHeapFree(ScreenBuffer
);
542 VOID
TuiMessageBoxCritical(PCSTR MessageText
)
545 unsigned int height
= 1;
554 for (i
=0; i
<strlen(MessageText
); i
++)
556 if (MessageText
[i
] == '\n')
561 for (i
=0,j
=0,k
=0; i
<height
; i
++)
563 while ((MessageText
[j
] != '\n') && (MessageText
[j
] != 0))
576 // Calculate box area
577 x1
= (UiScreenWidth
- (width
+2))/2;
579 y1
= ((UiScreenHeight
- height
- 2)/2) + 1;
580 y2
= y1
+ height
+ 4;
583 TuiDrawBox(x1
, y1
, x2
, y2
, D_VERT
, D_HORZ
, TRUE
, TRUE
, ATTR(UiMessageBoxFgColor
, UiMessageBoxBgColor
));
586 for (i
=0,j
=0; i
<strlen(MessageText
)+1; i
++)
588 if ((MessageText
[i
] == '\n') || (MessageText
[i
] == 0))
592 UiDrawText(x1
+2, y1
+1+curline
, temp
, ATTR(UiMessageBoxFgColor
, UiMessageBoxBgColor
));
596 temp
[j
++] = MessageText
[i
];
600 strcpy(temp
, " OK ");
601 UiDrawText(x1
+((x2
-x1
)/2)-3, y2
-2, temp
, ATTR(COLOR_BLACK
, COLOR_GRAY
));
604 UiDrawStatusText("Press ENTER to continue");
606 VideoCopyOffScreenBufferToVRAM();
612 key
= MachConsGetCh();
613 if(key
== KEY_EXTENDED
)
614 key
= MachConsGetCh();
618 else if(key
== KEY_SPACE
)
620 else if(key
== KEY_ESC
)
626 VideoCopyOffScreenBufferToVRAM();
632 VOID
TuiDrawProgressBarCenter(ULONG Position
, ULONG Range
, PCHAR ProgressText
)
634 ULONG Left
, Top
, Right
, Bottom
;
635 ULONG Width
= 50; // Allow for 50 "bars"
638 Left
= (UiScreenWidth
- Width
- 4) / 2;
639 Right
= Left
+ Width
+ 3;
640 Top
= (UiScreenHeight
- Height
- 2) / 2;
642 Bottom
= Top
+ Height
+ 1;
644 TuiDrawProgressBar(Left
, Top
, Right
, Bottom
, Position
, Range
, ProgressText
);
647 VOID
TuiDrawProgressBar(ULONG Left
, ULONG Top
, ULONG Right
, ULONG Bottom
, ULONG Position
, ULONG Range
, PCHAR ProgressText
)
650 ULONG ProgressBarWidth
= (Right
- Left
) - 3;
652 // First make sure the progress bar text fits
653 UiTruncateStringEllipsis(ProgressText
, ProgressBarWidth
- 4);
655 if (Position
> Range
)
661 TuiDrawBox(Left
, Top
, Right
, Bottom
, VERT
, HORZ
, TRUE
, TRUE
, ATTR(UiMenuFgColor
, UiMenuBgColor
));
664 // Draw the "Loading..." text
666 TuiDrawCenteredText(Left
+ 2, Top
+ 2, Right
- 2, Top
+ 2, ProgressText
, ATTR(UiTextColor
, UiMenuBgColor
));
668 // Draw the percent complete
669 for (i
=0; i
<(Position
*ProgressBarWidth
)/Range
; i
++)
671 TuiDrawText(Left
+2+i
, Top
+2, "\xDB", ATTR(UiTextColor
, UiMenuBgColor
));
675 for (; i
<ProgressBarWidth
; i
++)
677 TuiDrawText(Left
+2+i
, Top
+2, "\xB2", ATTR(UiTextColor
, UiMenuBgColor
));
681 VideoCopyOffScreenBufferToVRAM();
684 UCHAR
TuiTextToColor(PCSTR ColorText
)
686 if (_stricmp(ColorText
, "Black") == 0)
688 else if (_stricmp(ColorText
, "Blue") == 0)
690 else if (_stricmp(ColorText
, "Green") == 0)
692 else if (_stricmp(ColorText
, "Cyan") == 0)
694 else if (_stricmp(ColorText
, "Red") == 0)
696 else if (_stricmp(ColorText
, "Magenta") == 0)
697 return COLOR_MAGENTA
;
698 else if (_stricmp(ColorText
, "Brown") == 0)
700 else if (_stricmp(ColorText
, "Gray") == 0)
702 else if (_stricmp(ColorText
, "DarkGray") == 0)
703 return COLOR_DARKGRAY
;
704 else if (_stricmp(ColorText
, "LightBlue") == 0)
705 return COLOR_LIGHTBLUE
;
706 else if (_stricmp(ColorText
, "LightGreen") == 0)
707 return COLOR_LIGHTGREEN
;
708 else if (_stricmp(ColorText
, "LightCyan") == 0)
709 return COLOR_LIGHTCYAN
;
710 else if (_stricmp(ColorText
, "LightRed") == 0)
711 return COLOR_LIGHTRED
;
712 else if (_stricmp(ColorText
, "LightMagenta") == 0)
713 return COLOR_LIGHTMAGENTA
;
714 else if (_stricmp(ColorText
, "Yellow") == 0)
716 else if (_stricmp(ColorText
, "White") == 0)
722 UCHAR
TuiTextToFillStyle(PCSTR FillStyleText
)
724 if (_stricmp(FillStyleText
, "Light") == 0)
728 else if (_stricmp(FillStyleText
, "Medium") == 0)
732 else if (_stricmp(FillStyleText
, "Dark") == 0)
740 VOID
TuiFadeInBackdrop(VOID
)
742 PPALETTE_ENTRY TuiFadePalette
= NULL
;
744 if (UiUseSpecialEffects
&& ! MachVideoIsPaletteFixed())
746 TuiFadePalette
= (PPALETTE_ENTRY
)MmHeapAlloc(sizeof(PALETTE_ENTRY
) * 64);
748 if (TuiFadePalette
!= NULL
)
750 VideoSavePaletteState(TuiFadePalette
, 64);
751 VideoSetAllColorsToBlack(64);
755 // Draw the backdrop and title box
758 if (UiUseSpecialEffects
&& ! MachVideoIsPaletteFixed() && TuiFadePalette
!= NULL
)
760 VideoFadeIn(TuiFadePalette
, 64);
761 MmHeapFree(TuiFadePalette
);
765 VOID
TuiFadeOut(VOID
)
767 PPALETTE_ENTRY TuiFadePalette
= NULL
;
769 if (UiUseSpecialEffects
&& ! MachVideoIsPaletteFixed())
771 TuiFadePalette
= (PPALETTE_ENTRY
)MmHeapAlloc(sizeof(PALETTE_ENTRY
) * 64);
773 if (TuiFadePalette
!= NULL
)
775 VideoSavePaletteState(TuiFadePalette
, 64);
779 if (UiUseSpecialEffects
&& ! MachVideoIsPaletteFixed() && TuiFadePalette
!= NULL
)
784 MachVideoSetDisplayMode(NULL
, FALSE
);
786 if (UiUseSpecialEffects
&& ! MachVideoIsPaletteFixed() && TuiFadePalette
!= NULL
)
788 VideoRestorePaletteState(TuiFadePalette
, 64);
789 MmHeapFree(TuiFadePalette
);
794 BOOLEAN
TuiEditBox(PCSTR MessageText
, PCHAR EditTextBuffer
, ULONG Length
)
797 unsigned int height
= 1;
805 ULONG EditBoxStartX
, EditBoxEndX
;
807 unsigned int EditBoxTextCount
;
808 int EditBoxTextDisplayIndex
;
812 // Save the screen contents
813 ScreenBuffer
= MmHeapAlloc(UiScreenWidth
* UiScreenHeight
* 2);
814 TuiSaveScreen(ScreenBuffer
);
817 for (i
=0; i
<strlen(MessageText
); i
++)
819 if (MessageText
[i
] == '\n')
824 for (i
=0,j
=0,k
=0; i
<height
; i
++)
826 while ((MessageText
[j
] != '\n') && (MessageText
[j
] != 0))
839 // Calculate box area
840 x1
= (UiScreenWidth
- (width
+2))/2;
842 y1
= ((UiScreenHeight
- height
- 2)/2) + 1;
843 y2
= y1
+ height
+ 4;
846 TuiDrawBox(x1
, y1
, x2
, y2
, D_VERT
, D_HORZ
, TRUE
, TRUE
, ATTR(UiMessageBoxFgColor
, UiMessageBoxBgColor
));
849 for (i
=0,j
=0; i
<strlen(MessageText
)+1; i
++)
851 if ((MessageText
[i
] == '\n') || (MessageText
[i
] == 0))
855 UiDrawText(x1
+2, y1
+1+curline
, temp
, ATTR(UiMessageBoxFgColor
, UiMessageBoxBgColor
));
859 temp
[j
++] = MessageText
[i
];
862 EditBoxTextCount
= 0;
863 EditBoxLine
= y2
- 2;
864 EditBoxStartX
= x1
+ 3;
865 EditBoxEndX
= x2
- 3;
866 UiFillArea(EditBoxStartX
, EditBoxLine
, EditBoxEndX
, EditBoxLine
, ' ', ATTR(UiEditBoxTextColor
, UiEditBoxBgColor
));
869 EditBoxCursorX
= EditBoxStartX
;
870 MachVideoSetTextCursorPosition(EditBoxCursorX
, EditBoxLine
);
871 MachVideoHideShowTextCursor(TRUE
);
874 UiDrawStatusText("Press ENTER to continue, or ESC to cancel");
876 VideoCopyOffScreenBufferToVRAM();
882 key
= MachConsGetCh();
883 if(key
== KEY_EXTENDED
)
885 key
= MachConsGetCh();
893 else if(key
== KEY_ESC
)
898 else if (key
== KEY_BACKSPACE
) // Remove a character
900 if (EditBoxTextCount
)
903 EditTextBuffer
[EditBoxTextCount
] = 0;
910 else // Add this key to the buffer
912 if (EditBoxTextCount
< Length
- 1)
914 EditTextBuffer
[EditBoxTextCount
] = key
;
916 EditTextBuffer
[EditBoxTextCount
] = 0;
925 // Draw the edit box background
926 UiFillArea(EditBoxStartX
, EditBoxLine
, EditBoxEndX
, EditBoxLine
, ' ', ATTR(UiEditBoxTextColor
, UiEditBoxBgColor
));
929 if (EditBoxTextCount
> (EditBoxEndX
- EditBoxStartX
))
931 EditBoxTextDisplayIndex
= EditBoxTextCount
- (EditBoxEndX
- EditBoxStartX
);
932 EditBoxCursorX
= EditBoxEndX
;
936 EditBoxTextDisplayIndex
= 0;
937 EditBoxCursorX
= EditBoxStartX
+ EditBoxTextCount
;
939 UiDrawText(EditBoxStartX
, EditBoxLine
, &EditTextBuffer
[EditBoxTextDisplayIndex
], ATTR(UiEditBoxTextColor
, UiEditBoxBgColor
));
942 MachVideoSetTextCursorPosition(EditBoxCursorX
, EditBoxLine
);
946 VideoCopyOffScreenBufferToVRAM();
949 // Hide the cursor again
950 MachVideoHideShowTextCursor(FALSE
);
952 // Restore the screen contents
953 TuiRestoreScreen(ScreenBuffer
);
954 MmHeapFree(ScreenBuffer
);
959 const UIVTBL TuiVtbl
=
972 TuiMessageBoxCritical
,
973 TuiDrawProgressBarCenter
,