Re: Cocoa "canvas" view ?
Re: Cocoa "canvas" view ?
- Subject: Re: Cocoa "canvas" view ?
- From: Guillaume Laurent <email@hidden>
- Date: Sun, 23 Nov 2008 00:35:36 +0100
On Nov 21, 2008, at 17:20 , Kyle Sluder wrote:
On Fri, Nov 21, 2008 at 9:50 AM, Guillaume Laurent
<email@hidden> wrote:
Indeed I could :-). This is a very impressive work, thank you for
it. Can
you tell me more about its scalability ? What I'm planning to write
is a
music classical notation editor, so I'll typically need to handle a
number
of objects in the 10k order of magnitude, in a very large view.
In your position I would hesitate to actually model your graphical
elements as objects. Rather, I would just have my view figure out
what portion of the score needs to be drawn, and then just draw to the
view. Perhaps I would use a cell class like NoteCell to do the dirty
work. My view would know how to convert bounds-oriented coordinates
into sections of staffs, and then would draw the staves, followed by
iterating through each note in each staff, calling -setObjectValue: on
the view's cell and then drawing the cell at the appropriate place.
That's another option I'm also considering, but then you also need to
re-invent all the collision detection mechanism, so you can tell what
note the user has clicked on, or which ones he's selected. You also
have to re-invent a "tools" mechanism just like the one DrawKit has,
for the various editing operations.
This is conceptually similar to how NSTableView works. It doesn't
really care about objects; the OO illusion is not necessary at the
level it's dealing with, and the complexity of dealing with it will
probably make your head spin, your app slow, or both.
For the record we've already done this (a Linux sequencer called
Rosegarden), and there aren't really any performance nor complexity
problems. Quite the contrary, when at one point I rewrote one of the
editing view (not dealing with notation but with tracks, i.e. showing
rectangles on a grid - pretty simple) from a canvas-based view to a
custom view as you suggest, the end result was way more complicated
code-wise. The only gain we had was getting rid of the limitations of
the original canvas view we were based on.
--
Guillaume
http://telegraph-road.org
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden