File: undo_cmds.c

package info (click to toggle)
gimp 1.0.2-3
  • links: PTS
  • area: main
  • in suites: slink
  • size: 17,116 kB
  • ctags: 16,070
  • sloc: ansic: 226,067; lisp: 8,497; sh: 4,965; makefile: 4,543
file content (135 lines) | stat: -rw-r--r-- 3,263 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/* The GIMP -- an 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 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 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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "appenv.h"
#include "drawable.h"
#include "general.h"
#include "undo.h"
#include "undo_cmds.h"

static int int_value;
static int success;

/***************************/
/*  UNDO_PUSH_GROUP_START  */

static Argument *
undo_push_group_start_invoker (Argument *args)
{
  GImage *gimage;

  success = TRUE;
  if (success)
    {
      int_value = args[0].value.pdb_int;
      if ((gimage = gimage_get_ID (int_value)) == NULL)
	success = FALSE;
    }

  if (success)
    undo_push_group_start (gimage, MISC_UNDO);

  return procedural_db_return_args (&undo_push_group_start_proc, success);
}

/*  The procedure definition  */
ProcArg undo_push_group_start_args[] =
{
  { PDB_IMAGE,
    "image",
    "The ID of the image in which to pop an undo group"
  }
};

ProcRecord undo_push_group_start_proc =
{
  "gimp_undo_push_group_start",
  "Starts a group undo",
  "This function is used to start a group undo--necessary for logically combining two or more undo operations into a single operation.  This call must be used in conjunction with a 'gimp_undo_push_group_end' call.",
  "Spencer Kimball & Peter Mattis",
  "Spencer Kimball & Peter Mattis",
  "1997",
  PDB_INTERNAL,

  /*  Input arguments  */
  1,
  undo_push_group_start_args,

  /*  Output arguments  */
  0,
  NULL,

  /*  Exec method  */
  { { undo_push_group_start_invoker } },
};


/*************************/
/*  UNDO_PUSH_GROUP_END  */

static Argument *
undo_push_group_end_invoker  (Argument *args)
{
  GImage *gimage;

  success = TRUE;
  if (success)
    {
      int_value = args[0].value.pdb_int;
      if ((gimage = gimage_get_ID (int_value)) == NULL)
	success = FALSE;
    }

  if (success)
    undo_push_group_end (gimage);

  return procedural_db_return_args (&undo_push_group_end_proc, success);
}

/*  The procedure definition  */
ProcArg undo_push_group_end_args[] =
{
  { PDB_IMAGE,
    "image",
    "The ID of the image in which to pop an undo group"
  }
};

ProcRecord undo_push_group_end_proc =
{
  "gimp_undo_push_group_end",
  "Finish a group undo",
  "This function must be called once for each undo_push_group call that is made.",
  "Spencer Kimball & Peter Mattis",
  "Spencer Kimball & Peter Mattis",
  "1997",
  PDB_INTERNAL,

  /*  Input arguments  */
  1,
  undo_push_group_end_args,

  /*  Output arguments  */
  0,
  NULL,

  /*  Exec method  */
  { { undo_push_group_end_invoker } },
};