I may not be grasping the entire problem, but I'll take a stab at it.
When one of your views has an interesting, non-identity transform
applied, is this just a transform that your app is applying at draw
time? If so, can you keep track of that transformation matrix
somewhere besides a CGContext (such as a in a C++ object associated
with the view, or even attached to the view using SetControlProperty)?
Cheers,
--Dave
On Jun 8, 2006, at 5:40 PM, Rick Mann wrote:
I've brought this subject up before, and I usually get convinced of
the right way to do it. Then I get distracted from this project for
months, and forget it all. So, here it is again:
I am developing a non-trivial CAD application. It supports many
different tools, so I have a "mouse handler" architecture: an
instance of the current tool is set to be current, and mouse events
are sent to it for handling.
In some tools, keys can be pressed during button-down periods. For
this reason, I don't want to use TrackMouseLocation(); I'd rather
maintain state, and let key events be handled appropriately.
A great deal of drawing takes place in response to mouse events.
Just pointing at an object on the canvas can result in drawing as
it's highlighted, for example.
To complicate matters, there is an almost-always non-identity
transform applied; the user can zoom in and pan all over the
canvas, and clicking needs to be translated into canvas coordinates
(inverse of the CG context's transform).
My understanding from past experience is that I really can't get
the view's CGContext from within a mouse event (for the purposes of
doing an inverse transformation), and that I shouldn't do drawing,
either. I can probably live with the latter, but I really want to
build my model during the event.
The alternative is to store the last mouse position, set some
state, ask for the view to be redrawn, and do everything in the
redraw. I don't like this for any number of reasons.
So, I think I really need to get the view's CGContext during the
mouse event, use that to update the model, then ask for redraw, and
draw the current model in the draw event. My biggest concern is
that I've been told the context is unreliable during a mouse event.
All this is complicated by the fact that I think I'll be drawing
layers of the image to off-screen buffers, and then using those to
composite the final image together (for speed).
Comments? Suggestions?
TIA,
--
Rick
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden