Yes, I haven't gotten to the second part yet.

So, let me see if I understand what you're doing in your first example.

You're putting the initial window controller in a global that both the doc and 
the windowController can get to.  When it's time to open a new doc you're 
saving the current windowController to the global variable, removing it from 
the dc list and calling [dc openDocument...].  This will reuse the saved global 
windowController (the code in the document subclass).

 [dc openDocumentWith...] is opening the new doc and it'll be associated with 
the same windowController in the makeWindowControllers method. I see how you're 
doing that.  What I don't understand is the documentation for 
openDocumentWIthCOntentsOfURL doesn't mention anything about setting up the 
managedObjectContext or creating an undoManager and liking the MOC to a 
persistentStore.  This could just be me because I've been doing cocoa for 6 
months (programming in other languages for many years) but are you assuming all 
the stuff happens because openDocument... is called?

Regarding the second part, yes I'm planning on setting up another 
windowController and when I show the second window moving the 
managedObjectContext over to it.  Both windows will have the same moc.  I had a 
similar problem with that: no undo and the saving didn't work but I put that on 
hold until I got the first part done.  I figure if it works in the preview 
window making it work in it's own window should be straightforward.



On Apr 30, 2010, at 3:36 PM, Quincey Morris wrote:

> 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 protected])
> 
> 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/cocoa-dev%40softraph.com
> 
> This email sent to [email protected]

_______________________________________________

Cocoa-dev mailing list ([email protected])

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 [email protected]

Reply via email to