[gimp/gimp-2-10] Issue #2222 - Warp Transform doesn't commit changes upon saving ...
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] Issue #2222 - Warp Transform doesn't commit changes upon saving ...
- Date: Sat, 29 Sep 2018 06:41:15 +0000 (UTC)
commit 943f92a6acf469b5531152c2974a1eb2eca50ff3
Author: Ell <ell_se yahoo com>
Date: Sat Sep 29 02:25:34 2018 -0400
Issue #2222 - Warp Transform doesn't commit changes upon saving ...
... the XCF file
Add a "saving" signal to GimpImage, which is emitted when the image
is about to be saved or exported (but before it's actually saved/
exported). Connect to this signal in tool-manager, and commit the
current tool in response (unless its GimpToolControl::preserve is
TRUE).
(cherry picked from commit ae628a86640cfc8c2bc0e420c23518c03b65361b)
app/core/gimpimage.c | 26 ++++++++++++++++++++++++++
app/core/gimpimage.h | 2 ++
app/file/file-save.c | 2 ++
app/tools/tool_manager.c | 36 ++++++++++++++++++++++++++++++++----
4 files changed, 62 insertions(+), 4 deletions(-)
---
diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c
index bb9ad909ba..be65863efb 100644
--- a/app/core/gimpimage.c
+++ b/app/core/gimpimage.c
@@ -111,6 +111,7 @@ enum
SELECTION_INVALIDATE,
CLEAN,
DIRTY,
+ SAVING,
SAVED,
EXPORTED,
GUIDE_ADDED,
@@ -431,6 +432,15 @@ gimp_image_class_init (GimpImageClass *klass)
G_TYPE_NONE, 1,
GIMP_TYPE_DIRTY_MASK);
+ gimp_image_signals[SAVING] =
+ g_signal_new ("saving",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (GimpImageClass, saving),
+ NULL, NULL,
+ gimp_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
gimp_image_signals[SAVED] =
g_signal_new ("saved",
G_TYPE_FROM_CLASS (klass),
@@ -588,6 +598,7 @@ gimp_image_class_init (GimpImageClass *klass)
klass->clean = NULL;
klass->dirty = NULL;
+ klass->saving = NULL;
klass->saved = NULL;
klass->exported = NULL;
klass->guide_added = NULL;
@@ -3393,6 +3404,21 @@ gimp_image_get_dirty_time (GimpImage *image)
return GIMP_IMAGE_GET_PRIVATE (image)->dirty_time;
}
+/**
+ * gimp_image_saving:
+ * @image:
+ *
+ * Emits the "saving" signal, indicating that @image is about to be saved,
+ * or exported.
+ */
+void
+gimp_image_saving (GimpImage *image)
+{
+ g_return_if_fail (GIMP_IS_IMAGE (image));
+
+ g_signal_emit (image, gimp_image_signals[SAVING], 0);
+}
+
/**
* gimp_image_saved:
* @image:
diff --git a/app/core/gimpimage.h b/app/core/gimpimage.h
index b2e03fba79..26daa9453c 100644
--- a/app/core/gimpimage.h
+++ b/app/core/gimpimage.h
@@ -76,6 +76,7 @@ struct _GimpImageClass
GimpDirtyMask dirty_mask);
void (* dirty) (GimpImage *image,
GimpDirtyMask dirty_mask);
+ void (* saving) (GimpImage *image);
void (* saved) (GimpImage *image,
GFile *file);
void (* exported) (GimpImage *image,
@@ -166,6 +167,7 @@ GimpPlugInProcedure * gimp_image_get_load_proc (GimpImage *image);
void gimp_image_set_save_proc (GimpImage *image,
GimpPlugInProcedure *proc);
GimpPlugInProcedure * gimp_image_get_save_proc (GimpImage *image);
+void gimp_image_saving (GimpImage *image);
void gimp_image_saved (GimpImage *image,
GFile *file);
void gimp_image_set_export_proc (GimpImage *image,
diff --git a/app/file/file-save.c b/app/file/file-save.c
index 334455f43b..252d62a280 100644
--- a/app/file/file-save.c
+++ b/app/file/file-save.c
@@ -89,6 +89,8 @@ file_save (Gimp *gimp,
g_object_ref (image);
g_object_ref (file);
+ gimp_image_saving (image);
+
drawable = gimp_image_get_active_drawable (image);
if (! drawable)
diff --git a/app/tools/tool_manager.c b/app/tools/tool_manager.c
index 78b49d6e3a..31b26ac180 100644
--- a/app/tools/tool_manager.c
+++ b/app/tools/tool_manager.c
@@ -55,6 +55,7 @@ struct _GimpToolManager
GQuark image_clean_handler_id;
GQuark image_dirty_handler_id;
+ GQuark image_saving_handler_id;
};
@@ -74,6 +75,8 @@ static void tool_manager_preset_changed (GimpContext *user_context,
static void tool_manager_image_clean_dirty (GimpImage *image,
GimpDirtyMask dirty_mask,
GimpToolManager *tool_manager);
+static void tool_manager_image_saving (GimpImage *image,
+ GimpToolManager *tool_manager);
static void tool_manager_cast_spell (GimpToolInfo *tool_info);
@@ -90,10 +93,11 @@ tool_manager_init (Gimp *gimp)
tool_manager = g_slice_new0 (GimpToolManager);
- tool_manager->active_tool = NULL;
- tool_manager->tool_stack = NULL;
- tool_manager->image_clean_handler_id = 0;
- tool_manager->image_dirty_handler_id = 0;
+ tool_manager->active_tool = NULL;
+ tool_manager->tool_stack = NULL;
+ tool_manager->image_clean_handler_id = 0;
+ tool_manager->image_dirty_handler_id = 0;
+ tool_manager->image_saving_handler_id = 0;
tool_manager_set (gimp, tool_manager);
@@ -107,6 +111,11 @@ tool_manager_init (Gimp *gimp)
G_CALLBACK (tool_manager_image_clean_dirty),
tool_manager);
+ tool_manager->image_saving_handler_id =
+ gimp_container_add_handler (gimp->images, "saving",
+ G_CALLBACK (tool_manager_image_saving),
+ tool_manager);
+
user_context = gimp_get_user_context (gimp);
g_signal_connect (user_context, "tool-changed",
@@ -145,6 +154,8 @@ tool_manager_exit (Gimp *gimp)
tool_manager->image_clean_handler_id);
gimp_container_remove_handler (gimp->images,
tool_manager->image_dirty_handler_id);
+ gimp_container_remove_handler (gimp->images,
+ tool_manager->image_saving_handler_id);
g_clear_object (&tool_manager->active_tool);
@@ -785,6 +796,23 @@ tool_manager_image_clean_dirty (GimpImage *image,
}
}
+static void
+tool_manager_image_saving (GimpImage *image,
+ GimpToolManager *tool_manager)
+{
+ GimpTool *tool = tool_manager->active_tool;
+
+ if (tool &&
+ ! gimp_tool_control_get_preserve (tool->control))
+ {
+ GimpDisplay *display = gimp_tool_has_image (tool, image);
+
+ if (display)
+ tool_manager_control_active (image->gimp, GIMP_TOOL_ACTION_COMMIT,
+ display);
+ }
+}
+
static void
tool_manager_cast_spell (GimpToolInfo *tool_info)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]