1 Implementing Dr Scheme Tools
2 Adding Languages to Dr Scheme
3 Creating New Kinds of Dr Scheme Frames
4 Extending the Existing Dr Scheme Classes
5 Expanding the User’s Program Text and Breaking
6 Editor Modes
7 Language-specific capabilities
8 drscheme: get/ extend
9 drscheme: unit
10 drscheme: language
11 drscheme: language-configuration
12 drscheme: debug
13 drscheme: rep
14 drscheme: frame
15 drscheme: help-desk
16 drscheme: eval
17 drscheme: modes
Index
On this page:
drscheme: unit: tab<%>
break-callback
can-close?
disable-evaluation
enable-evaluation
get-breakables
get-defs
get-directory
get-enabled
get-frame
get-ints
is-current-tab?
is-running?
on-close
reset-offer-kill
set-breakables
drscheme: unit: tab%
clear-annotations
drscheme: unit: program-editor-mixin
after-delete
after-insert
drscheme: unit: interactions-canvas%
drscheme: unit: frame%
add-show-menu-items
break-callback
change-to-file
edit-menu: between-select-all-and-find
execute-callback
file-menu: between-open-and-revert
file-menu: between-print-and-close
file-menu: between-save-as-and-print
file-menu: print-string
file-menu: save-as-string
file-menu: save-string
get-break-button
get-button-panel
get-canvas
get-canvas%
get-definitions/ interactions-panel-parent
get-editor
get-editor%
get-execute-button
get-text-to-search
make-searchable
on-close
on-size
still-untouched?
update-save-button
update-save-message
update-shown
drscheme: unit: frame<%>
get-language-menu
ensure-defs-shown
ensure-rep-hidden
ensure-rep-shown
get-current-tab
get-definitions-canvas
get-definitions-text
get-insert-menu
get-interactions-canvas
get-interactions-text
get-tabs
on-tab-change
register-capability-menu-item
register-toolbar-button
drscheme: unit: definitions-text%
set-filename
set-modified
drscheme: unit: definitions-text<%>
after-set-next-settings
begin-metadata-changes
end-metadata-changes
get-next-settings
get-port-name-identifier
get-tab
port-name-matches?
set-needs-execution-message
set-next-settings
drscheme: unit: definitions-canvas%
drscheme: unit: get-program-editor-mixin
drscheme: unit: add-to-program-editor-mixin
drscheme: unit: open-drscheme-window
Version: 4.0.2

 

9 drscheme:unit

drscheme:unit:tab<%> : interface?

  implements: 

drscheme:rep:context<%>

(send a-drscheme:unit:tab break-callback)  void?

Specification:This method is called when the break button is clicked and this tab is the active tab.

Default implementation:By default, breaks any evaluation that may be happening at this point.

(send a-drscheme:unit:tab can-close?)  boolean?

Refine this method with augment.

Specification:This method is called to determine if it is okay to close this tab.

Default implementation:Calls the definitions text’s and interactions text’s can-close? method.

(send a-drscheme:unit:tab disable-evaluation)  void?

Overrides disable-evaluation in drscheme:rep:context<%>.

Disables the Run button, and the Run menu item and locks the interactions window, and the definitions window.

(send a-drscheme:unit:tab enable-evaluation)  void?

Overrides enable-evaluation in drscheme:rep:context<%>.

Enables the Run button, and the Run menu item and unlocks (via the lock method) the interactions window and the definitions window.

(send a-drscheme:unit:tab get-breakables)

 

 

(or/c thread? false/c)

(or/c custodian? false/c)

Overrides get-breakables in drscheme:rep:context<%>.

(send a-drscheme:unit:tab get-defs)

  (is-a?/c (scheme drscheme:rep:text%))

This text is initially the top half of the drscheme window and contains the users program.

This text defaults to a text% object, but if you change drscheme:get/extend:extend-interactions-text procedure, it will use the extended class to create the text.

(send a-drscheme:unit:tab get-directory)

  (or/c string? false/c)

Overrides get-directory in drscheme:rep:context<%>.

This is the directory that the file is saved in, or the directory DrScheme started up in, if the file has not been saved.

(send a-drscheme:unit:tab get-enabled)  boolean?

