|
Description  |
|
|
BACKGROUND OF THE INVENTION
The present invention relates to computer operating and file management
systems, particularly to improvements in tools for such systems which
enhance user productivity, system management and availability of such
systems to a broader spectrum of user levels of expertise. In the context
of this invention a tool, is a compact computer program or routine
designed to do a specific task well. Typically, several tools can be
linked together to perform more complex tasks.
The present invention may be used with graphical user interfaces for use in
computer systems of all types and sizes, including large scale mainframes,
workstations and microcomputers, whether or not any of the computers are
coupled together in a network. In particular, the present invention
provides consistent characterization of system files, and the definition
and design of the functionality and appearance of icons and symbols used
with operating environment programs.
As more computing power is introduced into microprocessor technology and
the cost- and size-per-bit of memory devices decreases, more sophisticated
programs can be operated on smaller and more compact computer systems.
Thus, stand alone microcomputer systems presently available are beginning
to approach the speed and computing power, i.e. instruction through-put,
of workstations, which, in turn, are beginning to rival main frame
computers in their capacity for processing complex computing operations.
Most computer systems designed for use by sophisticated users require a
high level of expertise and long hours of familiarization and setup.
Typically, thorough knowledge of complex sets of non-intuitive
input/output commands and procedures is required before such users can
become productive. If the operating and file management systems are
changed very substantially as such systems are improved and enhanced, such
users must relearn new commands and techniques before becoming fully
productive again. Even experts are hindered by complex mechanics of
interfacing with such a system.
Nowadays workstations are often part of, or planned for use in, a network.
Networks typically require system administration which in the past has
been left to the most expert-level user in view of the complexities
associated with management of system resources and users. However, the
increasing number of workstation users whose expertise does not include
system administration highlights the need to simplify network system
administration. In particular, system administration tasks that involve
customizing a workstation to a user's needs and preferences can and should
be done by the users themselves rather than the system administrator.
Many sophisticated workstation networking systems provide disjoint
mechanisms for customizing each work station. These mechanisms usually
include modifying some file and following some script or simply issuing a
set of commands The scripts and commands normally encrypt a set of
non-intuitive options which are focused on completing only one portion of
the complete task.
Textual scripts are helpful in getting the job done but lack feedback.
Unless the script has good error and detection and correction features,
the system manager has no immediate feedback as to whether the process
really worked. In the graphical user interface of the present invention,
the manager is presented with a view of all of the options and states that
disks and file systems can achieve without having to know the difficult
commands and procedures to achieve those states.
User acceptance of a PC-like workstation or workstation-like PC is
influenced or impacted by the new user's initial impression of how easy or
difficult it is to bring the system into productive use. If the system
requires the user to learn a set of complex tasks and an array of
non-intuitive command lines before he can be productive, he may feel that
he is working for the machine rather than that the machine is working for
him. Thus, presenting a "view" of the system and how it can be modified to
suit the user's needs and preferences is generally regarded as more
intuitive and less overwhelming than facing a set of complex input/output
commands and procedures.
The popularity of graphical user interfaces, which employ graphic symbols
and analog control of cursor movement instead of typewritten entry of
commands and cursor keys, has grown very quickly and steadily with the
introduction of personal computers for use at home and small businesses by
users at all levels of expertise. A visual interface with a computer
system helps users feel that their computer is friendlier and, moreover,
helps the user work more efficiently and productively with the system.
A user-friendly, interactive, intuitive graphical user interface to
powerful computer systems having extensive file and database management
systems is advantageous for users at all levels. If such an interface
provides an adaptive visual appearance and intuitive flow of information
including icons for creating, accessing and manipulating system files, the
entry-level (i.e. beginner) user will not be intimidated, the
intermediate-level (i.e. average) user broadens his expertise faster, the
advanced-level (i.e. expert) user becomes even more productive, and system
administration becomes less complex and more efficient.
SUMMARY OF THE INVENTION
A tool constructed according to the principles of the present invention
assists the user in managing system files and the actions associated with
them by a process called file typing. If used with a graphical user
interface, the tool also provides the user with control of the appearance
and functionality of file icons.
The present invention is designed for use with powerful, flexible operating
systems having the following fundamental characteristics:
1) Substantially, all information is stored in a hierarchy; thus,
information may be organized by dividing it into various files and
directories, which in turn may have subfiles and subdirectories.
2) Each workstation may support more than one user; thus, the present
invention anticipates a multi-user environment.
3) The system may support very sophisticated networking software which
allows users to access information on other work stations as easily as if
the information was installed on that users work station; if used in a
multi-user, networked system the present invention anticipates the need
for system administration.
Using the file typing process of the present invention, users can
characterize system files, and their associated icons, according to their
individual needs and preferences. The user may also determine the
functionality of the icons he derives.
Potentially, an unlimited number of possible file types can exist in a
system for which the file typing process of the present invention is
designed. Such file types include plain text files, formatted documents,
directories, shell scripts, images, binary executables and the like. Every
type of file is given an associated set of operations, often unique, that
a user would most often want to perform with or on such files. The file
type declarations and associated rules provide each type of file with
potentially unique appearance and behavior customized to the needs and
preferences of the user.
As with other systems, icons are used to view file directories, work with
existing files and run applications. In addition, icons may be newly
created, copied, renamed, removed, printed, transferred or rearranged.
Finally, icons may be used for printing the files generated using
applications and transferring files to the work-stations or various
storage media such as tape. Thus, the tool of the present invention allows
the user to use a mouse input device, cursor icons and pop-up menus to
interact with the computer system to access sets of files and directories,
set personal preferences for how the files and directories should be
displayed, launch applications, use basic utility programs and organize
files and directories.
The present invention is implemented under the UNIX system. UNIX is highly
regarded by experts in computer science as a simple, elegant operating and
file management system for use on computers having different processing
power, ranging from microprocessors to mainframes, and providing a common
execution environment across all of them. The system originally developed
and introduced by Bell Telephone Laboratories in 1969, has become
increasingly widespread. Different versions of it are supported on the
equipment of several different computer system manufacturers. Details of
the UNIX system are given in the references listed below which are
incorporated by reference as if fully set forth herein.
Bach, M. J., "The Design of the UNIX Operating System," Prentice-Hall
Software Series, Englewood Cliffs, N.J., 1986.
Bourne, S. R., "The UNIX Shell," The Bell System Technical Journal,
July-August 1978, Vol. 57, No. 6, Part 2, pp. 1971-1990.
Kernighan, B. W., and R. Pike, "The UNIX Programming Environment,"
Prentice-Hall, Englewood Cliffs, N.J. 1984.
The version of the UNIX system for which the preferred embodiment of the
present invention is implemented is called "IRIX", developed and
introduced by Silicon Graphics, Inc. IRIX is described in "The IRIX
Programmer's Reference Manual," Vols. I, II, III; "The IRIX System
Adminstrator's Reference Manual"; The IRIX User's Reference Manual," Vols.
I, II; "IRIS-4D Programmers Guide," Vols. I, II; "IRIS-4D System
Administrator's Guide"; and "IRIS-4D User's Guide", which are also
incorporated by reference as if fully set forth herein.
DESCRIPTION OF THE DRAWING
FIG. 1 is a system block diagram of a computer system for use with a file
typing process constructed according to the principles of the present
invention.
FIG. 2 is a summary flow diagram for development of a compiled file of file
typing rules according to the principles of the present invention.
FIGS. 3A-3C, inclusive, is a summary flow diagram for deriving file typing
rules according to the principles of the present invention.
FIGS. 4A-4B, inclusive, is a flow diagram of the executive program for
typing a file according to the file typing process of the present
invention.
FIG. 5 is a flow diagram of the executive program for closing a file
according to the file typing process of the present invention.
FIGS. 6A-6S, inclusive, is a detailed flow diagram of the file typing
process of the present invention.
FIGS. 7A-7C, inclusive, is a detailed flow diagram of the opcode "OP TAG"
for the file typing process of the present invention.
FIG. 8A illustrates mapping icons to pixels using the bounds rule of the
file typing process of the present invention.
FIG. 8B illustrates axes for 3-D icons using the style conventions of the
file typing process of the present invention.
FIG. 9A is a flow diagram of the executive program for setting the state of
icons, according to the present invention.
FIG. 9B is a flow diagram of the executive program for setting the colors
of icons, according to the present invention.
FIGS. 10A-10P, inclusive, is a detailed flow diagram of the iconic
rendering process of the present invention.
FIG. 11 is a face view of an iconic interface for a computer file system
characterized by the file typing process of the present invention.
DESCRIPTION OF THE PREFERRED EMBODIMENT
A typical system for using the file typing process of the present invention
includes main computing unit 101, keyboard 102, mouse input device 103
with related pad 104 and monitor 105 as shown in FIG. 1. Operating
environment programs in a simulated desktop or other working area metaphor
are displayed on the screen of display monitor 105.
In most computer systems, the number of files a user can create is limited
ultimately by the amount of memory available in the system. The file
typing process of the present invention manages numerous varieties of
system files and the actions associated with them. Every type of file,
such as plain text files, formatted documents, directories, shell scripts,
images and binary executables, is given an associated set of operations,
often unique, that a user would most often want to perform on those files.
The file type declarations and associated rules that give each type of
file a unique appearance and behavior are collectively called file typing
rules.
File typing rules determine how a file of a particular type will appear in
the operating environment, and also define what functions a user can
perform on the file by double-clicking the mouse input device while the
cursor is located on an associated icon or choosing menu items to
manipulate the contents of the file. The operating environment may use the
file typing rules to evaluate all files presented from system memory. File
typing rules are also used to customize the look of the icons, modify what
happens to the files the icons represent or to create unique icons when
the user is developing an application and associated data file.
In the present invention, command lines for accessing and acting on system
files are represented by icons. Such command lines are invoked by the user
acting upon the icons according to the present invention via the mouse
device as if they had been typed in a shell. Thus the present invention
provides the user with graphical access for performing sophisticated
operations on UNIX-based files.
File typing rules are similar to shell scripts. Shell scripts are well
known as files containing UNIX instructions for creating new UNIX
commands. Many of the file typing rules are similar also to sets Bourne
shell commands. C-shells, Bourne shells and shell scripts are familiar to
those skilled in the use of the UNIX operating system.
File typing rules comprise a type declaration, which identifies a unique
file type, and a set of as many as seven rules following the declaration.
All rules, including the type declaration, consist of a rule key followed
by the rule itself. Rules may be multi-line, but continuation lines may
not begin with any of the rule keys. A summary of rule keys, the
associated rule and the function of the rule is provided in Table I.
TABLE I
______________________________________
File Typing Rule Key
Function
______________________________________
TYPE declares a new type
MATCH Lets WorkSpace determine if a file is of
the declared type.
LEGEND Provides a text description of the file type.
SUPERTYPE Tells WorkSpace to treat the file as a sub-
set of a another type under certain cir-
cumstances
SPECIALFILE Tells WorkSpace that the file typing rule
is to be used only on non-plain files.
CMD OPEN Defines a series of actions that occur
when the mouse is double-clicked on an
icon.
CMD ALTOPEN Defines a series of actions that occur
when the mouse is alt-double-clicked
on an icon.
CMD DROP Defines a series of actions that occur
when you "drop" an icon on top of
another.
CMD PRINT Defines a series of actions that occur
when you choose `Print` from the
WorkSpace or Directory View menus.
MENUCMD Defines menu entries and actions that are
inserted into the WorkSpace or Directory
View menus when an icon is selected.
BOUNDS Defines the coordinate space for the file
type's icon.
ICON Defines the appearance (geometry) of the
file type's icon.
______________________________________
A description of file typing rules according to the present invention is
given below with continuing reference to FIGS. 2 to 10P.
File Typing Rules
1.1 The Type Declaration
Syntax: TYPE type-name
Description: type-name is a one word ASCII string. Legal type names can be
any legal C language variable name. The user should ideally choose a name
that is in some way descriptive of the file type it represents. All rules
that follow a TYPE declaration apply to that type, until the next TYPE
declaration is encountered in the FTR file. Each TYPE declaration must
have a unique type name.
Example: TYPE GenericExecutable
1.2 The MATCH Rule
Syntax: MATCH match-expression;
Description: match-expression is a logical expression that should evaluate
to true if and only if a file is of the type declared by TYPE. The
match-expression must consist only of valid MATCH functions, as described
in the section below. The match-expression can use multiple lines, but
must terminate with semicolon (;). Multiple match-expressions are not
permitted for a given type. The MATCH rule is employed each time a file is
encountered by the operating environment, to assign a type to that file.
Example: MATCH glob ("*.h") && ascil;
1.3 Valid Match-Expression
This section describes the syntax and function of valid match-expressions.
Operators, Constants, and Numerical Representation
The following C language operators may be used in a match-expression:
+ - * / & l ! % ()
The following C language conditional operators may be used in a
match-expression:
&& ll == !=<> <= >=
The `==` operator works for string comparisons in addition to numerical
comparisons.
The following constants may be used in a match-expression:
true false
Numbers in match-expressions may be represented in either decimal, octal,
or hexadecimal notation. These representations are given below:
______________________________________
Representation Syntax
______________________________________
decimal num
octal Onum
hexadecimal Oxnum
______________________________________
FUNCTIONS
Table II describes the set of valid match-expression functions.
TABLE II
______________________________________
Function Syntax
Definition
______________________________________
ascii Returns TRUE if the first 512 bytes of
the file are all printable ASCII
characters.
char(n) Returns the nth byte in the file as a
signed character: range -128 to 127
dircontains ("string")
Returns TRUE if the file is a directory
and contains the file named by string.
glob ("string")
Returns TRUE if the file's name
matches string; allows use of the follow-
ing expansions in string for pattern
matching: { } [ ] * ? and backslash
(see sh(1) filename expansion).
linkcount Returns the number of hard links to the
file.
long (n) Returns the nth byte in the file as a
signed long integer; range -2.sup.31 to
2.sup.31 - 1.
mode Returns the mode bits of the file (see
chmod(1)).
print (expr or "string")
Prints the value of the expression expr
or string to stdout each time the rule is
evaluated; used for debugging. Always
returns true.
short (n) Returns the nth byte of the file as a
signed short integer; range -32768
to 32767.
size Returns the size of the file in bytes.
string (n,m) Returns a string from the file that is
m bytes (characters) long, beginning at
the nth byte of the file.
uchar (n) Returns the nth byte of the file as
an unsigned character; range 0 to 255.
tag Returns the specific WorkSpace
application tag injected into an
executable file by the tag injection
tool (see tag(1) in Appendix D,
"WorkSpace Man Pages").
ushort (n) Returns the nth byte of the file as an
unsigned short integer; range 0 to 65535.
Returns-1 if the file is not a tagged
file.
______________________________________
1.4 Building Effective MATCH Rules
A match rule consists of a sequence of expressions, each of which checks a
file for positive distinguishing characteristics. The most effective way
to order these expressions in a single MATCH rule is to choose a set of
expressions, each of which tests for a single characteristic, and conjoin
them all using `and` conditionals (&&).
The order in which the expressions in a MATCH rule are conjoined may have
an effect on the efficiency of the rule's evaluation. The user should
always try to order the expressions so that the maximum number of files
are `weeded out` by the first expressions. The reason for this is that, as
in the C language, && will stop evaluation as soon as one side of the
conditional is found to be false. Therefore, as a rule of thumb, the more
likely an expression is to be false, the further to the left of the MATCH
rule you should place it.
For example, one possible way to match a C source file is with the
following rule:
MATCH glob ("*.c") && ascii;
Note that it is more efficient to place the glob ("*.c") expression first
because there are many more files that do not end in ".c" than there are
files that are not ASCII text.
The user should also make sure that the match rule is specific enough not
to "catch" any unwanted files. FTR files are scanned sequentially (see
Section 2.10, "Comparing FTR Rules"), so if a type is defined with the
following MATCH rule at the beginning of the FTR file,
TYPE foo
MATCH ascil;
every text file in the system will be defined as a file of type `foo`.
1.5 Tagging Executables
The most preferable way to match a specific executable to a file typing
rule is to "tag" it with a unique 32-bit number. tag (1) allows the user
to inject a 32-bit tag safely into a shell script of MIPS executable,
where it can be read by a MATCH rule using the tag match-expression
function (see Section 1.3).
1.6 Programming the IRIS Operating Environment
An operating environment in accordance with the present invention is the
IRIS Operating Environment, developed and introduced by Silicon Graphics,
Inc. IRIS, including its icon-based interface called WorkSpace, is
described in "Programming the IRIS WorkSpace"; "The Personal IRIS Owner's
Guide"; and "The IRIS-4D Series Owner Guide", which are also incorporated
by reference as if fully set forth herein.
The upper 16 bits of the tag number are reserved for vendor ID, for
separate administration by the vendor. The lower 16 bits are for general
use. Several uses values for the lower 16 bits have been defined, which
Operating Environment recognizes:
__________________________________________________________________________
/* The different classes of how to launch an executable
__________________________________________________________________________
*/
# define GENERICEXEX
0x00000000
/* this can be windowed or no output */
# define LAUNCHEXEC 0x00000100
/* fires a launch window for arg input */
# define OUTEXEC 0x00000200
/* output only wsh */
# define TTYEXEC 0x00000400
/* wsh that takes input and ouput */
# define TTYLAUNCHEXEC
TTYEXEClLAUNCHEXEC
# define TTYOUTEXEC TTYEXEClOUTEXEC
# DEFINE TTYLAUNCHOUTEXEC
TTYEXEClOUTEXEClLAUNCHEXEC
/* Define to represent the number of args
an executable expects */
# define ARGSO 0x00000000
# define ARGS1 0x00000001
# define ARFS2 0x00000002
# define ARGS3 0x00000004
# define ARGSO-1 0x00000008
# define ARGSO-N 0x00000010
# define ARGS1-N 0x00000020
__________________________________________________________________________
1.7 The Legend Rule
Syntax: LEGEND text-string
Description: text-string is a string that describes the file type in plain
language a user can understand. The legend is used to describe the file in
the Get File Info window. It is also used when a Directory View window is
set to display as a list. Legends that are longer that 25 characters may
be truncated in some circumstances.
Example: LEGEND C program source file 1.8 The Supertype Rule
Syntax: SUPERTYPE type-name [type-name . . . ]
Description: The SUPERTYPE rule is used to indicate that a particular file
type can be treated as a part of a more general file type for under
certain conditions. A special case in the operating environment is
directories; the user may wish to create a directory with a custom icon,
yet still have the OPEN and ALTOPEN rules work as a normal directory.
(Note: the operating environment automatically handles the OPEN and
ALTOPEN rules for directories; the OPEN and ALTOPEN rules are
placeholders.) A unique directory TYPE, with its own ICON rule may be
created, but if SUPERTYPE is used, it will work like a standard directory
(see example.) SUPERTYPE is also very useful for printing, where a custom
file type may want to be printed as, say, an ASCII file. The user can also
make use of SUPERTYPEs in separate OPEN, ALTOPEN, DROP, and PRINT rules by
using is Super (1) as part of those rules. A given file typing rule may
contain several different SUPERTYPE rules, and thus be considered a subset
of several more general file types.
______________________________________
Example: TYPE MyDirectory
SUPERTYPE Directory
______________________________________
1.8 The Special File Rule
Syntax: SPECIALFILE
Description: SPECIALFILE is used to distinguish a file typing rule used for
matching non-plain files. Device files, and other non-plain files can
cause damage to physical devices if they are matched using standard file
typing rules. Special files are only matched using rules containing
SPECIALFILE, which are written so as not to interfere with actual physical
devices. Similarly, plain files are not matched using rules containing a
SPECIALFILE rule.
Example: SPECIALFILE
1.2 The Command (CMD) Rules
The CMD rules determine how an icon behaves when a user interacts with it,
whether it is by clicking, dragging, or through menu selections.
1.10 The CMD Open Rule
Syntax: CMD OPEN sh-expressions[; sh-expression; . . . ; sh-expression]
Description: The OPEN rule is invoked when any field of the appropriate
type is double-clicked, or selected and opened from the operating
environment or directory view Menu via the `Open` menu item. The OPEN rule
should reflect the most often used function that would be applied to a
file of the given type. sh-expression can be any valid Bourne shell
expression. Any expression may use multiple lines. Any number of
expressions may be used, and must be separated by semicolons (;). The
final expression should not end with a semicolon. Variable may be defined
and used as in a Bourne shell script, including environment variables.
These environment variables may be used to refer to the currently
selectioned icons within the operating environment or directory view.
Example: CMD OPEN $wineditor $files
1.11 The CMD ALTOPEN Rule
Syntax: CMD ALTOPEN sh-expression[;sh-expression; . . . ; sh-expression]
Description: The ALTOPEN rule is envoked when any file of the appropriate
type is double-clicked while the ALT key is depressed. The ALTOPEN rule
provides added functionality for power users. sh-expression can be any
valid Bourne shell expression. Any expression may use multiple lines. Any
number of expressions may be used, and must be separated by semicolons
(;). The final expression should not end with a semicolon. Variables may
be defined and used as in a Bourne shell script, including environment
variables. These environment variables may be used to refer to the
currently selectioned icons within the operating environment or directory
view.
Example: CMD ALTOPEN make
1.12 The CMD DROP Rule
Syntax: CMD DROP sh-expression[; sh-expression; . . . ; sh-expression]
Description: The DROP rule is invoked whenever a selected (file) icon is
"dropped" onto another icon in the operating environment or directory view
Windows. When this happens, operating environment checks to see if the
file type that is being dropped upon has a DROP rule to handle the files
being dropped. In this way, the user can write rules that allow one icon
to process the contents of other icons simply by dragging the icons
selected for processing onto the top of the target icon (i.e., the one
with the DROP rule).
Example: CMD DROP $TARGET $SELECTED
1.13 CMD PRINT Rule
Syntax: CMD PRINT sh-expression[;sh-expression; . . . ;sh-expression]
Description: The PRINT rule is invoked whenever a file of the appropriate
type is selected and printed using a print menu item form the operating
environment or directory view menu. sh-expression can be any valid Bourne
shell expression. Any expression may use multiple lines. Any number of
expressions may be used, and must be separated by semicolons (;). The
final expression should not end with a semicolon. Variables may be defined
and used as in a bourne shell script, including environment variables.
These environment variables may be used to refer to the currently
selectioned icons within the operating environment or directory view. The
recommended method of implementing the PRINT rule is to use the print-job
routing utility from the operating environment.
Example: OMD PRINT routeprint $LEADER $REST
1.14 The NEMUCMD Rule
Syntax: MENUCMD "string" sh-expression[;sh-expression; . . .
;sh-expression]
Description: MENUCMD inserts the menu entry string into the operating
environment or directory view menu if a single file of the appropriate
type is selected, or a group all of the same appropriate type is selected.
If the menu entry is chosen, the actions described by the sh-expressions
is performed on each of the selected files.
Example: MENUCMD "Empty Dumpster" rm-rf $LEADER/*
1.15 The BOUNDS Rule
Syntax: BOUNDS x0, y0, x1, y1
Description: x0, y0, x1, y1 define, respectively, the lower left and upper
right corners of the bounding rectangle of the coordinate space in which
the icon is displayed. The values are separated by commas (,). When the
operating environment paints the icon, it scales the icon so that its
bounds fit just within the fixed layout area reserved for it. The aspect
ratio of the bounding rectangle is preserved. If no BOUNDS rule is
supplied for a file type's icon, the bounding rectangle defaults to 0.0,
0.0, 100.0, 100.0. Referring to FIG. 8A, an example of as scaleable icon
having the bounds -20.0, -20.0, 50.0, 75.0 is shown.
1.16 The ICON Rule
Syntax: ICON icon-description-routine
Description: icon-description-routine is a routine written using the icon
description language, detailed below. The routine can continue for any
number of lines. The ICON rule is invoked any time a file of the specified
type needs to be represented in the operating environment or a directory
view. The rule is evaluated each time the icon is painted by the
application that needs it.
______________________________________
Example: ICON color(iconcolor);
bgnoutlinepolygon( );
vertex(0,0);
vertex(0,60);
vertex(40,60);
vertex(40,0);
endoutlinepolygon(outlinecolor);
______________________________________
1.17 The Icon Description Language
The icon description language is a restricted subset of the C programming
language, including line and polygon drawing routines from any well-known
graphics library routine. The description routine for a given icon is
similar in structure to a C subroutine, but lacking the subroutine and
variable declarations and the outermost enclosing brackets. The valid
symbols and functions in the icon description language are described
below.
Operators
The following C language operators may be used in an icon description
routine:
+ - * l & l ! % = () {}
The following C language conditional operators may be used in an icon
description routine:
&& ll == != <> <= >=
Constants
The following logical constants may be used in an icon description routine:
true false
The following icon color constants is described in Section 1.18, "Drawing
Icons".
Variables
The following icon status variables are set by the operating environment,
and may be used in an icon description routine:
current disabled opened located selected
These variables have values of either true or false. They can be used in a
conditional statement to alter the appearance of an icon when it has been
manipulated in various ways from the operating environment (see Section
1.18, "Drawing Icons").
Other legal C variables may be used in an icon description routine without
need of a declaration; all variables are represented as type float. Any
variable name is acceptable, provided it does not collide with any of the
predefined constants, variables or function names in the icon description
language.
Functions
The icon description functions comprise, for the most part, a very
restricted subset of the C language version of a graphic library routine
modified for 2-D drawing. Table III describes the set of valid icon
description functions.
TABLE IIIA
______________________________________
Function Syntax Definition
______________________________________
arc (x,y,r,startang, endang)
Draw an arc starting at
icon coordinates x, y, rad-
ius r, starting at angle star-
tang, ending at angle endang.
Angle measures are in
tenths of degrees.
arcf (x,y,r,stratang, endang)
Like arc, but filled with
the current pen color.
bclos (color) Like pclos (see below) but
uses color for the border
(outline) color of the poly-
gon.
bgnclosedline ( )
Begin drawing a closed, un-
filled figure drawn in the
current pen color. Used in
conjunction with vertex and
endclosedline.
bgnline ( ) Like bgnclosedline, except
the figure is not closed.
Used in conjunction with
vertex and endline.
bgnoutlinepolygon
Begin drawing a polygon
filled with the current
pen color. The polygon is
outlined with a color spec-
ified by endoutlinepolygon.
Also used in conjunction
with vertex.
bgnpoint ( ) Begin drawing a series of
unconnected points defined
using calls to vertex. Used
in conjunction with vertex
and endpoint.
bgnpolygon ( ) Like bgnoutlinepolygon
except the polygon is not
outlined. Used in conjunc-
tion with vertex and
endpolygon.
color (n) Set current pen color to
color index n.
draw (x,y) Draw a line in the current
color from the current pen
location to x, y.
endclosedline ( )
Finishes a closed, unfilled
figure started with
bgnclosedline.
______________________________________
TABLE IIIB
______________________________________
Function Syntax Definition
______________________________________
endline ( ) Finishes an open, unfilled figure
started with bgnline.
endoutlinepolygon (color)
Finishes a filled polygon started
with bgnoutlinepolygon and out-
lines it with color.
endpoint ( ) Finishes a series of points started
with bgnpoint.
endpolygon ( ) Finishes a filled, unoutlined poly-
gon stared with bgnpolygon.
for Standard C for-loop.
if (expr) expr [ else expr ]
Standard C language if-statement.
move (x,y) Move current pen location to x, y.
pclos ( ) Draw a line in the current pen
color that closes the current poly-
gon, and fill the polygon with the
current color.
pdr (x,y) Draw the side of a filled polygon
in the current pen color, from the
current pen location to x, y.
pmv (x,y) Begin a filled polygon at location
x, y.
print (expr of "string")
prints the value of the expression
expr or string to stdout; used for
debugging
vertex (x,y) Specifies a coordinate used for
drawing points, lines, and poly-
gons by bgnpoint, bgnline,
bgnpolygon, etc.
______________________________________
1.18 Drawing Icons
Any points, lines, or polygons the user draws will "stack" in the order
they are drawn, with the most recently drawn polygon on top. This concept
is used to easily achieve drop-shadow effects, by drawing the same polygon
twice, using different pen colors, and offset.
There are three icon color constants are recommended for standard icon use;
iconcolor for drawing polygons that make up the "foreground" of the icon,
outlinecolor for outlining and linework, and shadowcolor for contrasting
drop shadows. iconcolor is particularly useful, because it automatically
changes to the calling application's preferred color conventions when a
given icon is located, disabled, or selected.
The various icon status variables are used to change the appearance of an
icon when it is opened, located, selected, or disabled. The following code
fragment illustrates how to draw an icon that changes appearance when it
wa | | |