From: hanwen Date: Tue, 23 Jul 2002 18:38:44 +0000 (+0000) Subject: * lily/separation-item.cc (width): cache extent in extent-X X-Git-Tag: release/1.5.71~108 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=41bc9fd3eee18b13cdd67eeccb0c8b28721c499d;p=lilypond.git * lily/separation-item.cc (width): cache extent in extent-X * lily/spacing-spanner.cc (standard_breakable_column_spacing): only add extent for non-musical column. --- diff --git a/ChangeLog b/ChangeLog index 089154d867..6e4584f89e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2002-07-23 Han-Wen + * lily/separation-item.cc (width): cache extent in extent-X + + * lily/spacing-spanner.cc (standard_breakable_column_spacing): + only add extent for non-musical column. + * lily/accidental-placement.cc (split_accidentals): new function (get_relevant_accidental_extent): new function diff --git a/input/regression/accidental-unbroken-tie-spacing.ly b/input/regression/accidental-unbroken-tie-spacing.ly new file mode 100644 index 0000000000..7d4e017b7f --- /dev/null +++ b/input/regression/accidental-unbroken-tie-spacing.ly @@ -0,0 +1,28 @@ +\header { +texidoc = "Tied accidentaled notes (which cause reminder accidentals) don't wreak havoc in +the spacing when unbroken." +} + +\version "1.5.68" +\include "deutsch.ly" + +rechts = \notes \relative c' { + \clef treble + \time 3/4 + \context Voice { + c8 h2 ~ | + + } +} + +Rechts = \context Staff \notes { + rechts +} + +\score { + \rechts + + \paper { + linewidth = -3.3 \cm + } +} diff --git a/lily/accidental-placement.cc b/lily/accidental-placement.cc index c05932ecee..292f993551 100644 --- a/lily/accidental-placement.cc +++ b/lily/accidental-placement.cc @@ -111,8 +111,8 @@ Accidental_placement::split_accidentals (Grob * accs, } /* - Accidentals are special, because they appear and disappear before - and after ties at will. + Accidentals are special, because they appear and disappear after + ties at will. */ Interval Accidental_placement::get_relevant_accidental_extent (Grob *me, diff --git a/lily/separating-group-spanner.cc b/lily/separating-group-spanner.cc index f4471530bf..4cd8c8ef32 100644 --- a/lily/separating-group-spanner.cc +++ b/lily/separating-group-spanner.cc @@ -19,9 +19,14 @@ Separating_group_spanner::find_rods (Item * r, SCM next) { /* - This is an inner loop, however, in most cases, the interesting L - will just be the first entry of NEXT, making it linear in most of - the cases. */ + This is an inner loop: look for the first normal (unbroken) Left + grob. This looks like an inner loop (ie. quadratic total), but in + most cases, the interesting L will just be the first entry of + NEXT, making it linear in most of the cases. + */ + if (Separation_item::width (r).empty_b ()) + return; + for(; gh_pair_p (next); next = ly_cdr (next)) { Item *l = dynamic_cast (unsmob_grob (ly_car( next))); @@ -39,8 +44,6 @@ Separating_group_spanner::find_rods (Item * r, SCM next) rod.item_l_drul_[RIGHT] = r; rod.distance_f_ = li[RIGHT] - ri[LEFT]; - - rod.columnize (); rod.add_to_cols (); } } @@ -56,16 +59,15 @@ Separating_group_spanner::find_rods (Item * r, SCM next) rod.distance_f_ = li[RIGHT] - ri[LEFT]; - rod.columnize (); rod.add_to_cols (); - break; } - else - /* - this grob doesn't cause a constraint. We look further until we - find one that does. */ - ; + + /* + this grob doesn't cause a constraint. We look further until we + find one that does. + */ + } } diff --git a/lily/separation-item.cc b/lily/separation-item.cc index f85866f4c8..f318a62f7e 100644 --- a/lily/separation-item.cc +++ b/lily/separation-item.cc @@ -27,11 +27,15 @@ Separation_item::add_conditional_item (Grob* me , Grob *e) Pointer_group_interface::add_grob (me, ly_symbol2scm ("conditional-elements"), e); } +/* + Return the width of ME given that we are considering the object on + the LEFT. + */ Interval Separation_item::conditional_width (Grob * me, Grob * left) { Interval w = width (me); - + Item *item = dynamic_cast (me); Paper_column * pc = item->column_l (); diff --git a/lily/spacing-spanner.cc b/lily/spacing-spanner.cc index 4c3f635950..3c8f3a4e14 100644 --- a/lily/spacing-spanner.cc +++ b/lily/spacing-spanner.cc @@ -28,9 +28,6 @@ #include "break-align-interface.hh" #include "spacing-interface.hh" -/* - paper-column: - */ class Spacing_spanner { public: @@ -639,18 +636,25 @@ Spacing_spanner::standard_breakable_column_spacing (Grob * me, Item*l, Item*r, Real * fixed, Real * space, Moment shortest) { + *fixed = 0.0; Direction d = LEFT; Drul_array cols(l,r); do { - Interval lext = cols[d]->extent (cols [d], X_AXIS); - - *fixed += -d * lext[-d]; + if (!Paper_column::musical_b (cols[d])) + { + /* + Tied accidentals over barlines cause problems, so lets see + what happens if we do this for non musical columns only. + */ + Interval lext = cols[d]->extent (cols [d], X_AXIS); + *fixed += -d * lext[-d]; + } } while (flip (&d) != LEFT); - + if (l->breakable_b (l) && r->breakable_b(r)) { Moment *dt = unsmob_moment (l->get_grob_property ("measure-length")); @@ -669,8 +673,6 @@ Spacing_spanner::standard_breakable_column_spacing (Grob * me, Item*l, Item*r, *space = *fixed + get_duration_space (me, dt, shortest.main_part_, &dummy); } - - } diff --git a/scm/grob-property-description.scm b/scm/grob-property-description.scm index e2e8c83667..f7983f8936 100644 --- a/scm/grob-property-description.scm +++ b/scm/grob-property-description.scm @@ -306,7 +306,7 @@ taking grob as argument, returning a smobbed Molecule. All visible, i.e. non-transparent, grobs have a callback to create a Molecule. The callback should be a Scheme function taking one argument (the grob) and returning a Molecule. Most molecule callbacks are -written in C++, but you can also write them in Scheme. An examlily/lilypond/ple is +written in C++, but you can also write them in Scheme. An example is provided in @code{input/regression/molecule-hacking.ly}. ")