libgimpwidgets/Makefile.am libgimpwidgets/gimpwidgetsenums.h moved enums

2005-05-20  Sven Neumann  <sven@gimp.org>

	* libgimpwidgets/Makefile.am
	* libgimpwidgets/gimpwidgetsenums.h
	* libgimpwidgets/gimpwidgetstypes.h: moved enums to a new file and
	register the GimpColorAreaType enum with the type system.

	* libgimpwidgets/gimpwidgets.def: updated.

	* libgimpwidgets/gimpcolorarea.c: added an object property.
This commit is contained in:
Sven Neumann 2005-05-20 18:34:00 +00:00 committed by Sven Neumann
parent 1e4a9b7499
commit 6bd6a44442
7 changed files with 179 additions and 44 deletions

View file

@ -1,3 +1,14 @@
2005-05-20 Sven Neumann <sven@gimp.org>
* libgimpwidgets/Makefile.am
* libgimpwidgets/gimpwidgetsenums.h
* libgimpwidgets/gimpwidgetstypes.h: moved enums to a new file and
register the GimpColorAreaType enum with the type system.
* libgimpwidgets/gimpwidgets.def: updated.
* libgimpwidgets/gimpcolorarea.c: added an object property.
2005-05-20 Sven Neumann <sven@gimp.org>
* libgimpwidgets/gimpcolorbutton.c: started to add object properties.

View file

@ -6,6 +6,7 @@ _libs
.libs
.deps
*.la
gimpwidgetsenums.c
gimpwidgetsmarshal.h
gimpwidgetsmarshal.c
test-preview-area

View file

@ -62,6 +62,7 @@ lib_LTLIBRARIES = libgimpwidgets-2.0.la
libgimpwidgets_2_0_la_sources = \
gimpwidgets.c \
gimpwidgets.h \
gimpwidgetsenums.h \
gimpwidgetstypes.h \
gimpbrowser.c \
gimpbrowser.h \
@ -147,6 +148,7 @@ libgimpwidgets_2_0_la_sources = \
gimpwidgets-private.h
libgimpwidgets_2_0_la_built_sources = \
gimpwidgetsenums.c \
gimpwidgetsmarshal.c \
gimpwidgetsmarshal.h
@ -163,6 +165,7 @@ libgimpwidgets_2_0_la_SOURCES = \
libgimpwidgetsinclude_HEADERS = \
gimpwidgets.h \
gimpwidgetsenums.h \
gimpwidgetstypes.h \
gimpbrowser.h \
gimpbutton.h \
@ -223,19 +226,30 @@ libgimpwidgets_2_0_la_DEPENDENCIES = $(gimpwidgets_def)
# rules to generate built sources
#
# setup autogeneration dependancies
gen_sources = xgen-gwmh xgen-gwmc
gen_sources = xgen-wec xgen-wmh xgen-wmc
CLEANFILES = $(gen_sources)
$(srcdir)/gimpwidgetsenums.c: $(srcdir)/gimpwidgetsenums.h $(GIMP_MKENUMS)
$(GIMP_MKENUMS) \
--fhead "#include \"config.h\"\n#include <glib-object.h>\n#include \"gimpwidgetstypes.h\"\n" \
--fprod "\n/* enumerations from \"@filename@\" */" \
--vhead "GType\n@enum_name@_get_type (void)\n{\n static const G@Type@Value values[] =\n {" \
--vprod " { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
--vtail " { 0, NULL, NULL }\n };\n\n static GType type = 0;\n\n if (! type)\n {\n type = g_@type@_register_static (\"@EnumName@\", values);\n }\n\n return type;\n}\n" \
$(srcdir)/gimpwidgetsenums.h > xgen-wec \
&& cp xgen-wec $(@F) \
&& rm -f xgen-wec
$(srcdir)/gimpwidgetsmarshal.h: $(srcdir)/gimpwidgetsmarshal.list
$(GLIB_GENMARSHAL) --prefix=_gimp_widgets_marshal $(srcdir)/gimpwidgetsmarshal.list --header >> xgen-gwmh \
&& (cmp -s xgen-gwmh $(@F) || cp xgen-gwmh $(@F)) \
&& rm -f xgen-gwmh xgen-gwmh~
$(GLIB_GENMARSHAL) --prefix=_gimp_widgets_marshal $(srcdir)/gimpwidgetsmarshal.list --header >> xgen-wmh \
&& (cmp -s xgen-wmh $(@F) || cp xgen-wmh $(@F)) \
&& rm -f xgen-wmh xgen-wmh~
$(srcdir)/gimpwidgetsmarshal.c: $(srcdir)/gimpwidgetsmarshal.h
echo "#include \"gimpwidgetsmarshal.h\"" >> xgen-gwmc \
&& $(GLIB_GENMARSHAL) --prefix=_gimp_widgets_marshal $(srcdir)/gimpwidgetsmarshal.list --body >> xgen-gwmc \
&& cp xgen-gwmc $(@F) \
&& rm -f xgen-gwmc xgen-gwmc~
echo "#include \"gimpwidgetsmarshal.h\"" >> xgen-wmc \
&& $(GLIB_GENMARSHAL) --prefix=_gimp_widgets_marshal $(srcdir)/gimpwidgetsmarshal.list --body >> xgen-wmc \
&& cp xgen-wmc $(@F) \
&& rm -f xgen-wmc xgen-wmc~
#

View file

