test missing. On Thu, Aug 18, 2011 at 8:03 AM, <mts...@gmail.com> wrote: > Reviewers: , > > Description: > Makes sure that ledger lines do not overlap with accidentals. > > Please review this at http://codereview.appspot.com/4898060/ > > Affected files: > M lily/ledger-line-spanner.cc > > > Index: lily/ledger-line-spanner.cc > diff --git a/lily/ledger-line-spanner.cc b/lily/ledger-line-spanner.cc > index > 01238222147c9afbf4f33a2e6b62ac2018a46c9f..9487034eabdca68f4cf93df9251e596013b4203c > 100644 > --- a/lily/ledger-line-spanner.cc > +++ b/lily/ledger-line-spanner.cc > @@ -18,6 +18,7 @@ > */ > > #include <map> > +#include <set> > using namespace std; > > #include "note-head.hh" > @@ -34,6 +35,7 @@ struct Ledger_line_spanner > DECLARE_SCHEME_CALLBACK (set_spacing_rods, (SCM)); > static Stencil brew_ledger_lines (Grob *me, > int pos, > + set<int> &poss, > Interval, > Real, Real, > Interval x_extent, > @@ -45,6 +47,7 @@ struct Ledger_line_spanner > Stencil > Ledger_line_spanner::brew_ledger_lines (Grob *staff, > int pos, > + set<int> &poss, > Interval staff_extent, > Real halfspace, > Real ledgerlinethickness, > @@ -74,8 +77,16 @@ Ledger_line_spanner::brew_ledger_lines (Grob *staff, > : -dir * halfspace; > > offs += pos * halfspace; > + set<int>::iterator it; > + set<int> local_poss; > + > + for (it = poss.begin (); it != poss.end (); it++) > + local_poss.insert (max (0, line_count - *it)); > + > for (int i = 0; i < line_count; i++) > { > + if (local_poss.find (i) != local_poss.end () && i) > + continue; > Stencil ledger_line ((i == 0) > ? proto_first_line > : proto_ledger_line); > @@ -315,6 +326,17 @@ Ledger_line_spanner::print (SCM smob) > // create ledgers for note heads > Real ledgerlinethickness > = Staff_symbol::get_ledger_line_thickness (staff); > + > + Drul_array<set<int > > poss; > + for (vsize i = heads.size (); i--;) > + { > + Item *h = dynamic_cast<Item *> (heads[i]); > + > + int pos = Staff_symbol_referencer::get_rounded_position (h); > + if (!staff_extent.contains (pos - sign (pos)) && > !staff_extent.is_empty ()) > + poss[(Direction) sign (pos)].insert (sign (pos) * int (rint (pos - > staff_extent[Direction (sign (pos))])) / 2); > + } > + > for (vsize i = heads.size (); i--;) > { > Item *h = dynamic_cast<Item *> (heads[i]); > @@ -347,7 +369,9 @@ Ledger_line_spanner::print (SCM smob) > */ > } > > - ledgers.add_stencil (brew_ledger_lines (staff, pos, staff_extent, > + ledgers.add_stencil (brew_ledger_lines (staff, pos, > + poss[(Direction) sign > (pos)], > + staff_extent, > halfspace, > ledgerlinethickness, > ledger_size, > > > > _______________________________________________ > lilypond-devel mailing list > lilypond-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/lilypond-devel >
-- Han-Wen Nienhuys - han...@xs4all.nl - http://www.xs4all.nl/~hanwen _______________________________________________ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel