DIRECTORY Buttons USING [ButtonProc], Containers USING [ChildXBound, Create], DFOperations USING [SModelAction], DFOperationsQueue USING [Enqueue, RequestRecord], DFToolInternal USING [AddOpToTable, Choice, CreateSelector, DFTool, EnsureDFName, MakeCenteredLabel, offScreenY, OpDefiner, Operation, OpsInteraction, OpSpecificProc, OptionSelector, SelectOption, ViewerToRopeList], FileViewerOps USING [WaitUntilSaved], Rope USING [Concat, ROPE], ViewerClasses USING [Viewer], ViewerOps USING [MoveViewer], ViewerTools USING [GetContents]; SModelToolImpl: CEDAR PROGRAM IMPORTS Containers, DFOperationsQueue, DFToolInternal, FileViewerOps, 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 _ []]; initialChoice: Tool.Choice; 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, initialChoice, 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.action.remoteCheck _ NARROW[initialChoice.value, REF BOOL]^; [data.storeOptionSelector, initialChoice, 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 ]; data.action.storeChanged _ NARROW[initialChoice.value, REF BOOL]^; 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 short, long: ROPE; [short, long] _ Tool.EnsureDFName[list.first, wDir]; FileViewerOps.WaitUntilSaved[long, tool.feedback]; tool.opsQueue.Enqueue[NEW[OpsQ.RequestRecord _ [ dfFile: short, wDir: wDir, interact: Tool.OpsInteraction, log: tool.log, clientData: op, 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", $sModel, $individual, SModelSpecific]]]; END. DSModelToolImpl.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. last edited by Levin on December 16, 1983 2:30 pm Doug Wyatt, March 6, 1985 12:56:57 pm PST Spreitzer, May 20, 1985 5:52:12 pm PDT -- ---- ---- ---- ---- ---- ---- ---- SModel-specific Code -- ---- ---- ---- ---- ---- ---- ---- Note: runs synchronously with Viewers' notifier to ensure atomicity with $doOp logic. Note: runs synchronously with Viewers' notifier to ensure atomicity with $doOp logic. -- ---- ---- ---- ---- ---- ---- ---- Initialization -- ---- ---- ---- ---- ---- ---- ---- Κ9˜codešœ™Kšœ Οmœ1™