NewInspectorView.st
author Claus Gittinger <cg@exept.de>
Tue, 03 Feb 2004 16:08:53 +0100
changeset 1781 d67090b1ad57
parent 1213 6cf7a4c2dfce
child 2298 d5467f85544f
permissions -rw-r--r--
resources shared with UIPainter class
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
809
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
     1
"
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
     2
 COPYRIGHT (c) 1997 by eXept Software AG
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
     3
              All Rights Reserved
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
     4
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
     5
 This software is furnished under a license and may be used
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
     6
 only in accordance with the terms of that license and with the
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
     8
 be provided or otherwise made available to, or used by, any
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
     9
 other person.  No title to or ownership of the software is
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    10
 hereby transferred.
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    11
"
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    12
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    13
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    14
32
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    15
"{ NameSpace: NewInspector }"
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    16
1213
6cf7a4c2dfce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
    17
VariableVerticalPanel subclass:#NewInspectorView
32
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    18
	instanceVariableNames:'inspectorView userSpace workSpace inspectedObject'
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    19
	classVariableNames:''
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    20
	poolDictionaries:''
1213
6cf7a4c2dfce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
    21
	category:'Interface-NewInspector'
32
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    22
!
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    23
1213
6cf7a4c2dfce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
    24
!NewInspectorView class methodsFor:'documentation'!
32
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    25
809
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    26
copyright
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    27
"
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    28
 COPYRIGHT (c) 1997 by eXept Software AG
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    29
              All Rights Reserved
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    30
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    31
 This software is furnished under a license and may be used
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    32
 only in accordance with the terms of that license and with the
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    33
 inclusion of the above copyright notice.   This software may not
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    34
 be provided or otherwise made available to, or used by, any
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    35
 other person.  No title to or ownership of the software is
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    36
 hereby transferred.
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    37
"
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    38
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    39
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    40
!
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    41
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    42
documentation
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    43
"
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    44
    a new (multipane) inspector;
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    45
    open with:
1213
6cf7a4c2dfce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
    46
        NewInspector::NewInspectorView inspect:someObject
809
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    47
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    48
    install as standard inspector:
1213
6cf7a4c2dfce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
    49
        Smalltalk at:#Inspector put:(NewInspector::NewInspectorView)
809
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    50
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    51
    [open with:]
1213
6cf7a4c2dfce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
    52
        NewInspector::NewInspectorView 
