9.5.2 Project Object Defaults (TypeDefaults)

The .defaults group on the Project object contains a number of objects called TypeDefaults. These objects can represent the default values of fields within a whole range of possible objects that could be created in the project. These defaults are used to make sure that the appropriate types of objects are created for particular algorithms. This is done through the use of default files, which are saved groups of TypeDefault objects.

There are a number of different default files saved in the `defaults' directory, one of which is automatically loaded into the .defaults group of the project when it is created. Which one is used is based on the name of the PDP++ executable (i.e., bp.def for bp++). When PDP++ starts, it checks the name of the executable, and puts the appropriate defaults file name in the default_file field of the PDPRoot object. Changing this field will change the default file that will be used when a new project is created.

The user can create their own defaults files, to have things come up just the way they like them. It is recommended that you start with the basic defaults appropriate to a given algorithm that you will be using. Simply edit an existing or create a new TypeDefault object in the .defaults group of a project that has the right initial defaults in it. There is one TypeDefault object for each different type or class of object whose default values are being set. Derived classes (see section 8.1.1 What is an Object?) automatically inherit default values set on parent classes.

The TypeDefault object has the following members:

TypeDef* default_type
This is where you pick the type of object you want to set the default values of. Note that many types are descended from taNBase, so look in its submenu. Be sure to press Apply after selecting a type, so that the object knows what type of token to make.
TAPtr token
This field contains a token of the type selected in default_type (remember to hit Apply first before editing this!). Default values are set by simply editing this object and setting the values of the fields as you want them to be by default. Only those fields that have a check in the leftmost checkbox next to the field will have default values saved. Thus, make sure that box is checked when you make changes to the fields. Then, Ok the dialog, and be sure to hit Apply on the TypeDefault object itself. This causes the specific changes you specified to be registered in the active_membs group, which only records the values of those members that were checked.
taBase_Group active_membs
The type default values are actually saved as name-value pairs (using the NameValue object), where the name is the name of the member, and the value is a string representation of its value. This is a group of such name-value pairs for the checked fields. While you can enter things directly in here, it is recommended that you use the token to do it instead.

When you have created a set of defaults, save them using the Save As/All menu item in the .defaults group. If you have the appropriate permissions, it is easier to put the defaults file in the global `/usr/local/pdp++/defaults' directory. However, it is cleaner to keep your defaults in your own directory. Since your home directory is searched automatically for default files, you could put the default files there. A better solution is to create a special directory to hold your defaults, and add this directory to your include_path in your `.pdpinitrc' file (see section 9.5.1 Settings and the .pdpinitrc and .cssinitrc Files).