]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/molecule.hh
release: 1.3.19
[lilypond.git] / lily / include / molecule.hh
1 /*
2   molecule.hh -- declare Molecule
3
4   source file of the GNU LilyPond music typesetter
5
6   (c)  1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8 #ifndef MOLECULE_HH
9 #define MOLECULE_HH
10
11 #include "lily-proto.hh"
12 #include "box.hh"
13 #include "axes.hh"
14 #include "direction.hh"
15 #include "cons.hh"
16
17 //#define ATOM_SMOB
18
19 /** a group of individually translated symbols. You can add molecules
20     to the top, to the right, etc.
21
22     Dimension behavior:
23
24     Empty molecules have empty dimensions.  If add_at_edge is used to
25     init the molecule, we assume that
26     DIMENSIONS = (Interval(0,0),Interval(0,0)
27
28 */
29 class Molecule {
30 #ifdef ATOM_SMOB
31   SCM atom_list_;
32 #else
33   //  Protected_scm atom_list_; // change to List<Atom>?
34   Cons<Atom> *atom_list_;
35 #endif
36   friend class Paper_outputter;
37
38 public:
39   Box dim_;
40
41   Molecule();
42   ~Molecule();
43
44   /**
45      Set dimensions to empty, or to (Interval(0,0),Interval(0,0) */
46   void set_empty (bool);
47   
48   void add_at_edge (Axis a, Direction d, const Molecule &m, Real padding);
49   void add_atom (Atom const *a);    
50   void add_molecule (Molecule const &m);
51   void translate (Offset);
52   
53   /**
54      align D direction in axis A.
55
56      If D == CENTER, then move the dimension(A).center() to (0,0)
57
58      Else, move so dimension(A)[D] == 0.0
59      
60    */
61   void align_to (Axis a, Direction d);
62   void translate_axis (Real,Axis);
63
64   
65   /// how big is #this#? 
66   Box extent() const;
67   Interval extent (Axis) const;
68
69   Molecule (const Molecule&s);
70   void print() const;
71   void operator=(const Molecule&);  
72   bool empty_b() const;
73 };
74 #endif