Update of /cvsroot/ufraw/ufraw
In directory vz-cvs-3.sog:/tmp/cvs-serv31985
Modified Files:
ufobject.cc ufobject.h ufraw.h ufraw_conf.c ufraw_lensfun.cc
ufraw_settings.cc ufraw_ufraw.c
Log Message:
Read LensFun settings from --conf file.
Index: ufobject.cc
===================================================================
RCS file: /cvsroot/ufraw/ufraw/ufobject.cc,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- ufobject.cc 20 Feb 2011 06:15:20 -0000 1.12
+++ ufobject.cc 27 Jul 2011 13:50:45 -0000 1.13
@@ -1064,6 +1064,11 @@
object->SetEventHandle(handle);
}
+ UFBoolean ufobject_is_default(UFObject *object)
+ {
+ return object->IsDefault();
+ }
+
void ufobject_set_default(UFObject *object)
{
object->SetDefault();
Index: ufraw_settings.cc
===================================================================
RCS file: /cvsroot/ufraw/ufraw/ufraw_settings.cc,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- ufraw_settings.cc 25 Jul 2011 05:59:06 -0000 1.16
+++ ufraw_settings.cc 27 Jul 2011 13:50:46 -0000 1.17
@@ -298,8 +298,8 @@
#ifdef HAVE_LENSFUN
if (!Parent().Has(ufLensfun))
return;
- if (IsDefault())
- ufraw_lensfun_init(&Parent()[ufLensfun]);
+ if (IsEqual("yes"))
+ ufraw_lensfun_init(&Parent()[ufLensfun], TRUE);
#endif
}
};
Index: ufraw.h
===================================================================
RCS file: /cvsroot/ufraw/ufraw/ufraw.h,v
retrieving revision 1.162
retrieving revision 1.163
diff -u -d -r1.162 -r1.163
--- ufraw.h 20 Feb 2011 06:15:20 -0000 1.162
+++ ufraw.h 27 Jul 2011 13:50:45 -0000 1.163
@@ -85,7 +85,7 @@
UFObject *ufraw_image_new();
#ifdef HAVE_LENSFUN
UFObject *ufraw_lensfun_new();
- void ufraw_lensfun_init(UFObject *lensfun);
+ void ufraw_lensfun_init(UFObject *lensfun, UFBoolean reset);
struct lfDatabase *ufraw_lensfun_db(); /* mount/camera/lens database */
const struct lfCamera *ufraw_lensfun_camera(const UFObject *lensfun);
void ufraw_lensfun_set_camera(UFObject *lensfun, const struct lfCamera
*camera);
Index: ufraw_conf.c
===================================================================
RCS file: /cvsroot/ufraw/ufraw/ufraw_conf.c,v
retrieving revision 1.175
retrieving revision 1.176
diff -u -d -r1.175 -r1.176
--- ufraw_conf.c 20 Feb 2011 06:15:20 -0000 1.175
+++ ufraw_conf.c 27 Jul 2011 13:50:46 -0000 1.176
@@ -885,12 +885,6 @@
ufraw_message(UFRAW_REPORT, NULL);
conf->version = 0;
}
-#ifdef HAVE_LENSFUN
- if (conf->ufobject != NULL) {
- UFObject *lensfun = ufgroup_drop(conf->ufobject, ufLensfun);
- ufobject_delete(lensfun);
- }
-#endif
}
}
Index: ufraw_ufraw.c
===================================================================
RCS file: /cvsroot/ufraw/ufraw/ufraw_ufraw.c,v
retrieving revision 1.261
retrieving revision 1.262
diff -u -d -r1.261 -r1.262
--- ufraw_ufraw.c 17 Apr 2011 11:00:29 -0000 1.261
+++ ufraw_ufraw.c 27 Jul 2011 13:50:46 -0000 1.262
@@ -460,7 +460,16 @@
}
ufraw_image_set_data(uf->conf->ufobject, uf);
#ifdef HAVE_LENSFUN
- ufraw_lensfun_init(ufgroup_element(uf->conf->ufobject, ufLensfun));
+ // Do not reset lensfun settings while loading ID.
+ UFBoolean reset = !uf->LoadingID;
+ if (conf != NULL && conf->ufobject != NULL) {
+ UFObject *conf_lensfun_auto = ufgroup_element(conf->ufobject,
+ ufLensfunAuto);
+ // Do not reset lensfun settings from conf file.
+ if (ufstring_is_equal(conf_lensfun_auto, "no"))
+ reset = FALSE;
+ }
+ ufraw_lensfun_init(ufgroup_element(uf->conf->ufobject, ufLensfun), reset);
#endif
char *absname = uf_file_set_absolute(uf->filename);
Index: ufobject.h
===================================================================
RCS file: /cvsroot/ufraw/ufraw/ufobject.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- ufobject.h 20 Feb 2011 06:15:20 -0000 1.10
+++ ufobject.h 27 Jul 2011 13:50:45 -0000 1.11
@@ -439,6 +439,8 @@
void ufobject_set_user_data(UFObject *object, void *user_data);
void ufobject_set_changed_event_handle(UFObject *object,
UFEventHandle *handle);
+/// Return TRUE if object is set to its default value.
+ UFBoolean ufobject_is_default(UFObject *object);
/// Set the current object value to its default value.
void ufobject_set_default(UFObject *object);
/// Return the numerical value of the object. Returns NaN if object is not a
Index: ufraw_lensfun.cc
===================================================================
RCS file: /cvsroot/ufraw/ufraw/ufraw_lensfun.cc,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- ufraw_lensfun.cc 20 Feb 2011 06:15:20 -0000 1.21
+++ ufraw_lensfun.cc 27 Jul 2011 13:50:46 -0000 1.22
@@ -84,7 +84,7 @@
void SetLensModel(const lfLens &lens);
void SetInterpolation(const lfLens &lens);
void Interpolate();
- void Init();
+ void Init(bool reset);
};
static void parse_maker_model(const char *txt, char *make, size_t sz_make,
@@ -126,11 +126,10 @@
return UFObject::Event(type);
if (!HasParent())
return UFObject::Event(type);
- Lensfun &Lensfun = Lensfun::Parent(*this);
- Lensfun.UFObject::Parent()[ufLensfunAuto].Set("no");
char make[200], model[200];
parse_maker_model(StringValue(), make, sizeof(make),
model, sizeof(model));
+ Lensfun &Lensfun = Lensfun::Parent(*this);
const lfLens **lensList = Lensfun.LensDB()->FindLenses(&Lensfun.Camera,
make, model, LF_SEARCH_LOOSE);
if (lensList == NULL) {
@@ -143,6 +142,14 @@
lf_free(lensList);
return UFObject::Event(type);
}
+ void OriginalValueChangedEvent() {
+ if (!HasParent())
+ return;
+ Lensfun &Lensfun = Lensfun::Parent(*this);
+ // While loading rc/cmd/conf data, do not reset the auto setting
+ if (ufraw_image_get_data(this) != NULL)
+ Lensfun.UFObject::Parent()[ufLensfunAuto].Set("no");
+ }
};
#define _buffer_size 80
@@ -300,8 +307,11 @@
void OriginalValueChangedEvent() {
if (!HasParent())
return;
- lfLens emptyLens;
- Lensfun::Parent(*this)[ufLensModel].Reset();
+ Lensfun &Lensfun = Lensfun::Parent(*this);
+ Lensfun[ufLensModel].Reset();
+ // While loading rc/cmd/conf data, do not reset the auto setting
+ if (ufraw_image_get_data(this) != NULL)
+ Lensfun.UFObject::Parent()[ufLensfunAuto].Set("no");
}
};
@@ -633,9 +643,11 @@
lfDatabase *Lensfun::_LensDB = NULL;
-void Lensfun::Init()
+void Lensfun::Init(bool reset)
{
ufraw_data *uf = ufraw_image_get_data(this);
+ if (uf == NULL)
+ return;
UFGroup &Image = UFObject::Parent();
/* Set lens and camera from EXIF info, if possible */
@@ -658,7 +670,7 @@
UFArray &Distance = (*this)[ufDistance];
Distance.SetDefault(_StringNumber(buffer, uf->conf->subject_distance));
- if (uf->LoadingID) {
+ if (!reset) {
(*this)[ufTCA].Event(uf_value_changed);
(*this)[ufVignetting].Event(uf_value_changed);
(*this)[ufDistortion].Event(uf_value_changed);
@@ -697,9 +709,9 @@
extern "C" {
- void ufraw_lensfun_init(UFObject *lensfun)
+ void ufraw_lensfun_init(UFObject *lensfun, UFBoolean reset)
{
- static_cast<UFRaw::Lensfun *>(lensfun)->Init();
+ static_cast<UFRaw::Lensfun *>(lensfun)->Init(reset);
}
void ufraw_convert_prepare_transform(ufraw_data *uf,
------------------------------------------------------------------------------
Got Input? Slashdot Needs You.
Take our quick survey online. Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey
_______________________________________________
ufraw-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ufraw-cvs