Indicates if evaluation is currently enabled in this tab. Evaluation is typically disabled when some evaluation is already running (in another thread).

(send a-drscheme:unit:tab get-frame)

  (is-a?/c (scheme drscheme:unit:frame%))

Returns the frame that this tab is inside.

(send a-drscheme:unit:tab get-ints)

  (is-a?/c (scheme drscheme:unit:definitions-text<%>))

This text is initially the bottom half of the drscheme window and contains the users interactions with the REPL.

This text defaults to a drscheme:rep:text% object, but if you use the drscheme:get/extend:extend-interactions-text procedure, it will use the extended class to create the text.

(send a-drscheme:unit:tab is-current-tab?)  boolean?

Indicates if this tab is the currently active tab.

(send a-drscheme:unit:tab is-running?)  boolean?

Indicates if the running message in the bottom right of drscheme’s frame should be “running” or “not running” when this frame is active.

(send a-drscheme:unit:tab on-close)  void?

Refine this method with augment.

Specification: This method is called when the tab is closed.

Default implementation: Calls the definitions text’s on-close and interactions text’s on-close methods.

(send a-drscheme:unit:tab reset-offer-kill)  void?

Overrides reset-offer-kill in drscheme:rep:context<%>.

(send a-drscheme:unit:tab set-breakables

 

thread

 

 

 

 

 

 

custodian)

 

 

void?

  thread : (or/c thread? false/c)

  custodian : (or/c custodian? false/c)

Overrides set-breakables in drscheme:rep:context<%>.

drscheme:unit:tab% : class?

  superclass: object%

  extends: 

drscheme:unit:tab<%>

The base class that implements the tab’s functionality.

(make-object drscheme:unit:tab%)

  (is-a?/c drscheme:unit:tab%)

(send a-drscheme:unit:tab clear-annotations)  void?

Overrides clear-annotations in drscheme:rep:context<%>.

Clears any error highlighting.

drscheme:unit:program-editor-mixin : (class? . -> . class?)

  argument extends/implements: 

text%

 

editor:basic<%>

This mixes in the ability to reset the highlighting for error message when the user modifies the buffer. Use it for editors that have program text where errors can occur.

(send a-drscheme:unit:program-editor after-delete

 

start

 

 

 

len)

 

  void?

  start : number

  len : number

Overrides after-delete in text%.

Calls the super method.

Resets an error highlighting.

(send a-drscheme:unit:program-editor after-insert

 

start

 

 

 

len)

 

  void?

  start : number

  len : number

Overrides after-insert in text%.

Calls the super method.

Resets an error highlighting.

drscheme:unit:interactions-canvas% : class?

  superclass: canvas:wide-snip%

(new drscheme:unit:interactions-canvas% ...superclass-args...)

  (is-a?/c drscheme:unit:interactions-canvas%)

Passes all arguments to super-init.

drscheme:unit:frame% : class?

  superclass: (drscheme:frame:basics-mixin (drscheme:frame:mixin frame:searchable%))

  extends: 

drscheme:unit:frame<%>

This frame inserts the Scheme and Language menus into the menu bar as it is initialized.

(new drscheme:unit:frame% ...superclass-args...)

  (is-a?/c drscheme:unit:frame%)

Passes all arguments to super-init.

(new drscheme:unit:frame%)  (is-a?/c drscheme:unit:frame%)

Passes all arguments to super-init.

(send a-drscheme:unit:frame add-show-menu-items show-menu)

  void?

  show-menu : (is-a?/c (scheme menu%))

Overrides <method not found>.

Adds the “Show Definitions”, “Show Interactions” and “Show Contour” menu items.

(send a-drscheme:unit:frame break-callback)  void?

Specification: This method is called when the user clicks on the break button or chooses the break menu item.

Default implementation: Breaks the user’s evaluation started by the Run button (or possibly a queued callback in the user’s eventspace).

(send a-drscheme:unit:frame change-to-file file)  void?

  file : string?

Loads this file into this already created frame. In normal DrScheme use, this method is only called if this is the first frame opened and no editing has occurred. It should be safe to call this at anytime, however.

(send a-drscheme:unit:frame edit-menu:between-select-all-and-find)

  void?

Overrides edit-menu:between-select-all-and-find in frame:standard-menus<%>.

