1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-06-26 17:10:38 +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$)
IF LEFT$(ncthisline$, 4) = "SUB " THEN isSF = 1
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 RIGHT$(ncthisline$, 7) = " STATIC" THEN
thisline$ = RTRIM$(LEFT$(thisline$, LEN(thisline$) - 7))
@ -698,19 +700,40 @@ DO
sfname$ = thisline$
END IF
'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?
'We'll also check for that:
for endSF_CHECK = idecy to iden
thisline$ = idegetline(endSF_CHECK)
'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$))
endedSF = 0
ncthisline$ = UCASE$(thisline$)
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$, 8) = "DECLARE " and INSTR(ncthisline$, " LIBRARY") > 0 THEN InsideDECLARE = -1: EXIT FOR
IF LEFT$(ncthisline$, 11) = "END DECLARE" THEN EXIT FOR
next
if endedSF = 0 then sfname$ = ""
EXIT FOR
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,
'and all that's left is a bunch of comments or $INCLUDES?
'We'll also check for that:
endedSF = 0
for endSF_CHECK = idecy to iden
thisline$ = idegetline(endSF_CHECK)
thisline$ = LTRIM$(RTRIM$(thisline$))
ncthisline$ = UCASE$(thisline$)
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$, 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
if endedSF = 0 then sfname$ = "" else exit for
end if
END IF
NEXT
@ -2004,6 +2027,7 @@ DO
IF lnks > 1 THEN
'clarify context
lnk$ = idef1box$(lnks$, lnks)
if lnk$ = "C" then goto ideloop
END IF
@ -2058,12 +2082,12 @@ DO
WikiParse a$
idehelp = 1
skipdisplay = 0
IdeSystem = 1 '***
IdeSystem = 3 'Standard qb45 behaviour. Allows for quick peek at help then ESC.
retval = 1: GOTO redraweverything2
END IF
WikiParse a$
IdeSystem = 1 '***
IdeSystem = 3 'Standard qb45 behaviour. Allows for quick peek at help then ESC.
GOTO specialchar
END IF 'lnks
@ -2598,17 +2622,29 @@ DO
END IF
IF KB = KEY_UP THEN
GOSUB selectcheck
idecy = idecy - 1
IF idecy < 1 THEN idecy = 1
GOTO specialchar
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
idecy = idecy - 1
IF idecy < 1 THEN idecy = 1
GOTO specialchar
END IF
END IF
IF KB = KEY_DOWN THEN
GOSUB selectcheck
idecy = idecy + 1
IF idecy > iden THEN idecy = iden
GOTO specialchar
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
idecy = idecy + 1
IF idecy < idesy THEN idecy = idesy
GOTO specialchar
END IF
END IF
IF mWHEEL THEN
@ -10331,6 +10367,9 @@ DO 'main loop
f$ = idetxt(o(1).stx)
idef1box$ = f$
EXIT FUNCTION
ELSEIF K$ = CHR$(27) THEN
idef1box$ = "C"
EXIT FUNCTION
END IF
'end of custom controls