<> <> <> <> 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]_0, 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.