IconHacksDoc.tioga
Copyright Ó 1991, 1992 by Xerox Corporation. All rights reserved.
Last tweaked by Mike Spreitzer on August 19, 1988 9:56:17 am PDT
Dave Rumph, June 2, 1987 10:15:18 am PDT
Doug Wyatt, September 25, 1992 2:36 pm PDT
IconHacks
CEDAR 10.1 — FOR INTERNAL XEROX USE ONLY
IconHacks
Mike Spreitzer
© Copyright 1987 Xerox Corporation. All rights reserved.
Abstract: This package hacks Viewer labels by replacing common long patterns with shorter ones. It also selects icon shapes, based on the extension of the file, and whether the viewer is considered to be edited or not.
Created by: Mike Spreitzer
Maintained by: Mike Spreitzer <Spreitzer:parc>, Michael Plass <Plass:parc>
Keywords: Viewer, Label, Icon
XEROX  Xerox Corporation
   Palo Alto Research Center
   3333 Coyote Hill Road
   Palo Alto, California 94304

For Internal Xerox Use Only
1. Label Hacking
1.0. Theory
Many of our viewers have names that are too long to fit well in the space available in icons. Label hacking lets you identify patterns and replacements to apply to the viewer names to get the icon labels. The patterns and replacements are expressed in the language used in the `Target' and `Replacement' fields of the EditTool. You specify a list of patterns and replacements, which are applied in that order.
1.1. Control
For this feature to be engaged, you must have the IconHacks package installed, and the user profile entry "IconHacks.HackLabels" must be TRUE.
1.2. User Profile Entries
IconHacks.LabelSubstitutions: Line ← Defaults
This is a list of (pair | "Defaults"); "Defaults" means to insert the default list of pairs in that position. Each pair consists of a pattern (and maybe some switches) and a replacement, as in the EditTool. The patterns and replacements may be quoted; when there are no quotes, white space is taken to seperate, and no switches may be given. Switches are specified by a series of characters immediately following the closing quote of a quoted pattern. Here are the meanings of those characters (sense starts out TRUE):
- => sense ← FALSE;
+ => sense ← TRUE;
l => literal ← sense;
p => literal ← NOT sense;
w => word ← sense;
c => ignoreCase ← NOT sense;
The default switch settings are: literal=TRUE, word=FALSE, ignoreCase=TRUE.
Remember that for a non-literal pair, you have to be careful about the meta-characters of the pattern and replacement language. These are documented at the end of the `Subs' section of the EditTool. A common `gotcha' is to forget to quote the angle brackets in file and directory names. For literal pairs, there is no special processing, and so there are no metacharacters to worry about.
The default list is:
/Cedar/ c/
/Cedar10.1/ c/
/PCedar2.0/ pc/
/tilde/userName/ ~/
.mesa .m
.config .c
IconHacks.HackLabels: BOOLFALSE
This controls whether the label hacking is done.
2. Icon Mapping
2.1. How it works
IconHacks also will automatically select an icon shape for newly created (or edited or saved) files, based on the extension of the file, and whether the viewer is considered to be edited or not. The icons to be used must have been registered with IconRegistry. The icon to be used will be the first of the following:
1) The icon specified by the profile entry "IconHacks.Icon.extension". (It will also check for "IconHacks.DirtyIcon.extension" first if the viewer is edited.)
2) If the icon "extension" is registered (and "Dirtyextension" if ...), then it will use that one.
3) The icon specified by the profile entry "IconHacks.DefaultIcon". (It will also check for "IconHacks.DirtyDefaultIcon" first if the viewer is edited.)
4) Whatever the client code which created the viewer requested.
The following profile entry may by added to your profile to get one such mapping. (N.B. If you use Remember or another package which uses IconRegistry, you may need to fold these in as additions.)
RegisteredIcons: "
Mesa: ///7.0/Commands/IconHacks.Icons 0
DirtyMesa: ///7.0/Commands/IconHacks.Icons 1
Tioga: ///7.0/Commands/IconHacks.Icons 2
DirtyTioga: ///7.0/Commands/IconHacks.Icons 3
Df: ///7.0/Commands/IconHacks.Icons 4
DirtyDf: ///7.0/Commands/IconHacks.Icons 5
Config: ///7.0/Commands/IconHacks.Icons 6
DirtyConfig: ///7.0/Commands/IconHacks.Icons 7
Errlog: ///7.0/Commands/IconHacks.Icons 8
DirtyErrlog: ///7.0/Commands/IconHacks.Icons 9
"
2.2. User Profile Entries
IconHacks.HackIcons: BOOLFALSE
This controls whether the icon shape hacking is done.
IconHacks.DirtyIcon.extension: ROPEIconName
IconHacks.Icon.extension: ROPEIconName
IconHacks.DefaultDirtyIcon: ROPEIconName
IconHacks.DefaultIcon: ROPEIconName