static GValueArray * patterns_set_popup_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GValueArray *args) { gboolean success = TRUE; const gchar *pattern_callback; const gchar *pattern_name; pattern_callback = g_value_get_string (&args->values[0]); pattern_name = g_value_get_string (&args->values[1]); if (success) { if (gimp->no_interface || ! gimp_pdb_lookup_procedure (gimp->pdb, pattern_callback) || ! gimp_pdb_dialog_set (gimp, gimp->pattern_factory->container, pattern_callback, pattern_name, NULL)) success = FALSE; } return gimp_procedure_get_return_values (procedure, success); }
static GimpValueArray * plugin_precision_enabled_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GimpValueArray *args, GError **error) { gboolean success = TRUE; GimpValueArray *return_vals; gboolean enabled = FALSE; GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in; if (plug_in) { enabled = gimp_plug_in_precision_enabled (plug_in); } else { success = FALSE; } return_vals = gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); if (success) g_value_set_boolean (gimp_value_array_index (return_vals, 1), enabled); return return_vals; }
static GimpValueArray * floating_sel_attach_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GimpValueArray *args, GError **error) { gboolean success = TRUE; GimpLayer *layer; GimpDrawable *drawable; layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp); drawable = gimp_value_get_drawable (gimp_value_array_index (args, 1), gimp); if (success) { if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, GIMP_PDB_ITEM_CONTENT, error) && gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error)) floating_sel_attach (layer, drawable); else success = FALSE; } return gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); }
static GimpValueArray * procedural_db_dump_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GimpValueArray *args, GError **error) { gboolean success = TRUE; const gchar *filename; filename = g_value_get_string (gimp_value_array_index (args, 0)); if (success) { GFile *file = g_file_new_for_path (filename); success = gimp_pdb_dump (gimp->pdb, file, error); g_object_unref (file); } return gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); }
static GimpValueArray * plugin_menu_branch_register_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GimpValueArray *args, GError **error) { gboolean success = TRUE; const gchar *menu_path; const gchar *menu_name; menu_path = g_value_get_string (gimp_value_array_index (args, 0)); menu_name = g_value_get_string (gimp_value_array_index (args, 1)); if (success) { GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in; if (plug_in) { gimp_plug_in_manager_add_menu_branch (gimp->plug_in_manager, plug_in->prog, menu_path, menu_name); } else { success = FALSE; } } return gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); }
static GValueArray * brushes_get_spacing_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GValueArray *args) { gboolean success = TRUE; GValueArray *return_vals; gint32 spacing = 0; GimpBrush *brush = gimp_context_get_brush (context); if (brush) spacing = gimp_brush_get_spacing (brush); else success = FALSE; return_vals = gimp_procedure_get_return_values (procedure, success); if (success) g_value_set_int (&return_vals->values[1], spacing); return return_vals; }
static GimpValueArray * procedural_db_get_data_size_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GimpValueArray *args, GError **error) { gboolean success = TRUE; GimpValueArray *return_vals; const gchar *identifier; gint32 bytes = 0; identifier = g_value_get_string (gimp_value_array_index (args, 0)); if (success) { gchar *canonical = gimp_canonicalize_identifier (identifier); if (! gimp_plug_in_manager_get_data (gimp->plug_in_manager, canonical, &bytes)) success = FALSE; g_free (canonical); } 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), bytes); return return_vals; }
static GimpValueArray * selection_combine_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GimpValueArray *args, GError **error) { gboolean success = TRUE; GimpChannel *channel; gint32 operation; channel = gimp_value_get_channel (gimp_value_array_index (args, 0), gimp); operation = g_value_get_enum (gimp_value_array_index (args, 1)); if (success) { if (gimp_pdb_item_is_attached (GIMP_ITEM (channel), NULL, 0, error)) gimp_item_to_selection (GIMP_ITEM (channel), operation, TRUE, FALSE, 0.0, 0.0); else success = FALSE; } return gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); }
static GimpValueArray * temp_name_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GimpValueArray *args, GError **error) { gboolean success = TRUE; GimpValueArray *return_vals; const gchar *extension; gchar *name = NULL; extension = g_value_get_string (gimp_value_array_index (args, 0)); if (success) { name = gimp_get_temp_filename (gimp, extension); } return_vals = gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); if (success) g_value_take_string (gimp_value_array_index (return_vals, 1), name); return return_vals; }
static GimpValueArray * selection_layer_alpha_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GimpValueArray *args, GError **error) { gboolean success = TRUE; GimpLayer *layer; layer = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp); if (success) { if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), NULL, 0, error)) gimp_item_to_selection (GIMP_ITEM (layer), GIMP_CHANNEL_OP_REPLACE, TRUE, FALSE, 0.0, 0.0); else success = FALSE; } return gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); }
static GimpValueArray * selection_save_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GimpValueArray *args, GError **error) { gboolean success = TRUE; GimpValueArray *return_vals; GimpImage *image; GimpChannel *channel = NULL; image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp); if (success) { channel = gimp_selection_save (GIMP_SELECTION (gimp_image_get_mask (image))); if (! channel) success = FALSE; } return_vals = gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); if (success) gimp_value_set_channel (gimp_value_array_index (return_vals, 1), channel); return return_vals; }
static GimpValueArray * selection_border_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GimpValueArray *args, GError **error) { gboolean success = TRUE; GimpImage *image; gint32 radius; image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp); radius = g_value_get_int (gimp_value_array_index (args, 1)); if (success) { /* FIXME: "feather" and "edge-lock" hardcoded to TRUE */ gimp_channel_border (gimp_image_get_mask (image), radius, radius, TRUE, TRUE, TRUE); } return gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); }
static GimpValueArray * selection_translate_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GimpValueArray *args, GError **error) { gboolean success = TRUE; GimpImage *image; gint32 offx; gint32 offy; image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp); offx = g_value_get_int (gimp_value_array_index (args, 1)); offy = g_value_get_int (gimp_value_array_index (args, 2)); if (success) { gimp_item_translate (GIMP_ITEM (gimp_image_get_mask (image)), offx, offy, TRUE); } return gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); }
static GimpValueArray * selection_is_empty_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GimpValueArray *args, GError **error) { gboolean success = TRUE; GimpValueArray *return_vals; GimpImage *image; gboolean is_empty = FALSE; image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp); if (success) { is_empty = gimp_channel_is_empty (gimp_image_get_mask (image)); } return_vals = gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); if (success) g_value_set_boolean (gimp_value_array_index (return_vals, 1), is_empty); return return_vals; }
static GimpValueArray * channel_get_color_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GimpValueArray *args, GError **error) { gboolean success = TRUE; GimpValueArray *return_vals; GimpChannel *channel; GimpRGB color = { 0.0, 0.0, 0.0, 1.0 }; channel = gimp_value_get_channel (gimp_value_array_index (args, 0), gimp); if (success) { gimp_channel_get_color (channel, &color); gimp_rgb_set_alpha (&color, 1.0); } return_vals = gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); if (success) gimp_value_set_rgb (gimp_value_array_index (return_vals, 1), &color); return return_vals; }
static GimpValueArray * register_magic_load_handler_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GimpValueArray *args, GError **error) { gboolean success = TRUE; const gchar *procedure_name; const gchar *extensions; const gchar *prefixes; const gchar *magics; procedure_name = g_value_get_string (gimp_value_array_index (args, 0)); extensions = g_value_get_string (gimp_value_array_index (args, 1)); prefixes = g_value_get_string (gimp_value_array_index (args, 2)); magics = g_value_get_string (gimp_value_array_index (args, 3)); if (success) { gchar *canonical = gimp_canonicalize_identifier (procedure_name); success = gimp_plug_in_manager_register_load_handler (gimp->plug_in_manager, canonical, extensions, prefixes, magics); g_free (canonical); } return gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); }
static GimpValueArray * channel_set_color_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GimpValueArray *args, GError **error) { gboolean success = TRUE; GimpChannel *channel; GimpRGB color; channel = gimp_value_get_channel (gimp_value_array_index (args, 0), gimp); gimp_value_get_rgb (gimp_value_array_index (args, 1), &color); if (success) { GimpRGB rgb_color = color; rgb_color.a = channel->color.a; gimp_channel_set_color (channel, &rgb_color, TRUE); } return gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); }
static GimpValueArray * register_file_handler_mime_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GimpValueArray *args, GError **error) { gboolean success = TRUE; const gchar *procedure_name; const gchar *mime_type; procedure_name = g_value_get_string (gimp_value_array_index (args, 0)); mime_type = g_value_get_string (gimp_value_array_index (args, 1)); if (success) { gchar *canonical = gimp_canonicalize_identifier (procedure_name); success = gimp_plug_in_manager_register_mime_type (gimp->plug_in_manager, canonical, mime_type); g_free (canonical); } return gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); }
static GValueArray * brushes_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_brushes = 0; gchar **brush_list = NULL; filter = g_value_get_string (&args->values[0]); if (success) { brush_list = gimp_container_get_filtered_name_array (gimp->brush_factory->container, filter, &num_brushes); } return_vals = gimp_procedure_get_return_values (procedure, success); if (success) { g_value_set_int (&return_vals->values[1], num_brushes); gimp_value_take_stringarray (&return_vals->values[2], brush_list, num_brushes); } return return_vals; }
static GimpValueArray * register_thumbnail_loader_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GimpValueArray *args, GError **error) { gboolean success = TRUE; const gchar *load_proc; const gchar *thumb_proc; load_proc = g_value_get_string (gimp_value_array_index (args, 0)); thumb_proc = g_value_get_string (gimp_value_array_index (args, 1)); if (success) { gchar *canonical = gimp_canonicalize_identifier (load_proc); gchar *canon_thumb = gimp_canonicalize_identifier (thumb_proc); success = gimp_plug_in_manager_register_thumb_loader (gimp->plug_in_manager, canonical, canon_thumb); g_free (canonical); g_free (canon_thumb); } return gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); }
static GimpValueArray * procedural_db_set_data_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GimpValueArray *args, GError **error) { gboolean success = TRUE; const gchar *identifier; gint32 bytes; const guint8 *data; identifier = g_value_get_string (gimp_value_array_index (args, 0)); bytes = g_value_get_int (gimp_value_array_index (args, 1)); data = gimp_value_get_int8array (gimp_value_array_index (args, 2)); if (success) { gchar *canonical = gimp_canonicalize_identifier (identifier); gimp_plug_in_manager_set_data (gimp->plug_in_manager, canonical, bytes, data); g_free (canonical); } return gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); }
static GimpValueArray * channel_copy_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GimpValueArray *args, GError **error) { gboolean success = TRUE; GimpValueArray *return_vals; GimpChannel *channel; GimpChannel *channel_copy = NULL; channel = gimp_value_get_channel (gimp_value_array_index (args, 0), gimp); if (success) { channel_copy = GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (channel), G_TYPE_FROM_INSTANCE (channel))); if (! channel_copy) success = FALSE; } return_vals = gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); if (success) gimp_value_set_channel (gimp_value_array_index (return_vals, 1), channel_copy); return return_vals; }
static GimpValueArray * plugin_menu_register_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GimpValueArray *args, GError **error) { gboolean success = TRUE; const gchar *procedure_name; const gchar *menu_path; procedure_name = g_value_get_string (gimp_value_array_index (args, 0)); menu_path = g_value_get_string (gimp_value_array_index (args, 1)); if (success) { GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in; if (plug_in) { gchar *canonical = gimp_canonicalize_identifier (procedure_name); success = gimp_plug_in_menu_register (plug_in, canonical, menu_path); g_free (canonical); } else { success = FALSE; } } return gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); }
static GimpValueArray * channel_combine_masks_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GimpValueArray *args, GError **error) { gboolean success = TRUE; GimpChannel *channel1; GimpChannel *channel2; gint32 operation; gint32 offx; gint32 offy; channel1 = gimp_value_get_channel (gimp_value_array_index (args, 0), gimp); channel2 = gimp_value_get_channel (gimp_value_array_index (args, 1), gimp); operation = g_value_get_enum (gimp_value_array_index (args, 2)); offx = g_value_get_int (gimp_value_array_index (args, 3)); offy = g_value_get_int (gimp_value_array_index (args, 4)); if (success) { gimp_channel_push_undo (channel1, _("Combine Masks")); gimp_channel_combine_mask (channel1, channel2, operation, offx, offy); } return gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); }
static GimpValueArray * plugin_get_pdb_error_handler_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GimpValueArray *args, GError **error) { gboolean success = TRUE; GimpValueArray *return_vals; gint32 handler = 0; GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in; if (plug_in) { handler = gimp_plug_in_get_error_handler (plug_in); } else { success = FALSE; } return_vals = gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); if (success) g_value_set_enum (gimp_value_array_index (return_vals, 1), handler); return return_vals; }
static GimpValueArray * channel_get_show_masked_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GimpValueArray *args, GError **error) { gboolean success = TRUE; GimpValueArray *return_vals; GimpChannel *channel; gboolean show_masked = FALSE; channel = gimp_value_get_channel (gimp_value_array_index (args, 0), gimp); if (success) { show_masked = gimp_channel_get_show_masked (channel); } return_vals = gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); if (success) g_value_set_boolean (gimp_value_array_index (return_vals, 1), show_masked); return return_vals; }
static GimpValueArray * plugin_domain_register_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GimpValueArray *args, GError **error) { gboolean success = TRUE; const gchar *domain_name; const gchar *domain_path; domain_name = g_value_get_string (gimp_value_array_index (args, 0)); domain_path = g_value_get_string (gimp_value_array_index (args, 1)); if (success) { GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in; if (plug_in && plug_in->call_mode == GIMP_PLUG_IN_CALL_QUERY) { gimp_plug_in_def_set_locale_domain (plug_in->plug_in_def, domain_name, domain_path); } else { success = FALSE; } } return gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); }
static GimpValueArray * channel_get_opacity_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GimpValueArray *args, GError **error) { gboolean success = TRUE; GimpValueArray *return_vals; GimpChannel *channel; gdouble opacity = 0.0; channel = gimp_value_get_channel (gimp_value_array_index (args, 0), gimp); if (success) { opacity = gimp_channel_get_opacity (channel) * 100; } return_vals = gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); if (success) g_value_set_double (gimp_value_array_index (return_vals, 1), opacity); return return_vals; }
static GimpValueArray * floating_sel_remove_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GimpValueArray *args, GError **error) { gboolean success = TRUE; GimpLayer *floating_sel; floating_sel = gimp_value_get_layer (gimp_value_array_index (args, 0), gimp); if (success) { if (gimp_layer_is_floating_sel (floating_sel)) { gimp_image_remove_layer (gimp_item_get_image (GIMP_ITEM (floating_sel)), floating_sel, TRUE, NULL); } else { g_set_error_literal (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT, _("Cannot remove this layer because " "it is not a floating selection.")); success = FALSE; } } return gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); }
static GimpValueArray * fonts_set_popup_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GimpValueArray *args, GError **error) { gboolean success = TRUE; const gchar *font_callback; const gchar *font_name; font_callback = g_value_get_string (gimp_value_array_index (args, 0)); font_name = g_value_get_string (gimp_value_array_index (args, 1)); if (success) { if (gimp->no_interface || ! gimp_pdb_lookup_procedure (gimp->pdb, font_callback) || ! gimp_pdb_dialog_set (gimp, gimp->fonts, font_callback, font_name, NULL)) success = FALSE; } return gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); }