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, 05 Oct 2012 12:02:16 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120825 Thunderbird/15.0

On 05.10.2012 11:06, Riccardo Mottola wrote:
Hi Fred & Nikolaus,

thank you for your suggestions, they were mostly overlapping, so I was
confident it was the best way!

Fred Kiefer wrote:
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.
by searching on the web I found another important method to override:
- (NSString *)fileTypeFromLastRunSavePanel

which is very important if the new accessory view changes the filetype.
I found no other way to "set it", since setFileType doesn't work.

I have one problem though: the file extension.

Previously, i was running this in saveDocumentAs (thus "before")
     filepath = [[filepath stringByDeletingPathExtension]
stringByAppendingString: @".tiff"];
     [self setFileName:filepath];
     [self setFileType: @"tiff"];

that's easy, since I only have one filetype, I could preset the
extension and normalize it before opening the panel. I may have many
extensions, because PRICE is "editor" of only TIFF files (or, in the
future JPEG and a few others) but "opens" all file types supported by GUI.

The best would be that on the change of the filetype popup (don't try
that on GNUstep yet or, if, substitute PRWindow.gorm file with
PRWindow.nib, there is a strange bug affecting only gorm).

How can I set the filename with the filepanel running? The filetype is
not a problem since it gets "set" later cleanly with the method
mentioned above.

I don't quite understand what you are asking here. Somewhere in your code you run the actual save panel, with what ever extensions you need. When this code returns you ask the save panel for the selected filename and file type. This surely isn't the problem. Do you want to change the filename that is displayed in the save panel itself? This should be automatically adjusted when ever you select a different file type. I just tested with Ink and there this mechanism seems to work.
Most likely you are talking about a different problem that I fail to see.

Fred




reply via email to

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