1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-06-29 09:20:38 +00:00

New Debug menu

The IDE now offers to add  when the user attempts to set a breakpoint.
This commit is contained in:
Fellippe Heitor 2021-07-15 23:57:54 -03:00
parent 5f3075ec3e
commit 16b2c82b2f
2 changed files with 79 additions and 37 deletions

View file

@ -19,6 +19,8 @@ DIM SHARED IdeSystem AS LONG
'3=Scrolling within the help window '3=Scrolling within the help window
IdeSystem = 1 IdeSystem = 1
DIM SHARED IdeDebugMode AS LONG
DIM SHARED IdeRecentLink(1 TO 6, 1 TO 2) AS STRING DIM SHARED IdeRecentLink(1 TO 6, 1 TO 2) AS STRING
DIM SHARED IdeOpenFile AS STRING 'makes IdeOpen directly open the file passed DIM SHARED IdeOpenFile AS STRING 'makes IdeOpen directly open the file passed
@ -201,9 +203,9 @@ END TYPE
DIM SHARED idefocusline 'simply stores the location of the line to highlight in red DIM SHARED idefocusline 'simply stores the location of the line to highlight in red
DIM SHARED idecompilererrormessage$ DIM SHARED idecompilererrormessage$
DIM SHARED ideautorun, startPaused DIM SHARED ideautorun, startPaused
DIM SHARED menu$(1 TO 10, 0 TO 20) DIM SHARED menu$(1 TO 11, 0 TO 20)
DIM SHARED menuDesc$(1 TO 10, 0 TO 20) DIM SHARED menuDesc$(1 TO 11, 0 TO 20)
DIM SHARED menusize(1 TO 10) DIM SHARED menusize(1 TO 11)
DIM SHARED menus AS INTEGER, idecontextualmenuID AS INTEGER DIM SHARED menus AS INTEGER, idecontextualmenuID AS INTEGER
DIM SHARED ideeditmenuID AS INTEGER, SearchMenuID AS INTEGER DIM SHARED ideeditmenuID AS INTEGER, SearchMenuID AS INTEGER
DIM SHARED OptionsMenuID AS INTEGER, OptionsMenuSwapMouse AS INTEGER, OptionsMenuPasteCursor AS INTEGER DIM SHARED OptionsMenuID AS INTEGER, OptionsMenuSwapMouse AS INTEGER, OptionsMenuPasteCursor AS INTEGER

View file

