mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-18 22:03:53 +00:00
pdb: add gimp-dynamics-refresh and gimp-dynamics-get-list
This commit is contained in:
parent
6ee7b22153
commit
634cf6d620
|
@ -47,6 +47,7 @@ libappinternal_procs_a_SOURCES = \
|
|||
display-cmds.c \
|
||||
drawable-cmds.c \
|
||||
drawable-transform-cmds.c \
|
||||
dynamics-cmds.c \
|
||||
edit-cmds.c \
|
||||
fileops-cmds.c \
|
||||
floating-sel-cmds.c \
|
||||
|
|
140
app/pdb/dynamics-cmds.c
Normal file
140
app/pdb/dynamics-cmds.c
Normal file
|
@ -0,0 +1,140 @@
|
|||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* NOTE: This file is auto-generated by pdbgen.pl. */
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gegl.h>
|
||||
|
||||
#include "pdb-types.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpcontainer-filter.h"
|
||||
#include "core/gimpcontainer.h"
|
||||
#include "core/gimpdatafactory.h"
|
||||
#include "core/gimpparamspecs.h"
|
||||
|
||||
#include "gimppdb.h"
|
||||
#include "gimpprocedure.h"
|
||||
#include "internal-procs.h"
|
||||
|
||||
|
||||
static GValueArray *
|
||||
dynamics_refresh_invoker (GimpProcedure *procedure,
|
||||
Gimp *gimp,
|
||||
GimpContext *context,
|
||||
GimpProgress *progress,
|
||||
const GValueArray *args,
|
||||
GError **error)
|
||||
{
|
||||
gimp_data_factory_data_refresh (gimp->dynamics_factory, context);
|
||||
|
||||
return gimp_procedure_get_return_values (procedure, TRUE, NULL);
|
||||
}
|
||||
|
||||
static GValueArray *
|
||||
dynamics_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_dynamics = 0;
|
||||
gchar **dynamics_list = NULL;
|
||||
|
||||
filter = g_value_get_string (&args->values[0]);
|
||||
|
||||
if (success)
|
||||
{
|
||||
dynamics_list = gimp_container_get_filtered_name_array (gimp_data_factory_get_container (gimp->dynamics_factory),
|
||||
filter, &num_dynamics);
|
||||
}
|
||||
|
||||
return_vals = gimp_procedure_get_return_values (procedure, success,
|
||||
error ? *error : NULL);
|
||||
|
||||
if (success)
|
||||
{
|
||||
g_value_set_int (&return_vals->values[1], num_dynamics);
|
||||
gimp_value_take_stringarray (&return_vals->values[2], dynamics_list, num_dynamics);
|
||||
}
|
||||
|
||||
return return_vals;
|
||||
}
|
||||
|
||||
void
|
||||
register_dynamics_procs (GimpPDB *pdb)
|
||||
{
|
||||
GimpProcedure *procedure;
|
||||
|
||||
/*
|
||||
* gimp-dynamics-refresh
|
||||
*/
|
||||
procedure = gimp_procedure_new (dynamics_refresh_invoker);
|
||||
gimp_object_set_static_name (GIMP_OBJECT (procedure),
|
||||
"gimp-dynamics-refresh");
|
||||
gimp_procedure_set_static_strings (procedure,
|
||||
"gimp-dynamics-refresh",
|
||||
"Refresh current paint dynamics. This function always succeeds.",
|
||||
"This procedure retrieves all paint dynamics currently in the user's paint dynamics path and updates the paint dynamics dialogs accordingly.",
|
||||
"Michael Natterer <mitch@gimp.org>",
|
||||
"Michael Natterer",
|
||||
"2011",
|
||||
NULL);
|
||||
gimp_pdb_register_procedure (pdb, procedure);
|
||||
g_object_unref (procedure);
|
||||
|
||||
/*
|
||||
* gimp-dynamics-get-list
|
||||
*/
|
||||
procedure = gimp_procedure_new (dynamics_get_list_invoker);
|
||||
gimp_object_set_static_name (GIMP_OBJECT (procedure),
|
||||
"gimp-dynamics-get-list");
|
||||
gimp_procedure_set_static_strings (procedure,
|
||||
"gimp-dynamics-get-list",
|
||||
"Retrieve the list of loaded paint dynamics.",
|
||||
"This procedure returns a list of the paint dynamics that are currently available.",
|
||||
"Michael Natterer <mitch@gimp.org>",
|
||||
"Michael Natterer",
|
||||
"2011",
|
||||
NULL);
|
||||
gimp_procedure_add_argument (procedure,
|
||||
gimp_param_spec_string ("filter",
|
||||
"filter",
|
||||
"An optional regular expression used to filter the list",
|
||||
FALSE, TRUE, FALSE,
|
||||
NULL,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_procedure_add_return_value (procedure,
|
||||
gimp_param_spec_int32 ("num-dynamics",
|
||||
"num dynamics",
|
||||
"The number of available paint dynamics",
|
||||
0, G_MAXINT32, 0,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_procedure_add_return_value (procedure,
|
||||
gimp_param_spec_string_array ("dynamics-list",
|
||||
"dynamics list",
|
||||
"The list of paint dynamics names",
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_pdb_register_procedure (pdb, procedure);
|
||||
g_object_unref (procedure);
|
||||
}
|
|
@ -28,7 +28,7 @@
|
|||
#include "internal-procs.h"
|
||||
|
||||
|
||||
/* 638 procedures registered total */
|
||||
/* 640 procedures registered total */
|
||||
|
||||
void
|
||||
internal_procs_init (GimpPDB *pdb)
|
||||
|
@ -46,6 +46,7 @@ internal_procs_init (GimpPDB *pdb)
|
|||
register_display_procs (pdb);
|
||||
register_drawable_procs (pdb);
|
||||
register_drawable_transform_procs (pdb);
|
||||
register_dynamics_procs (pdb);
|
||||
register_edit_procs (pdb);
|
||||
register_fileops_procs (pdb);
|
||||
register_floating_sel_procs (pdb);
|
||||
|
|
|
@ -35,6 +35,7 @@ void register_convert_procs (GimpPDB *pdb);
|
|||
void register_display_procs (GimpPDB *pdb);
|
||||
void register_drawable_procs (GimpPDB *pdb);
|
||||
void register_drawable_transform_procs (GimpPDB *pdb);
|
||||
void register_dynamics_procs (GimpPDB *pdb);
|
||||
void register_edit_procs (GimpPDB *pdb);
|
||||
void register_fileops_procs (GimpPDB *pdb);
|
||||
void register_floating_sel_procs (GimpPDB *pdb);
|
||||
|
|
|
@ -81,6 +81,7 @@ PDB_WRAPPERS_C = \
|
|||
gimpdisplay_pdb.c \
|
||||
gimpdrawable_pdb.c \
|
||||
gimpdrawabletransform_pdb.c \
|
||||
gimpdynamics_pdb.c \
|
||||
gimpedit_pdb.c \
|
||||
gimpfileops_pdb.c \
|
||||
gimpfloatingsel_pdb.c \
|
||||
|
@ -133,6 +134,7 @@ PDB_WRAPPERS_H = \
|
|||
gimpdisplay_pdb.h \
|
||||
gimpdrawable_pdb.h \
|
||||
gimpdrawabletransform_pdb.h \
|
||||
gimpdynamics_pdb.h \
|
||||
gimpedit_pdb.h \
|
||||
gimpfileops_pdb.h \
|
||||
gimpfloatingsel_pdb.h \
|
||||
|
|
|
@ -211,6 +211,8 @@ EXPORTS
|
|||
gimp_drawable_type_with_alpha
|
||||
gimp_drawable_update
|
||||
gimp_drawable_width
|
||||
gimp_dynamics_get_list
|
||||
gimp_dynamics_refresh
|
||||
gimp_edit_blend
|
||||
gimp_edit_bucket_fill
|
||||
gimp_edit_bucket_fill_full
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include <libgimp/gimpdisplay_pdb.h>
|
||||
#include <libgimp/gimpdrawable_pdb.h>
|
||||
#include <libgimp/gimpdrawabletransform_pdb.h>
|
||||
#include <libgimp/gimpdynamics_pdb.h>
|
||||
#include <libgimp/gimpedit_pdb.h>
|
||||
#include <libgimp/gimpfileops_pdb.h>
|
||||
#include <libgimp/gimpfloatingsel_pdb.h>
|
||||
|
|
109
libgimp/gimpdynamics_pdb.c
Normal file
109
libgimp/gimpdynamics_pdb.c
Normal file
|
@ -0,0 +1,109 @@
|
|||
/* LIBGIMP - The GIMP Library
|
||||
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
|
||||
*
|
||||
* gimpdynamics_pdb.c
|
||||
*
|
||||
* This library is free software: you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* NOTE: This file is auto-generated by pdbgen.pl */
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gimp.h"
|
||||
|
||||
|
||||
/**
|
||||
* SECTION: gimpdynamics
|
||||
* @title: gimpdynamics
|
||||
* @short_description: Operations related to dynamics.
|
||||
*
|
||||
* Operations related to dynamics.
|
||||
**/
|
||||
|
||||
|
||||
/**
|
||||
* gimp_dynamics_refresh:
|
||||
*
|
||||
* Refresh current paint dynamics. This function always succeeds.
|
||||
*
|
||||
* This procedure retrieves all paint dynamics currently in the user's
|
||||
* paint dynamics path and updates the paint dynamics dialogs
|
||||
* accordingly.
|
||||
*
|
||||
* Returns: TRUE on success.
|
||||
*
|
||||
* Since: GIMP 2.8
|
||||
**/
|
||||
gboolean
|
||||
gimp_dynamics_refresh (void)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gboolean success = TRUE;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp-dynamics-refresh",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_END);
|
||||
|
||||
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_dynamics_get_list:
|
||||
* @filter: An optional regular expression used to filter the list.
|
||||
* @num_dynamics: The number of available paint dynamics.
|
||||
*
|
||||
* Retrieve the list of loaded paint dynamics.
|
||||
*
|
||||
* This procedure returns a list of the paint dynamics that are
|
||||
* currently available.
|
||||
*
|
||||
* Returns: The list of paint dynamics names.
|
||||
*
|
||||
* Since: GIMP 2.8
|
||||
**/
|
||||
gchar **
|
||||
gimp_dynamics_get_list (const gchar *filter,
|
||||
gint *num_dynamics)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gchar **dynamics_list = NULL;
|
||||
gint i;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp-dynamics-get-list",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_STRING, filter,
|
||||
GIMP_PDB_END);
|
||||
|
||||
*num_dynamics = 0;
|
||||
|
||||
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
|
||||
{
|
||||
*num_dynamics = return_vals[1].data.d_int32;
|
||||
dynamics_list = g_new (gchar *, *num_dynamics);
|
||||
for (i = 0; i < *num_dynamics; i++)
|
||||
dynamics_list[i] = g_strdup (return_vals[2].data.d_stringarray[i]);
|
||||
}
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return dynamics_list;
|
||||
}
|
42
libgimp/gimpdynamics_pdb.h
Normal file
42
libgimp/gimpdynamics_pdb.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
/* LIBGIMP - The GIMP Library
|
||||
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
|
||||
*
|
||||
* gimpdynamics_pdb.h
|
||||
*
|
||||
* This library is free software: you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* NOTE: This file is auto-generated by pdbgen.pl */
|
||||
|
||||
#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
|
||||
#error "Only <libgimp/gimp.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __GIMP_DYNAMICS_PDB_H__
|
||||
#define __GIMP_DYNAMICS_PDB_H__
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/* For information look into the C source or the html documentation */
|
||||
|
||||
|
||||
gboolean gimp_dynamics_refresh (void);
|
||||
gchar** gimp_dynamics_get_list (const gchar *filter,
|
||||
gint *num_dynamics);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GIMP_DYNAMICS_PDB_H__ */
|
|
@ -13,6 +13,7 @@ pdb_sources = \
|
|||
pdb/display.pdb \
|
||||
pdb/drawable.pdb \
|
||||
pdb/drawable_transform.pdb \
|
||||
pdb/dynamics.pdb \
|
||||
pdb/edit.pdb \
|
||||
pdb/fileops.pdb \
|
||||
pdb/floating_sel.pdb \
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
display
|
||||
drawable
|
||||
drawable_transform
|
||||
dynamics
|
||||
edit
|
||||
fileops
|
||||
floating_sel
|
||||
|
|
87
tools/pdbgen/pdb/dynamics.pdb
Normal file
87
tools/pdbgen/pdb/dynamics.pdb
Normal file
|
@ -0,0 +1,87 @@
|
|||
# GIMP - The GNU Image Manipulation Program
|
||||
# Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# "Perlized" from C source by Manish Singh <yosh@gimp.org>
|
||||
|
||||
sub dynamics_refresh {
|
||||
$blurb = 'Refresh current paint dynamics. This function always succeeds.';
|
||||
|
||||
$help = <<'HELP';
|
||||
This procedure retrieves all paint dynamics currently in the user's
|
||||
paint dynamics path and updates the paint dynamics dialogs
|
||||
accordingly.
|
||||
HELP
|
||||
|
||||
&mitch_pdb_misc('2011', '2.8');
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
gimp_data_factory_data_refresh (gimp->dynamics_factory, context);
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
sub dynamics_get_list {
|
||||
$blurb = 'Retrieve the list of loaded paint dynamics.';
|
||||
|
||||
$help = <<'HELP';
|
||||
This procedure returns a list of the paint dynamics that are currently
|
||||
available.
|
||||
HELP
|
||||
|
||||
&mitch_pdb_misc('2011', '2.8');
|
||||
|
||||
@inargs = (
|
||||
{ name => 'filter', type => 'string', null_ok => 1,
|
||||
desc => 'An optional regular expression used to filter the list' }
|
||||
);
|
||||
|
||||
@outargs = (
|
||||
{ name => 'dynamics_list', type => 'stringarray',
|
||||
desc => 'The list of paint dynamics names',
|
||||
array => { name => 'num_dynamics',
|
||||
desc => 'The number of available paint dynamics' } }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
headers => [ qw("core/gimpcontainer-filter.h") ],
|
||||
code => <<'CODE'
|
||||
{
|
||||
dynamics_list = gimp_container_get_filtered_name_array (gimp_data_factory_get_container (gimp->dynamics_factory),
|
||||
filter, &num_dynamics);
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@headers = qw("core/gimp.h"
|
||||
"core/gimpcontainer.h"
|
||||
"core/gimpdatafactory.h");
|
||||
|
||||
@procs = qw(dynamics_refresh
|
||||
dynamics_get_list);
|
||||
|
||||
%exports = (app => [@procs], lib => [@procs]);
|
||||
|
||||
$desc = 'Paint Dynamics';
|
||||
$doc_title = 'gimpdynamics';
|
||||
$doc_short_desc = 'Operations related to paint dynamics.';
|
||||
$doc_long_desc = 'Operations related to paint dynamics.';
|
||||
|
||||
1;
|
Loading…
Reference in a new issue