interface
method
(send an-editor:basic has-focus? )→boolean?
This function returns #t when the editor has the keyboard focus. It is implemented using: on-focusmethod
(send an-editor:basic 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 begin-edit-sequence and end-edit-sequence for more info about edit sequences.
method
This method is used to install callbacks that will be run after any edit-sequence completes.The procedure 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 tag is a symbol, the thunk is keyed on that symbol, and only one thunk per symbol will be called after the edit-sequence. Specifically, the last call to run-after-edit-sequence ’s argument will be called.
method
(send an-editor:basic get-top-level-window )
Returns the top-level-window<%> currently associated with this buffer.Note that the result of this method may not currently be displaying this editor (e.g., the editor may be for a tab that’s not currently active in DrRacket).method
(send an-editor:basic save-file-out-of-date? )→boolean?
Returns #t if the file on disk has been modified, by some other program.method
formatshow-errors?])= 'sameThis method is an alternative to save-file . Rather than showing errors via the original stdout, it opens a dialog with an error message showing the error.It returns #t if no error occurred and cancel was not clicked, and it returns #f if an error occurred or cancel was clicked.
method
formatshow-errors?])= 'guessLoads filename, much like load-file . Rather than showing errors via the original stdout, however, it shows a dialog box when an error occurs.The result indicates if an error happened (the error has already been shown to the user). It returns #t if no error occurred and #f if an error occurred.
method
(send an-editor:basic revert/gui-error [show-errors?])→boolean?
Reverts the content of the editor to the file on the disk, showing errors to the user via load-file/gui-error .The result indicates if an error happened (the error has already been shown to the user). It returns #t if no error occurred and #f if an error occurred.
If get-filename returns #f or if the filename is a temporary filename, the buffer is unchanged and the result is #f.
This method is called when an editor is closed. Typically, this method is called when the frame containing the editor is closed, but in some cases an editor is considered “closed” before the frame it is in is closed (e.g., when a tab in DrRacket is closed), and thus on-close will be called at that point.See also can-close? and close .
Default: does nothing.method
(send an-editor:basic 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).Returns #t.This method is merelyIt is intended as a shorthand, helper method for closing an editor. See also can-close? and on-close .method
(send an-editor:basic 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").method
(send an-editor:basic get-pos/text event)
Calls get-pos/text-dc-location with the x and y coordinates of event.method
y)This method’s first result is #f when the mouse event does not correspond to a location in the editor.If the second result is a text% object, then the first result will be a position in the editor and otherwise the first result will be #f. The position is found by calling find-position , using #f as the at-eol? argument.
mixin
editor:basic-mixin :(class? . -> .class? )
Augments can-save-file? in editor<%> .Checks to see if the file on the disk has been modified out side of this editor, using save-file-out-of-date? . If it has, this method prompts the user to be sure they want to save.See also editor:doing-autosave? and editor:silent-cancel-on-save-file-out-of-date? .
method
(send an-editor:basic after-save-file success?)→void?
success?:boolean?Augments after-save-file in editor<%> .If the current filename is not a temporary filename, this method calls 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 save-file-out-of-date? .
method
(send an-editor:basic after-load-file success?)→void?
success?:boolean?Augments after-load-file in editor<%> .Updates a private instance variable with the modification time of the file, for using in implementing save-file-out-of-date?Manages the state to implement has-focus?method
(send an-editor:basic on-edit-sequence )→boolean?
Augments on-edit-sequence in editor<%> .Always returns #t. Updates a flag for local-edit-sequence?method
(send an-editor:basic after-edit-sequence )→void?
Augments after-edit-sequence in editor<%> .Helps to implement run-after-edit-sequence .method
(send an-editor:basic on-new-box type)→(is-a?/c editor-snip% )
Overrides on-new-box in editor<%> .Creates instances of pasteboard:basic% or text:basic% instead of the built in pasteboard% and text% classes.Overrides on-new-image-snip in editor<%> .Uses finder:get-file to find a filename. Also, sets the parameter finder:dialog-parent-parameter to the result of get-top-level-window .Uses finder:put-file to find a filename. Also, sets the parameter finder:dialog-parent-parameter to the result of get-top-level-window .
interface
mixin
editor:standard-style-list-mixin :(class? . -> .class? )
interface
method
(send an-editor:keymap get-keymaps )
The keymaps returned from this method are chained to this 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.
See also editor:add-after-user-keymap .
mixin
editor:keymap-mixin :(class? . -> .class? )
interface
mixin
editor:autowrap-mixin :(class? . -> .class? )
interface
The result of this method is used as the parent for the dialog that asks about closing.Returns #f by default.method
(send an-editor:file 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.method
(send an-editor:file 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 can-close? .Returns #f by default.
method
(send an-editor:file user-saves-or-not-modified? allow-cancel?)
allow-cancel?:#tIf the file has not been saved, this prompts the user about saving and, if the user says to save, then it saves the file.The result is #t if the save file is up to date, or if the user says it is okay to continue without saving. Generally used when closing the file or quiting the app.
mixin
editor:file-mixin :(class? . -> .class? )
method
name:string?Overrides set-filename in editor<%> .Updates the filename on each frame displaying this editor, for each frame that matches frame:editor<%> .method
(send an-editor:file can-close? )→boolean?
Augments can-close? in editor:basic<%> .If the allow-close-with-no-filename? method returns #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 allow-close-with-no-filename? method returns #t, this method does as before, except only asks if the editor’s get-filename method returns a path.
Also calls inner.method
(send an-editor:file get-keymaps )
Overrides get-keymaps in editor:keymap<%> .This returns a list containing the super-class’s keymaps, plus the result of keymap:get-file
interface
Indicates whether this editor<%> should be backed up.Indicates whether this editor<%> should be autosaved.Returns #t.method
(send an-editor:backup-autosave do-autosave )→(or/c #fpath? )
This method is called to perform the autosaving. See also autosave:register .When the file has been modified since it was last saved and autosaving it turned on (via the autosave? method) an autosave file is created for this editor<%> .
Returns the filename where the autosave took place, or #f if none did. This method sets the parameter editor:doing-autosave? to #t during the dynamic extent of the call it makes to save-file .method
(send an-editor:backup-autosave remove-autosave )→void?
This method removes the autosave file associated with this editor<%> .
mixin
editor:backup-autosave-mixin :(class? . -> .class? )
method
format)filename:path?Augments on-save-file in editor<%> .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 path-utils:generate-backup-nameAugments on-close in editor:basic<%> .Deletes the autosave file and turns off autosaving.Sets a flag indicating that this editor<%> needs to be autosaved.method
(send an-editor:backup-autosave set-modified modified?)→void?
modified?:any/cOverrides set-modified in editor<%> .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.
interface
mixin
editor:autoload-mixin :(class? . -> .class? )
method
Overrides set-filename in editor<%> .Disables the monitoring, unless the call is in the dynamic extent of a call to load-file or save-file .Augments on-close in editor:basic<%> .Uses filesystem-change-evt-cancel to stop tracking changes to the file.method
filename:path?Augments on-save-file in editor<%> .Establishes the monitoring of filename and ties it to this editor<%> .method
(send an-editor:autoload after-save-file success?)→void?
success?:any/cAugments after-save-file in editor<%> .Uses the updated sha1 from get-file-sha1 , now that the editor’s content and the file on the disk have been synchronized.method
filename:path?Augments on-load-file in editor<%> .Establishes the monitoring of filename and ties it to this editor<%> .method
(send an-editor:autoload after-load-file success?)→void?
success?:any/cAugments after-load-file in editor<%> .Uses the updated sha1 from get-file-sha1 , now that the editor’s content and the file on the disk have been synchronized.method
(send an-editor:autoload update-sha1? path)→any/c
path:path-string?Overrides update-sha1? in editor<%> .
interface
mixin
editor:info-mixin :(class? . -> .class? )
Uses run-after-edit-sequence to call lock-status-changed .
class
superclass:canvas%
constructor
[messagemessage][ [stretchable-heightstretchable-height]])The message field controls the initial contents. If there is a list of strings, then each string is put on a separate line. If there is just a single string, it is split on newlines and then treated as if it were a list.The stretchable-height has the opposite default from the canvas% superclass.
method
(send an-editor:font-size-message set-message message)→void?
Changes the message.If message is a list of strings, then each string is put on a separate line. If there is just a single string, it is split on newlines and then treated as if it were a list argument.
parameter
autosaving?:boolean?
parameter
autosaving?:boolean?
If editor:silent-cancel-on-save-file-out-of-date? ’s value is #true, then a save that might overwrite some other change is silently ignored and no save actually happens (via can-save-file? ). If it is #false (and editor:doing-autosave? is also #false) then a dialog is opened to ask the user what to do.
Added in version 1.53 of package gui-lib.
procedure
( editor:set-current-preferred-font-size new-size)→void?
new-size:exact-nonnegative-integer?
procedure
( editor:font-size-pref->current-font-size font-preference)
font-preference :#:flat?#t)#:flat?#t)
Except if editor:get-change-font-size-when-monitors-change? returns #f, in which case the current monitor configuration is not considered and the last-set size (the second position in the vector) is always returned.
As background, the font size preference is actually saved on a per-monitor configuration basis; specifically the preference value (using the same contract as the argument of this function) contains a table mapping a list of monitor sizes (but not their positions) obtained by get-display-size to the preferred font size (plus a default size used for new configurations).
Defaults to #f
procedure
( editor:set-change-font-size-when-monitors-change? b?)→void?
b?:boolean?
procedure
procedure
procedure
name:string?
procedure
procedure
procedure
keymaps)