<<>> <> <> <> <> <> <> <<>> DIRECTORY Args, Commander, FileNames, IO, IOTioga, Rope, TiogaAccessViewers, TiogaMenuOps, ViewerClasses; MakeButtonsImpl: CEDAR PROGRAM IMPORTS Args, Commander, FileNames, IO, IOTioga, TiogaAccessViewers, TiogaMenuOps EXPORTS = BEGIN ROPE: TYPE = Rope.ROPE; STREAM: TYPE = IO.STREAM; Viewer: TYPE = ViewerClasses.Viewer; ButtonToolsCommand: Commander.CommandProc = { <> packageName: ROPE; viewer: Viewer; stream: STREAM ~ IOTioga.CreateTiogaAccessStream[]; FOR i: NAT IN [0..Args.NArgs[cmd]) DO packageName ¬ Args.GetRope[cmd, i]; MakeToolsButtons[packageName, stream]; ENDLOOP; viewer ¬ TiogaMenuOps.New[left]; TiogaAccessViewers.WriteViewer[IOTioga.WriterFromStream[stream], viewer]; }; boxPostfixRope: ROPE = "1.0 outlineBoxBearoff 1.0 outlineBoxThickness"; MakeToolsButtons: PROC [packageName: ROPE, f: IO.STREAM] = { oldProps, newProps: IOTioga.PropList; wDir: ROPE ¬ FileNames.CurrentWorkingDirectory[]; [] ¬ IOTioga.Break[f]; IOTioga.SetFormat[f, IOTioga.FormatFromRope["block"]]; f.PutF1["%g: ", [rope[packageName]] ]; oldProps ¬ IOTioga.GetCharProps[f]; newProps ¬ oldProps; newProps ¬ IOTioga.PropPut[newProps, $ButtonData, BringOverRope[packageName, wDir]]; newProps ¬ IOTioga.PropPut[newProps, $Postfix, boxPostfixRope]; IOTioga.SetCharProps[f, newProps]; f.PutRope["BringOver"]; IOTioga.SetCharProps[f, oldProps]; f.PutRope[" "]; newProps ¬ oldProps; newProps ¬ IOTioga.PropPut[newProps, $ButtonData, SModelRope[packageName, wDir]]; newProps ¬ IOTioga.PropPut[newProps, $Postfix, boxPostfixRope]; IOTioga.SetCharProps[f, newProps]; f.PutRope["SModel"]; IOTioga.SetCharProps[f, oldProps]; f.PutRope[" "]; newProps ¬ oldProps; newProps ¬ IOTioga.PropPut[newProps, $ButtonData, OpenDFRope[packageName, wDir]]; newProps ¬ IOTioga.PropPut[newProps, $Postfix, boxPostfixRope]; IOTioga.SetCharProps[f, newProps]; f.PutRope["OpenDF"]; IOTioga.SetCharProps[f, oldProps]; f.PutRope[" "]; newProps ¬ oldProps; newProps ¬ IOTioga.PropPut[newProps, $ButtonData, MakeDoRope[packageName, wDir]]; newProps ¬ IOTioga.PropPut[newProps, $Postfix, boxPostfixRope]; IOTioga.SetCharProps[f, newProps]; IOTioga.SetLooks[f, IOTioga.LooksFromRope["y"]]; f.PutRope["MakeDo"]; IOTioga.SetCharProps[f, oldProps]; IOTioga.ClearLooks[f]; f.PutRope[" "]; [] ¬ IOTioga.Break[f]; }; BringOverRope: PROC [packageName, wDir: ROPE] RETURNS [buttonData: ROPE] = { ros: IO.STREAM ¬ StandardBeginning[]; ros.PutFL[" ((\"CD %g; QBO /Cedar/Top/%g.df\") \"QBO \" \"Brings over %g.df into %g\")\n", LIST[[rope[wDir]], [rope[packageName]], [rope[packageName]], [rope[wDir]]] ]; <> <> buttonData ¬ StandardEnding[ros]; }; MakeDoRope: PROC [packageName, wDir: ROPE] RETURNS [buttonData: ROPE] = { ros: IO.STREAM ¬ StandardBeginning[]; ros.PutF[" ((\"CD %g; MakeDo4 %g\") \"MakeDo sun4\" \"MakeDo4 %g\")\n", [rope[wDir]], [rope[packageName]], [rope[packageName]] ]; ros.PutFL[" ((\"CD %g; MakeDo4 %g; MakeDo -df %g-sun4O3.df\") \"MakeDo sun4 and sun4-o3\" \"MakeDo4 %g; MakeDo -df %g-sun4O3.df\")\n", LIST[[rope[wDir]], [rope[packageName]], [rope[packageName]], [rope[packageName]],[rope[packageName]]]]; ros.PutF[" ((\"CD %g; MakeDo -df %g-sun4O3.df\") \"MakeDo sun4-o3\" \"MakeDo -df %g-sun4O3.df\")\n", [rope[wDir]], [rope[packageName]], [rope[packageName]] ]; buttonData ¬ StandardEnding[ros]; }; SModelRope: PROC [packageName, wDir: ROPE] RETURNS [buttonData: ROPE] = { ros: IO.STREAM ¬ StandardBeginning[]; ros.PutF[" ((\"CD %g; SModel %g-Suite.df\") \"SModel -Suite\" \"SModel %g-Suite.df\")\n", [rope[wDir]], [rope[packageName]], [rope[packageName]] ]; ros.PutFL[" ((\"CD %g; SModel %g-Suite.df; SModel %g-sun4O3.df\") \"SModel -Suite and -sun4O3\" \"SModel %g-Suite.df and -sun4O3.df\")\n", LIST[[rope[wDir]], [rope[packageName]], [rope[packageName]], [rope[packageName]]] ]; ros.PutF[" ((\"CD %g; SModel %g-sun4O3.df\") \"SModel -sun4O3\" \"SModel %g-sun4O3.df\")\n", [rope[wDir]], [rope[packageName]], [rope[packageName]] ]; buttonData ¬ StandardEnding[ros]; }; OpenDFRope: PROC [packageName, wDir: ROPE] RETURNS [buttonData: ROPE] = { ros: IO.STREAM ¬ StandardBeginning[]; ros.PutF[" ((\"CD %g; ButtonOpen %g-Suite.df\") \"ButtonOpen -Suite\" \"ButtonOpen %g-Suite.df\")\n", [rope[wDir]], [rope[packageName]], [rope[packageName]] ]; ros.PutF[" ((\"CD %g; ButtonOpen %g-Source.df\") \"ButtonOpen -Source Only\" \"ButtonOpen %g-Source.df\")\n", [rope[wDir]], [rope[packageName]], [rope[packageName]] ]; ros.PutF[" ((\"CD %g; ButtonOpen %g-PCR.df\") \"ButtonOpen -PCR Only\" \"ButtonOpen %g-PCR.df\")\n", [rope[wDir]], [rope[packageName]], [rope[packageName]] ]; buttonData ¬ StandardEnding[ros]; }; StandardBeginning: PROC [] RETURNS [ros: IO.STREAM] = { ros ¬ IO.ROS[]; ros.PutRope["Poppy1\n"]; ros.PutRope["Class: PopUpButton\n"]; ros.PutRope["Menu: (\n"]; }; StandardEnding: PROC [ros: IO.STREAM] RETURNS [buttonData: ROPE] = { ros.PutRope[" )\n"]; ros.PutRope["MessageHandler: CommandTool\n"]; ros.PutRope["Feedback: (\n"]; ros.PutRope[" (MouseMoved )\n"]; ros.PutRope[" (Down (BeginButton 1 ApplyLook EndButton))\n"]; ros.PutRope[" ((Done OK) (BeginButton 1 RemoveLook 21 RemoveLook EndButton))\n"]; ros.PutRope[" ((Done Error) (BeginButton 21 ApplyLook EndButton))\n"]; ros.PutRope[" )"]; buttonData ¬ IO.RopeFromROS[ros]; }; Commander.Register["ButtonTools", ButtonToolsCommand, "ButtonTools \n Creates a file containing buttons that bringover, makedo, verify, and smodel the named package"]; END.