2003-11-22 05:27:10 +08:00
|
|
|
/* LIBGIMP - The GIMP Library
|
|
|
|
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
|
|
|
|
*
|
|
|
|
* gimpcolordisplaystack.c
|
|
|
|
* Copyright (C) 2003 Michael Natterer <mitch@gimp.org>
|
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This library is free software: you can redistribute it and/or
|
2003-11-23 21:28:15 +08:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
2009-01-18 06:28:01 +08:00
|
|
|
* version 3 of the License, or (at your option) any later version.
|
2003-11-22 05:27:10 +08:00
|
|
|
*
|
2003-11-23 21:28:15 +08:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
2003-11-22 05:27:10 +08:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2003-11-23 21:28:15 +08:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2003-11-22 05:27:10 +08:00
|
|
|
*
|
2003-11-23 21:28:15 +08:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2009-01-18 06:28:01 +08:00
|
|
|
* License along with this library. If not, see
|
2018-07-12 05:27:07 +08:00
|
|
|
* <https://www.gnu.org/licenses/>.
|
2003-11-22 05:27:10 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2012-05-03 09:36:22 +08:00
|
|
|
#include <gegl.h>
|
2003-11-22 05:27:10 +08:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
#include "libgimpcolor/gimpcolor.h"
|
|
|
|
|
|
|
|
#include "gimpwidgetstypes.h"
|
|
|
|
|
|
|
|
#include "gimpcolordisplay.h"
|
|
|
|
#include "gimpcolordisplaystack.h"
|
2003-11-22 23:54:12 +08:00
|
|
|
#include "gimpwidgetsmarshal.h"
|
2003-11-22 05:27:10 +08:00
|
|
|
|
|
|
|
|
2010-07-06 00:01:28 +08:00
|
|
|
/**
|
|
|
|
* SECTION: gimpcolordisplaystack
|
|
|
|
* @title: GimpColorDisplayStack
|
|
|
|
* @short_description: A stack of color correction modules.
|
|
|
|
* @see_also: #GimpColorDisplay
|
|
|
|
*
|
|
|
|
* A stack of color correction modules.
|
|
|
|
**/
|
|
|
|
|
|
|
|
|
2003-11-22 05:27:10 +08:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
CHANGED,
|
2003-11-22 23:54:12 +08:00
|
|
|
ADDED,
|
|
|
|
REMOVED,
|
|
|
|
REORDERED,
|
2003-11-22 05:27:10 +08:00
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2024-08-01 11:55:31 +08:00
|
|
|
typedef struct _GimpColorDisplayStackPrivate
|
2011-01-01 02:11:27 +08:00
|
|
|
{
|
|
|
|
GList *filters;
|
2024-08-01 11:55:31 +08:00
|
|
|
} GimpColorDisplayStackPrivate;
|
2011-01-01 02:11:27 +08:00
|
|
|
|
|
|
|
|
2007-08-08 20:27:11 +08:00
|
|
|
static void gimp_color_display_stack_dispose (GObject *object);
|
2003-11-23 20:08:21 +08:00
|
|
|
|
|
|
|
static void gimp_color_display_stack_display_changed (GimpColorDisplay *display,
|
|
|
|
GimpColorDisplayStack *stack);
|
|
|
|
static void gimp_color_display_stack_display_enabled (GimpColorDisplay *display,
|
2003-11-23 21:08:56 +08:00
|
|
|
GParamSpec *pspec,
|
2003-11-23 20:08:21 +08:00
|
|
|
GimpColorDisplayStack *stack);
|
2007-08-08 20:27:11 +08:00
|
|
|
static void gimp_color_display_stack_disconnect (GimpColorDisplayStack *stack,
|
|
|
|
GimpColorDisplay *display);
|
2003-11-23 20:08:21 +08:00
|
|
|
|
2003-11-22 05:27:10 +08:00
|
|
|
|
app, libgimp*, modules: don't use g_type_class_add_private() ...
... and G_TYPE_INSTANCE_GET_PRIVATE()
g_type_class_add_private() and G_TYPE_INSTANCE_GET_PRIVATE() were
deprecated in GLib 2.58. Instead, use
G_DEFINE_[ABSTRACT_]TYPE_WITH_PRIVATE(), and
G_ADD_PRIVATE[_DYNAMIC](), and the implictly-defined
foo_get_instance_private() functions, all of which are available in
the GLib versions we depend on.
This commit only covers types registered using one of the
G_DEFINE_FOO() macros (i.e., most types), but not types with a
custom registration function, of which we still have a few -- GLib
currently only provides a (non-deprecated) public API for adding a
private struct using the G_DEFINE_FOO() macros.
Note that this commit was 99% auto-generated (because I'm not
*that* crazy :), so if there are any style mismatches... we'll have
to live with them for now.
2018-09-19 00:09:39 +08:00
|
|
|
G_DEFINE_TYPE_WITH_PRIVATE (GimpColorDisplayStack, gimp_color_display_stack,
|
|
|
|
G_TYPE_OBJECT)
|
2003-11-22 05:27:10 +08:00
|
|
|
|
2005-12-21 04:35:23 +08:00
|
|
|
#define parent_class gimp_color_display_stack_parent_class
|
2003-11-22 05:27:10 +08:00
|
|
|
|
2005-12-21 04:35:23 +08:00
|
|
|
static guint stack_signals[LAST_SIGNAL] = { 0 };
|
2003-11-22 05:27:10 +08:00
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_color_display_stack_class_init (GimpColorDisplayStackClass *klass)
|
|
|
|
{
|
2004-07-04 08:21:03 +08:00
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
2003-11-22 05:27:10 +08:00
|
|
|
|
|
|
|
stack_signals[CHANGED] =
|
|
|
|
g_signal_new ("changed",
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
G_STRUCT_OFFSET (GimpColorDisplayStackClass, changed),
|
2020-01-12 18:06:05 +08:00
|
|
|
NULL, NULL, NULL,
|
2003-11-22 05:27:10 +08:00
|
|
|
G_TYPE_NONE, 0);
|
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
stack_signals[ADDED] =
|
|
|
|
g_signal_new ("added",
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
G_STRUCT_OFFSET (GimpColorDisplayStackClass, added),
|
|
|
|
NULL, NULL,
|
|
|
|
_gimp_widgets_marshal_VOID__OBJECT_INT,
|
|
|
|
G_TYPE_NONE, 2,
|
|
|
|
GIMP_TYPE_COLOR_DISPLAY,
|
|
|
|
G_TYPE_INT);
|
|
|
|
|
|
|
|
stack_signals[REMOVED] =
|
|
|
|
g_signal_new ("removed",
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
G_STRUCT_OFFSET (GimpColorDisplayStackClass, removed),
|
2021-08-06 14:34:30 +08:00
|
|
|
NULL, NULL, NULL,
|
2003-11-22 23:54:12 +08:00
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
GIMP_TYPE_COLOR_DISPLAY);
|
|
|
|
|
|
|
|
stack_signals[REORDERED] =
|
|
|
|
g_signal_new ("reordered",
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
G_STRUCT_OFFSET (GimpColorDisplayStackClass, reordered),
|
|
|
|
NULL, NULL,
|
|
|
|
_gimp_widgets_marshal_VOID__OBJECT_INT,
|
|
|
|
G_TYPE_NONE, 2,
|
|
|
|
GIMP_TYPE_COLOR_DISPLAY,
|
|
|
|
G_TYPE_INT);
|
|
|
|
|
2007-08-08 20:27:11 +08:00
|
|
|
object_class->dispose = gimp_color_display_stack_dispose;
|
2003-11-22 05:27:10 +08:00
|
|
|
|
2007-08-08 20:27:11 +08:00
|
|
|
klass->changed = NULL;
|
|
|
|
klass->added = NULL;
|
|
|
|
klass->removed = NULL;
|
|
|
|
klass->reordered = NULL;
|
2003-11-22 05:27:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_color_display_stack_init (GimpColorDisplayStack *stack)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2007-08-08 20:27:11 +08:00
|
|
|
gimp_color_display_stack_dispose (GObject *object)
|
2003-11-22 05:27:10 +08:00
|
|
|
{
|
2011-01-01 02:11:27 +08:00
|
|
|
GimpColorDisplayStack *stack = GIMP_COLOR_DISPLAY_STACK (object);
|
2024-08-01 11:55:31 +08:00
|
|
|
GimpColorDisplayStackPrivate *private = gimp_color_display_stack_get_instance_private (stack);
|
2003-11-22 05:27:10 +08:00
|
|
|
|
2011-01-01 02:11:27 +08:00
|
|
|
if (private->filters)
|
2003-11-22 05:27:10 +08:00
|
|
|
{
|
2007-08-08 20:27:11 +08:00
|
|
|
GList *list;
|
|
|
|
|
2011-01-01 02:11:27 +08:00
|
|
|
for (list = private->filters; list; list = g_list_next (list))
|
2007-08-08 20:27:11 +08:00
|
|
|
{
|
|
|
|
GimpColorDisplay *display = list->data;
|
|
|
|
|
|
|
|
gimp_color_display_stack_disconnect (stack, display);
|
|
|
|
g_object_unref (display);
|
|
|
|
}
|
|
|
|
|
2011-01-01 02:11:27 +08:00
|
|
|
g_list_free (private->filters);
|
|
|
|
private->filters = NULL;
|
2003-11-22 05:27:10 +08:00
|
|
|
}
|
|
|
|
|
2007-08-08 20:27:11 +08:00
|
|
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
2003-11-22 05:27:10 +08:00
|
|
|
}
|
|
|
|
|
2011-01-01 02:11:27 +08:00
|
|
|
|
|
|
|
/* public functions */
|
|
|
|
|
2019-08-02 17:45:24 +08:00
|
|
|
/**
|
|
|
|
* gimp_color_display_stack_new:
|
|
|
|
*
|
|
|
|
* Creates a new stack of color correction modules.
|
|
|
|
*
|
|
|
|
* Returns: (transfer full): a newly allocated #GimpColorDisplayStack.
|
|
|
|
*
|
2019-08-18 20:07:17 +08:00
|
|
|
* Since: 2.0
|
2019-08-02 17:45:24 +08:00
|
|
|
**/
|
2003-11-22 05:27:10 +08:00
|
|
|
GimpColorDisplayStack *
|
|
|
|
gimp_color_display_stack_new (void)
|
|
|
|
{
|
2004-07-04 08:21:03 +08:00
|
|
|
return g_object_new (GIMP_TYPE_COLOR_DISPLAY_STACK, NULL);
|
2003-11-22 05:27:10 +08:00
|
|
|
}
|
|
|
|
|
2019-08-02 17:45:24 +08:00
|
|
|
/**
|
|
|
|
* gimp_color_display_stack_clone:
|
|
|
|
* @stack: a #GimpColorDisplayStack
|
|
|
|
*
|
|
|
|
* Creates a copy of @stack with all its display color modules also
|
|
|
|
* duplicated.
|
|
|
|
*
|
|
|
|
* Returns: (transfer full): a duplicate of @stack.
|
|
|
|
*
|
2019-08-18 20:07:17 +08:00
|
|
|
* Since: 2.0
|
2019-08-02 17:45:24 +08:00
|
|
|
**/
|
2003-11-22 05:27:10 +08:00
|
|
|
GimpColorDisplayStack *
|
|
|
|
gimp_color_display_stack_clone (GimpColorDisplayStack *stack)
|
|
|
|
{
|
2011-01-01 02:11:27 +08:00
|
|
|
GimpColorDisplayStackPrivate *private;
|
|
|
|
GimpColorDisplayStack *clone;
|
|
|
|
GList *list;
|
2003-11-22 05:27:10 +08:00
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_COLOR_DISPLAY_STACK (stack), NULL);
|
|
|
|
|
2024-08-01 11:55:31 +08:00
|
|
|
private = gimp_color_display_stack_get_instance_private (stack);
|
2011-01-01 02:11:27 +08:00
|
|
|
|
2003-11-22 05:27:10 +08:00
|
|
|
clone = g_object_new (GIMP_TYPE_COLOR_DISPLAY_STACK, NULL);
|
|
|
|
|
2011-01-01 02:11:27 +08:00
|
|
|
for (list = private->filters; list; list = g_list_next (list))
|
2003-11-22 05:27:10 +08:00
|
|
|
{
|
|
|
|
GimpColorDisplay *display;
|
|
|
|
|
|
|
|
display = gimp_color_display_clone (list->data);
|
|
|
|
|
|
|
|
gimp_color_display_stack_add (clone, display);
|
|
|
|
g_object_unref (display);
|
|
|
|
}
|
|
|
|
|
|
|
|
return clone;
|
|
|
|
}
|
|
|
|
|
2019-08-02 17:45:24 +08:00
|
|
|
/**
|
|
|
|
* gimp_color_display_stack_changed:
|
|
|
|
* @stack: a #GimpColorDisplayStack
|
|
|
|
*
|
|
|
|
* Emit the "changed" signal of @stack.
|
|
|
|
*
|
2019-08-18 20:07:17 +08:00
|
|
|
* Since: 2.0
|
2019-08-02 17:45:24 +08:00
|
|
|
**/
|
2003-11-22 05:27:10 +08:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2019-08-02 17:45:24 +08:00
|
|
|
/**
|
|
|
|
* gimp_color_display_stack_get_filters:
|
|
|
|
* @stack: a #GimpColorDisplayStack
|
|
|
|
*
|
|
|
|
* Gets the list of added color modules.
|
|
|
|
*
|
|
|
|
* Returns: (transfer none) (element-type GimpColorDisplay):
|
|
|
|
the list of @stack's display color modules.
|
|
|
|
*
|
|
|
|
* Since: 3.0
|
|
|
|
**/
|
2011-01-01 02:11:27 +08:00
|
|
|
GList *
|
|
|
|
gimp_color_display_stack_get_filters (GimpColorDisplayStack *stack)
|
|
|
|
{
|
2024-08-01 11:55:31 +08:00
|
|
|
GimpColorDisplayStackPrivate *private;
|
|
|
|
|
2011-01-01 02:11:27 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_COLOR_DISPLAY_STACK (stack), NULL);
|
|
|
|
|
2024-08-01 11:55:31 +08:00
|
|
|
private = gimp_color_display_stack_get_instance_private (stack);
|
|
|
|
|
|
|
|
return private->filters;
|
2011-01-01 02:11:27 +08:00
|
|
|
}
|
|
|
|
|
2019-08-02 17:45:24 +08:00
|
|
|
/**
|
|
|
|
* gimp_color_display_stack_add:
|
|
|
|
* @stack: a #GimpColorDisplayStack
|
|
|
|
* @display: (transfer none): a #GimpColorDisplay
|
|
|
|
*
|
|
|
|
* Add the color module @display to @stack.
|
|
|
|
*
|
2019-08-18 20:07:17 +08:00
|
|
|
* Since: 2.0
|
2019-08-02 17:45:24 +08:00
|
|
|
**/
|
2003-11-22 05:27:10 +08:00
|
|
|
void
|
|
|
|
gimp_color_display_stack_add (GimpColorDisplayStack *stack,
|
|
|
|
GimpColorDisplay *display)
|
|
|
|
{
|
2011-01-01 02:11:27 +08:00
|
|
|
GimpColorDisplayStackPrivate *private;
|
|
|
|
|
2003-11-22 05:27:10 +08:00
|
|
|
g_return_if_fail (GIMP_IS_COLOR_DISPLAY_STACK (stack));
|
|
|
|
g_return_if_fail (GIMP_IS_COLOR_DISPLAY (display));
|
|
|
|
|
2024-08-01 11:55:31 +08:00
|
|
|
private = gimp_color_display_stack_get_instance_private (stack);
|
2011-01-01 02:11:27 +08:00
|
|
|
|
|
|
|
g_return_if_fail (g_list_find (private->filters, display) == NULL);
|
|
|
|
|
|
|
|
private->filters = g_list_append (private->filters, g_object_ref (display));
|
2003-11-22 05:27:10 +08:00
|
|
|
|
2007-08-08 20:27:11 +08:00
|
|
|
g_signal_connect (display, "changed",
|
|
|
|
G_CALLBACK (gimp_color_display_stack_display_changed),
|
|
|
|
G_OBJECT (stack));
|
|
|
|
g_signal_connect (display, "notify::enabled",
|
|
|
|
G_CALLBACK (gimp_color_display_stack_display_enabled),
|
|
|
|
G_OBJECT (stack));
|
2003-11-22 05:27:10 +08:00
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
g_signal_emit (stack, stack_signals[ADDED], 0,
|
2011-01-01 02:11:27 +08:00
|
|
|
display, g_list_length (private->filters) - 1);
|
2003-11-22 23:54:12 +08:00
|
|
|
|
2003-11-22 05:27:10 +08:00
|
|
|
gimp_color_display_stack_changed (stack);
|
|
|
|
}
|
|
|
|
|
2019-08-02 17:45:24 +08:00
|
|
|
/**
|
|
|
|
* gimp_color_display_stack_remove:
|
|
|
|
* @stack: a #GimpColorDisplayStack
|
|
|
|
* @display: (transfer none): a #GimpColorDisplay
|
|
|
|
*
|
|
|
|
* Remove the color module @display from @stack.
|
|
|
|
*
|
2019-08-18 20:07:17 +08:00
|
|
|
* Since: 2.0
|
2019-08-02 17:45:24 +08:00
|
|
|
**/
|
2003-11-22 05:27:10 +08:00
|
|
|
void
|
|
|
|
gimp_color_display_stack_remove (GimpColorDisplayStack *stack,
|
|
|
|
GimpColorDisplay *display)
|
|
|
|
{
|
2011-01-01 02:11:27 +08:00
|
|
|
GimpColorDisplayStackPrivate *private;
|
|
|
|
|
2003-11-22 05:27:10 +08:00
|
|
|
g_return_if_fail (GIMP_IS_COLOR_DISPLAY_STACK (stack));
|
|
|
|
g_return_if_fail (GIMP_IS_COLOR_DISPLAY (display));
|
2011-01-01 02:11:27 +08:00
|
|
|
|
2024-08-01 11:55:31 +08:00
|
|
|
private = gimp_color_display_stack_get_instance_private (stack);
|
2011-01-01 02:11:27 +08:00
|
|
|
|
|
|
|
g_return_if_fail (g_list_find (private->filters, display) != NULL);
|
2003-11-22 05:27:10 +08:00
|
|
|
|
2007-08-08 20:27:11 +08:00
|
|
|
gimp_color_display_stack_disconnect (stack, display);
|
2003-11-22 05:27:10 +08:00
|
|
|
|
2011-01-01 02:11:27 +08:00
|
|
|
private->filters = g_list_remove (private->filters, display);
|
2003-11-22 23:54:12 +08:00
|
|
|
|
|
|
|
g_signal_emit (stack, stack_signals[REMOVED], 0, display);
|
2003-11-22 05:27:10 +08:00
|
|
|
|
|
|
|
gimp_color_display_stack_changed (stack);
|
2003-11-22 23:54:12 +08:00
|
|
|
|
|
|
|
g_object_unref (display);
|
2003-11-22 05:27:10 +08:00
|
|
|
}
|
|
|
|
|
2019-08-02 17:45:24 +08:00
|
|
|
/**
|
|
|
|
* gimp_color_display_stack_reorder_up:
|
|
|
|
* @stack: a #GimpColorDisplayStack
|
|
|
|
* @display: a #GimpColorDisplay
|
|
|
|
*
|
|
|
|
* Move the color module @display up in the filter list of @stack.
|
|
|
|
*
|
2019-08-18 20:07:17 +08:00
|
|
|
* Since: 2.0
|
2019-08-02 17:45:24 +08:00
|
|
|
**/
|
2003-11-22 05:27:10 +08:00
|
|
|
void
|
|
|
|
gimp_color_display_stack_reorder_up (GimpColorDisplayStack *stack,
|
|
|
|
GimpColorDisplay *display)
|
|
|
|
{
|
2011-01-01 02:11:27 +08:00
|
|
|
GimpColorDisplayStackPrivate *private;
|
|
|
|
GList *list;
|
2003-11-22 05:27:10 +08:00
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_COLOR_DISPLAY_STACK (stack));
|
|
|
|
g_return_if_fail (GIMP_IS_COLOR_DISPLAY (display));
|
|
|
|
|
2024-08-01 11:55:31 +08:00
|
|
|
private = gimp_color_display_stack_get_instance_private (stack);
|
2011-01-01 02:11:27 +08:00
|
|
|
|
|
|
|
list = g_list_find (private->filters, display);
|
2003-11-22 05:27:10 +08:00
|
|
|
|
|
|
|
g_return_if_fail (list != NULL);
|
|
|
|
|
|
|
|
if (list->prev)
|
|
|
|
{
|
|
|
|
list->data = list->prev->data;
|
|
|
|
list->prev->data = display;
|
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
g_signal_emit (stack, stack_signals[REORDERED], 0,
|
2011-01-01 02:11:27 +08:00
|
|
|
display, g_list_position (private->filters, list->prev));
|
2003-11-22 23:54:12 +08:00
|
|
|
|
2003-11-22 05:27:10 +08:00
|
|
|
gimp_color_display_stack_changed (stack);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-02 17:45:24 +08:00
|
|
|
/**
|
|
|
|
* gimp_color_display_stack_reorder_down:
|
|
|
|
* @stack: a #GimpColorDisplayStack
|
|
|
|
* @display: a #GimpColorDisplay
|
|
|
|
*
|
|
|
|
* Move the color module @display down in the filter list of @stack.
|
|
|
|
*
|
2019-08-18 20:07:17 +08:00
|
|
|
* Since: 2.0
|
2019-08-02 17:45:24 +08:00
|
|
|
**/
|
2003-11-22 05:27:10 +08:00
|
|
|
void
|
|
|
|
gimp_color_display_stack_reorder_down (GimpColorDisplayStack *stack,
|
|
|
|
GimpColorDisplay *display)
|
|
|
|
{
|
2011-01-01 02:11:27 +08:00
|
|
|
GimpColorDisplayStackPrivate *private;
|
|
|
|
GList *list;
|
2003-11-22 05:27:10 +08:00
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_COLOR_DISPLAY_STACK (stack));
|
|
|
|
g_return_if_fail (GIMP_IS_COLOR_DISPLAY (display));
|
|
|
|
|
2024-08-01 11:55:31 +08:00
|
|
|
private = gimp_color_display_stack_get_instance_private (stack);
|
2011-01-01 02:11:27 +08:00
|
|
|
|
|
|
|
list = g_list_find (private->filters, display);
|
2003-11-22 05:27:10 +08:00
|
|
|
|
|
|
|
g_return_if_fail (list != NULL);
|
|
|
|
|
|
|
|
if (list->next)
|
|
|
|
{
|
|
|
|
list->data = list->next->data;
|
|
|
|
list->next->data = display;
|
|
|
|
|
2003-11-22 23:54:12 +08:00
|
|
|
g_signal_emit (stack, stack_signals[REORDERED], 0,
|
2011-01-01 02:11:27 +08:00
|
|
|
display, g_list_position (private->filters, list->next));
|
2003-11-22 23:54:12 +08:00
|
|
|
|
2003-11-22 05:27:10 +08:00
|
|
|
gimp_color_display_stack_changed (stack);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-11-02 05:34:09 +08:00
|
|
|
/**
|
|
|
|
* gimp_color_display_stack_convert_buffer:
|
|
|
|
* @stack: a #GimpColorDisplayStack
|
|
|
|
* @buffer: a #GeglBuffer
|
|
|
|
* @area: area of @buffer to convert
|
|
|
|
*
|
|
|
|
* Runs all the stack's filters on all pixels in @area of @buffer.
|
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.10
|
2013-11-02 05:34:09 +08:00
|
|
|
**/
|
|
|
|
void
|
|
|
|
gimp_color_display_stack_convert_buffer (GimpColorDisplayStack *stack,
|
|
|
|
GeglBuffer *buffer,
|
|
|
|
GeglRectangle *area)
|
|
|
|
{
|
2011-01-01 02:11:27 +08:00
|
|
|
GimpColorDisplayStackPrivate *private;
|
|
|
|
GList *list;
|
2013-11-02 05:34:09 +08:00
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_COLOR_DISPLAY_STACK (stack));
|
|
|
|
g_return_if_fail (GEGL_IS_BUFFER (buffer));
|
|
|
|
|
2024-08-01 11:55:31 +08:00
|
|
|
private = gimp_color_display_stack_get_instance_private (stack);
|
2011-01-01 02:11:27 +08:00
|
|
|
|
|
|
|
for (list = private->filters; list; list = g_list_next (list))
|
2013-11-02 05:34:09 +08:00
|
|
|
{
|
|
|
|
GimpColorDisplay *display = list->data;
|
|
|
|
|
|
|
|
gimp_color_display_convert_buffer (display, buffer, area);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-11-23 20:08:21 +08:00
|
|
|
|
|
|
|
/* private functions */
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_color_display_stack_display_changed (GimpColorDisplay *display,
|
|
|
|
GimpColorDisplayStack *stack)
|
|
|
|
{
|
2011-01-01 02:03:47 +08:00
|
|
|
if (gimp_color_display_get_enabled (display))
|
2003-11-23 20:08:21 +08:00
|
|
|
gimp_color_display_stack_changed (stack);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_color_display_stack_display_enabled (GimpColorDisplay *display,
|
2003-11-23 21:08:56 +08:00
|
|
|
GParamSpec *pspec,
|
2003-11-23 20:08:21 +08:00
|
|
|
GimpColorDisplayStack *stack)
|
|
|
|
{
|
|
|
|
gimp_color_display_stack_changed (stack);
|
|
|
|
}
|
2007-08-08 20:27:11 +08:00
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_color_display_stack_disconnect (GimpColorDisplayStack *stack,
|
|
|
|
GimpColorDisplay *display)
|
|
|
|
{
|
|
|
|
g_signal_handlers_disconnect_by_func (display,
|
|
|
|
gimp_color_display_stack_display_changed,
|
|
|
|
stack);
|
|
|
|
g_signal_handlers_disconnect_by_func (display,
|
|
|
|
gimp_color_display_stack_display_enabled,
|
|
|
|
stack);
|
|
|
|
}
|