app/Makefile.am po/POTFILES.in app/brushes.[ch] app/gradients.[ch]

2001-02-14  Michael Natterer  <mitch@gimp.org>

	* app/Makefile.am
	* po/POTFILES.in
	* app/brushes.[ch]
	* app/gradients.[ch]
	* app/palettes.[ch]
	* app/patterns.[ch]: removed.

	* app/gimpdatafactory.[ch]: completely manage the data lists,
	including loading with different callbacks per extension.

	* app/gimpdatafactoryview.[ch]: enabled "new", "edit", "delete"
	and "refresh".

	* app/context_manager.c: initisalize the data factories.

	* app/gimpcontext.c: fixed some bad bugs introduced yesterday.

	* app/gradient_editor.[ch]: removed the public "create" function
	and create the editor implicitly on "set_gradient"

	* app/app_procs.c
	* app/apptypes.h
	* app/brush_edit.h
	* app/brush_select.c
	* app/commands.c
	* app/convert.c
	* app/devices.c
	* app/gimpbrushpipe.c
	* app/gimpcontainerview.h
	* app/gimpgradient.c
	* app/gimppattern.c
	* app/gradient_select.c
	* app/palette.c
	* app/pattern_select.c
	* 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/palette_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/palette.pdb
	* tools/pdbgen/pdb/pattern_select.pdb
	* tools/pdbgen/pdb/patterns.pdb: um, much stuff, mostly "changed
	accordingly" ;-)
This commit is contained in:
Michael Natterer 2001-02-14 01:42:12 +00:00 committed by Michael Natterer
parent a16b420306
commit a97e433ba2
80 changed files with 888 additions and 723 deletions

View File

@ -1,3 +1,57 @@
2001-02-14 Michael Natterer <mitch@gimp.org>
* app/Makefile.am
* po/POTFILES.in
* app/brushes.[ch]
* app/gradients.[ch]
* app/palettes.[ch]
* app/patterns.[ch]: removed.
* app/gimpdatafactory.[ch]: completely manage the data lists,
including loading with different callbacks per extension.
* app/gimpdatafactoryview.[ch]: enabled "new", "edit", "delete"
and "refresh".
* app/context_manager.c: initisalize the data factories.
* app/gimpcontext.c: fixed some bad bugs introduced yesterday.
* app/gradient_editor.[ch]: removed the public "create" function
and create the editor implicitly on "set_gradient"
* app/app_procs.c
* app/apptypes.h
* app/brush_edit.h
* app/brush_select.c
* app/commands.c
* app/convert.c
* app/devices.c
* app/gimpbrushpipe.c
* app/gimpcontainerview.h
* app/gimpgradient.c
* app/gimppattern.c
* app/gradient_select.c
* app/palette.c
* app/pattern_select.c
* 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/palette_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/palette.pdb
* tools/pdbgen/pdb/pattern_select.pdb
* tools/pdbgen/pdb/patterns.pdb: um, much stuff, mostly "changed
accordingly" ;-)
2001-02-13 Michael Natterer <mitch@gimp.org>
* gimprc.in

View File

@ -34,8 +34,6 @@ gimp_SOURCES = \
brush_scale.h \
brush_select.c \
brush_select.h \
brushes.c \
brushes.h \
channels_dialog.c \
channels_dialog.h \
channel_ops.c \
@ -167,8 +165,6 @@ gimp_SOURCES = \
global_edit.h \
gradient_editor.c \
gradient_editoe.h \
gradients.c \
gradients.h \
gradient_select.h \
gradient_select.c \
gximage.c \
@ -216,8 +212,6 @@ gimp_SOURCES = \
palette_import.h \
palette_select.c \
palette_select.h \
palettes.c \
palettes.h \
paletteP.h \
parasitelist.c \
parasitelist.h \
@ -231,8 +225,6 @@ gimp_SOURCES = \
pattern_header.h \
pattern_select.c \
pattern_select.h \
patterns.c \
patterns.h \
plug_in.c \
plug_in.h \
preferences_dialog.c \

View File

@ -77,10 +77,7 @@
/* for the example dialogs */
#include "brushes.h"
#include "gradients.h"
#include "palettes.h"
#include "patterns.h"
#include "gradient_editor.h"
#include "gimpcontainer.h"
#include "gimpcontainerlistview.h"
#include "gimpcontainergridview.h"
@ -1509,11 +1506,12 @@ container_view_new (gboolean list,
}
static void
data_factory_view_new (GimpViewType view_type,
gchar *title,
GimpDataFactory *factory,
GimpContext *context,
gint preview_size)
data_factory_view_new (GimpViewType view_type,
gchar *title,
GimpDataFactory *factory,
GimpDataEditFunc edit_func,
GimpContext *context,
gint preview_size)
{
GtkWidget *dialog;
GtkWidget *view;
@ -1535,6 +1533,7 @@ data_factory_view_new (GimpViewType view_type,
view = gimp_data_factory_view_new (view_type,
factory,
edit_func,
context,
preview_size,
5, 5);
@ -1746,6 +1745,7 @@ dialogs_test_brush_container_list_view_cmd_callback (GtkWidget *widget,
data_factory_view_new (GIMP_VIEW_TYPE_LIST,
"Brush List",
global_brush_factory,
NULL,
gimp_context_get_user (),
24);
}
@ -1757,6 +1757,7 @@ dialogs_test_pattern_container_list_view_cmd_callback (GtkWidget *widget,
data_factory_view_new (GIMP_VIEW_TYPE_LIST,
"Pattern List",
global_pattern_factory,
NULL,
gimp_context_get_user (),
24);
}
@ -1768,6 +1769,7 @@ dialogs_test_gradient_container_list_view_cmd_callback (GtkWidget *widget,
data_factory_view_new (GIMP_VIEW_TYPE_LIST,
"Gradient List",
global_gradient_factory,
gradient_editor_set_gradient,
gimp_context_get_user (),
24);
}
@ -1779,6 +1781,7 @@ dialogs_test_palette_container_list_view_cmd_callback (GtkWidget *widget,
data_factory_view_new (GIMP_VIEW_TYPE_LIST,
"Palette List",
global_palette_factory,
NULL,
gimp_context_get_user (),
24);
}
@ -1790,6 +1793,7 @@ dialogs_test_brush_container_grid_view_cmd_callback (GtkWidget *widget,
data_factory_view_new (GIMP_VIEW_TYPE_GRID,
"Brush Grid",
global_brush_factory,
NULL,
gimp_context_get_user (),
32);
}
@ -1801,6 +1805,7 @@ dialogs_test_pattern_container_grid_view_cmd_callback (GtkWidget *widget,
data_factory_view_new (GIMP_VIEW_TYPE_GRID,
"Pattern Grid",
global_pattern_factory,
NULL,
gimp_context_get_user (),
24);
}
@ -1812,17 +1817,19 @@ dialogs_test_gradient_container_grid_view_cmd_callback (GtkWidget *widget,
data_factory_view_new (GIMP_VIEW_TYPE_GRID,
"Gradient Grid",
global_gradient_factory,
gradient_editor_set_gradient,
gimp_context_get_user (),
24);
}
void
dialogs_test_palette_container_grid_view_cmd_callback (GtkWidget *widget,
gpointer client_data)
gpointer client_data)
{
data_factory_view_new (GIMP_VIEW_TYPE_GRID,
"Palette Grid",
global_palette_factory,
NULL,
gimp_context_get_user (),
24);
}

View File

@ -48,7 +48,6 @@
#include "app_procs.h"
#include "batch.h"
#include "brush_select.h"
#include "brushes.h"
#include "color_transfer.h"
#include "colormaps.h"
#include "context_manager.h"
@ -58,21 +57,19 @@
#include "gdisplay.h"
#include "gdisplay_ops.h"
#include "gimpcontext.h"
#include "gimpdatafactory.h"
#include "gimpimage.h"
#include "gimprc.h"
#include "gimpparasite.h"
#include "global_edit.h"
#include "gradient_select.h"
#include "gradients.h"
#include "gximage.h"
#include "image_render.h"
#include "lc_dialog.h"
#include "menus.h"
#include "paint_funcs.h"
#include "palettes.h"
#include "palette.h"
#include "pattern_select.h"
#include "patterns.h"
#include "plug_in.h"
#include "module_db.h"
#include "session.h"
@ -570,16 +567,26 @@ app_init (void)
RESET_BAR();
xcf_init (); /* initialize the xcf file format routines */
/* initialize the global parasite table */
app_init_update_status (_("Looking for data files"), _("Parasites"), 0.00);
gimp_init_parasites (); /* initialize the global parasite table */
gimp_init_parasites ();
/* initialize the list of gimp brushes */
app_init_update_status (NULL, _("Brushes"), 0.20);
brushes_init (no_data); /* initialize the list of gimp brushes */
gimp_data_factory_data_init (global_brush_factory, no_data);
/* initialize the list of gimp patterns */
app_init_update_status (NULL, _("Patterns"), 0.40);
patterns_init (no_data); /* initialize the list of gimp patterns */
gimp_data_factory_data_init (global_pattern_factory, no_data);
/* initialize the list of gimp palettes */
app_init_update_status (NULL, _("Palettes"), 0.60);
palettes_init (no_data); /* initialize the list of gimp palettes */
gimp_data_factory_data_init (global_palette_factory, no_data);
/* initialize the list of gimp gradients */
app_init_update_status (NULL, _("Gradients"), 0.80);
gradients_init (no_data); /* initialize the list of gimp gradients */
gimp_data_factory_data_init (global_gradient_factory, no_data);
app_init_update_status (NULL, NULL, 1.00);
plug_in_init (); /* initialize the plug in structures */
@ -695,13 +702,9 @@ app_exit_finish (void)
named_buffers_free ();
swapping_free ();
brush_dialog_free ();
brushes_free ();
pattern_dialog_free ();
patterns_free ();
palette_dialog_free ();
palettes_free ();
gradient_dialog_free ();
gradients_free ();
context_manager_free ();
hue_saturation_free ();
curves_free ();

View File

@ -83,8 +83,10 @@ typedef struct _GimpPatternPreview GimpPatternPreview;
typedef struct _GimpPalettePreview GimpPalettePreview;
typedef struct _GimpGradientPreview GimpGradientPreview;
typedef struct _GimpContainerView GimpContainerView;
typedef struct _GimpContainerListView GimpContainerListView;
typedef struct _GimpContainerGridView GimpContainerGridView;
typedef struct _GimpDataFactoryView GimpDataFactoryView;
typedef struct _HistogramWidget HistogramWidget;

View File

@ -43,9 +43,11 @@ struct _BrushEditGeneratedWindow
gint scale;
};
BrushEditGeneratedWindow * brush_edit_generated_new (void);
void brush_edit_generated_set_brush (BrushEditGeneratedWindow *begw,
GimpBrush *brush);
#endif /* __BRUSH_EDIT_H__ */

View File

@ -30,7 +30,6 @@
#include "context_manager.h"
#include "brush_edit.h"
#include "brush_select.h"
#include "brushes.h"
#include "dialog_handler.h"
#include "gimpbrushgenerated.h"
#include "gimpcontainer.h"
@ -199,7 +198,7 @@ brush_select_new (gchar *title,
}
if (no_data && first_call)
brushes_init (FALSE);
gimp_data_factory_data_init (global_brush_factory, FALSE);
first_call = FALSE;
@ -745,8 +744,7 @@ static void
brush_select_refresh_callback (GtkWidget *widget,
gpointer data)
{
/* re-init the brush list */
brushes_init (FALSE);
gimp_data_factory_data_init (global_brush_factory, FALSE);
}
static void

