simplify buttons file

dev-srcloc
Matthew Butterick 8 years ago
parent 093ac69a6a
commit 73341bb5a2

@ -1,17 +1,18 @@
#lang br #lang br
(require racket/draw) (require racket/draw)
(provide make-buttons) (provide make-button)
(define make-buttons (define label "Insert expression")
(list (let ([label "Insert expression"] (define bitmap (make-object bitmap% 16 16))
[bitmap (make-object bitmap% 16 16)] (define (callback drr-frame)
[callback (λ (drr-frame) (define drr-editor (send drr-frame get-definitions-text))
(define drr-editor (send drr-frame get-definitions-text)) (define block-string "@$ $@")
(define block-string "@$ $@") (send drr-editor begin-edit-sequence)
(send drr-editor begin-edit-sequence) (send drr-editor insert block-string)
(send drr-editor insert block-string) (send drr-editor end-edit-sequence)
(send drr-editor end-edit-sequence) (define pos (send drr-editor get-end-position))
(define pos (send drr-editor get-end-position)) (send drr-editor set-position (- pos (/ (string-length block-string) 2))))
(send drr-editor set-position (- pos (/ (string-length block-string) 2))))] (define number 98)
[number 98])
(list label bitmap callback number)))) (define make-button
(list (list label bitmap callback number)))

@ -10,7 +10,7 @@
[(drracket:indentation) [(drracket:indentation)
(dynamic-require 'br/demo/jsonic-2/indenter 'indent-jsonic)] (dynamic-require 'br/demo/jsonic-2/indenter 'indent-jsonic)]
[(drracket:toolbar-buttons) [(drracket:toolbar-buttons)
(dynamic-require 'br/demo/jsonic-2/buttons 'make-buttons)] (dynamic-require 'br/demo/jsonic-2/buttons 'make-button)]
[else default])) [else default]))
handle-query)) handle-query))

Loading…
Cancel
Save