gimp/plug-ins/script-fu/scripts/grid-system.scm
Henrik Brix Andersen f36a63f68c removed function gimp_menu_path_strip_uline() ...
2003-08-09 Henrik Brix Andersen <brix@gimp.org>

* gimp/app/widgets/gimpwidgets-utils.[ch]: removed function
gimp_menu_path_strip_uline() ...

* gimp/libgimpbase/gimputils.[ch]: ... and added it here under the
name gimp_strip_uline()

* gimp/devel-docs/libgimpbase/libgimpbase-sections.txt: added
gimp_strip_uline to gimputils section

* gimp/app/plug-in/plug-in.c
* gimp/app/widgets/gimpitemfactory.c
* gimp/app/widgets/gimptoolbox.
* gimp/app/gui/plug-in-menus.c: changed accordingly

* gimp/plug-ins/script-fu/script-fu-scripts.c
(script_fu_interface): use gimp_strip_uline() to strip mnemonics
from script-fu menu paths

* gimp/app/gui/vectors-menu.c
* gimp/app/gui/templates-menu.c
* gimp/app/gui/qmask-menu.c
* gimp/app/gui/palettes-menu.c
* gimp/app/gui/palette-editor-menu.c
* gimp/app/gui/images-menu.c
* gimp/app/gui/gradients-menu.c
* gimp/app/gui/gradient-editor-menu.c
* gimp/app/gui/documents-menu.c
* gimp/app/gui/dialogs-menu.c
* gimp/app/gui/colormap-editor-menu.c
* gimp/app/gui/channels-menu.c
* gimp/app/gui/buffers-menu.c
* gimp/app/gui/brushes-menu.c
* gimp/app/gui/layers-menu.c
* gimp/plug-ins/pygimp/plug-ins/clothify.py
* gimp/plug-ins/pygimp/plug-ins/shadow_bevel.py
* gimp/plug-ins/pygimp/plug-ins/whirlpinch.py
* gimp/plug-ins/pygimp/plug-ins/foggify.py
* gimp/plug-ins/script-fu/scripts/*.scm
* gimp/plug-ins/script-fu/script-fu.c: added mnemonics fixing more
of bug #106991

* gimp/app/gui/error-console-menu.c (error_console_menu_update):
updated menu item names, added mnemonics

* gimp/plug-ins/common/animoptimize.c *
gimp/plug-ins/common/animationplay.c: don't prepend every menu
entry with "Animation"
2003-08-11 17:14:32 +00:00

87 lines
3.4 KiB
Scheme

;;; grid-system.scm -*-scheme-*-
;;; Time-stamp: <1998/01/20 23:22:02 narazaki@InetQ.or.jp>
;;; This file is a part of:
;;; The GIMP (Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis)
;;; Author: Shuji Narazaki (narazaki@InetQ.or.jp)
;;; Version 0.6
;;; Code:
(if (not (symbol-bound? 'script-fu-grid-system-x-divides (the-environment)))
(define script-fu-grid-system-x-divides "'(1 g 1)"))
(if (not (symbol-bound? 'script-fu-grid-system-y-divides (the-environment)))
(define script-fu-grid-system-y-divides "'(1 g 1)"))
(define (script-fu-grid-system img drw x-divides-orig y-divides-orig)
(define (update-segment! s x0 y0 x1 y1)
(aset s 0 x0)
(aset s 1 y0)
(aset s 2 x1)
(aset s 3 y1))
(define (convert-g l)
(cond ((null? l) '())
((eq? (car l) 'g) (cons 1.618 (convert-g (cdr l))))
((eq? (car l) '1/g) (cons 0.618 (convert-g (cdr l))))
('else (cons (car l) (convert-g (cdr l))))))
(define (wrap-list l)
(define (wrap-object obj)
(cond ((number? obj) (string-append (number->string obj) " "))
((eq? obj 'g) "g ")
(eq? ojb '1/g) "1/g "))
(string-append "'("
(apply string-append (map wrap-object l))
")"))
(let* ((drw-width (car (gimp-drawable-width drw)))
(drw-height (car (gimp-drawable-height drw)))
(drw-offset-x (nth 0 (gimp-drawable-offsets drw)))
(drw-offset-y (nth 1 (gimp-drawable-offsets drw)))
(grid-layer #f)
(segment (cons-array 4 'double))
(stepped-x 0)
(stepped-y 0)
(temp 0)
(total-step-x 0)
(total-step-y 0))
(set! x-divides (convert-g x-divides-orig))
(set! y-divides (convert-g y-divides-orig))
(set! total-step-x (apply + x-divides))
(set! total-step-y (apply + y-divides))
;(gimp-undo-push-group-start img)
(set! grid-layer (car (gimp-layer-copy drw TRUE)))
(gimp-edit-clear grid-layer)
(gimp-layer-set-name grid-layer "grid layer")
(while (not (null? (cdr x-divides)))
(set! stepped-x (+ stepped-x (car x-divides)))
(set! temp (* drw-width (/ stepped-x total-step-x)))
(set! x-divides (cdr x-divides))
(update-segment! segment
(+ drw-offset-x temp) drw-offset-y
(+ drw-offset-x temp) (+ drw-offset-y drw-height))
(gimp-pencil grid-layer 4 segment))
(while (not (null? (cdr y-divides)))
(set! stepped-y (+ stepped-y (car y-divides)))
(set! temp (* drw-height (/ stepped-y total-step-y)))
(set! y-divides (cdr y-divides))
(update-segment! segment
drw-offset-x (+ drw-offset-y temp)
(+ drw-offset-x drw-width) (+ drw-offset-y temp))
(gimp-pencil grid-layer 4 segment))
(gimp-image-add-layer img grid-layer 0)
;(gimp-undo-push-group-end img)
(set! script-fu-grid-system-x-divides (wrap-list x-divides-orig))
(set! script-fu-grid-system-y-divides (wrap-list y-divides-orig))
(gimp-displays-flush)))
(script-fu-register "script-fu-grid-system"
_"<Image>/Script-Fu/Render/_Grid..."
"Draw grid as specified by X-DIVIDES (list of propotions relative to the drawable) and Y-DIVIDES. The color and width of grid is detemined by the current settings of brush."
"Shuji Narazaki <narazaki@InetQ.or.jp>"
"Shuji Narazaki"
"1997"
"RGB*, INDEXED*, GRAY*"
SF-IMAGE "Image to use" 0
SF-DRAWABLE "Drawable to draw grid" 0
SF-VALUE _"X Divisions" script-fu-grid-system-x-divides
SF-VALUE _"Y Divisions" script-fu-grid-system-y-divides
)
;;; grid-system.scm ends here