Ejemplo n.º 1
0
GimpUndo *
gimp_undo_stack_free_bottom (GimpUndoStack *stack,
                             GimpUndoMode   undo_mode)
{
  GimpUndo *undo;
  gint      n_children;

  g_return_val_if_fail (GIMP_IS_UNDO_STACK (stack), NULL);

  n_children = gimp_container_num_children (GIMP_CONTAINER (stack->undos));

  undo = (GimpUndo *)
    gimp_container_get_child_by_index (GIMP_CONTAINER (stack->undos),
                                       n_children - 1);

  if (undo)
    {
      gimp_container_remove (GIMP_CONTAINER (stack->undos), GIMP_OBJECT (undo));
      gimp_undo_free (undo, undo_mode);

      return undo;
    }

  return NULL;
}
Ejemplo n.º 2
0
gint
gimp_undo_stack_get_depth (GimpUndoStack *stack)
{
  g_return_val_if_fail (GIMP_IS_UNDO_STACK (stack), 0);

  return gimp_container_num_children (stack->undos);
}
Ejemplo n.º 3
0
GimpUndo *
gimp_undo_stack_peek (GimpUndoStack *stack)
{
  g_return_val_if_fail (GIMP_IS_UNDO_STACK (stack), NULL);

  return GIMP_UNDO (gimp_container_get_first_child (stack->undos));
}
Ejemplo n.º 4
0
void
gimp_undo_stack_push_undo (GimpUndoStack *stack,
                           GimpUndo      *undo)
{
  g_return_if_fail (GIMP_IS_UNDO_STACK (stack));
  g_return_if_fail (GIMP_IS_UNDO (undo));

  gimp_container_add (GIMP_CONTAINER (stack->undos), GIMP_OBJECT (undo));
}
Ejemplo n.º 5
0
GimpUndo *
gimp_undo_stack_peek (GimpUndoStack *stack)
{
  GimpObject *object;

  g_return_val_if_fail (GIMP_IS_UNDO_STACK (stack), NULL);

  object = gimp_container_get_child_by_index (GIMP_CONTAINER (stack->undos), 0);

  return (object ? GIMP_UNDO (object) : NULL);
}
Ejemplo n.º 6
0
GimpUndo *
gimp_undo_stack_free_bottom (GimpUndoStack *stack,
                             GimpUndoMode   undo_mode)
{
  GimpUndo *undo;

  g_return_val_if_fail (GIMP_IS_UNDO_STACK (stack), NULL);

  undo = GIMP_UNDO (gimp_container_get_last_child (stack->undos));

  if (undo)
    {
      gimp_container_remove (stack->undos, GIMP_OBJECT (undo));
      gimp_undo_free (undo, undo_mode);

      return undo;
    }

  return NULL;
}
Ejemplo n.º 7
0
GimpUndo *
gimp_undo_stack_pop_undo (GimpUndoStack       *stack,
                          GimpUndoMode         undo_mode,
                          GimpUndoAccumulator *accum)
{
  GimpUndo *undo;

  g_return_val_if_fail (GIMP_IS_UNDO_STACK (stack), NULL);
  g_return_val_if_fail (accum != NULL, NULL);

  undo = GIMP_UNDO (gimp_container_get_first_child (stack->undos));

  if (undo)
    {
      gimp_container_remove (stack->undos, GIMP_OBJECT (undo));
      gimp_undo_pop (undo, undo_mode, accum);

      return undo;
    }

  return NULL;
}