[Openmcl-devel] The File Menu

Ron Garret ron at flownet.com
Sun Jan 24 10:41:39 PST 2010


I'm pretty familiar with the standard Cocoa stuff.  What I didn't know was #_sel_getName (thanks Gary!), and what I still don't know is how much of what goes on in CCL is the standard Cocoa stuff and how much has already been intercepted and modified by Lisp and how.  I figure there must already be a subclass of NSDocument in the sources somewhere because the windows being created are Hemlock windows.

Hm, digging through the sources, it looks like there might be a really simple way to do what I want: Hemlock already has a subclass of NSDocument that it uses called hemlock-editor-document (imagine that!) and a method on writeSafelyToURL:ofType:forSaveOperation:error: that invokes write-hemlock-backup-file.  It seems that I can just intercept that to do what I want to do (though I'd feel warmer and fuzzier about it if I understood what the documentation for writeSafelyToURL:ofType:forSaveOperation:error: actually meant).

In any case, thanks to you, Mikel and Gary for your responses!  And Paul, your interfaceBuilder tutorial is awesome!

rg


On Jan 24, 2010, at 7:11 AM, Paul Krueger wrote:

> Gary talked about selectors and some of the specific calls for manipulating menus and menuitems. I have some additional discussion and code examples for manipulating menus in the interface tutorial that is in .../ccl/contrib/krueger/InterfaceProjects/Documentation/InterfaceBuilderWithCCLTutorial. If you're not already familiar with it, one of the things you'll need to understand to make your changes work is the First Responder chain which defines where selectors without a specific target are sent. That is discussed in the tutorial. If you prefer, it is relatively straightforward to alter the menu items so that they send a selector of your choice to a specific object of your choice, but then it would be up to you to figure out what window was on top (if any) and what document it was associated with so that you know what to act on.
> 
> Paul
> 
> On Jan 24, 2010, at 1:29 AM, Ron Garret wrote:
> 
>> Is it possible to change the behavior of items in the File menu?  Is it straightforward?  I want to intercept the SAVE and REVERT items and hook them up to a revision control system.  I tried to reverse engineer the menu but ran into a roadblock when the action selector was just a foreign pointer with no hint as to what it was pointing at.  Is the File menu managed by Lisp at all, or is all of its functionality provided by Cocoa?
>> 
>> Thanks,
>> rg
>> 
>> _______________________________________________
>> Openmcl-devel mailing list
>> Openmcl-devel at clozure.com
>> http://clozure.com/mailman/listinfo/openmcl-devel
> 




More information about the Openmcl-devel mailing list