UIPropertyView.st
author ca
Sat, 21 Jun 1997 12:21:22 +0200
changeset 168 8a79add2260f
parent 156 b332d7117c40
permissions -rw-r--r--
update notification when tab changed

"
 COPYRIGHT (c) 1997 by eXept Software AG
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"



ApplicationModel subclass:#UIPropertyView
	instanceVariableNames:'window specClass aspects modified modifiedHolder'
	classVariableNames:''
	poolDictionaries:''
	category:'Interface-UIPainter'
!

UIPropertyView subclass:#Specification
	instanceVariableNames:'specEdited specChannel'
	classVariableNames:''
	poolDictionaries:''
	privateIn:UIPropertyView
!

UIPropertyView subclass:#Dimension
	instanceVariableNames:'noteBook forView selection layoutTypes'
	classVariableNames:''
	poolDictionaries:''
	privateIn:UIPropertyView
!

!UIPropertyView class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 1997 by eXept Software AG
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"


!

documentation
"
    provides tools to the UIPainter accessing and manipulation properties
    and/or layouts.

    [see also:]
        UIBuilder

    [author:]
        Claus Atzkern
"

! !

!UIPropertyView class methodsFor:'instance creation'!

for:aTool in:aTopview
    |cls appl|

    cls := Smalltalk classNamed:(self name asString, '::', aTool asString).
    appl := cls new.
    appl origin:0.0@0.0 corner:1.0@1.0 in:aTopview.
  ^ appl
!

in:aTopview
    |appl|

    appl := self new.
    appl origin:0.0@0.0 corner:1.0@1.0 in:aTopview.
  ^ appl
! !

!UIPropertyView methodsFor:'accessing'!

buildFromSpec:aSpec
    |state subViews backGroundColor v|

    aSpec ~= specClass ifTrue:[
        window destroySubViews.

        aSpec notNil ifTrue:[
            v := builder buildFromSpec:aSpec in:window.
            window allViewBackground:(self viewBackground).
            window realizeAllSubViews.
        ]
    ].
    specClass := aSpec.
    self modified:false
        
!

modified
    "returns modifying state
    "
    ^ modified
!

modified:aState
    "set modifying state
    "
    modified := aState.

    modifiedHolder notNil ifTrue:[
        modifiedHolder value ~~ modified ifTrue:[
            modifiedHolder value:modified
        ]
    ]
!

modifiedHolder
    "returns the value holder set to true in case of modifying attributes
    "
    ^ modifiedHolder
!

modifiedHolder:aValueHolder
    "set the value holder set to true in case of modifying attributes
    "
    modifiedHolder notNil ifTrue:[
        modifiedHolder removeDependent:self. 
    ].

    (modifiedHolder := aValueHolder) notNil ifTrue:[
        modifiedHolder addDependent:self.
        modifiedHolder setValue:modified.
    ].
! !

!UIPropertyView methodsFor:'accessing hierarchy'!

lower
    "bring window to back
    "
    self window back
!

raise
    "bring window to front
    "
    self window raise
!

viewBackground
    ^ window viewBackground
!

viewBackground:aColor
    window viewBackground:aColor
!

window
    "returns window application is running in
    "
    ^ window
! !

!UIPropertyView methodsFor:'bindings'!

aspectFor:aKey
    "returns aspect for a key or nil
    "
    aspects notNil ifTrue:[
        ^ aspects at:aKey ifAbsent:nil
    ].
    ^ super aspectFor:aKey

!

aspects
    "returned monitored aspects
    "
    ^ aspects
!

aspects:aListOfAspects
    "set aspects to be monitored
    "
    (aspects := aListOfAspects) notNil ifTrue:[
        aspects do:[:el | el addDependent:self ].
    ].
    self modified:false.
! !

!UIPropertyView methodsFor:'change & update'!

update:something with:someArgument from:someone
    "any attribute changed its state in the current specification
    "
    someone == modifiedHolder ifTrue:[
        modified := modifiedHolder value
    ] ifFalse:[
        self modified:true
    ]
! !

!UIPropertyView methodsFor:'initialization'!

closeRequest

    modifiedHolder notNil ifTrue:[
        modifiedHolder removeDependent:self. 
        modifiedHolder := nil.
    ].

    super closeRequest


!

initialize
    super initialize.
    modified := false.
!

origin:anOrigin corner:aCorner in:aTopview
    window := SimpleView origin:anOrigin corner:aCorner in:aTopview

! !

!UIPropertyView::Specification methodsFor:'accessing'!

specEdited
    "gets current edit specification
    "
    ^ specEdited


!

specEdited:aSpec
    "sets current edit specification
    "
    |aspects|

    self modified:false.

    aSpec isNil ifTrue:[
        specChannel := nil.
        specEdited  := nil.
    ] ifFalse:[
        specEdited class == aSpec class ifTrue:[
            specEdited := aSpec.
            specChannel value:specEdited.
          ^ self modified:false.
        ].
        specEdited  := aSpec.
        aspects     := IdentityDictionary new.
        specChannel := specEdited asValue.
        specEdited class addBindingsTo:aspects for:specEdited channel:specChannel
    ].
    self aspects:aspects.
    self buildFromSpec:nil.


! !

!UIPropertyView::Specification methodsFor:'action'!

reload
    "reload specification
    "
    specChannel notNil ifTrue:[
        specChannel value:specEdited.
        self modified:false.
    ]


! !

!UIPropertyView::Dimension class methodsFor:'interface specs'!

