Ruler.st
changeset 34 159147b254e1
parent 33 3e68e4c73db3
child 36 160b8f0dfd7d
--- a/Ruler.st	Wed Dec 21 20:25:09 1994 +0100
+++ b/Ruler.st	Mon Feb 06 01:57:39 1995 +0100
@@ -21,7 +21,7 @@
 COPYRIGHT (c) 1991 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libwidg2/Ruler.st,v 1.11 1994-12-21 19:25:03 claus Exp $
+$Header: /cvs/stx/stx/libwidg2/Ruler.st,v 1.12 1995-02-06 00:57:29 claus Exp $
 '!
 
 !Ruler class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libwidg2/Ruler.st,v 1.11 1994-12-21 19:25:03 claus Exp $
+$Header: /cvs/stx/stx/libwidg2/Ruler.st,v 1.12 1995-02-06 00:57:29 claus Exp $
 "
 !
 
@@ -193,11 +193,12 @@
 
     (xOrigin + width > paperWidthPixel) ifTrue:[
 	self paint:(Color darkGrey).
-	self fillRectangleX:paperWidthPixel - xOrigin y:0
-		      width:(width - (paperWidthPixel - xOrigin)) height:height.
+	self fillRectangleX:paperWidthPixel y:0
+		      width:(xOrigin + width - paperWidthPixel) 
+		      height:height.
 	self paint:fgColor.
-	self displayLineFromX:paperWidthPixel - xOrigin y:0
-			  toX:paperWidthPixel - xOrigin y:height
+	self displayLineFromX:paperWidthPixel y:0
+			  toX:paperWidthPixel y:height
     ].
 
     self paint:fgColor.
@@ -216,13 +217,13 @@
 	pixelPerMM := (self millimeterToPixel:1) * scale.
 	pos := 5.
 	showUnit ifTrue:[
-	    labelRight := stringRight := marg + (font widthOf:'cm') + 3.
+	    labelRight := stringRight := marg + (font widthOf:'cm') + 3 + xOrigin.
 	] ifFalse:[
-	    labelRight := stringRight := 0.
+	    labelRight := stringRight := xOrigin.
 	].
 
-	x := (pixelPerMM * pos - xOrigin) rounded.
-	[(x < width) and:[pos <= paperWidthMM]] whileTrue:[
+	x := (pixelPerMM * pos) rounded.
+	[(x < (width+xOrigin)) and:[pos <= paperWidthMM]] whileTrue:[
 	    |l|
 
 	    l := shortLen.
@@ -243,9 +244,9 @@
 	    ].
 	    mod := (mod + 1) \\ 2.
 	    pos := pos + 5.
-	    x := (pixelPerMM * pos - xOrigin) rounded 
+	    x := (pixelPerMM * pos) rounded 
 	].
-	self displayString:'cm ' x:marg y:charY.
+	self displayString:'cm ' x:marg+xOrigin y:charY.
     ].
     (metric == #inch) ifTrue:[
 	"inches - long blibs every inch; short ones every half; very
@@ -254,14 +255,14 @@
 	pixelPerInch := (self inchToPixel:1) * scale.
 	pos := 0.25.
 	showUnit ifTrue:[
-	    labelRight := marg + (font widthOf:'inch') + 3.
+	    labelRight := marg + (font widthOf:'inch') + 3 + xOrigin.
 	] ifFalse:[
-	    labelRight := 0
+	    labelRight := xOrigin
 	].
 
-	x := (pixelPerInch * pos - xOrigin) rounded.
+	x := (pixelPerInch * pos) rounded.
 	veryShortLen := longLen // 4.
-	[(x < width) and:[pos <= paperWidth]] whileTrue:[
+	[(x < (xOrigin+width)) and:[pos <= paperWidth]] whileTrue:[
 	    |l|
 
 	    l := shortLen.    
@@ -284,9 +285,9 @@
 	    ].
 	    mod := (mod + 1) \\ 4.
 	    pos := pos + 0.25.
-	    x := (pixelPerInch * pos - xOrigin) rounded
+	    x := (pixelPerInch * pos) rounded
 	].
-	self displayString:'inch ' x:marg y:charY.
+	self displayString:'inch ' x:marg+xOrigin y:charY.
     ].
     self redrawEdges
 ! !