DIRECTORY BasicTime, CD, CDInstances, CDBasics, CDSimpleOps, CDCommandOps, CDOps, CDOrient, CDSequencer, TerminalIO; CDSelectCommands: CEDAR PROGRAM IMPORTS BasicTime, CDInstances, CDBasics, CDCommandOps, CDSimpleOps, CDOps, CDSequencer, TerminalIO = BEGIN SelectExclusive: PROC [comm: CDSequencer.Command] = BEGIN TerminalIO.WriteRope["Select pointed"]; CDSimpleOps.DeselectAll[comm.design]; CDSimpleOps.Select[comm.design, comm.pos]; TerminalIO.WriteLn[]; END; ReSelectExclusive: PROC [design: CD.Design, pos: CD.Position, verbose: BOOL_TRUE] RETURNS [done: BOOL_TRUE] = BEGIN Deselect: PROC[a: CD.Instance] = INLINE BEGIN IF a.selected THEN { a.selected _ FALSE; CDCommandOps.RedrawInstance[design, a] } END; DeselectList: PROC[list: CD.InstanceList] = BEGIN FOR w: CD.InstanceList _ list, w.rest WHILE w#NIL DO Deselect[w.first] ENDLOOP END; ap: CD.Instance _ NIL; --any application where pos points to FOR w: CD.InstanceList _ CDOps.InstList[design], w.rest WHILE w#NIL DO IF CDInstances.PointToI[pos, w.first] THEN { IF w.first.selected THEN { DeselectList[w.rest]; CDOps.ReOrderInstance[design, w.first]; IF verbose THEN CDCommandOps.WriteInfo[w.first]; RETURN } ELSE IF ap=NIL THEN ap _ w.first } ELSE Deselect[w.first] ENDLOOP; IF ap#NIL THEN { ap.selected _ TRUE; CDOps.ReOrderInstance[design, ap]; CDCommandOps.RedrawInstance[design, ap, FALSE]; IF verbose THEN CDCommandOps.WriteInfo[ap] } ELSE { done _ FALSE; IF verbose THEN TerminalIO.WriteRope[" (no object)"]; } END; RectDist: PROC[pos: CD.Position, r: CD.Rect] RETURNS [CD.Number] = BEGIN RETURN [MAX[ (IF pos.xr.x2 THEN (pos.x-r.x2) ELSE 0), (IF pos.yr.y2 THEN (pos.y-r.y2) ELSE 0) ]] END; CloseReSelectExclusive: PROC [design: CD.Design, pos: CD.Position, verbose: BOOL_TRUE, dist: CD.Number_100] = BEGIN IF ~ReSelectExclusive[design, pos, verbose] THEN { ap: CD.Instance _ NIL; FOR w: CD.InstanceList _ CDOps.InstList[design], w.rest WHILE w#NIL DO d: CD.Number = RectDist[pos, CDInstances.InstRectI[w.first]]; IF dšžœ˜J˜1JšœI˜IJ˜—Jšžœ˜—J˜šŸœžœ˜9Jšž˜J˜5JšœJžœ˜OJšžœ˜—J˜šŸœžœ˜2Jšž˜J˜'Jšœ%˜%JšœI˜IJšžœ˜—J˜šŸ œžœ˜-Jšœ™Jšž˜J˜#Jšžœžœ,˜FJšžœM˜QJšœ˜Jšžœ˜—J˜šŸ œžœ˜0Jšž˜J˜)JšœK˜KJšžœ˜—J˜šŸœžœ˜8Jšž˜J˜-JšœLžœ˜QJšžœ˜—J˜JšœF˜FJšœN˜NJšœO˜OJšœB˜BJ˜JšœJ˜JJšœE˜EJšœ@˜@Jšœ>˜>JšœH˜HJšœN˜NJ˜JšœF˜FJšœV˜VJšœH˜HJšœN˜NJ˜JšœD˜DJšœT˜TJšœ>˜>Jšžœ˜—…—Æ,ç