specificationAlignmentOrigin
    "this window spec was automatically generated by the ST/X UIPainter"

    "do not manually edit this - the painter/builder may not be able to
     handle the specification if its corrupted."

    "
     UIPainter new openOnClass:UIPropertyView::Dimension andSelector:#specificationAlignmentOrigin
     UIPropertyView::Dimension new openInterface:#specificationAlignmentOrigin
    "

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'name:' 'uIPainterView'
              #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
              #'label:' 'unnamed'
              #'bounds:' #(#Rectangle 0 0 250 365)
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#LabelSpec
                    #'name:' 'label2'
                    #'layout:' #(#AlignmentOrigin 49 0 68 0 1 0)
                    #'label:' 'top'
                    #'adjust:' #right
                )
                 #(#LabelSpec
                    #'name:' 'label3'
                    #'layout:' #(#Point 58 13)
                    #'label:' 'relative'
                )
                 #(#LabelSpec
                    #'name:' 'label4'
                    #'layout:' #(#Point 154 14)
                    #'label:' 'offset'
                )
                 #(#LabelSpec
                    #'name:' 'label5'
                    #'layout:' #(#AlignmentOrigin 63 0 140 0 1 0)
                    #'label:' 'align H'
                    #'adjust:' #right
                )
                 #(#LabelSpec
                    #'name:' 'label6'
                    #'layout:' #(#AlignmentOrigin 63 0 166 0 1 0)
                    #'label:' 'align V'
                    #'adjust:' #right
                )
                 #(#InputFieldSpec
                    #'name:' 'editField1'
                    #'layout:' #(#LayoutFrame 58 0 41 0 115 0 59 0)
                    #'model:' #leftFraction
                    #'tabable:' true
                    #'type:' #numberOrNil
                )
                 #(#InputFieldSpec
                    #'name:' 'editField2'
                    #'layout:' #(#LayoutFrame 58 0 68 0 115 0 86 0)
                    #'model:' #topFraction
                    #'tabable:' true
                    #'type:' #numberOrNil
                )
                 #(#InputFieldSpec
                    #'name:' 'editField5'
                    #'layout:' #(#LayoutFrame 68 0 140 0 125 0 158 0)
                    #'model:' #leftAlignmentFraction
                    #'tabable:' true
                    #'type:' #numberOrNil
                )
                 #(#InputFieldSpec
                    #'name:' 'editField6'
                    #'layout:' #(#LayoutFrame 68 0 166 0 125 0 184 0)
                    #'model:' #topAlignmentFraction
                    #'tabable:' true
                    #'type:' #numberOrNil
                )
                 #(#InputFieldSpec
                    #'name:' 'editField3'
                    #'layout:' #(#LayoutFrame 154 0 41 0 212 0 59 0)
                    #'model:' #leftOffset
                    #'tabable:' true
                    #'type:' #numberOrNil
                )
                 #(#InputFieldSpec
                    #'name:' 'editField4'
                    #'layout:' #(#LayoutFrame 154 0 68 0 212 0 86 0)
                    #'model:' #topOffset
                    #'tabable:' true
                    #'type:' #numberOrNil
                )
                 #(#ActionButtonSpec
                    #'name:' 'button1'
                    #'layout:' #(#LayoutFrame 119 0 41 0 138 0 59 0)
                    #'label:' ''
                    #'model:' #makeRelativeLeft
                    #'isTriggerOnDown:' false
                    #'autoRepeat:' false
                )
                 #(#ActionButtonSpec
                    #'name:' 'button2'
                    #'layout:' #(#LayoutFrame 119 0 68 0 138 0 86 0)
                    #'label:' ''
                    #'model:' #makeRelativeTop
                    #'isTriggerOnDown:' false
                    #'autoRepeat:' false
                )
                 #(#ActionButtonSpec
                    #'name:' 'button3'
                    #'layout:' #(#LayoutFrame 217 0 41 0 236 0 59 0)
                    #'label:' ''
                    #'model:' #makeOffsetLeft
                    #'isTriggerOnDown:' false
                    #'autoRepeat:' false
                )
                 #(#ActionButtonSpec
                    #'name:' 'button4'
                    #'layout:' #(#LayoutFrame 217 0 68 0 236 0 86 0)
                    #'label:' ''
                    #'model:' #makeOffsetTop
                    #'isTriggerOnDown:' false
                    #'autoRepeat:' false
                )
                 #(#ActionButtonSpec
                    #'name:' 'button8'
                    #'layout:' #(#LayoutFrame 119 0 102 0 138 0 120 0)
                    #'label:' ''
                    #'model:' #makeRelativeLeftTop
                    #'isTriggerOnDown:' false
                    #'autoRepeat:' false
                )
                 #(#ActionButtonSpec
                    #'name:' 'button9'
                    #'layout:' #(#LayoutFrame 217 0 102 0 236 0 120 0)
                    #'label:' ''
                    #'model:' #makeOffsetLeftTop
                    #'isTriggerOnDown:' false
                    #'autoRepeat:' false
                )
                 #(#LabelSpec
                    #'name:' 'label7'
                    #'layout:' #(#AlignmentOrigin 49 0 102 0 1 0)
                    #'label:' 'all'
                    #'adjust:' #right
                )
                 #(#LabelSpec
                    #'name:' 'label1'
                    #'layout:' #(#AlignmentOrigin 49 0 41 0 1 0)
                    #'label:' 'left'
                    #'adjust:' #right
                )
                 #(#DividerSpec
                    #'name:' 'separator1'
                    #'layout:' #(#Rectangle 154 142 203 153)
                    #'orientation:' #horizontal
                )
                 #(#DividerSpec
                    #'name:' 'separator2'
                    #'layout:' #(#Rectangle 154 173 203 184)
                    #'orientation:' #horizontal
                )
                 #(#DividerSpec
                    #'name:' 'separator3'
                    #'layout:' #(#Rectangle 145 152 155 173)
                    #'orientation:' #vertical
                )
                 #(#DividerSpec
                    #'name:' 'separator4'
                    #'layout:' #(#Rectangle 203 152 213 173)
                    #'orientation:' #vertical
                )
                 #(#ActionButtonSpec
                    #'name:' 'alignBR'
                    #'layout:' #(#Rectangle 201 172 213 184)
                    #'label:' ''
                    #'model:' #makeAlignBottomRight
                    #'isTriggerOnDown:' false
                    #'autoRepeat:' false
                )
                 #(#ActionButtonSpec
                    #'name:' 'alignTL'
                    #'layout:' #(#Rectangle 145 141 157 153)
                    #'label:' ''
                    #'model:' #makeAlignTopLeft
                    #'isTriggerOnDown:' false
                    #'autoRepeat:' false
                )
                 #(#ActionButtonSpec
                    #'name:' 'alignTR'
                    #'layout:' #(#Rectangle 201 141 213 153)
                    #'label:' ''
                    #'model:' #makeAlignTopRight
                    #'isTriggerOnDown:' false
                    #'autoRepeat:' false
                )
                 #(#ActionButtonSpec
                    #'name:' 'alignBL'
                    #'layout:' #(#Rectangle 145 171 157 183)
                    #'label:' ''
                    #'model:' #makeAlignBottomLeft
                    #'isTriggerOnDown:' false
                    #'autoRepeat:' false
                )
                 #(#ActionButtonSpec
                    #'name:' 'alignTC'
                    #'layout:' #(#Rectangle 173 141 185 153)
                    #'label:' ''
                    #'model:' #makeAlignTopCenter
                    #'isTriggerOnDown:' false
                    #'autoRepeat:' false
                )
                 #(#ActionButtonSpec
                    #'name:' 'alignBC'
                    #'layout:' #(#Rectangle 173 172 185 184)
                    #'label:' ''
                    #'model:' #makeAlignBottomCenter
                    #'isTriggerOnDown:' false
                    #'autoRepeat:' false
                )
                 #(#ActionButtonSpec
                    #'name:' 'alignLC'
                    #'layout:' #(#Rectangle 145 156 157 168)
                    #'label:' ''
                    #'model:' #makeAlignLeftCenter
                    #'isTriggerOnDown:' false
                    #'autoRepeat:' false
                )
                 #(#ActionButtonSpec
                    #'name:' 'alignRC'
                    #'layout:' #(#Rectangle 201 156 213 168)
                    #'label:' ''
                    #'model:' #makeAlignRightCenter
                    #'isTriggerOnDown:' false
                    #'autoRepeat:' false
                )
                 #(#ActionButtonSpec
                    #'name:' 'alignC'
                    #'layout:' #(#Rectangle 173 156 185 168)
                    #'label:' ''
                    #'model:' #makeAlignCenter
                    #'isTriggerOnDown:' false
                    #'autoRepeat:' false
                )
              )
          )
      )
