Changeset main,53 for main


Ignore:
Timestamp:
11/15/2007 09:11:06 PM (19 years ago)
Author:
David Owen <dsowen@…>
branch-nick:
tui
revision id:
dsowen@fugue88.ws-20071115211106-ix3zpfhce07h8wg8
Message:

Updated grid.

Location:
main/grid
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/grid/display.lisp

    r39 r53  
    1616  (make-instance 'grid
    1717                 :data data
    18                  :column-widths column-widths
     18                 :column-widths (coerce column-widths 'vector)
    1919                 :header-rows header-rows
    2020                 :header-columns header-columns
     
    6262    (let ((text (item grid row column))
    6363          (x (column-offset grid column)))
    64       (cdk::move-and-add-string main-window row x text))))
     64      (move-and-add-string main-window row x text))))
    6565
    6666(defun draw-header-top-item (grid row column)
     
    6868    (let ((text (item grid row column))
    6969          (x (column-offset grid column)))
    70       (cdk::move-and-add-string main-window row x text))))
     70      (move-and-add-string main-window row x text))))
    7171
    7272(defun draw-item (grid row column)
     
    7676          (y (+ row y-scroll)))
    7777      (let ((x (+ column-offset x-scroll)))
    78         (cdk::move-and-add-string window y x text)))))
     78        (move-and-add-string window y x text)))))
    7979
    8080;;;; ------------------------------------------------- ;;;;
     
    9191    (dotimes (i header-rows)
    9292      (draw-cell grid i column i x))
    93     (dotimes (i (- (cdk::getmaxy window) header-rows))
     93    (dotimes (i (- (size window) header-rows))
    9494      (let* ((y (+ i header-rows))
    9595             (row (+ y row-scroll)))
     
    100100(defun draw (grid)
    101101  (with-slots (data column-widths header-columns window column-scroll) grid
    102     (cdk::c-erase-window window)
     102    (erase window)
    103103    (let ((x 0))
    104104      (dotimes (i header-columns)
     
    107107      (do ((i (+ header-columns column-scroll) (incf i)))
    108108          ((or (>= i (columns data))
    109                (> x (cdk::getmaxx window))))
     109               (> x (nth-value 1 (size window)))))
    110110        (draw-column grid i x)
    111111        (incf x (svref column-widths i))))))
     
    115115(defmethod max-row-scroll ((grid grid))
    116116  (with-slots (data header-rows window) grid
    117     (max 0 (- (rows data) (cdk::getmaxy window)))))
     117    (max 0 (- (rows data) (size window)))))
    118118
    119119(defmethod (setf row-scroll) :around (i (grid grid))
  • main/grid/package.lisp

    r28 r53  
    11(defpackage #:grid
    2   (:use #:cl #:dso-util #:tui-display-string)
     2  (:use #:cl #:dso-util #:tui-display-string #:tui-output #:tui-window)
    33  (:export #:rows #:columns #:item #:uses-display-strings #:row-scroll
    44           #:column-scroll #:make-grid #:draw))
  • main/grid/test.lisp

    r26 r53  
    11(defpackage #:grid-test
    2   (:use #:cl #:cdk #:grid #:input)
     2  (:use #:cl #:cdk #:grid #:tui-input #:tui-output #:tui-window)
    33  (:export))
    44
     
    3030
    3131(defun clear (screen)
    32   (cdk::c-erase-window screen)
    33   (cdk::c-refresh-window screen))
     32  (erase screen)
     33  (refresh screen))
    3434
    3535(defun test-draw ()
     
    3838    (with-screen (screen)
    3939      (clear screen)
    40       (with-der-window (window screen 5 16 0 0)
     40      (with-subwindow (window screen 5 16 0 0)
    4141        (let ((grid (make-grid window data widths :header-columns 1 :header-rows 1)))
    4242          (flet ((try (i)
    4343                   (setf (row-scroll grid) i)
    4444                   (draw grid)
    45                    (input:%wget-wch window)))
     45                   (read-key window)))
    4646            (try 0)
    4747            (try 2)
     
    5151                   (setf (column-scroll grid) i)
    5252                   (draw grid)
    53                    (input:%wget-wch window)))
     53                   (read-key window)))
    5454            (try 3)
    5555            (try 99))))
     
    5757      (let ((grid (make-grid screen data widths :header-columns 1 :header-rows 1)))
    5858        (draw grid)
    59         (input:%wget-wch screen)))))
     59        (read-key screen)))))
Note: See TracChangeset for help on using the changeset viewer.