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