UIPainter.st
author ca
Tue, 18 Feb 1997 11:38:57 +0100
changeset 55 19e021c8f1ef
parent 54 d0b5a33e6df0
child 58 668eb9eae2ac
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 changeSelectorHolder changeChannel
		aspectSelectorHolder aspectChannel nameChannel applyAction
		leftFractionHolder leftOffsetHolder rightFractionHolder
		rightOffsetHolder topFractionHolder topOffsetHolder
		bottomFractionHolder bottomOffsetHolder specClass specSelector
		specSuperclass leftAlignmentFractionHolder
		topAlignmentFractionHolder classNameHolder methodNameHolder
		aspectHolders propertyShown specShown'
	classVariableNames:''
	poolDictionaries:''
	category:'Interface-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)
          )
      )
!

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: #foregroundChannel
                                        #acceptOnLostFocus: true
                                        #tabable: true

                                    )
                                     #(#InputFieldSpec
                                        #'layout:' #(#LayoutFrame 0 0 119 0 163 0 142 0)
                                        #model: #backgroundChannel
                                        #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
    "UIBuilder new openOnClass:self andSelector:#geometrySpecForAlignmentOrigin"
    "Builder new openInterface:#geometrySpecForAlignmentOrigin"

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#FramedBoxSpec
                    #'layout:' #(#LayoutFrame 0 0 -1 0 253 0 291 0)
                    #'component:' 
                     #(#SpecCollection
                        #'collection:' 
                         #(
                           #(#VerticalPanelViewSpec
                              #'layout:' #(#LayoutFrame 6 0 26 0 85 0 219 0)
                              #'component:' 
                               #(#SpecCollection
                                  #'collection:' 
                                   #(
                                     #(#LabelSpec
                                        #'layout:' #(#LayoutFrame 0 0 19 0 30 0 43 0)
                                        #'label:' 'left'
                                        #'adjust:' #left
                                    )
                                     #(#LabelSpec
                                        #'layout:' #(#LayoutFrame 0 0 63 0 31 0 87 0)
                                        #'label:' 'top'
                                        #'adjust:' #left
                                    )
                                     #(#LabelSpec
                                        #'layout:' #(#LayoutFrame 0 0 107 0 41 0 131 0)
                                        #'label:' 'align H'
                                        #'adjust:' #left
                                    )
                                     #(#LabelSpec
                                        #'layout:' #(#LayoutFrame 0 0 151 0 61 0 175 0)
                                        #'label:' 'align V'
                                        #'adjust:' #left
                                    )
                                  )
                              )
                              #'horizontalLayout:' #left
                              #'verticalLayout:' #spreadSpace
                          )
                           #(#VerticalPanelViewSpec
                              #'layout:' #(#LayoutFrame 80 0 24 0 124 0 217 0)
                              #'component:' 
                               #(#SpecCollection
                                  #'collection:' 
                                   #(
                                     #(#InputFieldSpec
                                        #'layout:' #(#LayoutFrame 0 0 21 0 71 0 42 0)
                                        #'type:' #numberOrNil
                                        #model: #leftFractionChannel
                                        #acceptOnLostFocus: true
                                        #tabable: true
                                    )
                                     #(#InputFieldSpec
                                        #'layout:' #(#LayoutFrame 0 0 64 0 71 0 85 0)
                                        #'type:' #numberOrNil
                                        #'model:' #'topFractionChannel'
                                        #acceptOnLostFocus: true
                                        #tabable: true
                                    )
                                     #(#InputFieldSpec
                                        #'layout:' #(#LayoutFrame 0 0 107 0 71 0 128 0)
                                        #'type:' #numberOrNil
                                        #model:  #'leftAlignmentFractionChannel'
                                        #acceptOnLostFocus: true
                                        #tabable: true
                                    )
                                     #(#InputFieldSpec
                                        #'layout:' #(#LayoutFrame 0 0 150 0 71 0 171 0)
                                        #'type:' #numberOrNil
                                        #'model:' #'topAlignmentFractionChannel'
                                        #acceptOnLostFocus: true
                                        #tabable: true
                                    )
                                  )
                              )
                              #'horizontalLayout:' #fit
                              #'verticalLayout:' #spreadSpace
                          )
                           #(#VerticalPanelViewSpec
                              #'layout:' #(#LayoutFrame 150 0 24 0 220 0 216 0)
                              #'component:' 
                               #(#SpecCollection
                                  #'collection:' 
                                   #(
                                     #(#InputFieldSpec
                                        #'layout:' #(#LayoutFrame 0 0 21 0 114 0 42 0)
                                        #'type:' #numberOrNil
                                        #model: #leftOffsetChannel
                                        #acceptOnLostFocus: true
                                        #tabable: true
                                    )
                                     #(#InputFieldSpec
                                        #'layout:' #(#LayoutFrame 0 0 64 0 114 0 85 0)
                                        #'type:' #numberOrNil
                                        #model: #topOffsetChannel
                                        #acceptOnLostFocus: true
                                        #tabable: true
                                    )
                                  )
                              )
                              #'horizontalLayout:' #fit
                              #'verticalLayout:' #spreadSpace
                          )
                           #(#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:' #setDimensionForAlignmentOrigin
                              #tabable: true
                          )
                           #(#LabelSpec
                              #'layout:' #(#LayoutFrame 77 0 9 0 137 0 31 0)
                              #'label:' 'relative'
                          )
                           #(#LabelSpec
                              #'layout:' #(#LayoutFrame 167 0 9 0 213 0 30 0)
                              #'label:' 'offset'
                          )
                        )
                    )
                    #'labelPosition:' #topLeft
                    #'showFrame:' false
                )
              )
          )
          #'window:' 
           #(#WindowSpec
              #'label:' 'indy: unnamed'
              #'bounds:' #(#Rectangle 0 0 255 292)
          )
      )
