Changeset 811


Ignore:
Timestamp:
May 2, 2004, 12:28:06 AM (21 years ago)
Author:
Gary Byers
Message:

save-as, open-document for Hemlock.
Fix off-by-one in paren-blinking; lock view focus when disabling blink
to fix display glitch.

File:
1 edited

Legend:

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

    r793 r811  
    538538  (send-super :set-background-color color))
    539539
    540 ;;; Maybe cause 1 character in the textview to blink (by setting/clearing a
    541 ;;; temporary attribute) in synch with the insertion point.
     540;;; Maybe cause 1 character in the textview to blink (by drawing an empty
     541;;; character rectangle) in synch with the insertion point.
    542542
    543543(define-objc-method ((:void :draw-insertion-point-in-rect (:<NSR>ect r)
     
    558558                    (ns-make-range (text-view-blink-location self) 1)
    559559                    :actual-character-range (%null-ptr))))
    560         #+debug (#_NSLog #@"Flag = %d" :<BOOL> (if flag #$YES #$NO))
     560        #+debug (#_NSLog #@"Flag = %d, location = %d" :<BOOL> (if flag #$YES #$NO) :int (text-view-blink-location self))
    561561        (if flag
    562562          (slet ((rect (send layout
     
    576576  (when (eql (text-view-blink-enabled self) #$YES)
    577577    (setf (text-view-blink-enabled self) #$NO)
    578     (let* ((layout (send self 'layout-manager)))
    579       (slet ((glyph-range (send layout
    580                                 :glyph-range-for-character-range
    581                                 (ns-make-range (text-view-blink-location self)
    582                                               1)
    583                                 :actual-character-range (%null-ptr))))
    584           (send layout
    585                 :draw-glyphs-for-glyph-range glyph-range
    586                 :at-point  (send self 'text-container-origin))))))
     578    (unwind-protect
     579         (progn
     580           (send self 'lock-focus)
     581           (let* ((layout (send self 'layout-manager)))
     582             (slet ((glyph-range (send layout
     583                                       :glyph-range-for-character-range
     584                                       (ns-make-range (text-view-blink-location self)
     585                                                      1)
     586                                       :actual-character-range (%null-ptr))))
     587                   (send layout
     588                         :draw-glyphs-for-glyph-range glyph-range
     589                         :at-point  (send self 'text-container-origin)))))
     590      (send self 'unlock-focus))))
    587591
    588592(defmethod update-blink ((self hemlock-textstorage-text-view))
     
    601605                     #+debug (#_NSLog #@"enable blink, forward")
    602606                     (setf (text-view-blink-location self)
    603                            (mark-absolute-position temp)
     607                           (1- (mark-absolute-position temp))
    604608                           (text-view-blink-enabled self) #$YES))))
    605609                ((eql (hi::previous-character point) #\))
     
    18181822
    18191823
     1824(defun hi::open-document ()
     1825  (send (send (find-class 'ns:ns-document-controller)
     1826              'shared-document-controller)
     1827        :perform-selector-on-main-thread (@selector "openDocument:")
     1828        :with-object (%null-ptr)
     1829        :wait-until-done t))
     1830 
    18201831(defmethod hi::save-hemlock-document ((self hemlock-editor-document))
    1821   (send self :save-document (%null-ptr)))
     1832  (send self
     1833        :perform-selector-on-main-thread (@selector "saveDocument:")
     1834        :with-object (%null-ptr)
     1835        :wait-until-done t))
     1836
     1837
     1838(defmethod hi::save-hemlock-document ((self hemlock-editor-document))
     1839  (send self
     1840        :perform-selector-on-main-thread (@selector "saveDocumentAs:")
     1841        :with-object (%null-ptr)
     1842        :wait-until-done t))
    18221843
    18231844;;; This needs to run on the main thread.
Note: See TracChangeset for help on using the changeset viewer.