The following section defines some commonly used terms to describe the multiple document interface.
The document that has window focus, and receives the next user input event, unless the user is switching to (activating) another document. The active document is always the current document when processing user input, but programs can temporarily change the current document during some operations.
The overall running program and associated objects that are common to all open documents, such as the MFC class CWinApp. There is one and only one application per invocation of an executable program.
Short for “application execution context.” See “Execution Context, Application”.
Throughout this section, the term “command” refers to a variety of AutoCAD constructs. A command consists of a program sequence performed as a logical unit of work that can be requested by the user or one of the AutoCAD scripting engines. No matter what construct is used, a command can be undone independently of other actions performed during system operation.
Specifically for the MDI API, a command is a sequence of code that begins by locking a document and ends by unlocking a document. In common cases, this locking and unlocking will be performed by ObjectARX but during other times the application must do the locking and unlocking directly. All of the following AutoCAD constructs are commands:
A set of commands that appears as one command to the user, during which the user can change the current document and a continued logical flow of user prompting is maintained. For example, if an active command is prompting for user input in the current document and the user switches the document, the application cancels the command in the old current document, and queues up a command to commence execution in the new current document.
A command that cannot be executed in more than one document at a time. Nonreentrancy can be used for commands that should not be available for more than one document at a time, or when the demands of supporting multiple instantiation are too great to be worth the overhead.
The standard input message polling mechanism in AutoCAD that facilitates combined keyboard and digitizer interaction. A separate command processor exists for each open document. The state of the command processor is maintained as an execution context.
Programmatic requests can be made to cause a document's execution context to become active without the user actually perceiving the document as “activated.” This is a transient state only, used primarily by ActiveX and VBA applications.
An AutoCAD drawing, specifically an instance of AcDbDatabase. Although the database is part of a document, it is not synonymous with a document.
A document consists of an MDI document window, an execution context, an associated editor state, and a single current database, plus any number of side databases that are opened in association with it. The current database is the one being displayed and edited via commands. The side databases are either used by xref or for general use. The document also includes system variables that are associated with a given drawing such as the current viewport variable. Documents are uniquely identified by their address, which is the AcApDocument* pointer.
Synonymous with database.
Usually synonymous with document, but sometimes includes its entire history since the document was opened, as well as the current state of the session.
The command state that is active when new OS level messages are pending. It is independent from all document execution contexts.
The following types of commands execute from this context:
These types of commands typically work on the active document, although they are not bound to do so. The intent is to handle document locking and unlocking reasonably transparently for external ActiveX applications and VBA. However, ObjectARX applications posting modeless dialogs will be required to lock and unlock documents explicitly in order to interact with their databases.
ObjectARX applications that meet all criteria needed to be successfully executed in an MDI AutoCAD. These criteria are listed in the section MDI-Aware Level. ObjectARX applications can register themselves as MDI aware by calling
acrxDynamicLinker->registerAppMDIAware(pkt);
when receiving the kInitAppMsg within their acrxEntryPoint() function.
A data structure that needs to exist only once per application.
A data structure that needs to be instantiated and maintained for each execution context, including document execution contexts and the application execution context. The AutoCAD command processor is an example of a per-context instantiation.
Any data structure, value, or other item that needs to be instantiated and maintained for each document.
When the command processor in a given edit session has no active
At this point, the Command prompt is being displayed in the command window. Notice that modeless dialogs and toolbars can be posted, as they do not operate through the command processor.
Synonymous with application.
A repository of state recorded during an edit session, which is used to undo the edit session command by command, when requested. Databases are often associated with an undo stack, which is supplied by the host application. In the case of AutoCAD, databases are typically opened under only one document at a time, because undo stacks correspond to documents.