DIRECTORY Atom, CD, CDBasics, CDCallSpecific, CDCommandOps, CDExtras, CDSequencer, CDOrient, CDOps, CDPanel, CDProperties, CDViewer USING [DesignOf], Rope, TerminalIO, ViewerClasses USING [Viewer]; CDExtraCommands: CEDAR PROGRAM IMPORTS Atom, CD, CDCommandOps, CDBasics, CDOps, CDOrient, CDPanel, CDProperties, CDSequencer, TerminalIO, CDCallSpecific, CDExtras, CDViewer, Rope = BEGIN verbose: BOOL _ TRUE; WriteInLambda: PROC [n: CD.Number] = {TerminalIO.WriteRope[CDExtras.ToLambda[n]]}; CoordinatesCommand: PROC [comm: CDSequencer.Command] = BEGIN TerminalIO.WriteRope["Coordinates"]; TerminalIO.WriteRope[" down: ("]; WriteInLambda[comm.sPos.x]; TerminalIO.WriteRope[","]; WriteInLambda[comm.sPos.y]; TerminalIO.WriteRope[") up: ("]; WriteInLambda[comm.pos.x]; TerminalIO.WriteRope[","]; WriteInLambda[comm.pos.y]; TerminalIO.WriteRope[") dist: ("]; WriteInLambda[comm.pos.x-comm.sPos.x]; TerminalIO.WriteRope[","]; WriteInLambda[comm.pos.y-comm.sPos.y]; TerminalIO.WriteRope[")\n"]; END; WriteInfo: PROC[aptr: CD.ApplicationPtr] = BEGIN x: REF ~ CDProperties.GetPropFromApplication[aptr, $SignalName]; TerminalIO.WriteRope[" ("]; TerminalIO.WriteRope[CDOps.Info[aptr.ob]]; IF x#NIL THEN WITH x SELECT FROM r: Rope.ROPE => TerminalIO.WriteRope[Rope.Concat[" ", r]]; a: ATOM => TerminalIO.WriteRope[Rope.Concat[" ", Atom.GetPName[a]]]; ENDCASE => NULL; TerminalIO.WriteRope[")"]; END; PersonalizedApplicationRect: PROC [aptr: CD.ApplicationPtr] RETURNS [CD.DesignRect] = --should be in CDApplications INLINE BEGIN RETURN [ CDOrient.MapRect[ itemInCell: aptr.ob.p.insideRect[aptr.ob], cellSize: aptr.ob.size, cellInstOrient: aptr.orientation, cellInstPos: aptr.location ] ] END; StatisticCommand: PROC [comm: CDSequencer.Command] = BEGIN countTot: INT _ 0; countSel: INT _ 0; countInvis: INT _ 0; isDesign: BOOL _ FALSE; rect: CD.DesignRect; aptr: CD.ApplicationPtr; TerminalIO.WriteRope["Statistic"]; IF ISTYPE[comm.ref, ViewerClasses.Viewer] THEN [isDesign, , rect] _ CDViewer.DesignOf[NARROW[comm.ref]]; IF ~isDesign THEN rect _ CDBasics.universe; FOR l: CD.ApplicationList _ CDOps.AppList[comm.design], l.rest WHILE l#NIL DO countTot _ countTot+1; IF l.first.selected THEN { IF ~CDBasics.Intersect[rect, PersonalizedApplicationRect[l.first]] THEN countInvis _ countInvis+1; countSel _ countSel+1; aptr _ l.first } ENDLOOP; TerminalIO.WriteInt[countTot]; TerminalIO.WriteRope[" objects;"]; TerminalIO.WriteInt[countSel]; TerminalIO.WriteRope[" selected"]; IF countSel=1 THEN { WriteInfo[aptr]; IF verbose THEN { TerminalIO.WriteRope[" at: ("]; TerminalIO.WriteInt[aptr.location.x]; TerminalIO.WriteRope[","]; TerminalIO.WriteInt[aptr.location.y]; TerminalIO.WriteRope[") size: ("]; TerminalIO.WriteInt[aptr.ob.size.x]; TerminalIO.WriteRope[","]; TerminalIO.WriteInt[aptr.ob.size.y]; TerminalIO.WriteRope[") orientation-code:"]; TerminalIO.WriteInt[aptr.orientation]; } }; IF countInvis#0 THEN { TerminalIO.WriteRope["\n **** "]; TerminalIO.WriteInt[countInvis]; TerminalIO.WriteRope[" invisible selected objects"]; }; TerminalIO.WriteLn[]; END; SelectIfLevel: CDCallSpecific.CallProc = BEGIN IF aptr.ob.level#NARROW[x, REF CD.Level]^ THEN {done_FALSE; RETURN}; IF aptr.selected THEN RETURN; aptr.selected _ TRUE; repaintMe _ TRUE END; AddSelectLevel: PROC [comm: CDSequencer.Command] = BEGIN n: INT; reflev: REF CD.Level _ NEW[CD.Level_CDPanel.FetchDefaultLevel[comm.design]]; TerminalIO.WriteRope["Select all of current layer: ("]; n _ CDCallSpecific.CallForAll[design: comm.design, whatElse: SelectIfLevel, x: reflev]; TerminalIO.WriteInt[n]; TerminalIO.WriteRope[") objects\n"]; END; SpecifyAlter: PROC [] RETURNS [code: ATOM_NIL, x: REF_NIL] = BEGIN step: CD.DesignNumber = CD.lambda; SELECT TerminalIO.RequestSelection["alter", LIST["dec w", "dec l", "inc w", "inc l", "dec par", "inc par"]] FROM 1 => {code _ $ChangeExt; x _ NEW[CD.DesignPosition_[-step, 0]]}; 2 => {code _ $ChangeExt; x _ NEW[CD.DesignPosition_[0, -step]]}; 3 => {code _ $ChangeExt; x _ NEW[CD.DesignPosition_[step, 0]]}; 4 => {code _ $ChangeExt; x _ NEW[CD.DesignPosition_[0, step]]}; 5 => {code _ $ChangeParam; x _ NEW[CD.DesignNumber_-step]}; 6 => {code _ $ChangeParam; x _ NEW[CD.DesignNumber_step]}; ENDCASE => {code _ NIL} END; AlterPointed: PROC [comm: CDSequencer.Command] = BEGIN code: ATOM; x: REF; n: CARDINAL; TerminalIO.WriteRope["alter pointed: "]; [code, x] _ SpecifyAlter[]; n _ CDCallSpecific.CallForPointed[design: comm.design, point: comm.pos, objectSpecific: code, x: x]; TerminalIO.WriteInt[n]; TerminalIO.WriteRope[" objects altered\n"]; END; AlterSelected: PROC [comm: CDSequencer.Command] = BEGIN code: ATOM; x: REF; n: CARDINAL; TerminalIO.WriteRope["alter selected: "]; [code, x] _ SpecifyAlter[]; n _ CDCallSpecific.CallForSelected[design: comm.design, objectSpecific: code, x: x]; TerminalIO.WriteInt[n]; TerminalIO.WriteRope[" objects altered\n"]; END; LevelName: PROC [lev: CD.Level] RETURNS [Rope.ROPE] = BEGIN RETURN[Atom.GetPName[CD.LevelKey[lev]]]; END; SetLayerCommand: PROC [comm: CDSequencer.Command] = BEGIN app: CD.ApplicationPtr = CDCommandOps.TheApplication[comm, "Set default layer"]; IF app#NIL THEN { layer: CD.Level = app.ob.level; IF app.ob.p.wireTyped AND CDProperties.GetPropFromLevel[layer, $DontUse]=NIL THEN { TerminalIO.WriteRope[Rope.Cat[" ", LevelName[layer], "\n"]]; CDPanel.StoreDefaultLevel[comm.design, layer]; } ELSE TerminalIO.WriteRope[" NOT DONE\n"]; CDOps.ReOrderApplication[comm.design, app] } END; EnforcePanel: PROC [comm: CDSequencer.Command] = BEGIN TerminalIO.WriteRope["Enforce a control panel\n"]; [] _ CDPanel.CreatePanel[comm.design] END; CDSequencer.ImplementCommand[$SetLayerP, SetLayerCommand,, doQueue]; CDSequencer.ImplementCommand[$AddSelectLevel, AddSelectLevel,, doQueue]; CDSequencer.ImplementCommand[$Coordinates, CoordinatesCommand,, doQueue]; CDSequencer.ImplementCommand[$Statistic, StatisticCommand,, doQueue]; CDSequencer.ImplementCommand[$AlterP, AlterPointed]; CDSequencer.ImplementCommand[$AlterS, AlterSelected]; CDSequencer.ImplementCommand[$EnforcePanel, EnforcePanel,, doQueue]; CDCommandOps.ImplementSpecificCommand[specificAtom: $Expand, useFor: "SPFXA"]; CDCommandOps.ImplementSpecificCommand[specificAtom: $Lengthen, tipBase: "Widen", useFor: "SPFXA", x: NEW[CD.DesignPosition_[CD.lambda, 0]]]; CDCommandOps.ImplementSpecificCommand[specificAtom: $Lengthen, tipBase: "Narrow", useFor: "SPFXA", x: NEW[CD.DesignPosition_[-CD.lambda, 0]]]; CDCommandOps.ImplementSpecificCommand[specificAtom: $Lengthen, tipBase: "Shorten", useFor: "SPFXA", x: NEW[CD.DesignPosition_[0, -CD.lambda]]]; CDCommandOps.ImplementSpecificCommand[specificAtom: $Lengthen, tipBase: "Lengthen", useFor: "SPFXA", x: NEW[CD.DesignPosition_[0, CD.lambda]]]; CDCommandOps.ImplementSpecificCommand[specificAtom: $Default, useFor: "SPFXA"]; CDCommandOps.ImplementSpecificCommand[specificAtom: $IncCount, text: "Inc count", useFor: "SPFXA"]; CDCommandOps.ImplementSpecificCommand[specificAtom: $DecCount, text: "Dec count", useFor: "SPFXA"]; END. ðCDExtraCommands.mesa (part of Chipndale) Copyright c 1983, 1984 by Xerox Corporation. All rights reserved. by Christian Jacobi July 11, 1983 3:42 pm last edited Christian Jacobi February 14, 1984 4:05 pm -- copied from CDOps Êo˜šœ*™*Jšœ Ïmœ7™BJšœ,™,Jšœ8™8J˜—šÏk ˜ Jšœ˜Jšžœ˜Jšœ ˜ J˜Jšœ ˜ Jšœ ˜ J˜ Jšœ ˜ Jšœ˜Jšœ ˜ Jšœ ˜ Jšœ žœ ˜Jšœ˜J˜ Jšœžœ ˜J˜—šÏnœžœž˜Jšžœ˜–—Jšž˜J˜Jšœ žœžœ˜J˜šŸ œžœžœ8˜RJ˜—šŸœžœ˜6Jšž˜J˜$J˜#Jšœ˜J˜Jšœ˜J˜"Jšœ˜J˜Jšœ˜J˜$Jšœ&˜&J˜Jšœ&˜&J˜Jšžœ˜J˜—šŸ œžœžœ˜*Jšœ™Jšž˜Jšœžœ:˜@Jšœ˜Jšœ*˜*šžœžœž˜ šžœžœž˜Jšœžœ/˜;Jšœžœ>˜EJšžœžœ˜——Jšœ˜Jšžœ˜—J˜š Ÿœžœžœžœžœ˜UJšÏc˜Jšžœž˜ šžœ˜šœ˜Jšœ*˜*Jšœ˜Jšœ!˜!Jšœ˜J˜—J˜—Jšžœ˜J˜—šŸœžœ˜4Jšž˜Jšœ žœ˜Jšœ žœ˜Jšœ žœ˜Jšœ žœžœ˜Jšœžœ ˜Jšœžœ˜Jšœ"˜"šžœžœ!ž˜.Jšœ'žœ ˜9—Jšžœ žœ˜+š žœžœ6žœžœž˜MJšœ˜šžœžœ˜JšžœAžœ˜bJšœ˜Jšœ˜Jšœ˜—Jšžœ˜—JšœB˜BJšœB˜Bšžœ žœ˜Jšœ˜šžœ žœ˜J˜Jšœ%˜%J˜Jšœ%˜%J˜#Jšœ$˜$J˜Jšœ$˜$J˜-Jšœ&˜&J˜—Jšœ˜—šžœžœ˜JšœC˜CJšœ5˜5J˜—Jšœ˜Jšžœ˜J˜—šŸ œ˜(Jšž˜Jšžœžœžœžœ žœžœžœ˜DJšžœžœžœ˜Jšœžœ˜Jšœ ž˜Jšžœ˜J˜—šŸœžœ˜2Jšž˜Jšœžœ˜Jš œžœžœ žœžœ/˜LJ˜7J˜WJ˜J˜$Jšžœ˜—J˜š Ÿ œžœžœžœžœ˜