mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-18 22:03:53 +00:00
app: add GimpAuxItem as base class for GimpGuide and GimpSamplePoint
and GimpAuxItemUndo for their respective undo classes.
This commit is contained in:
parent
b4c244b839
commit
2cd829eb85
|
@ -91,6 +91,10 @@ libappcore_a_sources = \
|
|||
gimpasync.h \
|
||||
gimpasyncset.c \
|
||||
gimpasyncset.h \
|
||||
gimpauxitem.c \
|
||||
gimpauxitem.h \
|
||||
gimpauxitemundo.c \
|
||||
gimpauxitemundo.h \
|
||||
gimpbezierdesc.h \
|
||||
gimpbezierdesc.c \
|
||||
gimpboundary.c \
|
||||
|
|
|
@ -91,6 +91,7 @@ typedef struct _GimpObject GimpObject;
|
|||
typedef struct _GimpViewable GimpViewable;
|
||||
typedef struct _GimpFilter GimpFilter;
|
||||
typedef struct _GimpItem GimpItem;
|
||||
typedef struct _GimpAuxItem GimpAuxItem;
|
||||
|
||||
typedef struct _Gimp Gimp;
|
||||
typedef struct _GimpImage GimpImage;
|
||||
|
@ -161,6 +162,12 @@ typedef struct _GimpLayer GimpLayer;
|
|||
typedef struct _GimpGroupLayer GimpGroupLayer;
|
||||
|
||||
|
||||
/* auxillary image items */
|
||||
|
||||
typedef struct _GimpGuide GimpGuide;
|
||||
typedef struct _GimpSamplePoint GimpSamplePoint;
|
||||
|
||||
|
||||
/* undo objects */
|
||||
|
||||
typedef struct _GimpUndo GimpUndo;
|
||||
|
@ -185,7 +192,6 @@ typedef struct _GimpDrawableFilter GimpDrawableFilter;
|
|||
typedef struct _GimpEnvironTable GimpEnvironTable;
|
||||
typedef struct _GimpExtension GimpExtension;
|
||||
typedef struct _GimpExtensionManager GimpExtensionManager;
|
||||
typedef struct _GimpGuide GimpGuide;
|
||||
typedef struct _GimpHistogram GimpHistogram;
|
||||
typedef struct _GimpIdTable GimpIdTable;
|
||||
typedef struct _GimpImagefile GimpImagefile;
|
||||
|
@ -194,7 +200,6 @@ typedef struct _GimpObjectQueue GimpObjectQueue;
|
|||
typedef struct _GimpParasiteList GimpParasiteList;
|
||||
typedef struct _GimpPdbProgress GimpPdbProgress;
|
||||
typedef struct _GimpProjection GimpProjection;
|
||||
typedef struct _GimpSamplePoint GimpSamplePoint;
|
||||
typedef struct _GimpSettings GimpSettings;
|
||||
typedef struct _GimpSubProgress GimpSubProgress;
|
||||
typedef struct _GimpTag GimpTag;
|
||||
|
|
151
app/core/gimpauxitem.c
Normal file
151
app/core/gimpauxitem.c
Normal file
|
@ -0,0 +1,151 @@
|
|||
/* GIMP - The GNU 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "core-types.h"
|
||||
|
||||
#include "gimpauxitem.h"
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
REMOVED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_ID
|
||||
};
|
||||
|
||||
|
||||
struct _GimpAuxItemPrivate
|
||||
{
|
||||
guint32 aux_item_ID;
|
||||
};
|
||||
|
||||
|
||||
static void gimp_aux_item_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_aux_item_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE (GimpAuxItem, gimp_aux_item, G_TYPE_OBJECT)
|
||||
|
||||
static guint gimp_aux_item_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
|
||||
static void
|
||||
gimp_aux_item_class_init (GimpAuxItemClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
gimp_aux_item_signals[REMOVED] =
|
||||
g_signal_new ("removed",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (GimpAuxItemClass, removed),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
object_class->get_property = gimp_aux_item_get_property;
|
||||
object_class->set_property = gimp_aux_item_set_property;
|
||||
|
||||
klass->removed = NULL;
|
||||
|
||||
g_object_class_install_property (object_class, PROP_ID,
|
||||
g_param_spec_uint ("id", NULL, NULL,
|
||||
0, G_MAXUINT32, 0,
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
GIMP_PARAM_READWRITE));
|
||||
|
||||
g_type_class_add_private (klass, sizeof (GimpAuxItemPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_aux_item_init (GimpAuxItem *aux_item)
|
||||
{
|
||||
aux_item->priv = G_TYPE_INSTANCE_GET_PRIVATE (aux_item,
|
||||
GIMP_TYPE_AUX_ITEM,
|
||||
GimpAuxItemPrivate);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_aux_item_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpAuxItem *aux_item = GIMP_AUX_ITEM (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_ID:
|
||||
g_value_set_uint (value, aux_item->priv->aux_item_ID);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_aux_item_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpAuxItem *aux_item = GIMP_AUX_ITEM (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_ID:
|
||||
aux_item->priv->aux_item_ID = g_value_get_uint (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
guint32
|
||||
gimp_aux_item_get_ID (GimpAuxItem *aux_item)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_AUX_ITEM (aux_item), 0);
|
||||
|
||||
return aux_item->priv->aux_item_ID;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_aux_item_removed (GimpAuxItem *aux_item)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_AUX_ITEM (aux_item));
|
||||
|
||||
g_signal_emit (aux_item, gimp_aux_item_signals[REMOVED], 0);
|
||||
}
|
56
app/core/gimpauxitem.h
Normal file
56
app/core/gimpauxitem.h
Normal file
|
@ -0,0 +1,56 @@
|
|||
/* GIMP - The GNU 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GIMP_AUX_ITEM_H__
|
||||
#define __GIMP_AUX_ITEM_H__
|
||||
|
||||
|
||||
#define GIMP_TYPE_AUX_ITEM (gimp_aux_item_get_type ())
|
||||
#define GIMP_AUX_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_AUX_ITEM, GimpAuxItem))
|
||||
#define GIMP_AUX_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_AUX_ITEM, GimpAuxItemClass))
|
||||
#define GIMP_IS_AUX_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_AUX_ITEM))
|
||||
#define GIMP_IS_AUX_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_AUX_ITEM))
|
||||
#define GIMP_AUX_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_AUX_ITEM, GimpAuxItemClass))
|
||||
|
||||
|
||||
typedef struct _GimpAuxItemPrivate GimpAuxItemPrivate;
|
||||
typedef struct _GimpAuxItemClass GimpAuxItemClass;
|
||||
|
||||
struct _GimpAuxItem
|
||||
{
|
||||
GObject parent_instance;
|
||||
|
||||
GimpAuxItemPrivate *priv;
|
||||
};
|
||||
|
||||
struct _GimpAuxItemClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
|
||||
/* signals */
|
||||
void (* removed) (GimpAuxItem *aux_item);
|
||||
};
|
||||
|
||||
|
||||
GType gimp_aux_item_get_type (void) G_GNUC_CONST;
|
||||
|
||||
guint32 gimp_aux_item_get_ID (GimpAuxItem *aux_item);
|
||||
|
||||
void gimp_aux_item_removed (GimpAuxItem *aux_item);
|
||||
|
||||
|
||||
#endif /* __GIMP_AUX_ITEM_H__ */
|
138
app/core/gimpauxitemundo.c
Normal file
138
app/core/gimpauxitemundo.c
Normal file
|
@ -0,0 +1,138 @@
|
|||
/* GIMP - The GNU 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
#include <gegl.h>
|
||||
|
||||
#include "core-types.h"
|
||||
|
||||
#include "gimpauxitem.h"
|
||||
#include "gimpauxitemundo.h"
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_AUX_ITEM
|
||||
};
|
||||
|
||||
|
||||
static void gimp_aux_item_undo_constructed (GObject *object);
|
||||
static void gimp_aux_item_undo_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_aux_item_undo_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
static void gimp_aux_item_undo_free (GimpUndo *undo,
|
||||
GimpUndoMode undo_mode);
|
||||
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE (GimpAuxItemUndo, gimp_aux_item_undo, GIMP_TYPE_UNDO)
|
||||
|
||||
#define parent_class gimp_aux_item_undo_parent_class
|
||||
|
||||
|
||||
static void
|
||||
gimp_aux_item_undo_class_init (GimpAuxItemUndoClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GimpUndoClass *undo_class = GIMP_UNDO_CLASS (klass);
|
||||
|
||||
object_class->constructed = gimp_aux_item_undo_constructed;
|
||||
object_class->set_property = gimp_aux_item_undo_set_property;
|
||||
object_class->get_property = gimp_aux_item_undo_get_property;
|
||||
|
||||
undo_class->free = gimp_aux_item_undo_free;
|
||||
|
||||
g_object_class_install_property (object_class, PROP_AUX_ITEM,
|
||||
g_param_spec_object ("aux-item", NULL, NULL,
|
||||
GIMP_TYPE_AUX_ITEM,
|
||||
GIMP_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY));
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_aux_item_undo_init (GimpAuxItemUndo *undo)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_aux_item_undo_constructed (GObject *object)
|
||||
{
|
||||
GimpAuxItemUndo *aux_item_undo = GIMP_AUX_ITEM_UNDO (object);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->constructed (object);
|
||||
|
||||
gimp_assert (GIMP_IS_AUX_ITEM (aux_item_undo->aux_item));
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_aux_item_undo_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpAuxItemUndo *aux_item_undo = GIMP_AUX_ITEM_UNDO (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_AUX_ITEM:
|
||||
aux_item_undo->aux_item = g_value_dup_object (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_aux_item_undo_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpAuxItemUndo *aux_item_undo = GIMP_AUX_ITEM_UNDO (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_AUX_ITEM:
|
||||
g_value_set_object (value, aux_item_undo->aux_item);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_aux_item_undo_free (GimpUndo *undo,
|
||||
GimpUndoMode undo_mode)
|
||||
{
|
||||
GimpAuxItemUndo *aux_item_undo = GIMP_AUX_ITEM_UNDO (undo);
|
||||
|
||||
g_clear_object (&aux_item_undo->aux_item);
|
||||
|
||||
GIMP_UNDO_CLASS (parent_class)->free (undo, undo_mode);
|
||||
}
|
52
app/core/gimpauxitemundo.h
Normal file
52
app/core/gimpauxitemundo.h
Normal file
|
@ -0,0 +1,52 @@
|
|||
/* GIMP - The GNU 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GIMP_AUX_ITEM_UNDO_H__
|
||||
#define __GIMP_AUX_ITEM_UNDO_H__
|
||||
|
||||
|
||||
#include "gimpundo.h"
|
||||
|
||||
|
||||
#define GIMP_TYPE_AUX_ITEM_UNDO (gimp_aux_item_undo_get_type ())
|
||||
#define GIMP_AUX_ITEM_UNDO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_AUX_ITEM_UNDO, GimpAuxItemUndo))
|
||||
#define GIMP_AUX_ITEM_UNDO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_AUX_ITEM_UNDO, GimpAuxItemUndoClass))
|
||||
#define GIMP_IS_AUX_ITEM_UNDO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_AUX_ITEM_UNDO))
|
||||
#define GIMP_IS_AUX_ITEM_UNDO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_AUX_ITEM_UNDO))
|
||||
#define GIMP_AUX_ITEM_UNDO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_AUX_ITEM_UNDO, GimpAuxItemUndoClass))
|
||||
|
||||
|
||||
typedef struct _GimpAuxItemUndo GimpAuxItemUndo;
|
||||
typedef struct _GimpAuxItemUndoClass GimpAuxItemUndoClass;
|
||||
|
||||
struct _GimpAuxItemUndo
|
||||
{
|
||||
GimpUndo parent_instance;
|
||||
|
||||
GimpAuxItem *aux_item;
|
||||
};
|
||||
|
||||
struct _GimpAuxItemUndoClass
|
||||
{
|
||||
GimpUndoClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
GType gimp_aux_item_undo_get_type (void) G_GNUC_CONST;
|
||||
|
||||
|
||||
#endif /* __GIMP_AUX_ITEM_UNDO_H__ */
|
|
@ -20,31 +20,19 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <cairo.h>
|
||||
#include <gegl.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
#include <gio/gio.h>
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
#include "libgimpcolor/gimpcolor.h"
|
||||
#include "libgimpconfig/gimpconfig.h"
|
||||
|
||||
#include "core-types.h"
|
||||
|
||||
#include "gimpguide.h"
|
||||
#include "gimpmarshal.h"
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
REMOVED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_ID,
|
||||
PROP_ORIENTATION,
|
||||
PROP_POSITION,
|
||||
PROP_STYLE
|
||||
|
@ -53,7 +41,6 @@ enum
|
|||
|
||||
struct _GimpGuidePrivate
|
||||
{
|
||||
guint32 guide_ID;
|
||||
GimpOrientationType orientation;
|
||||
gint position;
|
||||
|
||||
|
@ -71,9 +58,7 @@ static void gimp_guide_set_property (GObject *object,
|
|||
GParamSpec *pspec);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpGuide, gimp_guide, G_TYPE_OBJECT)
|
||||
|
||||
static guint gimp_guide_signals[LAST_SIGNAL] = { 0 };
|
||||
G_DEFINE_TYPE (GimpGuide, gimp_guide, GIMP_TYPE_AUX_ITEM)
|
||||
|
||||
|
||||
static void
|
||||
|
@ -81,26 +66,9 @@ gimp_guide_class_init (GimpGuideClass *klass)
|
|||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
gimp_guide_signals[REMOVED] =
|
||||
g_signal_new ("removed",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (GimpGuideClass, removed),
|
||||
NULL, NULL,
|
||||
gimp_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
object_class->get_property = gimp_guide_get_property;
|
||||
object_class->set_property = gimp_guide_set_property;
|
||||
|
||||
klass->removed = NULL;
|
||||
|
||||
g_object_class_install_property (object_class, PROP_ID,
|
||||
g_param_spec_uint ("id", NULL, NULL,
|
||||
0, G_MAXUINT32, 0,
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
GIMP_PARAM_READWRITE));
|
||||
|
||||
GIMP_CONFIG_PROP_ENUM (object_class, PROP_ORIENTATION,
|
||||
"orientation",
|
||||
NULL, NULL,
|
||||
|
@ -143,9 +111,6 @@ gimp_guide_get_property (GObject *object,
|
|||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_ID:
|
||||
g_value_set_uint (value, guide->priv->guide_ID);
|
||||
break;
|
||||
case PROP_ORIENTATION:
|
||||
g_value_set_enum (value, guide->priv->orientation);
|
||||
break;
|
||||
|
@ -171,9 +136,6 @@ gimp_guide_set_property (GObject *object,
|
|||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_ID:
|
||||
guide->priv->guide_ID = g_value_get_uint (value);
|
||||
break;
|
||||
case PROP_ORIENTATION:
|
||||
guide->priv->orientation = g_value_get_enum (value);
|
||||
break;
|
||||
|
@ -232,22 +194,6 @@ gimp_guide_custom_new (GimpOrientationType orientation,
|
|||
return guide;
|
||||
}
|
||||
|
||||
guint32
|
||||
gimp_guide_get_ID (GimpGuide *guide)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_GUIDE (guide), 0);
|
||||
|
||||
return guide->priv->guide_ID;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_guide_removed (GimpGuide *guide)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_GUIDE (guide));
|
||||
|
||||
g_signal_emit (guide, gimp_guide_signals[REMOVED], 0);
|
||||
}
|
||||
|
||||
GimpOrientationType
|
||||
gimp_guide_get_orientation (GimpGuide *guide)
|
||||
{
|
||||
|
|
|
@ -22,6 +22,9 @@
|
|||
#define __GIMP_GUIDE_H__
|
||||
|
||||
|
||||
#include "gimpauxitem.h"
|
||||
|
||||
|
||||
#define GIMP_GUIDE_POSITION_UNDEFINED G_MININT
|
||||
|
||||
|
||||
|
@ -38,17 +41,14 @@ typedef struct _GimpGuideClass GimpGuideClass;
|
|||
|
||||
struct _GimpGuide
|
||||
{
|
||||
GObject parent_instance;
|
||||
GimpAuxItem parent_instance;
|
||||
|
||||
GimpGuidePrivate *priv;
|
||||
};
|
||||
|
||||
struct _GimpGuideClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
|
||||
/* signals */
|
||||
void (* removed) (GimpGuide *guide);
|
||||
GimpAuxItemClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
|
@ -60,10 +60,6 @@ GimpGuide * gimp_guide_custom_new (GimpOrientationType orientatio
|
|||
guint32 guide_ID,
|
||||
GimpGuideStyle guide_style);
|
||||
|
||||
guint32 gimp_guide_get_ID (GimpGuide *guide);
|
||||
|
||||
void gimp_guide_removed (GimpGuide *guide);
|
||||
|
||||
GimpOrientationType gimp_guide_get_orientation (GimpGuide *guide);
|
||||
void gimp_guide_set_orientation (GimpGuide *guide,
|
||||
GimpOrientationType orientation);
|
||||
|
|
|
@ -28,31 +28,15 @@
|
|||
#include "gimpguideundo.h"
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_GUIDE
|
||||
};
|
||||
|
||||
|
||||
static void gimp_guide_undo_constructed (GObject *object);
|
||||
static void gimp_guide_undo_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_guide_undo_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
static void gimp_guide_undo_pop (GimpUndo *undo,
|
||||
GimpUndoMode undo_mode,
|
||||
GimpUndoAccumulator *accum);
|
||||
static void gimp_guide_undo_free (GimpUndo *undo,
|
||||
GimpUndoMode undo_mode);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpGuideUndo, gimp_guide_undo, GIMP_TYPE_UNDO)
|
||||
G_DEFINE_TYPE (GimpGuideUndo, gimp_guide_undo,
|
||||
GIMP_TYPE_AUX_ITEM_UNDO)
|
||||
|
||||
#define parent_class gimp_guide_undo_parent_class
|
||||
|
||||
|
@ -63,18 +47,9 @@ gimp_guide_undo_class_init (GimpGuideUndoClass *klass)
|
|||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GimpUndoClass *undo_class = GIMP_UNDO_CLASS (klass);
|
||||
|
||||
object_class->constructed = gimp_guide_undo_constructed;
|
||||
object_class->set_property = gimp_guide_undo_set_property;
|
||||
object_class->get_property = gimp_guide_undo_get_property;
|
||||
object_class->constructed = gimp_guide_undo_constructed;
|
||||
|
||||
undo_class->pop = gimp_guide_undo_pop;
|
||||
undo_class->free = gimp_guide_undo_free;
|
||||
|
||||
g_object_class_install_property (object_class, PROP_GUIDE,
|
||||
g_param_spec_object ("guide", NULL, NULL,
|
||||
GIMP_TYPE_GUIDE,
|
||||
GIMP_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY));
|
||||
undo_class->pop = gimp_guide_undo_pop;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -86,53 +61,16 @@ static void
|
|||
gimp_guide_undo_constructed (GObject *object)
|
||||
{
|
||||
GimpGuideUndo *guide_undo = GIMP_GUIDE_UNDO (object);
|
||||
GimpGuide *guide;
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->constructed (object);
|
||||
|
||||
gimp_assert (GIMP_IS_GUIDE (guide_undo->guide));
|
||||
guide = GIMP_GUIDE (GIMP_AUX_ITEM_UNDO (object)->aux_item);
|
||||
|
||||
guide_undo->orientation = gimp_guide_get_orientation (guide_undo->guide);
|
||||
guide_undo->position = gimp_guide_get_position (guide_undo->guide);
|
||||
}
|
||||
gimp_assert (GIMP_IS_GUIDE (guide));
|
||||
|
||||
static void
|
||||
gimp_guide_undo_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpGuideUndo *guide_undo = GIMP_GUIDE_UNDO (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_GUIDE:
|
||||
guide_undo->guide = g_value_dup_object (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_guide_undo_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpGuideUndo *guide_undo = GIMP_GUIDE_UNDO (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_GUIDE:
|
||||
g_value_set_object (value, guide_undo->guide);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
guide_undo->orientation = gimp_guide_get_orientation (guide);
|
||||
guide_undo->position = gimp_guide_get_position (guide);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -141,47 +79,38 @@ gimp_guide_undo_pop (GimpUndo *undo,
|
|||
GimpUndoAccumulator *accum)
|
||||
{
|
||||
GimpGuideUndo *guide_undo = GIMP_GUIDE_UNDO (undo);
|
||||
GimpGuide *guide;
|
||||
GimpOrientationType orientation;
|
||||
gint position;
|
||||
gboolean moved = FALSE;
|
||||
|
||||
GIMP_UNDO_CLASS (parent_class)->pop (undo, undo_mode, accum);
|
||||
|
||||
orientation = gimp_guide_get_orientation (guide_undo->guide);
|
||||
position = gimp_guide_get_position (guide_undo->guide);
|
||||
guide = GIMP_GUIDE (GIMP_AUX_ITEM_UNDO (undo)->aux_item);
|
||||
|
||||
orientation = gimp_guide_get_orientation (guide);
|
||||
position = gimp_guide_get_position (guide);
|
||||
|
||||
if (position == GIMP_GUIDE_POSITION_UNDEFINED)
|
||||
{
|
||||
gimp_image_add_guide (undo->image,
|
||||
guide_undo->guide, guide_undo->position);
|
||||
gimp_image_add_guide (undo->image, guide, guide_undo->position);
|
||||
}
|
||||
else if (guide_undo->position == GIMP_GUIDE_POSITION_UNDEFINED)
|
||||
{
|
||||
gimp_image_remove_guide (undo->image, guide_undo->guide, FALSE);
|
||||
gimp_image_remove_guide (undo->image, guide, FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_guide_set_position (guide_undo->guide, guide_undo->position);
|
||||
gimp_guide_set_position (guide, guide_undo->position);
|
||||
|
||||
moved = TRUE;
|
||||
}
|
||||
|
||||
gimp_guide_set_orientation (guide_undo->guide, guide_undo->orientation);
|
||||
gimp_guide_set_orientation (guide, guide_undo->orientation);
|
||||
|
||||
if (moved || guide_undo->orientation != orientation)
|
||||
gimp_image_guide_moved (undo->image, guide_undo->guide);
|
||||
gimp_image_guide_moved (undo->image, guide);
|
||||
|
||||
guide_undo->position = position;
|
||||
guide_undo->orientation = orientation;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_guide_undo_free (GimpUndo *undo,
|
||||
GimpUndoMode undo_mode)
|
||||
{
|
||||
GimpGuideUndo *guide_undo = GIMP_GUIDE_UNDO (undo);
|
||||
|
||||
g_clear_object (&guide_undo->guide);
|
||||
|
||||
GIMP_UNDO_CLASS (parent_class)->free (undo, undo_mode);
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#define __GIMP_GUIDE_UNDO_H__
|
||||
|
||||
|
||||
#include "gimpundo.h"
|
||||
#include "gimpauxitemundo.h"
|
||||
|
||||
|
||||
#define GIMP_TYPE_GUIDE_UNDO (gimp_guide_undo_get_type ())
|
||||
|
@ -35,16 +35,15 @@ typedef struct _GimpGuideUndoClass GimpGuideUndoClass;
|
|||
|
||||
struct _GimpGuideUndo
|
||||
{
|
||||
GimpUndo parent_instance;
|
||||
GimpAuxItemUndo parent_instance;
|
||||
|
||||
GimpGuide *guide;
|
||||
GimpOrientationType orientation;
|
||||
gint position;
|
||||
};
|
||||
|
||||
struct _GimpGuideUndoClass
|
||||
{
|
||||
GimpUndoClass parent_class;
|
||||
GimpAuxItemUndoClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ gimp_image_remove_guide (GimpImage *image,
|
|||
gimp_image_undo_push_guide (image, C_("undo-type", "Remove Guide"), guide);
|
||||
|
||||
private->guides = g_list_remove (private->guides, guide);
|
||||
gimp_guide_removed (guide);
|
||||
gimp_aux_item_removed (GIMP_AUX_ITEM (guide));
|
||||
|
||||
gimp_image_guide_removed (image, guide);
|
||||
|
||||
|
@ -177,7 +177,7 @@ gimp_image_get_guide (GimpImage *image,
|
|||
{
|
||||
GimpGuide *guide = guides->data;
|
||||
|
||||
if (gimp_guide_get_ID (guide) == id)
|
||||
if (gimp_aux_item_get_ID (GIMP_AUX_ITEM (guide)) == id)
|
||||
return guide;
|
||||
}
|
||||
|
||||
|
@ -208,7 +208,7 @@ gimp_image_get_next_guide (GimpImage *image,
|
|||
if (*guide_found) /* this is the first guide after the found one */
|
||||
return guide;
|
||||
|
||||
if (gimp_guide_get_ID (guide) == id) /* found it, next one will be returned */
|
||||
if (gimp_aux_item_get_ID (GIMP_AUX_ITEM (guide)) == id) /* found it, next one will be returned */
|
||||
*guide_found = TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ gimp_image_remove_sample_point (GimpImage *image,
|
|||
sample_point);
|
||||
|
||||
private->sample_points = g_list_remove (private->sample_points, sample_point);
|
||||
gimp_sample_point_removed (sample_point);
|
||||
gimp_aux_item_removed (GIMP_AUX_ITEM (sample_point));
|
||||
|
||||
gimp_image_sample_point_removed (image, sample_point);
|
||||
|
||||
|
@ -153,7 +153,7 @@ gimp_image_get_sample_point (GimpImage *image,
|
|||
{
|
||||
GimpSamplePoint *sample_point = sample_points->data;
|
||||
|
||||
if (gimp_sample_point_get_ID (sample_point) == id)
|
||||
if (gimp_aux_item_get_ID (GIMP_AUX_ITEM (sample_point)) == id)
|
||||
return sample_point;
|
||||
}
|
||||
|
||||
|
@ -184,7 +184,7 @@ gimp_image_get_next_sample_point (GimpImage *image,
|
|||
if (*sample_point_found) /* this is the first guide after the found one */
|
||||
return sample_point;
|
||||
|
||||
if (gimp_sample_point_get_ID (sample_point) == id) /* found it, next one will be returned */
|
||||
if (gimp_aux_item_get_ID (GIMP_AUX_ITEM (sample_point)) == id) /* found it, next one will be returned */
|
||||
*sample_point_found = TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -218,7 +218,7 @@ gimp_image_undo_push_guide (GimpImage *image,
|
|||
return gimp_image_undo_push (image, GIMP_TYPE_GUIDE_UNDO,
|
||||
GIMP_UNDO_GUIDE, undo_desc,
|
||||
GIMP_DIRTY_IMAGE_META,
|
||||
"guide", guide,
|
||||
"aux-item", guide,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
@ -233,7 +233,7 @@ gimp_image_undo_push_sample_point (GimpImage *image,
|
|||
return gimp_image_undo_push (image, GIMP_TYPE_SAMPLE_POINT_UNDO,
|
||||
GIMP_UNDO_SAMPLE_POINT, undo_desc,
|
||||
GIMP_DIRTY_IMAGE_META,
|
||||
"sample-point", sample_point,
|
||||
"aux-item", sample_point,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,20 +24,12 @@
|
|||
|
||||
#include "core-types.h"
|
||||
|
||||
#include "gimpmarshal.h"
|
||||
#include "gimpsamplepoint.h"
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
REMOVED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_ID,
|
||||
PROP_POSITION_X,
|
||||
PROP_POSITION_Y
|
||||
};
|
||||
|
@ -45,9 +37,8 @@ enum
|
|||
|
||||
struct _GimpSamplePointPrivate
|
||||
{
|
||||
guint32 sample_point_ID;
|
||||
gint position_x;
|
||||
gint position_y;
|
||||
gint position_x;
|
||||
gint position_y;
|
||||
};
|
||||
|
||||
|
||||
|
@ -61,9 +52,7 @@ static void gimp_sample_point_set_property (GObject *object,
|
|||
GParamSpec *pspec);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpSamplePoint, gimp_sample_point, G_TYPE_OBJECT)
|
||||
|
||||
static guint gimp_sample_point_signals[LAST_SIGNAL] = { 0 };
|
||||
G_DEFINE_TYPE (GimpSamplePoint, gimp_sample_point, GIMP_TYPE_AUX_ITEM)
|
||||
|
||||
|
||||
static void
|
||||
|
@ -71,26 +60,9 @@ gimp_sample_point_class_init (GimpSamplePointClass *klass)
|
|||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
gimp_sample_point_signals[REMOVED] =
|
||||
g_signal_new ("removed",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (GimpSamplePointClass, removed),
|
||||
NULL, NULL,
|
||||
gimp_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
object_class->get_property = gimp_sample_point_get_property;
|
||||
object_class->set_property = gimp_sample_point_set_property;
|
||||
|
||||
klass->removed = NULL;
|
||||
|
||||
g_object_class_install_property (object_class, PROP_ID,
|
||||
g_param_spec_uint ("id", NULL, NULL,
|
||||
0, G_MAXUINT32, 0,
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
GIMP_PARAM_READWRITE));
|
||||
|
||||
GIMP_CONFIG_PROP_INT (object_class, PROP_POSITION_X,
|
||||
"position-x",
|
||||
NULL, NULL,
|
||||
|
@ -128,9 +100,6 @@ gimp_sample_point_get_property (GObject *object,
|
|||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_ID:
|
||||
g_value_set_uint (value, sample_point->priv->sample_point_ID);
|
||||
break;
|
||||
case PROP_POSITION_X:
|
||||
g_value_set_int (value, sample_point->priv->position_x);
|
||||
break;
|
||||
|
@ -154,9 +123,6 @@ gimp_sample_point_set_property (GObject *object,
|
|||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_ID:
|
||||
sample_point->priv->sample_point_ID = g_value_get_uint (value);
|
||||
break;
|
||||
case PROP_POSITION_X:
|
||||
sample_point->priv->position_x = g_value_get_int (value);
|
||||
break;
|
||||
|
@ -178,22 +144,6 @@ gimp_sample_point_new (guint32 sample_point_ID)
|
|||
NULL);
|
||||
}
|
||||
|
||||
guint32
|
||||
gimp_sample_point_get_ID (GimpSamplePoint *sample_point)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_SAMPLE_POINT (sample_point), 0);
|
||||
|
||||
return sample_point->priv->sample_point_ID;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_sample_point_removed (GimpSamplePoint *sample_point)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_SAMPLE_POINT (sample_point));
|
||||
|
||||
g_signal_emit (sample_point, gimp_sample_point_signals[REMOVED], 0);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_sample_point_get_position (GimpSamplePoint *sample_point,
|
||||
gint *position_x,
|
||||
|
|
|
@ -19,6 +19,9 @@
|
|||
#define __GIMP_SAMPLE_POINT_H__
|
||||
|
||||
|
||||
#include "gimpauxitem.h"
|
||||
|
||||
|
||||
#define GIMP_SAMPLE_POINT_POSITION_UNDEFINED G_MININT
|
||||
|
||||
|
||||
|
@ -35,17 +38,14 @@ typedef struct _GimpSamplePointClass GimpSamplePointClass;
|
|||
|
||||
struct _GimpSamplePoint
|
||||
{
|
||||
GObject parent_instance;
|
||||
GimpAuxItem parent_instance;
|
||||
|
||||
GimpSamplePointPrivate *priv;
|
||||
};
|
||||
|
||||
struct _GimpSamplePointClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
|
||||
/* signals */
|
||||
void (* removed) (GimpSamplePoint *sample_point);
|
||||
GimpAuxItemClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
|
@ -53,10 +53,6 @@ GType gimp_sample_point_get_type (void) G_GNUC_CONST;
|
|||
|
||||
GimpSamplePoint * gimp_sample_point_new (guint32 sample_point_ID);
|
||||
|
||||
guint32 gimp_sample_point_get_ID (GimpSamplePoint *sample_point);
|
||||
|
||||
void gimp_sample_point_removed (GimpSamplePoint *sample_point);
|
||||
|
||||
void gimp_sample_point_get_position (GimpSamplePoint *sample_point,
|
||||
gint *position_x,
|
||||
gint *position_y);
|
||||
|
|
|
@ -28,31 +28,15 @@
|
|||
#include "gimpsamplepointundo.h"
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_SAMPLE_POINT
|
||||
};
|
||||
|
||||
|
||||
static void gimp_sample_point_undo_constructed (GObject *object);
|
||||
static void gimp_sample_point_undo_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_sample_point_undo_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
static void gimp_sample_point_undo_pop (GimpUndo *undo,
|
||||
GimpUndoMode undo_mode,
|
||||
GimpUndoAccumulator *accum);
|
||||
static void gimp_sample_point_undo_free (GimpUndo *undo,
|
||||
GimpUndoMode undo_mode);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpSamplePointUndo, gimp_sample_point_undo, GIMP_TYPE_UNDO)
|
||||
G_DEFINE_TYPE (GimpSamplePointUndo, gimp_sample_point_undo,
|
||||
GIMP_TYPE_AUX_ITEM_UNDO)
|
||||
|
||||
#define parent_class gimp_sample_point_undo_parent_class
|
||||
|
||||
|
@ -63,18 +47,9 @@ gimp_sample_point_undo_class_init (GimpSamplePointUndoClass *klass)
|
|||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GimpUndoClass *undo_class = GIMP_UNDO_CLASS (klass);
|
||||
|
||||
object_class->constructed = gimp_sample_point_undo_constructed;
|
||||
object_class->set_property = gimp_sample_point_undo_set_property;
|
||||
object_class->get_property = gimp_sample_point_undo_get_property;
|
||||
object_class->constructed = gimp_sample_point_undo_constructed;
|
||||
|
||||
undo_class->pop = gimp_sample_point_undo_pop;
|
||||
undo_class->free = gimp_sample_point_undo_free;
|
||||
|
||||
g_object_class_install_property (object_class, PROP_SAMPLE_POINT,
|
||||
g_param_spec_object ("sample-point", NULL, NULL,
|
||||
GIMP_TYPE_SAMPLE_POINT,
|
||||
GIMP_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY));
|
||||
undo_class->pop = gimp_sample_point_undo_pop;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -86,102 +61,55 @@ static void
|
|||
gimp_sample_point_undo_constructed (GObject *object)
|
||||
{
|
||||
GimpSamplePointUndo *sample_point_undo = GIMP_SAMPLE_POINT_UNDO (object);
|
||||
GimpSamplePoint *sample_point;
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->constructed (object);
|
||||
|
||||
gimp_assert (GIMP_IS_SAMPLE_POINT (sample_point_undo->sample_point));
|
||||
sample_point = GIMP_SAMPLE_POINT (GIMP_AUX_ITEM_UNDO (object)->aux_item);
|
||||
|
||||
gimp_sample_point_get_position (sample_point_undo->sample_point,
|
||||
gimp_assert (GIMP_IS_SAMPLE_POINT (sample_point));
|
||||
|
||||
gimp_sample_point_get_position (sample_point,
|
||||
&sample_point_undo->x,
|
||||
&sample_point_undo->y);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_sample_point_undo_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpSamplePointUndo *sample_point_undo = GIMP_SAMPLE_POINT_UNDO (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_SAMPLE_POINT:
|
||||
sample_point_undo->sample_point = g_value_dup_object (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_sample_point_undo_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpSamplePointUndo *sample_point_undo = GIMP_SAMPLE_POINT_UNDO (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_SAMPLE_POINT:
|
||||
g_value_set_object (value, sample_point_undo->sample_point);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_sample_point_undo_pop (GimpUndo *undo,
|
||||
GimpUndoMode undo_mode,
|
||||
GimpUndoAccumulator *accum)
|
||||
{
|
||||
GimpSamplePointUndo *sample_point_undo = GIMP_SAMPLE_POINT_UNDO (undo);
|
||||
GimpSamplePoint *sample_point;
|
||||
gint x;
|
||||
gint y;
|
||||
|
||||
GIMP_UNDO_CLASS (parent_class)->pop (undo, undo_mode, accum);
|
||||
|
||||
gimp_sample_point_get_position (sample_point_undo->sample_point, &x, &y);
|
||||
sample_point = GIMP_SAMPLE_POINT (GIMP_AUX_ITEM_UNDO (undo)->aux_item);
|
||||
|
||||
gimp_sample_point_get_position (sample_point, &x, &y);
|
||||
|
||||
if (x == GIMP_SAMPLE_POINT_POSITION_UNDEFINED)
|
||||
{
|
||||
gimp_image_add_sample_point (undo->image,
|
||||
sample_point_undo->sample_point,
|
||||
sample_point,
|
||||
sample_point_undo->x,
|
||||
sample_point_undo->y);
|
||||
}
|
||||
else if (sample_point_undo->x == GIMP_SAMPLE_POINT_POSITION_UNDEFINED)
|
||||
{
|
||||
gimp_image_remove_sample_point (undo->image,
|
||||
sample_point_undo->sample_point, FALSE);
|
||||
gimp_image_remove_sample_point (undo->image, sample_point, FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_sample_point_set_position (sample_point_undo->sample_point,
|
||||
gimp_sample_point_set_position (sample_point,
|
||||
sample_point_undo->x,
|
||||
sample_point_undo->y);
|
||||
|
||||
gimp_image_sample_point_moved (undo->image,
|
||||
sample_point_undo->sample_point);
|
||||
gimp_image_sample_point_moved (undo->image, sample_point);
|
||||
}
|
||||
|
||||
sample_point_undo->x = x;
|
||||
sample_point_undo->y = y;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_sample_point_undo_free (GimpUndo *undo,
|
||||
GimpUndoMode undo_mode)
|
||||
{
|
||||
GimpSamplePointUndo *sample_point_undo = GIMP_SAMPLE_POINT_UNDO (undo);
|
||||
|
||||
g_clear_object (&sample_point_undo->sample_point);
|
||||
|
||||
GIMP_UNDO_CLASS (parent_class)->free (undo, undo_mode);
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#define __GIMP_SAMPLE_POINT_UNDO_H__
|
||||
|
||||
|
||||
#include "gimpundo.h"
|
||||
#include "gimpauxitemundo.h"
|
||||
|
||||
|
||||
#define GIMP_TYPE_SAMPLE_POINT_UNDO (gimp_sample_point_undo_get_type ())
|
||||
|
@ -35,16 +35,15 @@ typedef struct _GimpSamplePointUndoClass GimpSamplePointUndoClass;
|
|||
|
||||
struct _GimpSamplePointUndo
|
||||
{
|
||||
GimpUndo parent_instance;
|
||||
GimpAuxItemUndo parent_instance;
|
||||
|
||||
GimpSamplePoint *sample_point;
|
||||
gint x;
|
||||
gint y;
|
||||
};
|
||||
|
||||
struct _GimpSamplePointUndoClass
|
||||
{
|
||||
GimpUndoClass parent_class;
|
||||
GimpAuxItemUndoClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ image_add_hguide_invoker (GimpProcedure *procedure,
|
|||
GimpGuide *g;
|
||||
|
||||
g = gimp_image_add_hguide (image, yposition, TRUE);
|
||||
guide = gimp_guide_get_ID (g);
|
||||
guide = gimp_aux_item_get_ID (GIMP_AUX_ITEM (g));
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
|
@ -106,7 +106,7 @@ image_add_vguide_invoker (GimpProcedure *procedure,
|
|||
GimpGuide *g;
|
||||
|
||||
g = gimp_image_add_vguide (image, xposition, TRUE);
|
||||
guide = gimp_guide_get_ID (g);
|
||||
guide = gimp_aux_item_get_ID (GIMP_AUX_ITEM (g));
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
|
@ -172,7 +172,7 @@ image_find_next_guide_invoker (GimpProcedure *procedure,
|
|||
GimpGuide *g = gimp_image_get_next_guide (image, guide, &success);
|
||||
|
||||
if (g)
|
||||
next_guide = gimp_guide_get_ID (g);
|
||||
next_guide = gimp_aux_item_get_ID (GIMP_AUX_ITEM (g));
|
||||
|
||||
if (! success)
|
||||
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
|
||||
|
|
|
@ -69,7 +69,7 @@ image_add_sample_point_invoker (GimpProcedure *procedure,
|
|||
|
||||
sp = gimp_image_add_sample_point_at_pos (image, position_x, position_y,
|
||||
TRUE);
|
||||
sample_point = gimp_sample_point_get_ID (sp);
|
||||
sample_point = gimp_aux_item_get_ID (GIMP_AUX_ITEM (sp));
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
|
@ -137,7 +137,7 @@ image_find_next_sample_point_invoker (GimpProcedure *procedure,
|
|||
&success);
|
||||
|
||||
if (sp)
|
||||
next_sample_point = gimp_sample_point_get_ID (sp);
|
||||
next_sample_point = gimp_aux_item_get_ID (GIMP_AUX_ITEM (sp));
|
||||
|
||||
if (! success)
|
||||
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
|
||||
|
|
|
@ -47,7 +47,7 @@ HELP
|
|||
GimpGuide *g;
|
||||
|
||||
g = gimp_image_add_hguide (image, yposition, TRUE);
|
||||
guide = gimp_guide_get_ID (g);
|
||||
guide = gimp_aux_item_get_ID (GIMP_AUX_ITEM (g));
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
|
@ -87,7 +87,7 @@ HELP
|
|||
GimpGuide *g;
|
||||
|
||||
g = gimp_image_add_vguide (image, xposition, TRUE);
|
||||
guide = gimp_guide_get_ID (g);
|
||||
guide = gimp_aux_item_get_ID (GIMP_AUX_ITEM (g));
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
|
@ -157,7 +157,7 @@ HELP
|
|||
GimpGuide *g = gimp_image_get_next_guide (image, guide, &success);
|
||||
|
||||
if (g)
|
||||
next_guide = gimp_guide_get_ID (g);
|
||||
next_guide = gimp_aux_item_get_ID (GIMP_AUX_ITEM (g));
|
||||
|
||||
if (! success)
|
||||
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
|
||||
|
|
|
@ -51,7 +51,7 @@ HELP
|
|||
|
||||
sp = gimp_image_add_sample_point_at_pos (image, position_x, position_y,
|
||||
TRUE);
|
||||
sample_point = gimp_sample_point_get_ID (sp);
|
||||
sample_point = gimp_aux_item_get_ID (GIMP_AUX_ITEM (sp));
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
|
@ -125,7 +125,7 @@ HELP
|
|||
&success);
|
||||
|
||||
if (sp)
|
||||
next_sample_point = gimp_sample_point_get_ID (sp);
|
||||
next_sample_point = gimp_aux_item_get_ID (GIMP_AUX_ITEM (sp));
|
||||
|
||||
if (! success)
|
||||
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
|
||||
|
|
Loading…
Reference in a new issue