added:
#doPickView
#selectView:
changed:
#menu
#openInPickMode
#selectFocusView
#toolbarMenu
when clicking, select the clicked view;
always show a view's name.
--- a/Tools__ViewTreeApplication.st Fri Feb 05 00:03:17 2010 +0100
+++ b/Tools__ViewTreeApplication.st Wed Feb 10 23:10:55 2010 +0100
@@ -324,7 +324,7 @@
(
(MenuItem
label: 'Pick a View'
- itemValue: doPickViews
+ itemValue: doPickView
translateLabel: true
)
(MenuItem
@@ -670,7 +670,7 @@
(
(MenuItem
label: 'Pick a View'
- itemValue: doPickViews
+ itemValue: doPickView
translateLabel: false
isButton: true
hideMenuOnActivated: false
@@ -720,7 +720,7 @@
app := self new.
app open.
- app doPickViews.
+ app doPickView.
! !
!ViewTreeInspectorApplication methodsFor:'actions'!
@@ -1441,7 +1441,7 @@
!ViewTreeInspectorApplication methodsFor:'private'!
selectFocusView
- |rootView focusItem focusView|
+ |rootView focusView|
rootView := model rootView.
@@ -1450,15 +1450,21 @@
].
focusView isNil ifTrue:[^ self ].
- focusItem := model selectedItem.
-
- (focusItem notNil and:[focusItem widget == focusView]) ifTrue:[
+ self selectView:focusView
+!
+
+selectView:aView
+ |currentItem viewItem|
+
+ currentItem := model selectedItem.
+
+ (currentItem notNil and:[currentItem widget == aView]) ifTrue:[
^ self
].
- focusItem := model listOfItems recursiveDetect:[:el| el widget == focusView ].
-
- focusItem notNil ifTrue:[
- model selectItem:focusItem.
+ viewItem := model listOfItems recursiveDetect:[:el| el widget == aView ].
+
+ viewItem notNil ifTrue:[
+ model selectItem:viewItem.
].
!
@@ -1668,27 +1674,28 @@
inst notNil ifTrue:[ inst inspect ].
!
-doPickViews
+doPickView
"pick a window's topView"
- |screen window cursor|
+ |screen clickedView topWindow cursor|
self doUnpick.
cursor := Cursor fromImage:(self class crossHairIcon).
screen := Screen current.
- window := screen viewFromPoint:(screen pointFromUserShowing:cursor).
- window isNil ifTrue:[^ self].
-
- window := window topView.
-
- ( window == Screen current rootView
- or:[window == self window topView]
+ clickedView := screen viewFromPoint:(screen pointFromUserShowing:cursor).
+ clickedView isNil ifTrue:[^ self].
+
+ topWindow := clickedView topView.
+
+ ( topWindow == Screen current rootView
+ or:[topWindow == self window topView]
) ifTrue:[
^ self
].
- self setRootItem:(ViewTreeItem buildViewsFrom:window).
+ self setRootItem:(ViewTreeItem buildViewsFrom:topWindow).
+ self selectView:clickedView.
!
doSelectNextOfApplicationClass:aClass startingIn:anItem
@@ -2118,7 +2125,8 @@
isValidAndShown := widget shown.
].
isValidAndShown ifFalse:[
- label := Text string:label emphasis:#italic
+ label := Text string:label emphasis:#italic.
+ label colorizeAllWith:Color grey.
].
labelHeight := self heightOn:aGC.
@@ -3880,27 +3888,28 @@
additionalLabelForItem:anItem
"answer the additional lable for an item or nil"
- |applClass|
-
+ |l applClass applClassName|
+
+ l := nil.
showWidgetNames == true ifTrue:[
- ^ '[', anItem widget name, ']'
+ l := '"', anItem widget name, '"'
].
anItem isApplicationClass ifTrue:[
applClass := anItem applicationClass.
-
- applClass notNil ifTrue:[
- ^ ('[', applClass name, ']')
+ applClass notNil ifTrue:[
+ applClassName := '[', applClass name allBold, ']'.
+ l := (l isNil ifTrue:[''] ifFalse:[l , ' ']) , applClassName
].
].
- ^ nil
+ ^ l
!
showWidgetNames
"answer true if the additional text is the widget name
otherwise the name of the application"
- ^ showWidgetNames ? false
+ ^ showWidgetNames ? true
!
showWidgetNames:aBoolean
@@ -3932,7 +3941,8 @@
"
treeModel := aModel.
showRoot := true.
- showWidgetNames := false.
+ "/ showWidgetNames := false.
+ showWidgetNames := true.
! !
!ViewTreeInspectorApplication::ViewTreeModel::ItemList methodsFor:'searching'!