From: Han-Wen Nienhuys Date: Wed, 20 Dec 2006 00:03:16 +0000 (+0100) Subject: Always cap shortest_playing_len by measure length. X-Git-Tag: release/2.11.4-1~13^2~10 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=0cc1af9f69a346f5df1314d658571cd804b1c1ee;p=lilypond.git Always cap shortest_playing_len by measure length. Make get_measure_length() more efficient by using Paper_column::get_rank as array index. --- diff --git a/lily/spacing-basic.cc b/lily/spacing-basic.cc index 2e81fdf416..4387c788be 100644 --- a/lily/spacing-basic.cc +++ b/lily/spacing-basic.cc @@ -86,14 +86,7 @@ get_measure_length (Grob *column) extract_grob_set (sys, "columns", cols); - vsize col_idx = binary_search (cols, column, - Paper_column::less_than); - - if (col_idx == VPOS) - { - programming_error ( __FUNCTION__ + string (": Unknown column")); - return 0; - } + vsize col_idx = Paper_column::get_rank (column); do { @@ -130,25 +123,26 @@ Spacing_spanner::note_spacing (Grob *me, Grob *lc, Grob *rc, Moment rwhen = Paper_column::when_mom (rc); Moment delta_t = rwhen - lwhen; - if (!Paper_column::is_musical (rc)) + + /* + when toying with mmrests, it is possible to have musical + column on the left and non-musical on the right, spanning + several measures. + + TODO: efficiency: measure length can be cached, or stored as + property in paper-column. + */ + + Moment *dt = get_measure_length (lc); + if (dt) { + delta_t = min (delta_t, *dt); + /* - when toying with mmrests, it is possible to have musical - column on the left and non-musical on the right, spanning - several measures. + The following is an extra safety measure, such that + the length of a mmrest event doesn't cause havoc. */ - - Moment *dt = get_measure_length (lc); - if (dt) - { - delta_t = min (delta_t, *dt); - - /* - The following is an extra safety measure, such that - the length of a mmrest event doesn't cause havoc. - */ - shortest_playing_len = min (shortest_playing_len, *dt); - } + shortest_playing_len = min (shortest_playing_len, *dt); } Real dist = 0.0; diff --git a/lily/system.cc b/lily/system.cc index 90eb463c44..3ca397976b 100644 --- a/lily/system.cc +++ b/lily/system.cc @@ -245,10 +245,7 @@ System::add_column (Paper_column *p) ga = unsmob_grob_array (scm_ga); } - p->rank_ - = ga->size () - ? Paper_column::get_rank (ga->array ().back ()) + 1 - : 0; + p->rank_ = ga->size (); ga->add (p); Axis_group_interface::add_element (this, p);