Scroll to navigation

Unidraw(3U) InterViews Reference Manual Unidraw(3U)

NAME

Unidraw - one-of-a-kind object for coordinating and controlling aUnidraw application

SYNOPSIS

#include <Unidraw/unidraw.h>

DESCRIPTION

Unidraw applications create a single instance of a Unidraw object,which does several things. It creates a World, establishing theconnection to the underlying window system. It initializes thecatalog and other objects, manages editor instances, and defines theapplication main loop. It also maintains histories of commands thathave be executed and reverse-executed for each component hierarchybeing edited. Finally, it cleans up internal state when it is deletedto ensure orderly program termination.

The Unidraw object must be created before opening any editors butafter creating a catalog. Below is the main program for a typicalUnidraw application:


);
}

PUBLICOPERATIONS

)

The first constructor form requires a catalog object and command lineargument information. Other arguments include pointers toPropertyData and OptionDesc arrays. This constructor creates a Worldinstance, passing whichever of these arguments are supplied (exceptthe catalog). To specify a World instance explicitly, use the secondconstructor form.
Run initiates the main loop of the program. The call to Run returnswhen Quit is called.
Bring the screen up to date with the state of the application'sobjects. By default, this involves moving connectors to their properpositions (by calling Solve on the global csolver object) and tellingeditors to update themselves (by calling their Update functions).Because Update may carry out potentially lengthy operations, Unidrawbatches Update calls by default. This ensures that multipleconsecutive calls do not induce redundant computations. To force animmediate update, simply call Update(true).
Open inserts an editor into the world, making it visible on thedisplay. The user positions the editor's window by default. Openedreturns whether an editor has been opened already.
Close closes a specified editor, removing it from the user's viewand deleting it. CloseDependents closes those editors that report a dependence on the given component via their DependsOn operation. CloseAll closes all open editors. ~Unidraw calls CloseAll.
Operations for iterating over the Unidraw object's list of openeditors. First initializes an iterator to point to the beginning ofthe list, Next increments the iterator to point to the followingeditor, and Done returns whether or not the iterator points beyond thefirst or last editor in the list.
Return the editor to which an iterator points.
Operations for finding an (or the) editor associated with a givencomponent. Find searches the list of editors for the one whoseGetComponent operation returns the given component. FindAny returnsthe first editor in the list whose GetComponent operation returns acomponent in the same hierarchy as the the given component.
Return the catalog passed to the constructor.
Return the world object, which the Unidraw object creates when it isinstantiated.
The Unidraw object maintains histories of commands associated with agiven component hierarchy. There are two command histories perhierarchy: the past history and the future history. These histories normally contain commands that have been executed and unexecuted to support arbitrary level undo and redo. For example, after a viewer executes the command that a tool generates by interpreting a manipulator, it will record that command in a past history for possible undoing in the future.

The Log operation logs a command, placing it on the past history forthe component hierarchy being edited. Log determines the past that isapproprate from the command's editor, which specifies the component(hence the hierarchy) that it is editing. Undo reverse-executes thelast i commands that were logged for a given component's hierarchy and moves them from their past history to the corresponding future history. Redo re-executes the future i commands and moves them to the past. Note that calling Redo without a preceding Undo is meaningless; thus calling Log will clear the future history associated with the affected component hierarchy.

Assign and retrieve the maximum command history length. No more thanthis many commands can be undone and redone. The default length is20. Older commands are deleted automatically as new commands arelogged.
Clear the past and future for a given component hierarchy, deletingthe corresponding commands. All histories are cleared if no componentis specified.
Clear the history associated with the given editor's component if noother editor is editing the same hierarchy. For example,Unidraw::Close calls this operation to avoid clearing histories when acomponent hierarchy is being edited in multiple editors.

PROTECTEDOPERATIONS

Process is called once in the main loop defined by the Run operation.It does nothing by default. Subclasses may redefine Process to carryout any processing that should be done in each pass through the mainloop.
This convenience function queries the given editor for aModifStatusVar instance. If it has one, then it returns its status(modified or unmodified); otherwise it returns false.
These operations support deferred editor deletion, a mechanism toavoid deleting editors prematurely. For example, if a command toclose the editor is invoked from a pull-down menu, then the commandmust not delete the editor, since that will delete the pull-down menubefore it has a chance to close. Thus Close and similar operations donot delete editors directly; instead, they call Mark to indicate thatan editor should be deleted sometime in the future. Sweep actuallydeletes the editors that have been marked. By default, Unidraw::Runcalls Sweep each time an event is handled.
A helper function that performs an immediate update independent of thebatching mechanism.
Command histories are stored as ULists. These operations provide alow-level interface to the lists themselves; the corresponding publicoperations are built on top. GetHistory returns the past and futurelists for a given component, while ClearHistory deletes the firsti commands on the given list.
Convenience functions for extracting the list element in an iteratorand the command object from the list element. These are useful inconjunction with protected history operations described above.
The first form of this function returns true if there are pending Update(s) to be performed. The second form sets this value explicitly.
The first form of this function returns true if the program is in the run loop defined by Run. The second form sets this value explicitly.

SEEALSO

Catalog(3U), Creator(3U), Editor(3U), Interactor(3U), Iterator(3U),Viewer(3I), UList(3U), World(3I), statevars(3U)

4 October 1990 Unidraw