home *** CD-ROM | disk | FTP | other *** search
- Vgad
-
- A gadget making tool for the Amiga
-
- Written and Copyright (C) 1987
- by: Stephen Vermeulen
- 3635 Utah Dr. N.W.,
- Calgary, Alberta,
- CANADA, T2N 4A6
- (403) 282-7990.
-
- Version 1.00, 14-Dec-1987
-
- =============================================
- This program may be freely redistributed
- provided that no charge is made for such
- distribution appart from reasonable media
- costs. This program may not be distributed
- with any commercial product without the
- prior written approval of the Author.
- =============================================
-
- Introduction:
-
- This little utility was brought to light by the need to create
- windows full of gadgets quickly from finnished art work. The
- philosophy that was adopted (since I am such a lousy artist) was
- that the Artist should create the ENTIRE window (including gadget
- layout and imagery) and then the Programmer would convert that
- finished art work to the appropriate SHORT[]/Image/Gadget/Window
- structures.
-
- This approach was tried using a commercial product and the idea
- was found to be sound; however, the approach taken in that product
- necessitated the careful window layout being shattered into
- brushes which would then be separately (and painstakingly)
- loaded and repositioned. This seemed like a major Government make
- work project so Vgad was born.
-
- Vgad provides none of the fancy frills associated with other gadget
- editors; it takes a very simple direct approach that you might find
- does the job very quickly. The idea is: the Artist creates all the
- imagery in two pictures (standard IFF pics). One picture contains the
- normal state (non-selected) and the other contains the fully
- selected state (all gadgets simultaneously depressed). The Programmer
- then runs Vgad on these two pictures and quickly boxes each gadget
- in turn. Once this has been done (typically just a few minutes)
- Vgad will have produced a C-source code file containing all
- the necessary data and control structures. The Programmer does a
- few more edits of this .c file and the associated .h file and
- compiles it... And as they say: "the rest is left as an example
- for the interested reader."
-
- Running Vgad:
-
- Vgad can only be run from the CLI at this time. The command to
- run it is either:
-
- Vgad
-
- which will print a copyright message and version number, along with
- the command syntax; or:
-
- Vgad normal.pic selected.pic prefix file.c file.h
-
- which will start the ball rolling. The various command arguments are:
-
- normal.pic:
-
- This is the normal (quiescent) state picture of the window. This
- is a standard IFF graphic, which should normally be rendered on
- one of the standard screen sized pages. This graphic may have
- any number of colours (ie. bitplanes) that the standard screen
- mode will allow - but exercise restraint: the Amiga is a
- MultiTasking machine so don't waste memory!
-
- To make this picture, just call up your favourite graphics editor
- (Express Paint etc.) and start doodling. Better yet, call your
- local starving Amiga artist and get him to make the picture :-)
-
- selected.pic:
-
- This is another standard IFF graphic. This one contains the
- selected state (highlighted) imagery for all the gadgets in
- the normal.pic. This can be very easily made by editing a copy
- of the normal.pic and just using a rectangular complement tool
- to do the appropriate highlighting. Alternatively, you can get
- your Amiga artist to make all sorts of fancy anternate imagery
- (since this is what Vgad does) for each of the gadgets.
-
- It is important that these two pictures are aligned in the same
- way on their pages because Vgad will assume that the normal and
- selected images for each gadget are in the same place on the two
- pictures.
-
- prefix:
-
- The prefix is a single text string that you want to use as the
- identifier for all the structures that are produced by Vgad from
- the two pictures. This string allows you to make the various
- structure names unique and to easily include the output from
- several runs of Vgad in one program without name conflicts.
-
- Vgad will construct the names of all the structures it generates
- from this prefix string by the following type of printf statement:
-
- printf("%s%d_%s", prefix, no, postfix);
-
- The "postfix" string depends on the type on the structure to be
- generated. Examples include "gadget" for a Gadget structure,
- "image", "window"... The "no" integer variable is the number
- of the structure. For example this is the 3rd Image structure or
- this is the 5th Gadget structure, and so on.
-
- file.c
-
- This is the file to which Vgad will write the C source code output.
- Currently all structures are written to this one file. Ideally,
- one would want to write the image data to its own file since that
- is the only data that must be in CHIP ram. This file can become
- quite large so you should make certain that there is enough free
- space on the destination device.
-
- file.h
-
- This file is a header file that you can include from your own
- source code to define all the structures that are contained in
- file.c. This file will not be very large; there is typically a
- ratio of about 50:1 between the file.c and file.h sizes.
-
- Usage:
-
- Once Vgad is up and running all you will see is a screen filled with
- your normal.pic. There are no menus or gadgets attached anywhere on
- this screen.
-
- Vgad gets its instructions in from you in two ways. The first is by
- you boxing an area on the screen. The boxing process is the fairly
- standard: push select button down, drag the mouse around until the box
- is the correct size and then release the select button. If you made
- a mistake in the area boxed, just box it again, Vgad only remembers
- the last area boxed. There is one twist to the boxing of areas, this
- is modeled after Express Paint, that is while you are rubberbanding
- a box you can DRAG the entire box (without changing its size) anywhere
- on the screen by just holding down a shift key while moving the mouse.
-
- The second source of commands is the keyboard. Vgad understands the
- following keys:
-
- b make a boolean Gadget of the currently boxed area,
- i make an Image of the currently boxed area,
- l make a longint Gadget of the currently boxed area,
- p make a proportional Gadget of the currently boxed area,
- (not implemented in this version)
- s make a string Gadget of the currently boxed area,
- w make a Window of the currently boxed area
-
- q quit, exit Vgad.
-
- So the actual use of Vgad goes something like this:
-
- 1. run Vgad
- 2. box an area
- 3. press a key to indicate what to do with the area just boxed
- 4. are we done?
- 4.a if yes press 'q'
- 4.b if not goto 2.
-
- And that is really all there is to it. You will have to do some
- editing of the output file to modify some of the flags, particularly
- in the Window structure, and you will have to chain the gadgets
- togeather and to the window(s). But that is about it. I have included
- a small do-nothing example called "test" (test.norm, test.sel, test.c,
- and test.h) where I have flagged the changes that had to be done to
- the raw file.c output of Vgad to get a running program. Have a look
- at it to see what to do. Test just hangs around until a Delay(500L)
- times out and then closes, just giving you time to click on the gadgets
- to see that they are alt-image boolean gadgets.
-
- Compiling output:
-
- Vgad source code has been compiled under Manx 3.4a with the various
- patches that have appeared. I can see no reason why it should not
- compile under Lattice 3.1 or higher; however, this I have not tested.
- When linking the image data must end up in CHIP ram so with Manx the
- appropriate linker command is:
-
- ln +cd file.o -lc
-
- the +cd flag being necessary to put the image data (actually all
- initialized data) in CHIP ram. You will probably need to do something
- similar if you are using Lattice.
-
- Bugs:
-
- None known at the current time. Image generation for proportional
- gadgets is not yet supported.
-
- Comments and Suggestions:
-
- These are always welcome and invited. If you want a modification
- send me a letter describing it and if I get around to it I will send
- the result off to Fred Fish.
-