Commit ee8b467e authored by Jehan's avatar Jehan

libgimp: GimpSaveProcedure() now uses GimpImage/GimpDrawable object...

... as parameters.
And GimpLoadProcedure() now expects the run() function to return a
GimpImage object.
parent a1eeca49
......@@ -84,13 +84,11 @@ gimp_image_procedure_constructed (GObject *object)
GIMP_PROC_ARG_IMAGE (procedure, "image",
"Image",
"The input image",
FALSE,
G_PARAM_READWRITE);
GIMP_PROC_ARG_DRAWABLE (procedure, "drawable",
"Drawable",
"The input drawable",
FALSE,
G_PARAM_READWRITE);
}
......
......@@ -94,7 +94,6 @@ gimp_load_procedure_constructed (GObject *object)
GIMP_PROC_VAL_IMAGE (procedure, "image",
"Image",
"Output image",
FALSE,
GIMP_PARAM_READWRITE);
}
......
......@@ -376,185 +376,185 @@ G_BEGIN_DECLS
/* display */
#define GIMP_PROC_ARG_DISPLAY(class, name, nick, blurb, none_ok, flags) \
#define GIMP_PROC_ARG_DISPLAY(class, name, nick, blurb, flags) \
gimp_procedure_add_argument (procedure,\
gimp_param_spec_display_id (name, nick, blurb,\
none_ok, \
g_param_spec_object (name, nick, blurb,\
GIMP_TYPE_DISPLAY, \
flags))
#define GIMP_PROC_VAL_DISPLAY(class, name, nick, blurb, none_ok, flags) \
#define GIMP_PROC_VAL_DISPLAY(class, name, nick, blurb, flags) \
gimp_procedure_add_return_value (procedure,\
gimp_param_spec_display_id (name, nick, blurb,\
none_ok, \
g_param_spec_object (name, nick, blurb,\
GIMP_TYPE_DISPLAY, \
flags))
/* image */
#define GIMP_PROC_ARG_IMAGE(class, name, nick, blurb, none_ok, flags) \
#define GIMP_PROC_ARG_IMAGE(class, name, nick, blurb, flags) \
gimp_procedure_add_argument (procedure,\
gimp_param_spec_image_id (name, nick, blurb,\
none_ok, \
g_param_spec_object (name, nick, blurb,\
GIMP_TYPE_IMAGE, \
flags))
#define GIMP_PROC_VAL_IMAGE(class, name, nick, blurb, none_ok, flags) \
#define GIMP_PROC_VAL_IMAGE(class, name, nick, blurb, flags) \
gimp_procedure_add_return_value (procedure,\
gimp_param_spec_image_id (name, nick, blurb,\
none_ok, \
g_param_spec_object (name, nick, blurb,\
GIMP_TYPE_IMAGE, \
flags))
#define GIMP_VALUES_GET_IMAGE(args, n) \
gimp_value_get_image_id (gimp_value_array_index (args, n))
g_value_get_object (gimp_value_array_index (args, n))
#define GIMP_VALUES_SET_IMAGE(args, n, value) \
gimp_value_set_image_id (gimp_value_array_index (args, n), value)
g_value_set_object (gimp_value_array_index (args, n), value)
/* item */
#define GIMP_PROC_ARG_ITEM(class, name, nick, blurb, none_ok, flags) \
#define GIMP_PROC_ARG_ITEM(class, name, nick, blurb, flags) \
gimp_procedure_add_argument (procedure,\
gimp_param_spec_item_id (name, nick, blurb,\
none_ok, \
g_param_spec_object (name, nick, blurb,\
GIMP_TYPE_ITEM, \
flags))
#define GIMP_PROC_VAL_ITEM(class, name, nick, blurb, none_ok, flags) \
#define GIMP_PROC_VAL_ITEM(class, name, nick, blurb, flags) \
gimp_procedure_add_return_value (procedure,\
gimp_param_spec_item_id (name, nick, blurb,\
none_ok, \
g_param_spec_object (name, nick, blurb,\
GIMP_TYPE_ITEM, \
flags))
#define GIMP_VALUES_GET_ITEM(args, n) \
gimp_value_get_item_id (gimp_value_array_index (args, n))
g_value_get_object (gimp_value_array_index (args, n))
#define GIMP_VALUES_SET_ITEM(args, n, value) \
gimp_value_set_item_id (gimp_value_array_index (args, n), value)
g_value_set_object (gimp_value_array_index (args, n), value)
/* drawable */
#define GIMP_PROC_ARG_DRAWABLE(class, name, nick, blurb, none_ok, flags) \
#define GIMP_PROC_ARG_DRAWABLE(class, name, nick, blurb, flags) \
gimp_procedure_add_argument (procedure,\
gimp_param_spec_drawable_id (name, nick, blurb,\
none_ok, \
g_param_spec_object (name, nick, blurb,\
GIMP_TYPE_DRAWABLE, \
flags))
#define GIMP_PROC_VAL_DRAWABLE(class, name, nick, blurb, none_ok, flags) \
#define GIMP_PROC_VAL_DRAWABLE(class, name, nick, blurb, flags) \
gimp_procedure_add_return_value (procedure,\
gimp_param_spec_drawable_id (name, nick, blurb,\
none_ok, \
g_param_spec_object (name, nick, blurb,\
GIMP_TYPE_DRAWABLE, \
flags))
#define GIMP_VALUES_GET_DRAWABLE(args, n) \
gimp_value_get_drawable_id (gimp_value_array_index (args, n))
g_value_get_object (gimp_value_array_index (args, n))
#define GIMP_VALUES_SET_DRAWABLE(args, n, value) \
gimp_value_set_drawable_id (gimp_value_array_index (args, n), value)
g_value_set_object (gimp_value_array_index (args, n), value)
/* layer */
#define GIMP_PROC_ARG_LAYER(class, name, nick, blurb, none_ok, flags) \
#define GIMP_PROC_ARG_LAYER(class, name, nick, blurb, flags) \
gimp_procedure_add_argument (procedure,\
gimp_param_spec_layer_id (name, nick, blurb,\
none_ok, \
g_param_spec_object (name, nick, blurb,\
GIMP_TYPE_LAYER, \
flags))
#define GIMP_PROC_VAL_LAYER(class, name, nick, blurb, none_ok, flags) \
#define GIMP_PROC_VAL_LAYER(class, name, nick, blurb, flags) \
gimp_procedure_add_return_value (procedure,\
gimp_param_spec_layer_id (name, nick, blurb,\
none_ok, \
g_param_spec_object (name, nick, blurb,\
GIMP_TYPE_LAYER, \
flags))
#define GIMP_VALUES_GET_LAYER(args, n) \
gimp_value_get_layer_id (gimp_value_array_index (args, n))
g_value_get_object (gimp_value_array_index (args, n))
#define GIMP_VALUES_SET_LAYER(args, n, value) \
gimp_value_set_layer_id (gimp_value_array_index (args, n), value)
g_value_set_object (gimp_value_array_index (args, n), value)
/* channel */
#define GIMP_PROC_ARG_CHANNEL(class, name, nick, blurb, none_ok, flags) \
#define GIMP_PROC_ARG_CHANNEL(class, name, nick, blurb, flags) \
gimp_procedure_add_argument (procedure,\
gimp_param_spec_channel_id (name, nick, blurb,\
none_ok, \
g_param_spec_object (name, nick, blurb,\
GIMP_TYPE_CHANNEL, \
flags))
#define GIMP_PROC_VAL_CHANNEL(class, name, nick, blurb, none_ok, flags) \
#define GIMP_PROC_VAL_CHANNEL(class, name, nick, blurb, flags) \
gimp_procedure_add_return_value (procedure,\
gimp_param_spec_channel_id (name, nick, blurb,\
none_ok, \
g_param_spec_object (name, nick, blurb,\
GIMP_TYPE_CHANNEL, \
flags))
#define GIMP_VALUES_GET_CHANNEL(args, n) \
gimp_value_get_channel_id (gimp_value_array_index (args, n))
g_value_get_object (gimp_value_array_index (args, n))
#define GIMP_VALUES_SET_CHANNEL(args, n, value) \
gimp_value_set_channel_id (gimp_value_array_index (args, n), value)
g_value_set_object (gimp_value_array_index (args, n), value)
/* layer mask */
#define GIMP_PROC_ARG_LAYER_MASK(class, name, nick, blurb, none_ok, flags) \
#define GIMP_PROC_ARG_LAYER_MASK(class, name, nick, blurb, flags) \
gimp_procedure_add_argument (procedure,\
gimp_param_spec_layer_mask_id (name, nick, blurb,\
none_ok, \
g_param_spec_object (name, nick, blurb,\
GIMP_TYPE_LAYER_MASK, \
flags))
#define GIMP_PROC_VAL_LAYER_MASK(class, name, nick, blurb, none_ok, flags) \
#define GIMP_PROC_VAL_LAYER_MASK(class, name, nick, blurb, flags) \
gimp_procedure_add_return_value (procedure,\
gimp_param_spec_layer_mask_id (name, nick, blurb,\
none_ok, \
g_param_spec_object (name, nick, blurb,\
GIMP_TYPE_LAYER_MASK, \
flags))
#define GIMP_VALUES_GET_LAYER_MASK(args, n) \
gimp_value_get_layer_mask_id (gimp_value_array_index (args, n))
g_value_get_object (gimp_value_array_index (args, n))
#define GIMP_VALUES_SET_LAYER_MASK(args, n, value) \
gimp_value_set_layer_mask_id (gimp_value_array_index (args, n), value)
g_value_set_object (gimp_value_array_index (args, n), value)
/* selection */
#define GIMP_PROC_ARG_SELECTION(class, name, nick, blurb, none_ok, flags) \
#define GIMP_PROC_ARG_SELECTION(class, name, nick, blurb, flags) \
gimp_procedure_add_argument (procedure,\
gimp_param_spec_selection_id (name, nick, blurb,\
none_ok, \
g_param_spec_object (name, nick, blurb,\
GIMP_TYPE_SELECTION, \
flags))
#define GIMP_PROC_VAL_SELECTION(class, name, nick, blurb, none_ok, flags) \
#define GIMP_PROC_VAL_SELECTION(class, name, nick, blurb, flags) \
gimp_procedure_add_return_value (procedure,\
gimp_param_spec_selection_id (name, nick, blurb,\
none_ok, \
g_param_spec_object (name, nick, blurb,\
GIMP_TYPE_SELECTION, \
flags))
#define GIMP_VALUES_GET_SELECTION(args, n) \
gimp_value_get_selection_id (gimp_value_array_index (args, n))
g_value_get_object (gimp_value_array_index (args, n))
#define GIMP_VALUES_SET_SELECTION(args, n, value) \
gimp_value_set_selection_id (gimp_value_array_index (args, n), value)
g_value_set_object (gimp_value_array_index (args, n), value)
/* vectors */
#define GIMP_PROC_ARG_VECTORS(class, name, nick, blurb, none_ok, flags) \
#define GIMP_PROC_ARG_VECTORS(class, name, nick, blurb, flags) \
gimp_procedure_add_argument (procedure,\
gimp_param_spec_vectors_id (name, nick, blurb,\
none_ok, \
g_param_spec_object (name, nick, blurb,\
GIMP_TYPE_VECTORS, \
flags))
#define GIMP_PROC_VAL_VECTORS(class, name, nick, blurb, none_ok, flags) \
#define GIMP_PROC_VAL_VECTORS(class, name, nick, blurb, flags) \
gimp_procedure_add_return_value (procedure,\
gimp_param_spec_vectors_id (name, nick, blurb,\
none_ok, \
g_param_spec_object (name, nick, blurb,\
GIMP_TYPE_VECTORS, \
flags))
#define GIMP_VALUES_GET_VECTORS(args, n) \
gimp_value_get_vectors_id (gimp_value_array_index (args, n))
g_value_get_object (gimp_value_array_index (args, n))
#define GIMP_VALUES_SET_VECTORS(args, n, value) \
gimp_value_set_vectors_id (gimp_value_array_index (args, n), value)
g_value_set_object (gimp_value_array_index (args, n), value)
G_END_DECLS
......
......@@ -79,13 +79,11 @@ gimp_save_procedure_constructed (GObject *object)
GIMP_PROC_ARG_IMAGE (procedure, "image",
"Image",
"The image to save",
FALSE,
G_PARAM_READWRITE);
GIMP_PROC_ARG_DRAWABLE (procedure, "drawable",
"Drawable",
"The drawable to save",
FALSE,
G_PARAM_READWRITE);
GIMP_PROC_ARG_STRING (procedure, "uri",
......@@ -147,17 +145,17 @@ gimp_save_procedure_run (GimpProcedure *procedure,
GimpValueArray *remaining;
GimpValueArray *return_values;
GimpRunMode run_mode;
gint32 image_id;
gint32 drawable_id;
GimpImage *image;
GimpDrawable *drawable;
const gchar *uri;
GFile *file;
gint i;
run_mode = GIMP_VALUES_GET_ENUM (args, 0);
image_id = GIMP_VALUES_GET_IMAGE (args, 1);
drawable_id = GIMP_VALUES_GET_DRAWABLE (args, 2);
uri = GIMP_VALUES_GET_STRING (args, 3);
/* raw_uri = GIMP_VALUES_GET_STRING (args, 4); */
run_mode = GIMP_VALUES_GET_ENUM (args, 0);
image = GIMP_VALUES_GET_IMAGE (args, 1);
drawable = GIMP_VALUES_GET_DRAWABLE (args, 2);
uri = GIMP_VALUES_GET_STRING (args, 3);
/* raw_uri = GIMP_VALUES_GET_STRING (args, 4); */
file = g_file_new_for_uri (uri);
......@@ -172,7 +170,7 @@ gimp_save_procedure_run (GimpProcedure *procedure,
return_values = save_proc->priv->run_func (procedure,
run_mode,
image_id, drawable_id,
image, drawable,
file,
remaining,
save_proc->priv->run_data);
......
......@@ -33,8 +33,8 @@ G_BEGIN_DECLS
* GimpRunSaveFunc:
* @procedure: the #GimpProcedure that runs.
* @run_mode: the #GimpRunMode.
* @image_id: the image to save.
* @drawable_id: the drawable to save.
* @image: the image to save.
* @drawable: the drawable to save.
* @file: the #GFile to save to.
* @args: the @procedure's remaining arguments.
* @run_data: the run_data given in gimp_save_procedure_new().
......@@ -48,8 +48,8 @@ G_BEGIN_DECLS
**/
typedef GimpValueArray * (* GimpRunSaveFunc) (GimpProcedure *procedure,
GimpRunMode run_mode,
gint32 image_id,
gint32 drawable_id,
GimpImage *image,
GimpDrawable *drawable,
GFile *file,
const GimpValueArray *args,
gpointer run_data);
......
......@@ -89,7 +89,6 @@ gimp_thumbnail_procedure_constructed (GObject *object)
GIMP_PROC_VAL_IMAGE (procedure, "image",
"Image",
"Thumbnail image",
FALSE,
GIMP_PARAM_READWRITE);
GIMP_PROC_VAL_INT (procedure, "image-width",
......
......@@ -293,7 +293,6 @@ film_create_procedure (GimpPlugIn *plug_in,
GIMP_PROC_VAL_IMAGE (procedure, "new-image",
"New image",
"Outout image",
FALSE,
G_PARAM_READWRITE);
}
......
......@@ -265,7 +265,6 @@ pagecurl_create_procedure (GimpPlugIn *plug_in,
GIMP_PROC_VAL_LAYER (procedure, "curl-layer",
"Curl layer",
"The new layer with the curl.",
FALSE,
G_PARAM_READWRITE);
}
......
......@@ -536,7 +536,6 @@ print_temp_proc_install (gint32 image_ID)
GIMP_PROC_ARG_IMAGE (procedure, "image",
"Image",
"The image to notify about",
FALSE,
G_PARAM_READWRITE);
gimp_plug_in_add_temp_procedure (plug_in, procedure);
......
......@@ -220,7 +220,6 @@ screenshot_create_procedure (GimpPlugIn *plug_in,
GIMP_PROC_VAL_IMAGE (procedure, "image",
"Image",
"Output image",
FALSE,
G_PARAM_READWRITE);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment