From: Jan Nieuwenhuizen <janneke@gnu.org>
Date: Fri, 27 Jun 1997 10:27:29 +0000 (+0200)
Subject: patch::: 0.0.68pre.jcn1: Re: patsen?
X-Git-Tag: release/0.0.70pre~1
X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=75909a5f5ae074da5a636889c080b446ba687fec;p=lilypond.git

patch::: 0.0.68pre.jcn1: Re: patsen?

pl 67.jcn3
	- rests under beam [c8 r c]

pl 67.jcn2
	- first attempt at rest collisions
	- rests.ly

pl 67.jcn1
	- beam stem length: beams.ly
	- bf: mingw configure
	- re: conflily
---

diff --git a/.version b/.version
index f39dbaa0d9..4bbb128a6d 100644
--- a/.version
+++ b/.version
@@ -4,4 +4,4 @@ TOPLEVEL_PATCH_LEVEL = 68
 # use to send patches, always empty for released version:
 # include separator: ".postfix", "-pl" makes rpm barf
 
-TOPLEVEL_MY_PATCH_LEVEL = pre
+TOPLEVEL_MY_PATCH_LEVEL =pre.jcn1
diff --git a/ANNOUNCE b/ANNOUNCE
index 003b4845c9..db7636e52b 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -24,7 +24,12 @@ least) Janneke!
 
 	HW
 
-[misschien wat monieks invoegen?]
+	That's a nice thought, Wendy.  I've got a few too, to spread
+the credits a bit (Again, no particular order) Michelle, Illushka, 
+Ruth, Eva, Fro/ydis, Monique, Noor, Sascha, Monique, Ilse, Monique, 
+Eva, Roos, Judith, and, of course, Wendy!
+
+	JCN
 
 **************************
 
diff --git a/NEWS b/NEWS
index fe3edf293f..7f2e534581 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,15 @@
+pl 67.jcn3
+	- rests under beam [c8 r c]
+
+pl 67.jcn2
+	- first attempt at rest collisions
+	- rests.ly
+
+pl 67.jcn1
+	- beam stem length: beams.ly
+	- bf: mingw configure
+	- re: conflily
+
 pl 68
 	- doco: other-packages.pod, lots of lilyliterature.pod
 	- last duration mode now is default.
@@ -28,6 +40,10 @@ pl 68
 
 ******
 june 3
+
+pl 67.wl1
+	- damped beamslope after wanske
+
 pl 67
 	- sketch of Music classes
 	- General_script_def as baseclass for Text_def and Script_def
diff --git a/TODO b/TODO
index f7a191fe75..f39f9c8491 100644
--- a/TODO
+++ b/TODO
@@ -140,6 +140,8 @@ BUGS
 
 	* lilypond - -> crash
 
+	* scales.ly
+
 	* standchen triool beam up/down
 	
 	* (where are the) gcc compile warnings on linux
diff --git a/bin/Makefile b/bin/Makefile
index ad9f6bb05b..cf07dbbc41 100644
--- a/bin/Makefile
+++ b/bin/Makefile
@@ -8,7 +8,8 @@ include $(depth)/make/Include.make
 
 SCRIPTS = clearlily cpgento genheader make_patch \
 	lily.efence\
-	make_version make_website release convert-mudela show-latest
+	make_version make_website release convert-mudela show-latest \
+	conflily
 EXTRA_DISTFILES = $(SCRIPTS)
 #
 
