Rev 248 | Rev 259 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 248 | Rev 256 | ||
---|---|---|---|
Line 217... | Line 217... | ||
217 | 217 | ||
218 | /* wantdialog = false means that we never got a Parameters call, so we're not supposed to ask user */ |
218 | /* wantdialog = false means that we never got a Parameters call, so we're not supposed to ask user */ |
219 | if( wantdialog && (!gdata->standalone || gdata->parm.popDialog) ){ |
219 | if( wantdialog && (!gdata->standalone || gdata->parm.popDialog) ){ |
220 | if( maindialog(pb) ){ |
220 | if( maindialog(pb) ){ |
221 | if (!host_preserves_parameters()) { |
221 | if (!host_preserves_parameters()) { |
- | 222 | if (!gdata->obfusc) { // If the filter is obfuscated, we may not save the formula to the .afs (TODO: just save the ctl/map, but not the r/g/b/a-formulas!) |
|
222 | /* Workaround for GIMP/PSPI, to avoid that formulas vanish when you re-open the main window. |
223 | /* Workaround for GIMP/PSPI, to avoid that formulas vanish when you re-open the main window. |
223 | The reason is a bug in PSPI: The host should preserve the value of pb->parameters, which PSPI does not do. |
224 | The reason is a bug in PSPI: The host should preserve the value of pb->parameters, which PSPI does not do. |
224 | Also, all global variables are unloaded, so the plugin cannot preserve any data. |
225 | Also, all global variables are unloaded, so the plugin cannot preserve any data. |
225 | Workaround in FF 1.7: If the host GIMP is detected, then a special mode will be activated. |
226 | Workaround in FF 1.7: If the host GIMP is detected, then a special mode will be activated. |
226 | This mode saves the filter data into a temporary file "FilterFoundryXX.afs" and loads it |
227 | This mode saves the filter data into a temporary file "FilterFoundryXX.afs" and loads it |
Line 249... | Line 250... | ||
249 | sfr.nFileExtension = (WORD)(strlen(outfilename) - strlen(".afs")); |
250 | sfr.nFileExtension = (WORD)(strlen(outfilename) - strlen(".afs")); |
250 | #endif |
251 | #endif |
251 | sfr.sfScript = 0; // FIXME: is that ok? |
252 | sfr.sfScript = 0; // FIXME: is that ok? |
252 | savefile(&sfr); |
253 | savefile(&sfr); |
253 | } |
254 | } |
- | 255 | } |
|
254 | 256 | ||
255 | /* update stored parameters from new user settings */ |
257 | /* update stored parameters from new user settings */ |
256 | saveparams(pb->parameters); |
258 | saveparams(pb->parameters); |
257 | }else |
259 | }else |
258 | e = userCanceledErr; |
260 | e = userCanceledErr; |
Line 306... | Line 308... | ||
306 | // We need to set gdata->standalone after loadfile(), but we must call readPARMresource() before loadfile() |
308 | // We need to set gdata->standalone after loadfile(), but we must call readPARMresource() before loadfile() |
307 | // Reason: readPARMresource() reads parameters from the DLL while loadfile() reads parameters from the AFS file |
309 | // Reason: readPARMresource() reads parameters from the DLL while loadfile() reads parameters from the AFS file |
308 | // But loadfile() will reset gdata->standalone ... |
310 | // But loadfile() will reset gdata->standalone ... |
309 | isStandalone = readPARMresource((HMODULE)hDllInstance, &reason, READ_OBFUSC); |
311 | isStandalone = readPARMresource((HMODULE)hDllInstance, &reason, READ_OBFUSC); |
310 | 312 | ||
- | 313 | if (!gdata->obfusc) { // If the filter is obfuscated, we may not save the formula to the .afs (TODO: just save the ctl/map, but not the r/g/b/a-formulas!) |
|
311 | tempdir = getenv("TMP"); |
314 | tempdir = getenv("TMP"); |
312 | #ifdef WIN_ENV |
315 | #ifdef WIN_ENV |
313 | if (strlen(tempdir) > 0) strcat(tempdir, "\\"); |
316 | if (strlen(tempdir) > 0) strcat(tempdir, "\\"); |
314 | #else |
317 | #else |
315 | if (strlen(tempdir) > 0) strcat(tempdir, "/"); |
318 | if (strlen(tempdir) > 0) strcat(tempdir, "/"); |
Line 327... | Line 330... | ||
327 | if (loadfile(&sfr, &reason)) { |
330 | if (loadfile(&sfr, &reason)) { |
328 | gdata->standalone = gdata->parmloaded = isStandalone; |
331 | gdata->standalone = gdata->parmloaded = isStandalone; |
329 | return true; |
332 | return true; |
330 | } |
333 | } |
331 | } |
334 | } |
- | 335 | } |
|
332 | 336 | ||
333 | if( (bUninitializedParams = !(params && readparams(params,false,&reasonstr))) ){ |
337 | if( (bUninitializedParams = !(params && readparams(params,false,&reasonstr))) ){ |
334 | /* either the parameter handle was uninitialised, |
338 | /* either the parameter handle was uninitialised, |
335 | or the parameter data couldn't be read; set default values */ |
339 | or the parameter data couldn't be read; set default values */ |
336 | 340 |