[gimp/gimp-2-10] app: reset overall transformation in transform tools
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] app: reset overall transformation in transform tools
- Date: Thu, 7 Mar 2019 22:50:33 +0000 (UTC)
commit 47a44106c224f0e23f040baa9249302450d00eca
Author: Ell <ell_se yahoo com>
Date: Thu Mar 7 17:42:52 2019 -0500
app: reset overall transformation in transform tools
In GimpTransformGridTool, reset both transform directions in
response to the "Reset" button, so that the overall transformation
is restored to the identity. Previously, we would only reset the
active transform direction (possibly compensating in the opposite
direction, if both directions are linked). This was intentional,
but it's probably a bit too confusing, especially in conjunction
with the newly added "Readjust" button. Let's just go back to
resetting everything.
(cherry picked from commit 2c67b291904423f09fd4350081063447af8b85ab)
app/tools/gimptransformgridtool.c | 47 ++++++++++++++++++++++++++-------------
1 file changed, 32 insertions(+), 15 deletions(-)
---
diff --git a/app/tools/gimptransformgridtool.c b/app/tools/gimptransformgridtool.c
index 3646c03f8b..b4fcc1b752 100644
--- a/app/tools/gimptransformgridtool.c
+++ b/app/tools/gimptransformgridtool.c
@@ -1243,15 +1243,26 @@ gimp_transform_grid_tool_response (GimpToolGui *gui,
switch (response_id)
{
case RESPONSE_RESET:
- /* restore the initial transformation info */
- memcpy (tg_tool->trans_info, tg_tool->init_trans_info,
- sizeof (TransInfo));
+ {
+ gboolean direction_linked;
- /* recalculate the tool's transformtion matrix */
- gimp_transform_tool_recalc_matrix (tr_tool, display);
+ /* restore the initial transformation info */
+ memcpy (tg_tool->trans_infos[GIMP_TRANSFORM_FORWARD],
+ tg_tool->init_trans_info,
+ sizeof (TransInfo));
+ memcpy (tg_tool->trans_infos[GIMP_TRANSFORM_BACKWARD],
+ tg_tool->init_trans_info,
+ sizeof (TransInfo));
- /* push the restored info to the undo stack */
- gimp_transform_grid_tool_push_internal_undo (tg_tool);
+ /* recalculate the tool's transformation matrix */
+ direction_linked = tg_options->direction_linked;
+ tg_options->direction_linked = FALSE;
+ gimp_transform_tool_recalc_matrix (tr_tool, display);
+ tg_options->direction_linked = direction_linked;
+
+ /* push the restored info to the undo stack */
+ gimp_transform_grid_tool_push_internal_undo (tg_tool);
+ }
break;
case RESPONSE_READJUST:
@@ -1261,8 +1272,8 @@ gimp_transform_grid_tool_response (GimpToolGui *gui,
/* readjust the transformation info */
GIMP_TRANSFORM_GRID_TOOL_GET_CLASS (tg_tool)->readjust (tg_tool);
- /* recalculate the tool's transformtion matrix, preserving the overall
- * transformation
+ /* recalculate the tool's transformation matrix, preserving the
+ * overall transformation
*/
direction_linked = tg_options->direction_linked;
tg_options->direction_linked = TRUE;
@@ -1297,12 +1308,18 @@ gimp_transform_grid_tool_update_sensitivity (GimpTransformGridTool *tg_tool)
if (! tg_tool->gui)
return;
- gimp_tool_gui_set_response_sensitive (tg_tool->gui, GTK_RESPONSE_OK,
- tr_tool->transform_valid);
- gimp_tool_gui_set_response_sensitive (tg_tool->gui, RESPONSE_RESET,
- memcmp (tg_tool->trans_info,
- tg_tool->init_trans_info,
- sizeof (TransInfo)) != 0);
+ gimp_tool_gui_set_response_sensitive (
+ tg_tool->gui, GTK_RESPONSE_OK,
+ tr_tool->transform_valid);
+
+ gimp_tool_gui_set_response_sensitive (
+ tg_tool->gui, RESPONSE_RESET,
+ memcmp (tg_tool->trans_infos[GIMP_TRANSFORM_FORWARD],
+ tg_tool->init_trans_info,
+ sizeof (TransInfo)) ||
+ memcmp (tg_tool->trans_infos[GIMP_TRANSFORM_BACKWARD],
+ tg_tool->init_trans_info,
+ sizeof (TransInfo)));
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]