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, June 11, 1985 10:54:17 pm PDT
DIRECTORY
CD,
CDDraw USING [CommandTable],
CDBasics USING [empty],
CDColors,
CDVScale USING [ScaleRec],
ViewerClasses USING [Viewer],
Imager USING [Context],
PrincOps USING [BBptr],
Rope USING [ROPE],
Terminal USING [FrameBuffer];
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.Rect, 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
frame: Terminal.FrameBuffer,
--speedups for frame^
screen: LONG POINTER ← NIL,
bpp: CARDINAL, -- bits per pixel (1, 4, 8)
logbpp: CARDINAL,
display: CDColors.DisplayType,
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
personalColors: REF CDColors.ColorDefinition,
colorTable: REF CDColors.ColorTable, --switch between fore- and back- ground
dClip: CD.Rect ← CDBasics.empty, -- no point outside is visible on viewer
--scale
scale: CDVScale.ScaleRec,
-----------
entered: BOOL ← FALSE,
viewContext: Imager.Context ← NIL,
ct: CDDraw.CommandTable ← NIL,
saveList: SaveList ← NIL,
deviceDrawRef: CD.DrawRef ← NIL,
actualDesign: CD.Design ← NIL,
stoprequest: REF BOOL,
check: BOOL ← FALSE,
hurryUp: BOOL ← FALSE,
slowDown: BOOL ← FALSE,
running: BOOL ← FALSE,
environment: BOOL ← TRUE,
symbolics: BOOL ← TRUE,
b1: BOOL ← TRUE,
b2: BOOL ← TRUE,
suppressFactorForCells: REAL ← 1.0,
contextFilter: REF CD.ContextFilter,
--further drawings
painterList: PainterList ← NIL,
--cursor tracking information (Visible Cursors)
usedCursor: OutLineProc,
startVC, stopVC: CD.Position,
onVC: BOOL ← FALSE,
cursorInhibitations: CARDINAL ← 0, -- MONITORED
firstHorizontalVC: BOOL ← TRUE,
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.Rect ← CDBasics.empty,
proc: PainterProc ← NIL, -- the painterproc
data: REF ← NIL
];
PainterProc: TYPE = PROC [me: MyGraphicRef, paintRef: REF PainterRec, interrestRect: CD.Rect];
IncludeAPainterRec: PROC [me: MyGraphicRef, pr: REF PainterRec];
RemoveAPainterRec: PROC [me: MyGraphicRef, pr: REF PainterRec];
PrivatePerDesign:
TYPE =
RECORD [
startLCValid: BOOL ← FALSE, -- Logical Cursors
startLC: CD.Position ← [0,0],
stopLC: CD.Position ← [0,0],
firstHLC: BOOL ← FALSE,
widthLC: CD.Number ← 0,
currentLayer: CD.Layer,
usedCursor: REF ← NIL, --key designating outlineProcLC
outlineProcLC: OutLineProc,
xMode: BOOL ← FALSE, -- usefull for wiring-, pendingdelete-mode, but only 1 per tip table...
mark: CD.Position ← [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.Rect, eraseFirst: BOOL];
RepaintBackground: PROC[me: MyGraphicRef, r: CD.Rect, eraseFirst: BOOL];
DrawCommentForViewers: PROCEDURE[r: CD.Rect, 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.