home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 310.lha / Icon2c_v1.0 / ReadMe! < prev    next >
Encoding:
Text File  |  1980-12-06  |  5.0 KB  |  113 lines

  1.  
  2.                 Icon2c Version 1.0 - created by Ray Lambert
  3.  
  4.   I recently had the opportunity to get a first hand look at an alpha
  5. version of Workbench 1.4.  I was very impressed and I really can't wait for
  6. it to be released.  The enhancements to Workbench make it a very useful tool
  7. (at last!) and as such, I think it is time that us programmers begin
  8. supporting it more through the use of icons in our programs.
  9.   It is a very simple task to create an icon for a user when a new document
  10. file is created.  The simplest method of doing this is by duplicating an
  11. existing icon from disk.  However of course, that requires that an icon must
  12. be available to be duplicated.  It is also slightly difficult to modify
  13. attributes of the icon such as Tool Types and Default Tool in this manner.
  14. Therefore, it would seem much better to have an icon actually compiled-in
  15. with your program which you could simply write-out when an icon is needed.
  16. Preparing an icon for compilation into your program however can be a little
  17. difficult in itself.
  18.   Enter Icon2c.  Icon2c is a utility program I wrote to aid with the process
  19. of preparing an existing icon for compilation into a C program.  Icon2c will
  20. read any Workbench icon of any type and convert it into a C source file
  21. which can be directly compiled and linked with no modification whatsoever.
  22. (Note:  all source is Lattice C 5.0x compatible and should compile with Manx
  23. however has not been tested with Manx).
  24.   A Workbench icon is represented in memory as a struct DiskObject and a
  25. variable number of supporting data structures (See
  26. INCLUDES:Workbench/workbench.h for details).  Icon2c will create the
  27. DiskObject structure as well as any supporting data structures required by
  28. the icon.  In this format, modifying an icon at run-time before saving it to
  29. disk, can be accomplished with ease.  Changing attributes such as Default
  30. Tool, ToolTypes and Stack Size are trivial matters.  Changing the icon's
  31. type or imagery is also easily accomplished.  Even saving the icon to disk
  32. is trivial, in the simplest case requiring only three commands (plus error
  33. checking).  (IconBase=OpenLibrary("icon.library",0);
  34. PutDiskObject("name",&DO); CloseLibrary(IconBase);)
  35.   With Icon2c, supporting Workbench icons should be no sweat now so I'll be
  36. expecting to see all new programs create their own icons!  [grin]
  37.   By the way, to create your own custom icons I recommand the combination of
  38. DPaint and HERMES' IconLab.  ("IconLab" should be in the libs somewhere - if
  39. you cannot find it drop me a note and I'll upload it.)
  40.   Icon2c is Public Domain so you can do whatever your little heart desires
  41. with it (let's keep it clean though, eh?).  If you make improvements to
  42. Icon2c or distribute it somewhere I would appreciate the credit however.
  43.  
  44.  
  45.  
  46.                         "So what is all this then?"
  47.  
  48. Following is a list of the files found in this archive with descriptions:
  49.  
  50.  
  51. Icon2c:  The star of this production!  Its usage is:
  52.             Icon2c <iconfile[.info]> <c file>
  53.   Both parameters are always required (note that the ".info" file extension
  54. on the icon name is optional).  If you forget this just run the program with
  55. no parameters and it will kindly remind you.
  56.  
  57.  
  58. Icon2c.c:  The C source for Icon2c.  To compile (with Lattice 5.0x) type:
  59. "Execute Icon2c.c".  Ignore the "declaration expected" warning - it does no
  60. harm.
  61.  
  62.  
  63. Icon.info:  A sample icon for experimenting with.
  64.  
  65.  
  66. icon.c:  Output of "Icon2c" after processing "Icon.info".
  67.  
  68.  
  69. icon.o:  Compiled object file of "icon.c".
  70.  
  71.  
  72. remake.c:  A sample source file for writing an icon to disk.
  73.  
  74.  
  75. remake.o:  Compiled object file of "remake.c" to be linked with "icon.o".
  76.  
  77.  
  78. Remake:  Program which recreates "Icon.info" - consists of "remake.o" and
  79. "icon.o" Blink'ed together.
  80.  
  81.  
  82. IconRemade.info:  A copy of "Icon.info" created by "Remake".
  83.  
  84.  
  85. TestScript:  A script file which automates the process of recreating
  86. "Remake" using any icon you choose.  Usage of TestScript is:
  87.       Execute TestScript <iconname.info>
  88. (note that the ".info" is NOT optional - ask Execute why!).  TestScript will
  89. first recreate the file "icon.c" using "Icon2c" and the icon you specify,
  90. then it will compile "icon.c" into "icon.o".  Next, it will Blink the new
  91. "icon.o" with "remake.o" to recreate "Remake".  Lastly it will run "Remake"
  92. which will recreate "IconRemade.info" - now a copy of your input icon.  I
  93. recommend that you place the contents of this archive into "RAM:" and then
  94. try using "TestScript" with your favorite icon.  Use Workbench to open the
  95. "RAM DISK" drawer and view the recreated icon.  Try copying your source icon
  96. to "RAM:" and compare the two.  They should be identical.  (Note:  sometimes
  97. the file size of the new icon differs by a few bytes.  While I can't explain
  98. why this happens, the new icon still functions properly - trust me :)
  99.  
  100.  
  101.  
  102.   If you find any bugs in Icon2c or you have any comments (good or bad) you
  103. can contact me at the following places:
  104.  
  105. PLink:        Analog*Kid
  106.  
  107. U.S. Snail:   Ray Lambert
  108.               415 Sanford Road
  109.               Westport, Massachusetts  02790
  110.  
  111. Phone:        (508) 672-8232
  112.  
  113.