SimpleView.st
changeset 3856 45fccc92d834
parent 3838 7a459c5888c8
child 3880 c4c8268a2d9f
--- a/SimpleView.st	Fri Apr 11 19:53:35 2003 +0200
+++ b/SimpleView.st	Tue Apr 15 13:58:09 2003 +0200
@@ -3461,9 +3461,12 @@
     "return the views sensor"
 
     windowGroup notNil ifTrue:[
-	^ windowGroup sensor.
-    ].
-    ^ nil
+        ^ windowGroup sensor.
+    ].
+
+    "there is now window group. Deliver events synchronously"
+
+    ^ SynchronousWindowSensor new.
 
     "Modified: 10.1.1997 / 19:47:13 / cg"
 !
@@ -4954,6 +4957,10 @@
 
     |leftEdge topEdge rightEdge botEdge anyEdge nx ny nw nh dx dy dw dh old oldPaint|
 
+    shown ifFalse:[
+        ^ self
+    ].
+
     nw := dw := w.
     nh := dh := h.
     nx := dx := x.
@@ -4965,118 +4972,118 @@
      check if there is a need to draw an edge (i.e. if margin is hit)
     "
     (margin ~~ 0) ifTrue:[
-	leftEdge := false.
-	topEdge := false.
-	rightEdge := false.
-	botEdge := false.
-	transformation notNil ifTrue:[
-	    "
-	     need device coordinates for this test
-	    "
-	    nx := transformation applyToX:nx.
-	    ny := transformation applyToY:ny.
-	    nw := transformation applyScaleX:nw.
-	    nh := transformation applyScaleY:nh.
-	].
-	"
-	 adjust expose rectangle, to exclude the margin.
-	 Care for rounding errors ...
-	"
-	(nx isMemberOf:SmallInteger) ifFalse:[
-	    old := nx.
-	    nx := nx truncated.
-	    nw := nw + (nx - old).
-	].
-	(ny isMemberOf:SmallInteger) ifFalse:[
-	    old := ny.
-	    ny := ny truncated.
-	    nh := nh + (ny - old).
-	].
-	(nw isMemberOf:SmallInteger) ifFalse:[
-	    nw := nw truncated + 1
-	].
-	(nh isMemberOf:SmallInteger) ifFalse:[
-	    nh := nh truncated + 1
-	].
-
-	dx := nx.
-	dy := ny.
-	dw := nw.
-	dh := nh.
-
-	(nx < margin) ifTrue:[
-	    old := nx.
-	    nx := margin.
-	    nw := nw - (nx - old).
-	    leftEdge := anyEdge := true.
-	].
-	((nx + nw - 1) >= (width - margin)) ifTrue:[
-	    nw := (width - margin - nx).
-	    rightEdge := anyEdge := true.
-	].
-	(ny < margin) ifTrue:[
-	    old := ny.
-	    ny := margin.
-	    nh := nh - (ny - old).
-	    topEdge := anyEdge := true.
-	].
-	((ny + nh - 1) >= (height - margin)) ifTrue:[
-	    nh := (height - margin - ny).
-	    botEdge := anyEdge := true.
-	].
-	transformation notNil ifTrue:[
-	    "
-	     need logical coordinates for redraw
-	    "
-	    nx := transformation applyInverseToX:nx.
-	    ny := transformation applyInverseToY:ny.
-	    nw := transformation applyInverseScaleX:nw.
-	    nh := transformation applyInverseScaleY:nh.
-	].
+        leftEdge := false.
+        topEdge := false.
+        rightEdge := false.
+        botEdge := false.
+        transformation notNil ifTrue:[
+            "
+             need device coordinates for this test
+            "
+            nx := transformation applyToX:nx.
+            ny := transformation applyToY:ny.
+            nw := transformation applyScaleX:nw.
+            nh := transformation applyScaleY:nh.
+        ].
+        "
+         adjust expose rectangle, to exclude the margin.
+         Care for rounding errors ...
+        "
+        (nx isMemberOf:SmallInteger) ifFalse:[
+            old := nx.
+            nx := nx truncated.
+            nw := nw + (nx - old).
+        ].
+        (ny isMemberOf:SmallInteger) ifFalse:[
+            old := ny.
+            ny := ny truncated.
+            nh := nh + (ny - old).
+        ].
+        (nw isMemberOf:SmallInteger) ifFalse:[
+            nw := nw truncated + 1
+        ].
+        (nh isMemberOf:SmallInteger) ifFalse:[
+            nh := nh truncated + 1
+        ].
+
+        dx := nx.
+        dy := ny.
+        dw := nw.
+        dh := nh.
+
+        (nx < margin) ifTrue:[
+            old := nx.
+            nx := margin.
+            nw := nw - (nx - old).
+            leftEdge := anyEdge := true.
+        ].
+        ((nx + nw - 1) >= (width - margin)) ifTrue:[
+            nw := (width - margin - nx).
+            rightEdge := anyEdge := true.
+        ].
+        (ny < margin) ifTrue:[
+            old := ny.
+            ny := margin.
+            nh := nh - (ny - old).
+            topEdge := anyEdge := true.
+        ].
+        ((ny + nh - 1) >= (height - margin)) ifTrue:[
+            nh := (height - margin - ny).
+            botEdge := anyEdge := true.
+        ].
+        transformation notNil ifTrue:[
+            "
+             need logical coordinates for redraw
+            "
+            nx := transformation applyInverseToX:nx.
+            ny := transformation applyInverseToY:ny.
+            nw := transformation applyInverseScaleX:nw.
+            nh := transformation applyInverseScaleY:nh.
+        ].
     ].
 
     (nw > 0 and:[nh > 0]) ifTrue:[
-	"
-	 redraw inside area
-	"
-	self clippingRectangle:(Rectangle left:nx top:ny width:nw height:nh).
-
-	device supportsAnyViewBackgroundPixmaps ifFalse:[
-	    "/ workaround: non-existing bg-pixmap support (win95)
-
-	    viewBackground isImageOrForm ifTrue:[
-		(device supportsViewBackgroundPixmap:viewBackground) ifFalse:[
-		    self fillRectangleWithViewBackgroundX:nx y:ny width:nw height:nh
-		]
-	    ].
-	].
-
-	self redrawX:nx y:ny width:nw height:nh.
+        "
+         redraw inside area
+        "
+        self clippingRectangle:(Rectangle left:nx top:ny width:nw height:nh).
+
+        device supportsAnyViewBackgroundPixmaps ifFalse:[
+            "/ workaround: non-existing bg-pixmap support (win95)
+
+            viewBackground isImageOrForm ifTrue:[
+                (device supportsViewBackgroundPixmap:viewBackground) ifFalse:[
+                    self fillRectangleWithViewBackgroundX:nx y:ny width:nw height:nh
+                ]
+            ].
+        ].
+
+        self redrawX:nx y:ny width:nw height:nh.
     ].
 
     "
      redraw edge(s)
     "
     anyEdge ifTrue:[
-	self deviceClippingRectangle:nil.
-	oldPaint := paint.
-	(topEdge and:[leftEdge and:[botEdge and:[rightEdge]]]) ifTrue:[
-	    self drawEdges
-	] ifFalse:[
-	    topEdge ifTrue:[
-		self drawTopEdge
-	    ].
-	    leftEdge ifTrue:[
-		self drawLeftEdge
-	    ].
-	    botEdge ifTrue:[
-		self drawBottomEdge
-	    ].
-	    rightEdge ifTrue:[
-		self drawRightEdge
-	    ]
-	].
-	self paint:oldPaint.
+        self deviceClippingRectangle:nil.
+        oldPaint := paint.
+        (topEdge and:[leftEdge and:[botEdge and:[rightEdge]]]) ifTrue:[
+            self drawEdges
+        ] ifFalse:[
+            topEdge ifTrue:[
+                self drawTopEdge
+            ].
+            leftEdge ifTrue:[
+                self drawLeftEdge
+            ].
+            botEdge ifTrue:[
+                self drawBottomEdge
+            ].
+            rightEdge ifTrue:[
+                self drawRightEdge
+            ]
+        ].
+        self paint:oldPaint.
     ].
     self deviceClippingRectangle:innerClipRect.
 
