From 292dbbf49ddbea539388db4af0dd070fc9e3bb26 Mon Sep 17 00:00:00 2001 From: FellippeHeitor Date: Sat, 14 Oct 2017 04:09:54 -0300 Subject: [PATCH] Add "Show compilation errors immediately" to Options menu. By unchecking the new switch in the Options menu, the IDE won't warn and "red-light" every single mistake until you tell it to start compilation with F5. Signed-off-by: FellippeHeitor --- source/global/IDEsettings.bas | 14 +++++ source/global/version.bas | 2 +- source/ide/ide_global.bas | 1 + source/ide/ide_methods.bas | 105 +++++++++++++++++++--------------- source/qb64.bas | 2 +- 5 files changed, 77 insertions(+), 47 deletions(-) diff --git a/source/global/IDEsettings.bas b/source/global/IDEsettings.bas index c6b40433e..c5d6b137d 100644 --- a/source/global/IDEsettings.bas +++ b/source/global/IDEsettings.bas @@ -10,6 +10,7 @@ DIM SHARED LoadedIDESettings AS INTEGER DIM SHARED MouseButtonSwapped AS _BYTE DIM SHARED PasteCursorAtEnd AS _BYTE DIM SHARED SaveExeWithSource AS _BYTE +DIM SHARED IDEShowErrorsImmediately AS _BYTE IF LoadedIDESettings = 0 THEN 'We only want to load the file once when QB64 first starts @@ -176,6 +177,19 @@ IF LoadedIDESettings = 0 THEN SaveExeWithSource = 0 END IF + result = ReadConfigSetting("ShowErrorsImmediately", value$) + IF result THEN + IF value$ = "TRUE" OR VAL(value$) = -1 THEN + IDEShowErrorsImmediately = -1 + ELSE + IDEShowErrorsImmediately = 0 + WriteConfigSetting "'[GENERAL SETTINGS]", "ShowErrorsImmediately", "FALSE" + END IF + ELSE + WriteConfigSetting "'[GENERAL SETTINGS]", "ShowErrorsImmediately", "TRUE" + IDEShowErrorsImmediately = -1 + END IF + result = ReadConfigSetting("BracketHighlight", value$) IF result THEN IF value$ = "TRUE" OR VAL(value$) = -1 THEN diff --git a/source/global/version.bas b/source/global/version.bas index da8d63856..2933dee53 100644 --- a/source/global/version.bas +++ b/source/global/version.bas @@ -4,4 +4,4 @@ DIM SHARED AutoBuildMsg AS STRING Version$ = "1.1" 'BuildNum format is YYYYMMDD/id, where id is a ever-increasing 'integer. If you make a change, update the date and increase the id! -BuildNum$ = "20171010/75" +BuildNum$ = "20171014/76" diff --git a/source/ide/ide_global.bas b/source/ide/ide_global.bas index debe40378..b632ef372 100644 --- a/source/ide/ide_global.bas +++ b/source/ide/ide_global.bas @@ -204,6 +204,7 @@ DIM SHARED menusize(1 TO 10) DIM SHARED menus AS INTEGER, idecontextualmenuID AS INTEGER DIM SHARED ideeditmenuID AS INTEGER DIM SHARED OptionsMenuID AS INTEGER, OptionsMenuSwapMouse AS INTEGER, OptionsMenuPasteCursor AS INTEGER +DIM SHARED OptionsMenuShowErrorsImmediately AS INTEGER DIM SHARED RunMenuID AS INTEGER, RunMenuSaveExeWithSource AS INTEGER, brackethighlight AS INTEGER DIM SHARED multihighlight AS INTEGER, keywordHighlight AS INTEGER DIM SHARED PresetColorSchemes AS INTEGER, TotalColorSchemes AS INTEGER, ColorSchemes$(0) diff --git a/source/ide/ide_methods.bas b/source/ide/ide_methods.bas index 9a194353d..f4cf6e145 100644 --- a/source/ide/ide_methods.bas +++ b/source/ide/ide_methods.bas @@ -129,7 +129,7 @@ FUNCTION ide2 (ignore) STATIC last.TBclick#, wholeword.select AS _BYTE STATIC wholeword.selectx1, wholeword.idecx STATIC wholeword.selecty1, wholeword.idecy - STATIC ForceResize + STATIC ForceResize, IDECompilationRequested AS _BYTE CONST idesystem2.w = 20 '"Find" field width (Status bar) char.sep$ = CHR$(34) + " =<>+-/\^:;,*()." @@ -308,17 +308,23 @@ FUNCTION ide2 (ignore) menu$(m, i) = "#Advanced...": i = i + 1 OptionsMenuSwapMouse = i - menu$(m, i) = menu$(m, i) + "#Swap Mouse Buttons": i = i + 1 + menu$(m, i) = "#Swap Mouse Buttons": i = i + 1 IF MouseButtonSwapped THEN menu$(OptionsMenuID, OptionsMenuSwapMouse) = CHR$(7) + menu$(OptionsMenuID, OptionsMenuSwapMouse) END IF OptionsMenuPasteCursor = i - menu$(m, i) = menu$(m, i) + "Cursor after #pasted content": i = i + 1 + menu$(m, i) = "Cursor after #pasted content": i = i + 1 IF PasteCursorAtEnd THEN menu$(OptionsMenuID, OptionsMenuPasteCursor) = CHR$(7) + menu$(OptionsMenuID, OptionsMenuPasteCursor) END IF + OptionsMenuShowErrorsImmediately = i + menu$(m, i) = "Show compilation #errors immediately": i = i + 1 + IF IDEShowErrorsImmediately THEN + menu$(OptionsMenuID, OptionsMenuShowErrorsImmediately) = CHR$(7) + menu$(OptionsMenuID, OptionsMenuShowErrorsImmediately) + END IF + menu$(m, i) = "-": i = i + 1 menu$(m, i) = "#Google Android...": i = i + 1 @@ -653,7 +659,9 @@ FUNCTION ide2 (ignore) IF c$ <> CHR$(3) THEN COLOR 7, 1: LOCATE idewy - 3, 2: PRINT SPACE$(idewx - 2);: LOCATE idewy - 2, 2: PRINT SPACE$(idewx - 2);: LOCATE idewy - 1, 2: PRINT SPACE$(idewx - 2); 'clear status window - IF ready THEN LOCATE idewy - 3, 2: PRINT "OK"; 'report OK status + IF ready THEN + IF ShowErrorsImmediately THEN LOCATE idewy - 3, 2: PRINT "OK"; 'report OK status + END IF IF showexecreated THEN showexecreated = 0 LOCATE idewy - 3, 2 @@ -904,48 +912,51 @@ FUNCTION ide2 (ignore) 'display error message (if necessary) IF failed THEN - IF LEFT$(IdeInfo, 19) <> "Selection length = " THEN IdeInfo = "" - UpdateIdeInfo + IF IDEShowErrorsImmediately OR IDECompilationRequested THEN + IF LEFT$(IdeInfo, 19) <> "Selection length = " THEN IdeInfo = "" + UpdateIdeInfo - COLOR 7, 1: LOCATE idewy - 3, 2: PRINT SPACE$(idewx - 2);: LOCATE idewy - 2, 2: PRINT SPACE$(idewx - 2);: LOCATE idewy - 1, 2: PRINT SPACE$(idewx - 2); 'clear status window + COLOR 7, 1: LOCATE idewy - 3, 2: PRINT SPACE$(idewx - 2);: LOCATE idewy - 2, 2: PRINT SPACE$(idewx - 2);: LOCATE idewy - 1, 2: PRINT SPACE$(idewx - 2); 'clear status window - 'scrolling unavailable, but may span multiple lines - a$ = MID$(c$, 2, LEN(c$) - 5) + 'scrolling unavailable, but may span multiple lines + a$ = MID$(c$, 2, LEN(c$) - 5) - l = CVL(RIGHT$(c$, 4)): IF l <> 0 THEN idefocusline = l + l = CVL(RIGHT$(c$, 4)): IF l <> 0 THEN idefocusline = l - x = 1 - y = idewy - 3 + x = 1 + y = idewy - 3 - IF l <> 0 AND idecy = l THEN a$ = a$ + " on current line" + IF l <> 0 AND idecy = l THEN a$ = a$ + " on current line" - FOR i = 1 TO LEN(a$) - x = x + 1: IF x = idewx THEN x = 2: y = y + 1 - IF y > idewy - 1 THEN EXIT FOR - LOCATE y, x - PRINT CHR$(ASC(a$, i)); - NEXT - - IF l <> 0 AND idecy <> l THEN - a$ = " on line" + STR$(l) - COLOR 11, 1 FOR i = 1 TO LEN(a$) x = x + 1: IF x = idewx THEN x = 2: y = y + 1 IF y > idewy - 1 THEN EXIT FOR LOCATE y, x PRINT CHR$(ASC(a$, i)); NEXT - END IF + IF l <> 0 AND idecy <> l THEN + a$ = " on line" + STR$(l) + COLOR 11, 1 + FOR i = 1 TO LEN(a$) + x = x + 1: IF x = idewx THEN x = 2: y = y + 1 + IF y > idewy - 1 THEN EXIT FOR + LOCATE y, x + PRINT CHR$(ASC(a$, i)); + NEXT + END IF + END IF END IF IF idechangemade THEN - COLOR 7, 1: LOCATE idewy - 3, 2: PRINT SPACE$(idewx - 2);: LOCATE idewy - 2, 2: PRINT SPACE$(idewx - 2);: LOCATE idewy - 1, 2: PRINT SPACE$(idewx - 2); 'clear status window + IF IDEShowErrorsImmediately OR IDECompilationRequested THEN + COLOR 7, 1: LOCATE idewy - 3, 2: PRINT SPACE$(idewx - 2);: LOCATE idewy - 2, 2: PRINT SPACE$(idewx - 2);: LOCATE idewy - 1, 2: PRINT SPACE$(idewx - 2); 'clear status window - IdeInfo = "" + IdeInfo = "" - LOCATE idewy - 3, 2: PRINT "..."; 'assume new compilation will begin + LOCATE idewy - 3, 2: PRINT "..."; 'assume new compilation will begin + END IF END IF ideshowtext @@ -1045,15 +1056,16 @@ FUNCTION ide2 (ignore) END IF 'skipdisplay - - + STATIC prev_idecy AS LONG, idechangedbefore AS _BYTE IF idechangemade THEN IF idelayoutallow THEN idelayoutallow = idelayoutallow - 1 idecurrentlinelayouti = 0 'invalidate - + idefocusline = 0 idechangemade = 0 + idechangedbefore = -1 + IDECompilationRequested = 0 IF ideunsaved = -1 THEN ideunsaved = 0 ELSE ideunsaved = 1 IF idenoundo = 0 THEN @@ -1201,20 +1213,6 @@ FUNCTION ide2 (ignore) END IF 'idechangemade - - - - - - - - - - - - - - change = 0 waitforinput: @@ -1400,7 +1398,7 @@ FUNCTION ide2 (ignore) idemrun: iderunmode = 0 'standard run idemrunspecial: - + IDECompilationRequested = -1 'run program IF ready <> 0 AND idechangemade = 0 THEN @@ -4363,6 +4361,21 @@ FUNCTION ide2 (ignore) GOTO ideloop END IF + IF RIGHT$(menu$(m, s), 36) = "Show compilation #errors immediately" THEN + PCOPY 2, 0 + IDEShowErrorsImmediately = NOT IDEShowErrorsImmediately + IF IDEShowErrorsImmediately THEN + WriteConfigSetting "'[GENERAL SETTINGS]", "ShowErrorsImmediately", "TRUE" + menu$(OptionsMenuID, OptionsMenuShowErrorsImmediately) = CHR$(7) + "Show compilation #errors immediately" + ELSE + WriteConfigSetting "'[GENERAL SETTINGS]", "ShowErrorsImmediately", "FALSE" + menu$(OptionsMenuID, OptionsMenuShowErrorsImmediately) = "Show compilation #errors immediately" + END IF + idechangemade = 1 + PCOPY 3, 0: SCREEN , , 3, 0: idewait4mous: idewait4alt + GOTO ideloop + END IF + IF RIGHT$(menu$(m, s), 30) = "Save EXE in the source #folder" THEN PCOPY 2, 0 SaveExeWithSource = NOT SaveExeWithSource @@ -5002,6 +5015,7 @@ FUNCTION ide2 (ignore) ModifyCOMMAND$ = "" _TITLE "QB64" idechangemade = 1 + idefocusline = 0 ideundobase = 0 'reset GOTO ideloop END IF @@ -7283,6 +7297,7 @@ FUNCTION ideopen$ idecx = 1 idecy = 1 ideselect = 0 + idefocusline = 0 lineinput3load path$ + idepathsep$ + f$ idet$ = SPACE$(LEN(lineinput3buffer) * 8) i2 = 1 diff --git a/source/qb64.bas b/source/qb64.bas index 71e517efd..2fdce9f8a 100644 --- a/source/qb64.bas +++ b/source/qb64.bas @@ -2200,7 +2200,7 @@ DO CASE 32 clr~& = _RGB32(VAL(red$), VAL(green$), VAL(blue$)) CASE ELSE - a$ = "Invalid Screen Mode.": GOTO errmes + a$ = "Invalid screen mode": GOTO errmes END SELECT wholestv$ = l$ + STR$(clr~&) + RIGHT$(wholestv$, LEN(wholestv$) - E)