X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fside-position-interface.cc;h=deaaf5f3aae4b941a1edfce62f8a0277a2c6f250;hb=c0ba46b982f0bb0544c5267b5176c17d8d9d1447;hp=7ff38d6e4e686a1e03159a4594f62921cbde8f69;hpb=1e1fa5221ca359326b073626168c6b7cda6453e1;p=lilypond.git diff --git a/lily/side-position-interface.cc b/lily/side-position-interface.cc index 7ff38d6e4e..deaaf5f3aa 100644 --- a/lily/side-position-interface.cc +++ b/lily/side-position-interface.cc @@ -6,10 +6,12 @@ (c) 1998--2004 Han-Wen Nienhuys */ -#include // ceil. -#include "note-head.hh" #include "side-position-interface.hh" + +#include // ceil. + +#include "note-head.hh" #include "warn.hh" #include "warn.hh" #include "dimensions.hh" @@ -17,6 +19,7 @@ #include "group-interface.hh" #include "directional-element-interface.hh" #include "staff-symbol-referencer.hh" +#include "string-convert.hh" void Side_position_interface::add_support (Grob*me, Grob*e) @@ -60,12 +63,10 @@ Side_position_interface::aligned_on_support_extents (SCM element_smob, SCM axis) } -/* - Puts the element next to the support, optionally taking in - account the extent of the support. -*/ +/* Put the element next to the support, optionally taking in + account the extent of the support. */ SCM -Side_position_interface::general_side_position (Grob * me, Axis a, bool use_extents) +Side_position_interface::general_side_position (Grob *me, Axis a, bool use_extents) { Real ss = Staff_symbol_referencer::staff_space (me); SCM support = me->get_property ("side-support-elements"); @@ -84,7 +85,7 @@ Side_position_interface::general_side_position (Grob * me, Axis a, bool use_exte for (SCM s = support; s != SCM_EOL; s = scm_cdr (s)) { - Grob * e = unsmob_grob (scm_car (s)); + Grob *e = unsmob_grob (scm_car (s)); if (e) if (use_extents) dim.unite (e->extent (common, a)); @@ -96,14 +97,12 @@ Side_position_interface::general_side_position (Grob * me, Axis a, bool use_exte } if (dim.is_empty ()) - { - dim = Interval (0,0); - } + dim = Interval (0, 0); Direction dir = Side_position_interface::get_direction (me); - Real off = me->get_parent (a)->relative_coordinate (common, a); - Real minimum_space = ss * robust_scm2double (me->get_property ("minimum-space"), -1); + Real off = me->get_parent (a)->relative_coordinate (common, a); + Real minimum_space = ss * robust_scm2double (me->get_property ("minimum-space"), -1); Real total_off = dim.linear_combination (dir) - off; total_off += dir * ss * robust_scm2double (me->get_property ("padding"), 0); @@ -111,16 +110,18 @@ Side_position_interface::general_side_position (Grob * me, Axis a, bool use_exte if (minimum_space >= 0 && dir && total_off * dir < minimum_space) - { - total_off = minimum_space * dir; - } + total_off = minimum_space * dir; + /* FIXME: 100CM should relate to paper size. */ if (fabs (total_off) > 100 CM) - programming_error ("Huh ? Improbable staff side dim."); - - - - + { + String msg + = String_convert::form_string ("Improbable offset for grob %s: %f%s", + me->name ().to_str0 (), total_off, + INTERNAL_UNIT); + + programming_error (msg); + } return scm_make_real (total_off); }