mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-07-10 15:55:13 +00:00
Incorporate additions to SUB list dialog (F2) and inner title bar, and fix ASCII picker.
-ASCII picker restores font upon exit -SUB dialog preselects a sub if its name is selected by the cursor in the main window
This commit is contained in:
commit
f8fea42a29
|
@ -708,12 +708,22 @@ DO
|
||||||
END IF
|
END IF
|
||||||
NEXT
|
NEXT
|
||||||
|
|
||||||
|
'attempt to cleanse sfname$, just in case there are any comments or other unwanted stuff
|
||||||
|
for CleanseSFNAME = 1 to len(sfname$)
|
||||||
|
select case mid$(sfname$, CleanseSFNAME, 1)
|
||||||
|
case " ", "'", ":"
|
||||||
|
sfname$ = left$(sfname$, CleanseSFNAME - 1)
|
||||||
|
exit for
|
||||||
|
end select
|
||||||
|
next
|
||||||
|
|
||||||
'update title of main window
|
'update title of main window
|
||||||
COLOR 7, 1: LOCATE 2, 2: PRINT STRING$(idewx - 2, chr$(196));
|
COLOR 7, 1: LOCATE 2, 2: PRINT STRING$(idewx - 2, chr$(196));
|
||||||
IF LEN(ideprogname) THEN a$ = ideprogname ELSE a$ = "Untitled" + tempfolderindexstr$
|
IF LEN(ideprogname) THEN a$ = ideprogname ELSE a$ = "Untitled" + tempfolderindexstr$
|
||||||
a$ = " " + a$
|
a$ = " " + a$
|
||||||
if LEN(sfname$) > 0 then a$ = a$ + ":" + sfname$
|
if LEN(sfname$) > 0 then a$ = a$ + ":" + sfname$
|
||||||
a$ = a$ + " "
|
a$ = a$ + " "
|
||||||
|
if len(a$) > idewx - 5 then a$ = left$(a$, idewx - 11) + string$(3, 250) + " "
|
||||||
COLOR 1, 7: LOCATE 2, ((idewx / 2) - 1) - (LEN(a$) - 1) \ 2: PRINT a$;
|
COLOR 1, 7: LOCATE 2, ((idewx / 2) - 1) - (LEN(a$) - 1) \ 2: PRINT a$;
|
||||||
|
|
||||||
'update search bar
|
'update search bar
|
||||||
|
@ -6411,10 +6421,31 @@ DIM sep AS STRING * 1
|
||||||
sep = CHR$(0)
|
sep = CHR$(0)
|
||||||
'-------- end of generic dialog box header --------
|
'-------- end of generic dialog box header --------
|
||||||
|
|
||||||
|
'------- identify word or character at current cursor position - copied/adapted from FUNCTION ide2:
|
||||||
|
a$ = idegetline(idecy)
|
||||||
|
x = idecx
|
||||||
|
IF x <= LEN(a$) THEN
|
||||||
|
IF alphanumeric(ASC(a$, x)) THEN
|
||||||
|
x1 = x
|
||||||
|
DO WHILE x1 > 1
|
||||||
|
IF alphanumeric(ASC(a$, x1 - 1)) OR ASC(a$, x1 - 1) = 36 THEN x1 = x1 - 1 ELSE EXIT DO
|
||||||
|
LOOP
|
||||||
|
x2 = x
|
||||||
|
DO WHILE x2 < LEN(a$)
|
||||||
|
IF alphanumeric(ASC(a$, x2 + 1)) OR ASC(a$, x2 + 1) = 36 THEN x2 = x2 + 1 ELSE EXIT DO
|
||||||
|
LOOP
|
||||||
|
a2$ = MID$(a$, x1, x2 - x1 + 1)
|
||||||
|
ELSE
|
||||||
|
a2$ = CHR$(ASC(a$, x))
|
||||||
|
END IF
|
||||||
|
a2$ = UCASE$(a2$) 'a2$ now holds the word or character at current cursor position
|
||||||
|
END IF
|
||||||
|
|
||||||
'-------- init --------
|
'-------- init --------
|
||||||
|
|
||||||
ly$ = MKL$(1)
|
ly$ = MKL$(1)
|
||||||
CurrentlyViewingWhichSUBFUNC = 1
|
CurrentlyViewingWhichSUBFUNC = 1
|
||||||
|
PreferCurrentCursorSUBFUNC = 0
|
||||||
l$ = ideprogname$
|
l$ = ideprogname$
|
||||||
IF l$ = "" THEN l$ = "Untitled" + tempfolderindexstr$
|
IF l$ = "" THEN l$ = "Untitled" + tempfolderindexstr$
|
||||||
FOR y = 1 TO iden
|
FOR y = 1 TO iden
|
||||||
|
@ -6451,6 +6482,20 @@ FOR y = 1 TO iden
|
||||||
n$ = a$
|
n$ = a$
|
||||||
args$ = ""
|
args$ = ""
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
|
'If the user currently has the cursor over a SUB/FUNC name, let's highlight it
|
||||||
|
'instead of the currently in edition, for a quick link functionality:
|
||||||
|
IF a2$ = UCASE$(n$) THEN PreferCurrentCursorSUBFUNC = (LEN(ly$) / 4)
|
||||||
|
|
||||||
|
'attempt to cleanse n$, just in case there are any comments or other unwanted stuff
|
||||||
|
for CleanseN = 1 to len(n$)
|
||||||
|
select case mid$(n$, CleanseN, 1)
|
||||||
|
case " ", "'", ":"
|
||||||
|
n$ = left$(n$, CleanseN - 1)
|
||||||
|
exit for
|
||||||
|
end select
|
||||||
|
next
|
||||||
|
|
||||||
IF LEN(n$) <= 20 THEN
|
IF LEN(n$) <= 20 THEN
|
||||||
n$ = n$ + SPACE$(20 - LEN(n$))
|
n$ = n$ + SPACE$(20 - LEN(n$))
|
||||||
ELSE
|
ELSE
|
||||||
|
@ -6483,7 +6528,11 @@ o(i).y = 1
|
||||||
'68
|
'68
|
||||||
o(i).w = idewx - 12: o(i).h = idewy + idesubwindow - 9
|
o(i).w = idewx - 12: o(i).h = idewy + idesubwindow - 9
|
||||||
o(i).txt = idenewtxt(l$)
|
o(i).txt = idenewtxt(l$)
|
||||||
o(i).sel = CurrentlyViewingWhichSUBFUNC
|
IF PreferCurrentCursorSUBFUNC <> 0 THEN
|
||||||
|
o(i).sel = PreferCurrentCursorSUBFUNC
|
||||||
|
ELSE
|
||||||
|
o(i).sel = CurrentlyViewingWhichSUBFUNC
|
||||||
|
END IF
|
||||||
o(i).nam = idenewtxt("Program Items")
|
o(i).nam = idenewtxt("Program Items")
|
||||||
|
|
||||||
|
|
||||||
|
@ -6742,6 +6791,7 @@ LOOP
|
||||||
END FUNCTION
|
END FUNCTION
|
||||||
|
|
||||||
SUB ideobjupdate (o AS idedbotype, focus, f, focusoffset, kk$, altletter$, mb, mousedown, mouseup, mx, my, info, mw)
|
SUB ideobjupdate (o AS idedbotype, focus, f, focusoffset, kk$, altletter$, mb, mousedown, mouseup, mx, my, info, mw)
|
||||||
|
STATIC SearchTerm$, LastKeybInput as single
|
||||||
DIM sep AS STRING * 1
|
DIM sep AS STRING * 1
|
||||||
sep = CHR$(0)
|
sep = CHR$(0)
|
||||||
|
|
||||||
|
@ -6946,50 +6996,71 @@ IF t = 2 THEN 'list box
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
IF LEN(kk$) = 1 THEN
|
IF LEN(kk$) = 1 THEN
|
||||||
|
ResetKeybTimer = 0
|
||||||
|
IF TIMER - LastKeybInput > 1 THEN SearchTerm$ = "": ResetKeybTimer = -1
|
||||||
|
LastKeybInput = TIMER
|
||||||
k = ASC(UCASE$(kk$)): IF k < 32 OR k > 126 THEN k = 255
|
k = ASC(UCASE$(kk$)): IF k < 32 OR k > 126 THEN k = 255
|
||||||
|
|
||||||
old_sel = o.sel
|
'Populate ListBoxITEMS:
|
||||||
a$ = idetxt(o.txt)
|
a$ = idetxt(o.txt)
|
||||||
|
redim ListBoxITEMS(0) as string
|
||||||
retryfind:
|
if len(a$) > 0 then
|
||||||
n = 1
|
n = 0: x = 1
|
||||||
x = 1
|
do
|
||||||
x2 = INSTR(x, a$, sep)
|
x2 = INSTR(x, a$, sep)
|
||||||
IF LEN(a$) THEN again = 1 ELSE again = 0
|
if x2 > 0 then
|
||||||
DO WHILE x2 <> 0 OR again <> 0
|
n = n + 1
|
||||||
IF x2 THEN
|
redim _preserve ListBoxITEMS(1 to n) as string
|
||||||
ca2$ = MID$(a$, x, x2 - x)
|
ListBoxITEMS(n) = mid$(a$, x, x2 - x)
|
||||||
a2$ = UCASE$(ca2$)
|
else
|
||||||
|
n = n + 1
|
||||||
|
redim _preserve ListBoxITEMS(1 to n) as string
|
||||||
|
ListBoxITEMS(n) = right$(a$, len(a$) - x + 1)
|
||||||
|
exit do
|
||||||
|
end if
|
||||||
x = x2 + 1
|
x = x2 + 1
|
||||||
again = 1
|
loop
|
||||||
ELSE
|
end if
|
||||||
ca2$ = RIGHT$(a$, LEN(a$) - x + 1)
|
|
||||||
a2$ = UCASE$(ca2$)
|
|
||||||
again = 0
|
|
||||||
END IF
|
|
||||||
|
|
||||||
IF n > old_sel THEN
|
if k = 255 then
|
||||||
match = 0
|
if o.sel > 0 then idetxt(o.stx) = ListBoxITEMS(o.sel)
|
||||||
FOR ai = 1 TO LEN(a2$)
|
goto selected 'Search is not performed if kk$ isn't a printable character
|
||||||
aa = ASC(a2$, ai)
|
else
|
||||||
IF aa > 126 OR (k <> 95 AND aa = 95) THEN
|
SearchTerm$ = SearchTerm$ + UCASE$(kk$)
|
||||||
'ignore
|
END IF
|
||||||
ELSE
|
|
||||||
IF aa = k THEN match = 1
|
if len(SearchTerm$) = 2 and left$(SearchTerm$, 1) = right$(SearchTerm$, 1) then
|
||||||
EXIT FOR
|
'if the user is pressing the same letter again, we deduce the search
|
||||||
END IF
|
'is only for the initials
|
||||||
NEXT
|
ResetKeybTimer = -1
|
||||||
IF match = 1 THEN
|
SearchTerm$ = ucase$(kk$)
|
||||||
o.sel = n
|
end if
|
||||||
GOTO selected
|
|
||||||
|
SearchPass = 1
|
||||||
|
if not ResetKeybTimer then StartSearch = abs(o.sel) else StartSearch = abs(o.sel) + 1
|
||||||
|
if StartSearch < 1 or StartSearch > n then StartSearch = 1
|
||||||
|
retryfind:
|
||||||
|
if SearchPass > 2 then goto selected
|
||||||
|
for findMatch = StartSearch to n
|
||||||
|
validCHARS$ = ""
|
||||||
|
FOR ai = 1 TO LEN(ListBoxITEMS(FindMatch))
|
||||||
|
aa = ASC(ucase$(ListBoxITEMS(findMatch)), ai)
|
||||||
|
IF aa > 126 OR (k <> 95 AND aa = 95) THEN
|
||||||
|
'ignore
|
||||||
|
ELSE
|
||||||
|
validCHARS$ = validCHARS$ + CHR$(aa)
|
||||||
END IF
|
END IF
|
||||||
END IF
|
NEXT
|
||||||
|
if findMatch = o.sel then idetxt(o.stx) = ListBoxITEMS(FindMatch)
|
||||||
IF n = o.sel THEN idetxt(o.stx) = ca2$
|
IF left$(validCHARS$, len(SearchTerm$)) = SearchTerm$ THEN
|
||||||
n = n + 1
|
o.sel = findMatch
|
||||||
x2 = INSTR(x, a$, sep)
|
GOTO selected
|
||||||
LOOP
|
end if
|
||||||
IF old_sel THEN old_sel = 0: GOTO retryfind
|
next findMatch
|
||||||
|
'No match, try again:
|
||||||
|
StartSearch = 1
|
||||||
|
SearchPass = SearchPass + 1
|
||||||
|
goto retryfind
|
||||||
selected:
|
selected:
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
|
@ -9537,8 +9608,9 @@ END SUB
|
||||||
|
|
||||||
SUB ideASCIIbox
|
SUB ideASCIIbox
|
||||||
'IF INSTR(_OS$, "WIN") THEN ret% = SHELL("internal\ASCII-Picker.exe") ELSE ret% = SHELL("internal/ASCII-Picker")
|
'IF INSTR(_OS$, "WIN") THEN ret% = SHELL("internal\ASCII-Picker.exe") ELSE ret% = SHELL("internal/ASCII-Picker")
|
||||||
|
'(code to fix font and arrow keys also written by Steve)
|
||||||
w = _WIDTH: h = _HEIGHT
|
w = _WIDTH: h = _HEIGHT
|
||||||
|
font = _FONT
|
||||||
temp = _NEWIMAGE(640, 480, 32)
|
temp = _NEWIMAGE(640, 480, 32)
|
||||||
temp1 = _NEWIMAGE(640, 480, 32)
|
temp1 = _NEWIMAGE(640, 480, 32)
|
||||||
ws = _NEWIMAGE(640, 480, 32)
|
ws = _NEWIMAGE(640, 480, 32)
|
||||||
|
@ -9579,9 +9651,12 @@ oldmousex = _MOUSEX: oldmousey = _MOUSEY
|
||||||
DO
|
DO
|
||||||
_LIMIT 60
|
_LIMIT 60
|
||||||
DO: LOOP WHILE _MOUSEINPUT
|
DO: LOOP WHILE _MOUSEINPUT
|
||||||
|
if oldx <> _mousex and oldy <> _mousey then
|
||||||
|
x = _MOUSEX \ 40 + 1 'If mouse moved, where are we now?
|
||||||
|
y = _MOUSEY \ 30 + 1
|
||||||
|
end if
|
||||||
|
oldx = _mousex: oldy = _mousey
|
||||||
|
|
||||||
x = _MOUSEX \ 40 + 1 'If mouse moved, where are we now?
|
|
||||||
y = _MOUSEY \ 30 + 1
|
|
||||||
num = (y - 1) * 16 + x - 1
|
num = (y - 1) * 16 + x - 1
|
||||||
IF num = 0 THEN
|
IF num = 0 THEN
|
||||||
text$ = ""
|
text$ = ""
|
||||||
|
@ -9613,7 +9688,7 @@ DO
|
||||||
CASE 13: EXIT DO
|
CASE 13: EXIT DO
|
||||||
CASE 27
|
CASE 27
|
||||||
_AUTODISPLAY
|
_AUTODISPLAY
|
||||||
SCREEN 0: WIDTH w, h: _DEST 0: _DELAY .2
|
SCREEN 0: WIDTH w, h: _FONT font: _DEST 0: _DELAY .2
|
||||||
IF _RESIZE THEN donothing = atall
|
IF _RESIZE THEN donothing = atall
|
||||||
EXIT SUB
|
EXIT SUB
|
||||||
CASE 32: toggle = NOT toggle
|
CASE 32: toggle = NOT toggle
|
||||||
|
@ -9631,13 +9706,13 @@ DO
|
||||||
Ex = _EXIT
|
Ex = _EXIT
|
||||||
IF Ex THEN
|
IF Ex THEN
|
||||||
_AUTODISPLAY
|
_AUTODISPLAY
|
||||||
SCREEN 0: WIDTH w, h: _DEST 0: _DELAY .2
|
SCREEN 0: WIDTH w, h: _FONT font: _DEST 0: _DELAY .2
|
||||||
IF _RESIZE THEN donothing = atall
|
IF _RESIZE THEN donothing = atall
|
||||||
EXIT FUNCTION
|
EXIT FUNCTION
|
||||||
END IF
|
END IF
|
||||||
IF MouseExit THEN
|
IF MouseExit THEN
|
||||||
_AUTODISPLAY
|
_AUTODISPLAY
|
||||||
SCREEN 0: WIDTH w, h: _DEST 0: _DELAY .2
|
SCREEN 0: WIDTH w, h: _FONT font: _DEST 0: _DELAY .2
|
||||||
IF _RESIZE THEN donothing = atall
|
IF _RESIZE THEN donothing = atall
|
||||||
EXIT FUNCTION
|
EXIT FUNCTION
|
||||||
END IF
|
END IF
|
||||||
|
@ -9660,7 +9735,9 @@ END IF
|
||||||
|
|
||||||
_AUTODISPLAY
|
_AUTODISPLAY
|
||||||
|
|
||||||
SCREEN 0: WIDTH w, h: _DEST 0: _DELAY .2
|
SCREEN 0: WIDTH w, h
|
||||||
|
_FONT font
|
||||||
|
_DEST 0: _DELAY .2
|
||||||
IF _RESIZE THEN donothing = atall
|
IF _RESIZE THEN donothing = atall
|
||||||
|
|
||||||
END FUNCTION
|
END FUNCTION
|
||||||
|
|
Loading…
Reference in a new issue