X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fself-aligment-interface.cc;h=9da0a406c212007d5250295df81a0dbd5af578d8;hb=428909a52eedefe201a8cd89876336f76e29fa28;hp=5035e1e616f094811ae590c697b433c485a7e4ef;hpb=332da9f4d25f9f63a3222efc87fae06b0c7abbdd;p=lilypond.git diff --git a/lily/self-aligment-interface.cc b/lily/self-aligment-interface.cc index 5035e1e616..9da0a406c2 100644 --- a/lily/self-aligment-interface.cc +++ b/lily/self-aligment-interface.cc @@ -1,9 +1,9 @@ /* self-alignment-interface.cc - + source file of the GNU LilyPond music typesetter - - (c) 2004 Han-Wen Nienhuys + + (c) 2004--2005 Han-Wen Nienhuys */ #include "self-alignment-interface.hh" @@ -19,8 +19,8 @@ Self_alignment_interface::centered_on_parent (SCM element_smob, SCM axis) Axis a = (Axis) scm_to_int (axis); Grob *him = me->get_parent (a); Interval he = him->extent (him, a); - - return scm_make_real (he.is_empty () ? 0.0 : he.center ()); + + return scm_make_real (he.is_empty () ? 0.0 : he.center ()); } MAKE_SCHEME_CALLBACK (Self_alignment_interface, aligned_on_parent, 2); @@ -31,7 +31,7 @@ Self_alignment_interface::aligned_on_parent (SCM element_smob, SCM axis) Axis a = (Axis) scm_to_int (axis); Grob *him = me->get_parent (a); Interval he = him->extent (him, a); - + SCM sym = (a == X_AXIS) ? ly_symbol2scm ("self-alignment-X") : ly_symbol2scm ("self-alignment-Y"); SCM align_prop (me->internal_get_property (sym)); @@ -41,12 +41,12 @@ Self_alignment_interface::aligned_on_parent (SCM element_smob, SCM axis) Real x = 0.0; Real align = scm_to_double (align_prop); - + Interval ext (me->extent (me, a)); if (ext.is_empty ()) - programming_error ("I'm empty. Can't align on self"); + programming_error ("can't align on self: empty element"); else - x -= ext.linear_combination (align) ; + x -= ext.linear_combination (align); if (!he.is_empty ()) x += he.linear_combination (align); @@ -57,15 +57,15 @@ Self_alignment_interface::aligned_on_parent (SCM element_smob, SCM axis) /* Position centered on parent. */ MAKE_SCHEME_CALLBACK (Self_alignment_interface, centered_on_other_axis_parent, 2); SCM -Self_alignment_interface::centered_on_other_axis_parent (SCM element_smob, +Self_alignment_interface::centered_on_other_axis_parent (SCM element_smob, SCM axis) { Grob *me = unsmob_grob (element_smob); Axis a = (Axis) scm_to_int (axis); Grob *him = me->get_parent (other_axis (a)); Interval he = him->extent (him, a); - - return scm_make_real (he.is_empty () ? 0.0 : he.center ()); + + return scm_make_real (he.is_empty () ? 0.0 : he.center ()); } /** callback that centers the element on itself @@ -79,20 +79,19 @@ Self_alignment_interface::aligned_on_self (SCM element_smob, SCM axis) SCM sym = (a == X_AXIS) ? ly_symbol2scm ("self-alignment-X") : ly_symbol2scm ("self-alignment-Y"); - + SCM align (me->internal_get_property (sym)); if (scm_is_number (align)) { Interval ext (me->extent (me, a)); if (ext.is_empty ()) - programming_error ("I'm empty. Can't align on self"); + programming_error ("can't align on self: empty element"); else return scm_make_real (- ext.linear_combination (scm_to_double (align))); } return scm_make_real (0.0); } - ADD_INTERFACE (Self_alignment_interface, "self-alignment-interface", "Position this object on itself and/or on its parent. To this end, the following functions " " are provided: \n" @@ -106,6 +105,6 @@ ADD_INTERFACE (Self_alignment_interface, "self-alignment-interface", " extent of the parent \n" "@item Self_alignment_interface::centered_on_other_axis_parent\n" " For X-axis, center on the Y-parent, and vice versa.\n " - "@end table\n", + "@end table\n", "self-alignment-X self-alignment-Y");