NewInspectorView.st
author Claus Gittinger <cg@exept.de>
Sun, 01 Feb 2015 14:16:33 +0100
changeset 3178 58100b56595d
parent 2621 285fa261cbcb
permissions -rw-r--r--
class: MenuEditor fixed the following redraw bug in ModelListView (which is already fixed in SelectionInListView): if a colored item is shown with selection, the color attribute should be removed (or relaxed), to avoid drawing the label invisible. I.e. if the text color is blue or grey, and the selection bg is blue. we should draw white-on-blue, instead of blue/grey on blue. For this to work, the info whether drawing a selection must be passed down through the renderer to the item's draw routine.
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
2621
285fa261cbcb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2298
diff changeset
     3
	      All Rights Reserved
809
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
"
2298
d5467f85544f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1213
diff changeset
    12
"{ Package: 'stx:libtool2' }"
809
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    13
2621
285fa261cbcb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2298
diff changeset
    14
"{ NameSpace: Tools }"
32
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    15
1213
6cf7a4c2dfce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
    16
VariableVerticalPanel subclass:#NewInspectorView
32
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    17
	instanceVariableNames:'inspectorView userSpace workSpace inspectedObject'
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    18
	classVariableNames:''
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    19
	poolDictionaries:''
1213
6cf7a4c2dfce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
    20
	category:'Interface-NewInspector'
32
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    21
!
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    22
1213
6cf7a4c2dfce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
    23
!NewInspectorView class methodsFor:'documentation'!
32
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    24
809
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    25
copyright
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    26
"
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    27
 COPYRIGHT (c) 1997 by eXept Software AG
2621
285fa261cbcb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2298
diff changeset
    28
	      All Rights Reserved
809
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    29
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    30
 This software is furnished under a license and may be used
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    31
 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
    32
 inclusion of the above copyright notice.   This software may not
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    33
 be provided or otherwise made available to, or used by, any
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    34
 other person.  No title to or ownership of the software is
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    35
 hereby transferred.
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    36
"
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
documentation
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    42
"
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    43
    a new (multipane) inspector;
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    44
    open with:
2621
285fa261cbcb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2298
diff changeset
    45
	Tools::NewInspectorView inspect:Object
809
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    46
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    47
    install as standard inspector:
2621
285fa261cbcb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2298
diff changeset
    48
	Smalltalk at:#Inspector put:(Tools::NewInspectorView)
809
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    49
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    50
    [open with:]
2621
285fa261cbcb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2298
diff changeset
    51
	Tools::NewInspectorView
