X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fside-position-interface.cc;h=2e4591153a2a8af143c4630fad4f4ba0e31ab4e0;hb=aa2b5b377586a52fcb6b14d4dd464b94f6738560;hp=95eba005ee92f5173d1493068f4009a147fc7ed9;hpb=d2762a4f1add2bb04d6fc34d3c7ae03eeb7d500f;p=lilypond.git diff --git a/lily/side-position-interface.cc b/lily/side-position-interface.cc index 95eba005ee..2e4591153a 100644 --- a/lily/side-position-interface.cc +++ b/lily/side-position-interface.cc @@ -24,7 +24,6 @@ #include #include -using namespace std; #include "accidental-interface.hh" #include "accidental-placement.hh" @@ -48,6 +47,10 @@ using namespace std; #include "warn.hh" #include "unpure-pure-container.hh" +using std::set; +using std::string; +using std::vector; + void Side_position_interface::add_support (Grob *me, Grob *e) { @@ -65,14 +68,14 @@ get_support_set (Grob *me) for (vsize i = 0; i < proto_support.size (); i++) { - if (Accidental_placement::has_interface (proto_support[i])) + if (has_interface (proto_support[i])) { Grob *accs = proto_support[i]; for (SCM acs = accs->get_object ("accidental-grobs"); scm_is_pair (acs); acs = scm_cdr (acs)) for (SCM s = scm_cdar (acs); scm_is_pair (s); s = scm_cdr (s)) { - Grob *a = Grob::unsmob (scm_car (s)); + Grob *a = unsmob (scm_car (s)); support.insert (a); } } @@ -96,7 +99,7 @@ axis_aligned_side_helper (SCM smob, Axis a, bool pure, int start, int end, SCM c current_off_ptr = &r; } - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob (smob); // We will only ever want widths of spanners after line breaking // so we can set pure to false if (dynamic_cast (me) && a == X_AXIS) @@ -138,7 +141,7 @@ MAKE_SCHEME_CALLBACK (Side_position_interface, calc_cross_staff, 1) SCM Side_position_interface::calc_cross_staff (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob (smob); extract_grob_set (me, "side-support-elements", elts); Direction my_dir = get_grob_direction (me) ; @@ -212,7 +215,7 @@ Side_position_interface::aligned_side (Grob *me, Axis a, bool pure, int start, i pure, start, end); - if (Skyline_pair::is_smob (skyp)) + if (unsmob (skyp)) { // for spanner pure heights, we don't know horizontal spacing, // so a spanner can never have a meaningful x coordiante @@ -228,7 +231,7 @@ Side_position_interface::aligned_side (Grob *me, Axis a, bool pure, int start, i Real yc = a == X_AXIS ? me->pure_relative_y_coordinate (common[Y_AXIS], start, end) : me->get_parent (Y_AXIS)->maybe_pure_coordinate (common[Y_AXIS], Y_AXIS, pure, start, end); - Skyline_pair copy = *Skyline_pair::unsmob (skyp); + Skyline_pair copy = *unsmob (skyp); copy.shift (a == X_AXIS ? yc : xc); copy.raise (a == X_AXIS ? xc : yc); my_dim = copy[-dir]; @@ -252,7 +255,7 @@ Side_position_interface::aligned_side (Grob *me, Axis a, bool pure, int start, i continue; // so 'me' may not move in response to 'e' if (a == Y_AXIS - && Stem::has_interface (e)) + && has_interface (e)) { // If called as 'pure' we may not force a stem to set its direction, if (pure && !is_direction (e->get_property_data ("direction"))) @@ -271,7 +274,7 @@ Side_position_interface::aligned_side (Grob *me, Axis a, bool pure, int start, i start, end); - if (Skyline_pair::is_smob (sp)) + if (unsmob (sp)) { Real xc = pure && dynamic_cast (e) ? e->get_parent (X_AXIS)->relative_coordinate (common[X_AXIS], X_AXIS) @@ -281,9 +284,9 @@ Side_position_interface::aligned_side (Grob *me, Axis a, bool pure, int start, i Real yc = a == X_AXIS ? e->pure_relative_y_coordinate (common[Y_AXIS], start, end) : e->maybe_pure_coordinate (common[Y_AXIS], Y_AXIS, pure, start, end); - Skyline_pair copy = *Skyline_pair::unsmob (sp); + Skyline_pair copy = *unsmob (sp); if (a == Y_AXIS - && Stem::has_interface (e) + && has_interface (e) && to_boolean (me->get_maybe_pure_property ("add-stem-support", pure, start, end))) copy[dir].set_minimum_height (copy[dir].max_height ()); copy.shift (a == X_AXIS ? yc : xc); @@ -344,7 +347,7 @@ Side_position_interface::aligned_side (Grob *me, Axis a, bool pure, int start, i total_off = minimum_space * dir; if (current_off) - total_off = dir * max (dir * total_off, + total_off = dir * std::max (dir * total_off, dir * (*current_off)); /* FIXME: 1000 should relate to paper size. */ @@ -381,7 +384,7 @@ Side_position_interface::aligned_side (Grob *me, Axis a, bool pure, int start, i staff_span.widen (1); if (staff_span.contains (position) /* If we are between notehead and staff, quantize for ledger lines. */ - || (Note_head::has_interface (head) + || (has_interface (head) && dir * position < 0)) { total_off += (rounded - position) * 0.5 * ss; @@ -403,7 +406,7 @@ Side_position_interface::aligned_side (Grob *me, Axis a, bool pure, int start, i Real diff = (dir * staff_extent[dir] + staff_padding - dir * total_off + dir * (staff_position - parent_position)); - total_off += dir * max (diff, 0.0); + total_off += dir * std::max (diff, 0.0); } } return scm_from_double (total_off); @@ -439,7 +442,7 @@ MAKE_SCHEME_CALLBACK (Side_position_interface, move_to_extremal_staff, 1); SCM Side_position_interface::move_to_extremal_staff (SCM smob) { - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob (smob); System *sys = dynamic_cast (me->get_system ()); Direction dir = get_grob_direction (me); if (dir != DOWN) @@ -464,7 +467,7 @@ Side_position_interface::move_to_extremal_staff (SCM smob) Axis_group_interface::add_element (top_staff, me); // Remove any cross-staff side-support dependencies - Grob_array *ga = Grob_array::unsmob (me->get_object ("side-support-elements")); + Grob_array *ga = unsmob (me->get_object ("side-support-elements")); if (ga) { vector const &elts = ga->array ();