[gimp] plug-ins: add a "Load Defaults" button to reset print resolution...



commit 4827116ac989c7a91f2586bd0c61570b5c697e22
Author: Jehan <jehan girinstud io>
Date:   Wed Dec 14 00:33:04 2016 +0100

    plug-ins: add a "Load Defaults" button to reset print resolution...
    
    ... in the print plug-in.
    The resolution set during printing may be different from the print size,
    for various reason (home printing vs. printshop for instance). The print
    plug-in's resolution is saved and reused from a non-persistent parasite,
    thus masking actual intended print resolution. Adding this button allows
    to reset this temporary value to the intended resolution at any time.

 plug-ins/print/print-page-layout.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/plug-ins/print/print-page-layout.c b/plug-ins/print/print-page-layout.c
index 15708a2..48f0a64 100644
--- a/plug-ins/print/print-page-layout.c
+++ b/plug-ins/print/print-page-layout.c
@@ -94,6 +94,7 @@ static void        print_size_info_set_page_setup     (PrintSizeInfo *info);
 
 static void        print_draw_crop_marks_toggled      (GtkWidget     *widget);
 
+static void        print_resolution_load_defaults     (PrintSizeInfo *info);
 
 static PrintSizeInfo  info;
 
@@ -235,6 +236,7 @@ print_size_frame (PrintData    *data,
   GtkWidget     *chain;
   GtkWidget     *frame;
   GtkWidget     *label;
+  GtkWidget     *button;
   GtkAdjustment *adj;
   gdouble        image_width;
   gdouble        image_height;
@@ -330,6 +332,13 @@ print_size_frame (PrintData    *data,
                                         _("_Y resolution:"), 1, 0, 0.0);
   gtk_size_group_add_widget (label_group, label);
 
+  button = gtk_button_new_with_mnemonic (_("_Load Defaults"));
+  g_signal_connect_swapped (button, "clicked",
+                            G_CALLBACK (print_resolution_load_defaults),
+                            &info);
+  gtk_widget_show (button);
+  gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
+
   gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (entry), 0,
                                          GIMP_MIN_RESOLUTION,
                                          GIMP_MAX_RESOLUTION);
@@ -923,3 +932,15 @@ print_draw_crop_marks_toggled (GtkWidget *widget)
   info.data->draw_crop_marks = active;
 }
 
+static void
+print_resolution_load_defaults (PrintSizeInfo *info)
+{
+  gdouble xres;
+  gdouble yres;
+
+  gimp_image_get_resolution (info->data->image_id, &xres, &yres);
+
+  gimp_size_entry_set_refval (info->resolution_entry, 0, xres);
+  gimp_size_entry_set_refval (info->resolution_entry, 1, yres);
+  print_size_info_resolution_changed (GTK_WIDGET (info->resolution_entry));
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]