]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/p-col.cc
release: 0.0.68pre
[lilypond.git] / lily / p-col.cc
index 3ace8fba82341f3a0d35ffd87020385919d118f3..f55ea2452b9520086d29141598b58acaaee6ea05 100644 (file)
@@ -1,6 +1,14 @@
+/*
+  p-col.cc -- implement PCol
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
 #include "p-col.hh"
 #include "p-score.hh"
-#include "p-staff.hh"
+
 #include "debug.hh"
 
 Interval
@@ -10,23 +18,27 @@ PCol::width() const
 
     for (iter_top(its,i); i.ok(); i++)
        w.unite(i->width());
-    if (w.empty())
+    if (w.empty_b())
        w.unite(Interval(0,0));
     return w;
 }
 
+void
+PCol::clean_breakable_items()
+{
+    if (!line_l_) {
+       for(iter(its.top(), j); j.ok(); ) {
+           j->unlink();
+           j.del();
+       }
+    }
+    if (prebreak_p_) prebreak_p_->clean_breakable_items();
+    if (postbreak_p_) postbreak_p_->clean_breakable_items();
+}
+
 int
-PCol::rank() const
+PCol::rank_i() const
 {
-#if 0
-    if(!pscore_l_)
-       return -1;
-    PCursor<PCol*> me=pscore_l_->find_col( (PCol*)this);
-    if (!me.ok())
-       return -1;
-    PCursor<PCol*> bot(pscore_l_->cols.top());
-    return me - bot;
-#endif
     assert(rank_i_ != -1);
     return rank_i_;
 }
@@ -47,8 +59,7 @@ PCol::print() const
 #ifndef NPRINT
     mtor << "PCol {";
 
-    if (rank() >= 0)
-       mtor << "rank: " << rank_i_ << '\n';
+    mtor << "rank: " << rank_i_ << '\n';
 
     mtor << "# symbols: " << its.size() ;
     if (breakable_b()){
@@ -68,7 +79,7 @@ PCol::print() const
 int
 PCol::compare(PCol const &c1, PCol const &c2)
 {
-    return c1.rank() - c2.rank();
+    return c1.rank_i() - c2.rank_i();
 }
 
 void
@@ -95,6 +106,12 @@ PCol::set_breakable()
     postbreak_p_->pscore_l_ = pscore_l_;
 }
 
+bool
+PCol::breakpoint_b() const
+{
+    return !line_l_;
+}
+
 bool
 PCol::breakable_b() const
 {
@@ -103,12 +120,14 @@ PCol::breakable_b() const
 
 PCol::PCol(PCol *parent)
 {
+    error_mark_b_ = false;
     daddy_l_ = parent;
     prebreak_p_=0;
     postbreak_p_=0;
     line_l_=0;
     hpos = -1.0;
     pscore_l_ = 0;
+    rank_i_ = -1;
 }
 
 PCol::~PCol()