<> <> DIRECTORY Buttons USING [ButtonProc], Containers USING [ChildXBound, Create], DFOperations USING [SModelAction], DFOperationsQueue USING [Enqueue, RequestRecord], DFToolInternal USING [ AddOpToTable, CreateSelector, DFTool, EnsureDFName, MakeCenteredLabel, offScreenY, OpDefiner, Operation, OpsInteraction, OpSpecificProc, OptionSelector, SelectOption, ViewerToRopeList], Rope USING [Concat, ROPE], ViewerClasses USING [Viewer], ViewerOps USING [MoveViewer], ViewerTools USING [GetContents]; SModelToolImpl: CEDAR PROGRAM IMPORTS Containers, DFOperationsQueue, DFToolInternal, Rope, ViewerOps, ViewerTools = BEGIN OPEN Ops: DFOperations, OpsQ: DFOperationsQueue, Tool: DFToolInternal; ROPE: TYPE = Rope.ROPE; <<>> ---- ---- ---- ---- ---- ---- ---- ---- <> ---- ---- ---- ---- ---- ---- ---- ---- SModelData: TYPE = RECORD [ action: Ops.SModelAction _ [], checkOptionSelector: REF Tool.OptionSelector _ NIL, storeOptionSelector: REF Tool.OptionSelector _ NIL ]; SModelSpecific: Tool.OpSpecificProc = { SELECT action FROM $createOptions => { op: Tool.Operation = NARROW[param]; tool: Tool.DFTool = op.tool; x: INTEGER; data: REF SModelData = NEW[SModelData _ []]; op.options _ data; op.optionsContainer _ Containers.Create[info: [ wx: 0, wy: Tool.offScreenY, ww: 9999, -- arbitrary; Containers.ChildXBound overrides wh: 0, parent: tool.inner, border: FALSE, scrollable: FALSE ]]; Containers.ChildXBound[tool.inner, op.optionsContainer]; Tool.MakeCenteredLabel[op, op.definer.opAlias.Concat[" Options"]]; [data.checkOptionSelector, x] _ Tool.CreateSelector[ name: "Check existence on server", proc: SelectSModelCheckOption, clientData: data, choices: LIST[ ["yes", NEW[BOOL _ TRUE]], ["no", NEW[BOOL _ FALSE]] ], op: op ]; [data.storeOptionSelector, x] _ Tool.CreateSelector[ name: "Store changed files", proc: SelectSModelStoreOption, clientData: data, choices: LIST[ ["yes", NEW[BOOL _ TRUE]], ["no", NEW[BOOL _ FALSE]] ], op: op, x: x + tool.parameters.entryHSpace ]; op.height _ op.height + tool.parameters.entryHeight + tool.parameters.entryVSpace; ViewerOps.MoveViewer[ viewer: op.optionsContainer, x: op.optionsContainer.wx, y: op.optionsContainer.wy, w: op.optionsContainer.ww, h: op.height, paint: FALSE ]; }; $doOp => { op: Tool.Operation = NARROW[param]; tool: Tool.DFTool = op.tool; wDir: ROPE = ViewerTools.GetContents[tool.wDir]; data: REF SModelData = NARROW[op.options]; FOR list: LIST OF ROPE _ Tool.ViewerToRopeList[tool.dfNames], list.rest UNTIL list = NIL DO tool.opsQueue.Enqueue[NEW[OpsQ.RequestRecord _ [ dfFile: Tool.EnsureDFName[list.first], wDir: wDir, interact: Tool.OpsInteraction, log: tool.log, clientData: tool, opSpecific: sModel[action: data.action] ]]]; ENDLOOP; }; ENDCASE; }; SelectSModelCheckOption: Buttons.ButtonProc = { <> data: REF SModelData = NARROW[clientData]; data.action.remoteCheck _ NARROW[Tool.SelectOption[data.checkOptionSelector].value, REF BOOL]^; }; SelectSModelStoreOption: Buttons.ButtonProc = { <> data: REF SModelData = NARROW[clientData]; data.action.storeChanged _ NARROW[Tool.SelectOption[data.storeOptionSelector].value, REF BOOL]^; }; ---- ---- ---- ---- ---- ---- ---- ---- <> ---- ---- ---- ---- ---- ---- ---- ---- Tool.AddOpToTable[NEW[Tool.OpDefiner _ ["SModel", $individual, SModelSpecific]]]; END.