Skip to content

Commit

Permalink
viewer add select all and copy to report frames
Browse files Browse the repository at this point in the history
  • Loading branch information
tgbugs committed Apr 4, 2024
1 parent 4da70de commit e72dc4c
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions sparcur_internal/sparcur/viewer.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -1661,6 +1661,9 @@ switch to that"
(define (k-export-dataset receiver event)
(export-current-dataset))

(define (k-next-thing r e)
"do nothing")

(define (backward-kill-word receiver event)
(when (eq? receiver text-search-box)
(let* ([ed (send receiver get-editor)]
Expand All @@ -1673,8 +1676,18 @@ switch to that"
; delete from epos to the backward word break
)))

(define (k-next-thing r e)
"do nothing")
(define (cb-select-all obj e)
(when (is-a? obj editor-canvas%)
(send (send obj get-editor) select-all)))

(define (cb-copy-value obj e)
; TODO proper chaining
(when (is-a? obj json-hierlist%)
(let* ([raw-value (node-data-value (send (send obj get-selected) user-data))]
[value (*->string raw-value)])
(send the-clipboard set-clipboard-string value (current-milliseconds))))
(when (is-a? obj editor-canvas%)
(send (send obj get-editor) copy)))

; add functions
(send* keymap
Expand All @@ -1684,12 +1697,7 @@ switch to that"
(add-function "export-dataset" k-export-dataset)
(add-function "quit" k-quit)
(add-function "test-backspace" (λ (a b) (displayln (format "delete all the things! ~a ~a" a b))))
(add-function "copy-value" (λ (obj event)
; TODO proper chaining
(when (is-a? obj json-hierlist%)
(let* ([raw-value (node-data-value (send (send obj get-selected) user-data))]
[value (*->string raw-value)])
(send the-clipboard set-clipboard-string value (current-milliseconds))))))
(add-function "copy-value" cb-copy-value)
(add-function "backward-kill-word" backward-kill-word)
(add-function "next-thing" k-next-thing)
(add-function "focus-search-box" (λ (a b) (send text-search-box focus)))
Expand Down Expand Up @@ -1718,6 +1726,7 @@ switch to that"
#;
(map-function "c:r" "refresh-datasets")
(map-function (fox "c:c") "copy-value") ; FIXME osx cmd:c
(map-function "c:a" "select-all")
(map-function "c:t" "test")
(map-function "f5" "fetch-export-dataset")
(map-function "c:t" "fetch-dataset")
Expand Down

0 comments on commit e72dc4c

Please sign in to comment.