From af905f3b9d601267d812cf5ed98768d5b09e45b3 Mon Sep 17 00:00:00 2001 From: fred Date: Tue, 26 Mar 2002 23:24:27 +0000 Subject: [PATCH] lilypond-1.3.70 --- lily/beam.cc | 281 ++++++++++++------------- lily/break-algorithm.cc | 17 +- lily/gourlay-breaking.cc | 10 +- lily/grace-align-item.cc | 20 +- lily/include/break-algorithm.hh | 6 +- lily/include/column-x-positions.hh | 2 +- lily/include/item.hh | 2 +- lily/include/line-of-score.hh | 2 +- lily/include/paper-column.hh | 44 ++-- lily/include/simple-spacer.hh | 2 +- lily/include/spaceable-element.hh | 29 +++ lily/include/spacing-spanner.hh | 22 +- lily/include/spanner.hh | 5 - lily/item.cc | 25 ++- lily/line-of-score.cc | 26 ++- lily/paper-column.cc | 76 ++----- lily/paper-score.cc | 2 +- lily/rod.cc | 13 +- lily/score-engraver.cc | 2 +- lily/script-column-engraver.cc | 2 +- lily/separating-line-group-engraver.cc | 7 +- lily/spring.cc | 5 +- 22 files changed, 273 insertions(+), 327 deletions(-) create mode 100644 lily/include/spaceable-element.hh diff --git a/lily/beam.cc b/lily/beam.cc index 604c4d356b..9e59ec6485 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -18,12 +18,12 @@ #include // tanh. + + #include "directional-element-interface.hh" #include "beaming.hh" -#include "dimensions.hh" #include "beam.hh" #include "misc.hh" -#include "debug.hh" #include "least-squares.hh" #include "stem.hh" #include "paper-def.hh" @@ -31,38 +31,27 @@ #include "group-interface.hh" #include "staff-symbol-referencer.hh" #include "cross-staff.hh" - -Beam::Beam (SCM s) - : Spanner (s) -{ - Score_element*me =this; - - Pointer_group_interface g (me, "stems"); - g.set_interface (); - - set_elt_property ("height", gh_int2scm (0)); // ugh. - set_elt_property ("y-position" ,gh_int2scm (0)); -} +#include "item.hh" +#include "spanner.hh" +#include "warn.hh" void -Beam::add_stem (Score_element*s) +Beam::add_stem (Score_element*me, Score_element*s) { - Score_element*me =this; Pointer_group_interface gi (me, "stems"); gi.add_element (s); s->add_dependency (me); assert (!Stem::beam_l (s)); - s->set_elt_property ("beam", self_scm_); + s->set_elt_property ("beam", me->self_scm_); add_bound_item (dynamic_cast (me), dynamic_cast (s)); } int -Beam::get_multiplicity () const +Beam::get_multiplicity (Score_element*me) { - Score_element*me =(Score_element*)this; int m = 0; for (SCM s = me->get_elt_property ("stems"); gh_pair_p (s); s = gh_cdr (s)) { @@ -86,23 +75,20 @@ MAKE_SCHEME_CALLBACK(Beam,before_line_breaking); SCM Beam::before_line_breaking (SCM smob) { - - Score_element * beam = unsmob_element (smob); - Beam * me =dynamic_cast (beam); + Score_element * me = unsmob_element (smob); // Why? - if (me->visible_stem_count () < 2) + if (visible_stem_count (me) < 2) { warning (_ ("beam has less than two stems")); - } if (!Directional_element_interface (me).get ()) - Directional_element_interface (me).set (me->get_default_dir ()); + Directional_element_interface (me).set (get_default_dir (me)); - me->auto_knees (); - me->set_stem_directions (); - me->set_stem_shorten (); + auto_knees (me); + set_stem_directions (me); + set_stem_shorten (me); return SCM_EOL; } @@ -111,14 +97,14 @@ Beam::before_line_breaking (SCM smob) FIXME */ Direction -Beam::get_default_dir () const +Beam::get_default_dir (Score_element*me) { Drul_array total; total[UP] = total[DOWN] = 0; Drul_array count; count[UP] = count[DOWN] = 0; Direction d = DOWN; - Spanner*me = (Spanner*)this; + Link_array stems= Pointer_group_interface__extract_elements (me, (Item*)0, "stems"); @@ -150,7 +136,7 @@ Beam::get_default_dir () const /* If dir is not determined: get default */ - return to_dir (get_elt_property ("default-neutral-direction")); + return to_dir (me->get_elt_property ("default-neutral-direction")); } @@ -160,11 +146,11 @@ Beam::get_default_dir () const once stem gets cleaned-up. */ void -Beam::set_stem_directions () +Beam::set_stem_directions (Score_element*me) { Link_array stems - =Pointer_group_interface__extract_elements (this, (Item*) 0, "stems"); - Direction d = Directional_element_interface (this).get (); + =Pointer_group_interface__extract_elements (me, (Item*) 0, "stems"); + Direction d = Directional_element_interface (me).get (); for (int i=0; i get_elt_property (gap_str.ch_C()); Direction d = Directional_element_interface (me).get (); Link_array stems= @@ -203,15 +188,16 @@ Beam::auto_knee (String gap_str, bool interstaff_b) if (gh_number_p (gap)) { + Spanner*sp = dynamic_cast (me); int auto_gap_i = gh_scm2int (gap); for (int i=1; i < stems.size (); i++) { - bool is_b = (bool)(calc_interstaff_dist (stems[i], me) - - calc_interstaff_dist (stems[i-1], me)); + bool is_b = (bool)(calc_interstaff_dist (stems[i], sp) + - calc_interstaff_dist (stems[i-1], sp)); int l_y = (int)(Stem::head_positions(stems[i-1])[d]) - + (int)calc_interstaff_dist (stems[i-1], me); + + (int)calc_interstaff_dist (stems[i-1], sp); int r_y = (int)(Stem::head_positions(stems[i])[d]) - + (int)calc_interstaff_dist (stems[i], me); + + (int)calc_interstaff_dist (stems[i], sp); int gap_i = r_y - l_y; if ((abs (gap_i) >= auto_gap_i) && (!interstaff_b || is_b)) @@ -228,7 +214,7 @@ Beam::auto_knee (String gap_str, bool interstaff_b) { Item *s = stems[i]; int y = (int)(Stem::head_positions(s)[d]) - + (int)calc_interstaff_dist (s, me); + + (int)calc_interstaff_dist (s, dynamic_cast (me)); Directional_element_interface (s).set (y < knee_y ? UP : DOWN); s->set_elt_property ("dir-forced", SCM_BOOL_T); @@ -244,17 +230,17 @@ Beam::auto_knee (String gap_str, bool interstaff_b) scmify forced-fraction */ void -Beam::set_stem_shorten () +Beam::set_stem_shorten (Score_element*m) { - Spanner*me = this; - if (!visible_stem_count ()) + Spanner*me = dynamic_cast (m); + if (!visible_stem_count (me)) return; - Real forced_fraction = forced_stem_count () / visible_stem_count (); + Real forced_fraction = forced_stem_count (me) / visible_stem_count (me); if (forced_fraction < 0.5) return; - int multiplicity = get_multiplicity (); + int multiplicity = get_multiplicity (me); // grace stems? SCM shorten = scm_eval (ly_symbol2scm ("beamed-stem-shorten")); @@ -268,7 +254,7 @@ Beam::set_stem_shorten () SCM shorten_elt = scm_list_ref (shorten, gh_int2scm (multiplicity (beam); + Score_element * me = unsmob_element (smob); /* first, calculate y, dy */ Real y, dy; - me->calc_default_position_and_height (&y, &dy); - if (me->visible_stem_count ()) +calc_default_position_and_height (me, &y, &dy); + if (visible_stem_count (me)) { - if (me->suspect_slope_b (y, dy)) + if (suspect_slope_b (me, y, dy)) dy = 0; - Real damped_dy = me->calc_slope_damping_f (dy); - Real quantised_dy = me->quantise_dy_f (damped_dy); + Real damped_dy = calc_slope_damping_f (me, dy); + Real quantised_dy = quantise_dy_f (me, damped_dy); y += (dy - quantised_dy) / 2; dy = quantised_dy; @@ -336,11 +321,11 @@ Beam::after_line_breaking (SCM smob) else { /* we can modify y, so we should quantise y */ - Real y_shift = me->check_stem_length_f (y, dy); + Real y_shift = check_stem_length_f (me, y, dy); y += y_shift; - y = me->quantise_y_f (y, dy, 0); - me->set_stem_length (y, dy); - y_shift = me->check_stem_length_f (y, dy); + y = quantise_y_f (me,y, dy, 0); + set_stem_length (me, y, dy); + y_shift = check_stem_length_f (me, y, dy); if (y_shift > half_space / 4) { @@ -353,12 +338,12 @@ Beam::after_line_breaking (SCM smob) int quant_dir = 0; if (abs (y_shift) > half_space / 2) quant_dir = sign (y_shift) * Directional_element_interface (me).get (); - y = me->quantise_y_f (y, dy, quant_dir); + y = quantise_y_f (me, y, dy, quant_dir); } } // UGH. Y is not in staff position unit? // Ik dacht datwe daar juist van weg wilden? - me->set_stem_length (y, dy); + set_stem_length (me, y, dy); me->set_elt_property ("y-position", gh_double2scm (y)); return SCM_UNDEFINED; @@ -368,16 +353,15 @@ Beam::after_line_breaking (SCM smob) See Documentation/tex/fonts.doc */ void -Beam::calc_default_position_and_height (Real* y, Real* dy) const +Beam::calc_default_position_and_height (Score_element*me,Real* y, Real* dy) { - Spanner*me = (Spanner*)this; *y = 0; *dy = 0; - if (visible_stem_count () <= 1) + if (visible_stem_count (me) <= 1) return; - Real first_ideal = Stem::calc_stem_info (first_visible_stem ()).idealy_f_; - if (first_ideal == Stem::calc_stem_info (last_visible_stem ()).idealy_f_) + Real first_ideal = Stem::calc_stem_info (first_visible_stem (me)).idealy_f_; + if (first_ideal == Stem::calc_stem_info (last_visible_stem (me)).idealy_f_) { *dy = 0; *y = first_ideal; @@ -385,7 +369,7 @@ Beam::calc_default_position_and_height (Real* y, Real* dy) const } Array ideals; - Real x0 = first_visible_stem ()->relative_coordinate (0, X_AXIS); + Real x0 = first_visible_stem (me)->relative_coordinate (0, X_AXIS); Link_array stems= Pointer_group_interface__extract_elements (me, (Item*)0, "stems"); @@ -400,23 +384,23 @@ Beam::calc_default_position_and_height (Real* y, Real* dy) const Real dydx; minimise_least_squares (&dydx, y, ideals); // duh, takes references - Real dx = last_visible_stem ()->relative_coordinate (0, X_AXIS) - x0; + Real dx = last_visible_stem (me)->relative_coordinate (0, X_AXIS) - x0; *dy = dydx * dx; } bool -Beam::suspect_slope_b (Real y, Real dy) const +Beam::suspect_slope_b (Score_element*me, Real y, Real dy) { /* first, calculate y, dy */ /* steep slope running against lengthened stem is suspect */ - Real first_ideal = Stem::calc_stem_info (first_visible_stem ()).idealy_f_; - Real last_ideal = Stem::calc_stem_info (last_visible_stem ()).idealy_f_; - Real lengthened = paper_l ()->get_var ("beam_lengthened"); - Real steep = paper_l ()->get_var ("beam_steep_slope"); + Real first_ideal = Stem::calc_stem_info (first_visible_stem (me)).idealy_f_; + Real last_ideal = Stem::calc_stem_info (last_visible_stem (me)).idealy_f_; + Real lengthened = me->paper_l ()->get_var ("beam_lengthened"); + Real steep = me->paper_l ()->get_var ("beam_steep_slope"); - Real dx = last_visible_stem ()->relative_coordinate (0, X_AXIS) - first_visible_stem ()->relative_coordinate (0, X_AXIS); + Real dx = last_visible_stem (me)->relative_coordinate (0, X_AXIS) - first_visible_stem (me)->relative_coordinate (0, X_AXIS); Real dydx = dy && dx ? dy/dx : 0; if (((y - first_ideal > lengthened) && (dydx > steep)) @@ -433,15 +417,15 @@ Beam::suspect_slope_b (Real y, Real dy) const corresponds with some tables in [Wanske] */ Real -Beam::calc_slope_damping_f (Real dy) const +Beam::calc_slope_damping_f (Score_element*me,Real dy) { - SCM damp = get_elt_property ("damping"); + SCM damp = me->get_elt_property ("damping"); int damping = gh_scm2int (damp); if (damping) { - Real dx = last_visible_stem ()->relative_coordinate (0, X_AXIS) - - first_visible_stem ()->relative_coordinate (0, X_AXIS); + Real dx = last_visible_stem (me)->relative_coordinate (0, X_AXIS) + - first_visible_stem (me)->relative_coordinate (0, X_AXIS); Real dydx = dy && dx ? dy/dx : 0; dydx = 0.6 * tanh (dydx) / damping; return dydx * dx; @@ -450,18 +434,17 @@ Beam::calc_slope_damping_f (Real dy) const } Real -Beam::calc_stem_y_f (Item* s, Real y, Real dy) const +Beam::calc_stem_y_f (Score_element*me,Item* s, Real y, Real dy) { - Score_element*me = (Score_element*)this; - Real thick = gh_scm2double (get_elt_property ("beam-thickness")); - thick *= paper_l ()->get_var ("staffspace"); + Real thick = gh_scm2double (me->get_elt_property ("beam-thickness")); + thick *= me->paper_l ()->get_var ("staffspace"); - int beam_multiplicity = get_multiplicity (); + int beam_multiplicity = get_multiplicity (me); int stem_multiplicity = (Stem::flag_i (s) - 2) >? 0; - Real interbeam_f = paper_l ()->interbeam_f (beam_multiplicity); - Real x0 = first_visible_stem ()->relative_coordinate (0, X_AXIS); - Real dx = last_visible_stem ()->relative_coordinate (0, X_AXIS) - x0; + Real interbeam_f = me->paper_l ()->interbeam_f (beam_multiplicity); + Real x0 = first_visible_stem (me)->relative_coordinate (0, X_AXIS); + Real dx = last_visible_stem (me)->relative_coordinate (0, X_AXIS) - x0; Real stem_y = (dy && dx ? (s->relative_coordinate (0, X_AXIS) - x0) / dx * dy : 0) + y; /* knee */ @@ -478,7 +461,7 @@ Beam::calc_stem_y_f (Item* s, Real y, Real dy) const // huh, why not for first visible? if (Staff_symbol_referencer::staff_symbol_l (s) - != Staff_symbol_referencer::staff_symbol_l (last_visible_stem ())) + != Staff_symbol_referencer::staff_symbol_l (last_visible_stem (me))) stem_y += Directional_element_interface (me).get () * (beam_multiplicity - stem_multiplicity) * interbeam_f; } @@ -487,9 +470,8 @@ Beam::calc_stem_y_f (Item* s, Real y, Real dy) const } Real -Beam::check_stem_length_f (Real y, Real dy) const +Beam::check_stem_length_f (Score_element*me,Real y, Real dy) { - Score_element * me = (Score_element*)this; Real shorten = 0; Real lengthen = 0; Direction dir = Directional_element_interface (me).get (); @@ -503,7 +485,7 @@ Beam::check_stem_length_f (Real y, Real dy) const if (Stem::invisible_b (s)) continue; - Real stem_y = calc_stem_y_f (s, y, dy); + Real stem_y = calc_stem_y_f (me, s, y, dy); stem_y *= dir; Stem_info info = Stem::calc_stem_info (s); @@ -526,10 +508,8 @@ Beam::check_stem_length_f (Real y, Real dy) const stem directions and length should set to relative to the chord's position of the beam. */ void -Beam::set_stem_length (Real y, Real dy) +Beam::set_stem_length (Score_element*me,Real y, Real dy) { - Beam*me = this; - Real half_space = Staff_symbol_referencer::staff_space (me)/2; Link_array stems= Pointer_group_interface__extract_elements (me, (Item*)0, "stems"); @@ -541,10 +521,10 @@ Beam::set_stem_length (Real y, Real dy) if (Stem::invisible_b (s)) continue; - Real stem_y = calc_stem_y_f (s, y, dy); + Real stem_y = calc_stem_y_f (me, s, y, dy); /* caution: stem measures in staff-positions */ - Stem::set_stemend (s,(stem_y + calc_interstaff_dist (s, me)) / half_space); + Stem::set_stemend (s,(stem_y + calc_interstaff_dist (s, dynamic_cast (me))) / half_space); } } @@ -557,9 +537,8 @@ Beam::set_stem_length (Real y, Real dy) + n * staff_space */ Real -Beam::quantise_dy_f (Real dy) const +Beam::quantise_dy_f (Score_element*me,Real dy) { - Score_element*me = (Score_element*)this; Array a; for (SCM s = scm_eval (ly_symbol2scm ("beam-height-quants")); s !=SCM_EOL; s = gh_cdr (s)) a.push (gh_scm2double (gh_car (s))); @@ -586,10 +565,9 @@ Beam::quantise_dy_f (Real dy) const if extend_b then stems must *not* get shorter */ Real -Beam::quantise_y_f (Real y, Real dy, int quant_dir) +Beam::quantise_y_f (Score_element*me,Real y, Real dy, int quant_dir) { - int multiplicity = get_multiplicity (); - Score_element*me = (Score_element*)this; + int multiplicity = get_multiplicity (me); Real staff_space = Staff_symbol_referencer::staff_space (me); SCM quants = scm_eval (gh_list (ly_symbol2scm ("beam-vertical-position-quants"), @@ -617,9 +595,8 @@ Beam::quantise_y_f (Real y, Real dy, int quant_dir) } void -Beam::set_beaming (Beaming_info_list *beaming) +Beam::set_beaming (Score_element*me,Beaming_info_list *beaming) { - Score_element*me = this; Link_array stems= Pointer_group_interface__extract_elements (me, (Score_element*)0, "stems"); @@ -644,28 +621,27 @@ Beam::set_beaming (Beaming_info_list *beaming) clean me up. */ Molecule -Beam::stem_beams (Item *here, Item *next, Item *prev) const +Beam::stem_beams (Score_element*me,Item *here, Item *next, Item *prev) { - Score_element*me = (Score_element*)this; if ((next && !(next->relative_coordinate (0, X_AXIS) > here->relative_coordinate (0, X_AXIS))) || (prev && !(prev->relative_coordinate (0, X_AXIS) < here->relative_coordinate (0, X_AXIS)))) programming_error ("Beams are not left-to-right"); - Real staffline_f = paper_l ()->get_var ("stafflinethickness"); - int multiplicity = get_multiplicity (); + Real staffline_f = me->paper_l ()->get_var ("stafflinethickness"); + int multiplicity = get_multiplicity (me); - Real interbeam_f = paper_l ()->interbeam_f (multiplicity); - Real thick = gh_scm2double (get_elt_property ("beam-thickness")); - thick *= paper_l ()->get_var ("staffspace"); + Real interbeam_f = me->paper_l ()->interbeam_f (multiplicity); + Real thick = gh_scm2double (me->get_elt_property ("beam-thickness")); + thick *= me->paper_l ()->get_var ("staffspace"); Real bdy = interbeam_f; Real stemdx = staffline_f; - Real dx = visible_stem_count () ? - last_visible_stem ()->relative_coordinate (0, X_AXIS) - first_visible_stem ()->relative_coordinate (0, X_AXIS) + Real dx = visible_stem_count (me) ? + last_visible_stem (me)->relative_coordinate (0, X_AXIS) - first_visible_stem (me)->relative_coordinate (0, X_AXIS) : 0.0; - Real dy = gh_scm2double (get_elt_property ("height")); + Real dy = gh_scm2double (me->get_elt_property ("height")); Real dydx = dy && dx ? dy/dx : 0; Molecule leftbeams; @@ -676,11 +652,11 @@ Beam::stem_beams (Item *here, Item *next, Item *prev) const if (!Stem::first_head (here)) nw_f = 0; else if (Stem::type_i (here)== 1) - nw_f = paper_l ()->get_var ("wholewidth"); + nw_f = me->paper_l ()->get_var ("wholewidth"); else if (Stem::type_i (here) == 2) - nw_f = paper_l ()->get_var ("notewidth") * 0.8; + nw_f = me->paper_l ()->get_var ("notewidth") * 0.8; else - nw_f = paper_l ()->get_var ("quartwidth"); + nw_f = me->paper_l ()->get_var ("quartwidth"); Direction dir = Directional_element_interface (me).get (); @@ -698,7 +674,7 @@ Beam::stem_beams (Item *here, Item *next, Item *prev) const w = w/2 beam (dydx, w, thick); + a = me->lookup_l ()->beam (dydx, w, thick); a.translate (Offset (-w, -w * dydx)); for (int j = 0; j < lhalfs; j++) { @@ -714,12 +690,12 @@ Beam::stem_beams (Item *here, Item *next, Item *prev) const int rwholebeams= Stem::beam_count (here,RIGHT) relative_coordinate (0, X_AXIS) - here->relative_coordinate (0, X_AXIS); - Molecule a = lookup_l ()->beam (dydx, w + stemdx, thick); + Molecule a = me->lookup_l ()->beam (dydx, w + stemdx, thick); a.translate_axis( - stemdx/2, X_AXIS); int j = 0; Real gap_f = 0; - SCM gap = get_elt_property ("beam-gap"); + SCM gap = me->get_elt_property ("beam-gap"); if (gh_number_p (gap)) { int gap_i = gh_scm2int ( (gap)); @@ -734,7 +710,7 @@ Beam::stem_beams (Item *here, Item *next, Item *prev) const // TODO: notehead widths differ for different types gap_f = nw_f / 2; w -= 2 * gap_f; - a = lookup_l ()->beam (dydx, w + stemdx, thick); + a = me->lookup_l ()->beam (dydx, w + stemdx, thick); } for (; j < rwholebeams; j++) @@ -746,7 +722,7 @@ Beam::stem_beams (Item *here, Item *next, Item *prev) const w = w/2 beam (dydx, w, thick); + a = me->lookup_l ()->beam (dydx, w, thick); for (; j < rwholebeams + rhalfs; j++) { @@ -769,19 +745,18 @@ MAKE_SCHEME_CALLBACK(Beam,brew_molecule); SCM Beam::brew_molecule (SCM smob) { - Score_element * beam = unsmob_element (smob); - Beam * me =dynamic_cast (beam); + Score_element * me =unsmob_element (smob); Molecule mol; if (!gh_pair_p (me->get_elt_property ("stems"))) return SCM_EOL; Real x0,dx; Link_arraystems = - Pointer_group_interface__extract_elements ((Beam*) me, (Item*) 0, "stems"); - if (me->visible_stem_count ()) + Pointer_group_interface__extract_elements (me, (Item*) 0, "stems"); + if (visible_stem_count (me)) { - x0 = me->first_visible_stem ()->relative_coordinate (0, X_AXIS); - dx = me->last_visible_stem ()->relative_coordinate (0, X_AXIS) - x0; + x0 = first_visible_stem (me)->relative_coordinate (0, X_AXIS); + dx = last_visible_stem (me)->relative_coordinate (0, X_AXIS) - x0; } else { @@ -801,23 +776,22 @@ Beam::brew_molecule (SCM smob) Item * prev = (j > 0)? stems[j-1] : 0; Item * next = (j < stems.size()-1) ? stems[j+1] :0; - Molecule sb = me->stem_beams (i, next, prev); + Molecule sb = stem_beams (me, i, next, prev); Real x = i->relative_coordinate (0, X_AXIS)-x0; sb.translate (Offset (x, x * dydx + y)); mol.add_molecule (sb); } mol.translate_axis (x0 - - me->get_bound (LEFT)->relative_coordinate (0, X_AXIS), X_AXIS); + - dynamic_cast (me)->get_bound (LEFT)->relative_coordinate (0, X_AXIS), X_AXIS); return mol.create_scheme (); } int -Beam::forced_stem_count () const +Beam::forced_stem_count (Score_element*me) { - Score_element* me = (Score_element*)this; Link_arraystems = - Pointer_group_interface__extract_elements ((Beam*) me, (Item*) 0, "stems"); + Pointer_group_interface__extract_elements ( me, (Item*) 0, "stems"); int f = 0; for (int i=0; i < stems.size (); i++) { @@ -840,9 +814,8 @@ Beam::forced_stem_count () const use filter and standard list functions. */ int -Beam::visible_stem_count () const +Beam::visible_stem_count (Score_element*me) { - Score_element * me = (Score_element*)this; Link_arraystems = Pointer_group_interface__extract_elements (me, (Item*) 0, "stems"); int c = 0; @@ -855,11 +828,10 @@ Beam::visible_stem_count () const } Item* -Beam::first_visible_stem() const +Beam::first_visible_stem(Score_element*me) { - Score_element * me = (Score_element*)this; Link_arraystems = - Pointer_group_interface__extract_elements ((Beam*) me, (Item*) 0, "stems"); + Pointer_group_interface__extract_elements ( me, (Item*) 0, "stems"); for (int i = 0; i < stems.size (); i++) { @@ -870,11 +842,10 @@ Beam::first_visible_stem() const } Item* -Beam::last_visible_stem() const +Beam::last_visible_stem(Score_element*me) { - Score_element * me = (Score_element*)this; Link_arraystems = - Pointer_group_interface__extract_elements ((Beam*) me, (Item*) 0, "stems"); + Pointer_group_interface__extract_elements ( me, (Item*) 0, "stems"); for (int i = stems.size (); i--;) { if (!Stem::invisible_b (stems[i])) @@ -902,8 +873,8 @@ Beam::rest_collision_callback (Score_element *rest, Axis a ) Score_element * stem = st; if (!stem) return 0.0; - Beam * beam = dynamic_cast (unsmob_element (stem->get_elt_property ("beam"))); - if (!beam || !beam->visible_stem_count ()) + Score_element * beam = unsmob_element (stem->get_elt_property ("beam")); + if (!beam || !Beam::has_interface (beam) || !Beam::visible_stem_count (beam)) return 0.0; // make callback for rest from this. @@ -920,8 +891,8 @@ Beam::rest_collision_callback (Score_element *rest, Axis a ) if (gh_number_p (s)) beam_y = gh_scm2double (s); - Real x0 = beam->first_visible_stem()->relative_coordinate (0, X_AXIS); - Real dx = beam->last_visible_stem()->relative_coordinate (0, X_AXIS) - x0; + Real x0 = first_visible_stem(beam)->relative_coordinate (0, X_AXIS); + Real dx = last_visible_stem(beam)->relative_coordinate (0, X_AXIS) - x0; Real dydx = beam_dy && dx ? beam_dy/dx : 0; Direction d = Stem::get_direction (stem); @@ -946,3 +917,21 @@ Beam::rest_collision_callback (Score_element *rest, Axis a ) return (-d * discrete_dist); } + + +bool +Beam::has_interface (Score_element*me) +{ + return me->has_interface (ly_symbol2scm ("beam-interface")); +} + +void +Beam::set_interface (Score_element*me) +{ + Pointer_group_interface g (me, "stems"); + g.set_interface (); + + me->set_elt_property ("height", gh_int2scm (0)); // ugh. + me->set_elt_property ("y-position" ,gh_int2scm (0)); + me->set_interface (ly_symbol2scm("beam-interface")); +} diff --git a/lily/break-algorithm.cc b/lily/break-algorithm.cc index 7c679d76fb..4802e0507c 100644 --- a/lily/break-algorithm.cc +++ b/lily/break-algorithm.cc @@ -22,13 +22,11 @@ Array Break_algorithm::find_break_indices () const { - Link_array all = pscore_l_->line_l_->column_l_arr (); - - + Link_array all = pscore_l_->line_l_->column_l_arr (); Array retval; for (int i=0; i < all.size (); i++) - if (all[i]->breakable_b ()) + if (Item::breakable_b (all[i])) retval.push (i); if (linewidth_f_ <=0) @@ -39,15 +37,14 @@ Break_algorithm::find_break_indices () const } -Link_array +Link_array Break_algorithm::find_breaks () const { - Link_array all = pscore_l_->line_l_->column_l_arr (); - - Link_array retval; + Link_array all = pscore_l_->line_l_->column_l_arr (); + Link_array retval; for (int i=0; i < all.size (); i++) - if (all[i]->breakable_b ()) + if (Item::breakable_b (all[i])) retval.push (all[i]); if (linewidth_f_ <=0) @@ -59,7 +56,7 @@ Break_algorithm::find_breaks () const Simple_spacer* -Break_algorithm::generate_spacing_problem (Link_array curline, Interval line) const +Break_algorithm::generate_spacing_problem (Link_array curline, Interval line) const { Simple_spacer * sp = new Simple_spacer; Paper_def * d = pscore_l_->paper_l_; diff --git a/lily/gourlay-breaking.cc b/lily/gourlay-breaking.cc index 3f9662a99a..192ece0a69 100644 --- a/lily/gourlay-breaking.cc +++ b/lily/gourlay-breaking.cc @@ -54,7 +54,7 @@ Array Gourlay_breaking::do_solve () const { Array optimal_paths; - Link_array all = + Link_array all = pscore_l_->line_l_->column_l_arr (); Array breaks = find_break_indices (); @@ -80,10 +80,10 @@ Gourlay_breaking::do_solve () const for (int start_idx = break_idx; start_idx--;) { - Link_array line = all.slice (breaks[start_idx], breaks[break_idx]+1); + Link_array line = all.slice (breaks[start_idx], breaks[break_idx]+1); - line[0] = dynamic_cast (line[0] ->find_prebroken_piece (RIGHT)); - line.top () = dynamic_cast (line.top ()->find_prebroken_piece (LEFT)); + line[0] = dynamic_cast (line[0]) ->find_prebroken_piece (RIGHT); + line.top () = dynamic_cast (line.top ())->find_prebroken_piece (LEFT); Column_x_positions cp; cp.cols_ = line; @@ -177,7 +177,7 @@ Gourlay_breaking::combine_demerits (Column_x_positions const &prev, Column_x_positions const &this_one) const { Real break_penalties = 0.0; - Paper_column * pc = this_one.cols_.top (); + Score_element * pc = this_one.cols_.top (); if (pc->original_l_) { SCM pen = pc->get_elt_property ("penalty"); diff --git a/lily/grace-align-item.cc b/lily/grace-align-item.cc index 2b7aec2beb..a8150dac67 100644 --- a/lily/grace-align-item.cc +++ b/lily/grace-align-item.cc @@ -13,15 +13,6 @@ #include "paper-column.hh" #include "paper-def.hh" -void -Grace_align_item::set_interface (Score_element*me) -{ - me->set_interface (ly_symbol2scm ("grace-align-interface")); - me->set_elt_property ("stacking-dir", gh_int2scm (RIGHT)); - Align_interface::set_interface(me); - Align_interface::set_axis (me,X_AXIS); -} - /* TODO: cfg-able */ @@ -41,6 +32,17 @@ Grace_align_item::before_line_breaking (SCM smob) return SCM_UNDEFINED; } +void +Grace_align_item::set_interface (Score_element*me) +{ + me->set_interface (ly_symbol2scm ("grace-align-interface")); + me->set_elt_property ("stacking-dir", gh_int2scm (RIGHT)); + Align_interface::set_interface(me); + Align_interface::set_axis (me,X_AXIS); +} + + + bool Grace_align_item::has_interface (Score_element*m) { diff --git a/lily/include/break-algorithm.hh b/lily/include/break-algorithm.hh index 7e0c341544..fa0b0d7770 100644 --- a/lily/include/break-algorithm.hh +++ b/lily/include/break-algorithm.hh @@ -28,7 +28,7 @@ protected: Real linewidth_f_; /// search all pcols which are breakable. - Link_array find_breaks() const; + Link_array find_breaks() const; Array find_break_indices() const; @@ -37,10 +37,10 @@ protected: void solve_line (Column_x_positions*) const; /// does curline fit on the paper? - bool feasible (Link_array) const; + bool feasible (Link_array) const; - Simple_spacer* generate_spacing_problem (Link_array, Interval) const; + Simple_spacer* generate_spacing_problem (Link_array, Interval) const; virtual Array do_solve() const=0; diff --git a/lily/include/column-x-positions.hh b/lily/include/column-x-positions.hh index 23bea78d2e..aec9602223 100644 --- a/lily/include/column-x-positions.hh +++ b/lily/include/column-x-positions.hh @@ -13,7 +13,7 @@ struct Column_x_positions { - Link_array cols_; + Link_array cols_; Array config_; Real force_f_; bool satisfies_constraints_b_; diff --git a/lily/include/item.hh b/lily/include/item.hh index c036dd2e52..16f298f7f2 100644 --- a/lily/include/item.hh +++ b/lily/include/item.hh @@ -43,7 +43,7 @@ public: Item (SCM); Item (Item const &); - bool breakable_b () const; + static bool breakable_b (Score_element*me); bool broken_b () const; Direction break_status_dir () const; diff --git a/lily/include/line-of-score.hh b/lily/include/line-of-score.hh index 9d510c692c..96b3d6b265 100644 --- a/lily/include/line-of-score.hh +++ b/lily/include/line-of-score.hh @@ -44,7 +44,7 @@ public: void output_lines (); Link_array broken_col_range (Item const*, Item const*) const; - Link_array column_l_arr () const; + Link_array column_l_arr () const; void add_column (Paper_column*); void typeset_element (Score_element*); diff --git a/lily/include/paper-column.hh b/lily/include/paper-column.hh index 3b1756e8f1..5633cb0fb2 100644 --- a/lily/include/paper-column.hh +++ b/lily/include/paper-column.hh @@ -15,16 +15,14 @@ #include "spring.hh" /** - stuff grouped vertically. - This is a class to address items vertically. It contains the data for: - \begin{itemize} - \item - unbroken score - \item - broken score - \item - the linespacing problem - \end{itemize} + bounded-by-me -- list of elts. + + shortest-starter-duration -- rational signifying shortest moment that starts here + + + Interfaces: + + axis-group, spaceable-element. */ class Paper_column : public Item @@ -32,29 +30,11 @@ class Paper_column : public Item public: VIRTUAL_COPY_CONS(Score_element); - /* - ugh. - - TODO: - - * junk these after spacing is done. - - * Put these in Scheme. - */ - - - Array minimal_dists_; - Array springs_; - - /* Not (yet) in scm, because of messy effects when a column commits suicide. */ int rank_i_; - /// set a minimum distance - void add_rod (Paper_column * to, Real distance); - void add_spring (Paper_column * to, Real dist, Real strength); - + virtual void do_break_processing (); virtual Paper_column *column_l () const; virtual Line_of_score *line_l () const; @@ -65,10 +45,10 @@ public: static int rank_i(Score_element*); Paper_column (SCM); - Moment when_mom ()const; - bool musical_b () const; - bool used_b () const; + static Moment when_mom (Score_element*); + + static bool used_b (Score_element*) ; void set_rank (int); }; diff --git a/lily/include/simple-spacer.hh b/lily/include/simple-spacer.hh index 0cc519fdbb..4f317b148a 100644 --- a/lily/include/simple-spacer.hh +++ b/lily/include/simple-spacer.hh @@ -73,7 +73,7 @@ struct Simple_spacer Simple_spacer (); void solve (Column_x_positions *) const; - void add_columns (Link_array); + void add_columns (Link_array); void my_solve_linelen (); void my_solve_natural_len (); Real active_springs_stiffness () const; diff --git a/lily/include/spaceable-element.hh b/lily/include/spaceable-element.hh new file mode 100644 index 0000000000..72a713ed4c --- /dev/null +++ b/lily/include/spaceable-element.hh @@ -0,0 +1,29 @@ +/* + spaceable-element.hh -- declare Spaceable_element + + source file of the GNU LilyPond music typesetter + + (c) 2000 Han-Wen Nienhuys + + */ + +#ifndef SPACEABLE_ELEMENT_HH +#define SPACEABLE_ELEMENT_HH + +#include "lily-guile.hh" +#include "lily-proto.hh" + + +struct Spaceable_element +{ + /// set a minimum distance + static void add_rod (Score_element*me, Score_element * to, Real distance); + static void add_spring (Score_element*me,Score_element * to, Real dist, Real strength); + static void set_interface (Score_element*); + static void remove_interface (Score_element*); + static SCM get_minimum_distances (Score_element*); + static SCM get_ideal_distances (Score_element*); +}; + +#endif /* SPACEABLE_ELEMENT_HH */ + diff --git a/lily/include/spacing-spanner.hh b/lily/include/spacing-spanner.hh index c6e4bdd7cd..917b5fdc89 100644 --- a/lily/include/spacing-spanner.hh +++ b/lily/include/spacing-spanner.hh @@ -12,21 +12,17 @@ #include "spanner.hh" -class Spacing_spanner : public Spanner +class Spacing_spanner { public: - Spacing_spanner (SCM); - - VIRTUAL_COPY_CONS(Score_element); - Array do_measure (Link_array) const; - -protected: - virtual Array get_springs () const; - - Real stem_dir_correction (Paper_column*,Paper_column*) const; - Real default_bar_spacing (Paper_column*,Paper_column*,Moment) const; - Real note_spacing (Paper_column*,Paper_column*,Moment) const; - Real get_duration_space (Moment dur, Moment shortest) const; + static void set_interface (Score_element*); + static void do_measure (Score_element*,Link_array) ; + + static SCM set_springs (SCM); + static Real stem_dir_correction (Score_element*,Score_element*,Score_element*) ; + static Real default_bar_spacing (Score_element*,Score_element*,Score_element*,Moment) ; + static Real note_spacing (Score_element*,Score_element*,Score_element*,Moment) ; + static Real get_duration_space (Score_element*,Moment dur, Moment shortest) ; }; #endif /* SPACING_SPANNER_HH */ diff --git a/lily/include/spanner.hh b/lily/include/spanner.hh index 4ce355dd4c..dd5a61b21b 100644 --- a/lily/include/spanner.hh +++ b/lily/include/spanner.hh @@ -47,16 +47,11 @@ public: Real spanner_length () const; static int compare (Spanner * const &,Spanner * const &); - virtual Array get_rods () const; - virtual Array get_springs () const; virtual Score_element* find_broken_piece (Line_of_score*) const; virtual void do_derived_mark (); protected: void set_my_columns (); VIRTUAL_COPY_CONS(Score_element); - - - virtual void do_space_processing (); virtual void do_break_processing (); virtual Line_of_score*line_l () const; }; diff --git a/lily/item.cc b/lily/item.cc index 319c402842..4e995bfd77 100644 --- a/lily/item.cc +++ b/lily/item.cc @@ -31,15 +31,23 @@ Item::Item (Item const &s) } - bool -Item::breakable_b () const +Item::breakable_b (Score_element*me) { - if (original_l_ ) + if (me->original_l_) return false; + + if (!dynamic_cast(me)) + programming_error ("only items can be breakable."); - Item * i =dynamic_cast (parent_l (X_AXIS)); - return (i) ? i->breakable_b () : to_boolean (get_elt_property ("breakable")); + Item * i =dynamic_cast (me->parent_l (X_AXIS)); + return (i) ? Item::breakable_b (i) : to_boolean (me->get_elt_property ("breakable")); +} + +Paper_column * +Item::column_l () const +{ + return dynamic_cast (parent_l (X_AXIS))->column_l (); } Line_of_score * @@ -83,7 +91,7 @@ Item::discretionary_processing() if (broken_b ()) return; - if (breakable_b ()) + if (Item::breakable_b (this)) copy_breakable_items(); } @@ -114,11 +122,6 @@ Item::find_prebroken_piece (Direction d) const return dynamic_cast (broken_to_drul_[d]); } -Paper_column * -Item::column_l () const -{ - return dynamic_cast (parent_l (X_AXIS))->column_l (); -} Direction Item::break_status_dir () const diff --git a/lily/line-of-score.cc b/lily/line-of-score.cc index 464212d3cb..ff641c0c24 100644 --- a/lily/line-of-score.cc +++ b/lily/line-of-score.cc @@ -133,7 +133,7 @@ Line_of_score::break_into_pieces (Array const &breaking) Line_of_score *line_l = dynamic_cast (clone()); line_l->rank_i_ = i; // line_l->set_immutable_elt_property ("rank", gh_int2scm( i)); - Link_array c (breaking[i].cols_); + Link_array c (breaking[i].cols_); pscore_l_->typeset_line (line_l); line_l->set_bound(LEFT,c[0]); @@ -141,7 +141,7 @@ Line_of_score::break_into_pieces (Array const &breaking) for (int j=0; j < c.size(); j++) { c[j]->translate_axis (breaking[i].config_[j],X_AXIS); - c[j]->line_l_ = line_l; + dynamic_cast (c[j])->line_l_ = line_l; } broken_into_l_arr_.push (line_l); @@ -233,7 +233,12 @@ Line_of_score::pre_processing () progress_indication ("\n" + _ ("Calculating column positions...") + " " ); for (SCM s = get_elt_property ("all-elements"); gh_pair_p (s); s = gh_cdr (s)) - unsmob_element (gh_car (s))->do_space_processing (); + { + Score_element * e = unsmob_element (gh_car (s)); + SCM proc = e->get_elt_property ("spacing-procedure"); + if (gh_procedure_p (proc)) + gh_call1 (proc, e->self_scm_); + } } void @@ -325,9 +330,8 @@ Line_of_score::broken_col_range (Item const*l, Item const*r) const while (gh_pair_p (s) && gh_car (s) != l->self_scm_) { - Paper_column *c - = dynamic_cast (unsmob_element (gh_car (s))); - if (c->breakable_b () && !c->line_l_) + Paper_column*c = dynamic_cast ( unsmob_element (gh_car (s))); + if (Item::breakable_b (c) && !c->line_l_) ret.push (c); s = gh_cdr (s); @@ -341,15 +345,15 @@ Line_of_score::broken_col_range (Item const*l, Item const*r) const Return all columns, but filter out any unused columns , since they might disrupt the spacing problem. */ -Link_array +Link_array Line_of_score::column_l_arr ()const { - Link_array acs - = Pointer_group_interface__extract_elements (this, (Paper_column*) 0, "columns"); + Link_array acs + = Pointer_group_interface__extract_elements (this, (Score_element*) 0, "columns"); bool bfound = false; for (int i= acs.size (); i -- ; ) { - bool brb = acs[i]->breakable_b(); + bool brb = Item::breakable_b (acs[i]); bfound = bfound || brb; /* @@ -357,7 +361,7 @@ Line_of_score::column_l_arr ()const seem empty. We need to retain breakable columns, in case someone forced a breakpoint. */ - if (!bfound || !acs[i]->used_b ()) + if (!bfound || !Paper_column::used_b (acs[i])) acs.del (i); } return acs; diff --git a/lily/paper-column.cc b/lily/paper-column.cc index 579d028256..fcdc933f9a 100644 --- a/lily/paper-column.cc +++ b/lily/paper-column.cc @@ -10,62 +10,13 @@ #include "paper-score.hh" #include "debug.hh" #include "axis-group-interface.hh" +#include "spaceable-element.hh" void -Paper_column::add_rod (Paper_column * p, Real d) +Paper_column::do_break_processing () { - Direction dir = Direction (sign (rank_i(p) -rank_i (this))); - - if (dir != RIGHT) - { - programming_error ("Must set minimum distance LTOR."); - return; - } - - for (int i=0; i < minimal_dists_.size (); i++) - { - Column_rod &rod = minimal_dists_[i]; - if (rod.other_l_ == p) - { - rod.distance_f_ = rod.distance_f_ >? d; - return ; - } - } - - Column_rod cr; - cr.distance_f_ = d; - cr.other_l_ = p; - - minimal_dists_.push (cr); -} - -void -Paper_column::add_spring (Paper_column * p, Real d, Real s) -{ - Direction dir = Direction (sign (rank_i(p) -rank_i (this))); - - if (dir != RIGHT) - { - programming_error ("Must set springs LTOR"); - return; - } - - for (int i=0; i < springs_.size (); i++) - { - Column_spring &spring = springs_[i]; - if (spring.other_l_ == p) - { - spring.distance_f_ = spring.distance_f_ >? d; - return ; - } - } - - Column_spring cr; - cr.distance_f_ = d; - cr.strength_f_ = s; - cr.other_l_ = p; - - springs_.push (cr); + Spaceable_element::remove_interface(this); + Item::do_break_processing (); } int @@ -91,19 +42,20 @@ Paper_column::Paper_column (SCM l) { Axis_group_interface::set_interface (this); Axis_group_interface::set_axes (this, X_AXIS, X_AXIS); + Spaceable_element::set_interface (this); set_elt_property ("bounded-by-me", SCM_EOL); line_l_=0; rank_i_ = -1; } Moment -Paper_column::when_mom () const +Paper_column::when_mom (Score_element*me) { - SCM m = get_elt_property ("when"); + SCM m = me->get_elt_property ("when"); Moment s (0); - if (SMOB_IS_TYPE_B(Moment, m)) + if (unsmob_moment (m)) { - s = *SMOB_TO_TYPE (Moment,m); + return *unsmob_moment (m); } return s; } @@ -113,17 +65,17 @@ Paper_column::musical_b () const { SCM m = get_elt_property ("shortest-starter-duration"); Moment s (0); - if (SMOB_IS_TYPE_B(Moment, m)) + if (unsmob_moment (m)) { - s = *SMOB_TO_TYPE (Moment,m); + s = *unsmob_moment (m); } return s != Moment(0); } bool -Paper_column::used_b ()const +Paper_column::used_b (Score_element*me ) { - return gh_pair_p (get_elt_property ("elements")) || breakable_b () - || gh_pair_p (get_elt_property ("bounded-by-me")) + return gh_pair_p (me->get_elt_property ("elements")) || Item::breakable_b (me) + || gh_pair_p (me->get_elt_property ("bounded-by-me")) ; } diff --git a/lily/paper-score.cc b/lily/paper-score.cc index 601ce748cb..86797de758 100644 --- a/lily/paper-score.cc +++ b/lily/paper-score.cc @@ -79,7 +79,7 @@ Paper_score::process () /* Be sure to set breakability on first & last column. */ - Link_array pc (line_l_->column_l_arr ()); + Link_array pc (line_l_->column_l_arr ()); pc[0]->set_elt_property ("breakable", SCM_BOOL_T); pc.top ()->set_elt_property ("breakable", SCM_BOOL_T); diff --git a/lily/rod.cc b/lily/rod.cc index 15b4c7a808..621fd15de2 100644 --- a/lily/rod.cc +++ b/lily/rod.cc @@ -10,8 +10,7 @@ #include "paper-column.hh" #include "debug.hh" #include "dimensions.hh" -#include "separation-item.hh" - +#include "spaceable-element.hh" Rod::Rod () { @@ -20,11 +19,6 @@ Rod::Rod () } -Column_rod::Column_rod () -{ - distance_f_ = 0; - other_l_ = 0; -} void Rod::columnize () @@ -43,7 +37,8 @@ Rod::add_to_cols () { columnize(); if (item_l_drul_[LEFT] != item_l_drul_[RIGHT]) - dynamic_cast (item_l_drul_[LEFT])-> - add_rod(dynamic_cast(item_l_drul_[RIGHT]), distance_f_ ); + Spaceable_element::add_rod (item_l_drul_[LEFT], + item_l_drul_[RIGHT], + distance_f_ ); } diff --git a/lily/score-engraver.cc b/lily/score-engraver.cc index 842a896fb7..1e35503f42 100644 --- a/lily/score-engraver.cc +++ b/lily/score-engraver.cc @@ -195,7 +195,7 @@ Score_engraver::set_columns (Paper_column *new_command_l, if (*current[i]) { scoreline_l_->add_column ((*current[i])); - if (!(*current[i])->used_b()) + if (!Paper_column::used_b (*current[i])) { (*current[i])->suicide (); *current[i] =0; diff --git a/lily/script-column-engraver.cc b/lily/script-column-engraver.cc index 47c37cfcaa..02676f0145 100644 --- a/lily/script-column-engraver.cc +++ b/lily/script-column-engraver.cc @@ -60,7 +60,7 @@ Script_column_engraver::acknowledge_element( Score_element_info inf) { Item *thing = dynamic_cast (inf.elem_l_); if (thing - && !thing->breakable_b () + && !Item::breakable_b (thing) && Side_position::get_axis (inf.elem_l_) == Y_AXIS) { script_l_arr_.push (thing); diff --git a/lily/separating-line-group-engraver.cc b/lily/separating-line-group-engraver.cc index 96749f0410..7cc7ad681a 100644 --- a/lily/separating-line-group-engraver.cc +++ b/lily/separating-line-group-engraver.cc @@ -18,7 +18,7 @@ class Separating_line_group_engraver : public Engraver protected: Item * break_malt_p_; Item * nobreak_malt_p_; - Separating_group_spanner * sep_span_p_; + Spanner * sep_span_p_; virtual void acknowledge_element (Score_element_info); virtual void do_creation_processing (); @@ -39,7 +39,8 @@ Separating_line_group_engraver::Separating_line_group_engraver () void Separating_line_group_engraver::do_creation_processing () { - sep_span_p_ = new Separating_group_spanner (get_property ("basicSeparatingGroupSpannerProperties")); + sep_span_p_ = new Spanner (get_property ("basicSeparatingGroupSpannerProperties")); + Separating_group_spanner::set_interface (sep_span_p_); announce_element (Score_element_info (sep_span_p_, 0)); sep_span_p_->set_bound (LEFT, unsmob_element (get_property ("currentCommandColumn"))); } @@ -58,7 +59,7 @@ Separating_line_group_engraver::acknowledge_element (Score_element_info i) Item * it = dynamic_cast (i.elem_l_); if (it && !it->parent_l (X_AXIS)) { - bool ib =it->breakable_b (); + bool ib =Item::breakable_b (it); Item *&p_ref_ (ib ? break_malt_p_ : nobreak_malt_p_); diff --git a/lily/spring.cc b/lily/spring.cc index 41a7e1772d..e5136a82ff 100644 --- a/lily/spring.cc +++ b/lily/spring.cc @@ -10,6 +10,7 @@ #include "spring.hh" #include "debug.hh" #include "item.hh" +#include "spaceable-element.hh" #include "paper-column.hh" Spring::Spring () @@ -22,7 +23,9 @@ Spring::Spring () void Spring::add_to_cols () { - item_l_drul_[LEFT]->column_l ()->add_spring (item_l_drul_[RIGHT]->column_l (), distance_f_, strength_f_); + Spaceable_element::add_spring (item_l_drul_[LEFT]->column_l (), + item_l_drul_[RIGHT]->column_l (), + distance_f_, strength_f_); } -- 2.39.5