mirror of
https://github.com/FellippeHeitor/InForm.git
synced 2025-01-15 11:59:34 +00:00
Moves CheckPreview from a TIMER event into BeforeUpdateDisplay. Also:
Adds a mechanism to restore the preview's contents in case of crash/restart.
This commit is contained in:
parent
84f654f94b
commit
975828e338
2 changed files with 37 additions and 17 deletions
|
@ -122,7 +122,7 @@ DIM SHARED OpenDialogOpen AS _BYTE, OverwriteOldFiles AS _BYTE
|
||||||
DIM SHARED RevertEdit AS _BYTE, OldColor AS _UNSIGNED LONG
|
DIM SHARED RevertEdit AS _BYTE, OldColor AS _UNSIGNED LONG
|
||||||
DIM SHARED ColorPreviewWord$, BlinkStatusBar AS SINGLE, StatusBarBackColor AS _UNSIGNED LONG
|
DIM SHARED ColorPreviewWord$, BlinkStatusBar AS SINGLE, StatusBarBackColor AS _UNSIGNED LONG
|
||||||
DIM SHARED HostPort AS STRING, Host AS LONG, Client AS LONG
|
DIM SHARED HostPort AS STRING, Host AS LONG, Client AS LONG
|
||||||
DIM SHARED Stream$, FormDataReceived AS _BYTE
|
DIM SHARED Stream$, FormDataReceived AS _BYTE, LastFormData$
|
||||||
|
|
||||||
TYPE newInputBox
|
TYPE newInputBox
|
||||||
ID AS LONG
|
ID AS LONG
|
||||||
|
@ -183,8 +183,8 @@ IF _FILEEXISTS("falcon.h") = 0 THEN RestoreFalcon
|
||||||
DIM SHARED CurrentPath$
|
DIM SHARED CurrentPath$
|
||||||
DIM SHARED OpenDialog AS LONG
|
DIM SHARED OpenDialog AS LONG
|
||||||
|
|
||||||
CheckPreviewTimer = _FREETIMER
|
'CheckPreviewTimer = _FREETIMER
|
||||||
ON TIMER(CheckPreviewTimer, .003) CheckPreview
|
'ON TIMER(CheckPreviewTimer, .003) CheckPreview
|
||||||
|
|
||||||
UiEditorTitle$ = "InForm Designer"
|
UiEditorTitle$ = "InForm Designer"
|
||||||
|
|
||||||
|
@ -959,12 +959,18 @@ SUB __UI_BeforeUpdateDisplay
|
||||||
END IF
|
END IF
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
|
CheckPreview
|
||||||
|
|
||||||
IF NOT MidRead THEN
|
IF NOT MidRead THEN
|
||||||
MidRead = True
|
MidRead = True
|
||||||
DIM incomingData$, Signal$
|
DIM incomingData$, Signal$
|
||||||
|
|
||||||
GET #Client, , incomingData$
|
GET #Client, , incomingData$
|
||||||
Stream$ = Stream$ + incomingData$
|
Stream$ = Stream$ + incomingData$
|
||||||
|
STATIC bytesIn~&, refreshes~&
|
||||||
|
refreshes~& = refreshes~& + 1
|
||||||
|
bytesIn~& = bytesIn~& + LEN(incomingData$)
|
||||||
|
Caption(StatusBar) = LTRIM$(STR$(refreshes~&)) + ": " + LTRIM$(STR$(bytesIn~&)) + " bytes received. (" + Stream$ + "...)"
|
||||||
|
|
||||||
$IF WIN THEN
|
$IF WIN THEN
|
||||||
IF PreviewAttached THEN
|
IF PreviewAttached THEN
|
||||||
|
@ -1047,7 +1053,8 @@ SUB __UI_BeforeUpdateDisplay
|
||||||
CASE "SIGNAL"
|
CASE "SIGNAL"
|
||||||
Signal$ = Signal$ + thisData$
|
Signal$ = Signal$ + thisData$
|
||||||
CASE "FORMDATA"
|
CASE "FORMDATA"
|
||||||
LoadPreview thisData$
|
LastFormData$ = thisData$
|
||||||
|
LoadPreview
|
||||||
FormDataReceived = True
|
FormDataReceived = True
|
||||||
CASE "UNDOPOINTER"
|
CASE "UNDOPOINTER"
|
||||||
UndoPointer = CVI(thisData$)
|
UndoPointer = CVI(thisData$)
|
||||||
|
@ -2393,7 +2400,7 @@ SUB __UI_OnLoad
|
||||||
__UI_ForceRedraw = True
|
__UI_ForceRedraw = True
|
||||||
_FREEIMAGE tempIcon
|
_FREEIMAGE tempIcon
|
||||||
|
|
||||||
TIMER(CheckPreviewTimer) ON
|
'TIMER(CheckPreviewTimer) ON
|
||||||
|
|
||||||
EXIT SUB
|
EXIT SUB
|
||||||
UiEditorPreviewNotFound:
|
UiEditorPreviewNotFound:
|
||||||
|
@ -2856,15 +2863,18 @@ FUNCTION ReadSequential$ (Txt$, Bytes%)
|
||||||
Txt$ = MID$(Txt$, Bytes% + 1)
|
Txt$ = MID$(Txt$, Bytes% + 1)
|
||||||
END FUNCTION
|
END FUNCTION
|
||||||
|
|
||||||
SUB LoadPreview (FormData$)
|
SUB LoadPreview
|
||||||
DIM a$, b$, i AS LONG, __UI_EOF AS _BYTE, Answer AS _BYTE
|
DIM a$, b$, i AS LONG, __UI_EOF AS _BYTE, Answer AS _BYTE
|
||||||
DIM NewType AS INTEGER, NewWidth AS INTEGER, NewHeight AS INTEGER
|
DIM NewType AS INTEGER, NewWidth AS INTEGER, NewHeight AS INTEGER
|
||||||
DIM NewLeft AS INTEGER, NewTop AS INTEGER, NewName AS STRING
|
DIM NewLeft AS INTEGER, NewTop AS INTEGER, NewName AS STRING
|
||||||
DIM NewParentID AS STRING, FloatValue AS _FLOAT, Dummy AS LONG
|
DIM NewParentID AS STRING, FloatValue AS _FLOAT, Dummy AS LONG
|
||||||
|
DIM FormData$
|
||||||
|
|
||||||
TIMER(__UI_EventsTimer) OFF
|
TIMER(__UI_EventsTimer) OFF
|
||||||
TIMER(__UI_RefreshTimer) OFF
|
TIMER(__UI_RefreshTimer) OFF
|
||||||
|
|
||||||
|
FormData$ = LastFormData$
|
||||||
|
|
||||||
b$ = ReadSequential$(FormData$, 4)
|
b$ = ReadSequential$(FormData$, 4)
|
||||||
|
|
||||||
REDIM PreviewCaptions(1 TO CVL(b$)) AS STRING
|
REDIM PreviewCaptions(1 TO CVL(b$)) AS STRING
|
||||||
|
@ -3092,8 +3102,9 @@ SUB CheckPreview
|
||||||
Control(ViewMenuPreview).Disabled = True
|
Control(ViewMenuPreview).Disabled = True
|
||||||
ELSE
|
ELSE
|
||||||
'Preview was closed.
|
'Preview was closed.
|
||||||
|
|
||||||
TIMER(__UI_EventsTimer) OFF
|
TIMER(__UI_EventsTimer) OFF
|
||||||
Control(ViewMenuPreview).Disabled = False
|
|
||||||
__UI_WaitMessage = "Reloading preview window..."
|
__UI_WaitMessage = "Reloading preview window..."
|
||||||
UiPreviewPID = 0
|
UiPreviewPID = 0
|
||||||
__UI_ProcessInputTimer = 0 'Make the "Please wait" message show up immediataly
|
__UI_ProcessInputTimer = 0 'Make the "Please wait" message show up immediataly
|
||||||
|
@ -3113,6 +3124,11 @@ SUB CheckPreview
|
||||||
|
|
||||||
Handshake
|
Handshake
|
||||||
|
|
||||||
|
IF LEN(LastFormData$) THEN
|
||||||
|
b$ = "RESTORECRASH>" + LastFormData$ + "<END>"
|
||||||
|
PUT #Client, , b$
|
||||||
|
END IF
|
||||||
|
|
||||||
TIMER(__UI_EventsTimer) ON
|
TIMER(__UI_EventsTimer) ON
|
||||||
END IF
|
END IF
|
||||||
END IF
|
END IF
|
||||||
|
|
|
@ -28,7 +28,7 @@ DIM SHARED UndoPointer AS INTEGER, TotalUndoImages AS INTEGER, MidUndo AS _BYTE
|
||||||
REDIM SHARED UndoImage(100) AS STRING
|
REDIM SHARED UndoImage(100) AS STRING
|
||||||
DIM SHARED IsCreating AS _BYTE
|
DIM SHARED IsCreating AS _BYTE
|
||||||
DIM SHARED Host AS LONG, HostPort AS STRING
|
DIM SHARED Host AS LONG, HostPort AS STRING
|
||||||
DIM SHARED Stream$
|
DIM SHARED Stream$, RestoreCrashData$
|
||||||
|
|
||||||
REDIM SHARED QB64KEYWORDS(0) AS STRING
|
REDIM SHARED QB64KEYWORDS(0) AS STRING
|
||||||
READ_KEYWORDS
|
READ_KEYWORDS
|
||||||
|
@ -68,6 +68,7 @@ CONST InDisk = 1
|
||||||
CONST InClipboard = 2
|
CONST InClipboard = 2
|
||||||
CONST ToEditor = 3
|
CONST ToEditor = 3
|
||||||
CONST ToUndoBuffer = 4
|
CONST ToUndoBuffer = 4
|
||||||
|
CONST FromEditor = 5
|
||||||
|
|
||||||
DIM i AS LONG
|
DIM i AS LONG
|
||||||
DIM SHARED AlphaNumeric(255)
|
DIM SHARED AlphaNumeric(255)
|
||||||
|
@ -240,6 +241,10 @@ SUB __UI_BeforeUpdateDisplay
|
||||||
thisCommand$ = LEFT$(thisData$, INSTR(thisData$, ">") - 1)
|
thisCommand$ = LEFT$(thisData$, INSTR(thisData$, ">") - 1)
|
||||||
thisData$ = MID$(thisData$, LEN(thisCommand$) + 2)
|
thisData$ = MID$(thisData$, LEN(thisCommand$) + 2)
|
||||||
SELECT CASE UCASE$(thisCommand$)
|
SELECT CASE UCASE$(thisCommand$)
|
||||||
|
CASE "RESTORECRASH"
|
||||||
|
RestoreCrashData$ = thisData$
|
||||||
|
LoadPreview FromEditor
|
||||||
|
EXIT SUB
|
||||||
CASE "WINDOWPOSITION"
|
CASE "WINDOWPOSITION"
|
||||||
NewWindowLeft = CVI(LEFT$(thisData$, 2))
|
NewWindowLeft = CVI(LEFT$(thisData$, 2))
|
||||||
NewWindowTop = CVI(MID$(thisData$, 3, 2))
|
NewWindowTop = CVI(MID$(thisData$, 3, 2))
|
||||||
|
@ -309,14 +314,12 @@ SUB __UI_BeforeUpdateDisplay
|
||||||
END SELECT
|
END SELECT
|
||||||
LOOP
|
LOOP
|
||||||
|
|
||||||
|
|
||||||
$IF WIN THEN
|
$IF WIN THEN
|
||||||
IF NewWindowLeft <> -32001 AND NewWindowTop <> -32001 AND (NewWindowLeft <> _SCREENX OR NewWindowTop <> _SCREENY) THEN
|
IF NewWindowLeft <> -32001 AND NewWindowTop <> -32001 AND (NewWindowLeft <> _SCREENX OR NewWindowTop <> _SCREENY) THEN
|
||||||
_SCREENMOVE NewWindowLeft + 612, NewWindowTop
|
_SCREENMOVE NewWindowLeft + 612, NewWindowTop
|
||||||
END IF
|
END IF
|
||||||
$END IF
|
$END IF
|
||||||
|
|
||||||
|
|
||||||
'Check if the editor is still alive
|
'Check if the editor is still alive
|
||||||
$IF WIN THEN
|
$IF WIN THEN
|
||||||
DIM hnd&, b&, ExitCode&
|
DIM hnd&, b&, ExitCode&
|
||||||
|
@ -455,10 +458,7 @@ SUB __UI_BeforeUpdateDisplay
|
||||||
'Editor sent property value
|
'Editor sent property value
|
||||||
b$ = ReadSequential$(Property$, 2)
|
b$ = ReadSequential$(Property$, 2)
|
||||||
TempValue = CVI(b$)
|
TempValue = CVI(b$)
|
||||||
IF TempValue <> 213 AND TempValue <> 214 AND TempValue <> 215 AND TempValue <> 217 AND TempValue <> 221 THEN
|
|
||||||
'Save undo image except for select, undo, redo, copy and select all signals
|
|
||||||
SaveUndoImage
|
SaveUndoImage
|
||||||
END IF
|
|
||||||
SELECT CASE TempValue
|
SELECT CASE TempValue
|
||||||
CASE 1 'Name
|
CASE 1 'Name
|
||||||
b$ = ReadSequential$(Property$, 4)
|
b$ = ReadSequential$(Property$, 4)
|
||||||
|
@ -932,6 +932,7 @@ SUB __UI_BeforeUpdateDisplay
|
||||||
NEXT
|
NEXT
|
||||||
CASE 201 TO 210
|
CASE 201 TO 210
|
||||||
'Alignment commands
|
'Alignment commands
|
||||||
|
b$ = ReadSequential$(Property$, 2)
|
||||||
DoAlign TempValue
|
DoAlign TempValue
|
||||||
CASE 211, 212 'Z-Ordering -> Move up/down
|
CASE 211, 212 'Z-Ordering -> Move up/down
|
||||||
DIM tID1 AS LONG, tID2 AS LONG
|
DIM tID1 AS LONG, tID2 AS LONG
|
||||||
|
@ -969,9 +970,10 @@ SUB __UI_BeforeUpdateDisplay
|
||||||
|
|
||||||
IF CVL(b$) > 0 THEN Control(CVL(b$)).ControlIsSelected = True
|
IF CVL(b$) > 0 THEN Control(CVL(b$)).ControlIsSelected = True
|
||||||
CASE 214 TO 221
|
CASE 214 TO 221
|
||||||
|
b$ = ReadSequential$(Property$, 2)
|
||||||
__UI_KeyPress TempValue
|
__UI_KeyPress TempValue
|
||||||
CASE 222 'New textbox control with the NumericOnly property set to true
|
CASE 222 'New textbox control with the NumericOnly property set to true
|
||||||
SaveUndoImage
|
b$ = ReadSequential$(Property$, 2)
|
||||||
TempValue = __UI_NewControl(__UI_Type_TextBox, "", 120, 23, TempWidth \ 2 - 60, TempHeight \ 2 - 12, ThisContainer)
|
TempValue = __UI_NewControl(__UI_Type_TextBox, "", 120, 23, TempWidth \ 2 - 60, TempHeight \ 2 - 12, ThisContainer)
|
||||||
Control(TempValue).Name = "Numeric" + Control(TempValue).Name
|
Control(TempValue).Name = "Numeric" + Control(TempValue).Name
|
||||||
SetCaption TempValue, RTRIM$(Control(TempValue).Name)
|
SetCaption TempValue, RTRIM$(Control(TempValue).Name)
|
||||||
|
@ -990,6 +992,7 @@ SUB __UI_BeforeUpdateDisplay
|
||||||
__UI_FirstSelectedID = TempValue
|
__UI_FirstSelectedID = TempValue
|
||||||
__UI_ForceRedraw = True
|
__UI_ForceRedraw = True
|
||||||
CASE 223
|
CASE 223
|
||||||
|
b$ = ReadSequential$(Property$, 2)
|
||||||
AlternateNumericOnlyProperty
|
AlternateNumericOnlyProperty
|
||||||
END SELECT
|
END SELECT
|
||||||
__UI_ForceRedraw = True
|
__UI_ForceRedraw = True
|
||||||
|
@ -1143,7 +1146,6 @@ END SUB
|
||||||
SUB __UI_KeyPress (id AS LONG)
|
SUB __UI_KeyPress (id AS LONG)
|
||||||
SELECT CASE id
|
SELECT CASE id
|
||||||
CASE 201 TO 210
|
CASE 201 TO 210
|
||||||
SaveUndoImage
|
|
||||||
DoAlign id
|
DoAlign id
|
||||||
CASE 214
|
CASE 214
|
||||||
RestoreUndoImage
|
RestoreUndoImage
|
||||||
|
@ -1166,7 +1168,6 @@ SUB __UI_KeyPress (id AS LONG)
|
||||||
AlternateNumericOnlyProperty
|
AlternateNumericOnlyProperty
|
||||||
CASE 224
|
CASE 224
|
||||||
DIM TempID AS LONG
|
DIM TempID AS LONG
|
||||||
SaveUndoImage
|
|
||||||
TempID = AddNewMenuBarControl
|
TempID = AddNewMenuBarControl
|
||||||
SelectNewControl TempID
|
SelectNewControl TempID
|
||||||
END SELECT
|
END SELECT
|
||||||
|
@ -1653,6 +1654,9 @@ SUB LoadPreview (Destination AS _BYTE)
|
||||||
ELSEIF UndoBuffer THEN
|
ELSEIF UndoBuffer THEN
|
||||||
IF UndoPointer = TotalUndoImages THEN EXIT SUB
|
IF UndoPointer = TotalUndoImages THEN EXIT SUB
|
||||||
Clip$ = UndoImage$(UndoPointer)
|
Clip$ = UndoImage$(UndoPointer)
|
||||||
|
ELSEIF Destination = FromEditor THEN
|
||||||
|
Clip$ = RestoreCrashData$
|
||||||
|
UndoBuffer = True
|
||||||
ELSE
|
ELSE
|
||||||
Clip$ = _CLIPBOARD$
|
Clip$ = _CLIPBOARD$
|
||||||
b$ = ReadSequential$(Clip$, LEN(__UI_ClipboardCheck$))
|
b$ = ReadSequential$(Clip$, LEN(__UI_ClipboardCheck$))
|
||||||
|
|
Loading…
Reference in a new issue