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: Fred Kiefer
Subject: Re: custom options during save in a document app
Date: Fri, 28 Sep 2012 11:11:53 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120825 Thunderbird/15.0

On 28.09.2012 10:28, Riccardo Mottola wrote:
Hi,

I want to handle two different filetypes during save in a document based
application. For one of the type I need an option view in the panel to
set some parameters.

I did that in a "standard" application. There it is easy: I have a save
method which has the task to create and display the save panel, so it
can instantiate it, add the view, read the parameters and perform the
save by directly writing the file.

In my doc-based app however, I have a document and a window controller.
To save I have overidden "dataRepresentationOfType" (actual work) and
"saveDocumentAs" (to add the file extension, nothing more).

dataRepresentationOfType is fine for now: currently type is "TIFF".
Adding "JPEG" is trivial. I need however the compression rate, somehow
an additional parameter.

But where/how can I add my view to the panel and handle its parameter?
Can I override a method I do not see or do i need to throw-away part of
what document-based apps offer me?

You best options here is to override the method -prepareSavePanel in our NSDocument subclass, which is the Apple recommended way of doing this. You will also have to override shouldRunSavePanelWithAccessoryView to return NO, otherwise the standard accessory view will still be displayed.

From there on down you will have to replace all the standard NSDocument methods to handle your additional parameters. There is no way around that.






reply via email to

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