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