All pastes #550777 Raw Edit

Mine

public text v1 · immutable
·published 2007-06-08 15:08 UTC
rendered paste body
#include <libgimp/gimp.h>

static void query (void);
static void run   (const gchar      *name,
                   gint              nparams,
                   const GimpParam  *param,
                   gint             *nreturn_vals,
                   GimpParam       **return_vals);

GimpPlugInInfo PLUG_IN_INFO =
{
  NULL,
  NULL,
  query,
  run
};

MAIN()

static void
query (void)
{
  static GimpParamDef args[] =
  {
    {
      GIMP_PDB_INT32,
      "run-mode",
      "Run mode"
    },
    {
      GIMP_PDB_IMAGE,
      "image",
      "Input image"
    },
    {
      GIMP_PDB_DRAWABLE,
      "drawable",
      "Input drawable"
    }
  };

  gimp_install_procedure (
    "test-runmode",
    "Test Runmode",
    "Displays the runmode",
    "Matthew Shooshtari",
    "Matthew Shooshtari",
    "2007",
    "_Display Runmode...",
    "RGB*, GRAY*",
    GIMP_PLUGIN,
    G_N_ELEMENTS (args), 0,
    args, NULL);

  gimp_plugin_menu_register ("plug-in-testmode",
                             "<Toolbox>/Xtns/TestMode");
}

static void
run (const gchar      *name,
     gint              nparams,
     const GimpParam  *param,
     gint             *nreturn_vals,
     GimpParam       **return_vals)
{
  static GimpParam  values[1];
  GimpPDBStatusType status = GIMP_PDB_SUCCESS;
  GimpRunMode       run_mode;

  /* Setting mandatory output values */
  *nreturn_vals = 1;
  *return_vals  = values;

  values[0].type = GIMP_PDB_STATUS;
  values[0].data.d_status = status;

  /*Display a message indicating which run mode we are in */
  run_mode = param[0].data.d_int32;

   switch (run_mode) {
  case GIMP_RUN_INTERACTIVE:
    g_message("interactive");
    return;

  case GIMP_RUN_NONINTERACTIVE:
    g_message("non-interactive");
    return;

  case GIMP_RUN_WITH_LAST_VALS:
    g_message("last vals");
    return;

  default:
	g_message("default");
    return;
  }