On Sunday, February 23, 2003, at 10:06 PM, Sherm Pendley wrote:
On Sunday, February 23, 2003, at 05:45 PM, Dan Mills wrote:
Would it be easy to subclass it in objc and just add a stub that calls a perl function? (or am I better off just waiting for the next CB? I'm not in a crazy hurry to get DND).
It depends on your requirements, and your willingness to delve into Objective-C.
*nod* - your example makes some sense, even though I don't really get half of the syntax :-P I'll see if I can hack something together, just for the hell of it--DND to the dock was what I really cared about.
On the other paw, if you don't know ObjC, and you're in no hurry to learn it, you may be better off waiting for CB 0.3 - it won't be very much longer.
Excellent.
but I looked around on google and found that I needed to add the accepted type(s) to the CFBundleDocumentTypes info.plist entry.
That's good advice, and accurate as far as it goes, but it's out of date. You no longer need to edit a .plist file by hand - just set up the relevant document type info in Project Builder's "Application Settings" pane. (It's safe to ignore the "Document Class" item for now; it's used by the NSDocumentManager class in document-based applications.)
Indeed. That "Application Settings" pane is really sweet!
I also read that the function called is application:openFile. I had openDocument () defined in MyApp.pm, which File->Open calls w/o problems. I added openFile () in MyApp.pm as well, but still nothing happens.
Nothing happens because - as you pointed out - the method you need to add to the application delegate (i.e. MyApp.pm) is "application:openFile", not just "openFile". The full Perl declaration for it would look something like this:
Ah! How dumb of me. Of course.
$OBJC_EXPORT{'application:openFile:'} = { 'args'=>'@@', 'return'=>'c' };
What do '@@' and 'c' mean? And why is this needed (but not needed for things like 'myApp::openDocument' which is called magically when I press M-o or click on File->Open)?
Works like a charm, though. Thanks!
-Dan
