CDVPrivate.mesa (Viewer definitions for ChipNDale)
Copyright © 1983, 1986, 1987 by Xerox Corporation. All rights reserved.
Created by Christian Jacobi, July 15, 1983 11:16 am
Last edited by: Christian Jacobi, April 29, 1987 1:11:56 pm PDT
DIRECTORY
CD,
CDDrawQueue USING [DrawQueue],
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.
notSupportedColorMode: ERROR; --catched by viewer paintproc
DebugProc: TYPE = PROC [ref: REFNIL, wedge: BOOLFALSE, msg: Rope.ROPENIL] RETURNS [BOOLFALSE];
UseDebug: PROC [proc: DebugProc];
--can be called to assign debugging procedures
--proc is called from critical places; any IO can wedge the machine
ShallContinue: PROC [ref: REFNIL, wedge: BOOLFALSE, msg: Rope.ROPENIL] RETURNS [BOOL];
--on errors in critical places, use
--! RuntimeError.UNCAUGHT => IF ShallContinue[...] THEN CONTINUE
--in addition to catching UNWIND
--deadlock: TRUE in places which would deadlock if CONTINUE isn't called
--xx Data xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
VRef: TYPE = REF VRec; -- for NEW use only New
VRec: TYPE = RECORD [
viewer: ViewerClasses.Viewer ← NIL,
-----------
-- all the data for bit-blit are protected with monitor
pBBptr: PrincOps.BBptr ← NIL,
-- used for painting [overpainting: "or"ing pictures] exclusively, with single
-- exception of re-initialization of background [flags are set for painting, and must
-- be reset before exit of re initialization].
xBBptr: PrincOps.BBptr ← NIL,
-- used for all other purposes; set flags before usage
frame: Terminal.FrameBuffer,
--speedups for frame^
screen: LONG POINTERNIL,
bpp: CARDINAL ← 1, -- bits per pixel (1, 4, 8)
logbpp: CARDINAL ← 0,
display: CDColors.DisplayType ← bw,
scWidthWords: CARDINAL ← 0, -- Screen width in words
vx: CARDINAL ← 0, --distance from left of screen to left most pixel
vy: CARDINAL ← 0, --distance from top of screen to bottom most pixel
vh: CARDINAL ← 0, --copied from viewer, to avoid race conditions
vw: CARDINAL ← 0, --copied from viewer, to avoid race conditions
dClip: CD.Rect ← CDBasics.empty, -- no point outside is visible on viewer
scale: CDVScale.ScaleRec,
-----------
personalColors: REF CDColors.ColorDefinition,
colorTable: REF CDColors.ColorTable, --switch between fore- and back- ground
viewContext: Imager.Context ← NIL,
ct: CDDrawQueue.DrawQueue ← NIL,
deviceDrawRef: CD.DrawRef ← NIL,
actualDesign: CD.Design ← NIL,
stoprequest: REF BOOL,
check: BOOLFALSE,
hurryUp: BOOLFALSE,
slowDown: BOOLFALSE,
running: BOOLFALSE,
environment: BOOLTRUE,
symbolics: BOOLTRUE,
fontSubstitution: BOOLFALSE,
borders: BOOLFALSE,
checkPriority: BOOLTRUE,
b4: BOOLTRUE,
b5: BOOLTRUE,
suppressFactorForCells: REAL ← 1.0,
contextFilter: REF CD.ContextFilter,
--further drawings
painterList: PainterList ← NIL,
--cursor tracking information (Visible Cursors)
usedCursor: OutLineProc,
startVC, stopVC: CD.Position ← [0, 0],
onVC: BOOLFALSE,
cursorInhibitations: CARDINAL ← 0, -- MONITORED
firstHorizontalVC: BOOLTRUE,
defaultWidthVC: CD.Number ← 0, -- width of cursored wire
intendedScale: CDVScale.ScaleRec,
designRec: REF VPrivatePerDesign, --never assign nil
properties: CD.PropRef ← --registration is expected
];
VPrivatePerDesign: 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, --if a new cursor is used, this one will be used; never assign nil
xMode: BOOLFALSE, -- usefull for wiring-, pendingdelete-modes..., but only 1 mode per tip table
mark: CD.Position ← [0, 0] -- reserved for usage as logical mark, independent of visibility
];
--PainterList's xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-- a viewer record has a list of PainterRec's, a record with a rectangle and a procedure.
-- Whenever a rectangle is (re)drawn, all intersecting PainterRec's will be applied. Its
-- interrestRect will be set to the intersection of the registered rect and some clip boundary.
--
-- This allows to independently implement drawing further area dependent features.
-- The PainterRec's proc will be called inside the "viewer main loop" only.
IncludeAPainterRec: PROC [me: VRef, pr: REF PainterRec];
RemoveAPainterRec: PROC [me: VRef, pr: REF PainterRec];
PainterRec: TYPE = RECORD [
rect: CD.Rect ← CDBasics.empty,
proc: PainterProc ← NIL, -- the painterproc
data: REFNIL
];
PainterProc: TYPE = PROC [me: VRef, paintRef: REF PainterRec, interrestRect: CD.Rect];
PainterList: TYPE = LIST OF REF PainterRec;
--xx list xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
allVRefs: READONLY LIST OF VRef;
--New and Destroy are the only methods to modify allVRefs
New: PRIVATE PROC [design: CD.Design] RETURNS [VRef];
Destroy: PRIVATE PROC [VRef];
--xx Drawing xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
CreateDrawInformation: PRIVATE PROC [vRef: VRef];
--monitored by: called from "viewer" loop only
ResetDrawScale: PRIVATE PROC [vRef: VRef];
--monitored by: called from "viewer" loop only
--moves scale down from intendedScale and calls CreateDrawInformation
RepaintRectAreaInViewer: PRIVATE PROC[vRef: VRef, rect: CD.Rect, eraseFirst: BOOL];
--monitored by: called from "viewer" loop only
--(re)draws everything
RepaintBackground: PRIVATE PROC[vRef: VRef, rect: CD.Rect, eraseFirst: BOOL];
--monitored by: called from "viewer" loop only
--(re)draws background only
--useful for erasing first and painting later to achieve visual effect
--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
--Cursor's
OutLineProc: TYPE = PROC[me: VRef];
--type of cursoring procedure
cursoredCDViewer: READONLY ViewerClasses.Viewer;
--viewer which has the ChipNDale cursor
--(it does not need to have the input focus)
InvertArea: PROC[me: VRef, x1, y1, x2, y2: INT];
--x1, y1, x2, y2 in viewers coordinates;
--handy procedure for several cursor implementors
--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
CreateViewer: PROC [design: CD.Design] RETURNS [ViewerClasses.Viewer];
LastViewer: PROC [] RETURNS [ViewerClasses.Viewer];
CheckPriority: CD.CheckPriorityProc;
DoInsideMonitor: PRIVATE PROC [proc: PROC [VRef], vRef: VRef];
--the monitor protecting the bit-blit data
END.