@ -42,10 +42,24 @@ enum
LAST_SIGNAL
};
enum
{
PROP_0,
PROP_TYPE
};
static void gimp_color_area_class_init (GimpColorAreaClass *klass);
static void gimp_color_area_init (GimpColorArea *area);
static void gimp_color_area_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gimp_color_area_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_color_area_finalize (GObject *object);
static void gimp_color_area_size_allocate (GtkWidget *widget,
@ -124,6 +138,8 @@ gimp_color_area_class_init (GimpColorAreaClass *klass)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
object_class->get_property = gimp_color_area_get_property;
object_class->set_property = gimp_color_area_set_property;
object_class->finalize = gimp_color_area_finalize;
widget_class->size_allocate = gimp_color_area_size_allocate;
@ -135,21 +151,32 @@ gimp_color_area_class_init (GimpColorAreaClass *klass)
widget_class->drag_data_get = gimp_color_area_drag_data_get;
klass->color_changed = NULL;
/**
* GimpColorArea:type:
*
* The type of the color area.
*
* Since: GIMP 2.4
*/
g_object_class_install_property (object_class, PROP_TYPE,
g_param_spec_enum ("type", NULL, NULL,
GIMP_TYPE_COLOR_AREA_TYPE,
GIMP_COLOR_AREA_FLAT,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
}
static void
gimp_color_area_init (GimpColorArea *area)
{
area->buf = NULL;
area->width = 0;
area->height = 0;
area->rowstride = 0;
area->buf = NULL;
area->width = 0;
area->height = 0;
area->rowstride = 0;
area->draw_border = FALSE;
area->type = GIMP_COLOR_AREA_FLAT;
gimp_rgba_set (&area->color, 0.0, 0.0, 0.0, 1.0);
area->draw_border = FALSE;
area->needs_render = TRUE;
}
static void
@ -166,6 +193,46 @@ gimp_color_area_finalize (GObject *object)
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
gimp_color_area_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
GimpColorArea *area = GIMP_COLOR_AREA (object);
switch (property_id)
{
case PROP_TYPE:
g_value_set_enum (value, area->type);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
gimp_color_area_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
GimpColorArea *area = GIMP_COLOR_AREA (object);
switch (property_id)
{
case PROP_TYPE:
gimp_color_area_set_type (area, g_value_get_enum (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
gimp_color_area_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
@ -249,10 +316,11 @@ gimp_color_area_new (const GimpRGB *color,
g_return_val_if_fail (color != NULL, NULL);
area = g_object_new (GIMP_TYPE_COLOR_AREA, NULL);
area = g_object_new (GIMP_TYPE_COLOR_AREA,
"type", type,
NULL);
area->color = *color;
area->type = type;
gtk_drag_dest_set (GTK_WIDGET (area),
GTK_DEST_DEFAULT_HIGHLIGHT |
@ -358,6 +426,8 @@ gimp_color_area_set_type (GimpColorArea *area,
area->needs_render = TRUE;
gtk_widget_queue_draw (GTK_WIDGET (area));
g_object_notify (G_OBJECT (area), "type");
}
/**

View file

@ -23,6 +23,7 @@ EXPORTS
gimp_color_area_set_color
gimp_color_area_set_draw_border
gimp_color_area_set_type
gimp_color_area_type_get_type
gimp_color_button_get_color
gimp_color_button_get_type
gimp_color_button_get_update

View file

@ -0,0 +1,62 @@
/* 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.
*/
#ifndef __GIMP_WIDGETS_ENUMS_H__
#define __GIMP_WIDGETS_ENUMS_H__
G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
#define GIMP_TYPE_COLOR_AREA_TYPE (gimp_color_area_type_get_type ())
GType gimp_color_area_type_get_type (void) G_GNUC_CONST;
typedef enum
{
GIMP_COLOR_AREA_FLAT = 0,
GIMP_COLOR_AREA_SMALL_CHECKS,
GIMP_COLOR_AREA_LARGE_CHECKS
} GimpColorAreaType;
typedef enum /*< skip >*/
{
GIMP_COLOR_SELECTOR_HUE,
GIMP_COLOR_SELECTOR_SATURATION,
GIMP_COLOR_SELECTOR_VALUE,
GIMP_COLOR_SELECTOR_RED,
GIMP_COLOR_SELECTOR_GREEN,
GIMP_COLOR_SELECTOR_BLUE,
GIMP_COLOR_SELECTOR_ALPHA
} GimpColorSelectorChannel;
typedef enum /*< skip >*/
{
GIMP_SIZE_ENTRY_UPDATE_NONE = 0,
GIMP_SIZE_ENTRY_UPDATE_SIZE = 1,
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION = 2
} GimpSizeEntryUpdatePolicy;
G_END_DECLS
#endif /* __GIMP_WIDGETS_ENUMS_H__ */

View file

@ -24,37 +24,13 @@
#include <libgimpbase/gimpbasetypes.h>
#include <libgimpwidgets/gimpwidgetsenums.h>
G_BEGIN_DECLS
/* For information look into the html documentation */
typedef enum
{
GIMP_COLOR_AREA_FLAT = 0,
GIMP_COLOR_AREA_SMALL_CHECKS,
GIMP_COLOR_AREA_LARGE_CHECKS
} GimpColorAreaType;
typedef enum
{
GIMP_COLOR_SELECTOR_HUE,
GIMP_COLOR_SELECTOR_SATURATION,
GIMP_COLOR_SELECTOR_VALUE,
GIMP_COLOR_SELECTOR_RED,
GIMP_COLOR_SELECTOR_GREEN,
GIMP_COLOR_SELECTOR_BLUE,
GIMP_COLOR_SELECTOR_ALPHA
} GimpColorSelectorChannel;
typedef enum
{
GIMP_SIZE_ENTRY_UPDATE_NONE = 0,
GIMP_SIZE_ENTRY_UPDATE_SIZE = 1,
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION = 2
} GimpSizeEntryUpdatePolicy;
typedef struct _GimpBrowser GimpBrowser;
typedef struct _GimpButton GimpButton;
typedef struct _GimpCellRendererColor GimpCellRendererColor;