Update of /cvsroot/ufraw/ufraw
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv1143
Modified Files:
ufobject.cc ufobject.h ufraw_lensfun.cc
Log Message:
Set lensfun defaults correctly when load ID files.
Index: ufobject.h
===================================================================
RCS file: /cvsroot/ufraw/ufraw/ufobject.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- ufobject.h 26 Feb 2010 07:01:04 -0000 1.4
+++ ufobject.h 2 Mar 2010 20:06:09 -0000 1.5
@@ -295,6 +295,9 @@
void Set(const char *string);
bool IsDefault() const;
void SetDefault();
+ /// Set @a string as a default value.
+ /// A #uf_default_changed event is triggered.
+ void SetDefault(const char *string);
void Reset();
/// Return true if object value is equal to @a string.
bool IsEqual(const char *string) const;
@@ -361,6 +364,11 @@
const char *StringValue() const;
bool IsDefault() const;
void SetDefault();
+ /// Set @a string as a default string value for the UFArray. As opposed
+ /// to the SetDefault() method with no arguments, this method does not
+ /// changes the default of the array's elements.
+ /// A #uf_default_changed event is triggered.
+ void SetDefault(const char *string);
void Reset();
/// Set the current index position in the array.
/// Return false if @a index is out of range.
Index: ufraw_lensfun.cc
===================================================================
RCS file: /cvsroot/ufraw/ufraw/ufraw_lensfun.cc,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- ufraw_lensfun.cc 1 Mar 2010 23:34:21 -0000 1.7
+++ ufraw_lensfun.cc 2 Mar 2010 20:06:09 -0000 1.8
@@ -29,8 +29,9 @@
namespace UFRaw {
class Lensfun : public UFGroup {
+private:
+ static lfDatabase *_LensDB;
public:
- static lfDatabase *LensDB;
lfLens Transformation;
lfLens Interpolation;
double FocalLengthValue;
@@ -49,6 +50,14 @@
return static_cast<Lensfun &>(object.Parent());
return Lensfun::Parent(object.Parent());
}
+ static lfDatabase *LensDB() {
+ /* Load lens database only once */
+ if (_LensDB == NULL) {
+ _LensDB = lfDatabase::Create();
+ _LensDB->Load();
+ }
+ return _LensDB;
+ }
void Interpolate();
void Init();
};
@@ -473,22 +482,25 @@
static_cast<Distortion &>((*this)[ufDistortion]).Interpolate();
}
-lfDatabase *Lensfun::LensDB = NULL;
+lfDatabase *Lensfun::_LensDB = NULL;
void Lensfun::Init() {
- /* Load lens database only once */
- if (LensDB == NULL) {
- LensDB = lfDatabase::Create();
- LensDB->Load();
- }
ufraw_data *uf = ufraw_image_get_data(this);
+ char buffer[_buffer_size];
+ UFArray &FocalLength = (*this)[ufFocalLength];
+ FocalLength.SetDefault(_StringNumber(buffer, uf->conf->focal_len));
+ UFArray &Aperture = (*this)[ufAperture];
+ Aperture.SetDefault(_StringNumber(buffer, uf->conf->aperture));
+ UFArray &Distance = (*this)[ufDistance];
+ Distance.SetDefault(_StringNumber(buffer, uf->conf->subject_distance));
+
/* Create a default camera */
uf->conf->camera = lf_camera_new();
/* Set lens and camera from EXIF info, if possible */
if (uf->conf->real_make[0] || uf->conf->real_model[0]) {
- const lfCamera **cams = LensDB->FindCameras(
+ const lfCamera **cams = LensDB()->FindCameras(
uf->conf->real_make, uf->conf->real_model);
if (cams != NULL) {
lf_camera_copy(uf->conf->camera, cams[0]);
@@ -496,7 +508,7 @@
}
}
if (strlen(uf->conf->lensText) > 0) {
- const lfLens **lenses = LensDB->FindLenses(
+ const lfLens **lenses = LensDB()->FindLenses(
uf->conf->camera, NULL, uf->conf->lensText);
if (lenses != NULL) {
Interpolation = *lenses[0];
@@ -513,23 +525,19 @@
}
uf->conf->lensfunMode = lensfun_auto;
}
+ FocalLength.Reset();
+ Aperture.Reset();
+ Distance.Reset();
if (uf->conf->lensfunMode == lensfun_none) {
(*this)[ufTCA].Reset();
(*this)[ufVignetting].Reset();
(*this)[ufDistortion].Reset();
} else {
- static_cast<FocalLength &>((*this)[ufFocalLength]).CreatePresets();
- static_cast<Aperture &>((*this)[ufAperture]).CreatePresets();
- static_cast<Distance &>((*this)[ufDistance]).CreatePresets();
+ static_cast<UFRaw::FocalLength &>(FocalLength).CreatePresets();
+ static_cast<UFRaw::Aperture &>(Aperture).CreatePresets();
+ static_cast<UFRaw::Distance &>(Distance).CreatePresets();
Interpolate();
}
- char buffer[_buffer_size];
- (*this)[ufFocalLength].Set(_StringNumber(buffer, uf->conf->focal_len));
- (*this)[ufFocalLength].SetDefault();
- (*this)[ufAperture].Set(_StringNumber(buffer, uf->conf->aperture));
- (*this)[ufAperture].SetDefault();
- (*this)[ufDistance].Set(_StringNumber(buffer, uf->conf->subject_distance));
- (*this)[ufDistance].SetDefault();
}
extern "C" {
@@ -607,7 +615,7 @@
}
lfDatabase *ufraw_lensfun_db() {
- return Lensfun::LensDB;
+ return Lensfun::LensDB();
}
} // extern "C"
Index: ufobject.cc
===================================================================
RCS file: /cvsroot/ufraw/ufraw/ufobject.cc,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- ufobject.cc 26 Feb 2010 07:01:04 -0000 1.6
+++ ufobject.cc 2 Mar 2010 20:06:09 -0000 1.7
@@ -513,12 +513,16 @@
return this->IsEqual(ufstring->Default);
}
-void UFString::SetDefault() {
+void UFString::SetDefault(const char *string) {
g_free(ufstring->Default);
- ufstring->Default = g_strdup(ufstring->String);
+ ufstring->Default = g_strdup(string);
Event(uf_default_changed);
}
+void UFString::SetDefault() {
+ SetDefault(ufstring->String);
+}
+
void UFString::Reset() {
Set(ufstring->Default);
}
@@ -820,9 +824,13 @@
return UFGroup::IsDefault();
}
-void UFArray::SetDefault() {
+void UFArray::SetDefault(const char *string) {
g_free(ufgroup->DefaultIndex);
- ufgroup->DefaultIndex = g_strdup(ufgroup->String);
+ ufgroup->DefaultIndex = g_strdup(string);
+}
+
+void UFArray::SetDefault() {
+ SetDefault(ufgroup->String);
UFGroup::SetDefault();
}
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
ufraw-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ufraw-cvs