first cut at splitting draw and gui docs

original commit: 694745e9985a65bbbfdf0c9853e472ee18a2476d
This commit is contained in:
Matthew Flatt 2010-11-05 21:53:36 -06:00
parent 6345035624
commit 86008d2f9a
14 changed files with 35 additions and 221 deletions

View File

@ -1,4 +1,3 @@
#lang scheme/signature
add-color<%>
@ -38,8 +37,6 @@ control<%>
current-eventspace
current-eventspace-has-menu-root?
current-eventspace-has-standard-menus?
current-ps-afm-file-paths
current-ps-cmap-file-paths
current-ps-setup
current-text-keymap-initializer
cursor%

View File

@ -4,6 +4,7 @@
namespace-anchor->empty-namespace
make-base-empty-namespace)
scheme/class
racket/draw
mzlib/etc
(prefix wx: "private/kernel.ss")
(prefix wx: "private/wxme/style.ss")
@ -101,26 +102,15 @@
add-pasteboard-keymap-functions
begin-busy-cursor
bell
bitmap%
make-bitmap
read-bitmap
make-monochrome-bitmap
brush%
brush-list%
editor-data%
editor-data-class%
editor-data-class-list<%>
check-for-break
clipboard<%>
clipboard-client%
color%
color-database<%>
control-event%
current-eventspace
current-ps-setup
cursor%
dc<%>
dc-path%
get-display-depth
end-busy-cursor
event%
@ -128,10 +118,7 @@
eventspace?
find-graphical-system-path
flush-display
font%
font-list%
font-name-directory<%>
get-highlight-background-color
get-highlight-background-color
get-highlight-text-color
get-the-editor-data-class-list
get-the-snip-class-list
@ -152,14 +139,9 @@
editor-wordbreak-map%
mouse-event%
mult-color<%>
pen%
pen-list%
point%
ps-setup%
read-editor-global-footer
read-editor-global-header
read-editor-version
region%
scroll-event%
snip%
snip-admin%
@ -181,14 +163,7 @@
yield
eventspace-shutdown?
get-panel-background
gl-context<%>
gl-config%
the-color-database
the-font-name-directory
the-font-list
the-pen-list
the-brush-list
the-style-list
the-editor-wordbreak-map
make-screen-bitmap
@ -197,9 +172,7 @@
(define the-clipboard (wx:get-the-clipboard))
(define the-x-selection-clipboard (wx:get-the-x-selection))
;; Obsolete
(define current-ps-afm-file-paths (make-parameter null))
(define current-ps-cmap-file-paths (make-parameter null))
(provide (all-from racket/draw))
(provide button%
canvas%
@ -277,13 +250,10 @@
get-top-level-edit-target-window
register-collecting-blit
unregister-collecting-blit
bitmap-dc%
post-script-dc%
printer-dc%
current-text-keymap-initializer
sleep/yield
get-window-text-extent
get-family-builtin-face
send-message-to-window
the-clipboard
the-x-selection-clipboard
@ -309,8 +279,6 @@
make-gui-namespace
make-gui-empty-namespace
file-creator-and-type
current-ps-afm-file-paths
current-ps-cmap-file-paths
hide-cursor-until-moved
system-position-ok-before-cancel?
label-string?

View File

@ -39,7 +39,7 @@
(let ([s (send (send edit get-style-list) find-named-style "Standard")])
(send s set-delta (font->delta f))))))]
[p (make-object horizontal-pane% f)]
[face (make-object list-box% #f (get-face-list) p refresh-sample)]
[face (make-object list-box% #f (wx:get-face-list) p refresh-sample)]
[p2 (make-object vertical-pane% p)]
[p3 (instantiate horizontal-pane% (p2) [stretchable-width #f])]
[style (let ([pnl (instantiate group-box-panel% ("Style" p3) [stretchable-height #f] [stretchable-width #f])])
@ -98,7 +98,7 @@
(lambda (font)
(let* ([facen (if font
(send font get-face)
(get-family-builtin-face 'default))]
(wx:get-family-builtin-face 'default))]
[f (and facen (send face find-string facen))])
(and f (>= f 0) (send face set-selection f)))
(when font

View File

@ -13,17 +13,13 @@
(provide register-collecting-blit
unregister-collecting-blit
bitmap-dc%
post-script-dc%
printer-dc%
get-window-text-extent
get-family-builtin-face
normal-control-font
small-control-font
tiny-control-font
view-control-font
menu-control-font
get-face-list)
menu-control-font)
(define register-collecting-blit
(case-lambda
@ -50,14 +46,6 @@
(check-instance 'unregister-collecting-blit canvas% 'canvas% #f canvas)
(wx:unregister-collecting-blit (mred->wx canvas))))
(define bitmap-dc%
(class100 wx:bitmap-dc% ([bitmap #f])
(inherit set-bitmap)
(sequence
(super-init)
(when bitmap
(set-bitmap bitmap)))))
(define-syntax check-page-active
(syntax-rules ()
[(_ check-page-status (id . args) ...) (begin (check-one-page-active check-page-status id args) ...)]))
@ -167,20 +155,6 @@
(super-new)))
(define post-script-dc%
(class (doc+page-check-mixin wx:post-script-dc% 'post-script-dc%)
(init [interactive #t][parent #f][use-paper-bbox #f][as-eps #t])
(check-top-level-parent/false '(constructor post-script-dc) parent)
(define is-eps? (and as-eps #t))
(define/override (multiple-pages-ok?) (not is-eps?))
(as-entry
(lambda ()
(let ([p (and parent (mred->wx parent))])
(as-exit (lambda () (super-make-object interactive p use-paper-bbox as-eps))))))))
(define printer-dc%
(class100 (doc+page-check-mixin wx:printer-dc% 'printer-dc%) ([parent #f])
(sequence
@ -199,37 +173,6 @@
(check-instance 'get-window-text-extent wx:font% 'font% #f font)
(let-values ([(w h d a) (get-window-text-extent* string font combine?)])
(values (inexact->exact (ceiling w)) (inexact->exact (ceiling h))))]))
(define ugly?
(lambda (a)
(and (positive? (string-length a))
(not (or (char-alphabetic? (string-ref a 0))
(char-numeric? (string-ref a 0))
(char=? #\- (string-ref a 0)))))))
(define compare-face-names
(lambda (a b)
(let ([a-sp? (char=? #\space (string-ref a 0))]
[b-sp? (char=? #\space (string-ref b 0))]
[a-ugly? (ugly? a)]
[b-ugly? (ugly? b)])
(cond [(eq? a-sp? b-sp?)
(cond
[(eq? a-ugly? b-ugly?)
(string-locale-ci<? a b)]
[else b-ugly?])]
[else a-sp?]))))
(define get-face-list
(case-lambda
[() (get-face-list 'all)]
[(a) (sort (wx:get-face-list a) compare-face-names)]))
(define (get-family-builtin-face family)
(unless (memq family '(default decorative roman script swiss modern system symbol))
(raise-type-error 'get-family-builtin-face "family symbol" family))
(let ([id (send wx:the-font-name-directory find-family-default-font-id family)])
(send wx:the-font-name-directory get-screen-name id 'normal 'normal)))
(define small-delta (case (system-type)
[(windows) 0]

View File

@ -6,9 +6,17 @@
scribble/decode
(for-label scheme/gui/base
scheme/base)
(for-syntax scheme/base))
(for-syntax scheme/base)
(only-in scribblings/draw/blurbs
res-sym
Resource
ResourceFirst
boxisfill
boxisfillnull
MismatchExn))
(provide (except-out (all-defined-out) p define-inline))
(provide (except-out (all-defined-out) p define-inline)
(all-from-out scribblings/draw/blurbs))
(define-syntax-rule (define-inline (name) body)
(define-syntax (name stx)
@ -193,8 +201,6 @@ information@|details|, even if the editor currently has delayed refreshing (see
@scheme[min-width], @scheme[min-height], @scheme[stretchable-width], and
@scheme[stretchable-height] arguments, see @scheme[area<%>].})
(define MismatchExn @elem{an @scheme[exn:fail:contract] exception is raised})
(define AFM @elem{Adobe Font Metrics})
(define (MonitorMethod what by-what method whatsit)
@ -244,18 +250,6 @@ information@|details|, even if the editor currently has delayed refreshing (see
(hspace 1)
(bytes->string/latin-1 name))))
(define (res-sym s)
(string->symbol (string-append "GRacket:" s)))
(define (Resource s)
@elem{@to-element[`(quote ,(res-sym s))]
preference})
(define (ResourceFirst s) ; fixme -- add index
(let ([r (Resource s)])
(index* (list (format "~a preference" (res-sym s)))
(list r)
r)))
(define (edsnipsize a b c)
@elem{An @scheme[editor-snip%] normally stretches to wrap around the size
of the editor it contains. This method @|a| of the snip
@ -269,11 +263,6 @@ information@|details|, even if the editor currently has delayed refreshing (see
"smaller"
@elem{the editor is @|b|-aligned in the snip}))
(define (boxisfill which what)
@elem{The @|which| box is filled with @|what|.})
(define (boxisfillnull which what)
@elem{The @|which| box is filled with @|what|, unless @|which| is @scheme[#f].})
(define (slant . s)
(make-element "slant" (decode-content s)))

View File

@ -3,28 +3,6 @@
@title{Fonts}
@defproc[(get-face-list [family (one-of/c 'mono 'all) 'all])
(listof string?)]{
Returns a list of font face names available on the current system. If
@scheme['mono] is provided as the argument, then only faces that are
known to correspond to monospace fonts are included in the list.
}
@defproc[(get-family-builtin-face [family (one-of/c 'default 'decorative 'roman 'script
'swiss 'modern 'symbol 'system)])
string?]{
Returns the built-in default face mapping for a particular font
family. The built-in default can be overridden via preferences, as
described in @secref["fontresources"].
See @scheme[font%] for information about @scheme[family].
}
@defthing[menu-control-font (is-a?/c font%)]{
This font is the default for @scheme[popup-menu%] objects.

View File

@ -1,7 +1,7 @@
#lang scribble/doc
@(require "common.ss")
@title{@bold{GUI}: Racket Graphics Toolkit}
@title{@bold{GUI}: Racket Graphical Interface Toolkit}
@author["Matthew Flatt" "Robert Bruce Findler" "John Clements"]
@ -9,12 +9,13 @@
@defmodule*/no-declare[(racket/gui/base)]{The
@racketmodname[racket/gui/base] library provides all of the class,
interface, and procedure bindings defined in this manual.}
interface, and procedure bindings defined in this manual, in addition
to the bindings of @racketmodname[racket/draw].}
@defmodulelang*/no-declare[(racket/gui)]{The
@racketmodname[racket/gui] language combines all bindings of the
@racketmodname[racket] language and the
@racketmodname[racket/gui/base] modules.}
@racketmodname[racket/gui/base] and @racketmodname[racket/draw] modules.}
@table-of-contents[]
@ -23,23 +24,9 @@ interface, and procedure bindings defined in this manual.}
@include-section["guide.scrbl"]
@include-section["reference.scrbl"]
@include-section["config.scrbl"]
@include-section["prefs.scrbl"]
@include-section["dynamic.scrbl"]
@;------------------------------------------------------------------------
@(bibliography
(bib-entry #:key "Adobe99"
#:author "Adobe Systems Incorporated"
#:title "PostScript Language Reference, third edition"
#:is-book? #t
#:url "http://partners.adobe.com/public/developer/en/ps/PLRM.pdf"
#:date "1999")
)
@;------------------------------------------------------------------------
@index-section[]

View File

@ -4,7 +4,7 @@
@title[#:style '(toc reveal)]{Overview}
For documentation purposes, the graphics toolbox is organized into
three parts:
two parts:
@itemize[
@ -13,11 +13,6 @@ For documentation purposes, the graphics toolbox is organized into
text fields, and events. The windowing toolbox is described in
@secref["windowing-overview"].}
@item{The @deftech{drawing toolbox}, for drawing pictures or
implementing dynamic GUI programs (such as a video game) using
drawing canvases, pens, and brushes. The drawing toolbox is
described in @secref["drawing-overview"].}
@item{The @deftech{editor toolbox}, for developing traditional text
editors, editors that mix text and graphics, or free-form layout
editors (such as a word processor, HTML editor, or icon-based file
@ -26,11 +21,8 @@ For documentation purposes, the graphics toolbox is organized into
]
These three parts roughly represent layers of increasing
sophistication. Simple GUI programs access only the windowing toolbox
directly, more complex programs use both the windowing and drawing
toolboxes, and large-scale applications rely on all three
toolboxes.
Simple GUI programs access only the windowing toolbox directly, while
large-scale applications tend to use the editor toolbox as well.
@local-table-of-contents[]
@ -40,8 +32,4 @@ These three parts roughly represent layers of increasing
@;------------------------------------------------------------------------
@include-section["draw-overview.scrbl"]
@;------------------------------------------------------------------------
@include-section["editor-overview.scrbl"]

View File

@ -20,11 +20,6 @@ The following are the (case-sensitive) preference names used by GRacket:
the basic style in a style list, and thus the default font size for
an editor.}
@item{@ResourceFirst{controlFontSize} --- sets the font size for
control and menu labels (Windows, X); the font is the @scheme['system]
font, which can be configured as described in
@secref["fontresources"].}
@item{@ResourceFirst{defaultMenuPrefix} --- sets the prefix used by
default for menu item shortcuts under X, one of @scheme['ctl],
@scheme['meta], or @scheme['alt]. The default is
@ -32,25 +27,10 @@ The following are the (case-sensitive) preference names used by GRacket:
@scheme['alt], underlined mnemonics (introduced by @litchar{&} in menu
labels) are suppressed.}
@item{@ResourceFirst{altUpSelectsMenu} --- a true value makes
pressing and releasing the Alt key select the first menu in the menu
bar under X.}
@item{@ResourceFirst{emacsUndo} --- a true value makes undo in
editors work as in Emacs (i.e., undo operations are themselves kept
in the undo stack).}
@item{@ResourceFirst{hiliteColor} --- a string to sets the color for
highlighting text, menus, and other GUI elements under X; the
preference string should contain six hexadecimal digits, two for each
component of the color. For example, set @Resource{hiliteColor} to
@scheme["0000A0"] and set @Resource{hiliteMenuBorder} to @scheme[#t]
for a Bluecurve-like look.}
@item{@ResourceFirst{hiliteMenuBorder} --- a true value causes a menu
selection to be highlighted with a border (in addition to a color) under
X.}
@item{@ResourceFirst{wheelStep} --- sets the default mouse-wheel step
size of @scheme[editor-canvas%] objects.}
@ -61,26 +41,8 @@ The following are the (case-sensitive) preference names used by GRacket:
@item{@ResourceFirst{playcmd} --- used to format a sound-playing
command; see @scheme[play-sound] for details.}
@item{@ResourceFirst{forceFocus} --- a true value enables extra
effort in GRacket to move the focus to a top-level window that is shown
or raised.}
@item{@ResourceFirst{doubleClickTime} --- overrides the
platform-specific default interval (in milliseconds) for double-click
events.}
@item{@ResourceFirst{gamma} --- sets the gamma value used in
gamma-correcting PNG files.}
@item{@ResourceFirst{selectionAsClipboard} --- under X, a true value
causes @scheme[the-clipboard] to be an alias to
@scheme[the-x-selection-clipboard], which means that cut and paste
operations use the X selection instead of the X clipboard. See also
@scheme[clipboard<%>].}
]
In addition, preference names built from font face names can provide
or override default entries for the @scheme[font-name-directory<%>];
see @secref["fontresources"] for information.

View File

@ -3,13 +3,10 @@
@defclass/title[printer-dc% object% (dc<%>)]{
A @scheme[printer-dc%] object is a Windows or Mac OS X printer
device context. The class cannot be instantiated under X (an
@scheme[exn:misc:unsupported] exception is raised).
Under Mac OS X, a newly created @scheme[printer-dc%] object obtains
orientation (portrait versus landscape) and scaling information from
the current @scheme[ps-setup%] object, as determined by the
A @scheme[printer-dc%] object is a printer device context. A newly
created @scheme[printer-dc%] object obtains orientation (portrait
versus landscape) and scaling information from the current
@scheme[ps-setup%] object, as determined by the
@scheme[current-ps-setup] parameter. This information can be
configured by the user through a dialog shown by
@scheme[get-page-setup-from-user].

View File

@ -7,8 +7,6 @@
@include-section["win-classes.scrbl"]
@include-section["win-funcs.scrbl"]
@include-section["draw-classes.scrbl"]
@include-section["draw-funcs.scrbl"]
@include-section["editor-classes.scrbl"]
@include-section["editor-funcs.scrbl"]
@include-section["wxme.scrbl"]

View File

@ -57,6 +57,7 @@ Alphabetical:
@include-section["pane-class.scrbl"]
@include-section["panel-class.scrbl"]
@include-section["popup-menu-class.scrbl"]
@include-section["printer-dc-class.scrbl"]
@include-section["radio-box-class.scrbl"]
@include-section["selectable-menu-item-intf.scrbl"]
@include-section["separator-menu-item-class.scrbl"]

View File

@ -8,4 +8,6 @@
@include-section["dialog-funcs.scrbl"]
@include-section["eventspace-funcs.scrbl"]
@include-section["system-menu-funcs.scrbl"]
@include-section["global-draw-funcs.scrbl"]
@include-section["font-funcs.scrbl"]
@include-section["miscwin-funcs.scrbl"]

View File

@ -137,3 +137,7 @@ Removed Functions
The `write-resource, `get-reource', and `send-event' functions have
been removed from `racket/gui/base'. If there is any demand for the
removed functionality, it will be implemented in a new library.
The `current-ps-afm-file-paths' and `current-ps-cmap-file-paths'
functions have been removed, because they no longer apply. PostScript
font information is obtained through Pango.