DIRECTORY
AIS USING [FRef],
BasicTime USING [GMT, nullGMT],
BiScrollers USING [BiScrollerStyle, TransformGenerator, ExtremaProc],
Containers USING [Container],
GriffinImageUtils USING [GriffinImage],
Imager USING [Context, VEC, Rectangle],
ImagerColorOperator USING [ColorOperator],
ImagerPixelArray USING [PixelArray],
Interpress USING [OpenMaster],
PDFileReader USING [Handle],
PDImageReader USING [Handle, ImageLink],
Real USING [LargestNumber],
Rope USING [ROPE],
ShowPress USING [Handle],
Sliders USING [Slider],
ViewerClasses USING [Viewer, NotifyProc, PaintProc, DestroyProc, GetProc];
PreView:
CEDAR
DEFINITIONS =
BEGIN
bsStyle: BiScrollers.BiScrollerStyle;
SwitchRange: TYPE = CHAR['A..'Z];
Switches: TYPE = PACKED ARRAY SwitchRange OF BOOLEAN;
FileType: TYPE = {none, press, pd, ip, ais, griffin};
Data: TYPE = REF Rep;
Rep:
TYPE =
RECORD [
fileInfo: FileInfo ← NIL,
container: Containers.Container ← NIL,
preViewer: ViewerClasses.Viewer ← NIL,
pageNumberViewer: ViewerClasses.Viewer ← NIL,
pageNumberSlider: Sliders.Slider ← NIL,
pageNumber: INTEGER ← 1,
lastPageNumber: INTEGER ← 1,
pageInMem: INTEGER ← 0,-- which page is in iMemContext.
iMemContext: Imager.Context ← NIL, -- an ImagerMemory context
pageHeight, pageWidth: REAL ← 0.0,
bBox: BBoxState ← NIL,
abort: BOOLEAN ← FALSE,
process: UNSAFE PROCESS ← NIL,
switches: Switches ← ALL[FALSE],
stuffWithBorders: BOOLEAN ← FALSE,
kind:
SELECT type: FileType
FROM
none => [],
press => [presshandle: ShowPress.Handle ← NIL],
pd => [
atImage: PDImageReader.ImageLink ← NIL, --set by ResetToImage
pageStructure: PDImageReader.ImageLink ← NIL, --set by GetPageStructure
pdhandle: PDFileReader.Handle ← NIL,
image: PDImageReader.Handle ← NIL,
scaleFactors: Imager.VEC ← [x: 1.0, y: 1.0],
scalePD: BOOLEAN ← TRUE
],
ip => [ipMaster: Interpress.OpenMaster ← NIL],
ais => [state: AISState ← NIL],
griffin => [image: GriffinImageUtils.GriffinImage],
ENDCASE
];
PressData: TYPE = REF press Rep;
PDData: TYPE = REF pd Rep;
IPData: TYPE = REF ip Rep;
AISData: TYPE = REF ais Rep;
GData: TYPE = REF griffin Rep;
FileInfo: TYPE = REF FileInfoRep;
FileInfoRep:
TYPE =
RECORD [
filetype: FileType ← none,
fullFName: Rope.ROPE ← NIL,
created: BasicTime.GMT ← BasicTime.nullGMT,
ref: REF ANY ← NIL
];
AISState: TYPE = REF AISStateRep;
AISStateRep:
TYPE =
RECORD [
openFile: AIS.FRef ← NIL,
op: ImagerColorOperator.ColorOperator ← NIL,
pa: ImagerPixelArray.PixelArray ← NIL,
scans, pixels: NAT ← 0, --lines per page, pixels per line
active: BOOL ← FALSE
];
BBoxState: TYPE = REF BBoxStateRep;
BBoxStateRep:
TYPE =
RECORD [
active: BOOL ← FALSE,
rect: Imager.Rectangle ← [0.0,0.0,0.0,0.0], -- actual bounding rectangle for clipping
mode: BBoxMode ← waitingForFirstPoint, -- mode for responding to mouse
lastX, lastY: REAL ← Real.LargestNumber, -- most recent point acquired from NotifyProc
x0, y0: REAL ← 0.0-- first point acquired from NotifyProc
];
BBoxMode: TYPE = {waitingForFirstPoint, waitingForSecondPoint};
BBoxOp: TYPE = {stuff, ipMaster};
NameList: TYPE = LIST OF Rope.ROPE;
PaintOp: TYPE = {paint, remove, change};
DoFileOps: PROC [op: BBoxOp, viewer: ViewerClasses.Viewer, data: Data, fileName: Rope.ROPE, clip: BOOL ← TRUE];
ResetProcess: PROC [data: Data];
PVFeedback: PROC [data: Data, v: ViewerClasses.Viewer, x, y: REAL ← 0.0, op: PaintOp ← paint];
PVNotify: ViewerClasses.NotifyProc;
PVPaint: ViewerClasses.PaintProc;
PVDestroy: ViewerClasses.DestroyProc;
PVGetName: ViewerClasses.GetProc;
PVBasicTransformProc: BiScrollers.TransformGenerator;
PVExtremaProc: BiScrollers.ExtremaProc;
PVListRemove: PROC [ref: REF ANY];