To use the functions described in this section, you will need to load
(gschem action) module.
Usually, it is sufficient to use normal Scheme functions when extending gschem. However, when integrating an extension function with the gschem GUI (e.g. via keybindings), it is often useful to couple a Scheme function with metadata such as the label and icon to show in menus, etc.
You can do this by creating a gschem action. Actions can be called
just like a normal Scheme function, but get executed via the gschem
eval-action! rather than being invoked
directly. Normally, actions have names begining with an ‘&’
Create a new action, bound to the given name in the current module. The body is a sequence of Scheme expressions which are evaluated in order when the action is invoked. Any number of initial properties can be specified for the action by providing pairs of keywords and values.
(define-action (&report-bug #:label ``Report Bug'' #:icon ``web-browser'') (show-uri ``http://bugs.launchpad.net/geda/+reportbug''))
Create and return a new action wrapping thunk. Optionally, specify keyword-value pairs to set initial properties for the action.
Returns ‘#t’ iff obj is a gschem action, and ‘#f’ otherwise.
Action properties are name-value pairs that are attached to an action.
Return the value of one of action’s properties. key is a symbol naming the property to retrieve.
Set the value of one of action’s properties. key is a symbol naming the property to set, and value is the new value.
All of gschem’s built-in actions are callable just like normal Scheme functions. However, it’s sometimes useful to explicitly evaluate an action in the same way that the gschem GUI (menus, toolbars or keybindings) would do so.
Invoke action, returning ‘#t’ on success and raising an
error on failure. There are a number of possible types for
eval-action! will accept:
The special symbol ‘repeat-last-command’ is interpreted as a
request to repeat the last action evaluated via
Note: If you have an action object
&action, then the
following to calls are equivalent and interchangeable:
(eval-action! &action) (&action)
Often in gschem actions it may be useful not to use the actual current mouse pointer position but to use the mouse pointer position that was current when the action was invoked.
Evaluate action at a particular point on the schematic plane. If point is omitted, the action is evaluated at the current mouse pointer position.
Return the current action pointer position, as set when the action was
eval-action-at-point!). This only makes sense to
call from inside an action.
Note: The pointer position can only be considered reliable when the user was actually clicking on or pointing at the schematic view area to invoke the action, rather than on a menu or toolbar button. At the moment this means that an action position is only set when a command is invoked by hotkey.