File: PressScreenImpl.mesa
Contents: Program to put up viewers button to make press file of display
Last edited by:
Rick Cattell on June 18, 1982 1:58 pm
Warren Teitelman on 6-Apr-82 12:02:06
Michael Plass on November 16, 1982 10:58 am
Last Edited by: Beach, May 24, 1983 9:13 am
DIRECTORY
SirPress USING [PressHandle, SetPageSize, BeginScannedRectangle, Create, in, UnsafeShowLine, EndScannedRectangle, ClosePress],
GraphicsOps USING [BitmapRef, ScreenBitmap],
Convert USING [ValueToRope],
Rope USING [Find, Replace, ROPE],
UserTerminal USING [GetBitBltTable],
FileIO USING [Open],
PressScreen
;
PressScreenImpl: MONITOR
IMPORTS Convert, Rope, SirPress, GraphicsOps, UserTerminal, FileIO
EXPORTS PressScreen =
BEGIN OPEN PressScreen;
extraWords: NAT ← 6; -- Half-screen prints are widened by this much.
PressScreen: PUBLIC PROC[pressFileName: Rope.ROPE, which: Side] = {
Send the screen to "Screen.press", either left half vertically or both horizontally on 8.5 by 11 orientation paper.
screen: SirPress.PressHandle← SirPress.Create[
fileNameForHeaderPage: pressFileName,
outputStream: FileIO.Open[pressFileName, overwrite]
];
screenBitMap: GraphicsOps.BitmapRef← GraphicsOps.ScreenBitmap[];
widthInWords: INT ← screenBitMap.width/16;
halfWidthInWords: NAT ← widthInWords/2;
screenPtr: LONG POINTER ← UserTerminal.GetBitBltTable[].dst.word;
define the screen rectangle
IF which=bothSides THEN {
screen.SetPageSize[height: 85, width: 110, unit: SirPress.in/10];
screen.BeginScannedRectangle[
x: 1, y: 1,
numberOfLines: screenBitMap.height,
dotsPerLine: widthInWords*16,
height: 8*4,
unit: SirPress.in/4]
}
ELSE
screen.BeginScannedRectangle[
x: 1, y: 1,
numberOfLines: screenBitMap.height,
dotsPerLine: (halfWidthInWords+extraWords)*16,
unit: SirPress.in/4];
call ShowLine for each line of screen (or half-line, if left side)
FOR i: INT IN [0..screenBitMap.height) DO
offset: LONG CARDINAL ← i*widthInWords;
IF which=rightSide THEN offset ← offset + halfWidthInWords - extraWords;
screen.UnsafeShowLine[screenPtr + offset];
ENDLOOP;
finish the rectangle and close the file
screen.EndScannedRectangle[];
screen.ClosePress[];
};
fileNameTemplate: Rope.ROPE ← "Screen#.press";
count is incremented by one and substituted for # in the template
count: INT ← 0;
NewPressName: PUBLIC ENTRY PROCEDURE RETURNS [pressFileName: Rope.ROPE] = {
ENABLE UNWIND => NULL;
i: INT = Rope.Find[s1: fileNameTemplate, s2: "#"];
pressFileName ← IF i = -1 THEN fileNameTemplate
ELSE fileNameTemplate.Replace[start: i, len: 1, with: Convert.ValueToRope[[signed[(count ← count + 1)]]]];
};
END.
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.