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)
{
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)
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
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));
(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))))))