make gimp-edit-paste-as-new not fail at an empty clipboard, but return -1

2007-05-05  Simon Budig  <simon@gimp.org>

	* tools/pdbgen/pdb/edit.pdb: make gimp-edit-paste-as-new not fail
	at an empty clipboard, but return -1 as image id.

	* app/pdb/edit_cmds.c
	* libgimp/gimpedit_pdb.c: regenerated.

	* plug-ins/script-fu/scripts/paste-as-brush.scm
	* plug-ins/script-fu/scripts/paste-as-pattern.scm: Changed
	accordingly, fixes bug #357059.

	* modules/controller_linux_input.c: changed some axis names to
	make more sense.


svn path=/trunk/; revision=22429
This commit is contained in:
Simon Budig 2007-05-06 04:42:51 +00:00 committed by Simon Budig
parent 5fc3164fb7
commit 196dda778e
7 changed files with 36128 additions and 52 deletions

36060
ChangeLog

File diff suppressed because it is too large Load Diff

View File

@ -199,7 +199,9 @@ edit_paste_as_new_invoker (GimpProcedure *procedure,
success = FALSE;
}
else
success = FALSE;
{
image = NULL;
}
return_vals = gimp_procedure_get_return_values (procedure, success);
@ -846,7 +848,7 @@ register_edit_procs (GimpPDB *pdb)
gimp_procedure_set_static_strings (procedure,
"gimp-edit-paste-as-new",
"Paste buffer to a new image.",
"This procedure pastes a copy of the internal GIMP edit buffer to a new image. The GIMP edit buffer will be empty unless a call was previously made to either 'gimp-edit-cut' or 'gimp-edit-copy'. This procedure returns the new image.",
"This procedure pastes a copy of the internal GIMP edit buffer to a new image. The GIMP edit buffer will be empty unless a call was previously made to either 'gimp-edit-cut' or 'gimp-edit-copy'. This procedure returns the new image or -1 if the edit buffer was empty.",
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer",
"2005",

View File

@ -187,7 +187,7 @@ gimp_edit_paste (gint32 drawable_ID,
* This procedure pastes a copy of the internal GIMP edit buffer to a
* new image. The GIMP edit buffer will be empty unless a call was
* previously made to either gimp_edit_cut() or gimp_edit_copy(). This
* procedure returns the new image.
* procedure returns the new image or -1 if the edit buffer was empty.
*
* Returns: The new image.
*

View File

@ -89,13 +89,13 @@ static const LinuxInputEvent rel_events[] =
{
{ REL_X, "x-move-left", N_("X Move Left") },
{ REL_X, "x-move-right", N_("X Move Right") },
{ REL_Y, "y-move-away", N_("Y Move Away") },
{ REL_Y, "y-move-near", N_("Y Move Near") },
{ REL_Y, "y-move-forward", N_("Y Move Forward") },
{ REL_Y, "y-move-back", N_("Y Move Back") },
{ REL_Z, "z-move-up", N_("Z Move Up") },
{ REL_Z, "z-move-down", N_("Z Move Down") },
#ifdef REL_RX
{ REL_RX, "x-axis-tilt-away", N_("X Axis Tilt Away") },
{ REL_RX, "x-axis-tilt-near", N_("X Axis Tilt Near") },
{ REL_RX, "x-axis-tilt-forward", N_("X Axis Tilt Forward") },
{ REL_RX, "x-axis-tilt-back", N_("X Axis Tilt Back") },
{ REL_RY, "y-axis-tilt-right", N_("Y Axis Tilt Right") },
{ REL_RY, "y-axis-tilt-left", N_("Y Axis Tilt Left") },
{ REL_RZ, "z-axis-turn-left", N_("Z Axis Turn Left") },

View File

@ -21,35 +21,41 @@
(define (script-fu-paste-as-brush name filename spacing)
(let* (
(brush-image (car (gimp-edit-paste-as-new)))
(brush-draw (car (gimp-image-get-active-drawable brush-image)))
(type (car (gimp-drawable-type brush-draw)))
(path (string-append gimp-directory
"/brushes/"
filename
(number->string brush-image)
".gbr"))
(let* ((brush-image (car (gimp-edit-paste-as-new)))
(brush-draw 0)
(type 0)
(path 0))
(if (= TRUE (car (gimp-image-is-valid brush-image)))
(begin
(set! brush-draw (car (gimp-image-get-active-drawable brush-image)))
(set! type (car (gimp-drawable-type brush-draw)))
(set! path (string-append gimp-directory
"/brushes/"
filename
(number->string brush-image)
".gbr"))
(if (= type GRAYA-IMAGE)
(begin
(gimp-context-push)
(gimp-context-set-background '(255 255 255))
(set! brush-draw (car (gimp-image-flatten brush-image)))
(gimp-context-pop)
)
)
(if (= type GRAYA-IMAGE)
(begin
(gimp-context-push)
(gimp-context-set-background '(255 255 255))
(set! brush-draw (car (gimp-image-flatten brush-image)))
(gimp-context-pop)
)
(file-gbr-save RUN-NONINTERACTIVE
brush-image brush-draw path path
spacing name)
(gimp-image-delete brush-image)
(gimp-brushes-refresh)
(gimp-context-set-brush name)
)
(gimp-message _"There is no image data in the clipboard to paste.")
)
(file-gbr-save RUN-NONINTERACTIVE
brush-image brush-draw path path
spacing name)
(gimp-image-delete brush-image)
(gimp-brushes-refresh)
(gimp-context-set-brush name)
)
)

View File

@ -20,24 +20,30 @@
(define (script-fu-paste-as-pattern name filename)
(let* (
(pattern-image (car (gimp-edit-paste-as-new)))
(pattern-draw (car (gimp-image-get-active-drawable pattern-image)))
(path (string-append gimp-directory
"/patterns/"
filename
(number->string pattern-image)
".pat"))
)
(let* ((pattern-image (car (gimp-edit-paste-as-new)))
(pattern-draw 0)
(path 0))
(file-pat-save RUN-NONINTERACTIVE
pattern-image pattern-draw path path
name)
(gimp-image-delete pattern-image)
(gimp-patterns-refresh)
(gimp-context-set-pattern name)
(if (= TRUE (car (gimp-image-is-valid pattern-image)))
(begin
(set! pattern-draw (car (gimp-image-get-active-drawable pattern-image)))
(set! path (string-append gimp-directory
"/patterns/"
filename
(number->string pattern-image)
".pat"))
(file-pat-save RUN-NONINTERACTIVE
pattern-image pattern-draw path path
name)
(gimp-image-delete pattern-image)
(gimp-patterns-refresh)
(gimp-context-set-pattern name)
)
(gimp-message _"There is no image data in the clipboard to paste.")
)
)
)

View File

@ -192,7 +192,7 @@ sub edit_paste_as_new {
This procedure pastes a copy of the internal GIMP edit buffer to a new
image. The GIMP edit buffer will be empty unless a call was
previously made to either gimp_edit_cut() or gimp_edit_copy(). This
procedure returns the new image.
procedure returns the new image or -1 if the edit buffer was empty.
HELP
&mitch_pdb_misc('2005', '2.4');
@ -212,7 +212,9 @@ HELP
success = FALSE;
}
else
success = FALSE;
{
image = NULL;
}
}
CODE
);