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

index 2fbb0d80187447ffaa0b6d89722abac13a45ae76..53c64fed95e50568ce17fdf1d9630bf81668eb28 100644 (file)
@@ -76,7 +76,6 @@ Collision::do_pre_processing()
     Note_column * col_l_a[4];
     Real x_off [4];
     int y_off[4];
-    bool rest_b_a[4];
     
     for (int j =0 ; j < 4; j++) {
        if (clash_group_arr_a[j].size()) 
@@ -88,7 +87,7 @@ Collision::do_pre_processing()
            y_extent[j] = col_l_a[j]->head_positions_interval();
        }
 
-       rest_b_a[j] = (col_l_a[j]) ? col_l_a[j]->rest_b_ : false;       
+
        x_off [j] = 0.0;
        y_off[j] = 0;
     }
@@ -97,28 +96,8 @@ Collision::do_pre_processing()
        x_off[idx(d, true)] = d*0.5;
     } while ((d *= -1) != 1);
 
-   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];
-       }
-    } while ((d *= -1) != 1);
-    
     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);
     do{
@@ -127,12 +106,10 @@ Collision::do_pre_processing()
     } while ((d *= -1) != 1);
    
     if (!middle.empty_b() && 
-       middle.length() <= 1 && col_l_a[idx(1,0)] && col_l_a[idx(-1,0)]
-       && !rest_b_a[idx(1,0)] && !rest_b_a[idx(-1,0)]) {
-       
+       middle.length() <= 1 && col_l_a[idx(1,0)] && col_l_a[idx(-1,0)]) {      
        Notehead * nu_l= col_l_a[idx(1,0)]->head_l_arr_[idx(1,0)];
        Notehead * nd_l = col_l_a[idx(-1,0)]->head_l_arr_[idx(1,0)];
-       if (! (nu_l->balltype == nd_l->balltype && nu_l->dots == nd_l->dots)) {
+       if (! (nu_l->balltype_i_ == nd_l->balltype_i_ && nu_l->dots_i_ == nd_l->dots_i_)) {
            x_off[idx(1,0)] -= 0.5;
            x_off[1] -= 0.5;
            x_off[2] += 0.5;
index 9dbc4f93ddd454294c9929d5bf0e82cc3d60e290..d3daf57a2c0e3f6afbca716965f39af363ab3390 100644 (file)
@@ -18,134 +18,23 @@ IMPLEMENT_STATIC_NAME(Note_column);
 void
 Note_column::add(Stem*stem_l)
 {
-    assert(!stem_l_);
-    stem_l_ = stem_l;
-    add_dependency(stem_l);
+    add_support(stem_l);
 }
 
 void
 Note_column::add(Notehead* n_l)
 {
-    if (head_l_arr_.size()){
-       if (n_l->rest_b_ != rest_b_) return; // ugly fix. Should think about integrating rests into colunms.
-    } else
-       rest_b_ = n_l->rest_b_;
-    
+    assert(!n_l->rest_b_);
     head_l_arr_.push(n_l);
-    add_dependency(n_l);
-}
-
-void
-Note_column::add(Script*s_l)
-{
-    script_l_arr_.push(s_l);
-    add_dependency(s_l);
-}
-
-void
-Note_column::translate(Offset o)
-{
-    for (int i=0; i < head_l_arr_.size(); i++)
-       head_l_arr_[i]->translate(o);
-    for (int i=0; i < script_l_arr_.size(); i++) 
-       script_l_arr_[i]->translate(o);
-    if (stem_l_)
-       stem_l_->translate(o);
-}
-
-
-void
-Note_column::do_print()const
-{
-    mtor << "heads: " << head_l_arr_.size() << '\n'; 
-    mtor << "scripts: " << script_l_arr_.size() << '\n'; 
-}
-
-Interval
-Note_column::do_height()const return r
-{
-    if (stem_l_)
-        r.unite(stem_l_->height());
-    for (int i=0; i < head_l_arr_.size(); i++)
-       r.unite(head_l_arr_[i]->height());
-    for (int i=0; i < script_l_arr_.size(); i++) 
-       r.unite(script_l_arr_[i]->height());
-}
-
-Interval
-Note_column::do_width()const return r;
-{
-    if (stem_l_)
-        r.unite(stem_l_->width());
-    for (int i=0; i < head_l_arr_.size(); i++)
-       r.unite(head_l_arr_[i]->width());
-    for (int i=0; i < script_l_arr_.size(); i++) 
-       r.unite(script_l_arr_[i]->width());
-}
-
-void
-Note_column::do_pre_processing()
-{
-    if (stem_l_ && !dir_i_)
-       dir_i_ = stem_l_->dir_i_;
-    
-    if (!script_l_arr_.size()) 
-       return;
-
-    Array<Script*> placed_l_arr_a[4];
-    for (int i=0; i < script_l_arr_.size(); i++) {
-       Script*s_l = script_l_arr_[i];
-       int j = (s_l->dir_i_ >0) ? 0 : 2;
-       if (!s_l->inside_staff_b_) 
-           j ++;
-       
-       placed_l_arr_a[j].push(s_l);
-    }
-    for (int j =0; j <4; j++) {
-       placed_l_arr_a[j].sort( Script::compare);
-    }
-    
-    Notehead *top_head_l=0;
-    Notehead *bot_head_l=0;
-    for (int i=0; i< head_l_arr_.size(); i++) {
-       if (head_l_arr_[i]->extremal == -1)
-           bot_head_l = head_l_arr_[i];
-       else if (head_l_arr_[i]->extremal == 1)
-           top_head_l = head_l_arr_[i];
-    }
-    /* argh. This sux. */
-    if (!top_head_l) 
-       top_head_l = bot_head_l;
-    if (!bot_head_l) 
-       bot_head_l = top_head_l;
-    //assert(bot_head_l && top_head_l);
-    Item *support_l=top_head_l;
-    int j;
-    for (j = 0; j < 2; j++ ) {
-       for (int i=0; i < placed_l_arr_a[j].size(); i++) {
-           if (support_l)
-               placed_l_arr_a[j][i]->add_support(support_l);
-           support_l = placed_l_arr_a[j][i];
-       }
-    }
-    
-    support_l=bot_head_l;
-    for (; j < 4; j++ ) {
-       for (int i=0; i < placed_l_arr_a[j].size(); i++) {
-           if (support_l)
-               placed_l_arr_a[j][i]->add_support(support_l);
-           support_l = placed_l_arr_a[j][i];
-       }
-    }
+    add_support(n_l);
 }
 
 Note_column::Note_column()
 {
     h_shift_b_ =false;
-    stem_l_ =0;
-    rest_b_ = false;
     dir_i_ =0;
 }
+
 void
 Note_column::sort()
 {
@@ -156,7 +45,7 @@ Interval_t<int>
 Note_column::head_positions_interval()const
 {
     (    (Note_column*)this)->sort();
-    return Interval_t<int> ( head_l_arr_[0]->position, 
-                            head_l_arr_.top()->position);
+    return Interval_t<int> ( head_l_arr_[0]->position_i_
+                            head_l_arr_.top()->position_i_);
 
 }