]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/score-engraver.cc
2002-07-13 Han-Wen <hanwen@cs.uu.nl>
[lilypond.git] / lily / score-engraver.cc
index 8b4b4c76759b7c6f1bf1fb7c94fc55b352db7ebe..d4d5e0aab7b1dc55b4f9dd5516b111942cf3eca3 100644 (file)
@@ -6,8 +6,8 @@
   (c)  1997--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
-#include "debug.hh"
-
+#include "warn.hh"
+#include "main.hh"
 #include "system.hh"
 #include "item.hh"
 #include "score-engraver.hh"
@@ -46,14 +46,18 @@ Score_engraver::make_columns ()
   
       command_column_l_->set_grob_property ("breakable", SCM_BOOL_T);
 
+
       Grob_info i1 (command_column_l_);
       i1.origin_trans_l_ = this;
-
+  
       Grob_info i2 (musical_column_l_);
       i2.origin_trans_l_ = this;
 
+  
       announce_grob (i1);
       announce_grob (i2);
+
+      
     }
 }
 
@@ -62,12 +66,16 @@ Score_engraver::prepare (Moment w)
 {
   Global_translator::prepare (w);
 
+  /*
+    TODO: don't make columns when skipTypesetting is true.
+   */
   make_columns ();
-
+  
   command_column_l_->set_grob_property ("when", now_mom_.smobbed_copy ());
   musical_column_l_->set_grob_property ("when", now_mom_.smobbed_copy ());
+
   
-  start_translation_timestep ();
+  Translator_group::start_translation_timestep();
 }
 
 void
@@ -126,11 +134,26 @@ Score_engraver::one_time_step ()
   if (!to_boolean (get_property ("skipTypesetting")))
     {
       process_music ();
-      announces ();
+      do_announces ();
     }
   
   stop_translation_timestep ();
   check_removal ();
+
+
+  for (int i = announce_info_arr_.size(); i--;)
+    {
+      Grob *g = announce_info_arr_[i].grob_l_;
+      if (!dynamic_cast<Paper_column*> (g)) // ugh.
+       {
+      
+         String msg= "Grob "
+           + g->name()
+           + " was created too late!";
+         g->programming_error (msg);
+       }
+    }
+  announce_info_arr_.clear ();
 }
 
 void
@@ -138,11 +161,8 @@ Score_engraver::announce_grob (Grob_info info)
 {
   announce_info_arr_.push (info);
   pscore_p_->line_l_->typeset_grob (info.grob_l_);
-
-
 }
 
-
 void
 Score_engraver::typeset_grob (Grob *elem_p)
 {
@@ -153,7 +173,6 @@ Score_engraver::typeset_grob (Grob *elem_p)
     elem_p_arr_.push (elem_p);
 }
 
-
 void
 Score_engraver::typeset_all ()
 {
@@ -163,10 +182,10 @@ Score_engraver::typeset_all ()
       
       if (Spanner *s = dynamic_cast <Spanner *> (elem_p))
        {
-           /*
+         /*
            do something sensible if spanner not 
            spanned on 2 items.
-          */
+         */
          Direction d = LEFT;
          do {
            if (!s->get_bound (d))
@@ -175,12 +194,16 @@ Score_engraver::typeset_all ()
                /* don't warn for empty/suicided spanners,
                   it makes real warningsinvisible.
                   maybe should be junked earlier? */
-               if (elem_p->immutable_property_alist_ == SCM_EOL)
+               if (!elem_p->live())
                  ; // gdb hook
                else
                  elem_p->warning (_f ("unbound spanner `%s'", s->name ().ch_C ()));
              }
-         } while (flip (&d) != LEFT);
+         }
+         while (flip (&d) != LEFT);
+
+         if (dynamic_cast<Item*> (s->get_parent (Y_AXIS)))
+           programming_error ("Spanner Y-parent is an item.");
        }
       else 
        {
@@ -286,7 +309,8 @@ Score_engraver::forbid_breaks ()
   /*
     result is junked.
    */
-  command_column_l_->remove_grob_property ("breakable");
+  if (command_column_l_)
+    command_column_l_->remove_grob_property ("breakable");
 }
   
 void
@@ -295,8 +319,8 @@ Score_engraver::acknowledge_grob (Grob_info gi)
   if (Staff_spacing::has_interface (gi.grob_l_))
     {
       Pointer_group_interface::add_grob (command_column_l_,
-                                           ly_symbol2scm ("spacing-wishes"),
-                                           gi.grob_l_);
+                                        ly_symbol2scm ("spacing-wishes"),
+                                        gi.grob_l_);
     }
   if (Note_spacing::has_interface (gi.grob_l_))
     {