make selection-list distinguish markable and unmarkable items

This commit is contained in:
eknauel 2005-05-25 11:43:46 +00:00
parent 83909af4ac
commit cbf39ba61e
2 changed files with 19 additions and 11 deletions

View File

@ -35,7 +35,10 @@
(define (make-process-selection-list num-cols num-lines processes) (define (make-process-selection-list num-cols num-lines processes)
(let ((layout (lambda (p) (layout-process num-cols p)))) (let ((layout (lambda (p) (layout-process num-cols p))))
(make-select-list (make-select-list
(zip processes (map layout processes)) (zip
processes
(map (lambda (p) #t) processes)
(map layout processes))
num-lines))) num-lines)))
(define (pps-receiver message) (define (pps-receiver message)

View File

@ -1,7 +1,8 @@
(define-record-type element :element (define-record-type element :element
(make-element marked? value text) (make-element markable? marked? value text)
element? element?
(marked? element-marked? set-element-marked?!) (markable? element-markable?)
(marked? element-marked?)
(value element-value) (value element-value)
(text element-text)) (text element-text))
@ -9,8 +10,8 @@
(lambda (r) (lambda (r)
`(element ,(element-marked? r) ,(element-text r)))) `(element ,(element-marked? r) ,(element-text r))))
(define (make-unmarked-element value text) (define (make-unmarked-element markable? value text)
(make-element #f value text)) (make-element markable? #f value text))
(define-record-type select-list :select-list (define-record-type select-list :select-list
(really-make-select-list elements view-index cursor-index num-lines) (really-make-select-list elements view-index cursor-index num-lines)
@ -26,11 +27,11 @@
(view-index ,(select-list-view-index r)) (view-index ,(select-list-view-index r))
(num-lines ,(select-list-num-lines r))))) (num-lines ,(select-list-num-lines r)))))
(define (make-select-list value/text-tuples num-lines) (define (make-select-list value/markable/text-tuples num-lines)
(really-make-select-list (really-make-select-list
(map (lambda (value/text) (map (lambda (value/markable/text)
(apply make-unmarked-element value/text)) (apply make-unmarked-element value/markable/text))
value/text-tuples) value/markable/text-tuples)
0 0 num-lines)) 0 0 num-lines))
(define key-m 109) (define key-m 109)
@ -62,7 +63,10 @@
(let ((el (car element.i)) (let ((el (car element.i))
(i (cadr element.i))) (i (cadr element.i)))
(cons (make-element (cons (make-element
(if (= index i) mark (element-marked? el)) (if (and (element-markable? el)
(= index i))
mark
(element-marked? el))
(element-value el) (element-value el)
(element-text el)) (element-text el))
result))) result)))
@ -100,7 +104,8 @@
(fold-right (fold-right
(lambda (el result) (lambda (el result)
(cons (cons
(make-element (element-marked? el) (make-element (element-markable? el)
(element-marked? el)
(element-value el) (element-value el)
(element-text el)) (element-text el))
result)) result))