From d257b1bc5c718fe0a98e568a1cc1a15441e79f34 Mon Sep 17 00:00:00 2001 From: hanwen Date: Mon, 1 May 2006 16:29:40 +0000 Subject: [PATCH] * input/regression/tie-arpeggio-collision.ly: new file. * lily/tie-formatting-problem.cc (set_column_chord_outline): new function: store outlines per column rank. --- ChangeLog | 2 ++ Documentation/topdocs/NEWS.tely | 5 ++++ input/regression/tie-arpeggio-collision.ly | 21 +++++++++++++++ input/regression/tie-arpeggio.ly | 11 +++++--- lily/include/tie-formatting-problem.hh | 11 +++++--- lily/tie-formatting-problem.cc | 30 +++++++++++++++------- 6 files changed, 64 insertions(+), 16 deletions(-) create mode 100644 input/regression/tie-arpeggio-collision.ly diff --git a/ChangeLog b/ChangeLog index d9f6a7db3e..e519132909 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2006-05-01 Han-Wen Nienhuys + * input/regression/tie-arpeggio-collision.ly: new file. + * lily/tie-formatting-problem.cc (set_column_chord_outline): new function: store outlines per column rank. diff --git a/Documentation/topdocs/NEWS.tely b/Documentation/topdocs/NEWS.tely index 403b70bdaa..02cd922aaf 100644 --- a/Documentation/topdocs/NEWS.tely +++ b/Documentation/topdocs/NEWS.tely @@ -66,8 +66,13 @@ which scares away people. @end ignore + +@item + @end itemize + + @ifhtml For older news, go to @uref{http://lilypond.org/doc/v2.8/Documentation/topdocs/NEWS.html}, diff --git a/input/regression/tie-arpeggio-collision.ly b/input/regression/tie-arpeggio-collision.ly new file mode 100644 index 0000000000..c8c78d4c53 --- /dev/null +++ b/input/regression/tie-arpeggio-collision.ly @@ -0,0 +1,21 @@ + +\header { + + texidoc = "Advanced tie chord formatting also works with arpegiated +ties. Due to arpeggios, tie directions may be changed relative to the +unarpegiated case." + + +} + +\version "2.9.3" + +\version "2.8.1" +\layout { ragged-right = ##t } +\new Staff \relative c'' { + 2~ | + \set tieWaitForNote = ##t + e8~ c~ a~ f~ 2 | + f,8~ a~ c~ e~ 2 | +} + diff --git a/input/regression/tie-arpeggio.ly b/input/regression/tie-arpeggio.ly index 74b3e742fe..aa94e4736a 100644 --- a/input/regression/tie-arpeggio.ly +++ b/input/regression/tie-arpeggio.ly @@ -1,10 +1,11 @@ \header { - texidoc = "when @code{tieWaitForNote} is set, the right-tied note - does not have to follow the lef-tied note directly. When - @code{tieWaitForNote} is set to false, any tie will erase all pending - ties." + texidoc = + + "when @code{tieWaitForNote} is set, the right-tied note does not + have to follow the lef-tied note directly. When @code{tieWaitForNote} + is set to false, any tie will erase all pending ties." } @@ -21,4 +22,6 @@ \set tieWaitForNote = ##f ~ + | + } diff --git a/lily/include/tie-formatting-problem.hh b/lily/include/tie-formatting-problem.hh index 1b8f203608..94e2f4b373 100644 --- a/lily/include/tie-formatting-problem.hh +++ b/lily/include/tie-formatting-problem.hh @@ -73,12 +73,14 @@ struct Tie_configuration_variation Tie_configuration_variation (); }; -typedef map > Chord_outline_map ; +typedef map > Chord_outline_map; +typedef map Column_extent_map; class Tie_formatting_problem { Chord_outline_map chord_outlines_; - Drul_array< Box > stem_extents_; - Drul_array< Box > head_extents_; + Column_extent_map stem_extents_; + Column_extent_map head_extents_; + set dot_positions_; Interval dot_x_; vector specifications_; @@ -109,6 +111,9 @@ public: Tie_details details_; void print_ties_configuration (Ties_configuration const *); + Interval get_stem_extent (int, Axis) const; + Interval get_head_extent (int, Axis) const; + public: Tie_formatting_problem (); ~Tie_formatting_problem (); diff --git a/lily/tie-formatting-problem.cc b/lily/tie-formatting-problem.cc index 882dd7ae8b..d8b8895070 100644 --- a/lily/tie-formatting-problem.cc +++ b/lily/tie-formatting-problem.cc @@ -147,7 +147,7 @@ Tie_formatting_problem::set_column_chord_outline (vector bounds, insert_extent_into_skyline (&chord_outlines_[column_rank], Box (x,y), Y_AXIS, -dir); - stem_extents_[dir].unite (Box (x,y)); + stem_extents_[column_rank].unite (Box (x,y)); if (dir == LEFT) { @@ -179,10 +179,10 @@ Tie_formatting_problem::set_column_chord_outline (vector bounds, } while (flip (&updowndir) != DOWN); - head_extents_[dir].set_empty (); + head_extents_[column_rank].set_empty (); for (vsize i = 0; i < head_boxes.size (); i++) { - head_extents_[dir].unite (head_boxes[i]); + head_extents_[column_rank].unite (head_boxes[i]); } } @@ -391,12 +391,12 @@ Tie_formatting_problem::generate_configuration (int pos, Direction dir, } if (y_tune - && max (fabs (head_extents_[LEFT][Y_AXIS][dir] - y), - fabs (head_extents_[RIGHT][Y_AXIS][dir] - y)) < 0.25 + && max (fabs (get_head_extent (columns[LEFT], Y_AXIS)[dir] - y), + fabs (get_head_extent (columns[RIGHT],Y_AXIS)[dir] - y)) < 0.25 && !Staff_symbol_referencer::on_line (details_.staff_symbol_referencer_, pos)) { conf->delta_y_ = - (head_extents_[LEFT][Y_AXIS][dir] - y) + (get_head_extent (columns[LEFT], Y_AXIS)[dir] - y) + dir * details_.outer_tie_vertical_gap_; } @@ -467,19 +467,31 @@ Tie_formatting_problem::generate_configuration (int pos, Direction dir, do { Real y = conf->position_ * details_.staff_space_ * 0.5 + conf->delta_y_; - if (stem_extents_[d][X_AXIS].is_empty () - || !stem_extents_[d][Y_AXIS].contains (y)) + if (get_stem_extent (conf->column_ranks_[d], X_AXIS).is_empty () + || !get_stem_extent (conf->column_ranks_[d], Y_AXIS).contains (y)) continue; conf->attachment_x_[d] = d * min (d * conf->attachment_x_[d], - d * (stem_extents_[d][X_AXIS][-d] - d * details_.stem_gap_)); + d * (get_stem_extent (conf->column_ranks_[d], X_AXIS)[-d] - d * details_.stem_gap_)); } while (flip (&d) != LEFT); return conf; } +Interval +Tie_formatting_problem::get_head_extent (int col, Axis a) const +{ + return (*head_extents_.find (col)).second[a]; +} + +Interval +Tie_formatting_problem::get_stem_extent (int col, Axis a) const +{ + return (*stem_extents_.find (col)).second[a]; +} + /** TIE_IDX and TIES_CONF are optional. */ -- 2.39.5