[gimp/gimp-2-10] Issue #3025 - "File/New" doesn't honor "precision" choice ...
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] Issue #3025 - "File/New" doesn't honor "precision" choice ...
- Date: Sun, 31 Mar 2019 19:19:44 +0000 (UTC)
commit 8c7e2a9e03ffb3ebbf385350231a81eee59b26cd
Author: Ell <ell_se yahoo com>
Date: Sun Mar 31 14:54:30 2019 -0400
Issue #3025 - "File/New" doesn't honor "precision" choice ...
... for "Edit/Preferences/Default Image"
In GimpTemplateEditor, don't use gimp_prop_enum_combo_box_new() for
the "Precision" combo-box, and rather synchronize the combo-box and
the template manually, since we only want to update the "Gamma"
combo-box according to the precision when it changes through the
UI, and not when the template's precision otherwise changes.
This fixes an issue where we'd always set the default gamma value
when resetting the editor's template, overwriting the template's
original gamma value.
(cherry picked from commit 033082dd9a0850a86c1b0b76187afd4725df4e9f)
app/widgets/gimptemplateeditor.c | 47 +++++++++++++++++++++++++++++++++++-----
1 file changed, 41 insertions(+), 6 deletions(-)
---
diff --git a/app/widgets/gimptemplateeditor.c b/app/widgets/gimptemplateeditor.c
index 82311f5cc5..118700f0e2 100644
--- a/app/widgets/gimptemplateeditor.c
+++ b/app/widgets/gimptemplateeditor.c
@@ -31,6 +31,8 @@
#include "config/gimpcoreconfig.h"
+#include "gegl/gimp-babl.h"
+
#include "core/gimp.h"
#include "core/gimptemplate.h"
@@ -71,6 +73,7 @@ struct _GimpTemplateEditorPrivate
GtkWidget *more_label;
GtkWidget *resolution_se;
GtkWidget *chain_button;
+ GtkWidget *precision_combo;
GtkWidget *profile_combo;
};
@@ -158,6 +161,7 @@ gimp_template_editor_constructed (GObject *object)
GtkWidget *scrolled_window;
GtkWidget *text_view;
GtkTextBuffer *text_buffer;
+ GtkListStore *store;
GList *focus_chain = NULL;
gchar *text;
gint row;
@@ -404,15 +408,28 @@ gimp_template_editor_constructed (GObject *object)
_("Color _space:"), 0.0, 0.5,
combo, 1, FALSE);
- combo = gimp_prop_enum_combo_box_new (G_OBJECT (template),
- "component-type",
- GIMP_COMPONENT_TYPE_U8,
- GIMP_COMPONENT_TYPE_FLOAT);
+ /* construct the precision combo manually, instead of using
+ * gimp_prop_enum_combo_box_new(), so that we only reset the gamma combo when
+ * the precision is changed through the ui. see issue #3025.
+ */
+ store = gimp_enum_store_new_with_range (GIMP_TYPE_COMPONENT_TYPE,
+ GIMP_COMPONENT_TYPE_U8,
+ GIMP_COMPONENT_TYPE_FLOAT);
+
+ private->precision_combo = g_object_new (GIMP_TYPE_ENUM_COMBO_BOX,
+ "model", store,
+ NULL);
+ g_object_unref (store);
+
gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
_("_Precision:"), 0.0, 0.5,
- combo, 1, FALSE);
+ private->precision_combo, 1, FALSE);
- g_signal_connect (combo, "changed",
+ gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (private->precision_combo),
+ gimp_babl_component_type (
+ gimp_template_get_precision (template)));
+
+ g_signal_connect (private->precision_combo, "changed",
G_CALLBACK (gimp_template_editor_precision_changed),
editor);
@@ -642,6 +659,10 @@ gimp_template_editor_precision_changed (GtkWidget *widget,
gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget),
(gint *) &component_type);
+ g_object_set (private->template,
+ "component-type", component_type,
+ NULL);
+
/* when changing this logic, also change the same switch()
* in convert-precision-dialog.c
*/
@@ -763,6 +784,20 @@ gimp_template_editor_template_notify (GimpTemplate *template,
gimp_template_get_resolution_y (template),
FALSE);
}
+ else if (! strcmp (param_spec->name, "component-type"))
+ {
+ g_signal_handlers_block_by_func (private->precision_combo,
+ gimp_template_editor_precision_changed,
+ editor);
+
+ gimp_int_combo_box_set_active (
+ GIMP_INT_COMBO_BOX (private->precision_combo),
+ gimp_babl_component_type (gimp_template_get_precision (template)));
+
+ g_signal_handlers_unblock_by_func (private->precision_combo,
+ gimp_template_editor_precision_changed,
+ editor);
+ }
}
#ifdef ENABLE_MEMSIZE_LABEL
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]