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

Sets focus to the debuggee when SLEEP is used.

Properly sizes Watch List dialog when there are "hidden" variables in includes.
This commit is contained in:
FellippeHeitor 2021-08-24 13:23:01 -03:00
parent cb91b6fea1
commit 2ccfae416a
2 changed files with 31 additions and 10 deletions

View file

@ -7215,7 +7215,7 @@ SUB DebugMode
END IF END IF
clearStatusWindow 1 clearStatusWindow 1
IF EnteredInput THEN IF EnteredInput THEN
setStatusMessage 1, "Execution will be paused after INPUT/LINE INPUT finishes running...", 2 setStatusMessage 1, "Execution will be paused after SLEEP/INPUT/LINE INPUT finishes running...", 2
set_foreground_window debuggeehwnd set_foreground_window debuggeehwnd
ELSE ELSE
setStatusMessage 1, "Paused.", 2 setStatusMessage 1, "Paused.", 2
@ -7484,7 +7484,7 @@ SUB DebugMode
GOSUB UpdateDisplay GOSUB UpdateDisplay
dummy = DarkenFGBG(1) dummy = DarkenFGBG(1)
clearStatusWindow 1 clearStatusWindow 1
setStatusMessage 1, "INPUT/LINE INPUT active in your program...", 10 setStatusMessage 1, "SLEEP/INPUT/LINE INPUT active in your program...", 10
set_foreground_window debuggeehwnd set_foreground_window debuggeehwnd
CASE "leave input" CASE "leave input"
EnteredInput = 0 EnteredInput = 0
@ -7805,6 +7805,7 @@ FUNCTION idevariablewatchbox$(currentScope$, filter$, selectVar, returnAction)
'calculate longest module name, longest var name, longest type name 'calculate longest module name, longest var name, longest type name
FOR x = 1 TO totalVariablesCreated FOR x = 1 TO totalVariablesCreated
IF usedVariableList(x).includedLine THEN _CONTINUE 'don't deal with variables in $INCLUDEs
IF LEN(usedVariableList(x).subfunc) > maxModuleNameLen THEN IF LEN(usedVariableList(x).subfunc) > maxModuleNameLen THEN
maxModuleNameLen = LEN(usedVariableList(x).subfunc) maxModuleNameLen = LEN(usedVariableList(x).subfunc)
END IF END IF
@ -7814,7 +7815,7 @@ FUNCTION idevariablewatchbox$(currentScope$, filter$, selectVar, returnAction)
searchTerm$ = filter$ searchTerm$ = filter$
GOSUB buildList GOSUB buildList
dialogHeight = (totalVariablesCreated) + 7 dialogHeight = (totalMainVariablesCreated) + 7
listBuilt: listBuilt:
i = 0 i = 0
IF dialogHeight < lastUsedDialogHeight THEN dialogHeight = lastUsedDialogHeight IF dialogHeight < lastUsedDialogHeight THEN dialogHeight = lastUsedDialogHeight
@ -7824,7 +7825,7 @@ FUNCTION idevariablewatchbox$(currentScope$, filter$, selectVar, returnAction)
IF dialogHeight < 9 THEN dialogHeight = 9 IF dialogHeight < 9 THEN dialogHeight = 9
dialogWidth = 6 + maxModuleNameLen + maxVarLen + maxTypeLen dialogWidth = 6 + maxModuleNameLen + maxVarLen + maxTypeLen
IF IdeDebugMode > 0 THEN dialogWidth = dialogWidth + 100 'make room for "= values" IF IdeDebugMode > 0 THEN dialogWidth = dialogWidth + 40 'make room for "= values"
IF dialogWidth < 60 THEN dialogWidth = 60 IF dialogWidth < 60 THEN dialogWidth = 60
IF dialogWidth > idewx - 8 THEN dialogWidth = idewx - 8 IF dialogWidth > idewx - 8 THEN dialogWidth = idewx - 8
@ -8012,6 +8013,7 @@ FUNCTION idevariablewatchbox$(currentScope$, filter$, selectVar, returnAction)
longestVarName = 0 longestVarName = 0
nextvWatchDataSlot = 0 nextvWatchDataSlot = 0
FOR y = 1 TO totalVariablesCreated FOR y = 1 TO totalVariablesCreated
IF usedVariableList(x).includedLine THEN _CONTINUE 'don't deal with variables in $INCLUDEs
IF usedVariableList(y).watch THEN IF usedVariableList(y).watch THEN
thisLen = LEN(usedVariableList(y).name) thisLen = LEN(usedVariableList(y).name)
IF usedVariableList(y).isarray THEN IF usedVariableList(y).isarray THEN
@ -8382,6 +8384,7 @@ FUNCTION idevariablewatchbox$(currentScope$, filter$, selectVar, returnAction)
buildList: buildList:
maxVarLen = LEN("Variable") maxVarLen = LEN("Variable")
FOR x = 1 TO totalVariablesCreated FOR x = 1 TO totalVariablesCreated
IF usedVariableList(x).includedLine THEN _CONTINUE 'don't deal with variables in $INCLUDEs
thisLen = LEN(usedVariableList(x).name) thisLen = LEN(usedVariableList(x).name)
IF LEN(usedVariableList(x).watchRange) > 0 THEN IF LEN(usedVariableList(x).watchRange) > 0 THEN
thisLen = thisLen + LEN(usedVariableList(x).watchRange) thisLen = thisLen + LEN(usedVariableList(x).watchRange)
@ -8473,11 +8476,13 @@ FUNCTION idevariablewatchbox$(currentScope$, filter$, selectVar, returnAction)
LOOP LOOP
IF LEN(usedVariableList(x).storage) THEN l$ = l$ + "}" IF LEN(usedVariableList(x).storage) THEN l$ = l$ + "}"
ELSEIF usedVariableList(x).isarray = 0 AND LEN(usedVariableList(x).elements) = 0 THEN ELSEIF usedVariableList(x).isarray = 0 AND LEN(usedVariableList(x).elements) = 0 THEN
storageSlot& = CVL(usedVariableList(x).storage) IF LEN(usedVariableList(x).storage) = 4 THEN
l$ = l$ + " = " + CHR$(16) + CHR$(variableNameColor) storageSlot& = CVL(usedVariableList(x).storage)
IF thisIsAString THEN l$ = l$ + CHR$(34) l$ = l$ + " = " + CHR$(16) + CHR$(variableNameColor)
l$ = l$ + StrReplace$(vWatchReceivedData$(storageSlot&), CHR$(0), " ") IF thisIsAString THEN l$ = l$ + CHR$(34)
IF thisIsAString THEN l$ = l$ + CHR$(34) l$ = l$ + StrReplace$(vWatchReceivedData$(storageSlot&), CHR$(0), " ")
IF thisIsAString THEN l$ = l$ + CHR$(34)
END IF
END IF END IF
END IF END IF
ELSE ELSE

