libgimpbase/Makefile.am removed this file again.

2005-01-23  Sven Neumann  <sven@gimp.org>

	* libgimpbase/Makefile.am
	* libgimpbase/gimpbaseparams.[ch]: removed this file again.

	* libgimpbase/gimpmemsize.[ch]
	* libgimpbase/gimppath.[ch]
	* libgimpbase/gimpunit.[ch]: moved the paramspec definitions to
	the types they belong to.

	* libgimpbase/gimpbase.h: changed accordingly.

	* libgimpwidgets/Makefile.am (libgimpwidgetsinclude_HEADERS):
	install the new header files.
This commit is contained in:
Sven Neumann 2005-01-23 02:09:41 +00:00 committed by Sven Neumann
parent b145e84dd2
commit e9eab5d8e0
11 changed files with 423 additions and 399 deletions

View File

@ -1,3 +1,18 @@
2005-01-23 Sven Neumann <sven@gimp.org>
* libgimpbase/Makefile.am
* libgimpbase/gimpbaseparams.[ch]: removed this file again.
* libgimpbase/gimpmemsize.[ch]
* libgimpbase/gimppath.[ch]
* libgimpbase/gimpunit.[ch]: moved the paramspec definitions to
the types they belong to.
* libgimpbase/gimpbase.h: changed accordingly.
* libgimpwidgets/Makefile.am (libgimpwidgetsinclude_HEADERS):
install the new header files.
2005-01-23 Sven Neumann <sven@gimp.org>
* app/text/text-enums.h

View File

@ -69,8 +69,6 @@ lib_LTLIBRARIES = libgimpbase-2.0.la
libgimpbase_sources = \
gimpbase.h \
gimpbaseenums.h \
gimpbaseparams.h \
gimpbaseparams.c \
gimpbasetypes.h \
gimpbasetypes.c \
gimplimits.h \
@ -90,6 +88,8 @@ libgimpbase_sources = \
gimpparasite.h \
gimpparasiteio.c \
gimpparasiteio.h \
gimppath.h \
gimppath.c \
gimpprotocol.c \
gimpprotocol.h \
gimpsignal.c \
@ -111,7 +111,6 @@ libgimpbase_2_0_la_SOURCES = $(libgimpbase_sources) $(libgimpbase_built_sources)
libgimpbaseinclude_HEADERS = \
gimpbase.h \
gimpbaseenums.h \
gimpbaseparams.h \
gimpbasetypes.h \
gimplimits.h \
gimpversion.h \
@ -122,6 +121,7 @@ libgimpbaseinclude_HEADERS = \
gimpmemsize.h \
gimpparasite.h \
gimpparasiteio.h \
gimppath.h \
gimpsignal.h \
gimpunit.h \
gimputils.h

View File

@ -23,13 +23,13 @@
#include <libgimpbase/gimpbasetypes.h>
#include <libgimpbase/gimpbaseparams.h>
#include <libgimpbase/gimpchecks.h>
#include <libgimpbase/gimpdatafiles.h>
#include <libgimpbase/gimpenv.h>
#include <libgimpbase/gimplimits.h>
#include <libgimpbase/gimpmemsize.h>
#include <libgimpbase/gimpparasite.h>
#include <libgimpbase/gimppath.h>
#include <libgimpbase/gimpunit.h>
#include <libgimpbase/gimputils.h>
#include <libgimpbase/gimpversion.h>

View File

