1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-06-29 10:30:36 +00:00

Allows using _FONT 8 for the IDE

This commit is contained in:
FellippeHeitor 2020-01-18 03:27:51 -03:00
parent 81106cb5a2
commit a114182f8a
3 changed files with 57 additions and 22 deletions

View file

@ -422,6 +422,14 @@ IF LoadedIDESettings = 0 THEN
idecustomfont = 0 idecustomfont = 0
END IF END IF
result = ReadConfigSetting("IDE_UseFont8", value$)
IF UCASE$(value$) = "TRUE" THEN
IDE_UseFont8 = 1
ELSE
WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_UseFont8", "FALSE"
IDE_UseFont8 = 0
END IF
result = ReadConfigSetting("IDE_CustomFont$", value$) result = ReadConfigSetting("IDE_CustomFont$", value$)
idecustomfontfile$ = value$ idecustomfontfile$ = value$
if result = 0 OR idecustomfontfile$ = "" then if result = 0 OR idecustomfontfile$ = "" then

View file

@ -214,6 +214,6 @@ DIM SHARED ideundocombo, ideundocombochr, idenoundo, idemergeundo
DIM SHARED idealthighlight, ideentermenu DIM SHARED idealthighlight, ideentermenu
DIM SHARED ideautolayout, ideautoindent, ideautoindentsize, ideindentsubs, idebackupsize DIM SHARED ideautolayout, ideautoindent, ideautoindentsize, ideindentsubs, idebackupsize
DIM SHARED idewx, idewy, idecustomfont, idecustomfontfile$, idecustomfontheight, idecustomfonthandle DIM SHARED idewx, idewy, idecustomfont, idecustomfontfile$, idecustomfontheight, idecustomfonthandle
DIM SHARED iderunmode DIM SHARED iderunmode, IDE_UseFont8 AS _BYTE
'IDE MODULE SECTION END: shared data & definitions 'IDE MODULE SECTION END: shared data & definitions

View file

