
C
HAPTER
1: Overview
Plug-in entry point and messages
13
Core message actions
The following table contains the set of core message actions received by all plug-ins and corresponding
actions your plug-in should take.
Reload and unload messages
Whenever a plug-in is loaded into memory or unloaded from memory, Illustrator sends it an
access
message action:
#define kSPAccessCaller "SP Access"
#define kSPAccessUnloadSelector"Unload"
#define kSPAccessReloadSelector"Reload"
The message action contains the
access caller
and a
reload
or
unload
selector. This is your plug-in’s
opportunity to set up, restore, or save state information. The access caller/selectors bracket all other callers
and selectors.
Access messages bracket all other messages. Reload is the first message your plug-in receives; Unload, the
last. At these times, your plug-in should not acquire or release suites other than those built into Illustrator.
Start-up and shut-down messages
Illustrator has two core interface message actions, where the plug-in can interact with the application:
#define kSPInterfaceCaller
"SP Interface"
#define kSPInterfaceStartupSelector
"Startup"
#define kSPInterfaceShutdownSelector
"Shutdown"
When Illustrator is launched, it sends a “startup” message to each plug-in it finds. This allows your plug-in
to allocate global memory, add user-interface items to Illustrator, register suites, or perform other
initialization. The start-up message action consists of the interface caller (
kSPInterfaceCaller
) and
start-up selector (
kSPInterfaceStartupSelector
).
When the user quits Illustrator, it sends each plug-in a “shutdown” message. The shut-down message
action comprises the interface caller (
kSPInterfaceCaller
) and shut-down selector
(
kSPInterfaceShutdownSelector
). Shut-down is intended for flushing files and preserving preferences,
not destruction. A plug-in that exports a suite should not dispose of its plug-in globals or suite
information, since it may be called after its own shut-down by another plug-in’s shut-down. For example, if
Caller
Selector
Action to perform
kSPAccessCaller
(“SP Access”)
kSPAccessReloadSelector
(“Reload”)
Restore any state information (globals).
kSPAccessUnloadSelector
(“Unload”)
Save any state information (globals).
kSPInterfaceCaller
(“SP Interface”)
kSPInterfaceStartupSelector
(“Startup”)
Initialize globals and add features to the
application.
kSPInterfaceShutdownSelector
(“Shutdown”)
Free globals, remove features from the
application, and save preferences.