!

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

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#FramedBoxSpec
                    #'layout:' #(#LayoutFrame 0 0 -1 0 253 0 291 0)
                    #'component:' 
                     #(#SpecCollection
                        #'collection:' 
                         #(
                           #(#VerticalPanelViewSpec
                              #'layout:' #(#LayoutFrame 6 0 26 0 85 0 219 0)
                              #'component:' 
                               #(#SpecCollection
                                  #'collection:' 
                                   #(
                                     #(#LabelSpec
                                        #'layout:' #(#LayoutFrame 0 0 19 0 30 0 43 0)
                                        #'label:' 'left'
                                        #'adjust:' #left
                                    )
                                     #(#LabelSpec
                                        #'layout:' #(#LayoutFrame 0 0 63 0 30 0 87 0)
                                        #'label:' 'top'
                                        #'adjust:' #left
                                    )
                                     #(#LabelSpec
                                        #'layout:' #(#LayoutFrame 0 0 107 0 40 0 131 0)
                                        #'label:' 'right'
                                        #'adjust:' #left
                                    )
                                     #(#LabelSpec
                                        #'layout:' #(#LayoutFrame 0 0 151 0 40 0 175 0)
                                        #'label:' 'bottom'
                                        #'adjust:' #left
                                    )
                                  )
                              )
                              #'horizontalLayout:' #left
                              #'verticalLayout:' #spreadSpace
                          )
                           #(#VerticalPanelViewSpec
                              #'layout:' #(#LayoutFrame 80 0 24 0 124 0 217 0)
                              #'component:' 
                               #(#SpecCollection
                                  #'collection:' 
                                   #(
                                     #(#InputFieldSpec
                                        #'layout:' #(#LayoutFrame 0 0 21 0 71 0 42 0)
                                        #'type:' #numberOrNil
                                        #model: #leftFractionChannel
                                        #acceptOnLostFocus: true
                                        #tabable: true
                                    )
                                     #(#InputFieldSpec
                                        #'layout:' #(#LayoutFrame 0 0 64 0 71 0 85 0)
                                        #'type:' #numberOrNil
                                        #'model:' #'topFractionChannel'
                                        #acceptOnLostFocus: true
                                        #tabable: true
                                    )
                                     #(#InputFieldSpec
                                        #'layout:' #(#LayoutFrame 0 0 107 0 71 0 128 0)
                                        #'type:' #numberOrNil
                                        #model:  #'rightFractionChannel'
                                        #acceptOnLostFocus: true
                                        #tabable: true
                                    )
                                     #(#InputFieldSpec
                                        #'layout:' #(#LayoutFrame 0 0 150 0 71 0 171 0)
                                        #'type:' #numberOrNil
                                        #'model:' #'bottomFractionChannel'
                                        #acceptOnLostFocus: true
                                        #tabable: true
                                    )
                                  )
                              )
                              #'horizontalLayout:' #fit
                              #'verticalLayout:' #spreadSpace
                          )
                           #(#VerticalPanelViewSpec
                              #'layout:' #(#LayoutFrame 150 0 24 0 220 0 216 0)
                              #'component:' 
                               #(#SpecCollection
                                  #'collection:' 
                                   #(
                                     #(#InputFieldSpec
                                        #'layout:' #(#LayoutFrame 0 0 21 0 114 0 42 0)
                                        #'type:' #numberOrNil
                                        #model: #leftOffsetChannel
                                        #acceptOnLostFocus: true
                                        #tabable: true
                                    )
                                     #(#InputFieldSpec
                                        #'layout:' #(#LayoutFrame 0 0 64 0 114 0 85 0)
                                        #'type:' #numberOrNil
                                        #model: #topOffsetChannel
                                        #acceptOnLostFocus: true
                                        #tabable: true
                                    )
                                     #(#InputFieldSpec
                                        #'layout:' #(#LayoutFrame 0 0 107 0 114 0 128 0)
                                        #'type:' #numberOrNil
                                        #'model:' #rightOffsetChannel
                                        #acceptOnLostFocus: true
                                        #tabable: true
                                    )
                                     #(#InputFieldSpec
                                        #'layout:' #(#LayoutFrame 0 0 150 0 114 0 171 0)
                                        #'type:' #numberOrNil
                                        #'model:' #bottomOffsetChannel
                                        #acceptOnLostFocus: true
                                        #tabable: true
                                    )
                                  )
                              )
                              #'horizontalLayout:' #fit
                              #'verticalLayout:' #spreadSpace
                          )

                           #(#ActionButtonSpec
                              #'name:' 'button'
                              #'layout:' #(#LayoutFrame 16 0 210 0 76 0 240 0)
                              #'label:' 'frame'
                              #'model:' #setLayoutFrame
                              #'initiallyDisabled:' true
                          )
                           #(#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
                          )

                           #(#ActionButtonSpec
                              #'layout:' #(#LayoutFrame 96 0 260 0 156 0 290 0)
                              #'label:' 'apply'
                              #'model:' #setDimensionForLayoutFrame
                              #tabable: true
                          )
                           #(#LabelSpec
                              #'layout:' #(#LayoutFrame 77 0 9 0 137 0 31 0)
                              #'label:' 'relative'
                          )
                           #(#LabelSpec
                              #'layout:' #(#LayoutFrame 167 0 9 0 213 0 30 0)
                              #'label:' 'offset'
                          )
                        )
                    )
                    #'labelPosition:' #topLeft
                    #'showFrame:' false
                )
              )
          )
          #'window:' 
           #(#WindowSpec
              #'label:' 'indy: unnamed'
              #'bounds:' #(#Rectangle 0 0 255 292)
          )
      )
!

geometrySpecForLayoutOrigin
    "UIPainter new openOnClass:self andSelector:#geometrySpecForLayoutOrigin"
    "Builder new openInterface:#geometrySpecForLayoutOrigin"

    <resource: #canvas>

    ^

       #(#FullSpec
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#FramedBoxSpec
                    #'name:' 'framedBox'
                    #'layout:' #(#LayoutFrame 0 0 -1 0 253 0 291 0)
                    #'component:' 
                     #(#SpecCollection
                        #'collection:' 
                         #(
                           #(#VerticalPanelViewSpec
                              #'name:' 'verticalPanelView'
                              #'layout:' #(#LayoutFrame 6 0 26 0 85 0 219 0)
                              #'component:' 
                               #(#SpecCollection
                                  #'collection:' 
                                   #(
                                     #(#LabelSpec
                                        #'name:' 'label'
                                        #'layout:' #(#LayoutFrame 0 0 19 0 30 0 43 0)
                                        #'label:' 'left'
                                        #'adjust:' #left
                                    )
                                     #(#LabelSpec
                                        #'name:' 'label'
                                        #'layout:' #(#LayoutFrame 0 0 63 0 31 0 87 0)
                                        #'label:' 'top'
                                        #'adjust:' #left
                                    )
                                  )
                              )
                              #'horizontalLayout:' #left
                              #'verticalLayout:' #spreadSpace
                          )
                           #(#VerticalPanelViewSpec
                              #'name:' 'verticalPanelView'
                              #'layout:' #(#LayoutFrame 80 0 24 0 124 0 217 0)
                              #'component:' 
                               #(#SpecCollection
                                  #'collection:' 
                                   #(
                                     #(#InputFieldSpec
                                        #'layout:' #(#LayoutFrame 0 0 21 0 71 0 42 0)
                                        #'type:' #numberOrNil
                                        #model: #leftFractionChannel
                                        #'acceptOnLostFocus:' true
                                        #tabable: true
                                    )
                                     #(#InputFieldSpec
                                        #'layout:' #(#LayoutFrame 0 0 64 0 71 0 85 0)
                                        #'type:' #numberOrNil
                                        #'model:' #'topFractionChannel'
                                        #acceptOnLostFocus: true
                                        #tabable: true
                                    )
                                  )
                              )
                              #'horizontalLayout:' #fit
                              #'verticalLayout:' #spreadSpace
                          )
                           #(#VerticalPanelViewSpec
                              #'name:' 'verticalPanelView'
                              #'layout:' #(#LayoutFrame 150 0 24 0 220 0 216 0)
                              #'component:' 
                               #(#SpecCollection
                                  #'collection:' 
                                   #(
                                     #(#InputFieldSpec
                                        #'layout:' #(#LayoutFrame 0 0 21 0 114 0 42 0)
                                        #'type:' #numberOrNil
                                        #model: #leftOffsetChannel
                                        #acceptOnLostFocus: true
                                        #tabable: true
                                    )
                                     #(#InputFieldSpec
                                        #'layout:' #(#LayoutFrame 0 0 64 0 114 0 85 0)
                                        #'type:' #numberOrNil
                                        #model: #topOffsetChannel
                                        #acceptOnLostFocus: true
                                        #tabable: true
                                    )
                                  )
                              )
                              #'horizontalLayout:' #fit
                              #'verticalLayout:' #spreadSpace
                          )
                           #(#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
                              #'name:' 'button'
                              #'layout:' #(#LayoutFrame 96 0 260 0 156 0 290 0)
                              #'label:' 'apply'
                              #'model:' #setDimensionForLayoutOrigin
                          )
                           #(#LabelSpec
                              #'name:' 'label'
                              #'layout:' #(#LayoutFrame 77 0 9 0 137 0 31 0)
                              #'label:' 'relative'
                          )
                           #(#LabelSpec
                              #'name:' 'label'
                              #'layout:' #(#LayoutFrame 159 0 9 0 205 0 30 0)
                              #'label:' 'offset'
                          )
                        )
                    )
                    #'labelPosition:' #topLeft
                    #'showFrame:' false
                )
              )
          )
          #'window:' 
           #(#WindowSpec
              #'label:' 'indy: unnamed'
              #'bounds:' #(#Rectangle 0 0 255 292)
          )
      )