!

specificationExtent
    "this window spec was automatically generated by the ST/X UIPainter"

    "do not manually edit this - the painter/builder may not be able to
     handle the specification if its corrupted."

    "
     UIPainter new openOnClass:UIPropertyView::Dimension andSelector:#specificationExtent
     UIPropertyView::Dimension new openInterface:#specificationExtent
    "

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'name:' 'uIPainterView'
              #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
              #'label:' 'unnamed'
              #'bounds:' #(#Rectangle 0 0 224 251)
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#LabelSpec
                    #'name:' 'label1'
                    #'layout:' #(#AlignmentOrigin 99 0 45 0 1 0)
                    #'label:' 'horizontal:'
                    #'adjust:' #left
                )
                 #(#LabelSpec
                    #'name:' 'label2'
                    #'layout:' #(#AlignmentOrigin 99 0 72 0 1 0)
                    #'label:' 'vertical:'
                    #'adjust:' #left
                )
                 #(#InputFieldSpec
                    #'name:' 'editField1'
                    #'layout:' #(#LayoutFrame 104 0 45 0 197 0 63 0)
                    #'model:' #leftOffset
                    #'tabable:' true
                    #'type:' #numberOrNil
                )
                 #(#InputFieldSpec
                    #'name:' 'editField2'
                    #'layout:' #(#LayoutFrame 104 0 72 0 197 0 90 0)
                    #'model:' #rightOffset
                    #'tabable:' true
                    #'type:' #numberOrNil
                )
                 #(#LabelSpec
                    #'name:' 'extentLabel'
                    #'layout:' #(#LayoutFrame 9 0 20 0 63 0 37 0)
                    #'label:' 'Extent:'
                )
              )
          )
      )
!

