home *** CD-ROM | disk | FTP | other *** search
-
- Icon2c Version 1.0 - created by Ray Lambert
-
- I recently had the opportunity to get a first hand look at an alpha
- version of Workbench 1.4. I was very impressed and I really can't wait for
- it to be released. The enhancements to Workbench make it a very useful tool
- (at last!) and as such, I think it is time that us programmers begin
- supporting it more through the use of icons in our programs.
- It is a very simple task to create an icon for a user when a new document
- file is created. The simplest method of doing this is by duplicating an
- existing icon from disk. However of course, that requires that an icon must
- be available to be duplicated. It is also slightly difficult to modify
- attributes of the icon such as Tool Types and Default Tool in this manner.
- Therefore, it would seem much better to have an icon actually compiled-in
- with your program which you could simply write-out when an icon is needed.
- Preparing an icon for compilation into your program however can be a little
- difficult in itself.
- Enter Icon2c. Icon2c is a utility program I wrote to aid with the process
- of preparing an existing icon for compilation into a C program. Icon2c will
- read any Workbench icon of any type and convert it into a C source file
- which can be directly compiled and linked with no modification whatsoever.
- (Note: all source is Lattice C 5.0x compatible and should compile with Manx
- however has not been tested with Manx).
- A Workbench icon is represented in memory as a struct DiskObject and a
- variable number of supporting data structures (See
- INCLUDES:Workbench/workbench.h for details). Icon2c will create the
- DiskObject structure as well as any supporting data structures required by
- the icon. In this format, modifying an icon at run-time before saving it to
- disk, can be accomplished with ease. Changing attributes such as Default
- Tool, ToolTypes and Stack Size are trivial matters. Changing the icon's
- type or imagery is also easily accomplished. Even saving the icon to disk
- is trivial, in the simplest case requiring only three commands (plus error
- checking). (IconBase=OpenLibrary("icon.library",0);
- PutDiskObject("name",&DO); CloseLibrary(IconBase);)
- With Icon2c, supporting Workbench icons should be no sweat now so I'll be
- expecting to see all new programs create their own icons! [grin]
- By the way, to create your own custom icons I recommand the combination of
- DPaint and HERMES' IconLab. ("IconLab" should be in the libs somewhere - if
- you cannot find it drop me a note and I'll upload it.)
- Icon2c is Public Domain so you can do whatever your little heart desires
- with it (let's keep it clean though, eh?). If you make improvements to
- Icon2c or distribute it somewhere I would appreciate the credit however.
-
-
-
- "So what is all this then?"
-
- Following is a list of the files found in this archive with descriptions:
-
-
- Icon2c: The star of this production! Its usage is:
- Icon2c <iconfile[.info]> <c file>
- Both parameters are always required (note that the ".info" file extension
- on the icon name is optional). If you forget this just run the program with
- no parameters and it will kindly remind you.
-
-
- Icon2c.c: The C source for Icon2c. To compile (with Lattice 5.0x) type:
- "Execute Icon2c.c". Ignore the "declaration expected" warning - it does no
- harm.
-
-
- Icon.info: A sample icon for experimenting with.
-
-
- icon.c: Output of "Icon2c" after processing "Icon.info".
-
-
- icon.o: Compiled object file of "icon.c".
-
-
- remake.c: A sample source file for writing an icon to disk.
-
-
- remake.o: Compiled object file of "remake.c" to be linked with "icon.o".
-
-
- Remake: Program which recreates "Icon.info" - consists of "remake.o" and
- "icon.o" Blink'ed together.
-
-
- IconRemade.info: A copy of "Icon.info" created by "Remake".
-
-
- TestScript: A script file which automates the process of recreating
- "Remake" using any icon you choose. Usage of TestScript is:
- Execute TestScript <iconname.info>
- (note that the ".info" is NOT optional - ask Execute why!). TestScript will
- first recreate the file "icon.c" using "Icon2c" and the icon you specify,
- then it will compile "icon.c" into "icon.o". Next, it will Blink the new
- "icon.o" with "remake.o" to recreate "Remake". Lastly it will run "Remake"
- which will recreate "IconRemade.info" - now a copy of your input icon. I
- recommend that you place the contents of this archive into "RAM:" and then
- try using "TestScript" with your favorite icon. Use Workbench to open the
- "RAM DISK" drawer and view the recreated icon. Try copying your source icon
- to "RAM:" and compare the two. They should be identical. (Note: sometimes
- the file size of the new icon differs by a few bytes. While I can't explain
- why this happens, the new icon still functions properly - trust me :)
-
-
-
- If you find any bugs in Icon2c or you have any comments (good or bad) you
- can contact me at the following places:
-
- PLink: Analog*Kid
-
- U.S. Snail: Ray Lambert
- 415 Sanford Road
- Westport, Massachusetts 02790
-
- Phone: (508) 672-8232
-
-