Tools__ViewTreeApplication.st
author Claus Gittinger <cg@exept.de>
Thu, 29 Aug 2013 00:52:54 +0200
changeset 3049 292d06e8b7ae
parent 3040 b62c4b71910c
child 3070 648aad0e3777
permissions -rw-r--r--
class: Tools::ViewTreeInspectorApplication
comment/format in: #inspectorModeIndexHolder
changed:6 methods
cg@2748
     1
"
cg@2748
     2
 COPYRIGHT (c) 2007 by eXept Software AG
cg@2748
     3
              All Rights Reserved
cg@2748
     4
cg@2748
     5
 This software is furnished under a license and may be used
cg@2748
     6
 only in accordance with the terms of that license and with the
cg@2748
     7
 inclusion of the above copyright notice.   This software may not
cg@2748
     8
 be provided or otherwise made available to, or used by, any
cg@2748
     9
 other person.  No title to or ownership of the software is
cg@2748
    10
 hereby transferred.
cg@2748
    11
"
ca@2177
    12
"{ Package: 'stx:libtool2' }"
ca@2177
    13
ca@2177
    14
"{ NameSpace: Tools }"
ca@2177
    15
cg@2744
    16
ToolApplicationModel subclass:#ViewTreeInspectorApplication
ca@2177
    17
	instanceVariableNames:'model treeView hasSingleSelectionHolder clickedItem clickedPoint
cg@2770
    18
		motionAction process followFocusChannel showNamesHolder
cg@3037
    19
		inspectorView inspectorModeIndexHolder'
ca@2177
    20
	classVariableNames:''
ca@2177
    21
	poolDictionaries:''
cg@2744
    22
	category:'Interface-Smalltalk'
ca@2177
    23
!
ca@2177
    24
ca@2177
    25
Object subclass:#MenuDesc
ca@2177
    26
	instanceVariableNames:'title value action'
ca@2177
    27
	classVariableNames:''
ca@2177
    28
	poolDictionaries:''
cg@2744
    29
	privateIn:ViewTreeInspectorApplication
ca@2177
    30
!
ca@2177
    31
cg@2744
    32
HierarchicalItem subclass:#ViewTreeItem
cg@2744
    33
	instanceVariableNames:'widget isDrawnShown exists xOffsetAdditionalName'
cg@2744
    34
	classVariableNames:'HandleExtent'
cg@2744
    35
	poolDictionaries:''
cg@2744
    36
	privateIn:ViewTreeInspectorApplication
cg@2744
    37
!
cg@2744
    38
cg@2744
    39
ValueModel subclass:#ViewTreeModel
cg@2744
    40
	instanceVariableNames:'lockSema selectedSuperItems selection hiddenLevel listOfItems
cg@2744
    41
		inputEventAction mappedViewAction beforeSelectionChangedAction
cg@2744
    42
		icons timedUpdateTask selectOnClickHolder testModeChannel
cg@2978
    43
		hasTargetWidgetChannel catchEvents'
cg@2744
    44
	classVariableNames:''
cg@2744
    45
	poolDictionaries:''
cg@2744
    46
	privateIn:ViewTreeInspectorApplication
cg@2744
    47
!
cg@2744
    48
cg@2744
    49
HierarchicalList subclass:#ItemList
cg@2744
    50
	instanceVariableNames:'treeModel eventHook eventHookInitialized showWidgetNames'
cg@2744
    51
	classVariableNames:''
cg@2744
    52
	poolDictionaries:''
cg@2744
    53
	privateIn:ViewTreeInspectorApplication::ViewTreeModel
cg@2744
    54
!
cg@2744
    55
cg@2744
    56
!ViewTreeInspectorApplication class methodsFor:'documentation'!
ca@2177
    57
cg@2748
    58
copyright
cg@2748
    59
"
cg@2748
    60
 COPYRIGHT (c) 2007 by eXept Software AG
cg@2748
    61
              All Rights Reserved
cg@2748
    62
cg@2748
    63
 This software is furnished under a license and may be used
cg@2748
    64
 only in accordance with the terms of that license and with the
cg@2748
    65
 inclusion of the above copyright notice.   This software may not
cg@2748
    66
 be provided or otherwise made available to, or used by, any
cg@2748
    67
 other person.  No title to or ownership of the software is
cg@2748
    68
 hereby transferred.
cg@2748
    69
"
cg@2748
    70
!
cg@2748
    71
ca@2177
    72
documentation
ca@2177
    73
"
ca@2177
    74
     Small application showing a ViewTreeModel use.
ca@2177
    75
ca@2177
    76
     It displays a hierarchical list of a selected TopView and
ca@2177
    77
     all its contained subViews.
ca@2177
    78
     Useful to have a look at subcomponents - to see how views
ca@2177
    79
     are structured.
ca@2177
    80
ca@2177
    81
ca@2177
    82
    [Instance variables:]
ca@2177
    83
        model           <ViewTreeModel>      the used ViewTreeModel
ca@2177
    84
        clickedItem     <ViewTreeItem>       item under the clickedPoint (motion action)
ca@2177
    85
        clickedPoint    <Point>              point where the motion action started from.
ca@2177
    86
        motionAction    <Action>             (oneArg-) action called durring buttonMotion.
ca@2177
    87
ca@2177
    88
ca@2177
    89
    [author:]
ca@2177
    90
        Claus Atzkern
ca@2177
    91
ca@2177
    92
    [see also:]
ca@2177
    93
        ViewTreeModel
ca@2177
    94
        ViewTreeItem
ca@2177
    95
"
ca@2177
    96
! !
ca@2177
    97
cg@2744
    98
!ViewTreeInspectorApplication class methodsFor:'initialization'!
ca@2177
    99
ca@2177
   100
initialize
ca@2177
   101
    "add myself to the launcher menu
ca@2177
   102
    "
ca@2177
   103
    self installInLauncher.
ca@2177
   104
!
ca@2177
   105
ca@2177
   106
installInLauncher
cg@2744
   107
    "add myself to the launcher menu"
cg@2744
   108
ca@2177
   109
    |menuItem icon|
ca@2177
   110
ca@2177
   111
    NewLauncher isNil ifTrue:[^ self].
cg@2744
   112
    "/ cg - disabled. the icon is too ugly.
cg@2744
   113
    ^ self.
ca@2177
   114
ca@2177
   115
    icon := ToolbarIconLibrary inspectLocals20x20Icon magnifiedTo:28@28.
ca@2177
   116
ca@2177
   117
    menuItem := MenuItem new 
cg@2744
   118
                    label: 'View Tree Inspector';
cg@2744
   119
                    value: [ ViewTreeInspectorApplication open];
ca@2177
   120
                    isButton: true;
ca@2177
   121
                    icon: icon;
ca@2177
   122
                    nameKey: #viewInspect.
ca@2177
   123
ca@2177
   124
    menuItem startGroup:#right.
ca@2177
   125
    NewLauncher addMenuItem:menuItem in:'toolbar'
ca@2177
   126
                   position:#( #before #help)
ca@2177
   127
                      space:false.
ca@2177
   128
ca@2177
   129
"
ca@2177
   130
self installInLauncher
ca@2177
   131
self removeFromLauncher
ca@2177
   132
"
ca@2177
   133
!
ca@2177
   134
ca@2177
   135
postAutoload
ca@2177
   136
    "add myself to the launcher menu
ca@2177
   137
    "
ca@2177
   138
    self installInLauncher.
ca@2177
   139
"
ca@2177
   140
self installInLauncher
ca@2177
   141
self removeFromLauncher
ca@2177
   142
"
ca@2177
   143
!
ca@2177
   144
ca@2177
   145
removeFromLauncher
ca@2177
   146
    "remove myself from the launcher menu
ca@2177
   147
    "
ca@2177
   148
    NewLauncher isNil ifTrue:[^ self].
ca@2177
   149
    NewLauncher removeUserTool:#viewInspect
ca@2177
   150
ca@2177
   151
"
ca@2177
   152
self installInLauncher
ca@2177
   153
self removeFromLauncher
ca@2177
   154
"
ca@2177
   155
!
ca@2177
   156
ca@2177
   157
unload
ca@2177
   158
    "class is about to be unloaded - remove myself from the launcher menu
ca@2177
   159
    "
ca@2177
   160
    self removeFromLauncher.
ca@2177
   161
    super unload.
ca@2177
   162
! !
ca@2177
   163
cg@2744
   164
!ViewTreeInspectorApplication class methodsFor:'image specs'!
cg@2744
   165
cg@2759
   166
crossHairIcon
cg@2759
   167
    "This resource specification was automatically generated
cg@2759
   168
     by the ImageEditor of ST/X."
cg@2759
   169
cg@2759
   170
    "Do not manually edit this!! If it is corrupted,
cg@2759
   171
     the ImageEditor may not be able to read the specification."
cg@2759
   172
cg@2759
   173
    "
cg@2759
   174
     self crossHairIcon inspect
cg@2759
   175
     ImageEditor openOnClass:self andSelector:#crossHairIcon
cg@2759
   176
     Icon flushCachedIcons
cg@2759
   177
    "
cg@2759
   178
cg@2759
   179
    <resource: #image>
cg@2759
   180
cg@2759
   181
    ^Icon
cg@2759
   182
        constantNamed:'Tools::ViewTreeInspectorApplication class crossHairIcon'
cg@2759
   183
        ifAbsentPut:[(Depth1Image new) width: 24; height: 24; photometric:(#palette); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@F0@@XL@@>>@A8O@A>?@B,Z B(J @@@@B(J B,Z A>?@A8O@@>>@@XL@@F0@@@@@@@@@@@@@@@@@@@@@') ; colorMapFromArray:#[255 255 255 0 0 0]; mask:((Depth1Image new) width: 24; height: 24; photometric:(#blackIs0); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@G0@@_<@@?>@A??@C?? C?? G??0G<_0G<_0G<_0G??0C?? C?? A??@@?>@@_<@@G0@@@@@@@@@@@@@@@@@') ; yourself); yourself]
cg@2759
   184
!
cg@2759
   185
cg@2744
   186
pickWindowIcon
cg@2744
   187
    "This resource specification was automatically generated
cg@2744
   188
     by the ImageEditor of ST/X."
cg@2744
   189
cg@2744
   190
    "Do not manually edit this!! If it is corrupted,
cg@2744
   191
     the ImageEditor may not be able to read the specification."
cg@2744
   192
cg@2744
   193
    "
cg@2744
   194
     self pickWindowIcon inspect
cg@2744
   195
     ImageEditor openOnClass:self andSelector:#pickWindowIcon
cg@2744
   196
     Icon flushCachedIcons
cg@2744
   197
    "
cg@2744
   198
cg@2744
   199
    <resource: #image>
cg@2744
   200
cg@2744
   201
    ^Icon
cg@2744
   202
        constantNamed:'Tools::ViewTreeInspectorApplication class pickWindowIcon'
cg@2744
   203
        ifAbsentPut:[(Depth8Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#[8]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
cg@2744
   204
,;N3,;N3,;N3,;N3,;N3,;N3,;N3,3H<P38;M3P,H2@^GA(VEQHQCP0KA D<[&-%XU=WST%BN#D!!GQ$TD@(IBP\BQF)+Z6E_U4-FPCX+G1,WEA@JBP$HAT23
cg@2744
   205
,;N3,;N3,;N3,;N$():Z&IRR&1!!^,;N3,;N3,;N3,;N$)JJ^&)"T$),0W[N3,;N3,;N3,;N3,:R"'')*X%IJWK523,;N3,;N3,0@@@KN3)JJ^&)"T$"5Z,;N3
cg@2744
   206
,;N3@@B3-KL@@JJ^&)"T$)D*V[N3,;N3@KN3-KR4)JH@&)"T$)*MJE"3,;N3,0B3)JJ4&*R"@I*X%IJZ#RYV,;N3,0B3@JR"-JR"-I(@%IJV%H %U[N3,;L@
cg@2744
   207
-@B4-KR4-KR4@IRR%IJEIER3,;N3@KL@)JJ4():4&@BO#9RR!!RIS,;N3,;L@,:R"-JJ^& BT#8>O#8H"T+N3,;N3@KN$@@@@'')(@%H>O#(>AH%F3,;N3,;L@
cg@2744
   208
@JR4'' @@%IJO#8>O RIO,;N3,;N3):P@@@BX%IJO#8>O#7<"S*63,;N$():Z&IRR&IRR#8>O#8=>H"&-,;N$():Z&IRR&)"T$(>O#8>O @<)R$!!GQTD?OS$8
cg@2744
   209
MSL.I2H"H"H"H"HO,;N3,;N3,;N3,;N3,;N3,;N3,;N3,0@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@a') ; colorMapFromArray:#[0 0 0 0 50 164 0 50 171 0 137 0 0 206 0 1 50 177 2 56 178 3 64 241 3 67 246 3 73 255 4 74 255 5 63 191 7 66 194 10 71 196 10 79 255 12 59 167 12 82 255 14 77 199 18 83 201 19 88 255 21 91 255 23 89 204 27 95 206 28 97 255 29 72 179 30 100 255 32 101 209 36 106 255 36 107 211 39 109 255 41 113 214 45 115 255 45 119 216 48 118 255 50 87 176 50 125 219 51 88 176 51 88 177 52 89 178 52 90 178 53 90 178 53 127 212 54 91 179 54 123 255 54 131 221 55 92 180 55 95 181 56 93 180 56 94 181 57 127 255 57 149 229 58 99 184 58 137 224 61 104 187 63 132 255 63 143 226 64 108 190 66 113 193 66 135 255 67 149 229 68 157 232 69 117 196 71 155 231 72 122 199 72 141 255 75 126 202 75 144 255 75 160 234 77 163 236 78 131 206 80 149 255 81 136 209 84 140 212 84 153 255 87 145 215 88 157 255 91 168 235 93 161 255 94 154 222 96 157 223 96 165 255 97 159 225 98 160 225 98 162 226 99 163 227 100 165 228 101 166 229 101 170 255 102 167 230 103 169 231 104 170 232 104 173 255 105 172 233 105 174 234 106 175 235 109 178 255 112 180 255 117 186 255 119 187 255 122 154 245 125 160 253 125 193 255 126 161 253 126 194 255 127 162 254 130 165 254 132 200 255 132 201 255 133 60 36 135 170 255 139 207 255 140 175 255 144 179 255 149 184 255 153 188 255 157 192 255 162 196 255 166 200 255 170 204 255 174 208 255 174 218 230 177 212 255 181 215 255 185 219 255 188 222 255 191 225 255 212 211 224 218 217 230 219 219 230 220 220 231 222 221 232 223 223 233 225 224 234 225 225 234 226 226 237 227 226 235 227 227 236 227 227 238 228 228 237 229 229 239 231 230 238 231 231 238 231 231 240 232 232 241 233 232 239 233 233 240 234 234 242 235 234 241 236 236 243 237 236 242 237 237 244 238 237 243 238 238 244 239 238 243 239 239 245 240 239 244 241 240 245 241 241 246 241 241 247 242 242 246 242 242 247 243 243 247 243 243 248 244 244 248 244 244 249 245 244 247 246 246 249 246 246 250 247 246 249 247 247 250 248 248 251 249 249 250 249 249 251 250 250 251 250 250 252 251 251 252 251 251 253 253 253 254 254 254 255 255 255 255 0 0 0]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@C????????????????????????????????????????????????????????????????????????????????@@@C') ; yourself); yourself]
cg@2759
   210
!
cg@2759
   211
cg@2759
   212
pickWindowIcon2
cg@2759
   213
    "This resource specification was automatically generated
cg@2759
   214
     by the ImageEditor of ST/X."
cg@2759
   215
cg@2759
   216
    "Do not manually edit this!! If it is corrupted,
cg@2759
   217
     the ImageEditor may not be able to read the specification."
cg@2759
   218
cg@2759
   219
    "
cg@2759
   220
     self pickWindowIcon2 inspect
cg@2759
   221
     ImageEditor openOnClass:self andSelector:#pickWindowIcon2
cg@2759
   222
     Icon flushCachedIcons
cg@2759
   223
    "
cg@2759
   224
cg@2759
   225
    <resource: #image>
cg@2759
   226
cg@2759
   227
    ^Icon
cg@2759
   228
        constantNamed:'Tools::ViewTreeInspectorApplication class pickWindowIcon2'
cg@2759
   229
        ifAbsentPut:[(Depth8Image new) width: 22; height: 23; photometric:(#palette); bitsPerSample:(#[8]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
cg@2759
   230
@CH<O#,7MB0#HA8\F!!XUD!!DMC@,F@P@<[&U!!W5]MRTH:LRD]FQPPB $IA0H@QF)+XU=WR4Y@M",_F1\TD@(IBP E@D23,;N3,;N3,;N3,;N"'')*X%IJ[F@A^
cg@2759
   231
,;N3,;N3,0@@@@@@():Z&IRR&3@@W+N3,;N3@@B3,0B3)@@@&)"T$),0@E63,;N3@KN3@@@@@@B"'' BX%IJWK0A\,;N3@KN3,;N3@JR"'')*X@IRR&24@V+N3
cg@2759
   232
@KN3,;L@@@@@@I:Z&IP@$),*@E&3,0B3,;N3,:P@():Z&IRT@IJ[J@AX,0B3@KL@,;L@@@B^& BT@IP@&2X@U+L@,0B3@KL@)JJ^@I @%@BT@I,%@EV3@@@@
cg@2759
   233
@@@@@JR"'' @@@@@@@@B[I@AT,0B3@KL@)@B$()8@&@BZ@IP@&2H@T;L@,0B3@JR$@@@@%I @& BT@I,"@EJ3,0B3,:R$)I8@&IRX%I*X@IJ[H AQ,;L@,:R$
cg@2759
   234
)@@@@@@@&IRO#0BO RH@S;N3,0B$)JR"'' BX%I"T#0BO#7<"@D:-,;N$@JR$@@@@@@BR#0BO#8=>H AN+[N$)JH@@I"T@I"T@@BO#8>O_"H@JZ63)JJ^&) @
cg@2759
   235
