configure.in app/Makefile.am app/config/gimpconfig.[ch]

2001-11-27  Sven Neumann  <sven@gimp.org>

	* configure.in
	* app/Makefile.am
	* app/config/gimpconfig.[ch]
	* app/config/gimpconfig-serialize.[ch]
	* app/config/gimpconfig-deserialize.[ch]: added new base class
	GimpConfig that knows how to serialize and deserialize it's properties
	in sexp format. Contains two example properties that will go into
	derived classes once this is really used.

	* app/main.c: deserialize and serialize the test GimpConfig object to
	~/.gimp-1.3/foorc (only for debugging).

	* app/widgets/widgets-types.h
	* app/core/core-types.h: moved GimpPreviewSize enum to core-types.

	* app/core/core-types.h: don't include gdk-pixbuf.h.

	* app/core/gimptoolinfo.h
	* app/core/gimpimagefile.c: include gdk-pixbuf.h.

	* app/core/gimpimage.[ch]: made construct_flag a gboolean.

	* app/core/gimpdrawable-invert.c
	* app/core/gimpunit.c

	* tools/pdbgen/pdb/plug_in.pdb
	* app/pdb/plug_in_cmds.c: removed unused variables.

	* app/display/Makefile.am: removed .PHONY and files cruft

	* app/Makefile.am
	* libgimp/Makefile.am
	* libgimpbase/Makefile.am
	* libgimpcolor/Makefile.am
	* libgimpmath/Makefile.am
	* libgimpwidgets/Makefile.am
	* plug-ins/Makefile.am: removed commented out makefile.mingw rules.
	If we ever need them again, they can easily be resurrected from CVS.
This commit is contained in:
Sven Neumann 2001-11-27 03:52:11 +00:00 committed by Sven Neumann
parent 0cc4c54c94
commit 19e1acbcd7
47 changed files with 1625 additions and 375 deletions

View File

@ -1,3 +1,44 @@
2001-11-27 Sven Neumann <sven@gimp.org>
* configure.in
* app/Makefile.am
* app/config/gimpconfig.[ch]
* app/config/gimpconfig-serialize.[ch]
* app/config/gimpconfig-deserialize.[ch]: added new base class
GimpConfig that knows how to serialize and deserialize it's properties
in sexp format. Contains two example properties that will go into
derived classes once this is really used.
* app/main.c: deserialize and serialize the test GimpConfig object to
~/.gimp-1.3/foorc (only for debugging).
* app/widgets/widgets-types.h
* app/core/core-types.h: moved GimpPreviewSize enum to core-types.
* app/core/core-types.h: don't include gdk-pixbuf.h.
* app/core/gimptoolinfo.h
* app/core/gimpimagefile.c: include gdk-pixbuf.h.
* app/core/gimpimage.[ch]: made construct_flag a gboolean.
* app/core/gimpdrawable-invert.c
* app/core/gimpunit.c
* tools/pdbgen/pdb/plug_in.pdb
* app/pdb/plug_in_cmds.c: removed unused variables.
* app/display/Makefile.am: removed .PHONY and files cruft
* app/Makefile.am
* libgimp/Makefile.am
* libgimpbase/Makefile.am
* libgimpcolor/Makefile.am
* libgimpmath/Makefile.am
* libgimpwidgets/Makefile.am
* plug-ins/Makefile.am: removed commented out makefile.mingw rules.
If we ever need them again, they can easily be resurrected from CVS.
2001-11-26 Kelly Martin <kmartin@pyrzqxgl.org>
* app/Makefile.am
@ -421,7 +462,7 @@
* plug-ins/script-fu/script-fu-enums.h
* plug-ins/script-fu/script-fu-scripts.c
* plug-ins/script-fu/siod-wrapper.c: applied a modified version of a
patch from Matteo Nastasi <nastasi@tiscalinet.it> that adds the new
patch from Matteo Nastasi <matteo.nastasi@milug.org> that adds the new
Script-Fu parameter type SF-DIRNAME.
* plug-ins/script-fu/scripts/test-sphere.scm: use SF-DIRNAME.

View File

@ -1,6 +1,18 @@
## Process this file with automake to produce Makefile.in
SUBDIRS = paint-funcs base core xcf file pdb plug-in display tools widgets gui
SUBDIRS = \
paint-funcs \
base \
core \
config \
xcf \
file \
pdb \
plug-in \
display \
tools \
widgets \
gui
scriptdata =
@ -138,6 +150,7 @@ gimp_1_3_LDADD = @STRIP_BEGIN@ \
xcf/libappxcf.a \
file/libappfile.a \
pdb/libapppdb.a \
config/libappconfig.a \
paint-funcs/libapppaint-funcs.a \
base/libappbase.a \
$(top_builddir)/libgimpcolor/libgimpcolor-$(LT_RELEASE).la \
@ -151,7 +164,3 @@ gimp_1_3_LDADD = @STRIP_BEGIN@ \
$(INTLLIBS) \
$(REGEXREPL) \
@STRIP_END@
## this is probably cruft, but may not be. -klm
## makefile.mingw: $(top_builddir)/config.status $(top_srcdir)/app/makefile.mingw.in
## cd $(top_builddir) && CONFIG_FILES=app/$@ CONFIG_HEADERS= $(SHELL) ./config.status

6
app/config/.cvsignore Normal file
View File

@ -0,0 +1,6 @@
Makefile
Makefile.in
.deps
.libs
*.lo
libappconfig.la

25
app/config/Makefile.am Normal file
View File

@ -0,0 +1,25 @@
## Process this file with automake to produce Makefile.in
noinst_LIBRARIES = libappconfig.a
libappconfig_a_SOURCES = @STRIP_BEGIN@ \
gimpconfig.c \
gimpconfig.h \
gimpconfig-deserialize.c \
gimpconfig-deserialize.h \
gimpconfig-serialize.c \
gimpconfig-serialize.h \
@STRIP_END@
AM_CPPFLAGS = @STRIP_BEGIN@ \
-DG_LOG_DOMAIN=\"Gimp-Config\" \
@GIMP_THREAD_FLAGS@ \
@GIMP_MP_FLAGS@ \
@STRIP_END@
INCLUDES = @STRIP_BEGIN@ \
-I$(top_srcdir) \
-I$(top_srcdir)/app \
$(GLIB_CFLAGS) \
-I$(includedir) \
@STRIP_END@

View File

@ -0,0 +1,223 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* Object properties deserialization routines
* Copyright (C) 2001 Sven Neumann <sven@gimp.org>
*
* 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 <stdio.h>
#include <string.h>
#include <glib-object.h>
#include "gimpconfig.h"
#include "gimpconfig-deserialize.h"
static void gimp_config_deserialize_property (GimpConfig *config,
GScanner *scanner,
GTokenType *token);
gboolean
gimp_config_deserialize_properties (GimpConfig *config,
GScanner *scanner)
{
GimpConfigClass *klass;
GParamSpec **property_specs;
guint n_property_specs;
guint i;
guint scope_id;
guint old_scope_id;
GTokenType token;
g_return_val_if_fail (GIMP_IS_CONFIG (config), FALSE);
klass = GIMP_CONFIG_GET_CLASS (config);
property_specs = g_object_class_list_properties (G_OBJECT_CLASS (klass),
&n_property_specs);
g_return_val_if_fail (property_specs != NULL && n_property_specs > 0, FALSE);
scope_id = GPOINTER_TO_UINT (config);
old_scope_id = g_scanner_set_scope (scanner, scope_id);
for (i = 0; i < n_property_specs; i++)
{
GParamSpec *prop_spec = property_specs[i];
if (prop_spec->flags & G_PARAM_READWRITE &&
g_type_is_a (prop_spec->owner_type, GIMP_TYPE_CONFIG))
{
g_scanner_scope_add_symbol (scanner, scope_id,
prop_spec->name, prop_spec);
}
}
token = G_TOKEN_LEFT_PAREN;
do
{
if (g_scanner_peek_next_token (scanner) != token)
break;
token = g_scanner_get_next_token (scanner);
switch (token)
{
case G_TOKEN_LEFT_PAREN:
token = G_TOKEN_SYMBOL;
break;
case G_TOKEN_SYMBOL:
gimp_config_deserialize_property (config, scanner, &token);
break;
case G_TOKEN_RIGHT_PAREN:
token = G_TOKEN_LEFT_PAREN;
break;
default: /* do nothing */
break;
}
}
while (token != G_TOKEN_EOF);
if (token != G_TOKEN_LEFT_PAREN)
{
g_scanner_get_next_token (scanner);
g_scanner_unexp_token (scanner, token, NULL, NULL, NULL,
"parse error", TRUE);
}
g_scanner_set_scope (scanner, old_scope_id);
if (property_specs)
g_free (property_specs);
return (token == G_TOKEN_EOF);
}
static void
gimp_config_deserialize_property (GimpConfig *config,
GScanner *scanner,
GTokenType *token)
{
GParamSpec *prop_spec;
GValue value = { 0, };
prop_spec = G_PARAM_SPEC (scanner->value.v_symbol);
g_value_init (&value, prop_spec->value_type);
switch (G_TYPE_FUNDAMENTAL (G_VALUE_TYPE (&value)))
{
case G_TYPE_STRING:
*token = G_TOKEN_STRING;
break;
case G_TYPE_BOOLEAN:
case G_TYPE_ENUM:
*token = G_TOKEN_IDENTIFIER;
break;
case G_TYPE_INT:
case G_TYPE_UINT:
case G_TYPE_LONG:
case G_TYPE_ULONG:
*token = G_TOKEN_INT;
break;
case G_TYPE_FLOAT:
case G_TYPE_DOUBLE:
*token = G_TOKEN_FLOAT;
break;
default:
g_assert_not_reached ();
break;
}
if (g_scanner_peek_next_token (scanner) != *token)
return;
g_scanner_get_next_token (scanner);
switch (G_TYPE_FUNDAMENTAL (G_VALUE_TYPE (&value)))
{
case G_TYPE_STRING:
g_value_set_string (&value, scanner->value.v_string);
break;
case G_TYPE_BOOLEAN:
if (g_ascii_strcasecmp (scanner->value.v_identifier, "true") == 0)
g_value_set_boolean (&value, TRUE);
else if (g_ascii_strcasecmp (scanner->value.v_identifier, "false") == 0)
g_value_set_boolean (&value, FALSE);
else
g_scanner_warn
(scanner,
"expected 'true' or 'false' for boolean property %s, got '%s'",
prop_spec->name, scanner->value.v_identifier);
break;
case G_TYPE_ENUM:
{
GEnumClass *enum_class;
GEnumValue *enum_value;
enum_class = g_type_class_peek (G_VALUE_TYPE (&value));
enum_value = g_enum_get_value_by_name (G_ENUM_CLASS (enum_class),
scanner->value.v_identifier);
if (enum_value)
g_value_set_enum (&value, enum_value->value);
else
g_scanner_warn (scanner,
"invalid value '%s' for enum property %s",
scanner->value.v_identifier, prop_spec->name);
}
break;
case G_TYPE_INT:
g_value_set_int (&value, scanner->value.v_int);
break;
case G_TYPE_UINT:
g_value_set_uint (&value, scanner->value.v_int);
break;
case G_TYPE_LONG:
g_value_set_int (&value, scanner->value.v_int);
break;
case G_TYPE_ULONG:
g_value_set_uint (&value, scanner->value.v_int);
break;
case G_TYPE_FLOAT:
g_value_set_float (&value, scanner->value.v_float);
break;
case G_TYPE_DOUBLE:
g_value_set_double (&value, scanner->value.v_float);
break;
default:
g_assert_not_reached ();
}
g_object_set_property (G_OBJECT (config), prop_spec->name, &value);
g_value_unset (&value);
*token = G_TOKEN_RIGHT_PAREN;
}

