FileViewerOps.mesa
Copyright Ó 1986, 1987, 1991 by Xerox Corporation. All rights reserved.
Doug Wyatt, December 17, 1986 11:37:29 am PST
Russ Atkinson (RRA) January 20, 1987 6:23:37 pm PST
DIRECTORY
IO USING [STREAM],
Rope USING [ROPE];
FileViewerOps:
CEDAR
DEFINITIONS =
BEGIN
OPEN
IO, Rope;
SourceFromSelection:
PROC [which: SelectionOption ¬ primary]
RETURNS [fileName:
ROPE ¬
NIL, index:
INT ¬ -1];
... returns the file name and position within the file for the selected Tioga viewer (returns [NIL, -1] if no valid Tioga viewer is selected).
SelectionOption:
TYPE = {primary, feedback};
primary => use primary selection
feedback => use feedback selection
OpenSource:
PROC [fileName:
ROPE, index:
INT, chars:
INT ¬ 2, feedBack:
STREAM ¬
NIL];
... opens a viewer on the source file. If index >= 0, then also set the feedback selection to the given index (for "chars" characters).
ShowLog:
PROC [
fileName: ROPE,
destroyIt: BOOL ¬ FALSE,
createIconic: BOOL ¬ FALSE,
blinkIfIconic: BOOL ¬ TRUE];
WaitUntilSaved:
PROC [fileName:
ROPE, feedBack:
STREAM ¬
NIL];
WaitUntilSaved tries to find a viewer (v) such that
Rope.Find[(IF v.name # NIL THEN v.file ELSE v.name), fileName, 0, FALSE] # 0
AND v is in the process of being saved or is marked as a "newVersion". If such a viewer is found, this prints relevant messages on "feedBack" and waits until v.saveInProgress is TRUE, then until it goes FALSE, then returns.
AttachErrorLog:
PROC [sourceFileName: Rope.
ROPE];
Find or open a viewer on sourceFileName and put an ErrorLog button in the menu. Change the icon to show that the file has errors.
RemoveErrorLog:
PROC [sourceFileName: Rope.
ROPE];
Remove the ErrorLog button from the viewer. Change the icon back. Destroy the errlog file.