1
1
Fork 0
mirror of https://github.com/FellippeHeitor/InForm.git synced 2025-01-14 19:49:33 +00:00

Fixes incorrect insertion of new controls in empty SELECT CASE blocks.

This commit is contained in:
FellippeHeitor 2020-11-02 19:55:10 -03:00
parent 5661656d78
commit 60f0b919f9
2 changed files with 25 additions and 12 deletions

View file

@ -1,5 +1,5 @@
'Starting with v1.0, __UI_VersionNumber is actually the current build.
CONST __UI_Version = "v1.3"
CONST __UI_VersionNumber = 18
CONST __UI_VersionNumber = 19
CONST __UI_VersionIsBeta = -1
CONST __UI_CopyrightSpan = "2016-2020"

View file

@ -1401,7 +1401,6 @@ SUB __UI_BeforeUpdateDisplay
END IF
NEXT
'$CONSOLE
IF CheckUpdatesNow THEN
IF CheckUpdateDone = False THEN
STATIC ThisStep AS INTEGER
@ -1410,7 +1409,7 @@ SUB __UI_BeforeUpdateDisplay
STATIC OverallDownloadStart!
DIM Result$, remoteFile$, start!
IF ThisStep = 0 THEN
'_ECHO "Beginning update process"
'"Beginning update process"
ThisStep = 1
updateDescription$ = ""
serverVersion$ = ""
@ -1426,7 +1425,7 @@ SUB __UI_BeforeUpdateDisplay
SELECT EVERYCASE ThisStep
CASE 1 'check availability
'_ECHO "Checking availability"
'"Checking availability"
start! = TIMER
IF CheckDevUpdates THEN
@ -1435,7 +1434,7 @@ SUB __UI_BeforeUpdateDisplay
remoteFile$ = "www.qb64.org/inform/update/latest.ini"
END IF
'_ECHO "Fetching " + remoteFile$
'"Fetching " + remoteFile$
Result$ = Download$(remoteFile$, "InForm/InFormUpdate.ini", 30)
SELECT CASE CVI(LEFT$(Result$, 2))
CASE 1 'Success
@ -1460,7 +1459,7 @@ SUB __UI_BeforeUpdateDisplay
localVersionNumber! = __UI_VersionNumber
'_ECHO "Comparing versions"
'"Comparing versions"
IF __UI_VersionIsBeta THEN isBeta$ = " Beta Version" ELSE isBeta$ = ""
serverBeta$ = ReadSetting("InForm/InFormUpdate.ini", "", "beta")
serverBeta%% = (serverBeta$ = "true")
@ -1469,7 +1468,7 @@ SUB __UI_BeforeUpdateDisplay
serverVersionString$ = ReadSetting("InForm/InFormUpdate.ini", "", "versionstring")
updateDescription$ = ReadSetting("InForm/InFormUpdate.ini", "", "description")
'_ECHO STR$(serverBeta%%) + "," + serverVersion$ + "," + serverVersionString$ + "," + updateDescription$
'STR$(serverBeta%%) + "," + serverVersion$ + "," + serverVersionString$ + "," + updateDescription$
IF serverBeta%% AND CheckDevUpdates = False THEN
CheckUpdateDone = True
@ -4286,6 +4285,7 @@ SUB SaveForm (ExitToQB64 AS _BYTE, SaveOnlyFrm AS _BYTE)
END IF
NEXT
'.FRM file
TextFileNum = FREEFILE
OPEN BaseOutputFileName + ".frm" FOR OUTPUT AS #TextFileNum
PRINT #TextFileNum, "': This form was generated by"
@ -4587,6 +4587,8 @@ SUB SaveForm (ExitToQB64 AS _BYTE, SaveOnlyFrm AS _BYTE)
NEXT
PRINT #TextFileNum, "END SUB"
CLOSE #TextFileNum
'.BAS file
IF NOT SaveOnlyFrm THEN
IF PreserveBackup THEN
DIM insertionPoint AS LONG, endPoint AS LONG, firstCASE AS LONG
@ -4720,10 +4722,15 @@ SUB SaveForm (ExitToQB64 AS _BYTE, SaveOnlyFrm AS _BYTE)
thisBlock$ = MID$(BackupCode$, insertionPoint, endPoint - insertionPoint)
IF INSTR(thisBlock$, "SELECT CASE id") THEN
firstCASE = _INSTRREV(INSTR(thisBlock$, " CASE "), thisBlock$, CHR$(10))
indenting = INSTR(firstCASE, thisBlock$, "CASE ") - firstCASE - 1
firstCASE = INSTR(thisBlock$, " CASE ")
IF firstCASE THEN
firstCASE = _INSTRREV(firstCASE, thisBlock$, CHR$(10))
indenting = INSTR(firstCASE, thisBlock$, "CASE ") - firstCASE - 1
ELSE
indenting = 8
firstCASE = _INSTRREV(INSTR(thisBlock$, "END SELECT"), thisBlock$, CHR$(10))
END IF
addedItems$ = ""
IF firstCASE = 0 THEN firstCASE = INSTR(thisBlock$, " SELECT CASE id") + 2
FOR Dummy = 1 TO UBOUND(PreviewControls)
GOSUB checkCondition
IF checkConditionResult THEN
@ -4731,15 +4738,21 @@ SUB SaveForm (ExitToQB64 AS _BYTE, SaveOnlyFrm AS _BYTE)
INSTR(thisBlock$, " CASE " + RTRIM$(PreviewControls(Dummy).Name) + " '<-- " + CHR$(34) + RTRIM$(PreviewControls(Dummy).Name) + CHR$(34) + " deleted from Form on ") = 0 THEN
addedItems$ = addedItems$ + SPACE$(indenting) + "CASE " + RTRIM$(PreviewControls(Dummy).Name) + CHR$(10) + CHR$(10)
ELSEIF INSTR(thisBlock$, " CASE " + RTRIM$(PreviewControls(Dummy).Name) + " '<-- " + CHR$(34) + RTRIM$(PreviewControls(Dummy).Name) + CHR$(34) + " deleted from Form on ") > 0 THEN
thisBlock$ = LEFT$(thisBlock$, INSTR(thisBlock$, " CASE " + RTRIM$(PreviewControls(Dummy).Name) + " '<-- " + CHR$(34)) + 5 + LEN(RTRIM$(PreviewControls(Dummy).Name))) + MID$(thisBlock$, INSTR(INSTR(thisBlock$, " CASE " + RTRIM$(PreviewControls(Dummy).Name) + " '<-- " + CHR$(34) + RTRIM$(PreviewControls(Dummy).Name) + CHR$(34) + " deleted from Form on "), thisBlock$, CHR$(10)))
thisBlock$ = LEFT$(thisBlock$, INSTR(thisBlock$, " CASE " + RTRIM$(PreviewControls(Dummy).Name) + _
" '<-- " + CHR$(34)) + 5 + LEN(RTRIM$(PreviewControls(Dummy).Name))) + _
MID$(thisBlock$, INSTR(INSTR(thisBlock$, " CASE " + RTRIM$(PreviewControls(Dummy).Name) + _
" '<-- " + CHR$(34) + RTRIM$(PreviewControls(Dummy).Name) + CHR$(34) + _
" deleted from Form on "), thisBlock$, CHR$(10)))
END IF
END IF
NEXT
IF LEN(addedItems$) THEN
thisBlock$ = LEFT$(thisBlock$, firstCASE) + addedItems$ + MID$(thisBlock$, firstCASE + 1)
END IF
BackupCode$ = LEFT$(BackupCode$, insertionPoint - 1) + thisBlock$ + MID$(BackupCode$, endPoint)
END IF
BackupCode$ = LEFT$(BackupCode$, insertionPoint - 1) + thisBlock$ + MID$(BackupCode$, endPoint)
END SELECT
NEXT