discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: custom options during save in a document app


From: Wolfgang Lux
Subject: Re: custom options during save in a document app
Date: Mon, 8 Oct 2012 14:42:58 +0200

Riccardo Mottola wrote:

>>> On GNUstep I ca't get anything to work at the moment, I expect I need some 
>>> slight different reparent code, because the accessory view is not a Box, 
>>> however right now I get "null" for the original content view. Does it work 
>>> for  you?
>> Just checked and it indeed doesn't work on GNUstep. Turns out this is 
>> because GNUstep is still using a long deprecated API 
>> (-runModalSavePanel:withAccessoryView:) to present the save panel. However, 
>> this gives you a different option to modify the accessory: Override that 
>> NSDocument method and change the accessoryView passed to that method before 
>> calling the super class implementation.
> 
> Why does it matter? the calling sequence is different? I see my methods 
> called, but the values are still null. So th calls look compatible, but 
> something is perhaps not initialised?

Okay, looks like I have to explain myself once again.
When GNUstep presents a save panel (from the saveDocument, saveDocumentAs, and 
saveDocumentTo actions), it ultimately presents an application modal save panel 
going through the -runModalSavePanel:withAccessoryView: method. This gets the 
default accessory view of the AppKit passed in and allows subclasses to modify 
that accessory view or create a different view before calling the super class 
implementation in NSDocument, which actually displays the panel.
Apple has switched to using document modals panels (aka sheets) for NSDocument 
in MacOS X Public Beta and now calls 
-runModalSavePanelForSaveOperation:delegate:didSaveSelector:contextInfo: 
instead of -runModalSavePanel:withAccessoryView:. To allow customization of the 
save panel, the new method calls -prepareSavePanel:. You can find this 
information in Apple's older AppKit release notes.
Now GNUstep implements a strange mixture by calling the new method (and hence 
-prepareSavePanel:) when a document save panel is to be presented and then 
calling the old method from there.

So, my idea (not spelled out explicitly) is that you override 
-runModalSavePanel:withAccessoryView: to customize the accessory view under 
GNUstep and to use -prepareSavePanel: to customize it under Cocoa when 
-accessoryView returns a non-nil view.


> I tried overriding it in MyDocument.m and it never gets called :(

It is called for me, i.e. on GNUstep not on Cocoa.

Wolfgang




reply via email to

[Prev in Thread] Current Thread [Next in Thread]