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)
(let ((layout (lambda (p) (layout-process num-cols p))))
(make-select-list
(zip processes (map layout processes))
(zip
processes
(map (lambda (p) #t) processes)
(map layout processes))
num-lines)))
(define (pps-receiver message)

View File

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