pdb: add new procedure gimp-get-default-new-layer-mode
Which returns GimpCoreConfig::default-new-layer-mode and will be used to make plug-ins create layers/images in the configured way.
This commit is contained in:
@ -173,6 +173,25 @@ get_monitor_resolution_invoker (GimpProcedure *procedure,
|
||||
return return_vals;
|
||||
}
|
||||
|
||||
static GimpValueArray *
|
||||
get_default_new_layer_mode_invoker (GimpProcedure *procedure,
|
||||
Gimp *gimp,
|
||||
GimpContext *context,
|
||||
GimpProgress *progress,
|
||||
const GimpValueArray *args,
|
||||
GError **error)
|
||||
{
|
||||
GimpValueArray *return_vals;
|
||||
gint32 mode = 0;
|
||||
|
||||
mode = gimp->config->default_new_layer_mode;
|
||||
|
||||
return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
|
||||
g_value_set_enum (gimp_value_array_index (return_vals, 1), mode);
|
||||
|
||||
return return_vals;
|
||||
}
|
||||
|
||||
static GimpValueArray *
|
||||
get_theme_dir_invoker (GimpProcedure *procedure,
|
||||
Gimp *gimp,
|
||||
@ -400,6 +419,30 @@ register_gimprc_procs (GimpPDB *pdb)
|
||||
gimp_pdb_register_procedure (pdb, procedure);
|
||||
g_object_unref (procedure);
|
||||
|
||||
/*
|
||||
* gimp-get-default-new-layer-mode
|
||||
*/
|
||||
procedure = gimp_procedure_new (get_default_new_layer_mode_invoker);
|
||||
gimp_object_set_static_name (GIMP_OBJECT (procedure),
|
||||
"gimp-get-default-new-layer-mode");
|
||||
gimp_procedure_set_static_strings (procedure,
|
||||
"gimp-get-default-new-layer-mode",
|
||||
"Get the default mode for newly created layers.",
|
||||
"Returns the default mode for newly created layers.",
|
||||
"Michael Natterer <mitch@gimp.org>",
|
||||
"Michael Natterer",
|
||||
"2017",
|
||||
NULL);
|
||||
gimp_procedure_add_return_value (procedure,
|
||||
g_param_spec_enum ("mode",
|
||||
"mode",
|
||||
"The layer mode",
|
||||
GIMP_TYPE_LAYER_MODE,
|
||||
GIMP_LAYER_MODE_NORMAL,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_pdb_register_procedure (pdb, procedure);
|
||||
g_object_unref (procedure);
|
||||
|
||||
/*
|
||||
* gimp-get-theme-dir
|
||||
*/
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
#include "internal-procs.h"
|
||||
|
||||
|
||||
/* 811 procedures registered total */
|
||||
/* 812 procedures registered total */
|
||||
|
||||
void
|
||||
internal_procs_init (GimpPDB *pdb)
|
||||
|
||||
@ -332,6 +332,7 @@ EXPORTS
|
||||
gimp_gamma
|
||||
gimp_get_color_configuration
|
||||
gimp_get_default_comment
|
||||
gimp_get_default_new_layer_mode
|
||||
gimp_get_default_unit
|
||||
gimp_get_icon_theme_dir
|
||||
gimp_get_module_load_inhibit
|
||||
|
||||
@ -208,6 +208,36 @@ gimp_get_monitor_resolution (gdouble *xres,
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_get_default_new_layer_mode:
|
||||
*
|
||||
* Get the default mode for newly created layers.
|
||||
*
|
||||
* Returns the default mode for newly created layers.
|
||||
*
|
||||
* Returns: The layer mode.
|
||||
*
|
||||
* Since: 2.10
|
||||
**/
|
||||
GimpLayerMode
|
||||
gimp_get_default_new_layer_mode (void)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
GimpLayerMode mode = 0;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp-get-default-new-layer-mode",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_END);
|
||||
|
||||
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
|
||||
mode = return_vals[1].data.d_int32;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_get_theme_dir:
|
||||
*
|
||||
|
||||
@ -32,17 +32,18 @@ G_BEGIN_DECLS
|
||||
/* For information look into the C source or the html documentation */
|
||||
|
||||
|
||||
gchar* gimp_gimprc_query (const gchar *token);
|
||||
gboolean gimp_gimprc_set (const gchar *token,
|
||||
const gchar *value);
|
||||
gchar* gimp_get_default_comment (void);
|
||||
GimpUnit gimp_get_default_unit (void);
|
||||
gboolean gimp_get_monitor_resolution (gdouble *xres,
|
||||
gdouble *yres);
|
||||
gchar* gimp_get_theme_dir (void);
|
||||
gchar* gimp_get_icon_theme_dir (void);
|
||||
G_GNUC_INTERNAL gchar* _gimp_get_color_configuration (void);
|
||||
gchar* gimp_get_module_load_inhibit (void);
|
||||
gchar* gimp_gimprc_query (const gchar *token);
|
||||
gboolean gimp_gimprc_set (const gchar *token,
|
||||
const gchar *value);
|
||||
gchar* gimp_get_default_comment (void);
|
||||
GimpUnit gimp_get_default_unit (void);
|
||||
gboolean gimp_get_monitor_resolution (gdouble *xres,
|
||||
gdouble *yres);
|
||||
GimpLayerMode gimp_get_default_new_layer_mode (void);
|
||||
gchar* gimp_get_theme_dir (void);
|
||||
gchar* gimp_get_icon_theme_dir (void);
|
||||
G_GNUC_INTERNAL gchar* _gimp_get_color_configuration (void);
|
||||
gchar* gimp_get_module_load_inhibit (void);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@ -170,6 +170,27 @@ CODE
|
||||
);
|
||||
}
|
||||
|
||||
sub get_default_new_layer_mode {
|
||||
$blurb = 'Get the default mode for newly created layers.';
|
||||
$help = 'Returns the default mode for newly created layers.';
|
||||
|
||||
&mitch_pdb_misc('2017', '2.10');
|
||||
|
||||
@outargs = (
|
||||
{ name => 'mode', type => 'enum GimpLayerMode',
|
||||
default => 'GIMP_LAYER_MODE_NORMAL',
|
||||
desc => 'The layer mode' }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
mode = gimp->config->default_new_layer_mode;
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
sub get_theme_dir {
|
||||
$blurb = 'Get the directory of the current GUI theme.';
|
||||
$help = 'Returns a copy of the current GUI theme dir.';
|
||||
@ -269,6 +290,7 @@ CODE
|
||||
get_default_comment
|
||||
get_default_unit
|
||||
get_monitor_resolution
|
||||
get_default_new_layer_mode
|
||||
get_theme_dir
|
||||
get_icon_theme_dir
|
||||
get_color_configuration
|
||||
|
||||
Reference in New Issue
Block a user