2 molecule.hh -- declare Molecule
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2002 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"
19 /** a group of individually translated symbols. You can add molecules
20 to the top, to the right, etc.
22 It is implemented as a "tree" of scheme expressions, as in
24 Expr = combine Expr Expr
25 | translate Offset Expr
29 SCHEME is a Scheme expression that --when eval'd-- produces the
33 Because of the way that Molecule is implemented, it is the most
34 efficient to add "fresh" molecules to what you're going to build.
38 Empty molecules have empty dimensions. If add_at_edge is used to
39 init the molecule, we assume that
40 DIMENSIONS = (Interval (0,0),Interval (0,0)
44 friend SCM ly_molecule_set_extent_x (SCM, SCM, SCM);
49 DECLARE_SIMPLE_SMOBS (Molecule,);
51 Molecule (Box, SCM s);
55 SCM smobbed_copy () const;
56 SCM get_expr () const;
59 Set dimensions to empty, or to (Interval (0,0),Interval (0,0) */
60 void set_empty (bool);
61 void add_at_edge (Axis a, Direction d, const Molecule &m, Real padding,
63 void add_molecule (Molecule const &m);
64 void translate (Offset);
67 align D direction in axis A.
69 If D == CENTER, then move the dimension (A).center () to (0,0)
71 Else, move so dimension (A)[D] == 0.0
74 void align_to (Axis a, Direction d);
75 void translate_axis (Real,Axis);
77 Interval extent (Axis) const;
78 Box extent_box () const;
80 codify THIS into a Scheme expression.
82 SCM create_scheme () const;
83 bool empty_b () const;
86 static SCM ly_get_molecule_extent (SCM mol, SCM axis);
87 static SCM ly_set_molecule_extent_x (SCM,SCM,SCM);
88 static SCM ly_molecule_combined_at_edge (SCM,SCM,SCM,SCM,SCM);
92 DECLARE_UNSMOB(Molecule,molecule);
93 SCM fontify_atom (Font_metric const*, SCM atom);
95 Molecule create_molecule (SCM brew_molecule);