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: Sun, 07 Oct 2012 11:46:07 +0200
User-agent: GNUMail (Version 1.2.0)

Hi Wolfgang,

On 2012-10-07 09:33:33 +0200 Wolfgang Lux <wolfgang.lux@gmail.com> wrote:

I made a hack now to use pos.1 and pos2.. just to test (it is bad of course, since the order and generally the filetypes might change). It shows the concept can work, I will commit it so you can see it and i can test it on gnustep too.

No need to use hacks. The proper way to find out the selected file type is [[sender selectedItem] representedObject].

Perfect. The represented object is a NSString and contains directly the filetype. I cleaned up the code, it works fine and commited it.

Not sure what your problem is here. There is nothing you need to initialize. NSDocument automatically selects the current document type (as returned by the -fileType method) for you.
I need to initialize my option controls, specifically I send an action to the compression ration slider, so it reads its value and sends it to the text field. I do this if" "JPEG" is selected, but not if "TIFF" since it is not needed.

At startup, the document type gets selected automatically, but it does not "perform" the action. So if it selects TIFF it is fine, but if it is already JPEG, the fields are uninitialized. Perhaps I should check duing the file panel creation, but there I don't have the "sener", that is the popupbutton, to explicitely check for the type.


At least under GNUstep the pop up button is created just once and retained by the NSDocument class. The next time you use the save panel the pop up button will be reused and set as accessory view of the save panel before -prepareSavePanel is called. If that doesn't work for you, you seem to have a major bug in your code.
I don't doubt there are bugs lurking around.

On mac, if I do "save as" and "save as again" I get twice this log:

2012-10-07 11:13:37.651 PRICE[1316] prepareSavePanel, original accessory view class: NSBox 2012-10-07 11:13:37.666 PRICE[1316] original content view: <NSView: 0x4692f0>
2012-10-07 11:13:37.669 PRICE[1316] new options view: <NSBox: 0x4d6840>

<...>

2012-10-07 11:13:48.188 PRICE[1316] prepareSavePanel, original accessory view class: NSBox 2012-10-07 11:13:48.188 PRICE[1316] original content view: <NSView: 0x5828d70>
2012-10-07 11:13:48.188 PRICE[1316] new options view: <NSBox: 0x4d6840>

this means that the options view loaded from the nib is the same, but he view of the savepanel is different.

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?

Rccardo




reply via email to

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