@ -224,7 +224,7 @@ FUNCTION ide2 (ignore)
idelaunched = 1 idelaunched = 1
WIDTH idewx, idewy WIDTH idewx, idewy
_FONT 16 IF IDE_UseFont8 THEN _FONT 8 ELSE _FONT 16
'change codepage 'change codepage
IF idecpindex THEN IF idecpindex THEN
@ -4609,7 +4609,7 @@ FUNCTION ide2 (ignore)
IF idecustomfont THEN IF idecustomfont THEN
_FONT idecustomfonthandle _FONT idecustomfonthandle
ELSE ELSE
_FONT 16 IF IDE_UseFont8 THEN _FONT 8 ELSE _FONT 16
END IF END IF
skipdisplay = 0 skipdisplay = 0
GOTO redraweverything2 GOTO redraweverything2
@ -11512,11 +11512,19 @@ FUNCTION idedisplaybox
o(i).nam = idenewtxt("Restore window #position at startup") o(i).nam = idenewtxt("Restore window #position at startup")
IF IDE_AutoPosition THEN o(i).sel = 1 IF IDE_AutoPosition THEN o(i).sel = 1
i = i + 1
o(i).typ = 4 'check box
o(i).y = 9
o(i).nam = idenewtxt("Use _FONT 8")
o(i).sel = IDE_UseFont8
prevFont8Setting = o(i).sel
i = i + 1 i = i + 1
o(i).typ = 4 'check box o(i).typ = 4 'check box
o(i).y = 10 o(i).y = 10
o(i).nam = idenewtxt("Custom #Font:") o(i).nam = idenewtxt("Custom #Font:")
o(i).sel = idecustomfont o(i).sel = idecustomfont
prevCustomFontSetting = o(i).sel
a2$ = idecustomfontfile$ a2$ = idecustomfontfile$
i = i + 1 i = i + 1
@ -11622,7 +11630,7 @@ FUNCTION idedisplaybox
IF focus <> PrevFocus THEN IF focus <> PrevFocus THEN
'Always start with TextBox values selected upon getting focus 'Always start with TextBox values selected upon getting focus
PrevFocus = focus PrevFocus = focus
IF focus = 1 OR focus = 2 OR focus = 5 OR focus = 6 THEN IF focus = 1 OR focus = 2 OR focus = 6 OR focus = 7 THEN
o(focus).v1 = LEN(idetxt(o(focus).txt)) o(focus).v1 = LEN(idetxt(o(focus).txt))
IF o(focus).v1 > 0 THEN o(focus).issel = -1 IF o(focus).v1 > 0 THEN o(focus).issel = -1
o(focus).sx1 = 0 o(focus).sx1 = 0
@ -11655,40 +11663,54 @@ FUNCTION idedisplaybox
END IF END IF
idetxt(o(2).txt) = a$ idetxt(o(2).txt) = a$
a$ = idetxt(o(5).txt) IF prevFont8Setting <> o(4).sel THEN
IF LEN(a$) > 1024 THEN a$ = LEFT$(a$, 1024) prevFont8Setting = o(4).sel
idetxt(o(5).txt) = a$ IF o(4).sel THEN o(5).sel = 0: prevCustomFontSetting = 0
END IF
IF prevCustomFontSetting <> o(5).sel THEN
prevCustomFontSetting = o(5).sel
IF o(5).sel THEN o(4).sel = 0: prevFont8Setting = 0
END IF
a$ = idetxt(o(6).txt) a$ = idetxt(o(6).txt)
IF LEN(a$) > 1024 THEN a$ = LEFT$(a$, 1024)
idetxt(o(6).txt) = a$
a$ = idetxt(o(7).txt)
IF LEN(a$) > 2 THEN a$ = LEFT$(a$, 2) '2 character limit IF LEN(a$) > 2 THEN a$ = LEFT$(a$, 2) '2 character limit
FOR i = 1 TO LEN(a$) FOR i = 1 TO LEN(a$)
a = ASC(a$, i) a = ASC(a$, i)
IF a < 48 OR a > 57 THEN a$ = "": EXIT FOR IF a < 48 OR a > 57 THEN a$ = "": EXIT FOR
IF i = 2 AND ASC(a$, 1) = 48 THEN a$ = "0": EXIT FOR IF i = 2 AND ASC(a$, 1) = 48 THEN a$ = "0": EXIT FOR
NEXT NEXT
IF focus <> 6 THEN IF focus <> 7 THEN
IF LEN(a$) THEN a = VAL(a$) ELSE a = 0 IF LEN(a$) THEN a = VAL(a$) ELSE a = 0
IF a < 8 THEN a$ = "8" IF a < 8 THEN a$ = "8"
END IF END IF
idetxt(o(6).txt) = a$ idetxt(o(7).txt) = a$
IF K$ = CHR$(27) OR (focus = 9 AND info <> 0) THEN EXIT FUNCTION
IF K$ = CHR$(27) OR (focus = 8 AND info <> 0) THEN EXIT FUNCTION IF K$ = CHR$(13) OR (focus = 8 AND info <> 0) THEN
IF K$ = CHR$(13) OR (focus = 7 AND info <> 0) THEN
x = 0 'change to custom font x = 0 'change to custom font
'get size in v% 'get size in v%
v$ = idetxt(o(6).txt): IF v$ = "" THEN v$ = "0" v$ = idetxt(o(7).txt): IF v$ = "" THEN v$ = "0"
v% = VAL(v$) v% = VAL(v$)
IF v% < 8 THEN v% = 8 IF v% < 8 THEN v% = 8
IF v% > 99 THEN v% = 99 IF v% > 99 THEN v% = 99
IF v% <> idecustomfontheight THEN x = 1 IF v% <> idecustomfontheight THEN x = 1
IF o(4).sel <> idecustomfont THEN IF o(4).sel <> IDE_UseFont8 THEN
IF o(4).sel = 0 THEN IDE_UseFont8 = o(4).sel
_FONT 16 idedisplaybox = 1
END IF
IF o(5).sel <> idecustomfont THEN
IF o(5).sel = 0 THEN
IF IDE_UseFont8 THEN _FONT 8 ELSE _FONT 16
_FREEFONT idecustomfonthandle _FREEFONT idecustomfonthandle
ELSE ELSE
x = 1 x = 1
@ -11696,14 +11718,14 @@ FUNCTION idedisplaybox
END IF END IF
v$ = idetxt(o(5).txt): IF v$ <> idecustomfontfile$ THEN x = 1 v$ = idetxt(o(6).txt): IF v$ <> idecustomfontfile$ THEN x = 1
IF o(4).sel = 1 AND x = 1 THEN IF o(5).sel = 1 AND x = 1 THEN
oldhandle = idecustomfonthandle oldhandle = idecustomfonthandle
idecustomfonthandle = _LOADFONT(v$, v%, "MONOSPACE") idecustomfonthandle = _LOADFONT(v$, v%, "MONOSPACE")
IF idecustomfonthandle = -1 THEN IF idecustomfonthandle = -1 THEN
'failed! - revert to default settings 'failed! - revert to default settings
o(4).sel = 0: idetxt(o(5).txt) = "c:\windows\fonts\lucon.ttf": idetxt(o(6).txt) = "21": _FONT 16 o(5).sel = 0: idetxt(o(6).txt) = "c:\windows\fonts\lucon.ttf": idetxt(o(7).txt) = "21": IF IDE_UseFont8 THEN _FONT 8 ELSE _FONT 16
ELSE ELSE
_FONT idecustomfonthandle _FONT idecustomfonthandle
END IF END IF
@ -11730,16 +11752,16 @@ FUNCTION idedisplaybox
IF v% <> 0 THEN v% = -1 IF v% <> 0 THEN v% = -1
IDE_AutoPosition = v% IDE_AutoPosition = v%
v% = o(4).sel v% = o(5).sel
IF v% <> 0 THEN v% = 1 IF v% <> 0 THEN v% = 1
idecustomfont = v% idecustomfont = v%
v$ = idetxt(o(5).txt) v$ = idetxt(o(6).txt)
IF LEN(v$) > 1024 THEN v$ = LEFT$(v$, 1024) IF LEN(v$) > 1024 THEN v$ = LEFT$(v$, 1024)
idecustomfontfile$ = v$ idecustomfontfile$ = v$
v$ = v$ + SPACE$(1024 - LEN(v$)) v$ = v$ + SPACE$(1024 - LEN(v$))
v$ = idetxt(o(6).txt): IF v$ = "" THEN v$ = "0" v$ = idetxt(o(7).txt): IF v$ = "" THEN v$ = "0"
v% = VAL(v$) v% = VAL(v$)
IF v% < 8 THEN v% = 8 IF v% < 8 THEN v% = 8
IF v% > 99 THEN v% = 99 IF v% > 99 THEN v% = 99
@ -11753,6 +11775,11 @@ FUNCTION idedisplaybox
ELSE ELSE
WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_CustomFont", "FALSE" WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_CustomFont", "FALSE"
END IF END IF
IF IDE_UseFont8 THEN
WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_UseFont8", "TRUE"
ELSE
WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_UseFont8", "FALSE"
END IF
IF IDE_AutoPosition THEN IF IDE_AutoPosition THEN
WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_AutoPosition", "TRUE" WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_AutoPosition", "TRUE"
ELSE ELSE