return common;
}
-MAKE_SCHEME_CALLBACK (Axis_group_interface, calc_x_common, 1);
SCM
-Axis_group_interface::calc_x_common (SCM grob)
+Axis_group_interface::calc_common (Grob *me, Axis axis)
{
- Grob *me = unsmob_grob (grob);
-
extract_grob_set (me, "elements", elts);
- Grob *common = common_refpoint_of_array (elts, me, X_AXIS);
+ Grob *common = common_refpoint_of_array (elts, me, axis);
+ if (!common)
+ {
+ me->programming_error ("No common parent found in calc_common axis.");
+ return SCM_EOL;
+ }
+
return common->self_scm ();
}
+
+MAKE_SCHEME_CALLBACK (Axis_group_interface, calc_x_common, 1);
+SCM
+Axis_group_interface::calc_x_common (SCM grob)
+{
+ return calc_common (unsmob_grob (grob), X_AXIS);
+}
+
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);
- Grob *common = common_refpoint_of_array (elts, me, Y_AXIS);
- return common->self_scm ();
+ return calc_common (unsmob_grob (grob), Y_AXIS);
}
Interval
static bool has_axis (Grob *, Axis);
static void get_children (Grob *, vector<Grob*> *);
static Interval staff_extent (Grob *me, Grob *ref, Axis, Grob *staff, Axis);
+ static SCM calc_common (Grob *, Axis);
DECLARE_GROB_INTERFACE();
};