UILayoutTool.st
changeset 1268 1bc516d840bf
parent 1198 6b7cfe55105b
child 1304 c4a9211a6ec7
equal deleted inserted replaced
1267:db910ada83f7 1268:1bc516d840bf
    18 	classVariableNames:''
    18 	classVariableNames:''
    19 	poolDictionaries:''
    19 	poolDictionaries:''
    20 	category:'Interface-UIPainter'
    20 	category:'Interface-UIPainter'
    21 !
    21 !
    22 
    22 
       
    23 ApplicationModel subclass:#LayoutFrame
       
    24 	instanceVariableNames:''
       
    25 	classVariableNames:''
       
    26 	poolDictionaries:''
       
    27 	privateIn:UILayoutTool
       
    28 !
       
    29 
    23 ApplicationModel subclass:#LayoutOrigin
    30 ApplicationModel subclass:#LayoutOrigin
    24 	instanceVariableNames:''
    31 	instanceVariableNames:''
    25 	classVariableNames:''
    32 	classVariableNames:''
    26 	poolDictionaries:''
    33 	poolDictionaries:''
    27 	privateIn:UILayoutTool
    34 	privateIn:UILayoutTool
    28 !
    35 !
    29 
    36 
    30 ApplicationModel subclass:#Rectangle
    37 ApplicationModel subclass:#Point
       
    38 	instanceVariableNames:''
       
    39 	classVariableNames:''
       
    40 	poolDictionaries:''
       
    41 	privateIn:UILayoutTool
       
    42 !
       
    43 
       
    44 ApplicationModel subclass:#AlignmentOrigin
    31 	instanceVariableNames:''
    45 	instanceVariableNames:''
    32 	classVariableNames:''
    46 	classVariableNames:''
    33 	poolDictionaries:''
    47 	poolDictionaries:''
    34 	privateIn:UILayoutTool
    48 	privateIn:UILayoutTool
    35 !
    49 !
    39 	classVariableNames:''
    53 	classVariableNames:''
    40 	poolDictionaries:''
    54 	poolDictionaries:''
    41 	privateIn:UILayoutTool
    55 	privateIn:UILayoutTool
    42 !
    56 !
    43 
    57 
    44 ApplicationModel subclass:#AlignmentOrigin
    58 ApplicationModel subclass:#Rectangle
    45 	instanceVariableNames:''
       
    46 	classVariableNames:''
       
    47 	poolDictionaries:''
       
    48 	privateIn:UILayoutTool
       
    49 !
       
    50 
       
    51 ApplicationModel subclass:#Point
       
    52 	instanceVariableNames:''
       
    53 	classVariableNames:''
       
    54 	poolDictionaries:''
       
    55 	privateIn:UILayoutTool
       
    56 !
       
    57 
       
    58 ApplicationModel subclass:#LayoutFrame
       
    59 	instanceVariableNames:''
    59 	instanceVariableNames:''
    60 	classVariableNames:''
    60 	classVariableNames:''
    61 	poolDictionaries:''
    61 	poolDictionaries:''
    62 	privateIn:UILayoutTool
    62 	privateIn:UILayoutTool
    63 !
    63 !
   717     #(  bottomFraction          bottomOffset
   717     #(  bottomFraction          bottomOffset
   718         leftFraction            leftOffset
   718         leftFraction            leftOffset
   719         topFraction             topOffset
   719         topFraction             topOffset
   720         rightFraction           rightOffset
   720         rightFraction           rightOffset
   721         leftAlignmentFraction   topAlignmentFraction
   721         leftAlignmentFraction   topAlignmentFraction
   722         useDefaultExtent
   722         (useDefaultExtent     false)
   723         defaultExtentEnabled
   723         (defaultExtentEnabled false)
   724     )
   724     )
   725 
   725 
   726     do:[:aKey||holder|
   726     do:[:aKeyOrPair| |holder key val|
   727         holder := ValueHolder new.
   727         (key := aKeyOrPair) isSymbol ifFalse:[
       
   728             key := aKeyOrPair first.
       
   729             val := aKeyOrPair second
       
   730         ].
       
   731         holder := val asValue.
   728         holder addDependent:self.
   732         holder addDependent:self.
   729         aspects at:aKey put:holder.
   733         aspects at:key put:holder.
   730     ].
   734     ].
   731 
   735 
   732     slices  := self class slices.
   736     slices  := self class slices.
   733     size    := slices size - 1.
   737     size    := slices size - 1.
   734     tabList := Array new:size.
   738     tabList := Array new:size.
   781         appl notNil ifTrue:[
   785         appl notNil ifTrue:[
   782             noteBook scrolledView allViewBackground:(noteBook viewBackground).
   786             noteBook scrolledView allViewBackground:(noteBook viewBackground).
   783         ]
   787         ]
   784     ].
   788     ].
   785     self update
   789     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)
       
  1138 
       
  1139 ! !
       
  1140 
       
  1141 !UILayoutTool::AlignmentOrigin class methodsFor:'help 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::AlignmentOrigin    
       
  1152     "
       
  1153 
       
  1154     <resource: #help>
       
  1155 
       
  1156     ^super helpSpec addPairsFrom:#(
       
  1157 
       
  1158 #alignBottomCenter
       
  1159 'Aligns the selected widget bottomCenter to location.'
       
  1160 
       
  1161 #alignBottomLeft
       
  1162 'Aligns the selected widget bottomLeft to location.'
       
  1163 
       
  1164 #alignBottomRight
       
  1165 'Aligns the selected widget bottomRight to location.'
       
  1166 
       
  1167 #alignCenter
       
  1168 'Aligns the selected widget center to location.'
       
  1169 
       
  1170 #alignHorizontal
       
  1171 'Horizontal inset to the location point of the selected widget.'
       
  1172 
       
  1173 #alignLeftCenter
       
  1174 'Aligns the selected widget leftCenter to location.'
       
  1175 
       
  1176 #alignRightCenter
       
  1177 'Aligns the selected widget rightCenter to location.'
       
  1178 
       
  1179 #alignTopCenter
       
  1180 'Aligns the selected widget topCenter to location.'
       
  1181 
       
  1182 #alignTopLeft
       
  1183 'Aligns the selected widget topLeft to location.'
       
  1184 
       
  1185 #alignTopRight
       
  1186 'Aligns the selected widget topRight to location.'
       
  1187 
       
  1188 #alignVertical
       
  1189 'Vertical inset to the location point of the widget.'
       
  1190 
       
  1191 )
       
  1192 ! !
       
  1193 
       
  1194 !UILayoutTool::AlignmentOrigin class methodsFor:'interface specs'!
       
  1195 
       
  1196 windowSpec
       
  1197     "This resource specification was automatically generated
       
  1198      by the UIPainter of ST/X."
       
  1199 
       
  1200     "Do not manually edit this!! If it is corrupted,
       
  1201      the UIPainter may not be able to read the specification."
       
  1202 
       
  1203     "
       
  1204      UIPainter new openOnClass:UILayoutTool::AlignmentOrigin andSelector:#windowSpec
       
  1205      UILayoutTool::AlignmentOrigin new openInterface:#windowSpec
       
  1206      UILayoutTool::AlignmentOrigin open
       
  1207     "
       
  1208 
       
  1209     <resource: #canvas>
       
  1210 
       
  1211     ^
       
  1212      
       
  1213        #(#FullSpec
       
  1214           #window: 
       
  1215            #(#WindowSpec
       
  1216               #name: 'UILayoutTool-AlignmentOrigin'
       
  1217               #layout: #(#LayoutFrame 291 0 130 0 695 0 336 0)
       
  1218               #label: 'UILayoutTool-AlignmentOrigin'
       
  1219               #min: #(#Point 10 10)
       
  1220               #max: #(#Point 1152 900)
       
  1221               #bounds: #(#Rectangle 291 130 696 337)
       
  1222               #usePreferredExtent: false
       
  1223           )
       
  1224           #component: 
       
  1225            #(#SpecCollection
       
  1226               #collection: 
       
  1227                #(
       
  1228                  #(#UISubSpecification
       
  1229                     #name: 'layoutOriginSpec'
       
  1230                     #layout: #(#LayoutFrame 1 0.0 6 0 0 1.0 111 0)
       
  1231                     #majorKey: #UILayoutTool
       
  1232                     #minorKey: #layoutOriginSpec
       
  1233                 )
       
  1234                  #(#FramedBoxSpec
       
  1235                     #name: 'FramedBox'
       
  1236                     #layout: #(#LayoutFrame 1 0.0 113 0 0 1.0 208 0)
       
  1237                     #component: 
       
  1238                      #(#SpecCollection
       
  1239                         #collection: 
       
  1240                          #(
       
  1241                            #(#LabelSpec
       
  1242                               #name: 'alignHLabel'
       
  1243                               #layout: #(#AlignmentOrigin 88 0 17 0 1 0)
       
  1244                               #label: 'Horizontal:'
       
  1245                               #adjust: #right
       
  1246                           )
       
  1247                            #(#LabelSpec
       
  1248                               #name: 'alignVLabel'
       
  1249                               #layout: #(#AlignmentOrigin 88 0 43 0 1 0)
       
  1250                               #label: 'Vertical:'
       
  1251                               #adjust: #right
       
  1252                           )
       
  1253                            #(#InputFieldSpec
       
  1254                               #name: 'leftAlignmentFractionField'
       
  1255                               #layout: #(#LayoutFrame 90 0 14 0 147 0 36 0)
       
  1256                               #activeHelpKey: #alignHorizontal
       
  1257                               #tabable: true
       
  1258                               #model: #leftAlignmentFraction
       
  1259                               #group: #inputGroup
       
  1260                               #type: #numberOrNil
       
  1261                               #acceptOnLostFocus: true
       
  1262                     #acceptChannel: #acceptChannel
       
  1263                     #modifiedChannel: #modifiedChannel
       
  1264                           )
       
  1265                            #(#InputFieldSpec
       
  1266                               #name: 'topAlignmentFractionField'
       
  1267                               #layout: #(#LayoutFrame 90 0 40 0 147 0 62 0)
       
  1268                               #activeHelpKey: #alignVertical
       
  1269                               #tabable: true
       
  1270                               #model: #topAlignmentFraction
       
  1271                               #group: #inputGroup
       
  1272                               #type: #numberOrNil
       
  1273                               #acceptOnLostFocus: true
       
  1274                     #acceptChannel: #acceptChannel
       
  1275                     #modifiedChannel: #modifiedChannel
       
  1276                           )
       
  1277                            #(#DividerSpec
       
  1278                               #name: 'separator1'
       
  1279                               #layout: #(#LayoutFrame 204 0 19 0 245 0 22 0)
       
  1280                           )
       
  1281                            #(#DividerSpec
       
  1282                               #name: 'separator2'
       
  1283                               #layout: #(#LayoutFrame 204 0 55 0 245 0 58 0)
       
  1284                           )
       
  1285                            #(#DividerSpec
       
  1286                               #name: 'separator3'
       
  1287                               #layout: #(#LayoutFrame 196 0 28 0 199 0 50 0)
       
  1288                               #orientation: #vertical
       
  1289                           )
       
  1290                            #(#DividerSpec
       
  1291                               #name: 'separator4'
       
  1292                               #layout: #(#LayoutFrame 250 0 28 0 253 0 50 0)
       
  1293                               #orientation: #vertical
       
  1294                           )
       
  1295                            #(#ActionButtonSpec
       
  1296                               #name: 'alignBottomRight'
       
  1297                               #layout: #(#LayoutFrame 245 0 50 0 259 0 64 0)
       
  1298                               #activeHelpKey: #alignBottomRight
       
  1299                               #model: #alignBottomRight
       
  1300                           )
       
  1301                            #(#ActionButtonSpec
       
  1302                               #name: 'alignTopLeft'
       
  1303                               #layout: #(#LayoutFrame 190 0 14 0 204 0 28 0)
       
  1304                               #activeHelpKey: #alignTopLeft
       
  1305                               #model: #alignTopLeft
       
  1306                           )
       
  1307                            #(#ActionButtonSpec
       
  1308                               #name: 'alignTopRight'
       
  1309                               #layout: #(#LayoutFrame 245 0 14 0 259 0 28 0)
       
  1310                               #activeHelpKey: #alignTopRight
       
  1311                               #model: #alignTopRight
       
  1312                           )
       
  1313                            #(#ActionButtonSpec
       
  1314                               #name: 'alignBottomLeft'
       
  1315                               #layout: #(#LayoutFrame 190 0 50 0 204 0 64 0)
       
  1316                               #activeHelpKey: #alignBottomLeft
       
  1317                               #model: #alignBottomLeft
       
  1318                           )
       
  1319                            #(#ActionButtonSpec
       
  1320                               #name: 'alignTopCenter'
       
  1321                               #layout: #(#LayoutFrame 217 0 14 0 231 0 28 0)
       
  1322                               #activeHelpKey: #alignTopCenter
       
  1323                               #model: #alignTopCenter
       
  1324                           )
       
  1325                            #(#ActionButtonSpec
       
  1326                               #name: 'alignBottomCenter'
       
  1327                               #layout: #(#LayoutFrame 217 0 50 0 231 0 64 0)
       
  1328                               #activeHelpKey: #alignBottomCenter
       
  1329                               #model: #alignBottomCenter
       
  1330                           )
       
  1331                            #(#ActionButtonSpec
       
  1332                               #name: 'alignLeftCenter'
       
  1333                               #layout: #(#LayoutFrame 190 0 32 0 204 0 46 0)
       
  1334                               #activeHelpKey: #alignLeftCenter
       
  1335                               #model: #alignLeftCenter
       
  1336                           )
       
  1337                            #(#ActionButtonSpec
       
  1338                               #name: 'alignRightCenter'
       
  1339                               #layout: #(#LayoutFrame 245 0 32 0 259 0 46 0)
       
  1340                               #activeHelpKey: #alignRightCenter
       
  1341                               #model: #alignRightCenter
       
  1342                           )
       
  1343                            #(#ActionButtonSpec
       
  1344                               #name: 'alignCenter'
       
  1345                               #layout: #(#LayoutFrame 217 0 32 0 231 0 46 0)
       
  1346                               #activeHelpKey: #alignCenter
       
  1347                               #model: #alignCenter
       
  1348                           )
       
  1349                         )
       
  1350                     )
       
  1351                     #label: 'Alignment'
       
  1352                     #labelPosition: #topLeft
       
  1353                 )
       
  1354               )
       
  1355           )
       
  1356       )
       
  1357 
       
  1358     "Modified: / 13.8.1998 / 19:57:47 / cg"
       
  1359 ! !
       
  1360 
       
  1361 !UILayoutTool::AlignmentOrigin methodsFor:'accessing'!
       
  1362 
       
  1363 fetch:aView spec:aSpec
       
  1364     "fetch alignmentOrigin
       
  1365     "
       
  1366     |layout type 
       
  1367      leftAlignmentFractionHolder topAlignmentFractionHolder
       
  1368      leftOffsetHolder leftFractionHolder topOffsetHolder topFractionHolder|
       
  1369 
       
  1370     type   := UIPainterView layoutType:aView.
       
  1371     layout := aView geometryLayout.
       
  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 
       
  1380     layout isLayout ifTrue:[
       
  1381         leftOffsetHolder   value:(layout leftOffset).
       
  1382         leftFractionHolder value:(layout leftFraction).
       
  1383         topOffsetHolder    value:(layout topOffset).
       
  1384         topFractionHolder  value:(layout topFraction).
       
  1385 
       
  1386         type == #AlignmentOrigin ifTrue:[
       
  1387             leftAlignmentFractionHolder value:(layout leftAlignmentFraction).
       
  1388             topAlignmentFractionHolder  value:(layout topAlignmentFraction).
       
  1389           ^ self
       
  1390         ]
       
  1391     ] ifFalse:[
       
  1392         layout := aView computeOrigin.
       
  1393 
       
  1394         leftOffsetHolder   value:(layout x).
       
  1395         leftFractionHolder value:0.
       
  1396         topOffsetHolder    value:(layout y).
       
  1397         topFractionHolder  value:0.
       
  1398     ].
       
  1399     leftAlignmentFractionHolder value:0.
       
  1400     topAlignmentFractionHolder  value:0.
       
  1401 
       
  1402 
       
  1403 !
       
  1404 
       
  1405 layout
       
  1406     "returns current layout as alignmentOrigin
       
  1407     "
       
  1408     |layout|
       
  1409 
       
  1410     layout  := Smalltalk::AlignmentOrigin new.
       
  1411 
       
  1412     layout   leftOffset:((self aspectFor:#leftOffset)   value) ? 0.
       
  1413     layout    topOffset:((self aspectFor:#topOffset)    value) ? 0.
       
  1414     layout leftFraction:((self aspectFor:#leftFraction) value) ? 0.
       
  1415     layout  topFraction:((self aspectFor:#topFraction)  value) ? 0.
       
  1416 
       
  1417     layout leftAlignmentFraction:((self aspectFor:#leftAlignmentFraction) value) ? 0.
       
  1418     layout  topAlignmentFraction:((self aspectFor:#topAlignmentFraction)  value) ? 0.
       
  1419 
       
  1420   ^ layout
       
  1421 ! !
       
  1422 
       
  1423 !UILayoutTool::AlignmentOrigin methodsFor:'alignment'!
       
  1424 
       
  1425 alignBottomCenter
       
  1426     self makeAlignLeft:0.5 top:1
       
  1427 
       
  1428 
       
  1429 !
       
  1430 
       
  1431 alignBottomLeft
       
  1432     self makeAlignLeft:0 top:1
       
  1433 
       
  1434 
       
  1435 !
       
  1436 
       
  1437 alignBottomRight
       
  1438     self makeAlignLeft:1 top:1
       
  1439 
       
  1440 
       
  1441 !
       
  1442 
       
  1443 alignCenter
       
  1444     self makeAlignLeft:0.5 top:0.5
       
  1445 
       
  1446 
       
  1447 !
       
  1448 
       
  1449 alignLeftCenter
       
  1450     self makeAlignLeft:0 top:0.5
       
  1451 
       
  1452 
       
  1453 !
       
  1454 
       
  1455 alignRightCenter
       
  1456     self makeAlignLeft:1 top:0.5
       
  1457 
       
  1458 
       
  1459 !
       
  1460 
       
  1461 alignTopCenter
       
  1462     self makeAlignLeft:0.5 top:0
       
  1463 
       
  1464 
       
  1465 !
       
  1466 
       
  1467 alignTopLeft
       
  1468     self makeAlignLeft:0 top:0
       
  1469 
       
  1470 
       
  1471 !
       
  1472 
       
  1473 alignTopRight
       
  1474     self makeAlignLeft:1 top:0
       
  1475 
       
  1476 
       
  1477 !
       
  1478 
       
  1479 makeAlignLeft:leftAlignmentFraction top:topAlignmentFraction
       
  1480     |lAF tAF lO tO ext lAHolder tAHolder lOHolder tOHolder|
       
  1481 
       
  1482     lAF     := (lAHolder := self aspectFor:#leftAlignmentFraction) value ? 0.
       
  1483     tAF     := (tAHolder := self aspectFor:#topAlignmentFraction)  value ? 0.
       
  1484     ext     := (self aspectFor:#layoutView) computeExtent.
       
  1485 
       
  1486     lAHolder value:leftAlignmentFraction.
       
  1487     tAHolder  value:topAlignmentFraction.
       
  1488 
       
  1489     lO := (lOHolder := self aspectFor:#leftOffset) value ? 0.
       
  1490     tO := (tOHolder := self aspectFor:#topOffset)  value ? 0.
       
  1491 
       
  1492     lO := lO + (ext x * (leftAlignmentFraction - lAF)).
       
  1493     tO := tO + (ext y * (topAlignmentFraction  - tAF)).
       
  1494 
       
  1495     lOHolder value:(lO rounded).
       
  1496     tOHolder value:(tO rounded).
       
  1497 
       
  1498 !
       
  1499 
       
  1500 makeAlignTopRight
       
  1501     self makeAlignLeft:1 top:0
       
  1502 
       
  1503 
       
  1504 ! !
       
  1505 
       
  1506 !UILayoutTool::Point class methodsFor:'interface specs'!
       
  1507 
       
  1508 windowSpec
       
  1509     "This resource specification was automatically generated
       
  1510      by the UIPainter of ST/X."
       
  1511 
       
  1512     "Do not manually edit this!! If it is corrupted,
       
  1513      the UIPainter may not be able to read the specification."
       
  1514 
       
  1515     "
       
  1516      UIPainter new openOnClass:UILayoutTool::Point andSelector:#windowSpec
       
  1517      UILayoutTool::Point new openInterface:#windowSpec
       
  1518      UILayoutTool::Point open
       
  1519     "
       
  1520 
       
  1521     <resource: #canvas>
       
  1522 
       
  1523     ^
       
  1524      
       
  1525        #(#FullSpec
       
  1526           #window: 
       
  1527            #(#WindowSpec
       
  1528               #name: 'UILayoutTool-Point'
       
  1529               #layout: #(#LayoutFrame 324 0 410 0 618 0 547 0)
       
  1530               #label: 'UILayoutTool-Point'
       
  1531               #min: #(#Point 10 10)
       
  1532               #max: #(#Point 1152 900)
       
  1533               #bounds: #(#Rectangle 324 410 619 548)
       
  1534               #usePreferredExtent: false
       
  1535           )
       
  1536           #component: 
       
  1537            #(#SpecCollection
       
  1538               #collection: 
       
  1539                #(
       
  1540                  #(#UISubSpecification
       
  1541                     #name: 'layoutPointSpec'
       
  1542                     #layout: #(#LayoutFrame 1 0.0 6 0 0 1.0 100 0)
       
  1543                     #majorKey: #UILayoutTool
       
  1544                     #minorKey: #layoutPointSpec
       
  1545                 )
       
  1546               )
       
  1547           )
       
  1548       )
       
  1549 ! !
       
  1550 
       
  1551 !UILayoutTool::Point methodsFor:'accessing'!
       
  1552 
       
  1553 fetch:aView spec:aSpec
       
  1554     "fetch point
       
  1555     "
       
  1556     |origin|
       
  1557 
       
  1558     origin  := aView computeOrigin.
       
  1559 
       
  1560     (self aspectFor:#leftOffset) value:(origin x).
       
  1561     (self aspectFor:#topOffset)  value:(origin y).
       
  1562 
       
  1563 
       
  1564 !
       
  1565 
       
  1566 layout
       
  1567     "returns current layout as point
       
  1568     "
       
  1569   ^ Smalltalk::Point x:(((self aspectFor:#leftOffset) value) ? 0)
       
  1570                      y:(((self aspectFor:#topOffset)  value) ? 0)
       
  1571 
   790 
  1572 ! !
   791 ! !
  1573 
   792 
  1574 !UILayoutTool::LayoutFrame class methodsFor:'help specs'!
   793 !UILayoutTool::LayoutFrame class methodsFor:'help specs'!
  1575 
   794 
  2226         right:1          offset:0 
  1445         right:1          offset:0 
  2227         top:0            offset:0 
  1446         top:0            offset:0 
  2228         bottom:0.5       offset:0
  1447         bottom:0.5       offset:0
  2229 ! !
  1448 ! !
  2230 
  1449 
       
  1450 !UILayoutTool::LayoutOrigin class methodsFor:'interface specs'!
       
  1451 
       
  1452 windowSpec
       
  1453     "This resource specification was automatically generated
       
  1454      by the UIPainter of ST/X."
       
  1455 
       
  1456     "Do not manually edit this!! If it is corrupted,
       
  1457      the UIPainter may not be able to read the specification."
       
  1458 
       
  1459     "
       
  1460      UIPainter new openOnClass:UILayoutTool::LayoutOrigin andSelector:#windowSpec
       
  1461      UILayoutTool::LayoutOrigin new openInterface:#windowSpec
       
  1462      UILayoutTool::LayoutOrigin open
       
  1463     "
       
  1464 
       
  1465     <resource: #canvas>
       
  1466 
       
  1467     ^
       
  1468      
       
  1469        #(#FullSpec
       
  1470           #window: 
       
  1471            #(#WindowSpec
       
  1472               #name: 'UILayoutTool-LayoutOrigin'
       
  1473               #layout: #(#LayoutFrame 290 0 420 0 647 0 565 0)
       
  1474               #label: 'UILayoutTool-LayoutOrigin'
       
  1475               #min: #(#Point 10 10)
       
  1476               #max: #(#Point 1152 900)
       
  1477               #bounds: #(#Rectangle 290 420 648 566)
       
  1478               #usePreferredExtent: false
       
  1479           )
       
  1480           #component: 
       
  1481            #(#SpecCollection
       
  1482               #collection: 
       
  1483                #(
       
  1484                  #(#UISubSpecification
       
  1485                     #name: 'layoutOriginSpec'
       
  1486                     #layout: #(#LayoutFrame 1 0.0 6 0 0 1.0 110 0)
       
  1487                     #majorKey: #UILayoutTool
       
  1488                     #minorKey: #layoutOriginSpec
       
  1489                 )
       
  1490               )
       
  1491           )
       
  1492       )
       
  1493 ! !
       
  1494 
       
  1495 !UILayoutTool::LayoutOrigin methodsFor:'accessing'!
       
  1496 
       
  1497 fetch:aView spec:aSpec
       
  1498     "fetch layoutOrigin
       
  1499     "
       
  1500     |layout|
       
  1501 
       
  1502     layout  := UIPainterView asLayoutFrameFromView:aView.
       
  1503 
       
  1504     (self aspectFor:#leftOffset)   value:(layout leftOffset).
       
  1505     (self aspectFor:#leftFraction) value:(layout leftFraction).
       
  1506     (self aspectFor:#topOffset)    value:(layout topOffset).
       
  1507     (self aspectFor:#topFraction)  value:(layout topFraction).
       
  1508 
       
  1509 
       
  1510 !
       
  1511 
       
  1512 layout
       
  1513     "returns current layout as layoutOrigin
       
  1514     "
       
  1515     |layout|
       
  1516 
       
  1517     layout  := Smalltalk::LayoutOrigin new.
       
  1518 
       
  1519     layout   leftOffset:((self aspectFor:#leftOffset)   value) ? 0.
       
  1520     layout    topOffset:((self aspectFor:#topOffset)    value) ? 0.
       
  1521     layout leftFraction:((self aspectFor:#leftFraction) value) ? 0.
       
  1522     layout  topFraction:((self aspectFor:#topFraction)  value) ? 0.
       
  1523 
       
  1524   ^ layout
       
  1525 
       
  1526 ! !
       
  1527 
       
  1528 !UILayoutTool::Point class methodsFor:'interface specs'!
       
  1529 
       
  1530 windowSpec
       
  1531     "This resource specification was automatically generated
       
  1532      by the UIPainter of ST/X."
       
  1533 
       
  1534     "Do not manually edit this!! If it is corrupted,
       
  1535      the UIPainter may not be able to read the specification."
       
  1536 
       
  1537     "
       
  1538      UIPainter new openOnClass:UILayoutTool::Point andSelector:#windowSpec
       
  1539      UILayoutTool::Point new openInterface:#windowSpec
       
  1540      UILayoutTool::Point open
       
  1541     "
       
  1542 
       
  1543     <resource: #canvas>
       
  1544 
       
  1545     ^
       
  1546      
       
  1547        #(#FullSpec
       
  1548           #window: 
       
  1549            #(#WindowSpec
       
  1550               #name: 'UILayoutTool-Point'
       
  1551               #layout: #(#LayoutFrame 324 0 410 0 618 0 547 0)
       
  1552               #label: 'UILayoutTool-Point'
       
  1553               #min: #(#Point 10 10)
       
  1554               #max: #(#Point 1152 900)
       
  1555               #bounds: #(#Rectangle 324 410 619 548)
       
  1556               #usePreferredExtent: false
       
  1557           )
       
  1558           #component: 
       
  1559            #(#SpecCollection
       
  1560               #collection: 
       
  1561                #(
       
  1562                  #(#UISubSpecification
       
  1563                     #name: 'layoutPointSpec'
       
  1564                     #layout: #(#LayoutFrame 1 0.0 6 0 0 1.0 100 0)
       
  1565                     #majorKey: #UILayoutTool
       
  1566                     #minorKey: #layoutPointSpec
       
  1567                 )
       
  1568               )
       
  1569           )
       
  1570       )
       
  1571 ! !
       
  1572 
       
  1573 !UILayoutTool::Point methodsFor:'accessing'!
       
  1574 
       
  1575 fetch:aView spec:aSpec
       
  1576     "fetch point
       
  1577     "
       
  1578     |origin|
       
  1579 
       
  1580     origin  := aView computeOrigin.
       
  1581 
       
  1582     (self aspectFor:#leftOffset) value:(origin x).
       
  1583     (self aspectFor:#topOffset)  value:(origin y).
       
  1584 
       
  1585 
       
  1586 !
       
  1587 
       
  1588 layout
       
  1589     "returns current layout as point
       
  1590     "
       
  1591   ^ Smalltalk::Point x:(((self aspectFor:#leftOffset) value) ? 0)
       
  1592                      y:(((self aspectFor:#topOffset)  value) ? 0)
       
  1593 
       
  1594 ! !
       
  1595 
       
  1596 !UILayoutTool::AlignmentOrigin class methodsFor:'help specs'!
       
  1597 
       
  1598 helpSpec
       
  1599     "This resource specification was automatically generated
       
  1600      by the UIHelpTool of ST/X."
       
  1601 
       
  1602     "Do not manually edit this!! If it is corrupted,
       
  1603      the UIHelpTool may not be able to read the specification."
       
  1604 
       
  1605     "
       
  1606      UIHelpTool openOnClass:UILayoutTool::AlignmentOrigin    
       
  1607     "
       
  1608 
       
  1609     <resource: #help>
       
  1610 
       
  1611     ^super helpSpec addPairsFrom:#(
       
  1612 
       
  1613 #alignBottomCenter
       
  1614 'Aligns the selected widget bottomCenter to location.'
       
  1615 
       
  1616 #alignBottomLeft
       
  1617 'Aligns the selected widget bottomLeft to location.'
       
  1618 
       
  1619 #alignBottomRight
       
  1620 'Aligns the selected widget bottomRight to location.'
       
  1621 
       
  1622 #alignCenter
       
  1623 'Aligns the selected widget center to location.'
       
  1624 
       
  1625 #alignHorizontal
       
  1626 'Horizontal inset to the location point of the selected widget.'
       
  1627 
       
  1628 #alignLeftCenter
       
  1629 'Aligns the selected widget leftCenter to location.'
       
  1630 
       
  1631 #alignRightCenter
       
  1632 'Aligns the selected widget rightCenter to location.'
       
  1633 
       
  1634 #alignTopCenter
       
  1635 'Aligns the selected widget topCenter to location.'
       
  1636 
       
  1637 #alignTopLeft
       
  1638 'Aligns the selected widget topLeft to location.'
       
  1639 
       
  1640 #alignTopRight
       
  1641 'Aligns the selected widget topRight to location.'
       
  1642 
       
  1643 #alignVertical
       
  1644 'Vertical inset to the location point of the widget.'
       
  1645 
       
  1646 )
       
  1647 ! !
       
  1648 
       
  1649 !UILayoutTool::AlignmentOrigin class methodsFor:'interface specs'!
       
  1650 
       
  1651 windowSpec
       
  1652     "This resource specification was automatically generated
       
  1653      by the UIPainter of ST/X."
       
  1654 
       
  1655     "Do not manually edit this!! If it is corrupted,
       
  1656      the UIPainter may not be able to read the specification."
       
  1657 
       
  1658     "
       
  1659      UIPainter new openOnClass:UILayoutTool::AlignmentOrigin andSelector:#windowSpec
       
  1660      UILayoutTool::AlignmentOrigin new openInterface:#windowSpec
       
  1661      UILayoutTool::AlignmentOrigin open
       
  1662     "
       
  1663 
       
  1664     <resource: #canvas>
       
  1665 
       
  1666     ^
       
  1667      
       
  1668        #(#FullSpec
       
  1669           #window: 
       
  1670            #(#WindowSpec
       
  1671               #name: 'UILayoutTool-AlignmentOrigin'
       
  1672               #layout: #(#LayoutFrame 291 0 130 0 695 0 336 0)
       
  1673               #label: 'UILayoutTool-AlignmentOrigin'
       
  1674               #min: #(#Point 10 10)
       
  1675               #max: #(#Point 1152 900)
       
  1676               #bounds: #(#Rectangle 291 130 696 337)
       
  1677               #usePreferredExtent: false
       
  1678           )
       
  1679           #component: 
       
  1680            #(#SpecCollection
       
  1681               #collection: 
       
  1682                #(
       
  1683                  #(#UISubSpecification
       
  1684                     #name: 'layoutOriginSpec'
       
  1685                     #layout: #(#LayoutFrame 1 0.0 6 0 0 1.0 111 0)
       
  1686                     #majorKey: #UILayoutTool
       
  1687                     #minorKey: #layoutOriginSpec
       
  1688                 )
       
  1689                  #(#FramedBoxSpec
       
  1690                     #name: 'FramedBox'
       
  1691                     #layout: #(#LayoutFrame 1 0.0 113 0 0 1.0 208 0)
       
  1692                     #component: 
       
  1693                      #(#SpecCollection
       
  1694                         #collection: 
       
  1695                          #(
       
  1696                            #(#LabelSpec
       
  1697                               #name: 'alignHLabel'
       
  1698                               #layout: #(#AlignmentOrigin 88 0 17 0 1 0)
       
  1699                               #label: 'Horizontal:'
       
  1700                               #adjust: #right
       
  1701                           )
       
  1702                            #(#LabelSpec
       
  1703                               #name: 'alignVLabel'
       
  1704                               #layout: #(#AlignmentOrigin 88 0 43 0 1 0)
       
  1705                               #label: 'Vertical:'
       
  1706                               #adjust: #right
       
  1707                           )
       
  1708                            #(#InputFieldSpec
       
  1709                               #name: 'leftAlignmentFractionField'
       
  1710                               #layout: #(#LayoutFrame 90 0 14 0 147 0 36 0)
       
  1711                               #activeHelpKey: #alignHorizontal
       
  1712                               #tabable: true
       
  1713                               #model: #leftAlignmentFraction
       
  1714                               #group: #inputGroup
       
  1715                               #type: #numberOrNil
       
  1716                               #acceptOnLostFocus: true
       
  1717                     #acceptChannel: #acceptChannel
       
  1718                     #modifiedChannel: #modifiedChannel
       
  1719                           )
       
  1720                            #(#InputFieldSpec
       
  1721                               #name: 'topAlignmentFractionField'
       
  1722                               #layout: #(#LayoutFrame 90 0 40 0 147 0 62 0)
       
  1723                               #activeHelpKey: #alignVertical
       
  1724                               #tabable: true
       
  1725                               #model: #topAlignmentFraction
       
  1726                               #group: #inputGroup
       
  1727                               #type: #numberOrNil
       
  1728                               #acceptOnLostFocus: true
       
  1729                     #acceptChannel: #acceptChannel
       
  1730                     #modifiedChannel: #modifiedChannel
       
  1731                           )
       
  1732                            #(#DividerSpec
       
  1733                               #name: 'separator1'
       
  1734                               #layout: #(#LayoutFrame 204 0 19 0 245 0 22 0)
       
  1735                           )
       
  1736                            #(#DividerSpec
       
  1737                               #name: 'separator2'
       
  1738                               #layout: #(#LayoutFrame 204 0 55 0 245 0 58 0)
       
  1739                           )
       
  1740                            #(#DividerSpec
       
  1741                               #name: 'separator3'
       
  1742                               #layout: #(#LayoutFrame 196 0 28 0 199 0 50 0)
       
  1743                               #orientation: #vertical
       
  1744                           )
       
  1745                            #(#DividerSpec
       
  1746                               #name: 'separator4'
       
  1747                               #layout: #(#LayoutFrame 250 0 28 0 253 0 50 0)
       
  1748                               #orientation: #vertical
       
  1749                           )
       
  1750                            #(#ActionButtonSpec
       
  1751                               #name: 'alignBottomRight'
       
  1752                               #layout: #(#LayoutFrame 245 0 50 0 259 0 64 0)
       
  1753                               #activeHelpKey: #alignBottomRight
       
  1754                               #model: #alignBottomRight
       
  1755                           )
       
  1756                            #(#ActionButtonSpec
       
  1757                               #name: 'alignTopLeft'
       
  1758                               #layout: #(#LayoutFrame 190 0 14 0 204 0 28 0)
       
  1759                               #activeHelpKey: #alignTopLeft
       
  1760                               #model: #alignTopLeft
       
  1761                           )
       
  1762                            #(#ActionButtonSpec
       
  1763                               #name: 'alignTopRight'
       
  1764                               #layout: #(#LayoutFrame 245 0 14 0 259 0 28 0)
       
  1765                               #activeHelpKey: #alignTopRight
       
  1766                               #model: #alignTopRight
       
  1767                           )
       
  1768                            #(#ActionButtonSpec
       
  1769                               #name: 'alignBottomLeft'
       
  1770                               #layout: #(#LayoutFrame 190 0 50 0 204 0 64 0)
       
  1771                               #activeHelpKey: #alignBottomLeft
       
  1772                               #model: #alignBottomLeft
       
  1773                           )
       
  1774                            #(#ActionButtonSpec
       
  1775                               #name: 'alignTopCenter'
       
  1776                               #layout: #(#LayoutFrame 217 0 14 0 231 0 28 0)
       
  1777                               #activeHelpKey: #alignTopCenter
       
  1778                               #model: #alignTopCenter
       
  1779                           )
       
  1780                            #(#ActionButtonSpec
       
  1781                               #name: 'alignBottomCenter'
       
  1782                               #layout: #(#LayoutFrame 217 0 50 0 231 0 64 0)
       
  1783                               #activeHelpKey: #alignBottomCenter
       
  1784                               #model: #alignBottomCenter
       
  1785                           )
       
  1786                            #(#ActionButtonSpec
       
  1787                               #name: 'alignLeftCenter'
       
  1788                               #layout: #(#LayoutFrame 190 0 32 0 204 0 46 0)
       
  1789                               #activeHelpKey: #alignLeftCenter
       
  1790                               #model: #alignLeftCenter
       
  1791                           )
       
  1792                            #(#ActionButtonSpec
       
  1793                               #name: 'alignRightCenter'
       
  1794                               #layout: #(#LayoutFrame 245 0 32 0 259 0 46 0)
       
  1795                               #activeHelpKey: #alignRightCenter
       
  1796                               #model: #alignRightCenter
       
  1797                           )
       
  1798                            #(#ActionButtonSpec
       
  1799                               #name: 'alignCenter'
       
  1800                               #layout: #(#LayoutFrame 217 0 32 0 231 0 46 0)
       
  1801                               #activeHelpKey: #alignCenter
       
  1802                               #model: #alignCenter
       
  1803                           )
       
  1804                         )
       
  1805                     )
       
  1806                     #label: 'Alignment'
       
  1807                     #labelPosition: #topLeft
       
  1808                 )
       
  1809               )
       
  1810           )
       
  1811       )
       
  1812 
       
  1813     "Modified: / 13.8.1998 / 19:57:47 / cg"
       
  1814 ! !
       
  1815 
       
  1816 !UILayoutTool::AlignmentOrigin methodsFor:'accessing'!
       
  1817 
       
  1818 fetch:aView spec:aSpec
       
  1819     "fetch alignmentOrigin
       
  1820     "
       
  1821     |layout type 
       
  1822      leftAlignmentFractionHolder topAlignmentFractionHolder
       
  1823      leftOffsetHolder leftFractionHolder topOffsetHolder topFractionHolder|
       
  1824 
       
  1825     type   := UIPainterView layoutType:aView.
       
  1826     layout := aView geometryLayout.
       
  1827 
       
  1828     leftOffsetHolder := (self aspectFor:#leftOffset).
       
  1829     leftFractionHolder := (self aspectFor:#leftFraction).
       
  1830     topOffsetHolder := (self aspectFor:#topOffset).
       
  1831     topFractionHolder := (self aspectFor:#topFraction).
       
  1832     leftAlignmentFractionHolder := (self aspectFor:#leftAlignmentFraction).
       
  1833     topAlignmentFractionHolder := (self aspectFor:#topAlignmentFraction).
       
  1834 
       
  1835     layout isLayout ifTrue:[
       
  1836         leftOffsetHolder   value:(layout leftOffset).
       
  1837         leftFractionHolder value:(layout leftFraction).
       
  1838         topOffsetHolder    value:(layout topOffset).
       
  1839         topFractionHolder  value:(layout topFraction).
       
  1840 
       
  1841         type == #AlignmentOrigin ifTrue:[
       
  1842             leftAlignmentFractionHolder value:(layout leftAlignmentFraction).
       
  1843             topAlignmentFractionHolder  value:(layout topAlignmentFraction).
       
  1844           ^ self
       
  1845         ]
       
  1846     ] ifFalse:[
       
  1847         layout := aView computeOrigin.
       
  1848 
       
  1849         leftOffsetHolder   value:(layout x).
       
  1850         leftFractionHolder value:0.
       
  1851         topOffsetHolder    value:(layout y).
       
  1852         topFractionHolder  value:0.
       
  1853     ].
       
  1854     leftAlignmentFractionHolder value:0.
       
  1855     topAlignmentFractionHolder  value:0.
       
  1856 
       
  1857 
       
  1858 !
       
  1859 
       
  1860 layout
       
  1861     "returns current layout as alignmentOrigin
       
  1862     "
       
  1863     |layout|
       
  1864 
       
  1865     layout  := Smalltalk::AlignmentOrigin new.
       
  1866 
       
  1867     layout   leftOffset:((self aspectFor:#leftOffset)   value) ? 0.
       
  1868     layout    topOffset:((self aspectFor:#topOffset)    value) ? 0.
       
  1869     layout leftFraction:((self aspectFor:#leftFraction) value) ? 0.
       
  1870     layout  topFraction:((self aspectFor:#topFraction)  value) ? 0.
       
  1871 
       
  1872     layout leftAlignmentFraction:((self aspectFor:#leftAlignmentFraction) value) ? 0.
       
  1873     layout  topAlignmentFraction:((self aspectFor:#topAlignmentFraction)  value) ? 0.
       
  1874 
       
  1875   ^ layout
       
  1876 ! !
       
  1877 
       
  1878 !UILayoutTool::AlignmentOrigin methodsFor:'alignment'!
       
  1879 
       
  1880 alignBottomCenter
       
  1881     self makeAlignLeft:0.5 top:1
       
  1882 
       
  1883 
       
  1884 !
       
  1885 
       
  1886 alignBottomLeft
       
  1887     self makeAlignLeft:0 top:1
       
  1888 
       
  1889 
       
  1890 !
       
  1891 
       
  1892 alignBottomRight
       
  1893     self makeAlignLeft:1 top:1
       
  1894 
       
  1895 
       
  1896 !
       
  1897 
       
  1898 alignCenter
       
  1899     self makeAlignLeft:0.5 top:0.5
       
  1900 
       
  1901 
       
  1902 !
       
  1903 
       
  1904 alignLeftCenter
       
  1905     self makeAlignLeft:0 top:0.5
       
  1906 
       
  1907 
       
  1908 !
       
  1909 
       
  1910 alignRightCenter
       
  1911     self makeAlignLeft:1 top:0.5
       
  1912 
       
  1913 
       
  1914 !
       
  1915 
       
  1916 alignTopCenter
       
  1917     self makeAlignLeft:0.5 top:0
       
  1918 
       
  1919 
       
  1920 !
       
  1921 
       
  1922 alignTopLeft
       
  1923     self makeAlignLeft:0 top:0
       
  1924 
       
  1925 
       
  1926 !
       
  1927 
       
  1928 alignTopRight
       
  1929     self makeAlignLeft:1 top:0
       
  1930 
       
  1931 
       
  1932 !
       
  1933 
       
  1934 makeAlignLeft:leftAlignmentFraction top:topAlignmentFraction
       
  1935     |lAF tAF lO tO ext lAHolder tAHolder lOHolder tOHolder|
       
  1936 
       
  1937     lAF     := (lAHolder := self aspectFor:#leftAlignmentFraction) value ? 0.
       
  1938     tAF     := (tAHolder := self aspectFor:#topAlignmentFraction)  value ? 0.
       
  1939     ext     := (self aspectFor:#layoutView) computeExtent.
       
  1940 
       
  1941     lAHolder value:leftAlignmentFraction.
       
  1942     tAHolder  value:topAlignmentFraction.
       
  1943 
       
  1944     lO := (lOHolder := self aspectFor:#leftOffset) value ? 0.
       
  1945     tO := (tOHolder := self aspectFor:#topOffset)  value ? 0.
       
  1946 
       
  1947     lO := lO + (ext x * (leftAlignmentFraction - lAF)).
       
  1948     tO := tO + (ext y * (topAlignmentFraction  - tAF)).
       
  1949 
       
  1950     lOHolder value:(lO rounded).
       
  1951     tOHolder value:(tO rounded).
       
  1952 
       
  1953 !
       
  1954 
       
  1955 makeAlignTopRight
       
  1956     self makeAlignLeft:1 top:0
       
  1957 
       
  1958 
       
  1959 ! !
       
  1960 
       
  1961 !UILayoutTool::Extent class methodsFor:'help specs'!
       
  1962 
       
  1963 helpSpec
       
  1964     "This resource specification was automatically generated
       
  1965      by the UIHelpTool of ST/X."
       
  1966 
       
  1967     "Do not manually edit this!! If it is corrupted,
       
  1968      the UIHelpTool may not be able to read the specification."
       
  1969 
       
  1970     "
       
  1971      UIHelpTool openOnClass:UILayoutTool::Extent    
       
  1972     "
       
  1973 
       
  1974     <resource: #help>
       
  1975 
       
  1976     ^super helpSpec addPairsFrom:#(
       
  1977 
       
  1978 #hrzExtent
       
  1979 'Horizontal extent of the selected widget.'
       
  1980 
       
  1981 #vrtExtent
       
  1982 'Vertical extent of the selected widget.'
       
  1983 
       
  1984 )
       
  1985 ! !
       
  1986 
       
  1987 !UILayoutTool::Extent class methodsFor:'interface specs'!
       
  1988 
       
  1989 windowSpec
       
  1990     "This resource specification was automatically generated
       
  1991      by the UIPainter of ST/X."
       
  1992 
       
  1993     "Do not manually edit this!! If it is corrupted,
       
  1994      the UIPainter may not be able to read the specification."
       
  1995 
       
  1996     "
       
  1997      UIPainter new openOnClass:UILayoutTool::Extent andSelector:#windowSpec
       
  1998      UILayoutTool::Extent new openInterface:#windowSpec
       
  1999      UILayoutTool::Extent open
       
  2000     "
       
  2001 
       
  2002     <resource: #canvas>
       
  2003 
       
  2004     ^
       
  2005      
       
  2006        #(#FullSpec
       
  2007           #name: #windowSpec
       
  2008           #window: 
       
  2009            #(#WindowSpec
       
  2010               #name: 'UILayoutTool-Extent'
       
  2011               #layout: #(#LayoutFrame 216 0 173 0 541 0 321 0)
       
  2012               #level: 0
       
  2013               #label: 'UILayoutTool-Extent'
       
  2014               #min: #(#Point 10 10)
       
  2015               #max: #(#Point 1152 900)
       
  2016               #bounds: #(#Rectangle 216 173 542 322)
       
  2017               #usePreferredExtent: false
       
  2018               #returnIsOKInDialog: true
       
  2019               #escapeIsCancelInDialog: true
       
  2020           )
       
  2021           #component: 
       
  2022            #(#SpecCollection
       
  2023               #collection: 
       
  2024                #(
       
  2025                  #(#FramedBoxSpec
       
  2026                     #name: 'FramedBox'
       
  2027                     #layout: #(#LayoutFrame 0 0.0 6 0.0 0 1.0 137 0)
       
  2028                     #component: 
       
  2029                      #(#SpecCollection
       
  2030                         #collection: 
       
  2031                          #(
       
  2032                            #(#LabelSpec
       
  2033                               #name: 'labelWidth'
       
  2034                               #layout: #(#AlignmentOrigin 89 0 24 0 1 0.5)
       
  2035                               #label: 'Width:'
       
  2036                               #adjust: #right
       
  2037                           )
       
  2038                            #(#InputFieldSpec
       
  2039                               #name: 'fieldLeftOffset'
       
  2040                               #layout: #(#LayoutFrame 90 0 13 0 140 0 35 0)
       
  2041                               #activeHelpKey: #hrzExtent
       
  2042                               #enableChannel: #notUsingDefaultExtent
       
  2043                               #tabable: true
       
  2044                               #model: #leftOffset
       
  2045                               #group: #inputGroup
       
  2046                               #type: #numberOrNil
       
  2047                               #acceptOnLostFocus: true
       
  2048                               #acceptChannel: #acceptChannel
       
  2049                               #modifiedChannel: #modifiedChannel
       
  2050                           )
       
  2051                            #(#LabelSpec
       
  2052                               #name: 'labelHeight'
       
  2053                               #layout: #(#AlignmentOrigin 89 0 49 0 1 0.5)
       
  2054                               #label: 'Height:'
       
  2055                               #adjust: #right
       
  2056                           )
       
  2057                            #(#InputFieldSpec
       
  2058                               #name: 'fieldRightOffset'
       
  2059                               #layout: #(#LayoutFrame 90 0 38 0 140 0 60 0)
       
  2060                               #activeHelpKey: #vrtExtent
       
  2061                               #enableChannel: #notUsingDefaultExtent
       
  2062                               #tabable: true
       
  2063                               #model: #rightOffset
       
  2064                               #group: #inputGroup
       
  2065                               #type: #numberOrNil
       
  2066                               #acceptOnLostFocus: true
       
  2067                               #acceptChannel: #acceptChannel
       
  2068                               #modifiedChannel: #modifiedChannel
       
  2069                           )
       
  2070                            #(#CheckBoxSpec
       
  2071                               #name: 'useDefaultExtentCheckBox'
       
  2072                               #layout: #(#LayoutFrame -1 0 75 0 296 0 97 0)
       
  2073                               #model: #useDefaultExtent
       
  2074                               #label: 'Use Widgets Default Extent'
       
  2075                               #translateLabel: true
       
  2076                               #enableChannel: #defaultExtentEnabled
       
  2077                           )
       
  2078                         )
       
  2079                     )
       
  2080                     #label: 'Extent'
       
  2081                     #labelPosition: #topLeft
       
  2082                 )
       
  2083               )
       
  2084           )
       
  2085       )
       
  2086 ! !
       
  2087 
       
  2088 !UILayoutTool::Extent methodsFor:'accessing'!
       
  2089 
       
  2090 fetch:aView spec:aSpec
       
  2091     "fetch extent
       
  2092     "
       
  2093     |extent|
       
  2094 
       
  2095     extent  := aView computeExtent.
       
  2096 
       
  2097     (self aspectFor:#leftOffset)  value:(extent x).
       
  2098     (self aspectFor:#rightOffset) value:(extent y).
       
  2099 
       
  2100     (self aspectFor:#useDefaultExtent) value:aSpec useDefaultExtent 
       
  2101 !
       
  2102 
       
  2103 layout
       
  2104     "returns current extent
       
  2105     "
       
  2106   ^ Smalltalk::Point x:(((self aspectFor:#leftOffset)   value) ? 0)
       
  2107                      y:(((self aspectFor:#rightOffset)  value) ? 0)
       
  2108 
       
  2109 ! !
       
  2110 
       
  2111 !UILayoutTool::Rectangle class methodsFor:'interface specs'!
       
  2112 
       
  2113 windowSpec
       
  2114     "This resource specification was automatically generated
       
  2115      by the UIPainter of ST/X."
       
  2116 
       
  2117     "Do not manually edit this!! If it is corrupted,
       
  2118      the UIPainter may not be able to read the specification."
       
  2119 
       
  2120     "
       
  2121      UIPainter new openOnClass:UILayoutTool::Rectangle andSelector:#windowSpec
       
  2122      UILayoutTool::Rectangle new openInterface:#windowSpec
       
  2123      UILayoutTool::Rectangle open
       
  2124     "
       
  2125 
       
  2126     <resource: #canvas>
       
  2127 
       
  2128     ^
       
  2129      
       
  2130        #(#FullSpec
       
  2131           #window: 
       
  2132            #(#WindowSpec
       
  2133               #name: 'UILayoutTool-Rectangle'
       
  2134               #layout: #(#LayoutFrame 291 0 130 0 632 0 328 0)
       
  2135               #label: 'UILayoutTool-Rectangle'
       
  2136               #min: #(#Point 10 10)
       
  2137               #max: #(#Point 1152 900)
       
  2138               #bounds: #(#Rectangle 291 130 633 329)
       
  2139               #usePreferredExtent: false
       
  2140           )
       
  2141           #component: 
       
  2142            #(#SpecCollection
       
  2143               #collection: 
       
  2144                #(
       
  2145                  #(#UISubSpecification
       
  2146                     #name: 'subSpecification'
       
  2147                     #layout: #(#LayoutFrame 1 0.0 6 0 0 1.0 96 0)
       
  2148                     #majorKey: #UILayoutTool
       
  2149                     #minorKey: #layoutPointSpec
       
  2150                 )
       
  2151                  #(#FramedBoxSpec
       
  2152                     #name: 'FramedBox'
       
  2153                     #layout: #(#LayoutFrame 1 0.0 99 0 0 1.0 194 0)
       
  2154                     #component: 
       
  2155                      #(#SpecCollection
       
  2156                         #collection: 
       
  2157                          #(
       
  2158                            #(#LabelSpec
       
  2159                               #name: 'labelCornerY'
       
  2160                               #layout: #(#AlignmentOrigin 83 0 16 0 1 0)
       
  2161                               #label: 'Right:'
       
  2162                               #adjust: #left
       
  2163                           )
       
  2164                            #(#InputFieldSpec
       
  2165                               #name: 'fieldCornerX'
       
  2166                               #layout: #(#LayoutFrame 85 0 13 0 135 0 35 0)
       
  2167                               #activeHelpKey: #cornerX
       
  2168                               #tabable: true
       
  2169                               #model: #rightOffset
       
  2170                               #group: #inputGroup
       
  2171                               #type: #numberOrNil
       
  2172                               #acceptOnLostFocus: true
       
  2173                     #acceptChannel: #acceptChannel
       
  2174                     #modifiedChannel: #modifiedChannel
       
  2175                           )
       
  2176                            #(#LabelSpec
       
  2177                               #name: 'labelCornerX'
       
  2178                               #layout: #(#AlignmentOrigin 83 0 41 0 1 0)
       
  2179                               #label: 'Bottom:'
       
  2180                               #adjust: #left
       
  2181                           )
       
  2182                            #(#InputFieldSpec
       
  2183                               #name: 'fieldCornerY'
       
  2184                               #layout: #(#LayoutFrame 85 0 38 0 135 0 60 0)
       
  2185                               #activeHelpKey: #cornerY
       
  2186                               #tabable: true
       
  2187                               #model: #bottomOffset
       
  2188                               #group: #inputGroup
       
  2189                               #type: #numberOrNil
       
  2190                               #acceptOnLostFocus: true
       
  2191                     #acceptChannel: #acceptChannel
       
  2192                     #modifiedChannel: #modifiedChannel
       
  2193                           )
       
  2194                         )
       
  2195                     )
       
  2196                     #label: 'Corner'
       
  2197                     #labelPosition: #topLeft
       
  2198                 )
       
  2199               )
       
  2200           )
       
  2201       )
       
  2202 
       
  2203     "Modified: / 13.8.1998 / 19:59:16 / cg"
       
  2204 ! !
       
  2205 
       
  2206 !UILayoutTool::Rectangle methodsFor:'accessing'!
       
  2207 
       
  2208 fetch:aView spec:aSpec
       
  2209     "fetch rectangle
       
  2210     "
       
  2211     |origin corner|
       
  2212 
       
  2213     origin := aView computeOrigin.
       
  2214     corner := aView computeCorner.
       
  2215 
       
  2216     (self aspectFor:#leftOffset)   value:(origin x).
       
  2217     (self aspectFor:#rightOffset)  value:(corner x).
       
  2218     (self aspectFor:#topOffset)    value:(origin y).
       
  2219     (self aspectFor:#bottomOffset) value:(corner y).
       
  2220 
       
  2221 
       
  2222 !
       
  2223 
       
  2224 layout
       
  2225     "returns current layout as rectangle
       
  2226     "
       
  2227   ^ Smalltalk::Rectangle left:(((self aspectFor:#leftOffset)   value) ? 0)
       
  2228                           top:(((self aspectFor:#topOffset)    value) ? 0)
       
  2229                         right:(((self aspectFor:#rightOffset)  value) ? 0)
       
  2230                        bottom:(((self aspectFor:#bottomOffset) value) ? 0)
       
  2231 
       
  2232 
       
  2233 ! !
       
  2234 
  2231 !UILayoutTool class methodsFor:'documentation'!
  2235 !UILayoutTool class methodsFor:'documentation'!
  2232 
  2236 
  2233 version
  2237 version
  2234     ^ '$Header$'
  2238     ^ '$Header$'
  2235 ! !
  2239 ! !