Init:
PROCEDURE [f: Rope.
ROPE, wd: Rope.
ROPE ←
NIL] = {
Rule:
PROC [wx, wy, ww, wh:
INTEGER] ~ {
[] ← Rules.Create[info: [wx: wx, wy: wy, ww: ww, wh: wh, parent: s.container]];
};
Button:
PROC [name: Rope.
ROPE, wx, wy:
INTEGER, proc: Buttons.ButtonProc, clientData:
REF] ~ {
[] ← Buttons.Create[info: [name: name, wx: wx, wy: wy, parent: s.container], proc: proc, clientData: clientData];
};
SelectButton:
PROC [name: Rope.
ROPE, wx, wy:
INTEGER, v: ViewerClasses.Viewer] ~ {
[] ← Buttons.Create[info: [name: name, wx: wx, wy: wy, parent: s.container], proc: Select, clientData: LIST[s, v]];
};
SelectViewer:
PROC [wx, wy, ww, wh:
INTEGER, data: Rope.
ROPE ←
NIL]
RETURNS [ViewerClasses.Viewer] ~ {
RETURN [ViewerTools.MakeNewTextViewer[info: [wx: wx, wy: wy, ww: ww, wh: wh, parent: s.container, data: data, border: FALSE, scrollable: TRUE]]]
};
s: AISCopy.State ← NEW[AISCopy.StateRec];
s.container ← ViewerOps.CreateViewer[flavor: $Container, info: [name: "Copy", scrollable: FALSE, icon: icon]];
-- Divide image from controls
Rule[wx: 0, wy: 112, ww: 1000, wh: 2];
-- Divide Input parameters from Output parameters
Rule[wx: 255, wy: 22, ww: 2, wh: 68];
-- Divide Output parameters from Command buttons
Rule[wx: 505, wy: 22, ww: 2, wh: 68];
-- Divide parameters from feedback
Rule[wx: 0, wy: 90, ww: 1000, wh: 2];
-- Divide working directory from parameters
Rule[wx: 0, wy: 22, ww: 1000, wh: 2];
-- Image viewer
s.AISViewer ← ViewerOps.CreateViewer[flavor: $AISCopy, info: [name: "AIS file", wx: 0, wy: 114, ww: 0, wh: 0, parent: s.container, data: s]];
Containers.ChildYBound[s.container, s.AISViewer];
Containers.ChildXBound[s.container, s.AISViewer];
-- working directory button
IF wd.IsEmpty
AND
NOT f.IsEmpty
THEN {
fullFName: Rope.ROPE;
cp: FS.ComponentPositions;
[fullFName, cp] ← FS.ExpandName[f];
wd ← Rope.Substr[fullFName, 0, cp.base.start];
f ← Rope.Substr[fullFName, cp.base.start, cp.ver.start+cp.ver.length];
};
s.wdViewer ← ViewerTools.MakeNewTextViewer[info: [wx: 53, wy: 3, ww: 544, wh: 15, parent: s.container, border: FALSE, scrollable: TRUE, data: wd]];
Button[name: "WD: ", wx: 10, wy: 3, proc: SelectWD, clientData: s.wdViewer];
-- Input controls
s.inFnViewer ← SelectViewer[wx: 112, wy: 32, ww: 130, wh: 15];
SelectButton[name: "Input Filename: ", wx: 10, wy: 32, v: s.inFnViewer];
s.topViewer ← SelectViewer[wx: 42, wy: 52, ww: 50, wh: 15, data: "0"];
SelectButton[name: "Top:", wx: 10, wy: 52, v: s.topViewer];
s.leftViewer ← SelectViewer[wx: 42, wy: 72, ww: 50, wh: 15, data: "0"];
SelectButton[name: "Left:", wx: 10, wy: 72, v: s.leftViewer];
s.heightViewer ← SelectViewer[wx: 135, wy: 52, ww: 50, wh: 15, data: "2048"];
SelectButton[name: "Scans:", wx: 94, wy: 52, v: s.heightViewer];
s.widthViewer ← SelectViewer[wx: 135, wy: 72, ww: 50, wh: 15, data: "2048"];
SelectButton[name: "Pixels:", wx: 94, wy: 72, v: s.widthViewer];
Button[name: "PEEK", wx: 205, wy: 52, proc: Peek, clientData: s];
s.emptyViewer ← SelectViewer[wx: 201, wy: 72, ww: 54, wh: 15, data: "0"];
SelectButton[name: "e:", wx: 185, wy: 72, v: s.emptyViewer];
-- Output parameters
s.outFnViewer ← SelectViewer[wx: 371, wy: 32, ww: 130, wh: 15];
SelectButton[name: "Output Filename: ", wx: 260, wy: 32, v: s.outFnViewer];
s.oScansViewer ← SelectViewer[wx: 302, wy: 52, ww: 50, wh: 15, data: "2048"];
SelectButton[name: "Scans:", wx: 260, wy: 52, v: s.oScansViewer];
s.oPixelsViewer ← SelectViewer[wx: 302, wy: 72, ww: 50, wh: 15, data: "2048"];
SelectButton[name: "Pixels:", wx: 260, wy: 72, v: s.oPixelsViewer];
s.oScaleS ← SelectViewer[wx: 400, wy: 52, ww: 50, wh: 15, data: "1.0"];
SelectButton[name: "Scale:", wx: 360, wy: 52, v: s.oScaleS];
s.oScaleP ← SelectViewer[wx: 400, wy: 72, ww: 50, wh: 15, data: "1.0"];
SelectButton[name: "Scale:", wx: 360, wy: 72, v: s.oScaleP];
-- Command buttons
Button[name: "GO", wx: 520, wy: 32, proc: Go, clientData: s];
Button[name: "ABORT", wx: 520, wy: 52, proc: Abort, clientData: s];
-- Feedback instruments
s.logViewer ← ViewerOps.CreateViewer[flavor: $TypeScript, info: [wx: 30, wy: 94, ww: 560, wh: 15, parent: s.container]];
[ , s.out] ← ViewerIO.CreateViewerStreams[viewer: s.logViewer, name: NIL];
s.pie ← PieViewers.Create[parent: s.container, x: 10, y: 94];
IF f#
NIL
THEN {
ViewerTools.SetContents[s.inFnViewer, f];
Show[s];
};
};
Commander.Register[key: "AISCopy", proc: StartNewCopyProcess, doc: "AIS copying program"];