Index: /trunk/ccl/examples/cocoa-backtrace.lisp
===================================================================
--- /trunk/ccl/examples/cocoa-backtrace.lisp	(revision 5731)
+++ /trunk/ccl/examples/cocoa-backtrace.lisp	(revision 5732)
@@ -10,5 +10,5 @@
     (length (ns-lisp-string-string self)))
 
-(define-objc-method ((:unichar :character-at-index (unsigned index))
+(define-objc-method ((:unichar :character-at-index (:<NSUI>nteger index))
 		     ns-lisp-string)
   (char-code (schar (ns-lisp-string-string self) index)))
@@ -90,6 +90,6 @@
         (our-frame-label-p self item)))
 
-(define-objc-method ((:int :outline-view view
-                           :number-of-children-of-item item)
+(define-objc-method ((:<NSI>nteger :outline-view view
+                                   :number-of-children-of-item item)
                      backtrace-window-controller)
     (declare (ignore view))
@@ -110,5 +110,5 @@
              
 (define-objc-method ((:id :outline-view view
-                          :child (:int index)
+                          :child (:<NSI>nteger index)
                           :of-item item)
                      backtrace-window-controller)
Index: /trunk/ccl/examples/cocoa-editor.lisp
===================================================================
--- /trunk/ccl/examples/cocoa-editor.lisp	(revision 5731)
+++ /trunk/ccl/examples/cocoa-editor.lisp	(revision 5732)
@@ -17,4 +17,11 @@
   (pushnew :all-in-cocoa-thread *features*)
   (use-interface-dir :cocoa))
+
+;;; In the double-float case, this is probably way too small.
+;;; Traditionally, it's (approximately) the point at which
+;;; a single-float stops being able to accurately represent
+;;; integral values.
+(eval-when (:compile-toplevel :load-toplevel :execute)
+  (defconstant large-number-for-text (float 1.0f7 +cgfloat-zero+)))
 
 (def-cocoa-default *editor-rows* :int 24 "Initial height of editor windows, in characters")
@@ -257,5 +264,5 @@
 ;;; Return the length of the abstract string, i.e., the number of
 ;;; characters in the buffer (including implicit newlines.)
-(define-objc-method ((:unsigned length)
+(define-objc-method ((:<NSUI>nteger length)
 		     hemlock-buffer-string)
   (let* ((cache (hemlock-buffer-string-cache self)))
@@ -269,8 +276,8 @@
 ;;; Return the character at the specified index (as a :unichar.)
 
-(define-objc-method ((:unichar :character-at-index (unsigned index))
+(define-objc-method ((:unichar :character-at-index (:<NSUI>nteger index))
 		     hemlock-buffer-string)
   #+debug
-  (#_NSLog #@"Character at index: %d" :unsigned index)
+  (#_NSLog #@"Character at index: %d" :<NSUI>nteger index)
   (char-code (hemlock-char-at-index (hemlock-buffer-string-cache self) index)))
 
@@ -285,6 +292,6 @@
     #+debug
     (#_NSLog #@"get characters: %d/%d"
-             :unsigned index
-             :unsigned length)
+             :<NSUI>nteger index
+             :<NSUI>nteger length)
     (multiple-value-bind (line idx) (update-line-cache-for-index cache index)
       (let* ((len (hemlock::line-length line)))
@@ -303,7 +310,7 @@
                   idx 0))))))))
 
-(define-objc-method ((:void :get-line-start ((:* :unsigned) startptr)
-                            :end ((:* :unsigned) endptr)
-                            :contents-end ((:* :unsigned) contents-endptr)
+(define-objc-method ((:void :get-line-start ((:* :<NSUI>nteger) startptr)
+                            :end ((:* :<NSUI>nteger) endptr)
+                            :contents-end ((:* :<NSUI>nteger) contents-endptr)
                             :for-range (:<NSR>ange r))
                      hemlock-buffer-string)
@@ -409,5 +416,5 @@
   (:metaclass ns:+ns-object))
 
-(define-objc-method ((:unsigned :line-break-before-index (:unsigned index)
+(define-objc-method ((:<NSUI>nteger :line-break-before-index (:<NSUI>nteger index)
                                 :within-range (:<NSR>ange r))
                      hemlock-text-storage)
@@ -514,5 +521,6 @@
 			buffer))))
 
-(define-objc-method ((:id :attributes-at-index (:unsigned index)
+(define-objc-method ((:id :attributes-at-index (#+apple-objc-2.0 :<NSUI>nteger
+                                                #-apple-objc-2.0 :unsigned index)
 			  :effective-range ((* :<NSR>ange) rangeptr))
 		     hemlock-text-storage)
@@ -998,5 +1006,5 @@
                       (hi::buffer-modeline-fields buffer)))))
 	(send (%make-nsstring string)
-	      :draw-at-point (ns-make-point 0.0f0 0.0f0)
+	      :draw-at-point (ns-make-point +cgfloat-zero+ +cgfloat-zero+)
 	      :with-attributes *modeline-text-attributes*)))))
 
@@ -1147,9 +1155,9 @@
 	(slet* ((contentsize (send scrollview 'content-size))
 		(containersize (ns-make-size
-				1.0f7
-				1.0f7))
+				large-number-for-text
+				large-number-for-text))
 		(tv-frame (ns-make-rect
-			   0.0f0
-			   0.0f0
+			   +cgfloat-zero+
+			   +cgfloat-zero+
 			   (pref contentsize :<NSS>ize.width)
 			   (pref contentsize :<NSS>ize.height))))
@@ -1165,7 +1173,7 @@
               (send layout :set-delegate tv)
 	      (send tv :set-min-size (ns-make-size
-				      0.0f0
+				      +cgfloat-zero+
 				      (pref contentsize :<NSS>ize.height)))
-	      (send tv :set-max-size (ns-make-size 1.0f7 1.0f7))
+	      (send tv :set-max-size (ns-make-size large-number-for-text large-number-for-text))
 	      (send tv :set-rich-text nil)
 	      (send tv :set-horizontally-resizable t)
@@ -1247,5 +1255,5 @@
       (send box :set-autoresizing-mask #$NSViewWidthSizable)
       (slet* ((box-frame (send box 'bounds))
-              (containersize (ns-make-size 1.0f7 (pref box-frame :<NSR>ect.size.height))))
+              (containersize (ns-make-size large-number-for-text (pref box-frame :<NSR>ect.size.height))))
         (let* ((clipview (make-objc-instance "NSClipView"
                                              :with-frame box-frame)))
@@ -1278,5 +1286,5 @@
                                              :text-container container)))
               (send echo :set-min-size (pref box-frame :<NSR>ect.size))
-              (send echo :set-max-size (ns-make-size 1.0f7 (pref box-frame :<NSR>ect.size)))
+              (send echo :set-max-size (ns-make-size large-number-for-text (pref box-frame :<NSR>ect.size)))
               (send echo :set-rich-text nil)
               (send echo :set-horizontally-resizable t)
@@ -1622,7 +1630,7 @@
   
 (defun hi::document-begin-editing (document)
+  #-all-in-cocoa-thread
+  (send (slot-value document 'textstorage) 'begin-editing)
   #+all-in-cocoa-thread
-  (send (slot-value document 'textstorage) 'begin-editing)
-  #-all-in-cocoa-thread
   (send (slot-value document 'textstorage)
         :perform-selector-on-main-thread
@@ -1637,7 +1645,7 @@
 
 (defun hi::document-end-editing (document)
+  #-all-in-cocoa-thread
+  (send (slot-value document 'textstorage) 'end-editing)
   #+all-in-cocoa-thread
-  (send (slot-value document 'textstorage) 'end-editing)
-  #-all-in-cocoa-thread
   (send (slot-value document 'textstorage)
         :perform-selector-on-main-thread
@@ -1788,6 +1796,10 @@
   (let* ((sf (send f 'screen-font)))
     (if (%null-ptr-p sf) (setq sf f))
-    (values (send sf 'default-line-height-for-font)
-	    (send sf :width-of-string #@" "))))
+    (values (fround
+             (+ (- (send sf 'ascender)
+                   (send sf 'descender))
+                (send sf 'leading)))
+            (slet ((s (send sf 'maximum-advancement)))
+              (fround (pref s :<NSS>ize.width))))))
          
 
@@ -1804,8 +1816,8 @@
       (when (send scrollview 'has-vertical-scroller)
 	(send scrollview :set-vertical-line-scroll char-height)
-	(send scrollview :set-vertical-page-scroll 0.0f0 #|char-height|#))
+	(send scrollview :set-vertical-page-scroll +cgfloat-zero+ #|char-height|#))
       (when (send scrollview 'has-horizontal-scroller)
 	(send scrollview :set-horizontal-line-scroll char-width)
-	(send scrollview :set-horizontal-page-scroll 0.0f0 #|char-width|#))
+	(send scrollview :set-horizontal-page-scroll +cgfloat-zero+ #|char-width|#))
       (slet ((sv-size
 	      (send (@class ns-scroll-view)
@@ -2038,7 +2050,9 @@
     (send controller 'release)
     (slet ((current-point (ns-make-point (or *next-editor-x-pos*
-                                             *initial-editor-x-pos*)
+                                             (float *initial-editor-x-pos*
+                                                    +cgfloat-zero+))
                                          (or *next-editor-y-pos*
-                                             *initial-editor-y-pos*))))
+                                             (float *initial-editor-y-pos*
+                                                    +cgfloat-zero+)))))
       (slet ((new-point (send window
                               :cascade-top-left-from-point current-point)))
