Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More ide refactoring #525

Merged
merged 12 commits into from
Aug 6, 2024
34 changes: 29 additions & 5 deletions source/ide/config/cfg_methods.bas
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,22 @@ SUB CopyFromOther
oqbv% = 1 'pre v3.14.0
oqbi$ = oqbi$ + pathsep$ + "internal" + pathsep$
nul& = CopyFile&(oqbi$ + "config.ini", ConfigFile$)
IF nul& = 0 THEN 'we need to convert old to new color scheme order
oqbd$ = _READFILE$(ConfigFile$)
sid% = INSTR(oqbd$, "SchemeID=")
IF sid% > 0 THEN
id% = VAL(MID$(oqbd$, sid% + 9))
IF id% > 10 THEN
'custom user schemes move by 4, as of 4 new built-in schemes in v3.14.0
oqbd$ = LEFT$(oqbd$, sid% + 8) + str2$(id% + 4) + MID$(oqbd$, sid% + 9 + LEN(str2$(id%)))
ELSE
'built-in schemes are reordered according to the lookup string
ncso$ = "12349567de" 'old id = pick position for new id
oqbd$ = LEFT$(oqbd$, sid% + 8) + str2$(VAL("&H" + MID$(ncso$, id%, 1))) + MID$(oqbd$, sid% + 9 + LEN(str2$(id%)))
END IF
END IF
_WRITEFILE ConfigFile$, oqbd$
END IF
oqbi$ = oqbi$ + "temp" + pathsep$
END IF
nul& = CopyFile&(oqbi$ + "debug.ini", DebugFile$)
Expand Down Expand Up @@ -40,7 +56,7 @@ SUB CopyFromOther
IF _MESSAGEBOX("QB64-PE IDE", "No qb64pe executable found, so that seems not to be a QB64-PE installation, select another folder?", "yesno", "warning" ) = 1 GOTO cfoAgain
END IF
END IF
QB64_uptime! = TIMER 'reinit to avoid startup resize events going wild
QB64_uptime# = TIMER(0.001) 'reinit to avoid startup resize events going wild
END SUB

'===== Routine to read/set initial config values ==============================
Expand Down Expand Up @@ -395,15 +411,15 @@ SUB ReadInitialConfig
result = ReadConfigSetting(displaySettingsSection$, "IDE_CustomFont", value$)
idecustomfont = VAL(value$)
IF UCASE$(value$) = "TRUE" OR idecustomfont <> 0 THEN
idecustomfont = 1
idecustomfont = -1
ELSE
WriteConfigSetting displaySettingsSection$, "IDE_CustomFont", "False"
idecustomfont = 0
END IF

result = ReadConfigSetting(displaySettingsSection$, "IDE_UseFont8", value$)
IF UCASE$(value$) = "TRUE" THEN
IDE_UseFont8 = 1
IDE_UseFont8 = -1
ELSE
WriteConfigSetting displaySettingsSection$, "IDE_UseFont8", "False"
IDE_UseFont8 = 0
Expand All @@ -412,13 +428,21 @@ SUB ReadInitialConfig
result = ReadConfigSetting(displaySettingsSection$, "IDE_CustomFont$", value$)
idecustomfontfile$ = value$
IF result = 0 OR idecustomfontfile$ = "" THEN
idecustomfontfile$ = "C:\Windows\Fonts\lucon.ttf"
IF os$ = "LNX" THEN
idecustomfontfile$ = _DIR$("fonts") + "truetype/liberation/LiberationMono-Regular.ttf"
IF MacOSX THEN idecustomfontfile$ = _DIR$("fonts") + "Courier New.ttf"
ELSE
idecustomfontfile$ = _DIR$("fonts") + "lucon.ttf"
END IF
WriteConfigSetting displaySettingsSection$, "IDE_CustomFont$", idecustomfontfile$
END IF

result = ReadConfigSetting(displaySettingsSection$, "IDE_CustomFontSize", value$)
idecustomfontheight = VAL(value$)
IF idecustomfontheight < 8 OR idecustomfontheight > 100 THEN idecustomfontheight = 21: WriteConfigSetting displaySettingsSection$, "IDE_CustomFontSize", "21"
IF idecustomfontheight < 8 OR idecustomfontheight > 100 THEN
idecustomfontheight = 19
WriteConfigSetting displaySettingsSection$, "IDE_CustomFontSize", STR$(idecustomfontheight)
END IF

result = ReadConfigSetting(displaySettingsSection$, "IDE_CodePage", value$)
idecpindex = VAL(value$)
Expand Down
3 changes: 3 additions & 0 deletions source/ide/ide_global.bas
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ TYPE idedbotype
typ AS LONG
nam AS LONG
txt AS LONG
inv AS LONG 'invalid data detected, eg. text in number fields (text boxes)
blk AS LONG 'blocked space at right in chars (text boxes)
rpt AS LONG 'repeat selection while mousebutten is held down (single symbol buttons)
dft AS LONG
cx AS LONG
cy AS LONG
Expand Down
Loading