コード例 #1
0
ファイル: parasite-cmds.c プロジェクト: jdburton/gimp-osx
static GValueArray *
vectors_parasite_list_invoker (GimpProcedure      *procedure,
                               Gimp               *gimp,
                               GimpContext        *context,
                               GimpProgress       *progress,
                               const GValueArray  *args,
                               GError            **error)
{
  gboolean success = TRUE;
  GValueArray *return_vals;
  GimpVectors *vectors;
  gint32 num_parasites = 0;
  gchar **parasites = NULL;

  vectors = gimp_value_get_vectors (&args->values[0], gimp);

  if (success)
    {
      parasites = gimp_item_parasite_list (GIMP_ITEM (vectors), &num_parasites);
    }

  return_vals = gimp_procedure_get_return_values (procedure, success,
                                                  error ? *error : NULL);

  if (success)
    {
      g_value_set_int (&return_vals->values[1], num_parasites);
      gimp_value_take_stringarray (&return_vals->values[2], parasites, num_parasites);
    }

  return return_vals;
}
コード例 #2
0
ファイル: buffer_cmds.c プロジェクト: Amerekanets/gimp
static GValueArray *
buffers_get_list_invoker (GimpProcedure     *procedure,
                          Gimp              *gimp,
                          GimpContext       *context,
                          GimpProgress      *progress,
                          const GValueArray *args)
{
  gboolean success = TRUE;
  GValueArray *return_vals;
  const gchar *filter;
  gint32 num_buffers = 0;
  gchar **buffer_list = NULL;

  filter = g_value_get_string (&args->values[0]);

  if (success)
    {
      buffer_list = gimp_container_get_filtered_name_array (gimp->named_buffers,
                                                            filter, &num_buffers);
    }

  return_vals = gimp_procedure_get_return_values (procedure, success);

  if (success)
    {
      g_value_set_int (&return_vals->values[1], num_buffers);
      gimp_value_take_stringarray (&return_vals->values[2], buffer_list, num_buffers);
    }

  return return_vals;
}
コード例 #3
0
ファイル: palettes-cmds.c プロジェクト: jiapei100/gimp
static GimpValueArray *
palettes_get_list_invoker (GimpProcedure         *procedure,
                           Gimp                  *gimp,
                           GimpContext           *context,
                           GimpProgress          *progress,
                           const GimpValueArray  *args,
                           GError               **error)
{
  gboolean success = TRUE;
  GimpValueArray *return_vals;
  const gchar *filter;
  gint32 num_palettes = 0;
  gchar **palette_list = NULL;

  filter = g_value_get_string (gimp_value_array_index (args, 0));

  if (success)
    {
      palette_list = gimp_container_get_filtered_name_array (gimp_data_factory_get_container (gimp->palette_factory),
                                                             filter, &num_palettes);
    }

  return_vals = gimp_procedure_get_return_values (procedure, success,
                                                  error ? *error : NULL);

  if (success)
    {
      g_value_set_int (gimp_value_array_index (return_vals, 1), num_palettes);
      gimp_value_take_stringarray (gimp_value_array_index (return_vals, 2), palette_list, num_palettes);
    }

  return return_vals;
}
コード例 #4
0
ファイル: gradients-cmds.c プロジェクト: jdburton/gimp-osx
static GValueArray *
gradients_get_list_invoker (GimpProcedure      *procedure,
                            Gimp               *gimp,
                            GimpContext        *context,
                            GimpProgress       *progress,
                            const GValueArray  *args,
                            GError            **error)
{
  gboolean success = TRUE;
  GValueArray *return_vals;
  const gchar *filter;
  gint32 num_gradients = 0;
  gchar **gradient_list = NULL;

  filter = g_value_get_string (&args->values[0]);

  if (success)
    {
      gradient_list = gimp_container_get_filtered_name_array (gimp->gradient_factory->container,
                                                              filter, &num_gradients);
    }

  return_vals = gimp_procedure_get_return_values (procedure, success,
                                                  error ? *error : NULL);

  if (success)
    {
      g_value_set_int (&return_vals->values[1], num_gradients);
      gimp_value_take_stringarray (&return_vals->values[2], gradient_list, num_gradients);
    }

  return return_vals;
}
コード例 #5
0
ファイル: plug-in-cmds.c プロジェクト: Amerekanets/gimp-1
static GValueArray *
plugins_query_invoker (GimpProcedure      *procedure,
                       Gimp               *gimp,
                       GimpContext        *context,
                       GimpProgress       *progress,
                       const GValueArray  *args,
                       GError            **error)
{
  GValueArray *return_vals;
  const gchar *search_string;
  gint32 num_plugins = 0;
  gchar **menu_path = NULL;
  gchar **plugin_accelerator = NULL;
  gchar **plugin_location = NULL;
  gchar **plugin_image_type = NULL;
  gint32 *plugin_install_time = NULL;
  gchar **plugin_real_name = NULL;

  search_string = g_value_get_string (&args->values[0]);

  num_plugins = gimp_plug_in_manager_query (gimp->plug_in_manager,
                                            search_string,
                                            &menu_path,
                                            &plugin_accelerator,
                                            &plugin_location,
                                            &plugin_image_type,
                                            &plugin_real_name,
                                            &plugin_install_time);

  return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);

  g_value_set_int (&return_vals->values[1], num_plugins);
  gimp_value_take_stringarray (&return_vals->values[2], menu_path, num_plugins);
  g_value_set_int (&return_vals->values[3], num_plugins);
  gimp_value_take_stringarray (&return_vals->values[4], plugin_accelerator, num_plugins);
  g_value_set_int (&return_vals->values[5], num_plugins);
  gimp_value_take_stringarray (&return_vals->values[6], plugin_location, num_plugins);
  g_value_set_int (&return_vals->values[7], num_plugins);
  gimp_value_take_stringarray (&return_vals->values[8], plugin_image_type, num_plugins);
  g_value_set_int (&return_vals->values[9], num_plugins);
  gimp_value_take_int32array (&return_vals->values[10], plugin_install_time, num_plugins);
  g_value_set_int (&return_vals->values[11], num_plugins);
  gimp_value_take_stringarray (&return_vals->values[12], plugin_real_name, num_plugins);

  return return_vals;
}
コード例 #6
0
ファイル: plug-in-cmds.c プロジェクト: AjayRamanathan/gimp
static GimpValueArray *
plugins_query_invoker (GimpProcedure         *procedure,
                       Gimp                  *gimp,
                       GimpContext           *context,
                       GimpProgress          *progress,
                       const GimpValueArray  *args,
                       GError               **error)
{
  GimpValueArray *return_vals;
  const gchar *search_string;
  gint32 num_plugins = 0;
  gchar **menu_path = NULL;
  gchar **plugin_accelerator = NULL;
  gchar **plugin_location = NULL;
  gchar **plugin_image_type = NULL;
  gint32 *plugin_install_time = NULL;
  gchar **plugin_real_name = NULL;

  search_string = g_value_get_string (gimp_value_array_index (args, 0));

  num_plugins = gimp_plug_in_manager_query (gimp->plug_in_manager,
                                            search_string,
                                            &menu_path,
                                            &plugin_accelerator,
                                            &plugin_location,
                                            &plugin_image_type,
                                            &plugin_real_name,
                                            &plugin_install_time);

  return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);

  g_value_set_int (gimp_value_array_index (return_vals, 1), num_plugins);
  gimp_value_take_stringarray (gimp_value_array_index (return_vals, 2), menu_path, num_plugins);
  g_value_set_int (gimp_value_array_index (return_vals, 3), num_plugins);
  gimp_value_take_stringarray (gimp_value_array_index (return_vals, 4), plugin_accelerator, num_plugins);
  g_value_set_int (gimp_value_array_index (return_vals, 5), num_plugins);
  gimp_value_take_stringarray (gimp_value_array_index (return_vals, 6), plugin_location, num_plugins);
  g_value_set_int (gimp_value_array_index (return_vals, 7), num_plugins);
  gimp_value_take_stringarray (gimp_value_array_index (return_vals, 8), plugin_image_type, num_plugins);
  g_value_set_int (gimp_value_array_index (return_vals, 9), num_plugins);
  gimp_value_take_int32array (gimp_value_array_index (return_vals, 10), plugin_install_time, num_plugins);
  g_value_set_int (gimp_value_array_index (return_vals, 11), num_plugins);
  gimp_value_take_stringarray (gimp_value_array_index (return_vals, 12), plugin_real_name, num_plugins);

  return return_vals;
}
コード例 #7
0
static GimpValueArray *
procedural_db_query_invoker (GimpProcedure         *procedure,
                             Gimp                  *gimp,
                             GimpContext           *context,
                             GimpProgress          *progress,
                             const GimpValueArray  *args,
                             GError               **error)
{
  gboolean success = TRUE;
  GimpValueArray *return_vals;
  const gchar *name;
  const gchar *blurb;
  const gchar *help;
  const gchar *author;
  const gchar *copyright;
  const gchar *date;
  const gchar *proc_type;
  gint32 num_matches = 0;
  gchar **procedure_names = NULL;

  name = g_value_get_string (gimp_value_array_index (args, 0));
  blurb = g_value_get_string (gimp_value_array_index (args, 1));
  help = g_value_get_string (gimp_value_array_index (args, 2));
  author = g_value_get_string (gimp_value_array_index (args, 3));
  copyright = g_value_get_string (gimp_value_array_index (args, 4));
  date = g_value_get_string (gimp_value_array_index (args, 5));
  proc_type = g_value_get_string (gimp_value_array_index (args, 6));

  if (success)
    {
      success = gimp_pdb_query (gimp->pdb,
                                name, blurb, help, author,
                                copyright, date, proc_type,
                                &num_matches, &procedure_names,
                                error);
    }

  return_vals = gimp_procedure_get_return_values (procedure, success,
                                                  error ? *error : NULL);

  if (success)
    {
      g_value_set_int (gimp_value_array_index (return_vals, 1), num_matches);
      gimp_value_take_stringarray (gimp_value_array_index (return_vals, 2), procedure_names, num_matches);
    }

  return return_vals;
}
コード例 #8
0
ファイル: gimp-cmds.c プロジェクト: jiapei100/gimp
static GimpValueArray *
get_parasite_list_invoker (GimpProcedure         *procedure,
                           Gimp                  *gimp,
                           GimpContext           *context,
                           GimpProgress          *progress,
                           const GimpValueArray  *args,
                           GError               **error)
{
  GimpValueArray *return_vals;
  gint32 num_parasites = 0;
  gchar **parasites = NULL;

  parasites = gimp_parasite_list (gimp, &num_parasites);

  return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);

  g_value_set_int (gimp_value_array_index (return_vals, 1), num_parasites);
  gimp_value_take_stringarray (gimp_value_array_index (return_vals, 2), parasites, num_parasites);

  return return_vals;
}
コード例 #9
0
ファイル: gimphelp.c プロジェクト: Amerekanets/gimp
static void
gimp_help_call (Gimp        *gimp,
                const gchar *procedure_name,
                const gchar *help_domain,
                const gchar *help_locales,
                const gchar *help_id)
{
  GimpProcedure *procedure;

  /*  Special case the help browser  */
  if (! strcmp (procedure_name, "extension-gimp-help-browser-temp"))
    {
      GValueArray *return_vals;

      return_vals =
        gimp_pdb_execute_procedure_by_name (gimp->pdb,
                                            gimp_get_user_context (gimp),
                                            NULL,
                                            procedure_name,
                                            G_TYPE_STRING, help_domain,
                                            G_TYPE_STRING, help_locales,
                                            G_TYPE_STRING, help_id,
                                            G_TYPE_NONE);

      g_value_array_free (return_vals);

      return;
    }

  /*  Check if a help parser is already running  */
  procedure = gimp_pdb_lookup_procedure (gimp->pdb, "extension-gimp-help-temp");

  if (! procedure)
    {
      GValueArray  *args         = NULL;
      gint          n_domains    = 0;
      gchar       **help_domains = NULL;
      gchar       **help_uris    = NULL;

      procedure = gimp_pdb_lookup_procedure (gimp->pdb, "extension-gimp-help");

      if (! procedure)
        /*  FIXME: error msg  */
        return;

      n_domains = gimp_plug_in_manager_get_help_domains (gimp->plug_in_manager,
                                                         &help_domains,
                                                         &help_uris);

      args = gimp_procedure_get_arguments (procedure);
      gimp_value_array_truncate (args, 4);

      g_value_set_int             (&args->values[0], n_domains);
      gimp_value_take_stringarray (&args->values[1], help_domains, n_domains);
      g_value_set_int             (&args->values[2], n_domains);
      gimp_value_take_stringarray (&args->values[3], help_uris, n_domains);

      gimp_procedure_execute_async (procedure, gimp,
                                    gimp_get_user_context (gimp),
                                    NULL, args, NULL);

      g_value_array_free (args);
    }

  /*  Check if the help parser started properly  */
  procedure = gimp_pdb_lookup_procedure (gimp->pdb, "extension-gimp-help-temp");

  if (procedure)
    {
      GValueArray *return_vals;

#ifdef GIMP_HELP_DEBUG
      g_printerr ("Calling help via %s: %s %s %s\n",
                  procedure_name,
                  help_domain  ? help_domain  : "(null)",
                  help_locales ? help_locales : "(null)",
                  help_id      ? help_id      : "(null)");
#endif

      return_vals =
        gimp_pdb_execute_procedure_by_name (gimp->pdb,
                                            gimp_get_user_context (gimp),
                                            NULL,
                                            "extension-gimp-help-temp",
                                            G_TYPE_STRING, procedure_name,
                                            G_TYPE_STRING, help_domain,
                                            G_TYPE_STRING, help_locales,
                                            G_TYPE_STRING, help_id,
                                            G_TYPE_NONE);

      g_value_array_free (return_vals);
    }
}
コード例 #10
0
ファイル: gimphelp.c プロジェクト: Amerekanets/gimp
static gboolean
gimp_help_browser (Gimp *gimp)
{
  static gboolean  busy = FALSE;
  GimpProcedure   *procedure;

  if (busy)
    return TRUE;

  busy = TRUE;

  /*  Check if a help browser is already running  */
  procedure = gimp_pdb_lookup_procedure (gimp->pdb,
                                         "extension-gimp-help-browser-temp");

  if (! procedure)
    {
      GValueArray *args          = NULL;
      gint          n_domains    = 0;
      gchar       **help_domains = NULL;
      gchar       **help_uris    = NULL;

      procedure = gimp_pdb_lookup_procedure (gimp->pdb,
                                             "extension-gimp-help-browser");

      if (! procedure)
        {
          gimp_help_browser_error (gimp,
                                   _("Help browser not found"),
                                   _("Could not find GIMP help browser."),
                                   _("The GIMP help browser plug-in appears "
                                     "to be missing from your installation."));
          busy = FALSE;

          return FALSE;
        }

      n_domains = gimp_plug_in_manager_get_help_domains (gimp->plug_in_manager,
                                                         &help_domains,
                                                         &help_uris);

      args = gimp_procedure_get_arguments (procedure);
      gimp_value_array_truncate (args, 5);

      g_value_set_int             (&args->values[0], GIMP_RUN_INTERACTIVE);
      g_value_set_int             (&args->values[1], n_domains);
      gimp_value_take_stringarray (&args->values[2], help_domains, n_domains);
      g_value_set_int             (&args->values[3], n_domains);
      gimp_value_take_stringarray (&args->values[4], help_uris, n_domains);

      gimp_procedure_execute_async (procedure, gimp,
                                    gimp_get_user_context (gimp),
                                    NULL, args, NULL);

      g_value_array_free (args);
    }

  /*  Check if the help browser started properly  */
  procedure = gimp_pdb_lookup_procedure (gimp->pdb,
                                         "extension-gimp-help-browser-temp");

  if (! procedure)
    {
      gimp_help_browser_error (gimp,
                               _("Help browser doesn't start"),
                               _("Could not start the GIMP help browser plug-in."),
                               NULL);
      busy = FALSE;

      return FALSE;
    }

  busy = FALSE;

  return TRUE;
}