~ubuntu-branches/ubuntu/jaunty/gimp/jaunty-security

« back to all changes in this revision

Viewing changes to plug-ins/script-fu/scripts/guides-from-selection.scm

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-05-02 16:33:03 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070502163303-bvzhjzbpw8qglc4y
Tags: 2.3.16-1ubuntu1
* Resynchronized with Debian, remaining Ubuntu changes:
  - debian/rules: i18n magic.
* debian/control.in:
  - Maintainer: Ubuntu Core Developers <ubuntu-devel@lists.ubuntu.com>
* debian/patches/02_help-message.patch,
  debian/patches/03_gimp.desktop.in.in.patch,
  debian/patches/10_dont_show_wizard.patch: updated.
* debian/patches/04_composite-signedness.patch,
  debian/patches/05_add-letter-spacing.patch: dropped, used upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
;; -*-scheme-*- 
2
 
 
3
 
(define (script-fu-guides-from-selection image
4
 
                                         drawable) 
5
 
  (let* ((boundries (gimp-selection-bounds image))
6
 
         ;; non-empty INT32 TRUE if there is a selection
7
 
         (selection (car boundries)) 
8
 
         (x1 (cadr boundries))
9
 
         (y1 (caddr boundries))
10
 
         (x2 (cadr (cddr boundries))) 
11
 
         (y2 (caddr (cddr boundries))))
12
 
        
13
 
    ;; need to check for a selection or we get guides right at edges of the image
14
 
    (if (= selection TRUE) 
15
 
        (begin
16
 
          (gimp-image-undo-group-start image) 
17
 
 
18
 
          (gimp-image-add-vguide image x1)
19
 
          (gimp-image-add-hguide image y1)
20
 
          (gimp-image-add-vguide image x2)
21
 
          (gimp-image-add-hguide image y2)
22
 
 
23
 
          (gimp-image-undo-group-end image)       
24
 
          (gimp-displays-flush)))))
25
 
 
26
 
(script-fu-register "script-fu-guides-from-selection" 
27
 
                    _"New Guides from _Selection"
28
 
                    _"Creates four Guides around the bounding box of the current selection."
29
 
                    "Alan Horkan"
30
 
                    "Alan Horkan, 2004.  Public Domain."
31
 
                    "2004-08-13"
32
 
                    ""
33
 
                    SF-IMAGE    "Image"    0 
34
 
                    SF-DRAWABLE "Drawable" 0)
35
 
 
36
 
(script-fu-menu-register "script-fu-guides-from-selection" 
37
 
                         "<Image>/Image/Guides")
 
1
;; -*-scheme-*-
 
2
 
 
3
(define (script-fu-guides-from-selection image drawable)
 
4
  (let* (
 
5
        (boundries (gimp-selection-bounds image))
 
6
        ;; non-empty INT32 TRUE if there is a selection
 
7
        (selection (car boundries))
 
8
        (x1 (cadr boundries))
 
9
        (y1 (caddr boundries))
 
10
        (x2 (cadr (cddr boundries)))
 
11
        (y2 (caddr (cddr boundries)))
 
12
        )
 
13
 
 
14
    ;; need to check for a selection or we get guides right at edges of the image
 
15
    (if (= selection TRUE)
 
16
      (begin
 
17
        (gimp-image-undo-group-start image)
 
18
 
 
19
        (gimp-image-add-vguide image x1)
 
20
        (gimp-image-add-hguide image y1)
 
21
        (gimp-image-add-vguide image x2)
 
22
        (gimp-image-add-hguide image y2)
 
23
 
 
24
        (gimp-image-undo-group-end image)
 
25
        (gimp-displays-flush)
 
26
      )
 
27
    )
 
28
  )
 
29
)
 
30
 
 
31
(script-fu-register "script-fu-guides-from-selection"
 
32
  _"New Guides from _Selection"
 
33
  _"Draw a grid as specified by the lists of X and Y locations using the current brush"
 
34
  "Alan Horkan"
 
35
  "Alan Horkan, 2004.  Public Domain."
 
36
  "2004-08-13"
 
37
  ""
 
38
  SF-IMAGE    "Image"    0
 
39
  SF-DRAWABLE "Drawable" 0
 
40
)
 
41
 
 
42
(script-fu-menu-register "script-fu-guides-from-selection"
 
43
                         "<Image>/Image/Guides")