--- a/LayoutOrigin.st Thu Nov 23 11:43:41 1995 +0100
+++ b/LayoutOrigin.st Thu Nov 23 18:42:34 1995 +0100
@@ -10,11 +10,8 @@
hereby transferred.
"
-'From Smalltalk/X, Version:2.10.5 on 15-apr-1995 at 12:14:46 pm'!
-
Layout subclass:#LayoutOrigin
- instanceVariableNames:'leftFraction topFraction leftOffset
- topOffset'
+ instanceVariableNames:'leftFraction topFraction leftOffset topOffset'
classVariableNames:''
poolDictionaries:''
category:'Graphics-Geometry'
@@ -90,10 +87,6 @@
top open
"
-!
-
-version
- ^ '$Header: /cvs/stx/stx/libview2/LayoutOrigin.st,v 1.8 1995-11-11 16:04:40 cg Exp $'
! !
!LayoutOrigin class methodsFor:'instance creation'!
@@ -109,17 +102,6 @@
"
!
-offsetFromPoint:aPoint
- "given a point, create a layoutOrigin representing the same
- absolute (pixel) origin."
-
- ^ self new leftOffset:aPoint x topOffset:aPoint y
-
- "
- LayoutOrigin offsetFromPoint:100@100
- "
-!
-
fromPoint:aPoint
"return a new LayoutOrigin from aPoint.
If the coordinates are between 0 and 1, take
@@ -144,6 +126,143 @@
LayoutOrigin fromPoint:0.5@0.5
LayoutOrigin fromPoint:0.5@100
"
+!
+
+offsetFromPoint:aPoint
+ "given a point, create a layoutOrigin representing the same
+ absolute (pixel) origin."
+
+ ^ self new leftOffset:aPoint x topOffset:aPoint y
+
+ "
+ LayoutOrigin offsetFromPoint:100@100
+ "
+! !
+
+!LayoutOrigin methodsFor:'accessing'!
+
+leftFraction
+ "return leftFraction"
+
+ ^ leftFraction
+!
+
+leftFraction:something
+ "set leftFraction"
+
+ leftFraction := something.
+!
+
+leftFraction:something offset:o
+ "set leftFraction and offset"
+
+ leftFraction := something.
+ leftOffset := o
+!
+
+leftFraction:newLeft topFraction:newTop
+ "set leftFraction and topFraction"
+
+ leftFraction := newLeft.
+ topFraction := newTop.
+!
+
+leftOffset
+ "return leftOffset"
+
+ ^ leftOffset
+!
+
+leftOffset:something
+ "set leftOffset"
+
+ leftOffset := something.
+!
+
+leftOffset:newLeft topOffset:newTop
+ "set leftOffset and topOffset"
+
+ leftOffset := newLeft.
+ topOffset := newTop.
+!
+
+topFraction
+ "return topFraction"
+
+ ^ topFraction
+!
+
+topFraction:something
+ "set topFraction"
+
+ topFraction := something.
+!
+
+topFraction:something offset:o
+ "set topFraction and offset"
+
+ topFraction := something.
+ topOffset := o
+!
+
+topOffset
+ "return topOffset"
+
+ ^ topOffset
+!
+
+topOffset:something
+ "set topOffset"
+
+ topOffset := something.
+! !
+
+!LayoutOrigin methodsFor:'converting'!
+
+fromLiteralArrayEncoding:encoding
+ "read my values from an encoding.
+ The encoding is supposed to be of the form:
+ (#LayoutOrigin orgOffsX relOrgX orgOffsY relOrgY)
+ This is the reverse operation to #literalArrayEncoding."
+
+ leftOffset := encoding at:2.
+ leftFraction := encoding at:3.
+ topOffset := encoding at:4.
+ topFraction := encoding at:5.
+
+
+ "
+ LayoutOrigin new fromLiteralArrayEncoding:#(#LayoutOrigin 70 0 2 0)
+ "
+!
+
+literalArrayEncoding
+ "encode myself as an array.
+ The encoding is:
+ (#LayoutOrigin orgOffsX relOrgX orgOffsY relOrgY)
+ "
+
+ ^ Array
+ with:self class name asSymbol
+ with:leftOffset
+ with:leftFraction
+ with:topOffset
+ with:topFraction
+
+ "
+ LayoutOrigin new fromLiteralArrayEncoding:#(#LayoutOrigin 70 0 2 0)
+ (LayoutOrigin new leftOffset:10; leftFraction:0.2;
+ topOffset:20; topFraction:0.4) literalArrayEncoding
+ "
+
+ "Modified: 1.9.1995 / 02:43:48 / claus"
+! !
+
+!LayoutOrigin methodsFor:'initialization'!
+
+initialize
+ leftOffset := topOffset := 0.
+ leftFraction := topFraction := 0.
! !
!LayoutOrigin methodsFor:'printing & storing'!
@@ -157,86 +276,12 @@
, ')'
! !
-!LayoutOrigin methodsFor:'accessing'!
-
-leftFraction:something
- "set leftFraction"
-
- leftFraction := something.
-!
-
-leftFraction
- "return leftFraction"
-
- ^ leftFraction
-!
-
-leftOffset:something
- "set leftOffset"
-
- leftOffset := something.
-!
-
-leftOffset
- "return leftOffset"
-
- ^ leftOffset
-!
-
-leftFraction:something offset:o
- "set leftFraction and offset"
-
- leftFraction := something.
- leftOffset := o
-!
-
-topFraction:something
- "set topFraction"
-
- topFraction := something.
-!
+!LayoutOrigin methodsFor:'queries'!
-topFraction
- "return topFraction"
-
- ^ topFraction
-!
-
-topOffset:something
- "set topOffset"
-
- topOffset := something.
-!
-
-topOffset
- "return topOffset"
-
- ^ topOffset
+origin
+ ^ leftFraction asFloat @ topFraction asFloat
!
-topFraction:something offset:o
- "set topFraction and offset"
-
- topFraction := something.
- topOffset := o
-!
-
-leftFraction:newLeft topFraction:newTop
- "set leftFraction and topFraction"
-
- leftFraction := newLeft.
- topFraction := newTop.
-!
-
-leftOffset:newLeft topOffset:newTop
- "set leftOffset and topOffset"
-
- leftOffset := newLeft.
- topOffset := newTop.
-! !
-
-!LayoutOrigin methodsFor:'queries'!
-
rectangleRelativeTo:superRectangle preferred:prefRect
|x y|
@@ -267,57 +312,10 @@
topFraction:0.5.
lO rectangleRelativeTo:superRect preferred:(0@0 corner:30@30)
"
-!
-
-origin
- ^ leftFraction asFloat @ topFraction asFloat
-! !
-
-!LayoutOrigin methodsFor:'initialization'!
-
-initialize
- leftOffset := topOffset := 0.
- leftFraction := topFraction := 0.
! !
-!LayoutOrigin methodsFor:'converting'!
-
-literalArrayEncoding
- "encode myself as an array.
- The encoding is:
- (#LayoutOrigin orgOffsX relOrgX orgOffsY relOrgY)
- "
-
- ^ Array
- with:self class name asSymbol
- with:leftOffset
- with:leftFraction
- with:topOffset
- with:topFraction
-
- "
- LayoutOrigin new fromLiteralArrayEncoding:#(#LayoutOrigin 70 0 2 0)
- (LayoutOrigin new leftOffset:10; leftFraction:0.2;
- topOffset:20; topFraction:0.4) literalArrayEncoding
- "
+!LayoutOrigin class methodsFor:'documentation'!
- "Modified: 1.9.1995 / 02:43:48 / claus"
-!
-
-fromLiteralArrayEncoding:encoding
- "read my values from an encoding.
- The encoding is supposed to be of the form:
- (#LayoutOrigin orgOffsX relOrgX orgOffsY relOrgY)
- This is the reverse operation to #literalArrayEncoding."
-
- leftOffset := encoding at:2.
- leftFraction := encoding at:3.
- topOffset := encoding at:4.
- topFraction := encoding at:5.
-
-
- "
- LayoutOrigin new fromLiteralArrayEncoding:#(#LayoutOrigin 70 0 2 0)
- "
+version
+ ^ '$Header: /cvs/stx/stx/libview2/LayoutOrigin.st,v 1.9 1995-11-23 17:42:34 cg Exp $'
! !
-