Changeset 5732
- Timestamp:
- Jan 18, 2007, 3:15:24 AM (18 years ago)
- Location:
- trunk/ccl/examples
- Files:
-
- 2 edited
-
cocoa-backtrace.lisp (modified) (3 diffs)
-
cocoa-editor.lisp (modified) (17 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ccl/examples/cocoa-backtrace.lisp
r2020 r5732 10 10 (length (ns-lisp-string-string self))) 11 11 12 (define-objc-method ((:unichar :character-at-index ( unsignedindex))12 (define-objc-method ((:unichar :character-at-index (:<NSUI>nteger index)) 13 13 ns-lisp-string) 14 14 (char-code (schar (ns-lisp-string-string self) index))) … … 90 90 (our-frame-label-p self item))) 91 91 92 (define-objc-method ((: int:outline-view view93 :number-of-children-of-item item)92 (define-objc-method ((:<NSI>nteger :outline-view view 93 :number-of-children-of-item item) 94 94 backtrace-window-controller) 95 95 (declare (ignore view)) … … 110 110 111 111 (define-objc-method ((:id :outline-view view 112 :child (: intindex)112 :child (:<NSI>nteger index) 113 113 :of-item item) 114 114 backtrace-window-controller) -
trunk/ccl/examples/cocoa-editor.lisp
r5693 r5732 17 17 (pushnew :all-in-cocoa-thread *features*) 18 18 (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+))) 19 26 20 27 (def-cocoa-default *editor-rows* :int 24 "Initial height of editor windows, in characters") … … 257 264 ;;; Return the length of the abstract string, i.e., the number of 258 265 ;;; characters in the buffer (including implicit newlines.) 259 (define-objc-method ((: unsignedlength)266 (define-objc-method ((:<NSUI>nteger length) 260 267 hemlock-buffer-string) 261 268 (let* ((cache (hemlock-buffer-string-cache self))) … … 269 276 ;;; Return the character at the specified index (as a :unichar.) 270 277 271 (define-objc-method ((:unichar :character-at-index ( unsignedindex))278 (define-objc-method ((:unichar :character-at-index (:<NSUI>nteger index)) 272 279 hemlock-buffer-string) 273 280 #+debug 274 (#_NSLog #@"Character at index: %d" : unsignedindex)281 (#_NSLog #@"Character at index: %d" :<NSUI>nteger index) 275 282 (char-code (hemlock-char-at-index (hemlock-buffer-string-cache self) index))) 276 283 … … 285 292 #+debug 286 293 (#_NSLog #@"get characters: %d/%d" 287 : unsignedindex288 : unsignedlength)294 :<NSUI>nteger index 295 :<NSUI>nteger length) 289 296 (multiple-value-bind (line idx) (update-line-cache-for-index cache index) 290 297 (let* ((len (hemlock::line-length line))) … … 303 310 idx 0)))))))) 304 311 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) 308 315 :for-range (:<NSR>ange r)) 309 316 hemlock-buffer-string) … … 409 416 (:metaclass ns:+ns-object)) 410 417 411 (define-objc-method ((: unsigned :line-break-before-index (:unsignedindex)418 (define-objc-method ((:<NSUI>nteger :line-break-before-index (:<NSUI>nteger index) 412 419 :within-range (:<NSR>ange r)) 413 420 hemlock-text-storage) … … 514 521 buffer)))) 515 522 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) 517 525 :effective-range ((* :<NSR>ange) rangeptr)) 518 526 hemlock-text-storage) … … 998 1006 (hi::buffer-modeline-fields buffer))))) 999 1007 (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+) 1001 1009 :with-attributes *modeline-text-attributes*))))) 1002 1010 … … 1147 1155 (slet* ((contentsize (send scrollview 'content-size)) 1148 1156 (containersize (ns-make-size 1149 1.0f71150 1.0f7))1157 large-number-for-text 1158 large-number-for-text)) 1151 1159 (tv-frame (ns-make-rect 1152 0.0f01153 0.0f01160 +cgfloat-zero+ 1161 +cgfloat-zero+ 1154 1162 (pref contentsize :<NSS>ize.width) 1155 1163 (pref contentsize :<NSS>ize.height)))) … … 1165 1173 (send layout :set-delegate tv) 1166 1174 (send tv :set-min-size (ns-make-size 1167 0.0f01175 +cgfloat-zero+ 1168 1176 (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)) 1170 1178 (send tv :set-rich-text nil) 1171 1179 (send tv :set-horizontally-resizable t) … … 1247 1255 (send box :set-autoresizing-mask #$NSViewWidthSizable) 1248 1256 (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)))) 1250 1258 (let* ((clipview (make-objc-instance "NSClipView" 1251 1259 :with-frame box-frame))) … … 1278 1286 :text-container container))) 1279 1287 (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))) 1281 1289 (send echo :set-rich-text nil) 1282 1290 (send echo :set-horizontally-resizable t) … … 1622 1630 1623 1631 (defun hi::document-begin-editing (document) 1632 #-all-in-cocoa-thread 1633 (send (slot-value document 'textstorage) 'begin-editing) 1624 1634 #+all-in-cocoa-thread 1625 (send (slot-value document 'textstorage) 'begin-editing)1626 #-all-in-cocoa-thread1627 1635 (send (slot-value document 'textstorage) 1628 1636 :perform-selector-on-main-thread … … 1637 1645 1638 1646 (defun hi::document-end-editing (document) 1647 #-all-in-cocoa-thread 1648 (send (slot-value document 'textstorage) 'end-editing) 1639 1649 #+all-in-cocoa-thread 1640 (send (slot-value document 'textstorage) 'end-editing)1641 #-all-in-cocoa-thread1642 1650 (send (slot-value document 'textstorage) 1643 1651 :perform-selector-on-main-thread … … 1788 1796 (let* ((sf (send f 'screen-font))) 1789 1797 (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)))))) 1792 1804 1793 1805 … … 1804 1816 (when (send scrollview 'has-vertical-scroller) 1805 1817 (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|#)) 1807 1819 (when (send scrollview 'has-horizontal-scroller) 1808 1820 (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|#)) 1810 1822 (slet ((sv-size 1811 1823 (send (@class ns-scroll-view) … … 2038 2050 (send controller 'release) 2039 2051 (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+)) 2041 2054 (or *next-editor-y-pos* 2042 *initial-editor-y-pos*)))) 2055 (float *initial-editor-y-pos* 2056 +cgfloat-zero+))))) 2043 2057 (slet ((new-point (send window 2044 2058 :cascade-top-left-from-point current-point)))
Note:
See TracChangeset
for help on using the changeset viewer.
