diff --git a/ChangeLog b/ChangeLog index 114aaf8fb4..00315e3058 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Thu Mar 19 14:13:33 EST 1998 Adrian Likins + + * 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 * docs/gimp_quick_reference.[tex|ps]: added a diff --git a/app/brushes.c b/app/brushes.c index a97b57e5bf..2e55095dce 100644 --- a/app/brushes.c +++ b/app/brushes.c @@ -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; + } + } + } } diff --git a/app/drawable.c b/app/drawable.c index 665dc5e080..11c8572298 100644 --- a/app/drawable.c +++ b/app/drawable.c @@ -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; }