View File

@ -1,72 +0,0 @@
/* 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 "apptypes.h"
#include "context_manager.h"
#include "brushes.h"
#include "gimpbrush.h"
#include "gimpbrushgenerated.h"
#include "gimpbrushpipe.h"
#include "gimpdatafactory.h"
#include "gimpdatalist.h"
#include "gimprc.h"
/* public functions */
void
brushes_init (gboolean no_data)
{
brushes_free ();
if (brush_path != NULL && !no_data)
{
gimp_data_list_load (GIMP_DATA_LIST (global_brush_factory->container),
brush_path,
(GimpDataObjectLoaderFunc) gimp_brush_load,
GIMP_BRUSH_FILE_EXTENSION,
(GimpDataObjectLoaderFunc) gimp_brush_load,
GIMP_BRUSH_PIXMAP_FILE_EXTENSION,
(GimpDataObjectLoaderFunc) gimp_brush_generated_load,
GIMP_BRUSH_GENERATED_FILE_EXTENSION,
(GimpDataObjectLoaderFunc) gimp_brush_pipe_load,
GIMP_BRUSH_PIPE_FILE_EXTENSION,
NULL);
}
}
void
brushes_free (void)
{
if (gimp_container_num_children (global_brush_factory->container) == 0)
return;
gimp_data_list_save_and_clear
(GIMP_DATA_LIST (global_brush_factory->container),
brush_path);
}

View File

@ -1,27 +0,0 @@
/* 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.
*/
#ifndef __BRUSHES_H__
#define __BRUSHES_H__
void brushes_init (gboolean no_data);
void brushes_free (void);
#endif /* __BRUSHES_H__ */

View File

@ -77,10 +77,7 @@
/* for the example dialogs */
#include "brushes.h"
#include "gradients.h"
#include "palettes.h"
#include "patterns.h"
#include "gradient_editor.h"
#include "gimpcontainer.h"
#include "gimpcontainerlistview.h"
#include "gimpcontainergridview.h"
@ -1509,11 +1506,12 @@ container_view_new (gboolean list,
}
static void
data_factory_view_new (GimpViewType view_type,
gchar *title,
GimpDataFactory *factory,
GimpContext *context,
gint preview_size)
data_factory_view_new (GimpViewType view_type,
gchar *title,
GimpDataFactory *factory,
GimpDataEditFunc edit_func,
GimpContext *context,
gint preview_size)
{
GtkWidget *dialog;
GtkWidget *view;
@ -1535,6 +1533,7 @@ data_factory_view_new (GimpViewType view_type,
view = gimp_data_factory_view_new (view_type,
factory,
edit_func,
context,
preview_size,
5, 5);
@ -1746,6 +1745,7 @@ dialogs_test_brush_container_list_view_cmd_callback (GtkWidget *widget,
data_factory_view_new (GIMP_VIEW_TYPE_LIST,
"Brush List",
global_brush_factory,
NULL,
gimp_context_get_user (),
24);
}
@ -1757,6 +1757,7 @@ dialogs_test_pattern_container_list_view_cmd_callback (GtkWidget *widget,
data_factory_view_new (GIMP_VIEW_TYPE_LIST,
"Pattern List",
global_pattern_factory,
NULL,
gimp_context_get_user (),
24);
}
@ -1768,6 +1769,7 @@ dialogs_test_gradient_container_list_view_cmd_callback (GtkWidget *widget,
data_factory_view_new (GIMP_VIEW_TYPE_LIST,
"Gradient List",
global_gradient_factory,
gradient_editor_set_gradient,
gimp_context_get_user (),
24);
}
@ -1779,6 +1781,7 @@ dialogs_test_palette_container_list_view_cmd_callback (GtkWidget *widget,
data_factory_view_new (GIMP_VIEW_TYPE_LIST,
"Palette List",
global_palette_factory,
NULL,
gimp_context_get_user (),
24);
}
@ -1790,6 +1793,7 @@ dialogs_test_brush_container_grid_view_cmd_callback (GtkWidget *widget,
data_factory_view_new (GIMP_VIEW_TYPE_GRID,
"Brush Grid",
global_brush_factory,
NULL,
gimp_context_get_user (),
32);
}
@ -1801,6 +1805,7 @@ dialogs_test_pattern_container_grid_view_cmd_callback (GtkWidget *widget,
data_factory_view_new (GIMP_VIEW_TYPE_GRID,
"Pattern Grid",
global_pattern_factory,
NULL,
gimp_context_get_user (),
24);
}
@ -1812,17 +1817,19 @@ dialogs_test_gradient_container_grid_view_cmd_callback (GtkWidget *widget,
data_factory_view_new (GIMP_VIEW_TYPE_GRID,
"Gradient Grid",
global_gradient_factory,
gradient_editor_set_gradient,
gimp_context_get_user (),
24);
}
void
dialogs_test_palette_container_grid_view_cmd_callback (GtkWidget *widget,
gpointer client_data)
gpointer client_data)
{
data_factory_view_new (GIMP_VIEW_TYPE_GRID,
"Palette Grid",
global_palette_factory,
NULL,
gimp_context_get_user (),
24);
}

View File

@ -27,6 +27,8 @@
#include "context_manager.h"
#include "gdisplay.h"
#include "gimpbrush.h"
#include "gimpbrushgenerated.h"
#include "gimpbrushpipe.h"
#include "gimpcontainer.h"
#include "gimpcontext.h"
#include "gimpdatafactory.h"
@ -145,7 +147,40 @@ context_manager_init (void)
GimpContext *standard_context;
GimpContext *default_context;
GimpContext *user_context;
gint i;
gint i;
static const GimpDataFactoryLoaderEntry brush_loader_entries[] =
{
{ gimp_brush_load, GIMP_BRUSH_FILE_EXTENSION },
{ gimp_brush_load, GIMP_BRUSH_PIXMAP_FILE_EXTENSION },
{ gimp_brush_generated_load, GIMP_BRUSH_GENERATED_FILE_EXTENSION },
{ gimp_brush_pipe_load, GIMP_BRUSH_PIPE_FILE_EXTENSION }
};
static gint n_brush_loader_entries = (sizeof (brush_loader_entries) /
sizeof (brush_loader_entries[0]));
static const GimpDataFactoryLoaderEntry pattern_loader_entries[] =
{
{ gimp_pattern_load, GIMP_PATTERN_FILE_EXTENSION }
};
static gint n_pattern_loader_entries = (sizeof (pattern_loader_entries) /
sizeof (pattern_loader_entries[0]));
static const GimpDataFactoryLoaderEntry gradient_loader_entries[] =
{
{ gimp_gradient_load, GIMP_GRADIENT_FILE_EXTENSION },
{ gimp_gradient_load, NULL /* legacy loader */ }
};
static gint n_gradient_loader_entries = (sizeof (gradient_loader_entries) /
sizeof (gradient_loader_entries[0]));
static const GimpDataFactoryLoaderEntry palette_loader_entries[] =
{
{ gimp_palette_load, GIMP_PALETTE_FILE_EXTENSION },
{ gimp_palette_load, NULL /* legacy loader */ }
};
static gint n_palette_loader_entries = (sizeof (palette_loader_entries) /
sizeof (palette_loader_entries[0]));
/* Create the context of all existing images */
image_context = GIMP_CONTAINER (gimp_list_new (GIMP_TYPE_IMAGE,
@ -155,24 +190,32 @@ context_manager_init (void)
global_brush_factory =
gimp_data_factory_new (GIMP_TYPE_BRUSH,
(const gchar **) &brush_path,
brush_loader_entries,
n_brush_loader_entries,
gimp_brush_new,
gimp_brush_get_standard);
global_pattern_factory =
gimp_data_factory_new (GIMP_TYPE_PATTERN,
(const gchar **) &pattern_path,
pattern_loader_entries,
n_pattern_loader_entries,
gimp_pattern_new,
gimp_pattern_get_standard);
global_gradient_factory =
gimp_data_factory_new (GIMP_TYPE_GRADIENT,
(const gchar **) &gradient_path,
gradient_loader_entries,
n_gradient_loader_entries,
gimp_gradient_new,
gimp_gradient_get_standard);
global_palette_factory =
gimp_data_factory_new (GIMP_TYPE_PALETTE,
(const gchar **) &palette_path,
palette_loader_entries,
n_palette_loader_entries,
gimp_palette_new,
gimp_palette_get_standard);
@ -182,13 +225,6 @@ context_manager_init (void)
/* TODO: load from disk */
default_context = gimp_context_new ("Default", NULL);
/*
default_context->brush_name = g_strdup (default_brush);
default_context->pattern_name = g_strdup (default_pattern);
default_context->gradient_name = g_strdup (default_gradient);
default_context->palette_name = g_strdup (default_palette);
*/
gimp_context_set_default (default_context);
/* Initialize the user context with the default context's values */
@ -280,6 +316,11 @@ context_manager_free (void)
/* TODO: Save to disk before destroying */
gtk_object_unref (GTK_OBJECT (gimp_context_get_default ()));
gimp_context_set_default (NULL);
gimp_data_factory_data_free (global_brush_factory);
gimp_data_factory_data_free (global_pattern_factory);
gimp_data_factory_data_free (global_gradient_factory);
gimp_data_factory_data_free (global_palette_factory);
}
void

View File

@ -109,7 +109,6 @@
#include "gimplist.h"
#include "gimplayer.h"
#include "gimppalette.h"
#include "palettes.h"
#include "palette_select.h"
#include "pixel_region.h"
#include "tile_manager.h"

View File

@ -48,7 +48,6 @@
#include "appenv.h"
#include "brush_header.h"
#include "pattern_header.h"
#include "patterns.h"
#include "gimpbrush.h"
#include "gimpbrushpipe.h"
#include "gimprc.h"

View File

@ -48,7 +48,6 @@
#include "appenv.h"
#include "brush_header.h"
#include "pattern_header.h"
#include "patterns.h"
#include "gimpbrush.h"
#include "gimpbrushpipe.h"
#include "gimprc.h"

View File

@ -1797,7 +1797,7 @@ gimp_context_pattern_removed (GimpContainer *container,
gtk_object_unref (GTK_OBJECT (pattern));
if (! gimp_container_frozen (container))
gimp_context_brush_list_thaw (container, context);
gimp_context_pattern_list_thaw (container, context);
}
}
@ -1961,7 +1961,7 @@ gimp_context_gradient_removed (GimpContainer *container,
gtk_object_unref (GTK_OBJECT (gradient));
if (! gimp_container_frozen (container))
gimp_context_brush_list_thaw (container, context);
gimp_context_gradient_list_thaw (container, context);
}
}
@ -2110,7 +2110,7 @@ gimp_context_palette_removed (GimpContainer *container,
gtk_object_unref (GTK_OBJECT (palette));
if (! gimp_container_frozen (container))
gimp_context_brush_list_thaw (container, context);
gimp_context_palette_list_thaw (container, context);
}
}

View File

