On 5 Oct 2011, at 12:39 PM, Nick wrote: > I have a task to write a simple vector graphics editor, which has a window, a > sheet (which can be bigger than the window), and some objects [...] I need an > advice how would experienced developers implement this basic functionality. > [....] > What I mean is to what extent can I use Cocoa primitives for these objects > and the sheet itself? And what I will have to implement "by hand"? > > Could you please give me a basic idea of how such kind of editors are > usually implemented? If there are some simple opensource programs, I'd be > thankful for their names.
The "Sketch" example that comes with Xcode should be a decent example of this, I think. Using views for canvas objects is a little too "heavyweight" for a normal drawing program. Instead, I would make the canvas be a single view, containing an NSArray of (non-NSView) objects; the canvas's drawRect calls a method like -drawInView:self on each of the objects; any time an object is changed, there needs to be some way for the canvas to -setNeedsDisplay: on both the old and new bounds. Scrolling can be done simply by placing the canvas view into an NSScollView though. _______________________________________________ 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