~ubuntu-branches/ubuntu/hoary/gimp/hoary

« back to all changes in this revision

Viewing changes to plug-ins/imagemap/imap_cmd_move_up.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2005-04-04 14:51:23 UTC
  • Revision ID: james.westby@ubuntu.com-20050404145123-9py049eeelfymur8
Tags: upstream-2.2.2
ImportĀ upstreamĀ versionĀ 2.2.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * This is a plug-in for the GIMP.
 
3
 *
 
4
 * Generates clickable image maps.
 
5
 *
 
6
 * Copyright (C) 1998-2003 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 2 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, write to the Free Software
 
20
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
21
 *
 
22
 */
 
23
 
 
24
#include "config.h"
 
25
 
 
26
#include <gtk/gtk.h>
 
27
 
 
28
#include "imap_commands.h"
 
29
 
 
30
#include "libgimp/stdplugins-intl.h"
 
31
 
 
32
static CmdExecuteValue_t move_up_command_execute(Command_t *parent);
 
33
 
 
34
CommandClass_t move_up_command_class = {
 
35
   NULL,                        /* move_up_command_destruct */
 
36
   move_up_command_execute,
 
37
   NULL,                        /* move_up_command_undo */
 
38
   NULL                         /* move_up_command_redo */
 
39
};
 
40
 
 
41
typedef struct {
 
42
   Command_t parent;
 
43
   ObjectList_t *list;
 
44
   gboolean add;
 
45
} MoveUpCommand_t;
 
46
 
 
47
Command_t* 
 
48
move_up_command_new(ObjectList_t *list)
 
49
{
 
50
   MoveUpCommand_t *command = g_new(MoveUpCommand_t, 1);
 
51
   command->list = list;
 
52
   command->add = FALSE;
 
53
   return command_init(&command->parent, _("Move Up"), &move_up_command_class);
 
54
}
 
55
 
 
56
static void
 
57
move_up_one_object(Object_t *obj, gpointer data)
 
58
{
 
59
   MoveUpCommand_t *command = (MoveUpCommand_t*) data;
 
60
 
 
61
   if (command->add) {
 
62
      command_add_subcommand(&command->parent,
 
63
                             object_up_command_new(command->list, obj));
 
64
      command->add = FALSE;
 
65
   }
 
66
   else {
 
67
      command->add = TRUE;
 
68
   }
 
69
}
 
70
 
 
71
static CmdExecuteValue_t
 
72
move_up_command_execute(Command_t *parent)
 
73
{
 
74
   MoveUpCommand_t *command = (MoveUpCommand_t*) parent;
 
75
   gpointer id;
 
76
 
 
77
   id = object_list_add_move_cb(command->list, move_up_one_object, command);
 
78
   object_list_move_selected_up(command->list);
 
79
   object_list_remove_move_cb(command->list, id);
 
80
 
 
81
   return CMD_APPEND;
 
82
}