From 7f8807b5aa8f04a6149d3fd9649da9627ca7517e Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Sat, 6 Jan 2007 21:28:35 +0100 Subject: [PATCH] get child-refpoint in other direction --- lily/align-interface.cc | 12 +++--------- lily/axis-group-interface.cc | 14 +++++++++++++- lily/include/axis-group-interface.hh | 1 + scm/define-grobs.scm | 2 +- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/lily/align-interface.cc b/lily/align-interface.cc index 87b354a5f4..23b9527d29 100644 --- a/lily/align-interface.cc +++ b/lily/align-interface.cc @@ -147,15 +147,9 @@ get_skylines (Grob *me, for (vsize i = 0; i < elements->size (); i++) { Grob *elt = (*elements)[i]; - Grob *child_common = 0; - - /* - should consider whether to restrict to Y_AXIS. - */ - if (a == Y_AXIS) - child_common = unsmob_grob (elt->get_object ("Y-common")); - else - child_common = unsmob_grob (elt->get_object ("X-common")); + Grob *child_common = unsmob_grob ((a == Y_AXIS) + ? elt->get_object ("X-common") + : elt->get_object ("Y-common")); if (!child_common) { diff --git a/lily/axis-group-interface.cc b/lily/axis-group-interface.cc index 7c09658c8c..6cebbce598 100644 --- a/lily/axis-group-interface.cc +++ b/lily/axis-group-interface.cc @@ -283,6 +283,17 @@ Axis_group_interface::calc_pure_elts_and_common (Grob *me) return common; } +MAKE_SCHEME_CALLBACK(Axis_group_interface,calc_x_common, 1); +SCM +Axis_group_interface::calc_x_common (SCM grob) +{ + Grob *me = unsmob_grob (grob); + + extract_grob_set (me, "elements", elts); + Grob *common = common_refpoint_of_array (elts, me, X_AXIS); + return common->self_scm (); +} + MAKE_SCHEME_CALLBACK(Axis_group_interface,calc_y_common, 1); SCM Axis_group_interface::calc_y_common (SCM grob) @@ -290,7 +301,8 @@ Axis_group_interface::calc_y_common (SCM grob) Grob *me = unsmob_grob (grob); extract_grob_set (me, "elements", elts); - return common_refpoint_of_array (elts, me, Y_AXIS)->self_scm (); + Grob *common = common_refpoint_of_array (elts, me, Y_AXIS); + return common->self_scm (); } SCM diff --git a/lily/include/axis-group-interface.hh b/lily/include/axis-group-interface.hh index c634b52bb3..a4201d006c 100644 --- a/lily/include/axis-group-interface.hh +++ b/lily/include/axis-group-interface.hh @@ -19,6 +19,7 @@ struct Axis_group_interface static SCM generic_group_extent (Grob *me, Axis a); static SCM pure_group_height (Grob *me, int start, int end); DECLARE_SCHEME_CALLBACK (width, (SCM smob)); + DECLARE_SCHEME_CALLBACK (calc_x_common, (SCM smob)); DECLARE_SCHEME_CALLBACK (calc_y_common, (SCM smob)); DECLARE_SCHEME_CALLBACK (height, (SCM smob)); DECLARE_SCHEME_CALLBACK (pure_height, (SCM smob, SCM start, SCM end)); diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index 87ee472c3b..4d06aa3a03 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -2013,7 +2013,7 @@ (X-extent . ,ly:axis-group-interface::width) (skylines . ,ly:axis-group-interface::calc-skylines); (meta . ((class . Spanner) - (object-callbacks . ((Y-common . ,ly:axis-group-interface::calc-y-common))) + (object-callbacks . ((X-common . ,ly:axis-group-interface::calc-x-common))) (interfaces . (axis-group-interface hara-kiri-group-spanner-interface vertically-spaceable-interface)))))) -- 2.39.2