!

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:NewApplication andSelector:#windowSpec"
    "NewApplication new openInterface:#windowSpec"
    "NewApplication open"

    <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 == #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
    ^ aspectHolders at:aKey ifAbsent:[super aspectFor:aKey]
!

backgroundChannel
    ^ self aspectFor:#backgroundChannel
!

bottomFractionChannel
    ^ bottomFractionHolder
!

bottomOffsetChannel
    ^ bottomOffsetHolder

!

foregroundChannel
    ^ self aspectFor:#foregroundChannel

!

leftAlignmentFractionChannel
    ^ leftAlignmentFractionHolder

!

leftFractionChannel
    ^ leftFractionHolder

!

leftOffsetChannel
    ^ leftOffsetHolder

!

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

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

rightFractionChannel
    ^ rightFractionHolder

!

rightOffsetChannel
    ^ rightOffsetHolder

!

topAlignmentFractionChannel
    ^ topAlignmentFractionHolder

!

topFractionChannel
    ^ topFractionHolder

!

topOffsetChannel
    ^ topOffsetHolder

! !

!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'!

buttonPanelSpec
    "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'  )
       )
!

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
    aspectHolders := IdentityDictionary new.

    aspectHolders at:#classNameChannel put:((specClass notNil ifTrue:[specClass name] ifFalse:['NewApplication']) asValue).
    aspectHolders at:#superclassNameChannel put:((specClass notNil ifTrue:[specClass superclass] ifFalse:[ApplicationModel]) name 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:#foregroundChannel put:(ValueHolder new).
    aspectHolders at:#backgroundChannel put:(ValueHolder new).


    bottomFractionHolder        := nil asValue.
    bottomOffsetHolder          := nil asValue.
    leftFractionHolder          := nil asValue.
    leftOffsetHolder            := nil asValue.
    rightFractionHolder         := nil asValue.
    rightOffsetHolder           := nil asValue.
    topFractionHolder           := nil asValue.
    topOffsetHolder             := nil asValue.
    leftAlignmentFractionHolder := nil asValue.
    topAlignmentFractionHolder  := nil asValue.

