Ported module loading to GTypeModule, getting rid of all own module
2002-10-20 Michael Natterer <mitch@gimp.org> Ported module loading to GTypeModule, getting rid of all own module registering/bookkeeping stuff for color selectors and display filters. The modules now simply register GimpColorSelector and GimpColorDisplay subclasses, the list of registered subclasses can then be obtained calling g_type_children() on the abstract base classes. This is work in progress and just the first working state after I started breaking everything... * app/gui/color-select.[ch] * libgimp/gimpcolordisplay.h * libgimp/gimpcolorselector.h: removed. * app/gui/Makefile.am * libgimp/Makefile.am: changed accordingly. * libgimp/gimpmodule.h: massively simplified. All voodoo is gone. * libgimpwidgets/gimpcolordisplay.[ch] * libgimpwidgets/gimpcolorselector.[ch]: new abstract base classes which need to be subclassed by modules. * libgimpwidgets/gimpcolorselect.[ch]: the built-in color selector from app/gui/color-select.* ported to be a GimpColorSelector subclass. * libgimpwidgets/Makefile.am * libgimpwidgets/gimpwidgets.h * libgimpwidgets/gimpwidgetsmarshal.list * libgimpwidgets/gimpwidgetstypes.h: changed accordingly. * app/core/gimpmoduleinfo.[ch]: made it a GTypeModule subclass * app/core/gimpmodules.c: changed accordingly. * app/core/gimpcontainer.c * app/core/gimplist.c: HACKED around to allow GimpLists of GObjects (not GimpObjects). This is EEKy, so I will either make gimp->modules a simple GList and revert this bit of change, or allow GObjects all over the place in GimpContainer land... * app/display/gimpdisplayshell-filter.[ch] * app/gui/color-notebook.c: removed all module stuff and use g_type_children() to get the list of available color_selectors and display_filters. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-render.c * app/gui/module-browser.c: changed accordingly. * app/gui/gui.c: ref the built-in color selector's class before the modules are queried so it appears first in the list of GimpColorSelector's children. * modules/Makefile.am: build the water color selector again. * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c * modules/colorsel_triangle.c * modules/colorsel_water.c: ported them all to the new API. * modules/gimpmodregister.[ch]: removed the old EMX module hack.
This commit is contained in:
committed by
Michael Natterer
parent
921d265270
commit
d7055a3351
@ -25,6 +25,12 @@ libgimpwidgets_1_3_la_sources = \
|
||||
gimpcolorarea.h \
|
||||
gimpcolorbutton.c \
|
||||
gimpcolorbutton.h \
|
||||
gimpcolordisplay.c \
|
||||
gimpcolordisplay.h \
|
||||
gimpcolorselector.c \
|
||||
gimpcolorselector.h \
|
||||
gimpcolorselect.c \
|
||||
gimpcolorselect.h \
|
||||
gimpdialog.c \
|
||||
gimpdialog.h \
|
||||
gimpfileselection.c \
|
||||
@ -70,6 +76,9 @@ libgimpwidgetsinclude_HEADERS = \
|
||||
gimpchainbutton.h \
|
||||
gimpcolorarea.h \
|
||||
gimpcolorbutton.h \
|
||||
gimpcolordisplay.h \
|
||||
gimpcolorselector.h \
|
||||
gimpcolorselect.h \
|
||||
gimpdialog.h \
|
||||
gimpfileselection.h \
|
||||
gimphelpui.h \
|
||||
|
||||
170
libgimpwidgets/gimpcolordisplay.c
Normal file
170
libgimpwidgets/gimpcolordisplay.c
Normal file
@ -0,0 +1,170 @@
|
||||
/* LIBGIMP - The GIMP Library
|
||||
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
|
||||
*
|
||||
* gimpcolordisplay.c
|
||||
* Copyright (C) 2002 Michael Natterer <mitch@gimp.org>
|
||||
*
|
||||
* This program 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 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 Lesser General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpcolor/gimpcolor.h"
|
||||
|
||||
#include "gimpwidgetstypes.h"
|
||||
|
||||
#include "gimpcolordisplay.h"
|
||||
|
||||
|
||||
static void gimp_color_display_class_init (GimpColorDisplayClass *klass);
|
||||
static void gimp_color_display_init (GimpColorDisplay *display);
|
||||
|
||||
|
||||
static GObjectClass *parent_class = NULL;
|
||||
|
||||
|
||||
GType
|
||||
gimp_color_display_get_type (void)
|
||||
{
|
||||
static GType display_type = 0;
|
||||
|
||||
if (! display_type)
|
||||
{
|
||||
static const GTypeInfo display_info =
|
||||
{
|
||||
sizeof (GimpColorDisplayClass),
|
||||
(GBaseInitFunc) NULL,
|
||||
(GBaseFinalizeFunc) NULL,
|
||||
(GClassInitFunc) gimp_color_display_class_init,
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
sizeof (GimpColorDisplay),
|
||||
0, /* n_preallocs */
|
||||
(GInstanceInitFunc) gimp_color_display_init,
|
||||
};
|
||||
|
||||
display_type = g_type_register_static (G_TYPE_OBJECT,
|
||||
"GimpColorDisplay",
|
||||
&display_info, 0);
|
||||
}
|
||||
|
||||
return display_type;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_color_display_class_init (GimpColorDisplayClass *klass)
|
||||
{
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
klass->clone = NULL;
|
||||
klass->convert = NULL;
|
||||
klass->load_state = NULL;
|
||||
klass->save_state = NULL;
|
||||
klass->configure = NULL;
|
||||
klass->configure_cancel = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_color_display_init (GimpColorDisplay *display)
|
||||
{
|
||||
}
|
||||
|
||||
GimpColorDisplay *
|
||||
gimp_color_display_new (GType display_type)
|
||||
{
|
||||
GimpColorDisplay *display;
|
||||
|
||||
g_return_val_if_fail (g_type_is_a (display_type, GIMP_TYPE_COLOR_DISPLAY),
|
||||
NULL);
|
||||
|
||||
display = g_object_new (display_type, NULL);
|
||||
|
||||
return display;
|
||||
}
|
||||
|
||||
GimpColorDisplay *
|
||||
gimp_color_display_clone (GimpColorDisplay *display)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_COLOR_DISPLAY (display), NULL);
|
||||
|
||||
if (GIMP_COLOR_DISPLAY_GET_CLASS (display)->clone)
|
||||
return GIMP_COLOR_DISPLAY_GET_CLASS (display)->clone (display);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_color_display_convert (GimpColorDisplay *display,
|
||||
guchar *buf,
|
||||
gint width,
|
||||
gint height,
|
||||
gint bpp,
|
||||
gint bpl)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_COLOR_DISPLAY (display));
|
||||
|
||||
if (GIMP_COLOR_DISPLAY_GET_CLASS (display)->convert)
|
||||
GIMP_COLOR_DISPLAY_GET_CLASS (display)->convert (display, buf,
|
||||
width, height,
|
||||
bpp, bpl);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_color_display_load_state (GimpColorDisplay *display,
|
||||
GimpParasite *state)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_COLOR_DISPLAY (display));
|
||||
g_return_if_fail (state != NULL);
|
||||
|
||||
if (GIMP_COLOR_DISPLAY_GET_CLASS (display)->load_state)
|
||||
GIMP_COLOR_DISPLAY_GET_CLASS (display)->load_state (display, state);
|
||||
}
|
||||
|
||||
GimpParasite *
|
||||
gimp_color_display_save_state (GimpColorDisplay *display)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_COLOR_DISPLAY (display), NULL);
|
||||
|
||||
if (GIMP_COLOR_DISPLAY_GET_CLASS (display)->save_state)
|
||||
return GIMP_COLOR_DISPLAY_GET_CLASS (display)->save_state (display);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_color_display_configure (GimpColorDisplay *display,
|
||||
GFunc ok_func,
|
||||
gpointer ok_data,
|
||||
GFunc cancel_func,
|
||||
gpointer cancel_data)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_COLOR_DISPLAY (display));
|
||||
|
||||
if (GIMP_COLOR_DISPLAY_GET_CLASS (display)->configure)
|
||||
GIMP_COLOR_DISPLAY_GET_CLASS (display)->configure (display,
|
||||
ok_func, ok_data,
|
||||
cancel_func, cancel_data);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_color_display_configure_cancel (GimpColorDisplay *display)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_COLOR_DISPLAY (display));
|
||||
|
||||
if (GIMP_COLOR_DISPLAY_GET_CLASS (display)->configure_cancel)
|
||||
GIMP_COLOR_DISPLAY_GET_CLASS (display)->configure_cancel (display);
|
||||
}
|
||||
94
libgimpwidgets/gimpcolordisplay.h
Normal file
94
libgimpwidgets/gimpcolordisplay.h
Normal file
@ -0,0 +1,94 @@
|
||||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1999 Manish Singh <yosh@gimp.org>
|
||||
*
|
||||
* This program 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 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 Lesser 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_COLOR_DISPLAY_H__
|
||||
#define __GIMP_COLOR_DISPLAY_H__
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/* For information look at the html documentation */
|
||||
|
||||
|
||||
#define GIMP_TYPE_COLOR_DISPLAY (gimp_color_display_get_type ())
|
||||
#define GIMP_COLOR_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_COLOR_DISPLAY, GimpColorDisplay))
|
||||
#define GIMP_COLOR_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_COLOR_DISPLAY, GimpColorDisplayClass))
|
||||
#define GIMP_IS_COLOR_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_COLOR_DISPLAY))
|
||||
#define GIMP_IS_COLOR_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_COLOR_DISPLAY))
|
||||
#define GIMP_COLOR_DISPLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_COLOR_DISPLAY, GimpColorDisplayClass))
|
||||
|
||||
|
||||
typedef struct _GimpColorDisplayClass GimpColorDisplayClass;
|
||||
|
||||
struct _GimpColorDisplay
|
||||
{
|
||||
GObject parent_instance;
|
||||
};
|
||||
|
||||
struct _GimpColorDisplayClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
|
||||
const gchar *name;
|
||||
const gchar *help_page;
|
||||
|
||||
/* virtual functions */
|
||||
GimpColorDisplay * (* clone) (GimpColorDisplay *display);
|
||||
void (* convert) (GimpColorDisplay *display,
|
||||
guchar *buf,
|
||||
gint width,
|
||||
gint height,
|
||||
gint bpp,
|
||||
gint bpl);
|
||||
|
||||
void (* load_state) (GimpColorDisplay *display,
|
||||
GimpParasite *state);
|
||||
GimpParasite * (* save_state) (GimpColorDisplay *display);
|
||||
void (* configure) (GimpColorDisplay *display,
|
||||
GFunc ok_func,
|
||||
gpointer ok_data,
|
||||
GFunc cancel_func,
|
||||
gpointer cancel_data);
|
||||
void (* configure_cancel) (GimpColorDisplay *display);
|
||||
};
|
||||
|
||||
|
||||
GType gimp_color_display_get_type (void) G_GNUC_CONST;
|
||||
GimpColorDisplay * gimp_color_display_new (GType display_type);
|
||||
|
||||
GimpColorDisplay * gimp_color_display_clone (GimpColorDisplay *display);
|
||||
|
||||
void gimp_color_display_convert (GimpColorDisplay *display,
|
||||
guchar *buf,
|
||||
gint width,
|
||||
gint height,
|
||||
gint bpp,
|
||||
gint bpl);
|
||||
void gimp_color_display_load_state (GimpColorDisplay *display,
|
||||
GimpParasite *state);
|
||||
GimpParasite * gimp_color_display_save_state (GimpColorDisplay *display);
|
||||
void gimp_color_display_configure (GimpColorDisplay *display,
|
||||
GFunc ok_func,
|
||||
gpointer ok_data,
|
||||
GFunc cancel_func,
|
||||
gpointer cancel_data);
|
||||
void gimp_color_display_configure_cancel (GimpColorDisplay *display);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GIMP_COLOR_DISPLAY_H__ */
|
||||
File diff suppressed because it is too large
Load Diff
41
libgimpwidgets/gimpcolorselect.h
Normal file
41
libgimpwidgets/gimpcolorselect.h
Normal file
@ -0,0 +1,41 @@
|
||||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GIMP_COLOR_SELECT_H__
|
||||
#define __GIMP_COLOR_SELECT_H__
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
#define GIMP_TYPE_COLOR_SELECT (gimp_color_select_get_type ())
|
||||
#define GIMP_COLOR_SELECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_COLOR_SELECT, GimpColorSelect))
|
||||
#define GIMP_COLOR_SELECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_COLOR_SELECT, GimpColorSelectClass))
|
||||
#define GIMP_IS_COLOR_SELECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_COLOR_SELECT))
|
||||
#define GIMP_IS_COLOR_SELECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_COLOR_SELECT))
|
||||
#define GIMP_COLOR_SELECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_COLOR_SELECT, GimpColorSelectClass))
|
||||
|
||||
|
||||
typedef struct _GimpColorSelectClass GimpColorSelectClass;
|
||||
|
||||
|
||||
GType gimp_color_select_get_type (void) G_GNUC_CONST;
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GIMP_COLOR_SELECT_H__ */
|
||||
161
libgimpwidgets/gimpcolorselector.c
Normal file
161
libgimpwidgets/gimpcolorselector.c
Normal file
@ -0,0 +1,161 @@
|
||||
/* LIBGIMP - The GIMP Library
|
||||
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
|
||||
*
|
||||
* gimpcolorselector.c
|
||||
* Copyright (C) 2002 Michael Natterer <mitch@gimp.org>
|
||||
*
|
||||
* based on:
|
||||
* Colour selector module
|
||||
* Copyright (C) 1999 Austin Donnelly <austin@greenend.org.uk>
|
||||
*
|
||||
* This program 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 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 Lesser General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpcolor/gimpcolor.h"
|
||||
|
||||
#include "gimpwidgetstypes.h"
|
||||
|
||||
#include "gimpcolorselector.h"
|
||||
#include "gimpwidgetsmarshal.h"
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
COLOR_CHANGED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
|
||||
static void gimp_color_selector_class_init (GimpColorSelectorClass *klass);
|
||||
static void gimp_color_selector_init (GimpColorSelector *selector);
|
||||
|
||||
|
||||
static GtkVBoxClass *parent_class = NULL;
|
||||
|
||||
static guint selector_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
|
||||
GType
|
||||
gimp_color_selector_get_type (void)
|
||||
{
|
||||
static GType selector_type = 0;
|
||||
|
||||
if (! selector_type)
|
||||
{
|
||||
static const GTypeInfo selector_info =
|
||||
{
|
||||
sizeof (GimpColorSelectorClass),
|
||||
(GBaseInitFunc) NULL,
|
||||
(GBaseFinalizeFunc) NULL,
|
||||
(GClassInitFunc) gimp_color_selector_class_init,
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
sizeof (GimpColorSelector),
|
||||
0, /* n_preallocs */
|
||||
(GInstanceInitFunc) gimp_color_selector_init,
|
||||
};
|
||||
|
||||
selector_type = g_type_register_static (GTK_TYPE_VBOX,
|
||||
"GimpColorSelector",
|
||||
&selector_info, 0);
|
||||
}
|
||||
|
||||
return selector_type;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_color_selector_class_init (GimpColorSelectorClass *klass)
|
||||
{
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
selector_signals[COLOR_CHANGED] =
|
||||
g_signal_new ("color_changed",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (GimpColorSelectorClass, color_changed),
|
||||
NULL, NULL,
|
||||
_gimp_widgets_marshal_VOID__POINTER_POINTER,
|
||||
G_TYPE_NONE, 2,
|
||||
G_TYPE_POINTER,
|
||||
G_TYPE_POINTER);
|
||||
|
||||
klass->set_color = NULL;
|
||||
klass->set_channel = NULL;
|
||||
klass->color_changed = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_color_selector_init (GimpColorSelector *selector)
|
||||
{
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gimp_color_selector_new (GType selector_type,
|
||||
const GimpRGB *rgb,
|
||||
const GimpHSV *hsv)
|
||||
{
|
||||
GimpColorSelector *selector;
|
||||
|
||||
g_return_val_if_fail (g_type_is_a (selector_type, GIMP_TYPE_COLOR_SELECTOR),
|
||||
NULL);
|
||||
g_return_val_if_fail (rgb != NULL, NULL);
|
||||
g_return_val_if_fail (hsv != NULL, NULL);
|
||||
|
||||
selector = g_object_new (selector_type, NULL);
|
||||
|
||||
gimp_color_selector_set_color (selector, rgb, hsv);
|
||||
|
||||
return GTK_WIDGET (selector);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_color_selector_set_color (GimpColorSelector *selector,
|
||||
const GimpRGB *rgb,
|
||||
const GimpHSV *hsv)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_COLOR_SELECTOR (selector));
|
||||
g_return_if_fail (rgb != NULL);
|
||||
g_return_if_fail (hsv != NULL);
|
||||
|
||||
if (GIMP_COLOR_SELECTOR_GET_CLASS (selector)->set_color)
|
||||
GIMP_COLOR_SELECTOR_GET_CLASS (selector)->set_color (selector, rgb, hsv);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_color_selector_set_channel (GimpColorSelector *selector,
|
||||
GimpColorSelectorChannel channel)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_COLOR_SELECTOR (selector));
|
||||
|
||||
if (GIMP_COLOR_SELECTOR_GET_CLASS (selector)->set_channel)
|
||||
GIMP_COLOR_SELECTOR_GET_CLASS (selector)->set_channel (selector, channel);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_color_selector_color_changed (GimpColorSelector *selector,
|
||||
const GimpRGB *rgb,
|
||||
const GimpHSV *hsv)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_COLOR_SELECTOR (selector));
|
||||
g_return_if_fail (rgb != NULL);
|
||||
g_return_if_fail (hsv != NULL);
|
||||
|
||||
g_signal_emit (G_OBJECT (selector), selector_signals[COLOR_CHANGED], 0,
|
||||
rgb, hsv);
|
||||
}
|
||||
104
libgimpwidgets/gimpcolorselector.h
Normal file
104
libgimpwidgets/gimpcolorselector.h
Normal file
@ -0,0 +1,104 @@
|
||||
/* LIBGIMP - The GIMP Library
|
||||
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
|
||||
*
|
||||
* gimpcolorselector.h
|
||||
* Copyright (C) 2002 Michael Natterer <mitch@gimp.org>
|
||||
*
|
||||
* based on:
|
||||
* Colour selector module
|
||||
* Copyright (C) 1999 Austin Donnelly <austin@greenend.org.uk>
|
||||
*
|
||||
* This program 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 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 Lesser 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_COLOR_SELECTOR_H__
|
||||
#define __GIMP_COLOR_SELECTOR_H__
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/* For information look at the html documentation */
|
||||
|
||||
|
||||
#define GIMP_COLOR_SELECTOR_SIZE 150
|
||||
#define GIMP_COLOR_SELECTOR_BAR_SIZE 15
|
||||
|
||||
|
||||
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;
|
||||
|
||||
|
||||
#define GIMP_TYPE_COLOR_SELECTOR (gimp_color_selector_get_type ())
|
||||
#define GIMP_COLOR_SELECTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_COLOR_SELECTOR, GimpColorSelector))
|
||||
#define GIMP_COLOR_SELECTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_COLOR_SELECTOR, GimpColorSelectorClass))
|
||||
#define GIMP_IS_COLOR_SELECTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_COLOR_SELECTOR))
|
||||
#define GIMP_IS_COLOR_SELECTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_COLOR_SELECTOR))
|
||||
#define GIMP_COLOR_SELECTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_COLOR_SELECTOR, GimpColorSelectorClass))
|
||||
|
||||
|
||||
typedef struct _GimpColorSelectorClass GimpColorSelectorClass;
|
||||
|
||||
struct _GimpColorSelector
|
||||
{
|
||||
GtkVBox parent_instance;
|
||||
};
|
||||
|
||||
struct _GimpColorSelectorClass
|
||||
{
|
||||
GtkVBoxClass parent_class;
|
||||
|
||||
const gchar *name;
|
||||
const gchar *help_page;
|
||||
|
||||
/* virtual functions */
|
||||
void (* set_color) (GimpColorSelector *selector,
|
||||
const GimpRGB *rgb,
|
||||
const GimpHSV *hsv);
|
||||
void (* set_channel) (GimpColorSelector *selector,
|
||||
GimpColorSelectorChannel channel);
|
||||
|
||||
/* signals */
|
||||
void (* color_changed) (GimpColorSelector *selector,
|
||||
const GimpRGB *rgb,
|
||||
const GimpHSV *hsv);
|
||||
};
|
||||
|
||||
|
||||
GType gimp_color_selector_get_type (void) G_GNUC_CONST;
|
||||
GtkWidget * gimp_color_selector_new (GType selector_type,
|
||||
const GimpRGB *rgb,
|
||||
const GimpHSV *hsv);
|
||||
|
||||
void gimp_color_selector_set_color (GimpColorSelector *selector,
|
||||
const GimpRGB *rgb,
|
||||
const GimpHSV *hsv);
|
||||
void gimp_color_selector_set_channel (GimpColorSelector *selector,
|
||||
GimpColorSelectorChannel channel);
|
||||
|
||||
void gimp_color_selector_color_changed (GimpColorSelector *selector,
|
||||
const GimpRGB *rgb,
|
||||
const GimpHSV *hsv);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GIMP_COLOR_SELECTOR_H__ */
|
||||
@ -30,6 +30,9 @@
|
||||
#include <libgimpwidgets/gimpchainbutton.h>
|
||||
#include <libgimpwidgets/gimpcolorarea.h>
|
||||
#include <libgimpwidgets/gimpcolorbutton.h>
|
||||
#include <libgimpwidgets/gimpcolordisplay.h>
|
||||
#include <libgimpwidgets/gimpcolorselector.h>
|
||||
#include <libgimpwidgets/gimpcolorselect.h>
|
||||
#include <libgimpwidgets/gimpdialog.h>
|
||||
#include <libgimpwidgets/gimpfileselection.h>
|
||||
#include <libgimpwidgets/gimphelpui.h>
|
||||
|
||||
@ -1 +1,2 @@
|
||||
NONE:INT,INT
|
||||
NONE:POINTER,POINTER
|
||||
|
||||
@ -48,6 +48,9 @@ typedef struct _GimpButton GimpButton;
|
||||
typedef struct _GimpChainButton GimpChainButton;
|
||||
typedef struct _GimpColorArea GimpColorArea;
|
||||
typedef struct _GimpColorButton GimpColorButton;
|
||||
typedef struct _GimpColorDisplay GimpColorDisplay;
|
||||
typedef struct _GimpColorSelector GimpColorSelector;
|
||||
typedef struct _GimpColorSelect GimpColorSelect;
|
||||
typedef struct _GimpDialog GimpDialog;
|
||||
typedef struct _GimpFileSelection GimpFileSelection;
|
||||
typedef struct _GimpOffsetArea GimpOffsetArea;
|
||||
|
||||
Reference in New Issue
Block a user