X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fspacing-spanner.cc;h=12f18e865fedbf6adba8575b8d2db74bfffe969f;hb=cfc908430e67711a28a33097aaea491f7c127a72;hp=ee4904999f372fbf5b7cda819052a556ad0c4119;hpb=c054eb280fd9953596eb164f67b0f9d5555c5a32;p=lilypond.git diff --git a/lily/spacing-spanner.cc b/lily/spacing-spanner.cc index ee4904999f..12f18e865f 100644 --- a/lily/spacing-spanner.cc +++ b/lily/spacing-spanner.cc @@ -39,6 +39,8 @@ #include "system.hh" #include "warn.hh" +using std::vector; + vector Spacing_spanner::get_columns (Grob *me_grob) { @@ -58,7 +60,7 @@ MAKE_SCHEME_CALLBACK (Spacing_spanner, set_springs, 1); SCM Spacing_spanner::set_springs (SCM smob) { - Spanner *me = Spanner::unsmob (smob); + Spanner *me = unsmob (smob); /* can't use get_system () ? --hwn. @@ -89,7 +91,7 @@ MAKE_SCHEME_CALLBACK (Spacing_spanner, calc_common_shortest_duration, 1); SCM Spacing_spanner::calc_common_shortest_duration (SCM grob) { - Spanner *me = Spanner::unsmob (grob); + Spanner *me = unsmob (grob); vector cols (get_columns (me)); @@ -106,7 +108,7 @@ Spacing_spanner::calc_common_shortest_duration (SCM grob) { if (Paper_column::is_musical (cols[i])) { - Moment *when = Moment::unsmob (cols[i]->get_property ("when")); + Moment *when = unsmob (cols[i]->get_property ("when")); /* ignore grace notes for shortest notes. @@ -115,9 +117,9 @@ Spacing_spanner::calc_common_shortest_duration (SCM grob) continue; SCM st = cols[i]->get_property ("shortest-starter-duration"); - Moment this_shortest = *Moment::unsmob (st); + Moment this_shortest = *unsmob (st); assert (this_shortest.to_bool ()); - shortest_in_measure = min (shortest_in_measure, this_shortest.main_part_); + shortest_in_measure = std::min (shortest_in_measure, this_shortest.main_part_); } else if (!shortest_in_measure.is_infinity () && Paper_column::is_breakable (cols[i])) @@ -161,11 +163,11 @@ Spacing_spanner::calc_common_shortest_duration (SCM grob) SCM bsd = me->get_property ("base-shortest-duration"); Rational d = Rational (1, 8); - if (Moment *m = Moment::unsmob (bsd)) + if (Moment *m = unsmob (bsd)) d = m->main_part_; if (max_idx != VPOS) - d = min (d, durations[max_idx]); + d = std::min (d, durations[max_idx]); return Moment (d).smobbed_copy (); } @@ -237,14 +239,14 @@ set_column_rods (vector const &cols, Real padding) if (Separation_item::is_empty (r) && (!rb || Separation_item::is_empty (rb))) continue; - Skyline_pair *skys = Skyline_pair::unsmob (r->get_property ("horizontal-skylines")); + Skyline_pair *skys = unsmob (r->get_property ("horizontal-skylines")); overhangs[i] = skys ? (*skys)[RIGHT].max_height () : 0.0; if (0 == i) continue; /* min rather than max because stickout will be negative if the right-hand column sticks out a lot to the left */ - Real stickout = min (skys ? (*skys)[LEFT].max_height () : 0.0, + Real stickout = std::min (skys ? (*skys)[LEFT].max_height () : 0.0, Separation_item::conditional_skyline (r, cols[i - 1]).max_height ()); Real prev_distances = 0.0; @@ -261,7 +263,7 @@ set_column_rods (vector const &cols, Real padding) Item *lb = l->find_prebroken_piece (RIGHT); Real dist = Separation_item::set_distance (l, r, padding); - distances[i] = max (distances[i], dist - prev_distances); + distances[i] = std::max (distances[i], dist - prev_distances); if (lb) { @@ -270,7 +272,7 @@ set_column_rods (vector const &cols, Real padding) // right than the unbroken version, by extending farther and/or // nesting more closely; if (j == i - 1) // check this, the first time we see each lb. - overhangs[j] = max (overhangs[j], + overhangs[j] = std::max (overhangs[j], lb->extent (lb, X_AXIS)[RIGHT] + distances[i] - dist); } @@ -281,7 +283,7 @@ set_column_rods (vector const &cols, Real padding) prev_distances += distances[j]; } - overhangs[i] = max (overhangs[i], + overhangs[i] = std::max (overhangs[i], overhangs[i - 1] - distances[i]); } } @@ -351,10 +353,10 @@ Spacing_spanner::musical_column_spacing (Grob *me, /* This is probably a waste of time in the case of polyphonic music. */ - if (found_matching_column && Note_spacing::has_interface (wish)) + if (found_matching_column && has_interface (wish)) { Real inc = options->increment_; - Grob *gsp = Grob::unsmob (left_col->get_object ("grace-spacing")); + Grob *gsp = unsmob (left_col->get_object ("grace-spacing")); if (gsp && Paper_column::when_mom (left_col).grace_part_) { Spacing_options grace_opts; @@ -418,7 +420,7 @@ Spacing_spanner::musical_column_spacing (Grob *me, if (Paper_column::is_extraneous_column_from_ligature (left_col)) spring.set_distance (spring.min_distance ()); else - spring.set_distance (max (left_col->extent (left_col, X_AXIS)[RIGHT], + spring.set_distance (std::max (left_col->extent (left_col, X_AXIS)[RIGHT], spring.min_distance ())); spring.set_inverse_stretch_strength (1.0); @@ -447,7 +449,7 @@ Spacing_spanner::fills_measure (Grob *me, Item *left, Item *col) Moment dt = Paper_column::when_mom (next) - Paper_column::when_mom (col); - Moment *len = Moment::unsmob (left->get_property ("measure-length")); + Moment *len = unsmob (left->get_property ("measure-length")); if (!len) return false; @@ -489,7 +491,7 @@ Spacing_spanner::breakable_column_spacing (Grob *me, Item *l, Item *r, { Item *spacing_grob = dynamic_cast (wishes[i]); - if (!spacing_grob || !Staff_spacing::has_interface (spacing_grob)) + if (!spacing_grob || !has_interface (spacing_grob)) continue; /*