285fa261cbcb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2298
diff changeset
    52
		inspect:(Array with:#hello with:'hello' with:#(1 2 3) asSortedCollection with:Display)
809
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    53
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    54
    [author:]
2621
285fa261cbcb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2298
diff changeset
    55
	Claus Atzkern
809
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 88
diff changeset
    56
"
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
32
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    59
examples
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    60
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    61
"
39
03af455029eb *** empty log message ***
ca
parents: 32
diff changeset
    62
    open an inspector on an array
2621
285fa261cbcb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2298
diff changeset
    63
									[exBegin]
39
03af455029eb *** empty log message ***
ca
parents: 32
diff changeset
    64
    |array|
03af455029eb *** empty log message ***
ca
parents: 32
diff changeset
    65
03af455029eb *** empty log message ***
ca
parents: 32
diff changeset
    66
    array := Array new:5.
03af455029eb *** empty log message ***
ca
parents: 32
diff changeset
    67
    array at:1 put:(Array new:400).
2621
285fa261cbcb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2298
diff changeset
    68
    Tools::NewInspectorView inspect:array
285fa261cbcb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2298
diff changeset
    69
									[exEnd]
32
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    70
"
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    71
! !
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    72
1213
6cf7a4c2dfce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
    73
!NewInspectorView class methodsFor:'instance creation'!
32
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    74
811
911e51013604 added #openOn: for oldInspector compatibility.
Claus Gittinger <cg@exept.de>
parents: 810
diff changeset
    75
inspect:anObject
32
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    76
    "start inspector on an instance
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    77
    "
811
911e51013604 added #openOn: for oldInspector compatibility.
Claus Gittinger <cg@exept.de>
parents: 810
diff changeset
    78
    ^ self openOn:anObject
911e51013604 added #openOn: for oldInspector compatibility.
Claus Gittinger <cg@exept.de>
parents: 810
diff changeset
    79
!
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
openOn:anObject
911e51013604 added #openOn: for oldInspector compatibility.
Claus Gittinger <cg@exept.de>
parents: 810
diff changeset
    82
    "start an inspector on some object
911e51013604 added #openOn: for oldInspector compatibility.
Claus Gittinger <cg@exept.de>
parents: 810
diff changeset
    83
    "
911e51013604 added #openOn: for oldInspector compatibility.
Claus Gittinger <cg@exept.de>
parents: 810
diff changeset
    84
32
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    85
    |top isp|
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    86
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    87
    top := StandardSystemView new extent:600@400.
1213
6cf7a4c2dfce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
    88
    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
    89
    isp inspect:anObject.
32
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    90
    top open.
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    91
811
911e51013604 added #openOn: for oldInspector compatibility.
Claus Gittinger <cg@exept.de>
parents: 810
diff changeset
    92
    ^ isp.
32
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    93
! !
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    94
1213
6cf7a4c2dfce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
    95
!NewInspectorView methodsFor:'accessing'!
32
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    96
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    97
inspect:anInstance
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    98
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
    99
    inspectedObject := anInstance.
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   100
    self topView label:(inspectedObject class name asString).
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   101
    inspectorView inspect:anInstance.
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   102
    self updateWorkSpace.
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   103
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   104
! !
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   105
1213
6cf7a4c2dfce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   106
!NewInspectorView methodsFor:'initialization'!
32
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   107
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   108
initialize
88
d6dccf1ad344 correctly compute height of the middle workspace
Claus Gittinger <cg@exept.de>
parents: 39
diff changeset
   109
    |view wsHeight|
32
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   110
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   111
    super initialize.
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   112
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   113
    view := SimpleView origin:0.0 @ 0.0 corner:1.0 @ 0.5 in:self.
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   114
1213
6cf7a4c2dfce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   115
    inspectorView := NewInspectorPanelView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:view.
32
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   116
    workSpace     := Workspace          origin:0.0 @ 1.0 corner:1.0 @ 1.0 in:view.
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   117
    userSpace     := Workspace          origin:0.0 @ 0.5 corner:1.0 @ 1.0 in:self.
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   118
88
d6dccf1ad344 correctly compute height of the middle workspace
Claus Gittinger <cg@exept.de>
parents: 39
diff changeset
   119
    wsHeight := (workSpace preferredExtentForLines:1 cols:10) y.
d6dccf1ad344 correctly compute height of the middle workspace
Claus Gittinger <cg@exept.de>
parents: 39
diff changeset
   120
    workSpace     topInset:wsHeight negated.
d6dccf1ad344 correctly compute height of the middle workspace
Claus Gittinger <cg@exept.de>
parents: 39
diff changeset
   121
    inspectorView bottomInset:wsHeight.
32
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   122
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   123
    userSpace acceptAction:[:theText|inspectorView accept:theText notifying:workSpace].
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   124
    workSpace acceptAction:[:theText|inspectorView accept:theText notifying:workSpace].
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   125
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   126
    userSpace   doItAction:[:theCode|inspectorView doIt:theCode notifying:workSpace].
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   127
    workSpace   doItAction:[:theCode|inspectorView doIt:theCode notifying:workSpace].
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   128
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   129
    inspectorView action:[:el|self updateWorkSpace].
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   130
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   131
    inspectorView valueChangedAction:[:el||lbl|
2621
285fa261cbcb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2298
diff changeset
   132
	workSpace list:(Array with:(el displayString)).
32
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   133
    ].
88
d6dccf1ad344 correctly compute height of the middle workspace
Claus Gittinger <cg@exept.de>
parents: 39
diff changeset
   134
d6dccf1ad344 correctly compute height of the middle workspace
Claus Gittinger <cg@exept.de>
parents: 39
diff changeset
   135
    "Modified: 18.3.1997 / 10:57:34 / cg"
32
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   136
! !
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   137
1213
6cf7a4c2dfce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   138
!NewInspectorView methodsFor:'update'!
32
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   139
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   140
updateWorkSpace
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   141
    "update the workSpace
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   142
    "
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   143
    workSpace list:(Array with:(inspectorView selectedInstanceVar displayString)).
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   144
! !
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   145
1213
6cf7a4c2dfce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   146
!NewInspectorView class methodsFor:'documentation'!
32
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   147
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   148
version
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   149
    ^ '$Header$'
9dfc1899e849 intitial checkin
ca
parents:
diff changeset
   150
! !