home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 2002 April / pcpro0402.iso / essentials / graphics / Gimp / gimp-src-20001226.exe / src / gimp / plug-ins / imagemap / imap_cmd_clear.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-22  |  2.4 KB  |  86 lines

  1. /*
  2.  * This is a plug-in for the 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 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 "imap_cmd_clear.h"
  25. #include "imap_cmd_delete.h"
  26. #include "libgimp/stdplugins-intl.h"
  27. #include "imap_main.h"
  28.  
  29. static CmdExecuteValue_t clear_command_execute(Command_t *parent);
  30. static void clear_command_undo(Command_t *parent);
  31. static void clear_command_redo(Command_t *parent);
  32.  
  33. static CommandClass_t clear_command_class = {
  34.    NULL,            /* clear_command_destruct */
  35.    clear_command_execute,
  36.    clear_command_undo,
  37.    clear_command_redo
  38. };
  39.  
  40. typedef struct {
  41.    Command_t      parent;
  42.    ObjectList_t    *list;
  43. } ClearCommand_t;
  44.  
  45. Command_t* 
  46. clear_command_new(ObjectList_t *list)
  47. {
  48.    ClearCommand_t *command = g_new(ClearCommand_t, 1);
  49.    command->list = list;
  50.    return command_init(&command->parent, _("Clear"), &clear_command_class);
  51. }
  52.  
  53. static void
  54. remove_one_object(Object_t *obj, gpointer data)
  55. {
  56.    ClearCommand_t *command = (ClearCommand_t*) data;
  57.    command_add_subcommand(&command->parent,
  58.               delete_command_new(command->list, obj));
  59. }
  60.  
  61. static CmdExecuteValue_t
  62. clear_command_execute(Command_t *parent)
  63. {
  64.    ClearCommand_t *command = (ClearCommand_t*) parent;
  65.    gpointer id;
  66.  
  67.    id = object_list_add_remove_cb(command->list, remove_one_object, command);
  68.    object_list_delete_selected(command->list);
  69.    object_list_remove_remove_cb(command->list, id);
  70.  
  71.    redraw_preview();        /* Fix me! */
  72.    return CMD_APPEND;
  73. }
  74.  
  75. static void
  76. clear_command_undo(Command_t *parent)
  77. {
  78.    redraw_preview();        /* Fix me! */
  79. }
  80.  
  81. static void
  82. clear_command_redo(Command_t *parent)
  83. {
  84.    redraw_preview();        /* Fix me! */
  85. }
  86.