+/*
+ 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)
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();
-#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;
}
}
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 +"\'", 0 );
+ 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
{
#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_;
+}