From 191e9bdcf4a4b4f065b163a3a55a036c821c3597 Mon Sep 17 00:00:00 2001 From: fred Date: Sun, 24 Mar 2002 19:26:58 +0000 Subject: [PATCH] lilypond-0.0.20 --- Sources.make | 21 ++++++++++++--------- hdr/spanner.hh | 11 +++++++++-- src/beam.cc | 16 +++++++++++++--- src/slur.cc | 18 ++++++++++++++++++ src/spanner.cc | 5 ++++- 5 files changed, 56 insertions(+), 15 deletions(-) diff --git a/Sources.make b/Sources.make index 53977c778b..a04e3dd03c 100644 --- a/Sources.make +++ b/Sources.make @@ -9,20 +9,22 @@ hdr= qlp.hh linespace.hh qlpsolve.hh\ parseconstruct.hh debug.hh globvars.hh keyword.hh\ misc.hh score.hh notename.hh lexer.hh symtable.hh\ symbol.hh main.hh dimen.hh paper.hh lookup.hh\ + spanner.hh beam.hh directionalspanner.hh slur.hh textspanner.hh\ sccol.hh stcol.hh staffcommands.hh melodicstaff.hh\ - identifier.hh simplestaff.hh spanner.hh stem.hh\ - notehead.hh leastsquares.hh beam.hh rest.hh\ + identifier.hh simplestaff.hh stem.hh\ + notehead.hh leastsquares.hh rest.hh\ swalker.hh bar.hh meter.hh accidental.hh\ key.hh keyitem.hh localkeyitem.hh simplewalker.hh\ - clef.hh clefitem.hh slur.hh inputcommands.hh\ - getcommand.hh inputmusic.hh \ + clef.hh clefitem.hh inputcommands.hh\ + getcommand.hh inputmusic.hh timedescription.hh\ inputscore.hh inputstaff.hh identparent.hh\ - inputcommand.hh grouping.hh moment.hh + inputcommand.hh grouping.hh moment.hh offset.hh + mycc= qlp.cc qlpsolve.cc leastsquares.cc\ inputcommands.cc inputmusic.cc \ - inputscore.cc inputstaff.cc\ - moment.cc\ + inputscore.cc inputstaff.cc inputcommand.cc\ + timedescription.cc\ break.cc linespace.cc molecule.cc staffline.cc\ pscore.cc tex.cc item.cc pcol.cc staff.cc \ rhythmstaff.cc score.cc note.cc main.cc misc.cc\ @@ -34,15 +36,16 @@ mycc= qlp.cc qlpsolve.cc leastsquares.cc\ dimen.cc paper.cc lookup.cc staffcommands.cc\ sccol.cc stcol.cc getcommands.cc simplestaff.cc\ melodicstaff.cc simpleprint.cc\ - spanner.cc \ + spanner.cc textspanner.cc directionalspanner.cc \ notehead.cc stem.cc \ rest.cc bar.cc meter.cc keyitem.cc localkeyitem.cc clefitem.cc\ swalker.cc scoreline.cc\ simplewalker.cc\ texbeam.cc texslur.cc clef.cc key.cc slur.cc beam.cc\ - idealspacing.cc inputcommand.cc grouping.cc identifier.cc\ + idealspacing.cc grouping.cc identifier.cc\ lexerinit.cc mylexer.cc\ template1.cc template2.cc template3.cc template4.cc\ + template5.cc\ version.cc diff --git a/hdr/spanner.hh b/hdr/spanner.hh index cfaca3dec9..86d63527ae 100644 --- a/hdr/spanner.hh +++ b/hdr/spanner.hh @@ -6,7 +6,9 @@ #ifndef SPANNER_HH #define SPANNER_HH + #include "proto.hh" +#include "interval.hh" /// a symbol which is attached between two columns. struct Spanner { @@ -18,14 +20,19 @@ struct Spanner { String TeXstring () const ; Spanner(); - Paperdef*paper() const; + Paperdef *paper() const; virtual ~Spanner(); virtual Interval height()const=0; /** PRE: processed */ - virtual Interval width()const; + /// do calcs + virtual void calculate(); + /** + It is safe to call calculate multiple times on one object + */ + virtual Interval width()const; virtual void process(); virtual void preprocess(); diff --git a/src/beam.cc b/src/beam.cc index 9cb43f5731..85d5cc4812 100644 --- a/src/beam.cc +++ b/src/beam.cc @@ -27,13 +27,23 @@ Stem_info::Stem_info(const Stem*s) { x = s->hpos(); int dir = s->dir; - idealy = MAX(dir*s->top, dir*s->bot); - miny = MAX(dir*s->minnote, dir*s-> maxnote); + idealy = max(dir*s->top, dir*s->bot); + miny = max(dir*s->minnote, dir*s-> maxnote); assert(miny <= idealy); no_beams = s->flag; } /****************/ +Offset +Beam::center()const +{ + if(!dir) + ((Beam*)this)->calculate(); + Real w=width().length()/2; + return Offset(w, + (left_pos + w* slope)*paper()->interline()); +} + Beam::Beam() { @@ -143,7 +153,7 @@ Beam::set_grouping(Rhythmic_grouping def, Rhythmic_grouping cur) PCursor s(stems); svec flags; for (; s.ok(); s++) { - int f = intlog2(ABS(s->flag))-2; + int f = intlog2(abs(s->flag))-2; assert(f>0); flags.add(f); } diff --git a/src/slur.cc b/src/slur.cc index f795dc8284..b16aae1f0a 100644 --- a/src/slur.cc +++ b/src/slur.cc @@ -7,6 +7,24 @@ #include "molecule.hh" #include "debug.hh" #include "boxes.hh" +void +Slur::calculate() +{ + set_default_dir(); +} + +Offset +Slur::center() const +{ + int pos1 = encompass.last()->position; + int pos2 = encompass[0]->position; + + int dy = pos1-pos2; + + Real w = width().length(); + + return Offset(w/2,dy * paper()->internote()); +} void Slur::add(Notehead*n) diff --git a/src/spanner.cc b/src/spanner.cc index a550227ea6..9a8c1dc36f 100644 --- a/src/spanner.cc +++ b/src/spanner.cc @@ -5,7 +5,10 @@ #include "symbol.hh" #include "molecule.hh" #include "pcol.hh" - +void +Spanner::calculate() +{ +} String Spanner::TeXstring() const { -- 2.39.5