mirror of https://github.com/GNOME/gimp.git
re-enabled transform undo. Fixes the transform tool crashes.
2001-03-31 Michael Natterer <mitch@gimp.org> * app/undo.c: re-enabled transform undo. Fixes the transform tool crashes. * app/tools/gimptool.[ch]: put tool->ID back because the undo system uses it. Also, a unique tool serial number will be not too bad to have once we have module tools. * app/tools/gimptransformtool.[ch]: changed accordingly.
This commit is contained in:
parent
47f987f801
commit
4ee31d0cac
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2001-03-31 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/undo.c: re-enabled transform undo. Fixes the transform tool
|
||||
crashes.
|
||||
|
||||
* app/tools/gimptool.[ch]: put tool->ID back because the undo
|
||||
system uses it. Also, a unique tool serial number will be not too
|
||||
bad to have once we have module tools.
|
||||
|
||||
* app/tools/gimptransformtool.[ch]: changed accordingly.
|
||||
|
||||
2001-03-31 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/Makefile.am
|
||||
|
|
|
@ -664,8 +664,9 @@ gimp_transform_tool_doit (GimpTransformTool *gt_tool,
|
|||
new_tiles, new_layer);
|
||||
|
||||
/* create and initialize the transform_undo structure */
|
||||
tu = g_new (TransformUndo, 1);
|
||||
tu->tool = gt_tool;
|
||||
tu = g_new0 (TransformUndo, 1);
|
||||
tu->tool_ID = tool->ID;
|
||||
tu->tool_type = GTK_OBJECT (tool)->klass->type;
|
||||
|
||||
for (i = 0; i < TRAN_INFO_SIZE; i++)
|
||||
tu->trans_info[i] = old_trans_info[i];
|
||||
|
@ -727,7 +728,7 @@ gimp_transform_tool_motion (GimpTool *tool,
|
|||
{
|
||||
GimpTransformTool *tr_tool;
|
||||
|
||||
tr_tool = GIMP_TRANSFORM_TOOL(tool);
|
||||
tr_tool = GIMP_TRANSFORM_TOOL (tool);
|
||||
|
||||
if (! tr_tool->bpressed)
|
||||
return;
|
||||
|
|
|
@ -664,8 +664,9 @@ gimp_transform_tool_doit (GimpTransformTool *gt_tool,
|
|||
new_tiles, new_layer);
|
||||
|
||||
/* create and initialize the transform_undo structure */
|
||||
tu = g_new (TransformUndo, 1);
|
||||
tu->tool = gt_tool;
|
||||
tu = g_new0 (TransformUndo, 1);
|
||||
tu->tool_ID = tool->ID;
|
||||
tu->tool_type = GTK_OBJECT (tool)->klass->type;
|
||||
|
||||
for (i = 0; i < TRAN_INFO_SIZE; i++)
|
||||
tu->trans_info[i] = old_trans_info[i];
|
||||
|
@ -727,7 +728,7 @@ gimp_transform_tool_motion (GimpTool *tool,
|
|||
{
|
||||
GimpTransformTool *tr_tool;
|
||||
|
||||
tr_tool = GIMP_TRANSFORM_TOOL(tool);
|
||||
tr_tool = GIMP_TRANSFORM_TOOL (tool);
|
||||
|
||||
if (! tr_tool->bpressed)
|
||||
return;
|
||||
|
|
|
@ -49,7 +49,8 @@
|
|||
#include "tools/gimptool.h"
|
||||
#include "tools/gimpdrawtool.h"
|
||||
#include "tools/gimppainttool.h"
|
||||
#include "tools/transform_core.h"
|
||||
#include "tools/gimptransformtool.h"
|
||||
#include "tools/tool_manager.h"
|
||||
|
||||
#include "libgimp/gimpparasite.h"
|
||||
|
||||
|
@ -1263,25 +1264,20 @@ undo_pop_transform (GimpImage *gimage,
|
|||
UndoType type,
|
||||
gpointer tu_ptr)
|
||||
{
|
||||
#ifdef __GNUC__
|
||||
#warning very bogus
|
||||
#endif
|
||||
#if 0
|
||||
TransformCore *tc;
|
||||
TransformUndo *tu;
|
||||
TileManager *temp;
|
||||
gdouble d;
|
||||
gint i;
|
||||
|
||||
GimpTransformTool *tt;
|
||||
TransformUndo *tu;
|
||||
TileManager *temp;
|
||||
gdouble d;
|
||||
gint i;
|
||||
|
||||
/* Can't have ANY tool selected - maybe a plugin running */
|
||||
if (active_tool == NULL)
|
||||
return TRUE;
|
||||
|
||||
tc = (TransformCore *) active_tool->private;
|
||||
tt = (GimpTransformTool *) active_tool;
|
||||
tu = (TransformUndo *) tu_ptr;
|
||||
|
||||
path_transform_do_undo (gimage,tu->path_undo);
|
||||
path_transform_do_undo (gimage, tu->path_undo);
|
||||
|
||||
/* only pop if the active tool is the tool that pushed this undo */
|
||||
if (tu->tool_ID != active_tool->ID)
|
||||
|
@ -1291,23 +1287,24 @@ undo_pop_transform (GimpImage *gimage,
|
|||
for (i = 0; i < TRAN_INFO_SIZE; i++)
|
||||
{
|
||||
d = tu->trans_info[i];
|
||||
tu->trans_info[i] = tc->trans_info[i];
|
||||
tc->trans_info[i] = d;
|
||||
tu->trans_info[i] = tt->trans_info[i];
|
||||
tt->trans_info[i] = d;
|
||||
}
|
||||
|
||||
/* swap the original buffer--the source buffer for repeated transforms
|
||||
*/
|
||||
temp = tu->original;
|
||||
tu->original = tc->original;
|
||||
tc->original = temp;
|
||||
tu->original = tt->original;
|
||||
tt->original = temp;
|
||||
|
||||
/* If we're re-implementing the first transform, reactivate tool */
|
||||
if (state == REDO && tc->original)
|
||||
if (state == REDO && tt->original)
|
||||
{
|
||||
active_tool->state = ACTIVE;
|
||||
draw_core_resume (tc->core, active_tool);
|
||||
|
||||
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tt));
|
||||
}
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -93,12 +93,7 @@ static guint gimp_tool_signals[LAST_SIGNAL] = { 0 };
|
|||
|
||||
static GimpObjectClass *parent_class = NULL;
|
||||
|
||||
|
||||
#ifdef __GNUC__
|
||||
#warning FIXME: check what global_tool_ID was used for
|
||||
#endif
|
||||
|
||||
/* static gint global_tool_ID = 0; */
|
||||
static gint global_tool_ID = 0;
|
||||
|
||||
|
||||
GtkType
|
||||
|
@ -251,6 +246,8 @@ gimp_tool_class_init (GimpToolClass *klass)
|
|||
static void
|
||||
gimp_tool_init (GimpTool *tool)
|
||||
{
|
||||
tool->ID = global_tool_ID++;
|
||||
|
||||
tool->state = INACTIVE;
|
||||
tool->paused_count = 0;
|
||||
tool->scroll_lock = FALSE; /* Allow scrolling */
|
||||
|
|
|
@ -51,6 +51,8 @@ struct _GimpTool
|
|||
{
|
||||
GimpObject parent_instance;
|
||||
|
||||
gint ID; /* unique tool ID */
|
||||
|
||||
ToolState state; /* state of tool activity */
|
||||
gint paused_count; /* paused control count */
|
||||
gboolean scroll_lock; /* allow scrolling or not */
|
||||
|
|
|
@ -664,8 +664,9 @@ gimp_transform_tool_doit (GimpTransformTool *gt_tool,
|
|||
new_tiles, new_layer);
|
||||
|
||||
/* create and initialize the transform_undo structure */
|
||||
tu = g_new (TransformUndo, 1);
|
||||
tu->tool = gt_tool;
|
||||
tu = g_new0 (TransformUndo, 1);
|
||||
tu->tool_ID = tool->ID;
|
||||
tu->tool_type = GTK_OBJECT (tool)->klass->type;
|
||||
|
||||
for (i = 0; i < TRAN_INFO_SIZE; i++)
|
||||
tu->trans_info[i] = old_trans_info[i];
|
||||
|
@ -727,7 +728,7 @@ gimp_transform_tool_motion (GimpTool *tool,
|
|||
{
|
||||
GimpTransformTool *tr_tool;
|
||||
|
||||
tr_tool = GIMP_TRANSFORM_TOOL(tool);
|
||||
tr_tool = GIMP_TRANSFORM_TOOL (tool);
|
||||
|
||||
if (! tr_tool->bpressed)
|
||||
return;
|
||||
|
|
|
@ -109,8 +109,8 @@ typedef struct _TransformUndo TransformUndo;
|
|||
|
||||
struct _TransformUndo
|
||||
{
|
||||
/* Is this the right thing to do? */
|
||||
GimpTransformTool *tool;
|
||||
gint tool_ID;
|
||||
GtkType tool_type;
|
||||
|
||||
TranInfo trans_info;
|
||||
TileManager *original;
|
||||
|
|
37
app/undo.c
37
app/undo.c
|
@ -49,7 +49,8 @@
|
|||
#include "tools/gimptool.h"
|
||||
#include "tools/gimpdrawtool.h"
|
||||
#include "tools/gimppainttool.h"
|
||||
#include "tools/transform_core.h"
|
||||
#include "tools/gimptransformtool.h"
|
||||
#include "tools/tool_manager.h"
|
||||
|
||||
#include "libgimp/gimpparasite.h"
|
||||
|
||||
|
@ -1263,25 +1264,20 @@ undo_pop_transform (GimpImage *gimage,
|
|||
UndoType type,
|
||||
gpointer tu_ptr)
|
||||
{
|
||||
#ifdef __GNUC__
|
||||
#warning very bogus
|
||||
#endif
|
||||
#if 0
|
||||
TransformCore *tc;
|
||||
TransformUndo *tu;
|
||||
TileManager *temp;
|
||||
gdouble d;
|
||||
gint i;
|
||||
|
||||
GimpTransformTool *tt;
|
||||
TransformUndo *tu;
|
||||
TileManager *temp;
|
||||
gdouble d;
|
||||
gint i;
|
||||
|
||||
/* Can't have ANY tool selected - maybe a plugin running */
|
||||
if (active_tool == NULL)
|
||||
return TRUE;
|
||||
|
||||
tc = (TransformCore *) active_tool->private;
|
||||
tt = (GimpTransformTool *) active_tool;
|
||||
tu = (TransformUndo *) tu_ptr;
|
||||
|
||||
path_transform_do_undo (gimage,tu->path_undo);
|
||||
path_transform_do_undo (gimage, tu->path_undo);
|
||||
|
||||
/* only pop if the active tool is the tool that pushed this undo */
|
||||
if (tu->tool_ID != active_tool->ID)
|
||||
|
@ -1291,23 +1287,24 @@ undo_pop_transform (GimpImage *gimage,
|
|||
for (i = 0; i < TRAN_INFO_SIZE; i++)
|
||||
{
|
||||
d = tu->trans_info[i];
|
||||
tu->trans_info[i] = tc->trans_info[i];
|
||||
tc->trans_info[i] = d;
|
||||
tu->trans_info[i] = tt->trans_info[i];
|
||||
tt->trans_info[i] = d;
|
||||
}
|
||||
|
||||
/* swap the original buffer--the source buffer for repeated transforms
|
||||
*/
|
||||
temp = tu->original;
|
||||
tu->original = tc->original;
|
||||
tc->original = temp;
|
||||
tu->original = tt->original;
|
||||
tt->original = temp;
|
||||
|
||||
/* If we're re-implementing the first transform, reactivate tool */
|
||||
if (state == REDO && tc->original)
|
||||
if (state == REDO && tt->original)
|
||||
{
|
||||
active_tool->state = ACTIVE;
|
||||
draw_core_resume (tc->core, active_tool);
|
||||
|
||||
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tt));
|
||||
}
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue