Author: akv
Date: 2010-06-19 22:05:40 +0200 (Sat, 19 Jun 2010)
New Revision: 3433

Modified:
   trunk/src/rs-actions.c
Log:
Allowing to set camera and auto WB on multiple selected photos - bug 239.

Modified: trunk/src/rs-actions.c
===================================================================
--- trunk/src/rs-actions.c      2010-06-19 17:28:19 UTC (rev 3432)
+++ trunk/src/rs-actions.c      2010-06-19 20:05:40 UTC (rev 3433)
@@ -635,6 +635,28 @@
                gui_status_notify(_("Adjusting to auto white balance"));
                rs_photo_set_wb_auto(rs->photo, rs->current_setting);
        }
+
+       /* Apply to all selected photos */
+       GList *selected = rs_store_get_selected_names(rs->store);
+       gint num_selected = g_list_length(selected);
+
+       if (num_selected > 1)
+       {
+               RS_PHOTO *photo;
+               gint cur, load_mask;
+
+               for(cur=0;cur<num_selected;cur++)
+               {
+                       /* This is nothing but a hack around rs_cache_*() */
+                       photo = rs_photo_new();
+                       photo->filename = g_strdup(g_list_nth_data(selected, 
cur));
+                       load_mask = rs_cache_load(photo);
+                       
rs_settings_set_wb(photo->settings[rs->current_setting], 0.0, 0.0, 
PRESET_WB_AUTO);
+                       rs_cache_save(photo, load_mask | MASK_WB);
+                       g_object_unref(photo);
+               }
+               g_list_free(selected);
+       }
 }
 
 ACTION(camera_wb)
@@ -649,6 +671,28 @@
                        rs_photo_set_wb_from_mul(rs->photo, 
rs->current_setting, rs->photo->metadata->cam_mul, PRESET_WB_CAMERA);
                }
        }
+
+       /* Apply to all selected photos */
+       GList *selected = rs_store_get_selected_names(rs->store);
+       gint num_selected = g_list_length(selected);
+
+       if (num_selected > 1)
+       {
+               RS_PHOTO *photo;
+               gint cur, load_mask;
+
+               for(cur=0;cur<num_selected;cur++)
+               {
+                       /* This is nothing but a hack around rs_cache_*() */
+                       photo = rs_photo_new();
+                       photo->filename = g_strdup(g_list_nth_data(selected, 
cur));
+                       load_mask = rs_cache_load(photo);
+                       
rs_settings_set_wb(photo->settings[rs->current_setting], 0.0, 0.0, 
PRESET_WB_CAMERA);
+                       rs_cache_save(photo, load_mask | MASK_WB);
+                       g_object_unref(photo);
+               }
+               g_list_free(selected);
+       }
 }
 
 ACTION(crop)


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

Reply via email to