]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/score.cc
patch::: 1.1.30.mb1: Re: LilyPond 1.1.30
[lilypond.git] / lily / score.cc
index 5e8fa7e7f12247dc077c5605fc8ac961cb42ff2b..455cebd63d3f879ef26fdbf5b37c50057770f874 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+  (c)  1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
 #include "score.hh"
 #include "music-iterator.hh"
 #include "music.hh"
 #include "global-translator.hh"
-#include "header.hh"
+#include "scope.hh"
 #include "cpu-timer.hh"
+#include "main.hh"
+#include "paper-def.hh"
 
-extern String default_out_fn;
 
 Score::Score()
+    : Input()
 {
   header_p_ = 0;
   music_p_ = 0;
@@ -28,11 +30,13 @@ Score::Score()
 }
 
 Score::Score (Score const &s)
+  : Input (s)
 {
-  music_p_ = s.music_p_->clone();
+  music_p_ = (s.music_p_) ? s.music_p_->clone() : 0;
   for (int i=0; i < s.def_p_arr_.size (); i++)
     def_p_arr_.push(s.def_p_arr_[i]->clone());
-  header_p_ = new Header (*s.header_p_);
+
+  header_p_ =  (s.header_p_) ? new Header (*s.header_p_): 0;
 }
 
 Score::~Score()
@@ -49,60 +53,67 @@ Score::run_translator (Music_output_def *odef_l)
   Cpu_timer timer;
   Global_translator * trans_p = odef_l->get_global_translator_p();
   if (!trans_p)
-    return ;
+    {
+      non_fatal_error (_("no toplevel translator"));
+      return ;
+    }
+  *mlog << '\n' << _("Interpreting music...") << flush;
+  trans_p->last_mom_ = music_p_->length_mom ();
+
+  Music_iterator * iter = Music_iterator::static_get_iterator_p (music_p_, trans_p);
   
-  *mlog << "\nInterpreting music ...";
-  trans_p->last_mom_ = music_p_->time_int().max ();
 
-  Music_iterator * iter = Music_iterator::static_get_iterator_p (music_p_, 
-                                                                trans_p);
   iter->construct_children();
 
-  if (! iter->ok()) 
+  if (! iter->ok())
     {
       delete iter;
-      warning ("Need music in a score");
+      warning (_("need music in a score"));
       errorlevel_i_ =1;
       return ;
     }
-  
+
   trans_p->start();
-  
-  while (iter->ok() || trans_p->moments_left_i ()) 
+
+  while (iter->ok() || trans_p->moments_left_i ())
     {
-      Moment w = infinity_mom;
-      if (iter->ok()) 
+      Moment w;
+      w.set_infinite (1);
+      if (iter->ok())
        {
          w = iter->next_moment();
-         DOUT << "proccing: " << w <<"\n";
-         iter->print();
+         DOUT << "proccing: " << w << '\n';
+         if (!monitor->silent_b ("walking"))
+           iter->print();
        }
+      
       trans_p->modify_next (w);
       trans_p->prepare (w);
-      trans_p->print();
+      
+      if (!monitor->silent_b ("walking"))
+       trans_p->print();
 
       iter->process_and_next (w);
       trans_p->process();
     }
+  
   delete iter;
   trans_p->finish();
 
-  
-  if (errorlevel_i_) 
+
+  if (errorlevel_i_)
     {
-      // should we? hampers debugging. 
-      warning ("Errors found, /*not processing score*/");
+      // should we? hampers debugging.
+      warning (_ ("errors found, /*not processing score*/"));
     }
-    
+
   Music_output * output = trans_p->get_output_p();
   delete trans_p;
-  *mlog << " (time: " << String(timer.read (), "%.2f") << " seconds)";
+  *mlog << endl << _f ("time: %.2f seconds",  timer.read ()) << flush;
 
-  
   output->header_l_ = header_p_;
-  output->default_out_str_ = default_out_fn;
   output->origin_str_ =  location_str();
-  
+
   *mlog << endl;
   output->process();
   delete output ;
@@ -116,17 +127,21 @@ Score::process()
 
   print();
   for (int i=0; i < def_p_arr_.size (); i++)
-    run_translator (def_p_arr_[i]);
+    {
+      if (no_paper_global_b 
+         && dynamic_cast<Paper_def*>(def_p_arr_[i]))
+       continue;
+      run_translator (def_p_arr_[i]);
+    }
 }
 
 
 
-
 void
 Score::print() const
 {
 #ifndef NPRINT
-  DOUT << "score {\n"; 
+  DOUT << "score {\n";
   music_p_ -> print ();
   for (int i=0; i < def_p_arr_.size (); i++)
     def_p_arr_[i]->print();
@@ -135,10 +150,7 @@ Score::print() const
 }
 
 void
-Score::add (Music_output_def *pap_p)
+Score::add_output (Music_output_def *pap_p)
 {
   def_p_arr_.push(pap_p);
 }
-
-
-