[WASTE-list] Drawing issues with WASTE 3.1

Dan Korn dkorn at printable.com
Thu Mar 27 14:25:34 EDT 2008


Thanks Marco. As you allude to, the problem is indeed related to
WASTE's re-drawing on a timer to flash the caret. In WASTE 2.x, there
was a function WEIdle which the PowerPlant wrapper would call at its
own idle processing time to allow WASTE to flash the caret. In WASTE
3, this is done with a timer loop that WASTE runs on its own,
apparently asynchronously. The problem is that when PowerPlant calls
FocusDraw() to draw its own stuff on the dialog, the internal WASTE
timer executes, and does its own drawing, but it doesn't know that the
GrafPort has already been clipped by PowerPlant, and it ends up
drawing in the wrong place.

I followed your suggestion and added a wePrepareViewHook function,
which calls FocusDraw() for the PowerPlant LPane which wraps the
control. This prevents WASTE from drawing in the wrong place on the
dialog, but now I have the reverse problem: The PowerPlant controls
are drawn on top of the WASTE control! I'm on the horns of a dilemma.

I'm still not really sure how to solve this. Is there a way to tell
WASTE to temporarily stop flashing the caret? If I can do that, then
I could try to figure out when PowerPlant is doing its drawing and
suspend WASTE during that time.

I realize that the underlying technologies have been changed by Apple,
but this is a lot more work than I bargained for with the WASTE 3.x
upgrade.

Dan

-----Original Message-----
From: Marco Piovanelli [mailto:marco.piovanelli at pobox.com]
Sent: Thursday, March 27, 2008 6:13 AM
To: Dan Korn
Cc: WASTE 3.0 List
Subject: Re: [WASTE-list] Drawing issues with WASTE 3.1

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