Commit a97e433b authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

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" ;-)
parent a16b4203
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
......
......@@ -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 \
......
......@@ -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"
......@@ -1512,6 +1509,7 @@ static void
data_factory_view_new (GimpViewType view_type,
gchar *title,
GimpDataFactory *factory,
GimpDataEditFunc edit_func,
GimpContext *context,
gint preview_size)
{
......@@ -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,6 +1817,7 @@ 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);
}
......@@ -1823,6 +1829,7 @@ dialogs_test_palette_container_grid_view_cmd_callback (GtkWidget *widget,
data_factory_view_new (GIMP_VIEW_TYPE_GRID,
"Palette Grid",
global_palette_factory,
NULL,
gimp_context_get_user (),
24);
}
......
......@@ -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 ();
......
......@@ -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;
......
......@@ -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__ */
......@@ -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
......
/* 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);
}
/* 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__ */
......@@ -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"
......@@ -1512,6 +1509,7 @@ static void
data_factory_view_new (GimpViewType view_type,
gchar *title,
GimpDataFactory *factory,
GimpDataEditFunc edit_func,
GimpContext *context,
gint preview_size)
{
......@@ -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,6 +1817,7 @@ 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);
}
......@@ -1823,6 +1829,7 @@ dialogs_test_palette_container_grid_view_cmd_callback (GtkWidget *widget,
data_factory_view_new (GIMP_VIEW_TYPE_GRID,
"Palette Grid",
global_palette_factory,
NULL,
gimp_context_get_user (),
24);
}
......
......@@ -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"
......@@ -147,6 +149,39 @@ context_manager_init (void)
GimpContext *user_context;
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,
GIMP_CONTAINER_POLICY_WEAK));
......@@ -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
......
......@@ -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"
......
......@@ -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"
......
......@@ -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"
......
......@@ -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);
}
}
......@