Changeset 7476


Ignore:
Timestamp:
Oct 19, 2007, 4:22:01 AM (13 years ago)
Author:
gb
Message:

make modeline font pref work

Location:
trunk/ccl/cocoa-ide
Files:
2 edited

Legend:

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

    r7464 r7476  
    12101210
    12111211(defclass modeline-view (ns:ns-view)
    1212     ((pane :foreign-type :id :accessor modeline-view-pane))
     1212    ((pane :foreign-type :id :accessor modeline-view-pane)
     1213     (text-attributes :foreign-type :id :accessor modeline-text-attributes))
    12131214  (:metaclass ns:+ns-object))
    12141215
     
    12201221;;; full pathname) in more cases.
    12211222
    1222 (defloadvar *modeline-text-attributes* nil)
    12231223
    12241224(def-cocoa-default *modeline-font-name* :string "Courier New Bold Italic"
     
    12401240;;; used in the event dispatch mechanism,
    12411241(defun draw-modeline-string (the-modeline-view)
    1242   (let* ((pane (modeline-view-pane the-modeline-view))
    1243          (buffer (buffer-for-modeline-view the-modeline-view)))
    1244     (when buffer
    1245       ;; You don't want to know why this is done this way.
    1246       (unless *modeline-text-attributes*
    1247         (setq *modeline-text-attributes*
    1248               (create-text-attributes :color (#/blackColor ns:ns-color)
    1249                                       :font (default-font
    1250                                                 :name *modeline-font-name*
    1251                                               :size *modeline-font-size*))))
    1252       (let* ((string
    1253               (apply #'concatenate 'string
    1254                      (mapcar
    1255                       #'(lambda (field)
    1256                           (funcall (hi::modeline-field-function field)
    1257                                    buffer pane))
    1258                       (hi::buffer-modeline-fields buffer)))))
    1259         (#/drawAtPoint:withAttributes: (%make-nsstring string)
    1260                                        (ns:make-ns-point 0 0)
    1261                                        *modeline-text-attributes*)))))
     1242  (with-slots (pane text-attributes) the-modeline-view
     1243    (let* ((buffer (buffer-for-modeline-view the-modeline-view)))
     1244      (when buffer
     1245        ;; You donn't want to know why this is done this way.
     1246        (when (%null-ptr-p text-attributes)
     1247          (setq text-attributes
     1248                (create-text-attributes :color (#/blackColor ns:ns-color)
     1249                                        :font (default-font
     1250                                                  :name *modeline-font-name*
     1251                                                :size *modeline-font-size*))))
     1252        (let* ((string
     1253                (apply #'concatenate 'string
     1254                       (mapcar
     1255                        #'(lambda (field)
     1256                            (funcall (hi::modeline-field-function field)
     1257                                     buffer pane))
     1258                        (hi::buffer-modeline-fields buffer)))))
     1259          (#/drawAtPoint:withAttributes: (%make-nsstring string)
     1260                                         (ns:make-ns-point 0 0)
     1261                                         text-attributes))))))
    12621262
    12631263;;; Draw the underlying buffer's modeline string on a white background
  • trunk/ccl/cocoa-ide/cocoa-prefs.lisp

    r7440 r7476  
    8989    (when (is-fixed-pitch-font f)
    9090      (let* ((values (#/values (#/sharedUserDefaultsController ns:ns-user-defaults-controller))))
    91         (#/setValue:forKey: values (#/fontName f) #@"modelineFontName:")
     91        (#/setValue:forKey: values (#/fontName f) #@"modelineFontName")
    9292        (#/setValue:forKey: values (#/stringWithFormat: ns:ns-string #@"%u" (round (#/pointSize f))) #@"modelineFontSize")))))
    9393
Note: See TracChangeset for help on using the changeset viewer.