Subversion Repositories filter_foundry

Rev

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

Rev 393 Rev 444
Line 207... Line 207...
207
 
207
 
208
        FSpDelete(&sfr->sfFile);
208
        FSpDelete(&sfr->sfFile);
209
        if(FSpCreate(&sfr->sfFile,SIG_SIMPLETEXT,TEXT_FILETYPE,sfr->sfScript) == noErr)
209
        if(FSpCreate(&sfr->sfFile,SIG_SIMPLETEXT,TEXT_FILETYPE,sfr->sfScript) == noErr)
210
                if(FSpOpenDF(&sfr->sfFile,fsWrPerm,&r) == noErr){
210
                if(FSpOpenDF(&sfr->sfFile,fsWrPerm,&r) == noErr){
211
 
211
 
212
                        if (fileHasExtension(sfr, ".txt")) {
212
                        if (fileHasExtension(sfr, TEXT(".txt"))) {
213
                                // PluginCommander .txt
213
                                // PluginCommander .txt
214
                                if ((h = PINEWHANDLE(1))) { // don't set initial size to 0, since some hosts (e.g. GIMP/PSPI) are incompatible with that.
214
                                if ((h = PINEWHANDLE(1))) { // don't set initial size to 0, since some hosts (e.g. GIMP/PSPI) are incompatible with that.
215
                                        res = !(saveparams_picotxt(h,false) || savehandleintofile(h, r));
215
                                        res = !(saveparams_picotxt(h,false) || savehandleintofile(h, r));
216
                                        PIDISPOSEHANDLE(h);
216
                                        PIDISPOSEHANDLE(h);
217
                                }
217
                                }
218
                        }
218
                        }
219
 
219
 
220
                        if ((fileHasExtension(sfr, ".afs")) || (fileHasExtension(sfr, ".pff"))) {
220
                        if ((fileHasExtension(sfr, TEXT(".afs"))) || (fileHasExtension(sfr, TEXT(".pff")))) {
221
                                if (fileHasExtension(sfr, ".pff")) {
221
                                if (fileHasExtension(sfr, TEXT(".pff"))) {
222
                                        // If it is a Premiere settings file, we need to swap the channels red and blue
222
                                        // If it is a Premiere settings file, we need to swap the channels red and blue
223
                                        // We just swap the pointers!
223
                                        // We just swap the pointers!
224
                                        char* tmp;
224
                                        char* tmp;
225
                                        tmp = expr[0];
225
                                        tmp = expr[0];
226
                                        expr[0] = expr[2];
226
                                        expr[0] = expr[2];
Line 230... Line 230...
230
                                if ((h = PINEWHANDLE(1))) { // don't set initial size to 0, since some hosts (e.g. GIMP/PSPI) are incompatible with that.
230
                                if ((h = PINEWHANDLE(1))) { // don't set initial size to 0, since some hosts (e.g. GIMP/PSPI) are incompatible with that.
231
                                        res = !(saveparams_afs_pff(h) || savehandleintofile(h, r));
231
                                        res = !(saveparams_afs_pff(h) || savehandleintofile(h, r));
232
                                        PIDISPOSEHANDLE(h);
232
                                        PIDISPOSEHANDLE(h);
233
                                }
233
                                }
234
 
234
 
235
                                if (fileHasExtension(sfr, ".pff")) {
235
                                if (fileHasExtension(sfr, TEXT(".pff"))) {
236
                                        // Swap back so that the other program stuff will work normally again
236
                                        // Swap back so that the other program stuff will work normally again
237
                                        char* tmp;
237
                                        char* tmp;
238
                                        tmp = expr[0];
238
                                        tmp = expr[0];
239
                                        expr[0] = expr[2];
239
                                        expr[0] = expr[2];
240
                                        expr[2] = tmp;
240
                                        expr[2] = tmp;
241
                                }
241
                                }
242
                        }
242
                        }
243
 
243
 
244
                        FSClose(r);
244
                        FSClose(r);
245
                }else reasonstr = (_strdup("Could not open the file."));
245
                }else reasonstr = _strdup("Could not open the file.");
246
        else reasonstr = (_strdup("Could not create the file."));
246
        else reasonstr = _strdup("Could not create the file.");
247
 
247
 
248
        if(!res)
248
        if (!res) {
-
 
249
                #ifdef UNICODE
-
 
250
                TCHAR reasonstrW[0x300];
-
 
251
                mbstowcs(reasonstrW, reasonstr, 0x300);
-
 
252
                alertuser((TCHAR*)TEXT("Could not save settings."), reasonstrW);
-
 
253
                #else
249
                alertuser(_strdup("Could not save settings."),reasonstr);
254
                alertuser((TCHAR*)TEXT("Could not save settings."), reasonstr);
-
 
255
                #endif
-
 
256
        }
250
 
257
 
251
        return res;
258
        return res;
252
}
259
}