*** empty log message ***
authorClaus Gittinger <cg@exept.de>
Tue, 02 Mar 2004 09:44:45 +0100
changeset 2668 fa1ac72a7a8f
parent 2667 bcaa8849c028
child 2669 a40d7aa7c89c
*** empty log message ***
StrokeView.st
--- a/StrokeView.st	Sat Feb 28 15:02:20 2004 +0100
+++ b/StrokeView.st	Tue Mar 02 09:44:45 2004 +0100
@@ -1,7 +1,8 @@
 "{ Package: 'stx:libwidg2' }"
 
 View subclass:#StrokeView
-	instanceVariableNames:'strokes currentStroke lastPoint clearButton clearLastButton'
+	instanceVariableNames:'strokes currentStroke lastPoint clearButton clearLastButton
+		strokeAction'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'Views-Special'
@@ -33,13 +34,23 @@
 "
 ! !
 
+!StrokeView methodsFor:'accessing'!
+
+strokeAction:something
+    strokeAction := something.
+! !
+
 !StrokeView methodsFor:'button actions'!
 
 newStrokeSequence
     strokes removeAll.
     currentStroke := lastPoint := nil.
     self updateButtonStates.
-    self redraw
+    self redraw.
+
+    strokeAction notNil ifTrue:[
+        strokeAction value:strokes.
+    ]
 !
 
 removeLastStroke
@@ -49,7 +60,11 @@
 
     currentStroke := lastPoint := nil.
     self updateButtonStates.
-    self redraw
+    self redraw.
+
+    strokeAction notNil ifTrue:[
+        strokeAction value:strokes.
+    ]
 !
 
 updateButtonStates
@@ -72,6 +87,7 @@
     thisPoint := x@y.
     currentStroke add:(LineSegment from:lastPoint to:thisPoint).
 
+    self paint:Color yellow.
     self displayLineFrom:lastPoint to:thisPoint.
 
     lastPoint := thisPoint.
@@ -89,6 +105,10 @@
         strokes add:currentStroke.
         currentStroke := nil.
         self updateButtonStates.
+        self redrawStrokes.
+        strokeAction notNil ifTrue:[
+            strokeAction value:strokes.
+        ]
     ].
 ! !
 
@@ -103,6 +123,8 @@
 initialize
     super initialize.
 
+    self viewBackground:Color black.
+
     strokes := OrderedCollection new.
 
     clearButton := self newButton2D.
@@ -148,9 +170,16 @@
 
 redraw
     self clear.
+    self redrawStrokes.
+!
+
+redrawStrokes
+    self paint:Color cyan.
     strokes do:[:eachStroke |
         self drawStroke:eachStroke
     ].
+
+    self paint:Color yellow.
     currentStroke notNil ifTrue:[
         self drawStroke:currentStroke
     ].
@@ -159,5 +188,5 @@
 !StrokeView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/StrokeView.st,v 1.2 2004-02-27 17:24:31 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/StrokeView.st,v 1.3 2004-03-02 08:44:45 cg Exp $'
 ! !