<> <> <> <> DIRECTORY CD, CDDrawQueue USING [DrawQueue], CDBasics USING [empty], CDColors, CDVScale USING [ScaleRec], ViewerClasses USING [Viewer], Imager USING [Context], PrincOps USING [BBptr], 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>> VRef: TYPE = REF VRec; -- for NEW use only New VRec: TYPE = RECORD [ viewer: ViewerClasses.Viewer _ NIL, <<----------->> pBBptr: PrincOps.BBptr _ NIL, -- used for painting exclusively oBBptr: PrincOps.BBptr _ NIL, -- used for outlines exclusively xBBptr: PrincOps.BBptr _ NIL, -- used for all other purposes frame: Terminal.FrameBuffer, <<--speedups for frame^>> screen: LONG POINTER _ NIL, 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 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: CDVScale.ScaleRec, <<----------->> viewContext: Imager.Context _ NIL, ct: CDDrawQueue.DrawQueue _ 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, specialFonts: BOOL _ FALSE, checkPriority: BOOL _ TRUE, b4: BOOL _ TRUE, b5: 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 _ [0, 0], onVC: BOOL _ FALSE, cursorInhibitations: CARDINAL _ 0, -- MONITORED firstHorizontalVC: BOOL _ TRUE, defaultWidthVC: CD.Number _ 0, -- width of cursored wire <<>> intendedScale: CDVScale.ScaleRec, designRec: REF VPrivatePerDesign, 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 xMode: BOOL _ FALSE, -- 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: REF _ NIL ]; 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 [me: VRef]; <<--callable from within viewer paintproc only>> RepaintRectAreaInViewer: PRIVATE PROC[me: VRef, rect: CD.Rect, eraseFirst: BOOL]; <<--monitored by: called from "viewer" loop only>> <<--(re)draws everything>> <<--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>> <<--Cursor's>> OutLineProc: TYPE = PROC[me: VRef]; --type of cursoring procedure ImplementACursor: PROC[mode: ATOM, proc: CursorModeProc]; <<--Registers a proc to be called from the tip table (Supposed the tip Notify proc >> <<--calls SetCursorMode; hopefully implemented!, but not by this interface)>> <<--Most proc's are used only to install the procedure to be used for subsequent cursoring>> <<-- (they set the viewers (VPrivatePerDesign) fields usedCursor and outlineProcLC)>> CursorModeProc: TYPE = PROC[me: VRef, mode: REF]; SetCursorMode: PRIVATE PROC[me: VRef, mode: REF]; <<--To be called by the viewers Notify proc only; its call should be caused by >> <<--a tip table entry.>> <<--The registered (ImplementACursor) CursorModeProc will be called;>> <<--and typically installs the procedure to be used for subsequent cursoring>> <<>> <<>> 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]; <<--the data field has type VRef>> LastViewer: PROC[] RETURNS [ViewerClasses.Viewer]; CheckPriority: CD.CheckPriorityProc; END.