From 2f7b37a5d3482bbda90bea53f98e845c2580512f Mon Sep 17 00:00:00 2001 From: Joe Neeman Date: Fri, 1 Jun 2007 14:53:59 +1000 Subject: [PATCH] Fix spacing of the first bar on the system. Fix spacing between barlines and accidentals. Remove unused parameters from spacing functions. --- lily/include/spacing-options.hh | 2 +- lily/include/spacing-spanner.hh | 3 +-- lily/spacing-basic.cc | 16 +++++----------- lily/spacing-determine-loose-columns.cc | 3 +-- lily/spacing-loose-columns.cc | 5 ++--- lily/spacing-options.cc | 4 +--- lily/spacing-spanner.cc | 11 ++--------- lily/staff-spacing.cc | 12 ++---------- 8 files changed, 15 insertions(+), 41 deletions(-) diff --git a/lily/include/spacing-options.hh b/lily/include/spacing-options.hh index 0b2d30b664..c202c7d64d 100644 --- a/lily/include/spacing-options.hh +++ b/lily/include/spacing-options.hh @@ -31,6 +31,6 @@ struct Spacing_options Spacing_options(); void init_from_grob (Grob *me); - Real get_duration_space (Rational d, bool *) const; + Real get_duration_space (Rational d) const; }; #endif /* SPACING_OPTIONS_HH */ diff --git a/lily/include/spacing-spanner.hh b/lily/include/spacing-spanner.hh index 3018cadebc..60302736bd 100644 --- a/lily/include/spacing-spanner.hh +++ b/lily/include/spacing-spanner.hh @@ -23,7 +23,6 @@ private: Paper_column *nextr, Spacing_options const *options); static Real default_bar_spacing (Grob *, Grob *, Grob *, Moment); - static Real get_duration_space (Moment dur, Spacing_options const *, bool *); static Rational effective_shortest_duration (Grob *me, vector const &all); static void breakable_column_spacing (Grob *, Item *l, Item *r, Spacing_options const *); static void prune_loose_columns (Grob *, vector *cols, Spacing_options *); @@ -34,7 +33,7 @@ private: static bool fills_measure (Grob *, Item *, Item *); public: static vector get_columns (Grob *me); - static Real note_spacing (Grob *, Grob *, Grob *, Spacing_options const *, bool *); + static Real note_spacing (Grob *, Grob *, Grob *, Spacing_options const *); static void standard_breakable_column_spacing (Grob *me, Item *l, Item *r, Real *fixed, Real *space, Spacing_options const *); diff --git a/lily/spacing-basic.cc b/lily/spacing-basic.cc index e0d9daaa00..0d73b4af0b 100644 --- a/lily/spacing-basic.cc +++ b/lily/spacing-basic.cc @@ -76,10 +76,7 @@ Spacing_spanner::standard_breakable_column_spacing (Grob *me, Item *l, Item *r, *space = *fixed + 0.5; } else - { - bool dummy; - *space = *fixed + options->get_duration_space (dt.main_part_, &dummy); - } + *space = *fixed + options->get_duration_space (dt.main_part_); } } @@ -106,8 +103,7 @@ get_measure_length (Grob *column) Real Spacing_spanner::note_spacing (Grob *me, Grob *lc, Grob *rc, - Spacing_options const *options, - bool *expand_only) + Spacing_options const *options) { (void) me; @@ -151,8 +147,7 @@ Spacing_spanner::note_spacing (Grob *me, Grob *lc, Grob *rc, Real dist = 0.0; if (delta_t.main_part_ && !lwhen.grace_part_) { - dist = options->get_duration_space (shortest_playing_len.main_part_, - expand_only); + dist = options->get_duration_space (shortest_playing_len.main_part_); dist *= double (delta_t.main_part_ / shortest_playing_len.main_part_); } else if (delta_t.grace_part_) @@ -162,14 +157,13 @@ Spacing_spanner::note_spacing (Grob *me, Grob *lc, Grob *rc, available (namely the space for the global shortest note), and multiply that by grace-space-factor */ - dist = options->get_duration_space (options->global_shortest_, expand_only) / 2.0; + dist = options->get_duration_space (options->global_shortest_) / 2.0; Grob *grace_spacing = unsmob_grob (lc->get_object ("grace-spacing")); if (grace_spacing) { Spacing_options grace_opts; grace_opts.init_from_grob (grace_spacing); - bool bla; - dist = grace_opts.get_duration_space (delta_t.grace_part_, &bla); + dist = grace_opts.get_duration_space (delta_t.grace_part_); } } diff --git a/lily/spacing-determine-loose-columns.cc b/lily/spacing-determine-loose-columns.cc index 920e66bd03..e491730869 100644 --- a/lily/spacing-determine-loose-columns.cc +++ b/lily/spacing-determine-loose-columns.cc @@ -155,9 +155,8 @@ Spacing_spanner::set_distances_for_loose_col (Grob *me, Grob *c, */ Real space = 0.0; Real fixed = 0.0; - bool dummy = false; - Real base = note_spacing (me, lc, rc, options, &dummy); + Real base = note_spacing (me, lc, rc, options); Note_spacing::get_spacing (sp, rc, base, options->increment_, &space, &fixed); diff --git a/lily/spacing-loose-columns.cc b/lily/spacing-loose-columns.cc index 3a69e26802..ee19b29ab7 100644 --- a/lily/spacing-loose-columns.cc +++ b/lily/spacing-loose-columns.cc @@ -119,13 +119,12 @@ set_loose_columns (System *which, Column_x_positions const *posns) else programming_error ("Column without spacing object"); - bool expand_only = false; Real base_note_space = 0.0; if (Paper_column::is_musical (next_col) && Paper_column::is_musical (loose_col)) - base_note_space = Spacing_spanner::note_spacing (spacing, loose_col, next_col, - &options, &expand_only); + base_note_space = Spacing_spanner::note_spacing (spacing, loose_col, next_col, + &options); else { Real fixed, space; diff --git a/lily/spacing-options.cc b/lily/spacing-options.cc index 8c7b7c3ca5..a3e512525b 100644 --- a/lily/spacing-options.cc +++ b/lily/spacing-options.cc @@ -56,8 +56,7 @@ Spacing_options::Spacing_options () Get the measure wide ant for arithmetic spacing. */ Real -Spacing_options::get_duration_space (Rational d, - bool *expand_only) const +Spacing_options::get_duration_space (Rational d) const { Real k = shortest_duration_space_; @@ -92,7 +91,6 @@ Spacing_options::get_duration_space (Rational d, */ Real log = log_2 (global_shortest_); k -= log; - *expand_only = false; return (log_2 (d) + k) * increment_; } diff --git a/lily/spacing-spanner.cc b/lily/spacing-spanner.cc index a61bffb98a..13c2964edb 100644 --- a/lily/spacing-spanner.cc +++ b/lily/spacing-spanner.cc @@ -167,15 +167,10 @@ Spacing_spanner::generate_pair_spacing (Grob *me, { if (Paper_column::is_musical (left_col)) { - bool skip_unbroken_right = false; - if (!Paper_column::is_musical (right_col) && options->float_nonmusical_columns_ && after_right_col && Paper_column::is_musical (after_right_col)) - skip_unbroken_right = true; - - if (skip_unbroken_right) { /* TODO: should generate rods to prevent collisions. @@ -233,8 +228,7 @@ Spacing_spanner::generate_springs (Grob *me, } /* - Generate the space between two musical columns LEFT_COL and RIGHT_COL, given - spacing parameters INCR and SHORTEST. + Generate the space between two musical columns LEFT_COL and RIGHT_COL. */ void Spacing_spanner::musical_column_spacing (Grob *me, @@ -242,8 +236,7 @@ Spacing_spanner::musical_column_spacing (Grob *me, Item *right_col, Spacing_options const *options) { - bool expand_only = false; - Real base_note_space = note_spacing (me, left_col, right_col, options, &expand_only); + Real base_note_space = note_spacing (me, left_col, right_col, options); Real max_fixed = 0; Real max_space = 0; diff --git a/lily/staff-spacing.cc b/lily/staff-spacing.cc index 79e7028644..e688d60cfb 100644 --- a/lily/staff-spacing.cc +++ b/lily/staff-spacing.cc @@ -71,15 +71,6 @@ Staff_spacing::next_note_correction (Grob *me, if (bar_size.is_empty ()) left_stickout_correction *= 0.75; - /* - We want 0.3 ss before the sticking-out object. - - current_fixed/2 is our guess at (right side of left object + 0.3) - */ - left_stickout_correction += current_fixed/2 - current_space; - left_stickout_correction = max (left_stickout_correction, 0.0); - - Real optical_corr = 0.0; Grob *stem = Note_column::get_stem (g); if (!bar_size.is_empty () @@ -164,8 +155,9 @@ Staff_spacing::next_notes_correction (Grob *me, Grob *last_grob, ) { Interval bar_size = bar_y_positions (last_grob); + Grob *orig = me->original () ? me->original () : me; - extract_grob_set (me, "right-items", right_items); + extract_grob_set (orig, "right-items", right_items); *compound_fixed = 0.0; *compound_space = 0.0; -- 2.39.5