--File: IPMVEditOpsImpl.mesa
Last Edited by: CSChow, January 28, 1985 7:05:53 am PST
Preas, August 1, 1986 9:02:30 pm PDT
DIRECTORY
IO,
TerminalIO,
Rope,
Commander,
Menus,
Labels ,
IP,
IPCTG,
IPCoTab,
IPOrient,
IPToolBox,
IPBasicOps,
IPTopOps,
IPTop,
IPMVEditOps;
IPMVEditOpsImpl: CEDAR PROGRAM
IMPORTS IO, IPCoTab, IPOrient, IPToolBox, IPBasicOps, IPCTG, IPTopOps, Rope, TerminalIO
EXPORTS IPMVEditOps =
BEGIN OPEN Top: IPTop, CT: IPCoTab, CTG: IPCTG;
##Some minor details##--
DefaultBrkOtherIfX: BOOLFALSE;
DefaultOrientation: CTG.ChType ← hor;
MenuHit: PUBLIC PROC [top: Top.Ref, command: ATOM, mouse: Menus.MouseButton, shift, control: BOOL] RETURNS [reGeom, refreshFlag: BOOLTRUE] ={
SELECT command FROM
$BrkX =>{argStream: IO.STREAMIO.RIS[TerminalIO.RequestRope["BreakCross: <refCh> <ch to break>\n"]];
refCh: CTG.Channel ← top.ctg.GetChannel[argStream.GetID];
toBreakCh: CTG.Channel ← top.ctg.GetChannel[argStream.GetID];
TerminalIO.PutRope["Breaking Cross..."];
[] ← IPTopOps.BreakCross[top, refCh, toBreakCh, TRUE];};
$FomX =>{argStream: IO.STREAMIO.RIS[TerminalIO.RequestRope["FormCross: <ch1> <ch2>\n"]];
ch1: CTG.Channel ← top.ctg.GetChannel[argStream.GetID];
ch2: CTG.Channel ← top.ctg.GetChannel[argStream.GetID];
TerminalIO.PutRope["Form Cross..."];
[] ← IPTopOps.FormCross[top, ch1, ch2, TRUE];};
$RemZ =>{argStream: IO.STREAMIO.RIS[TerminalIO.RequestRope["RemoveZ: <zSpine>\n"]];
zSpine: CTG.Channel ← top.ctg.GetChannel[argStream.GetID];
TerminalIO.PutRope["Remove Z..."];
[] ← IPTopOps.RemoveZ[top, zSpine, TRUE];};
$FomZ =>{argStream: IO.STREAMIO.RIS[TerminalIO.RequestRope["FormZ: <comp1> <comp2> <zType: neg/pos>\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;
TerminalIO.PutRope["Form Z..."];
[] ← IPTopOps.FormZ[top, comp1, comp2, zType, TRUE];};
$LtoT =>{argStream: IO.STREAMIO.RIS[TerminalIO.RequestRope["LtoT: <ch> <whichEnd: neg/pos>\n"]];
ch: CTG.Channel ← top.ctg.GetChannel[argStream.GetID];
whichEnd: CTG.Side ← IF Rope.Equal[argStream.GetID, "neg", FALSE] THEN neg ELSE pos;
TerminalIO.PutRope["Changing L to T..."];
[] ← IPTopOps.LtoT[top, ch, whichEnd, TRUE];};
$TtoL =>{argStream: IO.STREAMIO.RIS[TerminalIO.RequestRope["TtoL: <comp> <ch> <lType: neg/pos>\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;
TerminalIO.PutRope["Changing T to L..."];
[] ← IPTopOps.TtoL[top, co, ch, lType, TRUE];};
$FlxKne =>{argStream: IO.STREAMIO.RIS[TerminalIO.RequestRope["FlexKnee: <leg> <floor> <whichEnd: neg/pos>\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;
TerminalIO.PutRope["Forming Knee ..."];
[] ← IPTopOps.FlexKnee[top, leg, floor, whichEnd, TRUE];};
$ExtKne =>{argStream: IO.STREAMIO.RIS[TerminalIO.RequestRope["ExtendKnee: <shin>\n"]];
shin: CTG.Channel ← top.ctg.GetChannel[argStream.GetID];
TerminalIO.PutRope["Extending Knee..."];
[] ← IPTopOps.ExtendKnee[top, shin, TRUE];};
$FlipT =>{argStream: IO.STREAMIO.RIS[TerminalIO.RequestRope["FlipT: <chToBend> <attachTo> <whichEnd: neg/pos>\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;
TerminalIO.PutRope["FlippingT..."];
[] ← IPTopOps.FlipT[top, chToBend, attachTo, whichEnd, TRUE];};
$Mrr => {argStream: IO.STREAMIO.RIS[TerminalIO.RequestRope["Mirror: <comp> <mirrorOrientation: hor/ver ← ver>\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;
TerminalIO.PutRope[Rope.Cat["Mirroring ", CT.GetName[comp], "..."]];
[] ← IPTopOps.Mirror[top, comp, mirrorOrient, TRUE];};
$Rot => {argStream: IO.STREAMIO.RIS[TerminalIO.RequestRope["Rotate: <comp> <numberOfRot: INT ← 1>\n"]];
comp: CT.Component ← top.coTab.GetComponent[argStream.GetID];
numberOfRot: INT;
numberOfRot ← IO.GetInt[argStream ! IO.EndOfStream => {numberOfRot ← 1; CONTINUE}];
TerminalIO.PutRope[Rope.Cat["Rotating ", CT.GetName[comp], "...."]];
[] ← IPTopOps.Rotate[top, comp, numberOfRot, TRUE];};
$Ornt => {argStream: IO.STREAMIO.RIS[TerminalIO.RequestRope["Orient: <comp> <opCode: [0..7]>\n"]];
comp: CT.Component ← top.coTab.GetComponent[argStream.GetID];
opCode: IP.Orientation ← IPOrient.CDIntToOrien[argStream.GetInt];
TerminalIO.PutRope[Rope.Cat["Orienting ", CT.GetName[comp], "..."]];
[] ← IPTopOps.Orient[top, comp, opCode, TRUE];};
$SetCo => {argStream: IO.STREAMIO.RIS[TerminalIO.RequestRope["SetComponent: <comp> <atX, atY: INT ← 0> <active: BOOL ← TRUE>\n"]];
comp: CT.Component ← top.coTab.GetComponent[IO.GetTokenRope[argStream, IO.IDProc].token];
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}];
TerminalIO.PutRope[Rope.Cat["Setting Componet ", CT.GetName[comp], "..."]];
[] ← IPTopOps.SetComponent[top, comp, active, [atX, atY], TRUE];
reGeom ← FALSE;
refreshFlag ← FALSE;
};
$MovCo => {argStream: IO.STREAMIO.RIS[TerminalIO.RequestRope["Move Component: <comp> <byX, byY: INT>\n"]];
comp: CT.Component ← top.coTab.GetComponent[IO.GetTokenRope[argStream, IO.IDProc].token];
byX: INT ← argStream.GetInt;
byY: INT ← argStream.GetInt;
TerminalIO.PutRope[Rope.Cat["Moving Component ", CT.GetName[comp], "..."]];
[] ← IPTopOps.MoveComponent[top, comp, [byX, byY], TRUE];
reGeom ← FALSE;
refreshFlag ← FALSE;
};
$SwapCo => {
argStream: IO.STREAMIO.RIS[TerminalIO.RequestRope["Swap Components: <comp1> <comp2>\n"]];
comp1: CT.Component ← top.coTab.GetComponent[IO.GetTokenRope[argStream, IO.IDProc].token];
comp2: CT.Component ← top.coTab.GetComponent[IO.GetTokenRope[argStream, IO.IDProc].token];
TerminalIO.PutRope[Rope.Cat["Swapping Components ", CT.GetName[comp1], " and ", CT.GetName[comp2], "..."]];
[]← IPTopOps.SwapComponents[top, comp1, comp2, TRUE];
};
$SpawnCo => {
argStream: IO.STREAMIO.RIS[TerminalIO.RequestRope["Spawn Components: <comp> <negChildName> <posChildName> <splitDirection: hor/ver ← ver> \n"]];
comp: CT.Component ← top.coTab.GetComponent[IO.GetTokenRope[argStream, IO.IDProc].token];
negChildName: Rope.ROPE ← IO.GetTokenRope[argStream, IO.IDProc].token;
posChildName: Rope.ROPE ← IO.GetTokenRope[argStream, IO.IDProc].token;
splitDirection: CTG.ChType;
splitDirection ← IF Rope.Equal[IO.GetID[argStream ! IO.EndOfStream => {splitDirection ← ver; CONTINUE}], "hor", FALSE] THEN hor ELSE ver;
TerminalIO.PutRope[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.STREAMIO.RIS[TerminalIO.RequestRope["Set Component Shape: <comp> <shape: {(x y) sw: (x1 y1), ...nw: (x4 y4)}>\n"]];
comp: CT.Component ← top.coTab.GetComponent[IO.GetTokenRope[argStream, IO.IDProc].token];
shape: IP.ShapeRep ← IPToolBox.GetShape[argStream]^;
TerminalIO.PutRope[Rope.Cat["Setting ", CT.GetName[comp], " shape..."]];
[]← IPTopOps.SetCompShape[top, comp, shape, TRUE, TRUE];
};
$ClrCnr =>{argStream: IO.STREAMIO.RIS[TerminalIO.RequestRope["ClearNegCorners: <co> <corner: [0..4] (0 = all, 1 = sw,..., nw = 4)> (<chToUse: hor/ver>)\n"]];
co: CT.Component ← top.coTab.GetComponent[IO.GetTokenRope[argStream, IO.IDProc].token];
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;
TerminalIO.PutRope[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.STREAMIO.RIS[TerminalIO.RequestRope["Grow: <coName> <chToSplit> <negBnd> <posBnd>\n"]];
coName: Rope.ROPE ← IO.GetTokenRope[argStream, IO.IDProc].token;
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];
TerminalIO.PutRope["Grow..."];
[] ← IPTopOps.Grow[top, co, chToSplit, negBnd, posBnd, TRUE];
};
$Grw1 =>{argStream: IO.STREAMIO.RIS[TerminalIO.RequestRope["Grow1: <coName> <host> <hostCorner: [1..4]>\n"]];
coName: Rope.ROPE ← IO.GetTokenRope[argStream, IO.IDProc].token;
co: CT.Component ← top.coTab.GetComponent[coName];
host: CT.Component ← top.coTab.GetComponent[IO.GetTokenRope[argStream, IO.IDProc].token];
hostCorner: CT.CornerTypes ← (SELECT argStream.GetInt FROM 1 => sw, 2 => se, 3=> ne, ENDCASE => nw);
TerminalIO.PutRope["Grow1..."];
[] ← IPTopOps.Grow1[top, co, host, hostCorner, TRUE];};
$Shr =>{argStream: IO.STREAMIO.RIS[TerminalIO.RequestRope["Shrink: <co> (<shrinkDirectionHint: hor/ver ← hor>)\n"]];
co: CT.Component ← top.coTab.GetComponent[IO.GetTokenRope[argStream, IO.IDProc].token];
shrinkDirectionHint: CTG.ChType;
TerminalIO.PutRope["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.STREAMIO.RIS[TerminalIO.RequestRope["BreakCrosses: <refCh> <chBnd1> <chBnd2>\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];
TerminalIO.PutRope["Breaking Crosses..."];
[] ← IPTopOps.BreakCrosses[top, refCh, chBnd1, chBnd2, TRUE];};
ENDCASE => ERROR;
};--MenuHit
END.