specificationLayoutFrame
    "this window spec was automatically generated by the ST/X UIPainter"

    "do not manually edit this - the painter/builder may not be able to
     handle the specification if its corrupted."

    "
     UIPainter new openOnClass:UIPropertyView::Dimension andSelector:#specificationLayoutFrame
     UIPropertyView::Dimension new openInterface:#specificationLayoutFrame
    "

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'name:' 'uIPainterView'
              #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
              #'label:' 'unnamed'
              #'bounds:' #(#Rectangle 0 0 238 291)
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#LabelSpec
                    #'name:' 'label left'
                    #'layout:' #(#AlignmentOrigin 60 0 43 0 1 0)
                    #'label:' 'left'
                )
                 #(#LabelSpec
                    #'name:' 'label top'
                    #'layout:' #(#AlignmentOrigin 60 0 71 0 1 0)
                    #'label:' 'top'
                )
                 #(#LabelSpec
                    #'name:' 'label right'
                    #'layout:' #(#AlignmentOrigin 60 0 99 0 1 0)
                    #'label:' 'right'
                )
                 #(#LabelSpec
                    #'name:' 'label bottom'
                    #'layout:' #(#AlignmentOrigin 60 0 127 0 1 0)
                    #'label:' 'bottom'
                )
                 #(#LabelSpec
                    #'name:' 'label relative'
                    #'layout:' #(#Point 65 14)
                    #'label:' 'relative'
                )
                 #(#LabelSpec
                    #'name:' 'label offset'
                    #'layout:' #(#Point 159 14)
                    #'label:' 'offset'
                )
                 #(#LabelSpec
                    #'name:' 'label all relative'
                    #'layout:' #(#AlignmentOrigin 60 0 161 0 1 0)
                    #'label:' 'all'
                )
                 #(#InputFieldSpec
                    #'name:' 'relative E1'
                    #'layout:' #(#LayoutFrame 65 0 43 0 113 0 61 0)
                    #'model:' #leftFraction
                    #'type:' #numberOrNil
                )
                 #(#InputFieldSpec
                    #'name:' 'relative E2'
                    #'layout:' #(#LayoutFrame 65 0 71 0 113 0 89 0)
                    #'model:' #topFraction
                    #'type:' #numberOrNil
                )
                 #(#InputFieldSpec
                    #'name:' 'relative E3'
                    #'layout:' #(#LayoutFrame 65 0 99 0 113 0 117 0)
                    #'model:' #rightFraction
                    #'type:' #numberOrNil
                )
                 #(#InputFieldSpec
                    #'name:' 'relative E4'
                    #'layout:' #(#LayoutFrame 65 0 127 0 113 0 145 0)
                    #'model:' #bottomFraction
                    #'type:' #numberOrNil
                )
                 #(#InputFieldSpec
                    #'name:' 'offset E1'
                    #'layout:' #(#LayoutFrame 159 0 43 0 210 0 61 0)
                    #'model:' #leftOffset
                    #'type:' #numberOrNil
                )
                 #(#InputFieldSpec
                    #'name:' 'offset E2'
                    #'layout:' #(#LayoutFrame 159 0 71 0 210 0 89 0)
                    #'model:' #topOffset
                    #'type:' #numberOrNil
                )
                 #(#InputFieldSpec
                    #'name:' 'offset E3'
                    #'layout:' #(#LayoutFrame 159 0 99 0 210 0 117 0)
                    #'model:' #rightOffset
                    #'type:' #numberOrNil
                )
                 #(#InputFieldSpec
                    #'name:' 'offset E4'
                    #'layout:' #(#LayoutFrame 159 0 127 0 210 0 145 0)
                    #'model:' #bottomOffset
                    #'type:' #numberOrNil
                )
                 #(#ActionButtonSpec
                    #'name:' 'relative B1'
                    #'layout:' #(#LayoutFrame 117 0 43 0 136 0 61 0)
                    #'label:' ' '
                    #'model:' #makeRelativeLeft
                    #'isTriggerOnDown:' false
                    #'autoRepeat:' false
                )
                 #(#ActionButtonSpec
                    #'name:' 'relative B2'
                    #'layout:' #(#LayoutFrame 117 0 71 0 136 0 89 0)
                    #'label:' ' '
                    #'model:' #makeRelativeTop
                    #'isTriggerOnDown:' false
                    #'autoRepeat:' false
                )
                 #(#ActionButtonSpec
                    #'name:' 'relative B3'
                    #'layout:' #(#LayoutFrame 117 0 99 0 136 0 117 0)
                    #'label:' ' '
                    #'model:' #makeRelativeRight
                    #'isTriggerOnDown:' false
                    #'autoRepeat:' false
                )
                 #(#ActionButtonSpec
                    #'name:' 'relative B4'
                    #'layout:' #(#LayoutFrame 117 0 127 0 136 0 145 0)
                    #'label:' ' '
                    #'model:' #makeRelativeBottom
                    #'isTriggerOnDown:' false
                    #'autoRepeat:' false
                )
                 #(#ActionButtonSpec
                    #'name:' 'relative BAll'
                    #'layout:' #(#LayoutFrame 117 0 161 0 136 0 179 0)
                    #'label:' ' '
                    #'model:' #makeRelativeAll
                    #'isTriggerOnDown:' false
                    #'autoRepeat:' false
                )
                 #(#ActionButtonSpec
                    #'name:' 'offset B1'
                    #'layout:' #(#LayoutFrame 214 0 43 0 233 0 61 0)
                    #'label:' ''
                    #'model:' #makeOffsetLeft
                    #'isTriggerOnDown:' false
                    #'autoRepeat:' false
                )
                 #(#ActionButtonSpec
                    #'name:' 'offset B2'
                    #'layout:' #(#LayoutFrame 214 0 71 0 233 0 89 0)
                    #'label:' ''
                    #'model:' #makeOffsetTop
                    #'isTriggerOnDown:' false
                    #'autoRepeat:' false
                )
                 #(#ActionButtonSpec
                    #'name:' 'offset B3'
                    #'layout:' #(#LayoutFrame 214 0 99 0 233 0 117 0)
                    #'label:' ''
                    #'model:' #makeOffsetRight
                    #'isTriggerOnDown:' false
                    #'autoRepeat:' false
                )
                 #(#ActionButtonSpec
                    #'name:' 'offset B4'
                    #'layout:' #(#LayoutFrame 214 0 127 0 233 0 145 0)
                    #'label:' ''
                    #'model:' #makeOffsetBottom
                    #'isTriggerOnDown:' false
                    #'autoRepeat:' false
                )
                 #(#ActionButtonSpec
                    #'name:' 'offset BAll'
                    #'layout:' #(#LayoutFrame 214 0 161 0 233 0 179 0)
                    #'label:' ' '
                    #'model:' #makeOffsetAll
                    #'isTriggerOnDown:' false
                    #'autoRepeat:' false
                )
              )
          )
      )