@ -24,17 +24,23 @@
#include "apptypes.h"
#include "datafiles.h"
#include "gimpdata.h"
#include "gimpdatalist.h"
#include "gimpdatafactory.h"
#include "gimpcontext.h"
#include "gimpmarshal.h"
#include "libgimp/gimpintl.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 void gimp_data_factory_data_load_callback (const gchar *filename,
gpointer callback_data);
static GimpObjectClass *parent_class = NULL;
@ -81,8 +87,10 @@ 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;
factory->loader_entries = NULL;
factory->n_loader_entries = 0;
factory->data_new_func = NULL;
factory->data_get_standard_func = NULL;
}
static void
@ -100,17 +108,19 @@ gimp_data_factory_destroy (GtkObject *object)
}
GimpDataFactory *
gimp_data_factory_new (GtkType data_type,
const gchar **data_path,
GimpDataNewDefaultFunc default_func,
GimpDataNewStandardFunc standard_func)
gimp_data_factory_new (GtkType data_type,
const gchar **data_path,
GimpDataFactoryLoaderEntry *loader_entries,
gint n_loader_entries,
GimpDataNewFunc new_func,
GimpDataGetStandardFunc 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);
g_return_val_if_fail (loader_entries != NULL, NULL);
g_return_val_if_fail (n_loader_entries > 0, NULL);
factory = gtk_type_new (GIMP_TYPE_DATA_FACTORY);
@ -119,15 +129,41 @@ gimp_data_factory_new (GtkType 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;
factory->data_path = data_path;
factory->loader_entries = loader_entries;
factory->n_loader_entries = n_loader_entries;
factory->data_new_func = new_func;
factory->data_get_standard_func = standard_func;
return factory;
}
void
gimp_data_factory_data_init (GimpDataFactory *factory)
gimp_data_factory_data_init (GimpDataFactory *factory,
gboolean no_data)
{
g_return_if_fail (factory != NULL);
g_return_if_fail (GIMP_IS_DATA_FACTORY (factory));
gimp_container_freeze (factory->container);
if (gimp_container_num_children (factory->container) > 0)
gimp_data_factory_data_free (factory);
if (factory->data_path && *factory->data_path)
{
datafiles_read_directories (*factory->data_path, 0,
gimp_data_factory_data_load_callback,
factory);
}
gimp_container_thaw (factory->container);
}
void
gimp_data_factory_data_save (GimpDataFactory *factory)
{
g_return_if_fail (factory != NULL);
g_return_if_fail (GIMP_IS_DATA_FACTORY (factory));
@ -148,3 +184,94 @@ gimp_data_factory_data_free (GimpDataFactory *factory)
gimp_data_list_save_and_clear (GIMP_DATA_LIST (factory->container),
*factory->data_path);
}
GimpData *
gimp_data_factory_data_new (GimpDataFactory *factory,
const gchar *name)
{
g_return_val_if_fail (factory != NULL, NULL);
g_return_val_if_fail (GIMP_IS_DATA_FACTORY (factory), NULL);
g_return_val_if_fail (name != NULL, NULL);
if (factory->data_new_func)
{
GimpData *data;
data = factory->data_new_func (name);
gimp_container_add (factory->container, GIMP_OBJECT (data));
return data;
}
return NULL;
}
GimpData *
gimp_data_factory_data_duplicate (GimpDataFactory *factory,
GimpData *data,
const gchar *name)
{
g_return_val_if_fail (factory != NULL, NULL);
g_return_val_if_fail (GIMP_IS_DATA_FACTORY (factory), NULL);
g_return_val_if_fail (data != NULL, NULL);
g_return_val_if_fail (GIMP_IS_DATA (data), NULL);
g_return_val_if_fail (name != NULL, NULL);
return NULL;
}
GimpData *
gimp_data_factory_data_get_standard (GimpDataFactory *factory)
{
g_return_val_if_fail (factory != NULL, NULL);
g_return_val_if_fail (GIMP_IS_DATA_FACTORY (factory), NULL);
if (factory->data_get_standard_func)
return factory->data_get_standard_func ();
return NULL;
}
static void
gimp_data_factory_data_load_callback (const gchar *filename,
gpointer callback_data)
{
GimpDataFactory *factory;
gint i;
factory = (GimpDataFactory *) callback_data;
for (i = 0; i < factory->n_loader_entries; i++)
{
if (factory->loader_entries[i].extension)
{
if (datafiles_check_extension (filename,
factory->loader_entries[i].extension))
{
goto insert;
}
}
else
{
g_warning ("%s(): trying legacy loader on file with unknown "
"extension: %s",
G_GNUC_FUNCTION, filename);
goto insert;
}
}
return;
insert:
{
GimpData *data;
data = (GimpData *) (* factory->loader_entries[i].load_func) (filename);
if (! data)
g_message (_("Warning: Failed to load data from\n\"%s\""), filename);
else
gimp_container_add (factory->container, GIMP_OBJECT (data));
}
}

View File

@ -23,8 +23,18 @@
#include "gimpobject.h"
typedef GimpData * (* GimpDataNewDefaultFunc) (const gchar *name);
typedef GimpData * (* GimpDataNewStandardFunc) (void);
typedef GimpData * (* GimpDataNewFunc) (const gchar *name);
typedef GimpData * (* GimpDataLoadFunc) (const gchar *filename);
typedef GimpData * (* GimpDataGetStandardFunc) (void);
typedef struct _GimpDataFactoryLoaderEntry GimpDataFactoryLoaderEntry;
struct _GimpDataFactoryLoaderEntry
{
GimpDataLoadFunc load_func;
const gchar *extension;
};
#define GIMP_TYPE_DATA_FACTORY (gimp_data_factory_get_type ())
@ -38,14 +48,17 @@ typedef struct _GimpDataFactoryClass GimpDataFactoryClass;
struct _GimpDataFactory
{
GimpObject *object;
GimpObject parent_instance;
GimpContainer *container;
GimpContainer *container;
const gchar **data_path;
const gchar **data_path;
GimpDataNewDefaultFunc new_default_data_func;
GimpDataNewStandardFunc new_standard_data_func;
GimpDataFactoryLoaderEntry *loader_entries;
gint n_loader_entries;
GimpDataNewFunc data_new_func;
GimpDataGetStandardFunc data_get_standard_func;
};
struct _GimpDataFactoryClass
@ -55,13 +68,24 @@ struct _GimpDataFactoryClass
GtkType gimp_data_factory_get_type (void);
GimpDataFactory * gimp_data_factory_new (GtkType data_type,
const gchar **data_path,
GimpDataNewDefaultFunc default_func,
GimpDataNewStandardFunc standard_func);
GimpDataFactory * gimp_data_factory_new (GtkType data_type,
const gchar **data_path,
GimpDataFactoryLoaderEntry *loader_entries,
gint n_loader_entries,
GimpDataNewFunc new_func,
GimpDataGetStandardFunc standard_func);
void gimp_data_factory_data_init (GimpDataFactory *factory);
void gimp_data_factory_data_free (GimpDataFactory *factory);
void gimp_data_factory_data_init (GimpDataFactory *factory,
gboolean no_data);
void gimp_data_factory_data_save (GimpDataFactory *factory);
void gimp_data_factory_data_free (GimpDataFactory *factory);
GimpData * gimp_data_factory_data_new (GimpDataFactory *factory,
const gchar *name);
GimpData * gimp_data_factory_data_duplicate (GimpDataFactory *factory,
GimpData *data,
const gchar *name);
GimpData * gimp_data_factory_data_get_standard (GimpDataFactory *factory);
#endif /* __GIMP_DATA_FACTORY_H__ */

View File

@ -33,7 +33,6 @@
#include "gimpimage.h"
#include "gimpgradient.h"
#include "gimprc.h"
#include "gradients.h"
#include "temp_buf.h"
#include "libgimp/gimplimits.h"

View File

@ -109,7 +109,6 @@
#include "gimplist.h"
#include "gimplayer.h"
#include "gimppalette.h"
#include "palettes.h"
#include "palette_select.h"
#include "pixel_region.h"
#include "tile_manager.h"

View File

@ -45,7 +45,6 @@
#include "gimpimage.h"
#include "gimppattern.h"
#include "gimprc.h"
#include "patterns.h"
#include "pattern_header.h"
#include "temp_buf.h"

View File

@ -45,7 +45,6 @@
#include "gimpimage.h"
#include "gimppattern.h"
#include "gimprc.h"
#include "patterns.h"
#include "pattern_header.h"
#include "temp_buf.h"

View File

@ -30,7 +30,6 @@
#include "appenv.h"
#include "context_manager.h"
#include "brushes.h"
#include "devices.h"
#include "dialog_handler.h"
#include "gimpbrush.h"
@ -42,8 +41,6 @@
#include "gimppreview.h"
#include "gimplist.h"
#include "gimprc.h"
#include "gradients.h"
#include "patterns.h"
#include "session.h"
#include "tools/tools.h"

View File

@ -48,7 +48,6 @@
#include "appenv.h"
#include "brush_header.h"
#include "pattern_header.h"
#include "patterns.h"
#include "gimpbrush.h"
#include "gimpbrushpipe.h"
#include "gimprc.h"

View File

@ -30,7 +30,6 @@
#define GIMP_IS_CONTAINER_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_CONTAINER_VIEW))
typedef struct _GimpContainerView GimpContainerView;
typedef struct _GimpContainerViewClass GimpContainerViewClass;
struct _GimpContainerView

View File

@ -1797,7 +1797,7 @@ gimp_context_pattern_removed (GimpContainer *container,
gtk_object_unref (GTK_OBJECT (pattern));
if (! gimp_container_frozen (container))
gimp_context_brush_list_thaw (container, context);
gimp_context_pattern_list_thaw (container, context);
}
}
@ -1961,7 +1961,7 @@ gimp_context_gradient_removed (GimpContainer *container,
gtk_object_unref (GTK_OBJECT (gradient));
if (! gimp_container_frozen (container))
gimp_context_brush_list_thaw (container, context);
gimp_context_gradient_list_thaw (container, context);
}
}
@ -2110,7 +2110,7 @@ gimp_context_palette_removed (GimpContainer *container,
gtk_object_unref (GTK_OBJECT (palette));
if (! gimp_container_frozen (container))
gimp_context_brush_list_thaw (container, context);
gimp_context_palette_list_thaw (container, context);
}
}

View File

