<> <> <> <> 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]_0, 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 POINTER _ NIL, 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: BOOL _ FALSE, viewContext: Graphics.Context_NIL, ct: CDDraw.CommandTable_NIL, saveList: SaveList _ NIL, deviceDrawRef: CD.DrawRef_NIL, actualDesign: CD.Design_NIL, stoprequest: REF BOOL, hurryUp: 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, <<>> <<--scale>> scale: CDVScale.ScaleRec, <<>> <<--further drawings>> painterList: PainterList _ NIL, <<>> <<--cursor tracking information (Visible Cursors)>> usedCursor: OutLineProc, startVC, stopVC: CD.DesignPosition, 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.DesignRect _ CDBasics.empty, proc: PainterProc _ NIL, -- the painterproc data: REF _ NIL ]; 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: BOOL_FALSE, -- Logical Cursors startLC: CD.DesignPosition_[0,0], stopLC: CD.DesignPosition_[0,0], firstHLC: BOOL_FALSE, widthLC: CD.DesignNumber_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.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.