@@ -5240,34 +5247,33 @@
     amountToScroll := self verticalScrollStep.
     pageScroll := false.
 
-    (sensor := self sensor) notNil ifTrue:[
-	sensor ctrlDown ifTrue:[
-	    pageScroll := true
-	]
+    sensor := self sensor.
+    sensor ctrlDown ifTrue:[
+        pageScroll := true
     ].
 
     pageScroll ifFalse:[
-	(sensor isNil or:[sensor shiftDown]) ifFalse:[
-	    hCont := self heightOfContents.
-	    hCont > (self innerHeight * 3) ifTrue:[
-		factor := (hCont // self innerHeight) min:4.
-		amountToScroll := amountToScroll * factor.
-	    ]
-	]
+        sensor shiftDown ifFalse:[
+            hCont := self heightOfContents.
+            hCont > (self innerHeight * 3) ifTrue:[
+                factor := (hCont // self innerHeight) min:4.
+                amountToScroll := amountToScroll * factor.
+            ]
+        ]
     ].
 
     amount > 0 ifTrue:[
-	pageScroll ifTrue:[
-	    self pageUp
-	] ifFalse:[
-	    self scrollUp:amountToScroll
-	]
+        pageScroll ifTrue:[
+            self pageUp
+        ] ifFalse:[
+            self scrollUp:amountToScroll
+        ]
     ] ifFalse:[
-	pageScroll ifTrue:[
-	    self pageDown
-	] ifFalse:[
-	    self scrollDown:amountToScroll
-	]
+        pageScroll ifTrue:[
+            self pageDown
+        ] ifFalse:[
+            self scrollDown:amountToScroll
+        ]
     ].
 
     "Modified: / 21.5.1999 / 19:58:42 / cg"
@@ -5490,13 +5496,7 @@
      to handle events (useful to update low-prio views from
      a higher prio process, to avoid blocking in the high prio one)"
 
-    |sensor|
-
-    (sensor := self sensor) notNil ifTrue:[
-	sensor pushUserEvent:aSelector for:self withArguments:args
-    ] ifFalse:[
-	self perform:aSelector withArguments:args
-    ]
+    self sensor pushUserEvent:aSelector for:self withArguments:args
 
     "
      |v|
@@ -8206,22 +8206,15 @@
      damaged areas right now.
      The given rectangle is in logical coordinate space."
 
-    |sensor r|
-
-    (sensor := self sensor) notNil ifTrue:[
-        r := aRectangle.
-        transformation notNil ifTrue:[
-            r := transformation applyTo:r.
-        ].
-        sensor addDamage:r copy view:self.
-        (shown and:[doRepair]) ifTrue:[
-            self repairDamage
-        ]
-    ] ifFalse:[
-        shown ifTrue:[
-            self redrawX:aRectangle left y:aRectangle top
-                   width:aRectangle width height:aRectangle height
-        ].
+    |r|
+
+    r := aRectangle.
+    transformation notNil ifTrue:[
+        r := transformation applyTo:r.
+    ].
+    self sensor addDamage:r copy view:self.
+    (shown and:[doRepair]) ifTrue:[
+        self repairDamage
     ]
 
     "Modified: / 10.11.1998 / 01:55:03 / cg"
@@ -8233,18 +8226,9 @@
      damaged areas right now.
      The given rectangle is in device coordinate space."
 
-    |sensor|
-
-    (sensor := self sensor) notNil ifTrue:[
-        sensor addDamage:aRectangle copy view:self.
-        (shown and:[doRepair]) ifTrue:[
-            self repairDamage
-        ]
-    ] ifFalse:[
-        shown ifTrue:[
-            self redrawDeviceX:aRectangle left y:aRectangle top
-                         width:aRectangle width height:aRectangle height
-        ].
+    self sensor addDamage:aRectangle copy view:self.
+    (shown and:[doRepair]) ifTrue:[
+        self repairDamage
     ]
 
     "Modified: / 10.11.1998 / 01:55:03 / cg"
@@ -9383,7 +9367,7 @@
 !SimpleView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.470 2003-04-03 18:01:25 penk Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.471 2003-04-15 11:57:58 stefan Exp $'
 ! !
 
 SimpleView initialize!