Subversion Repositories filter_foundry

Rev

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

Rev 369 Rev 373
Line 78... Line 78...
78
        for (i = 0; i < 4; i++) hash += hash += djb2((char*)parm->formula[i]);
78
        for (i = 0; i < 4; i++) hash += hash += djb2((char*)parm->formula[i]);
79
 
79
 
80
        return hash;
80
        return hash;
81
}
81
}
82
 
82
 
-
 
83
void get_temp_afs(char *outfilename, Boolean isStandalone, PARM_T *parm) {
-
 
84
        char* tempdir;
-
 
85
        int hash;
-
 
86
 
-
 
87
        tempdir = getenv("TMP");
-
 
88
        #ifdef WIN_ENV
-
 
89
        if (strlen(tempdir) > 0) strcat(tempdir, "\\");
-
 
90
        #else
-
 
91
        if (strlen(tempdir) > 0) strcat(tempdir, "/");
-
 
92
        #endif
-
 
93
 
-
 
94
        hash = (isStandalone) ? get_parm_hash(parm) : 0;
-
 
95
        sprintf(outfilename, "%sFilterFoundry%d.afs", tempdir, hash);
-
 
96
}
-
 
97
 
83
DLLEXPORT MACPASCAL
98
DLLEXPORT MACPASCAL
84
void ENTRYPOINT(short selector, FilterRecordPtr pb, intptr_t *data, short *result){
99
void ENTRYPOINT(short selector, FilterRecordPtr pb, intptr_t *data, short *result){
85
        static Boolean wantdialog = false;
100
        static Boolean wantdialog = false;
86
        static Boolean premiereWarnedOnce = false;
101
        static Boolean premiereWarnedOnce = false;
87
        OSErr e = noErr;
102
        OSErr e = noErr;
Line 270... Line 285...
270
                                           Workaround in FF 1.7: If the host GIMP is detected, then a special mode will be activated.
285
                                           Workaround in FF 1.7: If the host GIMP is detected, then a special mode will be activated.
271
                                           This mode saves the filter data into a temporary file "FilterFoundryXX.afs" and loads it
286
                                           This mode saves the filter data into a temporary file "FilterFoundryXX.afs" and loads it
272
                                           when the window is opened again. */
287
                                           when the window is opened again. */
273
                                        // Workaround: Save settings in "FilterFoundryXX.afs" if the host does not preserve pb->parameters
288
                                        // Workaround: Save settings in "FilterFoundryXX.afs" if the host does not preserve pb->parameters
274
                                        char outfilename[255];
289
                                        char outfilename[255];
275
                                        char* tempdir;
-
 
276
                                        int hash;
-
 
277
                                        StandardFileReply sfr;
290
                                        StandardFileReply sfr;
278
                                        char* bakexpr[4];
291
                                        char* bakexpr[4];
279
 
292
 
280
                                        sfr.sfGood = true;
293
                                        sfr.sfGood = true;
281
                                        sfr.sfReplacing = true;
294
                                        sfr.sfReplacing = true;
282
                                        sfr.sfType = PS_FILTER_FILETYPE;
295
                                        sfr.sfType = PS_FILTER_FILETYPE;
283
 
296
 
284
                                        tempdir = getenv("TMP");
-
 
285
                                        #ifdef WIN_ENV
-
 
286
                                        if (strlen(tempdir) > 0) strcat(tempdir, "\\");
-
 
287
                                        #else
-
 
288
                                        if (strlen(tempdir) > 0) strcat(tempdir, "/");
-
 
289
                                        #endif
-
 
290
 
-
 
291
                                        hash = (gdata->standalone) ? get_parm_hash(&gdata->parm) : 0;
-
 
292
                                        sprintf(outfilename, "%sFilterFoundry%d.afs", tempdir, hash);
297
                                        get_temp_afs(&outfilename[0], gdata->standalone, &gdata->parm);
293
 
298
 
294
                                        myc2pstrcpy(sfr.sfFile.name, outfilename);
299
                                        myc2pstrcpy(sfr.sfFile.name, outfilename);
295
                                        #ifdef WIN_ENV
300
                                        #ifdef WIN_ENV
296
                                        sfr.nFileExtension = (WORD)(strlen(outfilename) - strlen(".afs") + 1);
301
                                        sfr.nFileExtension = (WORD)(strlen(outfilename) - strlen(".afs") + 1);
297
                                        #endif
302
                                        #endif
Line 362... Line 367...
362
        Boolean showdialog;
367
        Boolean showdialog;
363
 
368
 
364
        if (!host_preserves_parameters()) {
369
        if (!host_preserves_parameters()) {
365
                // Workaround: Load settings in "FilterFoundryXX.afs" if host does not preserve pb->parameters
370
                // Workaround: Load settings in "FilterFoundryXX.afs" if host does not preserve pb->parameters
366
                char outfilename[255];
371
                char outfilename[255];
367
                char* tempdir;
-
 
368
                int hash;
-
 
369
                Boolean isStandalone;
372
                Boolean isStandalone;
370
                StandardFileReply sfr;
373
                StandardFileReply sfr;
371
                char* bakexpr[4];
374
                char* bakexpr[4];
372
 
375
 
373
                sfr.sfGood = true;
376
                sfr.sfGood = true;
Line 387... Line 390...
387
                        }
390
                        }
388
                        gdata->parmloaded = false;
391
                        gdata->parmloaded = false;
389
                        return false;
392
                        return false;
390
                }
393
                }
391
 
394
 
392
                tempdir = getenv("TMP");
-
 
393
                #ifdef WIN_ENV
-
 
394
                if (strlen(tempdir) > 0) strcat(tempdir, "\\");
-
 
395
                #else
-
 
396
                if (strlen(tempdir) > 0) strcat(tempdir, "/");
-
 
397
                #endif
-
 
398
 
-
 
399
                hash = (isStandalone) ? get_parm_hash(&gdata->parm) : 0;
395
                get_temp_afs(&outfilename[0], isStandalone, &gdata->parm);
400
                sprintf(outfilename, "%sFilterFoundry%d.afs", tempdir, hash);
-
 
401
 
396
 
402
                myc2pstrcpy(sfr.sfFile.name, outfilename);
397
                myc2pstrcpy(sfr.sfFile.name, outfilename);
403
                #ifdef WIN_ENV
398
                #ifdef WIN_ENV
404
                sfr.nFileExtension = (WORD)(strlen(outfilename) - strlen(".afs") + 1);
399
                sfr.nFileExtension = (WORD)(strlen(outfilename) - strlen(".afs") + 1);
405
                #endif
400
                #endif