GGHistory.mesa
Copyright Ó 1988 by Xerox Corporation. All rights reserved.
Pier, August 31, 1988 11:08:27 am PDT
Bier, October 31, 1988 4:28:40 pm PST
DIRECTORY
GGHistoryTypes, GGHistoryTypesOpaque, GGInterfaceTypes, GGModelTypes, RefTab, Rope, ViewerClasses;
GGHistory: CEDAR DEFINITIONS = BEGIN
OPEN GGHistoryTypes;
GGData: TYPE = GGInterfaceTypes.GGData;
Change: TYPE = GGHistoryTypesOpaque.Change;
Scene: TYPE = GGModelTypes.Scene;
Slice: TYPE = GGModelTypes.Slice;
SliceDescriptor: TYPE = GGModelTypes.SliceDescriptor;
SliceParts: TYPE = GGModelTypes.SliceParts;
Viewer: TYPE = ViewerClasses.Viewer;
HistoryTool: TYPE = REF HistoryToolObj;
HistoryToolObj: TYPE = RECORD [
layout: Layout,
eventNumArg: Viewer,
sizeArg: Viewer,
textField: Viewer];
Layout: TYPE = REF LayoutRec;
LayoutRec: TYPE = RECORD [
entryLeft: INTEGER ← 5,
initLeft: INTEGER ← 5,
heightSoFar: INTEGER ← 5,
initHeight: INTEGER ← 5,
entryHeight: INTEGER ← 15,
entryVSpace: INTEGER ← 5,
gapSize: INTEGER ← 5,
container: Viewer
];
Routines used by the Gargoyle interface code.
NewCurrent: PROC [name: Rope.ROPE, ggData: GGData] RETURNS [HistoryEvent];
equivalent to
SetCurrent[ggData, Create[name] ];
GetCurrent[ggData];
used to create a new current event at the start of a user operation
GetCurrent: PROC [ggData: GGData] RETURNS [event: HistoryEvent, index: INT];
returns event in progress and its event number
PushCurrent: PROC [ggData: GGData];
pushes current event in progress onto history list
used to make a completed history entry at the end of a user operation
NewCapture: PROC [name: Rope.ROPE, ggData: GGData];
makes a new currentEvent and captures the current scene
KillAdvanceCapture: PROC [ggData: GGData];
aborts advance capture when it is known to be out of date
DoAdvanceCapture: PROC [ggData: GGData];
called by RestoreScreenAndInvariants to use idle time for possibly useful (future) capture.
Routines that make entries on a HistoryEvent and perform actual undo of HistoryEvent
Note: PROC [event: HistoryEvent, historyProc: HistoryProc, historyData: REF Change];
adds <historyProc, historyData> to list of subevents
Undo: PROC [historyEvent: HistoryEvent, currentEvent: HistoryEvent];
calls historyProc[historyData, currentEvent] for each subevent
in reverse order that subevents originally happened
currentEvent arg is to record the effects of Undo so it too will be undoable
UndoN: PROC [ggData: GGData, N: INT ← 0];
undoes the top N events on the history list
Utility routines manipulating HistoryEvents.
Create: PROC [name: Rope.ROPE] RETURNS [HistoryEvent];
takes a rope as the name of this event for printing
SetCurrent: PROC [ggData: GGData, event: HistoryEvent]; -- sets current event to event
SetHistory: PROC [ggData: GGData, list: LIST OF HistoryEvent]; -- sets history list to list
GetHistory: PROC [ggData: GGData] RETURNS [LIST OF HistoryEvent];
Push: PROC [event: HistoryEvent, list: LIST OF HistoryEvent];
Reset: PROC [event: HistoryEvent];
resets the list of subevents to NIL. Attempts to free storage within the list elements.
ResetHistory: PROC [ggData: GGData];
empties the entire history. Attempts to free storage within the list elements.
Empty: PROC [event: HistoryEvent] RETURNS [BOOL];
returns true if subevents list is empty
HistoryTool procedures
BuildTool: PROC [caption: Rope.ROPE, ggData: GGData] RETURNS [HistoryTool];
Build a new HistoryTool for ggData
CapTool: PROC [caption: Rope.ROPE, ggData: GGData];
Change the HistoryTool caption
ClearTool: PROC [ggData: GGData];
Clear the history tool viewers
END.