[comp.sys.amiga] Need help with .info files

spencer@eris.BERKELEY.EDU (01/20/87)

Well, perhaps I am behind the times, but I don't know where to go in the 
manuals to find information on the .info file structure.  I don't know
what is wrong with me, I just don't ever remember coming across it.  I 
am trying to read the icon files and display their graphic on my own screen.
If there is anyone who does know, please let me know.  If there is an interest
in how they work I will post responses.

 As always,
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Randy Spencer P.O. Box 4542 Berkeley CA 94704 (415)284-4740 C#(415)283-5469
                         I N F I N I T Y          spencer%eris@berkeley.edu
Now working for          |||||||||||::::... . .      spencer@USCVAXQ.bitnet
But in no way            |||||||||||||||::::.. .. . ....ucbvax!eris!spencer
Officially representing  ||||||||||||:::::... ..         
                         s o f t w a r e 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

louie@sayshell.umd.edu (Louis A. Mamakos) (01/20/87)

In article <2269@jade.BERKELEY.EDU> spencer@eris.BERKELEY.EDU () writes:
>Well, perhaps I am behind the times, but I don't know where to go in the 
>manuals to find information on the .info file structure.  I don't know
>what is wrong with me, I just don't ever remember coming across it.  I 
>am trying to read the icon files and display their graphic on my own screen.
>If there is anyone who does know, please let me know.  If there is an interest
>in how they work I will post responses.

You're best be is to use the routines in the icon.library library.  You probably
want to use GetDiskObject(), which will return a pointer to a data structure
which is documented in the RKM and include files.   As far as I can tell, the
format of the data that lives on disk *in* the .info files is undocumented.
You should use the icon.library stuff, so that when we convince C-A to put
all the icons in one file (per directory?) you're program will still work.

For a more detailed treatement of how to use these .info things, look for my
article in Volume 2, Number 2 of {\it Amazing Computing} magazine, entitled
"Working with the Workbench".  


Louis A. Mamakos  WA3YMH    Internet: louie@TRANTOR.UMD.EDU
University of Maryland, Computer Science Center - Systems Programming

carolyn@cbmvax.cbm.UUCP (Carolyn Scheppner) (01/21/87)

In article <2269@jade.BERKELEY.EDU> spencer@eris.BERKELEY.EDU () writes:
>Well, perhaps I am behind the times, but I don't know where to go in the 
>manuals to find information on the .info file structure.  I don't know
>what is wrong with me, I just don't ever remember coming across it.  I 
>am trying to read the icon files and display their graphic on my own screen.

   See the "Workbench" chapter of the Rom Kernel manual.  It describes
.info's.  I was originally apprehensive about working with them but
it was all MUCH easier than I thought it would be.

   Basically...

...
#include <exec/types.h>
#include <workbench/workbench.h>
...
ULONG  IconBase = NULL;
struct DiskObject *obj;
...
main()
   {
   char *filename;
   ...
   if(!(IconBase=OpenLibrary("icon.library",0)))  yourabort();

   filename = "whatever";   /* name of file minus '.info' */

   if(!(obj=(struct DiskObject *)GetDiskObject(filename)))  yourabort();

   /* If successful, GetDiskObject() has allocated a struct DiskObject
    * and filled it in from the .info file.  See workbench.h for a
    * description of the DiskObject structure.  The DiskObject structure
    * contains a whole embedded Gadget structure.  The GadgetRender
    * field of the Gadget points to the Image structure for the icon.
    * The really nice thing is how simple it is to modify DiskObjects.
    * All you have to do is use the obj pointer returned by GetDiskObject()
    * to modify the pointers, flags etc. in the structure.  Then use
    * PutDiskObject(filename,obj) to write out the .info.  Filename
    * can be the same name, or the name of a different file you wish
    * to create an icon for.  The magic part is that PutDiskObject()
    * grabs all of the things pointed to by the DiskObject structure
    * and drags them along into the .info file.  This is how I did
    * IconMerge (1.2 Extras disk).  I just Get two DiskObjects,
    * put the GadgetRender pointer of the second in the SelectRender
    * field of the first, replace any existing highlighting flags
    * for the first with GADGHIMAGE, and Put the first one back out
    * under a new name.  Then FreeDiskObject(obj) the original two.
    */

   ... /* do your stuff, PutDiskObject(filename,obj) if you wish */

   cleanup()
   }

yourabort()
   {
   cleanup();
   exit(0);
   }

cleanup()
   {   
   if(obj) FreeDiskObject(obj);
   if(IconBase) CloseLibrary(IconBase);
   ...
   }

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Carolyn Scheppner -- CBM   >>Amiga Technical Support<<
                     UUCP  ...{allegra,caip,ihnp4,seismo}!cbmvax!carolyn 
                     PHONE 215-431-9180
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

ralph@mit-atrp.UUCP (Amiga-Man) (01/21/87)

In article <2269@jade.BERKELEY.EDU> spencer@eris.BERKELEY.EDU () writes:
>Well, perhaps I am behind the times, but I don't know where to go in the 
>manuals to find information on the .info file structure.....

A quick pass through my RKM's (ROM Kernel Manuals) again, after
having read them alot during Christmas break provided these pointers:

RKM Vol 1, pg 4-23 "Workbench" - A basic description of the action
RKM Vol 2, pg A-145 "icon.doc" - Manual pages for functions which
     do all the icon manipulations.
RKM Vol2 , pg E-76 "workbench/workbench.i" - The data structures for
     "disk objects" and "Workbench Objects".

These pointers are a start, and then you'll have to branch
out into the other stuff concerning gadgets and images.

I really feel that the "iconic" interface is an absolute necessity
on a modern personal computer and, except for compiling, I already use
the 1.2 workbench regularly. I would compile that way too, but the
compilers aren't well behaved enough in that environment, Rats !
By reading the above sections I have figured out how to get my C programs
to take arguments from both the workbench and the CLI, behaving
nicely in BOTH cases (even though I rarely use the CLI access anymore).

Also, I have been using PC's and mainframes for over 12 years and I feel
that if a computer doesn't offer a standard, convenient visual user
interface it isn't worth the material in its little rubber feet :-).
Realize that any computer(oops, maybe not mainframes, since their real-time
performance isn't too good) can provide such an interface, but it
must be used by most people and all programs must support
it for it to be effective (Darned Dpaint I, it has no icon!).
Wouldn't you love to see a workbench work-alike running on a IBM PC ?

My Amiga gets used by me, my friends, and even my family back home and
the icon interface is "THE WAY". This makes it easy for them to quickly
use and enjoy the machine. Even the minor delays in getting the icons
up, is faster (in my mind) than having to list the directory and painfully
type the command in (and I can type mighty fast too, proof: posting length).
Any improvement in the icon speed is VERY WELCOME, though. I'd like to
get together with others and try to either convince CBM to speed it
up even more, or come up with our own compatible way. Another persons
posting seemed to indicate the possibility of making a new "icon.device".
Is this possible ?
___________________________________       ______
|.|____________________________|O|O|     /      |
|                                  |    | Ralph |
| Sorry to banter so long. Ciao ! _|    |_______|
|________________________________|H|