]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.45
authorfred <fred>
Sun, 24 Mar 2002 19:36:55 +0000 (19:36 +0000)
committerfred <fred>
Sun, 24 Mar 2002 19:36:55 +0000 (19:36 +0000)
lily/p-col.cc
lily/p-score.cc

index caaf26476697e8ca4489cd2569d9ee9bb4d46850..3ace8fba82341f3a0d35ffd87020385919d118f3 100644 (file)
@@ -18,6 +18,7 @@ PCol::width() const
 int
 PCol::rank() const
 {
+#if 0
     if(!pscore_l_)
        return -1;
     PCursor<PCol*> me=pscore_l_->find_col( (PCol*)this);
@@ -25,6 +26,19 @@ PCol::rank() const
        return -1;
     PCursor<PCol*> bot(pscore_l_->cols.top());
     return me - bot;
+#endif
+    assert(rank_i_ != -1);
+    return rank_i_;
+}
+
+void
+PCol::set_rank(int i)
+{
+    rank_i_ = i;
+    if (prebreak_p_)
+       prebreak_p_->rank_i_ = i;
+    if (postbreak_p_)
+       postbreak_p_->rank_i_ = i;
 }
 
 void
@@ -34,7 +48,7 @@ PCol::print() const
     mtor << "PCol {";
 
     if (rank() >= 0)
-       mtor << "rank: " << rank() << '\n';
+       mtor << "rank: " << rank_i_ << '\n';
 
     mtor << "# symbols: " << its.size() ;
     if (breakable_b()){
@@ -54,11 +68,7 @@ PCol::print() const
 int
 PCol::compare(PCol const &c1, PCol const &c2)
 {
-    PScore*ps_l = c1.pscore_l_;
-    PCursor<PCol*> ac(ps_l->find_col(&c1));
-    PCursor<PCol*> bc(ps_l->find_col(&c2));
-    assert(ac.ok() && bc.ok());
-    return ac - bc;
+    return c1.rank() - c2.rank();
 }
 
 void
index 9e31523da1d60b8cee95c7c82ae8193a65f34935..800d3287cf5292a26a7c9cb04d95365f693e0988 100644 (file)
@@ -26,11 +26,15 @@ PScore::get_spacing(PCol*l, PCol*r)
 void
 PScore::clean_cols()
 {
+    int rank_i = 0;
     for (iter_top(cols,c); c.ok(); )
        if (!c->used_b()) {
            delete c.remove_p();
-       } else
+       } else {
+           c->set_rank(rank_i++);
            c++;
+       }
+    
 }
 
 
@@ -248,6 +252,7 @@ void
 PScore::process()
 {
     clean_cols();
+    
     *mlog << "Preprocessing ... " <<flush;
     preprocess();
     *mlog << "\nCalculating column positions ... " <<flush;