Custom Services MenuBuilder Version 1.0 By A. F. Preston IMPORTANT NOTE: This Software is Copyrighted 1987 by Custom Services All rights to this and the generated data are the property of Custom Services and may not be used for Commercial purposes without the express written consent of Custom Services. This program is made available as "No Frills Software" to be distributed with all the copyright notices intact. Custom Services Has many useful tools to aid in program developement. This program along with the complete documentation is available by sending $5.00 to: Custom Services P. O. Box 254 Moorestown, NJ., 08057 By Sending a disk with your PD software or shareware you will recieve a $2.00 discount. General Description: There is a difficulty in building menus, this program will automate the process. This program will take a simple text file and generate a C source file with all the needed structures for producing an AMIGA Menu. Input: The Input to this program is a simple set of three commands. The commands are: MENU,Name ITEM,Name,[Select],[Command] SUBI,Name,[Select],[Command] Position and Flags will be set to a reasonable default. The User may Edit the resulting source to modify the options. Name is the name of the Menu, item or Sub item. Select is an optional item which will display when the item is in position to be selected. The V1.2 Intuition will overlay the text in Select field on top of the text in the Name field. Command is the Character to use for selection of the menu item with the AMIGA key. No check will be made to see that characters are not used more than once. The positioning of a menu will be automatically calculated based on the length of the strings used in the menu. The widest string will be used to base the width. Most of this processing is contained in the routine Do_Output, Change it's parameters as needed. Sub Menus will overlap the Menu Item by about 40 %. Output: The Output will be generated from the text in the file. A Standard C source file compatible with Lattice C and V1.2 Intuition will be generated. The struct's Menu, MenuItem, and IntuiText will be generated as needed to define the Menu's based on the input file. Process: The text file is read line by line and the data saved in the regular Intuition structures. After all data is read and no errors have been found the program will output to STDOUT all the text needed to generate the menu described. If sub menus are specified the position of the sub menu will be about 40 % overlapped with the linked menu item. Usage: Build your file of the appropriate menu description statements. Run the program redirecting the output to a file. Compile the file. Link you menu with the driver and processing programs and go! You will need to include the statement: extern struct Menu *MyMenu; In your source program and call: SetMenuStrip(window ptr,MyMenu); Also, before you close your window you must call: ClearMenuStrip(window ptr); or risk a spectacular crash. I don't know why Intuition doesn't do this automatically as normal exit time cleanup! Examples: A program was published in AMIGAWORLD which contained two source files: The first was a driver program, the second a Menu. This program allowed users to test their menus, it is included here as a driver. The results from the Menubuilder will be a file which is compatible with "MENU". A script file BUILD_IT will build the MENUBUILDER, create your menu, compile the result, link the driver, and execute your test. The test file is a sample menu with sub menus. The resulting program is called Process. Process is a simple menu handler. You have to add your own code to do the work required by your task. MENU will open a screen and window and pass menu items to Process. If the -d option is used, MENU will display the menu items and not pass the data on to Process. A program would have 1) Menu - Screen, Window, Argument processing, and Menu handling 2) Process - your code to do whatever the program is supposed to do. 3) text.c - the menu file generated by MENUBUILDER The file text.c is generated by the command: MENUBUILDER >text.c test This must be compiled and the three files linked. See Build_It to see how this is done. Known Features(Bugs) and improvements: I am currently using this program as supplied. I do find that command sequences require a slightly larger width and am working on corrections for that code. The code generated by MENUBUILDER will compile without warnings and appears to be correct. It would be nice if the generated code would be checked for menu's that are too large for your screen. Range checks for pixel positions outside the 640 X 200 Hi Res screen would save time. I am looking into range checking. Warranty: 30 seconds or 30 feet whichever comes first! Seriously, I would like to know if you find bugs in this or any of my programs. I will try and fix the bug and return you a good version of the program. All I ask is that you send a disk with information on what the problem is. Please include return postage with your disk!