<<--File: IPMVEditOpsImpl.mesa>> <> <> DIRECTORY IO, TerminalIO, Rope, Commander, Menus, Labels , IP, IPCTG, IPCoTab, IPToolBox, IPBasicOps, IPTopOps, IPTop, IPMVEditOps; IPMVEditOpsImpl: CEDAR PROGRAM IMPORTS IO, TerminalIO, Rope, IPCoTab, IPToolBox, IPBasicOps, IPCTG, IPTopOps EXPORTS IPMVEditOps= BEGIN OPEN TIO: TerminalIO, Top: IPTop, CT: IPCoTab, CTG: IPCTG; <<##Some minor details##-->> DefaultBrkOtherIfX: BOOL _ FALSE; DefaultOrientation: CTG.ChType _ hor; MenuHit: PUBLIC PROC [top: Top.Ref, command: ATOM, mouse: Menus.MouseButton, shift, control: BOOL] RETURNS [reGeom, refreshFlag: BOOL _ TRUE] ={ SELECT command FROM $BrkX =>{argStream: IO.STREAM _ IO.RIS[TIO.RequestRope["BreakCross: \n"]]; refCh: CTG.Channel _ top.ctg.GetChannel[argStream.GetID]; toBreakCh: CTG.Channel _ top.ctg.GetChannel[argStream.GetID]; TIO.WriteRope["Breaking Cross..."]; [] _ IPTopOps.BreakCross[top, refCh, toBreakCh, TRUE];}; $FomX =>{argStream: IO.STREAM _ IO.RIS[TIO.RequestRope["FormCross: \n"]]; ch1: CTG.Channel _ top.ctg.GetChannel[argStream.GetID]; ch2: CTG.Channel _ top.ctg.GetChannel[argStream.GetID]; TIO.WriteRope["Form Cross..."]; [] _ IPTopOps.FormCross[top, ch1, ch2, TRUE];}; $RemZ =>{argStream: IO.STREAM _ IO.RIS[TIO.RequestRope["RemoveZ: \n"]]; zSpine: CTG.Channel _ top.ctg.GetChannel[argStream.GetID]; TIO.WriteRope["Remove Z..."]; [] _ IPTopOps.RemoveZ[top, zSpine, TRUE];}; $FomZ =>{argStream: IO.STREAM _ IO.RIS[TIO.RequestRope["FormZ: \n"]]; comp1: CTG.Component _ top.coTab.GetComponent[argStream.GetID]; comp2: CTG.Component _ top.coTab.GetComponent[argStream.GetID]; zType: CTG.Side _ IF Rope.Equal[argStream.GetID, "neg", FALSE] THEN neg ELSE pos; TIO.WriteRope["Form Z..."]; [] _ IPTopOps.FormZ[top, comp1, comp2, zType, TRUE];}; $LtoT =>{argStream: IO.STREAM _ IO.RIS[TIO.RequestRope["LtoT: \n"]]; ch: CTG.Channel _ top.ctg.GetChannel[argStream.GetID]; whichEnd: CTG.Side _ IF Rope.Equal[argStream.GetID, "neg", FALSE] THEN neg ELSE pos; TIO.WriteRope["Changing L to T..."]; [] _ IPTopOps.LtoT[top, ch, whichEnd, TRUE];}; $TtoL =>{argStream: IO.STREAM _ IO.RIS[TIO.RequestRope["TtoL: \n"]]; co: CT.Component _ top.coTab.GetComponent[argStream.GetID]; ch: CTG.Channel _ top.ctg.GetChannel[argStream.GetID]; lType: CTG.Side _ IF Rope.Equal[argStream.GetID, "neg", FALSE] THEN neg ELSE pos; TIO.WriteRope["Changing T to L..."]; [] _ IPTopOps.TtoL[top, co, ch, lType, TRUE];}; $FlxKne =>{argStream: IO.STREAM _ IO.RIS[TIO.RequestRope["FlexKnee: \n"]]; leg: CTG.Channel _ top.ctg.GetChannel[argStream.GetID]; floor: CTG.Channel _ top.ctg.GetChannel[argStream.GetID]; whichEnd: CTG.Side _ IF Rope.Equal[argStream.GetID, "neg", FALSE] THEN neg ELSE pos; TIO.WriteRope["Forming Knee ..."]; [] _ IPTopOps.FlexKnee[top, leg, floor, whichEnd, TRUE];}; $ExtKne =>{argStream: IO.STREAM _ IO.RIS[TIO.RequestRope["ExtendKnee: \n"]]; shin: CTG.Channel _ top.ctg.GetChannel[argStream.GetID]; TIO.WriteRope["Extending Knee..."]; [] _ IPTopOps.ExtendKnee[top, shin, TRUE];}; $FlipT =>{argStream: IO.STREAM _ IO.RIS[TIO.RequestRope["FlipT: \n"]]; chToBend: CTG.Channel _ top.ctg.GetChannel[argStream.GetID]; attachTo: CTG.Channel _ top.ctg.GetChannel[argStream.GetID]; whichEnd: CTG.Side _ IF Rope.Equal[argStream.GetID, "neg", FALSE] THEN neg ELSE pos; TIO.WriteRope["FlippingT..."]; [] _ IPTopOps.FlipT[top, chToBend, attachTo, whichEnd, TRUE];}; $Mrr => {argStream: IO.STREAM _ IO.RIS[TIO.RequestRope["Mirror: \n"]]; comp: CT.Component _ top.coTab.GetComponent[argStream.GetID]; mirrorOrient: CTG.ChType; IF Rope.Equal[IO.GetID[argStream! IO.EndOfStream => {mirrorOrient _ IPBasicOps.OTFlip[DefaultOrientation]; CONTINUE}], "hor", FALSE] THEN mirrorOrient _ hor ELSE mirrorOrient _ ver; TIO.WriteRope[Rope.Cat["Mirroring ", CT.GetName[comp], "..."]]; [] _ IPTopOps.Mirror[top, comp, mirrorOrient, TRUE];}; $Rot => {argStream: IO.STREAM _ IO.RIS[TIO.RequestRope["Rotate: \n"]]; comp: CT.Component _ top.coTab.GetComponent[argStream.GetID]; numberOfRot: INT; numberOfRot _ IO.GetInt[argStream ! IO.EndOfStream => {numberOfRot _ 1; CONTINUE}]; TIO.WriteRope[Rope.Cat["Rotating ", CT.GetName[comp], "...."]]; [] _ IPTopOps.Rotate[top, comp, numberOfRot, TRUE];}; $Ornt => {argStream: IO.STREAM _ IO.RIS[TIO.RequestRope["Orient: \n"]]; comp: CT.Component _ top.coTab.GetComponent[argStream.GetID]; opCode: INT _ argStream.GetInt; TIO.WriteRope[Rope.Cat["Orienting ", CT.GetName[comp], "..."]]; [] _ IPTopOps.Orient[top, comp, opCode, TRUE];}; $SetCo => {argStream: IO.STREAM _ IO.RIS[TIO.RequestRope["SetComponent: \n"]]; comp: CT.Component _ top.coTab.GetComponent[argStream.GetID]; active: BOOL; atX, atY: INT; atX _ IO.GetInt[argStream ! IO.EndOfStream => {atX _ 1; CONTINUE}]; atY _ IO.GetInt[argStream ! IO.EndOfStream => {atY _ 1; CONTINUE}]; active _ IO.GetBool[argStream ! IO.EndOfStream => {active _ TRUE; CONTINUE}]; TIO.WriteRope[Rope.Cat["Setting Componet ", CT.GetName[comp], "..."]]; [] _ IPTopOps.SetComponent[top, comp, active, [atX, atY], TRUE]; reGeom _ FALSE; refreshFlag _ FALSE; }; $MovCo => {argStream: IO.STREAM _ IO.RIS[TIO.RequestRope["Move Component: \n"]]; comp: CT.Component _ top.coTab.GetComponent[argStream.GetID]; byX: INT _ argStream.GetInt; byY: INT _ argStream.GetInt; TIO.WriteRope[Rope.Cat["Moving Component ", CT.GetName[comp], "..."]]; [] _ IPTopOps.MoveComponent[top, comp, [byX, byY], TRUE]; reGeom _ FALSE; refreshFlag _ FALSE; }; $SwapCo => { argStream: IO.STREAM _ IO.RIS[TIO.RequestRope["Swap Components: \n"]]; comp1: CT.Component _ top.coTab.GetComponent[argStream.GetID]; comp2: CT.Component _ top.coTab.GetComponent[argStream.GetID]; TIO.WriteRope[Rope.Cat["Swapping Components ", CT.GetName[comp1], " and ", CT.GetName[comp2], "..."]]; []_ IPTopOps.SwapComponents[top, comp1, comp2, TRUE]; }; $SpawnCo => { argStream: IO.STREAM _ IO.RIS[TIO.RequestRope["Spawn Components: \n"]]; comp: CT.Component _ top.coTab.GetComponent[argStream.GetID]; negChildName: Rope.ROPE _ argStream.GetID; posChildName: Rope.ROPE _ argStream.GetID; splitDirection: CTG.ChType; splitDirection _ IF Rope.Equal[IO.GetID[argStream ! IO.EndOfStream => {splitDirection _ ver; CONTINUE}], "hor", FALSE] THEN hor ELSE ver; TIO.WriteRope[Rope.Cat[Rope.Cat[CT.GetName[comp], " spawns into ", negChildName], Rope.Cat[" and ", posChildName, "..."]]]; []_ IPTopOps.SpawnComps[top, comp, negChildName, posChildName, comp.shape, comp.shape, splitDirection, TRUE, TRUE]; }; $SetCoShp => { argStream: IO.STREAM _ IO.RIS[TIO.RequestRope["Set Component Shape: \n"]]; comp: CT.Component _ top.coTab.GetComponent[argStream.GetID]; shape: IP.ShapeRep _ IPToolBox.GetShape[argStream]^; TIO.WriteRope[Rope.Cat["Setting ", CT.GetName[comp], " shape..."]]; []_ IPTopOps.SetCompShape[top, comp, shape, TRUE, TRUE]; }; $ClrCnr =>{argStream: IO.STREAM _ IO.RIS[TIO.RequestRope["ClearNegCorners: ()\n"]]; co: CT.Component _ top.coTab.GetComponent[argStream.GetID]; cornerType: NAT _ argStream.GetInt; chToUse: CTG.ChType; chToUse _ IF Rope.Equal[IO.GetID[argStream! IO.EndOfStream => {chToUse _ DefaultOrientation; CONTINUE}], "hor", FALSE] THEN hor ELSE ver; TIO.WriteRope[Rope.Cat["Clear Neg Corners...", (SELECT cornerType FROM 0 => "all", 1 => "sw", 2 => "se", 3 => "ne", 4 => "nw", ENDCASE => ERROR), "..."]]; SELECT cornerType FROM 0=> [] _ IPTopOps.ClearAllNegCorners[top, co, chToUse, DefaultBrkOtherIfX, TRUE]; 1 => [] _ IPTopOps.ClearNegCorner[top, co, sw, chToUse, DefaultBrkOtherIfX, TRUE]; 2 => [] _ IPTopOps.ClearNegCorner[top, co, se, chToUse, DefaultBrkOtherIfX, TRUE]; 3 => [] _ IPTopOps.ClearNegCorner[top, co, ne, chToUse, DefaultBrkOtherIfX, TRUE]; 4 => [] _ IPTopOps.ClearNegCorner[top, co, nw, chToUse, DefaultBrkOtherIfX, TRUE]; ENDCASE => ERROR;}; $Grw =>{argStream: IO.STREAM _ IO.RIS[TIO.RequestRope["Grow: \n"]]; coName: Rope.ROPE _ argStream.GetID; co: CT.Component _ top.coTab.GetComponent[coName]; chToSplit: CTG.Channel _ top.ctg.GetChannel[argStream.GetID]; negBnd: CTG.Channel _ top.ctg.GetChannel[argStream.GetID]; posBnd: CTG.Channel _ top.ctg.GetChannel[argStream.GetID]; TIO.WriteRope["Grow..."]; [] _ IPTopOps.Grow[top, co, chToSplit, negBnd, posBnd, TRUE]; }; $Grw1 =>{argStream: IO.STREAM _ IO.RIS[TIO.RequestRope["Grow1: \n"]]; coName: Rope.ROPE _ argStream.GetID; co: CT.Component _ top.coTab.GetComponent[coName]; host: CT.Component _ top.coTab.GetComponent[argStream.GetID]; hostCorner: CT.CornerTypes _ (SELECT argStream.GetInt FROM 1 => sw, 2 => se, 3=> ne, ENDCASE => nw); TIO.WriteRope["Grow1..."]; [] _ IPTopOps.Grow1[top, co, host, hostCorner, TRUE];}; $Shr =>{argStream: IO.STREAM _ IO.RIS[TIO.RequestRope["Shrink: ()\n"]]; co: CT.Component _ top.coTab.GetComponent[argStream.GetID]; shrinkDirectionHint: CTG.ChType; TIO.WriteRope["Shrink..."]; IF Rope.Equal[IO.GetID[argStream! IO.EndOfStream => {shrinkDirectionHint _ DefaultOrientation; CONTINUE}], "hor", FALSE] THEN shrinkDirectionHint _ hor ELSE shrinkDirectionHint _ ver; [] _ IPTopOps.Shrink[top, co, shrinkDirectionHint, TRUE];}; $BrkXs =>{argStream: IO.STREAM _ IO.RIS[TIO.RequestRope["BreakCrosses: \n"]]; refCh: CTG.Channel _ top.ctg.GetChannel[argStream.GetID]; chBnd1: CTG.Channel _ top.ctg.GetChannel[argStream.GetID]; chBnd2: CTG.Channel _ top.ctg.GetChannel[argStream.GetID]; TIO.WriteRope["Breaking Crosses..."]; [] _ IPTopOps.BreakCrosses[top, refCh, chBnd1, chBnd2, TRUE];}; ENDCASE => ERROR; };--MenuHit END.