From 58dbdca5f9c0a3008dcf3ed9c1ef89164906a333 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Sun, 19 Feb 2006 15:14:00 +0000 Subject: [PATCH] * lily/tie-formatting-problem.cc (set_chord_outline): put dots in outline too. (generate_configuration): for small ties, also look for collisions at Y + DIR*h + DELTA_Y. (get_variations): consider variation for dot positions too. * lily/side-position-interface.cc (aligned_side): take abs for quantized rounded position. Fixes tenuto below staff. --- ChangeLog | 9 ++++++ THANKS | 6 ++++ lily/side-position-interface.cc | 2 +- lily/tie-formatting-problem.cc | 54 ++++++++++++++++++++++++--------- 4 files changed, 56 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 75233cb455..42d5170bfe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2006-02-19 Han-Wen Nienhuys + * lily/tie-formatting-problem.cc (set_chord_outline): put dots + in outline too. + (generate_configuration): for small ties, also look for collisions + at Y + DIR*h + DELTA_Y. + (get_variations): consider variation for dot positions too. + + * lily/side-position-interface.cc (aligned_side): take abs for + quantized rounded position. Fixes tenuto below staff. + * scm/stencil.scm (annotate-y-interval): robustify: print nan/inf markers when necessary. diff --git a/THANKS b/THANKS index a6ea1c4379..c674cfc166 100644 --- a/THANKS +++ b/THANKS @@ -53,10 +53,12 @@ Vicente Solsona Dellá BUG HUNTERS/SUGGESTIONS +Bertalan Fodor Bob Broadus Chris Sawer Christian Ebert Darius Blasband +David Bobroff Donald Axel Don Blaheta Edward Neeman @@ -66,18 +68,22 @@ Frédéric Bron Hans Forbrich Joe Neeman Jukka Akkanen +Kieren Richard MacMillan Lambros Lambrou Laura Conrad Mark Steinheuser Matevž Jekovec Michael Welsh Duggan Milan Zamazal +Orm Finnendahl Patrick K Welton +Paul Scott Ralph Little Scott Russell Sean Reed Steven Weber Sven Axelsson +Thomas Scharkowski Thomas Bushnell BSG Trent Johnston Trevor Bača diff --git a/lily/side-position-interface.cc b/lily/side-position-interface.cc index f5f51bced2..8836e30d24 100644 --- a/lily/side-position-interface.cc +++ b/lily/side-position-interface.cc @@ -180,7 +180,7 @@ Side_position_interface::aligned_side (Grob *me, Axis a) Real rounded = directed_round (position, dir); Grob *head = me->get_parent (X_AXIS); - if (rounded <= 2 * Staff_symbol_referencer::staff_radius (me) + if (fabs (rounded) <= 2 * Staff_symbol_referencer::staff_radius (me) || (Note_head::has_interface (head) && sign (Staff_symbol_referencer::get_position (head)) == - dir)) { diff --git a/lily/tie-formatting-problem.cc b/lily/tie-formatting-problem.cc index 916cb04adf..fb3b74ad39 100644 --- a/lily/tie-formatting-problem.cc +++ b/lily/tie-formatting-problem.cc @@ -65,6 +65,7 @@ Tie_formatting_problem::set_chord_outline (vector bounds, Real staff_space = Staff_symbol_referencer::staff_space (bounds[0]); vector boxes; + vector head_boxes; Grob *stem = 0; for (vsize i = 0; i < bounds.size (); i++) @@ -81,26 +82,26 @@ Tie_formatting_problem::set_chord_outline (vector bounds, (p+1) * 0.5 * staff_space); Interval x = head->extent (x_refpoint_, X_AXIS); + head_boxes.push_back (Box (x, y)); boxes.push_back (Box (x, y)); Grob *dots = Rhythmic_head::get_dots (head); if (d == LEFT && dots) { Interval x = dots->extent (x_refpoint_, X_AXIS); - Interval y (-0.5, 0.5); int p = int (Staff_symbol_referencer::get_position (dots)); - y.translate (p); dot_positions_.insert (p); dot_x_.unite (x); + + Interval y (dots->extent (dots, Y_AXIS)); + y.translate (p * staff_space * 0.5); - y *= staff_space * 0.5; - // boxes.push_back (Box (x, y)); + boxes.push_back (Box (x, y)); } } chord_outlines_[d] = empty_skyline (-d); - if (bounds[0]->break_status_dir ()) { Real x = robust_relative_extent (bounds[0], x_refpoint_, X_AXIS)[-d]; @@ -142,9 +143,9 @@ Tie_formatting_problem::set_chord_outline (vector bounds, { Interval x; Interval y; - if (boxes.size()) + if (head_boxes.size()) { - Box b = boundary (boxes, updowndir, 0); + Box b = boundary (head_boxes, updowndir, 0); x = b[X_AXIS]; x[-d] = b[X_AXIS].linear_combination (-d / 2); y[-updowndir] = b[Y_AXIS][updowndir]; @@ -299,7 +300,7 @@ Tie_formatting_problem::get_configuration (int pos, Direction dir) } - Tie_configuration *conf = generate_configuration (pos,dir); + Tie_configuration *conf = generate_configuration (pos, dir); possibilities_[key] = conf; return conf; } @@ -320,6 +321,21 @@ Tie_formatting_problem::generate_configuration (int pos, Direction dir) const conf->attachment_x_ = get_attachment (y + conf->delta_y_); Real h = conf->height (details_); + + if (h < details_.intra_space_threshold_ * 0.5 * details_.staff_space_) + { + /* + This is less sensible for long ties, since those are more + horizontal. + */ + Interval close_by = get_attachment (y + + conf->delta_y_ + + (dir * details_.intra_space_threshold_ * 0.25 + * details_.staff_space_)); + + conf->attachment_x_.intersect (close_by); + } + if (!conf->delta_y_) { /* @@ -776,12 +792,22 @@ Tie_formatting_problem::get_variations (Ties_configuration const &ties) vars.push_back (var); } } + else if (dot_positions_.find (ties[i].position_) != dot_positions_.end () + && !specifications_[i].has_manual_position_) + { + Tie_configuration_variation var; + var.index_ = i; + var.suggestion_ = get_configuration (ties[i].position_ + ties[i].dir_, + ties[i].dir_); + vars.push_back (var); + } + } last_center = center; } - /* TODO: switch off? */ + /* TODO: switch off? */ Direction d = DOWN; do { @@ -811,16 +837,16 @@ Tie_formatting_problem::set_manual_tie_configuration (SCM manual_configs) { Tie_specification &spec = specifications_[k]; - if (scm_is_number (scm_cdr (entry))) - { - spec.has_manual_dir_ = true; - spec.manual_dir_ = Direction (scm_to_int (scm_cdr (entry))); - } if (scm_is_number (scm_car (entry))) { spec.has_manual_position_ = true; spec.manual_position_ = scm_to_double (scm_car (entry)); } + if (scm_is_number (scm_cdr (entry))) + { + spec.has_manual_dir_ = true; + spec.manual_dir_ = Direction (scm_to_int (scm_cdr (entry))); + } } k ++; } -- 2.39.2