]> git.donarmstrong.com Git - lilypond.git/commitdiff
get child-refpoint in other direction
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 6 Jan 2007 20:28:35 +0000 (21:28 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 6 Jan 2007 20:28:35 +0000 (21:28 +0100)
lily/align-interface.cc
lily/axis-group-interface.cc
lily/include/axis-group-interface.hh
scm/define-grobs.scm

index 87b354a5f44a1317cd0e5b7a7c3f65544e0976ed..23b9527d296147e7934829aed218d1ed658d71c3 100644 (file)
@@ -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)
        {
index 7c09658c8ce273b99055c111be7745fd559ecd9d..6cebbce598121d38cd052fe8c874a9ff0349aeae 100644 (file)
@@ -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
index c634b52bb3ee02670c72fa0bf7bb2d6750670901..a4201d006c5b791e6c2a8dbc0216b12b44db4e4f 100644 (file)
@@ -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));
index 87ee472c3b193cbdfae0976af2e237e2b50ed6df..4d06aa3a03bb2172c55acda651343e35bf6837fb 100644 (file)
        (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))))))