<> <> <> <> <> <> <> <> <> <> <> <> <> <<>> DIRECTORY CD, CDInstances, CDOps, CDPanelFonts, CDSatellites, CDSequencer, CDTexts, IO, Rope, TerminalIO; CDSatellitesCommands: CEDAR PROGRAM IMPORTS CDInstances, CDOps, CDPanelFonts, CDSatellites, CDSequencer, CDTexts, IO, TerminalIO = BEGIN SelectWithMaster: PROC [design: CD.Design, master: REF, deselectOthers: BOOL_TRUE] RETURNS [n: INT_0] = { FOR w: CD.InstanceList _ CDOps.InstList[design], w.rest WHILE w#NIL DO IF CDTexts.IsText[w.first.ob] AND CDSatellites.IsAssociated[master, w.first] THEN { n _ n+1; SelectInst[design, w.first] } ELSE IF master=w.first THEN SelectInst[design, w.first] ELSE DeSelectInst[design, w.first] ENDLOOP; }; SelectObjectSatellitesComm: PROC [comm: CDSequencer.Command] = { n: INT; ob: CD.Object _ CDOps.PushedTopCell[comm.design]; [] _ CDSatellites.GetSatellites[ob]; --reinstalls invariants n _ SelectWithMaster[comm.design, ob]; TerminalIO.PutF[" %g satellites(s) in group.\n", IO.int[n]]; }; SelectInstanceSatellitesComm: PROC [comm: CDSequencer.Command] = { n: INT; selOrMaster: REF_NIL; selected: CD.Instance _ CDOps.TheInstance[comm.design, "select satelites for "]; IF selected#NIL THEN { ob: CD.Object _ CDOps.PushedTopCell[comm.design]; [] _ CDSatellites.GetSatellites[ob]; --reinstalls invariants IF CDTexts.IsText[selected.ob] THEN { WITH CDSatellites.GetMaster[ob, selected] SELECT FROM i: CD.Instance => {selOrMaster _ i; TerminalIO.PutRope["instance satellites"]}; o: CD.Object => {selOrMaster _ o; TerminalIO.PutRope["object satellites"]}; ENDCASE => {selOrMaster _ NIL; TerminalIO.PutRope["non satellite texts"]}; } ELSE {selOrMaster _ selected; TerminalIO.PutRope["instance satellites"]}; } ELSE {selOrMaster _ NIL; TerminalIO.PutRope[" select non satellite texts"]}; n _ SelectWithMaster[comm.design, selOrMaster]; TerminalIO.PutF[" %g satellite(s) in group.\n", IO.int[n]]; }; SetInstanceSatellites: PROC [design: CD.Design, exclusive: BOOL] RETURNS [n: INT_0] = { satellites: CD.InstanceList _ NIL; master: CD.Instance _ NIL; ob: CD.Object _ CDOps.PushedTopCell[design]; [] _ CDSatellites.GetSatellites[ob]; --reinstalls invariants FOR w: CD.InstanceList _ CDOps.InstList[design], w.rest WHILE w#NIL DO IF w.first.selected THEN { IF CDTexts.IsText[w.first.ob] THEN satellites _ CONS[w.first, satellites] ELSE { IF master#NIL THEN CDSequencer.Quit["failed: more than one master selected"]; master _ w.first } } ENDLOOP; IF master=NIL THEN CDSequencer.Quit["failed: no master selected"]; IF exclusive THEN CDSatellites.Associate[master, NIL]; FOR w: CD.InstanceList _ satellites, w.rest WHILE w#NIL DO n _ n+1; CDSatellites.Associate[master, w.first]; ENDLOOP; }; SetObjectSatellites: PROC [design: CD.Design, exclusive: BOOL] RETURNS [n: INT_0] = { ob: CD.Object _ CDOps.PushedTopCell[design]; [] _ CDSatellites.GetSatellites[ob]; --reinstalls invariants IF exclusive THEN CDSatellites.Associate[ob, NIL]; FOR w: CD.InstanceList _ CDOps.InstList[design], w.rest WHILE w#NIL DO IF w.first.selected AND CDTexts.IsText[w.first.ob] THEN { CDSatellites.Associate[ob, w.first]; n _ n+1; }; ENDLOOP; }; InclusiveInstanceSatellitesComm: PROC [comm: CDSequencer.Command] = { TerminalIO.PutRope["set instance satellites inclusive\n"]; [] _ SetInstanceSatellites[comm.design, FALSE]; }; ExclusiveInstanceSatellitesComm: PROC [comm: CDSequencer.Command] = { n: INT; TerminalIO.PutRope["set object satellites exclusive\n"]; n _ SetInstanceSatellites[comm.design, TRUE]; TerminalIO.PutF[" %g satellite(s) in group.\n", IO.int[n]]; }; <<>> InclusiveObjectSatellitesComm: PROC [comm: CDSequencer.Command] = { TerminalIO.PutRope["set object satellites inclusive\n"]; [] _ SetObjectSatellites[comm.design, FALSE]; }; ExclusiveObjectSatellitesComm: PROC [comm: CDSequencer.Command] = { n: INT; TerminalIO.PutRope["set object satellites exclusive\n"]; n _ SetObjectSatellites[comm.design, TRUE]; TerminalIO.PutF[" %g satellite(s) in group.\n", IO.int[n]]; }; GetTextPart: PROC [comm: CDSequencer.Command, r: Rope.ROPE] RETURNS [i: CD.Instance] = { <<--quits command if no success>> ob: CD.Object; f: CDTexts.CDFont; name: Rope.ROPE _ TerminalIO.RequestRope[r]; f _ CDPanelFonts.CurrentFont[comm.design]; IF f=NIL THEN CDSequencer.Quit["failed: no current font"]; IF name=NIL THEN CDSequencer.Quit["failed: empty text"]; ob _ CDTexts.Create[name, f, CD.commentLayer, TRUE]; IF ob=NIL THEN CDSequencer.Quit["failed: text not created"]; i _ CDInstances.NewInst[ob, [comm.pos]]; CDOps.IncludeInstance[comm.design, i]; }; DrawInstanceSatelliteComm: PROC [comm: CDSequencer.Command] = { selected: CD.Instance _ CDOps.TheInstance[comm.design, "draw satellite to master\n"]; IF selected#NIL THEN { inst: CD.Instance; ob: CD.Object _ CDOps.PushedTopCell[comm.design]; [] _ CDSatellites.GetSatellites[ob]; --reinstalls invariants IF CDTexts.IsText[selected.ob] THEN CDSequencer.Quit["failed: selected instance is text, can't put a satellite on texts\n"]; inst _ GetTextPart[comm, "type instance satellite: "]; CDSatellites.Associate[selected, inst]; }; }; DrawObjectSatelliteComm: PROC [comm: CDSequencer.Command] = { ob: CD.Object _ CDOps.PushedTopCell[comm.design]; text: CD.Instance _ GetTextPart[comm, "type object satellite: "]; [] _ CDSatellites.GetSatellites[ob]; --reinstalls invariants CDSatellites.Associate[ob, text]; }; <<>> UnSatelliteComm: PROC [comm: CDSequencer.Command] = { TerminalIO.PutRope["remove satellite association for selected\n"]; FOR w: CD.InstanceList _ CDOps.InstList[comm.design], w.rest WHILE w#NIL DO IF w.first.selected THEN CDSatellites.Associate[w.first, NIL]; ENDLOOP; }; <<>> <<--general utilities>> <<>> SelectInst: PROC [design: CD.Design, inst: CD.Instance] = { IF ~inst.selected THEN { inst.selected_TRUE; CDOps.RedrawInstance[design, inst]; } }; DeSelectInst: PROC [design: CD.Design, inst: CD.Instance] = { IF inst.selected THEN { inst.selected_FALSE; CDOps.RedrawInstance[design, inst, TRUE]; } }; CDSequencer.ImplementCommand[$SelectInstanceGroup, SelectInstanceSatellitesComm,, doQueue]; CDSequencer.ImplementCommand[$SelectObjectGroup, SelectObjectSatellitesComm,, doQueue]; CDSequencer.ImplementCommand[$AddInstanceSatellite, DrawInstanceSatelliteComm,, doQueueAndMark]; CDSequencer.ImplementCommand[$AddObjectSatellite, DrawObjectSatelliteComm,, doQueueAndMark]; CDSequencer.ImplementCommand[$SetInstanceSatellites, InclusiveInstanceSatellitesComm,, doQueueAndMark]; CDSequencer.ImplementCommand[$SetInstanceSatellitesExclusive, ExclusiveInstanceSatellitesComm,, doQueueAndMark]; CDSequencer.ImplementCommand[$SetObjectSatellites, InclusiveObjectSatellitesComm,, doQueueAndMark]; CDSequencer.ImplementCommand[$SetObjectSatellitesExclusive, ExclusiveObjectSatellitesComm,, doQueueAndMark]; CDSequencer.ImplementCommand[$UnSatellite, UnSatelliteComm,, doQueueAndMark]; <<>> <<[] _ CDPopUpMenus.MakeMenu[$SatellitesMenu, "Satellites Menu", "Satellites Menu"];>> <> <> <", >> <> <> <> <<];>> <> <> <> <", >> <> <> <<];>> <<>> <> <> <> <", >> <> <> <<];>> <> <> <> <", >> <> <> <<];>> <<>> <> <> <> <; adds instance satellites", >> <> <> <<];>> <> <> <> <> <> <> <<];>> <> <> < add other object satellites", >> <> <> <> <<];>> <> <> <> <> <> <> <<];>> <<>> <> <> <> <> <> <<];>> END.