
C
HAPTER
1: Overview
Illustrator API
17
When your plug-in is first called, it “knows about” only the Basic suite (see
SPBasicSuite
), which was
introduced earlier in this chapter (as part of the
SPMessageData
structure). The Basic suite is used to
acquire and release other suites.
The following code snippet shows how to pop an alert on start-up using the ADM Basic suite (see
ADMBasicSuite
).
extern "C" ASAPI ASErr PluginMain(char* caller, char* selector, void* message)
{
ASErr error = kASNoError;
if (strcmp(caller, kSPInterfaceCaller)==0) {
if (strcmp(selector, kSPInterfaceStartupSelector)==0) {
SPMessageData* messageData = (SPMessageData*)message;
SPBasicSuite* sSPBasic = messageData->basic;
ADMBasicSuite11* sADMBasic = nil;
error = sSPBasic->AcquireSuite(kADMBasicSuite, kADMBasicSuiteVersion11,
(const void**)&sADMBasic);
if (error == kNoError) {
sADMBasic->MessageAlert("HelloWorld!");
sSPBasic->ReleaseSuite(kADMBasicSuite, kADMBasicSuiteVersion);
}
}
}
return error;
}
This code snippet is intended to show only the concepts of acquiring, using, and releasing a suite; this is
not the preferred way to acquire and release suites. To see how suites normally are acquired and released,
see the sample plug-ins provided in the SDK.
Publishing suites
All plug-ins use suites, since they are the fundamental mechanism of the Illustrator API. Plug-ins also can
publish suites of their own, for use by other plug-ins. This feature, where plug-ins may be both clients of
suites and publishers of suites, is extremely powerful. Several plug-ins included with Illustrator publish
suites used by many other plug-ins.
From the plug-in’s perspective, it is unimportant whether a particular suite is implemented within
Illustrator itself or as a plug-in. The Illustrator plug-in manager is responsible for managing suites among
various plug-ins and the application.
To export a suite, a plug-in must call
SPSuitesSuite::AddSuite
on start-up. We also recommend that a
plug-in declare a
PIExportsProperty
in its PiPL, to allow Illustrator to optimize the plug-in initialization
process. Illustrator always tries to load plug-ins with a
PIExportsProperty
first, so other plug-ins that
depend on exported suites can load and start up successfully on the first try.
For more information on how to publish suites, see
SPSuitesSuite::AddSuite
in
Adobe Illustrator API
Reference
and
“Export property” on page 36
.
Binary compatibility
Illustrator makes its best effort to support binary compatibility across two previous product versions. For
example, this means a plug-in built with the Illustrator CS3 SDK or Illustrator CS4 SDK should load and run
under Illustrator CS5. Changes to the development, operating system, or hardware platform can
compromise this objective.