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