From 209401db7258a986a949a3d85e86557adba8fc28 Mon Sep 17 00:00:00 2001 From: fred Date: Mon, 25 Nov 1996 00:09:32 +0000 Subject: [PATCH] lilypond-0.0.11 --- Documentation/Makefile | 3 ++- Documentation/pointers | 31 +++++++++++++++++++++++++++++++ hdr/pscore.hh | 12 ++++++++++-- src/pscore.cc | 41 ++++++++++++++++++++++++++++++++++++----- 4 files changed, 79 insertions(+), 8 deletions(-) create mode 100644 Documentation/pointers diff --git a/Documentation/Makefile b/Documentation/Makefile index daf587679e..383026e355 100644 --- a/Documentation/Makefile +++ b/Documentation/Makefile @@ -1,5 +1,6 @@ -DOCFILES=commands CodingStyle algorithms Makefile breaking +DOCFILES=commands CodingStyle algorithms Makefile breaking\ + slurfont pointers dist: ln $(DOCFILES) $(DDIR)/Documentation/ \ No newline at end of file diff --git a/Documentation/pointers b/Documentation/pointers new file mode 100644 index 0000000000..45e2479d3f --- /dev/null +++ b/Documentation/pointers @@ -0,0 +1,31 @@ +This describes the ownership of certain classes in LilyPond. + +signifies a "list of". (This is not complete) + +Score: + Paperdef + Staff+ + Score_commands + Score_columns+ + PScore + +Staff: + Voice + Staff_column+ + Command+ + + +Voice: + Voice_element + +Voice_element: + Request+ + + +PScore: + PStaff+ + PCol+ + Idealspacing+ + Item+ + Spanner+ + Spanner+ (broken) + diff --git a/hdr/pscore.hh b/hdr/pscore.hh index c434f5b700..00fb79bccc 100644 --- a/hdr/pscore.hh +++ b/hdr/pscore.hh @@ -30,8 +30,13 @@ struct PScore { /// crescs etc; no particular order IPointerList spanners; - /****************************************************************/ + /// broken spanners + IPointerList broken_spans; + /****************/ + + void add_broken(Spanner*); + svec select_items(PStaff*, PCol*); /// before calc_breaking @@ -78,7 +83,7 @@ struct PScore { */ /// return argument as a cursor. - PCursor find_col(PCol *); + PCursor find_col(const PCol *)const; /// delete unused columns void clean_cols(); @@ -94,6 +99,9 @@ struct PScore { /// does curline fit on the paper? bool feasible(svec curline) const; + + /// which is first (left, higher) + int compare_pcols(const PCol*, const PCol*)const; }; /** notes, signs, symbols in a score can be grouped in two ways: horizontally (staffwise), and vertically (columns). #PScore# diff --git a/src/pscore.cc b/src/pscore.cc index 663a14c783..ba1113aa1a 100644 --- a/src/pscore.cc +++ b/src/pscore.cc @@ -13,7 +13,7 @@ void PScore::clean_cols() { for (PCursor c(cols); c.ok(); ) - if (!c->used) { + if (!c->used()) { c.del(); } else c++; @@ -71,8 +71,7 @@ PScore::typeset_spanner(Spanner*sp, PStaff*ps) sp->pstaff_ = ps; spanners.bottom().add(sp); ps->spans.bottom().add(sp); - sp->left->starters.bottom().add(sp); - sp->right->stoppers.bottom().add(sp); + // do not init start/stop fields. These are for broken spans only. } @@ -83,7 +82,7 @@ PScore::add_line(svec curline, svec config) lines.bottom().add(p); for (int i=0; i < curline.sz(); i++){ PCol *c=(PCol *)curline[i]; // so, this isn't really const. - c->hpos= config[i]; + c->hpos = config[i]; } } @@ -104,6 +103,15 @@ PScore::get_spacing(PCol*l, PCol*r) } +int +PScore::compare_pcols(const PCol*a, const PCol*b)const +{ + PCursor ac(find_col(a)); + PCursor bc(find_col(b)); + assert(ac.ok() && bc.ok()); + return ac - bc; +} + /* return all breakable columns */ @@ -121,6 +129,11 @@ PScore::find_breaks() const void PScore::add(PCol *p) { + p->pscore_ = this; + if (p->breakable()){ + p->prebreak->pscore_ = this; + p->postbreak->pscore_ = this; + } cols.bottom().add(p); } @@ -196,10 +209,28 @@ PScore::preprocess() void PScore::postprocess() { - for (PCursor ic(spanners); ic.ok(); ic++) { + for (PCursor ic(broken_spans); ic.ok(); ic++) { ic->process(); } for (PCursor ic(its); ic.ok(); ic++){ ic->postprocess(); } } + +PCursor +PScore::find_col(const PCol *c)const +{ + PCursor cc(cols); + for (; cc.ok(); cc++) + if (cc.ptr() == c || cc->prebreak == c || cc->postbreak == c) + return cc; + return cc; +} + +void +PScore::add_broken(Spanner*s) +{ + broken_spans.bottom().add(s); + s->left->starters.bottom().add (s); + s->right->stoppers.bottom().add (s); +} -- 2.39.5