DIRECTORY CD, CDTechnology, CDVPrivate, Graphics, RuntimeError, PrincOpsUtils, TerminalExtras, Basics, Terminal, ViewerClasses; CDVCursor: CEDAR MONITOR IMPORTS CDTechnology, CDVPrivate, Graphics, RuntimeError, PrincOpsUtils, TerminalExtras, Terminal EXPORTS CDVPrivate = BEGIN lambda: CD.DesignNumber = CD.lambda; MyGraphicRef: TYPE = CDVPrivate.MyGraphicRef; ViewerPos2: PROC [me: MyGraphicRef] RETURNS [CD.Position] = INLINE { RETURN [CDVPrivate.DesignToViewerPosition[me, me.stopVC]]; }; ViewerPos1: PROC [me: MyGraphicRef] RETURNS [CD.Position] = INLINE { RETURN [CDVPrivate.DesignToViewerPosition[me, me.startVC]]; }; SetModeInvertBlack: PROC[me: MyGraphicRef] = INLINE { Graphics.SetColor[me.viewerContext, Graphics.black]; [] _ Graphics.SetPaintMode[me.viewerContext, invert]; }; PosCursor: PUBLIC PROC[me: MyGraphicRef] = BEGIN p2: CD.Position~ViewerPos2[me]; SetModeInvertBlack[me]; Graphics.SetCP[me.viewerContext, p2.x-8, p2.y-8]; Graphics.DrawTo[me.viewerContext, p2.x+8, p2.y+8]; Graphics.SetCP[me.viewerContext, p2.x+8, p2.y-8]; Graphics.DrawTo[me.viewerContext, p2.x-8, p2.y+8]; END; ShadowCursor: PUBLIC PROC[me: MyGraphicRef] = BEGIN p2: CD.Position~ViewerPos2[me]; CDVPrivate.InvertArea[me, p2.x-3, p2.y, p2.x+3, p2.y]; CDVPrivate.InvertArea[me, p2.x, p2.y-3, p2.x, p2.y+3]; END; DontCursor: PUBLIC PROC[me: MyGraphicRef] = BEGIN p2: CD.Position~ViewerPos2[me]; CDVPrivate.InvertArea[me, p2.x-8, p2.y, p2.x+8, p2.y]; CDVPrivate.InvertArea[me, p2.x, p2.y-8, p2.x, p2.y+8]; END; LineCursor: PUBLIC PROC[me: MyGraphicRef] = BEGIN p1: CD.Position~ViewerPos1[me]; p2: CD.Position~ViewerPos2[me]; SetModeInvertBlack[me]; Graphics.SetCP[me.viewerContext, p1.x, p1.y]; Graphics.DrawTo[me.viewerContext, p2.x, p2.y]; END; BoxCursor: PUBLIC PROC[me: MyGraphicRef] = BEGIN ENABLE RuntimeError.UNCAUGHT => { IF CDVPrivate.catchAnyWhichDeadlock THEN GOTO SomeError ELSE REJECT; }; p1: CD.Position~ViewerPos1[me]; p2: CD.Position~ViewerPos2[me]; CDVPrivate.InvertArea[me, p1.x, p1.y, p1.x, p2.y]; CDVPrivate.InvertArea[me, p1.x, p2.y, p2.x, p2.y]; CDVPrivate.InvertArea[me, p2.x, p2.y, p2.x, p1.y]; CDVPrivate.InvertArea[me, p2.x, p1.y, p1.x, p1.y]; EXITS SomeError => NULL; END; LCursor: PUBLIC PROC[me: MyGraphicRef] = BEGIN ENABLE RuntimeError.UNCAUGHT => { IF CDVPrivate.catchAnyWhichDeadlock THEN GOTO SomeError ELSE REJECT; }; yi, yo, xi, xo: INT; --i=inner, o=outer, if p1 considered center wireWidth: CD.Number = MAX[CDVPrivate.ScaleDesignToViewer[me, me.defaultWidthVC], 1]; p1: CD.Position = ViewerPos1[me]; p2: CD.Position = ViewerPos2[me]; IF me.firstHorizontalVC THEN { IF p2.x<=p1.x AND p2.x>=p1.x-wireWidth AND (p2.yp1.y+wireWidth) THEN { -- sorry, only vertical, p2.x ignored CDVPrivate.InvertArea[me, p1.x, p2.y, p1.x, p1.y]; CDVPrivate.InvertArea[me, p1.x, p1.y, p1.x+wireWidth, p1.y]; CDVPrivate.InvertArea[me, p1.x+wireWidth, p1.y, p1.x+wireWidth, p2.y]; CDVPrivate.InvertArea[me, p1.x+wireWidth, p2.y, p1.x, p2.y]; RETURN }; IF p2.x>=p1.x THEN {xi _ p2.x; xo _ xi+wireWidth} ELSE {xo _ p2.x; xi _ xo+wireWidth}; IF p2.yp1.y+wireWidth THEN { -- L shaped, up CDVPrivate.InvertArea[me, p1.x, p1.y, xo, p1.y]; CDVPrivate.InvertArea[me, xo, p1.y, xo, p2.y]; CDVPrivate.InvertArea[me, xo, p2.y, xi, p2.y]; CDVPrivate.InvertArea[me, xi, p2.y, xi, p1.y+wireWidth]; CDVPrivate.InvertArea[me, xi, p1.y+wireWidth, p1.x, p1.y+wireWidth]; CDVPrivate.InvertArea[me, p1.x, p1.y+wireWidth, p1.x, p1.y]; RETURN }; CDVPrivate.InvertArea[me, p1.x, p1.y, p2.x, p1.y]; CDVPrivate.InvertArea[me, p2.x, p1.y, p2.x, p1.y+wireWidth]; CDVPrivate.InvertArea[me, p2.x, p1.y+wireWidth, p1.x, p1.y+wireWidth]; CDVPrivate.InvertArea[me, p1.x, p1.y+wireWidth, p1.x, p1.y]; } ELSE -- NOT me.firstHorizontalVC -- { IF p2.y<=p1.y AND p2.y>=p1.y-wireWidth AND (p2.xp1.x+wireWidth) THEN { -- sorry, only horizontal, p2.y ignored CDVPrivate.InvertArea[me, p2.x, p1.y, p1.x, p1.y]; CDVPrivate.InvertArea[me, p1.x, p1.y, p1.x, p1.y+wireWidth]; CDVPrivate.InvertArea[me, p1.x, p1.y+wireWidth, p2.x, p1.y+wireWidth]; CDVPrivate.InvertArea[me, p2.x, p1.y+wireWidth, p2.x, p1.y]; RETURN }; IF p2.y>=p1.y THEN {yi _ p2.y; yo _ yi+wireWidth} ELSE {yo _ p2.y; yi _ yo+wireWidth}; IF p2.xp1.x+wireWidth THEN { -- L shaped, right CDVPrivate.InvertArea[me, p1.x, p1.y, p1.x, yo]; CDVPrivate.InvertArea[me, p1.x, yo, p2.x, yo]; CDVPrivate.InvertArea[me, p2.x, yo, p2.x, yi]; CDVPrivate.InvertArea[me, p2.x, yi, p1.x+wireWidth, yi]; CDVPrivate.InvertArea[me, p1.x+wireWidth, yi, p1.x+wireWidth, p1.y]; CDVPrivate.InvertArea[me, p1.x+wireWidth, p1.y, p1.x, p1.y]; RETURN }; -- only vertical CDVPrivate.InvertArea[me, p1.x, p1.y, p1.x, p2.y]; CDVPrivate.InvertArea[me, p1.x, p2.y, p1.x+wireWidth, p2.y]; CDVPrivate.InvertArea[me, p1.x+wireWidth, p2.y, p1.x+wireWidth, p1.y]; CDVPrivate.InvertArea[me, p1.x+wireWidth, p1.y, p1.x, p1.y]; }; EXITS SomeError => NULL; END; SetCursorMode: PUBLIC PROC[me: MyGraphicRef, mode: CDVPrivate.CursorMode] = BEGIN me.designRec.modeLC _ mode; SELECT mode FROM cLBox => { l: CD.Level = CDTechnology.CurrentLevel[me.actualDesign]; w: CD.DesignNumber = CDTechnology.LevelWidth[me.actualDesign, l]; me.designRec.outlineProcLC _ IF w>0 THEN LCursor ELSE BoxCursor }; cBox => me.designRec.outlineProcLC _ BoxCursor; cArrow => me.designRec.outlineProcLC _ LineCursor; cPos => me.designRec.outlineProcLC _ PosCursor; cDont => me.designRec.outlineProcLC _ DontCursor; ENDCASE => me.designRec.outlineProcLC _ ShadowCursor; END; virtual: Terminal.Virtual = Terminal.Current[]; InvertArea: PUBLIC PROC[me: MyGraphicRef, x1, y1, x2, y2: INT] = TRUSTED BEGIN ENABLE RuntimeError.UNCAUGHT => { IF CDVPrivate.catchAnyWhichDeadlock THEN GOTO SomeError ELSE REJECT; }; xBit: CARDINAL; coordSys: ViewerClasses.CoordSys = bottom; xc1: CARDINAL _ MIN[MAX[x1, 0], LONG[me.vwminus1]]; yc1: CARDINAL _ MIN[MAX[y1, 0], LONG[me.vhminus1]]; xc2: CARDINAL _ MIN[MAX[x2, 0], LONG[me.vwminus1]]; yc2: CARDINAL _ MIN[MAX[y2, 0], LONG[me.vhminus1]]; IF xc1>xc2 THEN {t: CARDINAL=xc1; xc1_xc2; xc2_t}; IF yc1>yc2 THEN {t: CARDINAL=yc1; yc1_yc2; yc2_t}; me.bBLT.width _ PrincOpsUtils.BITSHIFT[(xc2+1-xc1), me.logbpp]; me.bBLT.height _ (yc2+1-yc1); xBit _ PrincOpsUtils.BITSHIFT[(xc1+me.vx), me.logbpp]; yc1 _ IF coordSys=top THEN yc1+me.vy ELSE me.vy-yc2; me.bBLT.dst _ [ me.screen + (LONG[yc1]*LONG[me.scWidthWords]) + LONG[(xBit/Basics.bitsPerWord)],, xBit MOD Basics.bitsPerWord ]; me.bBLT.flags.dstFunc _ xor; -- cursoring is monitored; no drawing! IF me.bpp=1 THEN PrincOpsUtils.BITBLT[me.bBLT] ELSE { TerminalExtras.LockColorFrame[vt: virtual, xmin: xc1+me.vx, ymin: yc1, xmax: xc2+me.vx+1, ymax: yc1+me.bBLT.height ]; PrincOpsUtils.BITBLT[me.bBLT]; TerminalExtras.UnlockColorFrame[virtual] }; me.bBLT.flags.dstFunc _ null; EXITS SomeError => NULL; END; END. `CDVCursor.mesa by Christian Jacobi August 5, 1983 11:07 am last edited by Christian Jacobi October 14, 1983 6:03 pm -- only horizontal --sets modeLC, outlineProcLC --x1, y1, x2, y2 in viewers coordinates; inverts all the border points errrorReport.text _ "InvertArea"; errrorReport.me _ me; errrorReport.r_[x1: x1, x2: x2, y1: y1, y2: y2]; Ê1˜Jšœ™Jšœ.™.Jšœ:™:J˜šÏk ˜ Jšœ˜Jšœ ˜ Jšœ ˜ J˜ J˜ Jšœ˜Jšœ˜Jšœ˜Jšœ ˜ Jšœ˜J˜—JšÏn œœ˜Jšœ]˜dJšœ ˜Jš˜J˜Jšœ$˜$Jšœœ˜-J˜š ž œœœœ œ˜DJšœ4˜:J˜J˜—š ž œœœœ œ˜DJšœ5˜;J˜J˜—šžœœœ˜5J˜4J˜5Jšœ˜J˜—šž œœœ˜+Jš˜Jšœœ˜Jšœ˜J˜1J˜2J˜1J˜2Jšœ˜J˜—šž œœœ˜.Jš˜Jšœœ˜Jšœ6˜6Jšœ6˜6Jšœ˜J˜—šž œœœ˜,Jš˜Jšœœ˜Jšœ6˜6Jšœ6˜6Jšœ˜J˜—šž œœœ˜,Jš˜Jšœœ˜Jšœœ˜Jšœ˜J˜-J˜.Jšœ˜J˜—šž œœœ˜+Jš˜šœœ˜!Jš œ"œœ œœ˜DJ˜—Jšœœ˜Jšœœ˜Jšœ2˜2Jšœ2˜2Jšœ2˜2Jšœ2˜2š˜Jšœ œ˜—Jšœ˜J˜—šžœœœ˜)Jš˜šœœ˜!Jš œ"œœ œœ˜DJ˜—JšœœÏc+˜Ašœ œ ˜Jšœ;˜>—Jšœœ˜!Jšœœ˜!šœœ˜šœ œ˜&Jšœ œŸ%˜SJšœ2˜2Jšœ<˜