Adds the "Split" and "Collapse" menu items.

(send a-drscheme:unit:frame execute-callback)  void?

Specification: This method is called when the user clicks on the Run button or chooses the Run menu item.

Default implementation: It calls ensure-rep-shown and then it calls do-many-text-evals passing in the result of get-interactions-text and its entire range, unless the first two characters are "\#!" in which case, it skips the first line.

(send a-drscheme:unit:frame file-menu:between-open-and-revert)

  void?

Overrides file-menu:between-open-and-revert in drscheme:frame:basics-mixin.

Calls the super method and adds a separator-menu-item% to the menu.

(send a-drscheme:unit:frame file-menu:between-print-and-close)

  void?

Overrides file-menu:between-print-and-close in drscheme:frame:basics-mixin.

Adds a menu item for printing the interactions.

(send a-drscheme:unit:frame file-menu:between-save-as-and-print)

  void?

Overrides file-menu:between-save-as-and-print in frame:standard-menus<%>.

Adds a submenu that contains various save options:

  • save definitions as text

  • save interactions

  • save interactions as

  • save interactions as text

and adds a separator item.

(send a-drscheme:unit:frame file-menu:print-string)  void?

Overrides file-menu:print-string in frame:standard-menus<%>.

returns "Definitions"

(send a-drscheme:unit:frame file-menu:save-as-string)  void?

Overrides file-menu:save-as-string in frame:standard-menus<%>.

Returns "Definitions".

(send a-drscheme:unit:frame file-menu:save-string)  void?

Overrides file-menu:save-string in frame:standard-menus<%>.

Returns "Definitions".

(send a-drscheme:unit:frame get-break-button)

  (is-a?/c button%)

Returns the break button. Mostly used for test suites.

(send a-drscheme:unit:frame get-button-panel)

  (is-a?/c horizontal-panel%)

This panel goes along the top of the drscheme window and has buttons for important actions the user frequently executes.

A tool can add a button to this panel to make some new functionality easily accessible to the user.

See also mrlib’s switchable-button%.

(send a-drscheme:unit:frame get-canvas)

  (is-a?/c editor-canvas%)

Overrides get-canvas in frame:editor<%>.

Returns the result of get-definitions-canvas.

(send a-drscheme:unit:frame get-canvas%)  (is-a?/c canvas%)

Overrides get-canvas% in frame:editor<%>.

Returns the result of drscheme:get/extend:get-definitions-canvas.

(send a-drscheme:unit:frame get-definitions/interactions-panel-parent)

  (is-a?/c vertical-panel%)

(send a-drscheme:unit:frame get-definitions/interactions-panel-parent)

  void?

Specification: This method is provided so that tools can add area-container<%>s to the drscheme frame. Override this method so that it returns a child of the super-classes’s result and insert new children in between.

Default implementation: First case:

Returns the result of get-area-container

Second case:

(send a-drscheme:unit:frame get-editor)  (is-a?/c editor<%>)

Overrides get-editor in frame:editor<%>.

Returns the result of get-definitions-text.

(send a-drscheme:unit:frame get-editor%)  (is-a?/c editor<%>)

Overrides get-editor% in frame:editor<%>.

Returns the result of drscheme:get/extend:get-definitions-text.

(send a-drscheme:unit:frame get-execute-button)

  (is-a?/c button%)

Returns the Run button. Mostly used for test suites.

(send a-drscheme:unit:frame get-text-to-search)

  (is-a?/c text:searching%)

Overrides get-text-to-search in frame:searchable-text-mixin.

returns the text that is active in the last canvas passed to make-searchable

(send a-drscheme:unit:frame make-searchable canvas)  void?

  canvas : (is-a?/c drscheme:unit:interactions-canvas%)

stores the canvas, until get-text-to-search is called.

(send a-drscheme:unit:frame on-close)  void?

Overrides on-close in frame:searchable-mixin.

Sends the result of get-interactions-text the shutdown and on-close methods.

Calls the super method.

(send a-drscheme:unit:frame on-size)  void?

Overrides on-size in window<%>.

Updates the preferences for the window width and height so next time a drscheme window is opened, it will be this width and height.

