Changeset main,26 for main


Ignore:
Timestamp:
11/03/2007 05:27:59 PM (19 years ago)
Author:
David Owen <dsowen@…>
branch-nick:
tui
revision id:
dsowen@fugue88.ws-20071103172759-aacwcew0kzliob1n
Message:

Grid now uses display strings.

Location:
main/grid
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • main/grid/display.lisp

    r22 r26  
    8181
    8282(defun draw-cell (grid row column y x)
    83   (with-slots (window) grid
    84     (cdk::move-and-add-string window y x (item grid row column))))
     83  (with-slots (data window) grid
     84    (let ((text (item data row column)))
     85      (unless (uses-display-strings data row column)
     86        (setf text (enquote text)))
     87      (render text window y x))))
    8588
    8689(defun draw-column (grid column x)
  • main/grid/model.lisp

    r22 r26  
    3636column COLUMN.  ROW and COLUMN refer to data rows and columns, not
    3737character or text rows and columns.  Rows and columns are zero-based."))
     38
     39(defgeneric uses-display-strings (grid-data row column)
     40  (:documentation
     41   "Returns T if the item uses display-strings, or at least has
     42already been properly escaped.")
     43  (:method (grid-data row column)))
  • main/grid/package.lisp

    r22 r26  
    11(defpackage #:grid
    2   (:use #:cl #:dso-util)
    3   (:export #:rows #:columns #:item #:row-scroll #:column-scroll #:make-grid
    4            #:draw))
     2  (:use #:cl #:display-string #:dso-util)
     3  (:export #:rows #:columns #:item #:uses-display-strings #:row-scroll
     4           #:column-scroll #:make-grid #:draw))
  • main/grid/test.lisp

    r22 r26  
    1818  (cond
    1919    ((= row 0)
    20      (string (aref "*ABCDEFGHI" column)))
     20     (concatenate 'string "`B`U " (string (aref "*ABCDEFGHI" column)) " `u`b"))
    2121    ((= column 0)
    22      (format nil "~A" row))
     22     (format nil " `B~A`b " row))
    2323    (t
    24      (format nil "~A,~A" row column))))
     24     (format nil (if (= row column 2) "`R~A,~A`r" "~A,~A") row column))))
     25
     26(defmethod uses-display-strings ((gd test) row column)
     27  t)
    2528
    2629
     
    3538    (with-screen (screen)
    3639      (clear screen)
    37       (with-der-window (window screen 5 17 0 0)
     40      (with-der-window (window screen 5 16 0 0)
    3841        (let ((grid (make-grid window data widths :header-columns 1 :header-rows 1)))
    3942          (flet ((try (i)
Note: See TracChangeset for help on using the changeset viewer.