!

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 
            putLabels:(resources  array:#(
                        'larger' 
                        'smaller'
                        '-'
                        'normal'
                        'bold'
                        'italic'
                        'bold italic'
                        '-'
                        'font panel'
                       ) )
            selectors:#(largerFont 
                        smallerFont
                        nil
                        normalFont
                        boldFont
                        italicFont
                        boldItalicFont
                        nil
                        showFontPanel
                       )
             receiver:workView.

    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' 
                       ) )
            selectors:#(
                        groupRadioButtons 
                        groupEnterFields
                       )
             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 panel topPane botPanel v 
     leftPanel middlePanel rightPanel buttonPanel propSelector|

    super initialize.

    self initChannels.

    whichProperty := SelectionInList new.
    whichProperty list:#('dimension' 'colors' 'model' 'misc' 'attribute list').
    whichProperty onChangeSend:#propertySelectionChanged 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 := self setupButtonPanelIn:topView below:menu.

    leftPanel := View in:topView.
    leftPanel origin:(0.0 @ 0.0) corner:0.3@1.0.
    leftPanel topInset:menu height + buttonPanel height + View viewSpacing.

    middlePanel := View in:topView.
    middlePanel origin:(0.3 @ 0.0) corner:0.6@1.0.
    middlePanel topInset:menu height + buttonPanel height + View viewSpacing.

    rightPanel := View in:topView.
    rightPanel origin:(0.6 @ 0.0) corner:1.0@1.0.
    rightPanel topInset:menu height + buttonPanel height + View viewSpacing.

    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.

"/    panel := VariableVerticalPanel in:topView.
"/    panel origin:(0.0 @ 0.0) corner:0.5@1.0.
"/    panel topInset:menu height + buttonPanel height + View viewSpacing.

