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

libgimpwidgets/Makefile.am libgimpwidgets/gimpwidgets.h

2003-11-21  Michael Natterer  <mitch@gimp.org>

	* libgimpwidgets/Makefile.am
	* libgimpwidgets/gimpwidgets.h
	* libgimpwidgets/gimpwidgetstypes.h
	* libgimpwidgets/gimpcolordisplaystack.[ch]: new object
	GimpColorDisplayStack which manages a list of GimpColorDisplays.
	(unfinished, just for others to look at).
parent cf3e046f
2003-11-21 Michael Natterer <mitch@gimp.org>
* libgimpwidgets/Makefile.am
* libgimpwidgets/gimpwidgets.h
* libgimpwidgets/gimpwidgetstypes.h
* libgimpwidgets/gimpcolordisplaystack.[ch]: new object
GimpColorDisplayStack which manages a list of GimpColorDisplays.
(unfinished, just for others to look at).
2003-11-21 Sven Neumann <sven@gimp.org>
 
* libgimpwidgets/makefile.msc: s/gimpfileselection/gimpfileentry/
......@@ -74,6 +74,8 @@ libgimpwidgets_1_3_la_sources = \
gimpcolorbutton.h \
gimpcolordisplay.c \
gimpcolordisplay.h \
gimpcolordisplaystack.c \
gimpcolordisplaystack.h \
gimpcolornotebook.c \
gimpcolornotebook.h \
gimpcolorscale.c \
......@@ -136,6 +138,7 @@ libgimpwidgetsinclude_HEADERS = \
gimpcolorarea.h \
gimpcolorbutton.h \
gimpcolordisplay.h \
gimpcolordisplaystack.h \
gimpcolornotebook.h \
gimpcolorscale.h \
gimpcolorscales.h \
......
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
*
* gimpcolordisplaystack.c
* Copyright (C) 2003 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"
#include "gimpcolordisplaystack.h"
enum
{
CHANGED,
LAST_SIGNAL
};
static void gimp_color_display_stack_class_init (GimpColorDisplayStackClass *klass);
static void gimp_color_display_stack_init (GimpColorDisplayStack *stack);
static void gimp_color_display_stack_finalize (GObject *object);
static GObjectClass *parent_class = NULL;
static guint stack_signals[LAST_SIGNAL] = { 0 };
GType
gimp_color_display_stack_get_type (void)
{
static GType display_type = 0;
if (! display_type)
{
static const GTypeInfo display_info =
{
sizeof (GimpColorDisplayStackClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_color_display_stack_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpColorDisplayStack),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_color_display_stack_init,
};
display_type = g_type_register_static (G_TYPE_OBJECT,
"GimpColorDisplayStack",
&display_info, 0);
}
return display_type;
}
static void
gimp_color_display_stack_class_init (GimpColorDisplayStackClass *klass)
{
GObjectClass *object_class;
object_class = G_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
stack_signals[CHANGED] =
g_signal_new ("changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpColorDisplayStackClass, changed),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
object_class->finalize = gimp_color_display_stack_finalize;
klass->changed = NULL;
}
static void
gimp_color_display_stack_init (GimpColorDisplayStack *stack)
{
stack->filters = NULL;
}
static void
gimp_color_display_stack_finalize (GObject *object)
{
GimpColorDisplayStack *stack = GIMP_COLOR_DISPLAY_STACK (object);
if (stack->filters)
{
g_list_foreach (stack->filters, (GFunc) g_object_unref, NULL);
g_list_free (stack->filters);
stack->filters = NULL;
}
G_OBJECT_CLASS (parent_class)->finalize (object);
}
GimpColorDisplayStack *
gimp_color_display_stack_new (void)
{
GimpColorDisplayStack *stack;
stack = g_object_new (GIMP_TYPE_COLOR_DISPLAY_STACK, NULL);
return stack;
}
GimpColorDisplayStack *
gimp_color_display_stack_clone (GimpColorDisplayStack *stack)
{
GimpColorDisplayStack *clone;
GList *list;
g_return_val_if_fail (GIMP_IS_COLOR_DISPLAY_STACK (stack), NULL);
clone = g_object_new (GIMP_TYPE_COLOR_DISPLAY_STACK, NULL);
for (list = stack->filters; list; list = g_list_next (list))
{
GimpColorDisplay *display;
display = gimp_color_display_clone (list->data);
gimp_color_display_stack_add (clone, display);
g_object_unref (display);
}
return clone;
}
void
gimp_color_display_stack_changed (GimpColorDisplayStack *stack)
{
g_return_if_fail (GIMP_IS_COLOR_DISPLAY_STACK (stack));
g_signal_emit (stack, stack_signals[CHANGED], 0);
}
void
gimp_color_display_stack_add (GimpColorDisplayStack *stack,
GimpColorDisplay *display)
{
g_return_if_fail (GIMP_IS_COLOR_DISPLAY_STACK (stack));
g_return_if_fail (GIMP_IS_COLOR_DISPLAY (display));
g_return_if_fail (g_list_find (stack->filters, display) == NULL);
stack->filters = g_list_append (stack->filters, g_object_ref (display));
g_signal_connect_object (display, "changed",
G_CALLBACK (gimp_color_display_stack_changed),
G_OBJECT (stack),
G_CONNECT_SWAPPED);
gimp_color_display_stack_changed (stack);
}
void
gimp_color_display_stack_remove (GimpColorDisplayStack *stack,
GimpColorDisplay *display)
{
g_return_if_fail (GIMP_IS_COLOR_DISPLAY_STACK (stack));
g_return_if_fail (GIMP_IS_COLOR_DISPLAY (display));
g_return_if_fail (g_list_find (stack->filters, display) != NULL);
g_signal_handlers_disconnect_by_func (display,
gimp_color_display_stack_changed,
stack);
stack->filters = g_list_remove (stack->filters, display);
g_object_unref (display);
gimp_color_display_stack_changed (stack);
}
void
gimp_color_display_stack_reorder_up (GimpColorDisplayStack *stack,
GimpColorDisplay *display)
{
GList *list;
g_return_if_fail (GIMP_IS_COLOR_DISPLAY_STACK (stack));
g_return_if_fail (GIMP_IS_COLOR_DISPLAY (display));
list = g_list_find (stack->filters, display);
g_return_if_fail (list != NULL);
if (list->prev)
{
list->data = list->prev->data;
list->prev->data = display;
gimp_color_display_stack_changed (stack);
}
}
void
gimp_color_display_stack_reorder_down (GimpColorDisplayStack *stack,
GimpColorDisplay *display)
{
GList *list;
g_return_if_fail (GIMP_IS_COLOR_DISPLAY_STACK (stack));
g_return_if_fail (GIMP_IS_COLOR_DISPLAY (display));
list = g_list_find (stack->filters, display);
g_return_if_fail (list != NULL);
if (list->next)
{
list->data = list->next->data;
list->next->data = display;
gimp_color_display_stack_changed (stack);
}
}
void
gimp_color_display_stack_convert (GimpColorDisplayStack *stack,
guchar *buf,
gint width,
gint height,
gint bpp,
gint bpl)
{
GList *list;
g_return_if_fail (GIMP_IS_COLOR_DISPLAY_STACK (stack));
for (list = stack->filters; list; list = g_list_next (list))
{
GimpColorDisplay *display = list->data;
gimp_color_display_convert (display, buf, width, height, bpp, bpl);
}
}
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
*
* gimpcolordisplaystack.h
* Copyright (C) 2003 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.
*/
#ifndef __GIMP_COLOR_DISPLAY_STACK_H__
#define __GIMP_COLOR_DISPLAY_STACK_H__
G_BEGIN_DECLS
/* For information look at the html documentation */
#define GIMP_TYPE_COLOR_DISPLAY_STACK (gimp_color_display_stack_get_type ())
#define GIMP_COLOR_DISPLAY_STACK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_COLOR_DISPLAY_STACK, GimpColorDisplayStack))
#define GIMP_COLOR_DISPLAY_STACK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_COLOR_DISPLAY_STACK, GimpColorDisplayStackClass))
#define GIMP_IS_COLOR_DISPLAY_STACK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_COLOR_DISPLAY_STACK))
#define GIMP_IS_COLOR_DISPLAY_STACK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_COLOR_DISPLAY_STACK))
#define GIMP_COLOR_DISPLAY_STACK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_COLOR_DISPLAY_STACK, GimpColorDisplayStackClass))
typedef struct _GimpColorDisplayStackClass GimpColorDisplayStackClass;
struct _GimpColorDisplayStack
{
GObject parent_instance;
GList *filters;
};
struct _GimpColorDisplayStackClass
{
GObjectClass parent_class;
void (* changed) (GimpColorDisplayStack *stack);
};
GType gimp_color_display_stack_get_type (void) G_GNUC_CONST;
GimpColorDisplayStack * gimp_color_display_stack_new (void);
void gimp_color_display_stack_changed (GimpColorDisplayStack *stack);
void gimp_color_display_stack_add (GimpColorDisplayStack *stack,
GimpColorDisplay *display);
void gimp_color_display_stack_remove (GimpColorDisplayStack *stack,
GimpColorDisplay *display);
void gimp_color_display_stack_reorder_up (GimpColorDisplayStack *stack,
GimpColorDisplay *display);
void gimp_color_display_stack_reorder_down (GimpColorDisplayStack *stack,
GimpColorDisplay *display);
void gimp_color_display_stack_convert (GimpColorDisplayStack *stack,
guchar *buf,
gint width,
gint height,
gint bpp,
gint bpl);
G_END_DECLS
#endif /* __GIMP_COLOR_DISPLAY_STACK_H__ */
......@@ -31,6 +31,7 @@
#include <libgimpwidgets/gimpcolorarea.h>
#include <libgimpwidgets/gimpcolorbutton.h>
#include <libgimpwidgets/gimpcolordisplay.h>
#include <libgimpwidgets/gimpcolordisplaystack.h>
#include <libgimpwidgets/gimpcolornotebook.h>
#include <libgimpwidgets/gimpcolorscale.h>
#include <libgimpwidgets/gimpcolorscales.h>
......
......@@ -55,26 +55,27 @@ typedef enum
} GimpSizeEntryUpdatePolicy;
typedef struct _GimpButton GimpButton;
typedef struct _GimpChainButton GimpChainButton;
typedef struct _GimpColorArea GimpColorArea;
typedef struct _GimpColorButton GimpColorButton;
typedef struct _GimpColorDisplay GimpColorDisplay;
typedef struct _GimpColorNotebook GimpColorNotebook;
typedef struct _GimpColorScale GimpColorScale;
typedef struct _GimpColorScales GimpColorScales;
typedef struct _GimpColorSelector GimpColorSelector;
typedef struct _GimpColorSelect GimpColorSelect;
typedef struct _GimpColorSelection GimpColorSelection;
typedef struct _GimpDialog GimpDialog;
typedef struct _GimpFileEntry GimpFileEntry;
typedef struct _GimpMemsizeEntry GimpMemsizeEntry;
typedef struct _GimpOffsetArea GimpOffsetArea;
typedef struct _GimpPathEditor GimpPathEditor;
typedef struct _GimpPickButton GimpPickButton;
typedef struct _GimpPixmap GimpPixmap;
typedef struct _GimpSizeEntry GimpSizeEntry;
typedef struct _GimpUnitMenu GimpUnitMenu;
typedef struct _GimpButton GimpButton;
typedef struct _GimpChainButton GimpChainButton;
typedef struct _GimpColorArea GimpColorArea;
typedef struct _GimpColorButton GimpColorButton;
typedef struct _GimpColorDisplay GimpColorDisplay;
typedef struct _GimpColorDisplayStack GimpColorDisplayStack;
typedef struct _GimpColorNotebook GimpColorNotebook;
typedef struct _GimpColorScale GimpColorScale;
typedef struct _GimpColorScales GimpColorScales;
typedef struct _GimpColorSelector GimpColorSelector;
typedef struct _GimpColorSelect GimpColorSelect;
typedef struct _GimpColorSelection GimpColorSelection;
typedef struct _GimpDialog GimpDialog;
typedef struct _GimpFileEntry GimpFileEntry;
typedef struct _GimpMemsizeEntry GimpMemsizeEntry;
typedef struct _GimpOffsetArea GimpOffsetArea;
typedef struct _GimpPathEditor GimpPathEditor;
typedef struct _GimpPickButton GimpPickButton;
typedef struct _GimpPixmap GimpPixmap;
typedef struct _GimpSizeEntry GimpSizeEntry;
typedef struct _GimpUnitMenu GimpUnitMenu;
typedef void (* GimpHelpFunc) (const gchar *help_id,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment