From: fred Date: Tue, 3 Dec 1996 23:35:24 +0000 (+0000) Subject: lilypond-0.0.14 X-Git-Tag: release/1.5.59~6680 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=097338571bda93468fbfe417dab5240eea45d68f;p=lilypond.git lilypond-0.0.14 --- diff --git a/src/calcideal.cc b/src/calcideal.cc index 3f9a7dca23..47ca885ade 100644 --- a/src/calcideal.cc +++ b/src/calcideal.cc @@ -24,12 +24,10 @@ Score::do_connect(PCol *c1, PCol *c2, Real d, Real h) void Score::connect(PCol* c1, PCol *c2, Real d, Real h) { - if (c2->used() && c1->used()) { - do_connect(c1,c2,d,h); - do_connect(c1->postbreak, c2,d,h); - do_connect(c1, c2->prebreak,d,h); - do_connect(c1->postbreak, c2->prebreak,d,h); - } + do_connect(c1,c2,d,h); + do_connect(c1->postbreak, c2,d,h); + do_connect(c1, c2->prebreak,d,h); + do_connect(c1->postbreak, c2->prebreak,d,h); } /* this needs A LOT of rethinking. @@ -39,43 +37,61 @@ Score::connect(PCol* c1, PCol *c2, Real d, Real h) void Score::calc_idealspacing() { +#if 1 PCursor i(cols_); for (; i.ok(); i++) { - + assert(i->used()); PCursor j (i+1); if (i->musical) { for (int n=0; n < i->durations.sz(); n++) { Real d = i->durations[n]; Real dist = paper_->duration_to_dist(d); - while (d + i->when > j->when) + while (j->when < d + i->when) j++; + + assert(j->when == d+i->when); - if (j->used()) - connect(i->pcol_, j->pcol_, dist); - if (!j->musical && (j+1)->used && (j+1)->when == j->when) { + connect(i->pcol_, j->pcol_, dist); + if (!j->musical && (j+1).ok() + && (j+1)->when == j->when) { j++; connect(i->pcol_, j->pcol_, dist); } } - } else if (i->used()) { - + } else if (j.ok()) { + /* attach i to the next column in use. This exists, since the last col is breakable, and therefore in use */ - for (;j.ok(); j++) { - if (j->used()) { - Real d = j->when - i->when; - Real dist = (d) ? paper_->duration_to_dist(d) : - convert_dimen(2,"pt"); + + Real d = j->when - i->when; + Real dist = (d) ? paper_->duration_to_dist(d) : + convert_dimen(2,"pt"); + + connect(i->pcol_, j->pcol_, dist, (d) ? 1.0:1.0); + } + // !j.ok() might hold if we're at the last col. + + } +#else + PCursor sc(cols_); - connect(i->pcol_, j->pcol_, dist, (d) ? 1.0:1.0); - break; - } + for (; sc.ok(); sc++) { + if (sc->musical) + for (int i=0; i < sc->durations.sz(); i++) { + Real d = sc->durations[i]; + Real dist = paper_->duration_to_dist(d); + PCol * c2 = find_col(sc->when + d,true)->pcol_; + connect(sc->pcol_, c2, dist); + c2 = find_col(sc->when + d,false)->pcol_; + connect(sc->pcol_, c2, dist); } - // !j.ok() might hold if we're at the last col. + else if (sc->used()) { // ignore empty columns + PCol * c2 = find_col(sc->when,true)->pcol_; + connect(sc->pcol_, c2, 0.0); } - } +#endif } diff --git a/src/score.cc b/src/score.cc index 60ab3931f9..57336936b5 100644 --- a/src/score.cc +++ b/src/score.cc @@ -1,7 +1,4 @@ -#include "staffcommands.hh" #include "tstream.hh" -#include "getcommand.hh" -#include "inputcommands.hh" #include "score.hh" #include "sccol.hh" #include "pscore.hh" @@ -9,6 +6,7 @@ #include "debug.hh" #include "paper.hh" + void Score::process() { @@ -18,20 +16,21 @@ Score::process() paper_ = new Paperdef; /// distribute commands to disciples - distribute_commands(); - pscore_ = new PScore(paper_); - for (PCursor sc(staffs_); sc.ok(); sc++) { - sc->set_output(pscore_); - sc->process(); + for (PCursor i(staffs_); i.ok(); i++) { + i->process_commands(last()); + i->set_output(pscore_); + i->process(); } // do this after processing, staffs first have to generate PCols. do_pcols(); + // ugh. Would want to clean the columns before anything else. + clean_cols(); calc_idealspacing(); - clean_cols(); // ugh. Would want to clean the columns before anything else. - + // debugging + print (); OK(); pscore_->preprocess(); @@ -49,16 +48,16 @@ Score::process() void Score::clean_cols() { - for (PCursor sc(staffs_); sc.ok(); sc++) - sc->clean_cols(); + for (PCursor i(staffs_); i.ok(); i++) + i->clean_cols(); for (PCursor c(cols_); c.ok(); ) { if (!c->pcol_->used()) { - mtor << "removing : "; - c->print(); c.del(); - } else + } else { + c->preprocess(); c++; + } } pscore_->clean_cols(); @@ -114,27 +113,12 @@ Score::find_col(Real w,bool mus) return scc; } -void -Score::distribute_commands() -{ - for (PCursor sc(staffs_); sc.ok(); sc++) { - sc->process_input_commands(input_commands_, last()); - } -} -void -Score::add(Staff*s) -{ - s->score_ = this; - staffs_.bottom().add(s); -} - - void Score::do_pcols() { - PCursor sc(cols_); - for (; sc.ok(); sc++) { - pscore_->add(sc->pcol_); + PCursor i(cols_); + for (; i.ok(); i++) { + pscore_->add(i->pcol_); } } Real @@ -151,9 +135,9 @@ void Score::OK() const { #ifndef NDEBUG - for (PCursor sc(staffs_); sc.ok(); sc++) { - sc->OK(); - assert(sc->score_ == this); + for (PCursor i(staffs_); i.ok(); i++) { + i->OK(); + assert(i->score_ == this); } staffs_.OK(); cols_.OK(); @@ -169,34 +153,28 @@ Score::print() const { #ifndef NPRINT mtor << "score {\n"; - for (PCursor sc(staffs_); sc.ok(); sc++) { - sc->print(); + for (PCursor i(staffs_); i.ok(); i++) { + i->print(); } - for (PCursor sc(cols_); sc.ok(); sc++) { - sc->print(); + for (PCursor i(cols_); i.ok(); i++) { + i->print(); } + if (pscore_) + pscore_->print(); + mtor << "}\n"; #endif } -Score::Score() +Score::Score(Paperdef*p) { pscore_=0; - paper_ = 0; + paper_ = p; } Score::~Score() { delete pscore_; - for (int i=0; i &s) +Score::add(Staff*s) { - input_commands_.add(get_reset_command()); - input_commands_.concat(s); + s->score_ = this; + staffs_.bottom().add(s); }