Changeset 5885


Ignore:
Timestamp:
Feb 10, 2007, 9:30:37 PM (18 years ago)
Author:
Gary Byers
Message:

Need to ensure that floats are CG-FLOATs when appropriate; other changes
for 64-bit platforms, Objc-2.0.

Location:
trunk/ccl/examples
Files:
3 edited

Legend:

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

    r5732 r5885  
    521521                        buffer))))
    522522
    523 (define-objc-method ((:id :attributes-at-index (#+apple-objc-2.0 :<NSUI>nteger
    524                                                 #-apple-objc-2.0 :unsigned index)
     523(define-objc-method ((:id :attributes-at-index (:<NSUI>nteger index)
    525524                          :effective-range ((* :<NSR>ange) rangeptr))
    526525                     hemlock-text-storage)
     
    816815                                   (- index (mark-absolute-position m2)))
    817816                             (return-from HANDLED nil))))))))))))
    818     (objc-message-send-super-stret r (super) "selectionRangeForProposedRange:granularity:"
    819                                    :<NSR>ange proposed
    820                                    :<NSS>election<G>ranularity g)
     817    (send-super/stret r
     818                      :selection-range-for-proposed-range proposed
     819                      :granularity g)
    821820    #+debug
    822821    (#_NSLog #@"range = %@, proposed = %@, granularity = %d"
     
    10601059           (let* ((modeline-width (* (pref modeline-frame
    10611060                                           :<NSR>ect.size.width)
    1062                                      0.75e0)))
    1063              (declare (single-float modeline-width))
     1061                                     0.75f0)))
     1062             (declare (type cg-float single-float modeline-width))
    10641063             (setf (pref modeline-frame :<NSR>ect.size.width)
    10651064                   modeline-width
    1066                    (the single-float
     1065                   (the cg-float
    10671066                     (pref scrollbar-frame :<NSR>ect.size.width))
    1068                    (- (the single-float
     1067                   (- (the cg-float
    10691068                        (pref scrollbar-frame :<NSR>ect.size.width))
    10701069                      modeline-width)
    1071                    (the single-float
     1070                   (the cg-float
    10721071                     (pref scrollbar-frame :<NSR>ect.origin.x))
    1073                    (+ (the single-float
     1072                   (+ (the cg-float
    10741073                        (pref scrollbar-frame :<NSR>ect.origin.x))
    10751074                      modeline-width))
     
    11321131        (send pane :set-box-type #$NSBoxPrimary)
    11331132        (send pane :set-border-type #$NSNoBorder)
    1134         (send pane :set-content-view-margins (ns-make-size *text-pane-margin-width* *text-pane-margin-height*))
     1133        (send pane :set-content-view-margins (ns-make-size (float *text-pane-margin-width* +cgfloat-zero+) (float *text-pane-margin-height* +cgfloat-zero+)))
    11351134        (send pane :set-title-position #$NSNoTitle))
    11361135      pane))
     
    11381137
    11391138(defun make-scrolling-text-view-for-textstorage (textstorage x y width height tracks-width color)
    1140   (slet ((contentrect (ns-make-rect x y width height)))
     1139  (slet ((contentrect (ns-make-rect
     1140                       (float x +cgfloat-zero+)
     1141                       (float y +cgfloat-zero+)
     1142                       (float width +cgfloat-zero+)
     1143                       (float height +cgfloat-zero+))))
    11411144    (let* ((scrollview (send (make-objc-instance
    11421145                              'modeline-scroll-view
     
    12501253
    12511254(defun make-echo-area (hemlock-frame x y width height gap-context color)
    1252   (slet ((frame (ns-make-rect x y width height)))
     1255  (slet ((frame (ns-make-rect (float x +cgfloat-zero+)
     1256                              (float y +cgfloat-zero+)
     1257                              (float width +cgfloat-zero+)
     1258                              (float height +cgfloat-zero+))))
    12531259    (let* ((box (make-objc-instance "NSView"
    12541260                                    :with-frame frame)))
     
    14621468  (let* ((window-content-view (send w 'content-view)))
    14631469    (slet ((window-frame (send window-content-view 'frame)))
    1464       (slet ((pane-rect (ns-make-rect 0.0f0
    1465                                       reserve-below
     1470      (slet ((pane-rect (ns-make-rect +cgfloat-zero+
     1471                                      (float reserve-below +cgfloat-zero+)
    14661472                                      (pref window-frame :<NSR>ect.size.width)
    14671473                                      (- (pref window-frame :<NSR>ect.size.height) (+ reserve-above reserve-below)))))
     
    18101816         (width (fceiling (* ncols char-width)))
    18111817         (scrollview (text-pane-scroll-view pane))
    1812          (window (send scrollview 'window)))
     1818         (window (send scrollview 'window))
     1819         (has-horizontal-scroller (send scrollview 'has-horizontal-scroller))
     1820         (has-vertical-scroller (send scrollview 'has-vertical-scroller)))
     1821    (format t "~& width = ~s, height = ~s" width height)
    18131822    (rlet ((tv-size :<NSS>ize :height height
    18141823                    :width (+ width (* 2 (send (send tv 'text-container)
    18151824                                               'line-fragment-padding)))))
    1816       (when (send scrollview 'has-vertical-scroller)
     1825      (#_NSLog #@"\ntv-size = %@\n" :address (#_NSStringFromSize tv-size))
     1826     
     1827      (when has-vertical-scroller
    18171828        (send scrollview :set-vertical-line-scroll char-height)
    18181829        (send scrollview :set-vertical-page-scroll +cgfloat-zero+ #|char-height|#))
    1819       (when (send scrollview 'has-horizontal-scroller)
     1830      (when has-horizontal-scroller
    18201831        (send scrollview :set-horizontal-line-scroll char-width)
    18211832        (send scrollview :set-horizontal-page-scroll +cgfloat-zero+ #|char-width|#))
     
    18231834              (send (@class ns-scroll-view)
    18241835                    :frame-size-for-content-size tv-size
    1825                     :has-horizontal-scroller
    1826                     (send scrollview 'has-horizontal-scroller)
    1827                     :has-vertical-scroller
    1828                     (send scrollview 'has-vertical-scroller)
     1836                    :has-horizontal-scroller has-horizontal-scroller
     1837                    :has-vertical-scroller has-vertical-scroller
    18291838                    :border-type (send scrollview 'border-type))))
     1839        (#_NSLog #@"\na: sv-size = %@\n" :address (#_NSStringFromSize sv-size))
    18301840        (slet ((pane-frame (send pane 'frame))
    18311841               (margins (send pane 'content-view-margins)))
     
    18351845          (incf (pref sv-size :<NSS>ize.width)
    18361846                (pref margins :<NSS>ize.width))
     1847          (#_NSLog #@"\nb: sv-size = %@\n" :address (#_NSStringFromSize sv-size))
    18371848          (send window :set-content-size sv-size)
    18381849          (send window :set-resize-increments
     
    18621873(defmethod textview-background-color ((doc hemlock-editor-document))
    18631874  (send (find-class 'ns:ns-color)
    1864         :color-with-calibrated-red *editor-background-red-component*
    1865         :green *editor-background-green-component*
    1866         :blue *editor-background-blue-component*
    1867         :alpha *editor-background-alpha-component*))
     1875        :color-with-calibrated-red (float *editor-background-red-component*
     1876                                          +cgfloat-zero+)
     1877        :green (float *editor-background-green-component* +cgfloat-zero+)
     1878        :blue (float *editor-background-blue-component* +cgfloat-zero+)
     1879        :alpha (float *editor-background-alpha-component* +cgfloat-zero+)))
    18681880
    18691881
  • trunk/ccl/examples/cocoa-prefs.lisp

    r5731 r5885  
    148148(define-objc-method ((:id :init-with-frame (:<NSR>ect frame))
    149149                     prefs-view)
    150     (send-super :init-with-frame frame)
     150  (send-super :init-with-frame frame)
    151151  (slet ((scroll-frame (ns-make-rect (float 20.0f0 +cgfloat-zero+)
    152152                                     (float 40.0f0 +cgfloat-zero+)
     
    211211         (let* ((panel (new-cocoa-window :class self
    212212                                         :title "Preferences"
    213                                          :activate nil)))
    214            (slet ((bounds (send (send panel 'content-view) 'bounds)))
     213                                         :activate nil))
     214                (view (send panel 'content-view)))
     215           (slet ((bounds (send view 'bounds)))
    215216             (let* ((v (make-instance 'prefs-view :with-frame bounds)))
    216217               (send panel :set-content-view v)
  • trunk/ccl/examples/cocoa-typeout.lisp

    r1178 r5885  
    4747    (slet* ((contentsize (send scrollview 'content-size))
    4848            (text-frame (ns-make-rect
    49                          0.0f0
    50                          0.0f0
     49                         +cgfloat-zero+
     50                         +cgfloat-zero+
    5151                         (pref contentsize :<NSS>ize.width)
    5252                         (pref contentsize :<NSS>ize.height))))
     
    7777                                         :width 600
    7878                                         :activate nil)))
    79            (rlet ((size :<NSS>ize :width 600.0f0 :height 10000.0f0))
     79           (rlet ((size :<NSS>ize
     80                    :width (float 600.0f0 +cgfloat-zero+)
     81                    :height (float 10000.0f0 +cgfloat-zero+)))
    8082                 (send panel :set-max-size size)
    81                  (setf (pref size :<NSS>ize.height) 1.0f0)
     83                 (setf (pref size :<NSS>ize.height) (float 1.0f0 +cgfloat-zero+))
    8284                 (send panel :set-min-size size))
    8385           (slet ((bounds (send (send panel 'content-view) 'bounds)))
Note: See TracChangeset for help on using the changeset viewer.