class: UIPainterView stable
authorClaus Gittinger <cg@exept.de>
Tue, 30 Jul 2013 09:49:42 +0200
changeset 303852374621e04b
parent 3037 876c28de42da
child 3039 c407489f2faf
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).
UIPainterView.st
     1.1 --- a/UIPainterView.st	Tue Jul 30 09:45:42 2013 +0200
     1.2 +++ b/UIPainterView.st	Tue Jul 30 09:49:42 2013 +0200
     1.3 @@ -1634,14 +1634,14 @@
     1.4  !
     1.5  
     1.6  generateWindowSpec
     1.7 -    |spec addToSpec|
     1.8 +    |spec addToSpec specsAlready|
     1.9  
    1.10      spec := OrderedCollection new.
    1.11 +    specsAlready := IdentitySet new.
    1.12  
    1.13      addToSpec :=
    1.14          [:aView|
    1.15              |vSpec|
    1.16 -
    1.17              "/ care for wrapped views ...
    1.18              vSpec := self fullSpecFor:aView.
    1.19              vSpec isNil ifTrue:[
    1.20 @@ -1657,6 +1657,8 @@
    1.21                      AbortSignal raise
    1.22                  ].
    1.23              ].
    1.24 +            (specsAlready includes:vSpec) ifTrue:[self halt].
    1.25 +            specsAlready add:vSpec.
    1.26              spec add:vSpec
    1.27          ].
    1.28  
    1.29 @@ -1664,6 +1666,8 @@
    1.30      self components do:addToSpec.
    1.31      spec := treeView generateFullSpecForComponents:spec named:methodName.
    1.32      ^ spec
    1.33 +
    1.34 +    "Modified: / 30-07-2013 / 09:13:13 / cg"
    1.35  !
    1.36  
    1.37  generateWindowSpecMethodSource
    1.38 @@ -2504,6 +2508,8 @@
    1.39          ]
    1.40      ].
    1.41      ^ mySpec
    1.42 +
    1.43 +    "Modified: / 30-07-2013 / 09:12:18 / cg"
    1.44  !
    1.45  
    1.46  fullSpecWithAbsolutePositionFor:aView
    1.47 @@ -2585,10 +2591,19 @@
    1.48      |prop spec|
    1.49  
    1.50      (prop := self propertyOfView:aView) isNil ifTrue:[^ nil].
    1.51 +    "/ attention: the above prop may be a superview's prop,
    1.52 +    "/ for subviews which have not been built by me
    1.53 +    "/ (for example, in a box with a given viewClass like Inspector,
    1.54 +    "/ we would return the boxes spec for the subviews.
    1.55 +    "/ This is definitely NOT what we want (as it generates wrong specs).
    1.56 +    "/ therefore check:
    1.57 +    prop view == aView ifFalse:[^ nil].
    1.58  
    1.59      spec := prop spec copy.
    1.60      spec layoutFromView:aView.
    1.61      ^ spec
    1.62 +
    1.63 +    "Modified (comment): / 30-07-2013 / 09:47:51 / cg"
    1.64  !
    1.65  
    1.66  specForSelection