# Code Generation Options dialog

This dialog lets you control where, and whether, the code for links is generated, specify the application class name and control where individual resource types should be generated. These are dealt with separately below.

Application Class Name

The application class name is used to identify resource settings when you generate an Xresource file. Assigning a name other than the default "XApplication" prevents confusion of your resource values with system-wide X resources.

Links Code Generation

Using the option menu labelled "Links", you can choose whether the links are generated into the primary source file, into the stubs file or not generated at all. Alternatively, you could choose to generate the links code declarations only.

The code created as part of the links functionality consists of a set of generic functions (one for each of the four types of link) and the declarations of these functions. Because the functions are always the same, you only need to generate one set of the functions for your whole application. If you are generating code from more than one design, each of which contains links, you only need to generate the functions once but you will need to generate the declarations for each design. The declarations are always generated into the primary source file.

Comment Preludes

This option menu refers to the special comments which appear in the generated code around the areas where preludes can be added. You can choose whether you wish comments to be added "Always" (whether a prelude has been specified or not), "When Defined" (i.e. only when a prelude has been specified) or "Never". The default is "Never".

The example below shows a comment for a shell pre-manage prelude. Because there is no prelude inside the comment we must assume that "Always" was the selected option:

    	/* visu: prelude for shell1: pre-manage >>> */

    	/* <<< pre-manage ends. */
    	XtSetArg(al[ac], XmNallowShellResize, TRUE); ac++;
    	shell1 = XmCreateDialogShell ( parent, "shell1", al, ac );
    	ac = 0;
    	/* visu: prelude for form1: pre-create >>> */

    	/* <<< pre-create ends. */
    	XtSetArg(al[ac], XmNautoUnmanage, FALSE); ac++;
    	form1 = XmCreateForm ( shell1, "form1", al, ac );

Control of Resources

The panel in the middle of the Options dialog contains references to each type of resource.

Motif defines the following resource types:

- Strings Includes null-terminated character strings and XmStrings
- Fonts
- Colors
- Pixmaps
- Translations
- Scalars Multiple-choice resources, including Booleans. On most resource panels, these are on the "Settings" page
- Integers Any integer resource setting which is not a scalar
- Reals Any floating-point numeric resource value

You can specify into which file each resource type should be generated. If a resource is generated into the source code it is then hard-coded and cannot be modified through the resource file. Typically, any resources which are not generated into the source code are generated into the X resource file, where they can be edited by the end user.

The option menu labelled "Callbacks" differs from the others. This is only used for UIL and lets you choose whether callbacks are registered in the UIL code or the C code. By default, they are registered in the UIL. If you use client data, however, you should generate the callbacks into the C code, because structure types cannot be defined in UIL.

Masking Resources

If you look at any resource panel, you will see that it contains unlabeled toggles next to each resource.

These work in combination with the "Mask widget resources" and "Mask only global resources" radio buttons in the Generate Options dialog. Using all these gives you control over the generation of resources on an individual basis.

Mask Widget Resources

The following description applies when the "Mask widget resources" is set:

If an individual resource does not have its resource panel toggle set, the resource is generated according to the option menu for its type in the Generate Dialog - i.e. a Label string with the resource panel toggle off will be generated to the file specified by the option menu labelled "Strings".

If an individual resource does have its resource panel toggle set, the resource is generated to the opposite file from the one specified for its type by the option menu in the Generate dialog - i.e. an integer resource with the resource panel toggle on will be generated to the resource file if the "Integers" option menu is set to "Code" and to the code file if the option menu is set to "Resource file".

Mask Only Global Resources

The following description applies when the "Mask only global resources" is set:

The option menus in the Generate dialog now apply only to global objects (font, color and pixmap objects). These (and only these) are controlled exactly as discussed for all resources in the Mask Widget Resources section above.

All other resources are controlled only by their individual resource panel toggles. They are generated into the code file if the resource panel toggle is off and into the resource file if the resource panel toggle is on.

See also:

- Generate dialog
- Primary Source File Options dialog
- Makefile Generation Options
- About WorkShop Visual