mirror of
https://github.com/QB64Official/qb64.git
synced 2024-08-22 11:25:08 +00:00
Add option to toggle Line Numbers from View menu. Also:
- Align line numbers to right; - Highlight line number of current line;
This commit is contained in:
parent
ce9a0c07c6
commit
88d6911ec9
3 changed files with 52 additions and 10 deletions
|
@ -191,6 +191,19 @@ IF LoadedIDESettings = 0 THEN
|
||||||
IDEShowErrorsImmediately = -1
|
IDEShowErrorsImmediately = -1
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
|
result = ReadConfigSetting("ShowLineNumbers", value$)
|
||||||
|
IF result THEN
|
||||||
|
IF value$ = "TRUE" OR VAL(value$) = -1 THEN
|
||||||
|
ShowLineNumbers = -1
|
||||||
|
ELSE
|
||||||
|
ShowLineNumbers = 0
|
||||||
|
WriteConfigSetting "'[GENERAL SETTINGS]", "ShowLineNumbers", "FALSE"
|
||||||
|
END IF
|
||||||
|
ELSE
|
||||||
|
WriteConfigSetting "'[GENERAL SETTINGS]", "ShowLineNumbers", "FALSE"
|
||||||
|
ShowLineNumbers = 0
|
||||||
|
END IF
|
||||||
|
|
||||||
result = ReadConfigSetting("BracketHighlight", value$)
|
result = ReadConfigSetting("BracketHighlight", value$)
|
||||||
IF result THEN
|
IF result THEN
|
||||||
IF value$ = "TRUE" OR VAL(value$) = -1 THEN
|
IF value$ = "TRUE" OR VAL(value$) = -1 THEN
|
||||||
|
|
|
@ -166,7 +166,7 @@ DIM SHARED ModifyCOMMAND$
|
||||||
DIM SHARED EnteringRGB AS _BYTE
|
DIM SHARED EnteringRGB AS _BYTE
|
||||||
DIM SHARED ActiveINCLUDELink AS LONG
|
DIM SHARED ActiveINCLUDELink AS LONG
|
||||||
DIM SHARED ActiveINCLUDELinkFile AS STRING
|
DIM SHARED ActiveINCLUDELinkFile AS STRING
|
||||||
DIM SHARED HideCurrentLineHighlight AS _BYTE
|
DIM SHARED HideCurrentLineHighlight AS _BYTE, ShowLineNumbers AS _BYTE
|
||||||
'--------------------------------------------------------------------------------
|
'--------------------------------------------------------------------------------
|
||||||
TYPE idedbptype
|
TYPE idedbptype
|
||||||
x AS LONG
|
x AS LONG
|
||||||
|
@ -205,6 +205,7 @@ DIM SHARED menus AS INTEGER, idecontextualmenuID AS INTEGER
|
||||||
DIM SHARED ideeditmenuID AS INTEGER
|
DIM SHARED ideeditmenuID AS INTEGER
|
||||||
DIM SHARED OptionsMenuID AS INTEGER, OptionsMenuSwapMouse AS INTEGER, OptionsMenuPasteCursor AS INTEGER
|
DIM SHARED OptionsMenuID AS INTEGER, OptionsMenuSwapMouse AS INTEGER, OptionsMenuPasteCursor AS INTEGER
|
||||||
DIM SHARED OptionsMenuShowErrorsImmediately AS INTEGER
|
DIM SHARED OptionsMenuShowErrorsImmediately AS INTEGER
|
||||||
|
DIM SHARED ViewMenuID AS INTEGER, ViewMenuShowLineNumbers AS INTEGER
|
||||||
DIM SHARED RunMenuID AS INTEGER, RunMenuSaveExeWithSource AS INTEGER, brackethighlight AS INTEGER
|
DIM SHARED RunMenuID AS INTEGER, RunMenuSaveExeWithSource AS INTEGER, brackethighlight AS INTEGER
|
||||||
DIM SHARED multihighlight AS INTEGER, keywordHighlight AS INTEGER
|
DIM SHARED multihighlight AS INTEGER, keywordHighlight AS INTEGER
|
||||||
DIM SHARED PresetColorSchemes AS INTEGER, TotalColorSchemes AS INTEGER, ColorSchemes$(0)
|
DIM SHARED PresetColorSchemes AS INTEGER, TotalColorSchemes AS INTEGER, ColorSchemes$(0)
|
||||||
|
|
|
@ -249,9 +249,16 @@ FUNCTION ide2 (ignore)
|
||||||
ideeditmenuID = m
|
ideeditmenuID = m
|
||||||
IdeMakeEditMenu
|
IdeMakeEditMenu
|
||||||
|
|
||||||
m = m + 1: i = 0
|
m = m + 1: i = 0: ViewMenuID = m
|
||||||
menu$(m, i) = "View": i = i + 1
|
menu$(m, i) = "View": i = i + 1
|
||||||
menu$(m, i) = "#SUBs... F2": i = i + 1
|
menu$(m, i) = "#SUBs... F2": i = i + 1
|
||||||
|
|
||||||
|
ViewMenuShowLineNumbers = i
|
||||||
|
menu$(m, i) = "#Line numbers": i = i + 1
|
||||||
|
IF ShowLineNumbers THEN
|
||||||
|
menu$(ViewMenuID, ViewMenuShowLineNumbers) = CHR$(7) + menu$(ViewMenuID, ViewMenuShowLineNumbers)
|
||||||
|
END IF
|
||||||
|
|
||||||
menusize(m) = i - 1
|
menusize(m) = i - 1
|
||||||
|
|
||||||
m = m + 1: i = 0
|
m = m + 1: i = 0
|
||||||
|
@ -4810,6 +4817,20 @@ FUNCTION ide2 (ignore)
|
||||||
GOTO ideloop
|
GOTO ideloop
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
|
IF RIGHT$(menu$(m, s), 13) = "#Line numbers" THEN
|
||||||
|
PCOPY 2, 0
|
||||||
|
ShowLineNumbers = NOT ShowLineNumbers
|
||||||
|
IF ShowLineNumbers THEN
|
||||||
|
WriteConfigSetting "'[GENERAL SETTINGS]", "ShowLineNumbers", "TRUE"
|
||||||
|
menu$(ViewMenuID, ViewMenuShowLineNumbers) = CHR$(7) + "#Line numbers"
|
||||||
|
ELSE
|
||||||
|
WriteConfigSetting "'[GENERAL SETTINGS]", "ShowLineNumbers", "FALSE"
|
||||||
|
menu$(ViewMenuID, ViewMenuShowLineNumbers) = "#Line numbers"
|
||||||
|
END IF
|
||||||
|
PCOPY 3, 0: SCREEN , , 3, 0: idewait4mous: idewait4alt
|
||||||
|
GOTO ideloop
|
||||||
|
END IF
|
||||||
|
|
||||||
IF menu$(m, s) = "#Find... Ctrl+F3" THEN
|
IF menu$(m, s) = "#Find... Ctrl+F3" THEN
|
||||||
PCOPY 2, 0
|
PCOPY 2, 0
|
||||||
idefindjmp:
|
idefindjmp:
|
||||||
|
@ -8202,16 +8223,17 @@ SUB ideshowtext
|
||||||
FOR y = 0 TO (idewy - 9)
|
FOR y = 0 TO (idewy - 9)
|
||||||
LOCATE y + 3, 1
|
LOCATE y + 3, 1
|
||||||
COLOR 7, 1
|
COLOR 7, 1
|
||||||
|
l$ = SPACE$(LEN(STR$(iden)) + 1)
|
||||||
PRINT CHR$(179); 'clear prev bookmarks from lhs
|
PRINT CHR$(179); 'clear prev bookmarks from lhs
|
||||||
|
IF l = idecy THEN COLOR , 6
|
||||||
|
PRINT l$;
|
||||||
|
|
||||||
IF l <= iden THEN
|
IF l <= iden AND ShowLineNumbers THEN
|
||||||
LOCATE y + 3, 2
|
l$ = STR$(l)
|
||||||
l$ = SPACE$(LEN(STR$(iden)) + 2)
|
LOCATE y + 3, POS(1) - (LEN(l$) + 1)
|
||||||
MID$(l$, 1) = STR$(l)
|
|
||||||
PRINT l$;
|
PRINT l$;
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
|
|
||||||
IF l = idefocusline AND idecy <> l THEN
|
IF l = idefocusline AND idecy <> l THEN
|
||||||
COLOR 7, 4 'Line with error gets a red background
|
COLOR 7, 4 'Line with error gets a red background
|
||||||
ELSEIF idecy = l OR (l >= idecy_multilinestart AND l <= idecy_multilineend) THEN
|
ELSEIF idecy = l OR (l >= idecy_multilinestart AND l <= idecy_multilineend) THEN
|
||||||
|
@ -8532,10 +8554,16 @@ SUB ideshowtext
|
||||||
LOOP ' verifying the code and growing the array during the IDE passes.
|
LOOP ' verifying the code and growing the array during the IDE passes.
|
||||||
IF InValidLine(l) AND 1 THEN COLOR 7
|
IF InValidLine(l) AND 1 THEN COLOR 7
|
||||||
|
|
||||||
IF 2 + m - idesx >= 2 AND (2 + m - idesx) + LEN(STR$(iden)) + 2 < idewx - 1 THEN
|
IF ShowLineNumbers THEN
|
||||||
LOCATE y + 3, (2 + m - idesx) + LEN(STR$(iden)) + 2
|
IF 2 + m - idesx >= 2 AND (2 + m - idesx) + LEN(STR$(iden)) + 1 < idewx - 1 THEN
|
||||||
PRINT thisChar$;
|
LOCATE y + 3, (2 + m - idesx) + LEN(STR$(iden)) + 1
|
||||||
END IF
|
END IF
|
||||||
|
ELSE
|
||||||
|
IF 2 + m - idesx >= 2 AND 2 + m - idesx < idewx THEN
|
||||||
|
LOCATE y + 3, 2 + m - idesx
|
||||||
|
END IF
|
||||||
|
END IF
|
||||||
|
PRINT thisChar$;
|
||||||
|
|
||||||
'Restore BG color in case a matching bracket was printed with different BG
|
'Restore BG color in case a matching bracket was printed with different BG
|
||||||
IF l = idecy THEN COLOR , 6
|
IF l = idecy THEN COLOR , 6
|
||||||
|
|
Loading…
Reference in a new issue