home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
488.lha
/
MakeMenu_v1.0
/
MakeMenu.doc
< prev
next >
Wrap
Text File
|
1991-03-08
|
7KB
|
168 lines
MakeMenu V1.0 (15-oct-90) - by Hans Jansen
This package aims to facilitate the design and coding of Intuition Menu
structures. It consists of two programs, the actual MakeMenu program, which
creates a C code file from a simple menu description file, and a TestMenu
program, which, when linked with the compiled output of MakeMenu, enables
you to view the menu without having to build a complete application around
it.
MakeMenu:
This program was adapted from "Menu Builder V1.0" by Custom Services, as
published on Fish Disk #65.
The original program contains the following copyright statement:
___________________________________________________________________________
| |
| This Software is Copyrighted 1986 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. |
|___________________________________________________________________________|
I adapted the program to my own, somewhat extended, needs because it
originally only generated menu items with the CHECKIT attribute,
without even so much as highlighting the selected item.
Like its predecessor, MakeMenu takes a simple sequential file and
from that file generates the menu structures for a program.
Call:
MakeMenu ifile ofile
ifile :
The menu descriptor file, containing lines of the form:
MENU,[Flags],Name
ITEM,[Flags],Name,[Select],[Command]
SUBI,[Flags],Name,[Select],[Command]
Name is the name of the Menu, Item or SubItem.
Select is an optional name which will display when the item is
clicked upon.
Command is the Character to use for selection of the menu item with
the AMIGA key. Only single letters A-Z are allowed. The letters
M and N are not allowed since Intuition uses these for screen control.
Flag (for menu entry):
"D" specifies the menu to be disabled.
Default attributes for a Menu's Flags field are:
MENUENABLED.
Flags (for menu item entry):
"D" specifies the menu to be disabled.
"T" sets the item attribute MENUTOGGLE;
"C" sets the item attribute CHECKIT;
"S" sets the item attribute CHECKED ("Selected").
Default attributes for an Item's or SubItem's Flags field are:
ITEMENABLED | ITEMTEXT | HIGHCOMP.
Note that no plausibility check is done on the combination of these
attributes!
ofile :
The resulting C code file, compilable as is! You may, however,
edit the source to modify the options.
Processing:
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.
The positioning of a menu will be automatically calculated based on the
length of the strings used in the menu to the left of this one. The
widest string will be used to base the width. Most of this processing
is contained in the function Do_Output; change its parameters as needed.
The structs Menu, MenuItem, and IntuiText will be generated as needed
to define the menus based on the input file.
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!
TestMenu:
This program was adapted from the Intuition/Menus example in pages
125-133 of the V1.3 RKM "Libraries and Devices:, also published on
Fish Disk #344 (the "Libs&DevsCompanion"). On that disk, the program
carried the following copyright statement:
/* Copyright (c) 1990 Commodore-Amiga, Inc.
*
* This example is provided in electronic form by Commodore-Amiga, Inc. for
* use with the 1.3 revisions of the Addison-Wesley Amiga reference manuals.
* The 1.3 Addison-Wesley Amiga Reference Manual series contains additional
* information on the correct usage of the techniques and operating system
* functions presented in this example. The source and executable code of
* this example may only be distributed in free electronic form, via bulletin
* board or as part of a fully non-commercial and freely redistributable
* diskette. Both the source and executable code (including comments) must
* be included, without modification, in any copy. This example may not be
* published in printed form or distributed with any commercial product.
* However, the programming techniques and support routines set forth in
* this example may be used in the development of original executable
* software products for Commodore Amiga computers.
* All other rights reserved.
* This example is provided "as-is" and is subject to change; no warranties
* are made. All use is at your own risk. No liability or responsibility
* is assumed.
*/
This program, when linked with the (compiled) output from MakeMenu,
will enable you to fast-prototype your menu design. The program will
report the menu/item/subitem numbers for any selection you make.
Usage of the package:
Build your menu description file with any text editor. Run it through
MakeMenu by a command like
MakeMenu menu.test menu.c
Then compile the resulting .c file and link the object with your own
application. That is all there is to it!
The supplied makefile (for PDC V3.3) will automatically build a new
executable for the test program TestMenu, when you define a new menu in
the file Menu.Test; the resulting output file will be called Menu.c.
When all goes well, it will also run the TestMenu program to let you
view your menu.
Bugs:
You must be kidding! I don't write any bugs into my software! [(:-)]
However, should you find anything wrong with the program, I should be
pleased to hear about it. Please e-mail me to the address below.
Notice that currently there is no way to generate mutual-exclusion
flags. Should I ever appear to need that functionality, I will probably
add it and repost the package. I have no way to predict when that will
be, if ever.
You are free to do with the package as you like; but in case of any
extensions being added I should still like to have a copy.
This package has been developed using PDC V3.33. I have not tried to
produce a makefile compatible to Aztec or SAS C; but I do not believe
adaptation to those environments will give any problems.
--
J (Hans) W Jansen @ Philips Medical Systems Nederland, Dept. DA&S-EDM
Building QP-1115 PO Box 10000 5680 DA Best The Netherlands
UUCP: hj@philtis.cft.philips.nl Voice: +31 040 763342