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

app/Makefile.am app/gimpunit.c removed...

2001-07-11  Michael Natterer  <mitch@gimp.org>

	* app/Makefile.am
	* app/gimpunit.c
	* app/unitrc.h: removed...

	* app/core/Makefile.am
	* app/core/gimpunit.[ch]: ...re-added here.

	* app/core/gimp.[ch]: added the image and drawable hash tables,
	next_image_ID, next_guide_ID and next_drawable_ID, added a
	GimpCoreConfig pointer which is now initalized dynamically.

	* app/core/gimpcoreconfig.[ch]: don't provide a global core_config
	variable any more (need to access gimp->config now).

	* app/gdisplay.[ch]
	* app/core/gimpdrawable.[ch]
	* app/core/gimpimage.[ch]: removed all global variables from
	gimpimage.c and gimpdrawable.c, pass a Gimp* to all *_get_by_ID()
	functions.

	* tools/pdbgen/app.pl: pass Gimp* to all _get_by_ID() functions.

	* app/app_procs.c
	* app/file-open.c
	* app/file-save.c
	* app/gimprc.c
	* app/libgimp_glue.c
	* app/module_db.c
	* app/plug_in.c
	* app/undo.c
	* app/user_install.c
	* app/core/core-types.h
	* app/core/gimpcontext.c
	* app/core/gimpimage-crop.c
	* app/core/gimpimage-new.c
	* app/core/gimpparasite.c
	* app/gui/file-new-dialog.c
	* app/gui/file-open-dialog.c
	* app/gui/info-window.c
	* app/gui/preferences-dialog.c
	* app/gui/resize-dialog.c
	* app/xcf/xcf-load.c
	* app/xcf/xcf-save.c
	* app/xcf/xcf.c
	* app/widgets/gimpdnd.c

	* app/pdb/channel_cmds.c
	* app/pdb/color_cmds.c
	* app/pdb/convert_cmds.c
	* app/pdb/display_cmds.c
	* app/pdb/drawable_cmds.c
	* app/pdb/edit_cmds.c
	* app/pdb/fileops_cmds.c
	* app/pdb/floating_sel_cmds.c
	* app/pdb/guides_cmds.c
	* app/pdb/image_cmds.c
	* app/pdb/layer_cmds.c
	* app/pdb/parasite_cmds.c
	* app/pdb/paths_cmds.c
	* app/pdb/selection_cmds.c
	* app/pdb/text_tool_cmds.c
	* app/pdb/tools_cmds.c
	* app/pdb/undo_cmds.c
	* app/pdb/unit_cmds.c

	* tools/pdbgen/pdb/image.pdb
	* tools/pdbgen/pdb/unit.pdb: changed accordingly.
