Changeset 6765


Ignore:
Timestamp:
Jun 20, 2007, 10:34:32 AM (17 years ago)
Author:
Gary Byers
Message:

Wrap #/beginEditing, #/endEditing around textstorage modifications.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ide-1.0/ccl/examples/cocoa-typeout.lisp

    r6251 r6765  
    6565
    6666(objc:defmethod #/sharedPanel ((self +typeout-panel))
    67   (cond (*typeout-panel*)
    68         (t
    69          (let* ((panel (new-cocoa-window :class self
    70                                          :title "Typeout"
    71                                          :width 600
    72                                          :activate nil)))
    73            (ns:with-ns-size (size 600 10000)
    74              (#/setMaxSize: panel size)
    75              (setf (ns:ns-size-height size) 1)
    76              (#/setMinSize: panel size))
    77            (let* ((view (make-instance 'typeout-view :with-frame (#/bounds (#/contentView panel)))))
    78              (#/setContentView: panel view)
    79              (#/setNeedsDisplay: view t)
    80              (setf (slot-value panel 'typeout-view) view)
    81              (setq *typeout-panel* panel))))))
     67   (cond (*typeout-panel*)
     68        (t
     69          (let* ((panel (new-cocoa-window :class self
     70                                          :title "Typeout"
     71                                          :width 600
     72                                          :activate nil)))
     73            (ns:with-ns-size (size 600 10000)
     74                             (#/setMaxSize: panel size)
     75                             (setf (ns:ns-size-height size) 1)
     76                             (#/setMinSize: panel size))
     77            (let* ((view (make-instance 'typeout-view :with-frame (#/bounds (#/contentView panel)))))
     78              (#/setContentView: panel view)
     79              (#/setNeedsDisplay: view t)
     80              (setf (slot-value panel 'typeout-view) view)
     81              (setq *typeout-panel* panel))))))
    8282
    8383(objc:defmethod #/init ((self typeout-panel))
     
    9292(defloadvar *typeout-attributes* nil)
    9393
    94 (defclass typeout-stream (fundamental-stream)
     94(defclass typeout-stream (fundamental-character-output-stream)
    9595  ((text-storage :initform nil :accessor typeout-stream-text-storage)
    9696   (line-number :initform 0 :accessor typeout-stream-line-number)
     
    106106                                  :line-break-mode :word)))
    107107    (#/show panel)))
     108
    108109
    109110
     
    172173  (prepare-typeout-stream stream)
    173174  (let* ((the-typeout-view (typeout-panel-typeout-view *typeout-panel*))
    174         (text-storage (slot-value the-typeout-view 'text-storage))
    175         (len (#/length text-storage)))
     175        (text-storage (slot-value the-typeout-view 'text-storage))
     176        (len (#/length text-storage)))
    176177    (declare (type ns:ns-text-storage text-storage))
     178    (#/performSelectorOnMainThread:withObject:waitUntilDone:
     179     text-storage
     180     (@selector #/beginEditing)
     181     +null-ptr+
     182     t)
    177183    (#/deleteCharactersInRange: text-storage (ns:make-ns-range 0 len))))
     184
     185(defmethod stream-force-output ((stream typeout-stream))
     186  (let* ((the-typeout-view (typeout-panel-typeout-view *typeout-panel*))
     187         (text-storage (slot-value the-typeout-view 'text-storage)))
     188    (#/performSelectorOnMainThread:withObject:waitUntilDone:
     189     text-storage
     190     (@selector #/endEditing)
     191     +null-ptr+
     192     t)))
     193 
     194
    178195
    179196(defloadvar *typeout-stream* (make-instance 'typeout-stream))
Note: See TracChangeset for help on using the changeset viewer.