diff --git a/collects/framework/framework-docs.ss b/collects/framework/framework-docs.ss index 8891d287a7..e1949f8a69 100644 --- a/collects/framework/framework-docs.ss +++ b/collects/framework/framework-docs.ss @@ -43,14 +43,22 @@ (define-syntax (export/docs stx) (syntax-case stx () - [(_ (id ctc argspec docs ...) ...) - #'(begin (fw-doc-form id ctc argspec docs ...) ...)])) + [(_ tag docs ...) + (let ([reg (regexp (format "^~a:" (syntax->datum #'tag)))]) + (with-syntax ([((id ctc argspec docs ...) ...) + (filter (λ (x) + (syntax-case x () + [(id ctc argspec docs ...) + (regexp-match reg (format "~a" (syntax->datum #'id)))])) + (syntax->list #'(docs ...)))]) + #'(begin (fw-doc-form id ctc argspec docs ...) ...)))])) (define-syntax (conv/export/docs stx) (define-struct faux-stx (obj vec) #:prefab) (syntax-case stx () - [(id arg) + [(id tag arg) #`(export/docs + tag #,@(let loop ([f-stx (syntax->datum #'arg)]) (cond [(faux-stx? f-stx) @@ -61,4 +69,6 @@ [else f-stx])))])) (define-syntax (def-fw-procs stx) - #'(framework-exports/srcloc-preserved conv/export/docs)) + (syntax-case stx () + [(_ tag) + #'(framework-exports/srcloc-preserved conv/export/docs tag)])) diff --git a/collects/framework/private/framework-exports.ss b/collects/framework/private/framework-exports.ss index 9ad7ac3dbc..7325e117a3 100644 --- a/collects/framework/private/framework-exports.ss +++ b/collects/framework/private/framework-exports.ss @@ -1362,7 +1362,7 @@ [else stx]))]) #`(define-syntax (framework-exports/srcloc-preserved stx) (syntax-case stx () - [(_ id) - #'(id #,marshalled)]))))]))) + [(_ id tag) + #'(id tag #,marshalled)]))))]))) (framework-exports make-framework-exports/srcloc-preserved) diff --git a/collects/scribblings/framework/framework-application.scrbl b/collects/scribblings/framework/framework-application.scrbl new file mode 100644 index 0000000000..bd6a84257a --- /dev/null +++ b/collects/scribblings/framework/framework-application.scrbl @@ -0,0 +1,8 @@ +#lang scribble/doc +@(require scribble/manual) +@(require (for-label framework/framework)) +@(require (for-label scheme/gui)) +@title{Application} + +@(require framework/framework-docs) +@(def-fw-procs application) diff --git a/collects/scribblings/framework/framework-autosave.scrbl b/collects/scribblings/framework/framework-autosave.scrbl new file mode 100644 index 0000000000..287762bd17 --- /dev/null +++ b/collects/scribblings/framework/framework-autosave.scrbl @@ -0,0 +1,18 @@ +#lang scribble/doc +@(require scribble/manual) +@(require (for-label framework/framework)) +@(require (for-label scheme/gui)) +@title{Autosave} + +@definterface[autosave:autosavable<%> ()]{ + Classes that implement this interface can be autosaved. + @defmethod*[(((do-autosave) void))]{ + This method is called when the object is registered to be + autosaved (see + @scheme[autosave:register]). + + + } +} +@(require framework/framework-docs) +@(def-fw-procs autosave) diff --git a/collects/scribblings/framework/framework-canvas.scrbl b/collects/scribblings/framework/framework-canvas.scrbl new file mode 100644 index 0000000000..1e6b66ed1f --- /dev/null +++ b/collects/scribblings/framework/framework-canvas.scrbl @@ -0,0 +1,102 @@ +#lang scribble/doc +@(require scribble/manual) +@(require (for-label framework/framework)) +@(require (for-label scheme/gui)) +@title{Canvas} + +@definterface[canvas:basic<%> (editor-canvas%)]{ + +} +@defmixin[canvas:basic-mixin (editor-canvas%) (canvas:basic<%>)]{ +} +@definterface[canvas:color<%> (canvas:basic<%>)]{ + \index{background color} + Mixins that implement this interface initialize the + background color of the canvas to the value of the + \index{'framework:basic-canvas-background} + \scheme|'framework:basic-canvas-background| preference. + Adds a callback so that when that preference is modified, + the background color changes. + +} +@defmixin[canvas:color-mixin (canvas:basic<%>) (canvas:color<%>)]{ +} +@definterface[canvas:delegate<%> (canvas:basic<%>)]{ + This class is part of the delegate window implementation. +} +@defmixin[canvas:delegate-mixin (canvas:basic<%>) (canvas:delegate<%>)]{ + Provides an implementation of + @scheme[canvas:delegate<%>]. + @defmethod*[#:mode override (((on-superwindow-show (shown? boolean)) void))]{ + + Notifies the delegate window when the original window is + visible. When invisible, the blue highlighting is erased. + } +} +@definterface[canvas:info<%> (canvas:basic<%>)]{ + +} +@defmixin[canvas:info-mixin (canvas:basic<%>) (canvas:info<%>)]{ + + @defmethod*[#:mode override (((on-focus) void))]{ + + sets the canvas that the frame displays info about. + } + @defmethod*[#:mode override (((set-editor) void))]{ + + Calls + @method[frame:info<%> update-info] + to update the frame's info panel. + } +} +@definterface[canvas:wide-snip<%> (canvas:basic<%>)]{ + Any + @scheme[canvas%] + that matches this interface will automatically + resize selected snips when it's size changes. Use + @method[canvas:wide-snip<%> add-tall-snip] + and + @method[canvas:wide-snip<%> add-wide-snip] + to specify which snips should be resized. + @defmethod*[(((recalc-snips) void))]{ + Recalculates the sizes of the wide snips. + + } + @defmethod*[(((add-wide-snip (snip (instance snip%))) void))]{ + Snips passed to this method will be resized when the canvas's size + changes. Their width will be set so they take up all of the space + from their lefts to the right edge of the canvas. + + + } + @defmethod*[(((add-tall-snip (snip (instance snip%))) void))]{ + Snips passed to this method will be resized when the canvas's size + changes. Their height will be set so they take up all of the space + from their tops to the bottom of the canvas. + + } +} +@defmixin[canvas:wide-snip-mixin (canvas:basic<%>) (canvas:wide-snip<%>)]{ + This canvas maintains a list of wide and tall snips and adjusts their + heights and widths when the canvas's size changes. + + The result of this mixin uses the same initialization arguments as the + mixin's argument. + @defmethod*[#:mode override (((on-size (width (integer-in 0 10000)) (height (integer-in 0 10000))) void))]{ + + Adjusts the sizes of the marked snips. + + See + @method[canvas:wide-snip<%> add-wide-snip] + and + @method[canvas:wide-snip<%> add-tall-snip]. + + } +} +@defclass[canvas:basic% (canvas:basic-mixin editor-canvas%) ()]{} +@defclass[canvas:color% (canvas:color-mixin canvas:basic%) ()]{} +@defclass[canvas:info% (canvas:info-mixin canvas:basic%) ()]{} +@defclass[canvas:delegate% (canvas:delegate-mixin canvas:basic%) ()]{} +@defclass[canvas:wide-snip% (canvas:wide-snip-mixin canvas:basic%) ()]{} +@(require framework/framework-docs) +@(def-fw-procs canvas) diff --git a/collects/scribblings/framework/framework-color-model.scrbl b/collects/scribblings/framework/framework-color-model.scrbl new file mode 100644 index 0000000000..139b530311 --- /dev/null +++ b/collects/scribblings/framework/framework-color-model.scrbl @@ -0,0 +1,8 @@ +#lang scribble/doc +@(require scribble/manual) +@(require (for-label framework/framework)) +@(require (for-label scheme/gui)) +@title{Color Model} + +@(require framework/framework-docs) +@(def-fw-procs color-model) diff --git a/collects/scribblings/framework/framework-color-prefs.scrbl b/collects/scribblings/framework/framework-color-prefs.scrbl new file mode 100644 index 0000000000..70d979bc11 --- /dev/null +++ b/collects/scribblings/framework/framework-color-prefs.scrbl @@ -0,0 +1,8 @@ +#lang scribble/doc +@(require scribble/manual) +@(require (for-label framework/framework)) +@(require (for-label scheme/gui)) +@title{Color Prefs} + +@(require framework/framework-docs) +@(def-fw-procs color-prefs) diff --git a/collects/scribblings/framework/framework-color.scrbl b/collects/scribblings/framework/framework-color.scrbl new file mode 100644 index 0000000000..6b36b1764b --- /dev/null +++ b/collects/scribblings/framework/framework-color.scrbl @@ -0,0 +1,237 @@ +#lang scribble/doc +@(require scribble/manual) +@(require (for-label framework/framework)) +@(require (for-label scheme/gui)) +@title{Color} + +@definterface[color:text<%> (text:basic<%>)]{ + This interface describes how coloring is stopped and started for text + that knows how to color itself. It also describes how to query the + lexical and s-expression structure of the text. + @defmethod*[(((start-colorer (token-sym-style (-> symbol? string?)) (get-token (-> input-port? (values any? symbol? (union false? symbol?) natural-number? natural-number?))) (pairs (listof (list/p symbol? symbol?)))) void))]{ + Starts tokenizing the buffer for coloring and parenthesis matching. + + + token-sym-style will be passed the first return symbol from get-token + and should return the style-name that the token should be colored. + + get-token takes an input port and returns the next token as 5 values: + \begin{enumerate} + \item + An unused value. This value is intended to represent the textual + component of the token and may be used as such in the future. + \item + A symbol describing the type of the token. This symbol is transformed + into a style-name via the token-sym->style argument. The symbols + 'white-space and 'comment have special meaning and should always be + returned for white space and comment tokens respectively. The symbol + 'no-color can be used to indicate that although the token is not white + space, it should not be colored. The symbol 'eof must be used to + indicate when all the tokens have been consumed. + \item + A symbol indicating how the token should be treated by the paren + matcher or \#f. This symbol should be in the pairs argument. + \item + The starting position of the token. + \item + The ending position of the token. + \end{enumerate} + + get-token will usually be implemented with a lexer using the (lib + "lex.ss" "parser-tools") library.\\ + get-token must obey the following invariants: + \begin{itemize} + \item + Every position in the buffer must be accounted for in exactly one + token. + \item + The token returned by get-token must rely only on the contents of the + input port argument. This means that the tokenization of some part of + the input cannot depend on earlier parts of the input. + \item + No edit to the buffer can change the tokenization of the buffer prior + to the token immediately preceding the edit. In the following + example this invariant does not hold. If the buffer contains:\\ + " 1 2 3\\ + and the tokenizer treats the unmatched " as its own token (a string + error token), and separately tokenizes the 1 2 and 3, an edit to make + the buffer look like:\\ + " 1 2 3"\\ + would result in a single string token modifying previous tokens. To + handle these situations, get-token must treat the first line as a + single token. + \end{itemize} + + pairs is a list of different kinds of matching parens. The second + value returned by get-token is compared to this list to see how the + paren matcher should treat the token. An example: Suppose pairs is + \scheme+'((|(| |)|) (|[| |]|) (begin end))+. This means that there + are three kinds of parens. Any token which has 'begin as its second + return value will act as an open for matching tokens with 'end. + Similarly any token with \scheme+'|]|+ will act as a closing match for + tokens with \scheme+'|[|+. When trying to correct a mismatched + closing parenthesis, each closing symbol in pairs will be converted to + a string and tried as a closing parenthesis. + } + @defmethod*[(((stop-colorer (clear-colors boolean |#t|)) void))]{ + Stops coloring and paren matching the buffer. + + + If clear-colors is true all the text in the buffer will have it's + style set to Standard. + } + @defmethod*[(((force-stop-colorer (stop? boolean)) void))]{ + Causes the entire tokenizing/coloring system to become inactive. + Intended for debugging purposes only. + + + stop? determines whether the system is being forced to stop or allowed + to wake back up. + } + @defmethod*[(((is-stopped?) boolean))]{ + Indicates if the colorer for this editor has been stopped, or not. + + } + @defmethod*[(((is-frozen?) boolean))]{ + Indicates if this editor's colorer is frozen. See also + @method[color:text<%> freeze-colorer] + and + @method[color:text<%> thaw-colorer]. + + + } + @defmethod*[(((freeze-colorer) void))]{ + Keep the text tokenized and paren matched, but stop altering the colors. + + + freeze-colorer will not return until the coloring/tokenization of the + entire text is brought up-to-date. It must not be called on a locked + text. + } + @defmethod*[(((thaw-colorer (recolor boolean |#t|) (retokenize boolean |#f|)) void))]{ + Start coloring a frozen buffer again. + + + If recolor? is \scheme|#t|, the text is re-colored. If it is + \scheme|#f| the text is not recolored. When recolor? is \scheme|#t|, + retokenize? controls how the text is recolored. \scheme|#f| causes + the text to be entirely re-colored before thaw-colorer returns using + the existing tokenization. \scheme|#t| causes the entire text to be + retokenized and recolored from scratch. This will happen in the + background after the call to thaw-colorer returns. + + } + @defmethod*[(((reset-region (start natural-number?) (end (union (quote end) natural-number?))) void))]{ + Set the region of the text that is tokenized. + + } + @defmethod*[(((reset-regions (regions (listof (list number (union (quote end) number))))) void))]{ + + Sets the currently active regions to be \var{regions}. + } + @defmethod*[(((get-regions) (listof (list number (union (quote end) number)))))]{ + This returns the list of regions that are currently being colored in the editor. + + } + @defmethod*[(((skip-whitespace (position natural-number?) (direction (symbols (quote forward) (quote backward))) (comments? boolean)) natural-number?))]{ + Returns the next non-whitespace character. + + + Starts from position and skips whitespace in the direction indicated + by direction. If comments? is true, comments are skipped as well as + whitespace. skip-whitespace determines whitespaces and comments by + comparing the token type to 'white-space and 'comment. + + Must only be called while the tokenizer is started. + } + @defmethod*[(((backward-match (position natural-number?) (cutoff natural-number?)) (union natural-number? false?)))]{ + + + + Skip all consecutive whitespaces and comments (using skip-whitespace) + immediately preceding the position. If the token at this position is + a close, return the position of the matching open, or \scheme|#f| if + there is none. If the token was an open, return \scheme|#f|. For any + other token, return the start of that token. + + Must only be called while the tokenizer is started. + } + @defmethod*[(((backward-containing-sexp) void) ((backward-containing-sexp (position natural-number?) (cutoff natural-number?)) (union natural-number? false?)))]{ + + + + Return the starting position of the interior of the (non-atomic) + s-expression containing position, or \scheme|#f| is there is none. + + Must only be called while the tokenizer is started. + } + @defmethod*[(((forward-match (position natural-number?) (cutoff natural-number?)) (union natural-number? false?)))]{ + + + + Skip all consecutive whitespaces and comments (using skip-whitespace) + immediately following position. If the token at this position is an + open, return the position of the matching close, or \scheme|#f| if + there is none. For any other token, return the end of that token. + + Must only be called while the tokenizer is started. + } + @defmethod*[(((insert-close-paren (position natural-number?) (char char?) (flash? boolean) (fixup? boolean)) void))]{ + + + Position is the place to put the parenthesis and char is the + parenthesis to be added. If fixup? is true, the right kind of closing + parenthesis will be chosen from the pairs list kept last passed to + start-colorer, otherwise char will be inserted, even if it is not the + right kind. If flash? is true the matching open parenthesis will be + flashed. + } + @defmethod*[(((classify-position (position natural-number?)) symbol?))]{ + + + Return a symbol for the lexer-determined token type for the token that + contains the item after \scheme|position|. + + Must only be called while the tokenizer is started. + } +} +@defmixin[color:text-mixin (text:basic<%>) (color:text<%>)]{ + Adds the functionality needed for on-the-fly coloring and parenthesis + matching based on incremental tokenization of the text. + @defmethod*[#:mode override (((lock) void))]{ + } + @defmethod*[#:mode override (((on-focus) void))]{ + } + @defmethod*[#:mode augment (((after-edit-sequence) void))]{ + } + @defmethod*[#:mode augment (((after-set-position) void))]{ + } + @defmethod*[#:mode augment (((after-change-style) void))]{ + } + @defmethod*[#:mode augment (((on-set-size-constraint) void))]{ + + } + @defmethod*[#:mode augment (((after-insert) void))]{ + } + @defmethod*[#:mode augment (((after-delete) void))]{ + } +} +@defclass[color:text% (color:text-mixin text:keymap%) ()]{} +@definterface[color:text-mode<%> ()]{ +} +@defmixin[color:text-mode-mixin (mode:surrogate-text<%>) (color:text-mode<%>)]{ + This mixin adds coloring functionality to the mode. + + @defconstructor[((get-token lexer default-lexer) (token-sym->style (token $rightarrow$ string) |scheme(λ (x) "Standard"))|) (matches (listof (list/c symbol? symbol?)) null))]{ + + The arguments are passed to + @method[color:text<%> start-colorer]. + } + @defmethod*[#:mode override (((on-disable-surrogate) void))]{ + } + @defmethod*[#:mode override (((on-enable-surrogate) void))]{ + } +} +@defclass[color:text-mode% (color:text-mode-mixin mode:surrogate-text%) ()]{} +@(require framework/framework-docs) +@(def-fw-procs color) diff --git a/collects/scribblings/framework/framework-comment-box.scrbl b/collects/scribblings/framework/framework-comment-box.scrbl new file mode 100644 index 0000000000..8904f2bf86 --- /dev/null +++ b/collects/scribblings/framework/framework-comment-box.scrbl @@ -0,0 +1,48 @@ +#lang scribble/doc +@(require scribble/manual) +@(require (for-label framework/framework)) +@(require (for-label scheme/gui)) +@title{Comment Box} + +@defclass[comment-box:snip% decorated-editor-snip% (readable-snip<%>)]{ + This snip implements the comment boxes that you see in + DrScheme. + + @defmethod*[#:mode override (((make-editor) (is-a?/c text%)))]{ + + Makes an instance of + \begin{schemedisplay} + (scheme:text-mixin text:keymap%) + \end{schemedisplay} + } + @defmethod*[#:mode override (((make-snip) (is-a?/c comment-snip%)))]{ + + Returns an instance of the + @scheme[comment-snip%] + class. + } + @defmethod*[#:mode override (((get-corner-bitmap) (is-a?/c bitmap%)))]{ + + Returns the semicolon bitmap from the file + \begin{schemedisplay} + (build-path (collection-path "icons") "semicolon.gif") + \end{schemedisplay} + } + @defmethod*[#:mode override (((get-position) (symbols (quote left-top) (quote top-right))))]{ + + Returns \scheme|'left-top| + } + @defmethod*[#:mode override (((get-text) string))]{ + + Returns the same string as the super method, but with + newlines replaced by newline-semicolon-space. + } + @defmethod*[#:mode override (((get-menu) (is-a?/c popup-menu%)))]{ + + Returns a menu with a single item to change the box into + semicolon comments. + + } +} +@(require framework/framework-docs) +@(def-fw-procs comment-box) diff --git a/collects/scribblings/framework/framework-editor.scrbl b/collects/scribblings/framework/framework-editor.scrbl new file mode 100644 index 0000000000..aafb1a97d2 --- /dev/null +++ b/collects/scribblings/framework/framework-editor.scrbl @@ -0,0 +1,432 @@ +#lang scribble/doc +@(require scribble/manual) +@(require (for-label framework/framework)) +@(require (for-label scheme/gui)) +@title{Editor} + +@definterface[editor:basic<%> (editor<%>)]{ + Classes matching this interface support the basic + @scheme[editor<%>] + functionality required by the framework. + @defmethod*[(((has-focus?) boolean))]{ + This function returns \rawscm{\#t} when the editor has the keyboard + focus. It is implemented using: + @method[editor<%> on-focus] + + } + @defmethod*[(((local-edit-sequence?) boolean))]{ + Indicates if this editor is in an edit sequence. Enclosing buffer's + edit-sequence status is not considered by this method. + + See + @method[editor<%> begin-edit-sequence] + and + @method[editor<%> end-edit-sequence] + for more info about edit sequences. + + } + @defmethod*[(((run-after-edit-sequence (thunk (-> void)) (tag (union symbol? |#f|) |#f|)) void))]{ + This method is used to install callbacks that will be run after any + edit-sequence completes. + + + The procedure \var{thunk} will be called immediately if the edit is + not in an edit-sequence. If the edit is in an edit-sequence, it will + be called when the edit-sequence completes. + + If \var{tag} is a symbol, the \var{thunk} is keyed on that symbol, and + only one thunk per symbol will be called after the + edit-sequence. Specifically, the last call to + @method[editor:basic<%> run-after-edit-sequence]'s argument will be called. + + } + @defmethod*[(((get-top-level-window) (union |#f| (is-a?/c top-level-window<%>))))]{ + Returns the + @scheme[top-level-window<%>] + currently associated with this buffer. + + This does not work for embedded editors. + + + } + @defmethod*[(((save-file-out-of-date?) boolean))]{ + Returns \rawscm{\#t} if the file on disk has been modified, by some other program. + + } + @defmethod*[(((save-file/gui-error (filename (union path |#f|) |#f|) (format (union (quote guess) (quote standard) (quote text) (quote text-force-cr) same copy) (quote same)) (show-errors? boolean |#t|)) boolean))]{ + This method is an alternative to + @method[editor<%> save-file]. Rather than showing errors via the original stdout, it + opens a dialog with an error message showing the error. + + The result indicates if an error happened (the error has + already been shown to the user). It returns \rawscm{\#t} if + no error occurred and \rawscm{\#f} if an error occurred. + + } + @defmethod*[(((load-file/gui-error (filename (union string |#f|) |#f|) (format (union (quote guess) (quote standard) (quote text) (quote text-force-cr) (quote same) (quote copy)) (quote guess)) (show-errors? boolean |#t|)) boolean))]{ + This method is an alternative to + @method[editor<%> load-file]. Rather than showing errors via the original stdout, it + opens a dialog with an error message showing the error. + + The result indicates if an error happened (the error has + already been shown to the user). It returns \rawscm{\#t} if + no error occurred and \rawscm{\#f} if an error occurred. + + } + @defmethod*[(((on-close) void))]{ + This method is called when an editor is closed. See also + @method[editor:basic<%> can-close?] + and + @method[editor:basic<%> close]. + + + Does nothing. + } + @defmethod*[(((can-close?) boolean))]{ + This method is called to query the editor if is okay to + close the editor. Although there is no visible effect + associated with closing an editor, there may be some cleanup + actions that need to be run when the user is finished with + the editor (asking if it should be saved, for example). + + See also + @method[editor:basic<%> on-close]and + @method[editor:basic<%> close]. + + + Returns \scheme|#t|. + } + @defmethod*[(((close) boolean))]{ + This method is merely + \begin{schemedisplay} + (if (can-close?) + (begin (on-close) #t) + #f) + \end{schemedisplay} + It is intended as a shorthand, helper method for closing + an editor. See also + @method[editor:basic<%> can-close?] + and + @method[editor:basic<%> on-close]. + + } + @defmethod*[(((get-filename/untitled-name) string))]{ + Returns the printed version of the filename for this + editor. If the editor doesn't yet have a filename, it + returns a symbolic name (something like "Untitled"). + + } +} +@defmixin[editor:basic-mixin (editor<%>) (editor:basic<%>)]{ + This provides the basic editor services required by the rest of the + framework. + + The result of this mixin uses the same initialization arguments as the + mixin's argument. + + Each instance of a class created with this mixin contains a private + \iscmclass{keymap} that is chained to the global keymap via: + \rawscm{(send \var{keymap} chain-to-keymap (keymap:get-global) \#f)}. + + This installs the global keymap \iscmprocedure{keymap:get-global} to + handle keyboard and mouse mappings not handled by \var{keymap}. The + global keymap is created when the framework is invoked. + @defmethod*[#:mode augment (((can-save-file? (filename string) (format symbol?)) boolean))]{ + + Checks to see if the file on the disk has been modified out + side of this editor, using + @method[editor:basic<%> save-file-out-of-date?]. + If it has, this method prompts the user to be sure they want to save. + + } + @defmethod*[#:mode augment (((after-save-file (success? boolean)) void))]{ + + If the current filename is not a temporary filename, this method calls + @scheme[handler:add-to-recent]with the current filename. + + to add the new filename to the list of recently opened files. + + Additionally, updates a private instance variable with the + modification time of the file, for using in implementing + @method[editor:basic<%> save-file-out-of-date?]. + + } + @defmethod*[#:mode augment (((after-load-file (success? boolean)) void))]{ + + Updates a private instance variable with the modification + time of the file, for using in implementing + @method[editor:basic<%> save-file-out-of-date?] + + } + @defmethod*[#:mode override (((on-focus (on? boolean)) void))]{ + Manages the state to implement + @method[editor:basic<%> has-focus?] + + } + @defmethod*[#:mode augment (((on-edit-sequence) boolean))]{ + + Always returns \rawscm{\#t}. Updates a flag for + @method[editor:basic<%> local-edit-sequence?] + } + @defmethod*[#:mode augment (((after-edit-sequence) void))]{ + + Helps to implement + @method[editor:basic<%> run-after-edit-sequence]. + } + @defmethod*[#:mode override (((on-new-box (type (union (quote pasteboard) (quote text)))) (instance editor-snip%)))]{ + + Creates instances of + @scheme[pasteboard:basic%] + or + @scheme[text:basic%] + instead of the built in + @scheme[pasteboard%] + and + @scheme[text%] + classes. + } + @defmethod*[#:mode override (((get-file (directory (or/c path-string? false/c))) string))]{ + + Uses + @scheme[finder:get-file] + to find a filename. Also, sets the parameter + @scheme[finder:dialog-parent-parameter] + to the result of + @method[editor:basic<%> get-top-level-window]. + } + @defmethod*[#:mode override (((put-file (directory (or/c path? false/c)) (default-name (or/c path? false/c))) string))]{ + + Uses + @scheme[finder:put-file] + to find a filename. Also, sets the parameter + @scheme[finder:dialog-parent-parameter] + to the result of + @method[editor:basic<%> get-top-level-window]. + } +} +@definterface[editor:standard-style-list<%> (editor<%>)]{ + This interface is implemented by the results of + @scheme[editor:standard-style-list-mixin]. +} +@defmixin[editor:standard-style-list-mixin (editor<%>) (editor:standard-style-list<%>)]{ + The mixin adds code to the initialization + of the class that sets the editor's style + list (via + @method[editor<%> set-style-list]) + to the result of + @scheme[editor:get-standard-style-list]. + + In addition, it calls + @method[editor<%> set-load-overwrites-styles] + with \scheme|#f|. + This ensures that saved files with different + settings for the style list do not clobber + the shared style list. +} +@definterface[editor:keymap<%> (editor:basic<%>)]{ + Classes matching this interface add support for mixing in multiple + keymaps. They provides an extensible interface to chained keymaps, + through the + @method[editor:keymap<%> get-keymaps] + method. + + This editor is initialized by calling + @scheme[add-editor-keymap-functions], + @scheme[add-text-keymap-functions], and + @scheme[add-pasteboard-keymap-functions]. + @defmethod*[(((get-keymaps) (list-of (instance keymap%))))]{ + The keymaps returned from this method are chained to this + \iscmintf{editor}'s keymap. + + The result of this method should not change -- that is, it + should return the same list of keymaps each time it is + called. + + + Defaultly returns \rawscm{(list + @scheme[keymap:get-global])} + } +} +@defmixin[editor:keymap-mixin (editor:basic<%>) (editor:keymap<%>)]{ + This provides a mixin that implements the + @scheme[editor:keymap<%>] + interface. +} +@definterface[editor:autowrap<%> (editor:basic<%>)]{ + Classes implementing this interface keep the + @method[editor<%> auto-wrap] + state set based on the + \rawscm{'framework:auto-set-wrap?} preference + (see + \hyperref{the preferences section}{section~}{ for more info about preferences}{fw:preferences}). + + They install a preferences callback with + @scheme[preferences:add-callback] + that sets the state when the preference changes and + initialize the value of + @method[editor<%> auto-wrap] + to the current value of \rawscm{'framework:auto-set-wrap?} + via + @scheme[preferences:get]. +} +@defmixin[editor:autowrap-mixin (editor:basic<%>) (editor:autowrap<%>)]{ + See + @scheme[editor:autowrap<%>] +} +@definterface[editor:file<%> (editor:keymap<%>)]{ + Objects supporting this interface are expected to support files. + @defmethod*[(((get-can-close-parent) (union false (is-a/c? frame%) (is-a/c? dialog%))))]{ + The result of this method is used as the parent for the + dialog that asks about closing. + + + Defaultly returns \scheme|#f|. + } + @defmethod*[(((update-frame-filename) void))]{ + Attempts to find a frame that displays this editor. If it + does, it updates the frame's title based on a new filename + in the editor. + + } + @defmethod*[(((allow-close-with-no-filename?) boolean))]{ + This method indicates if closing the file when it hasn't + been saved is a reason to alert the user. See also + @method[editor:file-mixin can-close?]. + + + Defaultly returns \scheme|#f|. + } +} +@defmixin[editor:file-mixin (editor:keymap<%>) (editor:file<%>)]{ + This editor locks itself when the file that is opened is read-only in + the filesystem. + + The class that this mixin produces uses the same initialization + arguments as it's input. + @defmethod*[#:mode override (((set-filename (name string) (temp? boolean |#f|)) void))]{ + + Updates the filename on each frame displaying this editor, for each + frame that matches + @scheme[frame:editor<%>]. + } + @defmethod*[#:mode augment (((can-close?) boolean))]{ + + If the + @method[editor:file<%> allow-close-with-no-filename?] + method returns \scheme|#f|, this method checks to see if the file + has been saved at all yet. If not, it asks the user + about saving (and saves if they ask). + + If the + @method[editor:file<%> allow-close-with-no-filename?] + method returns \scheme|#t|, this method does as before, + except only asks if the editor's + @method[editor<%> get-filename]method returns a path. + + Also calls inner. + } + @defmethod*[#:mode override (((get-keymaps) (list-of (instance keymap%))))]{ + + This returns a list containing the super-class's keymaps, plus the + result of + @scheme[keymap:get-file] + } +} +@definterface[editor:backup-autosave<%> (editor:basic<%>)]{ + Classes matching this interface support backup files and autosaving. + @defmethod*[(((backup?) boolean))]{ + Indicates weather this + @scheme[editor<%>] + should be backed up. + + + Returns the value of the + @scheme[preferences:get] + applied to + \rawscm{'framework:backup-files?}. + \index{'framework:backup-files?} + + } + @defmethod*[(((autosave?) boolean))]{ + Indicates weather this + @scheme[editor<%>] + should be autosaved. + + + Returns \rawscm{\#t}. + } + @defmethod*[(((do-autosave) (union |#f| string)))]{ + This method is called to perform the autosaving. + See also + @scheme[autosave:register] + + + When the file has been modified since it was last saved and autosaving + it turned on (via the + @method[editor:backup-autosave<%> autosave?] + method) an autosave file is created for this + @scheme[editor<%>]. + + Returns the filename where the autosave took place, or + \rawscm{\#f} if none did. + } + @defmethod*[(((remove-autosave) void))]{ + This method removes the autosave file associated with this + @scheme[editor<%>]. + + + } +} +@defmixin[editor:backup-autosave-mixin (editor:basic<%>) (editor:backup-autosave<%> autosave:autosavable<%>)]{ + This mixin adds backup and autosave functionality to an editor. + + During initialization, this object is registered + with + @scheme[autosave:register]. + + The result of this mixin uses the same initialization arguments as the + mixin's argument. + + @defmethod*[#:mode augment (((on-save-file (filename path?) (format (one-of/c (quote guess) (quote standard) (quote text) (quote text-force-cr) (quote same) (quote copy)))) bool))]{ + + If a backup file has not been created this session for this file, + deletes any existing backup file and copies the old save file into the + backup file. For the backup file's name, see + @scheme[path-utils:generate-backup-name] + } + @defmethod*[#:mode augment (((on-close) void))]{ + + Deletes the autosave file and turns off autosaving. + } + @defmethod*[#:mode augment (((on-change) void))]{ + + Sets a flag indicating that this \iscmintf{editor} needs to be autosaved. + } + @defmethod*[#:mode override (((set-modified (modified? any/c)) void))]{ + + If the file is no longer modified, this method deletes the autosave + file. If it is, it updates a flag to indicate that the autosave file + is out of date. + } +} +@definterface[editor:info<%> (editor:basic<%>)]{ + An + @scheme[editor<%>] + matching this interface provides information about its lock state to its + @scheme[top-level-window<%>]. +} +@defmixin[editor:info-mixin (editor:basic<%>) (editor:info<%>)]{ + This editor tells the frame when it is locked and unlocked. + See also + @scheme[frame:text-info<%>]. + + @defmethod*[#:mode override (((lock (lock? boolean)) void))]{ + + Uses + @method[editor:basic<%> run-after-edit-sequence] + to call + @method[frame:info<%> lock-status-changed]. + } +} +@(require framework/framework-docs) +@(def-fw-procs editor) diff --git a/collects/scribblings/framework/framework-exit.scrbl b/collects/scribblings/framework/framework-exit.scrbl new file mode 100644 index 0000000000..8b4f67e308 --- /dev/null +++ b/collects/scribblings/framework/framework-exit.scrbl @@ -0,0 +1,8 @@ +#lang scribble/doc +@(require scribble/manual) +@(require (for-label framework/framework)) +@(require (for-label scheme/gui)) +@title{Exit} + +@(require framework/framework-docs) +@(def-fw-procs exit) diff --git a/collects/scribblings/framework/framework-finder.scrbl b/collects/scribblings/framework/framework-finder.scrbl new file mode 100644 index 0000000000..970332c179 --- /dev/null +++ b/collects/scribblings/framework/framework-finder.scrbl @@ -0,0 +1,8 @@ +#lang scribble/doc +@(require scribble/manual) +@(require (for-label framework/framework)) +@(require (for-label scheme/gui)) +@title{Finder} + +@(require framework/framework-docs) +@(def-fw-procs finder) diff --git a/collects/scribblings/framework/framework-frame.scrbl b/collects/scribblings/framework/framework-frame.scrbl new file mode 100644 index 0000000000..bb124b2b87 --- /dev/null +++ b/collects/scribblings/framework/framework-frame.scrbl @@ -0,0 +1,2384 @@ +#lang scribble/doc +@(require scribble/manual) +@(require (for-label framework/framework)) +@(require (for-label scheme/gui)) +@title{Frame} + +@definterface[frame:basic<%> (frame%)]{ + Classes matching this interface support the basic + @scheme[frame%] + functionality required by the framework. + @defmethod*[(((get-area-container%) (is-a?/c area-container<%>)))]{ + The class that this method returns is used to create the + @scheme[area-container<%>] + in this frame. + + } + @defmethod*[(((get-area-container) (instance (is-a?/c area-container<%>))))]{ + This returns the main + @scheme[area-container<%>] + in the frame + + } + @defmethod*[(((get-menu-bar%) (subclass?/c menu-bar%)))]{ + The result of this method is used to create the initial menu bar for + this frame. + + + Return + @scheme[menu-bar%]. + } + @defmethod*[(((make-root-area-container (class (is-a?/c area-container<%>)) (parent (instance (is-a?/c area-container<%>)))) (instance (is-a?/c area-container<%>))))]{ + Override this method to insert a panel in between the panel used by + the clients of this frame and the frame itself. For example, to insert + a status line panel override this method with something like this: + + \begin{schemedisplay} + (class ... + ... + (rename [super-make-root-area-container make-root-area-container]) + (field + [status-panel #f]) + (define/override (make-root-area-container cls parent) + (set! status-panel + (super-make-root-area-container vertical-panel% parent)) + (let ([root (make-object cls status-panel)]) + + ; ... add other children to status-panel ... + + root)) + ... + \end{schemedisplay} + + In this example, status-panel will contain a root panel for the other + classes, and whatever panels are needed to display status information. + + The searching frame is implemented using this method. + + + Calls \rawscm{make-object} with \var{class} and \var{parent}. + } + @defmethod*[(((close) void))]{ + This method closes the frame by calling the + @method[top-level-window<%> can-close?], + @method[top-level-window<%> on-close], and + @method[top-level-window<%> show] + methods. + + It's implementation is: + \begin{schemedisplay} + (inherit can-close? on-close) + (public + [show + (lambda () + (when (can-close?) + (on-close) + (show #f)))]) + \end{schemedisplay} + + } + @defmethod*[(((editing-this-file? (filename path)) boolean))]{ + Indicates if this frame contains this buffer (and can edit + that file). + + + Returns \scheme|#f|. + } + @defmethod*[(((get-filename (temp (union |#f| (box boolean)) |#f|)) (union |#f| path)))]{ + This returns the filename that the frame is currently being saved as, + or \rawscm{\#f} if there is no appropriate filename. + + + Defaultly returns \rawscm{\#f}. + + If \var{temp} is a box, it is filled with \rawscm{\#t} or \rawscm{\#f}, + depending if the filename is a temporary filename. + } + @defmethod*[(((make-visible (filename string)) void))]{ + Makes the file named by \var{filename} visible (intended for + use with tabbed editing). + + } +} +@defmixin[frame:basic-mixin (frame%) (frame:basic<%>)]{ + This mixin provides the basic functionality that the framework + expects. It helps manage the list of frames in the + @scheme[group:%] + object returned by + @scheme[group:get-the-frame-group]. + + Do not give \iscmclass{panel}s or \iscmintf{control}s this frame as + parent. Instead, use the result of the + @method[frame:basic<%> get-area-container] + method. + + \index{Windows menu} + This mixin also creates a menu bar for the frame, as the + frame is initialized. It uses the class returned by + @method[frame:basic<%> get-menu-bar\%]. It only passes the frame as an initialization argument. + In addition, it creates the windows menu in the menu bar. + + See also + @scheme[frame:reorder-menus]. + @defmethod*[#:mode override (((show (on? boolean)) void))]{ + + Calls the super method. + + When \var{on?} is \scheme|#t|, inserts the frame into the + frame group and when it is \scheme|#f|, removes the frame + from the group. + } + @defmethod*[#:mode override (((can-exit?) boolean))]{ + + This, together with + @method[frame:basic-mixin on-exit] + mimics + @scheme[exit:exit]. + + First, it calls + @scheme[exit:set-exiting] + with \rawscm{\#t}. + Then, it calls + @scheme[exit:can-exit?]. If it returns \rawscm{\#t}, + so does this method. If + it returns \rawscm{\#f}, + this method calls + @scheme[exit:set-exiting] + with \rawscm{\#f}. + } + @defmethod*[#:mode override (((on-exit) void))]{ + + Together with + @method[frame:basic-mixin can-exit?] + this mimics the behavior of + @scheme[exit:exit]. + + Calls + @scheme[exit:on-exit] + and then queues a callback + to call MzScheme's \rawscm{exit} + function. If that returns, it + calls + @scheme[exit:set-exiting] + to reset that flag to + \rawscm{\#f}. + } + @defmethod*[#:mode override (((on-superwindow-show (shown? any/c)) void))]{ + + Notifies the result of (@scheme[group:get-the-frame-group]) that a frame has been shown, by calling + the + @method[group:% frame-shown/hidden] + method. + + } + @defmethod*[#:mode override (((on-drop-file (pathname string)) void))]{ + + Calls + @scheme[handler:edit-file] + with \var{pathname} as an argument. + } + @defmethod*[#:mode override (((after-new-child) void))]{ + + Raises an exception if attempting to add a child to this frame (except if using the + @method[frame:basic<%> make-root-area-container] + method). + } +} +@definterface[frame:size-pref<%> (frame:basic<%>)]{ + +} +@defmixin[frame:size-pref-mixin (frame:basic<%>) (frame:size-pref<%>)]{ + @defconstructor[((size-preferences-key symbol?) (label label-string?) (parent (or/c (is-a?/c frame%) false/c) #f) (x (or/c (integer-in -10000 10000) false/c) #f) (y (or/c (integer-in -10000 10000) false/c) #f) (style (listof (one-of/c (quote no-resize-border) (quote no-caption) (quote no-system-menu) (quote hide-menu-bar) (quote mdi-parent) (quote mdi-child) (quote toolbar-button) (quote float) (quote metal))) null) (enabled any/c #t) (border (integer-in 0 1000) 0) (spacing (integer-in 0 1000) 0) (alignment (list/c (one-of/c (quote left) (quote center) (quote right)) (one-of/c (quote top) (quote center) (quote bottom))) (quote (center top))) (min-width (integer-in 0 10000) graphical-minimum-width) (min-height (integer-in 0 10000) graphical-minimum-height) (stretchable-width any/c #t) (stretchable-height any/c #t))]{ + + The size \var{size-preferences-key} symbol is used with + @scheme[preferences:get] + and + @scheme[preferences:set] + to track the current size. + + Passes the \var{width} and \var{height} initialization + arguments to the superclass based on the current value + of the preference. + + See also + @scheme[frame:setup-size-pref]. + + } + @defmethod*[#:mode override (((on-size (width number) (height number)) void))]{ + + Updates the preferences, according to the width and + height. The preferences key is the one passed + to the initialization argument of the class. + } +} +@definterface[frame:register-group<%> ()]{ + Frames that implement this interface are registered with the group. See + @scheme[group:get-the-frame-group] + and + @scheme[frame:register-group-mixin]. +} +@defmixin[frame:register-group-mixin (frame:basic<%>) (frame:register-group<%>)]{ + During initialization, calls + @method[group:% insert-frame]with \scheme|this|. + @defmethod*[#:mode augment (((can-close?) bool))]{ + + Calls the inner method, with a default of \scheme|#t|. + If that returns \scheme|#t|, + it checks for one of the these three conditions: + \begin{itemize} + + \item + @scheme[exit:exiting?] + returns \rawscm{\#t} + \item there is more than one + frame in the group returned + by + @scheme[group:get-the-frame-group], or + \item the procedure + @scheme[exit:user-oks-exit] + returns \rawscm{\#t}. + \end{itemize} + If any of those conditions hold, the + method returns \rawscm{\#t}. + } + @defmethod*[#:mode augment (((on-close) void))]{ + + First calls the inner method. + Next, calls the + @method[group:% remove-frame] + method of the result of + @scheme[group:get-the-frame-group] + with \rawscm{this} as an argument. + Finally, unless + @scheme[exit:exiting?] + returns \rawscm{\#t}, + and if there are no more + frames open, it calls + @scheme[exit:exit]. + } + @defmethod*[#:mode override (((on-activate (on? boolean)) void))]{ + + Calls + @method[group:% set-active-frame] + with \rawscm{this} when + \var{on?} is true. + + } +} +@definterface[frame:status-line<%> (frame:basic<%>)]{ + The mixin that implements this interface provides an + interface to a set of status lines at the bottom of this + frame. + + Each status line must be opened with + @method[frame:status-line<%> open-status-line] + before any messages are shown in the status line and + once + @method[frame:status-line<%> close-status-line] + is called, no more messages may be displayed, + unless the status line is re-opened. + + The screen space for status lines is not created + until + @method[frame:status-line<%> update-status-line] + is called with a string. Additionally, + the screen space for one status line is re-used + when by another status line when the first + passes \scheme|#f| to + @method[frame:status-line<%> update-status-line]. In this manner, the status line frame avoids + opening too many status lines and avoids + flashing the status lines open and closed too + often. + @defmethod*[(((open-status-line (id symbol?)) void))]{ + Creates a new status line identified by the symbol + argument. The line will not appear in the frame until a + message is put into it, via + @method[frame:status-line<%> update-status-line]. + + + } + @defmethod*[(((close-status-line (id symbol?)) void))]{ + Closes the status line \var{id}. + + } + @defmethod*[(((update-status-line (id symbol?) (status (union |#f| string))) void))]{ + Updates the status line named by \var{id} with + \var{status}. If \var{status} is \scheme{#f}, the status + line is becomes blank (and may be used by other ids). + + } +} +@defmixin[frame:status-line-mixin (frame:basic<%>) (frame:status-line<%>)]{ + + @defmethod*[#:mode override (((make-root-area-container (class (subclass?/c panel%)) (parent (instanceof (subclass?/c panel%)))) (is-a?/c panel%)))]{ + + Adds a panel at the bottom of the frame to hold the status + lines. + + } +} +@definterface[frame:info<%> (frame:basic<%>)]{ + Frames matching this interface support a status line. + + The preference \scheme|'framework:show-status-line| controls + the visibility of the status line. If it is \scheme|#t|, the + status line is visible and if it is \scheme|#f|, the + status line is not visible (see + \hyperref{the preferences section}{section~}{ for more info about preferences}{fw:preferences}). + @defmethod*[(((determine-width (str string) (canvas (instance editor-canvas%)) (text (instance text%))) integer))]{ + This method is used to calculate the size of an + @scheme[editor-canvas%] + with a particular set of characters in it. + It is used to calculate the sizes of the edits in the status line. + + } + @defmethod*[(((lock-status-changed) void))]{ + This method is called when the lock status of the + @scheme[editor<%>] + changes. + + + Updates the lock icon in the status line panel. + } + @defmethod*[(((update-info) void))]{ + This method updates all of the information in the panel. + + } + @defmethod*[(((set-info-canvas (canvas (instance canvas:basic%))) void))]{ + Sets this canvas to be the canvas that the info frame shows info about. The + @method[canvas:info-mixin% on-focus] + and + @method[canvas:info-mixin% set-editor] + methods call this method to ensure that the info canvas is set correctly. + + } + @defmethod*[(((get-info-canvas) (instance canvas:basic%)))]{ + Returns the canvas that the + @scheme[frame:info<%>] + currently shows info about. See also + @method[frame:info<%> set-info-canvas] + + } + @defmethod*[(((get-info-editor) (union |#f| (is-a?/c editor<%>))))]{ + Override this method to specify the editor that the status line + contains information about. + + + Returns the result of + @method[frame:editor<%> get-editor]. + } + @defmethod*[(((get-info-panel) (instance horizontal-panel%)))]{ + This method returns the panel where the information about this editor + is displayed. + + } + @defmethod*[(((show-info) void))]{ + Shows the info panel. + + See also + @method[frame:info<%> is-info-hidden?]. + + } + @defmethod*[(((hide-info) void))]{ + Hides the info panel. + + See also + @method[frame:info<%> is-info-hidden?]. + + } + @defmethod*[(((is-info-hidden?) boolean))]{ + Result indicates if the show info panel has been explicitly hidden with + @method[frame:info<%> hide-info]. + + If this method returns \scheme|#t| and + \scheme|(preferences:get 'framework:show-status-line)| is + \scheme|#f|, then the info panel will not be visible. + Otherwise, it is visible. + + + } +} +@defmixin[frame:info-mixin (frame:basic<%>) (frame:info<%>)]{ + This mixin provides support for displaying various info in the status + line of the frame. + + The result of this mixin uses the same initialization arguments as the + mixin's argument. + @defmethod*[#:mode override (((make-root-area-container (class (subclass?/c area-container<%>)) (parent (is-a?/c area-container<%>))) (instance area-container<%>)))]{ + + Builds an extra panel for displaying various information. + } + @defmethod*[#:mode augment (((on-close) void))]{ + + Removes the GC icon with + @scheme[unregister-collecting-blit] + and cleans up other callbacks. + } +} +@definterface[frame:text-info<%> (frame:info<%>)]{ + Objects matching this interface receive information from editors + constructed with + @scheme[editor:info-mixin] + and display it. + @defmethod*[(((set-macro-recording (on? boolean)) void))]{ + Shows/hides the icon in the info bar that indicates if a + macro recording is in progress. + + } + @defmethod*[(((overwrite-status-changed) void))]{ + This method is called when the overwrite mode is turned either on or off in the + @scheme[editor<%>] + in this frame. + + + + } + @defmethod*[(((anchor-status-changed) void))]{ + This method is called when the anchor is turned either on or off in the + @scheme[editor<%>] + in this frame. + + + } + @defmethod*[(((editor-position-changed) void))]{ + This method is called when the position in the + @scheme[editor<%>] + changes. + + + } +} +@defmixin[frame:text-info-mixin (frame:info<%>) (frame:text-info<%>)]{ + This mixin adds status information to the info panel relating to an + edit. + + @defmethod*[#:mode augment (((on-close) void))]{ + + removes a preferences callback for \rawscm{'framework:line-offsets}. + See section~\ref{fw:preferences} for more information + } + @defmethod*[#:mode override (((update-info) void))]{ + + Calls + @method[frame:text-info<%> overwrite-status-changed], + @method[frame:text-info<%> anchor-status-changed], and + @method[frame:text-info<%> editor-position-changed]. + } +} +@definterface[frame:pasteboard-info<%> (frame:info<%>)]{ + +} +@defmixin[frame:pasteboard-info-mixin (frame:basic<%>) (frame:pasteboard-info<%>)]{ + +} +@definterface[frame:standard-menus<%> (frame:basic<%>)]{ + \begin{itemize} + \item + @method[frame:standard-menus<%> file-menu:new-callback], + @method[frame:standard-menus<%> file-menu:create-new?], + @method[frame:standard-menus<%> file-menu:new-string], + @method[frame:standard-menus<%> file-menu:new-help-string], + @method[frame:standard-menus<%> file-menu:new-on-demand], + @method[frame:standard-menus<%> file-menu:get-new-item] + + \item + @method[frame:standard-menus<%> file-menu:between-new-and-open] + + \item + @method[frame:standard-menus<%> file-menu:open-callback], + @method[frame:standard-menus<%> file-menu:create-open?], + @method[frame:standard-menus<%> file-menu:open-string], + @method[frame:standard-menus<%> file-menu:open-help-string], + @method[frame:standard-menus<%> file-menu:open-on-demand], + @method[frame:standard-menus<%> file-menu:get-open-item] + + \item + @method[frame:standard-menus<%> file-menu:open-recent-callback], + @method[frame:standard-menus<%> file-menu:create-open-recent?], + @method[frame:standard-menus<%> file-menu:open-recent-string], + @method[frame:standard-menus<%> file-menu:open-recent-help-string], + @method[frame:standard-menus<%> file-menu:open-recent-on-demand], + @method[frame:standard-menus<%> file-menu:get-open-recent-item] + + \item + @method[frame:standard-menus<%> file-menu:between-open-and-revert] + + \item + @method[frame:standard-menus<%> file-menu:revert-callback], + @method[frame:standard-menus<%> file-menu:create-revert?], + @method[frame:standard-menus<%> file-menu:revert-string], + @method[frame:standard-menus<%> file-menu:revert-help-string], + @method[frame:standard-menus<%> file-menu:revert-on-demand], + @method[frame:standard-menus<%> file-menu:get-revert-item] + + \item + @method[frame:standard-menus<%> file-menu:between-revert-and-save] + + \item + @method[frame:standard-menus<%> file-menu:save-callback], + @method[frame:standard-menus<%> file-menu:create-save?], + @method[frame:standard-menus<%> file-menu:save-string], + @method[frame:standard-menus<%> file-menu:save-help-string], + @method[frame:standard-menus<%> file-menu:save-on-demand], + @method[frame:standard-menus<%> file-menu:get-save-item] + + \item + @method[frame:standard-menus<%> file-menu:save-as-callback], + @method[frame:standard-menus<%> file-menu:create-save-as?], + @method[frame:standard-menus<%> file-menu:save-as-string], + @method[frame:standard-menus<%> file-menu:save-as-help-string], + @method[frame:standard-menus<%> file-menu:save-as-on-demand], + @method[frame:standard-menus<%> file-menu:get-save-as-item] + + \item + @method[frame:standard-menus<%> file-menu:between-save-as-and-print] + + \item + @method[frame:standard-menus<%> file-menu:print-callback], + @method[frame:standard-menus<%> file-menu:create-print?], + @method[frame:standard-menus<%> file-menu:print-string], + @method[frame:standard-menus<%> file-menu:print-help-string], + @method[frame:standard-menus<%> file-menu:print-on-demand], + @method[frame:standard-menus<%> file-menu:get-print-item] + + \item + @method[frame:standard-menus<%> file-menu:between-print-and-close] + + \item + @method[frame:standard-menus<%> file-menu:close-callback], + @method[frame:standard-menus<%> file-menu:create-close?], + @method[frame:standard-menus<%> file-menu:close-string], + @method[frame:standard-menus<%> file-menu:close-help-string], + @method[frame:standard-menus<%> file-menu:close-on-demand], + @method[frame:standard-menus<%> file-menu:get-close-item] + + \item + @method[frame:standard-menus<%> file-menu:between-close-and-quit] + + \item + @method[frame:standard-menus<%> file-menu:quit-callback], + @method[frame:standard-menus<%> file-menu:create-quit?], + @method[frame:standard-menus<%> file-menu:quit-string], + @method[frame:standard-menus<%> file-menu:quit-help-string], + @method[frame:standard-menus<%> file-menu:quit-on-demand], + @method[frame:standard-menus<%> file-menu:get-quit-item] + + \item + @method[frame:standard-menus<%> file-menu:after-quit] + + \item + @method[frame:standard-menus<%> edit-menu:undo-callback], + @method[frame:standard-menus<%> edit-menu:create-undo?], + @method[frame:standard-menus<%> edit-menu:undo-string], + @method[frame:standard-menus<%> edit-menu:undo-help-string], + @method[frame:standard-menus<%> edit-menu:undo-on-demand], + @method[frame:standard-menus<%> edit-menu:get-undo-item] + + \item + @method[frame:standard-menus<%> edit-menu:redo-callback], + @method[frame:standard-menus<%> edit-menu:create-redo?], + @method[frame:standard-menus<%> edit-menu:redo-string], + @method[frame:standard-menus<%> edit-menu:redo-help-string], + @method[frame:standard-menus<%> edit-menu:redo-on-demand], + @method[frame:standard-menus<%> edit-menu:get-redo-item] + + \item + @method[frame:standard-menus<%> edit-menu:between-redo-and-cut] + + \item + @method[frame:standard-menus<%> edit-menu:cut-callback], + @method[frame:standard-menus<%> edit-menu:create-cut?], + @method[frame:standard-menus<%> edit-menu:cut-string], + @method[frame:standard-menus<%> edit-menu:cut-help-string], + @method[frame:standard-menus<%> edit-menu:cut-on-demand], + @method[frame:standard-menus<%> edit-menu:get-cut-item] + + \item + @method[frame:standard-menus<%> edit-menu:between-cut-and-copy] + + \item + @method[frame:standard-menus<%> edit-menu:copy-callback], + @method[frame:standard-menus<%> edit-menu:create-copy?], + @method[frame:standard-menus<%> edit-menu:copy-string], + @method[frame:standard-menus<%> edit-menu:copy-help-string], + @method[frame:standard-menus<%> edit-menu:copy-on-demand], + @method[frame:standard-menus<%> edit-menu:get-copy-item] + + \item + @method[frame:standard-menus<%> edit-menu:between-copy-and-paste] + + \item + @method[frame:standard-menus<%> edit-menu:paste-callback], + @method[frame:standard-menus<%> edit-menu:create-paste?], + @method[frame:standard-menus<%> edit-menu:paste-string], + @method[frame:standard-menus<%> edit-menu:paste-help-string], + @method[frame:standard-menus<%> edit-menu:paste-on-demand], + @method[frame:standard-menus<%> edit-menu:get-paste-item] + + \item + @method[frame:standard-menus<%> edit-menu:between-paste-and-clear] + + \item + @method[frame:standard-menus<%> edit-menu:clear-callback], + @method[frame:standard-menus<%> edit-menu:create-clear?], + @method[frame:standard-menus<%> edit-menu:clear-string], + @method[frame:standard-menus<%> edit-menu:clear-help-string], + @method[frame:standard-menus<%> edit-menu:clear-on-demand], + @method[frame:standard-menus<%> edit-menu:get-clear-item] + + \item + @method[frame:standard-menus<%> edit-menu:between-clear-and-select-all] + + \item + @method[frame:standard-menus<%> edit-menu:select-all-callback], + @method[frame:standard-menus<%> edit-menu:create-select-all?], + @method[frame:standard-menus<%> edit-menu:select-all-string], + @method[frame:standard-menus<%> edit-menu:select-all-help-string], + @method[frame:standard-menus<%> edit-menu:select-all-on-demand], + @method[frame:standard-menus<%> edit-menu:get-select-all-item] + + \item + @method[frame:standard-menus<%> edit-menu:between-select-all-and-find] + + \item + @method[frame:standard-menus<%> edit-menu:find-callback], + @method[frame:standard-menus<%> edit-menu:create-find?], + @method[frame:standard-menus<%> edit-menu:find-string], + @method[frame:standard-menus<%> edit-menu:find-help-string], + @method[frame:standard-menus<%> edit-menu:find-on-demand], + @method[frame:standard-menus<%> edit-menu:get-find-item] + + \item + @method[frame:standard-menus<%> edit-menu:find-again-callback], + @method[frame:standard-menus<%> edit-menu:create-find-again?], + @method[frame:standard-menus<%> edit-menu:find-again-string], + @method[frame:standard-menus<%> edit-menu:find-again-help-string], + @method[frame:standard-menus<%> edit-menu:find-again-on-demand], + @method[frame:standard-menus<%> edit-menu:get-find-again-item] + + \item + @method[frame:standard-menus<%> edit-menu:replace-and-find-again-callback], + @method[frame:standard-menus<%> edit-menu:create-replace-and-find-again?], + @method[frame:standard-menus<%> edit-menu:replace-and-find-again-string], + @method[frame:standard-menus<%> edit-menu:replace-and-find-again-help-string], + @method[frame:standard-menus<%> edit-menu:replace-and-find-again-on-demand], + @method[frame:standard-menus<%> edit-menu:get-replace-and-find-again-item] + + \item + @method[frame:standard-menus<%> edit-menu:between-find-and-preferences] + + \item + @method[frame:standard-menus<%> edit-menu:preferences-callback], + @method[frame:standard-menus<%> edit-menu:create-preferences?], + @method[frame:standard-menus<%> edit-menu:preferences-string], + @method[frame:standard-menus<%> edit-menu:preferences-help-string], + @method[frame:standard-menus<%> edit-menu:preferences-on-demand], + @method[frame:standard-menus<%> edit-menu:get-preferences-item] + + \item + @method[frame:standard-menus<%> edit-menu:after-preferences] + + \item + @method[frame:standard-menus<%> help-menu:before-about] + + \item + @method[frame:standard-menus<%> help-menu:about-callback], + @method[frame:standard-menus<%> help-menu:create-about?], + @method[frame:standard-menus<%> help-menu:about-string], + @method[frame:standard-menus<%> help-menu:about-help-string], + @method[frame:standard-menus<%> help-menu:about-on-demand], + @method[frame:standard-menus<%> help-menu:get-about-item] + + \item + @method[frame:standard-menus<%> help-menu:after-about] + + \end{itemize} + @defmethod*[(((get-menu%) (subclass?/c menu:can-restore-underscore-menu%)))]{ + The result of this method is used as the class + for creating the result of these methods: + @method[frame:standard-menus<%> get-file-menu], + @method[frame:standard-menus<%> get-edit-menu], + @method[frame:standard-menus<%> get-help-menu]. + + + defaultly returns + @scheme[menu%] + } + @defmethod*[(((get-menu-item%) (subclass?/c menu-item%)))]{ + The result of this method is used as the class for creating + the menu items in this frame (see + @scheme[frame:standard-menus%] + for a list). + + + defaultly returns + @scheme[menu:can-restore-menu-item%]. + } + @defmethod*[(((get-checkable-menu-item%) (subclass?/c checkable-menu-item%)))]{ + The result of this method is used as the class for creating + checkable menu items in this class (see + @scheme[frame:standard-menus%] + for a list). + + + defaultly returns + @scheme[menu:can-restore-checkable-menu-item%]. + } + @defmethod*[(((get-file-menu) (instance (subclass?/c menu%))))]{ + Returns the file menu + See also + @method[frame:standard-menus<%> get-menu\%] + + } + @defmethod*[(((get-edit-menu) (instance (subclass?/c menu%))))]{ + Returns the edit menu + See also + @method[frame:standard-menus<%> get-menu\%] + + } + @defmethod*[(((get-help-menu) (instance (subclass?/c menu%))))]{ + Returns the help menu + See also + @method[frame:standard-menus<%> get-menu\%] + + } + @defmethod*[(((file-menu:new-callback (item (instance (subclass?/c menu-item%))) (evt (instance control-event%))) void))]{ + This method is called when the new menu-item of the file-menu menu is selected. + + + Defaultly bound to: + \begin{schemedisplay} + (λ (item control) (handler:edit-file #f) #t) + \end{schemedisplay} + } + @defmethod*[(((file-menu:get-new-item) (instance menu-item%)))]{ + This method returns the \iscmclass{menu-item} that corresponds + to this menu item. + + } + @defmethod*[(((file-menu:new-string) string))]{ + The result of this method is the name of this menu. + + defaultly returns "(string-constant new-menu-item)" + } + @defmethod*[(((file-menu:new-help-string) string))]{ + This result of this method is used as the help string when the + @scheme[menu-item%] + object is created. + + + Defaultly returns "\scheme{(string-constant new-info)}" + } + @defmethod*[(((file-menu:new-on-demand (item menu-item%)) void))]{ + The menu item's on-demand method calls this method + + + Defaultly is this: + \scheme{(λ (menu-item) (void))} + } + @defmethod*[(((file-menu:create-new?) boolean))]{ + The result of this method determines if the + corresponding menu-item is created. Override this + to control the creation of the menu-item. + + + defaultly returns \#t + } + @defmethod*[(((file-menu:between-new-and-open (menu (instance (subclass?/c menu%)))) void))]{ + This method is called between the addition of the new menu-item + and before the addition of the open menu-item to the file-menu menu. + Override it to add additional menus at that point. + + + Does nothing. + } + @defmethod*[(((file-menu:open-callback (item (instance (subclass?/c menu-item%))) (evt (instance control-event%))) void))]{ + This method is called when the open menu-item of the file-menu menu is selected. + + + Defaultly bound to: + \begin{schemedisplay} + (λ (item control) (handler:open-file) #t) + \end{schemedisplay} + } + @defmethod*[(((file-menu:get-open-item) (instance menu-item%)))]{ + This method returns the \iscmclass{menu-item} that corresponds + to this menu item. + + } + @defmethod*[(((file-menu:open-string) string))]{ + The result of this method is the name of this menu. + + defaultly returns "(string-constant open-menu-item)" + } + @defmethod*[(((file-menu:open-help-string) string))]{ + This result of this method is used as the help string when the + @scheme[menu-item%] + object is created. + + + Defaultly returns "\scheme{(string-constant open-info)}" + } + @defmethod*[(((file-menu:open-on-demand (item menu-item%)) void))]{ + The menu item's on-demand method calls this method + + + Defaultly is this: + \scheme{(λ (menu-item) (void))} + } + @defmethod*[(((file-menu:create-open?) boolean))]{ + The result of this method determines if the + corresponding menu-item is created. Override this + to control the creation of the menu-item. + + + defaultly returns \#t + } + @defmethod*[(((file-menu:open-recent-callback (item (instance (subclass?/c menu-item%))) (evt (instance control-event%))) void))]{ + This method is called when the open-recent menu-item of the file-menu menu is selected. + + + Defaultly bound to: + \begin{schemedisplay} + (λ (x y) (void)) + \end{schemedisplay} + } + @defmethod*[(((file-menu:get-open-recent-item) (instance menu-item%)))]{ + This method returns the \iscmclass{menu-item} that corresponds + to this menu item. + + } + @defmethod*[(((file-menu:open-recent-string) string))]{ + The result of this method is the name of this menu. + + defaultly returns "(string-constant open-recent-menu-item)" + } + @defmethod*[(((file-menu:open-recent-help-string) string))]{ + This result of this method is used as the help string when the + @scheme[menu-item%] + object is created. + + + Defaultly returns "\scheme{(string-constant open-recent-info)}" + } + @defmethod*[(((file-menu:open-recent-on-demand (item menu-item%)) void))]{ + The menu item's on-demand method calls this method + + + Defaultly is this: + \scheme{(λ (menu) (handler:install-recent-items menu))} + } + @defmethod*[(((file-menu:create-open-recent?) boolean))]{ + The result of this method determines if the + corresponding menu-item is created. Override this + to control the creation of the menu-item. + + + defaultly returns \#t + } + @defmethod*[(((file-menu:between-open-and-revert (menu (instance (subclass?/c menu%)))) void))]{ + This method is called between the addition of the open menu-item + and before the addition of the revert menu-item to the file-menu menu. + Override it to add additional menus at that point. + + + Does nothing. + } + @defmethod*[(((file-menu:revert-callback (item (instance (subclass?/c menu-item%))) (evt (instance control-event%))) void))]{ + This method is called when the revert menu-item of the file-menu menu is selected. + + + Defaultly bound to: + \begin{schemedisplay} + (λ (item control) (void)) + \end{schemedisplay} + } + @defmethod*[(((file-menu:get-revert-item) (instance menu-item%)))]{ + This method returns the \iscmclass{menu-item} that corresponds + to this menu item. + + } + @defmethod*[(((file-menu:revert-string) string))]{ + The result of this method is the name of this menu. + + defaultly returns "(string-constant revert-menu-item)" + } + @defmethod*[(((file-menu:revert-help-string) string))]{ + This result of this method is used as the help string when the + @scheme[menu-item%] + object is created. + + + Defaultly returns "\scheme{(string-constant revert-info)}" + } + @defmethod*[(((file-menu:revert-on-demand (item menu-item%)) void))]{ + The menu item's on-demand method calls this method + + + Defaultly is this: + \scheme{(λ (menu-item) (void))} + } + @defmethod*[(((file-menu:create-revert?) boolean))]{ + The result of this method determines if the + corresponding menu-item is created. Override this + to control the creation of the menu-item. + + + defaultly returns \#f + } + @defmethod*[(((file-menu:between-revert-and-save (menu (instance (subclass?/c menu%)))) void))]{ + This method is called between the addition of the revert menu-item + and before the addition of the save menu-item to the file-menu menu. + Override it to add additional menus at that point. + + + Does nothing. + } + @defmethod*[(((file-menu:save-callback (item (instance (subclass?/c menu-item%))) (evt (instance control-event%))) void))]{ + This method is called when the save menu-item of the file-menu menu is selected. + + + Defaultly bound to: + \begin{schemedisplay} + (λ (item control) (void)) + \end{schemedisplay} + } + @defmethod*[(((file-menu:get-save-item) (instance menu-item%)))]{ + This method returns the \iscmclass{menu-item} that corresponds + to this menu item. + + } + @defmethod*[(((file-menu:save-string) string))]{ + The result of this method is the name of this menu. + + defaultly returns "(string-constant save-menu-item)" + } + @defmethod*[(((file-menu:save-help-string) string))]{ + This result of this method is used as the help string when the + @scheme[menu-item%] + object is created. + + + Defaultly returns "\scheme{(string-constant save-info)}" + } + @defmethod*[(((file-menu:save-on-demand (item menu-item%)) void))]{ + The menu item's on-demand method calls this method + + + Defaultly is this: + \scheme{(λ (menu-item) (void))} + } + @defmethod*[(((file-menu:create-save?) boolean))]{ + The result of this method determines if the + corresponding menu-item is created. Override this + to control the creation of the menu-item. + + + defaultly returns \#f + } + @defmethod*[(((file-menu:save-as-callback (item (instance (subclass?/c menu-item%))) (evt (instance control-event%))) void))]{ + This method is called when the save-as menu-item of the file-menu menu is selected. + + + Defaultly bound to: + \begin{schemedisplay} + (λ (item control) (void)) + \end{schemedisplay} + } + @defmethod*[(((file-menu:get-save-as-item) (instance menu-item%)))]{ + This method returns the \iscmclass{menu-item} that corresponds + to this menu item. + + } + @defmethod*[(((file-menu:save-as-string) string))]{ + The result of this method is the name of this menu. + + defaultly returns "(string-constant save-as-menu-item)" + } + @defmethod*[(((file-menu:save-as-help-string) string))]{ + This result of this method is used as the help string when the + @scheme[menu-item%] + object is created. + + + Defaultly returns "\scheme{(string-constant save-as-info)}" + } + @defmethod*[(((file-menu:save-as-on-demand (item menu-item%)) void))]{ + The menu item's on-demand method calls this method + + + Defaultly is this: + \scheme{(λ (menu-item) (void))} + } + @defmethod*[(((file-menu:create-save-as?) boolean))]{ + The result of this method determines if the + corresponding menu-item is created. Override this + to control the creation of the menu-item. + + + defaultly returns \#f + } + @defmethod*[(((file-menu:between-save-as-and-print (menu (instance (subclass?/c menu%)))) void))]{ + This method is called between the addition of the save-as menu-item + and before the addition of the print menu-item to the file-menu menu. + Override it to add additional menus at that point. + + + Does nothing. + } + @defmethod*[(((file-menu:print-callback (item (instance (subclass?/c menu-item%))) (evt (instance control-event%))) void))]{ + This method is called when the print menu-item of the file-menu menu is selected. + + + Defaultly bound to: + \begin{schemedisplay} + (λ (item control) (void)) + \end{schemedisplay} + } + @defmethod*[(((file-menu:get-print-item) (instance menu-item%)))]{ + This method returns the \iscmclass{menu-item} that corresponds + to this menu item. + + } + @defmethod*[(((file-menu:print-string) string))]{ + The result of this method is the name of this menu. + + defaultly returns "(string-constant print-menu-item)" + } + @defmethod*[(((file-menu:print-help-string) string))]{ + This result of this method is used as the help string when the + @scheme[menu-item%] + object is created. + + + Defaultly returns "\scheme{(string-constant print-info)}" + } + @defmethod*[(((file-menu:print-on-demand (item menu-item%)) void))]{ + The menu item's on-demand method calls this method + + + Defaultly is this: + \scheme{(λ (menu-item) (void))} + } + @defmethod*[(((file-menu:create-print?) boolean))]{ + The result of this method determines if the + corresponding menu-item is created. Override this + to control the creation of the menu-item. + + + defaultly returns \#f + } + @defmethod*[(((file-menu:between-print-and-close (menu (instance (subclass?/c menu%)))) void))]{ + This method is called between the addition of the print menu-item + and before the addition of the close menu-item to the file-menu menu. + Override it to add additional menus at that point. + + + Adds a separator menu item. + } + @defmethod*[(((file-menu:close-callback (item (instance (subclass?/c menu-item%))) (evt (instance control-event%))) void))]{ + This method is called when the close menu-item of the file-menu menu is selected. + + + Defaultly bound to: + \begin{schemedisplay} + (λ (item control) (when (can-close?) (on-close) (show #f)) #t) + \end{schemedisplay} + } + @defmethod*[(((file-menu:get-close-item) (instance menu-item%)))]{ + This method returns the \iscmclass{menu-item} that corresponds + to this menu item. + + } + @defmethod*[(((file-menu:close-string) string))]{ + The result of this method is the name of this menu. + + defaultly returns "(string-constant close-menu-item)" + } + @defmethod*[(((file-menu:close-help-string) string))]{ + This result of this method is used as the help string when the + @scheme[menu-item%] + object is created. + + + Defaultly returns "\scheme{(string-constant close-info)}" + } + @defmethod*[(((file-menu:close-on-demand (item menu-item%)) void))]{ + The menu item's on-demand method calls this method + + + Defaultly is this: + \scheme{(λ (menu-item) (void))} + } + @defmethod*[(((file-menu:create-close?) boolean))]{ + The result of this method determines if the + corresponding menu-item is created. Override this + to control the creation of the menu-item. + + + defaultly returns \#t + } + @defmethod*[(((file-menu:between-close-and-quit (menu (instance (subclass?/c menu%)))) void))]{ + This method is called between the addition of the close menu-item + and before the addition of the quit menu-item to the file-menu menu. + Override it to add additional menus at that point. + + + Does nothing. + } + @defmethod*[(((file-menu:quit-callback (item (instance (subclass?/c menu-item%))) (evt (instance control-event%))) void))]{ + This method is called when the quit menu-item of the file-menu menu is selected. + + + Defaultly bound to: + \begin{schemedisplay} + (λ (item control) (when (exit:user-oks-exit) (exit:exit))) + \end{schemedisplay} + } + @defmethod*[(((file-menu:get-quit-item) (instance menu-item%)))]{ + This method returns the \iscmclass{menu-item} that corresponds + to this menu item. + + } + @defmethod*[(((file-menu:quit-string) string))]{ + The result of this method is the name of this menu. + + defaultly returns "(if (eq? (system-type) (quote windows)) (string-constant quit-menu-item-windows) (string-constant quit-menu-item-others))" + } + @defmethod*[(((file-menu:quit-help-string) string))]{ + This result of this method is used as the help string when the + @scheme[menu-item%] + object is created. + + + Defaultly returns "\scheme{(string-constant quit-info)}" + } + @defmethod*[(((file-menu:quit-on-demand (item menu-item%)) void))]{ + The menu item's on-demand method calls this method + + + Defaultly is this: + \scheme{(λ (menu-item) (void))} + } + @defmethod*[(((file-menu:create-quit?) boolean))]{ + The result of this method determines if the + corresponding menu-item is created. Override this + to control the creation of the menu-item. + + + defaultly returns (not (current-eventspace-has-standard-menus?)) + } + @defmethod*[(((file-menu:after-quit (menu (instance (subclass?/c menu%)))) void))]{ + This method is called after the addition of the quit menu-item + to the file-menu menu. + Override it to add additional menus at that point. + + + Does nothing. + } + @defmethod*[(((edit-menu:undo-callback (item (instance (subclass?/c menu-item%))) (evt (instance control-event%))) void))]{ + This method is called when the undo menu-item of the edit-menu menu is selected. + + + Defaultly bound to: + \begin{schemedisplay} + (λ (menu evt) + (let ((edit (get-edit-target-object))) + (when (and edit (is-a? edit editor<%>)) + (send edit do-edit-operation 'undo))) + #t) + \end{schemedisplay} + } + @defmethod*[(((edit-menu:get-undo-item) (instance menu-item%)))]{ + This method returns the \iscmclass{menu-item} that corresponds + to this menu item. + + } + @defmethod*[(((edit-menu:undo-string) string))]{ + The result of this method is the name of this menu. + + defaultly returns "(string-constant undo-menu-item)" + } + @defmethod*[(((edit-menu:undo-help-string) string))]{ + This result of this method is used as the help string when the + @scheme[menu-item%] + object is created. + + + Defaultly returns "\scheme{(string-constant undo-info)}" + } + @defmethod*[(((edit-menu:undo-on-demand (item menu-item%)) void))]{ + The menu item's on-demand method calls this method + + + Defaultly is this: + \scheme{(λ (item) (let* ((editor (get-edit-target-object)) (enable? (and editor (is-a? editor editor<\%>) (send editor can-do-edit-operation? (quote undo))))) (send item enable enable?)))} + } + @defmethod*[(((edit-menu:create-undo?) boolean))]{ + The result of this method determines if the + corresponding menu-item is created. Override this + to control the creation of the menu-item. + + + defaultly returns \#t + } + @defmethod*[(((edit-menu:redo-callback (item (instance (subclass?/c menu-item%))) (evt (instance control-event%))) void))]{ + This method is called when the redo menu-item of the edit-menu menu is selected. + + + Defaultly bound to: + \begin{schemedisplay} + (λ (menu evt) + (let ((edit (get-edit-target-object))) + (when (and edit (is-a? edit editor<%>)) + (send edit do-edit-operation 'redo))) + #t) + \end{schemedisplay} + } + @defmethod*[(((edit-menu:get-redo-item) (instance menu-item%)))]{ + This method returns the \iscmclass{menu-item} that corresponds + to this menu item. + + } + @defmethod*[(((edit-menu:redo-string) string))]{ + The result of this method is the name of this menu. + + defaultly returns "(string-constant redo-menu-item)" + } + @defmethod*[(((edit-menu:redo-help-string) string))]{ + This result of this method is used as the help string when the + @scheme[menu-item%] + object is created. + + + Defaultly returns "\scheme{(string-constant redo-info)}" + } + @defmethod*[(((edit-menu:redo-on-demand (item menu-item%)) void))]{ + The menu item's on-demand method calls this method + + + Defaultly is this: + \scheme{(λ (item) (let* ((editor (get-edit-target-object)) (enable? (and editor (is-a? editor editor<\%>) (send editor can-do-edit-operation? (quote redo))))) (send item enable enable?)))} + } + @defmethod*[(((edit-menu:create-redo?) boolean))]{ + The result of this method determines if the + corresponding menu-item is created. Override this + to control the creation of the menu-item. + + + defaultly returns \#t + } + @defmethod*[(((edit-menu:between-redo-and-cut (menu (instance (subclass?/c menu%)))) void))]{ + This method is called between the addition of the redo menu-item + and before the addition of the cut menu-item to the edit-menu menu. + Override it to add additional menus at that point. + + + Adds a separator menu item. + } + @defmethod*[(((edit-menu:cut-callback (item (instance (subclass?/c menu-item%))) (evt (instance control-event%))) void))]{ + This method is called when the cut menu-item of the edit-menu menu is selected. + + + Defaultly bound to: + \begin{schemedisplay} + (λ (menu evt) + (let ((edit (get-edit-target-object))) + (when (and edit (is-a? edit editor<%>)) + (send edit do-edit-operation 'cut))) + #t) + \end{schemedisplay} + } + @defmethod*[(((edit-menu:get-cut-item) (instance menu-item%)))]{ + This method returns the \iscmclass{menu-item} that corresponds + to this menu item. + + } + @defmethod*[(((edit-menu:cut-string) string))]{ + The result of this method is the name of this menu. + + defaultly returns "(string-constant cut-menu-item)" + } + @defmethod*[(((edit-menu:cut-help-string) string))]{ + This result of this method is used as the help string when the + @scheme[menu-item%] + object is created. + + + Defaultly returns "\scheme{(string-constant cut-info)}" + } + @defmethod*[(((edit-menu:cut-on-demand (item menu-item%)) void))]{ + The menu item's on-demand method calls this method + + + Defaultly is this: + \scheme{(λ (item) (let* ((editor (get-edit-target-object)) (enable? (and editor (is-a? editor editor<\%>) (send editor can-do-edit-operation? (quote cut))))) (send item enable enable?)))} + } + @defmethod*[(((edit-menu:create-cut?) boolean))]{ + The result of this method determines if the + corresponding menu-item is created. Override this + to control the creation of the menu-item. + + + defaultly returns \#t + } + @defmethod*[(((edit-menu:between-cut-and-copy (menu (instance (subclass?/c menu%)))) void))]{ + This method is called between the addition of the cut menu-item + and before the addition of the copy menu-item to the edit-menu menu. + Override it to add additional menus at that point. + + + Does nothing. + } + @defmethod*[(((edit-menu:copy-callback (item (instance (subclass?/c menu-item%))) (evt (instance control-event%))) void))]{ + This method is called when the copy menu-item of the edit-menu menu is selected. + + + Defaultly bound to: + \begin{schemedisplay} + (λ (menu evt) + (let ((edit (get-edit-target-object))) + (when (and edit (is-a? edit editor<%>)) + (send edit do-edit-operation 'copy))) + #t) + \end{schemedisplay} + } + @defmethod*[(((edit-menu:get-copy-item) (instance menu-item%)))]{ + This method returns the \iscmclass{menu-item} that corresponds + to this menu item. + + } + @defmethod*[(((edit-menu:copy-string) string))]{ + The result of this method is the name of this menu. + + defaultly returns "(string-constant copy-menu-item)" + } + @defmethod*[(((edit-menu:copy-help-string) string))]{ + This result of this method is used as the help string when the + @scheme[menu-item%] + object is created. + + + Defaultly returns "\scheme{(string-constant copy-info)}" + } + @defmethod*[(((edit-menu:copy-on-demand (item menu-item%)) void))]{ + The menu item's on-demand method calls this method + + + Defaultly is this: + \scheme{(λ (item) (let* ((editor (get-edit-target-object)) (enable? (and editor (is-a? editor editor<\%>) (send editor can-do-edit-operation? (quote copy))))) (send item enable enable?)))} + } + @defmethod*[(((edit-menu:create-copy?) boolean))]{ + The result of this method determines if the + corresponding menu-item is created. Override this + to control the creation of the menu-item. + + + defaultly returns \#t + } + @defmethod*[(((edit-menu:between-copy-and-paste (menu (instance (subclass?/c menu%)))) void))]{ + This method is called between the addition of the copy menu-item + and before the addition of the paste menu-item to the edit-menu menu. + Override it to add additional menus at that point. + + + Does nothing. + } + @defmethod*[(((edit-menu:paste-callback (item (instance (subclass?/c menu-item%))) (evt (instance control-event%))) void))]{ + This method is called when the paste menu-item of the edit-menu menu is selected. + + + Defaultly bound to: + \begin{schemedisplay} + (λ (menu evt) + (let ((edit (get-edit-target-object))) + (when (and edit (is-a? edit editor<%>)) + (send edit do-edit-operation 'paste))) + #t) + \end{schemedisplay} + } + @defmethod*[(((edit-menu:get-paste-item) (instance menu-item%)))]{ + This method returns the \iscmclass{menu-item} that corresponds + to this menu item. + + } + @defmethod*[(((edit-menu:paste-string) string))]{ + The result of this method is the name of this menu. + + defaultly returns "(string-constant paste-menu-item)" + } + @defmethod*[(((edit-menu:paste-help-string) string))]{ + This result of this method is used as the help string when the + @scheme[menu-item%] + object is created. + + + Defaultly returns "\scheme{(string-constant paste-info)}" + } + @defmethod*[(((edit-menu:paste-on-demand (item menu-item%)) void))]{ + The menu item's on-demand method calls this method + + + Defaultly is this: + \scheme{(λ (item) (let* ((editor (get-edit-target-object)) (enable? (and editor (is-a? editor editor<\%>) (send editor can-do-edit-operation? (quote paste))))) (send item enable enable?)))} + } + @defmethod*[(((edit-menu:create-paste?) boolean))]{ + The result of this method determines if the + corresponding menu-item is created. Override this + to control the creation of the menu-item. + + + defaultly returns \#t + } + @defmethod*[(((edit-menu:between-paste-and-clear (menu (instance (subclass?/c menu%)))) void))]{ + This method is called between the addition of the paste menu-item + and before the addition of the clear menu-item to the edit-menu menu. + Override it to add additional menus at that point. + + + Does nothing. + } + @defmethod*[(((edit-menu:clear-callback (item (instance (subclass?/c menu-item%))) (evt (instance control-event%))) void))]{ + This method is called when the clear menu-item of the edit-menu menu is selected. + + + Defaultly bound to: + \begin{schemedisplay} + (λ (menu evt) + (let ((edit (get-edit-target-object))) + (when (and edit (is-a? edit editor<%>)) + (send edit do-edit-operation 'clear))) + #t) + \end{schemedisplay} + } + @defmethod*[(((edit-menu:get-clear-item) (instance menu-item%)))]{ + This method returns the \iscmclass{menu-item} that corresponds + to this menu item. + + } + @defmethod*[(((edit-menu:clear-string) string))]{ + The result of this method is the name of this menu. + + defaultly returns "(if (eq? (system-type) (quote windows)) (string-constant clear-menu-item-windows) (string-constant clear-menu-item-windows))" + } + @defmethod*[(((edit-menu:clear-help-string) string))]{ + This result of this method is used as the help string when the + @scheme[menu-item%] + object is created. + + + Defaultly returns "\scheme{(string-constant clear-info)}" + } + @defmethod*[(((edit-menu:clear-on-demand (item menu-item%)) void))]{ + The menu item's on-demand method calls this method + + + Defaultly is this: + \scheme{(λ (item) (let* ((editor (get-edit-target-object)) (enable? (and editor (is-a? editor editor<\%>) (send editor can-do-edit-operation? (quote clear))))) (send item enable enable?)))} + } + @defmethod*[(((edit-menu:create-clear?) boolean))]{ + The result of this method determines if the + corresponding menu-item is created. Override this + to control the creation of the menu-item. + + + defaultly returns \#t + } + @defmethod*[(((edit-menu:between-clear-and-select-all (menu (instance (subclass?/c menu%)))) void))]{ + This method is called between the addition of the clear menu-item + and before the addition of the select-all menu-item to the edit-menu menu. + Override it to add additional menus at that point. + + + Does nothing. + } + @defmethod*[(((edit-menu:select-all-callback (item (instance (subclass?/c menu-item%))) (evt (instance control-event%))) void))]{ + This method is called when the select-all menu-item of the edit-menu menu is selected. + + + Defaultly bound to: + \begin{schemedisplay} + (λ (menu evt) + (let ((edit (get-edit-target-object))) + (when (and edit (is-a? edit editor<%>)) + (send edit do-edit-operation 'select-all))) + #t) + \end{schemedisplay} + } + @defmethod*[(((edit-menu:get-select-all-item) (instance menu-item%)))]{ + This method returns the \iscmclass{menu-item} that corresponds + to this menu item. + + } + @defmethod*[(((edit-menu:select-all-string) string))]{ + The result of this method is the name of this menu. + + defaultly returns "(string-constant select-all-menu-item)" + } + @defmethod*[(((edit-menu:select-all-help-string) string))]{ + This result of this method is used as the help string when the + @scheme[menu-item%] + object is created. + + + Defaultly returns "\scheme{(string-constant select-all-info)}" + } + @defmethod*[(((edit-menu:select-all-on-demand (item menu-item%)) void))]{ + The menu item's on-demand method calls this method + + + Defaultly is this: + \scheme{(λ (item) (let* ((editor (get-edit-target-object)) (enable? (and editor (is-a? editor editor<\%>) (send editor can-do-edit-operation? (quote select-all))))) (send item enable enable?)))} + } + @defmethod*[(((edit-menu:create-select-all?) boolean))]{ + The result of this method determines if the + corresponding menu-item is created. Override this + to control the creation of the menu-item. + + + defaultly returns \#t + } + @defmethod*[(((edit-menu:between-select-all-and-find (menu (instance (subclass?/c menu%)))) void))]{ + This method is called between the addition of the select-all menu-item + and before the addition of the find menu-item to the edit-menu menu. + Override it to add additional menus at that point. + + + Adds a separator menu item. + } + @defmethod*[(((edit-menu:find-callback (item (instance (subclass?/c menu-item%))) (evt (instance control-event%))) void))]{ + This method is called when the find menu-item of the edit-menu menu is selected. + + + Defaultly bound to: + \begin{schemedisplay} + (λ (item control) (void)) + \end{schemedisplay} + } + @defmethod*[(((edit-menu:get-find-item) (instance menu-item%)))]{ + This method returns the \iscmclass{menu-item} that corresponds + to this menu item. + + } + @defmethod*[(((edit-menu:find-string) string))]{ + The result of this method is the name of this menu. + + defaultly returns "(string-constant find-menu-item)" + } + @defmethod*[(((edit-menu:find-help-string) string))]{ + This result of this method is used as the help string when the + @scheme[menu-item%] + object is created. + + + Defaultly returns "\scheme{(string-constant find-info)}" + } + @defmethod*[(((edit-menu:find-on-demand (item menu-item%)) void))]{ + The menu item's on-demand method calls this method + + + Defaultly is this: + \scheme{(λ (item) (send item enable (let ((target (get-edit-target-object))) (and target (is-a? target editor<\%>)))))} + } + @defmethod*[(((edit-menu:create-find?) boolean))]{ + The result of this method determines if the + corresponding menu-item is created. Override this + to control the creation of the menu-item. + + + defaultly returns \#f + } + @defmethod*[(((edit-menu:find-again-callback (item (instance (subclass?/c menu-item%))) (evt (instance control-event%))) void))]{ + This method is called when the find-again menu-item of the edit-menu menu is selected. + + + Defaultly bound to: + \begin{schemedisplay} + (λ (item control) (void)) + \end{schemedisplay} + } + @defmethod*[(((edit-menu:get-find-again-item) (instance menu-item%)))]{ + This method returns the \iscmclass{menu-item} that corresponds + to this menu item. + + } + @defmethod*[(((edit-menu:find-again-string) string))]{ + The result of this method is the name of this menu. + + defaultly returns "(string-constant find-again-menu-item)" + } + @defmethod*[(((edit-menu:find-again-help-string) string))]{ + This result of this method is used as the help string when the + @scheme[menu-item%] + object is created. + + + Defaultly returns "\scheme{(string-constant find-again-info)}" + } + @defmethod*[(((edit-menu:find-again-on-demand (item menu-item%)) void))]{ + The menu item's on-demand method calls this method + + + Defaultly is this: + \scheme{(λ (item) (send item enable (let ((target (get-edit-target-object))) (and target (is-a? target editor<\%>)))))} + } + @defmethod*[(((edit-menu:create-find-again?) boolean))]{ + The result of this method determines if the + corresponding menu-item is created. Override this + to control the creation of the menu-item. + + + defaultly returns \#f + } + @defmethod*[(((edit-menu:replace-and-find-again-callback (item (instance (subclass?/c menu-item%))) (evt (instance control-event%))) void))]{ + This method is called when the replace-and-find-again menu-item of the edit-menu menu is selected. + + + Defaultly bound to: + \begin{schemedisplay} + (λ (item control) (void)) + \end{schemedisplay} + } + @defmethod*[(((edit-menu:get-replace-and-find-again-item) (instance menu-item%)))]{ + This method returns the \iscmclass{menu-item} that corresponds + to this menu item. + + } + @defmethod*[(((edit-menu:replace-and-find-again-string) string))]{ + The result of this method is the name of this menu. + + defaultly returns "(string-constant replace-and-find-again-menu-item)" + } + @defmethod*[(((edit-menu:replace-and-find-again-help-string) string))]{ + This result of this method is used as the help string when the + @scheme[menu-item%] + object is created. + + + Defaultly returns "\scheme{(string-constant replace-and-find-again-info)}" + } + @defmethod*[(((edit-menu:replace-and-find-again-on-demand (item menu-item%)) void))]{ + The menu item's on-demand method calls this method + + + Defaultly is this: + \scheme{(λ (item) (send item enable (let ((target (get-edit-target-object))) (and target (is-a? target editor<\%>)))))} + } + @defmethod*[(((edit-menu:create-replace-and-find-again?) boolean))]{ + The result of this method determines if the + corresponding menu-item is created. Override this + to control the creation of the menu-item. + + + defaultly returns \#f + } + @defmethod*[(((edit-menu:between-find-and-preferences (menu (instance (subclass?/c menu%)))) void))]{ + This method is called between the addition of the find menu-item + and before the addition of the preferences menu-item to the edit-menu menu. + Override it to add additional menus at that point. + + + Adds a separator except when \rawscm{current-eventspace-has-standard-menus?} returns \rawscm{\#t}. + } + @defmethod*[(((edit-menu:preferences-callback (item (instance (subclass?/c menu-item%))) (evt (instance control-event%))) void))]{ + This method is called when the preferences menu-item of the edit-menu menu is selected. + + + Defaultly bound to: + \begin{schemedisplay} + (λ (item control) (preferences:show-dialog) #t) + \end{schemedisplay} + } + @defmethod*[(((edit-menu:get-preferences-item) (instance menu-item%)))]{ + This method returns the \iscmclass{menu-item} that corresponds + to this menu item. + + } + @defmethod*[(((edit-menu:preferences-string) string))]{ + The result of this method is the name of this menu. + + defaultly returns "(string-constant preferences-menu-item)" + } + @defmethod*[(((edit-menu:preferences-help-string) string))]{ + This result of this method is used as the help string when the + @scheme[menu-item%] + object is created. + + + Defaultly returns "\scheme{(string-constant preferences-info)}" + } + @defmethod*[(((edit-menu:preferences-on-demand (item menu-item%)) void))]{ + The menu item's on-demand method calls this method + + + Defaultly is this: + \scheme{(λ (menu-item) (void))} + } + @defmethod*[(((edit-menu:create-preferences?) boolean))]{ + The result of this method determines if the + corresponding menu-item is created. Override this + to control the creation of the menu-item. + + + defaultly returns (not (current-eventspace-has-standard-menus?)) + } + @defmethod*[(((edit-menu:after-preferences (menu (instance (subclass?/c menu%)))) void))]{ + This method is called after the addition of the preferences menu-item + to the edit-menu menu. + Override it to add additional menus at that point. + + + Does nothing. + } + @defmethod*[(((help-menu:before-about (menu (instance (subclass?/c menu%)))) void))]{ + This method is called before the addition of the about menu-item + to the help-menu menu. + Override it to add additional menus at that point. + + + Does nothing. + } + @defmethod*[(((help-menu:about-callback (item (instance (subclass?/c menu-item%))) (evt (instance control-event%))) void))]{ + This method is called when the about menu-item of the help-menu menu is selected. + + + Defaultly bound to: + \begin{schemedisplay} + (λ (item control) (void)) + \end{schemedisplay} + } + @defmethod*[(((help-menu:get-about-item) (instance menu-item%)))]{ + This method returns the \iscmclass{menu-item} that corresponds + to this menu item. + + } + @defmethod*[(((help-menu:about-string) string))]{ + The result of this method is the name of this menu. + + defaultly returns "(string-constant about-menu-item)" + } + @defmethod*[(((help-menu:about-help-string) string))]{ + This result of this method is used as the help string when the + @scheme[menu-item%] + object is created. + + + Defaultly returns "\scheme{(string-constant about-info)}" + } + @defmethod*[(((help-menu:about-on-demand (item menu-item%)) void))]{ + The menu item's on-demand method calls this method + + + Defaultly is this: + \scheme{(λ (menu-item) (void))} + } + @defmethod*[(((help-menu:create-about?) boolean))]{ + The result of this method determines if the + corresponding menu-item is created. Override this + to control the creation of the menu-item. + + + defaultly returns \#f + } + @defmethod*[(((help-menu:after-about (menu (instance (subclass?/c menu%)))) void))]{ + This method is called after the addition of the about menu-item + to the help-menu menu. + Override it to add additional menus at that point. + + + Does nothing. + } +} +@defmixin[frame:standard-menus-mixin (frame:basic<%>) (frame:standard-menus<%>)]{ + The result of this mixin implements + @scheme[frame:standard-menus<%>]. + @defmethod*[#:mode augment (((on-close) void))]{ + Removes the preferences callbacks for the menu items + } +} +@definterface[frame:editor<%> (frame:standard-menus<%>)]{ + Frame classes matching this interface support embedded editors. + @defmethod*[(((get-entire-label) string))]{ + This method returns the entire label for the frame. + See also + @method[window<%> set-label] + and + @method[frame:editor<%> set-label-prefix]. + + } + @defmethod*[(((get-label-prefix) string))]{ + This returns the prefix for the frame's label. + + } + @defmethod*[(((set-label-prefix (prefix string)) void))]{ + Sets the prefix for the label of the frame. + + } + @defmethod*[(((get-canvas%) (subclass?/c editor-canvas%)))]{ + The result of this method is used to create the canvas for the + @scheme[editor<%>] + in this frame. + + + Returns + @scheme[editor-canvas%]. + } + @defmethod*[(((get-canvas<%>) (instance canvas:basic%)))]{ + The result of this method is used to guard the result of the + @method[frame:editor<%> get-canvas\%] + method. + + } + @defmethod*[(((get-editor%) (is-a?/c editor<%>)))]{ + The result of this class is used to create the + @scheme[editor<%>] + in this frame. + + Override this method to specify a different editor class. + + + Returns the value of the init-field \scheme|editor%|. + } + @defmethod*[(((get-editor<%>) interface))]{ + The result of this method is used by + @method[frame:editor<%> make-editor] + to check that + @method[frame:editor<%> get-editor\%] + is returning a reasonable editor. + + + Returns + @scheme[editor<%>]. + } + @defmethod*[(((make-editor) (instance (is-a?/c editor<%>))))]{ + This method is called to create the editor in this frame. + It calls + @method[frame:editor<%> get-editor<\%>] + and uses that interface to make sure the result of + @method[frame:editor<%> get-editor\%] + is reasonable. + + + + Calls \rawscm{(make-object @method[frame:editor<%> get-editor\%])}. + + } + @defmethod*[(((revert) void))]{ + + Loads the most recently saved version of the file to the disk. If the + @scheme[editor<%>] + is a + @scheme[text%], the start and end positions are restored. + } + @defmethod*[(((save (format (union (quote guess) (quote standard) (quote text) (quote text-force-cr) (quote same) (quote copy)) (quote same))) boolean))]{ + Saves the file being edited, possibly calling + @method[frame:editor<%> save-as] + if the editor has no filename yet. + + + Returns \rawscm{\#f} if the user cancels this operation + (only possible when the file has not been saved before and + the user is prompted for a new filename) and returns + \rawscm{\#t} if not. + } + @defmethod*[(((save-as (format (union (quote guess) (quote standard) (quote text) (quote text-force-cr) (quote same) (quote copy)) (quote same))) boolean))]{ + Queries the use for a file name and saves the file with that name. + + + Returns \rawscm{\#f} if the user cancells the file-choosing + dialog and returns \rawscm{\#t} otherwise. + } + @defmethod*[(((get-canvas) (instance (subclass?/c canvas%))))]{ + Returns the canvas used to display the + @scheme[editor<%>] + in this frame. + + + } + @defmethod*[(((get-editor) (instance (is-a?/c editor<%>))))]{ + Returns the editor in this frame. + + + } +} +@defmixin[frame:editor-mixin (frame:standard-menus<%>) (frame:editor<%>)]{ + This mixin adds functionality to support an + @scheme[editor<%>] + in the frame. This + includes management of the title, implementations of some of the menu + items, a reasonable initial size, and access to the + @scheme[editor<%>] + itself. + + The size of this frame with be either 600 by 650 or 65 less than the + width and height of the screen, whichever is smaller. + + @defconstructor[((filename string?) (editor% (is-a?/c editor<%>)) (parent (or/c (is-a?/c frame%) false/c) #f) (width (or/c (integer-in 0 10000) false/c) #f) (height (or/c (integer-in 0 10000) false/c) #f) (x (or/c (integer-in -10000 10000) false/c) #f) (y (or/c (integer-in -10000 10000) false/c) #f) (style (listof (one-of/c (quote no-resize-border) (quote no-caption) (quote no-system-menu) (quote hide-menu-bar) (quote mdi-parent) (quote mdi-child) (quote toolbar-button) (quote float) (quote metal))) null) (enabled any/c #t) (border (integer-in 0 1000) 0) (spacing (integer-in 0 1000) 0) (alignment (list/c (one-of/c (quote left) (quote center) (quote right)) (one-of/c (quote top) (quote center) (quote bottom))) (quote (center top))) (min-width (integer-in 0 10000) graphical-minimum-width) (min-height (integer-in 0 10000) graphical-minimum-height) (stretchable-width any/c #t) (stretchable-height any/c #t))]{ + + } + @defmethod*[#:mode override (((get-filename) (union |#f| path)))]{ + + Returns the filename in the editor returned by + @method[frame:editor<%> get-editor]. + } + @defmethod*[#:mode override (((editing-this-file? (filename path)) boolean))]{ + + Returns \scheme|#t| if the filename is the file that this + frame is editing. + } + @defmethod*[#:mode augment (((on-close) void))]{ + + Calls the + @scheme[editor:basic<%>]'s method + @method[editor:basic<%> on-close]. + } + @defmethod*[#:mode augment (((can-close?) void))]{ + + Calls the + @scheme[editor:basic<%>]'s method + @method[editor:basic<%> can-close?]. + } + @defmethod*[#:mode override (((get-label) string))]{ + + Returns the portion of the label after the hyphen. See also + @method[frame:editor<%> get-entire-label]. + } + @defmethod*[#:mode override (((set-label (label string?)) void))]{ + + Sets the label, but preserves the label's prefix. See also + @method[frame:editor<%> set-label-prefix]. + } + @defmethod*[#:mode override (((file-menu:open-callback (item any) (evt mouse-event)) void))]{ + + Calls + @scheme[handler:open-file] + with the directory of the saved file associated with this editor + (if any). + } + @defmethod*[#:mode override (((file-menu:revert-on-demand) void))]{ + + Disables the menu item when the editor is locked. + } + @defmethod*[#:mode override (((file-menu:revert-callback (item (is-a?/c menu-item%)) (evt (is-a?/c control-event%))) void))]{ + + Informs the user that this action is not undoable and, + if they still want to continue, calls + @method[frame:editor<%> revert]. + } + @defmethod*[#:mode override (((file-menu:create-revert?) boolean))]{ + + returns \#t + } + @defmethod*[#:mode override (((file-menu:save-callback (item (is-a?/c menu-item%)) (evt (is-a?/c control-event%))) void))]{ + + Saves the file in the editor. + } + @defmethod*[#:mode override (((file-menu:create-save?) boolean))]{ + + returns \#t + } + @defmethod*[#:mode override (((file-menu:save-as-callback (item (is-a?/c menu-item%)) (evt (is-a?/c control-event%))) void))]{ + + Prompts the user for a file name and uses that filename to save the buffer. + Calls + @method[frame:editor<%> save-as] + with no arguments. + } + @defmethod*[#:mode override (((file-menu:create-save-as?) boolean))]{ + + returns \#t + } + @defmethod*[#:mode override (((file-menu:print-callback (item (is-a?/c menu-item%)) (evt (is-a?/c control-event%))) void))]{ + + Calls the + @method[editor<%> print] + method of + @scheme[editor<%>] + with the default arguments, except that + the \var{output-mode} argument + is the result of calling + @scheme[preferences:get] + with \rawscm{'framework:print-output-mode}. + } + @defmethod*[#:mode override (((file-menu:create-print?) boolean))]{ + + returns \#t + } + @defmethod*[#:mode override (((file-menu:between-save-as-and-print (file-menu (is-a?/c menu%))) void))]{ + + Creates a Print Setup menu item. + } + @defmethod*[#:mode override (((edit-menu:between-select-all-and-find (edit-menu (instance menu%))) void))]{ + + Adds a menu item for toggling + @method[editor<%> auto-wrap] + in the focused text. + + } + @defmethod*[#:mode override (((help-menu:about-callback (item (is-a?/c menu-item%)) (evt (is-a?/c control-event%))) void))]{ + + Calls + @scheme[message-box] + with a message welcoming the user to the application named by + @scheme[application:current-app-name] + + } + @defmethod*[#:mode override (((help-menu:about-string) string))]{ + + Returns the result of (@scheme[application:current-app-name]) + } + @defmethod*[#:mode override (((help-menu:create-about?) boolean))]{ + + returns \#t + } +} +@definterface[frame:open-here<%> (frame:editor<%>)]{ + Frames implementing this mixin can change the file they are + displaying. + + The frame is only re-used when the + \scheme|'framework:open-here?| preference is set + (see + @scheme[preferences:get] + and + @scheme[preferences:set] + for details on preferences). + + The + @scheme[frame:open-here-mixin] + implements this interface. + @defmethod*[(((get-open-here-editor) (is-a?/c editor<%>)))]{ + When the user switches the visible file in this frame, + the of this method is the editor that gets switched. + + + Defaultly returns the result of + @method[frame:editor<%> get-editor]. + } + @defmethod*[(((open-here (filename string)) void))]{ + + Opens \var{filename} in the current frame, possibly + prompting the user about saving a file (in which case the + frame might not get switched). + } +} +@defmixin[frame:open-here-mixin (frame:editor<%>) (frame:open-here<%>)]{ + Provides an implementation of + @scheme[frame:open-here<%>] + @defmethod*[#:mode override (((file-menu:new-on-demand (item (is-a?/c menu-item%))) void))]{ + + Sets the label of \var{item} to + "New..." if the preference \scheme|'framework:open-here?| is set. + } + @defmethod*[#:mode override (((file-menu:new-callback (item (instance (subclass?/c menu-item%))) (evt (instance control-event%))) void))]{ + + When the preference \scheme|'framework:open-here?| + preference is set, this method prompts the user, asking if + they would like to create a new frame, or just clear out + this one. If they clear it out and the file hasn't been + saved, they are asked about saving. + } + @defmethod*[#:mode override (((file-menu:open-on-demand (item (is-a?/c menu-item%))) void))]{ + + Sets the label of \var{item} to + "Open Here..." if the preference \scheme|'framework:open-here?| is set. + } + @defmethod*[#:mode augment (((on-close) void))]{ + + Calls + @method[group:% set-open-here-frame] + with \scheme|#f| if + the result of + @method[group:% get-open-here-frame] + is \scheme|eq?| to \scheme|this|. + } + @defmethod*[#:mode override (((on-activate (on? boolean)) void))]{ + + When \var{on?} is \scheme|#t|, calls + @method[group:% set-open-here-frame] + with \scheme|this|. + } +} +@definterface[frame:text<%> (frame:editor<%>)]{ + Frames matching this interface provide support for + @scheme[text%]s. + +} +@defmixin[frame:text-mixin (frame:editor<%>) (frame:text<%>)]{ + This mixins adds support for + @scheme[text%]s in the frame. + + @defconstructor[((editor% (extends text%)))]{ + + Calls the super initialization with either the value of the + \scheme|editor%| init or, if none was supplied, it passes \scheme|text%|. + } + @defmethod*[#:mode override (((get-editor<%>) interface))]{ + + Returns \rawscm{(class->interface \iscmclass{text})}. + } +} +@definterface[frame:pasteboard<%> (frame:editor<%>)]{ + Frames matching this interface provide support for + @scheme[pasteboard%]s. +} +@defmixin[frame:pasteboard-mixin (frame:editor<%>) (frame:pasteboard<%>)]{ + This mixin provides support for pasteboards in a frame. + + @defconstructor[((editor% (extends pasteboard%)))]{ + + Calls the super initialization with either the value of the + \scheme|editor%| init or, if none was supplied, it passes \scheme|pasteboard%|. + + } + @defmethod*[#:mode override (((get-editor<%>) interface))]{ + + Returns \rawscm{(class->interface \iscmclass{pasteboard})}. + } +} +@definterface[frame:delegate<%> (frame:status-line<%> frame:text<%>)]{ + Frames that implement this interface provide a 20,000 feet + overview of the text in the main editor. The term {\bf + delegate} in these method descriptions refers to the + original editor and the term {\bf delegatee} refers to the + editor showing the 20,000 feet overview. + @defmethod*[(((get-delegated-text) (instanceof (is-a?/c text:delegate<%>))))]{ + Returns the delegate text. + + } + @defmethod*[(((delegated-text-shown?) boolean))]{ + Returns \rawscm{\#t} if the delegate is visible, and + \rawscm{\#f} if it isn't. + + } + @defmethod*[(((hide-delegated-text) void))]{ + Hides the delegated text. + + When the delegated text is hidden, it is not being + updated. This is accomplished by calling the + @method[text:delegate<%> set-delegate] + method of + @method[frame:editor<%> get-editor]with \rawscm{\#f}. + + See also + @method[frame:delegate<%> show-delegated-text] + + } + @defmethod*[(((show-delegated-text) void))]{ + Makes the delegated text visible. + + When the delegated text is shown, the + @method[text:delegate<%> set-delegate] + method of + @method[frame:delegate<%> get-delegated-text]is called with + the text to delegate messages to. + + See also + @method[frame:delegate<%> hide-delegated-text]. + + } + @defmethod*[(((delegate-moved) void))]{ + This method is called when the visible region of the + delegate editor changes, so that the blue region in the + delegatee is updated. + + } +} +@defmixin[frame:delegate-mixin (frame:status-line<%> frame:text<%>) (frame:delegate<%>)]{ + Adds support for a 20,000-feet view via + \iscmintf{text:delegate} and \iscmmixin{text:delegate-mixin} + @defmethod*[#:mode override (((make-root-area-container (class (subclass?/c panel%)) (parent (instanceof (subclass?/c panel%)))) (is-a?/c panel%)))]{ + + adds a panel outside to hold the delegate + \iscmclass{editor-canvas} and \iscmclass{text}. + + } + @defmethod*[#:mode override (((get-editor<%>) interface))]{ + + Returns \iscmintf{text:delegate}. + + } + @defmethod*[#:mode override (((get-editor%) (is-a?/c text:delegate<%>)))]{ + + returns the super result, with the + @scheme[text:delegate-mixin] + mixed in. + } +} +@definterface[frame:searchable<%> (frame:basic<%>)]{ + Frames that implement this interface support searching. + @defmethod*[(((get-text-to-search) (instance (subclass?/c text%))))]{ + Override this method to specify which text to search. + + + Returns the result of + @method[frame:editor<%> get-editor]. + } + @defmethod*[(((hide-search) void))]{ + This method hides the searching information on the bottom of the + frame. + + } + @defmethod*[(((unhide-search) void))]{ + When the searching sub window is hidden, makes it visible. + + } + @defmethod*[(((set-search-direction (dir (union -1 1))) void))]{ + Sets the direction that future searches will be performed. + + + If \var{dir} is \rawscm{1} searches will be performed forwards and if + \var{dir} is \rawscm{-1} searches will be performed backwards. + } + @defmethod*[(((replace&search) boolean))]{ + Calls + @method[frame:searchable<%> replace] + and if it returns \rawscm{\#t}, calls + @method[frame:searchable<%> search-again]. + + } + @defmethod*[(((replace-all) void))]{ + Loops through the text from the current position to the end, replacing + all occurrences of the search string with the contents of the replace + edit. Only searches forward, does not loop around to the beginning of + the text. + + } + @defmethod*[(((replace) boolean))]{ + If the selected text matches the search string, this method replaces + the text with the contents of the replace text. If the replace was + successful, \rawscm{\#t} is returned. Otherwise, \rawscm{\#f} is returned. + + } + @defmethod*[(((can-replace?) boolean))]{ + Returns \rawscm{\#t} if a replace command would succeed. + + + Defaultly is \rawscm{\#t} when the selected text in the result of + @method[frame:searchable<%> get-text-to-search] + is the same as the text in the find text. + } + @defmethod*[(((toggle-search-focus) void))]{ + Toggles the keyboard focus between the searching edit, the replacing edit and the result of + @method[frame:searchable<%> get-text-to-search]. + + } + @defmethod*[(((move-to-search-or-search) (union boolean void)))]{ + This method moves the focus to the text that contains the search + string, or if the focus is there already, performs a forward search. + + It returns void if the focus was not to the search text, otherwise it + returns a boolean indicating the success of the search. + + + } + @defmethod*[(((move-to-search-or-reverse-search) (union boolean void)))]{ + This method moves the focus to the text that contains the search + string, or if the focus is there already, performs a reverse search. + + It returns void if the focus was not to the search text, otherwise it + returns a boolean indicating the success of the search. + + } + @defmethod*[(((search-again (direction Symbol (rm previous searching direction)) (beep? bool |#t|)) boolean))]{ + Searches for the text in the search edit in the result of + @method[frame:searchable<%> get-text-to-search]. + + + Returns \rawscm{\#t} if the text is found and sets the selection to the + found text. If the text is not found it returns \rawscm{\#f}. + } +} +@defmixin[frame:searchable-mixin (frame:standard-menus<%>) (frame:searchable<%>)]{ + This mixin adds support for searching in the + @scheme[editor<%>] + in this frame. + + The result of this mixin uses the same initialization arguments as the + mixin's argument. + @defmethod*[#:mode override (((edit-menu:find-callback (item (is-a?/c menu-item%)) (evt (is-a?/c control-event%))) void))]{ + + Calls + @method[frame:searchable<%> move-to-search-or-search]. + } + @defmethod*[#:mode override (((edit-menu:create-find?) boolean))]{ + + returns \#t + } + @defmethod*[#:mode override (((edit-menu:find-again-callback) boolean))]{ + + Returns \rawscm{\#t}, and searches for the same text that was last + searched for in the text. + } + @defmethod*[#:mode override (((edit-menu:create-find-again?) boolean))]{ + + returns \#t + } + @defmethod*[#:mode override (((edit-menu:replace-and-find-again-callback) boolean))]{ + + Returns \rawscm{\#t}, and if the selected text matches the current text + in the find box, replaces it with the contents of the replace box and + searches for the next occurrence of the text in the find box. + + + } + @defmethod*[#:mode override (((edit-menu:replace-and-find-again-on-demand (item menu-item%)) void))]{ + + Disables \var{item} when + @method[frame:searchable<%> can-replace?] + returns \rawscm{\#f} and enables it when that method returns + \rawscm{\#t}. + } + @defmethod*[#:mode override (((edit-menu:create-replace-and-find-again?) boolean))]{ + + returns \#t + } + @defmethod*[#:mode override (((make-root-area-container) (is-a?/c area-container<%>)))]{ + + Builds a panel for the searching information. + } + @defmethod*[#:mode override (((on-activate) void))]{ + + When the frame is activated, searches will take place in this frame. + } + @defmethod*[#:mode augment (((on-close) void))]{ + + Cleans up after the searching frame. + } +} +@definterface[frame:searchable-text<%> (frame:searchable<%> frame:text<%>)]{ + +} +@defmixin[frame:searchable-text-mixin (frame:text<%> frame:searchable<%>) (frame:searchable-text<%>)]{ + + @defmethod*[#:mode override (((get-text-to-search) (instanceof text%)))]{ + + Returns the result of + @method[frame:editor<%> get-editor]. + } + @defmethod*[#:mode override (((get-editor<%>) (is-a?/c editor<%>)))]{ + + Returns + @scheme[text:searching<%>]. + } + @defmethod*[#:mode override (((get-editor%) (is-a?/c editor<%>)))]{ + + Returns + @scheme[text:searching%]. + } +} +@defclass[frame:basic% (frame:register-group-mixin (frame:basic-mixin frame%)) ()]{} +@defclass[frame:size-pref% (frame:size-pref-mixin frame:basic%) ()]{} +@defclass[frame:info% (frame:info-mixin frame:basic%) ()]{} +@defclass[frame:text-info% (frame:text-info-mixin frame:info%) ()]{} +@defclass[frame:pasteboard-info% (frame:pasteboard-info-mixin frame:text-info%) ()]{} +@defclass[frame:status-line% (frame:status-line-mixin frame:text-info%) ()]{} +@defclass[frame:standard-menus% (frame:standard-menus-mixin frame:status-line%) ()]{} +@defclass[frame:editor% (frame:editor-mixin frame:standard-menus%) ()]{} +@defclass[frame:open-here% (frame:open-here-mixin frame:editor%) ()]{} +@defclass[frame:text% (frame:text-mixin frame:open-here%) ()]{} +@defclass[frame:searchable% (frame:searchable-text-mixin (frame:searchable-mixin frame:text%)) ()]{} +@defclass[frame:delegate% (frame:delegate-mixin frame:searchable%) ()]{} +@defclass[frame:pasteboard% (frame:pasteboard-mixin frame:open-here%) ()]{} +@(require framework/framework-docs) +@(def-fw-procs frame) diff --git a/collects/scribblings/framework/framework-group.scrbl b/collects/scribblings/framework/framework-group.scrbl new file mode 100644 index 0000000000..2f6900896f --- /dev/null +++ b/collects/scribblings/framework/framework-group.scrbl @@ -0,0 +1,124 @@ +#lang scribble/doc +@(require scribble/manual) +@(require (for-label framework/framework)) +@(require (for-label scheme/gui)) +@title{Group} + +@defclass[group:% object% ()]{ + This class manages a group of frames matching the + @scheme[frame:basic<%>] + interface. There is one instance created by + the framework, returned by the function + @scheme[group:get-the-frame-group] + and every frame that was constructed with + @scheme[frame:basic-mixin] + adds itself to the result of + @scheme[group:get-the-frame-group]. + @defmethod*[(((set-open-here-frame (frame (is-a?/c frame:editor%))) void))]{ + Sets the frame to load new files into. + See also + @scheme[frame:open-here<%>]. + + + } + @defmethod*[(((get-open-here-frame) (union |#f| (is-a?/c frame:editor<%>))))]{ + Returns the currently saved frame + to load new files into. + + } + @defmethod*[(((get-mdi-parent) (union |#f| (instance frame%))))]{ + The result of this method must be used as the parent frame for each + frame in the group. + + } + @defmethod*[(((get-frames) (list-of (instance frame:basic<%>))))]{ + Returns the frames in the group. + + } + @defmethod*[(((frame-label-changed (frame (is-a?/c frame:basic<%>))) void))]{ + This method is called by frames constructed with + @scheme[frame:basic-mixin] + when their titles change. + + + Updates the windows menu of each frame in the group. + } + @defmethod*[(((frame-shown/hidden) void))]{ + This method is called by instances of + @scheme[frame:basic%] + to notify the frame group that + a frame's visibility is changed. + + + Updates the Windows menus of all of the frames in the frame group. + } + @defmethod*[(((for-each-frame (f ((instance frame:basic<%>) -> void))) void))]{ + This method applies a function to each frame in the group. It also + remembers the function and applies it to any new frames that are added + to the group when they are added. + + See also + @method[group:% get-frames]. + + + Applies \var{f} to each frame in the group + } + @defmethod*[(((get-active-frame) (is-a?/c frame:basic<%>)))]{ + Returns the frame with the keyboard focus or the first frame in the + group. + + } + @defmethod*[(((set-active-frame (frame (is-a?/c frame:basic<%>))) void))]{ + Sets the active frame in the group. + This method is called by + @method[frame:register-group-mixin on-focus]. + + } + @defmethod*[(((insert-frame (frame (is-a?/c frame:basic<%>))) void))]{ + Inserts a frame into the group. + + } + @defmethod*[(((remove-frame (frame (is-a?/c frame:basic<%>))) void))]{ + Removes a frame from the group. + + + } + @defmethod*[(((clear) boolean))]{ + This removes all of the frames in the group. It does not close the frames. See also + @method[group:% on-close-all]and + @method[group:% can-close-all?]. + + } + @defmethod*[(((on-close-all) void))]{ + Call this method to close all of the frames in the group. + The function + @method[group:% can-close-all?] + must have been called just before this function and it must have returned + \rawscm{\#t}. + + + Calls the + @method[top-level-window<%> on-close] + method and the + @method[top-level-window<%> show] + method (with \rawscm{\#f} as argument) + on each frame in the group. + } + @defmethod*[(((can-close-all?) void))]{ + Call this method to make sure that closing all of the frames in the frame groups is + permitted by the user. The function + @method[group:% on-close-all] + is expected to be called just after this method is called. + + + Calls the + @method[top-level-window<%> can-close?] + method of each frame in the group. + } + @defmethod*[(((locate-file) (union |#f| (is-a?/c frame:basic<%>))))]{ + Returns the frame that is editing or viewing a particular file. + + } +} +@(require framework/framework-docs) +@(def-fw-procs group) diff --git a/collects/scribblings/framework/framework-handler.scrbl b/collects/scribblings/framework/framework-handler.scrbl new file mode 100644 index 0000000000..7c52d1a572 --- /dev/null +++ b/collects/scribblings/framework/framework-handler.scrbl @@ -0,0 +1,8 @@ +#lang scribble/doc +@(require scribble/manual) +@(require (for-label framework/framework)) +@(require (for-label scheme/gui)) +@title{Handler} + +@(require framework/framework-docs) +@(def-fw-procs handler) diff --git a/collects/scribblings/framework/framework-icon.scrbl b/collects/scribblings/framework/framework-icon.scrbl new file mode 100644 index 0000000000..1d34c1722b --- /dev/null +++ b/collects/scribblings/framework/framework-icon.scrbl @@ -0,0 +1,8 @@ +#lang scribble/doc +@(require scribble/manual) +@(require (for-label framework/framework)) +@(require (for-label scheme/gui)) +@title{Icon} + +@(require framework/framework-docs) +@(def-fw-procs icon) diff --git a/collects/scribblings/framework/framework-keymap.scrbl b/collects/scribblings/framework/framework-keymap.scrbl new file mode 100644 index 0000000000..5a82d3cf34 --- /dev/null +++ b/collects/scribblings/framework/framework-keymap.scrbl @@ -0,0 +1,45 @@ +#lang scribble/doc +@(require scribble/manual) +@(require (for-label framework/framework)) +@(require (for-label scheme/gui)) +@title{Keymap} + +@definterface[keymap:aug-keymap<%> (keymap%)]{ + This keymap overrides some of the built in \iscmclass{keymap} methods + to be able to extract the keybindings from the keymap. + @defmethod*[(((get-chained-keymaps) (listof (instance keymap%))))]{ + + Returns the list of keymaps that are chained to this one. + } + @defmethod*[(((get-map-function-table) hash-table))]{ + + Returns a hash-table that maps symbols naming key sequences to the + names of the keymap functions the are bound to. + } + @defmethod*[(((get-map-function-table/ht (ht hash-table)) hash-table))]{ + + This is a helper function for + @method[keymap:aug-keymap<%> get-map-function-table] + that returns the same result, except it accepts a hash-table that + it inserts the bindings into. It does not replace any bindings already in + \var{ht}. + } +} +@defmixin[keymap:aug-keymap-mixin (keymap%) (keymap:aug-keymap<%>)]{ + @defmethod*[#:mode override (((chain-to-keymap (next (instance keymap%)) (prefix? boolean)) void))]{ + + Keeps a list of the keymaps chained to this one. + } + @defmethod*[#:mode override (((remove-chained-keymap (keymap (is-a?/c keymap))) void))]{ + + Keeps the list of the keymaps chained to this one up to date. + } + @defmethod*[#:mode override (((map-function (key-name string) (function-name string)) void))]{ + + Keeps a separate record of the key names and functions that they are + bound to in this keymap. + } +} +@defclass[keymap:aug-keymap% (keymap:aug-keymap-mixin keymap%) ()]{} +@(require framework/framework-docs) +@(def-fw-procs keymap) diff --git a/collects/scribblings/framework/framework-main.scrbl b/collects/scribblings/framework/framework-main.scrbl new file mode 100644 index 0000000000..673526696e --- /dev/null +++ b/collects/scribblings/framework/framework-main.scrbl @@ -0,0 +1,8 @@ +#lang scribble/doc +@(require scribble/manual) +@(require (for-label framework/framework)) +@(require (for-label scheme/gui)) +@title{Main} + +@(require framework/framework-docs) +@(def-fw-procs main) diff --git a/collects/scribblings/framework/framework-menu.scrbl b/collects/scribblings/framework/framework-menu.scrbl new file mode 100644 index 0000000000..93d79ed00b --- /dev/null +++ b/collects/scribblings/framework/framework-menu.scrbl @@ -0,0 +1,48 @@ +#lang scribble/doc +@(require scribble/manual) +@(require (for-label framework/framework)) +@(require (for-label scheme/gui)) +@title{Menu} + +@definterface[menu:can-restore<%> (selectable-menu-item<%>)]{ + Classes created with this mixin remember their keybindings so the + keybindings can be removed and then restored. + @defmethod*[(((restore-keybinding) void))]{ + Sets the keyboard shortcut to the setting it had when the class was + created. + + } +} +@defmixin[menu:can-restore-mixin (selectable-menu-item<%>) (menu:can-restore<%>)]{ + +} +@definterface[menu:can-restore-underscore<%> (labelled-menu-item<%>)]{ + These menus can save and restore the underscores (indicated + via the \& characters in the original labels) in their + labels. + + If the preference \scm{'framework:menu-bindings} + is \scm{\#f}, calls + @method[menu:can-restore-underscore<%> erase-underscores] + during initialization. + @defmethod*[(((erase-underscores) void))]{ + Erases the underscores in the label of this menu, but + remembers them so they can be restores with + @method[menu:can-restore-underscore<%> restore-underscores]. + + } + @defmethod*[(((restore-underscores) void))]{ + Restores underscores in the menu's label to their original + state. + + + } +} +@defmixin[menu:can-restore-underscore-mixin (labelled-menu-item<%>) (menu:can-restore-underscore<%>)]{ + +} +@defclass[menu:can-restore-menu-item% (menu:can-restore-mixin menu-item%) ()]{} +@defclass[menu:can-restore-checkable-menu-item% (menu:can-restore-mixin checkable-menu-item%) ()]{} +@defclass[menu:can-restore-underscore-menu% (menu:can-restore-underscore-mixin menu%) ()]{} +@(require framework/framework-docs) +@(def-fw-procs menu) diff --git a/collects/scribblings/framework/framework-mode.scrbl b/collects/scribblings/framework/framework-mode.scrbl new file mode 100644 index 0000000000..c5c2e4642b --- /dev/null +++ b/collects/scribblings/framework/framework-mode.scrbl @@ -0,0 +1,8 @@ +#lang scribble/doc +@(require scribble/manual) +@(require (for-label framework/framework)) +@(require (for-label scheme/gui)) +@title{Mode} + +@(require framework/framework-docs) +@(def-fw-procs mode) diff --git a/collects/scribblings/framework/framework-number-snip.scrbl b/collects/scribblings/framework/framework-number-snip.scrbl new file mode 100644 index 0000000000..788776fdcb --- /dev/null +++ b/collects/scribblings/framework/framework-number-snip.scrbl @@ -0,0 +1,15 @@ +#lang scribble/doc +@(require scribble/manual) +@(require (for-label framework/framework)) +@(require (for-label scheme/gui)) +@title{Number Snip} + +@defclass[number-snip:snip-class% snip-class% ()]{ + + @defmethod*[#:mode override (((read (f stream-in)) snip))]{ + + Constructs a number snip from its input. + } +} +@(require framework/framework-docs) +@(def-fw-procs number-snip) diff --git a/collects/scribblings/framework/framework-panel.scrbl b/collects/scribblings/framework/framework-panel.scrbl new file mode 100644 index 0000000000..c283be6b5c --- /dev/null +++ b/collects/scribblings/framework/framework-panel.scrbl @@ -0,0 +1,171 @@ +#lang scribble/doc +@(require scribble/manual) +@(require (for-label framework/framework)) +@(require (for-label scheme/gui)) +@title{Panel} + +@definterface[panel:single<%> (area-container<%>)]{ + See + @scheme[panel:single-mixin%]. + @defmethod*[(((active-child (child (is-a?/c area<%>))) void) ((active-child) (is-a?/c area<%>)))]{ + + Sets the active child to be \var{child} + + + Returns the current active child. + } +} +@defmixin[panel:single-mixin (area-container<%>) (panel:single<%>)]{ + This mixin adds single panel functionality to an implementation of the + \iscmintf{area-container} interface. + + Single panels place all of the children in the center of the panel, + and allow make one child to be visible at a time. The + @method[panel:single<%> active-child] + method controls which panel is currently active. + + The + @method[window<%> show] + method is used to hide and show the children of a single panel. + @defmethod*[#:mode override (((after-new-child (child subarea<%>)) void))]{ + + Hides this child by calling \scmline{(send child show \#f)}, unless + this is the first child in which case it does nothing. + } + @defmethod*[#:mode override (((container-size) (values exact-integer exact-integer)))]{ + + Returns the maximum width of all the children and the maximum height + of all of the children. + } + @defmethod*[#:mode override (((place-children) (listof (list exact-integer exact-integer exact-integer exact-integer))))]{ + + Returns the positions for single panels and panes. + } +} +@definterface[panel:single-window<%> (panel:single<%> window<%>)]{ + +} +@defmixin[panel:single-window-mixin (panel:single<%> window<%>) (panel:single-window<%>)]{ + + @defmethod*[#:mode override (((container-size (info (list-of (list exact-integer exact-integer boolean boolean)))) (values exact-integer exact-integer)))]{ + + Factors the border width into the size calculation. + } +} +@defclass[panel:single% (panel:single-window-mixin (panel:single-mixin panel%)) ()]{} +@defclass[panel:single-pane% (panel:single-mixin pane%) ()]{} +@definterface[panel:dragable<%> (window<%> area-container<%>)]{ + Classes matching this interface implement a panel where the + user can adjust the percentage of the space that each takes + up. The user adjusts the size by clicking and dragging the + empty space between the children. + @defmethod*[(((after-percentage-change) void))]{ + This method is called when the user changes the percentage + by dragging the bar between the children, or when a new + child is added to the frame, but not when + @method[panel:dragable<%> set-percentages] + is called. + + Use + @method[panel:dragable<%> get-percentages] + to find the current percentages. + + + } + @defmethod*[(((set-percentages (new-percentages (listof number))) void))]{ + Call this method to set the percentages that each window + takes up of the panel. + + + The argument, \var{new-percentages} must be a list of + numbers that sums to 1. It's length must be equal to the + number of children of the panel (see + @method[area-container<%> get-children]) and each percentage must correspond to a number of pixels + that is equal to or larger than the + minimum with of the child, as reported by + @method[area<%> min-width]. + } + @defmethod*[(((get-percentages) (listof numbers)))]{ + Return the current percentages of the children. + + } + @defmethod*[(((get-vertical?) boolean))]{ + This method controls the behavior of the other overridden + methods in mixins that implement this interface. + + If it returns \scheme|#t|, the panel will be vertically + aligned and if it returns \scheme|#f|, they will be + horizontally aligned. + + } +} +@definterface[panel:vertical-dragable<%> (panel:dragable<%>)]{ + A panel that implements + @scheme[panel:vertical-dragable<%>]. It aligns its children vertically. +} +@definterface[panel:horizontal-dragable<%> (panel:dragable<%>)]{ + A panel that implements + @scheme[panel:horizontal-dragable<%>]. It aligns its children horizontally. +} +@defmixin[panel:dragable-mixin (window<%> area-container<%>) (panel:dragable<%>)]{ + This mixin adds the + @scheme[panel:dragable<%>] + functionality to a + @scheme[panel%]. + + It is not useful unless the + @method[panel:dragable<%> get-vertical?] + method is overridden. + + + @defmethod*[#:mode override (((after-new-child (child (instance-of (is-a?/c area<%>)))) void))]{ + + Updates the number of percentages to make sure that it + matches the number of children and calls + @method[panel:dragable<%> after-percentage-change]. + } + @defmethod*[#:mode override (((on-subwindow-event (receiver (instanceof window<%>)) (event (instanceof mouse-event%))) boolean))]{ + + When the cursor is dragging the middle bar around, this + method handles the resizing of the two panes. + } + @defmethod*[#:mode override (((place-children (info (list-of (list exact-int exact-int))) (w exact-int) (h exact-int)) (list-of (list exact-int exact-int exact-int exact-int))))]{ + + Places the children vertically in the panel, based on the percentages + returned from + @method[panel:dragable<%> get-percentages]. Also leaves a little gap between each pair of children. + } + @defmethod*[#:mode override (((container-size (info list)) two))]{ + + Computes the minimum size the panel would have to be in + order to have the current percentages (see + @method[panel:dragable<%> get-percentages]). + + } +} +@defmixin[panel:vertical-dragable-mixin (panel:dragable<%>) (panel:vertical-dragable<%>)]{ + This mixin merely overrides the + @method[panel:dragable<%> get-vertical?] + method of the + @scheme[panel:dragable-mixin] + to return \scheme|#t|. + @defmethod*[#:mode override (((get-vertical?) boolean))]{ + + Returns \scheme|#t|. + } +} +@defmixin[panel:horizontal-dragable-mixin (panel:dragable<%>) (panel:vertical-dragable<%>)]{ + This mixin merely overrides the + @method[panel:dragable<%> get-vertical?] + method of the + @scheme[panel:dragable-mixin] + to return \scheme|#f|. + @defmethod*[#:mode override (((get-vertical?) boolean))]{ + + Returns \scheme|#f|. + } +} +@defclass[panel:vertical-dragable% (panel:vertical-dragable-mixin (panel:dragable-mixin vertical-panel%)) ()]{} +@defclass[panel:horizontal-dragable% (panel:horizontal-dragable-mixin (panel:dragable-mixin horizontal-panel%)) ()]{} +@(require framework/framework-docs) +@(def-fw-procs panel) diff --git a/collects/scribblings/framework/framework-pasteboard.scrbl b/collects/scribblings/framework/framework-pasteboard.scrbl new file mode 100644 index 0000000000..6ec147da75 --- /dev/null +++ b/collects/scribblings/framework/framework-pasteboard.scrbl @@ -0,0 +1,14 @@ +#lang scribble/doc +@(require scribble/manual) +@(require (for-label framework/framework)) +@(require (for-label scheme/gui)) +@title{Pasteboard} + +@defclass[pasteboard:basic% (editor:basic-mixin pasteboard%) ()]{} +@defclass[pasteboard:standard-style-list% (editor:standard-style-list-mixin pasteboard:basic%) ()]{} +@defclass[pasteboard:keymap% (editor:keymap-mixin pasteboard:standard-style-list%) ()]{} +@defclass[pasteboard:file% (editor:file-mixin pasteboard:keymap%) ()]{} +@defclass[pasteboard:backup-autosave% (editor:backup-autosave-mixin pasteboard:file%) ()]{} +@defclass[pasteboard:info% (editor:info-mixin pasteboard:backup-autosave%) ()]{} +@(require framework/framework-docs) +@(def-fw-procs pasteboard) diff --git a/collects/scribblings/framework/framework-path-utils.scrbl b/collects/scribblings/framework/framework-path-utils.scrbl new file mode 100644 index 0000000000..48d2cacd30 --- /dev/null +++ b/collects/scribblings/framework/framework-path-utils.scrbl @@ -0,0 +1,8 @@ +#lang scribble/doc +@(require scribble/manual) +@(require (for-label framework/framework)) +@(require (for-label scheme/gui)) +@title{Path Utils} + +@(require framework/framework-docs) +@(def-fw-procs path-utils) diff --git a/collects/scribblings/framework/framework-preferences.scrbl b/collects/scribblings/framework/framework-preferences.scrbl new file mode 100644 index 0000000000..56e51968a4 --- /dev/null +++ b/collects/scribblings/framework/framework-preferences.scrbl @@ -0,0 +1,8 @@ +#lang scribble/doc +@(require scribble/manual) +@(require (for-label framework/framework)) +@(require (for-label scheme/gui)) +@title{Preferences} + +@(require framework/framework-docs) +@(def-fw-procs preferences) diff --git a/collects/scribblings/framework/framework-scheme.scrbl b/collects/scribblings/framework/framework-scheme.scrbl new file mode 100644 index 0000000000..c609fbe62d --- /dev/null +++ b/collects/scribblings/framework/framework-scheme.scrbl @@ -0,0 +1,273 @@ +#lang scribble/doc +@(require scribble/manual) +@(require (for-label framework/framework)) +@(require (for-label scheme/gui)) +@title{Scheme} + +@definterface[scheme:sexp-snip<%> ()]{ + @defmethod*[(((get-saved-snips) (listof snip%)))]{ + This returns the list of snips hidden by the sexp snip. + + } +} +@defclass[scheme:sexp-snip% snip% (scheme:sexp-snip<%> readable-snip<%>)]{ + + @defmethod*[#:mode override (((get-text (offset number) (num number) (flattened? boolean |#f|)) string))]{ + + Returns the concatenation of the text for all of the hidden + snips. + } + @defmethod*[#:mode override (((copy) (is-a?/c scheme:sexp-snip%)))]{ + + Returns a copy of this snip that includes the hidden snips. + } + @defmethod*[#:mode override (((write (stream-out editor-stream-out%)) void))]{ + + Saves the embedded snips + } + @defmethod*[#:mode override (((draw (dc dc<%>) (x real) (y real) (left real) (top real) (right real) (bottom real) (dx real) (dy real) (draw-caret symbol?)) void))]{ + + Draws brackets with a centered ellipses between them. + } + @defmethod*[#:mode override (((get-extent (dc (is-a?/c dc<%>)) (x real) (y real) (w boxed |#f|) (h boxed |#f|) (descent boxed |#f|) (space boxed |#f|) (lspace boxed |#f|) (rspace boxed |#f|)) void))]{ + + Returns a size corresponding to what this snip draws. + } +} +@definterface[scheme:text<%> (text:basic<%> mode:host-text<%> color:text<%>)]{ + Texts matching this interface support Scheme mode operations. + @defmethod*[(((get-limit (start exact-integer)) int))]{ + + Returns a limit for backward-matching parenthesis starting at position + \var{start}. + + } + @defmethod*[(((balance-parens (key-event (instance key-event%))) void))]{ + This function is called when the user types a close parenthesis in the + @scheme[text%]. If the close parenthesis that the user inserted does not match the + corresponding open parenthesis and the \rawscm{'framework:fixup-parens} preference is + \rawscm{\#t} (see + @scheme[preferences:get]) the correct closing parenthesis is inserted. + If the \rawscm{'framework:paren-match} preference is + \rawscm{\#t} (see + @scheme[preferences:get]) the matching open parenthesis is flashed. + + } + @defmethod*[(((tabify-on-return?) boolean))]{ + The result of this method is used to determine if the return key + automatically tabs over to the correct position. + + Override it to change it's behavior. + + + } + @defmethod*[(((tabify (start-pos exact-integer (send this iscmclassmethod (text) (get-start-position)))) void))]{ + + Tabs the line containing by \var{start-pos} + + } + @defmethod*[(((tabify-selection (start exact-integer) (end exact-integer)) void))]{ + + Sets the tabbing for the lines containing positions \var{start} + through \var{end}. + } + @defmethod*[(((tabify-all) void))]{ + + Tabs all lines. + } + @defmethod*[(((insert-return) void))]{ + + Inserts a newline into the buffer. If + @method[scheme:text<%> tabify-on-return?] + returns \rawscm{\#t}, this will tabify the new line. + } + @defmethod*[(((box-comment-out-selection (start-pos (union (quote start) exact-integer) rawscm) (end-pos (union (quote end) exact-integer) rawscm)) void))]{ + This method comments out a selection in the text by putting it into a comment box. + + + Removes the region from \var{start-pos} to \var{end-pos} + from the editor and inserts a comment box with that region + of text inserted into the box. + + If \var{start-pos} is \rawscm{'start}, the starting point of + the selection is used. If \var{end-pos} is \rawscm{'end}, + the ending point of the selection is used. + } + @defmethod*[(((comment-out-selection (start exact-integer) (end exact-integer)) void))]{ + + Comments the lines containing positions \var{start} through \var{end} + by inserting a semi-colon at the front of each line. + } + @defmethod*[(((uncomment-selection (start int) (end int)) void))]{ + + Uncomments the lines containing positions \var{start} through \var{end}. + + } + @defmethod*[(((get-forward-sexp (start exact-integer)) (union |#f| exact-integer)))]{ + + Returns the position of the end of next S-expression after position + \var{start}, or \rawscm{\#f} if there is no appropriate answer. + + } + @defmethod*[(((remove-sexp (start exact-integer)) void))]{ + + Forward-deletes the S-expression starting after the position \var{start}. + + } + @defmethod*[(((forward-sexp (start |#t|)) exact-integer))]{ + + Moves forward over the S-expression starting at position \var{start}. + } + @defmethod*[(((flash-forward-sexp (start-pos exact-integer)) void))]{ + + Flashes the parenthesis that closes the sexpression at + \var{start-pos}. + + + } + @defmethod*[(((get-backward-sexp (start exact-integer)) (union exact-integer |#f|)))]{ + + + Returns the position of the start of the S-expression before or + containing \var{start}, or \rawscm{\#f} if there is no appropriate + answer. + } + @defmethod*[(((flash-backward-sexp (start-pos exact-integer)) void))]{ + + Flashes the parenthesis that opens the sexpression at + \var{start-pos}. + + } + @defmethod*[(((backward-sexp (start-pos exact-integer)) void))]{ + Move the caret backwards one sexpression + + + Moves the caret to the beginning of the sexpression that ends at + \var{start-pos}. + } + @defmethod*[(((find-up-sexp (start-pos exact-integer)) (union |#f| exact-integer)))]{ + + Returns the position of the beginning of the next sexpression outside + the sexpression that contains \var{start-pos}. If there is no such + sexpression, it returns \rawscm{\#f}. + + } + @defmethod*[(((up-sexp (start exact-integer)) void))]{ + + Moves backward out of the S-expression containing the position \var{start}. + + } + @defmethod*[(((find-down-sexp (start-pos exact-integer)) (union |#f| exact-integer)))]{ + + Returns the position of the beginning of the next sexpression inside + the sexpression that contains \var{start-pos}. If there is no such + sexpression, it returns \rawscm{\#f}. + } + @defmethod*[(((down-sexp (start exact-integer)) void))]{ + + Moves forward into the next S-expression after the position \var{start}. + } + @defmethod*[(((remove-parens-forward (start exact-integer)) void))]{ + + Removes the parentheses from the S-expression starting after the + position \var{start}. + + } + @defmethod*[(((select-forward-sexp (start exact-integer)) |#t|))]{ + + Selects the next S-expression, starting at position \var{start}. + } + @defmethod*[(((select-backward-sexp (start exact-integer)) |#t|))]{ + + Selects the previous S-expression, starting at position \var{start}. + + } + @defmethod*[(((select-up-sexp (start exact-integer)) |#t|))]{ + + Selects the region to the enclosing S-expression, starting at position \var{start}. + + } + @defmethod*[(((select-down-sexp (start exact-integer)) |#t|))]{ + + Selects the region to the next contained S-expression, starting at position \var{start}. + + } + @defmethod*[(((transpose-sexp (start exact-integer)) void))]{ + + Swaps the S-expression beginning before the position \var{start} with + the next S-expression following \var{start}. + } + @defmethod*[(((mark-matching-parenthesis (pos exact-positive-integer)) void))]{ + If the paren after \var{pos} is matched, this method + highlights it and it's matching counterpart in dark green. + + } + @defmethod*[(((get-tab-size) exact-integer))]{ + This method returns the current size of the tabs for scheme mode. + See also + @method[scheme:text<%> set-tab-size]. + + } + @defmethod*[(((set-tab-size (new-size exact-integer)) void))]{ + This method sets the tab size for this + text. + + } + @defmethod*[(((introduce-let-ans) void))]{ + Adds a let around the current s-expression and a printf into the body + of the let. + + } + @defmethod*[(((move-sexp-out) void))]{ + Replaces the sexpression surrounding the insertion point with the + sexpression following the insertion point. + + } +} +@defmixin[scheme:text-mixin (text:basic<%> mode:host-text<%> color:text<%> text:autocomplete<%>) (scheme:text<%>)]{ + This mixin adds functionality for editing Scheme files. + + The result of this mixin uses the same initialization arguments as the + mixin's argument. + @defmethod*[#:mode override (((get-word-at (pos positive-exact-integer)) string))]{ + Returns the word just before \var{pos}, which is then used + as the prefix for auto-completion. + + } +} +@definterface[scheme:text-mode<%> ()]{ + The result of + @scheme[scheme:text-mode-mixin] + implements this interface. +} +@defmixin[scheme:text-mode-mixin (color:text-mode<%> mode:surrogate-text<%>) (scheme:text-mode<%>)]{ + This mixin adds Scheme mode functionality + to the mode that it is mixed into. The resulting + mode assumes that it is only set to an editor + that is the result of + @scheme[scheme:text-mixin]. + @defmethod*[#:mode override (((on-disable-surrogate) void))]{ + + Removes the scheme keymap (see also + @scheme[scheme:get-keymap]) and disables any parenthesis + highlighting in the host editor. + } + @defmethod*[#:mode override (((on-enable-surrogate) void))]{ + + Adds the scheme keymap (see also + @scheme[scheme:get-keymap]) and enables a parenthesis + highlighting in the host editor. + + } +} +@defmixin[scheme:set-mode-mixin (scheme:text<%> mode:host-text<%>) ()]{ + This mixin creates a new instance of + @scheme[scheme:text-mode%] + and installs it, by calling its own + @method[mode:host-text<%> set-surrogate] + method with the object. +} +@defclass[scheme:text% (scheme:set-mode-mixin (scheme:text-mixin (text:autocomplete-mixin (mode:host-text-mixin color:text%)))) ()]{} +@defclass[scheme:text-mode% (scheme:text-mode-mixin color:text-mode%) ()]{} +@(require framework/framework-docs) +@(def-fw-procs scheme) diff --git a/collects/scribblings/framework/framework-text.scrbl b/collects/scribblings/framework/framework-text.scrbl new file mode 100644 index 0000000000..35ec1a618c --- /dev/null +++ b/collects/scribblings/framework/framework-text.scrbl @@ -0,0 +1,950 @@ +#lang scribble/doc +@(require scribble/manual) +@(require (for-label framework/framework)) +@(require (for-label scheme/gui)) +@title{Text} + +@definterface[text:basic<%> (editor:basic<%> text%)]{ + Classes matching this interface are expected to implement the basic + functionality needed by the framework. + @defmethod*[(((highlight-range (start exact-integer) (end exact-integer) (color (instance color%)) (bitmap (union |#f| (instance bitmap%)) |#f|) (caret-space boolean |#f|) (priority (union (quote high) (quote low)) (quote low))) (-> void)))]{ + This function highlights a region of text in the buffer. + + + The range between \var{start} and \var{end} will be highlighted with the + color in color, and \var{bitmap} will be painted over the range of text in + black and white. If \var{bitmap} is \rawscm{\#f}, the range will be inverted, + using the platform specific xor. This method is not recommended, because the + selection is also displayed using xor. + + If \var{caret-space?} is not \rawscm{\#f}, the left edge of the range + will be one pixel short, to leave space for the caret. The caret does + not interfere with the right hand side of the range. Note that under X + windows the caret is drawn with XOR, which means almost anything can + happen. So if the caret is in the middle of the range it may be hard + to see, or if it is on the left of the range and \var{caret-space?} is + \rawscm{\#f} it may also be hard to see. + + The \var{priority} argument indicates the relative priority for + drawing overlapping regions. If two regions overlap and have different + priorities, the region with \rawscm{'high} priority will be drawn second + and only it will be visible in the overlapping region. + + This method returns a thunk, which, when invoked, will turn off + the highlighting from this range. + + See also + @method[text:basic<%> unhighlight-range]. + } + @defmethod*[(((unhighlight-range (start exact-integer) (end exact-integer) (color (instance color%)) (bitmap (union |#f| (instance bitmap%)) |#f|) (caret-space boolean |#f|)) void))]{ + This method removes the highlight from a region of text in + the buffer. + + + The region must match up to a region specified + from an earlier call to + @method[text:basic<%> highlight-range]. + + } + @defmethod*[(((get-highlighted-ranges) (listof range)))]{ + + Returns a list of (opaque) values representing the active + ranges in the editor. + } + @defmethod*[(((get-styles-fixed) boolean))]{ + If the result of this function is \rawscm{\#t}, the styles in this + @scheme[text:basic<%>] + will be fixed. This means + that any text inserted to this editor + has its style set to this editor's + @scheme[style-list%]'s \rawscm{"Standard"} style. + + See also + @method[text:basic<%> set-styles-fixed]. + + } + @defmethod*[(((get-fixed-style) (is-a?/c style<%>)))]{ + Returns the style used by + @method[text:basic<%> set-styles-fixed]when setting the styles. + + } + @defmethod*[(((set-styles-fixed (fixed? boolean)) void))]{ + Sets the styles fixed parameter of this + @scheme[text%]. See also + @method[text:basic<%> get-styles-fixed] + and + @method[text:basic<%> get-fixed-style]. + + } + @defmethod*[(((move/copy-to-edit (dest-text (instance text%)) (start exact-integer) (end exact-integer) (dest-pos exact-integer)) void))]{ + This moves or copies text and snips to another edit. + + + Moves or copies from the edit starting at \var{start} and ending at + \var{end}. It puts the copied text and snips in \var{dest-text} + starting at location \var{dest-pos}. + + If a snip refused to be moved, it will be copied, otherwise it will be + moved. A snip may refuse to be moved by returning \rawscm{\#f} from + @method[snip% release-from-owner]. + } + @defmethod*[(((initial-autowrap-bitmap) (union |#f| (instance bitmap%))))]{ + The result of this method is used as the initial autowrap + bitmap. Override this method to change the initial + @scheme[bitmap%]. See also + @method[text% set-autowrap-bitmap] + + + Defaultly returns the result of + @scheme[icon:get-autowrap-bitmap] + } + @defmethod*[(((get-port-name) symbol?))]{ + + The result of this method is a symbol that identifies this + editor and that is used as the port-name of a port that is + read from this editor if this editor is used in DrScheme. + See also + @method[text:basic<%> port-name-matches?]. + } + @defmethod*[(((port-name-matches? (id (or/c path? symbol?))) boolean))]{ + + Indicates if \var{id} matches the port name of this file. If + the file is saved, the port name matches when the save file + is the path as \var{id}. If the file has not been saved, the + port name matches if the symbol is the same as the result of + @method[text:basic<%> port-name-matches]. + + } +} +@defmixin[text:basic-mixin (editor:basic<%> text%) (text:basic<%>)]{ + This mixin implements the basic functionality needed for + @scheme[text%] + objects in the framework. + + The class that this mixin produces uses the same initialization + arguments as it's input. + @defmethod*[#:mode override (((on-paint (before? any/c) (dc (is-a?/c dc<%>)) (left real?) (top real?) (right real?) (bottom real?) (dx real?) (dy real?) (draw-caret (one-of/c (quote no-caret) (quote show-inactive-caret) (quote show-caret)))) void))]{ + + Draws the rectangles installed by + @method[text:basic<%> highlight-range]. + } + @defmethod*[#:mode augment (((on-insert (start exact-int) (end exact-int)) void))]{ + + See + @method[text:basic<%> set-styles-fixed]. + } + @defmethod*[#:mode augment (((after-insert (start nonnegative-exact-integer?) (len nonnegative-exact-integer?)) void))]{ + + See + @method[text:basic<%> set-styles-fixed]. + } + @defmethod*[#:mode override (((put-file (directory path) (default-name path)) void))]{ + + Like + @method[editor<%> put-file] + but uses + @scheme[finder:put-file] + instead of \scheme|put-file|. + + } +} +@definterface[text:foreground-color<%> (text:basic<%> editor:standard-style-list<%>)]{ + +} +@defmixin[text:foreground-color-mixin (text:basic<%> editor:standard-style-list<%>) (text:foreground-color<%>)]{ + This mixin changes the default text style to have + the foreground color controlled by + @scheme[editor:set-default-font-color]. + @defmethod*[#:mode override (((default-style-name) string))]{ + + Returns the result of + @scheme[editor:get-default-color-style-name]. + } + @defmethod*[#:mode override (((get-fixed-style) (is-a?/c style<%>)))]{ + + Returns the style named by + @scheme[editor:get-default-color-style-name]. + } +} +@definterface[text:hide-caret/selection<%> (text:basic<%>)]{ + This class hides the caret, except when the selection is active. + + Instances of this class are useful for editors that used for + displaying purposes, but still allow users to copy their text. +} +@defmixin[text:hide-caret/selection-mixin (text:basic<%>) (text:hide-caret/selection<%>)]{ + + @defmethod*[#:mode augment (((after-set-position) void))]{ + + Calls + @method[text% hide-caret] + to hide the caret when there is only a caret and no selection. + + } +} +@definterface[text:nbsp->space<%> (text%)]{ + Classes that implement this interface silently change + non-breaking spaces, ie the character \scheme|(integer->char + 160)|, to regular spaces when inserted into the editor. + +} +@defmixin[text:nbsp->space-mixin (text%) (text:nbsp->space<%>)]{ + @defmethod*[#:mode augment (((on-insert (start exact-int) (end exact-int)) void))]{ + + Starts an edit-sequence by calling + @method[editor<%> begin-edit-sequence]. + } + @defmethod*[#:mode augment (((after-insert (start nonnegative-exact-integer?) (len nonnegative-exact-integer?)) void))]{ + + Replaces all non-breaking space characters + \begin{schemedisplay} + (integer->char 160) + \end{schemedisplay} + by \scheme|#\space| characters. + + Ends the edit sequence (by calling + @method[editor<%> end-edit-sequence]) started in + @method[text:nbsp->space-mixin on-insert]. + } +} +@definterface[text:searching<%> (editor:keymap<%> text:basic<%>)]{ + Any object matching this interface can be searched. +} +@defmixin[text:searching-mixin (editor:keymap<%> text:basic<%>) (text:searching<%>)]{ + This + @scheme[text%] + can be searched. + + The result of this mixin uses the same initialization arguments as the + mixin's argument. + @defmethod*[#:mode override (((get-keymaps) (list-of (instance keymap%))))]{ + + This returns a list containing the super-class's keymaps, plus the + result of + @scheme[keymap:get-search] + } +} +@definterface[text:return<%> (text%)]{ + Objects supporting this interface were created by + @scheme[text:return-mixin]. +} +@defmixin[text:return-mixin (text%) (text:return<%>)]{ + Use this buffer to perform some special action when return is typed. + + @defconstructor[((return (-> boolean)))]{ + + } + @defmethod*[#:mode override (((on-local-char (event (is-a?/c key-event%))) void))]{ + + If \var{key} is either return or newline, only invoke the \var{return} + thunk (initialization argument) and do nothing else. + } +} +@definterface[text:wide-snip<%> (text:basic<%>)]{ + + @defmethod*[(((add-wide-snip (snip (instance snip%))) void))]{ + Registers a snip in this editor to be resized when its viewing area + changes. Ensures the snip is as wide as the viewing area. + + This method should only be called by + @method[canvas:wide-snip<%> add-tall-snip]. + + } + @defmethod*[(((add-tall-snip (snip (is-a?/c snip%))) void))]{ + Registers a snip in this editor. It is resized when the + viewing area of the editor changes. + + This method should only be called by + @method[canvas:wide-snip<%> add-tall-snip]. + + } +} +@defmixin[text:wide-snip-mixin (text:basic<%>) (text:wide-snip<%>)]{ + +} +@definterface[text:delegate<%> (text:basic<%>)]{ + Implementations of this interface copy all of the + changes to this editor to the result of + @method[text:delegate<%> get-delegate] + except instead of regular string and tab snips, + instead instances of + @scheme[text:1-pixel-string-snip%] + and + @scheme[text:1-pixel-tab-snip%] + are created. + + The contents of the two + editor are kept in sync, as modifications + to this object happen. + @defmethod*[(((get-delegate) (union |#f| (instanceof text%))))]{ + The result of this method is the \iscmclass{text} object + that the contents of this editor are being delegated to, or + \rawscm{\#f}, if there is none. + + } + @defmethod*[(((set-delegate (delegate (union |#f| (instanceof text%)))) void))]{ + This method sets the current delegate. + + + When it is set, all of the snips are copied from this object + to \var{delegate}. Additionally, if this object implements + @scheme[scheme:text<%>] + the tab settings of \var{delegate} are updated to match this + objects. + } +} +@defclass[text:1-pixel-string-snip% string-snip% ()]{ + This class re-uses the implementation of + @scheme[string-snip%] + to implement a string snip that just draws + a single pixel for each character in the string. + + See also + @scheme[text:1-pixel-tab-snip%] + for a similar extension to the + @scheme[tab-snip%]class. + + This snip is used in conjunction with the + @scheme[frame:delegate<%>] + and + @scheme[text:delegate<%>] + interfaces. + @defmethod*[#:mode override (((split (position exact) (first (box (instanceof snip%))) (second (box (instanceof snip%)))) void))]{ + + Fills the boxes with instance of + @scheme[text:1-pixel-string-snip%]s. + } + @defmethod*[#:mode override (((copy) (instanceof snip%)))]{ + + Creates and returns an instance of + @scheme[text:1-pixel-string-snip%]. + } + @defmethod*[#:mode override (((get-extent (dc (instanceof dc<%>)) (x real) (y real) (w (box (union non-negative-real-number |#f|)) |#f|) (h (box (union non-negative-real-number |#f|)) |#f|) (descent (box (union non-negative-real-number |#f|)) |#f|) (space (box (union non-negative-real-number |#f|)) |#f|) (lspace (box (union non-negative-real-number |#f|)) |#f|) (rspace (box (union non-negative-real-number |#f|)) |#f|)) void))]{ + + Sets the descent, space, lspace, and rspace to zero. Sets + the height to 1. Sets the width to the number of characters + in the string. + + } + @defmethod*[#:mode override (((insert (s string) (len exact) (pos exact 0)) void))]{ + } + @defmethod*[#:mode override (((draw (dc (instanceof dc<%>)) (x real) (y real) (left real) (top real) (right real) (bottom real) (dx real) (dy real) (draw-caret (union (quote no-caret) (quote show-inactive-caret) (quote show-caret)))) void))]{ + + Draws black pixels for non-whitespace characters and draws + nothing for whitespace characters. + + } +} +@defclass[text:1-pixel-tab-snip% tab-snip% ()]{ + This class re-uses the implementation of + @scheme[tab-snip%] + to implement a string snip that is always one pixel + high. + + See also + @scheme[text:1-pixel-string-snip%] + for a similar extension to the + @scheme[string-snip%]class. + + This snip is used in conjunction with the + @scheme[frame:delegate<%>] + and + @scheme[text:delegate<%>] + interfaces. + @defmethod*[#:mode override (((split (position exact) (first (box (instanceof snip%))) (second (box (instanceof snip%)))) void))]{ + + Fills the boxes with instance of + @scheme[text:1-pixel-tab-snip%]s. + } + @defmethod*[#:mode override (((copy) (instanceof snip%)))]{ + + Creates and returns an instance of + @scheme[text:1-pixel-tab-snip%]. + } + @defmethod*[#:mode override (((get-extent (dc (instanceof dc<%>)) (x real) (y real) (w (box (union non-negative-real-number |#f|)) |#f|) (h (box (union non-negative-real-number |#f|)) |#f|) (descent (box (union non-negative-real-number |#f|)) |#f|) (space (box (union non-negative-real-number |#f|)) |#f|) (lspace (box (union non-negative-real-number |#f|)) |#f|) (rspace (box (union non-negative-real-number |#f|)) |#f|)) void))]{ + + Sets the descent, space, lspace, and rspace to zero. Sets + the height to 1. Sets the width to the width of tabs as + returned in the \scm{tab-width} parameter of the + @method[text% get-tabs] + method. + + } + @defmethod*[#:mode override (((draw (dc (instanceof dc<%>)) (x real) (y real) (left real) (top real) (right real) (bottom real) (dx real) (dy real) (draw-caret (union (quote no-caret) (quote show-inactive-caret) (quote show-caret)))) void))]{ + + Draws nothing. + + } +} +@defmixin[text:delegate-mixin (text:basic<%>) (text:delegate<%>)]{ + This mixin provides an implementation of the + @scheme[text:delegate<%>] + interface. + @defmethod*[#:mode override (((highlight-range (start exact-integer) (end exact-integer) (color (instance color%)) (bitmap (union |#f| (instance bitmap%))) (caret-space boolean |#f|) (priority (union (quote high) (quote low)) (quote low))) (-> void)))]{ + + In addition to calling the super method, + @method[text:basic<%> highlight-range], this method forwards the highlighting to + the delegatee. + } + @defmethod*[#:mode override (((unhighlight-range (start exact-integer) (end exact-integer) (color (instance color%)) (bitmap (union |#f| (instance bitmap%)) |#f|) (caret-space boolean |#f|)) void))]{ + This method propagates the call to the delegate. + + } + @defmethod*[#:mode override (((on-paint (before? any/c) (dc (is-a?/c dc<%>)) (left real?) (top real?) (right real?) (bottom real?) (dx real?) (dy real?) (draw-caret (one-of/c (quote no-caret) (quote show-inactive-caret) (quote show-caret)))) void))]{ + + Draws a blue region in the delegatee editor that shows where + the visible region of the delegate editor is. + } + @defmethod*[#:mode augment (((on-edit-sequence) void))]{ + + starts an edit sequence in the delegate. + } + @defmethod*[#:mode augment (((after-edit-sequence) void))]{ + + ends an edit sequence in the delegate. + } + @defmethod*[#:mode override (((resized (snip (is-a?/c snip%)) (redraw-now? boolean)) void))]{ + + Sends a message to the delegate to update the size of the + copied snip, if there is one. + } + @defmethod*[#:mode augment (((after-insert (start number) (len number)) void))]{ + + forwards the change to the delegate + } + @defmethod*[#:mode augment (((after-delete (start number) (len number)) void))]{ + + forwards the change to the delegate. + } + @defmethod*[#:mode augment (((after-change-style (start number) (len number)) void))]{ + + forwards the changed style to the delegate. + } + @defmethod*[#:mode augment (((on-load-file (filename string) (format symbol?)) void))]{ + + remembers the filename, for use in + @method[text:delegate-mixin after-load-file]. + } + @defmethod*[#:mode augment (((after-load-file (success? boolean)) void))]{ + + updates the delegate with the new contents of the text. + } +} +@definterface[text:info<%> (text:basic<%>)]{ + Objects supporting this interface are expected to send information + about themselves to the frame that is displaying them. +} +@defmixin[text:info-mixin (editor:keymap<%> text:basic<%>) (text:info<%>)]{ + This mixin adds support for supplying information to objects created with + @scheme[frame:info-mixin]. When this + @scheme[editor:basic<%>] + is displayed in a frame, that frame must have been created with + @scheme[frame:info-mixin]. + @defmethod*[#:mode override (((set-anchor (on? any/c)) void))]{ + + Calls the + @method[frame:text-info<%> anchor-status-changed] + method of the frame that is viewing this object. It uses + @method[editor<%> get-canvas] + to get the canvas for this frame, and uses that canvas's + @scheme[top-level-window<%>] + as the frame. + } + @defmethod*[#:mode override (((set-overwrite-mode (on? any/c)) void))]{ + + Calls the + @method[frame:text-info<%> overwrite-status-changed]method of the frame that is viewing this object. It uses + @method[editor<%> get-canvas] + to get the canvas for this frame, and uses that canvas's + @scheme[top-level-window<%>] + as the frame. + } + @defmethod*[#:mode augment (((after-set-position) void))]{ + + Calls the + @method[frame:text-info<%> editor-position-changed] + method of the frame that is viewing this object. It uses + @method[editor<%> get-canvas] + to get the canvas for this frame, and uses that canvas's + @scheme[top-level-window<%>] + as the frame. + } + @defmethod*[#:mode augment (((after-insert (start nonnegative-exact-integer?) (len nonnegative-exact-integer?)) void))]{ + + Calls the + @method[frame:text-info<%> editor-position-changed] + method of the frame that is viewing this object. It uses + @method[editor<%> get-canvas] + to get the canvas for this frame, and uses that canvas's + @scheme[top-level-window<%>] + as the frame. + } + @defmethod*[#:mode augment (((after-delete (start nonnegative-exact-integer?) (len nonnegative-exact-integer?)) void))]{ + + Calls the + @method[frame:text-info<%> editor-position-changed] + method of the frame that is viewing this object. It uses + @method[editor<%> get-canvas] + to get the canvas for this frame, and uses that canvas's + @scheme[top-level-window<%>] + as the frame. + } +} +@definterface[text:clever-file-format<%> (text%)]{ + Objects supporting this interface are expected to support a clever + file format when saving. + +} +@defmixin[text:clever-file-format-mixin (text%) (text:clever-file-format<%>)]{ + The result of this mixin uses the same initialization arguments as the + mixin's argument. + + When files are saved from this + @scheme[text%], a check is made to see if there are any non-@scheme[string-snip%] + objects in the + @scheme[text%]. If so, it is saved using the file format \rawscm{'std}. (see + @method[text% set-file-format] + for more information. If not, the file format passed to + @method[editor<%> save-file] + is used. + @defmethod*[#:mode augment (((on-save-file (filename path?) (format (one-of/c (quote guess) (quote standard) (quote text) (quote text-force-cr) (quote same) (quote copy)))) void))]{ + + If the method + @method[text% get-file-format] + returns \rawscm{'standard} and the text has only + @scheme[string-snip%]s, the file format is set to \rawscm{'text}. + + If the method + @method[text% get-file-format] + returns \rawscm{'text} and the text has some non + @scheme[string-snip%]s, the file format is set to \rawscm{'standard}. + + Depending on the user's preferences, the user may also be queried. + + Also, the changes to the file format only happen if the argument + \var{file-format} is \rawscm{'copy} or \rawscm{'same}. + } +} +@definterface[text:file<%> (editor:file<%> text:basic<%>)]{ + Mixins that implement this interface lock themselves when + the file they are editing is read only. + @defmethod*[(((get-read-write?) boolean))]{ + Indicates whether or not this editor is in read-write mode. + + } + @defmethod*[(((while-unlocked (thunk (-> any/c))) any/c))]{ + + Unlocks the editor, calls the thunk, and then relocks the + editor, all using a \scheme{dynamic-wind}. + } +} +@defmixin[text:file-mixin (editor:file<%> text:basic<%>) (text:file<%>)]{ + @defmethod*[#:mode augment (((can-insert? (start number) (len number)) boolean))]{ + + Returns false if the result of + @method[text:file<%> get-read-write?] + is true, otherwise returns the + result of calling \scheme|inner|. + } + @defmethod*[#:mode augment (((can-delete? (start number) (len number)) boolean))]{ + + Returns false if the result of + @method[text:file<%> get-read-write?] + is true, otherwise returns the + result of calling \scheme|inner|. + } + @defmethod*[#:mode augment (((after-save-file) void))]{ + + Checks if the newly saved file is write-only in the filesystem. If + so, locks the editor with the + @method[editor<%> lock] + method. Otherwise unlocks the buffer + + For each canvas returned from + @method[editor<%> get-canvases] + it checks to see if the + @scheme[canvas%]'s + @method[area<%> get-top-level-window] + matches the + @scheme[frame:editor<%>] + interface. If so, it calls + @method[frame:editor-mixin set-label] + with the last part of the filename (ie, the name of the file, not the + directory the file is in). + } + @defmethod*[#:mode augment (((after-load-file) void))]{ + + Checks if the newly loaded file is write-only in the filesystem. If + so, locks the editor with the + @method[editor<%> lock] + method. Otherwise unlocks the buffer + + For each canvas returned from + @method[editor<%> get-canvases] + it checks to see if the + @scheme[canvas%]'s + @method[area<%> get-top-level-window] + matches the + @scheme[frame:editor<%>] + interface. If so, it calls + @method[frame:editor-mixin set-label] + with the last part of the filename (ie, the name of the file, not the + directory the file is in). + } +} +@definterface[text:ports<%> ()]{ + Classes implementing this interface (via the associated + mixin) support input and output ports that read from the + editor. + + There are two input ports: the normal input port just reads + from the editor's contents directly and the box input port + inserts an editor snip into this text and uses input typed + into the box as input into the port. + + They create three threads to mediate access to the input and + output ports (one for each input port and one for all of the + output ports). + @defmethod*[(((delete/io (start exact-integer) (end exact-integer)) void))]{ + Deletes the text between \var{start} and \var{end} without + changing the behavior of the ports (otherwise, deleting the + text would break internal invariants of the port). + + Both \var{start} and \var{end} must be less than + @method[text:ports<%> get-insertion-point] + (or else it is safe to delete them so you don't need this + method). + + + } + @defmethod*[(((get-insertion-point) exact-integer))]{ + Returns the position where characters put into the output + port will appear. + + } + @defmethod*[(((set-insertion-point (ip exact-integer)) void))]{ + Sets the position where the output port will insert characters. + See also + @method[text:ports<%> get-insertion-point]. + + } + @defmethod*[(((get-unread-start-point) exact-integer))]{ + Returns the position where input will be taken into the + input port (after the next time return is typed). + + } + @defmethod*[(((set-unread-start-point (usp exact-integer)) void))]{ + Sets the position where input will be taken into the + input port (after the next time return is typed). + + See also + @method[text:ports<%> get-unread-start-point]. + + } + @defmethod*[(((set-allow-edits (allow-edits? boolean)) void))]{ + Enables or disables editing in the buffer. Be sure to update + the unread start point (via + @method[text:ports<%> set-unread-start-point]) and the insertion point (via + @method[text:ports<%> set-insertion-point]) after making changes to the buffer. + + } + @defmethod*[(((get-allow-edits) boolean))]{ + Indicates if editing is allowed in the buffer at this point. + + } + @defmethod*[(((insert-between (str (union snip% string))) void))]{ + Inserts some text between the unread start point and the + insertion point (and updates them properly). To insert + before the two points, see + @method[text:ports<%> insert-before]. + + See also + @method[text:ports<%> set-unread-start-point] + and + @method[text:ports<%> set-insertion-point]. + + } + @defmethod*[(((insert-before (str (union snip% string))) void))]{ + Inserts some text before the unread start point and updates + it and the insertion point properly. To insert between + the two points, see + @method[text:ports<%> insert-between]. + + See also + @method[text:ports<%> set-unread-start-point] + and + @method[text:ports<%> set-insertion-point]. + + } + @defmethod*[(((submit-to-port? (key char)) boolean))]{ + Augment this method to help control when characters should + be submitted to the input port. + + + Return \scheme|#t| or the result of calling \scheme|inner|. + } + @defmethod*[(((on-submit) void))]{ + This method is called when text is sent into the input port. + + + Does nothing. + } + @defmethod*[(((send-eof-to-in-port) void))]{ + This method puts an eof into the input port. + + } + @defmethod*[(((send-eof-to-box-in-port) void))]{ + This method puts an eof into the box input port. + + } + @defmethod*[(((reset-input-box) void))]{ + This method removes the current input box from the editor + (and all input in it is lost). + + } + @defmethod*[(((clear-output-ports) void))]{ + Flushes all of the data in all of the output ports that + hasn't appeared in the editor yet. + + } + @defmethod*[(((clear-input-port) void))]{ + Flushes all of the data in the input port that hasn't yet + been read. Reading will now block. + + } + @defmethod*[(((clear-box-input-port) void))]{ + Flushes all of the data in the box input port that hasn't + yet been read. Reading will now block. + + } + @defmethod*[(((get-out-style-delta) (or/c (is-a?/c style-delta%) string?)))]{ + The result of this method is the style that is used to color + text submitted to the result of + @method[text:ports<%> get-out-port]. + + If the result is a string that is not mapped in the editor's + style list, the style named \scheme|"Standard"| is used and + if that isn't mapped, the style named \scheme|"Basic"| is used. + + This method is called during the initialization of the class. + + + Defaultly returns \scheme|"text:ports out"| which is mapped + to a blue style in the style list returned by + @scheme[editor:get-standard-style-list]. + } + @defmethod*[(((get-err-style-delta) (or/c (is-a?/c style-delta%) string?)))]{ + The result of this method is the style that is used to color + text submitted to the result of + @method[text:ports<%> get-err-port]. + + If the result is a string that is not mapped in the editor's + style list, the style named \scheme|"Standard"| is used and + if that isn't mapped, the style named \scheme|"Basic"| is used. + + This method is called during the initialization of the class. + + + Defaultly returns \scheme|"text:ports err"| which is mapped + to a red italic style in the style list returned by + @scheme[editor:get-standard-style-list]. + } + @defmethod*[(((get-value-style-delta) (or/c (is-a?/c style-delta%) string?)))]{ + The result of this method is the style (or the name of the + style) that is used to color text submitted to the result of + @method[text:ports<%> get-value-port]. + + If the result is a string that is not mapped in the editor's + style list, the style named \scheme|"Standard"| is used and + if that isn't mapped, the style named \scheme|"Basic"| is used. + + This method is called during the initialization of the class. + + + + Defaultly returns \scheme|"text:ports value"| which is mapped + to a blue style in the style list returned by + @scheme[editor:get-standard-style-list]. + + } + @defmethod*[(((get-in-port) input-port))]{ + Returns the input port that data in this editor is sent to. + + } + @defmethod*[(((get-in-box-port) input-port))]{ + Returns the box input port that data in this editor is sent to. + + } + @defmethod*[(((get-out-port) output-port))]{ + Returns an output port that writes into this editor. The + only difference between this port and the ports returned by + @method[text:ports<%> get-err-port] + and + @method[text:ports<%> get-value-port] + is the font style and color. + + } + @defmethod*[(((get-err-port) output-port))]{ + Returns an output port that writes into this editor. The + only difference between this port and the ports returned by + @method[text:ports<%> get-err-port] + and + @method[text:ports<%> get-out-port] + is the font style and color. + + } + @defmethod*[(((get-value-port) output-port))]{ + Returns an output port that writes into this editor. The + only difference between this port and the ports returned by + @method[text:ports<%> get-err-port] + and + @method[text:ports<%> get-out-port] + is the font style and color. + + } + @defmethod*[(((after-io-insertion) void))]{ + This method is called after an insertion due to IO occurs. + + } + @defmethod*[(((get-box-input-editor-snip%) (subclass editor-snip%)))]{ + The result of this method is used as the class of editor + snips that is inserted by the box port in this editor. + + } + @defmethod*[(((get-box-input-text%) (implements iscmmixin (text:input-box))))]{ + The result of this method is instantiated and placed inside the result of + @method[text:ports<%> get-box-input-editor-snip\%]. + + } +} +@defmixin[text:ports-mixin (text:wide-snip<%>) (text:ports<%>)]{ + + @defmethod*[#:mode augment (((can-insert? (start exact-integer) (len exact-integer)) boolean))]{ + + Returns the results of the \scheme|inner| call, unless + @method[text:ports<%> get-allow-edits] + returns \scheme|#f|. + } + @defmethod*[#:mode augment (((can-delete? (start exact-integer) (len exact-integer)) boolean))]{ + + Returns the results of the \scheme|inner| call, unless + @method[text:ports<%> get-allow-edits] + returns \scheme|#f|. + } + @defmethod*[#:mode override (((on-local-char (event (is-a?/c key-event%))) void))]{ + + Sends the data between the last position and the result of + @method[text:ports<%> get-unread-start-point] + to the input port, unless + @method[text:ports<%> submit-to-port?] + returns \scheme|#f|. + + Also calls + @method[text:ports<%> on-submit]. + } + @defmethod*[#:mode augment (((on-display-size) void))]{ + + Adjusts the embedded editor-snip (used for reading input to the + @method[text:ports<%> get-in-box-ports]) to match the width of the editor. + } +} +@definterface[text:input-box<%> (text%)]{ + Classes that implement this interface are used as the + editors for the box input port in + @scheme[text:ports%]. + +} +@defmixin[text:input-box-mixin (text%) (text:input-box<%>)]{ + This mixin provides an implementation of + @scheme[text:input-box<%>] + for use with + @scheme[text:ports<%>]. + @defmethod*[#:mode override (((on-default-char (event key-event%)) void))]{ + + Notifies the + @scheme[text:ports<%>] + enclosing this editor that a new line of input has been provided. + } +} +@definterface[text:autocomplete<%> (text%)]{ + The mixin implementing this interface provides an + unintrusive autocompletion menu when a particular + (configurable) keystroke is pressed. + + @defmethod*[(((auto-complete) void))]{ + Starts a completion. + + } + @defmethod*[(((get-autocomplete-border-color) (or/c string? (is-a?/c color%))))]{ + The border color for the autocomplete menu. Defaults to + \scheme|"black"|. + + } + @defmethod*[(((get-autocomplete-background-color) (or/c string? (is-a?/c color%))))]{ + The background color for the non-selected menu + items. Defaults to \scheme|"lavender"|. + + } + @defmethod*[(((get-autocomplete-selected-color) (or/c string? (is-a?/c color%))))]{ + The background color for the selected menu item. Defaults to + \scheme|(make-object color% 204 153 255)|. + + } + @defmethod*[(((completion-mode-key-event? (key-event key-event%)) boolean))]{ + Returns true when the key event passed to it should initiate + the completions menu. + + } + @defmethod*[(((get-all-words) (listof string)))]{ + + Returns the list of the words that autocompletion should + choose from. + } + @defmethod*[(((get-word-at (pos positive-exact-integer)) string))]{ + + Given an editor location, returns the prefix ending at that location + that autocompletion should try to complete. + } +} +@defmixin[text:autocomplete-mixin (text%) (text:autocomplete<%>)]{ + + @defmethod*[#:mode override (((on-paint) void))]{ + + Draws the completion menu (when it is popped up). + } + @defmethod*[#:mode override (((on-char) void))]{ + + Takes over the handling of key events when the completions + menu is visible. Also, when the completions menu is not + visible, it calls the + @method[text:completion<%> completion-mode-key-event?] + method to see if it should start completing. + } + @defmethod*[#:mode override (((on-event) void))]{ + + This method is overridden to allow mouse access of the + completions menu. It only handles events when there is a + menu open and the mouse is in the menu, in which case it + makes the menu trace the mouse. + + The only time it does not call the super method is when + the mouse is button is pushed. + } +} +@defclass[text:basic% (text:basic-mixin (editor:basic-mixin text%)) ()]{} +@defclass[text:hide-caret/selection% (text:hide-caret/selection-mixin text:basic%) ()]{} +@defclass[text:nbsp->space% (text:nbsp->space-mixin text:basic%) ()]{} +@defclass[text:delegate% (text:delegate-mixin text:basic%) ()]{} +@defclass[text:wide-snip% (text:wide-snip-mixin text:basic%) ()]{} +@defclass[text:standard-style-list% (editor:standard-style-list-mixin text:wide-snip%) ()]{} +@defclass[text:input-box% (text:input-box-mixin text:standard-style-list%) ()]{} +@defclass[text:keymap% (editor:keymap-mixin text:standard-style-list%) ()]{} +@defclass[text:return% (text:return-mixin text:keymap%) ()]{} +@defclass[text:autowrap% (editor:autowrap-mixin text:keymap%) ()]{} +@defclass[text:file% (text:file-mixin (editor:file-mixin text:autowrap%)) ()]{} +@defclass[text:clever-file-format% (text:clever-file-format-mixin text:file%) ()]{} +@defclass[text:backup-autosave% (editor:backup-autosave-mixin text:clever-file-format%) ()]{} +@defclass[text:searching% (text:searching-mixin text:backup-autosave%) ()]{} +@defclass[text:info% (text:info-mixin (editor:info-mixin text:searching%)) ()]{} +@(require framework/framework-docs) +@(def-fw-procs text) diff --git a/collects/scribblings/framework/framework-version.scrbl b/collects/scribblings/framework/framework-version.scrbl new file mode 100644 index 0000000000..d3323a98de --- /dev/null +++ b/collects/scribblings/framework/framework-version.scrbl @@ -0,0 +1,8 @@ +#lang scribble/doc +@(require scribble/manual) +@(require (for-label framework/framework)) +@(require (for-label scheme/gui)) +@title{Version} + +@(require framework/framework-docs) +@(def-fw-procs version) diff --git a/collects/scribblings/framework/framework.scrbl b/collects/scribblings/framework/framework.scrbl index c8218240a2..d8832d8af9 100644 --- a/collects/scribblings/framework/framework.scrbl +++ b/collects/scribblings/framework/framework.scrbl @@ -8,5 +8,29 @@ @(defmodule framework/framework) -@(require framework/framework-docs) -@(def-fw-procs) +@include-section["framework-application.scrbl"] +@include-section["framework-autosave.scrbl"] +@include-section["framework-canvas.scrbl"] +@include-section["framework-color-model.scrbl"] +@include-section["framework-color-prefs.scrbl"] +@include-section["framework-color.scrbl"] +@include-section["framework-comment-box.scrbl"] +@include-section["framework-editor.scrbl"] +@include-section["framework-exit.scrbl"] +@include-section["framework-finder.scrbl"] +@include-section["framework-frame.scrbl"] +@include-section["framework-group.scrbl"] +@include-section["framework-handler.scrbl"] +@include-section["framework-icon.scrbl"] +@include-section["framework-keymap.scrbl"] +@;include-section["framework-main.scrbl"] +@include-section["framework-menu.scrbl"] +@;include-section["framework-mode.scrbl"] +@include-section["framework-number-snip.scrbl"] +@include-section["framework-panel.scrbl"] +@include-section["framework-pasteboard.scrbl"] +@include-section["framework-path-utils.scrbl"] +@include-section["framework-preferences.scrbl"] +@include-section["framework-scheme.scrbl"] +@include-section["framework-text.scrbl"] +@include-section["framework-version.scrbl"] diff --git a/collects/scribblings/framework/info.ss b/collects/scribblings/framework/info.ss index 8fd673ac14..5a7c0dd453 100644 --- a/collects/scribblings/framework/info.ss +++ b/collects/scribblings/framework/info.ss @@ -1,4 +1,4 @@ #lang setup/infotab -(define scribblings '(("framework.scrbl" (#;multi-page) (gui-library 100)))) +(define scribblings '(("framework.scrbl" (multi-page))))