@ -1,356 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* ParamSpecs for config objects
* Copyright (C) 2001-2003 Sven Neumann <sven@gimp.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <glib-object.h>
#include "libgimpbase/gimpbase.h"
#include "gimpbaseparams.h"
#include "gimpbasetypes.h"
/*
* GIMP_TYPE_PARAM_MEMSIZE
*/
static void gimp_param_memsize_class_init (GParamSpecClass *class);
/**
* gimp_param_memsize_get_type:
*
* Reveals the object type
*
* Returns: the #GType for a memsize object
*
* Since: GIMP 2.4
**/
GType
gimp_param_memsize_get_type (void)
{
static GType spec_type = 0;
if (!spec_type)
{
static const GTypeInfo type_info =
{
sizeof (GParamSpecClass),
NULL, NULL,
(GClassInitFunc) gimp_param_memsize_class_init,
NULL, NULL,
sizeof (GParamSpecUInt64),
0, NULL, NULL
};
spec_type = g_type_register_static (G_TYPE_PARAM_UINT64,
"GimpParamMemsize",
&type_info, 0);
}
return spec_type;
}
static void
gimp_param_memsize_class_init (GParamSpecClass *class)
{
class->value_type = GIMP_TYPE_MEMSIZE;
}
/**
* gimp_param_spec_memsize:
* @name: Canonical name of the param
* @nick: Nickname of the param
* @blurb: Brief desciption of param.
* @minimum: Smallest allowed value of the parameter.
* @maximum: Largest allowed value of the parameter.
* @default_value: Value to use if none is assigned.
* @flags: a combination of #GParamFlags
*
* Creates a param spec to hold a memory size value.
* See g_param_spec_internal() for more information.
*
* Returns: a newly allocated #GParamSpec instance
*
* Since: GIMP 2.4
**/
GParamSpec *
gimp_param_spec_memsize (const gchar *name,
const gchar *nick,
const gchar *blurb,
guint64 minimum,
guint64 maximum,
guint64 default_value,
GParamFlags flags)
{
GParamSpecUInt64 *pspec;
pspec = g_param_spec_internal (GIMP_TYPE_PARAM_MEMSIZE,
name, nick, blurb, flags);
pspec->minimum = minimum;
pspec->maximum = maximum;
pspec->default_value = default_value;
return G_PARAM_SPEC (pspec);
}
/*
* GIMP_TYPE_PARAM_PATH
*/
#define GIMP_PARAM_SPEC_PATH(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), GIMP_TYPE_PARAM_PATH, GimpParamSpecPath))
typedef struct _GimpParamSpecPath GimpParamSpecPath;
struct _GimpParamSpecPath
{
GParamSpecString parent_instance;
GimpParamPathType type;
};
static void gimp_param_path_class_init (GParamSpecClass *class);
/**
* gimp_param_path_get_type:
*
* Reveals the object type
*
* Returns: the #GType for a directory path object
*
* Since: GIMP 2.4
**/
GType
gimp_param_path_get_type (void)
{
static GType spec_type = 0;
if (!spec_type)
{
static const GTypeInfo type_info =
{
sizeof (GParamSpecClass),
NULL, NULL,
(GClassInitFunc) gimp_param_path_class_init,
NULL, NULL,
sizeof (GimpParamSpecPath),
0, NULL, NULL
};
spec_type = g_type_register_static (G_TYPE_PARAM_STRING,
"GimpParamPath",
&type_info, 0);
}
return spec_type;
}
static void
gimp_param_path_class_init (GParamSpecClass *class)
{
class->value_type = GIMP_TYPE_PATH;
}
/**
* gimp_param_spec_path:
* @name: Canonical name of the param
* @nick: Nickname of the param
* @blurb: Brief desciption of param.
* @type: a #GimpParamPathType value.
* @default_value: Value to use if none is assigned.
* @flags: a combination of #GParamFlags
*
* Creates a param spec to hold a filename, dir name,
* or list of file or dir names.
* See g_param_spec_internal() for more information.
*
* Returns: a newly allocated #GParamSpec instance
*
* Since: GIMP 2.4
**/
GParamSpec *
gimp_param_spec_path (const gchar *name,
const gchar *nick,
const gchar *blurb,
GimpParamPathType type,
gchar *default_value,
GParamFlags flags)
{
GParamSpecString *pspec;
pspec = g_param_spec_internal (GIMP_TYPE_PARAM_PATH,
name, nick, blurb, flags);
pspec->default_value = default_value;
GIMP_PARAM_SPEC_PATH (pspec)->type = type;
return G_PARAM_SPEC (pspec);
}
/**
* gimp_param_spec_path_get_path_type:
* @pspec: A #GParamSpec for a path param
*
* Tells whether the path param encodes a filename,
* dir name, or list of file or dir names.
*
* Returns: a #GimpParamPathType value
*
* Since: GIMP 2.4
**/
GimpParamPathType
gimp_param_spec_path_type (GParamSpec *pspec)
{
g_return_val_if_fail (GIMP_IS_PARAM_SPEC_PATH (pspec), 0);
return GIMP_PARAM_SPEC_PATH (pspec)->type;
}
/*
* GIMP_TYPE_PARAM_UNIT
*/
#define GIMP_PARAM_SPEC_UNIT(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), GIMP_TYPE_PARAM_UNIT, GimpParamSpecUnit))
typedef struct _GimpParamSpecUnit GimpParamSpecUnit;
struct _GimpParamSpecUnit
{
GParamSpecInt parent_instance;
gboolean allow_percent;
};
static void gimp_param_unit_class_init (GParamSpecClass *class);
static gboolean gimp_param_unit_value_validate (GParamSpec *pspec,
GValue *value);
/**
* gimp_param_unit_get_type:
*
* Reveals the object type
*
* Returns: the #GType for a unit param object
*
* Since: GIMP 2.4
**/
GType
gimp_param_unit_get_type (void)
{
static GType spec_type = 0;
if (!spec_type)
{
static const GTypeInfo type_info =
{
sizeof (GParamSpecClass),
NULL, NULL,
(GClassInitFunc) gimp_param_unit_class_init,
NULL, NULL,
sizeof (GimpParamSpecUnit),
0, NULL, NULL
};
spec_type = g_type_register_static (G_TYPE_PARAM_INT,
"GimpParamUnit",
&type_info, 0);
}
return spec_type;
}
static void
gimp_param_unit_class_init (GParamSpecClass *class)
{
class->value_type = GIMP_TYPE_UNIT;
class->value_validate = gimp_param_unit_value_validate;
}
static gboolean
gimp_param_unit_value_validate (GParamSpec *pspec,
GValue *value)
{
GParamSpecInt *ispec = G_PARAM_SPEC_INT (pspec);
GimpParamSpecUnit *uspec = GIMP_PARAM_SPEC_UNIT (pspec);
gint oval = value->data[0].v_int;
if (uspec->allow_percent && value->data[0].v_int == GIMP_UNIT_PERCENT)
{
value->data[0].v_int = value->data[0].v_int;
}
else
{
value->data[0].v_int = CLAMP (value->data[0].v_int,
ispec->minimum,
gimp_unit_get_number_of_units () - 1);
}
return value->data[0].v_int != oval;
}
/**
* gimp_param_spec_unit:
* @name: Canonical name of the param
* @nick: Nickname of the param
* @blurb: Brief desciption of param.
* @allow_pixels: Whether "pixels" is an allowed unit.
* @allow_percent: Whether "perecent" is an allowed unit.
* @default_value: Unit to use if none is assigned.
* @flags: a combination of #GParamFlags
*
* Creates a param spec to hold a units param.
* See g_param_spec_internal() for more information.
*
* Returns: a newly allocated #GParamSpec instance
*
* Since: GIMP 2.4
**/
GParamSpec *
gimp_param_spec_unit (const gchar *name,
const gchar *nick,
const gchar *blurb,
gboolean allow_pixels,
gboolean allow_percent,
GimpUnit default_value,
GParamFlags flags)
{
GimpParamSpecUnit *pspec;
GParamSpecInt *ispec;
pspec = g_param_spec_internal (GIMP_TYPE_PARAM_UNIT,
name, nick, blurb, flags);
ispec = G_PARAM_SPEC_INT (pspec);
ispec->default_value = default_value;
ispec->minimum = allow_pixels ? GIMP_UNIT_PIXEL : GIMP_UNIT_INCH;
ispec->maximum = GIMP_UNIT_PERCENT - 1;
pspec->allow_percent = allow_percent;
return G_PARAM_SPEC (pspec);
}

View File

@ -245,3 +245,89 @@ string_to_memsize (const GValue *src_value,
g_value_set_uint64 (dest_value, memsize);
}
/*
* GIMP_TYPE_PARAM_MEMSIZE
*/
static void gimp_param_memsize_class_init (GParamSpecClass *class);
/**
* gimp_param_memsize_get_type:
*
* Reveals the object type
*
* Returns: the #GType for a memsize object
*
* Since: GIMP 2.4
**/
GType
gimp_param_memsize_get_type (void)
{
static GType spec_type = 0;
if (!spec_type)
{
static const GTypeInfo type_info =
{
sizeof (GParamSpecClass),
NULL, NULL,
(GClassInitFunc) gimp_param_memsize_class_init,
NULL, NULL,
sizeof (GParamSpecUInt64),
0, NULL, NULL
};
spec_type = g_type_register_static (G_TYPE_PARAM_UINT64,
"GimpParamMemsize",
&type_info, 0);
}
return spec_type;
}
static void
gimp_param_memsize_class_init (GParamSpecClass *class)
{
class->value_type = GIMP_TYPE_MEMSIZE;
}
/**
* gimp_param_spec_memsize:
* @name: Canonical name of the param
* @nick: Nickname of the param
* @blurb: Brief desciption of param.
* @minimum: Smallest allowed value of the parameter.
* @maximum: Largest allowed value of the parameter.
* @default_value: Value to use if none is assigned.
* @flags: a combination of #GParamFlags
*
* Creates a param spec to hold a memory size value.
* See g_param_spec_internal() for more information.
*
* Returns: a newly allocated #GParamSpec instance
*
* Since: GIMP 2.4
**/
GParamSpec *
gimp_param_spec_memsize (const gchar *name,
const gchar *nick,
const gchar *blurb,
guint64 minimum,
guint64 maximum,
guint64 default_value,
GParamFlags flags)
{
GParamSpecUInt64 *pspec;
pspec = g_param_spec_internal (GIMP_TYPE_PARAM_MEMSIZE,
name, nick, blurb, flags);
pspec->minimum = minimum;
pspec->maximum = maximum;
pspec->default_value = default_value;
return G_PARAM_SPEC (pspec);
}

