Tools__ViewTreeApplication.st
author Claus Gittinger <cg@exept.de>
Tue, 09 Dec 2014 17:35:40 +0100
changeset 3171 16cec0f0e3b4
parent 3169 54d9e27b384d
child 3174 cd45c49a0d63
permissions -rw-r--r--
class: Tools::ViewTreeInspectorApplication
added: #doDebugProcess - menu item
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,
ca@2177
   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@2744
   583
                  enabled: hasTargetWidgetChannel
cg@2744
   584
                  label: 'All Applications'
cg@2744
   585
                  submenuChannel: submenuApplications:
cg@2744
   586
                )
cg@2744
   587
               )
cg@2744
   588
              nil
cg@2744
   589
              nil
cg@2744
   590
            )
cg@2744
   591
          )
cg@2744
   592
         (MenuItem
cg@3034
   593
            label: 'Process'
cg@2744
   594
            submenu: 
cg@2744
   595
           (Menu
cg@2744
   596
              (
cg@2744
   597
               (MenuItem
cg@2744
   598
                  enabled: hasSingleSelectionHolder
cg@3171
   599
                  label: 'Debug'
cg@3171
   600
                  itemValue: doDebugProcess
cg@3171
   601
                )
cg@3171
   602
               (MenuItem
cg@3171
   603
                  enabled: hasSingleSelectionHolder
cg@2744
   604
                  label: 'Inspect'
cg@2744
   605
                  itemValue: doInspect:
cg@3034
   606
                  argument: process
ca@2454
   607
                )
ca@2454
   608
               (MenuItem
ca@2454
   609
                  label: '-'
ca@2454
   610
                )
ca@2454
   611
               (MenuItem
cg@3034
   612
                  label: 'Open Process Monitor'
cg@3034
   613
                  itemValue: doOpenProcessMonitor
ca@2454
   614
                )
ca@2454
   615
               )
ca@2454
   616
              nil
ca@2454
   617
              nil
ca@2454
   618
            )
ca@2454
   619
          )
ca@2454
   620
         (MenuItem
cg@2744
   621
            label: 'Help'
cg@2744
   622
            startGroup: conditionalRight
cg@2744
   623
            submenu: 
cg@2744
   624
           (Menu
cg@2744
   625
              (
cg@2744
   626
               (MenuItem
cg@2744
   627
                  label: 'Documentation'
cg@2744
   628
                  itemValue: openDocumentation
cg@2744
   629
                )
cg@2744
   630
               (MenuItem
cg@2744
   631
                  label: '-'
cg@2744
   632
                )
cg@2744
   633
               (MenuItem
cg@2744
   634
                  label: 'About this Application...'
cg@2744
   635
                  itemValue: openAboutThisApplication
cg@2744
   636
                )
cg@2744
   637
               )
cg@2744
   638
              nil
cg@2744
   639
              nil
cg@2744
   640
            )
ca@2177
   641
          )
ca@2177
   642
         )
ca@2177
   643
        nil
ca@2177
   644
        nil
ca@2177
   645
      )
ca@2177
   646
!
ca@2177
   647
ca@2177
   648
middleButtonMenu
ca@2177
   649
    "This resource specification was automatically generated
ca@2177
   650
     by the MenuEditor of ST/X."
ca@2177
   651
ca@2177
   652
    "Do not manually edit this!! If it is corrupted,
ca@2177
   653
     the MenuEditor may not be able to read the specification."
ca@2177
   654
ca@2177
   655
    "
ca@2177
   656
     MenuEditor new openOnClass:ViewTreeApplication andSelector:#middleButtonMenu
ca@2177
   657
     (Menu new fromLiteralArrayEncoding:(ViewTreeApplication middleButtonMenu)) startUp
ca@2177
   658
    "
ca@2177
   659
ca@2177
   660
    <resource: #menu>
ca@2177
   661
ca@2177
   662
    ^ 
ca@2177
   663
     #(Menu
ca@2177
   664
        (
ca@2177
   665
         (MenuItem
ca@2177
   666
            label: 'Geometry'
ca@2177
   667
            translateLabel: true
ca@2177
   668
            submenuChannel: submenuGeometry:
ca@2177
   669
            keepLinkedMenu: true
ca@2177
   670
          )
ca@2177
   671
         (MenuItem
ca@2177
   672
            label: 'Interface'
ca@2177
   673
            translateLabel: true
ca@2177
   674
            submenuChannel: submenuInterface:
ca@2177
   675
            keepLinkedMenu: true
ca@2177
   676
          )
ca@2177
   677
         (MenuItem
ca@2177
   678
            label: 'Visibility'
ca@2177
   679
            translateLabel: true
ca@2177
   680
            submenuChannel: submenuVisibility:
ca@2177
   681
            keepLinkedMenu: true
ca@2177
   682
          )
ca@2177
   683
         (MenuItem
ca@2177
   684
            label: '-'
ca@2177
   685
          )
ca@2177
   686
         (MenuItem
ca@2177
   687
            label: 'Browse View Class'
ca@2177
   688
            itemValue: doBrowse:
ca@2177
   689
            translateLabel: true
cg@3169
   690
            argument: #view
ca@2177
   691
          )
ca@2177
   692
         (MenuItem
ca@2177
   693
            label: 'Browse Model Class'
ca@2177
   694
            itemValue: doBrowse:
ca@2177
   695
            translateLabel: true
ca@2177
   696
            isVisible: hasModel
cg@3169
   697
            argument: #model
ca@2177
   698
          )
ca@2177
   699
         (MenuItem
ca@2177
   700
            label: 'Browse Application Class'
ca@2177
   701
            itemValue: doBrowse:
ca@2177
   702
            translateLabel: true
ca@2177
   703
            isVisible: hasApplication
cg@3169
   704
            argument: #application
ca@2177
   705
          )
ca@2177
   706
         (MenuItem
ca@2177
   707
            label: 'Browse Controller Class'
ca@2177
   708
            itemValue: doBrowse:
ca@2177
   709
            translateLabel: true
ca@2177
   710
            isVisible: hasController
cg@3169
   711
            argument: #controller
ca@2177
   712
          )
ca@2177
   713
         (MenuItem
ca@2177
   714
            label: '-'
ca@2177
   715
          )
ca@2177
   716
         (MenuItem
ca@2177
   717
            label: 'Inspect View'
ca@2177
   718
            itemValue: doInspect:
ca@2177
   719
            translateLabel: true
cg@3169
   720
            argument: #view
ca@2177
   721
          )
ca@2177
   722
         (MenuItem
ca@2177
   723
            label: 'Inspect Window Group'
ca@2177
   724
            itemValue: doInspect:
ca@2177
   725
            translateLabel: true
cg@3169
   726
            argument: #group
ca@2177
   727
          )
ca@2177
   728
         (MenuItem
ca@2177
   729
            label: 'Inspect Model'
ca@2177
   730
            itemValue: doInspect:
ca@2177
   731
            translateLabel: true
ca@2177
   732
            isVisible: hasModel
cg@3169
   733
            argument: #model
ca@2177
   734
          )
ca@2177
   735
         (MenuItem
ca@2177
   736
            label: 'Inspect Application'
ca@2177
   737
            itemValue: doInspect:
ca@2177
   738
            translateLabel: true
ca@2177
   739
            isVisible: hasApplication
cg@3169
   740
            argument: #application
ca@2177
   741
          )
ca@2177
   742
         (MenuItem
ca@2177
   743
            label: 'Inspect Controller'
ca@2177
   744
            itemValue: doInspect:
ca@2177
   745
            translateLabel: true
ca@2177
   746
            isVisible: hasController
cg@3169
   747
            argument: #controller
ca@2177
   748
          )
ca@2177
   749
         (MenuItem
ca@2177
   750
            label: '-'
ca@2177
   751
          )
ca@2177
   752
         (MenuItem
ca@2177
   753
            label: 'Flash'
ca@2177
   754
            itemValue: doFlash
ca@2177
   755
            translateLabel: true
ca@2177
   756
          )
ca@2177
   757
         (MenuItem
ca@2177
   758
            label: '-'
ca@2177
   759
          )
ca@2177
   760
         (MenuItem
ca@2177
   761
            label: 'Destroy'
ca@2177
   762
            itemValue: doDestroy
ca@2177
   763
            translateLabel: true
ca@2177
   764
          )
ca@2177
   765
         (MenuItem
ca@2177
   766
            label: '-'
ca@2177
   767
          )
ca@2177
   768
         (MenuItem
ca@2177
   769
            label: 'Instance Variables'
ca@2177
   770
            translateLabel: true
ca@2177
   771
            submenuChannel: submenuInspector:
ca@2177
   772
            keepLinkedMenu: true
ca@2177
   773
          )
ca@2177
   774
         (MenuItem
ca@2177
   775
            label: '='
ca@2177
   776
          )
ca@2177
   777
         (MenuItem
ca@2177
   778
            label: ''
ca@2177
   779
          )
ca@2177
   780
         (MenuItem
ca@2177
   781
            enabled: selectedComponentHasChildren
ca@2177
   782
            label: 'Applications'
ca@2177
   783
            nameKey: single
ca@2177
   784
            translateLabel: true
ca@2177
   785
            submenuChannel: submenuApplications:
ca@2177
   786
            keepLinkedMenu: true
ca@2177
   787
          )
ca@2177
   788
         (MenuItem
ca@2177
   789
            enabled: selectedComponentHasChildren
ca@2177
   790
            label: 'Components'
ca@2177
   791
            nameKey: single
ca@2177
   792
            translateLabel: true
ca@2177
   793
            submenuChannel: submenuComponents:
ca@2177
   794
            keepLinkedMenu: true
ca@2177
   795
          )
ca@2177
   796
         )
ca@2177
   797
        nil
ca@2177
   798
        nil
ca@2177
   799
      )
ca@2177
   800
!
ca@2177
   801
ca@2177
   802
toolbarMenu
ca@2177
   803
    "This resource specification was automatically generated
ca@2177
   804
     by the MenuEditor of ST/X."
ca@2177
   805
ca@2177
   806
    "Do not manually edit this!! If it is corrupted,
ca@2177
   807
     the MenuEditor may not be able to read the specification."
ca@2177
   808
cg@2978
   809
ca@2177
   810
    "
cg@2757
   811
     MenuEditor new openOnClass:Tools::ViewTreeInspectorApplication andSelector:#toolbarMenu
cg@2757
   812
     (Menu new fromLiteralArrayEncoding:(Tools::ViewTreeInspectorApplication toolbarMenu)) startUp
ca@2177
   813
    "
ca@2177
   814
ca@2177
   815
    <resource: #menu>
ca@2177
   816
ca@2177
   817
    ^ 
ca@2177
   818
     #(Menu
ca@2177
   819
        (
ca@2177
   820
         (MenuItem
cg@2978
   821
            enabled: hasTargetWidgetChannel
cg@2978
   822
            label: 'Redraw'
cg@2978
   823
            itemValue: doRedraw
cg@2978
   824
            isButton: true
cg@2978
   825
            labelImage: (ResourceRetriever ToolbarIconLibrary reloadIcon)
cg@2978
   826
          )
cg@2978
   827
         (MenuItem
cg@2978
   828
            label: '-'
cg@2978
   829
          )
cg@2978
   830
         (MenuItem
cg@2978
   831
            label: 'Pick a View and Catch Events'
cg@2762
   832
            itemValue: doPickView
cg@2744
   833
            translateLabel: false
cg@2744
   834
            isButton: true
cg@2744
   835
            hideMenuOnActivated: false
cg@2759
   836
            labelImage: (ResourceRetriever #'Tools::ViewTreeInspectorApplication' pickWindowIcon2)
cg@2744
   837
          )
cg@2744
   838
         (MenuItem
cg@2757
   839
            enabled: hasTargetWidgetChannel
cg@3124
   840
            isVisible: isNotCatchingEventsChannel
cg@3124
   841
            label: 'Catch Events of Picked View'
cg@3124
   842
            activeHelpKey: doCatchEvents
cg@3124
   843
            itemValue: doCatchEvents
cg@3124
   844
            nameKey: doCatchEvents
cg@3124
   845
            isButton: true
cg@3124
   846
            labelImage: (ResourceRetriever nil releaseViewIcon)
cg@3124
   847
          )
cg@3124
   848
         (MenuItem
cg@3124
   849
            enabled: hasTargetWidgetChannel
cg@3124
   850
            isVisible: isCatchingEventsChannel
cg@2978
   851
            label: 'Release Picked View and Uncatch Events'
cg@3070
   852
            activeHelpKey: doUncatchEvents
cg@2978
   853
            itemValue: doUncatchEvents
cg@3070
   854
            nameKey: doUncatchEvents
cg@2757
   855
            isButton: true
cg@3124
   856
            labelImage: (ResourceRetriever nil lockViewIcon)
cg@2757
   857
          )
cg@2757
   858
         (MenuItem
cg@2757
   859
            label: '-'
cg@2757
   860
          )
cg@2757
   861
         (MenuItem
ca@2454
   862
            enabled: hasSingleSelectionHolder
cg@2744
   863
            label: 'Browse Application'
ca@2454
   864
            itemValue: doBrowse:
ca@2454
   865
            translateLabel: false
cg@2744
   866
            isButton: true
cg@2744
   867
            hideMenuOnActivated: false
ca@2454
   868
            labelImage: (ResourceRetriever ToolbarIconLibrary systemBrowser24x24Icon2)
ca@2454
   869
            argument: application
ca@2177
   870
          )
ca@2177
   871
         (MenuItem
ca@2454
   872
            enabled: hasSingleSelectionHolder
cg@2744
   873
            label: 'Inspect Application'
ca@2454
   874
            itemValue: doInspect:
ca@2454
   875
            translateLabel: false
cg@2744
   876
            isButton: true
cg@2744
   877
            hideMenuOnActivated: false
cg@2744
   878
            labelImage: (ResourceRetriever ToolbarIconLibrary inspect22x24Icon)
ca@2454
   879
            argument: application
ca@2177
   880
          )
ca@2177
   881
         )
ca@2177
   882
        nil
ca@2177
   883
        nil
ca@2177
   884
      )
