diff --git a/gui-doc/mrlib/scribblings/image-core.scrbl b/gui-doc/mrlib/scribblings/image-core.scrbl index 767282e9..1b253c26 100644 --- a/gui-doc/mrlib/scribblings/image-core.scrbl +++ b/gui-doc/mrlib/scribblings/image-core.scrbl @@ -51,3 +51,11 @@ up an image. to short-circuit the full check. (The full check draws the two images and then compares the resulting bitmaps.) } + + +@defthing[snip-class (is-a?/c snip-class%)]{ + The snipclass used by images (which are @racket[snip%]s) created by this library. + + Not all @racket[image?] values are @racket[snip%]s, but those that are use this as + their @racket[snip-class%]. +} diff --git a/gui-doc/mrlib/scribblings/mrlib.scrbl b/gui-doc/mrlib/scribblings/mrlib.scrbl index 1aa972f8..abd2d1c2 100644 --- a/gui-doc/mrlib/scribblings/mrlib.scrbl +++ b/gui-doc/mrlib/scribblings/mrlib.scrbl @@ -21,6 +21,7 @@ @include-section["image-core.scrbl"] @include-section["matrix-snip.scrbl"] @include-section["snip-canvas.scrbl"] +@include-section["syntax-browser.scrbl"] @include-section["tex-table.scrbl"] @include-section["terminal.scrbl"] diff --git a/gui-doc/mrlib/scribblings/syntax-browser.scrbl b/gui-doc/mrlib/scribblings/syntax-browser.scrbl new file mode 100644 index 00000000..f0079af0 --- /dev/null +++ b/gui-doc/mrlib/scribblings/syntax-browser.scrbl @@ -0,0 +1,20 @@ +#lang scribble/doc +@(require "common.rkt" (for-label mrlib/image-core)) + +@title{Syntax Browser} + +@defmodule[mrlib/syntax-browser] + +@defproc[(render-syntax/snip [stx syntax?]) (is-a?/c snip%)]{ + Constructs a @racket[snip%] object that displays information + about @racket[stx]. +} + +@defproc[(render-syntax/window [stx syntax?]) void?]{ Uses + @racket[render-syntax/snip]'s result, together with a frame + and editor-canvas to show @racket[stx]. +} + +@defthing[snip-class (is-a?/c snip-class%)]{ + The snipclass used by the result of @racket[render-syntax/snip]. +} \ No newline at end of file diff --git a/gui-lib/mrlib/syntax-browser.rkt b/gui-lib/mrlib/syntax-browser.rkt index b08da8b4..df53205b 100644 --- a/gui-lib/mrlib/syntax-browser.rkt +++ b/gui-lib/mrlib/syntax-browser.rkt @@ -11,13 +11,20 @@ needed to really make this work: racket/class racket/gui/base racket/match - (prefix-in - racket/base) + racket/contract + (prefix-in : racket/base) "include-bitmap.rkt") (define orig-output-port (current-output-port)) (define (oprintf . args) (apply fprintf orig-output-port args)) - (provide render-syntax/snip render-syntax/window snip-class) + (provide + (contract-out + [render-syntax/snip + (-> syntax? (is-a?/c snip%))] + [render-syntax/window + (-> syntax? void?)]) + snip-class) ;; this is doing the same thing as the class in ;; the framework by the same name, but we don't @@ -47,7 +54,7 @@ needed to really make this work: (class snip-class% (define/override (read stream) (make-object syntax-snip% - (unmarshall-syntax (-read (open-input-bytes (send stream get-bytes)))))) + (unmarshall-syntax (:read (open-input-bytes (send stream get-bytes)))))) (super-new))) (define snip-class (new syntax-snipclass%))