SimpleView.st
branchjv
changeset 7765 b8189ae681df
parent 7742 b5a20c01d46f
parent 7747 b957c1314cca
child 7803 14d6df784ebb
equal deleted inserted replaced
7743:fa3c8eb0bc1d 7765:b8189ae681df
 10966 
 10966 
 10967     hCont := self heightOfContents.
 10967     hCont := self heightOfContents.
 10968     wCont := self widthOfContents.
 10968     wCont := self widthOfContents.
 10969     currentTransformation := gc transformation.
 10969     currentTransformation := gc transformation.
 10970     currentTransformation isNil ifTrue:[
 10970     currentTransformation isNil ifTrue:[
 10971 	orgY := orgX := 0
 10971         orgY := orgX := 0
 10972     ] ifFalse:[
 10972     ] ifFalse:[
 10973 	wCont := (currentTransformation applyScaleX:wCont) rounded.
 10973         wCont := (currentTransformation applyScaleX:wCont) rounded.
 10974 	hCont := (currentTransformation applyScaleY:hCont) rounded.
 10974         hCont := (currentTransformation applyScaleY:hCont) rounded.
 10975 	orgY := currentTransformation translation y negated.
 10975         orgY := currentTransformation translation y negated.
 10976 	orgX := currentTransformation translation x negated
 10976         orgX := currentTransformation translation x negated
 10977     ].
 10977     ].
 10978 
 10978 
 10979     iw := self innerWidth.
 10979     iw := self innerWidth.
 10980     ih := self innerHeight.
 10980     ih := self innerHeight.
 10981 
 10981 
 10983 
 10983 
 10984     x := newOrigin x.
 10984     x := newOrigin x.
 10985     y := newOrigin y.
 10985     y := newOrigin y.
 10986 
 10986 
 10987     allowScrollBeyondContents ifFalse:[
 10987     allowScrollBeyondContents ifFalse:[
 10988 	x + iw > wCont ifTrue:[
 10988         x + iw > wCont ifTrue:[
 10989 	    x := (wCont - iw) asInteger.
 10989             x := (wCont - iw) asInteger.
 10990 	].
 10990         ].
 10991     ].
 10991     ].
 10992     x < 0 ifTrue:[
 10992     x < 0 ifTrue:[
 10993 	x := 0
 10993         x := 0
 10994     ].
 10994     ].
 10995     allowScrollBeyondContents ifFalse:[
 10995     allowScrollBeyondContents ifFalse:[
 10996 	y + ih > hCont ifTrue:[
 10996         y + ih > hCont ifTrue:[
 10997 	    y := (hCont - ih) asInteger.
 10997             y := (hCont - ih) asInteger.
 10998 	].
 10998         ].
 10999     ].
 10999     ].
 11000     y < 0 ifTrue:[
 11000     y < 0 ifTrue:[
 11001 	y := 0.
 11001         y := 0.
 11002     ].
 11002     ].
 11003 
 11003 
 11004     dX := x - orgX.
 11004     dX := x - orgX.
 11005     dY := y - orgY.
 11005     dY := y - orgY.
 11006 
 11006 
 11007     (dX == 0 and:[dY == 0]) ifTrue:[
 11007     (dX == 0 and:[dY == 0]) ifTrue:[
 11008        ^ self
 11008        ^ self
 11009     ].
 11009     ].
 11010 
 11010 
 11011     (wg := self windowGroup) notNil ifTrue:[
 11011     (wg := self windowGroup) notNil ifTrue:[
 11012 	wg processRealExposeEventsFor:self.
 11012         wg processRealExposeEventsFor:self.
 11013     ].
 11013     ].
 11014 
 11014 
 11015     self originWillChange.
 11015     self originWillChange.
 11016     (shown and:[doRedraw]) ifTrue:[
 11016     (shown and:[doRedraw]) ifTrue:[
 11017 	copyWidth := iw - dX abs.
 11017         copyWidth := iw - dX abs.
 11018 	copyHeight := ih - dY abs.
 11018         copyHeight := ih - dY abs.
 11019 	((copyWidth > 0) and:[copyHeight > 0]) ifTrue:[
 11019         ((copyWidth > 0) and:[copyHeight > 0]) ifTrue:[
 11020 	    "/ some of the currently displayed pixels
 11020             "/ some of the currently displayed pixels
 11021 	    "/ remain visible. Copy them
 11021             "/ remain visible. Copy them
 11022 
 11022 
 11023 	    dX < 0 ifTrue:[
 11023             dX < 0 ifTrue:[
 11024 	      fromX := margin.
 11024               fromX := margin.
 11025 	      toX := margin - dX.
 11025               toX := margin - dX.
 11026 	      redrawX := margin
 11026               redrawX := margin
 11027 	    ] ifFalse:[
 11027             ] ifFalse:[
 11028 	      fromX := margin + dX.
 11028               fromX := margin + dX.
 11029 	      toX := margin.
 11029               toX := margin.
 11030 	      redrawX := margin + copyWidth.
 11030               redrawX := margin + copyWidth.
 11031 	    ].
 11031             ].
 11032 	    dY < 0 ifTrue:[
 11032             dY < 0 ifTrue:[
 11033 	      fromY := margin.
 11033               fromY := margin.
 11034 	      toY   := margin - dY.
 11034               toY   := margin - dY.
 11035 	      redrawY := margin.
 11035               redrawY := margin.
 11036 	    ] ifFalse:[
 11036             ] ifFalse:[
 11037 	      fromY := margin + dY.
 11037               fromY := margin + dY.
 11038 	      toY   := margin.
 11038               toY   := margin.
 11039 	      redrawY := margin + copyHeight.
 11039               redrawY := margin + copyHeight.
 11040 	    ].
 11040             ].
 11041 	    self catchExpose.
 11041             self catchExpose.
 11042 	    self setViewOrigin:(x @ y).
 11042             self setViewOrigin:(x @ y).
 11043 	    self
 11043             self
 11044 		copyFrom:self
 11044                 copyFrom:self
 11045 		x:fromX y:fromY
 11045                 x:fromX y:fromY
 11046 		toX:toX   y:toY
 11046                 toX:toX   y:toY
 11047 		width:copyWidth
 11047                 width:copyWidth
 11048 		height:copyHeight
 11048                 height:copyHeight
 11049 		async:true.
 11049                 async:true.
 11050 
 11050 
 11051 	    self setInnerClip.
 11051             self setInnerClip.
 11052 
 11052 
 11053 	    "first redraw the rectangle above/below the
 11053             "first redraw the rectangle above/below the
 11054 	     copied area (with full width)."
 11054              copied area (with full width)."
 11055 
 11055 
 11056 	    copyHeight < ih ifTrue:[
 11056             copyHeight < ih ifTrue:[
 11057 	    self invalidateDeviceRectangle:((margin@redrawY) extent:(iw@(ih - copyHeight))) repairNow:false.
 11057                 self invalidateDeviceRectangle:((margin@redrawY) extent:(iw@(ih - copyHeight))) repairNow:false.
 11058 "/                self
 11058             ].
 11059 "/                    redrawDeviceX:margin y:redrawY
 11059 
 11060 "/                    width:iw height:(ih - copyHeight).
 11060             "second redraw the rectangle left/right of the
 11061 	    ].
 11061              copied area"
 11062 
 11062 
 11063 	    "second redraw the rectangle left/right of the
 11063             copyWidth < iw ifTrue:[
 11064 	     copied area"
 11064                 self invalidateDeviceRectangle:((redrawX@toY) extent:((iw-copyWidth)@copyHeight)) repairNow:false.
 11065 
 11065             ].
 11066 	    copyWidth < iw ifTrue:[
 11066             self waitForExpose.
 11067 	    self invalidateDeviceRectangle:((redrawX@toY) extent:((iw-copyWidth)@copyHeight)) repairNow:false.
 11067         ] ifFalse:[
 11068 "/                self redrawDeviceX:redrawX y:toY
 11068             "redraw everything"
 11069 "/
 11069 
 11070 "/                             width:iw - copyWidth
 11070             self setViewOrigin:(x @ y).
 11071 "/                            height:copyHeight.
 11071             self invalidateDeviceRectangle:((margin@margin) extent:(iw@ih)) repairNow:false.
 11072 	    ].
 11072         ].
 11073 	    self waitForExpose.
       
 11074 	] ifFalse:[
       
 11075 	    "redraw everything"
       
 11076 
       
 11077 	    self setViewOrigin:(x @ y).
       
 11078 	    self invalidateDeviceRectangle:((margin@margin) extent:(iw@ih)) repairNow:false.
       
 11079 "/            self redrawDeviceX:margin y:margin
       
 11080 "/                         width:iw
       
 11081 "/                        height:ih.
       
 11082 	].
       
 11083     ] ifFalse:[
 11073     ] ifFalse:[
 11084 	self setViewOrigin:(x @ y).
 11074         self setViewOrigin:(x @ y).
 11085     ].
 11075     ].
 11086 
 11076 
 11087     self originChanged:(dX negated @ dY negated).
 11077     self originChanged:(dX negated @ dY negated).
 11088 
 11078 
 11089     "Modified: / 5.8.1996 / 11:57:09 / stefan"
 11079     "Modified: / 5.8.1996 / 11:57:09 / stefan"