Changeset main,55 for main/grid/display.lisp
- Timestamp:
- 11/16/2007 04:52:26 PM (19 years ago)
- branch-nick:
- tui
- revision id:
- dsowen@fugue88.ws-20071116165226-urvzht93m31b4n1t
- File:
-
- 1 edited
-
main/grid/display.lisp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
main/grid/display.lisp
r53 r55 5 5 (defclass grid () 6 6 ((data :initarg :data) 7 (column-widths :type (vector (integer 1)) :initarg :column-widths)8 7 (header-rows :type (integer 0) :initarg :header-rows) 9 8 (header-columns :type (integer 0) :initarg :header-columns) … … 12 11 (column-scroll :type (integer 0) :initform 0 :accessor column-scroll))) 13 12 14 (defun make-grid (window data column-widths 15 &key (header-rows 0) (header-columns 0)) 13 (defun make-grid (window data &key (header-rows 0) (header-columns 0)) 16 14 (make-instance 'grid 17 15 :data data 18 :column-widths (coerce column-widths 'vector)19 16 :header-rows header-rows 20 17 :header-columns header-columns … … 41 38 42 39 (defun column-offset (grid column) 43 (with-slots (column-widths header-columns column-scroll) grid 44 (let ((base (+ header-columns column-scroll))) 40 (with-slots (data header-columns column-scroll) grid 41 (let ((base (+ header-columns column-scroll)) 42 (column-widths (mapcar (peval 'column-width data) 43 (range header-columns)))) 45 44 (multiple-value-bind (in-header in-data) (column-split grid column) 46 45 (let ((w1 (reduce '+ column-widths :end in-header)) … … 99 98 100 99 (defun draw (grid) 101 (with-slots (data column-widthsheader-columns window column-scroll) grid100 (with-slots (data header-columns window column-scroll) grid 102 101 (erase window) 103 102 (let ((x 0)) 104 103 (dotimes (i header-columns) 105 104 (draw-column grid i x) 106 (incf x ( svref column-widthsi)))105 (incf x (column-width data i))) 107 106 (do ((i (+ header-columns column-scroll) (incf i))) 108 107 ((or (>= i (columns data)) 109 108 (> x (nth-value 1 (size window))))) 110 109 (draw-column grid i x) 111 (incf x ( svref column-widthsi))))))110 (incf x (column-width data i)))))) 112 111 113 112
Note: See TracChangeset
for help on using the changeset viewer.
