]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.1
authorfred <fred>
Sat, 31 Aug 1996 15:16:18 +0000 (15:16 +0000)
committerfred <fred>
Sat, 31 Aug 1996 15:16:18 +0000 (15:16 +0000)
molecule.hh [new file with mode: 0644]

diff --git a/molecule.hh b/molecule.hh
new file mode 100644 (file)
index 0000000..c98cfe5
--- /dev/null
@@ -0,0 +1,50 @@
+#ifndef MOLECULE_HH
+#define MOLECULE_HH
+
+#include "list.hh"
+#include "boxes.hh"
+#include "item.hh"
+
+/// a symbol which can be translated, and freely copied
+struct Atom {
+    Offset off;
+    const Symbol * sym;
+
+    void translate(Offset o) {
+       off += o;
+    }
+    
+    /// how big is #this#?
+    Box extent() const {
+       Box b( sym->dim);
+       b.translate(off);
+       return b;
+    }
+    Atom(const Symbol*s) {
+       sym=s;
+    }
+    String TeXstring() const;
+};
+
+/// a group of #Atom#s
+struct Molecule : Output {
+    List<Atom> ats;
+
+    Molecule() { }
+    Molecule(Atom a) { ats.bottom().add(a); }
+    //    Molecule(Molecule const&src);
+    void add_right(const Molecule &m);
+    void add_left(const Molecule &m);
+    void add_top(const Molecule &m);
+    void add_bot(const Molecule &m);
+    void add(Molecule const &m);
+    void translate(Offset);
+
+    /// how big is #this#? 
+    Box extent() const;
+
+    String TeXstring() const;
+};
+/** a group of individually translated symbols. You can add molecules
+    to the top, to the right, etc.  */
+#endif