(send a-drscheme:unit:frame still-untouched?)  boolean?

Specification: determines if the definitions window has not been modified. Used in conjunction with change-to-file.

Default implementation: Returns #t if the buffer is empty, it has not been saved and it is unmodified.

(send a-drscheme:unit:frame update-save-button modified?)

  void?

  modified? : any/c

This method hides or shows the save button, based on the modified? argument.

If the save button has not been created yet, it remembers the modified? argument as an initial visibility for the save button.

This method is called by the set-modified method.

(send a-drscheme:unit:frame update-save-message name)  void?

  name : string?

Updates the save message on the drscheme frame. This method is called by the set-filename method.

(send a-drscheme:unit:frame update-shown)  void?

Overrides <method not found>.

Updates the interactions, definitions, and contour menu items based on the contents of the windows.

drscheme:unit:frame<%> : interface?

(send a-drscheme:unit:frame get-language-menu)

  (is-a?/c menu%)

Returns the language-specific menu. This menu is called the Scheme menu in the Scheme language but is, in general, controlled by the 'drscheme:language-menu-title capability (see drscheme:language:register-capability for details on capabilities).

(send a-drscheme:unit:frame ensure-defs-shown)  void?

Ensures that the definitions window is visible.

(send a-drscheme:unit:frame ensure-rep-hidden)  void?

Makes sure the rep is hidden (by making the definitions window visible).

(send a-drscheme:unit:frame ensure-rep-shown)  void?

Shows the interactions window

(send a-drscheme:unit:frame get-current-tab)

  (is-a?/c (scheme drscheme:unit:tab<%>))

Returns the currently active tab.

(send a-drscheme:unit:frame get-definitions-canvas)

  (is-a?/c drscheme:unit:definitions-canvas%)

This canvas is the canvas containing the get-definitions-text. It is initially the top half of the drscheme window.

This canvas defaults to a drscheme:unit:definitions-canvas% object, but if you change the drscheme:get/extend:extend-definitions-canvas procedure, it will use the class in the parameter to create the canvas.

(send a-drscheme:unit:frame get-definitions-text)

  (is-a?/c drscheme:unit:definitions-text%)

Calls result of get-current-tab’s get-ints method.

(send a-drscheme:unit:frame get-insert-menu)  (is-a?/c menu%)

Specification: Returns the \scm|"Insert"| menu.

(send a-drscheme:unit:frame get-interactions-canvas)

  (instanceof (derivedfrom (scheme drscheme:unit:interactions-canvas%)))

This canvas is the canvas containing the get-interactions-text. It is initially the bottom half of the drscheme window.

This canvas defaults to a drscheme:unit:interactions-canvas% object, but if you use the drscheme:get/extend:extend-interactions-canvas procedure, it will use the extended class to create the canvas.

(send a-drscheme:unit:frame get-interactions-text)

  (instanceof (derivedfrom (scheme drscheme:rep:text%)))

Calls result of get-current-tab’s get-defs method.

(send a-drscheme:unit:frame get-tabs)

  (listof (scheme drscheme:unit:tab<%>))

Returns the list of tabs in this frame.

(send a-drscheme:unit:frame on-tab-change

 

from-tab

 

 

 

 

 

 

to-tab)

 

 

void?

  from-tab : (is-a?/c drscheme:unit:tab<%>)

  to-tab : (is-a?/c drscheme:unit:tab<%>)

Refine this method with augment.

Specification: Called after a new tab becomes the selected tab in the frame.

Default implementation: The from-tab argument is the previously selected tab, and the to-tab argument is the newly selected tab.

(send a-drscheme:unit:frame register-capability-menu-item

 

 

 

key

 

 

 

menu)

 

  void?

  key : symbol

  menu : (is-a? (scheme menu%))

Registers the menu item that was most recently added as being controlled by the capability key. This means that the (boolean) value of the capability determines if the menu item is present in the menu (the capability is checked when the menus are cliked on).

This assumes that the menu items in this menu are not moved around, except by the this capability. If they are, things can go funny ({\it i.e.}, no good checks are in place).

Note that the capability must be registered separately, via drscheme:language:register-capability.

(send a-drscheme:unit:frame register-toolbar-button tb)  void?

  tb : (is-a?/c switchable-button%)

