mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-23 04:51:44 +00:00
b5d8536f3f
2001-02-13 Michael Natterer <mitch@gimp.org> * gimprc.in * user_install * user_install.bat * app/gimprc.[ch] * app/preferences_dialog.c: removed the "brush_vbr_path" variable, because all data types will be editable and saveable soon. * app/Makefile.am * app/apptypes.h * app/gimpdatafactory.[ch]: new object which holds a data list and knows how to create, edit, duplicate etc. the items in it. Will completely replace the brushes.[ch], patterns.[ch], ... files soon. * po/POTFILES.in * app/gimpdatacontainerview.[ch]: removed. * app/gimpdatafactoryview.[ch]: added. A view on the GimpDataFactory with a GUI for creating, editing, deleting etc. items (mostly unimplemented). * app/context_manager.[ch]: replaced the global data lists by global data factories. * app/brush_select.c * app/brushes.[ch] * app/commands.c * app/convert.c * app/devices.c * app/gimpbrush.[ch] * app/gimpbrushgenerated.c * app/gimpcontext.c * app/gimpdata.[ch] * app/gimpdatalist.[ch] * app/gimpdnd.c * app/gimpgradient.[ch] * app/gimppalette.[ch] * app/gimppattern.[ch] * app/gradient_editor.c * app/gradient_select.c * app/gradients.[ch] * app/indicator_area.c * app/palette.c * app/palette_import.c * app/palette_select.c * app/palettes.[ch] * app/pattern_select.c * app/patterns.[ch] * app/pdb/brush_select_cmds.c * app/pdb/brushes_cmds.c * app/pdb/convert_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/gradients_cmds.c * app/pdb/pattern_select_cmds.c * app/pdb/patterns_cmds.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb: changed accordingly.
151 lines
4 KiB
C
151 lines
4 KiB
C
/* The GIMP -- an image manipulation program
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
*/
|
|
|
|
#include "config.h"
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
|
|
|
#include "apptypes.h"
|
|
|
|
#include "gimpdata.h"
|
|
#include "gimpdatalist.h"
|
|
#include "gimpdatafactory.h"
|
|
#include "gimpcontext.h"
|
|
#include "gimpmarshal.h"
|
|
|
|
|
|
static void gimp_data_factory_class_init (GimpDataFactoryClass *klass);
|
|
static void gimp_data_factory_init (GimpDataFactory *factory);
|
|
static void gimp_data_factory_destroy (GtkObject *object);
|
|
|
|
|
|
static GimpObjectClass *parent_class = NULL;
|
|
|
|
|
|
GtkType
|
|
gimp_data_factory_get_type (void)
|
|
{
|
|
static guint factory_type = 0;
|
|
|
|
if (! factory_type)
|
|
{
|
|
GtkTypeInfo factory_info =
|
|
{
|
|
"GimpDataFactory",
|
|
sizeof (GimpDataFactory),
|
|
sizeof (GimpDataFactoryClass),
|
|
(GtkClassInitFunc) gimp_data_factory_class_init,
|
|
(GtkObjectInitFunc) gimp_data_factory_init,
|
|
/* reserved_1 */ NULL,
|
|
/* reserved_2 */ NULL,
|
|
(GtkClassInitFunc) NULL
|
|
};
|
|
|
|
factory_type = gtk_type_unique (GIMP_TYPE_OBJECT, &factory_info);
|
|
}
|
|
|
|
return factory_type;
|
|
}
|
|
|
|
static void
|
|
gimp_data_factory_class_init (GimpDataFactoryClass *klass)
|
|
{
|
|
GtkObjectClass *object_class;
|
|
|
|
object_class = (GtkObjectClass *) klass;
|
|
|
|
parent_class = gtk_type_class (GTK_TYPE_VBOX);
|
|
|
|
object_class->destroy = gimp_data_factory_destroy;
|
|
}
|
|
|
|
static void
|
|
gimp_data_factory_init (GimpDataFactory *factory)
|
|
{
|
|
factory->container = NULL;
|
|
factory->data_path = NULL;
|
|
factory->new_default_data_func = NULL;
|
|
factory->new_standard_data_func = NULL;
|
|
}
|
|
|
|
static void
|
|
gimp_data_factory_destroy (GtkObject *object)
|
|
{
|
|
GimpDataFactory *factory;
|
|
|
|
factory = GIMP_DATA_FACTORY (object);
|
|
|
|
if (factory->container)
|
|
gtk_object_unref (GTK_OBJECT (factory->container));
|
|
|
|
if (GTK_OBJECT_CLASS (parent_class)->destroy)
|
|
GTK_OBJECT_CLASS (parent_class)->destroy (object);
|
|
}
|
|
|
|
GimpDataFactory *
|
|
gimp_data_factory_new (GtkType data_type,
|
|
const gchar **data_path,
|
|
GimpDataNewDefaultFunc default_func,
|
|
GimpDataNewStandardFunc standard_func)
|
|
{
|
|
GimpDataFactory *factory;
|
|
|
|
g_return_val_if_fail (gtk_type_is_a (data_type, GIMP_TYPE_DATA), NULL);
|
|
g_return_val_if_fail (data_path != NULL, NULL);
|
|
g_return_val_if_fail (default_func != NULL, NULL);
|
|
g_return_val_if_fail (standard_func != NULL, NULL);
|
|
|
|
factory = gtk_type_new (GIMP_TYPE_DATA_FACTORY);
|
|
|
|
factory->container = GIMP_CONTAINER (gimp_data_list_new (data_type));
|
|
|
|
gtk_object_ref (GTK_OBJECT (factory->container));
|
|
gtk_object_sink (GTK_OBJECT (factory->container));
|
|
|
|
factory->data_path = data_path;
|
|
factory->new_default_data_func = default_func;
|
|
factory->new_standard_data_func = standard_func;
|
|
|
|
return factory;
|
|
}
|
|
|
|
void
|
|
gimp_data_factory_data_init (GimpDataFactory *factory)
|
|
{
|
|
g_return_if_fail (factory != NULL);
|
|
g_return_if_fail (GIMP_IS_DATA_FACTORY (factory));
|
|
}
|
|
|
|
void
|
|
gimp_data_factory_data_free (GimpDataFactory *factory)
|
|
{
|
|
g_return_if_fail (factory != NULL);
|
|
g_return_if_fail (GIMP_IS_DATA_FACTORY (factory));
|
|
|
|
if (gimp_container_num_children (factory->container) == 0)
|
|
return;
|
|
|
|
if (! (factory->data_path && *factory->data_path))
|
|
return;
|
|
|
|
gimp_data_list_save_and_clear (GIMP_DATA_LIST (factory->container),
|
|
*factory->data_path);
|
|
}
|