This message relates, primarily, to the UFRaw Gimp plug-in. What I want is for 
UFRaw to remember the configuration settings for each image rather than just 
have one system wide set.

I've had a look at the code and developed a set of patches for consideration. 
There is one (acknowledged) area that could be improved upon - there are most 
likely others.

What the patch does is to force the writing and reading of an ID-type file 
whose path is generated from the raw file. For example, if the raw file is 
"~/IMG0074.CR2" the the config file is "~/.IMG0074.CR2.ufraw" - note the 
leading 
"." in the file name. If that file does not exists then the default 
$HOME/.ufrawrc file is read.

Do others think that this is a useful addition to the plug-in? Is the basic 
approach suitable? Other comments?

The "diff" output follows. BTW: I currently run Fedora 13 so the source is from 
the Fedora SRPM which may differ from that which available on this site.

Cheers,
Kevin

$ diff -br ufraw-0.18.old/ufraw.c ufraw-0.18.new/ufraw.c
50c50
<     conf_load(&rc, NULL);
---
>     conf_load(&rc, NULL, 0);
diff -br ufraw-0.18.old/ufraw_conf.c ufraw-0.18.new/ufraw_conf.c
762c762
< int conf_load(conf_data *c, const char *IDFilename)
---
> int conf_load(conf_data *c, const char *IDFilename, gboolean override )
776c776
<     if (IDFilename == NULL)
---
>     if (IDFilename == NULL || override)
879c879
<         int status = conf_load(conf, confFilename);
---
>         int status = conf_load(conf, confFilename, 0);
diff -br ufraw-0.18.old/ufraw-gimp.c ufraw-0.18.new/ufraw-gimp.c
235c235,239
<     conf_load(&rc, NULL);
---
> 
>       if( conf_load( &rc, buildImageConfigPath( uf->filename ), 1 ) == 
UFRAW_ERROR )
>       {       fprintf( stderr, "conf_load from image specific file failed - 
> loading 
from $HOME\n" );
>               conf_load(&rc, NULL, 0);
>       }
238a243
> 
diff -br ufraw-0.18.old/ufraw.h ufraw-0.18.new/ufraw.h
371a372
>     char *buildImageConfigPath(char *filename);
449c450
<     int conf_load(conf_data *c, const char *confFilename);
---
>     int conf_load(conf_data *c, const char *confFilename, gboolean 
override);
diff -br ufraw-0.18.old/ufraw_preview.c ufraw-0.18.new/ufraw_preview.c
3919a3920
> 
5876c5877
<             conf_save(RC, NULL, NULL);
---
>             conf_save(RC, buildImageConfigPath( uf->filename ), NULL);
5883c5884
<             conf_save(RC, NULL, NULL);
---
>            conf_save(RC, buildImageConfigPath( uf->filename ), NULL);
5889c5890
<                 conf_save(RC, NULL, NULL);
---
>                 conf_save(RC, buildImageConfigPath( uf->filename ), NULL);
5891c5892
<                 conf_save(RC, NULL, NULL);
---
>                conf_save(RC, buildImageConfigPath( uf->filename ), NULL);
diff -br ufraw-0.18.old/ufraw_ufraw.c ufraw-0.18.new/ufraw_ufraw.c
178c178
<         status = conf_load(conf, filename);
---
>         status = conf_load(conf, filename, 0);
2214a2215,2229
> // build the path to the image-specific *.ufraw config file
> 
> char *buildImageConfigPath(char *filename)
> {   fprintf( stderr, "buildImageConfigPath: filename =%s=\n", filename );
>     char* lastSlash = strrchr( filename, '/' );
>     int l1 = lastSlash ? lastSlash - filename + 1 : 0;
>     static char imageConfigPath[ 4096 ];      //      this is *very* slack - 
> needs 
something a little more sophisticated
>     strncpy( imageConfigPath, filename, l1 );
>       strcpy( imageConfigPath + l1, "." );
>       strcat( imageConfigPath, filename + l1 );
>       strcat( imageConfigPath, ".ufraw" );
>     fprintf( stderr, "buildImageConfigPath: imageConfigPath =%s=\n", 
imageConfigPath );
> 
>     return imageConfigPath;
> }

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
ufraw-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ufraw-devel

Reply via email to