809
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    53
                inspect:(Array with:#hello with:'hello' with:#(1 2 3) asSortedCollection with:Display)
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    54
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    55
    [author:]
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    56
        Claus Atzkern
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    57
"
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    58
!
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    59
32
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    60
examples
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    61
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    62
"
39
03af455029eb *** empty log message ***
ca
parents: 32
diff changeset
    63
    open an inspector on an array
03af455029eb *** empty log message ***
ca
parents: 32
diff changeset
    64
                                                                        [exBegin]
03af455029eb *** empty log message ***
ca
parents: 32
diff changeset
    65
    |array|
03af455029eb *** empty log message ***
ca
parents: 32
diff changeset
    66
03af455029eb *** empty log message ***
ca
parents: 32
diff changeset
    67
    array := Array new:5.
03af455029eb *** empty log message ***
ca
parents: 32
diff changeset
    68
    array at:1 put:(Array new:400).
1213
6cf7a4c2dfce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
    69
    NewInspector::NewInspectorView inspect:array
39
03af455029eb *** empty log message ***
ca
parents: 32
diff changeset
    70
                                                                        [exEnd]
32
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    71
"
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    72
! !
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    73
1213
6cf7a4c2dfce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
    74
!NewInspectorView class methodsFor:'instance creation'!
32
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    75
811
911e51013604 added #openOn: for oldInspector compatibility.
Claus Gittinger <cg@exept.de>
parents: 810
diff changeset
    76
inspect:anObject
32
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    77
    "start inspector on an instance
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    78
    "
811
911e51013604 added #openOn: for oldInspector compatibility.
Claus Gittinger <cg@exept.de>
parents: 810
diff changeset
    79
    ^ self openOn:anObject
911e51013604 added #openOn: for oldInspector compatibility.
Claus Gittinger <cg@exept.de>
parents: 810
diff changeset
    80
!
911e51013604 added #openOn: for oldInspector compatibility.
Claus Gittinger <cg@exept.de>
parents: 810
diff changeset
    81
911e51013604 added #openOn: for oldInspector compatibility.
Claus Gittinger <cg@exept.de>
parents: 810
diff changeset
    82
openOn:anObject
911e51013604 added #openOn: for oldInspector compatibility.
Claus Gittinger <cg@exept.de>
parents: 810
diff changeset
    83
    "start an inspector on some object
911e51013604 added #openOn: for oldInspector compatibility.
Claus Gittinger <cg@exept.de>
parents: 810
diff changeset
    84
    "
911e51013604 added #openOn: for oldInspector compatibility.
Claus Gittinger <cg@exept.de>
parents: 810
diff changeset
    85
32
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    86
    |top isp|
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    87
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    88
    top := StandardSystemView new extent:600@400.
1213
6cf7a4c2dfce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
    89
    isp := NewInspectorView origin:0.0@0.0  corner:1.0@1.0 in:top.
811
911e51013604 added #openOn: for oldInspector compatibility.
Claus Gittinger <cg@exept.de>
parents: 810
diff changeset
    90
    isp inspect:anObject.
32
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    91
    top open.
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    92
811
911e51013604 added #openOn: for oldInspector compatibility.
Claus Gittinger <cg@exept.de>
parents: 810
diff changeset
    93
    ^ isp.
32
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    94
! !
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    95
1213
6cf7a4c2dfce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
    96
!NewInspectorView methodsFor:'accessing'!
32
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    97
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    98
inspect:anInstance
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    99
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   100
    inspectedObject := anInstance.
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   101
    self topView label:(inspectedObject class name asString).
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   102
    inspectorView inspect:anInstance.
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   103
    self updateWorkSpace.
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   104
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   105
! !
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   106
1213
6cf7a4c2dfce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   107
!NewInspectorView methodsFor:'initialization'!
32
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   108
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   109
initialize
88
d6dccf1ad344 correctly compute height of the middle workspace
Claus Gittinger <cg@exept.de>
parents: 39
diff changeset
   110
    |view wsHeight|
32
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   111
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   112
    super initialize.
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   113
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   114
    view := SimpleView origin:0.0 @ 0.0 corner:1.0 @ 0.5 in:self.
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   115
1213
6cf7a4c2dfce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   116
    inspectorView := NewInspectorPanelView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:view.
32
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   117
    workSpace     := Workspace          origin:0.0 @ 1.0 corner:1.0 @ 1.0 in:view.
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   118
    userSpace     := Workspace          origin:0.0 @ 0.5 corner:1.0 @ 1.0 in:self.
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   119
88
d6dccf1ad344 correctly compute height of the middle workspace
Claus Gittinger <cg@exept.de>
parents: 39
diff changeset
   120
    wsHeight := (workSpace preferredExtentForLines:1 cols:10) y.
d6dccf1ad344 correctly compute height of the middle workspace
Claus Gittinger <cg@exept.de>
parents: 39
diff changeset
   121
    workSpace     topInset:wsHeight negated.
d6dccf1ad344 correctly compute height of the middle workspace
Claus Gittinger <cg@exept.de>
parents: 39
diff changeset
   122
    inspectorView bottomInset:wsHeight.
32
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   123
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   124
    userSpace acceptAction:[:theText|inspectorView accept:theText notifying:workSpace].
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   125
    workSpace acceptAction:[:theText|inspectorView accept:theText notifying:workSpace].
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   126
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   127
    userSpace   doItAction:[:theCode|inspectorView doIt:theCode notifying:workSpace].
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   128
    workSpace   doItAction:[:theCode|inspectorView doIt:theCode notifying:workSpace].
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   129
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   130
    inspectorView action:[:el|self updateWorkSpace].
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   131
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   132
    inspectorView valueChangedAction:[:el||lbl|
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   133
        workSpace list:(Array with:(el displayString)).
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   134
    ].
88
d6dccf1ad344 correctly compute height of the middle workspace
Claus Gittinger <cg@exept.de>
parents: 39
diff changeset
   135
d6dccf1ad344 correctly compute height of the middle workspace
Claus Gittinger <cg@exept.de>
parents: 39
diff changeset
   136
    "Modified: 18.3.1997 / 10:57:34 / cg"
32
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   137
! !
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   138
1213
6cf7a4c2dfce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   139
!NewInspectorView methodsFor:'update'!
32
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   140
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   141
updateWorkSpace
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   142
    "update the workSpace
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   143
    "
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   144
    workSpace list:(Array with:(inspectorView selectedInstanceVar displayString)).
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   145
! !
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   146
1213
6cf7a4c2dfce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   147
!NewInspectorView class methodsFor:'documentation'!
32
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   148
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   149
version
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   150
    ^ '$Header$'
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   151
! !