@@@@@IJO#8>O#8@O@B&3,;N3,;N3,;N3,;N"'')*X%IJ[C0@)R$]EPS<=NS 5L28''H"H"H"H"H <b') ; colorMapFromArray:#[0 0 0 0 50 164 0 50 171 0 137 0 0 206 0 1 50 177 2 56 178 3 64 241 3 67 246 3 73 255 4 74 255 5 63 191 7 66 194 10 71 196 10 79 255 12 59 167 12 82 255 14 77 199 18 83 201 19 88 255 21 91 255 23 89 204 27 95 206 28 97 255 29 72 179 30 100 255 32 101 209 36 106 255 36 107 211 39 109 255 41 113 214 45 115 255 45 119 216 48 118 255 50 87 176 50 125 219 51 88 176 51 88 177 52 89 178 52 90 178 53 90 178 53 127 212 54 91 179 54 123 255 54 131 221 55 92 180 55 95 181 56 93 180 56 94 181 57 127 255 57 149 229 58 99 184 58 137 224 61 104 187 63 132 255 63 143 226 64 108 190 66 113 193 66 135 255 67 149 229 68 157 232 69 117 196 71 155 231 72 122 199 72 141 255 75 126 202 75 144 255 75 160 234 77 163 236 78 131 206 80 149 255 81 136 209 84 140 212 84 153 255 87 145 215 88 157 255 91 168 235 93 161 255 94 154 222 96 157 223 96 165 255 97 159 225 98 160 225 98 162 226 99 163 227 100 165 228 101 166 229 101 170 255 102 167 230 103 169 231 104 170 232 104 173 255 105 172 233 105 174 234 106 175 235 109 178 255 112 180 255 117 186 255 119 187 255 122 154 245 125 160 253 125 193 255 126 161 253 126 194 255 127 162 254 130 165 254 132 200 255 132 201 255 133 60 36 135 170 255 139 207 255 140 175 255 144 179 255 149 184 255 153 188 255 157 192 255 162 196 255 166 200 255 170 204 255 174 208 255 174 218 230 177 212 255 181 215 255 185 219 255 188 222 255 191 225 255 212 211 224 218 217 230 219 219 230 220 220 231 222 221 232 223 223 233 225 224 234 225 225 234 226 226 237 227 226 235 227 227 236 227 227 238 228 228 237 229 229 239 231 230 238 231 231 238 231 231 240 232 232 241 233 232 239 233 233 240 234 234 242 235 234 241 236 236 243 237 236 242 237 237 244 238 237 243 238 238 244 239 238 243 239 239 245 240 239 244 241 240 245 241 241 246 241 241 247 242 242 246 242 242 247 243 243 247 243 243 248 244 244 248 244 244 249 245 244 247 246 246 249 246 246 250 247 246 249 247 247 250 248 248 251 249 249 250 249 249 251 250 250 251 250 250 252 251 251 252 251 251 253 253 253 254 254 254 255 255 255 255]; mask:((Depth1Image new) width: 22; height: 23; photometric:(#blackIs0); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'_??<_??<_??<_??<_??<_??<_??<_??<_??<_??<_??<_??<_??<_??<_??<_??<_??<_??<_??<_??<_??<_??<_??<') ; yourself); yourself]
cg@3000
   236
!
cg@3000
   237
cg@3000
   238
releaseViewIcon
cg@3000
   239
    "This resource specification was automatically generated
cg@3000
   240
     by the ImageEditor of ST/X."
cg@3000
   241
cg@3000
   242
    "Do not manually edit this!! If it is corrupted,
cg@3000
   243
     the ImageEditor may not be able to read the specification."
cg@3000
   244
cg@3000
   245
    "
cg@3000
   246
     self releaseViewIcon inspect
cg@3000
   247
     ImageEditor openOnClass:self andSelector:#releaseViewIcon
cg@3000
   248
     Icon flushCachedIcons
cg@3000
   249
    "
cg@3000
   250
cg@3000
   251
    <resource: #image>
cg@3000
   252
cg@3000
   253
    ^Icon
cg@3000
   254
        constantNamed:'Tools::ViewTreeInspectorApplication releaseViewIcon'
cg@3000
   255
        ifAbsentPut:[(Depth8Image new) width: 24; height: 24; photometric:(#palette); bitsPerSample:(#[8]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
cg@3000
   256
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
cg@3000
   257
@@@@@@@@@@@@@@A8^G!!7O3ACP5*P@@A8^G @@@@@@@@@@@A8^@@@OE0/!!P0S#0@@^G @@@@@@@@@@@B (@@''D#48"1.CX5H@(J@@@@@@@@@@@@B (@@@@@@"
cg@3000
   258
''%!!/P7,@(J@@@@@@@@@@@@@%I@@@@BH%IRTQV5P@IRT@@@@@@@@@@@ANSP@@@@ANS$8:T80@S$8@@@@@@@@@@@AN&UYWK(EYQ@\FUPQHXT8@@@@@@@@@@@AN
cg@3000
   259
HC2!!TVY:Y#-%I*IKMD8@@@@@@@@@@@A$\@83XBEG%).GGX _!!&P@@@@@@@@@@@AO[P5+ &(WPYN@["!!E\$<@@@@@@@@@@@B_F''FQPAXX_!!&TGH4HB9<@@@@@
cg@3000
   260
@@@@@@B_%3HCJ7=BKPU,Q)01B9<@@@@@@@@@@@@PBP8T_F!!''JPI)_Y"D&!!@@@@@@@@@@@@@$B)I9TGXO''WQIWQ93W0@@@@@@@@@@@@@$"U=JR$)JR$)JR$)_
cg@3000
   261
"P@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
cg@3000
   262
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@') ; colorMapFromArray:#[132 141 152 147 150 154 250 223 1 246 214 0 205 172 133 238 195 0 213 180 146 217 186 150 188 136 0 206 151 0 183 125 9 208 208 202 196 204 214 255 255 210 255 255 219 210 178 65 242 242 235 106 112 117 96 107 126 250 255 255 255 241 0 154 154 151 255 227 0 67 35 0 52 17 0 253 211 0 208 159 0 167 178 193 222 168 0 248 231 45 208 174 26 199 152 26 225 184 36 255 249 75 220 220 215 77 88 108 241 241 235 245 245 239 255 250 109 242 249 255 255 255 142 255 237 1 142 148 162 242 212 1 143 154 176 174 133 0 222 189 144 169 179 192 177 184 193 184 129 0 255 255 194 253 241 60 210 210 205 214 214 209 77 83 92 230 230 225 98 106 114 243 243 238 117 117 114 255 252 115 255 255 255 115 123 147 130 140 156 152 156 159 241 210 0 53 18 0 151 116 0 162 170 184 218 187 150 193 143 4 220 165 0 206 188 46 181 130 21 204 173 44 206 206 201 208 167 44 72 84 108 240 240 234 244 244 238 243 243 237 212 182 79 255 255 126 131 135 141 119 133 159 132 141 163 195 162 126 219 188 133 218 185 135 180 180 176 221 190 150 175 181 191 176 183 196 181 189 201 202 170 38 209 209 204 207 207 202 251 241 74 229 229 224 238 238 233 226 234 245 244 244 237 255 251 113 255 255 124 255 241 2 255 234 3 249 219 0 255 249 29 252 243 30 227 181 0 212 165 5 222 170 0 173 179 194 216 171 19 255 255 198 208 208 203 156 90 7 206 175 50 91 91 95 211 180 71 242 242 237 246 246 241 212 182 80 255 255 123 129 137 152 255 239 8 251 223 0 59 25 0 251 215 0 228 183 0 222 191 149 249 238 43 177 186 197 187 129 0 186 194 206 209 209 203 249 238 67 255 255 211 226 226 221 235 235 229 100 103 111 76 93 127 255 255 112 88 104 139 130 135 148 149 155 158 247 218 0 224 194 126 255 217 0 228 184 0 13 30 68 161 138 32 204 152 0 255 255 53 206 155 18 207 207 201 255 250 72 255 255 82 209 176 59 232 232 227 243 243 236 245 245 240 255 255 115 255 255 251]; mask:((Depth1Image new) width: 24; height: 24; photometric:(#blackIs0); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@G8@@O<@@O>@@@^@@@N@@@N@@?? @?? @?? @?? @?? @?? @?? @?? @_?@@@@@@@@@@@@@@@@@@@@@') ; yourself); yourself]
cg@2744
   263
! !
cg@2744
   264
cg@2744
   265
!ViewTreeInspectorApplication class methodsFor:'interface specs'!
ca@2177
   266
ca@2177
   267
windowSpec
ca@2177
   268
    "This resource specification was automatically generated
ca@2177
   269
     by the UIPainter of ST/X."
ca@2177
   270
ca@2177
   271
    "Do not manually edit this!! If it is corrupted,
ca@2177
   272
     the UIPainter may not be able to read the specification."
ca@2177
   273
ca@2177
   274
    "
cg@2757
   275
     UIPainter new openOnClass:Tools::ViewTreeInspectorApplication andSelector:#windowSpec
cg@2757
   276
     Tools::ViewTreeInspectorApplication new openInterface:#windowSpec
cg@2757
   277
     Tools::ViewTreeInspectorApplication open
ca@2177
   278
    "
ca@2177
   279
ca@2177
   280
    <resource: #canvas>
ca@2177
   281
ca@2177
   282
    ^ 
cg@3037
   283
    #(FullSpec
cg@3037
   284
       name: windowSpec
cg@3037
   285
       window: 
cg@3037
   286
      (WindowSpec
cg@3037
   287
         label: 'View Tree Inspector'
cg@3037
   288
         name: 'View Tree Inspector'
cg@3037
   289
         min: (Point 10 10)
cg@3037
   290
         max: (Point 1024 9999)
cg@3037
   291
         bounds: (Rectangle 0 0 381 654)
cg@3037
   292
         menu: menu
cg@3037
   293
       )
cg@3037
   294
       component: 
cg@3037
   295
      (SpecCollection
cg@3037
   296
         collection: (
cg@3037
   297
          (MenuPanelSpec
cg@3037
   298
             name: 'toolbarMenu'
cg@3037
   299
             layout: (LayoutFrame 0 0.0 0 0 0 1.0 40 0)
cg@3037
   300
             menu: toolbarMenu
cg@3037
   301
             textDefault: true
cg@3037
   302
           )
cg@3037
   303
          (VariableVerticalPanelSpec
cg@3037
   304
             name: 'VariableVerticalPanel1'
cg@3037
   305
             layout: (LayoutFrame 0 0.0 40 0.0 0 1.0 0 1.0)
cg@3037
   306
             component: 
cg@3037
   307
            (SpecCollection
cg@3037
   308
               collection: (
cg@3037
   309
                (HierarchicalListViewSpec
cg@3037
   310
                   name: 'List'
cg@3037
   311
                   level: 1
cg@3037
   312
                   model: model
cg@3037
   313
                   menu: middleButtonMenu
cg@3037
   314
                   hasHorizontalScrollBar: true
cg@3037
   315
                   hasVerticalScrollBar: true
cg@3037
   316
                   miniScrollerHorizontal: true
cg@3037
   317
                   miniScrollerVertical: false
cg@3037
   318
                   listModel: listOfItems
cg@3037
   319
                   multipleSelectOk: true
cg@3037
   320
                   useIndex: false
cg@3037
   321
                   highlightMode: label
cg@3037
   322
                   showLeftIndicators: false
cg@3037
   323
                   indicatorSelector: indicatorClicked:
cg@3037
   324
                   useDefaultIcons: false
cg@3037
   325
                   postBuildCallback: postBuildTree:
cg@2770
   326
                 )
cg@3037
   327
                (ViewSpec
cg@3037
   328
                   name: 'Box2'
cg@3037
   329
                   component: 
cg@3037
   330
                  (SpecCollection
cg@3037
   331
                     collection: (
cg@3037
   332
                      (TabViewSpec
cg@3037
   333
                         name: 'TabHeader1'
cg@3037
   334
                         layout: (LayoutFrame 0 0.0 0 0 0 1.0 25 0)
cg@3037
   335
                         model: inspectorModeIndexHolder
cg@3037
   336
                         menu: inspectorModes
cg@3037
   337
                         useIndex: true
cg@3037
   338
                         translateLabel: true
cg@3037
   339
                       )
cg@3049
   340
                      (ViewSpec
cg@3049
   341
                         name: 'Inspector'
cg@3049
   342
                         layout: (LayoutFrame 0 0 26 0 0 1 0 1)
cg@3049
   343
                         viewClassName: 'InspectorView'
cg@3049
   344
                         postBuildCallback: postBuildInspectorView:
cg@3049
   345
                       )
cg@3037
   346
                      )
cg@3037
   347
                    
cg@3037
   348
                   )
cg@3037
   349
                 )
cg@3037
   350
                )
cg@3037
   351
              
cg@3037
   352
             )
cg@3037
   353
             handles: (Any 0.5 1.0)
ca@2177
   354
           )
cg@3037
   355
          )
cg@3037
   356
        
cg@3037
   357
       )
cg@3037
   358
     )
ca@2177
   359
! !
ca@2177
   360
cg@2744
   361
!ViewTreeInspectorApplication class methodsFor:'menu specs'!
ca@2177
   362
ca@2177
   363
menu
ca@2177
   364
    "This resource specification was automatically generated
ca@2177
   365
     by the MenuEditor of ST/X."
ca@2177
   366
ca@2177
   367
    "Do not manually edit this!! If it is corrupted,
ca@2177
   368
     the MenuEditor may not be able to read the specification."
ca@2177
   369
cg@2978
   370
ca@2177
   371
    "
cg@2978
   372
     MenuEditor new openOnClass:Tools::ViewTreeInspectorApplication andSelector:#menu
cg@2978
   373
     (Menu new fromLiteralArrayEncoding:(Tools::ViewTreeInspectorApplication menu)) startUp
ca@2177
   374
    "
ca@2177
   375
ca@2177
   376
    <resource: #menu>
ca@2177
   377
ca@2177
   378
    ^ 
ca@2177
   379
     #(Menu
ca@2177
   380
        (
ca@2177
   381
         (MenuItem
ca@2177
   382
            label: 'File'
ca@2177
   383
            submenu: 
ca@2177
   384
           (Menu
ca@2177
   385
              (
ca@2177
   386
               (MenuItem
ca@2177
   387
                  label: 'Pick a View'
cg@2762
   388
                  itemValue: doPickView
ca@2177
   389
                )
ca@2177
   390
               (MenuItem
ca@2455
   391
                  enabled: hasTargetWidgetChannel
ca@2177
   392
                  label: 'Release Picked View'
ca@2177
   393
                  itemValue: doUnpick
ca@2177
   394
                )
ca@2177
   395
               (MenuItem
ca@2177
   396
                  label: '-'
ca@2177
   397
                )
ca@2177
   398
               (MenuItem
cg@2744
   399
                  label: 'Settings'
cg@2744
   400
                  submenu: 
cg@2744
   401
                 (Menu
cg@2744
   402
                    (
cg@2744
   403
                     (MenuItem
cg@2744
   404
                        label: 'Test Mode'
cg@2744
   405
                        hideMenuOnActivated: false
cg@2744
   406
                        indication: testModeChannel
cg@2744
   407
                      )
cg@2744
   408
                     (MenuItem
cg@2744
   409
                        enabled: testModeChannel
cg@2744
   410
                        label: 'Follow Focus'
cg@2744
   411
                        hideMenuOnActivated: false
cg@2744
   412
                        indication: followFocusChannel
cg@2744
   413
                      )
cg@2744
   414
                     (MenuItem
cg@2744
   415
                        label: '-'
cg@2744
   416
                      )
cg@2744
   417
                     (MenuItem
cg@2744
   418
                        label: 'Select on Click'
cg@2744
   419
                        hideMenuOnActivated: false
cg@2744
   420
                        indication: selectOnClickHolder
cg@2744
   421
                      )
cg@2744
   422
                     (MenuItem
cg@2744
   423
                        label: '-'
cg@2744
   424
                      )
cg@2744
   425
                     (MenuItem
cg@2744
   426
                        label: 'Show Name of Widgets'
cg@2744
   427
                        hideMenuOnActivated: false
cg@2744
   428
                        indication: showNamesHolder
cg@2744
   429
                      )
cg@2744
   430
                     )
cg@2744
   431
                    nil
cg@2744
   432
                    nil
cg@2744
   433
                  )
cg@2744
   434
                )
cg@2744
   435
               (MenuItem
cg@2744
   436
                  label: '-'
cg@2744
   437
                )
cg@2744
   438
               (MenuItem
ca@2177
   439
                  label: 'Exit'
ca@2177
   440
                  itemValue: closeRequest
ca@2177
   441
                )
ca@2177
   442
               )
ca@2177
   443
              nil
ca@2177
   444
              nil
ca@2177
   445
            )
ca@2177
   446
          )
ca@2177
   447
         (MenuItem
cg@2744
   448
            enabled: hasSingleSelectionHolder
cg@2744
   449
            label: 'Selection'
cg@2744
   450
            submenuChannel: middleButtonMenu
cg@2744
   451
          )
cg@2744
   452
         (MenuItem
cg@3034
   453
            label: 'Widget'
cg@3034
   454
            submenu: 
cg@3034
   455
           (Menu
cg@3034
   456
              (
cg@3034
   457
               (MenuItem
cg@3034
   458
                  enabled: hasSingleSelectionHolder
cg@3034
   459
                  label: 'Browse'
cg@3034
   460
                  itemValue: doBrowse:
cg@3034
   461
                  argument: view
cg@3034
   462
                )
cg@3034
   463
               (MenuItem
cg@3034
   464
                  enabled: hasSingleSelectionHolder
cg@3034
   465
                  label: 'Inspect'
cg@3034
   466
                  itemValue: doInspect:
cg@3034
   467
                  argument: view
cg@3034
   468
                )
cg@3034
   469
               (MenuItem
cg@3034
   470
                  label: '-'
cg@3034
   471
                )
cg@3034
   472
               (MenuItem
cg@3034
   473
                  enabled: hasTargetWidgetChannel
cg@3034
   474
                  label: 'All Components'
cg@3034
   475
                  startGroup: right
cg@3034
   476
                  submenuChannel: submenuComponents:
cg@3034
   477
                )
cg@3034
   478
               )
cg@3034
   479
              nil
cg@3034
   480
              nil
cg@3034
   481
            )
cg@3034
   482
          )
cg@3034
   483
         (MenuItem
cg@2744
   484
            label: 'Application'
ca@2454
   485
            submenu: 
ca@2454
   486
           (Menu
ca@2454
   487
              (
ca@2454
   488
               (MenuItem
cg@2978
   489
                  label: 'Redraw'
cg@2978
   490
                  itemValue: doRedraw
cg@2978
   491
                )
cg@2978
   492
               (MenuItem
cg@2978
   493
                  label: '-'
cg@2978
   494
                )
cg@2978
   495
               (MenuItem
cg@2744
   496
                  enabled: hasSingleSelectionHolder
cg@2744
   497
                  label: 'Browse'
cg@2744
   498
                  itemValue: doBrowse:
cg@2744
   499
                  argument: application
ca@2454
   500
                )
ca@2454
   501
               (MenuItem
cg@2744
   502
                  enabled: hasSingleSelectionHolder
cg@2744
   503
                  label: 'Inspect'
cg@2744
   504
                  itemValue: doInspect:
cg@2744
   505
                  argument: application
ca@2454
   506
                )
ca@2454
   507
               (MenuItem
ca@2454
   508
                  label: '-'
ca@2454
   509
                )
ca@2454
   510
               (MenuItem
cg@2744
   511
                  enabled: hasTargetWidgetChannel
cg@2744
   512
                  label: 'All Applications'
cg@2744
   513
                  submenuChannel: submenuApplications:
cg@2744
   514
                )
cg@2744
   515
               )
cg@2744
   516
              nil
cg@2744
   517
              nil
cg@2744
   518
            )
cg@2744
   519
          )
cg@2744
   520
         (MenuItem
cg@3034
   521
            label: 'Process'
cg@2744
   522
            submenu: 
cg@2744
   523
           (Menu
cg@2744
   524
              (
cg@2744
   525
               (MenuItem
cg@2744
   526
                  enabled: hasSingleSelectionHolder
cg@2744
   527
                  label: 'Inspect'
cg@2744
   528
                  itemValue: doInspect:
cg@3034
   529
                  argument: process
ca@2454
   530
                )
ca@2454
   531
               (MenuItem
ca@2454
   532
                  label: '-'
ca@2454
   533
                )
ca@2454
   534
               (MenuItem
cg@3034
   535
                  label: 'Open Process Monitor'
cg@3034
   536
                  itemValue: doOpenProcessMonitor
ca@2454
   537
                )
ca@2454
   538
               )
ca@2454
   539
              nil
ca@2454
   540
              nil
ca@2454
   541
            )
ca@2454
   542
          )
ca@2454
   543
         (MenuItem
cg@2744
   544
            label: 'Help'
cg@2744
   545
            startGroup: conditionalRight
cg@2744
   546
            submenu: 
cg@2744
   547
           (Menu
cg@2744
   548
              (
cg@2744
   549
               (MenuItem
cg@2744
   550
                  label: 'Documentation'
cg@2744
   551
                  itemValue: openDocumentation
cg@2744
   552
                )
cg@2744
   553
               (MenuItem
cg@2744
   554
                  label: '-'
cg@2744
   555
                )
cg@2744
   556
               (MenuItem
cg@2744
   557
                  label: 'About this Application...'
cg@2744
   558
                  itemValue: openAboutThisApplication
cg@2744
   559
                )
cg@2744
   560
               )
cg@2744
   561
              nil
cg@2744
   562
              nil
cg@2744
   563
            )
ca@2177
   564
          )
ca@2177
   565
         )
