-- file EntityEditor.mesa
-- created by Donahue, October 18, 1982 1:48 pm
-- last edited by: Donahue December 29, 1982 11:57 am

DIRECTORY
DB: TYPE USING[ Entity, Segment ],
ViewerClasses: TYPE USING[ Viewer ],
VTables: TYPE USING[ VTable ];

EntityEditor: DEFINITIONS IMPORTS DB =

BEGIN OPEN DB, ViewerClasses, VTables;

SaveFailed: ERROR;

DisplayEntities: PROC[ of: Entity, parent: Viewer, in: DB.Segment,
        noEdits: BOOLEANFALSE ] RETURNS[ viewer: VTable ];
-- make a nested viewer (a VTable) that has all of the tuples for the "*" relation, using the
-- entity provided as the "of" field
-- if noEdits is true then the table produced cannot be changed
-- the viewer produced is NOT painted
-- the entities are displayed in iconic form (yellow-bugging them "opens" them, blue-bugging
-- deletes them from the display)

NewEntry: PROC[ is: Entity, table: VTable ];
-- add a new entry to the table
-- The table will be expanded as necessary to contain the new icon (duplicates are not stored)
-- Again, the table is not painted and no updates are actually made to the database

SaveEntities: PROC[ viewer: Viewer, in: DB.Segment, newOf: Entity ← NIL ];
-- given a table set up by DisplayEntities, add all of its contents to the database
-- if a newOf is provided, then it will be used to create new relationships with all of the
-- entities that are displayed in the table; otherwise all of the existing relationships for the
-- entity provided when the table was created will be updated
-- if a log is provided, then all changes will be logged

END.