Tools__ViewTreeApplication.st
changeset 3524 366f04fbfb23
parent 3500 51cbdcf5b2cb
child 3525 5df4da794cd2
equal deleted inserted replaced
3523:25fa267c550a 3524:366f04fbfb23
     1 "
     1 "
     2  COPYRIGHT (c) 2007 by eXept Software AG
     2  COPYRIGHT (c) 2007 by eXept Software AG
     3               All Rights Reserved
     3 	      All Rights Reserved
     4 
     4 
     5  This software is furnished under a license and may be used
     5  This software is furnished under a license and may be used
     6  only in accordance with the terms of that license and with the
     6  only in accordance with the terms of that license and with the
     7  inclusion of the above copyright notice.   This software may not
     7  inclusion of the above copyright notice.   This software may not
     8  be provided or otherwise made available to, or used by, any
     8  be provided or otherwise made available to, or used by, any
    57 !ViewTreeInspectorApplication class methodsFor:'documentation'!
    57 !ViewTreeInspectorApplication class methodsFor:'documentation'!
    58 
    58 
    59 copyright
    59 copyright
    60 "
    60 "
    61  COPYRIGHT (c) 2007 by eXept Software AG
    61  COPYRIGHT (c) 2007 by eXept Software AG
    62               All Rights Reserved
    62 	      All Rights Reserved
    63 
    63 
    64  This software is furnished under a license and may be used
    64  This software is furnished under a license and may be used
    65  only in accordance with the terms of that license and with the
    65  only in accordance with the terms of that license and with the
    66  inclusion of the above copyright notice.   This software may not
    66  inclusion of the above copyright notice.   This software may not
    67  be provided or otherwise made available to, or used by, any
    67  be provided or otherwise made available to, or used by, any
    79      Useful to have a look at subcomponents - to see how views
    79      Useful to have a look at subcomponents - to see how views
    80      are structured.
    80      are structured.
    81 
    81 
    82 
    82 
    83     [Instance variables:]
    83     [Instance variables:]
    84         model           <ViewTreeModel>      the used ViewTreeModel
    84 	model           <ViewTreeModel>      the used ViewTreeModel
    85         clickedItem     <ViewTreeItem>       item under the clickedPoint (motion action)
    85 	clickedItem     <ViewTreeItem>       item under the clickedPoint (motion action)
    86         clickedPoint    <Point>              point where the motion action started from.
    86 	clickedPoint    <Point>              point where the motion action started from.
    87         motionAction    <Action>             (oneArg-) action called durring buttonMotion.
    87 	motionAction    <Action>             (oneArg-) action called durring buttonMotion.
    88 
    88 
    89 
    89 
    90     [author:]
    90     [author:]
    91         Claus Atzkern
    91 	Claus Atzkern
    92 
    92 
    93     [see also:]
    93     [see also:]
    94         ViewTreeModel
    94 	ViewTreeModel
    95         ViewTreeItem
    95 	ViewTreeItem
    96 "
    96 "
    97 ! !
    97 ! !
    98 
    98 
    99 !ViewTreeInspectorApplication class methodsFor:'initialization'!
    99 !ViewTreeInspectorApplication class methodsFor:'initialization'!
   100 
   100 
   113     "/ cg - disabled. the icon is too ugly.
   113     "/ cg - disabled. the icon is too ugly.
   114     ^ self.
   114     ^ self.
   115 
   115 
   116 "/    icon := ToolbarIconLibrary inspectLocals20x20Icon magnifiedTo:28@28.
   116 "/    icon := ToolbarIconLibrary inspectLocals20x20Icon magnifiedTo:28@28.
   117 "/
   117 "/
   118 "/    menuItem := MenuItem new 
   118 "/    menuItem := MenuItem new
   119 "/                    label: 'View Tree Inspector';
   119 "/                    label: 'View Tree Inspector';
   120 "/                    value: [ ViewTreeInspectorApplication open];
   120 "/                    value: [ ViewTreeInspectorApplication open];
   121 "/                    isButton: true;
   121 "/                    isButton: true;
   122 "/                    icon: icon;
   122 "/                    icon: icon;
   123 "/                    nameKey: #viewInspect.
   123 "/                    nameKey: #viewInspect.
   162     super unload.
   162     super unload.
   163 ! !
   163 ! !
   164 
   164 
   165 !ViewTreeInspectorApplication class methodsFor:'help specs'!
   165 !ViewTreeInspectorApplication class methodsFor:'help specs'!
   166 
   166 
   167 flyByHelpSpec
   167 helpSpec
   168     <resource: #help>
   168     <resource: #help>
   169 
   169 
   170     ^super flyByHelpSpec addPairsFrom:#(
   170     ^super helpSpec addPairsFrom:#(
   171 
   171 
   172 #doRedraw
   172 #doRedraw
   173 'Force the application to redraw its windows'
   173 'Force the application to redraw its windows'
   174 
   174 
   175 #doUncatchEvents
   175 #doUncatchEvents
   176 'Release picked view and uncatch events\(currently locked for widget selection)'  
   176 'Release picked view and uncatch events\(currently locked for widget selection)'
   177 
   177 
   178 #doCatchEvents
   178 #doCatchEvents
   179 'Lock view and catch events for widget selection\(currently unlocked)'  
   179 'Lock view and catch events for widget selection\(currently unlocked)'
   180 
   180 
   181 #doInspectApplication
   181 #doInspectApplication
   182 'Inspect the selected view''s application'  
   182 'Inspect the selected view''s application'
   183 
   183 
   184 #doBrowseApplication
   184 #doBrowseApplication
   185 'Browse the selected view''s application'  
   185 'Browse the selected view''s application'
   186 
   186 
   187 #doPickView
   187 #doPickView
   188 'Pick a widget with the mouse and inspect its view hierarchy'  
   188 'Pick a widget with the mouse and inspect its view hierarchy'
   189 
   189 
   190 )
   190 )
   191 ! !
   191 ! !
   192 
   192 
   193 !ViewTreeInspectorApplication class methodsFor:'image specs'!
   193 !ViewTreeInspectorApplication class methodsFor:'image specs'!
   210     "
   210     "
   211 
   211 
   212     <resource: #image>
   212     <resource: #image>
   213 
   213 
   214     ^Icon
   214     ^Icon
   215         constantNamed:'Tools::ViewTreeInspectorApplication lockViewIcon'
   215 	constantNamed:'Tools::ViewTreeInspectorApplication lockViewIcon'
   216         ifAbsentPut:[(Depth8Image new) width: 24; height: 24; photometric:(#palette); bitsPerSample:(#[8]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
   216 	ifAbsentPut:[(Depth8Image new) width: 24; height: 24; photometric:(#palette); bitsPerSample:(#[8]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
   217 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
   217 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
   218 @@@@@@@@@@@@@@A8^G!!7O3ACP5*P@@A8^G @@@@@@@@@@@A8^@@@OE0/!!P0S#0@@^G @@@@@@@@@@@B (@D''D#48"1.CX5H@(J@@@@@@@@@@@@B (B(>SAT"
   218 @@@@@@@@@@@@@@A8^G!!7O3ACP5*P@@A8^G @@@@@@@@@@@A8^@@@OE0/!!P0S#0@@^G @@@@@@@@@@@B (@D''D#48"1.CX5H@(J@@@@@@@@@@@@B (B(>SAT"
   219 ''%!!/P7,@(J@@@@@@@@@@@@@%IB0#M"H%IRTQV5P@IRT@@@@@@@@@@@ANSX:U]PANS$8:T80@S$8@@@@@@@@@@@AN&UYWK(EYQ@\FUPQHXT8@@@@@@@@@@@AN
   219 ''%!!/P7,@(J@@@@@@@@@@@@@%IB0#M"H%IRTQV5P@IRT@@@@@@@@@@@ANSX:U]PANS$8:T80@S$8@@@@@@@@@@@AN&UYWK(EYQ@\FUPQHXT8@@@@@@@@@@@AN
   220 HC2!!TVY:Y#-%I*IKMD8@@@@@@@@@@@A$\@83XBEG%).GGX _!!&P@@@@@@@@@@@AO[P5+ &(WPYN@["!!E\$<@@@@@@@@@@@B_F''FQPAXX_!!&TGH4HB9<@@@@@
   220 HC2!!TVY:Y#-%I*IKMD8@@@@@@@@@@@A$\@83XBEG%).GGX _!!&P@@@@@@@@@@@AO[P5+ &(WPYN@["!!E\$<@@@@@@@@@@@B_F''FQPAXX_!!&TGH4HB9<@@@@@
   221 @@@@@@B_%3HCJ7=BKPU,Q)01B9<@@@@@@@@@@@@PBP8T_F!!''JPI)_Y"D&!!@@@@@@@@@@@@@$B)I9TGXO''WQIWQ93W0@@@@@@@@@@@@@$"U=JR$)JR$)JR$)_
   221 @@@@@@B_%3HCJ7=BKPU,Q)01B9<@@@@@@@@@@@@PBP8T_F!!''JPI)_Y"D&!!@@@@@@@@@@@@@$B)I9TGXO''WQIWQ93W0@@@@@@@@@@@@@$"U=JR$)JR$)JR$)_
   236      Icon flushCachedIcons
   236      Icon flushCachedIcons
   237     "
   237     "
   238     <resource: #image>
   238     <resource: #image>
   239 
   239 
   240     ^Icon
   240     ^Icon
   241         constantNamed:'Tools::ViewTreeInspectorApplication releaseViewIcon'
   241 	constantNamed:'Tools::ViewTreeInspectorApplication releaseViewIcon'
   242         ifAbsentPut:[(Depth8Image new) width: 24; height: 24; photometric:(#palette); bitsPerSample:(#[8]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
   242 	ifAbsentPut:[(Depth8Image new) width: 24; height: 24; photometric:(#palette); bitsPerSample:(#[8]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
   243 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
   243 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
   244 @@@@@@@@@@@@@@A8^G!!7O3ACP5*P@@A8^G @@@@@@@@@@@A8^@@@OE0/!!P0S#0@@^G @@@@@@@@@@@B (@@''D#48"1.CX5H@(J@@@@@@@@@@@@B (@@@@@@"
   244 @@@@@@@@@@@@@@A8^G!!7O3ACP5*P@@A8^G @@@@@@@@@@@A8^@@@OE0/!!P0S#0@@^G @@@@@@@@@@@B (@@''D#48"1.CX5H@(J@@@@@@@@@@@@B (@@@@@@"
   245 ''%!!/P7,@(J@@@@@@@@@@@@@%I@@@@BH%IRTQV5P@IRT@@@@@@@@@@@ANSP@@@@ANS$8:T80@S$8@@@@@@@@@@@AN&UYWK(EYQ@\FUPQHXT8@@@@@@@@@@@AN
   245 ''%!!/P7,@(J@@@@@@@@@@@@@%I@@@@BH%IRTQV5P@IRT@@@@@@@@@@@ANSP@@@@ANS$8:T80@S$8@@@@@@@@@@@AN&UYWK(EYQ@\FUPQHXT8@@@@@@@@@@@AN
   246 HC2!!TVY:Y#-%I*IKMD8@@@@@@@@@@@A$\@83XBEG%).GGX _!!&P@@@@@@@@@@@AO[P5+ &(WPYN@["!!E\$<@@@@@@@@@@@B_F''FQPAXX_!!&TGH4HB9<@@@@@
   246 HC2!!TVY:Y#-%I*IKMD8@@@@@@@@@@@A$\@83XBEG%).GGX _!!&P@@@@@@@@@@@AO[P5+ &(WPYN@["!!E\$<@@@@@@@@@@@B_F''FQPAXX_!!&TGH4HB9<@@@@@
   247 @@@@@@B_%3HCJ7=BKPU,Q)01B9<@@@@@@@@@@@@PBP8T_F!!''JPI)_Y"D&!!@@@@@@@@@@@@@$B)I9TGXO''WQIWQ93W0@@@@@@@@@@@@@$"U=JR$)JR$)JR$)_
   247 @@@@@@B_%3HCJ7=BKPU,Q)01B9<@@@@@@@@@@@@PBP8T_F!!''JPI)_Y"D&!!@@@@@@@@@@@@@$B)I9TGXO''WQIWQ93W0@@@@@@@@@@@@@$"U=JR$)JR$)JR$)_
   264      Tools::ViewTreeInspectorApplication open
   264      Tools::ViewTreeInspectorApplication open
   265     "
   265     "
   266 
   266 
   267     <resource: #canvas>
   267     <resource: #canvas>
   268 
   268 
   269     ^ 
   269     ^
   270     #(FullSpec
   270     #(FullSpec
   271        name: windowSpec
   271        name: windowSpec
   272        window: 
   272        window:
   273       (WindowSpec
   273       (WindowSpec
   274          label: 'View Tree Inspector'
   274 	 label: 'View Tree Inspector'
   275          name: 'View Tree Inspector'
   275 	 name: 'View Tree Inspector'
   276          min: (Point 10 10)
   276 	 min: (Point 10 10)
   277          max: (Point 1024 9999)
   277 	 max: (Point 1024 9999)
   278          bounds: (Rectangle 0 0 693 643)
   278 	 bounds: (Rectangle 0 0 693 643)
   279          menu: menu
   279 	 menu: menu
   280        )
   280        )
   281        component: 
   281        component:
   282       (SpecCollection
   282       (SpecCollection
   283          collection: (
   283 	 collection: (
   284           (MenuPanelSpec
   284 	  (MenuPanelSpec
   285              name: 'toolbarMenu'
   285 	     name: 'toolbarMenu'
   286              layout: (LayoutFrame 0 0.0 0 0 0 1.0 40 0)
   286 	     layout: (LayoutFrame 0 0.0 0 0 0 1.0 40 0)
   287              menu: toolbarMenu
   287 	     menu: toolbarMenu
   288              textDefault: true
   288 	     textDefault: true
   289            )
   289 	   )
   290           (VariableVerticalPanelSpec
   290 	  (VariableVerticalPanelSpec
   291              name: 'VariableVerticalPanel1'
   291 	     name: 'VariableVerticalPanel1'
   292              layout: (LayoutFrame 0 0.0 40 0.0 0 1.0 0 1.0)
   292 	     layout: (LayoutFrame 0 0.0 40 0.0 0 1.0 0 1.0)
   293              component: 
   293 	     component:
   294             (SpecCollection
   294 	    (SpecCollection
   295                collection: (
   295 	       collection: (
   296                 (ViewSpec
   296 		(ViewSpec
   297                    name: 'PathAndListPane'
   297 		   name: 'PathAndListPane'
   298                    component: 
   298 		   component:
   299                   (SpecCollection
   299 		  (SpecCollection
   300                      collection: (
   300 		     collection: (
   301                       (ViewSpec
   301 		      (ViewSpec
   302                          name: 'PathPane'
   302 			 name: 'PathPane'
   303                          layout: (LayoutFrame 0 0 0 0 0 1 25 0)
   303 			 layout: (LayoutFrame 0 0 0 0 0 1 25 0)
   304                          component: 
   304 			 component:
   305                         (SpecCollection
   305 			(SpecCollection
   306                            collection: (
   306 			   collection: (
   307                             (InputFieldSpec
   307 			    (InputFieldSpec
   308                                name: 'Path'
   308 			       name: 'Path'
   309                                layout: (LayoutFrame 0 0 0 0 0 1 0 1)
   309 			       layout: (LayoutFrame 0 0 0 0 0 1 0 1)
   310                                model: path
   310 			       model: path
   311                                acceptOnReturn: true
   311 			       acceptOnReturn: true
   312                                acceptOnTab: true
   312 			       acceptOnTab: true
   313                                acceptOnPointerLeave: true
   313 			       acceptOnPointerLeave: true
   314                                emptyFieldReplacementText: 'No View Selected'
   314 			       emptyFieldReplacementText: 'No View Selected'
   315                              )
   315 			     )
   316                             )
   316 			    )
   317                           
   317 
   318                          )
   318 			 )
   319                        )
   319 		       )
   320                       (HierarchicalListViewSpec
   320 		      (HierarchicalListViewSpec
   321                          name: 'List'
   321 			 name: 'List'
   322                          layout: (LayoutFrame 0 0 25 0 0 1 0 1)
   322 			 layout: (LayoutFrame 0 0 25 0 0 1 0 1)
   323                          level: 1
   323 			 level: 1
   324                          model: model
   324 			 model: model
   325                          menu: middleButtonMenu
   325 			 menu: middleButtonMenu
   326                          hasHorizontalScrollBar: true
   326 			 hasHorizontalScrollBar: true
   327                          hasVerticalScrollBar: true
   327 			 hasVerticalScrollBar: true
   328                          miniScrollerHorizontal: true
   328 			 miniScrollerHorizontal: true
   329                          miniScrollerVertical: false
   329 			 miniScrollerVertical: false
   330                          listModel: listOfItems
   330 			 listModel: listOfItems
   331                          multipleSelectOk: true
   331 			 multipleSelectOk: true
   332                          useIndex: false
   332 			 useIndex: false
   333                          highlightMode: label
   333 			 highlightMode: label
   334                          showLeftIndicators: false
   334 			 showLeftIndicators: false
   335                          indicatorSelector: indicatorClicked:
   335 			 indicatorSelector: indicatorClicked:
   336                          useDefaultIcons: false
   336 			 useDefaultIcons: false
   337                          postBuildCallback: postBuildTree:
   337 			 postBuildCallback: postBuildTree:
   338                        )
   338 		       )
   339                       )
   339 		      )
   340                     
   340 
   341                    )
   341 		   )
   342                  )
   342 		 )
   343                 (ViewSpec
   343 		(ViewSpec
   344                    name: 'Box2'
   344 		   name: 'Box2'
   345                    component: 
   345 		   component:
   346                   (SpecCollection
   346 		  (SpecCollection
   347                      collection: (
   347 		     collection: (
   348                       (TabViewSpec
   348 		      (TabViewSpec
   349                          name: 'TabHeader1'
   349 			 name: 'TabHeader1'
   350                          layout: (LayoutFrame 0 0.0 0 0 0 1.0 25 0)
   350 			 layout: (LayoutFrame 0 0.0 0 0 0 1.0 25 0)
   351                          model: inspectorModeIndexHolder
   351 			 model: inspectorModeIndexHolder
   352                          menu: inspectorModes
   352 			 menu: inspectorModes
   353                          useIndex: true
   353 			 useIndex: true
   354                          translateLabel: true
   354 			 translateLabel: true
   355                        )
   355 		       )
   356                       (SubCanvasSpec
   356 		      (SubCanvasSpec
   357                          name: 'Browser'
   357 			 name: 'Browser'
   358                          layout: (LayoutFrame 0 0 26 0 0 1 0 1)
   358 			 layout: (LayoutFrame 0 0 26 0 0 1 0 1)
   359                          visibilityChannel: browserVisibleHolder
   359 			 visibilityChannel: browserVisibleHolder
   360                          hasHorizontalScrollBar: true
   360 			 hasHorizontalScrollBar: true
   361                          hasVerticalScrollBar: true
   361 			 hasVerticalScrollBar: true
   362                          majorKey: #'Tools::NewSystemBrowser'
   362 			 majorKey: #'Tools::NewSystemBrowser'
   363                          minorKey: singleClassWithoutVariableListBrowserSpec
   363 			 minorKey: singleClassWithoutVariableListBrowserSpec
   364                          createNewApplication: true
   364 			 createNewApplication: true
   365                          createNewBuilder: true
   365 			 createNewBuilder: true
   366                          postBuildCallback: postBuildBrowserCanvas:
   366 			 postBuildCallback: postBuildBrowserCanvas:
   367                        )
   367 		       )
   368                       (ViewSpec
   368 		      (ViewSpec
   369                          name: 'Inspector'
   369 			 name: 'Inspector'
   370                          layout: (LayoutFrame 0 0 26 0 0 1 0 1)
   370 			 layout: (LayoutFrame 0 0 26 0 0 1 0 1)
   371                          visibilityChannel: inspectorVisibleHolder
   371 			 visibilityChannel: inspectorVisibleHolder
   372                          postBuildCallback: postBuildInspectorView:
   372 			 postBuildCallback: postBuildInspectorView:
   373                          viewClassName: 'InspectorView'
   373 			 viewClassName: 'InspectorView'
   374                        )
   374 		       )
   375                       )
   375 		      )
   376                     
   376 
   377                    )
   377 		   )
   378                  )
   378 		 )
   379                 )
   379 		)
   380               
   380 
   381              )
   381 	     )
   382              handles: (Any 0.5 1.0)
   382 	     handles: (Any 0.5 1.0)
   383            )
   383 	   )
   384           )
   384 	  )
   385         
   385 
   386        )
   386        )
   387      )
   387      )
   388 ! !
   388 ! !
   389 
   389 
   390 !ViewTreeInspectorApplication class methodsFor:'menu specs'!
   390 !ViewTreeInspectorApplication class methodsFor:'menu specs'!
   392 menu
   392 menu
   393     "This resource specification was automatically generated
   393     "This resource specification was automatically generated
   394      by the MenuEditor of ST/X."
   394      by the MenuEditor of ST/X."
   395 
   395 
   396     "Do not manually edit this!! If it is corrupted,
   396     "Do not manually edit this!! If it is corrupted,
   397      the MenuEditor may not be able to read the specification."      
   397      the MenuEditor may not be able to read the specification."
   398 
   398 
   399 
   399 
   400     "
   400     "
   401      MenuEditor new openOnClass:Tools::ViewTreeInspectorApplication andSelector:#menu
   401      MenuEditor new openOnClass:Tools::ViewTreeInspectorApplication andSelector:#menu
   402      (Menu new fromLiteralArrayEncoding:(Tools::ViewTreeInspectorApplication menu)) startUp
   402      (Menu new fromLiteralArrayEncoding:(Tools::ViewTreeInspectorApplication menu)) startUp
   403     "
   403     "
   404 
   404 
   405     <resource: #menu>
   405     <resource: #menu>
   406 
   406 
   407     ^ 
   407     ^
   408      #(Menu
   408      #(Menu
   409         (
   409 	(
   410          (MenuItem
   410 	 (MenuItem
   411             label: 'File'
   411 	    label: 'File'
   412             submenu: 
   412 	    submenu:
   413            (Menu
   413 	   (Menu
   414               (
   414 	      (
   415                (MenuItem
   415 	       (MenuItem
   416                   label: 'Pick a View'
   416 		  label: 'Pick a View'
   417                   itemValue: doPickView
   417 		  itemValue: doPickView
   418                 )
   418 		)
   419                (MenuItem
   419 	       (MenuItem
   420                   enabled: hasTargetWidgetChannel
   420 		  enabled: hasTargetWidgetChannel
   421                   label: 'Release Picked View'
   421 		  label: 'Release Picked View'
   422                   itemValue: doUnpick
   422 		  itemValue: doUnpick
   423                 )
   423 		)
   424                (MenuItem
   424 	       (MenuItem
   425                   label: '-'
   425 		  label: '-'
   426                 )
   426 		)
   427                (MenuItem
   427 	       (MenuItem
   428                   label: 'Settings'
   428 		  label: 'Settings'
   429                   submenu: 
   429 		  submenu:
   430                  (Menu
   430 		 (Menu
   431                     (
   431 		    (
   432                      (MenuItem
   432 		     (MenuItem
   433                         label: 'Test Mode'
   433 			label: 'Test Mode'
   434                         hideMenuOnActivated: false
   434 			hideMenuOnActivated: false
   435                         indication: testModeChannel
   435 			indication: testModeChannel
   436                       )
   436 		      )
   437                      (MenuItem
   437 		     (MenuItem
   438                         enabled: testModeChannel
   438 			enabled: testModeChannel
   439                         label: 'Follow Focus'
   439 			label: 'Follow Focus'
   440                         hideMenuOnActivated: false
   440 			hideMenuOnActivated: false
   441                         indication: followFocusChannel
   441 			indication: followFocusChannel
   442                       )
   442 		      )
   443                      (MenuItem
   443 		     (MenuItem
   444                         label: '-'
   444 			label: '-'
   445                       )
   445 		      )
   446                      (MenuItem
   446 		     (MenuItem
   447                         label: 'Select on Click'
   447 			label: 'Select on Click'
   448                         hideMenuOnActivated: false
   448 			hideMenuOnActivated: false
   449                         indication: selectOnClickHolder
   449 			indication: selectOnClickHolder
   450                       )
   450 		      )
   451                      (MenuItem
   451 		     (MenuItem
   452                         label: '-'
   452 			label: '-'
   453                       )
   453 		      )
   454                      (MenuItem
   454 		     (MenuItem
   455                         label: 'Show Name of Widgets'
   455 			label: 'Show Name of Widgets'
   456                         hideMenuOnActivated: false
   456 			hideMenuOnActivated: false
   457                         indication: showNamesHolder
   457 			indication: showNamesHolder
   458                       )
   458 		      )
   459                      )
   459 		     )
   460                     nil
   460 		    nil
   461                     nil
   461 		    nil
   462                   )
   462 		  )
   463                 )
   463 		)
   464                (MenuItem
   464 	       (MenuItem
   465                   label: '-'
   465 		  label: '-'
   466                 )
   466 		)
   467                (MenuItem
   467 	       (MenuItem
   468                   label: 'Exit'
   468 		  label: 'Exit'
   469                   itemValue: closeRequest
   469 		  itemValue: closeRequest
   470                 )
   470 		)
   471                )
   471 	       )
   472               nil
   472 	      nil
   473               nil
   473 	      nil
   474             )
   474 	    )
   475           )
   475 	  )
   476          (MenuItem
   476 	 (MenuItem
   477             enabled: hasSingleSelectionHolder
   477 	    enabled: hasSingleSelectionHolder
   478             label: 'Selection'
   478 	    label: 'Selection'
   479             submenuChannel: middleButtonMenu
   479 	    submenuChannel: middleButtonMenu
   480           )
   480 	  )
   481          (MenuItem
   481 	 (MenuItem
   482             label: 'Widget'
   482 	    label: 'Widget'
   483             submenu: 
   483 	    submenu:
   484            (Menu
   484 	   (Menu
   485               (
   485 	      (
   486                (MenuItem
   486 	       (MenuItem
   487                   enabled: hasSingleSelectionHolder
   487 		  enabled: hasSingleSelectionHolder
   488                   label: 'Browse'
   488 		  label: 'Browse'
   489                   itemValue: doBrowse:
   489 		  itemValue: doBrowse:
   490                   argument: view
   490 		  argument: view
   491                 )
   491 		)
   492                (MenuItem
   492 	       (MenuItem
   493                   enabled: hasSingleSelectionHolder
   493 		  enabled: hasSingleSelectionHolder
   494                   label: 'Inspect'
   494 		  label: 'Inspect'
   495                   itemValue: doInspect:
   495 		  itemValue: doInspect:
   496                   argument: view
   496 		  argument: view
   497                 )
   497 		)
   498                (MenuItem
   498 	       (MenuItem
   499                   label: '-'
   499 		  label: '-'
   500                 )
   500 		)
   501                (MenuItem
   501 	       (MenuItem
   502                   enabled: hasTargetWidgetChannel
   502 		  enabled: hasTargetWidgetChannel
   503                   label: 'All Components'
   503 		  label: 'All Components'
   504                   startGroup: right
   504 		  startGroup: right
   505                   submenuChannel: submenuComponents:
   505 		  submenuChannel: submenuComponents:
   506                 )
   506 		)
   507                )
   507 	       )
   508               nil
   508 	      nil
   509               nil
   509 	      nil
   510             )
   510 	    )
   511           )
   511 	  )
   512          (MenuItem
   512 	 (MenuItem
   513             label: 'Application'
   513 	    label: 'Application'
   514             submenu: 
   514 	    submenu:
   515            (Menu
   515 	   (Menu
   516               (
   516 	      (
   517                (MenuItem
   517 	       (MenuItem
   518                   label: 'Redraw'
   518 		  label: 'Redraw'
   519                   itemValue: doRedraw
   519 		  itemValue: doRedraw
   520                 )
   520 		)
   521                (MenuItem
   521 	       (MenuItem
   522                   label: '-'
   522 		  label: '-'
   523                 )
   523 		)
   524                (MenuItem
   524 	       (MenuItem
   525                   enabled: hasSingleSelectionHolder
   525 		  enabled: hasSingleSelectionHolder
   526                   label: 'Browse'
   526 		  label: 'Browse'
   527                   itemValue: doBrowse:
   527 		  itemValue: doBrowse:
   528                   argument: application
   528 		  argument: application
   529                 )
   529 		)
   530                (MenuItem
   530 	       (MenuItem
   531                   enabled: hasSingleSelectionHolder
   531 		  enabled: hasSingleSelectionHolder
   532                   label: 'Inspect'
   532 		  label: 'Inspect'
   533                   itemValue: doInspect:
   533 		  itemValue: doInspect:
   534                   argument: application
   534 		  argument: application
   535                 )
   535 		)
   536                (MenuItem
   536 	       (MenuItem
   537                   label: '-'
   537 		  label: '-'
   538                 )
   538 		)
   539                (MenuItem
   539 	       (MenuItem
   540                   enabled: canBrowseWindowSpecMethod
   540 		  enabled: canBrowseWindowSpecMethod
   541                   label: 'Browse Window Spec Method'
   541 		  label: 'Browse Window Spec Method'
   542                   itemValue: doBrowseWindowSpecMethod
   542 		  itemValue: doBrowseWindowSpecMethod
   543                 )
   543 		)
   544                (MenuItem
   544 	       (MenuItem
   545                   enabled: canEditWindowSpec
   545 		  enabled: canEditWindowSpec
   546                   label: 'Edit Window Spec'
   546 		  label: 'Edit Window Spec'
   547                   itemValue: doEditWindowSpec
   547 		  itemValue: doEditWindowSpec
   548                 )
   548 		)
   549                (MenuItem
   549 	       (MenuItem
   550                   label: '-'
   550 		  label: '-'
   551                 )
   551 		)
   552                (MenuItem
   552 	       (MenuItem
   553                   enabled: hasTargetWidgetChannel
   553 		  enabled: hasTargetWidgetChannel
   554                   label: 'All Applications'
   554 		  label: 'All Applications'
   555                   submenuChannel: submenuApplications:
   555 		  submenuChannel: submenuApplications:
   556                 )
   556 		)
   557                )
   557 	       )
   558               nil
   558 	      nil
   559               nil
   559 	      nil
   560             )
   560 	    )
   561           )
   561 	  )
   562          (MenuItem
   562 	 (MenuItem
   563             label: 'Process'
   563 	    label: 'Process'
   564             submenu: 
   564 	    submenu:
   565            (Menu
   565 	   (Menu
   566               (
   566 	      (
   567                (MenuItem
   567 	       (MenuItem
   568                   enabled: hasSingleSelectionHolder
   568 		  enabled: hasSingleSelectionHolder
   569                   label: 'Debug'
   569 		  label: 'Debug'
   570                   itemValue: doDebugProcess
   570 		  itemValue: doDebugProcess
   571                 )
   571 		)
   572                (MenuItem
   572 	       (MenuItem
   573                   enabled: hasSingleSelectionHolder
   573 		  enabled: hasSingleSelectionHolder
   574                   label: 'Inspect'
   574 		  label: 'Inspect'
   575                   itemValue: doInspect:
   575 		  itemValue: doInspect:
   576                   argument: process
   576 		  argument: process
   577                 )
   577 		)
   578                (MenuItem
   578 	       (MenuItem
   579                   label: '-'
   579 		  label: '-'
   580                 )
   580 		)
   581                (MenuItem
   581 	       (MenuItem
   582                   label: 'Open Process Monitor'
   582 		  label: 'Open Process Monitor'
   583                   itemValue: doOpenProcessMonitor
   583 		  itemValue: doOpenProcessMonitor
   584                 )
   584 		)
   585                )
   585 	       )
   586               nil
   586 	      nil
   587               nil
   587 	      nil
   588             )
   588 	    )
   589           )
   589 	  )
   590          (MenuItem
   590 	 (MenuItem
   591             label: 'Help'
   591 	    label: 'Help'
   592             startGroup: conditionalRight
   592 	    startGroup: conditionalRight
   593             submenu: 
   593 	    submenu:
   594            (Menu
   594 	   (Menu
   595               (
   595 	      (
   596                (MenuItem
   596 	       (MenuItem
   597                   label: 'Documentation'
   597 		  label: 'Documentation'
   598                   itemValue: openDocumentation
   598 		  itemValue: openDocumentation
   599                 )
   599 		)
   600                (MenuItem
   600 	       (MenuItem
   601                   label: '-'
   601 		  label: '-'
   602                 )
   602 		)
   603                (MenuItem
   603 	       (MenuItem
   604                   label: 'About this Application...'
   604 		  label: 'About this Application...'
   605                   itemValue: openAboutThisApplication
   605 		  itemValue: openAboutThisApplication
   606                 )
   606 		)
   607                )
   607 	       )
   608               nil
   608 	      nil
   609               nil
   609 	      nil
   610             )
   610 	    )
   611           )
   611 	  )
   612          )
   612 	 )
   613         nil
   613 	nil
   614         nil
   614 	nil
   615       )
   615       )
   616 !
   616 !
   617 
   617 
   618 middleButtonMenu
   618 middleButtonMenu
   619     "This resource specification was automatically generated
   619     "This resource specification was automatically generated
   628      (Menu new fromLiteralArrayEncoding:(Tools::ViewTreeInspectorApplication middleButtonMenu)) startUp
   628      (Menu new fromLiteralArrayEncoding:(Tools::ViewTreeInspectorApplication middleButtonMenu)) startUp
   629     "
   629     "
   630 
   630 
   631     <resource: #menu>
   631     <resource: #menu>
   632 
   632 
   633     ^ 
   633     ^
   634      #(Menu
   634      #(Menu
   635         (
   635 	(
   636          (MenuItem
   636 	 (MenuItem
   637             label: 'Browse View Class'
   637 	    label: 'Browse View Class'
   638             itemValue: doBrowse:
   638 	    itemValue: doBrowse:
   639             argument: view
   639 	    argument: view
   640           )
   640 	  )
   641          (MenuItem
   641 	 (MenuItem
   642             label: 'Browse Model Class'
   642 	    label: 'Browse Model Class'
   643             itemValue: doBrowse:
   643 	    itemValue: doBrowse:
   644             isVisible: hasModel
   644 	    isVisible: hasModel
   645             argument: model
   645 	    argument: model
   646           )
   646 	  )
   647          (MenuItem
   647 	 (MenuItem
   648             label: 'Browse Application Class'
   648 	    label: 'Browse Application Class'
   649             itemValue: doBrowse:
   649 	    itemValue: doBrowse:
   650             isVisible: hasApplication
   650 	    isVisible: hasApplication
   651             argument: application
   651 	    argument: application
   652           )
   652 	  )
   653          (MenuItem
   653 	 (MenuItem
   654             label: 'Browse Controller Class'
   654 	    label: 'Browse Controller Class'
   655             itemValue: doBrowse:
   655 	    itemValue: doBrowse:
   656             isVisible: hasController
   656 	    isVisible: hasController
   657             argument: controller
   657 	    argument: controller
   658           )
   658 	  )
   659          (MenuItem
   659 	 (MenuItem
   660             label: '-'
   660 	    label: '-'
   661           )
   661 	  )
   662          (MenuItem
   662 	 (MenuItem
   663             label: 'Inspect View'
   663 	    label: 'Inspect View'
   664             itemValue: doInspect:
   664 	    itemValue: doInspect:
   665             argument: view
   665 	    argument: view
   666           )
   666 	  )
   667          (MenuItem
   667 	 (MenuItem
   668             label: 'Inspect Window Group'
   668 	    label: 'Inspect Window Group'
   669             itemValue: doInspect:
   669 	    itemValue: doInspect:
   670             argument: group
   670 	    argument: group
   671           )
   671 	  )
   672          (MenuItem
   672 	 (MenuItem
   673             label: 'Inspect Model'
   673 	    label: 'Inspect Model'
   674             itemValue: doInspect:
   674 	    itemValue: doInspect:
   675             isVisible: hasModel
   675 	    isVisible: hasModel
   676             argument: model
   676 	    argument: model
   677           )
   677 	  )
   678          (MenuItem
   678 	 (MenuItem
   679             label: 'Inspect Application'
   679 	    label: 'Inspect Application'
   680             itemValue: doInspect:
   680 	    itemValue: doInspect:
   681             isVisible: hasApplication
   681 	    isVisible: hasApplication
   682             argument: application
   682 	    argument: application
   683           )
   683 	  )
   684          (MenuItem
   684 	 (MenuItem
   685             label: 'Inspect Controller'
   685 	    label: 'Inspect Controller'
   686             itemValue: doInspect:
   686 	    itemValue: doInspect:
   687             isVisible: hasController
   687 	    isVisible: hasController
   688             argument: controller
   688 	    argument: controller
   689           )
   689 	  )
   690          (MenuItem
   690 	 (MenuItem
   691             label: '-'
   691 	    label: '-'
   692           )
   692 	  )
   693          (MenuItem
   693 	 (MenuItem
   694             label: 'Flash'
   694 	    label: 'Flash'
   695             itemValue: doFlash
   695 	    itemValue: doFlash
   696           )
   696 	  )
   697          (MenuItem
   697 	 (MenuItem
   698             label: '-'
   698 	    label: '-'
   699           )
   699 	  )
   700          (MenuItem
   700 	 (MenuItem
   701             label: 'Destroy'
   701 	    label: 'Destroy'
   702             itemValue: doDestroy
   702 	    itemValue: doDestroy
   703             labelImage: (ResourceRetriever ToolbarIconLibrary erase16x16Icon 'Destroy')
   703 	    labelImage: (ResourceRetriever ToolbarIconLibrary erase16x16Icon 'Destroy')
   704           )
   704 	  )
   705          (MenuItem
   705 	 (MenuItem
   706             label: '-'
   706 	    label: '-'
   707           )
   707 	  )
   708          (MenuItem
   708 	 (MenuItem
   709             label: 'Geometry'
   709 	    label: 'Geometry'
   710             submenuChannel: submenuGeometry:
   710 	    submenuChannel: submenuGeometry:
   711             keepLinkedMenu: true
   711 	    keepLinkedMenu: true
   712           )
   712 	  )
   713          (MenuItem
   713 	 (MenuItem
   714             label: 'Interface'
   714 	    label: 'Interface'
   715             submenuChannel: submenuInterface:
   715 	    submenuChannel: submenuInterface:
   716             keepLinkedMenu: true
   716 	    keepLinkedMenu: true
   717           )
   717 	  )
   718          (MenuItem
   718 	 (MenuItem
   719             label: 'Visibility'
   719 	    label: 'Visibility'
   720             submenuChannel: submenuVisibility:
   720 	    submenuChannel: submenuVisibility:
   721             keepLinkedMenu: true
   721 	    keepLinkedMenu: true
   722           )
   722 	  )
   723          (MenuItem
   723 	 (MenuItem
   724             label: 'Instance Variables'
   724 	    label: 'Instance Variables'
   725             submenuChannel: submenuInspector:
   725 	    submenuChannel: submenuInspector:
   726             keepLinkedMenu: true
   726 	    keepLinkedMenu: true
   727           )
   727 	  )
   728          (MenuItem
   728 	 (MenuItem
   729             label: '='
   729 	    label: '='
   730           )
   730 	  )
   731          (MenuItem
   731 	 (MenuItem
   732             label: ''
   732 	    label: ''
   733           )
   733 	  )
   734          (MenuItem
   734 	 (MenuItem
   735             enabled: selectedComponentHasChildren
   735 	    enabled: selectedComponentHasChildren
   736             label: 'Applications'
   736 	    label: 'Applications'
   737             nameKey: single
   737 	    nameKey: single
   738             submenuChannel: submenuApplications:
   738 	    submenuChannel: submenuApplications:
   739             keepLinkedMenu: true
   739 	    keepLinkedMenu: true
   740           )
   740 	  )
   741          (MenuItem
   741 	 (MenuItem
   742             enabled: selectedComponentHasChildren
   742 	    enabled: selectedComponentHasChildren
   743             label: 'Components'
   743 	    label: 'Components'
   744             nameKey: single
   744 	    nameKey: single
   745             submenuChannel: submenuComponents:
   745 	    submenuChannel: submenuComponents:
   746             keepLinkedMenu: true
   746 	    keepLinkedMenu: true
   747           )
   747 	  )
   748          )
   748 	 )
   749         nil
   749 	nil
   750         nil
   750 	nil
   751       )
   751       )
   752 !
   752 !
   753 
   753 
   754 middleButtonMenuForMenuItems
   754 middleButtonMenuForMenuItems
   755     "This resource specification was automatically generated
   755     "This resource specification was automatically generated
   764      (Menu new fromLiteralArrayEncoding:(Tools::ViewTreeInspectorApplication middleButtonMenu)) startUp
   764      (Menu new fromLiteralArrayEncoding:(Tools::ViewTreeInspectorApplication middleButtonMenu)) startUp
   765     "
   765     "
   766 
   766 
   767     <resource: #menu>
   767     <resource: #menu>
   768 
   768 
   769     ^ 
   769     ^
   770      #(Menu
   770      #(Menu
   771         (
   771 	(
   772          (MenuItem
   772 	 (MenuItem
   773             label: 'Browse Menu Item''s Class'
   773 	    label: 'Browse Menu Item''s Class'
   774             itemValue: doBrowse:
   774 	    itemValue: doBrowse:
   775             argument: menuItem
   775 	    argument: menuItem
   776           )
   776 	  )
   777          (MenuItem
   777 	 (MenuItem
   778             label: '-'
   778 	    label: '-'
   779           )
   779 	  )
   780          (MenuItem
   780 	 (MenuItem
   781             label: 'Inspect Menu Item'
   781 	    label: 'Inspect Menu Item'
   782             itemValue: doInspect:
   782 	    itemValue: doInspect:
   783             argument: menuItem
   783 	    argument: menuItem
   784           )
   784 	  )
   785          (MenuItem
   785 	 (MenuItem
   786             label: '-'
   786 	    label: '-'
   787           )
   787 	  )
   788          (MenuItem
   788 	 (MenuItem
   789             label: 'Interface'
   789 	    label: 'Interface'
   790             submenuChannel: submenuMenuItemInterface:
   790 	    submenuChannel: submenuMenuItemInterface:
   791             keepLinkedMenu: true
   791 	    keepLinkedMenu: true
   792           )
   792 	  )
   793          )
   793 	 )
   794         nil
   794 	nil
   795         nil
   795 	nil
   796       )
   796       )
   797 
   797 
   798     "Created: / 16-08-2017 / 13:48:49 / cg"
   798     "Created: / 16-08-2017 / 13:48:49 / cg"
   799 !
   799 !
   800 
   800 
   811      (Menu new fromLiteralArrayEncoding:(Tools::ViewTreeInspectorApplication toolbarMenu)) startUp
   811      (Menu new fromLiteralArrayEncoding:(Tools::ViewTreeInspectorApplication toolbarMenu)) startUp
   812     "
   812     "
   813 
   813 
   814     <resource: #menu>
   814     <resource: #menu>
   815 
   815 
   816     ^ 
   816     ^
   817      #(Menu
   817      #(Menu
   818         (
   818 	(
   819          (MenuItem
   819 	 (MenuItem
   820             enabled: hasTargetWidgetChannel
   820 	    enabled: hasTargetWidgetChannel
   821             label: 'Redraw'
   821 	    label: 'Redraw'
   822             itemValue: doRedraw
   822 	    itemValue: doRedraw
   823             isButton: true
   823 	    isButton: true
   824             labelImage: (ResourceRetriever ToolbarIconLibrary reloadIcon)
   824 	    labelImage: (ResourceRetriever ToolbarIconLibrary reloadIcon)
   825           )
   825 	  )
   826          (MenuItem
   826 	 (MenuItem
   827             label: '-'
   827 	    label: '-'
   828           )
   828 	  )
   829          (MenuItem
   829 	 (MenuItem
   830             label: 'Pick a View and Catch Events'
   830 	    label: 'Pick a View and Catch Events'
   831             itemValue: doPickView
   831 	    itemValue: doPickView
   832             translateLabel: false
   832 	    translateLabel: false
   833             isButton: true
   833 	    isButton: true
   834             hideMenuOnActivated: false
   834 	    hideMenuOnActivated: false
   835             labelImage: (ResourceRetriever ToolbarIconLibrary pickWindowIcon)
   835 	    labelImage: (ResourceRetriever ToolbarIconLibrary pickWindowIcon)
   836           )
   836 	  )
   837          (MenuItem
   837 	 (MenuItem
   838             enabled: hasTargetWidgetChannel
   838 	    enabled: hasTargetWidgetChannel
   839             isVisible: isNotCatchingEventsChannel
   839 	    isVisible: isNotCatchingEventsChannel
   840             label: 'Catch Events of Picked View'
   840 	    label: 'Catch Events of Picked View'
   841             activeHelpKey: doCatchEvents
   841 	    activeHelpKey: doCatchEvents
   842             itemValue: doCatchEvents
   842 	    itemValue: doCatchEvents
   843             nameKey: doCatchEvents
   843 	    nameKey: doCatchEvents
   844             isButton: true
   844 	    isButton: true
   845             labelImage: (ResourceRetriever nil releaseViewIcon)
   845 	    labelImage: (ResourceRetriever nil releaseViewIcon)
   846           )
   846 	  )
   847          (MenuItem
   847 	 (MenuItem
   848             enabled: hasTargetWidgetChannel
   848 	    enabled: hasTargetWidgetChannel
   849             isVisible: isCatchingEventsChannel
   849 	    isVisible: isCatchingEventsChannel
   850             label: 'Release Picked View and Uncatch Events'
   850 	    label: 'Release Picked View and Uncatch Events'
   851             activeHelpKey: doUncatchEvents
   851 	    activeHelpKey: doUncatchEvents
   852             itemValue: doUncatchEvents
   852 	    itemValue: doUncatchEvents
   853             nameKey: doUncatchEvents
   853 	    nameKey: doUncatchEvents
   854             isButton: true
   854 	    isButton: true
   855             labelImage: (ResourceRetriever nil lockViewIcon)
   855 	    labelImage: (ResourceRetriever nil lockViewIcon)
   856           )
   856 	  )
   857          (MenuItem
   857 	 (MenuItem
   858             label: '-'
   858 	    label: '-'
   859           )
   859 	  )
   860          (MenuItem
   860 	 (MenuItem
   861             activeHelpKey: doBrowseApplication
   861 	    activeHelpKey: doBrowseApplication
   862             enabled: hasSingleSelectionHolder
   862 	    enabled: hasSingleSelectionHolder
   863             label: 'Browse Application'
   863 	    label: 'Browse Application'
   864             itemValue: doBrowse:
   864 	    itemValue: doBrowse:
   865             translateLabel: false
   865 	    translateLabel: false
   866             isButton: true
   866 	    isButton: true
   867             hideMenuOnActivated: false
   867 	    hideMenuOnActivated: false
   868             labelImage: (ResourceRetriever ToolbarIconLibrary systemBrowser24x24Icon2)
   868 	    labelImage: (ResourceRetriever ToolbarIconLibrary systemBrowser24x24Icon2)
   869             argument: application
   869 	    argument: application
   870           )
   870 	  )
   871          (MenuItem
   871 	 (MenuItem
   872             activeHelpKey: doInspectApplication
   872 	    activeHelpKey: doInspectApplication
   873             enabled: hasSingleSelectionHolder
   873 	    enabled: hasSingleSelectionHolder
   874             label: 'Inspect Application'
   874 	    label: 'Inspect Application'
   875             itemValue: doInspect:
   875 	    itemValue: doInspect:
   876             translateLabel: false
   876 	    translateLabel: false
   877             isButton: true
   877 	    isButton: true
   878             hideMenuOnActivated: false
   878 	    hideMenuOnActivated: false
   879             labelImage: (ResourceRetriever ToolbarIconLibrary inspect22x24Icon)
   879 	    labelImage: (ResourceRetriever ToolbarIconLibrary inspect22x24Icon)
   880             argument: application
   880 	    argument: application
   881           )
   881 	  )
   882          )
   882 	 )
   883         nil
   883 	nil
   884         nil
   884 	nil
   885       )
   885       )
   886 ! !
   886 ! !
   887 
   887 
   888 !ViewTreeInspectorApplication class methodsFor:'startup'!
   888 !ViewTreeInspectorApplication class methodsFor:'startup'!
   889 
   889 
   924     |item sensor|
   924     |item sensor|
   925 
   925 
   926     item := model listOfItems at:anIndex ifAbsent:nil.
   926     item := model listOfItems at:anIndex ifAbsent:nil.
   927 
   927 
   928     item notNil ifTrue:[
   928     item notNil ifTrue:[
   929         (     (sensor := self window sensor) notNil
   929 	(     (sensor := self window sensor) notNil
   930          and:[(sensor ctrlDown or:[sensor shiftDown])]
   930 	 and:[(sensor ctrlDown or:[sensor shiftDown])]
   931         ) ifTrue:[
   931 	) ifTrue:[
   932             item recursiveToggleExpand
   932 	    item recursiveToggleExpand
   933         ] ifFalse:[
   933 	] ifFalse:[
   934             item toggleExpand
   934 	    item toggleExpand
   935         ]
   935 	]
   936     ].
   936     ].
   937 ! !
   937 ! !
   938 
   938 
   939 !ViewTreeInspectorApplication methodsFor:'aspects'!
   939 !ViewTreeInspectorApplication methodsFor:'aspects'!
   940 
   940 
   942     "what is shown in the inspector:
   942     "what is shown in the inspector:
   943      1->Widget
   943      1->Widget
   944      2->Application
   944      2->Application
   945      3->WindowGroup
   945      3->WindowGroup
   946      4->Sensor
   946      4->Sensor
   947      5->Model 
   947      5->Model
   948      6->Widget Class 
   948      6->Widget Class
   949      7->Application Class 
   949      7->Application Class
   950     "
   950     "
   951 
   951 
   952     ^ BlockValue
   952     ^ BlockValue
   953         with:[:v | self inspectorMode == #widgetClass or:[self inspectorMode == #applicationClass] ]
   953 	with:[:v | self inspectorMode == #widgetClass or:[self inspectorMode == #applicationClass] ]
   954         argument:self inspectorModeIndexHolder
   954 	argument:self inspectorModeIndexHolder
   955 !
   955 !
   956 
   956 
   957 canBrowseWindowSpecMethod
   957 canBrowseWindowSpecMethod
   958     ^ self hasSingleSelectionHolder value and:[ self windowSpecMethodOfSelection notNil ]
   958     ^ self hasSingleSelectionHolder value and:[ self windowSpecMethodOfSelection notNil ]
   959 !
   959 !
   984     "what is shown in the inspector:
   984     "what is shown in the inspector:
   985      1->widget
   985      1->widget
   986      2->application
   986      2->application
   987      3->WindowGroup
   987      3->WindowGroup
   988      4->Sensor
   988      4->Sensor
   989      5->Model 
   989      5->Model
   990      6->Widget Class 
   990      6->Widget Class
   991      7->Application Class 
   991      7->Application Class
   992     "
   992     "
   993 
   993 
   994     |mode|
   994     |mode|
   995     mode := inspectorModeIndexHolder value.
   995     mode := inspectorModeIndexHolder value.
   996     ^ #( widget application group sensor model widgetClass applicationClass) at:mode ifAbsent:#widget
   996     ^ #( widget application group sensor model widgetClass applicationClass) at:mode ifAbsent:#widget
  1002     "what is shown in the inspector:
  1002     "what is shown in the inspector:
  1003      1->Widget
  1003      1->Widget
  1004      2->Application
  1004      2->Application
  1005      3->WindowGroup
  1005      3->WindowGroup
  1006      4->Sensor
  1006      4->Sensor
  1007      5->Model 
  1007      5->Model
  1008      6->Widget Class 
  1008      6->Widget Class
  1009      7->Application Class 
  1009      7->Application Class
  1010     "
  1010     "
  1011 
  1011 
  1012     ^ inspectorModeIndexHolder
  1012     ^ inspectorModeIndexHolder
  1013 
  1013 
  1014     "Created: / 30-07-2013 / 07:44:07 / cg"
  1014     "Created: / 30-07-2013 / 07:44:07 / cg"
  1025     "what is shown in the inspector:
  1025     "what is shown in the inspector:
  1026      1->Widget
  1026      1->Widget
  1027      2->Application
  1027      2->Application
  1028      3->WindowGroup
  1028      3->WindowGroup
  1029      4->Sensor
  1029      4->Sensor
  1030      5->Model 
  1030      5->Model
  1031      6->Widget Class 
  1031      6->Widget Class
  1032      7->Application Class 
  1032      7->Application Class
  1033     "
  1033     "
  1034 
  1034 
  1035     ^ BlockValue
  1035     ^ BlockValue
  1036         with:[:v | v not ]
  1036 	with:[:v | v not ]
  1037         argument:self browserVisibleHolder
  1037 	argument:self browserVisibleHolder
  1038 !
  1038 !
  1039 
  1039 
  1040 isCatchingEventsChannel
  1040 isCatchingEventsChannel
  1041     ^ isCatchingEventsChannel
  1041     ^ isCatchingEventsChannel
  1042 !
  1042 !
  1059 
  1059 
  1060 path
  1060 path
  1061     <resource: #uiAspect>
  1061     <resource: #uiAspect>
  1062 
  1062 
  1063     path isNil ifTrue:[
  1063     path isNil ifTrue:[
  1064         path := PluggableAdaptor 
  1064 	path := PluggableAdaptor
  1065                     on: self model 
  1065 		    on: self model
  1066                     getter:[ :model | model path ]
  1066 		    getter:[ :model | model path ]
  1067                     setter:[ :model :newValue |  ]
  1067 		    setter:[ :model :newValue |  ]
  1068     ].
  1068     ].
  1069     ^ path.
  1069     ^ path.
  1070 
  1070 
  1071     "Modified: / 19-05-2014 / 18:40:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1071     "Modified: / 19-05-2014 / 18:40:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1072 !
  1072 !
  1097 windowSpecMethodOfSelection
  1097 windowSpecMethodOfSelection
  1098     |item view app nonMeta meta masterApp
  1098     |item view app nonMeta meta masterApp
  1099      spec builder specSelector implementors|
  1099      spec builder specSelector implementors|
  1100 
  1100 
  1101     item := model selectedItem.
  1101     item := model selectedItem.
  1102     item isNil ifTrue:[^ nil]. 
  1102     item isNil ifTrue:[^ nil].
  1103 
  1103 
  1104     view := item widget.
  1104     view := item widget.
  1105     view isNil ifTrue:[^ nil]. 
  1105     view isNil ifTrue:[^ nil].
  1106 
  1106 
  1107     app := view application.
  1107     app := view application.
  1108     app isNil ifTrue:[^ nil]. 
  1108     app isNil ifTrue:[^ nil].
  1109     
  1109 
  1110     builder := app builder.
  1110     builder := app builder.
  1111     builder isNil ifTrue:[^ nil]. 
  1111     builder isNil ifTrue:[^ nil].
  1112 
  1112 
  1113     spec := builder spec.
  1113     spec := builder spec.
  1114     spec isNil ifTrue:[^ nil].
  1114     spec isNil ifTrue:[^ nil].
  1115 
  1115 
  1116     specSelector := spec name.
  1116     specSelector := spec name.
  1117     specSelector isNil ifTrue:[^ nil].
  1117     specSelector isNil ifTrue:[^ nil].
  1118 
  1118 
  1119     ((nonMeta := app class theNonMetaclass) canUnderstand:specSelector) ifTrue:[
  1119     ((nonMeta := app class theNonMetaclass) canUnderstand:specSelector) ifTrue:[
  1120         ^ nonMeta lookupMethodFor:specSelector.
  1120 	^ nonMeta lookupMethodFor:specSelector.
  1121     ].
  1121     ].
  1122     ((meta := app class theMetaclass) canUnderstand:specSelector) ifTrue:[
  1122     ((meta := app class theMetaclass) canUnderstand:specSelector) ifTrue:[
  1123         ^ meta lookupMethodFor:specSelector.
  1123 	^ meta lookupMethodFor:specSelector.
  1124     ].
  1124     ].
  1125 
  1125 
  1126     "/ maybe a simple dialog given a spec
  1126     "/ maybe a simple dialog given a spec
  1127     (masterApp := app masterApplication) notNil ifTrue:[
  1127     (masterApp := app masterApplication) notNil ifTrue:[
  1128         ((nonMeta := masterApp class theNonMetaclass) canUnderstand:specSelector) ifTrue:[     
  1128 	((nonMeta := masterApp class theNonMetaclass) canUnderstand:specSelector) ifTrue:[
  1129             ^ nonMeta lookupMethodFor:specSelector.
  1129 	    ^ nonMeta lookupMethodFor:specSelector.
  1130         ].
  1130 	].
  1131         ((meta := masterApp class theMetaclass) canUnderstand:specSelector) ifTrue:[    
  1131 	((meta := masterApp class theMetaclass) canUnderstand:specSelector) ifTrue:[
  1132             ^ meta lookupMethodFor:specSelector.
  1132 	    ^ meta lookupMethodFor:specSelector.
  1133         ].
  1133 	].
  1134     ].
  1134     ].
  1135 
  1135 
  1136     implementors := Smalltalk allImplementorsOf: specSelector.
  1136     implementors := Smalltalk allImplementorsOf: specSelector.
  1137     implementors size == 1 ifTrue:[
  1137     implementors size == 1 ifTrue:[
  1138         ^ implementors first compiledMethodAt:specSelector.
  1138 	^ implementors first compiledMethodAt:specSelector.
  1139     ].
  1139     ].
  1140 
  1140 
  1141     ^ nil
  1141     ^ nil
  1142 ! !
  1142 ! !
  1143 
  1143 
  1151 
  1151 
  1152 selectionChanged
  1152 selectionChanged
  1153     |info view item|
  1153     |info view item|
  1154 
  1154 
  1155     item := model selectedItem.
  1155     item := model selectedItem.
  1156     item notNil ifTrue:[ 
  1156     item notNil ifTrue:[
  1157         |state|
  1157 	|state|
  1158 
  1158 
  1159         view := item widget.
  1159 	view := item widget.
  1160         view isNil ifTrue:[
  1160 	view isNil ifTrue:[
  1161             info := '%1 [%2]' bindWith:(item menuItem label asString)
  1161 	    info := '%1 [%2]' bindWith:(item menuItem label asString)
  1162                                   with:(item menuItem value asString).
  1162 				  with:(item menuItem value asString).
  1163         ] ifFalse:[    
  1163 	] ifFalse:[
  1164             view id isNil ifTrue:[
  1164 	    view id isNil ifTrue:[
  1165                 state := 'no ID'.
  1165 		state := 'no ID'.
  1166             ] ifFalse:[
  1166 	    ] ifFalse:[
  1167                 view shown ifTrue:[
  1167 		view shown ifTrue:[
  1168                     state := 'visible'.
  1168 		    state := 'visible'.
  1169                 ] ifFalse:[
  1169 		] ifFalse:[
  1170                     state := 'invisible'
  1170 		    state := 'invisible'
  1171                 ].
  1171 		].
  1172             ].
  1172 	    ].
  1173             info := '%1 [%2] - %3' bindWith:(view class name)
  1173 	    info := '%1 [%2] - %3' bindWith:(view class name)
  1174                                        with:(view name ? '') with:state allBold.
  1174 				       with:(view name ? '') with:state allBold.
  1175         ]
  1175 	]
  1176     ] ifFalse:[
  1176     ] ifFalse:[
  1177         info := ''
  1177 	info := ''
  1178     ].
  1178     ].
  1179     hasSingleSelectionHolder value:(view notNil).
  1179     hasSingleSelectionHolder value:(view notNil).
  1180     self updateInspector
  1180     self updateInspector
  1181 
  1181 
  1182     "Modified: / 16-08-2017 / 13:44:59 / cg"
  1182     "Modified: / 16-08-2017 / 13:44:59 / cg"
  1184 
  1184 
  1185 update:something with:someArgument from:aModel
  1185 update:something with:someArgument from:aModel
  1186     |oldSelection|
  1186     |oldSelection|
  1187 
  1187 
  1188     aModel == showNamesHolder ifTrue:[
  1188     aModel == showNamesHolder ifTrue:[
  1189         oldSelection := model selectedItem.
  1189 	oldSelection := model selectedItem.
  1190         model selectedItem:nil.
  1190 	model selectedItem:nil.
  1191         self listOfItems showWidgetNames:(aModel value).
  1191 	self listOfItems showWidgetNames:(aModel value).
  1192         model selectedItem:oldSelection.
  1192 	model selectedItem:oldSelection.
  1193         ^ self
  1193 	^ self
  1194     ].
  1194     ].
  1195 
  1195 
  1196     aModel == model ifTrue:[
  1196     aModel == model ifTrue:[
  1197         self selectionChanged.
  1197 	self selectionChanged.
  1198         ^ self
  1198 	^ self
  1199     ].
  1199     ].
  1200 
  1200 
  1201     super update:something with:someArgument from:aModel.
  1201     super update:something with:someArgument from:aModel.
  1202 !
  1202 !
  1203 
  1203 
  1204 updateBrowser
  1204 updateBrowser
  1205     |cls widget|
  1205     |cls widget|
  1206 
  1206 
  1207     widget := self selectedView.
  1207     widget := self selectedView.
  1208     
  1208 
  1209     "/ update the browser
  1209     "/ update the browser
  1210     self inspectorMode == #widgetClass ifTrue:[
  1210     self inspectorMode == #widgetClass ifTrue:[
  1211         cls := widget class.
  1211 	cls := widget class.
  1212     ] ifFalse:[
  1212     ] ifFalse:[
  1213         cls := widget application class
  1213 	cls := widget application class
  1214     ].    
  1214     ].
  1215     browser switchToClass:cls selector:nil.
  1215     browser switchToClass:cls selector:nil.
  1216 !
  1216 !
  1217 
  1217 
  1218 updateInspector
  1218 updateInspector
  1219     |view mode obj|
  1219     |view mode obj|
  1220 
  1220 
  1221     view := self selectedView.
  1221     view := self selectedView.
  1222     mode := self inspectorMode.
  1222     mode := self inspectorMode.
  1223     
  1223 
  1224     ((mode == #widgetClass) or:[(mode == #applicationClass)]) ifTrue:[
  1224     ((mode == #widgetClass) or:[(mode == #applicationClass)]) ifTrue:[
  1225         "/ update the browser
  1225 	"/ update the browser
  1226         view notNil ifTrue:[
  1226 	view notNil ifTrue:[
  1227             self updateBrowser.
  1227 	    self updateBrowser.
  1228         ].
  1228 	].
  1229         ^ self.
  1229 	^ self.
  1230     ].
  1230     ].
  1231     
  1231 
  1232     (view isNil or:[mode == #widget]) ifTrue:[
  1232     (view isNil or:[mode == #widget]) ifTrue:[
  1233         obj := view.
  1233 	obj := view.
  1234     ] ifFalse:[ (mode == #group) ifTrue:[
  1234     ] ifFalse:[ (mode == #group) ifTrue:[
  1235         obj := view windowGroup
  1235 	obj := view windowGroup
  1236     ] ifFalse:[ (mode == #sensor) ifTrue:[
  1236     ] ifFalse:[ (mode == #sensor) ifTrue:[
  1237         obj := view sensor
  1237 	obj := view sensor
  1238     ] ifFalse:[ (mode == #model) ifTrue:[
  1238     ] ifFalse:[ (mode == #model) ifTrue:[
  1239         obj := view model
  1239 	obj := view model
  1240     ] ifFalse:[
  1240     ] ifFalse:[
  1241         obj := view application.
  1241 	obj := view application.
  1242     ]]]].
  1242     ]]]].
  1243     inspectorView inspect:obj.
  1243     inspectorView inspect:obj.
  1244     inspectorView headLineLabel:(obj class nameWithoutPrefix)
  1244     inspectorView headLineLabel:(obj class nameWithoutPrefix)
  1245 
  1245 
  1246     "Created: / 30-07-2013 / 09:21:16 / cg"
  1246     "Created: / 30-07-2013 / 09:21:16 / cg"
  1252     |click rootView|
  1252     |click rootView|
  1253 
  1253 
  1254     motionAction isNil ifTrue:[^ self].
  1254     motionAction isNil ifTrue:[^ self].
  1255 
  1255 
  1256     (rootView := model rootView) isNil ifTrue:[
  1256     (rootView := model rootView) isNil ifTrue:[
  1257         clickedItem := motionAction := nil.
  1257 	clickedItem := motionAction := nil.
  1258         ^ self
  1258 	^ self
  1259     ].
  1259     ].
  1260 
  1260 
  1261     click := rootView device
  1261     click := rootView device
  1262             translatePoint:((ev x)@ (ev y))
  1262 	    translatePoint:((ev x)@ (ev y))
  1263             fromView:(ev view)
  1263 	    fromView:(ev view)
  1264             toView:rootView.
  1264 	    toView:rootView.
  1265 
  1265 
  1266     click = clickedPoint ifFalse:[
  1266     click = clickedPoint ifFalse:[
  1267         (clickedItem isNil or:[(click dist:clickedPoint) > 5.0]) ifTrue:[
  1267 	(clickedItem isNil or:[(click dist:clickedPoint) > 5.0]) ifTrue:[
  1268             motionAction value:click
  1268 	    motionAction value:click
  1269         ]
  1269 	]
  1270     ].
  1270     ].
  1271 !
  1271 !
  1272 
  1272 
  1273 processButtonPressEvent:ev
  1273 processButtonPressEvent:ev
  1274     |rootView sensor lastRectangle|
  1274     |rootView sensor lastRectangle|
  1276     rootView    := model rootView.
  1276     rootView    := model rootView.
  1277     sensor      := model rootView sensor.
  1277     sensor      := model rootView sensor.
  1278     clickedItem := model listOfItems detectItemRespondsToView:(ev view).
  1278     clickedItem := model listOfItems detectItemRespondsToView:(ev view).
  1279 
  1279 
  1280     (sensor ctrlDown or:[sensor shiftDown]) ifTrue:[
  1280     (sensor ctrlDown or:[sensor shiftDown]) ifTrue:[
  1281         clickedItem notNil ifTrue:[
  1281 	clickedItem notNil ifTrue:[
  1282             self selectOnClickHolder value ifTrue:[
  1282 	    self selectOnClickHolder value ifTrue:[
  1283                 model toggleSelectItem:clickedItem
  1283 		model toggleSelectItem:clickedItem
  1284             ].
  1284 	    ].
  1285         ].
  1285 	].
  1286         clickedItem := motionAction := nil.
  1286 	clickedItem := motionAction := nil.
  1287         ^ self
  1287 	^ self
  1288     ].
  1288     ].
  1289 
  1289 
  1290     clickedPoint := rootView device translatePoint:((ev x)@ (ev y))  fromView:(ev view) toView:rootView.
  1290     clickedPoint := rootView device translatePoint:((ev x)@ (ev y))  fromView:(ev view) toView:rootView.
  1291     lastRectangle := nil.
  1291     lastRectangle := nil.
  1292 
  1292 
  1293     motionAction :=[:p|
  1293     motionAction :=[:p|
  1294         rootView    := model rootView device rootView.
  1294 	rootView    := model rootView device rootView.
  1295         rootView    := model rootView.
  1295 	rootView    := model rootView.
  1296         clickedItem := nil.
  1296 	clickedItem := nil.
  1297 
  1297 
  1298         rootView xoring:[
  1298 	rootView xoring:[
  1299             lastRectangle notNil ifTrue:[ rootView displayRectangle:lastRectangle ]
  1299 	    lastRectangle notNil ifTrue:[ rootView displayRectangle:lastRectangle ]
  1300                                 ifFalse:[ rootView clippedByChildren:false ].
  1300 				ifFalse:[ rootView clippedByChildren:false ].
  1301 
  1301 
  1302             p isNil ifTrue:[
  1302 	    p isNil ifTrue:[
  1303                 rootView clippedByChildren:true.
  1303 		rootView clippedByChildren:true.
  1304                 motionAction := nil.
  1304 		motionAction := nil.
  1305             ] ifFalse:[
  1305 	    ] ifFalse:[
  1306                 lastRectangle := Rectangle origin:(clickedPoint min:p) corner:(clickedPoint max:p).
  1306 		lastRectangle := Rectangle origin:(clickedPoint min:p) corner:(clickedPoint max:p).
  1307                 rootView displayRectangle:lastRectangle.
  1307 		rootView displayRectangle:lastRectangle.
  1308             ].
  1308 	    ].
  1309             rootView flush.
  1309 	    rootView flush.
  1310         ].
  1310 	].
  1311         lastRectangle
  1311 	lastRectangle
  1312     ].
  1312     ].
  1313 !
  1313 !
  1314 
  1314 
  1315 processButtonReleaseEvent:anEvent
  1315 processButtonReleaseEvent:anEvent
  1316     |rootView rectangle newItems widget origin|
  1316     |rootView rectangle newItems widget origin|
  1317 
  1317 
  1318     (rootView := model rootView) isNil ifTrue:[
  1318     (rootView := model rootView) isNil ifTrue:[
  1319         clickedItem := motionAction := nil.
  1319 	clickedItem := motionAction := nil.
  1320         ^ self
  1320 	^ self
  1321     ].
  1321     ].
  1322     motionAction isNil ifTrue:[ ^ self ].
  1322     motionAction isNil ifTrue:[ ^ self ].
  1323     clickedItem notNil ifTrue:[ ^ model selectItem:clickedItem ].
  1323     clickedItem notNil ifTrue:[ ^ model selectItem:clickedItem ].
  1324 
  1324 
  1325     rectangle := motionAction value:nil.
  1325     rectangle := motionAction value:nil.
  1326     rectangle isNil ifTrue:[^ self].
  1326     rectangle isNil ifTrue:[^ self].
  1327 
  1327 
  1328     newItems := OrderedCollection new.
  1328     newItems := OrderedCollection new.
  1329 
  1329 
  1330     model rootItem recursiveDo:[:anItem|
  1330     model rootItem recursiveDo:[:anItem|
  1331         widget := anItem widget.
  1331 	widget := anItem widget.
  1332         widget notNil ifTrue:[
  1332 	widget notNil ifTrue:[
  1333             origin := widget originRelativeTo:rootView.
  1333 	    origin := widget originRelativeTo:rootView.
  1334 
  1334 
  1335             (rectangle containsRect:(Rectangle origin:origin extent:(widget extent))) ifTrue:[
  1335 	    (rectangle containsRect:(Rectangle origin:origin extent:(widget extent))) ifTrue:[
  1336                 newItems add:anItem.
  1336 		newItems add:anItem.
  1337             ]
  1337 	    ]
  1338         ].
  1338 	].
  1339     ].
  1339     ].
  1340     model value:newItems.
  1340     model value:newItems.
  1341 
  1341 
  1342     "Modified: / 11-11-2017 / 17:24:59 / cg"
  1342     "Modified: / 11-11-2017 / 17:24:59 / cg"
  1343 !
  1343 !
  1349     anEvent isButtonEvent  ifFalse:[ ^ self ].
  1349     anEvent isButtonEvent  ifFalse:[ ^ self ].
  1350 
  1350 
  1351     button := anEvent button.
  1351     button := anEvent button.
  1352 
  1352 
  1353     (button == 2 or:[button == #menu]) ifTrue:[
  1353     (button == 2 or:[button == #menu]) ifTrue:[
  1354         motionAction isNil ifTrue:[
  1354 	motionAction isNil ifTrue:[
  1355             anEvent isButtonPressEvent ifTrue:[
  1355 	    anEvent isButtonPressEvent ifTrue:[
  1356                 self selectOnClickHolder value ifTrue:[
  1356 		self selectOnClickHolder value ifTrue:[
  1357                     menu := self middleButtonMenu value.
  1357 		    menu := self middleButtonMenu value.
  1358                     menu notNil ifTrue:[
  1358 		    menu notNil ifTrue:[
  1359                         menu := MenuPanel 
  1359 			menu := MenuPanel
  1360                                     menu:(Menu new fromLiteralArrayEncoding:menu)
  1360 				    menu:(Menu new fromLiteralArrayEncoding:menu)
  1361                                     receiver:self.
  1361 				    receiver:self.
  1362                         menu startUp.
  1362 			menu startUp.
  1363                     ]
  1363 		    ]
  1364                 ].
  1364 		].
  1365             ].
  1365 	    ].
  1366             clickedItem := nil.
  1366 	    clickedItem := nil.
  1367         ].
  1367 	].
  1368         ^ self
  1368 	^ self
  1369     ].
  1369     ].
  1370 
  1370 
  1371     anEvent isButtonPressEvent  ifTrue:[ self processButtonPressEvent:anEvent. ^ self ].
  1371     anEvent isButtonPressEvent  ifTrue:[ self processButtonPressEvent:anEvent. ^ self ].
  1372     anEvent isButtonMotionEvent ifTrue:[ self processButtonMotionEvent:anEvent. ^ self ].
  1372     anEvent isButtonMotionEvent ifTrue:[ self processButtonMotionEvent:anEvent. ^ self ].
  1373 
  1373 
  1374     anEvent isButtonReleaseEvent ifTrue:[
  1374     anEvent isButtonReleaseEvent ifTrue:[
  1375         self selectOnClickHolder value ifTrue:[
  1375 	self selectOnClickHolder value ifTrue:[
  1376             self processButtonReleaseEvent:anEvent
  1376 	    self processButtonReleaseEvent:anEvent
  1377         ].
  1377 	].
  1378     ].
  1378     ].
  1379     clickedItem := motionAction := nil.
  1379     clickedItem := motionAction := nil.
  1380 
  1380 
  1381     anEvent type == #'buttonMultiPress:x:y:' ifTrue:[
  1381     anEvent type == #'buttonMultiPress:x:y:' ifTrue:[
  1382         self selectOnClickHolder value ifTrue:[
  1382 	self selectOnClickHolder value ifTrue:[
  1383             self doInspect:#view.
  1383 	    self doInspect:#view.
  1384         ].
  1384 	].
  1385     ].
  1385     ].
  1386 !
  1386 !
  1387 
  1387 
  1388 processKeyPressEvent:anEvent
  1388 processKeyPressEvent:anEvent
  1389     |item prnt idx key max next|
  1389     |item prnt idx key max next|
  1397     (   key == #CursorUp
  1397     (   key == #CursorUp
  1398     or:[key == #CursorDown
  1398     or:[key == #CursorDown
  1399     or:[key == #CursorLeft
  1399     or:[key == #CursorLeft
  1400     or:[key == #CursorRight]]]
  1400     or:[key == #CursorRight]]]
  1401     ) ifFalse:[
  1401     ) ifFalse:[
  1402         ^ self
  1402 	^ self
  1403     ].
  1403     ].
  1404     item := model selectedItem.
  1404     item := model selectedItem.
  1405 
  1405 
  1406     item isNil ifTrue:[
  1406     item isNil ifTrue:[
  1407         ^ model selectedItem:(model first ? model rootItem)
  1407 	^ model selectedItem:(model first ? model rootItem)
  1408     ].
  1408     ].
  1409 
  1409 
  1410     prnt := item parent.
  1410     prnt := item parent.
  1411     prnt isNil ifTrue:[
  1411     prnt isNil ifTrue:[
  1412         "/ is the root item
  1412 	"/ is the root item
  1413         (key == #CursorUp or:[key == #CursorLeft]) ifTrue:[item := model listOfItems last]
  1413 	(key == #CursorUp or:[key == #CursorLeft]) ifTrue:[item := model listOfItems last]
  1414                                                   ifFalse:[item := item at:1 ifAbsent:item].
  1414 						  ifFalse:[item := item at:1 ifAbsent:item].
  1415 
  1415 
  1416         ^ model selectedItem:item
  1416 	^ model selectedItem:item
  1417     ].
  1417     ].
  1418     key == #CursorLeft ifTrue:[ ^ model selectedItem:prnt ].
  1418     key == #CursorLeft ifTrue:[ ^ model selectedItem:prnt ].
  1419 
  1419 
  1420     key == #CursorRight ifTrue:[
  1420     key == #CursorRight ifTrue:[
  1421         next := item at:1 ifAbsent:nil.
  1421 	next := item at:1 ifAbsent:nil.
  1422         next notNil ifTrue:[ model selectedItem:next ].
  1422 	next notNil ifTrue:[ model selectedItem:next ].
  1423         ^ self
  1423 	^ self
  1424     ].
  1424     ].
  1425 
  1425 
  1426     max := prnt size.
  1426     max := prnt size.
  1427 
  1427 
  1428     key == #CursorUp ifTrue:[
  1428     key == #CursorUp ifTrue:[
  1429         idx := prnt identityIndexOf:item.
  1429 	idx := prnt identityIndexOf:item.
  1430         idx == 1 ifTrue:[idx := max + 1].
  1430 	idx == 1 ifTrue:[idx := max + 1].
  1431         model selectedItem:(prnt at:idx - 1).
  1431 	model selectedItem:(prnt at:idx - 1).
  1432         ^ self.
  1432 	^ self.
  1433     ].
  1433     ].
  1434 
  1434 
  1435     key == #CursorDown ifTrue:[
  1435     key == #CursorDown ifTrue:[
  1436         idx := prnt identityIndexOf:item.
  1436 	idx := prnt identityIndexOf:item.
  1437         idx == max ifTrue:[idx := 0].
  1437 	idx == max ifTrue:[idx := 0].
  1438         model selectedItem:(prnt at:idx + 1).
  1438 	model selectedItem:(prnt at:idx + 1).
  1439         ^ self.
  1439 	^ self.
  1440     ].
  1440     ].
  1441 !
  1441 !
  1442 
  1442 
  1443 processMappedView:aView
  1443 processMappedView:aView
  1444     |parent anchor|
  1444     |parent anchor|
  1445 
  1445 
  1446     parent := self listOfItems detectItemRespondsToView:aView.
  1446     parent := self listOfItems detectItemRespondsToView:aView.
  1447     parent isNil ifTrue:[ ^ self ].
  1447     parent isNil ifTrue:[ ^ self ].
  1448 
  1448 
  1449     NotFoundSignal handle:[:ex|
  1449     NotFoundSignal handle:[:ex|
  1450         "contained subvies used by spec are not yet created;
  1450 	"contained subvies used by spec are not yet created;
  1451          thus we have to wait until last used subview is build
  1451 	 thus we have to wait until last used subview is build
  1452         "
  1452 	"
  1453         anchor := nil.
  1453 	anchor := nil.
  1454     ] do:[
  1454     ] do:[
  1455         anchor := parent class buildViewsFrom:(parent widget).
  1455 	anchor := parent class buildViewsFrom:(parent widget).
  1456     ].
  1456     ].
  1457     anchor notNil ifTrue:[
  1457     anchor notNil ifTrue:[
  1458         parent updateFromChildren:anchor children.
  1458 	parent updateFromChildren:anchor children.
  1459     ].
  1459     ].
  1460 ! !
  1460 ! !
  1461 
  1461 
  1462 !ViewTreeInspectorApplication methodsFor:'initialization & release'!
  1462 !ViewTreeInspectorApplication methodsFor:'initialization & release'!
  1463 
  1463 
  1534     |view controller|
  1534     |view controller|
  1535 
  1535 
  1536     view := self selectedView.
  1536     view := self selectedView.
  1537 
  1537 
  1538     view notNil ifTrue:[
  1538     view notNil ifTrue:[
  1539         controller := view controller.
  1539 	controller := view controller.
  1540       ^ (controller notNil and:[controller ~~ view])
  1540       ^ (controller notNil and:[controller ~~ view])
  1541     ].
  1541     ].
  1542     ^ false
  1542     ^ false
  1543 !
  1543 !
  1544 
  1544 
  1554 !ViewTreeInspectorApplication methodsFor:'menu specs'!
  1554 !ViewTreeInspectorApplication methodsFor:'menu specs'!
  1555 
  1555 
  1556 middleButtonMenu
  1556 middleButtonMenu
  1557     "returns the middleButton menu for the single selected item or nil"
  1557     "returns the middleButton menu for the single selected item or nil"
  1558 
  1558 
  1559     ^ [ 
  1559     ^ [
  1560         model selectedItem notNil ifTrue:[
  1560 	model selectedItem notNil ifTrue:[
  1561             model selectedItem isView ifTrue:[
  1561 	    model selectedItem isView ifTrue:[
  1562                 self class middleButtonMenu
  1562 		self class middleButtonMenu
  1563             ] ifFalse:[
  1563 	    ] ifFalse:[
  1564                 self class middleButtonMenuForMenuItems
  1564 		self class middleButtonMenuForMenuItems
  1565             ].    
  1565 	    ].
  1566         ] ifFalse:[
  1566 	] ifFalse:[
  1567             nil
  1567 	    nil
  1568         ]
  1568 	]
  1569       ]
  1569       ]
  1570 
  1570 
  1571     "Modified: / 16-08-2017 / 13:48:31 / cg"
  1571     "Modified: / 16-08-2017 / 13:48:31 / cg"
  1572 !
  1572 !
  1573 
  1573 
  1574 submenuApplications:aMenu
  1574 submenuApplications:aMenu
  1575     |applications menu item list addBlock|
  1575     |applications menu item list addBlock|
  1576 
  1576 
  1577     item := aMenu selection nameKey == #single ifTrue:[model selectedItem]
  1577     item := aMenu selection nameKey == #single ifTrue:[model selectedItem]
  1578                                               ifFalse:[model rootItem].
  1578 					      ifFalse:[model rootItem].
  1579     item isNil ifTrue:[^ nil].
  1579     item isNil ifTrue:[^ nil].
  1580 
  1580 
  1581     applications := IdentityDictionary new.
  1581     applications := IdentityDictionary new.
  1582 
  1582 
  1583     addBlock := [:el| |cls ctr|
  1583     addBlock := [:el| |cls ctr|
  1584         cls := self resolveApplicationClassFor:el.
  1584 	cls := self resolveApplicationClassFor:el.
  1585 
  1585 
  1586         cls notNil ifTrue:[
  1586 	cls notNil ifTrue:[
  1587             ctr := applications at:cls ifAbsent:0.
  1587 	    ctr := applications at:cls ifAbsent:0.
  1588             applications at:cls put:(ctr + 1).
  1588 	    applications at:cls put:(ctr + 1).
  1589         ].
  1589 	].
  1590     ].
  1590     ].
  1591     item recursiveDo:addBlock.
  1591     item recursiveDo:addBlock.
  1592     addBlock value:item.
  1592     addBlock value:item.
  1593 
  1593 
  1594     applications isEmpty ifTrue:[^ nil ].
  1594     applications isEmpty ifTrue:[^ nil ].
  1595     list := SortedCollection sortBlock:[:a :b| a title < b title ].
  1595     list := SortedCollection sortBlock:[:a :b| a title < b title ].
  1596 
  1596 
  1597     applications keysAndValuesDo:[:cls :ctr|
  1597     applications keysAndValuesDo:[:cls :ctr|
  1598        list add:(MenuDesc title:(cls name)
  1598        list add:(MenuDesc title:(cls name)
  1599                           value:(ctr printString)
  1599 			  value:(ctr printString)
  1600                          action:[self doSelectNextOfApplicationClass:cls startingIn:item]
  1600 			 action:[self doSelectNextOfApplicationClass:cls startingIn:item]
  1601                  ).
  1601 		 ).
  1602     ].
  1602     ].
  1603 
  1603 
  1604     menu := MenuDesc buildFromList:list onGC:aMenu.
  1604     menu := MenuDesc buildFromList:list onGC:aMenu.
  1605     menu do:[:el|
  1605     menu do:[:el|
  1606         el hideMenuOnActivated:false
  1606 	el hideMenuOnActivated:false
  1607     ].
  1607     ].
  1608     ^ menu
  1608     ^ menu
  1609 !
  1609 !
  1610 
  1610 
  1611 submenuComponents:aMenu
  1611 submenuComponents:aMenu
  1612     |widgets list total menu item|
  1612     |widgets list total menu item|
  1613 
  1613 
  1614     item := aMenu selection nameKey == #single ifTrue:[model selectedItem]
  1614     item := aMenu selection nameKey == #single ifTrue:[model selectedItem]
  1615                                               ifFalse:[model rootItem].
  1615 					      ifFalse:[model rootItem].
  1616     item isNil ifTrue:[^ nil].
  1616     item isNil ifTrue:[^ nil].
  1617 
  1617 
  1618     widgets := IdentityDictionary new.
  1618     widgets := IdentityDictionary new.
  1619     total   := 0.
  1619     total   := 0.
  1620 
  1620 
  1621     item recursiveDo:[:el| |cls ctr|
  1621     item recursiveDo:[:el| |cls ctr|
  1622         cls := el widget.
  1622 	cls := el widget.
  1623 
  1623 
  1624         cls notNil ifTrue:[
  1624 	cls notNil ifTrue:[
  1625             cls := cls class.
  1625 	    cls := cls class.
  1626             ctr := widgets at:cls ifAbsent:0.
  1626 	    ctr := widgets at:cls ifAbsent:0.
  1627             widgets at:cls put:(ctr + 1).
  1627 	    widgets at:cls put:(ctr + 1).
  1628             total := total + 1.
  1628 	    total := total + 1.
  1629         ].
  1629 	].
  1630     ].
  1630     ].
  1631     total == 0 ifTrue:[^ nil].
  1631     total == 0 ifTrue:[^ nil].
  1632     list := SortedCollection sortBlock:[:a :b| a title < b title ].
  1632     list := SortedCollection sortBlock:[:a :b| a title < b title ].
  1633 
  1633 
  1634     widgets keysAndValuesDo:[:cls :ctr|
  1634     widgets keysAndValuesDo:[:cls :ctr|
  1635         list add:(MenuDesc title:(cls name)
  1635 	list add:(MenuDesc title:(cls name)
  1636                            value:(ctr printString)
  1636 			   value:(ctr printString)
  1637                           action:[self doSelectNextOfClass:cls startingIn:item]
  1637 			  action:[self doSelectNextOfClass:cls startingIn:item]
  1638                  ).
  1638 		 ).
  1639     ].
  1639     ].
  1640     list := list asOrderedCollection.
  1640     list := list asOrderedCollection.
  1641     list add:(MenuDesc separator).
  1641     list add:(MenuDesc separator).
  1642     list add:(MenuDesc title:'Total' value:(total printString)).
  1642     list add:(MenuDesc title:'Total' value:(total printString)).
  1643     menu := MenuDesc buildFromList:list onGC:aMenu.
  1643     menu := MenuDesc buildFromList:list onGC:aMenu.
  1644     menu do:[:el|
  1644     menu do:[:el|
  1645         el hideMenuOnActivated:false
  1645 	el hideMenuOnActivated:false
  1646     ].
  1646     ].
  1647     ^ menu
  1647     ^ menu
  1648 !
  1648 !
  1649 
  1649 
  1650 submenuGeometry:aMenu
  1650 submenuGeometry:aMenu
  1663 
  1663 
  1664     x := view left.
  1664     x := view left.
  1665     y := view top.
  1665     y := view top.
  1666 
  1666 
  1667     (x == point x and:[y == point y]) ifTrue:[ inst := point ]
  1667     (x == point x and:[y == point y]) ifTrue:[ inst := point ]
  1668                                      ifFalse:[ inst := '%1 --> (%2@%3)' bindWith:point with:x with:y ].
  1668 				     ifFalse:[ inst := '%1 --> (%2@%3)' bindWith:point with:x with:y ].
  1669 
  1669 
  1670     list add:(MenuDesc title:'origin' value:inst).
  1670     list add:(MenuDesc title:'origin' value:inst).
  1671 
  1671 
  1672     "/ corner
  1672     "/ corner
  1673     point := view relativeCorner.
  1673     point := view relativeCorner.
  1675 
  1675 
  1676     x := view right.
  1676     x := view right.
  1677     y := view bottom.
  1677     y := view bottom.
  1678 
  1678 
  1679     (x == point x and:[y == point y]) ifTrue:[ inst := point ]
  1679     (x == point x and:[y == point y]) ifTrue:[ inst := point ]
  1680                                      ifFalse:[ inst := '%1 --> (%2@%3)' bindWith:point with:x with:y ].
  1680 				     ifFalse:[ inst := '%1 --> (%2@%3)' bindWith:point with:x with:y ].
  1681 
  1681 
  1682     list add:(MenuDesc title:'corner' value:inst).
  1682     list add:(MenuDesc title:'corner' value:inst).
  1683 
  1683 
  1684     "/ extent
  1684     "/ extent
  1685     (point := view relativeExtent) isNil ifTrue:[point := view extent].
  1685     (point := view relativeExtent) isNil ifTrue:[point := view extent].
  1689     list add:(MenuDesc title:'pref. extent' value:(view preferredExtent)).
  1689     list add:(MenuDesc title:'pref. extent' value:(view preferredExtent)).
  1690     list add:(MenuDesc separator).
  1690     list add:(MenuDesc separator).
  1691 
  1691 
  1692     "/ view insets
  1692     "/ view insets
  1693     inst := 'l:%1  r:%2  t:%3  b:%4' bindWith:(view leftInset)
  1693     inst := 'l:%1  r:%2  t:%3  b:%4' bindWith:(view leftInset)
  1694                                          with:(view rightInset)
  1694 					 with:(view rightInset)
  1695                                          with:(view topInset)
  1695 					 with:(view topInset)
  1696                                          with:(view bottomInset).
  1696 					 with:(view bottomInset).
  1697 
  1697 
  1698     list add:(MenuDesc title:'insets'      value:inst).
  1698     list add:(MenuDesc title:'insets'      value:inst).
  1699     list add:(MenuDesc title:'borderWidth' value:(view borderWidth)).
  1699     list add:(MenuDesc title:'borderWidth' value:(view borderWidth)).
  1700     list add:(MenuDesc title:'level'       value:(view level)).
  1700     list add:(MenuDesc title:'level'       value:(view level)).
  1701     list add:(MenuDesc separator).
  1701     list add:(MenuDesc separator).
  1705 
  1705 
  1706     (inst := view transformation) notNil ifTrue:[ inst := inst displayString ].
  1706     (inst := view transformation) notNil ifTrue:[ inst := inst displayString ].
  1707     list add:(MenuDesc title:'transformation' value:inst).
  1707     list add:(MenuDesc title:'transformation' value:inst).
  1708 
  1708 
  1709     (view isKindOf:Label) ifTrue:[
  1709     (view isKindOf:Label) ifTrue:[
  1710         list add:(MenuDesc separator).
  1710 	list add:(MenuDesc separator).
  1711         (inst := view adjust) notNil ifTrue:[ inst := inst displayString ].
  1711 	(inst := view adjust) notNil ifTrue:[ inst := inst displayString ].
  1712         list add:(MenuDesc title:'adjust' value:inst).
  1712 	list add:(MenuDesc title:'adjust' value:inst).
  1713     ].
  1713     ].
  1714     (view isKindOf:PanelView) ifTrue:[
  1714     (view isKindOf:PanelView) ifTrue:[
  1715         list add:(MenuDesc separator).
  1715 	list add:(MenuDesc separator).
  1716         (inst := view horizontalLayout ) notNil ifTrue:[ inst := inst displayString ].
  1716 	(inst := view horizontalLayout ) notNil ifTrue:[ inst := inst displayString ].
  1717         list add:(MenuDesc title:'horizontalLayout' value:inst).
  1717 	list add:(MenuDesc title:'horizontalLayout' value:inst).
  1718         (inst := view verticalLayout ) notNil ifTrue:[ inst := inst displayString ].
  1718 	(inst := view verticalLayout ) notNil ifTrue:[ inst := inst displayString ].
  1719         list add:(MenuDesc title:'verticalLayout' value:inst).
  1719 	list add:(MenuDesc title:'verticalLayout' value:inst).
  1720     ].
  1720     ].
  1721 
  1721 
  1722     ^ MenuDesc buildFromList:list onGC:aMenu
  1722     ^ MenuDesc buildFromList:list onGC:aMenu
  1723 !
  1723 !
  1724 
  1724 
  1737     names := view class allInstVarNames.
  1737     names := view class allInstVarNames.
  1738     indices := (1 to:names size) asArray.
  1738     indices := (1 to:names size) asArray.
  1739     names sortWith:indices.
  1739     names sortWith:indices.
  1740 
  1740 
  1741     1 to:n do:[:i| |action|
  1741     1 to:n do:[:i| |action|
  1742         label := (names at:i) printString.
  1742 	label := (names at:i) printString.
  1743         value := view instVarAt:(indices at:i).
  1743 	value := view instVarAt:(indices at:i).
  1744         value isNil ifTrue:[
  1744 	value isNil ifTrue:[
  1745             value  := '------'.
  1745 	    value  := '------'.
  1746             action := nil.
  1746 	    action := nil.
  1747         ] ifFalse:[
  1747 	] ifFalse:[
  1748             value  := value displayString contractAtEndTo:40.
  1748 	    value  := value displayString contractAtEndTo:40.
  1749             action := [(view instVarAt:i) inspect].
  1749 	    action := [(view instVarAt:i) inspect].
  1750         ].
  1750 	].
  1751         list add:(MenuDesc title:label value:value action:action).
  1751 	list add:(MenuDesc title:label value:value action:action).
  1752     ].
  1752     ].
  1753 
  1753 
  1754     ^ MenuDesc buildFromList:list onGC:aMenu
  1754     ^ MenuDesc buildFromList:list onGC:aMenu
  1755 
  1755 
  1756     "Modified: / 31-07-2013 / 13:12:52 / cg"
  1756     "Modified: / 31-07-2013 / 13:12:52 / cg"
  1768 
  1768 
  1769     inst  := view controller.
  1769     inst  := view controller.
  1770     value := nil.
  1770     value := nil.
  1771 
  1771 
  1772     inst isNil ifTrue:[
  1772     inst isNil ifTrue:[
  1773         label := nil
  1773 	label := nil
  1774     ] ifFalse:[
  1774     ] ifFalse:[
  1775         inst == view ifTrue:[ 
  1775 	inst == view ifTrue:[
  1776             label := '== view itself' 
  1776 	    label := '== view itself'
  1777         ] ifFalse:[ 
  1777 	] ifFalse:[
  1778             label := inst displayString.
  1778 	    label := inst displayString.
  1779             value := [view controller inspect].
  1779 	    value := [view controller inspect].
  1780         ].
  1780 	].
  1781     ].
  1781     ].
  1782     list add:(MenuDesc title:'controller' value:label action:value).
  1782     list add:(MenuDesc title:'controller' value:label action:value).
  1783 
  1783 
  1784     inst := view delegate.
  1784     inst := view delegate.
  1785     inst notNil ifTrue:[
  1785     inst notNil ifTrue:[
  1786         list add:(MenuDesc title:'delegate' value:(inst displayString) action:[ view delegate inspect ]).
  1786 	list add:(MenuDesc title:'delegate' value:(inst displayString) action:[ view delegate inspect ]).
  1787     ].
  1787     ].
  1788 
  1788 
  1789     inst := view application.
  1789     inst := view application.
  1790 
  1790 
  1791     inst notNil ifTrue:[ 
  1791     inst notNil ifTrue:[
  1792         |topAppl|
  1792 	|topAppl|
  1793 
  1793 
  1794         list add:(MenuDesc title:'application' value:inst action:[ view application inspect ]).
  1794 	list add:(MenuDesc title:'application' value:inst action:[ view application inspect ]).
  1795 
  1795 
  1796         topAppl := inst topApplication.
  1796 	topAppl := inst topApplication.
  1797 
  1797 
  1798         (topAppl notNil and:[topAppl ~~ inst]) ifTrue:[
  1798 	(topAppl notNil and:[topAppl ~~ inst]) ifTrue:[
  1799             list add:(MenuDesc title:'topApplication' value:topAppl action:[ inst topApplication inspect ]).
  1799 	    list add:(MenuDesc title:'topApplication' value:topAppl action:[ inst topApplication inspect ]).
  1800         ].
  1800 	].
  1801     ].
  1801     ].
  1802     list add:(MenuDesc separator).
  1802     list add:(MenuDesc separator).
  1803 
  1803 
  1804     (view respondsTo:#'model') ifTrue:[
  1804     (view respondsTo:#'model') ifTrue:[
  1805         inst := view model.
  1805 	inst := view model.
  1806 
  1806 
  1807         inst isNil 
  1807 	inst isNil
  1808             ifTrue:[ label := value := nil ]
  1808 	    ifTrue:[ label := value := nil ]
  1809             ifFalse:[ label := inst displayString.
  1809 	    ifFalse:[ label := inst displayString.
  1810                       label := label,(self aspectLabelFor:inst inApplicationOf:view).  
  1810 		      label := label,(self aspectLabelFor:inst inApplicationOf:view).
  1811                       value := [ view model inspect ].
  1811 		      value := [ view model inspect ].
  1812                     ].
  1812 		    ].
  1813 
  1813 
  1814         list add:(MenuDesc title:'model' value:label action:value).
  1814 	list add:(MenuDesc title:'model' value:label action:value).
  1815 
  1815 
  1816         (inst notNil and:[view respondsTo:#modelInterface]) ifTrue:[
  1816 	(inst notNil and:[view respondsTo:#modelInterface]) ifTrue:[
  1817             view modelInterface keysAndValuesDo:[:key : val|
  1817 	    view modelInterface keysAndValuesDo:[:key : val|
  1818                 val isNil ifTrue:[ label := nil ]
  1818 		val isNil ifTrue:[ label := nil ]
  1819                          ifFalse:[ label := val displayString ].
  1819 			 ifFalse:[ label := val displayString ].
  1820 
  1820 
  1821                 list add:(MenuDesc title:('      - ', key) value:label ).
  1821 		list add:(MenuDesc title:('      - ', key) value:label ).
  1822             ]
  1822 	    ]
  1823         ].
  1823 	].
  1824     ].
  1824     ].
  1825 
  1825 
  1826     (view respondsTo:#enableChannel) ifTrue:[
  1826     (view respondsTo:#enableChannel) ifTrue:[
  1827         inst := view enableChannel.
  1827 	inst := view enableChannel.
  1828 
  1828 
  1829         inst isNil ifTrue:[ label := value := nil ]
  1829 	inst isNil ifTrue:[ label := value := nil ]
  1830                   ifFalse:[ label := inst displayString.
  1830 		  ifFalse:[ label := inst displayString.
  1831                             label := label,(self aspectLabelFor:inst inApplicationOf:view).  
  1831 			    label := label,(self aspectLabelFor:inst inApplicationOf:view).
  1832                             value := [ view enableChannel inspect ].
  1832 			    value := [ view enableChannel inspect ].
  1833                           ].
  1833 			  ].
  1834 
  1834 
  1835         list add:(MenuDesc title:'enableChannel' value:label action:value).
  1835 	list add:(MenuDesc title:'enableChannel' value:label action:value).
  1836     ].
  1836     ].
  1837 
  1837 
  1838     #( #action #pressAction #releaseAction ) do:[:actionSelector |
  1838     #( #action #pressAction #releaseAction ) do:[:actionSelector |
  1839         (view respondsTo:actionSelector) ifTrue:[
  1839 	(view respondsTo:actionSelector) ifTrue:[
  1840             inst := view perform:actionSelector.
  1840 	    inst := view perform:actionSelector.
  1841 
  1841 
  1842             inst isNil 
  1842 	    inst isNil
  1843                 ifTrue:[ label := value := nil ]
  1843 		ifTrue:[ label := value := nil ]
  1844                 ifFalse:[ label := inst displayString.
  1844 		ifFalse:[ label := inst displayString.
  1845                             value := [ (view perform:actionSelector) inspect ].
  1845 			    value := [ (view perform:actionSelector) inspect ].
  1846                         ].
  1846 			].
  1847 
  1847 
  1848             list add:(MenuDesc title:actionSelector"'action'" value:label action:value).
  1848 	    list add:(MenuDesc title:actionSelector"'action'" value:label action:value).
  1849         ].
  1849 	].
  1850     ].
  1850     ].
  1851 
  1851 
  1852     list last isSeparator ifFalse:[ list add:(MenuDesc separator) ].
  1852     list last isSeparator ifFalse:[ list add:(MenuDesc separator) ].
  1853 
  1853 
  1854     (view respondsTo:#listHolder) ifTrue:[
  1854     (view respondsTo:#listHolder) ifTrue:[
  1855         inst := view listHolder.
  1855 	inst := view listHolder.
  1856 
  1856 
  1857         inst isNil ifTrue:[ label := value := nil ]
  1857 	inst isNil ifTrue:[ label := value := nil ]
  1858                   ifFalse:[ label := inst class printString.
  1858 		  ifFalse:[ label := inst class printString.
  1859                             label := label,(self aspectLabelFor:inst inApplicationOf:view).  
  1859 			    label := label,(self aspectLabelFor:inst inApplicationOf:view).
  1860                             value := [ view listHolder inspect ].
  1860 			    value := [ view listHolder inspect ].
  1861                           ].
  1861 			  ].
  1862         list add:(MenuDesc title:'listHolder' value:label action:value).
  1862 	list add:(MenuDesc title:'listHolder' value:label action:value).
  1863     ].
  1863     ].
  1864 
  1864 
  1865     (view respondsTo:#list) ifTrue:[
  1865     (view respondsTo:#list) ifTrue:[
  1866         inst := view list.
  1866 	inst := view list.
  1867 
  1867 
  1868         inst isNil ifTrue:[ label := value := nil ]
  1868 	inst isNil ifTrue:[ label := value := nil ]
  1869                   ifFalse:[ label := '%1 [%2]' bindWith:(inst class printString) with:(inst size).
  1869 		  ifFalse:[ label := '%1 [%2]' bindWith:(inst class printString) with:(inst size).
  1870                             label := label,(self aspectLabelFor:inst inApplicationOf:view).  
  1870 			    label := label,(self aspectLabelFor:inst inApplicationOf:view).
  1871                             value := [ view list inspect ].
  1871 			    value := [ view list inspect ].
  1872                           ].
  1872 			  ].
  1873 
  1873 
  1874         list add:(MenuDesc title:'list' value:label action:value).
  1874 	list add:(MenuDesc title:'list' value:label action:value).
  1875     ].
  1875     ].
  1876 
  1876 
  1877     list last isSeparator ifTrue:[ list removeLast ].
  1877     list last isSeparator ifTrue:[ list removeLast ].
  1878     ^ MenuDesc buildFromList:list onGC:aMenu
  1878     ^ MenuDesc buildFromList:list onGC:aMenu
  1879 
  1879 
  1888     item := self selectedMenuItem.
  1888     item := self selectedMenuItem.
  1889     item isNil ifTrue:[^ nil].
  1889     item isNil ifTrue:[^ nil].
  1890 
  1890 
  1891     list := OrderedCollection new.
  1891     list := OrderedCollection new.
  1892 
  1892 
  1893     list add:(MenuDesc 
  1893     list add:(MenuDesc
  1894                 title:'itemValue' 
  1894 		title:'itemValue'
  1895                 value:(item itemValue)
  1895 		value:(item itemValue)
  1896                 action:[ 
  1896 		action:[
  1897                     UserPreferences systemBrowserClass
  1897 		    UserPreferences systemBrowserClass
  1898                         browseImplementorsOf:item itemValue
  1898 			browseImplementorsOf:item itemValue
  1899                 ]).
  1899 		]).
  1900 
  1900 
  1901     ^ MenuDesc buildFromList:list onGC:aMenu
  1901     ^ MenuDesc buildFromList:list onGC:aMenu
  1902 
  1902 
  1903     "Created: / 16-08-2017 / 13:51:05 / cg"
  1903     "Created: / 16-08-2017 / 13:51:05 / cg"
  1904 !
  1904 !
  1925     list add:(MenuDesc separator).
  1925     list add:(MenuDesc separator).
  1926 
  1926 
  1927     list add:(MenuDesc title:'hiddenOnRealize' value:(view isHiddenOnRealize)).
  1927     list add:(MenuDesc title:'hiddenOnRealize' value:(view isHiddenOnRealize)).
  1928 
  1928 
  1929     (value := view visibilityChannel) isNil ifTrue:[
  1929     (value := view visibilityChannel) isNil ifTrue:[
  1930         list add:(MenuDesc title:'visibilityChannel' value:'------').
  1930 	list add:(MenuDesc title:'visibilityChannel' value:'------').
  1931     ] ifFalse:[
  1931     ] ifFalse:[
  1932         list add:(MenuDesc title:'visibilityChannel'
  1932 	list add:(MenuDesc title:'visibilityChannel'
  1933                            value:(value displayString)
  1933 			   value:(value displayString)
  1934                           action:[view visibilityChannel inspect]).
  1934 			  action:[view visibilityChannel inspect]).
  1935     ].
  1935     ].
  1936 
  1936 
  1937     ^ MenuDesc buildFromList:list onGC:aMenu
  1937     ^ MenuDesc buildFromList:list onGC:aMenu
  1938 ! !
  1938 ! !
  1939 
  1939 
  1944 
  1944 
  1945     aModel isNil ifTrue:[^ ''].
  1945     aModel isNil ifTrue:[^ ''].
  1946     aView isNil ifTrue:[^ ''].
  1946     aView isNil ifTrue:[^ ''].
  1947     (app := aView application) isNil ifTrue:[^ ''].
  1947     (app := aView application) isNil ifTrue:[^ ''].
  1948     app builder bindings keysAndValuesDo:[:aspect :value |
  1948     app builder bindings keysAndValuesDo:[:aspect :value |
  1949         value == aModel ifTrue:[^ ' [aspect: ',aspect,']'].
  1949 	value == aModel ifTrue:[^ ' [aspect: ',aspect,']'].
  1950     ].
  1950     ].
  1951     app class allInstVarNames do:[:nm | 
  1951     app class allInstVarNames do:[:nm |
  1952         (app instVarNamed:nm) == aModel ifTrue:[^ ' [instvar: ',nm,']']
  1952 	(app instVarNamed:nm) == aModel ifTrue:[^ ' [instvar: ',nm,']']
  1953     ].
  1953     ].
  1954 
  1954 
  1955     ^ ''
  1955     ^ ''
  1956 
  1956 
  1957     "Created: / 27-04-2012 / 14:22:09 / cg"
  1957     "Created: / 27-04-2012 / 14:22:09 / cg"
  1961     |rootView focusView|
  1961     |rootView focusView|
  1962 
  1962 
  1963     rootView := model rootView.
  1963     rootView := model rootView.
  1964 
  1964 
  1965     (rootView notNil and:[rootView shown]) ifTrue:[
  1965     (rootView notNil and:[rootView shown]) ifTrue:[
  1966         focusView := rootView windowGroup focusView.
  1966 	focusView := rootView windowGroup focusView.
  1967     ].
  1967     ].
  1968     focusView isNil ifTrue:[^ self ].
  1968     focusView isNil ifTrue:[^ self ].
  1969 
  1969 
  1970     self selectView:focusView
  1970     self selectView:focusView
  1971 !
  1971 !
  1974     |currentItem viewItem|
  1974     |currentItem viewItem|
  1975 
  1975 
  1976     currentItem := model selectedItem.
  1976     currentItem := model selectedItem.
  1977 
  1977 
  1978     (currentItem notNil and:[currentItem widget == aView]) ifTrue:[
  1978     (currentItem notNil and:[currentItem widget == aView]) ifTrue:[
  1979         ^ self
  1979 	^ self
  1980     ].
  1980     ].
  1981     viewItem := model listOfItems recursiveDetect:[:el| el widget == aView ].
  1981     viewItem := model listOfItems recursiveDetect:[:el| el widget == aView ].
  1982 
  1982 
  1983     viewItem notNil ifTrue:[
  1983     viewItem notNil ifTrue:[
  1984         model selectItem:viewItem.
  1984 	model selectItem:viewItem.
  1985     ].        
  1985     ].
  1986 !
  1986 !
  1987 
  1987 
  1988 setRootItem:aRootItemOrNil
  1988 setRootItem:aRootItemOrNil
  1989     |theProcess|
  1989     |theProcess|
  1990 
  1990 
  1991     aRootItemOrNil isNil ifTrue:[
  1991     aRootItemOrNil isNil ifTrue:[
  1992         process := nil.
  1992 	process := nil.
  1993     ] ifFalse:[
  1993     ] ifFalse:[
  1994         "/ expand tree to level 3
  1994 	"/ expand tree to level 3
  1995         aRootItemOrNil do:[:aRootChild|
  1995 	aRootItemOrNil do:[:aRootChild|
  1996             aRootChild do:[:aSubChild| aSubChild expand ].
  1996 	    aRootChild do:[:aSubChild| aSubChild expand ].
  1997             aRootChild expand.
  1997 	    aRootChild expand.
  1998         ].
  1998 	].
  1999         aRootItemOrNil expand.
  1999 	aRootItemOrNil expand.
  2000 
  2000 
  2001         process isNil ifTrue:[
  2001 	process isNil ifTrue:[
  2002             theProcess := process :=
  2002 	    theProcess := process :=
  2003                 Process 
  2003 		Process
  2004                     for:[   
  2004 		    for:[
  2005                         |update testModeChannel|
  2005 			|update testModeChannel|
  2006 
  2006 
  2007                         update := false.
  2007 			update := false.
  2008                         testModeChannel := model testModeChannel.
  2008 			testModeChannel := model testModeChannel.
  2009 
  2009 
  2010                         [process == theProcess] whileTrue:[
  2010 			[process == theProcess] whileTrue:[
  2011                             Delay waitForSeconds:0.5.
  2011 			    Delay waitForSeconds:0.5.
  2012 
  2012 
  2013                             (treeView notNil and:[process == theProcess and:[treeView shown]]) ifTrue:[
  2013 			    (treeView notNil and:[process == theProcess and:[treeView shown]]) ifTrue:[
  2014                                 (testModeChannel value == true and:[followFocusChannel value == true]) ifTrue:[
  2014 				(testModeChannel value == true and:[followFocusChannel value == true]) ifTrue:[
  2015                                     self selectFocusView.
  2015 				    self selectFocusView.
  2016                                 ].
  2016 				].
  2017                                 update ifTrue:[
  2017 				update ifTrue:[
  2018                                     self updateShownStatus.
  2018 				    self updateShownStatus.
  2019                                 ].
  2019 				].
  2020                                 update := update not.
  2020 				update := update not.
  2021                             ].
  2021 			    ].
  2022                         ].
  2022 			].
  2023                     ] 
  2023 		    ]
  2024                     priority:(Processor userSchedulingPriority).
  2024 		    priority:(Processor userSchedulingPriority).
  2025             theProcess name:'ViewTreeInspector - Focus Follower'.
  2025 	    theProcess name:'ViewTreeInspector - Focus Follower'.
  2026             theProcess resume.
  2026 	    theProcess resume.
  2027         ].
  2027 	].
  2028     ].
  2028     ].
  2029     model rootItem:aRootItemOrNil.
  2029     model rootItem:aRootItemOrNil.
  2030 
  2030 
  2031     "Modified: / 25-07-2013 / 12:03:44 / cg"
  2031     "Modified: / 25-07-2013 / 12:03:44 / cg"
  2032 !
  2032 !
  2039 
  2039 
  2040     max := 0.
  2040     max := 0.
  2041     min := 9999999.
  2041     min := 9999999.
  2042 
  2042 
  2043     rootItem recursiveEachVisibleItemDo:[:anItem|
  2043     rootItem recursiveEachVisibleItemDo:[:anItem|
  2044         anItem widget notNil ifTrue:[
  2044 	anItem widget notNil ifTrue:[
  2045             visState := (anItem widget shown).
  2045 	    visState := (anItem widget shown).
  2046 
  2046 
  2047             visState ~~ anItem isDrawnShown ifTrue:[
  2047 	    visState ~~ anItem isDrawnShown ifTrue:[
  2048                 anItem isDrawnShown:visState.
  2048 		anItem isDrawnShown:visState.
  2049                 listIdx := treeView identityIndexOf:anItem.
  2049 		listIdx := treeView identityIndexOf:anItem.
  2050 
  2050 
  2051                 listIdx > 0 ifTrue:[    
  2051 		listIdx > 0 ifTrue:[
  2052                     max := max max:listIdx.
  2052 		    max := max max:listIdx.
  2053                     min := min min:listIdx.
  2053 		    min := min min:listIdx.
  2054                 ].
  2054 		].
  2055             ].
  2055 	    ].
  2056         ].
  2056 	].
  2057     ].
  2057     ].
  2058     max < min ifTrue:[^ self].
  2058     max < min ifTrue:[^ self].
  2059     max := max + 1.
  2059     max := max + 1.
  2060 
  2060 
  2061     visY0  := (treeView yVisibleOfLine:min) max:0.
  2061     visY0  := (treeView yVisibleOfLine:min) max:0.
  2062     visY1  := (treeView yVisibleOfLine:max) min:(treeView height).
  2062     visY1  := (treeView yVisibleOfLine:max) min:(treeView height).
  2063     height := visY1 - visY0.
  2063     height := visY1 - visY0.
  2064     
  2064 
  2065     height > 2 ifTrue:[
  2065     height > 2 ifTrue:[
  2066         treeView shown ifTrue:[
  2066 	treeView shown ifTrue:[
  2067             damage := Rectangle left:0 top:visY0 width:(treeView width) height:height.
  2067 	    damage := Rectangle left:0 top:visY0 width:(treeView width) height:height.
  2068             treeView invalidateDeviceRectangle:damage repairNow:false.
  2068 	    treeView invalidateDeviceRectangle:damage repairNow:false.
  2069         ].
  2069 	].
  2070     ].
  2070     ].
  2071 
  2071 
  2072     "Modified: / 16-08-2017 / 12:29:15 / cg"
  2072     "Modified: / 16-08-2017 / 12:29:15 / cg"
  2073 ! !
  2073 ! !
  2074 
  2074 
  2116 
  2116 
  2117 !ViewTreeInspectorApplication methodsFor:'user operations'!
  2117 !ViewTreeInspectorApplication methodsFor:'user operations'!
  2118 
  2118 
  2119 doBrowse:what
  2119 doBrowse:what
  2120     "open browser on:
  2120     "open browser on:
  2121         #view           browse class
  2121 	#view           browse class
  2122         #model          browse model class
  2122 	#model          browse model class
  2123         #application    browse application class
  2123 	#application    browse application class
  2124         #controller     browse controller class
  2124 	#controller     browse controller class
  2125     "
  2125     "
  2126     |inst|
  2126     |inst|
  2127 
  2127 
  2128     (inst := self objectToInspectOrBrowse:what) isNil ifTrue:[^ self].
  2128     (inst := self objectToInspectOrBrowse:what) isNil ifTrue:[^ self].
  2129     inst class browserClass openInClass:(inst class) selector:nil
  2129     inst class browserClass openInClass:(inst class) selector:nil
  2139 !
  2139 !
  2140 
  2140 
  2141 doCatchEvents
  2141 doCatchEvents
  2142     model catchEvents:true.
  2142     model catchEvents:true.
  2143     isCatchingEventsChannel value:true.
  2143     isCatchingEventsChannel value:true.
  2144 "/    ((builder componentAt:'toolbarMenu') itemAt:#doUncatchEvents) 
  2144 "/    ((builder componentAt:'toolbarMenu') itemAt:#doUncatchEvents)
  2145 "/        enabled:true;
  2145 "/        enabled:true;
  2146 "/        label:(self class releaseViewIcon);
  2146 "/        label:(self class releaseViewIcon);
  2147 "/        activeHelpKey:#doUncatchEvents.
  2147 "/        activeHelpKey:#doUncatchEvents.
  2148 !
  2148 !
  2149 
  2149 
  2167     item isNil ifTrue:[ ^ self].
  2167     item isNil ifTrue:[ ^ self].
  2168 
  2168 
  2169     parent := item parent.
  2169     parent := item parent.
  2170 
  2170 
  2171     parent isNil ifTrue:[
  2171     parent isNil ifTrue:[
  2172         "/ the root
  2172 	"/ the root
  2173         model withSelectionHiddenDo:[item deleteAll].
  2173 	model withSelectionHiddenDo:[item deleteAll].
  2174       ^ self
  2174       ^ self
  2175     ].
  2175     ].
  2176 
  2176 
  2177     model withSelectionHiddenDo:[
  2177     model withSelectionHiddenDo:[
  2178         |idx nsel|
  2178 	|idx nsel|
  2179 
  2179 
  2180         idx := parent identityIndexOf:item.
  2180 	idx := parent identityIndexOf:item.
  2181 
  2181 
  2182         idx == parent size ifTrue:[
  2182 	idx == parent size ifTrue:[
  2183             nsel := parent at:(idx - 1) ifAbsent:parent
  2183 	    nsel := parent at:(idx - 1) ifAbsent:parent
  2184         ] ifFalse:[
  2184 	] ifFalse:[
  2185             nsel := parent at:(idx + 1)
  2185 	    nsel := parent at:(idx + 1)
  2186         ].
  2186 	].
  2187         model setValue:nil.
  2187 	model setValue:nil.
  2188         item delete.
  2188 	item delete.
  2189 
  2189 
  2190         parent isLayoutContainer ifTrue:[
  2190 	parent isLayoutContainer ifTrue:[
  2191             parent widget sizeChanged:nil
  2191 	    parent widget sizeChanged:nil
  2192         ].
  2192 	].
  2193         model value:nsel.
  2193 	model value:nsel.
  2194     ].
  2194     ].
  2195 !
  2195 !
  2196 
  2196 
  2197 doEditWindowSpec
  2197 doEditWindowSpec
  2198     |mthd|
  2198     |mthd|
  2208 
  2208 
  2209     view := self selectedView.
  2209     view := self selectedView.
  2210     view isNil ifTrue:[ ^ self].
  2210     view isNil ifTrue:[ ^ self].
  2211 
  2211 
  2212     view shown ifTrue:[
  2212     view shown ifTrue:[
  2213         model withSelectionHiddenDo:[
  2213 	model withSelectionHiddenDo:[
  2214             view perform:#flash ifNotUnderstood:nil.
  2214 	    view perform:#flash ifNotUnderstood:nil.
  2215         ].
  2215 	].
  2216     ].
  2216     ].
  2217 !
  2217 !
  2218 
  2218 
  2219 doInspect:what
  2219 doInspect:what
  2220     "open inspector on:
  2220     "open inspector on:
  2221         #view           inspect class
  2221 	#view           inspect class
  2222         #group          inspect windowGroup
  2222 	#group          inspect windowGroup
  2223         #model          inspect model
  2223 	#model          inspect model
  2224         #application    inspect application
  2224 	#application    inspect application
  2225         #controller     inspect controller
  2225 	#controller     inspect controller
  2226         #process        inspect application's process
  2226 	#process        inspect application's process
  2227     "
  2227     "
  2228 
  2228 
  2229     |inst|
  2229     |inst|
  2230 
  2230 
  2231     (inst := self objectToInspectOrBrowse:what) isNil ifTrue:[^ self].
  2231     (inst := self objectToInspectOrBrowse:what) isNil ifTrue:[^ self].
  2256     topWindow := clickedView topView.
  2256     topWindow := clickedView topView.
  2257 
  2257 
  2258     (    topWindow == Screen current rootView
  2258     (    topWindow == Screen current rootView
  2259      or:[topWindow == self window topView]
  2259      or:[topWindow == self window topView]
  2260     ) ifTrue:[
  2260     ) ifTrue:[
  2261         ^ self
  2261 	^ self
  2262     ].
  2262     ].
  2263 
  2263 
  2264     self showWindow:clickedView.
  2264     self showWindow:clickedView.
  2265 !
  2265 !
  2266 
  2266 
  2267 doRedraw
  2267 doRedraw
  2268     "redraw the app"
  2268     "redraw the app"
  2269 
  2269 
  2270     |rootView|
  2270     |rootView|
  2271     
  2271 
  2272     (rootView := model rootView) notNil ifTrue:[
  2272     (rootView := model rootView) notNil ifTrue:[
  2273         rootView withAllSubViewsDo:[:v | v "redraw; "invalidate].
  2273 	rootView withAllSubViewsDo:[:v | v "redraw; "invalidate].
  2274     ]
  2274     ]
  2275 
  2275 
  2276     "Modified: / 16-08-2017 / 12:02:11 / cg"
  2276     "Modified: / 16-08-2017 / 12:02:11 / cg"
  2277 !
  2277 !
  2278 
  2278 
  2279 doSelectNextElementStartingIn:anItem forWhich:aBlock
  2279 doSelectNextElementStartingIn:anItem forWhich:aBlock
  2280     |startItem firstFound searchNext|
  2280     |startItem firstFound searchNext|
  2281 
  2281 
  2282     startItem  := model last.
  2282     startItem  := model last.
  2283     searchNext := startItem notNil.        
  2283     searchNext := startItem notNil.
  2284     firstFound := nil.
  2284     firstFound := nil.
  2285 
  2285 
  2286     anItem recursiveDo:[:el|
  2286     anItem recursiveDo:[:el|
  2287         el == startItem ifTrue:[
  2287 	el == startItem ifTrue:[
  2288             searchNext := false
  2288 	    searchNext := false
  2289         ] ifFalse:[
  2289 	] ifFalse:[
  2290             (aBlock value:el) ifTrue:[
  2290 	    (aBlock value:el) ifTrue:[
  2291                 searchNext ifFalse:[^ model selectItem:el].
  2291 		searchNext ifFalse:[^ model selectItem:el].
  2292 
  2292 
  2293                 firstFound isNil ifTrue:[
  2293 		firstFound isNil ifTrue:[
  2294                     firstFound := el
  2294 		    firstFound := el
  2295                 ]
  2295 		]
  2296             ]
  2296 	    ]
  2297         ]
  2297 	]
  2298     ].
  2298     ].
  2299     firstFound notNil ifTrue:[
  2299     firstFound notNil ifTrue:[
  2300         self window beep.
  2300 	self window beep.
  2301         model selectItem:firstFound
  2301 	model selectItem:firstFound
  2302     ].
  2302     ].
  2303 !
  2303 !
  2304 
  2304 
  2305 doSelectNextOfApplicationClass:aClass startingIn:anItem
  2305 doSelectNextOfApplicationClass:aClass startingIn:anItem
  2306     self doSelectNextElementStartingIn:anItem forWhich:[:el | (self resolveApplicationClassFor:el) == aClass].
  2306     self doSelectNextElementStartingIn:anItem forWhich:[:el | (self resolveApplicationClassFor:el) == aClass].
  2313 doUncatchEvents
  2313 doUncatchEvents
  2314     "release the inspected window (no longer catch its events)"
  2314     "release the inspected window (no longer catch its events)"
  2315 
  2315 
  2316     model catchEvents:false.
  2316     model catchEvents:false.
  2317     isCatchingEventsChannel value:false.
  2317     isCatchingEventsChannel value:false.
  2318 "/    ((builder componentAt:'toolbarMenu') itemAt:#doUncatchEvents) 
  2318 "/    ((builder componentAt:'toolbarMenu') itemAt:#doUncatchEvents)
  2319 "/        label:(self class releaseViewIcon);
  2319 "/        label:(self class releaseViewIcon);
  2320 "/        enabled:false;
  2320 "/        enabled:false;
  2321 "/        activeHelpKey:#doCatchEvents.
  2321 "/        activeHelpKey:#doCatchEvents.
  2322     self doRedraw
  2322     self doRedraw
  2323 !
  2323 !
  2328     self setRootItem:nil.
  2328     self setRootItem:nil.
  2329 !
  2329 !
  2330 
  2330 
  2331 objectToInspectOrBrowse:what
  2331 objectToInspectOrBrowse:what
  2332     "return one of:
  2332     "return one of:
  2333         #view           for inspect/browse view/widget
  2333 	#view           for inspect/browse view/widget
  2334         #group          for inspect/browse windowGroup
  2334 	#group          for inspect/browse windowGroup
  2335         #model          for inspect/browse model
  2335 	#model          for inspect/browse model
  2336         #application    for inspect/browse application
  2336 	#application    for inspect/browse application
  2337         #controller     for inspect/browse controller
  2337 	#controller     for inspect/browse controller
  2338         #process        for inspect/browse application's process
  2338 	#process        for inspect/browse application's process
  2339         #widgetClass    for inspect/browse widget's class
  2339 	#widgetClass    for inspect/browse widget's class
  2340         #menuItem       for inspect/browse menuItem
  2340 	#menuItem       for inspect/browse menuItem
  2341     "
  2341     "
  2342     |view|
  2342     |view|
  2343 
  2343 
  2344     what == #menuItem       ifTrue:[ 
  2344     what == #menuItem       ifTrue:[
  2345         ^ model selectedItem menuItem
  2345 	^ model selectedItem menuItem
  2346     ].
  2346     ].
  2347 
  2347 
  2348     view := self selectedView.
  2348     view := self selectedView.
  2349     view isNil ifTrue:[^ nil].
  2349     view isNil ifTrue:[^ nil].
  2350 
  2350 
  2395     tabSpec positions:(Array with:0 with:w).
  2395     tabSpec positions:(Array with:0 with:w).
  2396 
  2396 
  2397     menu := Menu new.
  2397     menu := Menu new.
  2398 
  2398 
  2399     aList do:[:el|
  2399     aList do:[:el|
  2400         menu addItem:(el asMenuItemWithTabulatorSpecification:tabSpec).
  2400 	menu addItem:(el asMenuItemWithTabulatorSpecification:tabSpec).
  2401     ].
  2401     ].
  2402     menuPanel := MenuPanel menu:menu.
  2402     menuPanel := MenuPanel menu:menu.
  2403     ^ menuPanel
  2403     ^ menuPanel
  2404 ! !
  2404 ! !
  2405 
  2405 
  2431     title isNil ifTrue:[ ^ MenuItem label:value ].     "/ separator
  2431     title isNil ifTrue:[ ^ MenuItem label:value ].     "/ separator
  2432 
  2432 
  2433     array := Array with:(title, ':') with:'------'.
  2433     array := Array with:(title, ':') with:'------'.
  2434 
  2434 
  2435     value notNil ifTrue:[
  2435     value notNil ifTrue:[
  2436         array at:2 put:(value printString, ' ')
  2436 	array at:2 put:(value printString, ' ')
  2437     ].
  2437     ].
  2438 
  2438 
  2439    ^ MenuItem 
  2439    ^ MenuItem
  2440         label:(MultiColListEntry fromStrings:array tabulatorSpecification:aTabSpec)
  2440 	label:(MultiColListEntry fromStrings:array tabulatorSpecification:aTabSpec)
  2441         value:action
  2441 	value:action
  2442 ! !
  2442 ! !
  2443 
  2443 
  2444 !ViewTreeInspectorApplication::MenuDesc methodsFor:'instance creation'!
  2444 !ViewTreeInspectorApplication::MenuDesc methodsFor:'instance creation'!
  2445 
  2445 
  2446 title:aTitle value:aValue action:anAction
  2446 title:aTitle value:aValue action:anAction
  2448     "
  2448     "
  2449     title  := aTitle withoutSeparators.
  2449     title  := aTitle withoutSeparators.
  2450     action := anAction.
  2450     action := anAction.
  2451 
  2451 
  2452     aValue notNil ifTrue:[
  2452     aValue notNil ifTrue:[
  2453         value := aValue printString.
  2453 	value := aValue printString.
  2454 
  2454 
  2455         value size > 70 ifTrue:[
  2455 	value size > 70 ifTrue:[
  2456             value := value copyFrom:1 to:70.
  2456 	    value := value copyFrom:1 to:70.
  2457             value := value, '...'
  2457 	    value := value, '...'
  2458         ]
  2458 	]
  2459     ].
  2459     ].
  2460 ! !
  2460 ! !
  2461 
  2461 
  2462 !ViewTreeInspectorApplication::MenuDesc methodsFor:'queries'!
  2462 !ViewTreeInspectorApplication::MenuDesc methodsFor:'queries'!
  2463 
  2463 
  2481     aMenuItem isNil ifTrue:[^ nil].
  2481     aMenuItem isNil ifTrue:[^ nil].
  2482 
  2482 
  2483     item     := self forMenuItem:aMenuItem.
  2483     item     := self forMenuItem:aMenuItem.
  2484     subItems := OrderedCollection new.
  2484     subItems := OrderedCollection new.
  2485     (subMenu := aMenuItem submenuOrNil) notNil ifTrue:[
  2485     (subMenu := aMenuItem submenuOrNil) notNil ifTrue:[
  2486         subMenu items do:[:eachMenuItem |
  2486 	subMenu items do:[:eachMenuItem |
  2487             subItems add:(self buildMenuItemsFrom:eachMenuItem)
  2487 	    subItems add:(self buildMenuItemsFrom:eachMenuItem)
  2488         ].    
  2488 	].
  2489     ].
  2489     ].
  2490     item children:subItems.
  2490     item children:subItems.
  2491     ^ item
  2491     ^ item
  2492 
  2492 
  2493     "Created: / 16-08-2017 / 12:23:02 / cg"
  2493     "Created: / 16-08-2017 / 12:23:02 / cg"
  2504     item     := self forView:aView.
  2504     item     := self forView:aView.
  2505     subViews := aView subViews.
  2505     subViews := aView subViews.
  2506     subItems := OrderedCollection new.
  2506     subItems := OrderedCollection new.
  2507 
  2507 
  2508     subViews notEmptyOrNil ifTrue:[
  2508     subViews notEmptyOrNil ifTrue:[
  2509         subViews do:[:aSubView|
  2509 	subViews do:[:aSubView|
  2510             subItems add:(self buildViewsFrom:aSubView).
  2510 	    subItems add:(self buildViewsFrom:aSubView).
  2511         ].
  2511 	].
  2512     ].
  2512     ].
  2513 
  2513 
  2514     (aView isKindOf:MenuPanel) ifTrue:[
  2514     (aView isKindOf:MenuPanel) ifTrue:[
  2515         (aView items ? #()) do:[:eachMenuItem |
  2515 	(aView items ? #()) do:[:eachMenuItem |
  2516             subItems add:(self buildMenuItemsFrom:eachMenuItem)
  2516 	    subItems add:(self buildMenuItemsFrom:eachMenuItem)
  2517         ].    
  2517 	].
  2518     ].    
  2518     ].
  2519     item children:subItems.
  2519     item children:subItems.
  2520     
  2520 
  2521     ^ item
  2521     ^ item
  2522 
  2522 
  2523     "Modified: / 16-08-2017 / 12:43:35 / cg"
  2523     "Modified: / 16-08-2017 / 12:43:35 / cg"
  2524 ! !
  2524 ! !
  2525 
  2525 
  2529 "
  2529 "
  2530     ViewTreeItems represants a pickable object within a ViewTreeModel.
  2530     ViewTreeItems represants a pickable object within a ViewTreeModel.
  2531     The class is used to build up the hierarchical tree.
  2531     The class is used to build up the hierarchical tree.
  2532 
  2532 
  2533     [Instance variables:]
  2533     [Instance variables:]
  2534         widget        <View>            the widget represented by the item
  2534 	widget        <View>            the widget represented by the item
  2535         spec          <UISpecification> the UISpecification or nil
  2535 	spec          <UISpecification> the UISpecification or nil
  2536 
  2536 
  2537     [Class variables:]
  2537     [Class variables:]
  2538         HandleExtent  <Point>           keeps the extent of a handle
  2538 	HandleExtent  <Point>           keeps the extent of a handle
  2539 
  2539 
  2540 
  2540 
  2541     [author:]
  2541     [author:]
  2542         Claus Atzkern
  2542 	Claus Atzkern
  2543 
  2543 
  2544     [see also:]
  2544     [see also:]
  2545         HierarchicalItem
  2545 	HierarchicalItem
  2546         ViewTreeModel
  2546 	ViewTreeModel
  2547 "
  2547 "
  2548 !
  2548 !
  2549 
  2549 
  2550 version
  2550 version
  2551     ^ '$Header$'
  2551     ^ '$Header$'
  2598 
  2598 
  2599 applicationClass
  2599 applicationClass
  2600     |appl|
  2600     |appl|
  2601 
  2601 
  2602     widget notNil ifTrue:[
  2602     widget notNil ifTrue:[
  2603         appl := widget application.
  2603 	appl := widget application.
  2604         appl notNil ifTrue:[^ appl class ].
  2604 	appl notNil ifTrue:[^ appl class ].
  2605     ].
  2605     ].
  2606     ^ nil
  2606     ^ nil
  2607 !
  2607 !
  2608 
  2608 
  2609 isDrawnShown
  2609 isDrawnShown
  2636 
  2636 
  2637 specClass
  2637 specClass
  2638     "returns the spec-class assigned to the item
  2638     "returns the spec-class assigned to the item
  2639     "
  2639     "
  2640     widget isNil ifTrue:[
  2640     widget isNil ifTrue:[
  2641         ^ MenuPanelSpec 
  2641 	^ MenuPanelSpec
  2642     ].
  2642     ].
  2643     ^ widget specClass
  2643     ^ widget specClass
  2644 
  2644 
  2645     "Modified (format): / 16-08-2017 / 12:31:36 / cg"
  2645     "Modified (format): / 16-08-2017 / 12:31:36 / cg"
  2646 !
  2646 !
  2682      superView cannot resize its sub widgets
  2682      superView cannot resize its sub widgets
  2683     "
  2683     "
  2684     |layout specClass superView|
  2684     |layout specClass superView|
  2685 
  2685 
  2686     (superView := widget superView) isNil ifTrue:[
  2686     (superView := widget superView) isNil ifTrue:[
  2687         ^ #Extent
  2687 	^ #Extent
  2688     ].
  2688     ].
  2689         
  2689 
  2690     specClass := superView specClass.
  2690     specClass := superView specClass.
  2691 
  2691 
  2692     (specClass notNil and:[specClass isLayoutContainer]) ifTrue:[
  2692     (specClass notNil and:[specClass isLayoutContainer]) ifTrue:[
  2693         ^ specClass canResizeSubComponents ifTrue:[#Extent] ifFalse:[nil]
  2693 	^ specClass canResizeSubComponents ifTrue:[#Extent] ifFalse:[nil]
  2694     ].
  2694     ].
  2695 
  2695 
  2696     (layout := widget geometryLayout) isNil ifTrue:[
  2696     (layout := widget geometryLayout) isNil ifTrue:[
  2697         ^ #Extent
  2697 	^ #Extent
  2698     ].
  2698     ].
  2699 
  2699 
  2700     layout isLayout ifTrue:[
  2700     layout isLayout ifTrue:[
  2701         layout isLayoutFrame        ifTrue:[ ^ #LayoutFrame ].
  2701 	layout isLayoutFrame        ifTrue:[ ^ #LayoutFrame ].
  2702         layout isAlignmentOrigin    ifTrue:[ ^ #AlignmentOrigin ].
  2702 	layout isAlignmentOrigin    ifTrue:[ ^ #AlignmentOrigin ].
  2703         layout isLayoutOrigin       ifTrue:[ ^ #LayoutOrigin ].
  2703 	layout isLayoutOrigin       ifTrue:[ ^ #LayoutOrigin ].
  2704     ] ifFalse:[
  2704     ] ifFalse:[
  2705         layout isRectangle          ifTrue:[ ^ #Rectangle ].
  2705 	layout isRectangle          ifTrue:[ ^ #Rectangle ].
  2706         layout isPoint              ifTrue:[ ^ #Point ].
  2706 	layout isPoint              ifTrue:[ ^ #Point ].
  2707 
  2707 
  2708     ].
  2708     ].
  2709     Transcript showCR:'UNSUPPORTRD LAYOUT: ', layout printString.
  2709     Transcript showCR:'UNSUPPORTRD LAYOUT: ', layout printString.
  2710   ^ nil
  2710   ^ nil
  2711 !
  2711 !
  2728     "not only a query; also builds"
  2728     "not only a query; also builds"
  2729 
  2729 
  2730     |subViews list item subMenu|
  2730     |subViews list item subMenu|
  2731 
  2731 
  2732     children isNil ifTrue:[
  2732     children isNil ifTrue:[
  2733         isExpanded := false.
  2733 	isExpanded := false.
  2734 
  2734 
  2735         list := OrderedCollection new.
  2735 	list := OrderedCollection new.
  2736 
  2736 
  2737         "/ it's either a widget or a menuItem
  2737 	"/ it's either a widget or a menuItem
  2738         widget notNil ifTrue:[
  2738 	widget notNil ifTrue:[
  2739             subViews := widget subViews.
  2739 	    subViews := widget subViews.
  2740             subViews notEmptyOrNil ifTrue:[
  2740 	    subViews notEmptyOrNil ifTrue:[
  2741                 subViews do:[:aSubView|
  2741 		subViews do:[:aSubView|
  2742                     item := self class buildViewsFrom:aSubView.
  2742 		    item := self class buildViewsFrom:aSubView.
  2743                     item parent:self.
  2743 		    item parent:self.
  2744                     list add:item.
  2744 		    list add:item.
  2745                 ].
  2745 		].
  2746             ].
  2746 	    ].
  2747         ].
  2747 	].
  2748 
  2748 
  2749         menuItem notNil ifTrue:[ 
  2749 	menuItem notNil ifTrue:[
  2750             (subMenu := menuItem submenuOrNil) notNil ifTrue:[
  2750 	    (subMenu := menuItem submenuOrNil) notNil ifTrue:[
  2751                 subMenu items do:[:aSubItem|
  2751 		subMenu items do:[:aSubItem|
  2752                     item := self class buildMenuItemsFrom:aSubItem.
  2752 		    item := self class buildMenuItemsFrom:aSubItem.
  2753                     item parent:self.
  2753 		    item parent:self.
  2754                     list add:item.
  2754 		    list add:item.
  2755                 ].
  2755 		].
  2756             ].
  2756 	    ].
  2757         ].
  2757 	].
  2758         children := list.
  2758 	children := list.
  2759     ].
  2759     ].
  2760     ^ children notEmpty
  2760     ^ children notEmpty
  2761 
  2761 
  2762     "Modified: / 16-08-2017 / 12:27:23 / cg"
  2762     "Modified: / 16-08-2017 / 12:27:23 / cg"
  2763 !
  2763 !
  2772 
  2772 
  2773 additionalLabelForItem:anItem
  2773 additionalLabelForItem:anItem
  2774     "answer an additional label for an Item"
  2774     "answer an additional label for an Item"
  2775 
  2775 
  2776     parent notNil ifTrue:[
  2776     parent notNil ifTrue:[
  2777         ^ parent additionalLabelForItem:anItem
  2777 	^ parent additionalLabelForItem:anItem
  2778     ].
  2778     ].
  2779     ^ nil
  2779     ^ nil
  2780 !
  2780 !
  2781 
  2781 
  2782 displayIcon:anIcon atX:x y:y on:aGC
  2782 displayIcon:anIcon atX:x y:y on:aGC
  2783     |x0 y0 y1 w|
  2783     |x0 y0 y1 w|
  2784 
  2784 
  2785     super displayIcon:anIcon atX:x y:y on:aGC.
  2785     super displayIcon:anIcon atX:x y:y on:aGC.
  2786 
  2786 
  2787     self exists ifFalse:[
  2787     self exists ifFalse:[
  2788         aGC paint:(Color red).
  2788 	aGC paint:(Color red).
  2789 
  2789 
  2790         y0 := y + 1.
  2790 	y0 := y + 1.
  2791         y1 := y + anIcon height - 2.
  2791 	y1 := y + anIcon height - 2.
  2792 
  2792 
  2793         x0 := x - 1.
  2793 	x0 := x - 1.
  2794         w  := anIcon width.
  2794 	w  := anIcon width.
  2795 
  2795 
  2796         2 timesRepeat:[
  2796 	2 timesRepeat:[
  2797             aGC displayLineFromX:x0 y:y0 toX:(x0 + w) y:y1.
  2797 	    aGC displayLineFromX:x0 y:y0 toX:(x0 + w) y:y1.
  2798             aGC displayLineFromX:x0 y:y1 toX:(x0 + w) y:y0.
  2798 	    aGC displayLineFromX:x0 y:y1 toX:(x0 + w) y:y0.
  2799             x0 := x0 + 1.
  2799 	    x0 := x0 + 1.
  2800         ].
  2800 	].
  2801     ].
  2801     ].
  2802 !
  2802 !
  2803 
  2803 
  2804 displayOn:aGC x:x y:y h:h isHighlightedAsSelected:isHighlightedAsSelected
  2804 displayOn:aGC x:x y:y h:h isHighlightedAsSelected:isHighlightedAsSelected
  2805     |labelHeight additionalName label isValidAndShown|
  2805     |labelHeight additionalName label isValidAndShown|
  2806 
  2806 
  2807     label := self label.
  2807     label := self label.
  2808     label isEmptyOrNil ifTrue:[^ self].
  2808     label isEmptyOrNil ifTrue:[^ self].
  2809 
  2809 
  2810     widget isNil ifTrue:[
  2810     widget isNil ifTrue:[
  2811         isValidAndShown := true.
  2811 	isValidAndShown := true.
  2812     ] ifFalse:[
  2812     ] ifFalse:[
  2813         widget id isNil ifTrue:[
  2813 	widget id isNil ifTrue:[
  2814             isDrawnShown := false.
  2814 	    isDrawnShown := false.
  2815 
  2815 
  2816             self exists ifFalse:[
  2816 	    self exists ifFalse:[
  2817                 xOffsetAdditionalName := nil.
  2817 		xOffsetAdditionalName := nil.
  2818             ].
  2818 	    ].
  2819             isValidAndShown := false.
  2819 	    isValidAndShown := false.
  2820         ] ifFalse:[
  2820 	] ifFalse:[
  2821             isValidAndShown := widget shown.
  2821 	    isValidAndShown := widget shown.
  2822         ].
  2822 	].
  2823     ].
  2823     ].
  2824     
  2824 
  2825     isValidAndShown ifFalse:[
  2825     isValidAndShown ifFalse:[
  2826         label := Text string:label emphasis:#italic.
  2826 	label := Text string:label emphasis:#italic.
  2827         label colorizeAllWith:Color gray.
  2827 	label colorizeAllWith:Color gray.
  2828     ].
  2828     ].
  2829 
  2829 
  2830     labelHeight := self heightOn:aGC.
  2830     labelHeight := self heightOn:aGC.
  2831     self displayLabel:label h:labelHeight on:aGC x:x y:y h:h isHighlightedAsSelected:isHighlightedAsSelected.
  2831     self displayLabel:label h:labelHeight on:aGC x:x y:y h:h isHighlightedAsSelected:isHighlightedAsSelected.
  2832 
  2832 
  2833     xOffsetAdditionalName notNil ifTrue:[
  2833     xOffsetAdditionalName notNil ifTrue:[
  2834         additionalName := self additionalLabelForItem:self.
  2834 	additionalName := self additionalLabelForItem:self.
  2835 
  2835 
  2836         additionalName notNil ifTrue:[
  2836 	additionalName notNil ifTrue:[
  2837             self displayLabel:additionalName
  2837 	    self displayLabel:additionalName
  2838                             h:labelHeight on:aGC
  2838 			    h:labelHeight on:aGC
  2839                             x:(x + xOffsetAdditionalName) y:y
  2839 			    x:(x + xOffsetAdditionalName) y:y
  2840                             h:h.
  2840 			    h:h.
  2841         ] ifFalse:[
  2841 	] ifFalse:[
  2842             xOffsetAdditionalName := nil.
  2842 	    xOffsetAdditionalName := nil.
  2843         ].
  2843 	].
  2844     ].
  2844     ].
  2845 
  2845 
  2846     "Modified (format): / 16-08-2017 / 12:57:39 / cg"
  2846     "Modified (format): / 16-08-2017 / 12:57:39 / cg"
  2847 !
  2847 !
  2848 
  2848 
  2849 recursiveAdditionalNameBehaviourChanged
  2849 recursiveAdditionalNameBehaviourChanged
  2850     width := xOffsetAdditionalName := nil.
  2850     width := xOffsetAdditionalName := nil.
  2851 
  2851 
  2852     children notNil ifTrue:[
  2852     children notNil ifTrue:[
  2853         children do:[:each| each recursiveAdditionalNameBehaviourChanged ]
  2853 	children do:[:each| each recursiveAdditionalNameBehaviourChanged ]
  2854     ].
  2854     ].
  2855 !
  2855 !
  2856 
  2856 
  2857 widthOn:aGC
  2857 widthOn:aGC
  2858     "return the width of the receiver, if it is to be displayed on aGC
  2858     "return the width of the receiver, if it is to be displayed on aGC
  2859     "
  2859     "
  2860     |additionalName|
  2860     |additionalName|
  2861 
  2861 
  2862     width isNil ifTrue:[
  2862     width isNil ifTrue:[
  2863         width := self widthOf:(self label) on:aGC.
  2863 	width := self widthOf:(self label) on:aGC.
  2864         width := width + 2.
  2864 	width := width + 2.
  2865 
  2865 
  2866         additionalName := self additionalLabelForItem:self.
  2866 	additionalName := self additionalLabelForItem:self.
  2867 
  2867 
  2868         additionalName notNil ifTrue:[
  2868 	additionalName notNil ifTrue:[
  2869             xOffsetAdditionalName := width + 10.
  2869 	    xOffsetAdditionalName := width + 10.
  2870             width := xOffsetAdditionalName + (self widthOf:additionalName on:aGC).
  2870 	    width := xOffsetAdditionalName + (self widthOf:additionalName on:aGC).
  2871             width := width + 2.
  2871 	    width := width + 2.
  2872         ] ifFalse:[
  2872 	] ifFalse:[
  2873             xOffsetAdditionalName := nil.
  2873 	    xOffsetAdditionalName := nil.
  2874         ].
  2874 	].
  2875     ].
  2875     ].
  2876     ^ width
  2876     ^ width
  2877 ! !
  2877 ! !
  2878 
  2878 
  2879 !ViewTreeInspectorApplication::ViewTreeItem methodsFor:'enumerating'!
  2879 !ViewTreeInspectorApplication::ViewTreeItem methodsFor:'enumerating'!
  2882     "evaluate the two arg block on each handle; the arguments to the block is
  2882     "evaluate the two arg block on each handle; the arguments to the block is
  2883      the rectangle relative to the rootView and the handle type which is
  2883      the rectangle relative to the rootView and the handle type which is
  2884      set to nil if not resizeable.
  2884      set to nil if not resizeable.
  2885 
  2885 
  2886      TYPES:     type    position( X - Y )
  2886      TYPES:     type    position( X - Y )
  2887                 -------------------------        
  2887 		-------------------------
  2888                 #LT     Left   - Top
  2888 		#LT     Left   - Top
  2889                 #LC     Left   - Center
  2889 		#LC     Left   - Center
  2890                 #LB     Left   - Bottom
  2890 		#LB     Left   - Bottom
  2891                 #CT     Center - Top
  2891 		#CT     Center - Top
  2892                 #CB     Center - Bottom
  2892 		#CB     Center - Bottom
  2893                 #RT     Right  - Top
  2893 		#RT     Right  - Top
  2894                 #RC     Right  - Center
  2894 		#RC     Right  - Center
  2895                 #RB     Right  - Bottom
  2895 		#RB     Right  - Bottom
  2896 
  2896 
  2897                 nil     ** handle not pickable **
  2897 		nil     ** handle not pickable **
  2898     "
  2898     "
  2899     |type relOrg relCrn maxExt rootView w h
  2899     |type relOrg relCrn maxExt rootView w h
  2900      xL    "{ Class:SmallInteger }"
  2900      xL    "{ Class:SmallInteger }"
  2901      xC    "{ Class:SmallInteger }"
  2901      xC    "{ Class:SmallInteger }"
  2902      xR    "{ Class:SmallInteger }"
  2902      xR    "{ Class:SmallInteger }"
  2927     type := self layoutType.
  2927     type := self layoutType.
  2928     w   := HandleExtent x.
  2928     w   := HandleExtent x.
  2929     h   := HandleExtent y.
  2929     h   := HandleExtent y.
  2930 
  2930 
  2931     (type == #LayoutFrame or:[type == #Rectangle]) ifTrue:[
  2931     (type == #LayoutFrame or:[type == #Rectangle]) ifTrue:[
  2932         aTwoArgAction value:(Rectangle left:xL top:yT width:w height:h) value:#LT.
  2932 	aTwoArgAction value:(Rectangle left:xL top:yT width:w height:h) value:#LT.
  2933         aTwoArgAction value:(Rectangle left:xL top:yC width:w height:h) value:#LC.
  2933 	aTwoArgAction value:(Rectangle left:xL top:yC width:w height:h) value:#LC.
  2934         aTwoArgAction value:(Rectangle left:xL top:yB width:w height:h) value:#LB.
  2934 	aTwoArgAction value:(Rectangle left:xL top:yB width:w height:h) value:#LB.
  2935         aTwoArgAction value:(Rectangle left:xC top:yT width:w height:h) value:#CT.
  2935 	aTwoArgAction value:(Rectangle left:xC top:yT width:w height:h) value:#CT.
  2936         aTwoArgAction value:(Rectangle left:xC top:yB width:w height:h) value:#CB.
  2936 	aTwoArgAction value:(Rectangle left:xC top:yB width:w height:h) value:#CB.
  2937         aTwoArgAction value:(Rectangle left:xR top:yT width:w height:h) value:#RT.
  2937 	aTwoArgAction value:(Rectangle left:xR top:yT width:w height:h) value:#RT.
  2938         aTwoArgAction value:(Rectangle left:xR top:yC width:w height:h) value:#RC.
  2938 	aTwoArgAction value:(Rectangle left:xR top:yC width:w height:h) value:#RC.
  2939         aTwoArgAction value:(Rectangle left:xR top:yB width:w height:h) value:#RB.
  2939 	aTwoArgAction value:(Rectangle left:xR top:yB width:w height:h) value:#RB.
  2940       ^ self
  2940       ^ self
  2941     ].
  2941     ].
  2942 
  2942 
  2943     aTwoArgAction value:(Rectangle left:xL top:yT width:w height:h) value:nil.
  2943     aTwoArgAction value:(Rectangle left:xL top:yT width:w height:h) value:nil.
  2944     aTwoArgAction value:(Rectangle left:xL top:yB width:w height:h) value:nil.
  2944     aTwoArgAction value:(Rectangle left:xL top:yB width:w height:h) value:nil.
  2945     aTwoArgAction value:(Rectangle left:xR top:yT width:w height:h) value:nil.
  2945     aTwoArgAction value:(Rectangle left:xR top:yT width:w height:h) value:nil.
  2946 
  2946 
  2947     type == #Extent ifTrue:[
  2947     type == #Extent ifTrue:[
  2948         aTwoArgAction value:(Rectangle left:xC top:yB width:w height:h) value:#CB.
  2948 	aTwoArgAction value:(Rectangle left:xC top:yB width:w height:h) value:#CB.
  2949         aTwoArgAction value:(Rectangle left:xR top:yC width:w height:h) value:#RC.
  2949 	aTwoArgAction value:(Rectangle left:xR top:yC width:w height:h) value:#RC.
  2950         aTwoArgAction value:(Rectangle left:xR top:yB width:w height:h) value:#RB.
  2950 	aTwoArgAction value:(Rectangle left:xR top:yB width:w height:h) value:#RB.
  2951       ^ self
  2951       ^ self
  2952     ].
  2952     ].
  2953     aTwoArgAction value:(Rectangle left:xR top:yB width:w height:h) value:nil.
  2953     aTwoArgAction value:(Rectangle left:xR top:yB width:w height:h) value:nil.
  2954 
  2954 
  2955     "Modified: / 16-08-2017 / 13:04:27 / cg"
  2955     "Modified: / 16-08-2017 / 13:04:27 / cg"
  2957 
  2957 
  2958 recursiveEachVisibleItemDo:anOneArgBlock
  2958 recursiveEachVisibleItemDo:anOneArgBlock
  2959     "recursive evaluate the block on each child which is visible
  2959     "recursive evaluate the block on each child which is visible
  2960     "
  2960     "
  2961     (isExpanded and:[children size > 0]) ifTrue:[
  2961     (isExpanded and:[children size > 0]) ifTrue:[
  2962         children do:[:aChild|
  2962 	children do:[:aChild|
  2963             anOneArgBlock value:aChild.
  2963 	    anOneArgBlock value:aChild.
  2964             aChild recursiveEachVisibleItemDo:anOneArgBlock.
  2964 	    aChild recursiveEachVisibleItemDo:anOneArgBlock.
  2965         ]
  2965 	]
  2966     ].
  2966     ].
  2967 !
  2967 !
  2968 
  2968 
  2969 subViewsDo:aOneArgBlock
  2969 subViewsDo:aOneArgBlock
  2970     "evaluate aBlock for all subviews other than InputView's   
  2970     "evaluate aBlock for all subviews other than InputView's
  2971     "
  2971     "
  2972     |subViews|
  2972     |subViews|
  2973 
  2973 
  2974     subViews := widget subViews.
  2974     subViews := widget subViews.
  2975 
  2975 
  2976     subViews notNil ifTrue:[
  2976     subViews notNil ifTrue:[
  2977         subViews do:aOneArgBlock
  2977 	subViews do:aOneArgBlock
  2978     ].
  2978     ].
  2979 ! !
  2979 ! !
  2980 
  2980 
  2981 !ViewTreeInspectorApplication::ViewTreeItem methodsFor:'initialization'!
  2981 !ViewTreeInspectorApplication::ViewTreeItem methodsFor:'initialization'!
  2982 
  2982 
  3004 delete
  3004 delete
  3005     "delete self and all contained items; the assigned views are destroyed
  3005     "delete self and all contained items; the assigned views are destroyed
  3006      in case of rootView, only the children are deleted
  3006      in case of rootView, only the children are deleted
  3007     "
  3007     "
  3008     parent isHierarchicalItem ifTrue:[
  3008     parent isHierarchicalItem ifTrue:[
  3009         self criticalDo:[
  3009 	self criticalDo:[
  3010             parent remove:self.
  3010 	    parent remove:self.
  3011             widget destroy.
  3011 	    widget destroy.
  3012         ]
  3012 	]
  3013     ] ifFalse:[
  3013     ] ifFalse:[
  3014         self deleteAll
  3014 	self deleteAll
  3015     ].
  3015     ].
  3016 !
  3016 !
  3017 
  3017 
  3018 deleteAll
  3018 deleteAll
  3019     "delete all contained items; the assigned views are destroyed
  3019     "delete all contained items; the assigned views are destroyed
  3020     "
  3020     "
  3021     children size == 0 ifTrue:[^ self].
  3021     children size == 0 ifTrue:[^ self].
  3022 
  3022 
  3023     self criticalDo:[
  3023     self criticalDo:[
  3024         self nonCriticalDo:[:el| el widget destroy ].
  3024 	self nonCriticalDo:[:el| el widget destroy ].
  3025         self removeAll
  3025 	self removeAll
  3026     ].
  3026     ].
  3027 ! !
  3027 ! !
  3028 
  3028 
  3029 !ViewTreeInspectorApplication::ViewTreeItem methodsFor:'operations layout'!
  3029 !ViewTreeInspectorApplication::ViewTreeItem methodsFor:'operations layout'!
  3030 
  3030 
  3034     |extent layout newLyt lftFrc lftOff topFrc topOff|
  3034     |extent layout newLyt lftFrc lftOff topFrc topOff|
  3035 
  3035 
  3036     layout := widget geometryLayout.
  3036     layout := widget geometryLayout.
  3037 
  3037 
  3038     layout isNil ifTrue:[
  3038     layout isNil ifTrue:[
  3039         ^ widget bounds asLayout
  3039 	^ widget bounds asLayout
  3040     ].
  3040     ].
  3041 
  3041 
  3042     layout isLayout ifFalse:[
  3042     layout isLayout ifFalse:[
  3043         layout isRectangle ifTrue:[
  3043 	layout isRectangle ifTrue:[
  3044             ^ LayoutFrame leftOffset:(layout left) rightOffset:(layout right)
  3044 	    ^ LayoutFrame leftOffset:(layout left) rightOffset:(layout right)
  3045                            topOffset:(layout top) bottomOffset:(layout bottom)
  3045 			   topOffset:(layout top) bottomOffset:(layout bottom)
  3046         ].
  3046 	].
  3047         layout isPoint ifTrue:[
  3047 	layout isPoint ifTrue:[
  3048             extent := widget extent.
  3048 	    extent := widget extent.
  3049           ^ LayoutFrame leftOffset:(layout x)  rightOffset:(layout x + extent x)
  3049 	  ^ LayoutFrame leftOffset:(layout x)  rightOffset:(layout x + extent x)
  3050                          topOffset:(layout y) bottomOffset:(layout y + extent y)
  3050 			 topOffset:(layout y) bottomOffset:(layout y + extent y)
  3051         ].
  3051 	].
  3052 
  3052 
  3053         Transcript showCR:'UNSUPPORTRD LAYOUT: ', layout printString.
  3053 	Transcript showCR:'UNSUPPORTRD LAYOUT: ', layout printString.
  3054       ^ nil
  3054       ^ nil
  3055     ].
  3055     ].
  3056 
  3056 
  3057     layout isLayoutFrame ifTrue:[ ^ layout copy ].    
  3057     layout isLayoutFrame ifTrue:[ ^ layout copy ].
  3058 
  3058 
  3059     lftFrc := layout leftFraction.
  3059     lftFrc := layout leftFraction.
  3060     lftOff := layout leftOffset.
  3060     lftOff := layout leftOffset.
  3061     topFrc := layout topFraction.
  3061     topFrc := layout topFraction.
  3062     topOff := layout topOffset.
  3062     topOff := layout topOffset.
  3063     extent := widget extent.
  3063     extent := widget extent.
  3064 
  3064 
  3065     newLyt := LayoutFrame leftFraction:lftFrc offset:lftOff
  3065     newLyt := LayoutFrame leftFraction:lftFrc offset:lftOff
  3066                          rightFraction:lftFrc offset:(lftOff + extent x)
  3066 			 rightFraction:lftFrc offset:(lftOff + extent x)
  3067                            topFraction:topFrc offset:topOff
  3067 			   topFraction:topFrc offset:topOff
  3068                         bottomFraction:topFrc offset:(topOff + extent y).
  3068 			bottomFraction:topFrc offset:(topOff + extent y).
  3069 
  3069 
  3070     (      layout isAlignmentOrigin
  3070     (      layout isAlignmentOrigin
  3071      and:[(layout leftAlignmentFraction ~= 0 or:[layout topAlignmentFraction ~= 0])]
  3071      and:[(layout leftAlignmentFraction ~= 0 or:[layout topAlignmentFraction ~= 0])]
  3072     ) ifTrue:[
  3072     ) ifTrue:[
  3073         |svRc prBd dlta|
  3073 	|svRc prBd dlta|
  3074 
  3074 
  3075         svRc := widget superView viewRectangle.
  3075 	svRc := widget superView viewRectangle.
  3076         prBd := widget preferredBounds.
  3076 	prBd := widget preferredBounds.
  3077 
  3077 
  3078         dlta := (  ((layout rectangleRelativeTo:svRc preferred:prBd) corner)
  3078 	dlta := (  ((layout rectangleRelativeTo:svRc preferred:prBd) corner)
  3079                  - ((newLyt rectangleRelativeTo:svRc preferred:prBd) corner)
  3079 		 - ((newLyt rectangleRelativeTo:svRc preferred:prBd) corner)
  3080                 ) rounded.
  3080 		) rounded.
  3081 
  3081 
  3082         newLyt   leftOffset:(lftOff + dlta x).
  3082 	newLyt   leftOffset:(lftOff + dlta x).
  3083         newLyt  rightOffset:(lftOff + extent x + dlta x).
  3083 	newLyt  rightOffset:(lftOff + extent x + dlta x).
  3084         newLyt    topOffset:(topOff + dlta y).
  3084 	newLyt    topOffset:(topOff + dlta y).
  3085         newLyt bottomOffset:(topOff + extent y + dlta y).
  3085 	newLyt bottomOffset:(topOff + extent y + dlta y).
  3086     ].
  3086     ].
  3087     ^ newLyt
  3087     ^ newLyt
  3088 !
  3088 !
  3089 
  3089 
  3090 moveLeft:l top:t
  3090 moveLeft:l top:t
  3093     |layout|
  3093     |layout|
  3094 
  3094 
  3095     self isMoveable ifFalse:[ ^ self ].
  3095     self isMoveable ifFalse:[ ^ self ].
  3096 
  3096 
  3097     (layout := widget geometryLayout) isNil ifTrue:[
  3097     (layout := widget geometryLayout) isNil ifTrue:[
  3098         "Extent"
  3098 	"Extent"
  3099         widget origin:(widget origin + (l@t)).
  3099 	widget origin:(widget origin + (l@t)).
  3100       ^ self
  3100       ^ self
  3101     ].
  3101     ].
  3102 
  3102 
  3103     layout := layout copy.
  3103     layout := layout copy.
  3104 
  3104 
  3105     layout isLayout ifTrue:[
  3105     layout isLayout ifTrue:[
  3106         layout leftOffset:(layout leftOffset + l)
  3106 	layout leftOffset:(layout leftOffset + l)
  3107                 topOffset:(layout topOffset  + t).
  3107 		topOffset:(layout topOffset  + t).
  3108 
  3108 
  3109         layout isLayoutFrame ifTrue:[
  3109 	layout isLayoutFrame ifTrue:[
  3110             layout  rightOffset:(layout rightOffset  + l).
  3110 	    layout  rightOffset:(layout rightOffset  + l).
  3111             layout bottomOffset:(layout bottomOffset + t).
  3111 	    layout bottomOffset:(layout bottomOffset + t).
  3112         ]
  3112 	]
  3113 
  3113 
  3114     ] ifFalse:[
  3114     ] ifFalse:[
  3115         layout isRectangle ifTrue:[
  3115 	layout isRectangle ifTrue:[
  3116             layout setLeft:(layout left + l).
  3116 	    layout setLeft:(layout left + l).
  3117             layout  setTop:(layout top  + t).
  3117 	    layout  setTop:(layout top  + t).
  3118         ] ifFalse:[
  3118 	] ifFalse:[
  3119             layout isPoint ifFalse:[^ self].
  3119 	    layout isPoint ifFalse:[^ self].
  3120             layout x:(layout x + l) y:(layout y + t).
  3120 	    layout x:(layout x + l) y:(layout y + t).
  3121         ]
  3121 	]
  3122     ].
  3122     ].
  3123     widget geometryLayout:layout.
  3123     widget geometryLayout:layout.
  3124 !
  3124 !
  3125 
  3125 
  3126 resizeLeft:l top:t right:r bottom:b
  3126 resizeLeft:l top:t right:r bottom:b
  3127     "resize the widget measured in pixels
  3127     "resize the widget measured in pixels
  3128     "
  3128     "
  3129     |layout|
  3129     |layout|
  3130 
  3130 
  3131     self isResizeable ifFalse:[
  3131     self isResizeable ifFalse:[
  3132         ^ self
  3132 	^ self
  3133     ].
  3133     ].
  3134 
  3134 
  3135     (layout := widget geometryLayout) isNil ifTrue:[
  3135     (layout := widget geometryLayout) isNil ifTrue:[
  3136         "Extent"
  3136 	"Extent"
  3137         (r == l and:[b == t]) ifFalse:[
  3137 	(r == l and:[b == t]) ifFalse:[
  3138             widget extent:(widget computeExtent + ((r-l) @ (b-t))).
  3138 	    widget extent:(widget computeExtent + ((r-l) @ (b-t))).
  3139         ].
  3139 	].
  3140         ^ self
  3140 	^ self
  3141     ].
  3141     ].
  3142 
  3142 
  3143     layout isLayout ifTrue:[
  3143     layout isLayout ifTrue:[
  3144         layout := layout copy.
  3144 	layout := layout copy.
  3145 
  3145 
  3146         layout leftOffset:(layout leftOffset + l)
  3146 	layout leftOffset:(layout leftOffset + l)
  3147                 topOffset:(layout topOffset  + t).
  3147 		topOffset:(layout topOffset  + t).
  3148 
  3148 
  3149         layout isLayoutFrame ifTrue:[
  3149 	layout isLayoutFrame ifTrue:[
  3150             layout bottomOffset:(layout bottomOffset + b).
  3150 	    layout bottomOffset:(layout bottomOffset + b).
  3151             layout  rightOffset:(layout rightOffset  + r).
  3151 	    layout  rightOffset:(layout rightOffset  + r).
  3152         ]
  3152 	]
  3153     ] ifFalse:[
  3153     ] ifFalse:[
  3154         layout isRectangle ifFalse:[^ self].
  3154 	layout isRectangle ifFalse:[^ self].
  3155         layout := layout copy.
  3155 	layout := layout copy.
  3156 
  3156 
  3157         layout left:(layout left   + l)
  3157 	layout left:(layout left   + l)
  3158               right:(layout right  + r)
  3158 	      right:(layout right  + r)
  3159                 top:(layout top    + t)
  3159 		top:(layout top    + t)
  3160              bottom:(layout bottom + b).
  3160 	     bottom:(layout bottom + b).
  3161     ].
  3161     ].
  3162     widget geometryLayout:layout.
  3162     widget geometryLayout:layout.
  3163 ! !
  3163 ! !
  3164 
  3164 
  3165 !ViewTreeInspectorApplication::ViewTreeItem methodsFor:'operations update'!
  3165 !ViewTreeInspectorApplication::ViewTreeItem methodsFor:'operations update'!
  3169 
  3169 
  3170     queue := OrderedCollection new.
  3170     queue := OrderedCollection new.
  3171     queue add:self.
  3171     queue add:self.
  3172 
  3172 
  3173     self criticalDo:[
  3173     self criticalDo:[
  3174         [queue notEmpty] whileTrue:[
  3174 	[queue notEmpty] whileTrue:[
  3175             |toRemove  elProcessed|
  3175 	    |toRemove  elProcessed|
  3176 
  3176 
  3177             elProcessed := queue removeFirst.
  3177 	    elProcessed := queue removeFirst.
  3178             toRemove := nil.
  3178 	    toRemove := nil.
  3179             elProcessed nonCriticalDo:[:el|
  3179 	    elProcessed nonCriticalDo:[:el|
  3180                 el exists ifTrue:[
  3180 		el exists ifTrue:[
  3181                     queue add:el.
  3181 		    queue add:el.
  3182                 ] ifFalse:[
  3182 		] ifFalse:[
  3183                     toRemove isNil ifTrue:[toRemove := OrderedCollection new].
  3183 		    toRemove isNil ifTrue:[toRemove := OrderedCollection new].
  3184                     toRemove add:el.
  3184 		    toRemove add:el.
  3185                 ]
  3185 		]
  3186             ].
  3186 	    ].
  3187             toRemove notNil ifTrue:[
  3187 	    toRemove notNil ifTrue:[
  3188                 toRemove do:[:el| elProcessed remove:el ].
  3188 		toRemove do:[:el| elProcessed remove:el ].
  3189             ].
  3189 	    ].
  3190         ].
  3190 	].
  3191     ].
  3191     ].
  3192 !
  3192 !
  3193 
  3193 
  3194 updateFromChildren:mergedList
  3194 updateFromChildren:mergedList
  3195     "update my children against the list of items derived from
  3195     "update my children against the list of items derived from
  3198 
  3198 
  3199     mergedList size == 0 ifTrue:[ ^ self removeAll ].
  3199     mergedList size == 0 ifTrue:[ ^ self removeAll ].
  3200     children   size == 0 ifTrue:[ ^ self addAll:mergedList ].
  3200     children   size == 0 ifTrue:[ ^ self addAll:mergedList ].
  3201 
  3201 
  3202     self criticalDo:[
  3202     self criticalDo:[
  3203         self nonCriticalDo:[:el| |wdg|
  3203 	self nonCriticalDo:[:el| |wdg|
  3204             wdg := el widget.
  3204 	    wdg := el widget.
  3205             mergedList detect:[:e2| e2 widget == wdg ] ifNone:[ self remove:el ].
  3205 	    mergedList detect:[:e2| e2 widget == wdg ] ifNone:[ self remove:el ].
  3206         ].
  3206 	].
  3207 
  3207 
  3208         mergedList keysAndValuesDo:[:i :el| |wdg e2|
  3208 	mergedList keysAndValuesDo:[:i :el| |wdg e2|
  3209             wdg := el widget.
  3209 	    wdg := el widget.
  3210 
  3210 
  3211             e2  := self at:i ifAbsent:nil.
  3211 	    e2  := self at:i ifAbsent:nil.
  3212 
  3212 
  3213             (e2 isNil or:[e2 widget ~~ wdg]) ifTrue:[
  3213 	    (e2 isNil or:[e2 widget ~~ wdg]) ifTrue:[
  3214                 self add:el beforeIndex:i
  3214 		self add:el beforeIndex:i
  3215             ]
  3215 	    ]
  3216         ]
  3216 	]
  3217     ].
  3217     ].
  3218 ! !
  3218 ! !
  3219 
  3219 
  3220 !ViewTreeInspectorApplication::ViewTreeItem methodsFor:'printing & storing'!
  3220 !ViewTreeInspectorApplication::ViewTreeItem methodsFor:'printing & storing'!
  3221 
  3221 
  3223     "get the icon used for presentation"
  3223     "get the icon used for presentation"
  3224 
  3224 
  3225     |specClass model|
  3225     |specClass model|
  3226 
  3226 
  3227     menuItem notNil ifTrue:[
  3227     menuItem notNil ifTrue:[
  3228         menuItem label isImage ifTrue:[
  3228 	menuItem label isImage ifTrue:[
  3229             ^ menuItem label magnifiedTo:20@20.
  3229 	    ^ menuItem label magnifiedTo:20@20.
  3230         ].    
  3230 	].
  3231     ].
  3231     ].
  3232     
  3232 
  3233     specClass := self specClass.
  3233     specClass := self specClass.
  3234     specClass isNil ifTrue:[^ nil].
  3234     specClass isNil ifTrue:[^ nil].
  3235 
  3235 
  3236     model := self treeModel.
  3236     model := self treeModel.
  3237     model notNil ifTrue:[
  3237     model notNil ifTrue:[
  3238         ^ model iconAt:specClass ifNonePut:[specClass icon]
  3238 	^ model iconAt:specClass ifNonePut:[specClass icon]
  3239     ].
  3239     ].
  3240     ^ specClass icon
  3240     ^ specClass icon
  3241 
  3241 
  3242     "Modified: / 16-08-2017 / 13:00:35 / cg"
  3242     "Modified: / 16-08-2017 / 13:00:35 / cg"
  3243 !
  3243 !
  3256 
  3256 
  3257 string
  3257 string
  3258     "get the string
  3258     "get the string
  3259     "
  3259     "
  3260     widget isNil ifTrue:[
  3260     widget isNil ifTrue:[
  3261         ^ menuItem class name    
  3261 	^ menuItem class name
  3262     ].    
  3262     ].
  3263     ^ widget class name.
  3263     ^ widget class name.
  3264 
  3264 
  3265     "Modified: / 16-08-2017 / 13:45:39 / cg"
  3265     "Modified: / 16-08-2017 / 13:45:39 / cg"
  3266 ! !
  3266 ! !
  3267 
  3267 
  3280     |specClass|
  3280     |specClass|
  3281 
  3281 
  3282     specClass := self specClass.
  3282     specClass := self specClass.
  3283 
  3283 
  3284     specClass notNil ifTrue:[
  3284     specClass notNil ifTrue:[
  3285         ^ specClass canResizeSubComponents
  3285 	^ specClass canResizeSubComponents
  3286     ].
  3286     ].
  3287     ^ false
  3287     ^ false
  3288 !
  3288 !
  3289 
  3289 
  3290 exists
  3290 exists
  3291     widget isNil ifTrue:[^ menuItem notNil].
  3291     widget isNil ifTrue:[^ menuItem notNil].
  3292     widget id notNil ifTrue:[^ true ].
  3292     widget id notNil ifTrue:[^ true ].
  3293 
  3293 
  3294     exists ~~ false ifTrue:[
  3294     exists ~~ false ifTrue:[
  3295         exists := false.
  3295 	exists := false.
  3296 
  3296 
  3297         widget superView notNil ifTrue:[
  3297 	widget superView notNil ifTrue:[
  3298             (parent isHierarchicalItem and:[parent exists]) ifTrue:[
  3298 	    (parent isHierarchicalItem and:[parent exists]) ifTrue:[
  3299                 exists := (parent widget subViews includesIdentical:widget).
  3299 		exists := (parent widget subViews includesIdentical:widget).
  3300             ].
  3300 	    ].
  3301         ].
  3301 	].
  3302     ].
  3302     ].
  3303     ^ exists
  3303     ^ exists
  3304 
  3304 
  3305     "Modified: / 16-08-2017 / 12:47:50 / cg"
  3305     "Modified: / 16-08-2017 / 12:47:50 / cg"
  3306 !
  3306 !
  3309     |cls|
  3309     |cls|
  3310 
  3310 
  3311     cls := widget class.
  3311     cls := widget class.
  3312 
  3312 
  3313     ^ (    cls == ApplicationSubView
  3313     ^ (    cls == ApplicationSubView
  3314         or:[cls == ApplicationWindow
  3314 	or:[cls == ApplicationWindow
  3315         or:[cls == SubCanvas]]
  3315 	or:[cls == SubCanvas]]
  3316       ) 
  3316       )
  3317 !
  3317 !
  3318 
  3318 
  3319 isSelected
  3319 isSelected
  3320     |model|
  3320     |model|
  3321 
  3321 
  3328     "returns true if the widget supports sub components
  3328     "returns true if the widget supports sub components
  3329     "
  3329     "
  3330     |specClass|
  3330     |specClass|
  3331 
  3331 
  3332     widget isScrollWrapper ifTrue:[
  3332     widget isScrollWrapper ifTrue:[
  3333         ^ false
  3333 	^ false
  3334     ].
  3334     ].
  3335     specClass := self specClass.
  3335     specClass := self specClass.
  3336 
  3336 
  3337     specClass notNil ifTrue:[
  3337     specClass notNil ifTrue:[
  3338         ^ specClass supportsSubComponents
  3338 	^ specClass supportsSubComponents
  3339     ].
  3339     ].
  3340     ^ false
  3340     ^ false
  3341 ! !
  3341 ! !
  3342 
  3342 
  3343 !ViewTreeInspectorApplication::ViewTreeItem methodsFor:'testing'!
  3343 !ViewTreeInspectorApplication::ViewTreeItem methodsFor:'testing'!
  3348     |sv specClass|
  3348     |sv specClass|
  3349 
  3349 
  3350     sv := widget superView.
  3350     sv := widget superView.
  3351 
  3351 
  3352     sv notNil ifTrue:[
  3352     sv notNil ifTrue:[
  3353         specClass := sv specClass.
  3353 	specClass := sv specClass.
  3354 
  3354 
  3355         specClass notNil ifTrue:[
  3355 	specClass notNil ifTrue:[
  3356             ^ specClass isLayoutContainer
  3356 	    ^ specClass isLayoutContainer
  3357         ].
  3357 	].
  3358     ].
  3358     ].
  3359     ^ false
  3359     ^ false
  3360 !
  3360 !
  3361 
  3361 
  3362 isLayoutContainer
  3362 isLayoutContainer
  3366     |specClass|
  3366     |specClass|
  3367 
  3367 
  3368     specClass := self specClass.
  3368     specClass := self specClass.
  3369 
  3369 
  3370     specClass notNil ifTrue:[
  3370     specClass notNil ifTrue:[
  3371         ^ specClass isLayoutContainer
  3371 	^ specClass isLayoutContainer
  3372     ].
  3372     ].
  3373     ^ false
  3373     ^ false
  3374 !
  3374 !
  3375 
  3375 
  3376 isMoveable
  3376 isMoveable
  3377     "returns true if the widget is not in a layout container
  3377     "returns true if the widget is not in a layout container
  3378     "
  3378     "
  3379     self isInLayoutContainer ifFalse:[
  3379     self isInLayoutContainer ifFalse:[
  3380         ^ widget superView notNil
  3380 	^ widget superView notNil
  3381     ].
  3381     ].
  3382     ^ false
  3382     ^ false
  3383 !
  3383 !
  3384 
  3384 
  3385 isResizeable
  3385 isResizeable
  3388     |sv specClass|
  3388     |sv specClass|
  3389 
  3389 
  3390     sv := widget superView.
  3390     sv := widget superView.
  3391 
  3391 
  3392     sv notNil ifTrue:[
  3392     sv notNil ifTrue:[
  3393         specClass := sv specClass.
  3393 	specClass := sv specClass.
  3394 
  3394 
  3395         specClass notNil ifTrue:[
  3395 	specClass notNil ifTrue:[
  3396             ^ specClass canResizeSubComponents
  3396 	    ^ specClass canResizeSubComponents
  3397         ].
  3397 	].
  3398     ].
  3398     ].
  3399     ^ false
  3399     ^ false
  3400 ! !
  3400 ! !
  3401 
  3401 
  3402 !ViewTreeInspectorApplication::ViewTreeModel class methodsFor:'documentation'!
  3402 !ViewTreeInspectorApplication::ViewTreeModel class methodsFor:'documentation'!
  3409     and subviews (ViewTreeItems) and the selection, a list of selected ViewTreeItems's.
  3409     and subviews (ViewTreeItems) and the selection, a list of selected ViewTreeItems's.
  3410     It shows the selected items highlighted.
  3410     It shows the selected items highlighted.
  3411 
  3411 
  3412 
  3412 
  3413     [Instance variables:]
  3413     [Instance variables:]
  3414         lockSema            <Semaphore>         lock selection notifications and redraws
  3414 	lockSema            <Semaphore>         lock selection notifications and redraws
  3415 
  3415 
  3416         testModeChannel     <ValueHolder>       true, than running in test mode.
  3416 	testModeChannel     <ValueHolder>       true, than running in test mode.
  3417 
  3417 
  3418         hasTargetWidgetChannel <ValueHolder>    true, than any target view is grapped
  3418 	hasTargetWidgetChannel <ValueHolder>    true, than any target view is grapped
  3419 
  3419 
  3420         selection           <Sequence or nil>   selected items or nil
  3420 	selection           <Sequence or nil>   selected items or nil
  3421 
  3421 
  3422         hiddenLevel         <Integer>           internal use; redrawing the selection
  3422 	hiddenLevel         <Integer>           internal use; redrawing the selection
  3423                                                 only is done if the counter is 0.
  3423 						only is done if the counter is 0.
  3424 
  3424 
  3425         listOfItems         <HierarchicalList>  hiearchical list build from existing items.
  3425 	listOfItems         <HierarchicalList>  hiearchical list build from existing items.
  3426 
  3426 
  3427         selectedSuperItems  <Sequence>          list of selected super items; items selected
  3427 	selectedSuperItems  <Sequence>          list of selected super items; items selected
  3428                                                 but not contained in another selected item.
  3428 						but not contained in another selected item.
  3429 
  3429 
  3430         inputEventAction    <Action>            called for each InputEvent
  3430 	inputEventAction    <Action>            called for each InputEvent
  3431 
  3431 
  3432         mappedViewAction    <Action>            called for a new mapped view which
  3432 	mappedViewAction    <Action>            called for a new mapped view which
  3433                                                 can not be found in the current item list.
  3433 						can not be found in the current item list.
  3434 
  3434 
  3435         beforeSelectionChangedAction <Action>   called before the selection changed
  3435 	beforeSelectionChangedAction <Action>   called before the selection changed
  3436 
  3436 
  3437     [author:]
  3437     [author:]
  3438         Claus Atzkern
  3438 	Claus Atzkern
  3439 
  3439 
  3440     [see also:]
  3440     [see also:]
  3441         ViewTreeItem
  3441 	ViewTreeItem
  3442 "
  3442 "
  3443 !
  3443 !
  3444 
  3444 
  3445 examples
  3445 examples
  3446 "
  3446 "
  3447     example 1: pick any window and show views and contained views
  3447     example 1: pick any window and show views and contained views
  3448                                                                                 [exBegin]
  3448 										[exBegin]
  3449     |top sel model panel|
  3449     |top sel model panel|
  3450 
  3450 
  3451     model := ViewTreeModel new.
  3451     model := ViewTreeModel new.
  3452     top   := StandardSystemView new; extent:440@400.
  3452     top   := StandardSystemView new; extent:440@400.
  3453     sel   := ScrollableView for:HierarchicalListView miniScroller:true origin:0.0@0.0 corner:1.0@1.0 in:top.
  3453     sel   := ScrollableView for:HierarchicalListView miniScroller:true origin:0.0@0.0 corner:1.0@1.0 in:top.
  3457     panel topInset:-24.
  3457     panel topInset:-24.
  3458     panel horizontalLayout:#fitSpace.
  3458     panel horizontalLayout:#fitSpace.
  3459 
  3459 
  3460     Button label:'Exit'       action:[model rootItem:nil. top destroy] in:panel.
  3460     Button label:'Exit'       action:[model rootItem:nil. top destroy] in:panel.
  3461     Button label:'Pick Views' action:[  |win|
  3461     Button label:'Pick Views' action:[  |win|
  3462                                         (     (win := Screen current viewFromUser) notNil
  3462 					(     (win := Screen current viewFromUser) notNil
  3463                                          and:[(win := win topView) ~~ Screen current rootView
  3463 					 and:[(win := win topView) ~~ Screen current rootView
  3464                                          and:[win ~~ top]]
  3464 					 and:[win ~~ top]]
  3465                                         ) ifTrue:[
  3465 					) ifTrue:[
  3466                                             model rootItem:(ViewTreeItem buildViewsFrom:win)
  3466 					    model rootItem:(ViewTreeItem buildViewsFrom:win)
  3467                                         ] ifFalse:[
  3467 					] ifFalse:[
  3468                                             model rootItem:nil
  3468 					    model rootItem:nil
  3469                                         ]
  3469 					]
  3470                                      ] in:panel.
  3470 				     ] in:panel.
  3471 
  3471 
  3472     sel  multipleSelectOk:true.
  3472     sel  multipleSelectOk:true.
  3473     sel              list:model listOfItems.
  3473     sel              list:model listOfItems.
  3474     sel             model:model.
  3474     sel             model:model.
  3475     sel          useIndex:false.
  3475     sel          useIndex:false.
  3476 
  3476 
  3477     sel doubleClickAction:[:i| |el|
  3477     sel doubleClickAction:[:i| |el|
  3478         el := model listOfItems at:i.
  3478 	el := model listOfItems at:i.
  3479         el spec notNil ifTrue:[ el spec   inspect ] ifFalse:[ el widget inspect ]
  3479 	el spec notNil ifTrue:[ el spec   inspect ] ifFalse:[ el widget inspect ]
  3480     ].
  3480     ].
  3481     sel indicatorAction:[:i| (model listOfItems at:i) toggleExpand ].
  3481     sel indicatorAction:[:i| (model listOfItems at:i) toggleExpand ].
  3482 
  3482 
  3483     model inputEventAction:[:anEvent| |item|
  3483     model inputEventAction:[:anEvent| |item|
  3484         anEvent isButtonEvent ifTrue:[
  3484 	anEvent isButtonEvent ifTrue:[
  3485             anEvent isButtonPressEvent ifTrue:[
  3485 	    anEvent isButtonPressEvent ifTrue:[
  3486                 model selectedItem:(model listOfItems detectItemRespondsToView:(anEvent view)).
  3486 		model selectedItem:(model listOfItems detectItemRespondsToView:(anEvent view)).
  3487             ] ifFalse:[
  3487 	    ] ifFalse:[
  3488                 anEvent type == #'buttonMultiPress:x:y:' ifTrue:[
  3488 		anEvent type == #'buttonMultiPress:x:y:' ifTrue:[
  3489                     (item := model selectedItem) notNil ifTrue:[item widget inspect]
  3489 		    (item := model selectedItem) notNil ifTrue:[item widget inspect]
  3490                 ]
  3490 		]
  3491             ]
  3491 	    ]
  3492         ]
  3492 	]
  3493     ].
  3493     ].
  3494 
  3494 
  3495     top openAndWait.
  3495     top openAndWait.
  3496     [[top shown] whileTrue:[Delay waitForSeconds:0.5]. model rootItem:nil] forkAt:8
  3496     [[top shown] whileTrue:[Delay waitForSeconds:0.5]. model rootItem:nil] forkAt:8
  3497 
  3497 
  3498                                                                                 [exEnd]
  3498 										[exEnd]
  3499 "
  3499 "
  3500 ! !
  3500 ! !
  3501 
  3501 
  3502 !ViewTreeInspectorApplication::ViewTreeModel methodsFor:'accessing'!
  3502 !ViewTreeInspectorApplication::ViewTreeModel methodsFor:'accessing'!
  3503 
  3503 
  3506 !
  3506 !
  3507 
  3507 
  3508 catchEvents:aBoolean
  3508 catchEvents:aBoolean
  3509     catchEvents := aBoolean.
  3509     catchEvents := aBoolean.
  3510     aBoolean ifFalse:[
  3510     aBoolean ifFalse:[
  3511         self redrawUnselected:selection andLock:false checkTestMode:false.
  3511 	self redrawUnselected:selection andLock:false checkTestMode:false.
  3512     ].
  3512     ].
  3513 !
  3513 !
  3514 
  3514 
  3515 path
  3515 path
  3516     "Return a XPath like path to this item"
  3516     "Return a XPath like path to this item"
  3517 
  3517 
  3518     | view views|
  3518     | view views|
  3519 
  3519 
  3520     selection isNil ifTrue:[ ^ nil ].
  3520     selection isNil ifTrue:[ ^ nil ].
  3521     selection isCollection ifTrue:[ 
  3521     selection isCollection ifTrue:[
  3522         selection size ~~ 1 ifTrue:[ ^ nil ].
  3522 	selection size ~~ 1 ifTrue:[ ^ nil ].
  3523         view := selection anElement widget.
  3523 	view := selection anElement widget.
  3524     ] ifFalse:[ 
  3524     ] ifFalse:[
  3525         view := selection widget.
  3525 	view := selection widget.
  3526     ].
  3526     ].
  3527     view isNil ifTrue:[^ nil].
  3527     view isNil ifTrue:[^ nil].
  3528     
  3528 
  3529     views := OrderedCollection new.
  3529     views := OrderedCollection new.
  3530     [ view notNil ] whileTrue:[ 
  3530     [ view notNil ] whileTrue:[
  3531         views add: view.
  3531 	views add: view.
  3532         view := view superView.
  3532 	view := view superView.
  3533     ].
  3533     ].
  3534     views removeLast.
  3534     views removeLast.
  3535     ^ String streamContents:[ :s|
  3535     ^ String streamContents:[ :s|
  3536         views reverseDo:[:each |
  3536 	views reverseDo:[:each |
  3537             s nextPutAll:'/'.
  3537 	    s nextPutAll:'/'.
  3538             s nextPutAll: each name asString "storeString".
  3538 	    s nextPutAll: each name asString "storeString".
  3539         ].
  3539 	].
  3540     ]
  3540     ]
  3541 
  3541 
  3542     "Created: / 19-05-2014 / 18:15:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  3542     "Created: / 19-05-2014 / 18:15:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  3543     "Modified: / 16-08-2017 / 13:03:47 / cg"
  3543     "Modified: / 16-08-2017 / 13:03:47 / cg"
  3544 !
  3544 !
  3556 
  3556 
  3557     timedUpdateTask := nil.
  3557     timedUpdateTask := nil.
  3558     self deselect.
  3558     self deselect.
  3559 
  3559 
  3560     lockSema critical:[
  3560     lockSema critical:[
  3561         anItem notNil ifTrue:[ expanded := anItem isExpanded ]
  3561 	anItem notNil ifTrue:[ expanded := anItem isExpanded ]
  3562                      ifFalse:[ expanded := false ].
  3562 		     ifFalse:[ expanded := false ].
  3563 
  3563 
  3564         self value:nil.
  3564 	self value:nil.
  3565         listOfItems root:anItem.
  3565 	listOfItems root:anItem.
  3566 
  3566 
  3567         anItem notNil ifTrue:[
  3567 	anItem notNil ifTrue:[
  3568             timedUpdateTask := Process for:[ self timedUpdateTaskCycle ] priority:8.
  3568 	    timedUpdateTask := Process for:[ self timedUpdateTaskCycle ] priority:8.
  3569             timedUpdateTask name:'Update'.
  3569 	    timedUpdateTask name:'Update'.
  3570             timedUpdateTask resume.
  3570 	    timedUpdateTask resume.
  3571         ].
  3571 	].
  3572     ].
  3572     ].
  3573 
  3573 
  3574     (expanded and:[anItem notNil]) ifTrue:[
  3574     (expanded and:[anItem notNil]) ifTrue:[
  3575         anItem expand
  3575 	anItem expand
  3576     ].
  3576     ].
  3577     ^ anItem
  3577     ^ anItem
  3578 !
  3578 !
  3579 
  3579 
  3580 rootView
  3580 rootView
  3639     view := self rootView.
  3639     view := self rootView.
  3640     view isNil ifTrue:[^ icon].
  3640     view isNil ifTrue:[^ icon].
  3641 
  3641 
  3642     icon := icon copy onDevice:(view device).
  3642     icon := icon copy onDevice:(view device).
  3643     icon isImage ifTrue:[
  3643     icon isImage ifTrue:[
  3644         icon clearMaskedPixels.
  3644 	icon clearMaskedPixels.
  3645     ].
  3645     ].
  3646     icons at:aKey put:icon.
  3646     icons at:aKey put:icon.
  3647     ^ icon
  3647     ^ icon
  3648 ! !
  3648 ! !
  3649 
  3649 
  3652 signalHiddenLevel
  3652 signalHiddenLevel
  3653     "show the selection if signaled; increments hiddenLevel
  3653     "show the selection if signaled; increments hiddenLevel
  3654      see: #waitHiddenLevel
  3654      see: #waitHiddenLevel
  3655     "
  3655     "
  3656     (hiddenLevel := hiddenLevel - 1) < 1 ifTrue:[
  3656     (hiddenLevel := hiddenLevel - 1) < 1 ifTrue:[
  3657         hiddenLevel := 0.
  3657 	hiddenLevel := 0.
  3658         self invalidateSelection.
  3658 	self invalidateSelection.
  3659     ].
  3659     ].
  3660 !
  3660 !
  3661 
  3661 
  3662 waitHiddenLevel
  3662 waitHiddenLevel
  3663     "hide the selection until signaled; increments hiddenLevel
  3663     "hide the selection until signaled; increments hiddenLevel
  3668 
  3668 
  3669 withSelectionHiddenDo:aZeroArgumentBlock
  3669 withSelectionHiddenDo:aZeroArgumentBlock
  3670     "apply block with selection hidden
  3670     "apply block with selection hidden
  3671     "
  3671     "
  3672 
  3672 
  3673     [   
  3673     [
  3674         self waitHiddenLevel.
  3674 	self waitHiddenLevel.
  3675         aZeroArgumentBlock value
  3675 	aZeroArgumentBlock value
  3676     ] ensure:[
  3676     ] ensure:[
  3677         self signalHiddenLevel.
  3677 	self signalHiddenLevel.
  3678     ].
  3678     ].
  3679 
  3679 
  3680     "Modified (format): / 17-07-2017 / 10:44:01 / cg"
  3680     "Modified (format): / 17-07-2017 / 10:44:01 / cg"
  3681 ! !
  3681 ! !
  3682 
  3682 
  3720     |view myTaskId|
  3720     |view myTaskId|
  3721 
  3721 
  3722     myTaskId := timedUpdateTask.
  3722     myTaskId := timedUpdateTask.
  3723 
  3723 
  3724     listOfItems root notNil ifTrue:[
  3724     listOfItems root notNil ifTrue:[
  3725         view := listOfItems root widget.
  3725 	view := listOfItems root widget.
  3726     ].
  3726     ].
  3727 
  3727 
  3728     [ view notNil ] whileTrue:[
  3728     [ view notNil ] whileTrue:[
  3729         Delay waitForSeconds:0.5.
  3729 	Delay waitForSeconds:0.5.
  3730         
  3730 
  3731         (myTaskId == timedUpdateTask and:[view id notNil]) ifFalse:[
  3731 	(myTaskId == timedUpdateTask and:[view id notNil]) ifFalse:[
  3732             view := nil.
  3732 	    view := nil.
  3733         ] ifTrue:[
  3733 	] ifTrue:[
  3734             (view sensor hasUserEvent:#updateChildren for:self) ifFalse:[
  3734 	    (view sensor hasUserEvent:#updateChildren for:self) ifFalse:[
  3735                 view sensor pushUserEvent:#updateChildren for:self.
  3735 		view sensor pushUserEvent:#updateChildren for:self.
  3736             ].
  3736 	    ].
  3737         ].
  3737 	].
  3738     ].
  3738     ].
  3739     timedUpdateTask == myTaskId ifTrue:[
  3739     timedUpdateTask == myTaskId ifTrue:[
  3740         timedUpdateTask := nil.
  3740 	timedUpdateTask := nil.
  3741         listOfItems root:nil.
  3741 	listOfItems root:nil.
  3742     ].
  3742     ].
  3743 !
  3743 !
  3744 
  3744 
  3745 update:something with:someArgument from:aModel
  3745 update:something with:someArgument from:aModel
  3746 
  3746 
  3747     aModel == testModeChannel ifTrue:[
  3747     aModel == testModeChannel ifTrue:[
  3748         (hiddenLevel == 0 and:[selection size > 0]) ifTrue:[
  3748 	(hiddenLevel == 0 and:[selection size > 0]) ifTrue:[
  3749             testModeChannel value ifTrue:[
  3749 	    testModeChannel value ifTrue:[
  3750                 self redrawUnselected:selection andLock:false checkTestMode:false.
  3750 		self redrawUnselected:selection andLock:false checkTestMode:false.
  3751             ] ifFalse:[
  3751 	    ] ifFalse:[
  3752                 self invalidateSelection.
  3752 		self invalidateSelection.
  3753             ].
  3753 	    ].
  3754         ].
  3754 	].
  3755         ^ self
  3755 	^ self
  3756     ].
  3756     ].
  3757     super update:something with:someArgument from:aModel.
  3757     super update:something with:someArgument from:aModel.
  3758 !
  3758 !
  3759 
  3759 
  3760 updateChildren
  3760 updateChildren
  3762 
  3762 
  3763     rootItem := listOfItems root.
  3763     rootItem := listOfItems root.
  3764     rootItem isNil ifTrue:[^ self].
  3764     rootItem isNil ifTrue:[^ self].
  3765 
  3765 
  3766     rootItem exists ifFalse:[
  3766     rootItem exists ifFalse:[
  3767         listOfItems root:nil.
  3767 	listOfItems root:nil.
  3768     ] ifTrue:[
  3768     ] ifTrue:[
  3769         rootItem updateChildren.
  3769 	rootItem updateChildren.
  3770     ].
  3770     ].
  3771 ! !
  3771 ! !
  3772 
  3772 
  3773 !ViewTreeInspectorApplication::ViewTreeModel methodsFor:'event processing'!
  3773 !ViewTreeInspectorApplication::ViewTreeModel methodsFor:'event processing'!
  3774 
  3774 
  3781 
  3781 
  3782     catchEvents ifFalse:[^ false].
  3782     catchEvents ifFalse:[^ false].
  3783 
  3783 
  3784     evView := anEvent view.
  3784     evView := anEvent view.
  3785     evView isNil ifTrue:[
  3785     evView isNil ifTrue:[
  3786         (anEvent isMessageSendEvent not or:[anEvent receiver ~~ self]) ifTrue:[
  3786 	(anEvent isMessageSendEvent not or:[anEvent receiver ~~ self]) ifTrue:[
  3787             ^ false
  3787 	    ^ false
  3788         ].
  3788 	].
  3789         anEvent value.
  3789 	anEvent value.
  3790         ^ true.
  3790 	^ true.
  3791     ].
  3791     ].
  3792     rootView := listOfItems rootView.
  3792     rootView := listOfItems rootView.
  3793     rootView isNil ifTrue:[ ^ false ].
  3793     rootView isNil ifTrue:[ ^ false ].
  3794 
  3794 
  3795     anEvent isConfigureEvent ifTrue:[
  3795     anEvent isConfigureEvent ifTrue:[
  3796         hiddenLevel == 0 ifTrue:[
  3796 	hiddenLevel == 0 ifTrue:[
  3797             self redrawUnselected:selection andLock:false.
  3797 	    self redrawUnselected:selection andLock:false.
  3798         ].
  3798 	].
  3799         ^ false
  3799 	^ false
  3800     ].
  3800     ].
  3801 
  3801 
  3802     "/ check whether view is contained within the rootView
  3802     "/ check whether view is contained within the rootView
  3803     (evView == rootView or:[evView isComponentOf:rootView]) ifFalse:[
  3803     (evView == rootView or:[evView isComponentOf:rootView]) ifFalse:[
  3804         ^ false
  3804 	^ false
  3805     ].
  3805     ].
  3806 
  3806 
  3807     anEvent isInputEvent ifFalse:[
  3807     anEvent isInputEvent ifFalse:[
  3808         anEvent isDamage ifTrue:[
  3808 	anEvent isDamage ifTrue:[
  3809             hiddenLevel == 0 ifTrue:[self invalidateSelection].
  3809 	    hiddenLevel == 0 ifTrue:[self invalidateSelection].
  3810             ^ false
  3810 	    ^ false
  3811         ].
  3811 	].
  3812 
  3812 
  3813         anEvent isMapEvent ifTrue:[
  3813 	anEvent isMapEvent ifTrue:[
  3814             mappedViewAction notNil ifTrue:[
  3814 	    mappedViewAction notNil ifTrue:[
  3815                 item := listOfItems recursiveDetect:[:el| el widget == evView].
  3815 		item := listOfItems recursiveDetect:[:el| el widget == evView].
  3816                 item isNil ifTrue:[ mappedViewAction value:evView ]
  3816 		item isNil ifTrue:[ mappedViewAction value:evView ]
  3817             ].
  3817 	    ].
  3818             ^ false
  3818 	    ^ false
  3819         ].
  3819 	].
  3820 
  3820 
  3821         anEvent type == #terminate ifTrue:[
  3821 	anEvent type == #terminate ifTrue:[
  3822             item := listOfItems recursiveDetect:[:el| el widget == evView].
  3822 	    item := listOfItems recursiveDetect:[:el| el widget == evView].
  3823             item notNil ifTrue:[ self processTerminateForItem:item ].
  3823 	    item notNil ifTrue:[ self processTerminateForItem:item ].
  3824             ^ false
  3824 	    ^ false
  3825         ].
  3825 	].
  3826         ^ false
  3826 	^ false
  3827     ].
  3827     ].
  3828     testMode := testModeChannel value.
  3828     testMode := testModeChannel value.
  3829 
  3829 
  3830     anEvent isFocusEvent ifTrue:[
  3830     anEvent isFocusEvent ifTrue:[
  3831         evView == rootView ifTrue:[
  3831 	evView == rootView ifTrue:[
  3832             self invalidateSelection
  3832 	    self invalidateSelection
  3833         ].
  3833 	].
  3834         ^ testMode not.
  3834 	^ testMode not.
  3835     ].
  3835     ].
  3836     anEvent isPointerEnterLeaveEvent ifTrue:[ ^ testMode not ].
  3836     anEvent isPointerEnterLeaveEvent ifTrue:[ ^ testMode not ].
  3837 
  3837 
  3838     testMode ifFalse:[
  3838     testMode ifFalse:[
  3839         inputEventAction notNil ifTrue:[ inputEventAction value:anEvent ].
  3839 	inputEventAction notNil ifTrue:[ inputEventAction value:anEvent ].
  3840     ] ifTrue:[
  3840     ] ifTrue:[
  3841         anEvent isButtonPressEvent ifTrue:[
  3841 	anEvent isButtonPressEvent ifTrue:[
  3842             selectOnClickHolder value ifTrue:[
  3842 	    selectOnClickHolder value ifTrue:[
  3843                 self selectItem:(listOfItems detectItemRespondsToView:evView).
  3843 		self selectItem:(listOfItems detectItemRespondsToView:evView).
  3844             ].
  3844 	    ].
  3845         ]
  3845 	]
  3846     ].
  3846     ].
  3847 
  3847 
  3848     (hiddenLevel ~~ 0 and:[anEvent isButtonReleaseEvent]) ifTrue:[
  3848     (hiddenLevel ~~ 0 and:[anEvent isButtonReleaseEvent]) ifTrue:[
  3849         hiddenLevel := 1.
  3849 	hiddenLevel := 1.
  3850         self signalHiddenLevel.
  3850 	self signalHiddenLevel.
  3851     ].
  3851     ].
  3852 
  3852 
  3853     ^ testMode not
  3853     ^ testMode not
  3854 !
  3854 !
  3855 
  3855 
  3892     (     hiddenLevel == 0
  3892     (     hiddenLevel == 0
  3893      and:[selection notNil
  3893      and:[selection notNil
  3894      and:[(topView := listOfItems rootView) notNil
  3894      and:[(topView := listOfItems rootView) notNil
  3895      and:[topView shown]]]
  3895      and:[topView shown]]]
  3896     ) ifTrue:[
  3896     ) ifTrue:[
  3897         topView sensor pushUserEvent:#redrawSelection for:self withArguments:#()
  3897 	topView sensor pushUserEvent:#redrawSelection for:self withArguments:#()
  3898     ]
  3898     ]
  3899 !
  3899 !
  3900 
  3900 
  3901 recursiveRepair:theDamages startIn:aView relativeTo:aRootView
  3901 recursiveRepair:theDamages startIn:aView relativeTo:aRootView
  3902     "repair all views and contained views, which intersects the damage.
  3902     "repair all views and contained views, which intersects the damage.
  3917     (aView shown and:[theDamages notEmpty]) ifFalse:[ ^ self ].
  3917     (aView shown and:[theDamages notEmpty]) ifFalse:[ ^ self ].
  3918 
  3918 
  3919     subViews := aView subViews.
  3919     subViews := aView subViews.
  3920 
  3920 
  3921     subViews size ~~ 0 ifTrue:[
  3921     subViews size ~~ 0 ifTrue:[
  3922         subViews reverseDo:[:v| self recursiveRepair:theDamages startIn:v relativeTo:aRootView ].
  3922 	subViews reverseDo:[:v| self recursiveRepair:theDamages startIn:v relativeTo:aRootView ].
  3923         theDamages isEmpty ifTrue:[ ^ self ].
  3923 	theDamages isEmpty ifTrue:[ ^ self ].
  3924     ].
  3924     ].
  3925 
  3925 
  3926     relOrg  := aView originRelativeTo:aRootView.
  3926     relOrg  := aView originRelativeTo:aRootView.
  3927     bwWidth := aView borderWidth.
  3927     bwWidth := aView borderWidth.
  3928     size    := theDamages size.
  3928     size    := theDamages size.
  3932     relOrgY := relOrg y - bwWidth.
  3932     relOrgY := relOrg y - bwWidth.
  3933     width   := aView width  + bwWidth + bwWidth.
  3933     width   := aView width  + bwWidth + bwWidth.
  3934     height  := aView height + bwWidth + bwWidth.
  3934     height  := aView height + bwWidth + bwWidth.
  3935 
  3935 
  3936     size to:1 by:-1 do:[:anIndex|
  3936     size to:1 by:-1 do:[:anIndex|
  3937         repaired := damage := theDamages at:anIndex.
  3937 	repaired := damage := theDamages at:anIndex.
  3938 
  3938 
  3939         "/ compute the rectangle into the view
  3939 	"/ compute the rectangle into the view
  3940         y := damage top  - relOrgY.
  3940 	y := damage top  - relOrgY.
  3941         x := damage left - relOrgX.
  3941 	x := damage left - relOrgX.
  3942         w := damage width.
  3942 	w := damage width.
  3943         h := damage height.
  3943 	h := damage height.
  3944 
  3944 
  3945         x     < 0      ifTrue:[ w := w + x. x := 0. repaired := nil ].
  3945 	x     < 0      ifTrue:[ w := w + x. x := 0. repaired := nil ].
  3946         y     < 0      ifTrue:[ h := h + y. y := 0. repaired := nil ].
  3946 	y     < 0      ifTrue:[ h := h + y. y := 0. repaired := nil ].
  3947         x + w > width  ifTrue:[ w := width  - x.    repaired := nil ].
  3947 	x + w > width  ifTrue:[ w := width  - x.    repaired := nil ].
  3948         y + h > height ifTrue:[ h := height - y.    repaired := nil ].
  3948 	y + h > height ifTrue:[ h := height - y.    repaired := nil ].
  3949 
  3949 
  3950         (w > 0 and:[h > 0]) ifTrue:[
  3950 	(w > 0 and:[h > 0]) ifTrue:[
  3951             bwWidth ~~ 0 ifTrue:[
  3951 	    bwWidth ~~ 0 ifTrue:[
  3952                 color isNil ifTrue:[
  3952 		color isNil ifTrue:[
  3953                     "/ must force redraw of border
  3953 		    "/ must force redraw of border
  3954                     color := aView borderColor.
  3954 		    color := aView borderColor.
  3955                     aView borderColor:(Color colorId:1).
  3955 		    aView borderColor:(Color colorId:1).
  3956                     aView borderColor:color.
  3956 		    aView borderColor:color.
  3957                 ].
  3957 		].
  3958                 w := w - bwWidth.
  3958 		w := w - bwWidth.
  3959                 h := h - bwWidth.
  3959 		h := h - bwWidth.
  3960 
  3960 
  3961                 (x := x - bwWidth) < 0 ifTrue:[w := w + x. x := 0].
  3961 		(x := x - bwWidth) < 0 ifTrue:[w := w + x. x := 0].
  3962                 (y := y - bwWidth) < 0 ifTrue:[h := h + y. y := 0].
  3962 		(y := y - bwWidth) < 0 ifTrue:[h := h + y. y := 0].
  3963 
  3963 
  3964                 h > 0 ifFalse:[w := 0].         "/ later testing on width only
  3964 		h > 0 ifFalse:[w := 0].         "/ later testing on width only
  3965             ].
  3965 	    ].
  3966 
  3966 
  3967             w > 0 ifTrue:[
  3967 	    w > 0 ifTrue:[
  3968                 aView clearRectangleX:x y:y width:w height:h.
  3968 		aView clearRectangleX:x y:y width:w height:h.
  3969                 aView exposeX:x y:y width:w height:h
  3969 		aView exposeX:x y:y width:w height:h
  3970             ].
  3970 	    ].
  3971             repaired notNil ifTrue:[ theDamages removeFromIndex:anIndex toIndex:anIndex ].
  3971 	    repaired notNil ifTrue:[ theDamages removeFromIndex:anIndex toIndex:anIndex ].
  3972         ]
  3972 	]
  3973     ].
  3973     ].
  3974 !
  3974 !
  3975 
  3975 
  3976 redrawSelection
  3976 redrawSelection
  3977     "redraw all items selected
  3977     "redraw all items selected
  3984      and:[(size := selection size) > 0
  3984      and:[(size := selection size) > 0
  3985      and:[(topView := listOfItems rootView) notNil
  3985      and:[(topView := listOfItems rootView) notNil
  3986      and:[topView shown
  3986      and:[topView shown
  3987      and:[(topView sensor hasEvent:#redrawSelection for:self) not]]]]
  3987      and:[(topView sensor hasEvent:#redrawSelection for:self) not]]]]
  3988     ) ifFalse:[
  3988     ) ifFalse:[
  3989         ^ self
  3989 	^ self
  3990     ].
  3990     ].
  3991 
  3991 
  3992     lockSema critical:[
  3992     lockSema critical:[
  3993         |list|
  3993 	|list|
  3994 
  3994 
  3995         list := selection.
  3995 	list := selection.
  3996 
  3996 
  3997         list size > 0 ifTrue:[
  3997 	list size > 0 ifTrue:[
  3998             topView paint:(Color black).
  3998 	    topView paint:(Color black).
  3999             topView clippedByChildren:false.
  3999 	    topView clippedByChildren:false.
  4000 
  4000 
  4001             list keysAndValuesReverseDo:[:anIndex :anItem|
  4001 	    list keysAndValuesReverseDo:[:anIndex :anItem|
  4002                 (anIndex == 1 and:[size > 1]) ifTrue:[ topView paint:(Color red) ].
  4002 		(anIndex == 1 and:[size > 1]) ifTrue:[ topView paint:(Color red) ].
  4003 
  4003 
  4004                 anItem handlesDo:[:aRect :what|
  4004 		anItem handlesDo:[:aRect :what|
  4005                     what isNil ifTrue:[topView displayRectangle:aRect]
  4005 		    what isNil ifTrue:[topView displayRectangle:aRect]
  4006                               ifFalse:[topView fillRectangle:aRect]
  4006 			      ifFalse:[topView fillRectangle:aRect]
  4007                 ]
  4007 		]
  4008             ].
  4008 	    ].
  4009             topView clippedByChildren:true.
  4009 	    topView clippedByChildren:true.
  4010         ].
  4010 	].
  4011     ].
  4011     ].
  4012 !
  4012 !
  4013 
  4013 
  4014 redrawUnselected:aList andLock:doLock
  4014 redrawUnselected:aList andLock:doLock
  4015     "redraw all items unselected; if doLock is true, the hiddenLevel
  4015     "redraw all items unselected; if doLock is true, the hiddenLevel
  4023      is incremented and thus the select mechanism is locked.
  4023      is incremented and thus the select mechanism is locked.
  4024     "
  4024     "
  4025     |rootView damages subViews x y w h|
  4025     |rootView damages subViews x y w h|
  4026 
  4026 
  4027     doLock ifTrue:[
  4027     doLock ifTrue:[
  4028         hiddenLevel := hiddenLevel + 1.
  4028 	hiddenLevel := hiddenLevel + 1.
  4029         hiddenLevel ~~ 1 ifTrue:[^ self].
  4029 	hiddenLevel ~~ 1 ifTrue:[^ self].
  4030     ] ifFalse:[
  4030     ] ifFalse:[
  4031         hiddenLevel ~~ 0 ifTrue:[^ self].
  4031 	hiddenLevel ~~ 0 ifTrue:[^ self].
  4032     ].
  4032     ].
  4033     checkTestMode ifTrue:[
  4033     checkTestMode ifTrue:[
  4034         testModeChannel value ifTrue:[ ^ self ]. "/ test whether running testMode
  4034 	testModeChannel value ifTrue:[ ^ self ]. "/ test whether running testMode
  4035     ].
  4035     ].
  4036 
  4036 
  4037     (     aList size ~~ 0
  4037     (     aList size ~~ 0
  4038      and:[(rootView := listOfItems rootView) notNil
  4038      and:[(rootView := listOfItems rootView) notNil
  4039      and:[rootView shown]]
  4039      and:[rootView shown]]
  4040     ) ifFalse:[
  4040     ) ifFalse:[
  4041         ^ self
  4041 	^ self
  4042     ].
  4042     ].
  4043 
  4043 
  4044     lockSema critical:[
  4044     lockSema critical:[
  4045         damages := OrderedCollection new:(8 * aList size).
  4045 	damages := OrderedCollection new:(8 * aList size).
  4046 
  4046 
  4047         aList do:[:item|
  4047 	aList do:[:item|
  4048             item handlesDo:[:handle :what|
  4048 	    item handlesDo:[:handle :what|
  4049                 damages reverseDo:[:el|
  4049 		damages reverseDo:[:el|
  4050                     (el intersects:handle) ifTrue:[
  4050 		    (el intersects:handle) ifTrue:[
  4051                         damages removeIdentical:el.
  4051 			damages removeIdentical:el.
  4052 
  4052 
  4053                         handle left:(handle left   min:el left)
  4053 			handle left:(handle left   min:el left)
  4054                               right:(handle right  max:el right)
  4054 			      right:(handle right  max:el right)
  4055                                 top:(handle top    min:el top)
  4055 				top:(handle top    min:el top)
  4056                              bottom:(handle bottom max:el bottom)
  4056 			     bottom:(handle bottom max:el bottom)
  4057                     ]
  4057 		    ]
  4058                 ].                        
  4058 		].
  4059                 damages add:handle
  4059 		damages add:handle
  4060             ]
  4060 	    ]
  4061         ].
  4061 	].
  4062 
  4062 
  4063         damages do:[:el|
  4063 	damages do:[:el|
  4064             x := el left.
  4064 	    x := el left.
  4065             y := el top.
  4065 	    y := el top.
  4066             w := el width.
  4066 	    w := el width.
  4067             h := el height.
  4067 	    h := el height.
  4068 
  4068 
  4069             rootView clearRectangleX:x y:y width:w height:h.
  4069 	    rootView clearRectangleX:x y:y width:w height:h.
  4070             rootView         exposeX:x y:y width:w height:h.
  4070 	    rootView         exposeX:x y:y width:w height:h.
  4071         ].
  4071 	].
  4072 
  4072 
  4073         (subViews := rootView subViews) notNil ifTrue:[
  4073 	(subViews := rootView subViews) notNil ifTrue:[
  4074             subViews reverseDo:[:v| self recursiveRepair:damages startIn:v relativeTo:rootView ].
  4074 	    subViews reverseDo:[:v| self recursiveRepair:damages startIn:v relativeTo:rootView ].
  4075         ].
  4075 	].
  4076     ].
  4076     ].
  4077 ! !
  4077 ! !
  4078 
  4078 
  4079 !ViewTreeInspectorApplication::ViewTreeModel methodsFor:'queries'!
  4079 !ViewTreeInspectorApplication::ViewTreeModel methodsFor:'queries'!
  4080 
  4080 
  4089 
  4089 
  4090 at:anIndex
  4090 at:anIndex
  4091     "returns the selected item at an index or nil
  4091     "returns the selected item at an index or nil
  4092     "
  4092     "
  4093     selection notNil ifTrue:[
  4093     selection notNil ifTrue:[
  4094         ^ selection at:anIndex ifAbsent:nil
  4094 	^ selection at:anIndex ifAbsent:nil
  4095     ].
  4095     ].
  4096     ^ nil
  4096     ^ nil
  4097 !
  4097 !
  4098 
  4098 
  4099 at:anIndex ifAbsent:aBlock
  4099 at:anIndex ifAbsent:aBlock
  4100     "returns the selected item at an index or the result of the block
  4100     "returns the selected item at an index or the result of the block
  4101     "
  4101     "
  4102     selection notNil ifTrue:[
  4102     selection notNil ifTrue:[
  4103         ^ selection at:anIndex ifAbsent:aBlock
  4103 	^ selection at:anIndex ifAbsent:aBlock
  4104     ].
  4104     ].
  4105     ^ aBlock value
  4105     ^ aBlock value
  4106 !
  4106 !
  4107 
  4107 
  4108 first
  4108 first
  4144     |newSelect|
  4144     |newSelect|
  4145 
  4145 
  4146     item isNil ifTrue:[^ item].
  4146     item isNil ifTrue:[^ item].
  4147 
  4147 
  4148     lockSema critical:[
  4148     lockSema critical:[
  4149         selection isNil ifTrue:[
  4149 	selection isNil ifTrue:[
  4150             newSelect := Array with:item.
  4150 	    newSelect := Array with:item.
  4151         ] ifFalse:[
  4151 	] ifFalse:[
  4152             (self includes:item) ifFalse:[
  4152 	    (self includes:item) ifFalse:[
  4153                 newSelect := selection copyWith:item
  4153 		newSelect := selection copyWith:item
  4154             ]
  4154 	    ]
  4155         ].
  4155 	].
  4156 
  4156 
  4157         newSelect size ~~ selection size ifTrue:[
  4157 	newSelect size ~~ selection size ifTrue:[
  4158             item makeVisible.
  4158 	    item makeVisible.
  4159             self value:newSelect
  4159 	    self value:newSelect
  4160         ]
  4160 	]
  4161     ].
  4161     ].
  4162     ^ item
  4162     ^ item
  4163 !
  4163 !
  4164 
  4164 
  4165 addAll:aCollectionOfItems
  4165 addAll:aCollectionOfItems
  4168     |newSelect|
  4168     |newSelect|
  4169 
  4169 
  4170     aCollectionOfItems size == 0 ifTrue:[ ^ aCollectionOfItems ].
  4170     aCollectionOfItems size == 0 ifTrue:[ ^ aCollectionOfItems ].
  4171 
  4171 
  4172     lockSema critical:[
  4172     lockSema critical:[
  4173         selection isNil ifTrue:[
  4173 	selection isNil ifTrue:[
  4174             newSelect := Array withAll:aCollectionOfItems.
  4174 	    newSelect := Array withAll:aCollectionOfItems.
  4175         ] ifFalse:[
  4175 	] ifFalse:[
  4176             newSelect := OrderedCollection withAll:selection.
  4176 	    newSelect := OrderedCollection withAll:selection.
  4177 
  4177 
  4178             aCollectionOfItems do:[:el|
  4178 	    aCollectionOfItems do:[:el|
  4179                 (selection includesIdentical:el) ifFalse:[newSelect add:el]
  4179 		(selection includesIdentical:el) ifFalse:[newSelect add:el]
  4180             ].
  4180 	    ].
  4181         ].
  4181 	].
  4182         self value:newSelect.
  4182 	self value:newSelect.
  4183     ].
  4183     ].
  4184     ^ aCollectionOfItems
  4184     ^ aCollectionOfItems
  4185 !
  4185 !
  4186 
  4186 
  4187 deselect
  4187 deselect
  4196     |newSelect|
  4196     |newSelect|
  4197 
  4197 
  4198     item isNil ifTrue:[^ nil].
  4198     item isNil ifTrue:[^ nil].
  4199 
  4199 
  4200     lockSema critical:[
  4200     lockSema critical:[
  4201         (selection notNil and:[selection includesIdentical:item]) ifTrue:[
  4201 	(selection notNil and:[selection includesIdentical:item]) ifTrue:[
  4202             selection size == 1 ifTrue:[ newSelect := nil ]
  4202 	    selection size == 1 ifTrue:[ newSelect := nil ]
  4203                                ifFalse:[ newSelect := selection copyWithout:item ].
  4203 			       ifFalse:[ newSelect := selection copyWithout:item ].
  4204 
  4204 
  4205             self value:newSelect
  4205 	    self value:newSelect
  4206         ].
  4206 	].
  4207     ].
  4207     ].
  4208     ^ item
  4208     ^ item
  4209 !
  4209 !
  4210 
  4210 
  4211 removeAll
  4211 removeAll
  4221 
  4221 
  4222     selection   isNil ifTrue:[ ^ loItems ].
  4222     selection   isNil ifTrue:[ ^ loItems ].
  4223     loItems size == 0 ifTrue:[ ^ loItems ].
  4223     loItems size == 0 ifTrue:[ ^ loItems ].
  4224 
  4224 
  4225     lockSema critical:[
  4225     lockSema critical:[
  4226         selection notNil ifTrue:[
  4226 	selection notNil ifTrue:[
  4227             newSelect := selection select:[:el| (loItems includesIdentical:el) not ].
  4227 	    newSelect := selection select:[:el| (loItems includesIdentical:el) not ].
  4228             self value:newSelect.
  4228 	    self value:newSelect.
  4229         ]
  4229 	]
  4230     ].
  4230     ].
  4231     ^ loItems
  4231     ^ loItems
  4232 !
  4232 !
  4233 
  4233 
  4234 selectAll
  4234 selectAll
  4237     |root newSelection|
  4237     |root newSelection|
  4238 
  4238 
  4239     root := listOfItems root.
  4239     root := listOfItems root.
  4240 
  4240 
  4241     root isNil ifTrue:[
  4241     root isNil ifTrue:[
  4242         newSelection := nil
  4242 	newSelection := nil
  4243     ] ifFalse:[
  4243     ] ifFalse:[
  4244         newSelection := OrderedCollection new.
  4244 	newSelection := OrderedCollection new.
  4245         root recursiveDo:[:el| newSelection add:el ].
  4245 	root recursiveDo:[:el| newSelection add:el ].
  4246     ].
  4246     ].
  4247     self value:newSelection.
  4247     self value:newSelection.
  4248 !
  4248 !
  4249 
  4249 
  4250 selectItem:anItem
  4250 selectItem:anItem
  4268 toggleSelectItem:anItem
  4268 toggleSelectItem:anItem
  4269     "toggle selection-state of the item; add or remove the item from the
  4269     "toggle selection-state of the item; add or remove the item from the
  4270      current selection.
  4270      current selection.
  4271     "
  4271     "
  4272     anItem notNil ifTrue:[
  4272     anItem notNil ifTrue:[
  4273         (self includes:anItem) ifTrue:[self remove:anItem]
  4273 	(self includes:anItem) ifTrue:[self remove:anItem]
  4274                               ifFalse:[self add:anItem]
  4274 			      ifFalse:[self add:anItem]
  4275     ].
  4275     ].
  4276     ^ anItem
  4276     ^ anItem
  4277 ! !
  4277 ! !
  4278 
  4278 
  4279 !ViewTreeInspectorApplication::ViewTreeModel methodsFor:'selection enumerating'!
  4279 !ViewTreeInspectorApplication::ViewTreeModel methodsFor:'selection enumerating'!
  4359     |unselected rootView rootItem selSize|
  4359     |unselected rootView rootItem selSize|
  4360 
  4360 
  4361     selSize := selection size.
  4361     selSize := selection size.
  4362 
  4362 
  4363     selSize == 0 ifTrue:[
  4363     selSize == 0 ifTrue:[
  4364         selectedSuperItems := #().
  4364 	selectedSuperItems := #().
  4365     ] ifFalse:[
  4365     ] ifFalse:[
  4366         selSize == 1 ifTrue:[
  4366 	selSize == 1 ifTrue:[
  4367             selectedSuperItems := Array with:(selection at:1).
  4367 	    selectedSuperItems := Array with:(selection at:1).
  4368         ] ifFalse:[
  4368 	] ifFalse:[
  4369             rootItem := listOfItems root.
  4369 	    rootItem := listOfItems root.
  4370 
  4370 
  4371             (selection includesIdentical:rootItem) ifTrue:[
  4371 	    (selection includesIdentical:rootItem) ifTrue:[
  4372                 selectedSuperItems := Array with:rootItem.
  4372 		selectedSuperItems := Array with:rootItem.
  4373             ] ifFalse:[
  4373 	    ] ifFalse:[
  4374                 selectedSuperItems := OrderedCollection new:selSize.
  4374 		selectedSuperItems := OrderedCollection new:selSize.
  4375 
  4375 
  4376                 selection do:[:anItem|
  4376 		selection do:[:anItem|
  4377                     anItem parentsDetect:[:el| selection includesIdentical:el ]
  4377 		    anItem parentsDetect:[:el| selection includesIdentical:el ]
  4378                                   ifNone:[ selectedSuperItems add:anItem ].
  4378 				  ifNone:[ selectedSuperItems add:anItem ].
  4379                 ].
  4379 		].
  4380             ]
  4380 	    ]
  4381         ]
  4381 	]
  4382     ].
  4382     ].
  4383 
  4383 
  4384     (     hiddenLevel == 0
  4384     (     hiddenLevel == 0
  4385      and:[(rootView := listOfItems rootView) notNil
  4385      and:[(rootView := listOfItems rootView) notNil
  4386      and:[rootView shown]]
  4386      and:[rootView shown]]
  4387     ) ifTrue:[
  4387     ) ifTrue:[
  4388         selSize == 0 ifTrue:[
  4388 	selSize == 0 ifTrue:[
  4389             "/ must redraw the old selection unselected
  4389 	    "/ must redraw the old selection unselected
  4390             self redrawUnselected:oldSelection andLock:false
  4390 	    self redrawUnselected:oldSelection andLock:false
  4391         ] ifFalse:[
  4391 	] ifFalse:[
  4392             self invalidateSelection.
  4392 	    self invalidateSelection.
  4393 
  4393 
  4394             oldSelection size ~~ 0 ifTrue:[
  4394 	    oldSelection size ~~ 0 ifTrue:[
  4395                 "/ must redraw all elements no longer in the selection
  4395 		"/ must redraw all elements no longer in the selection
  4396                 unselected := oldSelection select:[:el| (selection includesIdentical:el) not ].
  4396 		unselected := oldSelection select:[:el| (selection includesIdentical:el) not ].
  4397                 self redrawUnselected:unselected andLock:false.
  4397 		self redrawUnselected:unselected andLock:false.
  4398             ]
  4398 	    ]
  4399         ]
  4399 	]
  4400     ].
  4400     ].
  4401     super changed:aParameter with:oldSelection.
  4401     super changed:aParameter with:oldSelection.
  4402 !
  4402 !
  4403 
  4403 
  4404 setValue:aNewSelection 
  4404 setValue:aNewSelection
  4405     "set the selection without notifying
  4405     "set the selection without notifying
  4406     "
  4406     "
  4407     |newSelect idx|
  4407     |newSelect idx|
  4408 
  4408 
  4409     newSelect := nil.
  4409     newSelect := nil.
  4410 
  4410 
  4411     aNewSelection notNil ifTrue:[
  4411     aNewSelection notNil ifTrue:[
  4412         lockSema critical:[
  4412 	lockSema critical:[
  4413             aNewSelection isCollection ifFalse:[
  4413 	    aNewSelection isCollection ifFalse:[
  4414                 (selection size == 1 and:[selection first == aNewSelection]) ifTrue:[
  4414 		(selection size == 1 and:[selection first == aNewSelection]) ifTrue:[
  4415                     newSelect := selection
  4415 		    newSelect := selection
  4416                 ] ifFalse:[
  4416 		] ifFalse:[
  4417                     newSelect := Array with:aNewSelection.
  4417 		    newSelect := Array with:aNewSelection.
  4418                 ]
  4418 		]
  4419             ] ifTrue:[
  4419 	    ] ifTrue:[
  4420                 aNewSelection notEmpty ifTrue:[
  4420 		aNewSelection notEmpty ifTrue:[
  4421                     aNewSelection size ~~ selection size ifTrue:[
  4421 		    aNewSelection size ~~ selection size ifTrue:[
  4422                         newSelect := aNewSelection copy.
  4422 			newSelect := aNewSelection copy.
  4423                     ] ifFalse:[
  4423 		    ] ifFalse:[
  4424                         idx := selection findFirst:[:el| (aNewSelection includesIdentical:el) not ].
  4424 			idx := selection findFirst:[:el| (aNewSelection includesIdentical:el) not ].
  4425 
  4425 
  4426                         idx ~~ 0 ifTrue:[newSelect := aNewSelection copy]
  4426 			idx ~~ 0 ifTrue:[newSelect := aNewSelection copy]
  4427                                 ifFalse:[newSelect := selection ].
  4427 				ifFalse:[newSelect := selection ].
  4428                     ]
  4428 		    ]
  4429                 ]
  4429 		]
  4430             ]
  4430 	    ]
  4431         ].
  4431 	].
  4432     ].
  4432     ].
  4433     newSelect ~~ selection ifTrue:[
  4433     newSelect ~~ selection ifTrue:[
  4434         beforeSelectionChangedAction value.
  4434 	beforeSelectionChangedAction value.
  4435         selection := newSelect.
  4435 	selection := newSelect.
  4436         selection notNil ifTrue:[selection do:[:el| el makeVisible]]
  4436 	selection notNil ifTrue:[selection do:[:el| el makeVisible]]
  4437     ].
  4437     ].
  4438 !
  4438 !
  4439 
  4439 
  4440 triggerValue:aValue
  4440 triggerValue:aValue
  4441     "set my value & send change notifications to my dependents.
  4441     "set my value & send change notifications to my dependents.
  4442      Send the change message even if the value didn't change.
  4442      Send the change message even if the value didn't change.
  4443     "
  4443     "
  4444     |oldSelection|
  4444     |oldSelection|
  4445 
  4445 
  4446     lockSema critical:[
  4446     lockSema critical:[
  4447         oldSelection := selection.
  4447 	oldSelection := selection.
  4448         self setValue:aValue.
  4448 	self setValue:aValue.
  4449         self changed:#value with:oldSelection
  4449 	self changed:#value with:oldSelection
  4450     ]
  4450     ]
  4451 !
  4451 !
  4452 
  4452 
  4453 value
  4453 value
  4454     "returns the current selection
  4454     "returns the current selection
  4461      dependents if it changed.
  4461      dependents if it changed.
  4462     "
  4462     "
  4463     |oldSelection|
  4463     |oldSelection|
  4464 
  4464 
  4465     lockSema critical:[
  4465     lockSema critical:[
  4466         oldSelection := selection.
  4466 	oldSelection := selection.
  4467         self setValue:aValue.
  4467 	self setValue:aValue.
  4468 
  4468 
  4469         oldSelection == selection ifFalse:[
  4469 	oldSelection == selection ifFalse:[
  4470             self changed:#value with:oldSelection
  4470 	    self changed:#value with:oldSelection
  4471         ]
  4471 	]
  4472     ].
  4472     ].
  4473 ! !
  4473 ! !
  4474 
  4474 
  4475 !ViewTreeInspectorApplication::ViewTreeModel methodsFor:'selection searching'!
  4475 !ViewTreeInspectorApplication::ViewTreeModel methodsFor:'selection searching'!
  4476 
  4476 
  4542     "return true, if all items of the collection are included in the current selection
  4542     "return true, if all items of the collection are included in the current selection
  4543     "
  4543     "
  4544     |keptSelection|
  4544     |keptSelection|
  4545 
  4545 
  4546     aCollection size ~~ 0 ifTrue:[
  4546     aCollection size ~~ 0 ifTrue:[
  4547         "/ the selection may change at any time (may it?)
  4547 	"/ the selection may change at any time (may it?)
  4548         (keptSelection := selection) isNil ifTrue:[ ^ false ].
  4548 	(keptSelection := selection) isNil ifTrue:[ ^ false ].
  4549 
  4549 
  4550         ^ aCollection contains:[:el| (keptSelection includesIdentical:el)]
  4550 	^ aCollection contains:[:el| (keptSelection includesIdentical:el)]
  4551     ].
  4551     ].
  4552     ^ true
  4552     ^ true
  4553 
  4553 
  4554     "Modified (format): / 12-02-2017 / 11:51:14 / cg"
  4554     "Modified (format): / 12-02-2017 / 11:51:14 / cg"
  4555 !
  4555 !
  4558     "return true, if any item of the collection is in the current selection
  4558     "return true, if any item of the collection is in the current selection
  4559     "
  4559     "
  4560     |keptSelection|
  4560     |keptSelection|
  4561 
  4561 
  4562     aCollection notNil ifTrue:[
  4562     aCollection notNil ifTrue:[
  4563         "/ the selection may change at any time (may it?)
  4563 	"/ the selection may change at any time (may it?)
  4564         (keptSelection := selection) notNil ifTrue:[
  4564 	(keptSelection := selection) notNil ifTrue:[
  4565             ^ aCollection contains:[:el| (keptSelection includesIdentical:el)]
  4565 	    ^ aCollection contains:[:el| (keptSelection includesIdentical:el)]
  4566         ]
  4566 	]
  4567     ].
  4567     ].
  4568     ^ false
  4568     ^ false
  4569 
  4569 
  4570     "Modified (format): / 12-02-2017 / 11:50:26 / cg"
  4570     "Modified (format): / 12-02-2017 / 11:50:26 / cg"
  4571 !
  4571 !
  4600 "
  4600 "
  4601     Kind of HierarchicalList class which contains all the visible
  4601     Kind of HierarchicalList class which contains all the visible
  4602     ViewTreeItem's and the root, the anchor of the hierarchical list.
  4602     ViewTreeItem's and the root, the anchor of the hierarchical list.
  4603 
  4603 
  4604     [Instance variables:]
  4604     [Instance variables:]
  4605         treeModel       <ViewTreeModel>         all events are delegated to
  4605 	treeModel       <ViewTreeModel>         all events are delegated to
  4606         eventHook       <BlockValue>            save and resore the pre/post -EventHook
  4606 	eventHook       <BlockValue>            save and resore the pre/post -EventHook
  4607 
  4607 
  4608 
  4608 
  4609     [author:]
  4609     [author:]
  4610         Claus Atzkern
  4610 	Claus Atzkern
  4611 
  4611 
  4612     [see also:]
  4612     [see also:]
  4613         HierarchicalList
  4613 	HierarchicalList
  4614         ViewTreeModel
  4614 	ViewTreeModel
  4615         ViewTreeItem
  4615 	ViewTreeItem
  4616 "
  4616 "
  4617 ! !
  4617 ! !
  4618 
  4618 
  4619 !ViewTreeInspectorApplication::ViewTreeModel::ItemList methodsFor:'accessing'!
  4619 !ViewTreeInspectorApplication::ViewTreeModel::ItemList methodsFor:'accessing'!
  4620 
  4620 
  4627 
  4627 
  4628     rootView := self rootView.
  4628     rootView := self rootView.
  4629     super root:theRoot.
  4629     super root:theRoot.
  4630 
  4630 
  4631     rootView notNil ifTrue:[ |wgrp|
  4631     rootView notNil ifTrue:[ |wgrp|
  4632         wgrp := rootView windowGroup.
  4632 	wgrp := rootView windowGroup.
  4633 
  4633 
  4634         wgrp notNil ifTrue:[
  4634 	wgrp notNil ifTrue:[
  4635            wgrp removePreEventHook:treeModel.
  4635 	   wgrp removePreEventHook:treeModel.
  4636            wgrp removePostEventHook:self.
  4636 	   wgrp removePostEventHook:self.
  4637         ].
  4637 	].
  4638     ].
  4638     ].
  4639 
  4639 
  4640     super root:theRoot.
  4640     super root:theRoot.
  4641     rootView := self rootView.
  4641     rootView := self rootView.
  4642 
  4642 
  4643     rootView notNil ifTrue:[
  4643     rootView notNil ifTrue:[
  4644         "must setup a task because there might not exist a windowGroup at the moment
  4644 	"must setup a task because there might not exist a windowGroup at the moment
  4645         "
  4645 	"
  4646         [   |wgrp|
  4646 	[   |wgrp|
  4647 
  4647 
  4648             [rootView == self rootView] whileTrue:[
  4648 	    [rootView == self rootView] whileTrue:[
  4649                 wgrp := rootView windowGroup.
  4649 		wgrp := rootView windowGroup.
  4650                 wgrp notNil ifTrue:[
  4650 		wgrp notNil ifTrue:[
  4651                     rootView := nil.
  4651 		    rootView := nil.
  4652                     wgrp addPreEventHook:treeModel.
  4652 		    wgrp addPreEventHook:treeModel.
  4653                     wgrp addPostEventHook:self.
  4653 		    wgrp addPostEventHook:self.
  4654                 ] ifFalse:[
  4654 		] ifFalse:[
  4655                     Delay waitForMilliseconds:100.
  4655 		    Delay waitForMilliseconds:100.
  4656                 ].
  4656 		].
  4657             ].
  4657 	    ].
  4658 
  4658 
  4659         ] forkAt:(Processor userSchedulingPriority + 2).
  4659 	] forkAt:(Processor userSchedulingPriority + 2).
  4660     ].
  4660     ].
  4661     treeModel notNil ifTrue:[
  4661     treeModel notNil ifTrue:[
  4662         treeModel targetWidgetChanged.
  4662 	treeModel targetWidgetChanged.
  4663     ].
  4663     ].
  4664     
  4664 
  4665     ^ root.
  4665     ^ root.
  4666 !
  4666 !
  4667 
  4667 
  4668 rootView
  4668 rootView
  4669     "returns the widget assigned to the root or nil
  4669     "returns the widget assigned to the root or nil
  4684 
  4684 
  4685     |widget l applClass applClassName key|
  4685     |widget l applClass applClassName key|
  4686 
  4686 
  4687     l := nil.
  4687     l := nil.
  4688     showWidgetNames == true ifTrue:[
  4688     showWidgetNames == true ifTrue:[
  4689         (widget := anItem widget) notNil ifTrue:[
  4689 	(widget := anItem widget) notNil ifTrue:[
  4690             l := '"', widget name, '"'
  4690 	    l := '"', widget name, '"'
  4691         ] ifFalse:[
  4691 	] ifFalse:[
  4692             l := '"', anItem menuItem label asString, '"'
  4692 	    l := '"', anItem menuItem label asString, '"'
  4693         ].    
  4693 	].
  4694     ].
  4694     ].
  4695 
  4695 
  4696     anItem isApplicationClass ifTrue:[
  4696     anItem isApplicationClass ifTrue:[
  4697         applClass := anItem applicationClass.
  4697 	applClass := anItem applicationClass.
  4698         applClass notNil ifTrue:[   
  4698 	applClass notNil ifTrue:[
  4699             applClassName := '[', applClass name allBold, ']'.
  4699 	    applClassName := '[', applClass name allBold, ']'.
  4700             l := (l isNil ifTrue:[''] ifFalse:[l , ' ']) , applClassName
  4700 	    l := (l isNil ifTrue:[''] ifFalse:[l , ' ']) , applClassName
  4701         ].
  4701 	].
  4702     ].
  4702     ].
  4703 
  4703 
  4704     application notNil ifTrue:[
  4704     application notNil ifTrue:[
  4705         key := application builder namedComponents keyAtValue:widget ifAbsent:nil.
  4705 	key := application builder namedComponents keyAtValue:widget ifAbsent:nil.
  4706         key notNil ifTrue:[
  4706 	key notNil ifTrue:[
  4707             l := l , ' #',key
  4707 	    l := l , ' #',key
  4708         ].
  4708 	].
  4709     ].
  4709     ].
  4710 
  4710 
  4711     ^ l
  4711     ^ l
  4712 
  4712 
  4713     "Modified: / 16-08-2017 / 12:47:12 / cg"
  4713     "Modified: / 16-08-2017 / 12:47:12 / cg"
  4723 showWidgetNames:aBoolean
  4723 showWidgetNames:aBoolean
  4724     "set true if the additional text is the widget name
  4724     "set true if the additional text is the widget name
  4725      otherwise the name of the application"
  4725      otherwise the name of the application"
  4726 
  4726 
  4727     self showWidgetNames == aBoolean ifFalse:[
  4727     self showWidgetNames == aBoolean ifFalse:[
  4728         showWidgetNames := aBoolean.
  4728 	showWidgetNames := aBoolean.
  4729 
  4729 
  4730         root notNil ifTrue:[
  4730 	root notNil ifTrue:[
  4731             root recursiveAdditionalNameBehaviourChanged.
  4731 	    root recursiveAdditionalNameBehaviourChanged.
  4732             self changed.
  4732 	    self changed.
  4733         ].
  4733 	].
  4734     ].
  4734     ].
  4735 ! !
  4735 ! !
  4736 
  4736 
  4737 !ViewTreeInspectorApplication::ViewTreeModel::ItemList methodsFor:'event processing'!
  4737 !ViewTreeInspectorApplication::ViewTreeModel::ItemList methodsFor:'event processing'!
  4738 
  4738 
  4759     "returns the bottom-most item which contains the view
  4759     "returns the bottom-most item which contains the view
  4760     "
  4760     "
  4761     |view item topView|
  4761     |view item topView|
  4762 
  4762 
  4763     root notNil ifTrue:[
  4763     root notNil ifTrue:[
  4764         view    := aView.
  4764 	view    := aView.
  4765         topView := root widget.
  4765 	topView := root widget.
  4766 
  4766 
  4767         [ view notNil ] whileTrue:[
  4767 	[ view notNil ] whileTrue:[
  4768             topView == view ifTrue:[^ root].
  4768 	    topView == view ifTrue:[^ root].
  4769             item := root recursiveDetect:[:el| el widget == view ].
  4769 	    item := root recursiveDetect:[:el| el widget == view ].
  4770             item notNil ifTrue:[^ item].
  4770 	    item notNil ifTrue:[^ item].
  4771             view := view superView
  4771 	    view := view superView
  4772         ]
  4772 	]
  4773     ].
  4773     ].
  4774     ^ nil
  4774     ^ nil
  4775 !
  4775 !
  4776 
  4776 
  4777 recursiveDetect:aOneOrgBlock
  4777 recursiveDetect:aOneOrgBlock
  4778     "recursive find the first child, for which evaluation 
  4778     "recursive find the first child, for which evaluation
  4779      of the block returns true; if none nil is returned
  4779      of the block returns true; if none nil is returned
  4780     "
  4780     "
  4781     root notNil ifTrue:[
  4781     root notNil ifTrue:[
  4782         (aOneOrgBlock value:root) ifTrue:[ ^ root ].
  4782 	(aOneOrgBlock value:root) ifTrue:[ ^ root ].
  4783       ^ root recursiveDetect:aOneOrgBlock
  4783       ^ root recursiveDetect:aOneOrgBlock
  4784     ].
  4784     ].
  4785     ^ nil
  4785     ^ nil
  4786 ! !
  4786 ! !
  4787 
  4787