Implement #displayOn: instead of #displayString
authorStefan Vogel <sv@exept.de>
Fri, 03 Aug 2012 17:53:55 +0200
changeset 3017 23ca648eacd9
parent 3016 e2374dddc45f
child 3018 e7f336370c9f
Implement #displayOn: instead of #displayString
AlignmentOrigin.st
--- a/AlignmentOrigin.st	Fri Aug 03 17:53:52 2012 +0200
+++ b/AlignmentOrigin.st	Fri Aug 03 17:53:55 2012 +0200
@@ -9,6 +9,7 @@
  other person.  No title to or ownership of the software is
  hereby transferred.
 "
+"{ Package: 'stx:libview2' }"
 
 LayoutOrigin subclass:#AlignmentOrigin
 	instanceVariableNames:'leftAlignmentFraction topAlignmentFraction'
@@ -239,17 +240,31 @@
 
 !AlignmentOrigin methodsFor:'printing & storing'!
 
-displayString
+displayOn:aGCOrStream
     "return a printed representation of the receiver for displaying"
 
-    ^ self class name , '(' 
-	, 'l: ' , leftFraction displayString
-	, '+' , leftOffset displayString
-	, ' t: ' , topFraction displayString
-	, '+' , topOffset displayString
-	, ' a: ' , leftAlignmentFraction displayString
-	, '@' , topAlignmentFraction displayString
-	, ')'
+    "/ what a kludge - Dolphin and Squeak mean: printOn: a stream;
+    "/ ST/X (and some old ST80's) mean: draw-yourself on a GC.
+    (aGCOrStream isStream) ifFalse:[
+        ^ super displayOn:aGCOrStream
+    ].
+
+    aGCOrStream 
+        nextPutAll:self class name;
+        nextPutAll:'(l: '.
+
+    leftFraction displayOn:aGCOrStream.
+    aGCOrStream nextPut:$+. 
+    leftOffset displayOn:aGCOrStream.
+    aGCOrStream nextPutAll:' t: '.
+    topFraction displayOn:aGCOrStream.
+    aGCOrStream nextPut:$+. 
+    topOffset displayOn:aGCOrStream.
+    aGCOrStream nextPutAll:' a: '.
+    leftAlignmentFraction displayOn:aGCOrStream.
+    aGCOrStream nextPut:$@. 
+    topAlignmentFraction displayOn:aGCOrStream.
+    aGCOrStream nextPut:$). 
 
     "Modified: 22.1.1997 / 11:58:38 / cg"
 ! !
@@ -313,5 +328,5 @@
 !AlignmentOrigin class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/AlignmentOrigin.st,v 1.25 1998-08-13 16:40:40 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/AlignmentOrigin.st,v 1.26 2012-08-03 15:53:55 stefan Exp $'
 ! !