Re: Loading PersistentDocuments into the same window
Re: Loading PersistentDocuments into the same window
- Subject: Re: Loading PersistentDocuments into the same window
- From: Quincey Morris <email@hidden>
- Date: Fri, 30 Apr 2010 12:36:06 -0700
On Apr 30, 2010, at 10:55, Brad Stone wrote:
> Think about the Finder. You click on a file, get a preview. If you like it you can open it. That's what I'm driving at. You click on a row in a tableView, you get a preview (the opening is in code, I'm storing an index of file references in a different NSDocument) and if you like it you open up in a new window. The difference here is you can edit the file in preview.
After letting this percolate for a while ...
It's a bit more involved than I thought, because it looks like you actually need 2 window controller classes -- one for the preview, and another for the independently opened documents (assuming those windows don't themselves function as preview windows).
In any case, I think I'd keep the initial preview window as a singleton, and always let the document create its own window controller (of a different class, I'd assume), when a file is chosen for preview, but just not show the document's own window yet.
Then, I'd attach the singleton controller to the document with addWindowController: (after removing it from another document, if it was previously attached elsewhere). It could could then configure itself to display the document contents. (That would eliminate the global variable and the makeWindowControllers override that I suggested earlier.)
That would make it easy to "open" an independent document window from the preview -- just show its already existing window.
_______________________________________________
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