support dashed outline drawing.
authorClaus Gittinger <cg@exept.de>
Fri, 28 Mar 1997 16:41:10 +0100
changeset 505 ed95005f043b
parent 504 b77cdd860259
child 506 e029bc0ede3a
support dashed outline drawing.
DObject.st
DisplayObject.st
--- a/DObject.st	Thu Mar 27 15:14:10 1997 +0100
+++ b/DObject.st	Fri Mar 28 16:41:10 1997 +0100
@@ -57,12 +57,25 @@
 
 !DisplayObject class methodsFor:'behavior'!
 
+dragDashedOutline
+    "if true, outline dragging is done by drawing the line dashed.
+     if false, the outline is drawn solid.
+     Can be redefined in subclasses (for solid outline)."
+
+    ^ true
+
+    "Created: 28.3.1997 / 16:21:56 / cg"
+    "Modified: 28.3.1997 / 16:40:54 / cg"
+!
+
 dragOutline
     "if true, dragging is done by drawing outline only;
-     if false, dragging is done by full draw (fast servers only)
-     - can be redefined in subclasses"
+     if false, dragging is done by full draw (fast servers only).
+     Can be redefined in subclasses (for full dragging)"
 
     ^ true
+
+    "Modified: 28.3.1997 / 16:40:44 / cg"
 ! !
 
 !DisplayObject methodsFor:'ST-80 drawing'!
@@ -216,36 +229,64 @@
 
 !DisplayObject methodsFor:'drawing'!
 
+drawDashedOutlineIn:aGC offset:anOffset
+    "draw the receivers outline at its origin offset by anOffset, aPoint"
+
+    |prevStyle|
+
+    prevStyle := aGC lineStyle.
+    aGC lineStyle:#dashed.
+    [
+        self drawOutlineIn:aGC offset:anOffset.
+    ] valueNowOrOnUnwindDo:[
+        aGC lineStyle:prevStyle.
+    ]
+
+    "Created: 28.3.1997 / 16:23:25 / cg"
+    "Modified: 28.3.1997 / 16:29:24 / cg"
+!
+
 drawDragIn:aView
-    self class dragOutline ifTrue:[
-	self drawOutlineIn:aView offset:(0 @ 0)
-    ] ifFalse: [
-	self drawIn:aView offset:(0 @ 0)
-    ]
+    "draw the receiver for dragging at its origin"
+
+    self drawDragIn:aView offset:0@0
+
+    "Modified: 28.3.1997 / 16:27:32 / cg"
 !
 
 drawDragIn:aView at:drawOrigin
-    "draw the receiver for dragging"
+    "draw the receiver for dragging at some point"
+
+    |offs|
 
-    self class dragOutline ifTrue:[
-	self drawOutlineIn:aView offset:(drawOrigin - (self origin))
-    ] ifFalse: [
-	self drawIn:aView offset:(drawOrigin - (self origin))
-    ]
+    offs := drawOrigin - (self origin).
+    self drawDragIn:aView offset:offs
+
+    "Modified: 28.3.1997 / 16:20:17 / cg"
 !
 
 drawDragIn:aView offset:drawOrigin
+    "draw the receiver for dragging offset by some amount"
+
     self class dragOutline ifTrue:[
-	self drawOutlineIn:aView offset:drawOrigin
+        self class dragDashedOutline ifTrue:[
+            self drawDashedOutlineIn:aView offset:drawOrigin
+        ] ifFalse:[
+            self drawOutlineIn:aView offset:drawOrigin
+        ]
     ] ifFalse: [
-	self drawIn:aView offset:drawOrigin
+        self drawIn:aView offset:drawOrigin
     ]
+
+    "Modified: 28.3.1997 / 16:22:31 / cg"
 !
 
 drawIn:aView
     "draw the receiver at its origin"
 
-    self drawIn:aView offset:(0@0)
+    self drawIn:aView offset:0@0
+
+    "Modified: 28.3.1997 / 16:27:46 / cg"
 !
 
 drawIn:aView at:drawOrigin
@@ -263,7 +304,9 @@
 drawOutlineIn:aView
     "draw the receivers outline at its origin"
 
-    self drawOutlineIn:aView offset:(0@0)
+    self drawOutlineIn:aView offset:0@0
+
+    "Modified: 28.3.1997 / 16:27:50 / cg"
 !
 
 drawOutlineIn:aView at:drawOrigin
@@ -275,16 +318,25 @@
 drawOutlineIn:aView offset:anOffset
     "draw the receivers outline at its origin offset by anOffset, aPoint"
 
-    |org|
+    |org x y w h|
+
     org := self origin + anOffset.
-    aView displayRectangleX:org x y:org y
-		      width:frame width height:frame height
+    x := org x.
+    y := org y.
+    w := frame width.
+    h := frame height.
+
+    aView displayRectangleX:x y:y width:w height:h
+
+    "Modified: 28.3.1997 / 16:32:34 / cg"
 !
 
 drawSelectedIn:aView
     "draw the receiver highlighted at its position"
 
-    self drawSelectedIn:aView offset:(0@0)
+    self drawSelectedIn:aView offset:0@0
+
+    "Modified: 28.3.1997 / 16:27:56 / cg"
 !
 
 drawSelectedIn:aView offset:anOffset
