VDBFrameApplication.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Fri, 21 Jun 2019 22:54:50 +0100
changeset 175 a304c250e889
parent 154 26937faa5a97
child 191 d540bf90c8f7
permissions -rw-r--r--
UI: add "Scratch Pad" tool which can be used by user to keep notes during debug session, to edit (configuration) files and so on.

"
jv:vdb - Visual / VM Debugger
Copyright (C) 2015-now Jan Vrany

This software is licensed under 'Creative Commons Attribution-NonCommercial 4.0 International License'

You may find a full license text in LICENSE.txt or at http://creativecommons.org/licenses/by-nc/4.0/
"
"{ Package: 'jv:vdb' }"

"{ NameSpace: Smalltalk }"

VDBTabbingContainer subclass:#VDBFrameApplication
	instanceVariableNames:'frameHolder variableObjectListHolder registerListHolder'
	classVariableNames:''
	poolDictionaries:''
	category:'VDB-UI-Others'
!

!VDBFrameApplication class methodsFor:'documentation'!

copyright
"
jv:vdb - Visual / VM Debugger
Copyright (C) 2015-now Jan Vrany

This software is licensed under 'Creative Commons Attribution-NonCommercial 4.0 International License'

You may find a full license text in LICENSE.txt or at http://creativecommons.org/licenses/by-nc/4.0/
"
! !

!VDBFrameApplication class methodsFor:'accessing'!

defaultWindowTitle
    ^ self resources string: 'Frame'

    "Created: / 01-10-2018 / 12:05:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified (format): / 03-10-2018 / 15:38:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!VDBFrameApplication class methodsFor:'plugIn spec'!

aspectSelectors
    "This resource specification was automatically generated
     by the UIPainter of ST/X."

    "Do not manually edit this. If it is corrupted,
     the UIPainter may not be able to read the specification."

    "Return a description of exported aspects;
     these can be connected to aspects of an embedding application
     (if this app is embedded in a subCanvas)."

    ^ #(
        #debuggerHolder
        #frameHolder
      ).

! !

!VDBFrameApplication methodsFor:'accessing'!

frame
    ^ self frameHolder value

    "Created: / 05-07-2018 / 11:55:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

frame: aGDBFrame
    self frameHolder value: aGDBFrame

    "Created: / 05-07-2018 / 11:55:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!VDBFrameApplication methodsFor:'aspects'!

frameHolder
    "return/create the 'frameHolder' value holder (automatically generated)"

    frameHolder isNil ifTrue:[
        frameHolder := ValueHolder new.
        frameHolder addDependent:self.
    ].
    ^ frameHolder
!

frameHolder:something
    "set the 'frameHolder' value holder (automatically generated)"

    |oldValue newValue|

    frameHolder notNil ifTrue:[
        oldValue := frameHolder value.
        frameHolder removeDependent:self.
    ].
    frameHolder := something.
    frameHolder notNil ifTrue:[
        frameHolder addDependent:self.
    ].
    newValue := frameHolder value.
    oldValue ~~ newValue ifTrue:[
        self update:#value with:newValue from:frameHolder.
    ].
!

registerListHolder
    "return/create the 'variableObjectListHolder' value holder (automatically generated)"

    registerListHolder isNil ifTrue:[
        registerListHolder := ValueHolder with: #().
        registerListHolder addDependent:self.
    ].
    ^ registerListHolder

    "Created: / 01-10-2018 / 10:07:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

registerListHolder:something
    "set the 'variableObjectListHolder' value holder (automatically generated)"

    |oldValue newValue|

    registerListHolder notNil ifTrue:[
        oldValue := registerListHolder value.
        registerListHolder removeDependent:self.
    ].
    registerListHolder := something.
    registerListHolder notNil ifTrue:[
        registerListHolder addDependent:self.
    ].
    newValue := registerListHolder value.
    oldValue ~~ newValue ifTrue:[
        self update:#value with:newValue from:registerListHolder.
    ].

    "Created: / 01-10-2018 / 10:08:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

variableObjectListHolder
    "return/create the 'variableObjectListHolder' value holder (automatically generated)"

    variableObjectListHolder isNil ifTrue:[
        variableObjectListHolder := ValueHolder with: #().
        variableObjectListHolder addDependent:self.
    ].
    ^ variableObjectListHolder

    "Modified: / 03-02-2018 / 07:33:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

variableObjectListHolder:something
    "set the 'variableObjectListHolder' value holder (automatically generated)"

    |oldValue newValue|

    variableObjectListHolder notNil ifTrue:[
        oldValue := variableObjectListHolder value.
        variableObjectListHolder removeDependent:self.
    ].
    variableObjectListHolder := something.
    variableObjectListHolder notNil ifTrue:[
        variableObjectListHolder addDependent:self.
    ].
    newValue := variableObjectListHolder value.
    oldValue ~~ newValue ifTrue:[
        self update:#value with:newValue from:variableObjectListHolder.
    ].
! !

!VDBFrameApplication methodsFor:'change & update'!

enqueueDelayedUpdateRegisterList
    self enqueueMessage:#delayedpdateRegisterList

    "Created: / 01-10-2018 / 10:06:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 18-02-2019 / 10:23:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

enqueueDelayedUpdateVariableObjectList
    self enqueueMessage:#delayedUpdateVariableObjectList

    "Created: / 03-02-2018 / 07:28:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 18-02-2019 / 10:23:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

update:aspect with:param from:sender
    "Invoked when an object that I depend upon sends a change notification."

    sender == frameHolder ifTrue:[ 
         self enqueueDelayedUpdateVariableObjectList.
         self enqueueDelayedUpdateRegisterList.
         ^ self.
    ].
    super update:aspect with:param from:sender

    "Created: / 03-02-2018 / 09:48:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 01-10-2018 / 12:02:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!VDBFrameApplication methodsFor:'change & update-delayed'!

delayedUpdateVariableObjectList
    | frame  list |

    debugger isNil ifTrue:[
        self variableObjectListHolder value:#().
        ^ self.
    ].
    frame := frameHolder value.
    frame isNil ifTrue:[
        self variableObjectListHolder value:#().
        ^ self.
    ].
    "/ It may happen that the variable is out of scope. In that case, we get an error
    "/ '-var-create: unable to create variable object'. So, ignore all such variables.
    "/ See GDB source code:
    "/ 
    "/    gdb/mi/mi-cmd-var.c
    "/    gdb/testsuite/gdb.mi/mi-var-cmd.exp
    list := frame variables.
    self variableObjectListHolder value:list.

    "Created: / 03-02-2018 / 07:30:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 05-07-2018 / 11:57:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

delayedpdateRegisterList
    | frame  list |

    debugger isNil ifTrue:[
        self registerListHolder value:#().
        ^ self.
    ].
    frame := frameHolder value.
    frame isNil ifTrue:[
        self registerListHolder value:#().
        ^ self.
    ].
    list := frame registers.
    self registerListHolder value:list.

    "Created: / 01-10-2018 / 10:07:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!VDBFrameApplication methodsFor:'initialization & release'!

initialize
    super initialize.
    self addApplication: (VDBVariableObjectListApplication new
                            debuggerHolder: self debuggerHolder;
                            variableObjectListHolder: self variableObjectListHolder;
                            yourself).
    self addApplication: (VDBRegisterListApplication new
                            debuggerHolder: self debuggerHolder;
                            registerListHolder: self registerListHolder;
                            yourself)

    "Created: / 01-10-2018 / 10:03:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!VDBFrameApplication class methodsFor:'documentation'!

version_HG

    ^ '$Changeset: <not expanded> $'
! !