[Rawstudio-commit] r1987 - trunk/src

Anders Brander anders at brander.dk
Thu Sep 11 20:36:59 CEST 2008


Author: abrander
Date: 2008-09-11 20:36:59 +0200 (Thu, 11 Sep 2008)
New Revision: 1987

Modified:
   trunk/src/rawstudio.c
   trunk/src/rs-actions.c
   trunk/src/rs-cache.c
   trunk/src/rs-cache.h
   trunk/src/rs-photo.c
Log:
Added mask argument to rs_cache_save().

Modified: trunk/src/rawstudio.c
===================================================================
--- trunk/src/rawstudio.c	2008-09-09 22:03:06 UTC (rev 1986)
+++ trunk/src/rawstudio.c	2008-09-11 18:36:59 UTC (rev 1987)
@@ -617,7 +617,7 @@
 	g_object_unref(rct);
 
 	photo->exported = TRUE;
-	rs_cache_save(photo);
+	rs_cache_save(photo, MASK_ALL);
 
 	/* Set the exported flag */
 	rs_store_set_flags(NULL, photo->filename, NULL, NULL, &photo->exported);

Modified: trunk/src/rs-actions.c
===================================================================
--- trunk/src/rs-actions.c	2008-09-09 22:03:06 UTC (rev 1986)
+++ trunk/src/rs-actions.c	2008-09-11 18:36:59 UTC (rev 1987)
@@ -444,7 +444,7 @@
 					}
 					rs_cache_load(photo);
 					rs_settings_double_copy(rs->settings_buffer, photo->settings[rs->current_setting], mask);
-					rs_cache_save(photo);
+					rs_cache_save(photo, mask);
 				}
 				g_object_unref(photo);
 			}
@@ -638,7 +638,7 @@
 
 	if (RS_IS_PHOTO(rs->photo) && num_selected == 1)
 	{
-		rs_cache_save(rs->photo);
+		rs_cache_save(rs->photo, MASK_ALL);
 
 		if (rs_batch_add_to_queue(rs->queue, rs->photo->filename, rs->current_setting))
 			g_string_printf(gs, _(" %s added to batch queue"), rs->photo->filename);
@@ -720,7 +720,7 @@
 
 		/* Save settings of current photo just to be sure */
 		if (rs->photo)
-			rs_cache_save(rs->photo);
+			rs_cache_save(rs->photo, MASK_ALL);
 
 		g_string_printf(gs, _("%d photos added to batch queue"),
 			((gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cb_a))) ? num_selected : 0)

Modified: trunk/src/rs-cache.c
===================================================================
--- trunk/src/rs-cache.c	2008-09-09 22:03:06 UTC (rev 1986)
+++ trunk/src/rs-cache.c	2008-09-11 18:36:59 UTC (rev 1987)
@@ -53,7 +53,7 @@
 }
 
 void
-rs_cache_save(RS_PHOTO *photo)
+rs_cache_save(RS_PHOTO *photo, guint mask)
 {
 	gint id, i;
 	xmlTextWriterPtr writer;
@@ -82,25 +82,32 @@
 			photo->crop->x1, photo->crop->y1,
 			photo->crop->x2, photo->crop->y2);
 	}
-	for(id=0;id<3;id++)
+	for(id=0;id<3&&mask>0;id++)
 	{
 		xmlTextWriterStartElement(writer, BAD_CAST "settings");
 		xmlTextWriterWriteFormatAttribute(writer, BAD_CAST "id", "%d", id);
-		xmlTextWriterWriteFormatElement(writer, BAD_CAST "exposure", "%f",
-			photo->settings[id]->exposure);
+		if (mask & MASK_EXPOSURE)
+			xmlTextWriterWriteFormatElement(writer, BAD_CAST "exposure", "%f",
+				photo->settings[id]->exposure);
+		if (mask & MASK_SATURATION)
 		xmlTextWriterWriteFormatElement(writer, BAD_CAST "saturation", "%f",
 			photo->settings[id]->saturation);
+		if (mask & MASK_HUE)
 		xmlTextWriterWriteFormatElement(writer, BAD_CAST "hue", "%f",
 			photo->settings[id]->hue);
+		if (mask & MASK_CONTRAST)
 		xmlTextWriterWriteFormatElement(writer, BAD_CAST "contrast", "%f",
 			photo->settings[id]->contrast);
+		if (mask & MASK_WARMTH)
 		xmlTextWriterWriteFormatElement(writer, BAD_CAST "warmth", "%f",
 			photo->settings[id]->warmth);
+		if (mask & MASK_TINT)
 		xmlTextWriterWriteFormatElement(writer, BAD_CAST "tint", "%f",
 			photo->settings[id]->tint);
+		if (mask & MASK_SHARPEN)
 		xmlTextWriterWriteFormatElement(writer, BAD_CAST "sharpen", "%f",
 			photo->settings[id]->sharpen);
-		if (photo->settings[id]->curve_nknots > 0)
+		if (mask & MASK_CURVE && photo->settings[id]->curve_nknots > 0)
 		{
 			xmlTextWriterStartElement(writer, BAD_CAST "curve");
 			xmlTextWriterWriteFormatAttribute(writer, BAD_CAST "num", "%d", photo->settings[id]->curve_nknots);
@@ -375,7 +382,7 @@
 			photo->priority = *priority;
 		if (exported)
 			photo->exported = *exported;
-		rs_cache_save(photo);
+		rs_cache_save(photo, 0);
 	}
 	else
 	{

Modified: trunk/src/rs-cache.h
===================================================================
--- trunk/src/rs-cache.h	2008-09-09 22:03:06 UTC (rev 1986)
+++ trunk/src/rs-cache.h	2008-09-11 18:36:59 UTC (rev 1987)
@@ -21,7 +21,7 @@
 #define RS_CACHE_H
 
 extern gchar *rs_cache_get_name(const gchar *src);
-extern void rs_cache_save(RS_PHOTO *photo);
+extern void rs_cache_save(RS_PHOTO *photo, guint mask);
 extern gboolean rs_cache_load(RS_PHOTO *photo);
 extern void rs_cache_load_quick(const gchar *filename, gint *priority, gboolean *exported);
 extern void rs_cache_save_flags(const gchar *filename, const guint *priority, const gboolean *exported);

Modified: trunk/src/rs-photo.c
===================================================================
--- trunk/src/rs-photo.c	2008-09-09 22:03:06 UTC (rev 1986)
+++ trunk/src/rs-photo.c	2008-09-11 18:36:59 UTC (rev 1987)
@@ -634,5 +634,5 @@
 {
 	if (!photo) return;
 
-	rs_cache_save(photo);
+	rs_cache_save(photo, MASK_ALL);
 }




More information about the Rawstudio-commit mailing list