]> git.donarmstrong.com Git - lilypond.git/blobdiff - src/inputscore.cc
partial: 0.0.38.hanjan
[lilypond.git] / src / inputscore.cc
index cdc348c725fd3f5f9d78a5509293f06285290bd6..6fca9dc8eb8db3aaf96f58788d561b794b60992c 100644 (file)
@@ -1,17 +1,20 @@
+/*
+  inputscore.cc -- implement Input_score
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
 #include "debug.hh"
-#include "inputcommand.hh"
 #include "inputscore.hh"
 #include "inputstaff.hh"
+#include "inputmusic.hh"
 #include "score.hh"
-#include "paper.hh"
+#include "paperdef.hh"
+#include "mididef.hh"
+#include "staff.hh"
 
-void
-Input_score::add(Array<Input_command*> &s)
-{
-    commands_.bottom().add(get_reset_command());
-    for (int i=0; i < s.size(); i++)
-       commands_.bottom().add(s[i]);
-}
 
 void
 Input_score::add(Input_staff*s)
@@ -22,41 +25,78 @@ Input_score::add(Input_staff*s)
 void
 Input_score::set(Paperdef*p)
 {
-    delete paper_;
-    paper_ = p;
+    delete paper_p_;
+    paper_p_ = p;
+}
+
+void
+Input_score::set(Midi_def* midi_p)
+{
+    delete midi_p_;
+    midi_p_ = midi_p;
+}
+Input_score::Input_score(Input_score const&s)
+{
+    paper_p_ = (s.paper_p_)? new Paperdef(*s.paper_p_) :0;
+    midi_p_ = (s.midi_p_)? new Midi_def(*s.midi_p_) : 0;
+    defined_ch_c_l_ = s.defined_ch_c_l_;
+    errorlevel_i_ = s.errorlevel_i_;
+    score_wide_music_p_ = (s.score_wide_music_p_) ?
+       s.score_wide_music_p_->clone():0;
 }
 
 Score*
 Input_score::parse()
 {
-    Paperdef* paper_p=new Paperdef(*paper_);
-    Score *s_p = new Score(paper_p);
-    
+    Score *s_p = new Score;
+    s_p->defined_ch_c_l_= defined_ch_c_l_;
+    s_p->errorlevel_i_ = errorlevel_i_;
+    if (midi_p_)
+       s_p->set(new Midi_def(*midi_p_));
+    if (paper_p_)
+       s_p->set(    new Paperdef(*paper_p_));
+
     for (iter_top(staffs_,i); i.ok(); i++) {
-       Staff* staf_p=i->parse(commands_, s_p);
+       Staff* staf_p=i->parse(s_p, score_wide_music_p_);
        s_p->add(staf_p);
     }
+
     return s_p;
 }
 
+void
+Input_score::set(Input_music *m_p)
+{
+    delete score_wide_music_p_;
+    score_wide_music_p_ =m_p;    
+}
+
+
 Input_score::~Input_score()
 {
-    // TODO!
-//should fix paper/symtabs to allow this deletion.
-//    delete paper_;
+    delete paper_p_;
+    delete score_wide_music_p_;
+    delete midi_p_;
 }
 
 Input_score::Input_score()
 {
-    paper_= 0;
+    score_wide_music_p_ =0;
+    defined_ch_c_l_=0;
+    paper_p_= 0;
+    midi_p_ = 0;
+    errorlevel_i_ = 0;
 }
 
 void
 Input_score::print()const
 {
+#ifndef NPRINT
     mtor << "Input_score {\n";
     for (iter_top(staffs_,i); i.ok(); i++) {
        i->print();
     }
     mtor << "}\n";
+#endif
 }