View File

@ -23,6 +23,10 @@
G_BEGIN_DECLS
/*
* GIMP_TYPE_MEMSIZE
*/
#define GIMP_TYPE_MEMSIZE (gimp_memsize_get_type ())
#define GIMP_VALUE_HOLDS_MEMSIZE(value) (G_TYPE_CHECK_VALUE_TYPE ((value), GIMP_TYPE_MEMSIZE))
@ -35,6 +39,24 @@ gboolean gimp_memsize_deserialize (const gchar *string,
gchar * gimp_memsize_to_string (guint64 memsize);
/*
* GIMP_TYPE_PARAM_MEMSIZE
*/
#define GIMP_TYPE_PARAM_MEMSIZE (gimp_param_memsize_get_type ())
#define GIMP_IS_PARAM_SPEC_MEMSIZE(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GIMP_TYPE_PARAM_MEMSIZE))
GType gimp_param_memsize_get_type (void) G_GNUC_CONST;
GParamSpec * gimp_param_spec_memsize (const gchar *name,
const gchar *nick,
const gchar *blurb,
guint64 minimum,
guint64 maximum,
guint64 default_value,
GParamFlags flags);
G_END_DECLS
#endif /* __GIMP_MEMSIZE_H__ */

140
libgimpbase/gimppath.c Normal file
View File

@ -0,0 +1,140 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <glib-object.h>
#include "gimpbasetypes.h"
#include "gimppath.h"
/*
* GIMP_TYPE_PARAM_PATH
*/
#define GIMP_PARAM_SPEC_PATH(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), GIMP_TYPE_PARAM_PATH, GimpParamSpecPath))
typedef struct _GimpParamSpecPath GimpParamSpecPath;
struct _GimpParamSpecPath
{
GParamSpecString parent_instance;
GimpParamPathType type;
};
static void gimp_param_path_class_init (GParamSpecClass *class);
/**
* gimp_param_path_get_type:
*
* Reveals the object type
*
* Returns: the #GType for a directory path object
*
* Since: GIMP 2.4
**/
GType
gimp_param_path_get_type (void)
{
static GType spec_type = 0;
if (!spec_type)
{
static const GTypeInfo type_info =
{
sizeof (GParamSpecClass),
NULL, NULL,
(GClassInitFunc) gimp_param_path_class_init,
NULL, NULL,
sizeof (GimpParamSpecPath),
0, NULL, NULL
};
spec_type = g_type_register_static (G_TYPE_PARAM_STRING,
"GimpParamPath",
&type_info, 0);
}
return spec_type;
}
static void
gimp_param_path_class_init (GParamSpecClass *class)
{
class->value_type = GIMP_TYPE_PATH;
}
/**
* gimp_param_spec_path:
* @name: Canonical name of the param
* @nick: Nickname of the param
* @blurb: Brief desciption of param.
* @type: a #GimpParamPathType value.
* @default_value: Value to use if none is assigned.
* @flags: a combination of #GParamFlags
*
* Creates a param spec to hold a filename, dir name,
* or list of file or dir names.
* See g_param_spec_internal() for more information.
*
* Returns: a newly allocated #GParamSpec instance
*
* Since: GIMP 2.4
**/
GParamSpec *
gimp_param_spec_path (const gchar *name,
const gchar *nick,
const gchar *blurb,
GimpParamPathType type,
gchar *default_value,
GParamFlags flags)
{
GParamSpecString *pspec;
pspec = g_param_spec_internal (GIMP_TYPE_PARAM_PATH,
name, nick, blurb, flags);
pspec->default_value = default_value;
GIMP_PARAM_SPEC_PATH (pspec)->type = type;
return G_PARAM_SPEC (pspec);
}
/**
* gimp_param_spec_path_get_path_type:
* @pspec: A #GParamSpec for a path param
*
* Tells whether the path param encodes a filename,
* dir name, or list of file or dir names.
*
* Returns: a #GimpParamPathType value
*
* Since: GIMP 2.4
**/
GimpParamPathType
gimp_param_spec_path_type (GParamSpec *pspec)
{
g_return_val_if_fail (GIMP_IS_PARAM_SPEC_PATH (pspec), 0);
return GIMP_PARAM_SPEC_PATH (pspec)->type;
}

View File

@ -17,29 +17,12 @@
* Boston, MA 02111-1307, USA.
*/
#ifndef __GIMP_BASE_PARAMS_H__
#define __GIMP_BASE_PARAMS_H__
#ifndef __GIMP_PATH_H__
#define __GIMP_PATH_H__
/* For information look into the C source or the html documentation */
/*
* GIMP_TYPE_PARAM_MEMSIZE
*/
#define GIMP_TYPE_PARAM_MEMSIZE (gimp_param_memsize_get_type ())
#define GIMP_IS_PARAM_SPEC_MEMSIZE(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GIMP_TYPE_PARAM_MEMSIZE))
GType gimp_param_memsize_get_type (void) G_GNUC_CONST;
GParamSpec * gimp_param_spec_memsize (const gchar *name,
const gchar *nick,
const gchar *blurb,
guint64 minimum,
guint64 maximum,
guint64 default_value,
GParamFlags flags);
/*
* GIMP_TYPE_PARAM_PATH
@ -68,22 +51,4 @@ GParamSpec * gimp_param_spec_path (const gchar *name,
GimpParamPathType gimp_param_spec_path_type (GParamSpec *pspec);
/*
* GIMP_TYPE_PARAM_UNIT
*/
#define GIMP_TYPE_PARAM_UNIT (gimp_param_unit_get_type ())
#define GIMP_IS_PARAM_SPEC_UNIT(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GIMP_TYPE_PARAM_UNIT))
GType gimp_param_unit_get_type (void) G_GNUC_CONST;
GParamSpec * gimp_param_spec_unit (const gchar *name,
const gchar *nick,
const gchar *blurb,
gboolean allow_pixels,
gboolean allow_percent,
GimpUnit default_value,
GParamFlags flags);
#endif /* __GIMP_BASE_PARAMS_H__ */
#endif /* __GIMP_PATH_H__ */

View File

@ -333,3 +333,130 @@ gimp_unit_get_plural (GimpUnit unit)
return _gimp_unit_vtable.unit_get_plural (unit);
}
/*
* GIMP_TYPE_PARAM_UNIT
*/
#define GIMP_PARAM_SPEC_UNIT(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), GIMP_TYPE_PARAM_UNIT, GimpParamSpecUnit))
typedef struct _GimpParamSpecUnit GimpParamSpecUnit;
struct _GimpParamSpecUnit
{
GParamSpecInt parent_instance;
gboolean allow_percent;
};
static void gimp_param_unit_class_init (GParamSpecClass *class);
static gboolean gimp_param_unit_value_validate (GParamSpec *pspec,
GValue *value);
/**
* gimp_param_unit_get_type:
*
* Reveals the object type
*
* Returns: the #GType for a unit param object
*
* Since: GIMP 2.4
**/
GType
gimp_param_unit_get_type (void)
{
static GType spec_type = 0;
if (!spec_type)
{
static const GTypeInfo type_info =
{
sizeof (GParamSpecClass),
NULL, NULL,
(GClassInitFunc) gimp_param_unit_class_init,
NULL, NULL,
sizeof (GimpParamSpecUnit),
0, NULL, NULL
};
spec_type = g_type_register_static (G_TYPE_PARAM_INT,
"GimpParamUnit",
&type_info, 0);
}
return spec_type;
}
static void
gimp_param_unit_class_init (GParamSpecClass *class)
{
class->value_type = GIMP_TYPE_UNIT;
class->value_validate = gimp_param_unit_value_validate;
}
static gboolean
gimp_param_unit_value_validate (GParamSpec *pspec,
GValue *value)
{
GParamSpecInt *ispec = G_PARAM_SPEC_INT (pspec);
GimpParamSpecUnit *uspec = GIMP_PARAM_SPEC_UNIT (pspec);
gint oval = value->data[0].v_int;
if (uspec->allow_percent && value->data[0].v_int == GIMP_UNIT_PERCENT)
{
value->data[0].v_int = value->data[0].v_int;
}
else
{
value->data[0].v_int = CLAMP (value->data[0].v_int,
ispec->minimum,
gimp_unit_get_number_of_units () - 1);
}
return value->data[0].v_int != oval;
}
/**
* gimp_param_spec_unit:
* @name: Canonical name of the param
* @nick: Nickname of the param
* @blurb: Brief desciption of param.
* @allow_pixels: Whether "pixels" is an allowed unit.
* @allow_percent: Whether "perecent" is an allowed unit.
* @default_value: Unit to use if none is assigned.
* @flags: a combination of #GParamFlags
*
* Creates a param spec to hold a units param.
* See g_param_spec_internal() for more information.
*
* Returns: a newly allocated #GParamSpec instance
*
* Since: GIMP 2.4
**/
GParamSpec *
gimp_param_spec_unit (const gchar *name,
const gchar *nick,
const gchar *blurb,
gboolean allow_pixels,
gboolean allow_percent,
GimpUnit default_value,
GParamFlags flags)
{
GimpParamSpecUnit *pspec;
GParamSpecInt *ispec;
pspec = g_param_spec_internal (GIMP_TYPE_PARAM_UNIT,
name, nick, blurb, flags);
ispec = G_PARAM_SPEC_INT (pspec);
ispec->default_value = default_value;
ispec->minimum = allow_pixels ? GIMP_UNIT_PIXEL : GIMP_UNIT_INCH;
ispec->maximum = GIMP_UNIT_PERCENT - 1;
pspec->allow_percent = allow_percent;
return G_PARAM_SPEC (pspec);
}

