diff --git a/app/core/gimpdrawable-filters.c b/app/core/gimpdrawable-filters.c index 4b9364f988..1d445b6689 100644 --- a/app/core/gimpdrawable-filters.c +++ b/app/core/gimpdrawable-filters.c @@ -112,18 +112,10 @@ gimp_drawable_n_editable_filters (GimpDrawable *drawable, GimpFilter *filter = list->data; gboolean editable = FALSE; - if (GIMP_IS_DRAWABLE_FILTER (filter)) + if (GIMP_IS_DRAWABLE_FILTER (filter) && + ! gimp_drawable_filter_get_temporary (GIMP_DRAWABLE_FILTER (filter))) { - gboolean temporary; - - g_object_get (filter, - "temporary", &temporary, - NULL); - - if (temporary) - editing_blocked = TRUE; - else - editable = TRUE; + editable = TRUE; } else { diff --git a/app/core/gimpdrawablefilter.c b/app/core/gimpdrawablefilter.c index 78b7907a0b..c8fcf11419 100644 --- a/app/core/gimpdrawablefilter.c +++ b/app/core/gimpdrawablefilter.c @@ -115,7 +115,7 @@ struct _GimpDrawableFilter GeglNode *crop_after; GimpApplicator *applicator; - gboolean is_temporary; + gboolean temporary; /* This is mirroring merge_filter option of GimpFilterOptions. */ gboolean to_be_merged; }; @@ -291,7 +291,7 @@ gimp_drawable_filter_set_property (GObject *object, break; case PROP_TEMPORARY: - filter->is_temporary = g_value_get_boolean (value); + filter->temporary = g_value_get_boolean (value); break; case PROP_TO_BE_MERGED: @@ -325,7 +325,7 @@ gimp_drawable_filter_get_property (GObject *object, g_value_set_boolean (value, filter->has_custom_name); break; case PROP_TEMPORARY: - g_value_set_boolean (value, filter->is_temporary); + g_value_set_boolean (value, filter->temporary); break; case PROP_TO_BE_MERGED: g_value_set_boolean (value, filter->to_be_merged); @@ -590,6 +590,30 @@ gimp_drawable_filter_get_mask (GimpDrawableFilter *filter) return filter->mask; } +void +gimp_drawable_filter_set_temporary (GimpDrawableFilter *filter, + gboolean temporary) +{ + g_return_if_fail (GIMP_IS_DRAWABLE_FILTER (filter)); + + temporary = temporary ? TRUE : FALSE; + + if (temporary != filter->temporary) + { + g_object_set (filter, + "temporary", temporary, + NULL); + } +} + +gboolean +gimp_drawable_filter_get_temporary (GimpDrawableFilter *filter) +{ + g_return_val_if_fail (GIMP_IS_DRAWABLE_FILTER (filter), FALSE); + + return filter->temporary; +} + void gimp_drawable_filter_set_opacity (GimpDrawableFilter *filter, gdouble opacity) diff --git a/app/core/gimpdrawablefilter.h b/app/core/gimpdrawablefilter.h index c09c5f2baa..feb711960a 100644 --- a/app/core/gimpdrawablefilter.h +++ b/app/core/gimpdrawablefilter.h @@ -69,6 +69,10 @@ GeglNode * gimp_drawable_filter_get_operation (GimpDrawableFilter *filter) GimpDrawableFilterMask * gimp_drawable_filter_get_mask (GimpDrawableFilter *filter); +void gimp_drawable_filter_set_temporary (GimpDrawableFilter *filter, + gboolean temporary); +gboolean gimp_drawable_filter_get_temporary (GimpDrawableFilter *filter); + void gimp_drawable_filter_set_opacity (GimpDrawableFilter *filter, gdouble opacity); gdouble gimp_drawable_filter_get_opacity (GimpDrawableFilter *filter); diff --git a/app/core/gimpdrawablefilterundo.c b/app/core/gimpdrawablefilterundo.c index 7b4d3ef735..8301367c1b 100644 --- a/app/core/gimpdrawablefilterundo.c +++ b/app/core/gimpdrawablefilterundo.c @@ -106,7 +106,8 @@ gimp_drawable_filter_undo_constructed (GObject *object) G_OBJECT_CLASS (parent_class)->constructed (object); - gimp_assert (GIMP_IS_DRAWABLE_FILTER (df_undo->filter)); + gimp_assert (GIMP_IS_DRAWABLE_FILTER (df_undo->filter) && + ! gimp_drawable_filter_get_temporary (df_undo->filter)); drawable = gimp_drawable_filter_get_drawable (df_undo->filter); if (drawable) diff --git a/app/core/gimpimage-undo-push.c b/app/core/gimpimage-undo-push.c index 34fdfc9f4f..468146e13a 100644 --- a/app/core/gimpimage-undo-push.c +++ b/app/core/gimpimage-undo-push.c @@ -320,6 +320,8 @@ gimp_image_undo_push_filter_add (GimpImage *image, { g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL); g_return_val_if_fail (GIMP_IS_DRAWABLE_FILTER (filter), NULL); + g_return_val_if_fail (gimp_drawable_filter_get_temporary (filter) == FALSE, + NULL); return gimp_image_undo_push (image, GIMP_TYPE_DRAWABLE_FILTER_UNDO, GIMP_UNDO_FILTER_ADD, undo_desc, @@ -336,6 +338,8 @@ gimp_image_undo_push_filter_remove (GimpImage *image, { g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL); g_return_val_if_fail (GIMP_IS_DRAWABLE_FILTER (filter), NULL); + g_return_val_if_fail (gimp_drawable_filter_get_temporary (filter) == FALSE, + NULL); return gimp_image_undo_push (image, GIMP_TYPE_DRAWABLE_FILTER_UNDO, GIMP_UNDO_FILTER_REMOVE, undo_desc, @@ -352,6 +356,8 @@ gimp_image_undo_push_filter_reorder (GimpImage *image, { g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL); g_return_val_if_fail (GIMP_IS_DRAWABLE_FILTER (filter), NULL); + g_return_val_if_fail (gimp_drawable_filter_get_temporary (filter) == FALSE, + NULL); return gimp_image_undo_push (image, GIMP_TYPE_DRAWABLE_FILTER_UNDO, GIMP_UNDO_FILTER_REORDER, undo_desc, @@ -368,6 +374,8 @@ gimp_image_undo_push_filter_modified (GimpImage *image, { g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL); g_return_val_if_fail (GIMP_IS_DRAWABLE_FILTER (filter), NULL); + g_return_val_if_fail (gimp_drawable_filter_get_temporary (filter) == FALSE, + NULL); return gimp_image_undo_push (image, GIMP_TYPE_DRAWABLE_FILTER_UNDO, GIMP_UNDO_FILTER_MODIFIED, undo_desc, diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c index 202fac626a..803dc47ee8 100644 --- a/app/core/gimpimage.c +++ b/app/core/gimpimage.c @@ -2063,7 +2063,8 @@ gimp_image_rec_filter_remove_undo (GimpImage *image, for (filter_list = GIMP_LIST (filters)->queue->tail; filter_list; filter_list = g_list_previous (filter_list)) { - if (GIMP_IS_DRAWABLE_FILTER (filter_list->data)) + if (GIMP_IS_DRAWABLE_FILTER (filter_list->data) && + ! gimp_drawable_filter_get_temporary (filter_list->data)) { GimpDrawableFilter *filter = filter_list->data; diff --git a/app/tools/gimpbucketfilltool.c b/app/tools/gimpbucketfilltool.c index eee560d6b0..97f5b96380 100644 --- a/app/tools/gimpbucketfilltool.c +++ b/app/tools/gimpbucketfilltool.c @@ -371,7 +371,7 @@ gimp_bucket_fill_tool_start (GimpBucketFillTool *tool, tool->priv->filter = gimp_drawable_filter_new (drawables->data, _("Bucket fill"), tool->priv->graph, GIMP_ICON_TOOL_BUCKET_FILL); - g_object_set (tool->priv->filter, "temporary", TRUE, NULL); + gimp_drawable_filter_set_temporary (tool->priv->filter, TRUE); gimp_drawable_filter_set_region (tool->priv->filter, GIMP_FILTER_REGION_DRAWABLE); diff --git a/app/tools/gimpcagetool.c b/app/tools/gimpcagetool.c index 5ce764718a..a808e17054 100644 --- a/app/tools/gimpcagetool.c +++ b/app/tools/gimpcagetool.c @@ -1301,8 +1301,8 @@ gimp_cage_tool_create_filter (GimpCageTool *ct) _("Cage transform"), ct->render_node, GIMP_ICON_TOOL_CAGE); + gimp_drawable_filter_set_temporary (ct->filter, TRUE); gimp_drawable_filter_set_region (ct->filter, GIMP_FILTER_REGION_DRAWABLE); - g_object_set (ct->filter, "temporary", TRUE, NULL); g_signal_connect (ct->filter, "flush", G_CALLBACK (gimp_cage_tool_filter_flush), diff --git a/app/tools/gimpfiltertool.c b/app/tools/gimpfiltertool.c index 4ebe04bada..ea08e81954 100644 --- a/app/tools/gimpfiltertool.c +++ b/app/tools/gimpfiltertool.c @@ -2200,12 +2200,13 @@ gimp_filter_tool_set_config (GimpFilterTool *filter_tool, index); } + gimp_drawable_filter_set_temporary (filter_tool->filter, TRUE); + name = g_strdup_printf (_("Editing '%s'..."), gimp_object_get_name (filter_tool->existing_filter)); g_object_set (filter_tool->filter, - "name", name, - "mask", mask, - "temporary", TRUE, + "name", name, + "mask", mask, NULL); g_free (name); diff --git a/app/tools/gimpgradienttool.c b/app/tools/gimpgradienttool.c index b919a89d6a..ad07227a73 100644 --- a/app/tools/gimpgradienttool.c +++ b/app/tools/gimpgradienttool.c @@ -1105,7 +1105,7 @@ gimp_gradient_tool_create_filter (GimpGradientTool *gradient_tool, C_("undo-type", "Gradient"), gradient_tool->graph, GIMP_ICON_TOOL_GRADIENT); - g_object_set (gradient_tool->filter, "temporary", TRUE, NULL); + gimp_drawable_filter_set_temporary (gradient_tool->filter, TRUE); gimp_drawable_filter_set_region (gradient_tool->filter, GIMP_FILTER_REGION_DRAWABLE); diff --git a/app/tools/gimpseamlessclonetool.c b/app/tools/gimpseamlessclonetool.c index 64b69b2459..d859bc7818 100644 --- a/app/tools/gimpseamlessclonetool.c +++ b/app/tools/gimpseamlessclonetool.c @@ -755,7 +755,7 @@ gimp_seamless_clone_tool_create_filter (GimpSeamlessCloneTool *sc, _("Seamless Clone"), sc->render_node, GIMP_ICON_TOOL_SEAMLESS_CLONE); - g_object_set (sc->filter, "temporary", TRUE, NULL); + gimp_drawable_filter_set_temporary (sc->filter, TRUE); gimp_drawable_filter_set_region (sc->filter, GIMP_FILTER_REGION_DRAWABLE); diff --git a/app/tools/gimptransformgridtool.c b/app/tools/gimptransformgridtool.c index 8fb13d12eb..74f6245b08 100644 --- a/app/tools/gimptransformgridtool.c +++ b/app/tools/gimptransformgridtool.c @@ -2045,7 +2045,7 @@ filter_new (GimpTransformGridTool *tg_tool, GIMP_TRANSFORM_TOOL_GET_CLASS (tg_tool)->undo_desc, node, gimp_tool_get_icon_name (GIMP_TOOL (tg_tool))); - g_object_set (filter->filter, "temporary", TRUE, NULL); + gimp_drawable_filter_set_temporary (filter->filter, TRUE); gimp_drawable_filter_set_clip (filter->filter, FALSE); gimp_drawable_filter_set_override_constraints (filter->filter, TRUE); diff --git a/app/tools/gimpwarptool.c b/app/tools/gimpwarptool.c index eb20e18ed6..61f0793473 100644 --- a/app/tools/gimpwarptool.c +++ b/app/tools/gimpwarptool.c @@ -1091,7 +1091,7 @@ gimp_warp_tool_create_filter (GimpWarpTool *wt, _("Warp transform"), wt->graph, GIMP_ICON_TOOL_WARP); - g_object_set (wt->filter, "temporary", TRUE, NULL); + gimp_drawable_filter_set_temporary (wt->filter, TRUE); gimp_drawable_filter_set_region (wt->filter, GIMP_FILTER_REGION_DRAWABLE); diff --git a/app/widgets/gimpdrawabletreeview-filters.c b/app/widgets/gimpdrawabletreeview-filters.c index 10f01ea5cb..66bb12eba6 100644 --- a/app/widgets/gimpdrawabletreeview-filters.c +++ b/app/widgets/gimpdrawabletreeview-filters.c @@ -596,7 +596,7 @@ gimp_drawable_filters_editor_view_visible_cell_toggled (GtkCellRendererToggle *t visible = gimp_filter_get_active (GIMP_FILTER (filter)); gimp_filter_set_active (GIMP_FILTER (filter), ! visible); - gimp_drawable_update (drawable, 0, 0, -1, -1); + gimp_drawable_update_bounding_box (drawable); gimp_image_flush (gimp_item_get_image (GIMP_ITEM (drawable))); } } @@ -671,7 +671,7 @@ gimp_drawable_filters_editor_visible_all_toggled (GtkWidget *widget, } } - gimp_drawable_update (editor->drawable, 0, 0, -1, -1); + gimp_drawable_update_bounding_box (editor->drawable); gimp_image_flush (gimp_item_get_image (GIMP_ITEM (editor->drawable))); } diff --git a/app/xcf/xcf-save.c b/app/xcf/xcf-save.c index 9b42a44174..39b162b7a6 100644 --- a/app/xcf/xcf-save.c +++ b/app/xcf/xcf-save.c @@ -1964,7 +1964,8 @@ xcf_save_layer (XcfInfo *info, for (filter_list = GIMP_LIST (filters)->queue->tail; filter_list; filter_list = g_list_previous (filter_list)) { - if (GIMP_IS_DRAWABLE_FILTER (filter_list->data)) + if (GIMP_IS_DRAWABLE_FILTER (filter_list->data) && + ! gimp_drawable_filter_get_temporary (filter_list->data)) { GimpDrawableFilter *filter = filter_list->data; GimpDrawableFilterMask *mask = NULL; @@ -2038,7 +2039,8 @@ xcf_save_layer (XcfInfo *info, for (list = GIMP_LIST (filters)->queue->head; list; list = g_list_next (list)) { - if (GIMP_IS_DRAWABLE_FILTER (list->data)) + if (GIMP_IS_DRAWABLE_FILTER (list->data) && + ! gimp_drawable_filter_get_temporary (list->data)) { GimpDrawableFilter *filter = list->data; GimpDrawableFilterMask *mask = NULL;