@ -24,17 +24,23 @@
#include "apptypes.h"
#include "datafiles.h"
#include "gimpdata.h"
#include "gimpdatalist.h"
#include "gimpdatafactory.h"
#include "gimpcontext.h"
#include "gimpmarshal.h"
#include "libgimp/gimpintl.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 void gimp_data_factory_data_load_callback (const gchar *filename,
gpointer callback_data);
static GimpObjectClass *parent_class = NULL;
@ -81,8 +87,10 @@ 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;
factory->loader_entries = NULL;
factory->n_loader_entries = 0;
factory->data_new_func = NULL;
factory->data_get_standard_func = NULL;
}
static void
@ -100,17 +108,19 @@ gimp_data_factory_destroy (GtkObject *object)
}
GimpDataFactory *
gimp_data_factory_new (GtkType data_type,
const gchar **data_path,
GimpDataNewDefaultFunc default_func,
GimpDataNewStandardFunc standard_func)
gimp_data_factory_new (GtkType data_type,
const gchar **data_path,
GimpDataFactoryLoaderEntry *loader_entries,
gint n_loader_entries,
GimpDataNewFunc new_func,
GimpDataGetStandardFunc 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);
g_return_val_if_fail (loader_entries != NULL, NULL);
g_return_val_if_fail (n_loader_entries > 0, NULL);
factory = gtk_type_new (GIMP_TYPE_DATA_FACTORY);
@ -119,15 +129,41 @@ gimp_data_factory_new (GtkType 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;
factory->data_path = data_path;
factory->loader_entries = loader_entries;
factory->n_loader_entries = n_loader_entries;
factory->data_new_func = new_func;
factory->data_get_standard_func = standard_func;
return factory;
}
void
gimp_data_factory_data_init (GimpDataFactory *factory)
gimp_data_factory_data_init (GimpDataFactory *factory,
gboolean no_data)
{
g_return_if_fail (factory != NULL);
g_return_if_fail (GIMP_IS_DATA_FACTORY (factory));
gimp_container_freeze (factory->container);
if (gimp_container_num_children (factory->container) > 0)
gimp_data_factory_data_free (factory);
if (factory->data_path && *factory->data_path)
{
datafiles_read_directories (*factory->data_path, 0,
gimp_data_factory_data_load_callback,
factory);
}
gimp_container_thaw (factory->container);
}
void
gimp_data_factory_data_save (GimpDataFactory *factory)
{
g_return_if_fail (factory != NULL);
g_return_if_fail (GIMP_IS_DATA_FACTORY (factory));
@ -148,3 +184,94 @@ gimp_data_factory_data_free (GimpDataFactory *factory)
gimp_data_list_save_and_clear (GIMP_DATA_LIST (factory->container),
*factory->data_path);
}
GimpData *
gimp_data_factory_data_new (GimpDataFactory *factory,
const gchar *name)
{
g_return_val_if_fail (factory != NULL, NULL);
g_return_val_if_fail (GIMP_IS_DATA_FACTORY (factory), NULL);
g_return_val_if_fail (name != NULL, NULL);
if (factory->data_new_func)
{
GimpData *data;
data = factory->data_new_func (name);
gimp_container_add (factory->container, GIMP_OBJECT (data));
return data;
}
return NULL;
}
GimpData *
gimp_data_factory_data_duplicate (GimpDataFactory *factory,
GimpData *data,
const gchar *name)
{
g_return_val_if_fail (factory != NULL, NULL);
g_return_val_if_fail (GIMP_IS_DATA_FACTORY (factory), NULL);
g_return_val_if_fail (data != NULL, NULL);
g_return_val_if_fail (GIMP_IS_DATA (data), NULL);
g_return_val_if_fail (name != NULL, NULL);
return NULL;
}
GimpData *
gimp_data_factory_data_get_standard (GimpDataFactory *factory)
{
g_return_val_if_fail (factory != NULL, NULL);
g_return_val_if_fail (GIMP_IS_DATA_FACTORY (factory), NULL);
if (factory->data_get_standard_func)
return factory->data_get_standard_func ();
return NULL;
}
static void
gimp_data_factory_data_load_callback (const gchar *filename,
gpointer callback_data)
{
GimpDataFactory *factory;
gint i;
factory = (GimpDataFactory *) callback_data;
for (i = 0; i < factory->n_loader_entries; i++)
{
if (factory->loader_entries[i].extension)
{
if (datafiles_check_extension (filename,
factory->loader_entries[i].extension))
{
goto insert;
}
}
else
{
g_warning ("%s(): trying legacy loader on file with unknown "
"extension: %s",
G_GNUC_FUNCTION, filename);
goto insert;
}
}
return;
insert:
{
GimpData *data;
data = (GimpData *) (* factory->loader_entries[i].load_func) (filename);
if (! data)
g_message (_("Warning: Failed to load data from\n\"%s\""), filename);
else
gimp_container_add (factory->container, GIMP_OBJECT (data));
}
}

View File

@ -23,8 +23,18 @@
#include "gimpobject.h"
typedef GimpData * (* GimpDataNewDefaultFunc) (const gchar *name);
typedef GimpData * (* GimpDataNewStandardFunc) (void);
typedef GimpData * (* GimpDataNewFunc) (const gchar *name);
typedef GimpData * (* GimpDataLoadFunc) (const gchar *filename);
typedef GimpData * (* GimpDataGetStandardFunc) (void);
typedef struct _GimpDataFactoryLoaderEntry GimpDataFactoryLoaderEntry;
struct _GimpDataFactoryLoaderEntry
{
GimpDataLoadFunc load_func;
const gchar *extension;
};
#define GIMP_TYPE_DATA_FACTORY (gimp_data_factory_get_type ())
@ -38,14 +48,17 @@ typedef struct _GimpDataFactoryClass GimpDataFactoryClass;
struct _GimpDataFactory
{
GimpObject *object;
GimpObject parent_instance;
GimpContainer *container;
GimpContainer *container;
const gchar **data_path;
const gchar **data_path;
GimpDataNewDefaultFunc new_default_data_func;
GimpDataNewStandardFunc new_standard_data_func;
GimpDataFactoryLoaderEntry *loader_entries;
gint n_loader_entries;
GimpDataNewFunc data_new_func;
GimpDataGetStandardFunc data_get_standard_func;
};
struct _GimpDataFactoryClass
@ -55,13 +68,24 @@ struct _GimpDataFactoryClass
GtkType gimp_data_factory_get_type (void);
GimpDataFactory * gimp_data_factory_new (GtkType data_type,
const gchar **data_path,
GimpDataNewDefaultFunc default_func,
GimpDataNewStandardFunc standard_func);
GimpDataFactory * gimp_data_factory_new (GtkType data_type,
const gchar **data_path,
GimpDataFactoryLoaderEntry *loader_entries,
gint n_loader_entries,
GimpDataNewFunc new_func,
GimpDataGetStandardFunc standard_func);
void gimp_data_factory_data_init (GimpDataFactory *factory);
void gimp_data_factory_data_free (GimpDataFactory *factory);
void gimp_data_factory_data_init (GimpDataFactory *factory,
gboolean no_data);
void gimp_data_factory_data_save (GimpDataFactory *factory);
void gimp_data_factory_data_free (GimpDataFactory *factory);
GimpData * gimp_data_factory_data_new (GimpDataFactory *factory,
const gchar *name);
GimpData * gimp_data_factory_data_duplicate (GimpDataFactory *factory,
GimpData *data,
const gchar *name);
GimpData * gimp_data_factory_data_get_standard (GimpDataFactory *factory);
#endif /* __GIMP_DATA_FACTORY_H__ */

View File

