On Thu, Jul 09, 2009 at 08:10:52AM +0200, Frank van Maarseveen wrote:
> 
> The patch below shows image rotation (not just flipping) in the preview
> window of ufraw. The only way to specify a rotation is still to modify the
> ID file but at least the preview window is now showing it correctly. There
> are a couple of ways to make this accessible from within the GUI, for
> example let the user draw a line on the horizon in the image but I'll
> leave that for someone else.

Thanks for this patch, Frank. It was me that put the half-finished
rotation code into ufraw-batch, and never found time to figure out how
to integrate it correctly into the preview.

Attached is a very quick patch against current CVS which adds a rotation
control to the transformations page of the GUI. This is not intended for
a commit yet, but it might be a useful start for anyone who'd like to
start tackling the issues of how arbitrary rotations interact with the
existing transformation controls.


Martin
diff --git a/ufraw_preview.c b/ufraw_preview.c
index 2a89ac9..7723b7f 100644
--- a/ufraw_preview.c
+++ b/ufraw_preview.c
@@ -2702,6 +2702,10 @@ static void adjustment_update(GtkAdjustment *adj, double *valuep)
 	CFG->Scale = 0;
 	create_base_image(data);
     }
+    else if (valuep==&CFG->rotationAngle)
+    {
+        create_base_image(data);
+    }
     else if (valuep==&CFG->threshold)
         preview_invalidate_layer (data, ufraw_denoise_phase);
     else
@@ -4613,6 +4617,24 @@ static void transformations_fill_interface(preview_data *data,
     gtk_table_attach(table, button, 4, 5, 0, 1, 0, 0, 0, 0);
     g_signal_connect(G_OBJECT(button), "clicked",
 		     G_CALLBACK(flip_image), (gpointer)2);
+
+    /* Rotation controls */
+    table = GTK_TABLE(table_with_frame(page, NULL, TRUE));
+    label = gtk_label_new(_("Rotation"));
+    gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, 0, 0, 0, 0);
+    data->RotationAdjustment = GTK_ADJUSTMENT(gtk_adjustment_new(
+        CFG->rotationAngle, 0, 90, 1, 10, 0));
+    g_object_set_data(G_OBJECT(data->RotationAdjustment),
+        "Adjustment-Accuracy", (gpointer)0);
+    data->RotationSpin = GTK_SPIN_BUTTON(gtk_spin_button_new(
+        data->RotationAdjustment, 1, 3));
+    g_object_set_data(G_OBJECT(data->RotationAdjustment), "Parent-Widget",
+        data->RotationSpin);
+    g_signal_connect(G_OBJECT(data->RotationAdjustment), "value-changed",
+        G_CALLBACK(adjustment_update), &CFG->rotationAngle);
+    gtk_table_attach(GTK_TABLE(table), GTK_WIDGET(data->RotationSpin),
+        1, 2, 0, 1, 0, 0, 0, 0);
+
     /* End of transformation page */
 }
 
diff --git a/ufraw_ui.h b/ufraw_ui.h
index 1d4b65b..7db80e0 100644
--- a/ufraw_ui.h
+++ b/ufraw_ui.h
@@ -83,6 +83,7 @@ typedef struct {
     GtkSpinButton *ShrinkSpin;
     GtkSpinButton *HeightSpin;
     GtkSpinButton *WidthSpin;
+    GtkSpinButton *RotationSpin;
     /* We need the adjustments for update_scale() */
     GtkAdjustment *WBTuningAdjustment;
     GtkAdjustment *TemperatureAdjustment;
@@ -107,6 +108,7 @@ typedef struct {
     GtkAdjustment *ShrinkAdjustment;
     GtkAdjustment *HeightAdjustment;
     GtkAdjustment *WidthAdjustment;
+    GtkAdjustment *RotationAdjustment;
     GtkAdjustment *GrayscaleMixers[3];
 #ifdef HAVE_LENSFUN
     /* The GtkEntry with camera maker/model name */
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
ufraw-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ufraw-devel

Reply via email to