home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 2002 April / pcpro0402.iso / essentials / graphics / Gimp / gimp-src-20001226.exe / src / gimp / app / display_cmds.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-06-01  |  4.2 KB  |  163 lines

  1. /* The GIMP -- an image manipulation program
  2.  * Copyright (C) 1995-2000 Spencer Kimball and Peter Mattis
  3.  *
  4.  * This program is free software; you can redistribute it and/or modify
  5.  * it under the terms of the GNU General Public License as published by
  6.  * the Free Software Foundation; either version 2 of the License, or
  7.  * (at your option) any later version.
  8.  *
  9.  * This program is distributed in the hope that it will be useful,
  10.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.  * GNU General Public License for more details.
  13.  *
  14.  * You should have received a copy of the GNU General Public License
  15.  * along with this program; if not, write to the Free Software
  16.  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17.  */
  18.  
  19. /* NOTE: This file is autogenerated by pdbgen.pl. */
  20.  
  21. #include "procedural_db.h"
  22.  
  23. #include "gdisplay.h"
  24.  
  25. static ProcRecord display_new_proc;
  26. static ProcRecord display_delete_proc;
  27. static ProcRecord displays_flush_proc;
  28.  
  29. void
  30. register_display_procs (void)
  31. {
  32.   procedural_db_register (&display_new_proc);
  33.   procedural_db_register (&display_delete_proc);
  34.   procedural_db_register (&displays_flush_proc);
  35. }
  36.  
  37. static Argument *
  38. display_new_invoker (Argument *args)
  39. {
  40.   gboolean success = TRUE;
  41.   Argument *return_args;
  42.   GimpImage *gimage;
  43.   GDisplay *gdisp = NULL;
  44.   guint scale = 0x101;
  45.  
  46.   gimage = pdb_id_to_image (args[0].value.pdb_int);
  47.   if (gimage == NULL)
  48.     success = FALSE;
  49.  
  50.   if (success)
  51.     {
  52.       if (gimage->layers)
  53.     success = (gdisp = gdisplay_new (gimage, scale)) != NULL;
  54.       else
  55.     success = FALSE;
  56.     }
  57.  
  58.   return_args = procedural_db_return_args (&display_new_proc, success);
  59.  
  60.   if (success)
  61.     return_args[1].value.pdb_int = gdisp->ID;
  62.  
  63.   return return_args;
  64. }
  65.  
  66. static ProcArg display_new_inargs[] =
  67. {
  68.   {
  69.     PDB_IMAGE,
  70.     "image",
  71.     "The image"
  72.   }
  73. };
  74.  
  75. static ProcArg display_new_outargs[] =
  76. {
  77.   {
  78.     PDB_DISPLAY,
  79.     "display",
  80.     "The new display"
  81.   }
  82. };
  83.  
  84. static ProcRecord display_new_proc =
  85. {
  86.   "gimp_display_new",
  87.   "Create a new display for the specified image.",
  88.   "Creates a new display for the specified image. If the image already has a display, another is added. Multiple displays are handled transparently by the GIMP. The newly created display is returned and can be subsequently destroyed with a call to 'gimp-display-delete'. This procedure only makes sense for use with the GIMP UI.",
  89.   "Spencer Kimball & Peter Mattis",
  90.   "Spencer Kimball & Peter Mattis",
  91.   "1995-1996",
  92.   PDB_INTERNAL,
  93.   1,
  94.   display_new_inargs,
  95.   1,
  96.   display_new_outargs,
  97.   { { display_new_invoker } }
  98. };
  99.  
  100. static Argument *
  101. display_delete_invoker (Argument *args)
  102. {
  103.   gboolean success = TRUE;
  104.   GDisplay *gdisp;
  105.  
  106.   gdisp = gdisplay_get_ID (args[0].value.pdb_int);
  107.   if (gdisp == NULL)
  108.     success = FALSE;
  109.  
  110.   if (success)
  111.     gtk_widget_destroy (gdisp->shell);
  112.  
  113.   return procedural_db_return_args (&display_delete_proc, success);
  114. }
  115.  
  116. static ProcArg display_delete_inargs[] =
  117. {
  118.   {
  119.     PDB_DISPLAY,
  120.     "display",
  121.     "The display to delete"
  122.   }
  123. };
  124.  
  125. static ProcRecord display_delete_proc =
  126. {
  127.   "gimp_display_delete",
  128.   "Delete the specified display.",
  129.   "This procedure removes the specified display. If this is the last remaining display for the underlying image, then the image is deleted also.",
  130.   "Spencer Kimball & Peter Mattis",
  131.   "Spencer Kimball & Peter Mattis",
  132.   "1995-1996",
  133.   PDB_INTERNAL,
  134.   1,
  135.   display_delete_inargs,
  136.   0,
  137.   NULL,
  138.   { { display_delete_invoker } }
  139. };
  140.  
  141. static Argument *
  142. displays_flush_invoker (Argument *args)
  143. {
  144.   gdisplays_flush ();
  145.   return procedural_db_return_args (&displays_flush_proc, TRUE);
  146. }
  147.  
  148. static ProcRecord displays_flush_proc =
  149. {
  150.   "gimp_displays_flush",
  151.   "Flush all internal changes to the user interface",
  152.   "This procedure takes no arguments and returns nothing except a success status. Its purpose is to flush all pending updates of image manipulations to the user interface. It should be called whenever appropriate.",
  153.   "Spencer Kimball & Peter Mattis",
  154.   "Spencer Kimball & Peter Mattis",
  155.   "1995-1996",
  156.   PDB_INTERNAL,
  157.   0,
  158.   NULL,
  159.   0,
  160.   NULL,
  161.   { { displays_flush_invoker } }
  162. };
  163.