[gimp] Issue #1297 - Unhide the items hidden in the Advanced drop-down file...



commit 7ed93452e8d2714cda2432fb46878aacfc9d5baa
Author: Michael Natterer <mitch gimp org>
Date:   Mon Dec 3 12:55:04 2018 +0100

    Issue #1297 - Unhide the items hidden in the Advanced drop-down file...
    
    ...export dialogs
    
    Remove the "Advanced" expander from the PNG export GUI and generally
    clean up the dialog layout.
    
    Issue #701: Add a "Save color profile" toggle and always honor it.

 plug-ins/common/file-png.c      |  34 +++--
 plug-ins/ui/plug-in-file-png.ui | 272 +++++++++++++++++++---------------------
 2 files changed, 156 insertions(+), 150 deletions(-)
---
diff --git a/plug-ins/common/file-png.c b/plug-ins/common/file-png.c
index e065b17ccf..afd63855d9 100644
--- a/plug-ins/common/file-png.c
+++ b/plug-ins/common/file-png.c
@@ -104,6 +104,7 @@ typedef struct
   gboolean  save_xmp;
   gboolean  save_iptc;
   gboolean  save_thumbnail;
+  gboolean  save_profile;
   PngExportFormat export_format;
 }
 PngSaveVals;
@@ -126,6 +127,7 @@ typedef struct
   GtkWidget     *save_xmp;
   GtkWidget     *save_iptc;
   GtkWidget     *save_thumbnail;
+  GtkWidget     *save_profile;
 }
 PngSaveGui;
 
