Re: Basic: How to go about implementing such a view?
Re: Basic: How to go about implementing such a view?
- Subject: Re: Basic: How to go about implementing such a view?
- From: "Clark S. Cox III" <email@hidden>
- Date: Thu, 1 Jan 2009 11:53:16 -0500
On Dec 30, 2008, at 23:35, Matt Rajca <email@hidden> wrote:
Hi!
I am trying to figure out how to implement a 'Piano Roll' view in
Cocoa. Attached is a screenshot of what I'm trying to accomplish.
Disregard the keyboard on the left of the window and let's just
focus on the area with the colorful rectangles, symbolizing notes.
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?
Seems reasonable. The one thingbto be sure of is, for efficiency's
sake, only draw the rows that intersect the rect passed to drawRect:
2. When drawing the vertical lines, should I just use a loop with
Quartz 2D/Cocoa Drawing calls?
Same answer as #1 :)
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.
This is up to you. Using a view per note is probably the simplest from
an implementation standpoint, but it is likely to also be the least
efficient. Were I to do this, I would probably use A CA layer per note.
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?
Yes, this is exactly how scroll views work.
Thanks!
~Matt
<PianoRollWindow.jpg>
_______________________________________________
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
_______________________________________________
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