]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/grob.cc
* mf/merge.pe: new file.
[lilypond.git] / lily / grob.cc
index fe43a6218c368618ca06d1f812f7bbad146580d9..888e6836db9511097a1ae04989189b582b03486c 100644 (file)
@@ -6,8 +6,9 @@
   (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
+#include "grob.hh"
 
-#include <string.h>
+#include <cstring>
 #include <math.h>
 
 #include "main.hh"
@@ -17,9 +18,7 @@
 #include "misc.hh"
 #include "paper-score.hh"
 #include "stencil.hh"
-#include "grob.hh"
 #include "warn.hh"
-#include "spanner.hh"
 #include "system.hh"
 #include "item.hh"
 #include "stencil.hh"
@@ -49,7 +48,7 @@ Grob::Grob (SCM basicprops,
   key_ = key;
   /* FIXME: default should be no callback.  */
   self_scm_ = SCM_EOL;
-  pscore_= 0;
+  pscore_ = 0;
   status_ = 0;
   original_ = 0;
   immutable_property_alist_ =  basicprops;
@@ -60,6 +59,10 @@ Grob::Grob (SCM basicprops,
      GC. After smobify_self (), they are.  */
   smobify_self ();
 
+  /*
+    We always get a new key object for a new grob.
+   */
+  scm_gc_unprotect_object (key_->self_scm ());
   SCM meta = get_property ("meta");
   if (scm_is_pair (meta))
     {
@@ -87,7 +90,7 @@ Grob::Grob (SCM basicprops,
     {
       SCM l = get_property (onames[a]);
 
-      if (scm_ilength (l) >=0)
+      if (scm_ilength (l) >= 0)
        {
          dim_cache_[a].offset_callbacks_ = l;
          dim_cache_[a].offsets_left_ = scm_ilength (l);
@@ -411,7 +414,7 @@ Grob::extent (Grob *refp, Axis a) const
     ;
   else if (ly_c_procedure_p (d->dimension_))
     /* FIXME: add doco on types, and should typecheck maybe?  */
-    d->dimension_= scm_call_2 (d->dimension_, self_scm (), scm_int2num (a));
+    d->dimension_ = scm_call_2 (d->dimension_, self_scm (), scm_int2num (a));
   else
     return ext;
 
@@ -657,6 +660,13 @@ Grob::internal_has_interface (SCM k)
   return scm_c_memq (k, ifs) != SCM_BOOL_F;
 }
 
+Grob*
+Grob::get_parent (Axis a) const
+{
+  return  dim_cache_[a].parent_;
+}
+
+
 /** Return Array of Grobs in SCM list LST */
 Link_array<Grob>
 ly_scm2grobs (SCM lst)
@@ -728,8 +738,11 @@ ADD_INTERFACE (Grob, "grob-interface",
               "Y-extent-callback print-function extra-offset spacing-procedure "
               "context staff-symbol interfaces dependencies X-extent Y-extent extra-X-extent "
               "meta layer before-line-breaking-callback "
+              "axis-group-parent-X "
+              "axis-group-parent-Y "
               "after-line-breaking-callback extra-Y-extent minimum-X-extent "
               "minimum-Y-extent transparent tweak-count tweak-rank"
               );
 
 
+