Author: post
Date: 2010-04-05 12:37:27 +0200 (Mon, 05 Apr 2010)
New Revision: 3335

Modified:
   trunk/src/conf_interface.h
   trunk/src/rs-save-dialog.c
Log:
Remember Percent scale from one export to the next.

Modified: trunk/src/conf_interface.h
===================================================================
--- trunk/src/conf_interface.h  2010-04-05 09:12:54 UTC (rev 3334)
+++ trunk/src/conf_interface.h  2010-04-05 10:37:27 UTC (rev 3335)
@@ -65,6 +65,7 @@
 #define CONF_LIBRARY_AUTOTAG "library_autotag"
 #define CONF_LIBRARY_TAG_SEARCH "library_tag_search"
 #define CONF_EXPORT_AS_FOLDER "export_as_folder"
+#define CONF_EXPORT_AS_SIZE_PERCENT "export_as_size_percent"
 
 #define DEFAULT_CONF_EXPORT_FILENAME "%f_%2c"
 #define DEFAULT_CONF_BATCH_DIRECTORY "batch_exports/"

Modified: trunk/src/rs-save-dialog.c
===================================================================
--- trunk/src/rs-save-dialog.c  2010-04-05 09:12:54 UTC (rev 3334)
+++ trunk/src/rs-save-dialog.c  2010-04-05 10:37:27 UTC (rev 3335)
@@ -198,13 +198,15 @@
        dialog->photo = g_object_ref(photo);
 
        gint w, h;
+       gdouble percent = 100.0f;
+       rs_conf_get_double(CONF_EXPORT_AS_SIZE_PERCENT, &percent);
        rs_filter_get_size_simple(dialog->fcrop, RS_FILTER_REQUEST_QUICK, &w, 
&h);
        dialog->w_original = w;
        dialog->h_original = h;
 
-       gtk_spin_button_set_value(dialog->w_spin, dialog->w_original);
-       gtk_spin_button_set_value(dialog->h_spin, dialog->h_original);
-       gtk_spin_button_set_value(dialog->p_spin, 100.0);
+       gtk_spin_button_set_value(dialog->w_spin, percent * dialog->w_original 
/ 100.0);
+       gtk_spin_button_set_value(dialog->h_spin, percent * dialog->w_original 
/ 100.0);
+       gtk_spin_button_set_value(dialog->p_spin, percent);
        
        gchar* basename = g_path_get_basename(photo->filename);
        gchar* output = g_strrstr(basename, ".");
@@ -392,9 +394,11 @@
        dialog->keep_aspect = togglebutton->active;
        if (dialog->keep_aspect)
        {
-               gtk_spin_button_set_value(dialog->w_spin, dialog->w_original);
-               gtk_spin_button_set_value(dialog->h_spin, dialog->h_original);
-               gtk_spin_button_set_value(dialog->p_spin, 100.0);
+               gdouble percent = 100.0f;
+               rs_conf_get_double(CONF_EXPORT_AS_SIZE_PERCENT, &percent);
+               gtk_spin_button_set_value(dialog->w_spin, percent * 
dialog->w_original / 100.0);
+               gtk_spin_button_set_value(dialog->h_spin, percent * 
dialog->h_original / 100.0);
+               gtk_spin_button_set_value(dialog->p_spin, percent);
        }
        return;
 }
@@ -441,6 +445,7 @@
        gtk_spin_button_set_value(dialog->h_spin, dialog->h_original*ratio);
        g_signal_handler_unblock(dialog->w_spin, dialog->w_signal);
        g_signal_handler_unblock(dialog->h_spin, dialog->h_signal);
+       
rs_conf_set_double(CONF_EXPORT_AS_SIZE_PERCENT,gtk_spin_button_get_value(spinbutton));
        return;
 }
 
@@ -458,6 +463,9 @@
        GtkWidget *vbox, *hbox;
        GtkWidget *checkbox;
 
+       gdouble percent = 100.0f;
+       rs_conf_get_double(CONF_EXPORT_AS_SIZE_PERCENT, &percent);
+
        checkbox = gtk_check_button_new_with_label(_("Keep aspect"));
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbox), 
dialog->keep_aspect);
        g_signal_connect ((gpointer) checkbox, "toggled", G_CALLBACK 
(size_pref_aspect_changed), dialog);
@@ -467,7 +475,7 @@
        dialog->p_spin = GTK_SPIN_BUTTON(gtk_spin_button_new_with_range(1.0, 
200.0, 1.0));
        gtk_spin_button_set_value(dialog->w_spin, (gdouble) dialog->save_width);
        gtk_spin_button_set_value(dialog->h_spin, (gdouble) 
dialog->save_height);
-       gtk_spin_button_set_value(dialog->p_spin, 100.0);
+       gtk_spin_button_set_value(dialog->p_spin, percent);
        dialog->w_signal = g_signal_connect(G_OBJECT(dialog->w_spin), 
"value_changed", G_CALLBACK(size_pref_w_changed), dialog);
        dialog->h_signal = g_signal_connect(G_OBJECT(dialog->h_spin), 
"value_changed", G_CALLBACK(size_pref_h_changed), dialog);
        g_signal_connect(G_OBJECT(dialog->p_spin), "value_changed", 
G_CALLBACK(size_pref_p_changed), dialog);


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

Reply via email to