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