@ -326,7 +326,14 @@ FUNCTION ide2 (ignore)
menu$(m, i) = "Make E#XE Only F11": i = i + 1 menu$(m, i) = "Make E#XE Only F11": i = i + 1
END IF END IF
menuDesc$(m, i - 1) = "Compiles current program without running it" menuDesc$(m, i - 1) = "Compiles current program without running it"
menusize(m) = i - 1
m = m + 1: i = 0
menu$(m, i) = "Debug": i = i + 1
menu$(m, i) = "Toggle #Breakpoint F9": i = i + 1
menuDesc$(m, i - 1) = "Sets/clears breakpoint at cursor location"
menu$(m, i) = "#Clear All Breakpoints F10": i = i + 1
menuDesc$(m, i - 1) = "Removes all breakpoints"
menusize(m) = i - 1 menusize(m) = i - 1
m = m + 1: i = 0: OptionsMenuID = m m = m + 1: i = 0: OptionsMenuID = m
@ -398,7 +405,6 @@ FUNCTION ide2 (ignore)
menuDesc$(m, i - 1) = "Allows mixing colors to edit/insert _RGB statements" menuDesc$(m, i - 1) = "Allows mixing colors to edit/insert _RGB statements"
menusize(m) = i - 1 menusize(m) = i - 1
m = m + 1: i = 0 m = m + 1: i = 0
menu$(m, i) = "Help": i = i + 1 menu$(m, i) = "Help": i = i + 1
menu$(m, i) = "#View Shift+F1": i = i + 1 menu$(m, i) = "#View Shift+F1": i = i + 1
@ -684,9 +690,17 @@ FUNCTION ide2 (ignore)
IF c$ = CHR$(254) THEN IF c$ = CHR$(254) THEN
'$DEBUG mode on '$DEBUG mode on
IdeDebugMode = 1
EnterDebugMode:
idecompiling = 0 idecompiling = 0
ready = 1 ready = 1
DebugMode DebugMode
SELECT CASE IdeDebugMode
CASE 1
IdeDebugMode = 0
END SELECT
COLOR 0, 7: _PRINTSTRING (1, 1), menubar$
GOTO ideloop GOTO ideloop
END IF END IF
@ -1532,9 +1546,7 @@ FUNCTION ide2 (ignore)
END IF END IF
IF KB = KEY_F9 THEN 'toggle breakpoint IF KB = KEY_F9 THEN 'toggle breakpoint
IF vWatchOn THEN GOTO toggleBreakpoint
IdeBreakpoints(idecy) = NOT IdeBreakpoints(idecy)
END IF
END IF END IF
IF KB = KEY_F11 THEN 'make exe only IF KB = KEY_F11 THEN 'make exe only
@ -2904,25 +2916,15 @@ FUNCTION ide2 (ignore)
idemouseselect = 1 idemouseselect = 1
wholeword.select = 0 wholeword.select = 0
END IF END IF
ELSEIF mX > 1 AND mX <= 1 + maxLineNumberLength AND mY > 2 AND mY < (idewy - 5) AND ShowLineNumbers THEN ELSEIF (mX > 1 AND mX <= 1 + maxLineNumberLength AND mY > 2 AND mY < (idewy - 5) AND ShowLineNumbers) OR _
'line numbers are visible and have been clicked (mX = 1 AND mY > 2 AND mY < (idewy - 5) AND ShowLineNumbers = 0) THEN
IF vWatchOn THEN 'line numbers are visible and have been clicked or
ideselect = 0
idecytemp = mY - 2 + idesy - 1
IF idecytemp =< iden THEN
idecy = idecytemp
IdeBreakpoints(idecy) = NOT IdeBreakpoints(idecy)
END IF
END IF
ELSEIF mX = 1 AND mY > 2 AND mY < (idewy - 5) AND ShowLineNumbers = 0 THEN
'line numbers are hidden and the left border has been clicked 'line numbers are hidden and the left border has been clicked
IF vWatchOn THEN ideselect = 0
ideselect = 0 idecytemp = mY - 2 + idesy - 1
idecytemp = mY - 2 + idesy - 1 IF idecytemp =< iden THEN
IF idecytemp =< iden THEN idecy = idecytemp
idecy = idecytemp GOTO toggleBreakpoint
IdeBreakpoints(idecy) = NOT IdeBreakpoints(idecy)
END IF
END IF END IF
END IF END IF
END IF END IF
@ -5556,6 +5558,30 @@ FUNCTION ide2 (ignore)
GOTO idemexe GOTO idemexe
END IF END IF
IF menu$(m, s) = "Toggle #Breakpoint F9" THEN
PCOPY 3, 0: SCREEN , , 3, 0
toggleBreakpoint:
IF vWatchOn = 0 THEN
result = idemessagebox("Toggle Breakpoint", "Insert $DEBUG metacommand?", "#Yes;#No")
IF result = 1 THEN
ideselect = 0
ideinsline 1, SCase$("$Debug")
idecy = idecy + 1
idechangemade = 1
IdeBreakpoints(idecy) = NOT IdeBreakpoints(idecy)
END IF
ELSE
IdeBreakpoints(idecy) = NOT IdeBreakpoints(idecy)
END IF
GOTO ideloop
END IF
IF menu$(m, s) = "#Clear All Breakpoints F10" THEN
PCOPY 3, 0: SCREEN , , 3, 0
REDIM IdeBreakpoints(iden) AS _BYTE
GOTO ideloop
END IF
IF menu$(m, s) = "E#xit" THEN IF menu$(m, s) = "E#xit" THEN
PCOPY 2, 0 PCOPY 2, 0
quickexit: quickexit:
@ -5990,13 +6016,19 @@ FUNCTION ide2 (ignore)
END FUNCTION END FUNCTION
SUB DebugMode SUB DebugMode
DIM PauseMode AS _BYTE STATIC PauseMode AS _BYTE
timeout = 10 timeout = 10
_KEYCLEAR _KEYCLEAR
IF IdeDebugMode = 1 THEN PauseMode = 0
SCREEN , , 3, 0 SCREEN , , 3, 0
COLOR 0, 7: _PRINTSTRING (1, 1), SPACE$(LEN(menubar$))
m$ = "$DEBUG MODE ACTIVE"
COLOR 2
_PRINTSTRING ((idewx - LEN(m$)) \ 2, 1), m$
dummy = DarkenFGBG(1) dummy = DarkenFGBG(1)
clearStatusWindow 0 clearStatusWindow 0
setStatusMessage 1, "Entering $DEBUG mode (ESC to abort)...", 15 setStatusMessage 1, "Entering $DEBUG mode (ESC to abort)...", 15
@ -6140,15 +6172,18 @@ SUB DebugMode
ELSE ELSE
IF mouseDown THEN IF mouseDown THEN
IF mouseDownOnX = mX AND mouseDownOnY = mY THEN IF mouseDownOnX = mX AND mouseDownOnY = mY THEN
ideselect = 0 IF (mX > 1 AND mX <= 1 + maxLineNumberLength AND mY > 2 AND mY < (idewy - 5) AND ShowLineNumbers) OR _
idecytemp = mY - 2 + idesy - 1 (mX = 1 AND mY > 2 AND mY < (idewy - 5) AND ShowLineNumbers = 0) THEN
IF idecytemp =< iden THEN ideselect = 0
IdeBreakpoints(idecytemp) = NOT IdeBreakpoints(idecytemp) idecytemp = mY - 2 + idesy - 1
IF IdeBreakpoints(idecytemp) THEN cmd$ = "set breakpoint:" ELSE cmd$ = "clear breakpoint:" IF idecytemp =< iden THEN
cmd$ = cmd$ + MKL$(idecytemp) IdeBreakpoints(idecytemp) = NOT IdeBreakpoints(idecytemp)
GOSUB SendCommand IF IdeBreakpoints(idecytemp) THEN cmd$ = "set breakpoint:" ELSE cmd$ = "clear breakpoint:"
ideshowtext cmd$ = cmd$ + MKL$(idecytemp)
PCOPY 3, 0 GOSUB SendCommand
ideshowtext
PCOPY 3, 0
END IF
END IF END IF
END IF END IF
END IF END IF
@ -7651,6 +7686,12 @@ SUB ideinsline (i, text$)
END IF END IF
NEXT NEXT
REDIM _PRESERVE IdeBreakpoints(iden + 1) AS _BYTE
FOR b = iden + 1 TO i STEP -1
SWAP IdeBreakpoints(b), IdeBreakpoints(b - 1)
NEXT
IdeBreakpoints(i) = 0
text$ = RTRIM$(text$) text$ = RTRIM$(text$)
IF i = -1 THEN i = idel IF i = -1 THEN i = idel
@ -7664,7 +7705,6 @@ SUB ideinsline (i, text$)
textlen = LEN(text$) textlen = LEN(text$)
idet$ = LEFT$(idet$, ideli - 1) + MKL$(textlen) + text$ + MKL$(textlen) + RIGHT$(idet$, LEN(idet$) - ideli + 1) idet$ = LEFT$(idet$, ideli - 1) + MKL$(textlen) + text$ + MKL$(textlen) + RIGHT$(idet$, LEN(idet$) - ideli + 1)
iden = iden + 1 iden = iden + 1
REDIM _PRESERVE IdeBreakpoints(iden) AS _BYTE
END SUB END SUB
FUNCTION ideinputbox$(title$, caption$, initialvalue$, validinput$, boxwidth, maxlength) FUNCTION ideinputbox$(title$, caption$, initialvalue$, validinput$, boxwidth, maxlength)