scripts: Fix "Remove all Guides" script bug

Resolves #10651
The "Remove All Guides" script calls
gimp-image-find-next-guide, which per
its description can take in 0. However,
the parameter sets 1 as the minimum
value.
This patch fixes the range so that it can
accept 0, which enables the Remove All
Guides script to work again.
It also updates the script to the new
multi-layer aware API.
This commit is contained in:
Alx Sa 2024-01-18 02:27:56 +00:00
parent 14abb71c34
commit 21d24467ad
5 changed files with 14 additions and 15 deletions

View File

@ -163,11 +163,11 @@ image_find_next_guide_invoker (GimpProcedure *procedure,
gboolean success = TRUE;
GimpValueArray *return_vals;
GimpImage *image;
guint guide;
gint guide;
guint next_guide = 0;
image = g_value_get_object (gimp_value_array_index (args, 0));
guide = g_value_get_uint (gimp_value_array_index (args, 1));
guide = g_value_get_int (gimp_value_array_index (args, 1));
if (success)
{
@ -390,11 +390,11 @@ register_image_guides_procs (GimpPDB *pdb)
FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_uint ("guide",
"guide",
"The ID of the current guide (0 if first invocation)",
1, G_MAXUINT32, 1,
GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
g_param_spec_int ("guide",
"guide",
"The ID of the current guide (0 if first invocation)",
0, G_MAXINT32, 1,
GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
gimp_procedure_add_return_value (procedure,
g_param_spec_uint ("next-guide",
"next guide",

View File

@ -168,7 +168,7 @@ gimp_image_delete_guide (GimpImage *image,
**/
guint
gimp_image_find_next_guide (GimpImage *image,
guint guide)
gint guide)
{
GimpValueArray *args;
GimpValueArray *return_vals;
@ -176,7 +176,7 @@ gimp_image_find_next_guide (GimpImage *image,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE, image,
G_TYPE_UINT, guide,
G_TYPE_INT, guide,
G_TYPE_NONE);
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),

View File

@ -39,7 +39,7 @@ guint gimp_image_add_vguide (GimpImage *image,
gboolean gimp_image_delete_guide (GimpImage *image,
guint guide);
guint gimp_image_find_next_guide (GimpImage *image,
guint guide);
gint guide);
GimpOrientationType gimp_image_get_guide_orientation (GimpImage *image,
guint guide);
gint gimp_image_get_guide_position (GimpImage *image,

View File

@ -142,7 +142,7 @@ HELP
@inargs = (
{ name => 'image', type => 'image',
desc => 'The image' },
{ name => 'guide', type => 'guide', no_validate => 1,
{ name => 'guide', type => '0 <= int32', default => 1, no_validate => 1,
desc => 'The ID of the current guide (0 if first invocation)' }
);

View File

@ -1,6 +1,6 @@
;; -*-scheme-*-
(define (script-fu-guides-remove image drawable)
(define (script-fu-guides-remove image drawables)
(let* ((guide-id 0))
(gimp-image-undo-group-start image)
@ -15,15 +15,14 @@
)
)
(script-fu-register "script-fu-guides-remove"
(script-fu-register-filter "script-fu-guides-remove"
_"_Remove all Guides"
_"Remove all horizontal and vertical guides"
"Alan Horkan"
"Alan Horkan, 2004. Public Domain."
"April 2004"
"*"
SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0
SF-ONE-OR-MORE-DRAWABLE
)
(script-fu-menu-register "script-fu-guides-remove"