@ -26,6 +26,7 @@
#include "gimpcontainer.h"
#include "gimpcontainerview.h"
#include "gimpdata.h"
#include "gimpdatafactory.h"
#include "gimpdatafactoryview.h"
#include "gimpcontainergridview.h"
@ -58,6 +59,10 @@ static void gimp_data_factory_view_delete_clicked (GtkWidget *wid
static void gimp_data_factory_view_refresh_clicked (GtkWidget *widget,
GimpDataFactoryView *view);
static void gimp_data_factory_view_data_changed (GimpContext *context,
GimpData *data,
GimpDataFactoryView *view);
static GtkVBoxClass *parent_class = NULL;
@ -196,6 +201,10 @@ gimp_data_factory_view_init (GimpDataFactoryView *view)
pixmap = gimp_pixmap_new (refresh_xpm);
gtk_container_add (GTK_CONTAINER (view->refresh_button), pixmap);
gtk_widget_show (pixmap);
gtk_widget_set_sensitive (view->edit_button, FALSE);
gtk_widget_set_sensitive (view->duplicate_button, FALSE);
gtk_widget_set_sensitive (view->new_button, FALSE);
}
static void
@ -210,12 +219,13 @@ gimp_data_factory_view_destroy (GtkObject *object)
}
GtkWidget *
gimp_data_factory_view_new (GimpViewType view_type,
GimpDataFactory *factory,
GimpContext *context,
gint preview_size,
gint min_items_x,
gint min_items_y)
gimp_data_factory_view_new (GimpViewType view_type,
GimpDataFactory *factory,
GimpDataEditFunc edit_func,
GimpContext *context,
gint preview_size,
gint min_items_x,
gint min_items_y)
{
GimpDataFactoryView *factory_view;
@ -227,7 +237,8 @@ gimp_data_factory_view_new (GimpViewType view_type,
factory_view = gtk_type_new (GIMP_TYPE_DATA_FACTORY_VIEW);
factory_view->factory = factory;
factory_view->factory = factory;
factory_view->data_edit_func = edit_func;
switch (view_type)
{
@ -259,6 +270,13 @@ gimp_data_factory_view_new (GimpViewType view_type,
GTK_WIDGET (factory_view->view));
gtk_widget_show (GTK_WIDGET (factory_view->view));
gtk_signal_connect_while_alive
(GTK_OBJECT (context),
gimp_context_type_to_signal_name (factory->container->children_type),
GTK_SIGNAL_FUNC (gimp_data_factory_view_data_changed),
factory_view,
GTK_OBJECT (factory_view));
return GTK_WIDGET (factory_view);
}
@ -266,8 +284,21 @@ static void
gimp_data_factory_view_new_clicked (GtkWidget *widget,
GimpDataFactoryView *view)
{
g_print ("new %s\n",
gimp_object_get_name (gimp_context_get_by_type (view->view->context, view->factory->container->children_type)));
if (view->factory->data_new_func)
{
GimpData *data;
data = gimp_data_factory_data_new (view->factory, _("Untitled"));
if (data)
{
gimp_context_set_by_type (view->view->context,
view->factory->container->children_type,
GIMP_OBJECT (data));
gimp_data_factory_view_edit_clicked (NULL, view);
}
}
}
static void
@ -281,19 +312,66 @@ static void
gimp_data_factory_view_edit_clicked (GtkWidget *widget,
GimpDataFactoryView *view)
{
g_print ("edit %s\n", gimp_object_get_name (gimp_context_get_by_type (view->view->context, view->factory->container->children_type)));
GimpData *data;
data = (GimpData *)
gimp_context_get_by_type (view->view->context,
view->factory->container->children_type);
if (view->data_edit_func &&
data &&
gimp_container_have (view->factory->container,
GIMP_OBJECT (data)))
{
view->data_edit_func (data);
}
}
static void
gimp_data_factory_view_delete_clicked (GtkWidget *widget,
GimpDataFactoryView *view)
{
g_print ("delete %s\n", gimp_object_get_name (gimp_context_get_by_type (view->view->context, view->factory->container->children_type)));
GimpData *data;
data = (GimpData *)
gimp_context_get_by_type (view->view->context,
view->factory->container->children_type);
if (data && gimp_container_have (view->factory->container,
GIMP_OBJECT (data)))
{
if (data->filename)
gimp_data_delete_from_disk (data);
gimp_container_remove (view->factory->container, GIMP_OBJECT (data));
}
}
static void
gimp_data_factory_view_refresh_clicked (GtkWidget *widget,
GimpDataFactoryView *view)
{
g_print ("refresh\n");
gimp_data_factory_data_init (view->factory, FALSE);
}
static void
gimp_data_factory_view_data_changed (GimpContext *context,
GimpData *data,
GimpDataFactoryView *view)
{
gboolean duplicate_sensitive = FALSE;
gboolean edit_sensitive = FALSE;
gboolean delete_sensitive = FALSE;
if (data && gimp_container_have (view->factory->container,
GIMP_OBJECT (data)))
{
duplicate_sensitive = FALSE; /* TODO: GimpData's "duplicate" method */
edit_sensitive = (view->data_edit_func != NULL);
delete_sensitive = TRUE; /* TODO: check permissions */
}
gtk_widget_set_sensitive (view->duplicate_button, duplicate_sensitive);
gtk_widget_set_sensitive (view->edit_button, edit_sensitive);
gtk_widget_set_sensitive (view->delete_button, delete_sensitive);
}

View File

@ -23,6 +23,9 @@
#include <gtk/gtkvbox.h>
typedef void (* GimpDataEditFunc) (GimpData *data);
typedef enum
{
GIMP_VIEW_TYPE_GRID,
@ -37,7 +40,6 @@ typedef enum
#define GIMP_IS_DATA_FACTORY_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_DATA_FACTORY_VIEW))
typedef struct _GimpDataFactoryView GimpDataFactoryView;
typedef struct _GimpDataFactoryViewClass GimpDataFactoryViewClass;
struct _GimpDataFactoryView
@ -45,6 +47,8 @@ struct _GimpDataFactoryView
GtkVBox parent_instance;
GimpDataFactory *factory;
GimpDataEditFunc data_edit_func;
GimpContainerView *view;
GtkWidget *button_box;
@ -64,12 +68,13 @@ struct _GimpDataFactoryViewClass
GtkType gimp_data_factory_view_get_type (void);
GtkWidget * gimp_data_factory_view_new (GimpViewType view_type,
GimpDataFactory *factory,
GimpContext *context,
gint preview_size,
gint min_items_x,
gint min_items_y);
GtkWidget * gimp_data_factory_view_new (GimpViewType view_type,
GimpDataFactory *factory,
GimpDataEditFunc edit_func,
GimpContext *context,
gint preview_size,
gint min_items_x,
gint min_items_y);
#endif /* __GIMP_DATA_FACTORY_VIEW_H__ */

View File

@ -33,7 +33,6 @@
#include "gimpimage.h"
#include "gimpgradient.h"
#include "gimprc.h"
#include "gradients.h"
#include "temp_buf.h"
#include "libgimp/gimplimits.h"

View File

@ -109,7 +109,6 @@
#include "gimplist.h"
#include "gimplayer.h"
#include "gimppalette.h"
#include "palettes.h"
#include "palette_select.h"
#include "pixel_region.h"
#include "tile_manager.h"

View File

@ -45,7 +45,6 @@
#include "gimpimage.h"
#include "gimppattern.h"
#include "gimprc.h"
#include "patterns.h"
#include "pattern_header.h"
#include "temp_buf.h"

View File

@ -77,7 +77,6 @@
#include "gimplist.h"
#include "gimprc.h"
#include "gradient_editor.h"
#include "gradients.h"
#include "libgimp/gimpenv.h"
#include "libgimp/gimplimits.h"
@ -237,6 +236,8 @@ typedef struct
/***** Local functions *****/
static void gradient_editor_create (void);
static void gradient_editor_drop_gradient (GtkWidget *widget,
GimpViewable *viewable,
gpointer data);
@ -530,9 +531,35 @@ static void seg_get_closest_handle (GimpGradient *grad,
static GradientEditor *g_editor = NULL;
/***** Public gradient editor functions *****/
void
gradient_editor_set_gradient (GimpGradient *gradient)
{
if (! g_editor)
gradient_editor_create ();
if (gimp_container_have (global_gradient_factory->container,
GIMP_OBJECT (gradient)))
{
gimp_context_set_gradient (g_editor->context, gradient);
}
if (! GTK_WIDGET_VISIBLE (g_editor->shell))
gtk_widget_show (g_editor->shell);
else
gdk_window_raise (g_editor->shell->window);
}
void
gradient_editor_free (void)
{
}
/***** The main gradient editor dialog *****/
void
static void
gradient_editor_create (void)
{
GtkWidget *vbox;
@ -544,14 +571,7 @@ gradient_editor_create (void)
/* If the editor already exists, just show it */
if (g_editor)
{
if (! GTK_WIDGET_VISIBLE (g_editor->shell))
gtk_widget_show (g_editor->shell);
else
gdk_window_raise (g_editor->shell->window);
return;
}
return;
g_editor = g_new (GradientEditor, 1);
@ -855,24 +875,6 @@ gradient_editor_create (void)
gtk_widget_show (g_editor->shell);
}
void
gradient_editor_free (void)
{
}
void
gradient_editor_set_gradient (GimpGradient *gradient)
{
if (gimp_container_have (global_gradient_factory->container,
GIMP_OBJECT (gradient)) &&
g_editor)
{
gimp_context_set_gradient (g_editor->context, gradient);
}
}
/***** Gradient editor functions *****/
static void
gradient_editor_drop_gradient (GtkWidget *widget,
GimpViewable *viewable,
@ -886,7 +888,7 @@ gradient_editor_gradient_changed (GimpContext *context,
GimpGradient *gradient,
gpointer data)
{
preview_update (TRUE);
ed_update_editor (GRAD_UPDATE_PREVIEW | GRAD_RESET_CONTROL);
}
/*****/
@ -913,8 +915,6 @@ ed_update_editor (int flags)
control_update (gradient, TRUE);
}
/*****/
static GtkWidget *
ed_create_button (gchar *label,
gchar *help_data,
@ -944,8 +944,6 @@ ed_set_hint (gchar *str)
gtk_label_set_text (GTK_LABEL (g_editor->hint_label), str);
}
/*****/
static void
ed_initialize_saved_colors (void)
{
@ -1375,7 +1373,7 @@ static void
ed_refresh_grads_callback (GtkWidget *widget,
gpointer data)
{
gradients_init (FALSE);
gimp_data_factory_data_init (global_gradient_factory, FALSE);
if (! gimp_container_num_children (global_gradient_factory->container))
{

View File

@ -23,10 +23,8 @@
#define __GRADIENT_EDITOR_H__
void gradient_editor_create (void);
void gradient_editor_free (void);
void gradient_editor_set_gradient (GimpGradient *gradient);
void gradient_editor_free (void);
#endif /* __GRADIENT_EDITOR_H__ */

View File

@ -37,7 +37,6 @@
#include "gimpdnd.h"
#include "gimpgradient.h"
#include "gradient_editor.h"
#include "gradients.h"
#include "gradient_select.h"
#include "session.h"
@ -141,7 +140,7 @@ gradient_select_new (gchar *title,
}
if (no_data && first_call)
gradients_init (FALSE);
gimp_data_factory_data_init (global_gradient_factory, FALSE);
first_call = FALSE;
@ -349,8 +348,6 @@ gradient_select_edit_callback (GtkWidget *widget,
gsp = (GradientSelect *) data;
gradient_editor_create ();
gradient_editor_set_gradient (gimp_context_get_gradient (gsp->context));
}

View File

@ -1,61 +0,0 @@
/* 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 PURIGHTE. 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 "apptypes.h"
#include "context_manager.h"
#include "gimpdatafactory.h"
#include "gimpdatalist.h"
#include "gimpgradient.h"
#include "gimprc.h"
#include "gradients.h"
/* public functions */
void
gradients_init (gint no_data)
{
gradients_free ();
if (gradient_path != NULL && !no_data)
{
gimp_data_list_load (GIMP_DATA_LIST (global_gradient_factory->container),
gradient_path,
(GimpDataObjectLoaderFunc) gimp_gradient_load,
GIMP_GRADIENT_FILE_EXTENSION,
(GimpDataObjectLoaderFunc) gimp_gradient_load,
NULL /* legacy loader */);
}
}
void
gradients_free (void)
{
if (gimp_container_num_children (global_gradient_factory->container) == 0)
return;
gimp_data_list_save_and_clear (GIMP_DATA_LIST (global_gradient_factory->container),
gradient_path);
}

View File

@ -1,27 +0,0 @@
/* 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.
*/
#ifndef __GRADIENTS_H__
#define __GRADIENTS_H__
void gradients_init (gboolean no_data);
void gradients_free (void);
#endif /* __GRADIENTS_H__ */

View File

@ -43,9 +43,11 @@ struct _BrushEditGeneratedWindow
gint scale;
};
BrushEditGeneratedWindow * brush_edit_generated_new (void);
void brush_edit_generated_set_brush (BrushEditGeneratedWindow *begw,
GimpBrush *brush);
#endif /* __BRUSH_EDIT_H__ */

View File

@ -30,7 +30,6 @@
#include "context_manager.h"
#include "brush_edit.h"
#include "brush_select.h"
#include "brushes.h"
#include "dialog_handler.h"
#include "gimpbrushgenerated.h"
#include "gimpcontainer.h"
@ -199,7 +198,7 @@ brush_select_new (gchar *title,
}
if (no_data && first_call)
brushes_init (FALSE);
gimp_data_factory_data_init (global_brush_factory, FALSE);
first_call = FALSE;
@ -745,8 +744,7 @@ static void
brush_select_refresh_callback (GtkWidget *widget,
gpointer data)
{
/* re-init the brush list */
brushes_init (FALSE);
gimp_data_factory_data_init (global_brush_factory, FALSE);
}
static void

View File

@ -77,10 +77,7 @@
/* for the example dialogs */
#include "brushes.h"
#include "gradients.h"
#include "palettes.h"
#include "patterns.h"
#include "gradient_editor.h"
#include "gimpcontainer.h"
#include "gimpcontainerlistview.h"
#include "gimpcontainergridview.h"
@ -1509,11 +1506,12 @@ container_view_new (gboolean list,
}
static void
data_factory_view_new (GimpViewType view_type,
gchar *title,
GimpDataFactory *factory,
GimpContext *context,
gint preview_size)
data_factory_view_new (GimpViewType view_type,
gchar *title,
GimpDataFactory *factory,
GimpDataEditFunc edit_func,
GimpContext *context,
gint preview_size)
{
GtkWidget *dialog;
GtkWidget *view;
@ -1535,6 +1533,7 @@ data_factory_view_new (GimpViewType view_type,
view = gimp_data_factory_view_new (view_type,
factory,
edit_func,
context,
preview_size,
5, 5);
@ -1746,6 +1745,7 @@ dialogs_test_brush_container_list_view_cmd_callback (GtkWidget *widget,
data_factory_view_new (GIMP_VIEW_TYPE_LIST,
"Brush List",
global_brush_factory,
NULL,
gimp_context_get_user (),
24);
}
@ -1757,6 +1757,7 @@ dialogs_test_pattern_container_list_view_cmd_callback (GtkWidget *widget,
data_factory_view_new (GIMP_VIEW_TYPE_LIST,
"Pattern List",
global_pattern_factory,
NULL,
gimp_context_get_user (),
24);
}
@ -1768,6 +1769,7 @@ dialogs_test_gradient_container_list_view_cmd_callback (GtkWidget *widget,
data_factory_view_new (GIMP_VIEW_TYPE_LIST,
"Gradient List",
global_gradient_factory,
gradient_editor_set_gradient,
gimp_context_get_user (),
24);
}
@ -1779,6 +1781,7 @@ dialogs_test_palette_container_list_view_cmd_callback (GtkWidget *widget,
data_factory_view_new (GIMP_VIEW_TYPE_LIST,
"Palette List",
global_palette_factory,
NULL,
gimp_context_get_user (),
24);
}
@ -1790,6 +1793,7 @@ dialogs_test_brush_container_grid_view_cmd_callback (GtkWidget *widget,
data_factory_view_new (GIMP_VIEW_TYPE_GRID,
"Brush Grid",
global_brush_factory,
NULL,
gimp_context_get_user (),
32);
}
@ -1801,6 +1805,7 @@ dialogs_test_pattern_container_grid_view_cmd_callback (GtkWidget *widget,
data_factory_view_new (GIMP_VIEW_TYPE_GRID,
"Pattern Grid",
global_pattern_factory,
NULL,
gimp_context_get_user (),
24);
}
@ -1812,17 +1817,19 @@ dialogs_test_gradient_container_grid_view_cmd_callback (GtkWidget *widget,
data_factory_view_new (GIMP_VIEW_TYPE_GRID,
"Gradient Grid",
global_gradient_factory,
gradient_editor_set_gradient,
gimp_context_get_user (),
24);
}
void
dialogs_test_palette_container_grid_view_cmd_callback (GtkWidget *widget,
gpointer client_data)
gpointer client_data)
{
data_factory_view_new (GIMP_VIEW_TYPE_GRID,
"Palette Grid",
global_palette_factory,
NULL,
gimp_context_get_user (),
24);
}

View File

@ -30,7 +30,6 @@
#include "appenv.h"
#include "context_manager.h"
#include "brushes.h"
#include "devices.h"
#include "dialog_handler.h"
#include "gimpbrush.h"
@ -42,8 +41,6 @@
#include "gimppreview.h"
#include "gimplist.h"
#include "gimprc.h"
#include "gradients.h"
#include "patterns.h"
#include "session.h"
#include "tools/tools.h"

View File

@ -77,7 +77,6 @@
#include "gimplist.h"
#include "gimprc.h"
#include "gradient_editor.h"
#include "gradients.h"
#include "libgimp/gimpenv.h"
#include "libgimp/gimplimits.h"
@ -237,6 +236,8 @@ typedef struct
/***** Local functions *****/
static void gradient_editor_create (void);
static void gradient_editor_drop_gradient (GtkWidget *widget,
GimpViewable *viewable,
gpointer data);
@ -530,9 +531,35 @@ static void seg_get_closest_handle (GimpGradient *grad,
static GradientEditor *g_editor = NULL;
/***** Public gradient editor functions *****/
void
gradient_editor_set_gradient (GimpGradient *gradient)
{
if (! g_editor)
gradient_editor_create ();
if (gimp_container_have (global_gradient_factory->container,
GIMP_OBJECT (gradient)))
{
gimp_context_set_gradient (g_editor->context, gradient);
}
if (! GTK_WIDGET_VISIBLE (g_editor->shell))
gtk_widget_show (g_editor->shell);
else
gdk_window_raise (g_editor->shell->window);
}
void
gradient_editor_free (void)
{
}
/***** The main gradient editor dialog *****/
void
static void
gradient_editor_create (void)
{
GtkWidget *vbox;
@ -544,14 +571,7 @@ gradient_editor_create (void)
/* If the editor already exists, just show it */
if (g_editor)
{
if (! GTK_WIDGET_VISIBLE (g_editor->shell))
gtk_widget_show (g_editor->shell);
else
gdk_window_raise (g_editor->shell->window);
return;
}
return;
g_editor = g_new (GradientEditor, 1);
@ -855,24 +875,6 @@ gradient_editor_create (void)
gtk_widget_show (g_editor->shell);
}
void
gradient_editor_free (void)
{
}
void
gradient_editor_set_gradient (GimpGradient *gradient)
{
if (gimp_container_have (global_gradient_factory->container,
GIMP_OBJECT (gradient)) &&
g_editor)
{
gimp_context_set_gradient (g_editor->context, gradient);
}
}
/***** Gradient editor functions *****/
static void
gradient_editor_drop_gradient (GtkWidget *widget,
GimpViewable *viewable,
@ -886,7 +888,7 @@ gradient_editor_gradient_changed (GimpContext *context,
GimpGradient *gradient,
gpointer data)
{
preview_update (TRUE);
ed_update_editor (GRAD_UPDATE_PREVIEW | GRAD_RESET_CONTROL);
}
/*****/
@ -913,8 +915,6 @@ ed_update_editor (int flags)
control_update (gradient, TRUE);
}
/*****/
static GtkWidget *
ed_create_button (gchar *label,
gchar *help_data,
@ -944,8 +944,6 @@ ed_set_hint (gchar *str)
gtk_label_set_text (GTK_LABEL (g_editor->hint_label), str);
}
/*****/
static void
ed_initialize_saved_colors (void)
{
@ -1375,7 +1373,7 @@ static void
ed_refresh_grads_callback (GtkWidget *widget,
gpointer data)
{
gradients_init (FALSE);
gimp_data_factory_data_init (global_gradient_factory, FALSE);
if (! gimp_container_num_children (global_gradient_factory->container))
{

View File

@ -23,10 +23,8 @@
#define __GRADIENT_EDITOR_H__
void gradient_editor_create (void);
void gradient_editor_free (void);
void gradient_editor_set_gradient (GimpGradient *gradient);
void gradient_editor_free (void);
#endif /* __GRADIENT_EDITOR_H__ */

View File

@ -37,7 +37,6 @@
#include "gimpdnd.h"
#include "gimpgradient.h"
#include "gradient_editor.h"
#include "gradients.h"
#include "gradient_select.h"
#include "session.h"
@ -141,7 +140,7 @@ gradient_select_new (gchar *title,
}
if (no_data && first_call)
gradients_init (FALSE);
gimp_data_factory_data_init (global_gradient_factory, FALSE);
first_call = FALSE;
@ -349,8 +348,6 @@ gradient_select_edit_callback (GtkWidget *widget,
gsp = (GradientSelect *) data;
gradient_editor_create ();
gradient_editor_set_gradient (gimp_context_get_gradient (gsp->context));
}

View File

@ -77,10 +77,7 @@
/* for the example dialogs */
#include "brushes.h"
#include "gradients.h"
#include "palettes.h"
#include "patterns.h"
#include "gradient_editor.h"
#include "gimpcontainer.h"
#include "gimpcontainerlistview.h"
#include "gimpcontainergridview.h"
@ -1509,11 +1506,12 @@ container_view_new (gboolean list,
}
static void
data_factory_view_new (GimpViewType view_type,
gchar *title,
GimpDataFactory *factory,
GimpContext *context,
gint preview_size)
data_factory_view_new (GimpViewType view_type,
gchar *title,
GimpDataFactory *factory,
GimpDataEditFunc edit_func,
GimpContext *context,
gint preview_size)
{
GtkWidget *dialog;
GtkWidget *view;
@ -1535,6 +1533,7 @@ data_factory_view_new (GimpViewType view_type,
view = gimp_data_factory_view_new (view_type,
factory,
edit_func,
context,
preview_size,
5, 5);
@ -1746,6 +1745,7 @@ dialogs_test_brush_container_list_view_cmd_callback (GtkWidget *widget,
data_factory_view_new (GIMP_VIEW_TYPE_LIST,
"Brush List",
global_brush_factory,
NULL,
gimp_context_get_user (),
24);
}
@ -1757,6 +1757,7 @@ dialogs_test_pattern_container_list_view_cmd_callback (GtkWidget *widget,
data_factory_view_new (GIMP_VIEW_TYPE_LIST,
"Pattern List",
global_pattern_factory,
NULL,
gimp_context_get_user (),
24);
}
@ -1768,6 +1769,7 @@ dialogs_test_gradient_container_list_view_cmd_callback (GtkWidget *widget,
data_factory_view_new (GIMP_VIEW_TYPE_LIST,
"Gradient List",
global_gradient_factory,
gradient_editor_set_gradient,
gimp_context_get_user (),
24);
}
@ -1779,6 +1781,7 @@ dialogs_test_palette_container_list_view_cmd_callback (GtkWidget *widget,
data_factory_view_new (GIMP_VIEW_TYPE_LIST,
"Palette List",
global_palette_factory,
NULL,
gimp_context_get_user (),
24);
}
@ -1790,6 +1793,7 @@ dialogs_test_brush_container_grid_view_cmd_callback (GtkWidget *widget,
data_factory_view_new (GIMP_VIEW_TYPE_GRID,
"Brush Grid",
global_brush_factory,
NULL,
gimp_context_get_user (),
32);
}
@ -1801,6 +1805,7 @@ dialogs_test_pattern_container_grid_view_cmd_callback (GtkWidget *widget,
data_factory_view_new (GIMP_VIEW_TYPE_GRID,
"Pattern Grid",
global_pattern_factory,
NULL,
gimp_context_get_user (),
24);
}
@ -1812,17 +1817,19 @@ dialogs_test_gradient_container_grid_view_cmd_callback (GtkWidget *widget,
data_factory_view_new (GIMP_VIEW_TYPE_GRID,
"Gradient Grid",
global_gradient_factory,
gradient_editor_set_gradient,
gimp_context_get_user (),
24);
}
void
dialogs_test_palette_container_grid_view_cmd_callback (GtkWidget *widget,
gpointer client_data)
gpointer client_data)
{
data_factory_view_new (GIMP_VIEW_TYPE_GRID,
"Palette Grid",
global_palette_factory,
NULL,
gimp_context_get_user (),
24);
}

View File

@ -30,7 +30,6 @@
#include "appenv.h"
#include "context_manager.h"
#include "brushes.h"
#include "devices.h"
#include "dialog_handler.h"
#include "gimpbrush.h"
@ -42,8 +41,6 @@
#include "gimppreview.h"
#include "gimplist.h"
#include "gimprc.h"
#include "gradients.h"
#include "patterns.h"
#include "session.h"
#include "tools/tools.h"

View File

@ -39,7 +39,6 @@
#include "palette.h"
#include "palette_import.h"
#include "palette_select.h"
#include "palettes.h"
#include "paletteP.h"
#include "session.h"
@ -415,7 +414,7 @@ palette_refresh_all (void)
default_palette_entries = NULL;
palettes_init (FALSE);
gimp_data_factory_data_init (global_palette_factory, FALSE);
if ((palette_dialog = top_level_palette))
{

View File

@ -35,7 +35,6 @@
#include "gimpdatafactory.h"
#include "gimpdnd.h"
#include "gimppattern.h"
#include "patterns.h"
#include "pattern_select.h"
#include "session.h"
#include "temp_buf.h"
@ -155,7 +154,7 @@ pattern_select_new (gchar *title,
}
if (no_data && first_call)
patterns_init (FALSE);
gimp_data_factory_data_init (global_pattern_factory, FALSE);
first_call = FALSE;
@ -432,5 +431,5 @@ static void
pattern_select_refresh_callback (GtkWidget *widget,
gpointer data)
{
patterns_init (FALSE);
gimp_data_factory_data_init (global_pattern_factory, FALSE);
}

View File

@ -39,7 +39,6 @@
#include "palette.h"
#include "palette_import.h"
#include "palette_select.h"
#include "palettes.h"
#include "paletteP.h"
#include "session.h"
@ -415,7 +414,7 @@ palette_refresh_all (void)
default_palette_entries = NULL;
palettes_init (FALSE);
gimp_data_factory_data_init (global_palette_factory, FALSE);
if ((palette_dialog = top_level_palette))
{

View File

@ -1,62 +0,0 @@
/* 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 "apptypes.h"
#include "context_manager.h"
#include "gimpdatafactory.h"
#include "gimpdatalist.h"
#include "gimppalette.h"
#include "gimprc.h"
#include "palette.h"
#include "palettes.h"
/* public functions */
void
palettes_init (gboolean no_data)
{
palettes_free ();
if (palette_path != NULL && !no_data)
{
gimp_data_list_load (GIMP_DATA_LIST (global_palette_factory->container),
palette_path,
(GimpDataObjectLoaderFunc) gimp_palette_load,
GIMP_PALETTE_FILE_EXTENSION,
(GimpDataObjectLoaderFunc) gimp_palette_load,
NULL /* legacy loader */);
}
}
void
palettes_free (void)
{
if (gimp_container_num_children (global_palette_factory->container) == 0)
return;
gimp_data_list_save_and_clear (GIMP_DATA_LIST (global_palette_factory->container),
palette_path);
}

View File

@ -1,27 +0,0 @@
/* 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.
*/
#ifndef __PALETTES_H__
#define __PALETTES_H__
void palettes_init (gboolean no_data);
void palettes_free (void);
#endif /* __PALETTES_H__ */

View File

@ -35,7 +35,6 @@
#include "gimpdatafactory.h"
#include "gimpdnd.h"
#include "gimppattern.h"
#include "patterns.h"
#include "pattern_select.h"
#include "session.h"
#include "temp_buf.h"
@ -155,7 +154,7 @@ pattern_select_new (gchar *title,
}
if (no_data && first_call)
patterns_init (FALSE);
gimp_data_factory_data_init (global_pattern_factory, FALSE);
first_call = FALSE;
@ -432,5 +431,5 @@ static void
pattern_select_refresh_callback (GtkWidget *widget,
gpointer data)
{
patterns_init (FALSE);
gimp_data_factory_data_init (global_pattern_factory, FALSE);
}

View File

@ -1,61 +0,0 @@
/* 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 "apptypes.h"
#include "context_manager.h"
#include "gimpdatafactory.h"
#include "gimpdatalist.h"
#include "gimppattern.h"
#include "gimprc.h"
#include "patterns.h"
#include "temp_buf.h"
/* public functions */
void
patterns_init (gboolean no_data)
{
patterns_free ();
if (pattern_path != NULL && !no_data)
{
gimp_data_list_load (GIMP_DATA_LIST (global_pattern_factory->container),
pattern_path,
(GimpDataObjectLoaderFunc) gimp_pattern_load,
GIMP_PATTERN_FILE_EXTENSION,
NULL);
}
}
void
patterns_free (void)
{
if (gimp_container_num_children (global_pattern_factory->container) == 0)
return;
gimp_data_list_save_and_clear (GIMP_DATA_LIST (global_pattern_factory->container),
pattern_path);
}

View File

@ -1,27 +0,0 @@
/* 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.
*/
#ifndef __PATTERNS_H__
#define __PATTERNS_H__
void patterns_init (gboolean no_data);
void patterns_free (void);
#endif /* __PATTERNS_H__ */

View File

@ -28,7 +28,6 @@
#include "procedural_db.h"
#include "brush_select.h"
#include "brushes.h"
#include "context_manager.h"
#include "gimpbrush.h"
#include "gimpcontext.h"

View File

@ -27,7 +27,6 @@
#include "apptypes.h"
#include "procedural_db.h"
#include "brushes.h"
#include "context_manager.h"
#include "gimpbrush.h"
#include "gimpcontext.h"
@ -74,7 +73,7 @@ brushes_refresh_invoker (Argument *args)
* <sjburges@gimp.org>
*/
brushes_init (FALSE);
gimp_data_factory_data_init (global_brush_factory, FALSE);
return procedural_db_return_args (&brushes_refresh_proc, TRUE);
}

View File

@ -34,7 +34,6 @@
#include "gimpimage.h"
#include "gimppalette.h"
#include "palette.h"
#include "palettes.h"
static ProcRecord convert_rgb_proc;
static ProcRecord convert_grayscale_proc;
@ -196,7 +195,7 @@ convert_indexed_invoker (Argument *args)
case CUSTOM_PALETTE:
if (! global_palette_factory->container->num_children)
palettes_init (FALSE);
gimp_data_factory_data_init (global_palette_factory, FALSE);
palette = (GimpPalette *)
gimp_container_get_child_by_name (global_palette_factory->container,

View File

@ -33,7 +33,6 @@
#include "gimpdatafactory.h"
#include "gimpgradient.h"
#include "gradient_select.h"
#include "gradients.h"
static ProcRecord gradients_popup_proc;
static ProcRecord gradients_close_popup_proc;

View File

@ -32,7 +32,6 @@
#include "gimpdatafactory.h"
#include "gimpgradient.h"
#include "gimplist.h"
#include "gradients.h"
static ProcRecord gradients_get_list_proc;
static ProcRecord gradients_get_active_proc;

View File

@ -26,9 +26,10 @@
#include "apptypes.h"
#include "procedural_db.h"
#include "context_manager.h"
#include "gimpcontext.h"
#include "gimpdatafactory.h"
#include "gimpimage.h"
#include "palettes.h"
#include "libgimpcolor/gimpcolor.h"
@ -264,8 +265,7 @@ palette_refresh_invoker (Argument *args)
* -and shamelessly stolen by Adrian Likins for use here...
*/
palettes_free ();
palettes_init (FALSE);
gimp_data_factory_data_init (global_palette_factory, FALSE);
return procedural_db_return_args (&palette_refresh_proc, TRUE);
}

View File

@ -33,7 +33,6 @@
#include "gimplist.h"
#include "gimppattern.h"
#include "pattern_select.h"
#include "patterns.h"
static ProcRecord patterns_popup_proc;
static ProcRecord patterns_close_popup_proc;

View File

@ -32,7 +32,6 @@
#include "gimpdatafactory.h"
#include "gimplist.h"
#include "gimppattern.h"
#include "patterns.h"
#include "temp_buf.h"
static ProcRecord patterns_get_pattern_proc;

View File

@ -43,9 +43,11 @@ struct _BrushEditGeneratedWindow
gint scale;
};
BrushEditGeneratedWindow * brush_edit_generated_new (void);
void brush_edit_generated_set_brush (BrushEditGeneratedWindow *begw,
GimpBrush *brush);
#endif /* __BRUSH_EDIT_H__ */

View File

@ -30,7 +30,6 @@
#define GIMP_IS_CONTAINER_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_CONTAINER_VIEW))
typedef struct _GimpContainerView GimpContainerView;
typedef struct _GimpContainerViewClass GimpContainerViewClass;
struct _GimpContainerView

View File

@ -26,6 +26,7 @@
#include "gimpcontainer.h"
#include "gimpcontainerview.h"
#include "gimpdata.h"
#include "gimpdatafactory.h"
#include "gimpdatafactoryview.h"
#include "gimpcontainergridview.h"
@ -58,6 +59,10 @@ static void gimp_data_factory_view_delete_clicked (GtkWidget *wid
static void gimp_data_factory_view_refresh_clicked (GtkWidget *widget,
GimpDataFactoryView *view);
static void gimp_data_factory_view_data_changed (GimpContext *context,
GimpData *data,
GimpDataFactoryView *view);
static GtkVBoxClass *parent_class = NULL;
@ -196,6 +201,10 @@ gimp_data_factory_view_init (GimpDataFactoryView *view)
pixmap = gimp_pixmap_new (refresh_xpm);
gtk_container_add (GTK_CONTAINER (view->refresh_button), pixmap);
gtk_widget_show (pixmap);
gtk_widget_set_sensitive (view->edit_button, FALSE);
gtk_widget_set_sensitive (view->duplicate_button, FALSE);
gtk_widget_set_sensitive (view->new_button, FALSE);
}
static void
@ -210,12 +219,13 @@ gimp_data_factory_view_destroy (GtkObject *object)
}
GtkWidget *
gimp_data_factory_view_new (GimpViewType view_type,
GimpDataFactory *factory,
GimpContext *context,
gint preview_size,
gint min_items_x,
gint min_items_y)
gimp_data_factory_view_new (GimpViewType view_type,
GimpDataFactory *factory,
GimpDataEditFunc edit_func,
GimpContext *context,
gint preview_size,
gint min_items_x,
gint min_items_y)
{
GimpDataFactoryView *factory_view;
@ -227,7 +237,8 @@ gimp_data_factory_view_new (GimpViewType view_type,
factory_view = gtk_type_new (GIMP_TYPE_DATA_FACTORY_VIEW);
factory_view->factory = factory;
factory_view->factory = factory;
factory_view->data_edit_func = edit_func;
switch (view_type)
{
@ -259,6 +270,13 @@ gimp_data_factory_view_new (GimpViewType view_type,
GTK_WIDGET (factory_view->view));
gtk_widget_show (GTK_WIDGET (factory_view->view));
gtk_signal_connect_while_alive
(GTK_OBJECT (context),
gimp_context_type_to_signal_name (factory->container->children_type),
GTK_SIGNAL_FUNC (gimp_data_factory_view_data_changed),
factory_view,
GTK_OBJECT (factory_view));
return GTK_WIDGET (factory_view);
}
@ -266,8 +284,21 @@ static void
gimp_data_factory_view_new_clicked (GtkWidget *widget,
GimpDataFactoryView *view)
{
g_print ("new %s\n",
gimp_object_get_name (gimp_context_get_by_type (view->view->context, view->factory->container->children_type)));
if (view->factory->data_new_func)
{
GimpData *data;
data = gimp_data_factory_data_new (view->factory, _("Untitled"));
if (data)
{
gimp_context_set_by_type (view->view->context,
view->factory->container->children_type,
GIMP_OBJECT (data));
gimp_data_factory_view_edit_clicked (NULL, view);
}
}
}
static void
@ -281,19 +312,66 @@ static void
gimp_data_factory_view_edit_clicked (GtkWidget *widget,
GimpDataFactoryView *view)
{
g_print ("edit %s\n", gimp_object_get_name (gimp_context_get_by_type (view->view->context, view->factory->container->children_type)));
GimpData *data;
data = (GimpData *)
gimp_context_get_by_type (view->view->context,
view->factory->container->children_type);
if (view->data_edit_func &&
data &&
gimp_container_have (view->factory->container,
GIMP_OBJECT (data)))
{
view->data_edit_func (data);
}
}
static void
gimp_data_factory_view_delete_clicked (GtkWidget *widget,
GimpDataFactoryView *view)
{
g_print ("delete %s\n", gimp_object_get_name (gimp_context_get_by_type (view->view->context, view->factory->container->children_type)));
GimpData *data;
data = (GimpData *)
gimp_context_get_by_type (view->view->context,
view->factory->container->children_type);
if (data && gimp_container_have (view->factory->container,
GIMP_OBJECT (data)))
{
if (data->filename)
gimp_data_delete_from_disk (data);
gimp_container_remove (view->factory->container, GIMP_OBJECT (data));
}
}
static void
gimp_data_factory_view_refresh_clicked (GtkWidget *widget,
GimpDataFactoryView *view)
{
g_print ("refresh\n");
gimp_data_factory_data_init (view->factory, FALSE);
}
static void
gimp_data_factory_view_data_changed (GimpContext *context,
GimpData *data,
GimpDataFactoryView *view)
{
gboolean duplicate_sensitive = FALSE;
gboolean edit_sensitive = FALSE;
gboolean delete_sensitive = FALSE;
if (data && gimp_container_have (view->factory->container,
GIMP_OBJECT (data)))
{
duplicate_sensitive = FALSE; /* TODO: GimpData's "duplicate" method */
edit_sensitive = (view->data_edit_func != NULL);
delete_sensitive = TRUE; /* TODO: check permissions */
}
gtk_widget_set_sensitive (view->duplicate_button, duplicate_sensitive);
gtk_widget_set_sensitive (view->edit_button, edit_sensitive);
gtk_widget_set_sensitive (view->delete_button, delete_sensitive);
}

View File

@ -23,6 +23,9 @@
#include <gtk/gtkvbox.h>
typedef void (* GimpDataEditFunc) (GimpData *data);
typedef enum
{
GIMP_VIEW_TYPE_GRID,
@ -37,7 +40,6 @@ typedef enum
#define GIMP_IS_DATA_FACTORY_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_DATA_FACTORY_VIEW))
typedef struct _GimpDataFactoryView GimpDataFactoryView;
typedef struct _GimpDataFactoryViewClass GimpDataFactoryViewClass;
struct _GimpDataFactoryView
@ -45,6 +47,8 @@ struct _GimpDataFactoryView
GtkVBox parent_instance;
GimpDataFactory *factory;
GimpDataEditFunc data_edit_func;
GimpContainerView *view;
GtkWidget *button_box;
@ -64,12 +68,13 @@ struct _GimpDataFactoryViewClass
GtkType gimp_data_factory_view_get_type (void);
GtkWidget * gimp_data_factory_view_new (GimpViewType view_type,
GimpDataFactory *factory,
GimpContext *context,
gint preview_size,
gint min_items_x,
gint min_items_y);
GtkWidget * gimp_data_factory_view_new (GimpViewType view_type,
GimpDataFactory *factory,
GimpDataEditFunc edit_func,
GimpContext *context,
gint preview_size,
gint min_items_x,
gint min_items_y);
#endif /* __GIMP_DATA_FACTORY_VIEW_H__ */

View File

@ -30,7 +30,6 @@
#include "appenv.h"
#include "context_manager.h"
#include "brushes.h"
#include "devices.h"
#include "dialog_handler.h"
#include "gimpbrush.h"
@ -42,8 +41,6 @@
#include "gimppreview.h"
#include "gimplist.h"
#include "gimprc.h"
#include "gradients.h"
#include "patterns.h"
#include "session.h"
#include "tools/tools.h"

View File

@ -30,7 +30,6 @@
#include "appenv.h"
#include "context_manager.h"
#include "brushes.h"
#include "devices.h"
#include "dialog_handler.h"
#include "gimpbrush.h"
@ -42,8 +41,6 @@
#include "gimppreview.h"
#include "gimplist.h"
#include "gimprc.h"
#include "gradients.h"
#include "patterns.h"
#include "session.h"
#include "tools/tools.h"

View File

@ -77,7 +77,6 @@
#include "gimplist.h"
#include "gimprc.h"
#include "gradient_editor.h"
#include "gradients.h"
#include "libgimp/gimpenv.h"
#include "libgimp/gimplimits.h"
@ -237,6 +236,8 @@ typedef struct
/***** Local functions *****/
static void gradient_editor_create (void);
static void gradient_editor_drop_gradient (GtkWidget *widget,
GimpViewable *viewable,
gpointer data);
@ -530,9 +531,35 @@ static void seg_get_closest_handle (GimpGradient *grad,
static GradientEditor *g_editor = NULL;
/***** Public gradient editor functions *****/
void
gradient_editor_set_gradient (GimpGradient *gradient)
{
if (! g_editor)
gradient_editor_create ();
if (gimp_container_have (global_gradient_factory->container,
GIMP_OBJECT (gradient)))
{
gimp_context_set_gradient (g_editor->context, gradient);
}
if (! GTK_WIDGET_VISIBLE (g_editor->shell))
gtk_widget_show (g_editor->shell);
else
gdk_window_raise (g_editor->shell->window);
}
void
gradient_editor_free (void)
{
}
/***** The main gradient editor dialog *****/
void
static void
gradient_editor_create (void)
{
GtkWidget *vbox;
@ -544,14 +571,7 @@ gradient_editor_create (void)
/* If the editor already exists, just show it */
if (g_editor)
{
if (! GTK_WIDGET_VISIBLE (g_editor->shell))
gtk_widget_show (g_editor->shell);
else
gdk_window_raise (g_editor->shell->window);
return;
}
return;
g_editor = g_new (GradientEditor, 1);
@ -855,24 +875,6 @@ gradient_editor_create (void)
gtk_widget_show (g_editor->shell);
}
void
gradient_editor_free (void)
{
}
void
gradient_editor_set_gradient (GimpGradient *gradient)
{
if (gimp_container_have (global_gradient_factory->container,
GIMP_OBJECT (gradient)) &&
g_editor)
{
gimp_context_set_gradient (g_editor->context, gradient);
}
}
/***** Gradient editor functions *****/
static void
gradient_editor_drop_gradient (GtkWidget *widget,
GimpViewable *viewable,
@ -886,7 +888,7 @@ gradient_editor_gradient_changed (GimpContext *context,
GimpGradient *gradient,
gpointer data)
{
preview_update (TRUE);
ed_update_editor (GRAD_UPDATE_PREVIEW | GRAD_RESET_CONTROL);
}
/*****/
@ -913,8 +915,6 @@ ed_update_editor (int flags)
control_update (gradient, TRUE);
}
/*****/
static GtkWidget *
ed_create_button (gchar *label,
gchar *help_data,
@ -944,8 +944,6 @@ ed_set_hint (gchar *str)
gtk_label_set_text (GTK_LABEL (g_editor->hint_label), str);
}
/*****/
static void
ed_initialize_saved_colors (void)
{
@ -1375,7 +1373,7 @@ static void
ed_refresh_grads_callback (GtkWidget *widget,
gpointer data)
{
gradients_init (FALSE);
gimp_data_factory_data_init (global_gradient_factory, FALSE);
if (! gimp_container_num_children (global_gradient_factory->container))
{

View File

@ -23,10 +23,8 @@
#define __GRADIENT_EDITOR_H__
void gradient_editor_create (void);
void gradient_editor_free (void);
void gradient_editor_set_gradient (GimpGradient *gradient);
void gradient_editor_free (void);
#endif /* __GRADIENT_EDITOR_H__ */

View File

@ -39,7 +39,6 @@
#include "palette.h"
#include "palette_import.h"
#include "palette_select.h"
#include "palettes.h"
#include "paletteP.h"
#include "session.h"
@ -415,7 +414,7 @@ palette_refresh_all (void)
default_palette_entries = NULL;
palettes_init (FALSE);
gimp_data_factory_data_init (global_palette_factory, FALSE);
if ((palette_dialog = top_level_palette))
{

View File

@ -5,7 +5,6 @@ app/about_dialog.c
app/app_procs.c
app/brush_edit.c
app/brush_select.c
app/brushes.c
app/channel_ops.c
app/channels_dialog.c
app/color_area.c
@ -59,7 +58,6 @@ app/palette_import.c
app/palette_select.c
app/paths_dialog.c
app/pattern_select.c
app/patterns.c
app/plug_in.c
app/preferences_dialog.c
app/qmask.c

View File

@ -125,7 +125,7 @@ sub brushes_set_popup {
);
%invoke = (
headers => [ qw("brushes.h" "gimpbrush.h" "gimplist.h") ],
headers => [ qw("gimpbrush.h" "gimplist.h") ],
vars => [ 'ProcRecord *prec', 'BrushSelect *bsp' ],
code => <<'CODE'
{

View File

@ -84,7 +84,7 @@ HELP
* <sjburges@gimp.org>
*/
brushes_init (FALSE);
gimp_data_factory_data_init (global_brush_factory, FALSE);
}
CODE
);
@ -357,8 +357,8 @@ CODE
);
}
@headers = qw("context_manager.h" "brushes.h" "gimplist.h"
"gimpbrush.h" "gimpcontext.h" "gimpdatafactory.h" "temp_buf.h");
@headers = qw("context_manager.h" "gimplist.h" "gimpbrush.h"
"gimpcontext.h" "gimpdatafactory.h" "temp_buf.h");
@procs = qw(brushes_refresh brushes_get_brush brushes_set_brush
brushes_get_opacity brushes_set_opacity brushes_get_spacing

View File

@ -130,7 +130,7 @@ HELP
case CUSTOM_PALETTE:
if (! global_palette_factory->container->num_children)
palettes_init (FALSE);
gimp_data_factory_data_init (global_palette_factory, FALSE);
palette = (GimpPalette *)
gimp_container_get_child_by_name (global_palette_factory->container,
@ -157,7 +157,7 @@ CODE
}
@headers = qw("context_manager.h" "gimpcontainer.h" "gimpimage.h"
"gimpdatafactory.h" "gimppalette.h" "palettes.h" "convert.h");
"gimpdatafactory.h" "gimppalette.h" "convert.h");
@procs = qw(convert_rgb convert_grayscale convert_indexed);
%exports = (app => [@procs], lib => [@procs]);

View File

@ -228,7 +228,7 @@ CODE
}
@headers = qw(<string.h> "context_manager.h" "gimpcontext.h"
"gimpcontainer.h" "gimpdatafactory.h" "gradients.h"
"gimpcontainer.h" "gimpdatafactory.h"
"gimpgradient.h" "gradient_select.h");
$extra{app}->{code} = <<'CODE';

View File

@ -238,7 +238,7 @@ CODE
}
@headers = qw("context_manager.h" "gimpcontext.h" "gimpcontainer.h"
"gimpdatafactory.h" "gimplist.h" "gradients.h" "gimpgradient.h");
"gimpdatafactory.h" "gimplist.h" "gimpgradient.h");
@procs = qw(gradients_get_list gradients_get_active gradients_set_active
gradients_sample_uniform gradients_sample_custom);

View File

@ -162,14 +162,13 @@ HELP
* -and shamelessly stolen by Adrian Likins for use here...
*/
palettes_free ();
palettes_init (FALSE);
gimp_data_factory_data_init (global_palette_factory, FALSE);
}
CODE
);
}
@headers = qw("gimpcontext.h" "palettes.h");
@headers = qw("context_manager.h" "gimpcontext.h" "gimpdatafactory.h");
@procs = qw(palette_get_foreground palette_get_background
palette_set_foreground palette_set_background

View File

@ -137,9 +137,9 @@ CODE
);
}
@headers = qw(<string.h> "context_manager.h" "patterns.h"
"pattern_select.h" "gimpcontext.h" "gimpdatafactory.h"
"gimplist.h" "gimppattern.h");
@headers = qw(<string.h> "context_manager.h" "pattern_select.h"
"gimpcontext.h" "gimpdatafactory.h" "gimplist.h"
"gimppattern.h");
$extra{app}->{code} = <<'CODE';
static PatternSelect *

View File

@ -221,7 +221,7 @@ CODE
}
@headers = qw("context_manager.h" "gimpcontext.h" "gimpdatafactory.h"
"patterns.h" "gimplist.h" "gimppattern.h" "temp_buf.h");
"gimplist.h" "gimppattern.h" "temp_buf.h");
@procs = qw(patterns_get_pattern patterns_set_pattern patterns_list
patterns_get_pattern_data);