From eaaba13b481415d7aba6e5d6e8d7725bc4616547 Mon Sep 17 00:00:00 2001 From: fred Date: Wed, 27 Mar 2002 02:05:36 +0000 Subject: [PATCH] lilypond-1.5.33 --- lily/line-of-score.cc | 44 +++++++++++++++++++++++++++++++++++++++++++ lily/third-try.cc | 37 +++++++++++++++++++++++++++++++----- 2 files changed, 76 insertions(+), 5 deletions(-) diff --git a/lily/line-of-score.cc b/lily/line-of-score.cc index 989d932580..de47ec41d4 100644 --- a/lily/line-of-score.cc +++ b/lily/line-of-score.cc @@ -172,9 +172,14 @@ set_loose_columns (Line_of_score* which, Column_x_positions const *posns) } while (1); + +#if 0 Real rx = right->relative_coordinate (right->get_parent (X_AXIS), X_AXIS); Real lx = left->relative_coordinate (left->get_parent (X_AXIS), X_AXIS); + /* + divide space equally over loose columns. + */ int j = 1; loose = col; while (1) @@ -191,6 +196,45 @@ set_loose_columns (Line_of_score* which, Column_x_positions const *posns) j ++; loose = dynamic_cast (unsmob_grob (ly_cdr (between))); } +#else + /* + We divide the remaining space of the column over the left and + right side. At the moment, we + + */ + Grob * common = right->common_refpoint (left, X_AXIS); + + Real rx = right->extent(common, X_AXIS)[LEFT]; + Real lx = left->extent(common, X_AXIS)[RIGHT]; + Real total_dx = rx - lx; + Interval cval =col->extent (col, X_AXIS); + + /* + + We put it in the middle. This is not an ideal solution -- the + break alignment code inserts a fixed space before the clef + (about 1 SS), while the space following the clef is + flexible. In tight situations, the clef will almost be on top + of the following note. + + */ + Real dx = rx-lx - cval.length (); + if (total_dx < 2* cval.length ()) + { + /* + todo: this is discontinuous. I'm too tired to + invent a sliding mechanism. Duh. + + TODO. + */ + dx *= 0.25; + } + else + dx *= 0.5; + + col->line_l_ = which; + col->translate_axis (lx + dx - cval[LEFT], X_AXIS); +#endif } } diff --git a/lily/third-try.cc b/lily/third-try.cc index 79deb7cb8a..ee3677cb9a 100644 --- a/lily/third-try.cc +++ b/lily/third-try.cc @@ -160,13 +160,40 @@ Third_spacing_spanner::prune_loose_colunms (Link_array *cols) c->set_grob_property ("between-cols", gh_cons (lns, rns)); - /* - TODO: we should have distance constraints for loose - columns anyway, and the placement could be improved. Clefs - easily run into their neigbhors when folded into too - little space. + Set distance constraints for loose columns */ + Drul_array next_door; + next_door[LEFT] =cols->elem (i - 1); + next_door[RIGHT] =cols->elem (i + 1); + Direction d = LEFT; + Drul_array dists(0,0); + + do + { + dists[d] = 0.0; + Grob *lc = d == LEFT ? lc : c; + Grob *rc = d == LEFT ? c : rc; + + for (SCM s = lc->get_grob_property ("spacing-wishes"); + gh_pair_p (s); s = gh_cdr (s)) + { + Grob *sp = unsmob_grob (gh_car (s)); + if (Note_spacing::left_column (sp) != lc + || Note_spacing::right_column (sp) != rc) + continue; + + dists[d] = dists[d] >? Note_spacing::get_spacing (sp); + } + } + while (flip (&d) != LEFT); + + Rod r; + r.distance_f_ = dists[LEFT] + dists[RIGHT]; + r.item_l_drul_[LEFT] = dynamic_cast (cols->elem(i-1)); + r.item_l_drul_[RIGHT] = dynamic_cast (cols->elem (i+1)); + + r.add_to_cols (); } else { -- 2.39.5