add line printing support
authorfm
Wed, 09 Aug 2006 14:46:19 +0200
changeset 2146 61291b6cc0f7
parent 2145 75b115b9a5fa
child 2147 10c893aa772a
add line printing support
PrinterContext.st
--- a/PrinterContext.st	Tue Aug 08 11:30:41 2006 +0200
+++ b/PrinterContext.st	Wed Aug 09 14:46:19 2006 +0200
@@ -211,6 +211,35 @@
     "Created: / 07-08-2006 / 11:48:46 / fm"
 !
 
+printLines: pairOfPointsArray
+
+        "Opens a print dialog and prints the given lines"
+
+    | printerInfo printer |
+    printerInfo := PrintingDialog getPrinterInfo.
+    printerInfo isNil ifTrue:[^self].
+
+    printer := self fromPrinterInfo: printerInfo.
+    [ 
+    printer startPrintJob: 'Lines'.
+    printer foreground:Color black background:Color white.
+    pairOfPointsArray
+        do:[:pairOfPoints |                 
+             printer displayLineFrom: (pairOfPoints at:1)  to: (pairOfPoints at:2).
+        ].
+    printer endPrintJob.
+    ] forkAt: 3
+
+"
+    PrinterContext printLines:  
+        (Array with: (Array with:10@10 with:100@10)
+               with: (Array with:10@10 with:35@200))
+"
+
+    "Created: / 07-08-2006 / 12:09:48 / fm"
+    "Modified: / 07-08-2006 / 14:11:17 / fm"
+!
+
 printPolygons: polygons
 
         "Opens a print dialog and prints the given polygons"
@@ -1009,5 +1038,5 @@
 !PrinterContext class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/PrinterContext.st,v 1.1 2006-08-07 13:26:45 fm Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/PrinterContext.st,v 1.2 2006-08-09 12:46:19 fm Exp $'
 ! !