# HG changeset patch # User Claus Gittinger # Date 1141634941 -3600 # Node ID 746cc87a768ede05ea9e9034c9ea04498b832ba5 # Parent 5b7cc72d8226445b67cc5bb1236da06d26ec086a *** empty log message *** diff -r 5b7cc72d8226 -r 746cc87a768e UILayoutTool.st --- a/UILayoutTool.st Mon Mar 06 09:47:37 2006 +0100 +++ b/UILayoutTool.st Mon Mar 06 09:49:01 2006 +0100 @@ -875,17 +875,19 @@ !UILayoutTool methodsFor:'selection'! selectedSlice - "returns slice assigned to selection or nil - " - selection notNil ifTrue:[ - self class slices do:[:aSlice| - aSlice first = selection ifTrue:[ - ^ aSlice - ] - ] - ]. - ^ nil - + "returns the slice assigned to the selection or nil" + + selection isNil ifTrue:[^ nil]. + ^ self class slices detect:[:aSlice | aSlice first = selection] ifNone:nil + +"/ selection notNil ifTrue:[ +"/ self class slices do:[:aSlice| +"/ aSlice first = selection ifTrue:[ +"/ ^ aSlice +"/ ] +"/ ] +"/ ]. +"/ ^ nil ! selection @@ -1489,7 +1491,7 @@ name: 'FramedBox' layout: (LayoutFrame 0 0.0 6 0.0 0 1.0 145 0) labelPosition: topLeft - translateLabel: true + translateLabel: true component: (SpecCollection collection: ( @@ -1497,8 +1499,8 @@ label: 'Width:' name: 'labelWidth' layout: (AlignmentOrigin 89 0 24 0 1 0.5) + translateLabel: true adjust: right - translateLabel: true ) (InputFieldSpec name: 'fieldLeftOffset' @@ -1518,8 +1520,8 @@ label: 'Height:' name: 'labelHeight' layout: (AlignmentOrigin 89 0 49 0 1 0.5) + translateLabel: true adjust: right - translateLabel: true ) (InputFieldSpec name: 'fieldRightOffset' @@ -1527,7 +1529,7 @@ activeHelpKey: vrtExtent enableChannel: notUsingDefaultExtent tabable: true - model: rightOffset + model: topOffset group: inputGroup type: numberOrNil acceptOnLostFocus: true @@ -1548,6 +1550,16 @@ ) ) + (PopUpListSpec + label: 'Common Extents' + name: 'CommonExtentsPopUpList' + layout: (LayoutFrame 179 0 35 0 304 0 57 0) + tabable: true + menu: listOfCommonExtents + useIndex: true + ignoreReselect: false + stateChangeCallBackSelector: commonExtentSelected: + ) ) ) @@ -1557,24 +1569,53 @@ !UILayoutTool::Extent methodsFor:'accessing'! fetch:aView spec:aSpec - "fetch extent - " + "fetch the extent from aView" + |extent| extent := aView computeExtent. (self aspectFor:#leftOffset) value:(extent x). - (self aspectFor:#rightOffset) value:(extent y). + (self aspectFor:#topOffset) value:(extent y). (self aspectFor:#useDefaultExtent) value:aSpec useDefaultExtent ! layout - "returns current extent - " - ^ Smalltalk::Point x:(((self aspectFor:#leftOffset) value) ? 0) - y:(((self aspectFor:#rightOffset) value) ? 0) - + "returns the current extent" + + ^ (((self aspectFor:#leftOffset) value) ? 0) @ (((self aspectFor:#topOffset) value) ? 0) +! ! + +!UILayoutTool::Extent methodsFor:'aspects'! + +commonExtentsSpec + ^ #( + ('200 x 100' (200 100) ) + ('300 x 300' (300 300) ) + ('640 x 400' (640 400) ) + ('800 x 600' (800 600) ) + ) +! + +listOfCommonExtents + ^ self commonExtentsSpec collect:[:eachRow | eachRow first]. +! ! + +!UILayoutTool::Extent methodsFor:'user actions'! + +commonExtentSelected:index + |xy x y| + + xy := (self commonExtentsSpec at:index) second. + x := xy at:1. + y := xy at:2. + + (self aspectFor:#leftOffset) value:x. + (self aspectFor:#topOffset) value:y. + + (builder componentAt:#CommonExtentsPopUpList) + label:(resources string:'Common Extents'). ! ! !UILayoutTool::LayoutFrame class methodsFor:'defaults'! @@ -1643,7 +1684,7 @@ 'Compute pure-fractional y.' #makeBottomRelativeFromBottom -'Compute fraction+offset for y relative to container.' +'Compute fraction+offset for y relative to containers bottom.' #makeRightAbsolute 'Compute pure-absolute x.' @@ -1709,9 +1750,9 @@ ^Icon constantNamed:#'UILayoutTool::LayoutFrame class setBigBottomFixPartIcon' - ifAbsentPut:[(Depth4Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' -@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"H"H@H"H"@BDQDP@QDQH@HQDQ@ADQD @!!DQD@DQDR@BDQDP@QDQH@HQ -DQ@ADQD @!!DQD@DQDR@BDQDP@QDQH@H"H"@BH"H @@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 255 0 0 255 255 255]; mask:((Depth1Image new) width: 16; height: 16; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??>@@X@A @F@@_????????????????????????????A XFA XFA _????????????????????????????@@X@A??????????????????????????>@@X@A??A XFA??????????????????????????>A XFA??