Next: , Previous: , Up: lepton-schematic API Reference   [Contents][Index]


3.4 Hooks

To use the hooks described in this section, you will need to load the (schematic hook) module.

lepton-schematic defines a number of hooks that allow functions to be automatically run whenever a number of built-in actions are invoked by the user.

Most Scheme functions do not call these hooks. If it makes sense for your code to invoke a standard hook, you should normally do so explicitly.

Warning: Functions added to these standard hooks should not normally modify their arguments.

For more information on hooks in Guile, see Hooks in Guile Reference Manual.

Variable: add-objects-hook

Called after objects are added to the page, at their initial creation. The argument is a list of the objects being added.

Variable: copy-objects-hook

Called after objects are copied, either via Edit → Copy Mode or similar, or to buffers, or to the clipboard. Argument is a list of the objects that were copied.

Variable: remove-objects-hook

Called after objects are removed from the page. Argument is a list of the objects being removed.

Variable: move-objects-hook

Called after objects are moved. Argument is a list of the objects that were moved.

Variable: mirror-objects-hook

Called after objects are mirrored. Argument is a list of the objects that were mirrored.

Variable: rotate-objects-hook

Called after objects are rotated. Argument is a list of the objects that were rotated.

Variable: paste-objects-hook

Called after objects are pasted to the page, either via Edit → Copy Mode or similar, or via buffers, or via the clipboard. Argument is a list of the objects that were pasted.

Variable: attach-attribs-hook

Called after attributes are attached to something. The argument is a list of the attributes that were attached.

Variable: detach-attribs-hook

Called after attributes are detached from something. The argument is a list of the attributes that were detached.

Variable: select-objects-hook

Called after objects are added to the selection. The argument is a list of objects that were selected.

Variable: deselect-objects-hook

Called after objects are removed from the selection. The argument is a list of objects that were deselected.

Variable: new-page-hook

Called when a new page is created. The argument is the new page.

Variable: open-page-hook

Called when an existing page is loaded. The argument is the loaded page.

Variable: action-property-hook

Called when an action property is set. The arguments are the action, the property key and the property value. See Actions.

Since 1.10.

Variable: bind-keys-hook

Called when a key binding is set or modified. The arguments are the keymap, the key sequence and the binding’s target.

Note: bind-keys-hook may be run multiple times for a single key binding event if the target keymap is bound within a superior keymap.

Since 1.10.

Variable: switch-action-mode-hook

Called when GUI switches to a new action mode. The argument is the new mode.

The action mode may be one of the following symbols:

  • select-mode
  • grips-mode
  • arc-mode
  • box-mode
  • bus-mode
  • circle-mode
  • line-mode
  • net-mode
  • path-mode
  • picture-mode
  • pin-mode
  • component-mode
  • copy-mode
  • multiple-copy-mode
  • move-mode
  • paste-mode
  • text-mode
  • box-select-mode
  • zoom-box-mode
  • pan-mode
  • mirror-mode
  • rotate-mode
(add-hook! switch-action-mode-hook
           (lambda (mode) (display mode) (newline)))

Since 1.10.


Next: Actions, Previous: Selections, Up: lepton-schematic API Reference   [Contents][Index]