Changeset 12151


Ignore:
Timestamp:
May 28, 2009, 6:11:43 PM (10 years ago)
Author:
rme
Message:

Lose the gradient in the modeline.

File:
1 edited

Legend:

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

    r12149 r12151  
    15181518;;; Modeline-view
    15191519
    1520 ;;; The modeline view is embedded in the horizontal scroll bar of the
    1521 ;;; scrollview which surrounds the textview in a pane.  (A view embedded
    1522 ;;; in a scrollbar like this is sometimes called a "placard").  Whenever
    1523 ;;; the view's invalidated, its drawRect: method draws a string containing
    1524 ;;; the current values of the buffer's modeline fields.
    1525 
    1526 (defparameter *modeline-grays* #(255 255 253 247 242 236 231
    1527                                  224 229 234 239 245 252 255))
    1528 
    1529 (defparameter *modeline-height* 14)
    1530 (defloadvar *modeline-pattern-image* nil)
    1531 
    1532 (defun create-modeline-pattern-image ()
    1533   (let* ((n (length *modeline-grays*)))
    1534     (multiple-value-bind (samples-array samples-macptr)
    1535         (make-heap-ivector n '(unsigned-byte 8))
    1536       (dotimes (i n)
    1537         (setf (aref samples-array i) (aref *modeline-grays* i)))
    1538       (rlet ((p :address samples-macptr))
    1539         (let* ((rep (make-instance 'ns:ns-bitmap-image-rep
    1540                                    :with-bitmap-data-planes p
    1541                                    :pixels-wide 1
    1542                                    :pixels-high n
    1543                                    :bits-per-sample 8
    1544                                    :samples-per-pixel 1
    1545                                    :has-alpha #$NO
    1546                                    :is-planar #$NO
    1547                                    :color-space-name #&NSDeviceWhiteColorSpace
    1548                                    :bytes-per-row 1
    1549                                    :bits-per-pixel 8))
    1550                (image (make-instance 'ns:ns-image
    1551                                      :with-size (ns:make-ns-size 1 n))))
    1552           (#/addRepresentation: image rep)
    1553           (#/release rep)
    1554           (setf *modeline-pattern-image* image))))))
    1555 
    15561520(defclass modeline-view (ns:ns-view)
    15571521    ((pane :foreign-type :id :accessor modeline-view-pane)
     
    15611525(objc:defmethod #/initWithFrame: ((self modeline-view) (frame :<NSR>ect))
    15621526  (call-next-method frame)
    1563   (unless *modeline-pattern-image*
    1564     (create-modeline-pattern-image))
    15651527  (let* ((size (#/smallSystemFontSize ns:ns-font))
    15661528         (font (#/systemFontOfSize: ns:ns-font size))
     
    16021564         (context (#/currentContext ns:ns-graphics-context)))
    16031565    (#/saveGraphicsState context)
    1604     (ns:with-ns-point (p0 0 (ns:ns-rect-height bounds))
    1605       (let ((p1 (#/convertPoint:toView: self p0 +null-ptr+)))
    1606         (#/setPatternPhase: context p1)))
    1607     (#/set (#/colorWithPatternImage: ns:ns-color *modeline-pattern-image*))
     1566    (#/set (#/colorWithCalibratedWhite:alpha: ns:ns-color 0.9 1.0))
    16081567    (#_NSRectFill bounds)
    16091568    (#/set (#/colorWithCalibratedWhite:alpha: ns:ns-color 0.3333 1.0))
     
    16131572                        (ns:ns-rect-width bounds) (- (ns:ns-rect-height bounds) 0.5))
    16141573      (#_NSRectFill r))
    1615     (#/set (#/blackColor ns:ns-color))
    16161574    (draw-modeline-string self)
    16171575    (#/restoreGraphicsState context)))
     
    18531811        (#/setAutoresizingMask: modeline #$NSViewWidthSizable)
    18541812        (#/addSubview: pane modeline)
     1813        (#/release modeline)
    18551814        (setf (slot-value pane 'mode-line) modeline
    18561815              (slot-value modeline 'pane) pane))
Note: See TracChangeset for help on using the changeset viewer.