Rev 211 | Rev 216 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 211 | Rev 212 | ||
---|---|---|---|
Line 30... | Line 30... | ||
30 | #include "PITerminology.h" |
30 | #include "PITerminology.h" |
31 | 31 | ||
32 | #include "compat_string.h" |
32 | #include "compat_string.h" |
33 | 33 | ||
34 | //#define PRINTABLE_HASH_FF16 |
34 | //#define PRINTABLE_HASH_FF16 |
- | 35 | #define ENABLE_APPLESCRIPT |
|
35 | 36 | ||
36 | /* |
37 | /* |
37 | Find a printable 4-character key, remembering (see Photoshop API guide): |
38 | Find a printable 4-character key, remembering (see Photoshop API guide): |
38 | - All IDs starting with an uppercase letter are reserved by Adobe. |
39 | - All IDs starting with an uppercase letter are reserved by Adobe. |
39 | - All IDs that are all uppercase are reserved by Apple. |
40 | - All IDs that are all uppercase are reserved by Apple. |
Line 171... | Line 172... | ||
171 | /* add Title/Name property key */ |
172 | /* add Title/Name property key */ |
172 | 173 | ||
173 | prop->vendorID = kPhotoshopSignature; |
174 | prop->vendorID = kPhotoshopSignature; |
174 | prop->propertyKey = PINameProperty; |
175 | prop->propertyKey = PINameProperty; |
175 | prop->propertyID = 0; |
176 | prop->propertyID = 0; |
- | 177 | // TODO: The padding should be zeroed out, otherwise we might have residues inside the PIPL |
|
176 | prop->propertyLength = roundToNext4(title[0] + 1); |
178 | prop->propertyLength = roundToNext4(title[0] + 1); |
177 | PLstrcpy((StringPtr)prop->propertyData, title); |
179 | PLstrcpy((StringPtr)prop->propertyData, title); |
178 | 180 | ||
179 | // skip past new property record, and any padding |
181 | // skip past new property record, and any padding |
180 | p += offsetof(PIProperty, propertyData) + prop->propertyLength; |
182 | p += offsetof(PIProperty, propertyData) + prop->propertyLength; |
Line 183... | Line 185... | ||
183 | /* add Category property key */ |
185 | /* add Category property key */ |
184 | 186 | ||
185 | prop->vendorID = kPhotoshopSignature; |
187 | prop->vendorID = kPhotoshopSignature; |
186 | prop->propertyKey = PICategoryProperty; |
188 | prop->propertyKey = PICategoryProperty; |
187 | prop->propertyID = 0; |
189 | prop->propertyID = 0; |
- | 190 | // TODO: The padding should be zeroed out, otherwise we might have residues inside the PIPL |
|
188 | prop->propertyLength = roundToNext4(gdata->parm.category[0] + 1); |
191 | prop->propertyLength = roundToNext4(gdata->parm.category[0] + 1); |
189 | PLstrcpy((StringPtr)prop->propertyData, gdata->parm.category); |
192 | PLstrcpy((StringPtr)prop->propertyData, gdata->parm.category); |
190 | 193 | ||
191 | p += offsetof(PIProperty, propertyData) + prop->propertyLength; |
194 | p += offsetof(PIProperty, propertyData) + prop->propertyLength; |
192 | prop = (PIProperty*)p; |
195 | prop = (PIProperty*)p; |
193 | 196 | ||
194 | /* add HasTerminology property key */ |
197 | /* add HasTerminology property key */ |
195 | 198 | ||
- | 199 | hstm = (struct hstm_data*)prop->propertyData; |
|
- | 200 | ||
- | 201 | #ifdef ENABLE_APPLESCRIPT |
|
- | 202 | // If the uniqueString/scope is set, the plugin will only communicate with Photoshop. |
|
- | 203 | // Otherwise it can be accessed with AppleScript, but the AETE keys need to be unique then. |
|
- | 204 | // This is achieved with getAeteKey(). |
|
- | 205 | scopelen = sprintf(hstm->scope, ""); |
|
- | 206 | #else |
|
196 | /* construct scope string by concatenating Category and Title - hopefully unique! */ |
207 | // Construct scope string by concatenating Category and Title - hopefully unique! |
197 | // Note: In doresources() we malloc'ed 300h additional bytes, |
208 | // Note: In doresources() we malloc'ed 300h additional bytes, |
198 | // and in the build dialog, title and category are size-limited, |
209 | // and in the build dialog, title and category are size-limited, |
199 | // so we can write here without malloc. |
210 | // so we can write here without malloc. |
200 | hstm = (struct hstm_data*)prop->propertyData; |
- | |
201 | scopelen = sprintf(hstm->scope, "%s %s", |
211 | scopelen = sprintf(hstm->scope, "%s %s", |
202 | INPLACEP2CSTR(gdata->parm.category), |
212 | INPLACEP2CSTR(gdata->parm.category), |
203 | INPLACEP2CSTR(title)); |
213 | INPLACEP2CSTR(title)); |
- | 214 | #endif |
|
204 | 215 | ||
205 | /* make up a new event ID for this aete, based on printable base-95 hash of scope */ |
216 | /* make up a new event ID for this aete, based on printable base-95 hash of scope */ |
206 | hash = djb2(hstm->scope); |
217 | hash = djb2(hstm->scope); |
207 | *event_id = printablehash(hash); /* this is used by aete_generate() later... */ |
218 | *event_id = printablehash(hash); /* this is used by aete_generate() later... */ |
208 | 219 | ||
209 | prop->vendorID = kPhotoshopSignature; |
220 | prop->vendorID = kPhotoshopSignature; |
210 | prop->propertyKey = PIHasTerminologyProperty; |
221 | prop->propertyKey = PIHasTerminologyProperty; |
211 | prop->propertyID = 0; |
222 | prop->propertyID = 0; |
- | 223 | // TODO: The padding should be zeroed out, otherwise we might have residues inside the PIPL |
|
212 | prop->propertyLength = roundToNext4(offsetof(struct hstm_data, scope) + scopelen); |
224 | prop->propertyLength = roundToNext4(offsetof(struct hstm_data, scope) + scopelen); |
213 | 225 | ||
214 | hstm->version = 0; |
226 | hstm->version = 0; |
215 | hstm->class_id = plugInClassID; |
227 | hstm->class_id = plugInClassID; |
216 | hstm->event_id = *event_id; |
228 | hstm->event_id = *event_id; |