1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-07-01 13:50:36 +00:00

Main window improvements.

- Place cursor inside the help window when it's first invoked (allows for quick peek and ESC to close the help window).
- Allow ESC to close the dialog (named "Which?"), used to clarify the help context.
- Allow CTRL+UP or DOWN to scroll the window by one line at a time, without moving the cursor.

- Fix quick link feature (F2) to recognize FUNCTION names ending with single or multiple sigils.
- Fix external procedures being considered local and placed in front of program name.
This commit is contained in:
FellippeHeitor 2016-01-04 21:42:02 -02:00
parent debc1e9792
commit ac1fc6c794

View file

@ -680,6 +680,8 @@ DO
ncthisline$ = UCASE$(thisline$) ncthisline$ = UCASE$(thisline$)
IF LEFT$(ncthisline$, 4) = "SUB " THEN isSF = 1 IF LEFT$(ncthisline$, 4) = "SUB " THEN isSF = 1
IF LEFT$(ncthisline$, 9) = "FUNCTION " THEN isSF = 2 IF LEFT$(ncthisline$, 9) = "FUNCTION " THEN isSF = 2
IF LEFT$(ncthisline$, 7) = "END SUB" and currSF_CHECK < idecy THEN EXIT FOR
IF LEFT$(ncthisline$, 12) = "END FUNCTION" and currSF_CHECK < idecy THEN EXIT FOR
IF isSF THEN IF isSF THEN
IF RIGHT$(ncthisline$, 7) = " STATIC" THEN IF RIGHT$(ncthisline$, 7) = " STATIC" THEN
thisline$ = RTRIM$(LEFT$(thisline$, LEN(thisline$) - 7)) thisline$ = RTRIM$(LEFT$(thisline$, LEN(thisline$) - 7))
@ -698,19 +700,40 @@ DO
sfname$ = thisline$ sfname$ = thisline$
END IF END IF
'It could be that SUB or FUNCTION is inside a DECLARE LIBRARY.
'In such case, it must be ignored:
InsideDECLARE = 0
for declib_CHECK = currSF_CHECK to 1 step -1
thisline$ = idegetline(declib_CHECK)
thisline$ = LTRIM$(RTRIM$(thisline$))
ncthisline$ = UCASE$(thisline$)
IF LEFT$(ncthisline$, 8) = "DECLARE " and INSTR(ncthisline$, " LIBRARY") > 0 THEN InsideDECLARE = -1: EXIT FOR
IF LEFT$(ncthisline$, 11) = "END DECLARE" THEN EXIT FOR
next
if InsideDECLARE = -1 then
sfname$ = ""
else
'Ok, we're not inside a DECLARE LIBRARY.
'But what if we're past the end of this module's SUBs and FUNCTIONs, 'But what if we're past the end of this module's SUBs and FUNCTIONs,
'and all that's left is a bunch of comments or $INCLUDES? 'and all that's left is a bunch of comments or $INCLUDES?
'We'll also check for that: 'We'll also check for that:
endedSF = 0
for endSF_CHECK = idecy to iden for endSF_CHECK = idecy to iden
thisline$ = idegetline(endSF_CHECK) thisline$ = idegetline(endSF_CHECK)
thisline$ = LTRIM$(RTRIM$(thisline$)) thisline$ = LTRIM$(RTRIM$(thisline$))
endedSF = 0
ncthisline$ = UCASE$(thisline$) ncthisline$ = UCASE$(thisline$)
IF LEFT$(ncthisline$, 7) = "END SUB" THEN endedSF = 1: EXIT FOR IF LEFT$(ncthisline$, 7) = "END SUB" THEN endedSF = 1: EXIT FOR
IF LEFT$(ncthisline$, 12) = "END FUNCTION" THEN endedSF = 2: EXIT FOR IF LEFT$(ncthisline$, 12) = "END FUNCTION" THEN endedSF = 2: EXIT FOR
IF LEFT$(ncthisline$, 4) = "SUB " AND endSF_CHECK = idecy THEN endedSF = 1: EXIT FOR
IF LEFT$(ncthisline$, 9) = "FUNCTION " AND endSF_CHECK = idecy THEN endedSF = 2: EXIT FOR
IF LEFT$(ncthisline$, 4) = "SUB " AND InsideDECLARE = 0 THEN EXIT FOR
IF LEFT$(ncthisline$, 9) = "FUNCTION " AND InsideDECLARE = 0 THEN EXIT FOR
IF LEFT$(ncthisline$, 8) = "DECLARE " and INSTR(ncthisline$, " LIBRARY") > 0 THEN InsideDECLARE = -1
IF LEFT$(ncthisline$, 11) = "END DECLARE" THEN InsideDECLARE = 0
next next
if endedSF = 0 then sfname$ = "" if endedSF = 0 then sfname$ = "" else exit for
EXIT FOR end if
END IF END IF
NEXT NEXT
@ -2004,6 +2027,7 @@ DO
IF lnks > 1 THEN IF lnks > 1 THEN
'clarify context 'clarify context
lnk$ = idef1box$(lnks$, lnks) lnk$ = idef1box$(lnks$, lnks)
if lnk$ = "C" then goto ideloop
END IF END IF
@ -2058,12 +2082,12 @@ DO
WikiParse a$ WikiParse a$
idehelp = 1 idehelp = 1
skipdisplay = 0 skipdisplay = 0
IdeSystem = 1 '*** IdeSystem = 3 'Standard qb45 behaviour. Allows for quick peek at help then ESC.
retval = 1: GOTO redraweverything2 retval = 1: GOTO redraweverything2
END IF END IF
WikiParse a$ WikiParse a$
IdeSystem = 1 '*** IdeSystem = 3 'Standard qb45 behaviour. Allows for quick peek at help then ESC.
GOTO specialchar GOTO specialchar
END IF 'lnks END IF 'lnks
@ -2598,18 +2622,30 @@ DO
END IF END IF
IF KB = KEY_UP THEN IF KB = KEY_UP THEN
IF KCONTROL THEN 'scroll the window, instead of moving the cursor
idesy = idesy - 1
if idesy < 1 then idesy = 1
if idecy > idesy + (idewy - 9) then idecy = idesy + (idewy - 9)
ELSE
GOSUB selectcheck GOSUB selectcheck
idecy = idecy - 1 idecy = idecy - 1
IF idecy < 1 THEN idecy = 1 IF idecy < 1 THEN idecy = 1
GOTO specialchar GOTO specialchar
END IF END IF
END IF
IF KB = KEY_DOWN THEN IF KB = KEY_DOWN THEN
IF KCONTROL THEN 'scroll the window, instead of moving the cursor
idesy = idesy + 1
if idesy > iden then idesy = iden
if idecy < idesy then idecy = idesy
ELSE
GOSUB selectcheck GOSUB selectcheck
idecy = idecy + 1 idecy = idecy + 1
IF idecy > iden THEN idecy = iden IF idecy < idesy THEN idecy = idesy
GOTO specialchar GOTO specialchar
END IF END IF
END IF
IF mWHEEL THEN IF mWHEEL THEN
GOSUB selectcheck GOSUB selectcheck
@ -10331,6 +10367,9 @@ DO 'main loop
f$ = idetxt(o(1).stx) f$ = idetxt(o(1).stx)
idef1box$ = f$ idef1box$ = f$
EXIT FUNCTION EXIT FUNCTION
ELSEIF K$ = CHR$(27) THEN
idef1box$ = "C"
EXIT FUNCTION
END IF END IF
'end of custom controls 'end of custom controls