]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/grob.cc
Doc-es: fix repeated word.
[lilypond.git] / lily / grob.cc
index a21ab9c5d9ae9c4bcd6f438f6db5b896fd0d3536..ed96f1d13a9b1386a4c64912c2d823684b397097 100644 (file)
@@ -1,7 +1,7 @@
 /*
   This file is part of LilyPond, the GNU music typesetter.
 
-  Copyright (C) 1997--2011 Han-Wen Nienhuys <hanwen@xs4all.nl>
+  Copyright (C) 1997--2012 Han-Wen Nienhuys <hanwen@xs4all.nl>
 
   LilyPond is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -170,6 +170,17 @@ Grob::get_print_stencil () const
             = *unsmob_stencil (scm_call_1 (ly_lily_module_constant ("stencil-whiteout"),
                                            retval.smobbed_copy ()));
         }
+
+      SCM id = get_property ("id");
+      if (scm_is_string (id))
+        {
+          SCM expr = scm_list_3 (ly_symbol2scm ("id"),
+                                 id,
+                                 retval.expr ());
+
+          retval = Stencil (retval.extent_box (), expr);
+        }
+
     }
 
   return retval;
@@ -598,7 +609,7 @@ Grob::fixup_refpoint ()
   VERTICAL ORDERING
 ****************************************************************/
 
-Grob*
+Grob *
 get_maybe_root_vertical_alignment (Grob *g, Grob *maybe)
 {
   if (!g)
@@ -609,17 +620,19 @@ get_maybe_root_vertical_alignment (Grob *g, Grob *maybe)
 
 }
 
-Grob*
+Grob *
 Grob::get_root_vertical_alignment (Grob *g)
 {
   return get_maybe_root_vertical_alignment (g, 0);
 }
 
-Grob*
+Grob *
 Grob::get_vertical_axis_group (Grob *g)
 {
   if (!g)
     return 0;
+  if (!g->get_parent (Y_AXIS))
+    return 0;
   if (Axis_group_interface::has_interface (g)
       && Align_interface::has_interface (g->get_parent (Y_AXIS)))
     return g;
@@ -644,20 +657,37 @@ Grob::get_vertical_axis_group_index (Grob *g)
 
 bool
 Grob::vertical_less (Grob *g1, Grob *g2)
+{
+  return internal_vertical_less (g1, g2, false);
+}
+
+bool
+Grob::pure_vertical_less (Grob *g1, Grob *g2)
+{
+  return internal_vertical_less (g1, g2, true);
+}
+
+bool
+Grob::internal_vertical_less (Grob *g1, Grob *g2, bool pure)
 {
   Grob *vag = get_root_vertical_alignment (g1);
-  if (!vag)
-    return false;
   if (!vag)
     {
       g1->programming_error ("grob does not belong to a VerticalAlignment?");
       return false;
     }
+
   Grob *ag1 = get_vertical_axis_group (g1);
   Grob *ag2 = get_vertical_axis_group (g2);
 
   extract_grob_set (vag, "elements", elts);
 
+  if (ag1 == ag2 && !pure)
+    {
+      Grob *common = g1->common_refpoint (g2, Y_AXIS);
+      return g1->relative_coordinate (common, Y_AXIS) > g2->relative_coordinate (common, Y_AXIS);
+    }
+
   for (vsize i = 0; i < elts.size (); i++)
     {
       if (elts[i] == ag1)
@@ -765,9 +795,11 @@ ADD_INTERFACE (Grob,
                "cause "
                "color "
                "cross-staff "
+               "id "
                "extra-X-extent "
                "extra-Y-extent "
                "extra-offset "
+               "forced-spacing "
                "interfaces "
                "layer "
                "meta "