#REFACTORING by stefan
authorStefan Vogel <sv@exept.de>
Mon, 25 Jul 2016 15:52:29 +0200
changeset 7473 f557f225192b
parent 7472 2af1c55ce4b6
child 7474 ff35cd980d70
#REFACTORING by stefan class: DisplaySurface removed: #fillDeviceRectangleWithViewBackgroundX:y:width:height: #fillRectangleWithViewBackgroundX:y:width:height: changed: #clearDeviceRectangleX:y:width:height: #fillDeviceRectangleWithPattern:x:y:width:height:patternOffset: (send #deviceClippingBoundsOrNil instead of #deviceClippingRectangle, send #deviceClippingBounds: instead of #deviceClippingRectangle:)
DisplaySurface.st
--- a/DisplaySurface.st	Mon Jul 25 15:48:32 2016 +0200
+++ b/DisplaySurface.st	Mon Jul 25 15:52:29 2016 +0200
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1992 by Claus Gittinger
 	      All Rights Reserved
@@ -860,6 +858,53 @@
     flags := flags bitOr:GotExposeFlagMask.
 ! !
 
+!DisplaySurface methodsFor:'binary storage'!
+
+readBinaryContentsFrom: stream manager: manager
+    "tell the newly restored View to recreate itself.
+     Bug: does not work correctly yet.
+          (restored view looses its position & wg process)"
+
+    |wasRealized|
+
+    super readBinaryContentsFrom: stream manager: manager.
+
+    wasRealized := realized.
+    realized := false.
+    self recreate.
+    wasRealized ifTrue:[
+        self remap
+    ]
+
+
+    "
+     |s l|
+     s := 'storedLabel.boss' asFilename writeStream binary.
+     l := (Label label:'hello there') realize.
+     Delay waitForSeconds:1.
+     l storeBinaryOn:s.
+     s close.
+    "
+
+    "
+     |s l|
+     s := 'storedLabel.boss' asFilename writeStream binary.
+     (l := Label label:'hello there') open.
+     (Delay forSeconds:10) wait.
+     l storeBinaryOn:s.
+     s close.
+     l destroy.
+    "
+
+    "
+     |s|
+     s := 'storedLabel.boss' asFilename readStream binary.
+     (Object readBinaryFrom:s)
+    "
+
+    "Modified: 3.5.1996 / 23:59:38 / stefan"
+    "Modified: 14.2.1997 / 15:42:55 / cg"
+! !
 
 !DisplaySurface methodsFor:'button menus'!
 
@@ -1030,19 +1075,19 @@
             ^ self.
         ].
 
+        org := self viewOrigin.
         (device supportsMaskedDrawingWith:viewBackground) ifFalse:[
             "/ hand-fill: the device cannot draw with a bitmap pattern underneath.
-            self fillDeviceRectangleWithViewBackgroundX:x y:y width:w height:h.
+            self fillDeviceRectangleWithPattern:viewBackground x:x y:y width:w height:h patternOffset:org.
             ^ self.
         ].
 
-        org := self viewOrigin.
         patternOffsetX := (org x rounded \\ viewBackground width).
         patternOffsetY := (org y rounded \\ viewBackground height).
         (patternOffsetX ~= 0 or:[patternOffsetY ~= 0]) ifTrue:[
             (device supportsMaskedDrawingWithOffset:viewBackground) ifFalse:[
                 "/ hand-fill: the device cannot draw with a shifted bitmap pattern underneath.
-                self fillDeviceRectangleWithViewBackgroundX:x y:y width:w height:h.
+                self fillDeviceRectangleWithPattern:viewBackground x:x y:y width:w height:h patternOffset:org.
                 ^ self.
             ].
         ].
@@ -1185,19 +1230,6 @@
     "Modified: / 4.5.1999 / 20:40:12 / cg"
 !
 
-fillDeviceRectangleWithViewBackgroundX:xIn y:yIn width:wIn height:hIn
-    <resource: #obsolete>
-    "fill a rectangular area with the viewBackground.
-     A helper for devices which do not support background pixmaps (i.e. win95 screens).
-     This is never invoked with X11 or Win-NT/XP/Vista systems.
-     Caller must ensure that the viewBackground is really a form"
-
-    self
-	fillDeviceRectangleWithPattern:viewBackground
-	x:xIn y:yIn width:wIn height:hIn
-	patternOffset:self viewOrigin
-!
-
 fillRectangleWithPattern:aPixmap x:x y:y width:w height:h patternOffset:pattOffs
     <resource: #obsolete>
     "fill a rectangular area with aPixmap.
@@ -1240,19 +1272,6 @@
     "Modified: 4.6.1996 / 17:58:49 / cg"
 !
 
-fillRectangleWithViewBackgroundX:x y:y width:w height:h
-    <resource: #obsolete>
-    "fill a rectangular area with the viewBackground.
-     A helper for devices which do not support background pixmaps (i.e. win95 screens).
-     This is never invoked with X11 or Win-NT/XP/Vista systems.
-     Caller must ensure that the viewBackground is really a form"
-
-    self
-	fillRectangleWithPattern:viewBackground
-	x:x y:y width:w height:h
-	patternOffset:self viewOrigin
-!
-
 redraw
     "nothing done here"
     ^ self