plug-ins/gfig/gfig-dialog.c renamed undo_water_mark to undo_level. Fixed

* plug-ins/gfig/gfig-dialog.c
* plug-ins/gfig/gfig-dialog.h
  plug-ins/gfig/gfig-dobject.c: renamed undo_water_mark to undo_level.
  Fixed the style handling when clearing the whole thing and undoing in
  some very particular cases. The undo part should certainly be redone
  to some extent.

Btw, this is the revision 1.10000 of the ChangeLog, yeah!
This commit is contained in:
David Odin 2004-11-28 17:55:05 +00:00
parent 78884dba56
commit cfe5e88fc9
4 changed files with 29 additions and 14 deletions

View File

@ -1,3 +1,14 @@
2004-11-28 DindinX <dindinx@gimp.org>
* plug-ins/gfig/gfig-dialog.c
* plug-ins/gfig/gfig-dialog.h
plug-ins/gfig/gfig-dobject.c: renamed undo_water_mark to undo_level.
Fixed the style handling when clearing the whole thing and undoing in
some very particular cases. The undo part should certainly be redone
to some extent.
Btw, this is the revision 1.10000 of the ChangeLog, yeah!
2004-11-28 Bill Skaggs <weskaggs@primate.ucdavis.edu>
* plug-ins/gfig/gfig-style.c: make sure PaintType is saved and

View File

@ -234,7 +234,7 @@ gfig_dialog (void)
* If not, we create a new transparent layer.
*/
gfig_list = NULL;
undo_water_mark = -1;
undo_level = -1;
parasite = gimp_drawable_parasite_find (gfig_context->drawable_id, "gfig");
for (k=0; k < 1000; k++)
gfig_context->style[k] = NULL;
@ -328,7 +328,7 @@ gfig_dialog (void)
toolbar, FALSE, FALSE, 0);
gtk_widget_show (toolbar);
gfig_dialog_action_set_sensitive ("undo", undo_water_mark >= 0);
gfig_dialog_action_set_sensitive ("undo", undo_level >= 0);
/* Main box */
main_hbox = gtk_hbox_new (FALSE, 12);
@ -733,21 +733,24 @@ static void
gfig_undo_action_callback (GtkAction *action,
gpointer data)
{
if (undo_water_mark >= 0)
if (undo_level >= 0)
{
/* Free current objects an reinstate previous */
free_all_objs (gfig_context->current_obj->obj_list);
gfig_context->current_obj->obj_list = NULL;
tmp_bezier = tmp_line = obj_creating = NULL;
gfig_context->current_obj->obj_list = undo_table[undo_water_mark];
undo_water_mark--;
gfig_context->current_obj->obj_list = undo_table[undo_level];
/* FIXME: this only work when undoing the only object in the list */
if (gfig_context->current_obj->obj_list == NULL)
gfig_context->current_style = &gfig_context->default_style;
undo_level--;
/* Update the screen */
gtk_widget_queue_draw (gfig_context->preview);
/* And preview */
gfig_context->current_obj->obj_status |= GFIG_MODIFIED;
}
gfig_dialog_action_set_sensitive ("undo", undo_water_mark >= 0);
gfig_dialog_action_set_sensitive ("undo", undo_level >= 0);
gfig_paint_callback ();
}
@ -763,6 +766,7 @@ gfig_clear_action_callback (GtkWidget *widget,
/* Free all objects */
free_all_objs (gfig_context->current_obj->obj_list);
gfig_context->current_obj->obj_list = NULL;
gfig_context->current_style = &gfig_context->default_style;
obj_creating = NULL;
tmp_line = NULL;
tmp_bezier = NULL;

View File

@ -26,7 +26,7 @@
#ifndef __GFIG_DIALOG_H__
#define __GFIG_DIALOG_H__
gint undo_water_mark; /* Last slot filled in -1 = no undo */
gint undo_level; /* Last slot filled in -1 = no undo */
GList *undo_table[MAX_UNDO];
gboolean gfig_dialog (void);

View File

@ -996,13 +996,13 @@ clear_undo (void)
{
int lv;
for (lv = undo_water_mark; lv >= 0; lv--)
for (lv = undo_level; lv >= 0; lv--)
{
free_all_objs (undo_table[lv]);
undo_table[lv] = NULL;
}
undo_water_mark = -1;
undo_level = -1;
gfig_dialog_action_set_sensitive ("undo", FALSE);
}
@ -1012,7 +1012,7 @@ setup_undo (void)
{
/* Copy object list to undo buffer */
#if DEBUG
printf ("setup undo level [%d]\n", undo_water_mark);
printf ("setup undo level [%d]\n", undo_level);
#endif /*DEBUG*/
if (!gfig_context->current_obj)
@ -1021,22 +1021,22 @@ setup_undo (void)
return;
}
if (undo_water_mark >= selvals.maxundo - 1)
if (undo_level >= selvals.maxundo - 1)
{
int loop;
/* the little one in the bed said "roll over".. */
if (undo_table[0])
free_one_obj (undo_table[0]->data);
for (loop = 0; loop < undo_water_mark; loop++)
for (loop = 0; loop < undo_level; loop++)
{
undo_table[loop] = undo_table[loop + 1];
}
}
else
{
undo_water_mark++;
undo_level++;
}
undo_table[undo_water_mark] =
undo_table[undo_level] =
copy_all_objs (gfig_context->current_obj->obj_list);
gfig_dialog_action_set_sensitive ("undo", TRUE);