2 molecule.hh -- declare Molecule
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
11 #include <stdlib.h> // size_t
12 #include "lily-proto.hh"
15 #include "direction.hh"
16 #include "lily-guile.hh"
18 /** a group of individually translated symbols. You can add molecules
19 to the top, to the right, etc.
21 It is implemented as a "tree" of scheme expressions, as in
23 Expr = combine Expr Expr
24 | translate Offset Expr
28 SCHEME is a Scheme expression that --when eval'd-- produces the
32 Because of the way that Molecule is implemented, it is the most
33 efficient to add "fresh" molecules to what you're going to build.
37 Empty molecules have empty dimensions. If add_at_edge is used to
38 init the molecule, we assume that
39 DIMENSIONS = (Interval(0,0),Interval(0,0)
41 TODO: go full smob with Molecule.
45 /// can't alloc on heap.
46 void * operator new (size_t s);
52 SCM get_expr () const;
54 Molecule (Box, SCM s);
58 Set dimensions to empty, or to (Interval(0,0),Interval(0,0) */
59 void set_empty (bool);
60 void add_at_edge (Axis a, Direction d, const Molecule &m, Real padding);
61 void add_molecule (Molecule const &m);
62 void translate (Offset);
65 align D direction in axis A.
67 If D == CENTER, then move the dimension(A).center() to (0,0)
69 Else, move so dimension(A)[D] == 0.0
72 void align_to (Axis a, Direction d);
73 void translate_axis (Real,Axis);
75 Interval extent (Axis) const;
77 codify THIS into a Scheme expression.
79 SCM create_scheme () const;
83 SCM fontify_atom (Font_metric*, SCM atom);
85 Molecule create_molecule (SCM brew_molecule);