2006-12-10 05:33:38 +08:00
/* GIMP - The GNU Image Manipulation Program
2003-07-03 08:47:26 +08:00
* Copyright ( C ) 1995 - 2003 Spencer Kimball and Peter Mattis
2000-06-02 05:18:04 +08:00
*
2009-01-18 06:28:01 +08:00
* This program is free software : you can redistribute it and / or modify
2000-06-02 05:18:04 +08:00
* it under the terms of the GNU General Public License as published by
2009-01-18 06:28:01 +08:00
* the Free Software Foundation ; either version 3 of the License , or
2000-06-02 05:18:04 +08:00
* ( 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
2018-07-12 05:27:07 +08:00
* along with this program . If not , see < https : //www.gnu.org/licenses/>.
2000-06-02 05:18:04 +08:00
*/
2007-01-09 18:52:47 +08:00
/* NOTE: This file is auto-generated by pdbgen.pl. */
2000-06-02 05:18:04 +08:00
2000-12-29 23:22:01 +08:00
# include "config.h"
2001-10-29 02:45:45 +08:00
# include <string.h>
2000-12-29 23:22:01 +08:00
2008-10-10 04:24:04 +08:00
# include <gegl.h>
2000-12-29 23:22:01 +08:00
2012-05-03 09:36:22 +08:00
# include <gdk-pixbuf/gdk-pixbuf.h>
2012-05-04 06:50:23 +08:00
# include "libgimpbase/gimpbase.h"
2001-08-17 22:27:31 +08:00
# include "pdb-types.h"
2000-06-02 05:18:04 +08:00
2001-07-05 03:31:35 +08:00
# include "core/gimp.h"
2003-09-05 01:04:36 +08:00
# include "core/gimpcontainer-filter.h"
2001-05-09 10:32:03 +08:00
# include "core/gimpcontext.h"
# include "core/gimpdatafactory.h"
# include "core/gimpgradient.h"
2008-02-08 01:08:54 +08:00
# include "core/gimpparamspecs.h"
2000-06-02 05:18:04 +08:00
2008-02-08 01:08:54 +08:00
# include "gimppdb.h"
# include "gimppdb-utils.h"
# include "gimpprocedure.h"
2008-04-04 19:15:55 +08:00
# include "internal-procs.h"
2006-11-01 03:02:56 +08:00
2000-06-02 05:18:04 +08:00
2012-05-04 06:50:23 +08:00
static GimpValueArray *
2012-05-29 01:55:28 +08:00
gradients_refresh_invoker ( GimpProcedure * procedure ,
2012-05-04 06:50:23 +08:00
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GimpValueArray * args ,
GError * * error )
2002-02-21 19:16:00 +08:00
{
2010-04-11 19:12:41 +08:00
gimp_data_factory_data_refresh ( gimp - > gradient_factory , context ) ;
2008-02-21 21:43:10 +08:00
2008-08-16 21:57:57 +08:00
return gimp_procedure_get_return_values ( procedure , TRUE , NULL ) ;
2002-02-21 19:16:00 +08:00
}
2012-05-04 06:50:23 +08:00
static GimpValueArray *
2012-05-29 01:55:28 +08:00
gradients_get_list_invoker ( GimpProcedure * procedure ,
2012-05-04 06:50:23 +08:00
Gimp * gimp ,
GimpContext * context ,
GimpProgress * progress ,
const GimpValueArray * args ,
GError * * error )
2000-06-02 05:18:04 +08:00
{
2003-09-05 01:04:36 +08:00
gboolean success = TRUE ;
2012-05-04 06:50:23 +08:00
GimpValueArray * return_vals ;
2006-04-03 00:03:32 +08:00
const gchar * filter ;
2019-08-15 20:04:56 +08:00
gint num_gradients = 0 ;
2003-09-05 01:28:13 +08:00
gchar * * gradient_list = NULL ;
2001-02-11 03:35:29 +08:00
2012-05-04 06:50:23 +08:00
filter = g_value_get_string ( gimp_value_array_index ( args , 0 ) ) ;
2003-09-05 01:04:36 +08:00
if ( success )
2006-03-22 17:58:08 +08:00
{
2008-12-20 05:58:17 +08:00
gradient_list = gimp_container_get_filtered_name_array ( gimp_data_factory_get_container ( gimp - > gradient_factory ) ,
2006-03-22 17:58:08 +08:00
filter , & num_gradients ) ;
}
2000-06-02 05:18:04 +08:00
2008-08-16 21:57:57 +08:00
return_vals = gimp_procedure_get_return_values ( procedure , success ,
error ? * error : NULL ) ;
2000-06-02 05:18:04 +08:00
2003-09-05 01:04:36 +08:00
if ( success )
{
2012-05-04 06:50:23 +08:00
g_value_set_int ( gimp_value_array_index ( return_vals , 1 ) , num_gradients ) ;
2019-07-26 18:56:28 +08:00
gimp_value_take_string_array ( gimp_value_array_index ( return_vals , 2 ) , gradient_list , num_gradients ) ;
2003-09-05 01:04:36 +08:00
}
2000-06-02 05:18:04 +08:00
2006-03-28 05:09:32 +08:00
return return_vals ;
2000-06-02 05:18:04 +08:00
}
2006-04-05 05:11:45 +08:00
void
2006-04-26 17:13:47 +08:00
register_gradients_procs ( GimpPDB * pdb )
2001-10-26 05:59:52 +08:00
{
2006-04-05 05:11:45 +08:00
GimpProcedure * procedure ;
/*
* gimp - gradients - refresh
*/
2006-04-06 18:01:30 +08:00
procedure = gimp_procedure_new ( gradients_refresh_invoker ) ;
2008-04-04 18:58:56 +08:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
" gimp-gradients-refresh " ) ;
2019-09-09 05:40:34 +08:00
gimp_procedure_set_static_help ( procedure ,
" Refresh current gradients. This function always succeeds. " ,
" This procedure retrieves all gradients currently in the user's gradient path and updates the gradient dialogs accordingly. " ,
NULL ) ;
gimp_procedure_set_static_attribution ( procedure ,
" Michael Natterer <mitch@gimp.org> " ,
" Michael Natterer " ,
" 2002 " ) ;
2006-04-26 17:13:47 +08:00
gimp_pdb_register_procedure ( pdb , procedure ) ;
2006-04-07 16:16:26 +08:00
g_object_unref ( procedure ) ;
2006-04-05 05:11:45 +08:00
/*
* gimp - gradients - get - list
*/
2006-04-06 18:01:30 +08:00
procedure = gimp_procedure_new ( gradients_get_list_invoker ) ;
2008-04-04 18:58:56 +08:00
gimp_object_set_static_name ( GIMP_OBJECT ( procedure ) ,
" gimp-gradients-get-list " ) ;
2019-09-09 05:40:34 +08:00
gimp_procedure_set_static_help ( procedure ,
" Retrieve the list of loaded gradients. " ,
" This procedure returns a list of the gradients that are currently loaded. You can later use the 'gimp-context-set-gradient' function to set the active gradient. " ,
NULL ) ;
gimp_procedure_set_static_attribution ( procedure ,
" Federico Mena Quintero " ,
" Federico Mena Quintero " ,
" 1997 " ) ;
2006-04-05 05:11:45 +08:00
gimp_procedure_add_argument ( procedure ,
gimp_param_spec_string ( " filter " ,
" filter " ,
" An optional regular expression used to filter the list " ,
2007-04-25 22:23:05 +08:00
FALSE , TRUE , FALSE ,
2006-04-05 05:11:45 +08:00
NULL ,
GIMP_PARAM_READWRITE ) ) ;
gimp_procedure_add_return_value ( procedure ,
2019-08-15 20:04:56 +08:00
g_param_spec_int ( " num-gradients " ,
" num gradients " ,
" The number of loaded gradients " ,
0 , G_MAXINT32 , 0 ,
GIMP_PARAM_READWRITE ) ) ;
2006-04-05 05:11:45 +08:00
gimp_procedure_add_return_value ( procedure ,
gimp_param_spec_string_array ( " gradient-list " ,
" gradient list " ,
2012-12-04 06:16:16 +08:00
" The list of gradient names " ,
2006-04-05 05:11:45 +08:00
GIMP_PARAM_READWRITE ) ) ;
2006-04-26 17:13:47 +08:00
gimp_pdb_register_procedure ( pdb , procedure ) ;
2006-04-07 16:16:26 +08:00
g_object_unref ( procedure ) ;
2006-04-05 05:11:45 +08:00
}