Registers the toolbar button tb. This is required so that the toolbar buttons properly switch orientation when the toolbar’s position is moved.

drscheme:unit:definitions-text% : class?

  superclass: (drscheme:rep:drs-bindings-keymap-mixin (drscheme:unit:program-editor-mixin (scheme:text-mixin text:info%)))

  extends: 

drscheme:unit:definitions-text<%>

(new drscheme:unit:definitions-text%)

  (is-a?/c drscheme:unit:definitions-text%)

Passes all arguments to super-init.

(send a-drscheme:unit:definitions-text set-filename)  void?

Overrides <method not found>.

Calls update-save-message.

(send a-drscheme:unit:definitions-text set-modified)  void?

Overrides <method not found>.

Calls update-save-button.

drscheme:unit:definitions-text<%> : interface?

This interface is implemented by the definitions text.

(send a-drscheme:unit:definitions-text after-set-next-settings language-settings)

  void?

  language-settings : language-settings

Refine this method with augment.

Specification: Called when the next settings changes. See also get-next-settings.

Default implementation:

(send a-drscheme:unit:definitions-text begin-metadata-changes)

  void?

Augment this method to be notified when DrScheme is changing the buffer to insert metadata. The metadata is only inserted during saving, so tools that track changes to DrScheme will need to ignore changes that occur after this method is called, and before end-metadata-changes is called.

A call to begin-metadata-changes will always be followed with a call to end-metadata-changes (ie, the calls cannot be nested).

(send a-drscheme:unit:definitions-text end-metadata-changes)

  void?

Called when the changes to insert metadata are done, and the editor is back to its state at the time of the call to begin-metadata-changes.

A call to begin-metadata-changes will always be followed with a call to end-metadata-changes (ie, the calls cannot be nested).

(send a-drscheme:unit:definitions-text get-next-settings)

  language-settings

This method returns the language-settings that will be used when the user next clicks Run in this DrScheme window.

(send a-drscheme:unit:definitions-text get-port-name-identifier)

  symbol

Returns an identifier that can be used as a port’s name when the editor is not saved. (If it is saved, the filename of the editor should be used.)

(send a-drscheme:unit:definitions-text get-tab)

  (instanceof (scheme drscheme:unit:tab%))

Returns the editor’s enclosing tab.

(send a-drscheme:unit:definitions-text port-name-matches? id)

  boolean?

  id : any

Indicates if the name of a port (which is also saved in the source field of an exception record) matches this editor.

(send a-drscheme:unit:definitions-text set-needs-execution-message msg)

  void?

  msg : string?

Specification: This method, when called, puts this drscheme window in a state such that interactions submitted to the REPL will trigger a yellow warning message. The state is reset when the program is next Run.

Default implementation: Records msg and uses it the next time the user submits an interaction (unless the Runs first).

(send a-drscheme:unit:definitions-text set-next-settings

 

 

 

language-settings

 

 

 [

update-prefs?])

 

  void?

  language-settings : language-settings

  update-prefs? : any/c = (scheme #t)

Changes the language settings for this window. If update-prefs? is a true value, the preference is changed, which affects newly created windows.

See also after-set-next-settings and get-next-settings.

drscheme:unit:definitions-canvas% : class?

  superclass: editor-canvas%

Initializes the visibility of the save button.

(drscheme:unit:get-program-editor-mixin)

  ((subclass?/c text%) . -> . (subclass?/c text%))

Returns a mixin that must be mixed in to any text% object that might contain program text (and thus can be in the source field of some syntax object).

See also drscheme:unit:add-to-program-editor-mixin.

(drscheme:unit:add-to-program-editor-mixin mixin)  void?

  mixin : ((subclass?/c text%) . -> . (subclass?/c text%))

This function can only be called in phase 1 (see Implementing DrScheme Tools for details).

Adds mixin to the result of drscheme:unit:get-program-editor-mixin.

(drscheme:unit:open-drscheme-window)

  (is-a?/c drscheme:unit:frame%)

(drscheme:unit:open-drscheme-window filename)

  (is-a?/c drscheme:unit:frame%)

  filename : (or/c string? false/c)

Opens a drscheme frame that displays filename, or nothing if filename is #f or not supplied.