|
From: | Riccardo Mottola |
Subject: | Re: custom options during save in a document app |
Date: | Fri, 05 Oct 2012 14:37:33 +0200 |
User-agent: | Mozilla/5.0 (X11; FreeBSD i386; rv:15.0) Gecko/20120921 Firefox/15.0.1 SeaMonkey/2.12.1 |
Hi Wolfgang, Wolfgang Lux wrote:
Exactly, I added an accessory view, however as far as I understand, the document types are now my burden. I do not want to override saveDocumentAs anymore, at least not for this need. I can read back what was selected with fileTypeFromLastRunSavePanel, however in the "standard" view which these the type selection generated by the NSDocumentClass are handled automatically. In the standard panel, selection them does change the extension of the file directly (and perhaps does other things too and I want to emulate this).Hi Riccardo, I think you are on a completely wrong track here. If you want to add a JPEG file type to PRICE, you should declare that in the NSTypes (or CFBundleDocumentTypes) section of the Info.plist file as a separate type, but using the same NSDocumentClass as for TIFF files. Then, the NSDocument framework will automatically handle the file type and file extension for you and you shouldn't override saveDocumentAs: (it will not work in the way you'd expect on OS X anyway thanks to document modal sheets anyway). To add options for the JPEG type you must add an accessory view to the save panel in -prepareSavePanel:, as Fred and Nikolaus suggested. Make sure you save the values selected by the user in attributes of your document class, so you have them available in -dataRepresentationOfType:
Your suggestion would be then to populate the popup dynamically by the supported NSDocumentClass types? That would be a further plus that adds some burden, since some have certain options other others, but could be cool.
Riccardo
[Prev in Thread] | Current Thread | [Next in Thread] |