mirror of https://github.com/GNOME/gimp.git
plug-ins: port cml-explorer to gimp_image_procedure_new2()
Also fixes some spelling issues and removes a warning about an uninitialized variable. Currently the only argument is for non-interactive mode, so the dialogue isn't ported to GimpProcedureDialog yet.
This commit is contained in:
parent
22cb6b3bb6
commit
3c53d5f38e
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* Value Time Space
|
* Value Time Space
|
||||||
* Coupled-Map Lattice cont. discrete discrete
|
* Coupled-Map Lattice cont. discrete discrete
|
||||||
* Celluar Automata discrete discrete discrete
|
* Cellular Automata discrete discrete discrete
|
||||||
* Differential Eq. cont. cont. cont.
|
* Differential Eq. cont. cont. cont.
|
||||||
*
|
*
|
||||||
* (But this program uses a parameter: hold-rate to avoid very fast changes.
|
* (But this program uses a parameter: hold-rate to avoid very fast changes.
|
||||||
|
@ -340,7 +340,7 @@ static GimpValueArray * explorer_run (GimpProcedure *procedu
|
||||||
GimpImage *image,
|
GimpImage *image,
|
||||||
gint n_drawables,
|
gint n_drawables,
|
||||||
GimpDrawable **drawables,
|
GimpDrawable **drawables,
|
||||||
const GimpValueArray *args,
|
GimpProcedureConfig *config,
|
||||||
gpointer run_data);
|
gpointer run_data);
|
||||||
|
|
||||||
static gboolean CML_main_function (gboolean preview_p);
|
static gboolean CML_main_function (gboolean preview_p);
|
||||||
|
@ -497,9 +497,9 @@ explorer_create_procedure (GimpPlugIn *plug_in,
|
||||||
|
|
||||||
if (! strcmp (name, PLUG_IN_PROC))
|
if (! strcmp (name, PLUG_IN_PROC))
|
||||||
{
|
{
|
||||||
procedure = gimp_image_procedure_new (plug_in, name,
|
procedure = gimp_image_procedure_new2 (plug_in, name,
|
||||||
GIMP_PDB_PROC_TYPE_PLUGIN,
|
GIMP_PDB_PROC_TYPE_PLUGIN,
|
||||||
explorer_run, NULL, NULL);
|
explorer_run, NULL, NULL);
|
||||||
|
|
||||||
gimp_procedure_set_image_types (procedure, "RGB*, GRAY*");
|
gimp_procedure_set_image_types (procedure, "RGB*, GRAY*");
|
||||||
gimp_procedure_set_sensitivity_mask (procedure,
|
gimp_procedure_set_sensitivity_mask (procedure,
|
||||||
|
@ -512,14 +512,14 @@ explorer_create_procedure (GimpPlugIn *plug_in,
|
||||||
gimp_procedure_set_documentation (procedure,
|
gimp_procedure_set_documentation (procedure,
|
||||||
_("Create abstract Coupled-Map "
|
_("Create abstract Coupled-Map "
|
||||||
"Lattice patterns"),
|
"Lattice patterns"),
|
||||||
"Make an image of Coupled-Map Lattice "
|
_("Make an image of Coupled-Map Lattice "
|
||||||
"(CML). CML is a kind of Cellula "
|
"(CML). CML is a kind of Cellular "
|
||||||
"Automata on continuous (value) "
|
"Automata on continuous (value) "
|
||||||
"domain. In GIMP_RUN_NONINTERACTIVE, "
|
"domain. In GIMP_RUN_NONINTERACTIVE, "
|
||||||
"the name of a parameter file is "
|
"the name of a parameter file is "
|
||||||
"passed as the 4th arg. You can "
|
"passed as the 4th arg. You can "
|
||||||
"control CML_explorer via parameter "
|
"control CML_explorer via parameter "
|
||||||
"file.",
|
"file."),
|
||||||
/* Or do you want to call me
|
/* Or do you want to call me
|
||||||
* with over 50 args?
|
* with over 50 args?
|
||||||
*/
|
*/
|
||||||
|
@ -531,9 +531,9 @@ explorer_create_procedure (GimpPlugIn *plug_in,
|
||||||
"1997");
|
"1997");
|
||||||
|
|
||||||
GIMP_PROC_ARG_STRING (procedure, "parameter-uri",
|
GIMP_PROC_ARG_STRING (procedure, "parameter-uri",
|
||||||
"Parameter UTI",
|
_("Parameter URI"),
|
||||||
"The local file:// URI of parameter file. "
|
_("The local file:// URI of parameter file. "
|
||||||
"CML_explorer makes an image with its settings.",
|
"CML_explorer makes an image with its settings."),
|
||||||
NULL,
|
NULL,
|
||||||
G_PARAM_READWRITE);
|
G_PARAM_READWRITE);
|
||||||
}
|
}
|
||||||
|
@ -547,7 +547,7 @@ explorer_run (GimpProcedure *procedure,
|
||||||
GimpImage *image,
|
GimpImage *image,
|
||||||
gint n_drawables,
|
gint n_drawables,
|
||||||
GimpDrawable **drawables,
|
GimpDrawable **drawables,
|
||||||
const GimpValueArray *args,
|
GimpProcedureConfig *config,
|
||||||
gpointer run_data)
|
gpointer run_data)
|
||||||
{
|
{
|
||||||
if (n_drawables != 1)
|
if (n_drawables != 1)
|
||||||
|
@ -580,8 +580,13 @@ explorer_run (GimpProcedure *procedure,
|
||||||
|
|
||||||
case GIMP_RUN_NONINTERACTIVE:
|
case GIMP_RUN_NONINTERACTIVE:
|
||||||
{
|
{
|
||||||
const gchar *uri = GIMP_VALUES_GET_STRING (args, 0);
|
gchar *uri;
|
||||||
GFile *file = g_file_new_for_uri (uri);
|
GFile *file;
|
||||||
|
|
||||||
|
g_object_get (config,
|
||||||
|
"parameter-uri", &uri,
|
||||||
|
NULL);
|
||||||
|
file = g_file_new_for_uri (uri);
|
||||||
|
|
||||||
if (! CML_load_parameter_file (g_file_peek_path (file), FALSE))
|
if (! CML_load_parameter_file (g_file_peek_path (file), FALSE))
|
||||||
{
|
{
|
||||||
|
@ -592,6 +597,8 @@ explorer_run (GimpProcedure *procedure,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (uri)
|
||||||
|
g_free (uri);
|
||||||
g_object_unref (file);
|
g_object_unref (file);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -2407,7 +2414,7 @@ CML_load_parameter_file (const gchar *filename,
|
||||||
}
|
}
|
||||||
if (flag)
|
if (flag)
|
||||||
{
|
{
|
||||||
gint dummy;
|
gint dummy = 0;
|
||||||
|
|
||||||
if (fgets (line, CML_LINE_SIZE - 1, file) == NULL) /* skip a line */
|
if (fgets (line, CML_LINE_SIZE - 1, file) == NULL) /* skip a line */
|
||||||
dummy = 1;
|
dummy = 1;
|
||||||
|
|
Loading…
Reference in New Issue