DIRECTORY CD, CDApplications, CDCommands, CDCommandOps, CDOps, CDOrient, CDRects, CDSequencer, TerminalIO, CDInline; CDWireAndSelectCommands: CEDAR PROGRAM IMPORTS CDApplications, CDCommandOps, CDCommands, CDOps, CDSequencer, TerminalIO, CDRects, CDInline = BEGIN AddARect: PROC[design: CD.Design, r: CD.DesignRect, l: CD.Level] = BEGIN ob: CD.ObPtr; sz: CD.DesignPosition _ CDInline.SizeOfRect[r]; orient: CD.Orientation _ CDOrient.original; IF sz.yr.x2 THEN (pos.x-r.x2) ELSE 0), (IF pos.yr.y2 THEN (pos.y-r.y2) ELSE 0) ]] END; CloseReSelect: PROC [design: CD.Design, pos: CD.DesignPosition, verbose: BOOL_TRUE, dist: CD.DesignNumber_100] = BEGIN IF ~ReSelect[design, pos, verbose] THEN { ap: CD.ApplicationPtr _ NIL; FOR w: CD.ApplicationList _ CDOps.AppList[design], w.rest WHILE w#NIL DO d: CD.DesignNumber = RectDist[pos, CDApplications.ARectI[w.first]]; IF d=start.x-wireWidth AND (stop.ystart.y+wireWidth) THEN { --crazy vertical wire IF ABS[start.y-stop.y]=start.y AND stop.y<=start.y+wireWidth THEN { --horizontal wire stop.y _ start.y+wireWidth; AddARect[comm.design, CDInline.ToRect[start, stop], comm.l] } ELSE { --L shaped (firsthorizontal) IF start.x<=stop.x THEN {stop.x _ stop.x+wireWidth} ELSE {t: CD.Number=stop.x; stop.x _ start.x; start.x _ t}; stop.y _ start.y+wireWidth; AddARect[comm.design, CDInline.ToRect[start, stop], comm.l]; IF firstOnly THEN RETURN; start.x _ comm.pos.x; stop.y _ comm.pos.y; stop.x _ start.x+wireWidth; AddARect[comm.design, CDInline.ToRect[start, stop], comm.l]; } } ELSE { -- NOT firstHorizontalVC -- IF stop.y<=start.y AND stop.y>=start.y-wireWidth AND (stop.xstart.x+wireWidth) THEN { --crazy horizontal wire IF ABS[stop.x-start.x]=start.x AND stop.x<=start.x+wireWidth THEN { --vertical wire stop.x _ start.x+wireWidth; AddARect[comm.design, CDInline.ToRect[start, stop], comm.l] } ELSE { --L shaped (firstVertical) IF start.y<=stop.y THEN {stop.y _ stop.y+wireWidth} ELSE {t: CD.Number = stop.y; stop.y _ start.y; start.y _ t}; stop.x _ start.x+wireWidth; AddARect[comm.design, CDInline.ToRect[start, stop], comm.l]; IF firstOnly THEN RETURN; start.y _ comm.pos.y; stop.y _ start.y+wireWidth; stop.x _ comm.pos.x; AddARect[comm.design, CDInline.ToRect[start, stop], comm.l]; } } END; DeselectPointed: PROC [comm: CDSequencer.Command] = BEGIN TerminalIO.WriteRope["Remove selection\n"]; CDCommands.DeSelect[comm.design, comm.pos] END; DeSelectLast: PROC [design: CD.Design, pos: CD.DesignPosition, usePos: BOOL_TRUE] RETURNS [done: BOOL_FALSE] = BEGIN sel: CD.ApplicationPtr _ NIL; FOR w: CD.ApplicationList _ CDOps.AppList[design], w.rest WHILE w#NIL DO IF w.first.selected THEN { IF ~usePos OR CDApplications.PointToI[pos, w.first] THEN sel _ w.first; }; ENDLOOP; IF sel#NIL THEN { sel.selected _ FALSE; done _ TRUE; CDOps.DelayedRedraw[design, CDApplications.ARectO[sel]]; } END; DeselectLastSelected: PROC [comm: CDSequencer.Command] = BEGIN TerminalIO.WriteRope["Remove selection\n"]; [] _ DeSelectLast[comm.design, comm.pos, TRUE] END; AddSelection: PROC [comm: CDSequencer.Command] = BEGIN TerminalIO.WriteRope["Add selection "]; CDCommands.Select[comm.design, comm.pos]; TerminalIO.WriteLn[]; END; DeselectAll: PROC [comm: CDSequencer.Command] = BEGIN TerminalIO.WriteRope["Deselect all\n"]; CDCommands.DeselectAll[comm.design] END; DeleteSelected: PROC [comm: CDSequencer.Command] = BEGIN TerminalIO.WriteRope["Delete selected\n"]; CDCommands.DeleteSelected[comm.design] END; DeletePointed: PROC [comm: CDSequencer.Command] = BEGIN TerminalIO.WriteRope["Delete pointed\n"]; CDCommands.DeletePointed[comm.design, comm.pos] END; Undelete: PROC [comm: CDSequencer.Command] = BEGIN TerminalIO.WriteRope["Undelete\n"]; CDCommands.Undelete[comm.design] END; SelectAll: PROC [comm: CDSequencer.Command] = BEGIN TerminalIO.WriteRope["Select all\n"]; CDCommands.SelectAll[comm.design] END; AreaAddSelect: PROC [comm: CDSequencer.Command] = BEGIN TerminalIO.WriteRope["Inclusive select area\n"]; CDCommands.AreaSelect[comm.design, CDInline.ToRect[comm.pos, comm.sPos]] END; AAddSelect: PROC [comm: CDSequencer.Command] = BEGIN IF comm.pos=comm.sPos THEN { TerminalIO.WriteRope["select inclusive "]; CDCommands.Select[comm.design, comm.pos]; TerminalIO.WriteLn[]; } ELSE { TerminalIO.WriteRope["select inclusive\n"]; CDCommands.AreaSelect[comm.design, CDInline.ToRect[comm.pos, comm.sPos]] } END; AreaAddSelectTouching: PROC [comm: CDSequencer.Command] = BEGIN TerminalIO.WriteRope["select inclusive touching\n"]; CDCommands.AreaSelect[comm.design, CDInline.ToRect[comm.pos, comm.sPos], TRUE] END; AreaOnlySelect: PROC [comm: CDSequencer.Command] = BEGIN TerminalIO.WriteRope["Exclusive select area\n"]; CDCommands.DeselectAll[comm.design]; CDCommands.AreaSelect[comm.design, CDInline.ToRect[comm.pos, comm.sPos]] END; ADeSelect: PROC [comm: CDSequencer.Command] = BEGIN TerminalIO.WriteRope["deselect\n"]; IF comm.pos=comm.sPos THEN CDCommands.DeSelect[comm.design, comm.pos] ELSE CDCommands.AreaDeSelect[comm.design, CDInline.ToRect[comm.pos, comm.sPos]] END; AreaDeSelect: PROC [comm: CDSequencer.Command] = BEGIN TerminalIO.WriteRope["Deselect area\n"]; CDCommands.AreaDeSelect[comm.design, CDInline.ToRect[comm.pos, comm.sPos]] END; AreaDeSelectTouching: PROC [comm: CDSequencer.Command] = BEGIN TerminalIO.WriteRope["Deselect touching\n"]; CDCommands.AreaDeSelect[comm.design, CDInline.ToRect[comm.pos, comm.sPos], TRUE] END; AbortCommand: PROC [comm: CDSequencer.Command] = BEGIN TerminalIO.WriteRope["Try to abort current command\n"]; CDSequencer.AbortTheCommand[comm.design] END; Impl: PROC [] = BEGIN CDSequencer.ImplementCommand[$AbortCommand, AbortCommand,, dontQueue]; CDSequencer.ImplementCommand[$DrawRect, AddRect]; CDSequencer.ImplementCommand[$DrawWire, AddWire]; CDSequencer.ImplementCommand[$ContinueWire, ContinueWire]; CDSequencer.ImplementCommand[$DeleteS, DeleteSelected]; CDSequencer.ImplementCommand[$DeleteP, DeletePointed]; CDSequencer.ImplementCommand[$Undel, Undelete]; CDSequencer.ImplementCommand[$OnlySelectP, SelectExclusive,, doQueue]; CDSequencer.ImplementCommand[$ReSelectOnlyP, ReSelectExclusive,, doQueue]; CDSequencer.ImplementCommand[$CloseReSelectOnlyP, CloseReSelectCommand,, doQueue]; CDSequencer.ImplementCommand[$AddSelectP, AddSelection,, doQueue]; CDSequencer.ImplementCommand[$DeSelectLP, DeselectLastSelected,, doQueue]; CDSequencer.ImplementCommand[$DeSelectFP, DeselectPointed,, doQueue]; --oldy--CDSequencer.ImplementCommand[$DeSelectP, DeselectPointed,, doQueue]; CDSequencer.ImplementCommand[$DeSelectS, DeselectAll,, doQueue]; CDSequencer.ImplementCommand[$SelectAll, SelectAll,, doQueue]; CDSequencer.ImplementCommand[$AreaOnlySelect, AreaOnlySelect,, doQueue]; CDSequencer.ImplementCommand[$AreaAddSelect, AreaAddSelect,, doQueue]; CDSequencer.ImplementCommand[$AreaAddSelectTouching, AreaAddSelectTouching,, doQueue]; CDSequencer.ImplementCommand[$AAddSelect, AAddSelect,, doQueue]; CDSequencer.ImplementCommand[$AreaDeSelect, AreaDeSelect,, doQueue]; CDSequencer.ImplementCommand[$AreaDeSelectTouching, AreaDeSelectTouching,, doQueue]; CDSequencer.ImplementCommand[$ADeSelect, ADeSelect,, doQueue]; END; Impl[]; END. BCDWireAndSelectCommands.mesa (part of Chipndale) by Christian Jacobi June 29, 1983 4:44 pm last edited Christian Jacobi February 3, 1984 7:19 pm --hit --if a selected ap is pointed we already did return --Distance between a point and a rectangle --select pointed application exclusive; --(but dont select an other application if the pointed one is already the right one) --select pointed application exclusive; --(but dont select an other application if the pointed one is already the right one) --if there is none, select closest --uses pos, sPos, n (for width), b (for firstHorizontal), l (for level) --this procedure knows EXACTLY the algorithm used for showing --temporary wires in the cursor part --not only crazy vertical -- not only crazy horizontal --Auto select area or pointed --Auto deselect area or pointed Ê ”˜Jšœ2™2Jšœ,™,Jšœ7™7J˜šÏk ˜ Jšœ˜J˜J˜ J˜ J˜J˜ J˜J˜ J˜ J˜ J˜—šÏnœœ˜&Jšœ_˜f—Jš˜J˜š žœœ œ œœ ˜CJš˜Jšœœ˜ Jšœœ)˜/Jšœœ!˜+šœ œ˜Jšœœ˜Jšœ ˜ Jšœ ˜ Jšœ˜Jšœ˜—Jšœ œ7œ˜NJšœ˜˜J˜J˜J˜"Jšœ˜—Jšœ˜J˜—šžœœ˜3Jš˜J˜'J˜$J˜)J˜Jšœ˜J˜—šžœœ œœœœœ œ˜jJš˜šžœœœ˜'Jšœ˜ šœ œ˜Jšœ œ˜Jšœ6œ˜;J˜—Jšœ˜—šž œœœ˜/Jš˜š œœ œœ˜7Jšœ˜Jš˜—Jšœ˜—JšœœœÏc%˜Bš œœ1œœ˜Hšœ'œ'œ˜YJšœ™šœœ˜Jšœ˜Jšœ*˜*Jšœ œ!˜0Jš˜Jšœ˜—Jšœœœœ ˜ Jšœ˜—Jšœ˜Jšœ˜—Jšœ3™3šœœœ˜Jšœœ˜Jšœ%˜%Jšœ7œ˜>Jšœ œ˜*J˜—šœ˜Jšœœ˜ Jšœ œ'˜6J˜—Jšœ˜J˜—š žœœœœœœ˜NJ™*Jš˜šœœ˜ Jš œœ œœœ œœ˜NJš œœ œœœ œœ˜MJ˜—Jšœ˜—J˜šž œœ œœœœœ˜pJš˜šœ!œ˜)Jšœœœ˜š œœ1œœ˜HJšœœ>˜CJšœœ˜'Jšœ˜—šœœœ˜Jšœœ˜Jšœ7œ˜>šœ œ˜Jšœ+˜+Jšœ˜J˜—J˜—J˜—Jšœ˜J˜—šžœœ˜5Jšœ'™'J™TJš˜J˜+Jšœ%˜%J˜Jšœ˜J˜—šžœœ˜8Jšœ'™'J™TJ™"Jš˜J˜,Jšœ*œ˜4J˜Jšœ˜J˜—šžœœ˜+Jš˜J˜$JšœD˜DJšœ˜—J˜šžœœ˜+JšœG™GJš˜Jšœ'œ˜-Jš˜—J˜šž œœ˜0Jš˜Jšœ'œ˜,Jšœ˜—J˜šžœœ(œœ˜JJšœ=™=Jšœ$™$Jš˜Jšœœ˜&Jšœœ˜#Jšœ œ˜$Jšœ œœ˜,J˜$šœŸœœ˜$šœœ˜0JšœœœŸ˜Mšœœœœ˜&Jšœ2œ˜:—Jšœ˜Jšœ<˜˜>JšœH˜HJ˜JšœF˜FJšœV˜VJšœ@˜@J˜JšœD˜DJšœT˜TJšœ>˜>J˜Jšœ˜—J˜Jšœ˜Jšœ˜—…—)ö9Ì