UILayoutTool.st
changeset 1198 6b7cfe55105b
parent 1077 46793bf50415
child 1268 1bc516d840bf
equal deleted inserted replaced
1197:ef91ed58b7d4 1198:6b7cfe55105b
    18 	classVariableNames:''
    18 	classVariableNames:''
    19 	poolDictionaries:''
    19 	poolDictionaries:''
    20 	category:'Interface-UIPainter'
    20 	category:'Interface-UIPainter'
    21 !
    21 !
    22 
    22 
       
    23 ApplicationModel subclass:#LayoutOrigin
       
    24 	instanceVariableNames:''
       
    25 	classVariableNames:''
       
    26 	poolDictionaries:''
       
    27 	privateIn:UILayoutTool
       
    28 !
       
    29 
       
    30 ApplicationModel subclass:#Rectangle
       
    31 	instanceVariableNames:''
       
    32 	classVariableNames:''
       
    33 	poolDictionaries:''
       
    34 	privateIn:UILayoutTool
       
    35 !
       
    36 
       
    37 ApplicationModel subclass:#Extent
       
    38 	instanceVariableNames:''
       
    39 	classVariableNames:''
       
    40 	poolDictionaries:''
       
    41 	privateIn:UILayoutTool
       
    42 !
       
    43 
    23 ApplicationModel subclass:#AlignmentOrigin
    44 ApplicationModel subclass:#AlignmentOrigin
    24 	instanceVariableNames:''
    45 	instanceVariableNames:''
    25 	classVariableNames:''
    46 	classVariableNames:''
    26 	poolDictionaries:''
    47 	poolDictionaries:''
    27 	privateIn:UILayoutTool
    48 	privateIn:UILayoutTool
    28 !
    49 !
    29 
    50 
    30 ApplicationModel subclass:#Extent
       
    31 	instanceVariableNames:''
       
    32 	classVariableNames:''
       
    33 	poolDictionaries:''
       
    34 	privateIn:UILayoutTool
       
    35 !
       
    36 
       
    37 ApplicationModel subclass:#LayoutFrame
       
    38 	instanceVariableNames:''
       
    39 	classVariableNames:''
       
    40 	poolDictionaries:''
       
    41 	privateIn:UILayoutTool
       
    42 !
       
    43 
       
    44 ApplicationModel subclass:#LayoutOrigin
       
    45 	instanceVariableNames:''
       
    46 	classVariableNames:''
       
    47 	poolDictionaries:''
       
    48 	privateIn:UILayoutTool
       
    49 !
       
    50 
       
    51 ApplicationModel subclass:#Point
    51 ApplicationModel subclass:#Point
    52 	instanceVariableNames:''
    52 	instanceVariableNames:''
    53 	classVariableNames:''
    53 	classVariableNames:''
    54 	poolDictionaries:''
    54 	poolDictionaries:''
    55 	privateIn:UILayoutTool
    55 	privateIn:UILayoutTool
    56 !
    56 !
    57 
    57 
    58 ApplicationModel subclass:#Rectangle
    58 ApplicationModel subclass:#LayoutFrame
    59 	instanceVariableNames:''
    59 	instanceVariableNames:''
    60 	classVariableNames:''
    60 	classVariableNames:''
    61 	poolDictionaries:''
    61 	poolDictionaries:''
    62 	privateIn:UILayoutTool
    62 	privateIn:UILayoutTool
    63 !
    63 !
   618 ! !
   618 ! !
   619 
   619 
   620 !UILayoutTool methodsFor:'converting absolute'!
   620 !UILayoutTool methodsFor:'converting absolute'!
   621 
   621 
   622 absolute:what xOrY:xOrY
   622 absolute:what xOrY:xOrY
   623     |extent fraction offset fractSymb offsetSymb|
   623     |extent fraction offset fractSymb offsetSymb fractHolder offsetHolder|
   624 
   624 
   625     extent     := (self layoutView superView computeExtent) perform:xOrY.
   625     extent     := (self layoutView superView computeExtent) perform:xOrY.
   626     fractSymb  := (what, 'Fraction') asSymbol.
   626     fractSymb  := (what, 'Fraction') asSymbol.
   627     offsetSymb := (what,   'Offset') asSymbol.
   627     offsetSymb := (what,   'Offset') asSymbol.
   628     fraction   := (self aspectFor:fractSymb)  value.
   628     fractHolder := (self aspectFor:fractSymb).
   629     offset     := (self aspectFor:offsetSymb) value.
   629     offsetHolder := (self aspectFor:offsetSymb).
       
   630     fraction   := fractHolder  value.
       
   631     offset     := offsetHolder value.
   630     offset     := offset + ((fraction * extent) asInteger).
   632     offset     := offset + ((fraction * extent) asInteger).
   631 
   633 
   632     (self aspectFor:offsetSymb) value:offset.
   634     offsetHolder value:offset.
   633     (self aspectFor:fractSymb)  value:0.
   635     fractHolder  value:0.
   634 
   636 
   635 
   637 
   636 
   638 
   637 !
   639 !
   638 
   640 
   657 ! !
   659 ! !
   658 
   660 
   659 !UILayoutTool methodsFor:'converting relative'!
   661 !UILayoutTool methodsFor:'converting relative'!
   660 
   662 
   661 relative:what xOrY:xOrY
   663 relative:what xOrY:xOrY
   662     |extent fraction offset fractSymb offsetSymb|
   664     |extent fraction offset fractSymb offsetSymb fractHolder offsetHolder|
   663 
   665 
   664     extent     := (self layoutView superView computeExtent) perform:xOrY.
   666     extent     := (self layoutView superView computeExtent) perform:xOrY.
   665     fractSymb  := (what, 'Fraction') asSymbol.
   667     fractSymb  := (what, 'Fraction') asSymbol.
   666     offsetSymb := (what,   'Offset') asSymbol.
   668     offsetSymb := (what,   'Offset') asSymbol.
   667     fraction   := (self aspectFor:fractSymb)  value.
   669     fractHolder := (self aspectFor:fractSymb).
   668     offset     := (self aspectFor:offsetSymb) value.
   670     offsetHolder := (self aspectFor:offsetSymb).
       
   671     fraction   := fractHolder  value.
       
   672     offset     := offsetHolder value.
   669     fraction   := (fraction + (offset / extent)) asFloat.
   673     fraction   := (fraction + (offset / extent)) asFloat.
   670 
   674 
   671     (fraction > 1.0) ifTrue:[ fraction := 1.0 ].
   675     (fraction > 1.0) ifTrue:[ fraction := 1.0 ].
   672     (fraction < 0.0) ifTrue:[ fraction := 0 ].
   676     (fraction < 0.0) ifTrue:[ fraction := 0 ].
   673 
   677 
   674     (self aspectFor:offsetSymb) value:0.
   678     offsetHolder value:0.
   675     (self aspectFor:fractSymb)  value:fraction.
   679     fractHolder  value:fraction.
   676 
   680 
   677 
   681 
   678 
   682 
   679 !
   683 !
   680 
   684 
   777         appl notNil ifTrue:[
   781         appl notNil ifTrue:[
   778             noteBook scrolledView allViewBackground:(noteBook viewBackground).
   782             noteBook scrolledView allViewBackground:(noteBook viewBackground).
   779         ]
   783         ]
   780     ].
   784     ].
   781     self update
   785     self update
       
   786 
       
   787 ! !
       
   788 
       
   789 !UILayoutTool::LayoutOrigin class methodsFor:'interface specs'!
       
   790 
       
   791 windowSpec
       
   792     "This resource specification was automatically generated
       
   793      by the UIPainter of ST/X."
       
   794 
       
   795     "Do not manually edit this!! If it is corrupted,
       
   796      the UIPainter may not be able to read the specification."
       
   797 
       
   798     "
       
   799      UIPainter new openOnClass:UILayoutTool::LayoutOrigin andSelector:#windowSpec
       
   800      UILayoutTool::LayoutOrigin new openInterface:#windowSpec
       
   801      UILayoutTool::LayoutOrigin open
       
   802     "
       
   803 
       
   804     <resource: #canvas>
       
   805 
       
   806     ^
       
   807      
       
   808        #(#FullSpec
       
   809           #window: 
       
   810            #(#WindowSpec
       
   811               #name: 'UILayoutTool-LayoutOrigin'
       
   812               #layout: #(#LayoutFrame 290 0 420 0 647 0 565 0)
       
   813               #label: 'UILayoutTool-LayoutOrigin'
       
   814               #min: #(#Point 10 10)
       
   815               #max: #(#Point 1152 900)
       
   816               #bounds: #(#Rectangle 290 420 648 566)
       
   817               #usePreferredExtent: false
       
   818           )
       
   819           #component: 
       
   820            #(#SpecCollection
       
   821               #collection: 
       
   822                #(
       
   823                  #(#UISubSpecification
       
   824                     #name: 'layoutOriginSpec'
       
   825                     #layout: #(#LayoutFrame 1 0.0 6 0 0 1.0 110 0)
       
   826                     #majorKey: #UILayoutTool
       
   827                     #minorKey: #layoutOriginSpec
       
   828                 )
       
   829               )
       
   830           )
       
   831       )
       
   832 ! !
       
   833 
       
   834 !UILayoutTool::LayoutOrigin methodsFor:'accessing'!
       
   835 
       
   836 fetch:aView spec:aSpec
       
   837     "fetch layoutOrigin
       
   838     "
       
   839     |layout|
       
   840 
       
   841     layout  := UIPainterView asLayoutFrameFromView:aView.
       
   842 
       
   843     (self aspectFor:#leftOffset)   value:(layout leftOffset).
       
   844     (self aspectFor:#leftFraction) value:(layout leftFraction).
       
   845     (self aspectFor:#topOffset)    value:(layout topOffset).
       
   846     (self aspectFor:#topFraction)  value:(layout topFraction).
       
   847 
       
   848 
       
   849 !
       
   850 
       
   851 layout
       
   852     "returns current layout as layoutOrigin
       
   853     "
       
   854     |layout|
       
   855 
       
   856     layout  := Smalltalk::LayoutOrigin new.
       
   857 
       
   858     layout   leftOffset:((self aspectFor:#leftOffset)   value) ? 0.
       
   859     layout    topOffset:((self aspectFor:#topOffset)    value) ? 0.
       
   860     layout leftFraction:((self aspectFor:#leftFraction) value) ? 0.
       
   861     layout  topFraction:((self aspectFor:#topFraction)  value) ? 0.
       
   862 
       
   863   ^ layout
       
   864 
       
   865 ! !
       
   866 
       
   867 !UILayoutTool::Rectangle class methodsFor:'interface specs'!
       
   868 
       
   869 windowSpec
       
   870     "This resource specification was automatically generated
       
   871      by the UIPainter of ST/X."
       
   872 
       
   873     "Do not manually edit this!! If it is corrupted,
       
   874      the UIPainter may not be able to read the specification."
       
   875 
       
   876     "
       
   877      UIPainter new openOnClass:UILayoutTool::Rectangle andSelector:#windowSpec
       
   878      UILayoutTool::Rectangle new openInterface:#windowSpec
       
   879      UILayoutTool::Rectangle open
       
   880     "
       
   881 
       
   882     <resource: #canvas>
       
   883 
       
   884     ^
       
   885      
       
   886        #(#FullSpec
       
   887           #window: 
       
   888            #(#WindowSpec
       
   889               #name: 'UILayoutTool-Rectangle'
       
   890               #layout: #(#LayoutFrame 291 0 130 0 632 0 328 0)
       
   891               #label: 'UILayoutTool-Rectangle'
       
   892               #min: #(#Point 10 10)
       
   893               #max: #(#Point 1152 900)
       
   894               #bounds: #(#Rectangle 291 130 633 329)
       
   895               #usePreferredExtent: false
       
   896           )
       
   897           #component: 
       
   898            #(#SpecCollection
       
   899               #collection: 
       
   900                #(
       
   901                  #(#UISubSpecification
       
   902                     #name: 'subSpecification'
       
   903                     #layout: #(#LayoutFrame 1 0.0 6 0 0 1.0 96 0)
       
   904                     #majorKey: #UILayoutTool
       
   905                     #minorKey: #layoutPointSpec
       
   906                 )
       
   907                  #(#FramedBoxSpec
       
   908                     #name: 'FramedBox'
       
   909                     #layout: #(#LayoutFrame 1 0.0 99 0 0 1.0 194 0)
       
   910                     #component: 
       
   911                      #(#SpecCollection
       
   912                         #collection: 
       
   913                          #(
       
   914                            #(#LabelSpec
       
   915                               #name: 'labelCornerY'
       
   916                               #layout: #(#AlignmentOrigin 83 0 16 0 1 0)
       
   917                               #label: 'Right:'
       
   918                               #adjust: #left
       
   919                           )
       
   920                            #(#InputFieldSpec
       
   921                               #name: 'fieldCornerX'
       
   922                               #layout: #(#LayoutFrame 85 0 13 0 135 0 35 0)
       
   923                               #activeHelpKey: #cornerX
       
   924                               #tabable: true
       
   925                               #model: #rightOffset
       
   926                               #group: #inputGroup
       
   927                               #type: #numberOrNil
       
   928                               #acceptOnLostFocus: true
       
   929                     #acceptChannel: #acceptChannel
       
   930                     #modifiedChannel: #modifiedChannel
       
   931                           )
       
   932                            #(#LabelSpec
       
   933                               #name: 'labelCornerX'
       
   934                               #layout: #(#AlignmentOrigin 83 0 41 0 1 0)
       
   935                               #label: 'Bottom:'
       
   936                               #adjust: #left
       
   937                           )
       
   938                            #(#InputFieldSpec
       
   939                               #name: 'fieldCornerY'
       
   940                               #layout: #(#LayoutFrame 85 0 38 0 135 0 60 0)
       
   941                               #activeHelpKey: #cornerY
       
   942                               #tabable: true
       
   943                               #model: #bottomOffset
       
   944                               #group: #inputGroup
       
   945                               #type: #numberOrNil
       
   946                               #acceptOnLostFocus: true
       
   947                     #acceptChannel: #acceptChannel
       
   948                     #modifiedChannel: #modifiedChannel
       
   949                           )
       
   950                         )
       
   951                     )
       
   952                     #label: 'Corner'
       
   953                     #labelPosition: #topLeft
       
   954                 )
       
   955               )
       
   956           )
       
   957       )
       
   958 
       
   959     "Modified: / 13.8.1998 / 19:59:16 / cg"
       
   960 ! !
       
   961 
       
   962 !UILayoutTool::Rectangle methodsFor:'accessing'!
       
   963 
       
   964 fetch:aView spec:aSpec
       
   965     "fetch rectangle
       
   966     "
       
   967     |origin corner|
       
   968 
       
   969     origin := aView computeOrigin.
       
   970     corner := aView computeCorner.
       
   971 
       
   972     (self aspectFor:#leftOffset)   value:(origin x).
       
   973     (self aspectFor:#rightOffset)  value:(corner x).
       
   974     (self aspectFor:#topOffset)    value:(origin y).
       
   975     (self aspectFor:#bottomOffset) value:(corner y).
       
   976 
       
   977 
       
   978 !
       
   979 
       
   980 layout
       
   981     "returns current layout as rectangle
       
   982     "
       
   983   ^ Smalltalk::Rectangle left:(((self aspectFor:#leftOffset)   value) ? 0)
       
   984                           top:(((self aspectFor:#topOffset)    value) ? 0)
       
   985                         right:(((self aspectFor:#rightOffset)  value) ? 0)
       
   986                        bottom:(((self aspectFor:#bottomOffset) value) ? 0)
       
   987 
       
   988 
       
   989 ! !
       
   990 
       
   991 !UILayoutTool::Extent class methodsFor:'help specs'!
       
   992 
       
   993 helpSpec
       
   994     "This resource specification was automatically generated
       
   995      by the UIHelpTool of ST/X."
       
   996 
       
   997     "Do not manually edit this!! If it is corrupted,
       
   998      the UIHelpTool may not be able to read the specification."
       
   999 
       
  1000     "
       
  1001      UIHelpTool openOnClass:UILayoutTool::Extent    
       
  1002     "
       
  1003 
       
  1004     <resource: #help>
       
  1005 
       
  1006     ^super helpSpec addPairsFrom:#(
       
  1007 
       
  1008 #hrzExtent
       
  1009 'Horizontal extent of the selected widget.'
       
  1010 
       
  1011 #vrtExtent
       
  1012 'Vertical extent of the selected widget.'
       
  1013 
       
  1014 )
       
  1015 ! !
       
  1016 
       
  1017 !UILayoutTool::Extent class methodsFor:'interface specs'!
       
  1018 
       
  1019 windowSpec
       
  1020     "This resource specification was automatically generated
       
  1021      by the UIPainter of ST/X."
       
  1022 
       
  1023     "Do not manually edit this!! If it is corrupted,
       
  1024      the UIPainter may not be able to read the specification."
       
  1025 
       
  1026     "
       
  1027      UIPainter new openOnClass:UILayoutTool::Extent andSelector:#windowSpec
       
  1028      UILayoutTool::Extent new openInterface:#windowSpec
       
  1029      UILayoutTool::Extent open
       
  1030     "
       
  1031 
       
  1032     <resource: #canvas>
       
  1033 
       
  1034     ^
       
  1035      
       
  1036        #(#FullSpec
       
  1037           #name: #windowSpec
       
  1038           #window: 
       
  1039            #(#WindowSpec
       
  1040               #name: 'UILayoutTool-Extent'
       
  1041               #layout: #(#LayoutFrame 216 0 173 0 541 0 321 0)
       
  1042               #level: 0
       
  1043               #label: 'UILayoutTool-Extent'
       
  1044               #min: #(#Point 10 10)
       
  1045               #max: #(#Point 1152 900)
       
  1046               #bounds: #(#Rectangle 216 173 542 322)
       
  1047               #usePreferredExtent: false
       
  1048               #returnIsOKInDialog: true
       
  1049               #escapeIsCancelInDialog: true
       
  1050           )
       
  1051           #component: 
       
  1052            #(#SpecCollection
       
  1053               #collection: 
       
  1054                #(
       
  1055                  #(#FramedBoxSpec
       
  1056                     #name: 'FramedBox'
       
  1057                     #layout: #(#LayoutFrame 0 0.0 6 0.0 0 1.0 137 0)
       
  1058                     #component: 
       
  1059                      #(#SpecCollection
       
  1060                         #collection: 
       
  1061                          #(
       
  1062                            #(#LabelSpec
       
  1063                               #name: 'labelWidth'
       
  1064                               #layout: #(#AlignmentOrigin 89 0 24 0 1 0.5)
       
  1065                               #label: 'Width:'
       
  1066                               #adjust: #right
       
  1067                           )
       
  1068                            #(#InputFieldSpec
       
  1069                               #name: 'fieldLeftOffset'
       
  1070                               #layout: #(#LayoutFrame 90 0 13 0 140 0 35 0)
       
  1071                               #activeHelpKey: #hrzExtent
       
  1072                               #enableChannel: #notUsingDefaultExtent
       
  1073                               #tabable: true
       
  1074                               #model: #leftOffset
       
  1075                               #group: #inputGroup
       
  1076                               #type: #numberOrNil
       
  1077                               #acceptOnLostFocus: true
       
  1078                               #acceptChannel: #acceptChannel
       
  1079                               #modifiedChannel: #modifiedChannel
       
  1080                           )
       
  1081                            #(#LabelSpec
       
  1082                               #name: 'labelHeight'
       
  1083                               #layout: #(#AlignmentOrigin 89 0 49 0 1 0.5)
       
  1084                               #label: 'Height:'
       
  1085                               #adjust: #right
       
  1086                           )
       
  1087                            #(#InputFieldSpec
       
  1088                               #name: 'fieldRightOffset'
       
  1089                               #layout: #(#LayoutFrame 90 0 38 0 140 0 60 0)
       
  1090                               #activeHelpKey: #vrtExtent
       
  1091                               #enableChannel: #notUsingDefaultExtent
       
  1092                               #tabable: true
       
  1093                               #model: #rightOffset
       
  1094                               #group: #inputGroup
       
  1095                               #type: #numberOrNil
       
  1096                               #acceptOnLostFocus: true
       
  1097                               #acceptChannel: #acceptChannel
       
  1098                               #modifiedChannel: #modifiedChannel
       
  1099                           )
       
  1100                            #(#CheckBoxSpec
       
  1101                               #name: 'useDefaultExtentCheckBox'
       
  1102                               #layout: #(#LayoutFrame -1 0 75 0 296 0 97 0)
       
  1103                               #model: #useDefaultExtent
       
  1104                               #label: 'Use Widgets Default Extent'
       
  1105                               #translateLabel: true
       
  1106                               #enableChannel: #defaultExtentEnabled
       
  1107                           )
       
  1108                         )
       
  1109                     )
       
  1110                     #label: 'Extent'
       
  1111                     #labelPosition: #topLeft
       
  1112                 )
       
  1113               )
       
  1114           )
       
  1115       )
       
  1116 ! !
       
  1117 
       
  1118 !UILayoutTool::Extent methodsFor:'accessing'!
       
  1119 
       
  1120 fetch:aView spec:aSpec
       
  1121     "fetch extent
       
  1122     "
       
  1123     |extent|
       
  1124 
       
  1125     extent  := aView computeExtent.
       
  1126 
       
  1127     (self aspectFor:#leftOffset)  value:(extent x).
       
  1128     (self aspectFor:#rightOffset) value:(extent y).
       
  1129 
       
  1130     (self aspectFor:#useDefaultExtent) value:aSpec useDefaultExtent 
       
  1131 !
       
  1132 
       
  1133 layout
       
  1134     "returns current extent
       
  1135     "
       
  1136   ^ Smalltalk::Point x:(((self aspectFor:#leftOffset)   value) ? 0)
       
  1137                      y:(((self aspectFor:#rightOffset)  value) ? 0)
   782 
  1138 
   783 ! !
  1139 ! !
   784 
  1140 
   785 !UILayoutTool::AlignmentOrigin class methodsFor:'help specs'!
  1141 !UILayoutTool::AlignmentOrigin class methodsFor:'help specs'!
   786 
  1142 
  1005 !UILayoutTool::AlignmentOrigin methodsFor:'accessing'!
  1361 !UILayoutTool::AlignmentOrigin methodsFor:'accessing'!
  1006 
  1362 
  1007 fetch:aView spec:aSpec
  1363 fetch:aView spec:aSpec
  1008     "fetch alignmentOrigin
  1364     "fetch alignmentOrigin
  1009     "
  1365     "
  1010     |layout type|
  1366     |layout type 
       
  1367      leftAlignmentFractionHolder topAlignmentFractionHolder
       
  1368      leftOffsetHolder leftFractionHolder topOffsetHolder topFractionHolder|
  1011 
  1369 
  1012     type   := UIPainterView layoutType:aView.
  1370     type   := UIPainterView layoutType:aView.
  1013     layout := aView geometryLayout.
  1371     layout := aView geometryLayout.
  1014 
  1372 
       
  1373     leftOffsetHolder := (self aspectFor:#leftOffset).
       
  1374     leftFractionHolder := (self aspectFor:#leftFraction).
       
  1375     topOffsetHolder := (self aspectFor:#topOffset).
       
  1376     topFractionHolder := (self aspectFor:#topFraction).
       
  1377     leftAlignmentFractionHolder := (self aspectFor:#leftAlignmentFraction).
       
  1378     topAlignmentFractionHolder := (self aspectFor:#topAlignmentFraction).
       
  1379 
  1015     layout isLayout ifTrue:[
  1380     layout isLayout ifTrue:[
  1016         (self aspectFor:#leftOffset)   value:(layout leftOffset).
  1381         leftOffsetHolder   value:(layout leftOffset).
  1017         (self aspectFor:#leftFraction) value:(layout leftFraction).
  1382         leftFractionHolder value:(layout leftFraction).
  1018         (self aspectFor:#topOffset)    value:(layout topOffset).
  1383         topOffsetHolder    value:(layout topOffset).
  1019         (self aspectFor:#topFraction)  value:(layout topFraction).
  1384         topFractionHolder  value:(layout topFraction).
  1020 
  1385 
  1021         type == #AlignmentOrigin ifTrue:[
  1386         type == #AlignmentOrigin ifTrue:[
  1022             (self aspectFor:#leftAlignmentFraction) value:(layout leftAlignmentFraction).
  1387             leftAlignmentFractionHolder value:(layout leftAlignmentFraction).
  1023             (self aspectFor:#topAlignmentFraction)  value:(layout topAlignmentFraction).
  1388             topAlignmentFractionHolder  value:(layout topAlignmentFraction).
  1024           ^ self
  1389           ^ self
  1025         ]
  1390         ]
  1026     ] ifFalse:[
  1391     ] ifFalse:[
  1027         layout := aView computeOrigin.
  1392         layout := aView computeOrigin.
  1028 
  1393 
  1029         (self aspectFor:#leftOffset)   value:(layout x).
  1394         leftOffsetHolder   value:(layout x).
  1030         (self aspectFor:#leftFraction) value:0.
  1395         leftFractionHolder value:0.
  1031         (self aspectFor:#topOffset)    value:(layout y).
  1396         topOffsetHolder    value:(layout y).
  1032         (self aspectFor:#topFraction)  value:0.
  1397         topFractionHolder  value:0.
  1033     ].
  1398     ].
  1034     (self aspectFor:#leftAlignmentFraction) value:0.
  1399     leftAlignmentFractionHolder value:0.
  1035     (self aspectFor:#topAlignmentFraction)  value:0.
  1400     topAlignmentFractionHolder  value:0.
  1036 
  1401 
  1037 
  1402 
  1038 !
  1403 !
  1039 
  1404 
  1040 layout
  1405 layout
  1110 
  1475 
  1111 
  1476 
  1112 !
  1477 !
  1113 
  1478 
  1114 makeAlignLeft:leftAlignmentFraction top:topAlignmentFraction
  1479 makeAlignLeft:leftAlignmentFraction top:topAlignmentFraction
  1115     |lAF tAF lO tO ext|
  1480     |lAF tAF lO tO ext lAHolder tAHolder lOHolder tOHolder|
  1116 
  1481 
  1117     lAF     := (self aspectFor:#leftAlignmentFraction) value ? 0.
  1482     lAF     := (lAHolder := self aspectFor:#leftAlignmentFraction) value ? 0.
  1118     tAF     := (self aspectFor:#topAlignmentFraction)  value ? 0.
  1483     tAF     := (tAHolder := self aspectFor:#topAlignmentFraction)  value ? 0.
  1119     ext     := (self aspectFor:#layoutView) computeExtent.
  1484     ext     := (self aspectFor:#layoutView) computeExtent.
  1120 
  1485 
  1121     (self aspectFor:#leftAlignmentFraction) value:leftAlignmentFraction.
  1486     lAHolder value:leftAlignmentFraction.
  1122     (self aspectFor:#topAlignmentFraction)  value:topAlignmentFraction.
  1487     tAHolder  value:topAlignmentFraction.
  1123 
  1488 
  1124     lO := (self aspectFor:#leftOffset) value ? 0.
  1489     lO := (lOHolder := self aspectFor:#leftOffset) value ? 0.
  1125     tO := (self aspectFor:#topOffset)  value ? 0.
  1490     tO := (tOHolder := self aspectFor:#topOffset)  value ? 0.
  1126 
  1491 
  1127     lO := lO + (ext x * (leftAlignmentFraction - lAF)).
  1492     lO := lO + (ext x * (leftAlignmentFraction - lAF)).
  1128     tO := tO + (ext y * (topAlignmentFraction  - tAF)).
  1493     tO := tO + (ext y * (topAlignmentFraction  - tAF)).
  1129 
  1494 
  1130     (self aspectFor:#leftOffset) value:(lO rounded).
  1495     lOHolder value:(lO rounded).
  1131     (self aspectFor:#topOffset)  value:(tO rounded).
  1496     tOHolder value:(tO rounded).
  1132 
  1497 
  1133 !
  1498 !
  1134 
  1499 
  1135 makeAlignTopRight
  1500 makeAlignTopRight
  1136     self makeAlignLeft:1 top:0
  1501     self makeAlignLeft:1 top:0
  1137 
  1502 
  1138 
  1503 
  1139 ! !
  1504 ! !
  1140 
  1505 
  1141 !UILayoutTool::Extent class methodsFor:'help specs'!
  1506 !UILayoutTool::Point class methodsFor:'interface specs'!
  1142 
       
  1143 helpSpec
       
  1144     "This resource specification was automatically generated
       
  1145      by the UIHelpTool of ST/X."
       
  1146 
       
  1147     "Do not manually edit this!! If it is corrupted,
       
  1148      the UIHelpTool may not be able to read the specification."
       
  1149 
       
  1150     "
       
  1151      UIHelpTool openOnClass:UILayoutTool::Extent    
       
  1152     "
       
  1153 
       
  1154     <resource: #help>
       
  1155 
       
  1156     ^super helpSpec addPairsFrom:#(
       
  1157 
       
  1158 #hrzExtent
       
  1159 'Horizontal extent of the selected widget.'
       
  1160 
       
  1161 #vrtExtent
       
  1162 'Vertical extent of the selected widget.'
       
  1163 
       
  1164 )
       
  1165 ! !
       
  1166 
       
  1167 !UILayoutTool::Extent class methodsFor:'interface specs'!
       
  1168 
  1507 
  1169 windowSpec
  1508 windowSpec
  1170     "This resource specification was automatically generated
  1509     "This resource specification was automatically generated
  1171      by the UIPainter of ST/X."
  1510      by the UIPainter of ST/X."
  1172 
  1511 
  1173     "Do not manually edit this!! If it is corrupted,
  1512     "Do not manually edit this!! If it is corrupted,
  1174      the UIPainter may not be able to read the specification."
  1513      the UIPainter may not be able to read the specification."
  1175 
  1514 
  1176     "
  1515     "
  1177      UIPainter new openOnClass:UILayoutTool::Extent andSelector:#windowSpec
  1516      UIPainter new openOnClass:UILayoutTool::Point andSelector:#windowSpec
  1178      UILayoutTool::Extent new openInterface:#windowSpec
  1517      UILayoutTool::Point new openInterface:#windowSpec
  1179      UILayoutTool::Extent open
  1518      UILayoutTool::Point open
  1180     "
  1519     "
  1181 
  1520 
  1182     <resource: #canvas>
  1521     <resource: #canvas>
  1183 
  1522 
  1184     ^
  1523     ^
  1185      
  1524      
  1186        #(#FullSpec
  1525        #(#FullSpec
  1187           #name: #windowSpec
       
  1188           #window: 
  1526           #window: 
  1189            #(#WindowSpec
  1527            #(#WindowSpec
  1190               #name: 'UILayoutTool-Extent'
  1528               #name: 'UILayoutTool-Point'
  1191               #layout: #(#LayoutFrame 216 0 173 0 541 0 321 0)
  1529               #layout: #(#LayoutFrame 324 0 410 0 618 0 547 0)
  1192               #level: 0
  1530               #label: 'UILayoutTool-Point'
  1193               #label: 'UILayoutTool-Extent'
       
  1194               #min: #(#Point 10 10)
  1531               #min: #(#Point 10 10)
  1195               #max: #(#Point 1152 900)
  1532               #max: #(#Point 1152 900)
  1196               #bounds: #(#Rectangle 216 173 542 322)
  1533               #bounds: #(#Rectangle 324 410 619 548)
  1197               #usePreferredExtent: false
  1534               #usePreferredExtent: false
  1198               #returnIsOKInDialog: true
       
  1199               #escapeIsCancelInDialog: true
       
  1200           )
  1535           )
  1201           #component: 
  1536           #component: 
  1202            #(#SpecCollection
  1537            #(#SpecCollection
  1203               #collection: 
  1538               #collection: 
  1204                #(
  1539                #(
  1205                  #(#FramedBoxSpec
  1540                  #(#UISubSpecification
  1206                     #name: 'FramedBox'
  1541                     #name: 'layoutPointSpec'
  1207                     #layout: #(#LayoutFrame 0 0.0 6 0.0 0 1.0 137 0)
  1542                     #layout: #(#LayoutFrame 1 0.0 6 0 0 1.0 100 0)
  1208                     #component: 
  1543                     #majorKey: #UILayoutTool
  1209                      #(#SpecCollection
  1544                     #minorKey: #layoutPointSpec
  1210                         #collection: 
       
  1211                          #(
       
  1212                            #(#LabelSpec
       
  1213                               #name: 'labelWidth'
       
  1214                               #layout: #(#AlignmentOrigin 89 0 24 0 1 0.5)
       
  1215                               #label: 'Width:'
       
  1216                               #adjust: #right
       
  1217                           )
       
  1218                            #(#InputFieldSpec
       
  1219                               #name: 'fieldLeftOffset'
       
  1220                               #layout: #(#LayoutFrame 90 0 13 0 140 0 35 0)
       
  1221                               #activeHelpKey: #hrzExtent
       
  1222                               #enableChannel: #notUsingDefaultExtent
       
  1223                               #tabable: true
       
  1224                               #model: #leftOffset
       
  1225                               #group: #inputGroup
       
  1226                               #type: #numberOrNil
       
  1227                               #acceptOnLostFocus: true
       
  1228                               #acceptChannel: #acceptChannel
       
  1229                               #modifiedChannel: #modifiedChannel
       
  1230                           )
       
  1231                            #(#LabelSpec
       
  1232                               #name: 'labelHeight'
       
  1233                               #layout: #(#AlignmentOrigin 89 0 49 0 1 0.5)
       
  1234                               #label: 'Height:'
       
  1235                               #adjust: #right
       
  1236                           )
       
  1237                            #(#InputFieldSpec
       
  1238                               #name: 'fieldRightOffset'
       
  1239                               #layout: #(#LayoutFrame 90 0 38 0 140 0 60 0)
       
  1240                               #activeHelpKey: #vrtExtent
       
  1241                               #enableChannel: #notUsingDefaultExtent
       
  1242                               #tabable: true
       
  1243                               #model: #rightOffset
       
  1244                               #group: #inputGroup
       
  1245                               #type: #numberOrNil
       
  1246                               #acceptOnLostFocus: true
       
  1247                               #acceptChannel: #acceptChannel
       
  1248                               #modifiedChannel: #modifiedChannel
       
  1249                           )
       
  1250                            #(#CheckBoxSpec
       
  1251                               #name: 'useDefaultExtentCheckBox'
       
  1252                               #layout: #(#LayoutFrame -1 0 75 0 296 0 97 0)
       
  1253                               #model: #useDefaultExtent
       
  1254                               #label: 'Use Widgets Default Extent'
       
  1255                               #translateLabel: true
       
  1256                               #enableChannel: #defaultExtentEnabled
       
  1257                           )
       
  1258                         )
       
  1259                     )
       
  1260                     #label: 'Extent'
       
  1261                     #labelPosition: #topLeft
       
  1262                 )
  1545                 )
  1263               )
  1546               )
  1264           )
  1547           )
  1265       )
  1548       )
  1266 ! !
  1549 ! !
  1267 
  1550 
  1268 !UILayoutTool::Extent methodsFor:'accessing'!
  1551 !UILayoutTool::Point methodsFor:'accessing'!
  1269 
  1552 
  1270 fetch:aView spec:aSpec
  1553 fetch:aView spec:aSpec
  1271     "fetch extent
  1554     "fetch point
  1272     "
  1555     "
  1273     |extent|
  1556     |origin|
  1274 
  1557 
  1275     extent  := aView computeExtent.
  1558     origin  := aView computeOrigin.
  1276 
  1559 
  1277     (self aspectFor:#leftOffset)  value:(extent x).
  1560     (self aspectFor:#leftOffset) value:(origin x).
  1278     (self aspectFor:#rightOffset) value:(extent y).
  1561     (self aspectFor:#topOffset)  value:(origin y).
  1279 
  1562 
  1280     (self aspectFor:#useDefaultExtent) value:aSpec useDefaultExtent 
  1563 
  1281 !
  1564 !
  1282 
  1565 
  1283 layout
  1566 layout
  1284     "returns current extent
  1567     "returns current layout as point
  1285     "
  1568     "
  1286   ^ Smalltalk::Point x:(((self aspectFor:#leftOffset)   value) ? 0)
  1569   ^ Smalltalk::Point x:(((self aspectFor:#leftOffset) value) ? 0)
  1287                      y:(((self aspectFor:#rightOffset)  value) ? 0)
  1570                      y:(((self aspectFor:#topOffset)  value) ? 0)
  1288 
  1571 
  1289 ! !
  1572 ! !
  1290 
  1573 
  1291 !UILayoutTool::LayoutFrame class methodsFor:'help specs'!
  1574 !UILayoutTool::LayoutFrame class methodsFor:'help specs'!
  1292 
  1575 
  1943         right:1          offset:0 
  2226         right:1          offset:0 
  1944         top:0            offset:0 
  2227         top:0            offset:0 
  1945         bottom:0.5       offset:0
  2228         bottom:0.5       offset:0
  1946 ! !
  2229 ! !
  1947 
  2230 
  1948 !UILayoutTool::LayoutOrigin class methodsFor:'interface specs'!
       
  1949 
       
  1950 windowSpec
       
  1951     "This resource specification was automatically generated
       
  1952      by the UIPainter of ST/X."
       
  1953 
       
  1954     "Do not manually edit this!! If it is corrupted,
       
  1955      the UIPainter may not be able to read the specification."
       
  1956 
       
  1957     "
       
  1958      UIPainter new openOnClass:UILayoutTool::LayoutOrigin andSelector:#windowSpec
       
  1959      UILayoutTool::LayoutOrigin new openInterface:#windowSpec
       
  1960      UILayoutTool::LayoutOrigin open
       
  1961     "
       
  1962 
       
  1963     <resource: #canvas>
       
  1964 
       
  1965     ^
       
  1966      
       
  1967        #(#FullSpec
       
  1968           #window: 
       
  1969            #(#WindowSpec
       
  1970               #name: 'UILayoutTool-LayoutOrigin'
       
  1971               #layout: #(#LayoutFrame 290 0 420 0 647 0 565 0)
       
  1972               #label: 'UILayoutTool-LayoutOrigin'
       
  1973               #min: #(#Point 10 10)
       
  1974               #max: #(#Point 1152 900)
       
  1975               #bounds: #(#Rectangle 290 420 648 566)
       
  1976               #usePreferredExtent: false
       
  1977           )
       
  1978           #component: 
       
  1979            #(#SpecCollection
       
  1980               #collection: 
       
  1981                #(
       
  1982                  #(#UISubSpecification
       
  1983                     #name: 'layoutOriginSpec'
       
  1984                     #layout: #(#LayoutFrame 1 0.0 6 0 0 1.0 110 0)
       
  1985                     #majorKey: #UILayoutTool
       
  1986                     #minorKey: #layoutOriginSpec
       
  1987                 )
       
  1988               )
       
  1989           )
       
  1990       )
       
  1991 ! !
       
  1992 
       
  1993 !UILayoutTool::LayoutOrigin methodsFor:'accessing'!
       
  1994 
       
  1995 fetch:aView spec:aSpec
       
  1996     "fetch layoutOrigin
       
  1997     "
       
  1998     |layout|
       
  1999 
       
  2000     layout  := UIPainterView asLayoutFrameFromView:aView.
       
  2001 
       
  2002     (self aspectFor:#leftOffset)   value:(layout leftOffset).
       
  2003     (self aspectFor:#leftFraction) value:(layout leftFraction).
       
  2004     (self aspectFor:#topOffset)    value:(layout topOffset).
       
  2005     (self aspectFor:#topFraction)  value:(layout topFraction).
       
  2006 
       
  2007 
       
  2008 !
       
  2009 
       
  2010 layout
       
  2011     "returns current layout as layoutOrigin
       
  2012     "
       
  2013     |layout|
       
  2014 
       
  2015     layout  := Smalltalk::LayoutOrigin new.
       
  2016 
       
  2017     layout   leftOffset:((self aspectFor:#leftOffset)   value) ? 0.
       
  2018     layout    topOffset:((self aspectFor:#topOffset)    value) ? 0.
       
  2019     layout leftFraction:((self aspectFor:#leftFraction) value) ? 0.
       
  2020     layout  topFraction:((self aspectFor:#topFraction)  value) ? 0.
       
  2021 
       
  2022   ^ layout
       
  2023 
       
  2024 ! !
       
  2025 
       
  2026 !UILayoutTool::Point class methodsFor:'interface specs'!
       
  2027 
       
  2028 windowSpec
       
  2029     "This resource specification was automatically generated
       
  2030      by the UIPainter of ST/X."
       
  2031 
       
  2032     "Do not manually edit this!! If it is corrupted,
       
  2033      the UIPainter may not be able to read the specification."
       
  2034 
       
  2035     "
       
  2036      UIPainter new openOnClass:UILayoutTool::Point andSelector:#windowSpec
       
  2037      UILayoutTool::Point new openInterface:#windowSpec
       
  2038      UILayoutTool::Point open
       
  2039     "
       
  2040 
       
  2041     <resource: #canvas>
       
  2042 
       
  2043     ^
       
  2044      
       
  2045        #(#FullSpec
       
  2046           #window: 
       
  2047            #(#WindowSpec
       
  2048               #name: 'UILayoutTool-Point'
       
  2049               #layout: #(#LayoutFrame 324 0 410 0 618 0 547 0)
       
  2050               #label: 'UILayoutTool-Point'
       
  2051               #min: #(#Point 10 10)
       
  2052               #max: #(#Point 1152 900)
       
  2053               #bounds: #(#Rectangle 324 410 619 548)
       
  2054               #usePreferredExtent: false
       
  2055           )
       
  2056           #component: 
       
  2057            #(#SpecCollection
       
  2058               #collection: 
       
  2059                #(
       
  2060                  #(#UISubSpecification
       
  2061                     #name: 'layoutPointSpec'
       
  2062                     #layout: #(#LayoutFrame 1 0.0 6 0 0 1.0 100 0)
       
  2063                     #majorKey: #UILayoutTool
       
  2064                     #minorKey: #layoutPointSpec
       
  2065                 )
       
  2066               )
       
  2067           )
       
  2068       )
       
  2069 ! !
       
  2070 
       
  2071 !UILayoutTool::Point methodsFor:'accessing'!
       
  2072 
       
  2073 fetch:aView spec:aSpec
       
  2074     "fetch point
       
  2075     "
       
  2076     |origin|
       
  2077 
       
  2078     origin  := aView computeOrigin.
       
  2079 
       
  2080     (self aspectFor:#leftOffset) value:(origin x).
       
  2081     (self aspectFor:#topOffset)  value:(origin y).
       
  2082 
       
  2083 
       
  2084 !
       
  2085 
       
  2086 layout
       
  2087     "returns current layout as point
       
  2088     "
       
  2089   ^ Smalltalk::Point x:(((self aspectFor:#leftOffset) value) ? 0)
       
  2090                      y:(((self aspectFor:#topOffset)  value) ? 0)
       
  2091 
       
  2092 ! !
       
  2093 
       
  2094 !UILayoutTool::Rectangle class methodsFor:'interface specs'!
       
  2095 
       
  2096 windowSpec
       
  2097     "This resource specification was automatically generated
       
  2098      by the UIPainter of ST/X."
       
  2099 
       
  2100     "Do not manually edit this!! If it is corrupted,
       
  2101      the UIPainter may not be able to read the specification."
       
  2102 
       
  2103     "
       
  2104      UIPainter new openOnClass:UILayoutTool::Rectangle andSelector:#windowSpec
       
  2105      UILayoutTool::Rectangle new openInterface:#windowSpec
       
  2106      UILayoutTool::Rectangle open
       
  2107     "
       
  2108 
       
  2109     <resource: #canvas>
       
  2110 
       
  2111     ^
       
  2112      
       
  2113        #(#FullSpec
       
  2114           #window: 
       
  2115            #(#WindowSpec
       
  2116               #name: 'UILayoutTool-Rectangle'
       
  2117               #layout: #(#LayoutFrame 291 0 130 0 632 0 328 0)
       
  2118               #label: 'UILayoutTool-Rectangle'
       
  2119               #min: #(#Point 10 10)
       
  2120               #max: #(#Point 1152 900)
       
  2121               #bounds: #(#Rectangle 291 130 633 329)
       
  2122               #usePreferredExtent: false
       
  2123           )
       
  2124           #component: 
       
  2125            #(#SpecCollection
       
  2126               #collection: 
       
  2127                #(
       
  2128                  #(#UISubSpecification
       
  2129                     #name: 'subSpecification'
       
  2130                     #layout: #(#LayoutFrame 1 0.0 6 0 0 1.0 96 0)
       
  2131                     #majorKey: #UILayoutTool
       
  2132                     #minorKey: #layoutPointSpec
       
  2133                 )
       
  2134                  #(#FramedBoxSpec
       
  2135                     #name: 'FramedBox'
       
  2136                     #layout: #(#LayoutFrame 1 0.0 99 0 0 1.0 194 0)
       
  2137                     #component: 
       
  2138                      #(#SpecCollection
       
  2139                         #collection: 
       
  2140                          #(
       
  2141                            #(#LabelSpec
       
  2142                               #name: 'labelCornerY'
       
  2143                               #layout: #(#AlignmentOrigin 83 0 16 0 1 0)
       
  2144                               #label: 'Right:'
       
  2145                               #adjust: #left
       
  2146                           )
       
  2147                            #(#InputFieldSpec
       
  2148                               #name: 'fieldCornerX'
       
  2149                               #layout: #(#LayoutFrame 85 0 13 0 135 0 35 0)
       
  2150                               #activeHelpKey: #cornerX
       
  2151                               #tabable: true
       
  2152                               #model: #rightOffset
       
  2153                               #group: #inputGroup
       
  2154                               #type: #numberOrNil
       
  2155                               #acceptOnLostFocus: true
       
  2156                     #acceptChannel: #acceptChannel
       
  2157                     #modifiedChannel: #modifiedChannel
       
  2158                           )
       
  2159                            #(#LabelSpec
       
  2160                               #name: 'labelCornerX'
       
  2161                               #layout: #(#AlignmentOrigin 83 0 41 0 1 0)
       
  2162                               #label: 'Bottom:'
       
  2163                               #adjust: #left
       
  2164                           )
       
  2165                            #(#InputFieldSpec
       
  2166                               #name: 'fieldCornerY'
       
  2167                               #layout: #(#LayoutFrame 85 0 38 0 135 0 60 0)
       
  2168                               #activeHelpKey: #cornerY
       
  2169                               #tabable: true
       
  2170                               #model: #bottomOffset
       
  2171                               #group: #inputGroup
       
  2172                               #type: #numberOrNil
       
  2173                               #acceptOnLostFocus: true
       
  2174                     #acceptChannel: #acceptChannel
       
  2175                     #modifiedChannel: #modifiedChannel
       
  2176                           )
       
  2177                         )
       
  2178                     )
       
  2179                     #label: 'Corner'
       
  2180                     #labelPosition: #topLeft
       
  2181                 )
       
  2182               )
       
  2183           )
       
  2184       )
       
  2185 
       
  2186     "Modified: / 13.8.1998 / 19:59:16 / cg"
       
  2187 ! !
       
  2188 
       
  2189 !UILayoutTool::Rectangle methodsFor:'accessing'!
       
  2190 
       
  2191 fetch:aView spec:aSpec
       
  2192     "fetch rectangle
       
  2193     "
       
  2194     |origin corner|
       
  2195 
       
  2196     origin := aView computeOrigin.
       
  2197     corner := aView computeCorner.
       
  2198 
       
  2199     (self aspectFor:#leftOffset)   value:(origin x).
       
  2200     (self aspectFor:#rightOffset)  value:(corner x).
       
  2201     (self aspectFor:#topOffset)    value:(origin y).
       
  2202     (self aspectFor:#bottomOffset) value:(corner y).
       
  2203 
       
  2204 
       
  2205 !
       
  2206 
       
  2207 layout
       
  2208     "returns current layout as rectangle
       
  2209     "
       
  2210   ^ Smalltalk::Rectangle left:(((self aspectFor:#leftOffset)   value) ? 0)
       
  2211                           top:(((self aspectFor:#topOffset)    value) ? 0)
       
  2212                         right:(((self aspectFor:#rightOffset)  value) ? 0)
       
  2213                        bottom:(((self aspectFor:#bottomOffset) value) ? 0)
       
  2214 
       
  2215 
       
  2216 ! !
       
  2217 
       
  2218 !UILayoutTool class methodsFor:'documentation'!
  2231 !UILayoutTool class methodsFor:'documentation'!
  2219 
  2232 
  2220 version
  2233 version
  2221     ^ '$Header$'
  2234     ^ '$Header$'
  2222 ! !
  2235 ! !