From: fred Date: Thu, 10 Oct 1996 14:05:31 +0000 (+0000) Subject: lilypond-0.0.2 X-Git-Tag: release/1.5.59~7117 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=30175a5148aa52591b5613b9fb99998ef3233fd2;p=lilypond.git lilypond-0.0.2 --- diff --git a/break.cc b/break.cc index 8f76d13fdc..0647d5f3e2 100644 --- a/break.cc +++ b/break.cc @@ -57,7 +57,11 @@ struct Col_configuration { }; /// wordwrap type algorithm -/* el stupido. This should be optimised... +/* el stupido. This should be optimised: + + It would be nice to have a Dynamic Programming type of algorithm + similar to TeX's + */ void @@ -87,7 +91,7 @@ PScore::calc_breaking() } current.add(breakpoints[i]->prebreak ); current.setsol(solve_line(current.line)); - + mtor << "energy : " << current.energy << '\n'; if (current.energy < minimum.energy) { minimum = current; @@ -99,7 +103,7 @@ PScore::calc_breaking() curcol ++; i++; } - + mtor << "Adding line, next breakpoint " << i << '\n'; add_line(minimum.line, minimum.config); } } diff --git a/line.cc b/line.cc index 9311aeb22d..88e2f3eb28 100644 --- a/line.cc +++ b/line.cc @@ -1,4 +1,5 @@ #include "line.hh" +#include "symbol.hh" #include "cols.hh" #include "pscore.hh" @@ -6,7 +7,7 @@ String Line_of_staff::TeXstring() const { String s("%line_of_staff\n\\vbox to "); - s += String(height * VERT_TO_PT) +"pt{"; + s += String(maxheight() * VERT_TO_PT) +"pt{"; //make some room s += vstrut(base* VERT_TO_PT); @@ -92,3 +93,31 @@ 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; + y = pstaff_->stafsym->height(scor->score->linewidth); + PCursor cc(scor->cols); + + // all items in the current line & staff. + for (; cc.ok(); cc++) { + + + for (PCursor ic(cc->its); ic.ok(); ic++) { + if (ic->pstaff_ == pstaff_) { + y.unite(ic->height()); + } + + // spanners. + for (PCursor sc(cc->starters); sc.ok(); sc++) + if (sc->pstaff_ == pstaff_) + assert(false); + } + } + return y.max; +} + + diff --git a/misc.cc b/misc.cc index d07c358d1a..effab35896 100644 --- a/misc.cc +++ b/misc.cc @@ -21,7 +21,8 @@ double log2(double x) { const Real PHI = (1+sqrt(5))/2; const double ENGRAVERS_SPACE = PHI; -const double WHOLE_SPACE = 10.0; +const double WHOLE_SPACE = 5.0; // should be settable from input + Real @@ -30,3 +31,7 @@ duration_to_idealspace(Mtime d) // see Roelofs, p. 57 return WHOLE_SPACE * pow(ENGRAVERS_SPACE, log2(d)); } + + + + diff --git a/score.cc b/score.cc index 543aca0d5a..b2b520c443 100644 --- a/score.cc +++ b/score.cc @@ -9,7 +9,30 @@ void Score::add(Command *c) { - commands_.bottom().add(new Command(*c)); + if (c->code == TYPESET && c->args[0] == "BAR") { + /* should be encapsulated in BREAKs + + THIS SUX. + + */ + Command k; + + k.when = c->when; + k.code = BREAK_PRE; + commands_.bottom().add(new Command(k)); + commands_.bottom().add(new Command(*c)); + k.code = BREAK_MIDDLE; + commands_.bottom().add(new Command(k)); + commands_.bottom().add(new Command(*c)); + k.code = BREAK_POST; + commands_.bottom().add(new Command(k)); + k.code = BREAK_END; + commands_.bottom().add(new Command(k)); + } + else + commands_.bottom().add(new Command(*c)); + + } void @@ -103,12 +126,16 @@ Score::process() sc->set_output(pscore_); sc->process(); } + + // do this after processing, staffs first have to generate PCols. do_pcols(); calc_idealspacing(); clean_cols(); OK(); // print(); pscore_->calc_breaking(); + // TODO: calculate vertical structs + // TODO: calculate mixed structs. } // remove empty cols with no spacing attached.