View File

@ -0,0 +1,30 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* Object peoperties deserialization routines
* Copyright (C) 2001 Sven Neumann <sven@gimp.org>
*
* 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 __DESERIALIZE_H__
#define __DESERIALIZE_H__
gboolean gimp_config_deserialize_properties (GimpConfig *config,
GScanner *scanner);
#endif /* __DESERIALIZE_H__ */

View File

@ -0,0 +1,96 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* Object propoerties serialization routines
* Copyright (C) 2001 Sven Neumann <sven@gimp.org>
*
* 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 <stdio.h>
#include <string.h>
#include <glib-object.h>
#include "gimpconfig.h"
#include "gimpconfig-serialize.h"
void
gimp_config_serialize_properties (GimpConfig *config,
FILE *file)
{
GimpConfigClass *klass;
GParamSpec **property_specs;
guint n_property_specs;
guint i;
GValue value = { 0, };
klass = GIMP_CONFIG_GET_CLASS (config);
property_specs = g_object_class_list_properties (G_OBJECT_CLASS (klass),
&n_property_specs);
for (i = 0; i < n_property_specs; i++)
{
GParamSpec *prop_spec;
gchar *str;
prop_spec = property_specs[i];
if (! (prop_spec->flags & G_PARAM_READWRITE &&
g_type_is_a (prop_spec->owner_type, GIMP_TYPE_CONFIG)))
continue;
str = NULL;
g_value_init (&value, prop_spec->value_type);
g_object_get_property (G_OBJECT (config), prop_spec->name, &value);
if (G_VALUE_HOLDS_STRING (&value))
{
const gchar *src;
src = g_value_get_string (&value);
if (!src)
str = g_strdup ("NULL");
else
{
gchar *s = g_strescape (src, NULL);
str = g_strdup_printf ("\"%s\"", s);
g_free (s);
}
}
else if (g_value_type_transformable (G_VALUE_TYPE (&value),
G_TYPE_STRING))
{
GValue tmp_value = { 0, };
g_value_init (&tmp_value, G_TYPE_STRING);
g_value_transform (&value, &tmp_value);
str = g_strescape (g_value_get_string (&tmp_value), NULL);
g_value_unset (&tmp_value);
}
fprintf (file, "(%s %s)\n", prop_spec->name, str);
g_free (str);
g_value_unset (&value);
}
}

View File

@ -0,0 +1,30 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* Object properties serialization routines
* Copyright (C) 2001 Sven Neumann <sven@gimp.org>
*
* 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 __SERIALIZE_H__
#define __SERIALIZE_H__
void gimp_config_serialize_properties (GimpConfig *config,
FILE *file);
#endif /* __SERIALIZE_H__ */

238
app/config/gimpconfig.c Normal file
View File

@ -0,0 +1,238 @@
/* 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 <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <glib-object.h>
#include "gimpconfig.h"
#include "gimpconfig-deserialize.h"
#include "gimpconfig-serialize.h"
enum
{
PROP_0,
PROP_MARCHING_ANTS_SPEED,
PROP_PREVIEW_SIZE
};
#define GIMP_TYPE_PREVIEW_SIZE (gimp_preview_size_get_type ())
GType gimp_preview_size_get_type (void) G_GNUC_CONST;
static void gimp_config_class_init (GimpConfigClass *klass);
static void gimp_config_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_config_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static GimpObjectClass *parent_class = NULL;
static const GEnumValue gimp_preview_size_enum_values[] =
{
{ GIMP_PREVIEW_SIZE_NONE, "none" },
{ GIMP_PREVIEW_SIZE_TINY, "tiny" },
{ GIMP_PREVIEW_SIZE_EXTRA_SMALL, "extra-small" },
{ GIMP_PREVIEW_SIZE_SMALL, "small" },
{ GIMP_PREVIEW_SIZE_MEDIUM, "medium" },
{ GIMP_PREVIEW_SIZE_LARGE, "large" },
{ GIMP_PREVIEW_SIZE_EXTRA_LARGE, "extra-large" },
{ GIMP_PREVIEW_SIZE_HUGE, "huge" },
{ GIMP_PREVIEW_SIZE_ENORMOUS, "enormous" },
{ GIMP_PREVIEW_SIZE_GIGANTIC, "gigantic" }
};
GType
gimp_preview_size_get_type (void)
{
static GType size_type = 0;
if (! size_type)
{
size_type = g_enum_register_static ("GimpPreviewSize",
gimp_preview_size_enum_values);
}
return size_type;
}
GType
gimp_config_get_type (void)
{
static GType config_type = 0;
if (! config_type)
{
static const GTypeInfo config_info =
{
sizeof (GimpConfigClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_config_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpConfig),
0, /* n_preallocs */
NULL /* instance_init */
};
config_type = g_type_register_static (GIMP_TYPE_OBJECT,
"GimpConfig",
&config_info, 0);
}
return config_type;
}
static void
gimp_config_class_init (GimpConfigClass *klass)
{
GObjectClass *object_class;
parent_class = g_type_class_peek_parent (klass);
object_class = G_OBJECT_CLASS (klass);
object_class->set_property = gimp_config_set_property;
object_class->get_property = gimp_config_get_property;
g_object_class_install_property (object_class,
PROP_MARCHING_ANTS_SPEED,
g_param_spec_uint ("marching-ants-speed",
NULL, NULL,
50, G_MAXINT,
300,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class,
PROP_PREVIEW_SIZE,
g_param_spec_enum ("preview-size",
NULL, NULL,
GIMP_TYPE_PREVIEW_SIZE,
GIMP_PREVIEW_SIZE_MEDIUM,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
}
static void
gimp_config_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
GimpConfig *gimp_config;
gimp_config = GIMP_CONFIG (object);
switch (property_id)
{
case PROP_MARCHING_ANTS_SPEED:
gimp_config->marching_ants_speed = g_value_get_uint (value);
break;
case PROP_PREVIEW_SIZE:
gimp_config->preview_size = g_value_get_enum (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
gimp_config_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
GimpConfig *gimp_config;
gimp_config = GIMP_CONFIG (object);
switch (property_id)
{
case PROP_MARCHING_ANTS_SPEED:
g_value_set_uint (value, gimp_config->marching_ants_speed);
break;
case PROP_PREVIEW_SIZE:
g_value_set_enum (value, gimp_config->preview_size);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
void
gimp_config_serialize (GimpConfig *config)
{
FILE *file;
g_return_if_fail (GIMP_CONFIG (config));
g_return_if_fail (GIMP_OBJECT (config)->name != NULL);
file = fopen (GIMP_OBJECT (config)->name, "w");
if (file)
gimp_config_serialize_properties (config, file);
fclose (file);
}
gboolean
gimp_config_deserialize (GimpConfig *config)
{
gint fd;
GScanner *scanner;
gboolean success;
g_return_val_if_fail (GIMP_CONFIG (config), FALSE);
g_return_val_if_fail (GIMP_OBJECT (config)->name != NULL, FALSE);
fd = open (GIMP_OBJECT (config)->name, O_RDONLY);
if (fd == -1)
return FALSE;
scanner = g_scanner_new (NULL);
scanner->config->cset_identifier_first = ( G_CSET_a_2_z "-" G_CSET_A_2_Z );
scanner->config->cset_identifier_nth = ( G_CSET_a_2_z "-" G_CSET_A_2_Z );
g_scanner_input_file (scanner, fd);
scanner->input_name = GIMP_OBJECT (config)->name;
success = gimp_config_deserialize_properties (config, scanner);
g_scanner_destroy (scanner);
close (fd);
return success;
}

57
app/config/gimpconfig.h Normal file
View File

@ -0,0 +1,57 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995-1997 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 __GIMP_CONFIG_H__
#define __GIMP_CONFIG_H__
#include "core/core-types.h"
#include "core/gimpobject.h"
#define GIMP_TYPE_CONFIG (gimp_config_get_type ())
#define GIMP_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_CONFIG, GimpConfig))
#define GIMP_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_CONFIG, GimpConfigClass))
#define GIMP_IS_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_CONFIG))
#define GIMP_IS_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_CONFIG))
#define GIMP_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_CONFIG, GimpConfigClass))
typedef struct _GimpConfig GimpConfig;
typedef struct _GimpConfigClass GimpConfigClass;
struct _GimpConfig
{
GimpObject parent_instance;
guint marching_ants_speed;
GimpPreviewSize preview_size;
};
struct _GimpConfigClass
{
GimpObjectClass parent_class;
};
GType gimp_config_get_type (void) G_GNUC_CONST;
void gimp_config_serialize (GimpConfig *config);
gboolean gimp_config_deserialize (GimpConfig *config);
#endif /* __GIMP_CONFIG_H__ */

View File

@ -20,8 +20,6 @@
#define __CORE_TYPES_H__
#include <gdk-pixbuf/gdk-pixbuf.h> /* EEK */
#include "libgimpbase/gimpbasetypes.h"
#include "libgimpmath/gimpmath.h"
@ -199,6 +197,20 @@ typedef enum /*< skip >*/
GIMP_TRANSFORM_BACKWARD
} GimpTransformDirection;
typedef enum /*< skip >*/
{
GIMP_PREVIEW_SIZE_NONE = 0,
GIMP_PREVIEW_SIZE_TINY = 16,
GIMP_PREVIEW_SIZE_EXTRA_SMALL = 24,
GIMP_PREVIEW_SIZE_SMALL = 32,
GIMP_PREVIEW_SIZE_MEDIUM = 48,
GIMP_PREVIEW_SIZE_LARGE = 64,
GIMP_PREVIEW_SIZE_EXTRA_LARGE = 96,
GIMP_PREVIEW_SIZE_HUGE = 128,
GIMP_PREVIEW_SIZE_ENORMOUS = 192,
GIMP_PREVIEW_SIZE_GIGANTIC = 256
} GimpPreviewSize;
/* base objects */

View File

@ -18,7 +18,7 @@
#include "config.h"
#include <glib.h>
#include <glib-object.h>
#include "core-types.h"

View File

@ -467,7 +467,7 @@ gimp_image_init (GimpImage *gimage)
gimage->shadow = NULL;
gimage->construct_flag = -1;
gimage->construct_flag = FALSE;
gimage->proj_type = RGBA_GIMAGE;
gimage->projection = NULL;
@ -2260,7 +2260,7 @@ gimp_image_construct_layers (GimpImage *gimage,
PixelRegion src1PR, src2PR, maskPR;
PixelRegion * mask;
GList *list;
GList *reverse_list = NULL;
GList *reverse_list;
gint off_x;
gint off_y;
@ -2268,36 +2268,8 @@ gimp_image_construct_layers (GimpImage *gimage,
if ((layer = gimp_image_floating_sel (gimage)))
floating_sel_composite (layer, x, y, w, h, FALSE);
/* Note added by Raph Levien, 27 Jan 1998
This looks it was intended as an optimization, but it seems to
have correctness problems. In particular, if all channels are
turned off, the screen simply does not update the projected
image. It should be black. Turning off this optimization seems to
restore correct behavior. At some future point, it may be
desirable to turn the optimization back on.
*/
#if 0
/* If all channels are not visible, simply return */
switch (gimp_image_base_type (gimage))
{
case RGB:
if (! gimp_image_get_component_visible (gimage, RED_CHANNEL) &&
! gimp_image_get_component_visible (gimage, GREEN_CHANNEL) &&
! gimp_image_get_component_visible (gimage, BLUE_CHANNEL))
return;
break;
case GRAY:
if (! gimp_image_get_component_visible (gimage, GRAY_CHANNEL))
return;
break;
case INDEXED:
if (! gimp_image_get_component_visible (gimage, INDEXED_CHANNEL))
return;
break;
}
#endif
reverse_list = NULL;
for (list = GIMP_LIST (gimage->layers)->list;
list;
@ -2323,8 +2295,10 @@ gimp_image_construct_layers (GimpImage *gimage,
x1 = CLAMP (off_x, x, x + w);
y1 = CLAMP (off_y, y, y + h);
x2 = CLAMP (off_x + gimp_drawable_width (GIMP_DRAWABLE (layer)), x, x + w);
y2 = CLAMP (off_y + gimp_drawable_height (GIMP_DRAWABLE (layer)), y, y + h);
x2 = CLAMP (off_x + gimp_drawable_width (GIMP_DRAWABLE (layer)),
x, x + w);
y2 = CLAMP (off_y + gimp_drawable_height (GIMP_DRAWABLE (layer)),
y, y + h);
/* configure the pixel regions */
pixel_region_init (&src1PR, gimp_image_projection (gimage),
@ -2388,7 +2362,7 @@ gimp_image_construct_layers (GimpImage *gimage,
}
}
gimage->construct_flag = 1; /* something was projected */
gimage->construct_flag = TRUE; /* something was projected */
}
g_list_free (reverse_list);
@ -2433,7 +2407,7 @@ gimp_image_construct_channels (GimpImage *gimage,
project_channel (gimage, channel, &src1PR, &src2PR);
gimage->construct_flag = 1;
gimage->construct_flag = TRUE;
}
}
@ -2535,7 +2509,7 @@ gimp_image_construct (GimpImage *gimage,
/* set the construct flag, used to determine if anything
* has been written to the gimage raw image yet.
*/
gimage->construct_flag = 0;
gimage->construct_flag = FALSE;
if (gimage->layers)
{
@ -2544,17 +2518,19 @@ gimp_image_construct (GimpImage *gimage,
}
if ((gimage->layers) && /* There's a layer. */
(! g_slist_next (gimage->layers)) && /* It's the only layer. */
(gimp_layer_has_alpha ((GimpLayer *) (gimage->layers->data))) && /* It's !flat. */
/* It's visible. */
(! g_slist_next (gimage->layers)) && /* It's the only layer. */
(gimp_layer_has_alpha ((GimpLayer *) (gimage->layers->data))) &&
/* It's !flat. */
(gimp_drawable_get_visible (GIMP_DRAWABLE (gimage->layers->data))) &&
/* It's visible. */
(gimp_drawable_width (GIMP_DRAWABLE (gimage->layers->data)) ==
gimage->width) &&
(gimp_drawable_height (GIMP_DRAWABLE (gimage->layers->data)) ==
gimage->height) && /* Covers all. */
/* Not indexed. */
(!gimp_drawable_is_indexed (GIMP_DRAWABLE (gimage->layers->data))) &&
(((GimpLayer *)(gimage->layers->data))->opacity == OPAQUE_OPACITY) /*opaq */
/* Not indexed. */
(((GimpLayer *)(gimage->layers->data))->opacity == OPAQUE_OPACITY)
/* Opaque */
)
{
gint xoff;
@ -2585,14 +2561,14 @@ gimp_image_construct (GimpImage *gimage,
destPR.curtile, srcPR.curtile);
}
gimage->construct_flag = 1;
gimage->construct_flag = TRUE;
gimp_image_construct_channels (gimage, x, y, w, h);
return;
}
}
#else
gimage->construct_flag = 0;
gimage->construct_flag = FALSE;
#endif
/* First, determine if the projection image needs to be

View File

@ -53,7 +53,7 @@ struct _GimpImage
{
GimpViewable parent_instance;
Gimp *gimp; /* The GIMP we image belongs to */
Gimp *gimp; /* the GIMP the image belongs to*/
gint ID; /* provides a unique ID */
@ -79,7 +79,7 @@ struct _GimpImage
TileManager *shadow; /* shadow buffer tiles */
/* Projection attributes */
gint construct_flag; /* flag for construction */
gboolean construct_flag; /* flag for construction */
GimpImageType proj_type; /* type of the projection image */
gint proj_bytes; /* bpp in projection image */
gint proj_level; /* projection level */

View File

@ -467,7 +467,7 @@ gimp_image_init (GimpImage *gimage)
gimage->shadow = NULL;
gimage->construct_flag = -1;
gimage->construct_flag = FALSE;
gimage->proj_type = RGBA_GIMAGE;
gimage->projection = NULL;
@ -2260,7 +2260,7 @@ gimp_image_construct_layers (GimpImage *gimage,
PixelRegion src1PR, src2PR, maskPR;
PixelRegion * mask;
GList *list;
GList *reverse_list = NULL;
GList *reverse_list;
gint off_x;
gint off_y;
@ -2268,36 +2268,8 @@ gimp_image_construct_layers (GimpImage *gimage,
if ((layer = gimp_image_floating_sel (gimage)))
floating_sel_composite (layer, x, y, w, h, FALSE);
/* Note added by Raph Levien, 27 Jan 1998
This looks it was intended as an optimization, but it seems to
have correctness problems. In particular, if all channels are
turned off, the screen simply does not update the projected
image. It should be black. Turning off this optimization seems to
restore correct behavior. At some future point, it may be
desirable to turn the optimization back on.
*/
#if 0
/* If all channels are not visible, simply return */
switch (gimp_image_base_type (gimage))
{
case RGB:
if (! gimp_image_get_component_visible (gimage, RED_CHANNEL) &&
! gimp_image_get_component_visible (gimage, GREEN_CHANNEL) &&
! gimp_image_get_component_visible (gimage, BLUE_CHANNEL))
return;
break;
case GRAY:
if (! gimp_image_get_component_visible (gimage, GRAY_CHANNEL))
return;
break;
case INDEXED:
if (! gimp_image_get_component_visible (gimage, INDEXED_CHANNEL))
return;
break;
}
#endif
reverse_list = NULL;
for (list = GIMP_LIST (gimage->layers)->list;
list;
@ -2323,8 +2295,10 @@ gimp_image_construct_layers (GimpImage *gimage,
x1 = CLAMP (off_x, x, x + w);
y1 = CLAMP (off_y, y, y + h);
x2 = CLAMP (off_x + gimp_drawable_width (GIMP_DRAWABLE (layer)), x, x + w);
y2 = CLAMP (off_y + gimp_drawable_height (GIMP_DRAWABLE (layer)), y, y + h);
x2 = CLAMP (off_x + gimp_drawable_width (GIMP_DRAWABLE (layer)),
x, x + w);
y2 = CLAMP (off_y + gimp_drawable_height (GIMP_DRAWABLE (layer)),
y, y + h);
/* configure the pixel regions */
pixel_region_init (&src1PR, gimp_image_projection (gimage),
@ -2388,7 +2362,7 @@ gimp_image_construct_layers (GimpImage *gimage,
}
}
gimage->construct_flag = 1; /* something was projected */
gimage->construct_flag = TRUE; /* something was projected */
}
g_list_free (reverse_list);
@ -2433,7 +2407,7 @@ gimp_image_construct_channels (GimpImage *gimage,
project_channel (gimage, channel, &src1PR, &src2PR);
gimage->construct_flag = 1;
gimage->construct_flag = TRUE;
}
}
@ -2535,7 +2509,7 @@ gimp_image_construct (GimpImage *gimage,
/* set the construct flag, used to determine if anything
* has been written to the gimage raw image yet.
*/
gimage->construct_flag = 0;
gimage->construct_flag = FALSE;
if (gimage->layers)
{
@ -2544,17 +2518,19 @@ gimp_image_construct (GimpImage *gimage,
}
if ((gimage->layers) && /* There's a layer. */
(! g_slist_next (gimage->layers)) && /* It's the only layer. */
(gimp_layer_has_alpha ((GimpLayer *) (gimage->layers->data))) && /* It's !flat. */
/* It's visible. */
(! g_slist_next (gimage->layers)) && /* It's the only layer. */
(gimp_layer_has_alpha ((GimpLayer *) (gimage->layers->data))) &&
/* It's !flat. */
(gimp_drawable_get_visible (GIMP_DRAWABLE (gimage->layers->data))) &&
/* It's visible. */
(gimp_drawable_width (GIMP_DRAWABLE (gimage->layers->data)) ==
gimage->width) &&
(gimp_drawable_height (GIMP_DRAWABLE (gimage->layers->data)) ==
gimage->height) && /* Covers all. */
/* Not indexed. */
(!gimp_drawable_is_indexed (GIMP_DRAWABLE (gimage->layers->data))) &&
(((GimpLayer *)(gimage->layers->data))->opacity == OPAQUE_OPACITY) /*opaq */
/* Not indexed. */
(((GimpLayer *)(gimage->layers->data))->opacity == OPAQUE_OPACITY)
/* Opaque */
)
{
gint xoff;
@ -2585,14 +2561,14 @@ gimp_image_construct (GimpImage *gimage,
destPR.curtile, srcPR.curtile);
}
gimage->construct_flag = 1;
gimage->construct_flag = TRUE;
gimp_image_construct_channels (gimage, x, y, w, h);
return;
}
}
#else
gimage->construct_flag = 0;
gimage->construct_flag = FALSE;
#endif
/* First, determine if the projection image needs to be

View File

@ -53,7 +53,7 @@ struct _GimpImage
{
GimpViewable parent_instance;
Gimp *gimp; /* The GIMP we image belongs to */
Gimp *gimp; /* the GIMP the image belongs to*/
gint ID; /* provides a unique ID */
@ -79,7 +79,7 @@ struct _GimpImage
TileManager *shadow; /* shadow buffer tiles */
/* Projection attributes */
gint construct_flag; /* flag for construction */
gboolean construct_flag; /* flag for construction */
GimpImageType proj_type; /* type of the projection image */
gint proj_bytes; /* bpp in projection image */
gint proj_level; /* projection level */

View File

@ -467,7 +467,7 @@ gimp_image_init (GimpImage *gimage)
gimage->shadow = NULL;
gimage->construct_flag = -1;
gimage->construct_flag = FALSE;
gimage->proj_type = RGBA_GIMAGE;
gimage->projection = NULL;
@ -2260,7 +2260,7 @@ gimp_image_construct_layers (GimpImage *gimage,
PixelRegion src1PR, src2PR, maskPR;
PixelRegion * mask;
GList *list;
GList *reverse_list = NULL;
GList *reverse_list;
gint off_x;
gint off_y;
@ -2268,36 +2268,8 @@ gimp_image_construct_layers (GimpImage *gimage,
if ((layer = gimp_image_floating_sel (gimage)))
floating_sel_composite (layer, x, y, w, h, FALSE);
/* Note added by Raph Levien, 27 Jan 1998
This looks it was intended as an optimization, but it seems to
have correctness problems. In particular, if all channels are
turned off, the screen simply does not update the projected
image. It should be black. Turning off this optimization seems to
restore correct behavior. At some future point, it may be
desirable to turn the optimization back on.
*/
#if 0
/* If all channels are not visible, simply return */
switch (gimp_image_base_type (gimage))
{
case RGB:
if (! gimp_image_get_component_visible (gimage, RED_CHANNEL) &&
! gimp_image_get_component_visible (gimage, GREEN_CHANNEL) &&
! gimp_image_get_component_visible (gimage, BLUE_CHANNEL))
return;
break;
case GRAY:
if (! gimp_image_get_component_visible (gimage, GRAY_CHANNEL))
return;
break;
case INDEXED:
if (! gimp_image_get_component_visible (gimage, INDEXED_CHANNEL))
return;
break;
}
#endif
reverse_list = NULL;
for (list = GIMP_LIST (gimage->layers)->list;
list;
@ -2323,8 +2295,10 @@ gimp_image_construct_layers (GimpImage *gimage,
x1 = CLAMP (off_x, x, x + w);
y1 = CLAMP (off_y, y, y + h);
x2 = CLAMP (off_x + gimp_drawable_width (GIMP_DRAWABLE (layer)), x, x + w);
y2 = CLAMP (off_y + gimp_drawable_height (GIMP_DRAWABLE (layer)), y, y + h);
x2 = CLAMP (off_x + gimp_drawable_width (GIMP_DRAWABLE (layer)),
x, x + w);
y2 = CLAMP (off_y + gimp_drawable_height (GIMP_DRAWABLE (layer)),
y, y + h);
/* configure the pixel regions */
pixel_region_init (&src1PR, gimp_image_projection (gimage),
@ -2388,7 +2362,7 @@ gimp_image_construct_layers (GimpImage *gimage,
}
}
gimage->construct_flag = 1; /* something was projected */
gimage->construct_flag = TRUE; /* something was projected */
}
g_list_free (reverse_list);
@ -2433,7 +2407,7 @@ gimp_image_construct_channels (GimpImage *gimage,
project_channel (gimage, channel, &src1PR, &src2PR);
gimage->construct_flag = 1;
gimage->construct_flag = TRUE;
}
}
@ -2535,7 +2509,7 @@ gimp_image_construct (GimpImage *gimage,
/* set the construct flag, used to determine if anything
* has been written to the gimage raw image yet.
*/
gimage->construct_flag = 0;
gimage->construct_flag = FALSE;
if (gimage->layers)
{
@ -2544,17 +2518,19 @@ gimp_image_construct (GimpImage *gimage,
}
if ((gimage->layers) && /* There's a layer. */
(! g_slist_next (gimage->layers)) && /* It's the only layer. */
(gimp_layer_has_alpha ((GimpLayer *) (gimage->layers->data))) && /* It's !flat. */
/* It's visible. */
(! g_slist_next (gimage->layers)) && /* It's the only layer. */
(gimp_layer_has_alpha ((GimpLayer *) (gimage->layers->data))) &&
/* It's !flat. */
(gimp_drawable_get_visible (GIMP_DRAWABLE (gimage->layers->data))) &&
/* It's visible. */
(gimp_drawable_width (GIMP_DRAWABLE (gimage->layers->data)) ==
gimage->width) &&
(gimp_drawable_height (GIMP_DRAWABLE (gimage->layers->data)) ==
gimage->height) && /* Covers all. */
/* Not indexed. */
(!gimp_drawable_is_indexed (GIMP_DRAWABLE (gimage->layers->data))) &&
(((GimpLayer *)(gimage->layers->data))->opacity == OPAQUE_OPACITY) /*opaq */
/* Not indexed. */
(((GimpLayer *)(gimage->layers->data))->opacity == OPAQUE_OPACITY)
/* Opaque */
)
{
gint xoff;
@ -2585,14 +2561,14 @@ gimp_image_construct (GimpImage *gimage,
destPR.curtile, srcPR.curtile);
}
gimage->construct_flag = 1;
gimage->construct_flag = TRUE;
gimp_image_construct_channels (gimage, x, y, w, h);
return;
}
}
#else
gimage->construct_flag = 0;
gimage->construct_flag = FALSE;
#endif
/* First, determine if the projection image needs to be

View File

@ -53,7 +53,7 @@ struct _GimpImage
{
GimpViewable parent_instance;
Gimp *gimp; /* The GIMP we image belongs to */
Gimp *gimp; /* the GIMP the image belongs to*/
gint ID; /* provides a unique ID */
@ -79,7 +79,7 @@ struct _GimpImage
TileManager *shadow; /* shadow buffer tiles */
/* Projection attributes */
gint construct_flag; /* flag for construction */
gboolean construct_flag; /* flag for construction */
GimpImageType proj_type; /* type of the projection image */
gint proj_bytes; /* bpp in projection image */
gint proj_level; /* projection level */

View File

@ -467,7 +467,7 @@ gimp_image_init (GimpImage *gimage)
gimage->shadow = NULL;
gimage->construct_flag = -1;
gimage->construct_flag = FALSE;
gimage->proj_type = RGBA_GIMAGE;
gimage->projection = NULL;
@ -2260,7 +2260,7 @@ gimp_image_construct_layers (GimpImage *gimage,
PixelRegion src1PR, src2PR, maskPR;
PixelRegion * mask;
GList *list;
GList *reverse_list = NULL;
GList *reverse_list;
gint off_x;
gint off_y;
@ -2268,36 +2268,8 @@ gimp_image_construct_layers (GimpImage *gimage,
if ((layer = gimp_image_floating_sel (gimage)))
floating_sel_composite (layer, x, y, w, h, FALSE);
/* Note added by Raph Levien, 27 Jan 1998
This looks it was intended as an optimization, but it seems to
have correctness problems. In particular, if all channels are
turned off, the screen simply does not update the projected
image. It should be black. Turning off this optimization seems to
restore correct behavior. At some future point, it may be
desirable to turn the optimization back on.
*/
#if 0
/* If all channels are not visible, simply return */
switch (gimp_image_base_type (gimage))
{
case RGB:
if (! gimp_image_get_component_visible (gimage, RED_CHANNEL) &&
! gimp_image_get_component_visible (gimage, GREEN_CHANNEL) &&
! gimp_image_get_component_visible (gimage, BLUE_CHANNEL))
return;
break;
case GRAY:
if (! gimp_image_get_component_visible (gimage, GRAY_CHANNEL))
return;
break;
case INDEXED:
if (! gimp_image_get_component_visible (gimage, INDEXED_CHANNEL))
return;
break;
}
#endif
reverse_list = NULL;
for (list = GIMP_LIST (gimage->layers)->list;
list;
@ -2323,8 +2295,10 @@ gimp_image_construct_layers (GimpImage *gimage,
x1 = CLAMP (off_x, x, x + w);
y1 = CLAMP (off_y, y, y + h);
x2 = CLAMP (off_x + gimp_drawable_width (GIMP_DRAWABLE (layer)), x, x + w);
y2 = CLAMP (off_y + gimp_drawable_height (GIMP_DRAWABLE (layer)), y, y + h);
x2 = CLAMP (off_x + gimp_drawable_width (GIMP_DRAWABLE (layer)),
x, x + w);
y2 = CLAMP (off_y + gimp_drawable_height (GIMP_DRAWABLE (layer)),
y, y + h);
/* configure the pixel regions */
pixel_region_init (&src1PR, gimp_image_projection (gimage),
@ -2388,7 +2362,7 @@ gimp_image_construct_layers (GimpImage *gimage,
}
}
gimage->construct_flag = 1; /* something was projected */
gimage->construct_flag = TRUE; /* something was projected */
}
g_list_free (reverse_list);
@ -2433,7 +2407,7 @@ gimp_image_construct_channels (GimpImage *gimage,
project_channel (gimage, channel, &src1PR, &src2PR);
gimage->construct_flag = 1;
gimage->construct_flag = TRUE;
}
}
@ -2535,7 +2509,7 @@ gimp_image_construct (GimpImage *gimage,
/* set the construct flag, used to determine if anything
* has been written to the gimage raw image yet.
*/
gimage->construct_flag = 0;
gimage->construct_flag = FALSE;
if (gimage->layers)
{
@ -2544,17 +2518,19 @@ gimp_image_construct (GimpImage *gimage,
}
if ((gimage->layers) && /* There's a layer. */
(! g_slist_next (gimage->layers)) && /* It's the only layer. */
(gimp_layer_has_alpha ((GimpLayer *) (gimage->layers->data))) && /* It's !flat. */
/* It's visible. */
(! g_slist_next (gimage->layers)) && /* It's the only layer. */
(gimp_layer_has_alpha ((GimpLayer *) (gimage->layers->data))) &&
/* It's !flat. */
(gimp_drawable_get_visible (GIMP_DRAWABLE (gimage->layers->data))) &&
/* It's visible. */
(gimp_drawable_width (GIMP_DRAWABLE (gimage->layers->data)) ==
gimage->width) &&
(gimp_drawable_height (GIMP_DRAWABLE (gimage->layers->data)) ==
gimage->height) && /* Covers all. */
/* Not indexed. */
(!gimp_drawable_is_indexed (GIMP_DRAWABLE (gimage->layers->data))) &&
(((GimpLayer *)(gimage->layers->data))->opacity == OPAQUE_OPACITY) /*opaq */
/* Not indexed. */
(((GimpLayer *)(gimage->layers->data))->opacity == OPAQUE_OPACITY)
/* Opaque */
)
{
gint xoff;
@ -2585,14 +2561,14 @@ gimp_image_construct (GimpImage *gimage,
destPR.curtile, srcPR.curtile);
}
gimage->construct_flag = 1;
gimage->construct_flag = TRUE;
gimp_image_construct_channels (gimage, x, y, w, h);
return;
}
}
#else
gimage->construct_flag = 0;
gimage->construct_flag = FALSE;
#endif
/* First, determine if the projection image needs to be

View File

@ -53,7 +53,7 @@ struct _GimpImage
{
GimpViewable parent_instance;
Gimp *gimp; /* The GIMP we image belongs to */
Gimp *gimp; /* the GIMP the image belongs to*/
gint ID; /* provides a unique ID */
@ -79,7 +79,7 @@ struct _GimpImage
TileManager *shadow; /* shadow buffer tiles */
/* Projection attributes */
gint construct_flag; /* flag for construction */
gboolean construct_flag; /* flag for construction */
GimpImageType proj_type; /* type of the projection image */
gint proj_bytes; /* bpp in projection image */
gint proj_level; /* projection level */

View File

@ -467,7 +467,7 @@ gimp_image_init (GimpImage *gimage)
gimage->shadow = NULL;
gimage->construct_flag = -1;
gimage->construct_flag = FALSE;
gimage->proj_type = RGBA_GIMAGE;
gimage->projection = NULL;
@ -2260,7 +2260,7 @@ gimp_image_construct_layers (GimpImage *gimage,
PixelRegion src1PR, src2PR, maskPR;
PixelRegion * mask;
GList *list;
GList *reverse_list = NULL;
GList *reverse_list;
gint off_x;
gint off_y;
@ -2268,36 +2268,8 @@ gimp_image_construct_layers (GimpImage *gimage,
if ((layer = gimp_image_floating_sel (gimage)))
floating_sel_composite (layer, x, y, w, h, FALSE);
/* Note added by Raph Levien, 27 Jan 1998
This looks it was intended as an optimization, but it seems to
have correctness problems. In particular, if all channels are
turned off, the screen simply does not update the projected
image. It should be black. Turning off this optimization seems to
restore correct behavior. At some future point, it may be
desirable to turn the optimization back on.
*/
#if 0
/* If all channels are not visible, simply return */
switch (gimp_image_base_type (gimage))
{
case RGB:
if (! gimp_image_get_component_visible (gimage, RED_CHANNEL) &&
! gimp_image_get_component_visible (gimage, GREEN_CHANNEL) &&
! gimp_image_get_component_visible (gimage, BLUE_CHANNEL))
return;
break;
case GRAY:
if (! gimp_image_get_component_visible (gimage, GRAY_CHANNEL))
return;
break;
case INDEXED:
if (! gimp_image_get_component_visible (gimage, INDEXED_CHANNEL))
return;
break;
}
#endif
reverse_list = NULL;
for (list = GIMP_LIST (gimage->layers)->list;
list;
@ -2323,8 +2295,10 @@ gimp_image_construct_layers (GimpImage *gimage,
x1 = CLAMP (off_x, x, x + w);
y1 = CLAMP (off_y, y, y + h);
x2 = CLAMP (off_x + gimp_drawable_width (GIMP_DRAWABLE (layer)), x, x + w);
y2 = CLAMP (off_y + gimp_drawable_height (GIMP_DRAWABLE (layer)), y, y + h);
x2 = CLAMP (off_x + gimp_drawable_width (GIMP_DRAWABLE (layer)),
x, x + w);
y2 = CLAMP (off_y + gimp_drawable_height (GIMP_DRAWABLE (layer)),
y, y + h);
/* configure the pixel regions */
pixel_region_init (&src1PR, gimp_image_projection (gimage),
@ -2388,7 +2362,7 @@ gimp_image_construct_layers (GimpImage *gimage,
}
}
gimage->construct_flag = 1; /* something was projected */
gimage->construct_flag = TRUE; /* something was projected */
}
g_list_free (reverse_list);
@ -2433,7 +2407,7 @@ gimp_image_construct_channels (GimpImage *gimage,
project_channel (gimage, channel, &src1PR, &src2PR);
gimage->construct_flag = 1;
gimage->construct_flag = TRUE;
}
}
@ -2535,7 +2509,7 @@ gimp_image_construct (GimpImage *gimage,
/* set the construct flag, used to determine if anything
* has been written to the gimage raw image yet.
*/
gimage->construct_flag = 0;
gimage->construct_flag = FALSE;
if (gimage->layers)
{
@ -2544,17 +2518,19 @@ gimp_image_construct (GimpImage *gimage,
}
if ((gimage->layers) && /* There's a layer. */
(! g_slist_next (gimage->layers)) && /* It's the only layer. */
(gimp_layer_has_alpha ((GimpLayer *) (gimage->layers->data))) && /* It's !flat. */
/* It's visible. */
(! g_slist_next (gimage->layers)) && /* It's the only layer. */
(gimp_layer_has_alpha ((GimpLayer *) (gimage->layers->data))) &&
/* It's !flat. */
(gimp_drawable_get_visible (GIMP_DRAWABLE (gimage->layers->data))) &&
/* It's visible. */
(gimp_drawable_width (GIMP_DRAWABLE (gimage->layers->data)) ==
gimage->width) &&
(gimp_drawable_height (GIMP_DRAWABLE (gimage->layers->data)) ==
gimage->height) && /* Covers all. */
/* Not indexed. */
(!gimp_drawable_is_indexed (GIMP_DRAWABLE (gimage->layers->data))) &&
(((GimpLayer *)(gimage->layers->data))->opacity == OPAQUE_OPACITY) /*opaq */
/* Not indexed. */
(((GimpLayer *)(gimage->layers->data))->opacity == OPAQUE_OPACITY)
/* Opaque */
)
{
gint xoff;
@ -2585,14 +2561,14 @@ gimp_image_construct (GimpImage *gimage,
destPR.curtile, srcPR.curtile);
}
gimage->construct_flag = 1;
gimage->construct_flag = TRUE;
gimp_image_construct_channels (gimage, x, y, w, h);
return;
}
}
#else
gimage->construct_flag = 0;
gimage->construct_flag = FALSE;
#endif
/* First, determine if the projection image needs to be

View File

@ -53,7 +53,7 @@ struct _GimpImage
{
GimpViewable parent_instance;
Gimp *gimp; /* The GIMP we image belongs to */
Gimp *gimp; /* the GIMP the image belongs to*/
gint ID; /* provides a unique ID */
@ -79,7 +79,7 @@ struct _GimpImage
TileManager *shadow; /* shadow buffer tiles */
/* Projection attributes */
gint construct_flag; /* flag for construction */
gboolean construct_flag; /* flag for construction */
GimpImageType proj_type; /* type of the projection image */
gint proj_bytes; /* bpp in projection image */
gint proj_level; /* projection level */

View File

@ -467,7 +467,7 @@ gimp_image_init (GimpImage *gimage)
gimage->shadow = NULL;
gimage->construct_flag = -1;
gimage->construct_flag = FALSE;
gimage->proj_type = RGBA_GIMAGE;
gimage->projection = NULL;
@ -2260,7 +2260,7 @@ gimp_image_construct_layers (GimpImage *gimage,
PixelRegion src1PR, src2PR, maskPR;
PixelRegion * mask;
GList *list;
GList *reverse_list = NULL;
GList *reverse_list;
gint off_x;
gint off_y;
@ -2268,36 +2268,8 @@ gimp_image_construct_layers (GimpImage *gimage,
if ((layer = gimp_image_floating_sel (gimage)))
floating_sel_composite (layer, x, y, w, h, FALSE);
/* Note added by Raph Levien, 27 Jan 1998
This looks it was intended as an optimization, but it seems to
have correctness problems. In particular, if all channels are
turned off, the screen simply does not update the projected
image. It should be black. Turning off this optimization seems to
restore correct behavior. At some future point, it may be
desirable to turn the optimization back on.
*/
#if 0
/* If all channels are not visible, simply return */
switch (gimp_image_base_type (gimage))
{
case RGB:
if (! gimp_image_get_component_visible (gimage, RED_CHANNEL) &&
! gimp_image_get_component_visible (gimage, GREEN_CHANNEL) &&
! gimp_image_get_component_visible (gimage, BLUE_CHANNEL))
return;
break;
case GRAY:
if (! gimp_image_get_component_visible (gimage, GRAY_CHANNEL))
return;
break;
case INDEXED:
if (! gimp_image_get_component_visible (gimage, INDEXED_CHANNEL))
return;
break;
}
#endif
reverse_list = NULL;
for (list = GIMP_LIST (gimage->layers)->list;
list;
@ -2323,8 +2295,10 @@ gimp_image_construct_layers (GimpImage *gimage,
x1 = CLAMP (off_x, x, x + w);
y1 = CLAMP (off_y, y, y + h);
x2 = CLAMP (off_x + gimp_drawable_width (GIMP_DRAWABLE (layer)), x, x + w);
y2 = CLAMP (off_y + gimp_drawable_height (GIMP_DRAWABLE (layer)), y, y + h);
x2 = CLAMP (off_x + gimp_drawable_width (GIMP_DRAWABLE (layer)),
x, x + w);
y2 = CLAMP (off_y + gimp_drawable_height (GIMP_DRAWABLE (layer)),
y, y + h);
/* configure the pixel regions */
pixel_region_init (&src1PR, gimp_image_projection (gimage),
@ -2388,7 +2362,7 @@ gimp_image_construct_layers (GimpImage *gimage,
}
}
gimage->construct_flag = 1; /* something was projected */
gimage->construct_flag = TRUE; /* something was projected */
}
g_list_free (reverse_list);
@ -2433,7 +2407,7 @@ gimp_image_construct_channels (GimpImage *gimage,
project_channel (gimage, channel, &src1PR, &src2PR);
gimage->construct_flag = 1;
gimage->construct_flag = TRUE;
}
}
@ -2535,7 +2509,7 @@ gimp_image_construct (GimpImage *gimage,
/* set the construct flag, used to determine if anything
* has been written to the gimage raw image yet.
*/
gimage->construct_flag = 0;
gimage->construct_flag = FALSE;
if (gimage->layers)
{
@ -2544,17 +2518,19 @@ gimp_image_construct (GimpImage *gimage,
}
if ((gimage->layers) && /* There's a layer. */
(! g_slist_next (gimage->layers)) && /* It's the only layer. */
(gimp_layer_has_alpha ((GimpLayer *) (gimage->layers->data))) && /* It's !flat. */
/* It's visible. */
(! g_slist_next (gimage->layers)) && /* It's the only layer. */
(gimp_layer_has_alpha ((GimpLayer *) (gimage->layers->data))) &&
/* It's !flat. */
(gimp_drawable_get_visible (GIMP_DRAWABLE (gimage->layers->data))) &&
/* It's visible. */
(gimp_drawable_width (GIMP_DRAWABLE (gimage->layers->data)) ==
gimage->width) &&
(gimp_drawable_height (GIMP_DRAWABLE (gimage->layers->data)) ==
gimage->height) && /* Covers all. */
/* Not indexed. */
(!gimp_drawable_is_indexed (GIMP_DRAWABLE (gimage->layers->data))) &&
(((GimpLayer *)(gimage->layers->data))->opacity == OPAQUE_OPACITY) /*opaq */
/* Not indexed. */
(((GimpLayer *)(gimage->layers->data))->opacity == OPAQUE_OPACITY)
/* Opaque */
)
{
gint xoff;
@ -2585,14 +2561,14 @@ gimp_image_construct (GimpImage *gimage,
destPR.curtile, srcPR.curtile);
}
gimage->construct_flag = 1;
gimage->construct_flag = TRUE;
gimp_image_construct_channels (gimage, x, y, w, h);
return;
}
}
#else
gimage->construct_flag = 0;
gimage->construct_flag = FALSE;
#endif
/* First, determine if the projection image needs to be

View File

@ -53,7 +53,7 @@ struct _GimpImage
{
GimpViewable parent_instance;
Gimp *gimp; /* The GIMP we image belongs to */
Gimp *gimp; /* the GIMP the image belongs to*/
gint ID; /* provides a unique ID */
@ -79,7 +79,7 @@ struct _GimpImage
TileManager *shadow; /* shadow buffer tiles */
/* Projection attributes */
gint construct_flag; /* flag for construction */
gboolean construct_flag; /* flag for construction */
GimpImageType proj_type; /* type of the projection image */
gint proj_bytes; /* bpp in projection image */
gint proj_level; /* projection level */

View File

@ -30,6 +30,7 @@
#endif
#include <glib-object.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include "core-types.h"

View File

@ -467,7 +467,7 @@ gimp_image_init (GimpImage *gimage)
gimage->shadow = NULL;
gimage->construct_flag = -1;
gimage->construct_flag = FALSE;
gimage->proj_type = RGBA_GIMAGE;
gimage->projection = NULL;
@ -2260,7 +2260,7 @@ gimp_image_construct_layers (GimpImage *gimage,
PixelRegion src1PR, src2PR, maskPR;
PixelRegion * mask;
GList *list;
GList *reverse_list = NULL;
GList *reverse_list;
gint off_x;
gint off_y;
@ -2268,36 +2268,8 @@ gimp_image_construct_layers (GimpImage *gimage,
if ((layer = gimp_image_floating_sel (gimage)))
floating_sel_composite (layer, x, y, w, h, FALSE);
/* Note added by Raph Levien, 27 Jan 1998
This looks it was intended as an optimization, but it seems to
have correctness problems. In particular, if all channels are
turned off, the screen simply does not update the projected
image. It should be black. Turning off this optimization seems to
restore correct behavior. At some future point, it may be
desirable to turn the optimization back on.
*/
#if 0
/* If all channels are not visible, simply return */
switch (gimp_image_base_type (gimage))
{
case RGB:
if (! gimp_image_get_component_visible (gimage, RED_CHANNEL) &&
! gimp_image_get_component_visible (gimage, GREEN_CHANNEL) &&
! gimp_image_get_component_visible (gimage, BLUE_CHANNEL))
return;
break;
case GRAY:
if (! gimp_image_get_component_visible (gimage, GRAY_CHANNEL))
return;
break;
case INDEXED:
if (! gimp_image_get_component_visible (gimage, INDEXED_CHANNEL))
return;
break;
}
#endif
reverse_list = NULL;
for (list = GIMP_LIST (gimage->layers)->list;
list;
@ -2323,8 +2295,10 @@ gimp_image_construct_layers (GimpImage *gimage,
x1 = CLAMP (off_x, x, x + w);
y1 = CLAMP (off_y, y, y + h);
x2 = CLAMP (off_x + gimp_drawable_width (GIMP_DRAWABLE (layer)), x, x + w);
y2 = CLAMP (off_y + gimp_drawable_height (GIMP_DRAWABLE (layer)), y, y + h);
x2 = CLAMP (off_x + gimp_drawable_width (GIMP_DRAWABLE (layer)),
x, x + w);
y2 = CLAMP (off_y + gimp_drawable_height (GIMP_DRAWABLE (layer)),
y, y + h);
/* configure the pixel regions */
pixel_region_init (&src1PR, gimp_image_projection (gimage),
@ -2388,7 +2362,7 @@ gimp_image_construct_layers (GimpImage *gimage,
}
}
gimage->construct_flag = 1; /* something was projected */
gimage->construct_flag = TRUE; /* something was projected */
}
g_list_free (reverse_list);
@ -2433,7 +2407,7 @@ gimp_image_construct_channels (GimpImage *gimage,
project_channel (gimage, channel, &src1PR, &src2PR);
gimage->construct_flag = 1;
gimage->construct_flag = TRUE;
}
}
@ -2535,7 +2509,7 @@ gimp_image_construct (GimpImage *gimage,
/* set the construct flag, used to determine if anything
* has been written to the gimage raw image yet.
*/
gimage->construct_flag = 0;
gimage->construct_flag = FALSE;
if (gimage->layers)
{
@ -2544,17 +2518,19 @@ gimp_image_construct (GimpImage *gimage,
}
if ((gimage->layers) && /* There's a layer. */
(! g_slist_next (gimage->layers)) && /* It's the only layer. */
(gimp_layer_has_alpha ((GimpLayer *) (gimage->layers->data))) && /* It's !flat. */
/* It's visible. */
(! g_slist_next (gimage->layers)) && /* It's the only layer. */
(gimp_layer_has_alpha ((GimpLayer *) (gimage->layers->data))) &&
/* It's !flat. */
(gimp_drawable_get_visible (GIMP_DRAWABLE (gimage->layers->data))) &&
/* It's visible. */
(gimp_drawable_width (GIMP_DRAWABLE (gimage->layers->data)) ==
gimage->width) &&
(gimp_drawable_height (GIMP_DRAWABLE (gimage->layers->data)) ==
gimage->height) && /* Covers all. */
/* Not indexed. */
(!gimp_drawable_is_indexed (GIMP_DRAWABLE (gimage->layers->data))) &&
(((GimpLayer *)(gimage->layers->data))->opacity == OPAQUE_OPACITY) /*opaq */
/* Not indexed. */
(((GimpLayer *)(gimage->layers->data))->opacity == OPAQUE_OPACITY)
/* Opaque */
)
{
gint xoff;
@ -2585,14 +2561,14 @@ gimp_image_construct (GimpImage *gimage,
destPR.curtile, srcPR.curtile);
}
gimage->construct_flag = 1;
gimage->construct_flag = TRUE;
gimp_image_construct_channels (gimage, x, y, w, h);
return;
}
}
#else
gimage->construct_flag = 0;
gimage->construct_flag = FALSE;
#endif
/* First, determine if the projection image needs to be

View File

@ -53,7 +53,7 @@ struct _GimpImage
{
GimpViewable parent_instance;
Gimp *gimp; /* The GIMP we image belongs to */
Gimp *gimp; /* the GIMP the image belongs to*/
gint ID; /* provides a unique ID */
@ -79,7 +79,7 @@ struct _GimpImage
TileManager *shadow; /* shadow buffer tiles */
/* Projection attributes */
gint construct_flag; /* flag for construction */
gboolean construct_flag; /* flag for construction */
GimpImageType proj_type; /* type of the projection image */
gint proj_bytes; /* bpp in projection image */
gint proj_level; /* projection level */

View File

@ -20,6 +20,8 @@
#define __GIMP_TOOL_INFO_H__
#include <gdk-pixbuf/gdk-pixbuf.h>
#include "gimpdata.h"

View File

@ -24,7 +24,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <glib.h>
#include <glib-object.h>
#include "libgimpbase/gimpbase.h"

View File

@ -50,10 +50,3 @@ INCLUDES = @STRIP_BEGIN@ \
$(GTK_CFLAGS) \
-I$(includedir) \
@STRIP_END@
.PHONY: files
files:
@files=`ls $(DISTFILES) 2> /dev/null`; for p in $$files; do \
echo $$p; \
done

View File

@ -42,6 +42,8 @@
#include "core/core-types.h"
#include "config/gimpconfig.h"
#include "gui/gui.h"
#include "appenv.h"
@ -143,6 +145,27 @@ main (int argc,
gui_libs_init (&argc, &argv);
}
/* test code for GimpConfig, will go away */
{
GimpConfig *config;
gchar *filename;
config = g_object_new (GIMP_TYPE_CONFIG, NULL);
filename = gimp_personal_rc_file ("foorc");
gimp_object_set_name (GIMP_OBJECT (config), filename);
g_free (filename);
g_signal_connect_swapped (G_OBJECT (config), "notify",
G_CALLBACK (g_print),
"GimpConfig property changed\n");
gimp_config_serialize (config);
gimp_config_deserialize (config);
g_object_unref (config);
}
#if defined (HAVE_SHM_H) || defined (G_OS_WIN32)
use_shm = TRUE;
#endif

View File

@ -414,7 +414,6 @@ plugin_domain_register_invoker (Gimp *gimp,
gboolean success = TRUE;
gchar *domain_name;
gchar *domain_path;
PlugInDef *plug_in_def;
domain_name = (gchar *) args[0].value.pdb_pointer;
if (domain_name == NULL)
@ -472,7 +471,6 @@ plugin_help_register_invoker (Gimp *gimp,
{
gboolean success = TRUE;
gchar *help_path;
PlugInDef *plug_in_def;
help_path = (gchar *) args[0].value.pdb_pointer;
if (help_path == NULL)

View File

@ -33,20 +33,6 @@ typedef enum
GIMP_VIEW_TYPE_LIST
} GimpViewType;
typedef enum
{
GIMP_PREVIEW_SIZE_NONE = 0,
GIMP_PREVIEW_SIZE_TINY = 16,
GIMP_PREVIEW_SIZE_EXTRA_SMALL = 24,
GIMP_PREVIEW_SIZE_SMALL = 32,
GIMP_PREVIEW_SIZE_MEDIUM = 48,
GIMP_PREVIEW_SIZE_LARGE = 64,
GIMP_PREVIEW_SIZE_EXTRA_LARGE = 96,
GIMP_PREVIEW_SIZE_HUGE = 128,
GIMP_PREVIEW_SIZE_ENORMOUS = 192,
GIMP_PREVIEW_SIZE_GIGANTIC = 256
} GimpPreviewSize;
typedef enum
{
GIMP_DROP_NONE,

View File

@ -860,6 +860,7 @@ libgimpwidgets/makefile.mingw
app/Makefile
app/makefile.mingw
app/base/Makefile
app/config/Makefile
app/core/Makefile
app/display/Makefile
app/file/Makefile

View File

@ -182,7 +182,3 @@ libgimpui_1_3_la_LDFLAGS = @STRIP_BEGIN@ \
@STRIP_END@
libgimpui_1_3_la_LIBADD = $(GTK_LIBS)
## this is probably cruft, but may not be. -klm
## makefile.mingw: $(top_builddir)/config.status $(top_srcdir)/libgimp/makefile.mingw.in
## cd $(top_builddir) && CONFIG_FILES=libgimp/$@ CONFIG_HEADERS= $(SHELL) ./config.status

View File

@ -69,7 +69,3 @@ libgimpbase_1_3_la_LDFLAGS = @STRIP_BEGIN@ \
@STRIP_END@
libgimpbase_1_3_la_LIBADD = $(GLIB_LIBS)
## this is probably cruft, but may not be. -klm
## makefile.mingw: $(top_builddir)/config.status $(top_srcdir)/libgimpcolor/makefile.mingw.in
## cd $(top_builddir) && CONFIG_FILES=libgimpcolor/$@ CONFIG_HEADERS= $(SHELL) ./config.status

View File

@ -56,8 +56,3 @@ libgimpcolor_1_3_la_LDFLAGS = @STRIP_BEGIN@ \
@STRIP_END@
libgimpcolor_1_3_la_LIBADD = $(GLIB_LIBS) -lm
## this is probably cruft, but may not be. -klm
## makefile.mingw: $(top_builddir)/config.status $(top_srcdir)/libgimpcolor/makefile.mingw.in
## cd $(top_builddir) && CONFIG_FILES=libgimpcolor/$@ CONFIG_HEADERS= $(SHELL) ./config.status
##

View File

@ -0,0 +1,223 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* Object properties deserialization routines
* Copyright (C) 2001 Sven Neumann <sven@gimp.org>
*
* 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 <stdio.h>
#include <string.h>
#include <glib-object.h>
#include "gimpconfig.h"
#include "gimpconfig-deserialize.h"
static void gimp_config_deserialize_property (GimpConfig *config,
GScanner *scanner,
GTokenType *token);
gboolean
gimp_config_deserialize_properties (GimpConfig *config,
GScanner *scanner)
{
GimpConfigClass *klass;
GParamSpec **property_specs;
guint n_property_specs;
guint i;
guint scope_id;
guint old_scope_id;
GTokenType token;
g_return_val_if_fail (GIMP_IS_CONFIG (config), FALSE);
klass = GIMP_CONFIG_GET_CLASS (config);
property_specs = g_object_class_list_properties (G_OBJECT_CLASS (klass),
&n_property_specs);
g_return_val_if_fail (property_specs != NULL && n_property_specs > 0, FALSE);
scope_id = GPOINTER_TO_UINT (config);
old_scope_id = g_scanner_set_scope (scanner, scope_id);
for (i = 0; i < n_property_specs; i++)
{
GParamSpec *prop_spec = property_specs[i];
if (prop_spec->flags & G_PARAM_READWRITE &&
g_type_is_a (prop_spec->owner_type, GIMP_TYPE_CONFIG))
{
g_scanner_scope_add_symbol (scanner, scope_id,
prop_spec->name, prop_spec);
}
}
token = G_TOKEN_LEFT_PAREN;
do
{
if (g_scanner_peek_next_token (scanner) != token)
break;
token = g_scanner_get_next_token (scanner);
switch (token)
{
case G_TOKEN_LEFT_PAREN:
token = G_TOKEN_SYMBOL;
break;
case G_TOKEN_SYMBOL:
gimp_config_deserialize_property (config, scanner, &token);
break;
case G_TOKEN_RIGHT_PAREN:
token = G_TOKEN_LEFT_PAREN;
break;
default: /* do nothing */
break;
}
}
while (token != G_TOKEN_EOF);
if (token != G_TOKEN_LEFT_PAREN)
{
g_scanner_get_next_token (scanner);
g_scanner_unexp_token (scanner, token, NULL, NULL, NULL,
"parse error", TRUE);
}
g_scanner_set_scope (scanner, old_scope_id);
if (property_specs)
g_free (property_specs);
return (token == G_TOKEN_EOF);
}
static void
gimp_config_deserialize_property (GimpConfig *config,
GScanner *scanner,
GTokenType *token)
{
GParamSpec *prop_spec;
GValue value = { 0, };
prop_spec = G_PARAM_SPEC (scanner->value.v_symbol);
g_value_init (&value, prop_spec->value_type);
switch (G_TYPE_FUNDAMENTAL (G_VALUE_TYPE (&value)))
{
case G_TYPE_STRING:
*token = G_TOKEN_STRING;
break;
case G_TYPE_BOOLEAN:
case G_TYPE_ENUM:
*token = G_TOKEN_IDENTIFIER;
break;
case G_TYPE_INT:
case G_TYPE_UINT:
case G_TYPE_LONG:
case G_TYPE_ULONG:
*token = G_TOKEN_INT;
break;
case G_TYPE_FLOAT:
case G_TYPE_DOUBLE:
*token = G_TOKEN_FLOAT;
break;
default:
g_assert_not_reached ();
break;
}
if (g_scanner_peek_next_token (scanner) != *token)
return;
g_scanner_get_next_token (scanner);
switch (G_TYPE_FUNDAMENTAL (G_VALUE_TYPE (&value)))
{
case G_TYPE_STRING:
g_value_set_string (&value, scanner->value.v_string);
break;
case G_TYPE_BOOLEAN:
if (g_ascii_strcasecmp (scanner->value.v_identifier, "true") == 0)
g_value_set_boolean (&value, TRUE);
else if (g_ascii_strcasecmp (scanner->value.v_identifier, "false") == 0)
g_value_set_boolean (&value, FALSE);
else
g_scanner_warn
(scanner,
"expected 'true' or 'false' for boolean property %s, got '%s'",
prop_spec->name, scanner->value.v_identifier);
break;
case G_TYPE_ENUM:
{
GEnumClass *enum_class;
GEnumValue *enum_value;
enum_class = g_type_class_peek (G_VALUE_TYPE (&value));
enum_value = g_enum_get_value_by_name (G_ENUM_CLASS (enum_class),
scanner->value.v_identifier);
if (enum_value)
g_value_set_enum (&value, enum_value->value);
else
g_scanner_warn (scanner,
"invalid value '%s' for enum property %s",
scanner->value.v_identifier, prop_spec->name);
}
break;
case G_TYPE_INT:
g_value_set_int (&value, scanner->value.v_int);
break;
case G_TYPE_UINT:
g_value_set_uint (&value, scanner->value.v_int);
break;
case G_TYPE_LONG:
g_value_set_int (&value, scanner->value.v_int);
break;
case G_TYPE_ULONG:
g_value_set_uint (&value, scanner->value.v_int);
break;
case G_TYPE_FLOAT:
g_value_set_float (&value, scanner->value.v_float);
break;
case G_TYPE_DOUBLE:
g_value_set_double (&value, scanner->value.v_float);
break;
default:
g_assert_not_reached ();
}
g_object_set_property (G_OBJECT (config), prop_spec->name, &value);
g_value_unset (&value);
*token = G_TOKEN_RIGHT_PAREN;
}

View File

@ -0,0 +1,30 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* Object peoperties deserialization routines
* Copyright (C) 2001 Sven Neumann <sven@gimp.org>
*
* 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 __DESERIALIZE_H__
#define __DESERIALIZE_H__
gboolean gimp_config_deserialize_properties (GimpConfig *config,
GScanner *scanner);
#endif /* __DESERIALIZE_H__ */

View File

@ -0,0 +1,238 @@
/* 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 <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <glib-object.h>
#include "gimpconfig.h"
#include "gimpconfig-deserialize.h"
#include "gimpconfig-serialize.h"
enum
{
PROP_0,
PROP_MARCHING_ANTS_SPEED,
PROP_PREVIEW_SIZE
};
#define GIMP_TYPE_PREVIEW_SIZE (gimp_preview_size_get_type ())
GType gimp_preview_size_get_type (void) G_GNUC_CONST;
static void gimp_config_class_init (GimpConfigClass *klass);
static void gimp_config_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_config_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static GimpObjectClass *parent_class = NULL;
static const GEnumValue gimp_preview_size_enum_values[] =
{
{ GIMP_PREVIEW_SIZE_NONE, "none" },
{ GIMP_PREVIEW_SIZE_TINY, "tiny" },
{ GIMP_PREVIEW_SIZE_EXTRA_SMALL, "extra-small" },
{ GIMP_PREVIEW_SIZE_SMALL, "small" },
{ GIMP_PREVIEW_SIZE_MEDIUM, "medium" },
{ GIMP_PREVIEW_SIZE_LARGE, "large" },
{ GIMP_PREVIEW_SIZE_EXTRA_LARGE, "extra-large" },
{ GIMP_PREVIEW_SIZE_HUGE, "huge" },
{ GIMP_PREVIEW_SIZE_ENORMOUS, "enormous" },
{ GIMP_PREVIEW_SIZE_GIGANTIC, "gigantic" }
};
GType
gimp_preview_size_get_type (void)
{
static GType size_type = 0;
if (! size_type)
{
size_type = g_enum_register_static ("GimpPreviewSize",
gimp_preview_size_enum_values);
}
return size_type;
}
GType
gimp_config_get_type (void)
{
static GType config_type = 0;
if (! config_type)
{
static const GTypeInfo config_info =
{
sizeof (GimpConfigClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_config_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpConfig),
0, /* n_preallocs */
NULL /* instance_init */
};
config_type = g_type_register_static (GIMP_TYPE_OBJECT,
"GimpConfig",
&config_info, 0);
}
return config_type;
}
static void
gimp_config_class_init (GimpConfigClass *klass)
{
GObjectClass *object_class;
parent_class = g_type_class_peek_parent (klass);
object_class = G_OBJECT_CLASS (klass);
object_class->set_property = gimp_config_set_property;
object_class->get_property = gimp_config_get_property;
g_object_class_install_property (object_class,
PROP_MARCHING_ANTS_SPEED,
g_param_spec_uint ("marching-ants-speed",
NULL, NULL,
50, G_MAXINT,
300,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class,
PROP_PREVIEW_SIZE,
g_param_spec_enum ("preview-size",
NULL, NULL,
GIMP_TYPE_PREVIEW_SIZE,
GIMP_PREVIEW_SIZE_MEDIUM,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
}
static void
gimp_config_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
GimpConfig *gimp_config;
gimp_config = GIMP_CONFIG (object);
switch (property_id)
{
case PROP_MARCHING_ANTS_SPEED:
gimp_config->marching_ants_speed = g_value_get_uint (value);
break;
case PROP_PREVIEW_SIZE:
gimp_config->preview_size = g_value_get_enum (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
gimp_config_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
GimpConfig *gimp_config;
gimp_config = GIMP_CONFIG (object);
switch (property_id)
{
case PROP_MARCHING_ANTS_SPEED:
g_value_set_uint (value, gimp_config->marching_ants_speed);
break;
case PROP_PREVIEW_SIZE:
g_value_set_enum (value, gimp_config->preview_size);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
void
gimp_config_serialize (GimpConfig *config)
{
FILE *file;
g_return_if_fail (GIMP_CONFIG (config));
g_return_if_fail (GIMP_OBJECT (config)->name != NULL);
file = fopen (GIMP_OBJECT (config)->name, "w");
if (file)
gimp_config_serialize_properties (config, file);
fclose (file);
}
gboolean
gimp_config_deserialize (GimpConfig *config)
{
gint fd;
GScanner *scanner;
gboolean success;
g_return_val_if_fail (GIMP_CONFIG (config), FALSE);
g_return_val_if_fail (GIMP_OBJECT (config)->name != NULL, FALSE);
fd = open (GIMP_OBJECT (config)->name, O_RDONLY);
if (fd == -1)
return FALSE;
scanner = g_scanner_new (NULL);
scanner->config->cset_identifier_first = ( G_CSET_a_2_z "-" G_CSET_A_2_Z );
scanner->config->cset_identifier_nth = ( G_CSET_a_2_z "-" G_CSET_A_2_Z );
g_scanner_input_file (scanner, fd);
scanner->input_name = GIMP_OBJECT (config)->name;
success = gimp_config_deserialize_properties (config, scanner);
g_scanner_destroy (scanner);
close (fd);
return success;
}

View File

@ -0,0 +1,57 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995-1997 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 __GIMP_CONFIG_H__
#define __GIMP_CONFIG_H__
#include "core/core-types.h"
#include "core/gimpobject.h"
#define GIMP_TYPE_CONFIG (gimp_config_get_type ())
#define GIMP_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_CONFIG, GimpConfig))
#define GIMP_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_CONFIG, GimpConfigClass))
#define GIMP_IS_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_CONFIG))
#define GIMP_IS_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_CONFIG))
#define GIMP_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_CONFIG, GimpConfigClass))
typedef struct _GimpConfig GimpConfig;
typedef struct _GimpConfigClass GimpConfigClass;
struct _GimpConfig
{
GimpObject parent_instance;
guint marching_ants_speed;
GimpPreviewSize preview_size;
};
struct _GimpConfigClass
{
GimpObjectClass parent_class;
};
GType gimp_config_get_type (void) G_GNUC_CONST;
void gimp_config_serialize (GimpConfig *config);
gboolean gimp_config_deserialize (GimpConfig *config);
#endif /* __GIMP_CONFIG_H__ */

View File

@ -0,0 +1,96 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* Object propoerties serialization routines
* Copyright (C) 2001 Sven Neumann <sven@gimp.org>
*
* 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 <stdio.h>
#include <string.h>
#include <glib-object.h>
#include "gimpconfig.h"
#include "gimpconfig-serialize.h"
void
gimp_config_serialize_properties (GimpConfig *config,
FILE *file)
{
GimpConfigClass *klass;
GParamSpec **property_specs;
guint n_property_specs;
guint i;
GValue value = { 0, };
klass = GIMP_CONFIG_GET_CLASS (config);
property_specs = g_object_class_list_properties (G_OBJECT_CLASS (klass),
&n_property_specs);
for (i = 0; i < n_property_specs; i++)
{
GParamSpec *prop_spec;
gchar *str;
prop_spec = property_specs[i];
if (! (prop_spec->flags & G_PARAM_READWRITE &&
g_type_is_a (prop_spec->owner_type, GIMP_TYPE_CONFIG)))
continue;
str = NULL;
g_value_init (&value, prop_spec->value_type);
g_object_get_property (G_OBJECT (config), prop_spec->name, &value);
if (G_VALUE_HOLDS_STRING (&value))
{
const gchar *src;
src = g_value_get_string (&value);
if (!src)
str = g_strdup ("NULL");
else
{
gchar *s = g_strescape (src, NULL);
str = g_strdup_printf ("\"%s\"", s);
g_free (s);
}
}
else if (g_value_type_transformable (G_VALUE_TYPE (&value),
G_TYPE_STRING))
{
GValue tmp_value = { 0, };
g_value_init (&tmp_value, G_TYPE_STRING);
g_value_transform (&value, &tmp_value);
str = g_strescape (g_value_get_string (&tmp_value), NULL);
g_value_unset (&tmp_value);
}
fprintf (file, "(%s %s)\n", prop_spec->name, str);
g_free (str);
g_value_unset (&value);
}
}

View File

@ -0,0 +1,30 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* Object properties serialization routines
* Copyright (C) 2001 Sven Neumann <sven@gimp.org>
*
* 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 __SERIALIZE_H__
#define __SERIALIZE_H__
void gimp_config_serialize_properties (GimpConfig *config,
FILE *file);
#endif /* __SERIALIZE_H__ */

View File

@ -47,7 +47,3 @@ libgimpmath_1_3_la_LDFLAGS = @STRIP_BEGIN@ \
@STRIP_END@
libgimpmath_1_3_la_LIBADD = $(GLIB_LIBS) -lm
## this is probably cruft, but may not be. -klm
## makefile.mingw: $(top_builddir)/config.status $(top_srcdir)/libgimpmath/makefile.mingw.in
## cd $(top_builddir) && CONFIG_FILES=libgimpmath/$@ CONFIG_HEADERS= $(SHELL) ./config.status

View File

@ -84,7 +84,3 @@ libgimpwidgets_1_3_la_LDFLAGS = @STRIP_BEGIN@ \
@STRIP_END@
libgimpwidgets_1_3_la_LIBADD = $(GLIB_LIBS) -lm
## this is probably cruft, but may not be. -klm
##makefile.mingw: $(top_builddir)/config.status $(top_srcdir)/libgimpwidgets/makefile.mingw.in
## cd $(top_builddir) && CONFIG_FILES=libgimpwidgets/$@ CONFIG_HEADERS= $(SHELL) ./config.status

View File

@ -62,7 +62,3 @@ SUBDIRS = \
## gap \
## gdyntext \
## this is probably cruft, but may not be. -klm
## makefile.mingw: $(top_builddir)/config.status $(top_srcdir)/plug-ins/makefile.mingw.in
## cd $(top_builddir) && CONFIG_FILES=plug-ins/$@ CONFIG_HEADERS= $(SHELL) ./config.status

View File

@ -279,7 +279,6 @@ HELP
%invoke = (
success => 'TRUE',
vars => [ 'PlugInDef *plug_in_def' ],
code => <<'CODE',
{
if (current_plug_in && current_plug_in->query)
@ -313,7 +312,6 @@ HELP
%invoke = (
success => 'TRUE',
vars => [ 'PlugInDef *plug_in_def' ],
code => <<'CODE',
{
if (current_plug_in && current_plug_in->query)