--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,
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: 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[TIO.RequestRope["BreakCross: <refCh> <ch to break>\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.STREAMIO.RIS[TIO.RequestRope["FormCross: <ch1> <ch2>\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.STREAMIO.RIS[TIO.RequestRope["RemoveZ: <zSpine>\n"]];
zSpine: CTG.Channel ← top.ctg.GetChannel[argStream.GetID];
TIO.WriteRope["Remove Z..."];
[] ← IPTopOps.RemoveZ[top, zSpine, TRUE];};
$FomZ =>{argStream: IO.STREAMIO.RIS[TIO.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;
TIO.WriteRope["Form Z..."];
[] ← IPTopOps.FormZ[top, comp1, comp2, zType, TRUE];};
$LtoT =>{argStream: IO.STREAMIO.RIS[TIO.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;
TIO.WriteRope["Changing L to T..."];
[] ← IPTopOps.LtoT[top, ch, whichEnd, TRUE];};
$TtoL =>{argStream: IO.STREAMIO.RIS[TIO.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;
TIO.WriteRope["Changing T to L..."];
[] ← IPTopOps.TtoL[top, co, ch, lType, TRUE];};
$FlxKne =>{argStream: IO.STREAMIO.RIS[TIO.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;
TIO.WriteRope["Forming Knee ..."];
[] ← IPTopOps.FlexKnee[top, leg, floor, whichEnd, TRUE];};
$ExtKne =>{argStream: IO.STREAMIO.RIS[TIO.RequestRope["ExtendKnee: <shin>\n"]];
shin: CTG.Channel ← top.ctg.GetChannel[argStream.GetID];
TIO.WriteRope["Extending Knee..."];
[] ← IPTopOps.ExtendKnee[top, shin, TRUE];};
$FlipT =>{argStream: IO.STREAMIO.RIS[TIO.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;
TIO.WriteRope["FlippingT..."];
[] ← IPTopOps.FlipT[top, chToBend, attachTo, whichEnd, TRUE];};
$Mrr => {argStream: IO.STREAMIO.RIS[TIO.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;
TIO.WriteRope[Rope.Cat["Mirroring ", CT.GetName[comp], "..."]];
[] ← IPTopOps.Mirror[top, comp, mirrorOrient, TRUE];};
$Rot => {argStream: IO.STREAMIO.RIS[TIO.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}];
TIO.WriteRope[Rope.Cat["Rotating ", CT.GetName[comp], "...."]];
[] ← IPTopOps.Rotate[top, comp, numberOfRot, TRUE];};
$Ornt => {argStream: IO.STREAMIO.RIS[TIO.RequestRope["Orient: <comp> <opCode: [0..7]>\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.STREAMIO.RIS[TIO.RequestRope["SetComponent: <comp> <atX, atY: INT ← 0> <active: BOOL ← TRUE>\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.STREAMIO.RIS[TIO.RequestRope["Move Component: <comp> <byX, byY: INT>\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.STREAMIO.RIS[TIO.RequestRope["Swap Components: <comp1> <comp2>\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.STREAMIO.RIS[TIO.RequestRope["Spawn Components: <comp> <negChildName> <posChildName> <splitDirection: hor/ver ← ver> \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.STREAMIO.RIS[TIO.RequestRope["Set Component Shape: <comp> <shape: {(x y) sw: (x1 y1), ...nw: (x4 y4)}>\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.STREAMIO.RIS[TIO.RequestRope["ClearNegCorners: <co> <corner: [0..4] (0 = all, 1 = sw,..., nw = 4)> (<chToUse: hor/ver>)\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.STREAMIO.RIS[TIO.RequestRope["Grow: <coName> <chToSplit> <negBnd> <posBnd>\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.STREAMIO.RIS[TIO.RequestRope["Grow1: <coName> <host> <hostCorner: [1..4]>\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.STREAMIO.RIS[TIO.RequestRope["Shrink: <co> (<shrinkDirectionHint: hor/ver ← hor>)\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.STREAMIO.RIS[TIO.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];
TIO.WriteRope["Breaking Crosses..."];
[] ← IPTopOps.BreakCrosses[top, refCh, chBnd1, chBnd2, TRUE];};
ENDCASE => ERROR;
};--MenuHit
END.