Re: Upgrading NSDocument format, best practice
Re: Upgrading NSDocument format, best practice
- Subject: Re: Upgrading NSDocument format, best practice
- From: Graham Cox <email@hidden>
- Date: Thu, 17 Sep 2009 01:10:31 +1000
On 17/09/2009, at 12:52 AM, I. Savant wrote:
On Sep 16, 2009, at 10:48 AM, Graham Cox wrote:
So far I haven't experienced any problems and it prompts for save
just like any untitled document would.
Hmmm ... it just seems wrong to me, though. :-) Perhaps it's not a
"short-circuiting" in the sense I so dramatically described, but a
well-defined mechanism already exists in Cocoa. In your case, I
would imagine a ".mydoctemplate" as a non-editing-role type for
".mydoc" would be "more Cocoa-like". That's my opinion, though, not
gospel.
For that matter, isn't this a job for "stationary"? Does Cocoa
respect it and "do the right thing"? I see you yourself had asked
this very question:
http://lists.apple.com/archives/Cocoa-dev/2008/Oct/msg00804.html
Indeed, that's when I was casting around for an implementation. I do
go on to follow that advice about makeControllers and don't get the
title flash.
You're probably right that a different file extension/UTI/role type
might be cleaner, but there's a logistical side to it also. It means
we can turn any file into a template just by putting it into a known
folder. No changes to anything. It also means the user can do the
same, and the files show up in the template browser, but open as
untitled (because they are opened via the browser, which does the
setFileURL:nil thing). Also the inverse - if I need to edit a template
I just open it via the normal Open command instead, and voila! This is
a good fit for this requirement, but maybe not exactly for the OP.
I never found out if the classical stationery flag is honoured.
--Graham
_______________________________________________
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