]> git.donarmstrong.com Git - lilypond.git/blobdiff - src/pcol.cc
release: 0.0.21
[lilypond.git] / src / pcol.cc
index 41cf4fdb67d43f4fb760f2a3d202b26575b496b2..52df4297d4ab8be9155d8e98220a6f8f2e685368 100644 (file)
@@ -3,57 +3,39 @@
 #include "pstaff.hh"
 #include "debug.hh"
 
-void
-Idealspacing::print() const
-{
-#ifndef NPRINT
-    mtor << "idealspacing {" ;
-    mtor << "distance "<<space<< " strength " << hooke << "}\n";
-#endif
-}
-
-Idealspacing::Idealspacing(const PCol * l,const PCol * r)
-{
-    space = 0.0;
-    hooke = 0.0;
-    left = l;
-    right = r;
-}
-
-void
-Idealspacing::OK() const
-{
-#ifndef NDEBUG
-    assert(hooke >= 0 && left  && right);
-#endif    
-}
-
-/****************************************************************/
-
 Interval
 PCol::width() const
 {
     Interval w;
 
-    for (PCursor<const Item *> ic(its); ic.ok(); ic++)
-       w.unite(ic->width());
+    for (iter_top(its,i); i.ok(); i++)
+       w.unite(i->width());
     if (w.empty())
        w.unite(Interval(0,0));
     return w;
 }
 
+int
+PCol::rank() const
+{
+    if(!pscore_)
+       return -1;
+    PCursor<PCol*> me=pscore_->find_col( (PCol*)this);
+    if (!me.ok())
+       return -1;
+    PCursor<PCol*> bot(pscore_->cols.top());
+    return me - bot;
+}
+
 void
 PCol::print() const
 {
 #ifndef NPRINT
     mtor << "PCol {";
-    if (pscore_) {             // ugh
-       PCursor<PCol*> me=pscore_->find_col(this);
-       PCursor<PCol*> bot(pscore_->cols.top());
-       if (me.ok()) {
-           mtor << "rank: " << me - bot << '\n';
-       }
-    }
+
+    if (rank() >= 0)
+       mtor << "rank: " << rank() << '\n';
+
     mtor << "# symbols: " << its.size() ;
     if (breakable()){
        mtor << "\npre,post: ";
@@ -62,7 +44,7 @@ PCol::print() const
     } else if (daddy) {
        mtor<<'\n' << ((this == daddy->prebreak) ? "prebreak" : "postbreak");
     }
-    mtor << "extent: " << width().min << ", " << width().max << "\n";
+    mtor << "extent: " << width().str() << "\n";
     mtor << "}\n";
 #endif 
 }
@@ -70,7 +52,7 @@ PCol::print() const
 int
 PCol::compare(const PCol &c1, const PCol &c2)
 {
-    return c1.pscore_->compare_pcols(&c1,&c2);
+    return c1.pscore_->compare_pcols((PCol*)&c1,(PCol*)&c2);
 }
 
 void