|The DrWimp C Application Builder|
|Wimp Lib Action|
When a new application is created a default main window, iconbar menu and icon are
created for the application, with default actions. Three files are placed into the C source code directory. drwapp.c is copied from the !DRWDEF application and two are application specific files generated by DrWimpC App Builder - drwUtregfn.c and drwUli.c. The last two contain application and library initialization code, while drwapp.c contains the main program loop which exits when the application is quit by user action, or an error occurs that requires the application to be stopped. These files are required whether the Wimp Lib Actions user functions are used or the alternative template function definitions are used.
Of course, each application will provide its own code for the wimp events it wants to handle.
The WimpLibAction facility provides a simple way to use the matched user/wimp function interface of the DrWimpC library. The Wimp Lib Actions menu lists the types of wimp interaction category each item leading to a submenu of wimp interactions associated with the category. Each wimp interaction type has a submenu of files that contain the default user functions required for the wimp interaction. <Select>ing a wimp interaction type will cause the user files it requires to be copied into your application (if they don't already exist). Then <Select>ing one of the files will load it into the text editor. You can then add your own code to the user functions and save the file back to your application..
The DrWimpC library is organized according to the design of the BASIC DrWimp library into functions that interact with the wimp and OS as events such as mouse clicks, menu selections, wimp messages are received by the application, and call user written functions to allow an application to respond to them. The user functions have the same definition for each application and default functions must be present for each event that you want your application to handle.
If a user file exists in the application's C directory its submenu item will be ticked. All files should be ticked for a Wimp Lib Action to be correctly included in an application, otherwise the compile and link will fail with missing symbols for user functions that have not been defined.
Employing the user functions to interact with the DrWimpC library leads to a close correspondence with programs written using the BASIC DrWimp library. There is a single user function in DrWimpC for every user function defined in the BASIC DrWimp library, except for a few where defining a C version of the function is either unnecessary or has no meaning in C, or can be done in a way that doesn't warrant a C function.
There are also a number of new user functions for enhancements to the DrWimpC library such as RAM transfers, the OLE protocol, and client external edit facility.
When all user files for a wimp interaction are present in an application its entry in the sub menu will be ticked. Certain user functions will be present in all applications. These are placed in file 'drwUwinit.c'. Examples are drw_uw_init, drw_u_quit, drw_u_pwnz and drw_uw_closedown.
|User Source Menu|
|Edit Sources Menu|
|Add New File|
|!drwdef Part 1|
|!drwdef Part 2|
|!drwdef Part 3|
|External Dependency Links for !DrWimpC.|
|This web site without the zip files.|
|Back to TOP|
The menu tree below shows the Wimp Lib Action menu, opened by <SELECT>ing the Project' button in the Projects window, after the Null Events action has been selected, including the source file action menu with title of the file's name. From here you can start an external edit of the drwUNull file by clicking on its ticked item in the Null Events menu, or by selecting Goto Line in the source file submenu and entering a line number. You can also go directly to a function in a file (there is only a single function in the default drwUNull file) by selecting the FN List item in the source file submenu to open a window containing a list of functions in the file. Clicking on a function will start, or continue an external edit with the cursor placed in the edit window at the start of the body of the selected function. As already noted , you need an editor that has implemented the external edit protocol available - which means !StrongEd or !Zap.
|Back to TOP|
There is another useful way to start editing the standard user files from the Project menu Source Files
item. Following its submenu leads to a list of user file types, and then to a list of either descriptive names of each standard user file or a list of standard user file names. From there you can click on the name or use the source file submenu as above. See below for an illustration using the drwUNull file. A tick by the item indicates the file is present in the application's C source file directory.
|The standard user files listed by name from the Standard Files submenu item.|
|The standard user files listed using descriptive names..|
The submenu of a ticked item is the source file submenu as above.
|Back to TOP|
You can add your own C source files either manually or from the New File item in the Project menu. These can be accessed from the User Files item of the Source file Types menu shown above. It is greyed out if there are no files of your own in the C source file directory. Similarly, you can do the same with header files. These will be stored in the application's h directory. Header files for the standard user files are defined once in the DrWimpC library h directory. (in DRW:h). If you add new functions to a standard user file you should either provide your own header file for their prototype definitions, or define the function before it is used in the file.
Once an edit is started you can do all the usual edit stuff. Saving the file returns the updated file to DrWimpC App Builder which saves the file back to the application. In the source file submenu you can also use the Save File option to save the file, or Return File to save the file and continue editing it. Abort Edit does what it says without saving the file. The Refresh item causes the function list held by DrWimpC App Builder for the file to be updated to include any new, or remove deleted functions no longer in the file, while continuing the edit.
You can get a list of current external edits in !DrWimpC by right-clicking on the !DrWimpC iconbar icon. Clicking select on an item in the resulting list will bring the edit window to the top of the window stack.
The Touch item updates the file's timestamp.
The Shared/Debug flag is used to individually control whether the file is compiled with debug information (for the ROOL compiler tools) or as position independent code (for the GCC 4 shared library option).
The clean options remove object files created created by the compilers. (Separate object files are maintained in different object file directories [named depending on the compiler used and the Shared/Debug flag setting]). The object file directories are named o (ROOL compiler used) , od (for ROOL compiler with debug option), og (for GCC 4 static compile), and ogd (for GCC 4 position independent code). The Project Compile and Dev Tool Choices menu and dialogue control these settings globally, for all source files in an application..
The Clean Project menu is opened by <SELECT>ing the 'Clean' button in the Project window. It controls the cleaning of the object directories globally, for the application. (Clean App removes only the application object files, Clean All also removes the Template function object files) and/ or target !RunImage and Template Code libraries.
Selecting one of the first two menu items on the clean and clean all menus .does the deleting of either all object files and targets such as the !RunImage, and for the clean all menu any template library objects. The other items control which version of object files are deleted. That is, the location of the object files - the o, od, og and ogd directories, and for template libraries the obj, objd, objg and objgd directories. Selecting the Delete Obj Dir item will also cause these directories to be removed.
|Back to TOP|
|The New File Dialogue.|
This dialogue is accessed from the New File Project menu item via a sub menu that allows you to select whether a new C source file or C header file is to be created. .The new header file is placed in the application's h directory, or if as in the example, the Application hdr indicator is set,, in a sub directory inside the application named with the application's name.
Here the resulting file would be named TextFile placed in the directory HardDisc4.$.!NewApp.NewApp.h.
|Back to TOP|
|Selecting OK creates the file. An empty external edit window for the file is opened..|
When an application using the DrWimpC library starts the library performs various initialization tasks such as opening message files, allocating memory for library resources, etc. Then. the application is registered as a wimp task by calling Wimp_Initialise.
After a valid wimp task handle is returned the library passes control to your application to do its own initialisation by calling the user function drw_uw_init() which is defined in drwUwinit.c. Place all your initialisation such as allocating memory, loading templates and creating windows, defining menus etc in this function. The file can be quickly accessed from the Project menu App Initialise item. The App Initialise sub menu has three file items including drwUwinit.c.
The drwUli file is generated by DrWimpC App Builder and is in the menu for info only..
drwapp contains the main() function and a function to allow user specific settings affecting library initialisation to be made
One chore of initialisation is defining menu structures. Unlike Templates, there is no friendly menu editor to help. DrWimpC App Builder provides a GUI method of defining menus and menu structures described in the next item.
|Next: Defined Menus.||Previous: Getting Started.|