]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/grob.cc
Merge branch 'lilypond/translation' of ssh://jomand@git.sv.gnu.org/srv/git/lilypond
[lilypond.git] / lily / grob.cc
index 78be89e399f147c6cefb42428e7896bd204308c9..e37fc94302bba8e1c2012db54952ee0287fa5e63 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 1997--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
+  (c) 1997--2009 Han-Wen Nienhuys <hanwen@xs4all.nl>
 */
 
 #include "grob.hh"
@@ -702,7 +702,17 @@ Grob::stencil_width (SCM smob)
   return grob_stencil_extent (me, X_AXIS);
 }
 
+Stream_event*
+Grob::event_cause ()
+{
+  SCM cause = get_property ("cause");
+  if (to_boolean (Stream_event::smob_p (cause)))
+    return unsmob_stream_event (cause);
+  else if (to_boolean (Grob::smob_p (cause)))
+    return unsmob_grob (cause)->event_cause ();
 
+  return 0;
+}
 
 Grob *
 common_refpoint_of_list (SCM elist, Grob *common, Axis a)
@@ -722,14 +732,11 @@ common_refpoint_of_list (SCM elist, Grob *common, Axis a)
 Grob *
 common_refpoint_of_array (vector<Grob*> const &arr, Grob *common, Axis a)
 {
-  for (vsize i = arr.size (); i--;)
-    if (Grob *s = arr[i])
-      {
-       if (common)
-         common = common->common_refpoint (s, a);
-       else
-         common = s;
-      }
+  for (vsize i = 0; i < arr.size (); i++)
+    if (common)
+      common = common->common_refpoint (arr[i], a);
+    else
+      common = arr[i];
 
   return common;
 }