ca@2177
   566
        nil
ca@2177
   567
        nil
ca@2177
   568
      )
ca@2177
   569
!
ca@2177
   570
ca@2177
   571
middleButtonMenu
ca@2177
   572
    "This resource specification was automatically generated
ca@2177
   573
     by the MenuEditor of ST/X."
ca@2177
   574
ca@2177
   575
    "Do not manually edit this!! If it is corrupted,
ca@2177
   576
     the MenuEditor may not be able to read the specification."
ca@2177
   577
ca@2177
   578
    "
ca@2177
   579
     MenuEditor new openOnClass:ViewTreeApplication andSelector:#middleButtonMenu
ca@2177
   580
     (Menu new fromLiteralArrayEncoding:(ViewTreeApplication middleButtonMenu)) startUp
ca@2177
   581
    "
ca@2177
   582
ca@2177
   583
    <resource: #menu>
ca@2177
   584
ca@2177
   585
    ^ 
ca@2177
   586
     #(Menu
ca@2177
   587
        (
ca@2177
   588
         (MenuItem
ca@2177
   589
            label: 'Geometry'
ca@2177
   590
            translateLabel: true
ca@2177
   591
            submenuChannel: submenuGeometry:
ca@2177
   592
            keepLinkedMenu: true
ca@2177
   593
          )
ca@2177
   594
         (MenuItem
ca@2177
   595
            label: 'Interface'
ca@2177
   596
            translateLabel: true
ca@2177
   597
            submenuChannel: submenuInterface:
ca@2177
   598
            keepLinkedMenu: true
ca@2177
   599
          )
ca@2177
   600
         (MenuItem
ca@2177
   601
            label: 'Visibility'
ca@2177
   602
            translateLabel: true
ca@2177
   603
            submenuChannel: submenuVisibility:
ca@2177
   604
            keepLinkedMenu: true
ca@2177
   605
          )
ca@2177
   606
         (MenuItem
ca@2177
   607
            label: '-'
ca@2177
   608
          )
ca@2177
   609
         (MenuItem
ca@2177
   610
            label: 'Browse View Class'
ca@2177
   611
            itemValue: doBrowse:
ca@2177
   612
            translateLabel: true
ca@2177
   613
            argument: view
ca@2177
   614
          )
ca@2177
   615
         (MenuItem
ca@2177
   616
            label: 'Browse Model Class'
ca@2177
   617
            itemValue: doBrowse:
ca@2177
   618
            translateLabel: true
ca@2177
   619
            isVisible: hasModel
ca@2177
   620
            argument: model
ca@2177
   621
          )
ca@2177
   622
         (MenuItem
ca@2177
   623
            label: 'Browse Application Class'
ca@2177
   624
            itemValue: doBrowse:
ca@2177
   625
            translateLabel: true
ca@2177
   626
            isVisible: hasApplication
ca@2177
   627
            argument: application
ca@2177
   628
          )
ca@2177
   629
         (MenuItem
ca@2177
   630
            label: 'Browse Controller Class'
ca@2177
   631
            itemValue: doBrowse:
ca@2177
   632
            translateLabel: true
ca@2177
   633
            isVisible: hasController
ca@2177
   634
            argument: controller
ca@2177
   635
          )
ca@2177
   636
         (MenuItem
ca@2177
   637
            label: '-'
ca@2177
   638
          )
ca@2177
   639
         (MenuItem
ca@2177
   640
            label: 'Inspect View'
ca@2177
   641
            itemValue: doInspect:
ca@2177
   642
            translateLabel: true
ca@2177
   643
            argument: view
ca@2177
   644
          )
ca@2177
   645
         (MenuItem
ca@2177
   646
            label: 'Inspect Window Group'
ca@2177
   647
            itemValue: doInspect:
ca@2177
   648
            translateLabel: true
ca@2177
   649
            argument: group
ca@2177
   650
          )
ca@2177
   651
         (MenuItem
ca@2177
   652
            label: 'Inspect Model'
ca@2177
   653
            itemValue: doInspect:
ca@2177
   654
            translateLabel: true
ca@2177
   655
            isVisible: hasModel
ca@2177
   656
            argument: model
ca@2177
   657
          )
ca@2177
   658
         (MenuItem
ca@2177
   659
            label: 'Inspect Application'
ca@2177
   660
            itemValue: doInspect:
ca@2177
   661
            translateLabel: true
ca@2177
   662
            isVisible: hasApplication
ca@2177
   663
            argument: application
ca@2177
   664
          )
ca@2177
   665
         (MenuItem
ca@2177
   666
            label: 'Inspect Controller'
ca@2177
   667
            itemValue: doInspect:
ca@2177
   668
            translateLabel: true
ca@2177
   669
            isVisible: hasController
ca@2177
   670
            argument: controller
ca@2177
   671
          )
ca@2177
   672
         (MenuItem
ca@2177
   673
            label: '-'
ca@2177
   674
          )
ca@2177
   675
         (MenuItem
ca@2177
   676
            label: 'Flash'
ca@2177
   677
            itemValue: doFlash
ca@2177
   678
            translateLabel: true
ca@2177
   679
          )
ca@2177
   680
         (MenuItem
ca@2177
   681
            label: '-'
ca@2177
   682
          )
ca@2177
   683
         (MenuItem
ca@2177
   684
            label: 'Destroy'
ca@2177
   685
            itemValue: doDestroy
ca@2177
   686
            translateLabel: true
ca@2177
   687
          )
ca@2177
   688
         (MenuItem
ca@2177
   689
            label: '-'
ca@2177
   690
          )
ca@2177
   691
         (MenuItem
ca@2177
   692
            label: 'Instance Variables'
ca@2177
   693
            translateLabel: true
ca@2177
   694
            submenuChannel: submenuInspector:
ca@2177
   695
            keepLinkedMenu: true
ca@2177
   696
          )
ca@2177
   697
         (MenuItem
ca@2177
   698
            label: '='
ca@2177
   699
          )
ca@2177
   700
         (MenuItem
ca@2177
   701
            label: ''
ca@2177
   702
          )
ca@2177
   703
         (MenuItem
ca@2177
   704
            enabled: selectedComponentHasChildren
ca@2177
   705
            label: 'Applications'
ca@2177
   706
            nameKey: single
ca@2177
   707
            translateLabel: true
ca@2177
   708
            submenuChannel: submenuApplications:
ca@2177
   709
            keepLinkedMenu: true
ca@2177
   710
          )
ca@2177
   711
         (MenuItem
ca@2177
   712
            enabled: selectedComponentHasChildren
ca@2177
   713
            label: 'Components'
ca@2177
   714
            nameKey: single
ca@2177
   715
            translateLabel: true
ca@2177
   716
            submenuChannel: submenuComponents:
ca@2177
   717
            keepLinkedMenu: true
ca@2177
   718
          )
ca@2177
   719
         )
ca@2177
   720
        nil
ca@2177
   721
        nil
ca@2177
   722
      )
ca@2177
   723
!
ca@2177
   724
ca@2177
   725
toolbarMenu
ca@2177
   726
    "This resource specification was automatically generated
ca@2177
   727
     by the MenuEditor of ST/X."
ca@2177
   728
ca@2177
   729
    "Do not manually edit this!! If it is corrupted,
ca@2177
   730
     the MenuEditor may not be able to read the specification."
ca@2177
   731
cg@2978
   732
ca@2177
   733
    "
cg@2757
   734
     MenuEditor new openOnClass:Tools::ViewTreeInspectorApplication andSelector:#toolbarMenu
cg@2757
   735
     (Menu new fromLiteralArrayEncoding:(Tools::ViewTreeInspectorApplication toolbarMenu)) startUp
ca@2177
   736
    "
ca@2177
   737
ca@2177
   738
    <resource: #menu>
ca@2177
   739
ca@2177
   740
    ^ 
ca@2177
   741
     #(Menu