"/    topPane := View in:panel.
"/    topPane origin:(0.0 @ 0.0) corner:(1.0 @ 0.5).
"/    topPane borderWidth:0.

"/    botPanel := VariableHorizontalPanel in:panel.
"/    botPanel origin:(0.0 @ 0.5) corner:(1.0 @ 1.0).
"/    botPanel borderWidth:0.

    elementMenu := self createPaletteIn:leftPanel.

"/    v := ScrollableView for:UIPainterTreeView in:botPanel.
"/    v origin:(0.0 @ 0.0) corner:(0.5 @ 1.0).
"/    treeView := v scrolledView.

"/    v := ScrollableView for:SelectionInListView in:botPanel.
"/    v origin:(0.5 @ 0.0) corner:(1.0 @ 1.0).
"/    outletView := v scrolledView.
"/    outletView action:[:lineNr | self selectOutlet:lineNr].

"/    v := ScrollableView for:TextCollector in:topPane.
"/    v origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
"/    infoView := v scrolledView.

    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.
    specSuperclass := aClass superclass.
    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.
!

setupButtonPanelIn:aTopView below:aMenu
    "create the buttonPanel
    "
    |spc mh buttonPanel pressAction|

    spc := View viewSpacing // 2.
    buttonPanel := HorizontalPanelView in:aTopView.
    buttonPanel level:-1; borderWidth:0.
    buttonPanel horizontalLayout:#leftSpace.

    pressAction := [:aButton :aSelector|
        |menu org top|

        workView selection notNil ifTrue:[
            top := aButton topView.

            org := top origin + (aButton originRelativeTo:top) 
                              + (0@((spc + aButton extent y))).

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

            menu action:[:anArg||no|
                (no := anArg) isNil ifTrue:[
                    no := EnterBox request:'number'.
                    no := SmallInteger readFrom:no onError:0.
                ].
                no ~~ 0 ifTrue:[
                    workView perform:aSelector with:no
                ]
            ].
            menu showAt:org.
        ].
        aButton turnOff
    ].

    self buttonPanelSpec do:[:anArray| |selector image button|
        selector := anArray at:1.

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

            selector last == $: ifFalse:[
                button action:[ workView perform:selector ]
            ] ifTrue:[
                button pressAction:[ pressAction value:button value:selector ] 
            ]
        ] ifFalse:[|sep|
            sep := View in:buttonPanel.
            sep extent:20@1; borderWidth:0.
        ]
    ].

    mh := aMenu height.
    buttonPanel origin:0.0 @ (mh + spc)
                corner:(1.0 @ (mh + spc + buttonPanel preferredExtent y)).

    buttonPanel leftInset:spc; rightInset:spc.
  ^ buttonPanel
! !

