PressScreenToolImpl.mesa
Tool to make AIS/press file of display
Last Edited by: Plass, April 25, 1985 11:51:04 am PST
Last Edited by: Beach, May 7, 1984 4:39:28 pm PDT
Spreitzer, February 4, 1986 1:48:24 pm PST
DIRECTORY
Buttons,
Carets,
ChoiceButtons,
Commander,
Containers,
Convert,
Imager,
ImagerBackdoor,
ImagerTerminal,
InterminalBackdoor,
IO,
Labels,
LFBoundingBox,
Menus,
MessageWindow,
PieViewers,
PressScreen,
Process,
Real,
Rope,
Rules,
RuntimeError,
SirPress,
ViewerClasses,
ViewerOps,
ViewerSpecs,
ViewerTools;
PressScreenToolImpl: CEDAR MONITOR
IMPORTS Buttons, ChoiceButtons, Commander, Containers, Convert, Imager, ImagerBackdoor, ImagerTerminal, InterminalBackdoor, IO, Labels, LFBoundingBox, Menus, MessageWindow, PieViewers, PressScreen, Process, Real, Rope, Rules, RuntimeError, ViewerSpecs, ViewerOps, ViewerTools
EXPORTS PressScreen = {
OPEN PressScreen;
ROPE: TYPE = Rope.ROPE;
ScreenArea: TYPE = {leftColumn, rightColumn, wholeScreen, desiredArea};
indent: INTEGER ~ 4;
baseline: INTEGER ~ 16;
NewPressScreenTool: PUBLIC PROCEDURE [serverName: ROPE] RETURNS[psTool: PressScreenTool] = {
Creates a PressScreen tool viewer.
ENABLE UNWIND => NULL;
viewer: ViewerClasses.Viewer ←
ViewerOps.CreateViewer[
flavor: $PressScreen,
info: [
name: IF serverName.Length = 0 THEN "PressScreen" ELSE Rope.Concat["PressScreen to ", serverName],
column: right,
scrollable: FALSE
],
paint: TRUE
];
psTool ← NARROW[ViewerOps.FetchProp[viewer, $PressScreenData]];
};
InitPressScreenViewer: ViewerClasses.InitProc = {
The only way this proc is called is to init a new $PressScreen viewer.
There is no reset menu entry posted.
psTool: PressScreenTool ← NEW[PressScreenToolRec];
nextX: INTEGER;
curY: INTEGER ← indent/2;
NextY: PROCEDURE RETURNS [y:NAT] = {y ← curY ← curY+baseline};
button: ViewerClasses.Viewer;
menu: Menus.Menu ← Menus.CreateMenu[];
InsertMenu: PROCEDURE [name: ROPE, proc: Menus.ClickProc, doc: ROPE] = {
Menus.InsertMenuEntry[menu, Menus.CreateEntry[
name: name,
proc: proc,
clientData: psTool,
documentation: doc
]];
};
LabelledTextViewer: PROCEDURE [name: ROPE] RETURNS [v: ViewerClasses.Viewer] = {
v ← ViewerTools.MakeNewTextViewer[
info:[wx: button.wx+button.ww, wy: curY, ww: 50, wh: button.wh,
parent: self, scrollable: FALSE, border: TRUE],
paint: TRUE
];
button ← Labels.Create[
info: [name: name, wx: v.wx + v.ww, wy: curY+1, wh: button.wh, parent: self, scrollable: FALSE, border: FALSE],
paint: TRUE
];
};
MyButton: PROCEDURE [name: ROPE, proc: Buttons.ButtonProc, doc: ROPE] RETURNS [Buttons.Button] = {
RETURN [Buttons.Create[
info: [name: name, wx: indent, wy: NextY[], parent: self, border: FALSE],
clientData: psTool,
proc: proc,
fork: TRUE,
paint: TRUE,
documentation: doc
]]};
triggerName: ROPE ← Rope.Concat["PS", GenSym[]];
ViewerOps.AddProp[self, $PressScreenData, psTool];
psTool.tool ← self;
containerInitProc[self]; -- since I know its really a $Container, I need to init it for him
[] ← Buttons.Create[info: [name: triggerName], proc: PSButton, clientData: psTool, documentation: "Convert the identified area of the screen image into an AIS/Press file"];
Create the PressScreen menu
InsertMenu["SaveState", SaveStateButton,
"Saves the state of the PressScreen tool."];
InsertMenu["GetSelectedViewer", GetSelectedViewerButton,
"Gets the corners of the selected viewer for PressScreening."];
InsertMenu["FlashImage", FlashImageButton,
"Flashes the identified area of the screen image."];
InsertMenu["SetCorners", SetCornersButton,
"Permits designation of a rectangular screen area"];
InsertMenu["DoIt", DoItButton,
"Convert the identified area of the screen image into an AIS/Press file"];
ViewerOps.SetMenu[self, menu];
OutputStyle: AIS/Press file Interpress file Stuff into Tioga
psTool.outputStyleChoice ← ChoiceButtons.BuildEnumTypeSelection[
viewer: self,
x: indent,
y: curY,
title: "Output Style:",
buttonNames: LIST["AIS/Press file", "Interpress file", "Stuff into Tioga"],
default: "AIS/Press file",
style: menuSelection];
Screen Area: DesiredArea WholeScreen LeftColumn RightColumn
psTool.screenAreaChoice ← ChoiceButtons.BuildEnumTypeSelection[
viewer: self,
x: indent,
y: NextY[],
title: "Screen Area:",
buttonNames: CONS["DesiredArea", CONS["WholeScreen", CONS["LeftColumn", CONS["RightColumn", NIL]]]],
default: "WholeScreen",
style: menuSelection];
Area Corners: #### x #### y #### x #### y
button ← MyButton["Area Corners: ", AreaCornersButton, "Set the corners of the identified area of the screen"];
psTool.ulx ← LabelledTextViewer["x "];
psTool.uly ← LabelledTextViewer["y "];
psTool.lrx ← LabelledTextViewer["x "];
psTool.lry ← LabelledTextViewer["y"];
Magnification: FullPage HalfPage UseFactorBelow
psTool.magnificationChoice ← ChoiceButtons.BuildEnumTypeSelection[
viewer: self,
x: indent,
y: NextY[],
title: "Magnification:",
buttonNames: CONS["FullPage", CONS["HalfPage", CONS["UseFactorBelow", NIL]]],
default: "FullPage",
style: menuSelection];
MagnificationFactor: xxxx %
button ← MyButton["MagnificationFactor: ", MagnificationFactorButton, "Set the magnification factor"];
psTool.magnificationViewer ← LabelledTextViewer["%"];
Page Format: Landscape Portrait
psTool.formatViewer ← ChoiceButtons.BuildEnumTypeSelection[
viewer: self,
x: indent,
y: NextY[],
title: "Page Format:",
buttonNames: CONS["Portrait", CONS["Landscape", NIL]],
default: "Portrait",
style: menuSelection];
BlackBorder: xxxx pixels
button ← MyButton["BlackBorder: ", BlackBorderButton, "Set the black border width surrounding the identified image area."];
psTool.borderViewer ← LabelledTextViewer["pixels"];
PageMargin: xxxx inches
button ← MyButton["PageMargin: ", PageMarginButton, "Set the white space provided around the page"];
psTool.pageMarginViewer ← LabelledTextViewer["inches"];
CountDownTimer: xxxx seconds
button ← MyButton["CountDownTimer: ", CountDownTimerButton, "Set the time before the screen is copied"];
psTool.countDownTimerViewer ← LabelledTextViewer["seconds "];
psTool.countDownPieViewer ← PieViewers.Create[parent: self, x: button.wx+button.ww, y: curY];
Viewer Controls: LockViewers DisplayCursor DisplayCarets
button ← Labels.Create[
info: [name: "Viewer Controls: ", wx: indent, wy: NextY[]+1, wh: button.wh, parent: self, scrollable: FALSE, border: FALSE],
paint: TRUE
];
[psTool.lockViewersTriState, nextX] ← ChoiceButtons.BuildTriStateButton[
viewer: self,
x: button.wx+button.ww,
y: curY,
name: "LockViewers"];
[psTool.displayCursorTriState, nextX] ← ChoiceButtons.BuildTriStateButton[
viewer: self,
x: nextX,
y: curY,
name: "DisplayCursor"];
[psTool.displayCaretsTriState, nextX] ← ChoiceButtons.BuildTriStateButton[
viewer: self,
x: nextX,
y: curY,
name: "DisplayCarets"];
Rule between buttons and log viewer
Containers.ChildXBound[self, Rules.Create[info: [wx: 0, wy: NextY[], wh: 1, parent: self]]];
Create log viewer for file completion messages
psTool.logViewer ← ViewerTools.MakeNewTextViewer[
info: [wx: 0, wy: curY+2, parent: self, scrollable: TRUE, border: FALSE]
];
Containers.ChildXBound[self, psTool.logViewer];
Containers.ChildYBound[self, psTool.logViewer];
AppendLogMessage[psTool, "To set the area corners: left-click SetCorners and cursor changes to cross-hair; left-click-and-hold to set first corner; drag mouse to second corner and release the mouse button."];
AppendLogMessage[psTool, "To use GetSelectedViewer: make a point selection within a viewer or make the selection the name of a viewer and left-click GetSelectedViewer."];
[] ← psTool.logViewer.class.scroll[psTool.logViewer, thumb, 0];
Display default settings
ChoiceButtons.UpdateChoiceButtons[self, psTool.outputStyleChoice, "AIS/Press file"];
ChoiceButtons.UpdateChoiceButtons[self, psTool.screenAreaChoice, "WholeScreen"];
ChoiceButtons.UpdateChoiceButtons[self, psTool.magnificationChoice, "FullPage"];
ViewerTools.SetContents[psTool.magnificationViewer, IO.PutFR["%g", IO.real[100.0]]];
ViewerTools.SetContents[psTool.ulx, IO.PutFR["%g", IO.int[0]]];
ViewerTools.SetContents[psTool.uly, IO.PutFR["%g", IO.int[808]]];
ViewerTools.SetContents[psTool.lrx, IO.PutFR["%g", IO.int[1024]]];
ViewerTools.SetContents[psTool.lry, IO.PutFR["%g", IO.int[0]]];
ChoiceButtons.UpdateChoiceButtons[self, psTool.formatViewer, "Portrait"];
ViewerTools.SetContents[psTool.borderViewer, IO.PutFR["%g", IO.int[2]]];
ViewerTools.SetContents[psTool.pageMarginViewer, IO.PutFR["%g", IO.real[0.75]]];
ViewerTools.SetContents[psTool.countDownTimerViewer, IO.PutFR["%g", IO.int[0]]];
PieViewers.Set[psTool.countDownPieViewer, 100.0];
ViewerOps.PaintViewer[self, all];
};
DestroyPressScreenViewer: ViewerClasses.DestroyProc = {
psTool: PressScreenTool ← NARROW[ViewerOps.FetchProp[self, $PressScreenData]];
SaveState[psTool];
psTool.destroyed ← TRUE;
IF containerDestroyProc # NIL THEN containerDestroyProc[self];
};
GetSelectedViewerButton: Buttons.ButtonProc = {
psTool: PressScreenTool ← NARROW[clientData];
selectedViewer: ViewerClasses.Viewer ← ViewerTools.GetSelectedViewer[];
sourceName: ROPENIL;
sourceName ← IF selectedViewer = NIL OR selectedViewer.class.get = NIL THEN NIL
ELSE NARROW[selectedViewer.class.get[selectedViewer, $SelChars !
RuntimeError.UNCAUGHT => CONTINUE]];
IF sourceName.Length <= 1 THEN {
IF (selectedViewer = NIL) THEN {
AppendLogMessage[psTool, "Selection not in text viewer"];
RETURN;
}
ELSE {
WHILE sourceName.Length <= 1 AND selectedViewer # NIL DO
sourceName ← selectedViewer.name;
selectedViewer ← selectedViewer.parent;
ENDLOOP;
};
};
IF sourceName.Length > 1 THEN {
selectedViewer ← ViewerOps.FindViewer[sourceName];
IF selectedViewer = NIL THEN
AppendLogMessage[psTool, Rope.Cat["Viewer \"", sourceName, "\" wasn't found."]]
ELSE {
ViewerTools.SetContents[psTool.ulx, IO.PutFR["%g", IO.int[selectedViewer.wx]]];
ViewerTools.SetContents[psTool.uly, IO.PutFR["%g", IO.int[selectedViewer.wy+selectedViewer.wh]]];
ViewerTools.SetContents[psTool.lrx, IO.PutFR["%g", IO.int[selectedViewer.wx+selectedViewer.ww]]];
ViewerTools.SetContents[psTool.lry, IO.PutFR["%g", IO.int[selectedViewer.wy]]];
ChoiceButtons.UpdateChoiceButtons[psTool.tool, psTool.screenAreaChoice, "DesiredArea"];
FlashScreenArea[psTool];
};
};
};
FlashImageButton: Buttons.ButtonProc = {
psTool: PressScreenTool ← NARROW[clientData];
FlashScreenArea[psTool];
};
flashTime: Process.Milliseconds ~ 600;
FlashScreenArea: PROCEDURE [psTool: PressScreenTool] = {
ulx, uly, lrx, lry: REAL;
context: Imager.Context ← ImagerTerminal.BWContext[vt: InterminalBackdoor.terminal, pixelUnits: TRUE];
context.SetColor[ImagerBackdoor.invert];
[ulx, uly, lrx, lry] ← ReadScreenCorners[psTool];
context.MaskBox[[lrx, lry, ulx, uly]];
Process.Pause[Process.MsecToTicks[flashTime]];
context.MaskBox[[lrx, lry, ulx, uly]];
};
SetCornersButton: Buttons.ButtonProc = {
psTool: PressScreenTool ← NARROW[clientData];
x, y, w, h: NAT;
[x, y, w, h] ← LFBoundingBox.GetArea[ ! LFBoundingBox.AbortAdjust => GOTO DoNothing];
ViewerTools.SetContents[psTool.ulx, IO.PutFR["%g", IO.int[x]]];
ViewerTools.SetContents[psTool.uly, IO.PutFR["%g", IO.int[y+h]]];
ViewerTools.SetContents[psTool.lrx, IO.PutFR["%g", IO.int[x+w]]];
ViewerTools.SetContents[psTool.lry, IO.PutFR["%g", IO.int[y]]];
ChoiceButtons.UpdateChoiceButtons[psTool.tool, psTool.screenAreaChoice, "DesiredArea"];
FlashScreenArea[psTool];
EXITS
DoNothing => NULL;
};
SaveStateButton: Buttons.ButtonProc = {
psTool: PressScreenTool ← NARROW[clientData];
SaveState[psTool];
};
SaveState: PROCEDURE [psTool: PressScreenTool] = {
IF psTool.destroyed THEN RETURN;
psTool.outputStyleRope ← ChoiceButtons.GetSelectedButton[psTool.outputStyleChoice];
psTool.screenAreaRope ← ChoiceButtons.GetSelectedButton[psTool.screenAreaChoice];
psTool.magnificationRope ← ChoiceButtons.GetSelectedButton[psTool.magnificationChoice];
psTool.pageMargin ← ConvertRopeToReal[ViewerTools.GetContents[psTool.pageMarginViewer]];
psTool.magnificationFactor ← ConvertRopeToReal[ViewerTools.GetContents[psTool.magnificationViewer]]/100.0;
[psTool.ulX, psTool.ulY, psTool.lrX, psTool.lrY] ← ReadScreenCorners[psTool];
psTool.formatRope ← ChoiceButtons.GetSelectedButton[psTool.formatViewer];
psTool.borderWidth ← ConvertRopeToReal[ViewerTools.GetContents[psTool.borderViewer]];
psTool.pageMargin ← ConvertRopeToReal[ViewerTools.GetContents[psTool.pageMarginViewer]];
psTool.countDownTime ← Process.SecondsToTicks[MIN[100000, MAX[0, Real.FixC[ConvertRopeToReal[ViewerTools.GetContents[psTool.countDownTimerViewer]]]]]];
psTool.lockViewers ← psTool.lockViewersTriState.state = on;
psTool.displayCursor ← psTool.displayCursorTriState.state = on;
psTool.displayCarets ← psTool.displayCaretsTriState.state = on;
psTool.stateSaved ← TRUE;
};
PSButton: Buttons.ButtonProc = {
SELECT mouseButton FROM
red, blue => DoItButton[parent, clientData, mouseButton, shift, control];
yellow => SetCornersButton[parent, clientData, mouseButton, shift, control];
ENDCASE => ERROR;
};
DoItButton: Buttons.ButtonProc = {
psTool: PressScreenTool ← NARROW[clientData];
SaveState[psTool];
DoIt[psTool];
};
DoIt: PROCEDURE [psTool: PressScreenTool] = {
IF psTool.stateSaved THEN {
sp: ScreenParameters ← [
borderWidth: psTool.borderWidth,
lockViewers: psTool.lockViewers,
displayCursor: psTool.displayCursor,
displayCarets: psTool.displayCarets
];
pp: PageParameters = [
magnification: psTool.magnificationFactor,
scaleToFit: SELECT TRUE FROM
psTool.magnificationRope.Equal["UseFactorBelow"] => useMagnification,
psTool.magnificationRope.Equal["HalfPage"] => halfPage,
psTool.magnificationRope.Equal["FullPage"] => fullPage,
ENDCASE => halfPage,
leftMarginInches: psTool.pageMargin,
rightMarginInches: psTool.pageMargin,
landscape: SELECT TRUE FROM
psTool.formatRope.Equal["Landscape"] => TRUE,
ENDCASE => FALSE
];
SELECT TRUE FROM
psTool.screenAreaRope.Equal["LeftColumn"] => {
sp.sourceHeight ← InterminalBackdoor.terminal.bwHeight;
sp.sourceWidth ← ViewerSpecs.openLeftWidth;
sp.sourceBottom ← 0;
sp.sourceLeft ← ViewerSpecs.openLeftLeftX;
};
psTool.screenAreaRope.Equal["RightColumn"] => {
sp.sourceHeight ← InterminalBackdoor.terminal.bwHeight;
sp.sourceWidth ← ViewerSpecs.openRightWidth;
sp.sourceBottom ← 0;
sp.sourceLeft ← ViewerSpecs.openRightLeftX;
};
psTool.screenAreaRope.Equal["WholeScreen"] => {
sp.sourceHeight ← InterminalBackdoor.terminal.bwHeight;
sp.sourceWidth ← InterminalBackdoor.terminal.bwWidth;
sp.sourceBottom ← 0;
sp.sourceLeft ← 0;
};
psTool.screenAreaRope.Equal["DesiredArea"] => {
ulx, uly, lrx, lry: REAL;
[ulx, uly, lrx, lry] ← ReadScreenCorners[psTool];
sp.sourceHeight ← Real.Fix[uly - lry + 1];
sp.sourceWidth ← Real.Fix[lrx - ulx + 1];
sp.sourceBottom ← Real.Fix[lry];
sp.sourceLeft ← Real.Fix[ulx];
};
ENDCASE => {
sp.sourceHeight ← InterminalBackdoor.terminal.bwHeight;
sp.sourceWidth ← InterminalBackdoor.terminal.bwWidth;
sp.sourceBottom ← 0;
sp.sourceLeft ← 0;
};
IF psTool.countDownTime > 0 THEN {
FOR i: CARDINAL IN [1..25] DO
Process.Pause[psTool.countDownTime/25];
IF NOT psTool.countDownPieViewer.destroyed THEN
PieViewers.Set[psTool.countDownPieViewer, 100.0-4*i];
ENDLOOP;
};
SELECT TRUE FROM
psTool.outputStyleRope.Equal["AIS/Press file"] => {
fileName: ROPE;
fileName ← AISPressScreen[
pressFileName: NewAISPressName[],
screenParms: sp,
pageParms: pp
! MagnificationFactorTooLarge => GOTO ReportError];
AppendLogMessage[psTool, Rope.Concat[fileName, " written."]];
};
psTool.outputStyleRope.Equal["Interpress file"] => {
fileName: ROPE;
fileName ← IPScreen[
ipFileName: NewIPName[],
screenParms: sp,
pageParms: pp
! MagnificationFactorTooLarge => GOTO ReportError];
AppendLogMessage[psTool, Rope.Concat[fileName, " written."]];
};
psTool.outputStyleRope.Equal["Stuff into Tioga"] => {
StuffScreen[
screenParms: sp
! MagnificationFactorTooLarge => GOTO ReportError];
AppendLogMessage[psTool, "Stuffed."];
};
ENDCASE => AppendLogMessage[psTool, "Internal Error."];
IF NOT psTool.countDownPieViewer.destroyed THEN
PieViewers.Set[psTool.countDownPieViewer, 100.0];
EXITS
ReportError =>
AppendLogMessage[psTool, "Magnification factor too large for identified area"];
};
};
MagnificationFactorButton: Buttons.ButtonProc = {
psTool: PressScreenTool ← NARROW[clientData];
IF mouseButton = blue THEN ViewerTools.SetContents[psTool.magnificationViewer, ""];
ViewerTools.SetSelection[psTool.magnificationViewer];
};
AreaCornersButton: Buttons.ButtonProc = {
psTool: PressScreenTool ← NARROW[clientData];
sourceHeight, sourceWidth, sourceBottom, sourceLeft: NAT ← 0;
screenAreaChoice: ROPE ← ChoiceButtons.GetSelectedButton[psTool.screenAreaChoice];
SELECT TRUE FROM
screenAreaChoice.Equal["LeftColumn"] => {
sourceHeight ← InterminalBackdoor.terminal.bwHeight;
sourceWidth ← ViewerSpecs.openLeftWidth;
sourceBottom ← 0;
sourceLeft ← ViewerSpecs.openLeftLeftX;
};
screenAreaChoice.Equal["RightColumn"] => {
sourceHeight ← InterminalBackdoor.terminal.bwHeight;
sourceWidth ← ViewerSpecs.openRightWidth;
sourceBottom ← 0;
sourceLeft ← ViewerSpecs.openRightLeftX;
};
screenAreaChoice.Equal["WholeScreen"] => {
sourceHeight ← InterminalBackdoor.terminal.bwHeight;
sourceWidth ← InterminalBackdoor.terminal.bwWidth;
sourceBottom ← 0;
sourceLeft ← 0;
};
screenAreaChoice.Equal["DesiredArea"] => {
sourceHeight ← sourceWidth ← sourceBottom ← sourceLeft ← 0;
};
ENDCASE => {
sourceHeight ← InterminalBackdoor.terminal.bwHeight;
sourceWidth ← InterminalBackdoor.terminal.bwWidth;
sourceBottom ← 0;
sourceLeft ← 0;
};
ViewerTools.SetContents[psTool.ulx, IO.PutFR["%g", IO.int[sourceLeft]]];
ViewerTools.SetContents[psTool.uly, IO.PutFR["%g", IO.int[sourceBottom+sourceHeight-1]]];
ViewerTools.SetContents[psTool.lrx, IO.PutFR["%g", IO.int[sourceLeft+sourceWidth-1]]];
ViewerTools.SetContents[psTool.lry, IO.PutFR["%g", IO.int[sourceBottom]]];
ViewerTools.SetSelection[psTool.ulx];
};
BlackBorderButton: Buttons.ButtonProc = {
psTool: PressScreenTool ← NARROW[clientData];
IF mouseButton = blue THEN ViewerTools.SetContents[psTool.borderViewer, ""];
ViewerTools.SetSelection[psTool.borderViewer];
};
PageMarginButton: Buttons.ButtonProc = {
psTool: PressScreenTool ← NARROW[clientData];
IF mouseButton = blue THEN ViewerTools.SetContents[psTool.pageMarginViewer, ""];
ViewerTools.SetSelection[psTool.pageMarginViewer];
};
CountDownTimerButton: Buttons.ButtonProc = {
psTool: PressScreenTool ← NARROW[clientData];
IF mouseButton = blue THEN ViewerTools.SetContents[psTool.countDownTimerViewer, "0"];
ViewerTools.SetSelection[psTool.countDownTimerViewer];
};
AppendLogMessage: PROCEDURE [psTool: PressScreenTool, msg: ROPE] = {
psTool.logMessage ← psTool.logMessage.Cat[msg, "\n"];
IF NOT psTool.logViewer.destroyed THEN {
ViewerTools.SetContents[psTool.logViewer, psTool.logMessage];
[] ← psTool.logViewer.class.scroll[psTool.logViewer, thumb, 100];
}
ELSE MessageWindow.Append[msg, TRUE];
};
ReadScreenCorners: PROCEDURE [psTool: PressScreenTool] RETURNS [ulx, uly, lrx, lry: REAL] = {
ulx ← ConvertRopeToReal[ViewerTools.GetContents[psTool.ulx]];
uly ← ConvertRopeToReal[ViewerTools.GetContents[psTool.uly]];
lrx ← ConvertRopeToReal[ViewerTools.GetContents[psTool.lrx]];
lry ← ConvertRopeToReal[ViewerTools.GetContents[psTool.lry]];
};
ConvertRopeToReal: PROCEDURE [rope: ROPE] RETURNS [value: REAL] = {
success: BOOLEANTRUE;
value ← 0.0;
value ← Convert.RealFromRope[rope ! Convert.Error => {success ← FALSE; CONTINUE}];
IF NOT success THEN value ← Convert.IntFromRope[rope ! Convert.Error => CONTINUE];
};
GetName: PROC [stream: IO.STREAM] RETURNS [name: ROPE] ~ {
name ← NIL;
name ← IO.GetTokenRope[stream, IO.IDProc ! IO.EndOfStream => CONTINUE].token;
};
PressScreenExecCommand: Commander.CommandProc = TRUSTED {
stream: IO.STREAMIO.RIS[cmd.commandLine];
serverName: ROPE ← GetName[stream];
[] ← NewPressScreenTool[serverName];
};
sym: INT ← 0;
GenSym: ENTRY PROC RETURNS [ROPE] ~ {s: INT ← sym; sym ← sym + 1; RETURN [IF s = 0 THEN "" ELSE Convert.RopeFromInt[s]]};
pressScreenViewerClass: ViewerClasses.ViewerClass ~
NEW[ViewerClasses.ViewerClassRec ← ViewerOps.FetchViewerClass[$Container]^];
containerInitProc: ViewerClasses.InitProc ← pressScreenViewerClass.init;
containerDestroyProc: ViewerClasses.InitProc ← pressScreenViewerClass.destroy;
pressScreenViewerClass.init ← InitPressScreenViewer;
pressScreenViewerClass.destroy ← DestroyPressScreenViewer;
ViewerOps.RegisterViewerClass[$PressScreen, pressScreenViewerClass];
Commander.Register[
key: "PressScreen",
proc: PressScreenExecCommand,
doc: "Create a tool to make AIS/Press files of portions of the bitmap display screen"
];
}.
6-Apr-82 12:01:31 Teitelman fixed PressScreenButton to clear message window first.
May 4, 1982 4:39 pm Cattell: print msg saying whether half or full screen. Also, no longer need config 'cause SirPressPackage is external.
June 18, 1982 1:58 pm Cattell: convert to 3.2; leave a little left margin to avoid printer truncation.
November 15, 1982 12:30 pm Plass: Made client-callable interface.
November 15, 1982 2:30 pm Plass: Made rightSide work, removed button interface, made half-screen resolution match what Spruce can sometimes handle.
November 16, 1982 10:57 am Plass: Tracked SirPress changes.
Edited on May 7, 1984 4:39:28 pm PDT, by Beach
changes to: GetSelectedViewerButton to catch ERROR returned if viewer does not support $SelChars, DIRECTORY, PressScreenToolImpl, DIRECTORY, InitPressScreenViewer, SetCornersButton, PressScreenToolImpl