diff --git a/bin/conflily b/bin/conflily
new file mode 100644
index 0000000000..a7e86b127a
--- /dev/null
+++ b/bin/conflily
@@ -0,0 +1,28 @@
+#!/bin/bash
+# conflily
+# ugh: must be executed from lilypond-x.x.x (bin/conflily)
+
+root=$HOME
+lelie=music/lily
+
+if [ ! -e $root/lelie ]
+then
+	echo ln -s $root/$lelie/current $root/lelie
+	ln -s $root/$lelie/current $root/lelie
+fi
+
+rm $root/$lelie/current >& /dev/null
+current=`basename \`pwd\``
+echo ln -s $root/$lelie/$current $root/$lelie/current
+ln -s $root/$lelie/$current $root/$lelie/current
+
+ln -sf $root/lelie/lily/out/lilypond bin/lilypond
+ln -sf $root/lelie/mi2mu/out/mi2mu bin/mi2mu
+
+if [ "x$LILYINCLUDE" = "x" ]
+then
+	export LILYINCLUDE=$root/lelie/init
+fi
+
+configure --prefix=$HOME --enable-debugging --enable-printing --enable-checking
+
diff --git a/configure.in b/configure.in
index dbaf1cd095..9cffeaeae8 100644
--- a/configure.in
+++ b/configure.in
@@ -107,7 +107,7 @@ AC_ARG_ENABLE(profiling,
 AC_ARG_ENABLE(mingw32,
     [  mingw-prefix=DIR        set the mingw32 directory (standalone windows32 exes)],
     [MINGWPREFIX=$enableval],
-    [MINGWPREFIX=$enableval])
+    [MINGWPREFIX=no])
     
 AC_ARG_ENABLE(tex-prefix,
     [  tex-prefix=DIR          set the tex-directory to find TeX subdirectories. (default: PREFIX)],
diff --git a/init/table_sixteen.ini b/init/table_sixteen.ini
index b331826f55..7f1ced6c03 100644
--- a/init/table_sixteen.ini
+++ b/init/table_sixteen.ini
@@ -97,7 +97,7 @@ table_sixteen=
 
      "bars" = \table {
 	"empty"	"\emptybar"
-	"|"	"\maatstreep"		0.0\pt	0.4\pt 	-8.0\pt	8.0\pt
+	"|"	"\maatstreep"		0.0\pt	0.64\pt -8.0\pt	8.0\pt
 	"||"	"\doublebar"		0.0\pt	4.0\pt	-8.0\pt	8.0\pt
 	"|."	"\finishbar"		-4.0\pt	0.0\pt	-8.0\pt	8.0\pt
 	":|"	"\repeatbar"		-4.0\pt	0.0\pt	-8.0\pt	8.0\pt
diff --git a/input/beams.ly b/input/beams.ly
new file mode 100644
index 0000000000..24753a131d
--- /dev/null
+++ b/input/beams.ly
@@ -0,0 +1,69 @@
+%{MudelaHeader
+
+ filename: beams.ly
+ title: 
+ description: 
+ composer(s): heu
+ entered-by: jcn
+ copyright: GPL
+
+ Tested Features: beams and beamflags
+EndMudelaHeader
+%}
+
+\score{
+	\staff{ \inputregister{melodicregs}
+		\melodic{ \octave c'; 
+			\meter 8/4;
+			\duration8;
+			\stem 1; [c c'' a' f']
+			\duration16;
+			\stem 1; [c c'' a' f']
+			\duration32;
+			\stem 1; [c c'' a' f']
+			\duration64;
+			\stem 1; [c c'' a' f']
+			\duration128;
+			\stem 1; [c c'' a' f']
+
+			\duration 8;
+			\stem 1; ['g 'g 'g 'g]
+			\duration 16;
+			\stem 1; ['g 'g 'g 'g]
+			\duration 32;
+			\stem 1; ['g 'g 'g 'g]
+			\duration 64;
+			\stem 1; ['g 'g 'g 'g]
+			\duration 128;
+			\stem 1; ['g 'g 'g 'g]
+		}
+	}
+	\staff{ \inputregister{melodicregs}
+		\melodic{ \octave c'; 
+			\meter 8/4;
+			\duration8;
+			\stem -1; [a' 'a c e]
+			\duration16;
+			\stem -1; [a' 'a c e]
+			\duration32;
+			\stem -1; [a' 'a c e]
+			\duration64;
+			\stem -1; [a' 'a c e]
+			\duration128;
+			\stem -1; [a' 'a c e]
+
+			\octave c;
+			\duration 8;
+			\stem -1; [d'' d'' d'' d'']
+			\duration 16;
+			\stem -1; [d'' d'' d'' d'']
+			\duration 32;
+			\stem -1; [d'' d'' d'' d'']
+			\duration 64;
+			\stem -1; [d'' d'' d'' d'']
+			\duration 128;
+			\stem -1; [d'' d'' d'' d'']
+		}
+	}
+	\paper{}
+}
diff --git a/input/rests.ly b/input/rests.ly
new file mode 100644
index 0000000000..a8a7a0ba9f
--- /dev/null
+++ b/input/rests.ly
@@ -0,0 +1,42 @@
+%{MudelaHeader
+
+ filename: rests.ly
+ title: 
+ description: 
+ composer(s): heu
+ entered-by: jcn
+ copyright: GPL
+
+ Tested Features: rest collisions
+EndMudelaHeader
+%}
+
+\score{
+	\staff{ \inputregister{melodicregs}
+		\melodic{ 
+			\meter 4/4;
+			\octave c'; 
+			< \multivoice 
+				{ \stem 1;  g' f' e' d' c' b a g f e d c }
+				{ \stem -1; r  r  r  r  r  r r r r r r r }
+			>
+			< \multivoice 
+				{ \stem 1;  r r r r r r r r  r  r  r  r }
+				{ \stem -1; c d e f g a b c' d' e' f' g' }
+			>
+			r8
+			< \multivoice r8 r8 >
+			< \multivoice r8 r8 r8 >
+			< \multivoice r8 r8 r8 r8 >
+			< \multivoice r r >
+			< \multivoice r r r >
+			\stem 1;
+			[c''8 r8 c''8 c''8]
+			[c8 r8 c8 c8]
+			\stem -1;
+			[c8 r8 c8 c8]
+			[c''8 r8 c''8 c''8]
+		}
+	}
+	\paper{}
+}
diff --git a/lily/.version b/lily/.version
index 779974957f..f8c8298f3a 100644
--- a/lily/.version
+++ b/lily/.version
@@ -4,4 +4,4 @@ PATCH_LEVEL = 68
 # use to send patches, always empty for released version:
 # include separator: ".postfix", "-pl" makes rpm barf
 
-MY_PATCH_LEVEL = pre
+MY_PATCH_LEVEL =pre.jcn1
diff --git a/lily/beam.cc b/lily/beam.cc
index cf2eb652a8..d0b0079692 100644
--- a/lily/beam.cc
+++ b/lily/beam.cc
@@ -33,11 +33,11 @@
 
 struct Stem_info {
     Real x;
-    Real idealy;
-    Real miny;
-    int no_beams;
+    int dir_i_;
+    Real idealy_f_;
+    Real miny_f_;
+    int beams_i_;
 
-    
     Stem_info(){}
     Stem_info(Stem const *);
 };
@@ -45,17 +45,52 @@ struct Stem_info {
 Stem_info::Stem_info(Stem const *s)
 {
     x = s->hpos_f();
-    int dir = s->dir_i_;
-    idealy  = dir * s->stem_end_f();
-    miny = dir * s->stem_start_f() + 2;	// ugh
-    assert(miny <= idealy);
+    dir_i_ = s->dir_i_;
+    beams_i_ = intlog2( s->flag_i_ ) - 2;
+
+    /*
+     [todo] 
+         * get algorithm
+	 * runtime
+
+     Breitkopf + H\"artel:
+         miny_f_ = interline + #beams * interbeam
+	 ideal8 = 2 * interline + interbeam
+	 ideal16,32,64,128 = 1.5 * interline + #beams * interbeam
+
+     * B\"arenreiter:
+         miny_f_ = interline + #beams * interbeam
+	 ideal8,16 = 2 interline + #beams * interbeam
+	 ideal32,64,128 = 1.5 interline + #beams * interbeam
+         
+     */
+
+    Real notehead_y = s->paper()->interline_f();
+    // huh? why do i need the / 2
+//    Real interbeam_f = s->paper()->interbeam_f();
+    Real interbeam_f = s->paper()->interbeam_f() / 2;
+    Real interline_f = s->paper()->interline_f();
+           
+    /* well eh, huh?
+    idealy_f_  = dir_i_ * s->stem_start_f() + beams_i_ * interbeam_f; 
+    if ( beams_i_ < 3 )
+	idealy_f_ += 2 * interline_f;
+    else
+	idealy_f_ += 1.5 * interline_f;
+    */
+
+    idealy_f_  = dir_i_ * s->stem_end_f();
+
+    miny_f_ = dir_i_ * s->stem_start_f() + notehead_y + beams_i_ * interbeam_f;
+
+    idealy_f_ =  miny_f_ >? idealy_f_;
+//    assert(miny_f_ <= idealy_f_);
 }
 
 
 /* *************** */
 
 
-
 Offset
 Beam::center()const
 {
@@ -133,14 +168,14 @@ Beam::solve_slope()
     Least_squares l;
     for (int i=0; i < sinfo.size(); i++) {
 	sinfo[i].x -= leftx;
-	l.input.push(Offset(sinfo[i].x, sinfo[i].idealy));
+	l.input.push(Offset(sinfo[i].x, sinfo[i].idealy_f_));
     }
 
     l.minimise(slope, left_pos);
     Real dy = 0.0;
     for (int i=0; i < sinfo.size(); i++) {
 	Real y = sinfo[i].x * slope + left_pos;
-	Real my = sinfo[i].miny;
+	Real my = sinfo[i].miny_f_;
 
 	if (my - y > dy)
 	    dy = my -y;	
@@ -235,7 +270,8 @@ Beam::stem_beams(Stem *here, Stem *next, Stem *prev)const
 {
     assert( !next || next->hpos_f() > here->hpos_f()  );
     assert( !prev || prev->hpos_f() < here->hpos_f()  );
-    Real dy=paper()->internote_f()*2;
+//    Real dy=paper()->internote_f()*2;
+    Real dy = paper()->interbeam_f();
     Real stemdx = paper()->rule_thickness();
     Real sl = slope*paper()->internote_f();
     paper()->lookup_l()->beam(sl, 20 PT);
@@ -293,9 +329,15 @@ Beam::stem_beams(Stem *here, Stem *next, Stem *prev)const
 Molecule*
 Beam::brew_molecule_p() const 
 {
-    Molecule *out=0;
-    Real inter=paper()->internote_f();
-    out = new Molecule;
+    /*
+      [todo]
+      the y of the (start) of the beam should be quantisized,
+      so that no stafflines appear just in between two beam-flags
+     */
+    Molecule *mol_p = new Molecule;
+    // huh? inter-what
+//    Real inter_f = paper()->interbeam_f();
+    Real inter_f = paper()->internote_f();
     Real x0 = stems[0]->hpos_f();
     for (int j=0; j <stems.size(); j++) {
 	Stem *i = stems[j];
@@ -304,11 +346,11 @@ Beam::brew_molecule_p() const
 
 	Molecule sb = stem_beams(i, next, prev);
 	Real  x = i->hpos_f()-x0;
-	sb.translate(Offset(x, (x * slope  + left_pos)* inter));
-	out->add(sb);
+	sb.translate(Offset(x, (x * slope  + left_pos)* inter_f));
+	mol_p->add(sb);
     }
-    out->translate_x(x0 - left_col_l_->hpos);
-    return out;
+    mol_p->translate_x(x0 - left_col_l_->hpos);
+    return mol_p;
 }
 
 IMPLEMENT_STATIC_NAME(Beam);
diff --git a/lily/include/beam.hh b/lily/include/beam.hh
index 01726c57df..9a729a5da9 100644
--- a/lily/include/beam.hh
+++ b/lily/include/beam.hh
@@ -27,7 +27,6 @@ public:
     NAME_MEMBERS();
     Beam();
     void add(Stem*);
-    
 
     void set_grouping(Rhythmic_grouping def, Rhythmic_grouping current);
     void set_stemlens();
diff --git a/lily/include/lookup.hh b/lily/include/lookup.hh
index 0a0921efce..b41306315f 100644
--- a/lily/include/lookup.hh
+++ b/lily/include/lookup.hh
@@ -21,6 +21,7 @@ struct Lookup {
     void add(String, Symtable*);
     void print()const;
     Real internote_f()const;
+    Real interbeam_f()const;
 
     Symbol linestaff(int n, Real w)const;
     Symbol fill(Box b)const;
diff --git a/lily/include/paper-def.hh b/lily/include/paper-def.hh
index 2ce328406b..21423cf5bc 100644
--- a/lily/include/paper-def.hh
+++ b/lily/include/paper-def.hh
@@ -49,6 +49,8 @@ public:
     void set(Lookup*);
     ~Paper_def();
     Paper_def(Paper_def const&);
+    /// The distance between beams
+    Real interbeam_f()const;
     /**
       The distance between lines
      */
diff --git a/lily/include/rest-collision-reg.hh b/lily/include/rest-collision-reg.hh
index b324fe245f..ecde3d6f96 100644
--- a/lily/include/rest-collision-reg.hh
+++ b/lily/include/rest-collision-reg.hh
@@ -18,6 +18,7 @@ class Rest_collision_register : public Request_register {
     Array< Collision *> collision_l_arr_;
 protected:
     virtual void acknowledge_element(Score_elem_info);
+    virtual void do_print() const;
     virtual void do_pre_move_processing();
 public:
     Rest_collision_register();
diff --git a/lily/include/rest-collision.hh b/lily/include/rest-collision.hh
index 8482d66882..1d698f859d 100644
--- a/lily/include/rest-collision.hh
+++ b/lily/include/rest-collision.hh
@@ -17,11 +17,14 @@ class Rest_collision : public Item {
     Link_array<Rest_column> rest_l_arr_;
     Link_array<Note_column> ncol_l_arr_;
 public:
+    void add(Note_column*);
     void add(Rest_column*);
     void add(Collision*);
     NAME_MEMBERS();
 protected:
     virtual void do_post_processing();
+    virtual void do_pre_processing();
+    virtual void do_print() const;
     virtual void do_substitute_dependency(Score_elem*,Score_elem*);
 };
 #endif // REST_COLLISION_HH
diff --git a/lily/include/rest-column.hh b/lily/include/rest-column.hh
index 4e54241d01..8c9e4b80f5 100644
--- a/lily/include/rest-column.hh
+++ b/lily/include/rest-column.hh
@@ -20,11 +20,14 @@ class Rest_column : public Script_column {
     Link_array<Note_head> head_l_arr_;
 public:
     int dir_i_;
+    Stem* stem_l_;
     void add(Note_head *);
+    void add(Stem *);
     NAME_MEMBERS();
     void translate_y(Real dy);
     Rest_column();
 protected:
+    virtual void do_print() const;
     virtual void do_substitute_dependency(Score_elem*, Score_elem*);
 };
 
diff --git a/lily/lookup.cc b/lily/lookup.cc
index dae5ad37b5..c38322fdf0 100644
--- a/lily/lookup.cc
+++ b/lily/lookup.cc
@@ -72,6 +72,23 @@ Lookup::internote_f() const
     return ball(4).dim.y.length()/2;
 }
 
+Real
+Lookup::interbeam_f() const
+{
+    /* 
+      [todo]
+         * runtime
+
+      "french" style: interbeam = intenote;
+      "german" style: interbeam = 2/3 * interline
+
+      as lily's style is currently german, we'll hardcode german style
+     */
+     // it seems that "interline" means _between_ lines
+//   return  ball(4).dim.y.length() * 2 / 3; 
+     return  ball(4).dim.y.length() * 2 / 3 + 0.4;  //ugh
+}
+
 Symbol
 Lookup::ball(int j) const
 {
diff --git a/lily/note-column-reg.cc b/lily/note-column-reg.cc
index 4dbf16f887..44142ac9a7 100644
--- a/lily/note-column-reg.cc
+++ b/lily/note-column-reg.cc
@@ -73,8 +73,12 @@ Note_column_register::do_pre_move_processing()
     for (int i=0; i < script_l_arr_.size(); i++)
 	col_l->add(script_l_arr_[i]);
     
-    if (ncol_p_&&stem_l_)
-	ncol_p_->add(stem_l_);
+    if (stem_l_) {
+	if (ncol_p_)
+	    ncol_p_->add(stem_l_);
+	if (restcol_p_)
+	    restcol_p_->add(stem_l_);
+    }
     if (restcol_p_) {
 	if (! restcol_p_ -> dir_i_)
 	    restcol_p_->dir_i_ = dir_i_;
diff --git a/lily/paper-def.cc b/lily/paper-def.cc
index 3691fabfd5..18158eba08 100644
--- a/lily/paper-def.cc
+++ b/lily/paper-def.cc
@@ -66,6 +66,11 @@ Paper_def::interline_f() const
     return lookup_p_->ball(4).dim.y.length();
 }
 
+Real
+Paper_def::interbeam_f() const
+{
+    return lookup_p_->interbeam_f();
+}
 Real
 Paper_def::internote_f() const
 {
diff --git a/lily/rest-collision-reg.cc b/lily/rest-collision-reg.cc
index 81b27a417a..259e33c949 100644
--- a/lily/rest-collision-reg.cc
+++ b/lily/rest-collision-reg.cc
@@ -6,12 +6,22 @@
   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
 */
 
+#include "debug.hh"
 #include "rest-collision.hh"
 #include "rest-collision-reg.hh"
 #include "collision.hh"
 #include "rest-column.hh"
 #include "note-column.hh"
 
+IMPLEMENT_STATIC_NAME(Rest_collision_register);
+IMPLEMENT_IS_TYPE_B1(Rest_collision_register, Request_register);
+ADD_THIS_REGISTER(Rest_collision_register);
+
+Rest_collision_register::Rest_collision_register()
+{
+    rest_collision_p_ =0;
+}
+
 void
 Rest_collision_register::acknowledge_element(Score_elem_info i)
 {
@@ -19,7 +29,13 @@ Rest_collision_register::acknowledge_element(Score_elem_info i)
     if (nC == Collision::static_name()) {
 	collision_l_arr_.push((Collision*)i.elem_l_->item());
     } 
-    else if (nC == Rest_column ::static_name()) {
+    else if (nC == Note_column::static_name()) {
+	// what should i do, what should _register do?
+	if (!rest_collision_p_)
+	    rest_collision_p_ = new Rest_collision;
+	rest_collision_p_->add((Note_column*)i.elem_l_->item());
+    }
+    else if (nC == Rest_column::static_name()) {
 	if (!rest_collision_p_)
 	    rest_collision_p_ = new Rest_collision;
 	rest_collision_p_->add((Rest_column*)i.elem_l_->item());
@@ -35,11 +51,12 @@ Rest_collision_register::do_pre_move_processing()
     }
 }
 
-Rest_collision_register::Rest_collision_register()
+void
+Rest_collision_register::do_print() const
 {
-    rest_collision_p_ =0;
+#ifndef NPRINT
+    mtor << "collisions: " << collision_l_arr_.size();
+    if ( rest_collision_p_ )
+	rest_collision_p_->print();
+#endif
 }
-
-IMPLEMENT_STATIC_NAME(Rest_collision_register);
-IMPLEMENT_IS_TYPE_B1(Rest_collision_register, Request_register);
-ADD_THIS_REGISTER(Rest_collision_register);
diff --git a/lily/rest-collision.cc b/lily/rest-collision.cc
index 368d47d574..7d219dc95c 100644
--- a/lily/rest-collision.cc
+++ b/lily/rest-collision.cc
@@ -6,16 +6,32 @@
   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
 */
 
+#include "debug.hh"
 #include "rest-collision.hh"
 #include "rest-column.hh"
+#include "note-column.hh"
+#include "stem.hh"
+#include "note-head.hh"
 #include "collision.hh"
+#include "paper-def.hh"
+
+IMPLEMENT_STATIC_NAME(Rest_collision);
+IMPLEMENT_IS_TYPE_B1(Rest_collision,Item);
+
+void
+Rest_collision::add(Note_column *nc_l)
+{
+    add_dependency(nc_l);
+    ncol_l_arr_.push(nc_l);
+}
 
 void
 Rest_collision::add(Rest_column *rc_l)
 {
-    rest_l_arr_.push(rc_l);
     add_dependency(rc_l);
+    rest_l_arr_.push(rc_l);
 }
+
 void
 Rest_collision::add(Collision * c_l)
 {
@@ -24,40 +40,108 @@ Rest_collision::add(Collision * c_l)
 	ncol_l_arr_.push(c_l->clash_l_arr_[i]);
 }
 
-
 void
 Rest_collision::do_post_processing()
 {
-#if 0
-        bool rest_b_a[4];
-	rest_b_a[j] = (col_l_a[j]) ? col_l_a[j]->rest_b_ : false;	
-    do {
-	int i1 = idx(d, false);
-	int i2 = idx(d,true);
-	if (!intersection(y_extent[i1] , 
-			  y_extent[i2]).empty_b()) {
-	    if (rest_b_a[i1]) {
-		y_off[i1] = -y_extent[i1][-d] + y_extent[1][d] + d*4; // ugh
-		y_extent[i1] += y_off[i1];
-	    }
-	}
-    } while ((d *= -1) != 1);
-
-    do {
-	int i1 = idx(d, false);
-	int i2 = idx(-d,false);
-	
-	if (d*(y_extent[i1][-d] - y_extent[i2][d] )< 0&& rest_b_a[i1]) {
-	    y_off[i1] = -y_extent[i1][-d] + y_extent[i2][d] +d* 4; // ugh
-	    y_extent[i1] += y_off[i1];
+    /*
+      handle rest under beam (do_post: beams are calculated now)
+
+      [todo]
+      i-d like to have access to the beam itself, 
+      iso only the (half-initialised?) stem
+
+      what about combination of collisions and rest under beam
+     */
+
+    // no rests to collide
+    if (!rest_l_arr_.size())
+    	return;
+    // can this happen?
+    Stem* stem_l = rest_l_arr_[0]->stem_l_;
+    if (!stem_l)
+    	return;
+    // no beam
+    if (!(stem_l->beams_left_i_ || stem_l->beams_right_i_))
+    	return;
+
+    Real inter_f = paper()->internote_f();
+    int dir_i = rest_l_arr_[0]->dir_i_;
+    int midpos = 4;
+#if 1
+    // ugh
+    int stem_length_i = 7 - 2;
+    // ugh, Stem::stem_start vs Stem::stem_end
+    int pos = (stem_l->stem_end_f() - midpos) - dir_i * stem_length_i;
+#else // nogo: stem_start not set for rests?
+    int pos = (stem_l->stem_start_f() - midpos) + dir_i * 2;
+#endif
+    Real dy = pos * inter_f;
+    rest_l_arr_[0]->translate_y(dy);	
+}
+
+void
+Rest_collision::do_pre_processing()
+{
+    /* 
+      handle rest-rest and rest-note collisions
+
+      [todo]
+      decide not to print rest if too crowded?
+     */
+
+    // no rests to collide
+    if (!rest_l_arr_.size())
+    	return;
+
+    // no partners to collide with
+    if (rest_l_arr_.size() + ncol_l_arr_.size() < 2 )
+	return;
+
+    Real inter_f = paper()->internote_f();
+
+    // meisjes met meisjes
+    if (!ncol_l_arr_.size()) {
+	Real dy = rest_l_arr_.size() > 2 ? 6 * inter_f : 4 * inter_f;
+	rest_l_arr_[0]->translate_y(dy);	
+	// top is last element...
+	rest_l_arr_.top()->translate_y(-dy);	
+    }
+    // meisjes met jongetjes
+    else {
+#if 0 // breendet: rests go always under
+	// geen gemug, trug op je rug
+	int dir_i = -1;
+	rest_l_arr_[0]->translate_y(dir_i * 3 * inter_f);	
+#else
+	// int dir_i = - ncol_l_arr_[0]->dir_i_;
+	int dir_i = rest_l_arr_[0]->dir_i_;
+	// hope it's 4: if it works->doco
+	int midpos = 4;
+	// minimum move
+	int minpos = 4;
+	// quart rest height
+	int size_i = 6;
+	int sep_i = 3 + size_i / 2;
+	for (int i = 0; i < ncol_l_arr_.size(); i++) {
+	    // how to know whether to sort?
+	    ncol_l_arr_[i]->sort();
+	    for ( int j = 0; j < ncol_l_arr_[i]->head_l_arr_.size(); j++ )
+		minpos = minpos >? dir_i * ( ncol_l_arr_[i]->head_l_arr_[j]->position_i_ - midpos ) + sep_i;
 	}
-    } while ((d *= -1) != 1);
-    
+	Real dy = dir_i * minpos * inter_f;
+	rest_l_arr_[0]->translate_y(dy);	
 #endif
+    }
 }
-IMPLEMENT_STATIC_NAME(Rest_collision);
-IMPLEMENT_IS_TYPE_B1(Rest_collision,Item);
 
+void
+Rest_collision::do_print() const
+{
+#ifndef NPRINT
+    mtor << "rests: " << rest_l_arr_.size() << ", ";
+    mtor << "cols: " << ncol_l_arr_.size();
+#endif
+}
 
 void
 Rest_collision::do_substitute_dependency(Score_elem*o,Score_elem*n)
diff --git a/lily/rest-column.cc b/lily/rest-column.cc
index 39cd296b85..df4bd98846 100644
--- a/lily/rest-column.cc
+++ b/lily/rest-column.cc
@@ -6,10 +6,20 @@
   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
 */
 
+#include "debug.hh"
 #include "rest-column.hh"
 #include "note-head.hh"
 #include "rest-column.hh"
+#include "stem.hh"
 
+IMPLEMENT_STATIC_NAME(Rest_column);
+IMPLEMENT_IS_TYPE_B1(Rest_column,Item);
+
+Rest_column::Rest_column()
+{
+    dir_i_ = 0;
+}
+    
 void
 Rest_column::add(Note_head *n_l)
 {
@@ -18,20 +28,19 @@ Rest_column::add(Note_head *n_l)
 }
 
 void
-Rest_column::translate_y(Real dy_f)
+Rest_column::add(Stem*stem_l)
 {
-    for (int i=0; i < head_l_arr_.size(); i++)
-	head_l_arr_[i]->translate_y(dy_f);
+    stem_l_ = stem_l;
+//    add_support(stem_l);
 }
 
-IMPLEMENT_STATIC_NAME(Rest_column);
-IMPLEMENT_IS_TYPE_B1(Rest_column,Item);
-
-Rest_column::Rest_column()
+void
+Rest_column::do_print() const
 {
-    dir_i_ = 0;
+#ifndef NPRINT
+    mtor << "heads: " << head_l_arr_.size();
+#endif
 }
-    
 
 void
 Rest_column::do_substitute_dependency(Score_elem*o,Score_elem*n)
@@ -42,3 +51,10 @@ Rest_column::do_substitute_dependency(Score_elem*o,Score_elem*n)
 				(n)? (Note_head*)n->item() : 0);
     }
 }
+
+void
+Rest_column::translate_y(Real dy_f)
+{
+    for (int i=0; i < head_l_arr_.size(); i++)
+	head_l_arr_[i]->translate_y(dy_f);
+}
diff --git a/lily/stem.cc b/lily/stem.cc
index d41d96f9c3..00b7423a2b 100644
--- a/lily/stem.cc
+++ b/lily/stem.cc
@@ -59,7 +59,6 @@ Stem::do_print() const
 {
 #ifndef NPRINT
     mtor << "flag "<< flag_i_ << " print_flag_b_ " << print_flag_b_;
-
 #endif
 }
 
diff --git a/mi2mu/include/mi2mu.hh b/mi2mu/include/mi2mu.hh
index a7e877f301..493b2c76cd 100644
--- a/mi2mu/include/mi2mu.hh
+++ b/mi2mu/include/mi2mu.hh
@@ -27,7 +27,10 @@
 #undef mtor
 #endif
 
-#define MVOICE_LIST
+// arrays are 20% faster, but we have no Pointer_array yet
+#define MVOICE_LIST  // does this work?
+#define MEVENT_LIST
+#define TCOL_LIST
 
 #include "string.hh"
 #include "string-convert.hh"
diff --git a/mi2mu/include/midi-track.hh b/mi2mu/include/midi-track.hh
index 61022327c3..c25d65831b 100644
--- a/mi2mu/include/midi-track.hh
+++ b/mi2mu/include/midi-track.hh
@@ -49,13 +49,11 @@ private:
 	void output_mudela_rest_remain( Lily_stream& lily_stream_r, Moment mom );
 
 #ifdef TCOL_LIST
-#warning using track_column list
 	Pointer_list<Track_column*> tcol_p_list_;
 #else
 	Array<Track_column*> tcol_p_array_;
 #endif
 #ifdef MVOICE_LIST
-#warning using midi_voice list
 	Pointer_list<Midi_voice*> midi_voice_p_list_;
 #else
 	Array<Midi_voice*> midi_voice_p_array_;
diff --git a/mi2mu/include/midi-voice.hh b/mi2mu/include/midi-voice.hh
index 8360af08e4..cc3e023152 100644
--- a/mi2mu/include/midi-voice.hh
+++ b/mi2mu/include/midi-voice.hh
@@ -22,7 +22,6 @@ private:
 	Moment end_mom_;
 	Moment begin_mom_;
 #ifdef MEVENT_LIST
-#error using list
 	Pointer_list<Midi_event*> midi_event_p_list_;
 #else
 	Array<Midi_event*> midi_event_p_array_;
diff --git a/mi2mu/include/track-column.hh b/mi2mu/include/track-column.hh
index 6c0630883b..4d5f647a61 100644
--- a/mi2mu/include/track-column.hh
+++ b/mi2mu/include/track-column.hh
@@ -16,7 +16,6 @@ public:
 
 //private:
 #ifdef MEVENT_LIST
-#error using list
 	Pointer_list<Midi_event*> midi_event_p_list_;
 #else
 	Array<Midi_event*> midi_event_p_array_;
diff --git a/mi2mu/midi-track.cc b/mi2mu/midi-track.cc
index 8d1c7833e4..10cd36d291 100644
--- a/mi2mu/midi-track.cc
+++ b/mi2mu/midi-track.cc
@@ -14,7 +14,6 @@ Midi_track::Midi_track( int number_i, String copyright_str, String track_name_st
 	midi_time_p_ = new Midi_time( 4, 2, 24, 8 );
 	midi_tempo_p_ = new Midi_tempo( 1000000 );
 #ifdef TCOL_LIST
-#error doing list!
 	tcol_p_list_.bottom().add( new Track_column( Moment( 0 ) ) );
 #else
 	tcol_p_array_.push( new Track_column( Moment( 0 ) ) );
@@ -141,14 +140,12 @@ Midi_track::next_begin_mom( Moment now_mom )
 	Moment begin_mom = Midi_track::end_mom();
 #ifdef MVOICE_LIST
 	for ( PCursor<Midi_voice*> i( midi_voice_p_list_.top() ); i.ok(); i++ )
-//		if ( i->begin_mom() >= now_mom )// well, which one ? 
 		if ( i->begin_mom() > now_mom )
 			begin_mom = begin_mom <? i->begin_mom();
 #else
 	for ( int i = 0; i < midi_voice_p_array_.size(); i++ )
-		if ( midi_voice_p_array_[ i ]->begin_mom() >= now_mom ) // well, which one ?
 		if ( midi_voice_p_array_[ i ]->begin_mom() > now_mom )
-//			begin_mom = begin_mom <? midi_voice_p_array_[ i ]->begin_mom();
+			begin_mom = begin_mom <? midi_voice_p_array_[ i ]->begin_mom();
 #endif
 	return begin_mom;
 }
@@ -163,7 +160,6 @@ Midi_track::next_end_mom( Moment now_mom )
 			end_mom = end_mom <? i->end_mom();
 #else
 	for ( int i = 0; i < midi_voice_p_array_.size(); i++ ) 
-//		if ( midi_voice_p_array_[ i ]->end_mom() >= now_mom )
 		if ( midi_voice_p_array_[ i ]->end_mom() > now_mom )
 			end_mom = end_mom <? midi_voice_p_array_[ i ]->end_mom();
 #endif
@@ -444,7 +440,6 @@ void
 Midi_track::remove_end_at( Link_list<Midi_voice*>& open_voices_r, Moment mom )
 {
 	for ( PCursor<Midi_voice*> i( open_voices_r.top() ); i.ok(); i++ )
-//		if ( i->end_mom() == mom ) { }
 		if ( i->end_mom() <= mom ) {
 			tor( DEBUG_ver ) << "open_voices (" << open_voices_r.size() << "): -1\n";
 			i.remove_p();