1439 ! ! |
1439 ! ! |
1440 |
1440 |
1441 !ViewTreeInspectorApplication methodsFor:'private'! |
1441 !ViewTreeInspectorApplication methodsFor:'private'! |
1442 |
1442 |
1443 selectFocusView |
1443 selectFocusView |
1444 |rootView focusItem focusView| |
1444 |rootView focusView| |
1445 |
1445 |
1446 rootView := model rootView. |
1446 rootView := model rootView. |
1447 |
1447 |
1448 (rootView notNil and:[rootView shown]) ifTrue:[ |
1448 (rootView notNil and:[rootView shown]) ifTrue:[ |
1449 focusView := rootView windowGroup focusView. |
1449 focusView := rootView windowGroup focusView. |
1450 ]. |
1450 ]. |
1451 focusView isNil ifTrue:[^ self ]. |
1451 focusView isNil ifTrue:[^ self ]. |
1452 |
1452 |
1453 focusItem := model selectedItem. |
1453 self selectView:focusView |
1454 |
1454 ! |
1455 (focusItem notNil and:[focusItem widget == focusView]) ifTrue:[ |
1455 |
|
1456 selectView:aView |
|
1457 |currentItem viewItem| |
|
1458 |
|
1459 currentItem := model selectedItem. |
|
1460 |
|
1461 (currentItem notNil and:[currentItem widget == aView]) ifTrue:[ |
1456 ^ self |
1462 ^ self |
1457 ]. |
1463 ]. |
1458 focusItem := model listOfItems recursiveDetect:[:el| el widget == focusView ]. |
1464 viewItem := model listOfItems recursiveDetect:[:el| el widget == aView ]. |
1459 |
1465 |
1460 focusItem notNil ifTrue:[ |
1466 viewItem notNil ifTrue:[ |
1461 model selectItem:focusItem. |
1467 model selectItem:viewItem. |
1462 ]. |
1468 ]. |
1463 ! |
1469 ! |
1464 |
1470 |
1465 setRootItem:aRootItemOrNil |
1471 setRootItem:aRootItemOrNil |
1466 |theProcess| |
1472 |theProcess| |
1666 ifFalse:[what == #controller ifTrue:[ inst := inst controller ]]]]. |
1672 ifFalse:[what == #controller ifTrue:[ inst := inst controller ]]]]. |
1667 |
1673 |
1668 inst notNil ifTrue:[ inst inspect ]. |
1674 inst notNil ifTrue:[ inst inspect ]. |
1669 ! |
1675 ! |
1670 |
1676 |
1671 doPickViews |
1677 doPickView |
1672 "pick a window's topView" |
1678 "pick a window's topView" |
1673 |
1679 |
1674 |screen window cursor| |
1680 |screen clickedView topWindow cursor| |
1675 |
1681 |
1676 self doUnpick. |
1682 self doUnpick. |
1677 |
1683 |
1678 cursor := Cursor fromImage:(self class crossHairIcon). |
1684 cursor := Cursor fromImage:(self class crossHairIcon). |
1679 |
1685 |
1680 screen := Screen current. |
1686 screen := Screen current. |
1681 window := screen viewFromPoint:(screen pointFromUserShowing:cursor). |
1687 clickedView := screen viewFromPoint:(screen pointFromUserShowing:cursor). |
1682 window isNil ifTrue:[^ self]. |
1688 clickedView isNil ifTrue:[^ self]. |
1683 |
1689 |
1684 window := window topView. |
1690 topWindow := clickedView topView. |
1685 |
1691 |
1686 ( window == Screen current rootView |
1692 ( topWindow == Screen current rootView |
1687 or:[window == self window topView] |
1693 or:[topWindow == self window topView] |
1688 ) ifTrue:[ |
1694 ) ifTrue:[ |
1689 ^ self |
1695 ^ self |
1690 ]. |
1696 ]. |
1691 self setRootItem:(ViewTreeItem buildViewsFrom:window). |
1697 self setRootItem:(ViewTreeItem buildViewsFrom:topWindow). |
|
1698 self selectView:clickedView. |
1692 ! |
1699 ! |
1693 |
1700 |
1694 doSelectNextOfApplicationClass:aClass startingIn:anItem |
1701 doSelectNextOfApplicationClass:aClass startingIn:anItem |
1695 |startItem firstFound searchNext| |
1702 |startItem firstFound searchNext| |
1696 |
1703 |
2116 isValidAndShown := false. |
2123 isValidAndShown := false. |
2117 ] ifFalse:[ |
2124 ] ifFalse:[ |
2118 isValidAndShown := widget shown. |
2125 isValidAndShown := widget shown. |
2119 ]. |
2126 ]. |
2120 isValidAndShown ifFalse:[ |
2127 isValidAndShown ifFalse:[ |
2121 label := Text string:label emphasis:#italic |
2128 label := Text string:label emphasis:#italic. |
|
2129 label colorizeAllWith:Color grey. |
2122 ]. |
2130 ]. |
2123 |
2131 |
2124 labelHeight := self heightOn:aGC. |
2132 labelHeight := self heightOn:aGC. |
2125 self displayLabel:label h:labelHeight on:aGC x:x y:y h:h. |
2133 self displayLabel:label h:labelHeight on:aGC x:x y:y h:h. |
2126 |
2134 |
3878 !ViewTreeInspectorApplication::ViewTreeModel::ItemList methodsFor:'accessing look'! |
3886 !ViewTreeInspectorApplication::ViewTreeModel::ItemList methodsFor:'accessing look'! |
3879 |
3887 |
3880 additionalLabelForItem:anItem |
3888 additionalLabelForItem:anItem |
3881 "answer the additional lable for an item or nil" |
3889 "answer the additional lable for an item or nil" |
3882 |
3890 |
3883 |applClass| |
3891 |l applClass applClassName| |
3884 |
3892 |
|
3893 l := nil. |
3885 showWidgetNames == true ifTrue:[ |
3894 showWidgetNames == true ifTrue:[ |
3886 ^ '[', anItem widget name, ']' |
3895 l := '"', anItem widget name, '"' |
3887 ]. |
3896 ]. |
3888 |
3897 |
3889 anItem isApplicationClass ifTrue:[ |
3898 anItem isApplicationClass ifTrue:[ |
3890 applClass := anItem applicationClass. |
3899 applClass := anItem applicationClass. |
3891 |
3900 applClass notNil ifTrue:[ |
3892 applClass notNil ifTrue:[ |
3901 applClassName := '[', applClass name allBold, ']'. |
3893 ^ ('[', applClass name, ']') |
3902 l := (l isNil ifTrue:[''] ifFalse:[l , ' ']) , applClassName |
3894 ]. |
3903 ]. |
3895 ]. |
3904 ]. |
3896 ^ nil |
3905 ^ l |
3897 ! |
3906 ! |
3898 |
3907 |
3899 showWidgetNames |
3908 showWidgetNames |
3900 "answer true if the additional text is the widget name |
3909 "answer true if the additional text is the widget name |
3901 otherwise the name of the application" |
3910 otherwise the name of the application" |
3902 |
3911 |
3903 ^ showWidgetNames ? false |
3912 ^ showWidgetNames ? true |
3904 ! |
3913 ! |
3905 |
3914 |
3906 showWidgetNames:aBoolean |
3915 showWidgetNames:aBoolean |
3907 "set true if the additional text is the widget name |
3916 "set true if the additional text is the widget name |
3908 otherwise the name of the application" |
3917 otherwise the name of the application" |
3930 on:aModel |
3939 on:aModel |
3931 "set the model, a ViewTreeModel |
3940 "set the model, a ViewTreeModel |
3932 " |
3941 " |
3933 treeModel := aModel. |
3942 treeModel := aModel. |
3934 showRoot := true. |
3943 showRoot := true. |
3935 showWidgetNames := false. |
3944 "/ showWidgetNames := false. |
|
3945 showWidgetNames := true. |
3936 ! ! |
3946 ! ! |
3937 |
3947 |
3938 !ViewTreeInspectorApplication::ViewTreeModel::ItemList methodsFor:'searching'! |
3948 !ViewTreeInspectorApplication::ViewTreeModel::ItemList methodsFor:'searching'! |
3939 |
3949 |
3940 detectItemRespondsToView:aView |
3950 detectItemRespondsToView:aView |