app/brushes.c: pathc from Andy Thomas to improve brsh loading via pdb

app/drawable.c: patch from gimp-hpux i missed yesterday...

-adrian
This commit is contained in:
Adrian Likins 1998-03-19 19:40:33 +00:00
parent 741884c24e
commit ba4557617b
3 changed files with 42 additions and 4 deletions

View File

@ -1,3 +1,9 @@
Thu Mar 19 14:13:33 EST 1998 Adrian Likins <adrian@gimp.org>
* applied patch from Andy Thomas to brushes.c to
improve brush loading via pdb. Fixes problems with
bruses of the same name.
Thu Mar 19 13:21:28 MET 1998 Sven Neumann <sven@gimp.org>
* docs/gimp_quick_reference.[tex|ps]: added a

View File

@ -65,6 +65,8 @@ void
brushes_init ()
{
GSList * list;
GBrushP gb_start = NULL;
gint gb_count = 0;
if (brush_list)
brushes_free();
@ -83,9 +85,39 @@ brushes_init ()
while (list) {
/* Set the brush index */
((GBrush *) list->data)->index = num_brushes++;
list = g_slist_next (list);
}
/* ALT make names unique */
GBrushP gb = (GBrushP)list->data;
gb->index = num_brushes++;
list = g_slist_next(list);
if(list) {
GBrushP gb2 = (GBrushP)list->data;
if(gb_start == NULL) {
gb_start = gb;
}
if(gb_start->name
&& gb2->name
&& (strcmp(gb_start->name,gb2->name) == 0)) {
gint b_digits = 2;
gint gb_tmp_cnt = gb_count++;
/* Alter gb2... */
g_free(gb2->name);
while((gb_tmp_cnt /= 10) > 0)
b_digits++;
/* name str + " #" + digits + null */
gb2->name = g_malloc(strlen(gb_start->name)+3+b_digits);
sprintf(gb2->name,"%s #%d",gb_start->name,gb_count);
}
else
{
gb_start = gb2;
gb_count = 0;
}
}
}
}

View File

@ -88,7 +88,7 @@ gimp_drawable_class_init (GimpDrawableClass *class)
gtk_signal_default_marshaller,
GTK_TYPE_NONE, 0);
gtk_object_class_add_signals (object_class, drawable_signals, LAST_SIGNAL);
gtk_object_class_add_signals (object_class, (guint *)drawable_signals, LAST_SIGNAL);
object_class->destroy = gimp_drawable_destroy;
}