From adedeba2802571e8e705c46f1d4a56205fe83e16 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Fri, 23 Dec 2005 12:06:56 +0000 Subject: [PATCH] * lily/slur-configuration.cc (score_extra_encompass): don't use bound->column() == avoid->column() for checking extents, as this doesn't work for accidentals. * lily/slur-engraver.cc (acknowledge_extra_object): remove DynamicText hardcoding. * lily/slur-scoring.cc (enumerate_attachments): robustness: don't crash if bound stem is NULL * lily/piano-pedal-performer.cc: patch by MWD for enabling piano pedals. --- ChangeLog | 20 ++++++++++- THANKS | 1 + lily/include/main.hh | 5 +-- lily/include/slur-scoring.hh | 2 +- lily/piano-pedal-performer.cc | 4 +++ lily/slur-configuration.cc | 13 +++++--- lily/slur-engraver.cc | 10 ++++-- lily/slur-scoring.cc | 63 +++++++++++++++++++---------------- scm/define-grobs.scm | 2 +- 9 files changed, 79 insertions(+), 41 deletions(-) diff --git a/ChangeLog b/ChangeLog index 927f44b64c..ae9f2b229e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2005-12-23 Han-Wen Nienhuys + + * lily/slur-configuration.cc (score_extra_encompass): don't use + bound->column() == avoid->column() for checking extents, as this + doesn't work for accidentals. + + * lily/slur-engraver.cc (acknowledge_extra_object): remove + DynamicText hardcoding. + + * lily/slur-scoring.cc (enumerate_attachments): robustness: don't + crash if bound stem is NULL + + * lily/piano-pedal-performer.cc: patch by MWD for enabling piano + pedals. + 2005-12-22 Graham Percival * scm/define-markup-commands.scm: typo. @code{\raise} @@ -17,7 +32,10 @@ 2005-12-21 Han-Wen Nienhuys - * stepmake/bin/install.py (dest): don't create existing. + * lily/slur-configuration.cc (score_extra_encompass): don't use + "avoid" choice for avoid-slur. + + * stepmake/bin/install.py (dest): don't create existing dir. 2005-12-21 Jan Nieuwenhuizen diff --git a/THANKS b/THANKS index ec17d8d488..ecb68c0397 100644 --- a/THANKS +++ b/THANKS @@ -78,6 +78,7 @@ Vicente Solsona Dellá Vincenzo Colonnella Werner Lemberg Will Oram +Wolfgang Hoffmann Release 2.6 *********** diff --git a/lily/include/main.hh b/lily/include/main.hh index 4dcda0f86a..ca059cbc7f 100644 --- a/lily/include/main.hh +++ b/lily/include/main.hh @@ -54,10 +54,11 @@ extern const char *LILYPOND_DATADIR; /* Debugging options: switch on + + Cannot switch on -DNDEBUG, because it causes weird errors if you mix + DNDEBUG and normal builds. */ -#ifndef NDEBUG #define DEBUG_SLUR_SCORING 1 -#endif #endif /* MAIN_HH */ diff --git a/lily/include/slur-scoring.hh b/lily/include/slur-scoring.hh index deeab48589..4d3e742da3 100644 --- a/lily/include/slur-scoring.hh +++ b/lily/include/slur-scoring.hh @@ -81,7 +81,7 @@ struct Bound_info Grob *slur_head_; Grob *staff_; Grob *stem_; - Interval slur_head_extent_; + Interval slur_head_x_extent_; Real staff_space_; Bound_info () diff --git a/lily/piano-pedal-performer.cc b/lily/piano-pedal-performer.cc index ea4889f11b..7464389189 100644 --- a/lily/piano-pedal-performer.cc +++ b/lily/piano-pedal-performer.cc @@ -84,6 +84,8 @@ Piano_pedal_performer::process_music () a->type_string_ = String (p->name_); a->dir_ = STOP; audios_.push (a); + Audio_element_info info(a, p->event_drul_[STOP]); + announce_element (info); } p->start_event_ = 0; } @@ -95,6 +97,8 @@ Piano_pedal_performer::process_music () a->type_string_ = String (p->name_); a->dir_ = START; audios_.push (a); + Audio_element_info info(a, p->event_drul_[START]); + announce_element (info); } p->event_drul_[START] = 0; p->event_drul_[STOP] = 0; diff --git a/lily/slur-configuration.cc b/lily/slur-configuration.cc index 2b5a090822..4d32a9a545 100644 --- a/lily/slur-configuration.cc +++ b/lily/slur-configuration.cc @@ -322,14 +322,17 @@ Slur_configuration::score_extra_encompass (Slur_score_state const &state) distance. */ Item *as_item = dynamic_cast (state.extra_encompass_infos_[j].grob_); - if ((as_item - && as_item->get_column () - == state.extremes_[d].bound_->get_column ()) - || state.extra_encompass_infos_[j].extents_[X_AXIS].contains (attachment[d][X_AXIS])) + if (!as_item) + continue; + + Interval item_x = as_item->extent (state.common_[X_AXIS], X_AXIS); + item_x.intersect (state.extremes_[d].slur_head_x_extent_); + if (!item_x.is_empty ()) { y = attachment[d][Y_AXIS]; found = true; } + } while (flip (&d) != LEFT); @@ -344,7 +347,7 @@ Slur_configuration::score_extra_encompass (Slur_score_state const &state) } Real dist = 0.0; - if (info.type_ == ly_symbol2scm ("avoid")) + if (info.type_ == ly_symbol2scm ("around")) dist = info.extents_[Y_AXIS].distance (y); /* diff --git a/lily/slur-engraver.cc b/lily/slur-engraver.cc index 2dfe2fec10..2dd0d01ec3 100644 --- a/lily/slur-engraver.cc +++ b/lily/slur-engraver.cc @@ -93,6 +93,10 @@ Slur_engraver::acknowledge_note_column (Grob_info info) void Slur_engraver::acknowledge_extra_object (Grob_info info) { + if (slurs_.is_empty () + && end_slurs_.is_empty ()) + return ; + Grob *e = info.grob (); SCM avoid = e->get_property ("avoid-slur"); if (Tie::has_interface (e) @@ -103,9 +107,8 @@ Slur_engraver::acknowledge_extra_object (Grob_info info) for (int i = end_slurs_.size (); i--;) Slur::add_extra_encompass (end_slurs_[i], e); } - else if ((avoid == ly_symbol2scm ("outside") - || avoid == ly_symbol2scm ("around")) - && e->name () != "DynamicText") + else if (avoid == ly_symbol2scm ("outside") + || avoid == ly_symbol2scm ("around")) { Grob *slur = slurs_.size () ? slurs_[0] : 0; slur = (end_slurs_.size () && !slur) @@ -155,6 +158,7 @@ Slur_engraver::acknowledge_script (Grob_info info) void Slur_engraver::acknowledge_text_script (Grob_info info) { + // if (!info.grob ()->internal_has_interface (ly_symbol2scm ("DynamicText"))) acknowledge_extra_object (info); } diff --git a/lily/slur-scoring.cc b/lily/slur-scoring.cc index b808375fb7..64246d9a9f 100644 --- a/lily/slur-scoring.cc +++ b/lily/slur-scoring.cc @@ -236,38 +236,41 @@ Slur_score_state::get_bound_info () const { extremes[d].note_column_ = extremes[d].bound_; extremes[d].stem_ = Note_column::get_stem (extremes[d].note_column_); - extremes[d].stem_dir_ = get_grob_direction (extremes[d].stem_); - - for (int a = X_AXIS; a < NO_AXES; a++) + if (extremes[d].stem_) { - Axis ax = Axis (a); - Interval s = extremes[d].stem_->extent (common_[ax], ax); - if (s.is_empty ()) + extremes[d].stem_dir_ = get_grob_direction (extremes[d].stem_); + + for (int a = X_AXIS; a < NO_AXES; a++) { - /* - do not issue warning. This happens for rests and - whole notes. - */ - s = Interval (0, 0) - + extremes[d].stem_->relative_coordinate (common_[ax], ax); + Axis ax = Axis (a); + Interval s = extremes[d].stem_->extent (common_[ax], ax); + if (s.is_empty ()) + { + /* + do not issue warning. This happens for rests and + whole notes. + */ + s = Interval (0, 0) + + extremes[d].stem_->relative_coordinate (common_[ax], ax); + } + extremes[d].stem_extent_[ax] = s; } - extremes[d].stem_extent_[ax] = s; - } - extremes[d].slur_head_ - = Stem::extremal_heads (extremes[d].stem_)[dir]; - if (!extremes[d].slur_head_ - && Note_column::has_rests (extremes[d].bound_)) - extremes[d].slur_head_ = Note_column::get_rest (extremes[d].bound_); + extremes[d].slur_head_ + = Stem::extremal_heads (extremes[d].stem_)[dir]; + if (!extremes[d].slur_head_ + && Note_column::has_rests (extremes[d].bound_)) + extremes[d].slur_head_ = Note_column::get_rest (extremes[d].bound_); + extremes[d].staff_ = Staff_symbol_referencer + ::get_staff_symbol (extremes[d].stem_); + extremes[d].staff_space_ = Staff_symbol_referencer + ::staff_space (extremes[d].stem_); + } if (extremes[d].slur_head_) - extremes[d].slur_head_extent_ + extremes[d].slur_head_x_extent_ = extremes[d].slur_head_->extent (common_[X_AXIS], X_AXIS); - extremes[d].staff_ = Staff_symbol_referencer - ::get_staff_symbol (extremes[d].stem_); - extremes[d].staff_space_ = Staff_symbol_referencer - ::staff_space (extremes[d].stem_); } } while (flip (&d) != LEFT); @@ -343,7 +346,8 @@ Slur_score_state::fill (Grob *me) Direction d = LEFT; do { - if (!is_broken_) + if (!is_broken_ + && extremes_[d].slur_head_) musical_dy_ += d * extremes_[d].slur_head_->relative_coordinate (common_[Y_AXIS], Y_AXIS); } @@ -598,6 +602,9 @@ Real Slur_score_state::move_away_from_staffline (Real y, Grob *on_staff) const { + if (!on_staff) + return y; + Grob *staff_symbol = Staff_symbol_referencer::get_staff_symbol (on_staff); if (!staff_symbol) return y; @@ -723,9 +730,9 @@ Slur_score_state::enumerate_attachments (Drul_array end_ys) const do { if (extremes_[d].slur_head_ - && !extremes_[d].slur_head_extent_.is_empty ()) + && !extremes_[d].slur_head_x_extent_.is_empty ()) { - os[d][X_AXIS] = extremes_[d].slur_head_extent_.center (); + os[d][X_AXIS] = extremes_[d].slur_head_x_extent_.center (); attach_to_stem[d] = false; } } @@ -743,7 +750,7 @@ Slur_score_state::enumerate_attachments (Drul_array end_ys) const TODO: parameter */ os[d][X_AXIS] - -= dir_ * extremes_[d].slur_head_extent_.length () + -= dir_ * extremes_[d].slur_head_x_extent_.length () * sin (dz.arg ()) / 3; } } diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index 0c5ea1c732..44ba247e45 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -593,7 +593,7 @@ (font-series . bold) (font-encoding . fetaDynamic) (font-shape . italic) - (avoid-slur . avoid) + (avoid-slur . around) (no-spacing-rods . #t) (script-priority . 100) (meta . ((class . Item) -- 2.39.2