IconEditorDefs:
CEDAR
DEFINITIONS =
BEGIN
*** general constants and types used for icons ***
Nat: TYPE = INTEGER; -- positive INTEGERS
iconW: Nat = 64; -- width and height of an icon (in bits)
iconH: Nat = 64;
intWBound: Nat = iconW-1;
intHBound: Nat = iconH-1;
IntW: TYPE = [0..intWBound];
IntH: TYPE = [0..intHBound];
maxStorage: Nat = 32; -- how many icons kept "in core" at any given time
BitArray: TYPE = ARRAY IntH OF MACHINE DEPENDENT RECORD [b: PACKED ARRAY IntW OF BOOLEAN];
RectangleRec: TYPE = RECORD [ x, y, w, h: Nat ← 0];
LineRec: TYPE = RECORD [ x1, y1, x2, y2: Nat ← 0];
MarkType: TYPE = {rect, line};
MarkPoint: TYPE = RECORD [x, y: Nat ← 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: BOOLEAN ← FALSE,
x, y: REAL ← 0];
*** constants used for laying out display ***
normalThickness: REAL = 1.0;
distX: Nat = 4; -- fixed distance between Icons on the menu
distY: Nat = 4;
maxIconsOnDisplay: Nat = 20; -- Maximum # of Icons allowed in the displayed Icon menu
minimumUnit: Nat = 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: Nat ← 0, -- rectangle for label (from bottom left)
ly: Nat ← 0, -- rectangle for label (from bottom left)
lw: Nat ← 0, -- rectangle for label (from bottom left)
lh: Nat ← 0, -- rectangle for label (from bottom left)
empty: ARRAY [0..251) OF WORD ← ALL[0] -- for future use
];
*** 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,
queue: MBQueue.Queue, --serialize Menu/Buttons
numberOfIcons: Nat ← 0, -- How many icons in the current file
numberReadIn: Nat ← 0, -- How many icons originally read in (needed for reset)
numIconsPerRow, numIconsPerCol: Nat,
possibleX, possibleY: Nat, -- space remaining for board after Icon menu allocated
icX, icY: Nat, -- computed origin for the Icon menu
boardSize: REAL,
unit: Nat,
startDisplay: Nat ← 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: BOOLEAN ← TRUE, -- Used for marking diagonal points of rectangles
drewLine, drewRectangle: BOOLEAN ← 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: BOOLEAN -- Indicates whether previous rectangle should be erased
];
*** Signals ***
CouldntLoadIcons: SIGNAL;
CouldntSaveIcons: SIGNAL;
ViewerNoGood: SIGNAL;
BlackLabelProc, WhiteLabelProc, LineProc, InvertProc, BlackProc, DarkGrayProc, DeskTopGrayProc, WhiteProc, UnLabelIconProc, LabelIconProc, RightProc, LeftProc, DownProc, UpProc, UndoProc, FillIconProc, ShowLabelProc, CreateIconProc, DeleteIconProc, RotateDisplayProc, LoadIconProc, SaveProc, ResetProc: Menus.MenuProc;