]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/axis-group-engraver.cc
* configure.in: Test for and accept lmodern if EC fonts not found.
[lilypond.git] / lily / axis-group-engraver.cc
index 1bc232f4c5fc12dca618c12ba1e389eb53e465f9..c4967edfd3a134f3f3b3c0552d3b37440d02b85f 100644 (file)
@@ -9,7 +9,6 @@
 #include "spanner.hh"
 #include "paper-column.hh"
 #include "axis-group-interface.hh"
-#include "engraver.hh"
 #include "engraver-group-engraver.hh"
 #include "warn.hh"
 #include "context.hh"
@@ -35,6 +34,7 @@ public:
 
 Axis_group_engraver::Axis_group_engraver ()
 {
+  must_be_last_ = true;
   staffline_ = 0;
 }
 
@@ -85,7 +85,6 @@ Axis_group_engraver::finalize ()
 
   staffline_->set_bound (RIGHT,it);
 
-  typeset_grob (staffline_);
   staffline_ = 0;
 }
 
@@ -102,23 +101,38 @@ Axis_group_engraver::acknowledge_grob (Grob_info i)
 void
 Axis_group_engraver::process_acknowledged_grobs ()
 {
-  /* UGH UGH UGH */
+  if (!staffline_) 
+    return ;
+  
   for (int i=0; i < elts_.size (); i++)
     {
       Grob *par = elts_[i]->get_parent (Y_AXIS);
 
       if (!par || !Axis_group_interface::has_interface (par))
-       if (elts_[i]->is_empty (Y_AXIS))
-         {
-           /*
-             We have to do _something_, otherwise staff objects will
-             end up with System as parent.  
+       {
+         if (staffline_->get_parent (Y_AXIS)
+             && staffline_->get_parent (Y_AXIS) == elts_[i])
+           {
+             String msg = _("Axis_group_engraver: vertical group already has a parent.\n"
+                            "Do you have two Axis_group_engravers?\n"
+                            "Killing this vertical group.");
+             staffline_->warning (msg);
+             staffline_->suicide ();
+             staffline_ = 0;
+             break ;
+           }
+         else if (elts_[i]->is_empty (Y_AXIS))
+           {
+             /*
+               We have to do _something_, otherwise staff objects will
+               end up with System as parent.  
              
-            */
-           elts_[i]->set_parent (staffline_, Y_AXIS);
-         }
-       else
-         add_element (elts_[i]);
+             */
+             elts_[i]->set_parent (staffline_, Y_AXIS);
+           }
+         else
+           add_element (elts_[i]);
+       }
     }
   elts_.clear ();
 }
@@ -170,8 +184,9 @@ void
 Hara_kiri_engraver::acknowledge_grob (Grob_info i)
 {
   Axis_group_engraver::acknowledge_grob (i);
-  if (i.grob_->internal_has_interface (ly_symbol2scm ("rhythmic-grob-interface"))
-      || i.grob_->internal_has_interface (ly_symbol2scm ("lyric-interface"))
+  if (staffline_
+      && (i.grob_->internal_has_interface (ly_symbol2scm ("rhythmic-grob-interface"))
+         || i.grob_->internal_has_interface (ly_symbol2scm ("lyric-interface")))
       )
     {
       Hara_kiri_group_spanner::add_interesting_item (staffline_, i.grob_);