discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Another NSDocument patch


From: Fred Kiefer
Subject: Re: Another NSDocument patch
Date: Tue, 06 Mar 2007 02:30:51 +0100
User-agent: Thunderbird 1.5.0.9 (X11/20060911)

Wolfgang Lux wrote:
> Hello!
> 
> The following patch brings NSDocument's modal print dialog interface
> into operation. Here's a short summary of the changes:
> 
> - NSPrintPanel:
>   The modal loop which displays the print panel is now left with either
>   NSOKButton or NSCancelButton (cf. the documentation of NSPrintPanel's
>   -runModal: and
>  
> -beginSheetWithPrintInfo:modalForWindow:delegate:didEndSelector:contextInfo:
> 
>   methods).
> 
> - NSPrintOperation:
>   The callback passed to the print panel's beginSheet... method had a
>   wrong signature (and also was misspelled). In addition, the code of
>   the callback did retrieve its own callback from the print dictionary
>   in a wrong way (was asking for a pointer to a selector while a
>   selector was saved).
> 
> - NSDocument:
>   The callback of
> -runModalPrintOperation:delegate:didRunSelector:contextInfo:
>   method has a different signature than the one passed to the print
> operation's
>   -runOperationModalForWindow:delegate:didRunSelector:contextInfo:
> method. This
>   means NSDocument needs some adapter code and also has to save the
> delegate
>   and selector passed to runModalPrintOperation... in some place. Since
> there
>   can be at most one print dialog for a document, I've chosen to add two
> private
>   instance variables to NSDocument for that purpose.
> 


Looks fine to me (with one exception*). I am just waiting for Greg to
reply on this. He committed your previous change while this new one was
out already and I am not sure, if there was a reason he didn't touch
this one.

Fred

* The one problem I see is with the use of inline declaration of
variables. The following will work with your compiler (and with mine as
well), but wont with old versions of gcc, so please avoid it:

{
   _picked = NSOKButton;
-  [NSApp runModalForWindow: self];
+  int ret = [NSApp runModalForWindow: self];
   [_optionPanel orderOut: self];
   /* Don't order ourselves out, let the NSPrintOperation do that */
-  return (_picked == NSCancelButton) ? NSCancelButton :  NSOKButton;
+  return ret;
 }




reply via email to

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