X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Farpeggio.cc;h=5322a46c95fcdeceecb01cbc189f3903269d5a9d;hb=2a00c69a012d4ccaf24a036bdb5ac9ea43fb9604;hp=56066912fb6e156a87ba938cba89bfc1118b7592;hpb=9f114c6402fb7cf9c9bf0ea97ee7c16291c48193;p=lilypond.git diff --git a/lily/arpeggio.cc b/lily/arpeggio.cc index 56066912fb..5322a46c95 100644 --- a/lily/arpeggio.cc +++ b/lily/arpeggio.cc @@ -18,12 +18,9 @@ #include "lookup.hh" #include "pointer-group-interface.hh" -MAKE_SCHEME_CALLBACK (Arpeggio, print, 1); -SCM -Arpeggio::print (SCM smob) +Grob * +Arpeggio::get_common_y (Grob *me) { - Grob *me = unsmob_grob (smob); - Grob *common = me; extract_grob_set (me, "stems", stems); @@ -34,17 +31,27 @@ Arpeggio::print (SCM smob) Y_AXIS); } + return common; +} + +MAKE_SCHEME_CALLBACK(Arpeggio, calc_positions, 1); +SCM +Arpeggio::calc_positions (SCM grob) +{ + Grob *me = unsmob_grob (grob); + Grob *common = get_common_y (me); + /* TODO: Using stems here is not very convenient; should store noteheads instead, and also put them into the support. Now we will mess up in vicinity of a collision. - */ Interval heads; Real my_y = me->relative_coordinate (common, Y_AXIS); + extract_grob_set (me, "stems", stems); for (vsize i = 0; i < stems.size (); i++) { Grob *stem = stems[i]; @@ -56,6 +63,20 @@ Arpeggio::print (SCM smob) - my_y); } + heads *= 1/Staff_symbol_referencer::staff_space(me); + + return ly_interval2scm (heads); +} + +MAKE_SCHEME_CALLBACK (Arpeggio, print, 1); +SCM +Arpeggio::print (SCM smob) +{ + Grob *me = unsmob_grob (smob); + Interval heads = robust_scm2interval (me->get_property ("positions"), + Interval()) + * Staff_symbol_referencer::staff_space (me); + if (heads.is_empty () || heads.length () < 0.5) { if (!to_boolean (me->get_property ("transparent"))) @@ -101,27 +122,9 @@ SCM Arpeggio::brew_chord_bracket (SCM smob) { Grob *me = unsmob_grob (smob); - Grob *common = me; - - extract_grob_set (me, "stems", stems); - for (vsize i = 0; i < stems.size (); i++) - { - Grob *stem = stems[i]; - common = common->common_refpoint (Staff_symbol_referencer::get_staff_symbol (stem), - Y_AXIS); - } - - Interval heads; - Real my_y = me->relative_coordinate (common, Y_AXIS); - - for (vsize i = 0; i < stems.size (); i++) - { - Grob *stem = stems[i]; - Grob *ss = Staff_symbol_referencer::get_staff_symbol (stem); - Interval iv = Stem::head_positions (stem); - iv *= Staff_symbol::staff_space (ss) / 2.0; - heads.unite (iv + ss->relative_coordinate (common, Y_AXIS) - my_y); - } + Interval heads = robust_scm2interval (me->get_property ("positions"), + Interval()) + * Staff_symbol_referencer::staff_space (me); Real lt = me->layout ()->get_dimension (ly_symbol2scm ("line-thickness")); Real sp = 1.5 * Staff_symbol_referencer::staff_space (me); @@ -165,29 +168,13 @@ Arpeggio::pure_height (SCM smob, SCM, SCM) return height (smob); } -MAKE_SCHEME_CALLBACK (Arpeggio, calc_cross_staff, 1); -SCM -Arpeggio::calc_cross_staff (SCM smob) -{ - Grob *me = unsmob_grob (smob); - extract_grob_set (me, "stems", stems); - - for (vsize i = 1; i < stems.size (); i++) - { - Grob *s1 = Staff_symbol_referencer::get_staff_symbol (stems[i-1]); - Grob *s2 = Staff_symbol_referencer::get_staff_symbol (stems[i]); - if (s1 != s2) - return SCM_BOOL_T; - } - return SCM_BOOL_F; -} - ADD_INTERFACE (Arpeggio, "Functions and settings for drawing an arpeggio symbol (a wavy line left to noteheads.", /* properties */ "arpeggio-direction " - "stems " + "positions " "script-priority " // TODO: make around-note-interface + "stems " );