]> git.donarmstrong.com Git - lilypond.git/blobdiff - src/staffline.cc
release: 0.0.38
[lilypond.git] / src / staffline.cc
index c83e904bc6fbfbd6c018bffe6557febed8547371..5d18b219e6c708e9e81edf20443cae0940a7f8f9 100644 (file)
@@ -3,16 +3,18 @@
 #include "dimen.hh"
 #include "spanner.hh"
 #include "symbol.hh"
-#include "paper.hh"
+#include "paper-def.hh"
+#include "molecule.hh"
 #include "pcol.hh"
 #include "pscore.hh"
 
 static String
 make_vbox(Interval i)
-{    
+{
+    Real r = (i.empty()) ? 0.0 : i.length();
     String s("\\vbox to ");
-    s += print_dimen(i.length());
-    s += "{\\vskip "+print_dimen(i.max)+" ";
+    s += print_dimen(r);
+    s += "{\\vskip "+print_dimen(i.right)+" ";
     return s;
 }
 
@@ -21,13 +23,12 @@ String
 Line_of_staff::TeXstring() const
 {
     String s("%line_of_staff\n");
+    
     s+=make_vbox(height());
     // the staff itself: eg lines, accolades
     s += "\\hbox{";
-    {
-       Symbol sym = pstaff_->get_stafsym(scor->score->paper_->linewidth);
-       s+=sym.tex;
-       PCursor<const PCol *> cc(scor->cols);
+    {                          
+       iter_top(line_of_score_l_->cols,cc);
        Real lastpos=cc->hpos;
 
        // all items in the current line & staff.
@@ -40,15 +41,14 @@ Line_of_staff::TeXstring() const
                s +=String( "\\kern ") + print_dimen(delta);
 
            // now output the items.
-
-           for (PCursor<const Item *> ic(cc->its); ic.ok(); ic++) {
-               if (ic->pstaff_ == pstaff_)
-                   s += ic->TeXstring();
+           for (iter_top(cc->its,i); i.ok(); i++) {
+               if (i->pstaff_l_ == pstaff_l_)
+                   s += i->TeXstring();
            }
            // spanners.
-           for (PCursor<const Spanner *> sc(cc->starters); sc.ok(); sc++)
-               if (sc->pstaff_ == pstaff_)
-                   s += sc->TeXstring();
+           for (iter_top(cc->starters,i); i.ok(); i++)
+               if (i->pstaff_l_ == pstaff_l_)
+                   s += i->TeXstring();
        }
     }
     s+="\\hss}\\vss}";
@@ -57,22 +57,20 @@ Line_of_staff::TeXstring() const
 
 Line_of_staff::Line_of_staff(Line_of_score * sc, PStaff*st)
 {
-    scor=sc;
-    pstaff_=st;
-#if 0
-    const PCol *linestart = sc->cols.top();
-    const PCol *linestop = sc->cols.bottom();
-
-    for (PCursor<const Spanner*> sp(pstaff_->spans); sp.ok(); sp++) {
-       const PCol *brokenstart = &MAX(*linestart, *sp->left);
-       const PCol *brokenstop = &MIN(*linestop, *sp->right);
-//     if (*brokenstop  < *brokenstart)
-       brokenspans.bottom().add(sp->broken_at(0,0));
-    }
-#endif
-    for (PCursor<const Spanner*> sp(pstaff_->spans); sp.ok(); sp++) {
+    line_of_score_l_=sc;
+    pstaff_l_=st;
 
-       brokenspans.bottom().add(sp->broken_at(0,0));
+    PCol *linestart = sc->cols.top();
+    PCol *linestop = sc->cols.bottom();
+    
+    for (iter_top(pstaff_l_->spans,i); i.ok(); i++) {
+       PCol *brokenstart = &max(*linestart, *i->left);
+       PCol *brokenstop = &min(*linestop, *i->right);
+       if ( *brokenstart < *brokenstop) {
+           Spanner*span_p =i->broken_at(brokenstart,brokenstop);
+           line_of_score_l_->pscore_l_-> // higghl
+               add_broken(span_p);
+       }
     }
 }
 
@@ -80,28 +78,33 @@ Line_of_staff::Line_of_staff(Line_of_score * sc, PStaff*st)
 Interval
 Line_of_staff::height() const
 {
-    Interval y;
-    {
-       Symbol s = pstaff_->stafsym->eval(scor->score->paper_->linewidth);
-       y = s.dim.y;
-    }
-    PCursor<const PCol *> cc(scor->cols);
+    Interval y(0,0);
+
+    iter_top(line_of_score_l_->cols,cc);
     
     // 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());
-       }
+       for (iter_top(cc->its,i); i.ok(); i++) {
+           if (i->pstaff_l_ == pstaff_l_) 
+               y.unite(i->height());
            
+       }
        // spanners.
-       for (PCursor<const Spanner *> sc(cc->starters); sc.ok(); sc++)
-           if (sc->pstaff_ == pstaff_) {
-               y.unite(sc->height());
+       for (iter_top(cc->starters,i); i.ok(); i++)
+           if (i->pstaff_l_ == pstaff_l_) {
+               y.unite(i->height());
            }
-       }
     }
+    
     return y;
 }
 
-
+void
+Line_of_staff::process()
+{
+#if 0
+    if (!pstaff_l_->stafsym_p_)
+       pstaff_l_->brew_molecule_p(line_of_score_l_->pscore_l_->
+                                paper_l_->linewidth);
+#endif
+}