VerticalRuler.st
changeset 195 0fbaea91aa3d
parent 161 5b6e284959a4
child 196 9311b28d1a32
--- a/VerticalRuler.st	Wed May 29 16:44:13 1996 +0200
+++ b/VerticalRuler.st	Fri May 31 19:23:26 1996 +0200
@@ -89,13 +89,13 @@
     paperHeightPixel := ((self inchToPixel:paperHeight) * scale) rounded.
 
     (yOrigin + height > paperHeightPixel) ifTrue:[
-	self paint:(Color darkGrey).
-	self fillRectangleX:0 y:paperHeightPixel
-		      width:width
-		      height:(yOrigin + height - paperHeightPixel).
-	self paint:fgColor.
-	self displayLineFromX:0 y:paperHeightPixel
-			  toX:width y:paperHeightPixel
+        self paint:(Color darkGrey).
+        self fillRectangleX:0 y:paperHeightPixel
+                      width:width
+                      height:(yOrigin + height - paperHeightPixel).
+        self paint:fgColor.
+        self displayLineFromX:0 y:paperHeightPixel
+                          toX:width y:paperHeightPixel
     ].
 
     self paint:fgColor.
@@ -109,86 +109,88 @@
     fontHeight := font height.
 
     showUnit ifTrue:[
-	labelBot := marg + font height + font ascent + yOrigin.
+        labelBot := marg + font height + font ascent + yOrigin.
     ] ifFalse:[
-	labelBot := yOrigin
+        labelBot := yOrigin
     ].
 
     (metric == #mm) ifTrue:[
-	"centimeter - long blibs every centimeter; short ones every half"
+        "centimeter - long blibs every centimeter; short ones every half"
 
-	paperHeightMM := self inchToMillimeter:paperHeight.
-	pixelPerMM := (self millimeterToPixel:1) * scale.
-	pos := 5.
-	y := (pixelPerMM * pos) rounded.
-	[(y < (height+yOrigin)) and:[pos <= paperHeightMM]] whileTrue:[
-	    |l|
+        paperHeightMM := UnitConverter inchToMillimeter:paperHeight.
+        pixelPerMM := (self millimeterToPixel:1) * scale.
+        pos := 5.
+        y := (pixelPerMM * pos) rounded.
+        [(y < (height+yOrigin)) and:[pos <= paperHeightMM]] whileTrue:[
+            |l|
 
-	    l := shortLen.
-	    (mod ~~ 1) ifTrue:[
-		y < labelBot ifFalse:[
-		    l := longLen
-		]
-	    ].
-	    self displayLineFromX:left y:y toX:(left + l) y:y.
+            l := shortLen.
+            (mod ~~ 1) ifTrue:[
+                y < labelBot ifFalse:[
+                    l := longLen
+                ]
+            ].
+            self displayLineFromX:left y:y toX:(left + l) y:y.
 
-	    (mod ~~ 1 and:[y >= labelBot]) ifTrue:[
-		self displayString:(pos // 10) printString
-				 x:charX
-				 y:(y + marg + fontHeight)
-	    ].
-	    mod := (mod + 1) \\ 2.
-	    pos := pos + 5.
-	    y := (pixelPerMM * pos) rounded 
-	].
-	showUnit ifTrue:[
-	    self displayString:'cm ' x:charX y:marg + fontHeight + yOrigin.
-	]
+            (mod ~~ 1 and:[y >= labelBot]) ifTrue:[
+                self displayString:(pos // 10) printString
+                                 x:charX
+                                 y:(y + marg + fontHeight)
+            ].
+            mod := (mod + 1) \\ 2.
+            pos := pos + 5.
+            y := (pixelPerMM * pos) rounded 
+        ].
+        showUnit ifTrue:[
+            self displayString:'cm ' x:charX y:marg + fontHeight + yOrigin.
+        ]
     ].
     (metric == #inch) ifTrue:[
-	"inches - long blibs every inch; short ones every half; very
-	 short ones every quarter"
+        "inches - long blibs every inch; short ones every half; very
+         short ones every quarter"
 
-	pixelPerInch := (self inchToPixel:1) * scale.
-	pos := 0.25.
+        pixelPerInch := (self inchToPixel:1) * scale.
+        pos := 0.25.
 
-	y := (pixelPerInch * pos) rounded.
-	veryShortLen := longLen // 4.
-	[(y < (yOrigin + height)) and:[pos <= paperHeight]] whileTrue:[
-	    |l|
+        y := (pixelPerInch * pos) rounded.
+        veryShortLen := longLen // 4.
+        [(y < (yOrigin + height)) and:[pos <= paperHeight]] whileTrue:[
+            |l|
 
-	    l := shortLen.
-	    (mod == 0) ifTrue:[
-		y < labelBot ifFalse:[
-		    l := longLen.
-		]
-	    ] ifFalse:[
-		(mod == 2) ifFalse:[
-		    l := veryShortLen
-		]
-	    ].
-	    self displayLineFromX:left y:y toX:(left + l) y:y.
+            l := shortLen.
+            (mod == 0) ifTrue:[
+                y < labelBot ifFalse:[
+                    l := longLen.
+                ]
+            ] ifFalse:[
+                (mod == 2) ifFalse:[
+                    l := veryShortLen
+                ]
+            ].
+            self displayLineFromX:left y:y toX:(left + l) y:y.
 
-	    (mod == 0) ifTrue:[
-		y < labelBot ifFalse:[
-		    self displayString:pos asInteger printString
-				     x:charX
-				     y:(y + marg + fontHeight)
-		]
-	    ].
-	    mod := (mod + 1) \\ 4.
-	    pos := pos + 0.25.
-	    y := (pixelPerInch * pos) rounded
-	].
-	showUnit ifTrue:[
-	    self displayString:'inch ' x:charX y:marg + fontHeight + yOrigin.
-	]
+            (mod == 0) ifTrue:[
+                y < labelBot ifFalse:[
+                    self displayString:pos asInteger printString
+                                     x:charX
+                                     y:(y + marg + fontHeight)
+                ]
+            ].
+            mod := (mod + 1) \\ 4.
+            pos := pos + 0.25.
+            y := (pixelPerInch * pos) rounded
+        ].
+        showUnit ifTrue:[
+            self displayString:'inch ' x:charX y:marg + fontHeight + yOrigin.
+        ]
     ].
     self redrawEdges
+
+    "Modified: 31.5.1996 / 18:06:59 / cg"
 ! !
 
 !VerticalRuler class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/VerticalRuler.st,v 1.7 1996-04-27 18:22:04 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/VerticalRuler.st,v 1.8 1996-05-31 17:23:26 cg Exp $'
 ! !