IconEditorDefs.mesa
Copyright Ó 1987, 1992 by Xerox Corporation. All rights reserved.
Last Edited by: Ken Pier, May 17, 1991 5:58 pm PDT
Bloomenthal, April 11, 1990 12:17:04 pm PDT
Russ Atkinson (RRA) March 9, 1987 5:19:02 pm PST
DIRECTORY
Containers USING [Container],
Icons,
Imager USING [Box],
IO USING [STREAM],
MBQueue USING [Queue],
Menus USING [Menu, MenuProc],
Rope USING [ROPE],
ViewerClasses USING [Viewer];
IconEditorDefs:
CEDAR
DEFINITIONS =
BEGIN
*** general constants and types used for icons ***
maxStorage: INT16 = 32; -- how many icons kept "in core" at any given time
Halfword: TYPE ~ Icons.Halfword; -- CARD16
bitsPerHalfword: NAT ~ Icons.bitsPerHalfword; -- 16
iconW: INT16 ~ Icons.iconW;
iconH: INT16 ~ Icons.iconH;
intWBound: INT16 = iconW-1;
intHBound: INT16 = iconH-1;
IntW: TYPE = [0..intWBound];
IntH: TYPE = [0..intHBound];
BitArray: TYPE = PACKED ARRAY [0..iconH*iconW/bitsPerHalfword) OF Halfword;
BitArray:
TYPE =
ARRAY IntH
OF
MACHINE
DEPENDENT
RECORD [
b: PACKED ARRAY IntW OF BOOL
];
RectangleRec: TYPE = RECORD [ x, y, w, h: INT16 ¬ 0];
LineRec: TYPE = RECORD [ x1, y1, x2, y2: INT16 ¬ 0];
MarkType: TYPE = {rect, line};
MarkPoint: TYPE = RECORD [x, y: INT16 ¬ 0];
IconUpdate: TYPE = {screen, board, icon, bit, newIcon, mark, rect, line};
IconInfoRef: TYPE = REF IconInfoRec;
IconInfoRec:
TYPE =
RECORD [
handle: IconHandle,
update: IconUpdate,
currentIcon: IconFlavor,
clearBit: BOOL ¬ FALSE,
x, y: REAL ¬ 0];
*** constants used for laying out display ***
normalThickness: REAL = 1.0;
distX: INT16 = 4; -- fixed distance between Icons on the menu
distY: INT16 = 4;
maxIconsOnDisplay: INT16 = 20; -- Maximum # of Icons allowed in the displayed Icon menu
minimumUnit: INT16 = 3;
*** type declarations for Icon File Format ***
IconFlavor:
TYPE =
MACHINE
DEPENDENT {
-- pre-defined icons
document(0),
dirtyDocument(1),
fileCabinet(2),
tool(3),
typescript(4),
private(177776B), -- will cause call of viewer paintProc to paint icon
unInit(177777B) -- private flag for unitialized icon type
};
IconRef: TYPE = REF IconFileFormat;
IconFileFormat:
TYPE =
MACHINE
DEPENDENT
RECORD [
bits: BitArray, -- 64 x 64 bit pattern
label: BOOL ¬ FALSE, -- label icon with viewer name?
invertLabel: BOOL ¬ FALSE, -- invert text when labeling?
filler: [0..37777B] ¬ 0, -- 14 bits of filler
lx, ly, lw, lh: INT16 ¬ 0,
fillerInt: INT16 ¬ 0,
empty: PACKED ARRAY [0..250) OF Halfword ¬ ALL[0] -- leftovers
];
*** type declarations for Icon Editor ***
IconHandle: TYPE = REF IconHandleRec;
IconHandleRec:
TYPE =
RECORD [
container: Containers.Container,
viewer: ViewerClasses.Viewer,
iconFileWindow: ViewerClasses.Viewer,
iconNumberWindow: ViewerClasses.Viewer,
iconFetchFileWindow: ViewerClasses.Viewer,
iconNameWindow: ViewerClasses.Viewer,
iconFileName: Rope.ROPE,
iconFile: IO.STREAM,
workingDir: Rope.ROPE,
queue: MBQueue.Queue,
serialize Menu/Buttons
numberOfIcons:
INT16 ¬ 0,
How many icons in the current file
numberReadIn:
INT16 ¬ 0,
How many icons originally read in (needed for reset)
numIconsPerRow, numIconsPerCol: INT16,
possibleX, possibleY:
INT16,
space remaining for board after Icon menu allocated
icX, icY:
INT16,
computed origin for the Icon menu
boardSize: REAL,
unit: INT16,
startDisplay:
INT16 ¬ 0,
where to start displaying icons on screen
icons: ARRAY [0..maxStorage) OF IconRef,
currentIC: IconFlavor ¬ FIRST[IconFlavor],
nextFlavor: IconFlavor,
Keeps track of next possible flavor for new icons
currentIconRep: IconRef,
the icon currently displayed on drawing board
savedBitMap: BitArray,
used for "un-doing" operations
area and line marking variables
firstMark:
BOOL ¬
TRUE,
Used for marking diagonal points of rectangles
drewLine, drewRectangle:
BOOL ¬
FALSE,
Used for erasing previously drawn rectangles or lines
currentRectangle, labelRect: RectangleRec,
Normalized coordinates of rectangle (from bottom left)
currentLine: LineRec,
mark1, mark2: MarkPoint,
Diagonal (mark) points of rectangles
functionNotApplied:
BOOL
Indicates whether previous rectangle should be erased
];
*** Signals ***
CouldntLoadIcons: SIGNAL;
CouldntSaveIcons: SIGNAL;
ViewerNoGood: SIGNAL;
GetFileName: PROC [h: IconHandle, v: ViewerClasses.Viewer] RETURNS [Rope.ROPE];
PointsMarked:
PROC [handle: IconHandle, type: MarkType]
RETURNS [
BOOL];
SaveBitMap:
PROC [handle: IconHandle];
LayoutBoard:
PROC [handle: IconHandle, bounds: Imager.Box];
GetNewFlavor:
PROC [handle: IconHandle]
RETURNS [newFlavor: IconFlavor];
LoadIcons:
PROC [handle: IconHandle, filename: Rope.
ROPE]
RETURNS [nRead:
INT16, iconFile:
IO.
STREAM];
SaveIcons:
PROC [handle: IconHandle, filename: Rope.
ROPE, numberOfIcons:
INT16]
RETURNS [iconFile:
IO.
STREAM];
NormalizeRectangle:
PROC [corner1, corner2: MarkPoint]
RETURNS [rect: RectangleRec];
TransferEndPoints:
PROC [endpoint1, endpoint2: MarkPoint]
RETURNS [line: LineRec];
ComputeEndPoints:
PROC [handle: IconHandle, oldLine: LineRec]
RETURNS [newLine: LineRec];
IconProc:
TYPE ~
PROC [
handle: IconHandle,
flavor: IconFlavor,
rect: RectangleRec ¬ [],
line: LineRec ¬ [],
slowShift: BOOL ¬ FALSE];
ClearIcon:
PROC [handle: IconHandle, flavor: IconFlavor];
MirrorIcon:
PROC [handle: IconHandle, flavor: IconFlavor, rect: RectangleRec];
FlipIcon:
PROC [handle: IconHandle, flavor: IconFlavor, rect: RectangleRec];
DrawLine:
PROC [handle: IconHandle, line: LineRec, flavor: IconFlavor];
FreshMarks:
PROC [handle: IconHandle];
WhiteLabel:
PROC [handle: IconHandle, flavor: IconFlavor];
BlackLabel:
PROC [handle: IconHandle, flavor: IconFlavor];
SetLabel:
PROC [handle: IconHandle, flavor: IconFlavor, rect: RectangleRec];
UnSetLabel:
PROC [handle: IconHandle, flavor: IconFlavor];
SetWhite:
PROC [handle: IconHandle, flavor: IconFlavor, rect: RectangleRec];
SetDeskTopGray:
PROC [
handle: IconHandle, flavor: IconFlavor, rect: RectangleRec, firstClearToWhite: BOOL ¬ TRUE];
SetDarkGray:
PROC [handle: IconHandle, flavor: IconFlavor, rect: RectangleRec];
SetBlack:
PROC [handle: IconHandle, flavor: IconFlavor, rect: RectangleRec];
Invert:
PROC [handle: IconHandle, flavor: IconFlavor, rect: RectangleRec];
MoveRight:
PROC [handle: IconHandle, flavor: IconFlavor, slowShift:
BOOL];
MoveLeft:
PROC [handle: IconHandle, flavor: IconFlavor, slowShift:
BOOL];
MoveUp:
PROC [handle: IconHandle, flavor: IconFlavor, slowShift:
BOOL];
MoveDown:
PROC [handle: IconHandle, flavor: IconFlavor, slowShift:
BOOL];
FillIcon:
PROC [handle: IconHandle];
CreateMenu: PROC [handle: IconHandle] RETURNS [iconMenu: Menus.Menu];
BlackLabelProc, WhiteLabelProc, LineProc, InvertProc, BlackProc, DarkGrayProc, DeskTopGrayProc, DeskTopGrayIfWhiteProc, WhiteProc, UnLabelIconProc, LabelIconProc, RightProc, LeftProc, DownProc, UpProc, UndoProc, FillIconProc, ShowLabelProc, CreateIconProc, DeleteIconProc, KillAllIconsProc, RotateDisplayProc, LoadIconProc, SaveProc, ResetProc: Menus.MenuProc;
END.