Author: post
Date: 2010-12-29 04:26:08 +0100 (Wed, 29 Dec 2010)
New Revision: 3709

Modified:
   trunk/src/application.h
   trunk/src/gtk-interface.c
   trunk/src/rs-preview-widget.c
Log:
Automatically crop away leftovers from lens correction, if image has not 
already not already been cropped or straightened.

Modified: trunk/src/application.h
===================================================================
--- trunk/src/application.h     2010-12-29 03:23:57 UTC (rev 3708)
+++ trunk/src/application.h     2010-12-29 03:26:08 UTC (rev 3709)
@@ -52,6 +52,7 @@
        RSIccProfile *icc;
        gboolean dispose_has_run;
        RSFilter *thumbnail_filter;
+       RS_RECT *proposed_crop;
 } RS_PHOTO;
 
 typedef struct {

Modified: trunk/src/gtk-interface.c
===================================================================
--- trunk/src/gtk-interface.c   2010-12-29 03:23:57 UTC (rev 3708)
+++ trunk/src/gtk-interface.c   2010-12-29 03:26:08 UTC (rev 3709)
@@ -190,6 +190,8 @@
        rs_toolbox_set_photo(RS_TOOLBOX(rs->tools), photo);
        GTK_CATCHUP();
        gui_set_busy(FALSE);
+       if (NULL==rs->photo->crop && rs->photo->proposed_crop)
+               rs_photo_set_crop(rs->photo, rs->photo->proposed_crop);
        rs_core_actions_update_menu_items(rs);
        return TRUE;
 }

Modified: trunk/src/rs-preview-widget.c
===================================================================
--- trunk/src/rs-preview-widget.c       2010-12-29 03:23:57 UTC (rev 3708)
+++ trunk/src/rs-preview-widget.c       2010-12-29 03:26:08 UTC (rev 3709)
@@ -1529,6 +1529,24 @@
                                
rs_filter_request_set_quick(preview->request[i], FALSE);
                                gdk_window_invalidate_rect(window, &area, 
FALSE);
                        }
+                       else if (preview->photo && NULL==preview->photo->crop 
&& NULL==preview->photo->proposed_crop)
+                       {
+                               preview->photo->proposed_crop = 
g_new(RS_RECT,1);
+                               if (ABS(preview->photo->angle) < 0.001 &&
+                                       
rs_filter_param_get_integer(RS_FILTER_PARAM(response), "proposed-crop-x1", 
&preview->photo->proposed_crop->x1) &&
+                                               
rs_filter_param_get_integer(RS_FILTER_PARAM(response), "proposed-crop-y1", 
&preview->photo->proposed_crop->y1) &&
+                                                       
rs_filter_param_get_integer(RS_FILTER_PARAM(response), "proposed-crop-x2", 
&preview->photo->proposed_crop->x2) &&
+                                                               
rs_filter_param_get_integer(RS_FILTER_PARAM(response), "proposed-crop-y2", 
&preview->photo->proposed_crop->y2))
+                               {
+                                       if (preview->photo->orientation)
+                                               
rs_photo_rotate_rect_inverse(preview->photo, preview->photo->proposed_crop);
+                               }
+                               else 
+                               {
+                                       g_free(preview->photo->proposed_crop);
+                                       preview->photo->proposed_crop = NULL;
+                               }
+                       }
                        g_object_unref(new_request);
                        g_object_unref(response);
                }


_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit

Reply via email to