]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.19
authorfred <fred>
Fri, 20 Dec 1996 23:18:55 +0000 (23:18 +0000)
committerfred <fred>
Fri, 20 Dec 1996 23:18:55 +0000 (23:18 +0000)
hdr/molecule.hh
src/molecule.cc
src/stem.cc

index 83f8ac1e2c6f4edde23fdd7bcf9e2f1dd1ea1b40..b5df9ee383ab4baceca6c48974cbeaa99d3542f5 100644 (file)
@@ -38,7 +38,7 @@ struct Molecule {
     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_bottom(const Molecule &m);
     void add(Molecule const &m);
     void translate(Offset);
     void add(Atom a) { ats.bottom().add(new Atom(a)); }
index a664eeb74ad00c8902360a35f147318fd9ea6fb8..fb72eb6bf0600f0d5adb73c97abe841288d8be80 100644 (file)
@@ -116,7 +116,7 @@ Molecule::add_top(const Molecule &m)
 }
 
 void
-Molecule::add_bot(const Molecule &m)
+Molecule::add_bottom(const Molecule &m)
 {
     if (!ats.size()) {
        add(m);
index 84e24c598639bb1e2b8ba33f43361086fdb51a1c..03b91b93165e25d31578f40220f507f0cbb39ac8 100644 (file)
@@ -60,7 +60,8 @@ Stem::add(Notehead *n)
     if ( p < minnote)
        minnote = p;
     if ( p> maxnote)
-       maxnote = p;    
+       maxnote = p;
+    heads.add(n);
 }
 
 
@@ -108,11 +109,29 @@ Stem::set_default_extents()
        stem_xoffset = 0;
 }
 
+void
+Stem::set_noteheads()
+{
+    heads.sort(Notehead::compare);
+    int parity=0;
+    int lastpos = heads[0]->position;
+    for (int i=1; i < heads.sz(); i ++) {
+       if (ABS(lastpos- heads[i]->position) == 1) {
+           if (parity)
+               heads[i]->x_dir = (stem_xoffset>0) ? 1:-1;
+           parity = !parity;
+       } else
+           parity = 0;
+       lastpos = heads[i]->position;
+    }
+}
+
 void
 Stem::postprocess()
 {
     if (bot == top)
        set_default_extents();
+    set_noteheads();
     brew_molecole();
 }
 
@@ -146,7 +165,7 @@ Stem::brew_molecole()
        Symbol fl = p->lookup_->flag(flag);
        Molecule m(fl);
        if (flag < -4){         
-           output->add_bot(m);
+           output->add_bottom(m);
        } else if (flag > 4) {
            output->add_top(m);
        } else