View file

@ -120,7 +120,7 @@ TYPE usedVarList
AS STRING elementOffset, storage AS STRING elementOffset, storage
END TYPE END TYPE
DIM SHARED totalVariablesCreated AS LONG DIM SHARED totalVariablesCreated AS LONG, totalMainVariablesCreated AS LONG
DIM SHARED bypassNextVariable AS _BYTE DIM SHARED bypassNextVariable AS _BYTE
DIM SHARED totalWarnings AS LONG, warningListItems AS LONG, lastWarningHeader AS STRING DIM SHARED totalWarnings AS LONG, warningListItems AS LONG, lastWarningHeader AS STRING
DIM SHARED duplicateConstWarning AS _BYTE, warningsissued AS _BYTE DIM SHARED duplicateConstWarning AS _BYTE, warningsissued AS _BYTE
@ -1458,6 +1458,7 @@ SelectCaseCounter = 0
ExecCounter = 0 ExecCounter = 0
UserDefineCount = 7 UserDefineCount = 7
totalVariablesCreated = 0 totalVariablesCreated = 0
totalMainVariablesCreated = 0
REDIM SHARED usedVariableList(1000) AS usedVarList REDIM SHARED usedVariableList(1000) AS usedVarList
totalWarnings = 0 totalWarnings = 0
duplicateConstWarning = 0 duplicateConstWarning = 0
@ -11128,7 +11129,21 @@ DO
subcall$ = subcall$ + "," + str2$(passed&) subcall$ = subcall$ + "," + str2$(passed&)
END IF END IF
subcall$ = subcall$ + ");" subcall$ = subcall$ + ");"
IF firstelement$ = "SLEEP" THEN
IF vWatchOn = 1 THEN
PRINT #12, "*__LONG_VWATCH_LINENUMBER= -4; SUB_VWATCH((ptrszint*)vwatch_global_vars,(ptrszint*)vwatch_local_vars);"
END IF
END IF
PRINT #12, subcall$ PRINT #12, subcall$
IF firstelement$ = "SLEEP" THEN
IF vWatchOn = 1 THEN
PRINT #12, "*__LONG_VWATCH_LINENUMBER= -5; SUB_VWATCH((ptrszint*)vwatch_global_vars,(ptrszint*)vwatch_local_vars);"
END IF
END IF
subcall$ = "" subcall$ = ""
IF stringprocessinghappened THEN PRINT #12, cleanupstringprocessingcall$ + "0);" IF stringprocessinghappened THEN PRINT #12, cleanupstringprocessingcall$ + "0);"
@ -25968,6 +25983,7 @@ SUB manageVariableList (__name$, __cname$, localIndex AS LONG, action AS _BYTE)
thisincname$ = MID$(incname$(inclevel), LEN(thisincname$) + 1) thisincname$ = MID$(incname$(inclevel), LEN(thisincname$) + 1)
usedVariableList(i).includedFile = thisincname$ usedVariableList(i).includedFile = thisincname$
ELSE ELSE
totalMainVariablesCreated = totalMainVariablesCreated + 1
usedVariableList(i).includedLine = 0 usedVariableList(i).includedLine = 0
usedVariableList(i).includedFile = "" usedVariableList(i).includedFile = ""
END IF END IF