Changeset 666
- Timestamp:
- Mar 18, 2004, 4:43:31 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/ccl/examples/cocoa-editor.lisp (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ccl/examples/cocoa-editor.lisp
r641 r666 132 132 ;;; buffer generally has to call this, since any cached information 133 133 ;;; might be invalidated by the modification. 134 134 135 (defun reset-buffer-cache (d &optional (buffer (buffer-cache-buffer d) 135 136 buffer-p)) … … 209 210 hemlock-buffer-string) 210 211 (let* ((cache (hemlock-buffer-string-cache self))) 211 (force-output)212 212 (or (buffer-cache-buflen cache) 213 213 (setf (buffer-cache-buflen cache) … … 240 240 (let* ((cp/m-p (eq external-format :cp/m))) 241 241 (when cp/m-p 242 ;; This may seem like lot of fuss about an ancient OS and its243 ;; odd line-termination conventions. Of course, I'm actually244 ;; referring to CP/M-86.242 ;; This may seem like lot of fuss about an ancient OS and its 243 ;; odd line-termination conventions. Of course, I'm actually 244 ;; referring to CP/M-86. 245 245 (do* ((line (hi::mark-line (hi::buffer-start-mark buffer)) 246 246 next) … … 436 436 #+debug 437 437 (format t "~& key-event = ~s" key-event) 438 (hi::interpret-key-event key-event info)))))))) 438 (let* ((w (send self 'window)) 439 (hi::*echo-area-buffer* (hemlock-frame-echo-area-buffer w)) 440 (hi::*echo-area-stream* 441 (hemlock-frame-echo-area-stream w)) 442 (hi::*echo-area-window* hi::*current-window*) 443 (hi::*echo-area-region* 444 (hi::buffer-region hi::*echo-area-buffer*))) 445 (hi::interpret-key-event key-event info))))))))) 439 446 440 447 ;;; Update the underlying buffer's point. Should really set the … … 689 696 (:metaclass ns:+ns-object)) 690 697 691 698 ;;; The "document" for an echo-area isn't a real NSDocument. 699 (defclass echo-area-document (ns:ns-object) 700 ((textstorage :foreign-type :id)) 701 (:metaclass ns:+ns-object)) 702 703 (define-objc-method ((:void :update-change-count (:<NSD>ocument<C>hange<T>ype change)) echo-area-document) 704 (declare (ignore change))) 705 706 707 708 (defloadvar *hemlock-frame-count* 0) 709 710 (defun make-echo-area (hemlock-frame x y width height) 711 (slet ((frame (ns-make-rect x y width height)) 712 (containersize (ns-make-size 1.0f7 height))) 713 (let* ((buffer (hi:make-buffer (format nil "Echo Area ~d" 714 (prog1 715 *hemlock-frame-count* 716 (incf *hemlock-frame-count*))) 717 :modes '("Echo Area"))) 718 (stream (hi::make-hemlock-output-stream 719 (hi::region-end (hi::buffer-region buffer)) :full)) 720 (textstorage (make-textstorage-for-hemlock-buffer buffer)) 721 (doc (make-objc-instance 'echo-area-document)) 722 (layout (make-objc-instance 'ns-layout-manager)) 723 (container (send (make-objc-instance 'ns-text-container 724 :with-container-size 725 containersize) 726 'autorelease))) 727 (send textstorage :add-layout-manager layout) 728 (send layout :add-text-container container) 729 (send layout 'release) 730 (let* ((echo (make-objc-instance 'echo-area-view 731 :with-frame frame 732 :text-container container))) 733 (send echo :set-min-size (ns-make-size 0.0f0 height)) 734 (send echo :set-max-size (ns-make-size 1.0f7 1.0f7)) 735 (send echo :set-rich-text nil) 736 (send echo :set-horizontally-resizable nil) 737 (send echo :set-vertically-resizable nil) 738 (send echo :set-autoresizing-mask #$NSViewWidthSizable) 739 (send container :set-width-tracks-text-view nil) 740 (send container :set-height-tracks-text-view nil) 741 (setf (hemlock-frame-echo-area-buffer hemlock-frame) buffer 742 (hemlock-frame-echo-area-stream hemlock-frame) stream 743 (slot-value doc 'textstorage) textstorage 744 (hi::buffer-document buffer) doc) 745 746 echo)))) 747 692 748 (defun make-echo-area-for-window (w) 693 749 (let* ((content-view (send w 'content-view))) 694 750 (slet ((bounds (send content-view 'bounds))) 695 (slet ((frame (ns-make-rect 5.0 5.0 (- (pref bounds :<NSR>ect.size.width) 24.0) 15.0))) 696 (let* ((echo-area (make-objc-instance 'echo-area-view :with-frame frame))) 697 (send echo-area :set-autoresizing-mask #$NSViewWidthSizable) 698 (send content-view :add-subview echo-area) 699 echo-area))))) 751 (let* ((echo-area (make-echo-area w 5.0f0 5.0f0 (- (pref bounds :<NSR>ect.size.width) 24.0f0) 15.0f0))) 752 (send content-view :add-subview echo-area) 753 echo-area)))) 700 754 701 755 … … 707 761 ((echo-area-view :foreign-type :id) 708 762 (command-info :initform (hi::make-command-interpreter-info) 709 :accessor hemlock-frame-command-info)) 763 :accessor hemlock-frame-command-info) 764 (echo-area-buffer :initform nil :accessor hemlock-frame-echo-area-buffer) 765 (echo-area-stream :initform nil :accessor hemlock-frame-echo-area-stream)) 710 766 (:metaclass ns:+ns-object)) 711 767 … … 941 997 942 998 943 (defun hi::document-panes (document) 944 (let* ((ts (slot-value document 'textstorage)) 945 (panes ())) 946 (for-each-textview-using-storage 947 ts 948 #'(lambda (tv) 949 (let* ((pane (text-view-pane tv))) 950 (unless (%null-ptr-p pane) 951 (push pane panes))))) 952 panes)) 999 (defmethod hi::document-panes ((document t)) 1000 ) 1001 1002 953 1003 954 1004 … … 1063 1113 (let* ((cache (hemlock-buffer-string-cache string))) 1064 1114 (when cache (buffer-cache-buffer cache)))))) 1115 1116 (defmethod hi::document-panes ((document lisp-editor-document)) 1117 (let* ((ts (slot-value document 'textstorage)) 1118 (panes ())) 1119 (for-each-textview-using-storage 1120 ts 1121 #'(lambda (tv) 1122 (let* ((pane (text-view-pane tv))) 1123 (unless (%null-ptr-p pane) 1124 (push pane panes))))) 1125 panes)) 1065 1126 1066 1127 (define-objc-method ((:id :data-representation-of-type type)
Note:
See TracChangeset
for help on using the changeset viewer.
