CDVPrivate.mesa (Viewer definitions for Chipndale)
Copyright © 1983, 1984 by Xerox Corporation. All rights reserved.
by Christian Jacobi July 15, 1983 11:16 am
last edited by Christian Jacobi August 31, 1984 2:31:02 pm PDT
DIRECTORY
CD,
CDDraw USING [CommandTable],
CDInline 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 level 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.Level];
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
scWidthBits: CARDINAL, -- Screen width in bits
scWidthWords: CARDINAL, -- Screen width in words
scHeight: CARDINAL, -- Screen height in pixels=lines
vx, vy: CARDINAL, -- coordinates of viewer context origin in bitmap
dClip: CD.DesignRect ← CDInline.empty, -- no point outside is visible on viewer
-----------
entered: BOOLFALSE,
viewerContext: Graphics.Context←NIL,
ct: CDDraw.CommandTable←NIL,
saveList: SaveList ← NIL,
deviceDrawRef: CD.DrawRef←NIL,
actualDesign: CD.Design←NIL,
stoprequest: REF BOOLEAN,
hurryUp: BOOLEANFALSE,
running: BOOLEANFALSE,
suppressOutsidePushedCell: BOOLFALSE,
suppressFactorForCells: REAL ← 1.0,
--scale
scale: CDVScale.ScaleRec,
--further drawings
painterList: PainterList ← NIL,
--cursor tracking information (Visible Cursors)
usedCursor: OutLineProc,
startVC, stopVC: CD.DesignPosition,
onVC: BOOLEANFALSE,
cursorInhibitations: CARDINAL𡤀, -- MONITORED
firstHorizontalVC: BOOLEANTRUE,
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 ← CDInline.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𡤀,
currentLevel: CD.Level,
usedCursor: REFNIL, --key designating outlineProcLC
outlineProcLC: OutLineProc,
xMode: BOOLFALSE, -- usefull for wiringmode, pendingdeletemode, but only one per tip table...
mark: CD.DesignPosition←[0,0] -- in future replace completely by startLC?
--mark is a logical mark, independent of visibility
--owned and changed by the Notify procedure
];
--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
END.