# Generate Dialog

This dialog gives you an overview of all the files which can be generated from your design. The dialog contains some default settings, including default filenames. The default filename is appropriate to the type of file and the language being generated. You can change the defaults in the application resource file.

Setting the Language

For the language, use the "Language" option menu at the top of the dialog. You have a choice of C, C++ and UIL. When in Microsoft Windows mode, you have the additional choices "C++ (Motif XP)" and "C++ (Microsoft Windows MFC)"

Setting the Base Directory

To set the base directory you can type it directly into the text box labelled "Directory" or you can press the "Browse" button. The "Browse" button displays a file selection box so that you can find and select a directory. The filenames of the files to be generated are relative to the base directory. By default, the base directory is the directory in which you last opened a saved design or, if you are working on a new design, the directory from which you invoked WorkShop Visual. The default, which is shown enclosed in brackets, is not saved into your ".xd" file. An explicitly named directory will be saved.

You can type an absolute pathname into the filename text boxes. This method is not recommended because you would have to do this for every file. It is easier and less prone to typing mistakes if you set up the directory first and assume all files are relative to that directory.

Setting up the Primary Source File

In the text box labelled "Code", enter the filename of your primary source file.

From top to bottom, your primary code module contains the following sections:

- Headers (optional)
- Global variable declarations
- Declarations of link functions, or the functions themselves (optional)
- Structures needed for your fonts and pixmaps and code setting up font and pixmap objects
- Widget creation code for your design hierarchy
- A main() procedure (optional)

The optional portions of the file can be included or excluded by setting toggles on the control panel.

Setting up the Stubs File

Callback stubs, i.e. "empty" routines with the specified callback or method name, are generated for all callbacks and callback methods in your design. These are generated into a separate source file called a Stubs File. If you have callbacks or methods in your design, generating a stubs file allows you to compile the application since the callbacks are referenced from the main source code. It is left to you, however, to add the required functionality to the callback routines.

Setting up the Externs File

WorkShop Visual can generate a header file with extern declarations for all widgets which are global in scope, C++ class definitions and C structure definitions for your design. Global widgets include all widgets which you have explicitly named and those which you have designated as global on the Core resource panel.

To set up an Externs file, type the name of the file in the text box labelled "Externs" and set the "Generate" toggle next to it. By convention, Externs files have the suffix .h.

Setting up the Pixmaps File

The Pixmaps file is similar to the Externs file. It is a header file with static declarations of all pixmaps in your design. Generating one of these lets you keep the cumbersome definitions of pixmap structures in a file separate from your primary source file.

To generate a Pixmaps file, type the name of the file into the text box labelled "Pixmaps" and set the corresponding "Generate" toggle. By convention, Pixmaps files have the suffix .h.

Setting up the Main Program File

The main() program file is a file containing the main() procedure. By generating a separate file you can keep this procedure away from the rest of your source code. This is useful if you need to edit the procedure to perform some of your own initializations or call other parts of your application before starting off the user interface. If you edit this file, make sure that you generate it only once as subsequent generations will overwrite your changes.

If you wish the main() procedure to be generated into the primary source file, make sure that the text box labelled "Main program" contains the same name as the "Code" text box and the corresponding "Generate" toggle is set.

Setting up the X Resource File

Resource settings need to be available or they are not applied when your interface runs. You can make them available in one of two places: the primary source file or the X resource file. Generating resources into the source file is known as hard-wiring them

Setting up the Makefile

WorkShop Visual can generate a makefile for you which creates compilation instructions for all the files required by your design with the correct dependencies.

Finishing the Generate Dialog

When you have finished setting up the files you wish to generate and their options in the Generate Dialog, you can press "Apply" to save the settings or "Generate" to generate the files straight away. If you select "Apply" you can invoke the Generate Dialog when you are ready and then generate all the selected files, or you can select the relevant button on the toolbar to generate individual files using the settings you applied earlier without producing the generate dialog again. If you have set the "Save on generate" toggle, pressing "Generate" performs an "Apply" as well as generating the requested files.

See also:

- Primary Source File Options dialog
- Makefile Generation Options dialog
- Code Generation Options dialog
- Resource Panels and other WorkShop Visual dialogs
- Callbacks
- Code Generation
- Code Preludes
- Module Preludes
- Core Resources dialog
- Microsoft Foundation Classes
- Microsoft Windows Mode
- Pixmap Editor
- About WorkShop Visual