]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.32
authorfred <fred>
Sun, 24 Mar 2002 19:32:01 +0000 (19:32 +0000)
committerfred <fred>
Sun, 24 Mar 2002 19:32:01 +0000 (19:32 +0000)
src/inputscore.cc
src/inputstaff.cc

index 764c8e8509ff8116ca8f55a95044077b7462124d..a8a653982cdb9ab2639a393b71fcc3123d405ac3 100644 (file)
@@ -1,18 +1,19 @@
+/*
+  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 "paperdef.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)
@@ -23,51 +24,61 @@ Input_score::add(Input_staff*s)
 void
 Input_score::set(Paperdef*p)
 {
-    delete paper_;
-    paper_ = p;
+    delete paper_p_;
+    paper_p_ = p;
 }
 
-Input_score::Input_score(Input_score const&)
+Input_score::Input_score(Input_score const&s)
 {
-    assert(false);
+    paper_p_ = (s.paper_p_)? new Paperdef(*s.paper_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_);
+    Paperdef* paper_p=new Paperdef(*paper_p_);
     Score *s_p = new Score(paper_p);
     s_p->defined_ch_c_l_= defined_ch_c_l_;
     s_p->errorlevel_i_ = errorlevel_i_;
-    Array<Staff*> parsed_staffs;
+
     for (iter_top(staffs_,i); i.ok(); i++) {
-       Staff* staf_p=i->parse(s_p);
-       parsed_staffs.push(staf_p);
+       Staff* staf_p=i->parse(s_p, score_wide_music_p_);
        s_p->add(staf_p);
     }
-    int j = 0;
-    for (iter_top(staffs_,i); i.ok(); i++,j++) {
-       parsed_staffs[j]->do_commands(commands_, i->commands_);
-    }
+
     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()
 {
-    delete paper_;
+    delete paper_p_;
+    delete score_wide_music_p_;
 }
 
 Input_score::Input_score()
 {
+    score_wide_music_p_ =0;
     defined_ch_c_l_=0;
-    paper_= 0;
+    paper_p_= 0;
     errorlevel_i_ = 0;
 }
 
 void
 Input_score::print()const
 {
-    #ifndef NPRINT
+#ifndef NPRINT
     mtor << "Input_score {\n";
     for (iter_top(staffs_,i); i.ok(); i++) {
        i->print();
index d79aac1021f2f47c18173330a77183d8c766c6f4..116624574ca1f53ec90f48ddeb6aa2eb2fb17d11 100644 (file)
@@ -1,26 +1,16 @@
-#include "getcommand.hh"
 #include "debug.hh"
 #include "score.hh"
 #include "inputmusic.hh"
 #include "inputstaff.hh"
-#include "inputcommand.hh"
-#include "staffcommands.hh"
 #include "staff.hh"
 #include "complexstaff.hh"
 #include "lexer.hh"
 #include "lyricstaff.hh"
 
-void
-Input_staff::add(Array<Input_command*> &s)
-{
-    commands_.bottom().add(get_reset_command());
-    for (int i=0; i < s.size(); i++)
-       commands_.bottom().add(s[i]);
-    s.set_size(0);
-}
 
 Input_staff::Input_staff(String s)
 {
+    score_wide_music_p_ =0;
     type= s;
     defined_ch_c_l_ = 0;
 }
@@ -32,51 +22,36 @@ Input_staff::add(Input_music*m)
 }
 
 Staff*
-Input_staff::parse(Score*score_l)
+Input_staff::parse(Score*score_l, Input_music *default_score_wide)
 {
     Staff *p=0;
-#if 0
-    if (type == "simple")
-       p = new Melodic_staff;
-    else if (type == "rhythmic")
-       p = new Rhythmic_staff;
-    else
-#endif
-       
-       if (type == "melodic")
+    if (type == "melodic")
        p = new Complex_staff;
     else if (type == "lyric")
        p = new Lyric_staff;
     else
-       error( "Unknown staff-type `" + type +"\'", );
+       error( "Unknown staff-type `" + type +"\'", defined_ch_c_l_);
 
     p->score_l_ = score_l;
-    p->define_spot_str_ = "";  // todo
     
     for (iter_top(music_,i); i.ok(); i++) {
        Voice_list vl = i->convert();
        p->add(vl);
     }
-    
-    {
-       Array<String> mark_arr;
-       Array<Moment> moment_arr;
-       p->get_marks(mark_arr, moment_arr);
-       score_l->add_marks(mark_arr, moment_arr);
-    }
-    
+    Voice_list vl =  (score_wide_music_p_) ? score_wide_music_p_->convert()
+       : default_score_wide->convert();
+    p->add(vl);
     return p;
 }
 
 Input_staff::Input_staff(Input_staff const&s)
-{
-    
-    for (iter_top(s.commands_,i); i.ok(); i++)
-       commands_.bottom().add(new Input_command(**i));
+{    
     for (iter_top(s.music_,i); i.ok(); i++)
        add(i->clone());
     defined_ch_c_l_ = s.defined_ch_c_l_;
     type = s.type;
+    score_wide_music_p_ = (s.score_wide_music_p_) ?
+       s.score_wide_music_p_->clone() : 0;
 }
 
 void
@@ -84,10 +59,19 @@ Input_staff::print() const
 {
 #ifndef NPRINT
     mtor << "Input_staff {\n";
-    for (iter_top(commands_,i); i.ok(); i++)
-       i->print();
     for (iter_top(music_,i); i.ok(); i++)
        i->print();
     mtor << "}\n";
 #endif
 }
+void
+Input_staff::set_score_wide(Input_music *m_p)
+{
+    delete score_wide_music_p_;
+    score_wide_music_p_ = m_p;
+}
+
+Input_staff::~Input_staff()
+{
+    delete score_wide_music_p_;
+}