[WASTE-list] WENew

Marco Piovanelli marco.piovanelli at pobox.com
Wed Nov 16 05:24:58 EST 2005


On Tue, 15 Nov 2005 22:07:07 -0500,
Alfred Van Hoek (vanhoek at mac.com) wrote:



>It looks like WENew is automagically creating a CGContext starting with

>a quickdraw graphics port.The implementation of WASTE 3.0 does not

>rely on SetInfo(wePort) anymore, it just grabs the GWorld of the front

>window. It appears to work, we did not change our implementation of

>creating an instance of WASTE, but WENew will only work if a window is

>created already.

>

>Wouldn't it be better to let us assign a CGContext, rather then WENew?


The WASTE 3.0 implementation of WENew() uses whatever Quickdraw port
is current at WENew() time, just like previous implementations of
WENew(). The semantics of WENew() hasn't changed in this regard.
BTW, I don't think I assume the current Quickdraw port belongs to a
window -- it just has to be a valid QD port.

You're correct in stating that WESetInfo() doesn't currently work with
the wePort selector -- that's an oversight I'll fix ASAP.

Of course, since WASTE 3.0 is now using Core Graphics exclusively
for drawing, it would be better to create a WASTE view object
directly from a CGContext. While this isn't currently possible
through the compatibility APIs exposed by WASTE.framework, it can
be done by calling the underlying C++ core directly, with something
like this:

WEReference
MyWENewWithCGContext
(
CGRect inTextRect,
OptionBits inOptions,
CGContextRef inCGContext
)
{
WE3_TextController * controller = new WE3_TextController (
new WE3_TextModel ( new WE3_DefaultTextStorage ), inOptions ) ;
WE3_TextView * view = controller -> MakeNewView ( inCGContext,
inTextRect, inTextRect ) ;
controller -> SetCurrentView ( view ) ;
return controller ;
}

Also, with the forthcoming HIView wrapper for WASTE 3.0 you won't
need to specify a CGContext at creation time -- WASTE will just use
whatever context the HIToolbox passes to the kEventControlDraw handler.


-- marco

--
It's not the data universe only, it's human conversation.
They want to turn it into a one-way flow that they have entirely
monetized. I look at the collective human mind as a kind of
ecosystem. They want to clear cut it. They want to go into the
rainforest of human thought and mow the thing down.



More information about the WASTE-list mailing list