]> git.donarmstrong.com Git - lilypond.git/blob - hdr/molecule.hh
partial: 0.0.39-1.jcn
[lilypond.git] / hdr / molecule.hh
1 #ifndef MOLECULE_HH
2 #define MOLECULE_HH
3
4 #include "proto.hh"
5 #include "plist.hh"
6 #include "boxes.hh"
7 #include "symbol.hh"
8
9 /// a symbol which can be translated, and freely copied
10 struct Atom {
11     Offset off;
12     Symbol sym;
13
14     /* *************** */
15     
16     void translate(Offset o) {
17         off += o;
18     }
19     
20     /// how big is #this#?
21     Box extent() const;
22     Atom(Symbol s);
23
24     void print() const;
25
26     String TeXstring() const;
27 };
28
29
30 /** a group of individually translated symbols. You can add molecules
31     to the top, to the right, etc.  */
32 struct Molecule {
33     IPointerList<Atom*> ats;    // change to List<Atom>? 
34
35     /* *************** */
36     
37     Molecule() { }
38     Molecule(Atom a) { add(a) ; }
39
40     void add_right(const Molecule &m);
41     void add_left(const Molecule &m);
42     void add_top(const Molecule &m);
43     void add_bottom(const Molecule &m);
44     void add(Molecule const &m);
45     void translate(Offset);
46     void add(Atom a) { ats.bottom().add(new Atom(a)); }
47     /// how big is #this#? 
48     Box extent() const;
49
50     String TeXstring() const;
51
52     Molecule(const Molecule&s);
53     void print() const;
54 private:
55     void operator=(const Molecule&);
56 };
57 #endif