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