View File

@ -27,10 +27,33 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
/*
* GIMP_TYPE_UNIT
*/
#define GIMP_TYPE_UNIT (gimp_unit_get_type ())
#define GIMP_VALUE_HOLDS_UNIT(value) (G_TYPE_CHECK_VALUE_TYPE ((value), GIMP_TYPE_UNIT))
GType gimp_unit_get_type (void) G_GNUC_CONST;
GType gimp_unit_get_type (void) G_GNUC_CONST;
/*
* GIMP_TYPE_PARAM_UNIT
*/
#define GIMP_TYPE_PARAM_UNIT (gimp_param_unit_get_type ())
#define GIMP_IS_PARAM_SPEC_UNIT(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GIMP_TYPE_PARAM_UNIT))
GType gimp_param_unit_get_type (void) G_GNUC_CONST;
GParamSpec * gimp_param_spec_unit (const gchar *name,
const gchar *nick,
const gchar *blurb,
gboolean allow_pixels,
gboolean allow_percent,
GimpUnit default_value,
GParamFlags flags);
gint gimp_unit_get_number_of_units (void);

View File

@ -174,6 +174,8 @@ libgimpwidgetsinclude_HEADERS = \
gimpcolorselection.h \
gimpcontroller.h \
gimpdialog.h \
gimpenumcombobox.h \
gimpenumstore.h \
gimpfileentry.h \
gimpframe.h \
gimphelpui.h \