Subversion Repositories filter_foundry

Rev

Rev 346 | Rev 424 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 346 Rev 393
Line 151... Line 151...
151
        int pad = 4 - (x % 4);
151
        int pad = 4 - (x % 4);
152
        if (pad == 0) pad = 4;
152
        if (pad == 0) pad = 4;
153
        return x + pad;
153
        return x + pad;
154
}
154
}
155
 
155
 
156
size_t fixpipl(PIPropertyList *pipl, size_t origsize, StringPtr title, long *event_id) {
156
size_t fixpipl(PIPropertyList *pipl, size_t origsize, char* title, long *event_id) {
157
        PIProperty *prop;
157
        PIProperty *prop;
158
        char *p;
158
        char *p;
159
        struct hstm_data {
159
        struct hstm_data {
160
                /* this structure must be 14+1 bytes long, to match PiPL structure */
160
                /* this structure must be 14+1 bytes long, to match PiPL structure */
161
                long version; /* = 0 */
161
                long version; /* = 0 */
Line 179... Line 179...
179
        /* add Title/Name property key */
179
        /* add Title/Name property key */
180
 
180
 
181
        prop->vendorID = kPhotoshopSignature;
181
        prop->vendorID = kPhotoshopSignature;
182
        prop->propertyKey = PINameProperty;
182
        prop->propertyKey = PINameProperty;
183
        prop->propertyID = 0;
183
        prop->propertyID = 0;
184
        prop->propertyLength = (SPInt32)roundToNext4((size_t)title[0] + 1);
184
        prop->propertyLength = (SPInt32)roundToNext4(strlen(title) + 1);
185
        memset(prop->propertyData, 0x00, prop->propertyLength); // fill padding with 00h bytes (cosmetics)
185
        memset(prop->propertyData, 0x00, prop->propertyLength); // fill padding with 00h bytes (cosmetics)
186
        PLstrcpy((StringPtr)prop->propertyData, title);
186
        myc2pstrcpy((StringPtr)prop->propertyData, title);
187
 
187
 
188
        // skip past new property record, and any padding
188
        // skip past new property record, and any padding
189
        p += offsetof(PIProperty, propertyData) + prop->propertyLength;
189
        p += offsetof(PIProperty, propertyData) + prop->propertyLength;
190
        prop = (PIProperty*)p;
190
        prop = (PIProperty*)p;
191
 
191
 
Line 193... Line 193...
193
 
193
 
194
        prop->vendorID = kPhotoshopSignature;
194
        prop->vendorID = kPhotoshopSignature;
195
        prop->propertyKey = PICategoryProperty;
195
        prop->propertyKey = PICategoryProperty;
196
        prop->propertyID = 0;
196
        prop->propertyID = 0;
197
 
197
 
198
        prop->propertyLength = (SPInt32)roundToNext4((size_t)gdata->parm.category[0] + 1);
198
        prop->propertyLength = (SPInt32)roundToNext4(strlen(gdata->parm.szCategory) + 1);
199
        memset(prop->propertyData, 0x00, prop->propertyLength); // fill padding with 00h bytes (cosmetics)
199
        memset(prop->propertyData, 0x00, prop->propertyLength); // fill padding with 00h bytes (cosmetics)
200
        PLstrcpy((StringPtr)prop->propertyData, gdata->parm.category);
200
        myc2pstrcpy((StringPtr)prop->propertyData, gdata->parm.szCategory);
201
 
201
 
202
        p += offsetof(PIProperty, propertyData) + prop->propertyLength;
202
        p += offsetof(PIProperty, propertyData) + prop->propertyLength;
203
        prop = (PIProperty*)p;
203
        prop = (PIProperty*)p;
204
 
204
 
205
        /* add HasTerminology property key */
205
        /* add HasTerminology property key */
Line 207... Line 207...
207
        hstm = (struct hstm_data*)prop->propertyData;
207
        hstm = (struct hstm_data*)prop->propertyData;
208
 
208
 
209
        scope = (char*)malloc(0x300);
209
        scope = (char*)malloc(0x300);
210
        if (!scope) return -1;
210
        if (!scope) return -1;
211
        sprintf(scope, "%s %s",
211
        sprintf(scope, "%s %s",
212
            INPLACEP2CSTR(gdata->parm.category),
212
            gdata->parm.szCategory,
213
            INPLACEP2CSTR(title));
213
            title);
214
 
214
 
215
        #ifdef ENABLE_APPLESCRIPT
215
        #ifdef ENABLE_APPLESCRIPT
216
        // If the uniqueString/scope is set, the plugin will only communicate with Photoshop.
216
        // If the uniqueString/scope is set, the plugin will only communicate with Photoshop.
217
        // Otherwise it can be accessed with AppleScript, but the AETE keys need to be unique then.
217
        // Otherwise it can be accessed with AppleScript, but the AETE keys need to be unique then.
218
        // This is achieved with getAeteKey().
218
        // This is achieved with getAeteKey().
Line 310... Line 310...
310
        char tmp[256];
310
        char tmp[256];
311
 
311
 
312
        if (pparm->ctl_used[ctlidx] || pparm->map_used[mapidx]) {
312
        if (pparm->ctl_used[ctlidx] || pparm->map_used[mapidx]) {
313
                if (pparm->map_used[mapidx]) {
313
                if (pparm->map_used[mapidx]) {
314
                        if (ctlidx & 1) {
314
                        if (ctlidx & 1) {
315
                                sprintf(tmp, "... %s", (char*)pparm->map[mapidx]);
315
                                sprintf(tmp, "... %s", pparm->szMap[mapidx]);
316
                        } else {
316
                        } else {
317
                                sprintf(tmp, "%s ...", (char*)pparm->map[mapidx]);
317
                                sprintf(tmp, "%s ...", pparm->szMap[mapidx]);
318
                        }
318
                        }
319
                        AETE_WRITE_C2PSTR(tmp);
319
                        AETE_WRITE_C2PSTR(tmp);
320
                } else {
320
                } else {
321
                        AETE_WRITE_P2PSTR((char*)pparm->ctl[ctlidx]);
321
                        AETE_WRITE_C2PSTR(pparm->szCtl[ctlidx]);
322
                }
322
                }
323
                AETE_ALIGN_WORD();
323
                AETE_ALIGN_WORD();
324
                AETE_WRITE_DWORD(key);
324
                AETE_WRITE_DWORD(key);
325
                AETE_WRITE_DWORD(typeSInt32);
325
                AETE_WRITE_DWORD(typeSInt32);
326
                AETE_WRITE_C2PSTR(_strdup(""));
326
                AETE_WRITE_C2PSTR(_strdup(""));
Line 352... Line 352...
352
        AETE_WRITE_BYTE(0x00); /* aete version */
352
        AETE_WRITE_BYTE(0x00); /* aete version */
353
        AETE_WRITE_WORD(english); /* language specifiers */
353
        AETE_WRITE_WORD(english); /* language specifiers */
354
        AETE_WRITE_WORD(roman);
354
        AETE_WRITE_WORD(roman);
355
        AETE_WRITE_WORD(1); /* 1 suite */
355
        AETE_WRITE_WORD(1); /* 1 suite */
356
        {
356
        {
357
                AETE_WRITE_P2PSTR((char*)pparm->author); /* vendor suite name */
357
                AETE_WRITE_C2PSTR(pparm->szAuthor); /* vendor suite name */
358
                AETE_WRITE_C2PSTR(_strdup("")); /* optional description */
358
                AETE_WRITE_C2PSTR(_strdup("")); /* optional description */
359
                AETE_ALIGN_WORD();
359
                AETE_ALIGN_WORD();
360
                AETE_WRITE_DWORD(plugInSuiteID); /* suite ID */
360
                AETE_WRITE_DWORD(plugInSuiteID); /* suite ID */
361
                AETE_WRITE_WORD(1); /* suite code, must be 1. Attention: Filters like 'Pointillize' have set this to 0! */
361
                AETE_WRITE_WORD(1); /* suite code, must be 1. Attention: Filters like 'Pointillize' have set this to 0! */
362
                AETE_WRITE_WORD(1); /* suite level, must be 1. Attention: Filters like 'Pointillize' have set this to 0! */
362
                AETE_WRITE_WORD(1); /* suite level, must be 1. Attention: Filters like 'Pointillize' have set this to 0! */
363
                AETE_WRITE_WORD(1); /* 1 event (structure for filters) */
363
                AETE_WRITE_WORD(1); /* 1 event (structure for filters) */
364
                {
364
                {
365
                        AETE_WRITE_P2PSTR((char*)pparm->title); /* event name */
365
                        AETE_WRITE_C2PSTR(pparm->szTitle); /* event name */
366
                        AETE_WRITE_C2PSTR(_strdup("")); /* event description */
366
                        AETE_WRITE_C2PSTR(_strdup("")); /* event description */
367
                        AETE_ALIGN_WORD();
367
                        AETE_ALIGN_WORD();
368
                        AETE_WRITE_DWORD(plugInClassID); /* event class */
368
                        AETE_WRITE_DWORD(plugInClassID); /* event class */
369
                        AETE_WRITE_DWORD(/*plugInEventID*/event_id); /* event ID */
369
                        AETE_WRITE_DWORD(/*plugInEventID*/event_id); /* event ID */
370
                        /* NO_REPLY: */
370
                        /* NO_REPLY: */