UIPropertyView.st
changeset 170 bbb0a5c29671
parent 169 3a8b51cfb609
child 171 7a99c53780ef
equal deleted inserted replaced
169:3a8b51cfb609 170:bbb0a5c29671
     1 "
       
     2  COPYRIGHT (c) 1997 by eXept Software AG
       
     3               All Rights Reserved
       
     4 
       
     5  This software is furnished under a license and may be used
       
     6  only in accordance with the terms of that license and with the
       
     7  inclusion of the above copyright notice.   This software may not
       
     8  be provided or otherwise made available to, or used by, any
       
     9  other person.  No title to or ownership of the software is
       
    10  hereby transferred.
       
    11 "
       
    12 
       
    13 
       
    14 
       
    15 ApplicationModel subclass:#UIPropertyView
       
    16 	instanceVariableNames:'window specClass aspects modified modifiedHolder'
       
    17 	classVariableNames:''
       
    18 	poolDictionaries:''
       
    19 	category:'Interface-UIPainter'
       
    20 !
       
    21 
       
    22 UIPropertyView subclass:#Specification
       
    23 	instanceVariableNames:'specEdited specChannel'
       
    24 	classVariableNames:''
       
    25 	poolDictionaries:''
       
    26 	privateIn:UIPropertyView
       
    27 !
       
    28 
       
    29 UIPropertyView subclass:#Dimension
       
    30 	instanceVariableNames:'noteBook forView selection layoutTypes'
       
    31 	classVariableNames:''
       
    32 	poolDictionaries:''
       
    33 	privateIn:UIPropertyView
       
    34 !
       
    35 
       
    36 !UIPropertyView class methodsFor:'documentation'!
       
    37 
       
    38 copyright
       
    39 "
       
    40  COPYRIGHT (c) 1997 by eXept Software AG
       
    41               All Rights Reserved
       
    42 
       
    43  This software is furnished under a license and may be used
       
    44  only in accordance with the terms of that license and with the
       
    45  inclusion of the above copyright notice.   This software may not
       
    46  be provided or otherwise made available to, or used by, any
       
    47  other person.  No title to or ownership of the software is
       
    48  hereby transferred.
       
    49 "
       
    50 
       
    51 
       
    52 !
       
    53 
       
    54 documentation
       
    55 "
       
    56     provides tools to the UIPainter accessing and manipulation properties
       
    57     and/or layouts.
       
    58 
       
    59     [see also:]
       
    60         UIBuilder
       
    61 
       
    62     [author:]
       
    63         Claus Atzkern
       
    64 "
       
    65 
       
    66 ! !
       
    67 
       
    68 !UIPropertyView class methodsFor:'instance creation'!
       
    69 
       
    70 for:aTool in:aTopview
       
    71     |cls appl|
       
    72 
       
    73     cls := Smalltalk classNamed:(self name asString, '::', aTool asString).
       
    74     appl := cls new.
       
    75     appl origin:0.0@0.0 corner:1.0@1.0 in:aTopview.
       
    76   ^ appl
       
    77 !
       
    78 
       
    79 in:aTopview
       
    80     |appl|
       
    81 
       
    82     appl := self new.
       
    83     appl origin:0.0@0.0 corner:1.0@1.0 in:aTopview.
       
    84   ^ appl
       
    85 ! !
       
    86 
       
    87 !UIPropertyView methodsFor:'accessing'!
       
    88 
       
    89 buildFromSpec:aSpec
       
    90     |state subViews backGroundColor v|
       
    91 
       
    92     aSpec ~= specClass ifTrue:[
       
    93         window destroySubViews.
       
    94 
       
    95         aSpec notNil ifTrue:[
       
    96             v := builder buildFromSpec:aSpec in:window.
       
    97             window allViewBackground:(self viewBackground).
       
    98             window realizeAllSubViews.
       
    99         ]
       
   100     ].
       
   101     specClass := aSpec.
       
   102     self modified:false
       
   103         
       
   104 !
       
   105 
       
   106 modified
       
   107     "returns modifying state
       
   108     "
       
   109     ^ modified
       
   110 !
       
   111 
       
   112 modified:aState
       
   113     "set modifying state
       
   114     "
       
   115     modified := aState.
       
   116 
       
   117     modifiedHolder notNil ifTrue:[
       
   118         modifiedHolder value ~~ modified ifTrue:[
       
   119             modifiedHolder value:modified
       
   120         ]
       
   121     ]
       
   122 !
       
   123 
       
   124 modifiedHolder
       
   125     "returns the value holder set to true in case of modifying attributes
       
   126     "
       
   127     ^ modifiedHolder
       
   128 !
       
   129 
       
   130 modifiedHolder:aValueHolder
       
   131     "set the value holder set to true in case of modifying attributes
       
   132     "
       
   133     modifiedHolder notNil ifTrue:[
       
   134         modifiedHolder removeDependent:self. 
       
   135     ].
       
   136 
       
   137     (modifiedHolder := aValueHolder) notNil ifTrue:[
       
   138         modifiedHolder addDependent:self.
       
   139         modifiedHolder setValue:modified.
       
   140     ].
       
   141 ! !
       
   142 
       
   143 !UIPropertyView methodsFor:'accessing hierarchy'!
       
   144 
       
   145 lower
       
   146     "bring window to back
       
   147     "
       
   148     self window back
       
   149 !
       
   150 
       
   151 raise
       
   152     "bring window to front
       
   153     "
       
   154     self window raise
       
   155 !
       
   156 
       
   157 viewBackground
       
   158     ^ window viewBackground
       
   159 !
       
   160 
       
   161 viewBackground:aColor
       
   162     window viewBackground:aColor
       
   163 !
       
   164 
       
   165 window
       
   166     "returns window application is running in
       
   167     "
       
   168     ^ window
       
   169 ! !
       
   170 
       
   171 !UIPropertyView methodsFor:'bindings'!
       
   172 
       
   173 aspectFor:aKey
       
   174     "returns aspect for a key or nil
       
   175     "
       
   176     aspects notNil ifTrue:[
       
   177         ^ aspects at:aKey ifAbsent:nil
       
   178     ].
       
   179     ^ super aspectFor:aKey
       
   180 
       
   181 !
       
   182 
       
   183 aspects
       
   184     "returned monitored aspects
       
   185     "
       
   186     ^ aspects
       
   187 !
       
   188 
       
   189 aspects:aListOfAspects
       
   190     "set aspects to be monitored
       
   191     "
       
   192     (aspects := aListOfAspects) notNil ifTrue:[
       
   193         aspects do:[:el | el addDependent:self ].
       
   194     ].
       
   195     self modified:false.
       
   196 ! !
       
   197 
       
   198 !UIPropertyView methodsFor:'change & update'!
       
   199 
       
   200 update:something with:someArgument from:someone
       
   201     "any attribute changed its state in the current specification
       
   202     "
       
   203     someone == modifiedHolder ifTrue:[
       
   204         modified := modifiedHolder value
       
   205     ] ifFalse:[
       
   206         self modified:true
       
   207     ]
       
   208 ! !
       
   209 
       
   210 !UIPropertyView methodsFor:'initialization'!
       
   211 
       
   212 closeRequest
       
   213 
       
   214     modifiedHolder notNil ifTrue:[
       
   215         modifiedHolder removeDependent:self. 
       
   216         modifiedHolder := nil.
       
   217     ].
       
   218 
       
   219     super closeRequest
       
   220 
       
   221 
       
   222 !
       
   223 
       
   224 initialize
       
   225     super initialize.
       
   226     modified := false.
       
   227 !
       
   228 
       
   229 origin:anOrigin corner:aCorner in:aTopview
       
   230     window := SimpleView origin:anOrigin corner:aCorner in:aTopview
       
   231 
       
   232 ! !
       
   233 
       
   234 !UIPropertyView::Specification methodsFor:'accessing'!
       
   235 
       
   236 specEdited
       
   237     "gets current edit specification
       
   238     "
       
   239     ^ specEdited
       
   240 
       
   241 
       
   242 !
       
   243 
       
   244 specEdited:aSpec
       
   245     "sets current edit specification
       
   246     "
       
   247     |aspects|
       
   248 
       
   249     self modified:false.
       
   250 
       
   251     aSpec isNil ifTrue:[
       
   252         specChannel := nil.
       
   253         specEdited  := nil.
       
   254     ] ifFalse:[
       
   255         specEdited class == aSpec class ifTrue:[
       
   256             specEdited := aSpec.
       
   257             specChannel value:specEdited.
       
   258           ^ self modified:false.
       
   259         ].
       
   260         specEdited  := aSpec.
       
   261         aspects     := IdentityDictionary new.
       
   262         specChannel := specEdited asValue.
       
   263         specEdited class addBindingsTo:aspects for:specEdited channel:specChannel
       
   264     ].
       
   265     self aspects:aspects.
       
   266     self buildFromSpec:nil.
       
   267 
       
   268 
       
   269 ! !
       
   270 
       
   271 !UIPropertyView::Specification methodsFor:'action'!
       
   272 
       
   273 reload
       
   274     "reload specification
       
   275     "
       
   276     specChannel notNil ifTrue:[
       
   277         specChannel value:specEdited.
       
   278         self modified:false.
       
   279     ]
       
   280 
       
   281 
       
   282 ! !
       
   283 
       
   284 !UIPropertyView::Dimension class methodsFor:'interface specs'!
       
   285 
       
   286 specificationAlignmentOrigin
       
   287     "this window spec was automatically generated by the ST/X UIPainter"
       
   288 
       
   289     "do not manually edit this - the painter/builder may not be able to
       
   290      handle the specification if its corrupted."
       
   291 
       
   292     "
       
   293      UIPainter new openOnClass:UIPropertyView::Dimension andSelector:#specificationAlignmentOrigin
       
   294      UIPropertyView::Dimension new openInterface:#specificationAlignmentOrigin
       
   295     "
       
   296 
       
   297     <resource: #canvas>
       
   298 
       
   299     ^
       
   300      
       
   301        #(#FullSpec
       
   302           #'window:' 
       
   303            #(#WindowSpec
       
   304               #'name:' 'uIPainterView'
       
   305               #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
       
   306               #'label:' 'unnamed'
       
   307               #'bounds:' #(#Rectangle 0 0 250 365)
       
   308           )
       
   309           #'component:' 
       
   310            #(#SpecCollection
       
   311               #'collection:' 
       
   312                #(
       
   313                  #(#LabelSpec
       
   314                     #'name:' 'label2'
       
   315                     #'layout:' #(#AlignmentOrigin 49 0 68 0 1 0)
       
   316                     #'label:' 'top'
       
   317                     #'adjust:' #right
       
   318                 )
       
   319                  #(#LabelSpec
       
   320                     #'name:' 'label3'
       
   321                     #'layout:' #(#Point 58 13)
       
   322                     #'label:' 'relative'
       
   323                 )
       
   324                  #(#LabelSpec
       
   325                     #'name:' 'label4'
       
   326                     #'layout:' #(#Point 154 14)
       
   327                     #'label:' 'offset'
       
   328                 )
       
   329                  #(#LabelSpec
       
   330                     #'name:' 'label5'
       
   331                     #'layout:' #(#AlignmentOrigin 63 0 140 0 1 0)
       
   332                     #'label:' 'align H'
       
   333                     #'adjust:' #right
       
   334                 )
       
   335                  #(#LabelSpec
       
   336                     #'name:' 'label6'
       
   337                     #'layout:' #(#AlignmentOrigin 63 0 166 0 1 0)
       
   338                     #'label:' 'align V'
       
   339                     #'adjust:' #right
       
   340                 )
       
   341                  #(#InputFieldSpec
       
   342                     #'name:' 'editField1'
       
   343                     #'layout:' #(#LayoutFrame 58 0 41 0 115 0 59 0)
       
   344                     #'model:' #leftFraction
       
   345                     #'tabable:' true
       
   346                     #'type:' #numberOrNil
       
   347                 )
       
   348                  #(#InputFieldSpec
       
   349                     #'name:' 'editField2'
       
   350                     #'layout:' #(#LayoutFrame 58 0 68 0 115 0 86 0)
       
   351                     #'model:' #topFraction
       
   352                     #'tabable:' true
       
   353                     #'type:' #numberOrNil
       
   354                 )
       
   355                  #(#InputFieldSpec
       
   356                     #'name:' 'editField5'
       
   357                     #'layout:' #(#LayoutFrame 68 0 140 0 125 0 158 0)
       
   358                     #'model:' #leftAlignmentFraction
       
   359                     #'tabable:' true
       
   360                     #'type:' #numberOrNil
       
   361                 )
       
   362                  #(#InputFieldSpec
       
   363                     #'name:' 'editField6'
       
   364                     #'layout:' #(#LayoutFrame 68 0 166 0 125 0 184 0)
       
   365                     #'model:' #topAlignmentFraction
       
   366                     #'tabable:' true
       
   367                     #'type:' #numberOrNil
       
   368                 )
       
   369                  #(#InputFieldSpec
       
   370                     #'name:' 'editField3'
       
   371                     #'layout:' #(#LayoutFrame 154 0 41 0 212 0 59 0)
       
   372                     #'model:' #leftOffset
       
   373                     #'tabable:' true
       
   374                     #'type:' #numberOrNil
       
   375                 )
       
   376                  #(#InputFieldSpec
       
   377                     #'name:' 'editField4'
       
   378                     #'layout:' #(#LayoutFrame 154 0 68 0 212 0 86 0)
       
   379                     #'model:' #topOffset
       
   380                     #'tabable:' true
       
   381                     #'type:' #numberOrNil
       
   382                 )
       
   383                  #(#ActionButtonSpec
       
   384                     #'name:' 'button1'
       
   385                     #'layout:' #(#LayoutFrame 119 0 41 0 138 0 59 0)
       
   386                     #'label:' ''
       
   387                     #'model:' #makeRelativeLeft
       
   388                     #'isTriggerOnDown:' false
       
   389                     #'autoRepeat:' false
       
   390                 )
       
   391                  #(#ActionButtonSpec
       
   392                     #'name:' 'button2'
       
   393                     #'layout:' #(#LayoutFrame 119 0 68 0 138 0 86 0)
       
   394                     #'label:' ''
       
   395                     #'model:' #makeRelativeTop
       
   396                     #'isTriggerOnDown:' false
       
   397                     #'autoRepeat:' false
       
   398                 )
       
   399                  #(#ActionButtonSpec
       
   400                     #'name:' 'button3'
       
   401                     #'layout:' #(#LayoutFrame 217 0 41 0 236 0 59 0)
       
   402                     #'label:' ''
       
   403                     #'model:' #makeOffsetLeft
       
   404                     #'isTriggerOnDown:' false
       
   405                     #'autoRepeat:' false
       
   406                 )
       
   407                  #(#ActionButtonSpec
       
   408                     #'name:' 'button4'
       
   409                     #'layout:' #(#LayoutFrame 217 0 68 0 236 0 86 0)
       
   410                     #'label:' ''
       
   411                     #'model:' #makeOffsetTop
       
   412                     #'isTriggerOnDown:' false
       
   413                     #'autoRepeat:' false
       
   414                 )
       
   415                  #(#ActionButtonSpec
       
   416                     #'name:' 'button8'
       
   417                     #'layout:' #(#LayoutFrame 119 0 102 0 138 0 120 0)
       
   418                     #'label:' ''
       
   419                     #'model:' #makeRelativeLeftTop
       
   420                     #'isTriggerOnDown:' false
       
   421                     #'autoRepeat:' false
       
   422                 )
       
   423                  #(#ActionButtonSpec
       
   424                     #'name:' 'button9'
       
   425                     #'layout:' #(#LayoutFrame 217 0 102 0 236 0 120 0)
       
   426                     #'label:' ''
       
   427                     #'model:' #makeOffsetLeftTop
       
   428                     #'isTriggerOnDown:' false
       
   429                     #'autoRepeat:' false
       
   430                 )
       
   431                  #(#LabelSpec
       
   432                     #'name:' 'label7'
       
   433                     #'layout:' #(#AlignmentOrigin 49 0 102 0 1 0)
       
   434                     #'label:' 'all'
       
   435                     #'adjust:' #right
       
   436                 )
       
   437                  #(#LabelSpec
       
   438                     #'name:' 'label1'
       
   439                     #'layout:' #(#AlignmentOrigin 49 0 41 0 1 0)
       
   440                     #'label:' 'left'
       
   441                     #'adjust:' #right
       
   442                 )
       
   443                  #(#DividerSpec
       
   444                     #'name:' 'separator1'
       
   445                     #'layout:' #(#Rectangle 154 142 203 153)
       
   446                     #'orientation:' #horizontal
       
   447                 )
       
   448                  #(#DividerSpec
       
   449                     #'name:' 'separator2'
       
   450                     #'layout:' #(#Rectangle 154 173 203 184)
       
   451                     #'orientation:' #horizontal
       
   452                 )
       
   453                  #(#DividerSpec
       
   454                     #'name:' 'separator3'
       
   455                     #'layout:' #(#Rectangle 145 152 155 173)
       
   456                     #'orientation:' #vertical
       
   457                 )
       
   458                  #(#DividerSpec
       
   459                     #'name:' 'separator4'
       
   460                     #'layout:' #(#Rectangle 203 152 213 173)
       
   461                     #'orientation:' #vertical
       
   462                 )
       
   463                  #(#ActionButtonSpec
       
   464                     #'name:' 'alignBR'
       
   465                     #'layout:' #(#Rectangle 201 172 213 184)
       
   466                     #'label:' ''
       
   467                     #'model:' #makeAlignBottomRight
       
   468                     #'isTriggerOnDown:' false
       
   469                     #'autoRepeat:' false
       
   470                 )
       
   471                  #(#ActionButtonSpec
       
   472                     #'name:' 'alignTL'
       
   473                     #'layout:' #(#Rectangle 145 141 157 153)
       
   474                     #'label:' ''
       
   475                     #'model:' #makeAlignTopLeft
       
   476                     #'isTriggerOnDown:' false
       
   477                     #'autoRepeat:' false
       
   478                 )
       
   479                  #(#ActionButtonSpec
       
   480                     #'name:' 'alignTR'
       
   481                     #'layout:' #(#Rectangle 201 141 213 153)
       
   482                     #'label:' ''
       
   483                     #'model:' #makeAlignTopRight
       
   484                     #'isTriggerOnDown:' false
       
   485                     #'autoRepeat:' false
       
   486                 )
       
   487                  #(#ActionButtonSpec
       
   488                     #'name:' 'alignBL'
       
   489                     #'layout:' #(#Rectangle 145 171 157 183)
       
   490                     #'label:' ''
       
   491                     #'model:' #makeAlignBottomLeft
       
   492                     #'isTriggerOnDown:' false
       
   493                     #'autoRepeat:' false
       
   494                 )
       
   495                  #(#ActionButtonSpec
       
   496                     #'name:' 'alignTC'
       
   497                     #'layout:' #(#Rectangle 173 141 185 153)
       
   498                     #'label:' ''
       
   499                     #'model:' #makeAlignTopCenter
       
   500                     #'isTriggerOnDown:' false
       
   501                     #'autoRepeat:' false
       
   502                 )
       
   503                  #(#ActionButtonSpec
       
   504                     #'name:' 'alignBC'
       
   505                     #'layout:' #(#Rectangle 173 172 185 184)
       
   506                     #'label:' ''
       
   507                     #'model:' #makeAlignBottomCenter
       
   508                     #'isTriggerOnDown:' false
       
   509                     #'autoRepeat:' false
       
   510                 )
       
   511                  #(#ActionButtonSpec
       
   512                     #'name:' 'alignLC'
       
   513                     #'layout:' #(#Rectangle 145 156 157 168)
       
   514                     #'label:' ''
       
   515                     #'model:' #makeAlignLeftCenter
       
   516                     #'isTriggerOnDown:' false
       
   517                     #'autoRepeat:' false
       
   518                 )
       
   519                  #(#ActionButtonSpec
       
   520                     #'name:' 'alignRC'
       
   521                     #'layout:' #(#Rectangle 201 156 213 168)
       
   522                     #'label:' ''
       
   523                     #'model:' #makeAlignRightCenter
       
   524                     #'isTriggerOnDown:' false
       
   525                     #'autoRepeat:' false
       
   526                 )
       
   527                  #(#ActionButtonSpec
       
   528                     #'name:' 'alignC'
       
   529                     #'layout:' #(#Rectangle 173 156 185 168)
       
   530                     #'label:' ''
       
   531                     #'model:' #makeAlignCenter
       
   532                     #'isTriggerOnDown:' false
       
   533                     #'autoRepeat:' false
       
   534                 )
       
   535               )
       
   536           )
       
   537       )
       
   538 !
       
   539 
       
   540 specificationExtent
       
   541     "this window spec was automatically generated by the ST/X UIPainter"
       
   542 
       
   543     "do not manually edit this - the painter/builder may not be able to
       
   544      handle the specification if its corrupted."
       
   545 
       
   546     "
       
   547      UIPainter new openOnClass:UIPropertyView::Dimension andSelector:#specificationExtent
       
   548      UIPropertyView::Dimension new openInterface:#specificationExtent
       
   549     "
       
   550 
       
   551     <resource: #canvas>
       
   552 
       
   553     ^
       
   554      
       
   555        #(#FullSpec
       
   556           #'window:' 
       
   557            #(#WindowSpec
       
   558               #'name:' 'uIPainterView'
       
   559               #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
       
   560               #'label:' 'unnamed'
       
   561               #'bounds:' #(#Rectangle 0 0 224 251)
       
   562           )
       
   563           #'component:' 
       
   564            #(#SpecCollection
       
   565               #'collection:' 
       
   566                #(
       
   567                  #(#LabelSpec
       
   568                     #'name:' 'label1'
       
   569                     #'layout:' #(#AlignmentOrigin 99 0 45 0 1 0)
       
   570                     #'label:' 'horizontal:'
       
   571                     #'adjust:' #left
       
   572                 )
       
   573                  #(#LabelSpec
       
   574                     #'name:' 'label2'
       
   575                     #'layout:' #(#AlignmentOrigin 99 0 72 0 1 0)
       
   576                     #'label:' 'vertical:'
       
   577                     #'adjust:' #left
       
   578                 )
       
   579                  #(#InputFieldSpec
       
   580                     #'name:' 'editField1'
       
   581                     #'layout:' #(#LayoutFrame 104 0 45 0 197 0 63 0)
       
   582                     #'model:' #leftOffset
       
   583                     #'tabable:' true
       
   584                     #'type:' #numberOrNil
       
   585                 )
       
   586                  #(#InputFieldSpec
       
   587                     #'name:' 'editField2'
       
   588                     #'layout:' #(#LayoutFrame 104 0 72 0 197 0 90 0)
       
   589                     #'model:' #rightOffset
       
   590                     #'tabable:' true
       
   591                     #'type:' #numberOrNil
       
   592                 )
       
   593                  #(#LabelSpec
       
   594                     #'name:' 'extentLabel'
       
   595                     #'layout:' #(#LayoutFrame 9 0 20 0 63 0 37 0)
       
   596                     #'label:' 'Extent:'
       
   597                 )
       
   598               )
       
   599           )
       
   600       )
       
   601 !
       
   602 
       
   603 specificationLayoutFrame
       
   604     "this window spec was automatically generated by the ST/X UIPainter"
       
   605 
       
   606     "do not manually edit this - the painter/builder may not be able to
       
   607      handle the specification if its corrupted."
       
   608 
       
   609     "
       
   610      UIPainter new openOnClass:UIPropertyView::Dimension andSelector:#specificationLayoutFrame
       
   611      UIPropertyView::Dimension new openInterface:#specificationLayoutFrame
       
   612     "
       
   613 
       
   614     <resource: #canvas>
       
   615 
       
   616     ^
       
   617      
       
   618        #(#FullSpec
       
   619           #'window:' 
       
   620            #(#WindowSpec
       
   621               #'name:' 'uIPainterView'
       
   622               #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
       
   623               #'label:' 'unnamed'
       
   624               #'bounds:' #(#Rectangle 0 0 238 291)
       
   625           )
       
   626           #'component:' 
       
   627            #(#SpecCollection
       
   628               #'collection:' 
       
   629                #(
       
   630                  #(#LabelSpec
       
   631                     #'name:' 'label left'
       
   632                     #'layout:' #(#AlignmentOrigin 60 0 43 0 1 0)
       
   633                     #'label:' 'left'
       
   634                 )
       
   635                  #(#LabelSpec
       
   636                     #'name:' 'label top'
       
   637                     #'layout:' #(#AlignmentOrigin 60 0 71 0 1 0)
       
   638                     #'label:' 'top'
       
   639                 )
       
   640                  #(#LabelSpec
       
   641                     #'name:' 'label right'
       
   642                     #'layout:' #(#AlignmentOrigin 60 0 99 0 1 0)
       
   643                     #'label:' 'right'
       
   644                 )
       
   645                  #(#LabelSpec
       
   646                     #'name:' 'label bottom'
       
   647                     #'layout:' #(#AlignmentOrigin 60 0 127 0 1 0)
       
   648                     #'label:' 'bottom'
       
   649                 )
       
   650                  #(#LabelSpec
       
   651                     #'name:' 'label relative'
       
   652                     #'layout:' #(#Point 65 14)
       
   653                     #'label:' 'relative'
       
   654                 )
       
   655                  #(#LabelSpec
       
   656                     #'name:' 'label offset'
       
   657                     #'layout:' #(#Point 159 14)
       
   658                     #'label:' 'offset'
       
   659                 )
       
   660                  #(#LabelSpec
       
   661                     #'name:' 'label all relative'
       
   662                     #'layout:' #(#AlignmentOrigin 60 0 161 0 1 0)
       
   663                     #'label:' 'all'
       
   664                 )
       
   665                  #(#InputFieldSpec
       
   666                     #'name:' 'relative E1'
       
   667                     #'layout:' #(#LayoutFrame 65 0 43 0 113 0 61 0)
       
   668                     #'model:' #leftFraction
       
   669                     #'type:' #numberOrNil
       
   670                 )
       
   671                  #(#InputFieldSpec
       
   672                     #'name:' 'relative E2'
       
   673                     #'layout:' #(#LayoutFrame 65 0 71 0 113 0 89 0)
       
   674                     #'model:' #topFraction
       
   675                     #'type:' #numberOrNil
       
   676                 )
       
   677                  #(#InputFieldSpec
       
   678                     #'name:' 'relative E3'
       
   679                     #'layout:' #(#LayoutFrame 65 0 99 0 113 0 117 0)
       
   680                     #'model:' #rightFraction
       
   681                     #'type:' #numberOrNil
       
   682                 )
       
   683                  #(#InputFieldSpec
       
   684                     #'name:' 'relative E4'
       
   685                     #'layout:' #(#LayoutFrame 65 0 127 0 113 0 145 0)
       
   686                     #'model:' #bottomFraction
       
   687                     #'type:' #numberOrNil
       
   688                 )
       
   689                  #(#InputFieldSpec
       
   690                     #'name:' 'offset E1'
       
   691                     #'layout:' #(#LayoutFrame 159 0 43 0 210 0 61 0)
       
   692                     #'model:' #leftOffset
       
   693                     #'type:' #numberOrNil
       
   694                 )
       
   695                  #(#InputFieldSpec
       
   696                     #'name:' 'offset E2'
       
   697                     #'layout:' #(#LayoutFrame 159 0 71 0 210 0 89 0)
       
   698                     #'model:' #topOffset
       
   699                     #'type:' #numberOrNil
       
   700                 )
       
   701                  #(#InputFieldSpec
       
   702                     #'name:' 'offset E3'
       
   703                     #'layout:' #(#LayoutFrame 159 0 99 0 210 0 117 0)
       
   704                     #'model:' #rightOffset
       
   705                     #'type:' #numberOrNil
       
   706                 )
       
   707                  #(#InputFieldSpec
       
   708                     #'name:' 'offset E4'
       
   709                     #'layout:' #(#LayoutFrame 159 0 127 0 210 0 145 0)
       
   710                     #'model:' #bottomOffset
       
   711                     #'type:' #numberOrNil
       
   712                 )
       
   713                  #(#ActionButtonSpec
       
   714                     #'name:' 'relative B1'
       
   715                     #'layout:' #(#LayoutFrame 117 0 43 0 136 0 61 0)
       
   716                     #'label:' ' '
       
   717                     #'model:' #makeRelativeLeft
       
   718                     #'isTriggerOnDown:' false
       
   719                     #'autoRepeat:' false
       
   720                 )
       
   721                  #(#ActionButtonSpec
       
   722                     #'name:' 'relative B2'
       
   723                     #'layout:' #(#LayoutFrame 117 0 71 0 136 0 89 0)
       
   724                     #'label:' ' '
       
   725                     #'model:' #makeRelativeTop
       
   726                     #'isTriggerOnDown:' false
       
   727                     #'autoRepeat:' false
       
   728                 )
       
   729                  #(#ActionButtonSpec
       
   730                     #'name:' 'relative B3'
       
   731                     #'layout:' #(#LayoutFrame 117 0 99 0 136 0 117 0)
       
   732                     #'label:' ' '
       
   733                     #'model:' #makeRelativeRight
       
   734                     #'isTriggerOnDown:' false
       
   735                     #'autoRepeat:' false
       
   736                 )
       
   737                  #(#ActionButtonSpec
       
   738                     #'name:' 'relative B4'
       
   739                     #'layout:' #(#LayoutFrame 117 0 127 0 136 0 145 0)
       
   740                     #'label:' ' '
       
   741                     #'model:' #makeRelativeBottom
       
   742                     #'isTriggerOnDown:' false
       
   743                     #'autoRepeat:' false
       
   744                 )
       
   745                  #(#ActionButtonSpec
       
   746                     #'name:' 'relative BAll'
       
   747                     #'layout:' #(#LayoutFrame 117 0 161 0 136 0 179 0)
       
   748                     #'label:' ' '
       
   749                     #'model:' #makeRelativeAll
       
   750                     #'isTriggerOnDown:' false
       
   751                     #'autoRepeat:' false
       
   752                 )
       
   753                  #(#ActionButtonSpec
       
   754                     #'name:' 'offset B1'
       
   755                     #'layout:' #(#LayoutFrame 214 0 43 0 233 0 61 0)
       
   756                     #'label:' ''
       
   757                     #'model:' #makeOffsetLeft
       
   758                     #'isTriggerOnDown:' false
       
   759                     #'autoRepeat:' false
       
   760                 )
       
   761                  #(#ActionButtonSpec
       
   762                     #'name:' 'offset B2'
       
   763                     #'layout:' #(#LayoutFrame 214 0 71 0 233 0 89 0)
       
   764                     #'label:' ''
       
   765                     #'model:' #makeOffsetTop
       
   766                     #'isTriggerOnDown:' false
       
   767                     #'autoRepeat:' false
       
   768                 )
       
   769                  #(#ActionButtonSpec
       
   770                     #'name:' 'offset B3'
       
   771                     #'layout:' #(#LayoutFrame 214 0 99 0 233 0 117 0)
       
   772                     #'label:' ''
       
   773                     #'model:' #makeOffsetRight
       
   774                     #'isTriggerOnDown:' false
       
   775                     #'autoRepeat:' false
       
   776                 )
       
   777                  #(#ActionButtonSpec
       
   778                     #'name:' 'offset B4'
       
   779                     #'layout:' #(#LayoutFrame 214 0 127 0 233 0 145 0)
       
   780                     #'label:' ''
       
   781                     #'model:' #makeOffsetBottom
       
   782                     #'isTriggerOnDown:' false
       
   783                     #'autoRepeat:' false
       
   784                 )
       
   785                  #(#ActionButtonSpec
       
   786                     #'name:' 'offset BAll'
       
   787                     #'layout:' #(#LayoutFrame 214 0 161 0 233 0 179 0)
       
   788                     #'label:' ' '
       
   789                     #'model:' #makeOffsetAll
       
   790                     #'isTriggerOnDown:' false
       
   791                     #'autoRepeat:' false
       
   792                 )
       
   793               )
       
   794           )
       
   795       )
       
   796 !
       
   797 
       
   798 specificationLayoutOrigin
       
   799     "this window spec was automatically generated by the ST/X UIPainter"
       
   800 
       
   801     "do not manually edit this - the painter/builder may not be able to
       
   802      handle the specification if its corrupted."
       
   803 
       
   804     "
       
   805      UIPainter new openOnClass:UIPropertyView::Dimension andSelector:#specificationLayoutOrigin
       
   806      UIPropertyView::Dimension new openInterface:#specificationLayoutOrigin
       
   807     "
       
   808 
       
   809     <resource: #canvas>
       
   810 
       
   811     ^
       
   812      
       
   813        #(#FullSpec
       
   814           #'window:' 
       
   815            #(#WindowSpec
       
   816               #'name:' 'uIPainterView'
       
   817               #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
       
   818               #'label:' 'unnamed'
       
   819               #'bounds:' #(#Rectangle 0 0 238 303)
       
   820           )
       
   821           #'component:' 
       
   822            #(#SpecCollection
       
   823               #'collection:' 
       
   824                #(
       
   825                  #(#LabelSpec
       
   826                     #'name:' 'label1'
       
   827                     #'layout:' #(#AlignmentOrigin 52 0 44 0 1 0)
       
   828                     #'label:' 'left'
       
   829                 )
       
   830                  #(#LabelSpec
       
   831                     #'name:' 'label2'
       
   832                     #'layout:' #(#AlignmentOrigin 52 0 71 0 1 0)
       
   833                     #'label:' 'top'
       
   834                 )
       
   835                  #(#LabelSpec
       
   836                     #'name:' 'label3'
       
   837                     #'layout:' #(#Point 57 12)
       
   838                     #'label:' 'relative'
       
   839                 )
       
   840                  #(#LabelSpec
       
   841                     #'name:' 'label4'
       
   842                     #'layout:' #(#Point 154 13)
       
   843                     #'label:' 'offset'
       
   844                 )
       
   845                  #(#InputFieldSpec
       
   846                     #'name:' 'editField1'
       
   847                     #'layout:' #(#LayoutFrame 57 0 44 0 114 0 62 0)
       
   848                     #'model:' #leftFraction
       
   849                     #'tabable:' true
       
   850                     #'type:' #numberOrNil
       
   851                 )
       
   852                  #(#InputFieldSpec
       
   853                     #'name:' 'editField2'
       
   854                     #'layout:' #(#LayoutFrame 57 0 71 0 114 0 89 0)
       
   855                     #'model:' #topFraction
       
   856                     #'tabable:' true
       
   857                     #'type:' #numberOrNil
       
   858                 )
       
   859                  #(#InputFieldSpec
       
   860                     #'name:' 'editField3'
       
   861                     #'layout:' #(#LayoutFrame 154 0 44 0 212 0 62 0)
       
   862                     #'model:' #leftOffset
       
   863                     #'tabable:' true
       
   864                     #'type:' #numberOrNil
       
   865                 )
       
   866                  #(#InputFieldSpec
       
   867                     #'name:' 'editField4'
       
   868                     #'layout:' #(#LayoutFrame 154 0 71 0 212 0 89 0)
       
   869                     #'model:' #topOffset
       
   870                     #'tabable:' true
       
   871                     #'type:' #numberOrNil
       
   872                 )
       
   873                  #(#ActionButtonSpec
       
   874                     #'name:' 'button1'
       
   875                     #'layout:' #(#LayoutFrame 119 0 44 0 138 0 62 0)
       
   876                     #'label:' ''
       
   877                     #'model:' #makeRelativeLeft
       
   878                     #'isTriggerOnDown:' false
       
   879                     #'autoRepeat:' false
       
   880                 )
       
   881                  #(#ActionButtonSpec
       
   882                     #'name:' 'button2'
       
   883                     #'layout:' #(#LayoutFrame 119 0 71 0 138 0 89 0)
       
   884                     #'label:' ''
       
   885                     #'model:' #makeRelativeTop
       
   886                     #'isTriggerOnDown:' false
       
   887                     #'autoRepeat:' false
       
   888                 )
       
   889                  #(#ActionButtonSpec
       
   890                     #'name:' 'button3'
       
   891                     #'layout:' #(#LayoutFrame 216 0 44 0 235 0 62 0)
       
   892                     #'label:' ''
       
   893                     #'model:' #makeOffsetLeft
       
   894                     #'isTriggerOnDown:' false
       
   895                     #'autoRepeat:' false
       
   896                 )
       
   897                  #(#ActionButtonSpec
       
   898                     #'name:' 'button4'
       
   899                     #'layout:' #(#LayoutFrame 216 0 71 0 235 0 89 0)
       
   900                     #'label:' ''
       
   901                     #'model:' #makeOffsetTop
       
   902                     #'isTriggerOnDown:' false
       
   903                     #'autoRepeat:' false
       
   904                 )
       
   905                  #(#ActionButtonSpec
       
   906                     #'name:' 'button8'
       
   907                     #'layout:' #(#LayoutFrame 119 0 103 0 138 0 121 0)
       
   908                     #'label:' ''
       
   909                     #'model:' #makeRelativeLeftTop
       
   910                     #'isTriggerOnDown:' false
       
   911                     #'autoRepeat:' false
       
   912                 )
       
   913                  #(#ActionButtonSpec
       
   914                     #'name:' 'button9'
       
   915                     #'layout:' #(#LayoutFrame 216 0 103 0 235 0 121 0)
       
   916                     #'label:' ''
       
   917                     #'model:' #makeOffsetLeftTop
       
   918                     #'isTriggerOnDown:' false
       
   919                     #'autoRepeat:' false
       
   920                 )
       
   921                  #(#LabelSpec
       
   922                     #'name:' 'label5'
       
   923                     #'layout:' #(#AlignmentOrigin 52 0 103 0 1 0)
       
   924                     #'label:' 'all'
       
   925                 )
       
   926               )
       
   927           )
       
   928       )
       
   929 !
       
   930 
       
   931 specificationPoint
       
   932     "this window spec was automatically generated by the ST/X UIPainter"
       
   933 
       
   934     "do not manually edit this - the painter/builder may not be able to
       
   935      handle the specification if its corrupted."
       
   936 
       
   937     "
       
   938      UIPainter new openOnClass:UIPropertyView::Dimension andSelector:#specificationPoint
       
   939      UIPropertyView::Dimension new openInterface:#specificationPoint
       
   940     "
       
   941 
       
   942     <resource: #canvas>
       
   943 
       
   944     ^
       
   945      
       
   946        #(#FullSpec
       
   947           #'window:' 
       
   948            #(#WindowSpec
       
   949               #'name:' 'uIPainterView'
       
   950               #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
       
   951               #'label:' 'unnamed'
       
   952               #'bounds:' #(#Rectangle 0 0 238 303)
       
   953           )
       
   954           #'component:' 
       
   955            #(#SpecCollection
       
   956               #'collection:' 
       
   957                #(
       
   958                  #(#LabelSpec
       
   959                     #'name:' 'label1'
       
   960                     #'layout:' #(#AlignmentOrigin 75 0 19 0 1 0)
       
   961                     #'label:' 'origin x:'
       
   962                 )
       
   963                  #(#LabelSpec
       
   964                     #'name:' 'label2'
       
   965                     #'layout:' #(#AlignmentOrigin 75 0 46 0 1 0)
       
   966                     #'label:' 'origin y:'
       
   967                 )
       
   968                  #(#InputFieldSpec
       
   969                     #'name:' 'editField1'
       
   970                     #'layout:' #(#LayoutFrame 77 0 19 0 170 0 37 0)
       
   971                     #'model:' #absLeft
       
   972                     #'tabable:' true
       
   973                     #'type:' #numberOrNil
       
   974                 )
       
   975                  #(#InputFieldSpec
       
   976                     #'name:' 'editField2'
       
   977                     #'layout:' #(#LayoutFrame 77 0 46 0 170 0 64 0)
       
   978                     #'model:' #absTop
       
   979                     #'tabable:' true
       
   980                     #'type:' #numberOrNil
       
   981                 )
       
   982               )
       
   983           )
       
   984       )
       
   985 !
       
   986 
       
   987 specificationRectangle
       
   988     "this window spec was automatically generated by the ST/X UIPainter"
       
   989 
       
   990     "do not manually edit this - the painter/builder may not be able to
       
   991      handle the specification if its corrupted."
       
   992 
       
   993     "
       
   994      UIPainter new openOnClass:UIPropertyView::Dimension andSelector:#specificationRectangle
       
   995      UIPropertyView::Dimension new openInterface:#specificationRectangle
       
   996     "
       
   997 
       
   998     <resource: #canvas>
       
   999 
       
  1000     ^
       
  1001      
       
  1002        #(#FullSpec
       
  1003           #'window:' 
       
  1004            #(#WindowSpec
       
  1005               #'name:' 'uIPainterView'
       
  1006               #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
       
  1007               #'label:' 'unnamed'
       
  1008               #'bounds:' #(#Rectangle 0 0 238 303)
       
  1009           )
       
  1010           #'component:' 
       
  1011            #(#SpecCollection
       
  1012               #'collection:' 
       
  1013                #(
       
  1014                  #(#LabelSpec
       
  1015                     #'name:' 'label1'
       
  1016                     #'layout:' #(#AlignmentOrigin 80 0 19 0 1 0)
       
  1017                     #'label:' 'origin x:'
       
  1018                     #'adjust:' #left
       
  1019                 )
       
  1020                  #(#LabelSpec
       
  1021                     #'name:' 'label2'
       
  1022                     #'layout:' #(#AlignmentOrigin 80 0 46 0 1 0)
       
  1023                     #'label:' 'origin y:'
       
  1024                     #'adjust:' #left
       
  1025                 )
       
  1026                  #(#InputFieldSpec
       
  1027                     #'name:' 'editField1'
       
  1028                     #'layout:' #(#LayoutFrame 81 0 19 0 174 0 37 0)
       
  1029                     #'model:' #leftOffset
       
  1030                     #'tabable:' true
       
  1031                     #'type:' #numberOrNil
       
  1032                 )
       
  1033                  #(#InputFieldSpec
       
  1034                     #'name:' 'editField2'
       
  1035                     #'layout:' #(#LayoutFrame 81 0 46 0 174 0 64 0)
       
  1036                     #'model:' #topOffset
       
  1037                     #'tabable:' true
       
  1038                     #'type:' #numberOrNil
       
  1039                 )
       
  1040                  #(#LabelSpec
       
  1041                     #'name:' 'label4'
       
  1042                     #'layout:' #(#AlignmentOrigin 80 0 74 0 1 0)
       
  1043                     #'label:' 'corner x:'
       
  1044                     #'adjust:' #left
       
  1045                 )
       
  1046                  #(#LabelSpec
       
  1047                     #'name:' 'label5'
       
  1048                     #'layout:' #(#AlignmentOrigin 80 0 101 0 1 0)
       
  1049                     #'label:' 'corner y:'
       
  1050                     #'adjust:' #left
       
  1051                 )
       
  1052                  #(#InputFieldSpec
       
  1053                     #'name:' 'editField3'
       
  1054                     #'layout:' #(#LayoutFrame 81 0 74 0 174 0 92 0)
       
  1055                     #'model:' #rightOffset
       
  1056                     #'tabable:' true
       
  1057                     #'type:' #numberOrNil
       
  1058                 )
       
  1059                  #(#InputFieldSpec
       
  1060                     #'name:' 'editField4'
       
  1061                     #'layout:' #(#LayoutFrame 81 0 101 0 174 0 119 0)
       
  1062                     #'model:' #bottomOffset
       
  1063                     #'tabable:' true
       
  1064                     #'type:' #numberOrNil
       
  1065                 )
       
  1066               )
       
  1067           )
       
  1068       )
       
  1069 ! !
       
  1070 
       
  1071 !UIPropertyView::Dimension methodsFor:'accessing'!
       
  1072 
       
  1073 forView
       
  1074     "get the view the layout derives from
       
  1075     "
       
  1076   ^ forView
       
  1077 !
       
  1078 
       
  1079 forView:aView
       
  1080     "set the view the layout derives from
       
  1081     "
       
  1082     forView := aView.
       
  1083     self update.
       
  1084 !
       
  1085 
       
  1086 label
       
  1087     ^ 'Layout'
       
  1088 !
       
  1089 
       
  1090 layout
       
  1091     "returns current layout
       
  1092     "
       
  1093     |layout|
       
  1094 
       
  1095     selection notNil ifTrue:[
       
  1096         layout := self perform:(('get', selection asString) asSymbol).
       
  1097     ].
       
  1098     ^ layout
       
  1099 !
       
  1100 
       
  1101 layoutType
       
  1102     "returns current layoutType
       
  1103     "
       
  1104     ^ selection
       
  1105 !
       
  1106 
       
  1107 update
       
  1108     "update from physical view
       
  1109     "
       
  1110     |superView|
       
  1111 
       
  1112     forView notNil ifTrue:[
       
  1113         superView := forView superView
       
  1114     ].
       
  1115     noteBook enabled:((superView isNil or:[superView specClass isLayoutContainer]) not).
       
  1116     self selection:(UIPainterView layoutType:forView).
       
  1117 
       
  1118 
       
  1119 ! !
       
  1120 
       
  1121 !UIPropertyView::Dimension methodsFor:'accessing hierarchy'!
       
  1122 
       
  1123 window
       
  1124     ^ noteBook
       
  1125 
       
  1126 
       
  1127 ! !
       
  1128 
       
  1129 !UIPropertyView::Dimension methodsFor:'initialization'!
       
  1130 
       
  1131 initialize
       
  1132     "initialize channels
       
  1133     "
       
  1134     |layoutAspects|
       
  1135 
       
  1136     super initialize.
       
  1137 
       
  1138     layoutAspects := IdentityDictionary new.
       
  1139 
       
  1140     #(  bottomFraction          bottomOffset
       
  1141         leftFraction            leftOffset
       
  1142         topFraction             topOffset
       
  1143         rightFraction           rightOffset
       
  1144         leftAlignmentFraction   topAlignmentFraction
       
  1145         absLeft                 absTop               
       
  1146     )
       
  1147     do:[:aKey|
       
  1148         layoutAspects at:aKey put:(ValueHolder new)
       
  1149     ].
       
  1150     self aspects:layoutAspects.
       
  1151 
       
  1152 
       
  1153 !
       
  1154 
       
  1155 origin:anOrigin corner:aCorner in:aTopView
       
  1156     "set dimensions
       
  1157     "
       
  1158     noteBook := NoteBookView origin:anOrigin corner:aCorner in:aTopView.
       
  1159     window   := noteBook canvas.
       
  1160 
       
  1161     noteBook direction:#bottom.
       
  1162     noteBook useIndex:true.
       
  1163     layoutTypes := #( #LayoutFrame #AlignmentOrigin #LayoutOrigin #Point #Rectangle ).     
       
  1164     noteBook list:#( 'Frame' 'Alig.Origin' 'LayoutOrigin' 'Point' 'Rectangle' ).
       
  1165 
       
  1166     noteBook action:[:anIndex|
       
  1167         anIndex notNil ifTrue:[self selection:(layoutTypes at:anIndex)].
       
  1168     ].
       
  1169 
       
  1170 ! !
       
  1171 
       
  1172 !UIPropertyView::Dimension methodsFor:'layout access'!
       
  1173 
       
  1174 getAlignmentOrigin
       
  1175     "returns current layout as alignmentOrigin
       
  1176     "
       
  1177     |layout|
       
  1178 
       
  1179     layout  := AlignmentOrigin new.
       
  1180 
       
  1181     layout   leftOffset:((aspects at:#leftOffset)   value) ? 0.
       
  1182     layout    topOffset:((aspects at:#topOffset)    value) ? 0.
       
  1183     layout leftFraction:((aspects at:#leftFraction) value) ? 0.
       
  1184     layout  topFraction:((aspects at:#topFraction)  value) ? 0.
       
  1185 
       
  1186     layout leftAlignmentFraction:((aspects at:#leftAlignmentFraction) value) ? 0.
       
  1187     layout  topAlignmentFraction:((aspects at:#topAlignmentFraction)  value) ? 0.
       
  1188 
       
  1189   ^ layout
       
  1190 !
       
  1191 
       
  1192 getExtent
       
  1193     "returns current extent
       
  1194     "
       
  1195   ^ Point x:(((aspects at:#leftOffset)   value) ? 0)
       
  1196           y:(((aspects at:#rightOffset)  value) ? 0)
       
  1197 !
       
  1198 
       
  1199 getLayoutFrame
       
  1200     "returns current layout as layoutFrame
       
  1201     "
       
  1202     |layout|
       
  1203 
       
  1204     layout  := LayoutFrame new.
       
  1205 
       
  1206     layout     leftOffset:((aspects at:#leftOffset)     value) ? 0.
       
  1207     layout    rightOffset:((aspects at:#rightOffset)    value) ? 0.
       
  1208     layout      topOffset:((aspects at:#topOffset)      value) ? 0.
       
  1209     layout   bottomOffset:((aspects at:#bottomOffset)   value) ? 0.
       
  1210     layout   leftFraction:((aspects at:#leftFraction)   value) ? 0.
       
  1211     layout  rightFraction:((aspects at:#rightFraction)  value) ? 0.
       
  1212     layout    topFraction:((aspects at:#topFraction)    value) ? 0.
       
  1213     layout bottomFraction:((aspects at:#bottomFraction) value) ? 0.
       
  1214 
       
  1215   ^ layout
       
  1216 !
       
  1217 
       
  1218 getLayoutOrigin
       
  1219     "returns current layout as layoutOrigin
       
  1220     "
       
  1221     |layout|
       
  1222 
       
  1223     layout  := LayoutOrigin new.
       
  1224 
       
  1225     layout   leftOffset:((aspects at:#leftOffset)   value) ? 0.
       
  1226     layout    topOffset:((aspects at:#topOffset)    value) ? 0.
       
  1227     layout leftFraction:((aspects at:#leftFraction) value) ? 0.
       
  1228     layout  topFraction:((aspects at:#topFraction)  value) ? 0.
       
  1229 
       
  1230   ^ layout
       
  1231 !
       
  1232 
       
  1233 getPoint
       
  1234     "returns current layout as point
       
  1235     "
       
  1236   ^ Point x:(((aspects at:#absLeft) value) ? 0)
       
  1237           y:(((aspects at:#absTop)  value) ? 0)
       
  1238 !
       
  1239 
       
  1240 getRectangle
       
  1241     "returns current layout as rectangle
       
  1242     "
       
  1243   ^ Rectangle left:(((aspects at:#leftOffset)   value) ? 0)
       
  1244                top:(((aspects at:#topOffset)    value) ? 0)
       
  1245              right:(((aspects at:#rightOffset)  value) ? 0)
       
  1246             bottom:(((aspects at:#bottomOffset) value) ? 0)
       
  1247 ! !
       
  1248 
       
  1249 !UIPropertyView::Dimension methodsFor:'layout fetch'!
       
  1250 
       
  1251 fetchAlignmentOrigin
       
  1252     "fetch alignmentOrigin
       
  1253     "
       
  1254     |layout type extent|
       
  1255 
       
  1256     type    := UIPainterView layoutType:forView.
       
  1257     layout  := forView geometryLayout.
       
  1258 
       
  1259     layout isLayout ifTrue:[
       
  1260         (aspects at:#leftOffset)   value:(layout leftOffset).
       
  1261         (aspects at:#leftFraction) value:(layout leftFraction).
       
  1262         (aspects at:#topOffset)    value:(layout topOffset).
       
  1263         (aspects at:#topFraction)  value:(layout topFraction).
       
  1264 
       
  1265         type == #AlignmentOrigin ifTrue:[
       
  1266             (aspects at:#leftAlignmentFraction) value:(layout leftAlignmentFraction).
       
  1267             (aspects at:#topAlignmentFraction)  value:(layout topAlignmentFraction).
       
  1268           ^ self
       
  1269         ]
       
  1270     ] ifFalse:[
       
  1271         layout := forView computeOrigin.
       
  1272 
       
  1273         (aspects at:#leftOffset)   value:(layout x).
       
  1274         (aspects at:#leftFraction) value:0.
       
  1275         (aspects at:#topOffset)    value:(layout y).
       
  1276         (aspects at:#topFraction)  value:0.
       
  1277     ].
       
  1278     (aspects at:#leftAlignmentFraction) value:0.
       
  1279     (aspects at:#topAlignmentFraction)  value:0.
       
  1280 !
       
  1281 
       
  1282 fetchExtent
       
  1283     "fetch extent
       
  1284     "
       
  1285     |extent|
       
  1286 
       
  1287     extent  := forView computeExtent.
       
  1288 
       
  1289     (aspects at:#leftOffset)  value:(extent x).
       
  1290     (aspects at:#rightOffset) value:(extent y).
       
  1291 
       
  1292 !
       
  1293 
       
  1294 fetchLayoutFrame
       
  1295     "fetch layoutFrame
       
  1296     "
       
  1297     |layout|
       
  1298 
       
  1299     layout  := UIPainterView asLayoutFrameFromView:forView.
       
  1300 
       
  1301     (aspects at:#leftOffset)     value:(layout leftOffset).
       
  1302     (aspects at:#leftFraction)   value:(layout leftFraction).
       
  1303     (aspects at:#topOffset)      value:(layout topOffset).
       
  1304     (aspects at:#topFraction)    value:(layout topFraction).
       
  1305     (aspects at:#rightOffset)    value:(layout rightOffset).
       
  1306     (aspects at:#bottomOffset)   value:(layout bottomOffset).
       
  1307     (aspects at:#rightFraction)  value:(layout rightFraction).
       
  1308     (aspects at:#bottomFraction) value:(layout bottomFraction).
       
  1309 !
       
  1310 
       
  1311 fetchLayoutOrigin
       
  1312     "fetch layoutOrigin
       
  1313     "
       
  1314     |layout|
       
  1315 
       
  1316     layout  := UIPainterView asLayoutFrameFromView:forView.
       
  1317 
       
  1318     (aspects at:#leftOffset)   value:(layout leftOffset).
       
  1319     (aspects at:#leftFraction) value:(layout leftFraction).
       
  1320     (aspects at:#topOffset)    value:(layout topOffset).
       
  1321     (aspects at:#topFraction)  value:(layout topFraction).
       
  1322 !
       
  1323 
       
  1324 fetchPoint
       
  1325     "fetch point
       
  1326     "
       
  1327     |origin|
       
  1328 
       
  1329     origin  := forView computeOrigin.
       
  1330 
       
  1331     (aspects at:#absLeft) value:(origin x).
       
  1332     (aspects at:#absTop)  value:(origin y).
       
  1333 
       
  1334 !
       
  1335 
       
  1336 fetchRectangle
       
  1337     "fetch rectangle
       
  1338     "
       
  1339     |origin corner|
       
  1340 
       
  1341     origin  := forView computeOrigin.
       
  1342     corner  := forView computeCorner.
       
  1343 
       
  1344     (aspects at:#leftOffset)   value:(origin x).
       
  1345     (aspects at:#rightOffset)  value:(corner x).
       
  1346     (aspects at:#topOffset)    value:(origin y).
       
  1347     (aspects at:#bottomOffset) value:(corner y).
       
  1348 
       
  1349 ! !
       
  1350 
       
  1351 !UIPropertyView::Dimension methodsFor:'layout make align'!
       
  1352 
       
  1353 makeAlignBottomCenter
       
  1354     self makeAlignLeft:0.5 top:1
       
  1355 
       
  1356 
       
  1357 !
       
  1358 
       
  1359 makeAlignBottomLeft
       
  1360     self makeAlignLeft:0 top:1
       
  1361 
       
  1362 
       
  1363 !
       
  1364 
       
  1365 makeAlignBottomRight
       
  1366     self makeAlignLeft:1 top:1
       
  1367 
       
  1368 
       
  1369 !
       
  1370 
       
  1371 makeAlignCenter
       
  1372     self makeAlignLeft:0.5 top:0.5
       
  1373 
       
  1374 !
       
  1375 
       
  1376 makeAlignLeft:leftAlignmentFraction top:topAlignmentFraction
       
  1377     |lAF tAF lO tO ext|
       
  1378 
       
  1379     lAF     := (aspects at:#leftAlignmentFraction) value ? 0.
       
  1380     tAF     := (aspects at:#topAlignmentFraction)  value ? 0.
       
  1381     ext     := forView computeExtent.
       
  1382 
       
  1383     (aspects at:#leftAlignmentFraction) value:leftAlignmentFraction.
       
  1384     (aspects at:#topAlignmentFraction)  value:topAlignmentFraction.
       
  1385 
       
  1386     lO := (aspects at:#leftOffset) value ? 0.
       
  1387     tO := (aspects at:#topOffset)  value ? 0.
       
  1388 
       
  1389     lO := lO + (ext x * (leftAlignmentFraction - lAF)).
       
  1390     tO := tO + (ext y * (topAlignmentFraction  - tAF)).
       
  1391 
       
  1392     (aspects at:#leftOffset) value:(lO rounded).
       
  1393     (aspects at:#topOffset)  value:(tO rounded).
       
  1394 !
       
  1395 
       
  1396 makeAlignLeftCenter
       
  1397     self makeAlignLeft:0 top:0.5
       
  1398 
       
  1399 !
       
  1400 
       
  1401 makeAlignRightCenter
       
  1402     self makeAlignLeft:1 top:0.5
       
  1403 
       
  1404 !
       
  1405 
       
  1406 makeAlignTopCenter
       
  1407     self makeAlignLeft:0.5 top:0
       
  1408 
       
  1409 !
       
  1410 
       
  1411 makeAlignTopLeft
       
  1412     self makeAlignLeft:0 top:0
       
  1413 
       
  1414 !
       
  1415 
       
  1416 makeAlignTopRight
       
  1417     self makeAlignLeft:1 top:0
       
  1418 
       
  1419 
       
  1420 ! !
       
  1421 
       
  1422 !UIPropertyView::Dimension methodsFor:'layout make relative/absolute'!
       
  1423 
       
  1424 makeLayout:what xOrY:xOrY offset:aBool
       
  1425     |extent fraction offset fractSymb offsetSymb|
       
  1426 
       
  1427     extent     := (forView superView computeExtent) perform:xOrY.
       
  1428     fractSymb  := (what, 'Fraction') asSymbol.
       
  1429     offsetSymb := (what,   'Offset') asSymbol.
       
  1430 
       
  1431     fraction := (aspects at:fractSymb)  value.
       
  1432     offset   := (aspects at:offsetSymb) value.
       
  1433 
       
  1434     aBool ifTrue:[
       
  1435         offset   := offset + ((fraction * extent) asInteger).
       
  1436         fraction := 0.
       
  1437     ] ifFalse:[
       
  1438         fraction   := (fraction + (offset / extent)) asFloat.
       
  1439 
       
  1440         (fraction > 1.0) ifTrue:[ fraction := 1.0 ].
       
  1441         (fraction < 0.0) ifTrue:[ fraction := 0 ].
       
  1442         offset := 0.
       
  1443     ].
       
  1444     (aspects at:offsetSymb) value:offset.
       
  1445     (aspects at:fractSymb)  value:fraction.
       
  1446 !
       
  1447 
       
  1448 makeOffsetAll
       
  1449     self makeOffsetLeft.
       
  1450     self makeOffsetTop.
       
  1451     self makeOffsetRight.
       
  1452     self makeOffsetBottom.
       
  1453 
       
  1454 
       
  1455 !
       
  1456 
       
  1457 makeOffsetBottom
       
  1458     self makeLayout:'bottom' xOrY:#y offset:true.
       
  1459 
       
  1460 
       
  1461 !
       
  1462 
       
  1463 makeOffsetLeft
       
  1464     self makeLayout:'left' xOrY:#x offset:true.
       
  1465 
       
  1466 !
       
  1467 
       
  1468 makeOffsetLeftTop
       
  1469     self makeOffsetLeft.
       
  1470     self makeOffsetTop.
       
  1471 
       
  1472 !
       
  1473 
       
  1474 makeOffsetRight
       
  1475     self makeLayout:'right' xOrY:#x offset:true.
       
  1476 
       
  1477 !
       
  1478 
       
  1479 makeOffsetTop
       
  1480     self makeLayout:'top' xOrY:#y offset:true.
       
  1481 
       
  1482 !
       
  1483 
       
  1484 makeRelativeAll
       
  1485     self makeRelativeLeft.
       
  1486     self makeRelativeTop.
       
  1487     self makeRelativeRight.
       
  1488     self makeRelativeBottom.
       
  1489 
       
  1490 
       
  1491 !
       
  1492 
       
  1493 makeRelativeBottom
       
  1494     self makeLayout:'bottom' xOrY:#y offset:false.
       
  1495 
       
  1496 
       
  1497 !
       
  1498 
       
  1499 makeRelativeLeft
       
  1500     self makeLayout:'left' xOrY:#x offset:false.
       
  1501 
       
  1502 !
       
  1503 
       
  1504 makeRelativeLeftTop
       
  1505     self makeRelativeLeft.
       
  1506     self makeRelativeTop.
       
  1507 
       
  1508 !
       
  1509 
       
  1510 makeRelativeRight
       
  1511     self makeLayout:'right' xOrY:#x offset:false.
       
  1512 
       
  1513 !
       
  1514 
       
  1515 makeRelativeTop
       
  1516     self makeLayout:'top' xOrY:#y offset:false.
       
  1517 
       
  1518 ! !
       
  1519 
       
  1520 !UIPropertyView::Dimension methodsFor:'selection'!
       
  1521 
       
  1522 selection
       
  1523     ^ selection
       
  1524 
       
  1525 !
       
  1526 
       
  1527 selection:aLayoutType
       
  1528     |spec idx|
       
  1529 
       
  1530     selection == aLayoutType ifFalse:[
       
  1531         (selection := aLayoutType) notNil ifTrue:[
       
  1532             self perform:(('fetch',   selection asString) asSymbol).
       
  1533             spec := ('specification', selection asString) asSymbol.
       
  1534             spec := self class perform:spec.
       
  1535         ].
       
  1536         self buildFromSpec:spec.
       
  1537     ] ifTrue:[
       
  1538         selection notNil ifTrue:[
       
  1539             self perform:(('fetch',   selection asString) asSymbol).
       
  1540             self modified:false.
       
  1541         ]
       
  1542     ].
       
  1543     idx := layoutTypes findFirst:[:type| type == aLayoutType ].
       
  1544     noteBook setSelection:idx.
       
  1545 
       
  1546 ! !
       
  1547 
       
  1548 !UIPropertyView class methodsFor:'documentation'!
       
  1549 
       
  1550 version
       
  1551     ^ '$Header$'
       
  1552 ! !