[Drawkit] two views, different layers?
James Maxwell
jbmaxwell at rubato-music.com
Tue Jul 29 19:00:37 PDT 2008
oh, I actually wound up doing it in my DKToolController subclass'
mouseDown, as I haven't subclassed DKDrawingView, at this point. (And
I'm kind of trying not to!)
Does it make much difference to do it in the tool controller, rather
than the view? What I've done seems okay, from the little bit of
testing I've done, so far. I had to fudge around a bit to get changes
across the layers to undo properly... or rather, to redraw the display
properly after undoing. This seemed to be because objects on an
inactive layer were getting undone, and weren't being told to redraw
immediately after the undo... Anyway, I worked around it by enabling
undo for selections, then receiving the selection change notification.
From the notification I just switch to the layer that registered the
selection change. Seems to work, though maybe it's a bit brittle.
J.
On 29-Jul-08, at 6:05 PM, Graham Cox wrote:
> In your view's mouseDown: method, you can set the active layer "just
> in time" then continue with normal processing. Switching the active
> layer is usually a cheap process (as it's only changing a pointer
> and sending a couple of notifications) so you're unlikely to run
> into performance issues. And if the layer you want is already
> active, DK does nothing, so you don't even need to test for it -
> just set it and go.
>
> cheers, Graham
>
>
> On 30 Jul 2008, at 3:42 am, James Maxwell wrote:
>
>> Does anyone know if there's a built-in mechanism to set the active
>> layer using the view? Since I have two object drawing layers which
>> are intended to be exclusive to their own views, I'd like to be
>> able to automatically set a given layer to "active" when mouse
>> events are sent by a given view.
>> So, click view A --> activate layer A, click view B --> activate
>> layer B.
>
> _______________________________________________
> Drawkit mailing list
> Drawkit at lists.apptree.net
> http://lists.apptree.net/listinfo.cgi/drawkit-apptree.net
More information about the Drawkit
mailing list