UILayoutTool.st
changeset 1305 3aa9dab59633
parent 1304 c4a9211a6ec7
child 1310 572125002ce9
equal deleted inserted replaced
1304:c4a9211a6ec7 1305:3aa9dab59633
    12 
    12 
    13 
    13 
    14 
    14 
    15 
    15 
    16 ApplicationModel subclass:#UILayoutTool
    16 ApplicationModel subclass:#UILayoutTool
    17 	instanceVariableNames:'modifiedHolder aspects selection layoutView tabList layoutSpec'
    17 	instanceVariableNames:'modifiedHolder aspects selection currentTool layoutView tabList
       
    18 		layoutSpec toolsDictionary'
    18 	classVariableNames:''
    19 	classVariableNames:''
    19 	poolDictionaries:''
    20 	poolDictionaries:''
    20 	category:'Interface-UIPainter'
    21 	category:'Interface-UIPainter'
       
    22 !
       
    23 
       
    24 ApplicationModel subclass:#LayoutFrame
       
    25 	instanceVariableNames:''
       
    26 	classVariableNames:''
       
    27 	poolDictionaries:''
       
    28 	privateIn:UILayoutTool
       
    29 !
       
    30 
       
    31 ApplicationModel subclass:#Rectangle
       
    32 	instanceVariableNames:''
       
    33 	classVariableNames:''
       
    34 	poolDictionaries:''
       
    35 	privateIn:UILayoutTool
       
    36 !
       
    37 
       
    38 ApplicationModel subclass:#AlignmentOrigin
       
    39 	instanceVariableNames:''
       
    40 	classVariableNames:''
       
    41 	poolDictionaries:''
       
    42 	privateIn:UILayoutTool
    21 !
    43 !
    22 
    44 
    23 ApplicationModel subclass:#LayoutOrigin
    45 ApplicationModel subclass:#LayoutOrigin
    24 	instanceVariableNames:''
    46 	instanceVariableNames:''
    25 	classVariableNames:''
    47 	classVariableNames:''
    26 	poolDictionaries:''
    48 	poolDictionaries:''
    27 	privateIn:UILayoutTool
    49 	privateIn:UILayoutTool
    28 !
    50 !
    29 
    51 
    30 ApplicationModel subclass:#AlignmentOrigin
    52 ApplicationModel subclass:#Extent
    31 	instanceVariableNames:''
    53 	instanceVariableNames:''
    32 	classVariableNames:''
    54 	classVariableNames:''
    33 	poolDictionaries:''
    55 	poolDictionaries:''
    34 	privateIn:UILayoutTool
    56 	privateIn:UILayoutTool
    35 !
    57 !
    36 
    58 
    37 ApplicationModel subclass:#Rectangle
       
    38 	instanceVariableNames:''
       
    39 	classVariableNames:''
       
    40 	poolDictionaries:''
       
    41 	privateIn:UILayoutTool
       
    42 !
       
    43 
       
    44 ApplicationModel subclass:#Point
    59 ApplicationModel subclass:#Point
    45 	instanceVariableNames:''
       
    46 	classVariableNames:''
       
    47 	poolDictionaries:''
       
    48 	privateIn:UILayoutTool
       
    49 !
       
    50 
       
    51 ApplicationModel subclass:#LayoutFrame
       
    52 	instanceVariableNames:''
       
    53 	classVariableNames:''
       
    54 	poolDictionaries:''
       
    55 	privateIn:UILayoutTool
       
    56 !
       
    57 
       
    58 ApplicationModel subclass:#Extent
       
    59 	instanceVariableNames:''
    60 	instanceVariableNames:''
    60 	classVariableNames:''
    61 	classVariableNames:''
    61 	poolDictionaries:''
    62 	poolDictionaries:''
    62 	privateIn:UILayoutTool
    63 	privateIn:UILayoutTool
    63 !
    64 !
   445      UILayoutTool open
   446      UILayoutTool open
   446     "
   447     "
   447 
   448 
   448     <resource: #canvas>
   449     <resource: #canvas>
   449 
   450 
   450     ^
   451     ^ 
   451      
   452      #(#FullSpec
   452        #(#FullSpec
   453         #name: #windowSpec
   453           #window: 
   454         #window: 
   454            #(#WindowSpec
   455        #(#WindowSpec
   455               #name: 'UILayoutTool'
   456           #label: 'UILayoutTool'
   456               #layout: #(#LayoutFrame 571 0 290 0 870 0 589 0)
   457           #name: 'UILayoutTool'
   457               #label: 'UILayoutTool'
   458           #min: #(#Point 10 10)
   458               #min: #(#Point 10 10)
   459           #max: #(#Point 1152 900)
   459               #max: #(#Point 1152 900)
   460           #bounds: #(#Rectangle 12 22 312 322)
   460               #bounds: #(#Rectangle 571 290 871 590)
   461         )
   461               #usePreferredExtent: false
   462         #component: 
   462           )
   463        #(#SpecCollection
   463           #component: 
   464           #collection: #(
   464            #(#SpecCollection
   465            #(#NoteBookViewSpec
   465               #collection: 
   466               #attributes: 
   466                #(
   467              #(#tabable
   467                  #(#NoteBookViewSpec
   468                 true
   468                     #name: 'NoteBook'
       
   469                     #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
       
   470                     #activeHelpKey: #layoutTool
       
   471                     #enableChannel: #enableChannel
       
   472                     #tabable: true
       
   473                     #model: #noteBookModel
       
   474                     #menu: #noteBookList
       
   475                     #style: #(#FontDescription #helvetica #medium #roman #'10')
       
   476                     #direction: #bottom
       
   477                     #canvas: #noteBookView
       
   478                 )
       
   479               )
   469               )
   480           )
   470               #name: 'NoteBook'
       
   471               #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
       
   472               #activeHelpKey: #layoutTool
       
   473               #enableChannel: #enableChannel
       
   474               #tabable: true
       
   475               #model: #noteBookModel
       
   476               #menu: #noteBookList
       
   477               #style: #(#FontDescription #helvetica #medium #roman #'10')
       
   478               #direction: #bottom
       
   479               #canvas: #layoutCanvasHolder
       
   480               #keepCanvasAlive: true
       
   481             )
       
   482            )
       
   483          
       
   484         )
   481       )
   485       )
   482 ! !
   486 ! !
   483 
   487 
   484 !UILayoutTool methodsFor:'accessing'!
   488 !UILayoutTool methodsFor:'accessing'!
   485 
   489 
   490 !
   494 !
   491 
   495 
   492 layout
   496 layout
   493     "returns configued layout or nil
   497     "returns configued layout or nil
   494     "
   498     "
   495     |appl|
   499     ^ currentTool notNil ifTrue:[currentTool layout]
   496 
   500                         ifFalse:[nil]
   497     (appl := self noteBookView application) notNil ifTrue:[
       
   498         ^ appl layout
       
   499     ].
       
   500   ^ nil
       
   501 !
   501 !
   502 
   502 
   503 layoutType
   503 layoutType
   504     "returns current layout type or nil
   504     "returns current layout type or nil
   505     "
   505     "
   567 !
   567 !
   568 
   568 
   569 update
   569 update
   570     "update from view
   570     "update from view
   571     "
   571     "
   572     |view appl|
   572     |view|
   573 
   573 
   574     selection notNil ifTrue:[
   574     (selection notNil and:[currentTool notNil]) ifTrue:[
   575         (view := layoutView) notNil ifTrue:[
   575         (view := layoutView) notNil ifTrue:[
   576             (appl := self noteBookView application) notNil ifTrue:[
   576             currentTool fetch:view spec:layoutSpec
   577                 appl fetch:view spec:layoutSpec
       
   578             ]
       
   579         ]
   577         ]
   580     ].
   578     ].
   581         
   579         
   582 ! !
   580 ! !
   583 
   581 
   587     "returns aspect for a key or nil
   585     "returns aspect for a key or nil
   588     "
   586     "
   589   ^ aspects at:aKey ifAbsent:[ super aspectFor:aKey ]
   587   ^ aspects at:aKey ifAbsent:[ super aspectFor:aKey ]
   590 
   588 
   591 
   589 
       
   590 !
       
   591 
       
   592 layoutCanvasHolder
       
   593     |holder|
       
   594 
       
   595     (holder := builder bindingAt:#layoutCanvasHolder) isNil ifTrue:[
       
   596         holder := ValueHolder new.
       
   597         builder aspectAt:#layoutCanvasHolder put:holder
       
   598     ].
       
   599   ^ holder
   592 !
   600 !
   593 
   601 
   594 notUsingDefaultExtent
   602 notUsingDefaultExtent
   595     |holder|
   603     |holder|
   596 
   604 
   622     (holder := builder bindingAt:#noteBookModel) isNil ifTrue:[
   630     (holder := builder bindingAt:#noteBookModel) isNil ifTrue:[
   623         holder := AspectAdaptor new subject:self; forAspect:#selection.
   631         holder := AspectAdaptor new subject:self; forAspect:#selection.
   624         builder aspectAt:#noteBookModel put:holder.
   632         builder aspectAt:#noteBookModel put:holder.
   625     ].
   633     ].
   626     ^ holder
   634     ^ holder
   627 !
       
   628 
       
   629 noteBookView
       
   630     "automatically generated by UIPainter ...
       
   631     "
       
   632     |holder|
       
   633 
       
   634     (holder := builder bindingAt:#noteBookView) isNil ifTrue:[
       
   635         holder := SubCanvas new.
       
   636         builder aspectAt:#noteBookView put:holder
       
   637     ].
       
   638   ^ holder
       
   639 ! !
   635 ! !
   640 
   636 
   641 !UILayoutTool methodsFor:'change & update'!
   637 !UILayoutTool methodsFor:'change & update'!
   642 
   638 
   643 update:something with:aParameter from:changedObject
   639 update:something with:aParameter from:changedObject
   747     |slices size|
   743     |slices size|
   748 
   744 
   749     super initialize.
   745     super initialize.
   750 
   746 
   751     aspects  := IdentityDictionary new.
   747     aspects  := IdentityDictionary new.
       
   748     toolsDictionary := IdentityDictionary new.
   752 
   749 
   753     #(  bottomFraction          bottomOffset
   750     #(  bottomFraction          bottomOffset
   754         leftFraction            leftOffset
   751         leftFraction            leftOffset
   755         topFraction             topOffset
   752         topFraction             topOffset
   756         rightFraction           rightOffset
   753         rightFraction           rightOffset
   797 selection
   794 selection
   798     ^ selection
   795     ^ selection
   799 !
   796 !
   800 
   797 
   801 selection:aSelection
   798 selection:aSelection
   802     |appl slice sel noteBook|
   799     |appl slice sel noteBook key view|
   803 
   800 
   804     aSelection isNumber ifTrue:[
   801     aSelection isNumber ifTrue:[
   805         aSelection ~~ 0 ifTrue:[sel := tabList at:aSelection]
   802         aSelection ~~ 0 ifTrue:[sel := tabList at:aSelection]
   806     ] ifFalse:[
   803     ] ifFalse:[
   807         sel := aSelection
   804         sel := aSelection
   808     ].
   805     ].
       
   806 
   809     selection = sel ifFalse:[
   807     selection = sel ifFalse:[
   810         (selection := sel) notNil ifTrue:[
   808         (selection := sel) notNil ifTrue:[
   811             slice := self selectedSlice.
   809             key := selection asSymbol.
   812             appl  := slice last asString.
   810             appl := toolsDictionary at:key ifAbsent:nil.
   813             appl := Smalltalk classNamed:(self class name asString, '::', appl).
   811 
   814             appl := appl new.
   812             appl isNil ifTrue:[
   815             appl masterApplication:self.
   813                 view := SimpleView new.
   816             modifiedHolder value:true.
   814                 slice := self selectedSlice.
       
   815                 appl  := slice last asString.
       
   816                 appl := Smalltalk classNamed:(self class name asString, '::', appl).
       
   817                 appl := appl new.
       
   818                 appl masterApplication:self.
       
   819                 appl createBuilder.
       
   820                 view client:appl.
       
   821                 appl window:view.
       
   822                 modifiedHolder value:true.
       
   823                 toolsDictionary at:key put:appl.
       
   824             ] ifFalse:[
       
   825                 view := appl window
       
   826             ]
   817         ].
   827         ].
   818         noteBook := self noteBookView.
   828         currentTool := appl.
   819         noteBook client:appl.
   829         self layoutCanvasHolder value:view.
   820 
       
   821         appl notNil ifTrue:[
       
   822             noteBook scrolledView allViewBackground:(noteBook viewBackground).
       
   823         ]
       
   824     ].
   830     ].
   825     self update
   831     self update
   826 
       
   827 ! !
       
   828 
       
   829 !UILayoutTool::LayoutOrigin class methodsFor:'interface specs'!
       
   830 
       
   831 windowSpec
       
   832     "This resource specification was automatically generated
       
   833      by the UIPainter of ST/X."
       
   834 
       
   835     "Do not manually edit this!! If it is corrupted,
       
   836      the UIPainter may not be able to read the specification."
       
   837 
       
   838     "
       
   839      UIPainter new openOnClass:UILayoutTool::LayoutOrigin andSelector:#windowSpec
       
   840      UILayoutTool::LayoutOrigin new openInterface:#windowSpec
       
   841      UILayoutTool::LayoutOrigin open
       
   842     "
       
   843 
       
   844     <resource: #canvas>
       
   845 
       
   846     ^
       
   847      
       
   848        #(#FullSpec
       
   849           #window: 
       
   850            #(#WindowSpec
       
   851               #name: 'UILayoutTool-LayoutOrigin'
       
   852               #layout: #(#LayoutFrame 290 0 420 0 647 0 565 0)
       
   853               #label: 'UILayoutTool-LayoutOrigin'
       
   854               #min: #(#Point 10 10)
       
   855               #max: #(#Point 1152 900)
       
   856               #bounds: #(#Rectangle 290 420 648 566)
       
   857               #usePreferredExtent: false
       
   858           )
       
   859           #component: 
       
   860            #(#SpecCollection
       
   861               #collection: 
       
   862                #(
       
   863                  #(#UISubSpecification
       
   864                     #name: 'layoutOriginSpec'
       
   865                     #layout: #(#LayoutFrame 1 0.0 6 0 0 1.0 110 0)
       
   866                     #majorKey: #UILayoutTool
       
   867                     #minorKey: #layoutOriginSpec
       
   868                 )
       
   869               )
       
   870           )
       
   871       )
       
   872 ! !
       
   873 
       
   874 !UILayoutTool::LayoutOrigin methodsFor:'accessing'!
       
   875 
       
   876 fetch:aView spec:aSpec
       
   877     "fetch layoutOrigin
       
   878     "
       
   879     |layout|
       
   880 
       
   881     layout  := UIPainterView asLayoutFrameFromView:aView.
       
   882 
       
   883     (self aspectFor:#leftOffset)   value:(layout leftOffset).
       
   884     (self aspectFor:#leftFraction) value:(layout leftFraction).
       
   885     (self aspectFor:#topOffset)    value:(layout topOffset).
       
   886     (self aspectFor:#topFraction)  value:(layout topFraction).
       
   887 
       
   888 
       
   889 !
       
   890 
       
   891 layout
       
   892     "returns current layout as layoutOrigin
       
   893     "
       
   894     |layout|
       
   895 
       
   896     layout  := Smalltalk::LayoutOrigin new.
       
   897 
       
   898     layout   leftOffset:((self aspectFor:#leftOffset)   value) ? 0.
       
   899     layout    topOffset:((self aspectFor:#topOffset)    value) ? 0.
       
   900     layout leftFraction:((self aspectFor:#leftFraction) value) ? 0.
       
   901     layout  topFraction:((self aspectFor:#topFraction)  value) ? 0.
       
   902 
       
   903   ^ layout
       
   904 
       
   905 ! !
       
   906 
       
   907 !UILayoutTool::AlignmentOrigin class methodsFor:'help specs'!
       
   908 
       
   909 helpSpec
       
   910     "This resource specification was automatically generated
       
   911      by the UIHelpTool of ST/X."
       
   912 
       
   913     "Do not manually edit this!! If it is corrupted,
       
   914      the UIHelpTool may not be able to read the specification."
       
   915 
       
   916     "
       
   917      UIHelpTool openOnClass:UILayoutTool::AlignmentOrigin    
       
   918     "
       
   919 
       
   920     <resource: #help>
       
   921 
       
   922     ^super helpSpec addPairsFrom:#(
       
   923 
       
   924 #alignBottomCenter
       
   925 'Aligns the selected widget bottomCenter to location.'
       
   926 
       
   927 #alignBottomLeft
       
   928 'Aligns the selected widget bottomLeft to location.'
       
   929 
       
   930 #alignBottomRight
       
   931 'Aligns the selected widget bottomRight to location.'
       
   932 
       
   933 #alignCenter
       
   934 'Aligns the selected widget center to location.'
       
   935 
       
   936 #alignHorizontal
       
   937 'Horizontal inset to the location point of the selected widget.'
       
   938 
       
   939 #alignLeftCenter
       
   940 'Aligns the selected widget leftCenter to location.'
       
   941 
       
   942 #alignRightCenter
       
   943 'Aligns the selected widget rightCenter to location.'
       
   944 
       
   945 #alignTopCenter
       
   946 'Aligns the selected widget topCenter to location.'
       
   947 
       
   948 #alignTopLeft
       
   949 'Aligns the selected widget topLeft to location.'
       
   950 
       
   951 #alignTopRight
       
   952 'Aligns the selected widget topRight to location.'
       
   953 
       
   954 #alignVertical
       
   955 'Vertical inset to the location point of the widget.'
       
   956 
       
   957 )
       
   958 ! !
       
   959 
       
   960 !UILayoutTool::AlignmentOrigin class methodsFor:'interface specs'!
       
   961 
       
   962 windowSpec
       
   963     "This resource specification was automatically generated
       
   964      by the UIPainter of ST/X."
       
   965 
       
   966     "Do not manually edit this!! If it is corrupted,
       
   967      the UIPainter may not be able to read the specification."
       
   968 
       
   969     "
       
   970      UIPainter new openOnClass:UILayoutTool::AlignmentOrigin andSelector:#windowSpec
       
   971      UILayoutTool::AlignmentOrigin new openInterface:#windowSpec
       
   972      UILayoutTool::AlignmentOrigin open
       
   973     "
       
   974 
       
   975     <resource: #canvas>
       
   976 
       
   977     ^ 
       
   978      #(#FullSpec
       
   979         #name: #windowSpec
       
   980         #window: 
       
   981        #(#WindowSpec
       
   982           #label: 'UILayoutTool-AlignmentOrigin'
       
   983           #name: 'UILayoutTool-AlignmentOrigin'
       
   984           #min: #(#Point 10 10)
       
   985           #max: #(#Point 1152 900)
       
   986           #bounds: #(#Rectangle 42 231 447 438)
       
   987         )
       
   988         #component: 
       
   989        #(#SpecCollection
       
   990           #collection: #(
       
   991            #(#UISubSpecification
       
   992               #name: 'layoutOriginSpec'
       
   993               #layout: #(#LayoutFrame 1 0.0 6 0 0 1.0 111 0)
       
   994               #majorKey: #UILayoutTool
       
   995               #minorKey: #layoutOriginSpec
       
   996             )
       
   997            #(#FramedBoxSpec
       
   998               #label: 'Alignment'
       
   999               #name: 'FramedBox'
       
  1000               #layout: #(#LayoutFrame 1 0.0 113 0 0 1.0 208 0)
       
  1001               #labelPosition: #topLeft
       
  1002               #component: 
       
  1003              #(#SpecCollection
       
  1004                 #collection: #(
       
  1005                  #(#LabelSpec
       
  1006                     #label: 'Horizontal:'
       
  1007                     #name: 'alignHLabel'
       
  1008                     #layout: #(#AlignmentOrigin 88 0 17 0 1 0)
       
  1009                     #adjust: #right
       
  1010                   )
       
  1011                  #(#InputFieldSpec
       
  1012                     #attributes: 
       
  1013                    #(#tabable
       
  1014                       true
       
  1015                     )
       
  1016                     #name: 'leftAlignmentFractionField'
       
  1017                     #layout: #(#LayoutFrame 90 0 14 0 147 0 36 0)
       
  1018                     #activeHelpKey: #alignHorizontal
       
  1019                     #tabable: true
       
  1020                     #model: #leftAlignmentFraction
       
  1021                     #group: #inputGroup
       
  1022                     #type: #numberOrNil
       
  1023                     #acceptOnLostFocus: true
       
  1024                     #acceptChannel: #acceptChannel
       
  1025                     #modifiedChannel: #modifiedChannel
       
  1026                     #acceptOnPointerLeave: false
       
  1027                   )
       
  1028                  #(#LabelSpec
       
  1029                     #label: 'Vertical:'
       
  1030                     #name: 'alignVLabel'
       
  1031                     #layout: #(#AlignmentOrigin 88 0 43 0 1 0)
       
  1032                     #adjust: #right
       
  1033                   )
       
  1034                  #(#InputFieldSpec
       
  1035                     #attributes: 
       
  1036                    #(#tabable
       
  1037                       true
       
  1038                     )
       
  1039                     #name: 'topAlignmentFractionField'
       
  1040                     #layout: #(#LayoutFrame 90 0 40 0 147 0 62 0)
       
  1041                     #activeHelpKey: #alignVertical
       
  1042                     #tabable: true
       
  1043                     #model: #topAlignmentFraction
       
  1044                     #group: #inputGroup
       
  1045                     #type: #numberOrNil
       
  1046                     #acceptOnLostFocus: true
       
  1047                     #acceptChannel: #acceptChannel
       
  1048                     #modifiedChannel: #modifiedChannel
       
  1049                     #acceptOnPointerLeave: false
       
  1050                   )
       
  1051                  #(#DividerSpec
       
  1052                     #name: 'separator1'
       
  1053                     #layout: #(#LayoutFrame 204 0 19 0 245 0 22 0)
       
  1054                   )
       
  1055                  #(#DividerSpec
       
  1056                     #name: 'separator2'
       
  1057                     #layout: #(#LayoutFrame 204 0 55 0 245 0 58 0)
       
  1058                   )
       
  1059                  #(#DividerSpec
       
  1060                     #name: 'separator3'
       
  1061                     #layout: #(#LayoutFrame 196 0 28 0 199 0 50 0)
       
  1062                     #orientation: #vertical
       
  1063                   )
       
  1064                  #(#DividerSpec
       
  1065                     #name: 'separator4'
       
  1066                     #layout: #(#LayoutFrame 250 0 28 0 253 0 50 0)
       
  1067                     #orientation: #vertical
       
  1068                   )
       
  1069                  #(#ActionButtonSpec
       
  1070                     #attributes: 
       
  1071                    #(#tabable
       
  1072                       true
       
  1073                     )
       
  1074                     #name: 'alignTopLeft'
       
  1075                     #layout: #(#LayoutFrame 190 0 14 0 204 0 28 0)
       
  1076                     #activeHelpKey: #alignTopLeft
       
  1077                     #tabable: true
       
  1078                     #model: #alignTopLeft
       
  1079                   )
       
  1080                  #(#ActionButtonSpec
       
  1081                     #attributes: 
       
  1082                    #(#tabable
       
  1083                       true
       
  1084                     )
       
  1085                     #name: 'alignTopCenter'
       
  1086                     #layout: #(#LayoutFrame 217 0 14 0 231 0 28 0)
       
  1087                     #activeHelpKey: #alignTopCenter
       
  1088                     #tabable: true
       
  1089                     #model: #alignTopCenter
       
  1090                   )
       
  1091                  #(#ActionButtonSpec
       
  1092                     #attributes: 
       
  1093                    #(#tabable
       
  1094                       true
       
  1095                     )
       
  1096                     #name: 'alignTopRight'
       
  1097                     #layout: #(#LayoutFrame 245 0 14 0 259 0 28 0)
       
  1098                     #activeHelpKey: #alignTopRight
       
  1099                     #tabable: true
       
  1100                     #model: #alignTopRight
       
  1101                   )
       
  1102                  #(#ActionButtonSpec
       
  1103                     #attributes: 
       
  1104                    #(#tabable
       
  1105                       true
       
  1106                     )
       
  1107                     #name: 'alignLeftCenter'
       
  1108                     #layout: #(#LayoutFrame 190 0 32 0 204 0 46 0)
       
  1109                     #activeHelpKey: #alignLeftCenter
       
  1110                     #tabable: true
       
  1111                     #model: #alignLeftCenter
       
  1112                   )
       
  1113                  #(#ActionButtonSpec
       
  1114                     #attributes: 
       
  1115                    #(#tabable
       
  1116                       true
       
  1117                     )
       
  1118                     #name: 'alignCenter'
       
  1119                     #layout: #(#LayoutFrame 217 0 32 0 231 0 46 0)
       
  1120                     #activeHelpKey: #alignCenter
       
  1121                     #tabable: true
       
  1122                     #model: #alignCenter
       
  1123                   )
       
  1124                  #(#ActionButtonSpec
       
  1125                     #attributes: 
       
  1126                    #(#tabable
       
  1127                       true
       
  1128                     )
       
  1129                     #name: 'alignRightCenter'
       
  1130                     #layout: #(#LayoutFrame 245 0 32 0 259 0 46 0)
       
  1131                     #activeHelpKey: #alignRightCenter
       
  1132                     #tabable: true
       
  1133                     #model: #alignRightCenter
       
  1134                   )
       
  1135                  #(#ActionButtonSpec
       
  1136                     #attributes: 
       
  1137                    #(#tabable
       
  1138                       true
       
  1139                     )
       
  1140                     #name: 'alignBottomLeft'
       
  1141                     #layout: #(#LayoutFrame 190 0 50 0 204 0 64 0)
       
  1142                     #activeHelpKey: #alignBottomLeft
       
  1143                     #tabable: true
       
  1144                     #model: #alignBottomLeft
       
  1145                   )
       
  1146                  #(#ActionButtonSpec
       
  1147                     #attributes: 
       
  1148                    #(#tabable
       
  1149                       true
       
  1150                     )
       
  1151                     #name: 'alignBottomCenter'
       
  1152                     #layout: #(#LayoutFrame 217 0 50 0 231 0 64 0)
       
  1153                     #activeHelpKey: #alignBottomCenter
       
  1154                     #tabable: true
       
  1155                     #model: #alignBottomCenter
       
  1156                   )
       
  1157                  #(#ActionButtonSpec
       
  1158                     #attributes: 
       
  1159                    #(#tabable
       
  1160                       true
       
  1161                     )
       
  1162                     #name: 'alignBottomRight'
       
  1163                     #layout: #(#LayoutFrame 245 0 50 0 259 0 64 0)
       
  1164                     #activeHelpKey: #alignBottomRight
       
  1165                     #tabable: true
       
  1166                     #model: #alignBottomRight
       
  1167                   )
       
  1168                  )
       
  1169                
       
  1170               )
       
  1171             )
       
  1172            )
       
  1173          
       
  1174         )
       
  1175       )
       
  1176 ! !
       
  1177 
       
  1178 !UILayoutTool::AlignmentOrigin methodsFor:'accessing'!
       
  1179 
       
  1180 fetch:aView spec:aSpec
       
  1181     "fetch alignmentOrigin
       
  1182     "
       
  1183     |layout type 
       
  1184      leftAlignmentFractionHolder topAlignmentFractionHolder
       
  1185      leftOffsetHolder leftFractionHolder topOffsetHolder topFractionHolder|
       
  1186 
       
  1187     type   := UIPainterView layoutType:aView.
       
  1188     layout := aView geometryLayout.
       
  1189 
       
  1190     leftOffsetHolder := (self aspectFor:#leftOffset).
       
  1191     leftFractionHolder := (self aspectFor:#leftFraction).
       
  1192     topOffsetHolder := (self aspectFor:#topOffset).
       
  1193     topFractionHolder := (self aspectFor:#topFraction).
       
  1194     leftAlignmentFractionHolder := (self aspectFor:#leftAlignmentFraction).
       
  1195     topAlignmentFractionHolder := (self aspectFor:#topAlignmentFraction).
       
  1196 
       
  1197     layout isLayout ifTrue:[
       
  1198         leftOffsetHolder   value:(layout leftOffset).
       
  1199         leftFractionHolder value:(layout leftFraction).
       
  1200         topOffsetHolder    value:(layout topOffset).
       
  1201         topFractionHolder  value:(layout topFraction).
       
  1202 
       
  1203         type == #AlignmentOrigin ifTrue:[
       
  1204             leftAlignmentFractionHolder value:(layout leftAlignmentFraction).
       
  1205             topAlignmentFractionHolder  value:(layout topAlignmentFraction).
       
  1206           ^ self
       
  1207         ]
       
  1208     ] ifFalse:[
       
  1209         layout := aView computeOrigin.
       
  1210 
       
  1211         leftOffsetHolder   value:(layout x).
       
  1212         leftFractionHolder value:0.
       
  1213         topOffsetHolder    value:(layout y).
       
  1214         topFractionHolder  value:0.
       
  1215     ].
       
  1216     leftAlignmentFractionHolder value:0.
       
  1217     topAlignmentFractionHolder  value:0.
       
  1218 
       
  1219 
       
  1220 !
       
  1221 
       
  1222 layout
       
  1223     "returns current layout as alignmentOrigin
       
  1224     "
       
  1225     |layout|
       
  1226 
       
  1227     layout  := Smalltalk::AlignmentOrigin new.
       
  1228 
       
  1229     layout   leftOffset:((self aspectFor:#leftOffset)   value) ? 0.
       
  1230     layout    topOffset:((self aspectFor:#topOffset)    value) ? 0.
       
  1231     layout leftFraction:((self aspectFor:#leftFraction) value) ? 0.
       
  1232     layout  topFraction:((self aspectFor:#topFraction)  value) ? 0.
       
  1233 
       
  1234     layout leftAlignmentFraction:((self aspectFor:#leftAlignmentFraction) value) ? 0.
       
  1235     layout  topAlignmentFraction:((self aspectFor:#topAlignmentFraction)  value) ? 0.
       
  1236 
       
  1237   ^ layout
       
  1238 ! !
       
  1239 
       
  1240 !UILayoutTool::AlignmentOrigin methodsFor:'alignment'!
       
  1241 
       
  1242 alignBottomCenter
       
  1243     self makeAlignLeft:0.5 top:1
       
  1244 
       
  1245 
       
  1246 !
       
  1247 
       
  1248 alignBottomLeft
       
  1249     self makeAlignLeft:0 top:1
       
  1250 
       
  1251 
       
  1252 !
       
  1253 
       
  1254 alignBottomRight
       
  1255     self makeAlignLeft:1 top:1
       
  1256 
       
  1257 
       
  1258 !
       
  1259 
       
  1260 alignCenter
       
  1261     self makeAlignLeft:0.5 top:0.5
       
  1262 
       
  1263 
       
  1264 !
       
  1265 
       
  1266 alignLeftCenter
       
  1267     self makeAlignLeft:0 top:0.5
       
  1268 
       
  1269 
       
  1270 !
       
  1271 
       
  1272 alignRightCenter
       
  1273     self makeAlignLeft:1 top:0.5
       
  1274 
       
  1275 
       
  1276 !
       
  1277 
       
  1278 alignTopCenter
       
  1279     self makeAlignLeft:0.5 top:0
       
  1280 
       
  1281 
       
  1282 !
       
  1283 
       
  1284 alignTopLeft
       
  1285     self makeAlignLeft:0 top:0
       
  1286 
       
  1287 
       
  1288 !
       
  1289 
       
  1290 alignTopRight
       
  1291     self makeAlignLeft:1 top:0
       
  1292 
       
  1293 
       
  1294 !
       
  1295 
       
  1296 makeAlignLeft:leftAlignmentFraction top:topAlignmentFraction
       
  1297     |lAF tAF lO tO ext lAHolder tAHolder lOHolder tOHolder|
       
  1298 
       
  1299     lAF     := (lAHolder := self aspectFor:#leftAlignmentFraction) value ? 0.
       
  1300     tAF     := (tAHolder := self aspectFor:#topAlignmentFraction)  value ? 0.
       
  1301     ext     := (self aspectFor:#layoutView) computeExtent.
       
  1302 
       
  1303     lAHolder value:leftAlignmentFraction.
       
  1304     tAHolder  value:topAlignmentFraction.
       
  1305 
       
  1306     lO := (lOHolder := self aspectFor:#leftOffset) value ? 0.
       
  1307     tO := (tOHolder := self aspectFor:#topOffset)  value ? 0.
       
  1308 
       
  1309     lO := lO + (ext x * (leftAlignmentFraction - lAF)).
       
  1310     tO := tO + (ext y * (topAlignmentFraction  - tAF)).
       
  1311 
       
  1312     lOHolder value:(lO rounded).
       
  1313     tOHolder value:(tO rounded).
       
  1314 
       
  1315 !
       
  1316 
       
  1317 makeAlignTopRight
       
  1318     self makeAlignLeft:1 top:0
       
  1319 
       
  1320 
       
  1321 ! !
       
  1322 
       
  1323 !UILayoutTool::Rectangle class methodsFor:'interface specs'!
       
  1324 
       
  1325 windowSpec
       
  1326     "This resource specification was automatically generated
       
  1327      by the UIPainter of ST/X."
       
  1328 
       
  1329     "Do not manually edit this!! If it is corrupted,
       
  1330      the UIPainter may not be able to read the specification."
       
  1331 
       
  1332     "
       
  1333      UIPainter new openOnClass:UILayoutTool::Rectangle andSelector:#windowSpec
       
  1334      UILayoutTool::Rectangle new openInterface:#windowSpec
       
  1335      UILayoutTool::Rectangle open
       
  1336     "
       
  1337 
       
  1338     <resource: #canvas>
       
  1339 
       
  1340     ^
       
  1341      
       
  1342        #(#FullSpec
       
  1343           #window: 
       
  1344            #(#WindowSpec
       
  1345               #name: 'UILayoutTool-Rectangle'
       
  1346               #layout: #(#LayoutFrame 291 0 130 0 632 0 328 0)
       
  1347               #label: 'UILayoutTool-Rectangle'
       
  1348               #min: #(#Point 10 10)
       
  1349               #max: #(#Point 1152 900)
       
  1350               #bounds: #(#Rectangle 291 130 633 329)
       
  1351               #usePreferredExtent: false
       
  1352           )
       
  1353           #component: 
       
  1354            #(#SpecCollection
       
  1355               #collection: 
       
  1356                #(
       
  1357                  #(#UISubSpecification
       
  1358                     #name: 'subSpecification'
       
  1359                     #layout: #(#LayoutFrame 1 0.0 6 0 0 1.0 96 0)
       
  1360                     #majorKey: #UILayoutTool
       
  1361                     #minorKey: #layoutPointSpec
       
  1362                 )
       
  1363                  #(#FramedBoxSpec
       
  1364                     #name: 'FramedBox'
       
  1365                     #layout: #(#LayoutFrame 1 0.0 99 0 0 1.0 194 0)
       
  1366                     #component: 
       
  1367                      #(#SpecCollection
       
  1368                         #collection: 
       
  1369                          #(
       
  1370                            #(#LabelSpec
       
  1371                               #name: 'labelCornerY'
       
  1372                               #layout: #(#AlignmentOrigin 83 0 16 0 1 0)
       
  1373                               #label: 'Right:'
       
  1374                               #adjust: #left
       
  1375                           )
       
  1376                            #(#InputFieldSpec
       
  1377                               #name: 'fieldCornerX'
       
  1378                               #layout: #(#LayoutFrame 85 0 13 0 135 0 35 0)
       
  1379                               #activeHelpKey: #cornerX
       
  1380                               #tabable: true
       
  1381                               #model: #rightOffset
       
  1382                               #group: #inputGroup
       
  1383                               #type: #numberOrNil
       
  1384                               #acceptOnLostFocus: true
       
  1385                     #acceptChannel: #acceptChannel
       
  1386                     #modifiedChannel: #modifiedChannel
       
  1387                           )
       
  1388                            #(#LabelSpec
       
  1389                               #name: 'labelCornerX'
       
  1390                               #layout: #(#AlignmentOrigin 83 0 41 0 1 0)
       
  1391                               #label: 'Bottom:'
       
  1392                               #adjust: #left
       
  1393                           )
       
  1394                            #(#InputFieldSpec
       
  1395                               #name: 'fieldCornerY'
       
  1396                               #layout: #(#LayoutFrame 85 0 38 0 135 0 60 0)
       
  1397                               #activeHelpKey: #cornerY
       
  1398                               #tabable: true
       
  1399                               #model: #bottomOffset
       
  1400                               #group: #inputGroup
       
  1401                               #type: #numberOrNil
       
  1402                               #acceptOnLostFocus: true
       
  1403                     #acceptChannel: #acceptChannel
       
  1404                     #modifiedChannel: #modifiedChannel
       
  1405                           )
       
  1406                         )
       
  1407                     )
       
  1408                     #label: 'Corner'
       
  1409                     #labelPosition: #topLeft
       
  1410                 )
       
  1411               )
       
  1412           )
       
  1413       )
       
  1414 
       
  1415     "Modified: / 13.8.1998 / 19:59:16 / cg"
       
  1416 ! !
       
  1417 
       
  1418 !UILayoutTool::Rectangle methodsFor:'accessing'!
       
  1419 
       
  1420 fetch:aView spec:aSpec
       
  1421     "fetch rectangle
       
  1422     "
       
  1423     |origin corner|
       
  1424 
       
  1425     origin := aView computeOrigin.
       
  1426     corner := aView computeCorner.
       
  1427 
       
  1428     (self aspectFor:#leftOffset)   value:(origin x).
       
  1429     (self aspectFor:#rightOffset)  value:(corner x).
       
  1430     (self aspectFor:#topOffset)    value:(origin y).
       
  1431     (self aspectFor:#bottomOffset) value:(corner y).
       
  1432 
       
  1433 
       
  1434 !
       
  1435 
       
  1436 layout
       
  1437     "returns current layout as rectangle
       
  1438     "
       
  1439   ^ Smalltalk::Rectangle left:(((self aspectFor:#leftOffset)   value) ? 0)
       
  1440                           top:(((self aspectFor:#topOffset)    value) ? 0)
       
  1441                         right:(((self aspectFor:#rightOffset)  value) ? 0)
       
  1442                        bottom:(((self aspectFor:#bottomOffset) value) ? 0)
       
  1443 
       
  1444 
       
  1445 ! !
       
  1446 
       
  1447 !UILayoutTool::Point class methodsFor:'interface specs'!
       
  1448 
       
  1449 windowSpec
       
  1450     "This resource specification was automatically generated
       
  1451      by the UIPainter of ST/X."
       
  1452 
       
  1453     "Do not manually edit this!! If it is corrupted,
       
  1454      the UIPainter may not be able to read the specification."
       
  1455 
       
  1456     "
       
  1457      UIPainter new openOnClass:UILayoutTool::Point andSelector:#windowSpec
       
  1458      UILayoutTool::Point new openInterface:#windowSpec
       
  1459      UILayoutTool::Point open
       
  1460     "
       
  1461 
       
  1462     <resource: #canvas>
       
  1463 
       
  1464     ^
       
  1465      
       
  1466        #(#FullSpec
       
  1467           #window: 
       
  1468            #(#WindowSpec
       
  1469               #name: 'UILayoutTool-Point'
       
  1470               #layout: #(#LayoutFrame 324 0 410 0 618 0 547 0)
       
  1471               #label: 'UILayoutTool-Point'
       
  1472               #min: #(#Point 10 10)
       
  1473               #max: #(#Point 1152 900)
       
  1474               #bounds: #(#Rectangle 324 410 619 548)
       
  1475               #usePreferredExtent: false
       
  1476           )
       
  1477           #component: 
       
  1478            #(#SpecCollection
       
  1479               #collection: 
       
  1480                #(
       
  1481                  #(#UISubSpecification
       
  1482                     #name: 'layoutPointSpec'
       
  1483                     #layout: #(#LayoutFrame 1 0.0 6 0 0 1.0 100 0)
       
  1484                     #majorKey: #UILayoutTool
       
  1485                     #minorKey: #layoutPointSpec
       
  1486                 )
       
  1487               )
       
  1488           )
       
  1489       )
       
  1490 ! !
       
  1491 
       
  1492 !UILayoutTool::Point methodsFor:'accessing'!
       
  1493 
       
  1494 fetch:aView spec:aSpec
       
  1495     "fetch point
       
  1496     "
       
  1497     |origin|
       
  1498 
       
  1499     origin  := aView computeOrigin.
       
  1500 
       
  1501     (self aspectFor:#leftOffset) value:(origin x).
       
  1502     (self aspectFor:#topOffset)  value:(origin y).
       
  1503 
       
  1504 
       
  1505 !
       
  1506 
       
  1507 layout
       
  1508     "returns current layout as point
       
  1509     "
       
  1510   ^ Smalltalk::Point x:(((self aspectFor:#leftOffset) value) ? 0)
       
  1511                      y:(((self aspectFor:#topOffset)  value) ? 0)
       
  1512 
       
  1513 ! !
   832 ! !
  1514 
   833 
  1515 !UILayoutTool::LayoutFrame class methodsFor:'help specs'!
   834 !UILayoutTool::LayoutFrame class methodsFor:'help specs'!
  1516 
   835 
  1517 helpSpec
   836 helpSpec
  2209         right:1          offset:0 
  1528         right:1          offset:0 
  2210         top:0            offset:0 
  1529         top:0            offset:0 
  2211         bottom:0.5       offset:0
  1530         bottom:0.5       offset:0
  2212 ! !
  1531 ! !
  2213 
  1532 
       
  1533 !UILayoutTool::Rectangle class methodsFor:'interface specs'!
       
  1534 
       
  1535 windowSpec
       
  1536     "This resource specification was automatically generated
       
  1537      by the UIPainter of ST/X."
       
  1538 
       
  1539     "Do not manually edit this!! If it is corrupted,
       
  1540      the UIPainter may not be able to read the specification."
       
  1541 
       
  1542     "
       
  1543      UIPainter new openOnClass:UILayoutTool::Rectangle andSelector:#windowSpec
       
  1544      UILayoutTool::Rectangle new openInterface:#windowSpec
       
  1545      UILayoutTool::Rectangle open
       
  1546     "
       
  1547 
       
  1548     <resource: #canvas>
       
  1549 
       
  1550     ^
       
  1551      
       
  1552        #(#FullSpec
       
  1553           #window: 
       
  1554            #(#WindowSpec
       
  1555               #name: 'UILayoutTool-Rectangle'
       
  1556               #layout: #(#LayoutFrame 291 0 130 0 632 0 328 0)
       
  1557               #label: 'UILayoutTool-Rectangle'
       
  1558               #min: #(#Point 10 10)
       
  1559               #max: #(#Point 1152 900)
       
  1560               #bounds: #(#Rectangle 291 130 633 329)
       
  1561               #usePreferredExtent: false
       
  1562           )
       
  1563           #component: 
       
  1564            #(#SpecCollection
       
  1565               #collection: 
       
  1566                #(
       
  1567                  #(#UISubSpecification
       
  1568                     #name: 'subSpecification'
       
  1569                     #layout: #(#LayoutFrame 1 0.0 6 0 0 1.0 96 0)
       
  1570                     #majorKey: #UILayoutTool
       
  1571                     #minorKey: #layoutPointSpec
       
  1572                 )
       
  1573                  #(#FramedBoxSpec
       
  1574                     #name: 'FramedBox'
       
  1575                     #layout: #(#LayoutFrame 1 0.0 99 0 0 1.0 194 0)
       
  1576                     #component: 
       
  1577                      #(#SpecCollection
       
  1578                         #collection: 
       
  1579                          #(
       
  1580                            #(#LabelSpec
       
  1581                               #name: 'labelCornerY'
       
  1582                               #layout: #(#AlignmentOrigin 83 0 16 0 1 0)
       
  1583                               #label: 'Right:'
       
  1584                               #adjust: #left
       
  1585                           )
       
  1586                            #(#InputFieldSpec
       
  1587                               #name: 'fieldCornerX'
       
  1588                               #layout: #(#LayoutFrame 85 0 13 0 135 0 35 0)
       
  1589                               #activeHelpKey: #cornerX
       
  1590                               #tabable: true
       
  1591                               #model: #rightOffset
       
  1592                               #group: #inputGroup
       
  1593                               #type: #numberOrNil
       
  1594                               #acceptOnLostFocus: true
       
  1595                     #acceptChannel: #acceptChannel
       
  1596                     #modifiedChannel: #modifiedChannel
       
  1597                           )
       
  1598                            #(#LabelSpec
       
  1599                               #name: 'labelCornerX'
       
  1600                               #layout: #(#AlignmentOrigin 83 0 41 0 1 0)
       
  1601                               #label: 'Bottom:'
       
  1602                               #adjust: #left
       
  1603                           )
       
  1604                            #(#InputFieldSpec
       
  1605                               #name: 'fieldCornerY'
       
  1606                               #layout: #(#LayoutFrame 85 0 38 0 135 0 60 0)
       
  1607                               #activeHelpKey: #cornerY
       
  1608                               #tabable: true
       
  1609                               #model: #bottomOffset
       
  1610                               #group: #inputGroup
       
  1611                               #type: #numberOrNil
       
  1612                               #acceptOnLostFocus: true
       
  1613                     #acceptChannel: #acceptChannel
       
  1614                     #modifiedChannel: #modifiedChannel
       
  1615                           )
       
  1616                         )
       
  1617                     )
       
  1618                     #label: 'Corner'
       
  1619                     #labelPosition: #topLeft
       
  1620                 )
       
  1621               )
       
  1622           )
       
  1623       )
       
  1624 
       
  1625     "Modified: / 13.8.1998 / 19:59:16 / cg"
       
  1626 ! !
       
  1627 
       
  1628 !UILayoutTool::Rectangle methodsFor:'accessing'!
       
  1629 
       
  1630 fetch:aView spec:aSpec
       
  1631     "fetch rectangle
       
  1632     "
       
  1633     |origin corner|
       
  1634 
       
  1635     origin := aView computeOrigin.
       
  1636     corner := aView computeCorner.
       
  1637 
       
  1638     (self aspectFor:#leftOffset)   value:(origin x).
       
  1639     (self aspectFor:#rightOffset)  value:(corner x).
       
  1640     (self aspectFor:#topOffset)    value:(origin y).
       
  1641     (self aspectFor:#bottomOffset) value:(corner y).
       
  1642 
       
  1643 
       
  1644 !
       
  1645 
       
  1646 layout
       
  1647     "returns current layout as rectangle
       
  1648     "
       
  1649   ^ Smalltalk::Rectangle left:(((self aspectFor:#leftOffset)   value) ? 0)
       
  1650                           top:(((self aspectFor:#topOffset)    value) ? 0)
       
  1651                         right:(((self aspectFor:#rightOffset)  value) ? 0)
       
  1652                        bottom:(((self aspectFor:#bottomOffset) value) ? 0)
       
  1653 
       
  1654 
       
  1655 ! !
       
  1656 
       
  1657 !UILayoutTool::AlignmentOrigin class methodsFor:'help specs'!
       
  1658 
       
  1659 helpSpec
       
  1660     "This resource specification was automatically generated
       
  1661      by the UIHelpTool of ST/X."
       
  1662 
       
  1663     "Do not manually edit this!! If it is corrupted,
       
  1664      the UIHelpTool may not be able to read the specification."
       
  1665 
       
  1666     "
       
  1667      UIHelpTool openOnClass:UILayoutTool::AlignmentOrigin    
       
  1668     "
       
  1669 
       
  1670     <resource: #help>
       
  1671 
       
  1672     ^super helpSpec addPairsFrom:#(
       
  1673 
       
  1674 #alignBottomCenter
       
  1675 'Aligns the selected widget bottomCenter to location.'
       
  1676 
       
  1677 #alignBottomLeft
       
  1678 'Aligns the selected widget bottomLeft to location.'
       
  1679 
       
  1680 #alignBottomRight
       
  1681 'Aligns the selected widget bottomRight to location.'
       
  1682 
       
  1683 #alignCenter
       
  1684 'Aligns the selected widget center to location.'
       
  1685 
       
  1686 #alignHorizontal
       
  1687 'Horizontal inset to the location point of the selected widget.'
       
  1688 
       
  1689 #alignLeftCenter
       
  1690 'Aligns the selected widget leftCenter to location.'
       
  1691 
       
  1692 #alignRightCenter
       
  1693 'Aligns the selected widget rightCenter to location.'
       
  1694 
       
  1695 #alignTopCenter
       
  1696 'Aligns the selected widget topCenter to location.'
       
  1697 
       
  1698 #alignTopLeft
       
  1699 'Aligns the selected widget topLeft to location.'
       
  1700 
       
  1701 #alignTopRight
       
  1702 'Aligns the selected widget topRight to location.'
       
  1703 
       
  1704 #alignVertical
       
  1705 'Vertical inset to the location point of the widget.'
       
  1706 
       
  1707 )
       
  1708 ! !
       
  1709 
       
  1710 !UILayoutTool::AlignmentOrigin class methodsFor:'interface specs'!
       
  1711 
       
  1712 windowSpec
       
  1713     "This resource specification was automatically generated
       
  1714      by the UIPainter of ST/X."
       
  1715 
       
  1716     "Do not manually edit this!! If it is corrupted,
       
  1717      the UIPainter may not be able to read the specification."
       
  1718 
       
  1719     "
       
  1720      UIPainter new openOnClass:UILayoutTool::AlignmentOrigin andSelector:#windowSpec
       
  1721      UILayoutTool::AlignmentOrigin new openInterface:#windowSpec
       
  1722      UILayoutTool::AlignmentOrigin open
       
  1723     "
       
  1724 
       
  1725     <resource: #canvas>
       
  1726 
       
  1727     ^ 
       
  1728      #(#FullSpec
       
  1729         #name: #windowSpec
       
  1730         #window: 
       
  1731        #(#WindowSpec
       
  1732           #label: 'UILayoutTool-AlignmentOrigin'
       
  1733           #name: 'UILayoutTool-AlignmentOrigin'
       
  1734           #min: #(#Point 10 10)
       
  1735           #max: #(#Point 1152 900)
       
  1736           #bounds: #(#Rectangle 42 231 447 438)
       
  1737         )
       
  1738         #component: 
       
  1739        #(#SpecCollection
       
  1740           #collection: #(
       
  1741            #(#UISubSpecification
       
  1742               #name: 'layoutOriginSpec'
       
  1743               #layout: #(#LayoutFrame 1 0.0 6 0 0 1.0 111 0)
       
  1744               #majorKey: #UILayoutTool
       
  1745               #minorKey: #layoutOriginSpec
       
  1746             )
       
  1747            #(#FramedBoxSpec
       
  1748               #label: 'Alignment'
       
  1749               #name: 'FramedBox'
       
  1750               #layout: #(#LayoutFrame 1 0.0 113 0 0 1.0 208 0)
       
  1751               #labelPosition: #topLeft
       
  1752               #component: 
       
  1753              #(#SpecCollection
       
  1754                 #collection: #(
       
  1755                  #(#LabelSpec
       
  1756                     #label: 'Horizontal:'
       
  1757                     #name: 'alignHLabel'
       
  1758                     #layout: #(#AlignmentOrigin 88 0 17 0 1 0)
       
  1759                     #adjust: #right
       
  1760                   )
       
  1761                  #(#InputFieldSpec
       
  1762                     #attributes: 
       
  1763                    #(#tabable
       
  1764                       true
       
  1765                     )
       
  1766                     #name: 'leftAlignmentFractionField'
       
  1767                     #layout: #(#LayoutFrame 90 0 14 0 147 0 36 0)
       
  1768                     #activeHelpKey: #alignHorizontal
       
  1769                     #tabable: true
       
  1770                     #model: #leftAlignmentFraction
       
  1771                     #group: #inputGroup
       
  1772                     #type: #numberOrNil
       
  1773                     #acceptOnLostFocus: true
       
  1774                     #acceptChannel: #acceptChannel
       
  1775                     #modifiedChannel: #modifiedChannel
       
  1776                     #acceptOnPointerLeave: false
       
  1777                   )
       
  1778                  #(#LabelSpec
       
  1779                     #label: 'Vertical:'
       
  1780                     #name: 'alignVLabel'
       
  1781                     #layout: #(#AlignmentOrigin 88 0 43 0 1 0)
       
  1782                     #adjust: #right
       
  1783                   )
       
  1784                  #(#InputFieldSpec
       
  1785                     #attributes: 
       
  1786                    #(#tabable
       
  1787                       true
       
  1788                     )
       
  1789                     #name: 'topAlignmentFractionField'
       
  1790                     #layout: #(#LayoutFrame 90 0 40 0 147 0 62 0)
       
  1791                     #activeHelpKey: #alignVertical
       
  1792                     #tabable: true
       
  1793                     #model: #topAlignmentFraction
       
  1794                     #group: #inputGroup
       
  1795                     #type: #numberOrNil
       
  1796                     #acceptOnLostFocus: true
       
  1797                     #acceptChannel: #acceptChannel
       
  1798                     #modifiedChannel: #modifiedChannel
       
  1799                     #acceptOnPointerLeave: false
       
  1800                   )
       
  1801                  #(#DividerSpec
       
  1802                     #name: 'separator1'
       
  1803                     #layout: #(#LayoutFrame 204 0 19 0 245 0 22 0)
       
  1804                   )
       
  1805                  #(#DividerSpec
       
  1806                     #name: 'separator2'
       
  1807                     #layout: #(#LayoutFrame 204 0 55 0 245 0 58 0)
       
  1808                   )
       
  1809                  #(#DividerSpec
       
  1810                     #name: 'separator3'
       
  1811                     #layout: #(#LayoutFrame 196 0 28 0 199 0 50 0)
       
  1812                     #orientation: #vertical
       
  1813                   )
       
  1814                  #(#DividerSpec
       
  1815                     #name: 'separator4'
       
  1816                     #layout: #(#LayoutFrame 250 0 28 0 253 0 50 0)
       
  1817                     #orientation: #vertical
       
  1818                   )
       
  1819                  #(#ActionButtonSpec
       
  1820                     #attributes: 
       
  1821                    #(#tabable
       
  1822                       true
       
  1823                     )
       
  1824                     #name: 'alignTopLeft'
       
  1825                     #layout: #(#LayoutFrame 190 0 14 0 204 0 28 0)
       
  1826                     #activeHelpKey: #alignTopLeft
       
  1827                     #tabable: true
       
  1828                     #model: #alignTopLeft
       
  1829                   )
       
  1830                  #(#ActionButtonSpec
       
  1831                     #attributes: 
       
  1832                    #(#tabable
       
  1833                       true
       
  1834                     )
       
  1835                     #name: 'alignTopCenter'
       
  1836                     #layout: #(#LayoutFrame 217 0 14 0 231 0 28 0)
       
  1837                     #activeHelpKey: #alignTopCenter
       
  1838                     #tabable: true
       
  1839                     #model: #alignTopCenter
       
  1840                   )
       
  1841                  #(#ActionButtonSpec
       
  1842                     #attributes: 
       
  1843                    #(#tabable
       
  1844                       true
       
  1845                     )
       
  1846                     #name: 'alignTopRight'
       
  1847                     #layout: #(#LayoutFrame 245 0 14 0 259 0 28 0)
       
  1848                     #activeHelpKey: #alignTopRight
       
  1849                     #tabable: true
       
  1850                     #model: #alignTopRight
       
  1851                   )
       
  1852                  #(#ActionButtonSpec
       
  1853                     #attributes: 
       
  1854                    #(#tabable
       
  1855                       true
       
  1856                     )
       
  1857                     #name: 'alignLeftCenter'
       
  1858                     #layout: #(#LayoutFrame 190 0 32 0 204 0 46 0)
       
  1859                     #activeHelpKey: #alignLeftCenter
       
  1860                     #tabable: true
       
  1861                     #model: #alignLeftCenter
       
  1862                   )
       
  1863                  #(#ActionButtonSpec
       
  1864                     #attributes: 
       
  1865                    #(#tabable
       
  1866                       true
       
  1867                     )
       
  1868                     #name: 'alignCenter'
       
  1869                     #layout: #(#LayoutFrame 217 0 32 0 231 0 46 0)
       
  1870                     #activeHelpKey: #alignCenter
       
  1871                     #tabable: true
       
  1872                     #model: #alignCenter
       
  1873                   )
       
  1874                  #(#ActionButtonSpec
       
  1875                     #attributes: 
       
  1876                    #(#tabable
       
  1877                       true
       
  1878                     )
       
  1879                     #name: 'alignRightCenter'
       
  1880                     #layout: #(#LayoutFrame 245 0 32 0 259 0 46 0)
       
  1881                     #activeHelpKey: #alignRightCenter
       
  1882                     #tabable: true
       
  1883                     #model: #alignRightCenter
       
  1884                   )
       
  1885                  #(#ActionButtonSpec
       
  1886                     #attributes: 
       
  1887                    #(#tabable
       
  1888                       true
       
  1889                     )
       
  1890                     #name: 'alignBottomLeft'
       
  1891                     #layout: #(#LayoutFrame 190 0 50 0 204 0 64 0)
       
  1892                     #activeHelpKey: #alignBottomLeft
       
  1893                     #tabable: true
       
  1894                     #model: #alignBottomLeft
       
  1895                   )
       
  1896                  #(#ActionButtonSpec
       
  1897                     #attributes: 
       
  1898                    #(#tabable
       
  1899                       true
       
  1900                     )
       
  1901                     #name: 'alignBottomCenter'
       
  1902                     #layout: #(#LayoutFrame 217 0 50 0 231 0 64 0)
       
  1903                     #activeHelpKey: #alignBottomCenter
       
  1904                     #tabable: true
       
  1905                     #model: #alignBottomCenter
       
  1906                   )
       
  1907                  #(#ActionButtonSpec
       
  1908                     #attributes: 
       
  1909                    #(#tabable
       
  1910                       true
       
  1911                     )
       
  1912                     #name: 'alignBottomRight'
       
  1913                     #layout: #(#LayoutFrame 245 0 50 0 259 0 64 0)
       
  1914                     #activeHelpKey: #alignBottomRight
       
  1915                     #tabable: true
       
  1916                     #model: #alignBottomRight
       
  1917                   )
       
  1918                  )
       
  1919                
       
  1920               )
       
  1921             )
       
  1922            )
       
  1923          
       
  1924         )
       
  1925       )
       
  1926 ! !
       
  1927 
       
  1928 !UILayoutTool::AlignmentOrigin methodsFor:'accessing'!
       
  1929 
       
  1930 fetch:aView spec:aSpec
       
  1931     "fetch alignmentOrigin
       
  1932     "
       
  1933     |layout type 
       
  1934      leftAlignmentFractionHolder topAlignmentFractionHolder
       
  1935      leftOffsetHolder leftFractionHolder topOffsetHolder topFractionHolder|
       
  1936 
       
  1937     type   := UIPainterView layoutType:aView.
       
  1938     layout := aView geometryLayout.
       
  1939 
       
  1940     leftOffsetHolder := (self aspectFor:#leftOffset).
       
  1941     leftFractionHolder := (self aspectFor:#leftFraction).
       
  1942     topOffsetHolder := (self aspectFor:#topOffset).
       
  1943     topFractionHolder := (self aspectFor:#topFraction).
       
  1944     leftAlignmentFractionHolder := (self aspectFor:#leftAlignmentFraction).
       
  1945     topAlignmentFractionHolder := (self aspectFor:#topAlignmentFraction).
       
  1946 
       
  1947     layout isLayout ifTrue:[
       
  1948         leftOffsetHolder   value:(layout leftOffset).
       
  1949         leftFractionHolder value:(layout leftFraction).
       
  1950         topOffsetHolder    value:(layout topOffset).
       
  1951         topFractionHolder  value:(layout topFraction).
       
  1952 
       
  1953         type == #AlignmentOrigin ifTrue:[
       
  1954             leftAlignmentFractionHolder value:(layout leftAlignmentFraction).
       
  1955             topAlignmentFractionHolder  value:(layout topAlignmentFraction).
       
  1956           ^ self
       
  1957         ]
       
  1958     ] ifFalse:[
       
  1959         layout := aView computeOrigin.
       
  1960 
       
  1961         leftOffsetHolder   value:(layout x).
       
  1962         leftFractionHolder value:0.
       
  1963         topOffsetHolder    value:(layout y).
       
  1964         topFractionHolder  value:0.
       
  1965     ].
       
  1966     leftAlignmentFractionHolder value:0.
       
  1967     topAlignmentFractionHolder  value:0.
       
  1968 
       
  1969 
       
  1970 !
       
  1971 
       
  1972 layout
       
  1973     "returns current layout as alignmentOrigin
       
  1974     "
       
  1975     |layout|
       
  1976 
       
  1977     layout  := Smalltalk::AlignmentOrigin new.
       
  1978 
       
  1979     layout   leftOffset:((self aspectFor:#leftOffset)   value) ? 0.
       
  1980     layout    topOffset:((self aspectFor:#topOffset)    value) ? 0.
       
  1981     layout leftFraction:((self aspectFor:#leftFraction) value) ? 0.
       
  1982     layout  topFraction:((self aspectFor:#topFraction)  value) ? 0.
       
  1983 
       
  1984     layout leftAlignmentFraction:((self aspectFor:#leftAlignmentFraction) value) ? 0.
       
  1985     layout  topAlignmentFraction:((self aspectFor:#topAlignmentFraction)  value) ? 0.
       
  1986 
       
  1987   ^ layout
       
  1988 ! !
       
  1989 
       
  1990 !UILayoutTool::AlignmentOrigin methodsFor:'alignment'!
       
  1991 
       
  1992 alignBottomCenter
       
  1993     self makeAlignLeft:0.5 top:1
       
  1994 
       
  1995 
       
  1996 !
       
  1997 
       
  1998 alignBottomLeft
       
  1999     self makeAlignLeft:0 top:1
       
  2000 
       
  2001 
       
  2002 !
       
  2003 
       
  2004 alignBottomRight
       
  2005     self makeAlignLeft:1 top:1
       
  2006 
       
  2007 
       
  2008 !
       
  2009 
       
  2010 alignCenter
       
  2011     self makeAlignLeft:0.5 top:0.5
       
  2012 
       
  2013 
       
  2014 !
       
  2015 
       
  2016 alignLeftCenter
       
  2017     self makeAlignLeft:0 top:0.5
       
  2018 
       
  2019 
       
  2020 !
       
  2021 
       
  2022 alignRightCenter
       
  2023     self makeAlignLeft:1 top:0.5
       
  2024 
       
  2025 
       
  2026 !
       
  2027 
       
  2028 alignTopCenter
       
  2029     self makeAlignLeft:0.5 top:0
       
  2030 
       
  2031 
       
  2032 !
       
  2033 
       
  2034 alignTopLeft
       
  2035     self makeAlignLeft:0 top:0
       
  2036 
       
  2037 
       
  2038 !
       
  2039 
       
  2040 alignTopRight
       
  2041     self makeAlignLeft:1 top:0
       
  2042 
       
  2043 
       
  2044 !
       
  2045 
       
  2046 makeAlignLeft:leftAlignmentFraction top:topAlignmentFraction
       
  2047     |lAF tAF lO tO ext lAHolder tAHolder lOHolder tOHolder|
       
  2048 
       
  2049     lAF     := (lAHolder := self aspectFor:#leftAlignmentFraction) value ? 0.
       
  2050     tAF     := (tAHolder := self aspectFor:#topAlignmentFraction)  value ? 0.
       
  2051     ext     := (self aspectFor:#layoutView) computeExtent.
       
  2052 
       
  2053     lAHolder value:leftAlignmentFraction.
       
  2054     tAHolder  value:topAlignmentFraction.
       
  2055 
       
  2056     lO := (lOHolder := self aspectFor:#leftOffset) value ? 0.
       
  2057     tO := (tOHolder := self aspectFor:#topOffset)  value ? 0.
       
  2058 
       
  2059     lO := lO + (ext x * (leftAlignmentFraction - lAF)).
       
  2060     tO := tO + (ext y * (topAlignmentFraction  - tAF)).
       
  2061 
       
  2062     lOHolder value:(lO rounded).
       
  2063     tOHolder value:(tO rounded).
       
  2064 
       
  2065 !
       
  2066 
       
  2067 makeAlignTopRight
       
  2068     self makeAlignLeft:1 top:0
       
  2069 
       
  2070 
       
  2071 ! !
       
  2072 
       
  2073 !UILayoutTool::LayoutOrigin class methodsFor:'interface specs'!
       
  2074 
       
  2075 windowSpec
       
  2076     "This resource specification was automatically generated
       
  2077      by the UIPainter of ST/X."
       
  2078 
       
  2079     "Do not manually edit this!! If it is corrupted,
       
  2080      the UIPainter may not be able to read the specification."
       
  2081 
       
  2082     "
       
  2083      UIPainter new openOnClass:UILayoutTool::LayoutOrigin andSelector:#windowSpec
       
  2084      UILayoutTool::LayoutOrigin new openInterface:#windowSpec
       
  2085      UILayoutTool::LayoutOrigin open
       
  2086     "
       
  2087 
       
  2088     <resource: #canvas>
       
  2089 
       
  2090     ^
       
  2091      
       
  2092        #(#FullSpec
       
  2093           #window: 
       
  2094            #(#WindowSpec
       
  2095               #name: 'UILayoutTool-LayoutOrigin'
       
  2096               #layout: #(#LayoutFrame 290 0 420 0 647 0 565 0)
       
  2097               #label: 'UILayoutTool-LayoutOrigin'
       
  2098               #min: #(#Point 10 10)
       
  2099               #max: #(#Point 1152 900)
       
  2100               #bounds: #(#Rectangle 290 420 648 566)
       
  2101               #usePreferredExtent: false
       
  2102           )
       
  2103           #component: 
       
  2104            #(#SpecCollection
       
  2105               #collection: 
       
  2106                #(
       
  2107                  #(#UISubSpecification
       
  2108                     #name: 'layoutOriginSpec'
       
  2109                     #layout: #(#LayoutFrame 1 0.0 6 0 0 1.0 110 0)
       
  2110                     #majorKey: #UILayoutTool
       
  2111                     #minorKey: #layoutOriginSpec
       
  2112                 )
       
  2113               )
       
  2114           )
       
  2115       )
       
  2116 ! !
       
  2117 
       
  2118 !UILayoutTool::LayoutOrigin methodsFor:'accessing'!
       
  2119 
       
  2120 fetch:aView spec:aSpec
       
  2121     "fetch layoutOrigin
       
  2122     "
       
  2123     |layout|
       
  2124 
       
  2125     layout  := UIPainterView asLayoutFrameFromView:aView.
       
  2126 
       
  2127     (self aspectFor:#leftOffset)   value:(layout leftOffset).
       
  2128     (self aspectFor:#leftFraction) value:(layout leftFraction).
       
  2129     (self aspectFor:#topOffset)    value:(layout topOffset).
       
  2130     (self aspectFor:#topFraction)  value:(layout topFraction).
       
  2131 
       
  2132 
       
  2133 !
       
  2134 
       
  2135 layout
       
  2136     "returns current layout as layoutOrigin
       
  2137     "
       
  2138     |layout|
       
  2139 
       
  2140     layout  := Smalltalk::LayoutOrigin new.
       
  2141 
       
  2142     layout   leftOffset:((self aspectFor:#leftOffset)   value) ? 0.
       
  2143     layout    topOffset:((self aspectFor:#topOffset)    value) ? 0.
       
  2144     layout leftFraction:((self aspectFor:#leftFraction) value) ? 0.
       
  2145     layout  topFraction:((self aspectFor:#topFraction)  value) ? 0.
       
  2146 
       
  2147   ^ layout
       
  2148 
       
  2149 ! !
       
  2150 
  2214 !UILayoutTool::Extent class methodsFor:'help specs'!
  2151 !UILayoutTool::Extent class methodsFor:'help specs'!
  2215 
  2152 
  2216 helpSpec
  2153 helpSpec
  2217     "This resource specification was automatically generated
  2154     "This resource specification was automatically generated
  2218      by the UIHelpTool of ST/X."
  2155      by the UIHelpTool of ST/X."
  2368   ^ Smalltalk::Point x:(((self aspectFor:#leftOffset)   value) ? 0)
  2305   ^ Smalltalk::Point x:(((self aspectFor:#leftOffset)   value) ? 0)
  2369                      y:(((self aspectFor:#rightOffset)  value) ? 0)
  2306                      y:(((self aspectFor:#rightOffset)  value) ? 0)
  2370 
  2307 
  2371 ! !
  2308 ! !
  2372 
  2309 
       
  2310 !UILayoutTool::Point class methodsFor:'interface specs'!
       
  2311 
       
  2312 windowSpec
       
  2313     "This resource specification was automatically generated
       
  2314      by the UIPainter of ST/X."
       
  2315 
       
  2316     "Do not manually edit this!! If it is corrupted,
       
  2317      the UIPainter may not be able to read the specification."
       
  2318 
       
  2319     "
       
  2320      UIPainter new openOnClass:UILayoutTool::Point andSelector:#windowSpec
       
  2321      UILayoutTool::Point new openInterface:#windowSpec
       
  2322      UILayoutTool::Point open
       
  2323     "
       
  2324 
       
  2325     <resource: #canvas>
       
  2326 
       
  2327     ^
       
  2328      
       
  2329        #(#FullSpec
       
  2330           #window: 
       
  2331            #(#WindowSpec
       
  2332               #name: 'UILayoutTool-Point'
       
  2333               #layout: #(#LayoutFrame 324 0 410 0 618 0 547 0)
       
  2334               #label: 'UILayoutTool-Point'
       
  2335               #min: #(#Point 10 10)
       
  2336               #max: #(#Point 1152 900)
       
  2337               #bounds: #(#Rectangle 324 410 619 548)
       
  2338               #usePreferredExtent: false
       
  2339           )
       
  2340           #component: 
       
  2341            #(#SpecCollection
       
  2342               #collection: 
       
  2343                #(
       
  2344                  #(#UISubSpecification
       
  2345                     #name: 'layoutPointSpec'
       
  2346                     #layout: #(#LayoutFrame 1 0.0 6 0 0 1.0 100 0)
       
  2347                     #majorKey: #UILayoutTool
       
  2348                     #minorKey: #layoutPointSpec
       
  2349                 )
       
  2350               )
       
  2351           )
       
  2352       )
       
  2353 ! !
       
  2354 
       
  2355 !UILayoutTool::Point methodsFor:'accessing'!
       
  2356 
       
  2357 fetch:aView spec:aSpec
       
  2358     "fetch point
       
  2359     "
       
  2360     |origin|
       
  2361 
       
  2362     origin  := aView computeOrigin.
       
  2363 
       
  2364     (self aspectFor:#leftOffset) value:(origin x).
       
  2365     (self aspectFor:#topOffset)  value:(origin y).
       
  2366 
       
  2367 
       
  2368 !
       
  2369 
       
  2370 layout
       
  2371     "returns current layout as point
       
  2372     "
       
  2373   ^ Smalltalk::Point x:(((self aspectFor:#leftOffset) value) ? 0)
       
  2374                      y:(((self aspectFor:#topOffset)  value) ? 0)
       
  2375 
       
  2376 ! !
       
  2377 
  2373 !UILayoutTool class methodsFor:'documentation'!
  2378 !UILayoutTool class methodsFor:'documentation'!
  2374 
  2379 
  2375 version
  2380 version
  2376     ^ '$Header$'
  2381     ^ '$Header$'
  2377 ! !
  2382 ! !