Changeset 630


Ignore:
Timestamp:
Mar 6, 2004, 11:53:57 PM (21 years ago)
Author:
Gary Byers
Message:

APPLICATION-WILL-FINISH-LAUNCHING: start the UI.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/examples/cocoa.lisp

    r597 r630  
    3737
    3838
    39 ;;; The application's been initialized and is about to enter its
    40 ;;; run loop.  Try to load some application-specific key bindings
    41 ;;; from the application's bundle and from the user's Library
    42 ;;; directory.
    43 ;;; This basically works by repeatedly merging a new dictionary
    44 ;;; into an old one (where the new dictionary's bindings replace
    45 ;;; any conflicting bindings in the old dictionary.)  The order
    46 ;;; in which this happens is:
    47 ;;; 1) Standard global bindings:
    48 ;;;   /System/Library/Frameworks/AppKit.framework/Resources/StandardKeyBindings.dict
    49 ;;; 2) User global bindings:
    50 ;;;   ~/Library/KeyBindings/DefaultKeyBinding.dict
    51 ;;; 3) Standard application bindings:
    52 ;;;   $OpenMCL.app/Contents/Resources/OpenMCLKeyBindings.dict
    53 ;;; 4) User application bindings:
    54 ;;;   ~/Library/KeyBindings/OpenMCLKeyBindings.dict
    55 ;;;
    56 ;;; This means that OpenMCL's "standard" bindings may override the user's
    57 ;;; global bindings.  The user does get the last laugh, but it may be
    58 ;;; worth inverting steps 2 and 3.
    59 ;;;
    60 ;;; The NSKeyBindingManager class doesn't seem to be documented, so I
    61 ;;; suppose that this could all break at some point.  Project Builder
    62 ;;; seems to use a similar mechanism to establish its application-specific
    63 ;;; key bindings, so I don't think that this is likely to break soon.
    6439(define-objc-method ((:void :application-will-finish-launching (:id notification))
    6540                     lisp-application-delegate)
    6641  (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))
    8843
    8944(define-objc-method ((:void :new-listener sender) lisp-application-delegate)
Note: See TracChangeset for help on using the changeset viewer.