Commit 46b740cc authored by Austin Donnelly's avatar Austin Donnelly Committed by Austin Donnelly
Browse files

plug-ins/ifscompose/ifscompose.c Element labels now properly preserved

2000-11-27  Austin Donnelly <austin@gimp.org>

        * plug-ins/ifscompose/ifscompose.c
        * plug-ins/ifscompose/ifscompose_storage.c: Element labels now
            properly preserved across multiple runs.  Allow run with same
            values.  This is a partial fix for Bug#9156: bug in ifscompose.
            Not all the behaviour described in that bug report could be
            reproduced.  Thanks to David Hodson <hodsond@ozemail.com.au>
            for putting the work in to sort this out and produce the patch.
parent 969b4c59
2000-11-27 Austin Donnelly <austin@gimp.org>
* plug-ins/ifscompose/ifscompose.c
* plug-ins/ifscompose/ifscompose_storage.c: Element labels now
properly preserved across multiple runs. Allow run with same
values. This is a partial fix for Bug#9156: bug in ifscompose.
Not all the behaviour described in that bug report could be
reproduced. Thanks to David Hodson <hodsond@ozemail.com.au>
for putting the work in to sort this out and produce the patch.
2000-11-26 Sven Neumann <sven@gimp.org>
 
* PLUG_IN_MAINTAINERS
......
......@@ -296,7 +296,8 @@ IfsDesignArea *ifsDesign = NULL;
static AffElement **elements = NULL;
static gint *element_selected = NULL;
static gint element_count = 0;
/* labels are generated by printing this int */
static gint count_for_naming = 0;
static UndoItem undo_ring[UNDO_LEVELS];
static gint undo_cur = -1;
......@@ -429,6 +430,8 @@ run (gchar *name,
}
}
/* after ifsvals_parse_string, need to set up naming */
count_for_naming = ifsvals.num_elements;
/* First acquire information with a dialog */
if (! ifs_compose_dialog (active_drawable))
return;
......@@ -441,8 +444,22 @@ run (gchar *name,
case GIMP_RUN_WITH_LAST_VALS:
/* Possibly retrieve data */
status = GIMP_PDB_CALLING_ERROR;
/* gimp_get_data ("plug_in_ifs_compose", &mvals); */
{
gint length;
gchar *data;
length = gimp_get_data_size (IFSCOMPOSE_DATA);
if (length)
{
data = g_new (gchar, length);
gimp_get_data (IFSCOMPOSE_DATA, data);
ifsvals_parse_string (data, &ifsvals, &elements);
g_free (data);
}
else
ifs_compose_set_defaults ();
}
break;
default:
......@@ -2454,6 +2471,7 @@ ifs_compose_set_defaults (void)
for (i=0;i<ifsvals.num_elements;i++)
aff_element_free(elements[i]);
count_for_naming = 0;
ifsvals.num_elements = 3;
elements = g_realloc(elements, ifsvals.num_elements*sizeof(AffElement *));
......@@ -2461,13 +2479,13 @@ ifs_compose_set_defaults (void)
ifsvals.num_elements*sizeof(gint));
elements[0] = aff_element_new(0.3,0.37*ifsvals.aspect_ratio,color,
element_count++);
++count_for_naming);
element_selected[0] = FALSE;
elements[1] = aff_element_new(0.7,0.37*ifsvals.aspect_ratio,color,
element_count++);
++count_for_naming);
element_selected[1] = FALSE;
elements[2] = aff_element_new(0.5,0.7*ifsvals.aspect_ratio,color,
element_count++);
++count_for_naming);
element_selected[2] = FALSE;
ifsvals.center_x = 0.5;
......@@ -2541,7 +2559,7 @@ ifs_compose_new_callback (GtkWidget *widget,
color.vals[2] = (gdouble)bc/255;
elem = aff_element_new(0.5, 0.5*height/width,color,
element_count++);
++count_for_naming);
ifsvals.num_elements++;
elements = g_realloc(elements, ifsvals.num_elements*sizeof(AffElement *));
......
......@@ -294,6 +294,7 @@ ifsvals_parse (GScanner *scanner, IfsComposeVals *vals, AffElement ***elements)
new_vals = *vals;
new_vals.num_elements = 0;
i = 0;
expected_token = G_TOKEN_NONE;
while (expected_token == G_TOKEN_NONE)
......@@ -346,7 +347,7 @@ ifsvals_parse (GScanner *scanner, IfsComposeVals *vals, AffElement ***elements)
break;
case TOKEN_ELEMENT:
el = aff_element_new(0.0,0.0,color,vals->num_elements);
el = aff_element_new(0.0,0.0,color,++i);
expected_token = ifsvals_parse_element (scanner, &el->v);
if (expected_token == G_TOKEN_NONE)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment