--- a/ObjectView.st Tue Feb 18 15:57:23 2014 +0100
+++ b/ObjectView.st Tue Feb 18 16:01:30 2014 +0100
@@ -674,7 +674,7 @@
sel := self getClipboardObject.
((Screen current platformName ~= 'X11')
- or:[(device getSelectionOwnerOf:#CLIPBOARD) == drawableId])
+ or:[(self graphicsDevice getSelectionOwnerOf:#CLIPBOARD) == self drawableId])
ifTrue:[
"
a local selection - paste with some offset
@@ -717,28 +717,31 @@
"check if line drag is into another view"
rootMotion ifTrue:[
+ |currentTransformation|
+
rootPoint := lastButt.
"
get device coordinates
"
- transformation notNil ifTrue:[
- rootPoint := transformation applyTo:rootPoint.
+ currentTransformation := gc transformation.
+ currentTransformation notNil ifTrue:[
+ rootPoint := currentTransformation applyTo:rootPoint.
].
"
translate to screen
"
- offs := device translatePoint:0@0 fromView:self toView:rootView.
+ offs := self graphicsDevice translatePoint:0@0 fromView:self toView:rootView.
rootPoint := rootPoint + offs.
"search view the drop is in"
viewId := rootView id.
[viewId notNil] whileTrue:[
- destinationId := device viewIdFromPoint:rootPoint in:viewId.
+ destinationId := self graphicsDevice viewIdFromPoint:rootPoint in:viewId.
lastViewId := viewId.
viewId := destinationId
].
- destinationView := device viewFromId:lastViewId.
+ destinationView := self graphicsDevice viewFromId:lastViewId.
destinationId := lastViewId.
inMySelf := (destinationView == self).
rootMotion := false
@@ -755,7 +758,7 @@
] ifFalse:[
"into another one"
destinationView notNil ifTrue:[
- destinationPoint := device translatePoint:rootPoint fromView:rootView toView:destinationView.
+ destinationPoint := self graphicsDevice translatePoint:rootPoint fromView:rootView toView:destinationView.
(transformation2 := destinationView transformation) notNil ifTrue:[
destinationPoint := transformation2 applyInverseTo:destinationPoint
].
@@ -788,18 +791,21 @@
p1 := dragObject origin.
p2 := dragObject corner.
rootMotion ifTrue:[
+ |currentTransformation|
+
dragger := rootView.
"
get device coordinates
"
- transformation notNil ifTrue:[
- p1 := transformation applyTo:p1.
- p2 := transformation applyTo:p2.
+ currentTransformation := gc transformation.
+ currentTransformation notNil ifTrue:[
+ p1 := currentTransformation applyTo:p1.
+ p2 := currentTransformation applyTo:p2.
].
"
translate to screen
"
- offs := device translatePoint:0@0 fromView:self toView:rootView.
+ offs := self graphicsDevice translatePoint:0@0 fromView:self toView:rootView.
p1 := p1 + offs.
p2 := p2 + offs.
] ifFalse:[
@@ -929,26 +935,29 @@
"check if object is to be put into another view"
rootMotion ifTrue:[
+ |currentTransformation|
+
p := lastButt.
"
get device coordinates
"
- transformation notNil ifTrue:[
- p := transformation applyTo:p.
+ currentTransformation := gc transformation.
+ currentTransformation notNil ifTrue:[
+ p := currentTransformation applyTo:p.
].
"
translate to screen
"
- rootPoint := p + (device translatePoint:0@0 fromView:self toView:rootView).
+ rootPoint := p + (self graphicsDevice translatePoint:0@0 fromView:self toView:rootView).
"search view the drop is in"
viewId := rootView id.
[viewId notNil] whileTrue:[
- destinationId := device viewIdFromPoint:rootPoint in:viewId.
+ destinationId := self graphicsDevice viewIdFromPoint:rootPoint in:viewId.
lastViewId := viewId.
viewId := destinationId
].
- destinationView := device viewFromId:lastViewId.
+ destinationView := self graphicsDevice viewFromId:lastViewId.
destinationId := lastViewId.
inMySelf := (destinationView == self).
rootMotion := false
@@ -960,7 +969,7 @@
"simple move"
self move:movedObject by:moveDelta
] ifFalse:[
- destinationPoint := device translatePoint:rootPoint "/ use id here - could be alian view
+ destinationPoint := self graphicsDevice translatePoint:rootPoint "/ use id here - could be alian view
from:(rootView id)
to:destinationId.
destinationView notNil ifTrue:[
@@ -991,24 +1000,22 @@
|dragger offs p d scale oldTrans|
rootMotion ifTrue:[
+ |currentTransformation|
p := movedObject origin + moveDelta.
dragger := rootView.
"
get device coordinates
"
-"/ 'logical ' print. p printNL.
+ currentTransformation := gc transformation.
transformation notNil ifTrue:[
scale := transformation scale.
p := transformation applyTo:p.
-"/ 'device ' print. p printNL.
].
"
translate to screen
"
- offs := device translatePoint:0@0 fromView:self toView:rootView.
-"/ 'offs' print. offs printNL.
+ offs := self graphicsDevice translatePoint:0@0 fromView:self toView:rootView.
p := p + offs.
-"/ 'screen ' print. p printNL.
"
p is where we want it ...
have to adust slightly, since showDragging shows the object
@@ -1189,10 +1196,10 @@
shown ifTrue:[
vis := aRectangle.
- clipRect notNil ifTrue:[
- vis := vis intersect:clipRect
+ oldClip := self clippingBoundsOrNil.
+ oldClip notNil ifTrue:[
+ vis := vis intersect:oldClip
].
- oldClip := clipRect.
self clippingRectangle:vis.
self redrawObjectsAbove:anObject intersecting:vis.
@@ -1212,10 +1219,10 @@
shown ifTrue:[
vis := aRectangle.
- clipRect notNil ifTrue:[
- vis := vis intersect:clipRect
+ oldClip := self clippingBoundsOrNil.
+ oldClip notNil ifTrue:[
+ vis := vis intersect:oldClip
].
- oldClip := clipRect.
self clippingRectangle:vis.
self redrawObjectsAbove:anObject intersectingVisible:vis.
@@ -1257,10 +1264,10 @@
visRect := visRect origin truncated
corner:(visRect corner + (1@1)) truncated.
"/ ].
- clipRect notNil ifTrue:[
- visRect := visRect intersect:clipRect
+ oldClip := self clippingBoundsOrNil.
+ oldClip notNil ifTrue:[
+ visRect := visRect intersect:oldClip
].
- oldClip := clipRect.
self clippingRectangle:visRect.
self clearRectangle:visRect.
@@ -1280,18 +1287,18 @@
shown ifTrue:[
vis := visRect.
- clipRect notNil ifTrue:[
- vis := vis intersect:clipRect
+ oldClip := self clippingBoundsOrNil.
+ oldClip notNil ifTrue:[
+ vis := vis intersect:oldClip
].
- transformation notNil ifTrue:[
-"/ transformation scale ~~ 1 ifTrue:[
+ gc transformation notNil ifTrue:[
+"/ gc transformation scale ~~ 1 ifTrue:[
vis := vis origin truncated
corner:(vis corner + (1@1)) truncated.
"/ ]
].
- oldClip := clipRect.
self clippingRectangle:vis.
"/ no clear background; already done in redrawX:y:width:height:
@@ -1327,11 +1334,14 @@
|vFrame|
(aGC == self) ifTrue:[
+ |currentTransformation|
+
shown ifFalse:[^ self].
vFrame := Rectangle left:0 top:0 width:width height:height.
- transformation notNil ifTrue:[
- vFrame := transformation applyInverseTo:vFrame.
+ currentTransformation := gc transformation.
+ currentTransformation notNil ifTrue:[
+ vFrame := currentTransformation applyInverseTo:vFrame.
].
self redrawObjectsIntersecting:vFrame
] ifFalse:[
@@ -1414,7 +1424,7 @@
buttonMotion:buttonState x:buttX y:buttY
"user moved mouse while button pressed"
- |xpos ypos movePoint limitW limitH minDeltaForMotion|
+ |xpos ypos movePoint limitW limitH minDeltaForMotion currentTransformation|
"is it the select or 1-button ?"
buttonState == 0 ifTrue:[^ self].
@@ -1428,9 +1438,10 @@
rootMotion ifFalse:[
limitW := width.
limitH := height.
- transformation notNil ifTrue:[
- limitW := transformation applyInverseToX:width.
- limitH := transformation applyInverseToY:height.
+ currentTransformation := gc transformation.
+ currentTransformation notNil ifTrue:[
+ limitW := currentTransformation applyInverseToX:width.
+ limitH := currentTransformation applyInverseToY:height.
].
(xpos < 0) ifTrue:[
@@ -1456,8 +1467,9 @@
] ifFalse:[
minDeltaForMotion := self class mouseMotionDeltaForMove
].
- transformation notNil ifTrue:[
- minDeltaForMotion := transformation applyInverseToX:minDeltaForMotion.
+ currentTransformation := gc transformation.
+ currentTransformation notNil ifTrue:[
+ minDeltaForMotion := currentTransformation applyInverseToX:minDeltaForMotion.
].
((xpos - (lastButt x)) abs < minDeltaForMotion
and:[ (ypos - (lastButt y)) abs < minDeltaForMotion]) ifTrue:[
@@ -1605,7 +1617,7 @@
|mmH mmV params showDocumentBoundary gridW gridH
bigStepH bigStepV littleStepH littleStepV hires
- devPixmap colorMap fg bg|
+ devPixmap colorMap fg bg currentTransformation|
mmH := self horizontalPixelPerMillimeter.
mmV := self verticalPixelPerMillimeter.
@@ -1627,16 +1639,17 @@
].
].
- transformation notNil ifTrue:[
- mmH := mmH * transformation scale x.
- mmV := mmV * transformation scale y.
- bigStepH := bigStepH * transformation scale x.
- bigStepV := bigStepV * transformation scale y.
+ currentTransformation := gc transformation.
+ currentTransformation notNil ifTrue:[
+ mmH := mmH * currentTransformation scale x.
+ mmV := mmV * currentTransformation scale y.
+ bigStepH := bigStepH * currentTransformation scale x.
+ bigStepV := bigStepV * currentTransformation scale y.
littleStepH notNil ifTrue:[
- littleStepH := littleStepH * transformation scale x.
+ littleStepH := littleStepH * currentTransformation scale x.
].
littleStepV notNil ifTrue:[
- littleStepV := littleStepV * transformation scale y.
+ littleStepV := littleStepV * currentTransformation scale y.
].
].
@@ -1748,10 +1761,10 @@
gridPixmap displayLineFromX:0 y:gridH-1 toX:gridW-1 y:gridH-1.
].
- device platformName = 'WIN32' ifTrue:[
+ self graphicsDevice platformName = 'WIN32' ifTrue:[
"/ kludge - needs a deep form
colorMap := gridPixmap colorMap.
- devPixmap := Form width:gridW height:gridH depth:device depth onDevice:device.
+ devPixmap := Form width:gridW height:gridH depth:self graphicsDevice depth onDevice:self graphicsDevice.
devPixmap notNil ifTrue:[
devPixmap paint:(colorMap at:1).
devPixmap fillRectangleX:0 y:0 width:gridW height:gridH.
@@ -1792,7 +1805,7 @@
if littleStepH/V are nil, only bigSteps are drawn.
"
- |mmH mmV bigStepH bigStepV littleStepH littleStepV arr|
+ |mmH mmV bigStepH bigStepV littleStepH littleStepV arr currentTransformation|
"example: 12grid & 12snapIn"
"/ ^ #(12 12 nil nil 12 12 false).
@@ -1805,6 +1818,7 @@
mmH := self horizontalPixelPerMillimeter.
mmV := self verticalPixelPerMillimeter.
+ currentTransformation := gc transformation.
"
metric grid: small steps every millimeter, big step every
@@ -1815,8 +1829,8 @@
"dots every mm; lines every cm"
bigStepH := mmH * 10.0.
bigStepV := mmV * 10.0.
- (transformation notNil
- and:[transformation scale <= 0.5]) ifFalse:[
+ (currentTransformation notNil
+ and:[currentTransformation scale <= 0.5]) ifFalse:[
littleStepH := mmH.
littleStepV := mmV
]
@@ -1830,9 +1844,9 @@
"dots every eights inch; lines every half inch"
bigStepH := mmH * (25.4 / 2).
bigStepV := mmV * (25.4 / 2).
- (transformation notNil
- and:[transformation scale <= 0.5]) ifTrue:[
- transformation scale > 0.2 ifTrue:[
+ (currentTransformation notNil
+ and:[currentTransformation scale <= 0.5]) ifTrue:[
+ currentTransformation scale > 0.2 ifTrue:[
littleStepH := mmH * (25.4 / 4).
littleStepV := mmV * (25.4 / 4)
]
@@ -2123,7 +2137,7 @@
intersects := oldFrame intersects:newFrame.
intersects ifFalse:[
self hasSolidBackground ifTrue:[
- transformation isNil ifTrue:[
+ gc transformation isNil ifTrue:[
(objectsIntersectingOldFrame size == 1) ifTrue:[
(objectsIntersectingNewFrame size == 1) ifTrue:[
clip := self clippingRectangleOrNil.
@@ -2329,11 +2343,12 @@
We compensate for any scaling here, to get a constant physical
hitDelta (i.e. the value returned here is inverse scaled)."
- |delta|
+ |delta currentTransformation|
delta := self class hitDelta.
- transformation notNil ifTrue:[
- delta := delta / transformation scale x
+ currentTransformation := gc transformation.
+ currentTransformation notNil ifTrue:[
+ delta := delta / currentTransformation scale x
].
^ delta
!
@@ -2766,9 +2781,9 @@
Redefined to scroll by inches or centimeters."
scaleMetric == #inch ifTrue:[
- ^ (device horizontalPixelPerInch * (1/2)) asInteger
+ ^ (self graphicsDevice horizontalPixelPerInch * (1/2)) asInteger
].
- ^ (device horizontalPixelPerMillimeter * 20) asInteger
+ ^ (self graphicsDevice horizontalPixelPerMillimeter * 20) asInteger
!
verticalScrollStep
@@ -2776,9 +2791,9 @@
Redefined to scroll by inches or centimeters."
scaleMetric == #inch ifTrue:[
- ^ (device verticalPixelPerInch * (1/2)) asInteger
+ ^ (self graphicsDevice verticalPixelPerInch * (1/2)) asInteger
].
- ^ (device verticalPixelPerMillimeter * 20) asInteger
+ ^ (self graphicsDevice verticalPixelPerMillimeter * 20) asInteger
! !
!ObjectView methodsFor:'selection & handles'!
@@ -2872,11 +2887,12 @@
the same size regardless of scaling, inverse-scale from
what the default is."
- |hs|
+ |hs currentTransformation|
hs := self class handleSize.
- transformation notNil ifTrue:[
- ^ transformation applyInverseScaleX:hs
+ currentTransformation := gc transformation.
+ currentTransformation notNil ifTrue:[
+ ^ currentTransformation applyInverseScaleX:hs
].
^ hs
!
@@ -3452,11 +3468,11 @@
].
(newScale = 1) ifTrue:[
- transformation := nil
+ gc transformation:nil
] ifFalse:[
- transformation := WindowingTransformation
- scale:newScale
- translation:(currentTranslation / currentScale x * newScale x ) rounded.
+ gc transformation:(WindowingTransformation
+ scale:newScale
+ translation:(currentTranslation / currentScale x * newScale x ) rounded).
].
self contentsChanged.
self setInnerClip.
@@ -3479,12 +3495,15 @@
zoomIn:factor
"zoom in by multiplying the zoom factor by the argument"
- transformation isNil ifTrue:[
- transformation := WindowingTransformation scale:1 translation:0
+ |currentTransformation|
+
+ currentTransformation := gc transformation.
+ currentTransformation isNil ifTrue:[
+ currentTransformation := WindowingTransformation scale:1 translation:0
].
- transformation := WindowingTransformation
- scale:(transformation scale * factor)
- translation:(transformation translation * factor) rounded.
+ gc transformation:(WindowingTransformation
+ scale:(currentTransformation scale * factor)
+ translation:(currentTransformation translation * factor) rounded).
self contentsChanged.
self setInnerClip.
self invalidate.
@@ -3513,10 +3532,10 @@
!ObjectView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/ObjectView.st,v 1.137 2013-07-13 20:33:12 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/ObjectView.st,v 1.138 2014-02-18 15:01:30 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libwidg/ObjectView.st,v 1.137 2013-07-13 20:33:12 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/ObjectView.st,v 1.138 2014-02-18 15:01:30 stefan Exp $'
! !