ca@2177
   885
! !
ca@2177
   886
cg@2747
   887
!ViewTreeInspectorApplication class methodsFor:'startup'!
cg@2747
   888
cg@2747
   889
openInPickMode
cg@2747
   890
    |app|
cg@2747
   891
cg@2747
   892
    app := self new.
cg@2747
   893
    app open.
cg@2762
   894
    app doPickView.
cg@3124
   895
    ^ app
cg@3124
   896
!
cg@3124
   897
cg@3124
   898
openInPickModeAndRelease
cg@3124
   899
    "release the pick-lock after picking"
cg@3124
   900
cg@3124
   901
    |app|
cg@3124
   902
cg@3124
   903
    app := self openInPickMode.
cg@3124
   904
    app doUncatchEvents.
cg@3124
   905
    ^ app
cg@3014
   906
!
cg@3014
   907
cg@3014
   908
openOn:aView
cg@3014
   909
    "show a particular window's topView hierarchy,
cg@3014
   910
     select the given view"
cg@3014
   911
cg@3014
   912
    |app|
cg@3014
   913
cg@3014
   914
    app := self new.
cg@3014
   915
    app open.
cg@3014
   916
    app showWindow:aView.
cg@3124
   917
    ^ app
cg@2747
   918
! !
cg@2747
   919
cg@2744
   920
!ViewTreeInspectorApplication methodsFor:'actions'!
ca@2177
   921
ca@2177
   922
indicatorClicked:anIndex
ca@2177
   923
    |item sensor|
ca@2177
   924
ca@2177
   925
    item := model listOfItems at:anIndex ifAbsent:nil.
ca@2177
   926
ca@2177
   927
    item notNil ifTrue:[
ca@2177
   928
        (     (sensor := self window sensor) notNil
ca@2177
   929
         and:[(sensor ctrlDown or:[sensor shiftDown])]
ca@2177
   930
        ) ifTrue:[
ca@2177
   931
            item recursiveToggleExpand
ca@2177
   932
        ] ifFalse:[
ca@2177
   933
            item toggleExpand
ca@2177
   934
        ]
ca@2177
   935
    ].
ca@2177
   936
! !
ca@2177
   937
cg@2744
   938
!ViewTreeInspectorApplication methodsFor:'aspects'!
ca@2177
   939
ca@2177
   940
followFocusChannel
ca@2455
   941
    "boolean holder, which indicates whether selection changed dependend on the focus view"
ca@2455
   942
ca@2177
   943
    ^ followFocusChannel
ca@2177
   944
!
ca@2177
   945
ca@2177
   946
hasSingleSelectionHolder
ca@2455
   947
    "boolean holder, true if one item is selected"
ca@2455
   948
ca@2177
   949
    ^ hasSingleSelectionHolder
ca@2177
   950
!
ca@2177
   951
ca@2455
   952
hasTargetWidgetChannel
ca@2455
   953
    "answer the channel which is set to true if a target widget exists"
ca@2455
   954
ca@2455
   955
    ^ model hasTargetWidgetChannel
ca@2455
   956
!
ca@2455
   957
cg@3037
   958
inspectorMode
cg@3049
   959
    "what is shown in the inspector:
cg@3037
   960
     1->widget
cg@3049
   961
     2->application
cg@3049
   962
     3->WindowGroup
cg@3049
   963
     4->Sensor
cg@3049
   964
     5->Model 
cg@3049
   965
    "
cg@3049
   966
