> On 2014 Nov 19, at 20:36, Graham Cox <graham....@bigpond.com> wrote:
> 
> Is there a sound way to determine at document creation time whether the VB is 
> active or not?

Try the term “viewing mode”, as in-[NSDocument inViewingMode].  The 
documentation leaves me unsure as to whether or not “viewing mode” == “versions 
browser”.  I think someone at DTS that told me back in 2011 that this is true.  
But I consider that to be no more than a data point :(

> Ideally this would be for the actual document in question rather than 
> globally, because while it doesn't seem to be possible in the current 
> implementation, the architecture appears to permit documents to be opened 
> "normally" even while the VB is active for a different document.

I think what you’re saying is that you want this answer per NSDocument instance.

> How do others hande this?

Unfortunately, I found that -inViewingMode did not always give me the correct 
answer; in other words “viewing mode” ~= “versions browser”.  So I wrapped it 
with some hacks to also check if the document’s path places it in the 
DocumentRevisions-V100 or Backups.backupdb folder.  Code is here:

https://github.com/jerrykrinock/CategoriesObjC/blob/master/NSDocument%2BSSYAutosaveBetter.h
https://github.com/jerrykrinock/CategoriesObjC/blob/master/NSDocument%2BSSYAutosaveBetter.m

I realize this is a disgusting, evil and fragile hack.  Indeed, they might bump 
DocumentRevisions to V110 or V200 someday.  I was hoping for this to be 
temporary, and think I filed a bug on the lack of a good method to determine if 
you’re in Versions Browser, back in 2011.  I can’t find my bug report now, but 
discount that because I have little confidence in the search function in 
bugreport.apple.com.

> Do you just accept that the VB is a total dog unless your files are trivial, 
> or are there good workarounds to get acceptable performance?

My apps don’t have the performance issue, but they do have the issue that some 
controls need to be disabled.  Also, I've needed to know whether or not an 
NSDocument instance in viewing mode in order to work around other NSDocument 
bugs.


_______________________________________________

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to