class: UIPainterView
comment/format in: #fullSpecFor:
changed:
#generateWindowSpec
#specFor:
fixed a stupid bug (which has been there for a long time),
which generated completely wrong UI specs iff a view has
a viewclass specified which contains subviews
(such as a Box, with an ImageView class in the ViewTreeInspector).
Then the same viewspec was reinserted multiple times (for each of its
subviews).
--- a/UIPainterView.st Tue Jul 30 09:45:42 2013 +0200
+++ b/UIPainterView.st Tue Jul 30 09:49:42 2013 +0200
@@ -1634,14 +1634,14 @@
!
generateWindowSpec
- |spec addToSpec|
+ |spec addToSpec specsAlready|
spec := OrderedCollection new.
+ specsAlready := IdentitySet new.
addToSpec :=
[:aView|
|vSpec|
-
"/ care for wrapped views ...
vSpec := self fullSpecFor:aView.
vSpec isNil ifTrue:[
@@ -1657,6 +1657,8 @@
AbortSignal raise
].
].
+ (specsAlready includes:vSpec) ifTrue:[self halt].
+ specsAlready add:vSpec.
spec add:vSpec
].
@@ -1664,6 +1666,8 @@
self components do:addToSpec.
spec := treeView generateFullSpecForComponents:spec named:methodName.
^ spec
+
+ "Modified: / 30-07-2013 / 09:13:13 / cg"
!
generateWindowSpecMethodSource
@@ -2504,6 +2508,8 @@
]
].
^ mySpec
+
+ "Modified: / 30-07-2013 / 09:12:18 / cg"
!
fullSpecWithAbsolutePositionFor:aView
@@ -2585,10 +2591,19 @@
|prop spec|
(prop := self propertyOfView:aView) isNil ifTrue:[^ nil].
+ "/ attention: the above prop may be a superview's prop,
+ "/ for subviews which have not been built by me
+ "/ (for example, in a box with a given viewClass like Inspector,
+ "/ we would return the boxes spec for the subviews.
+ "/ This is definitely NOT what we want (as it generates wrong specs).
+ "/ therefore check:
+ prop view == aView ifFalse:[^ nil].
spec := prop spec copy.
spec layoutFromView:aView.
^ spec
+
+ "Modified (comment): / 30-07-2013 / 09:47:51 / cg"
!
specForSelection