1
1
Fork 0
mirror of https://github.com/FellippeHeitor/InForm.git synced 2025-01-15 11:59:34 +00:00

Adds progress indication to UiEditor's loading screen

This commit is contained in:
FellippeHeitor 2018-05-25 19:04:42 -03:00
parent 0b62d8391e
commit 7739a7de44
2 changed files with 53 additions and 17 deletions

View file

@ -471,20 +471,21 @@ END SUB
'---------------------------------------------------------------------------------
SUB __UI_Init
DIM i AS LONG
DIM i AS LONG, b$
SetFrameRate 30
__UI_BeforeInit
_SCREENSHOW
IF __UI_FormID = 0 THEN SYSTEM
SCREEN _NEWIMAGE(Control(__UI_FormID).Width, Control(__UI_FormID).Height, 32)
COLOR Control(__UI_FormID).ForeColor, Control(__UI_FormID).BackColor
CLS
IF Control(__UI_FormID).Font > 0 THEN _FONT Control(__UI_FormID).Font
__UI_PrintString _WIDTH / 2 - _PRINTWIDTH("Initializing...") / 2, _HEIGHT / 2 - _FONTHEIGHT / 2, "Initializing..."
_SCREENSHOW
b$ = "Initializing..."
GOSUB ShowMessage
_ICON
_TITLE "InForm"
@ -534,6 +535,13 @@ SUB __UI_Init
__UI_AutoRefresh = True
__UI_Loaded = True
EXIT SUB
ShowMessage:
CLS
__UI_PrintString _WIDTH / 2 - _PRINTWIDTH(b$) / 2, _HEIGHT / 2 - _FONTHEIGHT / 2, b$
_DISPLAY
RETURN
END SUB
'---------------------------------------------------------------------------------

View file

@ -1862,6 +1862,15 @@ SUB __UI_OnLoad
Control(StatusBar).BackColor = StatusBarBackColor
'LoadFontList
b$ = "Loading images..."
GOSUB ShowMessage
'Load splash image:
DIM tempIcon AS LONG
tempIcon = _LOADIMAGE("./InForm/resources/Application-icon.png", 32)
GOSUB ShowMessage
'Load toolbox images:
DIM CommControls AS LONG
CommControls = LoadEditorImage("commoncontrols.bmp")
@ -1931,6 +1940,9 @@ SUB __UI_OnLoad
DIM FileToOpen$, FreeFileNum AS INTEGER
b$ = "Reading settings..."
GOSUB ShowMessage
IF _DIREXISTS("InForm") = 0 THEN MKDIR "InForm"
IF _FILEEXISTS("InForm/InForm.ini") THEN
@ -1982,6 +1994,9 @@ SUB __UI_OnLoad
IF _FILEEXISTS("InForm/UiEditorUndo.dat") THEN KILL "InForm/UiEditorUndo.dat"
IF _FILEEXISTS("InForm/UiEditor.dat") THEN KILL "InForm/UiEditor.dat"
b$ = "Parsing command line..."
GOSUB ShowMessage
IF _FILEEXISTS(COMMAND$) THEN
SELECT CASE LCASE$(RIGHT$(COMMAND$, 4))
CASE ".bas"
@ -2038,6 +2053,9 @@ SUB __UI_OnLoad
END IF
END IF
b$ = "Checking Preview component..."
GOSUB ShowMessage
$IF WIN THEN
IF _FILEEXISTS("InForm/UiEditorPreview.exe") = 0 THEN
IF _FILEEXISTS("InForm/UiEditorPreview.bas") = 0 THEN
@ -2049,15 +2067,8 @@ SUB __UI_OnLoad
IF _FILEEXISTS("InForm/UiEditorPreview.exe") = 0 THEN GOTO UiEditorPreviewNotFound
END IF
END IF
b$ = "Launching..."
DIM tempIcon AS LONG
tempIcon = _LOADIMAGE("./InForm/resources/Application-icon.png", 32)
IF tempIcon < -1 THEN
_PUTIMAGE (_WIDTH / 2 - _WIDTH(tempIcon) / 2, _HEIGHT / 2 - _HEIGHT(tempIcon) / 2), tempIcon
_DISPLAY
ELSE
b$ = "Launching Preview component..."
GOSUB ShowMessage
END IF
SHELL _DONTWAIT ".\InForm\UiEditorPreview.exe"
$ELSE
IF _FILEEXISTS("InForm/UiEditorPreview") = 0 THEN
@ -2070,7 +2081,7 @@ SUB __UI_OnLoad
IF _FILEEXISTS("InForm/UiEditorPreview") = 0 THEN GOTO UiEditorPreviewNotFound
END IF
END IF
b$ = "Launching..."
b$ = "Launching Preview component..."
GOSUB ShowMessage
SHELL _DONTWAIT "./InForm/UiEditorPreview"
$END IF
@ -2081,6 +2092,9 @@ SUB __UI_OnLoad
PUT #UiEditorFile, OffsetEditorPID, b$
CLOSE #UiEditorFile
b$ = "Reading directory..."
GOSUB ShowMessage
'Fill "open dialog" listboxes:
'-------------------------------------------------
DIM TotalFiles%
@ -2098,6 +2112,9 @@ SUB __UI_OnLoad
TIMER(CheckPreviewTimer) ON
b$ = "Done."
GOSUB ShowMessage
__UI_RefreshMenuBar
_FREEIMAGE tempIcon
@ -2107,12 +2124,23 @@ SUB __UI_OnLoad
SYSTEM
ShowMessage:
DIM PreserveDestMessage AS LONG
PreserveDestMessage = _DEST
_DEST 0
_FONT Control(__UI_FormID).Font
IF tempIcon < -1 THEN
CLS , _RGB32(255, 255, 255)
_PUTIMAGE (_WIDTH / 2 - _WIDTH(tempIcon) / 2, _HEIGHT / 2 - _HEIGHT(tempIcon) / 2), tempIcon
COLOR __UI_DefaultColor(__UI_Type_Form, 1), _RGBA32(0, 0, 0, 0)
__UI_PrintString _WIDTH \ 2 - _PRINTWIDTH(b$) \ 2, _HEIGHT / 2 + _HEIGHT(tempIcon) / 2 - _FONTHEIGHT * 2, b$
_DISPLAY
ELSE
CLS , __UI_DefaultColor(__UI_Type_Form, 2)
COLOR __UI_DefaultColor(__UI_Type_Form, 1), _RGBA32(0, 0, 0, 0)
__UI_PrintString _WIDTH \ 2 - _PRINTWIDTH(b$) \ 2, _HEIGHT \ 2 - _FONTHEIGHT \ 2, b$
END IF
_DISPLAY
_DEST PreserveDestMessage
RETURN
END SUB