+#include "scommands.hh"
#include "tstream.hh"
#include "score.hh"
#include "sccol.hh"
#include "debug.hh"
#include "paper.hh"
+void
+Score::set(Paperdef*p)
+{
+ delete paper_;
+ paper_ = p;
+}
void
Score::output(String s)
{
OK();
- if (paper->outfile=="")
- paper->outfile = s;
+ if (paper_->outfile=="")
+ paper_->outfile = s;
- *mlog << "output to " << paper->outfile << "...\n";
- Tex_stream the_output(paper->outfile);
+ *mlog << "output to " << paper_->outfile << "...\n";
+ Tex_stream the_output(paper_->outfile);
pscore_->output(the_output);
}
void
Score::process()
{
- if (!paper)
- paper = new Paperdef;
-
- commands_.clean(last());
+ set(commands_->parse(last()));
+ commands_->print();
+
+ if (!paper_)
+ paper_ = new Paperdef;
+
+ commands_->clean(last());
/// distribute commands to disciples
distribute_commands();
*/
// todo
PCursor<Score_column*>
-Score::create_cols(Mtime w)
+Score::create_cols(Real w)
{
Score_column* c1 = new Score_column(w);
Score_column* c2 = new Score_column(w);
}
Score_column*
-Score::find_col(Mtime w,bool mus)
+Score::find_col(Real w,bool mus)
{
PCursor<Score_column*> scc(cols_);
for (; scc.ok(); scc++) {
Score::distribute_commands(void)
{
for (PCursor<Staff*> sc(staffs_); sc.ok(); sc++) {
- sc->add_commands(commands_);
+ sc->add_commands(*commands_);
}
}
void
pscore_->add(sc->pcol);
}
}
-Mtime
+Real
Score::last() const
{
- Mtime l = 0;
+ Real l = 0;
for (PCursor<Staff*> stc(staffs_); stc.ok(); stc++) {
l = MAX(l, stc->last());
}
for (PCursor<Score_column*> cc(cols_); cc.ok() && (cc+1).ok(); cc++) {
assert(cc->when <= (cc+1)->when);
}
- commands_.OK();
+ commands_->OK();
#endif
}
for (PCursor<Score_column*> sc(cols_); sc.ok(); sc++) {
sc->print();
}
- commands_.print();
+ commands_->print();
mtor << "}\n";
#endif
}
Score::Score()
{
pscore_=0;
- paper = 0;
+ paper_ = 0;
+ commands_ = new Score_commands;
}
+
+Score::~Score()
+{
+ delete pscore_;
+ delete commands_;
+ delete paper_;
+}
+
void
-Score::add(Command*c)
+Score::set(Score_commands*c)
{
- commands_.add(*c);
+ delete commands_;
+ commands_ = c;
}