!

specificationLayoutOrigin
    "this window spec was automatically generated by the ST/X UIPainter"

    "do not manually edit this - the painter/builder may not be able to
     handle the specification if its corrupted."

    "
     UIPainter new openOnClass:UIPropertyView::Dimension andSelector:#specificationLayoutOrigin
     UIPropertyView::Dimension new openInterface:#specificationLayoutOrigin
    "

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'name:' 'uIPainterView'
              #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
              #'label:' 'unnamed'
              #'bounds:' #(#Rectangle 0 0 238 303)
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#LabelSpec
                    #'name:' 'label1'
                    #'layout:' #(#AlignmentOrigin 52 0 44 0 1 0)
                    #'label:' 'left'
                )
                 #(#LabelSpec
                    #'name:' 'label2'
                    #'layout:' #(#AlignmentOrigin 52 0 71 0 1 0)
                    #'label:' 'top'
                )
                 #(#LabelSpec
                    #'name:' 'label3'
                    #'layout:' #(#Point 57 12)
                    #'label:' 'relative'
                )
                 #(#LabelSpec
                    #'name:' 'label4'
                    #'layout:' #(#Point 154 13)
                    #'label:' 'offset'
                )
                 #(#InputFieldSpec
                    #'name:' 'editField1'
                    #'layout:' #(#LayoutFrame 57 0 44 0 114 0 62 0)
                    #'model:' #leftFraction
                    #'tabable:' true
                    #'type:' #numberOrNil
                )
                 #(#InputFieldSpec
                    #'name:' 'editField2'
                    #'layout:' #(#LayoutFrame 57 0 71 0 114 0 89 0)
                    #'model:' #topFraction
                    #'tabable:' true
                    #'type:' #numberOrNil
                )
                 #(#InputFieldSpec
                    #'name:' 'editField3'
                    #'layout:' #(#LayoutFrame 154 0 44 0 212 0 62 0)
                    #'model:' #leftOffset
                    #'tabable:' true
                    #'type:' #numberOrNil
                )
                 #(#InputFieldSpec
                    #'name:' 'editField4'
                    #'layout:' #(#LayoutFrame 154 0 71 0 212 0 89 0)
                    #'model:' #topOffset
                    #'tabable:' true
                    #'type:' #numberOrNil
                )
                 #(#ActionButtonSpec
                    #'name:' 'button1'
                    #'layout:' #(#LayoutFrame 119 0 44 0 138 0 62 0)
                    #'label:' ''
                    #'model:' #makeRelativeLeft
                    #'isTriggerOnDown:' false
                    #'autoRepeat:' false
                )
                 #(#ActionButtonSpec
                    #'name:' 'button2'
                    #'layout:' #(#LayoutFrame 119 0 71 0 138 0 89 0)
                    #'label:' ''
                    #'model:' #makeRelativeTop
                    #'isTriggerOnDown:' false
                    #'autoRepeat:' false
                )
                 #(#ActionButtonSpec
                    #'name:' 'button3'
                    #'layout:' #(#LayoutFrame 216 0 44 0 235 0 62 0)
                    #'label:' ''
                    #'model:' #makeOffsetLeft
                    #'isTriggerOnDown:' false
                    #'autoRepeat:' false
                )
                 #(#ActionButtonSpec
                    #'name:' 'button4'
                    #'layout:' #(#LayoutFrame 216 0 71 0 235 0 89 0)
                    #'label:' ''
                    #'model:' #makeOffsetTop
                    #'isTriggerOnDown:' false
                    #'autoRepeat:' false
                )
                 #(#ActionButtonSpec
                    #'name:' 'button8'
                    #'layout:' #(#LayoutFrame 119 0 103 0 138 0 121 0)
                    #'label:' ''
                    #'model:' #makeRelativeLeftTop
                    #'isTriggerOnDown:' false
                    #'autoRepeat:' false
                )
                 #(#ActionButtonSpec
                    #'name:' 'button9'
                    #'layout:' #(#LayoutFrame 216 0 103 0 235 0 121 0)
                    #'label:' ''
                    #'model:' #makeOffsetLeftTop
                    #'isTriggerOnDown:' false
                    #'autoRepeat:' false
                )
                 #(#LabelSpec
                    #'name:' 'label5'
                    #'layout:' #(#AlignmentOrigin 52 0 103 0 1 0)
                    #'label:' 'all'
                )
              )
          )
      )
!

