]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/axis-group-interface.cc
Merge branch 'master' of ssh+git://git.sv.gnu.org/srv/git/lilypond
[lilypond.git] / lily / axis-group-interface.cc
index 0a82fe67131c859afd8aa95ad3df752877fb62d6..8089d316f948ac0e25b5f834a5ca8f7d72d94a63 100644 (file)
@@ -385,26 +385,33 @@ 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)
+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
@@ -628,7 +635,6 @@ Axis_group_interface::print (SCM smob)
 }
 
 ADD_INTERFACE (Axis_group_interface,
-
               "An object that groups other layout objects.",
 
               /* properties */