use `m' and `u' for selecting/unselecting items

This commit is contained in:
eknauel 2005-05-17 09:56:11 +00:00
parent 0a2c373bc0
commit f649bb93cc
1 changed files with 107 additions and 122 deletions

View File

@ -12,6 +12,8 @@
;;If the given path does not exist you will not be able to navigate!
(define key-m 109)
(define key-u 117)
(define-record-type browse-dir-list-res-obj browse-dir-list-res-obj
(make-browse-dir-list-res-obj pos-y
@ -192,10 +194,10 @@
(key (key-pressed-message-key message))
(c-x-pressed (browse-dir-list-res-obj-c-x-pressed model)))
(if c-x-pressed
(cond
;;Ctrl+x s -> Auswahl
((= key 115)
;; user pressed 'm' --- mark current entry
((= key key-m)
(let* ((marked-items (browse-dir-list-res-obj-marked-items model))
(res-marked-items (browse-dir-list-res-obj-res-marked-items
model))
@ -206,7 +208,7 @@
(let ((actual-item (list-ref all-items (- actual-pos 3)))
(actual-res-item #f))
(begin
(if (not (equal? (cwd) "/"))
(if (not (string=? (cwd) "/"))
(set! actual-res-item (string-append (cwd) "/" actual-item))
(set! actual-res-item (string-append "/" actual-item)))
(if (member actual-res-item marked-items)
@ -233,8 +235,8 @@
#f)))
new-model)))))))
;;Ctrl+x u -> unselect
((= key 117)
;; user pressed 'u' --- unmark current entry
((= key key-u)
(let* ((marked-items (browse-dir-list-res-obj-marked-items model))
(res-marked-items (browse-dir-list-res-obj-res-marked-items
model))
@ -281,37 +283,6 @@
new-res-marked-items
#f)))
new-model))))))
(else
(make-browse-dir-list-res-obj
(browse-dir-list-res-obj-pos-y model)
(browse-dir-list-res-obj-pos-x model)
(browse-dir-list-res-obj-file-list model)
(browse-dir-list-res-obj-result-text model)
(browse-dir-list-res-obj-working-directory
model)
(browse-dir-list-res-obj-width model)
(browse-dir-list-res-obj-initial-wd model)
(browse-dir-list-res-obj-marked-items model)
(browse-dir-list-res-obj-res-marked-items
model)
(not c-x-pressed))))
(cond
;;c-x
((= key 24)
(make-browse-dir-list-res-obj
(browse-dir-list-res-obj-pos-y model)
(browse-dir-list-res-obj-pos-x model)
(browse-dir-list-res-obj-file-list model)
(browse-dir-list-res-obj-result-text model)
(browse-dir-list-res-obj-working-directory
model)
(browse-dir-list-res-obj-width model)
(browse-dir-list-res-obj-initial-wd model)
(browse-dir-list-res-obj-marked-items model)
(browse-dir-list-res-obj-res-marked-items
model)
(not c-x-pressed)))
((= key key-up)
(let ((posy (browse-dir-list-res-obj-pos-y model)))
@ -358,9 +329,23 @@
((= key 10)
(selected-browse-dir-list model))
;; user pressed C-x
((= key 24)
(make-browse-dir-list-res-obj
(browse-dir-list-res-obj-pos-y model)
(browse-dir-list-res-obj-pos-x model)
(browse-dir-list-res-obj-file-list model)
(browse-dir-list-res-obj-result-text model)
(browse-dir-list-res-obj-working-directory
model)
(browse-dir-list-res-obj-width model)
(browse-dir-list-res-obj-initial-wd model)
(browse-dir-list-res-obj-marked-items model)
(browse-dir-list-res-obj-res-marked-items
model)
(not c-x-pressed)))
(else model)))))
(else model))))
((restore-message? message)