TEditDocumentsCache2Impl.mesa; Edited by Paxton on October 21, 1982 9:33 am
Edited by Plass on August 12, 1983 10:53 am
DIRECTORY
Menus USING [MakeInactive],
Rope USING [Concat, Equal, ROPE],
TEditDocumentsCache,
TEditDocumentPrivate,
TEditProfile USING [showUnsavedDocumentsList],
ViewerClasses USING [Viewer],
ViewerOps USING [CreateViewer, DestroyViewer, EstablishViewerPosition, PaintViewer],
ViewerTools USING [SetContents];
TEditDocumentsCache2Impl: CEDAR MONITOR
IMPORTS Menus, Rope, TEditProfile, ViewerOps, ViewerTools, TEditDocumentsCache
EXPORTS TEditDocumentsCache =
BEGIN OPEN TEditDocumentsCache, TEditDocumentPrivate;
viewer: ViewerClasses.Viewer;
Update: PUBLIC ENTRY PROC = {
ENABLE UNWIND => NULL;
rope: ROPE ← GetList[]; -- this is monitored, so get consistent list
viewerName: ROPE = "Unsaved Documents List";
ViewerOk: PROC RETURNS [BOOL] = {
RETURN [viewer # NIL AND ~viewer.destroyed AND
Rope.Equal[viewer.name, viewerName]] };
IF ~TEditProfile.showUnsavedDocumentsList THEN RETURN;
IF rope=NIL THEN {
IF ViewerOk[] THEN ViewerOps.DestroyViewer[viewer];
RETURN };
IF ~ViewerOk[] THEN {
viewer ← ViewerOps.CreateViewer[flavor: $Text, info: [name: viewerName,
iconic: TRUE], paint: FALSE];
Menus.MakeInactive[viewer, $tiogaBasicMenu]; -- don't let user mess with it
Menus.MakeInactive[viewer, $tiogaPlacesMenu]; -- don't let user mess with it
Menus.MakeInactive[viewer, $tiogaLevelsMenu]; -- don't let user mess with it
ViewerOps.EstablishViewerPosition[viewer, viewer.wx, viewer.wy, viewer.ww, viewer.wh];
ViewerOps.PaintViewer[viewer, all] };
rope ← Rope.Concat["The following files were edited but not saved. They may still be restored with edits intact simply by loading them. If you really want to get rid of the edits, load the file and hit Reset.\n", rope];
ViewerTools.SetContents[viewer, rope];
viewer.newVersion ← TRUE; -- set edited bit
ViewerOps.PaintViewer[viewer, caption] }; -- repaint the caption
END.