From 21a260120248e221d329218c8ef64f5e994ba1b3 Mon Sep 17 00:00:00 2001 From: fred Date: Tue, 22 Oct 1996 16:04:15 +0000 Subject: [PATCH] lilypond-0.0.4 --- linespace.cc | 19 ++++++++++++------- pscore.cc | 50 ++++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 56 insertions(+), 13 deletions(-) diff --git a/linespace.cc b/linespace.cc index 402bd4074e..17c16ef4ef 100644 --- a/linespace.cc +++ b/linespace.cc @@ -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 <<","<space<< " strength " << id->hooke << "}\n"; + mtor << "between " << 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 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 +PScore::select_items(PStaff*ps , PCol*pc) +{ + svec ret; + assert(ps && pc); + for (PCursor ic(pc->its); ic.ok(); ic++){ + if (ic->pstaff_ == ps) + ret.add((Item*)(const Item*)ic); + } + return ret; +} + +void +PScore::OK()const +{ + for (PCursor cc(cols); cc.ok(); cc++) + cc->OK(); + for (PCursor ic(suz); ic.ok(); ic++) + ic->OK(); + +} +void +PScore::print() const +{ + + #ifndef NPRINT + mtor << "PScore { width "< cc(cols); cc.ok(); cc++) + cc->print(); + + mtor << "\nideals: "; + for (PCursor ic(suz); ic.ok(); ic++) + ic->print(); + mtor << "}\n"; + #endif +} + -- 2.11.4.GIT