[Openmcl-devel] CCL totally rocks!

Ron Garret ron at awun.net
Wed Jun 3 23:48:37 PDT 2009

I just had one of those hacking moments that made all the frustration  
worthwhile.  Rather than try to describe it, I'll just show you.  Load  
the scribble demo, then do this:

(objc:load-framework "Quartz" :quartz)

(defun pdf-from-url (url)
   (make-instance ns:pdf-document :init-with-url
     (make-instance ns:ns-url :init-with-string url)))

(setf pdf (pdf-from-url #@"http://www.flownet.com/ron/specials.pdf"))
(setf pv (#/init (#/alloc ns:pdf-view)))
(#/setDocument: pv pdf)
(setf pw (make-ns-window 640 800 "PDF"))
(#/setContentView: pw pv)

; This is the cool part:

(setf cv (#/objectAtIndex: (#/subviews (#/objectAtIndex: (#/subviews  
pv) 0)) 0))
(#/addSubview: cv (make-instance 'scribble-view
                     :init-with-frame (#/bounds (#/objectAtIndex: (#/ 
subviews cv) 0))))

Now scribble.  Then scroll.

(Note that you have to use 32-bit CCL to do this because there's a  
fatal bug in the 64-bit version of the Cocoa PDFView class.)


More information about the Openmcl-devel mailing list