# HG changeset patch # User Jan Vrany # Date 1459846857 -3600 # Node ID cdf856e789989b8b41c670d3e0a0bb2941b20d48 # Parent f3deda9cea3eb8bccea5bad2631c1e3611eb6573 CairoGraphicsContext: Fixed paint setting Even though methods like #foreground: / #foreground:background: method are marked obsolete for quite some time, a lot of core widgets are still using them (!). Therefore CairoGraphicsContext must implement them to correctly update Cairo context. This fixes issues with EditField. diff -r f3deda9cea3e -r cdf856e78998 CairoGraphicsContext.st --- a/CairoGraphicsContext.st Tue Apr 05 08:02:32 2016 +0100 +++ b/CairoGraphicsContext.st Tue Apr 05 10:00:57 2016 +0100 @@ -185,9 +185,8 @@ super deviceClippingBounds: aRectangleOrNil. self deviceCoordinatesDo:[ cr notNil ifTrue:[ - aRectangleOrNil isNil ifTrue:[ - cr clipReset - ] ifFalse:[ + cr clipReset. + aRectangleOrNil notNil ifTrue:[ cr rectangleX: aRectangleOrNil left y: aRectangleOrNil top width: aRectangleOrNil width @@ -198,6 +197,7 @@ ]. "Created: / 27-03-2016 / 00:09:19 / Jan Vrany " + "Modified: / 05-04-2016 / 16:42:34 / Jan Vrany " ! function:aFunctionSymbol @@ -279,6 +279,56 @@ "Modified: / 02-04-2016 / 15:55:29 / jv" ! ! +!CairoGraphicsContext methodsFor:'accessing-internals'! + +foreground:aColor + + "set the internal foreground color for drawing - aColor must be a real color. + OBSOLETE: this method will vanish; use #paint: / #paint:on:" + + (aColor ~~ foreground) ifTrue:[ + aColor notNil ifTrue:[ + super foreground:aColor. + cr notNil ifTrue:[ + cr source: paint. + ]. + ] + ] + + "Created: / 05-04-2016 / 16:59:29 / Jan Vrany " +! + +foreground:fgColor background:bgColor + + "set both internal foreground and internal background colors + - these must be real colors. + OBSOLETE: this method will vanish; use #paint: / #paint:on:" + + ((fgColor ~~ foreground) or:[bgColor ~~ background]) ifTrue:[ + super foreground:fgColor background:bgColor. + cr notNil ifTrue:[ + cr source: paint. + ]. + ] + + "Created: / 05-04-2016 / 17:00:13 / Jan Vrany " +! + +foreground:aColor function:fun + + "set the foreground color and function for drawing. + OBSOLETE: this method will vanish; use #paint: / #paint:on:" + + ((aColor ~~ foreground) or:[fun ~~ function]) ifTrue:[ + super foreground:aColor function:fun. + cr notNil ifTrue:[ + cr source: paint. + ]. + ] + + "Created: / 05-04-2016 / 17:01:09 / Jan Vrany " +! ! + !CairoGraphicsContext methodsFor:'accessing-transformation'! transformation:aTransformation diff -r f3deda9cea3e -r cdf856e78998 Cairo__LineJoin.st --- a/Cairo__LineJoin.st Tue Apr 05 08:02:32 2016 +0100 +++ b/Cairo__LineJoin.st Tue Apr 05 10:00:57 2016 +0100 @@ -9,6 +9,7 @@ category:'Cairo-Constants' ! + !LineJoin class methodsFor:'initialization'! initialize @@ -35,5 +36,12 @@ ^CAIRO_LINE_JOIN_ROUND ! ! +!LineJoin class methodsFor:'documentation'! + +version_HG + + ^ '$Changeset: $' +! ! + LineJoin initialize! diff -r f3deda9cea3e -r cdf856e78998 tests/CairoGraphicsContextTests.st --- a/tests/CairoGraphicsContextTests.st Tue Apr 05 08:02:32 2016 +0100 +++ b/tests/CairoGraphicsContextTests.st Tue Apr 05 10:00:57 2016 +0100 @@ -322,6 +322,29 @@ top open. "Created: / 04-04-2016 / 18:45:05 / Jan Vrany " +! + +manual_02 + " + CairoGraphicsContextTests new manual_02 + " + + |top textView | + + top := StandardSystemView new. + top extent:300@25. + + textView := EditField new. + textView cairoify. + textView origin:0.0 @ 0.0 corner:1.0 @ 1.0. + top addSubView:textView. + + + + top open. + + "Created: / 05-04-2016 / 09:02:19 / Jan Vrany " + "Modified: / 05-04-2016 / 13:04:46 / Jan Vrany " ! ! !CairoGraphicsContextTests class methodsFor:'documentation'!