SaveCommand.mesa
Copyright Ó 1991, 1992 by Xerox Corporation. All rights reserved.
Weiser, May 25, 1992 7:53 pm PDT
DIRECTORY Commander, MultiCursors, Process, Rope, ViewerClasses, ViewerOps;
SaveCommand: CEDAR PROGRAM
IMPORTS Commander, MultiCursors, Process, ViewerOps
~ BEGIN
VerboseSaveAllEdits: PUBLIC PROC = {
poor man's crash recovery
Save: ViewerOps.EnumProc = {
MultiCursors.InvertACursor[NIL]; -- main cursor becomes a filled box
IF (v.newVersion OR v.newFile) AND v.class.save # NIL THEN
[] ← ViewerOps.SaveViewer[v ! ANY => CONTINUE];
v.newVersion ¬ v.newFile ¬ FALSE;
IF v.icon=dirtyDocument THEN v.icon ¬ document;
IF v.link#NIL THEN FOR t: ViewerOps.Viewer ¬ v.link, t.link UNTIL t=v DO
t.newVersion ¬ t.newFile ¬ FALSE;
ENDLOOP;
MultiCursors.InvertACursor[NIL]; -- main cursor becomes a hollow box, again
RETURN[TRUE];
};
PaintCaption: ViewerOps.EnumProc = { ViewerOps.PaintViewer[v, caption] };
inner: PROC = {
MultiCursors.SetACursor[activate, NIL]; -- main cursor becomes a hollow box
ViewerOps.EnumerateViewers[Save];
MultiCursors.SetACursor[textPointer, NIL]; -- to show the saves are done
ViewerOps.EnumerateViewers[PaintCaption]; -- ok if this doesn't finish
};
inner[];
};
SaveCommand: Commander.CommandProc ~ {
Process.Detach[FORK VerboseSaveAllEdits[]];
};
Commander.Register["SaveSafely", SaveCommand, "safely saves all viewers"];
END.