Hi Laurent:

Thanks for your reply. I'll try to reproduce the problem with a stripped down 
version of my app - It could be useful as a sample script if it doesn't 
reproduce the problem.

Far as I can tell I'm building for 10.5.

I get the warnings by running the PrintOperation modally as follows:

class SimpleX_ViewController < NSViewController
        def init
                if super
                        puts "SimpleX_ViewController"
                        initWithNibName( 'SimpleX', bundle:nil )
                        loadView()
                end
                
                self
        end

        # selector for printOperationDidRun is not recognized
        def printOperationDidRun( printOperation, success:success, 
contextInfo:info )
                puts "printOperationDidRun #{ success }"
        end

        def print
                puts "#{ self.class }.print"
                printInfo = NSPrintInfo.sharedPrintInfo
                puts "printInfo #{ printInfo.dictionary.inspect }"
                
                printOperation = NSPrintOperation.printOperationWithView( 
@printableView )
                printOperation.runOperationModalForWindow( view().window, 
delegate:self, didRunSelector:"printOperationDidRun:", contextInfo:nil )
        end
end

class SimpleX_View < NSView
        include DrawUtilities
        def drawRect( rect )
                @context = NSGraphicsContext.currentContext.graphicsPort # 
returns invalid context
                puts "SimpleX_View #{ @context.class }"
                DrawX( bounds )
        end

        def beginDocument
                puts "Got beginDocument"
                super # Should create the graphics context but operations 
returns nil for context
        end
        
        def knowsPageRange( rangePtr ) # Override pagination. Image may clip on 
some printers
                rangePtr[ 0 ] = NSMakeRange( 1, 1 )
                
                true
        end
        
        def rectForPage( page ); bounds; end # Use IB layout size. page should 
be 1
        
        def locationOfPrintRect( rect ) # Called only once for printing
                puts "locationOfPrintRect"
                
                currentOperation = NSPrintOperation.currentOperation
                puts "currentOperation #{ currentOperation.class }"
                context = currentOperation.context
                puts "context #{ currentOperation.context.class }"
                if context.nil?
                        puts "Invalid NSPrintOperation contect"
                end
                puts "view #{ currentOperation.view.class }" # OK
                
                super # super returns NSMakePoint( 0, 0 )
        end
end

Thanks,
Bob Rice


Begin forwarded message:

> From: Laurent Sansonetti <[email protected]>
> Date: August 16, 2010 12:18:21 AM EDT
> To: Robert Rice <[email protected]>
> Cc: "MacRuby development discussions." <[email protected]>
> Subject: Re: [MacRuby-devel] Warnings from print operation
> 
> Hi Robert,
> 
> (Please mail the list, not me directly.)
> 
> On Aug 15, 2010, at 8:20 PM, Robert Rice wrote:
> 
>> Hi Laurent:
>> 
>> My application has grown to over 200 files, but I could probably create a 
>> small project to create these errors, however, if the problem has to do with 
>> my MacRuby or framework installation, as I suspect, then the errors might 
>> not be reproducible on your system.
> 
> Maybe. Did you see if you call these deprecated APIs by yourself in your 
> project? Could you show the printing code at least?
> 
> Also, I would check the Xcode project settings to see if you're not building 
> for 10.5.
> 
> Did these warnings just appear now?
> 
> Larent
> 
>> On Aug 15, 2010, at 10:51 PM, Laurent Sansonetti wrote:
>> 
>>> Could you show your source code? Just from what you pasted I would assume 
>>> you're using deprecated APIs.
>>> 
>>> Laurent
>>> 
>>> On Aug 15, 2010, at 3:19 PM, Robert Rice wrote:
>>> 
>>>> Hi Thibault Martin-Lagardette:
>>>> 
>>>> Yes, but the deprecated calls are originating from NSView. Printing had 
>>>> stopped working for the views in my application so I tried creating my own 
>>>> PrintOperation and ran it modally for my window instead of routing the 
>>>> print command directly to the view. Then the warnings appeared. Could my 
>>>> project be linked to an old framework or Ruby library?
>>>> 
>>>> Thanks,
>>>> Bob Rice
>>>> 
>>>> 
>>>> On Aug 15, 2010, at 5:24 PM, Thibault Martin-Lagardette wrote:
>>>> 
>>>>> It looks like you are using deprecated APIs from the printing Framework. 
>>>>> These are clearly not ruby errors, but deprecated objective-c calls :-)
>>>>> 
>>>>> -- 
>>>>> Thibault Martin-Lagardette
>>>>> 
>>>>> 
>>>>> 
>>>>> On Aug 15, 2010, at 09:44, Robert Rice wrote:
>>>>> 
>>>>>> Hi Developers:
>>>>>> 
>>>>>> I get the followings warning from my PrintOperation:
>>>>>> 
>>>>>> SimpleX_ViewController.print
>>>>>> 2010-08-15 12:25:12.609 MacDriverLog-0.7[243:a0f] -[NSView(NSPrinting) 
>>>>>> beginPrologueBBox:creationDate:createdBy:fonts:forWhom:pages:title:] was 
>>>>>> deprecated before Mac OS 10.0 and overrides of it are not being invoked 
>>>>>> anymore, starting in Mac OS 10.5.
>>>>>> 2010-08-15 12:25:12.610 MacDriverLog-0.7[243:a0f] -[NSView(NSPrinting) 
>>>>>> endHeaderComments] was deprecated before Mac OS 10.0 and overrides of it 
>>>>>> are not being invoked anymore, starting in Mac OS 10.5.
>>>>>> 2010-08-15 12:25:12.612 MacDriverLog-0.7[243:a0f] -[NSView(NSPrinting) 
>>>>>> endPrologue] was deprecated before Mac OS 10.0 and overrides of it are 
>>>>>> not being invoked anymore, starting in Mac OS 10.5.
>>>>>> 2010-08-15 12:25:12.613 MacDriverLog-0.7[243:a0f] -[NSView(NSPrinting) 
>>>>>> beginSetup] was deprecated before Mac OS 10.0 and overrides of it are 
>>>>>> not being invoked anymore, starting in Mac OS 10.5.
>>>>>> 2010-08-15 12:25:12.614 MacDriverLog-0.7[243:a0f] -[NSView(NSPrinting) 
>>>>>> endSetup] was deprecated before Mac OS 10.0 and overrides of it are not 
>>>>>> being invoked anymore, starting in Mac OS 10.5.
>>>>>> 2010-08-15 12:25:12.615 MacDriverLog-0.7[243:a0f] -[NSView(NSPrinting) 
>>>>>> beginPage:label:bBox:fonts:] was deprecated before Mac OS 10.0 and 
>>>>>> overrides of it are not being invoked anymore, starting in Mac OS 10.5.
>>>>>> 2010-08-15 12:25:12.615 MacDriverLog-0.7[243:a0f] -[NSView(NSPrinting) 
>>>>>> beginPageSetupRect:placement:] was deprecated before Mac OS 10.0 and 
>>>>>> overrides of it are not being invoked anymore, starting in Mac OS 10.5.
>>>>>> 2010-08-15 12:25:12.616 MacDriverLog-0.7[243:a0f] -[NSView(NSPrinting) 
>>>>>> addToPageSetup] was deprecated before Mac OS 10.0 and overrides of it 
>>>>>> are not being invoked anymore, starting in Mac OS 10.5.
>>>>>> 2010-08-15 12:25:12.617 MacDriverLog-0.7[243:a0f] -[NSView(NSPrinting) 
>>>>>> endPageSetup] was deprecated before Mac OS 10.0 and overrides of it are 
>>>>>> not being invoked anymore, starting in Mac OS 10.5.
>>>>>> 2010-08-15 12:25:12.617 MacDriverLog-0.7[243:a0f] -[NSView(NSPrinting) 
>>>>>> beginTrailer] was deprecated before Mac OS 10.0 and overrides of it are 
>>>>>> not being invoked anymore, starting in Mac OS 10.5.
>>>>>> 2010-08-15 12:25:12.618 MacDriverLog-0.7[243:a0f] -[NSView(NSPrinting) 
>>>>>> endTrailer] was deprecated before Mac OS 10.0 and overrides of it are 
>>>>>> not being invoked anymore, starting in Mac OS 10.5.
>>>>>> 
>>>>>> Looks like I may need to update something. Would this be a framework or 
>>>>>> a Ruby library? How would I update my system?
>>>>>> 
>>>>>> Thanks,
>>>>>> Bob Rice
>>>>>> 
>>>>>> _______________________________________________
>>>>>> MacRuby-devel mailing list
>>>>>> [email protected]
>>>>>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>>>> 
>>>>> _______________________________________________
>>>>> MacRuby-devel mailing list
>>>>> [email protected]
>>>>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>>> 
>>>> _______________________________________________
>>>> MacRuby-devel mailing list
>>>> [email protected]
>>>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>> 
>>> _______________________________________________
>>> MacRuby-devel mailing list
>>> [email protected]
>>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>> 
> 

_______________________________________________
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

Reply via email to