]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.14
authorfred <fred>
Tue, 3 Dec 1996 23:06:11 +0000 (23:06 +0000)
committerfred <fred>
Tue, 3 Dec 1996 23:06:11 +0000 (23:06 +0000)
src/idealspacing.cc [new file with mode: 0644]
src/pcol.cc

diff --git a/src/idealspacing.cc b/src/idealspacing.cc
new file mode 100644 (file)
index 0000000..c6b8493
--- /dev/null
@@ -0,0 +1,30 @@
+#include "pcol.hh"
+#include "pscore.hh"
+#include "pstaff.hh"
+#include "debug.hh"
+
+void
+Idealspacing::print() const
+{
+#ifndef NPRINT
+    mtor << "idealspacing {" ;
+    mtor << "distance "<<space<< " strength " << hooke ;
+    mtor << "left " << left->rank() << " right " << right->rank() << "}\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    
+}
index 41cf4fdb67d43f4fb760f2a3d202b26575b496b2..2fab154829017478e75252ca6ec77aa70b43d979 100644 (file)
@@ -3,33 +3,6 @@
 #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
 {
@@ -41,19 +14,27 @@ PCol::width() const
        w.unite(Interval(0,0));
     return w;
 }
+int
+PCol::rank() const
+{
+    if(!pscore_)
+       return -1;
+    PCursor<PCol*> me=pscore_->find_col(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: ";