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