Rev 237 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
259 | daniel-mar | 1 | /* |
2 | This file is part of a common library for Adobe(R) Illustrator(R) plugins |
||
3 | Copyright (C) 2002-6 Toby Thain, toby@telegraphics.com.au |
||
4 | |||
5 | This program is free software; you can redistribute it and/or modify |
||
6 | it under the terms of the GNU General Public License as published by |
||
7 | the Free Software Foundation; either version 2 of the License, or |
||
8 | (at your option) any later version. |
||
9 | |||
10 | This program is distributed in the hope that it will be useful, |
||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
13 | GNU General Public License for more details. |
||
14 | |||
15 | You should have received a copy of the GNU General Public License |
||
16 | along with this program; if not, write to the Free Software |
||
17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||
18 | */ |
||
19 | |||
20 | #include <stdio.h> |
||
21 | |||
22 | #include "aipluginmain.h" |
||
23 | |||
24 | DLLEXPORT SPAPI |
||
25 | PLUGINRETURN ENTRYPOINT( char *caller, char *selector, SPMessageData *message ){ |
||
26 | SPBasicSuite *b = message->basic; |
||
27 | SPErr e = kSPNoError; |
||
28 | |||
29 | EnterCodeResource(); |
||
30 | |||
31 | // char s[0x100]; sprintf(s,"PluginMain(\"%s\",\"%s\")",caller,selector); dbg(s); |
||
32 | |||
33 | if( message->SPCheck == kSPValidSPMessageData ){ |
||
34 | |||
35 | if(b->IsEqual(caller, kSPInterfaceCaller)){ |
||
36 | if(b->IsEqual(selector, kSPInterfaceStartupSelector)) |
||
37 | e = plugin_startup( (SPInterfaceMessage*)message ); |
||
38 | else if(b->IsEqual(selector, kSPInterfaceShutdownSelector)){ |
||
39 | e = plugin_shutdown( (SPInterfaceMessage*)message ); |
||
40 | }else if(b->IsEqual(selector, kSPInterfaceAboutSelector)) |
||
41 | e = plugin_about( (SPInterfaceMessage*)message ); |
||
42 | } |
||
43 | #ifdef ISFILTER |
||
44 | else if(b->IsEqual(caller, kCallerAIFilter)){ |
||
45 | if(b->IsEqual(selector, kSelectorAIGoFilter)) |
||
46 | e = filter_go( (AIFilterMessage*)message ); |
||
47 | } |
||
48 | #endif |
||
49 | #ifdef ISTOOL |
||
50 | else if(b->IsEqual( caller, kCallerAITool)){ |
||
51 | if(b->IsEqual(selector, kSelectorAIEditToolOptions)) |
||
52 | e = toolOptions( (AIToolMessage*)message ); |
||
53 | else if(b->IsEqual(selector, kSelectorAITrackToolCursor)) |
||
54 | e = toolTrackCursor( (AIToolMessage*)message ); |
||
55 | else if(b->IsEqual(selector, kSelectorAIToolMouseDown)) |
||
56 | e = toolMouseDown( (AIToolMessage*)message ); |
||
57 | else if(b->IsEqual(selector, kSelectorAIToolMouseDrag)) |
||
58 | e = toolMouseDrag( (AIToolMessage*)message ); |
||
59 | else if(b->IsEqual(selector, kSelectorAIToolMouseUp)) |
||
60 | e = toolMouseUp( (AIToolMessage*)message ); |
||
61 | else if(b->IsEqual(selector, kSelectorAISelectTool)) |
||
62 | e = toolSelect( (AIToolMessage*)message ); |
||
63 | else if(b->IsEqual(selector, kSelectorAIDeselectTool)) |
||
64 | e = toolDeselect( (AIToolMessage*)message ); |
||
65 | } |
||
66 | #endif |
||
67 | |||
68 | }else{ |
||
69 | char s[0x100]; |
||
70 | sprintf(s,"invalid SPCheck (caller=\"%s\",selector=\"%s\")",caller,selector); |
||
71 | dbg(s); |
||
72 | } |
||
73 | |||
74 | ExitCodeResource(); |
||
75 | |||
76 | return e; |
||
77 | } |
||
78 | |||
79 | SPErr acq_suite(SPMessageData *m, char *name, long version, ppsuite suite) |
||
80 | { |
||
81 | unsigned long e = m->basic->AcquireSuite(name, version, suite); |
||
82 | if(e){ |
||
83 | char s[0x200], ai_vers[16]; |
||
84 | |||
85 | // version is BCD encoded, e.g. 0xNN000000 |
||
86 | int v = 10*(kPluginInterfaceVersion >> 28) + ((kPluginInterfaceVersion >> 24) & 0xf); |
||
87 | |||
88 | if(v > 10) |
||
89 | sprintf(ai_vers, "CS%c", v > 11 ? v+'1'-11 : ' '); |
||
90 | else |
||
91 | sprintf(ai_vers, "%d", v); |
||
92 | |||
93 | sprintf(s, "Could not load the plugin.\n\n" |
||
94 | "This plugin was built for Illustrator %s.\n\n" |
||
95 | "Please obtain the correct version for your installation " |
||
96 | "from https://www.telegraphics.com.au/sw/\n" |
||
97 | "or contact support@telegraphics.com.au if you cannot resolve the problem.\n\n" |
||
98 | "Details: AcquireSuite failed \"%s\" (%ld): %c%c%c%c", |
||
99 | ai_vers, name, version, (int)(e>>24), (int)(e>>16), (int)(e>>8), (int)e); |
||
100 | dbg(s); |
||
101 | } |
||
102 | return e; |
||
103 | } |