Author: post
Date: 2010-04-05 17:19:28 +0200 (Mon, 05 Apr 2010)
New Revision: 3342

Modified:
   trunk/src/rs-photo.c
   trunk/src/rs-photo.h
   trunk/src/rs-preview-widget.c
   trunk/src/rs-toolbox.c
Log:
Update view after lens is selected.

Modified: trunk/src/rs-photo.c
===================================================================
--- trunk/src/rs-photo.c        2010-04-05 15:16:56 UTC (rev 3341)
+++ trunk/src/rs-photo.c        2010-04-05 15:19:28 UTC (rev 3342)
@@ -31,6 +31,7 @@
        SPATIAL_CHANGED,
        SETTINGS_CHANGED,
        PROFILE_CHANGED,
+       LENS_CHANGED,
        LAST_SIGNAL
 };
 
@@ -113,6 +114,14 @@
                NULL,
                g_cclosure_marshal_VOID__POINTER,
                G_TYPE_NONE, 1, G_TYPE_POINTER);
+       signals[LENS_CHANGED] = g_signal_new ("lens-changed",
+               G_TYPE_FROM_CLASS (klass),
+               G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+               0, /* Is this right? */
+               NULL,
+               NULL,
+               g_cclosure_marshal_VOID__VOID,
+               G_TYPE_NONE, 0);
 
        parent_class = g_type_class_peek_parent (klass);
 }
@@ -426,6 +435,16 @@
 }
 
 /**
+ * Indicate that the lens has changed.
+ * @param photo A RS_PHOTO
+ */
+void rs_photo_lens_updated(RS_PHOTO *photo)
+{
+       g_assert(RS_IS_PHOTO(photo));
+       g_signal_emit(photo, signals[LENS_CHANGED], 0, 0);
+}
+
+/**
  * Get the assigned ICC profile for a RS_PHOTO
  * @param photo A RS_PHOTO
  * @return An ICC profile or NULL

Modified: trunk/src/rs-photo.h
===================================================================
--- trunk/src/rs-photo.h        2010-04-05 15:16:56 UTC (rev 3341)
+++ trunk/src/rs-photo.h        2010-04-05 15:19:28 UTC (rev 3342)
@@ -308,6 +308,12 @@
 extern void rs_photo_close(RS_PHOTO *photo);
 
 /**
+ * Indicate that the lens has changed.
+ * @param photo A RS_PHOTO
+ */
+extern void rs_photo_lens_updated(RS_PHOTO *photo);
+
+/**
  * Loads a photo in to a RS_PHOTO including metadata
  * @param filename The filename to load
  * @return A RS_PHOTO on success, NULL on error

Modified: trunk/src/rs-preview-widget.c
===================================================================
--- trunk/src/rs-preview-widget.c       2010-04-05 15:16:56 UTC (rev 3341)
+++ trunk/src/rs-preview-widget.c       2010-04-05 15:19:28 UTC (rev 3342)
@@ -233,6 +233,7 @@
 static void profile_changed(RS_PHOTO *photo, gpointer profile, RSPreviewWidget 
*preview);
 static void settings_changed(RS_PHOTO *photo, RSSettingsMask mask, 
RSPreviewWidget *preview);
 static void filter_changed(RSFilter *filter, RSFilterChangedMask mask, 
RSPreviewWidget *preview);
+static void lens_changed(RS_PHOTO *photo, RSPreviewWidget *preview);
 static gboolean get_image_coord(RSPreviewWidget *preview, gint view, const 
gint x, const gint y, gint *scaled_x, gint *scaled_y, gint *real_x, gint 
*real_y, gint *max_w, gint *max_h);
 static gint get_view_from_coord(RSPreviewWidget *preview, const gint x, const 
gint y);
 static void crop_aspect_changed(gpointer active, gpointer user_data);
@@ -621,6 +622,7 @@
        if (preview->photo)
        {
                g_signal_connect(G_OBJECT(preview->photo), "settings-changed", 
G_CALLBACK(settings_changed), preview);
+               g_signal_connect(G_OBJECT(preview->photo), "lens-changed", 
G_CALLBACK(lens_changed), preview);
                g_signal_connect(G_OBJECT(preview->photo), "profile-changed", 
G_CALLBACK(profile_changed), preview);
                for(view=0;view<MAX_VIEWS;view++) 
                {
@@ -2276,6 +2278,14 @@
 }
 
 static void
+lens_changed(RS_PHOTO *photo, RSPreviewWidget *preview)
+{
+       /* For now lensfun is the same for all views, so we update the first */
+       DIRTY(preview->dirty[0], SCREEN);
+       rs_filter_set_recursive(preview->filter_end[0], "distortion-enabled", 
TRUE, NULL);
+}
+
+static void
 profile_changed(RS_PHOTO *photo, gpointer profile, RSPreviewWidget *preview)
 {
        gint view;

Modified: trunk/src/rs-toolbox.c
===================================================================
--- trunk/src/rs-toolbox.c      2010-04-05 15:16:56 UTC (rev 3341)
+++ trunk/src/rs-toolbox.c      2010-04-05 15:19:28 UTC (rev 3342)
@@ -663,8 +663,7 @@
                for(i=0; i<3; i++) toolbox_lens_set_label(toolbox, i);
                RSLensDb *lens_db = rs_lens_db_get_default();
                rs_lens_db_save(lens_db);
-               /* FIXME: set lensfun plugin dirty */
-               /* FIXME: set photo dirty (force update) */
+               rs_photo_lens_updated(toolbox->photo);
        }
 }
 
@@ -705,7 +704,7 @@
        /* Pack everything nice */
        gtk_box_pack_start(GTK_BOX(vbox), gui_box(_("Basic"), 
GTK_WIDGET(table), "show_basic", TRUE), FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(vbox), gui_box(_("Channel Mixer"), 
GTK_WIDGET(channelmixertable), "show_channelmixer", TRUE), FALSE, FALSE, 0);
-       gtk_box_pack_start(GTK_BOX(vbox), gui_box(_("Lens corrections"), 
GTK_WIDGET(lenstable), "show_lens", TRUE), FALSE, FALSE, 0);
+       gtk_box_pack_start(GTK_BOX(vbox), gui_box(_("Lens Correction"), 
GTK_WIDGET(lenstable), "show_lens", TRUE), FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(vbox), gui_box(_("Curve"), 
toolbox->curve[snapshot], "show_curve", TRUE), FALSE, FALSE, 0);
 
        return vbox;


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

Reply via email to