]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/system-start-text.cc
Merge branch 'master' of git+ssh://jneem@git.sv.gnu.org/srv/git/lilypond
[lilypond.git] / lily / system-start-text.cc
index 1e7399409a2672915ace755028d79fe97539e14d..00795d22d749a743b8b381508f0816477e7ecc93 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
+  (c) 2006--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
 
 */
 
 #include "font-interface.hh"
 #include "spanner.hh"
 #include "stencil.hh"
+#include "item.hh"
 
 class System_start_text
 {
 public:
   static Stencil get_stencil (Grob *);
-  static bool has_interface (Grob *);
+  DECLARE_GROB_INTERFACE();
 
   DECLARE_SCHEME_CALLBACK (print, (SCM));
 };
@@ -56,7 +57,24 @@ System_start_text::print (SCM smob)
 {
   Spanner *me = unsmob_spanner (smob);
 
-  extract_grob_set (me, "elements", elts);
+  if (!me->get_bound (LEFT)->break_status_dir ())
+    {
+      me->suicide ();
+      return SCM_EOL;
+    }
+
+  extract_grob_set (me, "elements", all_elts);
+  vector<Grob*> elts;
+  for (vsize i = 0; i < all_elts.size (); i++)
+    if (all_elts[i]->is_live ())
+      elts.push_back (all_elts[i]);
+
+  if (!elts.size ())
+    {
+      me->suicide ();
+      return SCM_EOL;
+    }
+  
   Grob *common = common_refpoint_of_array (elts, me, Y_AXIS);
 
   Interval ext;
@@ -70,13 +88,13 @@ System_start_text::print (SCM smob)
     }
 
   Stencil m = get_stencil (me);
-  m.translate_axis (ext.center (), Y_AXIS);
+  if (!ext.is_empty ())
+    m.translate_axis (ext.center (), Y_AXIS);
   return m.smobbed_copy ();
 }
 
 
 ADD_INTERFACE (System_start_text,
-              "system-start-text-interface",
               "Text in front of the system.",
 
               /* properties */