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