logo

14 Templates

Templates simplify the re-use of configuration elements. A template may contain simple defaults like that all float signal shall be painted red. But they can also contain a rich set of elements containing multiple scripts and folders.

Templates is a new feature in version 1.3/1.4

Using templates

Templates can be used in two ways:

  1. Explicitly select and add them using the context menu.
  2. Implicitly let the system select, if you drag&drop a signal into the configuration tree.

Explicitly

All templates with the flag Show in add/insert menu checked are offered in the context menu. If a group is entered, they will appear in "<group> Templates". If you add or insert a template, system will just make a 100% copy of the content without changing anything. Any required signals need to be added manually.

Implicitly

All templates with the flag Use pattern for automatic instantiation checked can be used if doing drag&drop of signals into the configuration tree. To let the system detect the right template you need to define a pattern (see below). If the pattern of a template matches (depending of the order), a copy of the content will be added/inserted at the drop position. Additionally the following changes are made:

  1. All input signal references are set to the dropped signal.
  2. All empty name fields are set to the dropped signal name.
  3. All empty description fields are set to the dropped signal description.
  4. All macros ${name} in any name field are replaced by the name of the dropped signal.

Defining templates

There are two steps required to add a template. First define the template itself and its pattern. Then add the content that shall be added when using the pattern.

Templates are located at Preferences->Impulse->Templates. After adding a new template you will find these fields:

Name/Description
Just name and description. No further meaning.
Group
Used to organize templates in context menu.
Use pattern for automatic instantiation
Check this field for implicit usage.
Process Type / Signal Type
Used for matching (implicit usage) and configuration dialogue context (Signal fields are usually empty, so the dialogue does not know which offers to show).
Name pattern
This pattern matches,a) if the signal name contains the field text (regular unchecked) or b) the regular expression matches the signal name (regular checked).
Description pattern
Same as name pattern
Signal descriptor pattern
Again the same behaviour as with the name pattern. A signal descriptor has the form type (e.g. default)
Show in add/insert menu checked
Check this field for explicit usage.

After defining the pattern, you can add configuration content. You may use the context menu/buttons to add new elements, or you may copy existing elements from your configuration and paste them into the content area.

Examples

Default line diagram settings for float signals

Create a new template, enter name, select Float type, check Use pattern for automatic instantiation and check Enable. Add a new samples configuration, enter the dialogue and set the intended settings for float signals.

Default settings for buses

Create a new template, enter name, select Logic type, check Use pattern for automatic instantiation and check Enable. Next step depends on how to identify a bus signal. Lets assume buses got a signal descriptor default<bits=32>. So enter this in the field Signal descriptor and un-check Regular. Add a new samples configuration, enter the dialogue and set the intended settings for the bus.

Script template

Create a new template, enter name and group, select the Signal Type, check Show in add/insert menu and check Enable. Add a new samples configuration, enter the dialogue, change to script production and enter the script code.