mirror of
https://github.com/QB64Official/qb64.git
synced 2024-07-05 00:40:26 +00:00
Merge remote-tracking branch 'remotes/origin/idetweaks'
# Fixed Conflicts: # source/ide/ide_global.bas
This commit is contained in:
commit
99352ea125
|
@ -12,6 +12,7 @@ DIM SHARED MouseButtonSwapped AS _BYTE
|
|||
DIM SHARED PasteCursorAtEnd AS _BYTE
|
||||
DIM SHARED SaveExeWithSource AS _BYTE
|
||||
DIM SHARED IDEShowErrorsImmediately AS _BYTE
|
||||
DIM SHARED ShowLineNumbersSeparator AS _BYTE, ShowLineNumbersUseBG AS _BYTE
|
||||
|
||||
IF LoadedIDESettings = 0 THEN
|
||||
'We only want to load the file once when QB64 first starts
|
||||
|
@ -204,6 +205,45 @@ IF LoadedIDESettings = 0 THEN
|
|||
IDEShowErrorsImmediately = -1
|
||||
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("ShowLineNumbersSeparator", value$)
|
||||
IF result THEN
|
||||
IF value$ = "TRUE" OR VAL(value$) = -1 THEN
|
||||
ShowLineNumbersSeparator = -1
|
||||
ELSE
|
||||
ShowLineNumbersSeparator = 0
|
||||
WriteConfigSetting "'[GENERAL SETTINGS]", "ShowLineNumbersSeparator", "FALSE"
|
||||
END IF
|
||||
ELSE
|
||||
WriteConfigSetting "'[GENERAL SETTINGS]", "ShowLineNumbersSeparator", "TRUE"
|
||||
ShowLineNumbersSeparator = -1
|
||||
END IF
|
||||
|
||||
result = ReadConfigSetting("ShowLineNumbersUseBG", value$)
|
||||
IF result THEN
|
||||
IF value$ = "TRUE" OR VAL(value$) = -1 THEN
|
||||
ShowLineNumbersUseBG = -1
|
||||
ELSE
|
||||
ShowLineNumbersUseBG = 0
|
||||
WriteConfigSetting "'[GENERAL SETTINGS]", "ShowLineNumbersUseBG", "FALSE"
|
||||
END IF
|
||||
ELSE
|
||||
WriteConfigSetting "'[GENERAL SETTINGS]", "ShowLineNumbersUseBG", "TRUE"
|
||||
ShowLineNumbersUseBG = -1
|
||||
END IF
|
||||
|
||||
result = ReadConfigSetting("BracketHighlight", value$)
|
||||
IF result THEN
|
||||
IF value$ = "TRUE" OR VAL(value$) = -1 THEN
|
||||
|
|
|
@ -166,8 +166,9 @@ DIM SHARED ModifyCOMMAND$
|
|||
DIM SHARED EnteringRGB AS _BYTE
|
||||
DIM SHARED ActiveINCLUDELink AS LONG
|
||||
DIM SHARED ActiveINCLUDELinkFile AS STRING
|
||||
DIM SHARED HideCurrentLineHighlight AS _BYTE
|
||||
DIM SHARED idegotobox_LastLineNum AS LONG
|
||||
DIM SHARED HideCurrentLineHighlight AS _BYTE, ShowLineNumbers AS _BYTE
|
||||
DIM SHARED idegotobox_LastLineNum AS LONG, maxLineNumberLength AS LONG
|
||||
|
||||
'--------------------------------------------------------------------------------
|
||||
TYPE idedbptype
|
||||
x AS LONG
|
||||
|
@ -206,6 +207,7 @@ 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 ViewMenuID AS INTEGER, ViewMenuShowLineNumbers 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)
|
||||
|
|
|
@ -249,9 +249,16 @@ FUNCTION ide2 (ignore)
|
|||
ideeditmenuID = m
|
||||
IdeMakeEditMenu
|
||||
|
||||
m = m + 1: i = 0
|
||||
m = m + 1: i = 0: ViewMenuID = m
|
||||
menu$(m, i) = "View": 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
|
||||
|
||||
m = m + 1: i = 0
|
||||
|
@ -725,6 +732,7 @@ FUNCTION ide2 (ignore)
|
|||
'main loop
|
||||
DO
|
||||
ideloop:
|
||||
IF ShowLineNumbers THEN maxLineNumberLength = LEN(STR$(iden)) + 1 ELSE maxLineNumberLength = 0
|
||||
idecontextualmenu = 0
|
||||
idedeltxt 'removes temporary strings (typically created by guibox commands) by setting an index to 0
|
||||
IF idesubwindow <> 0 THEN _RESIZE OFF ELSE _RESIZE ON
|
||||
|
@ -2633,7 +2641,7 @@ FUNCTION ide2 (ignore)
|
|||
ideselecty1 = wholeword.selecty1
|
||||
idecy = wholeword.idecy
|
||||
END IF
|
||||
newposition = mX - 1 + idesx - 1
|
||||
newposition = (mX - 1 + idesx - 1) - maxLineNumberLength
|
||||
a$ = idegetline$(idecy)
|
||||
IF newposition > LEN(a$) THEN idecx = newposition: GOTO DoneWholeWord
|
||||
IF newposition = 1 THEN ideselectx1 = 1: GOTO DoneWholeWord
|
||||
|
@ -2659,11 +2667,11 @@ FUNCTION ide2 (ignore)
|
|||
END IF
|
||||
|
||||
IF mCLICK THEN
|
||||
IF mX > 1 AND mX < idewx AND mY > 2 AND mY < (idewy - 5) THEN 'inside text box
|
||||
IF mX > 1 + maxLineNumberLength AND mX < idewx AND mY > 2 AND mY < (idewy - 5) THEN 'inside text box
|
||||
IF old.mX = mX AND old.mY = mY THEN
|
||||
IF TIMER - last.TBclick# > .5 THEN GOTO regularTextBox_click
|
||||
'Double-click on text box: attempt to select "word" clicked
|
||||
idecx = mX - 1 + idesx - 1
|
||||
idecx = (mX - 1 + idesx - 1) - maxLineNumberLength
|
||||
idecy = mY - 2 + idesy - 1
|
||||
IF idecy > iden THEN
|
||||
GOTO regularTextBox_click
|
||||
|
@ -2754,13 +2762,33 @@ FUNCTION ide2 (ignore)
|
|||
regularTextBox_click:
|
||||
old.mX = mX: old.mY = mY: last.TBclick# = TIMER
|
||||
ideselect = 1
|
||||
idecx = mX - 1 + idesx - 1
|
||||
idecx = (mX - 1 + idesx - 1) - maxLineNumberLength
|
||||
idecy = mY - 2 + idesy - 1
|
||||
IF idecy > iden THEN idecy = iden
|
||||
ideselect = 1: ideselectx1 = idecx: ideselecty1 = idecy
|
||||
ideselect = 1
|
||||
IF (NOT KSHIFT) THEN ideselectx1 = idecx: ideselecty1 = idecy
|
||||
idemouseselect = 1
|
||||
wholeword.select = 0
|
||||
END IF
|
||||
ELSEIF mX > 1 AND mx =< 1 + maxLineNumberLength AND mY > 2 AND mY < (idewy - 5) AND ShowLineNumbers THEN
|
||||
'line numbers are visible and been clicked
|
||||
ideselect = 1
|
||||
idecy = mY - 2 + idesy - 1
|
||||
IF idecy < iden THEN
|
||||
IF (NOT KSHIFT) THEN ideselectx1 = 1: ideselecty1 = idecy
|
||||
idecy = idecy + 1
|
||||
idecx = 1
|
||||
ELSEIF idecy = iden THEN
|
||||
a$ = idegetline$(idecy)
|
||||
IF (NOT KSHIFT) THEN ideselectx1 = 1: ideselecty1 = idecy
|
||||
idecx = LEN(a$) + 1
|
||||
ELSEIF idecy > iden THEN
|
||||
idecy = iden
|
||||
ideselect = 0
|
||||
idecx = 1
|
||||
END IF
|
||||
wholeword.select = 0
|
||||
idemouseselect = 0
|
||||
END IF
|
||||
END IF
|
||||
|
||||
|
@ -2768,9 +2796,9 @@ FUNCTION ide2 (ignore)
|
|||
|
||||
IF mCLICK2 THEN 'Second mouse button pressed.
|
||||
invokecontextualmenu:
|
||||
IF mX > 1 AND mX < idewx AND mY > 2 AND mY < (idewy - 5) THEN 'inside text box
|
||||
IF mX > 1 + maxLineNumberLength AND mX < idewx AND mY > 2 AND mY < (idewy - 5) THEN 'inside text box
|
||||
IF ideselect = 0 THEN 'Right click only positions the cursor if no selection is active
|
||||
idecx = mX - 1 + idesx - 1
|
||||
idecx = (mX - 1 + idesx - 1) - maxLineNumberLength
|
||||
idecy = mY - 2 + idesy - 1
|
||||
IF idecy > iden THEN idecy = iden
|
||||
ELSE 'A selection is reported but it may be that the user only clicked the screen. Let's check:
|
||||
|
@ -2785,14 +2813,14 @@ FUNCTION ide2 (ignore)
|
|||
IF a2$ = "" THEN
|
||||
'Told ya.
|
||||
ideselect = 0
|
||||
idecx = mX - 1 + idesx - 1
|
||||
idecx = (mX - 1 + idesx - 1) - maxLineNumberLength
|
||||
idecy = mY - 2 + idesy - 1
|
||||
IF idecy > iden THEN idecy = iden
|
||||
ELSE
|
||||
'Ok, there is a selection. But we'll override it if the click was outside it
|
||||
IF mX - 1 + idesx - 1 < sx1 OR mX - 1 + idesx - 1 > sx2 THEN
|
||||
IF (mX - 1 + idesx - 1) - maxLineNumberLength < sx1 OR (mX - 1 + idesx - 1) - maxLineNumberLength > sx2 THEN
|
||||
ideselect = 0
|
||||
idecx = mX - 1 + idesx - 1
|
||||
idecx = (mX - 1 + idesx - 1) - maxLineNumberLength
|
||||
idecy = mY - 2 + idesy - 1
|
||||
IF idecy > iden THEN idecy = iden
|
||||
ideshowtext
|
||||
|
@ -2800,7 +2828,7 @@ FUNCTION ide2 (ignore)
|
|||
END IF
|
||||
IF mY - 2 + idesy - 1 < idecy OR mY - 2 + idesy - 1 > idecy THEN
|
||||
ideselect = 0
|
||||
idecx = mX - 1 + idesx - 1
|
||||
idecx = (mX - 1 + idesx - 1) - maxLineNumberLength
|
||||
idecy = mY - 2 + idesy - 1
|
||||
IF idecy > iden THEN idecy = iden
|
||||
ideshowtext
|
||||
|
@ -2814,7 +2842,7 @@ FUNCTION ide2 (ignore)
|
|||
IF sy1 > sy2 THEN SWAP sy1, sy2
|
||||
IF mY - 2 + idesy - 1 < sy1 OR mY - 2 + idesy - 1 > sy2 THEN
|
||||
ideselect = 0
|
||||
idecx = mX - 1 + idesx - 1
|
||||
idecx = (mX - 1 + idesx - 1) - maxLineNumberLength
|
||||
idecy = mY - 2 + idesy - 1
|
||||
IF idecy > iden THEN idecy = iden
|
||||
ideshowtext
|
||||
|
@ -2924,9 +2952,10 @@ FUNCTION ide2 (ignore)
|
|||
END IF
|
||||
|
||||
IF mB AND idemouseselect <= 1 THEN
|
||||
IF mX > 1 AND mX < idewx AND mY > 2 AND mY < idewy - 5 THEN 'inside text box
|
||||
IF mX > 1 + maxLineNumberLength AND mX < idewx AND mY > 2 AND mY < idewy - 5 THEN 'inside text box
|
||||
IF idemouseselect = 1 THEN
|
||||
idecx = mX - 1 + idesx - 1
|
||||
idecx = (mX - 1 + idesx - 1) - maxLineNumberLength
|
||||
IF idecx < 1 THEN idecx = 1
|
||||
idecy = mY - 2 + idesy - 1
|
||||
IF idecy > iden THEN idecy = iden
|
||||
END IF
|
||||
|
@ -2934,13 +2963,13 @@ FUNCTION ide2 (ignore)
|
|||
END IF
|
||||
|
||||
IF mB THEN
|
||||
IF mX = 1 OR mX = idewx OR mY <= 2 OR mY >= idewy - 5 THEN 'off text window area
|
||||
IF ((mX = 1 AND ShowLineNumbers = 0) OR (mX <= 1 + maxLineNumberLength AND ShowLineNumbers)) OR mX = idewx OR mY <= 2 OR mY >= idewy - 5 THEN 'off text window area
|
||||
IF idemouseselect = 1 THEN
|
||||
|
||||
'scroll window
|
||||
IF mY >= idewy - 5 THEN idecy = idecy + 1: IF idecy > iden THEN idecy = iden
|
||||
IF mY <= 2 THEN idecy = idecy - 1: IF idecy < 1 THEN idecy = 1
|
||||
IF mX = 1 THEN idecx = idecx - 1: IF idecx < 1 THEN idecx = 1
|
||||
IF ((mX = 1 AND ShowLineNumbers = 0) OR (mX <= 1 + maxLineNumberLength AND ShowLineNumbers)) THEN idecx = idecx - 1: IF idecx < 1 THEN idecx = 1
|
||||
IF mX = idewx THEN idecx = idecx + 1
|
||||
idewait
|
||||
END IF
|
||||
|
@ -4812,6 +4841,20 @@ FUNCTION ide2 (ignore)
|
|||
GOTO ideloop
|
||||
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
|
||||
PCOPY 2, 0
|
||||
idefindjmp:
|
||||
|
@ -8148,7 +8191,7 @@ SUB ideshowtext
|
|||
|
||||
IF idecx < idesx THEN idesx = idecx
|
||||
IF idecy < idesy THEN idesy = idecy
|
||||
IF idecx - idesx >= (idewx - 2) THEN idesx = idecx - (idewx - 3)
|
||||
IF (idecx + maxLineNumberLength) - idesx >= (idewx - 2) THEN idesx = (idecx + maxLineNumberLength) - (idewx - 3)
|
||||
IF idecy - idesy >= (idewy - 8) THEN idesy = idecy - (idewy - 9)
|
||||
|
||||
sy1 = ideselecty1
|
||||
|
@ -8205,6 +8248,21 @@ SUB ideshowtext
|
|||
LOCATE y + 3, 1
|
||||
COLOR 7, 1
|
||||
PRINT CHR$(179); 'clear prev bookmarks from lhs
|
||||
|
||||
IF ShowLineNumbers THEN
|
||||
IF ShowLineNumbersUseBG THEN COLOR , 6
|
||||
PRINT SPACE$(maxLineNumberLength);
|
||||
IF l <= iden THEN
|
||||
l2$ = STR$(l)
|
||||
IF POS(1) - (LEN(l2$) + 1) >= 2 THEN
|
||||
LOCATE y + 3, POS(1) - (LEN(l2$) + 1)
|
||||
PRINT l2$;
|
||||
END IF
|
||||
END IF
|
||||
IF ShowLineNumbersSeparator THEN LOCATE y + 3, 1 + maxLineNumberLength: PRINT CHR$(179);
|
||||
COLOR , 1
|
||||
END IF
|
||||
|
||||
IF l = idefocusline AND idecy <> l THEN
|
||||
COLOR 7, 4 'Line with error gets a red background
|
||||
ELSEIF idecy = l OR (l >= idecy_multilinestart AND l <= idecy_multilineend) THEN
|
||||
|
@ -8218,7 +8276,7 @@ SUB ideshowtext
|
|||
link_idecx = 0
|
||||
rgb_idecx = 0
|
||||
IF l = idecy THEN
|
||||
IF idecx <= LEN(a$) THEN
|
||||
IF idecx <= LEN(a$) AND idecx >= 1 THEN
|
||||
cc = ASC(a$, idecx)
|
||||
IF cc = 32 THEN
|
||||
IF LTRIM$(LEFT$(a$, idecx)) = "" THEN cc = -1
|
||||
|
@ -8339,7 +8397,6 @@ SUB ideshowtext
|
|||
|
||||
a2$ = SPACE$(idesx + (idewx - 3))
|
||||
MID$(a2$, 1) = a$
|
||||
'a2$ = RIGHT$(a2$, (idewx - 2))
|
||||
ELSE
|
||||
a2$ = SPACE$((idewx - 2))
|
||||
END IF
|
||||
|
@ -8525,9 +8582,16 @@ SUB ideshowtext
|
|||
LOOP ' verifying the code and growing the array during the IDE passes.
|
||||
IF InValidLine(l) AND 1 THEN COLOR 7
|
||||
|
||||
IF 2 + m - idesx >= 2 AND 2 + m - idesx < idewx THEN
|
||||
LOCATE y + 3, 2 + m - idesx
|
||||
PRINT thisChar$;
|
||||
IF ShowLineNumbers THEN
|
||||
IF (2 + m - idesx) + maxLineNumberLength >= 2 + maxLineNumberLength AND (2 + m - idesx) + maxLineNumberLength < idewx THEN
|
||||
LOCATE y + 3, (2 + m - idesx) + maxLineNumberLength
|
||||
PRINT thisChar$;
|
||||
END IF
|
||||
ELSE
|
||||
IF 2 + m - idesx >= 2 AND 2 + m - idesx < idewx THEN
|
||||
LOCATE y + 3, 2 + m - idesx
|
||||
PRINT thisChar$;
|
||||
END IF
|
||||
END IF
|
||||
|
||||
'Restore BG color in case a matching bracket was printed with different BG
|
||||
|
@ -8542,7 +8606,7 @@ SUB ideshowtext
|
|||
IF sy1 = sy2 THEN 'single line select
|
||||
COLOR 1, 7
|
||||
x2 = idesx
|
||||
FOR x = 2 TO (idewx - 2)
|
||||
FOR x = 2 + maxLineNumberLength TO (idewx - 2)
|
||||
IF x2 >= sx1 AND x2 < sx2 THEN
|
||||
a = SCREEN(y + 3, x)
|
||||
|
||||
|
@ -8566,10 +8630,10 @@ SUB ideshowtext
|
|||
COLOR 7, 1
|
||||
ELSE 'multiline select
|
||||
IF idecx = 1 AND l = sy2 AND idecy > sy1 THEN GOTO nofinalselect
|
||||
LOCATE y + 3, 2
|
||||
LOCATE y + 3, 2 + maxLineNumberLength
|
||||
COLOR 1, 7
|
||||
|
||||
FOR x = idesx TO idesx + idewx - 2
|
||||
FOR x = idesx TO idesx + idewx - (2 + maxLineNumberLength)
|
||||
PRINT MID$(a2$, x, 1);
|
||||
NEXT
|
||||
|
||||
|
@ -8606,7 +8670,7 @@ SUB ideshowtext
|
|||
LOCATE idewy + idesubwindow, (idewx - 10) - LEN(a$)
|
||||
PRINT a$;
|
||||
|
||||
SCREEN , , 0, 0: LOCATE idecy - idesy + 3, idecx - idesx + 2: SCREEN , , 3, 0
|
||||
SCREEN , , 0, 0: LOCATE idecy - idesy + 3, maxLineNumberLength + idecx - idesx + 2: SCREEN , , 3, 0
|
||||
|
||||
EXIT SUB
|
||||
FindQuoteComment:
|
||||
|
@ -13552,7 +13616,7 @@ SUB IdeMakeContextualMenu
|
|||
a$ = idegetline(idecy)
|
||||
a2$ = ""
|
||||
x = idecx
|
||||
IF x <= LEN(a$) THEN
|
||||
IF x <= LEN(a$) AND x >= 1 THEN
|
||||
IF alphanumeric(ASC(a$, x)) THEN
|
||||
x1 = x
|
||||
DO WHILE x1 > 1
|
||||
|
|
Loading…
Reference in a new issue