IconEditorDefs.mesa
Last Edited by: Ken Pier, May 17, 1985 4:48:25 pm PDT
DIRECTORY
Containers USING [Container],
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 ***
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: BOOLEANFALSE,
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: BOOLFALSE, -- label icon with viewer name?
invertLabel: BOOLFALSE, -- 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 WORDALL[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: BOOLEANTRUE, -- Used for marking diagonal points of rectangles
drewLine, drewRectangle: BOOLEANFALSE, -- 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;
PointsMarked: PROCEDURE [handle: IconHandle, type: MarkType] RETURNS [BOOLEAN];
SaveBitMap: PROCEDURE [handle: IconHandle];
LayoutBoard: PROCEDURE [handle: IconHandle, bounds: Imager.Box];
GetNewFlavor: PROCEDURE [handle: IconHandle] RETURNS [newFlavor: IconFlavor];
LoadIcons: PROCEDURE[handle: IconHandle, filename: Rope.ROPE] RETURNS [nRead: Nat, iconFile: IO.STREAM];
SaveIcons: PROCEDURE[handle: IconHandle, filename: Rope.ROPE, numberOfIcons: Nat] 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];
ClearIcon: PROCEDURE[handle: IconHandle, flavor: IconFlavor];
MirrorIcon: PROCEDURE[handle: IconHandle, flavor: IconFlavor, rect: RectangleRec];
DrawLine: PROCEDURE[handle: IconHandle, line: LineRec, flavor: IconFlavor];
FreshMarks: PROCEDURE [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];
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: BOOLEAN];
MoveLeft: PROC [handle: IconHandle, flavor: IconFlavor, slowShift: BOOLEAN];
MoveUp: PROC [handle: IconHandle, flavor: IconFlavor, slowShift: BOOLEAN];
MoveDown: PROC [handle: IconHandle, flavor: IconFlavor, slowShift: BOOLEAN];
FillIcon: PROC [handle: IconHandle];
CreateMenu: PROCEDURE [handle: IconHandle] RETURNS [iconMenu: Menus.Menu];
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;
END.