[WASTE-list] Drawing issues with WASTE 3.1

Marco Piovanelli marco.piovanelli at pobox.com
Thu Mar 27 07:13:07 EDT 2008


On Tue, 25 Mar 2008 12:30:39 -0500,
Dan Korn (dkorn at printable.com) wrote:



>I'm upgrading a PPC-only project that had been built in CodeWarrior

>using WASTE 2.1b1 to a Universal Binary project in Xcode using WASTE

>3.0 (v3.1b2). I'm using a modified version of the WTextView

>PowerPlant wrappers, with the QuickDraw eumlation in Leopard.

>

>Everything seems to be mostly working, but I'm having an issue where

>the text is sometimes drawn at the top left of my PowerPlant dialog

>instead of in the pane for the WTextView. It seems to depend on

>whether I have some text selected. If there's something selected, and

>I modify the text with WESetAttributes, it draws correctly. But if

>nothing is selected, and I modify the "null style" with

>WESetAttributes, everything gets drawn in the wrong place. I think

>all my calls to FocusDraw() are in the right places, and they seem to

>work in 2.1, but there's something different about 3.0.

>

>Any ideas? I might have to do something like suppress drawing when

>there's no selection. I can try to create a sample project which

>shows the problem, but it's going to be big with PowerPlant.


Dan,

You may want to try installing a "PrepareView" hook on your
WASTE instance. This is a callback that WASTE invokes whenever
it needs to draw anything to a view, either in response to
a direct API call (such as WEUpdate or WEScroll), or when
triggered indirectly by some event, like the firing of the
caret timer. The callback is invoked immediately prior to
drawing, and is an ideal place to perform any additional
setup of the QD port or CG context, like calling FocusDraw()
if your app is PowerPlant-based.

You install the "PrepareView" hook like this:

static WEPrepareViewUPP prepareViewUPP =
NewWEPrepareViewUPP(MyPrepareView);
OSStatus err;

err = WESetInfo(wePrepareViewHook, &prepareViewUPP, myWE);

where MyPrepareView is defined as follows:

static pascal void MyPrepareView(WEViewReference view)
{
}

The parameter to MyPrepareView() is a WASTE *view* reference,
not a controller reference (WEReference), as in WASTE 3.0
you can have multiple views associated with the same controller,
and your callback may need to distinguish between them.
You can retrieve the owning controller from the view reference
using WEGetViewOwner().

HTH,


-- 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