mirror of
https://github.com/QB64Official/qb64.git
synced 2024-08-22 11:25:08 +00:00
Simplifies array range selection (Watch List).
This commit is contained in:
parent
faf6b2dcdd
commit
445f192848
2 changed files with 44 additions and 49 deletions
|
@ -7705,16 +7705,14 @@ FUNCTION idevariablewatchbox$(currentScope$, filter$, selectVar)
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
IF LEN(usedVariableList(x).varType) > maxTypeLen THEN maxTypeLen = LEN(usedVariableList(x).varType)
|
IF LEN(usedVariableList(x).varType) > maxTypeLen THEN maxTypeLen = LEN(usedVariableList(x).varType)
|
||||||
IF LEN(usedVariableList(x).indexes) > 0 AND usedVariableList(x).watch <> 0 THEN
|
|
||||||
totalArrayElements = totalArrayElements + ((LEN(usedVariableList(x).indexes) \ 4) - 1)
|
|
||||||
END IF
|
|
||||||
NEXT
|
NEXT
|
||||||
|
|
||||||
searchTerm$ = filter$
|
searchTerm$ = filter$
|
||||||
GOSUB buildList
|
GOSUB buildList
|
||||||
|
dialogHeight = (totalVariablesCreated) + 7
|
||||||
|
listBuilt:
|
||||||
i = 0
|
i = 0
|
||||||
dialogHeight = (totalVariablesCreated + totalArrayElements) + 7
|
IF dialogHeight < lastUsedDialogHeight THEN dialogHeight = lastUsedDialogHeight
|
||||||
IF dialogHeight > idewy + idesubwindow - 6 THEN
|
IF dialogHeight > idewy + idesubwindow - 6 THEN
|
||||||
dialogHeight = idewy + idesubwindow - 6
|
dialogHeight = idewy + idesubwindow - 6
|
||||||
END IF
|
END IF
|
||||||
|
@ -7731,14 +7729,14 @@ FUNCTION idevariablewatchbox$(currentScope$, filter$, selectVar)
|
||||||
PrevFocus = 1
|
PrevFocus = 1
|
||||||
o(i).typ = 1
|
o(i).typ = 1
|
||||||
o(i).y = 2
|
o(i).y = 2
|
||||||
o(i).nam = idenewtxt("#Filter")
|
IF o(i).nam = 0 THEN o(i).nam = idenewtxt("#Filter")
|
||||||
o(i).txt = idenewtxt(filter$)
|
IF o(i).txt = 0 THEN o(i).txt = idenewtxt(filter$)
|
||||||
|
|
||||||
i = i + 1: varListBox = i
|
i = i + 1: varListBox = i
|
||||||
o(varListBox).typ = 2
|
o(varListBox).typ = 2
|
||||||
o(varListBox).y = 5
|
o(varListBox).y = 5
|
||||||
o(varListBox).w = dialogWidth - 4: o(i).h = dialogHeight - 7
|
o(varListBox).w = dialogWidth - 4: o(i).h = dialogHeight - 7
|
||||||
o(varListBox).txt = idenewtxt(l$)
|
IF o(varListBox).txt = 0 THEN o(varListBox).txt = idenewtxt(l$) ELSE idetxt(o(varListBox).txt) = l$
|
||||||
IF selectVar = 0 THEN selectVar = 1 ELSE focus = varListBox
|
IF selectVar = 0 THEN selectVar = 1 ELSE focus = varListBox
|
||||||
o(varListBox).sel = selectVar
|
o(varListBox).sel = selectVar
|
||||||
|
|
||||||
|
@ -7748,13 +7746,13 @@ FUNCTION idevariablewatchbox$(currentScope$, filter$, selectVar)
|
||||||
i = i + 1: buttonSet = i
|
i = i + 1: buttonSet = i
|
||||||
o(buttonSet).typ = 3
|
o(buttonSet).typ = 3
|
||||||
o(buttonSet).y = dialogHeight
|
o(buttonSet).y = dialogHeight
|
||||||
IF IdeDebugMode THEN
|
IF IdeDebugMode > 0 AND o(buttonSet).txt = 0 THEN
|
||||||
o(buttonSet).txt = idenewtxt("#Add All" + sep + "#Remove All" + sep + "#Send Value" + sep + "#Close")
|
o(buttonSet).txt = idenewtxt("#Add All" + sep + "#Remove All" + sep + "#Send Value" + sep + "#Close")
|
||||||
ELSE
|
ELSE
|
||||||
o(buttonSet).txt = idenewtxt("#Add All" + sep + "#Remove All" + sep + "#Close")
|
o(buttonSet).txt = idenewtxt("#Add All" + sep + "#Remove All" + sep + "#Close")
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
|
lastUsedDialogHeight = dialogHeight
|
||||||
|
|
||||||
|
|
||||||
'-------- end of init --------
|
'-------- end of init --------
|
||||||
|
@ -7848,7 +7846,7 @@ FUNCTION idevariablewatchbox$(currentScope$, filter$, selectVar)
|
||||||
|
|
||||||
IF (focus = 3 AND info <> 0) THEN 'add all
|
IF (focus = 3 AND info <> 0) THEN 'add all
|
||||||
FOR y = 1 TO totalVisibleVariables
|
FOR y = 1 TO totalVisibleVariables
|
||||||
IF usedVariableList(varDlgList(y).index).isarray THEN _CONTINUE
|
IF usedVariableList(varDlgList(y).index).isarray AND LEN(usedVariableList(varDlgList(y).index).watchRange) = 0 THEN _CONTINUE
|
||||||
usedVariableList(varDlgList(y).index).watch = -1
|
usedVariableList(varDlgList(y).index).watch = -1
|
||||||
ASC(idetxt(o(varListBox).txt), varDlgList(y).colorFlag) = variableNameColor
|
ASC(idetxt(o(varListBox).txt), varDlgList(y).colorFlag) = variableNameColor
|
||||||
ASC(idetxt(o(varListBox).txt), varDlgList(y).colorFlag2) = typeColumnColor
|
ASC(idetxt(o(varListBox).txt), varDlgList(y).colorFlag2) = typeColumnColor
|
||||||
|
@ -7867,10 +7865,6 @@ FUNCTION idevariablewatchbox$(currentScope$, filter$, selectVar)
|
||||||
ASC(idetxt(o(varListBox).txt), varDlgList(y).bgColorFlag) = 17
|
ASC(idetxt(o(varListBox).txt), varDlgList(y).bgColorFlag) = 17
|
||||||
ASC(idetxt(o(varListBox).txt), varDlgList(y).indicator) = 32 'space
|
ASC(idetxt(o(varListBox).txt), varDlgList(y).indicator) = 32 'space
|
||||||
NEXT
|
NEXT
|
||||||
IF usedVariableList(varDlgList(y).index).isarray THEN
|
|
||||||
GOSUB buildList
|
|
||||||
idetxt(o(varListBox).txt) = l$
|
|
||||||
END IF
|
|
||||||
focus = filterBox
|
focus = filterBox
|
||||||
_CONTINUE
|
_CONTINUE
|
||||||
END IF
|
END IF
|
||||||
|
@ -7946,23 +7940,38 @@ FUNCTION idevariablewatchbox$(currentScope$, filter$, selectVar)
|
||||||
y = ABS(o(varListBox).sel)
|
y = ABS(o(varListBox).sel)
|
||||||
|
|
||||||
IF y >= 1 AND y <= totalVisibleVariables THEN
|
IF y >= 1 AND y <= totalVisibleVariables THEN
|
||||||
|
IF usedVariableList(varDlgList(y).index).watch <> 0 AND usedVariableList(varDlgList(y).index).isarray THEN
|
||||||
|
GOTO setArrayRange
|
||||||
|
END IF
|
||||||
usedVariableList(varDlgList(y).index).watch = NOT usedVariableList(varDlgList(y).index).watch
|
usedVariableList(varDlgList(y).index).watch = NOT usedVariableList(varDlgList(y).index).watch
|
||||||
IF usedVariableList(varDlgList(y).index).watch THEN
|
IF usedVariableList(varDlgList(y).index).watch THEN
|
||||||
IF usedVariableList(varDlgList(y).index).isarray THEN
|
IF usedVariableList(varDlgList(y).index).isarray THEN
|
||||||
|
setArrayRange:
|
||||||
temp$ = ""
|
temp$ = ""
|
||||||
IF LEN(usedVariableList(varDlgList(y).index).indexes) THEN
|
IF LEN(usedVariableList(varDlgList(y).index).indexes) THEN
|
||||||
temp$ = formatRange$(usedVariableList(varDlgList(y).index).indexes)
|
temp$ = usedVariableList(varDlgList(y).index).watchRange
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
v$ = ideinputbox$("Watch Array", "#Indexes to watch", temp$, "01234567890,-", 45, 0, ok)
|
v$ = ideinputbox$("Watch Array", "#Indexes to watch", temp$, "01234567890,-", 45, 0, ok)
|
||||||
IF ok THEN
|
IF ok THEN
|
||||||
temp$ = parseRange$(v$)
|
IF LEN(v$) > 0 THEN
|
||||||
usedVariableList(varDlgList(y).index).indexes = temp$
|
temp$ = parseRange$(v$)
|
||||||
|
usedVariableList(varDlgList(y).index).indexes = temp$
|
||||||
|
temp$ = formatRange$(temp$)
|
||||||
|
usedVariableList(varDlgList(y).index).watchRange = temp$
|
||||||
|
ELSE
|
||||||
|
usedVariableList(varDlgList(y).index).indexes = ""
|
||||||
|
usedVariableList(varDlgList(y).index).watchRange = ""
|
||||||
|
usedVariableList(varDlgList(y).index).watch = 0
|
||||||
|
GOSUB buildList
|
||||||
|
idetxt(o(varListBox).txt) = l$
|
||||||
|
GOTO unWatch
|
||||||
|
END IF
|
||||||
GOSUB buildList
|
GOSUB buildList
|
||||||
idetxt(o(varListBox).txt) = l$
|
idetxt(o(varListBox).txt) = l$
|
||||||
ELSE
|
ELSE
|
||||||
usedVariableList(varDlgList(y).index).watch = 0
|
usedVariableList(varDlgList(y).index).watch = 0
|
||||||
_CONTINUE
|
GOTO unWatch
|
||||||
END IF
|
END IF
|
||||||
END IF
|
END IF
|
||||||
ASC(idetxt(o(varListBox).txt), varDlgList(y).colorFlag) = variableNameColor
|
ASC(idetxt(o(varListBox).txt), varDlgList(y).colorFlag) = variableNameColor
|
||||||
|
@ -7970,19 +7979,14 @@ FUNCTION idevariablewatchbox$(currentScope$, filter$, selectVar)
|
||||||
ASC(idetxt(o(varListBox).txt), varDlgList(y).bgColorFlag) = selectedBG
|
ASC(idetxt(o(varListBox).txt), varDlgList(y).bgColorFlag) = selectedBG
|
||||||
ASC(idetxt(o(varListBox).txt), varDlgList(y).indicator) = 43 '+
|
ASC(idetxt(o(varListBox).txt), varDlgList(y).indicator) = 43 '+
|
||||||
ELSE
|
ELSE
|
||||||
|
unWatch:
|
||||||
ASC(idetxt(o(varListBox).txt), varDlgList(y).colorFlag) = 16
|
ASC(idetxt(o(varListBox).txt), varDlgList(y).colorFlag) = 16
|
||||||
ASC(idetxt(o(varListBox).txt), varDlgList(y).colorFlag2) = 2
|
ASC(idetxt(o(varListBox).txt), varDlgList(y).colorFlag2) = 2
|
||||||
ASC(idetxt(o(varListBox).txt), varDlgList(y).bgColorFlag) = 17
|
ASC(idetxt(o(varListBox).txt), varDlgList(y).bgColorFlag) = 17
|
||||||
ASC(idetxt(o(varListBox).txt), varDlgList(y).indicator) = 32 'space
|
ASC(idetxt(o(varListBox).txt), varDlgList(y).indicator) = 32 'space
|
||||||
END IF
|
END IF
|
||||||
IF usedVariableList(varDlgList(y).index).isarray then
|
|
||||||
itemToSelect = varDlgList(y).index
|
|
||||||
GOSUB buildList
|
|
||||||
idetxt(o(varListBox).txt) = l$
|
|
||||||
END IF
|
|
||||||
END IF
|
END IF
|
||||||
'focus = filterBox
|
'focus = filterBox
|
||||||
WHILE _MOUSEBUTTON(1) OR _MOUSEBUTTON(2): y = _MOUSEINPUT: WEND
|
|
||||||
_CONTINUE
|
_CONTINUE
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
|
@ -8006,10 +8010,8 @@ FUNCTION idevariablewatchbox$(currentScope$, filter$, selectVar)
|
||||||
searchTerm$ = UCASE$(filter$)
|
searchTerm$ = UCASE$(filter$)
|
||||||
'rebuild filtered list
|
'rebuild filtered list
|
||||||
GOSUB buildList
|
GOSUB buildList
|
||||||
idetxt(o(varListBox).txt) = l$
|
|
||||||
IF LEN(searchTerm$) THEN temp$ = ", filtered" ELSE temp$ = ""
|
IF LEN(searchTerm$) THEN temp$ = ", filtered" ELSE temp$ = ""
|
||||||
idetxt(p.nam) = "Add Watch - Variable List (" + LTRIM$(STR$(totalVisibleVariables)) + temp$ + ")"
|
idetxt(p.nam) = "Add Watch - Variable List (" + LTRIM$(STR$(totalVisibleVariables)) + temp$ + ")"
|
||||||
_CONTINUE
|
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
dialogLoop:
|
dialogLoop:
|
||||||
|
@ -8068,8 +8070,8 @@ FUNCTION idevariablewatchbox$(currentScope$, filter$, selectVar)
|
||||||
maxVarLen = LEN("Variable")
|
maxVarLen = LEN("Variable")
|
||||||
FOR x = 1 TO totalVariablesCreated
|
FOR x = 1 TO totalVariablesCreated
|
||||||
thisLen = LEN(usedVariableList(x).name)
|
thisLen = LEN(usedVariableList(x).name)
|
||||||
IF LEN(usedVariableList(x).indexes) > 0 AND usedVariableList(x).watch <> 0 THEN
|
IF LEN(usedVariableList(x).watchRange) > 0 THEN
|
||||||
thisLen = thisLen + LEN(LTRIM$(STR$(CVL(RIGHT$(usedVariableList(x).indexes, 4)))))
|
thisLen = thisLen + LEN(usedVariableList(x).watchRange)
|
||||||
END IF
|
END IF
|
||||||
IF thisLen > maxVarLen THEN maxVarLen = thisLen
|
IF thisLen > maxVarLen THEN maxVarLen = thisLen
|
||||||
NEXT
|
NEXT
|
||||||
|
@ -8096,18 +8098,10 @@ FUNCTION idevariablewatchbox$(currentScope$, filter$, selectVar)
|
||||||
END IF
|
END IF
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
IF usedVariableList(x).isarray AND usedVariableList(x).watch THEN
|
|
||||||
totalArrayElements = LEN(usedVariableList(x).indexes) \ 4
|
|
||||||
thisArrayElement = 0
|
|
||||||
temp$ = usedVariableList(x).indexes
|
|
||||||
nextArrayElement:
|
|
||||||
thisArrayElement = thisArrayElement + 1
|
|
||||||
END IF
|
|
||||||
|
|
||||||
totalVisibleVariables = totalVisibleVariables + 1
|
totalVisibleVariables = totalVisibleVariables + 1
|
||||||
IF totalVisibleVariables > UBOUND(varDlgList) THEN
|
WHILE totalVisibleVariables > UBOUND(varDlgList)
|
||||||
REDIM _PRESERVE varDlgList(1 TO totalVariablesCreated + 100) AS varDlgList
|
REDIM _PRESERVE varDlgList(1 TO totalVariablesCreated + 100) AS varDlgList
|
||||||
END IF
|
WEND
|
||||||
|
|
||||||
l$ = l$ + CHR$(17)
|
l$ = l$ + CHR$(17)
|
||||||
varDlgList(totalVisibleVariables).bgColorFlag = LEN(l$) + 1
|
varDlgList(totalVisibleVariables).bgColorFlag = LEN(l$) + 1
|
||||||
|
@ -8128,11 +8122,9 @@ FUNCTION idevariablewatchbox$(currentScope$, filter$, selectVar)
|
||||||
l$ = l$ + CHR$(16) + " "
|
l$ = l$ + CHR$(16) + " "
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
IF usedVariableList(x).isarray AND usedVariableList(x).watch THEN
|
thisName$ = usedVariableList(x).name
|
||||||
thisName$ = LEFT$(usedVariableList(x).name, LEN(usedVariableList(x).name) - 1)
|
IF LEN(usedVariableList(x).watchRange) THEN
|
||||||
thisName$ = thisName$ + LTRIM$(STR$(CVL(MID$(temp$, thisArrayElement * 4 - 3, 4)))) + ")"
|
thisName$ = LEFT$(thisName$, LEN(thisName$) - 1) + usedVariableList(x).watchRange + ")"
|
||||||
ELSE
|
|
||||||
thisName$ = usedVariableList(x).name
|
|
||||||
END IF
|
END IF
|
||||||
text$ = thisName$ + CHR$(16)
|
text$ = thisName$ + CHR$(16)
|
||||||
varDlgList(totalVisibleVariables).colorFlag2 = LEN(l$) + LEN(text$) + 1
|
varDlgList(totalVisibleVariables).colorFlag2 = LEN(l$) + LEN(text$) + 1
|
||||||
|
@ -8164,9 +8156,6 @@ FUNCTION idevariablewatchbox$(currentScope$, filter$, selectVar)
|
||||||
END IF
|
END IF
|
||||||
END IF
|
END IF
|
||||||
IF x < totalVariablesCreated THEN l$ = l$ + sep
|
IF x < totalVariablesCreated THEN l$ = l$ + sep
|
||||||
IF usedVariableList(x).isarray AND usedVariableList(x).watch AND thisArrayElement < totalArrayElements THEN
|
|
||||||
GOTO nextArrayElement
|
|
||||||
END IF
|
|
||||||
NEXT
|
NEXT
|
||||||
itemToSelect = 0
|
itemToSelect = 0
|
||||||
RETURN
|
RETURN
|
||||||
|
|
|
@ -112,7 +112,7 @@ TYPE usedVarList
|
||||||
AS LONG linenumber, includeLevel, includedLine, scope, localIndex, strLength
|
AS LONG linenumber, includeLevel, includedLine, scope, localIndex, strLength
|
||||||
AS _BYTE used, watch, isarray
|
AS _BYTE used, watch, isarray
|
||||||
AS STRING name, cname, varType, includedFile, subfunc, mostRecentValue
|
AS STRING name, cname, varType, includedFile, subfunc, mostRecentValue
|
||||||
AS STRING indexes, elements 'for Arrays and UDTs
|
AS STRING watchRange, indexes, elements 'for Arrays and UDTs
|
||||||
AS _OFFSET baseAddress, address
|
AS _OFFSET baseAddress, address
|
||||||
END TYPE
|
END TYPE
|
||||||
|
|
||||||
|
@ -25963,6 +25963,11 @@ SUB manageVariableList (__name$, __cname$, localIndex AS LONG, action AS _BYTE)
|
||||||
IF (id.arrayelements > 0) THEN
|
IF (id.arrayelements > 0) THEN
|
||||||
usedVariableList(i).isarray = -1
|
usedVariableList(i).isarray = -1
|
||||||
usedVariableList(i).name = usedVariableList(i).name + "()"
|
usedVariableList(i).name = usedVariableList(i).name + "()"
|
||||||
|
ELSE
|
||||||
|
usedVariableList(i).isarray = 0
|
||||||
|
usedVariableList(i).watchRange = ""
|
||||||
|
usedVariableList(i).indexes = ""
|
||||||
|
usedVariableList(i).elements = ""
|
||||||
END IF
|
END IF
|
||||||
totalVariablesCreated = totalVariablesCreated + 1
|
totalVariablesCreated = totalVariablesCreated + 1
|
||||||
END IF
|
END IF
|
||||||
|
@ -26079,3 +26084,4 @@ DEFLNG A-Z
|
||||||
|
|
||||||
'-------- Optional IDE Component (2/2) --------
|
'-------- Optional IDE Component (2/2) --------
|
||||||
'$INCLUDE:'ide\ide_methods.bas'
|
'$INCLUDE:'ide\ide_methods.bas'
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue