UIPainter.st
author ca
Fri, 21 Feb 1997 20:33:57 +0100
changeset 58 668eb9eae2ac
parent 55 19e021c8f1ef
child 59 0a2b2ff030a0
permissions -rw-r--r--
*** empty log message ***

"
 COPYRIGHT (c) 1995 by Claus Gittinger
	      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:#UIPainter
	instanceVariableNames:'menu nameField elementMenu workView treeView outletView stringBox
		actionBox listBox fileBox currentFileName topView propertyFrame
		whichProperty nameChannel applyAction specClass specSelector
		specSuperclass aspectHolders specShown specSpecificAspectHolders
		claus'
	classVariableNames:''
	poolDictionaries:''
	category:'Interface-UIPainter'
!

HorizontalPanelView subclass:#ButtonPanel
	instanceVariableNames:'receiver argumentToSelector'
	classVariableNames:''
	poolDictionaries:''
	privateIn:UIPainter
!

!UIPainter class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 1995 by Claus Gittinger
	      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
"
    not yet finished, not yet published, not yet released.

    [start with:]
        UIPainter open
"
! !

!UIPainter class methodsFor:'interface specs'!

actionButtonModelSpec
    "UIPainter new openOnClass:self andSelector:#actionButtonModelSpec"

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#FramedBoxSpec
                    #'layout:' #(#LayoutFrame 0 0 -1 0 251 0 289 0)
                    #'component:' 
                     #(#SpecCollection
                        #'collection:' 
                         #(
                           #(#VerticalPanelViewSpec
                              #'layout:' #(#LayoutFrame 6 0 26 0 78 0 216 0)
                              #'component:' 
                               #(#SpecCollection
                                  #'collection:' 
                                   #(
                                     #(#LabelSpec
                                        #'name:' 'label'
                                        #'layout:' #(#LayoutFrame 0 0 47 0 57 0 71 0)
                                        #'label:' 'aspect:'
                                    )
                                     #(#LabelSpec
                                        #'name:' 'label'
                                        #'layout:' #(#LayoutFrame 0 0 119 0 62 0 143 0)
                                        #'label:' 'change:'
                                    )
                                  )
                              )
                              #'horizontalLayout:' #left
                              #'verticalLayout:' #spreadSpace
                          )
                           #(#VerticalPanelViewSpec
                              #'layout:' #(#LayoutFrame 80 0 24 0 231 0 214 0)
                              #'component:' 
                               #(#SpecCollection
                                  #'collection:' 
                                   #(
                                     #(#InputFieldSpec
                                        #'name:' 'aspectInput'
                                        #'layout:' #(#LayoutFrame 0 0 49 0 163 0 69 0)
                                        #model: #aspectChannel
                                        #acceptOnLostFocus: true
                                        #tabable: true
                                    )
                                     #(#InputFieldSpec
                                        #'name:' 'changeInput'
                                        #'layout:' #(#LayoutFrame 0 0 119 0 163 0 142 0)
                                        #model: #changeChannel
                                        #acceptOnLostFocus: true
                                        #tabable: true
                                    )
                                  )
                              )
                              #'horizontalLayout:' #fit
                              #'verticalLayout:' #spreadSpace
                          )
                           #(#ActionButtonSpec
                              #'name:' 'button'
                              #'layout:' #(#LayoutFrame 102 0 246 0 153 0 272 0)
                              #'label:' 'apply'
                              #'model:' #setModelAspects
                          )
                        )
                    )
                    #'labelPosition:' #topLeft
                    #'showFrame:' false
                )
              )
          )
          #'window:' 
           #(#WindowSpec
              #'label:' 'unnamed'
              #'bounds:' #(#Rectangle 0 0 255 292)
          )
      )
!

cancelAndApplySpec
    "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:UIPainter andSelector:#cancelAndApplySpec
     UIPainter new openInterface:#cancelAndApplySpec
    "

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
              #'label:' 'unnamed'
              #'bounds:' #(#Rectangle 0 0 225 45)
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#ActionButtonSpec
                    #'name:' 'cancel'
                    #'layout:' #(#LayoutFrame 26 0 13 0 77 0 35 0)
                    #'label:' 'cancel'
                    #'model:' #cancel
                )
                 #(#ActionButtonSpec
                    #'name:' 'apply'
                    #'layout:' #(#LayoutFrame 139 0 13 0 190 0 35 0)
                    #'label:' 'apply'
                    #'model:' #apply
                )
              )
          )
      )
!

colorSpec
    "UIBuilder new openOnClass:self andSelector:#colorSpec"
    "Builder new openInterface:#colorSpec"

    <resource: #canvas>
    ^
     
       #(#FullSpec
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#FramedBoxSpec
                    #'layout:' #(#LayoutFrame 0 0 -1 0 252 0 290 0)
                    #'component:' 
                     #(#SpecCollection
                        #'collection:' 
                         #(
                           #(#VerticalPanelViewSpec
                              #'layout:' #(#LayoutFrame 6 0 26 0 100 0 215 0)
                              #'component:' 
                               #(#SpecCollection
                                  #'collection:' 
                                   #(
                                     #(#LabelSpec
                                        #'name:' 'label'
                                        #'layout:' #(#LayoutFrame 0 0 47 0 87 0 71 0)
                                        #'label:' 'foreground:'
                                    )
                                     #(#LabelSpec
                                        #'name:' 'label'
                                        #'layout:' #(#LayoutFrame 0 0 119 0 93 0 143 0)
                                        #'label:' 'background:'
                                    )
                                  )
                              )
                              #'horizontalLayout:' #left
                              #'verticalLayout:' #spreadSpace
                          )
                           #(#VerticalPanelViewSpec
                              #'layout:' #(#LayoutFrame 114 0 24 0 233 0 213 0)
                              #'component:' 
                               #(#SpecCollection
                                  #'collection:' 
                                   #(
                                     #(#InputFieldSpec
                                        #'layout:' #(#LayoutFrame 0 0 49 0 163 0 69 0)
                                        #model: #foregroundColor
                                        #acceptOnLostFocus: true
                                        #tabable: true

                                    )
                                     #(#InputFieldSpec
                                        #'layout:' #(#LayoutFrame 0 0 119 0 163 0 142 0)
                                        #model: #backgroundColor
                                        #acceptOnLostFocus: true
                                        #tabable: true

                                    )
                                  )
                              )
                              #'horizontalLayout:' #fit
                              #'verticalLayout:' #spreadSpace
                          )
                           #(#ActionButtonSpec
                              #'name:' 'button'
                              #'layout:' #(#LayoutFrame 102 0 246 0 153 0 272 0)
                              #'label:' 'apply'
                              #'model:' #setColors
                              #tabable: true

                          )
                        )
                    )
                    #'labelPosition:' #topLeft
                    #'showFrame:' false
                )
              )
          )
          #'window:' 
           #(#WindowSpec
              #'label:' 'unnamed'
              #'bounds:' #(#Rectangle 0 0 255 292)
          )
      )
!

geometrySpecForAlignmentOrigin
    "
    UIPainter new openOnClass:self andSelector:#geometrySpecForAlignmentOrigin
    "
    <resource: #canvas>

    ^

       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
              #'label:' 'unnamed'
              #'bounds:' #(#Rectangle 0 0 248 304)
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#LabelSpec
                    #'name:' 'label1'
                    #'layout:' #(#LayoutFrame 5 0 42 0 48 0 60 0)
                    #'label:' 'left'
                )
                 #(#LabelSpec
                    #'name:' 'label2'
                    #'layout:' #(#LayoutFrame 5 0 69 0 48 0 87 0)
                    #'label:' 'top'
                )
                 #(#LabelSpec
                    #'name:' 'label3'
                    #'layout:' #(#LayoutFrame 57 0 10 0 103 0 27 0)
                    #'label:' 'relative'
                )
                 #(#LabelSpec
                    #'name:' 'label4'
                    #'layout:' #(#LayoutFrame 154 0 11 0 190 0 28 0)
                    #'label:' 'offset'
                )
                 #(#LabelSpec
                    #'name:' 'label5'
                    #'layout:' #(#LayoutFrame 5 0 96 0 48 0 114 0)
                    #'label:' 'align H'
                )
                 #(#LabelSpec
                    #'name:' 'label6'
                    #'layout:' #(#LayoutFrame 5 0 122 0 48 0 140 0)
                    #'label:' 'align V'
                )
                 #(#InputFieldSpec
                    #'name:' 'editField1'
                    #'type:' #numberOrNil
                    #'layout:' #(#LayoutFrame 57 0 42 0 114 0 60 0)
                    #'model:' #leftFraction
                    #acceptOnLostFocus: true
                    #tabable: true
                )
                 #(#InputFieldSpec
                    #'name:' 'editField2'
                    #'type:' #numberOrNil
                    #'layout:' #(#LayoutFrame 57 0 69 0 114 0 87 0)
                    #'model:' #topFraction
                    #acceptOnLostFocus: true
                    #tabable: true
                )
                 #(#InputFieldSpec
                    #'name:' 'editField5'
                    #'type:' #numberOrNil
                    #'layout:' #(#LayoutFrame 57 0 96 0 114 0 114 0)
                    #'model:' #leftAlignmentFraction
                    #acceptOnLostFocus: true
                    #tabable: true
                )
                 #(#InputFieldSpec
                    #'name:' 'editField6'
                    #'type:' #numberOrNil
                    #'layout:' #(#LayoutFrame 56 0 122 0 113 0 140 0)
                    #'model:' #topAlignmentFraction
                    #acceptOnLostFocus: true
                    #tabable: true
                )
                 #(#InputFieldSpec
                    #'name:' 'editField3'
                    #'type:' #numberOrNil
                    #'layout:' #(#LayoutFrame 154 0 42 0 212 0 60 0)
                    #'model:' #leftOffset
                    #acceptOnLostFocus: true
                    #tabable: true
                )
                 #(#InputFieldSpec
                    #'name:' 'editField4'
                    #'type:' #numberOrNil
                    #'layout:' #(#LayoutFrame 154 0 69 0 212 0 87 0)
                    #'model:' #topOffset
                    #acceptOnLostFocus: true
                    #tabable: true
                )
                 #(#ActionButtonSpec
                    #'name:' 'button1'
                    #'layout:' #(#LayoutFrame 119 0 42 0 138 0 60 0)
                    #'label:' ''
                    #'model:' #makeRelativeLeft
                )
                 #(#ActionButtonSpec
                    #'name:' 'button2'
                    #'layout:' #(#LayoutFrame 119 0 69 0 138 0 87 0)
                    #'label:' ''
                    #'model:' #makeRelativeTop
                )
                 #(#ActionButtonSpec
                    #'name:' 'button3'
                    #'layout:' #(#LayoutFrame 216 0 42 0 235 0 60 0)
                    #'label:' ''
                    #'model:' #makeOffsetLeft
                )
                 #(#ActionButtonSpec
                    #'name:' 'button4'
                    #'layout:' #(#LayoutFrame 216 0 69 0 235 0 87 0)
                    #'label:' ''
                    #'model:' #makeOffsetTop
                )


               #(#ActionButtonSpec
                  #'name:' 'button'
                  #'layout:' #(#LayoutFrame 16 0 210 0 76 0 240 0)
                  #'label:' 'frame'
                  #'model:' #setLayoutFrame
                )
               #(#ActionButtonSpec
                  #'name:' 'button'
                  #'layout:' #(#LayoutFrame 96 0 210 0 156 0 240 0)
                  #'label:' 'origin'
                  #'model:' #setLayoutOrigin
                )
               #(#ActionButtonSpec
                  #'name:' 'button'
                  #'layout:' #(#LayoutFrame 176 0 210 0 236 0 240 0)
                  #'label:' 'align'
                  #'model:' #setAlignmentOrigin
                  #'initiallyDisabled:' true
                )
               #(#ActionButtonSpec
                  #'layout:' #(#LayoutFrame 96 0 260 0 156 0 290 0)
                  #'label:' 'apply'
                  #'model:' #setDimensionForLayoutFrame
                  #tabable: true
                )

              )
          )
      )


!

geometrySpecForLayoutFrame
    "
    UIPainter new openOnClass:self andSelector:#geometrySpecForLayoutFrame
    "
    <resource: #canvas>

    ^

       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
              #'label:' 'unnamed'
              #'bounds:' #(#Rectangle 0 0 300 300)
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#LabelSpec
                    #'name:' 'label left'
                    #'layout:' #(#LayoutFrame 12 0 39 0 53 0 57 0)
                    #'label:' 'left'
                )
                 #(#LabelSpec
                    #'name:' 'label top'
                    #'layout:' #(#LayoutFrame 12 0 67 0 53 0 85 0)
                    #'label:' 'top'
                )
                 #(#LabelSpec
                    #'name:' 'label right'
                    #'layout:' #(#LayoutFrame 12 0 95 0 53 0 113 0)
                    #'label:' 'right'
                )
                 #(#LabelSpec
                    #'name:' 'label bottom'
                    #'layout:' #(#LayoutFrame 12 0 123 0 53 0 141 0)
                    #'label:' 'bottom'
                )
                 #(#LabelSpec
                    #'name:' 'label relative'
                    #'layout:' #(#LayoutFrame 65 0 6 0 110 0 24 0)
                    #'label:' 'relative'
                )
                 #(#LabelSpec
                    #'name:' 'label offset'
                    #'layout:' #(#LayoutFrame 159 0 6 0 190 0 24 0)
                    #'label:' 'offset'
                )
                 #(#LabelSpec
                    #'name:' 'label all relative'
                    #'layout:' #(#LayoutFrame 12 0 157 0 53 0 175 0)
                    #'label:' 'all'
                )
                 #(#LabelSpec
                    #'name:' 'label all absolute'
                    #'layout:' #(#LayoutFrame 159 0 157 0 210 0 175 0)
                    #'label:' 'all'
                )
                 #(#InputFieldSpec
                    #'name:' 'relative E1'
                    #'layout:' #(#LayoutFrame 65 0 39 0 113 0 57 0)
                    #'model:' #leftFraction
                    #'type:' #numberOrNil
                    #'immediateAccept:' false
                    #'acceptOnLeave:' true
                    #'acceptOnReturn:' true
                    #'acceptOnTab:' true
                    #'acceptOnLostFocus:' true
                )
                 #(#InputFieldSpec
                    #'name:' 'relative E2'
                    #'layout:' #(#LayoutFrame 65 0 67 0 113 0 85 0)
                    #'model:' #topFraction
                    #'type:' #numberOrNil
                    #'immediateAccept:' false
                    #'acceptOnLeave:' true
                    #'acceptOnReturn:' true
                    #'acceptOnTab:' true
                    #'acceptOnLostFocus:' true
                )
                 #(#InputFieldSpec
                    #'name:' 'relative E3'
                    #'layout:' #(#LayoutFrame 65 0 95 0 113 0 113 0)
                    #'model:' #rightFraction
                    #'type:' #numberOrNil
                    #'immediateAccept:' false
                    #'acceptOnLeave:' true
                    #'acceptOnReturn:' true
                    #'acceptOnTab:' true
                    #'acceptOnLostFocus:' true
                )
                 #(#InputFieldSpec
                    #'name:' 'relative E4'
                    #'layout:' #(#LayoutFrame 65 0 123 0 113 0 141 0)
                    #'model:' #bottomFraction
                    #'type:' #numberOrNil
                    #'immediateAccept:' false
                    #'acceptOnLeave:' true
                    #'acceptOnReturn:' true
                    #'acceptOnTab:' true
                    #'acceptOnLostFocus:' true
                )
                 #(#InputFieldSpec
                    #'name:' 'offset E1'
                    #'layout:' #(#LayoutFrame 159 0 39 0 210 0 57 0)
                    #'model:' #leftOffset
                    #'type:' #numberOrNil
                    #'immediateAccept:' false
                    #'acceptOnLeave:' true
                    #'acceptOnReturn:' true
                    #'acceptOnTab:' true
                    #'acceptOnLostFocus:' true
                )
                 #(#InputFieldSpec
                    #'name:' 'offset E2'
                    #'layout:' #(#LayoutFrame 159 0 67 0 210 0 85 0)
                    #'model:' #topOffset
                    #'type:' #numberOrNil
                    #'immediateAccept:' false
                    #'acceptOnLeave:' true
                    #'acceptOnReturn:' true
                    #'acceptOnTab:' true
                    #'acceptOnLostFocus:' true
                )
                 #(#InputFieldSpec
                    #'name:' 'offset E3'
                    #'layout:' #(#LayoutFrame 159 0 95 0 210 0 113 0)
                    #'model:' #rightOffset
                    #'type:' #numberOrNil
                    #'immediateAccept:' false
                    #'acceptOnLeave:' true
                    #'acceptOnReturn:' true
                    #'acceptOnTab:' true
                    #'acceptOnLostFocus:' true
                )
                 #(#InputFieldSpec
                    #'name:' 'offset E4'
                    #'layout:' #(#LayoutFrame 159 0 123 0 210 0 141 0)
                    #'model:' #bottomOffset
                    #'type:' #numberOrNil
                    #'immediateAccept:' false
                    #'acceptOnLeave:' true
                    #'acceptOnReturn:' true
                    #'acceptOnTab:' true
                    #'acceptOnLostFocus:' true
                )
                 #(#ActionButtonSpec
                    #'name:' 'relative B1'
                    #'layout:' #(#LayoutFrame 117 0 39 0 136 0 57 0)
                    #'label:' ''
                    #'model:' #makeRelativeLeft
                )
                 #(#ActionButtonSpec
                    #'name:' 'relative B2'
                    #'layout:' #(#LayoutFrame 117 0 67 0 136 0 85 0)
                    #'label:' ''
                    #'model:' #makeRelativeTop
                )
                 #(#ActionButtonSpec
                    #'name:' 'relative B3'
                    #'layout:' #(#LayoutFrame 117 0 95 0 136 0 113 0)
                    #'label:' ''
                    #'model:' #makeRelativeRight
                )
                 #(#ActionButtonSpec
                    #'name:' 'relative B4'
                    #'layout:' #(#LayoutFrame 117 0 123 0 136 0 141 0)
                    #'label:' ''
                    #'model:' #makeRelativeBottom
                )
                 #(#ActionButtonSpec
                    #'name:' 'relative BAll'
                    #'layout:' #(#LayoutFrame 117 0 157 0 136 0 175 0)
                    #'label:' ''
                    #'model:' #makeRelativeAll
                )
                 #(#ActionButtonSpec
                    #'name:' 'offset B1'
                    #'layout:' #(#LayoutFrame 214 0 39 0 233 0 57 0)
                    #'label:' ''
                    #'model:' #makeOffsetLeft
                )
                 #(#ActionButtonSpec
                    #'name:' 'offset B2'
                    #'layout:' #(#LayoutFrame 214 0 67 0 233 0 85 0)
                    #'label:' ''
                    #'model:' #makeOffsetTop
                )
                 #(#ActionButtonSpec
                    #'name:' 'offset B3'
                    #'layout:' #(#LayoutFrame 214 0 95 0 233 0 113 0)
                    #'label:' ''
                    #'model:' #makeOffsetRight
                )
                 #(#ActionButtonSpec
                    #'name:' 'offset B4'
                    #'layout:' #(#LayoutFrame 214 0 123 0 233 0 141 0)
                    #'label:' ''
                    #'model:' #makeOffsetBottom
                )
                 #(#ActionButtonSpec
                    #'name:' 'offset BAll'
                    #'layout:' #(#LayoutFrame 214 0 157 0 233 0 175 0)
                    #'label:' ''
                    #'model:' #makeOffsetAll
                )
                 #(#ActionButtonSpec
                    #'name:' 'button'
                    #'layout:' #(#LayoutFrame 16 0 210 0 76 0 240 0)
                    #'label:' 'frame'
                    #'model:' #setLayoutFrame
                )
                 #(#ActionButtonSpec
                    #'name:' 'button10'
                    #'layout:' #(#LayoutFrame 96 0 210 0 156 0 240 0)
                    #'label:' 'origin'
                    #'model:' #setLayoutOrigin
                )
                 #(#ActionButtonSpec
                    #'name:' 'button11'
                    #'layout:' #(#LayoutFrame 176 0 210 0 236 0 240 0)
                    #'label:' 'align'
                    #'model:' #setAlignmentOrigin
                )
                 #(#ActionButtonSpec
                    #'name:' 'button12'
                    #'layout:' #(#LayoutFrame 96 0 260 0 156 0 290 0)
                    #'label:' 'apply'
                    #'model:' #setDimensionForLayoutFrame
                )
              )
          )
      )


!

geometrySpecForLayoutOrigin
    "
    UIPainter new openOnClass:self andSelector:#geometrySpecForLayoutOrigin
    "
    <resource: #canvas>

    ^

       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
              #'label:' 'unnamed'
              #'bounds:' #(#Rectangle 0 0 248 304)
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#LabelSpec
                    #'name:' 'label1'
                    #'layout:' #(#LayoutFrame 16 0 42 0 44 0 60 0)
                    #'label:' 'left'
                )
                 #(#LabelSpec
                    #'name:' 'label2'
                    #'layout:' #(#LayoutFrame 16 0 69 0 44 0 87 0)
                    #'label:' 'top'
                )
                 #(#LabelSpec
                    #'name:' 'label3'
                    #'layout:' #(#LayoutFrame 57 0 10 0 103 0 27 0)
                    #'label:' 'relative'
                )
                 #(#LabelSpec
                    #'name:' 'label4'
                    #'layout:' #(#LayoutFrame 154 0 11 0 190 0 28 0)
                    #'label:' 'offset'
                )
                 #(#InputFieldSpec
                    #'name:' 'editField1'
                    #'type:' #numberOrNil
                    #'layout:' #(#LayoutFrame 57 0 42 0 114 0 60 0)
                    #'model:' #leftFraction
                    #acceptOnLostFocus: true
                    #tabable: true
                )
                 #(#InputFieldSpec
                    #'name:' 'editField2'
                    #'type:' #numberOrNil
                    #'layout:' #(#LayoutFrame 57 0 69 0 114 0 87 0)
                    #'model:' #topFraction
                    #acceptOnLostFocus: true
                    #tabable: true
                )
                 #(#InputFieldSpec
                    #'name:' 'editField3'
                    #'type:' #numberOrNil
                    #'layout:' #(#LayoutFrame 154 0 42 0 212 0 60 0)
                    #'model:' #leftOffset
                    #acceptOnLostFocus: true
                    #tabable: true
                )
                 #(#InputFieldSpec
                    #'name:' 'editField4'
                    #'type:' #numberOrNil
                    #'layout:' #(#LayoutFrame 154 0 69 0 212 0 87 0)
                    #'model:' #topOffset
                    #acceptOnLostFocus: true
                    #tabable: true
                )
                 #(#ActionButtonSpec
                    #'name:' 'button1'
                    #'layout:' #(#LayoutFrame 119 0 42 0 138 0 60 0)
                    #'label:' ''
                    #'model:' #makeRelativeLeft
                )
                 #(#ActionButtonSpec
                    #'name:' 'button2'
                    #'layout:' #(#LayoutFrame 119 0 69 0 138 0 87 0)
                    #'label:' ''
                    #'model:' #makeRelativeTop
                )
                 #(#ActionButtonSpec
                    #'name:' 'button3'
                    #'layout:' #(#LayoutFrame 216 0 42 0 235 0 60 0)
                    #'label:' ''
                    #'model:' #makeOffsetLeft
                )
                 #(#ActionButtonSpec
                    #'name:' 'button4'
                    #'layout:' #(#LayoutFrame 216 0 69 0 235 0 87 0)
                    #'label:' ''
                    #'model:' #makeOffsetTop
                )


               #(#ActionButtonSpec
                  #'name:' 'button'
                  #'layout:' #(#LayoutFrame 16 0 210 0 76 0 240 0)
                  #'label:' 'frame'
                  #'model:' #setLayoutFrame
                )
               #(#ActionButtonSpec
                  #'name:' 'button'
                  #'layout:' #(#LayoutFrame 96 0 210 0 156 0 240 0)
                  #'label:' 'origin'
                  #'model:' #setLayoutOrigin
                  #'initiallyDisabled:' true
                )
               #(#ActionButtonSpec
                  #'name:' 'button'
                  #'layout:' #(#LayoutFrame 176 0 210 0 236 0 240 0)
                  #'label:' 'align'
                  #'model:' #setAlignmentOrigin
                )
               #(#ActionButtonSpec
                  #'layout:' #(#LayoutFrame 96 0 260 0 156 0 290 0)
                  #'label:' 'apply'
                  #'model:' #setDimensionForLayoutFrame
                  #tabable: true
                )

              )
          )
      )


!

miscSpec
    "UIBuilder new openOnClass:self andSelector:#miscSpec"
    "Builder new openInterface:#miscSpec"

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#FramedBoxSpec
                    #'layout:' #(#LayoutFrame 0 0 -1 0 251 0 289 0)
                    #'component:' 
                     #(#SpecCollection
                        #'collection:' 
                         #(
                           #(#VerticalPanelViewSpec
                              #'layout:' #(#LayoutFrame 6 0 26 0 61 0 215 0)
                              #'component:' 
                               #(#SpecCollection
                                  #'collection:' 
                                   #(
                                     #(#LabelSpec
                                        #'layout:' #(#LayoutFrame 0 0 47 0 57 0 71 0)
                                        #'label:' 'name:'
                                    )
                                  )
                              )
                              #'horizontalLayout:' #left
                              #'verticalLayout:' #spreadSpace
                          )
                           #(#VerticalPanelViewSpec
                              #'layout:' #(#LayoutFrame 60 0 24 0 230 0 213 0)
                              #'component:' 
                               #(#SpecCollection
                                  #'collection:' 
                                   #(
                                     #(#InputFieldSpec
                                        #model: #nameChannel
                                        #'layout:' #(#LayoutFrame 0 0 49 0 163 0 69 0)
                                        #acceptOnLostFocus: true
                                        #tabable: true
                                    )
                                  )
                              )
                              #'horizontalLayout:' #fit
                              #'verticalLayout:' #spreadSpace
                          )
                           #(#ActionButtonSpec
                              #'layout:' #(#LayoutFrame 102 0 246 0 153 0 272 0)
                              #'label:' 'apply'
                              #'model:' #setMiscAspects
                              #tabable: true
                          )
                        )
                    )
                    #'labelPosition:' #topLeft
                    #'showFrame:' false
                )
              )
          )
          #'window:' 
           #(#WindowSpec
              #'label:' 'unnamed'
              #'bounds:' #(#Rectangle 0 0 255 292)
          )
      )
!

modelSpec
    "UIBuilder new openOnClass:self andSelector:#modelSpec"
    "Builder new openInterface:#modelSpec"

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#FramedBoxSpec
                    #'layout:' #(#LayoutFrame 0 0 -1 0 251 0 289 0)
                    #'component:' 
                     #(#SpecCollection
                        #'collection:' 
                         #(
                           #(#VerticalPanelViewSpec
                              #'layout:' #(#LayoutFrame 6 0 26 0 78 0 216 0)
                              #'component:' 
                               #(#SpecCollection
                                  #'collection:' 
                                   #(
                                     #(#LabelSpec
                                        #'name:' 'label'
                                        #'layout:' #(#LayoutFrame 0 0 47 0 57 0 71 0)
                                        #'label:' 'aspect:'
                                    )
                                     #(#LabelSpec
                                        #'name:' 'label'
                                        #'layout:' #(#LayoutFrame 0 0 119 0 62 0 143 0)
                                        #'label:' 'change:'
                                    )
                                  )
                              )
                              #'horizontalLayout:' #left
                              #'verticalLayout:' #spreadSpace
                          )
                           #(#VerticalPanelViewSpec
                              #'layout:' #(#LayoutFrame 80 0 24 0 231 0 214 0)
                              #'component:' 
                               #(#SpecCollection
                                  #'collection:' 
                                   #(
                                     #(#InputFieldSpec
                                        #'name:' 'aspectInput'
                                        #'layout:' #(#LayoutFrame 0 0 49 0 163 0 69 0)
                                        #model: #aspectChannel
                                        #acceptOnLostFocus: true
                                        #tabable: true
                                    )
                                     #(#InputFieldSpec
                                        #'name:' 'changeInput'
                                        #'layout:' #(#LayoutFrame 0 0 119 0 163 0 142 0)
                                        #model: #changeChannel
                                        #acceptOnLostFocus: true
                                        #tabable: true
                                    )
                                  )
                              )
                              #'horizontalLayout:' #fit
                              #'verticalLayout:' #spreadSpace
                          )
                           #(#ActionButtonSpec
                              #'name:' 'button'
                              #'layout:' #(#LayoutFrame 102 0 246 0 153 0 272 0)
                              #'label:' 'apply'
                              #'model:' #setModelAspects
                          )
                        )
                    )
                    #'labelPosition:' #topLeft
                    #'showFrame:' false
                )
              )
          )
          #'window:' 
           #(#WindowSpec
              #'label:' 'unnamed'
              #'bounds:' #(#Rectangle 0 0 255 292)
          )
      )
!

nameAndSelectorSpec
    "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:self andSelector:#nameAndSelectorSpec"

    <resource: #canvas>

    ^

       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
              #'label:' 'unnamed'
              #'bounds:' #(#Rectangle 0 0 300 300)
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#LabelSpec
                    #'name:' 'label1'
                    #'layout:' #(#LayoutFrame 10 0 50 0 110 0 70 0)
                    #'label:' 'class:'
                    #'adjust:' #right
                )
                 #(#LabelSpec
                    #'name:' 'label2'
                    #'layout:' #(#LayoutFrame 10 0 90 0 110 0 110 0)
                    #'label:' 'superclass:'
                    #'adjust:' #right
                )
                 #(#LabelSpec
                    #'name:' 'label3'
                    #'layout:' #(#LayoutFrame 10 0 130 0 110 0 150 0)
                    #'label:' 'selector:'
                    #'adjust:' #right
                )
                 #(#InputFieldSpec
                    #'name:' 'classNameField'
                    #'layout:' #(#LayoutFrame 120 0 50 0 289 0 69 0)
                    #'model:' #classNameChannel
                    #'immediateAccept:' false
                    #'acceptOnLeave:' true
                    #'acceptOnReturn:' true
                    #'acceptOnTab:' true
                )
                 #(#InputFieldSpec
                    #'name:' 'superclassNameField'
                    #'layout:' #(#LayoutFrame 120 0 90 0 289 0 109 0)
                    #'model:' #superclassNameChannel
                    #'immediateAccept:' false
                    #'acceptOnLeave:' true
                    #'acceptOnReturn:' true
                    #'acceptOnTab:' true
                )
                 #(#InputFieldSpec
                    #'name:' 'methodNameField'
                    #'layout:' #(#LayoutFrame 120 0 130 0 289 0 149 0)
                    #'model:' #methodNameChannel
                    #'immediateAccept:' false
                    #'acceptOnLeave:' true
                    #'acceptOnReturn:' true
                    #'acceptOnTab:' true
                )
                 #(#ActionButtonSpec
                    #'name:' 'button1'
                    #'layout:' #(#LayoutFrame 30 0 250 0 129 0 279 0)
                    #'label:' 'cancel'
                    #'model:' #cancel
                )
                 #(#ActionButtonSpec
                    #'name:' 'button2'
                    #'layout:' #(#LayoutFrame 160 0 250 0 259 0 279 0)
                    #'label:' 'ok'
                    #'model:' #accept
                )
              )
          )
      )



!

propertyFrameSpec
    "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:UIPainter andSelector:#propertyFrameSpec"
    "UIPainter new openInterface:#propertyFrameSpec"

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
              #'label:' 'unnamed'
              #'bounds:' #(#Rectangle 0 0 309 326)
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#ArbitraryComponentSpec
                    #'name:' 'view1'
                    #'layout:' #(#LayoutFrame 0 0 0 0 0 1.0 -40 1.0)
                )
                 #(#ActionButtonSpec
                    #'name:' 'button1'
                    #'layout:' #(#LayoutFrame 108 0 291 0 200 0 323 0)
                    #'label:' 'apply'
                )
              )
          )
      )
! !

!UIPainter methodsFor:'BuilderView interface'!

update:something
    |singleSelection|

    elementMenu deselect.

    singleSelection := workView singleSelection.

    something == #selection ifTrue:[
        claus setupView:singleSelection.
    ].

    (something == #layout or:[something == #any]) ifTrue:[
        singleSelection notNil ifTrue:[
            self fetchLayoutFrom:singleSelection
        ].
        ^ self
    ].

    (something == #aspects or:[something == #any]) ifTrue:[
        singleSelection notNil ifTrue:[
            self fetchModelAspectsFrom:singleSelection
        ].
        ^ self
    ].

    (something == #selection or:[something == #any]) ifTrue:[
        self showPropertyView.
        self showOutletsFor:(workView selection).

        singleSelection isNil ifFalse:[
            nameChannel isNil ifTrue:[self nameChannel].
            nameChannel value:singleSelection name.

            self fetchLayoutFrom:singleSelection.
            self fetchColorsFrom:singleSelection.
            self fetchModelAspectsFrom:singleSelection.
        ].
        ^ self
    ].
! !

!UIPainter methodsFor:'aspects'!

aspectFor:aKey
    ^ specSpecificAspectHolders at:aKey ifAbsent:[
        aspectHolders at:aKey ifAbsent:[
            super aspectFor:aKey
        ]
    ]

!

nameChannel
    nameChannel isNil ifTrue:[
	nameChannel := '' asValue.
    ].
    ^ nameChannel

    "Modified: 6.9.1995 / 00:38:00 / claus"
! !

!UIPainter methodsFor:'filein & fileout'!

openFile:aFileName
    |aStream |

    aStream := FileStream readonlyFileNamed:aFileName.
    aStream notNil ifTrue:[
	workView fileInContentsFrom:aStream.
	aStream close.
	currentFileName := aFileName
    ]

!

saveAs:aFileName
    |aStream|

    aStream := FileStream newFileNamed:aFileName.
    aStream notNil ifTrue:[
	workView storeContentsOn:aStream.
	aStream close
    ].
    currentFileName := aFileName

! !

!UIPainter methodsFor:'help'!

helpTextFor:aComponent
    |sel|

    (aComponent isKindOf:Button) ifTrue:[
	(sel := aComponent changeMessage) notNil ifTrue:[
	    "/ take the buttons change symbol as resource-key
	    ^ resources string:(sel asString)
	]
    ].
    ^ nil

    "Modified: 31.8.1995 / 20:49:58 / claus"
! !

!UIPainter methodsFor:'initialization'!

createCanvas 
    |topView|

    super initialize.

    topView := StandardSystemView new.
    topView label:'unnamed'.
    topView extent:300@300.
    topView application:self.

    workView := UIPainterView in:topView.
    workView layout:(0.0 @ 0.0 corner:1.0 @ 1.0) asLayout.

    ^ workView.

    "Builder new createCanvas open"
!

createPaletteIn:aViewOrNil
    |topView v|

    aViewOrNil isNil ifTrue:[
        topView := StandardSystemView new.
        topView label:'element palette'.
        topView extent:200@400.
    ] ifFalse:[
        topView := aViewOrNil
    ].
    v := HVScrollableView for:SelectionInListView miniScrollerH:true in:topView.
    v origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
    elementMenu := v scrolledView.

    ^ elementMenu.

    "(Builder new createPaletteIn:nil) topView open"

    "Modified: 5.9.1995 / 23:52:57 / claus"
!

initChannels
    |cls|

    specSpecificAspectHolders := IdentityDictionary new.
    aspectHolders := IdentityDictionary new.

    aspectHolders at:#classNameChannel put:(
        (specClass notNil ifTrue:[specClass]
                         ifFalse:['NewApplication']) asValue
    ).
    specSuperclass isNil ifTrue:[
        specClass notNil ifTrue:[
            (cls := Smalltalk at:specClass asSymbol) notNil ifTrue:[
                specSuperclass := cls superclass name.
            ]
        ]
    ].
    aspectHolders at:#superclassNameChannel put:(
        (specSuperclass notNil ifTrue:[specSuperclass]
                         ifFalse:['ApplicationModel']) asValue
    ).
    aspectHolders at:#methodNameChannel put:(
        (specSelector notNil ifTrue:[specSelector]
                            ifFalse:[#windowSpec]) asValue
    ).

    aspectHolders at:#aspectChannel put:(ValueHolder new).
    aspectHolders at:#changeChannel put:(ValueHolder new).

    aspectHolders at:#foregroundColor put:(ValueHolder new).
    aspectHolders at:#backgroundColor put:(ValueHolder new).

    #( bottomFraction leftFraction topFraction rightFraction leftAlignmentFraction
       bottomOffset   leftOffset   topOffset   rightOffset   topAlignmentFraction
     )
     do:[:aChannel| aspectHolders at:aChannel put:(ValueHolder new) ].
!

initPullDownMenu
    menu labels:(resources  array:#(
                                    'file'
                                    'font'
                                    'type'
                                    'align'
                                    'dimension'
                                    'special'
                                    'code'
                                    'test'
                                 )).

    menu selectors:#(#file
                     #font
                     #type
                     #align 
                     #dimension 
                     #special
                     #code
                     #test
                    ).

    menu at:#file 
            putLabels:(resources  array:
                      #('new'
                        'from class ...' 
                        'pick a view ' 
                        '-'
                        'save' 
                        'save as ...' 
                        '-'
                        'install' 
                        '-'
"/                        'source' 
                        'windowSpec' 
                        'inspect me' 
                        '-'
                        'print'
                        '-'
                        'quit'
                       ))
            selectors:#(doNew 
                        doFromClass
                        doPickAView
                        nil
                        doSave 
                        doSaveAs 
                        nil 
                        doInstall 
                        nil 
"/                        doSource 
                        doWindowSpec 
                        inspect
                        nil 
                        doPrint
                        nil 
                        doFinish
                       )
             receiver:self.

    menu at:#font putMenu:(workView subMenuFont menuView).

    menu at:#type 
            putLabels:(resources  array:#(
                        'basic widgets' 
                        'layout'
                        'text'
                        'interactors'
                        'modal'
                        'other'
                        '-'
                        'all'
                       ) )
            selectors:#(showBasicWidgets 
                        showLayoutWidgets
                        showTextWidgets
                        showInteractorWidgets
                        showModalWidgets
                        showOtherWidgets
                        nil
                        showAllWidgets
                       )
             receiver:self.

    menu at:#align     putMenu:(workView subMenuAlign menuView).
    menu at:#dimension putMenu:(workView subMenuDimension menuView).

    menu at:#special 
            putLabels:(resources  array:#(
                        'group radioButtons' 
                        'group enterFields'
                        '-'
                        'delete undo history'
                       ) )
            selectors:#(
                        groupRadioButtons 
                        groupEnterFields
                        nil
                        undoDeleteAll
                       )
             receiver:workView.

    menu at:#code 
            putLabels:(resources  array:#(
                        'class & method' 
                       ) )
            selectors:#(
                        defineClassAndSelector
                       )
             receiver:self.

    menu at:#test 
            putLabels:(resources array:#(
                        'test on' 
                       ) )
            selectors:#(toggleTest 
                       )
             receiver:self.
!

openInterface 
    |list v topInset menuInset leftPanel middlePanel rightPanel buttonPanel propSelector|

    super initialize.

    self initChannels.

    whichProperty := SelectionInList new.
"/    whichProperty list:#('dimension' 'colors' 'model' 'misc' 'attribute list').
    whichProperty list:(UISpecification slices collect:[:slice | slice first asString]).
    whichProperty onChangeSend:#showPropertyView to:self.

    workView :=self createCanvas.

    topView := StandardSystemView new.
    topView label:'Interface Builder'.
    topView icon:(Image fromFile:'bitmaps/Builder.xbm' resolution:100).
    topView extent:(600 @ 400).

    menu        := PullDownMenu in:topView.
    buttonPanel := ButtonPanel in:topView.

    menuInset := menu preferredExtent y.
    topInset  := menuInset + buttonPanel preferredExtent y.

    buttonPanel origin:0.0@menuInset corner:1.0@topInset.
    buttonPanel receiver:workView.
    leftPanel   := View origin:(0.0 @ 0.0) corner:0.3@1.0 in:topView.
    leftPanel   topInset:topInset.
    middlePanel := View origin:(0.3 @ 0.0) corner:0.6@1.0 in:topView.
    middlePanel topInset:topInset.
    rightPanel  := View origin:(0.6 @ 0.0) corner:1.0@1.0 in:topView.
    rightPanel  topInset:topInset.

    v := HVScrollableView for:UIPainterTreeView miniScrollerH:true in:middlePanel.
    v origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
    treeView := v scrolledView.

    propSelector := PopUpList label:'properties' in:rightPanel.
    propSelector origin:(0.0 @ 0.0) corner:1.0@(propSelector preferredExtent y).
    propSelector horizontalInset:View viewSpacing.
    propSelector model:whichProperty.

    propertyFrame := View in:rightPanel.
    propertyFrame origin:(0.0 @ 0.0) corner:1.0@1.0.
    propertyFrame topInset:propSelector height + View viewSpacing.

    claus := View origin:(0.0 @ 0.0) corner:1.0@1.0 in:rightPanel.
    claus := UIPropertyView in:claus receiver:workView.

    elementMenu := self createPaletteIn:leftPanel.

    treeView builderView:workView.  "link workview with treeview"

    workView addDependent:treeView.
    workView addDependent:self.

    self initPullDownMenu.

    elementMenu action:[:selection |
        workView testMode ifTrue:[
            elementMenu deselect
        ] ifFalse:[
            selection notNil ifTrue:[
                workView createWidgetWithClass:
                        (Smalltalk at:(elementMenu selectionValue asSymbol))
            ]
        ]
    ].
    topView application:self.   
    builder window:topView.

    topView beMaster.
    workView topView beSlave.

    "/ can be created as embedded or side-menu
    elementMenu topView ~~ topView ifTrue:[
        elementMenu topView beSlave.
    ].

    topView open.
    workView topView openInGroup:(topView windowGroup).
    elementMenu topView ~~ topView ifTrue:[
        elementMenu topView openInGroup:(topView windowGroup).
    ]

    "
     Builder open
    "

    "Modified: 6.9.1995 / 00:26:59 / claus"
!

openNewWindowCanvas
    self open.


!

openOnClass:aClass andSelector:aSelector
    "open up an interface builder, fetching a spec from someClass
     via some selector"

    |specArray|

    specClass := aClass name.
    specSuperclass := aClass superclass name.
    specSelector :=  aSelector.

    self openInterface.
    workView className:aClass name.
    workView methodName:aSelector.
    workView setupFromSpec:(aClass perform:aSelector).
!

openOnSpec:aSpecOrSpecArray
    "open up an interface builder, given some specArray"

    |newBuilder|

    newBuilder := self new.
! !

!UIPainter methodsFor:'make layout'!

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

    view := workView singleSelection.

    view isNil ifTrue:[
        ^ self
    ].
    layout := view geometryLayout.

    layout isLayout ifFalse:[
        ^ self
    ].
    fractSymb  := (what, 'Fraction') asSymbol.
    offsetSymb := (what,   'Offset') asSymbol.

    (    (layout respondsTo:fractSymb)
     and:[layout respondsTo:offsetSymb]
    ) ifTrue:[

        fraction := layout perform:fractSymb.
        offset   := layout perform:offsetSymb.
        extent   := (view superView computeExtent) perform:xOrY.

        aBool ifTrue:[
            offset := offset + ((fraction * extent) asInteger).
            (aspectHolders at:offsetSymb) value:offset.
            (aspectHolders at:fractSymb)  value:0.
        ] ifFalse:[
            fraction   := (fraction + (offset / extent)) asFloat.

            (fraction > 1.0) ifTrue:[ fraction := 1.0 ].
            (fraction < 0.0) ifTrue:[ fraction := 0.0 ].

            (aspectHolders at:offsetSymb) value:0.
            (aspectHolders 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.

!

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.

!

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

!

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

! !

!UIPainter methodsFor:'misc'!

listOfOutletsFor:aViewClass
    "return a list of outlets for a view-class"

    |l1 l2 all rej|

    (aViewClass == Object) ifTrue:[^ nil].

    l1 := self listOfOutletsFor:(aViewClass superclass).
    l2 := self listOfOutletsForClass:aViewClass.

    l2 isNil ifTrue:[
	all := l1
    ] ifFalse:[
	l1 isNil ifTrue:[
	    all := l2
	] ifFalse:[
	    all := l1 , l2
	]
    ].
    rej := self rejectOutletsForClass:aViewClass.
    rej notNil ifTrue:[
	rej do:[:x |
	    all := all copyWithout:x
	]
    ].
    ^ all
!

listOfOutletsForClass:aViewClass
    "return a list of outlets for a view-class"

    "could this be done automatically ?"

    (aViewClass == Label) ifTrue:[
	^ #('label'
	    'iconic-label'
	    'label layout'
	    'fixed size'
	    'foreground-color'
	    'background-color'
	   )
    ].
    (aViewClass == Button) ifTrue:[
	^ #(
	    'active foreground-color'
	    'active background-color'
	    'active level'
	    'passive level'
	    'press action'
	   )
    ].
    (aViewClass == Toggle) ifTrue:[
	^ #(
	    'release action'
	   )
    ].
    (aViewClass == CheckBox) ifTrue:[
	^ #(
	    'label'
	   )
    ].
    (aViewClass == FramedBox) ifTrue:[
	^ #(
	    'label'
	    'label position'
	    'frame shown'
	   )
    ].
    (aViewClass == VerticalPanelView) ifTrue:[
	^ #(
	    'horizontal layout'
	    'vertical layout'
	   )
    ].
    (aViewClass == HorizontalPanelView) ifTrue:[
	^ #(
	    'horizontal layout'
	    'vertical layout'
	   )
    ].
    (aViewClass == VariableVerticalPanel) ifTrue:[
	^ #(
	    'handle position'
	    'style'
	   )
    ].
    (aViewClass == ListView) ifTrue:[
	^ #(
	    'contents'
	   )
    ].
    (aViewClass == SelectionInListView) ifTrue:[
	^ #(
	    'press action'
	   )
    ].
    (aViewClass == EditField) ifTrue:[
	^#(
	   'initialText'
	   'field type'
	   'field length'
	  )
    ].
    (aViewClass == View) ifTrue:[
	^ #(
	    'level'
	    'view background-color'
	   )
    ].
    (aViewClass == Scroller) ifTrue:[
	^ #(
	    'scroll action'
	    'asynchronous'
	    'synchronous'
	   )
    ].
    (aViewClass == ScrollBar) ifTrue:[
	^ #(
	    'scroll action'
	    'scrollDown action'
	    'scrollUp action'
	    'asynchronous'
	    'synchronous'
	   )
    ].
    (aViewClass == HorizontalScrollBar) ifTrue:[
	^ #(
	    'scrollLeft action'
	    'scrollRight action'
	   )
    ].
    (aViewClass == PullDownMenu) ifTrue:[
	^ #(
	    'labels'
	    'actions'
	   )
    ].
    (aViewClass == Separator) ifTrue:[
	^ #(
	    'orientation'
	   )
    ].
    ^ nil

    "Modified: 6.9.1995 / 13:42:09 / claus"
!

rejectOutletsForClass:aViewClass
    "return a list of suppressed outlets for a view-class"

    "could this be done automatically ?"

    (aViewClass == CheckToggle) ifTrue:[
	^ #(
	    'iconic-label'
	   )
    ].
    (aViewClass == CheckBox) ifTrue:[
	^ #(
	    'horizontal layout'
	    'vertical layout'
	   )
    ].
    (aViewClass == HorizontalScrollBar) ifTrue:[
	^ #(
	    'scrollUp action'
	    'scrollDown action'
	   )
    ].
    ^ nil

    "Modified: 4.9.1995 / 18:55:03 / claus"
!

setupPropertyFromSpec:aSpec
    "apply is pressed in the geometry-sub view, with a alignmentOrigin selected
    "
    |aViewsSpec|

    workView singleSelectionDo:[:selectedView |
        aViewsSpec := workView generateSpecFor:selectedView.
        aViewsSpec := aViewsSpec first.
    ].

    self setupPropertyFromSpec:aSpec for:aViewsSpec

!

setupPropertyFromSpec:aSpec for:aViewsSpec
    "setup menu from spec
    "
    |specBindings|

    outletView := nil.

    specShown ~= aSpec ifTrue:[
        propertyFrame destroySubViews.

        "/ get aspects from specClass
        specSpecificAspectHolders := IdentityDictionary new.
        aViewsSpec class addBindingsTo:specSpecificAspectHolders for:aViewsSpec channel:nil.
        
        builder buildFromSpec:aSpec in:propertyFrame.
        propertyFrame realizeAllSubViews.
    ].
    specShown := aSpec
!

showOutletsFor:aView
    |c outlets|

    outletView isNil ifTrue:[^ self].

    (aView isKindOf:SimpleView) ifFalse:[
	outletView list:nil.
	^ self
    ].
    c := aView class.

    outlets := self listOfOutletsFor:c.
    outletView list:outlets

    "Modified: 5.9.1995 / 21:51:57 / claus"
! !

!UIPainter methodsFor:'private - fetch'!

fetchColorsFrom:aView
    |holder|

    holder := self aspectFor:#foregroundColor.
    (aView respondsTo:#foregroundColor) ifTrue:[
        holder value:(aView foregroundColor storeString).
    ] ifFalse:[
        holder value:nil
    ].
    holder := self aspectFor:#backgroundColor.
    (aView respondsTo:#backgroundColor) ifTrue:[
        holder value:(aView backgroundColor storeString).
    ] ifFalse:[
        holder value:nil
    ].

!

fetchLayoutFrom:aView
    |layout extent|

    layout := aView geometryLayout.
    layout isNil ifTrue:[^ self].

    layout isLayout ifFalse:[
        layout isRectangle ifTrue:[
            (aspectHolders at:#leftOffset)   value:(layout left).
            (aspectHolders at:#rightOffset)  value:(layout right).
            (aspectHolders at:#topOffset)    value:(layout top).
            (aspectHolders at:#bottomOffset) value:(layout bottom).
          ^ self
        ].
        layout isPoint ifTrue:[
            (aspectHolders at:#leftOffset)  value:(layout left).
            (aspectHolders at:#rightOffset) value:(layout right).
          ^ self
        ].
    ].

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

    layout isLayoutFrame ifTrue:[
        (aspectHolders at:#rightOffset)    value:(layout rightOffset).
        (aspectHolders at:#bottomOffset)   value:(layout bottomOffset).

        (aspectHolders at:#rightFraction)  value:(layout rightFraction).
        (aspectHolders at:#bottomFraction) value:(layout bottomFraction).

        (aspectHolders at:#leftAlignmentFraction) value:0.
        (aspectHolders at:#topAlignmentFraction)  value:0.
    ] ifFalse:[
        extent := aView extent.

        (aspectHolders at:#rightOffset)    value:(layout leftOffset + extent x).
        (aspectHolders at:#bottomOffset)   value:(layout topOffset  + extent y).

        (aspectHolders at:#rightFraction)  value:0.
        (aspectHolders at:#bottomFraction) value:0.

        layout isAlignmentOrigin ifTrue:[
            (aspectHolders at:#leftAlignmentFraction) value:(layout leftAlignmentFraction).
            (aspectHolders at:#topAlignmentFraction)  value:(layout topAlignmentFraction).
        ] ifFalse:[
            (aspectHolders at:#leftAlignmentFraction) value:0.
            (aspectHolders at:#topAlignmentFraction)  value:0.
        ]
    ].


!

fetchModelAspectsFrom:aView
    (self aspectFor:#aspectChannel) value:(workView aspectSelectorForView:aView).
    (self aspectFor:#changeChannel) value:(workView changeSelectorForView:aView).

! !

!UIPainter methodsFor:'setup choices'!

showAllWidgets
    "create list of basic widgets"

    self showWidgetsWhere:[:class | true]
!

showBasicWidgets
    "create list of basic widgets"

    self showWidgetsInCategory:'Views-Basic' 
			butNot:[:class | class isKindOf:ModalBox class]
!

showInteractorWidgets
    "create list of interactor widgets"

    self showWidgetsInCategory:'Views-Interactors'
			butNot:[:class | class isKindOf:ModalBox class]
!

showLayoutWidgets
    "create list of basic widgets"

    self showWidgetsInCategory:'Views-Layout'
			butNot:[:class | class isKindOf:ModalBox class]
!

showModalWidgets
    "create list of modal widgets"

    self showWidgetsWhere:[:class | class isKindOf:ModalBox class]
!

showOtherWidgets
    "create list of other widgets"

    |check cat|

    check := [:class |
		(#('Views-Basic' 
		   'Views-Interactors'
		   'Views-Layout'
		   'Views-Text') includes:class category) not].
    self showWidgetsWhere:check
		   butNot:[:class | class isKindOf:ModalBox class]
!

showTextWidgets
    "create list of basic widgets"

    self showWidgetsInCategory:'Views-Text'
			butNot:[:class | class isKindOf:ModalBox class]
!

showWidgetsInCategory:aCategory
    "create list of basic widgets"

    self showWidgetsWhere:[:class | class category = aCategory]
!

showWidgetsInCategory:aCategory butNot:excludeBlock
    "create list of basic widgets"

    self showWidgetsWhere:[:class | class category = aCategory]
		   butNot:excludeBlock
!

showWidgetsWhere:aBlock
    "create list of widgets where aBlock avaluates to true"

    self showWidgetsWhere:aBlock butNot:[:class | false]
!

showWidgetsWhere:aBlock butNot:excludeBlock
    "create list of widgets where aBlock evaluates to true and excludeBlock
     evaluates to false"

    |list|

    list := OrderedCollection new:0.
    SimpleView allSubclassesDo:[:aSubclass |
        (aBlock value:aSubclass) ifTrue:[
            (excludeBlock value:aSubclass) ifFalse:[
                list add:(aSubclass name)
            ]
        ]
    ].
    (aBlock value:View) ifTrue:[
        (excludeBlock value:View) ifFalse:[
            list add:'View'
        ]
    ].
    (list size == 0) ifFalse:[
        list sort
    ].
    elementMenu list:list
! !

!UIPainter methodsFor:'user actions - dimension'!

setAlignmentOrigin
    "apply is pressed in the geometry-sub view, with a alignmentOrigin selected
    "
    self setupPropertyFromSpec:(self class geometrySpecForAlignmentOrigin)
!

setDimensionForAlignmentOrigin
    |view layout|

    view := workView singleSelection.

    view notNil ifTrue:[
        layout := AlignmentOrigin new.

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

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

        workView setDimension:layout.
    ]
!

setDimensionForLayoutFrame
    |view layout|

    view := workView singleSelection.

    view notNil ifTrue:[
        layout := LayoutFrame new.

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

        workView setDimension:layout.
    ]
!

setDimensionForLayoutOrigin
    |view layout|

    view := workView singleSelection.

    view notNil ifTrue:[
        layout := LayoutOrigin new.

        layout leftOffset:((aspectHolders at:#leftOffset) value) ? 0.
        layout topOffset:((aspectHolders at:#topOffset) value) ? 0.

        layout leftFraction:((aspectHolders at:#leftFraction) value) ? 0.
        layout topFraction:((aspectHolders at:#topFraction) value) ? 0.

        workView setDimension:layout.
    ]
!

setLayoutFrame
    "apply is pressed in the geometry-sub view, with a layoutFrame selected
    "
    self setupPropertyFromSpec:(self class geometrySpecForLayoutFrame)
!

setLayoutOrigin
    "apply is pressed in the geometry-sub view, with a layoutOrigin selected
    "
    self setupPropertyFromSpec:(self class geometrySpecForLayoutOrigin)
! !

!UIPainter methodsFor:'user interaction'!

closeRequest
    workView  notNil ifTrue:[workView  release. workView := nil].
    super closeRequest
!

closeRequestFor:aTopView
    aTopView ~~ topView ifTrue:[
        topView device beep.
        ^ self
    ].
    super closeRequestFor:aTopView
!

selectOutlet:nr
    |outlet type sel text box action initialText initialList
     view prop t val|

    outlet := outletView selectionValue.
    outletView deselect.
    view := workView selection.
    view isNil ifTrue:[
        self notify:'select something first'.
        ^ self
    ].
    action := [:s | self setOutlet:sel type:type to:s in:view].
    (outlet = 'label') ifTrue:[
        type := #string.
        sel := #label:.
        text := 'label-text:'.
        initialText := view label
    ].
    (outlet = 'fixed size') ifTrue:[
        type := #boolean.
        sel := #sizeFixed:.
        text := 'size is fix:'.
    ].
    (outlet = 'frame shown') ifTrue:[
        type := #boolean.
        sel := #showFrame:.
        text := 'frame is to be drawn:'.
    ].
    (outlet = 'labels') ifTrue:[
        type := #strings.
        sel := #labels:.
        initialText := view labels
    ].
    (outlet = 'contents') ifTrue:[
        type := #text.
        sel := #contents:.
        initialText := view contents
    ].
    (outlet = 'initialText') ifTrue:[
        type := #string.
        sel := #initialText:.
        initialText := view contents
    ].
    (outlet = 'field type') ifTrue:[
        type := #fieldTypeSymbol.
        sel := #type:.
        initialList := #(number    
                         string
                         password
                        ).
        initialText := view converter isNil ifTrue:[#string] ifFalse:[view converter type].
    ].
    (outlet = 'field length') ifTrue:[
        type := #numberOrNil.
        sel := #maxChars:.
        text := 'field length (empty -> unlimited)'.
        initialText := view maxChars isNil ifTrue:[''] ifFalse:[view maxChars printString].
    ].
    (outlet = 'level') ifTrue:[
        type := #number.
        sel := #level:.
        initialText := view level printString
    ].
    (outlet = 'active level') ifTrue:[
        type := #number.
        sel := #onLevel:.
        initialText := view onLevel printString
    ].
    (outlet = 'passive level') ifTrue:[
        type := #number.
        sel := #offLevel:.
        initialText := view offLevel printString
    ].
    (outlet = 'iconic-label') ifTrue:[
        type := #form.
        sel := #label:.
        text := 'label-icon:'
    ].
    (outlet = 'view background-color') ifTrue:[
        type := #color.
        sel := #viewBackground:.
        text := 'view background color'.
        initialText := 'Black'
    ].
    (outlet = 'foreground-color') ifTrue:[
        type := #color.
        sel := #foregroundColor:.
        text := 'foreground color'.
        initialText := 'Black'
    ].
    (outlet = 'background-color') ifTrue:[
        type := #color.
        sel := #backgroundColor:.
        text := 'background color'.
        initialText := 'Grey'
    ].
    (outlet = 'active foreground-color') ifTrue:[
        type := #color.
        sel := #activeForegroundColor:.
        text := 'active foreground color'.
        initialText := 'Yellow'
    ].
    (outlet = 'active background-color') ifTrue:[
        type := #color.
        sel := #activeBackgroundColor:.
        text := 'active background color'.
        initialText := 'Grey'
    ].
    (outlet = 'scroll action') ifTrue:[
        type := #block.
        sel := #scrollAction:.
        text := 'action block when scrolled'
    ].
    (outlet = 'scrollUp action') ifTrue:[
        type := #block.
        sel := #scrollUpAction:.
        text := 'action block when scrolled up'
    ].
    (outlet = 'scrollDown action') ifTrue:[
        type := #block.
        sel := #scrollDownAction:.
        text := 'action block when scrolled down'
    ].
    (outlet = 'scrollLeft action') ifTrue:[
        type := #block.
        sel := #scrollLeftAction:.
        text := 'action block when scrolled left'
    ].
    (outlet = 'scrollRight action') ifTrue:[
        type := #block.
        sel := #scrollRightAction:.
        text := 'action block when scrolled right'
    ].
    (outlet = 'press action') ifTrue:[
        type := #block.
        sel := #pressAction:.
        text := 'action block when pressed'
    ].
    (outlet = 'release action') ifTrue:[
        type := #block.
        sel := #releaseAction:.
        text := 'action block when released'
    ].
    (outlet = 'style') ifTrue:[
        type := #symbol.
        sel := #style:.
        initialList := #(motif next)
    ].
    (outlet = 'handle position') ifTrue:[
        type := #symbol.
        sel := #handlePosition:.
        initialList := #(left center right)
    ].
    (outlet = 'horizontal layout') ifTrue:[
        type := #symbol.
        sel := #horizontalLayout:.
        text := 'horizontal components layout'.
        initialList := #(left
                         leftSpace
                         leftMax
                         leftSpaceMax
                         center 
                         centerMax 
                         right 
                         rightSpace 
                         rightMax 
                         rightSpaceMax 
                         spread 
                         spreadSpace 
                         spreadMax 
                         spreadSpaceMax 
                         fit
                         fitSpace).
        initialText := view horizontalLayout printString
    ].
    (outlet = 'vertical layout') ifTrue:[
        type := #symbol.
        sel := #verticalLayout:.
        text := 'vertical components layout'.
        initialList := #(top    
                         topSpace
                         center 
                         bottom 
                         bottomSpace 
                         spread 
                         spreadSpace 
                         fit
                         fitSpace).
        initialText := view verticalLayout printString
    ].
    (outlet = 'label position') ifTrue:[
        type := #symbol.
        sel := #labelPosition:.
        initialList := #(topLeft topCenter topRight bottomLeft bottomCenter bottomRight).
        initialText := view labelPosition printString
    ].
    (outlet = 'label layout') ifTrue:[
        type := #symbol.
        sel := #adjust:.
        initialList := #( left right center centerLeft centerRight fit ).
        initialText := view adjust printString
    ].
    (outlet = 'orientation') ifTrue:[
        type := #symbol.
        sel := #orientation:.
        initialList := #( horizontal vertical ).
        initialText := view orientation printString
    ].

    (type == #color) ifTrue:[
        initialList := #('Black'
                         'White'
                         'LightGrey'
                         'Grey'
                         'DarkGrey'
                         'Yellow'
                         'Red'
                         'Green'
                         'Blue'
                        )
    ].

    text isNil ifTrue:[
        text := outlet
    ].

    "what type of box do we need"

    t := type.
    ((type == #color) or:[type == #symbol or:[type == #fieldTypeSymbol]]) ifTrue:[
        t := #list
    ].
    ((type == #number) or:[type == #numberOrNil]) ifTrue:[
        t := #string
    ].
    (type == #strings) ifTrue:[
        t := #text
    ].
    (type == #block) ifTrue:[
        t := #text.
        initialText := workView outletValueOf:sel for:view.
        initialText isNil ifTrue:[initialText := '[statements]']
    ].
    (type == #block1) ifTrue:[
        t := #text.
        type := #block.
        initialText := workView outletValueOf:sel for:view.
        initialText isNil ifTrue:[initialText := '[:argument | statements ]']
    ].
    (type == #block2) ifTrue:[
        t := #text.
        type := #block.
        initialText := workView outletValueOf:sel for:view.
        initialText isNil ifTrue:[initialText := '[:arg1 :arg2 | statements ]']
    ].

    "show a box to enter thing"

    (t == #boolean) ifTrue:[
        val := Dialog confirmWithCancel:text.
        (val == true or:[val == false]) ifTrue:[
            action value:val
        ].
        ^ self
    ].
    (t == #string) ifTrue:[
"/        stringBox isNil ifTrue:[
            stringBox := EnterBox new.
"/        ].
        box := stringBox
    ].
    (t == #list) ifTrue:[
"/        listBox isNil ifTrue:[
            listBox := ListSelectionBox new.
"/        ].
        listBox list:initialList.
        box := listBox
    ].
    (t == #text) ifTrue:[
"/        actionBox isNil ifTrue:[
            actionBox := TextBox new.
"/        ].
        actionBox initialText:initialText.
        box := actionBox
    ].
"
Transcript show:'outlet: '. Transcript showCR:outlet.
Transcript show:'type:   '. Transcript showCR:type.
Transcript show:'sel:    '. Transcript showCR:sel.
Transcript show:'text:   '. Transcript showCR:text.
"

    box isNil ifTrue:[
        self notify:'not yet implemented'
    ] ifFalse:[
        box initialText:initialText.
        box title:text.
        box action:action.
        box showAtPointer
    ]

    "Modified: 6.9.1995 / 13:46:29 / claus"
!

setColors
    |fg bg|

    fg := (self aspectFor:#foregroundColor) value.

    (fg notNil and:[fg notEmpty]) ifTrue:[
        fg := Color readFrom:fg.
        workView singleSelectionDo:[:selectedView |
            selectedView foregroundColor:fg
        ].
    ].
    bg := (self aspectFor:#backgroundColor) value.

    (bg notNil and:[bg notEmpty]) ifTrue:[
        bg := Color readFrom:bg.
        workView singleSelectionDo:[:selectedView |
            selectedView backgroundColor:bg
        ].
    ].
!

setMiscAspects
    "sent when apply is pressen in the misc-sub view"

    workView singleSelectionDo:[:selectedView |
        selectedView ~~ workView ifTrue:[
            workView changeVariableNameOf:selectedView to:nameChannel value
        ]
    ].
!

setModelAspects
    "sent when apply is pressen in the model-sub view"

    |aspectSymbol|

    aspectSymbol := (self aspectFor:#aspectChannel) value.
    (aspectSymbol notNil and:[aspectSymbol notEmpty]) ifTrue:[
        aspectSymbol := aspectSymbol asSymbol.
        workView singleSelectionDo:[:selectedView |
            selectedView ~~ workView ifTrue:[
                workView setAspectSelector:aspectSymbol forView:selectedView
            ].
        ].
    ].
!

setOutlet:outletSymbol type:type to:outletValue in:aView
    |block val messageSymbol|

    messageSymbol := outletSymbol.
    val := outletValue.
    (type == #block) ifTrue:[
	block := Compiler evaluate:val.
	(block == #Error) ifTrue:[
	    self warn:'action will not work in test-mode'.
	    workView addOutletDefinitionFor:outletSymbol
				       type:type
				      value:outletValue
					for:aView.
	    ^ self
	].
	val := block
    ].
    (type == #number) ifTrue:[
	val := Number readFromString:outletValue onError:0 
    ].
    (type == #numberOrNil) ifTrue:[
	val := Number readFromString:outletValue onError:nil
    ].
    (type == #text) ifTrue:[
	val := outletValue asString
    ].
    (type == #strings) ifTrue:[
	val := outletValue asText
    ].
    (type == #symbol) ifTrue:[
	val := outletValue asSymbol.
    ].
    (type == #fieldTypeSymbol) ifTrue:[
	val := outletValue asSymbol.
	val == #password ifTrue:[
	    aView passwordCharacter:$*
	] ifFalse:[
	    aView passwordCharacter:nil
	].
	val := (PrintConverter new initFor:val).
	messageSymbol := #converter:
    ].
    (type == #color) ifTrue:[
	val := Color name:outletValue.
	val isNil ifTrue:[
	    self warn:('no such color:' , outletValue).
	    ^ self
	]
    ].
Transcript show:(val printString).
Transcript showCR:('(' , val class printString , ')').

    workView selectionHiddenDo:[
	aView perform:messageSymbol with:val.
	workView elementChanged:aView.
	aView redraw.
    ].
    workView addOutletDefinitionFor:outletSymbol
			       type:type
			      value:outletValue
				for:aView

    "Modified: 6.9.1995 / 13:44:46 / claus"
!

showPropertyView
    |v l spec shown possibleProperties slices specIndex slice specSymbol|

    shown := whichProperty selection.

    workView singleSelectionDo:[:selectedView |
        |aViewsSpec|

        aViewsSpec := workView generateSpecFor:selectedView.
        aViewsSpec := aViewsSpec first.

        slices := selectedView specClass slices.
        possibleProperties := slices collect:[:slice | slice first asString].
        possibleProperties := possibleProperties, #('dimension' 'colors' 'model' 'misc' 'attribute list').
        possibleProperties ~= whichProperty list ifTrue:[
            whichProperty list:possibleProperties.

            (possibleProperties includes:shown) ifFalse:[
                shown := nil.
            ].
        ].

        specIndex := slices findFirst:[:slice | slice first = shown].
        specIndex ~~ 0 ifTrue:[
            slice := slices at:specIndex.
            specSymbol := slice at:2.
            (selectedView specClass respondsTo:specSymbol) ifTrue:[
                spec := selectedView specClass perform:specSymbol.
                ^ self setupPropertyFromSpec:spec for:aViewsSpec
            ]
        ].

        (shown = 'dimension' or:[shown = 'Position']) ifTrue:[
            (l := selectedView geometryLayout) notNil ifTrue:[
                l isLayout ifTrue:[
                    l isAlignmentOrigin ifTrue:[
                        spec := self class geometrySpecForAlignmentOrigin
                    ] ifFalse:[
                        l isLayoutFrame ifFalse:[
                            spec := self class geometrySpecForLayoutOrigin
                        ]
                    ]
                ]
            ].
            spec isNil ifTrue:[
                spec := self class geometrySpecForLayoutFrame
            ].
            ^ self setupPropertyFromSpec:spec for:aViewsSpec
        ].

        shown = 'colors' ifTrue:[
            ^ self setupPropertyFromSpec:(self class colorSpec) for:aViewsSpec
        ].

        shown = 'model' ifTrue:[
            ^ self setupPropertyFromSpec:(self class modelSpec) for:aViewsSpec
        ].

        shown = 'misc' ifTrue:[
            ^ self setupPropertyFromSpec:(self class miscSpec) for:aViewsSpec
        ].

        shown = 'attribute list' ifTrue:[
            specShown ~~ #attributeList ifTrue:[
                propertyFrame destroySubViews.
                specSpecificAspectHolders := IdentityDictionary new.

                v := ScrollableView for:SelectionInListView in:propertyFrame.
                v origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
                outletView := v scrolledView.
                outletView action:[:lineNr | lineNr notNil ifTrue:[self selectOutlet:lineNr]].
                propertyFrame realizeAllSubViews.
                specShown := #attributeList.
            ].
            self showOutletsFor:(workView selection).
            ^ self
        ].
    ].

    propertyFrame destroySubViews.
    outletView := nil.
    specShown := nil.
    specSpecificAspectHolders := IdentityDictionary new.

! !

!UIPainter methodsFor:'user interaction - dialogs'!

checkClassAndSelector
    "check for class & superclass"

    |superclass cls|

    specClass isNil ifTrue:[^ false].

    specClass isBehavior ifFalse:[
        cls := Smalltalk at:specClass asSymbol
    ] ifTrue:[
        cls := specClass
    ].
    cls isNil ifTrue:[
        (superclass := Smalltalk at:specSuperclass asSymbol) isNil ifTrue:[
            self warn:'no class named ' , specSuperclass , ' exists.'.
            ^ false.
        ].
        (self confirm:'create ' , specClass , ' ?') ifTrue:[
            superclass subclass:(specClass asSymbol)
                       instanceVariableNames:''
                       classVariableNames:''
                       poolDictionaries:''
                       category:'New-Applications'.
            ^ true.
        ].
        ^ false.
    ].
    cls isBehavior ifFalse:[
        self warn:'a global named ' , specClass , ' exists, but is no class.'.
        ^ false.
    ].

    specSuperclass isBehavior ifFalse:[
        superclass := Smalltalk at:specSuperclass asSymbol
    ] ifTrue:[
        superclass := specSuperclass
    ].
    specSuperclass notNil ifTrue:[
        superclass isNil ifTrue:[
            self warn:'no class named ' , specSuperclass , ' exists.'.
            ^ false.
        ].

        (cls isSubclassOf:superclass) ifFalse:[
            self warn:'a global named ' , specClass , ' exists, but is not a subclass of ' , superclass name , '.'.
            ^ false.
        ]
    ].
    ^ true
!

defineClassAndSelector
    "launch a dialog to define class, superclass and method"

    |again|

    [
        again := false.
        (self openDialogInterface:#nameAndSelectorSpec) ifTrue:[

            specClass := (self aspectFor:#classNameChannel) value.
            specSelector := (self aspectFor:#methodNameChannel) value.
            specSuperclass := (self aspectFor:#superclassNameChannel) value.

            again := self checkClassAndSelector not.
            again ifFalse:[
                workView className:specClass superclassName:specSuperclass selector:specSelector.
            ].
        ]
    ] doWhile:[again]

! !

!UIPainter methodsFor:'user interaction - menu'!

doFinish
    self closeRequest
!

doFromClass
        |className methodName cls sel accepted failed spec s|

        className := '' asValue.
        methodName := '' asValue.
        (s := workView className) notNil ifTrue:[
            className value:s
        ].
        (s := workView methodName) notNil ifTrue:[
            methodName value:s
        ].

        failed := false.
        [
            accepted :=
                (DialogBox new
                    addTextLabel:'Classes name:';
                    addInputFieldOn:className; 
                    addVerticalSpace;
                    addTextLabel:'methods name:';
                    addInputFieldOn:methodName; 
                    addAbortButton; 
                    addOkButton; 
                    open
                ) accepted.

             accepted ifTrue:[
                cls := Smalltalk classNamed:className value.
                cls isNil ifTrue:[
                    failed := true.
                    self warn:'no such class'.
                ] ifFalse:[
                    sel := methodName value asSymbol.
                    (cls respondsTo:sel ) ifFalse:[
                        failed := true.
                        self warn:'no such method'
                    ] ifTrue:[
                        spec := cls perform:sel.
                        spec isArray ifFalse:[
                            failed := true.
                            self warn:'not a windowSpec method'    
                        ].
                        "/ ok, got it
                        workView className:className value.
                        workView methodName:methodName value.
                        workView setupFromSpec:spec.
                        ^ self
                     ]
                ]
             ]
        ] doWhile:[accepted and:[failed]].

    "Modified: 5.9.1995 / 18:47:57 / claus"
!

doInstall
    |code|

    (specClass isNil or:[specSelector isNil]) ifTrue:[
        self defineClassAndSelector
    ].

    self checkClassAndSelector ifFalse:[
        ^ self
    ].

    workView className:specClass superclassName:specSuperclass selector:specSelector.

    code := workView generateCode.
    (ReadStream on:code) fileIn.

    "Modified: 4.9.1995 / 17:06:10 / claus"
!

doNew
    workView removeAll.
    ^ self

    "Modified: 5.9.1995 / 20:52:21 / claus"
!

doOpen
    fileBox isNil ifTrue:[
	fileBox := FileSelectionBox
			title:''
			"pattern:'*.sib'"
			okText:''
			abortText:(Resource name:'BUILDER_ABORT_LABEL'
					fromFile:'Builder.rs')
			action:[nil]
    ].
    fileBox title:(Resource name:'BUILDER_OPEN_TITLE' fromFile:'Builder.rs').
    fileBox action:[:fileName | self openFile:fileName].
    fileBox okText:(Resource name:'BUILDER_OPEN_OK_LABEL' fromFile:'Builder.rs').
    fileBox showAtPointer
!

doPickAView
    |view className methodName cls sel accepted spec s|

    view := Display viewFromUser.
    view isNil ifTrue:[^ self].

    spec := UISpecification fromView:view topView.
    self halt.

    "/ ok, got it
    workView setupFromSpec:spec.
    workView className:view class name.
    workView methodName:#newSpec.
    ^ self

    "Modified: 5.9.1995 / 23:25:53 / claus"
!

doPrint
    ^ self
!

doSave
    currentFileName notNil ifTrue:[
	self saveAs:currentFileName
    ] ifFalse:[
	self doSaveAs
    ]
!

doSaveAs
    fileBox isNil ifTrue:[
	fileBox := FileSelectionBox
			title:''
			"pattern:'*.draw'"
			okText:''
			abortText:(Resource name:'BUILDER_ABORT_LABEL'
					fromFile:'Builder.rs')
			action:[nil]
    ].
    fileBox title:(Resource name:'BUILDER_SAVE_TITLE' fromFile:'Builder.rs').
    fileBox action:[:fileName | self saveAs:fileName].
    fileBox okText:(Resource name:'BUILDER_SAVE_OK_LABEL' fromFile:'Builder.rs').
    fileBox showAtPointer
! !

!UIPainter ignoredMethodsFor:'user interaction - menu'!

doSource
   |code v|

   code := workView generateCode.
   v := CodeView open.
   v contents:code.
   v label:(workView applicationName).
    ^ self

    "Modified: 5.9.1995 / 21:02:05 / claus"
! !

!UIPainter methodsFor:'user interaction - menu'!

doWindowSpec
   |code v|

   code := workView generateWindowSpecMethodSource.
   v := CodeView open.
   v contents:code.
   v label:'windowSpec'.
    ^ self

    "Modified: 5.9.1995 / 21:04:14 / claus"
!

toggleTest
    |m t|

    m := menu menuAt:#test.
    t := workView testMode not.

    t ifTrue:[
        m labelAt:#toggleTest put:(resources string:'test off')
    ] ifFalse:[
        m labelAt:#toggleTest put:(resources string:'test on')
    ].
    workView testMode:t
! !

!UIPainter::ButtonPanel methodsFor:'accessing'!

receiver
    ^ receiver
!

receiver:aReceiver
    receiver := aReceiver
! !

!UIPainter::ButtonPanel methodsFor:'initialization'!

initialize
    "initialize and setup buttons
    "
    super initialize.

    self level:-1.
    self borderWidth:0.
    self horizontalLayout:#leftSpace.
    argumentToSelector := 1.

    self specification do:[:anArray|
        |selector image button seperator|

        selector := anArray at:1.

        selector notNil ifTrue:[
            image  := Image fromFile:( anArray at:2 ).
            button := Button label:image in:self.

            selector last == $: ifFalse:[
                button action:[
                    receiver notNil ifTrue:[
                        receiver perform:selector
                    ]
                ]
            ] ifTrue:[
                button pressAction:[
                    receiver notNil ifTrue:[
                        receiver perform:selector with:argumentToSelector
                    ]
                ].
                button autoRepeat:true.
                button menuHolder:self; menuMessage:#editMenu; menuPerformer:self.
            ]
        ] ifFalse:[
            seperator := View in:self.
            seperator extent:20@1.
            seperator borderWidth:0.
        ]
    ].

!

specification
    "return a spec for the buttons in the panel;
     entries consists of selector and bitmap-filename.
     nil selectors are taken as separators (see setupButtonPanel)"

    ^ #(
        #( alignSelectionLeft         'b_alignL.xbm'    )
        #( alignSelectionRight        'b_alignR.xbm'    )
        #( alignSelectionLeftAndRight 'b_alignLR.xbm'   )
        #( nil )
        #( alignSelectionTop          'b_alignT.xbm'    )
        #( alignSelectionBottom       'b_alignB.xbm'    )
        #( alignSelectionTopAndBottom 'b_alignTB.xbm'   )
        #( nil )
        #( alignSelectionCenterHor    'b_alignCH.xbm'   )
        #( alignSelectionCenterVer    'b_alignCV.xbm'   )
        #( nil )
        #( moveSelectionLeft:         'b_moveLeft.xbm'  )
        #( moveSelectionRight:        'b_moveRight.xbm' )
        #( moveSelectionUp:           'b_moveUp.xbm'    )
        #( moveSelectionDown:         'b_moveDown.xbm'  )
       )


! !

!UIPainter::ButtonPanel methodsFor:'menu'!

editMenu
    "edit menu used by buttons using an argument for the receiver; the argumentToSelector
    "
    |menu|

    menu := PopUpMenu labels:#( '1' '2' '4' '10' '20' '..' )
                        args:#(  1   2   4   10   20  nil  ).

    menu action:[:anArg||no|
        (no := anArg) isNil ifTrue:[
            no := EnterBox request:'number'.
            no := SmallInteger readFrom:no onError:0.
        ].
        no ~~ 0 ifTrue:[
            |index view|

            view := (WindowGroup lastEventQuerySignal raise) view.
            view := view menuPerformer.
            argumentToSelector := no.
            view pressAction value.
            argumentToSelector := 1.
        ]
    ].
    ^ menu
! !

!UIPainter class methodsFor:'documentation'!

version
    ^ '$Header$'
! !