145 lines
4.8 KiB
Plaintext
145 lines
4.8 KiB
Plaintext
[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]
|
|
|
|
_name-message.ss_
|
|
|
|
[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]
|
|
|
|
|
|
The _name-message%_ class is derived from canvas%. It
|
|
overrides the on-paint and on-event methods to draw the name
|
|
of a file and handle clicks to popup a menu for choosing a
|
|
directory.
|
|
|
|
> (send a-name-message set-message file-name? msg)
|
|
|
|
file-name? : boolean
|
|
msg : string
|
|
|
|
If file-name? is #t, msg is treated like a pathname and
|
|
clicks on the name message objects popup a menu that opens a
|
|
get-file dialog.
|
|
|
|
If file-name is #f, msg is treated as a regular
|
|
string. Clicking on the name message pops up a dialog saying
|
|
that there is no file name until the file is saved.
|
|
|
|
> (send a-name-message on-choose-directory dir)
|
|
|
|
dir : string
|
|
|
|
This method is called when one of the popup menu items is
|
|
chosen. The argument is a string representing the specified
|
|
directory.
|
|
|
|
============================================================
|
|
|
|
> (calc-button-min-sizes dc string)
|
|
|
|
Calculates the minimum width and height of a button label
|
|
(when drawn with draw-button-label). Returns two values: the
|
|
width and height.
|
|
|
|
============================================================
|
|
|
|
> (draw-frame-button-label dc label width height inverted)
|
|
|
|
Draws a button label like the one for the (define ...) and
|
|
filename buttons in the top-left corner of the DrScheme
|
|
|
|
frame. Use this function to draw similar buttons. The basic
|
|
idea is to create a canvas object whose on-paint method is
|
|
overridden to call this function. The dc should be canvas's
|
|
dc object, the label should be the string to display on the
|
|
button. The width and height arguments should be the width
|
|
and height of the button and inverted? should be #t when the
|
|
button is being depressed.
|
|
|
|
See calc-button-min-sizes for help calculating the min sizes
|
|
of the button.
|
|
|
|
|
|
|
|
[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]
|
|
|
|
_plot.ss_
|
|
|
|
[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]
|
|
|
|
plot.ss provides a simple tool for plotting data values to a
|
|
device context.
|
|
|
|
|
|
Two structures are provided:
|
|
===========================================================
|
|
> (struct data-set ((points (listof (is-a?/c point%)))
|
|
(connected? any?)
|
|
(pen (is-a?/c pen%))
|
|
(min-x number?)
|
|
(max-x number?)
|
|
(min-y number?)
|
|
(max-y number?)))
|
|
|
|
points: the list of data values.
|
|
connected: determines whether the points are connected by a line or not.
|
|
pen: the pen% to draw the points/lines with.
|
|
min-x, max-x, min-y, max-y: indicate the window coordinates that the
|
|
data should be drawn in.
|
|
|
|
===========================================================
|
|
|
|
> (struct plot-setup ((axis-label-font (is-a?/c font%))
|
|
(axis-number-font (is-a?/c font%))
|
|
(axis-pen (is-a?/c pen%))
|
|
(grid? any?)
|
|
(grid-pen (is-a?/c pen%))
|
|
(x-axis-marking (listof number?))
|
|
(y-axis-marking (listof number?))
|
|
(x-axis-label string?)
|
|
(y-axis-label string?)))
|
|
|
|
axis-label-font: the font% the axis-labels is drawn with.
|
|
axis-number-font: the font% the numbering on the axes is
|
|
drawn with.
|
|
axis-pen: the pen% the axis is drawn with.
|
|
grid?: whether a grid should be drawn in at each axis marking.
|
|
grid-pen: the pen% to draw the grid with.
|
|
x-axis-marking: where marks should be placed on the x-axis.
|
|
y-axis-marking: where marks should be placed on the y-axis.
|
|
x-axis-label-string: the x-axis label.
|
|
y-axis-label-string: the y-axis label.
|
|
|
|
===========================================================
|
|
|
|
One function is provided:
|
|
===========================================================
|
|
> (plot (is-a?/c dc<%>) (listof data-set?) plot-setup?)
|
|
|
|
Draws the data-sets on the dc<%> configured by the setup.
|
|
Uses window coordinates that will accommodate all of the
|
|
data sets.
|
|
|
|
[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]
|
|
|
|
_include-bitmap.ss_
|
|
|
|
[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]
|
|
|
|
The include-bitmap.ss library provides a `include-bitmap form that
|
|
takes a filename containing a bitmap and "inlines" the bitmap into the
|
|
program. The advantage of "inlining" the bitmap is that a stand-alone
|
|
executable can be created that contains the bitmap and does not refer
|
|
to the original image file.
|
|
|
|
> (include-bitmap file-spec) SYNTAX
|
|
> (include-bitmap file-spec type-expr) SYNTAX
|
|
|
|
The `file-spec' is the same as for MzLib's `include': a path string, a
|
|
`build-path' form, or a `lib' form. The `type-expr' should produce
|
|
'unknown, 'unknown/mask, etc., and the default is 'unknown/mask.
|
|
|
|
> (include-bitmap/relative-to source file-spec) SYNTAX
|
|
> (include-bitmap/relative-to source file-spec type-expr) SYNTAX
|
|
|
|
Analogous to `include-at/relative-to', though only a source is needed
|
|
(no context).
|