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