PreViewDoc.tioga
Written by: Ken Pier, September 4, 1985
Last Edited By: Ken Pier, October 24, 1986 11:17:01 am PDT
Eric Nickell, June 27, 1986 11:26:10 am PDT
Bland, August 28, 1986 4:29:56 pm PDT
Mike Spreitzer September 4, 1986 5:56:01 pm PDT
PREVIEW TOOL DOCUMENTATION
CEDAR 6.0 — FOR INTERNAL XEROX USE ONLY
PreView Tool
Ken Pier
© Copyright 1985 Xerox Corporation. All rights reserved.
Abstract: PreView is a Cedar tool which allows users to open a viewer on any one of five file types: Interpress, Press, PD, Griffin, and AIS. There is also an option to use three color separation AIS files to get a full color picture. The user may scroll horizontally and vertically on any file page, and may flip through pages of a multi-page file. The user interface is the same for all the file types. PreView also provides interactive scaling, rotation, and cropping of file pages on display, with the option to either write a new Interpress file with the selected contents or to stuff the selected contents directly into a Tioga document in the form of a TiogaArtwork node.
Created by: Ken Pier
Maintained by: Ken Pier <Pier.PA>
Keywords: display, viewer, Interpress, Press, PD, AIS, Griffin, TiogaArtwork
XEROX  Xerox Corporation
   Palo Alto Research Center
   3333 Coyote Hill Road
   Palo Alto, California 94304