cg@3049
   967
    (inspectorModeIndexHolder value == 1) ifTrue:[ ^#widget].
cg@3049
   968
    (inspectorModeIndexHolder value == 2) ifTrue:[ ^#application].
cg@3049
   969
    (inspectorModeIndexHolder value == 3) ifTrue:[ ^#group].
cg@3049
   970
    (inspectorModeIndexHolder value == 4) ifTrue:[ ^#sensor].
cg@3049
   971
    (inspectorModeIndexHolder value == 5) ifTrue:[ ^#model].
cg@3049
   972
    ^ #application
cg@3037
   973
cg@3037
   974
    "Created: / 30-07-2013 / 07:44:59 / cg"
cg@3037
   975
!
cg@3037
   976
cg@3037
   977
inspectorModeIndexHolder
cg@3049
   978
    "what is shown in the inspector:
cg@3049
   979
     1->Widget
cg@3049
   980
     2->Application
cg@3049
   981
     3->WindowGroup
cg@3049
   982
     4->Sensor
cg@3049
   983
     5->Model 
cg@3049
   984
    "
cg@3037
   985
cg@3037
   986
    ^ inspectorModeIndexHolder
cg@3037
   987
cg@3037
   988
    "Created: / 30-07-2013 / 07:44:07 / cg"
cg@3037
   989
!
cg@3037
   990
cg@3037
   991
inspectorModes
cg@3049
   992
    ^ #('Widget' 'Application' 'WindowGroup' 'Sensor' 'Model')
cg@3037
   993
cg@3037
   994
    "Created: / 30-07-2013 / 09:42:16 / cg"
cg@3037
   995
!
cg@3037
   996
cg@3124
   997
isCatchingEventsChannel
cg@3124
   998
    ^ isCatchingEventsChannel
cg@3124
   999
!
cg@3124
  1000
cg@3124
  1001
isNotCatchingEventsChannel
cg@3124
  1002
    ^ BlockValue forLogicalNot:self isCatchingEventsChannel
cg@3124
  1003
!
cg@3124
  1004
ca@2177
  1005
listOfItems
ca@2455
  1006
    "returns the hierarchical list of items"
ca@2455
  1007
ca@2177
  1008
    ^ model listOfItems
ca@2177
  1009
!
ca@2177
  1010
ca@2177
  1011
model
ca@2455
  1012
    "returns my selection model, a ViewTreeModel"
ca@2455
  1013
ca@2177
  1014
    ^ model
ca@2177
  1015
!
ca@2177
  1016
jan@3112
  1017
path
jan@3112
  1018
    <resource: #uiAspect>
jan@3112
  1019
jan@3112
  1020
    path isNil ifTrue:[
cg@3123
  1021
        path := PluggableAdaptor 
cg@3123
  1022
                    on: self model 
cg@3123
  1023
                    getter:[ :model | model path ]
cg@3123
  1024
                    setter:[ :model :newValue |  ]
jan@3112
  1025
    ].
jan@3112
  1026
    ^ path.
jan@3112
  1027
jan@3112
  1028
    "Modified: / 19-05-2014 / 18:40:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
jan@3112
  1029
!
jan@3112
  1030
ca@2177
  1031
selectOnClickHolder
ca@2455
  1032
    "boolean holder, which indicates whether the selection will change on click"
ca@2455
  1033
ca@2177
  1034
    ^ model selectOnClickHolder
ca@2177
  1035
!
ca@2177
  1036
ca@2451
  1037
showNamesHolder
ca@2451
  1038
    "boolean holder, which indicates whether application names or widget names
ca@2455
  1039
     as additional text are shown for the items"
ca@2455
  1040
ca@2451
  1041
    ^ showNamesHolder
ca@2451
  1042
!
ca@2451
  1043
ca@2177
  1044
testModeChannel
ca@2455
  1045
    "answer a boolean channel which describes the behaviour how to process
ca@2455
  1046
     events on the target view.
ca@2455
  1047
ca@2455
  1048
     false: all input events are eaten and the selection is shown on the target view.
ca@2455
  1049
     true:  no  input events are eaten and no  selection is shown on the target view."
ca@2455
  1050
ca@2455
  1051
    ^ model testModeChannel
ca@2177
  1052
! !
ca@2177
  1053
cg@2744
  1054
!ViewTreeInspectorApplication methodsFor:'change & update'!
ca@2177
  1055
cg@3037
  1056
inspectorModeIndexHolderChanged
cg@3037
  1057
    self updateInspector
cg@3037
  1058
cg@3037
  1059
    "Created: / 30-07-2013 / 09:21:51 / cg"
cg@3037
  1060
!
cg@3037
  1061
ca@2177
  1062
selectionChanged
ca@2177
  1063
    |info view item|
ca@2177
  1064
ca@2177
  1065
    item := model selectedItem.
ca@2177
  1066
ca@2177
  1067
    item notNil ifTrue:[ |state|
ca@2177
  1068
        view := item widget.
ca@2177
  1069
ca@2177
  1070
        view id isNil ifTrue:[
ca@2177
  1071
            state := 'no ID'.
ca@2177
  1072
        ] ifFalse:[
ca@2177
  1073
            view shown ifTrue:[
ca@2177
  1074
                state := 'visible'.
ca@2177
  1075
            ] ifFalse:[
ca@2177
  1076
                state := 'invisible'
ca@2177
  1077
            ].
ca@2177
  1078
        ].
ca@2177
  1079
        info := '%1 [%2] - %3' bindWith:(view class name)
ca@2177
  1080
                                   with:(view name ? '') with:state allBold.
ca@2177
  1081
ca@2177
  1082
    ] ifFalse:[
ca@2177
  1083
        info := ''
ca@2177
  1084
    ].
ca@2177
  1085
    hasSingleSelectionHolder value:(view notNil).
cg@3037
  1086
    self updateInspector
cg@3037
  1087
cg@3037
  1088
    "Modified: / 30-07-2013 / 09:21:27 / cg"
ca@2177
  1089
!
ca@2177
  1090
ca@2177
  1091
update:something with:someArgument from:aModel
ca@2454
  1092
    |oldSelection|
ca@2454
  1093
ca@2451
  1094
    aModel == showNamesHolder ifTrue:[
ca@2455
  1095
        oldSelection := model selectedItem.
ca@2454
  1096
        model selectedItem:nil.
ca@2451
  1097
        self listOfItems showWidgetNames:(aModel value).
ca@2454
  1098
        model selectedItem:oldSelection.
ca@2451
  1099
        ^ self
ca@2451
  1100
    ].
ca@2458
  1101
ca@2458
  1102
    aModel == model ifTrue:[
ca@2458
  1103
        self selectionChanged.
ca@2458
  1104
        ^ self
ca@2458
  1105
    ].
ca@2458
  1106
ca@2177
  1107
    super update:something with:someArgument from:aModel.
cg@3037
  1108
!
cg@3037
  1109
cg@3037
  1110
updateInspector
cg@3037
  1111
    |view obj|
cg@3037
  1112
cg@3037
  1113
    view := self selectedView.
cg@3037
  1114
    (view isNil or:[self inspectorMode == #widget]) ifTrue:[
cg@3037
  1115
        obj := view.
cg@3049
  1116
    ] ifFalse:[ (self inspectorMode == #group) ifTrue:[
cg@3049
  1117
        obj := view windowGroup
cg@3049
  1118
    ] ifFalse:[ (self inspectorMode == #sensor) ifTrue:[
cg@3049
  1119
        obj := view sensor
cg@3049
  1120
    ] ifFalse:[ (self inspectorMode == #model) ifTrue:[
cg@3049
  1121
        obj := view model
cg@3037
  1122
    ] ifFalse:[
cg@3037
  1123
        obj := view application.
cg@3049
  1124
    ]]]].
cg@3037
  1125
    inspectorView inspect:obj.
cg@3037
  1126
    inspectorView headLineLabel:(obj class nameWithoutPrefix)
cg@3037
  1127
cg@3037
  1128
    "Created: / 30-07-2013 / 09:21:16 / cg"
ca@2177
  1129
! !
ca@2177
  1130
cg@2744
  1131
!ViewTreeInspectorApplication methodsFor:'event processing'!
ca@2177
  1132
ca@2177
  1133
processButtonMotionEvent:ev
ca@2455
  1134
    |click rootView|
ca@2177
  1135
ca@2455
  1136
    motionAction isNil ifTrue:[^ self].
ca@2455
  1137
ca@2455
  1138
    (rootView := model rootView) isNil ifTrue:[
ca@2455
  1139
        clickedItem := motionAction := nil.
ca@2455
  1140
        ^ self
ca@2455
  1141
    ].
ca@2455
  1142
ca@2455
  1143
    click := rootView device
ca@2455
  1144
            translatePoint:((ev x)@ (ev y))
ca@2455
  1145
            fromView:(ev view)
ca@2455
  1146
            toView:rootView.
ca@2455
  1147
ca@2455
  1148
    click = clickedPoint ifFalse:[
ca@2455
  1149
        (clickedItem isNil or:[(click dist:clickedPoint) > 5.0]) ifTrue:[
ca@2455
  1150
            motionAction value:click
ca@2177
  1151
        ]
ca@2177
  1152
    ].
ca@2177
  1153
!
ca@2177
  1154
ca@2177
  1155
processButtonPressEvent:ev
ca@2455
  1156
    |rootView sensor lastRectangle|
ca@2455
  1157
ca@2455
  1158
    rootView    := model rootView.
ca@2177
  1159
    sensor      := model rootView sensor.
ca@2177
  1160
    clickedItem := model listOfItems detectItemRespondsToView:(ev view).
ca@2177
  1161
ca@2177
  1162
    (sensor ctrlDown or:[sensor shiftDown]) ifTrue:[
ca@2177
  1163
        clickedItem notNil ifTrue:[
ca@2177
  1164
            self selectOnClickHolder value ifTrue:[
ca@2177
  1165
                model toggleSelectItem:clickedItem
ca@2177
  1166
            ].
ca@2177
  1167
        ].
ca@2177
  1168
        clickedItem := motionAction := nil.
ca@2455
  1169
        ^ self
ca@2455
  1170
    ].
ca@2177
  1171
ca@2455
  1172
    clickedPoint := rootView device translatePoint:((ev x)@ (ev y))  fromView:(ev view) toView:rootView.
ca@2455
  1173
    lastRectangle := nil.
ca@2177
  1174
ca@2455
  1175
    motionAction :=[:p|
ca@2455
  1176
        rootView    := model rootView device rootView.
ca@2455
  1177
        rootView    := model rootView.
ca@2455
  1178
        clickedItem := nil.
ca@2177
  1179
ca@2455
  1180
        rootView xoring:[
ca@2455
  1181
            lastRectangle notNil ifTrue:[ rootView displayRectangle:lastRectangle ]
ca@2455
  1182
                                ifFalse:[ rootView clippedByChildren:false ].
ca@2455
  1183
ca@2455
  1184
            p isNil ifTrue:[
ca@2455
  1185
                rootView clippedByChildren:true.
ca@2455
  1186
                motionAction := nil.
ca@2455
  1187
            ] ifFalse:[
ca@2455
  1188
                lastRectangle := Rectangle origin:(clickedPoint min:p) corner:(clickedPoint max:p).
ca@2455
  1189
                rootView displayRectangle:lastRectangle.
ca@2177
  1190
            ].
ca@2455
  1191
            rootView flush.
ca@2455
  1192
        ].
ca@2455
  1193
        lastRectangle
ca@2455
  1194
    ].
ca@2177
  1195
!
ca@2177
  1196
ca@2177
  1197
processButtonReleaseEvent:anEvent
ca@2177
  1198
    |rootView rectangle newItems widget origin|
ca@2177
  1199
ca@2455
  1200
    (rootView := model rootView) isNil ifTrue:[
ca@2455
  1201
        clickedItem := motionAction := nil.
ca@2455
  1202
        ^ self
ca@2455
  1203
    ].
ca@2177
  1204
    motionAction isNil ifTrue:[ ^ self ].
ca@2177
  1205
    clickedItem notNil ifTrue:[ ^ model selectItem:clickedItem ].
ca@2177
  1206
ca@2455
  1207
    rectangle := motionAction value:nil.
ca@2455
  1208
    rectangle isNil ifTrue:[^ self].
ca@2177
  1209
ca@2455
  1210
    newItems := OrderedCollection new.
ca@2177
  1211
ca@2455
  1212
    model rootItem recursiveDo:[:anItem|
ca@2455
  1213
        widget := anItem widget.
ca@2455
  1214
        origin := widget originRelativeTo:rootView.
ca@2455
  1215
ca@2455
  1216
        (rectangle containsRect:(Rectangle origin:origin extent:(widget extent))) ifTrue:[
ca@2455
  1217
            newItems add:anItem.
ca@2455
  1218
        ]
ca@2177
  1219
    ].
ca@2455
  1220
    model value:newItems.
ca@2177
  1221
!
ca@2177
  1222
ca@2177
  1223
processEvent:anEvent
ca@2177
  1224
    |button menu|
ca@2177
  1225
cg@2758
  1226
    anEvent isKeyPressEvent ifTrue:[ self processKeyPressEvent:anEvent. ^ self  ].
ca@2177
  1227
    anEvent isButtonEvent  ifFalse:[ ^ self ].
ca@2177
  1228
ca@2177
  1229
    button := anEvent button.
ca@2177
  1230
ca@2177
  1231
    (button == 2 or:[button == #menu]) ifTrue:[
ca@2177
  1232
        motionAction isNil ifTrue:[
ca@2177
  1233
            anEvent isButtonPressEvent ifTrue:[
ca@2177
  1234
                self selectOnClickHolder value ifTrue:[
ca@2177
  1235
                    menu := self middleButtonMenu value.
ca@2177
  1236
                    menu notNil ifTrue:[
cg@2758
  1237
                        menu := MenuPanel 
cg@2758
  1238
                                    menu:(Menu new fromLiteralArrayEncoding:menu)
cg@2758
  1239
                                    receiver:self.
ca@2177
  1240
                        menu startUp.
ca@2177
  1241
                    ]
ca@2177
  1242
                ].
ca@2177
  1243
            ].
ca@2177
  1244
            clickedItem := nil.
ca@2177
  1245
        ].
ca@2177
  1246
        ^ self
ca@2177
  1247
    ].
ca@2177
  1248
cg@2758
  1249
    anEvent isButtonPressEvent  ifTrue:[ self processButtonPressEvent:anEvent. ^ self ].
cg@2758
  1250
    anEvent isButtonMotionEvent ifTrue:[ self processButtonMotionEvent:anEvent. ^ self ].
ca@2177
  1251
ca@2177
  1252
    anEvent isButtonReleaseEvent ifTrue:[
ca@2177
  1253
        self selectOnClickHolder value ifTrue:[
ca@2177
  1254
            self processButtonReleaseEvent:anEvent
ca@2177
  1255
        ].
ca@2177
  1256
    ].
ca@2177
  1257
    clickedItem := motionAction := nil.
ca@2177
  1258
ca@2177
  1259
    anEvent type == #'buttonMultiPress:x:y:' ifTrue:[
ca@2177
  1260
        self selectOnClickHolder value ifTrue:[
ca@2177
  1261
            self doInspect:#view.
ca@2177
  1262
        ].
ca@2177
  1263
    ].
ca@2177
  1264
!
ca@2177
  1265
ca@2177
  1266
processKeyPressEvent:anEvent
ca@2177
  1267
    |item prnt idx key max next|
ca@2177
  1268
ca@2177
  1269
    key := anEvent key.
ca@2177
  1270
    key isSymbol ifFalse:[^ self].
ca@2177
  1271
ca@2177
  1272
    key == #Delete    ifTrue:[ ^ self doDestroy ].
ca@2177
  1273
    key == #InspectIt ifTrue:[ ^ self doInspect:#view ].
ca@2177
  1274
ca@2177
  1275
    (   key == #CursorUp
ca@2177
  1276
    or:[key == #CursorDown
ca@2177
  1277
    or:[key == #CursorLeft
ca@2177
  1278
    or:[key == #CursorRight]]]
ca@2177
  1279
    ) ifFalse:[
ca@2177
  1280
        ^ self
ca@2177
  1281
    ].
ca@2177
  1282
    item := model selectedItem.
ca@2177
  1283
ca@2177
  1284
    item isNil ifTrue:[
ca@2177
  1285
        ^ model selectedItem:(model first ? model rootItem)
ca@2177
  1286
    ].
ca@2177
  1287
ca@2177
  1288
    prnt := item parent.
ca@2177
  1289
    prnt isNil ifTrue:[
ca@2177
  1290
        "/ is the root item
ca@2177
  1291
        (key == #CursorUp or:[key == #CursorLeft]) ifTrue:[item := model listOfItems last]
ca@2177
  1292
                                                  ifFalse:[item := item at:1 ifAbsent:item].
ca@2177
  1293
cg@2758
  1294
        ^ model selectedItem:item
ca@2177
  1295
    ].
ca@2177
  1296
    key == #CursorLeft ifTrue:[ ^ model selectedItem:prnt ].
ca@2177
  1297
ca@2177
  1298
    key == #CursorRight ifTrue:[
ca@2177
  1299
        next := item at:1 ifAbsent:nil.
ca@2177
  1300
        next notNil ifTrue:[ model selectedItem:next ].
cg@2758
  1301
        ^ self
ca@2177
  1302
    ].
ca@2177
  1303
ca@2177
  1304
    max := prnt size.
ca@2177
  1305
ca@2177
  1306
    key == #CursorUp ifTrue:[
ca@2177
  1307
        idx := prnt identityIndexOf:item.
ca@2177
  1308
        idx == 1 ifTrue:[idx := max + 1].
ca@2177
  1309
        model selectedItem:(prnt at:idx - 1).
cg@2758
  1310
        ^ self.
ca@2177
  1311
    ].
ca@2177
  1312
ca@2177
  1313
    key == #CursorDown ifTrue:[
ca@2177
  1314
        idx := prnt identityIndexOf:item.
ca@2177
  1315
        idx == max ifTrue:[idx := 0].
ca@2177
  1316
        model selectedItem:(prnt at:idx + 1).
cg@2758
  1317
        ^ self.
ca@2177
  1318
    ].
ca@2177
  1319
!
ca@2177
  1320
ca@2177
  1321
processMappedView:aView
ca@2177
  1322
    |parent anchor|
ca@2177
  1323
ca@2177
  1324
    parent := self listOfItems detectItemRespondsToView:aView.
ca@2177
  1325
    parent isNil ifTrue:[ ^ self ].
ca@2177
  1326
ca@2177
  1327
    NotFoundSignal handle:[:ex|
ca@2177
  1328
        "contained subvies used by spec are not yet created;
ca@2177
  1329
         thus we have to wait until last used subview is build
ca@2177
  1330
        "
ca@2177
  1331
        anchor := nil.
ca@2177
  1332
    ] do:[
ca@2177
  1333
        anchor := parent class buildViewsFrom:(parent widget).
ca@2177
  1334
    ].
ca@2177
  1335
    anchor notNil ifTrue:[
ca@2177
  1336
        parent updateFromChildren:anchor children.
ca@2177
  1337
    ].
ca@2177
  1338
! !
ca@2177
  1339
cg@2744
  1340
!ViewTreeInspectorApplication methodsFor:'initialization & release'!
ca@2177
  1341
ca@2177
  1342
closeDownViews
ca@2455
  1343
    "release the grapped application"
ca@2455
  1344
ca@2177
  1345
    process := nil.
ca@2177
  1346
    super closeDownViews.
ca@2177
  1347
    self doUnpick.
ca@2177
  1348
!
ca@2177
  1349
ca@2177
  1350
initialize
ca@2455
  1351
    "setup my model and channels"
ca@2455
  1352
ca@2177
  1353
    super initialize.
ca@2177
  1354
ca@2177
  1355
    hasSingleSelectionHolder := false asValue.
ca@2177
  1356
    followFocusChannel       := false asValue.
cg@3124
  1357
    isCatchingEventsChannel  := false asValue.
cg@3037
  1358
    inspectorModeIndexHolder := 1 asValue.
cg@3037
  1359
    inspectorModeIndexHolder onChangeSend:#inspectorModeIndexHolderChanged to:self.
ca@2177
  1360
ca@2177
  1361
    model := ViewTreeModel new.
ca@2177
  1362
    model inputEventAction:[:ev| self processEvent:ev ].
ca@2177
  1363
    model mappedViewAction:[:vw| self processMappedView:vw ].
ca@2177
  1364
    model application:self.
ca@2458
  1365
    model addDependent:self.
ca@2458
  1366
ca@2177
  1367
ca@2451
  1368
    showNamesHolder := false asValue.
ca@2451
  1369
    showNamesHolder addDependent:self.
cg@3037
  1370
cg@3037
  1371
    "Modified: / 30-07-2013 / 09:20:08 / cg"
ca@2177
  1372
!
ca@2177
  1373
cg@2770
  1374
postBuildInspectorView:anInspector
cg@2770
  1375
    inspectorView := anInspector.
cg@2770
  1376
!
cg@2770
  1377
ca@2177
  1378
postBuildTree:aTree
ca@2177
  1379
    treeView := aTree scrolledView.
cg@3105
  1380
    "/ treeView hasConstantHeight:true.
cg@3104
  1381
!
cg@3104
  1382
cg@3104
  1383
release
cg@3104
  1384
    "release the grapped application"
cg@3104
  1385
cg@3104
  1386
    super release.
cg@3104
  1387
    self doUnpick.
ca@2177
  1388
! !
ca@2177
  1389
cg@2744
  1390
!ViewTreeInspectorApplication methodsFor:'menu queries'!
ca@2177
  1391
ca@2177
  1392
hasApplication
ca@2455
  1393
    "returns true if the current selected view has an application"
ca@2455
  1394
ca@2177
  1395
    |view|
ca@2177
  1396
ca@2177
  1397
    view := self selectedView.
ca@2177
  1398
  ^ (view notNil and:[view application notNil])
ca@2177
  1399
!
ca@2177
  1400
ca@2177
  1401
hasController
ca@2177
  1402
    "returns true if the current selected item's view has a controller
ca@2455
  1403
     other than nil or the view itself"
ca@2455
  1404
ca@2177
  1405
    |view controller|
ca@2177
  1406
ca@2177
  1407
    view := self selectedView.
ca@2177
  1408
ca@2177
  1409
    view notNil ifTrue:[
ca@2177
  1410
        controller := view controller.
ca@2177
  1411
      ^ (controller notNil and:[controller ~~ view])
ca@2177
  1412
    ].
ca@2177
  1413
    ^ false
ca@2177
  1414
!
ca@2177
  1415
ca@2177
  1416
hasModel
ca@2455
  1417
    "returns true if the current selected view has a model"
ca@2455
  1418
ca@2177
  1419
    |view|
ca@2177
  1420
ca@2177
  1421
    view := self selectedView.
ca@2177
  1422
  ^ (view notNil and:[view model notNil])
ca@2177
  1423
! !
ca@2177
  1424
cg@2744
  1425
!ViewTreeInspectorApplication methodsFor:'menu specs'!
ca@2177
  1426
ca@2177
  1427
middleButtonMenu
ca@2455
  1428
    "returns the middleButton menu for the single selected item or nil"
ca@2455
  1429
cg@2758
  1430
    ^ [ 
cg@2758
  1431
        model selectedItem notNil 
cg@2758
  1432
            ifTrue:[self class middleButtonMenu]
cg@2758
  1433
            ifFalse:[nil]
ca@2177
  1434
      ]
ca@2177
  1435
!
ca@2177
  1436
ca@2177
  1437
submenuApplications:aMenu
ca@2177
  1438
    |applications menu item list addBlock|
ca@2177
  1439
ca@2177
  1440
    item := aMenu selection nameKey == #single ifTrue:[model selectedItem]
ca@2177
  1441
                                              ifFalse:[model rootItem].
ca@2177
  1442
    item isNil ifTrue:[^ nil].
ca@2177
  1443
ca@2177
  1444
    applications := IdentityDictionary new.
ca@2177
  1445
ca@2177
  1446
    addBlock := [:el| |cls ctr|
ca@2177
  1447
        cls := self resolveApplicationClassFor:el.
ca@2177
  1448
ca@2177
  1449
        cls notNil ifTrue:[
ca@2177
  1450
            ctr := applications at:cls ifAbsent:0.
ca@2177
  1451
            applications at:cls put:(ctr + 1).
ca@2177
  1452
        ].
ca@2177
  1453
    ].
ca@2177
  1454
    item recursiveDo:addBlock.
ca@2177
  1455
    addBlock value:item.
ca@2177
  1456
ca@2177
  1457
    applications isEmpty ifTrue:[^ nil ].
ca@2177
  1458
    list := SortedCollection sortBlock:[:a :b| a title < b title ].
ca@2177
  1459
ca@2177
  1460
    applications keysAndValuesDo:[:cls :ctr|
ca@2177
  1461
       list add:(MenuDesc title:(cls name)
ca@2177
  1462
                          value:(ctr printString)
ca@2177
  1463
                         action:[self doSelectNextOfApplicationClass:cls startingIn:item]
ca@2177
  1464
                 ).
ca@2177
  1465
    ].
ca@2177
  1466
ca@2177
  1467
    menu := MenuDesc buildFromList:list onGC:aMenu.
ca@2177
  1468
    menu do:[:el|
ca@2177
  1469
        el hideMenuOnActivated:false
ca@2177
  1470
    ].
ca@2177
  1471
    ^ menu
ca@2177
  1472
!
ca@2177
  1473
ca@2177
  1474
submenuComponents:aMenu
ca@2177
  1475
    |widgets list total menu item|
ca@2177
  1476
ca@2177
  1477
    item := aMenu selection nameKey == #single ifTrue:[model selectedItem]
ca@2177
  1478
                                              ifFalse:[model rootItem].
ca@2177
  1479
    item isNil ifTrue:[^ nil].
ca@2177
  1480
ca@2177
  1481
    widgets := IdentityDictionary new.
ca@2177
  1482
    total   := 0.
ca@2177
  1483
ca@2177
  1484
    item recursiveDo:[:el| |cls ctr|
ca@2177
  1485
        cls := el widget.
ca@2177
  1486
ca@2177
  1487
        cls notNil ifTrue:[
ca@2177
  1488
            cls := cls class.
ca@2177
  1489
            ctr := widgets at:cls ifAbsent:0.
ca@2177
  1490
            widgets at:cls put:(ctr + 1).
ca@2177
  1491
            total := total + 1.
ca@2177
  1492
        ].
ca@2177
  1493
    ].
ca@2177
  1494
    total == 0 ifTrue:[^ nil].
ca@2177
  1495
    list := SortedCollection sortBlock:[:a :b| a title < b title ].
ca@2177
  1496
ca@2177
  1497
    widgets keysAndValuesDo:[:cls :ctr|
ca@2177
  1498
        list add:(MenuDesc title:(cls name)
ca@2177
  1499
                           value:(ctr printString)
ca@2177
  1500
                          action:[self doSelectNextOfClass:cls startingIn:item]
ca@2177
  1501
                 ).
ca@2177
  1502
    ].
ca@2177
  1503
    list := list asOrderedCollection.
ca@2177
  1504
    list add:(MenuDesc separator).
ca@2177
  1505
    list add:(MenuDesc title:'Total' value:(total printString)).
ca@2177
  1506
    menu := MenuDesc buildFromList:list onGC:aMenu.
ca@2177
  1507
    menu do:[:el|
ca@2177
  1508
        el hideMenuOnActivated:false
ca@2177
  1509
    ].
ca@2177
  1510
    ^ menu
ca@2177
  1511
!
ca@2177
  1512
ca@2177
  1513
submenuGeometry:aMenu
ca@2455
  1514
    "builds and returns the geometry submenu"
ca@2455
  1515
ca@2177
  1516
    |view point inst list x y|
ca@2177
  1517
ca@2177
  1518
    view := self selectedView.
ca@2177
  1519
    view isNil ifTrue:[^ nil].
ca@2177
  1520
ca@2177
  1521
    list := OrderedCollection new.
ca@2177
  1522
ca@2177
  1523
    "/ origin
ca@2177
  1524
    point := view relativeOrigin.
ca@2177
  1525
    point isNil ifTrue:[ point := view origin ].
ca@2177
  1526
ca@2177
  1527
    x := view left.
ca@2177
  1528
    y := view top.
ca@2177
  1529
ca@2177
  1530
    (x == point x and:[y == point y]) ifTrue:[ inst := point ]
ca@2177
  1531
                                     ifFalse:[ inst := '%1 --> (%2@%3)' bindWith:point with:x with:y ].
ca@2177
  1532
ca@2177
  1533
    list add:(MenuDesc title:'origin' value:inst).
ca@2177
  1534
ca@2177
  1535
    "/ corner
ca@2177
  1536
    point := view relativeCorner.
ca@2177
  1537
    point isNil ifTrue:[ point := view corner ].
ca@2177
  1538
ca@2177
  1539
    x := view right.
ca@2177
  1540
    y := view bottom.
ca@2177
  1541
ca@2177
  1542
    (x == point x and:[y == point y]) ifTrue:[ inst := point ]
ca@2177
  1543
                                     ifFalse:[ inst := '%1 --> (%2@%3)' bindWith:point with:x with:y ].
ca@2177
  1544
ca@2177
  1545
    list add:(MenuDesc title:'corner' value:inst).
ca@2177
  1546
ca@2177
  1547
    "/ extent
ca@2177
  1548
    (point := view relativeExtent) isNil ifTrue:[point := view extent].
ca@2177
  1549
    list add:(MenuDesc title:'extent' value:point).
ca@2177
  1550
ca@2177
  1551
    "/ preferred extent
ca@2177
  1552
    list add:(MenuDesc title:'pref. extent' value:(view preferredExtent)).
ca@2177
  1553
    list add:(MenuDesc separator).
ca@2177
  1554
ca@2177
  1555
    "/ view insets
ca@2177
  1556
    inst := 'l:%1  r:%2  t:%3  b:%4' bindWith:(view leftInset)
ca@2177
  1557
                                         with:(view rightInset)
ca@2177
  1558
                                         with:(view topInset)
ca@2177
  1559
                                         with:(view bottomInset).
ca@2177
  1560
ca@2177
  1561
    list add:(MenuDesc title:'insets'      value:inst).
ca@2177
  1562
    list add:(MenuDesc title:'borderWidth' value:(view borderWidth)).
ca@2177
  1563
    list add:(MenuDesc title:'level'       value:(view level)).
ca@2177
  1564
    list add:(MenuDesc separator).
ca@2177
  1565
ca@2177
  1566
    (inst := view layout) notNil ifTrue:[ inst := inst displayString ].
ca@2177
  1567
    list add:(MenuDesc title:'layout' value:inst).
ca@2177
  1568
ca@2177
  1569
    (inst := view transformation) notNil ifTrue:[ inst := inst displayString ].
ca@2177
  1570
    list add:(MenuDesc title:'transformation' value:inst).
ca@2177
  1571
ca@2177
  1572
  ^ MenuDesc buildFromList:list onGC:aMenu
ca@2177
  1573
!
ca@2177
  1574
ca@2177
  1575
submenuInspector:aMenu
ca@2455
  1576
    "builds and returns the inspector submenu"
ca@2455
  1577
cg@3040
  1578
    |view list n names label value indices|
ca@2177
  1579
ca@2177
  1580
    view := self selectedView.
ca@2177
  1581
    view isNil ifTrue:[^ nil].
ca@2177
  1582
ca@2177
  1583
    n := view class instSize.
ca@2177
  1584
    n > 0 ifFalse:[^ nil ].
ca@2177
  1585
ca@2177
  1586
    list  := OrderedCollection new:n.
ca@2177
  1587
    names := view class allInstVarNames.
cg@3040
  1588
    indices := (1 to:names size) asArray.
cg@3040
  1589
    names sortWith:indices.
ca@2177
  1590
ca@2177
  1591
    1 to:n do:[:i| |action|
ca@2177
  1592
        label := (names at:i) printString.
cg@3040
  1593
        value := view instVarAt:(indices at:i).
ca@2177
  1594
        value isNil ifTrue:[
ca@2177
  1595
            value  := '------'.
ca@2177
  1596
            action := nil.
ca@2177
  1597
        ] ifFalse:[
ca@2177
  1598
            value  := value displayString contractAtEndTo:40.
ca@2177
  1599
            action := [(view instVarAt:i) inspect].
ca@2177
  1600
        ].
ca@2177
  1601
        list add:(MenuDesc title:label value:value action:action).
ca@2177
  1602
    ].
ca@2177
  1603
ca@2177
  1604
    ^ MenuDesc buildFromList:list onGC:aMenu
cg@3040
  1605
cg@3040
  1606
    "Modified: / 31-07-2013 / 13:12:52 / cg"
ca@2177
  1607
!
ca@2177
  1608
ca@2177
  1609
submenuInterface:aMenu
ca@2455
  1610
    "builds and returns the interface submenu"
ca@2455
  1611
ca@2177
  1612
    |view label inst value list|
ca@2177
  1613
ca@2177
  1614
    view := self selectedView.
ca@2177
  1615
    view isNil ifTrue:[^ nil].
ca@2177
  1616
ca@2177
  1617
    list := OrderedCollection new.
ca@2177
  1618
ca@2177
  1619
    inst  := view controller.
ca@2177
  1620
    value := nil.
ca@2177
  1621
ca@2177
  1622
    inst isNil ifTrue:[
ca@2177
  1623
        label := nil
ca@2177
  1624
    ] ifFalse:[
cg@2758
  1625
        inst == view ifTrue:[ 
cg@2758
  1626
            label := '== view itself' 
cg@2758
  1627
        ] ifFalse:[ 
cg@2758
  1628
            label := inst displayString.
cg@2758
  1629
            value := [view controller inspect].
cg@2758
  1630
        ].
ca@2177
  1631
    ].
ca@2177
  1632
    list add:(MenuDesc title:'controller' value:label action:value).
ca@2177
  1633
ca@2177
  1634
    inst := view delegate.
ca@2177
  1635
    inst notNil ifTrue:[
ca@2177
  1636
        list add:(MenuDesc title:'delegate' value:(inst displayString) action:[ view delegate inspect ]).
ca@2177
  1637
    ].
ca@2177
  1638
ca@2177
  1639
    inst := view application.
ca@2177
  1640
cg@2758
  1641
    inst notNil ifTrue:[ 
cg@2758
  1642
        |topAppl|
cg@2758
  1643
ca@2177
  1644
        list add:(MenuDesc title:'application' value:inst action:[ view application inspect ]).
ca@2177
  1645
ca@2177
  1646
        topAppl := inst topApplication.
ca@2177
  1647
ca@2177
  1648
        (topAppl notNil and:[topAppl ~~ inst]) ifTrue:[
ca@2177
  1649
            list add:(MenuDesc title:'topApplication' value:topAppl action:[ inst topApplication inspect ]).
ca@2177
  1650
        ].
ca@2177
  1651
    ].
ca@2177
  1652
    list add:(MenuDesc separator).
ca@2177
  1653
cg@2888
  1654
    (view respondsTo:#'model') ifTrue:[
cg@2779
  1655
        inst := view model.
ca@2177
  1656
cg@2888
  1657
        inst isNil 
cg@2888
  1658
            ifTrue:[ label := value := nil ]
cg@2888
  1659
            ifFalse:[ label := inst displayString.
cg@2888
  1660
                      label := label,(self aspectLabelFor:inst inApplicationOf:view).  
cg@2888
  1661
                      value := [ view model inspect ].
cg@2888
  1662
                    ].
ca@2177
  1663
ca@2177
  1664
        list add:(MenuDesc title:'model' value:label action:value).
ca@2177
  1665
ca@2177
  1666
        (inst notNil and:[view respondsTo:#modelInterface]) ifTrue:[
ca@2177
  1667
            view modelInterface keysAndValuesDo:[:key : val|
ca@2177
  1668
                val isNil ifTrue:[ label := nil ]
ca@2177
  1669
                         ifFalse:[ label := val displayString ].
ca@2177
  1670
ca@2177
  1671
                list add:(MenuDesc title:('      - ', key) value:label ).
ca@2177
  1672
            ]
ca@2177
  1673
        ].
ca@2177
  1674
    ].
ca@2177
  1675
ca@2177
  1676
    (view respondsTo:#enableChannel) ifTrue:[
ca@2177
  1677
        inst := view enableChannel.
ca@2177
  1678
ca@2177
  1679
        inst isNil ifTrue:[ label := value := nil ]
ca@2177
  1680
                  ifFalse:[ label := inst displayString.
cg@2888
  1681
                            label := label,(self aspectLabelFor:inst inApplicationOf:view).  
ca@2177
  1682
                            value := [ view enableChannel inspect ].
ca@2177
  1683
                          ].
ca@2177
  1684
ca@2177
  1685
        list add:(MenuDesc title:'enableChannel' value:label action:value).
ca@2177
  1686
    ].
ca@2177
  1687
cg@2888
  1688
    #( #action #pressAction #releaseAction ) do:[:actionSelector |
cg@2779
  1689
        (view respondsTo:actionSelector) ifTrue:[
cg@2779
  1690
            inst := view perform:actionSelector.
cg@2779
  1691
cg@2779
  1692
            inst isNil 
cg@2779
  1693
                ifTrue:[ label := value := nil ]
cg@2779
  1694
                ifFalse:[ label := inst displayString.
cg@2779
  1695
                            value := [ (view perform:actionSelector) inspect ].
cg@2779
  1696
                        ].
cg@2779
  1697
cg@3040
  1698
            list add:(MenuDesc title:actionSelector"'action'" value:label action:value).
cg@2779
  1699
        ].
cg@2779
  1700
    ].
cg@2779
  1701
ca@2177
  1702
    list last isSeparator ifFalse:[ list add:(MenuDesc separator) ].
ca@2177
  1703
ca@2177
  1704
    (view respondsTo:#listHolder) ifTrue:[
ca@2177
  1705
        inst := view listHolder.
ca@2177
  1706
ca@2177
  1707
        inst isNil ifTrue:[ label := value := nil ]
ca@2177
  1708
                  ifFalse:[ label := inst class printString.
cg@2888
  1709
                            label := label,(self aspectLabelFor:inst inApplicationOf:view).  
ca@2177
  1710
                            value := [ view listHolder inspect ].
ca@2177
  1711
                          ].
ca@2177
  1712
        list add:(MenuDesc title:'listHolder' value:label action:value).
ca@2177
  1713
    ].
ca@2177
  1714
ca@2177
  1715
    (view respondsTo:#list) ifTrue:[
ca@2177
  1716
        inst := view list.
ca@2177
  1717
ca@2177
  1718
        inst isNil ifTrue:[ label := value := nil ]
ca@2177
  1719
                  ifFalse:[ label := '%1 [%2]' bindWith:(inst class printString) with:(inst size).
cg@2888
  1720
                            label := label,(self aspectLabelFor:inst inApplicationOf:view).  
ca@2177
  1721
                            value := [ view list inspect ].
ca@2177
  1722
                          ].
ca@2177
  1723
ca@2177
  1724
        list add:(MenuDesc title:'list' value:label action:value).
ca@2177
  1725
    ].
ca@2177
  1726
ca@2177
  1727
    list last isSeparator ifTrue:[ list removeLast ].
cg@2888
  1728
    ^ MenuDesc buildFromList:list onGC:aMenu
cg@2888
  1729
cg@3040
  1730
    "Modified: / 31-07-2013 / 13:09:55 / cg"
ca@2177
  1731
!
ca@2177
  1732
ca@2177
  1733
submenuVisibility:aMenu
ca@2455
  1734
    "builds and returns the geometry submenu"
ca@2455
  1735
ca@2177
  1736
    |view list value|
ca@2177
  1737
ca@2177
  1738
    view := self selectedView.
ca@2177
  1739
    view isNil ifTrue:[^ nil].
ca@2177
  1740
ca@2177
  1741
    list := OrderedCollection new.
ca@2177
  1742
ca@2177
  1743
    list add:(MenuDesc title:'device'     value:(view device printString)).
ca@2177
  1744
    list add:(MenuDesc title:'drawableId' value:(view id)).
ca@2177
  1745
    list add:(MenuDesc title:'gcId'       value:(view gcId)).
ca@2177
  1746
ca@2177
  1747
    list add:(MenuDesc separator).
ca@2177
  1748
ca@2177
  1749
    list add:(MenuDesc title:'shown'    value:(view shown)).
ca@2177
  1750
    list add:(MenuDesc title:'realized' value:(view realized)).
ca@2177
  1751
ca@2177
  1752
    list add:(MenuDesc separator).
ca@2177
  1753
ca@2177
  1754
    list add:(MenuDesc title:'hiddenOnRealize' value:(view isHiddenOnRealize)).
ca@2177
  1755
ca@2177
  1756
    (value := view visibilityChannel) isNil ifTrue:[
ca@2177
  1757
        list add:(MenuDesc title:'visibilityChannel' value:'------').
ca@2177
  1758
    ] ifFalse:[
ca@2177
  1759
        list add:(MenuDesc title:'visibilityChannel'
ca@2177
  1760
                           value:(value displayString)
ca@2177
  1761
                          action:[view visibilityChannel inspect]).
ca@2177
  1762
    ].
ca@2177
  1763
cg@2758
  1764
    ^ MenuDesc buildFromList:list onGC:aMenu
ca@2177
  1765
! !
ca@2177
  1766
cg@2744
  1767
!ViewTreeInspectorApplication methodsFor:'private'!
ca@2177
  1768
cg@2888
  1769
aspectLabelFor:aModel inApplicationOf:aView
cg@2888
  1770
    |app|
cg@2888
  1771
cg@2888
  1772
    aModel isNil ifTrue:[^ ''].
cg@2888
  1773
    aView isNil ifTrue:[^ ''].
cg@2888
  1774
    (app := aView application) isNil ifTrue:[^ ''].
cg@2888
  1775
    app builder bindings keysAndValuesDo:[:aspect :value |
cg@2888
  1776
        value == aModel ifTrue:[^ ' [aspect: ',aspect,']'].
cg@2888
  1777
    ].
cg@2888
  1778
    app class allInstVarNames do:[:nm | 
cg@2888
  1779
        (app instVarNamed:nm) == aModel ifTrue:[^ ' [instvar: ',nm,']']
cg@2888
  1780
    ].
cg@2888
  1781
cg@2888
  1782
    ^ ''
cg@2888
  1783
cg@2888
  1784
    "Created: / 27-04-2012 / 14:22:09 / cg"
cg@2888
  1785
!
cg@2888
  1786
ca@2177
  1787
selectFocusView
cg@2762
  1788
    |rootView focusView|
ca@2177
  1789
ca@2177
  1790
    rootView := model rootView.
ca@2177
  1791
ca@2177
  1792
    (rootView notNil and:[rootView shown]) ifTrue:[
ca@2177
  1793
        focusView := rootView windowGroup focusView.
ca@2177
  1794
    ].
ca@2177
  1795
    focusView isNil ifTrue:[^ self ].
ca@2177
  1796
cg@2762
  1797
    self selectView:focusView
cg@2762
  1798
!
cg@2762
  1799
cg@2762
  1800
selectView:aView
cg@2762
  1801
    |currentItem viewItem|
cg@2762
  1802
cg@2762
  1803
    currentItem := model selectedItem.
cg@2762
  1804
cg@2762
  1805
    (currentItem notNil and:[currentItem widget == aView]) ifTrue:[
ca@2177
  1806
        ^ self
ca@2177
  1807
    ].
cg@2762
  1808
    viewItem := model listOfItems recursiveDetect:[:el| el widget == aView ].
cg@2762
  1809
cg@2762
  1810
    viewItem notNil ifTrue:[
cg@2762
  1811
        model selectItem:viewItem.
ca@2177
  1812
    ].        
ca@2177
  1813
!
ca@2177
  1814
ca@2177
  1815
setRootItem:aRootItemOrNil
ca@2177
  1816
    |theProcess|
ca@2177
  1817
ca@2177
  1818
    aRootItemOrNil isNil ifTrue:[
ca@2177
  1819
        process := nil.
ca@2177
  1820
    ] ifFalse:[
ca@2177
  1821
        "/ expand tree to level 3
ca@2177
  1822
        aRootItemOrNil do:[:aRootChild|
ca@2177
  1823
            aRootChild do:[:aSubChild| aSubChild expand ].
ca@2177
  1824
            aRootChild expand.
ca@2177
  1825
        ].
ca@2177
  1826
        aRootItemOrNil expand.
ca@2177
  1827
ca@2177
  1828
        process isNil ifTrue:[
ca@2177
  1829
            theProcess := process :=
cg@3034
  1830
                Process 
cg@3034
  1831
                    for:[   
cg@3034
  1832
                        |update testModeChannel|
cg@3034
  1833
cg@3034
  1834
                        update := false.
cg@3034
  1835
                        testModeChannel := model testModeChannel.
cg@3034
  1836
cg@3034
  1837
                        [process == theProcess] whileTrue:[
cg@3034
  1838
                            Delay waitForSeconds:0.5.
cg@3034
  1839
cg@3034
  1840
                            (treeView notNil and:[process == theProcess and:[treeView shown]]) ifTrue:[
cg@3034
  1841
                                (testModeChannel value == true and:[followFocusChannel value == true]) ifTrue:[
cg@3034
  1842
                                    self selectFocusView.
ca@2177
  1843
                                ].
cg@3034
  1844
                                update ifTrue:[
cg@3034
  1845
                                    self updateShownStatus.
cg@3034
  1846
                                ].
cg@3034
  1847
                                update := update not.
cg@3034
  1848
                            ].
cg@3034
  1849
                        ].
cg@3034
  1850
                    ] 
cg@3034
  1851
                    priority:(Processor userSchedulingPriority).
cg@3034
  1852
            theProcess name:'ViewTreeInspector - Focus Follower'.
ca@2177
  1853
            theProcess resume.
ca@2177
  1854
        ].
ca@2177
  1855
    ].
ca@2177
  1856
    model rootItem:aRootItemOrNil.
cg@3034
  1857
cg@3034
  1858
    "Modified: / 25-07-2013 / 12:03:44 / cg"
ca@2177
  1859
!
ca@2177
  1860
ca@2177
  1861
updateShownStatus
ca@2177
  1862
    |rootItem min max visState listIdx visY0 visY1 height damage|
ca@2177
  1863
ca@2177
  1864
    rootItem := model rootItem.
ca@2177
  1865
    (rootItem notNil and:[rootItem widget shown]) ifFalse:[^ self].
ca@2177
  1866
ca@2177
  1867
    max := 0.
ca@2177
  1868
    min := 9999999.
ca@2177
  1869
ca@2177
  1870
    rootItem recursiveEachVisibleItemDo:[:anItem|
ca@2177
  1871
        visState := (anItem widget shown).
ca@2177
  1872
ca@2177
  1873
        visState ~~ anItem isDrawnShown ifTrue:[
ca@2177
  1874
            anItem isDrawnShown:visState.
ca@2177
  1875
            listIdx := treeView identityIndexOf:anItem.
ca@2177
  1876
ca@2177
  1877
            listIdx > 0 ifTrue:[    
ca@2177
  1878
                max := max max:listIdx.
ca@2177
  1879
                min := min min:listIdx.
ca@2177
  1880
            ].
ca@2177
  1881
        ].
ca@2177
  1882
    ].
ca@2177
  1883
    max < min ifTrue:[^ self].
ca@2177
  1884
    max := max + 1.
ca@2177
  1885
ca@2177
  1886
    visY0  := (treeView yVisibleOfLine:min) max:0.
ca@2177
  1887
    visY1  := (treeView yVisibleOfLine:max) min:(treeView height).
ca@2177
  1888
    height := visY1 - visY0.
ca@2177
  1889
    
ca@2177
  1890
    height > 2 ifTrue:[
ca@2177
  1891
        treeView shown ifTrue:[
ca@2177
  1892
            damage := Rectangle left:0 top:visY0 width:(treeView width) height:height.
ca@2177
  1893
            treeView invalidateDeviceRectangle:damage repairNow:false.
ca@2177
  1894
        ].
ca@2177
  1895
    ].
ca@2177
  1896
! !
ca@2177
  1897
cg@2744
  1898
!ViewTreeInspectorApplication methodsFor:'selection'!
ca@2177
  1899
ca@2177
  1900
selectedView
ca@2455
  1901
    "answer the selected view or nil"
ca@2455
  1902
ca@2177
  1903
    |item|
ca@2177
  1904
ca@2177
  1905
    item := model selectedItem.
ca@2177
  1906
    item notNil ifTrue:[ ^ item widget ].
ca@2177
  1907
  ^ nil
ca@2177
  1908
! !
ca@2177
  1909
cg@2744
  1910
!ViewTreeInspectorApplication methodsFor:'testing'!
ca@2177
  1911
ca@2177
  1912
resolveApplicationClassFor:aTreeItem
ca@2177
  1913
    aTreeItem isApplicationClass ifTrue:[
ca@2177
  1914
       ^ aTreeItem applicationClass
ca@2177
  1915
    ].
ca@2177
  1916
    ^ nil
ca@2177
  1917
!
ca@2177
  1918
ca@2177
  1919
selectedComponentHasChildren
ca@2177
  1920
    |item|
ca@2177
  1921
ca@2177
  1922
    item := model selectedItem.
ca@2177
  1923
    ^ (item notNil and:[item hasChildren])
ca@2177
  1924
! !
ca@2177
  1925
cg@2744
  1926
!ViewTreeInspectorApplication methodsFor:'user operations'!
ca@2177
  1927
ca@2177
  1928
doBrowse:what
ca@2177
  1929
    "open browser on:
ca@2177
  1930
        #view           browse class
ca@2177
  1931
        #model          browse model class
ca@2177
  1932
        #application    browse application class
ca@2177
  1933
        #controller     browse controller class
ca@2177
  1934
    "
cg@3167
  1935
    |inst|
cg@3167
  1936
cg@3167
  1937
    (inst := self objectToInspectOrBrowse:what) isNil ifTrue:[^ self].
cg@3167
  1938
    inst class browserClass openInClass:(inst class) selector:nil
cg@3049
  1939
cg@3049
  1940
    "Modified: / 28-08-2013 / 23:57:42 / cg"
ca@2177
  1941
!
ca@2177
  1942
cg@3124
  1943
doCatchEvents
cg@3124
  1944
    model catchEvents:true.
cg@3124
  1945
    isCatchingEventsChannel value:true.
cg@3124
  1946
"/    ((builder componentAt:'toolbarMenu') itemAt:#doUncatchEvents) 
cg@3124
  1947
"/        enabled:true;
cg@3124
  1948
"/        label:(self class releaseViewIcon);
cg@3124
  1949
"/        activeHelpKey:#doUncatchEvents.
cg@3124
  1950
!
cg@3124
  1951
cg@3171
  1952
doDebugProcess
cg@3171
  1953
    "open debugger on the window process"
cg@3171
  1954
cg@3171
  1955
    |view|
cg@3171
  1956
cg@3171
  1957
    view := self selectedView.
cg@3171
  1958
    view isNil ifTrue:[^ nil].
cg@3171
  1959
cg@3171
  1960
    Debugger openOn:view windowGroup process
cg@3171
  1961
!
cg@3171
  1962
ca@2177
  1963
doDestroy
ca@2455
  1964
    "destroy the current selected view"
ca@2455
  1965
ca@2177
  1966
    |item parent|
ca@2177
  1967
ca@2177
  1968
    item := model selectedItem.
ca@2177
  1969
    item isNil ifTrue:[ ^ self].
ca@2177
  1970
ca@2177
  1971
    parent := item parent.
ca@2177
  1972
ca@2177
  1973
    parent isNil ifTrue:[
ca@2177
  1974
        "/ the root
ca@2177
  1975
        model withSelectionHiddenDo:[item deleteAll].
ca@2177
  1976
      ^ self
ca@2177
  1977
    ].
ca@2177
  1978
ca@2177
  1979
    model withSelectionHiddenDo:[
ca@2177
  1980
        |idx nsel|
ca@2177
  1981
ca@2177
  1982
        idx := parent identityIndexOf:item.
ca@2177
  1983
ca@2177
  1984
        idx == parent size ifTrue:[
ca@2177
  1985
            nsel := parent at:(idx - 1) ifAbsent:parent
ca@2177
  1986
        ] ifFalse:[
ca@2177
  1987
            nsel := parent at:(idx + 1)
ca@2177
  1988
        ].
ca@2177
  1989
        model setValue:nil.
ca@2177
  1990
        item delete.
ca@2177
  1991
ca@2177
  1992
        parent isLayoutContainer ifTrue:[
ca@2177
  1993
            parent widget sizeChanged:nil
ca@2177
  1994
        ].
ca@2177
  1995
        model value:nsel.
ca@2177
  1996
    ].
ca@2177
  1997
!
ca@2177
  1998
ca@2177
  1999
doFlash
ca@2455
  2000
    "flash the selected view"
ca@2455
  2001
ca@2177
  2002
    |view|
ca@2177
  2003
ca@2177
  2004
    view := self selectedView.
ca@2177
  2005
    view isNil ifTrue:[ ^ self].
ca@2177
  2006
ca@2177
  2007
    view shown ifTrue:[
ca@2177
  2008
        model withSelectionHiddenDo:[
ca@2177
  2009
            view perform:#flash ifNotUnderstood:nil.
ca@2177
  2010
        ].
ca@2177
  2011
    ].
ca@2177
  2012
!
ca@2177
  2013
ca@2177
  2014
doInspect:what
ca@2177
  2015
    "open inspector on:
ca@2177
  2016
        #view           inspect class
ca@2177
  2017
        #group          inspect windowGroup
ca@2177
  2018
        #model          inspect model
ca@2177
  2019
        #application    inspect application
ca@2177
  2020
        #controller     inspect controller
cg@3034
  2021
        #process        inspect application's process
ca@2177
  2022
    "
cg@3167
  2023
ca@2177
  2024
    |inst|
ca@2177
  2025
cg@3167
  2026
    (inst := self objectToInspectOrBrowse:what) isNil ifTrue:[^ self].
cg@3167
  2027
    inst inspect.
cg@3049
  2028
cg@3049
  2029
    "Modified: / 28-08-2013 / 23:58:27 / cg"
ca@2177
  2030
!
ca@2177
  2031
cg@3034
  2032
doOpenProcessMonitor
cg@3034
  2033
    (ProcessMonitorV2 ? ProcessMonitor) open
cg@3034
  2034
cg@3034
  2035
    "Created: / 25-07-2013 / 12:34:23 / cg"
cg@3034
  2036
!
cg@3034
  2037
cg@2762
  2038
doPickView
ca@2455
  2039
    "pick a window's topView"
ca@2455
  2040
cg@2762
  2041
    |screen clickedView topWindow cursor|
ca@2177
  2042
ca@2177
  2043
    self doUnpick.
ca@2177
  2044
cg@2759
  2045
    cursor := Cursor fromImage:(self class crossHairIcon).
cg@2759
  2046
cg@2759
  2047
    screen := Screen current.
cg@2762
  2048
    clickedView := screen viewFromPoint:(screen pointFromUserShowing:cursor).
cg@2762
  2049
    clickedView isNil ifTrue:[^ self].
cg@2762
  2050
cg@2762
  2051
    topWindow := clickedView topView.
cg@2762
  2052
cg@2762
  2053
    (    topWindow == Screen current rootView
cg@2762
  2054
     or:[topWindow == self window topView]
ca@2177
  2055
    ) ifTrue:[
ca@2177
  2056
        ^ self
ca@2177
  2057
    ].
cg@2978
  2058
cg@3070
  2059
    self showWindow:clickedView.
ca@2177
  2060
!
ca@2177
  2061
cg@2978
  2062
doRedraw
cg@2978
  2063
    "redraw the app"
cg@2978
  2064
cg@3124
  2065
    model rootView notNil ifTrue:[
cg@3124
  2066
        model rootView withAllSubViewsDo:[:v | v "redraw; "invalidate].
cg@3124
  2067
    ]
cg@2978
  2068
!
cg@2978
  2069
cg@3168
  2070
doSelectNextElementStartingIn:anItem forWhich:aBlock
ca@2177
  2071
    |startItem firstFound searchNext|
ca@2177
  2072
ca@2177
  2073
    startItem  := model last.
ca@2177
  2074
    searchNext := startItem notNil.        
ca@2177
  2075
    firstFound := nil.
ca@2177
  2076
ca@2177
  2077
    anItem recursiveDo:[:el|
ca@2177
  2078
        el == startItem ifTrue:[
ca@2177
  2079
            searchNext := false
ca@2177
  2080
        ] ifFalse:[
cg@3168
  2081
            (aBlock value:el) ifTrue:[
ca@2177
  2082
                searchNext ifFalse:[^ model selectItem:el].
ca@2177
  2083
ca@2177
  2084
                firstFound isNil ifTrue:[
ca@2177
  2085
                    firstFound := el
ca@2177
  2086
                ]
ca@2177
  2087
            ]
ca@2177
  2088
        ]
ca@2177
  2089
    ].
ca@2177
  2090
    firstFound notNil ifTrue:[
ca@2177
  2091
        self window beep.
ca@2177
  2092
        model selectItem:firstFound
ca@2177
  2093
    ].
ca@2177
  2094
!
ca@2177
  2095
cg@3168
  2096
doSelectNextOfApplicationClass:aClass startingIn:anItem
cg@3168
  2097
    self doSelectNextElementStartingIn:anItem forWhich:[:el | (self resolveApplicationClassFor:el) == aClass].
cg@3168
  2098
!
cg@3168
  2099
ca@2177
  2100
doSelectNextOfClass:aClass startingIn:anItem
cg@3168
  2101
    self doSelectNextElementStartingIn:anItem forWhich:[:el | el widget class == aClass].
ca@2177
  2102
!
ca@2177
  2103
cg@2978
  2104
doUncatchEvents
cg@3124
  2105
    "release the inspected window (no longer catch its events)"
cg@3124
  2106
cg@2978
  2107
    model catchEvents:false.
cg@3124
  2108
    isCatchingEventsChannel value:false.
cg@3124
  2109
"/    ((builder componentAt:'toolbarMenu') itemAt:#doUncatchEvents) 
cg@3124
  2110
"/        label:(self class releaseViewIcon);
cg@3124
  2111
"/        enabled:false;
cg@3124
  2112
"/        activeHelpKey:#doCatchEvents.
cg@2978
  2113
    self doRedraw
cg@2978
  2114
!
cg@2978
  2115
ca@2177
  2116
doUnpick
ca@2455
  2117
    "release current picked window and contained subwindows"
ca@2455
  2118
ca@2177
  2119
    self setRootItem:nil.
cg@2744
  2120
!
cg@2744
  2121
cg@3167
  2122
objectToInspectOrBrowse:what
cg@3167
  2123
    "return one of:
cg@3167
  2124
        #view           inspect class
cg@3167
  2125
        #group          inspect windowGroup
cg@3167
  2126
        #model          inspect model
cg@3167
  2127
        #application    inspect application
cg@3167
  2128
        #controller     inspect controller
cg@3167
  2129
        #process        inspect application's process
cg@3167
  2130
    "
cg@3167
  2131
    |view inst|
cg@3167
  2132
cg@3167
  2133
    view := self selectedView.
cg@3167
  2134
    view isNil ifTrue:[^ nil].
cg@3167
  2135
cg@3167
  2136
             what == #group       ifTrue:[ inst := view windowGroup ]
cg@3167
  2137
    ifFalse:[what == #model       ifTrue:[ inst := view model ]
cg@3167
  2138
    ifFalse:[what == #application ifTrue:[ inst := view application ]
cg@3167
  2139
    ifFalse:[what == #controller  ifTrue:[ inst := view controller  ]
cg@3167
  2140
    ifFalse:[what == #process     ifTrue:[ inst := view windowGroup process  ]
cg@3169
  2141
    ifFalse:[what == #sensor      ifTrue:[ inst := view sensor  ]
cg@3169
  2142
    ifFalse:[inst := view  ]]]]]].
cg@3167
  2143
cg@3167
  2144
    (inst isNil and:[what == #application]) ifTrue:[
cg@3167
  2145
        inst := view topView
cg@3167
  2146
    ].
cg@3167
  2147
    ^ inst
cg@3167
  2148
cg@3167
  2149
    "Modified: / 28-08-2013 / 23:58:27 / cg"
cg@3167
  2150
!
cg@3167
  2151
cg@2744
  2152
openDocumentation
cg@2744
  2153
    HTMLDocumentView openFullOnDocumentationFile:'tools/misc/TOP.html#VIEWTREEINSPECTOR'
cg@3014
  2154
!
cg@3014
  2155
cg@3014
  2156
showWindow:aView
cg@3014
  2157
    "show a particular window's topView hierarchy,
cg@3014
  2158
     select the given view"
cg@3014
  2159
cg@3014
  2160
    | topWindow |
cg@3014
  2161
cg@3014
  2162
    topWindow := aView topView.
cg@3014
  2163
cg@3124
  2164
    self doCatchEvents.
cg@3014
  2165
    self setRootItem:(ViewTreeItem buildViewsFrom:topWindow).
cg@3014
  2166
    self selectView:aView.
ca@2177
  2167
! !
ca@2177
  2168
cg@2744
  2169
!ViewTreeInspectorApplication::MenuDesc class methodsFor:'building'!
ca@2177
  2170
ca@2177
  2171
buildFromList:aList onGC:aMenu
ca@2177
  2172
    |tabSpec menu w menuPanel|
ca@2177
  2173
ca@2177
  2174
    w := 0.
ca@2177
  2175
    aList do:[:el| w := w max:(el widthOn:aMenu) ].
ca@2177
  2176
ca@2177
  2177
    tabSpec := TabulatorSpecification new.
ca@2177
  2178
    tabSpec unit:#pixel.
ca@2177
  2179
    tabSpec positions:#(0     1.5 ).
ca@2177
  2180
    tabSpec align:#(#left #left).
ca@2177
  2181
ca@2177
  2182
    w := w + 15.
ca@2177
  2183
    tabSpec positions:(Array with:0 with:w).
ca@2177
  2184
ca@2177
  2185
    menu := Menu new.
ca@2177
  2186
ca@2177
  2187
    aList do:[:el|
ca@2177
  2188
        menu addItem:(el asMenuItemWithTabulatorSpecification:tabSpec).
ca@2177
  2189
    ].
ca@2177
  2190
    menuPanel := MenuPanel menu:menu.
ca@2177
  2191
    ^ menuPanel
ca@2177
  2192
! !
ca@2177
  2193
cg@2744
  2194
!ViewTreeInspectorApplication::MenuDesc class methodsFor:'instance creation'!
ca@2177
  2195
ca@2177
  2196
separator
ca@2177
  2197
    ^ self new
ca@2177
  2198
!
ca@2177
  2199
ca@2177
  2200
title:aTitle value:aValue
ca@2177
  2201
    ^ self title:aTitle value:aValue action:nil
ca@2177
  2202
!
ca@2177
  2203
ca@2177
  2204
title:aTitle value:aValue action:anAction
ca@2177
  2205
    ^ self new title:aTitle value:aValue action:anAction
ca@2177
  2206
! !
ca@2177
  2207
cg@2744
  2208
!ViewTreeInspectorApplication::MenuDesc methodsFor:'accessing'!
ca@2177
  2209
ca@2177
  2210
title
ca@2177
  2211
    ^ title
ca@2177
  2212
! !
ca@2177
  2213
cg@2744
  2214
!ViewTreeInspectorApplication::MenuDesc methodsFor:'building'!
ca@2177
  2215
ca@2177
  2216
asMenuItemWithTabulatorSpecification:aTabSpec
ca@2177
  2217
    |array|
ca@2177
  2218
ca@2177
  2219
    title isNil ifTrue:[ ^ MenuItem label:value ].     "/ separator
ca@2177
  2220
ca@2177
  2221
    array := Array with:(title, ':') with:'------'.
ca@2177
  2222
ca@2177
  2223
    value notNil ifTrue:[
ca@2177
  2224
        array at:2 put:(value printString, ' ')
ca@2177
  2225
    ].
ca@2177
  2226
cg@2758
  2227
   ^ MenuItem 
cg@2758
  2228
        label:(MultiColListEntry fromStrings:array tabulatorSpecification:aTabSpec)
cg@2758
  2229
        value:action
ca@2177
  2230
! !
ca@2177
  2231
cg@2744
  2232
!ViewTreeInspectorApplication::MenuDesc methodsFor:'instance creation'!
ca@2177
  2233
ca@2177
  2234
title:aTitle value:aValue action:anAction
ca@2177
  2235
    "test for separator
ca@2177
  2236
    "
ca@2177
  2237
    title  := aTitle withoutSeparators.
ca@2177
  2238
    action := anAction.
ca@2177
  2239
ca@2177
  2240
    aValue notNil ifTrue:[
ca@2177
  2241
        value := aValue printString.
ca@2177
  2242
ca@2177
  2243
        value size > 70 ifTrue:[
ca@2177
  2244
            value := value copyFrom:1 to:70.
ca@2177
  2245
            value := value, '...'
ca@2177
  2246
        ]
ca@2177
  2247
    ].
ca@2177
  2248
! !
ca@2177
  2249
cg@2744
  2250
!ViewTreeInspectorApplication::MenuDesc methodsFor:'queries'!
ca@2177
  2251
ca@2177
  2252
isSeparator
ca@2177
  2253
    ^ title isNil
ca@2177
  2254
!
ca@2177
  2255
ca@2177
  2256
widthOn:aGC
ca@2177
  2257
    title isNil ifTrue:[^ 5].  "/ separator
cg@2758
  2258
    ^ title widthOn:aGC
ca@2177
  2259
! !
ca@2177
  2260
cg@2744
  2261
!ViewTreeInspectorApplication::ViewTreeItem class methodsFor:'building'!
cg@2744
  2262
cg@2744
  2263
buildViewsFrom:aView
cg@2744
  2264
    "build the items starting from a source view;
cg@2744
  2265
     returns the anhor.
cg@2744
  2266
    "
cg@2744
  2267
    |item subViews subItems|
cg@2744
  2268
cg@2744
  2269
    aView isNil ifTrue:[^ nil].
cg@2744
  2270
cg@2744
  2271
    item     := self forView:aView.
cg@2744
  2272
    subViews := aView subViews.
cg@2744
  2273
cg@2744
  2274
    subViews notEmptyOrNil ifTrue:[
cg@2744
  2275
        subItems := OrderedCollection new.
cg@2744
  2276
        subViews do:[:aSubView|
cg@2744
  2277
            subItems add:(self buildViewsFrom:aSubView).
cg@2744
  2278
        ].
cg@2744
  2279
        item children:subItems.
cg@2744
  2280
    ].
cg@2744
  2281
    ^ item
cg@2744
  2282
! !
cg@2744
  2283
cg@2744
  2284
!ViewTreeInspectorApplication::ViewTreeItem class methodsFor:'documentation'!
cg@2744
  2285
cg@2744
  2286
documentation
cg@2744
  2287
"
cg@2744
  2288
    ViewTreeItems represants a pickable object within a ViewTreeModel.
cg@2744
  2289
    The class is used to build up the hierarchical tree.
cg@2744
  2290
cg@2744
  2291
    [Instance variables:]
cg@2744
  2292
        widget        <View>            the widget represented by the item
cg@2744
  2293
        spec          <UISpecification> the UISpecification or nil
cg@2744
  2294
cg@2744
  2295
    [Class variables:]
cg@2744
  2296
        HandleExtent  <Point>           keeps the extent of a handle
cg@2744
  2297
cg@2744
  2298
cg@2744
  2299
    [author:]
cg@2744
  2300
        Claus Atzkern
cg@2744
  2301
cg@2744
  2302
    [see also:]
cg@2744
  2303
        HierarchicalItem
cg@2744
  2304
        ViewTreeModel
cg@2744
  2305
"
cg@2744
  2306
!
ca@2177
  2307
ca@2177
  2308
version
ca@2177
  2309
    ^ '$Header$'
ca@2177
  2310
! !
ca@2177
  2311
cg@2744
  2312
!ViewTreeInspectorApplication::ViewTreeItem class methodsFor:'initialization'!
cg@2744
  2313
cg@2744
  2314
initialize
cg@2744
  2315
    "set the extent of the Handle
cg@2744
  2316
    "
cg@2744
  2317
    HandleExtent := 6@6.
cg@2744
  2318
! !
cg@2744
  2319
cg@2744
  2320
!ViewTreeInspectorApplication::ViewTreeItem class methodsFor:'instance creation'!
cg@2744
  2321
cg@2744
  2322
forView:aView
cg@2744
  2323
    |item|
cg@2744
  2324
cg@2744
  2325
    item := self basicNew initialize.
cg@2744
  2326
    item forView:aView.
cg@2744
  2327
  ^ item
cg@2744
  2328
!
cg@2744
  2329
cg@2744
  2330
new
cg@2744
  2331
    self error:'not allowed'.
cg@2744
  2332
  ^ nil
cg@2744
  2333
!
cg@2744
  2334
cg@2744
  2335
on:aView withSpec:aSpec
cg@2744
  2336
    |item|
cg@2744
  2337
cg@2744
  2338
    item := self basicNew initialize.
cg@2744
  2339
    item on:aView withSpec:aSpec.
cg@2744
  2340
  ^ item
cg@2744
  2341
! !
cg@2744
  2342
cg@2744
  2343
!ViewTreeInspectorApplication::ViewTreeItem methodsFor:'accessing'!
cg@2744
  2344
cg@2744
  2345
applicationClass
cg@2744
  2346
    |appl|
cg@2744
  2347
cg@2744
  2348
    widget notNil ifTrue:[
cg@2744
  2349
        appl := widget application.
cg@2744
  2350
        appl notNil ifTrue:[^ appl class ].
cg@2744
  2351
    ].
cg@2744
  2352
    ^ nil
cg@2744
  2353
!
cg@2744
  2354
cg@2744
  2355
isDrawnShown
cg@2744
  2356
    "returns true if the last display operations was done during the widget was shown
cg@2744
  2357
    "
cg@2744
  2358
    ^ isDrawnShown
cg@2744
  2359
!
cg@2744
  2360
cg@2744
  2361
isDrawnShown:aBoolean
cg@2744
  2362
    isDrawnShown := aBoolean.
cg@2744
  2363
!
cg@2744
  2364
cg@2744
  2365
rootView
cg@2744
  2366
    "returns the widget assigned to the root or nil
cg@2744
  2367
    "
cg@2744
  2368
    ^ parent rootView
cg@2744
  2369
!
cg@2744
  2370
cg@2744
  2371
specClass
cg@2744
  2372
    "returns the spec-class assigned to the item
cg@2744
  2373
    "
cg@2744
  2374
    ^ widget specClass
cg@2744
  2375
!
cg@2744
  2376
cg@2744
  2377
treeModel
cg@2744
  2378
    "returns the assigned treeModel, an instance of ViewTreeModel
cg@2744
  2379
    "
cg@2744
  2380
    ^ parent treeModel
cg@2744
  2381
!
cg@2744
  2382
cg@2744
  2383
widget
cg@2744
  2384
    "returns the widget assigned to the item
cg@2744
  2385
    "
cg@2744
  2386
    ^ widget
cg@2744
  2387
! !
cg@2744
  2388
cg@2744
  2389
!ViewTreeInspectorApplication::ViewTreeItem methodsFor:'accessing layout'!
cg@2744
  2390
cg@2744
  2391
boundsRelativeToRoot
cg@2744
  2392
    "returns the bounds relative to the root widget
cg@2744
  2393
    "
cg@2744
  2394
    ^ self originRelativeToRoot extent:(widget extent)
cg@2744
  2395
!
cg@2744
  2396
cg@2744
  2397
cornerRelativeToRoot
cg@2744
  2398
    "returns the corner relative to the root widget
cg@2744
  2399
    "
cg@2744
  2400
    ^ self originRelativeToRoot + (widget extent)
cg@2744
  2401
!
cg@2744
  2402
cg@2744
  2403
extent
cg@2744
  2404
    "returns the extent of the widget
cg@2744
  2405
    "
cg@2744
  2406
    ^ widget extent
cg@2744
  2407
!
cg@2744
  2408
cg@2744
  2409
layoutType
cg@2744
  2410
    "returns the type of layout assigned to the wiget; nil if the
cg@2744
  2411
     superView cannot resize its sub widgets
cg@2744
  2412
    "
cg@2744
  2413
    |layout specClass superView|
cg@2744
  2414
cg@2744
  2415
    (superView := widget superView) isNil ifTrue:[
cg@2744
  2416
        ^ #Extent
cg@2744
  2417
    ].
cg@2744
  2418
        
cg@2744
  2419
    specClass := superView specClass.
cg@2744
  2420
cg@2744
  2421
    (specClass notNil and:[specClass isLayoutContainer]) ifTrue:[
cg@2744
  2422
        ^ specClass canResizeSubComponents ifTrue:[#Extent] ifFalse:[nil]
cg@2744
  2423
    ].
cg@2744
  2424
cg@2744
  2425
    (layout := widget geometryLayout) isNil ifTrue:[
cg@2744
  2426
        ^ #Extent
cg@2744
  2427
    ].
cg@2744
  2428
cg@2744
  2429
    layout isLayout ifTrue:[
cg@2744
  2430
        layout isLayoutFrame        ifTrue:[ ^ #LayoutFrame ].
cg@2744
  2431
        layout isAlignmentOrigin    ifTrue:[ ^ #AlignmentOrigin ].
cg@2744
  2432
        layout isLayoutOrigin       ifTrue:[ ^ #LayoutOrigin ].
cg@2744
  2433
    ] ifFalse:[
cg@2744
  2434
        layout isRectangle          ifTrue:[ ^ #Rectangle ].
cg@2744
  2435
        layout isPoint              ifTrue:[ ^ #Point ].
cg@2744
  2436
cg@2744
  2437
    ].
cg@2744
  2438
    Transcript showCR:'UNSUPPORTRD LAYOUT: ', layout printString.
cg@2744
  2439
  ^ nil
cg@2744
  2440
!
cg@2744
  2441
cg@2744
  2442
originRelativeToRoot
cg@2744
  2443
    "returns the origin relative to the root widget
cg@2744
  2444
    "
cg@2744
  2445
    ^ widget originRelativeTo:(self rootView)
cg@2744
  2446
! !
cg@2744
  2447
cg@2744
  2448
!ViewTreeInspectorApplication::ViewTreeItem methodsFor:'accessing optimize'!
cg@2744
  2449
cg@2744
  2450
children
cg@2744
  2451
    "redefined: optimize
cg@2744
  2452
    "
cg@2744
  2453
    ^ children
cg@2744
  2454
!
cg@2744
  2455
cg@2744
  2456
hasChildren
cg@2744
  2457
    |subViews list item|
cg@2744
  2458
cg@2744
  2459
    children size ~~ 0 ifTrue:[
cg@2744
  2460
        ^ true
cg@2744
  2461
    ].
cg@2744
  2462
    isExpanded := false.
cg@2744
  2463
    subViews   := widget subViews.
cg@2744
  2464
cg@2744
  2465
    subViews size == 0 ifTrue:[^ false].
cg@2744
  2466
cg@2744
  2467
    list := OrderedCollection new.
cg@2744
  2468
cg@2744
  2469
    subViews do:[:aSubView|
cg@2744
  2470
        item := self class buildViewsFrom:aSubView.
cg@2744
  2471
        item parent:self.
cg@2744
  2472
        list add:item.
cg@2744
  2473
    ].
cg@2744
  2474
    children := list.
cg@2744
  2475
    ^ true
cg@2744
  2476
!
cg@2744
  2477
cg@2744
  2478
size
cg@2744
  2479
    "redefined: returns list of children
cg@2744
  2480
    "
cg@2744
  2481
    ^ children size
cg@2744
  2482
! !
cg@2744
  2483
cg@2744
  2484
!ViewTreeInspectorApplication::ViewTreeItem methodsFor:'displaying'!
cg@2744
  2485
cg@2744
  2486
additionalLabelForItem:anItem
cg@3017
  2487
    "answer an additional label for an Item"
cg@2744
  2488
cg@2744
  2489
    parent notNil ifTrue:[
cg@2744
  2490
        ^ parent additionalLabelForItem:anItem
cg@2744
  2491
    ].
cg@2744
  2492
    ^ nil
cg@2744
  2493
!
cg@2744
  2494
cg@2744
  2495
displayIcon:anIcon atX:x y:y on:aGC
cg@2744
  2496
    |x0 y0 y1 w|
cg@2744
  2497
cg@2744
  2498
    super displayIcon:anIcon atX:x y:y on:aGC.
cg@2744
  2499
cg@2744
  2500
    self exists ifFalse:[
cg@2744
  2501
        aGC paint:(Color red).
cg@2744
  2502
cg@2744
  2503
        y0 := y + 1.
cg@2744
  2504
        y1 := y + anIcon height - 2.
cg@2744
  2505
cg@2744
  2506
        x0 := x - 1.
cg@2744
  2507
        w  := anIcon width.
cg@2744
  2508
cg@2744
  2509
        2 timesRepeat:[
cg@2744
  2510
            aGC displayLineFromX:x0 y:y0 toX:(x0 + w) y:y1.
cg@2744
  2511
            aGC displayLineFromX:x0 y:y1 toX:(x0 + w) y:y0.
cg@2744
  2512
            x0 := x0 + 1.
cg@2744
  2513
        ].
cg@2744
  2514
    ].
cg@2744
  2515
!
cg@2744
  2516
cg@2744
  2517
displayOn:aGC x:x y:y h:h
cg@2744
  2518
    |labelHeight additionalName label isValidAndShown|
cg@2744
  2519
cg@2744
  2520
    label := self label.
cg@2744
  2521
    label isEmptyOrNil ifTrue:[^ self].
cg@2744
  2522
cg@2744
  2523
    widget id isNil ifTrue:[
cg@2744
  2524
        isDrawnShown := false.
cg@2744
  2525
cg@2744
  2526
        self exists ifFalse:[
cg@2744
  2527
            xOffsetAdditionalName := nil.
cg@2744
  2528
        ].
cg@2744
  2529
        isValidAndShown := false.
cg@2744
  2530
    ] ifFalse:[
cg@2744
  2531
        isValidAndShown := widget shown.
cg@2744
  2532
    ].
cg@2744
  2533
    isValidAndShown ifFalse:[
cg@2762
  2534
        label := Text string:label emphasis:#italic.
cg@3141
  2535
        label colorizeAllWith:Color gray.
cg@2744
  2536
    ].
cg@2744
  2537
cg@2744
  2538
    labelHeight := self heightOn:aGC.
cg@2744
  2539
    self displayLabel:label h:labelHeight on:aGC x:x y:y h:h.
cg@2744
  2540
cg@2744
  2541
    xOffsetAdditionalName notNil ifTrue:[
cg@2744
  2542
        additionalName := self additionalLabelForItem:self.
cg@2744
  2543
cg@2744
  2544
        additionalName notNil ifTrue:[
cg@2744
  2545
            self displayLabel:additionalName
cg@2744
  2546
                            h:labelHeight on:aGC
cg@2744
  2547
                            x:(x + xOffsetAdditionalName)
cg@2744
  2548
                            y:y
cg@2744
  2549
                            h:h.
cg@2744
  2550
        ] ifFalse:[
cg@2744
  2551
            xOffsetAdditionalName := nil.
cg@2744
  2552
        ].
cg@2744
  2553
    ].
cg@2744
  2554
!
cg@2744
  2555
cg@2744
  2556
recursiveAdditionalNameBehaviourChanged
cg@2744
  2557
    width := xOffsetAdditionalName := nil.
cg@2744
  2558
cg@2744
  2559
    children notNil ifTrue:[
cg@2744
  2560
        children do:[:each| each recursiveAdditionalNameBehaviourChanged ]
cg@2744
  2561
    ].
cg@2744
  2562
!
cg@2744
  2563
cg@2744
  2564
widthOn:aGC
cg@2744
  2565
    "return the width of the receiver, if it is to be displayed on aGC
cg@2744
  2566
    "
cg@2744
  2567
    |additionalName|
cg@2744
  2568
cg@2744
  2569
    width isNil ifTrue:[
cg@2744
  2570
        width := self widthOf:(self label) on:aGC.
cg@2744
  2571
        width := width + 2.
cg@2744
  2572
cg@2744
  2573
        additionalName := self additionalLabelForItem:self.
cg@2744
  2574
cg@2744
  2575
        additionalName notNil ifTrue:[
cg@2744
  2576
            xOffsetAdditionalName := width + 10.
cg@2744
  2577
            width := xOffsetAdditionalName + (self widthOf:additionalName on:aGC).
cg@2744
  2578
            width := width + 2.
cg@2744
  2579
        ] ifFalse:[
cg@2744
  2580
            xOffsetAdditionalName := nil.
cg@2744
  2581
        ].
cg@2744
  2582
    ].
cg@2744
  2583
    ^ width
cg@2744
  2584
! !
cg@2744
  2585
cg@2744
  2586
!ViewTreeInspectorApplication::ViewTreeItem methodsFor:'enumerating'!
cg@2744
  2587
cg@2744
  2588
handlesDo:aTwoArgAction
cg@2744
  2589
    "evaluate the two arg block on each handle; the arguments to the block is
cg@2744
  2590
     the rectangle relative to the rootView and the handle type which is
cg@2744
  2591
     set to nil if not resizeable.
cg@2744
  2592
cg@2744
  2593
     TYPES:     type    position( X - Y )
cg@2744
  2594
                -------------------------        
cg@2744
  2595
                #LT     Left   - Top
cg@2744
  2596
                #LC     Left   - Center
cg@2744
  2597
                #LB     Left   - Bottom
cg@2744
  2598
                #CT     Center - Top
cg@2744
  2599
                #CB     Center - Bottom
cg@2744
  2600
                #RT     Right  - Top
cg@2744
  2601
                #RC     Right  - Center
cg@2744
  2602
                #RB     Right  - Bottom
cg@2744
  2603
cg@2744
  2604
                nil     ** handle not pickable **
cg@2744
  2605
    "
cg@2744
  2606
    |type relOrg relCrn maxExt rootView w h
cg@2744
  2607
     xL    "{ Class:SmallInteger }"
cg@2744
  2608
     xC    "{ Class:SmallInteger }"
cg@2744
  2609
     xR    "{ Class:SmallInteger }"
cg@2744
  2610
     yT    "{ Class:SmallInteger }"
cg@2744
  2611
     yC    "{ Class:SmallInteger }"
cg@2744
  2612
     yB    "{ Class:SmallInteger }"
cg@2744
  2613
    |
cg@2744
  2614
    rootView := self rootView.
cg@2744
  2615
    relOrg   := widget originRelativeTo:rootView.
cg@2744
  2616
    relOrg isNil ifTrue:[ ^ self ].    "/ widget destroyed
cg@2744
  2617
cg@2744
  2618
    relOrg   := relOrg - (HandleExtent // 2).
cg@2744
  2619
    relCrn   := relOrg + widget extent.
cg@2744
  2620
    maxExt   := rootView extent - HandleExtent.
cg@2744
  2621
cg@2744
  2622
    xL := relOrg x max:0.
cg@2744
  2623
    xR := relCrn x min:(maxExt x).
cg@2744
  2624
    xC := xR + xL // 2.
cg@2744
  2625
cg@2744
  2626
    yT := relOrg y max:0.
cg@2744
  2627
    yB := relCrn y min:(maxExt y).
cg@2744
  2628
    yC := yB + yT // 2.
cg@2744
  2629
cg@2744
  2630
    type := self layoutType.
cg@2744
  2631
    w   := HandleExtent x.
cg@2744
  2632
    h   := HandleExtent y.
cg@2744
  2633
cg@2744
  2634
    (type == #LayoutFrame or:[type == #Rectangle]) ifTrue:[
cg@2744
  2635
        aTwoArgAction value:(Rectangle left:xL top:yT width:w height:h) value:#LT.
cg@2744
  2636
        aTwoArgAction value:(Rectangle left:xL top:yC width:w height:h) value:#LC.
cg@2744
  2637
        aTwoArgAction value:(Rectangle left:xL top:yB width:w height:h) value:#LB.
cg@2744
  2638
        aTwoArgAction value:(Rectangle left:xC top:yT width:w height:h) value:#CT.
cg@2744
  2639
        aTwoArgAction value:(Rectangle left:xC top:yB width:w height:h) value:#CB.
cg@2744
  2640
        aTwoArgAction value:(Rectangle left:xR top:yT width:w height:h) value:#RT.
cg@2744
  2641
        aTwoArgAction value:(Rectangle left:xR top:yC width:w height:h) value:#RC.
cg@2744
  2642
        aTwoArgAction value:(Rectangle left:xR top:yB width:w height:h) value:#RB.
cg@2744
  2643
      ^ self
cg@2744
  2644
    ].
cg@2744
  2645
cg@2744
  2646
    aTwoArgAction value:(Rectangle left:xL top:yT width:w height:h) value:nil.
cg@2744
  2647
    aTwoArgAction value:(Rectangle left:xL top:yB width:w height:h) value:nil.
cg@2744
  2648
    aTwoArgAction value:(Rectangle left:xR top:yT width:w height:h) value:nil.
cg@2744
  2649
cg@2744
  2650
    type == #Extent ifTrue:[
cg@2744
  2651
        aTwoArgAction value:(Rectangle left:xC top:yB width:w height:h) value:#CB.
cg@2744
  2652
        aTwoArgAction value:(Rectangle left:xR top:yC width:w height:h) value:#RC.
cg@2744
  2653
        aTwoArgAction value:(Rectangle left:xR top:yB width:w height:h) value:#RB.
cg@2744
  2654
      ^ self
cg@2744
  2655
    ].
cg@2744
  2656
    aTwoArgAction value:(Rectangle left:xR top:yB width:w height:h) value:nil.
cg@2744
  2657
!
cg@2744
  2658
cg@2744
  2659
recursiveEachVisibleItemDo:anOneArgBlock
cg@2744
  2660
    "recursive evaluate the block on each child which is visible
cg@2744
  2661
    "
cg@2744
  2662
    (isExpanded and:[children size > 0]) ifTrue:[
cg@2744
  2663
        children do:[:aChild|
cg@2744
  2664
            anOneArgBlock value:aChild.
cg@2744
  2665
            aChild recursiveEachVisibleItemDo:anOneArgBlock.
cg@2744
  2666
        ]
cg@2744
  2667
    ].
cg@2744
  2668
!
cg@2744
  2669
cg@2744
  2670
subViewsDo:aOneArgBlock
cg@2744
  2671
    "evaluate aBlock for all subviews other than InputView's   
cg@2744
  2672
    "
cg@2744
  2673
    |subViews|
cg@2744
  2674
cg@2744
  2675
    subViews := widget subViews.
cg@2744
  2676
cg@2744
  2677
    subViews notNil ifTrue:[
cg@2744
  2678
        subViews do:aOneArgBlock
cg@2744
  2679
    ].
cg@2744
  2680
! !
cg@2744
  2681
cg@2744
  2682
!ViewTreeInspectorApplication::ViewTreeItem methodsFor:'initialization'!
cg@2744
  2683
cg@2744
  2684
forView:aView
cg@2744
  2685
    widget := aView.
cg@2744
  2686
!
cg@2744
  2687
cg@2744
  2688
initialize
cg@2744
  2689
    "setup default attributes
cg@2744
  2690
    "
cg@2744
  2691
    super initialize.
cg@2744
  2692
    isDrawnShown := false.
cg@2744
  2693
    isExpanded   := false.
cg@2744
  2694
    children     := OrderedCollection new.
cg@2744
  2695
! !
cg@2744
  2696
cg@2744
  2697
!ViewTreeInspectorApplication::ViewTreeItem methodsFor:'operations delete'!
cg@2744
  2698
cg@2744
  2699
delete
cg@2744
  2700
    "delete self and all contained items; the assigned views are destroyed
cg@2744
  2701
     in case of rootView, only the children are deleted
cg@2744
  2702
    "
cg@2744
  2703
    parent isHierarchicalItem ifTrue:[
cg@2744
  2704
        self criticalDo:[
cg@2744
  2705
            parent remove:self.
cg@2744
  2706
            widget destroy.
cg@2744
  2707
        ]
cg@2744
  2708
    ] ifFalse:[
cg@2744
  2709
        self deleteAll
cg@2744
  2710
    ].
cg@2744
  2711
!
cg@2744
  2712
cg@2744
  2713
deleteAll
cg@2744
  2714
    "delete all contained items; the assigned views are destroyed
cg@2744
  2715
    "
cg@2744
  2716
    children size == 0 ifTrue:[^ self].
cg@2744
  2717
cg@2744
  2718
    self criticalDo:[
cg@2744
  2719
        self nonCriticalDo:[:el| el widget destroy ].
cg@2744
  2720
        self removeAll
cg@2744
  2721
    ].
cg@2744
  2722
! !
cg@2744
  2723
cg@2744
  2724
!ViewTreeInspectorApplication::ViewTreeItem methodsFor:'operations layout'!
cg@2744
  2725
cg@2744
  2726
asLayoutFrame
cg@2744
  2727
    "convert the layout of the widget to a LayoutFrame;
cg@2744
  2728
    "
cg@2744
  2729
    |extent layout newLyt lftFrc lftOff topFrc topOff|
cg@2744
  2730
cg@2744
  2731
    layout := widget geometryLayout.
cg@2744
  2732
cg@2744
  2733
    layout isNil ifTrue:[
cg@2744
  2734
        ^ widget bounds asLayout
cg@2744
  2735
    ].
cg@2744
  2736
cg@2744
  2737
    layout isLayout ifFalse:[
cg@2744
  2738
        layout isRectangle ifTrue:[
cg@2744
  2739
            ^ LayoutFrame leftOffset:(layout left) rightOffset:(layout right)
cg@2744
  2740
                           topOffset:(layout top) bottomOffset:(layout bottom)
cg@2744
  2741
        ].
cg@2744
  2742
        layout isPoint ifTrue:[
cg@2744
  2743
            extent := widget extent.
cg@2744
  2744
          ^ LayoutFrame leftOffset:(layout x)  rightOffset:(layout x + extent x)
cg@2744
  2745
                         topOffset:(layout y) bottomOffset:(layout y + extent y)
cg@2744
  2746
        ].
cg@2744
  2747
cg@2744
  2748
        Transcript showCR:'UNSUPPORTRD LAYOUT: ', layout printString.
cg@2744
  2749
      ^ nil
cg@2744
  2750
    ].
cg@2744
  2751
cg@2744
  2752
    layout isLayoutFrame ifTrue:[ ^ layout copy ].    
cg@2744