@@ -551,6 +553,7 @@ run (const gchar      *name,
       pngvals.save_xmp       = (metadata_flags & GIMP_METADATA_SAVE_XMP) != 0;
       pngvals.save_iptc      = (metadata_flags & GIMP_METADATA_SAVE_IPTC) != 0;
       pngvals.save_thumbnail = (metadata_flags & GIMP_METADATA_SAVE_THUMBNAIL) != 0;
+      pngvals.save_profile   = gimp_export_color_profile ();
 
       /* Override preferences from PNG export defaults (if saved). */
       load_parasite ();
@@ -1495,7 +1498,8 @@ save_image (const gchar  *filename,
   png_textp         text = NULL;
 
 #if defined(PNG_iCCP_SUPPORTED)
-  profile = gimp_image_get_color_profile (orig_image_ID);
+  if (pngvals.save_profile)
+    profile = gimp_image_get_effective_color_profile (orig_image_ID);
 #endif
 
   switch (gimp_image_get_precision (image_ID))
@@ -2386,18 +2390,25 @@ save_dialog (gint32    image_ID,
   pg.time = toggle_button_init (builder, "save-creation-time",
                                 pngvals.time,
                                 &pngvals.time);
-  pg.save_exif = toggle_button_init (builder, "sv_exif",
+  pg.save_exif = toggle_button_init (builder, "save-exif",
                                      pngvals.save_exif,
                                      &pngvals.save_exif);
-  pg.save_xmp = toggle_button_init (builder, "sv_xmp",
+  pg.save_xmp = toggle_button_init (builder, "save-xmp",
                                     pngvals.save_xmp,
                                     &pngvals.save_xmp);
-  pg.save_iptc = toggle_button_init (builder, "sv_iptc",
+  pg.save_iptc = toggle_button_init (builder, "save-iptc",
                                      pngvals.save_iptc,
                                      &pngvals.save_iptc);
-  pg.save_thumbnail = toggle_button_init (builder, "sv_thumbnail",
+  pg.save_thumbnail = toggle_button_init (builder, "save-thumbnail",
                                           pngvals.save_thumbnail,
                                           &pngvals.save_thumbnail);
+  pg.save_profile = toggle_button_init (builder, "save-color-profile",
+                                        pngvals.save_profile,
+                                        &pngvals.save_profile);
+
+#if !defined(PNG_iCCP_SUPPORTED)
+  gtk_widget_hide (pg.save_profile);
+#endif
 
   /* Comment toggle */
   parasite = gimp_image_get_parasite (image_ID, "gimp-comment");
@@ -2498,7 +2509,7 @@ load_parasite (void)
 
       gimp_parasite_free (parasite);
 
-      num_fields = sscanf (def_str, "%d %d %d %d %d %d %d %d %d %d %d %d %d",
+      num_fields = sscanf (def_str, "%d %d %d %d %d %d %d %d %d %d %d %d %d %d",
                            &tmpvals.interlaced,
                            &tmpvals.bkgd,
                            &tmpvals.gama,
@@ -2511,11 +2522,12 @@ load_parasite (void)
                            &tmpvals.save_exif,
                            &tmpvals.save_xmp,
                            &tmpvals.save_iptc,
-                           &tmpvals.save_thumbnail);
+                           &tmpvals.save_thumbnail,
+                           &tmpvals.save_profile);
 
       g_free (def_str);
 
-      if (num_fields == 9 || num_fields == 13)
+      if (num_fields == 9 || num_fields == 13 || num_fields == 14)
         pngvals = tmpvals;
     }
 }
@@ -2526,7 +2538,7 @@ save_parasite (void)
   GimpParasite *parasite;
   gchar        *def_str;
 
-  def_str = g_strdup_printf ("%d %d %d %d %d %d %d %d %d %d %d %d %d",
+  def_str = g_strdup_printf ("%d %d %d %d %d %d %d %d %d %d %d %d %d %d",
                              pngvals.interlaced,
                              pngvals.bkgd,
                              pngvals.gama,
@@ -2539,7 +2551,8 @@ save_parasite (void)
                              pngvals.save_exif,
                              pngvals.save_xmp,
                              pngvals.save_iptc,
-                             pngvals.save_thumbnail);
+                             pngvals.save_thumbnail,
+                             pngvals.save_profile);
 
   parasite = gimp_parasite_new (PNG_DEFAULTS_PARASITE,
                                 GIMP_PARASITE_PERSISTENT,
@@ -2575,6 +2588,7 @@ load_gui_defaults (PngSaveGui *pg)
   SET_ACTIVE (save_xmp);
   SET_ACTIVE (save_iptc);
   SET_ACTIVE (save_thumbnail);
+  SET_ACTIVE (save_profile);
 
 #undef SET_ACTIVE
 
diff --git a/plug-ins/ui/plug-in-file-png.ui b/plug-ins/ui/plug-in-file-png.ui
index 97ccef0819..6a5fecce4e 100644
--- a/plug-ins/ui/plug-in-file-png.ui
+++ b/plug-ins/ui/plug-in-file-png.ui
@@ -27,7 +27,7 @@
       <packing>
         <property name="left_attach">0</property>
         <property name="top_attach">0</property>
-        <property name="width">3</property>
+        <property name="width">2</property>
       </packing>
     </child>
     <child>
@@ -43,7 +43,7 @@
       <packing>
         <property name="left_attach">0</property>
         <property name="top_attach">1</property>
-        <property name="width">3</property>
+        <property name="width">2</property>
       </packing>
     </child>
     <child>
@@ -58,7 +58,7 @@
       <packing>
         <property name="left_attach">0</property>
         <property name="top_attach">2</property>
-        <property name="width">3</property>
+        <property name="width">2</property>
       </packing>
     </child>
     <child>
@@ -74,7 +74,7 @@
       <packing>
         <property name="left_attach">0</property>
         <property name="top_attach">3</property>
-        <property name="width">3</property>
+        <property name="width">2</property>
       </packing>
     </child>
     <child>
@@ -90,7 +90,7 @@
       <packing>
         <property name="left_attach">0</property>
         <property name="top_attach">4</property>
-        <property name="width">3</property>
+        <property name="width">2</property>
       </packing>
     </child>
     <child>
@@ -106,7 +106,87 @@
       <packing>
         <property name="left_attach">0</property>
         <property name="top_attach">5</property>
-        <property name="width">3</property>
+        <property name="width">2</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkCheckButton" id="save-exif">
+        <property name="label" translatable="yes">Save Exif data</property>
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="receives_default">False</property>
+        <property name="halign">start</property>
+        <property name="active">True</property>
+        <property name="draw_indicator">True</property>
+      </object>
+      <packing>
+        <property name="left_attach">2</property>
+        <property name="top_attach">1</property>
+        <property name="width">2</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkCheckButton" id="save-xmp">
+        <property name="label" translatable="yes">Save XMP data</property>
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="receives_default">False</property>
+        <property name="halign">start</property>
+        <property name="active">True</property>
+        <property name="draw_indicator">True</property>
+      </object>
+      <packing>
+        <property name="left_attach">2</property>
+        <property name="top_attach">2</property>
+        <property name="width">2</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkCheckButton" id="save-iptc">
+        <property name="label" translatable="yes">Save IPTC data</property>
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="receives_default">False</property>
+        <property name="halign">start</property>
+        <property name="active">True</property>
+        <property name="draw_indicator">True</property>
+      </object>
+      <packing>
+        <property name="left_attach">2</property>
+        <property name="top_attach">3</property>
+        <property name="width">2</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkCheckButton" id="save-thumbnail">
+        <property name="label" translatable="yes">Save thumbnail</property>
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="receives_default">False</property>
+        <property name="halign">start</property>
+        <property name="active">True</property>
+        <property name="draw_indicator">True</property>
+      </object>
+      <packing>
+        <property name="left_attach">2</property>
+        <property name="top_attach">4</property>
+        <property name="width">2</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkCheckButton" id="save-color-profile">
+        <property name="label" translatable="yes">Save color profile</property>
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="receives_default">False</property>
+        <property name="halign">start</property>
+        <property name="active">True</property>
+        <property name="draw_indicator">True</property>
+      </object>
+      <packing>
+        <property name="left_attach">2</property>
+        <property name="top_attach">5</property>
+        <property name="width">2</property>
       </packing>
     </child>
     <child>
@@ -120,9 +200,9 @@
         <property name="draw_indicator">True</property>
       </object>
       <packing>
-        <property name="left_attach">0</property>
-        <property name="top_attach">6</property>
-        <property name="width">3</property>
+        <property name="left_attach">2</property>
+        <property name="top_attach">0</property>
+        <property name="width">2</property>
       </packing>
     </child>
     <child>
@@ -136,14 +216,51 @@
         <property name="use_underline">True</property>
         <property name="draw_indicator">True</property>
       </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">6</property>
+        <property name="width">4</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkComboBoxText" id="pixelformat-combo">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <items>
+          <item translatable="yes">automatic pixelformat</item>
+          <item translatable="yes">8bpc RGB</item>
+          <item translatable="yes">8bpc GRAY</item>
+          <item translatable="yes">8bpc RGBA</item>
+          <item translatable="yes">8bpc GRAYA</item>
+          <item translatable="yes">16bpc RGB</item>
+          <item translatable="yes">16bpc GRAY</item>
+          <item translatable="yes">16bpc RGBA</item>
+          <item translatable="yes">16bpc GRAYA</item>
+        </items>
+      </object>
       <packing>
         <property name="left_attach">0</property>
         <property name="top_attach">7</property>
-        <property name="width">3</property>
+        <property name="width">4</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLabel" id="compression-level-label">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="halign">start</property>
+        <property name="label" translatable="yes">Co_mpression level:</property>
+        <property name="use_underline">True</property>
+        <property name="xalign">0</property>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">8</property>
       </packing>
     </child>
     <child>
       <object class="GtkScale" id="compression-level-scale">
+        <property name="width_request">100</property>
         <property name="visible">True</property>
         <property name="can_focus">True</property>
         <property name="hexpand">True</property>
@@ -152,7 +269,8 @@
       </object>
       <packing>
         <property name="left_attach">1</property>
-        <property name="top_attach">9</property>
+        <property name="top_attach">8</property>
+        <property name="width">2</property>
       </packing>
     </child>
     <child>
@@ -168,8 +286,8 @@
         <property name="numeric">True</property>
       </object>
       <packing>
-        <property name="left_attach">2</property>
-        <property name="top_attach">9</property>
+        <property name="left_attach">3</property>
+        <property name="top_attach">8</property>
       </packing>
     </child>
     <child>
@@ -207,136 +325,10 @@
           </packing>
         </child>
       </object>
-      <packing>
-        <property name="left_attach">0</property>
-        <property name="top_attach">11</property>
-        <property name="width">3</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkExpander" id="expander1">
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <child>
-          <object class="GtkBox" id="box1">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="orientation">vertical</property>
-            <child>
-              <object class="GtkCheckButton" id="sv_exif">
-                <property name="label" translatable="yes">Save Exif data</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">False</property>
-                <property name="halign">start</property>
-                <property name="active">True</property>
-                <property name="draw_indicator">True</property>
-              </object>
-              <packing>
-                <property name="expand">True</property>
-                <property name="fill">True</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkCheckButton" id="sv_xmp">
-                <property name="label" translatable="yes">Save XMP data</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">False</property>
-                <property name="halign">start</property>
-                <property name="active">True</property>
-                <property name="draw_indicator">True</property>
-              </object>
-              <packing>
-                <property name="expand">True</property>
-                <property name="fill">True</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkCheckButton" id="sv_iptc">
-                <property name="label" translatable="yes">Save IPTC data</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">False</property>
-                <property name="halign">start</property>
-                <property name="active">True</property>
-                <property name="draw_indicator">True</property>
-              </object>
-              <packing>
-                <property name="expand">True</property>
-                <property name="fill">True</property>
-                <property name="position">2</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkCheckButton" id="sv_thumbnail">
-                <property name="label" translatable="yes">Save thumbnail</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">False</property>
-                <property name="halign">start</property>
-                <property name="active">True</property>
-                <property name="draw_indicator">True</property>
-              </object>
-              <packing>
-                <property name="expand">True</property>
-                <property name="fill">True</property>
-                <property name="position">3</property>
-              </packing>
-            </child>
-          </object>
-        </child>
-        <child type="label">
-          <object class="GtkLabel" id="label1">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="label" translatable="yes">Advanced</property>
-          </object>
-        </child>
-      </object>
-      <packing>
-        <property name="left_attach">0</property>
-        <property name="top_attach">10</property>
-        <property name="width">3</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkLabel" id="compression-level-label">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="halign">start</property>
-        <property name="label" translatable="yes">Co_mpression level:</property>
-        <property name="use_underline">True</property>
-        <property name="mnemonic_widget">compression-level-spin</property>
-        <property name="xalign">0</property>
-      </object>
       <packing>
         <property name="left_attach">0</property>
         <property name="top_attach">9</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkComboBoxText" id="pixelformat-combo">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <items>
-          <item translatable="yes">automatic pixelformat</item>
-          <item translatable="yes">8bpc RGB</item>
-          <item translatable="yes">8bpc GRAY</item>
-          <item translatable="yes">8bpc RGBA</item>
-          <item translatable="yes">8bpc GRAYA</item>
-          <item translatable="yes">16bpc RGB</item>
-          <item translatable="yes">16bpc GRAY</item>
-          <item translatable="yes">16bpc RGBA</item>
-          <item translatable="yes">16bpc GRAYA</item>
-        </items>
-      </object>
-      <packing>
-        <property name="left_attach">0</property>
-        <property name="top_attach">8</property>
-        <property name="width">3</property>
+        <property name="width">4</property>
       </packing>
     </child>
   </object>


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