]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/molecule.hh
f5e94ef60aadf6aa94e532af47043e573ea76389
[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 #include "protected-scm.hh"
17
18 //#define ATOM_SMOB
19
20 /** a group of individually translated symbols. You can add molecules
21     to the top, to the right, etc.
22
23     Dimension behavior:
24
25     Empty molecules have empty dimensions.  If add_at_edge is used to
26     init the molecule, we assume that
27     DIMENSIONS = (Interval(0,0),Interval(0,0)
28
29 */
30 class Molecule {
31   Protected_scm atom_list_;
32
33   friend class Paper_outputter;
34
35 public:
36   Box dim_;
37
38   Molecule();
39   ~Molecule();
40
41   /**
42      Set dimensions to empty, or to (Interval(0,0),Interval(0,0) */
43   void set_empty (bool);
44   void add_at_edge (Axis a, Direction d, const Molecule &m, Real padding);
45
46   /**
47      Add an atom.  The molecule assumes responsibility for cleaning.
48    */
49   void add_atom (SCM as);    
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
71   void operator=(const Molecule&);  
72   bool empty_b() const;
73   void print ()const;
74 };
75 #endif