specificationPoint
    "this window spec was automatically generated by the ST/X UIPainter"

    "do not manually edit this - the painter/builder may not be able to
     handle the specification if its corrupted."

    "
     UIPainter new openOnClass:UIPropertyView::Dimension andSelector:#specificationPoint
     UIPropertyView::Dimension new openInterface:#specificationPoint
    "

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'name:' 'uIPainterView'
              #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
              #'label:' 'unnamed'
              #'bounds:' #(#Rectangle 0 0 238 303)
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#LabelSpec
                    #'name:' 'label1'
                    #'layout:' #(#AlignmentOrigin 75 0 19 0 1 0)
                    #'label:' 'origin x:'
                )
                 #(#LabelSpec
                    #'name:' 'label2'
                    #'layout:' #(#AlignmentOrigin 75 0 46 0 1 0)
                    #'label:' 'origin y:'
                )
                 #(#InputFieldSpec
                    #'name:' 'editField1'
                    #'layout:' #(#LayoutFrame 77 0 19 0 170 0 37 0)
                    #'model:' #absLeft
                    #'tabable:' true
                    #'type:' #numberOrNil
                )
                 #(#InputFieldSpec
                    #'name:' 'editField2'
                    #'layout:' #(#LayoutFrame 77 0 46 0 170 0 64 0)
                    #'model:' #absTop
                    #'tabable:' true
                    #'type:' #numberOrNil
                )
              )
          )
      )
!

specificationRectangle
    "this window spec was automatically generated by the ST/X UIPainter"

    "do not manually edit this - the painter/builder may not be able to
     handle the specification if its corrupted."

    "
     UIPainter new openOnClass:UIPropertyView::Dimension andSelector:#specificationRectangle
     UIPropertyView::Dimension new openInterface:#specificationRectangle
    "

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'name:' 'uIPainterView'
              #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
              #'label:' 'unnamed'
              #'bounds:' #(#Rectangle 0 0 238 303)
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#LabelSpec
                    #'name:' 'label1'
                    #'layout:' #(#AlignmentOrigin 80 0 19 0 1 0)
                    #'label:' 'origin x:'
                    #'adjust:' #left
                )
                 #(#LabelSpec
                    #'name:' 'label2'
                    #'layout:' #(#AlignmentOrigin 80 0 46 0 1 0)
                    #'label:' 'origin y:'
                    #'adjust:' #left
                )
                 #(#InputFieldSpec
                    #'name:' 'editField1'
                    #'layout:' #(#LayoutFrame 81 0 19 0 174 0 37 0)
                    #'model:' #leftOffset
                    #'tabable:' true
                    #'type:' #numberOrNil
                )
                 #(#InputFieldSpec
                    #'name:' 'editField2'
                    #'layout:' #(#LayoutFrame 81 0 46 0 174 0 64 0)
                    #'model:' #topOffset
                    #'tabable:' true
                    #'type:' #numberOrNil
                )
                 #(#LabelSpec
                    #'name:' 'label4'
                    #'layout:' #(#AlignmentOrigin 80 0 74 0 1 0)
                    #'label:' 'corner x:'
                    #'adjust:' #left
                )
                 #(#LabelSpec
                    #'name:' 'label5'
                    #'layout:' #(#AlignmentOrigin 80 0 101 0 1 0)
                    #'label:' 'corner y:'
                    #'adjust:' #left
                )
                 #(#InputFieldSpec
                    #'name:' 'editField3'
                    #'layout:' #(#LayoutFrame 81 0 74 0 174 0 92 0)
                    #'model:' #rightOffset
                    #'tabable:' true
                    #'type:' #numberOrNil
                )
                 #(#InputFieldSpec
                    #'name:' 'editField4'
                    #'layout:' #(#LayoutFrame 81 0 101 0 174 0 119 0)
                    #'model:' #bottomOffset
                    #'tabable:' true
                    #'type:' #numberOrNil
                )
              )
          )
      )
! !

!UIPropertyView::Dimension methodsFor:'accessing'!

forView
    "get the view the layout derives from
    "
  ^ forView
!

forView:aView
    "set the view the layout derives from
    "
    forView := aView.
    self update.
!

label
    ^ 'Layout'
!

layout
    "returns current layout
    "
    |layout|

    selection notNil ifTrue:[
        layout := self perform:(('get', selection asString) asSymbol).
    ].
    ^ layout
!

layoutType
    "returns current layoutType
    "
    ^ selection
!

update
    "update from physical view
    "
    |superView|

    forView notNil ifTrue:[
        superView := forView superView
    ].
    noteBook enabled:((superView isNil or:[superView specClass isLayoutContainer]) not).
    self selection:(UIPainterView layoutType:forView).


! !

!UIPropertyView::Dimension methodsFor:'accessing hierarchy'!

window
    ^ noteBook


! !

!UIPropertyView::Dimension methodsFor:'initialization'!

initialize
    "initialize channels
    "
    |layoutAspects|

    super initialize.

    layoutAspects := IdentityDictionary new.

    #(  bottomFraction          bottomOffset
        leftFraction            leftOffset
        topFraction             topOffset
        rightFraction           rightOffset
        leftAlignmentFraction   topAlignmentFraction
        absLeft                 absTop               
    )
    do:[:aKey|
        layoutAspects at:aKey put:(ValueHolder new)
    ].
    self aspects:layoutAspects.


!

