Subversion Repositories filter_foundry

Compare Revisions

Regard whitespace Rev 555 → Rev 554

/trunk/save.c
47,11 → 47,11
return e;
}
 
OSErr saveparams_afs_pff(Handle h, Boolean premiereOrder){
OSErr saveparams_afs_pff(Handle h){
char outbuf[CHOPLINES * 2 + 2] = "";
char *q, * p, * r, * start;
size_t n, chunk, j;
int i, k;
int i;
OSErr e;
size_t est;
static char afs_sig[] = "%RGB-1.0\r";
72,13 → 72,7
p += sprintf(p, "%d\r", gdata->parm.val[i]);
 
/* expressions, broken into lines no longer than CHOPLINES characters */
for( k=0 ; k<4 ; ++k ){
i = k;
if (premiereOrder) {
// Premiere has the order BGRA, while Photoshop (and our internal order) is RGBA
if (k == 0) i = 2;
else if (k == 2) i = 0;
}
for( i=0 ; i<4 ; ++i ){
if ((r = gdata->parm.szFormula[i])) {
chunk = 0; // to avoid that compiler complains
for (n = strlen(r); n; n -= chunk) {
269,51 → 263,65
return e;
}
 
FFSavingResult savefile_afs_pff_picotxt_guf(StandardFileReply *sfr){
Boolean savefile_afs_pff_picotxt_guf(StandardFileReply *sfr){
FILEREF r;
Handle h;
Boolean bres = false;
FFSavingResult res = 0;
Boolean res = false;
TCHAR* reasonstr = NULL;
 
FSpDelete(&sfr->sfFile);
if (FSpCreate(&sfr->sfFile, SIG_SIMPLETEXT, TEXT_FILETYPE, sfr->sfScript) == noErr) {
if(FSpCreate(&sfr->sfFile,SIG_SIMPLETEXT,TEXT_FILETYPE,sfr->sfScript) == noErr)
if (FSpOpenDF(&sfr->sfFile, fsWrPerm, &r) == noErr) {
 
if (fileHasExtension(sfr, TEXT(".txt"))) {
// PluginCommander .txt
if ((h = PINEWHANDLE(1))) { // don't set initial size to 0, since some hosts (e.g. GIMP/PSPI) are incompatible with that.
bres = !(saveparams_picotxt(h) || savehandleintofile(h, r));
if (!bres) res = MSG_ERROR_GENERATING_DATA_ID;
res = !(saveparams_picotxt(h) || savehandleintofile(h, r));
PIDISPOSEHANDLE(h);
}
else res = MSG_OUT_OF_MEMORY_ID;
}
else if (fileHasExtension(sfr, TEXT(".guf"))) {
 
if (fileHasExtension(sfr, TEXT(".guf"))) {
// GIMP UserFilter file
if ((h = PINEWHANDLE(1))) { // don't set initial size to 0, since some hosts (e.g. GIMP/PSPI) are incompatible with that.
bres = !(saveparams_guf(h) || savehandleintofile(h, r));
if (!bres) res = MSG_ERROR_GENERATING_DATA_ID;
res = !(saveparams_guf(h) || savehandleintofile(h, r));
PIDISPOSEHANDLE(h);
}
else res = MSG_OUT_OF_MEMORY_ID;
}
else if ((fileHasExtension(sfr, TEXT(".afs"))) || (fileHasExtension(sfr, TEXT(".pff")))) {
 
if ((fileHasExtension(sfr, TEXT(".afs"))) || (fileHasExtension(sfr, TEXT(".pff")))) {
if (fileHasExtension(sfr, TEXT(".pff"))) {
// If it is a Premiere settings file, we need to swap the channels red and blue
// We just swap the pointers!
char tmp[MAXEXPR];
strcpy(tmp, gdata->parm.szFormula[0]);
strcpy(gdata->parm.szFormula[0], gdata->parm.szFormula[2]);
strcpy(gdata->parm.szFormula[2], tmp);
}
 
if ((h = PINEWHANDLE(1))) { // don't set initial size to 0, since some hosts (e.g. GIMP/PSPI) are incompatible with that.
bres = !(saveparams_afs_pff(h, fileHasExtension(sfr, TEXT(".pff"))) || savehandleintofile(h, r));
if (!bres) res = MSG_ERROR_GENERATING_DATA_ID;
res = !(saveparams_afs_pff(h) || savehandleintofile(h, r));
PIDISPOSEHANDLE(h);
}
else res = MSG_OUT_OF_MEMORY_ID;
 
if (fileHasExtension(sfr, TEXT(".pff"))) {
// Swap back so that the other program stuff will work normally again
char tmp[MAXEXPR];
strcpy(tmp, gdata->parm.szFormula[0]);
strcpy(gdata->parm.szFormula[0], gdata->parm.szFormula[2]);
strcpy(gdata->parm.szFormula[2], tmp);
}
else {
res = MSG_UNSUPPORTED_FILE_FORMAT_ID;
}
 
FSClose(r);
}else reasonstr = FF_GetMsg_Cpy(MSG_CANNOT_OPEN_FILE_ID);
else reasonstr = FF_GetMsg_Cpy(MSG_CANNOT_CREATE_FILE_ID);
 
if (!res) {
alertuser_id(MSG_CANNOT_SAVE_SETTINGS_ID, reasonstr);
}
else res = MSG_CANNOT_OPEN_FILE_ID;
}
else res = MSG_CANNOT_CREATE_FILE_ID;
 
if (reasonstr) FF_GetMsg_Free(reasonstr);
 
return res;
}