!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
    "setup menu from spec
    "
    outletView := nil.

    specShown ~= aSpec ifTrue:[
        propertyFrame destroySubViews.
        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:#foregroundChannel.
    (aView respondsTo:#foregroundColor) ifTrue:[
        holder value:(aView foregroundColor storeString).
    ] ifFalse:[
        holder value:nil
    ].
    holder := self aspectFor:#backgroundChannel.
    (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:[
            leftOffsetHolder   value:(layout left).
            rightOffsetHolder  value:(layout right).
            topOffsetHolder    value:(layout top).
            bottomOffsetHolder value:(layout bottom).
            ^ self
        ].
        layout isPoint ifTrue:[
            leftOffsetHolder   value:(layout left).
            rightOffsetHolder  value:(layout right).
            ^ self
        ].
    ].

    leftOffsetHolder   value:(layout leftOffset).
    leftFractionHolder value:(layout leftFraction).
    topFractionHolder  value:(layout topFraction).
    topOffsetHolder    value:(layout topOffset).

    layout isLayoutFrame ifTrue:[
        rightOffsetHolder    value:(layout rightOffset).
        bottomOffsetHolder   value:(layout bottomOffset).
        rightFractionHolder  value:(layout rightFraction).
        bottomFractionHolder value:(layout bottomFraction).

        leftAlignmentFractionHolder value:0.
        topAlignmentFractionHolder  value:0.

    ] ifFalse:[
        extent := aView extent.

        rightOffsetHolder    value:(layout leftOffset + extent x).
        bottomOffsetHolder   value:(layout topOffset  + extent y).

        rightFractionHolder  value:0.
        bottomFractionHolder value:0.

        layout isAlignmentOrigin ifTrue:[
            leftAlignmentFractionHolder value:(layout leftAlignmentFraction).
            topAlignmentFractionHolder  value:(layout topAlignmentFraction)
        ] ifFalse:[
            leftAlignmentFractionHolder value:0.
            topAlignmentFractionHolder  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:(leftOffsetHolder   value) ? 0.
        layout    topOffset:(topOffsetHolder    value) ? 0.
        layout leftFraction:(leftFractionHolder value) ? 0.
        layout  topFraction:(topFractionHolder  value) ? 0.

        layout leftAlignmentFraction:(leftAlignmentFractionHolder value) ? 0.
        layout  topAlignmentFraction:(topAlignmentFractionHolder  value) ? 0.

        workView setDimension:layout.
    ]
!

setDimensionForLayoutFrame
    |view layout|

    view := workView singleSelection.

    view notNil ifTrue:[
        layout := LayoutFrame new.

        layout leftOffset:(leftOffsetHolder value) ? 0.
        layout rightOffset:(rightOffsetHolder value) ? 0.
        layout topOffset:(topOffsetHolder value) ? 0.
        layout bottomOffset:(bottomOffsetHolder value) ? 0.
        layout leftFraction:(leftFractionHolder value) ? 0.
        layout rightFraction:(rightFractionHolder value) ? 0.
        layout topFraction:(topFractionHolder value) ? 0.
        layout bottomFraction:(bottomFractionHolder value) ? 0.

        workView setDimension:layout.
    ]
!

setDimensionForLayoutOrigin
    |view layout|

    view := workView singleSelection.

    view notNil ifTrue:[
        layout := LayoutOrigin new.

        layout leftOffset:(leftOffsetHolder value) ? 0.
        layout topOffset:(topOffsetHolder value) ? 0.

        layout leftFraction:(leftFractionHolder value) ? 0.
        layout topFraction:(topFractionHolder 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
!

propertySelectionChanged
    workView singleSelectionDo:[:selectedView |
        propertyShown   := whichProperty selection.
        self showPropertyView
    ]
!

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 foregroundChannel value.
    (fg notNil and:[fg notEmpty]) ifTrue:[
        fg := Color readFrom:fg.
        workView singleSelectionDo:[:selectedView |
            selectedView foregroundColor:fg
        ].
    ].
    bg := self backgroundChannel 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|

    workView singleSelectionDo:[:selectedView |
        propertyShown = 'dimension' 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
        ].

        propertyShown = 'colors' ifTrue:[
            ^ self setupPropertyFromSpec:(self class colorSpec)
        ].

        propertyShown = 'model' ifTrue:[
            ^ self setupPropertyFromSpec:(self class modelSpec)
        ].

        propertyShown = 'misc' ifTrue:[
            ^ self setupPropertyFromSpec:(self class miscSpec)
        ].

        propertyShown = 'attribute list' ifTrue:[
            specShown ~~ #attributeList ifTrue:[
                propertyFrame destroySubViews.
                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.

! !

!UIPainter methodsFor:'user interaction - dialogs'!

checkClassAndSelector
    "check for class & superclass"

    |superclass cls|

    (cls := Smalltalk at:specClass asSymbol) 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 notNil ifTrue:[
        (superclass := Smalltalk at:specSuperclass asSymbol) 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.

    "/ 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 class methodsFor:'documentation'!

version
    ^ '$Header$'
! !