1
1
Fork 0
mirror of https://github.com/QB64Official/qb64.git synced 2024-07-03 08:51:22 +00:00

Fix to the IDE Resizing and changing fonts. Patch to ELSE allowing invalid syntax in various cases.

This commit is contained in:
SMcNeill 2014-08-14 03:55:38 -04:00
parent 4e73933e74
commit 1b7f25aaba
2 changed files with 39 additions and 3 deletions

View file

@ -622,8 +622,14 @@ idefocusline = 0
DO
ideloop:
idedeltxt 'removes temporary strings (typically created by guibox commands) by setting an index to 0
STATIC ForceResize
'### STEVE WAS HERE 10/11/2013 ###
IF _RESIZE THEN
IF _RESIZE or ForceResize THEN
IF idesubwindow <> 0 THEN 'If there's a subwindow up, don't resize as it screws all sorts of things up.
ForceResize = -1
ELSE
ForceResize = 0
f = FREEFILE
OPEN ".\internal\temp\options.bin" FOR BINARY AS #f
v% = _RESIZEWIDTH \ _FONTWIDTH: IF v% < 80 OR v% > 1000 THEN v% = 80
@ -634,14 +640,15 @@ DO
PUT #f, 9, v%
CLOSE #f
IF retval = 1 THEN 'screen dimensions have changed and everything must be redrawn/reapplied
tempf& = _font
WIDTH idewx, idewy + idesubwindow
_font tempf&
GOTO redraweverything
END IF
END IF
END IF
'### END OF STEVE EDIT
idedeltxt 'removes temporary strings (typically created by guibox commands) by setting an index to 0
IF skipdisplay = 0 THEN
LOCATE , , 0

View file

@ -5042,6 +5042,35 @@ DO
IF n = 1 THEN
IF firstelement$ = "ELSE" THEN
'Routine to add error checking for ELSE so we'll no longer be able to do things like the following:
'IF x = 1 THEN
' SELECT CASE s
' CASE 1
' END SELECT ELSE y = 2
'END IF
'Notice the ELSE with the SELECT CASE? Before this patch, commands like those were considered valid QB64 code.
temp$ = UCASE$(LTRIM$(RTRIM$(wholeline)))
goodelse = 0 'a check to see if it's a good else
IF LEFT$(temp$, 2) = "IF" THEN goodelse = -1: GOTO skipelsecheck 'If we have an IF, the else is probably good
IF LEFT$(temp$, 4) = "ELSE" THEN goodelse = -1: GOTO skipelsecheck 'If it's an else by itself,then we'll call it good too at this point and let the rest of the syntax checking check for us
DO
spacelocation = INSTR(temp$, " ")
IF spacelocation THEN temp$ = LEFT$(temp$, spacelocation - 1) + MID$(temp$, spacelocation + 1)
LOOP UNTIL spacelocation = 0
IF INSTR(temp$, ":ELSE") OR INSTR(temp$, ":IF") THEN goodelse = -1: GOTO skipelsecheck 'I personally don't like the idea of a :ELSE statement, but this checks for that and validates it as well. YUCK! (I suppose this might be useful if there's a label where the ELSE is, like thisline: ELSE
count = 0
DO
count = count + 1
SELECT CASE MID$(temp$, count, 1)
CASE IS = "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", ":"
CASE ELSE: EXIT DO
END SELECT
LOOP UNTIL count >= LEN(temp$)
IF MID$(temp$, count, 4) = "ELSE" OR MID$(temp$, count, 2) = "IF" THEN goodelse = -1 'We only had numbers before our else
IF NOT goodelse THEN a$ = "Invalid Syntax for ELSE": GOTO errmes
skipelsecheck:
'End of ELSE Error checking
FOR i = controllevel TO 1 STEP -1
t = controltype(i)
IF t = 1 THEN