ca@2177
   742
        (
ca@2177
   743
         (MenuItem
cg@2978
   744
            enabled: hasTargetWidgetChannel
cg@2978
   745
            label: 'Redraw'
cg@2978
   746
            itemValue: doRedraw
cg@2978
   747
            isButton: true
cg@2978
   748
            labelImage: (ResourceRetriever ToolbarIconLibrary reloadIcon)
cg@2978
   749
          )
cg@2978
   750
         (MenuItem
cg@2978
   751
            label: '-'
cg@2978
   752
          )
cg@2978
   753
         (MenuItem
cg@2978
   754
            label: 'Pick a View and Catch Events'
cg@2762
   755
            itemValue: doPickView
cg@2744
   756
            translateLabel: false
cg@2744
   757
            isButton: true
cg@2744
   758
            hideMenuOnActivated: false
cg@2759
   759
            labelImage: (ResourceRetriever #'Tools::ViewTreeInspectorApplication' pickWindowIcon2)
cg@2744
   760
          )
cg@2744
   761
         (MenuItem
cg@2757
   762
            enabled: hasTargetWidgetChannel
cg@2978
   763
            label: 'Release Picked View and Uncatch Events'
cg@2978
   764
            itemValue: doUncatchEvents
cg@2757
   765
            isButton: true
cg@3000
   766
            labelImage: (ResourceRetriever #'Tools::ViewTreeInspectorApplication' releaseViewIcon)
cg@2757
   767
          )
cg@2757
   768
         (MenuItem
cg@2757
   769
            label: '-'
cg@2757
   770
          )
cg@2757
   771
         (MenuItem
ca@2454
   772
            enabled: hasSingleSelectionHolder
cg@2744
   773
            label: 'Browse Application'
ca@2454
   774
            itemValue: doBrowse:
ca@2454
   775
            translateLabel: false
cg@2744
   776
            isButton: true
cg@2744
   777
            hideMenuOnActivated: false
ca@2454
   778
            labelImage: (ResourceRetriever ToolbarIconLibrary systemBrowser24x24Icon2)
ca@2454
   779
            argument: application
ca@2177
   780
          )
ca@2177
   781
         (MenuItem
ca@2454
   782
            enabled: hasSingleSelectionHolder
cg@2744
   783
            label: 'Inspect Application'
ca@2454
   784
            itemValue: doInspect:
ca@2454
   785
            translateLabel: false
cg@2744
   786
            isButton: true
cg@2744
   787
            hideMenuOnActivated: false
cg@2744
   788
            labelImage: (ResourceRetriever ToolbarIconLibrary inspect22x24Icon)
ca@2454
   789
            argument: application
ca@2177
   790
          )
ca@2177
   791
         )
ca@2177
   792
        nil
ca@2177
   793
        nil
ca@2177
   794
      )
ca@2177
   795
! !
ca@2177
   796
cg@2747
   797
!ViewTreeInspectorApplication class methodsFor:'startup'!
cg@2747
   798
cg@2747
   799
openInPickMode
cg@2747
   800
    |app|
cg@2747
   801
cg@2747
   802
    app := self new.
cg@2747
   803
    app open.
cg@2762
   804
    app doPickView.
cg@3014
   805
!
cg@3014
   806
cg@3014
   807
openOn:aView
cg@3014
   808
    "show a particular window's topView hierarchy,
cg@3014
   809
     select the given view"
cg@3014
   810
cg@3014
   811
    |app|
cg@3014
   812
cg@3014
   813
    app := self new.
cg@3014
   814
    app open.
cg@3014
   815
    app showWindow:aView.
cg@2747
   816
! !
cg@2747
   817
cg@2744
   818
!ViewTreeInspectorApplication methodsFor:'actions'!
ca@2177
   819
ca@2177
   820
indicatorClicked:anIndex
ca@2177
   821
    |item sensor|
ca@2177
   822
ca@2177
   823
    item := model listOfItems at:anIndex ifAbsent:nil.
ca@2177
   824
ca@2177
   825
    item notNil ifTrue:[
ca@2177
   826
        (     (sensor := self window sensor) notNil
ca@2177
   827
         and:[(sensor ctrlDown or:[sensor shiftDown])]
ca@2177
   828
        ) ifTrue:[
ca@2177
   829
            item recursiveToggleExpand
ca@2177
   830
        ] ifFalse:[
ca@2177
   831
            item toggleExpand
ca@2177
   832
        ]
ca@2177
   833
    ].
ca@2177
   834
! !
ca@2177
   835
cg@2744
   836
!ViewTreeInspectorApplication methodsFor:'aspects'!
ca@2177
   837
ca@2177
   838
followFocusChannel
ca@2455
   839
    "boolean holder, which indicates whether selection changed dependend on the focus view"
ca@2455
   840
ca@2177
   841
    ^ followFocusChannel
ca@2177
   842
!
ca@2177
   843
ca@2177
   844
hasSingleSelectionHolder
ca@2455
   845
    "boolean holder, true if one item is selected"
ca@2455
   846
ca@2177
   847
    ^ hasSingleSelectionHolder
ca@2177
   848
!
ca@2177
   849
ca@2455
   850
hasTargetWidgetChannel
ca@2455
   851
    "answer the channel which is set to true if a target widget exists"
ca@2455
   852
ca@2455
   853
    ^ model hasTargetWidgetChannel
ca@2455
   854
!
ca@2455
   855
cg@3037
   856
inspectorMode
cg@3049
   857
    "what is shown in the inspector:
cg@3037
   858
     1->widget
cg@3049
   859
     2->application
cg@3049
   860
     3->WindowGroup
cg@3049
   861
     4->Sensor
cg@3049
   862
     5->Model 
cg@3049
   863
    "
cg@3049
   864
cg@3049
   865
    (inspectorModeIndexHolder value == 1) ifTrue:[ ^#widget].
cg@3049
   866
    (inspectorModeIndexHolder value == 2) ifTrue:[ ^#application].
cg@3049
   867
    (inspectorModeIndexHolder value == 3) ifTrue:[ ^#group].
cg@3049
   868
    (inspectorModeIndexHolder value == 4) ifTrue:[ ^#sensor].
cg@3049
   869
    (inspectorModeIndexHolder value == 5) ifTrue:[ ^#model].
cg@3049
   870
    ^ #application
cg@3037
   871
cg@3037
   872
    "Created: / 30-07-2013 / 07:44:59 / cg"
cg@3037
   873
!
cg@3037
   874
cg@3037
   875
inspectorModeIndexHolder
cg@3049
   876
    "what is shown in the inspector:
cg@3049
   877
     1->Widget
cg@3049
   878
     2->Application
cg@3049
   879
     3->WindowGroup
cg@3049
   880
     4->Sensor
cg@3049
   881
     5->Model 
cg@3049
   882
    "
cg@3037
   883
cg@3037
   884
    ^ inspectorModeIndexHolder
cg@3037
   885
cg@3037
   886
    "Created: / 30-07-2013 / 07:44:07 / cg"
cg@3037
   887
!
cg@3037
   888
cg@3037
   889
inspectorModes
cg@3049
   890
    ^ #('Widget' 'Application' 'WindowGroup' 'Sensor' 'Model')
cg@3037
   891
cg@3037
   892
    "Created: / 30-07-2013 / 09:42:16 / cg"
cg@3037
   893
!
cg@3037
   894
ca@2177
   895
listOfItems
ca@2455
   896
    "returns the hierarchical list of items"
ca@2455
   897
ca@2177
   898
    ^ model listOfItems
ca@2177
   899
!
ca@2177
   900
ca@2177
   901
model
ca@2455
   902
    "returns my selection model, a ViewTreeModel"
ca@2455
   903
ca@2177
   904
    ^ model
ca@2177
   905
!
ca@2177
   906
ca@2177
   907
selectOnClickHolder
ca@2455
   908
    "boolean holder, which indicates whether the selection will change on click"
ca@2455
   909
ca@2177
   910
    ^ model selectOnClickHolder
ca@2177
   911
!
ca@2177
   912
ca@2451
   913
showNamesHolder
ca@2451
   914
    "boolean holder, which indicates whether application names or widget names
ca@2455
   915
     as additional text are shown for the items"
ca@2455
   916
ca@2451
   917
    ^ showNamesHolder
ca@2451
   918
!
ca@2451
   919
ca@2177
   920
testModeChannel
ca@2455
   921
    "answer a boolean channel which describes the behaviour how to process
ca@2455
   922
     events on the target view.
ca@2455
   923
ca@2455
   924
     false: all input events are eaten and the selection is shown on the target view.
ca@2455
   925
     true:  no  input events are eaten and no  selection is shown on the target view."
ca@2455
   926
ca@2455
   927
    ^ model testModeChannel
ca@2177
   928
! !
ca@2177
   929
cg@2744
   930
!ViewTreeInspectorApplication methodsFor:'change & update'!
ca@2177
   931
cg@3037
   932
inspectorModeIndexHolderChanged
cg@3037
   933
    self updateInspector
cg@3037
   934
cg@3037
   935
    "Created: / 30-07-2013 / 09:21:51 / cg"
cg@3037
   936
!
cg@3037
   937
ca@2177
   938
selectionChanged
ca@2177
   939
    |info view item|
ca@2177
   940
ca@2177
   941
    item := model selectedItem.
ca@2177
   942
ca@2177
   943
    item notNil ifTrue:[ |state|
ca@2177
   944
        view := item widget.
ca@2177
   945
ca@2177
   946
        view id isNil ifTrue:[
ca@2177
   947
            state := 'no ID'.
ca@2177
   948
        ] ifFalse:[
ca@2177
   949
            view shown ifTrue:[
ca@2177
   950
                state := 'visible'.
ca@2177
   951
            ] ifFalse:[
ca@2177
   952
                state := 'invisible'
ca@2177
   953
            ].
ca@2177
   954
        ].
ca@2177
   955
        info := '%1 [%2] - %3' bindWith:(view class name)
ca@2177
   956
                                   with:(view name ? '') with:state allBold.
ca@2177
   957
ca@2177
   958
    ] ifFalse:[
ca@2177
   959
        info := ''
ca@2177
   960
    ].
ca@2177
   961
    hasSingleSelectionHolder value:(view notNil).
cg@3037
   962
    self updateInspector
cg@3037
   963
cg@3037
   964
    "Modified: / 30-07-2013 / 09:21:27 / cg"
ca@2177
   965
!
ca@2177
   966
ca@2177
   967
update:something with:someArgument from:aModel
ca@2454
   968
    |oldSelection|
ca@2454
   969
ca@2451
   970
    aModel == showNamesHolder ifTrue:[
ca@2455
   971
        oldSelection := model selectedItem.
ca@2454
   972
        model selectedItem:nil.
ca@2451
   973
        self listOfItems showWidgetNames:(aModel value).
ca@2454
   974
        model selectedItem:oldSelection.
ca@2451
   975
        ^ self
ca@2451
   976
    ].
ca@2458
   977
ca@2458
   978
    aModel == model ifTrue:[
ca@2458
   979
        self selectionChanged.
ca@2458
   980
        ^ self
ca@2458
   981
    ].
ca@2458
   982
ca@2177
   983
    super update:something with:someArgument from:aModel.
cg@3037
   984
!
cg@3037
   985
cg@3037
   986
updateInspector
cg@3037
   987
    |view obj|
cg@3037
   988
cg@3037
   989
    view := self selectedView.
cg@3037
   990
    (view isNil or:[self inspectorMode == #widget]) ifTrue:[
cg@3037
   991
        obj := view.
cg@3049
   992
    ] ifFalse:[ (self inspectorMode == #group) ifTrue:[
cg@3049
   993
        obj := view windowGroup
cg@3049
   994
    ] ifFalse:[ (self inspectorMode == #sensor) ifTrue:[
cg@3049
   995
        obj := view sensor
cg@3049
   996
    ] ifFalse:[ (self inspectorMode == #model) ifTrue:[
cg@3049
   997
        obj := view model
cg@3037
   998
    ] ifFalse:[
cg@3037
   999
        obj := view application.
cg@3049
  1000
    ]]]].
cg@3037
  1001
    inspectorView inspect:obj.
cg@3037
  1002
    inspectorView headLineLabel:(obj class nameWithoutPrefix)
cg@3037
  1003
cg@3037
  1004
    "Created: / 30-07-2013 / 09:21:16 / cg"
ca@2177
  1005
! !
ca@2177
  1006
cg@2744
  1007
!ViewTreeInspectorApplication methodsFor:'event processing'!
ca@2177
  1008
ca@2177
  1009
processButtonMotionEvent:ev
ca@2455
  1010
    |click rootView|
ca@2177
  1011
ca@2455
  1012
    motionAction isNil ifTrue:[^ self].
ca@2455
  1013
ca@2455
  1014
    (rootView := model rootView) isNil ifTrue:[
ca@2455
  1015
        clickedItem := motionAction := nil.
ca@2455
  1016
        ^ self
ca@2455
  1017
    ].
ca@2455
  1018
ca@2455
  1019
    click := rootView device
ca@2455
  1020
            translatePoint:((ev x)@ (ev y))
ca@2455
  1021
            fromView:(ev view)
ca@2455
  1022
            toView:rootView.
ca@2455
  1023
ca@2455
  1024
    click = clickedPoint ifFalse:[
ca@2455
  1025
        (clickedItem isNil or:[(click dist:clickedPoint) > 5.0]) ifTrue:[
ca@2455
  1026
            motionAction value:click
ca@2177
  1027
        ]
ca@2177
  1028
    ].
ca@2177
  1029
!
ca@2177
  1030
ca@2177
  1031
processButtonPressEvent:ev
ca@2455
  1032
    |rootView sensor lastRectangle|
ca@2455
  1033
ca@2455
  1034
    rootView    := model rootView.
ca@2177
  1035
    sensor      := model rootView sensor.
ca@2177
  1036
    clickedItem := model listOfItems detectItemRespondsToView:(ev view).
ca@2177
  1037
ca@2177
  1038
    (sensor ctrlDown or:[sensor shiftDown]) ifTrue:[
ca@2177
  1039
        clickedItem notNil ifTrue:[
ca@2177
  1040
            self selectOnClickHolder value ifTrue:[
ca@2177
  1041
                model toggleSelectItem:clickedItem
ca@2177
  1042
            ].
ca@2177
  1043
        ].
ca@2177
  1044
        clickedItem := motionAction := nil.
ca@2455
  1045
        ^ self
ca@2455
  1046
    ].
ca@2177
  1047
ca@2455
  1048
    clickedPoint := rootView device translatePoint:((ev x)@ (ev y))  fromView:(ev view) toView:rootView.
ca@2455
  1049
    lastRectangle := nil.
ca@2177
  1050
ca@2455
  1051
    motionAction :=[:p|
ca@2455
  1052
        rootView    := model rootView device rootView.
ca@2455
  1053
        rootView    := model rootView.
ca@2455
  1054
        clickedItem := nil.
ca@2177
  1055
ca@2455
  1056
        rootView xoring:[
ca@2455
  1057
            lastRectangle notNil ifTrue:[ rootView displayRectangle:lastRectangle ]
ca@2455
  1058
                                ifFalse:[ rootView clippedByChildren:false ].
ca@2455
  1059
ca@2455
  1060
            p isNil ifTrue:[
ca@2455
  1061
                rootView clippedByChildren:true.
ca@2455
  1062
                motionAction := nil.
ca@2455
  1063
            ] ifFalse:[
ca@2455
  1064
                lastRectangle := Rectangle origin:(clickedPoint min:p) corner:(clickedPoint max:p).
ca@2455
  1065
                rootView displayRectangle:lastRectangle.
ca@2177
  1066
            ].
ca@2455
  1067
            rootView flush.
ca@2455
  1068
        ].
ca@2455
  1069
        lastRectangle
ca@2455
  1070
    ].
ca@2177
  1071
!
ca@2177
  1072
ca@2177
  1073
processButtonReleaseEvent:anEvent
ca@2177
  1074
    |rootView rectangle newItems widget origin|
ca@2177
  1075
ca@2455
  1076
    (rootView := model rootView) isNil ifTrue:[
ca@2455
  1077
        clickedItem := motionAction := nil.
ca@2455
  1078
        ^ self
ca@2455
  1079
    ].
ca@2177
  1080
    motionAction isNil ifTrue:[ ^ self ].
ca@2177
  1081
    clickedItem notNil ifTrue:[ ^ model selectItem:clickedItem ].
ca@2177
  1082
ca@2455
  1083
    rectangle := motionAction value:nil.
ca@2455
  1084
    rectangle isNil ifTrue:[^ self].
ca@2177
  1085
ca@2455
  1086
    newItems := OrderedCollection new.
ca@2177
  1087
ca@2455
  1088
    model rootItem recursiveDo:[:anItem|
ca@2455
  1089
        widget := anItem widget.
ca@2455
  1090
        origin := widget originRelativeTo:rootView.
ca@2455
  1091
ca@2455
  1092
        (rectangle containsRect:(Rectangle origin:origin extent:(widget extent))) ifTrue:[
ca@2455
  1093
            newItems add:anItem.
ca@2455
  1094
        ]
ca@2177
  1095
    ].
ca@2455
  1096
    model value:newItems.
ca@2177
  1097
!
ca@2177
  1098
ca@2177
  1099
processEvent:anEvent
ca@2177
  1100
    |button menu|
ca@2177
  1101
cg@2758
  1102
    anEvent isKeyPressEvent ifTrue:[ self processKeyPressEvent:anEvent. ^ self  ].
ca@2177
  1103
    anEvent isButtonEvent  ifFalse:[ ^ self ].
ca@2177
  1104
ca@2177
  1105
    button := anEvent button.
ca@2177
  1106
ca@2177
  1107
    (button == 2 or:[button == #menu]) ifTrue:[
ca@2177
  1108
        motionAction isNil ifTrue:[
ca@2177
  1109
            anEvent isButtonPressEvent ifTrue:[
ca@2177
  1110
                self selectOnClickHolder value ifTrue:[
ca@2177
  1111
                    menu := self middleButtonMenu value.
ca@2177
  1112
                    menu notNil ifTrue:[
cg@2758
  1113
                        menu := MenuPanel 
cg@2758
  1114
                                    menu:(Menu new fromLiteralArrayEncoding:menu)
cg@2758
  1115
                                    receiver:self.
ca@2177
  1116
                        menu startUp.
ca@2177
  1117
                    ]
ca@2177
  1118
                ].
ca@2177
  1119
            ].
ca@2177
  1120
            clickedItem := nil.
ca@2177
  1121
        ].
ca@2177
  1122
        ^ self
ca@2177
  1123
    ].
ca@2177
  1124
cg@2758
  1125
    anEvent isButtonPressEvent  ifTrue:[ self processButtonPressEvent:anEvent. ^ self ].
cg@2758
  1126
    anEvent isButtonMotionEvent ifTrue:[ self processButtonMotionEvent:anEvent. ^ self ].
ca@2177
  1127
ca@2177
  1128
    anEvent isButtonReleaseEvent ifTrue:[
ca@2177
  1129
        self selectOnClickHolder value ifTrue:[
ca@2177
  1130
            self processButtonReleaseEvent:anEvent
ca@2177
  1131
        ].
ca@2177
  1132
    ].
ca@2177
  1133
    clickedItem := motionAction := nil.
ca@2177
  1134
ca@2177
  1135
    anEvent type == #'buttonMultiPress:x:y:' ifTrue:[
ca@2177
  1136
        self selectOnClickHolder value ifTrue:[
ca@2177
  1137
            self doInspect:#view.
ca@2177
  1138
        ].
ca@2177
  1139
    ].
ca@2177
  1140
!
ca@2177
  1141
ca@2177
  1142
processKeyPressEvent:anEvent
ca@2177
  1143
    |item prnt idx key max next|
ca@2177
  1144
ca@2177
  1145
    key := anEvent key.
ca@2177
  1146
    key isSymbol ifFalse:[^ self].
ca@2177
  1147
ca@2177
  1148
    key == #Delete    ifTrue:[ ^ self doDestroy ].
ca@2177
  1149
    key == #InspectIt ifTrue:[ ^ self doInspect:#view ].
ca@2177
  1150
ca@2177
  1151
    (   key == #CursorUp
ca@2177
  1152
    or:[key == #CursorDown
ca@2177
  1153
    or:[key == #CursorLeft
ca@2177
  1154
    or:[key == #CursorRight]]]
ca@2177
  1155
    ) ifFalse:[
ca@2177
  1156
        ^ self
ca@2177
  1157
    ].
ca@2177
  1158
    item := model selectedItem.
ca@2177
  1159
ca@2177
  1160
    item isNil ifTrue:[
ca@2177
  1161
        ^ model selectedItem:(model first ? model rootItem)
ca@2177
  1162
    ].
ca@2177
  1163
ca@2177
  1164
    prnt := item parent.
ca@2177
  1165
    prnt isNil ifTrue:[
ca@2177
  1166
        "/ is the root item
ca@2177
  1167
        (key == #CursorUp or:[key == #CursorLeft]) ifTrue:[item := model listOfItems last]
ca@2177
  1168
                                                  ifFalse:[item := item at:1 ifAbsent:item].
ca@2177
  1169
cg@2758
  1170
        ^ model selectedItem:item
ca@2177
  1171
    ].
ca@2177
  1172
    key == #CursorLeft ifTrue:[ ^ model selectedItem:prnt ].
ca@2177
  1173
ca@2177
  1174
    key == #CursorRight ifTrue:[
ca@2177
  1175
        next := item at:1 ifAbsent:nil.
ca@2177
  1176
        next notNil ifTrue:[ model selectedItem:next ].
cg@2758
  1177
        ^ self
ca@2177
  1178
    ].
ca@2177
  1179
ca@2177
  1180
    max := prnt size.
ca@2177
  1181
ca@2177
  1182
    key == #CursorUp ifTrue:[
ca@2177
  1183
        idx := prnt identityIndexOf:item.
ca@2177
  1184
        idx == 1 ifTrue:[idx := max + 1].
ca@2177
  1185
        model selectedItem:(prnt at:idx - 1).
cg@2758
  1186
        ^ self.
ca@2177
  1187
    ].
ca@2177
  1188
ca@2177
  1189
    key == #CursorDown ifTrue:[
ca@2177
  1190
        idx := prnt identityIndexOf:item.
ca@2177
  1191
        idx == max ifTrue:[idx := 0].
ca@2177
  1192
        model selectedItem:(prnt at:idx + 1).
cg@2758
  1193
        ^ self.
ca@2177
  1194
    ].
ca@2177
  1195
!
ca@2177
  1196
ca@2177
  1197
processMappedView:aView
ca@2177
  1198
    |parent anchor|
ca@2177
  1199
ca@2177
  1200
    parent := self listOfItems detectItemRespondsToView:aView.
ca@2177
  1201
    parent isNil ifTrue:[ ^ self ].
ca@2177
  1202
ca@2177
  1203
    NotFoundSignal handle:[:ex|
ca@2177
  1204
        "contained subvies used by spec are not yet created;
ca@2177
  1205
         thus we have to wait until last used subview is build
ca@2177
  1206
        "
ca@2177
  1207
        anchor := nil.
ca@2177
  1208
    ] do:[
ca@2177
  1209
        anchor := parent class buildViewsFrom:(parent widget).
ca@2177
  1210
    ].
ca@2177
  1211
    anchor notNil ifTrue:[
ca@2177
  1212
        parent updateFromChildren:anchor children.
ca@2177
  1213
    ].
ca@2177
  1214
! !
ca@2177
  1215
cg@2744
  1216
!ViewTreeInspectorApplication methodsFor:'initialization & release'!
ca@2177
  1217
ca@2177
  1218
closeDownViews
ca@2455
  1219
    "release the grapped application"
ca@2455
  1220
ca@2177
  1221
    process := nil.
ca@2177
  1222
    super closeDownViews.
ca@2177
  1223
    self doUnpick.
ca@2177
  1224
!
ca@2177
  1225
ca@2177
  1226
initialize
ca@2455
  1227
    "setup my model and channels"
ca@2455
  1228
ca@2177
  1229
    super initialize.
ca@2177
  1230
ca@2177
  1231
    hasSingleSelectionHolder := false asValue.
ca@2177
  1232
    followFocusChannel       := false asValue.
cg@3037
  1233
    inspectorModeIndexHolder := 1 asValue.
cg@3037
  1234
    inspectorModeIndexHolder onChangeSend:#inspectorModeIndexHolderChanged to:self.
ca@2177
  1235
ca@2177
  1236
    model := ViewTreeModel new.
ca@2177
  1237
    model inputEventAction:[:ev| self processEvent:ev ].
ca@2177
  1238
    model mappedViewAction:[:vw| self processMappedView:vw ].
ca@2177
  1239
    model application:self.
ca@2458
  1240
    model addDependent:self.
ca@2458
  1241
ca@2177
  1242
ca@2451
  1243
    showNamesHolder := false asValue.
ca@2451
  1244
    showNamesHolder addDependent:self.
cg@3037
  1245
cg@3037
  1246
    "Modified: / 30-07-2013 / 09:20:08 / cg"
ca@2177
  1247
!
ca@2177
  1248
cg@2770
  1249
postBuildInspectorView:anInspector
cg@2770
  1250
    inspectorView := anInspector.
cg@2770
  1251
!
cg@2770
  1252
ca@2177
  1253
postBuildTree:aTree
ca@2177
  1254
    treeView := aTree scrolledView.
ca@2177
  1255
    treeView hasConstantHeight:true.
ca@2177
  1256
! !
ca@2177
  1257
cg@2744
  1258
!ViewTreeInspectorApplication methodsFor:'menu queries'!
ca@2177
  1259
ca@2177
  1260
hasApplication
ca@2455
  1261
    "returns true if the current selected view has an application"
ca@2455
  1262
ca@2177
  1263
    |view|
ca@2177
  1264
ca@2177
  1265
    view := self selectedView.
ca@2177
  1266
  ^ (view notNil and:[view application notNil])
ca@2177
  1267
!
ca@2177
  1268
ca@2177
  1269
hasController
ca@2177
  1270
    "returns true if the current selected item's view has a controller
ca@2455
  1271
     other than nil or the view itself"
ca@2455
  1272
ca@2177
  1273
    |view controller|
ca@2177
  1274
ca@2177
  1275
    view := self selectedView.
ca@2177
  1276
ca@2177
  1277
    view notNil ifTrue:[
ca@2177
  1278
        controller := view controller.
ca@2177
  1279
      ^ (controller notNil and:[controller ~~ view])
ca@2177
  1280
    ].
ca@2177
  1281
    ^ false
ca@2177
  1282
!
ca@2177
  1283
ca@2177
  1284
hasModel
ca@2455
  1285
    "returns true if the current selected view has a model"
ca@2455
  1286
ca@2177
  1287
    |view|
ca@2177
  1288
ca@2177
  1289
    view := self selectedView.
ca@2177
  1290
  ^ (view notNil and:[view model notNil])
ca@2177
  1291
! !
ca@2177
  1292
cg@2744
  1293
!ViewTreeInspectorApplication methodsFor:'menu specs'!
ca@2177
  1294
ca@2177
  1295
middleButtonMenu
ca@2455
  1296
    "returns the middleButton menu for the single selected item or nil"
ca@2455
  1297
cg@2758
  1298
    ^ [ 
cg@2758
  1299
        model selectedItem notNil 
cg@2758
  1300
            ifTrue:[self class middleButtonMenu]
cg@2758
  1301
            ifFalse:[nil]
ca@2177
  1302
      ]
ca@2177
  1303
!
ca@2177
  1304
ca@2177
  1305
submenuApplications:aMenu
ca@2177
  1306
    |applications menu item list addBlock|
ca@2177
  1307
ca@2177
  1308
    item := aMenu selection nameKey == #single ifTrue:[model selectedItem]
ca@2177
  1309
                                              ifFalse:[model rootItem].
ca@2177
  1310
    item isNil ifTrue:[^ nil].
ca@2177
  1311
ca@2177
  1312
    applications := IdentityDictionary new.
ca@2177
  1313
ca@2177
  1314
    addBlock := [:el| |cls ctr|
ca@2177
  1315
        cls := self resolveApplicationClassFor:el.
ca@2177
  1316
ca@2177
  1317
        cls notNil ifTrue:[
ca@2177
  1318
            ctr := applications at:cls ifAbsent:0.
ca@2177
  1319
            applications at:cls put:(ctr + 1).
ca@2177
  1320
        ].
ca@2177
  1321
    ].
ca@2177
  1322
    item recursiveDo:addBlock.
ca@2177
  1323
    addBlock value:item.
ca@2177
  1324
ca@2177
  1325
    applications isEmpty ifTrue:[^ nil ].
ca@2177
  1326
    list := SortedCollection sortBlock:[:a :b| a title < b title ].
ca@2177
  1327
ca@2177
  1328
    applications keysAndValuesDo:[:cls :ctr|
ca@2177
  1329
       list add:(MenuDesc title:(cls name)
ca@2177
  1330
                          value:(ctr printString)
ca@2177
  1331
                         action:[self doSelectNextOfApplicationClass:cls startingIn:item]
ca@2177
  1332
                 ).
ca@2177
  1333
    ].
ca@2177
  1334
ca@2177
  1335
    menu := MenuDesc buildFromList:list onGC:aMenu.
ca@2177
  1336
    menu do:[:el|
ca@2177
  1337
        el hideMenuOnActivated:false
ca@2177
  1338
    ].
ca@2177
  1339
    ^ menu
ca@2177
  1340
!
ca@2177
  1341
ca@2177
  1342
submenuComponents:aMenu
ca@2177
  1343
    |widgets list total menu item|
ca@2177
  1344
ca@2177
  1345
    item := aMenu selection nameKey == #single ifTrue:[model selectedItem]
ca@2177
  1346
                                              ifFalse:[model rootItem].
ca@2177
  1347
    item isNil ifTrue:[^ nil].
ca@2177
  1348
ca@2177
  1349
    widgets := IdentityDictionary new.
ca@2177
  1350
    total   := 0.
ca@2177
  1351
ca@2177
  1352
    item recursiveDo:[:el| |cls ctr|
ca@2177
  1353
        cls := el widget.
ca@2177
  1354
ca@2177
  1355
        cls notNil ifTrue:[
ca@2177
  1356
            cls := cls class.
ca@2177
  1357
            ctr := widgets at:cls ifAbsent:0.
ca@2177
  1358
            widgets at:cls put:(ctr + 1).
ca@2177
  1359
            total := total + 1.
ca@2177
  1360
        ].
ca@2177
  1361
    ].
ca@2177
  1362
    total == 0 ifTrue:[^ nil].
ca@2177
  1363
    list := SortedCollection sortBlock:[:a :b| a title < b title ].
ca@2177
  1364
ca@2177
  1365
    widgets keysAndValuesDo:[:cls :ctr|
ca@2177
  1366
        list add:(MenuDesc title:(cls name)
ca@2177
  1367
                           value:(ctr printString)
ca@2177
  1368
                          action:[self doSelectNextOfClass:cls startingIn:item]
ca@2177
  1369
                 ).
ca@2177
  1370
    ].
ca@2177
  1371
    list := list asOrderedCollection.
ca@2177
  1372
    list add:(MenuDesc separator).
ca@2177
  1373
    list add:(MenuDesc title:'Total' value:(total printString)).
ca@2177
  1374
    menu := MenuDesc buildFromList:list onGC:aMenu.
ca@2177
  1375
    menu do:[:el|
ca@2177
  1376
        el hideMenuOnActivated:false
ca@2177
  1377
    ].
ca@2177
  1378
    ^ menu
ca@2177
  1379
!
ca@2177
  1380
ca@2177
  1381
submenuGeometry:aMenu
ca@2455
  1382
    "builds and returns the geometry submenu"
ca@2455
  1383
ca@2177
  1384
    |view point inst list x y|
ca@2177
  1385
ca@2177
  1386
    view := self selectedView.
ca@2177
  1387
    view isNil ifTrue:[^ nil].
ca@2177
  1388
ca@2177
  1389
    list := OrderedCollection new.
ca@2177
  1390
ca@2177
  1391
    "/ origin
ca@2177
  1392
    point := view relativeOrigin.
ca@2177
  1393
    point isNil ifTrue:[ point := view origin ].
ca@2177
  1394
ca@2177
  1395
    x := view left.
ca@2177
  1396
    y := view top.
ca@2177
  1397
ca@2177
  1398
    (x == point x and:[y == point y]) ifTrue:[ inst := point ]
ca@2177
  1399
                                     ifFalse:[ inst := '%1 --> (%2@%3)' bindWith:point with:x with:y ].
ca@2177
  1400
ca@2177
  1401
    list add:(MenuDesc title:'origin' value:inst).
ca@2177
  1402
ca@2177
  1403
    "/ corner
ca@2177
  1404
    point := view relativeCorner.
ca@2177
  1405
    point isNil ifTrue:[ point := view corner ].
ca@2177
  1406
ca@2177
  1407
    x := view right.
ca@2177
  1408
    y := view bottom.
ca@2177
  1409
ca@2177
  1410
    (x == point x and:[y == point y]) ifTrue:[ inst := point ]
ca@2177
  1411
                                     ifFalse:[ inst := '%1 --> (%2@%3)' bindWith:point with:x with:y ].
ca@2177
  1412
ca@2177
  1413
    list add:(MenuDesc title:'corner' value:inst).
ca@2177
  1414
ca@2177
  1415
    "/ extent
ca@2177
  1416
    (point := view relativeExtent) isNil ifTrue:[point := view extent].
ca@2177
  1417
    list add:(MenuDesc title:'extent' value:point).
ca@2177
  1418
ca@2177
  1419
    "/ preferred extent
ca@2177
  1420
    list add:(MenuDesc title:'pref. extent' value:(view preferredExtent)).
ca@2177
  1421
    list add:(MenuDesc separator).
ca@2177
  1422
ca@2177
  1423
    "/ view insets
ca@2177
  1424
    inst := 'l:%1  r:%2  t:%3  b:%4' bindWith:(view leftInset)
ca@2177
  1425
                                         with:(view rightInset)
ca@2177
  1426
                                         with:(view topInset)
ca@2177
  1427
                                         with:(view bottomInset).
ca@2177
  1428
ca@2177
  1429
    list add:(MenuDesc title:'insets'      value:inst).
ca@2177
  1430
    list add:(MenuDesc title:'borderWidth' value:(view borderWidth)).
ca@2177
  1431
    list add:(MenuDesc title:'level'       value:(view level)).
ca@2177
  1432
    list add:(MenuDesc separator).
ca@2177
  1433
ca@2177
  1434
    (inst := view layout) notNil ifTrue:[ inst := inst displayString ].
ca@2177
  1435
    list add:(MenuDesc title:'layout' value:inst).
ca@2177
  1436
ca@2177
  1437
    (inst := view transformation) notNil ifTrue:[ inst := inst displayString ].
ca@2177
  1438
    list add:(MenuDesc title:'transformation' value:inst).
ca@2177
  1439
ca@2177
  1440
  ^ MenuDesc buildFromList:list onGC:aMenu
ca@2177
  1441
!
ca@2177
  1442
ca@2177
  1443
submenuInspector:aMenu
ca@2455
  1444
    "builds and returns the inspector submenu"
ca@2455
  1445
cg@3040
  1446
    |view list n names label value indices|
ca@2177
  1447
ca@2177
  1448
    view := self selectedView.
ca@2177
  1449
    view isNil ifTrue:[^ nil].
ca@2177
  1450
ca@2177
  1451
    n := view class instSize.
ca@2177
  1452
    n > 0 ifFalse:[^ nil ].
ca@2177
  1453
ca@2177
  1454
    list  := OrderedCollection new:n.
ca@2177
  1455
    names := view class allInstVarNames.
cg@3040
  1456
    indices := (1 to:names size) asArray.
cg@3040
  1457
    names sortWith:indices.
ca@2177
  1458
ca@2177
  1459
    1 to:n do:[:i| |action|
ca@2177
  1460
        label := (names at:i) printString.
cg@3040
  1461
        value := view instVarAt:(indices at:i).
ca@2177
  1462
        value isNil ifTrue:[
ca@2177
  1463
            value  := '------'.
ca@2177
  1464
            action := nil.
ca@2177
  1465
        ] ifFalse:[
ca@2177
  1466
            value  := value displayString contractAtEndTo:40.
ca@2177
  1467
            action := [(view instVarAt:i) inspect].
ca@2177
  1468
        ].
ca@2177
  1469
        list add:(MenuDesc title:label value:value action:action).
ca@2177
  1470
    ].
ca@2177
  1471
ca@2177
  1472
    ^ MenuDesc buildFromList:list onGC:aMenu
cg@3040
  1473
cg@3040
  1474
    "Modified: / 31-07-2013 / 13:12:52 / cg"
ca@2177
  1475
!
ca@2177
  1476
ca@2177
  1477
submenuInterface:aMenu
ca@2455
  1478
    "builds and returns the interface submenu"
ca@2455
  1479
ca@2177
  1480
    |view label inst value list|
ca@2177
  1481
ca@2177
  1482
    view := self selectedView.
ca@2177
  1483
    view isNil ifTrue:[^ nil].
ca@2177
  1484
ca@2177
  1485
    list := OrderedCollection new.
ca@2177
  1486
ca@2177
  1487
    inst  := view controller.
ca@2177
  1488
    value := nil.
ca@2177
  1489
ca@2177
  1490
    inst isNil ifTrue:[
ca@2177
  1491
        label := nil
ca@2177
  1492
    ] ifFalse:[
cg@2758
  1493
        inst == view ifTrue:[ 
cg@2758
  1494
            label := '== view itself' 
cg@2758
  1495
        ] ifFalse:[ 
cg@2758
  1496
            label := inst displayString.
cg@2758
  1497
            value := [view controller inspect].
cg@2758
  1498
        ].
ca@2177
  1499
    ].
ca@2177
  1500
    list add:(MenuDesc title:'controller' value:label action:value).
ca@2177
  1501
ca@2177
  1502
    inst := view delegate.
ca@2177
  1503
    inst notNil ifTrue:[
ca@2177
  1504
        list add:(MenuDesc title:'delegate' value:(inst displayString) action:[ view delegate inspect ]).
ca@2177
  1505
    ].
ca@2177
  1506
ca@2177
  1507
    inst := view application.
ca@2177
  1508
cg@2758
  1509
    inst notNil ifTrue:[ 
cg@2758
  1510
        |topAppl|
cg@2758
  1511
ca@2177
  1512
        list add:(MenuDesc title:'application' value:inst action:[ view application inspect ]).
ca@2177
  1513
ca@2177
  1514
        topAppl := inst topApplication.
ca@2177
  1515
ca@2177
  1516
        (topAppl notNil and:[topAppl ~~ inst]) ifTrue:[
ca@2177
  1517
            list add:(MenuDesc title:'topApplication' value:topAppl action:[ inst topApplication inspect ]).
ca@2177
  1518
        ].
ca@2177
  1519
    ].
ca@2177
  1520
    list add:(MenuDesc separator).
ca@2177
  1521
cg@2888
  1522
    (view respondsTo:#'model') ifTrue:[
cg@2779
  1523
        inst := view model.
ca@2177
  1524
cg@2888
  1525
        inst isNil 
cg@2888
  1526
            ifTrue:[ label := value := nil ]
cg@2888
  1527
            ifFalse:[ label := inst displayString.
cg@2888
  1528
                      label := label,(self aspectLabelFor:inst inApplicationOf:view).  
cg@2888
  1529
                      value := [ view model inspect ].
cg@2888
  1530
                    ].
ca@2177
  1531
ca@2177
  1532
        list add:(MenuDesc title:'model' value:label action:value).
ca@2177
  1533
ca@2177
  1534
        (inst notNil and:[view respondsTo:#modelInterface]) ifTrue:[
ca@2177
  1535
            view modelInterface keysAndValuesDo:[:key : val|
ca@2177
  1536
                val isNil ifTrue:[ label := nil ]
ca@2177
  1537
                         ifFalse:[ label := val displayString ].
ca@2177
  1538
ca@2177
  1539
                list add:(MenuDesc title:('      - ', key) value:label ).
ca@2177
  1540
            ]
ca@2177
  1541
        ].
ca@2177
  1542
    ].
ca@2177
  1543
ca@2177
  1544
    (view respondsTo:#enableChannel) ifTrue:[
ca@2177
  1545
        inst := view enableChannel.
ca@2177
  1546
ca@2177
  1547
        inst isNil ifTrue:[ label := value := nil ]
ca@2177
  1548
                  ifFalse:[ label := inst displayString.
cg@2888
  1549
                            label := label,(self aspectLabelFor:inst inApplicationOf:view).  
ca@2177
  1550
                            value := [ view enableChannel inspect ].
ca@2177
  1551
                          ].
ca@2177
  1552
ca@2177
  1553
        list add:(MenuDesc title:'enableChannel' value:label action:value).
ca@2177
  1554
    ].
ca@2177
  1555
cg@2888
  1556
    #( #action #pressAction #releaseAction ) do:[:actionSelector |
cg@2779
  1557
        (view respondsTo:actionSelector) ifTrue:[
cg@2779
  1558
            inst := view perform:actionSelector.
cg@2779
  1559
cg@2779
  1560
            inst isNil 
cg@2779
  1561
                ifTrue:[ label := value := nil ]
cg@2779
  1562
                ifFalse:[ label := inst displayString.
cg@2779
  1563
                            value := [ (view perform:actionSelector) inspect ].
cg@2779
  1564
                        ].
cg@2779
  1565
cg@3040
  1566
            list add:(MenuDesc title:actionSelector"'action'" value:label action:value).
cg@2779
  1567
        ].
cg@2779
  1568
    ].
cg@2779
  1569
ca@2177
  1570
    list last isSeparator ifFalse:[ list add:(MenuDesc separator) ].
ca@2177
  1571
ca@2177
  1572
    (view respondsTo:#listHolder) ifTrue:[
ca@2177
  1573
        inst := view listHolder.
ca@2177
  1574
ca@2177
  1575
        inst isNil ifTrue:[ label := value := nil ]
ca@2177
  1576
                  ifFalse:[ label := inst class printString.
cg@2888
  1577
                            label := label,(self aspectLabelFor:inst inApplicationOf:view).  
ca@2177
  1578
                            value := [ view listHolder inspect ].
ca@2177
  1579
                          ].
ca@2177
  1580
        list add:(MenuDesc title:'listHolder' value:label action:value).
ca@2177
  1581
    ].
ca@2177
  1582
ca@2177
  1583
    (view respondsTo:#list) ifTrue:[
ca@2177
  1584
        inst := view list.
ca@2177
  1585
ca@2177
  1586
        inst isNil ifTrue:[ label := value := nil ]
ca@2177
  1587
                  ifFalse:[ label := '%1 [%2]' bindWith:(inst class printString) with:(inst size).
cg@2888
  1588
                            label := label,(self aspectLabelFor:inst inApplicationOf:view).  
ca@2177
  1589
                            value := [ view list inspect ].
ca@2177
  1590
                          ].
ca@2177
  1591
ca@2177
  1592
        list add:(MenuDesc title:'list' value:label action:value).
ca@2177
  1593
    ].
ca@2177
  1594
ca@2177
  1595
    list last isSeparator ifTrue:[ list removeLast ].
cg@2888
  1596
    ^ MenuDesc buildFromList:list onGC:aMenu
cg@2888
  1597
cg@3040
  1598
    "Modified: / 31-07-2013 / 13:09:55 / cg"
ca@2177
  1599
!
ca@2177
  1600
ca@2177
  1601
submenuVisibility:aMenu
ca@2455
  1602
    "builds and returns the geometry submenu"
ca@2455
  1603
ca@2177
  1604
    |view list value|
ca@2177
  1605
ca@2177
  1606
    view := self selectedView.
ca@2177
  1607
    view isNil ifTrue:[^ nil].
ca@2177
  1608
ca@2177
  1609
    list := OrderedCollection new.
ca@2177
  1610
ca@2177
  1611
    list add:(MenuDesc title:'device'     value:(view device printString)).
ca@2177
  1612
    list add:(MenuDesc title:'drawableId' value:(view id)).
ca@2177
  1613
    list add:(MenuDesc title:'gcId'       value:(view gcId)).
ca@2177
  1614
ca@2177
  1615
    list add:(MenuDesc separator).
ca@2177
  1616
ca@2177
  1617
    list add:(MenuDesc title:'shown'    value:(view shown)).
ca@2177
  1618
    list add:(MenuDesc title:'realized' value:(view realized)).
ca@2177
  1619
ca@2177
  1620
    list add:(MenuDesc separator).
ca@2177
  1621
ca@2177
  1622
    list add:(MenuDesc title:'hiddenOnRealize' value:(view isHiddenOnRealize)).
ca@2177
  1623
ca@2177
  1624
    (value := view visibilityChannel) isNil ifTrue:[
ca@2177
  1625
        list add:(MenuDesc title:'visibilityChannel' value:'------').
ca@2177
  1626
    ] ifFalse:[
ca@2177
  1627
        list add:(MenuDesc title:'visibilityChannel'
ca@2177
  1628
                           value:(value displayString)
ca@2177
  1629
                          action:[view visibilityChannel inspect]).
ca@2177
  1630
    ].
ca@2177
  1631
cg@2758
  1632
    ^ MenuDesc buildFromList:list onGC:aMenu
ca@2177
  1633
! !
ca@2177
  1634
cg@2744
  1635
!ViewTreeInspectorApplication methodsFor:'private'!
ca@2177
  1636
cg@2888
  1637
aspectLabelFor:aModel inApplicationOf:aView
cg@2888
  1638
    |app|
cg@2888
  1639
cg@2888
  1640
    aModel isNil ifTrue:[^ ''].
cg@2888
  1641
    aView isNil ifTrue:[^ ''].
cg@2888
  1642
    (app := aView application) isNil ifTrue:[^ ''].
cg@2888
  1643
    app builder bindings keysAndValuesDo:[:aspect :value |
cg@2888
  1644
        value == aModel ifTrue:[^ ' [aspect: ',aspect,']'].
cg@2888
  1645
    ].
cg@2888
  1646
    app class allInstVarNames do:[:nm | 
cg@2888
  1647
        (app instVarNamed:nm) == aModel ifTrue:[^ ' [instvar: ',nm,']']
cg@2888
  1648
    ].
cg@2888
  1649
cg@2888
  1650
    ^ ''
cg@2888
  1651
cg@2888
  1652
    "Created: / 27-04-2012 / 14:22:09 / cg"
cg@2888
  1653
!
cg@2888
  1654
ca@2177
  1655
selectFocusView
cg@2762
  1656
    |rootView focusView|
ca@2177
  1657
ca@2177
  1658
    rootView := model rootView.
ca@2177
  1659
ca@2177
  1660
    (rootView notNil and:[rootView shown]) ifTrue:[
ca@2177
  1661
        focusView := rootView windowGroup focusView.
ca@2177
  1662
    ].
ca@2177
  1663
    focusView isNil ifTrue:[^ self ].
ca@2177
  1664
cg@2762
  1665
    self selectView:focusView
cg@2762
  1666
!
cg@2762
  1667
cg@2762
  1668
selectView:aView
cg@2762
  1669
    |currentItem viewItem|
cg@2762
  1670
cg@2762
  1671
    currentItem := model selectedItem.
cg@2762
  1672
cg@2762
  1673
    (currentItem notNil and:[currentItem widget == aView]) ifTrue:[
ca@2177
  1674
        ^ self
ca@2177
  1675
    ].
cg@2762
  1676
    viewItem := model listOfItems recursiveDetect:[:el| el widget == aView ].
cg@2762
  1677
cg@2762
  1678
    viewItem notNil ifTrue:[
cg@2762
  1679
        model selectItem:viewItem.
ca@2177
  1680
    ].        
ca@2177
  1681
!
ca@2177
  1682
ca@2177
  1683
setRootItem:aRootItemOrNil
ca@2177
  1684
    |theProcess|
ca@2177
  1685
ca@2177
  1686
    aRootItemOrNil isNil ifTrue:[
ca@2177
  1687
        process := nil.
ca@2177
  1688
    ] ifFalse:[
ca@2177
  1689
        "/ expand tree to level 3
ca@2177
  1690
        aRootItemOrNil do:[:aRootChild|
ca@2177
  1691
            aRootChild do:[:aSubChild| aSubChild expand ].
ca@2177
  1692
            aRootChild expand.
ca@2177
  1693
        ].
ca@2177
  1694
        aRootItemOrNil expand.
ca@2177
  1695
ca@2177
  1696
        process isNil ifTrue:[
ca@2177
  1697
            theProcess := process :=
cg@3034
  1698
                Process 
cg@3034
  1699
                    for:[   
cg@3034
  1700
                        |update testModeChannel|
cg@3034
  1701
cg@3034
  1702
                        update := false.
cg@3034
  1703
                        testModeChannel := model testModeChannel.
cg@3034
  1704
cg@3034
  1705
                        [process == theProcess] whileTrue:[
cg@3034
  1706
                            Delay waitForSeconds:0.5.
cg@3034
  1707
cg@3034
  1708
                            (treeView notNil and:[process == theProcess and:[treeView shown]]) ifTrue:[
cg@3034
  1709
                                (testModeChannel value == true and:[followFocusChannel value == true]) ifTrue:[
cg@3034
  1710
                                    self selectFocusView.
ca@2177
  1711
                                ].
cg@3034
  1712
                                update ifTrue:[
cg@3034
  1713
                                    self updateShownStatus.
cg@3034
  1714
                                ].
cg@3034
  1715
                                update := update not.
cg@3034
  1716
                            ].
cg@3034
  1717
                        ].
cg@3034
  1718
                    ] 
cg@3034
  1719
                    priority:(Processor userSchedulingPriority).
cg@3034
  1720
            theProcess name:'ViewTreeInspector - Focus Follower'.
ca@2177
  1721
            theProcess resume.
ca@2177
  1722
        ].
ca@2177
  1723
    ].
ca@2177
  1724
    model rootItem:aRootItemOrNil.
cg@3034
  1725
cg@3034
  1726
    "Modified: / 25-07-2013 / 12:03:44 / cg"
ca@2177
  1727
!
ca@2177
  1728
ca@2177
  1729
updateShownStatus
ca@2177
  1730
    |rootItem min max visState listIdx visY0 visY1 height damage|
ca@2177
  1731
ca@2177
  1732
    rootItem := model rootItem.
ca@2177
  1733
    (rootItem notNil and:[rootItem widget shown]) ifFalse:[^ self].
ca@2177
  1734
ca@2177
  1735
    max := 0.
ca@2177
  1736
    min := 9999999.
ca@2177
  1737
ca@2177
  1738
    rootItem recursiveEachVisibleItemDo:[:anItem|
ca@2177
  1739
        visState := (anItem widget shown).
ca@2177
  1740
ca@2177
  1741
        visState ~~ anItem isDrawnShown ifTrue:[
ca@2177
  1742
            anItem isDrawnShown:visState.
ca@2177
  1743
            listIdx := treeView identityIndexOf:anItem.
ca@2177
  1744
ca@2177
  1745
            listIdx > 0 ifTrue:[    
ca@2177
  1746
                max := max max:listIdx.
ca@2177
  1747
                min := min min:listIdx.
ca@2177
  1748
            ].
ca@2177
  1749
        ].
ca@2177
  1750
    ].
ca@2177
  1751
    max < min ifTrue:[^ self].
ca@2177
  1752
    max := max + 1.
ca@2177
  1753
ca@2177
  1754
    visY0  := (treeView yVisibleOfLine:min) max:0.
ca@2177
  1755
    visY1  := (treeView yVisibleOfLine:max) min:(treeView height).
ca@2177
  1756
    height := visY1 - visY0.
ca@2177
  1757
    
ca@2177
  1758
    height > 2 ifTrue:[
ca@2177
  1759
        treeView shown ifTrue:[
ca@2177
  1760
            damage := Rectangle left:0 top:visY0 width:(treeView width) height:height.
ca@2177
  1761
            treeView invalidateDeviceRectangle:damage repairNow:false.
ca@2177
  1762
        ].
ca@2177
  1763
    ].
ca@2177
  1764
! !
ca@2177
  1765
cg@2744
  1766
!ViewTreeInspectorApplication methodsFor:'selection'!
ca@2177
  1767
ca@2177
  1768
selectedView
ca@2455
  1769
    "answer the selected view or nil"
ca@2455
  1770
ca@2177
  1771
    |item|
ca@2177
  1772
ca@2177
  1773
    item := model selectedItem.
ca@2177
  1774
    item notNil ifTrue:[ ^ item widget ].
ca@2177
  1775
  ^ nil
ca@2177
  1776
! !
ca@2177
  1777
cg@2744
  1778
!ViewTreeInspectorApplication methodsFor:'testing'!
ca@2177
  1779
ca@2177
  1780
resolveApplicationClassFor:aTreeItem
ca@2177
  1781
    aTreeItem isApplicationClass ifTrue:[
ca@2177
  1782
       ^ aTreeItem applicationClass
ca@2177
  1783
    ].
ca@2177
  1784
    ^ nil
ca@2177
  1785
!
ca@2177
  1786
ca@2177
  1787
selectedComponentHasChildren
ca@2177
  1788
    |item|
ca@2177
  1789
ca@2177
  1790
    item := model selectedItem.
ca@2177
  1791
    ^ (item notNil and:[item hasChildren])
ca@2177
  1792
! !
ca@2177
  1793
cg@2744
  1794
!ViewTreeInspectorApplication methodsFor:'user operations'!
ca@2177
  1795
ca@2177
  1796
doBrowse:what
ca@2177
  1797
    "open browser on:
ca@2177
  1798
        #view           browse class
ca@2177
  1799
        #model          browse model class
ca@2177
  1800
        #application    browse application class
ca@2177
  1801
        #controller     browse controller class
ca@2177
  1802
    "
ca@2177
  1803
    |view inst|
ca@2177
  1804
ca@2177
  1805
    view := self selectedView.
ca@2177
  1806
    view isNil ifTrue:[^ self].
ca@2177
  1807
ca@2177
  1808
             what == #view        ifTrue:[ inst := view ]
ca@2177
  1809
    ifFalse:[what == #model       ifTrue:[ inst := view model ]
ca@2177
  1810
    ifFalse:[what == #application ifTrue:[ inst := view application ]
ca@2177
  1811
    ifFalse:[what == #controller  ifTrue:[ inst := view controller ]
cg@3049
  1812
    ifFalse:[what == #sensor      ifTrue:[ inst := view sensor ]
cg@3049
  1813
    ifFalse:[what == #group       ifTrue:[ inst := view windowGroup ]
ca@2177
  1814
    ifFalse:[
ca@2177
  1815
        ^ self
cg@3049
  1816
    ]]]]]].
ca@2177
  1817
ca@2177
  1818
    inst notNil ifTrue:[
ca@2177
  1819
        inst class browserClass openInClass:(inst class) selector:nil
ca@2177
  1820
    ].
cg@3049
  1821
cg@3049
  1822
    "Modified: / 28-08-2013 / 23:57:42 / cg"
ca@2177
  1823
!
ca@2177
  1824
ca@2177
  1825
doDestroy
ca@2455
  1826
    "destroy the current selected view"
ca@2455
  1827
ca@2177
  1828
    |item parent|
ca@2177
  1829
ca@2177
  1830
    item := model selectedItem.
ca@2177
  1831
    item isNil ifTrue:[ ^ self].
ca@2177
  1832
ca@2177
  1833
    parent := item parent.
ca@2177
  1834
ca@2177
  1835
    parent isNil ifTrue:[
ca@2177
  1836
        "/ the root
ca@2177
  1837
        model withSelectionHiddenDo:[item deleteAll].
ca@2177
  1838
      ^ self
ca@2177
  1839
    ].
ca@2177
  1840
ca@2177
  1841
    model withSelectionHiddenDo:[
ca@2177
  1842
        |idx nsel|
ca@2177
  1843
ca@2177
  1844
        idx := parent identityIndexOf:item.
ca@2177
  1845
ca@2177
  1846
        idx == parent size ifTrue:[
ca@2177
  1847
            nsel := parent at:(idx - 1) ifAbsent:parent
ca@2177
  1848
        ] ifFalse:[
ca@2177
  1849
            nsel := parent at:(idx + 1)
ca@2177
  1850
        ].
ca@2177
  1851
        model setValue:nil.
ca@2177
  1852
        item delete.
ca@2177
  1853
ca@2177
  1854
        parent isLayoutContainer ifTrue:[
ca@2177
  1855
            parent widget sizeChanged:nil
ca@2177
  1856
        ].
ca@2177
  1857
        model value:nsel.
ca@2177
  1858
    ].
ca@2177
  1859
!
ca@2177
  1860
ca@2177
  1861
doFlash
ca@2455
  1862
    "flash the selected view"
ca@2455
  1863
ca@2177
  1864
    |view|
ca@2177
  1865
ca@2177
  1866
    view := self selectedView.
ca@2177
  1867
    view isNil ifTrue:[ ^ self].
ca@2177
  1868
ca@2177
  1869
    view shown ifTrue:[
ca@2177
  1870
        model withSelectionHiddenDo:[
ca@2177
  1871
            view perform:#flash ifNotUnderstood:nil.
ca@2177
  1872
        ].
ca@2177
  1873
    ].
ca@2177
  1874
!
ca@2177
  1875
ca@2177
  1876
doInspect:what
ca@2177
  1877
    "open inspector on:
ca@2177
  1878
        #view           inspect class
ca@2177
  1879
        #group          inspect windowGroup
ca@2177
  1880
        #model          inspect model
ca@2177
  1881
        #application    inspect application
ca@2177
  1882
        #controller     inspect controller
cg@3034
  1883
        #process        inspect application's process
ca@2177
  1884
    "
ca@2177
  1885
    |inst|
ca@2177
  1886
ca@2177
  1887
    inst := self selectedView.
ca@2177
  1888
    inst isNil ifTrue:[^ self].
ca@2177
  1889
ca@2177
  1890
             what == #group       ifTrue:[ inst := inst windowGroup ]
ca@2177
  1891
    ifFalse:[what == #model       ifTrue:[ inst := inst model ]
ca@2177
  1892
    ifFalse:[what == #application ifTrue:[ inst := inst application ]
cg@3034
  1893
    ifFalse:[what == #controller  ifTrue:[ inst := inst controller  ]
cg@3049
  1894
    ifFalse:[what == #process     ifTrue:[ inst := inst windowGroup process  ]
cg@3049
  1895
    ifFalse:[what == #sensor      ifTrue:[ inst := inst sensor  ]]]]]].
ca@2177
  1896
ca@2177
  1897
    inst notNil ifTrue:[ inst inspect ].
cg@3049
  1898
cg@3049
  1899
    "Modified: / 28-08-2013 / 23:58:27 / cg"
ca@2177
  1900
!
ca@2177
  1901
cg@3034
  1902
doOpenProcessMonitor
cg@3034
  1903
    (ProcessMonitorV2 ? ProcessMonitor) open
cg@3034
  1904
cg@3034
  1905
    "Created: / 25-07-2013 / 12:34:23 / cg"
cg@3034
  1906
!
cg@3034
  1907
cg@2762
  1908
doPickView
ca@2455
  1909
    "pick a window's topView"
ca@2455
  1910
cg@2762
  1911
    |screen clickedView topWindow cursor|
ca@2177
  1912
ca@2177
  1913
    self doUnpick.
ca@2177
  1914
cg@2759
  1915
    cursor := Cursor fromImage:(self class crossHairIcon).
cg@2759
  1916
cg@2759
  1917
    screen := Screen current.
cg@2762
  1918
    clickedView := screen viewFromPoint:(screen pointFromUserShowing:cursor).
cg@2762
  1919
    clickedView isNil ifTrue:[^ self].
cg@2762
  1920
cg@2762
  1921
    topWindow := clickedView topView.
cg@2762
  1922
cg@2762
  1923
    (    topWindow == Screen current rootView
cg@2762
  1924
     or:[topWindow == self window topView]
ca@2177
  1925
    ) ifTrue:[
ca@2177
  1926
        ^ self
ca@2177
  1927
    ].
cg@2978
  1928
cg@3014
  1929
    self showWindow:clickedView
ca@2177
  1930
!
ca@2177
  1931
cg@2978
  1932
doRedraw
cg@2978
  1933
    "redraw the app"
cg@2978
  1934
cg@2978
  1935
    model rootView withAllSubViewsDo:[:v | v redraw; invalidate].
cg@2978
  1936
!
cg@2978
  1937
ca@2177
  1938
doSelectNextOfApplicationClass:aClass startingIn:anItem
ca@2177
  1939
    |startItem firstFound searchNext|
ca@2177
  1940
ca@2177
  1941
    startItem  := model last.
ca@2177
  1942
    searchNext := startItem notNil.        
ca@2177
  1943
    firstFound := nil.
ca@2177
  1944
ca@2177
  1945
    anItem recursiveDo:[:el|
ca@2177
  1946
        el == startItem ifTrue:[
ca@2177
  1947
            searchNext := false
ca@2177
  1948
        ] ifFalse:[
ca@2177
  1949
            (self resolveApplicationClassFor:el) == aClass ifTrue:[
ca@2177
  1950
                searchNext ifFalse:[^ model selectItem:el].
ca@2177
  1951
ca@2177
  1952
                firstFound isNil ifTrue:[
ca@2177
  1953
                    firstFound := el
ca@2177
  1954
                ]
ca@2177
  1955
            ]
ca@2177
  1956
        ]
ca@2177
  1957
    ].
ca@2177
  1958
    firstFound notNil ifTrue:[
ca@2177
  1959
        self window beep.
ca@2177
  1960
        model selectItem:firstFound
ca@2177
  1961
    ].
ca@2177
  1962
!
ca@2177
  1963
ca@2177
  1964
doSelectNextOfClass:aClass startingIn:anItem
ca@2177
  1965
    |startItem firstFound searchNext|
ca@2177
  1966
ca@2177
  1967
    startItem  := model last.
ca@2177
  1968
    searchNext := startItem notNil.        
ca@2177
  1969
    firstFound := nil.
ca@2177
  1970
ca@2177
  1971
    anItem recursiveDo:[:el|
ca@2177
  1972
        el == startItem ifTrue:[
ca@2177
  1973
            searchNext := false
ca@2177
  1974
        ] ifFalse:[
ca@2177
  1975
            el widget class == aClass ifTrue:[
ca@2177
  1976
                searchNext ifFalse:[^ model selectItem:el].
ca@2177
  1977
ca@2177
  1978
                firstFound isNil ifTrue:[
ca@2177
  1979
                    firstFound := el
ca@2177
  1980
                ]
ca@2177
  1981
            ]
ca@2177
  1982
        ]
ca@2177
  1983
    ].
ca@2177
  1984
    firstFound notNil ifTrue:[
ca@2177
  1985
        self window beep.
ca@2177
  1986
        model selectItem:firstFound
ca@2177
  1987
    ].
ca@2177
  1988
!
ca@2177
  1989
cg@2978
  1990
doUncatchEvents
cg@2978
  1991
    model catchEvents:false.
cg@2978
  1992
    self doRedraw
cg@2978
  1993
!
cg@2978
  1994
ca@2177
  1995
doUnpick
ca@2455
  1996
    "release current picked window and contained subwindows"
ca@2455
  1997
ca@2177
  1998
    self setRootItem:nil.
cg@2744
  1999
!
cg@2744
  2000
cg@2744
  2001
openDocumentation
cg@2744
  2002
    HTMLDocumentView openFullOnDocumentationFile:'tools/misc/TOP.html#VIEWTREEINSPECTOR'
cg@3014
  2003
!
cg@3014
  2004
cg@3014
  2005
showWindow:aView
cg@3014
  2006
    "show a particular window's topView hierarchy,
cg@3014
  2007
     select the given view"
cg@3014
  2008
cg@3014
  2009
    | topWindow |
cg@3014
  2010
cg@3014
  2011
    topWindow := aView topView.
cg@3014
  2012
cg@3014
  2013
    model catchEvents:true.
cg@3014
  2014
    self setRootItem:(ViewTreeItem buildViewsFrom:topWindow).
cg@3014
  2015
    self selectView:aView.
ca@2177
  2016
! !
ca@2177
  2017
cg@2744
  2018
!ViewTreeInspectorApplication::MenuDesc class methodsFor:'building'!
ca@2177
  2019
ca@2177
  2020
buildFromList:aList onGC:aMenu
ca@2177
  2021
    |tabSpec menu w menuPanel|
ca@2177
  2022
ca@2177
  2023
    w := 0.
ca@2177
  2024
    aList do:[:el| w := w max:(el widthOn:aMenu) ].
ca@2177
  2025
ca@2177
  2026
    tabSpec := TabulatorSpecification new.
ca@2177
  2027
    tabSpec unit:#pixel.
ca@2177
  2028
    tabSpec positions:#(0     1.5 ).
ca@2177
  2029
    tabSpec align:#(#left #left).
ca@2177
  2030
ca@2177
  2031
    w := w + 15.
ca@2177
  2032
    tabSpec positions:(Array with:0 with:w).
ca@2177
  2033
ca@2177
  2034
    menu := Menu new.
ca@2177
  2035
ca@2177
  2036
    aList do:[:el|
ca@2177
  2037
        menu addItem:(el asMenuItemWithTabulatorSpecification:tabSpec).
ca@2177
  2038
    ].
ca@2177
  2039
    menuPanel := MenuPanel menu:menu.
ca@2177
  2040
    ^ menuPanel
ca@2177
  2041
! !
ca@2177
  2042
cg@2744
  2043
!ViewTreeInspectorApplication::MenuDesc class methodsFor:'instance creation'!
ca@2177
  2044
ca@2177
  2045
separator
ca@2177
  2046
    ^ self new
ca@2177
  2047
!
ca@2177
  2048
ca@2177
  2049
title:aTitle value:aValue
ca@2177
  2050
    ^ self title:aTitle value:aValue action:nil
ca@2177
  2051
!
ca@2177
  2052
ca@2177
  2053
title:aTitle value:aValue action:anAction
ca@2177
  2054
    ^ self new title:aTitle value:aValue action:anAction
ca@2177
  2055
! !
ca@2177
  2056
cg@2744
  2057
!ViewTreeInspectorApplication::MenuDesc methodsFor:'accessing'!
ca@2177
  2058
ca@2177
  2059
title
ca@2177
  2060
    ^ title
ca@2177
  2061
! !
ca@2177
  2062
cg@2744
  2063
!ViewTreeInspectorApplication::MenuDesc methodsFor:'building'!
ca@2177
  2064
ca@2177
  2065
asMenuItemWithTabulatorSpecification:aTabSpec
ca@2177
  2066
    |array|
ca@2177
  2067
ca@2177
  2068
    title isNil ifTrue:[ ^ MenuItem label:value ].     "/ separator
ca@2177
  2069
ca@2177
  2070
    array := Array with:(title, ':') with:'------'.
ca@2177
  2071
ca@2177
  2072
    value notNil ifTrue:[
ca@2177
  2073
        array at:2 put:(value printString, ' ')
ca@2177
  2074
    ].
ca@2177
  2075
cg@2758
  2076
   ^ MenuItem 
cg@2758
  2077
        label:(MultiColListEntry fromStrings:array tabulatorSpecification:aTabSpec)
cg@2758
  2078
        value:action
ca@2177
  2079
! !
ca@2177
  2080
cg@2744
  2081
!ViewTreeInspectorApplication::MenuDesc methodsFor:'instance creation'!
ca@2177
  2082
ca@2177
  2083
title:aTitle value:aValue action:anAction
ca@2177
  2084
    "test for separator
ca@2177
  2085
    "
ca@2177
  2086
    title  := aTitle withoutSeparators.
ca@2177
  2087
    action := anAction.
ca@2177
  2088
ca@2177
  2089
    aValue notNil ifTrue:[
ca@2177
  2090
        value := aValue printString.
ca@2177
  2091
ca@2177
  2092
        value size > 70 ifTrue:[
ca@2177
  2093
            value := value copyFrom:1 to:70.
ca@2177
  2094
            value := value, '...'
ca@2177
  2095
        ]
ca@2177
  2096
    ].
ca@2177
  2097
! !
ca@2177
  2098
cg@2744
  2099
!ViewTreeInspectorApplication::MenuDesc methodsFor:'queries'!
ca@2177
  2100
ca@2177
  2101
isSeparator
ca@2177
  2102
    ^ title isNil
ca@2177
  2103
!
ca@2177
  2104
ca@2177
  2105
widthOn:aGC
ca@2177
  2106
    title isNil ifTrue:[^ 5].  "/ separator
cg@2758
  2107
    ^ title widthOn:aGC
ca@2177
  2108
! !
ca@2177
  2109
cg@2744
  2110
!ViewTreeInspectorApplication::ViewTreeItem class methodsFor:'building'!
cg@2744
  2111
cg@2744
  2112
buildViewsFrom:aView
cg@2744
  2113
    "build the items starting from a source view;
cg@2744
  2114
     returns the anhor.
cg@2744
  2115
    "
cg@2744
  2116
    |item subViews subItems|
cg@2744
  2117
cg@2744
  2118
    aView isNil ifTrue:[^ nil].
cg@2744
  2119
cg@2744
  2120
    item     := self forView:aView.
cg@2744
  2121
    subViews := aView subViews.
cg@2744
  2122
cg@2744
  2123
    subViews notEmptyOrNil ifTrue:[
cg@2744
  2124
        subItems := OrderedCollection new.
cg@2744
  2125
        subViews do:[:aSubView|
cg@2744
  2126
            subItems add:(self buildViewsFrom:aSubView).
cg@2744
  2127
        ].
cg@2744
  2128
        item children:subItems.
cg@2744
  2129
    ].
cg@2744
  2130
    ^ item
cg@2744
  2131
! !
cg@2744
  2132
cg@2744
  2133
!ViewTreeInspectorApplication::ViewTreeItem class methodsFor:'documentation'!
cg@2744
  2134
cg@2744
  2135
documentation
cg@2744
  2136
"
cg@2744
  2137
    ViewTreeItems represants a pickable object within a ViewTreeModel.
cg@2744
  2138
    The class is used to build up the hierarchical tree.
cg@2744
  2139
cg@2744
  2140
    [Instance variables:]
cg@2744
  2141
        widget        <View>            the widget represented by the item
cg@2744
  2142
        spec          <UISpecification> the UISpecification or nil
cg@2744
  2143
cg@2744
  2144
    [Class variables:]
cg@2744
  2145
        HandleExtent  <Point>           keeps the extent of a handle
cg@2744
  2146
cg@2744
  2147
cg@2744
  2148
    [author:]
cg@2744
  2149
        Claus Atzkern
cg@2744
  2150
cg@2744
  2151
    [see also:]
cg@2744
  2152
        HierarchicalItem
cg@2744
  2153
        ViewTreeModel
cg@2744
  2154
"
cg@2744
  2155
!
ca@2177
  2156
ca@2177
  2157
version
ca@2177
  2158
    ^ '$Header$'
ca@2177
  2159
! !
ca@2177
  2160
cg@2744
  2161
!ViewTreeInspectorApplication::ViewTreeItem class methodsFor:'initialization'!
cg@2744
  2162
cg@2744
  2163
initialize
cg@2744
  2164
    "set the extent of the Handle
cg@2744
  2165
    "
cg@2744
  2166
    HandleExtent := 6@6.
cg@2744
  2167
! !
cg@2744
  2168
cg@2744
  2169
!ViewTreeInspectorApplication::ViewTreeItem class methodsFor:'instance creation'!
cg@2744
  2170
cg@2744
  2171
forView:aView
cg@2744
  2172
    |item|
cg@2744
  2173
cg@2744
  2174
    item := self basicNew initialize.
cg@2744
  2175
    item forView:aView.
cg@2744
  2176
  ^ item
cg@2744
  2177
!
cg@2744
  2178
cg@2744
  2179
new
cg@2744
  2180
    self error:'not allowed'.
cg@2744
  2181
  ^ nil
cg@2744
  2182
!
cg@2744
  2183
cg@2744
  2184
on:aView withSpec:aSpec
cg@2744
  2185
    |item|
cg@2744
  2186
cg@2744
  2187
    item := self basicNew initialize.
cg@2744
  2188
    item on:aView withSpec:aSpec.
cg@2744
  2189
  ^ item
cg@2744
  2190
! !
cg@2744
  2191
cg@2744
  2192
!ViewTreeInspectorApplication::ViewTreeItem methodsFor:'accessing'!
cg@2744
  2193
cg@2744
  2194
applicationClass
cg@2744
  2195
    |appl|
cg@2744
  2196
cg@2744
  2197
    widget notNil ifTrue:[
cg@2744
  2198
        appl := widget application.
cg@2744
  2199
        appl notNil ifTrue:[^ appl class ].
cg@2744
  2200
    ].
cg@2744
  2201
    ^ nil
cg@2744
  2202
!
cg@2744
  2203
cg@2744
  2204
isDrawnShown
cg@2744
  2205
    "returns true if the last display operations was done during the widget was shown
cg@2744
  2206
    "
cg@2744
  2207
    ^ isDrawnShown
cg@2744
  2208
!
cg@2744
  2209
cg@2744
  2210
isDrawnShown:aBoolean
cg@2744
  2211
    isDrawnShown := aBoolean.
cg@2744
  2212
!
cg@2744
  2213
cg@2744
  2214
rootView
cg@2744
  2215
    "returns the widget assigned to the root or nil
cg@2744
  2216
    "
cg@2744
  2217
    ^ parent rootView
cg@2744
  2218
!
cg@2744
  2219
cg@2744
  2220
specClass
cg@2744
  2221
    "returns the spec-class assigned to the item
cg@2744
  2222
    "
cg@2744
  2223
    ^ widget specClass
cg@2744
  2224
!
cg@2744
  2225
cg@2744
  2226
treeModel
cg@2744
  2227
    "returns the assigned treeModel, an instance of ViewTreeModel
cg@2744
  2228
    "
cg@2744
  2229
    ^ parent treeModel
cg@2744
  2230
!
cg@2744
  2231
cg@2744
  2232
widget
cg@2744
  2233
    "returns the widget assigned to the item
cg@2744
  2234
    "
cg@2744
  2235
    ^ widget
cg@2744
  2236
! !
cg@2744
  2237
cg@2744
  2238
!ViewTreeInspectorApplication::ViewTreeItem methodsFor:'accessing layout'!
cg@2744
  2239
cg@2744
  2240
boundsRelativeToRoot
cg@2744
  2241
    "returns the bounds relative to the root widget
cg@2744
  2242
    "
cg@2744
  2243
    ^ self originRelativeToRoot extent:(widget extent)
cg@2744
  2244
!
cg@2744
  2245
cg@2744
  2246
cornerRelativeToRoot
cg@2744
  2247
    "returns the corner relative to the root widget
cg@2744
  2248
    "
cg@2744
  2249
    ^ self originRelativeToRoot + (widget extent)
cg@2744
  2250
!
cg@2744
  2251
cg@2744
  2252
extent
cg@2744
  2253
    "returns the extent of the widget
cg@2744
  2254
    "
cg@2744
  2255
    ^ widget extent
cg@2744
  2256
!
cg@2744
  2257
cg@2744
  2258
layoutType
cg@2744
  2259
    "returns the type of layout assigned to the wiget; nil if the
cg@2744
  2260
     superView cannot resize its sub widgets
cg@2744
  2261
    "
cg@2744
  2262
    |layout specClass superView|
cg@2744
  2263
cg@2744
  2264
    (superView := widget superView) isNil ifTrue:[
cg@2744
  2265
        ^ #Extent
cg@2744
  2266
    ].
cg@2744
  2267
        
cg@2744
  2268
    specClass := superView specClass.
cg@2744
  2269
cg@2744
  2270
    (specClass notNil and:[specClass isLayoutContainer]) ifTrue:[
cg@2744
  2271
        ^ specClass canResizeSubComponents ifTrue:[#Extent] ifFalse:[nil]
cg@2744
  2272
    ].
cg@2744
  2273
cg@2744
  2274
    (layout := widget geometryLayout) isNil ifTrue:[
cg@2744
  2275
        ^ #Extent
cg@2744
  2276
    ].
cg@2744
  2277
cg@2744
  2278
    layout isLayout ifTrue:[
cg@2744
  2279
        layout isLayoutFrame        ifTrue:[ ^ #LayoutFrame ].
cg@2744
  2280
        layout isAlignmentOrigin    ifTrue:[ ^ #AlignmentOrigin ].
cg@2744
  2281
        layout isLayoutOrigin       ifTrue:[ ^ #LayoutOrigin ].
cg@2744
  2282
    ] ifFalse:[
cg@2744
  2283
        layout isRectangle          ifTrue:[ ^ #Rectangle ].
cg@2744
  2284
        layout isPoint              ifTrue:[ ^ #Point ].
cg@2744
  2285
cg@2744
  2286
    ].
cg@2744
  2287
    Transcript showCR:'UNSUPPORTRD LAYOUT: ', layout printString.
cg@2744
  2288
  ^ nil
cg@2744
  2289
!
cg@2744
  2290
cg@2744
  2291
originRelativeToRoot
cg@2744
  2292
    "returns the origin relative to the root widget
cg@2744
  2293
    "
cg@2744
  2294
    ^ widget originRelativeTo:(self rootView)
cg@2744
  2295
! !
cg@2744
  2296
cg@2744
  2297
!ViewTreeInspectorApplication::ViewTreeItem methodsFor:'accessing optimize'!
cg@2744
  2298
cg@2744
  2299
children
cg@2744
  2300
    "redefined: optimize
cg@2744
  2301
    "
cg@2744
  2302
    ^ children
cg@2744
  2303
!
cg@2744
  2304
cg@2744
  2305
hasChildren
cg@2744
  2306
    |subViews list item|
cg@2744
  2307
cg@2744
  2308
    children size ~~ 0 ifTrue:[
cg@2744
  2309
        ^ true
cg@2744
  2310
    ].
cg@2744
  2311
    isExpanded := false.
cg@2744
  2312
    subViews   := widget subViews.
cg@2744
  2313
cg@2744
  2314
    subViews size == 0 ifTrue:[^ false].
cg@2744
  2315
cg@2744
  2316
    list := OrderedCollection new.
cg@2744
  2317
cg@2744
  2318
    subViews do:[:aSubView|
cg@2744
  2319
        item := self class buildViewsFrom:aSubView.
cg@2744
  2320
        item parent:self.
cg@2744
  2321
        list add:item.
cg@2744
  2322
    ].
cg@2744
  2323
    children := list.
cg@2744
  2324
    ^ true
cg@2744
  2325
!
cg@2744
  2326
cg@2744
  2327
size
cg@2744
  2328
    "redefined: returns list of children
cg@2744
  2329
    "
cg@2744
  2330
    ^ children size
cg@2744
  2331
! !
cg@2744
  2332
cg@2744
  2333
!ViewTreeInspectorApplication::ViewTreeItem methodsFor:'displaying'!
cg@2744
  2334
cg@2744
  2335
additionalLabelForItem:anItem
cg@3017
  2336
    "answer an additional label for an Item"
cg@2744
  2337
cg@2744
  2338
    parent notNil ifTrue:[
cg@2744
  2339
        ^ parent additionalLabelForItem:anItem
cg@2744
  2340
    ].
cg@2744
  2341
    ^ nil
cg@2744
  2342
!
cg@2744
  2343
cg@2744
  2344
displayIcon:anIcon atX:x y:y on:aGC
cg@2744
  2345
    |x0 y0 y1 w|
cg@2744
  2346
cg@2744
  2347
    super displayIcon:anIcon atX:x y:y on:aGC.
cg@2744
  2348
cg@2744
  2349
    self exists ifFalse:[
cg@2744
  2350
        aGC paint:(Color red).
cg@2744
  2351
cg@2744
  2352
        y0 := y + 1.
cg@2744
  2353
        y1 := y + anIcon height - 2.
cg@2744
  2354
cg@2744
  2355
        x0 := x - 1.
cg@2744
  2356
        w  := anIcon width.
cg@2744
  2357
cg@2744
  2358
        2 timesRepeat:[
cg@2744
  2359
            aGC displayLineFromX:x0 y:y0 toX:(x0 + w) y:y1.
cg@2744
  2360
            aGC displayLineFromX:x0 y:y1 toX:(x0 + w) y:y0.
cg@2744
  2361
            x0 := x0 + 1.
cg@2744
  2362
        ].
cg@2744
  2363
    ].
cg@2744
  2364
!
cg@2744
  2365
cg@2744
  2366
displayOn:aGC x:x y:y h:h
cg@2744
  2367
    |labelHeight additionalName label isValidAndShown|
cg@2744
  2368
cg@2744
  2369
    label := self label.
cg@2744
  2370
    label isEmptyOrNil ifTrue:[^ self].
cg@2744
  2371
cg@2744
  2372
    widget id isNil ifTrue:[
cg@2744
  2373
        isDrawnShown := false.
cg@2744
  2374
cg@2744
  2375
        self exists ifFalse:[
cg@2744
  2376
            xOffsetAdditionalName := nil.
cg@2744
  2377
        ].
cg@2744
  2378
        isValidAndShown := false.
cg@2744
  2379
    ] ifFalse:[
cg@2744
  2380
        isValidAndShown := widget shown.
cg@2744
  2381
    ].
cg@2744
  2382
    isValidAndShown ifFalse:[
cg@2762
  2383
        label := Text string:label emphasis:#italic.
cg@2762
  2384
        label colorizeAllWith:Color grey.
cg@2744
  2385
    ].
cg@2744
  2386
cg@2744
  2387
    labelHeight := self heightOn:aGC.
cg@2744
  2388
    self displayLabel:label h:labelHeight on:aGC x:x y:y h:h.
cg@2744
  2389
cg@2744
  2390
    xOffsetAdditionalName notNil ifTrue:[
cg@2744
  2391
        additionalName := self additionalLabelForItem:self.
cg@2744
  2392
cg@2744
  2393
        additionalName notNil ifTrue:[
cg@2744
  2394
            self displayLabel:additionalName
cg@2744
  2395
                            h:labelHeight on:aGC
cg@2744
  2396
                            x:(x + xOffsetAdditionalName)
cg@2744
  2397
                            y:y
cg@2744
  2398
                            h:h.
cg@2744
  2399
        ] ifFalse:[
cg@2744
  2400
            xOffsetAdditionalName := nil.
cg@2744
  2401
        ].
cg@2744
  2402
    ].
cg@2744
  2403
!
cg@2744
  2404
cg@2744
  2405
recursiveAdditionalNameBehaviourChanged
cg@2744
  2406
    width := xOffsetAdditionalName := nil.
cg@2744
  2407
cg@2744
  2408
    children notNil ifTrue:[
cg@2744
  2409
        children do:[:each| each recursiveAdditionalNameBehaviourChanged ]
cg@2744
  2410
    ].
cg@2744
  2411
!
cg@2744
  2412
cg@2744
  2413
widthOn:aGC
cg@2744
  2414
    "return the width of the receiver, if it is to be displayed on aGC
cg@2744
  2415
    "
cg@2744
  2416
    |additionalName|
cg@2744
  2417
cg@2744
  2418
    width isNil ifTrue:[
cg@2744
  2419
        width := self widthOf:(self label) on:aGC.
cg@2744
  2420
        width := width + 2.
cg@2744
  2421
cg@2744
  2422
        additionalName := self additionalLabelForItem:self.
cg@2744
  2423
cg@2744
  2424
        additionalName notNil ifTrue:[
cg@2744
  2425
            xOffsetAdditionalName := width + 10.
cg@2744
  2426
            width := xOffsetAdditionalName + (self widthOf:additionalName on:aGC).
cg@2744
  2427
            width := width + 2.
cg@2744
  2428
        ] ifFalse:[
cg@2744
  2429
            xOffsetAdditionalName := nil.
cg@2744
  2430
        ].
cg@2744
  2431
    ].
cg@2744
  2432
    ^ width
cg@2744
  2433
! !
cg@2744
  2434
cg@2744
  2435
!ViewTreeInspectorApplication::ViewTreeItem methodsFor:'enumerating'!
cg@2744
  2436
cg@2744
  2437
handlesDo:aTwoArgAction
cg@2744
  2438
    "evaluate the two arg block on each handle; the arguments to the block is
cg@2744
  2439
     the rectangle relative to the rootView and the handle type which is
cg@2744
  2440
     set to nil if not resizeable.
cg@2744
  2441
cg@2744
  2442
     TYPES:     type    position( X - Y )
cg@2744
  2443
                -------------------------        
cg@2744
  2444
                #LT     Left   - Top
cg@2744
  2445
                #LC     Left   - Center
cg@2744
  2446
                #LB     Left   - Bottom
cg@2744
  2447
                #CT     Center - Top
cg@2744
  2448
                #CB     Center - Bottom
cg@2744
  2449
                #RT     Right  - Top
cg@2744
  2450
                #RC     Right  - Center
cg@2744
  2451
                #RB     Right  - Bottom
cg@2744
  2452
cg@2744
  2453
                nil     ** handle not pickable **
cg@2744
  2454
    "
cg@2744
  2455
    |type relOrg relCrn maxExt rootView w h
cg@2744
  2456
     xL    "{ Class:SmallInteger }"
cg@2744
  2457
     xC    "{ Class:SmallInteger }"
cg@2744
  2458
     xR    "{ Class:SmallInteger }"
cg@2744
  2459
     yT    "{ Class:SmallInteger }"
cg@2744
  2460
     yC    "{ Class:SmallInteger }"
cg@2744
  2461
     yB    "{ Class:SmallInteger }"
cg@2744
  2462
    |
cg@2744
  2463
    rootView := self rootView.
cg@2744
  2464
    relOrg   := widget originRelativeTo:rootView.
cg@2744
  2465
    relOrg isNil ifTrue:[ ^ self ].    "/ widget destroyed
cg@2744
  2466
cg@2744
  2467
    relOrg   := relOrg - (HandleExtent // 2).
cg@2744
  2468
    relCrn   := relOrg + widget extent.
cg@2744
  2469
    maxExt   := rootView extent - HandleExtent.
cg@2744
  2470
cg@2744
  2471
    xL := relOrg x max:0.
cg@2744
  2472
    xR := relCrn x min:(maxExt x).
cg@2744
  2473
    xC := xR + xL // 2.
cg@2744
  2474
cg@2744
  2475
    yT := relOrg y max:0.
cg@2744
  2476
    yB := relCrn y min:(maxExt y).
cg@2744
  2477
    yC := yB + yT // 2.
cg@2744
  2478
cg@2744
  2479
    type := self layoutType.
cg@2744
  2480
    w   := HandleExtent x.
cg@2744
  2481
    h   := HandleExtent y.
cg@2744
  2482
cg@2744
  2483
    (type == #LayoutFrame or:[type == #Rectangle]) ifTrue:[
cg@2744
  2484
        aTwoArgAction value:(Rectangle left:xL top:yT width:w height:h) value:#LT.
cg@2744
  2485
        aTwoArgAction value:(Rectangle left:xL top:yC width:w height:h) value:#LC.
cg@2744
  2486
        aTwoArgAction value:(Rectangle left:xL top:yB width:w height:h) value:#LB.
cg@2744
  2487
        aTwoArgAction value:(Rectangle left:xC top:yT width:w height:h) value:#CT.
cg@2744
  2488
        aTwoArgAction value:(Rectangle left:xC top:yB width:w height:h) value:#CB.
cg@2744
  2489
        aTwoArgAction value:(Rectangle left:xR top:yT width:w height:h) value:#RT.
cg@2744
  2490
        aTwoArgAction value:(Rectangle left:xR top:yC width:w height:h) value:#RC.
cg@2744
  2491
        aTwoArgAction value:(Rectangle left:xR top:yB width:w height:h) value:#RB.
cg@2744
  2492
      ^ self
cg@2744
  2493
    ].
cg@2744
  2494
cg@2744
  2495
    aTwoArgAction value:(Rectangle left:xL top:yT width:w height:h) value:nil.
cg@2744
  2496
    aTwoArgAction value:(Rectangle left:xL top:yB width:w height:h) value:nil.
cg@2744
  2497
    aTwoArgAction value:(Rectangle left:xR top:yT width:w height:h) value:nil.
cg@2744
  2498
cg@2744
  2499
    type == #Extent ifTrue:[
cg@2744
  2500
        aTwoArgAction value:(Rectangle left:xC top:yB width:w height:h) value:#CB.
cg@2744
  2501
        aTwoArgAction value:(Rectangle left:xR top:yC width:w height:h) value:#RC.
cg@2744
  2502
        aTwoArgAction value:(Rectangle left:xR top:yB width:w height:h) value:#RB.
cg@2744
  2503
      ^ self
cg@2744
  2504
    ].
cg@2744
  2505
    aTwoArgAction value:(Rectangle left:xR top:yB width:w height:h) value:nil.
cg@2744
  2506
!
cg@2744
  2507
cg@2744
  2508
recursiveEachVisibleItemDo:anOneArgBlock
cg@2744
  2509
    "recursive evaluate the block on each child which is visible
cg@2744
  2510
    "
cg@2744
  2511
    (isExpanded and:[children size > 0]) ifTrue:[
cg@2744
  2512
        children do:[:aChild|
cg@2744
  2513
            anOneArgBlock value:aChild.
cg@2744
  2514
            aChild recursiveEachVisibleItemDo:anOneArgBlock.
cg@2744
  2515
        ]
cg@2744
  2516
    ].
cg@2744
  2517
!
cg@2744
  2518
cg@2744
  2519
subViewsDo:aOneArgBlock
cg@2744
  2520
    "evaluate aBlock for all subviews other than InputView's   
cg@2744
  2521
    "
cg@2744
  2522
    |subViews|
cg@2744
  2523
cg@2744
  2524
    subViews := widget subViews.
cg@2744
  2525
cg@2744
  2526
    subViews notNil ifTrue:[
cg@2744
  2527
        subViews do:aOneArgBlock
cg@2744
  2528
    ].
cg@2744
  2529
! !
cg@2744
  2530
cg@2744
  2531
!ViewTreeInspectorApplication::ViewTreeItem methodsFor:'initialization'!
cg@2744
  2532
cg@2744
  2533
forView:aView
cg@2744
  2534
    widget := aView.
cg@2744
  2535
!
cg@2744
  2536
cg@2744
  2537
initialize
cg@2744
  2538
    "setup default attributes
cg@2744
  2539
    "
cg@2744
  2540
    super initialize.
cg@2744
  2541
    isDrawnShown := false.
cg@2744
  2542
    isExpanded   := false.
cg@2744
  2543
    children     := OrderedCollection new.
cg@2744
  2544
! !
cg@2744
  2545
cg@2744
  2546
!ViewTreeInspectorApplication::ViewTreeItem methodsFor:'operations delete'!
cg@2744
  2547
cg@2744
  2548
delete
cg@2744
  2549
    "delete self and all contained items; the assigned views are destroyed
cg@2744
  2550
     in case of rootView, only the children are deleted
cg@2744
  2551
    "
cg@2744
  2552
    parent isHierarchicalItem ifTrue:[
cg@2744
  2553
        self criticalDo:[
cg@2744
  2554
            parent remove:self.
cg@2744
  2555
            widget destroy.
cg@2744
  2556
        ]
cg@2744
  2557
    ] ifFalse:[
cg@2744
  2558
        self deleteAll
cg@2744
  2559
    ].
cg@2744
  2560
!
cg@2744
  2561
cg@2744
  2562
deleteAll
cg@2744
  2563
    "delete all contained items; the assigned views are destroyed
cg@2744
  2564
    "
cg@2744
  2565
    children size == 0 ifTrue:[^ self].
cg@2744
  2566
cg@2744
  2567
    self criticalDo:[
cg@2744
  2568
        self nonCriticalDo:[:el| el widget destroy ].
cg@2744
  2569
        self removeAll
cg@2744
  2570
    ].
cg@2744
  2571
! !
cg@2744
  2572
cg@2744
  2573
!ViewTreeInspectorApplication::ViewTreeItem methodsFor:'operations layout'!
cg@2744
  2574
cg@2744
  2575
asLayoutFrame
cg@2744
  2576
    "convert the layout of the widget to a LayoutFrame;
cg@2744
  2577
    "
cg@2744
  2578
    |extent layout newLyt lftFrc lftOff topFrc topOff|
cg@2744
  2579
cg@2744
  2580
    layout := widget geometryLayout.
cg@2744
  2581
cg@2744
  2582
    layout isNil ifTrue:[
cg@2744
  2583
        ^ widget bounds asLayout
cg@2744
  2584
    ].
cg@2744
  2585
cg@2744
  2586
    layout isLayout ifFalse:[
cg@2744
  2587
        layout isRectangle ifTrue:[
cg@2744
  2588
            ^ LayoutFrame leftOffset:(layout left) rightOffset:(layout right)
cg@2744
  2589
                           topOffset:(layout top) bottomOffset:(layout bottom)
cg@2744
  2590
        ].
cg@2744
  2591
        layout isPoint ifTrue:[
cg@2744
  2592
            extent := widget extent.
cg@2744
  2593
          ^ LayoutFrame leftOffset:(layout x)  rightOffset:(layout x + extent x)
cg@2744
  2594
                         topOffset:(layout y) bottomOffset:(layout y + extent y)
cg@2744
  2595
        ].
cg@2744
  2596
cg@2744
  2597
        Transcript showCR:'UNSUPPORTRD LAYOUT: ', layout printString.
cg@2744
  2598
      ^ nil
cg@2744
  2599
    ].
cg@2744
  2600
cg@2744
  2601
    layout isLayoutFrame ifTrue:[ ^ layout copy ].    
cg@2744
  2602
cg@2744
  2603
    lftFrc := layout leftFraction.
cg@2744
  2604
    lftOff := layout leftOffset.
cg@2744
  2605
    topFrc := layout topFraction.
cg@2744
  2606
    topOff := layout topOffset.
cg@2744
  2607
    extent := widget extent.
cg@2744
  2608
cg@2744
  2609
    newLyt := LayoutFrame leftFraction:lftFrc offset:lftOff
cg@2744
  2610
                         rightFraction:lftFrc offset:(lftOff + extent x)
cg@2744
  2611
                           topFraction:topFrc offset:topOff
cg@2744
  2612
                        bottomFraction:topFrc offset:(topOff + extent y).
cg@2744
  2613
cg@2744
  2614
    (      layout isAlignmentOrigin
cg@2744
  2615
     and:[(layout leftAlignmentFraction ~= 0 or:[layout topAlignmentFraction ~= 0])]
cg@2744
  2616
    ) ifTrue:[
cg@2744
  2617
        |svRc prBd dlta|
cg@2744
  2618
cg@2744
  2619
        svRc := widget superView viewRectangle.
cg@2744
  2620
        prBd := widget preferredBounds.
cg@2744
  2621
cg@2744
  2622
        dlta := (  ((layout rectangleRelativeTo:svRc preferred:prBd) corner)
cg@2744
  2623
                 - ((newLyt rectangleRelativeTo:svRc preferred:prBd) corner)
cg@2744
  2624
                ) rounded.
cg@2744
  2625
cg@2744
  2626
        newLyt   leftOffset:(lftOff + dlta x).
cg@2744
  2627
        newLyt  rightOffset:(lftOff + extent x + dlta x).
cg@2744
  2628
        newLyt    topOffset:(topOff + dlta y).
cg@2744
  2629
        newLyt bottomOffset:(topOff + extent y + dlta y).
cg@2744
  2630
    ].
cg@2744
  2631
    ^ newLyt
cg@2744
  2632
!
cg@2744
  2633
cg@2744
  2634
moveLeft:l top:t
cg@2744
  2635
    "move the widget n pixele left and right
cg@2744
  2636
    "
cg@2744
  2637
    |layout|
cg@2744
  2638
cg@2744
  2639
    self isMoveable ifFalse:[ ^ self ].
cg@2744
  2640
cg@2744
  2641
    (layout := widget geometryLayout) isNil ifTrue:[
cg@2744
  2642
        "Extent"
cg@2744
  2643
        widget origin:(widget origin + (l@t)).
cg@2744
  2644
      ^ self
cg@2744
  2645
    ].
cg@2744
  2646
cg@2744
  2647
    layout := layout copy.
cg@2744
  2648
cg@2744
  2649
    layout isLayout ifTrue:[
cg@2744
  2650
        layout leftOffset:(layout leftOffset + l)
cg@2744
  2651
                topOffset:(layout topOffset  + t).
cg@2744
  2652
cg@2744
  2653
        layout isLayoutFrame ifTrue:[
cg@2744
  2654
            layout  rightOffset:(layout rightOffset  + l).
cg@2744
  2655
            layout bottomOffset:(layout bottomOffset + t).
cg@2744
  2656
        ]
cg@2744
  2657
cg@2744
  2658
    ] ifFalse:[
cg@2744
  2659
        layout isRectangle ifTrue:[
cg@2744
  2660
            layout setLeft:(layout left + l).
cg@2744
  2661
            layout  setTop:(layout top  + t).
cg@2744
  2662
        ] ifFalse:[
cg@2744
  2663
            layout isPoint ifFalse:[^ self].
cg@2744
  2664
            layout x:(layout x + l) y:(layout y + t).
cg@2744
  2665
        ]
cg@2744
  2666
    ].
cg@2744
  2667
    widget geometryLayout:layout.
cg@2744
  2668
!
cg@2744
  2669
cg@2744
  2670
resizeLeft:l top:t right:r bottom:b
cg@2744
  2671
    "resize the widget measured in pixels
cg@2744
  2672
    "
cg@2744
  2673
    |layout|
cg@2744
  2674
cg@2744
  2675
    self isResizeable ifFalse:[
cg@2744
  2676
        ^ self
cg@2744
  2677
    ].
cg@2744
  2678
cg@2744
  2679
    (layout := widget geometryLayout) isNil ifTrue:[
cg@2744
  2680
        "Extent"
cg@2744
  2681
        (r == l and:[b == t]) ifFalse:[
cg@2744
  2682
            widget extent:(widget computeExtent + ((r-l) @ (b-t))).
cg@2744
  2683
        ].
cg@2744
  2684
        ^ self
cg@2744
  2685
    ].
cg@2744
  2686
cg@2744
  2687
    layout isLayout ifTrue:[
cg@2744
  2688
        layout := layout copy.
cg@2744
  2689
cg@2744
  2690
        layout leftOffset:(layout leftOffset + l)
cg@2744
  2691
                topOffset:(layout topOffset  + t).
cg@2744
  2692
cg@2744
  2693
        layout isLayoutFrame ifTrue:[
cg@2744
  2694
            layout bottomOffset:(layout bottomOffset + b).
cg@2744
  2695
            layout  rightOffset:(layout rightOffset  + r).
cg@2744
  2696
        ]
cg@2744
  2697
    ] ifFalse:[
cg@2744
  2698
        layout isRectangle ifFalse:[^ self].
cg@2744
  2699
        layout := layout copy.
cg@2744
  2700
cg@2744
  2701
        layout left:(layout left   + l)
cg@2744
  2702
              right:(layout right  + r)
cg@2744
  2703
                top:(layout top    + t)
cg@2744
  2704
             bottom:(layout bottom + b).
cg@2744
  2705
    ].
cg@2744
  2706
    widget geometryLayout:layout.
cg@2744
  2707
! !
cg@2744
  2708
cg@2744
  2709
!ViewTreeInspectorApplication::ViewTreeItem methodsFor:'operations update'!
cg@2744
  2710
cg@2744
  2711
updateChildren
cg@2744
  2712
    |list|
cg@2744
  2713
cg@2744
  2714
    self do:[:el|
cg@2744
  2715
        el exists ifTrue:[
cg@2744
  2716
            el updateChildren.
cg@2744
  2717
        ] ifFalse:[
cg@2744
  2718
            list isNil ifTrue:[list := OrderedCollection new].
cg@2744
  2719
            list add:el.
cg@2744
  2720
        ]
cg@2744
  2721
    ].
cg@2744
  2722
    list notNil ifTrue:[
cg@2744
  2723
        list do:[:el| self remove:el ].
cg@2744
  2724
    ].
cg@2744
  2725
!
cg@2744
  2726
cg@2744
  2727
updateFromChildren:mergedList
cg@2744
  2728
    "update my children against the list of items derived from
cg@2744
  2729
     the merged list.
cg@2744
  2730
    "
cg@2744
  2731
cg@2744
  2732
    mergedList size == 0 ifTrue:[ ^ self removeAll ].
cg@2744
  2733
    children   size == 0 ifTrue:[ ^ self addAll:mergedList ].
cg@2744
  2734
cg@2744
  2735
    self criticalDo:[
cg@2744
  2736
        self nonCriticalDo:[:el| |wdg|
cg@2744
  2737
            wdg := el widget.
cg@2744
  2738
            mergedList detect:[:e2| e2 widget == wdg ] ifNone:[ self remove:el ].
cg@2744
  2739
        ].
cg@2744
  2740
cg@2744
  2741
        mergedList keysAndValuesDo:[:i :el| |wdg e2|
cg@2744
  2742
            wdg := el widget.
cg@2744
  2743
cg@2744
  2744
            e2  := self at:i ifAbsent:nil.
cg@2744
  2745
cg@2744
  2746
            (e2 isNil or:[e2 widget ~~ wdg]) ifTrue:[
cg@2744
  2747
                self add:el beforeIndex:i
cg@2744
  2748
            ]
cg@2744
  2749
        ]
cg@2744
  2750
    ].
cg@2744
  2751
! !
cg@2744
  2752
cg@2744
  2753
!ViewTreeInspectorApplication::ViewTreeItem methodsFor:'printing & storing'!
cg@2744
  2754
cg@2744
  2755
icon
cg@2744
  2756
    "get the icon used for presentation
cg@2744
  2757
    "
cg@2744
  2758
    |specClass model|
cg@2744
  2759
cg@2744
  2760
    specClass := self specClass.
cg@2744
  2761
    specClass isNil ifTrue:[^ nil].
cg@2744
  2762
cg@2744
  2763
    model := self treeModel.
cg@2744
  2764
cg@2744
  2765
    model notNil ifTrue:[
cg@2744
  2766
        ^ model iconAt:specClass ifNonePut:[specClass icon]
cg@2744
  2767
    ].
cg@2744
  2768
    ^ specClass icon
cg@2744
  2769
!
cg@2744
  2770
cg@2744
  2771
label
cg@2744
  2772
    "get the label used for presentation
cg@2744
  2773
    "
cg@2744
  2774
    ^ self string
cg@2744
  2775