diff --git a/source/global/IDEsettings.bas b/source/global/IDEsettings.bas new file mode 100644 index 000000000..52b41977c --- /dev/null +++ b/source/global/IDEsettings.bas @@ -0,0 +1,238 @@ +DIM SHARED IDECommentColor AS _UNSIGNED LONG, IDEMetaCommandColor AS _UNSIGNED LONG +DIM SHARED IDEQuoteColor AS _UNSIGNED LONG, IDETextColor AS _UNSIGNED LONG +DIM SHARED IDE_AutoPosition AS _BYTE, IDE_TopPosition AS INTEGER, IDE_LeftPosition AS INTEGER +DIM SHARED IDE_Index$ +DIM SHARED LoadedIDESettings AS INTEGER + +IF LoadedIDESettings = 0 THEN + 'We only want to load the file once when QB64 first starts + 'Other changes should occur to our settings when we change them in their appropiate routines. + 'There's no reason to open and close and open and close the same file a million times. + + LoadedIDESettings = -1 + + ConfigFile$ = "internal/config.txt" + ConfigBak$ = "internal/config.bak" + + GOSUB CheckConfigFileExists 'make certain the config file exists and if not, create one + + IF INSTR(_OS$, "WIN") THEN + + result = ReadConfigSetting("AllowIndependentSettings", value$) + IF result THEN + IF value$ = "TRUE" OR ABS(VAL(value$)) = 1 THEN 'We default to false and only use one set of IDE settings, no matter how many windows we open up + IDE_Index$ = "(" + LTRIM$(RTRIM$(STR$(tempfolderindex))) + ")" + ConfigFile$ = "internal/config" + IDE_Index$ + ".txt" + ConfigBak$ = "internal/config" + IDE_Index$ + ".bak" + GOSUB CheckConfigFileExists + ELSE + WriteConfigSetting "'[GENERAL SETTINGS]", "AllowIndependentSettings", "FALSE" + IDE_Index$ = "" + END IF + ELSE + WriteConfigSetting "'[GENERAL SETTINGS]", "AllowIndependentSettings", "FALSE" + IDE_Index$ = "" + END IF + + ELSE + 'Linux doesn't offer multiple temp folders and thus can not work properly with independent settings + 'This option is not included on Linux, and if manually inserted will simply be ignored. + IDE_Index$ = "" + END IF + + result = ReadConfigSetting("ConfigVersion", value$) 'Not really used for anything at this point, but might be important in the future. + ConfigFileVersion = VAL(value$) 'We'll get a config file version of 0 if there isn't any in the file + + result = ReadConfigSetting("CommentColor", value$) + IF result THEN + IDECommentColor = VRGBS(value$, _RGB32(85, 255, 255)) + ELSE + IDECommentColor = _RGB32(85, 255, 255) + WriteConfigSetting "'[IDE COLOR SETTINGS]", "CommentColor", "_RGB32(85,255,255)" + END IF + + result = ReadConfigSetting("MetaCommandColor", value$) + IF result THEN + IDEMetaCommandColor = VRGBS(value$, _RGB32(85, 255, 85)) + ELSE + IDEMetaCommandColor = _RGB32(85, 255, 85) + WriteConfigSetting "'[IDE COLOR SETTINGS]", "MetaCommandColor", "_RGB32(85,255,85)" + END IF + + result = ReadConfigSetting("QuoteColor", value$) + IF result THEN + IDEQuoteColor = VRGBS(value$, _RGB32(255, 255, 85)) + ELSE + IDEQuoteColor = _RGB32(255, 255, 85) + WriteConfigSetting "'[IDE COLOR SETTINGS]", "QuoteColor", "_RGB32(255,255,85)" + END IF + + result = ReadConfigSetting("TextColor", value$) + IF result THEN + IDETextColor = VRGBS(value$, _RGB32(255, 255, 2555)) + ELSE + IDETextColor = _RGB32(255, 255, 255) + WriteConfigSetting "'[IDE COLOR SETTINGS]", "TextColor", "_RGB32(255,255,255)" + END IF + + IF INSTR(_OS$, "WIN") THEN + + result = ReadConfigSetting("IDE_AutoPosition", value$) + IF result THEN + IF UCASE$(value$) = "TRUE" OR ABS(VAL(value$)) = 1 THEN + IDE_AutoPosition = -1 + ELSE + IDE_AutoPosition = 0 + WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_AutoPosition", "FALSE" + END IF + ELSE + IDE_Autopostion = 0 + WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_AutoPosition", "FALSE" + END IF + + result = ReadConfigSetting("IDE_TopPosition", value$) + IF result THEN + IDE_TopPosition = VAL(value$) + ELSE + IDE_Autopostion = 0 'If there's no position saved in the file, then we certainly don't need to try and auto-position to our last setting. + WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_AutoPosition", "FALSE" + WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_TopPosition", "0" + WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_LeftPosition", "0" + END IF + + result = ReadConfigSetting("IDE_LeftPosition", value$) + IF result THEN + IDE_LeftPosition = VAL(value$) + ELSE + IDE_Autopostion = 0 'If there's no position saved in the file, then we certainly don't need to try and auto-position to our last setting. + WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_AutoPosition", "FALSE" + WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_TopPosition", "0" + WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_LeftPosition", "0" + END IF + + 'I was going to do some basic error checking for screen position to make certain that we appeared on the monitor, + 'but I decided not to. Some people (like me) may have multiple monitors set up and may wish for QB64 to pop-up at + 'a coordinate which seems insane at first glance (-1000,0 for instance), but which may move the IDE window to the + 'second monitor instead of the primary one. + 'I'm going to trust that the user doesn't go crazy and enter values like IDE_TopPosition = 123456789 or something insane... + + ELSE 'Linux doesn't work with _SCREENY or _SCREENY, so it's impossible to move the IDE properly. + 'These settings aren't included and are always set FALSE for them. + IDE_AutoPosition = 0 + IDE_TopPosition = 0 + IDE_LeftPosition = 0 + END IF + result = ReadConfigSetting("IDE_Width", value$) + idewx = VAL(value$) + IF idewx < 80 OR idewx > 1000 THEN idewx = 80: WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_Width", "80" + + result = ReadConfigSetting("IDE_Height", value$) + idewy = VAL(value$) + IF idewx < 25 OR idewx > 1000 THEN idewx = 25: WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_Height", "25" + + result = ReadConfigSetting("IDE_AutoFormat", value$) + ideautolayout = VAL(value$) + IF UCASE$(value$) = "TRUE" OR ideautolayout <> 0 THEN + ideautolayout = 1 + ELSE + IF UCASE$(value$) <> "FALSE" AND value$ <> "0" THEN WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_AutoFormat", "TRUE" + END IF + + result = ReadConfigSetting("IDE_AutoIndent", value$) + ideautoindent = VAL(value$) + IF UCASE$(value$) = "TRUE" OR ideautoindent <> 0 THEN + ideautoindent = 1 + ELSE + IF UCASE$(value$) <> "FALSE" AND value$ <> "0" THEN WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_AutoIndent", "TRUE" + END IF + + result = ReadConfigSetting("IDE_IndentSize", value$) + ideautoindentsize = VAL(value$) + IF ideautoindentsize < 0 OR ideautoindentsize > 64 THEN ideautoindentsize = 4: WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_IndentSize", "4" + + result = ReadConfigSetting("IDE_CustomFont", value$) + idecustomfont = VAL(value$) + IF UCASE$(value$) = "TRUE" OR idecustomfont <> 0 THEN idecustomfont = 1 ELSE WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_CustomFont", "FALSE" + + result = ReadConfigSetting("IDE_CustomFont$", value$) + idecustomfontfile$ = value$ + IF idecustomfontfile$ = "" THEN WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_CustomFont$", "c:\windows\fonts\lucon.ttf" + + result = ReadConfigSetting("IDE_CustomFontSize", value$) + idecustomfontheight = VAL(value$) + IF idecustomfontheight < 8 OR idecustomfontheight > 100 THEN idecustomfontheight = 21: WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_CustomFontSize", "21" + + result = ReadConfigSetting("IDE_CodePage", value$) + idecpindex = VAL(value$) + IF idecpindex < 0 OR idecpindex > idecpnum THEN idecpindex = 0: WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_CodePage", "0" + + result = ReadConfigSetting("BackupSize", value$) + idebackupdize = VAL(value$) + IF idebackupsize < 10 OR idebackupsize > 2000 THEN idebackupize = 100: WriteConfigSetting "'[GENERAL SETTINGS]", "BackupSize", "100 'in MB" + + result = ReadConfigSetting("DeBugInfo", value$) + idedebuginfo = VAL(value$) + IF UCASE$(LEFT$(value$, 4)) = "TRUE" THEN idedebuginfo = 1 + IF idedebuginfo = 0 THEN WriteConfigSetting "'[GENERAL SETTINGS]", "DebugInfo", "FALSE 'INTERNAL VARIABLE USE ONLY!! DO NOT MANUALLY CHANGE!" + Include_GDB_Debugging_Info = idedebuginfo + + result = ReadConfigSetting("IDE_AndroidMenu", value$) + IdeAndroidMenu = ABS(VAL(value$)) + IF UCASE$(value$) = "TRUE" THEN IdeAndroidMenu = 1 + IF IdeAndroidMenu <> 1 THEN ideideandroidmenu = 0: WriteConfigSetting "'[ANDROID MENU]", "IDE_AndroidMenu", "FALSE" + + result = ReadConfigSetting("IDE_AndroidStartScript$", value$) + IdeAndroidStartScript$ = value$ 'no default values in case this fails?? + IF result = 0 THEN WriteConfigSetting "'[ANDROID MENU]", "IDE_AndroidStartScript$", "programs\android\start_android.bat" + + result = ReadConfigSetting("IDE_AndroidMakeScript$", value$) + IdeAndroidMakeScript$ = value$ 'no default values in case this fails?? + IF result = 0 THEN WriteConfigSetting "'[ANDROID MENU]", "IDE_AndroidMakeScript$", "programs\android\start_android.bat" + + + GOTO SkipCheckConfigFileExists + CheckConfigFileExists: + IF _FILEEXISTS(ConfigFile$) = 0 THEN + 'There's no config file in the folder. Let's make one for future use. + IF ConfigFile$ = "internal/config.txt" THEN 'It's the main file which we use for default/global settings + WriteConfigSetting "'[CONFIG VERSION]", "ConfigVersion", "1" + WriteConfigSetting "'[ANDROID MENU]", "IDE_AndroidMakeScript$", "programs\android\start_android.bat" + WriteConfigSetting "'[ANDROID MENU]", "IDE_AndroidStartScript$", "programs\android\start_android.bat" + WriteConfigSetting "'[ANDROID MENU]", "IDE_AndroidMenu", "FALSE" + IF INSTR(_OS$, "WIN") THEN WriteConfigSetting "'[GENERAL SETTINGS]", "AllowIndependentSettings", "FALSE" + WriteConfigSetting "'[GENERAL SETTINGS]", "BackupSize", "100 'in MB" + WriteConfigSetting "'[GENERAL SETTINGS]", "DebugInfo", "FALSE 'INTERNAL VARIABLE USE ONLY!! DO NOT MANUALLY CHANGE!" + WriteConfigSetting "'[IDE COLOR SETTINGS]", "CommentColor", "_RGB32(85,255,255)" + WriteConfigSetting "'[IDE COLOR SETTINGS]", "MetaCommandColor", "_RGB32(85,255,85)" + WriteConfigSetting "'[IDE COLOR SETTINGS]", "QuoteColor", "_RGB32(255,255,85)" + WriteConfigSetting "'[IDE COLOR SETTINGS]", "TextColor", "_RGB32(255,255,255)" + IF INSTR(_OS$, "WIN") THEN + WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_TopPosition", "0" + WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_LeftPosition", "0" + WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_AutoPosition", "FALSE" + END IF + WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_Width", "80" + WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_Height", "25" + WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_IndentSize", "4" + WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_AutoIndent", "TRUE" + WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_AutoFormat", "TRUE" + WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_CustomFontSize", "21" + WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_CustomFont$", "c:\windows\fonts\lucon.ttf" + WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_CustomFont", "FALSE" + WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_CodePage", "0" + ELSE + 'use the main config file as the default values and just copy it over to the new file + f = FREEFILE + OPEN "internal/config.txt" FOR BINARY AS #f + L = LOF(f): temp$ = SPACE$(L) + GET #f, 1, temp$ + CLOSE #f + OPEN ConfigFile$ FOR BINARY AS #f + PUT #f, 1, temp$ + CLOSE #f + END IF + END IF + RETURN + SkipCheckConfigFileExists: +END IF + diff --git a/source/global/settings.bas b/source/global/settings.bas index 10a0379f7..c676bfea1 100644 --- a/source/global/settings.bas +++ b/source/global/settings.bas @@ -1,40 +1,3 @@ 'Used for debugging the compiler's code (not the code it compiles) [for temporary/advanced usage] CONST Debug = 0 -DIM SHARED IDECommentColor AS _UNSIGNED LONG, IDEMetaCommandColor AS _UNSIGNED LONG -DIM SHARED IDEQuoteColor AS _UNSIGNED LONG, IDETextColor AS _UNSIGNED LONG -ConfigFile$ = "internal/config.txt" -ConfigBak$ = "internal/config.bak" - -IF _FILEEXISTS(ConfigFile$) = 0 THEN - 'There's no config file in the folder. Let's make one for future use. - WriteConfigSetting "'[CONFIG VERSION]", "ConfigVersion", "1" - WriteConfigSetting "'[IDE COLOR SETTINGS]", "CommentColor", "_RGB32(85,255,255)" - WriteConfigSetting "'[IDE COLOR SETTINGS]", "MetaCommandColor", "_RGB32(85,255,85)" - WriteConfigSetting "'[IDE COLOR SETTINGS]", "QuoteColor", "_RGB32(255,255,85)" - WriteConfigSetting "'[IDE COLOR SETTINGS]", "TextColor", "_RGB32(255,255,255)" - - 'go ahead and set default values automatically - ConfigFileVersion = 1 - IDECommentColor = _RGB32(85, 255, 255) - IDEMetaCommandColor = _RGB32(85, 255, 85) - IDEQuoteColor = _RGB32(255, 255, 85) - IDETextColor = _RGB32(255, 255, 255) -ELSE - - result = ReadConfigSetting("ConfigVersion", value$) 'Not really used for anything at this point, but might be important in the future. - ConfigFileVersion = VAL(value$) 'We'll get a config file version of 0 if there isn't any in the file - - result = ReadConfigSetting("CommentColor", value$) - IF result THEN IDECommentColor = VRGBS(value$, _RGB32(85, 255, 255)) ELSE IDECommentColor = _RGB32(85, 255, 255) - - result = ReadConfigSetting("MetaCommandColor", value$) - IF result THEN IDEMetaCommandColor = VRGBS(value$, _RGB32(85, 255, 85)) ELSE IDEMetaCommandColor = _RGB32(85, 255, 85) - - result = ReadConfigSetting("QuoteColor", value$) - IF result THEN IDEQuoteColor = VRGBS(value$, _RGB32(255, 255, 85)) ELSE IDEQuoteColor = _RGB32(255, 255, 85) - - result = ReadConfigSetting("TextColor", value$) - IF result THEN IDETextColor = VRGBS(value$, _RGB32(255, 255, 2555)) ELSE IDETextColor = _RGB32(255, 255, 255) - -END IF diff --git a/source/ide/ide_methods.bas b/source/ide/ide_methods.bas index 6c124d280..ae7496911 100644 --- a/source/ide/ide_methods.bas +++ b/source/ide/ide_methods.bas @@ -624,22 +624,28 @@ DO idedeltxt 'removes temporary strings (typically created by guibox commands) by setting an index to 0 STATIC ForceResize - '### STEVE WAS HERE 10/11/2013 ### + if IDE_AutoPosition then + IF IDE_TopPosition <> _SCREENY OR IDE_LeftPosition <> _SCREENX THEN + WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_TopPosition" , str$(_SCREENY) + WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_LeftPosition" , str$(_SCREENX) + IDE_TopPosition = _SCREENY: IDE_LeftPosition = _SCREENX + END IF + end if + 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 IF v% <> idewx THEN retval = 1: idewx = v% - PUT #f, 7, v% v% = _RESIZEHEIGHT \ _FONTHEIGHT: IF v% < 25 OR v% > 1000 THEN v% = 25 IF v% <> idewy THEN retval = 1: idewy = v% - PUT #f, 9, v% - CLOSE #f + IF retval = 1 THEN 'screen dimensions have changed and everything must be redrawn/reapplied + WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_Width", str$(idewx) + WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_Height", str$(idewy) + tempf& = _font WIDTH idewx, idewy + idesubwindow _font tempf& @@ -647,7 +653,6 @@ DO END IF END IF END IF - '### END OF STEVE EDIT IF skipdisplay = 0 THEN @@ -6638,16 +6643,9 @@ DO 'main loop _MAPUNICODE u TO x NEXT - 'SEEK 1049 - '[2] codepage(=0) - 'total bytes: 1050 - 'save changes - OPEN ".\internal\temp\options.bin" FOR BINARY AS #150 - SEEK #150, 1049 - v% = y: PUT #150, , v%: idecpindex = v% - CLOSE #150 - + v% = y: idecpindex = v% + WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_CodePage", str$(idecpindex) EXIT FUNCTION END IF @@ -7564,23 +7562,33 @@ DO 'main loop IF K$ = CHR$(27) OR (focus = 5 AND info <> 0) THEN EXIT FUNCTION IF K$ = CHR$(13) OR (focus = 4 AND info <> 0) THEN 'save changes - OPEN ".\internal\temp\options.bin" FOR BINARY AS #150 v% = o(1).sel: IF v% <> 0 THEN v% = 1 'ideautolayout - PUT #150, , v% + IF ideautolayout <> v% THEN ideautolayout = v%: idelayoutbox = 1 v% = o(2).sel: IF v% <> 0 THEN v% = 1 'ideautoindent - PUT #150, , v% + IF ideautoindent <> v% THEN ideautoindent = v%: idelayoutbox = 1 v$ = idetxt(o(3).txt) 'ideautoindentsize IF v$ = "" THEN v$ = "4" v% = VAL(v$) IF v% < 0 OR v% > 64 THEN v% = 4 - PUT #150, , v% IF ideautoindentsize <> v% THEN ideautoindentsize = v% IF ideautoindent <> 0 THEN idelayoutbox = 1 END IF - CLOSE #150 + +if ideautolayout then + WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_AutoFormat", "TRUE" +else + WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_AutoFormat", "FALSE" +end if +if ideautoindent then + WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_AutoIndent", "TRUE" +else + WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_AutoIndent", "FALSE" +end if + WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_IndentSize", str$(ideautoindentsize) + EXIT FUNCTION END IF @@ -7723,8 +7731,6 @@ DO 'main loop IF K$ = CHR$(13) OR (focus = 2 AND info <> 0) THEN 'save changes - OPEN ".\internal\temp\options.bin" FOR BINARY AS #150 - SEEK #150, 1051 v$ = idetxt(o(1).txt) 'idebackupsize v& = VAL(v$) IF v& < 10 THEN v& = 10 @@ -7737,8 +7743,7 @@ DO 'main loop END IF idebackupsize = v& - PUT #150, , v& - CLOSE #150 + WriteConfigSetting "'[GENERAL SETTINGS]", "BackupSize", str$(v&) + " 'in MB" idebackupbox = 1 EXIT FUNCTION END IF @@ -8029,13 +8034,16 @@ DO 'main loop IF K$ = CHR$(13) OR (focus = 1 AND info <> 0) THEN 'close 'save changes - OPEN ".\internal\temp\options.bin" FOR BINARY AS #150 'update idedebuginfo? v% = o(2).sel: IF v% <> 0 THEN v% = 1 IF v% <> idedebuginfo THEN - SEEK #150, 1055: PUT #150, , v% idedebuginfo = v% + if idedebuginfo then + WriteConfigSetting "'[GENERAL SETTINGS]", "DebugInfo", "TRUE 'INTERNAL VARIABLE USE ONLY!! DO NOT MANUALLY CHANGE!" + else + WriteConfigSetting "'[GENERAL SETTINGS]", "DebugInfo", "FALSE 'INTERNAL VARIABLE USE ONLY!! DO NOT MANUALLY CHANGE!" + end if Include_GDB_Debugging_Info = idedebuginfo IF os$ = "WIN" THEN CHDIR "internal\c" @@ -8057,7 +8065,6 @@ DO 'main loop '... - CLOSE #150 EXIT FUNCTION END IF @@ -8477,12 +8484,14 @@ DO 'main loop v3$ = idetxt(o(3 - 1).txt) IF LEN(v3$) > 256 THEN v3$ = LEFT$(v3$, 256) IF LEN(v3$) < 256 THEN v3$ = v3$ + SPACE$(256 - LEN(v3$)) - OPEN ".\internal\temp\options.bin" FOR BINARY AS #150 - SEEK #150, 1057 - PUT #150, , v% - PUT #150, , v$ - PUT #150, , v3$ - CLOSE #150 + WriteConfigSetting "'[ANDROID MENU]", "IDE_AndroidMakeScript$", v3$ + WriteConfigSetting "'[ANDROID MENU]", "IDE_AndroidStartScript$", v$ + if v% then + WriteConfigSetting "'[ANDROID MENU]", "IDE_AndroidMenu", "TRUE" + ELSE + WriteConfigSetting "'[ANDROID MENU]", "IDE_AndroidMenu", "FALSE" + end if + IdeAndroidMenu = o(1).sel IdeAndroidStartScript = "" 'idetxt(o(2).txt) IdeAndroidMakeScript = idetxt(o(3 - 1).txt) @@ -8732,44 +8741,47 @@ DO 'main loop END IF 'save changes - OPEN ".\internal\temp\options.bin" FOR BINARY AS #150 - - SEEK #150, 7 - v$ = idetxt(o(1).txt): IF v$ = "" THEN v$ = "0" v% = VAL(v$) IF v% < 80 THEN v% = 80 IF v% > 999 THEN v% = 999 - PUT #150, , v% IF v% <> idewx THEN idedisplaybox = 1 idewx = v% + v$ = idetxt(o(2).txt): IF v$ = "" THEN v$ = "0" v% = VAL(v$) IF v% < 25 THEN v% = 25 IF v% > 999 THEN v% = 999 - PUT #150, , v% IF v% <> idewy THEN idedisplaybox = 1 idewy = v% - idesubwindow + v% = o(3).sel IF v% <> 0 THEN v% = 1 - PUT #150, , v% idecustomfont = v% v$ = idetxt(o(4).txt) IF LEN(v$) > 1024 THEN v$ = LEFT$(v$, 1024) idecustomfontfile$ = v$ v$ = v$ + SPACE$(1024 - LEN(v$)) - PUT #150, , v$ v$ = idetxt(o(5).txt): IF v$ = "" THEN v$ = "0" v% = VAL(v$) IF v% < 8 THEN v% = 8 IF v% > 99 THEN v% = 99 - PUT #150, , v% idecustomfontheight = v% - CLOSE #150 + WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_Width", str$(idewx) + WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_Height", str$(idewy) + IF idecustomfont THEN + WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_CustomFont", "TRUE" + ELSE + WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_CustomFont", "FALSE" + END IF + WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_CustomFont$", idecustomfontfile$ + WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_CustomFontSize", str$(idecustomfontheight) + + EXIT FUNCTION END IF diff --git a/source/qb64.bas b/source/qb64.bas index aaaac536d..840e47ad2 100644 --- a/source/qb64.bas +++ b/source/qb64.bas @@ -304,126 +304,7 @@ DIM SHARED idemessage AS STRING 'set by qb64-error(...) to the error message to ' note: detected by the fact that ideerror was not set to 0 ' [255] - - - -'ref: options.bin -'SEEK 1 -'[2] ideautolayout(=1) -'[2] ideautoindent(=1) -'[2] ideautoindentsize(=4) -'SEEK 7 -'[2] idewx(=80) -'[2] idewy(=25) -'[2] idecustomfont(=0) -'[1024]idecustomfontfile(=c:\windows\fonts\lucon.ttf) -'[2] idecustomfontheight(=21) -'SEEK 1039 -'[2] ideupdatecheck(=1) ***deprecated*** -'[2] ideupdatedaily(=1) ***deprecated*** -'[2] ideupdateauto(=0) ***deprecated*** -'[4] ideupdatelast(=0) ***deprecated*** -'SEEK 1049 -'[2] codepage(=0) -'SEEK 1051 -'[4] backupsize(=100) -'SEEK 1055 -'[2] embed debug info -'total bytes: 1056 - -OPEN ".\internal\temp\options.bin" FOR BINARY AS #150 - -'remake options with defaults? -IF LOF(150) < 1048 THEN - CLOSE #150 - OPEN ".\internal\temp\options.bin" FOR OUTPUT AS #150: CLOSE #150 - OPEN ".\internal\temp\options.bin" FOR BINARY AS #150 - v% = 1: PUT #150, , v% 'layout - v% = 1: PUT #150, , v% 'indent - v% = 4: PUT #150, , v% 'indentsize - v% = 80: PUT #150, , v% 'w - v% = 25: PUT #150, , v% 'h - v% = 0: PUT #150, , v% 'use custom font? - v$ = SPACE$(1024): MID$(v$, 1) = "c:\windows\fonts\lucon.ttf": PUT #150, , v$ - v% = 21: PUT #150, , v% 'custom font height - v% = 1: PUT #150, , v% 'update-check - v% = 1: PUT #150, , v% 'update-daily - v% = 0: PUT #150, , v% 'update-autoapply - ideupdatelast& = 0: PUT #150, , ideupdatelast& 'update-datestamp(last) -END IF -IF LOF(150) < 1050 THEN - SEEK #150, 1049 - v% = 0: PUT #150, , v% 'codepage -END IF -IF LOF(150) < 1054 THEN - SEEK #150, 1051 - v& = 100: PUT #150, , v& 'backup-size(mb) -END IF -IF LOF(150) < 1056 THEN - SEEK #150, 1055 - v% = 0: PUT #150, , v% 'idedebuginfo -END IF - -'@1056 -IF LOF(150) < 1056 + 2 + 256 + 256 THEN - SEEK #150, 1057 - v% = 0: PUT #150, , v% 'IdeAndroidMenu - a$ = "programs\android\start_android.bat" - a$ = a$ + SPACE$(256 - LEN(a$)) - PUT #150, , a$ 'IdeAndroidStartScript - a$ = "programs\android\make_android.bat" - a$ = a$ + SPACE$(256 - LEN(a$)) - PUT #150, , a$ 'IdeAndroidMakeScript -END IF - -'load options -SEEK #150, 1 -'layout: -GET #150, , v%: IF v% <> 0 THEN v% = 1 -ideautolayout = v% -GET #150, , v%: IF v% <> 0 THEN v% = 1 -ideautoindent = v% -GET #150, , v%: IF v% < 0 OR v% > 64 THEN v% = 4 -ideautoindentsize = v% -'display: -GET #150, , v%: IF v% < 80 OR v% > 1000 THEN v% = 80 -idewx = v% -GET #150, , v%: IF v% < 25 OR v% > 1000 THEN v% = 25 -idewy = v% -GET #150, , v%: IF v% <> 0 THEN v% = 1 -idecustomfont = v% -v$ = SPACE$(1024): GET #150, , v$: idecustomfontfile$ = RTRIM$(v$) -GET #150, , v%: IF v% < 8 OR v% > 100 THEN v% = 21 -idecustomfontheight = v% -GET #150, , v%: IF v% < 0 OR v% > 1 THEN v% = 1 -ideupdatecheck = v% -GET #150, , v%: IF v% < 0 OR v% > 1 THEN v% = 1 -ideupdatedaily = v% -GET #150, , v%: IF v% < 0 OR v% > 1 THEN v% = 1 -ideupdateauto = v% -GET #150, , v& -ideupdatelast = v& -GET #150, , v%: IF v% < 0 OR v% > idecpnum THEN v% = 0 -idecpindex = v% -GET #150, , v&: IF v& < 10 OR v& > 2000 THEN v& = 100 -idebackupsize = v& -GET #150, , v%: IF v% < 0 OR v% > 1 THEN v% = 0 -idedebuginfo = v% -Include_GDB_Debugging_Info = idedebuginfo -GET #150, , v%: IF v% < 0 OR v% > 1 THEN v% = 0 -IdeAndroidMenu = v% -a$ = SPACE$(256) -GET #150, , a$ -a$ = RTRIM$(a$) -IdeAndroidStartScript$ = a$ -a$ = SPACE$(256) -GET #150, , a$ -a$ = RTRIM$(a$) -IdeAndroidMakeScript$ = a$ -CLOSE #150 - - - +'$INCLUDE:'global\IDEsettings.bas' 'hash table data TYPE HashListItem @@ -941,7 +822,8 @@ gl_scan_header '-----------------------QB64 COMPILER ONCE ONLY SETUP CODE ENDS HERE--------------------------------------- -IF NoIDEMode THEN GOTO noide +IF NoIDEMode THEN IDE_AutoPosition = 0: GOTO noide +IF IDE_AutoPosition THEN _SCREENMOVE IDE_LeftPosition, IDE_TopPosition idemode = 1 sendc$ = "" 'no initial message IF CMDLineFile <> "" THEN sendc$ = CHR$(1) + CMDLineFile @@ -1851,20 +1733,20 @@ DO 'Edit 02/23/2014 to add space between = and _ for statements like CONST x=_RGB(123,0,0) and stop us from gettting an error. DO - l = INSTR(wholestv$, "=_") - IF l THEN - wholestv$ = LEFT$(wholestv$, l) + " " + MID$(wholestv$, l + 1) + L = INSTR(wholestv$, "=_") + IF L THEN + wholestv$ = LEFT$(wholestv$, L) + " " + MID$(wholestv$, L + 1) END IF - LOOP UNTIL l = 0 + LOOP UNTIL L = 0 'End of Edit on 02/23/2014 DO finished = -1 - l = INSTR(l + 1, UCASE$(wholestv$), " _RGBA") - IF l > 0 THEN + L = INSTR(L + 1, UCASE$(wholestv$), " _RGBA") + IF L > 0 THEN altered = -1 - l$ = LEFT$(wholestv$, l - 1) - vp = INSTR(l, wholestv$, "(") + l$ = LEFT$(wholestv$, L - 1) + vp = INSTR(L, wholestv$, "(") IF vp > 0 THEN E = INSTR(vp + 1, wholestv$, ")") IF E > 0 THEN @@ -1877,7 +1759,7 @@ DO green$ = MID$(wholestv$, first + 1, second - first - 1) blue$ = MID$(wholestv$, second + 1, third - second - 1) alpha$ = MID$(wholestv$, third + 1) - IF MID$(wholestv$, l + 6, 2) = "32" THEN + IF MID$(wholestv$, L + 6, 2) = "32" THEN val$ = "32" ELSE val$ = MID$(wholestv$, fourth + 1) @@ -1908,11 +1790,11 @@ DO DO finished = -1 - l = INSTR(l + 1, UCASE$(wholestv$), " _RGB") - IF l > 0 THEN + L = INSTR(L + 1, UCASE$(wholestv$), " _RGB") + IF L > 0 THEN altered = -1 - l$ = LEFT$(wholestv$, l - 1) - vp = INSTR(l, wholestv$, "(") + l$ = LEFT$(wholestv$, L - 1) + vp = INSTR(L, wholestv$, "(") IF vp > 0 THEN E = INSTR(vp + 1, wholestv$, ")") IF E > 0 THEN @@ -1922,7 +1804,7 @@ DO red$ = MID$(wholestv$, vp + 1, first - vp - 1) green$ = MID$(wholestv$, first + 1, second - first - 1) blue$ = MID$(wholestv$, second + 1) - IF MID$(wholestv$, l + 5, 2) = "32" THEN + IF MID$(wholestv$, L + 5, 2) = "32" THEN val$ = "32" ELSE val$ = MID$(wholestv$, third + 1) @@ -1954,30 +1836,30 @@ DO 'New Edit by Steve on 02/23/2014 to add support for the new Math functions - l = 0: Emergency_Exit = 0 'A counter where if we're inside the same DO-Loop for more than 10,000 times, we assume it's an endless loop that didn't process properly and toss out an error message instead of locking up the program. + L = 0: Emergency_Exit = 0 'A counter where if we're inside the same DO-Loop for more than 10,000 times, we assume it's an endless loop that didn't process properly and toss out an error message instead of locking up the program. DO - l = INSTR(l + 1, wholestv$, "=") - IF l THEN - l2 = INSTR(l + 1, wholestv$, ",") 'Look for a comma after that + L = INSTR(L + 1, wholestv$, "=") + IF L THEN + l2 = INSTR(L + 1, wholestv$, ",") 'Look for a comma after that IF l2 = 0 THEN 'If there's no comma, then we're working to the end of the line l2 = LEN(wholestv$) ELSE l2 = l2 - 1 'else we only want to take what's before that comma and see if we can use it END IF - temp$ = RTRIM$(LTRIM$(MID$(wholestv$, l + 1, l2 - l))) + temp$ = RTRIM$(LTRIM$(MID$(wholestv$, L + 1, l2 - L))) temp1$ = RTRIM$(LTRIM$(Evaluate_Expression$(temp$))) IF LEFT$(temp1$, 5) <> "ERROR" AND temp$ <> temp1$ THEN 'The math routine should have did its replacement for us. altered = -1 - wholestv$ = LEFT$(wholestv$, l) + temp1$ + MID$(wholestv$, l2 + 1) + wholestv$ = LEFT$(wholestv$, L) + temp1$ + MID$(wholestv$, l2 + 1) ELSE 'We should leave it as it is and let the normal CONST routine handle things from here on out and see if it passes the rest of the error checks. END IF - l = l + 1 + L = L + 1 END IF Emergency_Exit = Emergency_Exit + 1 IF Emergency_Exit > 10000 THEN a$ = "CONST ERROR: Attempting to process MATH Function caused Endless Loop. Please recheck your math formula.": GOTO errmes - LOOP UNTIL l = 0 + LOOP UNTIL L = 0 'End of Math Support Edit @@ -14386,7 +14268,7 @@ FOR i = 1 TO blockn END IF 'convert rhs IF (newtyp AND ISSTRING) THEN - IF (rhstyp AND 4) = 0 THEN Give_Error "Cannot convert string to number": EXIT FUNCTION + IF (rhstyp AND 4) = 0 THEN Give_Error "Cannot convert string to number": EXIT FUNCTION ELSE 'newtyp is numeric IF rhstyp = 4 THEN Give_Error "Cannot convert number to string": EXIT FUNCTION