Changeset 630
- Timestamp:
- Mar 6, 2004, 11:53:57 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/ccl/examples/cocoa.lisp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ccl/examples/cocoa.lisp
r597 r630 37 37 38 38 39 ;;; The application's been initialized and is about to enter its40 ;;; run loop. Try to load some application-specific key bindings41 ;;; from the application's bundle and from the user's Library42 ;;; directory.43 ;;; This basically works by repeatedly merging a new dictionary44 ;;; into an old one (where the new dictionary's bindings replace45 ;;; any conflicting bindings in the old dictionary.) The order46 ;;; in which this happens is:47 ;;; 1) Standard global bindings:48 ;;; /System/Library/Frameworks/AppKit.framework/Resources/StandardKeyBindings.dict49 ;;; 2) User global bindings:50 ;;; ~/Library/KeyBindings/DefaultKeyBinding.dict51 ;;; 3) Standard application bindings:52 ;;; $OpenMCL.app/Contents/Resources/OpenMCLKeyBindings.dict53 ;;; 4) User application bindings:54 ;;; ~/Library/KeyBindings/OpenMCLKeyBindings.dict55 ;;;56 ;;; This means that OpenMCL's "standard" bindings may override the user's57 ;;; global bindings. The user does get the last laugh, but it may be58 ;;; worth inverting steps 2 and 3.59 ;;;60 ;;; The NSKeyBindingManager class doesn't seem to be documented, so I61 ;;; suppose that this could all break at some point. Project Builder62 ;;; seems to use a similar mechanism to establish its application-specific63 ;;; key bindings, so I don't think that this is likely to break soon.64 39 (define-objc-method ((:void :application-will-finish-launching (:id notification)) 65 40 lisp-application-delegate) 66 41 (declare (ignore notification)) 67 (let* ((standard-dict-path (send (send (@class ns-bundle) 'main-bundle) 68 :path-for-resource #@"OpenMCLKeyBindings" 69 :of-type #@"dict")) 70 (standard-dict (send (@class ns-dictionary) 71 :dictionary-with-contents-of-file 72 standard-dict-path)) 73 (user-dict-path (send 74 #@"~/Library/KeyBindings/OpenMCLKeyBindings.dict" 75 'string-by-expanding-tilde-in-path)) 76 (user-dict (send (@class ns-dictionary) 77 :dictionary-with-contents-of-file user-dict-path)) 78 (manager (send (@class ns-key-binding-manager) 'shared-key-binding-manager)) 79 (installed-dict (send manager 'dictionary))) 80 (unless (%null-ptr-p standard-dict) 81 (send installed-dict :add-entries-from-dictionary standard-dict)) 82 (unless (%null-ptr-p user-dict) 83 (send installed-dict :add-entries-from-dictionary user-dict)) 84 ;; Not sure if this step is necessary (installed-dict is already 85 ;; the shared manager's dictionary), but setDictionary: might 86 ;; have some additional side-effects. 87 (send manager :set-Dictionary installed-dict))) 42 (initialize-user-interface)) 88 43 89 44 (define-objc-method ((:void :new-listener sender) lisp-application-delegate)
Note:
See TracChangeset
for help on using the changeset viewer.
