1 /*
2 * This is a plug-in for GIMP.
3 *
4 * Generates clickable image maps.
5 *
6 * Copyright (C) 1998-1999 Maurits Rijk lpeek.mrijk@consunet.nl
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 *
21 */
22
23 #include "config.h"
24
25 #include <gtk/gtk.h>
26
27 #include "imap_commands.h"
28
29 #include "libgimp/stdplugins-intl.h"
30
31 static void object_down_command_destruct(Command_t *parent);
32 static CmdExecuteValue_t object_down_command_execute(Command_t *parent);
33 static void object_down_command_undo(Command_t *parent);
34
35 static CommandClass_t object_down_command_class = {
36 object_down_command_destruct,
37 object_down_command_execute,
38 object_down_command_undo,
39 NULL /* object_down_command_redo */
40 };
41
42 typedef struct {
43 Command_t parent;
44 ObjectList_t *list;
45 Object_t *obj;
46 } ObjectDownCommand_t;
47
48 Command_t*
object_down_command_new(ObjectList_t * list,Object_t * obj)49 object_down_command_new(ObjectList_t *list, Object_t *obj)
50 {
51 ObjectDownCommand_t *command = g_new(ObjectDownCommand_t, 1);
52 command->list = list;
53 command->obj = object_ref(obj);
54 return command_init(&command->parent, _("Move Down"),
55 &object_down_command_class);
56 }
57
58 static void
object_down_command_destruct(Command_t * parent)59 object_down_command_destruct(Command_t *parent)
60 {
61 ObjectDownCommand_t *command = (ObjectDownCommand_t*) parent;
62 object_unref(command->obj);
63 }
64
65 static CmdExecuteValue_t
object_down_command_execute(Command_t * parent)66 object_down_command_execute(Command_t *parent)
67 {
68 ObjectDownCommand_t *command = (ObjectDownCommand_t*) parent;
69 object_list_move_down(command->list, command->obj);
70 return CMD_APPEND;
71 }
72
73 static void
object_down_command_undo(Command_t * parent)74 object_down_command_undo(Command_t *parent)
75 {
76 ObjectDownCommand_t *command = (ObjectDownCommand_t*) parent;
77 object_list_move_up(command->list, command->obj);
78 }
79