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: Riccardo Mottola
Subject: Re: custom options during save in a document app
Date: Fri, 05 Oct 2012 11:06:48 +0200
User-agent: Mozilla/5.0 (X11; FreeBSD i386; rv:15.0) Gecko/20120921 Firefox/15.0.1 SeaMonkey/2.12.1

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.

Riccardo



reply via email to

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