checkin from browser
authorClaus Gittinger <cg@exept.de>
Sun, 12 May 1996 19:42:29 +0200
changeset 315 e4ef56137893
parent 314 42526a763add
child 316 628f72ebc5bc
checkin from browser
Text.st
--- a/Text.st	Sun May 12 17:56:24 1996 +0200
+++ b/Text.st	Sun May 12 19:42:29 1996 +0200
@@ -78,6 +78,14 @@
                                                                         [exEnd]
                                                                         [exBegin]
     Dialog
+        warn:(Text string:'hello' 
+                 emphasis:(Array with:#bold
+                                 with:#strikeout
+                                 with:(#color->Color red)
+                                 with:(#backgroundColor->Color yellow)))
+                                                                        [exEnd]
+                                                                        [exBegin]
+    Dialog
         warn:(Text string:'hello' color:(Color red))
                                                                         [exEnd]
 
@@ -255,22 +263,25 @@
 displayOn:aGC x:x0 y:y opaque:opaque
     "display the receiver on a GC"
 
-    |savedFont font color boldFont italicFont savedPaint 
+    |savedFont savedPaint savedBgPaint font color boldFont italicFont  
+     bgPaint
      bold italic underline strikeout 
      pos    "{ Class: SmallInteger }"
      endPos "{ Class: SmallInteger }"
      x      "{ Class: SmallInteger }"
      l      "{ Class: SmallInteger }"
-     yL|
+     yL k value|
 
     savedFont := aGC basicFont.
     savedPaint := aGC paint.
+    savedBgPaint := aGC backgroundPaint.
 
     pos := 1.
     x := x0.
     runs runsDo:[:len :emphasis |
         color := nil.
         bold := italic := underline := strikeout := false.
+        bgPaint := savedBgPaint.
 
         emphasis isSymbol ifTrue:[
             emphasis == #bold ifTrue:[bold := true]
@@ -280,9 +291,13 @@
             ]]]
         ] ifFalse:[
             (emphasis isMemberOf:Association) ifTrue:[
-                emphasis key == #color ifTrue:[
-                    color := emphasis value
-                ]
+                value := emphasis value.
+                k := emphasis key.
+                k == #color ifTrue:[
+                    color := value
+                ] ifFalse:[k == #backgroundColor ifTrue:[
+                    bgPaint := value
+                ]]
             ] ifFalse:[
                 emphasis notNil ifTrue:[
                     emphasis do:[:entry |
@@ -292,10 +307,15 @@
                         ifFalse:[entry == #strikeout ifTrue:[strikeout := true]
                         ifFalse:[
                             (entry isMemberOf:Association) ifTrue:[
-                                entry key == #color ifTrue:[
-                                    color := entry value
+                                value := entry value.
+                                k := entry key.
+                                k == #color ifTrue:[
+                                    color := value
+                                ] ifFalse:[k == #backgroundColor ifTrue:[
+                                    bgPaint := value
+                                ]]
                             ]
-                        ]]]]]
+                        ]]]]
                     ]
                 ]
             ]
@@ -323,7 +343,7 @@
             ]
         ].
         aGC basicFont:font.
-        aGC paint:color.
+        aGC paint:color on:bgPaint.
 
         endPos := pos + len - 1.
         opaque ifTrue:[
@@ -350,7 +370,7 @@
     aGC paint:savedPaint.
 
     "Created: 12.5.1996 / 11:14:30 / cg"
-    "Modified: 12.5.1996 / 17:15:23 / cg"
+    "Modified: 12.5.1996 / 19:42:07 / cg"
 !
 
 displayOpaqueOn:aGC x:x y:y
@@ -619,6 +639,6 @@
 !Text class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic2/Text.st,v 1.7 1996-05-12 15:56:24 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic2/Text.st,v 1.8 1996-05-12 17:42:29 cg Exp $'
 ! !
 Text initialize!