]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/score-engraver.cc
release: 1.5.19
[lilypond.git] / lily / score-engraver.cc
index a85c72c8952a2855197880a05376232baa89c5dc..9189ee71eb1a1d9dc28c687f86fbcda42fa58181 100644 (file)
@@ -19,6 +19,9 @@
 #include "translator-def.hh"
 
 
+/*
+  TODO: the column creation logic is rather hairy. Revise it.
+ */
 Score_engraver::Score_engraver ()
 {
   scoreline_l_ =0;
@@ -29,19 +32,17 @@ Score_engraver::Score_engraver ()
 }
 
 void
-Score_engraver::make_columns (Moment w)
+Score_engraver::make_columns ()
 {
   /*
     ugh.
    */
-  if (!command_column_l_
-      || *unsmob_moment (command_column_l_->get_grob_property ("when")) != w)
+  if (!command_column_l_)
+    //      || *unsmob_moment (command_column_l_->get_grob_property ("when")) != w)
     {
-      set_columns (new Paper_column (get_property (ly_symbol2scm ("NonMusicalPaperColumn"))),
-                  new Paper_column (get_property (ly_symbol2scm ("PaperColumn"))));
+      set_columns (new Paper_column (get_property ("NonMusicalPaperColumn")),
+                  new Paper_column (get_property ("PaperColumn")));
   
-      command_column_l_->set_grob_property ("when", w.smobbed_copy ());
-      musical_column_l_->set_grob_property ("when", w.smobbed_copy ());
       command_column_l_->set_grob_property ("breakable", SCM_BOOL_T);
 
       Grob_info i1 (command_column_l_, 0), i2 (musical_column_l_,0);
@@ -57,9 +58,9 @@ void
 Score_engraver::prepare (Moment w)
 {
   Global_translator::prepare (w);
-  make_columns (w);
 
-  post_move_processing ();
+  make_columns ();
+  start_translation_timestep ();
 }
 
 void
@@ -70,6 +71,7 @@ Score_engraver::finish ()
    
   check_removal ();
   removal_processing ();
+
 }
 
 /*
@@ -85,15 +87,13 @@ Score_engraver::initialize ()
   pscore_p_ = new Paper_score;
   pscore_p_->paper_l_ = dynamic_cast<Paper_def*> (output_def_l_);
 
-  SCM props = get_property (ly_symbol2scm ("LineOfScore"));
+  SCM props = get_property ("LineOfScore");
 
   pscore_p_->typeset_line (new Line_of_score (props));
   
-  make_columns (Moment (0));
+  make_columns ();
   scoreline_l_ = pscore_p_->line_l_;
-
   scoreline_l_->set_bound (LEFT, command_column_l_);
-  
   command_column_l_->set_grob_property ("breakable", SCM_BOOL_T);
 
   Engraver_group_engraver::initialize ();
@@ -104,20 +104,26 @@ void
 Score_engraver::finalize ()
 {
   Engraver_group_engraver::finalize ();
-  scoreline_l_->set_bound (RIGHT,command_column_l_);
-  command_column_l_->set_grob_property ("breakable", SCM_BOOL_T);
+
+  Grob * cc
+    = unsmob_grob (get_property ("currentCommandColumn"));
+  scoreline_l_->set_bound (RIGHT, cc);
+  cc->set_grob_property ("breakable", SCM_BOOL_T);
   
   typeset_all ();
-
-  set_columns (0,0);
 }
 
 void
 Score_engraver::one_time_step ()
 {
-  process_music ();
-  announces ();
-  pre_move_processing ();
+  if (!to_boolean (get_property ("skipTypesetting")))
+    {
+      process_music ();
+      announces ();
+    }
+
+  
+  stop_translation_timestep ();
   check_removal ();
 }
 
@@ -125,7 +131,7 @@ void
 Score_engraver::announce_grob (Grob_info info)
 {
   announce_info_arr_.push (info);
-  pscore_p_->line_l_->typeset_grob (info.elem_l_);
+  pscore_p_->line_l_->typeset_grob (info.grob_l_);
 }
 
 /* All elements are propagated to the top upon announcement. If
@@ -139,9 +145,7 @@ Score_engraver::announce_grob (Grob_info info)
 void
 Score_engraver::do_announces ()
 {
-  //////  do
-    Engraver_group_engraver::do_announces ();
-    //////while (announce_info_arr_.size ());
+  Engraver_group_engraver::do_announces ();
 }
 
 
@@ -212,25 +216,25 @@ Score_engraver::stop_translation_timestep ()
       if (! (breaks_i_%8))
        progress_indication ("[" + to_str (breaks_i_) + "]");
     }
+
+  command_column_l_->set_grob_property ("when", now_mom_.smobbed_copy ());
+  musical_column_l_->set_grob_property ("when", now_mom_.smobbed_copy ());
+
+  scoreline_l_->add_column (command_column_l_);
+  scoreline_l_->add_column (musical_column_l_);
+  
+  command_column_l_ = 0;
+  musical_column_l_ = 0;
 }
 
 void
 Score_engraver::set_columns (Paper_column *new_command_l, 
                             Paper_column *new_musical_l)
 {
-  Paper_column * news[] = {new_command_l, new_musical_l};
-  Paper_column **current[] = {&command_column_l_, &musical_column_l_};
-
-  for (int i=00; i< 2; i++) 
-    {
-      if (*current[i])
-       {
-         scoreline_l_->add_column ((*current[i]));
-       }
-      if (news[i])
-       *current[i] = news[i];
-    }
-
+  assert (!command_column_l_ && !musical_column_l_);
+  command_column_l_ = new_command_l;
+  musical_column_l_ = new_musical_l;
+  
   if (new_musical_l)
     set_property ("currentMusicalColumn", new_musical_l->self_scm ());
   if (new_command_l)
@@ -289,6 +293,23 @@ Score_engraver::forbid_breaks ()
   command_column_l_->remove_grob_property ("breakable");
 }
 
-ADD_THIS_TRANSLATOR (Score_engraver);
 
 
+
+ENTER_DESCRIPTION(Score_engraver,
+/* descr */       "Top level engraver. Takes care of generating columns and the complete  system (ie. LineOfScore)
+
+
+This engraver decides whether a column is breakable. The default is
+that a column is always breakable. However, when every Bar_engraver
+that does not have a barline at a certain point will call
+Score_engraver::forbid_breaks to stop linebreaks.  In practice, this
+means that you can make a breakpoint by creating a barline (assuming
+that there are no beams or notes that prevent a breakpoint.)
+
+
+",
+/* creats*/       "LineOfScore PaperColumn NonMusicalPaperColumn",
+/* acks  */       "grob-interface",
+/* reads */       "currentMusicalColumn currentCommandColumn",
+/* write */       "");