AmigaView
Sheldon Leemon
All About Icons
Icons, the little pictures that appear on the Workbench and its windows, make it easy to perform such actions as duplicating a disk or running a program. But because of their power, they generate a lot of curiosity—and questions. "How can I make my own icons?" "Why do some icons run programs when I double-click on them, while others do nothing?" "How can I increase the stack size for a program that's run from the Workbench?" To answer these questions, let's look at what icons are, and how they work.
Icons are pictures that represent actual objects in the Amiga disk filing system, such as disks, subdirectories, and files. Where do these icons come from? Information for each icon is stored in its own disk file. These files have the same filenames as the objects they represent, with the characters .info tacked onto the end. For example, the file that contains the icon information for the Preferences file is called Preferences.info, and the file that contains the icon information for the System directory is called System.info. In order for an icon to correctly represent a filing-system object, the .info file must be in the same directory as that object. The .info files contain a lot of information about the icon and the object it represents, including:
- The image used to draw the icon on the screen. This includes information about how to highlight the image when it's selected. It's even possible to use one image for the normal appearance of the icon and an altogether different image for its highlighted state. We've all seen these "action" icons. While the IconEd tool in the System drawer of the Workbench won't let you create two-image icons, you can create two separate image files with it and merge them with the IconMerge program on the Extras disk for AmigaDOS version 1.2.
- The type of object the icon represents. The Disk-type icon represents an actual floppy, hard, or RAMdisk. When you double-click on it, it opens a window which displays the files in its root directories for which there are icons. The Drawer-type icon represents a subdirectory. When you double-click on it, it opens a window which displays its icon files. The Tool icon represents an executable program, like a word processor. When you double-click on it, it runs the program. A Project icon represents a data file created by a Tool, like a paint program picture, or a text document. Normally, this type of icon won't do anything when you double-click on it, since data can't just load itself. But it's possible to designate a default program to run when a Project icon is selected. If that's done, double-clicking a Project icon will both run the program and load the data file. Finally, the last icon type is Garbage. This type of icon represents the Trashcan, which is a special kind of Drawer. The only difference between the Trashcan and any other subdirectory is that when you select the Empty Trash menu item from the Workbench, all of the files in the Trashcan directory are deleted. When you double-click on the Trashcan icon, a window opens to displays its contents like any other drawer.
- The default Tool (the program to be run when this icon is double-clicked). This applies only to Projects and Disk-type tools. The most common problem here is that the Tool might not be where this icon is looking for it. For example, if the tool is Amiga-Basic, and the AmigaBasic program isn't in the root directory of this disk, the icon won't be able to find and load it. Notice that the default Tool of a disk is Sys:System/Diskcopy. That's how the Workbench duplicates a disk when you drag its icon over another disk icon.
- Tool Types. These are text strings which correspond to the command line parameters in the CLI. For example, if you open a new CLI window from the CLI itself, you can specify its size and position by using a command like NEWCLI con:10/10/540/150/mywindow. You can do the same thing when you open a CLI window from the CLI icon by using a Tool Type text in the icon like windowname = con:10/10/540/150/mywindow. Not every Project tool uses Tool Types, but those that do can offer the user the option of configuring in the programs started from the Workbench in a certain way.
- The horizontal and vertical position of the image in the display window. For Disk- and Drawer-type icons, information about the size and location of the window that they open is also saved here. These items in the disk file are altered when you use the Snapshot menu item from the Workbench. But remember, each icon has its own file, and Snapshot affects only the items currently highlighted. If you want to save a window's size and position along with its contents, highlight the drawer and all of the icons in the window at the same time (by holding down Shift while you select icons) before using Snapshot.
- Stack Size. This is the amount of scratch-pad memory allocated to the program. If no size is set, the default 4K is used.
If you want to learn more about a particular icon and the object it represents, highlight the icon and select Info from the Workbench menu. A window will appear that not only gives you all of the information shown above, but will also allow you to edit such fields as Stack Size, Default Tool, and Tool Types and save the changes.