Changeset 891


Ignore:
Timestamp:
Oct 6, 2004, 3:44:40 PM (20 years ago)
Author:
Gary Byers
Message:

Alex Crain's patches (paste in listener, typeout window size)

Location:
trunk/ccl/examples
Files:
3 edited

Legend:

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

    r878 r891  
    399399(defclass hemlock-text-storage (ns:ns-text-storage)
    400400    ((string :foreign-type :id)
    401      (edit-count :foreign-type :int))
     401     (edit-count :foreign-type :int)
     402     (append-edits :foreign-type :int))
    402403  (:metaclass ns:+ns-object))
    403404
     
    535536
    536537(define-objc-method ((:void :replace-characters-in-range (:<NSR>ange r)
    537                             :with-string string)
    538                      hemlock-text-storage)
    539     (let* ((cache (hemlock-buffer-string-cache (send self 'string)))
    540            (buffer (if cache (buffer-cache-buffer cache)))
    541            (hi::*buffer-gap-context* (hi::buffer-gap-context buffer))
    542            (location (pref r :<NSR>ange.location))
    543            (length (pref r :<NSR>ange.length))
    544            (mark (hi::buffer-%mark buffer))
    545            (point (hi::buffer-point buffer)))
     538                            :with-string string)
     539                     hemlock-text-storage)
     540  (let* ((cache (hemlock-buffer-string-cache (send self 'string)))
     541         (buffer (if cache (buffer-cache-buffer cache)))
     542         (hi::*buffer-gap-context* (hi::buffer-gap-context buffer))
     543         (location (pref r :<NSR>ange.location))
     544         (length (pref r :<NSR>ange.length))
     545         (mark (hi::buffer-%mark buffer))
     546         (point (hi::buffer-point buffer))
     547         input-mark)
     548
     549    ;;
     550    ;; special behavior for listener windows.
     551    ;;
     552    (if (and (> (slot-value self 'append-edits) 0)
     553             (progn
     554               (setf input-mark (hi::variable-value 'hemlock::buffer-input-mark :buffer buffer))
     555               (not (hi::same-line-p point input-mark))))
     556        (progn
     557          ;;
     558          ;;  move the point to the end of the buffer
     559          ;;
     560          (setf (hi::buffer-region-active buffer) nil)
     561          (move-hemlock-mark-to-absolute-position point cache (hemlock-buffer-length buffer)))
    546562      (cond ((> length 0)
    547              (move-hemlock-mark-to-absolute-position mark cache location)
    548              (move-hemlock-mark-to-absolute-position point cache (+ location length))
    549              (hemlock::%buffer-activate-region buffer))
    550             (t
    551              (move-hemlock-mark-to-absolute-position point cache location)))
    552       (hi::insert-string point (lisp-string-from-nsstring string))))
     563             (move-hemlock-mark-to-absolute-position mark cache location)
     564             (move-hemlock-mark-to-absolute-position point cache (+ location length))
     565             (hemlock::%buffer-activate-region buffer))
     566            (t
     567             (move-hemlock-mark-to-absolute-position point cache location))))
     568    (hi::insert-string point (lisp-string-from-nsstring string))))
    553569
    554570
  • trunk/ccl/examples/cocoa-listener.lisp

    r866 r891  
    189189                                    "Listener-~d" *cocoa-listener-count*)))
    190190             (buffer (hemlock-document-buffer doc)))
     191        (setf (slot-value (slot-value self 'textstorage) 'append-edits) 1)
    191192        (send doc :set-file-name  (%make-nsstring listener-name))
    192193        (setf (hi::buffer-pathname buffer) nil
  • trunk/ccl/examples/cocoa-typeout.lisp

    r876 r891  
    7777                                         :width 600
    7878                                         :activate nil)))
     79           (rlet ((size :<NSS>ize :width 600.0f0 :height 10000.0f0))
     80                 (send panel :set-max-size size)
     81                 (setf (pref size :<NSS>ize.height) 1.0f0)
     82                 (send panel :set-min-size size))
    7983           (slet ((bounds (send (send panel 'content-view) 'bounds)))
    8084                 (let* ((view (make-instance 'typeout-view :with-frame bounds)))
Note: See TracChangeset for help on using the changeset viewer.