]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.65
authorfred <fred>
Sun, 24 Mar 2002 19:44:24 +0000 (19:44 +0000)
committerfred <fred>
Sun, 24 Mar 2002 19:44:24 +0000 (19:44 +0000)
lily/collision.cc
lily/include/note-column.hh

index 7e1f0988d7989671dad1021eb2a5d3c260157061..8f43ee4233b86f180dff743d78c4ca80638420dd 100644 (file)
@@ -1,14 +1,14 @@
 /*
   collision.cc -- implement Collision
 
-  source file of the LilyPond music typesetter
+  source file of the GNU LilyPond music typesetter
 
   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
 */
 #include "debug.hh"
 #include "collision.hh"
 #include "note-column.hh"
-#include "notehead.hh"
+#include "note-head.hh"
 #include "paper-def.hh"
 
 Collision::Collision()
@@ -21,7 +21,9 @@ Collision::add(Note_column* ncol_l)
     clash_l_arr_.push(ncol_l);
     add_dependency(ncol_l);
 }
-
+/**
+  should derive of Array.
+ */
 static 
 int idx(int dir, bool h_shift_b)
 {
@@ -105,26 +107,28 @@ Collision::do_pre_processing()
   
     // y_extent: smallest y-pos noteball interval containing all balls
     // 4 (0..3) groups: stem up/down; shift on/off; 
-    Interval_t<int> middle( y_extent[0].min(), y_extent[3].max());
-    Interval_t<int> open_middle( y_extent[3].max()+1, y_extent[0].min()-1);
+    Interval_t<int> middle( y_extent[idx(-1,0)].max(),
+                           y_extent[idx(1,0)].min() );
+    Interval_t<int> open_middle( y_extent[idx(-1,0)].max()+1, y_extent[idx(1,0)].min()-1);
     do{
        if (!open_middle.contains_b(y_extent[idx(d,true)]))
            x_off[idx(d, true)] = d *1.0 ;
     } while ((d *= -1) != 1);
    
-    if (!middle.empty_b() && 
-       middle.length() <= 2 && col_l_a[idx(1,0)] && col_l_a[idx(-1,0)]) {      
+    if (!middle.empty_b() 
+       && middle.length() < 2 && col_l_a[idx(1,0)] && col_l_a[idx(-1,0)]) {    
 // reproduction of bugfix at 3am ?
-       Notehead * nu_l= col_l_a[idx(1,0)]->head_l_arr_[0];
-       Notehead * nd_l = col_l_a[idx(-1,0)]->head_l_arr_.top();
-       if (! (nu_l->balltype_i_ == nd_l->balltype_i_ && nu_l->dots_i_ == nd_l->dots_i_)) {
+       Note_head * nu_l= col_l_a[idx(1,0)]->head_l_arr_[0];
+       Note_head * nd_l = col_l_a[idx(-1,0)]->head_l_arr_.top();
+       if (! (nu_l->balltype_i_ == nd_l->balltype_i_ && nu_l->dots_i_ == nd_l->dots_i_  && middle.length() == 0 )) {
            x_off[idx(1,0)] -= 0.5;
-           x_off[1] -= 0.5;
-           x_off[2] += 0.5;
+           x_off[idx(1,1)] -= 0.5;
+           x_off[idx(-1,1)] += 0.5;
            x_off[idx(-1,0)] += 0.5;
        }
+       
     }    
-    Real inter_f = paper()->internote();
+    Real inter_f = paper()->internote_f();
     Real wid_f = paper()->note_width();
     for (int j=0; j < 4; j++) {
        if (col_l_a[j])
@@ -135,3 +139,10 @@ Collision::do_pre_processing()
 }
 
 IMPLEMENT_STATIC_NAME(Collision);
+
+void
+Collision::do_substitute_dependency(Score_elem*o_l,Score_elem*n_l)
+{
+    clash_l_arr_.substitute((Note_column*)o_l->item(), 
+                           (Note_column*)(n_l?n_l->item():0));
+}
index b5af0185284e18a6bc6ed14b9d1352443548c155..32b1a18e11ba657e9a7a001a92831d9be9d6b03f 100644 (file)
@@ -1,7 +1,7 @@
 /*
   note-column.hh -- declare Note_column
 
-  source file of the LilyPond music typesetter
+  source file of the GNU LilyPond music typesetter
 
   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
 */
 /** a struct for treating a group of noteheads (noteheads, stem
   (chord) and scripts ) as a single entity.  */
 class Note_column : public Script_column {
-    void do_pre_processing();
+protected:
+    virtual void do_pre_processing();
+    virtual void do_substitute_dependency(Score_elem*,Score_elem*);
 public:
         /// link to the stem. For setting default direction
     Stem * stem_l_;
 
     bool h_shift_b_;
     
-    Array<Notehead*> head_l_arr_;
+    Link_array<Note_head> head_l_arr_;
     Interval_t<int> head_positions_interval()const;
 
     /** The relative position of the "voice" containing this
@@ -33,7 +35,7 @@ public:
         
     NAME_MEMBERS(Note_column);
     Note_column();
-    void add(Notehead *);
+    void add(Note_head *);
     void add(Stem *);
     void sort();
     void add(Script* s) { Script_column::add(s);}