]> git.donarmstrong.com Git - lilypond.git/blobdiff - line.cc
release: 0.0.4
[lilypond.git] / line.cc
diff --git a/line.cc b/line.cc
index 9311aeb22d726cc819e1976b03c0f8990d27b18f..ebe9595d3b78b1a94e534d9559cff414c56b3557 100644 (file)
--- a/line.cc
+++ b/line.cc
@@ -1,20 +1,23 @@
 #include "line.hh"
-#include "cols.hh"
+#include "dimen.hh"
+#include "symbol.hh"
+#include "pcol.hh"
 #include "pscore.hh"
 
 String
 Line_of_staff::TeXstring() const
 {
     String s("%line_of_staff\n\\vbox to ");
-    s += String(height * VERT_TO_PT) +"pt{";
+    s += print_dimen(maxheight() ) +"{";
 
     //make some room
-    s += vstrut(base* VERT_TO_PT);
+    s += vstrut(base);
 
     // the staff itself: eg lines, accolades
     s += "\\hbox{";
     {
-       s+=(*pstaff_->stafsym)(scor->score->linewidth);
+       Symbol sym = pstaff_->get_stafsym(scor->score->linewidth);
+       s+=sym.tex;
        PCursor<const PCol *> cc(scor->cols);
        Real lastpos=cc->hpos;
 
@@ -24,7 +27,7 @@ Line_of_staff::TeXstring() const
            lastpos = cc->hpos;
 
            // moveover
-           s +=String( "\\kern ") + HOR_TO_PT*delta + "pt ";
+           s +=String( "\\kern ") + print_dimen(delta);
 
            // now output the items.
 
@@ -38,7 +41,7 @@ Line_of_staff::TeXstring() const
                    s += sc->TeXstring();
        }
     }
-    s+="\\hss}}";
+    s+="\\hss}\\vss}";
     return s;
 }
 
@@ -46,8 +49,11 @@ String
 Line_of_score::TeXstring() const
 {
      String s("\\vbox{");
-     for (PCursor<Line_of_staff*> sc(staffs); sc.ok(); sc++)
+     for (PCursor<Line_of_staff*> sc(staffs); sc.ok(); sc++){
         s += sc->TeXstring();
+        if ((sc+1).ok())
+            s+= "\\interstaffline\n";
+     }
      s += "}";
      return s;
 }
@@ -92,3 +98,34 @@ Line_of_staff::Line_of_staff(Line_of_score * sc, PStaff*st)
            brokenspans.bottom().add(sp->broken_at(brokenstop, brokenstart));
     }
 }
+
+
+Real
+Line_of_staff::maxheight() const
+{
+    Interval y;
+    {
+       Symbol s = pstaff_->stafsym->eval(scor->score->linewidth);
+       y = s.dim.y;
+    }
+    PCursor<const PCol *> cc(scor->cols);
+    
+    // all items in the current line & staff.
+    for (; cc.ok(); cc++) {
+
+               
+       for (PCursor<const Item *> ic(cc->its); ic.ok(); ic++) {
+           if (ic->pstaff_ == pstaff_) {
+               y.unite(ic->height());
+       }
+           
+       // spanners.
+       for (PCursor<const Spanner *> sc(cc->starters); sc.ok(); sc++)
+           if (sc->pstaff_ == pstaff_)
+               assert(false);          
+       }
+    }
+    return y.max;
+}
+
+