Update of /cvsroot/ufraw/ufraw
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv23650
Modified Files:
ufraw-batch.c ufraw.h ufraw_lens_ui.c ufraw_ufraw.c
Log Message:
Simplify lensfun initialization, fixing some crop bugs in the process.
Index: ufraw.h
===================================================================
RCS file: /cvsroot/ufraw/ufraw/ufraw.h,v
retrieving revision 1.148
retrieving revision 1.149
diff -u -d -r1.148 -r1.149
--- ufraw.h 10 Feb 2010 23:37:02 -0000 1.148
+++ ufraw.h 12 Feb 2010 07:50:18 -0000 1.149
@@ -355,9 +355,6 @@
int ufraw_load_darkframe(ufraw_data *uf);
void ufraw_developer_prepare(ufraw_data *uf, DeveloperMode mode);
int ufraw_convert_image(ufraw_data *uf);
-#ifdef HAVE_LENSFUN
-void ufraw_lensfun_init(ufraw_data *uf);
-#endif
ufraw_image_data *ufraw_get_image(ufraw_data *uf, UFRawPhase phase,
gboolean bufferok);
ufraw_image_data *ufraw_convert_image_area(ufraw_data *uf, unsigned saidx,
Index: ufraw_lens_ui.c
===================================================================
RCS file: /cvsroot/ufraw/ufraw/ufraw_lens_ui.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- ufraw_lens_ui.c 10 Feb 2010 23:37:02 -0000 1.27
+++ ufraw_lens_ui.c 12 Feb 2010 07:50:18 -0000 1.28
@@ -460,15 +460,14 @@
gtk_widget_show_all (data->LensParamBox);
CFG->cur_lens_type = LF_UNKNOWN;
-
- lens_interpolate (data, lens);
}
-static void lens_menu_select (
- GtkMenuItem *menuitem, gpointer user_data)
+static void lens_menu_select(GtkMenuItem *menuitem, gpointer user_data)
{
preview_data *data = (preview_data *)user_data;
- lens_set (data, (lfLens *)g_object_get_data(G_OBJECT(menuitem), "lfLens"));
+ lfLens *lens = (lfLens *)g_object_get_data(G_OBJECT(menuitem), "lfLens");
+ lens_set(data, lens);
+ lens_interpolate(data, lens);
}
static void lens_menu_fill (
@@ -636,8 +635,7 @@
static void tca_model_changed (GtkComboBox *widget, preview_data *data)
{
- lfTCAModel model =
- (lfTCAModel) gtk_combo_box_get_active (widget);
+ lfTCAModel model = gtk_combo_box_get_active(widget) - LF_TCA_MODEL_NONE;
const char *details;
const lfParameter **params;
@@ -675,7 +673,7 @@
static void fill_tca_page(preview_data *data, GtkWidget *page)
{
GtkWidget *label;
- int i, active_index;
+ int i;
GtkWidget *hbox = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start(GTK_BOX(page), hbox, FALSE, FALSE, 0);
@@ -687,17 +685,13 @@
data->LensTCAModel = gtk_combo_box_new_text ();
uf_widget_set_tooltip(data->LensTCAModel,
_("Chromatic Aberrations mathematical model"));
- active_index = 0;
- for (i = 0; ; i++)
- {
+ for (i = 0; ; i++) {
const char *model_name;
lfTCAModel model = LF_TCA_MODEL_NONE + i;
model_name = lf_get_tca_model_desc (model, NULL, NULL);
if (!model_name)
break;
gtk_combo_box_append_text (GTK_COMBO_BOX (data->LensTCAModel),
model_name);
- if (model == CFG->lens_tca.Model)
- active_index = i;
}
g_signal_connect(G_OBJECT(data->LensTCAModel), "changed",
G_CALLBACK(tca_model_changed), data);
@@ -713,8 +707,6 @@
gtk_label_set_ellipsize(GTK_LABEL(data->LensTCADesc), PANGO_ELLIPSIZE_END);
gtk_label_set_selectable(GTK_LABEL(data->LensTCADesc), TRUE);
gtk_box_pack_start(GTK_BOX(page), data->LensTCADesc, FALSE, FALSE, 0);
-
- gtk_combo_box_set_active (GTK_COMBO_BOX (data->LensTCAModel),
active_index);
}
/* --- Vignetting correction page --- */
@@ -750,8 +742,8 @@
static void vignetting_model_changed (GtkComboBox *widget, preview_data *data)
{
- lfVignettingModel model =
- (lfVignettingModel) gtk_combo_box_get_active (widget);
+ lfVignettingModel model = gtk_combo_box_get_active(widget) -
+ LF_VIGNETTING_MODEL_NONE;
const char *details;
const lfParameter **params;
@@ -788,7 +780,7 @@
static void fill_vignetting_page(preview_data *data, GtkWidget *page)
{
GtkWidget *label;
- int i, active_index;
+ int i;
GtkWidget *hbox = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start(GTK_BOX(page), hbox, FALSE, FALSE, 0);
@@ -800,17 +792,13 @@
data->LensVignettingModel = gtk_combo_box_new_text ();
uf_widget_set_tooltip(data->LensVignettingModel,
_("Optical vignetting mathematical model"));
- active_index = 0;
- for (i = 0; ; i++)
- {
+ for (i = 0; ; i++) {
const char *model_name;
lfVignettingModel model = LF_VIGNETTING_MODEL_NONE + i;
model_name = lf_get_vignetting_model_desc (model, NULL, NULL);
if (!model_name)
break;
gtk_combo_box_append_text (GTK_COMBO_BOX (data->LensVignettingModel),
model_name);
- if (model == CFG->lens_vignetting.Model)
- active_index = i;
}
g_signal_connect(G_OBJECT(data->LensVignettingModel), "changed",
G_CALLBACK(vignetting_model_changed), data);
@@ -827,8 +815,6 @@
PANGO_ELLIPSIZE_END);
gtk_label_set_selectable(GTK_LABEL(data->LensVignettingDesc), TRUE);
gtk_box_pack_start(GTK_BOX(page), data->LensVignettingDesc, FALSE, FALSE,
0);
-
- gtk_combo_box_set_active (GTK_COMBO_BOX (data->LensVignettingModel),
active_index);
}
/* --- Distortion correction page --- */
@@ -863,8 +849,8 @@
static void distortion_model_changed (GtkComboBox *widget, preview_data *data)
{
- lfDistortionModel model =
- (lfDistortionModel) gtk_combo_box_get_active (widget);
+ lfDistortionModel model = gtk_combo_box_get_active(widget) -
+ LF_DIST_MODEL_NONE;
const char *details;
const lfParameter **params;
@@ -903,7 +889,7 @@
static void fill_distortion_page(preview_data *data, GtkWidget *page)
{
GtkWidget *label;
- int i, active_index;
+ int i;
GtkWidget *hbox = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start(GTK_BOX(page), hbox, FALSE, FALSE, 0);
@@ -915,17 +901,13 @@
data->LensDistortionModel = gtk_combo_box_new_text ();
uf_widget_set_tooltip (data->LensDistortionModel,
_("Lens distortion mathematical model"));
- active_index = 0;
- for (i = 0; ; i++)
- {
+ for (i = 0; ; i++) {
const char *model_name;
lfDistortionModel model = LF_DIST_MODEL_NONE + i;
model_name = lf_get_distortion_model_desc (model, NULL, NULL);
if (!model_name)
break;
gtk_combo_box_append_text (GTK_COMBO_BOX (data->LensDistortionModel),
model_name);
- if (model == CFG->lens_distortion.Model)
- active_index = i;
}
g_signal_connect (G_OBJECT (data->LensDistortionModel), "changed",
G_CALLBACK (distortion_model_changed), data);
@@ -943,8 +925,6 @@
gtk_label_set_selectable(GTK_LABEL(data->LensDistortionDesc), TRUE);
gtk_box_pack_start(GTK_BOX(page),
data->LensDistortionDesc, FALSE, FALSE, 0);
-
- gtk_combo_box_set_active (GTK_COMBO_BOX (data->LensDistortionModel),
active_index);
}
/* --- Lens geometry page --- */
@@ -1036,9 +1016,6 @@
g_object_set_data (G_OBJECT (data->LensToGeometrySel), "LensType",
&CFG->cur_lens_type);
g_signal_connect (G_OBJECT (data->LensToGeometrySel), "changed",
G_CALLBACK(geometry_model_changed), data);
-
- gtk_combo_box_set_active (GTK_COMBO_BOX (data->LensFromGeometrySel),
CFG->lens->Type);
- gtk_combo_box_set_active (GTK_COMBO_BOX (data->LensToGeometrySel),
CFG->cur_lens_type);
}
/**
@@ -1101,8 +1078,8 @@
gtk_notebook_set_tab_pos (subnb, GTK_POS_LEFT);
/* Create a default lens & camera */
- ufraw_lensfun_init(data->UF);
camera_set(data);
+ lens_set(data, CFG->lens);
subpage = notebook_page_new(subnb, _("Lens distortion"), "distortion");
fill_distortion_page(data, subpage);
@@ -1117,16 +1094,7 @@
_("Lateral chromatic aberration"), "tca");
fill_tca_page(data, subpage);
- lens_set(data, CFG->lens);
-
- if (CFG->lensfunMode == lensfun_none) {
- gtk_combo_box_set_active(GTK_COMBO_BOX(data->LensDistortionModel),
- LF_DIST_MODEL_NONE);
- gtk_combo_box_set_active(GTK_COMBO_BOX(data->LensTCAModel),
- LF_TCA_MODEL_NONE);
- gtk_combo_box_set_active(GTK_COMBO_BOX(data->LensVignettingModel),
- LF_VIGNETTING_MODEL_NONE);
- }
+ lens_interpolate(data, CFG->lens);
}
#endif /* HAVE_LENSFUN */
Index: ufraw_ufraw.c
===================================================================
RCS file: /cvsroot/ufraw/ufraw/ufraw_ufraw.c,v
retrieving revision 1.237
retrieving revision 1.238
diff -u -d -r1.237 -r1.238
--- ufraw_ufraw.c 11 Feb 2010 20:51:26 -0000 1.237
+++ ufraw_ufraw.c 12 Feb 2010 07:50:18 -0000 1.238
@@ -35,6 +35,7 @@
LF_MODIFY_DISTORTION | LF_MODIFY_GEOMETRY | LF_MODIFY_SCALE)
#define UF_LF_TRANSFORM ( \
LF_MODIFY_DISTORTION | LF_MODIFY_GEOMETRY | LF_MODIFY_SCALE)
+static void ufraw_lensfun_init(ufraw_data *uf);
static void ufraw_convert_image_vignetting(ufraw_data *uf,
ufraw_image_data *img, UFRectangle *area);
static void ufraw_convert_image_tca(ufraw_data *uf, ufraw_image_data *img,
@@ -571,7 +572,23 @@
uf->conf->BaseCurveIndex = linear_curve;
}
ufraw_load_darkframe(uf);
-
+#ifdef HAVE_LENSFUN
+ ufraw_lensfun_init(uf);
+ if (uf->conf->lensfunMode == lensfun_none) {
+ uf->conf->lens_distortion.Model = LF_DIST_MODEL_NONE;
+ if (uf->conf->lens->CalibDistortion != NULL)
+ while (uf->conf->lens->CalibDistortion[0] != NULL)
+ lf_lens_remove_calib_distortion(uf->conf->lens, 0);
+ uf->conf->lens_tca.Model = LF_TCA_MODEL_NONE;
+ if (uf->conf->lens->CalibTCA != NULL)
+ while (uf->conf->lens->CalibTCA[0] != NULL)
+ lf_lens_remove_calib_tca(uf->conf->lens, 0);
+ uf->conf->lens_vignetting.Model = LF_VIGNETTING_MODEL_NONE;
+ if (uf->conf->lens->CalibVignetting != NULL)
+ while (uf->conf->lens->CalibVignetting[0] != NULL)
+ lf_lens_remove_calib_vignetting(uf->conf->lens, 0);
+ }
+#endif
ufraw_get_image_dimensions(uf);
return UFRAW_SUCCESS;
@@ -1232,7 +1249,7 @@
}
#ifdef HAVE_LENSFUN
-void ufraw_lensfun_init(ufraw_data *uf)
+static void ufraw_lensfun_init(ufraw_data *uf)
{
/* Load lens database only once */
static lfDatabase *lensdb = NULL;
Index: ufraw-batch.c
===================================================================
RCS file: /cvsroot/ufraw/ufraw/ufraw-batch.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- ufraw-batch.c 27 Jan 2010 21:23:22 -0000 1.33
+++ ufraw-batch.c 12 Feb 2010 07:50:18 -0000 1.34
@@ -101,10 +101,6 @@
else
stat[0] = '\0';
ufraw_message(UFRAW_MESSAGE, _("Loaded %s %s"), uf->filename, stat);
-#ifdef HAVE_LENSFUN
- if (uf->conf->lensfunMode == lensfun_auto)
- ufraw_lensfun_init(uf);
-#endif
status = ufraw_batch_saver(uf);
if (status==UFRAW_SUCCESS || status==UFRAW_WARNING) {
if (uf->conf->createID!=only_id)
------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
ufraw-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ufraw-cvs