Putting this info in the document (whether or not it's in the actual document 
itself, or as an extended attribute) is not ideal, since it bakes in the 
display settings of the last person to view/edit that document. If I send you 
that document, you should either see it in its default state, or with your own 
settings, but not the way I left it (on page 42, at 200% zoom, etc). 

10.7's Resume infrastructure has a mechanism to do this, for documents and 
other windows that are open.   See <AppKit/NSWindowRestoration.h>.   The 
viewing state is stored in a central place in the user's home folder ; it 
includes some state such as window size and position by default but can be 
extended by individual apps to include any other UI state.  The state is 
persistent as long as the window is open, even if the app is quit in the 
meantime or the system is rebooted.  

This will not give you persistence of state once the document or window is 
explicitly closed by the user.

Ali








On Sep 21, 2011, at 13:34 , Nick wrote:

> Hello
> I am trying to implement some kind of "memory" for the documents in my
> application. For example, each  document window has a position on the
> screen. So I'd like to see this position next time the user opens this saved
> document.
> I can't save this info in the document file itself, as documents are plain
> text files.
> How it is usually done? Where it is best to store this 'meta' information
> that is attached to the document, provided that it can't be stored in the
> document itself? Does Mac OS provide some kind of tracking of saved earlier
> documents (i believe it does, since it keeps history of recently opened
> documents. i don't know where though...).
> 
> Should I store this information in some HFS's 'file fork'? Or is it better
> to create a "shadow file" for every document that keeps this metainformation
> (wouldn't like to do so, i keep that as the last resort).
> 
> Thank you for any advice!
> _______________________________________________
> 
> 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/aozer%40apple.com
> 
> This email sent to ao...@apple.com

_______________________________________________

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

Reply via email to