@@ -432,5 +484,5 @@
 !DisplayObject class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/Attic/DObject.st,v 1.20 1996-06-05 14:00:20 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/Attic/DObject.st,v 1.21 1997-03-28 15:41:10 cg Exp $'
 ! !
--- a/DisplayObject.st	Thu Mar 27 15:14:10 1997 +0100
+++ b/DisplayObject.st	Fri Mar 28 16:41:10 1997 +0100
@@ -57,12 +57,25 @@
 
 !DisplayObject class methodsFor:'behavior'!
 
+dragDashedOutline
+    "if true, outline dragging is done by drawing the line dashed.
+     if false, the outline is drawn solid.
+     Can be redefined in subclasses (for solid outline)."
+
+    ^ true
+
+    "Created: 28.3.1997 / 16:21:56 / cg"
+    "Modified: 28.3.1997 / 16:40:54 / cg"
+!
+
 dragOutline
     "if true, dragging is done by drawing outline only;
-     if false, dragging is done by full draw (fast servers only)
-     - can be redefined in subclasses"
+     if false, dragging is done by full draw (fast servers only).
+     Can be redefined in subclasses (for full dragging)"
 
     ^ true
+
+    "Modified: 28.3.1997 / 16:40:44 / cg"
 ! !
 
 !DisplayObject methodsFor:'ST-80 drawing'!
@@ -216,36 +229,64 @@
 
 !DisplayObject methodsFor:'drawing'!
 
+drawDashedOutlineIn:aGC offset:anOffset
+    "draw the receivers outline at its origin offset by anOffset, aPoint"
+
+    |prevStyle|
+
+    prevStyle := aGC lineStyle.
+    aGC lineStyle:#dashed.
+    [
+        self drawOutlineIn:aGC offset:anOffset.
+    ] valueNowOrOnUnwindDo:[
+        aGC lineStyle:prevStyle.
+    ]
+
+    "Created: 28.3.1997 / 16:23:25 / cg"
+    "Modified: 28.3.1997 / 16:29:24 / cg"
+!
+
 drawDragIn:aView
-    self class dragOutline ifTrue:[
-	self drawOutlineIn:aView offset:(0 @ 0)
-    ] ifFalse: [
-	self drawIn:aView offset:(0 @ 0)
-    ]
+    "draw the receiver for dragging at its origin"
+
+    self drawDragIn:aView offset:0@0
+
+    "Modified: 28.3.1997 / 16:27:32 / cg"
 !
 
 drawDragIn:aView at:drawOrigin
-    "draw the receiver for dragging"
+    "draw the receiver for dragging at some point"
+
+    |offs|
 
-    self class dragOutline ifTrue:[
-	self drawOutlineIn:aView offset:(drawOrigin - (self origin))
-    ] ifFalse: [
-	self drawIn:aView offset:(drawOrigin - (self origin))
-    ]
+    offs := drawOrigin - (self origin).
+    self drawDragIn:aView offset:offs
+
+    "Modified: 28.3.1997 / 16:20:17 / cg"
 !
 
 drawDragIn:aView offset:drawOrigin
+    "draw the receiver for dragging offset by some amount"
+
     self class dragOutline ifTrue:[
-	self drawOutlineIn:aView offset:drawOrigin
+        self class dragDashedOutline ifTrue:[
+            self drawDashedOutlineIn:aView offset:drawOrigin
+        ] ifFalse:[
+            self drawOutlineIn:aView offset:drawOrigin
+        ]
     ] ifFalse: [
-	self drawIn:aView offset:drawOrigin
+        self drawIn:aView offset:drawOrigin
     ]
+
+    "Modified: 28.3.1997 / 16:22:31 / cg"
 !
 
 drawIn:aView
     "draw the receiver at its origin"
 
-    self drawIn:aView offset:(0@0)
+    self drawIn:aView offset:0@0
+
+    "Modified: 28.3.1997 / 16:27:46 / cg"
 !
 
 drawIn:aView at:drawOrigin
@@ -263,7 +304,9 @@
 drawOutlineIn:aView
     "draw the receivers outline at its origin"
 
-    self drawOutlineIn:aView offset:(0@0)
+    self drawOutlineIn:aView offset:0@0
+
+    "Modified: 28.3.1997 / 16:27:50 / cg"
 !
 
 drawOutlineIn:aView at:drawOrigin
@@ -275,16 +318,25 @@
 drawOutlineIn:aView offset:anOffset
     "draw the receivers outline at its origin offset by anOffset, aPoint"
 
-    |org|
+    |org x y w h|
+
     org := self origin + anOffset.
-    aView displayRectangleX:org x y:org y
-		      width:frame width height:frame height
+    x := org x.
+    y := org y.
+    w := frame width.
+    h := frame height.
+
+    aView displayRectangleX:x y:y width:w height:h
+
+    "Modified: 28.3.1997 / 16:32:34 / cg"
 !
 
 drawSelectedIn:aView
     "draw the receiver highlighted at its position"
 
-    self drawSelectedIn:aView offset:(0@0)
+    self drawSelectedIn:aView offset:0@0
+
+    "Modified: 28.3.1997 / 16:27:56 / cg"
 !
 
 drawSelectedIn:aView offset:anOffset
@@ -432,5 +484,5 @@
 !DisplayObject class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/DisplayObject.st,v 1.20 1996-06-05 14:00:20 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/DisplayObject.st,v 1.21 1997-03-28 15:41:10 cg Exp $'
 ! !