mirror of https://github.com/GNOME/gimp.git
app/actions/image-actions.c added menu branch "<Image>/Image/Guides".
2004-10-13 Michael Natterer <mitch@gimp.org> * app/actions/image-actions.c * menus/image-menu.xml.in: added menu branch "<Image>/Image/Guides". * plug-ins/script-fu/scripts/Makefile.am * plug-ins/script-fu/scripts/guides-from-selection.scm * plug-ins/script-fu/scripts/guides-new-percent.scm * plug-ins/script-fu/scripts/guides-new.scm * plug-ins/script-fu/scripts/guides-remove-all.scm: added new scripts from Alan Horkan. Fixes bug #119667.
This commit is contained in:
parent
c94147a16c
commit
c85906af87
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
2004-10-13 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/actions/image-actions.c
|
||||
* menus/image-menu.xml.in: added menu branch "<Image>/Image/Guides".
|
||||
|
||||
* plug-ins/script-fu/scripts/Makefile.am
|
||||
* plug-ins/script-fu/scripts/guides-from-selection.scm
|
||||
* plug-ins/script-fu/scripts/guides-new-percent.scm
|
||||
* plug-ins/script-fu/scripts/guides-new.scm
|
||||
* plug-ins/script-fu/scripts/guides-remove-all.scm: added new
|
||||
scripts from Alan Horkan. Fixes bug #119667.
|
||||
|
||||
2004-10-13 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* plug-ins/common/flarefx.c: cleaned up and simplified the
|
||||
|
|
|
@ -56,6 +56,7 @@ static GimpActionEntry image_actions[] =
|
|||
{ "image-menu", NULL, N_("_Image") },
|
||||
{ "image-mode-menu", NULL, N_("_Mode") },
|
||||
{ "image-transform-menu", NULL, N_("_Transform") },
|
||||
{ "image-guides-menu", NULL, N_("_Guides") },
|
||||
|
||||
{ "image-new", GTK_STOCK_NEW,
|
||||
N_("_New..."), "<control>N", NULL,
|
||||
|
|
|
@ -288,6 +288,8 @@
|
|||
<menuitem action="image-flatten" />
|
||||
</placeholder>
|
||||
<separator />
|
||||
<menu action="image-guides-menu" name="Guides">
|
||||
</menu>
|
||||
<menuitem action="image-configure-grid" />
|
||||
<separator />
|
||||
</menu>
|
||||
|
@ -508,6 +510,7 @@
|
|||
<menu action="plug-in-render-clouds-menu" name="Clouds" />
|
||||
<menu action="plug-in-render-nature-menu" name="Nature" />
|
||||
<menu action="plug-in-render-pattern-menu" name="Pattern" />
|
||||
<separator />
|
||||
</menu>
|
||||
<menu action="plug-in-web-menu" name="Web" />
|
||||
<separator />
|
||||
|
|
|
@ -57,6 +57,10 @@ scriptdata_DATA = \
|
|||
gradient-bevel-logo.scm \
|
||||
gradient-example.scm \
|
||||
grid-system.scm \
|
||||
guides-from-selection.scm \
|
||||
guides-new.scm \
|
||||
guides-new-percent.scm \
|
||||
guides-remove-all.scm \
|
||||
hsv-graph.scm \
|
||||
i26-gunya2.scm \
|
||||
image-structure.scm \
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
;; -*-scheme-*-
|
||||
|
||||
(define (script-fu-guides-from-selection image
|
||||
drawable)
|
||||
(let* ((boundries (gimp-selection-bounds image))
|
||||
;; non-empty INT32 TRUE if there is a selection
|
||||
(selection (car boundries))
|
||||
(x1 (cadr boundries))
|
||||
(y1 (caddr boundries))
|
||||
(x2 (cadr (cddr boundries)))
|
||||
(y2 (caddr (cddr boundries))))
|
||||
|
||||
;; need to check for a selection or we get guides right at edges of the image
|
||||
(if (= selection TRUE)
|
||||
(begin
|
||||
(gimp-image-undo-group-start image)
|
||||
|
||||
(gimp-image-add-vguide image x1)
|
||||
(gimp-image-add-hguide image y1)
|
||||
(gimp-image-add-vguide image x2)
|
||||
(gimp-image-add-hguide image y2)
|
||||
|
||||
(gimp-image-undo-group-end image)
|
||||
(gimp-displays-flush)))))
|
||||
|
||||
(script-fu-register "script-fu-guides-from-selection"
|
||||
_"<Image>/Image/Guides/New Guides from _Selection"
|
||||
_"Creates four Guides around the bounding box of the current selection."
|
||||
"Alan Horkan"
|
||||
"Alan Horkan, 2004. Public Domain."
|
||||
"2004-08-13"
|
||||
""
|
||||
SF-IMAGE "Image" 0
|
||||
SF-DRAWABLE "Drawable" 0)
|
|
@ -0,0 +1,37 @@
|
|||
;; -*-scheme-*-
|
||||
|
||||
;; Alan Horkan 2004. Copyright.
|
||||
;; I'll fix it and license it differntly later if anyone cares to ask
|
||||
|
||||
(define (script-fu-guide-new-percent image
|
||||
drawable
|
||||
direction
|
||||
position)
|
||||
(let* ((width (car (gimp-drawable-width drawable)))
|
||||
(height (car (gimp-drawable-height drawable))))
|
||||
(gimp-image-undo-group-start image)
|
||||
|
||||
(if (= direction 0)
|
||||
(set! position (/ (* height position) 100))
|
||||
(set! position (/ (* width position) 100)))
|
||||
|
||||
(if (= direction 0)
|
||||
;; convert position to pixel
|
||||
(if (< position height) (gimp-image-add-hguide image position))
|
||||
(if (< position width) (gimp-image-add-vguide image position)))
|
||||
|
||||
(gimp-image-undo-group-end image)
|
||||
(gimp-displays-flush)))
|
||||
|
||||
(script-fu-register "script-fu-guide-new-percent"
|
||||
_"<Image>/Image/Guides/New Guide (by _Percent)..."
|
||||
"Add a single Line Guide with the specified postion. Position specified as a percent of the image size."
|
||||
"Alan Horkan"
|
||||
"Alan Horkan, 2004"
|
||||
"April 2004"
|
||||
""
|
||||
SF-IMAGE "Input Image" 0
|
||||
SF-DRAWABLE "Input Drawable" 0
|
||||
SF-OPTION _"Direction" '(_"Horizontal"
|
||||
_"Vertical")
|
||||
SF-ADJUSTMENT _"Position (in %)" '(50 0 100 1 10 0 1))
|
|
@ -0,0 +1,34 @@
|
|||
;; -*-scheme-*-
|
||||
|
||||
;; Alan Horkan 2004. Public Domain.
|
||||
;; so long as remove this block of comments from your script
|
||||
;; feel free to use it for whatever you like.
|
||||
|
||||
(define (script-fu-guide-new image
|
||||
drawable
|
||||
direction
|
||||
position)
|
||||
(let* ((width (car (gimp-drawable-width drawable)))
|
||||
(height (car (gimp-drawable-height drawable))))
|
||||
(gimp-image-undo-group-start image)
|
||||
|
||||
(if (= direction 0)
|
||||
;; check position is inside the image boundaries
|
||||
(if (< position height) (gimp-image-add-hguide image position))
|
||||
(if (< position width) (gimp-image-add-vguide image position)))
|
||||
|
||||
(gimp-image-undo-group-end image)
|
||||
(gimp-displays-flush)))
|
||||
|
||||
(script-fu-register "script-fu-guide-new"
|
||||
_"<Image>/Image/Guides/New _Guide..."
|
||||
"Add a single Line Guide with the specified postion and orientation. Postion is specified in Pixels (px)."
|
||||
"Alan Horkan"
|
||||
"Alan Horkan, 2004. Public Domain."
|
||||
"2004-04-02"
|
||||
""
|
||||
SF-IMAGE "Image" 0
|
||||
SF-DRAWABLE "Drawable" 0
|
||||
SF-OPTION _"Direction" '(_"Horizontal"
|
||||
_"Vertical")
|
||||
SF-ADJUSTMENT "Position" '(0 0 1000 1 10 0 1))
|
|
@ -0,0 +1,24 @@
|
|||
;; -*-scheme-*-
|
||||
|
||||
(define (script-fu-guides-remove image
|
||||
drawable)
|
||||
(let* ((guide-id 0))
|
||||
(gimp-image-undo-group-start image)
|
||||
|
||||
(set! guide-id (car (gimp-image-find-next-guide image 0)))
|
||||
(while (> guide-id 0)
|
||||
(gimp-image-delete-guide image guide-id)
|
||||
(set! guide-id (car (gimp-image-find-next-guide image 0))))
|
||||
|
||||
(gimp-image-undo-group-end image)
|
||||
(gimp-displays-flush)))
|
||||
|
||||
(script-fu-register "script-fu-guides-remove"
|
||||
_"<Image>/Image/Guides/_Remove all Guides"
|
||||
"Removes all horizontal and vertical guides."
|
||||
"Alan Horkan"
|
||||
"Alan Horkan, 2004. Public Domain."
|
||||
"April 2004"
|
||||
""
|
||||
SF-IMAGE "Image" 0
|
||||
SF-DRAWABLE "Drawable" 0)
|
Loading…
Reference in New Issue