Changeset 678


Ignore:
Timestamp:
Mar 19, 2004, 11:38:17 PM (21 years ago)
Author:
Gary Byers
Message:

Handle key events in echo area.

File:
1 edited

Legend:

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

    r666 r678  
    413413        (hemlock-ext::make-key-event c bits)))))
    414414
    415 ;;; Process a key-down NSEvent in a lisp text view by translating it
    416 ;;; into a Hemlock key event and passing it into the Hemlock command
    417 ;;; interpreter.  The underlying buffer becomes Hemlock's current buffer
    418 ;;; and the containing pane becomes Hemlock's current window when the
    419 ;;; command is processed.  Use the frame's command state object.
    420 
    421 (define-objc-method ((:void :key-down event)
    422                      hemlock-text-view)
     415(defun pass-key-down-event-to-hemlock (self event)
    423416  #+debug
    424417  (#_NSLog #@"Key down event = %@" :address event)
     
    440433                     (hi::*echo-area-stream*
    441434                      (hemlock-frame-echo-area-stream w))
    442                      (hi::*echo-area-window* hi::*current-window*)
     435                     (hi::*echo-area-window* (slot-value w 'echo-area-view ))
    443436                     (hi::*echo-area-region*
    444437                      (hi::buffer-region hi::*echo-area-buffer*)))
    445438                (hi::interpret-key-event key-event info)))))))))
     439 
     440;;; Process a key-down NSEvent in a lisp text view by translating it
     441;;; into a Hemlock key event and passing it into the Hemlock command
     442;;; interpreter.  The underlying buffer becomes Hemlock's current buffer
     443;;; and the containing pane becomes Hemlock's current window when the
     444;;; command is processed.  Use the frame's command state object.
     445
     446(define-objc-method ((:void :key-down event)
     447                     hemlock-text-view)
     448  (pass-key-down-event-to-hemlock self event))
    446449
    447450;;; Update the underlying buffer's point.  Should really set the
     
    692695
    693696
     697(defmethod hi::activate-hemlock-view ((view text-pane))
     698  (let* ((hemlock-frame (send view 'window))
     699         (text-view (text-pane-text-view view)))
     700    (send hemlock-frame :make-first-responder text-view)))
     701
     702
    694703(defclass echo-area-view (ns:ns-text-view)
    695704    ()
    696705  (:metaclass ns:+ns-object))
     706
     707(defmethod hi::activate-hemlock-view ((view echo-area-view))
     708  (let* ((hemlock-frame (send view 'window)))
     709    (send hemlock-frame :make-first-responder view)))
    697710
    698711;;; The "document" for an echo-area isn't a real NSDocument.
     
    704717  (declare (ignore change)))
    705718
     719(define-objc-method ((:void :key-down event)
     720                     echo-area-view)
     721  (pass-key-down-event-to-hemlock self event))
    706722
    707723
     
    12211237        (send textview :page-up nil)))))
    12221238
    1223      
     1239(defun hi::get-key-event (text-view ignore)
     1240  (declare (ignore ignore))
     1241  (let* ((event (send (send text-view 'window)
     1242                      :next-event-matching-mask #$NSKeyDownMask)))
     1243    (nsevent-to-key-event event)))
    12241244
    12251245(provide "COCOA-EDITOR")
Note: See TracChangeset for help on using the changeset viewer.