]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.4
authorfred <fred>
Tue, 22 Oct 1996 16:04:15 +0000 (16:04 +0000)
committerfred <fred>
Tue, 22 Oct 1996 16:04:15 +0000 (16:04 +0000)
linespace.cc
pscore.cc

index 402bd4074ebe16afb1d75f6ee5945366b2fc4804..17c16ef4efbabc3aa6a118c6cb98aefe2c6f23b7 100644 (file)
@@ -143,7 +143,7 @@ Spacing_problem::make_matrices(Matrix &quad, Vector &lin, Real &c) const
 
 // put the constraints into the LP problem
 void
-Spacing_problem::make_constraints(Optimisation_problem& lp) const
+Spacing_problem::make_constraints(Mixed_qp& lp) const
 {    
     int dim=cols.sz();
     for (int j=0; j < dim; j++) {
@@ -172,7 +172,7 @@ Spacing_problem::solve() const
 
     
     /* optimalisatiefunctie */        
-    Optimisation_problem lp(cols.sz());
+    Mixed_qp lp(cols.sz());
     make_matrices(lp.quad,lp.lin, lp.const_term);
     make_constraints(lp);    
     Vector start=find_initial_solution();    
@@ -196,6 +196,7 @@ Spacing_problem::add_column(const PCol *col, bool fixed, Real fixpos)
     Colinfo c;
     c.fixed=fixed;
     c.fixpos=fixpos;
+    assert(col);
     c.col=col;
     cols.add(c);
 }
@@ -219,15 +220,14 @@ Spacing_problem::print_ideal(const Idealspacing*id)const
     int l = col_id(id->left);
     int r = col_id(id->right);
 
-    mtor << "idealspacing { between " << l <<","<<r<<'\n';
-    mtor << "distance "<<id->space<< " strength " << id->hooke << "}\n";
+    mtor << "between " << l <<","<<r<<":" ;
 #endif
 }
 
 void
 Spacing_problem::print() const
 {
-    #ifndef NPRINT
+#ifndef NPRINT
     for (int i=0; i < cols.sz(); i++) {
        mtor << "col " << i<<' ';
        cols[i].print();
@@ -235,7 +235,7 @@ Spacing_problem::print() const
     for (int i=0; i < ideals.sz(); i++) {
        print_ideal(ideals[i]);
     }
-    #endif
+#endif
     
 }
 
@@ -246,9 +246,14 @@ Colinfo::print() const
     mtor << "column { ";
     if (fixed)
        mtor << "fixed at " << fixpos<<", ";
+    assert(col);
     mtor << "[" << minleft() << ", " << minright() << "]";
     mtor <<"}\n";
 #endif
 }
 
-
+Colinfo::Colinfo()
+{
+    fixed=false;
+    col=0;
+}
index 16156d1321eb9f8c30f4bd2a67907bd4c332bbae..44a87c0dd4d4416ca4912e06f6283b00a2093f16 100644 (file)
--- a/pscore.cc
+++ b/pscore.cc
@@ -1,5 +1,6 @@
 // utility functions for PScore
 #include "debug.hh"
+#include "dimen.hh"
 #include "line.hh"
 #include "pscore.hh"
 #include "tstream.hh"
@@ -60,7 +61,7 @@ PScore::get_spacing(PCol*l, PCol*r)
     
     Idealspacing*ip =new Idealspacing(l,r);
     suz.bottom().add(ip);
-    //    l->used = r->used = true;
+
     return ip;
 }
 
@@ -80,19 +81,17 @@ PScore::add(PCol *p)
 {
     cols.bottom().add(p);
 }
-/*
-    todo: config of width
-    */
+
 PScore::PScore()
 {
-    linewidth = 15;            // in cm for now
+    linewidth = convert_dimen(15,"cm");
 }
 
 void
 PScore::output(Tex_stream &ts)
 {
     int l=1;
-    ts << "% linewidth " << linewidth * HOR_TO_PT << " pt\n";
+    ts << "% linewidth " << print_dimen(linewidth )+"\n";
     for (PCursor<Line_of_score*> lic(lines); lic.ok(); lic++) {
        ts << "% line of score no. " << l++ <<"\n";
        ts << lic->TeXstring();
@@ -100,3 +99,42 @@ PScore::output(Tex_stream &ts)
            ts << "\\interscoreline\n";
     }  
 }
+
+svec<Item*>
+PScore::select_items(PStaff*ps , PCol*pc)
+{
+    svec<Item*> ret;
+    assert(ps && pc);
+    for (PCursor<const Item*> ic(pc->its); ic.ok(); ic++){
+       if (ic->pstaff_ == ps)
+           ret.add((Item*)(const Item*)ic);
+    }
+    return ret;
+}
+
+void
+PScore::OK()const
+{
+    for (PCursor<PCol*> cc(cols); cc.ok(); cc++)
+       cc->OK();
+    for (PCursor<Idealspacing*> ic(suz); ic.ok(); ic++)
+       ic->OK();
+    
+}
+void
+PScore::print() const
+{
+    
+     #ifndef NPRINT
+   mtor << "PScore { width "<<print_dimen(linewidth);
+    mtor << "\ncolumns: ";
+    for (PCursor<PCol*> cc(cols); cc.ok(); cc++)
+       cc->print();
+    
+    mtor << "\nideals: ";
+    for (PCursor<Idealspacing*> ic(suz); ic.ok(); ic++)
+       ic->print();
+    mtor << "}\n";
+   #endif 
+}
+