origin:anOrigin corner:aCorner in:aTopView
    "set dimensions
    "
    noteBook := NoteBookView origin:anOrigin corner:aCorner in:aTopView.
    window   := noteBook canvas.

    noteBook direction:#bottom.
    noteBook useIndex:true.
    layoutTypes := #( #LayoutFrame #AlignmentOrigin #LayoutOrigin #Point #Rectangle ).     
    noteBook list:#( 'Frame' 'Alig.Origin' 'LayoutOrigin' 'Point' 'Rectangle' ).

    noteBook action:[:anIndex|
        anIndex notNil ifTrue:[self selection:(layoutTypes at:anIndex)].
    ].

! !

!UIPropertyView::Dimension methodsFor:'layout access'!

getAlignmentOrigin
    "returns current layout as alignmentOrigin
    "
    |layout|

    layout  := AlignmentOrigin new.

    layout   leftOffset:((aspects at:#leftOffset)   value) ? 0.
    layout    topOffset:((aspects at:#topOffset)    value) ? 0.
    layout leftFraction:((aspects at:#leftFraction) value) ? 0.
    layout  topFraction:((aspects at:#topFraction)  value) ? 0.

    layout leftAlignmentFraction:((aspects at:#leftAlignmentFraction) value) ? 0.
    layout  topAlignmentFraction:((aspects at:#topAlignmentFraction)  value) ? 0.

  ^ layout
!

getExtent
    "returns current extent
    "
  ^ Point x:(((aspects at:#leftOffset)   value) ? 0)
          y:(((aspects at:#rightOffset)  value) ? 0)
!

getLayoutFrame
    "returns current layout as layoutFrame
    "
    |layout|

    layout  := LayoutFrame new.

    layout     leftOffset:((aspects at:#leftOffset)     value) ? 0.
    layout    rightOffset:((aspects at:#rightOffset)    value) ? 0.
    layout      topOffset:((aspects at:#topOffset)      value) ? 0.
    layout   bottomOffset:((aspects at:#bottomOffset)   value) ? 0.
    layout   leftFraction:((aspects at:#leftFraction)   value) ? 0.
    layout  rightFraction:((aspects at:#rightFraction)  value) ? 0.
    layout    topFraction:((aspects at:#topFraction)    value) ? 0.
    layout bottomFraction:((aspects at:#bottomFraction) value) ? 0.

  ^ layout
!

getLayoutOrigin
    "returns current layout as layoutOrigin
    "
    |layout|

    layout  := LayoutOrigin new.

    layout   leftOffset:((aspects at:#leftOffset)   value) ? 0.
    layout    topOffset:((aspects at:#topOffset)    value) ? 0.
    layout leftFraction:((aspects at:#leftFraction) value) ? 0.
    layout  topFraction:((aspects at:#topFraction)  value) ? 0.

  ^ layout
!

getPoint
    "returns current layout as point
    "
  ^ Point x:(((aspects at:#absLeft) value) ? 0)
          y:(((aspects at:#absTop)  value) ? 0)
!

getRectangle
    "returns current layout as rectangle
    "
  ^ Rectangle left:(((aspects at:#leftOffset)   value) ? 0)
               top:(((aspects at:#topOffset)    value) ? 0)
             right:(((aspects at:#rightOffset)  value) ? 0)
            bottom:(((aspects at:#bottomOffset) value) ? 0)
! !

!UIPropertyView::Dimension methodsFor:'layout fetch'!

fetchAlignmentOrigin
    "fetch alignmentOrigin
    "
    |layout type extent|

    type    := UIPainterView layoutType:forView.
    layout  := forView geometryLayout.

    layout isLayout ifTrue:[
        (aspects at:#leftOffset)   value:(layout leftOffset).
        (aspects at:#leftFraction) value:(layout leftFraction).
        (aspects at:#topOffset)    value:(layout topOffset).
        (aspects at:#topFraction)  value:(layout topFraction).

        type == #AlignmentOrigin ifTrue:[
            (aspects at:#leftAlignmentFraction) value:(layout leftAlignmentFraction).
            (aspects at:#topAlignmentFraction)  value:(layout topAlignmentFraction).
          ^ self
        ]
    ] ifFalse:[
        layout := forView computeOrigin.

        (aspects at:#leftOffset)   value:(layout x).
        (aspects at:#leftFraction) value:0.
        (aspects at:#topOffset)    value:(layout y).
        (aspects at:#topFraction)  value:0.
    ].
    (aspects at:#leftAlignmentFraction) value:0.
    (aspects at:#topAlignmentFraction)  value:0.
!

fetchExtent
    "fetch extent
    "
    |extent|

    extent  := forView computeExtent.

    (aspects at:#leftOffset)  value:(extent x).
    (aspects at:#rightOffset) value:(extent y).

!

fetchLayoutFrame
    "fetch layoutFrame
    "
    |layout|

    layout  := UIPainterView asLayoutFrameFromView:forView.

    (aspects at:#leftOffset)     value:(layout leftOffset).
    (aspects at:#leftFraction)   value:(layout leftFraction).
    (aspects at:#topOffset)      value:(layout topOffset).
    (aspects at:#topFraction)    value:(layout topFraction).
    (aspects at:#rightOffset)    value:(layout rightOffset).
    (aspects at:#bottomOffset)   value:(layout bottomOffset).
    (aspects at:#rightFraction)  value:(layout rightFraction).
    (aspects at:#bottomFraction) value:(layout bottomFraction).
!

fetchLayoutOrigin
    "fetch layoutOrigin
    "
    |layout|

    layout  := UIPainterView asLayoutFrameFromView:forView.

    (aspects at:#leftOffset)   value:(layout leftOffset).
    (aspects at:#leftFraction) value:(layout leftFraction).
    (aspects at:#topOffset)    value:(layout topOffset).
    (aspects at:#topFraction)  value:(layout topFraction).
!

fetchPoint
    "fetch point
    "
    |origin|

    origin  := forView computeOrigin.

    (aspects at:#absLeft) value:(origin x).
    (aspects at:#absTop)  value:(origin y).

!

fetchRectangle
    "fetch rectangle
    "
    |origin corner|

    origin  := forView computeOrigin.
    corner  := forView computeCorner.

    (aspects at:#leftOffset)   value:(origin x).
    (aspects at:#rightOffset)  value:(corner x).
    (aspects at:#topOffset)    value:(origin y).
    (aspects at:#bottomOffset) value:(corner y).

! !

!UIPropertyView::Dimension methodsFor:'layout make align'!

makeAlignBottomCenter
    self makeAlignLeft:0.5 top:1


!

makeAlignBottomLeft
    self makeAlignLeft:0 top:1


!

makeAlignBottomRight
    self makeAlignLeft:1 top:1


!

makeAlignCenter
    self makeAlignLeft:0.5 top:0.5

!

makeAlignLeft:leftAlignmentFraction top:topAlignmentFraction
    |lAF tAF lO tO ext|

    lAF     := (aspects at:#leftAlignmentFraction) value ? 0.
    tAF     := (aspects at:#topAlignmentFraction)  value ? 0.
    ext     := forView computeExtent.

    (aspects at:#leftAlignmentFraction) value:leftAlignmentFraction.
    (aspects at:#topAlignmentFraction)  value:topAlignmentFraction.

    lO := (aspects at:#leftOffset) value ? 0.
    tO := (aspects at:#topOffset)  value ? 0.

    lO := lO + (ext x * (leftAlignmentFraction - lAF)).
    tO := tO + (ext y * (topAlignmentFraction  - tAF)).

    (aspects at:#leftOffset) value:(lO rounded).
    (aspects at:#topOffset)  value:(tO rounded).
!

makeAlignLeftCenter
    self makeAlignLeft:0 top:0.5

!

makeAlignRightCenter
    self makeAlignLeft:1 top:0.5

!

makeAlignTopCenter
    self makeAlignLeft:0.5 top:0

!

makeAlignTopLeft
    self makeAlignLeft:0 top:0

!

makeAlignTopRight
    self makeAlignLeft:1 top:0


! !

!UIPropertyView::Dimension methodsFor:'layout make relative/absolute'!

makeLayout:what xOrY:xOrY offset:aBool
    |extent fraction offset fractSymb offsetSymb|

    extent     := (forView superView computeExtent) perform:xOrY.
    fractSymb  := (what, 'Fraction') asSymbol.
    offsetSymb := (what,   'Offset') asSymbol.

    fraction := (aspects at:fractSymb)  value.
    offset   := (aspects at:offsetSymb) value.

    aBool ifTrue:[
        offset   := offset + ((fraction * extent) asInteger).
        fraction := 0.
    ] ifFalse:[
        fraction   := (fraction + (offset / extent)) asFloat.

        (fraction > 1.0) ifTrue:[ fraction := 1.0 ].
        (fraction < 0.0) ifTrue:[ fraction := 0 ].
        offset := 0.
    ].
    (aspects at:offsetSymb) value:offset.
    (aspects at:fractSymb)  value:fraction.
!

makeOffsetAll
    self makeOffsetLeft.
    self makeOffsetTop.
    self makeOffsetRight.
    self makeOffsetBottom.


!

makeOffsetBottom
    self makeLayout:'bottom' xOrY:#y offset:true.


!

makeOffsetLeft
    self makeLayout:'left' xOrY:#x offset:true.

!

makeOffsetLeftTop
    self makeOffsetLeft.
    self makeOffsetTop.

!

makeOffsetRight
    self makeLayout:'right' xOrY:#x offset:true.

!

makeOffsetTop
    self makeLayout:'top' xOrY:#y offset:true.

!

makeRelativeAll
    self makeRelativeLeft.
    self makeRelativeTop.
    self makeRelativeRight.
    self makeRelativeBottom.


!

makeRelativeBottom
    self makeLayout:'bottom' xOrY:#y offset:false.


!

makeRelativeLeft
    self makeLayout:'left' xOrY:#x offset:false.

!

makeRelativeLeftTop
    self makeRelativeLeft.
    self makeRelativeTop.

!

makeRelativeRight
    self makeLayout:'right' xOrY:#x offset:false.

!

makeRelativeTop
    self makeLayout:'top' xOrY:#y offset:false.

! !

!UIPropertyView::Dimension methodsFor:'selection'!

selection
    ^ selection

!

selection:aLayoutType
    |spec idx|

    selection == aLayoutType ifFalse:[
        (selection := aLayoutType) notNil ifTrue:[
            self perform:(('fetch',   selection asString) asSymbol).
            spec := ('specification', selection asString) asSymbol.
            spec := self class perform:spec.
        ].
        self buildFromSpec:spec.
    ] ifTrue:[
        selection notNil ifTrue:[
            self perform:(('fetch',   selection asString) asSymbol).
            self modified:false.
        ]
    ].
    idx := layoutTypes findFirst:[:type| type == aLayoutType ].
    noteBook setSelection:idx.

! !

!UIPropertyView class methodsFor:'documentation'!

version
    ^ '$Header$'
! !