diff options
author | Han-Wen Nienhuys <hanwen@xs4all.nl> | 2006-11-25 01:42:38 +0100 |
---|---|---|
committer | Han-Wen Nienhuys <hanwen@xs4all.nl> | 2006-11-25 01:42:38 +0100 |
commit | 1706d83504f6735184779da8881fe8c59873cc2e (patch) | |
tree | 3890b8b40187badacf24f19627c91048932ed05a | |
parent | 7668add3e54645814be757b0ed5c1a59ab26e952 (diff) |
ignore barlines in slur formatting. Fixes #156.
-rw-r--r-- | input/regression/slur-clef.ly | 9 | ||||
-rw-r--r-- | lily/include/slur.hh | 1 | ||||
-rw-r--r-- | lily/slur-scoring.cc | 3 | ||||
-rw-r--r-- | lily/slur.cc | 40 | ||||
-rw-r--r-- | scm/define-grobs.scm | 3 |
5 files changed, 51 insertions, 5 deletions
diff --git a/input/regression/slur-clef.ly b/input/regression/slur-clef.ly index 86d27fbe03..c230f6e55a 100644 --- a/input/regression/slur-clef.ly +++ b/input/regression/slur-clef.ly @@ -1,6 +1,11 @@ +\header { + texidoc = "Slurs avoid clefs, but don't avoid barlines." + } + \paper { ragged-right = ##t - } + +} \version "2.10.0" -\new Staff { \clef bass c^( \clef "G" g') } +\new Staff { \clef bass c4^( \clef "G" g'4) c''1_( f'') } diff --git a/lily/include/slur.hh b/lily/include/slur.hh index 20667dd25c..d8603485d5 100644 --- a/lily/include/slur.hh +++ b/lily/include/slur.hh @@ -19,6 +19,7 @@ class Slur public: static void add_column (Grob *me, Grob *col); static void add_extra_encompass (Grob *me, Grob *col); + static void replace_breakable_encompass_objects (Grob *me); static void auxiliary_acknowledge_extra_object (Grob_info, vector<Grob*>&, vector<Grob*>&); DECLARE_SCHEME_CALLBACK (print, (SCM)); DECLARE_SCHEME_CALLBACK (calc_control_points, (SCM)); diff --git a/lily/slur-scoring.cc b/lily/slur-scoring.cc index ba8f5c80cc..34e20519c9 100644 --- a/lily/slur-scoring.cc +++ b/lily/slur-scoring.cc @@ -224,13 +224,14 @@ Slur_score_state::fill (Grob *me) slur_ = dynamic_cast<Spanner *> (me); columns_ = internal_extract_grob_array (me, ly_symbol2scm ("note-columns")); - + if (columns_.empty ()) { me->suicide (); return; } + Slur::replace_breakable_encompass_objects (me); staff_space_ = Staff_symbol_referencer::staff_space (me); Real lt = me->layout ()->get_dimension (ly_symbol2scm ("line-thickness")); thickness_ = robust_scm2double (me->get_property ("thickness"), 1.0) * lt; diff --git a/lily/slur.cc b/lily/slur.cc index 0128e8cdfd..a87feb6850 100644 --- a/lily/slur.cc +++ b/lily/slur.cc @@ -9,7 +9,7 @@ #include "slur.hh" - +#include "grob-array.hh" #include "beam.hh" #include "bezier.hh" #include "directional-element-interface.hh" @@ -27,7 +27,7 @@ #include "tie.hh" #include "warn.hh" #include "slur-scoring.hh" - +#include "separation-item.hh" #include "script-interface.hh" @@ -160,6 +160,42 @@ Slur::print (SCM smob) return a.smobbed_copy (); } + +/* + it would be better to do this at engraver level, but that is + fragile, as the breakabl items are generated on staff level, at + which point slur starts and ends have to be tracked +*/ +void +Slur::replace_breakable_encompass_objects (Grob *me) +{ + extract_grob_set (me, "encompass-objects", extra_objects); + vector<Grob *> new_encompasses; + + for (vsize i = 0; i < extra_objects.size (); i++) + { + Grob *g = extra_objects[i]; + + if (Separation_item::has_interface (g)) + { + extract_grob_set (g, "elements", breakables); + for (vsize j = 0; j < breakables.size (); j++) + if (breakables[j]->get_property ("avoid-slur") == ly_symbol2scm ("inside")) + new_encompasses.push_back (breakables[j]); + } + else + new_encompasses.push_back (g); + } + + SCM encompass_scm = me->get_object ("encompass-objects"); + if (Grob_array::unsmob (encompass_scm)) + { + vector<Grob *> &arr = + unsmob_grob_array (encompass_scm)->array_reference (); + arr = new_encompasses; + } +} + Bezier Slur::get_curve (Grob *me) { diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index 3b8dd7abbc..bd5dee7706 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -422,6 +422,7 @@ (stencil . ,ly:clef::print) (glyph-name . ,ly:clef::calc-glyph-name) (non-musical . #t) + (avoid-slur . inside) (font-family . music) (break-align-symbol . clef) (break-visibility . ,begin-of-line-visible) @@ -793,6 +794,7 @@ (KeySignature . ( (stencil . ,ly:key-signature-interface::print) + (avoid-slur . inside) (space-alist . ( (time-signature . (extra-space . 1.15)) (staff-bar . (extra-space . 1.1)) @@ -1808,6 +1810,7 @@ (stencil . ,ly:time-signature::print) (break-align-symbol . time-signature) (break-visibility . ,all-visible) + (avoid-slur . inside) (space-alist . ( (first-note . (fixed-space . 2.0)) (right-edge . (extra-space . 0.5)) |