Changeset 5732


Ignore:
Timestamp:
Jan 18, 2007, 3:15:24 AM (18 years ago)
Author:
Gary Byers
Message:

Use CGFloat, type casts, etc. Likwise for :<NSI>nteger, :<NSUI>nteger.

Location:
trunk/ccl/examples
Files:
2 edited

Legend:

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

    r2020 r5732  
    1010    (length (ns-lisp-string-string self)))
    1111
    12 (define-objc-method ((:unichar :character-at-index (unsigned index))
     12(define-objc-method ((:unichar :character-at-index (:<NSUI>nteger index))
    1313                     ns-lisp-string)
    1414  (char-code (schar (ns-lisp-string-string self) index)))
     
    9090        (our-frame-label-p self item)))
    9191
    92 (define-objc-method ((:int :outline-view view
    93                            :number-of-children-of-item item)
     92(define-objc-method ((:<NSI>nteger :outline-view view
     93                                   :number-of-children-of-item item)
    9494                     backtrace-window-controller)
    9595    (declare (ignore view))
     
    110110             
    111111(define-objc-method ((:id :outline-view view
    112                           :child (:int index)
     112                          :child (:<NSI>nteger index)
    113113                          :of-item item)
    114114                     backtrace-window-controller)
  • trunk/ccl/examples/cocoa-editor.lisp

    r5693 r5732  
    1717  (pushnew :all-in-cocoa-thread *features*)
    1818  (use-interface-dir :cocoa))
     19
     20;;; In the double-float case, this is probably way too small.
     21;;; Traditionally, it's (approximately) the point at which
     22;;; a single-float stops being able to accurately represent
     23;;; integral values.
     24(eval-when (:compile-toplevel :load-toplevel :execute)
     25  (defconstant large-number-for-text (float 1.0f7 +cgfloat-zero+)))
    1926
    2027(def-cocoa-default *editor-rows* :int 24 "Initial height of editor windows, in characters")
     
    257264;;; Return the length of the abstract string, i.e., the number of
    258265;;; characters in the buffer (including implicit newlines.)
    259 (define-objc-method ((:unsigned length)
     266(define-objc-method ((:<NSUI>nteger length)
    260267                     hemlock-buffer-string)
    261268  (let* ((cache (hemlock-buffer-string-cache self)))
     
    269276;;; Return the character at the specified index (as a :unichar.)
    270277
    271 (define-objc-method ((:unichar :character-at-index (unsigned index))
     278(define-objc-method ((:unichar :character-at-index (:<NSUI>nteger index))
    272279                     hemlock-buffer-string)
    273280  #+debug
    274   (#_NSLog #@"Character at index: %d" :unsigned index)
     281  (#_NSLog #@"Character at index: %d" :<NSUI>nteger index)
    275282  (char-code (hemlock-char-at-index (hemlock-buffer-string-cache self) index)))
    276283
     
    285292    #+debug
    286293    (#_NSLog #@"get characters: %d/%d"
    287              :unsigned index
    288              :unsigned length)
     294             :<NSUI>nteger index
     295             :<NSUI>nteger length)
    289296    (multiple-value-bind (line idx) (update-line-cache-for-index cache index)
    290297      (let* ((len (hemlock::line-length line)))
     
    303310                  idx 0))))))))
    304311
    305 (define-objc-method ((:void :get-line-start ((:* :unsigned) startptr)
    306                             :end ((:* :unsigned) endptr)
    307                             :contents-end ((:* :unsigned) contents-endptr)
     312(define-objc-method ((:void :get-line-start ((:* :<NSUI>nteger) startptr)
     313                            :end ((:* :<NSUI>nteger) endptr)
     314                            :contents-end ((:* :<NSUI>nteger) contents-endptr)
    308315                            :for-range (:<NSR>ange r))
    309316                     hemlock-buffer-string)
     
    409416  (:metaclass ns:+ns-object))
    410417
    411 (define-objc-method ((:unsigned :line-break-before-index (:unsigned index)
     418(define-objc-method ((:<NSUI>nteger :line-break-before-index (:<NSUI>nteger index)
    412419                                :within-range (:<NSR>ange r))
    413420                     hemlock-text-storage)
     
    514521                        buffer))))
    515522
    516 (define-objc-method ((:id :attributes-at-index (:unsigned index)
     523(define-objc-method ((:id :attributes-at-index (#+apple-objc-2.0 :<NSUI>nteger
     524                                                #-apple-objc-2.0 :unsigned index)
    517525                          :effective-range ((* :<NSR>ange) rangeptr))
    518526                     hemlock-text-storage)
     
    9981006                      (hi::buffer-modeline-fields buffer)))))
    9991007        (send (%make-nsstring string)
    1000               :draw-at-point (ns-make-point 0.0f0 0.0f0)
     1008              :draw-at-point (ns-make-point +cgfloat-zero+ +cgfloat-zero+)
    10011009              :with-attributes *modeline-text-attributes*)))))
    10021010
     
    11471155        (slet* ((contentsize (send scrollview 'content-size))
    11481156                (containersize (ns-make-size
    1149                                 1.0f7
    1150                                 1.0f7))
     1157                                large-number-for-text
     1158                                large-number-for-text))
    11511159                (tv-frame (ns-make-rect
    1152                            0.0f0
    1153                            0.0f0
     1160                           +cgfloat-zero+
     1161                           +cgfloat-zero+
    11541162                           (pref contentsize :<NSS>ize.width)
    11551163                           (pref contentsize :<NSS>ize.height))))
     
    11651173              (send layout :set-delegate tv)
    11661174              (send tv :set-min-size (ns-make-size
    1167                                       0.0f0
     1175                                      +cgfloat-zero+
    11681176                                      (pref contentsize :<NSS>ize.height)))
    1169               (send tv :set-max-size (ns-make-size 1.0f7 1.0f7))
     1177              (send tv :set-max-size (ns-make-size large-number-for-text large-number-for-text))
    11701178              (send tv :set-rich-text nil)
    11711179              (send tv :set-horizontally-resizable t)
     
    12471255      (send box :set-autoresizing-mask #$NSViewWidthSizable)
    12481256      (slet* ((box-frame (send box 'bounds))
    1249               (containersize (ns-make-size 1.0f7 (pref box-frame :<NSR>ect.size.height))))
     1257              (containersize (ns-make-size large-number-for-text (pref box-frame :<NSR>ect.size.height))))
    12501258        (let* ((clipview (make-objc-instance "NSClipView"
    12511259                                             :with-frame box-frame)))
     
    12781286                                             :text-container container)))
    12791287              (send echo :set-min-size (pref box-frame :<NSR>ect.size))
    1280               (send echo :set-max-size (ns-make-size 1.0f7 (pref box-frame :<NSR>ect.size)))
     1288              (send echo :set-max-size (ns-make-size large-number-for-text (pref box-frame :<NSR>ect.size)))
    12811289              (send echo :set-rich-text nil)
    12821290              (send echo :set-horizontally-resizable t)
     
    16221630 
    16231631(defun hi::document-begin-editing (document)
     1632  #-all-in-cocoa-thread
     1633  (send (slot-value document 'textstorage) 'begin-editing)
    16241634  #+all-in-cocoa-thread
    1625   (send (slot-value document 'textstorage) 'begin-editing)
    1626   #-all-in-cocoa-thread
    16271635  (send (slot-value document 'textstorage)
    16281636        :perform-selector-on-main-thread
     
    16371645
    16381646(defun hi::document-end-editing (document)
     1647  #-all-in-cocoa-thread
     1648  (send (slot-value document 'textstorage) 'end-editing)
    16391649  #+all-in-cocoa-thread
    1640   (send (slot-value document 'textstorage) 'end-editing)
    1641   #-all-in-cocoa-thread
    16421650  (send (slot-value document 'textstorage)
    16431651        :perform-selector-on-main-thread
     
    17881796  (let* ((sf (send f 'screen-font)))
    17891797    (if (%null-ptr-p sf) (setq sf f))
    1790     (values (send sf 'default-line-height-for-font)
    1791             (send sf :width-of-string #@" "))))
     1798    (values (fround
     1799             (+ (- (send sf 'ascender)
     1800                   (send sf 'descender))
     1801                (send sf 'leading)))
     1802            (slet ((s (send sf 'maximum-advancement)))
     1803              (fround (pref s :<NSS>ize.width))))))
    17921804         
    17931805
     
    18041816      (when (send scrollview 'has-vertical-scroller)
    18051817        (send scrollview :set-vertical-line-scroll char-height)
    1806         (send scrollview :set-vertical-page-scroll 0.0f0 #|char-height|#))
     1818        (send scrollview :set-vertical-page-scroll +cgfloat-zero+ #|char-height|#))
    18071819      (when (send scrollview 'has-horizontal-scroller)
    18081820        (send scrollview :set-horizontal-line-scroll char-width)
    1809         (send scrollview :set-horizontal-page-scroll 0.0f0 #|char-width|#))
     1821        (send scrollview :set-horizontal-page-scroll +cgfloat-zero+ #|char-width|#))
    18101822      (slet ((sv-size
    18111823              (send (@class ns-scroll-view)
     
    20382050    (send controller 'release)
    20392051    (slet ((current-point (ns-make-point (or *next-editor-x-pos*
    2040                                              *initial-editor-x-pos*)
     2052                                             (float *initial-editor-x-pos*
     2053                                                    +cgfloat-zero+))
    20412054                                         (or *next-editor-y-pos*
    2042                                              *initial-editor-y-pos*))))
     2055                                             (float *initial-editor-y-pos*
     2056                                                    +cgfloat-zero+)))))
    20432057      (slet ((new-point (send window
    20442058                              :cascade-top-left-from-point current-point)))
Note: See TracChangeset for help on using the changeset viewer.