ly:molecule-XXX conversions.
* lily/molecule-scheme.cc: change names to ly:molecule-XXX
* scm/new-markup.scm (center-markup): \center markup.
2003-03-04 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ * scripts/convert-ly.py (FatalConversionError.conv): add
+ ly:molecule-XXX conversions.
+
+ * lily/molecule-scheme.cc: change names to ly:molecule-XXX
+
* input/regression/multi-measure-rest-text.ly: new file.
* scm/music-functions.scm (glue-mm-rest-texts): automatically
2003-02-22 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ * VERSION: 1.7.13 released
+
* input/test/*: lots of cleanups/comment-outs/removals in chord
examples
#include "molecule.hh"
#include "font-metric.hh"
-LY_DEFINE(ly_set_molecule_extent_x,"ly:set-molecule-extent!", 3 , 0, 0,
+LY_DEFINE(ly_molecule_set_extent_x,"ly:molecule-set-extent!", 3 , 0, 0,
(SCM mol, SCM axis, SCM np),
"Set the extent (@var{extent} must be a pair of numbers) of @var{mol} in \n"
"@var{axis} direction (0 or 1 for x- and y-axis respectively).\n"
}
LY_DEFINE(ly_get_molecule_extent,
- "ly:get-molecule-extent", 2 , 0, 0, (SCM mol, SCM axis),
+ "ly:molecule-get-extent", 2 , 0, 0, (SCM mol, SCM axis),
"Return a pair of numbers signifying the extent of @var{mol} in "
"@var{axis} direction (0 or 1 for x and y axis respectively)."
)
LY_DEFINE(ly_molecule_combined_at_edge,
- "ly:combine-molecule-at-edge",
+ "ly:molecule-combine-at-edge",
4, 2, 0, (SCM first, SCM axis, SCM direction,
SCM second,
SCM padding,
/*
FIXME: support variable number of arguments "
*/
-LY_DEFINE(ly_add_molecule ,
- "ly:add-molecule", 2, 0, 0, (SCM first, SCM second),
+LY_DEFINE(ly_molecule_add ,
+ "ly:molecule-add", 2, 0, 0, (SCM first, SCM second),
"Combine two molecules."
)
{
return fontify_atom (unsmob_metrics (met), f);
}
-LY_DEFINE(ly_align_to_x,"ly:align-to!", 3, 0, 0, (SCM mol, SCM axis, SCM dir),
+LY_DEFINE(ly_align_to_x,"ly:molecule-align-to!", 3, 0, 0, (SCM mol, SCM axis, SCM dir),
"Align @var{mol} using its own extents.")
{
SCM_ASSERT_TYPE(unsmob_molecule (mol), mol, SCM_ARG1, __FUNCTION__, "molecule");
(if (number? fig)
(begin
(set! mol (fontify-text nf (number->string fig)))
- (ly:align-to! mol Y CENTER)
+ (ly:molecule-align-to! mol Y CENTER)
))
(if (number? acc)
(set! mol
- (ly:combine-molecule-at-edge
+ (ly:molecule-combine-at-edge
mol X RIGHT (ly:find-glyph-by-name mf (string-append "accidentals-" (number->string acc)))
0.2))
)
(if (ly:molecule? mol)
- (ly:align-to! mol X CENTER)
+ (ly:molecule-align-to! mol X CENTER)
)
mol))
)
(brew-complete-figure
grob (cdr gather-todo)
- (ly:combine-molecule-at-edge mol Y dir br-mol kerning)
+ (ly:molecule-combine-at-edge mol Y dir br-mol kerning)
)
)
(brew-complete-figure
grob (cdr figs)
- (ly:combine-molecule-at-edge mol Y dir (brew-one-figure grob (car figs))
+ (ly:molecule-combine-at-edge mol Y dir (brew-one-figure grob (car figs))
kerning))
)
))
(set! mol (brew-complete-figure grob (reverse figs) mol))
- (ly:align-to! mol Y (- dir))
+ (ly:molecule-align-to! mol Y (- dir))
mol
))
;;
;; chord names aren't in staffs, so WS is in global staff space.
(if (number? ws)
- (ly:combine-molecule-at-edge
+ (ly:molecule-combine-at-edge
molecule
X RIGHT (ly:make-molecule "" (cons 0 ws) '(-1 . 1) )
0.0)
(if (null? mols)
'()
(if (pair? mols)
- (ly:combine-molecule-at-edge (car mols) axis dir
+ (ly:molecule-combine-at-edge (car mols) axis dir
(stack-molecules axis dir padding (cdr mols))
padding
)
'()
(if (null? (cdr mols))
(car mols)
- (ly:combine-molecule-at-edge (car mols) Y dir
+ (ly:molecule-combine-at-edge (car mols) Y dir
(stack-lines dir padding baseline (cdr mols))
padding baseline
)
"Add brackets around MOL, producing a new molecule."
(let* (
- (ext (ly:get-molecule-extent mol axis))
+ (ext (ly:molecule-get-extent mol axis))
(lb (ly:bracket axis ext thick (- protusion)))
(rb (ly:bracket axis ext thick protusion))
)
- (set! mol (ly:combine-molecule-at-edge mol (other-axis axis) 1 lb padding))
- (set! mol (ly:combine-molecule-at-edge mol (other-axis axis) -1 rb padding))
+ (set! mol (ly:molecule-combine-at-edge mol (other-axis axis) 1 lb padding))
+ (set! mol (ly:molecule-combine-at-edge mol (other-axis axis) -1 rb padding))
mol
))
(thick 0.1)
)
- (set! mol (ly:add-molecule mol (box-molecule xext (cons (- (car yext) thick) (car yext) ))))
- (set! mol (ly:add-molecule mol (box-molecule xext (cons (cdr yext) (+ (cdr yext) thick) ))))
- (set! mol (ly:add-molecule mol (box-molecule (cons (cdr xext) (+ (cdr xext) thick)) yext)))
- (set! mol (ly:add-molecule mol (box-molecule (cons (- (car xext) thick) (car xext)) yext)))
+ (set! mol (ly:molecule-add mol (box-molecule xext (cons (- (car yext) thick) (car yext) ))))
+ (set! mol (ly:molecule-add mol (box-molecule xext (cons (cdr yext) (+ (cdr yext) thick) ))))
+ (set! mol (ly:molecule-add mol (box-molecule (cons (cdr xext) (+ (cdr xext) thick)) yext)))
+ (set! mol (ly:molecule-add mol (box-molecule (cons (- (car xext) thick) (car xext)) yext)))
mol
))
(let* (
(tail (stack-molecule-line space (cdr molecules)))
(head (car molecules))
- (xoff (+ space (cdr (ly:get-molecule-extent head X))))
+ (xoff (+ space (cdr (ly:molecule-get-extent head X))))
)
- (ly:add-molecule
+ (ly:molecule-add
head
(ly:molecule-translate-axis tail xoff X))
)
(define (combine-molecule-list lst)
(if (null? (cdr lst)) (car lst)
- (ly:add-molecule (car lst) (combine-molecule-list (cdr lst)))
+ (ly:molecule-add (car lst) (combine-molecule-list (cdr lst)))
))
(define-public (combine-markup grob props . rest)
- (ly:add-molecule
+ (ly:molecule-add
(interpret-markup grob props (car rest))
(interpret-markup grob props (cadr rest))))
(let*
(
(mols (map (lambda (x) (interpret-markup grob props x)) (car rest)))
- (cmols (map (lambda (x) (ly:align-to! x X CENTER)) mols))
+ (cmols (map (lambda (x) (ly:molecule-align-to! x X CENTER)) mols))
)
(stack-lines
(let ((slur (Slur::brew_molecule grob))
(text (fontify-text (ly:get-default-font grob) letter)))
- (let ((x (/ (- (cdr (ly:get-molecule-extent slur 0))
- (/ (cdr (ly:get-molecule-extent text 0)) 2.0)
+ (let ((x (/ (- (cdr (ly:molecule-get-extent slur 0))
+ (/ (cdr (ly:molecule-get-extent text 0)) 2.0)
)
-2.0)))
- (ly:set-molecule-extent! text 0 (cons x x))
- (ly:align-to! text 0 1)
+ (ly:molecule-set-extent! text 0 (cons x x))
+ (ly:molecule-align-to! text 0 1)
)
-
- (ly:combine-molecule-at-edge slur 1 1 text -0.6)
+
+ (ly:molecule-combine-at-edge slur 1 1 text -0.6)
)
)
)
(let*
(
(mol (callback grob))
- (x-ext (widen-interval (ly:get-molecule-extent mol 0) x-padding))
- (y-ext (widen-interval (ly:get-molecule-extent mol 1) y-padding))
+ (x-ext (widen-interval (ly:molecule-get-extent mol 0) x-padding))
+ (y-ext (widen-interval (ly:molecule-get-extent mol 1) y-padding))
(x-rule (box-molecule (widen-interval x-ext line-thick)
(cons 0 line-thick)))
(y-rule (box-molecule (cons 0 line-thick) y-ext))
)
- (set! mol (ly:combine-molecule-at-edge mol 0 1 y-rule x-padding))
- (set! mol (ly:combine-molecule-at-edge mol 0 -1 y-rule x-padding))
- (set! mol (ly:combine-molecule-at-edge mol 1 1 x-rule 0))
- (set! mol (ly:combine-molecule-at-edge mol 1 -1 x-rule 0))
+ (set! mol (ly:molecule-combine-at-edge mol 0 1 y-rule x-padding))
+ (set! mol (ly:molecule-combine-at-edge mol 0 -1 y-rule x-padding))
+ (set! mol (ly:molecule-combine-at-edge mol 1 1 x-rule 0))
+ (set! mol (ly:molecule-combine-at-edge mol 1 -1 x-rule 0))
mol
))
return str
conversions.append (((1,7,11), conv, "transpose-pitch -> pitch-transpose"))
+
+if 1:
+ def conv(str):
+ str = re.sub (r"ly:get-molecule-extent", "ly:molecule-get-extent", str)
+ str = re.sub (r"ly:set-molecule-extent!", "ly:molecule-set-extent!", str)
+ str = re.sub (r"ly:add-molecule", "ly:molecule-add", str)
+ str = re.sub (r"ly:combine-molecule-at-edge", "ly:molecule-combine-at-edge", str)
+ str = re.sub (r"ly:align-to!", "ly:molecule-align-to!", str)
+
+ return str
+
+ conversions.append (((1,7,13), conv, "ly:XX-molecule-YY -> ly:molecule-XX-YY"))
+
################################