CDVPrivate.mesa (Viewer definitions for ChipNDale)
Copyright © 1983, 1985 by Xerox Corporation. All rights reserved.
by Christian Jacobi, July 15, 1983 11:16 am
last edited by Christian Jacobi, April 22, 1985 11:03:49 am PST
DIRECTORY
CD,
CDDraw USING [CommandTable],
CDBasics USING [empty],
CDColors,
CDVScale USING [ScaleRec],
ViewerClasses USING [Viewer],
Graphics USING [Context],
PrincOps USING [BBptr],
Rope USING [ROPE];
CDVPrivate: CEDAR DEFINITIONS =
BEGIN
-- Non public chipndale interface defining viewer handling.
catchAny: BOOL; --catches low layer errors; set to false for debugging
catchAnyWhichDeadlock: BOOL; --set to false for debugging
notSupportedColorMode: ERROR; --catched by viewer paintproc
--xx Data xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
SaveList: TYPE = LIST OF SavedRectArraySeq;
saveListSize: INTEGER = 50;
SavedRectArraySeq: TYPE =
RECORD [next: [0..saveListSize]𡤀, x: ARRAY [0..saveListSize) OF SavedRect←TRASH];
SavedRect: TYPE = RECORD [r: CD.DesignRect, l: CD.Layer];
MyGraphicRef: TYPE = REF MyGraphicRec; -- for NEW use only NewAndLink
MyGraphicRec: TYPE = RECORD [
viewer: ViewerClasses.Viewer ← NIL,
-----------
pBBptr: PrincOps.BBptr, -- used for painting and background exclusively
xBBptr: PrincOps.BBptr, -- used for all other purposes
screen: LONG POINTERNIL,
bpp: CARDINAL, -- bits per pixel (1, 4, 8)
logbpp: CARDINAL,
personalColors: REF CDColors.ColorDefinition,
display: CDColors.DisplayType,
colorTable: REF CDColors.ColorTable, --switch between fore- and back- ground
greyTable: REF CDColors.ColorTable,
scWidth: CARDINAL, -- Screen width in pixels
scHeight: CARDINAL, -- Screen height in pixels=lines
scWidthWords: CARDINAL, -- Screen width in words
vx: CARDINAL, --distance from left of screen to left most pixel
vy: CARDINAL, --distance from top of screen to bottom most pixel
dClip: CD.DesignRect ← CDBasics.empty, -- no point outside is visible on viewer
-----------
entered: BOOLFALSE,
viewContext: Graphics.Context←NIL,
ct: CDDraw.CommandTable←NIL,
saveList: SaveList ← NIL,
deviceDrawRef: CD.DrawRef←NIL,
actualDesign: CD.Design←NIL,
stoprequest: REF BOOL,
hurryUp: BOOLFALSE,
running: BOOLFALSE,
environment: BOOLTRUE,
symbolics: BOOLTRUE,
b1: BOOLTRUE,
b2: BOOLTRUE,
suppressFactorForCells: REAL ← 1.0,
contextFilter: REF CD.ContextFilter,
--scale
scale: CDVScale.ScaleRec,
--further drawings
painterList: PainterList ← NIL,
--cursor tracking information (Visible Cursors)
usedCursor: OutLineProc,
startVC, stopVC: CD.DesignPosition,
onVC: BOOLFALSE,
cursorInhibitations: CARDINAL𡤀, -- MONITORED
firstHorizontalVC: BOOLTRUE,
defaultWidthVC: CD.Number, -- width of cursored wire
--book keeping
link: MyGraphicRef←NIL,
designRec: REF PrivatePerDesign,
properties: CD.Properties --these properties are not saved on files, but registration is expected
];
PainterList: TYPE = LIST OF REF PainterRec;
PainterRec: TYPE = RECORD [
rect: CD.DesignRect ← CDBasics.empty,
proc: PainterProc ← NIL, -- the painterproc
data: REFNIL
];
PainterProc: TYPE = PROC [me: MyGraphicRef, paintRef: REF PainterRec, interrestRect: CD.DesignRect];
IncludeAPainterRec: PROC [me: MyGraphicRef, pr: REF PainterRec];
RemoveAPainterRec: PROC [me: MyGraphicRef, pr: REF PainterRec];
PrivatePerDesign: TYPE = RECORD [
startLCValid: BOOLFALSE, -- Logical Cursors
startLC: CD.DesignPosition←[0,0],
stopLC: CD.DesignPosition←[0,0],
firstHLC: BOOLFALSE,
widthLC: CD.DesignNumber𡤀,
currentLayer: CD.Layer,
usedCursor: REFNIL, --key designating outlineProcLC
outlineProcLC: OutLineProc,
xMode: BOOLFALSE, -- usefull for wiring-, pendingdelete-mode, but only 1 per tip table...
mark: CD.DesignPosition←[0,0] -- reserved for usage as logical mark, independent of visibility
];
--xx linkage xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
linkBase: PRIVATE MyGraphicRef;
NewAndLink: PROC [design: CD.Design] RETURNS [MyGraphicRef];
UnLink: PROC [me: MyGraphicRef];
--xx Drawing xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
CreateDrawInformation: PROC [me: MyGraphicRef];
--callable from within viewer paintproc only
RepaintRectAreaInViewer: PROC[me: MyGraphicRef, rect: CD.DesignRect, eraseFirst: BOOL];
RepaintBackground: PROC[me: MyGraphicRef, r: CD.DesignRect, eraseFirst: BOOL];
DrawCommentForViewers: PROCEDURE[r: CD.DesignRect, comment: Rope.ROPE, pr: CD.DrawRef];
--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
--Cursor
cursoredCDViewer: READONLY ViewerClasses.Viewer;
--does not need to have the inputfocus; but has the chipndale cursor
OutLineProc: TYPE = PROC[me: MyGraphicRef];
--type of cursoring procedure
CursorModeProc: TYPE = PROC[me: MyGraphicRef, mode: REF];
--type of procedure to install a cursor mode
SetCursorMode: PRIVATE PROC[me: MyGraphicRef, mode: REF];
--sets outlineProcLC for the next time a cursor is fetched
ImplementACursor: PROC[mode: ATOM, proc: CursorModeProc];
--teaches SetCursorMode to call proc if mode mode is set
InvertArea: PROC[me: MyGraphicRef, x1, y1, x2, y2: INT];
--x1, y1, x2, y2 in viewers coordinates; handy for cursor implementors
--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
CreateViewer: PROC [design: CD.Design] RETURNS [ViewerClasses.Viewer];
--the data field has type MyGraphicRef
LastViewer: PROC[] RETURNS [ViewerClasses.Viewer];
END.