For Internal Xerox Use Only
1. Introduction
PreView is a Cedar tool which allows users to open a viewer on any one of five file types: Interpress, Press, PD, Griffin, and AIS. There is also an option to use three color separation AIS files to get a full color picture. The user may scroll horizontally and vertically on any file page, and may flip through pages of a multi-page file. The user interface is the same for all the file types. PreView also provides interactive scaling, rotation, and cropping of file pages on display, with the option to either write a new Interpress file with the selected contents or to stuff the selected contents directly into a Tioga document in the form of a TiogaArtwork node.
2. Getting Started
Bringover
To get started, Bringover -p /Cedar/CedarChest@/Top/PreView.df.
Getting a new PreView Tool
Type "Preview [-switches] FileList" to the appropriate CommandTool, where [-switches] is an optional set of switches and FileList is a series of file names. Star expansion is permitted. PreView.load will be executed if this is the first use of PreView in the current session. File names with extension (e.g. /User/UserName/SubD/Foo.press, or ///Foo.Interpress) or short file names with or without extension (e.g. Bar, or Bar.AIS) may be in the FileList. If the short file name exists in the local context, it will be used. If it does not exist, and has no extension, PreView will attempt to find a local file by attempting the following default file extensions:
IP, Interpress, Press, PD, AIS, Griffin
(The user may modify this list of file extensions via a UserProfile option).
PreView uses the text of the file extension only as a hint to determine what file type is in the file; it looks within the file to determine its type. If the file exists and has a compatible type, a new PreView Tool will be opened (left column, iconic) on the file.
UserProfile Options and Switches
Profile Options
The user may modify the list of file extensions via the UserProfile option "PreView.Extensions". For example:
PreView.Extensions: "MyExtension YourExtension InterP Press".
Defaults are PreView.Extensions: "ip interpress press pd ais griffin".
The user may specify that, should file searching on the extensions fail, PreView then attempt to open the file specified in the command line using a "Tioga" Open. For example:
PreView.TryTiogaOpen: TRUE
Default is PreView.TryTiogaOpen: FALSE
Switches
All switches must be in the first argument; for example:
Preview -fvm /Server/User/PD/BigFile.PD; -- full scale, versatec plotter, no imager memory
Preview -s 11 14 Color400Image.PD -- thermal transfer printer accepts 11 X 14 images
-c => Full Color. Only applies to AIS files, and specifies that the following three file names are to be treated as a triple of color separations in Red, Green, Blue order. Tokens after the three file names will be ignored. Size will be ignored because it is specified in the AIS file. The file names must be complete. For example:
PreView -c /Server/User/AIS/My-red.ais /Server/User/AIS/My-green.ais /Server/User/AIS/My-blue.ais
PreView -c /Server/User/AIS/My-red.ais!33 /Server/User/AIS/My-green.ais!33 /Server/User/AIS/My-blue.ais!33
PreView -c /Server/User/AIS/Old-red.ais!L /Server/User/AIS/Old-green.ais!L /Server/User/AIS/Old-blue.ais!L.
The name displayed at the top of the preViewer will be "/Server/User/AIS/My-*.ais".
-f => Full Scale. Only applies to PD files, and specifies that a PD file should not be scaled for display on the screen, but should instead be displayed at a resolution of one screen pixel to one printing device pixel. For example:
PreView -f /Server/User/PD/BigFile.PD.
-m => No ImagerMemory. Preview uses a package called ImagerMemory to memorize Imager calls for fast repainting. ImagerMemory is used for Interpress and Griffin files only. If -m is given, painting will not use ImagerMemory but will be done from scratch each time. For example:
PreView -m /Server/User/Griffin/OddGriffin.Griffin.
-s => Size. PreView interprets the next two tokens as (positive) real numbers; the first number is the page size in inches in the X (fast) direction; the second number is the page size in inches in the Y (slow) direction. For example, an 11" by 17" file might do:
PreView -s 11.0 17.0 /Server/User/PD/Color400Image.PD.
The default size is 8.5" x 11".
-v => Versatec. Only should be used for files which were destined for the large color Versatec plotter. PreView will assume a page size of 40" square, instead of the default size of 8.5" x 11". For example:
PreView -v /Server/User/IP/BigColorFile.IP.
Aliases
PreView.load defines two convenient aliases for use with the -c switch:
alias CPreView1 (Arg1) PreView -c Arg1-red.ais Arg1-green.ais Arg1-blue.ais
alias CPreView2 (Arg1) PreView -c Arg1-red.ais Arg1-grn.ais Arg1-blu.ais
For example:
"CPreView1 MyAIS" if your files are named MyAIS-red.ais, MyAIS-green.ais, MyAIS-blue.ais
"CPreView2 MyAIS" if your files are named MyAIS-red.ais, MyAIS-grn.ais, MyAIS-blu.ais
3. User Interface
The user interface consists of scrolling, transformation, paging, and output control functions. Scrolling and transformation are provided by the BiScrollers package, while paging and output control are implemented in the tool itself. All functions are nearly self-documenting if you experiment a bit with a PreView Tool.
Scrolling and Transformation Controls
Scrolling and image transformation are provided by the BiScrollers package, which displays two scroll bars in the image viewer and transformation buttons at the top of a PreView Tool.
Scrolling Controls
The BiScrollers vertical scroll bar is at the left of the viewer, and the horizontal scroll bar is at the bottom. They work in a manner analogous to a Tioga scroll bar. Move the cursor into the left edge of the viewer and the vertical scroll bar will appear. Scroll Up, Thumb, and Scroll Down are invoked as usual with left, middle and right mouse buttons respectively, and the scroll bar pattern indicates the percentage of the page that is actually displayed in the viewer. Similarly, move the cursor to the bottom of the viewer to invoke the horizontal scroll bar, which provides Scroll Left, Thumb, and Scroll Right.
Transformation Controls
The transformation buttons at the top of the viewer are:
Scale Rotate Fit Reset Edge Prev
The transformation buttons are PopUpButtons which change the display when invoked. See BiScrollersDoc and PopUpButtonsDoc for information on PopUpButtons. In addition, some of the buttons use the Tioga current selection as argument:
There is no need to memorize click/Shift/CTRL combinations for PopUpButtons. The buttons are self-documenting. Hold down any key over the button and a menu of all options will pop up. The click/Shift/CTRL combinations are accelerators only.
Scale:
left- scale image by (current selection); defaults to 2.0 if current selection is not a number.
middle- reset scale to 1.0;
right- scale image by 1.0/(current selection); defaults to 1.0/2.0 if current selection is not a number..
If current selection is not a number, the value 2.0 is used and a message may be flashed in the MessageWindow.
Rotate:
left- rotate image ccw by (current selection) degrees; defaults to 90.0 if current selection is not a number.
middle- reset rotation to 0 degrees;
right- rotate image cw by (current selection) degrees; defaults to 90.0 if current selection is not a number.
If (current selection) is not a number, the value 90.0 is used and a message may be flashed in the MessageWindow..
Fit:
any- scale and translate the image so as to maximize magnification while fitting the entire image in the viewer. Aspect ratio is preserved.
Reset:
left- reset all scrolling transformations to their nominal values and moves the image so the upper left corner is in the upper left corner of the viewer. Handy for images containing text.
middle- reset all scrolling transformations to their nominal values and center the image in the viewer.
right- center the image in the center of the viewer, preserving transformations.
Edge:
any- see the pop up menu for edge options. Moves the image to align with the chosen edge option.
Prev:
any- restores previous tool-to-viewer transformation.
Output, Selection and Paging Controls
Beneath the transformation buttons is another line of PopUpButtons:
Stuff ToIP Selection Page
These PopUpButtons control paging through a multi-page file and creating output from PreView.
There is no need to memorize click/Shift/CTRL combinations. The buttons are PopUpButtons and are self documenting. Hold down any key over the button and a menu of all options will pop up. The click/Shift/CTRL combinations are accelerators only.
Output Controls
Making a PreView Selection:
Output is controlled by the Stuff and the ToIP buttons, and by the selection rectangle. The user sweeps out a selection by moving the cursor over the viewer (note the crosshairs cursor pattern). When the left mouse button is depressed, PreView will fix one corner of the selection rectangle at the mouse point. A rectangle is then swept out by holding down the left button continuously and rolling the mouse to the other selection rectangle corner; note the rubberbanding rectangle as feedback. When the button is let up, the opposite corner is fixed. The user may at any time cancel the selection by a middle button click in the viewer. The user may modify the second corner of an existing selection by again holding down the left button, resuming sweeping, and releasing at the new corner. Whenever the left button is let up, the coordinates of the selection rectangle are reported in the message window.
After selection, any transformations (e.g. Scale, Rotate, ...) invoked will also be reflected in the selection. It is possible but somewhat counterintuitive to modify the selection after invoking transformations. After setting the desired selection, the output control menu buttons may be invoked.
Stuff:
Stuff causes the image in the (possibly transformed) selection to be converted to a Tioga Artwork node (of type Interpress) and then "stuffed" at the current selection. To see the image in the Artwork node, execute "ArtworkInterpress on" in a CommandTool. Stuffing may be done with either the current selection or the whole image, may be done with or without a border, and may be fit to the margins of the Tioga document. Pop up the Stuff button to see the options and accelerators. To perform a stuff, AFTER SELECTING move the input focus to the Tioga document at the place you want the new stuffed node to go, THEN use the Stuff button.
ToIP:
ToIP causes the image in the (possibly transformed) selection to be written to an Interpress Master whose filename is the current selection. The working directory of the CommandTool when PreView was invoked will be prepended to the selection. ToIP may be done with either the current selection or the whole image. Pop up the ToIP button to see the options and accelerators.
Selection:
Left- moves the image so the center of the PreView selection rectangle is in the center of the viewer. Requires a valid PreView selection. See "Making a PreView Selection".
Middle- moves the image so the center of the PreView selection rectangle is in the center of the viewer, then fits the image so as to maximize magnification while fitting the entire image in the viewer. Aspect ratio is preserved. Requires a valid PreView selection. See "Making a PreView Selection".
Right- moves the image so the center of the PreView selection rectangle is in the center of the viewer, then scales the image so as to maximize magnification while fitting the entire image in the viewer. Aspect ratio is preserved. Requires a valid PreView selection. See "Making a PreView Selection".
ShiftLeft- cancels the current selection and selects the entire page. Useful for finding page boundaries before a ToIP command.
ShiftMiddle- takes the current Tioga selection and tries to parse it into the four numbers to set the selection rectangle to. The numbers should be x y w h, in that order, with no commas between them. The units are inches.
N.B. The current implementations of clipping in the imaging contexts used by Stuff and ToIP do no culling or filtering. That means that even though a small selection is made to be copied, the entire page plus the clipping commands will appear in the output node or IP Master. This will be remedied as soon as culling or filtering contexts are implemented by the Imager.
Paging Controls
To the right of the Page button is a small Tioga viewer labeled AtPage: in which the current page number is displayed. To the right of the current page number viewer is a slider; put the cursor in the slider and hold the left mouse button down to "thumb" through the pages of the document. The current page number viewer will change dynamically to indicate the page number that will become the currently displayed page if you release the left button.
The Page PopUpButton changes the display when invoked by the mouse buttons outlined below.
Page:
Left- causes the next page of the document to become the currently displayed page;
Right- causes the previous page of the document to become the currently displayed page.
ShiftLeft- causes the first page of the document to become the currently displayed page.
ShiftRight- causes the last page of the document to become the currently displayed page.
ShiftMiddle- causes the page number in the Tioga selection to become the currently displayed page.
Stop Painting!!!
Holding down Shift-SWAT (on a Dorado) or Shift-STOP (on a DLion) for about 4 seconds while the cursor is in a PreView viewer will cause that viewer to abort painting.
4. Programmers Interface
PreViewClient.Mesa has a single public procedure:
CreatePreViewer: PROC [fileNames: NameList, switches: Switches] RETURNS [preViewer: ViewerClasses.Viewer];
which returns a container which includes all the Viewers and BiScrollers outlined above. PreView.mesa should be considered private to the implementation.
5. Helpful hints
Scrolling transformations are not affected by page turning; if you turn a page and it doesn't display to your liking, try the Vanilla button and go from there.
Once you have invoked a time consuming operation, don't pass the mouse through a BiScrollers scroll bar. Since those bars are themselves implemented as viewers, that will result in locking the cursor and the viewer columns for the duration of the painting of that preViewer.
The first time a PreViewer is painted may go slowly due to remote file access, setting up internal data structures, building pixel maps, font cache filling, and imager memorizing. Scaling and rotating will also cause font caching activity the first time they are invoked. Subsequent paintings will be faster.
Painting a PD image is invariably slow if the PD file has small bands, because the processing is done one band at a time.
Patience is a virtue.