parent 55b127a0
2001-07-11 Michael Natterer <mitch@gimp.org>
* app/Makefile.am
* app/gimpunit.c
* app/unitrc.h: removed...
* app/core/Makefile.am
* app/core/gimpunit.[ch]: ...re-added here.
* app/core/gimp.[ch]: added the image and drawable hash tables,
next_image_ID, next_guide_ID and next_drawable_ID, added a
GimpCoreConfig pointer which is now initalized dynamically.
* app/core/gimpcoreconfig.[ch]: don't provide a global core_config
variable any more (need to access gimp->config now).
* app/gdisplay.[ch]
* app/core/gimpdrawable.[ch]
* app/core/gimpimage.[ch]: removed all global variables from
gimpimage.c and gimpdrawable.c, pass a Gimp* to all *_get_by_ID()
functions.
* tools/pdbgen/app.pl: pass Gimp* to all _get_by_ID() functions.
* app/app_procs.c
* app/file-open.c
* app/file-save.c
* app/gimprc.c
* app/libgimp_glue.c
* app/module_db.c
* app/plug_in.c
* app/undo.c
* app/user_install.c
* app/core/core-types.h
* app/core/gimpcontext.c
* app/core/gimpimage-crop.c
* app/core/gimpimage-new.c
* app/core/gimpparasite.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.c
* app/gui/info-window.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.c
* app/xcf/xcf-load.c
* app/xcf/xcf-save.c
* app/xcf/xcf.c
* app/widgets/gimpdnd.c
* app/pdb/channel_cmds.c
* app/pdb/color_cmds.c
* app/pdb/convert_cmds.c
* app/pdb/display_cmds.c
* app/pdb/drawable_cmds.c
* app/pdb/edit_cmds.c
* app/pdb/fileops_cmds.c
* app/pdb/floating_sel_cmds.c
* app/pdb/guides_cmds.c
* app/pdb/image_cmds.c
* app/pdb/layer_cmds.c
* app/pdb/parasite_cmds.c
* app/pdb/paths_cmds.c
* app/pdb/selection_cmds.c
* app/pdb/text_tool_cmds.c
* app/pdb/tools_cmds.c
* app/pdb/undo_cmds.c
* app/pdb/unit_cmds.c
* tools/pdbgen/pdb/image.pdb
* tools/pdbgen/pdb/unit.pdb: changed accordingly.
2001-07-10 Sven Neumann <sven@gimp.org>
Bugfixes from the stable branch:
......
......@@ -81,8 +81,6 @@ gimp_SOURCES = @STRIP_BEGIN@ \
##
floating_sel.c \
floating_sel.h \
gimpunit.c \
unitrc.h \
##
## config stuff
##
......
......@@ -89,6 +89,7 @@
#include "base/tile.h"
#include "base/tile-manager.h"
#include "core/gimp.h"
#include "core/gimpcoreconfig.h"
#include "core/gimpdatafiles.h"
#include "core/gimpdrawable.h"
......@@ -323,19 +324,19 @@ plug_in_init (void)
plug_in_init_shm ();
/* search for binaries in the plug-in directory path */
gimp_datafiles_read_directories (core_config->plug_in_path, MODE_EXECUTABLE,
gimp_datafiles_read_directories (the_gimp->config->plug_in_path, MODE_EXECUTABLE,
plug_in_init_file, NULL);
/* read the pluginrc file for cached data */
filename = NULL;
if (core_config->pluginrc_path)
if (the_gimp->config->pluginrc_path)
{
if (g_path_is_absolute (core_config->pluginrc_path))
filename = g_strdup (core_config->pluginrc_path);
if (g_path_is_absolute (the_gimp->config->pluginrc_path))
filename = g_strdup (the_gimp->config->pluginrc_path);
else
filename = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s",
gimp_directory (),
core_config->pluginrc_path);
the_gimp->config->pluginrc_path);
}
else
filename = gimp_personal_rc_file ("pluginrc");
......@@ -855,7 +856,7 @@ plug_in_new (gchar *name)
if (! g_path_is_absolute (name))
{
path = plug_in_search_in_path (core_config->plug_in_path, name);
path = plug_in_search_in_path (the_gimp->config->plug_in_path, name);
if (! path)
{
......@@ -1605,9 +1606,9 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
tile_info = msg.data;
if (tile_info->shadow)
tm = gimp_drawable_shadow (gimp_drawable_get_by_ID (tile_info->drawable_ID));
tm = gimp_drawable_shadow (gimp_drawable_get_by_ID (the_gimp, tile_info->drawable_ID));
else
tm = gimp_drawable_data (gimp_drawable_get_by_ID (tile_info->drawable_ID));
tm = gimp_drawable_data (gimp_drawable_get_by_ID (the_gimp, tile_info->drawable_ID));
if (!tm)
{
......@@ -1642,9 +1643,9 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
else
{
if (tile_req->shadow)
tm = gimp_drawable_shadow (gimp_drawable_get_by_ID (tile_req->drawable_ID));
tm = gimp_drawable_shadow (gimp_drawable_get_by_ID (the_gimp, tile_req->drawable_ID));
else
tm = gimp_drawable_data (gimp_drawable_get_by_ID (tile_req->drawable_ID));
tm = gimp_drawable_data (gimp_drawable_get_by_ID (the_gimp, tile_req->drawable_ID));
if (!tm)
{
......@@ -3517,7 +3518,7 @@ plug_in_progress_init (PlugIn *plug_in,
message = plug_in->args[0];
if (gdisp_ID > 0)
gdisp = gdisplay_get_by_ID (gdisp_ID);
gdisp = gdisplay_get_by_ID (the_gimp, gdisp_ID);
if (plug_in->progress)
plug_in->progress = progress_restart (plug_in->progress, message,
......
......@@ -40,6 +40,7 @@
#include "core/gimp.h"
#include "core/gimpdatafactory.h"
#include "core/gimpunit.h"
#include "pdb/internal_procs.h"
......@@ -62,7 +63,6 @@
#include "module_db.h"
#include "plug_in.h"
#include "undo.h"
#include "unitrc.h"
#include "user_install.h"
#ifdef DISPLAY_FILTERS
......@@ -108,7 +108,7 @@ app_init (gint gimp_argc,
*/
gimp_dir = gimp_directory ();
if (stat (gimp_dir, &stat_buf) != 0)
if (stat (gimp_dir, &stat_buf) != 0)
{
/* not properly installed */
......
......@@ -93,6 +93,8 @@ libappcore_a_SOURCES = @STRIP_BEGIN@ \
gimpscanconvert.h \
gimptoolinfo.c \
gimptoolinfo.h \
gimpunit.c \
gimpunit.h \
gimpundo.c \
gimpundo.h \
gimpundostack.c \
......
......@@ -130,6 +130,8 @@ typedef struct _GimpUndoStack GimpUndoStack;
/* non-object types */
typedef struct _GimpCoreConfig GimpCoreConfig;
typedef struct _GimpGuide GimpGuide;
typedef struct _GimpImageNewValues GimpImageNewValues;
......
......@@ -35,9 +35,11 @@
#include "gimprc.h"
void
void
gimp_parasites_init (Gimp *gimp)
{
g_return_if_fail (gimp != NULL);
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (gimp->parasites == NULL);
gimp->parasites = gimp_parasite_list_new ();
......@@ -49,6 +51,9 @@ gimp_parasites_init (Gimp *gimp)
void
gimp_parasites_exit (Gimp *gimp)
{
g_return_if_fail (gimp != NULL);
g_return_if_fail (GIMP_IS_GIMP (gimp));
if (gimp->parasites)
{
gtk_object_unref (GTK_OBJECT (gimp->parasites));
......
......@@ -44,9 +44,9 @@
#include "gimppattern.h"
#include "gimpparasite.h"
#include "gimptoolinfo.h"
#include "gimpunit.h"
#include "app_procs.h"
#include "unitrc.h"
#include "libgimp/gimpintl.h"
......@@ -103,6 +103,8 @@ gimp_class_init (GimpClass *klass)
static void
gimp_init (Gimp *gimp)
{
gimp_core_config_init (gimp);
gimp->create_display_func = NULL;
gimp->gui_set_busy_func = NULL;
gimp->gui_unset_busy_func = NULL;
......@@ -110,31 +112,37 @@ gimp_init (Gimp *gimp)
gimp->busy = FALSE;
gimp->busy_idle_id = 0;
gimp->user_units = NULL;
gimp->n_user_units = 0;
gimp_units_init (gimp);
gimp_parasites_init (gimp);
gimp->images = gimp_list_new (GIMP_TYPE_IMAGE,
GIMP_CONTAINER_POLICY_WEAK);
gimp->images = gimp_list_new (GIMP_TYPE_IMAGE,
GIMP_CONTAINER_POLICY_WEAK);
gtk_object_ref (GTK_OBJECT (gimp->images));
gtk_object_sink (GTK_OBJECT (gimp->images));
gimp->global_buffer = NULL;
gimp->named_buffers = gimp_list_new (GIMP_TYPE_BUFFER,
GIMP_CONTAINER_POLICY_STRONG);
gimp->next_image_ID = 1;
gimp->next_guide_ID = 1;
gimp->image_table = g_hash_table_new (g_direct_hash, NULL);
gimp->next_drawable_ID = 1;
gimp->drawable_table = g_hash_table_new (g_direct_hash, NULL);
gimp->global_buffer = NULL;
gimp->named_buffers = gimp_list_new (GIMP_TYPE_BUFFER,
GIMP_CONTAINER_POLICY_STRONG);
gtk_object_ref (GTK_OBJECT (gimp->named_buffers));
gtk_object_sink (GTK_OBJECT (gimp->named_buffers));
gimp->parasites = NULL;
gimp->brush_factory = NULL;
gimp->pattern_factory = NULL;
gimp->gradient_factory = NULL;
gimp->palette_factory = NULL;
gimp->brush_factory = NULL;
gimp->pattern_factory = NULL;
gimp->gradient_factory = NULL;
gimp->palette_factory = NULL;
procedural_db_init (gimp);
gimp->tool_info_list = gimp_list_new (GIMP_TYPE_TOOL_INFO,
GIMP_CONTAINER_POLICY_STRONG);
gimp->tool_info_list = gimp_list_new (GIMP_TYPE_TOOL_INFO,
GIMP_CONTAINER_POLICY_STRONG);
gtk_object_ref (GTK_OBJECT (gimp->tool_info_list));
gtk_object_sink (GTK_OBJECT (gimp->tool_info_list));
......@@ -205,8 +213,6 @@ gimp_destroy (GtkObject *object)
gimp->palette_factory = NULL;
}
gimp_parasites_exit (gimp);
if (gimp->named_buffers)
{
gtk_object_unref (GTK_OBJECT (gimp->named_buffers));
......@@ -219,20 +225,27 @@ gimp_destroy (GtkObject *object)
gimp->global_buffer = NULL;
}
if (gimp->drawable_table)
{
g_hash_table_destroy (gimp->drawable_table);
gimp->drawable_table = NULL;
}
if (gimp->image_table)
{
g_hash_table_destroy (gimp->image_table);
gimp->image_table = NULL;
}
if (gimp->images)
{
gtk_object_unref (GTK_OBJECT (gimp->images));
gimp->images = NULL;
}
if (gimp->user_units)
{
g_list_foreach (gimp->user_units, (GFunc) g_free, NULL);
g_list_free (gimp->user_units);
gimp_parasites_exit (gimp);
gimp->user_units = NULL;
gimp->n_user_units = 0;
}
gimp_units_exit (gimp);
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
......@@ -289,11 +302,9 @@ gimp_initialize (Gimp *gimp)
g_return_if_fail (gimp != NULL);
g_return_if_fail (GIMP_IS_GIMP (gimp));
gimp_parasites_init (gimp);
gimp->brush_factory =
gimp_data_factory_new (GIMP_TYPE_BRUSH,
(const gchar **) &core_config->brush_path,
(const gchar **) &gimp->config->brush_path,
brush_loader_entries,
n_brush_loader_entries,
gimp_brush_new,
......@@ -303,7 +314,7 @@ gimp_initialize (Gimp *gimp)
gimp->pattern_factory =
gimp_data_factory_new (GIMP_TYPE_PATTERN,
(const gchar **) &core_config->pattern_path,
(const gchar **) &gimp->config->pattern_path,
pattern_loader_entries,
n_pattern_loader_entries,
gimp_pattern_new,
......@@ -313,7 +324,7 @@ gimp_initialize (Gimp *gimp)
gimp->gradient_factory =
gimp_data_factory_new (GIMP_TYPE_GRADIENT,
(const gchar **) &core_config->gradient_path,
(const gchar **) &gimp->config->gradient_path,
gradient_loader_entries,
n_gradient_loader_entries,
gimp_gradient_new,
......@@ -323,7 +334,7 @@ gimp_initialize (Gimp *gimp)
gimp->palette_factory =
gimp_data_factory_new (GIMP_TYPE_PALETTE,
(const gchar **) &core_config->palette_path,
(const gchar **) &gimp->config->palette_path,
palette_loader_entries,
n_palette_loader_entries,
gimp_palette_new,
......@@ -463,14 +474,14 @@ gimp_create_image (Gimp *gimp,
gimp_container_add (gimp->images, GIMP_OBJECT (gimage));
if (attach_comment && core_config->default_comment)
if (attach_comment && gimp->config->default_comment)
{
GimpParasite *parasite;
parasite = gimp_parasite_new ("gimp-comment",
GIMP_PARASITE_PERSISTENT,
strlen (core_config->default_comment) + 1,
core_config->default_comment);
strlen (gimp->config->default_comment) + 1,
gimp->config->default_comment);
gimp_image_parasite_attach (gimage, parasite);
gimp_parasite_free (parasite);
}
......
......@@ -42,6 +42,8 @@ struct _Gimp
{
GimpObject parent_instance;
GimpCoreConfig *config;
GimpCreateDisplayFunc create_display_func;
GimpSetBusyFunc gui_set_busy_func;
GimpUnsetBusyFunc gui_unset_busy_func;
......@@ -52,13 +54,19 @@ struct _Gimp
GList *user_units;
gint n_user_units;
GimpParasiteList *parasites;
GimpContainer *images;
gint next_image_ID;
guint32 next_guide_ID;
GHashTable *image_table;
gint next_drawable_ID;
GHashTable *drawable_table;
TileManager *global_buffer;
GimpContainer *named_buffers;
GimpParasiteList *parasites;
GimpDataFactory *brush_factory;
GimpDataFactory *pattern_factory;
GimpDataFactory *gradient_factory;
......
......@@ -1716,7 +1716,7 @@ gimp_context_brush_list_thaw (GimpContainer *container,
GimpBrush *brush;
if (! context->brush_name)
context->brush_name = g_strdup (core_config->default_brush);
context->brush_name = g_strdup (context->gimp->config->default_brush);
if ((brush = (GimpBrush *)
gimp_container_get_child_by_name (container,
......@@ -1880,7 +1880,7 @@ gimp_context_pattern_list_thaw (GimpContainer *container,
GimpPattern *pattern;
if (! context->pattern_name)
context->pattern_name = g_strdup (core_config->default_pattern);
context->pattern_name = g_strdup (context->gimp->config->default_pattern);
if ((pattern = (GimpPattern *)
gimp_container_get_child_by_name (container,
......@@ -2042,7 +2042,7 @@ gimp_context_gradient_list_thaw (GimpContainer *container,
GimpGradient *gradient;
if (! context->gradient_name)
context->gradient_name = g_strdup (core_config->default_gradient);
context->gradient_name = g_strdup (context->gimp->config->default_gradient);
if ((gradient = (GimpGradient *)
gimp_container_get_child_by_name (container,
......@@ -2189,7 +2189,7 @@ gimp_context_palette_list_thaw (GimpContainer *container,
GimpPalette *palette;
if (! context->palette_name)
context->palette_name = g_strdup (core_config->default_palette);
context->palette_name = g_strdup (context->gimp->config->default_palette);
if ((palette = (GimpPalette *)
gimp_container_get_child_by_name (container,
......@@ -2340,7 +2340,7 @@ gimp_context_buffer_list_thaw (GimpContainer *container,
GimpBuffer *buffer;
if (! context->buffer_name)
context->buffer_name = g_strdup (core_config->default_buffer);
context->buffer_name = g_strdup (context->gimp->config->default_buffer);
if ((buffer = (GimpBuffer *)
gimp_container_get_child_by_name (container,
......
......@@ -22,38 +22,42 @@
#include "core-types.h"
#include "gimp.h"
#include "gimpcoreconfig.h"
static GimpCoreConfig static_core_config =
void
gimp_core_config_init (Gimp *gimp)
{
/* plug_in_path */ NULL,
/* module_path */ NULL,
/* brush_path */ NULL,
/* pattern_path */ NULL,
/* palette_path */ NULL,
/* gradient_path */ NULL,
/* default_brush */ NULL,
/* default_pattern */ NULL,
/* default_palette */ NULL,
/* default_gradient */ NULL,
/* default_comment */ NULL,
/* default_type */ RGB,
/* default_width */ 256,
/* default_height */ 256,
/* default_units */ GIMP_UNIT_INCH,
/* default_xresolution */ 72.0,
/* default_yresolution */ 72.0,
/* default_resolution_units */ GIMP_UNIT_INCH,
/* levels_of_undo */ 5,
/* pluginrc_path */ NULL,
/* module_db_load_inhibit */ NULL,
/* thumbnail_mode */ 1
};
GimpCoreConfig *core_config = &static_core_config;
g_return_if_fail (gimp != NULL);
g_return_if_fail (GIMP_IS_GIMP (gimp));
gimp->config = g_new0 (GimpCoreConfig, 1);
gimp->config->plug_in_path = NULL;
gimp->config->module_path = NULL;
gimp->config->brush_path = NULL;
gimp->config->pattern_path = NULL;
gimp->config->palette_path = NULL;
gimp->config->gradient_path = NULL;
gimp->config->default_brush = NULL;
gimp->config->default_pattern = NULL;
gimp->config->default_palette = NULL;
gimp->config->default_gradient = NULL;
gimp->config->default_comment = NULL;
gimp->config->default_type = RGB;
gimp->config->default_width = 256;
gimp->config->default_height = 256;
gimp->config->default_units = GIMP_UNIT_INCH;
gimp->config->default_xresolution = 72.0;
gimp->config->default_yresolution = 72.0;
gimp->config->default_resolution_units = GIMP_UNIT_INCH;
gimp->config->levels_of_undo = 5;
gimp->config->pluginrc_path = NULL;
gimp->config->module_db_load_inhibit = NULL;
gimp->config->thumbnail_mode = 1;
}
......@@ -20,8 +20,6 @@
#define __GIMP_CORE_CONFIG_H__
typedef struct _GimpCoreConfig GimpCoreConfig;
struct _GimpCoreConfig
{
gchar *plug_in_path;
......@@ -53,7 +51,7 @@ struct _GimpCoreConfig
};
extern GimpCoreConfig *core_config;
void gimp_core_config_init (Gimp *gimp);
#endif /* __GIMP_CORE_CONFIG_H__ */
......@@ -36,6 +36,7 @@
#include "paint-funcs/paint-funcs.h"
#include "gimp.h"
#include "gimpchannel.h"
#include "gimpcontext.h"
#include "gimpdrawable.h"
......@@ -61,6 +62,8 @@ enum
};
/* local function prototypes */
static void gimp_drawable_class_init (GimpDrawableClass *klass);
static void gimp_drawable_init (GimpDrawable *drawable);
static void gimp_drawable_destroy (GtkObject *object);
......@@ -74,9 +77,6 @@ static guint gimp_drawable_signals[LAST_SIGNAL] = { 0 };
static GimpViewableClass *parent_class = NULL;
static gint global_drawable_ID = 1;
static GHashTable *gimp_drawable_table = NULL;
GtkType
gimp_drawable_get_type (void)
......@@ -158,7 +158,7 @@ gimp_drawable_init (GimpDrawable *drawable)
drawable->offset_x = 0;
drawable->offset_y = 0;
drawable->bytes = 0;
drawable->ID = global_drawable_ID++;
drawable->ID = 0;
drawable->tattoo = 0;
drawable->gimage = NULL;
drawable->type = -1;
......@@ -168,13 +168,6 @@ gimp_drawable_init (GimpDrawable *drawable)
drawable->parasites = gimp_parasite_list_new ();
drawable->preview_cache = NULL;
drawable->preview_valid = FALSE;
if (gimp_drawable_table == NULL)
gimp_drawable_table = g_hash_table_new (g_direct_hash, NULL);
g_hash_table_insert (gimp_drawable_table,
GINT_TO_POINTER (drawable->ID),
(gpointer) drawable);
}
static void
......@@ -186,7 +179,8 @@ gimp_drawable_destroy (GtkObject *object)
drawable = GIMP_DRAWABLE (object);
g_hash_table_remove (gimp_drawable_table, GINT_TO_POINTER (drawable->ID));
g_hash_table_remove (drawable->gimage->gimp->drawable_table,
GINT_TO_POINTER (drawable->ID));
if (drawable->tiles)
tile_manager_destroy (drawable->tiles);
......@@ -329,6 +323,13 @@ gimp_drawable_configure (GimpDrawable *drawable,
gboolean alpha;