Exemplo n.º 1
0
static void
gimp_ink_undo_constructed (GObject *object)
{
  GimpInkUndo *ink_undo = GIMP_INK_UNDO (object);
  GimpInk     *ink;

  G_OBJECT_CLASS (parent_class)->constructed (object);

  g_assert (GIMP_IS_INK (GIMP_PAINT_CORE_UNDO (ink_undo)->paint_core));

  ink = GIMP_INK (GIMP_PAINT_CORE_UNDO (ink_undo)->paint_core);

  if (ink->start_blobs)
    {
      gint      i;
      GimpBlob *blob;

      for (i = 0; i < g_list_length (ink->start_blobs); i++)
        {
          blob = g_list_nth_data (ink->start_blobs, i);

          ink_undo->last_blobs = g_list_prepend (ink_undo->last_blobs,
                                                 gimp_blob_duplicate (blob));
        }
      ink_undo->last_blobs = g_list_reverse (ink_undo->last_blobs);
    }
}
Exemplo n.º 2
0
static void
gimp_ink_undo_constructed (GObject *object)
{
  GimpInkUndo *ink_undo = GIMP_INK_UNDO (object);
  GimpInk     *ink;

  G_OBJECT_CLASS (parent_class)->constructed (object);

  g_assert (GIMP_IS_INK (GIMP_PAINT_CORE_UNDO (ink_undo)->paint_core));

  ink = GIMP_INK (GIMP_PAINT_CORE_UNDO (ink_undo)->paint_core);

  if (ink->start_blob)
    ink_undo->last_blob = gimp_blob_duplicate (ink->start_blob);
}
Exemplo n.º 3
0
static void
gimp_ink_undo_pop (GimpUndo              *undo,
                   GimpUndoMode           undo_mode,
                   GimpUndoAccumulator   *accum)
{
  GimpInkUndo *ink_undo = GIMP_INK_UNDO (undo);

  GIMP_UNDO_CLASS (parent_class)->pop (undo, undo_mode, accum);

  if (GIMP_PAINT_CORE_UNDO (ink_undo)->paint_core)
    {
      GimpInk  *ink = GIMP_INK (GIMP_PAINT_CORE_UNDO (ink_undo)->paint_core);
      GList    *tmp_blobs;

      tmp_blobs = ink->last_blobs;
      ink->last_blobs = ink_undo->last_blobs;
      ink_undo->last_blobs = tmp_blobs;
    }
}
Exemplo n.º 4
0
static void
gimp_paint_core_undo_constructed (GObject *object)
{
  GimpPaintCoreUndo *paint_core_undo = GIMP_PAINT_CORE_UNDO (object);

  G_OBJECT_CLASS (parent_class)->constructed (object);

  g_assert (GIMP_IS_PAINT_CORE (paint_core_undo->paint_core));

  paint_core_undo->last_coords = paint_core_undo->paint_core->start_coords;

  g_object_add_weak_pointer (G_OBJECT (paint_core_undo->paint_core),
                             (gpointer) &paint_core_undo->paint_core);
}
Exemplo n.º 5
0
static void
gimp_paint_core_undo_free (GimpUndo     *undo,
                           GimpUndoMode  undo_mode)
{
  GimpPaintCoreUndo *paint_core_undo = GIMP_PAINT_CORE_UNDO (undo);

  if (paint_core_undo->paint_core)
    {
      g_object_remove_weak_pointer (G_OBJECT (paint_core_undo->paint_core),
                                    (gpointer) &paint_core_undo->paint_core);
      paint_core_undo->paint_core = NULL;
    }

  GIMP_UNDO_CLASS (parent_class)->free (undo, undo_mode);
}
Exemplo n.º 6
0
static void
gimp_paint_core_undo_pop (GimpUndo              *undo,
                          GimpUndoMode           undo_mode,
                          GimpUndoAccumulator   *accum)
{
  GimpPaintCoreUndo *paint_core_undo = GIMP_PAINT_CORE_UNDO (undo);

  GIMP_UNDO_CLASS (parent_class)->pop (undo, undo_mode, accum);

  /*  only pop if the core still exists  */
  if (paint_core_undo->paint_core)
    {
      GimpCoords tmp_coords;

      tmp_coords = paint_core_undo->paint_core->last_coords;
      paint_core_undo->paint_core->last_coords = paint_core_undo->last_coords;
      paint_core_undo->last_coords = tmp_coords;
    }
}
Exemplo n.º 7
0
static void
gimp_paint_core_undo_get_property (GObject    *object,
                                   guint       property_id,
                                   GValue     *value,
                                   GParamSpec *pspec)
{
  GimpPaintCoreUndo *paint_core_undo = GIMP_PAINT_CORE_UNDO (object);

  switch (property_id)
    {
    case PROP_PAINT_CORE:
      g_value_set_object (value, paint_core_undo->paint_core);
      break;

    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
      break;
    }
}
Exemplo n.º 8
0
static GObject *
gimp_paint_core_undo_constructor (GType                  type,
                                  guint                  n_params,
                                  GObjectConstructParam *params)
{
  GObject           *object;
  GimpPaintCoreUndo *paint_core_undo;

  object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);

  paint_core_undo = GIMP_PAINT_CORE_UNDO (object);

  g_assert (GIMP_IS_PAINT_CORE (paint_core_undo->paint_core));

  paint_core_undo->last_coords = paint_core_undo->paint_core->start_coords;

  g_object_add_weak_pointer (G_OBJECT (paint_core_undo->paint_core),
                             (gpointer) &paint_core_undo->paint_core);

  return object;
}