X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Finclude%2Fmolecule.hh;h=76081729ca0c82361c5ec2e3c02ed61aac67c580;hb=d9b43b93f2c885409bafdb157138158f65cc49aa;hp=90102b62423981b8bb84042b028ec052a07b9f7f;hpb=8f58f4428d70961938e9151097886d861b3faeb3;p=lilypond.git diff --git a/lily/include/molecule.hh b/lily/include/molecule.hh index 90102b6242..76081729ca 100644 --- a/lily/include/molecule.hh +++ b/lily/include/molecule.hh @@ -3,72 +3,94 @@ source file of the GNU LilyPond music typesetter - (c) 1997--1999 Han-Wen Nienhuys + (c) 1997--2002 Han-Wen Nienhuys */ #ifndef MOLECULE_HH #define MOLECULE_HH +#include // size_t #include "lily-proto.hh" #include "box.hh" #include "axes.hh" #include "direction.hh" -#include "cons.hh" - -//#define ATOM_SMOB +#include "lily-guile.hh" +#include "smobs.hh" /** a group of individually translated symbols. You can add molecules to the top, to the right, etc. + It is implemented as a "tree" of scheme expressions, as in + + Expr = combine Expr Expr + | translate Offset Expr + | SCHEME + ; + + SCHEME is a Scheme expression that --when eval'd-- produces the + desired output. + + + Because of the way that Molecule is implemented, it is the most + efficient to add "fresh" molecules to what you're going to build. + Dimension behavior: Empty molecules have empty dimensions. If add_at_edge is used to init the molecule, we assume that - DIMENSIONS = (Interval(0,0),Interval(0,0) - + DIMENSIONS = (Interval (0,0),Interval (0,0) */ class Molecule { -#ifdef ATOM_SMOB - SCM atom_list_; -#else - // Protected_scm atom_list_; // change to List? - Cons *atom_list_; -#endif - friend class Paper_outputter; + Box dim_; + SCM expr_; + + DECLARE_SIMPLE_SMOBS (Molecule,); public: - Box dim_; + Molecule (Box, SCM s); + Molecule (); + - Molecule(); - ~Molecule(); + SCM smobbed_copy () const; + SCM get_expr () const; /** - Set dimensions to empty, or to (Interval(0,0),Interval(0,0) */ + Set dimensions to empty, or to (Interval (0,0),Interval (0,0) */ void set_empty (bool); - void add_at_edge (Axis a, Direction d, const Molecule &m, Real padding); - void add_atom (Atom const *a); void add_molecule (Molecule const &m); void translate (Offset); /** align D direction in axis A. - If D == CENTER, then move the dimension(A).center() to (0,0) + If D == CENTER, then move the dimension (A).center () to (0,0) - Else, move so dimension(A)[D] == 0.0 + Else, move so dimension (A)[D] == 0.0 */ void align_to (Axis a, Direction d); void translate_axis (Real,Axis); - - /// how big is #this#? - Box extent() const; Interval extent (Axis) const; + Box extent_box () const; + /** + codify THIS into a Scheme expression. + */ + SCM create_scheme () const; + bool empty_b () const; + - Molecule (const Molecule&s); - void print() const; - void operator=(const Molecule&); - bool empty_b() const; + static SCM ly_get_molecule_extent (SCM mol, SCM axis); + static SCM ly_set_molecule_extent_x (SCM,SCM,SCM); + static SCM ly_molecule_combined_at_edge (SCM,SCM,SCM,SCM,SCM); }; + + +DECLARE_UNSMOB(Molecule,molecule); +SCM fontify_atom (Font_metric*, SCM atom); + +Molecule create_molecule (SCM brew_molecule); + + + #endif