On 31 Dec 2008, at 3:35 pm, Matt Rajca wrote:
1. When drawing the light and dark grey rows which make up a background, should I just use a loop with Quartz 2D/Cocoa Drawing calls? 2. When drawing the vertical lines, should I just use a loop with Quartz 2D/Cocoa Drawing calls?
I'd say yes, this is probably the most straightforward. There's nothing built-in that will do it for you, but this kind of drawing is easy enough. For the lines, you might consider caching them into an NSBezierPath and drawing it all in one go rather than drawing each line separately, but that's a minor detail.
3. Should I put the notes (colorful rectangles) each in a separate view (or Core Animation layer), or is it effective to just draw them directly in the main view (same view in which the rows are drawn)? I am eventually going to want to resize them and change their position by dragging them around.
Draw them directly in the main view. Each as a subview would be a huge overkill that would be more complicated than necessary and probably suffer from performance problems. Each rectangle would probably be most usefully represented by a custom class but it wouldn't need to be a view.
Dragging is not too hard if you design your code appropriately. At some point you'll want to translate bidirectionally from your data model (note frequency + duration) to the view (rectangles). Hit- detecting which rectangle the mouse went down in will depend on you being able to find the right rectangle and relate that to the note you are affecting.
4. How would I go about changing the view's width as more notes (rectangles) are added to the view? When enclosed in a NSScrollView, would manipulating the width of the view also hide/show the horizontal scrollbar appropriately?
Just set the view's bounds to whatever you need. If in a scroller, it will work automatically with respect to the scrollbars, both for the scroll values and automatic hiding.
hth, Graham _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com