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_copy.c < prev    next >
Encoding:
C/C++ Source or Header  |  1999-10-25  |  2.1 KB  |  68 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_copy.h"
  25. #include "libgimp/stdplugins-intl.h"
  26.  
  27. static CmdExecuteValue_t copy_command_execute(Command_t *parent);
  28. static void copy_command_undo(Command_t *parent);
  29.  
  30. static CommandClass_t copy_command_class = {
  31.    NULL,            /* copy_command_destruct */
  32.    copy_command_execute,
  33.    copy_command_undo,
  34.    NULL                /* copy_command_redo */
  35. };
  36.  
  37. typedef struct {
  38.    Command_t parent;
  39.    ObjectList_t *list;
  40.    ObjectList_t *paste_buffer;
  41. } CopyCommand_t;
  42.  
  43. Command_t*
  44. copy_command_new(ObjectList_t *list)
  45. {
  46.    CopyCommand_t *command = g_new(CopyCommand_t, 1);
  47.    command->list = list;
  48.    command->paste_buffer = NULL;
  49.    return command_init(&command->parent, _("Copy"), ©_command_class);
  50. }
  51.  
  52. static CmdExecuteValue_t
  53. copy_command_execute(Command_t *parent)
  54. {
  55.    CopyCommand_t *command = (CopyCommand_t*) parent;
  56.    command->paste_buffer = object_list_copy(command->paste_buffer, 
  57.                         get_paste_buffer());
  58.    object_list_copy_to_paste_buffer(command->list);
  59.    return CMD_APPEND;
  60. }
  61.  
  62. static void
  63. copy_command_undo(Command_t *parent)
  64. {
  65.    CopyCommand_t *command = (CopyCommand_t*) parent;
  66.    object_list_copy(get_paste_buffer(), command->paste_buffer);
  67. }
  68.